@github/copilot-sdk 1.0.9-preview.1 → 1.0.9-preview.2
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/README.md +1 -0
- package/dist/cjs/client.js +16 -6
- package/dist/cjs/generated/rpc.js +0 -5
- package/dist/client.js +16 -6
- package/dist/generated/rpc.d.ts +0 -13
- package/dist/generated/rpc.js +0 -5
- package/dist/generated/session-events.d.ts +1 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -135,6 +135,7 @@ Create a new conversation session.
|
|
|
135
135
|
- `tools?: Tool[]` - Custom tools exposed to the CLI. Tools without `handler` are declaration-only and must be resolved via pending tool-call RPCs.
|
|
136
136
|
- `systemMessage?: SystemMessageConfig` - System message customization (see below)
|
|
137
137
|
- `infiniteSessions?: InfiniteSessionConfig` - Configure automatic context compaction (see below)
|
|
138
|
+
- `enableSessionStore?: boolean` - Enables the cross-session store for search and retrieval across sessions. When unset in `"copilot-cli"` mode, the runtime default applies (enabled). In `"empty"` mode, defaults to disabled.
|
|
138
139
|
- `provider?: ProviderConfig` - Custom API provider configuration (BYOK - Bring Your Own Key). See [Custom Providers](#custom-providers) section.
|
|
139
140
|
- `onPermissionRequest?: PermissionHandler` - Optional handler called before each tool execution to approve or deny it. When omitted, permission requests are emitted as events and left pending for manual resolution. Use `approveAll` to allow everything, or provide a custom function for fine-grained control. See [Permission Handling](#permission-handling) section.
|
|
140
141
|
- `onUserInputRequest?: UserInputHandler` - Handler for user input requests from the agent. Enables the `ask_user` tool. See [User Input Requests](#user-input-requests) section.
|
package/dist/cjs/client.js
CHANGED
|
@@ -520,9 +520,6 @@ class CopilotClient {
|
|
|
520
520
|
}
|
|
521
521
|
setupClientGlobalHandlers() {
|
|
522
522
|
const handlers = {};
|
|
523
|
-
handlers.hooks = {
|
|
524
|
-
invoke: async (params) => await this.handleHooksInvoke(params)
|
|
525
|
-
};
|
|
526
523
|
if (this.requestHandler) {
|
|
527
524
|
handlers.llmInference = (0, import_copilotRequestHandler.createCopilotRequestAdapter)(this.requestHandler, () => {
|
|
528
525
|
if (!this.connection) {
|
|
@@ -917,7 +914,8 @@ class CopilotClient {
|
|
|
917
914
|
enableHostGitOperations: false,
|
|
918
915
|
enableSessionStore: false,
|
|
919
916
|
enableSkills: false,
|
|
920
|
-
memory: { enabled: false }
|
|
917
|
+
memory: { enabled: false },
|
|
918
|
+
customAgentsLocalOnly: true
|
|
921
919
|
};
|
|
922
920
|
}
|
|
923
921
|
return {};
|
|
@@ -1002,7 +1000,9 @@ class CopilotClient {
|
|
|
1002
1000
|
if (!this.connection) {
|
|
1003
1001
|
await this.start();
|
|
1004
1002
|
}
|
|
1005
|
-
|
|
1003
|
+
const modeDefaults = this.configDefaultsForMode();
|
|
1004
|
+
config = { ...modeDefaults, ...config };
|
|
1005
|
+
config.customAgentsLocalOnly ??= modeDefaults.customAgentsLocalOnly;
|
|
1006
1006
|
config.systemMessage = this.getSystemMessageConfigForMode(config.systemMessage);
|
|
1007
1007
|
const callerSessionId = config.sessionId;
|
|
1008
1008
|
const useServerGeneratedId = config.cloud != null && callerSessionId == null;
|
|
@@ -1120,6 +1120,7 @@ class CopilotClient {
|
|
|
1120
1120
|
mcpOAuthTokenStorage: config.mcpOAuthTokenStorage,
|
|
1121
1121
|
envValueMode: "direct",
|
|
1122
1122
|
customAgents: toWireCustomAgents(config.customAgents),
|
|
1123
|
+
customAgentsLocalOnly: config.customAgentsLocalOnly,
|
|
1123
1124
|
defaultAgent: config.defaultAgent,
|
|
1124
1125
|
agent: config.agent,
|
|
1125
1126
|
configDir: config.configDirectory,
|
|
@@ -1248,7 +1249,9 @@ class CopilotClient {
|
|
|
1248
1249
|
if (config.hooks) {
|
|
1249
1250
|
session.registerHooks(config.hooks);
|
|
1250
1251
|
}
|
|
1251
|
-
|
|
1252
|
+
const modeDefaults = this.configDefaultsForMode();
|
|
1253
|
+
config = { ...modeDefaults, ...config };
|
|
1254
|
+
config.customAgentsLocalOnly ??= modeDefaults.customAgentsLocalOnly;
|
|
1252
1255
|
config.systemMessage = this.getSystemMessageConfigForMode(config.systemMessage);
|
|
1253
1256
|
const { wirePayload: wireSystemMessage, transformCallbacks } = extractTransformCallbacks(
|
|
1254
1257
|
config.systemMessage
|
|
@@ -1331,6 +1334,7 @@ class CopilotClient {
|
|
|
1331
1334
|
mcpOAuthTokenStorage: config.mcpOAuthTokenStorage,
|
|
1332
1335
|
envValueMode: "direct",
|
|
1333
1336
|
customAgents: toWireCustomAgents(config.customAgents),
|
|
1337
|
+
customAgentsLocalOnly: config.customAgentsLocalOnly,
|
|
1334
1338
|
defaultAgent: config.defaultAgent,
|
|
1335
1339
|
agent: config.agent,
|
|
1336
1340
|
skillDirectories: config.skillDirectories,
|
|
@@ -2088,6 +2092,12 @@ stderr: ${stderrOutput}`
|
|
|
2088
2092
|
return session.clientSessionApis;
|
|
2089
2093
|
});
|
|
2090
2094
|
(0, import_rpc.registerClientGlobalApiHandlers)(this.connection, this.clientGlobalHandlers);
|
|
2095
|
+
this.connection.onRequest(
|
|
2096
|
+
"hooks.invoke",
|
|
2097
|
+
async (params) => {
|
|
2098
|
+
return await this.handleHooksInvoke(params);
|
|
2099
|
+
}
|
|
2100
|
+
);
|
|
2091
2101
|
this.connection.onClose(() => {
|
|
2092
2102
|
this.state = "disconnected";
|
|
2093
2103
|
});
|
|
@@ -2582,11 +2582,6 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
|
2582
2582
|
});
|
|
2583
2583
|
}
|
|
2584
2584
|
function registerClientGlobalApiHandlers(connection, handlers) {
|
|
2585
|
-
connection.onRequest("hooks.invoke", async (params) => {
|
|
2586
|
-
const handler = handlers.hooks;
|
|
2587
|
-
if (!handler) throw new Error("No hooks client-global handler registered");
|
|
2588
|
-
return handler.invoke(params);
|
|
2589
|
-
});
|
|
2590
2585
|
connection.onRequest("llmInference.httpRequestStart", async (params) => {
|
|
2591
2586
|
const handler = handlers.llmInference;
|
|
2592
2587
|
if (!handler) throw new Error("No llmInference client-global handler registered");
|
package/dist/client.js
CHANGED
|
@@ -497,9 +497,6 @@ class CopilotClient {
|
|
|
497
497
|
}
|
|
498
498
|
setupClientGlobalHandlers() {
|
|
499
499
|
const handlers = {};
|
|
500
|
-
handlers.hooks = {
|
|
501
|
-
invoke: async (params) => await this.handleHooksInvoke(params)
|
|
502
|
-
};
|
|
503
500
|
if (this.requestHandler) {
|
|
504
501
|
handlers.llmInference = createCopilotRequestAdapter(this.requestHandler, () => {
|
|
505
502
|
if (!this.connection) {
|
|
@@ -894,7 +891,8 @@ class CopilotClient {
|
|
|
894
891
|
enableHostGitOperations: false,
|
|
895
892
|
enableSessionStore: false,
|
|
896
893
|
enableSkills: false,
|
|
897
|
-
memory: { enabled: false }
|
|
894
|
+
memory: { enabled: false },
|
|
895
|
+
customAgentsLocalOnly: true
|
|
898
896
|
};
|
|
899
897
|
}
|
|
900
898
|
return {};
|
|
@@ -979,7 +977,9 @@ class CopilotClient {
|
|
|
979
977
|
if (!this.connection) {
|
|
980
978
|
await this.start();
|
|
981
979
|
}
|
|
982
|
-
|
|
980
|
+
const modeDefaults = this.configDefaultsForMode();
|
|
981
|
+
config = { ...modeDefaults, ...config };
|
|
982
|
+
config.customAgentsLocalOnly ??= modeDefaults.customAgentsLocalOnly;
|
|
983
983
|
config.systemMessage = this.getSystemMessageConfigForMode(config.systemMessage);
|
|
984
984
|
const callerSessionId = config.sessionId;
|
|
985
985
|
const useServerGeneratedId = config.cloud != null && callerSessionId == null;
|
|
@@ -1097,6 +1097,7 @@ class CopilotClient {
|
|
|
1097
1097
|
mcpOAuthTokenStorage: config.mcpOAuthTokenStorage,
|
|
1098
1098
|
envValueMode: "direct",
|
|
1099
1099
|
customAgents: toWireCustomAgents(config.customAgents),
|
|
1100
|
+
customAgentsLocalOnly: config.customAgentsLocalOnly,
|
|
1100
1101
|
defaultAgent: config.defaultAgent,
|
|
1101
1102
|
agent: config.agent,
|
|
1102
1103
|
configDir: config.configDirectory,
|
|
@@ -1225,7 +1226,9 @@ class CopilotClient {
|
|
|
1225
1226
|
if (config.hooks) {
|
|
1226
1227
|
session.registerHooks(config.hooks);
|
|
1227
1228
|
}
|
|
1228
|
-
|
|
1229
|
+
const modeDefaults = this.configDefaultsForMode();
|
|
1230
|
+
config = { ...modeDefaults, ...config };
|
|
1231
|
+
config.customAgentsLocalOnly ??= modeDefaults.customAgentsLocalOnly;
|
|
1229
1232
|
config.systemMessage = this.getSystemMessageConfigForMode(config.systemMessage);
|
|
1230
1233
|
const { wirePayload: wireSystemMessage, transformCallbacks } = extractTransformCallbacks(
|
|
1231
1234
|
config.systemMessage
|
|
@@ -1308,6 +1311,7 @@ class CopilotClient {
|
|
|
1308
1311
|
mcpOAuthTokenStorage: config.mcpOAuthTokenStorage,
|
|
1309
1312
|
envValueMode: "direct",
|
|
1310
1313
|
customAgents: toWireCustomAgents(config.customAgents),
|
|
1314
|
+
customAgentsLocalOnly: config.customAgentsLocalOnly,
|
|
1311
1315
|
defaultAgent: config.defaultAgent,
|
|
1312
1316
|
agent: config.agent,
|
|
1313
1317
|
skillDirectories: config.skillDirectories,
|
|
@@ -2065,6 +2069,12 @@ stderr: ${stderrOutput}`
|
|
|
2065
2069
|
return session.clientSessionApis;
|
|
2066
2070
|
});
|
|
2067
2071
|
registerClientGlobalApiHandlers(this.connection, this.clientGlobalHandlers);
|
|
2072
|
+
this.connection.onRequest(
|
|
2073
|
+
"hooks.invoke",
|
|
2074
|
+
async (params) => {
|
|
2075
|
+
return await this.handleHooksInvoke(params);
|
|
2076
|
+
}
|
|
2077
|
+
);
|
|
2068
2078
|
this.connection.onClose(() => {
|
|
2069
2079
|
this.state = "disconnected";
|
|
2070
2080
|
});
|
package/dist/generated/rpc.d.ts
CHANGED
|
@@ -20142,18 +20142,6 @@ export interface ClientSessionApiHandlers {
|
|
|
20142
20142
|
* function uses `getHandlers` to resolve the session's handlers.
|
|
20143
20143
|
*/
|
|
20144
20144
|
export declare function registerClientSessionApiHandlers(connection: MessageConnection, getHandlers: (sessionId: string) => ClientSessionApiHandlers): void;
|
|
20145
|
-
/** Handler for `hooks` client global API methods. */
|
|
20146
|
-
/** @experimental */
|
|
20147
|
-
export interface HooksHandler {
|
|
20148
|
-
/**
|
|
20149
|
-
* Dispatches one SDK callback hook from the runtime to the connection that registered it. Internal transport plumbing: clients opt in through session initialization and the Rust hook processor owns ordering, policy, timeout, and callback routing.
|
|
20150
|
-
*
|
|
20151
|
-
* @param params Runtime-owned wire payload for a server-to-client hook callback invocation.
|
|
20152
|
-
*
|
|
20153
|
-
* @returns Optional output returned by an SDK callback hook.
|
|
20154
|
-
*/
|
|
20155
|
-
invoke(params: HookInvokeRequest): Promise<HookInvokeResponse>;
|
|
20156
|
-
}
|
|
20157
20145
|
/** Handler for `llmInference` client global API methods. */
|
|
20158
20146
|
/** @experimental */
|
|
20159
20147
|
export interface LlmInferenceHandler {
|
|
@@ -20186,7 +20174,6 @@ export interface GitHubTelemetryHandler {
|
|
|
20186
20174
|
}
|
|
20187
20175
|
/** All client global API handler groups. */
|
|
20188
20176
|
export interface ClientGlobalApiHandlers {
|
|
20189
|
-
hooks?: HooksHandler;
|
|
20190
20177
|
llmInference?: LlmInferenceHandler;
|
|
20191
20178
|
gitHubTelemetry?: GitHubTelemetryHandler;
|
|
20192
20179
|
}
|
package/dist/generated/rpc.js
CHANGED
|
@@ -2554,11 +2554,6 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
|
2554
2554
|
});
|
|
2555
2555
|
}
|
|
2556
2556
|
function registerClientGlobalApiHandlers(connection, handlers) {
|
|
2557
|
-
connection.onRequest("hooks.invoke", async (params) => {
|
|
2558
|
-
const handler = handlers.hooks;
|
|
2559
|
-
if (!handler) throw new Error("No hooks client-global handler registered");
|
|
2560
|
-
return handler.invoke(params);
|
|
2561
|
-
});
|
|
2562
2557
|
connection.onRequest("llmInference.httpRequestStart", async (params) => {
|
|
2563
2558
|
const handler = handlers.llmInference;
|
|
2564
2559
|
if (!handler) throw new Error("No llmInference client-global handler registered");
|
|
@@ -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 |
|
|
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 | ToolSearchActivatedEvent | 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 | ManagedSettingsEnforcedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | FactoryRunUpdatedEvent | 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
|
*/
|
|
@@ -3025,23 +3025,6 @@ export interface AssistantTurnStartData {
|
|
|
3025
3025
|
*/
|
|
3026
3026
|
turnId: string;
|
|
3027
3027
|
}
|
|
3028
|
-
/**
|
|
3029
|
-
* Metadata for an additional model inference attempt within an existing assistant turn
|
|
3030
|
-
*/
|
|
3031
|
-
export interface AssistantTurnRetryData {
|
|
3032
|
-
/**
|
|
3033
|
-
* Model identifier used for this retry, when known
|
|
3034
|
-
*/
|
|
3035
|
-
model?: string;
|
|
3036
|
-
/**
|
|
3037
|
-
* Provider or runtime classification that caused the retry, when known
|
|
3038
|
-
*/
|
|
3039
|
-
reason?: string;
|
|
3040
|
-
/**
|
|
3041
|
-
* Identifier of the turn whose model inference is being retried
|
|
3042
|
-
*/
|
|
3043
|
-
turnId: string;
|
|
3044
|
-
}
|
|
3045
3028
|
/**
|
|
3046
3029
|
* Session event "assistant.intent". Agent intent description for current activity or plan
|
|
3047
3030
|
*/
|
|
@@ -4052,19 +4035,6 @@ export interface ModelCallFailureRequestFingerprint {
|
|
|
4052
4035
|
*/
|
|
4053
4036
|
toolResultMessageCount: number;
|
|
4054
4037
|
}
|
|
4055
|
-
/**
|
|
4056
|
-
* Model API dispatch metadata for internal telemetry
|
|
4057
|
-
*/
|
|
4058
|
-
export interface ModelCallStartData {
|
|
4059
|
-
/**
|
|
4060
|
-
* Model identifier used for this API call, when known
|
|
4061
|
-
*/
|
|
4062
|
-
model?: string;
|
|
4063
|
-
/**
|
|
4064
|
-
* Identifier of the assistant turn that initiated the model call
|
|
4065
|
-
*/
|
|
4066
|
-
turnId: string;
|
|
4067
|
-
}
|
|
4068
4038
|
/**
|
|
4069
4039
|
* Session event "abort". Turn abort information including the reason for termination
|
|
4070
4040
|
*/
|
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.9-preview.
|
|
7
|
+
"version": "1.0.9-preview.2",
|
|
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",
|