@github/copilot-sdk 1.0.2 → 1.0.4

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 | 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;
8
+ export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | ScheduleRearmedEvent | 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 | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
9
9
  /**
10
10
  * Hosting platform type of the repository (github or ado)
11
11
  */
@@ -114,6 +114,14 @@ export type UserMessageAgentMode =
114
114
  * A user message attachment — a file, directory, code selection, blob, GitHub reference, or extension-supplied context payload
115
115
  */
116
116
  export type Attachment = AttachmentFile | AttachmentDirectory | AttachmentSelection | AttachmentGitHubReference | AttachmentBlob | AttachmentExtensionContext;
117
+ /**
118
+ * Why the binary data is absent: it exceeded the inline size limit, or its asset was unavailable
119
+ */
120
+ export type OmittedBinaryOmittedReason =
121
+ /** Bytes exceeded the session's inline size limit. */
122
+ "too_large"
123
+ /** The referenced binary asset could not be found (e.g. a truncated log). */
124
+ | "asset_unavailable";
117
125
  /**
118
126
  * Type of GitHub reference
119
127
  */
@@ -124,6 +132,22 @@ export type AttachmentGitHubReferenceType =
124
132
  | "pr"
125
133
  /** GitHub discussion reference. */
126
134
  | "discussion";
135
+ /**
136
+ * The system that produced a citation.
137
+ */
138
+ /** @experimental */
139
+ export type CitationProvider =
140
+ /** Citation produced by an Anthropic (Claude) model response. */
141
+ "anthropic"
142
+ /** Citation produced by an OpenAI model response. */
143
+ | "openai"
144
+ /** Citation synthesized client-side by the runtime from tool output. */
145
+ | "client";
146
+ /**
147
+ * Location within a cited source (character, page, or content-block range) that supports a span.
148
+ */
149
+ /** @experimental */
150
+ export type CitationLocation = CitationLocationChar | CitationLocationPage | CitationLocationBlock;
127
151
  /**
128
152
  * Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
129
153
  */
@@ -144,6 +168,14 @@ export type AssistantUsageApiEndpoint =
144
168
  | "/responses"
145
169
  /** WebSocket Responses API endpoint. */
146
170
  | "ws:/responses";
171
+ /**
172
+ * For HTTP 400 failures only: whether the response carried a structured CAPI error envelope (structured_error, a deterministic validation failure) or no error body (bodyless, the transient gateway/proxy signature). Absent for non-400 failures.
173
+ */
174
+ export type ModelCallFailureBadRequestKind =
175
+ /** The 400 response carried no error body (transient gateway/proxy signature). */
176
+ "bodyless"
177
+ /** The 400 response carried a structured CAPI error envelope (deterministic validation failure). */
178
+ | "structured_error";
147
179
  /**
148
180
  * Where the failed model call originated
149
181
  */
@@ -185,14 +217,6 @@ export type PersistedBinaryImageType =
185
217
  "image"
186
218
  /** Other binary resource data. */
187
219
  | "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
220
  /**
197
221
  * Binary result type discriminator. Use "image" for images and "resource" for other binary data.
198
222
  */
@@ -332,15 +356,13 @@ export type ElicitationCompletedAction =
332
356
  /** The user dismissed the request. */
333
357
  | "cancel";
334
358
  /**
335
- * Schema for the `ElicitationCompletedContent` type.
336
- */
337
- export type ElicitationCompletedContent = (string | number | boolean | string[]) | undefined;
338
- /**
339
- * Source-defined JSON payload for the custom notification
359
+ * How the pending MCP OAuth request was completed
340
360
  */
341
- export type CustomNotificationPayload = string | number | boolean | null | unknown[] | {
342
- [k: string]: unknown | undefined;
343
- };
361
+ export type McpOauthCompletionOutcome =
362
+ /** The request completed with a token-backed OAuth provider. */
363
+ "token"
364
+ /** The request completed without an OAuth provider. */
365
+ | "cancelled";
344
366
  /**
345
367
  * The user's auto-mode-switch choice
346
368
  */
@@ -445,14 +467,6 @@ export type ExtensionsLoadedExtensionStatus =
445
467
  | "failed"
446
468
  /** The extension process is starting. */
447
469
  | "starting";
448
- /**
449
- * Runtime-controlled routing state for the instance. "ready" when the provider connection is live; "stale" when the provider has gone away and the instance is awaiting rebinding.
450
- */
451
- export type CanvasOpenedAvailability =
452
- /** Provider connection is live; actions can be invoked. */
453
- "ready"
454
- /** Provider has gone away; the instance is awaiting rebinding. */
455
- | "stale";
456
470
  /**
457
471
  * Session event "session.start". Session initialization metadata including context and configuration
458
472
  */
@@ -895,6 +909,10 @@ export interface ScheduleCreatedData {
895
909
  * Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`)
896
910
  */
897
911
  recurring?: boolean;
912
+ /**
913
+ * True for a self-paced (`dynamic`) schedule: no fixed cadence; the model arms each next run via the `manage_schedule` `wakeup` action. `nextRunAt` is model-controlled rather than auto-computed.
914
+ */
915
+ selfPaced?: boolean;
898
916
  /**
899
917
  * IANA timezone the `cron` expression is evaluated in
900
918
  */
@@ -939,6 +957,49 @@ export interface ScheduleCancelledData {
939
957
  */
940
958
  id: number;
941
959
  }
960
+ /**
961
+ * Session event "session.schedule_rearmed". Self-paced schedule re-armed for its next run
962
+ */
963
+ export interface ScheduleRearmedEvent {
964
+ /**
965
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
966
+ */
967
+ agentId?: string;
968
+ data: ScheduleRearmedData;
969
+ /**
970
+ * When true, the event is transient and not persisted to the session event log on disk
971
+ */
972
+ ephemeral?: boolean;
973
+ /**
974
+ * Unique event identifier (UUID v4), generated when the event is emitted
975
+ */
976
+ id: string;
977
+ /**
978
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
979
+ */
980
+ parentId: string | null;
981
+ /**
982
+ * ISO 8601 timestamp when the event was created
983
+ */
984
+ timestamp: string;
985
+ /**
986
+ * Type discriminator. Always "session.schedule_rearmed".
987
+ */
988
+ type: "session.schedule_rearmed";
989
+ }
990
+ /**
991
+ * Self-paced schedule re-armed for its next run
992
+ */
993
+ export interface ScheduleRearmedData {
994
+ /**
995
+ * Id of the self-paced schedule that was re-armed
996
+ */
997
+ id: number;
998
+ /**
999
+ * Absolute time (epoch milliseconds) the model armed the next run to fire
1000
+ */
1001
+ nextRunAt: number;
1002
+ }
942
1003
  /**
943
1004
  * Session event "session.autopilot_objective_changed". Autopilot objective state file operation details indicating what changed
944
1005
  */
@@ -1920,6 +1981,10 @@ export interface CompactionCompleteData {
1920
1981
  * Copilot service request ID (x-copilot-service-request-id header) for the compaction LLM call
1921
1982
  */
1922
1983
  serviceRequestId?: string;
1984
+ /**
1985
+ * For failed compaction only: the HTTP status code of the compaction LLM call failure, when it carried one. Absent for successful compaction and for failures without an HTTP status (e.g. an empty model response or a transport error).
1986
+ */
1987
+ statusCode?: number;
1923
1988
  /**
1924
1989
  * Whether compaction completed successfully
1925
1990
  */
@@ -2110,15 +2175,32 @@ export interface UserMessageData {
2110
2175
  * File attachment
2111
2176
  */
2112
2177
  export interface AttachmentFile {
2178
+ /**
2179
+ * Internal: content-addressed id of the session.binary_asset event holding this attachment's model-facing bytes (e.g. "sha256:..."). Absent externally.
2180
+ */
2181
+ assetId?: string;
2182
+ /**
2183
+ * Internal: decoded byte length of the attachment's model-facing bytes. Absent externally.
2184
+ */
2185
+ byteLength?: number;
2113
2186
  /**
2114
2187
  * User-facing display name for the attachment
2115
2188
  */
2116
2189
  displayName: string;
2117
2190
  lineRange?: AttachmentFileLineRange;
2191
+ /**
2192
+ * Internal: MIME type of the file's model-facing bytes (post-resize for images). Set when the file's bytes are interned to an asset. Absent externally.
2193
+ */
2194
+ mimeType?: string;
2195
+ omittedReason?: OmittedBinaryOmittedReason;
2118
2196
  /**
2119
2197
  * Absolute file path
2120
2198
  */
2121
2199
  path: string;
2200
+ /**
2201
+ * Frozen rendered line this attachment contributed to the <tagged_files> prompt block (e.g. "* /path (123 lines)"). Captured at send time so resumed history reproduces the exact text the model saw, independent of later filesystem changes. Present only for attachments routed to <tagged_files> (mutually exclusive with assetId, which marks bytes sent natively).
2202
+ */
2203
+ taggedFilesEntry?: string;
2122
2204
  /**
2123
2205
  * Attachment type discriminator
2124
2206
  */
@@ -2149,6 +2231,10 @@ export interface AttachmentDirectory {
2149
2231
  * Absolute directory path
2150
2232
  */
2151
2233
  path: string;
2234
+ /**
2235
+ * Frozen rendered line this attachment contributed to the <tagged_files> prompt block (e.g. "* /path (12 items)"). Captured at send time so resumed history reproduces the exact text the model saw, independent of later filesystem changes.
2236
+ */
2237
+ taggedFilesEntry?: string;
2152
2238
  /**
2153
2239
  * Attachment type discriminator
2154
2240
  */
@@ -2240,9 +2326,17 @@ export interface AttachmentGitHubReference {
2240
2326
  */
2241
2327
  export interface AttachmentBlob {
2242
2328
  /**
2243
- * Base64-encoded content
2329
+ * Internal: content-addressed id of the session.binary_asset event holding this attachment's model-facing bytes (e.g. "sha256:..."). Absent externally.
2244
2330
  */
2245
- data: string;
2331
+ assetId?: string;
2332
+ /**
2333
+ * Internal: decoded byte length of the attachment's model-facing bytes. Absent externally.
2334
+ */
2335
+ byteLength?: number;
2336
+ /**
2337
+ * Base64-encoded content. Present on input and for external consumers; replaced by an internal `assetId` reference in persisted events when interned to a content-addressed asset.
2338
+ */
2339
+ data?: string;
2246
2340
  /**
2247
2341
  * User-facing display name for the attachment
2248
2342
  */
@@ -2251,6 +2345,7 @@ export interface AttachmentBlob {
2251
2345
  * MIME type of the inline data
2252
2346
  */
2253
2347
  mimeType: string;
2348
+ omittedReason?: OmittedBinaryOmittedReason;
2254
2349
  /**
2255
2350
  * Attachment type discriminator
2256
2351
  */
@@ -2571,6 +2666,12 @@ export interface AssistantMessageData {
2571
2666
  * Provider's completion / response identifier; shared across all chunks of a single API call. Used to group multi-chunk assistant utterances.
2572
2667
  */
2573
2668
  apiCallId?: string;
2669
+ /**
2670
+ * Provider-agnostic citations linking spans of this message's content to the sources that support them. Experimental; only populated when citation emission is enabled.
2671
+ *
2672
+ * @experimental
2673
+ */
2674
+ citations?: Citations;
2574
2675
  /**
2575
2676
  * The assistant's text response content
2576
2677
  */
@@ -2630,6 +2731,136 @@ export interface AssistantMessageData {
2630
2731
  */
2631
2732
  turnId?: string;
2632
2733
  }
2734
+ /**
2735
+ * Provider-agnostic citations linking spans of the assistant's response to their supporting sources.
2736
+ */
2737
+ /** @experimental */
2738
+ export interface Citations {
2739
+ /**
2740
+ * Deduplicated set of sources referenced by the citation spans.
2741
+ */
2742
+ sources: CitationSource[];
2743
+ /**
2744
+ * Spans of generated text annotated with the sources that support them.
2745
+ */
2746
+ spans: CitationSpan[];
2747
+ }
2748
+ /**
2749
+ * A source that backs one or more cited spans in the assistant's response.
2750
+ */
2751
+ /** @experimental */
2752
+ export interface CitationSource {
2753
+ /**
2754
+ * Stable, turn-scoped identifier for this source, referenced by CitationReference.sourceId.
2755
+ */
2756
+ id: string;
2757
+ /**
2758
+ * File path relative to the agent's workspace root, when the source is a file.
2759
+ */
2760
+ path?: string;
2761
+ provider: CitationProvider;
2762
+ /**
2763
+ * Human-readable title of the source.
2764
+ */
2765
+ title?: string;
2766
+ /**
2767
+ * URL of the source, when it is a web resource.
2768
+ */
2769
+ url?: string;
2770
+ }
2771
+ /**
2772
+ * A contiguous span of generated assistant text and the source references that support it.
2773
+ */
2774
+ /** @experimental */
2775
+ export interface CitationSpan {
2776
+ /**
2777
+ * End offset of the cited span within the final assistant message content (UTF-16 code units, zero-based, exclusive).
2778
+ */
2779
+ endIndex: number;
2780
+ /**
2781
+ * The sources that support this span of generated text.
2782
+ */
2783
+ references: CitationReference[];
2784
+ /**
2785
+ * Start offset of the cited span within the final assistant message content (UTF-16 code units, zero-based, inclusive).
2786
+ */
2787
+ startIndex: number;
2788
+ }
2789
+ /**
2790
+ * A single citation occurrence linking a span of generated text to a supporting source.
2791
+ */
2792
+ /** @experimental */
2793
+ export interface CitationReference {
2794
+ /**
2795
+ * The exact text from the source that supports the cited span, when provided by the model.
2796
+ */
2797
+ citedText?: string;
2798
+ location?: CitationLocation;
2799
+ /**
2800
+ * Provider-native citation correlation data (e.g. Anthropic search_result_index / document_index), passed through opaquely for debugging and forward compatibility.
2801
+ */
2802
+ providerMetadata?: {
2803
+ [k: string]: unknown | undefined;
2804
+ };
2805
+ /**
2806
+ * Identifier of the CitationSource this reference points to (CitationSource.id).
2807
+ */
2808
+ sourceId: string;
2809
+ }
2810
+ /**
2811
+ * A character range within the source's text content.
2812
+ */
2813
+ /** @experimental */
2814
+ export interface CitationLocationChar {
2815
+ /**
2816
+ * End character offset within the source text (zero-based, exclusive).
2817
+ */
2818
+ endIndex: number;
2819
+ /**
2820
+ * Start character offset within the source text (zero-based, inclusive).
2821
+ */
2822
+ startIndex: number;
2823
+ /**
2824
+ * Citation location type discriminator
2825
+ */
2826
+ type: "char";
2827
+ }
2828
+ /**
2829
+ * A page range within a paginated source document.
2830
+ */
2831
+ /** @experimental */
2832
+ export interface CitationLocationPage {
2833
+ /**
2834
+ * Last page number of the cited range (inclusive).
2835
+ */
2836
+ endPage: number;
2837
+ /**
2838
+ * First page number of the cited range.
2839
+ */
2840
+ startPage: number;
2841
+ /**
2842
+ * Citation location type discriminator
2843
+ */
2844
+ type: "page";
2845
+ }
2846
+ /**
2847
+ * A content-block range within a structured source document.
2848
+ */
2849
+ /** @experimental */
2850
+ export interface CitationLocationBlock {
2851
+ /**
2852
+ * Index of the last content block of the cited range (zero-based, exclusive).
2853
+ */
2854
+ endBlock: number;
2855
+ /**
2856
+ * Index of the first content block of the cited range (zero-based, inclusive).
2857
+ */
2858
+ startBlock: number;
2859
+ /**
2860
+ * Citation location type discriminator
2861
+ */
2862
+ type: "block";
2863
+ }
2633
2864
  /**
2634
2865
  * Neutral provider-tagged server-side tool-use payload (tool search, advisor) for verbatim round-tripping
2635
2866
  */
@@ -2989,14 +3220,23 @@ export interface ModelCallFailureData {
2989
3220
  * Completion ID from the model provider (e.g., chatcmpl-abc123)
2990
3221
  */
2991
3222
  apiCallId?: string;
3223
+ badRequestKind?: ModelCallFailureBadRequestKind;
2992
3224
  /**
2993
3225
  * Duration of the failed API call in milliseconds
2994
3226
  */
2995
3227
  durationMs?: number;
3228
+ /**
3229
+ * For HTTP 400 failures only: the `code` from the CAPI error envelope (e.g. 'model_max_prompt_tokens_exceeded') identifying which deterministic validation failure occurred. Raw server-controlled string, emitted only through restricted telemetry. Absent for bodyless or non-400 failures.
3230
+ */
3231
+ errorCode?: string;
2996
3232
  /**
2997
3233
  * Raw provider/runtime error message for restricted telemetry
2998
3234
  */
2999
3235
  errorMessage?: string;
3236
+ /**
3237
+ * For HTTP 400 failures only: the `type` from the CAPI error envelope (e.g. 'websocket_error'), a coarser companion to errorCode for envelopes that carry no code. Raw server-controlled string, emitted only through restricted telemetry. Absent for bodyless or non-400 failures.
3238
+ */
3239
+ errorType?: string;
3000
3240
  /**
3001
3241
  * What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
3002
3242
  */
@@ -3009,6 +3249,7 @@ export interface ModelCallFailureData {
3009
3249
  * GitHub request tracing ID (x-github-request-id header) for server-side log correlation
3010
3250
  */
3011
3251
  providerCallId?: string;
3252
+ requestFingerprint?: ModelCallFailureRequestFingerprint;
3012
3253
  /**
3013
3254
  * Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
3014
3255
  */
@@ -3019,6 +3260,39 @@ export interface ModelCallFailureData {
3019
3260
  */
3020
3261
  statusCode?: number;
3021
3262
  }
3263
+ /**
3264
+ * Content-free structural summary of the failing request for diagnosing malformed 4xx calls
3265
+ */
3266
+ export interface ModelCallFailureRequestFingerprint {
3267
+ /**
3268
+ * Total number of image content parts
3269
+ */
3270
+ imagePartCount: number;
3271
+ /**
3272
+ * Image parts whose media type cannot be determined (rejected by strict providers)
3273
+ */
3274
+ imagePartsMissingMediaType: number;
3275
+ /**
3276
+ * Role of the final message in the request
3277
+ */
3278
+ lastMessageRole?: string;
3279
+ /**
3280
+ * Total number of messages in the request
3281
+ */
3282
+ messageCount: number;
3283
+ /**
3284
+ * Tool calls whose name is missing or empty (rejected by strict providers)
3285
+ */
3286
+ namelessToolCallCount: number;
3287
+ /**
3288
+ * Total number of tool calls across assistant messages
3289
+ */
3290
+ toolCallCount: number;
3291
+ /**
3292
+ * Number of "tool" result messages in the request
3293
+ */
3294
+ toolResultMessageCount: number;
3295
+ }
3022
3296
  /**
3023
3297
  * Session event "abort". Turn abort information including the reason for termination
3024
3298
  */
@@ -3398,6 +3672,12 @@ export interface ToolExecutionCompleteResult {
3398
3672
  * @experimental
3399
3673
  */
3400
3674
  binaryResultsForLlm?: PersistedBinaryResult[];
3675
+ /**
3676
+ * Provider-neutral source material this tool makes available to the model as citable content. Persisted so it survives session resume. Experimental.
3677
+ *
3678
+ * @experimental
3679
+ */
3680
+ citableSources?: CitableSource[];
3401
3681
  /**
3402
3682
  * Concise tool result text sent to the LLM for chat completion, potentially truncated for token efficiency
3403
3683
  */
@@ -3497,6 +3777,32 @@ export interface BinaryAssetReference {
3497
3777
  mimeType: string;
3498
3778
  type: BinaryAssetReferenceType;
3499
3779
  }
3780
+ /**
3781
+ * A source supplied by a tool that should be made available to the model as citable content.
3782
+ */
3783
+ /** @experimental */
3784
+ export interface CitableSource {
3785
+ /**
3786
+ * The source text made available to the model as citable content.
3787
+ */
3788
+ content: string;
3789
+ /**
3790
+ * Stable identifier for this source within the tool result. Used for deduplication and may be used by future provider integrations to correlate response citations back to the originating source.
3791
+ */
3792
+ id: string;
3793
+ /**
3794
+ * File path relative to the agent's workspace root, when the source is a file.
3795
+ */
3796
+ path?: string;
3797
+ /**
3798
+ * Human-readable title of the source.
3799
+ */
3800
+ title?: string;
3801
+ /**
3802
+ * URL of the source, when it is a web resource.
3803
+ */
3804
+ url?: string;
3805
+ }
3500
3806
  /**
3501
3807
  * Plain text content block
3502
3808
  */
@@ -3723,25 +4029,21 @@ export interface ToolExecutionCompleteUIResourceMetaUIPermissions {
3723
4029
  * Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsCamera` type.
3724
4030
  */
3725
4031
  export interface ToolExecutionCompleteUIResourceMetaUIPermissionsCamera {
3726
- [k: string]: unknown | undefined;
3727
4032
  }
3728
4033
  /**
3729
4034
  * Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite` type.
3730
4035
  */
3731
4036
  export interface ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite {
3732
- [k: string]: unknown | undefined;
3733
4037
  }
3734
4038
  /**
3735
4039
  * Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation` type.
3736
4040
  */
3737
4041
  export interface ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation {
3738
- [k: string]: unknown | undefined;
3739
4042
  }
3740
4043
  /**
3741
4044
  * Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone` type.
3742
4045
  */
3743
4046
  export interface ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone {
3744
- [k: string]: unknown | undefined;
3745
4047
  }
3746
4048
  /**
3747
4049
  * Tool definition metadata, present for MCP tools with MCP Apps support
@@ -4653,6 +4955,14 @@ export interface PermissionRequestShell {
4653
4955
  * URLs that may be accessed by the command
4654
4956
  */
4655
4957
  possibleUrls: PermissionRequestShellPossibleUrl[];
4958
+ /**
4959
+ * True when the model has requested to run this command outside the sandbox (it set requestSandboxBypass: true and the host opted in via sandbox.allowBypass). This is a request, not a grant: the command runs unsandboxed only if the user approves this permission request. Hosts should highlight the elevated risk in the approval UI.
4960
+ */
4961
+ requestSandboxBypass?: boolean;
4962
+ /**
4963
+ * Model-provided justification for the sandbox-bypass request. Only meaningful when requestSandboxBypass is true.
4964
+ */
4965
+ requestSandboxBypassReason?: string;
4656
4966
  /**
4657
4967
  * Tool call ID that triggered this permission request
4658
4968
  */
@@ -5012,7 +5322,12 @@ export interface PermissionPromptRequestRead {
5012
5322
  * MCP tool invocation permission prompt
5013
5323
  */
5014
5324
  export interface PermissionPromptRequestMcp {
5015
- args?: unknown;
5325
+ /**
5326
+ * Arguments to pass to the MCP tool
5327
+ */
5328
+ args?: {
5329
+ [k: string]: unknown | undefined;
5330
+ };
5016
5331
  /**
5017
5332
  * Prompt kind discriminator
5018
5333
  */
@@ -5630,7 +5945,6 @@ export interface ElicitationRequestedData {
5630
5945
  * URL to open in the user's browser (url mode only)
5631
5946
  */
5632
5947
  url?: string;
5633
- [k: string]: unknown | undefined;
5634
5948
  }
5635
5949
  /**
5636
5950
  * JSON Schema describing the form fields to present to the user (form mode only)
@@ -5697,6 +6011,12 @@ export interface ElicitationCompletedData {
5697
6011
  */
5698
6012
  requestId: string;
5699
6013
  }
6014
+ /**
6015
+ * Schema for the `ElicitationCompletedContent` type.
6016
+ */
6017
+ export interface ElicitationCompletedContent {
6018
+ [k: string]: unknown | undefined;
6019
+ }
5700
6020
  /**
5701
6021
  * Session event "sampling.requested". Sampling request from an MCP server; contains the server name and a requestId for correlation
5702
6022
  */
@@ -5734,7 +6054,9 @@ export interface SamplingRequestedData {
5734
6054
  /**
5735
6055
  * The JSON-RPC request ID from the MCP protocol
5736
6056
  */
5737
- mcpRequestId: string | number;
6057
+ mcpRequestId: {
6058
+ [k: string]: unknown | undefined;
6059
+ };
5738
6060
  /**
5739
6061
  * Unique identifier for this sampling request; used to respond via session.respondToSampling()
5740
6062
  */
@@ -5743,7 +6065,6 @@ export interface SamplingRequestedData {
5743
6065
  * Name of the MCP server that initiated the sampling request
5744
6066
  */
5745
6067
  serverName: string;
5746
- [k: string]: unknown | undefined;
5747
6068
  }
5748
6069
  /**
5749
6070
  * Session event "sampling.completed". Sampling request completion notification signaling UI dismissal
@@ -5819,9 +6140,13 @@ export interface McpOauthRequiredEvent {
5819
6140
  */
5820
6141
  export interface McpOauthRequiredData {
5821
6142
  /**
5822
- * Unique identifier for this OAuth request; used to respond via session.respondToMcpOAuth()
6143
+ * Unique identifier for this OAuth request; used to respond via session.mcp.oauth.handlePendingRequest
5823
6144
  */
5824
6145
  requestId: string;
6146
+ /**
6147
+ * Raw OAuth protected-resource metadata document fetched for the MCP server, if available
6148
+ */
6149
+ resourceMetadata?: string;
5825
6150
  /**
5826
6151
  * Display name of the MCP server that requires OAuth
5827
6152
  */
@@ -5831,6 +6156,7 @@ export interface McpOauthRequiredData {
5831
6156
  */
5832
6157
  serverUrl: string;
5833
6158
  staticClientConfig?: McpOauthRequiredStaticClientConfig;
6159
+ wwwAuthenticateParams?: McpOauthWWWAuthenticateParams;
5834
6160
  }
5835
6161
  /**
5836
6162
  * Static OAuth client configuration, if the server specifies one
@@ -5849,6 +6175,23 @@ export interface McpOauthRequiredStaticClientConfig {
5849
6175
  */
5850
6176
  publicClient?: boolean;
5851
6177
  }
6178
+ /**
6179
+ * OAuth WWW-Authenticate parameters parsed from an MCP auth challenge
6180
+ */
6181
+ export interface McpOauthWWWAuthenticateParams {
6182
+ /**
6183
+ * OAuth error from the WWW-Authenticate error parameter, if present
6184
+ */
6185
+ error?: string;
6186
+ /**
6187
+ * Protected resource metadata URL from the WWW-Authenticate resource_metadata parameter
6188
+ */
6189
+ resourceMetadataUrl: string;
6190
+ /**
6191
+ * Requested OAuth scopes from the WWW-Authenticate scope parameter, if present
6192
+ */
6193
+ scope?: string;
6194
+ }
5852
6195
  /**
5853
6196
  * Session event "mcp.oauth_completed". MCP OAuth request completion notification
5854
6197
  */
@@ -5883,6 +6226,7 @@ export interface McpOauthCompletedEvent {
5883
6226
  * MCP OAuth request completion notification
5884
6227
  */
5885
6228
  export interface McpOauthCompletedData {
6229
+ outcome: McpOauthCompletionOutcome;
5886
6230
  /**
5887
6231
  * Request ID of the resolved OAuth request
5888
6232
  */
@@ -5937,6 +6281,12 @@ export interface CustomNotificationData {
5937
6281
  */
5938
6282
  version?: number;
5939
6283
  }
6284
+ /**
6285
+ * Source-defined JSON payload for the custom notification
6286
+ */
6287
+ export interface CustomNotificationPayload {
6288
+ [k: string]: unknown | undefined;
6289
+ }
5940
6290
  /**
5941
6291
  * Optional source-defined string identifiers describing the payload subject
5942
6292
  */
@@ -6597,6 +6947,10 @@ export interface SkillsLoadedData {
6597
6947
  * Schema for the `SkillsLoadedSkill` type.
6598
6948
  */
6599
6949
  export interface SkillsLoadedSkill {
6950
+ /**
6951
+ * Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field
6952
+ */
6953
+ argumentHint?: string;
6600
6954
  /**
6601
6955
  * Description of what the skill does
6602
6956
  */
@@ -6867,6 +7221,7 @@ export interface ExtensionsLoadedExtension {
6867
7221
  /**
6868
7222
  * Session event "session.canvas.opened".
6869
7223
  */
7224
+ /** @experimental */
6870
7225
  export interface CanvasOpenedEvent {
6871
7226
  /**
6872
7227
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -6897,8 +7252,8 @@ export interface CanvasOpenedEvent {
6897
7252
  /**
6898
7253
  * Schema for the `CanvasOpenedData` type.
6899
7254
  */
7255
+ /** @experimental */
6900
7256
  export interface CanvasOpenedData {
6901
- availability: CanvasOpenedAvailability;
6902
7257
  /**
6903
7258
  * Provider-local canvas identifier
6904
7259
  */
@@ -6921,10 +7276,6 @@ export interface CanvasOpenedData {
6921
7276
  * Stable caller-supplied canvas instance identifier
6922
7277
  */
6923
7278
  instanceId: string;
6924
- /**
6925
- * Whether this notification represents an idempotent reopen
6926
- */
6927
- reopen: boolean;
6928
7279
  /**
6929
7280
  * Provider-supplied status text
6930
7281
  */
@@ -6941,6 +7292,7 @@ export interface CanvasOpenedData {
6941
7292
  /**
6942
7293
  * Session event "session.canvas.registry_changed".
6943
7294
  */
7295
+ /** @experimental */
6944
7296
  export interface CanvasRegistryChangedEvent {
6945
7297
  /**
6946
7298
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -6971,6 +7323,7 @@ export interface CanvasRegistryChangedEvent {
6971
7323
  /**
6972
7324
  * Schema for the `CanvasRegistryChangedData` type.
6973
7325
  */
7326
+ /** @experimental */
6974
7327
  export interface CanvasRegistryChangedData {
6975
7328
  /**
6976
7329
  * Canvas declarations currently available
@@ -6980,6 +7333,7 @@ export interface CanvasRegistryChangedData {
6980
7333
  /**
6981
7334
  * Schema for the `CanvasRegistryChangedCanvas` type.
6982
7335
  */
7336
+ /** @experimental */
6983
7337
  export interface CanvasRegistryChangedCanvas {
6984
7338
  /**
6985
7339
  * Actions the agent or host may invoke
@@ -7015,6 +7369,7 @@ export interface CanvasRegistryChangedCanvas {
7015
7369
  /**
7016
7370
  * Schema for the `CanvasRegistryChangedCanvasAction` type.
7017
7371
  */
7372
+ /** @experimental */
7018
7373
  export interface CanvasRegistryChangedCanvasAction {
7019
7374
  /**
7020
7375
  * Action description
@@ -7034,6 +7389,7 @@ export interface CanvasRegistryChangedCanvasAction {
7034
7389
  /**
7035
7390
  * Session event "session.canvas.closed".
7036
7391
  */
7392
+ /** @experimental */
7037
7393
  export interface CanvasClosedEvent {
7038
7394
  /**
7039
7395
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -7064,6 +7420,7 @@ export interface CanvasClosedEvent {
7064
7420
  /**
7065
7421
  * Schema for the `CanvasClosedData` type.
7066
7422
  */
7423
+ /** @experimental */
7067
7424
  export interface CanvasClosedData {
7068
7425
  /**
7069
7426
  * Provider-local canvas identifier
@@ -7078,6 +7435,163 @@ export interface CanvasClosedData {
7078
7435
  */
7079
7436
  instanceId: string;
7080
7437
  }
7438
+ /**
7439
+ * Session event "session.canvas.unavailable". Transient signal that an open canvas instance's provider has dropped (for example the extension is reloading mid-session). The host should keep the panel mounted and surface a reconnecting affordance rather than tearing it down; a subsequent `session.canvas.opened` for the same instanceId clears the affordance once the provider reconnects with a fresh url. Ephemeral and never persisted, so it is never replayed on cold resume.
7440
+ */
7441
+ /** @experimental */
7442
+ export interface CanvasUnavailableEvent {
7443
+ /**
7444
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
7445
+ */
7446
+ agentId?: string;
7447
+ data: CanvasUnavailableData;
7448
+ /**
7449
+ * Always true for events that are transient and not persisted to the session event log on disk.
7450
+ */
7451
+ ephemeral: true;
7452
+ /**
7453
+ * Unique event identifier (UUID v4), generated when the event is emitted
7454
+ */
7455
+ id: string;
7456
+ /**
7457
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
7458
+ */
7459
+ parentId: string | null;
7460
+ /**
7461
+ * ISO 8601 timestamp when the event was created
7462
+ */
7463
+ timestamp: string;
7464
+ /**
7465
+ * Type discriminator. Always "session.canvas.unavailable".
7466
+ */
7467
+ type: "session.canvas.unavailable";
7468
+ }
7469
+ /**
7470
+ * Transient signal that an open canvas instance's provider has dropped (for example the extension is reloading mid-session). The host should keep the panel mounted and surface a reconnecting affordance rather than tearing it down; a subsequent `session.canvas.opened` for the same instanceId clears the affordance once the provider reconnects with a fresh url. Ephemeral and never persisted, so it is never replayed on cold resume.
7471
+ */
7472
+ /** @experimental */
7473
+ export interface CanvasUnavailableData {
7474
+ /**
7475
+ * Provider-local canvas identifier
7476
+ */
7477
+ canvasId: string;
7478
+ /**
7479
+ * Owning provider identifier
7480
+ */
7481
+ extensionId: string;
7482
+ /**
7483
+ * Stable caller-supplied identifier of the canvas instance whose provider became unavailable
7484
+ */
7485
+ instanceId: string;
7486
+ }
7487
+ /**
7488
+ * Session event "session.canvas.recorded". Durable record that a canvas instance is open, used to restore open canvases on cold session resume. Intentionally omits the transient url and availability.
7489
+ */
7490
+ /** @experimental */
7491
+ export interface CanvasRecordedEvent {
7492
+ /**
7493
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
7494
+ */
7495
+ agentId?: string;
7496
+ data: CanvasRecordedData;
7497
+ /**
7498
+ * When true, the event is transient and not persisted to the session event log on disk
7499
+ */
7500
+ ephemeral?: boolean;
7501
+ /**
7502
+ * Unique event identifier (UUID v4), generated when the event is emitted
7503
+ */
7504
+ id: string;
7505
+ /**
7506
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
7507
+ */
7508
+ parentId: string | null;
7509
+ /**
7510
+ * ISO 8601 timestamp when the event was created
7511
+ */
7512
+ timestamp: string;
7513
+ /**
7514
+ * Type discriminator. Always "session.canvas.recorded".
7515
+ */
7516
+ type: "session.canvas.recorded";
7517
+ }
7518
+ /**
7519
+ * Durable record that a canvas instance is open, used to restore open canvases on cold session resume. Intentionally omits the transient url and availability.
7520
+ */
7521
+ /** @experimental */
7522
+ export interface CanvasRecordedData {
7523
+ /**
7524
+ * Provider-local canvas identifier
7525
+ */
7526
+ canvasId: string;
7527
+ /**
7528
+ * Owning provider identifier
7529
+ */
7530
+ extensionId: string;
7531
+ /**
7532
+ * Input supplied when the instance was opened
7533
+ */
7534
+ input?: {
7535
+ [k: string]: unknown | undefined;
7536
+ };
7537
+ /**
7538
+ * Stable caller-supplied canvas instance identifier
7539
+ */
7540
+ instanceId: string;
7541
+ /**
7542
+ * Rendered title
7543
+ */
7544
+ title?: string;
7545
+ }
7546
+ /**
7547
+ * Session event "session.canvas.removed". Durable record that a canvas instance was closed, superseding a prior instance_recorded during resume replay.
7548
+ */
7549
+ /** @experimental */
7550
+ export interface CanvasRemovedEvent {
7551
+ /**
7552
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
7553
+ */
7554
+ agentId?: string;
7555
+ data: CanvasRemovedData;
7556
+ /**
7557
+ * When true, the event is transient and not persisted to the session event log on disk
7558
+ */
7559
+ ephemeral?: boolean;
7560
+ /**
7561
+ * Unique event identifier (UUID v4), generated when the event is emitted
7562
+ */
7563
+ id: string;
7564
+ /**
7565
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
7566
+ */
7567
+ parentId: string | null;
7568
+ /**
7569
+ * ISO 8601 timestamp when the event was created
7570
+ */
7571
+ timestamp: string;
7572
+ /**
7573
+ * Type discriminator. Always "session.canvas.removed".
7574
+ */
7575
+ type: "session.canvas.removed";
7576
+ }
7577
+ /**
7578
+ * Durable record that a canvas instance was closed, superseding a prior instance_recorded during resume replay.
7579
+ */
7580
+ /** @experimental */
7581
+ export interface CanvasRemovedData {
7582
+ /**
7583
+ * Provider-local canvas identifier
7584
+ */
7585
+ canvasId: string;
7586
+ /**
7587
+ * Owning provider identifier
7588
+ */
7589
+ extensionId: string;
7590
+ /**
7591
+ * Stable caller-supplied identifier of the canvas instance that was closed
7592
+ */
7593
+ instanceId: string;
7594
+ }
7081
7595
  /**
7082
7596
  * Session event "session.extensions.attachments_pushed".
7083
7597
  */
@@ -7196,7 +7710,6 @@ export interface McpAppToolCallCompleteError {
7196
7710
  */
7197
7711
  export interface McpAppToolCallCompleteToolMeta {
7198
7712
  ui?: McpAppToolCallCompleteToolMetaUI;
7199
- [k: string]: unknown | undefined;
7200
7713
  }
7201
7714
  /**
7202
7715
  * Schema for the `McpAppToolCallCompleteToolMetaUI` type.
@@ -7210,5 +7723,4 @@ export interface McpAppToolCallCompleteToolMetaUI {
7210
7723
  * Tool visibility per SEP-1865 (typically a subset of `["model","app"]`)
7211
7724
  */
7212
7725
  visibility?: string[];
7213
- [k: string]: unknown | undefined;
7214
7726
  }