@github/copilot-sdk-win32-x64 1.0.17-preview.7 → 1.0.17-unstable.37397886721.gad270aa
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 +0 -1
- package/copilot-sdk/extension.d.ts +1 -1
- package/copilot-sdk/extension.js +3 -285
- package/copilot-sdk/generated/rpc.d.ts +7 -502
- package/copilot-sdk/generated/session-events.d.ts +1 -15
- package/copilot-sdk/index.d.ts +1 -1
- package/copilot-sdk/index.js +3 -283
- package/copilot-sdk/session.d.ts +0 -7
- package/copilot-sdk/types.d.ts +0 -69
- 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 +12 -1460
- package/schemas/session-events.schema.json +1 -15
- package/tgrep/bin/win32-x64/tgrep.exe +0 -0
package/copilot-sdk/client.d.ts
CHANGED
|
@@ -507,7 +507,6 @@ export declare class CopilotClient {
|
|
|
507
507
|
private handleUserInputRequest;
|
|
508
508
|
private handleExitPlanModeRequest;
|
|
509
509
|
private handleAutoModeSwitchRequest;
|
|
510
|
-
private resolveSkillProviderSession;
|
|
511
510
|
private handleHooksInvoke;
|
|
512
511
|
private handleSystemMessageTransform;
|
|
513
512
|
}
|
|
@@ -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"> & {
|
|
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,37 +5004,6 @@ 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)
|
|
5038
5007
|
}
|
|
5039
5008
|
};
|
|
5040
5009
|
}
|
|
@@ -5090,110 +5059,6 @@ function createInternalServerRpc(connection) {
|
|
|
5090
5059
|
*/
|
|
5091
5060
|
connect: async (params) => connection.sendRequest("connect", params),
|
|
5092
5061
|
/** @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 */
|
|
5197
5062
|
sessions: {
|
|
5198
5063
|
/**
|
|
5199
5064
|
* Reads lightweight persisted metadata for one local session without opening it.
|
|
@@ -5233,30 +5098,6 @@ function createInternalServerRpc(connection) {
|
|
|
5233
5098
|
* @param params Session ID to delete from disk.
|
|
5234
5099
|
*/
|
|
5235
5100
|
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),
|
|
5260
5101
|
/**
|
|
5261
5102
|
* 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.
|
|
5262
5103
|
*
|
|
@@ -6131,17 +5972,11 @@ function createSessionRpc(connection, sessionId) {
|
|
|
6131
5972
|
/** @experimental */
|
|
6132
5973
|
mcp: {
|
|
6133
5974
|
/**
|
|
6134
|
-
* Lists
|
|
5975
|
+
* Lists MCP servers configured for the session, their connection status, and host-level state. The host-level state (disabled/filtered servers, failed/needs-auth/pending connections, mcp3p policy, full config) is empty/zero when no MCP host has been initialized for the session.
|
|
6135
5976
|
*
|
|
6136
5977
|
* @returns MCP servers configured for the session, with their connection status and host-level state.
|
|
6137
5978
|
*/
|
|
6138
5979
|
list: async () => connection.sendRequest("session.mcp.list", { sessionId }),
|
|
6139
|
-
/**
|
|
6140
|
-
* Lists effective MCP configuration without starting, restarting, authenticating, or waiting for servers. An optional live observation is from an already materialized matching server; this is not a readiness guarantee.
|
|
6141
|
-
*
|
|
6142
|
-
* @returns Effective MCP configuration with optional live observations from matching already materialized servers.
|
|
6143
|
-
*/
|
|
6144
|
-
listConfigured: async () => connection.sendRequest("session.mcp.listConfigured", { sessionId }),
|
|
6145
5980
|
/**
|
|
6146
5981
|
* Lists the tools exposed by a connected MCP server on this session's host. This performs a live `tools/list` request. Tool UI metadata is returned independently of whether MCP Apps rendering is enabled for the session.
|
|
6147
5982
|
*
|
|
@@ -7590,12 +7425,6 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
7590
7425
|
},
|
|
7591
7426
|
/** @experimental */
|
|
7592
7427
|
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 }),
|
|
7599
7428
|
/**
|
|
7600
7429
|
* Reloads MCP server connections for the session with an explicit host-provided configuration.
|
|
7601
7430
|
*
|
|
@@ -9367,7 +9196,6 @@ var CopilotSession = class {
|
|
|
9367
9196
|
elicitationHandler;
|
|
9368
9197
|
exitPlanModeHandler;
|
|
9369
9198
|
autoModeSwitchHandler;
|
|
9370
|
-
skillProvider;
|
|
9371
9199
|
hooks;
|
|
9372
9200
|
transformCallbacks;
|
|
9373
9201
|
_rpc = null;
|
|
@@ -9780,7 +9608,6 @@ var CopilotSession = class {
|
|
|
9780
9608
|
this.elicitationHandler = void 0;
|
|
9781
9609
|
this.exitPlanModeHandler = void 0;
|
|
9782
9610
|
this.autoModeSwitchHandler = void 0;
|
|
9783
|
-
this.skillProvider = void 0;
|
|
9784
9611
|
this.commandHandlers.clear();
|
|
9785
9612
|
this.canvases.clear();
|
|
9786
9613
|
this.workflows.clear();
|
|
@@ -10687,68 +10514,6 @@ var CopilotSession = class {
|
|
|
10687
10514
|
registerUserInputHandler(handler) {
|
|
10688
10515
|
this.userInputHandler = handler;
|
|
10689
10516
|
}
|
|
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
|
-
}
|
|
10752
10517
|
/**
|
|
10753
10518
|
* Registers hook handlers for session lifecycle events.
|
|
10754
10519
|
*
|
|
@@ -11102,9 +10867,6 @@ function toCanvasRpcError(error) {
|
|
|
11102
10867
|
const message = error instanceof Error ? error.message : String(error);
|
|
11103
10868
|
return new import_node.ResponseError(import_node.ErrorCodes.InternalError, message, { code, message });
|
|
11104
10869
|
}
|
|
11105
|
-
function skillProviderFailure(operation) {
|
|
11106
|
-
return new import_node.ResponseError(import_node.ErrorCodes.InternalError, `Skill provider ${operation} failed`);
|
|
11107
|
-
}
|
|
11108
10870
|
function strictJsonValidationError(context, category, message, path) {
|
|
11109
10871
|
return new import_node.ResponseError(import_node.ErrorCodes.InternalError, message, {
|
|
11110
10872
|
code: context.code,
|
|
@@ -12786,9 +12548,6 @@ var CopilotClient = class _CopilotClient {
|
|
|
12786
12548
|
if (config.gitHubToken !== void 0 && config.gitHubTokenProvider !== void 0) {
|
|
12787
12549
|
throw new Error("gitHubToken and gitHubTokenProvider are mutually exclusive");
|
|
12788
12550
|
}
|
|
12789
|
-
if (config.cloud != null && config.skillProvider) {
|
|
12790
|
-
throw new Error("Skill providers are not supported for cloud sessions.");
|
|
12791
|
-
}
|
|
12792
12551
|
if (!this.connection) {
|
|
12793
12552
|
await this.start();
|
|
12794
12553
|
}
|
|
@@ -12848,9 +12607,6 @@ var CopilotClient = class _CopilotClient {
|
|
|
12848
12607
|
if (config.hooks) {
|
|
12849
12608
|
s.registerHooks(config.hooks);
|
|
12850
12609
|
}
|
|
12851
|
-
if (config.skillProvider) {
|
|
12852
|
-
s.registerSkillProvider(config.skillProvider);
|
|
12853
|
-
}
|
|
12854
12610
|
if (transformCallbacks) {
|
|
12855
12611
|
s.registerTransformCallbacks(transformCallbacks);
|
|
12856
12612
|
}
|
|
@@ -12957,7 +12713,6 @@ var CopilotClient = class _CopilotClient {
|
|
|
12957
12713
|
enableSessionStore: config.enableSessionStore,
|
|
12958
12714
|
enableSkills: config.enableSkills,
|
|
12959
12715
|
skillDirectories: config.skillDirectories,
|
|
12960
|
-
...config.skillProvider ? { hasSkillProvider: true } : {},
|
|
12961
12716
|
pluginDirectories: config.pluginDirectories,
|
|
12962
12717
|
instructionDirectories: config.instructionDirectories,
|
|
12963
12718
|
disabledSkills: config.disabledSkills,
|
|
@@ -13111,9 +12866,6 @@ var CopilotClient = class _CopilotClient {
|
|
|
13111
12866
|
if (config.hooks) {
|
|
13112
12867
|
session.registerHooks(config.hooks);
|
|
13113
12868
|
}
|
|
13114
|
-
if (config.skillProvider) {
|
|
13115
|
-
session.registerSkillProvider(config.skillProvider);
|
|
13116
|
-
}
|
|
13117
12869
|
const modeDefaults = this.configDefaultsForMode();
|
|
13118
12870
|
config = { ...modeDefaults, ...config };
|
|
13119
12871
|
config.customAgentsLocalOnly ??= modeDefaults.customAgentsLocalOnly;
|
|
@@ -13127,10 +12879,9 @@ var CopilotClient = class _CopilotClient {
|
|
|
13127
12879
|
if (config.onEvent) {
|
|
13128
12880
|
session.on(config.onEvent);
|
|
13129
12881
|
}
|
|
13130
|
-
const toolFilterOptions = this.resolveToolFilterOptions(config);
|
|
13131
12882
|
this.setupSessionFs(session, config);
|
|
13132
|
-
const replacedSession = this.sessions.get(sessionId);
|
|
13133
12883
|
this.sessions.set(sessionId, session);
|
|
12884
|
+
const toolFilterOptions = this.resolveToolFilterOptions(config);
|
|
13134
12885
|
const gitHubTokenProviderRegistrationId = this.registerGitHubTokenProvider(
|
|
13135
12886
|
config.gitHubTokenProvider,
|
|
13136
12887
|
sessionId
|
|
@@ -13223,7 +12974,6 @@ var CopilotClient = class _CopilotClient {
|
|
|
13223
12974
|
defaultAgent: config.defaultAgent,
|
|
13224
12975
|
agent: config.agent,
|
|
13225
12976
|
skillDirectories: config.skillDirectories,
|
|
13226
|
-
...config.skillProvider ? { hasSkillProvider: true } : {},
|
|
13227
12977
|
pluginDirectories: config.pluginDirectories,
|
|
13228
12978
|
instructionDirectories: config.instructionDirectories,
|
|
13229
12979
|
disabledSkills: config.disabledSkills,
|
|
@@ -13268,13 +13018,7 @@ var CopilotClient = class _CopilotClient {
|
|
|
13268
13018
|
this.commitGitHubTokenProvider(sessionId, gitHubTokenProviderRegistrationId);
|
|
13269
13019
|
} catch (e) {
|
|
13270
13020
|
session._markDisconnected();
|
|
13271
|
-
|
|
13272
|
-
if (replacedSession) {
|
|
13273
|
-
this.sessions.set(sessionId, replacedSession);
|
|
13274
|
-
} else {
|
|
13275
|
-
this.sessions.delete(sessionId);
|
|
13276
|
-
}
|
|
13277
|
-
}
|
|
13021
|
+
this.sessions.delete(sessionId);
|
|
13278
13022
|
if (gitHubTokenProviderRegistrationId !== void 0) {
|
|
13279
13023
|
this.githubTokenProviders.delete(gitHubTokenProviderRegistrationId);
|
|
13280
13024
|
}
|
|
@@ -14250,20 +13994,6 @@ stderr: ${stderrOutput}` : ""}`
|
|
|
14250
13994
|
return await this.handleHooksInvoke(params);
|
|
14251
13995
|
}
|
|
14252
13996
|
);
|
|
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
|
-
);
|
|
14267
13997
|
const connection = this.connection;
|
|
14268
13998
|
const messageWriter = this.messageWriter;
|
|
14269
13999
|
const cliProcess = this.isExternalServer ? null : this.cliProcess;
|
|
@@ -14420,16 +14150,6 @@ stderr: ${stderrOutput}` : ""}`
|
|
|
14420
14150
|
});
|
|
14421
14151
|
return { response };
|
|
14422
14152
|
}
|
|
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
|
-
}
|
|
14433
14153
|
async handleHooksInvoke(params) {
|
|
14434
14154
|
if (!params || typeof params.sessionId !== "string" || typeof params.hookType !== "string") {
|
|
14435
14155
|
throw new Error("Invalid hooks invoke payload");
|
|
@@ -14464,13 +14184,11 @@ async function joinSession(config = {}) {
|
|
|
14464
14184
|
const client = new CopilotClient({ _internalConnection: { kind: "parent-process" } });
|
|
14465
14185
|
const {
|
|
14466
14186
|
extensionSdkPath: _stripped,
|
|
14467
|
-
skillProvider: _strippedSkillProvider,
|
|
14468
14187
|
workflows,
|
|
14469
14188
|
requestedEnvironmentVariables,
|
|
14470
14189
|
...rest
|
|
14471
14190
|
} = config;
|
|
14472
14191
|
void _stripped;
|
|
14473
|
-
void _strippedSkillProvider;
|
|
14474
14192
|
return client.resumeSessionForExtension(
|
|
14475
14193
|
sessionId,
|
|
14476
14194
|
{
|