Skip to content

refactor: derive routers from protocol metadata - #149

Merged
frostming merged 2 commits into
mainfrom
refactor/protocol-generated-routers
Sep 21, 2026
Merged

frostming merged 2 commits into
mainfrom
refactor/protocol-generated-routers

Conversation

@frostming

Copy link
Copy Markdown
Contributor

Summary

Adding or changing an ACP method previously required updating both its Agent/Client protocol declaration and a separate router registration. Move the wire method name, request/notification kind, unstable flag, optional-handler defaults, and adapters into param_model / param_models on the protocols. Both router entry points now delegate to MessageRouter.from_protocol.

The common builder preserves legacy handler dispatch, extension methods, optional terminal responses, unstable gates, and separate request/notification handlers for mcp/message. Config-option and elicitation conversions live in a private adapter module and are selected by protocol metadata. Model-only decorators on outgoing connection methods remain compatible with signature generation and legacy calls. No schema regeneration is included.

Related issues

Follow-up to #148.

Testing

  • Python 3.10 full suite, including transport extras: 312 passed, 2 skipped.
  • Python 3.14 full suite: 313 passed, 1 skipped.
  • make check: all lockfile, pre-commit, type, and dependency checks passed.
  • Compared generated and previous router tables with unstable support both enabled and disabled: methods, kinds, flags, defaults, and result adapters match.
  • Added tests for inherited declarations, protocol-only routing, union validation, duplicate-route rejection, legacy config/elicitation adapters, extensions, and preservation of decorator metadata during signature generation.

Docs & screenshots

Document route declarations and adapter options in the quickstart maintenance section.

Checklist

  • Conventional Commit title (e.g. feat:, fix:).
  • Tests cover the change or are not required (explain above).
  • Docs/examples updated when behaviour is user-facing.
  • Schema regenerations (make gen-all) are called out if applicable.

@frostming
frostming merged commit a11bb6e into main Sep 21, 2026
8 checks passed
@frostming
frostming deleted the refactor/protocol-generated-routers branch September 21, 2026 08:26
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