@github/copilot-sdk 1.0.6 → 1.0.7-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.
- package/dist/cjs/client.js +166 -38
- package/dist/cjs/copilotRequestHandler.js +9 -0
- package/dist/cjs/ffiRuntimeHost.js +282 -0
- package/dist/cjs/generated/rpc.js +63 -15
- package/dist/cjs/types.js +12 -0
- package/dist/client.d.ts +49 -0
- package/dist/client.js +156 -38
- package/dist/copilotRequestHandler.d.ts +3 -0
- package/dist/copilotRequestHandler.js +9 -0
- package/dist/ffiRuntimeHost.d.ts +40 -0
- package/dist/ffiRuntimeHost.js +248 -0
- package/dist/generated/rpc.d.ts +459 -9
- package/dist/generated/rpc.js +63 -15
- package/dist/generated/session-events.d.ts +174 -1
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +60 -1
- package/dist/types.js +12 -0
- package/package.json +3 -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 | 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 | 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 | 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;
|
|
9
9
|
/**
|
|
10
10
|
* Hosting platform type of the repository (github or ado)
|
|
11
11
|
*/
|
|
@@ -461,6 +461,16 @@ export type SessionLimitsExhaustedResponseAction =
|
|
|
461
461
|
| "unset"
|
|
462
462
|
/** Leave the limit unchanged and cancel the blocked model request. */
|
|
463
463
|
| "cancel";
|
|
464
|
+
/**
|
|
465
|
+
* Coarse request-difficulty bucket for UX explainability
|
|
466
|
+
*/
|
|
467
|
+
export type AutoModeResolvedReasoningBucket =
|
|
468
|
+
/** The request looks low-reasoning; a lighter model is appropriate. */
|
|
469
|
+
"low"
|
|
470
|
+
/** The request needs a moderate amount of reasoning. */
|
|
471
|
+
| "medium"
|
|
472
|
+
/** The request looks high-reasoning; a stronger model is appropriate. */
|
|
473
|
+
| "high";
|
|
464
474
|
/**
|
|
465
475
|
* Exit plan mode action
|
|
466
476
|
*/
|
|
@@ -3150,6 +3160,10 @@ export interface AssistantMessageData {
|
|
|
3150
3160
|
* @experimental
|
|
3151
3161
|
*/
|
|
3152
3162
|
citations?: Citations;
|
|
3163
|
+
/**
|
|
3164
|
+
* Client-minted request id (x-request-id header) echoed by the server. Distinct from requestId (x-github-request-id) and serviceRequestId (x-copilot-service-request-id).
|
|
3165
|
+
*/
|
|
3166
|
+
clientRequestId?: string;
|
|
3153
3167
|
/**
|
|
3154
3168
|
* The assistant's text response content
|
|
3155
3169
|
*/
|
|
@@ -7497,6 +7511,66 @@ export interface SessionLimitsExhaustedResponse {
|
|
|
7497
7511
|
*/
|
|
7498
7512
|
maxAiCredits?: number;
|
|
7499
7513
|
}
|
|
7514
|
+
/**
|
|
7515
|
+
* Session event "session.auto_mode_resolved". Auto Intent resolution: the concrete model the session settled on for the first prompt of an auto-mode session, and why. Lets SDK clients render the chosen model and the full reason it was picked. The core selection fields (chosenModel/reasoningBucket/categoryScores) are stable; the routing-analytics fields (predictedLabel/confidence/candidateModels) mirror the upstream intent service and may evolve, hence the event's experimental stability.
|
|
7516
|
+
*/
|
|
7517
|
+
/** @experimental */
|
|
7518
|
+
export interface AutoModeResolvedEvent {
|
|
7519
|
+
/**
|
|
7520
|
+
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
|
|
7521
|
+
*/
|
|
7522
|
+
agentId?: string;
|
|
7523
|
+
data: AutoModeResolvedData;
|
|
7524
|
+
/**
|
|
7525
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
7526
|
+
*/
|
|
7527
|
+
ephemeral?: boolean;
|
|
7528
|
+
/**
|
|
7529
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
7530
|
+
*/
|
|
7531
|
+
id: string;
|
|
7532
|
+
/**
|
|
7533
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
7534
|
+
*/
|
|
7535
|
+
parentId: string | null;
|
|
7536
|
+
/**
|
|
7537
|
+
* ISO 8601 timestamp when the event was created
|
|
7538
|
+
*/
|
|
7539
|
+
timestamp: string;
|
|
7540
|
+
/**
|
|
7541
|
+
* Type discriminator. Always "session.auto_mode_resolved".
|
|
7542
|
+
*/
|
|
7543
|
+
type: "session.auto_mode_resolved";
|
|
7544
|
+
}
|
|
7545
|
+
/**
|
|
7546
|
+
* Auto Intent resolution: the concrete model the session settled on for the first prompt of an auto-mode session, and why. Lets SDK clients render the chosen model and the full reason it was picked. The core selection fields (chosenModel/reasoningBucket/categoryScores) are stable; the routing-analytics fields (predictedLabel/confidence/candidateModels) mirror the upstream intent service and may evolve, hence the event's experimental stability.
|
|
7547
|
+
*/
|
|
7548
|
+
/** @experimental */
|
|
7549
|
+
export interface AutoModeResolvedData {
|
|
7550
|
+
/**
|
|
7551
|
+
* Ordered candidate model list the router returned, when not a fallback
|
|
7552
|
+
*/
|
|
7553
|
+
candidateModels?: string[];
|
|
7554
|
+
/**
|
|
7555
|
+
* Per-category classifier scores (0-1) behind the bucket: the granular HYDRA capability scores (reasoning, code_gen, debugging, tool_use), or the binary needs_reasoning/no_reasoning scores when HYDRA didn't run. Lets clients show a breakdown rather than just the bucket.
|
|
7556
|
+
*/
|
|
7557
|
+
categoryScores?: {
|
|
7558
|
+
[k: string]: number | undefined;
|
|
7559
|
+
};
|
|
7560
|
+
/**
|
|
7561
|
+
* The concrete model the session will use after any intent refinement
|
|
7562
|
+
*/
|
|
7563
|
+
chosenModel: string;
|
|
7564
|
+
/**
|
|
7565
|
+
* Classifier confidence for the predicted label, when available
|
|
7566
|
+
*/
|
|
7567
|
+
confidence?: number;
|
|
7568
|
+
/**
|
|
7569
|
+
* The predicted classifier label (e.g. `needs_reasoning`), when available
|
|
7570
|
+
*/
|
|
7571
|
+
predictedLabel?: string;
|
|
7572
|
+
reasoningBucket?: AutoModeResolvedReasoningBucket;
|
|
7573
|
+
}
|
|
7500
7574
|
/**
|
|
7501
7575
|
* Session event "commands.changed". SDK command registration change notification
|
|
7502
7576
|
*/
|
|
@@ -8040,6 +8114,105 @@ export interface McpServerStatusChangedData {
|
|
|
8040
8114
|
serverName: string;
|
|
8041
8115
|
status: McpServerStatus;
|
|
8042
8116
|
}
|
|
8117
|
+
/**
|
|
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.
|
|
8119
|
+
*/
|
|
8120
|
+
export interface McpToolsListChangedEvent {
|
|
8121
|
+
/**
|
|
8122
|
+
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
|
|
8123
|
+
*/
|
|
8124
|
+
agentId?: string;
|
|
8125
|
+
data: McpListChangedData;
|
|
8126
|
+
/**
|
|
8127
|
+
* Always true for events that are transient and not persisted to the session event log on disk.
|
|
8128
|
+
*/
|
|
8129
|
+
ephemeral: true;
|
|
8130
|
+
/**
|
|
8131
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
8132
|
+
*/
|
|
8133
|
+
id: string;
|
|
8134
|
+
/**
|
|
8135
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
8136
|
+
*/
|
|
8137
|
+
parentId: string | null;
|
|
8138
|
+
/**
|
|
8139
|
+
* ISO 8601 timestamp when the event was created
|
|
8140
|
+
*/
|
|
8141
|
+
timestamp: string;
|
|
8142
|
+
/**
|
|
8143
|
+
* Type discriminator. Always "mcp.tools.list_changed".
|
|
8144
|
+
*/
|
|
8145
|
+
type: "mcp.tools.list_changed";
|
|
8146
|
+
}
|
|
8147
|
+
/**
|
|
8148
|
+
* Payload of MCP `list_changed` notification events, emitted when an MCP server announces at runtime that one of its advertised lists changed.
|
|
8149
|
+
*/
|
|
8150
|
+
export interface McpListChangedData {
|
|
8151
|
+
/**
|
|
8152
|
+
* Name of the MCP server whose list changed
|
|
8153
|
+
*/
|
|
8154
|
+
serverName: string;
|
|
8155
|
+
}
|
|
8156
|
+
/**
|
|
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.
|
|
8158
|
+
*/
|
|
8159
|
+
export interface McpResourcesListChangedEvent {
|
|
8160
|
+
/**
|
|
8161
|
+
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
|
|
8162
|
+
*/
|
|
8163
|
+
agentId?: string;
|
|
8164
|
+
data: McpListChangedData;
|
|
8165
|
+
/**
|
|
8166
|
+
* Always true for events that are transient and not persisted to the session event log on disk.
|
|
8167
|
+
*/
|
|
8168
|
+
ephemeral: true;
|
|
8169
|
+
/**
|
|
8170
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
8171
|
+
*/
|
|
8172
|
+
id: string;
|
|
8173
|
+
/**
|
|
8174
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
8175
|
+
*/
|
|
8176
|
+
parentId: string | null;
|
|
8177
|
+
/**
|
|
8178
|
+
* ISO 8601 timestamp when the event was created
|
|
8179
|
+
*/
|
|
8180
|
+
timestamp: string;
|
|
8181
|
+
/**
|
|
8182
|
+
* Type discriminator. Always "mcp.resources.list_changed".
|
|
8183
|
+
*/
|
|
8184
|
+
type: "mcp.resources.list_changed";
|
|
8185
|
+
}
|
|
8186
|
+
/**
|
|
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.
|
|
8188
|
+
*/
|
|
8189
|
+
export interface McpPromptsListChangedEvent {
|
|
8190
|
+
/**
|
|
8191
|
+
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
|
|
8192
|
+
*/
|
|
8193
|
+
agentId?: string;
|
|
8194
|
+
data: McpListChangedData;
|
|
8195
|
+
/**
|
|
8196
|
+
* Always true for events that are transient and not persisted to the session event log on disk.
|
|
8197
|
+
*/
|
|
8198
|
+
ephemeral: true;
|
|
8199
|
+
/**
|
|
8200
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
8201
|
+
*/
|
|
8202
|
+
id: string;
|
|
8203
|
+
/**
|
|
8204
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
8205
|
+
*/
|
|
8206
|
+
parentId: string | null;
|
|
8207
|
+
/**
|
|
8208
|
+
* ISO 8601 timestamp when the event was created
|
|
8209
|
+
*/
|
|
8210
|
+
timestamp: string;
|
|
8211
|
+
/**
|
|
8212
|
+
* Type discriminator. Always "mcp.prompts.list_changed".
|
|
8213
|
+
*/
|
|
8214
|
+
type: "mcp.prompts.list_changed";
|
|
8215
|
+
}
|
|
8043
8216
|
/**
|
|
8044
8217
|
* Session event "session.extensions_loaded". Payload of `session.extensions_loaded` listing discovered extensions and their statuses.
|
|
8045
8218
|
*/
|
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, 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, 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";
|
package/dist/types.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export interface TelemetryConfig {
|
|
|
63
63
|
* Configures how a {@link CopilotClient} connects to the Copilot runtime.
|
|
64
64
|
* Construct via the factory functions on {@link RuntimeConnection}.
|
|
65
65
|
*/
|
|
66
|
-
export type RuntimeConnection = StdioRuntimeConnection | TcpRuntimeConnection | UriRuntimeConnection;
|
|
66
|
+
export type RuntimeConnection = StdioRuntimeConnection | InProcessRuntimeConnection | TcpRuntimeConnection | UriRuntimeConnection;
|
|
67
67
|
/**
|
|
68
68
|
* Spawns a runtime child process and communicates over its stdin/stdout.
|
|
69
69
|
* This is the default if no {@link CopilotClientOptions.connection} is set.
|
|
@@ -75,6 +75,25 @@ export interface StdioRuntimeConnection {
|
|
|
75
75
|
/** Extra command-line arguments to pass to the runtime process. */
|
|
76
76
|
readonly args?: readonly string[];
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Hosts the runtime in-process by loading the native runtime library and speaking
|
|
80
|
+
* JSON-RPC over its C ABI (FFI), instead of spawning a runtime child process. The
|
|
81
|
+
* native host spawns the CLI worker itself. Construct via
|
|
82
|
+
* {@link RuntimeConnection.forInProcess}.
|
|
83
|
+
*
|
|
84
|
+
* @experimental The in-process (FFI) transport is experimental and its behavior may
|
|
85
|
+
* change. Per-client options that are lowered to environment variables — including
|
|
86
|
+
* {@link CopilotClientOptions.env}, {@link CopilotClientOptions.telemetry},
|
|
87
|
+
* {@link CopilotClientOptions.gitHubToken}, and
|
|
88
|
+
* {@link CopilotClientOptions.baseDirectory} — are **not** honored with this
|
|
89
|
+
* transport, because the native runtime loads into the shared host process and its
|
|
90
|
+
* worker inherits that process's ambient environment. To configure the in-process
|
|
91
|
+
* runtime, set the corresponding environment variables on the host process before
|
|
92
|
+
* constructing the client. See https://github.com/github/copilot-sdk/issues/1934.
|
|
93
|
+
*/
|
|
94
|
+
export interface InProcessRuntimeConnection {
|
|
95
|
+
readonly kind: "inprocess";
|
|
96
|
+
}
|
|
78
97
|
/**
|
|
79
98
|
* Spawns a runtime child process that listens on a TCP socket and connects to it.
|
|
80
99
|
*/
|
|
@@ -136,6 +155,16 @@ export declare const RuntimeConnection: {
|
|
|
136
155
|
readonly forUri: (url: string, opts?: {
|
|
137
156
|
connectionToken?: string;
|
|
138
157
|
}) => UriRuntimeConnection;
|
|
158
|
+
/**
|
|
159
|
+
* Host the runtime in-process over the native runtime library's C ABI (FFI).
|
|
160
|
+
*
|
|
161
|
+
* @experimental Per-client options lowered to environment variables (`env`,
|
|
162
|
+
* `telemetry`, `gitHubToken`, `baseDirectory`) are **not** honored in-process;
|
|
163
|
+
* the worker inherits the host process's ambient environment. Set the
|
|
164
|
+
* corresponding environment variables on the host process instead. See
|
|
165
|
+
* https://github.com/github/copilot-sdk/issues/1934.
|
|
166
|
+
*/
|
|
167
|
+
readonly forInProcess: () => InProcessRuntimeConnection;
|
|
139
168
|
};
|
|
140
169
|
/**
|
|
141
170
|
* Controls SDK defaults for ambient features.
|
|
@@ -1363,6 +1392,22 @@ export interface ExtensionInfo {
|
|
|
1363
1392
|
/** Stable provider name within the source namespace. */
|
|
1364
1393
|
name: string;
|
|
1365
1394
|
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Stable identity for a host/SDK connection that supplies built-in canvases.
|
|
1397
|
+
*
|
|
1398
|
+
* When set on session create or resume, the runtime uses {@link id} verbatim
|
|
1399
|
+
* as the agent-facing canvas extension id, so canvases declared on a control
|
|
1400
|
+
* connection survive stdio reconnect and CLI process restart instead of being
|
|
1401
|
+
* re-keyed to a per-connection id. The id is opaque to the runtime; a
|
|
1402
|
+
* per-window-stable value such as `app:builtin:<windowId>` is recommended. An
|
|
1403
|
+
* id beginning with `connection:` is reserved and ignored by the runtime.
|
|
1404
|
+
*/
|
|
1405
|
+
export interface CanvasProviderIdentity {
|
|
1406
|
+
/** Opaque, stable provider id used verbatim as the canvas extension id. */
|
|
1407
|
+
id: string;
|
|
1408
|
+
/** Optional display name surfaced as the canvas extension name. */
|
|
1409
|
+
name?: string;
|
|
1410
|
+
}
|
|
1366
1411
|
/**
|
|
1367
1412
|
* Provider-scoped options for the Copilot API (CAPI).
|
|
1368
1413
|
*
|
|
@@ -1490,6 +1535,13 @@ export interface SessionConfigBase {
|
|
|
1490
1535
|
* id instead of a reconnect-specific connection id.
|
|
1491
1536
|
*/
|
|
1492
1537
|
extensionInfo?: ExtensionInfo;
|
|
1538
|
+
/**
|
|
1539
|
+
* Stable identity for a host/SDK connection that supplies built-in
|
|
1540
|
+
* canvases. When set, the runtime uses `id` verbatim as the agent-facing
|
|
1541
|
+
* canvas extension id, so canvases declared on a control connection survive
|
|
1542
|
+
* reconnect and CLI restart. Honored on session create and resume.
|
|
1543
|
+
*/
|
|
1544
|
+
canvasProvider?: CanvasProviderIdentity;
|
|
1493
1545
|
/**
|
|
1494
1546
|
* Slash commands registered for this session.
|
|
1495
1547
|
* When the CLI has a TUI, each command appears as `/name` for the user to invoke.
|
|
@@ -1782,6 +1834,13 @@ export interface SessionConfigBase {
|
|
|
1782
1834
|
* the identity used for content exclusion, model routing, and quota checks.
|
|
1783
1835
|
*/
|
|
1784
1836
|
gitHubToken?: string;
|
|
1837
|
+
/**
|
|
1838
|
+
* Opt-in: when true, the runtime self-fetches enterprise managed settings
|
|
1839
|
+
* (bypass-permissions policy) at session bootstrap using the session's
|
|
1840
|
+
* `gitHubToken`. Requires {@link SessionConfigBase.gitHubToken} to be set;
|
|
1841
|
+
* if omitted, the runtime is expected to reject session creation (fail-closed).
|
|
1842
|
+
*/
|
|
1843
|
+
enableManagedSettings?: boolean;
|
|
1785
1844
|
/**
|
|
1786
1845
|
* When true, skips embedding-based retrieval for this session.
|
|
1787
1846
|
* Use in multitenant deployments to prevent cross-session information leakage
|
package/dist/types.js
CHANGED
|
@@ -31,6 +31,18 @@ const RuntimeConnection = {
|
|
|
31
31
|
*/
|
|
32
32
|
forUri(url, opts = {}) {
|
|
33
33
|
return { kind: "uri", url, connectionToken: opts.connectionToken };
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Host the runtime in-process over the native runtime library's C ABI (FFI).
|
|
37
|
+
*
|
|
38
|
+
* @experimental Per-client options lowered to environment variables (`env`,
|
|
39
|
+
* `telemetry`, `gitHubToken`, `baseDirectory`) are **not** honored in-process;
|
|
40
|
+
* the worker inherits the host process's ambient environment. Set the
|
|
41
|
+
* corresponding environment variables on the host process instead. See
|
|
42
|
+
* https://github.com/github/copilot-sdk/issues/1934.
|
|
43
|
+
*/
|
|
44
|
+
forInProcess() {
|
|
45
|
+
return { kind: "inprocess" };
|
|
34
46
|
}
|
|
35
47
|
};
|
|
36
48
|
function convertMcpCallToolResult(callResult) {
|
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.7-preview.1",
|
|
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,8 @@
|
|
|
56
56
|
"author": "GitHub",
|
|
57
57
|
"license": "MIT",
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@github/copilot": "^1.0.
|
|
59
|
+
"@github/copilot": "^1.0.70",
|
|
60
|
+
"koffi": "^3.1.0",
|
|
60
61
|
"vscode-jsonrpc": "^8.2.1",
|
|
61
62
|
"zod": "^4.3.6"
|
|
62
63
|
},
|