Skip to content

Commit cf0b305

Browse files
Go SDK API review fixes (#1360)
* Go SDK API review: Phase A - SessionConfig/ResumeSessionConfig renames - OnExitPlanMode -> OnExitPlanModeRequest - OnAutoModeSwitch -> OnAutoModeSwitchRequest - ExitPlanModeHandler -> ExitPlanModeRequestHandler - AutoModeSwitchHandler -> AutoModeSwitchRequestHandler - Session.GetMessages -> Session.GetEvents - ResumeSessionConfig.DisableResume -> SuppressResumeEvent - Streaming bool -> *bool on SessionConfig and ResumeSessionConfig Wire-level RPC method (session.getMessages) and internal request types are unchanged; only the public Go surface is renamed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Go SDK API review: Phase B+C - ProviderConfig + MCP Tools tweaks B. ProviderConfig.MaxInputTokens -> MaxPromptTokens (matches the wire name 'maxPromptTokens' exactly). C. MCPStdioServerConfig.Tools / MCPHTTPServerConfig.Tools: change JSON tag from 'tools' to 'tools,omitempty'. Now nil/omitted slice means 'all tools' (CLI default), matching TS/Rust/C# semantics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Go SDK API review: Phase D - RuntimeConnection refactor Replaces the flat connection fields on ClientOptions with a single discriminated Connection RuntimeConnection field constructed from one of: StdioConnection{Path, Args} TcpConnection{Port, ConnectionToken, Path, Args} UriConnection{URL, ConnectionToken} Removes: - CLIPath, CLIArgs, CLIUrl, UseStdio, Port, TCPConnectionToken - AutoStart, AutoRestart - public ConnectionState type, State* constants, and Client.State() method Renames: - CopilotHome -> BaseDirectory - Remote -> EnableRemoteSessions - Client.ActualPort() -> Client.RuntimePort() LogLevel no longer defaults to 'info'. When empty, the SDK does not pass --log-level to the runtime, matching the TS SDK. All unit tests, e2e tests, samples, and the Go scenario apps are migrated. README updated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Go SDK API review: Phase E - lifecycle timestamps as time.Time SessionMetadata and SessionLifecycleEventMetadata: StartTime and ModifiedTime change from string to time.Time. The runtime emits these as ISO 8601 strings, which time.Time's default JSON unmarshal handles natively. Matches the equivalent C# (#1343) / TS (#1357) changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Go SDK API review: Phase F - hook timestamps as time.Time All six hook input types (PreToolUseHookInput, PostToolUseHookInput, UserPromptSubmittedHookInput, SessionStartHookInput, SessionEndHookInput, ErrorOccurredHookInput): Timestamp changes from int64 to time.Time. Each type gains a MarshalJSON/UnmarshalJSON pair that serializes Timestamp as Unix milliseconds on the wire, matching the runtime protocol. Mirrors the equivalent C# (#1343) UnixMillisecondsDateTimeOffsetConverter and TS (#1357) Date-typed hook timestamps. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Go SDK API review: Phases G-K - misc renames and cleanups G. InputOptions -> UiInputOptions on the Session.UI().Input convenience. H. Add Session.SendPrompt(ctx, prompt) and Session.SendPromptAndWait(ctx, prompt) convenience wrappers around the MessageOptions-based methods (mirrors the string overloads added in C#/TS). I. SessionFsProvider interface method renames (Go-specific): Mkdir -> MakeDirectory, Readdir -> ReadDirectory, ReaddirWithTypes -> ReadDirectoryWithTypes, Rm -> Remove. The adapter still implements the wire-protocol method names (rpc.SessionFsHandler) unchanged. J. SessionConfig/ResumeSessionConfig.CreateSessionFsHandler -> CreateSessionFsProvider (matches the SessionFsProvider type it returns). K. Remove deprecated Session.Destroy(); callers must use Session.Disconnect(). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Go SDK API review: Phase L - docs and scenario migrations Update Go code samples in docs/ to use the new ClientOptions.Connection shape (StdioConnection / UriConnection). Also migrate the streaming scenario to copilot.Bool(true) for the new *bool Streaming field. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Streaming: true in Go doc snippets after *bool change CI docs-validate extracts Go code blocks and compiles them. Update the remaining 4 sites (docs/getting-started.md x3, docs/features/streaming-events.md) to use copilot.Bool(true) now that SessionConfig.Streaming is *bool. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Apply gofmt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * MCP Tools: change []string to *[]string to preserve nil vs empty With `json:"tools,omitempty"` on a bare []string, Go collapses both nil and []string{} to "omitted", losing the documented distinction between "all tools" (nil) and "no tools" (empty slice). Switch the field type to *[]string so a non-nil pointer to an empty slice serializes as `tools: []` on the wire, matching TS `tools?: string[]` and C# `IList<string>?` with WhenWritingNull. Callers use the standard Go idiom for pointer-to-slice literals: Tools: &[]string{"*"} // explicit all tools Tools: &[]string{} // no tools Tools: &[]string{"a","b"} // only those tools Tools: nil // (default) all tools, field omitted Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: show StdioConnection.Args for Go --log-dir snippet The Go SDK now supports extra runtime args via StdioConnection.Args / TcpConnection.Args. Replace the outdated 'Go cannot pass args, run the CLI manually' snippet with the actual idiomatic call. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop TS/C# reference from MCPStdioServerConfig doc comment Go SDK source shouldn't reference other-language SDKs. Rephrase the Tools field doc to explain the pointer-to-slice form purely in Go terms. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a205e69 commit cf0b305

50 files changed

Lines changed: 803 additions & 856 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/features/mcp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func main() {
120120
"my-local-server": copilot.MCPStdioServerConfig{
121121
Command: "node",
122122
Args: []string{"./mcp-server.js"},
123-
Tools: []string{"*"},
123+
Tools: &[]string{"*"},
124124
},
125125
},
126126
})

docs/features/streaming-events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func main() {
130130

131131
session, _ := client.CreateSession(ctx, &copilot.SessionConfig{
132132
Model: "gpt-4.1",
133-
Streaming: true,
133+
Streaming: copilot.Bool(true),
134134
OnPermissionRequest: func(req copilot.PermissionRequest, inv copilot.PermissionInvocation) (copilot.PermissionRequestResult, error) {
135135
return copilot.PermissionRequestResult{Kind: copilot.PermissionRequestResultKindApproved}, nil
136136
},

docs/getting-started.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ func main() {
467467

468468
session, err := client.CreateSession(ctx, &copilot.SessionConfig{
469469
Model: "gpt-4.1",
470-
Streaming: true,
470+
Streaming: copilot.Bool(true),
471471
})
472472
if err != nil {
473473
log.Fatal(err)
@@ -1046,7 +1046,7 @@ func main() {
10461046

10471047
session, err := client.CreateSession(ctx, &copilot.SessionConfig{
10481048
Model: "gpt-4.1",
1049-
Streaming: true,
1049+
Streaming: copilot.Bool(true),
10501050
Tools: []copilot.Tool{getWeather},
10511051
})
10521052
if err != nil {
@@ -1482,7 +1482,7 @@ func main() {
14821482

14831483
session, err := client.CreateSession(ctx, &copilot.SessionConfig{
14841484
Model: "gpt-4.1",
1485-
Streaming: true,
1485+
Streaming: copilot.Bool(true),
14861486
Tools: []copilot.Tool{getWeather},
14871487
})
14881488
if err != nil {
@@ -2001,7 +2001,7 @@ func main() {
20012001
ctx := context.Background()
20022002

20032003
client := copilot.NewClient(&copilot.ClientOptions{
2004-
CLIUrl: "localhost:4321",
2004+
Connection: copilot.UriConnection{URL: "localhost:4321"},
20052005
})
20062006

20072007
if err := client.Start(ctx); err != nil {
@@ -2021,7 +2021,7 @@ func main() {
20212021
import copilot "github.com/github/copilot-sdk/go"
20222022

20232023
client := copilot.NewClient(&copilot.ClientOptions{
2024-
CLIUrl: "localhost:4321",
2024+
Connection: copilot.UriConnection{URL: "localhost:4321"},
20252025
})
20262026

20272027
if err := client.Start(ctx); err != nil {
@@ -2105,7 +2105,7 @@ var session = client.createSession(
21052105

21062106
</details>
21072107

2108-
**Note:** When `cli_url` / `cliUrl` / `CLIUrl` is provided, or Rust uses `Transport::External`, the SDK will not spawn or manage a CLI process - it will only connect to the existing server at the specified URL.
2108+
**Note:** When `cli_url` / `cliUrl` / Go's `UriConnection` is provided, or Rust uses `Transport::External`, the SDK will not spawn or manage a CLI process - it will only connect to the existing server at the specified URL.
21092109

21102110
## Telemetry and observability
21112111

docs/setup/backend-services.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Run the Copilot SDK in server-side applications—APIs, web backends, microservi
66

77
## How it works
88

9-
Instead of the SDK spawning a CLI child process, you run the CLI independently in **headless server mode**. Your backend connects to it over TCP using the `cliUrl` option.
9+
Instead of the SDK spawning a CLI child process, you run the CLI independently in **headless server mode**. Your backend connects to it over TCP using the `Connection` option (`UriConnection`).
1010

1111
```mermaid
1212
flowchart TB
@@ -177,7 +177,7 @@ func main() {
177177
message := "Hello"
178178

179179
client := copilot.NewClient(&copilot.ClientOptions{
180-
CLIUrl: "localhost:4321",
180+
Connection: copilot.UriConnection{URL: "localhost:4321"},
181181
})
182182
client.Start(ctx)
183183
defer client.Stop()
@@ -195,7 +195,7 @@ func main() {
195195

196196
```go
197197
client := copilot.NewClient(&copilot.ClientOptions{
198-
CLIUrl:"localhost:4321",
198+
Connection: copilot.UriConnection{URL: "localhost:4321"},
199199
})
200200
client.Start(ctx)
201201
defer client.Stop()

docs/setup/bundled-cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ await client.stop()
7171
<summary><strong>Go</strong></summary>
7272

7373
> [!NOTE]
74-
> The Go SDK does not bundle the CLI. You must install the CLI separately or set `CLIPath` to point to an existing binary. See [Local CLI Setup](./local-cli.md) for details.
74+
> The Go SDK does not bundle the CLI. You must install the CLI separately or set `Connection` to point to an existing binary. See [Local CLI Setup](./local-cli.md) for details.
7575
7676
<!-- docs-validate: hidden -->
7777
```go
@@ -137,7 +137,7 @@ Console.WriteLine(response?.Data.Content);
137137
<summary><strong>Java</strong></summary>
138138

139139
> [!NOTE]
140-
> The Java SDK does not bundle or embed the Copilot CLI. You must install the CLI separately and configure its path via `cliPath` or the `COPILOT_CLI_PATH` environment variable.
140+
> The Java SDK does not bundle or embed the Copilot CLI. You must install the CLI separately and configure its path via `Connection` or the `COPILOT_CLI_PATH` environment variable.
141141
142142
```java
143143
import com.github.copilot.sdk.CopilotClient;

docs/setup/local-cli.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Use a specific CLI binary instead of the SDK's bundled CLI. This is an advanced
66

77
## How it works
88

9-
By default, the Node.js, Python, and .NET SDKs include their own CLI dependency (see [Default Setup](./bundled-cli.md)). If you need to override this—for example, to use a system-installed CLI—you can use the `cliPath` option.
9+
By default, the Node.js, Python, and .NET SDKs include their own CLI dependency (see [Default Setup](./bundled-cli.md)). If you need to override this—for example, to use a system-installed CLI—you can use the `Connection` option.
1010

1111
```mermaid
1212
flowchart LR
@@ -78,7 +78,7 @@ await client.stop()
7878
<summary><strong>Go</strong></summary>
7979

8080
> [!NOTE]
81-
> The Go SDK does not bundle a CLI, so you must always provide `CLIPath`.
81+
> The Go SDK does not bundle a CLI, so you must always provide `Connection`.
8282
8383
<!-- docs-validate: hidden -->
8484
```go
@@ -95,7 +95,7 @@ func main() {
9595
ctx := context.Background()
9696

9797
client := copilot.NewClient(&copilot.ClientOptions{
98-
CLIPath: "/usr/local/bin/copilot",
98+
Connection: copilot.StdioConnection{Path: "/usr/local/bin/copilot"},
9999
})
100100
if err := client.Start(ctx); err != nil {
101101
log.Fatal(err)
@@ -115,7 +115,7 @@ func main() {
115115

116116
```go
117117
client := copilot.NewClient(&copilot.ClientOptions{
118-
CLIPath: "/usr/local/bin/copilot",
118+
Connection: copilot.StdioConnection{Path: "/usr/local/bin/copilot"},
119119
})
120120
if err := client.Start(ctx); err != nil {
121121
log.Fatal(err)

docs/troubleshooting/debugging.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,25 @@ const client = new CopilotClient({
142142
```go
143143
package main
144144

145+
import copilot "github.com/github/copilot-sdk/go"
146+
145147
func main() {
146-
// The Go SDK does not currently support passing extra CLI arguments.
147-
// For custom log directories, run the CLI manually with --log-dir
148-
// and connect via CLIUrl option.
148+
client := copilot.NewClient(&copilot.ClientOptions{
149+
Connection: copilot.StdioConnection{
150+
Args: []string{"--log-dir", "/path/to/logs"},
151+
},
152+
})
153+
_ = client
149154
}
150155
```
151156
<!-- /docs-validate: hidden -->
152157

153158
```go
154-
// The Go SDK does not currently support passing extra CLI arguments.
155-
// For custom log directories, run the CLI manually with --log-dir
156-
// and connect via CLIUrl option.
159+
client := copilot.NewClient(&copilot.ClientOptions{
160+
Connection: copilot.StdioConnection{
161+
Args: []string{"--log-dir", "/path/to/logs"},
162+
},
163+
})
157164
```
158165

159166
</details>
@@ -221,7 +228,7 @@ var client = new CopilotClient(new CopilotClientOptions
221228

222229
```go
223230
client := copilot.NewClient(&copilot.ClientOptions{
224-
CLIPath: "/usr/local/bin/copilot",
231+
Connection: copilot.StdioConnection{Path: "/usr/local/bin/copilot"},
225232
})
226233
```
227234
</details>

go/README.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Follow these steps to embed the CLI:
9494
1. Run `go get -tool github.com/github/copilot-sdk/go/cmd/bundler`. This is a one-time setup step per project.
9595
2. Run `go tool bundler` in your build environment just before building your application.
9696

97-
That's it! When your application calls `copilot.NewClient` without a `CLIPath` nor the `COPILOT_CLI_PATH` environment variable, the SDK will automatically install the embedded CLI to a cache directory and use it for all operations.
97+
That's it! When your application calls `copilot.NewClient` without a `Connection` field (or with an empty `StdioConnection{}`) and no `COPILOT_CLI_PATH` environment variable, the SDK will automatically install the embedded CLI to a cache directory and use it for all operations.
9898

9999
## API Reference
100100

@@ -110,8 +110,8 @@ That's it! When your application calls `copilot.NewClient` without a `CLIPath` n
110110
- `ListSessions(filter *SessionListFilter) ([]SessionMetadata, error)` - List sessions (with optional filter)
111111
- `DeleteSession(sessionID string) error` - Delete a session permanently
112112
- `GetLastSessionID(ctx context.Context) (*string, error)` - Get the ID of the most recently updated session
113-
- `GetState() ConnectionState` - Get connection state
114113
- `Ping(message string) (*PingResponse, error)` - Ping the server
114+
- `RuntimePort() int` - TCP port the runtime is listening on (0 if stdio)
115115
- `GetForegroundSessionID(ctx context.Context) (*string, error)` - Get the session ID currently displayed in TUI (TUI+server mode only)
116116
- `SetForegroundSessionID(ctx context.Context, sessionID string) error` - Request TUI to display a specific session (TUI+server mode only)
117117
- `On(handler SessionLifecycleHandler) func()` - Subscribe to all lifecycle events; returns unsubscribe function
@@ -136,18 +136,20 @@ Event types: `SessionLifecycleCreated`, `SessionLifecycleDeleted`, `SessionLifec
136136

137137
**ClientOptions:**
138138

139-
- `CLIPath` (string): Path to CLI executable (default: "copilot" or `COPILOT_CLI_PATH` env var)
140-
- `CLIUrl` (string): URL of existing CLI server (e.g., `"localhost:8080"`, `"http://127.0.0.1:9000"`, or just `"8080"`). When provided, the client will not spawn a CLI process.
141-
- `Cwd` (string): Working directory for CLI process
142-
- `CopilotHome` (string): Base directory for Copilot data (session state, config, etc.). Sets `COPILOT_HOME` on the spawned CLI process. When empty, the CLI defaults to `~/.copilot`. Useful in restricted environments where only specific directories are writable. Ignored when using `CLIUrl`. This does **not** affect where the Go SDK extracts the embedded CLI binary; use `embeddedcli.Config.Dir` for the extraction/cache location. You can vary `CopilotHome` per client independently of the shared extracted binary location.
143-
- `Port` (int): Server port for TCP mode (default: 0 for random)
144-
- `UseStdio` (bool): Use stdio transport instead of TCP (default: true)
145-
- `LogLevel` (string): Log level (default: "info")
146-
- `AutoStart` (\*bool): Auto-start server on first use (default: true). Use `Bool(false)` to disable.
147-
- `Env` ([]string): Environment variables for CLI process (default: inherits from current process)
139+
- `Connection` (RuntimeConnection): How the SDK connects to the runtime. Construct via one of:
140+
- `StdioConnection{Path, Args}` — spawn a runtime over stdio (the default if `Connection` is nil)
141+
- `TcpConnection{Port, ConnectionToken, Path, Args}` — spawn a runtime that listens on TCP
142+
- `UriConnection{URL, ConnectionToken}` — connect to an already-running runtime (no process spawned)
143+
144+
When `Path` is empty for stdio/tcp, the SDK uses the bundled CLI (or `COPILOT_CLI_PATH` env var).
145+
- `Cwd` (string): Working directory for the runtime process
146+
- `BaseDirectory` (string): Base directory for Copilot data (session state, config, etc.). Sets `COPILOT_HOME` on the spawned runtime. When empty, the runtime defaults to `~/.copilot`. Ignored with `UriConnection`. This does **not** affect where the Go SDK extracts the embedded CLI binary; use `embeddedcli.Config.Dir` for the extraction/cache location.
147+
- `LogLevel` (string): Log level. When empty (default), the runtime uses its own default level (the SDK does not pass `--log-level`).
148+
- `Env` ([]string): Environment variables for the runtime process (default: inherits from current process)
148149
- `GitHubToken` (string): GitHub token for authentication. When provided, takes priority over other auth methods.
149-
- `UseLoggedInUser` (\*bool): Whether to use logged-in user for authentication (default: true, but false when `GitHubToken` is provided). Cannot be used with `CLIUrl`.
150-
- `Telemetry` (\*TelemetryConfig): OpenTelemetry configuration for the CLI process. Providing this enables telemetry — no separate flag needed. See [Telemetry](#telemetry) below.
150+
- `UseLoggedInUser` (\*bool): Whether to use logged-in user for authentication (default: true, but false when `GitHubToken` is provided). Cannot be used with `UriConnection`.
151+
- `EnableRemoteSessions` (bool): Enable remote session support (Mission Control integration). Ignored with `UriConnection`.
152+
- `Telemetry` (\*TelemetryConfig): OpenTelemetry configuration for the runtime. Providing this enables telemetry — no separate flag needed. See [Telemetry](#telemetry) below.
151153

152154
**SessionConfig:**
153155

@@ -160,7 +162,7 @@ Event types: `SessionLifecycleCreated`, `SessionLifecycleDeleted`, `SessionLifec
160162
- **replace**: Replaces the entire prompt with `Content`
161163
- **customize**: Selectively override individual sections via `Sections` map (keys: `SectionIdentity`, `SectionTone`, `SectionToolEfficiency`, `SectionEnvironmentContext`, `SectionCodeChangeRules`, `SectionGuidelines`, `SectionSafety`, `SectionToolInstructions`, `SectionCustomInstructions`, `SectionLastInstructions`; values: `SectionOverride` with `Action` and optional `Content`)
162164
- `Provider` (\*ProviderConfig): Custom API provider configuration (BYOK). See [Custom Providers](#custom-providers) section.
163-
- `Streaming` (bool): Enable streaming delta events
165+
- `Streaming` (*bool): Enable streaming delta events (nil = runtime default)
164166
- `InfiniteSessions` (\*InfiniteSessionConfig): Automatic context compaction configuration
165167
- `OnPermissionRequest` (PermissionHandlerFunc): Optional handler called before each tool execution to approve or deny it. When nil, permission requests are emitted as events and left pending for manual resolution. Use `copilot.PermissionHandler.ApproveAll` to allow everything, or provide a custom function for fine-grained control. See [Permission Handling](#permission-handling) section.
166168
- `OnUserInputRequest` (UserInputHandler): Handler for user input requests from the agent (enables ask_user tool). See [User Input Requests](#user-input-requests) section.
@@ -174,7 +176,7 @@ Event types: `SessionLifecycleCreated`, `SessionLifecycleDeleted`, `SessionLifec
174176
- `Tools` ([]Tool): Tools to expose when resuming
175177
- `ReasoningEffort` (string): Reasoning effort level for models that support it
176178
- `Provider` (\*ProviderConfig): Custom API provider configuration (BYOK). See [Custom Providers](#custom-providers) section.
177-
- `Streaming` (bool): Enable streaming delta events
179+
- `Streaming` (*bool): Enable streaming delta events (nil = runtime default)
178180
- `Commands` ([]CommandDefinition): Slash-commands. See [Commands](#commands) section.
179181
- `OnElicitationRequest` (ElicitationHandler): Elicitation handler. See [Elicitation Requests](#elicitation-requests-serverclient) section.
180182

@@ -183,15 +185,14 @@ Event types: `SessionLifecycleCreated`, `SessionLifecycleDeleted`, `SessionLifec
183185
- `Send(ctx context.Context, options MessageOptions) (string, error)` - Send a message
184186
- `On(handler SessionEventHandler) func()` - Subscribe to events (returns unsubscribe function)
185187
- `Abort(ctx context.Context) error` - Abort the currently processing message
186-
- `GetMessages(ctx context.Context) ([]SessionEvent, error)` - Get message history
188+
- `GetEvents(ctx context.Context) ([]SessionEvent, error)` - Get event history
187189
- `Disconnect() error` - Disconnect the session (releases in-memory resources, preserves disk state)
188-
- `Destroy() error` - _(Deprecated)_ Use `Disconnect()` instead
189190
- `UI() *SessionUI` - Interactive UI API for elicitation dialogs
190191
- `Capabilities() SessionCapabilities` - Host capabilities (e.g. elicitation support)
191192

192193
### Helper Functions
193194

194-
- `Bool(v bool) *bool` - Helper to create bool pointers for `AutoStart` option
195+
- `Bool(v bool) *bool` - Helper to create bool pointers (e.g. for `Streaming`)
195196
- `Int(v int) *int` - Helper to create int pointers for `MinLength`, `MaxLength`
196197
- `String(v string) *string` - Helper to create string pointers
197198
- `Float64(v float64) *float64` - Helper to create float64 pointers
@@ -398,7 +399,7 @@ func main() {
398399

399400
session, err := client.CreateSession(context.Background(), &copilot.SessionConfig{
400401
Model: "gpt-5",
401-
Streaming: true,
402+
Streaming: copilot.Bool(true),
402403
})
403404
if err != nil {
404405
log.Fatal(err)
@@ -439,7 +440,7 @@ func main() {
439440
}
440441
```
441442

442-
When `Streaming: true`:
443+
When `Streaming: copilot.Bool(true)`:
443444

444445
- `assistant.message_delta` events are sent with `DeltaContent` containing incremental text
445446
- `assistant.reasoning_delta` events are sent with `DeltaContent` for reasoning/chain-of-thought (model-dependent)
@@ -797,7 +798,7 @@ confirmed, err := ui.Confirm(ctx, "Deploy to production?")
797798
choice, ok, err := ui.Select(ctx, "Pick an environment", []string{"staging", "production"})
798799

799800
// Text input — returns (text, ok bool, error)
800-
name, ok, err := ui.Input(ctx, "Enter the release name", &copilot.InputOptions{
801+
name, ok, err := ui.Input(ctx, "Enter the release name", &copilot.UiInputOptions{
801802
Title: "Release Name",
802803
Description: "A short name for the release",
803804
MinLength: copilot.Int(1),

0 commit comments

Comments
 (0)