Feature: Strongly type Python events
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- python
调研方向
从 python/copilot/generated/session_events.py 中的 Python Data 和 SessionEvent 定义开始,然后将 dotnet/src/Generated/SessionEvents.cs 中的强类型事件结构与对应的 Claude Agent SDK 类型进行比较。定义每个事件如何映射到其 payload 类型,并验证 Python 类型检查器能够为每个事件公开正确的 payload,而不依赖 union。
由索引模型根据 Issue 内容生成。
描述
Hi,
I was trying to build against the SDK in Python, and I got confused about which events carried what payloads. The Data class is a union of all possible data fields:
SessionEvent largely a pair of enum and Data with a long docstring:
Other bindings in dotnet, for example, strongly type the events, so you know what events carry what payloads:
I think stronger type hinting on the Python side would help make the SDK easier to consume by catching classes of bugs at IDE/Pyright/agent coding time. It has precedent on the Claude Agent SDK, which does adopt this pattern for its message type:
It's a breaking change to people using type hints, but I suspect we could do it in such a way that the only breaks would be people genuinely looking in the wrong place for payloads (i.e. silent bugs).
- 主要语言
- Java
- 星标
- 10.5k
- 派生
- 1.5k
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 131
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/copilot-sdk 的其他 Issue
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 68/100
github/copilot-sdk#2709 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 78/100
github/copilot-sdk#2673 ·
-
bug testing
难度 2/5 1-3 小时 新手友好度 75/100
github/copilot-sdk#2628 ·
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 68/100
github/copilot-sdk#2627 · 1 条评论 ·
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 74/100
github/copilot-sdk#2493 ·
查看 github/copilot-sdk 的全部 Issue
相似的 Issue
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
apache/flink-agents#1152 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 70/100
jenkinsci/blueocean-plugin#5417 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
objectionary/eo-graphs#75 ·