Intelligent-Internet / Intelligent-Internet/opencode-a2a
[Priority: Low] [Enhancement] 明确 Python API facade 导出契约
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 26
- Forks
- 7
- Avg merge
- 18h 30m
- Merged PRs (30d)
- 18
Description
背景
在 #518 的冗余清理与跨仓库 facade 风险对照中发现,src/opencode_a2a/contracts/extensions/__init__.py 是仓库实际使用的聚合导入入口,目前通过 # ruff: noqa: F401 表达 re-export,但没有显式 __all__ 或独立 facade import contract tests。
当前没有功能故障:该入口有生产代码和契约测试消费者,不会被合理的死代码审查判定为无消费者模块。本 issue 仅作为低优先级 API 治理备忘,不代表现有全部 re-export 已经被承诺为长期稳定的公共 Python API。
需要明确的问题
opencode_a2a.contracts.extensions是否应作为受支持的稳定 Python API facade?- 若是,哪些 symbols 属于有意公开的最小集合,哪些应继续从定义模块导入?
- 稳定性承诺是否只覆盖
client/__init__.py,还是还应覆盖 contracts facade? py.typed发布与 Python API 兼容策略应如何在文档和测试中体现?
建议方案
- 先记录仓库支持的 Python API 边界,避免仅凭当前导入形状隐式扩大兼容承诺。
- 若确认
contracts.extensions是稳定 facade:- 添加显式
__all__,仅列出有意公开的 symbols; - 添加 package/facade import contract tests;
- 验证 wheel 中的导入路径和类型信息;
- 在兼容性文档中说明变更与弃用策略。
- 添加显式
- 若不承诺该 facade:
- 明确其 internal/convenience 定位;
- 逐步让仓库内部消费者从真实定义模块导入,避免形成更强的事实 API。
非目标
- 不在本 issue 中改变 A2A wire contract、Agent Card、OpenAPI 或 JSON-RPC 行为。
- 不因为添加
__all__就自动承诺当前全部 re-export 永久稳定。 - 不与 #515 的 SDK 升级和 compatibility layer 审计混合实施。
验收标准
- 明确记录受支持的 Python API/facade 边界。
- 对
contracts.extensions作出“稳定 facade”或“内部便利入口”的明确决定。 - 若选择稳定 facade,添加最小显式
__all__和 import contract tests。 - 若选择内部入口,制定不破坏当前仓库调用的渐进收敛方案。
- 执行
bash ./scripts/doctor.sh。
关联
- Follow-up from #518
- 参考跨仓库
https://github.com/liujuanjuan1984/codex-a2a/pull/358中对已发布 JSON-RPC params facade 的兼容性复核经验。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/opencode_a2a/contracts/extensions/init.py and inspect its production consumers and existing contract tests. Determine and document whether this facade is stable or internal, then follow the selected path: define the minimal all and import contract tests, or plan gradual imports from definition modules. Run bash ./scripts/doctor.sh and verify the acceptance criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100