Skip to content

Commit 574b251

Browse files
dependabot[bot]devantlerclaude
authored
chore(deps): Bump github.com/github/copilot-sdk/go from 0.3.0 to 1.0.0 (#5311)
* chore(deps): Bump github.com/github/copilot-sdk/go from 0.3.0 to 1.0.0 Bumps [github.com/github/copilot-sdk/go](https://github.com/github/copilot-sdk) from 0.3.0 to 1.0.0. - [Release notes](https://github.com/github/copilot-sdk/releases) - [Changelog](https://github.com/github/copilot-sdk/blob/main/CHANGELOG.md) - [Commits](github/copilot-sdk@v0.3.0...v1.0.0) --- updated-dependencies: - dependency-name: github.com/github/copilot-sdk/go dependency-version: 1.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * fix(chat): adapt to copilot-sdk v1.0.0 API surface The v1.0.0 SDK ("Refine Go SDK pre-GA API surfaces") reshaped several pre-GA types, so the bump from 0.3.0 no longer compiled. Adapt the chat service and TUI: - PermissionRequest / PermissionResult are now discriminated interfaces. The permission handlers return rpc.PermissionDecision (ApproveOnce / Reject / UserNotAvailable) and read request fields via a type switch over the concrete *PermissionRequestXxx variants. - SessionEvent.Type is now a method (event.Type()). - ElicitationContext.Mode/URL/Source/RequestedSchema are now optionals (pointers / *ElicitationSchema); ElicitationResult.Action is a typed enum. - Token counts are int64, ModelBilling.Multiplier and SessionConfig.Streaming are pointers. - ClientOptions.CLIPath/Cwd -> Connection (StdioConnection) / WorkingDirectory; Session.GetMessages -> GetEvents; SDKMetadata.ModifiedTime is time.Time. - PermissionRequestKindMcp -> PermissionRequestKindMCP. go build ./... and the chat package tests pass; golangci-lint is clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nikolai Emil Damm <nikolaiemildamm@icloud.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent dcd92ef commit 574b251

24 files changed

Lines changed: 276 additions & 251 deletions

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ require (
6262
github.com/coreos/go-oidc/v3 v3.18.0
6363
github.com/cosi-project/runtime v1.16.1
6464
github.com/fsnotify/fsnotify v1.10.1
65-
github.com/github/copilot-sdk/go v0.3.0
65+
github.com/github/copilot-sdk/go v1.0.0
6666
github.com/go-jose/go-jose/v4 v4.1.4
6767
github.com/google/go-github/v72 v72.0.0
6868
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,8 +941,8 @@ github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
941941
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
942942
github.com/ghostiam/protogetter v0.3.18 h1:yEpghRGtP9PjKvVXtEzGpYfQj1Wl/ZehAfU6fr62Lfo=
943943
github.com/ghostiam/protogetter v0.3.18/go.mod h1:FjIu5Yfs6FT391m+Fjp3fbAYJ6rkL/J6ySpZBfnODuI=
944-
github.com/github/copilot-sdk/go v0.3.0 h1:LPMpoJzUTfrPbr/5e7s5QKvi66PMmREnbZ9kRxPe6ls=
945-
github.com/github/copilot-sdk/go v0.3.0/go.mod h1:uGWkjVYcp2DV9DgtqYihh5tEoJjNqxIFaUNnrwY4FxM=
944+
github.com/github/copilot-sdk/go v1.0.0 h1:spzqYzKv8l3bpeK43jPBtDcI//TSR8rI2ZcUAO/zFN0=
945+
github.com/github/copilot-sdk/go v1.0.0/go.mod h1:I6YKZQzUXhHZd8a2TkSOcBa8FMVL34QiEg2yxiaXghw=
946946
github.com/github/go-spdx/v2 v2.4.0 h1:+4IwVwJJbm3rzvrQ6P1nI9BDMcy3la4RchRy5uehV/M=
947947
github.com/github/go-spdx/v2 v2.4.0/go.mod h1:/5rwgS0txhGtRdUZwc02bTglzg6HK3FfuEbECKlK2Sg=
948948
github.com/gkampitakis/ciinfo v0.3.4 h1:5eBSibVuSMbb/H6Elc0IIEFbkzCJi3lm94n0+U7Z0KY=

pkg/cli/cmd/chat/chat.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func buildSessionConfig(
3636
exhaustionThreshold := 0.95
3737

3838
config := &copilot.SessionConfig{
39-
Streaming: streaming,
39+
Streaming: &streaming,
4040
SystemMessage: &copilot.SystemMessageConfig{
4141
Mode: "customize",
4242
Sections: sections,

pkg/cli/cmd/chat/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ func startCopilotClient(ctx context.Context) (*copilot.Client, error) {
130130
return nil, verifyErr
131131
}
132132

133-
opts.CLIPath = cliPath
133+
opts.Connection = &copilot.StdioConnection{Path: cliPath}
134134
}
135135

136136
cwd, cwdErr := os.Getwd()
137137
if cwdErr == nil {
138-
opts.Cwd = cwd
138+
opts.WorkingDirectory = cwd
139139
}
140140

141141
for _, envVar := range tokenEnvVars {

pkg/cli/cmd/chat/nontui.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ func isExitCommand(input string) bool {
269269
func buildNonTUIOnEventHandler(writer io.Writer) copilot.SessionEventHandler {
270270
return func(event copilot.SessionEvent) {
271271
//nolint:exhaustive // Only session-level events not in per-turn handler; rest ignored.
272-
switch event.Type {
272+
switch event.Type() {
273273
case copilot.SessionEventTypeToolExecutionProgress:
274274
if data, ok := event.Data.(*copilot.ToolExecutionProgressData); ok {
275275
_, _ = fmt.Fprintf(writer, " ⏳ %s\n", data.ProgressMessage)
@@ -333,7 +333,7 @@ func computeStreamingOutput(event copilot.SessionEvent, state *streamingState) s
333333
defer state.mu.Unlock()
334334

335335
//nolint:exhaustive // Only a subset of ~30 SDK event types are relevant for streaming display.
336-
switch event.Type {
336+
switch event.Type() {
337337
case copilot.SessionEventTypeAssistantMessageDelta:
338338
if data, ok := event.Data.(*copilot.AssistantMessageDeltaData); ok {
339339
return streamingOutput{action: actionDelta, text: data.DeltaContent}

pkg/cli/cmd/chat/tui.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func setupChatTools(
6969
func buildTUIOnEventHandler(eventChan chan<- tea.Msg) copilot.SessionEventHandler {
7070
return func(event copilot.SessionEvent) {
7171
//nolint:exhaustive // Only session-level events not in per-turn dispatcher; rest ignored.
72-
switch event.Type {
72+
switch event.Type() {
7373
case copilot.SessionEventTypeToolExecutionProgress:
7474
if data, ok := event.Data.(*copilot.ToolExecutionProgressData); ok {
7575
eventChan <- chatui.ToolProgressMsg{

pkg/cli/ui/chat/elicitation.go

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ func CreateTUIElicitationHandler(eventChan chan<- tea.Msg) copilot.ElicitationHa
279279

280280
eventChan <- elicitationRequestMsg{
281281
Message: ctx.Message,
282-
Source: ctx.ElicitationSource,
283-
Mode: ctx.Mode,
284-
URL: ctx.URL,
285-
Schema: ctx.RequestedSchema,
282+
Source: derefString(ctx.ElicitationSource),
283+
Mode: elicitationModeString(ctx.Mode),
284+
URL: derefString(ctx.URL),
285+
Schema: elicitationSchemaMap(ctx.RequestedSchema),
286286
Response: responseChan,
287287
}
288288

@@ -292,6 +292,25 @@ func CreateTUIElicitationHandler(eventChan chan<- tea.Msg) copilot.ElicitationHa
292292
}
293293
}
294294

295+
// elicitationModeString returns the string form of an optional elicitation mode.
296+
func elicitationModeString(mode *copilot.ElicitationRequestedMode) string {
297+
if mode == nil {
298+
return ""
299+
}
300+
301+
return string(*mode)
302+
}
303+
304+
// elicitationSchemaMap converts the SDK elicitation schema into the JSON-Schema-shaped
305+
// map[string]any the TUI consumes (a "properties" object), or nil when no schema is set.
306+
func elicitationSchemaMap(schema *copilot.ElicitationSchema) map[string]any {
307+
if schema == nil {
308+
return nil
309+
}
310+
311+
return map[string]any{"properties": schema.Properties}
312+
}
313+
295314
// extractFieldNames extracts field names from a JSON Schema "properties" map.
296315
// Returns the field names in sorted order, or nil for empty/missing schemas.
297316
func extractFieldNames(schema map[string]any) []string {

pkg/cli/ui/chat/elicitation_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ func TestCreateTUIElicitationHandler_SendsRequestAndReturnsResult(t *testing.T)
7171
go func() {
7272
result, err := handler(copilot.ElicitationContext{
7373
Message: "Pick a repository",
74-
ElicitationSource: "github-mcp",
75-
Mode: "form",
76-
RequestedSchema: map[string]any{
77-
"properties": map[string]any{
74+
ElicitationSource: new("github-mcp"),
75+
Mode: new(copilot.ElicitationRequestedModeForm),
76+
RequestedSchema: &copilot.ElicitationSchema{
77+
Properties: map[string]any{
7878
"repo": map[string]any{"type": "string"},
7979
},
8080
},
@@ -101,7 +101,7 @@ func TestCreateTUIElicitationHandler_SendsRequestAndReturnsResult(t *testing.T)
101101
}
102102

103103
result := <-resultChan
104-
assert.Equal(t, "accept", result.Action)
104+
assert.Equal(t, copilot.ElicitationActionAccept, result.Action)
105105
assert.Equal(t, "ksail", result.Content["repo"])
106106
}
107107

@@ -116,7 +116,7 @@ func TestCreateTUIElicitationHandler_DeclineResult(t *testing.T) {
116116
go func() {
117117
result, err := handler(copilot.ElicitationContext{
118118
Message: "Confirm action",
119-
Mode: "form",
119+
Mode: new(copilot.ElicitationRequestedModeForm),
120120
})
121121
assert.NoError(t, err)
122122

@@ -132,6 +132,6 @@ func TestCreateTUIElicitationHandler_DeclineResult(t *testing.T) {
132132
}
133133

134134
result := <-resultChan
135-
assert.Equal(t, "decline", result.Action)
135+
assert.Equal(t, copilot.ElicitationActionDecline, result.Action)
136136
assert.Nil(t, result.Content)
137137
}

pkg/cli/ui/chat/eventhandlers.go

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (d *sessionEventDispatcher) dispatch(
4040
event copilot.SessionEvent,
4141
) {
4242
//nolint:exhaustive // Only event types that affect dispatcher state are handled here.
43-
switch event.Type {
43+
switch event.Type() {
4444
case copilot.SessionEventTypeAssistantTurnStart:
4545
d.handleTurnStart()
4646
case copilot.SessionEventTypeAssistantMessageDelta:
@@ -51,7 +51,7 @@ func (d *sessionEventDispatcher) dispatch(
5151
copilot.SessionEventTypeAssistantReasoningDelta:
5252
d.handleReasoning(event)
5353
case copilot.SessionEventTypeSessionIdle, copilot.SessionEventTypeAssistantTurnEnd:
54-
d.handleSessionLifecycle(event.Type)
54+
d.handleSessionLifecycle(event.Type())
5555
case copilot.SessionEventTypeAbort:
5656
d.handleAbort()
5757
case copilot.SessionEventTypeSessionError:
@@ -90,7 +90,6 @@ func (d *sessionEventDispatcher) dispatch(
9090
}
9191

9292
func (d *sessionEventDispatcher) handleSessionLifecycle(eventType copilot.SessionEventType) {
93-
//nolint:exhaustive // Only lifecycle event types relevant to ending or transitioning a stream are handled here.
9493
switch eventType {
9594
case copilot.SessionEventTypeSessionIdle:
9695
d.eventChan <- streamEndMsg{}
@@ -130,7 +129,7 @@ func (d *sessionEventDispatcher) handleReasoning(event copilot.SessionEvent) {
130129

131130
d.eventChan <- reasoningMsg{
132131
content: content,
133-
isDelta: event.Type == copilot.SessionEventTypeAssistantReasoningDelta,
132+
isDelta: event.Type() == copilot.SessionEventTypeAssistantReasoningDelta,
134133
}
135134
}
136135

@@ -210,11 +209,11 @@ func (d *sessionEventDispatcher) handleUsage(event copilot.SessionEvent) {
210209
}
211210

212211
if data.InputTokens != nil {
213-
msg.inputTokens = *data.InputTokens
212+
msg.inputTokens = float64(*data.InputTokens)
214213
}
215214

216215
if data.OutputTokens != nil {
217-
msg.outputTokens = *data.OutputTokens
216+
msg.outputTokens = float64(*data.OutputTokens)
218217
}
219218

220219
if data.Cost != nil {
@@ -231,9 +230,9 @@ func (d *sessionEventDispatcher) handleUsage(event copilot.SessionEvent) {
231230
}
232231

233232
msg.quotaSnapshots[key] = quotaSnapshot{
234-
entitlementRequests: snapshot.EntitlementRequests,
233+
entitlementRequests: float64(snapshot.EntitlementRequests),
235234
isUnlimited: snapshot.IsUnlimitedEntitlement,
236-
usedRequests: snapshot.UsedRequests,
235+
usedRequests: float64(snapshot.UsedRequests),
237236
remainingPercentage: snapshot.RemainingPercentage,
238237
resetDate: resetStr,
239238
overage: snapshot.Overage,
@@ -260,15 +259,15 @@ func (d *sessionEventDispatcher) handleCompactionComplete(event copilot.SessionE
260259
}
261260

262261
if data.PreCompactionTokens != nil {
263-
msg.preCompactionTokens = *data.PreCompactionTokens
262+
msg.preCompactionTokens = float64(*data.PreCompactionTokens)
264263
}
265264

266265
if data.PostCompactionTokens != nil {
267-
msg.postCompactionTokens = *data.PostCompactionTokens
266+
msg.postCompactionTokens = float64(*data.PostCompactionTokens)
268267
}
269268

270269
if data.TokensRemoved != nil {
271-
msg.tokensRemoved = *data.TokensRemoved
270+
msg.tokensRemoved = float64(*data.TokensRemoved)
272271
}
273272

274273
d.eventChan <- msg
@@ -316,7 +315,7 @@ func (d *sessionEventDispatcher) handleSystemNotification(event copilot.SessionE
316315

317316
d.eventChan <- systemNotificationMsg{
318317
message: data.Content,
319-
infoType: string(data.Kind.Type),
318+
infoType: string(data.Kind.Type()),
320319
}
321320
}
322321

@@ -383,6 +382,6 @@ func (d *sessionEventDispatcher) handleAutoModeSwitchCompleted(event copilot.Ses
383382

384383
d.eventChan <- autoModeSwitchCompletedMsg{
385384
requestID: data.RequestID,
386-
response: data.Response,
385+
response: string(data.Response),
387386
}
388387
}

pkg/cli/ui/chat/eventhandlers_test.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@ func TestDispatch_AutoModeSwitchRequested_EmitsMessage(t *testing.T) {
568568

569569
errorCode := "rate_limit_exceeded"
570570
chat.ExportDispatch(dispatcher, copilot.SessionEvent{
571-
Type: copilot.SessionEventTypeAutoModeSwitchRequested,
572571
Data: &copilot.AutoModeSwitchRequestedData{
573572
RequestID: "req-123",
574573
ErrorCode: &errorCode,
@@ -602,7 +601,6 @@ func TestDispatch_AutoModeSwitchRequested_NilErrorCode(t *testing.T) {
602601
dispatcher := chat.ExportNewSessionEventDispatcher(eventChan)
603602

604603
chat.ExportDispatch(dispatcher, copilot.SessionEvent{
605-
Type: copilot.SessionEventTypeAutoModeSwitchRequested,
606604
Data: &copilot.AutoModeSwitchRequestedData{
607605
RequestID: "req-456",
608606
ErrorCode: nil,
@@ -634,10 +632,12 @@ func TestDispatch_AutoModeSwitchRequested_InvalidDataIgnored(t *testing.T) {
634632
eventChan := make(chan tea.Msg, 10)
635633
dispatcher := chat.ExportNewSessionEventDispatcher(eventChan)
636634

637-
// Wrong data type — dispatcher should silently ignore
635+
// Data routes to the requested handler via Type(), but is not the expected
636+
// *AutoModeSwitchRequestedData — exercises the handler's type guard.
638637
chat.ExportDispatch(dispatcher, copilot.SessionEvent{
639-
Type: copilot.SessionEventTypeAutoModeSwitchRequested,
640-
Data: &copilot.AutoModeSwitchCompletedData{}, // wrong type
638+
Data: &copilot.RawSessionEventData{
639+
EventType: copilot.SessionEventTypeAutoModeSwitchRequested,
640+
},
641641
})
642642

643643
assert.Empty(t, eventChan)
@@ -650,7 +650,6 @@ func TestDispatch_AutoModeSwitchCompleted_EmitsMessage(t *testing.T) {
650650
dispatcher := chat.ExportNewSessionEventDispatcher(eventChan)
651651

652652
chat.ExportDispatch(dispatcher, copilot.SessionEvent{
653-
Type: copilot.SessionEventTypeAutoModeSwitchCompleted,
654653
Data: &copilot.AutoModeSwitchCompletedData{
655654
RequestID: "req-789",
656655
Response: "yes",
@@ -681,10 +680,12 @@ func TestDispatch_AutoModeSwitchCompleted_InvalidDataIgnored(t *testing.T) {
681680
eventChan := make(chan tea.Msg, 10)
682681
dispatcher := chat.ExportNewSessionEventDispatcher(eventChan)
683682

684-
// Wrong data type — dispatcher should silently ignore
683+
// Data routes to the completed handler via Type(), but is not the expected
684+
// *AutoModeSwitchCompletedData — exercises the handler's type guard.
685685
chat.ExportDispatch(dispatcher, copilot.SessionEvent{
686-
Type: copilot.SessionEventTypeAutoModeSwitchCompleted,
687-
Data: &copilot.AutoModeSwitchRequestedData{}, // wrong type
686+
Data: &copilot.RawSessionEventData{
687+
EventType: copilot.SessionEventTypeAutoModeSwitchCompleted,
688+
},
688689
})
689690

690691
assert.Empty(t, eventChan)

0 commit comments

Comments
 (0)