@github/copilot-sdk 1.0.0-beta.10 → 1.0.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC.
4
4
 
5
- > **Note:** This SDK is in public preview and may change in breaking ways.
6
-
7
5
  ## Installation
8
6
 
9
7
  ```bash
@@ -57,7 +55,7 @@ await session.disconnect();
57
55
  await client.stop();
58
56
  ```
59
57
 
60
- Sessions also support `Symbol.asyncDispose` for use with [`await using`](https://github.com/tc39/proposal-explicit-resource-management) (TypeScript 5.2+/Node.js 18.0+):
58
+ Sessions also support `Symbol.asyncDispose` for use with [`await using`](https://github.com/tc39/proposal-explicit-resource-management) (TypeScript 5.2+ / Node.js 20+):
61
59
 
62
60
  ```typescript
63
61
  await using session = await client.createSession({
@@ -82,14 +80,20 @@ new CopilotClient(options?: CopilotClientOptions)
82
80
  - `connection?: RuntimeConnection` - How to connect to the Copilot runtime. Construct via the factory functions on `RuntimeConnection`:
83
81
  - `RuntimeConnection.forStdio({ path?, args? })` (default) — spawn the runtime and communicate over its stdin/stdout.
84
82
  - `RuntimeConnection.forTcp({ port?, connectionToken?, path?, args? })` — spawn the runtime as a TCP server.
85
- - `RuntimeConnection.forUri(url, { connectionToken? })` — connect to an already-running runtime (mutually exclusive with `gitHubToken`/`useLoggedInUser`).
86
- - `cwd?: string` - Working directory for the runtime process (default: current process cwd).
83
+ - `RuntimeConnection.forUri(url, { connectionToken? })` — connect to an already-running runtime (mutually exclusive with `gitHubToken`/`useLoggedInUser`). There is no top-level `cliUrl` shortcut; use this factory for URL-based connections.
84
+ - `mode?: "empty" | "copilot-cli"` - Defaulting strategy. Use `"empty"` for multi-user server mode; defaults to `"copilot-cli"`.
85
+ - `workingDirectory?: string` - Working directory for the runtime process (default: current process cwd).
87
86
  - `baseDirectory?: string` - Base directory for Copilot data (session state, config, etc.). Sets `COPILOT_HOME` on the spawned runtime. When not set, the runtime defaults to `~/.copilot`. Ignored when connecting via `RuntimeConnection.forUri`.
88
- - `logLevel?: string` - Log level. When omitted, the runtime uses its own default (currently `"info"`).
87
+ - `logLevel?: "none" | "error" | "warning" | "info" | "debug" | "all"` - Log level. When omitted, the runtime uses its own default (currently `"info"`).
88
+ - `env?: Record<string, string | undefined>` - Environment variables for the runtime process. When omitted, inherits `process.env`.
89
89
  - `gitHubToken?: string` - GitHub token for authentication. When provided, takes priority over other auth methods.
90
90
  - `useLoggedInUser?: boolean` - Whether to use logged-in user for authentication (default: true, but false when `gitHubToken` is provided). Cannot be used with `RuntimeConnection.forUri`.
91
+ - `onListModels?: () => Promise<ModelInfo[]> | ModelInfo[]` - Optional model-list provider, useful when using a custom provider.
91
92
  - `telemetry?: TelemetryConfig` - OpenTelemetry configuration for the runtime process. Providing this object enables telemetry — no separate flag needed. See [Telemetry](#telemetry) below.
92
93
  - `onGetTraceContext?: TraceContextProvider` - Advanced: callback for linking your application's own OpenTelemetry spans into the same distributed trace as the runtime's spans. Not needed for normal telemetry collection. See [Telemetry](#telemetry) below.
94
+ - `sessionFs?: SessionFsConfig` - Custom session filesystem provider.
95
+ - `sessionIdleTimeoutSeconds?: number` - Server-wide idle timeout for sessions in seconds. Ignored when connecting via `RuntimeConnection.forUri`.
96
+ - `enableRemoteSessions?: boolean` - Enable Mission Control remote session support. Ignored when connecting via `RuntimeConnection.forUri`.
93
97
 
94
98
  #### Methods
95
99
 
@@ -163,7 +167,7 @@ Get the ID of the session currently displayed in the TUI. Only available when co
163
167
 
164
168
  Request the TUI to switch to displaying the specified session. Only available in TUI+server mode.
165
169
 
166
- ##### `on(eventType: SessionLifecycleEventType, handler): () => void`
170
+ ##### `onLifecycle(eventType: SessionLifecycleEventType, handler): () => void`
167
171
 
168
172
  Subscribe to a specific session lifecycle event type. Returns an unsubscribe function.
169
173
 
@@ -173,7 +177,7 @@ const unsubscribe = client.onLifecycle("session.foreground", (event) => {
173
177
  });
174
178
  ```
175
179
 
176
- ##### `on(handler: SessionLifecycleHandler): () => void`
180
+ ##### `onLifecycle(handler: SessionLifecycleHandler): () => void`
177
181
 
178
182
  Subscribe to all session lifecycle events. Returns an unsubscribe function.
179
183
 
@@ -782,6 +782,7 @@ class CopilotClient {
782
782
  clientName: config.clientName,
783
783
  reasoningEffort: config.reasoningEffort,
784
784
  reasoningSummary: config.reasoningSummary,
785
+ contextTier: config.contextTier,
785
786
  tools: config.tools?.map((tool) => ({
786
787
  name: tool.name,
787
788
  description: tool.description,
@@ -792,6 +793,7 @@ class CopilotClient {
792
793
  canvases: config.canvases?.map((canvas) => canvas.declaration),
793
794
  requestCanvasRenderer: config.requestCanvasRenderer,
794
795
  requestExtensions: config.requestExtensions,
796
+ extensionSdkPath: config.extensionSdkPath,
795
797
  extensionInfo: config.extensionInfo,
796
798
  commands: config.commands?.map((cmd) => ({
797
799
  name: cmd.name,
@@ -943,6 +945,7 @@ class CopilotClient {
943
945
  model: config.model,
944
946
  reasoningEffort: config.reasoningEffort,
945
947
  reasoningSummary: config.reasoningSummary,
948
+ contextTier: config.contextTier,
946
949
  systemMessage: wireSystemMessage,
947
950
  availableTools: toolFilterOptions.availableTools,
948
951
  excludedTools: toolFilterOptions.excludedTools,
@@ -958,6 +961,7 @@ class CopilotClient {
958
961
  canvases: config.canvases?.map((canvas) => canvas.declaration),
959
962
  requestCanvasRenderer: config.requestCanvasRenderer,
960
963
  requestExtensions: config.requestExtensions,
964
+ extensionSdkPath: config.extensionSdkPath,
961
965
  extensionInfo: config.extensionInfo,
962
966
  commands: config.commands?.map((cmd) => ({
963
967
  name: cmd.name,
@@ -997,7 +1001,7 @@ class CopilotClient {
997
1001
  instructionDirectories: config.instructionDirectories,
998
1002
  disabledSkills: config.disabledSkills,
999
1003
  infiniteSessions: config.infiniteSessions,
1000
- suppressResumeEvent: config.suppressResumeEvent,
1004
+ disableResume: config.suppressResumeEvent,
1001
1005
  continuePendingWork: config.continuePendingWork,
1002
1006
  gitHubToken: config.gitHubToken,
1003
1007
  remoteSession: config.remoteSession,
@@ -35,8 +35,10 @@ async function joinSession(config = {}) {
35
35
  );
36
36
  }
37
37
  const client = new import_client.CopilotClient({ _internalConnection: { kind: "parent-process" } });
38
+ const { extensionSdkPath: _stripped, ...rest } = config;
39
+ void _stripped;
38
40
  return client.resumeSession(sessionId, {
39
- ...config,
41
+ ...rest,
40
42
  onPermissionRequest: config.onPermissionRequest ?? import_types.defaultJoinSessionPermissionHandler,
41
43
  suppressResumeEvent: config.suppressResumeEvent ?? true
42
44
  });
@@ -152,6 +152,12 @@ function createServerRpc(connection) {
152
152
  reload: async () => connection.sendRequest("user.settings.reload", {})
153
153
  }
154
154
  },
155
+ runtime: {
156
+ /**
157
+ * Gracefully shuts down an SDK-owned runtime. The response is sent only after cleanup completes; callers may then terminate the owned runtime process.
158
+ */
159
+ shutdown: async () => connection.sendRequest("runtime.shutdown", {})
160
+ },
155
161
  sessionFs: {
156
162
  /**
157
163
  * Registers an SDK client as the session filesystem provider.
@@ -438,7 +444,7 @@ function createSessionRpc(connection, sessionId) {
438
444
  /**
439
445
  * Gets the currently selected model for the session.
440
446
  *
441
- * @returns The currently selected model and reasoning effort for the session.
447
+ * @returns The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume.
442
448
  */
443
449
  getCurrent: async () => connection.sendRequest("session.model.getCurrent", { sessionId }),
444
450
  /**
@@ -918,7 +924,13 @@ function createSessionRpc(connection, sessionId) {
918
924
  /**
919
925
  * Reloads extension definitions and processes for the session.
920
926
  */
921
- reload: async () => connection.sendRequest("session.extensions.reload", { sessionId })
927
+ reload: async () => connection.sendRequest("session.extensions.reload", { sessionId }),
928
+ /**
929
+ * Push attachments into the next user-message turn from an extension. The host should surface them as composer pills and forward them via the next session.send call. Callable only by extension-owned connections.
930
+ *
931
+ * @param params Parameters for session.extensions.sendAttachmentsToMessage.
932
+ */
933
+ sendAttachmentsToMessage: async (params) => connection.sendRequest("session.extensions.sendAttachmentsToMessage", { sessionId, ...params })
922
934
  },
923
935
  /** @experimental */
924
936
  tools: {
package/dist/client.js CHANGED
@@ -768,6 +768,7 @@ class CopilotClient {
768
768
  clientName: config.clientName,
769
769
  reasoningEffort: config.reasoningEffort,
770
770
  reasoningSummary: config.reasoningSummary,
771
+ contextTier: config.contextTier,
771
772
  tools: config.tools?.map((tool) => ({
772
773
  name: tool.name,
773
774
  description: tool.description,
@@ -778,6 +779,7 @@ class CopilotClient {
778
779
  canvases: config.canvases?.map((canvas) => canvas.declaration),
779
780
  requestCanvasRenderer: config.requestCanvasRenderer,
780
781
  requestExtensions: config.requestExtensions,
782
+ extensionSdkPath: config.extensionSdkPath,
781
783
  extensionInfo: config.extensionInfo,
782
784
  commands: config.commands?.map((cmd) => ({
783
785
  name: cmd.name,
@@ -929,6 +931,7 @@ class CopilotClient {
929
931
  model: config.model,
930
932
  reasoningEffort: config.reasoningEffort,
931
933
  reasoningSummary: config.reasoningSummary,
934
+ contextTier: config.contextTier,
932
935
  systemMessage: wireSystemMessage,
933
936
  availableTools: toolFilterOptions.availableTools,
934
937
  excludedTools: toolFilterOptions.excludedTools,
@@ -944,6 +947,7 @@ class CopilotClient {
944
947
  canvases: config.canvases?.map((canvas) => canvas.declaration),
945
948
  requestCanvasRenderer: config.requestCanvasRenderer,
946
949
  requestExtensions: config.requestExtensions,
950
+ extensionSdkPath: config.extensionSdkPath,
947
951
  extensionInfo: config.extensionInfo,
948
952
  commands: config.commands?.map((cmd) => ({
949
953
  name: cmd.name,
@@ -983,7 +987,7 @@ class CopilotClient {
983
987
  instructionDirectories: config.instructionDirectories,
984
988
  disabledSkills: config.disabledSkills,
985
989
  infiniteSessions: config.infiniteSessions,
986
- suppressResumeEvent: config.suppressResumeEvent,
990
+ disableResume: config.suppressResumeEvent,
987
991
  continuePendingWork: config.continuePendingWork,
988
992
  gitHubToken: config.gitHubToken,
989
993
  remoteSession: config.remoteSession,
@@ -1,7 +1,7 @@
1
1
  import type { CopilotSession } from "./session.js";
2
2
  import { type ExtensionInfo, type PermissionHandler, type ResumeSessionConfig } from "./types.js";
3
3
  export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js";
4
- export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest"> & {
4
+ export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest" | "extensionSdkPath"> & {
5
5
  onPermissionRequest?: PermissionHandler;
6
6
  };
7
7
  export type { ExtensionInfo };
package/dist/extension.js CHANGED
@@ -15,8 +15,10 @@ async function joinSession(config = {}) {
15
15
  );
16
16
  }
17
17
  const client = new CopilotClient({ _internalConnection: { kind: "parent-process" } });
18
+ const { extensionSdkPath: _stripped, ...rest } = config;
19
+ void _stripped;
18
20
  return client.resumeSession(sessionId, {
19
- ...config,
21
+ ...rest,
20
22
  onPermissionRequest: config.onPermissionRequest ?? defaultJoinSessionPermissionHandler,
21
23
  suppressResumeEvent: config.suppressResumeEvent ?? true
22
24
  });
@@ -3,7 +3,7 @@
3
3
  * Generated from: api.schema.json
4
4
  */
5
5
  import type { MessageConnection } from "vscode-jsonrpc/node.js";
6
- import type { AbortReason, EmbeddedBlobResourceContents, EmbeddedTextResourceContents, McpServerSource, McpServerStatus, PermissionPromptRequest, PermissionRule, ReasoningSummary, SessionEvent, SessionMode, ShutdownType, SkillSource, UserToolSessionApproval } from "./session-events.js";
6
+ import type { AbortReason, Attachment, ContextTier, EmbeddedBlobResourceContents, EmbeddedTextResourceContents, McpServerSource, McpServerStatus, PermissionPromptRequest, PermissionRule, ReasoningSummary, SessionEvent, SessionMode, ShutdownType, SkillSource, UserToolSessionApproval } from "./session-events.js";
7
7
  /**
8
8
  * Where the agent definition was loaded from
9
9
  *
@@ -390,7 +390,7 @@ export type FilterMapping = {
390
390
  * via the `definition` "InstalledPluginSource".
391
391
  */
392
392
  /** @experimental */
393
- export type InstalledPluginSource = string | InstalledPluginSourceGithub | InstalledPluginSourceUrl | InstalledPluginSourceLocal;
393
+ export type InstalledPluginSource = string | InstalledPluginSourceGitHub | InstalledPluginSourceUrl | InstalledPluginSourceLocal;
394
394
  /**
395
395
  * Category of instruction source — used for merge logic
396
396
  *
@@ -654,7 +654,7 @@ export type SessionContextInfo = {
654
654
  */
655
655
  compactionThreshold: number;
656
656
  /**
657
- * Total context limit for /context display. promptTokenLimit + min(32k or 64k, outputTokenLimit) depending on model.
657
+ * Total context limit for /context display: promptTokenLimit + outputTokenLimit (the model's full max_output_tokens reserved on top of the prompt budget).
658
658
  */
659
659
  limit: number;
660
660
  /**
@@ -865,6 +865,28 @@ export type PermissionsSetApproveAllSource =
865
865
  | "autopilot_confirmation"
866
866
  /** Allow-all was enabled through an RPC caller. */
867
867
  | "rpc";
868
+ /**
869
+ * Schema for the `PushAttachment` type.
870
+ *
871
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
872
+ * via the `definition` "PushAttachment".
873
+ */
874
+ /** @experimental */
875
+ export type PushAttachment = PushAttachmentFile | PushAttachmentDirectory | PushAttachmentSelection | PushAttachmentGitHubReference | PushAttachmentBlob | ExtensionContextPushInput;
876
+ /**
877
+ * Type of GitHub reference
878
+ *
879
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
880
+ * via the `definition` "PushAttachmentGitHubReferenceType".
881
+ */
882
+ /** @experimental */
883
+ export type PushAttachmentGitHubReferenceType =
884
+ /** GitHub issue reference. */
885
+ "issue"
886
+ /** GitHub pull request reference. */
887
+ | "pr"
888
+ /** GitHub discussion reference. */
889
+ | "discussion";
868
890
  /**
869
891
  * Whether this item is a queued user message or a queued slash command / model change
870
892
  *
@@ -907,28 +929,6 @@ export type SendAgentMode =
907
929
  | "autopilot"
908
930
  /** The agent is in shell-focused UI mode. */
909
931
  | "shell";
910
- /**
911
- * A user message attachment — a file, directory, code selection, blob, or GitHub reference
912
- *
913
- * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
914
- * via the `definition` "SendAttachment".
915
- */
916
- /** @experimental */
917
- export type SendAttachment = SendAttachmentFile | SendAttachmentDirectory | SendAttachmentSelection | SendAttachmentGithubReference | SendAttachmentBlob;
918
- /**
919
- * Type of GitHub reference
920
- *
921
- * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
922
- * via the `definition` "SendAttachmentGithubReferenceType".
923
- */
924
- /** @experimental */
925
- export type SendAttachmentGithubReferenceType =
926
- /** GitHub issue reference. */
927
- "issue"
928
- /** GitHub pull request reference. */
929
- | "pr"
930
- /** GitHub discussion reference. */
931
- | "discussion";
932
932
  /**
933
933
  * How to deliver the message. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn.
934
934
  *
@@ -1009,7 +1009,7 @@ export type SessionFsSqliteQueryType =
1009
1009
  * via the `definition` "SessionInstalledPluginSource".
1010
1010
  */
1011
1011
  /** @experimental */
1012
- export type SessionInstalledPluginSource = string | SessionInstalledPluginSourceGithub | SessionInstalledPluginSourceUrl | SessionInstalledPluginSourceLocal;
1012
+ export type SessionInstalledPluginSource = string | SessionInstalledPluginSourceGitHub | SessionInstalledPluginSourceUrl | SessionInstalledPluginSourceLocal;
1013
1013
  /**
1014
1014
  * Public-facing workspace metadata for this session, or null if the session has no associated workspace. Excludes runtime-internal fields (GitHub IDs, summary count, internal flags).
1015
1015
  *
@@ -2652,7 +2652,7 @@ export interface ConnectRemoteSessionParams {
2652
2652
  sessionId: string;
2653
2653
  }
2654
2654
  /**
2655
- * The currently selected model and reasoning effort for the session.
2655
+ * The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume.
2656
2656
  *
2657
2657
  * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
2658
2658
  * via the `definition` "CurrentModel".
@@ -2667,6 +2667,7 @@ export interface CurrentModel {
2667
2667
  * Reasoning effort level currently applied to the active model, when one is set. Reads `Session.getReasoningEffort()` synchronously after `getSelectedModel()` resolves so the two values are reported as a snapshot.
2668
2668
  */
2669
2669
  reasoningEffort?: string;
2670
+ contextTier?: ContextTier;
2670
2671
  }
2671
2672
  /**
2672
2673
  * Lightweight metadata for a currently initialized session tool
@@ -2875,6 +2876,29 @@ export interface Extension {
2875
2876
  */
2876
2877
  pid?: number;
2877
2878
  }
2879
+ /**
2880
+ * Slim input shape for extension_context attachments; identity fields are runtime-derived.
2881
+ *
2882
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
2883
+ * via the `definition` "ExtensionContextPushInput".
2884
+ */
2885
+ /** @experimental */
2886
+ export interface ExtensionContextPushInput {
2887
+ /**
2888
+ * Attachment type discriminator
2889
+ */
2890
+ type: "extension_context";
2891
+ /**
2892
+ * Human-readable composer pill label
2893
+ */
2894
+ title: string;
2895
+ /**
2896
+ * Caller-supplied JSON payload (required, may be null but not undefined)
2897
+ */
2898
+ payload: {
2899
+ [k: string]: unknown | undefined;
2900
+ };
2901
+ }
2878
2902
  /**
2879
2903
  * Extensions discovered for the session, with their current status.
2880
2904
  *
@@ -3411,13 +3435,13 @@ export interface InstalledPlugin {
3411
3435
  source?: InstalledPluginSource;
3412
3436
  }
3413
3437
  /**
3414
- * Schema for the `InstalledPluginSourceGithub` type.
3438
+ * Schema for the `InstalledPluginSourceGitHub` type.
3415
3439
  *
3416
3440
  * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
3417
- * via the `definition` "InstalledPluginSourceGithub".
3441
+ * via the `definition` "InstalledPluginSourceGitHub".
3418
3442
  */
3419
3443
  /** @experimental */
3420
- export interface InstalledPluginSourceGithub {
3444
+ export interface InstalledPluginSourceGitHub {
3421
3445
  /**
3422
3446
  * Constant value. Always "github".
3423
3447
  */
@@ -4599,7 +4623,7 @@ export interface ModelBillingTokenPrices {
4599
4623
  */
4600
4624
  batchSize?: number;
4601
4625
  /**
4602
- * Maximum context window tokens for the default tier
4626
+ * Prompt token budget (max_prompt_tokens) for the default tier. The total context window is this value plus the model's max_output_tokens.
4603
4627
  */
4604
4628
  contextMax?: number;
4605
4629
  longContext?: ModelBillingTokenPricesLongContext;
@@ -4624,7 +4648,7 @@ export interface ModelBillingTokenPricesLongContext {
4624
4648
  */
4625
4649
  cachePrice?: number;
4626
4650
  /**
4627
- * Maximum context window tokens for the long context tier
4651
+ * Prompt token budget (max_prompt_tokens) for the long context tier. The total context window is this value plus the model's max_output_tokens.
4628
4652
  */
4629
4653
  contextMax?: number;
4630
4654
  }
@@ -4774,12 +4798,7 @@ export interface ModelSwitchToRequest {
4774
4798
  reasoningEffort?: string;
4775
4799
  reasoningSummary?: ReasoningSummary;
4776
4800
  modelCapabilities?: ModelCapabilitiesOverride;
4777
- /**
4778
- * Explicit context tier for the selected model. `"default"` / `"long_context"` pin the tier; `null` clears any previous explicit choice; `undefined` leaves the existing tier untouched.
4779
- */
4780
- contextTier?: "default"
4781
- /** Pin the session to the long-context tier when supported. */
4782
- | "long_context" | null;
4801
+ contextTier?: ContextTier;
4783
4802
  }
4784
4803
  /**
4785
4804
  * The model identifier active on the session after the switch.
@@ -6264,6 +6283,192 @@ export interface PluginList {
6264
6283
  */
6265
6284
  plugins: Plugin[];
6266
6285
  }
6286
+ /**
6287
+ * File attachment
6288
+ *
6289
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6290
+ * via the `definition` "PushAttachmentFile".
6291
+ */
6292
+ /** @experimental */
6293
+ export interface PushAttachmentFile {
6294
+ /**
6295
+ * Attachment type discriminator
6296
+ */
6297
+ type: "file";
6298
+ /**
6299
+ * Absolute file path
6300
+ */
6301
+ path: string;
6302
+ /**
6303
+ * User-facing display name for the attachment
6304
+ */
6305
+ displayName: string;
6306
+ lineRange?: PushAttachmentFileLineRange;
6307
+ }
6308
+ /**
6309
+ * Optional line range to scope the attachment to a specific section of the file
6310
+ *
6311
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6312
+ * via the `definition` "PushAttachmentFileLineRange".
6313
+ */
6314
+ /** @experimental */
6315
+ export interface PushAttachmentFileLineRange {
6316
+ /**
6317
+ * Start line number (1-based)
6318
+ */
6319
+ start: number;
6320
+ /**
6321
+ * End line number (1-based, inclusive)
6322
+ */
6323
+ end: number;
6324
+ }
6325
+ /**
6326
+ * Directory attachment
6327
+ *
6328
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6329
+ * via the `definition` "PushAttachmentDirectory".
6330
+ */
6331
+ /** @experimental */
6332
+ export interface PushAttachmentDirectory {
6333
+ /**
6334
+ * Attachment type discriminator
6335
+ */
6336
+ type: "directory";
6337
+ /**
6338
+ * Absolute directory path
6339
+ */
6340
+ path: string;
6341
+ /**
6342
+ * User-facing display name for the attachment
6343
+ */
6344
+ displayName: string;
6345
+ }
6346
+ /**
6347
+ * Code selection attachment from an editor
6348
+ *
6349
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6350
+ * via the `definition` "PushAttachmentSelection".
6351
+ */
6352
+ /** @experimental */
6353
+ export interface PushAttachmentSelection {
6354
+ /**
6355
+ * Attachment type discriminator
6356
+ */
6357
+ type: "selection";
6358
+ /**
6359
+ * Absolute path to the file containing the selection
6360
+ */
6361
+ filePath: string;
6362
+ /**
6363
+ * User-facing display name for the selection
6364
+ */
6365
+ displayName: string;
6366
+ /**
6367
+ * The selected text content
6368
+ */
6369
+ text: string;
6370
+ selection: PushAttachmentSelectionDetails;
6371
+ }
6372
+ /**
6373
+ * Position range of the selection within the file
6374
+ *
6375
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6376
+ * via the `definition` "PushAttachmentSelectionDetails".
6377
+ */
6378
+ /** @experimental */
6379
+ export interface PushAttachmentSelectionDetails {
6380
+ start: PushAttachmentSelectionDetailsStart;
6381
+ end: PushAttachmentSelectionDetailsEnd;
6382
+ }
6383
+ /**
6384
+ * Start position of the selection
6385
+ *
6386
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6387
+ * via the `definition` "PushAttachmentSelectionDetailsStart".
6388
+ */
6389
+ /** @experimental */
6390
+ export interface PushAttachmentSelectionDetailsStart {
6391
+ /**
6392
+ * Start line number (0-based)
6393
+ */
6394
+ line: number;
6395
+ /**
6396
+ * Start character offset within the line (0-based)
6397
+ */
6398
+ character: number;
6399
+ }
6400
+ /**
6401
+ * End position of the selection
6402
+ *
6403
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6404
+ * via the `definition` "PushAttachmentSelectionDetailsEnd".
6405
+ */
6406
+ /** @experimental */
6407
+ export interface PushAttachmentSelectionDetailsEnd {
6408
+ /**
6409
+ * End line number (0-based)
6410
+ */
6411
+ line: number;
6412
+ /**
6413
+ * End character offset within the line (0-based)
6414
+ */
6415
+ character: number;
6416
+ }
6417
+ /**
6418
+ * GitHub issue, pull request, or discussion reference
6419
+ *
6420
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6421
+ * via the `definition` "PushAttachmentGitHubReference".
6422
+ */
6423
+ /** @experimental */
6424
+ export interface PushAttachmentGitHubReference {
6425
+ /**
6426
+ * Attachment type discriminator
6427
+ */
6428
+ type: "github_reference";
6429
+ /**
6430
+ * Issue, pull request, or discussion number
6431
+ */
6432
+ number: number;
6433
+ /**
6434
+ * Title of the referenced item
6435
+ */
6436
+ title: string;
6437
+ referenceType: PushAttachmentGitHubReferenceType;
6438
+ /**
6439
+ * Current state of the referenced item (e.g., open, closed, merged)
6440
+ */
6441
+ state: string;
6442
+ /**
6443
+ * URL to the referenced item on GitHub
6444
+ */
6445
+ url: string;
6446
+ }
6447
+ /**
6448
+ * Blob attachment with inline base64-encoded data
6449
+ *
6450
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6451
+ * via the `definition` "PushAttachmentBlob".
6452
+ */
6453
+ /** @experimental */
6454
+ export interface PushAttachmentBlob {
6455
+ /**
6456
+ * Attachment type discriminator
6457
+ */
6458
+ type: "blob";
6459
+ /**
6460
+ * Base64-encoded content
6461
+ */
6462
+ data: string;
6463
+ /**
6464
+ * MIME type of the inline data
6465
+ */
6466
+ mimeType: string;
6467
+ /**
6468
+ * User-facing display name for the attachment
6469
+ */
6470
+ displayName?: string;
6471
+ }
6267
6472
  /**
6268
6473
  * Schema for the `QueuePendingItems` type.
6269
6474
  *
@@ -6504,190 +6709,21 @@ export interface SecretsAddFilterValuesResult {
6504
6709
  ok: true;
6505
6710
  }
6506
6711
  /**
6507
- * File attachment
6508
- *
6509
- * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6510
- * via the `definition` "SendAttachmentFile".
6511
- */
6512
- /** @experimental */
6513
- export interface SendAttachmentFile {
6514
- /**
6515
- * Attachment type discriminator
6516
- */
6517
- type: "file";
6518
- /**
6519
- * Absolute file path
6520
- */
6521
- path: string;
6522
- /**
6523
- * User-facing display name for the attachment
6524
- */
6525
- displayName: string;
6526
- lineRange?: SendAttachmentFileLineRange;
6527
- }
6528
- /**
6529
- * Optional line range to scope the attachment to a specific section of the file
6530
- *
6531
- * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6532
- * via the `definition` "SendAttachmentFileLineRange".
6533
- */
6534
- /** @experimental */
6535
- export interface SendAttachmentFileLineRange {
6536
- /**
6537
- * Start line number (1-based)
6538
- */
6539
- start: number;
6540
- /**
6541
- * End line number (1-based, inclusive)
6542
- */
6543
- end: number;
6544
- }
6545
- /**
6546
- * Directory attachment
6547
- *
6548
- * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6549
- * via the `definition` "SendAttachmentDirectory".
6550
- */
6551
- /** @experimental */
6552
- export interface SendAttachmentDirectory {
6553
- /**
6554
- * Attachment type discriminator
6555
- */
6556
- type: "directory";
6557
- /**
6558
- * Absolute directory path
6559
- */
6560
- path: string;
6561
- /**
6562
- * User-facing display name for the attachment
6563
- */
6564
- displayName: string;
6565
- }
6566
- /**
6567
- * Code selection attachment from an editor
6568
- *
6569
- * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6570
- * via the `definition` "SendAttachmentSelection".
6571
- */
6572
- /** @experimental */
6573
- export interface SendAttachmentSelection {
6574
- /**
6575
- * Attachment type discriminator
6576
- */
6577
- type: "selection";
6578
- /**
6579
- * Absolute path to the file containing the selection
6580
- */
6581
- filePath: string;
6582
- /**
6583
- * User-facing display name for the selection
6584
- */
6585
- displayName: string;
6586
- /**
6587
- * The selected text content
6588
- */
6589
- text: string;
6590
- selection: SendAttachmentSelectionDetails;
6591
- }
6592
- /**
6593
- * Position range of the selection within the file
6594
- *
6595
- * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6596
- * via the `definition` "SendAttachmentSelectionDetails".
6597
- */
6598
- /** @experimental */
6599
- export interface SendAttachmentSelectionDetails {
6600
- start: SendAttachmentSelectionDetailsStart;
6601
- end: SendAttachmentSelectionDetailsEnd;
6602
- }
6603
- /**
6604
- * Start position of the selection
6605
- *
6606
- * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6607
- * via the `definition` "SendAttachmentSelectionDetailsStart".
6608
- */
6609
- /** @experimental */
6610
- export interface SendAttachmentSelectionDetailsStart {
6611
- /**
6612
- * Start line number (0-based)
6613
- */
6614
- line: number;
6615
- /**
6616
- * Start character offset within the line (0-based)
6617
- */
6618
- character: number;
6619
- }
6620
- /**
6621
- * End position of the selection
6622
- *
6623
- * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6624
- * via the `definition` "SendAttachmentSelectionDetailsEnd".
6625
- */
6626
- /** @experimental */
6627
- export interface SendAttachmentSelectionDetailsEnd {
6628
- /**
6629
- * End line number (0-based)
6630
- */
6631
- line: number;
6632
- /**
6633
- * End character offset within the line (0-based)
6634
- */
6635
- character: number;
6636
- }
6637
- /**
6638
- * GitHub issue, pull request, or discussion reference
6639
- *
6640
- * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6641
- * via the `definition` "SendAttachmentGithubReference".
6642
- */
6643
- /** @experimental */
6644
- export interface SendAttachmentGithubReference {
6645
- /**
6646
- * Attachment type discriminator
6647
- */
6648
- type: "github_reference";
6649
- /**
6650
- * Issue, pull request, or discussion number
6651
- */
6652
- number: number;
6653
- /**
6654
- * Title of the referenced item
6655
- */
6656
- title: string;
6657
- referenceType: SendAttachmentGithubReferenceType;
6658
- /**
6659
- * Current state of the referenced item (e.g., open, closed, merged)
6660
- */
6661
- state: string;
6662
- /**
6663
- * URL to the referenced item on GitHub
6664
- */
6665
- url: string;
6666
- }
6667
- /**
6668
- * Blob attachment with inline base64-encoded data
6712
+ * Parameters for session.extensions.sendAttachmentsToMessage.
6669
6713
  *
6670
6714
  * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6671
- * via the `definition` "SendAttachmentBlob".
6715
+ * via the `definition` "SendAttachmentsToMessageParams".
6672
6716
  */
6673
6717
  /** @experimental */
6674
- export interface SendAttachmentBlob {
6675
- /**
6676
- * Attachment type discriminator
6677
- */
6678
- type: "blob";
6718
+ export interface SendAttachmentsToMessageParams {
6679
6719
  /**
6680
- * Base64-encoded content
6720
+ * Optional canvas instance binding the push for provenance. When supplied, the runtime resolves the canvas, verifies it is owned by the calling extension, and stamps canvasId/instanceId onto each extension_context entry. When omitted, no resolution runs and those fields stay unset on the attachment.
6681
6721
  */
6682
- data: string;
6722
+ instanceId?: string;
6683
6723
  /**
6684
- * MIME type of the inline data
6724
+ * Attachments to push into the next user-message turn. extension_context entries take the slim shape; standard variants take their full AttachmentSchema shape.
6685
6725
  */
6686
- mimeType: string;
6687
- /**
6688
- * User-facing display name for the attachment
6689
- */
6690
- displayName?: string;
6726
+ attachments: PushAttachment[];
6691
6727
  }
6692
6728
  /**
6693
6729
  * Parameters for sending a user message to the session
@@ -6708,7 +6744,7 @@ export interface SendRequest {
6708
6744
  /**
6709
6745
  * Optional attachments (files, directories, selections, blobs, GitHub references) to include with the message
6710
6746
  */
6711
- attachments?: SendAttachment[];
6747
+ attachments?: Attachment[];
6712
6748
  mode?: SendMode;
6713
6749
  /**
6714
6750
  * If true, adds the message to the front of the queue instead of the end
@@ -7391,13 +7427,13 @@ export interface SessionInstalledPlugin {
7391
7427
  source?: SessionInstalledPluginSource;
7392
7428
  }
7393
7429
  /**
7394
- * Schema for the `SessionInstalledPluginSourceGithub` type.
7430
+ * Schema for the `SessionInstalledPluginSourceGitHub` type.
7395
7431
  *
7396
7432
  * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
7397
- * via the `definition` "SessionInstalledPluginSourceGithub".
7433
+ * via the `definition` "SessionInstalledPluginSourceGitHub".
7398
7434
  */
7399
7435
  /** @experimental */
7400
- export interface SessionInstalledPluginSourceGithub {
7436
+ export interface SessionInstalledPluginSourceGitHub {
7401
7437
  /**
7402
7438
  * Constant value. Always "github".
7403
7439
  */
@@ -8127,6 +8163,10 @@ export interface SessionUpdateOptionsParams {
8127
8163
  * Whether to default custom agents to local-only execution.
8128
8164
  */
8129
8165
  customAgentsLocalOnly?: boolean;
8166
+ /**
8167
+ * When true, the selected custom agent's prompt is not injected into the user message (skill context is still injected). Used by automation triggers where the agent prompt is already in the problem statement.
8168
+ */
8169
+ suppressCustomAgentPrompt?: boolean;
8130
8170
  /**
8131
8171
  * Whether to skip loading custom instruction sources.
8132
8172
  */
@@ -10189,6 +10229,12 @@ export declare function createServerRpc(connection: MessageConnection): {
10189
10229
  reload: () => Promise<void>;
10190
10230
  };
10191
10231
  };
10232
+ runtime: {
10233
+ /**
10234
+ * Gracefully shuts down an SDK-owned runtime. The response is sent only after cleanup completes; callers may then terminate the owned runtime process.
10235
+ */
10236
+ shutdown: () => Promise<void>;
10237
+ };
10192
10238
  sessionFs: {
10193
10239
  /**
10194
10240
  * Registers an SDK client as the session filesystem provider.
@@ -10462,7 +10508,7 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
10462
10508
  /**
10463
10509
  * Gets the currently selected model for the session.
10464
10510
  *
10465
- * @returns The currently selected model and reasoning effort for the session.
10511
+ * @returns The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume.
10466
10512
  */
10467
10513
  getCurrent: () => Promise<CurrentModel>;
10468
10514
  /**
@@ -10943,6 +10989,12 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
10943
10989
  * Reloads extension definitions and processes for the session.
10944
10990
  */
10945
10991
  reload: () => Promise<void>;
10992
+ /**
10993
+ * Push attachments into the next user-message turn from an extension. The host should surface them as composer pills and forward them via the next session.send call. Callable only by extension-owned connections.
10994
+ *
10995
+ * @param params Parameters for session.extensions.sendAttachmentsToMessage.
10996
+ */
10997
+ sendAttachmentsToMessage: (params: SendAttachmentsToMessageParams) => Promise<void>;
10946
10998
  };
10947
10999
  /** @experimental */
10948
11000
  tools: {
@@ -126,6 +126,12 @@ function createServerRpc(connection) {
126
126
  reload: async () => connection.sendRequest("user.settings.reload", {})
127
127
  }
128
128
  },
129
+ runtime: {
130
+ /**
131
+ * Gracefully shuts down an SDK-owned runtime. The response is sent only after cleanup completes; callers may then terminate the owned runtime process.
132
+ */
133
+ shutdown: async () => connection.sendRequest("runtime.shutdown", {})
134
+ },
129
135
  sessionFs: {
130
136
  /**
131
137
  * Registers an SDK client as the session filesystem provider.
@@ -412,7 +418,7 @@ function createSessionRpc(connection, sessionId) {
412
418
  /**
413
419
  * Gets the currently selected model for the session.
414
420
  *
415
- * @returns The currently selected model and reasoning effort for the session.
421
+ * @returns The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume.
416
422
  */
417
423
  getCurrent: async () => connection.sendRequest("session.model.getCurrent", { sessionId }),
418
424
  /**
@@ -892,7 +898,13 @@ function createSessionRpc(connection, sessionId) {
892
898
  /**
893
899
  * Reloads extension definitions and processes for the session.
894
900
  */
895
- reload: async () => connection.sendRequest("session.extensions.reload", { sessionId })
901
+ reload: async () => connection.sendRequest("session.extensions.reload", { sessionId }),
902
+ /**
903
+ * Push attachments into the next user-message turn from an extension. The host should surface them as composer pills and forward them via the next session.send call. Callable only by extension-owned connections.
904
+ *
905
+ * @param params Parameters for session.extensions.sendAttachmentsToMessage.
906
+ */
907
+ sendAttachmentsToMessage: async (params) => connection.sendRequest("session.extensions.sendAttachmentsToMessage", { sessionId, ...params })
896
908
  },
897
909
  /** @experimental */
898
910
  tools: {
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Union of all session event variants emitted by the Copilot CLI runtime.
7
7
  */
8
- export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | PermissionsChangedEvent | PlanChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantUsageEvent | ModelCallFailureEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | McpAppToolCallCompleteEvent;
8
+ export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | PermissionsChangedEvent | PlanChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantUsageEvent | ModelCallFailureEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
9
9
  /**
10
10
  * Hosting platform type of the repository (github or ado)
11
11
  */
@@ -14,6 +14,14 @@ export type WorkingDirectoryContextHostType =
14
14
  "github"
15
15
  /** Repository is hosted on Azure DevOps. */
16
16
  | "ado";
17
+ /**
18
+ * Allowed values for the `ContextTier` enumeration.
19
+ */
20
+ export type ContextTier =
21
+ /** Default context tier with standard context window size. */
22
+ "default"
23
+ /** Extended context tier with a larger context window. */
24
+ | "long_context";
17
25
  /**
18
26
  * Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed")
19
27
  */
@@ -103,13 +111,13 @@ export type UserMessageAgentMode =
103
111
  /** The agent is in shell-focused UI mode. */
104
112
  | "shell";
105
113
  /**
106
- * A user message attachment — a file, directory, code selection, blob, or GitHub reference
114
+ * A user message attachment — a file, directory, code selection, blob, GitHub reference, or extension-supplied context payload
107
115
  */
108
- export type UserMessageAttachment = UserMessageAttachmentFile | UserMessageAttachmentDirectory | UserMessageAttachmentSelection | UserMessageAttachmentGithubReference | UserMessageAttachmentBlob;
116
+ export type Attachment = AttachmentFile | AttachmentDirectory | AttachmentSelection | AttachmentGitHubReference | AttachmentBlob | AttachmentExtensionContext;
109
117
  /**
110
118
  * Type of GitHub reference
111
119
  */
112
- export type UserMessageAttachmentGithubReferenceType =
120
+ export type AttachmentGitHubReferenceType =
113
121
  /** GitHub issue reference. */
114
122
  "issue"
115
123
  /** GitHub pull request reference. */
@@ -430,9 +438,7 @@ export interface StartData {
430
438
  /**
431
439
  * Context tier selected at session creation time for models with tiered context pricing; null when no tier is selected (e.g., non-tiered model)
432
440
  */
433
- contextTier?: "default"
434
- /** Extended context tier with a larger context window. */
435
- | "long_context" | null;
441
+ contextTier?: ContextTier | null;
436
442
  /**
437
443
  * Version string of the Copilot application
438
444
  */
@@ -547,9 +553,7 @@ export interface ResumeData {
547
553
  /**
548
554
  * Context tier currently selected at resume time; null when no tier is active
549
555
  */
550
- contextTier?: "default"
551
- /** Extended context tier with a larger context window. */
552
- | "long_context" | null;
556
+ contextTier?: ContextTier | null;
553
557
  /**
554
558
  * When true, tool calls and permission requests left in flight by the previous session lifetime remain pending after resume and the agentic loop awaits their results. User sends are queued behind the pending work until all such requests reach a terminal state. When false (the default), any such tool calls and permission requests are immediately marked as interrupted on resume.
555
559
  */
@@ -1042,9 +1046,7 @@ export interface ModelChangeData {
1042
1046
  /**
1043
1047
  * Context tier after the model change; null explicitly clears a previously selected tier
1044
1048
  */
1045
- contextTier?: "default"
1046
- /** Extended context tier with a larger context window. */
1047
- | "long_context" | null;
1049
+ contextTier?: ContextTier | null;
1048
1050
  /**
1049
1051
  * Newly selected model identifier
1050
1052
  */
@@ -1958,7 +1960,7 @@ export interface UserMessageData {
1958
1960
  /**
1959
1961
  * Files, selections, or GitHub references attached to the message
1960
1962
  */
1961
- attachments?: UserMessageAttachment[];
1963
+ attachments?: Attachment[];
1962
1964
  /**
1963
1965
  * The user's message text as displayed in the timeline
1964
1966
  */
@@ -1995,12 +1997,12 @@ export interface UserMessageData {
1995
1997
  /**
1996
1998
  * File attachment
1997
1999
  */
1998
- export interface UserMessageAttachmentFile {
2000
+ export interface AttachmentFile {
1999
2001
  /**
2000
2002
  * User-facing display name for the attachment
2001
2003
  */
2002
2004
  displayName: string;
2003
- lineRange?: UserMessageAttachmentFileLineRange;
2005
+ lineRange?: AttachmentFileLineRange;
2004
2006
  /**
2005
2007
  * Absolute file path
2006
2008
  */
@@ -2013,7 +2015,7 @@ export interface UserMessageAttachmentFile {
2013
2015
  /**
2014
2016
  * Optional line range to scope the attachment to a specific section of the file
2015
2017
  */
2016
- export interface UserMessageAttachmentFileLineRange {
2018
+ export interface AttachmentFileLineRange {
2017
2019
  /**
2018
2020
  * End line number (1-based, inclusive)
2019
2021
  */
@@ -2026,7 +2028,7 @@ export interface UserMessageAttachmentFileLineRange {
2026
2028
  /**
2027
2029
  * Directory attachment
2028
2030
  */
2029
- export interface UserMessageAttachmentDirectory {
2031
+ export interface AttachmentDirectory {
2030
2032
  /**
2031
2033
  * User-facing display name for the attachment
2032
2034
  */
@@ -2043,7 +2045,7 @@ export interface UserMessageAttachmentDirectory {
2043
2045
  /**
2044
2046
  * Code selection attachment from an editor
2045
2047
  */
2046
- export interface UserMessageAttachmentSelection {
2048
+ export interface AttachmentSelection {
2047
2049
  /**
2048
2050
  * User-facing display name for the selection
2049
2051
  */
@@ -2052,7 +2054,7 @@ export interface UserMessageAttachmentSelection {
2052
2054
  * Absolute path to the file containing the selection
2053
2055
  */
2054
2056
  filePath: string;
2055
- selection: UserMessageAttachmentSelectionDetails;
2057
+ selection: AttachmentSelectionDetails;
2056
2058
  /**
2057
2059
  * The selected text content
2058
2060
  */
@@ -2065,14 +2067,14 @@ export interface UserMessageAttachmentSelection {
2065
2067
  /**
2066
2068
  * Position range of the selection within the file
2067
2069
  */
2068
- export interface UserMessageAttachmentSelectionDetails {
2069
- end: UserMessageAttachmentSelectionDetailsEnd;
2070
- start: UserMessageAttachmentSelectionDetailsStart;
2070
+ export interface AttachmentSelectionDetails {
2071
+ end: AttachmentSelectionDetailsEnd;
2072
+ start: AttachmentSelectionDetailsStart;
2071
2073
  }
2072
2074
  /**
2073
2075
  * End position of the selection
2074
2076
  */
2075
- export interface UserMessageAttachmentSelectionDetailsEnd {
2077
+ export interface AttachmentSelectionDetailsEnd {
2076
2078
  /**
2077
2079
  * End character offset within the line (0-based)
2078
2080
  */
@@ -2085,7 +2087,7 @@ export interface UserMessageAttachmentSelectionDetailsEnd {
2085
2087
  /**
2086
2088
  * Start position of the selection
2087
2089
  */
2088
- export interface UserMessageAttachmentSelectionDetailsStart {
2090
+ export interface AttachmentSelectionDetailsStart {
2089
2091
  /**
2090
2092
  * Start character offset within the line (0-based)
2091
2093
  */
@@ -2098,12 +2100,12 @@ export interface UserMessageAttachmentSelectionDetailsStart {
2098
2100
  /**
2099
2101
  * GitHub issue, pull request, or discussion reference
2100
2102
  */
2101
- export interface UserMessageAttachmentGithubReference {
2103
+ export interface AttachmentGitHubReference {
2102
2104
  /**
2103
2105
  * Issue, pull request, or discussion number
2104
2106
  */
2105
2107
  number: number;
2106
- referenceType: UserMessageAttachmentGithubReferenceType;
2108
+ referenceType: AttachmentGitHubReferenceType;
2107
2109
  /**
2108
2110
  * Current state of the referenced item (e.g., open, closed, merged)
2109
2111
  */
@@ -2124,7 +2126,7 @@ export interface UserMessageAttachmentGithubReference {
2124
2126
  /**
2125
2127
  * Blob attachment with inline base64-encoded data
2126
2128
  */
2127
- export interface UserMessageAttachmentBlob {
2129
+ export interface AttachmentBlob {
2128
2130
  /**
2129
2131
  * Base64-encoded content
2130
2132
  */
@@ -2142,6 +2144,41 @@ export interface UserMessageAttachmentBlob {
2142
2144
  */
2143
2145
  type: "blob";
2144
2146
  }
2147
+ /**
2148
+ * Structured context contributed by an extension. Composer pills displayed in the host are forwarded back through session.send.attachments, then rendered into the model prompt as an <extension_context> XML block.
2149
+ */
2150
+ export interface AttachmentExtensionContext {
2151
+ /**
2152
+ * Provider-local canvas identifier when the push was bound to a canvas instance
2153
+ */
2154
+ canvasId?: string;
2155
+ /**
2156
+ * ISO 8601 timestamp captured by the runtime when the push was accepted
2157
+ */
2158
+ capturedAt: string;
2159
+ /**
2160
+ * Owning extension identifier. Runtime-derived from the caller's connection when produced via session.extensions.sendAttachmentsToMessage; preserved verbatim on subsequent transports.
2161
+ */
2162
+ extensionId: string;
2163
+ /**
2164
+ * Open canvas instance identifier when the push was bound to a canvas instance
2165
+ */
2166
+ instanceId?: string;
2167
+ /**
2168
+ * Caller-supplied JSON payload
2169
+ */
2170
+ payload?: {
2171
+ [k: string]: unknown | undefined;
2172
+ };
2173
+ /**
2174
+ * Human-readable composer pill label
2175
+ */
2176
+ title: string;
2177
+ /**
2178
+ * Attachment type discriminator
2179
+ */
2180
+ type: "extension_context";
2181
+ }
2145
2182
  /**
2146
2183
  * Session event "pending_messages.modified". Empty payload; the event signals that the pending message queue has changed
2147
2184
  */
@@ -2983,6 +3020,10 @@ export interface ToolExecutionStartData {
2983
3020
  * Original tool name on the MCP server, when the tool is an MCP tool
2984
3021
  */
2985
3022
  mcpToolName?: string;
3023
+ /**
3024
+ * Model identifier that generated this tool call
3025
+ */
3026
+ model?: string;
2986
3027
  /**
2987
3028
  * @deprecated
2988
3029
  * Tool call ID of the parent tool invocation when this event originates from a sub-agent
@@ -6658,6 +6699,45 @@ export interface CanvasRegistryChangedCanvasAction {
6658
6699
  */
6659
6700
  name: string;
6660
6701
  }
6702
+ /**
6703
+ * Session event "session.extensions.attachments_pushed".
6704
+ */
6705
+ export interface ExtensionsAttachmentsPushedEvent {
6706
+ /**
6707
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
6708
+ */
6709
+ agentId?: string;
6710
+ data: ExtensionsAttachmentsPushedData;
6711
+ /**
6712
+ * Always true for events that are transient and not persisted to the session event log on disk.
6713
+ */
6714
+ ephemeral: true;
6715
+ /**
6716
+ * Unique event identifier (UUID v4), generated when the event is emitted
6717
+ */
6718
+ id: string;
6719
+ /**
6720
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
6721
+ */
6722
+ parentId: string | null;
6723
+ /**
6724
+ * ISO 8601 timestamp when the event was created
6725
+ */
6726
+ timestamp: string;
6727
+ /**
6728
+ * Type discriminator. Always "session.extensions.attachments_pushed".
6729
+ */
6730
+ type: "session.extensions.attachments_pushed";
6731
+ }
6732
+ /**
6733
+ * Schema for the `ExtensionsAttachmentsPushedData` type.
6734
+ */
6735
+ export interface ExtensionsAttachmentsPushedData {
6736
+ /**
6737
+ * Attachments contributed by an extension; the host should surface these as composer pills and forward them via the next session.send call.
6738
+ */
6739
+ attachments: Attachment[];
6740
+ }
6661
6741
  /**
6662
6742
  * Session event "mcp_app.tool_call_complete". MCP App view called a tool on a connected MCP server (SEP-1865)
6663
6743
  */
package/dist/session.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createSessionRpc } from "./generated/rpc.js";
2
2
  import type { OpenCanvasInstance } from "./generated/rpc.js";
3
- import type { MessageOptions, ReasoningEffort, ReasoningSummary, ModelCapabilitiesOverride, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionUiApi, TypedSessionEventHandler } from "./types.js";
3
+ import type { MessageOptions, ContextTier, ReasoningEffort, ReasoningSummary, ModelCapabilitiesOverride, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionUiApi, TypedSessionEventHandler } from "./types.js";
4
4
  /** Assistant message event - the final response from the assistant. */
5
5
  export type AssistantMessageEvent = Extract<SessionEvent, {
6
6
  type: "assistant.message";
@@ -264,6 +264,7 @@ export declare class CopilotSession {
264
264
  setModel(model: string, options?: {
265
265
  reasoningEffort?: ReasoningEffort;
266
266
  reasoningSummary?: ReasoningSummary;
267
+ contextTier?: ContextTier;
267
268
  modelCapabilities?: ModelCapabilitiesOverride;
268
269
  }): Promise<void>;
269
270
  /**
package/dist/types.d.ts CHANGED
@@ -1226,6 +1226,11 @@ export interface LargeToolOutputConfig {
1226
1226
  * Valid reasoning effort levels for models that support it.
1227
1227
  */
1228
1228
  export type ReasoningEffort = "low" | "medium" | "high" | "xhigh";
1229
+ /**
1230
+ * Context window tier for the session. "long_context" pins the session to the
1231
+ * long-context tier when the selected model supports it.
1232
+ */
1233
+ export type ContextTier = "default" | "long_context";
1229
1234
  /**
1230
1235
  * Stable extension identity for session participants that provide canvases.
1231
1236
  */
@@ -1261,6 +1266,11 @@ export interface SessionConfigBase {
1261
1266
  * Use "none" to suppress summary output regardless of whether reasoning is enabled.
1262
1267
  */
1263
1268
  reasoningSummary?: ReasoningSummary;
1269
+ /**
1270
+ * Context window tier for models that support it. Use "long_context" to pin
1271
+ * the session to the long-context tier; omit or use "default" otherwise.
1272
+ */
1273
+ contextTier?: ContextTier;
1264
1274
  /** Per-property overrides for model capabilities, deep-merged over runtime defaults. */
1265
1275
  modelCapabilities?: ModelCapabilitiesOverride;
1266
1276
  /**
@@ -1314,6 +1324,19 @@ export interface SessionConfigBase {
1314
1324
  * stay clean.
1315
1325
  */
1316
1326
  requestExtensions?: boolean;
1327
+ /**
1328
+ * Optional override path to a `copilot-sdk/` folder to inject into
1329
+ * extension subprocesses for this session in place of the bundled SDK.
1330
+ * When unset or invalid (missing folder or missing `index.js` /
1331
+ * `extension.js`), the runtime falls back to the bundled SDK without
1332
+ * throwing. Takes precedence over any server-level default.
1333
+ *
1334
+ * Only honored on session create and resume — extensions joining via
1335
+ * `joinSession` cannot override the SDK path, because the extension
1336
+ * subprocess has already been forked by the host with the SDK the host
1337
+ * chose. `JoinSessionConfig` omits this field for that reason.
1338
+ */
1339
+ extensionSdkPath?: string;
1317
1340
  /**
1318
1341
  * Stable extension identity for canvas providers on this connection. When
1319
1342
  * set, the runtime uses `${source}:${name}` as the agent-facing extension
package/docs/examples.md CHANGED
@@ -158,7 +158,7 @@ Hooks intercept and modify behavior at key lifecycle points. Register them in th
158
158
  | `onPreToolUse` | Before a tool executes | Tool args, permission decision, add context |
159
159
  | `onPostToolUse` | After a tool executes successfully | Tool result, add context |
160
160
  | `onPostToolUseFailure` | After a tool execution returns a failure | Add hidden guidance to the model |
161
- | `onSessionStart` | Session starts or resumes | Add context, modify config |
161
+ | `onSessionStart` | Session starts or resumes | Add context |
162
162
  | `onSessionEnd` | Session ends | Cleanup actions, summary |
163
163
  | `onErrorOccurred` | An error occurs | Error handling strategy (retry/skip/abort) |
164
164
 
@@ -415,7 +415,7 @@ session.on("assistant.message", (event) => {
415
415
  | Event Type | Description | Key Data Fields |
416
416
  | --------------------------- | ------------------------------------------------ | ------------------------------------------------------ |
417
417
  | `assistant.message` | Agent's final response | `content`, `messageId`, `toolRequests` |
418
- | `assistant.streaming_delta` | Token-by-token streaming (ephemeral) | `totalResponseSizeBytes` |
418
+ | `assistant.message_delta` | Message content chunks (ephemeral) | `deltaContent` |
419
419
  | `tool.execution_start` | A tool is about to run | `toolCallId`, `toolName`, `arguments` |
420
420
  | `tool.execution_complete` | A tool finished running | `toolCallId`, `toolName`, `success`, `result`, `error` |
421
421
  | `user.message` | User sent a message | `content`, `attachments`, `source` |
@@ -629,8 +629,11 @@ const session = await joinSession({
629
629
  onPreToolUse: async (input) => {
630
630
  if (input.toolName === "bash") {
631
631
  const cmd = String(input.toolArgs?.command || "");
632
- if (/rm\\s+-rf\\s+\\/ / i.test(cmd) || /Remove-Item\\s+.*-Recurse/i.test(cmd)) {
633
- return { permissionDecision: "deny" };
632
+ if (/rm\\s+-rf\\s+\//i.test(cmd) || /Remove-Item\\s+.*-Recurse/i.test(cmd)) {
633
+ return {
634
+ permissionDecision: "deny",
635
+ permissionDecisionReason: "Destructive commands are not allowed.",
636
+ };
634
637
  }
635
638
  }
636
639
  },
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/github/copilot-sdk.git"
6
6
  },
7
- "version": "1.0.0-beta.10",
7
+ "version": "1.0.0-beta.12",
8
8
  "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
9
9
  "main": "./dist/cjs/index.js",
10
10
  "types": "./dist/index.d.ts",
@@ -44,7 +44,7 @@
44
44
  "generate": "cd ../scripts/codegen && npm run generate",
45
45
  "update:protocol-version": "tsx scripts/update-protocol-version.ts",
46
46
  "prepublishOnly": "npm run build",
47
- "package": "npm run clean && npm run build && node scripts/set-version.js && npm pack && npm version 0.1.0 --no-git-tag-version --allow-same-version"
47
+ "package": "npm run clean && npm run build && node scripts/set-version.js && npm pack && npm version 0.0.0-dev --no-git-tag-version --allow-same-version"
48
48
  },
49
49
  "keywords": [
50
50
  "github",
@@ -56,7 +56,7 @@
56
56
  "author": "GitHub",
57
57
  "license": "MIT",
58
58
  "dependencies": {
59
- "@github/copilot": "^1.0.56-1",
59
+ "@github/copilot": "^1.0.57",
60
60
  "vscode-jsonrpc": "^8.2.1",
61
61
  "zod": "^4.3.6"
62
62
  },