github / github/copilot-sdk

Feature: Strongly type Python events

オープン
#1,016 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Java
スター
10.5k
フォーク
1.5k
平均マージ
1日 11時間
マージ済み PR(30日)
127

説明

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:

https://github.com/github/copilot-sdk/blob/f7fd7577109d64e261456b16c49baa56258eae4e/python/copilot/generated/session_events.py#L1773

SessionEvent largely a pair of enum and Data with a long docstring:

https://github.com/github/copilot-sdk/blob/f7fd7577109d64e261456b16c49baa56258eae4e/python/copilot/generated/session_events.py#L3229

Other bindings in dotnet, for example, strongly type the events, so you know what events carry what payloads:

https://github.com/github/copilot-sdk/blob/f7fd7577109d64e261456b16c49baa56258eae4e/dotnet/src/Generated/SessionEvents.cs#L134

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:

https://github.com/anthropics/claude-agent-sdk-python/blob/13f65c81e2bec2a5d1f1e1efdd45aa061c4ec43f/src/claude_agent_sdk/types.py#L1071

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).

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。