Skip to content

Commit 2c9bc77

Browse files
SteffenDEbenbrandt
andauthored
feat: add unstable session/close (#81)
* add unstable session/stop See agentclientprotocol/agent-client-protocol#577. * update schema and rename stop to close * Fix generation issues... --------- Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
1 parent b4df57e commit 2c9bc77

File tree

7 files changed

+399
-310
lines changed

7 files changed

+399
-310
lines changed

schema/meta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"authenticate": "authenticate",
44
"initialize": "initialize",
55
"session_cancel": "session/cancel",
6+
"session_close": "session/close",
67
"session_fork": "session/fork",
78
"session_list": "session/list",
89
"session_load": "session/load",
@@ -11,8 +12,7 @@
1112
"session_resume": "session/resume",
1213
"session_set_config_option": "session/set_config_option",
1314
"session_set_mode": "session/set_mode",
14-
"session_set_model": "session/set_model",
15-
"session_stop": "session/stop"
15+
"session_set_model": "session/set_model"
1616
},
1717
"clientMethods": {
1818
"fs_read_text_file": "fs/read_text_file",

schema/schema.json

Lines changed: 120 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,10 @@
263263
{
264264
"allOf": [
265265
{
266-
"$ref": "#/$defs/StopSessionResponse"
266+
"$ref": "#/$defs/CloseSessionResponse"
267267
}
268268
],
269-
"title": "StopSessionResponse"
269+
"title": "CloseSessionResponse"
270270
},
271271
{
272272
"allOf": [
@@ -866,7 +866,7 @@
866866
"$ref": "#/$defs/ListSessionsRequest"
867867
}
868868
],
869-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nLists existing sessions known to the agent.\n\nThis method is only available if the agent advertises the `listSessions` capability.\n\nThe agent should return metadata about sessions with optional filtering and pagination support.",
869+
"description": "Lists existing sessions known to the agent.\n\nThis method is only available if the agent advertises the `sessionCapabilities.list` capability.\n\nThe agent should return metadata about sessions with optional filtering and pagination support.",
870870
"title": "ListSessionsRequest"
871871
},
872872
{
@@ -890,11 +890,11 @@
890890
{
891891
"allOf": [
892892
{
893-
"$ref": "#/$defs/StopSessionRequest"
893+
"$ref": "#/$defs/CloseSessionRequest"
894894
}
895895
],
896-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nStops an active session and frees up any resources associated with it.\n\nThis method is only available if the agent advertises the `session.stop` capability.\n\nThe agent must cancel any ongoing work (as if `session/cancel` was called)\nand then free up any resources associated with the session.",
897-
"title": "StopSessionRequest"
896+
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCloses an active session and frees up any resources associated with it.\n\nThis method is only available if the agent advertises the `session.close` capability.\n\nThe agent must cancel any ongoing work (as if `session/cancel` was called)\nand then free up any resources associated with the session.",
897+
"title": "CloseSessionRequest"
898898
},
899899
{
900900
"allOf": [
@@ -1059,6 +1059,41 @@
10591059
],
10601060
"x-docs-ignore": true
10611061
},
1062+
"CloseSessionRequest": {
1063+
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for closing an active session.\n\nIf supported, the agent **must** cancel any ongoing work related to the session\n(treat it as if `session/cancel` was called) and then free up any resources\nassociated with the session.\n\nOnly available if the Agent supports the `session.close` capability.",
1064+
"properties": {
1065+
"_meta": {
1066+
"additionalProperties": true,
1067+
"description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1068+
"type": ["object", "null"]
1069+
},
1070+
"sessionId": {
1071+
"allOf": [
1072+
{
1073+
"$ref": "#/$defs/SessionId"
1074+
}
1075+
],
1076+
"description": "The ID of the session to close."
1077+
}
1078+
},
1079+
"required": ["sessionId"],
1080+
"type": "object",
1081+
"x-method": "session/close",
1082+
"x-side": "agent"
1083+
},
1084+
"CloseSessionResponse": {
1085+
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from closing a session.",
1086+
"properties": {
1087+
"_meta": {
1088+
"additionalProperties": true,
1089+
"description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
1090+
"type": ["object", "null"]
1091+
}
1092+
},
1093+
"type": "object",
1094+
"x-method": "session/close",
1095+
"x-side": "agent"
1096+
},
10621097
"ConfigOptionUpdate": {
10631098
"description": "Session configuration options have been updated.",
10641099
"properties": {
@@ -1407,13 +1442,6 @@
14071442
"Error": {
14081443
"description": "JSON-RPC error object.\n\nRepresents an error that occurred during method execution, following the\nJSON-RPC 2.0 error object specification with optional additional data.\n\nSee protocol docs: [JSON-RPC Error Object](https://www.jsonrpc.org/specification#error_object)",
14091444
"properties": {
1410-
"authMethods": {
1411-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAuthentication methods relevant to this error.\nTypically included with `AUTH_REQUIRED` errors to narrow down which\nauthentication methods are applicable from those shared during initialization.",
1412-
"items": {
1413-
"$ref": "#/$defs/AuthMethod"
1414-
},
1415-
"type": "array"
1416-
},
14171445
"code": {
14181446
"allOf": [
14191447
{
@@ -1842,7 +1870,7 @@
18421870
"x-side": "client"
18431871
},
18441872
"ListSessionsRequest": {
1845-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for listing existing sessions.\n\nOnly available if the Agent supports the `listSessions` capability.",
1873+
"description": "Request parameters for listing existing sessions.\n\nOnly available if the Agent supports the `sessionCapabilities.list` capability.",
18461874
"properties": {
18471875
"_meta": {
18481876
"additionalProperties": true,
@@ -1863,7 +1891,7 @@
18631891
"x-side": "agent"
18641892
},
18651893
"ListSessionsResponse": {
1866-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from listing sessions.",
1894+
"description": "Response from listing sessions.",
18671895
"properties": {
18681896
"_meta": {
18691897
"additionalProperties": true,
@@ -2855,7 +2883,7 @@
28552883
"type": "null"
28562884
}
28572885
],
2858-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/list`."
2886+
"description": "Whether the agent supports `session/list`."
28592887
},
28602888
"resume": {
28612889
"anyOf": [
@@ -2871,15 +2899,37 @@
28712899
"stop": {
28722900
"anyOf": [
28732901
{
2874-
"$ref": "#/$defs/SessionStopCapabilities"
2902+
"$ref": "#/$defs/SessionCloseCapabilities"
28752903
},
28762904
{
28772905
"type": "null"
28782906
}
28792907
],
2880-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/stop`."
2908+
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/close`."
2909+
}
2910+
},
2911+
"type": "object"
2912+
},
2913+
"SessionCloseCapabilities": {
2914+
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for the `session/close` method.\n\nBy supplying `{}` it means that the agent supports closing of sessions.",
2915+
"properties": {
2916+
"_meta": {
2917+
"additionalProperties": true,
2918+
"description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
2919+
"type": ["object", "null"]
2920+
}
2921+
},
2922+
"type": "object"
2923+
},
2924+
"SessionConfigBoolean": {
2925+
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA boolean on/off toggle session configuration option payload.",
2926+
"properties": {
2927+
"currentValue": {
2928+
"description": "The current value of the boolean option.",
2929+
"type": "boolean"
28812930
}
28822931
},
2932+
"required": ["currentValue"],
28832933
"type": "object"
28842934
},
28852935
"SessionConfigGroupId": {
@@ -2911,6 +2961,22 @@
29112961
},
29122962
"required": ["type"],
29132963
"type": "object"
2964+
},
2965+
{
2966+
"allOf": [
2967+
{
2968+
"$ref": "#/$defs/SessionConfigBoolean"
2969+
}
2970+
],
2971+
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nBoolean on/off toggle.",
2972+
"properties": {
2973+
"type": {
2974+
"const": "boolean",
2975+
"type": "string"
2976+
}
2977+
},
2978+
"required": ["type"],
2979+
"type": "object"
29142980
}
29152981
],
29162982
"properties": {
@@ -3098,7 +3164,7 @@
30983164
"type": "string"
30993165
},
31003166
"SessionInfo": {
3101-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInformation about a session returned by session/list",
3167+
"description": "Information about a session returned by session/list",
31023168
"properties": {
31033169
"_meta": {
31043170
"additionalProperties": true,
@@ -3149,7 +3215,7 @@
31493215
"type": "object"
31503216
},
31513217
"SessionListCapabilities": {
3152-
"description": "Capabilities for the `session/list` method.\n\nBy supplying `{}` it means that the agent supports listing of sessions.\n\nFurther capabilities can be added in the future for other means of filtering or searching the list.",
3218+
"description": "Capabilities for the `session/list` method.\n\nBy supplying `{}` it means that the agent supports listing of sessions.",
31533219
"properties": {
31543220
"_meta": {
31553221
"additionalProperties": true,
@@ -3279,17 +3345,6 @@
32793345
},
32803346
"type": "object"
32813347
},
3282-
"SessionStopCapabilities": {
3283-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for the `session/stop` method.\n\nBy supplying `{}` it means that the agent supports stopping of sessions.",
3284-
"properties": {
3285-
"_meta": {
3286-
"additionalProperties": true,
3287-
"description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3288-
"type": ["object", "null"]
3289-
}
3290-
},
3291-
"type": "object"
3292-
},
32933348
"SessionUpdate": {
32943349
"description": "Different types of updates that can be sent during session processing.\n\nThese updates provide real-time feedback about the agent's progress.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)",
32953350
"discriminator": {
@@ -3475,6 +3530,39 @@
34753530
]
34763531
},
34773532
"SetSessionConfigOptionRequest": {
3533+
"anyOf": [
3534+
{
3535+
"description": "A boolean value (`type: \"boolean\"`).",
3536+
"properties": {
3537+
"type": {
3538+
"const": "boolean",
3539+
"type": "string"
3540+
},
3541+
"value": {
3542+
"description": "The boolean value.",
3543+
"type": "boolean"
3544+
}
3545+
},
3546+
"required": ["type", "value"],
3547+
"type": "object"
3548+
},
3549+
{
3550+
"description": "A [`SessionConfigValueId`] string value.\n\nThis is the default when `type` is absent on the wire. Unknown `type`\nvalues with string payloads also gracefully deserialize into this\nvariant.",
3551+
"properties": {
3552+
"value": {
3553+
"allOf": [
3554+
{
3555+
"$ref": "#/$defs/SessionConfigValueId"
3556+
}
3557+
],
3558+
"description": "The value ID."
3559+
}
3560+
},
3561+
"required": ["value"],
3562+
"title": "value_id",
3563+
"type": "object"
3564+
}
3565+
],
34783566
"description": "Request parameters for setting a session configuration option.",
34793567
"properties": {
34803568
"_meta": {
@@ -3497,17 +3585,9 @@
34973585
}
34983586
],
34993587
"description": "The ID of the session to set the configuration option for."
3500-
},
3501-
"value": {
3502-
"allOf": [
3503-
{
3504-
"$ref": "#/$defs/SessionConfigValueId"
3505-
}
3506-
],
3507-
"description": "The ID of the configuration option value to set."
35083588
}
35093589
},
3510-
"required": ["sessionId", "configId", "value"],
3590+
"required": ["sessionId", "configId"],
35113591
"type": "object",
35123592
"x-method": "session/set_config_option",
35133593
"x-side": "agent"
@@ -3649,41 +3729,6 @@
36493729
}
36503730
]
36513731
},
3652-
"StopSessionRequest": {
3653-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for stopping an active session.\n\nIf supported, the agent **must** cancel any ongoing work related to the session\n(treat it as if `session/cancel` was called) and then free up any resources\nassociated with the session.\n\nOnly available if the Agent supports the `session.stop` capability.",
3654-
"properties": {
3655-
"_meta": {
3656-
"additionalProperties": true,
3657-
"description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3658-
"type": ["object", "null"]
3659-
},
3660-
"sessionId": {
3661-
"allOf": [
3662-
{
3663-
"$ref": "#/$defs/SessionId"
3664-
}
3665-
],
3666-
"description": "The ID of the session to stop."
3667-
}
3668-
},
3669-
"required": ["sessionId"],
3670-
"type": "object",
3671-
"x-method": "session/stop",
3672-
"x-side": "agent"
3673-
},
3674-
"StopSessionResponse": {
3675-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from stopping a session.",
3676-
"properties": {
3677-
"_meta": {
3678-
"additionalProperties": true,
3679-
"description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
3680-
"type": ["object", "null"]
3681-
}
3682-
},
3683-
"type": "object",
3684-
"x-method": "session/stop",
3685-
"x-side": "agent"
3686-
},
36873732
"Terminal": {
36883733
"description": "Embed a terminal created with `terminal/create` by its id.\n\nThe terminal must be added before calling `terminal/release`.\n\nSee protocol docs: [Terminal](https://agentclientprotocol.com/protocol/terminals)",
36893734
"properties": {

scripts/generate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as fs from "fs/promises";
55
import { dirname } from "path";
66
import * as prettier from "prettier";
77

8-
const CURRENT_SCHEMA_RELEASE = "v0.11.0";
8+
const CURRENT_SCHEMA_RELEASE = "v0.11.1";
99

1010
await main();
1111

0 commit comments

Comments
 (0)