@github/copilot-sdk 1.0.0 → 1.0.2-preview.0

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.
@@ -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 | 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
  */
@@ -562,6 +619,10 @@ export interface ResumeData {
562
619
  * Total number of persisted events in the session at the time of resume
563
620
  */
564
621
  eventCount: number;
622
+ /**
623
+ * On-disk byte size of the session's persisted events.jsonl file at resume time; omitted when the file does not exist or cannot be stat'd
624
+ */
625
+ eventsFileSizeBytes?: number;
565
626
  /**
566
627
  * Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
567
628
  */
@@ -695,7 +756,7 @@ export interface ErrorData {
695
756
  url?: string;
696
757
  }
697
758
  /**
698
- * Session event "session.idle". Payload indicating the session is idle with no background agents in flight
759
+ * Session event "session.idle". Payload indicating the session is idle with no background agents or attached shell commands in flight
699
760
  */
700
761
  export interface IdleEvent {
701
762
  /**
@@ -725,7 +786,7 @@ export interface IdleEvent {
725
786
  type: "session.idle";
726
787
  }
727
788
  /**
728
- * Payload indicating the session is idle with no background agents in flight
789
+ * Payload indicating the session is idle with no background agents or attached shell commands in flight
729
790
  */
730
791
  export interface IdleData {
731
792
  /**
@@ -806,6 +867,14 @@ export interface ScheduleCreatedEvent {
806
867
  * Scheduled prompt registered via /every or /after
807
868
  */
808
869
  export interface ScheduleCreatedData {
870
+ /**
871
+ * Absolute fire time (epoch milliseconds) for a one-shot calendar schedule
872
+ */
873
+ at?: number;
874
+ /**
875
+ * 5-field cron expression for a recurring calendar schedule, evaluated in `tz`
876
+ */
877
+ cron?: string;
809
878
  /**
810
879
  * Optional user-facing label shown in the timeline instead of the actual prompt (e.g. `/skill-name args` when the prompt is a skill invocation expansion)
811
880
  */
@@ -815,9 +884,9 @@ export interface ScheduleCreatedData {
815
884
  */
816
885
  id: number;
817
886
  /**
818
- * Interval between ticks in milliseconds
887
+ * Interval between ticks in milliseconds (relative-interval schedules)
819
888
  */
820
- intervalMs: number;
889
+ intervalMs?: number;
821
890
  /**
822
891
  * Prompt text that gets enqueued on every tick
823
892
  */
@@ -826,6 +895,10 @@ export interface ScheduleCreatedData {
826
895
  * Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`)
827
896
  */
828
897
  recurring?: boolean;
898
+ /**
899
+ * IANA timezone the `cron` expression is evaluated in
900
+ */
901
+ tz?: string;
829
902
  }
830
903
  /**
831
904
  * Session event "session.schedule_cancelled". Scheduled prompt cancelled from the schedule manager dialog
@@ -1182,6 +1255,41 @@ export interface PlanChangedEvent {
1182
1255
  export interface PlanChangedData {
1183
1256
  operation: PlanChangedOperation;
1184
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
+ }
1185
1293
  /**
1186
1294
  * Session event "session.workspace_file_changed". Workspace file change details including path and operation type
1187
1295
  */
@@ -1457,6 +1565,10 @@ export interface ShutdownData {
1457
1565
  * Error description when shutdownType is "error"
1458
1566
  */
1459
1567
  errorReason?: string;
1568
+ /**
1569
+ * On-disk byte size of the session's persisted events.jsonl file at shutdown time; omitted when the file does not exist or cannot be stat'd
1570
+ */
1571
+ eventsFileSizeBytes?: number;
1460
1572
  /**
1461
1573
  * Per-model usage breakdown, keyed by model identifier
1462
1574
  */
@@ -2456,17 +2568,9 @@ export interface AssistantMessageEvent {
2456
2568
  */
2457
2569
  export interface AssistantMessageData {
2458
2570
  /**
2459
- * Raw Anthropic content array with advisor blocks (server_tool_use, advisor_tool_result) for verbatim round-tripping
2460
- *
2461
- * @experimental
2462
- */
2463
- anthropicAdvisorBlocks?: unknown[];
2464
- /**
2465
- * Anthropic advisor model ID used for this response, for timeline display on replay
2466
- *
2467
- * @experimental
2571
+ * Provider's completion / response identifier; shared across all chunks of a single API call. Used to group multi-chunk assistant utterances.
2468
2572
  */
2469
- anthropicAdvisorModel?: string;
2573
+ apiCallId?: string;
2470
2574
  /**
2471
2575
  * The assistant's text response content
2472
2576
  */
@@ -2512,6 +2616,7 @@ export interface AssistantMessageData {
2512
2616
  * GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
2513
2617
  */
2514
2618
  requestId?: string;
2619
+ serverTools?: AssistantMessageServerTools;
2515
2620
  /**
2516
2621
  * Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
2517
2622
  */
@@ -2525,6 +2630,19 @@ export interface AssistantMessageData {
2525
2630
  */
2526
2631
  turnId?: string;
2527
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
+ }
2528
2646
  /**
2529
2647
  * A tool invocation request from the assistant
2530
2648
  */
@@ -2738,6 +2856,11 @@ export interface AssistantUsageData {
2738
2856
  * Number of tokens written to prompt cache
2739
2857
  */
2740
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;
2741
2864
  /**
2742
2865
  * Model multiplier cost for billing purposes
2743
2866
  *
@@ -2748,6 +2871,10 @@ export interface AssistantUsageData {
2748
2871
  * Duration of the API call in milliseconds
2749
2872
  */
2750
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;
2751
2878
  /**
2752
2879
  * What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
2753
2880
  */
@@ -2794,6 +2921,15 @@ export interface AssistantUsageData {
2794
2921
  */
2795
2922
  timeToFirstTokenMs?: number;
2796
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
+ }
2797
2933
  /**
2798
2934
  * Token usage detail for a single billing category
2799
2935
  */
@@ -3033,6 +3169,7 @@ export interface ToolExecutionStartData {
3033
3169
  * Unique identifier for this tool call
3034
3170
  */
3035
3171
  toolCallId: string;
3172
+ toolDescription?: ToolExecutionStartToolDescription;
3036
3173
  /**
3037
3174
  * Name of the tool being executed
3038
3175
  */
@@ -3042,6 +3179,39 @@ export interface ToolExecutionStartData {
3042
3179
  */
3043
3180
  turnId?: string;
3044
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
+ }
3045
3215
  /**
3046
3216
  * Session event "tool.execution_partial_result". Streaming tool execution output for incremental result display
3047
3217
  */
@@ -3222,6 +3392,12 @@ export interface ToolExecutionCompleteError {
3222
3392
  * Tool execution result on success
3223
3393
  */
3224
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[];
3225
3401
  /**
3226
3402
  * Concise tool result text sent to the LLM for chat completion, potentially truncated for token efficiency
3227
3403
  */
@@ -3234,8 +3410,93 @@ export interface ToolExecutionCompleteResult {
3234
3410
  * Full detailed tool result for UI/timeline display, preserving complete content such as diffs. Falls back to content when absent.
3235
3411
  */
3236
3412
  detailedContent?: string;
3413
+ /**
3414
+ * Structured content (arbitrary JSON) returned verbatim by the MCP tool
3415
+ */
3416
+ structuredContent?: {
3417
+ [k: string]: unknown | undefined;
3418
+ };
3237
3419
  uiResource?: ToolExecutionCompleteUIResource;
3238
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
+ }
3239
3500
  /**
3240
3501
  * Plain text content block
3241
3502
  */
@@ -3578,7 +3839,7 @@ export interface SkillInvokedData {
3578
3839
  */
3579
3840
  pluginVersion?: string;
3580
3841
  /**
3581
- * 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)
3582
3843
  */
3583
3844
  source?: string;
3584
3845
  trigger?: SkillInvokedTrigger;
@@ -3630,7 +3891,7 @@ export interface SubagentStartedData {
3630
3891
  */
3631
3892
  agentName: string;
3632
3893
  /**
3633
- * Model the sub-agent will run with, when known at start. Surfaced in the timeline for auto-selected sub-agents (e.g. rubber-duck).
3894
+ * Model the sub-agent will run with, when known at start.
3634
3895
  */
3635
3896
  model?: string;
3636
3897
  /**
@@ -3752,7 +4013,7 @@ export interface SubagentFailedData {
3752
4013
  */
3753
4014
  error: string;
3754
4015
  /**
3755
- * Model used by the sub-agent (if any model calls succeeded before failure)
4016
+ * Model selected for the sub-agent, when known
3756
4017
  */
3757
4018
  model?: string;
3758
4019
  /**
@@ -3961,6 +4222,10 @@ export interface HookEndError {
3961
4222
  * Human-readable error message
3962
4223
  */
3963
4224
  message: string;
4225
+ /**
4226
+ * Source label of the hook that errored (e.g. the plugin it was loaded from), when known
4227
+ */
4228
+ source?: string;
3964
4229
  /**
3965
4230
  * Error stack trace, when available
3966
4231
  */
@@ -4004,6 +4269,73 @@ export interface HookProgressData {
4004
4269
  * Human-readable progress message from the hook process
4005
4270
  */
4006
4271
  message: string;
4272
+ /**
4273
+ * When true, this status message replaces the previous temporary one instead of accumulating
4274
+ */
4275
+ temporary?: boolean;
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;
4007
4339
  }
4008
4340
  /**
4009
4341
  * Session event "system.message". System/developer instruction content with role and optional template metadata
@@ -6522,7 +6854,7 @@ export interface ExtensionsLoadedData {
6522
6854
  */
6523
6855
  export interface ExtensionsLoadedExtension {
6524
6856
  /**
6525
- * 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')
6526
6858
  */
6527
6859
  id: string;
6528
6860
  /**
@@ -6699,6 +7031,53 @@ export interface CanvasRegistryChangedCanvasAction {
6699
7031
  */
6700
7032
  name: string;
6701
7033
  }
7034
+ /**
7035
+ * Session event "session.canvas.closed".
7036
+ */
7037
+ export interface CanvasClosedEvent {
7038
+ /**
7039
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
7040
+ */
7041
+ agentId?: string;
7042
+ data: CanvasClosedData;
7043
+ /**
7044
+ * Always true for events that are transient and not persisted to the session event log on disk.
7045
+ */
7046
+ ephemeral: true;
7047
+ /**
7048
+ * Unique event identifier (UUID v4), generated when the event is emitted
7049
+ */
7050
+ id: string;
7051
+ /**
7052
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
7053
+ */
7054
+ parentId: string | null;
7055
+ /**
7056
+ * ISO 8601 timestamp when the event was created
7057
+ */
7058
+ timestamp: string;
7059
+ /**
7060
+ * Type discriminator. Always "session.canvas.closed".
7061
+ */
7062
+ type: "session.canvas.closed";
7063
+ }
7064
+ /**
7065
+ * Schema for the `CanvasClosedData` type.
7066
+ */
7067
+ export interface CanvasClosedData {
7068
+ /**
7069
+ * Provider-local canvas identifier
7070
+ */
7071
+ canvasId: string;
7072
+ /**
7073
+ * Owning provider identifier
7074
+ */
7075
+ extensionId: string;
7076
+ /**
7077
+ * Stable caller-supplied identifier of the canvas instance that was closed
7078
+ */
7079
+ instanceId: string;
7080
+ }
6702
7081
  /**
6703
7082
  * Session event "session.extensions.attachments_pushed".
6704
7083
  */
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.d.ts CHANGED
@@ -170,12 +170,14 @@ export declare class CopilotSession {
170
170
  */
171
171
  on(handler: SessionEventHandler): () => void;
172
172
  private upsertOpenCanvasFromEvent;
173
+ private removeOpenCanvasFromEvent;
174
+ private removeOpenCanvas;
173
175
  private upsertOpenCanvas;
174
176
  /**
175
177
  * Snapshot of canvas instances currently known to be open for this session.
176
178
  * Populated from the `session.resume` response and live `session.canvas.opened`
177
- * events. Returns a defensive copy — mutating the returned array has no effect
178
- * on the session.
179
+ * and `session.canvas.closed` events. Returns a defensive copy — mutating the
180
+ * returned array has no effect on the session.
179
181
  */
180
182
  get openCanvases(): OpenCanvasInstance[];
181
183
  private assertElicitation;