Skip to content

Commit 37f4f90

Browse files
authored
Merge branch 'main' into dev/qmuntal/ctxlife
2 parents e226fe2 + 27f487f commit 37f4f90

307 files changed

Lines changed: 17529 additions & 2643 deletions

File tree

Some content is hidden

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

.github/agents/docs-maintenance.agent.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ cat nodejs/src/types.ts | grep -A 10 "export interface ExportSessionOptions"
344344
**Must match:**
345345
- `CopilotClient` constructor options: `cliPath`, `cliUrl`, `useStdio`, `port`, `logLevel`, `autoStart`, `autoRestart`, `env`, `githubToken`, `useLoggedInUser`
346346
- `createSession()` config: `model`, `tools`, `hooks`, `systemMessage`, `mcpServers`, `availableTools`, `excludedTools`, `streaming`, `reasoningEffort`, `provider`, `infiniteSessions`, `customAgents`, `workingDirectory`
347-
- `CopilotSession` methods: `send()`, `sendAndWait()`, `getMessages()`, `destroy()`, `abort()`, `on()`, `once()`, `off()`
347+
- `CopilotSession` methods: `send()`, `sendAndWait()`, `getMessages()`, `disconnect()`, `abort()`, `on()`, `once()`, `off()`
348348
- Hook names: `onPreToolUse`, `onPostToolUse`, `onUserPromptSubmitted`, `onSessionStart`, `onSessionEnd`, `onErrorOccurred`
349349

350350
#### Python Validation
@@ -362,7 +362,7 @@ cat python/copilot/types.py | grep -A 15 "class SessionHooks"
362362
**Must match (snake_case):**
363363
- `CopilotClient` options: `cli_path`, `cli_url`, `use_stdio`, `port`, `log_level`, `auto_start`, `auto_restart`, `env`, `github_token`, `use_logged_in_user`
364364
- `create_session()` config keys: `model`, `tools`, `hooks`, `system_message`, `mcp_servers`, `available_tools`, `excluded_tools`, `streaming`, `reasoning_effort`, `provider`, `infinite_sessions`, `custom_agents`, `working_directory`
365-
- `CopilotSession` methods: `send()`, `send_and_wait()`, `get_messages()`, `destroy()`, `abort()`, `export_session()`
365+
- `CopilotSession` methods: `send()`, `send_and_wait()`, `get_messages()`, `disconnect()`, `abort()`, `export_session()`
366366
- Hook names: `on_pre_tool_use`, `on_post_tool_use`, `on_user_prompt_submitted`, `on_session_start`, `on_session_end`, `on_error_occurred`
367367

368368
#### Go Validation
@@ -380,7 +380,7 @@ cat go/types.go | grep -A 15 "type SessionHooks struct"
380380
**Must match (PascalCase for exported):**
381381
- `ClientOptions` fields: `CLIPath`, `CLIUrl`, `UseStdio`, `Port`, `LogLevel`, `AutoStart`, `AutoRestart`, `Env`, `GithubToken`, `UseLoggedInUser`
382382
- `SessionConfig` fields: `Model`, `Tools`, `Hooks`, `SystemMessage`, `MCPServers`, `AvailableTools`, `ExcludedTools`, `Streaming`, `ReasoningEffort`, `Provider`, `InfiniteSessions`, `CustomAgents`, `WorkingDirectory`
383-
- `Session` methods: `Send()`, `SendAndWait()`, `GetMessages()`, `Destroy()`, `Abort()`, `ExportSession()`
383+
- `Session` methods: `Send()`, `SendAndWait()`, `GetMessages()`, `Disconnect()`, `Abort()`, `ExportSession()`
384384
- Hook fields: `OnPreToolUse`, `OnPostToolUse`, `OnUserPromptSubmitted`, `OnSessionStart`, `OnSessionEnd`, `OnErrorOccurred`
385385

386386
#### .NET Validation

.github/workflows/cross-repo-issue-analysis.md

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: Analyzes copilot-sdk issues to determine if a fix is needed in copilot-agent-runtime, then opens a linked issue and suggested-fix PR there
2+
description: Analyzes copilot-sdk issues to determine if a fix is needed in copilot-agent-runtime, then opens a linked issue there
33
on:
44
issues:
55
types: [labeled]
@@ -13,15 +13,13 @@ if: "github.event_name == 'workflow_dispatch' || github.event.label.name == 'run
1313
permissions:
1414
contents: read
1515
issues: read
16-
pull-requests: read
1716
steps:
1817
- name: Clone copilot-agent-runtime
1918
run: git clone --depth 1 https://x-access-token:${{ secrets.RUNTIME_TRIAGE_TOKEN }}@github.com/github/copilot-agent-runtime.git ${{ github.workspace }}/copilot-agent-runtime
2019
tools:
2120
github:
2221
toolsets: [default]
2322
github-token: ${{ secrets.RUNTIME_TRIAGE_TOKEN }}
24-
edit:
2523
bash:
2624
- "grep:*"
2725
- "find:*"
@@ -42,12 +40,6 @@ safe-outputs:
4240
labels: [upstream-from-sdk, ai-triaged]
4341
target-repo: "github/copilot-agent-runtime"
4442
max: 1
45-
create-pull-request:
46-
title-prefix: "[copilot-sdk] "
47-
labels: [upstream-from-sdk, ai-suggested-fix]
48-
draft: true
49-
target-repo: "github/copilot-agent-runtime"
50-
5143
timeout-minutes: 20
5244
---
5345

@@ -106,18 +98,13 @@ Classify the issue into one of these categories:
10698
- References the original SDK issue (e.g., `github/copilot-sdk#123`)
10799
- Includes the specific files and code paths involved
108100
- Suggests a fix approach
109-
- Create a draft PR in `github/copilot-agent-runtime` with a suggested fix:
110-
- Make the minimal, targeted code changes needed
111-
- Include a clear PR description linking back to both issues
112-
- If you're uncertain about the fix, still create the PR as a starting point for discussion
113101

114102
3. **Needs-investigation**: You cannot confidently determine the root cause. Label the issue `needs-investigation`.
115103

116104
## Guidelines
117105

118106
1. **Be thorough but focused**: Read enough code to be confident in your analysis, but don't read every file in both repos
119107
2. **Err on the side of creating the runtime issue**: If there's a reasonable chance the fix is in the runtime, create the issue. False positives are better than missed upstream bugs.
120-
3. **Make actionable PRs**: Even if the fix isn't perfect, a draft PR with a concrete starting point is more useful than just an issue description
121-
4. **Link everything**: Always cross-reference between the SDK issue, runtime issue, and runtime PR so maintainers can follow the trail
122-
5. **Be specific**: When describing the root cause, point to specific files, functions, and line numbers in both repos
123-
6. **Don't duplicate**: Before creating a runtime issue, search existing open issues in `github/copilot-agent-runtime` to avoid duplicates. If a related issue exists, reference it instead of creating a new one.
108+
3. **Link everything**: Always cross-reference between the SDK issue and runtime issue so maintainers can follow the trail
109+
4. **Be specific**: When describing the root cause, point to specific files, functions, and line numbers in both repos
110+
5. **Don't duplicate**: Before creating a runtime issue, search existing open issues in `github/copilot-agent-runtime` to avoid duplicates. If a related issue exists, reference it instead of creating a new one.

.github/workflows/publish.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
options:
1515
- latest
1616
- prerelease
17+
- unstable
1718
version:
1819
description: "Version override (optional, e.g., 1.0.0). If empty, auto-increments."
1920
type: string
@@ -66,8 +67,8 @@ jobs:
6667
fi
6768
else
6869
if [[ "$VERSION" != *-* ]]; then
69-
echo "❌ Error: Version '$VERSION' has no prerelease suffix but dist-tag is 'prerelease'" >> $GITHUB_STEP_SUMMARY
70-
echo "Use a version with suffix (e.g., '1.0.0-preview.0') for prerelease"
70+
echo "❌ Error: Version '$VERSION' has no prerelease suffix but dist-tag is '${{ github.event.inputs.dist-tag }}'" >> $GITHUB_STEP_SUMMARY
71+
echo "Use a version with suffix (e.g., '1.0.0-preview.0') for prerelease/unstable"
7172
exit 1
7273
fi
7374
fi
@@ -107,11 +108,12 @@ jobs:
107108
name: nodejs-package
108109
path: nodejs/*.tgz
109110
- name: Publish to npm
110-
if: github.ref == 'refs/heads/main'
111+
if: github.ref == 'refs/heads/main' || github.event.inputs.dist-tag == 'unstable'
111112
run: npm publish --tag ${{ github.event.inputs.dist-tag }} --access public --registry https://registry.npmjs.org
112113

113114
publish-dotnet:
114115
name: Publish .NET SDK
116+
if: github.event.inputs.dist-tag != 'unstable'
115117
needs: version
116118
runs-on: ubuntu-latest
117119
defaults:
@@ -147,6 +149,7 @@ jobs:
147149

148150
publish-python:
149151
name: Publish Python SDK
152+
if: github.event.inputs.dist-tag != 'unstable'
150153
needs: version
151154
runs-on: ubuntu-latest
152155
defaults:
@@ -183,7 +186,7 @@ jobs:
183186
github-release:
184187
name: Create GitHub Release
185188
needs: [version, publish-nodejs, publish-dotnet, publish-python]
186-
if: github.ref == 'refs/heads/main'
189+
if: github.ref == 'refs/heads/main' && github.event.inputs.dist-tag != 'unstable'
187190
runs-on: ubuntu-latest
188191
steps:
189192
- uses: actions/checkout@v6.0.2

CHANGELOG.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,78 @@ All notable changes to the Copilot SDK are documented in this file.
55
This changelog is automatically generated by an AI agent when stable releases are published.
66
See [GitHub Releases](https://github.com/github/copilot-sdk/releases) for the full list.
77

8+
## [v0.1.32](https://github.com/github/copilot-sdk/releases/tag/v0.1.32) (2026-03-07)
9+
10+
### Feature: backward compatibility with v2 CLI servers
11+
12+
SDK applications written against the v3 API now also work when connected to a v2 CLI server, with no code changes required. The SDK detects the server's protocol version and automatically adapts v2 `tool.call` and `permission.request` messages into the same user-facing handlers used by v3. ([#706](https://github.com/github/copilot-sdk/pull/706))
13+
14+
```ts
15+
const session = await client.createSession({
16+
tools: [myTool], // unchanged — works with v2 and v3 servers
17+
onPermissionRequest: approveAll,
18+
});
19+
```
20+
21+
```cs
22+
var session = await client.CreateSessionAsync(new SessionConfig {
23+
Tools = [myTool], // unchanged — works with v2 and v3 servers
24+
OnPermissionRequest = approveAll,
25+
});
26+
```
27+
28+
## [v0.1.31](https://github.com/github/copilot-sdk/releases/tag/v0.1.31) (2026-03-07)
29+
30+
### Feature: multi-client tool and permission broadcasts (protocol v3)
31+
32+
The SDK now uses protocol version 3, where the runtime broadcasts `external_tool.requested` and `permission.requested` as session events to all connected clients. This enables multi-client architectures where different clients contribute different tools, or where multiple clients observe the same permission prompts — if one client approves, all clients see the result. Your existing tool and permission handler code is unchanged. ([#686](https://github.com/github/copilot-sdk/pull/686))
33+
34+
```ts
35+
// Two clients each register different tools; the agent can use both
36+
const session1 = await client1.createSession({
37+
tools: [defineTool("search", { handler: doSearch })],
38+
onPermissionRequest: approveAll,
39+
});
40+
const session2 = await client2.resumeSession(session1.id, {
41+
tools: [defineTool("analyze", { handler: doAnalyze })],
42+
onPermissionRequest: approveAll,
43+
});
44+
```
45+
46+
```cs
47+
var session1 = await client1.CreateSessionAsync(new SessionConfig {
48+
Tools = [AIFunctionFactory.Create(DoSearch, "search")],
49+
OnPermissionRequest = PermissionHandlers.ApproveAll,
50+
});
51+
var session2 = await client2.ResumeSessionAsync(session1.Id, new ResumeSessionConfig {
52+
Tools = [AIFunctionFactory.Create(DoAnalyze, "analyze")],
53+
OnPermissionRequest = PermissionHandlers.ApproveAll,
54+
});
55+
```
56+
57+
### Feature: strongly-typed `PermissionRequestResultKind` for .NET and Go
58+
59+
Rather than comparing `result.Kind` against undiscoverable magic strings like `"approved"` or `"denied-interactively-by-user"`, .NET and Go now provide typed constants. Node and Python already had typed unions for this; this brings full parity. ([#631](https://github.com/github/copilot-sdk/pull/631))
60+
61+
```cs
62+
session.OnPermissionCompleted += (e) => {
63+
if (e.Result.Kind == PermissionRequestResultKind.Approved) { /* ... */ }
64+
if (e.Result.Kind == PermissionRequestResultKind.DeniedInteractivelyByUser) { /* ... */ }
65+
};
66+
```
67+
68+
```go
69+
// Go: PermissionKindApproved, PermissionKindDeniedByRules,
70+
// PermissionKindDeniedCouldNotRequestFromUser, PermissionKindDeniedInteractivelyByUser
71+
if result.Kind == copilot.PermissionKindApproved { /* ... */ }
72+
```
73+
74+
### Other changes
75+
76+
- feature: **[Python]** **[Go]** add `get_last_session_id()` / `GetLastSessionID()` for SDK-wide parity (was already available in Node and .NET) ([#671](https://github.com/github/copilot-sdk/pull/671))
77+
- improvement: **[Python]** add `timeout` parameter to generated RPC methods, allowing callers to override the default 30s timeout for long-running operations ([#681](https://github.com/github/copilot-sdk/pull/681))
78+
- bugfix: **[Go]** `PermissionRequest` fields are now properly typed (`ToolName`, `Diff`, `Path`, etc.) instead of a generic `Extra map[string]any` catch-all ([#685](https://github.com/github/copilot-sdk/pull/685))
79+
880
## [v0.1.30](https://github.com/github/copilot-sdk/releases/tag/v0.1.30) (2026-03-03)
981

1082
### Feature: support overriding built-in tools

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ Yes, the GitHub Copilot SDK allows you to define custom agents, skills, and tool
9191

9292
### Are there instructions for Copilot to speed up development with the SDK?
9393

94-
Yes, check out the custom instructions at [`github/awesome-copilot`](https://github.com/github/awesome-copilot/blob/main/collections/copilot-sdk.md).
94+
Yes, check out the custom instructions for each SDK:
95+
96+
- **[Node.js / TypeScript](https://github.com/github/awesome-copilot/blob/main/instructions/copilot-sdk-nodejs.instructions.md)**
97+
- **[Python](https://github.com/github/awesome-copilot/blob/main/instructions/copilot-sdk-python.instructions.md)**
98+
- **[.NET](https://github.com/github/awesome-copilot/blob/main/instructions/copilot-sdk-csharp.instructions.md)**
99+
- **[Go](https://github.com/github/awesome-copilot/blob/main/instructions/copilot-sdk-go.instructions.md)**
95100

96101
### What models are supported?
97102

@@ -107,8 +112,12 @@ Please use the [GitHub Issues](https://github.com/github/copilot-sdk/issues) pag
107112

108113
## Quick Links
109114

115+
- **[Documentation](./docs/index.md)** – Full documentation index
110116
- **[Getting Started](./docs/getting-started.md)** – Tutorial to get up and running
117+
- **[Setup Guides](./docs/setup/index.md)** – Architecture, deployment, and scaling
111118
- **[Authentication](./docs/auth/index.md)** – GitHub OAuth, BYOK, and more
119+
- **[Features](./docs/features/index.md)** – Hooks, custom agents, MCP, skills, and more
120+
- **[Troubleshooting](./docs/troubleshooting/debugging.md)** – Common issues and solutions
112121
- **[Cookbook](https://github.com/github/awesome-copilot/blob/main/cookbook/copilot-sdk)** – Practical recipes for common tasks across all languages
113122
- **[More Resources](https://github.com/github/awesome-copilot/blob/main/collections/copilot-sdk.md)** – Additional examples, tutorials, and community resources
114123

assets/copilot.png

7.26 KB
Loading

0 commit comments

Comments
 (0)