@github/copilot-sdk 1.0.4 → 1.0.5-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Union of all session event variants emitted by the Copilot CLI runtime.
7
7
  */
8
- export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | ScheduleRearmedEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantUsageEvent | ModelCallFailureEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
8
+ export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | ScheduleRearmedEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | ResponseLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantIdleEvent | AssistantUsageEvent | ModelCallFailureEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | McpHeadersRefreshRequiredEvent | McpHeadersRefreshCompletedEvent | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
9
9
  /**
10
10
  * Hosting platform type of the repository (github or ado)
11
11
  */
@@ -111,9 +111,9 @@ export type UserMessageAgentMode =
111
111
  /** The agent is in shell-focused UI mode. */
112
112
  | "shell";
113
113
  /**
114
- * A user message attachment — a file, directory, code selection, blob, GitHub reference, or extension-supplied context payload
114
+ * A user message attachment — a file, directory, code selection, blob, GitHub reference, GitHub-anchored pointer, or extension-supplied context payload
115
115
  */
116
- export type Attachment = AttachmentFile | AttachmentDirectory | AttachmentSelection | AttachmentGitHubReference | AttachmentBlob | AttachmentExtensionContext;
116
+ export type Attachment = AttachmentFile | AttachmentDirectory | AttachmentSelection | AttachmentGitHubReference | AttachmentGitHubCommit | AttachmentGitHubRelease | AttachmentGitHubActionsJob | AttachmentGitHubRepository | AttachmentGitHubFileDiff | AttachmentGitHubTreeComparison | AttachmentGitHubUrl | AttachmentGitHubFile | AttachmentGitHubSnippet | AttachmentBlob | AttachmentExtensionContext;
117
117
  /**
118
118
  * Why the binary data is absent: it exceeded the inline size limit, or its asset was unavailable
119
119
  */
@@ -132,6 +132,16 @@ export type AttachmentGitHubReferenceType =
132
132
  | "pr"
133
133
  /** GitHub discussion reference. */
134
134
  | "discussion";
135
+ /**
136
+ * How this user message was delivered to the agentic loop, relative to whether the loop was already running. This is the timing axis only; the message's origin (human vs. system/command/schedule/skill/etc.) is carried separately by `source`. A system-injected message has a delivery too — e.g. a background-task notification waking an idle agent is `idle`, the same mechanism as a human starting a fresh turn.
137
+ */
138
+ export type UserMessageDelivery =
139
+ /** Delivered while the loop was idle; starts its own run immediately (a human's fresh turn, or a system notification waking an idle agent). */
140
+ "idle"
141
+ /** Injected into the current in-flight run while the agent was busy (immediate mode). */
142
+ | "steering"
143
+ /** Enqueued while the agent was busy; processed as its own run afterward. */
144
+ | "queued";
135
145
  /**
136
146
  * The system that produced a citation.
137
147
  */
@@ -236,7 +246,7 @@ export type BinaryAssetReferenceType =
236
246
  /**
237
247
  * A content block within a tool result, which may be text, terminal output, image, audio, or a resource
238
248
  */
239
- export type ToolExecutionCompleteContent = ToolExecutionCompleteContentText | ToolExecutionCompleteContentTerminal | ToolExecutionCompleteContentImage | ToolExecutionCompleteContentAudio | ToolExecutionCompleteContentResourceLink | ToolExecutionCompleteContentResource;
249
+ export type ToolExecutionCompleteContent = ToolExecutionCompleteContentText | ToolExecutionCompleteContentTerminal | ToolExecutionCompleteContentShellExit | ToolExecutionCompleteContentImage | ToolExecutionCompleteContentAudio | ToolExecutionCompleteContentResourceLink | ToolExecutionCompleteContentResource;
240
250
  /**
241
251
  * Theme variant this icon is intended for
242
252
  */
@@ -355,6 +365,18 @@ export type ElicitationCompletedAction =
355
365
  | "decline"
356
366
  /** The user dismissed the request. */
357
367
  | "cancel";
368
+ /**
369
+ * Reason the runtime is requesting host-provided MCP OAuth credentials
370
+ */
371
+ export type McpOauthRequestReason =
372
+ /** Initial credentials are required before connecting to the MCP server. */
373
+ "initial"
374
+ /** The current host-provided credential was rejected and a replacement is requested. */
375
+ | "refresh"
376
+ /** The server requires a new host authorization flow before continuing. */
377
+ | "reauth"
378
+ /** The server requires a credential with additional scope or audience. */
379
+ | "upscope";
358
380
  /**
359
381
  * How the pending MCP OAuth request was completed
360
382
  */
@@ -363,6 +385,26 @@ export type McpOauthCompletionOutcome =
363
385
  "token"
364
386
  /** The request completed without an OAuth provider. */
365
387
  | "cancelled";
388
+ /**
389
+ * Why dynamic headers are being requested.
390
+ */
391
+ export type McpHeadersRefreshRequiredReason =
392
+ /** The transport is making its first dynamic header request for this server. */
393
+ "startup"
394
+ /** The previously cached dynamic headers expired. */
395
+ | "ttl-expired"
396
+ /** The server returned 401 and stale dynamic headers were invalidated. */
397
+ | "auth-failed";
398
+ /**
399
+ * How the pending MCP headers refresh request resolved.
400
+ */
401
+ export type McpHeadersRefreshCompletedOutcome =
402
+ /** The host supplied dynamic headers. */
403
+ "headers"
404
+ /** The host responded with no dynamic headers. */
405
+ | "none"
406
+ /** No response arrived within the bounded window. */
407
+ | "timeout";
366
408
  /**
367
409
  * The user's auto-mode-switch choice
368
410
  */
@@ -531,6 +573,7 @@ export interface StartData {
531
573
  * Whether this session supports remote steering via GitHub
532
574
  */
533
575
  remoteSteerable?: boolean;
576
+ responseLimits?: ResponseLimitsConfig;
534
577
  /**
535
578
  * Model selected at session creation time, if any
536
579
  */
@@ -582,6 +625,15 @@ export interface WorkingDirectoryContext {
582
625
  */
583
626
  repositoryHost?: string;
584
627
  }
628
+ /**
629
+ * Optional response limits.
630
+ */
631
+ export interface ResponseLimitsConfig {
632
+ /**
633
+ * Maximum AI Credits allowed while responding to one top-level user message.
634
+ */
635
+ maxAiCredits?: number;
636
+ }
585
637
  /**
586
638
  * Session event "session.resume". Session resume metadata including current context and event count
587
639
  */
@@ -646,6 +698,10 @@ export interface ResumeData {
646
698
  * Whether this session supports remote steering via GitHub
647
699
  */
648
700
  remoteSteerable?: boolean;
701
+ /**
702
+ * Response limits currently configured at resume time; null when no limits are active
703
+ */
704
+ responseLimits?: ResponseLimitsConfig | null;
649
705
  /**
650
706
  * ISO 8601 timestamp when the session was resumed
651
707
  */
@@ -1237,6 +1293,45 @@ export interface ModeChangedData {
1237
1293
  newMode: SessionMode;
1238
1294
  previousMode: SessionMode;
1239
1295
  }
1296
+ /**
1297
+ * Session event "session.response_limits_changed". Response limits update details. Null clears the limits.
1298
+ */
1299
+ export interface ResponseLimitsChangedEvent {
1300
+ /**
1301
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
1302
+ */
1303
+ agentId?: string;
1304
+ data: ResponseLimitsChangedData;
1305
+ /**
1306
+ * When true, the event is transient and not persisted to the session event log on disk
1307
+ */
1308
+ ephemeral?: boolean;
1309
+ /**
1310
+ * Unique event identifier (UUID v4), generated when the event is emitted
1311
+ */
1312
+ id: string;
1313
+ /**
1314
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
1315
+ */
1316
+ parentId: string | null;
1317
+ /**
1318
+ * ISO 8601 timestamp when the event was created
1319
+ */
1320
+ timestamp: string;
1321
+ /**
1322
+ * Type discriminator. Always "session.response_limits_changed".
1323
+ */
1324
+ type: "session.response_limits_changed";
1325
+ }
1326
+ /**
1327
+ * Response limits update details. Null clears the limits.
1328
+ */
1329
+ export interface ResponseLimitsChangedData {
1330
+ /**
1331
+ * Current response limits for the session, or null when no limits are active
1332
+ */
1333
+ responseLimits: ResponseLimitsConfig | null;
1334
+ }
1240
1335
  /**
1241
1336
  * Session event "session.permissions_changed". Permissions change details carrying the aggregate allow-all boolean transition.
1242
1337
  */
@@ -2142,6 +2237,7 @@ export interface UserMessageData {
2142
2237
  * The user's message text as displayed in the timeline
2143
2238
  */
2144
2239
  content: string;
2240
+ delivery?: UserMessageDelivery;
2145
2241
  /**
2146
2242
  * CAPI interaction ID for correlating this user message with its turn
2147
2243
  */
@@ -2321,6 +2417,231 @@ export interface AttachmentGitHubReference {
2321
2417
  */
2322
2418
  url: string;
2323
2419
  }
2420
+ /**
2421
+ * Pointer to a GitHub commit.
2422
+ */
2423
+ export interface AttachmentGitHubCommit {
2424
+ /**
2425
+ * First line of the commit message
2426
+ */
2427
+ message: string;
2428
+ /**
2429
+ * Full commit SHA
2430
+ */
2431
+ oid: string;
2432
+ repo: GitHubRepoRef;
2433
+ /**
2434
+ * Attachment type discriminator
2435
+ */
2436
+ type: "github_commit";
2437
+ /**
2438
+ * URL to the commit on GitHub
2439
+ */
2440
+ url: string;
2441
+ }
2442
+ /**
2443
+ * Pointer to a GitHub repository.
2444
+ */
2445
+ export interface GitHubRepoRef {
2446
+ /**
2447
+ * Numeric GitHub repository id
2448
+ */
2449
+ id?: number;
2450
+ /**
2451
+ * Repository name (without owner)
2452
+ */
2453
+ name: string;
2454
+ /**
2455
+ * Repository owner login (user or organization)
2456
+ */
2457
+ owner: string;
2458
+ }
2459
+ /**
2460
+ * Pointer to a GitHub release.
2461
+ */
2462
+ export interface AttachmentGitHubRelease {
2463
+ /**
2464
+ * Human-readable release name
2465
+ */
2466
+ name: string;
2467
+ repo: GitHubRepoRef;
2468
+ /**
2469
+ * Git tag the release is anchored to
2470
+ */
2471
+ tagName: string;
2472
+ /**
2473
+ * Attachment type discriminator
2474
+ */
2475
+ type: "github_release";
2476
+ /**
2477
+ * URL to the release on GitHub
2478
+ */
2479
+ url: string;
2480
+ }
2481
+ /**
2482
+ * Pointer to a GitHub Actions job.
2483
+ */
2484
+ export interface AttachmentGitHubActionsJob {
2485
+ /**
2486
+ * Terminal conclusion of the job when finished (e.g., success, failure, cancelled). Absent for in-progress jobs.
2487
+ */
2488
+ conclusion?: string;
2489
+ /**
2490
+ * Job id within the workflow run
2491
+ */
2492
+ jobId: number;
2493
+ /**
2494
+ * Display name of the job
2495
+ */
2496
+ jobName: string;
2497
+ repo: GitHubRepoRef;
2498
+ /**
2499
+ * Attachment type discriminator
2500
+ */
2501
+ type: "github_actions_job";
2502
+ /**
2503
+ * URL to the job on GitHub
2504
+ */
2505
+ url: string;
2506
+ /**
2507
+ * Display name of the workflow the job ran in
2508
+ */
2509
+ workflowName: string;
2510
+ }
2511
+ /**
2512
+ * Pointer to a GitHub repository.
2513
+ */
2514
+ export interface AttachmentGitHubRepository {
2515
+ /**
2516
+ * Short description of the repository
2517
+ */
2518
+ description?: string;
2519
+ /**
2520
+ * Git ref this attachment is anchored at (branch, tag, or commit). When absent the default branch is implied.
2521
+ */
2522
+ ref?: string;
2523
+ repo: GitHubRepoRef;
2524
+ /**
2525
+ * Attachment type discriminator
2526
+ */
2527
+ type: "github_repository";
2528
+ /**
2529
+ * URL to the repository on GitHub
2530
+ */
2531
+ url: string;
2532
+ }
2533
+ /**
2534
+ * Pointer to a single-file diff. At least one of `head` and `base` must be present.
2535
+ */
2536
+ export interface AttachmentGitHubFileDiff {
2537
+ base?: AttachmentGitHubFileDiffSide;
2538
+ head?: AttachmentGitHubFileDiffSide;
2539
+ /**
2540
+ * Attachment type discriminator
2541
+ */
2542
+ type: "github_file_diff";
2543
+ /**
2544
+ * URL to the diff on GitHub (e.g., a commit, compare, or PR-file URL)
2545
+ */
2546
+ url: string;
2547
+ }
2548
+ /**
2549
+ * One side of a file diff (head or base)
2550
+ */
2551
+ export interface AttachmentGitHubFileDiffSide {
2552
+ /**
2553
+ * Repository-relative path to the file
2554
+ */
2555
+ path: string;
2556
+ /**
2557
+ * Git ref (branch, tag, or commit SHA) the file is read at
2558
+ */
2559
+ ref: string;
2560
+ repo: GitHubRepoRef;
2561
+ }
2562
+ /**
2563
+ * Pointer to a comparison between two git revisions.
2564
+ */
2565
+ export interface AttachmentGitHubTreeComparison {
2566
+ base: AttachmentGitHubTreeComparisonSide;
2567
+ head: AttachmentGitHubTreeComparisonSide;
2568
+ /**
2569
+ * Attachment type discriminator
2570
+ */
2571
+ type: "github_tree_comparison";
2572
+ /**
2573
+ * URL to the comparison on GitHub
2574
+ */
2575
+ url: string;
2576
+ }
2577
+ /**
2578
+ * One side of a tree comparison (head or base)
2579
+ */
2580
+ export interface AttachmentGitHubTreeComparisonSide {
2581
+ repo: GitHubRepoRef;
2582
+ /**
2583
+ * Git revision (branch, tag, or commit SHA)
2584
+ */
2585
+ revision: string;
2586
+ }
2587
+ /**
2588
+ * Generic GitHub URL reference.
2589
+ */
2590
+ export interface AttachmentGitHubUrl {
2591
+ /**
2592
+ * Attachment type discriminator
2593
+ */
2594
+ type: "github_url";
2595
+ /**
2596
+ * URL to the GitHub resource
2597
+ */
2598
+ url: string;
2599
+ }
2600
+ /**
2601
+ * Pointer to a file in a GitHub repository at a specific ref.
2602
+ */
2603
+ export interface AttachmentGitHubFile {
2604
+ /**
2605
+ * Repository-relative path to the file
2606
+ */
2607
+ path: string;
2608
+ /**
2609
+ * Git ref the file is read at (branch, tag, or commit SHA)
2610
+ */
2611
+ ref: string;
2612
+ repo: GitHubRepoRef;
2613
+ /**
2614
+ * Attachment type discriminator
2615
+ */
2616
+ type: "github_file";
2617
+ /**
2618
+ * URL to the file on GitHub
2619
+ */
2620
+ url: string;
2621
+ }
2622
+ /**
2623
+ * Pointer to a line range inside a file in a GitHub repository.
2624
+ */
2625
+ export interface AttachmentGitHubSnippet {
2626
+ lineRange: AttachmentFileLineRange;
2627
+ /**
2628
+ * Repository-relative path to the file
2629
+ */
2630
+ path: string;
2631
+ /**
2632
+ * Git ref the file is read at (branch, tag, or commit SHA)
2633
+ */
2634
+ ref: string;
2635
+ repo: GitHubRepoRef;
2636
+ /**
2637
+ * Attachment type discriminator
2638
+ */
2639
+ type: "github_snippet";
2640
+ /**
2641
+ * URL to the snippet on GitHub (with line anchor)
2642
+ */
2643
+ url: string;
2644
+ }
2324
2645
  /**
2325
2646
  * Blob attachment with inline base64-encoded data
2326
2647
  */
@@ -3040,6 +3361,45 @@ export interface AssistantTurnEndData {
3040
3361
  */
3041
3362
  turnId: string;
3042
3363
  }
3364
+ /**
3365
+ * Session event "assistant.idle". Payload emitted whenever the main agent's processing loop goes idle, including while related background work (running agents or in-flight attached shell commands) is still pending and the session-level idle event is therefore deferred
3366
+ */
3367
+ export interface AssistantIdleEvent {
3368
+ /**
3369
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3370
+ */
3371
+ agentId?: string;
3372
+ data: AssistantIdleData;
3373
+ /**
3374
+ * Always true for events that are transient and not persisted to the session event log on disk.
3375
+ */
3376
+ ephemeral: true;
3377
+ /**
3378
+ * Unique event identifier (UUID v4), generated when the event is emitted
3379
+ */
3380
+ id: string;
3381
+ /**
3382
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3383
+ */
3384
+ parentId: string | null;
3385
+ /**
3386
+ * ISO 8601 timestamp when the event was created
3387
+ */
3388
+ timestamp: string;
3389
+ /**
3390
+ * Type discriminator. Always "assistant.idle".
3391
+ */
3392
+ type: "assistant.idle";
3393
+ }
3394
+ /**
3395
+ * Payload emitted whenever the main agent's processing loop goes idle, including while related background work (running agents or in-flight attached shell commands) is still pending and the session-level idle event is therefore deferred
3396
+ */
3397
+ export interface AssistantIdleData {
3398
+ /**
3399
+ * True when the preceding agentic loop was cancelled via abort signal
3400
+ */
3401
+ aborted?: boolean;
3402
+ }
3043
3403
  /**
3044
3404
  * Session event "assistant.usage". LLM API call usage metrics including tokens, costs, quotas, and billing information
3045
3405
  */
@@ -3439,6 +3799,7 @@ export interface ToolExecutionStartData {
3439
3799
  * Tool call ID of the parent tool invocation when this event originates from a sub-agent
3440
3800
  */
3441
3801
  parentToolCallId?: string;
3802
+ shellToolInfo?: ToolExecutionStartShellToolInfo;
3442
3803
  /**
3443
3804
  * Unique identifier for this tool call
3444
3805
  */
@@ -3453,6 +3814,19 @@ export interface ToolExecutionStartData {
3453
3814
  */
3454
3815
  turnId?: string;
3455
3816
  }
3817
+ /**
3818
+ * Shell-aware path hints for a shell tool's command, captured at start time so consumers can snapshot a file's pre-image before the tool runs.
3819
+ */
3820
+ export interface ToolExecutionStartShellToolInfo {
3821
+ /**
3822
+ * Whether the command includes a file write redirection (e.g., > or >>).
3823
+ */
3824
+ hasWriteFileRedirection: boolean;
3825
+ /**
3826
+ * File paths the command may read or write, derived from the command at start time. Produced by the same shell-aware extractor as PermissionRequestShell.possiblePaths, so it is present even when the command is auto-approved and no permission request fires.
3827
+ */
3828
+ possiblePaths: string[];
3829
+ }
3456
3830
  /**
3457
3831
  * Tool definition metadata, present for MCP tools with MCP Apps support
3458
3832
  */
@@ -3817,7 +4191,8 @@ export interface ToolExecutionCompleteContentText {
3817
4191
  type: "text";
3818
4192
  }
3819
4193
  /**
3820
- * Terminal/shell output content block with optional exit code and working directory
4194
+ * @deprecated
4195
+ * Deprecated for shell command exit metadata. Use ToolExecutionCompleteContentShellExit instead.
3821
4196
  */
3822
4197
  export interface ToolExecutionCompleteContentTerminal {
3823
4198
  /**
@@ -3837,6 +4212,35 @@ export interface ToolExecutionCompleteContentTerminal {
3837
4212
  */
3838
4213
  type: "terminal";
3839
4214
  }
4215
+ /**
4216
+ * Shell command exit metadata with optional output preview
4217
+ */
4218
+ export interface ToolExecutionCompleteContentShellExit {
4219
+ /**
4220
+ * Working directory where the shell command was executed
4221
+ */
4222
+ cwd?: string;
4223
+ /**
4224
+ * Exit code from the completed shell command
4225
+ */
4226
+ exitCode: number;
4227
+ /**
4228
+ * Output associated with this shell command, if available. May be partial, truncated, or a preview; not guaranteed to be full output.
4229
+ */
4230
+ outputPreview?: string;
4231
+ /**
4232
+ * Whether outputPreview is known to be incomplete or truncated
4233
+ */
4234
+ outputTruncated?: boolean;
4235
+ /**
4236
+ * Shell id, as assigned by Copilot runtime
4237
+ */
4238
+ shellId: string;
4239
+ /**
4240
+ * Content block type discriminator
4241
+ */
4242
+ type: "shell_exit";
4243
+ }
3840
4244
  /**
3841
4245
  * Image content block with base64-encoded data
3842
4246
  */
@@ -6139,6 +6543,7 @@ export interface McpOauthRequiredEvent {
6139
6543
  * OAuth authentication request for an MCP server
6140
6544
  */
6141
6545
  export interface McpOauthRequiredData {
6546
+ reason: McpOauthRequestReason;
6142
6547
  /**
6143
6548
  * Unique identifier for this OAuth request; used to respond via session.mcp.oauth.handlePendingRequest
6144
6549
  */
@@ -6166,6 +6571,10 @@ export interface McpOauthRequiredStaticClientConfig {
6166
6571
  * OAuth client ID for the server
6167
6572
  */
6168
6573
  clientId: string;
6574
+ /**
6575
+ * Optional OAuth client secret for confidential static clients, when the runtime can resolve one
6576
+ */
6577
+ clientSecret?: string;
6169
6578
  /**
6170
6579
  * Optional non-default OAuth grant type. When set to 'client_credentials', the OAuth flow runs headlessly using the client_id + keychain-stored secret (no browser, no callback server).
6171
6580
  */
@@ -6184,9 +6593,9 @@ export interface McpOauthWWWAuthenticateParams {
6184
6593
  */
6185
6594
  error?: string;
6186
6595
  /**
6187
- * Protected resource metadata URL from the WWW-Authenticate resource_metadata parameter
6596
+ * Protected resource metadata URL from the WWW-Authenticate resource_metadata parameter, if present
6188
6597
  */
6189
- resourceMetadataUrl: string;
6598
+ resourceMetadataUrl?: string;
6190
6599
  /**
6191
6600
  * Requested OAuth scopes from the WWW-Authenticate scope parameter, if present
6192
6601
  */
@@ -6232,6 +6641,94 @@ export interface McpOauthCompletedData {
6232
6641
  */
6233
6642
  requestId: string;
6234
6643
  }
6644
+ /**
6645
+ * Session event "mcp.headers_refresh_required". Dynamic headers refresh request for a remote MCP server
6646
+ */
6647
+ export interface McpHeadersRefreshRequiredEvent {
6648
+ /**
6649
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
6650
+ */
6651
+ agentId?: string;
6652
+ data: McpHeadersRefreshRequiredData;
6653
+ /**
6654
+ * Always true for events that are transient and not persisted to the session event log on disk.
6655
+ */
6656
+ ephemeral: true;
6657
+ /**
6658
+ * Unique event identifier (UUID v4), generated when the event is emitted
6659
+ */
6660
+ id: string;
6661
+ /**
6662
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
6663
+ */
6664
+ parentId: string | null;
6665
+ /**
6666
+ * ISO 8601 timestamp when the event was created
6667
+ */
6668
+ timestamp: string;
6669
+ /**
6670
+ * Type discriminator. Always "mcp.headers_refresh_required".
6671
+ */
6672
+ type: "mcp.headers_refresh_required";
6673
+ }
6674
+ /**
6675
+ * Dynamic headers refresh request for a remote MCP server
6676
+ */
6677
+ export interface McpHeadersRefreshRequiredData {
6678
+ reason: McpHeadersRefreshRequiredReason;
6679
+ /**
6680
+ * Unique identifier for this headers refresh request; used to respond via session.mcp.headers.handlePendingHeadersRefreshRequest()
6681
+ */
6682
+ requestId: string;
6683
+ /**
6684
+ * Display name of the remote MCP server requesting headers
6685
+ */
6686
+ serverName: string;
6687
+ /**
6688
+ * URL of the remote MCP server requesting headers
6689
+ */
6690
+ serverUrl: string;
6691
+ }
6692
+ /**
6693
+ * Session event "mcp.headers_refresh_completed". MCP headers refresh request completion notification
6694
+ */
6695
+ export interface McpHeadersRefreshCompletedEvent {
6696
+ /**
6697
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
6698
+ */
6699
+ agentId?: string;
6700
+ data: McpHeadersRefreshCompletedData;
6701
+ /**
6702
+ * Always true for events that are transient and not persisted to the session event log on disk.
6703
+ */
6704
+ ephemeral: true;
6705
+ /**
6706
+ * Unique event identifier (UUID v4), generated when the event is emitted
6707
+ */
6708
+ id: string;
6709
+ /**
6710
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
6711
+ */
6712
+ parentId: string | null;
6713
+ /**
6714
+ * ISO 8601 timestamp when the event was created
6715
+ */
6716
+ timestamp: string;
6717
+ /**
6718
+ * Type discriminator. Always "mcp.headers_refresh_completed".
6719
+ */
6720
+ type: "mcp.headers_refresh_completed";
6721
+ }
6722
+ /**
6723
+ * MCP headers refresh request completion notification
6724
+ */
6725
+ export interface McpHeadersRefreshCompletedData {
6726
+ outcome: McpHeadersRefreshCompletedOutcome;
6727
+ /**
6728
+ * Request ID of the resolved headers refresh request
6729
+ */
6730
+ requestId: string;
6731
+ }
6235
6732
  /**
6236
6733
  * Session event "session.custom_notification". Opaque custom notification data. Consumers may branch on source and name, but payload semantics are source-defined.
6237
6734
  */
package/dist/index.d.ts CHANGED
@@ -10,4 +10,4 @@ export { CopilotSession, type AssistantMessageEvent } from "./session.js";
10
10
  export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasHostContextCapabilities, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js";
11
11
  export { defineTool, approveAll, convertMcpCallToolResult, createSessionFsAdapter, CopilotRequestHandler, CopilotWebSocketHandler, CopilotWebSocketCloseStatus, CopilotWebSocketForwarder, SYSTEM_MESSAGE_SECTIONS, } from "./types.js";
12
12
  export type * from "./generated/session-events.js";
13
- export type { CommandContext, CommandDefinition, CommandHandler, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientMode, CopilotClientOptions, StdioRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, GetBearerToken, MessageOptions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, CapiSessionOptions, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ProviderModelConfig, ProviderTokenArgs, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolTelemetry, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
13
+ export type { CommandContext, CommandDefinition, CommandHandler, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientMode, CopilotClientOptions, StdioRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, BearerTokenProvider, MessageOptions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, CapiSessionOptions, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ProviderModelConfig, ProviderTokenArgs, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolTelemetry, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
package/dist/session.d.ts CHANGED
@@ -41,6 +41,7 @@ export declare class CopilotSession {
41
41
  private bearerTokenProviders;
42
42
  private commandHandlers;
43
43
  private permissionHandler?;
44
+ private mcpAuthHandler?;
44
45
  private userInputHandler?;
45
46
  private elicitationHandler?;
46
47
  private exitPlanModeHandler?;