Skip to content

Commit e4a892b

Browse files
benbrandtSteffenDE
andauthored
feat(unstable): Draft implementation of session/fork (#311)
Co-authored-by: Steffen Deusch <[email protected]>
1 parent 1c8a9fe commit e4a892b

File tree

7 files changed

+425
-1
lines changed

7 files changed

+425
-1
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ categories = ["development-tools", "api-bindings"]
1414
include = ["/src/**/*.rs", "/README.md", "/LICENSE", "/Cargo.toml"]
1515

1616
[features]
17-
unstable = ["unstable_session_model", "unstable_session_list"]
17+
unstable = ["unstable_session_model", "unstable_session_list", "unstable_session_fork"]
1818
unstable_session_model = []
1919
unstable_session_list = []
20+
unstable_session_fork = []
2021

2122
[[bin]]
2223
name = "generate"

docs/protocol/schema.unstable.mdx

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,88 @@ See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/exte
196196
The ID of the session to cancel operations for.
197197
</ResponseField>
198198

199+
<a id="session-fork"></a>
200+
### <span class="font-mono">session/fork</span>
201+
202+
**UNSTABLE**
203+
204+
This capability is not part of the spec yet, and may be removed or changed at any point.
205+
206+
Forks an existing session to create a new independent session.
207+
208+
This method is only available if the agent advertises the `session.fork` capability.
209+
210+
The agent should create a new session with the same conversation context as the
211+
original, allowing operations like generating summaries without affecting the
212+
original session's history.
213+
214+
#### <span class="font-mono">ForkSessionRequest</span>
215+
216+
**UNSTABLE**
217+
218+
This capability is not part of the spec yet, and may be removed or changed at any point.
219+
220+
Request parameters for forking an existing session.
221+
222+
Creates a new session based on the context of an existing one, allowing
223+
operations like generating summaries without affecting the original session's history.
224+
225+
Only available if the Agent supports the `session.fork` capability.
226+
227+
**Type:** Object
228+
229+
**Properties:**
230+
231+
<ResponseField name="_meta" type={"object"} >
232+
The _meta property is reserved by ACP to allow clients and agents to attach additional
233+
metadata to their interactions. Implementations MUST NOT make assumptions about values at
234+
these keys.
235+
236+
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
237+
238+
</ResponseField>
239+
<ResponseField name="sessionId" type={<a href="#sessionid">SessionId</a>} required>
240+
The ID of the session to fork.
241+
</ResponseField>
242+
243+
#### <span class="font-mono">ForkSessionResponse</span>
244+
245+
**UNSTABLE**
246+
247+
This capability is not part of the spec yet, and may be removed or changed at any point.
248+
249+
Response from forking an existing session.
250+
251+
**Type:** Object
252+
253+
**Properties:**
254+
255+
<ResponseField name="_meta" type={"object"} >
256+
The _meta property is reserved by ACP to allow clients and agents to attach additional
257+
metadata to their interactions. Implementations MUST NOT make assumptions about values at
258+
these keys.
259+
260+
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
261+
262+
</ResponseField>
263+
<ResponseField name="models" type={<><span><a href="#sessionmodelstate">SessionModelState</a></span><span> | null</span></>} >
264+
**UNSTABLE**
265+
266+
This capability is not part of the spec yet, and may be removed or changed at any point.
267+
268+
Initial model state if supported by the Agent
269+
270+
</ResponseField>
271+
<ResponseField name="modes" type={<><span><a href="#sessionmodestate">SessionModeState</a></span><span> | null</span></>} >
272+
Initial mode state if supported by the Agent
273+
274+
See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)
275+
276+
</ResponseField>
277+
<ResponseField name="sessionId" type={<a href="#sessionid">SessionId</a>} required>
278+
Unique identifier for the newly created forked session.
279+
</ResponseField>
280+
199281
<a id="session-list"></a>
200282
### <span class="font-mono">session/list</span>
201283

@@ -2591,6 +2673,14 @@ these keys.
25912673

25922674
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
25932675

2676+
</ResponseField>
2677+
<ResponseField name="fork" type={<><span><a href="#sessionforkcapabilities">SessionForkCapabilities</a></span><span> | null</span></>} >
2678+
**UNSTABLE**
2679+
2680+
This capability is not part of the spec yet, and may be removed or changed at any point.
2681+
2682+
Whether the agent supports `session/fork`.
2683+
25942684
</ResponseField>
25952685
<ResponseField name="list" type={<><span><a href="#sessionlistcapabilities">SessionListCapabilities</a></span><span> | null</span></>} >
25962686
**UNSTABLE**
@@ -2601,6 +2691,29 @@ Whether the agent supports `session/list`.
26012691

26022692
</ResponseField>
26032693

2694+
## <span class="font-mono">SessionForkCapabilities</span>
2695+
2696+
**UNSTABLE**
2697+
2698+
This capability is not part of the spec yet, and may be removed or changed at any point.
2699+
2700+
Capabilities for the `session/fork` method.
2701+
2702+
By supplying `\{\}` it means that the agent supports forking of sessions.
2703+
2704+
**Type:** Object
2705+
2706+
**Properties:**
2707+
2708+
<ResponseField name="_meta" type={"object"} >
2709+
The _meta property is reserved by ACP to allow clients and agents to attach additional
2710+
metadata to their interactions. Implementations MUST NOT make assumptions about values at
2711+
these keys.
2712+
2713+
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
2714+
2715+
</ResponseField>
2716+
26042717
## <span class="font-mono">SessionId</span>
26052718

26062719
A unique identifier for a conversation session between a client and agent.

schema/meta.unstable.json

Lines changed: 1 addition & 0 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_fork": "session/fork",
67
"session_list": "session/list",
78
"session_load": "session/load",
89
"session_new": "session/new",

schema/schema.unstable.json

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@
208208
{
209209
"$ref": "#/$defs/ListSessionsResponse"
210210
},
211+
{
212+
"$ref": "#/$defs/ForkSessionResponse"
213+
},
211214
{
212215
"$ref": "#/$defs/SetSessionModeResponse"
213216
},
@@ -573,6 +576,14 @@
573576
],
574577
"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."
575578
},
579+
{
580+
"allOf": [
581+
{
582+
"$ref": "#/$defs/ForkSessionRequest"
583+
}
584+
],
585+
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nForks an existing session to create a new independent session.\n\nThis method is only available if the agent advertises the `session.fork` capability.\n\nThe agent should create a new session with the same conversation context as the\noriginal, allowing operations like generating summaries without affecting the\noriginal session's history."
586+
},
576587
{
577588
"allOf": [
578589
{
@@ -1076,6 +1087,68 @@
10761087
},
10771088
"type": "object"
10781089
},
1090+
"ForkSessionRequest": {
1091+
"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 forking an existing session.\n\nCreates a new session based on the context of an existing one, allowing\noperations like generating summaries without affecting the original session's history.\n\nOnly available if the Agent supports the `session.fork` capability.",
1092+
"properties": {
1093+
"_meta": {
1094+
"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)"
1095+
},
1096+
"sessionId": {
1097+
"allOf": [
1098+
{
1099+
"$ref": "#/$defs/SessionId"
1100+
}
1101+
],
1102+
"description": "The ID of the session to fork."
1103+
}
1104+
},
1105+
"required": ["sessionId"],
1106+
"type": "object",
1107+
"x-method": "session/fork",
1108+
"x-side": "agent"
1109+
},
1110+
"ForkSessionResponse": {
1111+
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from forking an existing session.",
1112+
"properties": {
1113+
"_meta": {
1114+
"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)"
1115+
},
1116+
"models": {
1117+
"anyOf": [
1118+
{
1119+
"$ref": "#/$defs/SessionModelState"
1120+
},
1121+
{
1122+
"type": "null"
1123+
}
1124+
],
1125+
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent"
1126+
},
1127+
"modes": {
1128+
"anyOf": [
1129+
{
1130+
"$ref": "#/$defs/SessionModeState"
1131+
},
1132+
{
1133+
"type": "null"
1134+
}
1135+
],
1136+
"description": "Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)"
1137+
},
1138+
"sessionId": {
1139+
"allOf": [
1140+
{
1141+
"$ref": "#/$defs/SessionId"
1142+
}
1143+
],
1144+
"description": "Unique identifier for the newly created forked session."
1145+
}
1146+
},
1147+
"required": ["sessionId"],
1148+
"type": "object",
1149+
"x-method": "session/fork",
1150+
"x-side": "agent"
1151+
},
10791152
"HttpHeader": {
10801153
"description": "An HTTP header to set when making requests to the MCP server.",
10811154
"properties": {
@@ -2182,6 +2255,17 @@
21822255
"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)",
21832256
"type": ["object", "null"]
21842257
},
2258+
"fork": {
2259+
"anyOf": [
2260+
{
2261+
"$ref": "#/$defs/SessionForkCapabilities"
2262+
},
2263+
{
2264+
"type": "null"
2265+
}
2266+
],
2267+
"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/fork`."
2268+
},
21852269
"list": {
21862270
"anyOf": [
21872271
{
@@ -2196,6 +2280,15 @@
21962280
},
21972281
"type": "object"
21982282
},
2283+
"SessionForkCapabilities": {
2284+
"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/fork` method.\n\nBy supplying `{}` it means that the agent supports forking of sessions.",
2285+
"properties": {
2286+
"_meta": {
2287+
"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)"
2288+
}
2289+
},
2290+
"type": "object"
2291+
},
21992292
"SessionId": {
22002293
"description": "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)",
22012294
"type": "string"

0 commit comments

Comments
 (0)