@github/copilot-sdk 1.0.4 → 1.0.5-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.
- package/dist/cjs/client.js +7 -7
- package/dist/cjs/generated/rpc.js +15 -4
- package/dist/cjs/session.js +3 -2
- package/dist/client.js +7 -7
- package/dist/generated/rpc.d.ts +371 -9
- package/dist/generated/rpc.js +15 -4
- package/dist/generated/session-events.d.ts +437 -5
- package/dist/index.d.ts +1 -1
- package/dist/session.js +3 -2
- package/dist/types.d.ts +20 -9
- package/package.json +2 -2
|
@@ -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 | 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
|
*/
|
|
@@ -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
|
+
responseBudget?: ResponseBudgetConfig;
|
|
534
577
|
/**
|
|
535
578
|
* Model selected at session creation time, if any
|
|
536
579
|
*/
|
|
@@ -582,6 +625,19 @@ export interface WorkingDirectoryContext {
|
|
|
582
625
|
*/
|
|
583
626
|
repositoryHost?: string;
|
|
584
627
|
}
|
|
628
|
+
/**
|
|
629
|
+
* Optional response budget limits.
|
|
630
|
+
*/
|
|
631
|
+
export interface ResponseBudgetConfig {
|
|
632
|
+
/**
|
|
633
|
+
* Maximum AI Credits allowed while responding to one top-level user message.
|
|
634
|
+
*/
|
|
635
|
+
maxAiCredits?: number;
|
|
636
|
+
/**
|
|
637
|
+
* Maximum model-call iterations allowed while responding to one top-level user message.
|
|
638
|
+
*/
|
|
639
|
+
maxModelIterations?: number;
|
|
640
|
+
}
|
|
585
641
|
/**
|
|
586
642
|
* Session event "session.resume". Session resume metadata including current context and event count
|
|
587
643
|
*/
|
|
@@ -646,6 +702,10 @@ export interface ResumeData {
|
|
|
646
702
|
* Whether this session supports remote steering via GitHub
|
|
647
703
|
*/
|
|
648
704
|
remoteSteerable?: boolean;
|
|
705
|
+
/**
|
|
706
|
+
* Response budget limits currently configured at resume time; null when no budget is active
|
|
707
|
+
*/
|
|
708
|
+
responseBudget?: ResponseBudgetConfig | null;
|
|
649
709
|
/**
|
|
650
710
|
* ISO 8601 timestamp when the session was resumed
|
|
651
711
|
*/
|
|
@@ -2142,6 +2202,7 @@ export interface UserMessageData {
|
|
|
2142
2202
|
* The user's message text as displayed in the timeline
|
|
2143
2203
|
*/
|
|
2144
2204
|
content: string;
|
|
2205
|
+
delivery?: UserMessageDelivery;
|
|
2145
2206
|
/**
|
|
2146
2207
|
* CAPI interaction ID for correlating this user message with its turn
|
|
2147
2208
|
*/
|
|
@@ -2321,6 +2382,231 @@ export interface AttachmentGitHubReference {
|
|
|
2321
2382
|
*/
|
|
2322
2383
|
url: string;
|
|
2323
2384
|
}
|
|
2385
|
+
/**
|
|
2386
|
+
* Pointer to a GitHub commit.
|
|
2387
|
+
*/
|
|
2388
|
+
export interface AttachmentGitHubCommit {
|
|
2389
|
+
/**
|
|
2390
|
+
* First line of the commit message
|
|
2391
|
+
*/
|
|
2392
|
+
message: string;
|
|
2393
|
+
/**
|
|
2394
|
+
* Full commit SHA
|
|
2395
|
+
*/
|
|
2396
|
+
oid: string;
|
|
2397
|
+
repo: GitHubRepoRef;
|
|
2398
|
+
/**
|
|
2399
|
+
* Attachment type discriminator
|
|
2400
|
+
*/
|
|
2401
|
+
type: "github_commit";
|
|
2402
|
+
/**
|
|
2403
|
+
* URL to the commit on GitHub
|
|
2404
|
+
*/
|
|
2405
|
+
url: string;
|
|
2406
|
+
}
|
|
2407
|
+
/**
|
|
2408
|
+
* Pointer to a GitHub repository.
|
|
2409
|
+
*/
|
|
2410
|
+
export interface GitHubRepoRef {
|
|
2411
|
+
/**
|
|
2412
|
+
* Numeric GitHub repository id
|
|
2413
|
+
*/
|
|
2414
|
+
id?: number;
|
|
2415
|
+
/**
|
|
2416
|
+
* Repository name (without owner)
|
|
2417
|
+
*/
|
|
2418
|
+
name: string;
|
|
2419
|
+
/**
|
|
2420
|
+
* Repository owner login (user or organization)
|
|
2421
|
+
*/
|
|
2422
|
+
owner: string;
|
|
2423
|
+
}
|
|
2424
|
+
/**
|
|
2425
|
+
* Pointer to a GitHub release.
|
|
2426
|
+
*/
|
|
2427
|
+
export interface AttachmentGitHubRelease {
|
|
2428
|
+
/**
|
|
2429
|
+
* Human-readable release name
|
|
2430
|
+
*/
|
|
2431
|
+
name: string;
|
|
2432
|
+
repo: GitHubRepoRef;
|
|
2433
|
+
/**
|
|
2434
|
+
* Git tag the release is anchored to
|
|
2435
|
+
*/
|
|
2436
|
+
tagName: string;
|
|
2437
|
+
/**
|
|
2438
|
+
* Attachment type discriminator
|
|
2439
|
+
*/
|
|
2440
|
+
type: "github_release";
|
|
2441
|
+
/**
|
|
2442
|
+
* URL to the release on GitHub
|
|
2443
|
+
*/
|
|
2444
|
+
url: string;
|
|
2445
|
+
}
|
|
2446
|
+
/**
|
|
2447
|
+
* Pointer to a GitHub Actions job.
|
|
2448
|
+
*/
|
|
2449
|
+
export interface AttachmentGitHubActionsJob {
|
|
2450
|
+
/**
|
|
2451
|
+
* Terminal conclusion of the job when finished (e.g., success, failure, cancelled). Absent for in-progress jobs.
|
|
2452
|
+
*/
|
|
2453
|
+
conclusion?: string;
|
|
2454
|
+
/**
|
|
2455
|
+
* Job id within the workflow run
|
|
2456
|
+
*/
|
|
2457
|
+
jobId: number;
|
|
2458
|
+
/**
|
|
2459
|
+
* Display name of the job
|
|
2460
|
+
*/
|
|
2461
|
+
jobName: string;
|
|
2462
|
+
repo: GitHubRepoRef;
|
|
2463
|
+
/**
|
|
2464
|
+
* Attachment type discriminator
|
|
2465
|
+
*/
|
|
2466
|
+
type: "github_actions_job";
|
|
2467
|
+
/**
|
|
2468
|
+
* URL to the job on GitHub
|
|
2469
|
+
*/
|
|
2470
|
+
url: string;
|
|
2471
|
+
/**
|
|
2472
|
+
* Display name of the workflow the job ran in
|
|
2473
|
+
*/
|
|
2474
|
+
workflowName: string;
|
|
2475
|
+
}
|
|
2476
|
+
/**
|
|
2477
|
+
* Pointer to a GitHub repository.
|
|
2478
|
+
*/
|
|
2479
|
+
export interface AttachmentGitHubRepository {
|
|
2480
|
+
/**
|
|
2481
|
+
* Short description of the repository
|
|
2482
|
+
*/
|
|
2483
|
+
description?: string;
|
|
2484
|
+
/**
|
|
2485
|
+
* Git ref this attachment is anchored at (branch, tag, or commit). When absent the default branch is implied.
|
|
2486
|
+
*/
|
|
2487
|
+
ref?: string;
|
|
2488
|
+
repo: GitHubRepoRef;
|
|
2489
|
+
/**
|
|
2490
|
+
* Attachment type discriminator
|
|
2491
|
+
*/
|
|
2492
|
+
type: "github_repository";
|
|
2493
|
+
/**
|
|
2494
|
+
* URL to the repository on GitHub
|
|
2495
|
+
*/
|
|
2496
|
+
url: string;
|
|
2497
|
+
}
|
|
2498
|
+
/**
|
|
2499
|
+
* Pointer to a single-file diff. At least one of `head` and `base` must be present.
|
|
2500
|
+
*/
|
|
2501
|
+
export interface AttachmentGitHubFileDiff {
|
|
2502
|
+
base?: AttachmentGitHubFileDiffSide;
|
|
2503
|
+
head?: AttachmentGitHubFileDiffSide;
|
|
2504
|
+
/**
|
|
2505
|
+
* Attachment type discriminator
|
|
2506
|
+
*/
|
|
2507
|
+
type: "github_file_diff";
|
|
2508
|
+
/**
|
|
2509
|
+
* URL to the diff on GitHub (e.g., a commit, compare, or PR-file URL)
|
|
2510
|
+
*/
|
|
2511
|
+
url: string;
|
|
2512
|
+
}
|
|
2513
|
+
/**
|
|
2514
|
+
* One side of a file diff (head or base)
|
|
2515
|
+
*/
|
|
2516
|
+
export interface AttachmentGitHubFileDiffSide {
|
|
2517
|
+
/**
|
|
2518
|
+
* Repository-relative path to the file
|
|
2519
|
+
*/
|
|
2520
|
+
path: string;
|
|
2521
|
+
/**
|
|
2522
|
+
* Git ref (branch, tag, or commit SHA) the file is read at
|
|
2523
|
+
*/
|
|
2524
|
+
ref: string;
|
|
2525
|
+
repo: GitHubRepoRef;
|
|
2526
|
+
}
|
|
2527
|
+
/**
|
|
2528
|
+
* Pointer to a comparison between two git revisions.
|
|
2529
|
+
*/
|
|
2530
|
+
export interface AttachmentGitHubTreeComparison {
|
|
2531
|
+
base: AttachmentGitHubTreeComparisonSide;
|
|
2532
|
+
head: AttachmentGitHubTreeComparisonSide;
|
|
2533
|
+
/**
|
|
2534
|
+
* Attachment type discriminator
|
|
2535
|
+
*/
|
|
2536
|
+
type: "github_tree_comparison";
|
|
2537
|
+
/**
|
|
2538
|
+
* URL to the comparison on GitHub
|
|
2539
|
+
*/
|
|
2540
|
+
url: string;
|
|
2541
|
+
}
|
|
2542
|
+
/**
|
|
2543
|
+
* One side of a tree comparison (head or base)
|
|
2544
|
+
*/
|
|
2545
|
+
export interface AttachmentGitHubTreeComparisonSide {
|
|
2546
|
+
repo: GitHubRepoRef;
|
|
2547
|
+
/**
|
|
2548
|
+
* Git revision (branch, tag, or commit SHA)
|
|
2549
|
+
*/
|
|
2550
|
+
revision: string;
|
|
2551
|
+
}
|
|
2552
|
+
/**
|
|
2553
|
+
* Generic GitHub URL reference.
|
|
2554
|
+
*/
|
|
2555
|
+
export interface AttachmentGitHubUrl {
|
|
2556
|
+
/**
|
|
2557
|
+
* Attachment type discriminator
|
|
2558
|
+
*/
|
|
2559
|
+
type: "github_url";
|
|
2560
|
+
/**
|
|
2561
|
+
* URL to the GitHub resource
|
|
2562
|
+
*/
|
|
2563
|
+
url: string;
|
|
2564
|
+
}
|
|
2565
|
+
/**
|
|
2566
|
+
* Pointer to a file in a GitHub repository at a specific ref.
|
|
2567
|
+
*/
|
|
2568
|
+
export interface AttachmentGitHubFile {
|
|
2569
|
+
/**
|
|
2570
|
+
* Repository-relative path to the file
|
|
2571
|
+
*/
|
|
2572
|
+
path: string;
|
|
2573
|
+
/**
|
|
2574
|
+
* Git ref the file is read at (branch, tag, or commit SHA)
|
|
2575
|
+
*/
|
|
2576
|
+
ref: string;
|
|
2577
|
+
repo: GitHubRepoRef;
|
|
2578
|
+
/**
|
|
2579
|
+
* Attachment type discriminator
|
|
2580
|
+
*/
|
|
2581
|
+
type: "github_file";
|
|
2582
|
+
/**
|
|
2583
|
+
* URL to the file on GitHub
|
|
2584
|
+
*/
|
|
2585
|
+
url: string;
|
|
2586
|
+
}
|
|
2587
|
+
/**
|
|
2588
|
+
* Pointer to a line range inside a file in a GitHub repository.
|
|
2589
|
+
*/
|
|
2590
|
+
export interface AttachmentGitHubSnippet {
|
|
2591
|
+
lineRange: AttachmentFileLineRange;
|
|
2592
|
+
/**
|
|
2593
|
+
* Repository-relative path to the file
|
|
2594
|
+
*/
|
|
2595
|
+
path: string;
|
|
2596
|
+
/**
|
|
2597
|
+
* Git ref the file is read at (branch, tag, or commit SHA)
|
|
2598
|
+
*/
|
|
2599
|
+
ref: string;
|
|
2600
|
+
repo: GitHubRepoRef;
|
|
2601
|
+
/**
|
|
2602
|
+
* Attachment type discriminator
|
|
2603
|
+
*/
|
|
2604
|
+
type: "github_snippet";
|
|
2605
|
+
/**
|
|
2606
|
+
* URL to the snippet on GitHub (with line anchor)
|
|
2607
|
+
*/
|
|
2608
|
+
url: string;
|
|
2609
|
+
}
|
|
2324
2610
|
/**
|
|
2325
2611
|
* Blob attachment with inline base64-encoded data
|
|
2326
2612
|
*/
|
|
@@ -3040,6 +3326,45 @@ export interface AssistantTurnEndData {
|
|
|
3040
3326
|
*/
|
|
3041
3327
|
turnId: string;
|
|
3042
3328
|
}
|
|
3329
|
+
/**
|
|
3330
|
+
* 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
|
|
3331
|
+
*/
|
|
3332
|
+
export interface AssistantIdleEvent {
|
|
3333
|
+
/**
|
|
3334
|
+
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
|
|
3335
|
+
*/
|
|
3336
|
+
agentId?: string;
|
|
3337
|
+
data: AssistantIdleData;
|
|
3338
|
+
/**
|
|
3339
|
+
* Always true for events that are transient and not persisted to the session event log on disk.
|
|
3340
|
+
*/
|
|
3341
|
+
ephemeral: true;
|
|
3342
|
+
/**
|
|
3343
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
3344
|
+
*/
|
|
3345
|
+
id: string;
|
|
3346
|
+
/**
|
|
3347
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
3348
|
+
*/
|
|
3349
|
+
parentId: string | null;
|
|
3350
|
+
/**
|
|
3351
|
+
* ISO 8601 timestamp when the event was created
|
|
3352
|
+
*/
|
|
3353
|
+
timestamp: string;
|
|
3354
|
+
/**
|
|
3355
|
+
* Type discriminator. Always "assistant.idle".
|
|
3356
|
+
*/
|
|
3357
|
+
type: "assistant.idle";
|
|
3358
|
+
}
|
|
3359
|
+
/**
|
|
3360
|
+
* 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
|
|
3361
|
+
*/
|
|
3362
|
+
export interface AssistantIdleData {
|
|
3363
|
+
/**
|
|
3364
|
+
* True when the preceding agentic loop was cancelled via abort signal
|
|
3365
|
+
*/
|
|
3366
|
+
aborted?: boolean;
|
|
3367
|
+
}
|
|
3043
3368
|
/**
|
|
3044
3369
|
* Session event "assistant.usage". LLM API call usage metrics including tokens, costs, quotas, and billing information
|
|
3045
3370
|
*/
|
|
@@ -3439,6 +3764,7 @@ export interface ToolExecutionStartData {
|
|
|
3439
3764
|
* Tool call ID of the parent tool invocation when this event originates from a sub-agent
|
|
3440
3765
|
*/
|
|
3441
3766
|
parentToolCallId?: string;
|
|
3767
|
+
shellToolInfo?: ToolExecutionStartShellToolInfo;
|
|
3442
3768
|
/**
|
|
3443
3769
|
* Unique identifier for this tool call
|
|
3444
3770
|
*/
|
|
@@ -3453,6 +3779,19 @@ export interface ToolExecutionStartData {
|
|
|
3453
3779
|
*/
|
|
3454
3780
|
turnId?: string;
|
|
3455
3781
|
}
|
|
3782
|
+
/**
|
|
3783
|
+
* 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.
|
|
3784
|
+
*/
|
|
3785
|
+
export interface ToolExecutionStartShellToolInfo {
|
|
3786
|
+
/**
|
|
3787
|
+
* Whether the command includes a file write redirection (e.g., > or >>).
|
|
3788
|
+
*/
|
|
3789
|
+
hasWriteFileRedirection: boolean;
|
|
3790
|
+
/**
|
|
3791
|
+
* 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.
|
|
3792
|
+
*/
|
|
3793
|
+
possiblePaths: string[];
|
|
3794
|
+
}
|
|
3456
3795
|
/**
|
|
3457
3796
|
* Tool definition metadata, present for MCP tools with MCP Apps support
|
|
3458
3797
|
*/
|
|
@@ -6139,6 +6478,7 @@ export interface McpOauthRequiredEvent {
|
|
|
6139
6478
|
* OAuth authentication request for an MCP server
|
|
6140
6479
|
*/
|
|
6141
6480
|
export interface McpOauthRequiredData {
|
|
6481
|
+
reason: McpOauthRequestReason;
|
|
6142
6482
|
/**
|
|
6143
6483
|
* Unique identifier for this OAuth request; used to respond via session.mcp.oauth.handlePendingRequest
|
|
6144
6484
|
*/
|
|
@@ -6166,6 +6506,10 @@ export interface McpOauthRequiredStaticClientConfig {
|
|
|
6166
6506
|
* OAuth client ID for the server
|
|
6167
6507
|
*/
|
|
6168
6508
|
clientId: string;
|
|
6509
|
+
/**
|
|
6510
|
+
* Optional OAuth client secret for confidential static clients, when the runtime can resolve one
|
|
6511
|
+
*/
|
|
6512
|
+
clientSecret?: string;
|
|
6169
6513
|
/**
|
|
6170
6514
|
* 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
6515
|
*/
|
|
@@ -6184,9 +6528,9 @@ export interface McpOauthWWWAuthenticateParams {
|
|
|
6184
6528
|
*/
|
|
6185
6529
|
error?: string;
|
|
6186
6530
|
/**
|
|
6187
|
-
* Protected resource metadata URL from the WWW-Authenticate resource_metadata parameter
|
|
6531
|
+
* Protected resource metadata URL from the WWW-Authenticate resource_metadata parameter, if present
|
|
6188
6532
|
*/
|
|
6189
|
-
resourceMetadataUrl
|
|
6533
|
+
resourceMetadataUrl?: string;
|
|
6190
6534
|
/**
|
|
6191
6535
|
* Requested OAuth scopes from the WWW-Authenticate scope parameter, if present
|
|
6192
6536
|
*/
|
|
@@ -6232,6 +6576,94 @@ export interface McpOauthCompletedData {
|
|
|
6232
6576
|
*/
|
|
6233
6577
|
requestId: string;
|
|
6234
6578
|
}
|
|
6579
|
+
/**
|
|
6580
|
+
* Session event "mcp.headers_refresh_required". Dynamic headers refresh request for a remote MCP server
|
|
6581
|
+
*/
|
|
6582
|
+
export interface McpHeadersRefreshRequiredEvent {
|
|
6583
|
+
/**
|
|
6584
|
+
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
|
|
6585
|
+
*/
|
|
6586
|
+
agentId?: string;
|
|
6587
|
+
data: McpHeadersRefreshRequiredData;
|
|
6588
|
+
/**
|
|
6589
|
+
* Always true for events that are transient and not persisted to the session event log on disk.
|
|
6590
|
+
*/
|
|
6591
|
+
ephemeral: true;
|
|
6592
|
+
/**
|
|
6593
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
6594
|
+
*/
|
|
6595
|
+
id: string;
|
|
6596
|
+
/**
|
|
6597
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
6598
|
+
*/
|
|
6599
|
+
parentId: string | null;
|
|
6600
|
+
/**
|
|
6601
|
+
* ISO 8601 timestamp when the event was created
|
|
6602
|
+
*/
|
|
6603
|
+
timestamp: string;
|
|
6604
|
+
/**
|
|
6605
|
+
* Type discriminator. Always "mcp.headers_refresh_required".
|
|
6606
|
+
*/
|
|
6607
|
+
type: "mcp.headers_refresh_required";
|
|
6608
|
+
}
|
|
6609
|
+
/**
|
|
6610
|
+
* Dynamic headers refresh request for a remote MCP server
|
|
6611
|
+
*/
|
|
6612
|
+
export interface McpHeadersRefreshRequiredData {
|
|
6613
|
+
reason: McpHeadersRefreshRequiredReason;
|
|
6614
|
+
/**
|
|
6615
|
+
* Unique identifier for this headers refresh request; used to respond via session.mcp.headers.handlePendingHeadersRefreshRequest()
|
|
6616
|
+
*/
|
|
6617
|
+
requestId: string;
|
|
6618
|
+
/**
|
|
6619
|
+
* Display name of the remote MCP server requesting headers
|
|
6620
|
+
*/
|
|
6621
|
+
serverName: string;
|
|
6622
|
+
/**
|
|
6623
|
+
* URL of the remote MCP server requesting headers
|
|
6624
|
+
*/
|
|
6625
|
+
serverUrl: string;
|
|
6626
|
+
}
|
|
6627
|
+
/**
|
|
6628
|
+
* Session event "mcp.headers_refresh_completed". MCP headers refresh request completion notification
|
|
6629
|
+
*/
|
|
6630
|
+
export interface McpHeadersRefreshCompletedEvent {
|
|
6631
|
+
/**
|
|
6632
|
+
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
|
|
6633
|
+
*/
|
|
6634
|
+
agentId?: string;
|
|
6635
|
+
data: McpHeadersRefreshCompletedData;
|
|
6636
|
+
/**
|
|
6637
|
+
* Always true for events that are transient and not persisted to the session event log on disk.
|
|
6638
|
+
*/
|
|
6639
|
+
ephemeral: true;
|
|
6640
|
+
/**
|
|
6641
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
6642
|
+
*/
|
|
6643
|
+
id: string;
|
|
6644
|
+
/**
|
|
6645
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
6646
|
+
*/
|
|
6647
|
+
parentId: string | null;
|
|
6648
|
+
/**
|
|
6649
|
+
* ISO 8601 timestamp when the event was created
|
|
6650
|
+
*/
|
|
6651
|
+
timestamp: string;
|
|
6652
|
+
/**
|
|
6653
|
+
* Type discriminator. Always "mcp.headers_refresh_completed".
|
|
6654
|
+
*/
|
|
6655
|
+
type: "mcp.headers_refresh_completed";
|
|
6656
|
+
}
|
|
6657
|
+
/**
|
|
6658
|
+
* MCP headers refresh request completion notification
|
|
6659
|
+
*/
|
|
6660
|
+
export interface McpHeadersRefreshCompletedData {
|
|
6661
|
+
outcome: McpHeadersRefreshCompletedOutcome;
|
|
6662
|
+
/**
|
|
6663
|
+
* Request ID of the resolved headers refresh request
|
|
6664
|
+
*/
|
|
6665
|
+
requestId: string;
|
|
6666
|
+
}
|
|
6235
6667
|
/**
|
|
6236
6668
|
* Session event "session.custom_notification". Opaque custom notification data. Consumers may branch on source and name, but payload semantics are source-defined.
|
|
6237
6669
|
*/
|
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,
|
|
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.js
CHANGED
|
@@ -510,7 +510,7 @@ class CopilotSession {
|
|
|
510
510
|
};
|
|
511
511
|
}
|
|
512
512
|
/**
|
|
513
|
-
* Registers per-provider {@link
|
|
513
|
+
* Registers per-provider {@link BearerTokenProvider} callbacks for BYOK providers
|
|
514
514
|
* configured with managed-identity / on-demand bearer-token auth.
|
|
515
515
|
*
|
|
516
516
|
* The runtime never receives the callback itself; the SDK strips it from the
|
|
@@ -540,7 +540,8 @@ class CopilotSession {
|
|
|
540
540
|
);
|
|
541
541
|
}
|
|
542
542
|
const token = await callback({
|
|
543
|
-
providerName: params.providerName
|
|
543
|
+
providerName: params.providerName,
|
|
544
|
+
sessionId: params.sessionId
|
|
544
545
|
});
|
|
545
546
|
return { token };
|
|
546
547
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1799,7 +1799,7 @@ export interface ResumeSessionConfig extends SessionConfigBase {
|
|
|
1799
1799
|
openCanvases?: OpenCanvasInstance[];
|
|
1800
1800
|
}
|
|
1801
1801
|
/**
|
|
1802
|
-
* Arguments passed to a {@link
|
|
1802
|
+
* Arguments passed to a {@link BearerTokenProvider} callback when the runtime needs a
|
|
1803
1803
|
* fresh bearer token for a BYOK provider.
|
|
1804
1804
|
*
|
|
1805
1805
|
* @experimental Part of the experimental managed-identity / bearer-token-provider
|
|
@@ -1814,7 +1814,14 @@ export interface ProviderTokenArgs {
|
|
|
1814
1814
|
* The callback closes over its own token scope/audience; the runtime is
|
|
1815
1815
|
* provider-agnostic and forwards only the provider name.
|
|
1816
1816
|
*/
|
|
1817
|
-
providerName: string;
|
|
1817
|
+
readonly providerName: string;
|
|
1818
|
+
/**
|
|
1819
|
+
* Id of the session that triggered this token request. A client-level shared
|
|
1820
|
+
* callback registered for many sessions can use this to resolve the owning
|
|
1821
|
+
* session (e.g. via the client's session lookup) to scope token acquisition
|
|
1822
|
+
* or caching per session.
|
|
1823
|
+
*/
|
|
1824
|
+
readonly sessionId: string;
|
|
1818
1825
|
}
|
|
1819
1826
|
/**
|
|
1820
1827
|
* Per-provider callback that resolves a bearer token on demand, returning the
|
|
@@ -1828,7 +1835,7 @@ export interface ProviderTokenArgs {
|
|
|
1828
1835
|
* @experimental Part of the experimental managed-identity / bearer-token-provider
|
|
1829
1836
|
* surface and may change or be removed in future SDK or CLI releases.
|
|
1830
1837
|
*/
|
|
1831
|
-
export type
|
|
1838
|
+
export type BearerTokenProvider = (args: ProviderTokenArgs) => Promise<string>;
|
|
1832
1839
|
/**
|
|
1833
1840
|
* Configuration for a custom API provider.
|
|
1834
1841
|
*/
|
|
@@ -1870,12 +1877,14 @@ export interface ProviderConfig {
|
|
|
1870
1877
|
* When set, the SDK keeps this function client-side (it is never serialized)
|
|
1871
1878
|
* and the runtime calls back into this client to acquire a token before each
|
|
1872
1879
|
* outbound request. The runtime does no caching of its own, so the callback
|
|
1873
|
-
* owns token caching and refresh.
|
|
1874
|
-
* {@link bearerToken}
|
|
1880
|
+
* owns token caching and refresh. When set alongside {@link apiKey} /
|
|
1881
|
+
* {@link bearerToken}, this callback takes precedence: the runtime applies
|
|
1882
|
+
* the token it returns as the `Authorization: Bearer` header for each
|
|
1883
|
+
* request and does not send the static credential.
|
|
1875
1884
|
*
|
|
1876
1885
|
* @experimental
|
|
1877
1886
|
*/
|
|
1878
|
-
|
|
1887
|
+
bearerTokenProvider?: BearerTokenProvider;
|
|
1879
1888
|
/**
|
|
1880
1889
|
* Azure-specific options
|
|
1881
1890
|
*/
|
|
@@ -1960,12 +1969,14 @@ export interface NamedProviderConfig {
|
|
|
1960
1969
|
* When set, the SDK keeps this function client-side (it is never serialized)
|
|
1961
1970
|
* and the runtime calls back into this client to acquire a token before each
|
|
1962
1971
|
* outbound request. The runtime does no caching of its own, so the callback
|
|
1963
|
-
* owns token caching and refresh.
|
|
1964
|
-
* {@link bearerToken}
|
|
1972
|
+
* owns token caching and refresh. When set alongside {@link apiKey} /
|
|
1973
|
+
* {@link bearerToken}, this callback takes precedence: the runtime applies
|
|
1974
|
+
* the token it returns as the `Authorization: Bearer` header for each
|
|
1975
|
+
* request and does not send the static credential.
|
|
1965
1976
|
*
|
|
1966
1977
|
* @experimental
|
|
1967
1978
|
*/
|
|
1968
|
-
|
|
1979
|
+
bearerTokenProvider?: BearerTokenProvider;
|
|
1969
1980
|
/**
|
|
1970
1981
|
* Azure-specific options.
|
|
1971
1982
|
*/
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "git",
|
|
5
5
|
"url": "https://github.com/github/copilot-sdk.git"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.0.
|
|
7
|
+
"version": "1.0.5-preview.0",
|
|
8
8
|
"description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
|
|
9
9
|
"main": "./dist/cjs/index.js",
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"author": "GitHub",
|
|
57
57
|
"license": "MIT",
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@github/copilot": "^1.0.
|
|
59
|
+
"@github/copilot": "^1.0.66-1",
|
|
60
60
|
"vscode-jsonrpc": "^8.2.1",
|
|
61
61
|
"zod": "^4.3.6"
|
|
62
62
|
},
|