Skip to content

Commit 5817ec0

Browse files
Update SDK snapshot for Copilot CLI 1.0.99-0
1 parent ad20f9f commit 5817ec0

247 files changed

Lines changed: 30337 additions & 5224 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/workflows/block-remove-before-merge.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
check-paths:
1515
name: "No remove-before-merge directories"
1616
if: github.event_name == 'pull_request' && github.base_ref == 'main'
17-
runs-on: ubuntu-26.04-2core-agent-runtime
17+
runs-on: ubuntu-slim
1818
steps:
1919
- uses: actions/checkout@v7
2020
with:

‎.github/workflows/sdk-rust.yml‎

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
os: ${{ fromJSON(inputs.platform == 'linux-x64' && '["ubuntu-26.04-2core-agent-runtime"]' || inputs.platform == 'darwin-arm64' && '["macos-26-xlarge-agent-runtime"]' || inputs.platform == 'win32-x64' && '["windows-2025-4core-agent-runtime"]' || '["ubuntu-26.04-2core-agent-runtime","macos-26-xlarge-agent-runtime","windows-2025-4core-agent-runtime"]') }}
33-
runs-on: ${{ matrix.os }}
33+
# Staged runtimes plus multiple Cargo feature builds exhaust the standard
34+
# Linux runner disk during in-process linking. Keep the existing check names.
35+
runs-on: ${{ matrix.os == 'ubuntu-26.04-2core-agent-runtime' && 'ubuntu-26.04-16core-agent-runtime' || matrix.os }}
3436
defaults:
3537
run:
3638
shell: bash
@@ -45,6 +47,12 @@ jobs:
4547
- uses: actions/checkout@v7
4648
with:
4749
persist-credentials: false
50+
- name: Report initial Linux disk capacity
51+
if: runner.os == 'Linux'
52+
working-directory: .
53+
run: |
54+
df -h . "$RUNNER_TEMP"
55+
df -i . "$RUNNER_TEMP"
4856
- uses: ./.github/actions/download-sdk-runtime
4957
with:
5058
artifact-name: ${{ runner.os == 'Linux' && format('executable-sdk-{0}-{1}-gnu', runner.os, runner.arch) || format('executable-sdk-{0}-{1}', runner.os, runner.arch) }}
@@ -92,18 +100,6 @@ jobs:
92100
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
93101
RUST_E2E_CONCURRENCY: 4
94102
run: cargo test --no-default-features --features runtime,test-support,derive -- --test-threads=4 --nocapture
95-
- name: Report Linux Rust build resources
96-
if: failure() && runner.os == 'Linux'
97-
run: |
98-
echo "::group::Rust SDK build resources"
99-
df -h . "$RUNNER_TEMP"
100-
df -i . "$RUNNER_TEMP"
101-
free -h
102-
if [ -d target ]; then
103-
du -sh target
104-
fi
105-
echo "::endgroup::"
106-
107103
- name: Test in-process smoke
108104
id: inprocess
109105
if: ${{ !cancelled() && (steps.subprocess.outcome == 'success' || steps.subprocess.outcome == 'failure') }}
@@ -123,6 +119,20 @@ jobs:
123119
cargo test --no-default-features --features test-support,local-runtime,derive
124120
--test e2e client::should_use_configured_github_host_for_authentication
125121
-- --exact --test-threads=1 --nocapture
122+
- name: Report Linux Rust build resources
123+
if: always() && runner.os == 'Linux'
124+
working-directory: .
125+
run: |
126+
echo "::group::Rust SDK build resources"
127+
df -h . "$RUNNER_TEMP"
128+
df -i . "$RUNNER_TEMP"
129+
free -h
130+
for directory in "$SDK_HOME/rust/target" "$RUNNER_TEMP/copilot-sdk-runtime" dist-cli dist-bin; do
131+
if [ -d "$directory" ]; then
132+
du -sh "$directory"
133+
fi
134+
done
135+
echo "::endgroup::"
126136
127137
rust-musl-x64:
128138
name: "Rust (Alpine x64)"

‎.github/workflows/sdk.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ jobs:
169169
name: "Detect SDK layout"
170170
needs: detect-sdk-changes
171171
if: ${{ !cancelled() && (needs.detect-sdk-changes.result != 'success' || needs.detect-sdk-changes.outputs.has_sdk_changes == 'true') }}
172-
runs-on: ubuntu-26.04-2core-agent-runtime
172+
runs-on: ubuntu-slim
173173
outputs:
174174
runtime-source: ${{ steps.detect.outputs.runtime-source }}
175175
sdk-home: ${{ steps.detect.outputs.sdk-home }}
@@ -574,6 +574,9 @@ jobs:
574574
working-directory: ${{ needs.detect-layout.outputs.sdk-home }}/nodejs
575575
- run: npm ci
576576
working-directory: ${{ needs.detect-layout.outputs.sdk-home }}/scripts/codegen
577+
- name: Test all six source generators
578+
run: npm run test:codegen
579+
working-directory: ${{ needs.detect-layout.outputs.sdk-home }}
577580
- if: needs.detect-layout.outputs.runtime-source == 'published'
578581
run: npm ci
579582
working-directory: ${{ needs.detect-layout.outputs.sdk-home }}/java/scripts/codegen

‎CONTRIBUTING.md‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,67 @@ matrices. Their remaining E2E tests should exercise handwritten SDK behavior
208208
such as connection lifecycle, session orchestration, callbacks, custom tools,
209209
configuration, and language-specific integrations.
210210

211+
### Testing source generators
212+
213+
All six SDK generators have direct schema-to-source tests in
214+
`nodejs/test/*-codegen.test.ts`, alongside shared schema and legacy-parameter
215+
tests. From the **SDK root**, install only the Node dependencies and run:
216+
217+
```bash
218+
npm --prefix nodejs ci
219+
npm --prefix scripts/codegen ci
220+
npm run test:codegen
221+
```
222+
223+
This command bypasses runtime preparation and SDK generation. It excludes E2E
224+
files during discovery so the shared Vitest setup doesn't build the replay
225+
harness. The tests call
226+
the production in-memory renderers, including Python's Quicktype pipeline;
227+
they need no running CLI, network schema downloads, or target-language
228+
compilers or formatters. They also run with the Node unit suite and in the
229+
SDK freshness job. Java's schema-fetch tooling tests remain separate in
230+
`java/scripts/codegen`; compiler-dependent regressions such as
231+
`scripts/codegen/csharp-dictionary-roundtrip.test.ts` also run separately.
232+
233+
Use fresh schemas from `nodejs/test/codegen-fixtures.ts` for the common baseline
234+
and contract matrix. Coverage includes required/optional and nullable fields
235+
across scalars, objects, arrays, and maps; multi-hop references shared by
236+
requests and results; nested unions and additive variants; wire-name escaping;
237+
RPC scopes, metadata, and internal methods; and multiple event payload shapes.
238+
All six exercise complete event rendering, including discovery and registration
239+
where the language emits them. Each language also checks `A -> B -> A` rendering
240+
for both RPC and event output to catch leaked generator state.
241+
Keep assertions scoped to the affected declaration, method, or codec, and
242+
check absence where widening or duplication would be a regression.
243+
244+
Keep language-specific expectations and historical regressions in each language's
245+
test file rather than forcing identical output policies. Callback registration
246+
is covered for TypeScript, C#, Go, and Python; Java and Rust don't emit that
247+
surface. Java uses boxed record components across presence/nullability
248+
combinations and JSON-compatible fallbacks for some nested unions. Internal
249+
methods and internal-only types and namespaces are package-private; definitions
250+
also used by public methods remain public. The shared boolean-union
251+
fixture uses the published `EnqueueCommandResult` names supported by Rust's
252+
allowlist. Python tests exercise union postprocessing and legacy keyword-only
253+
parameters through Quicktype; RPC fixtures include the MCP and filesystem capability types
254+
required by its production postprocessor.
255+
256+
Java's known boolean-wire defect has five separate `it.fails` assertions.
257+
Rendering and file lookup run in ordinary setup, outside expected-failure checks.
258+
Fixing any assertion makes its test fail until `fails` is removed.
259+
260+
Each language has a small RPC and event source snapshot under
261+
`nodejs/test/__snapshots__/`. Pair snapshots with explicit contract assertions,
262+
and review generated source against the schema before accepting an update:
263+
264+
```bash
265+
npm run test:codegen -- --update
266+
```
267+
268+
These tests check emission correctness. Generation-freshness checks only detect
269+
stale committed output; generated-artifact tests and runtime E2Es check different
270+
boundaries and are not substitutes for generator tests.
271+
211272
### Testing an unreleased runtime API
212273

213274
In `github/copilot-agent-runtime`, Rust contracts under

‎docs/features/session-persistence.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ With `model: "auto"`, the optional `capi.autoTier` setting selects an Auto routi
313313

314314
When the runtime's default-off `DYNAMIC_AUTO_TIERS` feature is enabled, the session's `model.list` RPC also returns optional `auto` metadata from the provider's `/meta` endpoint. Use the enabled descriptors with `type: "auto"` to discover additional supported tier identifiers, their display names, descriptions, and ordering. The existing selection methods and JSON fields accept these identifiers. A discovery failure does not fall back to `/models`, and a successful response without `auto` metadata provides no selectable Auto tiers.
315315

316+
To populate a model picker before any session exists, enable `DYNAMIC_AUTO_TIERS` in the runtime's environment (for example, the `env` client option). The server-level `models.list` RPC (`client.rpc.models.list()` in Node.js) then returns the same `auto` metadata from the same `/meta` response, with the same no-fallback behavior. The server-level listing reads the flag the runtime resolved at startup, not per-session feature flags or experiment assignments, so set the flag where you launch the runtime. With the flag disabled, `models.list` is unchanged and omits `auto`.
317+
316318
Treat tier identifiers as extensible values, not a closed enumeration. Existing named values remain available; for additional identifiers, use strings in Node.js and Python, `AutoTier("premium-v2")` in Go, `new AutoTier("premium-v2")` in .NET, `AutoTier::Custom` in Rust, or `AutoTier.fromValue` in Java. The provider's `defaultTier` describes its default routing without creating a committed SDK preference.
317319

318320
If a persisted tier is removed or disabled, resume preserves the explicit preference rather than replacing it with the provider's default. Select an available replacement before activating Auto routing.

‎docs/features/streaming-events.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ Emitted when a tool finishes executing—successfully or with an error.
578578
| `model` | `string` | | Model that generated this tool call |
579579
| `interactionId` | `string` | | CAPI interaction ID |
580580
| `isUserRequested` | `boolean` | | `true` when the user explicitly requested this tool call |
581-
| `result` | `Result` | | Present on success (see below) |
581+
| `result` | `Result` | | Present on success, and on failure when the tool returned content with its error (see below) |
582582
| `error` | `{ message, code? }` | | Present on failure |
583583
| `toolTelemetry` | `object` | | Tool-specific telemetry (e.g., CodeQL check counts) |
584584
| `parentToolCallId` | `string` | | Deprecated. Use envelope-level `agentId` for sub-agent attribution |

‎docs/hooks/user-prompt-submitted.md‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,28 @@ Return `null` or `undefined` to use the prompt unchanged. Otherwise, return an o
142142
| `modifiedPrompt` | string | Modified prompt to use instead of original |
143143
| `additionalContext` | string | Extra context added to the conversation |
144144
| `suppressOutput` | boolean | If true, suppress the assistant's response output |
145+
| `decision` | `"block"` | Refuse the prompt (see [Blocking a prompt](#blocking-a-prompt)) |
146+
| `reason` | string | Why the prompt was blocked; required with `decision` |
147+
148+
### Blocking a prompt
149+
150+
Return a block decision to refuse the prompt:
151+
152+
```json
153+
{
154+
"decision": "block",
155+
"reason": "Prompts may not include credentials."
156+
}
157+
```
158+
159+
No model turn runs and no user message is recorded. The session emits an ephemeral `session.warning` with `warningType: "policy_blocked"` that carries the reason. The public member names follow each language's conventions:
160+
161+
| Meaning | Node.js / Python | Go / .NET | Rust | Java |
162+
|---------|------------------|-----------|------|------|
163+
| Block the prompt | `decision: "block"` | `Decision = "block"` | `decision: Some("block".into())` | `UserPromptSubmittedHookOutput.block(reason)` |
164+
| Why it was blocked | `reason` | `Reason` | `reason` | the `reason` argument |
165+
166+
In Go, an empty `Reason` is omitted from the output, and the prompt is blocked only when a reason is present.
145167

146168
## Examples
147169

@@ -347,10 +369,10 @@ const session = await client.createSession({
347369
onUserPromptSubmitted: async (input) => {
348370
for (const pattern of BLOCKED_PATTERNS) {
349371
if (pattern.test(input.prompt)) {
350-
// Replace the prompt with a warning message
372+
// Refuse the prompt; the reason reaches the client as a session.warning
351373
return {
352-
modifiedPrompt: "[Content blocked: Please don't include sensitive credentials in your prompts. Use environment variables instead.]",
353-
suppressOutput: true,
374+
decision: "block",
375+
reason: "Please don't include sensitive credentials in your prompts. Use environment variables instead.",
354376
};
355377
}
356378
}

‎docs/runtime-supervised-host.md‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ the runtime commit, not a separate `github/copilot-sdk` commit. Run SDK commands
1515
from `src/sdk` unless a command names another working directory.
1616

1717
Both runtime and SDK pin SDK protocol version 3. The standard AHP client is
18-
pinned to `@microsoft/agent-host-protocol@0.9.0`, matching the host's
19-
`rust/v0.9.0` source pin (`60706330f2f351b09f150d9a9c3c0eaedfc8e8b9`).
18+
pinned to `@microsoft/agent-host-protocol@0.9.0`. The host serves AHP 1.0
19+
and retains AHP 0.9 compatibility; the CLI client still negotiates AHP 0.9.
2020
The host prototype `d62d982`
2121
and SDK sample prototype `8fd2498` were inspected as references, not cherry-picked
2222
as production implementations. Their application-side TCP relay is not the
@@ -458,7 +458,19 @@ lifetime is separate from durable publication.
458458
`--ahp-host [--listen host:port] [--workspace directory]` serves this same backend
459459
in the CLI process, using normal SDK session construction, managed policy,
460460
hooks, authentication and telemetry. The old promotion backend and duplicate
461-
commands have been removed. Local-owner `/remote on|off|show` retains its independent
461+
commands have been removed. The CLI defaults to a random required local
462+
connection token. `--ahp-host-token <value>` supplies a fixed nonempty token
463+
(`localServer.token`); `--ahp-host-disable-token` sets
464+
`localServer.requireConnectionToken` to `false`. These options require
465+
`--ahp-host` and cannot be combined. Explicit tokens are visible in process
466+
arguments and may be stored in shell history. Startup prints a connectable
467+
`AHP 1.0 endpoint` URL with the active token URL-encoded in its `tkn` query parameter,
468+
not a separate token line. Disabling the token leaves the URL without that
469+
parameter. Treat this stdout URL as a credential; ordinary host logs retain
470+
the bare endpoint. GitHub authentication and resource authorization remain
471+
required in both modes, independently of SDK `--auth-token-env` or client-side
472+
`--ahp-authenticate-with-github`.
473+
Local-owner `/remote on|off|show` retains its independent
462474
Mission Control path; the old attached-AHP-client export toggle is intentionally unavailable.
463475
`COPILOT_AHP_SHARE_BIND` can select a wider listener for sharing;
464476
the CLI's managed remote-control policy still gates off-machine publication.

‎dotnet/README.md‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,18 @@ new CopilotClient(CopilotClientOptions? options = null)
112112
- `BaseDirectory` - Base directory for Copilot data (session state, config, etc.). Sets `COPILOT_HOME` on the spawned runtime process. When not set, the runtime defaults to `~/.copilot`. Useful in restricted environments where only specific directories are writable. Ignored when connecting via `RuntimeConnection.ForUri(...)`.
113113
- `EnableRemoteSessions` - Enables remote-session features.
114114
- `Environment` - Environment variables to pass to the runtime process.
115+
116+
For the native standalone runtime, set the `Environment` dictionary entry
117+
`["COPILOT_GITHUB_TELEMETRY_DISABLED"] = "true"` before startup to disable direct
118+
GitHub telemetry uploads for the entire host, including sessionless events.
119+
Authentication, `OnGitHubTelemetry` forwarding, and user-configured
120+
OpenTelemetry export remain unchanged. This is separate from
121+
`EnableSessionTelemetry = false`, which disables only a session's pipeline.
122+
The value must be exactly `"true"`; changing it requires a runtime restart.
123+
The Node CLI host does not use this variable. In-process connections reject
124+
per-client `Environment`; set the variable in the host process environment
125+
before starting the runtime instead.
126+
115127
- `Logger` - `ILogger` instance for SDK logging.
116128
- `GitHubToken` - GitHub token for authentication. When provided, takes priority over other auth methods.
117129
- `UseLoggedInUser` - Whether to use logged-in user for authentication (default: true, but false when `GitHubToken` is provided). Cannot be used with `RuntimeConnection.ForUri(...)`.
@@ -1394,7 +1406,7 @@ var session = await client.CreateSessionAsync(new SessionConfig
13941406
- `OnPreToolUse` - Intercept tool calls before execution. Can allow/deny or modify arguments.
13951407
- `OnPostToolUse` - Process tool results after successful execution. Can modify results or add context.
13961408
- `OnPostToolUseFailure` - Observe failed tool executions and inject extra context to guide the model's next step.
1397-
- `OnUserPromptSubmitted` - Intercept user prompts. Can modify the prompt before processing.
1409+
- `OnUserPromptSubmitted` - Intercept user prompts. Can modify the prompt before processing, or return `new UserPromptSubmittedHookOutput { Decision = "block", Reason = "..." }` to refuse it: no model turn runs, no user message is recorded, and the session emits an ephemeral `session.warning` (`warningType: "policy_blocked"`) carrying the reason.
13981410
- `OnSessionStart` - Run logic when a session starts or resumes.
13991411
- `OnSessionEnd` - Cleanup or logging when session ends.
14001412
- `OnErrorOccurred` - Handle errors with retry/skip/abort strategies.

0 commit comments

Comments
 (0)