Skip to content

Commit ac611b0

Browse files
authored
feat(v2)!: bump ACP schema to 2.0.0-beta.4 (#208)
* feat(v2)!: bump ACP schema to 2.0.0-beta.4 BREAKING CHANGE: Update the experimental v2 bindings and runtime to the beta.4 schema, which removes NES and document notifications and requires a non-null request ID for request-scoped elicitation. * fix(v2): harden validation, routing, and patch deserialization for beta.4 * fix(v2): align initialization, replay, and batch handling with ACP TCK v2 * fix(v2): require explicit type on wire initial configOptions * refactor(v2): unify wire tag validation and align error/envelope models with v1 * refactor(v2): align initialization, scoped validators, and test hygiene with v1 * refactor(v2): preserve v1/v2 boundaries and InitializationState API
1 parent 382d6f9 commit ac611b0

33 files changed

Lines changed: 11220 additions & 7003 deletions

‎docs/experimental-v2.md‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Experimental Protocol v2
22

3-
> **Experimental.** Protocol v2 is a draft. Import it from `acp.experimental` and
4-
> expect its API and generated models to change with the upstream schema.
3+
> **Experimental.** Protocol v2 is in preview. Import it from `acp.experimental`
4+
> and expect its API and generated models to change with the upstream schema.
55
6-
The bindings use `schema-v2.0.0-alpha.7`.
6+
The bindings use [`schema-v2.0.0-beta.4`](https://github.com/agentclientprotocol/agent-client-protocol/releases/tag/schema-v2.0.0-beta.4).
7+
The upstream schema removes Next Edit Suggestions (`nes/*`) and the associated
8+
document notifications from v2.
79

810
The v2 runtime is separate from the stable v1 API. Like v1, connection methods
911
and agent/client handlers accept expanded, snake-case parameters. Responses and
@@ -19,7 +21,7 @@ from acp.experimental import v2
1921

2022
class MyClient(v2.Client):
2123
async def session_update(
22-
self, session_id: str, update: Any, **kwargs: Any,
24+
self, session_id: str, update: v2.schema.SessionUpdate, **kwargs: Any,
2325
) -> None:
2426
handle_update(session_id, update)
2527

@@ -50,6 +52,7 @@ class MyAgent(v2.Agent):
5052
return v2.schema.InitializeResponse(
5153
protocol_version=v2.PROTOCOL_VERSION,
5254
info=v2.schema.Implementation(name="my-agent", version="1.0.0"),
55+
capabilities=v2.schema.AgentCapabilities(session=v2.schema.SessionCapabilities()),
5356
)
5457

5558
async def new_session(
@@ -91,14 +94,16 @@ await agent_connection.create_elicitation(
9194
)
9295
```
9396

94-
For elicitation, `session_id` selects session scope; otherwise `request_id`
95-
selects request scope (including `None`). Pass `requested_schema` for form mode,
97+
For elicitation, pass either `session_id` for session scope or a string or integer
98+
`request_id` for request scope. Pass `requested_schema` for form mode,
9699
or `elicitation_id` and `url` for URL mode. Handlers receive the validated
97100
branch's fields, including `type` for config options and `mode` for elicitation.
98101

99102
`session/prompt` returns after the agent inserts the user message into the ACP
100-
conversation, without waiting for processing to finish. The response requires a
101-
non-null `message_id`. Agents return `v2.schema.PromptResponse(message_id=...)`
103+
conversation, without waiting for processing to finish. Callers can pass a
104+
bounded `idempotency_key` (1–255 characters) so retries of the same submission
105+
return the original `message_id` instead of inserting a duplicate. The response
106+
requires a non-null `message_id`. Agents return `v2.schema.PromptResponse(message_id=...)`
102107
and echo the user message in a `UserMessageUpdate` or `UserMessageChunk` carrying
103108
the same ID. That update may arrive before or after the response; use
104109
`accepted.message_id` to match it. Other session updates are independent traffic
@@ -118,8 +123,8 @@ terminal updates and patch metadata. When applying received patches, use
118123

119124
Setting `replay_from=v2.schema.ReplayFromStartVariant()` on `connection.resume_session(...)`
120125
requests all retained conversation history; agents need not retain every message.
121-
Accepted elicitation content validates scalar values and string lists; nested
122-
objects are not valid form values.
126+
Accepted elicitation content preserves scalar values, string lists, and any
127+
custom or extension JSON values.
123128

124129
Agents that serve both versions use `AgentProtocolRouter`:
125130

‎schema/v2/VERSION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
refs/tags/schema-v2.0.0-alpha.7
1+
refs/tags/schema-v2.0.0-beta.4

‎schema/v2/meta.json‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,31 @@
1414
"session_list": "session/list",
1515
"session_delete": "session/delete",
1616
"session_fork": "session/fork",
17+
"session_archive": "session/archive",
18+
"session_unarchive": "session/unarchive",
19+
"session_status": "session/status",
20+
"session_options": "session/options",
21+
"session_set_title": "session/set_title",
1722
"session_resume": "session/resume",
1823
"session_close": "session/close",
24+
"tool_call_cancel": "tool_call/cancel",
25+
"terminal_cancel": "terminal/cancel",
1926
"auth_logout": "auth/logout",
20-
"nes_start": "nes/start",
21-
"nes_suggest": "nes/suggest",
22-
"nes_accept": "nes/accept",
23-
"nes_reject": "nes/reject",
24-
"nes_close": "nes/close",
25-
"document_did_open": "document/didOpen",
26-
"document_did_change": "document/didChange",
27-
"document_did_close": "document/didClose",
28-
"document_did_save": "document/didSave",
29-
"document_did_focus": "document/didFocus"
27+
"auth_status": "auth/status"
3028
},
3129
"clientMethods": {
3230
"session_request_permission": "session/request_permission",
3331
"session_update": "session/update",
3432
"mcp_message": "mcp/message",
3533
"elicitation_create": "elicitation/create",
36-
"elicitation_complete": "elicitation/complete"
34+
"elicitation_complete": "elicitation/complete",
35+
"auth_status_update": "auth/status_update"
3736
},
3837
"protocolMethods": {
3938
"cancel_request": "$/cancel_request"
39+
},
40+
"proxyMethods": {
41+
"proxy_initialize": "proxy/initialize",
42+
"proxy_successor": "proxy/successor"
4043
}
4144
}

0 commit comments

Comments
 (0)