@github/copilot-sdk 1.0.1 → 1.0.2

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.
@@ -206,7 +206,17 @@ function createServerRpc(connection) {
206
206
  *
207
207
  * @returns Skills discovered across global and project sources.
208
208
  */
209
- discover: async (params) => connection.sendRequest("skills.discover", params)
209
+ discover: async (params) => connection.sendRequest("skills.discover", params),
210
+ /**
211
+ * Returns the canonical directories where a client may create skills that the runtime will recognize, including ones that do not exist yet. Project directories become active once created.
212
+ *
213
+ * @param params Optional project paths to enumerate.
214
+ *
215
+ * @returns Canonical locations where skills can be created so the runtime will recognize them.
216
+ *
217
+ * @experimental
218
+ */
219
+ getDiscoveryPaths: async (params) => connection.sendRequest("skills.getDiscoveryPaths", params)
210
220
  },
211
221
  /** @experimental */
212
222
  agents: {
@@ -217,7 +227,15 @@ function createServerRpc(connection) {
217
227
  *
218
228
  * @returns Agents discovered across user, project, plugin, and remote sources.
219
229
  */
220
- discover: async (params) => connection.sendRequest("agents.discover", params)
230
+ discover: async (params) => connection.sendRequest("agents.discover", params),
231
+ /**
232
+ * Returns the canonical directories where a client may create custom agents that the runtime will recognize, including ones that do not exist yet. Project directories become active once created.
233
+ *
234
+ * @param params Optional project paths to include when enumerating agent discovery directories.
235
+ *
236
+ * @returns Canonical locations where custom agents can be created so the runtime will recognize them.
237
+ */
238
+ getDiscoveryPaths: async (params) => connection.sendRequest("agents.getDiscoveryPaths", params)
221
239
  },
222
240
  /** @experimental */
223
241
  instructions: {
@@ -228,7 +246,15 @@ function createServerRpc(connection) {
228
246
  *
229
247
  * @returns Instruction sources discovered across user, repository, and plugin sources.
230
248
  */
231
- discover: async (params) => connection.sendRequest("instructions.discover", params)
249
+ discover: async (params) => connection.sendRequest("instructions.discover", params),
250
+ /**
251
+ * Returns the canonical files and directories where a client may create custom instructions that the runtime will recognize, including ones that do not exist yet. Repository targets become active once created.
252
+ *
253
+ * @param params Optional project paths to include when enumerating instruction discovery targets.
254
+ *
255
+ * @returns Canonical files and directories where custom instructions can be created so the runtime will recognize them.
256
+ */
257
+ getDiscoveryPaths: async (params) => connection.sendRequest("instructions.getDiscoveryPaths", params)
232
258
  },
233
259
  user: {
234
260
  settings: {
@@ -698,7 +724,13 @@ function createSessionRpc(connection, sessionId) {
698
724
  *
699
725
  * @returns Todo rows read from the session SQL database. Empty when no session database is available.
700
726
  */
701
- readSqlTodos: async () => connection.sendRequest("session.plan.readSqlTodos", { sessionId })
727
+ readSqlTodos: async () => connection.sendRequest("session.plan.readSqlTodos", { sessionId }),
728
+ /**
729
+ * Reads todo rows AND dependency edges from the session SQL database for structured progress UI. Same defensive behavior as readSqlTodos — returns empty arrays when the database, tables, or columns aren't available. Clients should call this on session start and after every `session.todos_changed` event to refresh structured-UI rendering.
730
+ *
731
+ * @returns Todo rows + dependency edges read from the session SQL database.
732
+ */
733
+ readSqlTodosWithDependencies: async () => connection.sendRequest("session.plan.readSqlTodosWithDependencies", { sessionId })
702
734
  },
703
735
  /** @experimental */
704
736
  workspaces: {
@@ -1081,6 +1113,17 @@ function createSessionRpc(connection, sessionId) {
1081
1113
  reload: async (params) => connection.sendRequest("session.plugins.reload", { sessionId, ...params })
1082
1114
  },
1083
1115
  /** @experimental */
1116
+ provider: {
1117
+ /**
1118
+ * Returns the provider endpoint and credentials the session is currently configured to talk to, so the caller can make inference calls directly against the same backend the session uses.
1119
+ *
1120
+ * @param params Optional model identifier to scope the endpoint snapshot to.
1121
+ *
1122
+ * @returns A snapshot of the provider endpoint the session is currently configured to talk to.
1123
+ */
1124
+ getEndpoint: async (params) => connection.sendRequest("session.provider.getEndpoint", { sessionId, ...params })
1125
+ },
1126
+ /** @experimental */
1084
1127
  options: {
1085
1128
  /**
1086
1129
  * Patches the genuinely-mutable subset of session options.
@@ -1152,7 +1195,15 @@ function createSessionRpc(connection, sessionId) {
1152
1195
  *
1153
1196
  * @returns Current lightweight tool metadata snapshot for the session.
1154
1197
  */
1155
- getCurrentMetadata: async () => connection.sendRequest("session.tools.getCurrentMetadata", { sessionId })
1198
+ getCurrentMetadata: async () => connection.sendRequest("session.tools.getCurrentMetadata", { sessionId }),
1199
+ /**
1200
+ * Updates the current session's live subagent settings after user settings change. The persisted user settings remain the source of truth for future sessions.
1201
+ *
1202
+ * @param params Subagent settings to apply to the current session
1203
+ *
1204
+ * @returns Empty result after applying subagent settings
1205
+ */
1206
+ updateSubagentSettings: async (params) => connection.sendRequest("session.tools.updateSubagentSettings", { sessionId, ...params })
1156
1207
  },
1157
1208
  /** @experimental */
1158
1209
  commands: {
@@ -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 | CanvasClosedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
8
+ export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | 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 | BinaryAssetEvent | 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 | CanvasClosedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
9
9
  /**
10
10
  * Hosting platform type of the repository (github or ado)
11
11
  */
@@ -164,6 +164,51 @@ export type AbortReason =
164
164
  | "remote_command"
165
165
  /** An MCP server delivered a user.abort notification. */
166
166
  | "user_abort";
167
+ /**
168
+ * Allowed values for the `ToolExecutionStartToolDescriptionMetaUIVisibility` enumeration.
169
+ */
170
+ export type ToolExecutionStartToolDescriptionMetaUIVisibility =
171
+ /** Tool is callable by the model (LLM tool surface) */
172
+ "model"
173
+ /** Tool is callable by the MCP App view (iframe) via session.mcp.apps.callTool */
174
+ | "app";
175
+ /**
176
+ * A model-facing binary result as persisted: full inline data, a size-omitted marker, or a deduplicated asset reference
177
+ */
178
+ /** @experimental */
179
+ export type PersistedBinaryResult = PersistedBinaryImage | OmittedBinaryResult | BinaryAssetReference;
180
+ /**
181
+ * Binary result type discriminator. Use "image" for images and "resource" for other binary data.
182
+ */
183
+ export type PersistedBinaryImageType =
184
+ /** Binary image data. */
185
+ "image"
186
+ /** Other binary resource data. */
187
+ | "resource";
188
+ /**
189
+ * Why the binary data is absent: it exceeded the inline size limit, or its asset was unavailable
190
+ */
191
+ export type OmittedBinaryOmittedReason =
192
+ /** Bytes exceeded the session's inline size limit. */
193
+ "too_large"
194
+ /** The referenced binary asset could not be found (e.g. a truncated log). */
195
+ | "asset_unavailable";
196
+ /**
197
+ * Binary result type discriminator. Use "image" for images and "resource" for other binary data.
198
+ */
199
+ export type OmittedBinaryType =
200
+ /** Binary image data. */
201
+ "image"
202
+ /** Other binary resource data. */
203
+ | "resource";
204
+ /**
205
+ * Binary result type discriminator. Use "image" for images and "resource" for other binary data.
206
+ */
207
+ export type BinaryAssetReferenceType =
208
+ /** Binary image data. */
209
+ "image"
210
+ /** Other binary resource data. */
211
+ | "resource";
167
212
  /**
168
213
  * A content block within a tool result, which may be text, terminal output, image, audio, or a resource
169
214
  */
@@ -198,6 +243,14 @@ export type SkillInvokedTrigger =
198
243
  | "agent-invoked"
199
244
  /** Skill content loaded as part of another context, such as a configured custom agent or subagent. */
200
245
  | "context-load";
246
+ /**
247
+ * Binary asset type discriminator. Use "image" for images and "resource" otherwise.
248
+ */
249
+ export type BinaryAssetType =
250
+ /** Binary image data. */
251
+ "image"
252
+ /** Other binary resource data. */
253
+ | "resource";
201
254
  /**
202
255
  * Message role: "system" for system prompts, "developer" for developer-injected instructions
203
256
  */
@@ -375,7 +428,11 @@ export type ExtensionsLoadedExtensionSource =
375
428
  /** Extension discovered from the current project. */
376
429
  "project"
377
430
  /** Extension discovered from the user's extension directory. */
378
- | "user";
431
+ | "user"
432
+ /** Extension contributed by an installed plugin. */
433
+ | "plugin"
434
+ /** Extension discovered from the current session's state directory. */
435
+ | "session";
379
436
  /**
380
437
  * Current status: running, disabled, failed, or starting
381
438
  */
@@ -1198,6 +1255,41 @@ export interface PlanChangedEvent {
1198
1255
  export interface PlanChangedData {
1199
1256
  operation: PlanChangedOperation;
1200
1257
  }
1258
+ /**
1259
+ * Session event "session.todos_changed". Signal-only event: the agent's todos or todo_deps table was written to. No payload — clients should call session.plan.readSqlTodosWithDependencies() to fetch the current state. Events arrive in order; clients can debounce on arrival if needed.
1260
+ */
1261
+ export interface TodosChangedEvent {
1262
+ /**
1263
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
1264
+ */
1265
+ agentId?: string;
1266
+ data: TodosChangedData;
1267
+ /**
1268
+ * Always true for events that are transient and not persisted to the session event log on disk.
1269
+ */
1270
+ ephemeral: true;
1271
+ /**
1272
+ * Unique event identifier (UUID v4), generated when the event is emitted
1273
+ */
1274
+ id: string;
1275
+ /**
1276
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
1277
+ */
1278
+ parentId: string | null;
1279
+ /**
1280
+ * ISO 8601 timestamp when the event was created
1281
+ */
1282
+ timestamp: string;
1283
+ /**
1284
+ * Type discriminator. Always "session.todos_changed".
1285
+ */
1286
+ type: "session.todos_changed";
1287
+ }
1288
+ /**
1289
+ * Signal-only event: the agent's todos or todo_deps table was written to. No payload — clients should call session.plan.readSqlTodosWithDependencies() to fetch the current state. Events arrive in order; clients can debounce on arrival if needed.
1290
+ */
1291
+ export interface TodosChangedData {
1292
+ }
1201
1293
  /**
1202
1294
  * Session event "session.workspace_file_changed". Workspace file change details including path and operation type
1203
1295
  */
@@ -2475,18 +2567,6 @@ export interface AssistantMessageEvent {
2475
2567
  * Assistant response containing text content, optional tool requests, and interaction metadata
2476
2568
  */
2477
2569
  export interface AssistantMessageData {
2478
- /**
2479
- * Raw Anthropic content array with advisor blocks (server_tool_use, advisor_tool_result) for verbatim round-tripping
2480
- *
2481
- * @experimental
2482
- */
2483
- anthropicAdvisorBlocks?: unknown[];
2484
- /**
2485
- * Anthropic advisor model ID used for this response, for timeline display on replay
2486
- *
2487
- * @experimental
2488
- */
2489
- anthropicAdvisorModel?: string;
2490
2570
  /**
2491
2571
  * Provider's completion / response identifier; shared across all chunks of a single API call. Used to group multi-chunk assistant utterances.
2492
2572
  */
@@ -2536,6 +2616,7 @@ export interface AssistantMessageData {
2536
2616
  * GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
2537
2617
  */
2538
2618
  requestId?: string;
2619
+ serverTools?: AssistantMessageServerTools;
2539
2620
  /**
2540
2621
  * Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
2541
2622
  */
@@ -2549,6 +2630,19 @@ export interface AssistantMessageData {
2549
2630
  */
2550
2631
  turnId?: string;
2551
2632
  }
2633
+ /**
2634
+ * Neutral provider-tagged server-side tool-use payload (tool search, advisor) for verbatim round-tripping
2635
+ */
2636
+ /** @experimental */
2637
+ export interface AssistantMessageServerTools {
2638
+ advisorModel?: string;
2639
+ functionCallNamespaces?: {
2640
+ [k: string]: string | undefined;
2641
+ };
2642
+ items?: unknown[];
2643
+ provider: string;
2644
+ rawContentBlocks?: unknown[];
2645
+ }
2552
2646
  /**
2553
2647
  * A tool invocation request from the assistant
2554
2648
  */
@@ -2762,6 +2856,11 @@ export interface AssistantUsageData {
2762
2856
  * Number of tokens written to prompt cache
2763
2857
  */
2764
2858
  cacheWriteTokens?: number;
2859
+ /**
2860
+ * Whether the model response was blocked or truncated by content filtering (finish_reason === 'content_filter'). For Anthropic models this corresponds to a 'refusal' stop reason.
2861
+ */
2862
+ contentFilterTriggered?: boolean;
2863
+ copilotUsage?: AssistantUsageCopilotUsage;
2765
2864
  /**
2766
2865
  * Model multiplier cost for billing purposes
2767
2866
  *
@@ -2772,6 +2871,10 @@ export interface AssistantUsageData {
2772
2871
  * Duration of the API call in milliseconds
2773
2872
  */
2774
2873
  duration?: number;
2874
+ /**
2875
+ * Finish reason reported by the model for this API call (e.g. "stop", "length", "tool_calls", "content_filter"). Normalized to OpenAI vocabulary; for Anthropic models a "refusal" stop reason maps to "content_filter".
2876
+ */
2877
+ finishReason?: string;
2775
2878
  /**
2776
2879
  * What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
2777
2880
  */
@@ -2818,6 +2921,15 @@ export interface AssistantUsageData {
2818
2921
  */
2819
2922
  timeToFirstTokenMs?: number;
2820
2923
  }
2924
+ /**
2925
+ * Per-request cost and usage data from the CAPI copilot_usage response field
2926
+ */
2927
+ export interface AssistantUsageCopilotUsage {
2928
+ /**
2929
+ * Total cost in nano-AI units for this request
2930
+ */
2931
+ totalNanoAiu: number;
2932
+ }
2821
2933
  /**
2822
2934
  * Token usage detail for a single billing category
2823
2935
  */
@@ -3057,6 +3169,7 @@ export interface ToolExecutionStartData {
3057
3169
  * Unique identifier for this tool call
3058
3170
  */
3059
3171
  toolCallId: string;
3172
+ toolDescription?: ToolExecutionStartToolDescription;
3060
3173
  /**
3061
3174
  * Name of the tool being executed
3062
3175
  */
@@ -3066,6 +3179,39 @@ export interface ToolExecutionStartData {
3066
3179
  */
3067
3180
  turnId?: string;
3068
3181
  }
3182
+ /**
3183
+ * Tool definition metadata, present for MCP tools with MCP Apps support
3184
+ */
3185
+ export interface ToolExecutionStartToolDescription {
3186
+ _meta?: ToolExecutionStartToolDescriptionMeta;
3187
+ /**
3188
+ * Tool description
3189
+ */
3190
+ description?: string;
3191
+ /**
3192
+ * Tool name
3193
+ */
3194
+ name: string;
3195
+ }
3196
+ /**
3197
+ * MCP Apps metadata for UI resource association
3198
+ */
3199
+ export interface ToolExecutionStartToolDescriptionMeta {
3200
+ ui?: ToolExecutionStartToolDescriptionMetaUI;
3201
+ }
3202
+ /**
3203
+ * Schema for the `ToolExecutionStartToolDescriptionMetaUI` type.
3204
+ */
3205
+ export interface ToolExecutionStartToolDescriptionMetaUI {
3206
+ /**
3207
+ * URI of the UI resource
3208
+ */
3209
+ resourceUri?: string;
3210
+ /**
3211
+ * Who can access this tool
3212
+ */
3213
+ visibility?: ToolExecutionStartToolDescriptionMetaUIVisibility[];
3214
+ }
3069
3215
  /**
3070
3216
  * Session event "tool.execution_partial_result". Streaming tool execution output for incremental result display
3071
3217
  */
@@ -3246,6 +3392,12 @@ export interface ToolExecutionCompleteError {
3246
3392
  * Tool execution result on success
3247
3393
  */
3248
3394
  export interface ToolExecutionCompleteResult {
3395
+ /**
3396
+ * Model-facing binary results (base64 inline or size-omitted markers) sent to the LLM for this tool call
3397
+ *
3398
+ * @experimental
3399
+ */
3400
+ binaryResultsForLlm?: PersistedBinaryResult[];
3249
3401
  /**
3250
3402
  * Concise tool result text sent to the LLM for chat completion, potentially truncated for token efficiency
3251
3403
  */
@@ -3258,8 +3410,93 @@ export interface ToolExecutionCompleteResult {
3258
3410
  * Full detailed tool result for UI/timeline display, preserving complete content such as diffs. Falls back to content when absent.
3259
3411
  */
3260
3412
  detailedContent?: string;
3413
+ /**
3414
+ * Structured content (arbitrary JSON) returned verbatim by the MCP tool
3415
+ */
3416
+ structuredContent?: {
3417
+ [k: string]: unknown | undefined;
3418
+ };
3261
3419
  uiResource?: ToolExecutionCompleteUIResource;
3262
3420
  }
3421
+ /**
3422
+ * Binary result returned by a tool for the model
3423
+ */
3424
+ export interface PersistedBinaryImage {
3425
+ /**
3426
+ * Base64-encoded binary data
3427
+ */
3428
+ data: string;
3429
+ /**
3430
+ * Human-readable description of the binary data
3431
+ */
3432
+ description?: string;
3433
+ /**
3434
+ * Optional metadata from the producing tool.
3435
+ */
3436
+ metadata?: {
3437
+ [k: string]: unknown | undefined;
3438
+ };
3439
+ /**
3440
+ * MIME type of the binary data
3441
+ */
3442
+ mimeType: string;
3443
+ type: PersistedBinaryImageType;
3444
+ }
3445
+ /**
3446
+ * A binary result whose data was omitted from persistence due to the inline size limit
3447
+ */
3448
+ /** @experimental */
3449
+ export interface OmittedBinaryResult {
3450
+ /**
3451
+ * Decoded byte length of the omitted binary data
3452
+ */
3453
+ byteLength: number;
3454
+ /**
3455
+ * Human-readable description of the binary data
3456
+ */
3457
+ description?: string;
3458
+ /**
3459
+ * Optional metadata from the producing tool.
3460
+ */
3461
+ metadata?: {
3462
+ [k: string]: unknown | undefined;
3463
+ };
3464
+ /**
3465
+ * MIME type of the omitted binary data
3466
+ */
3467
+ mimeType: string;
3468
+ omittedReason: OmittedBinaryOmittedReason;
3469
+ type: OmittedBinaryType;
3470
+ }
3471
+ /**
3472
+ * A reference to binary data persisted once on a session.binary_asset event and shared by id
3473
+ */
3474
+ /** @experimental */
3475
+ export interface BinaryAssetReference {
3476
+ /**
3477
+ * Content-addressed id of the session.binary_asset event that holds this binary's bytes (e.g. "sha256:...").
3478
+ */
3479
+ assetId: string;
3480
+ /**
3481
+ * Decoded byte length of the referenced binary data
3482
+ */
3483
+ byteLength: number;
3484
+ /**
3485
+ * Human-readable description of the binary data
3486
+ */
3487
+ description?: string;
3488
+ /**
3489
+ * Optional metadata from the producing tool.
3490
+ */
3491
+ metadata?: {
3492
+ [k: string]: unknown | undefined;
3493
+ };
3494
+ /**
3495
+ * MIME type of the referenced binary data
3496
+ */
3497
+ mimeType: string;
3498
+ type: BinaryAssetReferenceType;
3499
+ }
3263
3500
  /**
3264
3501
  * Plain text content block
3265
3502
  */
@@ -3602,7 +3839,7 @@ export interface SkillInvokedData {
3602
3839
  */
3603
3840
  pluginVersion?: string;
3604
3841
  /**
3605
- * Source identifier for where the skill was discovered. Known values include: project (workspace skill), inherited (parent-directory skill), personal-copilot (~/.copilot/skills), personal-agents (~/.agents/skills), personal-claude (~/.claude/skills), custom (configured directory), plugin (installed plugin), builtin (bundled runtime skill), and remote (org/enterprise skill)
3842
+ * Source identifier for where the skill was discovered. Known values include: project (workspace skill), inherited (parent-directory skill), personal-copilot (~/.copilot/skills), personal-agents (~/.agents/skills), custom (configured directory), plugin (installed plugin), builtin (bundled runtime skill), and remote (org/enterprise skill)
3606
3843
  */
3607
3844
  source?: string;
3608
3845
  trigger?: SkillInvokedTrigger;
@@ -4037,6 +4274,69 @@ export interface HookProgressData {
4037
4274
  */
4038
4275
  temporary?: boolean;
4039
4276
  }
4277
+ /**
4278
+ * Session event "session.binary_asset". Canonical bytes for a content-addressed binary asset shared by reference across events
4279
+ */
4280
+ /** @experimental */
4281
+ export interface BinaryAssetEvent {
4282
+ /**
4283
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4284
+ */
4285
+ agentId?: string;
4286
+ data: BinaryAssetData;
4287
+ /**
4288
+ * When true, the event is transient and not persisted to the session event log on disk
4289
+ */
4290
+ ephemeral?: boolean;
4291
+ /**
4292
+ * Unique event identifier (UUID v4), generated when the event is emitted
4293
+ */
4294
+ id: string;
4295
+ /**
4296
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
4297
+ */
4298
+ parentId: string | null;
4299
+ /**
4300
+ * ISO 8601 timestamp when the event was created
4301
+ */
4302
+ timestamp: string;
4303
+ /**
4304
+ * Type discriminator. Always "session.binary_asset".
4305
+ */
4306
+ type: "session.binary_asset";
4307
+ }
4308
+ /**
4309
+ * Canonical bytes for a content-addressed binary asset shared by reference across events
4310
+ */
4311
+ export interface BinaryAssetData {
4312
+ /**
4313
+ * Content-addressed id for this binary asset (e.g. "sha256:...").
4314
+ */
4315
+ assetId: string;
4316
+ /**
4317
+ * Decoded byte length of the binary asset
4318
+ */
4319
+ byteLength: number;
4320
+ /**
4321
+ * Base64-encoded binary data
4322
+ */
4323
+ data: string;
4324
+ /**
4325
+ * Human-readable description of the binary data
4326
+ */
4327
+ description?: string;
4328
+ /**
4329
+ * Optional metadata from the producing tool.
4330
+ */
4331
+ metadata?: {
4332
+ [k: string]: unknown | undefined;
4333
+ };
4334
+ /**
4335
+ * MIME type of the binary asset
4336
+ */
4337
+ mimeType: string;
4338
+ type: BinaryAssetType;
4339
+ }
4040
4340
  /**
4041
4341
  * Session event "system.message". System/developer instruction content with role and optional template metadata
4042
4342
  */
@@ -6554,7 +6854,7 @@ export interface ExtensionsLoadedData {
6554
6854
  */
6555
6855
  export interface ExtensionsLoadedExtension {
6556
6856
  /**
6557
- * Source-qualified extension ID (e.g., 'project:my-ext', 'user:auth-helper')
6857
+ * Source-qualified extension ID (e.g., 'project:my-ext', 'user:auth-helper', 'plugin:my-plugin:my-ext')
6558
6858
  */
6559
6859
  id: string;
6560
6860
  /**
package/dist/index.d.ts CHANGED
@@ -10,4 +10,4 @@ export { CopilotSession, type AssistantMessageEvent } from "./session.js";
10
10
  export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasHostContextCapabilities, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js";
11
11
  export { defineTool, approveAll, convertMcpCallToolResult, createSessionFsAdapter, SYSTEM_MESSAGE_SECTIONS, } from "./types.js";
12
12
  export type * from "./generated/session-events.js";
13
- export type { CommandContext, CommandDefinition, CommandHandler, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientMode, CopilotClientOptions, StdioRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, LargeToolOutputConfig, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, MessageOptions, ModelBilling, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolTelemetry, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
13
+ export type { CommandContext, CommandDefinition, CommandHandler, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientMode, CopilotClientOptions, StdioRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, MessageOptions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolTelemetry, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
package/dist/session.js CHANGED
@@ -33,6 +33,9 @@ class CopilotSession {
33
33
  this._workspacePath = _workspacePath;
34
34
  this.traceContextProvider = traceContextProvider;
35
35
  }
36
+ sessionId;
37
+ connection;
38
+ _workspacePath;
36
39
  eventHandlers = /* @__PURE__ */ new Set();
37
40
  typedEventHandlers = /* @__PURE__ */ new Map();
38
41
  toolHandlers = /* @__PURE__ */ new Map();
package/dist/types.d.ts CHANGED
@@ -5,10 +5,10 @@ import type { Canvas } from "./canvas.js";
5
5
  import type { SessionFsProvider } from "./sessionFsProvider.js";
6
6
  import type { ReasoningSummary, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
7
7
  import type { CopilotSession } from "./session.js";
8
- import type { RemoteSessionMode } from "./generated/rpc.js";
9
- import type { OpenCanvasInstance } from "./generated/rpc.js";
8
+ import type { ModelBillingTokenPrices, OpenCanvasInstance, RemoteSessionMode } from "./generated/rpc.js";
10
9
  import type { ToolSet } from "./toolSet.js";
11
10
  export type { RemoteSessionMode } from "./generated/rpc.js";
11
+ export type { ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, } from "./generated/rpc.js";
12
12
  export type SessionEvent = GeneratedSessionEvent;
13
13
  export type { ReasoningSummary } from "./generated/session-events.js";
14
14
  export type { SessionFsProvider } from "./sessionFsProvider.js";
@@ -43,6 +43,8 @@ export type TraceContextProvider = () => TraceContext | Promise<TraceContext>;
43
43
  export interface TelemetryConfig {
44
44
  /** OTLP HTTP endpoint URL for trace/metric export. Sets OTEL_EXPORTER_OTLP_ENDPOINT. */
45
45
  otlpEndpoint?: string;
46
+ /** OTLP HTTP protocol for all signals. Sets OTEL_EXPORTER_OTLP_PROTOCOL. */
47
+ otlpProtocol?: "http/json" | "http/protobuf";
46
48
  /** File path for JSON-lines trace output. Sets COPILOT_OTEL_FILE_EXPORTER_PATH. */
47
49
  filePath?: string;
48
50
  /** Exporter backend type: "otlp-http" or "file". Sets COPILOT_OTEL_EXPORTER_TYPE. */
@@ -370,6 +372,13 @@ export interface Tool<TArgs = unknown> {
370
372
  * When true, the tool can execute without a permission prompt.
371
373
  */
372
374
  skipPermission?: boolean;
375
+ /**
376
+ * Controls whether the tool may be deferred (loaded lazily via tool search)
377
+ * rather than always pre-loaded. When `"auto"`, the tool can be deferred and
378
+ * surfaced through tool search. When `"never"`, the tool is always pre-loaded.
379
+ * Optional; defaults to `"auto"`.
380
+ */
381
+ defer?: "auto" | "never";
373
382
  }
374
383
  /**
375
384
  * Helper to define a tool with Zod schema and get type inference for the handler.
@@ -381,6 +390,7 @@ export declare function defineTool<T = unknown>(name: string, config: {
381
390
  handler?: ToolHandler<T>;
382
391
  overridesBuiltInTool?: boolean;
383
392
  skipPermission?: boolean;
393
+ defer?: "auto" | "never";
384
394
  }): Tool<T>;
385
395
  /**
386
396
  * Context passed to a command handler when a command is executed.
@@ -1199,6 +1209,16 @@ export interface InfiniteSessionConfig {
1199
1209
  */
1200
1210
  bufferExhaustionThreshold?: number;
1201
1211
  }
1212
+ /**
1213
+ * Configuration for the memory feature, which lets the agent persist and recall
1214
+ * information across turns.
1215
+ */
1216
+ export interface MemoryConfiguration {
1217
+ /**
1218
+ * Whether the memory feature is enabled for this session.
1219
+ */
1220
+ enabled: boolean;
1221
+ }
1202
1222
  /**
1203
1223
  * Configuration for handling large tool outputs.
1204
1224
  *
@@ -1566,6 +1586,10 @@ export interface SessionConfigBase {
1566
1586
  * Set to `{ enabled: false }` to disable.
1567
1587
  */
1568
1588
  infiniteSessions?: InfiniteSessionConfig;
1589
+ /**
1590
+ * Memory configuration for the session. When omitted, the runtime default applies.
1591
+ */
1592
+ memory?: MemoryConfiguration;
1569
1593
  /**
1570
1594
  * GitHub token for per-session authentication.
1571
1595
  * When provided, the runtime resolves this token into a full GitHub identity
@@ -1964,7 +1988,10 @@ export interface ModelPolicy {
1964
1988
  * Model billing information
1965
1989
  */
1966
1990
  export interface ModelBilling {
1991
+ /** Billing cost multiplier relative to the base rate */
1967
1992
  multiplier?: number;
1993
+ /** Token-level pricing information for this model */
1994
+ tokenPrices?: ModelBillingTokenPrices;
1968
1995
  }
1969
1996
  /**
1970
1997
  * Information about an available model