@github/copilot-sdk 0.3.0 → 1.0.0-beta.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.
@@ -2,7 +2,7 @@
2
2
  * AUTO-GENERATED FILE - DO NOT EDIT
3
3
  * Generated from: session-events.schema.json
4
4
  */
5
- export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | PlanChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantUsageEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent;
5
+ export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | 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 | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent;
6
6
  /**
7
7
  * Hosting platform type of the repository (github or ado)
8
8
  */
@@ -39,6 +39,10 @@ export type UserMessageAttachmentGithubReferenceType = "issue" | "pr" | "discuss
39
39
  * Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
40
40
  */
41
41
  export type AssistantMessageToolRequestType = "function" | "custom";
42
+ /**
43
+ * Where the failed model call originated
44
+ */
45
+ export type ModelCallFailureSource = "top_level" | "subagent" | "mcp_sampling";
42
46
  /**
43
47
  * A content block within a tool result, which may be text, terminal output, image, audio, or a resource
44
48
  */
@@ -58,7 +62,7 @@ export type SystemMessageRole = "system" | "developer";
58
62
  /**
59
63
  * Structured metadata identifying what triggered this notification
60
64
  */
61
- export type SystemNotification = SystemNotificationAgentCompleted | SystemNotificationAgentIdle | SystemNotificationNewInboxMessage | SystemNotificationShellCompleted | SystemNotificationShellDetachedCompleted;
65
+ export type SystemNotification = SystemNotificationAgentCompleted | SystemNotificationAgentIdle | SystemNotificationNewInboxMessage | SystemNotificationShellCompleted | SystemNotificationShellDetachedCompleted | SystemNotificationInstructionDiscovered;
62
66
  /**
63
67
  * Whether the agent completed successfully or failed
64
68
  */
@@ -92,9 +96,13 @@ export type PermissionPromptRequestMemoryDirection = "upvote" | "downvote";
92
96
  */
93
97
  export type PermissionPromptRequestPathAccessKind = "read" | "shell" | "write";
94
98
  /**
95
- * The outcome of the permission request
99
+ * The result of the permission request
100
+ */
101
+ export type PermissionResult = PermissionApproved | PermissionApprovedForSession | PermissionApprovedForLocation | PermissionCancelled | PermissionDeniedByRules | PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser | PermissionDeniedInteractivelyByUser | PermissionDeniedByContentExclusionPolicy | PermissionDeniedByPermissionRequestHook;
102
+ /**
103
+ * The approval to add as a session-scoped rule
96
104
  */
97
- export type PermissionCompletedKind = "approved" | "approved-for-session" | "approved-for-location" | "denied-by-rules" | "denied-no-approval-rule-and-could-not-request-from-user" | "denied-interactively-by-user" | "denied-by-content-exclusion-policy" | "denied-by-permission-request-hook";
105
+ export type UserToolSessionApproval = UserToolSessionApprovalCommands | UserToolSessionApprovalRead | UserToolSessionApprovalWrite | UserToolSessionApprovalMcp | UserToolSessionApprovalMemory | UserToolSessionApprovalCustomTool;
98
106
  /**
99
107
  * Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent.
100
108
  */
@@ -253,6 +261,10 @@ export interface ResumeData {
253
261
  */
254
262
  alreadyInUse?: boolean;
255
263
  context?: WorkingDirectoryContext;
264
+ /**
265
+ * When true, tool calls and permission requests left in flight by the previous session lifetime remain pending after resume and the agentic loop awaits their results. User sends are queued behind the pending work until all such requests reach a terminal state. When false (the default), any such tool calls and permission requests are immediately marked as interrupted on resume.
266
+ */
267
+ continuePendingWork?: boolean;
256
268
  /**
257
269
  * Total number of persisted events in the session at the time of resume
258
270
  */
@@ -273,6 +285,10 @@ export interface ResumeData {
273
285
  * Model currently selected at resume time
274
286
  */
275
287
  selectedModel?: string;
288
+ /**
289
+ * True when this resume attached to a session that the runtime already had running in-memory (for example, an extension joining a session another client was actively driving). False (or omitted) for cold resumes — the runtime had to reconstitute the session from its persisted event log.
290
+ */
291
+ sessionWasActive?: boolean;
276
292
  }
277
293
  export interface RemoteSteerableChangedEvent {
278
294
  /**
@@ -335,6 +351,14 @@ export interface ErrorEvent {
335
351
  * Error details for timeline display including message and optional diagnostic information
336
352
  */
337
353
  export interface ErrorData {
354
+ /**
355
+ * Only set on `errorType: "rate_limit"`. When `true`, the runtime will follow this error with an `auto_mode_switch.requested` event (or silently switch if `continueOnAutoMode` is enabled). UI clients can use this flag to suppress duplicate rendering of the rate-limit error when they show their own auto-mode-switch prompt.
356
+ */
357
+ eligibleForAutoSwitch?: boolean;
358
+ /**
359
+ * Fine-grained error code from the upstream provider, when available. For `errorType: "rate_limit"`, this is one of the `RateLimitErrorCode` values (e.g., `"user_weekly_rate_limited"`, `"user_global_rate_limited"`, `"rate_limited"`, `"user_model_rate_limited"`, `"integration_rate_limited"`).
360
+ */
361
+ errorCode?: string;
338
362
  /**
339
363
  * Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query")
340
364
  */
@@ -420,6 +444,80 @@ export interface TitleChangedData {
420
444
  */
421
445
  title: string;
422
446
  }
447
+ export interface ScheduleCreatedEvent {
448
+ /**
449
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
450
+ */
451
+ agentId?: string;
452
+ data: ScheduleCreatedData;
453
+ /**
454
+ * When true, the event is transient and not persisted to the session event log on disk
455
+ */
456
+ ephemeral?: boolean;
457
+ /**
458
+ * Unique event identifier (UUID v4), generated when the event is emitted
459
+ */
460
+ id: string;
461
+ /**
462
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
463
+ */
464
+ parentId: string | null;
465
+ /**
466
+ * ISO 8601 timestamp when the event was created
467
+ */
468
+ timestamp: string;
469
+ type: "session.schedule_created";
470
+ }
471
+ /**
472
+ * Scheduled prompt registered via /every
473
+ */
474
+ export interface ScheduleCreatedData {
475
+ /**
476
+ * Sequential id assigned to the scheduled prompt within the session
477
+ */
478
+ id: number;
479
+ /**
480
+ * Interval between ticks in milliseconds
481
+ */
482
+ intervalMs: number;
483
+ /**
484
+ * Prompt text that gets enqueued on every tick
485
+ */
486
+ prompt: string;
487
+ }
488
+ export interface ScheduleCancelledEvent {
489
+ /**
490
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
491
+ */
492
+ agentId?: string;
493
+ data: ScheduleCancelledData;
494
+ /**
495
+ * When true, the event is transient and not persisted to the session event log on disk
496
+ */
497
+ ephemeral?: boolean;
498
+ /**
499
+ * Unique event identifier (UUID v4), generated when the event is emitted
500
+ */
501
+ id: string;
502
+ /**
503
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
504
+ */
505
+ parentId: string | null;
506
+ /**
507
+ * ISO 8601 timestamp when the event was created
508
+ */
509
+ timestamp: string;
510
+ type: "session.schedule_cancelled";
511
+ }
512
+ /**
513
+ * Scheduled prompt cancelled from the schedule manager dialog
514
+ */
515
+ export interface ScheduleCancelledData {
516
+ /**
517
+ * Id of the scheduled prompt that was cancelled
518
+ */
519
+ id: number;
520
+ }
423
521
  export interface InfoEvent {
424
522
  /**
425
523
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -456,6 +554,10 @@ export interface InfoData {
456
554
  * Human-readable informational message for display in the timeline
457
555
  */
458
556
  message: string;
557
+ /**
558
+ * Optional actionable tip displayed with this message
559
+ */
560
+ tip?: string;
459
561
  /**
460
562
  * Optional URL associated with this message that the user can open in a browser
461
563
  */
@@ -530,6 +632,10 @@ export interface ModelChangeEvent {
530
632
  * Model change details including previous and new model identifiers
531
633
  */
532
634
  export interface ModelChangeData {
635
+ /**
636
+ * Reason the change happened, when not user-initiated. Currently `"rate_limit_auto_switch"` for changes triggered by the auto-mode-switch rate-limit recovery path. UI clients can use this to render contextual copy.
637
+ */
638
+ cause?: string;
533
639
  /**
534
640
  * Newly selected model identifier
535
641
  */
@@ -871,6 +977,12 @@ export interface ShutdownData {
871
977
  * System message token count at shutdown
872
978
  */
873
979
  systemTokens?: number;
980
+ /**
981
+ * Session-wide per-token-type accumulated token counts
982
+ */
983
+ tokenDetails?: {
984
+ [k: string]: ShutdownTokenDetail;
985
+ };
874
986
  /**
875
987
  * Tool definitions token count at shutdown
876
988
  */
@@ -879,6 +991,10 @@ export interface ShutdownData {
879
991
  * Cumulative time spent in API calls during the session, in milliseconds
880
992
  */
881
993
  totalApiDurationMs: number;
994
+ /**
995
+ * Session-wide accumulated nano-AI units cost
996
+ */
997
+ totalNanoAiu?: number;
882
998
  /**
883
999
  * Total number of premium API requests used during the session
884
1000
  */
@@ -903,6 +1019,16 @@ export interface ShutdownCodeChanges {
903
1019
  }
904
1020
  export interface ShutdownModelMetric {
905
1021
  requests: ShutdownModelMetricRequests;
1022
+ /**
1023
+ * Token count details per type
1024
+ */
1025
+ tokenDetails?: {
1026
+ [k: string]: ShutdownModelMetricTokenDetail;
1027
+ };
1028
+ /**
1029
+ * Accumulated nano-AI units cost for this model
1030
+ */
1031
+ totalNanoAiu?: number;
906
1032
  usage: ShutdownModelMetricUsage;
907
1033
  }
908
1034
  /**
@@ -918,6 +1044,12 @@ export interface ShutdownModelMetricRequests {
918
1044
  */
919
1045
  count: number;
920
1046
  }
1047
+ export interface ShutdownModelMetricTokenDetail {
1048
+ /**
1049
+ * Accumulated token count for this token type
1050
+ */
1051
+ tokenCount: number;
1052
+ }
921
1053
  /**
922
1054
  * Token usage breakdown
923
1055
  */
@@ -943,6 +1075,12 @@ export interface ShutdownModelMetricUsage {
943
1075
  */
944
1076
  reasoningTokens?: number;
945
1077
  }
1078
+ export interface ShutdownTokenDetail {
1079
+ /**
1080
+ * Accumulated token count for this token type
1081
+ */
1082
+ tokenCount: number;
1083
+ }
946
1084
  export interface ContextChangedEvent {
947
1085
  /**
948
1086
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -1187,7 +1325,7 @@ export interface CompactionCompleteCompactionTokensUsedCopilotUsage {
1187
1325
  */
1188
1326
  tokenDetails: CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail[];
1189
1327
  /**
1190
- * Total cost in nano-AIU (AI Units) for this request
1328
+ * Total cost in nano-AI units for this request
1191
1329
  */
1192
1330
  totalNanoAiu: number;
1193
1331
  }
@@ -1291,6 +1429,10 @@ export interface UserMessageData {
1291
1429
  * Path-backed native document attachments that stayed on the tagged_files path flow because native upload would exceed the request size limit
1292
1430
  */
1293
1431
  nativeDocumentPathFallbackPaths?: string[];
1432
+ /**
1433
+ * Parent agent task ID for background telemetry correlated to this user turn
1434
+ */
1435
+ parentAgentTaskId?: string;
1294
1436
  /**
1295
1437
  * Origin of this message, used for timeline filtering (e.g., "skill-pdf" for skill-injected messages that should be hidden from the user)
1296
1438
  */
@@ -1721,6 +1863,10 @@ export interface AssistantMessageData {
1721
1863
  * Tool invocations requested by the assistant in this message
1722
1864
  */
1723
1865
  toolRequests?: AssistantMessageToolRequest[];
1866
+ /**
1867
+ * Identifier for the agent loop turn that produced this message, matching the corresponding assistant.turn_start event
1868
+ */
1869
+ turnId?: string;
1724
1870
  }
1725
1871
  /**
1726
1872
  * A tool invocation request from the assistant
@@ -1740,6 +1886,10 @@ export interface AssistantMessageToolRequest {
1740
1886
  * Name of the MCP server hosting this tool, when the tool is an MCP tool
1741
1887
  */
1742
1888
  mcpServerName?: string;
1889
+ /**
1890
+ * Original tool name on the MCP server, when the tool is an MCP tool
1891
+ */
1892
+ mcpToolName?: string;
1743
1893
  /**
1744
1894
  * Name of the tool being invoked
1745
1895
  */
@@ -1754,6 +1904,40 @@ export interface AssistantMessageToolRequest {
1754
1904
  toolTitle?: string;
1755
1905
  type?: AssistantMessageToolRequestType;
1756
1906
  }
1907
+ export interface AssistantMessageStartEvent {
1908
+ /**
1909
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
1910
+ */
1911
+ agentId?: string;
1912
+ data: AssistantMessageStartData;
1913
+ ephemeral: true;
1914
+ /**
1915
+ * Unique event identifier (UUID v4), generated when the event is emitted
1916
+ */
1917
+ id: string;
1918
+ /**
1919
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
1920
+ */
1921
+ parentId: string | null;
1922
+ /**
1923
+ * ISO 8601 timestamp when the event was created
1924
+ */
1925
+ timestamp: string;
1926
+ type: "assistant.message_start";
1927
+ }
1928
+ /**
1929
+ * Streaming assistant message start metadata
1930
+ */
1931
+ export interface AssistantMessageStartData {
1932
+ /**
1933
+ * Message ID this start event belongs to, matching subsequent deltas and assistant.message
1934
+ */
1935
+ messageId: string;
1936
+ /**
1937
+ * Generation phase this message belongs to for phased-output models
1938
+ */
1939
+ phase?: string;
1940
+ }
1757
1941
  export interface AssistantMessageDeltaEvent {
1758
1942
  /**
1759
1943
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -1929,7 +2113,7 @@ export interface AssistantUsageCopilotUsage {
1929
2113
  */
1930
2114
  tokenDetails: AssistantUsageCopilotUsageTokenDetail[];
1931
2115
  /**
1932
- * Total cost in nano-AIU (AI Units) for this request
2116
+ * Total cost in nano-AI units for this request
1933
2117
  */
1934
2118
  totalNanoAiu: number;
1935
2119
  }
@@ -1988,6 +2172,61 @@ export interface AssistantUsageQuotaSnapshot {
1988
2172
  */
1989
2173
  usedRequests: number;
1990
2174
  }
2175
+ export interface ModelCallFailureEvent {
2176
+ /**
2177
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2178
+ */
2179
+ agentId?: string;
2180
+ data: ModelCallFailureData;
2181
+ ephemeral: true;
2182
+ /**
2183
+ * Unique event identifier (UUID v4), generated when the event is emitted
2184
+ */
2185
+ id: string;
2186
+ /**
2187
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
2188
+ */
2189
+ parentId: string | null;
2190
+ /**
2191
+ * ISO 8601 timestamp when the event was created
2192
+ */
2193
+ timestamp: string;
2194
+ type: "model.call_failure";
2195
+ }
2196
+ /**
2197
+ * Failed LLM API call metadata for telemetry
2198
+ */
2199
+ export interface ModelCallFailureData {
2200
+ /**
2201
+ * Completion ID from the model provider (e.g., chatcmpl-abc123)
2202
+ */
2203
+ apiCallId?: string;
2204
+ /**
2205
+ * Duration of the failed API call in milliseconds
2206
+ */
2207
+ durationMs?: number;
2208
+ /**
2209
+ * Raw provider/runtime error message for restricted telemetry
2210
+ */
2211
+ errorMessage?: string;
2212
+ /**
2213
+ * What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
2214
+ */
2215
+ initiator?: string;
2216
+ /**
2217
+ * Model identifier used for the failed API call
2218
+ */
2219
+ model?: string;
2220
+ /**
2221
+ * GitHub request tracing ID (x-github-request-id header) for server-side log correlation
2222
+ */
2223
+ providerCallId?: string;
2224
+ source: ModelCallFailureSource;
2225
+ /**
2226
+ * HTTP status code from the failed request
2227
+ */
2228
+ statusCode?: number;
2229
+ }
1991
2230
  export interface AbortEvent {
1992
2231
  /**
1993
2232
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -2119,6 +2358,10 @@ export interface ToolExecutionStartData {
2119
2358
  * Name of the tool being executed
2120
2359
  */
2121
2360
  toolName: string;
2361
+ /**
2362
+ * Identifier for the agent loop turn this tool was invoked in, matching the corresponding assistant.turn_start event
2363
+ */
2364
+ turnId?: string;
2122
2365
  }
2123
2366
  export interface ToolExecutionPartialResultEvent {
2124
2367
  /**
@@ -2249,6 +2492,10 @@ export interface ToolExecutionCompleteData {
2249
2492
  toolTelemetry?: {
2250
2493
  [k: string]: unknown;
2251
2494
  };
2495
+ /**
2496
+ * Identifier for the agent loop turn this tool was invoked in, matching the corresponding assistant.turn_start event
2497
+ */
2498
+ turnId?: string;
2252
2499
  }
2253
2500
  /**
2254
2501
  * Error details when the tool execution failed
@@ -2968,7 +3215,7 @@ export interface SystemNotificationNewInboxMessage {
2968
3215
  */
2969
3216
  senderName: string;
2970
3217
  /**
2971
- * Category of the sender (e.g., ambient-agent, plugin, hook)
3218
+ * Category of the sender (e.g., sidekick-agent, plugin, hook)
2972
3219
  */
2973
3220
  senderType: string;
2974
3221
  /**
@@ -3003,13 +3250,35 @@ export interface SystemNotificationShellDetachedCompleted {
3003
3250
  shellId: string;
3004
3251
  type: "shell_detached_completed";
3005
3252
  }
3253
+ export interface SystemNotificationInstructionDiscovered {
3254
+ /**
3255
+ * Human-readable label for the timeline (e.g., 'AGENTS.md from packages/billing/')
3256
+ */
3257
+ description?: string;
3258
+ /**
3259
+ * Relative path to the discovered instruction file
3260
+ */
3261
+ sourcePath: string;
3262
+ /**
3263
+ * Path of the file access that triggered discovery
3264
+ */
3265
+ triggerFile: string;
3266
+ /**
3267
+ * Tool command that triggered discovery (currently always 'view')
3268
+ */
3269
+ triggerTool: string;
3270
+ type: "instruction_discovered";
3271
+ }
3006
3272
  export interface PermissionRequestedEvent {
3007
3273
  /**
3008
3274
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3009
3275
  */
3010
3276
  agentId?: string;
3011
3277
  data: PermissionRequestedData;
3012
- ephemeral: true;
3278
+ /**
3279
+ * When true, the event is transient and not persisted to the session event log on disk
3280
+ */
3281
+ ephemeral?: boolean;
3013
3282
  /**
3014
3283
  * Unique event identifier (UUID v4), generated when the event is emitted
3015
3284
  */
@@ -3538,7 +3807,10 @@ export interface PermissionCompletedEvent {
3538
3807
  */
3539
3808
  agentId?: string;
3540
3809
  data: PermissionCompletedData;
3541
- ephemeral: true;
3810
+ /**
3811
+ * When true, the event is transient and not persisted to the session event log on disk
3812
+ */
3813
+ ephemeral?: boolean;
3542
3814
  /**
3543
3815
  * Unique event identifier (UUID v4), generated when the event is emitted
3544
3816
  */
@@ -3561,17 +3833,165 @@ export interface PermissionCompletedData {
3561
3833
  * Request ID of the resolved permission request; clients should dismiss any UI for this request
3562
3834
  */
3563
3835
  requestId: string;
3564
- result: PermissionCompletedResult;
3836
+ result: PermissionResult;
3565
3837
  /**
3566
3838
  * Optional tool call ID associated with this permission prompt; clients may use it to correlate UI created from tool-scoped prompts
3567
3839
  */
3568
3840
  toolCallId?: string;
3569
3841
  }
3570
- /**
3571
- * The result of the permission request
3572
- */
3573
- export interface PermissionCompletedResult {
3574
- kind: PermissionCompletedKind;
3842
+ export interface PermissionApproved {
3843
+ /**
3844
+ * The permission request was approved
3845
+ */
3846
+ kind: "approved";
3847
+ }
3848
+ export interface PermissionApprovedForSession {
3849
+ approval: UserToolSessionApproval;
3850
+ /**
3851
+ * Approved and remembered for the rest of the session
3852
+ */
3853
+ kind: "approved-for-session";
3854
+ }
3855
+ export interface UserToolSessionApprovalCommands {
3856
+ /**
3857
+ * Command identifiers approved by the user
3858
+ */
3859
+ commandIdentifiers: string[];
3860
+ /**
3861
+ * Command approval kind
3862
+ */
3863
+ kind: "commands";
3864
+ }
3865
+ export interface UserToolSessionApprovalRead {
3866
+ /**
3867
+ * Read approval kind
3868
+ */
3869
+ kind: "read";
3870
+ }
3871
+ export interface UserToolSessionApprovalWrite {
3872
+ /**
3873
+ * Write approval kind
3874
+ */
3875
+ kind: "write";
3876
+ }
3877
+ export interface UserToolSessionApprovalMcp {
3878
+ /**
3879
+ * MCP tool approval kind
3880
+ */
3881
+ kind: "mcp";
3882
+ /**
3883
+ * MCP server name
3884
+ */
3885
+ serverName: string;
3886
+ /**
3887
+ * Optional MCP tool name, or null for all tools on the server
3888
+ */
3889
+ toolName: string | null;
3890
+ }
3891
+ export interface UserToolSessionApprovalMemory {
3892
+ /**
3893
+ * Memory approval kind
3894
+ */
3895
+ kind: "memory";
3896
+ }
3897
+ export interface UserToolSessionApprovalCustomTool {
3898
+ /**
3899
+ * Custom tool approval kind
3900
+ */
3901
+ kind: "custom-tool";
3902
+ /**
3903
+ * Custom tool name
3904
+ */
3905
+ toolName: string;
3906
+ }
3907
+ export interface PermissionApprovedForLocation {
3908
+ approval: UserToolSessionApproval;
3909
+ /**
3910
+ * Approved and persisted for this project location
3911
+ */
3912
+ kind: "approved-for-location";
3913
+ /**
3914
+ * The location key (git root or cwd) to persist the approval to
3915
+ */
3916
+ locationKey: string;
3917
+ }
3918
+ export interface PermissionCancelled {
3919
+ /**
3920
+ * The permission request was cancelled before a response was used
3921
+ */
3922
+ kind: "cancelled";
3923
+ /**
3924
+ * Optional explanation of why the request was cancelled
3925
+ */
3926
+ reason?: string;
3927
+ }
3928
+ export interface PermissionDeniedByRules {
3929
+ /**
3930
+ * Denied because approval rules explicitly blocked it
3931
+ */
3932
+ kind: "denied-by-rules";
3933
+ /**
3934
+ * Rules that denied the request
3935
+ */
3936
+ rules: PermissionRule[];
3937
+ }
3938
+ export interface PermissionRule {
3939
+ /**
3940
+ * Optional rule argument matched against the request
3941
+ */
3942
+ argument: string | null;
3943
+ /**
3944
+ * The rule kind, such as Shell or GitHubMCP
3945
+ */
3946
+ kind: string;
3947
+ }
3948
+ export interface PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser {
3949
+ /**
3950
+ * Denied because no approval rule matched and user confirmation was unavailable
3951
+ */
3952
+ kind: "denied-no-approval-rule-and-could-not-request-from-user";
3953
+ }
3954
+ export interface PermissionDeniedInteractivelyByUser {
3955
+ /**
3956
+ * Optional feedback from the user explaining the denial
3957
+ */
3958
+ feedback?: string;
3959
+ /**
3960
+ * Whether to force-reject the current agent turn
3961
+ */
3962
+ forceReject?: boolean;
3963
+ /**
3964
+ * Denied by the user during an interactive prompt
3965
+ */
3966
+ kind: "denied-interactively-by-user";
3967
+ }
3968
+ export interface PermissionDeniedByContentExclusionPolicy {
3969
+ /**
3970
+ * Denied by the organization's content exclusion policy
3971
+ */
3972
+ kind: "denied-by-content-exclusion-policy";
3973
+ /**
3974
+ * Human-readable explanation of why the path was excluded
3975
+ */
3976
+ message: string;
3977
+ /**
3978
+ * File path that triggered the exclusion
3979
+ */
3980
+ path: string;
3981
+ }
3982
+ export interface PermissionDeniedByPermissionRequestHook {
3983
+ /**
3984
+ * Whether to interrupt the current agent turn
3985
+ */
3986
+ interrupt?: boolean;
3987
+ /**
3988
+ * Denied by a permission request hook registered by an extension or plugin
3989
+ */
3990
+ kind: "denied-by-permission-request-hook";
3991
+ /**
3992
+ * Optional message from the hook explaining the denial
3993
+ */
3994
+ message?: string;
3575
3995
  }
3576
3996
  export interface UserInputRequestedEvent {
3577
3997
  /**
@@ -3878,6 +4298,10 @@ export interface McpOauthRequiredStaticClientConfig {
3878
4298
  * OAuth client ID for the server
3879
4299
  */
3880
4300
  clientId: string;
4301
+ /**
4302
+ * Optional non-default OAuth grant type. When set to 'client_credentials', the OAuth flow runs headlessly using the client_id + keychain-stored secret (no browser, no callback server).
4303
+ */
4304
+ grantType?: "client_credentials";
3881
4305
  /**
3882
4306
  * Whether this is a public OAuth client
3883
4307
  */
@@ -3919,7 +4343,10 @@ export interface ExternalToolRequestedEvent {
3919
4343
  */
3920
4344
  agentId?: string;
3921
4345
  data: ExternalToolRequestedData;
3922
- ephemeral: true;
4346
+ /**
4347
+ * When true, the event is transient and not persisted to the session event log on disk
4348
+ */
4349
+ ephemeral?: boolean;
3923
4350
  /**
3924
4351
  * Unique event identifier (UUID v4), generated when the event is emitted
3925
4352
  */
@@ -3975,7 +4402,7 @@ export interface ExternalToolCompletedEvent {
3975
4402
  */
3976
4403
  agentId?: string;
3977
4404
  data: ExternalToolCompletedData;
3978
- ephemeral: true;
4405
+ ephemeral?: true;
3979
4406
  /**
3980
4407
  * Unique event identifier (UUID v4), generated when the event is emitted
3981
4408
  */
@@ -4138,6 +4565,10 @@ export interface AutoModeSwitchRequestedData {
4138
4565
  * Unique identifier for this request; used to respond via session.respondToAutoModeSwitch()
4139
4566
  */
4140
4567
  requestId: string;
4568
+ /**
4569
+ * Seconds until the rate limit resets, when known. Lets clients render a humanized reset time alongside the prompt.
4570
+ */
4571
+ retryAfterSeconds?: number;
4141
4572
  }
4142
4573
  export interface AutoModeSwitchCompletedEvent {
4143
4574
  /**
@@ -4496,9 +4927,9 @@ export interface CustomAgentsUpdatedAgent {
4496
4927
  */
4497
4928
  source: string;
4498
4929
  /**
4499
- * List of tool names available to this agent
4930
+ * List of tool names available to this agent, or null when all tools are available
4500
4931
  */
4501
- tools: string[];
4932
+ tools: string[] | null;
4502
4933
  /**
4503
4934
  * Whether the agent can be selected by the user
4504
4935
  */