@github/copilot-sdk 1.0.14 → 1.0.15-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 | AutoTierRecommendationEvent | AutoTierSwitchFailedEvent | ModeChangedEvent | ModeNoticeDeliveredEvent | SessionLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | UsageCheckpointEvent | ContextChangedEvent | UsageInfoEvent | ContextClearedEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | CompletionReceiptEvent | FusionRouteStartedEvent | FusionRouteFailedEvent | FusionResolvedEvent | FusionCompletedEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantFusionPhaseStartedEvent | AssistantFusionPhaseActivityEvent | AssistantFusionPhaseCompletedEvent | AssistantFusionPhaseFailedEvent | AssistantServerToolProgressEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantToolCallDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantIdleEvent | AssistantUsageEvent | ModelCallFailureEvent | ModelCallFinishedEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | ToolSearchActivatedEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentConfiguredEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | PermissionCarriedForwardEvent | PermissionMessageAuthorizationEvent | PermissionMessageAuthorizationReadEvent | PermissionMessageAuthorizationDegradedEvent | PermissionAssentDetectedEvent | PermissionContextualAuthorizationEvent | 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 | McpServerRemovedEvent | McpServerNeedsReconnectEvent | 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 | IndexedSearchEvent | WarningEvent | ModelChangeEvent | AutoTierRecommendationEvent | AutoTierSwitchFailedEvent | ModeChangedEvent | ModeNoticeDeliveredEvent | SessionLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | UsageCheckpointEvent | ContextChangedEvent | UsageInfoEvent | ContextClearedEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | CompletionReceiptEvent | FusionRouteStartedEvent | FusionRouteFailedEvent | FusionResolvedEvent | FusionCompletedEvent | PermissionRecoveryEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantFusionPhaseStartedEvent | AssistantFusionPhaseActivityEvent | AssistantFusionPhaseCompletedEvent | AssistantFusionPhaseFailedEvent | AssistantServerToolProgressEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantToolCallDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantIdleEvent | AssistantUsageEvent | ModelCallFailureEvent | ModelCallFinishedEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | ToolSearchActivatedEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentConfiguredEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | PermissionCarriedForwardEvent | PermissionMessageAuthorizationEvent | PermissionMessageAuthorizationReadEvent | PermissionMessageAuthorizationDegradedEvent | PermissionAssentDetectedEvent | PermissionContextualAuthorizationEvent | 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 | McpServerRemovedEvent | McpServerNeedsReconnectEvent | McpToolsListChangedEvent | McpResourcesListChangedEvent | McpPromptsListChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
13
13
  /**
14
14
  * Routing preference used when the session model is `auto`. `fast` is an integrator-only latency preset and is not a first-party GitHub Copilot product preference.
15
15
  */
@@ -112,6 +112,165 @@ export type AutopilotObjectiveChangedStatus =
112
112
  | "cap_reached"
113
113
  /** Objective was completed by the agent. */
114
114
  | "completed";
115
+ /**
116
+ * Transient indexed-search status and diagnostics from the live runtime service. Never persisted or used to infer activation from session history.
117
+ */
118
+ export type IndexedSearchData = {
119
+ /**
120
+ * Indexed-search event variant discriminator.
121
+ */
122
+ kind: "status";
123
+ state: IndexedSearchState;
124
+ } | {
125
+ disabledReason?: IndexedSearchDisabledReason;
126
+ /**
127
+ * Whether the repository meets the automatic indexing file-count threshold, when known.
128
+ */
129
+ eligible?: boolean;
130
+ /**
131
+ * Startup failure details. May contain sensitive user data; restricted telemetry only.
132
+ */
133
+ errorMessage?: string;
134
+ /**
135
+ * Number of text files counted in the repository.
136
+ */
137
+ fileCount?: number;
138
+ /**
139
+ * Whether indexed search was explicitly enabled through the environment.
140
+ */
141
+ forcedByEnv: boolean;
142
+ /**
143
+ * Indexed-search event variant discriminator.
144
+ */
145
+ kind: "startup";
146
+ outcome: IndexedSearchOutcome;
147
+ /**
148
+ * Wall-clock duration of startup in milliseconds.
149
+ */
150
+ startupDurationMs: number;
151
+ /**
152
+ * Whether waiting for index readiness was requested, including skipped attempts.
153
+ */
154
+ warmStart: boolean;
155
+ } | {
156
+ /**
157
+ * Server failure details. May contain sensitive user data; restricted telemetry only.
158
+ */
159
+ errorMessage?: string;
160
+ errorType: IndexedSearchErrorType;
161
+ /**
162
+ * Process exit code, when available.
163
+ */
164
+ exitCode?: number;
165
+ /**
166
+ * Indexed-search event variant discriminator.
167
+ */
168
+ kind: "server_error";
169
+ } | {
170
+ /**
171
+ * Number of added files.
172
+ */
173
+ addedFileCount?: number;
174
+ /**
175
+ * Number of modified files.
176
+ */
177
+ changedFileCount?: number;
178
+ /**
179
+ * Number of deleted files.
180
+ */
181
+ deletedFileCount?: number;
182
+ /**
183
+ * Indexed-search event variant discriminator.
184
+ */
185
+ kind: "incremental";
186
+ phase: IndexedSearchIncrementalPhase;
187
+ /**
188
+ * Total number of detected changes.
189
+ */
190
+ totalChangeCount?: number;
191
+ /**
192
+ * Total incremental indexing duration in milliseconds.
193
+ */
194
+ totalDurationMs?: number;
195
+ /**
196
+ * Index update duration in milliseconds.
197
+ */
198
+ updateDurationMs?: number;
199
+ /**
200
+ * Workspace scan duration in milliseconds.
201
+ */
202
+ walkDurationMs?: number;
203
+ };
204
+ /**
205
+ * Live indexed-search state for this session activation, never inferred from persisted history.
206
+ */
207
+ export type IndexedSearchState =
208
+ /** Indexed search is not active for this session. */
209
+ "disabled"
210
+ /** Indexed-search startup is in progress. */
211
+ | "starting"
212
+ /** The indexed-search server started successfully; its index may still be warming. */
213
+ | "enabled"
214
+ /** The indexed-search server and its index are ready. */
215
+ | "ready"
216
+ /** Indexed-search startup or the active server failed. */
217
+ | "failed";
218
+ /**
219
+ * Configuration, policy, or workspace condition that disabled indexed search.
220
+ */
221
+ export type IndexedSearchDisabledReason =
222
+ /** Indexed search was explicitly disabled by the environment. */
223
+ "use_tgrep_false"
224
+ /** Search uses the external ripgrep binary instead of bundled search. */
225
+ | "use_builtin_ripgrep_false"
226
+ /** Organization policy disables indexed search. */
227
+ | "organization"
228
+ /** Authentication has not resolved organization policy. */
229
+ | "organization_policy_auth_pending"
230
+ /** Organization policy could not be determined. */
231
+ | "organization_policy_unknown"
232
+ /** The workspace uses a virtualized or network filesystem. */
233
+ | "virtual_filesystem"
234
+ /** The workspace is inside a Windows cloud-sync root. */
235
+ | "cloud_sync_root"
236
+ /** The Windows cloud-sync safety check failed. */
237
+ | "cloud_sync_detection_failed"
238
+ /** The workspace is not available on the runtime's local filesystem. */
239
+ | "workspace_not_local";
240
+ /**
241
+ * Result of an indexed-search startup attempt.
242
+ */
243
+ export type IndexedSearchOutcome =
244
+ /** A new indexed-search server was started. */
245
+ "started"
246
+ /** The repository has too few files for automatic indexing. */
247
+ | "skipped_below_threshold"
248
+ /** No Git repository was found and indexing was not forced. */
249
+ | "skipped_no_gitroot"
250
+ /** Configuration, policy, or workspace safety disabled indexing. */
251
+ | "skipped_disabled"
252
+ /** An existing indexed-search server was reused. */
253
+ | "reused_existing"
254
+ /** The startup attempt failed. */
255
+ | "failed";
256
+ /**
257
+ * Category of an indexed-search server failure.
258
+ */
259
+ export type IndexedSearchErrorType =
260
+ /** The indexed-search server could not be spawned. */
261
+ "spawn_error"
262
+ /** The indexed-search server exited unexpectedly. */
263
+ | "unexpected_exit"
264
+ /** The indexed-search server was terminated by a signal. */
265
+ | "killed_by_signal";
266
+ /**
267
+ * Phase of an incremental indexed-search update.
268
+ */
269
+ export type IndexedSearchIncrementalPhase =
270
+ /** A workspace scan found changes to index. */
271
+ "changes_detected"
272
+ /** The incremental index update completed. */
273
+ | "updated";
115
274
  /**
116
275
  * Origin of an effective session model change.
117
276
  */
@@ -136,6 +295,8 @@ export type ModelChangeSource =
136
295
  | "plan_mode"
137
296
  /** The runtime selected the model automatically, such as rate-limit recovery or refusal fallback. */
138
297
  | "automatic"
298
+ /** The user selected the promoted model from the changeboarding card or its keyboard shortcut. */
299
+ | "changeboarding_shortcut"
139
300
  /** An SDK or RPC caller selected the model. */
140
301
  | "sdk";
141
302
  /**
@@ -219,6 +380,94 @@ export type CompactionTrigger =
219
380
  | "memory_pressure"
220
381
  /** Compaction requested while switching to a model with a smaller context window. */
221
382
  | "model_switch";
383
+ /**
384
+ * Category of structured task blocker
385
+ */
386
+ export type TaskBlockerKind =
387
+ /** Autopilot permission recovery requires intervention or has no safe autonomous path. */
388
+ "permission_recovery";
389
+ /**
390
+ * Runtime handling applied to a recovery attempt
391
+ */
392
+ export type PermissionRecoveryAttemptDisposition =
393
+ /** The request was denied without prompting so the agent could try an alternative. */
394
+ "deferred"
395
+ /** The request was surfaced to an interactive responder. */
396
+ | "prompted"
397
+ /** The interactive responder approved the request. */
398
+ | "approved"
399
+ /** The interactive responder denied the request or became unavailable. */
400
+ | "denied"
401
+ /** The request exhausted unattended recovery and produced a blocked outcome. */
402
+ | "blocked"
403
+ /** A tool call succeeded as an equivalent alternative. */
404
+ | "succeeded";
405
+ /**
406
+ * Controlled reason for an individual attempt disposition
407
+ */
408
+ export type PermissionRecoveryAttemptReason =
409
+ /** The attempt required permission that Assisted Permissions could not grant. */
410
+ "permission_required"
411
+ /** The request repeated an earlier attempt. */
412
+ | "repeated_attempt"
413
+ /** The request exceeded the bounded number of distinct attempts. */
414
+ | "attempts_exhausted"
415
+ /** The interactive responder approved the request. */
416
+ | "permission_approved"
417
+ /** The interactive responder denied the request. */
418
+ | "permission_denied"
419
+ /** The interactive responder became unavailable. */
420
+ | "responder_unavailable"
421
+ /** The tool call succeeded without the blocked permission. */
422
+ | "equivalent_alternative_succeeded";
423
+ /**
424
+ * Relationship of an attempt to earlier permission requests
425
+ */
426
+ export type PermissionRecoveryAttemptRelation =
427
+ /** The first denied permission request in the episode. */
428
+ "initial"
429
+ /** A request equivalent to an earlier attempt. */
430
+ | "retry"
431
+ /** A distinct request or a successful alternative tool call. */
432
+ | "alternative";
433
+ /**
434
+ * Action selected when autonomous recovery cannot continue
435
+ */
436
+ export type PermissionRecoveryOnBlocked =
437
+ /** Surface the existing permission prompt to a response-capable client. */
438
+ "ask"
439
+ /** Return a structured unsuccessful blocked outcome because no responder is available. */
440
+ | "fail";
441
+ /**
442
+ * Controlled reason for a permission-recovery episode transition
443
+ */
444
+ export type PermissionRecoveryReason =
445
+ /** An action required permission that Assisted Permissions could not grant. */
446
+ "permission_required"
447
+ /** The agent repeated an equivalent permission request instead of making progress. */
448
+ | "repeated_attempt"
449
+ /** The bounded number of distinct permission attempts was exhausted. */
450
+ | "attempts_exhausted"
451
+ /** A responder approved the escalated permission request. */
452
+ | "permission_approved"
453
+ /** A responder denied the escalated permission request. */
454
+ | "permission_denied"
455
+ /** The response-capable client became unavailable while escalation was pending. */
456
+ | "responder_unavailable"
457
+ /** A later tool call succeeded without requiring the blocked permission. */
458
+ | "equivalent_alternative_succeeded";
459
+ /**
460
+ * Lifecycle state of a permission-recovery episode
461
+ */
462
+ export type PermissionRecoveryStatus =
463
+ /** Autopilot may try a bounded equivalent alternative. */
464
+ "recovering"
465
+ /** An interactive permission response is required. */
466
+ | "awaiting_approval"
467
+ /** The episode ended through approval or a successful equivalent alternative. */
468
+ | "resolved"
469
+ /** No autonomous path remains and the task requires intervention. */
470
+ | "blocked";
222
471
  /**
223
472
  * Semantic result of evaluating a task completion request
224
473
  */
@@ -1706,6 +1955,36 @@ export interface InfoData {
1706
1955
  */
1707
1956
  url?: string;
1708
1957
  }
1958
+ /**
1959
+ * Session event "session.indexed_search". Transient indexed-search status and diagnostics from the live runtime service. Never persisted or used to infer activation from session history.
1960
+ */
1961
+ export interface IndexedSearchEvent {
1962
+ /**
1963
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
1964
+ */
1965
+ agentId?: string;
1966
+ data: IndexedSearchData;
1967
+ /**
1968
+ * Always true for events that are transient and not persisted to the session event log on disk.
1969
+ */
1970
+ ephemeral: true;
1971
+ /**
1972
+ * Unique event identifier (UUID v4), generated when the event is emitted
1973
+ */
1974
+ id: string;
1975
+ /**
1976
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
1977
+ */
1978
+ parentId: string | null;
1979
+ /**
1980
+ * ISO 8601 timestamp when the event was created
1981
+ */
1982
+ timestamp: string;
1983
+ /**
1984
+ * Type discriminator. Always "session.indexed_search".
1985
+ */
1986
+ type: "session.indexed_search";
1987
+ }
1709
1988
  /**
1710
1989
  * Session event "session.warning". Warning message for timeline display with categorization
1711
1990
  */
@@ -2902,6 +3181,7 @@ export interface CompactionCompleteData {
2902
3181
  * GitHub request tracing ID (x-github-request-id header) for the compaction LLM call
2903
3182
  */
2904
3183
  requestId?: string;
3184
+ responsesReasoning?: ResponsesReasoning;
2905
3185
  /**
2906
3186
  * Copilot service request ID (x-copilot-service-request-id header) for the compaction LLM call
2907
3187
  */
@@ -2990,6 +3270,23 @@ export interface CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail {
2990
3270
  */
2991
3271
  tokenType: string;
2992
3272
  }
3273
+ /**
3274
+ * Original request-level and effective conversation reasoning effort for a Responses history boundary
3275
+ */
3276
+ export interface ResponsesReasoning {
3277
+ /**
3278
+ * Effective effort selected before this message, independent of the response-level reasoning field
3279
+ */
3280
+ effort: string;
3281
+ /**
3282
+ * Original request-level effort, retained while replaying this conversation prefix
3283
+ */
3284
+ initialEffort: string;
3285
+ /**
3286
+ * Provider model whose reasoning settings this boundary records
3287
+ */
3288
+ model: string;
3289
+ }
2993
3290
  /**
2994
3291
  * Session event "session.task_complete". Task completion notification with summary from the agent
2995
3292
  */
@@ -3024,6 +3321,7 @@ export interface TaskCompleteEvent {
3024
3321
  * Task completion notification with summary from the agent
3025
3322
  */
3026
3323
  export interface TaskCompleteData {
3324
+ blocker?: TaskBlocker;
3027
3325
  /**
3028
3326
  * Active autopilot objective ID evaluated by the completion reviewer
3029
3327
  */
@@ -3042,6 +3340,64 @@ export interface TaskCompleteData {
3042
3340
  */
3043
3341
  summary?: string;
3044
3342
  }
3343
+ /**
3344
+ * Structured reason that the task cannot continue without intervention
3345
+ */
3346
+ /** @experimental */
3347
+ export interface TaskBlocker {
3348
+ kind: TaskBlockerKind;
3349
+ permissionRecovery: PermissionRecoveryData;
3350
+ reason: PermissionRecoveryReason;
3351
+ /**
3352
+ * Whether a later user response or steering message can resume the task
3353
+ */
3354
+ resumable: boolean;
3355
+ }
3356
+ /**
3357
+ * Authoritative snapshot of an Autopilot permission-recovery episode
3358
+ */
3359
+ export interface PermissionRecoveryData {
3360
+ /**
3361
+ * Ordered privacy-safe record of permission attempts and the successful alternative, when any
3362
+ */
3363
+ attempts: PermissionRecoveryAttempt[];
3364
+ /**
3365
+ * Stable identifier shared by every transition in this recovery episode
3366
+ */
3367
+ episodeId: string;
3368
+ /**
3369
+ * Maximum number of distinct autonomous permission attempts allowed before escalation
3370
+ */
3371
+ maxAttempts: number;
3372
+ onBlocked: PermissionRecoveryOnBlocked;
3373
+ reason: PermissionRecoveryReason;
3374
+ status: PermissionRecoveryStatus;
3375
+ }
3376
+ export interface PermissionRecoveryAttempt {
3377
+ /**
3378
+ * Unique identifier for this attempt record
3379
+ */
3380
+ attemptId: string;
3381
+ disposition: PermissionRecoveryAttemptDisposition;
3382
+ /**
3383
+ * One-based position of this attempt in the episode
3384
+ */
3385
+ ordinal: number;
3386
+ /**
3387
+ * Controlled permission request kind, such as shell, path, URL, or tool
3388
+ */
3389
+ permissionKind: string;
3390
+ reason: PermissionRecoveryAttemptReason;
3391
+ relation: PermissionRecoveryAttemptRelation;
3392
+ /**
3393
+ * SHA-256 fingerprint of normalized request data; raw permission arguments are not included
3394
+ */
3395
+ requestFingerprint: string;
3396
+ /**
3397
+ * Tool-call identifier associated with this attempt, when available
3398
+ */
3399
+ toolCallId?: string;
3400
+ }
3045
3401
  /**
3046
3402
  * Session event "session.completion_receipt". Behavior-neutral record of structured runtime facts present when an agent completion decision is accepted.
3047
3403
  */
@@ -3514,6 +3870,36 @@ export interface FusionCompletedData {
3514
3870
  */
3515
3871
  turnId: string;
3516
3872
  }
3873
+ /**
3874
+ * Session event "session.permission_recovery". Authoritative snapshot of an Autopilot permission-recovery episode
3875
+ */
3876
+ export interface PermissionRecoveryEvent {
3877
+ /**
3878
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3879
+ */
3880
+ agentId?: string;
3881
+ data: PermissionRecoveryData;
3882
+ /**
3883
+ * When true, the event is transient and not persisted to the session event log on disk
3884
+ */
3885
+ ephemeral?: boolean;
3886
+ /**
3887
+ * Unique event identifier (UUID v4), generated when the event is emitted
3888
+ */
3889
+ id: string;
3890
+ /**
3891
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3892
+ */
3893
+ parentId: string | null;
3894
+ /**
3895
+ * ISO 8601 timestamp when the event was created
3896
+ */
3897
+ timestamp: string;
3898
+ /**
3899
+ * Type discriminator. Always "session.permission_recovery".
3900
+ */
3901
+ type: "session.permission_recovery";
3902
+ }
3517
3903
  /**
3518
3904
  * Session event "user.message". Payload of `user.message` with displayed and model-transformed content, attachments, source/delivery metadata, mode, and telemetry IDs.
3519
3905
  */
@@ -3578,6 +3964,7 @@ export interface UserMessageData {
3578
3964
  * Parent agent task ID for background telemetry correlated to this user turn
3579
3965
  */
3580
3966
  parentAgentTaskId?: string;
3967
+ responsesReasoning?: ResponsesReasoning;
3581
3968
  /**
3582
3969
  * Origin of this message, used for timeline filtering and attribution (e.g., `skill-pdf` for hidden skill injection or `agent-<agent-id>` for an inter-agent prompt)
3583
3970
  */
@@ -6640,6 +7027,10 @@ export interface SkillInvokedData {
6640
7027
  * Whether model invocation is disabled for this skill
6641
7028
  */
6642
7029
  disableModelInvocation?: boolean;
7030
+ /**
7031
+ * Projected chat-message count when the skill was invoked. New writers persist this so replay does not need to reconstruct superseded history; readers derive it for legacy events when absent.
7032
+ */
7033
+ invokedAtTurn?: number;
6643
7034
  /**
6644
7035
  * Model identifier active when the skill was invoked, when known
6645
7036
  */
@@ -7393,6 +7784,7 @@ export interface SystemNotificationData {
7393
7784
  */
7394
7785
  content: string;
7395
7786
  kind: SystemNotification;
7787
+ responsesReasoning?: ResponsesReasoning;
7396
7788
  }
7397
7789
  /**
7398
7790
  * System notification metadata for a background agent that completed or failed, including agent ID, type, status, description, and prompt.
@@ -7632,8 +8024,13 @@ export interface PermissionRequestedEvent {
7632
8024
  */
7633
8025
  export interface PermissionRequestedData {
7634
8026
  agentMode?: SessionMode;
8027
+ permissionMode?: PermissionMode;
7635
8028
  permissionRequest: PermissionRequest;
7636
8029
  promptRequest?: PermissionPromptRequest;
8030
+ /**
8031
+ * Permission-recovery episode that authorized this request to surface for interactive attention
8032
+ */
8033
+ recoveryEpisodeId?: string;
7637
8034
  /**
7638
8035
  * Unique identifier for this permission request; used to respond via session.respondToPermission()
7639
8036
  */
@@ -7974,6 +8371,7 @@ export interface PermissionRequestMemory {
7974
8371
  */
7975
8372
  /** @experimental */
7976
8373
  export interface PermissionAssistedApproval {
8374
+ evaluation?: PermissionApprovalEvaluation;
7977
8375
  failureReason?: AssistedApprovalJudgeFailureReason;
7978
8376
  /**
7979
8377
  * 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.
@@ -7985,6 +8383,95 @@ export interface PermissionAssistedApproval {
7985
8383
  reason?: string;
7986
8384
  recommendation: AssistedApprovalRecommendation;
7987
8385
  }
8386
+ /**
8387
+ * Bounded runtime attribution, independent of free-text rationale. Telemetry revalidates this vocabulary before standard collection.
8388
+ */
8389
+ export interface PermissionApprovalEvaluation {
8390
+ /**
8391
+ * Stage that produced this attribution.
8392
+ */
8393
+ evaluationStage: "unknown"
8394
+ /** The request resolved before assisted-approval evaluation. */
8395
+ | "not_reached"
8396
+ /** A runtime gate skipped the judge. */
8397
+ | "pre_judge"
8398
+ /** The judge interface produced the evaluation. */
8399
+ | "judge"
8400
+ /** A cached recommendation or another request's outcome was reused. */
8401
+ | "reuse";
8402
+ /**
8403
+ * Whether the request invoked the judge interface. A cached recommendation retains the original attempt fact. Omitted means unknown, including inherited outcomes.
8404
+ */
8405
+ judgeAttempted?: boolean;
8406
+ /**
8407
+ * Status of the local judge interface, not proof of a model network call.
8408
+ */
8409
+ judgeStatus: "unknown"
8410
+ /** This evaluation did not invoke the judge interface. */
8411
+ | "not_called"
8412
+ /** The judge interface returned a usable verdict. */
8413
+ | "completed"
8414
+ /** The judge interface returned an error. */
8415
+ | "failed"
8416
+ /** This evaluation reused a cached recommendation. */
8417
+ | "cached"
8418
+ /** This request inherited another decision without local judge attribution. */
8419
+ | "inherited";
8420
+ /**
8421
+ * Machine-readable runtime gate reason, never a command, path or human rationale.
8422
+ */
8423
+ reasonCode: "unknown"
8424
+ /** The request resolved before assisted-approval evaluation. */
8425
+ | "not-reached"
8426
+ /** Assisted approval was inactive for this request. */
8427
+ | "inactive"
8428
+ /** The judge was skipped because authorization extraction could not safely establish a complete recent history. */
8429
+ | "authorization-history-incomplete"
8430
+ /** Managed policy required a human decision. */
8431
+ | "managed-approval-required"
8432
+ /** The request asked to bypass sandbox restrictions. */
8433
+ | "sandbox-bypass"
8434
+ /** An action field exceeded the judge input limit. */
8435
+ | "action-too-long"
8436
+ /** The script path was not authorized for inspection. */
8437
+ | "path-not-authorized"
8438
+ /** The script working directory was invalid. */
8439
+ | "invalid-working-directory"
8440
+ /** The script snapshot could not be read. */
8441
+ | "unreadable"
8442
+ /** The script path was not a regular file. */
8443
+ | "not-regular-file"
8444
+ /** The script snapshot exceeded the size limit. */
8445
+ | "too-large"
8446
+ /** The script snapshot was not UTF-8. */
8447
+ | "non-utf8"
8448
+ /** The script interpreter could not be inspected. */
8449
+ | "interpreter-unavailable"
8450
+ /** The interpreter snapshot exceeded the size limit. */
8451
+ | "interpreter-too-large"
8452
+ /** The shell environment could not be reviewed. */
8453
+ | "shell-environment-unreviewable"
8454
+ /** A script path could not be represented for review. */
8455
+ | "unrepresentable-path"
8456
+ /** An interpreter wrapped a script that could not be reviewed. */
8457
+ | "interpreter-wrapped-script"
8458
+ /** The script invocation could not be reviewed. */
8459
+ | "unreviewable-script-invocation"
8460
+ /** The script argument binding could not be reviewed. */
8461
+ | "argument-binding-unreviewable"
8462
+ /** The script review metadata was malformed. */
8463
+ | "malformed-script-action-review"
8464
+ /** The script snapshot manifest was malformed. */
8465
+ | "malformed-script-action-manifest"
8466
+ /** Script review was unavailable. */
8467
+ | "unavailable"
8468
+ /** The judge interface returned a usable verdict. */
8469
+ | "judge-verdict"
8470
+ /** The judge interface returned an error. */
8471
+ | "judge-error"
8472
+ /** The request inherited an outcome from another decision. */
8473
+ | "inherited";
8474
+ }
7988
8475
  /**
7989
8476
  * Custom tool invocation permission request
7990
8477
  */
@@ -8728,12 +9215,17 @@ export interface PermissionCompletedEvent {
8728
9215
  * Permission request completion notification signaling UI dismissal
8729
9216
  */
8730
9217
  export interface PermissionCompletedData {
9218
+ blocker?: TaskBlocker;
8731
9219
  /**
8732
9220
  * Who decided this permission request. Absent on completions recorded before this field existed, which consumers must treat as "not a human decision" rather than assuming one. Authorization records are minted only for `human_response`; an assisted-approval verdict, a host policy, an unattended fallback, and a hook resolution all produce the same `result` a person does, so this is the only field that distinguishes them.
8733
9221
  *
8734
9222
  * @experimental
8735
9223
  */
8736
9224
  decisionSource?: PermissionDecisionSource;
9225
+ /**
9226
+ * Permission-recovery episode settled by this response, when the request was escalated by Autopilot
9227
+ */
9228
+ recoveryEpisodeId?: string;
8737
9229
  /**
8738
9230
  * Request ID of the resolved permission request; clients should dismiss any UI for this request
8739
9231
  */
package/dist/index.d.ts CHANGED
@@ -11,5 +11,5 @@ export { defineFactory, FactoryResumeError, isFactoryRunTerminal } from "./facto
11
11
  export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasHostContextCapabilities, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js";
12
12
  export { defineTool, approveAll, createAttributedPermissionResult, convertMcpCallToolResult, createSessionFsAdapter, CopilotRequestHandler, CopilotWebSocketHandler, CopilotWebSocketCloseStatus, CopilotWebSocketForwarder, SessionFsSqliteTransactionFailure, SYSTEM_MESSAGE_SECTIONS, } from "./types.js";
13
13
  export type * from "./generated/session-events.js";
14
- export type { AskUserVariant, CommandContext, CommandDefinition, CommandHandler, CanvasProviderIdentity, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, AgentStopHandler, AgentStopHookInput, AgentStopHookOutput, UserPromptTransformedHandler, UserPromptTransformedHookInput, UserPromptTransformedHookOutput, CopilotClientInfo, CopilotClientMode, CopilotClientOptions, CopilotExpAssignmentResponse, StdioRuntimeConnection, InProcessRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, ChildProcessRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExpConfigEntry, ExpFlagValue, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, GitHubMcpToolConfig, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, GitHubTokenAcquireReason, GitHubTokenAcquireResult, GitHubTokenProvider, GitHubTokenProviderArgs, GitHubTokenProviderResult, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, FactoryLimits, FactoryMeta, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, BearerTokenProvider, MessageOptions, MessageSource, ManagedSettings, ManagedSettingsPermissions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, AutoTier, CapiSessionOptions, CurrentModel, ModelSwitchAutoTierResult, ModelSwitchAutoTierStatus, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestedData, PermissionRequestedEvent, PermissionRequestResult, AttributedPermissionResult, PermissionDecisionContext, PermissionDecisionOutcome, PermissionDecisionSource, PermissionDecisionSurface, PermissionResponseCapability, ProviderConfig, ProviderModelConfig, ProviderTokenArgs, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionHooks, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, SessionFsSqliteStatement, SessionFsSqliteTransactionErrorClass, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, CurrentToolMetadata, ToolTelemetry, ToolResultObject, ToolSearchConfig, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
14
+ export type { AskUserVariant, CommandContext, CommandDefinition, CommandHandler, CanvasProviderIdentity, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, AgentStopHandler, AgentStopHookInput, AgentStopHookOutput, UserPromptTransformedHandler, UserPromptTransformedHookInput, UserPromptTransformedHookOutput, CopilotClientInfo, CopilotClientMode, CopilotClientOptions, CopilotExpAssignmentResponse, StdioRuntimeConnection, InProcessRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, ChildProcessRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExpConfigEntry, ExpFlagValue, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionLaunchProfile, ExtensionLaunchProvider, ExtensionLaunchProviderResolveRequest, ExtensionLaunchProviderResolveResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, GitHubMcpToolConfig, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, GitHubTokenAcquireReason, GitHubTokenAcquireResult, GitHubTokenProvider, GitHubTokenProviderArgs, GitHubTokenProviderResult, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, FactoryLimits, FactoryMeta, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, BearerTokenProvider, ExtensionContextAttachment, MessageOptions, ResponseSchema, MessageSource, ManagedSettings, ManagedSettingsPermissions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, AutoTier, CapiSessionOptions, CurrentModel, ModelSwitchAutoTierResult, ModelSwitchAutoTierStatus, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestedData, PermissionRequestedEvent, PermissionRequestResult, AttributedPermissionResult, PermissionDecisionContext, PermissionDecisionOutcome, PermissionDecisionSource, PermissionDecisionSurface, PermissionResponseCapability, ProviderConfig, ProviderModelConfig, ProviderTokenArgs, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionHooks, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, SessionFsSqliteStatement, SessionFsSqliteTransactionErrorClass, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, CurrentToolMetadata, ToolTelemetry, ToolResultObject, ToolSearchConfig, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
15
15
  export type { RunOptions, ResumeOptions, FactoryLimitOverrides, FactoryResumeErrorCode, SessionFactoryApi, FactoryAgentOptions, FactoryContext, FactoryDefinition, FactoryHandle, FactoryJsonSchema, JsonValue, FactoryPipelineStage, FactoryStepOptions, FactoryRunResult, FactoryRunStatus, FactoryRunSummary, FactoryListRunsOptions, FactoryRunsPage, FactoryRunDetail, FactoryProgressPage, FactoryProgressLine, FactoryPhaseObservation, FactoryPhaseStatus, FactoryAgentSummary, } from "./factory.js";
@@ -0,0 +1,4 @@
1
+ import type { ResponseSchema, ZodSchema } from "./types.js";
2
+ export declare function isZodSchema(value: unknown): value is ZodSchema;
3
+ export declare function toJsonSchema(schema: ZodSchema | Record<string, unknown> | undefined): Record<string, unknown> | undefined;
4
+ export declare function isResponseSchema(value: unknown): value is ResponseSchema;
package/dist/schema.js ADDED
@@ -0,0 +1,14 @@
1
+ function isZodSchema(value) {
2
+ return typeof value === "object" && value !== null && "toJSONSchema" in value && typeof value.toJSONSchema === "function";
3
+ }
4
+ function toJsonSchema(schema) {
5
+ return isZodSchema(schema) ? schema.toJSONSchema() : schema;
6
+ }
7
+ function isResponseSchema(value) {
8
+ return isZodSchema(value) && "parse" in value && typeof value.parse === "function";
9
+ }
10
+ export {
11
+ isResponseSchema,
12
+ isZodSchema,
13
+ toJsonSchema
14
+ };