refactor(jsonrpc): register extension method handlers#331
Merged
liujuanjuan1984 merged 1 commit intomainfrom Mar 27, 2026
Merged
refactor(jsonrpc): register extension method handlers#331liujuanjuan1984 merged 1 commit intomainfrom
liujuanjuan1984 merged 1 commit intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
本 PR 基于
#324的评估结论,继续收敛 JSON-RPC 自定义分发层,目标是把OpencodeSessionQueryJSONRPCApplication压缩成薄壳,并消除当前最值得收口的三类具体风险:interrupt callback的 directory 特例主要靠实现细节维持模块变更
src/opencode_a2a/jsonrpc/application.py_handle_requests()收敛为:super()._handle_requests()204契约不变src/opencode_a2a/jsonrpc/dispatch.pyExtensionHandlerContextExtensionMethodSpec/ExtensionMethodRegistrysession_queryprovider_discoverysession_controlinterrupt_callbackMETHOD_TO_MODEL派生,不再手写固定常量列表src/opencode_a2a/jsonrpc/handlers/*application.py的 extension 业务分发拆到独立 handler:session_queries.pyprovider_discovery.pysession_control.pyinterrupt_callbacks.pycommon.py中补充轻量共享 helper:interrupt callback的 directory 行为显式命名为特例 helper,固定“只提取 metadata、不走 resolver”的历史契约,避免未来误改tests/jsonrpc/test_dispatch_registry.pytasks/pushNotificationConfig/get)也会正确委托自审结论
本次改动与
#324的目标一致,且没有改变对外 Agent Card / OpenAPI / JSON-RPC method 契约。本轮自审后未发现阻塞性问题;新增的 3 个当前风险点均已在本 PR 中收口:
interrupt callback的 directory 特例验证
uv run pytest tests/jsonrpc --cov-fail-under=0./scripts/doctor.sh404 passed,total coverage92.11%关联
Closes #324