@github/copilot-sdk-win32-x64 1.0.17-preview.5 → 1.0.17-preview.6
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/copilot-sdk/client.d.ts +1 -0
- package/copilot-sdk/extension.d.ts +1 -1
- package/copilot-sdk/extension.js +278 -2
- package/copilot-sdk/generated/rpc.d.ts +381 -1
- package/copilot-sdk/generated/session-events.d.ts +14 -0
- package/copilot-sdk/index.d.ts +1 -1
- package/copilot-sdk/index.js +276 -2
- package/copilot-sdk/session.d.ts +7 -0
- package/copilot-sdk/types.d.ts +69 -0
- package/package.json +1 -1
- package/prebuilds/win32-x64/copilot-runtime.exe +0 -0
- package/prebuilds/win32-x64/dpapi.node +0 -0
- package/prebuilds/win32-x64/msal-node-runtime.node +0 -0
- package/prebuilds/win32-x64/msalruntime.dll +0 -0
- package/prebuilds/win32-x64/runtime.node +2 -2
- package/ripgrep/bin/win32-x64/rg.exe +0 -0
- package/schemas/api.schema.json +1270 -6
- package/schemas/session-events.schema.json +14 -0
- package/tgrep/bin/win32-x64/tgrep.exe +0 -0
package/copilot-sdk/client.d.ts
CHANGED
|
@@ -507,6 +507,7 @@ export declare class CopilotClient {
|
|
|
507
507
|
private handleUserInputRequest;
|
|
508
508
|
private handleExitPlanModeRequest;
|
|
509
509
|
private handleAutoModeSwitchRequest;
|
|
510
|
+
private resolveSkillProviderSession;
|
|
510
511
|
private handleHooksInvoke;
|
|
511
512
|
private handleSystemMessageTransform;
|
|
512
513
|
}
|
|
@@ -2,7 +2,7 @@ import type { CopilotSession } from "./session.js";
|
|
|
2
2
|
import { type PermissionHandler, type ResumeSessionConfig } from "./types.js";
|
|
3
3
|
import type { WorkflowHandle } from "./workflow.js";
|
|
4
4
|
export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js";
|
|
5
|
-
export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest" | "extensionSdkPath"> & {
|
|
5
|
+
export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest" | "extensionSdkPath" | "skillProvider"> & {
|
|
6
6
|
onPermissionRequest?: PermissionHandler;
|
|
7
7
|
/**
|
|
8
8
|
* Names of sensitive environment variables this extension needs, such as
|
package/copilot-sdk/extension.js
CHANGED
|
@@ -5004,6 +5004,37 @@ function createServerRpc(connection) {
|
|
|
5004
5004
|
* @returns Outcome of an agentRegistry.spawn call.
|
|
5005
5005
|
*/
|
|
5006
5006
|
spawn: async (params) => connection.sendRequest("agentRegistry.spawn", params)
|
|
5007
|
+
},
|
|
5008
|
+
/** @experimental */
|
|
5009
|
+
connectors: {
|
|
5010
|
+
/**
|
|
5011
|
+
* Returns feature availability.
|
|
5012
|
+
*
|
|
5013
|
+
* @returns Feature availability.
|
|
5014
|
+
*/
|
|
5015
|
+
getCapabilities: async () => connection.sendRequest("connectors.getCapabilities", {}),
|
|
5016
|
+
/**
|
|
5017
|
+
* Returns eligible accounts.
|
|
5018
|
+
*
|
|
5019
|
+
* @returns Eligible accounts.
|
|
5020
|
+
*/
|
|
5021
|
+
getAccounts: async () => connection.sendRequest("connectors.getAccounts", {}),
|
|
5022
|
+
/**
|
|
5023
|
+
* Lists entries for the selected account.
|
|
5024
|
+
*
|
|
5025
|
+
* @param params Selected account.
|
|
5026
|
+
*
|
|
5027
|
+
* @returns Entries for the selected account.
|
|
5028
|
+
*/
|
|
5029
|
+
list: async (params) => connection.sendRequest("connectors.list", params),
|
|
5030
|
+
/**
|
|
5031
|
+
* Refreshes entries for the selected account.
|
|
5032
|
+
*
|
|
5033
|
+
* @param params Selected account.
|
|
5034
|
+
*
|
|
5035
|
+
* @returns Entries for the selected account.
|
|
5036
|
+
*/
|
|
5037
|
+
refresh: async (params) => connection.sendRequest("connectors.refresh", params)
|
|
5007
5038
|
}
|
|
5008
5039
|
};
|
|
5009
5040
|
}
|
|
@@ -5059,6 +5090,110 @@ function createInternalServerRpc(connection) {
|
|
|
5059
5090
|
*/
|
|
5060
5091
|
connect: async (params) => connection.sendRequest("connect", params),
|
|
5061
5092
|
/** @experimental */
|
|
5093
|
+
agents: {
|
|
5094
|
+
/**
|
|
5095
|
+
* Lists the agents this runtime ships, by name. A consumer separating shipped agents from ones the user or a plugin authored should compare against these names rather than against `AgentInfo.source`: an authored agent may carry the `builtin` source while not being one of these, and the runtime treats the two as separate questions. `disableableNames` is the subset a user may turn off, which a client needs to decide whether to offer a toggle. `yamlBasedNames` is the subset backed by a shipped YAML definition, which a client needs before asking the runtime to load one.
|
|
5096
|
+
*
|
|
5097
|
+
* @returns The agents this runtime ships, named so a consumer can tell them apart from authored ones.
|
|
5098
|
+
*/
|
|
5099
|
+
getBuiltins: async () => connection.sendRequest("agents.getBuiltins", {}),
|
|
5100
|
+
/**
|
|
5101
|
+
* Lists the shipped agents a client should offer right now, filtered by the feature flags it passes. `getBuiltins` names every agent the runtime knows about; some of those are gated, so a client rendering a picker wants this narrower list together with the description to show beside each name.
|
|
5102
|
+
*
|
|
5103
|
+
* @param params The feature flags to evaluate shipped agents against.
|
|
5104
|
+
*
|
|
5105
|
+
* @returns The shipped agents available under the requested flags.
|
|
5106
|
+
*/
|
|
5107
|
+
getAvailableBuiltins: async (params) => connection.sendRequest("agents.getAvailableBuiltins", params),
|
|
5108
|
+
/**
|
|
5109
|
+
* Loads one shipped agent's YAML definition, for a client that needs what the agent declares rather than only its name. `getBuiltins` reports which names have a definition to load: a name outside its `yamlBasedNames` is special-cased in code and has none. The definition crosses as its own JSON rather than as contract-typed fields, because the runtime parses it with the agent schema's tolerant shape and re-typing it here would drop the keys that shape accepts and this one does not. The projected `__nativeCustomAgent` view the runtime derives is included, so a caller reading the declared model and a caller rendering the agent see the same definition.
|
|
5110
|
+
*
|
|
5111
|
+
* @param params The shipped agent whose definition to load.
|
|
5112
|
+
*
|
|
5113
|
+
* @returns One shipped agent's definition.
|
|
5114
|
+
*/
|
|
5115
|
+
getBuiltinDefinition: async (params) => connection.sendRequest("agents.getBuiltinDefinition", params),
|
|
5116
|
+
/**
|
|
5117
|
+
* Projects one shipped agent the way a picker lists it, reading only the metadata at the head of the definition file and stopping before the prompt body. `getBuiltinDefinition` answers the whole definition instead, so a client listing every shipped agent should prefer this one: the cost of a listing grows with the number of agents, and the prompt body is the part a listing never shows. The two also differ in shape. This returns the projected custom agent on its own, whereas `getBuiltinDefinition` returns the authored definition with that projection nested under `__nativeCustomAgent`.
|
|
5118
|
+
*
|
|
5119
|
+
* @param params The shipped agent whose listing entry to load.
|
|
5120
|
+
*
|
|
5121
|
+
* @returns One shipped agent, projected for a listing.
|
|
5122
|
+
*/
|
|
5123
|
+
getBuiltinListingDefinition: async (params) => connection.sendRequest("agents.getBuiltinListingDefinition", params),
|
|
5124
|
+
/**
|
|
5125
|
+
* Resolves the model a custom agent asks for against the models actually available, and answers both the model to switch to and the warning a user should see when the agent's preference cannot be met. A custom agent may name several acceptable models in preference order, so the decision is a match rather than a lookup, and an agent whose preference is unavailable is a normal outcome that produces a warning rather than an error. A host must call this rather than pick the first available name itself, because the preference order and the wording of the warning are what keep one installation's agent selection the same as another's.
|
|
5126
|
+
*
|
|
5127
|
+
* @param params The models a custom agent asks for, and the models actually available.
|
|
5128
|
+
*
|
|
5129
|
+
* @returns The model to switch to, and the warning to show when the agent's preference could not be met.
|
|
5130
|
+
*/
|
|
5131
|
+
customAgentInitialModelDecision: async (params) => connection.sendRequest("agents.customAgentInitialModelDecision", params)
|
|
5132
|
+
},
|
|
5133
|
+
/** @experimental */
|
|
5134
|
+
gitHubRepository: {
|
|
5135
|
+
/**
|
|
5136
|
+
* Resolves the GitHub repository that owns a working-tree path by reading the selected git remote configured for it, preferring `origin`. Returns a null `repository` when the path is inside a git working tree but that selected remote does not resolve to a GitHub host. Fails when the path is not inside a git working tree at all, so a caller can tell 'not a repository' apart from 'a repository with no GitHub remote'.
|
|
5137
|
+
*
|
|
5138
|
+
* @param params Working-tree path whose owning GitHub repository should be resolved.
|
|
5139
|
+
*
|
|
5140
|
+
* @returns The GitHub repository that owns the requested path, when the selected remote (`origin`, else the first) is on a GitHub host.
|
|
5141
|
+
*/
|
|
5142
|
+
atPath: async (params) => connection.sendRequest("gitHubRepository.atPath", params)
|
|
5143
|
+
},
|
|
5144
|
+
/** @experimental */
|
|
5145
|
+
gitHubOwners: {
|
|
5146
|
+
/**
|
|
5147
|
+
* Registers a cancellable owner listing and returns its request id. Separate from `gitHubOwners.list` so the id exists before the listing starts: a caller that abandons the listing the moment it begins would otherwise have nothing to name in `gitHubOwners.cancel`. The id serves one listing only. Long-abandoned unused ids can be released by later allocations.
|
|
5148
|
+
*
|
|
5149
|
+
* @returns A freshly registered request id. Registering it before the listing starts is what lets a cancel that races the request still find the owner listing slot. The id serves one listing only. Long-abandoned unused ids can be released by later allocations.
|
|
5150
|
+
*/
|
|
5151
|
+
nextRequestId: async () => connection.sendRequest("gitHubOwners.nextRequestId", {}),
|
|
5152
|
+
/**
|
|
5153
|
+
* Lists the logins the authenticated user may act as — their own account first, then the organizations they belong to — by asking the GitHub API under the supplied credential. No credential travels in the request: `authInfo` selects one the runtime already holds, and the runtime resolves the token and the GitHub host from it. A failure the caller should render arrives as `message`; one it should raise arrives as `throwError`.
|
|
5154
|
+
*
|
|
5155
|
+
* @param params Credential to list owners under, and the request id that makes the listing cancellable.
|
|
5156
|
+
*
|
|
5157
|
+
* @returns Outcome of an owner listing. Exactly one of `owners` and `message` is present, except that `throwError` reports a failure the caller is expected to raise rather than render.
|
|
5158
|
+
*/
|
|
5159
|
+
list: async (params) => connection.sendRequest("gitHubOwners.list", params),
|
|
5160
|
+
/**
|
|
5161
|
+
* Abandons an owner listing started with the given request id. Answers `canceled: true` while a listing with that id is running. Answers `canceled: false` when the id was never registered, was registered but not used, was released after being abandoned, or its listing has ended. Canceling an unused id releases it, and a later `list` with that id is refused. The cancel acts only on owner listings and never reaches another request of the host.
|
|
5162
|
+
*
|
|
5163
|
+
* @param params The owner listing to abandon.
|
|
5164
|
+
*
|
|
5165
|
+
* @returns Whether the id named a running owner listing.
|
|
5166
|
+
*/
|
|
5167
|
+
cancel: async (params) => connection.sendRequest("gitHubOwners.cancel", params)
|
|
5168
|
+
},
|
|
5169
|
+
/** @experimental */
|
|
5170
|
+
git: {
|
|
5171
|
+
/**
|
|
5172
|
+
* Reads the remote that the branch checked out in a working tree tracks, as `branch.<name>.remote` configures it. Reports `origin` rather than failing whenever there is no tracking configuration to read — on a detached HEAD, on a branch with no upstream, or when git itself fails — because a caller asking which remote to talk to needs an answer it can act on, not an error. Marked internal because it exists to carry a CLI call site off the napi boundary onto the SDK contract; it is migration plumbing, not a surface consumers are meant to depend on.
|
|
5173
|
+
*
|
|
5174
|
+
* @param params Working-tree path a git query applies to.
|
|
5175
|
+
*
|
|
5176
|
+
* @returns The remote the checked-out branch tracks.
|
|
5177
|
+
*/
|
|
5178
|
+
currentBranchRemote: async (params) => connection.sendRequest("git.currentBranchRemote", params),
|
|
5179
|
+
/**
|
|
5180
|
+
* Collects the repository context of a working directory in one call: working tree root, repository identifier and host, current branch, and the HEAD and base commits. Every repository field is omitted when the path is not inside a git working tree, and the requested path is echoed back as `cwd`. The answer is the same `SessionWorkingDirectoryContext` that `session.metadata.recordContextChange` accepts, so a caller polling for a context change can forward the result unchanged. Marked internal because it exists to carry a CLI call site off the napi boundary onto the SDK contract; it is migration plumbing, not a surface consumers are meant to depend on. It can become public once an SDK consumer needs to derive session context from a directory itself.
|
|
5181
|
+
*
|
|
5182
|
+
* @param params Working-tree path a git query applies to.
|
|
5183
|
+
*
|
|
5184
|
+
* @returns Updated working directory and git context. Emitted as the new payload of `session.context_changed`.
|
|
5185
|
+
*/
|
|
5186
|
+
workingDirectoryContext: async (params) => connection.sendRequest("git.workingDirectoryContext", params),
|
|
5187
|
+
/**
|
|
5188
|
+
* Lists the GitHub repositories a working tree's remotes point at, one entry per distinct repository, so a caller can resolve a base and head repository without parsing remote URLs itself. When several remotes name the same repository, only the first is listed, and the entry keeps that remote name. Remotes pointing at no GitHub host are left out, so an empty list means the tree reaches GitHub through no remote. Failing to read the remotes is reported as an error rather than as an empty list, because the two mean different things to a caller. Marked internal because it exists to carry a CLI call site off the napi boundary onto the SDK contract; it is migration plumbing, not a surface consumers are meant to depend on.
|
|
5189
|
+
*
|
|
5190
|
+
* @param params Git working tree whose GitHub remotes should be listed.
|
|
5191
|
+
*
|
|
5192
|
+
* @returns The GitHub repositories a working tree's remotes point at.
|
|
5193
|
+
*/
|
|
5194
|
+
reposFromRemotes: async (params) => connection.sendRequest("git.reposFromRemotes", params)
|
|
5195
|
+
},
|
|
5196
|
+
/** @experimental */
|
|
5062
5197
|
sessions: {
|
|
5063
5198
|
/**
|
|
5064
5199
|
* Reads lightweight persisted metadata for one local session without opening it.
|
|
@@ -5098,6 +5233,30 @@ function createInternalServerRpc(connection) {
|
|
|
5098
5233
|
* @param params Session ID to delete from disk.
|
|
5099
5234
|
*/
|
|
5100
5235
|
delete: async (params) => connection.sendRequest("sessions.delete", params),
|
|
5236
|
+
/**
|
|
5237
|
+
* Creates the workspace record for a session that has not been opened yet. A host that hands a session off to another application — writing the record and then launching that application against the session ID — needs the record on disk before any session exists to carry it, which the session-scoped workspace methods cannot do. Replaces any existing record and resets the checkpoint index. When writing to the local filesystem, a stored `fork_count` survives on disk. Returns the record it built, so a surviving stored `fork_count` can differ from the answer.
|
|
5238
|
+
*
|
|
5239
|
+
* @param params Identity, state location and starting context for a workspace record.
|
|
5240
|
+
*
|
|
5241
|
+
* @returns The workspace record that was written.
|
|
5242
|
+
*/
|
|
5243
|
+
createWorkspace: async (params) => connection.sendRequest("sessions.createWorkspace", params),
|
|
5244
|
+
/**
|
|
5245
|
+
* Reads a session's workspace record straight from disk, without opening the session. Resuming by session ID has to know where the session lives before it can connect, so the lookup cannot come from the session-scoped workspace methods, which resolve their location from a live session's context. Returns no record when the file is absent.
|
|
5246
|
+
*
|
|
5247
|
+
* @param params Where the session's state lives, as a root directory and the session ID under it.
|
|
5248
|
+
*
|
|
5249
|
+
* @returns The workspace record on disk, omitted when the session has none.
|
|
5250
|
+
*/
|
|
5251
|
+
loadWorkspace: async (params) => connection.sendRequest("sessions.loadWorkspace", params),
|
|
5252
|
+
/**
|
|
5253
|
+
* Merges fields into a session's workspace record on disk, creating the record when it is absent. The counterpart to `sessions.loadWorkspace`, for the same before-the-session-exists case. It preserves stored workspace-schema fields the request does not supply, does not preserve stored keys outside the workspace schema, and never replaces a stored `fork_count`.
|
|
5254
|
+
*
|
|
5255
|
+
* @param params Where the session's state lives, plus workspace-schema fields to merge into its workspace record. Stored keys outside the schema are not preserved, and a stored `fork_count` is never replaced.
|
|
5256
|
+
*
|
|
5257
|
+
* @returns The merge completed. The record carries the supplied workspace-schema fields, but a stored `fork_count` stays.
|
|
5258
|
+
*/
|
|
5259
|
+
updateWorkspaceFields: async (params) => connection.sendRequest("sessions.updateWorkspaceFields", params),
|
|
5101
5260
|
/**
|
|
5102
5261
|
* Gets the dynamic-context board entry count associated with a session, when available. Internal: this exists solely so CLI telemetry events (`rem_spawn_gate`, `rem_consolidation_complete`) can pair START / END board counts around the detached rem-agent spawn. "Dynamic context board" is a runtime-internal concept that is not part of the public SDK contract; the long-term plan is to relocate the telemetry emission into the runtime so this method can be deleted entirely.
|
|
5103
5262
|
*
|
|
@@ -7431,6 +7590,12 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
7431
7590
|
},
|
|
7432
7591
|
/** @experimental */
|
|
7433
7592
|
mcp: {
|
|
7593
|
+
/**
|
|
7594
|
+
* Records the IDE the host is connected to, so the agent's system prompt can name it and its workspace folder. Null or an omitted `ide` clears the recorded value, which is how a host reports that it is disconnected; there is no separate clear method. Both `ideName` and `workspaceFolder` are required together, because half a state cannot be attributed to a project.
|
|
7595
|
+
*
|
|
7596
|
+
* @param params Records which IDE the host is connected to, or clears it.
|
|
7597
|
+
*/
|
|
7598
|
+
setConnectedIdeInfo: async (params) => connection.sendRequest("session.mcp.setConnectedIdeInfo", { ...params, sessionId }),
|
|
7434
7599
|
/**
|
|
7435
7600
|
* Reloads MCP server connections for the session with an explicit host-provided configuration.
|
|
7436
7601
|
*
|
|
@@ -9202,6 +9367,7 @@ var CopilotSession = class {
|
|
|
9202
9367
|
elicitationHandler;
|
|
9203
9368
|
exitPlanModeHandler;
|
|
9204
9369
|
autoModeSwitchHandler;
|
|
9370
|
+
skillProvider;
|
|
9205
9371
|
hooks;
|
|
9206
9372
|
transformCallbacks;
|
|
9207
9373
|
_rpc = null;
|
|
@@ -9614,6 +9780,7 @@ var CopilotSession = class {
|
|
|
9614
9780
|
this.elicitationHandler = void 0;
|
|
9615
9781
|
this.exitPlanModeHandler = void 0;
|
|
9616
9782
|
this.autoModeSwitchHandler = void 0;
|
|
9783
|
+
this.skillProvider = void 0;
|
|
9617
9784
|
this.commandHandlers.clear();
|
|
9618
9785
|
this.canvases.clear();
|
|
9619
9786
|
this.workflows.clear();
|
|
@@ -10520,6 +10687,68 @@ var CopilotSession = class {
|
|
|
10520
10687
|
registerUserInputHandler(handler) {
|
|
10521
10688
|
this.userInputHandler = handler;
|
|
10522
10689
|
}
|
|
10690
|
+
/**
|
|
10691
|
+
* Registers the session's skill provider.
|
|
10692
|
+
*
|
|
10693
|
+
* @param provider - The skill provider, or undefined to remove it
|
|
10694
|
+
* @internal This method is typically called internally when creating a session.
|
|
10695
|
+
*/
|
|
10696
|
+
registerSkillProvider(provider) {
|
|
10697
|
+
this.skillProvider = provider;
|
|
10698
|
+
}
|
|
10699
|
+
/**
|
|
10700
|
+
* Handles a `skillProvider.list` request from the runtime.
|
|
10701
|
+
*
|
|
10702
|
+
* @internal This method is for internal use by the SDK.
|
|
10703
|
+
*/
|
|
10704
|
+
async _handleSkillProviderList(token) {
|
|
10705
|
+
const provider = this.requireSkillProvider();
|
|
10706
|
+
return await this.callSkillProvider("listSkills", token, async (options) => ({
|
|
10707
|
+
skills: await provider.listSkills(options) ?? []
|
|
10708
|
+
}));
|
|
10709
|
+
}
|
|
10710
|
+
/**
|
|
10711
|
+
* Handles a `skillProvider.read` request from the runtime.
|
|
10712
|
+
*
|
|
10713
|
+
* @internal This method is for internal use by the SDK.
|
|
10714
|
+
*/
|
|
10715
|
+
async _handleSkillProviderRead(name, token) {
|
|
10716
|
+
const provider = this.requireSkillProvider();
|
|
10717
|
+
return await this.callSkillProvider("readSkill", token, async (options) => ({
|
|
10718
|
+
markdown: await provider.readSkill(name, options) ?? null
|
|
10719
|
+
}));
|
|
10720
|
+
}
|
|
10721
|
+
requireSkillProvider() {
|
|
10722
|
+
if (!this.skillProvider) {
|
|
10723
|
+
throw new Error(`No skill provider for session: ${this.sessionId}`);
|
|
10724
|
+
}
|
|
10725
|
+
return this.skillProvider;
|
|
10726
|
+
}
|
|
10727
|
+
/**
|
|
10728
|
+
* Runs a provider call with an abort signal tied to the runtime's request
|
|
10729
|
+
* cancellation. Failures are logged locally and reported generically.
|
|
10730
|
+
*/
|
|
10731
|
+
async callSkillProvider(operation, token, call) {
|
|
10732
|
+
const controller = new AbortController();
|
|
10733
|
+
const subscription = token?.onCancellationRequested(() => controller.abort());
|
|
10734
|
+
if (token?.isCancellationRequested) {
|
|
10735
|
+
controller.abort();
|
|
10736
|
+
}
|
|
10737
|
+
try {
|
|
10738
|
+
return await call({ signal: controller.signal });
|
|
10739
|
+
} catch (error) {
|
|
10740
|
+
if (controller.signal.aborted) {
|
|
10741
|
+
throw new import_node.ResponseError(-32800, `Skill provider ${operation} cancelled`);
|
|
10742
|
+
}
|
|
10743
|
+
console.error(`Skill provider ${operation} failed`, {
|
|
10744
|
+
sessionId: this.sessionId,
|
|
10745
|
+
error
|
|
10746
|
+
});
|
|
10747
|
+
throw skillProviderFailure(operation);
|
|
10748
|
+
} finally {
|
|
10749
|
+
subscription?.dispose();
|
|
10750
|
+
}
|
|
10751
|
+
}
|
|
10523
10752
|
/**
|
|
10524
10753
|
* Registers hook handlers for session lifecycle events.
|
|
10525
10754
|
*
|
|
@@ -10873,6 +11102,9 @@ function toCanvasRpcError(error) {
|
|
|
10873
11102
|
const message = error instanceof Error ? error.message : String(error);
|
|
10874
11103
|
return new import_node.ResponseError(import_node.ErrorCodes.InternalError, message, { code, message });
|
|
10875
11104
|
}
|
|
11105
|
+
function skillProviderFailure(operation) {
|
|
11106
|
+
return new import_node.ResponseError(import_node.ErrorCodes.InternalError, `Skill provider ${operation} failed`);
|
|
11107
|
+
}
|
|
10876
11108
|
function strictJsonValidationError(context, category, message, path) {
|
|
10877
11109
|
return new import_node.ResponseError(import_node.ErrorCodes.InternalError, message, {
|
|
10878
11110
|
code: context.code,
|
|
@@ -12554,6 +12786,9 @@ var CopilotClient = class _CopilotClient {
|
|
|
12554
12786
|
if (config.gitHubToken !== void 0 && config.gitHubTokenProvider !== void 0) {
|
|
12555
12787
|
throw new Error("gitHubToken and gitHubTokenProvider are mutually exclusive");
|
|
12556
12788
|
}
|
|
12789
|
+
if (config.cloud != null && config.skillProvider) {
|
|
12790
|
+
throw new Error("Skill providers are not supported for cloud sessions.");
|
|
12791
|
+
}
|
|
12557
12792
|
if (!this.connection) {
|
|
12558
12793
|
await this.start();
|
|
12559
12794
|
}
|
|
@@ -12613,6 +12848,9 @@ var CopilotClient = class _CopilotClient {
|
|
|
12613
12848
|
if (config.hooks) {
|
|
12614
12849
|
s.registerHooks(config.hooks);
|
|
12615
12850
|
}
|
|
12851
|
+
if (config.skillProvider) {
|
|
12852
|
+
s.registerSkillProvider(config.skillProvider);
|
|
12853
|
+
}
|
|
12616
12854
|
if (transformCallbacks) {
|
|
12617
12855
|
s.registerTransformCallbacks(transformCallbacks);
|
|
12618
12856
|
}
|
|
@@ -12719,6 +12957,7 @@ var CopilotClient = class _CopilotClient {
|
|
|
12719
12957
|
enableSessionStore: config.enableSessionStore,
|
|
12720
12958
|
enableSkills: config.enableSkills,
|
|
12721
12959
|
skillDirectories: config.skillDirectories,
|
|
12960
|
+
...config.skillProvider ? { hasSkillProvider: true } : {},
|
|
12722
12961
|
pluginDirectories: config.pluginDirectories,
|
|
12723
12962
|
instructionDirectories: config.instructionDirectories,
|
|
12724
12963
|
disabledSkills: config.disabledSkills,
|
|
@@ -12872,6 +13111,9 @@ var CopilotClient = class _CopilotClient {
|
|
|
12872
13111
|
if (config.hooks) {
|
|
12873
13112
|
session.registerHooks(config.hooks);
|
|
12874
13113
|
}
|
|
13114
|
+
if (config.skillProvider) {
|
|
13115
|
+
session.registerSkillProvider(config.skillProvider);
|
|
13116
|
+
}
|
|
12875
13117
|
const modeDefaults = this.configDefaultsForMode();
|
|
12876
13118
|
config = { ...modeDefaults, ...config };
|
|
12877
13119
|
config.customAgentsLocalOnly ??= modeDefaults.customAgentsLocalOnly;
|
|
@@ -12885,9 +13127,10 @@ var CopilotClient = class _CopilotClient {
|
|
|
12885
13127
|
if (config.onEvent) {
|
|
12886
13128
|
session.on(config.onEvent);
|
|
12887
13129
|
}
|
|
13130
|
+
const toolFilterOptions = this.resolveToolFilterOptions(config);
|
|
12888
13131
|
this.setupSessionFs(session, config);
|
|
13132
|
+
const replacedSession = this.sessions.get(sessionId);
|
|
12889
13133
|
this.sessions.set(sessionId, session);
|
|
12890
|
-
const toolFilterOptions = this.resolveToolFilterOptions(config);
|
|
12891
13134
|
const gitHubTokenProviderRegistrationId = this.registerGitHubTokenProvider(
|
|
12892
13135
|
config.gitHubTokenProvider,
|
|
12893
13136
|
sessionId
|
|
@@ -12980,6 +13223,7 @@ var CopilotClient = class _CopilotClient {
|
|
|
12980
13223
|
defaultAgent: config.defaultAgent,
|
|
12981
13224
|
agent: config.agent,
|
|
12982
13225
|
skillDirectories: config.skillDirectories,
|
|
13226
|
+
...config.skillProvider ? { hasSkillProvider: true } : {},
|
|
12983
13227
|
pluginDirectories: config.pluginDirectories,
|
|
12984
13228
|
instructionDirectories: config.instructionDirectories,
|
|
12985
13229
|
disabledSkills: config.disabledSkills,
|
|
@@ -13024,7 +13268,13 @@ var CopilotClient = class _CopilotClient {
|
|
|
13024
13268
|
this.commitGitHubTokenProvider(sessionId, gitHubTokenProviderRegistrationId);
|
|
13025
13269
|
} catch (e) {
|
|
13026
13270
|
session._markDisconnected();
|
|
13027
|
-
this.sessions.
|
|
13271
|
+
if (this.sessions.get(sessionId) === session) {
|
|
13272
|
+
if (replacedSession) {
|
|
13273
|
+
this.sessions.set(sessionId, replacedSession);
|
|
13274
|
+
} else {
|
|
13275
|
+
this.sessions.delete(sessionId);
|
|
13276
|
+
}
|
|
13277
|
+
}
|
|
13028
13278
|
if (gitHubTokenProviderRegistrationId !== void 0) {
|
|
13029
13279
|
this.githubTokenProviders.delete(gitHubTokenProviderRegistrationId);
|
|
13030
13280
|
}
|
|
@@ -14000,6 +14250,20 @@ stderr: ${stderrOutput}` : ""}`
|
|
|
14000
14250
|
return await this.handleHooksInvoke(params);
|
|
14001
14251
|
}
|
|
14002
14252
|
);
|
|
14253
|
+
this.connection.onRequest(
|
|
14254
|
+
"skillProvider.list",
|
|
14255
|
+
async (params, token) => await this.resolveSkillProviderSession(params)._handleSkillProviderList(token)
|
|
14256
|
+
);
|
|
14257
|
+
this.connection.onRequest(
|
|
14258
|
+
"skillProvider.read",
|
|
14259
|
+
async (params, token) => {
|
|
14260
|
+
const session = this.resolveSkillProviderSession(params);
|
|
14261
|
+
if (typeof params.name !== "string") {
|
|
14262
|
+
throw new Error("Invalid skillProvider.read payload");
|
|
14263
|
+
}
|
|
14264
|
+
return await session._handleSkillProviderRead(params.name, token);
|
|
14265
|
+
}
|
|
14266
|
+
);
|
|
14003
14267
|
const connection = this.connection;
|
|
14004
14268
|
const messageWriter = this.messageWriter;
|
|
14005
14269
|
const cliProcess = this.isExternalServer ? null : this.cliProcess;
|
|
@@ -14156,6 +14420,16 @@ stderr: ${stderrOutput}` : ""}`
|
|
|
14156
14420
|
});
|
|
14157
14421
|
return { response };
|
|
14158
14422
|
}
|
|
14423
|
+
resolveSkillProviderSession(params) {
|
|
14424
|
+
if (!params || typeof params.sessionId !== "string") {
|
|
14425
|
+
throw new Error("Invalid skillProvider payload");
|
|
14426
|
+
}
|
|
14427
|
+
const session = this.sessions.get(params.sessionId);
|
|
14428
|
+
if (!session) {
|
|
14429
|
+
throw new Error(`Session not found: ${params.sessionId}`);
|
|
14430
|
+
}
|
|
14431
|
+
return session;
|
|
14432
|
+
}
|
|
14159
14433
|
async handleHooksInvoke(params) {
|
|
14160
14434
|
if (!params || typeof params.sessionId !== "string" || typeof params.hookType !== "string") {
|
|
14161
14435
|
throw new Error("Invalid hooks invoke payload");
|
|
@@ -14190,11 +14464,13 @@ async function joinSession(config = {}) {
|
|
|
14190
14464
|
const client = new CopilotClient({ _internalConnection: { kind: "parent-process" } });
|
|
14191
14465
|
const {
|
|
14192
14466
|
extensionSdkPath: _stripped,
|
|
14467
|
+
skillProvider: _strippedSkillProvider,
|
|
14193
14468
|
workflows,
|
|
14194
14469
|
requestedEnvironmentVariables,
|
|
14195
14470
|
...rest
|
|
14196
14471
|
} = config;
|
|
14197
14472
|
void _stripped;
|
|
14473
|
+
void _strippedSkillProvider;
|
|
14198
14474
|
return client.resumeSessionForExtension(
|
|
14199
14475
|
sessionId,
|
|
14200
14476
|
{
|