Skip to content

refactor(v2)!: expand parameters and derive routes from protocols - #150

Merged
frostming merged 1 commit into
mainfrom
refactor/v2-protocol-routing
Sep 21, 2026
Merged

frostming merged 1 commit into
mainfrom
refactor/v2-protocol-routing

Conversation

@frostming

Copy link
Copy Markdown
Contributor

Summary

V2 connection methods and agent/client handlers now accept expanded snake-case parameters, matching the v1 calling style. For example, connection.new_session(NewSessionRequest(cwd="/workspace")) becomes connection.new_session(cwd="/workspace"). Nested values and responses remain v2 schema models; extra keyword arguments carry _meta.

Add public v2.Agent and v2.Client protocols and derive routing specifications from their param_model metadata and return annotations. V2 retains separate contracts because initialization, prompt responses, permissions, and session updates differ from v1.

Preserve initialization gating, strict request/response validation, prompt acceptance acknowledgements, independent session updates, omitted-versus-null patch fields, union branch fields, separate MCP request/notification dispatch, and explicit extension names. Unimplemented protocol stubs remain unhandled. Signature generation now selects the appropriate schema version.

Breaking experimental API change: callers and handlers must migrate from whole request models to expanded parameters. Stable v1 APIs are unchanged. No schema bindings were regenerated.

Related issues

Follow-up to #149.

Testing

  • make check — passed (lint/format, type checking, dependency checks).
  • Python 3.10: UV_PROJECT_ENVIRONMENT=/tmp/acp-python-ci310 NO_PROXY=localhost,127.0.0.1 no_proxy=localhost,127.0.0.1 uv run --python 3.10 --frozen --all-extras python -m pytest --doctest-modules -q356 passed, 2 skipped.
  • Python 3.14: NO_PROXY=localhost,127.0.0.1 no_proxy=localhost,127.0.0.1 uv run --frozen --all-extras python -m pytest --doctest-modules -q357 passed, 1 skipped.
  • Regression coverage includes protocol route coverage, connection/handler signature agreement, union request round trips and metadata, strict v2 responses, inherited protocol stubs, patch field preservation, and schema-specific signature generation.

Docs & screenshots

Updated docs/experimental-v2.md with expanded calls, agent/client implementations, union request examples, and migration guidance.

Checklist

  • Conventional Commit title.
  • Tests cover the change.
  • Docs/examples updated for the user-facing API change.
  • Schema regeneration status called out above (none).

@frostming
frostming merged commit 9d07d78 into main Sep 21, 2026
8 checks passed
@frostming
frostming deleted the refactor/v2-protocol-routing branch September 21, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant