@github/copilot-sdk 1.0.11-preview.2 → 1.0.12-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.
@@ -9,7 +9,7 @@ export type JsonValue = null | boolean | number | string | JsonValue[] | {
9
9
  /**
10
10
  * Union of all session event variants emitted by the Copilot CLI runtime.
11
11
  */
12
- export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | ScheduleRearmedEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | SessionLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | UsageCheckpointEvent | ContextChangedEvent | UsageInfoEvent | ContextClearedEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantServerToolProgressEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantToolCallDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantIdleEvent | AssistantUsageEvent | ModelCallFailureEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | ToolSearchActivatedEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | McpHeadersRefreshRequiredEvent | McpHeadersRefreshCompletedEvent | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | SessionLimitsExhaustedRequestedEvent | SessionLimitsExhaustedCompletedEvent | AutoModeResolvedEvent | ManagedSettingsResolvedEvent | ManagedSettingsEnforcedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | FactoryRunUpdatedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | McpToolsListChangedEvent | McpResourcesListChangedEvent | McpPromptsListChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
12
+ export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | ScheduleRearmedEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | SessionLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | UsageCheckpointEvent | ContextChangedEvent | UsageInfoEvent | ContextClearedEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantServerToolProgressEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantToolCallDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantIdleEvent | AssistantUsageEvent | ModelCallFailureEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | ToolSearchActivatedEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | McpHeadersRefreshRequiredEvent | McpHeadersRefreshCompletedEvent | CustomNotificationEvent | UIEphemeralQueryEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | SessionLimitsExhaustedRequestedEvent | SessionLimitsExhaustedCompletedEvent | AutoModeResolvedEvent | ManagedSettingsResolvedEvent | ManagedSettingsEnforcedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | FactoryRunUpdatedEvent | FactoryRunStartedEvent | FactoryRunSettledEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | McpToolsListChangedEvent | McpResourcesListChangedEvent | McpPromptsListChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
13
13
  /**
14
14
  * Hosting platform type of the repository (github or ado)
15
15
  */
@@ -76,6 +76,32 @@ export type AutopilotObjectiveChangedStatus =
76
76
  | "cap_reached"
77
77
  /** Objective was completed by the agent. */
78
78
  | "completed";
79
+ /**
80
+ * Origin of an effective session model change.
81
+ */
82
+ export type ModelChangeSource =
83
+ /** The user selected a model directly with `/model <id>`. */
84
+ "model_command"
85
+ /** The user selected the model with `/settings`. */
86
+ | "settings_command"
87
+ /** The user selected the model with the `/config` alias. */
88
+ | "config_command"
89
+ /** The user selected the model in the model picker, including the picker opened by bare `/model`. */
90
+ | "model_picker"
91
+ /** Organization-managed settings selected the model. */
92
+ | "managed_settings"
93
+ /** Repository settings selected the model. */
94
+ | "repo_settings"
95
+ /** Startup model resolution selected the model. */
96
+ | "startup"
97
+ /** Selecting an agent selected its configured model. */
98
+ | "agent"
99
+ /** Entering, leaving, or reconfiguring plan mode selected the model. */
100
+ | "plan_mode"
101
+ /** The runtime selected the model automatically, such as rate-limit recovery or refusal fallback. */
102
+ | "automatic"
103
+ /** An SDK or RPC caller selected the model. */
104
+ | "sdk";
79
105
  /**
80
106
  * The session mode the agent is operating in
81
107
  */
@@ -87,16 +113,16 @@ export type SessionMode =
87
113
  /** The agent is working autonomously toward task completion. */
88
114
  | "autopilot";
89
115
  /**
90
- * Allow-all mode for the session.
116
+ * Permission mode for the session.
91
117
  */
92
118
  /** @experimental */
93
- export type PermissionAllowAllMode =
119
+ export type PermissionMode =
94
120
  /** Permission requests follow the normal approval flow. */
95
- "off"
121
+ "manual"
122
+ /** Permission requests include an LLM safety recommendation; clients may automatically approve requests judged acceptable. */
123
+ | "assisted"
96
124
  /** Tool, path, and URL permission requests are automatically approved. */
97
- | "on"
98
- /** Permission requests follow the normal approval flow with an LLM advisory recommendation attached; clients may choose to auto-approve requests the judge evaluated as acceptable. */
99
- | "auto";
125
+ | "allow-all";
100
126
  /**
101
127
  * The type of operation performed on the plan file
102
128
  */
@@ -235,6 +261,14 @@ export type AssistantUsageApiEndpoint =
235
261
  | "/responses"
236
262
  /** WebSocket Responses API endpoint. */
237
263
  | "ws:/responses";
264
+ /**
265
+ * Transport used for a successful model call
266
+ */
267
+ export type AssistantUsageTransport =
268
+ /** HTTP transport, including SSE streams. */
269
+ "http"
270
+ /** WebSocket transport. */
271
+ | "websocket";
238
272
  /**
239
273
  * 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.
240
274
  */
@@ -395,7 +429,14 @@ export type SystemNotificationFactoryCompletedStatus =
395
429
  /**
396
430
  * Details of the permission being requested
397
431
  */
398
- export type PermissionRequest = PermissionRequestShell | PermissionRequestWrite | PermissionRequestRead | PermissionRequestMcp | PermissionRequestUrl | PermissionRequestMemory | PermissionRequestCustomTool | PermissionRequestHook | PermissionRequestExtensionManagement | PermissionRequestFactory | PermissionRequestExtensionPermissionAccess;
432
+ export type PermissionRequest = PermissionRequestShell | PermissionRequestWrite | PermissionRequestRead | PermissionRequestMcp | PermissionRequestUrl | PermissionRequestMemory | PermissionRequestCustomTool | PermissionRequestHook | PermissionRequestExtensionManagement | PermissionRequestFactory | PermissionRequestExtensionPermissionAccess | PermissionRequestExtensionEnvAccess;
433
+ /**
434
+ * Advisory recommendation the runtime attaches to a permission request whose origin it can vouch for by construction. Unlike the auto-approval judge this does not depend on auto mode and does not evaluate what the tool call does; its absence simply means the runtime has no opinion and the request follows the host's normal approval flow.
435
+ */
436
+ /** @experimental */
437
+ export type PermissionRecommendation =
438
+ /** The runtime vouches for the request's origin and recommends approving it without prompting. The host still owns the decision and may deny it; deny rules, managed policy, and the auto-approval safety judge all outrank this recommendation. */
439
+ "approve";
399
440
  /**
400
441
  * Whether this is a store or vote memory operation
401
442
  */
@@ -405,30 +446,10 @@ export type PermissionRequestMemoryAction =
405
446
  /** Vote on an existing memory. */
406
447
  | "vote";
407
448
  /**
408
- * Vote direction (vote only)
409
- */
410
- export type PermissionRequestMemoryDirection =
411
- /** Vote that the memory is useful or accurate. */
412
- "upvote"
413
- /** Vote that the memory is incorrect or outdated. */
414
- | "downvote";
415
- /**
416
- * Operation gated by a factory permission request.
417
- */
418
- export type FactoryPermissionOperation =
419
- /** Running a registered factory, which spends subagents, active time, and AI credits under the approved limits. */
420
- "run"
421
- /** Authoring a factory, which writes JavaScript into a session-scoped extension and loads it. */
422
- | "author";
423
- /**
424
- * Derived user-facing permission prompt details for UI consumers
425
- */
426
- export type PermissionPromptRequest = PermissionPromptRequestCommands | PermissionPromptRequestWrite | PermissionPromptRequestRead | PermissionPromptRequestMcp | PermissionPromptRequestUrl | PermissionPromptRequestMemory | PermissionPromptRequestCustomTool | PermissionPromptRequestPath | PermissionPromptRequestHook | PermissionPromptRequestExtensionManagement | PermissionPromptRequestFactory | PermissionPromptRequestExtensionPermissionAccess;
427
- /**
428
- * Why the auto-approval judge produced no usable recommendation. Present only alongside an `error` recommendation, where the human-readable reason is a fixed string and therefore cannot distinguish these cases. Intended to make a judge failure reportable by a consumer that has no access to the host's logs.
449
+ * Why the assisted-approval judge produced no usable recommendation. Present only alongside an `error` recommendation, where the human-readable reason is a fixed string and therefore cannot distinguish these cases. Intended to make a judge failure reportable by a consumer that has no access to the host's logs.
429
450
  */
430
451
  /** @experimental */
431
- export type AutoApprovalJudgeFailureReason =
452
+ export type AssistedApprovalJudgeFailureReason =
432
453
  /** The judge model call exceeded its deadline. */
433
454
  "timeout"
434
455
  /** The judge model call was cancelled before it returned. */
@@ -440,18 +461,46 @@ export type AutoApprovalJudgeFailureReason =
440
461
  /** The judge model replied, but the reply carried no ALLOW/DENY verdict. */
441
462
  | "parse_error";
442
463
  /**
443
- * Outcome of the auto-approval safety judge for a permission request. Present only when auto mode is enabled; its absence means the judge did not evaluate the request (auto mode was off).
464
+ * Outcome of the assisted-approval safety judge for a permission request. Present only in assisted mode; its absence means the judge did not evaluate the request.
444
465
  */
445
466
  /** @experimental */
446
- export type AutoApprovalRecommendation =
467
+ export type AssistedApprovalRecommendation =
447
468
  /** The judge evaluated the request and recommends automatically approving it. */
448
469
  "approve"
449
- /** The judge evaluated the request and does not recommend auto-approving it; explicit approval is required. Whether that means prompting, denying, or something else is the consumer's decision. */
470
+ /** The judge evaluated the request and does not recommend automatically approving it; explicit approval is required. Whether that means prompting, denying, or something else is the consumer's decision. */
450
471
  | "requireApproval"
451
- /** Auto mode is enabled, but this request category is never auto-approvable (for example, sandbox-bypass requests), so the judge was not consulted. */
472
+ /** Assisted mode is enabled, but this request category is never automatically approvable (for example, sandbox-bypass requests), so the judge was not consulted. */
452
473
  | "excluded"
453
474
  /** The judge was consulted but did not return a usable recommendation, so the request requires explicit approval. */
454
475
  | "error";
476
+ /**
477
+ * Vote direction (vote only)
478
+ */
479
+ export type PermissionRequestMemoryDirection =
480
+ /** Vote that the memory is useful or accurate. */
481
+ "upvote"
482
+ /** Vote that the memory is incorrect or outdated. */
483
+ | "downvote";
484
+ /**
485
+ * Scope of a stored memory.
486
+ */
487
+ export type PermissionRequestMemoryScope =
488
+ /** Store the memory for the current repository. */
489
+ "repository"
490
+ /** Store the memory for the current user. */
491
+ | "user";
492
+ /**
493
+ * Operation gated by a factory permission request.
494
+ */
495
+ export type FactoryPermissionOperation =
496
+ /** Running a registered factory, which spends subagents, active time, and AI credits under the approved limits. */
497
+ "run"
498
+ /** Authoring a factory, which writes JavaScript into a session-scoped extension and loads it. */
499
+ | "author";
500
+ /**
501
+ * Derived user-facing permission prompt details for UI consumers
502
+ */
503
+ export type PermissionPromptRequest = PermissionPromptRequestCommands | PermissionPromptRequestWrite | PermissionPromptRequestRead | PermissionPromptRequestMcp | PermissionPromptRequestUrl | PermissionPromptRequestMemory | PermissionPromptRequestCustomTool | PermissionPromptRequestPath | PermissionPromptRequestHook | PermissionPromptRequestExtensionManagement | PermissionPromptRequestFactory | PermissionPromptRequestExtensionPermissionAccess | PermissionPromptRequestExtensionEnvAccess;
455
504
  /**
456
505
  * Underlying permission kind that needs path approval
457
506
  */
@@ -469,7 +518,7 @@ export type PermissionResult = PermissionApproved | PermissionApprovedForSession
469
518
  /**
470
519
  * The approval to add as a session-scoped rule
471
520
  */
472
- export type UserToolSessionApproval = UserToolSessionApprovalCommands | UserToolSessionApprovalRead | UserToolSessionApprovalWrite | UserToolSessionApprovalMcp | UserToolSessionApprovalMemory | UserToolSessionApprovalCustomTool | UserToolSessionApprovalExtensionManagement | UserToolSessionApprovalFactory | UserToolSessionApprovalExtensionPermissionAccess;
521
+ export type UserToolSessionApproval = UserToolSessionApprovalCommands | UserToolSessionApprovalRead | UserToolSessionApprovalWrite | UserToolSessionApprovalMcp | UserToolSessionApprovalMemory | UserToolSessionApprovalCustomTool | UserToolSessionApprovalExtensionManagement | UserToolSessionApprovalFactory | UserToolSessionApprovalExtensionPermissionAccess | UserToolSessionApprovalExtensionEnvAccess;
473
522
  /**
474
523
  * Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent.
475
524
  */
@@ -536,6 +585,21 @@ export type McpHeadersRefreshCompletedOutcome =
536
585
  * Source-defined JSON payload for the custom notification
537
586
  */
538
587
  export type CustomNotificationPayload = JsonValue;
588
+ /**
589
+ * Lifecycle phase for a Rust-owned ephemeral query stream.
590
+ */
591
+ /** @experimental */
592
+ export type UIEphemeralQueryPhase =
593
+ /** The ephemeral query stream has begun. */
594
+ "started"
595
+ /** A partial result chunk was produced by the stream. */
596
+ | "chunk"
597
+ /** The ephemeral query stream finished successfully. */
598
+ | "completed"
599
+ /** The ephemeral query stream ended with an error. */
600
+ | "failed"
601
+ /** The ephemeral query stream was cancelled before completing. */
602
+ | "aborted";
539
603
  /**
540
604
  * The user's auto-mode-switch choice
541
605
  */
@@ -592,12 +656,12 @@ export type ManagedSettingsEnforcedAction =
592
656
  * For a `bypass_permissions_blocked` action, which permission-escalation primitive was refused
593
657
  */
594
658
  export type ManagedSettingsEnforcedEscalation =
595
- /** Full allow-all ("/allow-all on") permissions — auto-approving tools, paths, and URLs. */
659
+ /** Full allow-all permissions — automatically approving tools, paths, and URLs. */
596
660
  "allow_all"
597
- /** Auto-approval of all tool permission requests. */
661
+ /** Automatic approval of all tool permission requests. */
598
662
  | "approve_all"
599
- /** Advisory auto-approval ("/allow-all auto") mode — keeps normal prompt paths and adds LLM-advised approval, distinct from full allow-all. */
600
- | "auto_approval"
663
+ /** Assisted mode — keeps normal prompt paths and adds an LLM recommendation, distinct from allow-all. */
664
+ | "assisted_approval"
601
665
  /** Unrestricted filesystem access outside the session's allowed directories. */
602
666
  | "unrestricted_paths"
603
667
  /** Unrestricted URL fetch access. */
@@ -614,6 +678,18 @@ export type ExitPlanModeAction =
614
678
  | "autopilot"
615
679
  /** Exit plan mode and continue with parallel autonomous workers. */
616
680
  | "autopilot_fleet";
681
+ /**
682
+ * Terminal status a factory run committed. A settled run is never `pending` or `running`, so those two members of the run-status domain are deliberately absent.
683
+ */
684
+ export type FactoryRunSettledStatus =
685
+ /** The factory body resolved and its result was committed. */
686
+ "completed"
687
+ /** The run was stopped by a limit, an approval refusal or another policy decision. */
688
+ | "halted"
689
+ /** The run was cancelled by its caller or by session disposal. */
690
+ | "cancelled"
691
+ /** The run failed, with `failureType` carrying the class when it has one. */
692
+ | "error";
617
693
  /**
618
694
  * Source location type (e.g., project, personal-copilot, plugin, builtin)
619
695
  */
@@ -1474,6 +1550,7 @@ export interface ModelChangeData {
1474
1550
  */
1475
1551
  reasoningEffort?: string | null;
1476
1552
  reasoningSummary?: ReasoningSummary;
1553
+ source?: ModelChangeSource;
1477
1554
  verbosity?: Verbosity;
1478
1555
  }
1479
1556
  /**
@@ -1553,8 +1630,9 @@ export interface SessionLimitsChangedData {
1553
1630
  sessionLimits: SessionLimitsConfig | null;
1554
1631
  }
1555
1632
  /**
1556
- * Session event "session.permissions_changed". Permissions change details carrying the aggregate allow-all transition.
1633
+ * Session event "session.permissions_changed". Permission-mode transition details.
1557
1634
  */
1635
+ /** @experimental */
1558
1636
  export interface PermissionsChangedEvent {
1559
1637
  /**
1560
1638
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -1583,29 +1661,28 @@ export interface PermissionsChangedEvent {
1583
1661
  type: "session.permissions_changed";
1584
1662
  }
1585
1663
  /**
1586
- * Permissions change details carrying the aggregate allow-all transition.
1664
+ * Permission-mode transition details.
1587
1665
  */
1666
+ /** @experimental */
1588
1667
  export interface PermissionsChangedData {
1589
1668
  /**
1590
- * Allow-all mode after the change
1669
+ * Explicit LLM judge model override used by assisted mode; omitted when the provider default applies
1591
1670
  *
1592
1671
  * @experimental
1593
1672
  */
1594
- allowAllPermissionMode?: PermissionAllowAllMode;
1673
+ assistedApprovalModel?: string;
1595
1674
  /**
1596
- * Aggregate allow-all flag after the change
1597
- */
1598
- allowAllPermissions: boolean;
1599
- /**
1600
- * Allow-all mode before the change
1675
+ * Permission mode after the change
1601
1676
  *
1602
1677
  * @experimental
1603
1678
  */
1604
- previousAllowAllPermissionMode?: PermissionAllowAllMode;
1679
+ mode: PermissionMode;
1605
1680
  /**
1606
- * Aggregate allow-all flag before the change
1681
+ * Permission mode before the change
1682
+ *
1683
+ * @experimental
1607
1684
  */
1608
- previousAllowAllPermissions: boolean;
1685
+ previousMode: PermissionMode;
1609
1686
  }
1610
1687
  /**
1611
1688
  * Session event "session.plan_changed". Plan file operation details indicating what changed
@@ -1936,6 +2013,12 @@ export interface ShutdownEvent {
1936
2013
  * Session termination metrics including usage statistics, code changes, and shutdown reason
1937
2014
  */
1938
2015
  export interface ShutdownData {
2016
+ /**
2017
+ * Per-agent usage breakdown, keyed by agent instance identifier. The main conversation uses the stable key `main`.
2018
+ */
2019
+ agentMetrics?: {
2020
+ [k: string]: ShutdownAgentMetric | undefined;
2021
+ };
1939
2022
  codeChanges: ShutdownCodeChanges;
1940
2023
  /**
1941
2024
  * Non-system message token count at shutdown
@@ -1994,21 +2077,31 @@ export interface ShutdownData {
1994
2077
  totalNanoAiu?: number;
1995
2078
  }
1996
2079
  /**
1997
- * Aggregate code change metrics for the session
2080
+ * Usage attributed to one agent instance at session shutdown.
1998
2081
  */
1999
- export interface ShutdownCodeChanges {
2082
+ export interface ShutdownAgentMetric {
2000
2083
  /**
2001
- * List of file paths that were modified during the session
2084
+ * Human-readable label for this subagent invocation, copied from the originating `subagent.started` event. For task-tool subagents this is the invocation's task description rather than the agent's configured display name, so group by `agentName` for stable per-agent labels.
2002
2085
  */
2003
- filesModified: string[];
2086
+ agentDisplayName?: string;
2004
2087
  /**
2005
- * Total number of lines added during the session
2088
+ * Configured agent name, when this is a subagent
2006
2089
  */
2007
- linesAdded: number;
2090
+ agentName?: string;
2008
2091
  /**
2009
- * Total number of lines removed during the session
2092
+ * Per-model usage for this agent, keyed by model identifier
2010
2093
  */
2011
- linesRemoved: number;
2094
+ modelMetrics: {
2095
+ [k: string]: ShutdownModelMetric | undefined;
2096
+ };
2097
+ /**
2098
+ * Time spent in model API calls by this agent, in milliseconds
2099
+ */
2100
+ totalApiDurationMs: number;
2101
+ /**
2102
+ * Accumulated nano-AI units cost for this agent
2103
+ */
2104
+ totalNanoAiu: number;
2012
2105
  }
2013
2106
  /**
2014
2107
  * Per-model shutdown metrics with request counts, token usage, nano-AI units, and token details.
@@ -2080,6 +2173,23 @@ export interface ShutdownModelMetricUsage {
2080
2173
  */
2081
2174
  reasoningTokens?: number;
2082
2175
  }
2176
+ /**
2177
+ * Aggregate code change metrics for the session
2178
+ */
2179
+ export interface ShutdownCodeChanges {
2180
+ /**
2181
+ * List of file paths that were modified during the session
2182
+ */
2183
+ filesModified: string[];
2184
+ /**
2185
+ * Total number of lines added during the session
2186
+ */
2187
+ linesAdded: number;
2188
+ /**
2189
+ * Total number of lines removed during the session
2190
+ */
2191
+ linesRemoved: number;
2192
+ }
2083
2193
  /**
2084
2194
  * A session-wide shutdown token-type entry storing the accumulated token count.
2085
2195
  */
@@ -2607,6 +2717,10 @@ export interface UserMessageData {
2607
2717
  * Transformed version of the message sent to the model, with XML wrapping, timestamps, and other augmentations for prompt caching
2608
2718
  */
2609
2719
  transformedContent?: string;
2720
+ /**
2721
+ * The agent-loop turn ID that consumed this message; absent when no agent-loop turn consumed it
2722
+ */
2723
+ turnId?: string;
2610
2724
  }
2611
2725
  /**
2612
2726
  * File attachment
@@ -3256,6 +3370,9 @@ export interface AssistantReasoningData {
3256
3370
  * Unique identifier for this reasoning block
3257
3371
  */
3258
3372
  reasoningId: string;
3373
+ /**
3374
+ * Per-request treatment/eligibility signal returned by the Copilot API in the `X-GitHub-Copilot-Request-TE` response header for the associated model call; `false` when the header was absent or unparseable.
3375
+ */
3259
3376
  rte?: boolean;
3260
3377
  }
3261
3378
  /**
@@ -3493,6 +3610,9 @@ export interface AssistantMessageData {
3493
3610
  * GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
3494
3611
  */
3495
3612
  requestId?: string;
3613
+ /**
3614
+ * Per-request treatment/eligibility signal returned by the Copilot API in the `X-GitHub-Copilot-Request-TE` response header for the associated model call; `false` when the header was absent or unparseable.
3615
+ */
3496
3616
  rte?: boolean;
3497
3617
  serverTools?: AssistantMessageServerTools;
3498
3618
  /**
@@ -3641,12 +3761,27 @@ export interface CitationLocationBlock {
3641
3761
  */
3642
3762
  /** @experimental */
3643
3763
  export interface AssistantMessageServerTools {
3764
+ /**
3765
+ * Advisor model identifier associated with the server-tool payload.
3766
+ */
3644
3767
  advisorModel?: string;
3768
+ /**
3769
+ * Provider function-call namespaces keyed by function-call identifier.
3770
+ */
3645
3771
  functionCallNamespaces?: {
3646
3772
  [k: string]: string | undefined;
3647
3773
  };
3774
+ /**
3775
+ * Provider-native server-tool call and output items preserved verbatim for replay.
3776
+ */
3648
3777
  items?: JsonValue[];
3778
+ /**
3779
+ * Model provider that produced this server-tool payload.
3780
+ */
3649
3781
  provider: string;
3782
+ /**
3783
+ * Raw provider content blocks retained for verbatim round-tripping.
3784
+ */
3650
3785
  rawContentBlocks?: JsonValue[];
3651
3786
  }
3652
3787
  /**
@@ -3890,6 +4025,10 @@ export interface AssistantUsageEvent {
3890
4025
  * LLM API call usage metrics including tokens, costs, quotas, and billing information
3891
4026
  */
3892
4027
  export interface AssistantUsageData {
4028
+ /**
4029
+ * Number of accepted speculative prediction tokens
4030
+ */
4031
+ acceptedPredictionTokens?: number;
3893
4032
  /**
3894
4033
  * Completion ID from the model provider (e.g., chatcmpl-abc123)
3895
4034
  */
@@ -3942,6 +4081,22 @@ export interface AssistantUsageData {
3942
4081
  * Average inter-token latency in milliseconds. Only available for streaming requests
3943
4082
  */
3944
4083
  interTokenLatencyMs?: number;
4084
+ /**
4085
+ * Whether Auto mode was selected for this model call
4086
+ */
4087
+ isAuto?: boolean;
4088
+ /**
4089
+ * Whether this model call used a bring-your-own-key provider
4090
+ */
4091
+ isByok?: boolean;
4092
+ /**
4093
+ * Requested maximum output tokens used for this model call
4094
+ */
4095
+ maxOutputTokens?: number;
4096
+ /**
4097
+ * Effective maximum prompt-token limit used for this model call
4098
+ */
4099
+ maxPromptTokens?: number;
3945
4100
  /**
3946
4101
  * Model identifier used for this API call
3947
4102
  */
@@ -3963,10 +4118,18 @@ export interface AssistantUsageData {
3963
4118
  * Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
3964
4119
  */
3965
4120
  reasoningEffort?: string;
4121
+ reasoningSummary?: ReasoningSummary;
3966
4122
  /**
3967
4123
  * Number of output tokens used for reasoning (e.g., chain-of-thought)
3968
4124
  */
3969
4125
  reasoningTokens?: number;
4126
+ /**
4127
+ * Number of rejected speculative prediction tokens
4128
+ */
4129
+ rejectedPredictionTokens?: number;
4130
+ /**
4131
+ * Per-request treatment/eligibility signal returned by the Copilot API in the `X-GitHub-Copilot-Request-TE` response header for the associated model call; `false` when the header was absent or unparseable.
4132
+ */
3970
4133
  rte?: boolean;
3971
4134
  /**
3972
4135
  * Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
@@ -3976,6 +4139,7 @@ export interface AssistantUsageData {
3976
4139
  * Time to first token in milliseconds. Only available for streaming requests
3977
4140
  */
3978
4141
  timeToFirstTokenMs?: number;
4142
+ transport?: AssistantUsageTransport;
3979
4143
  }
3980
4144
  /**
3981
4145
  * Per-request cost and usage data from the CAPI copilot_usage response field
@@ -4068,6 +4232,10 @@ export interface ModelCallFailureData {
4068
4232
  * What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
4069
4233
  */
4070
4234
  initiator?: string;
4235
+ /**
4236
+ * Authoritative interaction classification for the failed call, matching `assistant.usage.interactionType` (for example `conversation-agent`, `conversation-subagent`, or `conversation-sampling`). Absent when the producer cannot classify the interaction.
4237
+ */
4238
+ interactionType?: string;
4071
4239
  /**
4072
4240
  * Whether the session selected Auto mode for the failed call
4073
4241
  */
@@ -4097,6 +4265,9 @@ export interface ModelCallFailureData {
4097
4265
  */
4098
4266
  reasoningEffort?: string;
4099
4267
  requestFingerprint?: ModelCallFailureRequestFingerprint;
4268
+ /**
4269
+ * Per-request treatment/eligibility signal returned by the Copilot API in the `X-GitHub-Copilot-Request-TE` response header for the associated model call; `false` when the header was absent or unparseable.
4270
+ */
4100
4271
  rte?: boolean;
4101
4272
  /**
4102
4273
  * Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
@@ -4284,6 +4455,9 @@ export interface ToolExecutionStartData {
4284
4455
  * Tool call ID of the parent tool invocation when this event originates from a sub-agent
4285
4456
  */
4286
4457
  parentToolCallId?: string;
4458
+ /**
4459
+ * Per-request treatment/eligibility signal returned by the Copilot API in the `X-GitHub-Copilot-Request-TE` response header for the associated model call; `false` when the header was absent or unparseable.
4460
+ */
4287
4461
  rte?: boolean;
4288
4462
  shellToolInfo?: ToolExecutionStartShellToolInfo;
4289
4463
  /**
@@ -4497,6 +4671,9 @@ export interface ToolExecutionCompleteData {
4497
4671
  */
4498
4672
  parentToolCallId?: string;
4499
4673
  result?: ToolExecutionCompleteResult;
4674
+ /**
4675
+ * Per-request treatment/eligibility signal returned by the Copilot API in the `X-GitHub-Copilot-Request-TE` response header for the associated model call; `false` when the header was absent or unparseable.
4676
+ */
4500
4677
  rte?: boolean;
4501
4678
  /**
4502
4679
  * Whether this tool execution ran inside a sandbox container
@@ -4910,17 +5087,35 @@ export interface ToolExecutionCompleteUIResourceMeta {
4910
5087
  */
4911
5088
  export interface ToolExecutionCompleteUIResourceMetaUI {
4912
5089
  csp?: ToolExecutionCompleteUIResourceMetaUICsp;
5090
+ /**
5091
+ * Optional dedicated origin for the rendered MCP Apps UI resource.
5092
+ */
4913
5093
  domain?: string;
4914
5094
  permissions?: ToolExecutionCompleteUIResourceMetaUIPermissions;
5095
+ /**
5096
+ * Whether the host should render a border around the MCP Apps UI resource.
5097
+ */
4915
5098
  prefersBorder?: boolean;
4916
5099
  }
4917
5100
  /**
4918
5101
  * CSP domain allowlists for an MCP Apps UI resource, including connect, resource, frame, and base URI domains.
4919
5102
  */
4920
5103
  export interface ToolExecutionCompleteUIResourceMetaUICsp {
5104
+ /**
5105
+ * Domains the UI resource may use as document base URIs.
5106
+ */
4921
5107
  baseUriDomains?: string[];
5108
+ /**
5109
+ * Domains the UI resource may connect to.
5110
+ */
4922
5111
  connectDomains?: string[];
5112
+ /**
5113
+ * Domains the UI resource may embed as nested frames.
5114
+ */
4923
5115
  frameDomains?: string[];
5116
+ /**
5117
+ * Domains from which the UI resource may load scripts, styles, images, and other resources.
5118
+ */
4924
5119
  resourceDomains?: string[];
4925
5120
  }
4926
5121
  /**
@@ -5146,6 +5341,10 @@ export interface SubagentStartedData {
5146
5341
  * Internal name of the sub-agent
5147
5342
  */
5148
5343
  agentName: string;
5344
+ /**
5345
+ * Root id of the factory run that spawned this sub-agent, when it was spawned by one.
5346
+ */
5347
+ factoryRunId?: string;
5149
5348
  /**
5150
5349
  * Model the sub-agent will run with, when known at start.
5151
5350
  */
@@ -5702,7 +5901,7 @@ export interface SystemNotificationData {
5702
5901
  */
5703
5902
  export interface SystemNotificationAgentCompleted {
5704
5903
  /**
5705
- * Unique identifier of the background agent
5904
+ * Unique task identifier
5706
5905
  */
5707
5906
  agentId: string;
5708
5907
  /**
@@ -5713,6 +5912,10 @@ export interface SystemNotificationAgentCompleted {
5713
5912
  * Human-readable description of the agent task
5714
5913
  */
5715
5914
  description?: string;
5915
+ /**
5916
+ * Friendly, non-unique name intended for display
5917
+ */
5918
+ displayName?: string;
5716
5919
  /**
5717
5920
  * The full prompt given to the background agent
5718
5921
  */
@@ -5728,7 +5931,7 @@ export interface SystemNotificationAgentCompleted {
5728
5931
  */
5729
5932
  export interface SystemNotificationAgentIdle {
5730
5933
  /**
5731
- * Unique identifier of the background agent
5934
+ * Unique task identifier
5732
5935
  */
5733
5936
  agentId: string;
5734
5937
  /**
@@ -5739,6 +5942,10 @@ export interface SystemNotificationAgentIdle {
5739
5942
  * Human-readable description of the agent task
5740
5943
  */
5741
5944
  description?: string;
5945
+ /**
5946
+ * Friendly, non-unique name intended for display
5947
+ */
5948
+ displayName?: string;
5742
5949
  /**
5743
5950
  * Type discriminator. Always "agent_idle".
5744
5951
  */
@@ -6126,6 +6333,12 @@ export interface PermissionRequestMcp {
6126
6333
  * Permission kind discriminator
6127
6334
  */
6128
6335
  kind: "mcp";
6336
+ /**
6337
+ * Advisory runtime permission recommendation. The SDK host remains responsible for deciding the request and may reject it.
6338
+ *
6339
+ * @experimental
6340
+ */
6341
+ permissionRecommendation?: PermissionRecommendation;
6129
6342
  /**
6130
6343
  * Whether this MCP tool is read-only (no side effects)
6131
6344
  */
@@ -6189,6 +6402,12 @@ export interface PermissionRequestUrl {
6189
6402
  */
6190
6403
  export interface PermissionRequestMemory {
6191
6404
  action?: PermissionRequestMemoryAction;
6405
+ /**
6406
+ * Assisted-approval judge information for this request; present only in assisted mode.
6407
+ *
6408
+ * @experimental
6409
+ */
6410
+ assistedApproval?: PermissionAssistedApproval;
6192
6411
  /**
6193
6412
  * Source references for the stored fact (store only)
6194
6413
  */
@@ -6206,6 +6425,11 @@ export interface PermissionRequestMemory {
6206
6425
  * Reason for the vote (vote only)
6207
6426
  */
6208
6427
  reason?: string;
6428
+ /**
6429
+ * Repository name with owner associated with the stored memory (store only)
6430
+ */
6431
+ repoNwo?: string;
6432
+ scope?: PermissionRequestMemoryScope;
6209
6433
  /**
6210
6434
  * Topic or subject of the memory (store only)
6211
6435
  */
@@ -6215,6 +6439,22 @@ export interface PermissionRequestMemory {
6215
6439
  */
6216
6440
  toolCallId?: string;
6217
6441
  }
6442
+ /**
6443
+ * Assisted-approval judge information attached to a permission request. Present only in assisted mode; its absence means the judge did not evaluate the request. The `recommendation` conveys the judge's disposition for this request.
6444
+ */
6445
+ /** @experimental */
6446
+ export interface PermissionAssistedApproval {
6447
+ failureReason?: AssistedApprovalJudgeFailureReason;
6448
+ /**
6449
+ * Model id that produced the recommendation, when the judge was consulted and reported one. Absent for `excluded` (the judge was not consulted) and for failures that occurred before a model was selected.
6450
+ */
6451
+ model?: string;
6452
+ /**
6453
+ * Human-readable reason for the judge's recommendation, when available.
6454
+ */
6455
+ reason?: string;
6456
+ recommendation: AssistedApprovalRecommendation;
6457
+ }
6218
6458
  /**
6219
6459
  * Custom tool invocation permission request
6220
6460
  */
@@ -6227,6 +6467,10 @@ export interface PermissionRequestCustomTool {
6227
6467
  * Permission kind discriminator
6228
6468
  */
6229
6469
  kind: "custom-tool";
6470
+ /**
6471
+ * Whether the tool declared that permission may be skipped unless a deny rule matches
6472
+ */
6473
+ skipPermission?: boolean;
6230
6474
  /**
6231
6475
  * Tool call ID that triggered this permission request
6232
6476
  */
@@ -6298,9 +6542,21 @@ export interface PermissionRequestFactory {
6298
6542
  * Whether this factory is eligible for persistent approval
6299
6543
  */
6300
6544
  canPersistApproval: boolean;
6545
+ /**
6546
+ * Factory-declared AI-credit limit before any run/resume caller override is applied.
6547
+ */
6301
6548
  declaredMaxAiCredits?: number;
6549
+ /**
6550
+ * Factory-declared concurrent-subagent limit before any run/resume caller override is applied.
6551
+ */
6302
6552
  declaredMaxConcurrentSubagents?: number;
6553
+ /**
6554
+ * Factory-declared total-subagent limit before any run/resume caller override is applied.
6555
+ */
6303
6556
  declaredMaxTotalSubagents?: number;
6557
+ /**
6558
+ * Factory-declared active-time limit in seconds before any run/resume caller override is applied.
6559
+ */
6304
6560
  declaredTimeoutSeconds?: number;
6305
6561
  /**
6306
6562
  * Factory description
@@ -6374,16 +6630,39 @@ export interface PermissionRequestExtensionPermissionAccess {
6374
6630
  */
6375
6631
  toolCallId?: string;
6376
6632
  }
6633
+ /**
6634
+ * Extension sensitive environment variable access request
6635
+ */
6636
+ export interface PermissionRequestExtensionEnvAccess {
6637
+ /**
6638
+ * Names of the sensitive environment variables the extension is requesting. Values never appear here.
6639
+ *
6640
+ * @minItems 1
6641
+ */
6642
+ environmentVariables: [string, ...string[]];
6643
+ /**
6644
+ * Name of the extension requesting environment variable access
6645
+ */
6646
+ extensionName: string;
6647
+ /**
6648
+ * Permission kind discriminator
6649
+ */
6650
+ kind: "extension-env-access";
6651
+ /**
6652
+ * Tool call ID that triggered this permission request
6653
+ */
6654
+ toolCallId?: string;
6655
+ }
6377
6656
  /**
6378
6657
  * Shell command permission prompt
6379
6658
  */
6380
6659
  export interface PermissionPromptRequestCommands {
6381
6660
  /**
6382
- * Auto-approval judge information for this request; present only when auto mode is enabled.
6661
+ * Assisted-approval judge information for this request; present only in assisted mode.
6383
6662
  *
6384
6663
  * @experimental
6385
6664
  */
6386
- autoApproval?: PermissionAutoApproval;
6665
+ assistedApproval?: PermissionAssistedApproval;
6387
6666
  /**
6388
6667
  * Whether the UI can offer session-wide approval for this command pattern
6389
6668
  */
@@ -6417,32 +6696,16 @@ export interface PermissionPromptRequestCommands {
6417
6696
  */
6418
6697
  warning?: string;
6419
6698
  }
6420
- /**
6421
- * Auto-approval judge information attached to a permission request. Present (non-null) only when the session's allow-all mode is "auto"; its absence means auto mode was off and the judge did not evaluate the request. The `recommendation` conveys the judge's disposition for this request.
6422
- */
6423
- /** @experimental */
6424
- export interface PermissionAutoApproval {
6425
- failureReason?: AutoApprovalJudgeFailureReason;
6426
- /**
6427
- * Model id that produced the recommendation, when the judge was consulted and reported one. Absent for `excluded` (the judge was not consulted) and for failures that occurred before a model was selected.
6428
- */
6429
- model?: string;
6430
- /**
6431
- * Human-readable reason for the judge's recommendation, when available.
6432
- */
6433
- reason?: string;
6434
- recommendation: AutoApprovalRecommendation;
6435
- }
6436
6699
  /**
6437
6700
  * File write permission prompt
6438
6701
  */
6439
6702
  export interface PermissionPromptRequestWrite {
6440
6703
  /**
6441
- * Auto-approval judge information for this request; present only when auto mode is enabled.
6704
+ * Assisted-approval judge information for this request; present only in assisted mode.
6442
6705
  *
6443
6706
  * @experimental
6444
6707
  */
6445
- autoApproval?: PermissionAutoApproval;
6708
+ assistedApproval?: PermissionAssistedApproval;
6446
6709
  /**
6447
6710
  * Whether the UI can offer session-wide approval for file write operations
6448
6711
  */
@@ -6481,11 +6744,11 @@ export interface PermissionPromptRequestWrite {
6481
6744
  */
6482
6745
  export interface PermissionPromptRequestRead {
6483
6746
  /**
6484
- * Auto-approval judge information for this request; present only when auto mode is enabled.
6747
+ * Assisted-approval judge information for this request; present only in assisted mode.
6485
6748
  *
6486
6749
  * @experimental
6487
6750
  */
6488
- autoApproval?: PermissionAutoApproval;
6751
+ assistedApproval?: PermissionAssistedApproval;
6489
6752
  /**
6490
6753
  * Human-readable description of why the file is being read
6491
6754
  */
@@ -6516,15 +6779,21 @@ export interface PermissionPromptRequestMcp {
6516
6779
  */
6517
6780
  args?: JsonValue;
6518
6781
  /**
6519
- * Auto-approval judge information for this request; present only when auto mode is enabled.
6782
+ * Assisted-approval judge information for this request; present only in assisted mode.
6520
6783
  *
6521
6784
  * @experimental
6522
6785
  */
6523
- autoApproval?: PermissionAutoApproval;
6786
+ assistedApproval?: PermissionAssistedApproval;
6524
6787
  /**
6525
6788
  * Prompt kind discriminator
6526
6789
  */
6527
6790
  kind: "mcp";
6791
+ /**
6792
+ * Advisory runtime permission recommendation. The host remains responsible for deciding the request and may reject it.
6793
+ *
6794
+ * @experimental
6795
+ */
6796
+ permissionRecommendation?: PermissionRecommendation;
6528
6797
  /**
6529
6798
  * Name of the MCP server providing the tool
6530
6799
  */
@@ -6547,11 +6816,11 @@ export interface PermissionPromptRequestMcp {
6547
6816
  */
6548
6817
  export interface PermissionPromptRequestUrl {
6549
6818
  /**
6550
- * Auto-approval judge information for this request; present only when auto mode is enabled.
6819
+ * Assisted-approval judge information for this request; present only in assisted mode.
6551
6820
  *
6552
6821
  * @experimental
6553
6822
  */
6554
- autoApproval?: PermissionAutoApproval;
6823
+ assistedApproval?: PermissionAssistedApproval;
6555
6824
  /**
6556
6825
  * Human-readable description of why the URL is being accessed
6557
6826
  */
@@ -6591,11 +6860,11 @@ export interface PermissionPromptRequestUrl {
6591
6860
  export interface PermissionPromptRequestMemory {
6592
6861
  action?: PermissionRequestMemoryAction;
6593
6862
  /**
6594
- * Auto-approval judge information for this request; present only when auto mode is enabled.
6863
+ * Assisted-approval judge information for this request; present only in assisted mode.
6595
6864
  *
6596
6865
  * @experimental
6597
6866
  */
6598
- autoApproval?: PermissionAutoApproval;
6867
+ assistedApproval?: PermissionAssistedApproval;
6599
6868
  /**
6600
6869
  * Source references for the stored fact (store only)
6601
6870
  */
@@ -6631,11 +6900,11 @@ export interface PermissionPromptRequestCustomTool {
6631
6900
  */
6632
6901
  args?: JsonValue;
6633
6902
  /**
6634
- * Auto-approval judge information for this request; present only when auto mode is enabled.
6903
+ * Assisted-approval judge information for this request; present only in assisted mode.
6635
6904
  *
6636
6905
  * @experimental
6637
6906
  */
6638
- autoApproval?: PermissionAutoApproval;
6907
+ assistedApproval?: PermissionAssistedApproval;
6639
6908
  /**
6640
6909
  * Prompt kind discriminator
6641
6910
  */
@@ -6659,11 +6928,11 @@ export interface PermissionPromptRequestCustomTool {
6659
6928
  export interface PermissionPromptRequestPath {
6660
6929
  accessKind: PermissionPromptRequestPathAccessKind;
6661
6930
  /**
6662
- * Auto-approval judge information for this request; present only when auto mode is enabled.
6931
+ * Assisted-approval judge information for this request; present only in assisted mode.
6663
6932
  *
6664
6933
  * @experimental
6665
6934
  */
6666
- autoApproval?: PermissionAutoApproval;
6935
+ assistedApproval?: PermissionAssistedApproval;
6667
6936
  /**
6668
6937
  * Prompt kind discriminator
6669
6938
  */
@@ -6682,11 +6951,11 @@ export interface PermissionPromptRequestPath {
6682
6951
  */
6683
6952
  export interface PermissionPromptRequestHook {
6684
6953
  /**
6685
- * Auto-approval judge information for this request; present only when auto mode is enabled.
6954
+ * Assisted-approval judge information for this request; present only in assisted mode.
6686
6955
  *
6687
6956
  * @experimental
6688
6957
  */
6689
- autoApproval?: PermissionAutoApproval;
6958
+ assistedApproval?: PermissionAssistedApproval;
6690
6959
  /**
6691
6960
  * Optional message from the hook explaining why confirmation is needed
6692
6961
  */
@@ -6713,11 +6982,11 @@ export interface PermissionPromptRequestHook {
6713
6982
  */
6714
6983
  export interface PermissionPromptRequestExtensionManagement {
6715
6984
  /**
6716
- * Auto-approval judge information for this request; present only when auto mode is enabled.
6985
+ * Assisted-approval judge information for this request; present only in assisted mode.
6717
6986
  *
6718
6987
  * @experimental
6719
6988
  */
6720
- autoApproval?: PermissionAutoApproval;
6989
+ assistedApproval?: PermissionAssistedApproval;
6721
6990
  /**
6722
6991
  * Name of the extension being managed
6723
6992
  */
@@ -6744,18 +7013,30 @@ export interface PermissionPromptRequestFactory {
6744
7013
  */
6745
7014
  approvalKey: string;
6746
7015
  /**
6747
- * Auto-approval judge information for this request; present only when auto mode is enabled.
7016
+ * Assisted-approval judge information for this request; present only in assisted mode.
6748
7017
  *
6749
7018
  * @experimental
6750
7019
  */
6751
- autoApproval?: PermissionAutoApproval;
7020
+ assistedApproval?: PermissionAssistedApproval;
6752
7021
  /**
6753
7022
  * Whether this factory is eligible for persistent approval
6754
7023
  */
6755
7024
  canPersistApproval: boolean;
7025
+ /**
7026
+ * Factory-declared AI-credit limit before any run/resume caller override is applied.
7027
+ */
6756
7028
  declaredMaxAiCredits?: number;
7029
+ /**
7030
+ * Factory-declared concurrent-subagent limit before any run/resume caller override is applied.
7031
+ */
6757
7032
  declaredMaxConcurrentSubagents?: number;
7033
+ /**
7034
+ * Factory-declared total-subagent limit before any run/resume caller override is applied.
7035
+ */
6758
7036
  declaredMaxTotalSubagents?: number;
7037
+ /**
7038
+ * Factory-declared active-time limit in seconds before any run/resume caller override is applied.
7039
+ */
6759
7040
  declaredTimeoutSeconds?: number;
6760
7041
  /**
6761
7042
  * Factory description
@@ -6804,11 +7085,11 @@ export interface PermissionPromptRequestFactory {
6804
7085
  */
6805
7086
  export interface PermissionPromptRequestExtensionPermissionAccess {
6806
7087
  /**
6807
- * Auto-approval judge information for this request; present only when auto mode is enabled.
7088
+ * Assisted-approval judge information for this request; present only in assisted mode.
6808
7089
  *
6809
7090
  * @experimental
6810
7091
  */
6811
- autoApproval?: PermissionAutoApproval;
7092
+ assistedApproval?: PermissionAssistedApproval;
6812
7093
  /**
6813
7094
  * Capabilities the extension is requesting
6814
7095
  */
@@ -6826,6 +7107,35 @@ export interface PermissionPromptRequestExtensionPermissionAccess {
6826
7107
  */
6827
7108
  toolCallId?: string;
6828
7109
  }
7110
+ /**
7111
+ * Extension sensitive environment variable access prompt
7112
+ */
7113
+ export interface PermissionPromptRequestExtensionEnvAccess {
7114
+ /**
7115
+ * Assisted-approval judge information for this request; present only in assisted mode.
7116
+ *
7117
+ * @experimental
7118
+ */
7119
+ assistedApproval?: PermissionAssistedApproval;
7120
+ /**
7121
+ * Names of the sensitive environment variables the extension is requesting. Values never appear here.
7122
+ *
7123
+ * @minItems 1
7124
+ */
7125
+ environmentVariables: [string, ...string[]];
7126
+ /**
7127
+ * Name of the extension requesting environment variable access
7128
+ */
7129
+ extensionName: string;
7130
+ /**
7131
+ * Prompt kind discriminator
7132
+ */
7133
+ kind: "extension-env-access";
7134
+ /**
7135
+ * Tool call ID that triggered this permission request
7136
+ */
7137
+ toolCallId?: string;
7138
+ }
6829
7139
  /**
6830
7140
  * Session event "permission.completed". Permission request completion notification signaling UI dismissal
6831
7141
  */
@@ -6878,6 +7188,10 @@ export interface PermissionApproved {
6878
7188
  * The permission request was approved
6879
7189
  */
6880
7190
  kind: "approved";
7191
+ /**
7192
+ * Whether a managed approval policy already handled this request
7193
+ */
7194
+ managedApprovalHandled?: boolean;
6881
7195
  }
6882
7196
  /**
6883
7197
  * Permission response variant that approves a request and remembers the provided approval for the rest of the session.
@@ -6888,6 +7202,10 @@ export interface PermissionApprovedForSession {
6888
7202
  * Approved and remembered for the rest of the session
6889
7203
  */
6890
7204
  kind: "approved-for-session";
7205
+ /**
7206
+ * Whether a managed approval policy already handled this request
7207
+ */
7208
+ managedApprovalHandled?: boolean;
6891
7209
  }
6892
7210
  /**
6893
7211
  * Session-scoped tool-approval rule for specific shell command identifiers.
@@ -6998,6 +7316,25 @@ export interface UserToolSessionApprovalExtensionPermissionAccess {
6998
7316
  */
6999
7317
  kind: "extension-permission-access";
7000
7318
  }
7319
+ /**
7320
+ * Session-scoped tool-approval rule for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names.
7321
+ */
7322
+ export interface UserToolSessionApprovalExtensionEnvAccess {
7323
+ /**
7324
+ * Names of the sensitive environment variables this approval covers. Values are never persisted.
7325
+ *
7326
+ * @minItems 1
7327
+ */
7328
+ environmentVariables: [string, ...string[]];
7329
+ /**
7330
+ * Extension name
7331
+ */
7332
+ extensionName: string;
7333
+ /**
7334
+ * Extension environment access approval kind
7335
+ */
7336
+ kind: "extension-env-access";
7337
+ }
7001
7338
  /**
7002
7339
  * Permission response variant that approves a request and persists the provided approval to a project location key.
7003
7340
  */
@@ -7011,6 +7348,10 @@ export interface PermissionApprovedForLocation {
7011
7348
  * The location key (git root or cwd) to persist the approval to
7012
7349
  */
7013
7350
  locationKey: string;
7351
+ /**
7352
+ * Whether a managed approval policy already handled this request
7353
+ */
7354
+ managedApprovalHandled?: boolean;
7014
7355
  }
7015
7356
  /**
7016
7357
  * Permission response variant indicating the request was cancelled before use, with an optional reason.
@@ -7727,6 +8068,60 @@ export interface CustomNotificationData {
7727
8068
  export interface CustomNotificationSubject {
7728
8069
  [k: string]: string | undefined;
7729
8070
  }
8071
+ /**
8072
+ * Session event "ui.ephemeral_query". Ordered output and terminal state for a transient query that does not modify conversation history.
8073
+ */
8074
+ /** @experimental */
8075
+ export interface UIEphemeralQueryEvent {
8076
+ /**
8077
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
8078
+ */
8079
+ agentId?: string;
8080
+ data: UIEphemeralQueryData;
8081
+ /**
8082
+ * Always true for events that are transient and not persisted to the session event log on disk.
8083
+ */
8084
+ ephemeral: true;
8085
+ /**
8086
+ * Unique event identifier (UUID v4), generated when the event is emitted
8087
+ */
8088
+ id: string;
8089
+ /**
8090
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
8091
+ */
8092
+ parentId: string | null;
8093
+ /**
8094
+ * ISO 8601 timestamp when the event was created
8095
+ */
8096
+ timestamp: string;
8097
+ /**
8098
+ * Type discriminator. Always "ui.ephemeral_query".
8099
+ */
8100
+ type: "ui.ephemeral_query";
8101
+ }
8102
+ /**
8103
+ * Ordered output and terminal state for a transient query that does not modify conversation history.
8104
+ */
8105
+ /** @experimental */
8106
+ export interface UIEphemeralQueryData {
8107
+ /**
8108
+ * Full response text, present for the `completed` phase.
8109
+ */
8110
+ answer?: string;
8111
+ /**
8112
+ * Ordered text delta, present for the `chunk` phase.
8113
+ */
8114
+ chunk?: string;
8115
+ /**
8116
+ * Model or transport failure message, present for the `failed` phase.
8117
+ */
8118
+ error?: string;
8119
+ phase: UIEphemeralQueryPhase;
8120
+ /**
8121
+ * Runtime-minted query identifier.
8122
+ */
8123
+ requestId: string;
8124
+ }
7730
8125
  /**
7731
8126
  * Session event "external_tool.requested". External tool invocation request for client-side tool execution
7732
8127
  */
@@ -7765,6 +8160,10 @@ export interface ExternalToolRequestedData {
7765
8160
  * Arguments to pass to the external tool
7766
8161
  */
7767
8162
  arguments?: JsonValue;
8163
+ /**
8164
+ * Stable provider identity captured with an extension-owned tool definition; hosts use it to route the request to the same provider that was offered to the model
8165
+ */
8166
+ providerId?: string | null;
7768
8167
  /**
7769
8168
  * Unique identifier for this request; used to respond via session.respondToExternalTool()
7770
8169
  */
@@ -8514,6 +8913,10 @@ export interface ExitPlanModeRequestedData {
8514
8913
  * Available actions the user can take
8515
8914
  */
8516
8915
  actions: ExitPlanModeAction[];
8916
+ /**
8917
+ * Model the session had selected when the plan was authored, when one is known
8918
+ */
8919
+ model?: string;
8517
8920
  /**
8518
8921
  * Full content of the plan file
8519
8922
  */
@@ -8694,7 +9097,117 @@ export interface FactoryRunUpdatedData {
8694
9097
  * Monotonic revision now available for the run.
8695
9098
  */
8696
9099
  revision: number;
9100
+ /**
9101
+ * Factory run identifier.
9102
+ */
9103
+ runId: string;
9104
+ }
9105
+ /**
9106
+ * Session event "factory.run_started". Ephemeral signal that a factory run attempt began executing.
9107
+ */
9108
+ /** @experimental */
9109
+ export interface FactoryRunStartedEvent {
9110
+ /**
9111
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
9112
+ */
9113
+ agentId?: string;
9114
+ data: FactoryRunStartedData;
9115
+ /**
9116
+ * Always true for events that are transient and not persisted to the session event log on disk.
9117
+ */
9118
+ ephemeral: true;
9119
+ /**
9120
+ * Unique event identifier (UUID v4), generated when the event is emitted
9121
+ */
9122
+ id: string;
9123
+ /**
9124
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
9125
+ */
9126
+ parentId: string | null;
9127
+ /**
9128
+ * ISO 8601 timestamp when the event was created
9129
+ */
9130
+ timestamp: string;
9131
+ /**
9132
+ * Type discriminator. Always "factory.run_started".
9133
+ */
9134
+ type: "factory.run_started";
9135
+ }
9136
+ /**
9137
+ * Ephemeral signal that a factory run attempt began executing.
9138
+ */
9139
+ /** @experimental */
9140
+ export interface FactoryRunStartedData {
9141
+ /**
9142
+ * Attempt number this start committed; a resumed run increments it.
9143
+ */
9144
+ attempt: number;
9145
+ /**
9146
+ * Name of the factory this run executes. Low cardinality by construction.
9147
+ */
9148
+ factoryName: string;
9149
+ /**
9150
+ * Identifier of the factory run that started.
9151
+ */
9152
+ runId: string;
9153
+ }
9154
+ /**
9155
+ * Session event "factory.run_settled". Ephemeral signal that a factory run reached a terminal status.
9156
+ */
9157
+ /** @experimental */
9158
+ export interface FactoryRunSettledEvent {
9159
+ /**
9160
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
9161
+ */
9162
+ agentId?: string;
9163
+ data: FactoryRunSettledData;
9164
+ /**
9165
+ * Always true for events that are transient and not persisted to the session event log on disk.
9166
+ */
9167
+ ephemeral: true;
9168
+ /**
9169
+ * Unique event identifier (UUID v4), generated when the event is emitted
9170
+ */
9171
+ id: string;
9172
+ /**
9173
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
9174
+ */
9175
+ parentId: string | null;
9176
+ /**
9177
+ * ISO 8601 timestamp when the event was created
9178
+ */
9179
+ timestamp: string;
9180
+ /**
9181
+ * Type discriminator. Always "factory.run_settled".
9182
+ */
9183
+ type: "factory.run_settled";
9184
+ }
9185
+ /**
9186
+ * Ephemeral signal that a factory run reached a terminal status.
9187
+ */
9188
+ /** @experimental */
9189
+ export interface FactoryRunSettledData {
9190
+ /**
9191
+ * AI credits this run consumed, in nano-AIU.
9192
+ */
9193
+ consumedNanoAiu: number;
9194
+ /**
9195
+ * Subagents this run consumed against its limits.
9196
+ */
9197
+ consumedSubagents: number;
9198
+ /**
9199
+ * Active milliseconds accumulated across every attempt of this run.
9200
+ */
9201
+ elapsedMs: number;
9202
+ /**
9203
+ * Typed failure class recorded on the run, when it failed with one (e.g. `factory_limit_reached`).
9204
+ */
9205
+ failureType?: string;
9206
+ /**
9207
+ * Identifier of the factory run that settled.
9208
+ */
8697
9209
  runId: string;
9210
+ status: FactoryRunSettledStatus;
8698
9211
  }
8699
9212
  /**
8700
9213
  * Session event "session.skills_loaded". Payload of `session.skills_loaded` listing resolved skill metadata.