@github/copilot-sdk 1.0.7-preview.2 → 1.0.7

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 | SessionLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | UsageCheckpointEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantToolCallDeltaEvent | 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 | SessionLimitsExhaustedRequestedEvent | SessionLimitsExhaustedCompletedEvent | AutoModeResolvedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | McpToolsListChangedEvent | McpResourcesListChangedEvent | McpPromptsListChangedEvent | 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 | SessionLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | UsageCheckpointEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantServerToolProgressEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantToolCallDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantIdleEvent | AssistantUsageEvent | ModelCallFailureEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | McpHeadersRefreshRequiredEvent | McpHeadersRefreshCompletedEvent | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | SessionLimitsExhaustedRequestedEvent | SessionLimitsExhaustedCompletedEvent | AutoModeResolvedEvent | ManagedSettingsResolvedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | McpToolsListChangedEvent | McpResourcesListChangedEvent | McpPromptsListChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
9
9
  /**
10
10
  * Hosting platform type of the repository (github or ado)
11
11
  */
@@ -471,6 +471,16 @@ export type AutoModeResolvedReasoningBucket =
471
471
  | "medium"
472
472
  /** The request looks high-reasoning; a stronger model is appropriate. */
473
473
  | "high";
474
+ /**
475
+ * Which channel supplied the effective enterprise managed settings (highest-authority present layer wins wholesale)
476
+ */
477
+ export type ManagedSettingsResolvedSource =
478
+ /** Account/org policy self-fetched from the GitHub managed-settings endpoint (higher authority). */
479
+ "server"
480
+ /** Device-level MDM policy discovered from plist/registry/file (lower authority). */
481
+ | "device"
482
+ /** No managed policy is in force (no layer contributed). */
483
+ | "none";
474
484
  /**
475
485
  * Exit plan mode action
476
486
  */
@@ -2943,6 +2953,53 @@ export interface AssistantIntentData {
2943
2953
  */
2944
2954
  intent: string;
2945
2955
  }
2956
+ /**
2957
+ * Session event "assistant.server_tool_progress". Live progress signal for a provider-hosted server tool (e.g. hosted web search) while it runs, before the finalized serverTools envelope lands on the terminal assistant.message
2958
+ */
2959
+ export interface AssistantServerToolProgressEvent {
2960
+ /**
2961
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2962
+ */
2963
+ agentId?: string;
2964
+ data: AssistantServerToolProgressData;
2965
+ /**
2966
+ * Always true for events that are transient and not persisted to the session event log on disk.
2967
+ */
2968
+ ephemeral: true;
2969
+ /**
2970
+ * Unique event identifier (UUID v4), generated when the event is emitted
2971
+ */
2972
+ id: string;
2973
+ /**
2974
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
2975
+ */
2976
+ parentId: string | null;
2977
+ /**
2978
+ * ISO 8601 timestamp when the event was created
2979
+ */
2980
+ timestamp: string;
2981
+ /**
2982
+ * Type discriminator. Always "assistant.server_tool_progress".
2983
+ */
2984
+ type: "assistant.server_tool_progress";
2985
+ }
2986
+ /**
2987
+ * Live progress signal for a provider-hosted server tool (e.g. hosted web search) while it runs, before the finalized serverTools envelope lands on the terminal assistant.message
2988
+ */
2989
+ export interface AssistantServerToolProgressData {
2990
+ /**
2991
+ * Kind of hosted server tool that is running. Only `web_search` is emitted today.
2992
+ */
2993
+ kind: string;
2994
+ /**
2995
+ * Position of the hosted tool call in the response output. Stable across the call's lifecycle events (unlike the provider's per-event item id, which CAPI rotates), so the host keys the live in-progress row on it.
2996
+ */
2997
+ outputIndex: number;
2998
+ /**
2999
+ * Lifecycle status of the hosted call: `in_progress`, `searching`, or `completed`.
3000
+ */
3001
+ status: string;
3002
+ }
2946
3003
  /**
2947
3004
  * Session event "assistant.reasoning". Assistant reasoning content for timeline display with complete thinking text
2948
3005
  */
@@ -4168,6 +4225,14 @@ export interface ToolExecutionCompleteData {
4168
4225
  * Whether this tool call was explicitly requested by the user rather than the assistant
4169
4226
  */
4170
4227
  isUserRequested?: boolean;
4228
+ /**
4229
+ * FIDES IFC label projected from tool ingress metadata (MCP `CallToolResult._meta` or synthesized built-in ingress labels). Persisted as `{ ifc: ... }` so the label survives session resume, including model-visible failure results. Experimental.
4230
+ *
4231
+ * @experimental
4232
+ */
4233
+ mcpMeta?: {
4234
+ [k: string]: unknown | undefined;
4235
+ };
4171
4236
  /**
4172
4237
  * Model identifier that generated this tool call
4173
4238
  */
@@ -4243,6 +4308,14 @@ export interface ToolExecutionCompleteResult {
4243
4308
  * Full detailed tool result for UI/timeline display, preserving complete content such as diffs. Falls back to content when absent.
4244
4309
  */
4245
4310
  detailedContent?: string;
4311
+ /**
4312
+ * FIDES IFC label projected from tool ingress metadata (MCP `CallToolResult._meta` or synthesized built-in ingress labels) — persisted as `{ ifc: ... }` (only the `ifc` key, not the whole `_meta`). Persisted so the FIDES IFC label survives session resume: the engine rehydrates accumulated taint by replaying these on load. Populated for ingress sources when FIDES IFC is on. Experimental.
4313
+ *
4314
+ * @experimental
4315
+ */
4316
+ mcpMeta?: {
4317
+ [k: string]: unknown | undefined;
4318
+ };
4246
4319
  /**
4247
4320
  * Structured content (arbitrary JSON) returned verbatim by the MCP tool
4248
4321
  */
@@ -6835,6 +6908,7 @@ export interface McpOauthRequiredEvent {
6835
6908
  * OAuth authentication request for an MCP server
6836
6909
  */
6837
6910
  export interface McpOauthRequiredData {
6911
+ httpResponse?: McpOauthHttpResponse;
6838
6912
  reason: McpOauthRequestReason;
6839
6913
  /**
6840
6914
  * Unique identifier for this OAuth request; used to respond via session.mcp.oauth.handlePendingRequest
@@ -6855,6 +6929,36 @@ export interface McpOauthRequiredData {
6855
6929
  staticClientConfig?: McpOauthRequiredStaticClientConfig;
6856
6930
  wwwAuthenticateParams?: McpOauthWWWAuthenticateParams;
6857
6931
  }
6932
+ /**
6933
+ * Raw HTTP response details from the OAuth auth challenge, as observed by the runtime.
6934
+ */
6935
+ export interface McpOauthHttpResponse {
6936
+ /**
6937
+ * Complete UTF-8 response body for host-specific challenge handling, including an empty string for an empty body. Omitted when the complete body is not valid UTF-8; body read failures fail the HTTP operation rather than exposing a partial response.
6938
+ */
6939
+ body?: string;
6940
+ /**
6941
+ * HTTP response headers as observed by the runtime. Order and casing are transport-dependent, and duplicate header names may appear multiple times.
6942
+ */
6943
+ headers: HeaderEntry[];
6944
+ /**
6945
+ * HTTP status code returned with the auth challenge.
6946
+ */
6947
+ statusCode: number;
6948
+ }
6949
+ /**
6950
+ * Single HTTP header entry as a name/value pair.
6951
+ */
6952
+ export interface HeaderEntry {
6953
+ /**
6954
+ * HTTP response header name as observed by the runtime.
6955
+ */
6956
+ name: string;
6957
+ /**
6958
+ * HTTP response header value as observed by the runtime.
6959
+ */
6960
+ value: string;
6961
+ }
6858
6962
  /**
6859
6963
  * Static OAuth client configuration, if the server specifies one
6860
6964
  */
@@ -7571,6 +7675,70 @@ export interface AutoModeResolvedData {
7571
7675
  predictedLabel?: string;
7572
7676
  reasoningBucket?: AutoModeResolvedReasoningBucket;
7573
7677
  }
7678
+ /**
7679
+ * Session event "session.managed_settings_resolved". Enterprise managed-settings resolution: the effective managed settings the session applied and where they came from, so SDK clients can show users what is enterprise-managed and by which authority. Fires whenever managed policy is (re)applied — at session start, on resume, and on account switch. This is an ephemeral live snapshot (delivered to subscribers but not persisted to the session event log), because at session start it resolves before `session.start` is emitted; for a session-independent pull, use the SDK `getManagedSettings()` API, which returns the identical payload. Managed settings have a single authoritative source, so the highest-authority present layer (server > device) wins wholesale; `bypassPermissionsDisabled` is deny-wins across layers. Marked experimental while the managed-settings surface stabilizes.
7680
+ */
7681
+ /** @experimental */
7682
+ export interface ManagedSettingsResolvedEvent {
7683
+ /**
7684
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
7685
+ */
7686
+ agentId?: string;
7687
+ data: ManagedSettingsResolvedData;
7688
+ /**
7689
+ * Always true for events that are transient and not persisted to the session event log on disk.
7690
+ */
7691
+ ephemeral: true;
7692
+ /**
7693
+ * Unique event identifier (UUID v4), generated when the event is emitted
7694
+ */
7695
+ id: string;
7696
+ /**
7697
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
7698
+ */
7699
+ parentId: string | null;
7700
+ /**
7701
+ * ISO 8601 timestamp when the event was created
7702
+ */
7703
+ timestamp: string;
7704
+ /**
7705
+ * Type discriminator. Always "session.managed_settings_resolved".
7706
+ */
7707
+ type: "session.managed_settings_resolved";
7708
+ }
7709
+ /**
7710
+ * Enterprise managed-settings resolution: the effective managed settings the session applied and where they came from, so SDK clients can show users what is enterprise-managed and by which authority. Fires whenever managed policy is (re)applied — at session start, on resume, and on account switch. This is an ephemeral live snapshot (delivered to subscribers but not persisted to the session event log), because at session start it resolves before `session.start` is emitted; for a session-independent pull, use the SDK `getManagedSettings()` API, which returns the identical payload. Managed settings have a single authoritative source, so the highest-authority present layer (server > device) wins wholesale; `bypassPermissionsDisabled` is deny-wins across layers. Marked experimental while the managed-settings surface stabilizes.
7711
+ */
7712
+ /** @experimental */
7713
+ export interface ManagedSettingsResolvedData {
7714
+ /**
7715
+ * Whether enterprise policy disables bypass-permissions ("yolo") mode for this session. Deny-wins across layers, and forced on when `failClosed` is true.
7716
+ */
7717
+ bypassPermissionsDisabled: boolean;
7718
+ /**
7719
+ * Whether the device (MDM/plist/registry/file) managed-settings layer was present
7720
+ */
7721
+ deviceManaged: boolean;
7722
+ /**
7723
+ * Whether managed policy could not be determined (e.g. a failed server fetch) and the session fell back to the fail-closed restriction. When true, restrictions such as disabling bypass-permissions are enforced even though `settings` may be absent.
7724
+ */
7725
+ failClosed: boolean;
7726
+ /**
7727
+ * The setting keys under enterprise management in the effective managed settings (e.g. `model`, `enabledPlugins`, `permissions`). Empty when no managed settings are in force.
7728
+ */
7729
+ managedKeys: string[];
7730
+ /**
7731
+ * Whether the server (account/org) managed-settings layer was present
7732
+ */
7733
+ serverManaged: boolean;
7734
+ /**
7735
+ * The effective (resolved) managed settings values, so clients can render exactly what is enforced. Absent when no managed policy is in force.
7736
+ */
7737
+ settings?: {
7738
+ [k: string]: unknown | undefined;
7739
+ };
7740
+ source: ManagedSettingsResolvedSource;
7741
+ }
7574
7742
  /**
7575
7743
  * Session event "commands.changed". SDK command registration change notification
7576
7744
  */
@@ -8115,7 +8283,7 @@ export interface McpServerStatusChangedData {
8115
8283
  status: McpServerStatus;
8116
8284
  }
8117
8285
  /**
8118
- * Session event "mcp.tools.list_changed". Payload of MCP `list_changed` notification events, emitted when an MCP server announces at runtime that one of its advertised lists changed.
8286
+ * Session event "mcp.tools.list_changed". Payload identifying the MCP server associated with a list change.
8119
8287
  */
8120
8288
  export interface McpToolsListChangedEvent {
8121
8289
  /**
@@ -8145,7 +8313,7 @@ export interface McpToolsListChangedEvent {
8145
8313
  type: "mcp.tools.list_changed";
8146
8314
  }
8147
8315
  /**
8148
- * Payload of MCP `list_changed` notification events, emitted when an MCP server announces at runtime that one of its advertised lists changed.
8316
+ * Payload identifying the MCP server associated with a list change.
8149
8317
  */
8150
8318
  export interface McpListChangedData {
8151
8319
  /**
@@ -8154,7 +8322,7 @@ export interface McpListChangedData {
8154
8322
  serverName: string;
8155
8323
  }
8156
8324
  /**
8157
- * Session event "mcp.resources.list_changed". Payload of MCP `list_changed` notification events, emitted when an MCP server announces at runtime that one of its advertised lists changed.
8325
+ * Session event "mcp.resources.list_changed". Payload identifying the MCP server associated with a list change.
8158
8326
  */
8159
8327
  export interface McpResourcesListChangedEvent {
8160
8328
  /**
@@ -8184,7 +8352,7 @@ export interface McpResourcesListChangedEvent {
8184
8352
  type: "mcp.resources.list_changed";
8185
8353
  }
8186
8354
  /**
8187
- * Session event "mcp.prompts.list_changed". Payload of MCP `list_changed` notification events, emitted when an MCP server announces at runtime that one of its advertised lists changed.
8355
+ * Session event "mcp.prompts.list_changed". Payload identifying the MCP server associated with a list change.
8188
8356
  */
8189
8357
  export interface McpPromptsListChangedEvent {
8190
8358
  /**
@@ -8268,7 +8436,7 @@ export interface ExtensionsLoadedExtension {
8268
8436
  status: ExtensionsLoadedExtensionStatus;
8269
8437
  }
8270
8438
  /**
8271
- * Session event "session.canvas.opened". Payload of `session.canvas.opened` with canvas instance and provider IDs plus optional title, status, URL, and input.
8439
+ * Session event "session.canvas.opened". Payload of `session.canvas.opened` with canvas instance and provider IDs plus optional icon, title, status, URL, and input.
8272
8440
  */
8273
8441
  /** @experimental */
8274
8442
  export interface CanvasOpenedEvent {
@@ -8299,7 +8467,7 @@ export interface CanvasOpenedEvent {
8299
8467
  type: "session.canvas.opened";
8300
8468
  }
8301
8469
  /**
8302
- * Payload of `session.canvas.opened` with canvas instance and provider IDs plus optional title, status, URL, and input.
8470
+ * Payload of `session.canvas.opened` with canvas instance and provider IDs plus optional icon, title, status, URL, and input.
8303
8471
  */
8304
8472
  /** @experimental */
8305
8473
  export interface CanvasOpenedData {
@@ -8315,6 +8483,10 @@ export interface CanvasOpenedData {
8315
8483
  * Owning extension display name, when available
8316
8484
  */
8317
8485
  extensionName?: string;
8486
+ /**
8487
+ * Host-local PNG path for the canvas icon, when supplied
8488
+ */
8489
+ icon?: string;
8318
8490
  /**
8319
8491
  * Input supplied when the instance was opened
8320
8492
  */
@@ -8408,6 +8580,10 @@ export interface CanvasRegistryChangedCanvas {
8408
8580
  * Owning extension display name, when available
8409
8581
  */
8410
8582
  extensionName?: string;
8583
+ /**
8584
+ * Host-local PNG path for the canvas icon, when supplied
8585
+ */
8586
+ icon?: string;
8411
8587
  /**
8412
8588
  * JSON Schema for canvas open input
8413
8589
  */
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, CanvasProviderIdentity, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientMode, CopilotClientOptions, StdioRuntimeConnection, InProcessRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, 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";
13
+ export type { CommandContext, CommandDefinition, CommandHandler, CanvasProviderIdentity, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientMode, CopilotClientOptions, StdioRuntimeConnection, InProcessRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, ChildProcessRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, 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, CurrentToolMetadata, ToolTelemetry, ToolResultObject, ToolSearchConfig, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
package/dist/session.d.ts CHANGED
@@ -30,6 +30,11 @@ export type AssistantMessageEvent = Extract<SessionEvent, {
30
30
  * await session.disconnect();
31
31
  * ```
32
32
  */
33
+ /**
34
+ * Fixed name of the runtime's built-in tool-search tool. A client can replace
35
+ * its behavior by registering a {@link Tool} with this exact name and
36
+ * `overridesBuiltInTool: true`.
37
+ */
33
38
  export declare class CopilotSession {
34
39
  readonly sessionId: string;
35
40
  private connection;
@@ -262,7 +267,7 @@ export declare class CopilotSession {
262
267
  *
263
268
  * @example
264
269
  * ```typescript
265
- * await session.setModel("gpt-4.1");
270
+ * await session.setModel("gpt-5.4");
266
271
  * await session.setModel("claude-sonnet-4.6", { reasoningEffort: "high" });
267
272
  * ```
268
273
  */
package/dist/session.js CHANGED
@@ -17,6 +17,7 @@ function isOpenCanvasInstance(value) {
17
17
  const instance = value;
18
18
  return typeof instance.instanceId === "string" && instance.instanceId.length > 0 && typeof instance.extensionId === "string" && instance.extensionId.length > 0 && typeof instance.canvasId === "string" && instance.canvasId.length > 0;
19
19
  }
20
+ const TOOL_SEARCH_TOOL_NAME = "tool_search_tool";
20
21
  class CopilotSession {
21
22
  /**
22
23
  * Creates a new CopilotSession instance.
@@ -329,11 +330,21 @@ class CopilotSession {
329
330
  */
330
331
  async _executeToolAndRespond(requestId, toolName, toolCallId, args, handler, traceparent, tracestate) {
331
332
  try {
333
+ let availableTools;
334
+ if (toolName === TOOL_SEARCH_TOOL_NAME) {
335
+ try {
336
+ const metadata = await this.rpc.tools.getCurrentMetadata();
337
+ availableTools = metadata.tools ?? void 0;
338
+ } catch {
339
+ availableTools = void 0;
340
+ }
341
+ }
332
342
  const rawResult = await handler(args, {
333
343
  sessionId: this.sessionId,
334
344
  toolCallId,
335
345
  toolName,
336
346
  arguments: args,
347
+ availableTools,
337
348
  traceparent,
338
349
  tracestate
339
350
  });
@@ -986,7 +997,7 @@ class CopilotSession {
986
997
  *
987
998
  * @example
988
999
  * ```typescript
989
- * await session.setModel("gpt-4.1");
1000
+ * await session.setModel("gpt-5.4");
990
1001
  * await session.setModel("claude-sonnet-4.6", { reasoningEffort: "high" });
991
1002
  * ```
992
1003
  */
package/dist/types.d.ts CHANGED
@@ -6,9 +6,10 @@ import type { SessionFsProvider } from "./sessionFsProvider.js";
6
6
  import type { CopilotRequestHandler } from "./copilotRequestHandler.js";
7
7
  import type { ReasoningSummary, SessionLimitsConfig, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
8
8
  import type { CopilotSession } from "./session.js";
9
- import type { GitHubTelemetryNotification, ModelBillingTokenPrices, OpenCanvasInstance, RemoteSessionMode } from "./generated/rpc.js";
9
+ import type { GitHubTelemetryNotification, ModelBillingTokenPrices, OpenCanvasInstance, RemoteSessionMode, CurrentToolMetadata } from "./generated/rpc.js";
10
10
  import type { ToolSet } from "./toolSet.js";
11
11
  export type { RemoteSessionMode } from "./generated/rpc.js";
12
+ export type { CurrentToolMetadata } from "./generated/rpc.js";
12
13
  export type { GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, } from "./generated/rpc.js";
13
14
  export type { ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, } from "./generated/rpc.js";
14
15
  export type SessionEvent = GeneratedSessionEvent;
@@ -65,15 +66,28 @@ export interface TelemetryConfig {
65
66
  */
66
67
  export type RuntimeConnection = StdioRuntimeConnection | InProcessRuntimeConnection | TcpRuntimeConnection | UriRuntimeConnection;
67
68
  /**
68
- * Spawns a runtime child process and communicates over its stdin/stdout.
69
- * This is the default if no {@link CopilotClientOptions.connection} is set.
69
+ * Shared shape for the transports that spawn a runtime **child process**
70
+ * ({@link StdioRuntimeConnection} and {@link TcpRuntimeConnection}).
70
71
  */
71
- export interface StdioRuntimeConnection {
72
- readonly kind: "stdio";
72
+ export interface ChildProcessRuntimeConnection {
73
73
  /** Path to the runtime executable. When omitted, the bundled runtime is used. */
74
74
  readonly path?: string;
75
75
  /** Extra command-line arguments to pass to the runtime process. */
76
76
  readonly args?: readonly string[];
77
+ /**
78
+ * Environment variables for the spawned runtime child process, replacing the
79
+ * inherited environment. Cannot be combined with
80
+ * {@link CopilotClientOptions.env}; setting both throws when the client is
81
+ * constructed. When omitted, the client-level env (or `process.env`) is used.
82
+ */
83
+ readonly env?: Record<string, string>;
84
+ }
85
+ /**
86
+ * Spawns a runtime child process and communicates over its stdin/stdout.
87
+ * This is the default if no {@link CopilotClientOptions.connection} is set.
88
+ */
89
+ export interface StdioRuntimeConnection extends ChildProcessRuntimeConnection {
90
+ readonly kind: "stdio";
77
91
  }
78
92
  /**
79
93
  * Hosts the runtime in-process by loading the native runtime library and speaking
@@ -97,7 +111,7 @@ export interface InProcessRuntimeConnection {
97
111
  /**
98
112
  * Spawns a runtime child process that listens on a TCP socket and connects to it.
99
113
  */
100
- export interface TcpRuntimeConnection {
114
+ export interface TcpRuntimeConnection extends ChildProcessRuntimeConnection {
101
115
  readonly kind: "tcp";
102
116
  /**
103
117
  * TCP port to listen on. `0` (the default) auto-allocates a free port.
@@ -110,10 +124,6 @@ export interface TcpRuntimeConnection {
110
124
  * loopback listener is safe by default.
111
125
  */
112
126
  readonly connectionToken?: string;
113
- /** Path to the runtime executable. When omitted, the bundled runtime is used. */
114
- readonly path?: string;
115
- /** Extra command-line arguments to pass to the runtime process. */
116
- readonly args?: readonly string[];
117
127
  }
118
128
  /**
119
129
  * Connects to an already-running runtime at the specified URL. The SDK does not
@@ -138,6 +148,7 @@ export declare const RuntimeConnection: {
138
148
  readonly forStdio: (opts?: {
139
149
  path?: string;
140
150
  args?: readonly string[];
151
+ env?: Record<string, string>;
141
152
  }) => StdioRuntimeConnection;
142
153
  /**
143
154
  * Spawn a runtime child process that listens on a TCP socket and connect to it.
@@ -147,6 +158,7 @@ export declare const RuntimeConnection: {
147
158
  connectionToken?: string;
148
159
  path?: string;
149
160
  args?: readonly string[];
161
+ env?: Record<string, string>;
150
162
  }) => TcpRuntimeConnection;
151
163
  /**
152
164
  * Connect to an already-running runtime at the given URL. The SDK does not
@@ -346,6 +358,10 @@ export type ToolResultObject = {
346
358
  error?: string;
347
359
  sessionLog?: string;
348
360
  toolTelemetry?: ToolTelemetry;
361
+ /**
362
+ * Names of tools returned by a tool-search tool.
363
+ */
364
+ toolReferences?: string[];
349
365
  };
350
366
  export type ToolResult = string | ToolResultObject;
351
367
  /**
@@ -401,6 +417,14 @@ export interface ToolInvocation {
401
417
  toolCallId: string;
402
418
  toolName: string;
403
419
  arguments: unknown;
420
+ /**
421
+ * Snapshot of the session's currently initialized tools. Populated by the
422
+ * SDK only when this invocation targets the built-in tool-search tool
423
+ * (`tool_search_tool`), so a tool-search override can rank/filter the live
424
+ * catalog — including MCP tools configured in settings — without issuing its
425
+ * own RPC. `undefined` for every other tool invocation.
426
+ */
427
+ availableTools?: CurrentToolMetadata[];
404
428
  /** W3C Trace Context traceparent from the CLI's execute_tool span. */
405
429
  traceparent?: string;
406
430
  /** W3C Trace Context tracestate from the CLI's execute_tool span. */
@@ -447,6 +471,14 @@ export interface Tool<TArgs = unknown> {
447
471
  * Optional; defaults to `"auto"`.
448
472
  */
449
473
  defer?: "auto" | "never";
474
+ /**
475
+ * Opaque, host-defined metadata associated with the tool definition.
476
+ *
477
+ * Keys are namespaced and are not part of the stable public API. Values are
478
+ * not interpreted and may be recognized to inform host-specific behavior.
479
+ * Unknown keys are preserved and round-tripped untouched.
480
+ */
481
+ metadata?: Record<string, unknown>;
450
482
  }
451
483
  /**
452
484
  * Helper to define a tool with Zod schema and get type inference for the handler.
@@ -459,7 +491,35 @@ export declare function defineTool<T = unknown>(name: string, config: {
459
491
  overridesBuiltInTool?: boolean;
460
492
  skipPermission?: boolean;
461
493
  defer?: "auto" | "never";
494
+ metadata?: Record<string, unknown>;
462
495
  }): Tool<T>;
496
+ /**
497
+ * SDK-supplied override for the runtime's built-in tool-search behavior.
498
+ *
499
+ * Tool search lets the model discover tools on demand instead of loading every
500
+ * tool definition up front. When the total tool count exceeds the deferral
501
+ * threshold, MCP and external tools are marked as deferred and surfaced through
502
+ * the built-in `tool_search_tool`.
503
+ *
504
+ * To override the tool-search tool's model-facing definition and/or its
505
+ * execution, register a {@link Tool} named `tool_search_tool` with
506
+ * `overridesBuiltInTool: true`. To customize the in-prompt tool-search
507
+ * guidance, use the `tool_instructions` section of {@link SystemMessageConfig}
508
+ * in `"customize"` mode.
509
+ */
510
+ export interface ToolSearchConfig {
511
+ /**
512
+ * Toggle to enable/disable tool search. When disabled, all tools are pre-loaded
513
+ * and the model's active tool set is not deferred.
514
+ */
515
+ enabled?: boolean;
516
+ /**
517
+ * Overrides the total tool count at which MCP and external tools are
518
+ * automatically deferred behind tool search. Defaults to the built-in
519
+ * threshold (30) when omitted.
520
+ */
521
+ deferThreshold?: number;
522
+ }
463
523
  /**
464
524
  * Context passed to a command handler when a command is executed.
465
525
  */
@@ -1553,6 +1613,14 @@ export interface SessionConfigBase {
1553
1613
  * Controls how the system prompt is constructed
1554
1614
  */
1555
1615
  systemMessage?: SystemMessageConfig;
1616
+ /**
1617
+ * Override for the runtime's built-in tool-search behavior.
1618
+ *
1619
+ * To also override the tool-search tool's implementation, register a
1620
+ * {@link Tool} named `tool_search_tool` with `overridesBuiltInTool: true` in
1621
+ * {@link SessionConfigBase.tools}.
1622
+ */
1623
+ toolSearch?: ToolSearchConfig;
1556
1624
  /**
1557
1625
  * List of tool names to allow. When specified, only these tools will be available.
1558
1626
  *
package/dist/types.js CHANGED
@@ -11,7 +11,7 @@ const RuntimeConnection = {
11
11
  * This is the default if no {@link CopilotClientOptions.connection} is set.
12
12
  */
13
13
  forStdio(opts = {}) {
14
- return { kind: "stdio", path: opts.path, args: opts.args };
14
+ return { kind: "stdio", path: opts.path, args: opts.args, env: opts.env };
15
15
  },
16
16
  /**
17
17
  * Spawn a runtime child process that listens on a TCP socket and connect to it.
@@ -22,7 +22,8 @@ const RuntimeConnection = {
22
22
  port: opts.port,
23
23
  connectionToken: opts.connectionToken,
24
24
  path: opts.path,
25
- args: opts.args
25
+ args: opts.args,
26
+ env: opts.env
26
27
  };
27
28
  },
28
29
  /**
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-preview.2",
7
+ "version": "1.0.7",
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.70",
59
+ "@github/copilot": "^1.0.71",
60
60
  "koffi": "^3.1.0",
61
61
  "vscode-jsonrpc": "^8.2.1",
62
62
  "zod": "^4.3.6"