@github/copilot-sdk 1.0.17-preview.6 → 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/README.md +0 -41
- package/dist/cjs/cliVersion.js +1 -1
- package/dist/cjs/client.js +2 -44
- package/dist/cjs/extension.js +0 -2
- package/dist/cjs/generated/rpc.js +1 -172
- package/dist/cjs/session.js +0 -67
- package/dist/cliVersion.d.ts +1 -1
- package/dist/cliVersion.js +1 -1
- package/dist/client.d.ts +0 -1
- package/dist/client.js +2 -44
- package/dist/extension.d.ts +1 -1
- package/dist/extension.js +0 -2
- package/dist/generated/rpc.d.ts +7 -502
- package/dist/generated/rpc.js +1 -172
- package/dist/generated/session-events.d.ts +1 -15
- package/dist/index.d.ts +1 -1
- package/dist/session.d.ts +0 -7
- package/dist/session.js +0 -67
- package/dist/types.d.ts +0 -69
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -369,7 +369,6 @@ Create a new conversation session.
|
|
|
369
369
|
- `askUserVariant?: "legacy" | "elicitation"` - Selects the model-facing `ask_user` tool shape when creating or cold-resuming a session. Defaults to `"legacy"`; use `"elicitation"` with `onElicitationRequest`.
|
|
370
370
|
- `onElicitationRequest?: ElicitationHandler` - Handler for elicitation requests dispatched by the server. Enables this client to present form-based UI dialogs on behalf of the agent or other session participants. See [Elicitation Requests](#elicitation-requests) section.
|
|
371
371
|
- `hooks?: SessionHooks` - Hook handlers for session lifecycle events. See [Session Hooks](#session-hooks) section.
|
|
372
|
-
- `skillProvider?: SkillProvider` - **Experimental.** Serves skills from host storage instead of skill directories. Not persisted; pass it again on resume. See [Skill providers](#skill-providers-experimental).
|
|
373
372
|
|
|
374
373
|
```typescript
|
|
375
374
|
const session = await client.createSession({
|
|
@@ -1121,46 +1120,6 @@ const session = await client.createSession({
|
|
|
1121
1120
|
});
|
|
1122
1121
|
```
|
|
1123
1122
|
|
|
1124
|
-
### Skill providers (experimental)
|
|
1125
|
-
|
|
1126
|
-
A skill provider serves skills from your own storage, such as a database, instead of `SKILL.md`
|
|
1127
|
-
files on disk. Provider skills join the session's skill catalog and load on demand through the
|
|
1128
|
-
`skill` tool, just like file-based skills.
|
|
1129
|
-
|
|
1130
|
-
```typescript
|
|
1131
|
-
import type { SkillProvider } from "@github/copilot-sdk";
|
|
1132
|
-
|
|
1133
|
-
const skillProvider: SkillProvider = {
|
|
1134
|
-
listSkills: async () => [
|
|
1135
|
-
{ name: "release-notes", description: "Writes release notes in the team's format." },
|
|
1136
|
-
],
|
|
1137
|
-
readSkill: async (name, { signal }) => (await db.findSkill(name, { signal }))?.markdown ?? null,
|
|
1138
|
-
};
|
|
1139
|
-
|
|
1140
|
-
const session = await client.createSession({
|
|
1141
|
-
onPermissionRequest: approveAll,
|
|
1142
|
-
skillProvider,
|
|
1143
|
-
});
|
|
1144
|
-
```
|
|
1145
|
-
|
|
1146
|
-
- `listSkills()` returns the catalog metadata. `readSkill(name)` returns the skill's markdown, or
|
|
1147
|
-
`null`/`undefined` if the skill no longer exists. The markdown may omit YAML frontmatter; when
|
|
1148
|
-
frontmatter is present, its fields must agree with the listed metadata, and `allowed-tools` is
|
|
1149
|
-
read only from frontmatter.
|
|
1150
|
-
- Each call receives `{ signal }`, an `AbortSignal` that fires when the runtime cancels the call,
|
|
1151
|
-
for example after its 30-second limit or when the session disconnects. It doesn't fire when the
|
|
1152
|
-
connection closes or the client is force-stopped; a running call then continues until it returns.
|
|
1153
|
-
- The provider is never persisted. Pass it again to `resumeSession`; resuming without it unbinds
|
|
1154
|
-
the provider.
|
|
1155
|
-
- A provider enables skills unless you set `enableSkills: false`, which keeps it bound but unused.
|
|
1156
|
-
In `mode: "empty"`, skills stay disabled until you set `enableSkills: true`.
|
|
1157
|
-
- Errors thrown by the provider are reported to the model as a generic load failure; their
|
|
1158
|
-
messages are not forwarded.
|
|
1159
|
-
- The runtime may call the provider concurrently, so both methods must be safe for concurrent use.
|
|
1160
|
-
- Skill providers are not supported for cloud sessions.
|
|
1161
|
-
|
|
1162
|
-
See [Custom skills](../docs/features/skills.md#skill-providers-experimental) for limits and details.
|
|
1163
|
-
|
|
1164
1123
|
### Multiple Sessions
|
|
1165
1124
|
|
|
1166
1125
|
```typescript
|
package/dist/cjs/cliVersion.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(cliVersion_exports, {
|
|
|
22
22
|
COPILOT_CLI_VERSION: () => COPILOT_CLI_VERSION
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(cliVersion_exports);
|
|
25
|
-
const COPILOT_CLI_VERSION = "1.0.
|
|
25
|
+
const COPILOT_CLI_VERSION = "1.0.92-4.unstable.r37397886721.gad270aa";
|
|
26
26
|
const COPILOT_CLI_USE_NPM_PACKAGE = false;
|
|
27
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
28
|
0 && (module.exports = {
|
package/dist/cjs/client.js
CHANGED
|
@@ -1204,9 +1204,6 @@ class CopilotClient {
|
|
|
1204
1204
|
if (config.gitHubToken !== void 0 && config.gitHubTokenProvider !== void 0) {
|
|
1205
1205
|
throw new Error("gitHubToken and gitHubTokenProvider are mutually exclusive");
|
|
1206
1206
|
}
|
|
1207
|
-
if (config.cloud != null && config.skillProvider) {
|
|
1208
|
-
throw new Error("Skill providers are not supported for cloud sessions.");
|
|
1209
|
-
}
|
|
1210
1207
|
if (!this.connection) {
|
|
1211
1208
|
await this.start();
|
|
1212
1209
|
}
|
|
@@ -1266,9 +1263,6 @@ class CopilotClient {
|
|
|
1266
1263
|
if (config.hooks) {
|
|
1267
1264
|
s.registerHooks(config.hooks);
|
|
1268
1265
|
}
|
|
1269
|
-
if (config.skillProvider) {
|
|
1270
|
-
s.registerSkillProvider(config.skillProvider);
|
|
1271
|
-
}
|
|
1272
1266
|
if (transformCallbacks) {
|
|
1273
1267
|
s.registerTransformCallbacks(transformCallbacks);
|
|
1274
1268
|
}
|
|
@@ -1375,7 +1369,6 @@ class CopilotClient {
|
|
|
1375
1369
|
enableSessionStore: config.enableSessionStore,
|
|
1376
1370
|
enableSkills: config.enableSkills,
|
|
1377
1371
|
skillDirectories: config.skillDirectories,
|
|
1378
|
-
...config.skillProvider ? { hasSkillProvider: true } : {},
|
|
1379
1372
|
pluginDirectories: config.pluginDirectories,
|
|
1380
1373
|
instructionDirectories: config.instructionDirectories,
|
|
1381
1374
|
disabledSkills: config.disabledSkills,
|
|
@@ -1529,9 +1522,6 @@ class CopilotClient {
|
|
|
1529
1522
|
if (config.hooks) {
|
|
1530
1523
|
session.registerHooks(config.hooks);
|
|
1531
1524
|
}
|
|
1532
|
-
if (config.skillProvider) {
|
|
1533
|
-
session.registerSkillProvider(config.skillProvider);
|
|
1534
|
-
}
|
|
1535
1525
|
const modeDefaults = this.configDefaultsForMode();
|
|
1536
1526
|
config = { ...modeDefaults, ...config };
|
|
1537
1527
|
config.customAgentsLocalOnly ??= modeDefaults.customAgentsLocalOnly;
|
|
@@ -1545,10 +1535,9 @@ class CopilotClient {
|
|
|
1545
1535
|
if (config.onEvent) {
|
|
1546
1536
|
session.on(config.onEvent);
|
|
1547
1537
|
}
|
|
1548
|
-
const toolFilterOptions = this.resolveToolFilterOptions(config);
|
|
1549
1538
|
this.setupSessionFs(session, config);
|
|
1550
|
-
const replacedSession = this.sessions.get(sessionId);
|
|
1551
1539
|
this.sessions.set(sessionId, session);
|
|
1540
|
+
const toolFilterOptions = this.resolveToolFilterOptions(config);
|
|
1552
1541
|
const gitHubTokenProviderRegistrationId = this.registerGitHubTokenProvider(
|
|
1553
1542
|
config.gitHubTokenProvider,
|
|
1554
1543
|
sessionId
|
|
@@ -1641,7 +1630,6 @@ class CopilotClient {
|
|
|
1641
1630
|
defaultAgent: config.defaultAgent,
|
|
1642
1631
|
agent: config.agent,
|
|
1643
1632
|
skillDirectories: config.skillDirectories,
|
|
1644
|
-
...config.skillProvider ? { hasSkillProvider: true } : {},
|
|
1645
1633
|
pluginDirectories: config.pluginDirectories,
|
|
1646
1634
|
instructionDirectories: config.instructionDirectories,
|
|
1647
1635
|
disabledSkills: config.disabledSkills,
|
|
@@ -1686,13 +1674,7 @@ class CopilotClient {
|
|
|
1686
1674
|
this.commitGitHubTokenProvider(sessionId, gitHubTokenProviderRegistrationId);
|
|
1687
1675
|
} catch (e) {
|
|
1688
1676
|
session._markDisconnected();
|
|
1689
|
-
|
|
1690
|
-
if (replacedSession) {
|
|
1691
|
-
this.sessions.set(sessionId, replacedSession);
|
|
1692
|
-
} else {
|
|
1693
|
-
this.sessions.delete(sessionId);
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1677
|
+
this.sessions.delete(sessionId);
|
|
1696
1678
|
if (gitHubTokenProviderRegistrationId !== void 0) {
|
|
1697
1679
|
this.githubTokenProviders.delete(gitHubTokenProviderRegistrationId);
|
|
1698
1680
|
}
|
|
@@ -2668,20 +2650,6 @@ stderr: ${stderrOutput}` : ""}`
|
|
|
2668
2650
|
return await this.handleHooksInvoke(params);
|
|
2669
2651
|
}
|
|
2670
2652
|
);
|
|
2671
|
-
this.connection.onRequest(
|
|
2672
|
-
"skillProvider.list",
|
|
2673
|
-
async (params, token) => await this.resolveSkillProviderSession(params)._handleSkillProviderList(token)
|
|
2674
|
-
);
|
|
2675
|
-
this.connection.onRequest(
|
|
2676
|
-
"skillProvider.read",
|
|
2677
|
-
async (params, token) => {
|
|
2678
|
-
const session = this.resolveSkillProviderSession(params);
|
|
2679
|
-
if (typeof params.name !== "string") {
|
|
2680
|
-
throw new Error("Invalid skillProvider.read payload");
|
|
2681
|
-
}
|
|
2682
|
-
return await session._handleSkillProviderRead(params.name, token);
|
|
2683
|
-
}
|
|
2684
|
-
);
|
|
2685
2653
|
const connection = this.connection;
|
|
2686
2654
|
const messageWriter = this.messageWriter;
|
|
2687
2655
|
const cliProcess = this.isExternalServer ? null : this.cliProcess;
|
|
@@ -2838,16 +2806,6 @@ stderr: ${stderrOutput}` : ""}`
|
|
|
2838
2806
|
});
|
|
2839
2807
|
return { response };
|
|
2840
2808
|
}
|
|
2841
|
-
resolveSkillProviderSession(params) {
|
|
2842
|
-
if (!params || typeof params.sessionId !== "string") {
|
|
2843
|
-
throw new Error("Invalid skillProvider payload");
|
|
2844
|
-
}
|
|
2845
|
-
const session = this.sessions.get(params.sessionId);
|
|
2846
|
-
if (!session) {
|
|
2847
|
-
throw new Error(`Session not found: ${params.sessionId}`);
|
|
2848
|
-
}
|
|
2849
|
-
return session;
|
|
2850
|
-
}
|
|
2851
2809
|
async handleHooksInvoke(params) {
|
|
2852
2810
|
if (!params || typeof params.sessionId !== "string" || typeof params.hookType !== "string") {
|
|
2853
2811
|
throw new Error("Invalid hooks invoke payload");
|
package/dist/cjs/extension.js
CHANGED
|
@@ -41,13 +41,11 @@ async function joinSession(config = {}) {
|
|
|
41
41
|
const client = new import_client.CopilotClient({ _internalConnection: { kind: "parent-process" } });
|
|
42
42
|
const {
|
|
43
43
|
extensionSdkPath: _stripped,
|
|
44
|
-
skillProvider: _strippedSkillProvider,
|
|
45
44
|
workflows,
|
|
46
45
|
requestedEnvironmentVariables,
|
|
47
46
|
...rest
|
|
48
47
|
} = config;
|
|
49
48
|
void _stripped;
|
|
50
|
-
void _strippedSkillProvider;
|
|
51
49
|
return client.resumeSessionForExtension(
|
|
52
50
|
sessionId,
|
|
53
51
|
{
|
|
@@ -980,37 +980,6 @@ function createServerRpc(connection) {
|
|
|
980
980
|
* @returns Outcome of an agentRegistry.spawn call.
|
|
981
981
|
*/
|
|
982
982
|
spawn: async (params) => connection.sendRequest("agentRegistry.spawn", params)
|
|
983
|
-
},
|
|
984
|
-
/** @experimental */
|
|
985
|
-
connectors: {
|
|
986
|
-
/**
|
|
987
|
-
* Returns feature availability.
|
|
988
|
-
*
|
|
989
|
-
* @returns Feature availability.
|
|
990
|
-
*/
|
|
991
|
-
getCapabilities: async () => connection.sendRequest("connectors.getCapabilities", {}),
|
|
992
|
-
/**
|
|
993
|
-
* Returns eligible accounts.
|
|
994
|
-
*
|
|
995
|
-
* @returns Eligible accounts.
|
|
996
|
-
*/
|
|
997
|
-
getAccounts: async () => connection.sendRequest("connectors.getAccounts", {}),
|
|
998
|
-
/**
|
|
999
|
-
* Lists entries for the selected account.
|
|
1000
|
-
*
|
|
1001
|
-
* @param params Selected account.
|
|
1002
|
-
*
|
|
1003
|
-
* @returns Entries for the selected account.
|
|
1004
|
-
*/
|
|
1005
|
-
list: async (params) => connection.sendRequest("connectors.list", params),
|
|
1006
|
-
/**
|
|
1007
|
-
* Refreshes entries for the selected account.
|
|
1008
|
-
*
|
|
1009
|
-
* @param params Selected account.
|
|
1010
|
-
*
|
|
1011
|
-
* @returns Entries for the selected account.
|
|
1012
|
-
*/
|
|
1013
|
-
refresh: async (params) => connection.sendRequest("connectors.refresh", params)
|
|
1014
983
|
}
|
|
1015
984
|
};
|
|
1016
985
|
}
|
|
@@ -1066,110 +1035,6 @@ function createInternalServerRpc(connection) {
|
|
|
1066
1035
|
*/
|
|
1067
1036
|
connect: async (params) => connection.sendRequest("connect", params),
|
|
1068
1037
|
/** @experimental */
|
|
1069
|
-
agents: {
|
|
1070
|
-
/**
|
|
1071
|
-
* 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.
|
|
1072
|
-
*
|
|
1073
|
-
* @returns The agents this runtime ships, named so a consumer can tell them apart from authored ones.
|
|
1074
|
-
*/
|
|
1075
|
-
getBuiltins: async () => connection.sendRequest("agents.getBuiltins", {}),
|
|
1076
|
-
/**
|
|
1077
|
-
* 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.
|
|
1078
|
-
*
|
|
1079
|
-
* @param params The feature flags to evaluate shipped agents against.
|
|
1080
|
-
*
|
|
1081
|
-
* @returns The shipped agents available under the requested flags.
|
|
1082
|
-
*/
|
|
1083
|
-
getAvailableBuiltins: async (params) => connection.sendRequest("agents.getAvailableBuiltins", params),
|
|
1084
|
-
/**
|
|
1085
|
-
* 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.
|
|
1086
|
-
*
|
|
1087
|
-
* @param params The shipped agent whose definition to load.
|
|
1088
|
-
*
|
|
1089
|
-
* @returns One shipped agent's definition.
|
|
1090
|
-
*/
|
|
1091
|
-
getBuiltinDefinition: async (params) => connection.sendRequest("agents.getBuiltinDefinition", params),
|
|
1092
|
-
/**
|
|
1093
|
-
* 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`.
|
|
1094
|
-
*
|
|
1095
|
-
* @param params The shipped agent whose listing entry to load.
|
|
1096
|
-
*
|
|
1097
|
-
* @returns One shipped agent, projected for a listing.
|
|
1098
|
-
*/
|
|
1099
|
-
getBuiltinListingDefinition: async (params) => connection.sendRequest("agents.getBuiltinListingDefinition", params),
|
|
1100
|
-
/**
|
|
1101
|
-
* 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.
|
|
1102
|
-
*
|
|
1103
|
-
* @param params The models a custom agent asks for, and the models actually available.
|
|
1104
|
-
*
|
|
1105
|
-
* @returns The model to switch to, and the warning to show when the agent's preference could not be met.
|
|
1106
|
-
*/
|
|
1107
|
-
customAgentInitialModelDecision: async (params) => connection.sendRequest("agents.customAgentInitialModelDecision", params)
|
|
1108
|
-
},
|
|
1109
|
-
/** @experimental */
|
|
1110
|
-
gitHubRepository: {
|
|
1111
|
-
/**
|
|
1112
|
-
* 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'.
|
|
1113
|
-
*
|
|
1114
|
-
* @param params Working-tree path whose owning GitHub repository should be resolved.
|
|
1115
|
-
*
|
|
1116
|
-
* @returns The GitHub repository that owns the requested path, when the selected remote (`origin`, else the first) is on a GitHub host.
|
|
1117
|
-
*/
|
|
1118
|
-
atPath: async (params) => connection.sendRequest("gitHubRepository.atPath", params)
|
|
1119
|
-
},
|
|
1120
|
-
/** @experimental */
|
|
1121
|
-
gitHubOwners: {
|
|
1122
|
-
/**
|
|
1123
|
-
* 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.
|
|
1124
|
-
*
|
|
1125
|
-
* @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.
|
|
1126
|
-
*/
|
|
1127
|
-
nextRequestId: async () => connection.sendRequest("gitHubOwners.nextRequestId", {}),
|
|
1128
|
-
/**
|
|
1129
|
-
* 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`.
|
|
1130
|
-
*
|
|
1131
|
-
* @param params Credential to list owners under, and the request id that makes the listing cancellable.
|
|
1132
|
-
*
|
|
1133
|
-
* @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.
|
|
1134
|
-
*/
|
|
1135
|
-
list: async (params) => connection.sendRequest("gitHubOwners.list", params),
|
|
1136
|
-
/**
|
|
1137
|
-
* 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.
|
|
1138
|
-
*
|
|
1139
|
-
* @param params The owner listing to abandon.
|
|
1140
|
-
*
|
|
1141
|
-
* @returns Whether the id named a running owner listing.
|
|
1142
|
-
*/
|
|
1143
|
-
cancel: async (params) => connection.sendRequest("gitHubOwners.cancel", params)
|
|
1144
|
-
},
|
|
1145
|
-
/** @experimental */
|
|
1146
|
-
git: {
|
|
1147
|
-
/**
|
|
1148
|
-
* 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.
|
|
1149
|
-
*
|
|
1150
|
-
* @param params Working-tree path a git query applies to.
|
|
1151
|
-
*
|
|
1152
|
-
* @returns The remote the checked-out branch tracks.
|
|
1153
|
-
*/
|
|
1154
|
-
currentBranchRemote: async (params) => connection.sendRequest("git.currentBranchRemote", params),
|
|
1155
|
-
/**
|
|
1156
|
-
* 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.
|
|
1157
|
-
*
|
|
1158
|
-
* @param params Working-tree path a git query applies to.
|
|
1159
|
-
*
|
|
1160
|
-
* @returns Updated working directory and git context. Emitted as the new payload of `session.context_changed`.
|
|
1161
|
-
*/
|
|
1162
|
-
workingDirectoryContext: async (params) => connection.sendRequest("git.workingDirectoryContext", params),
|
|
1163
|
-
/**
|
|
1164
|
-
* 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.
|
|
1165
|
-
*
|
|
1166
|
-
* @param params Git working tree whose GitHub remotes should be listed.
|
|
1167
|
-
*
|
|
1168
|
-
* @returns The GitHub repositories a working tree's remotes point at.
|
|
1169
|
-
*/
|
|
1170
|
-
reposFromRemotes: async (params) => connection.sendRequest("git.reposFromRemotes", params)
|
|
1171
|
-
},
|
|
1172
|
-
/** @experimental */
|
|
1173
1038
|
sessions: {
|
|
1174
1039
|
/**
|
|
1175
1040
|
* Reads lightweight persisted metadata for one local session without opening it.
|
|
@@ -1209,30 +1074,6 @@ function createInternalServerRpc(connection) {
|
|
|
1209
1074
|
* @param params Session ID to delete from disk.
|
|
1210
1075
|
*/
|
|
1211
1076
|
delete: async (params) => connection.sendRequest("sessions.delete", params),
|
|
1212
|
-
/**
|
|
1213
|
-
* 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.
|
|
1214
|
-
*
|
|
1215
|
-
* @param params Identity, state location and starting context for a workspace record.
|
|
1216
|
-
*
|
|
1217
|
-
* @returns The workspace record that was written.
|
|
1218
|
-
*/
|
|
1219
|
-
createWorkspace: async (params) => connection.sendRequest("sessions.createWorkspace", params),
|
|
1220
|
-
/**
|
|
1221
|
-
* 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.
|
|
1222
|
-
*
|
|
1223
|
-
* @param params Where the session's state lives, as a root directory and the session ID under it.
|
|
1224
|
-
*
|
|
1225
|
-
* @returns The workspace record on disk, omitted when the session has none.
|
|
1226
|
-
*/
|
|
1227
|
-
loadWorkspace: async (params) => connection.sendRequest("sessions.loadWorkspace", params),
|
|
1228
|
-
/**
|
|
1229
|
-
* 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`.
|
|
1230
|
-
*
|
|
1231
|
-
* @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.
|
|
1232
|
-
*
|
|
1233
|
-
* @returns The merge completed. The record carries the supplied workspace-schema fields, but a stored `fork_count` stays.
|
|
1234
|
-
*/
|
|
1235
|
-
updateWorkspaceFields: async (params) => connection.sendRequest("sessions.updateWorkspaceFields", params),
|
|
1236
1077
|
/**
|
|
1237
1078
|
* 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.
|
|
1238
1079
|
*
|
|
@@ -2107,17 +1948,11 @@ function createSessionRpc(connection, sessionId) {
|
|
|
2107
1948
|
/** @experimental */
|
|
2108
1949
|
mcp: {
|
|
2109
1950
|
/**
|
|
2110
|
-
* Lists
|
|
1951
|
+
* 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.
|
|
2111
1952
|
*
|
|
2112
1953
|
* @returns MCP servers configured for the session, with their connection status and host-level state.
|
|
2113
1954
|
*/
|
|
2114
1955
|
list: async () => connection.sendRequest("session.mcp.list", { sessionId }),
|
|
2115
|
-
/**
|
|
2116
|
-
* 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.
|
|
2117
|
-
*
|
|
2118
|
-
* @returns Effective MCP configuration with optional live observations from matching already materialized servers.
|
|
2119
|
-
*/
|
|
2120
|
-
listConfigured: async () => connection.sendRequest("session.mcp.listConfigured", { sessionId }),
|
|
2121
1956
|
/**
|
|
2122
1957
|
* 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.
|
|
2123
1958
|
*
|
|
@@ -3566,12 +3401,6 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
3566
3401
|
},
|
|
3567
3402
|
/** @experimental */
|
|
3568
3403
|
mcp: {
|
|
3569
|
-
/**
|
|
3570
|
-
* 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.
|
|
3571
|
-
*
|
|
3572
|
-
* @param params Records which IDE the host is connected to, or clears it.
|
|
3573
|
-
*/
|
|
3574
|
-
setConnectedIdeInfo: async (params) => connection.sendRequest("session.mcp.setConnectedIdeInfo", { ...params, sessionId }),
|
|
3575
3404
|
/**
|
|
3576
3405
|
* Reloads MCP server connections for the session with an explicit host-provided configuration.
|
|
3577
3406
|
*
|
package/dist/cjs/session.js
CHANGED
|
@@ -284,7 +284,6 @@ class CopilotSession {
|
|
|
284
284
|
elicitationHandler;
|
|
285
285
|
exitPlanModeHandler;
|
|
286
286
|
autoModeSwitchHandler;
|
|
287
|
-
skillProvider;
|
|
288
287
|
hooks;
|
|
289
288
|
transformCallbacks;
|
|
290
289
|
_rpc = null;
|
|
@@ -697,7 +696,6 @@ class CopilotSession {
|
|
|
697
696
|
this.elicitationHandler = void 0;
|
|
698
697
|
this.exitPlanModeHandler = void 0;
|
|
699
698
|
this.autoModeSwitchHandler = void 0;
|
|
700
|
-
this.skillProvider = void 0;
|
|
701
699
|
this.commandHandlers.clear();
|
|
702
700
|
this.canvases.clear();
|
|
703
701
|
this.workflows.clear();
|
|
@@ -1604,68 +1602,6 @@ class CopilotSession {
|
|
|
1604
1602
|
registerUserInputHandler(handler) {
|
|
1605
1603
|
this.userInputHandler = handler;
|
|
1606
1604
|
}
|
|
1607
|
-
/**
|
|
1608
|
-
* Registers the session's skill provider.
|
|
1609
|
-
*
|
|
1610
|
-
* @param provider - The skill provider, or undefined to remove it
|
|
1611
|
-
* @internal This method is typically called internally when creating a session.
|
|
1612
|
-
*/
|
|
1613
|
-
registerSkillProvider(provider) {
|
|
1614
|
-
this.skillProvider = provider;
|
|
1615
|
-
}
|
|
1616
|
-
/**
|
|
1617
|
-
* Handles a `skillProvider.list` request from the runtime.
|
|
1618
|
-
*
|
|
1619
|
-
* @internal This method is for internal use by the SDK.
|
|
1620
|
-
*/
|
|
1621
|
-
async _handleSkillProviderList(token) {
|
|
1622
|
-
const provider = this.requireSkillProvider();
|
|
1623
|
-
return await this.callSkillProvider("listSkills", token, async (options) => ({
|
|
1624
|
-
skills: await provider.listSkills(options) ?? []
|
|
1625
|
-
}));
|
|
1626
|
-
}
|
|
1627
|
-
/**
|
|
1628
|
-
* Handles a `skillProvider.read` request from the runtime.
|
|
1629
|
-
*
|
|
1630
|
-
* @internal This method is for internal use by the SDK.
|
|
1631
|
-
*/
|
|
1632
|
-
async _handleSkillProviderRead(name, token) {
|
|
1633
|
-
const provider = this.requireSkillProvider();
|
|
1634
|
-
return await this.callSkillProvider("readSkill", token, async (options) => ({
|
|
1635
|
-
markdown: await provider.readSkill(name, options) ?? null
|
|
1636
|
-
}));
|
|
1637
|
-
}
|
|
1638
|
-
requireSkillProvider() {
|
|
1639
|
-
if (!this.skillProvider) {
|
|
1640
|
-
throw new Error(`No skill provider for session: ${this.sessionId}`);
|
|
1641
|
-
}
|
|
1642
|
-
return this.skillProvider;
|
|
1643
|
-
}
|
|
1644
|
-
/**
|
|
1645
|
-
* Runs a provider call with an abort signal tied to the runtime's request
|
|
1646
|
-
* cancellation. Failures are logged locally and reported generically.
|
|
1647
|
-
*/
|
|
1648
|
-
async callSkillProvider(operation, token, call) {
|
|
1649
|
-
const controller = new AbortController();
|
|
1650
|
-
const subscription = token?.onCancellationRequested(() => controller.abort());
|
|
1651
|
-
if (token?.isCancellationRequested) {
|
|
1652
|
-
controller.abort();
|
|
1653
|
-
}
|
|
1654
|
-
try {
|
|
1655
|
-
return await call({ signal: controller.signal });
|
|
1656
|
-
} catch (error) {
|
|
1657
|
-
if (controller.signal.aborted) {
|
|
1658
|
-
throw new import_node.ResponseError(-32800, `Skill provider ${operation} cancelled`);
|
|
1659
|
-
}
|
|
1660
|
-
console.error(`Skill provider ${operation} failed`, {
|
|
1661
|
-
sessionId: this.sessionId,
|
|
1662
|
-
error
|
|
1663
|
-
});
|
|
1664
|
-
throw skillProviderFailure(operation);
|
|
1665
|
-
} finally {
|
|
1666
|
-
subscription?.dispose();
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
1605
|
/**
|
|
1670
1606
|
* Registers hook handlers for session lifecycle events.
|
|
1671
1607
|
*
|
|
@@ -2019,9 +1955,6 @@ function toCanvasRpcError(error) {
|
|
|
2019
1955
|
const message = error instanceof Error ? error.message : String(error);
|
|
2020
1956
|
return new import_node.ResponseError(import_node.ErrorCodes.InternalError, message, { code, message });
|
|
2021
1957
|
}
|
|
2022
|
-
function skillProviderFailure(operation) {
|
|
2023
|
-
return new import_node.ResponseError(import_node.ErrorCodes.InternalError, `Skill provider ${operation} failed`);
|
|
2024
|
-
}
|
|
2025
1958
|
function strictJsonValidationError(context, category, message, path) {
|
|
2026
1959
|
return new import_node.ResponseError(import_node.ErrorCodes.InternalError, message, {
|
|
2027
1960
|
code: context.code,
|
package/dist/cliVersion.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const COPILOT_CLI_VERSION = "1.0.
|
|
1
|
+
export declare const COPILOT_CLI_VERSION = "1.0.92-4.unstable.r37397886721.gad270aa";
|
|
2
2
|
export declare const COPILOT_CLI_USE_NPM_PACKAGE = false;
|
package/dist/cliVersion.js
CHANGED
package/dist/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
|
}
|
package/dist/client.js
CHANGED
|
@@ -1184,9 +1184,6 @@ class CopilotClient {
|
|
|
1184
1184
|
if (config.gitHubToken !== void 0 && config.gitHubTokenProvider !== void 0) {
|
|
1185
1185
|
throw new Error("gitHubToken and gitHubTokenProvider are mutually exclusive");
|
|
1186
1186
|
}
|
|
1187
|
-
if (config.cloud != null && config.skillProvider) {
|
|
1188
|
-
throw new Error("Skill providers are not supported for cloud sessions.");
|
|
1189
|
-
}
|
|
1190
1187
|
if (!this.connection) {
|
|
1191
1188
|
await this.start();
|
|
1192
1189
|
}
|
|
@@ -1246,9 +1243,6 @@ class CopilotClient {
|
|
|
1246
1243
|
if (config.hooks) {
|
|
1247
1244
|
s.registerHooks(config.hooks);
|
|
1248
1245
|
}
|
|
1249
|
-
if (config.skillProvider) {
|
|
1250
|
-
s.registerSkillProvider(config.skillProvider);
|
|
1251
|
-
}
|
|
1252
1246
|
if (transformCallbacks) {
|
|
1253
1247
|
s.registerTransformCallbacks(transformCallbacks);
|
|
1254
1248
|
}
|
|
@@ -1355,7 +1349,6 @@ class CopilotClient {
|
|
|
1355
1349
|
enableSessionStore: config.enableSessionStore,
|
|
1356
1350
|
enableSkills: config.enableSkills,
|
|
1357
1351
|
skillDirectories: config.skillDirectories,
|
|
1358
|
-
...config.skillProvider ? { hasSkillProvider: true } : {},
|
|
1359
1352
|
pluginDirectories: config.pluginDirectories,
|
|
1360
1353
|
instructionDirectories: config.instructionDirectories,
|
|
1361
1354
|
disabledSkills: config.disabledSkills,
|
|
@@ -1509,9 +1502,6 @@ class CopilotClient {
|
|
|
1509
1502
|
if (config.hooks) {
|
|
1510
1503
|
session.registerHooks(config.hooks);
|
|
1511
1504
|
}
|
|
1512
|
-
if (config.skillProvider) {
|
|
1513
|
-
session.registerSkillProvider(config.skillProvider);
|
|
1514
|
-
}
|
|
1515
1505
|
const modeDefaults = this.configDefaultsForMode();
|
|
1516
1506
|
config = { ...modeDefaults, ...config };
|
|
1517
1507
|
config.customAgentsLocalOnly ??= modeDefaults.customAgentsLocalOnly;
|
|
@@ -1525,10 +1515,9 @@ class CopilotClient {
|
|
|
1525
1515
|
if (config.onEvent) {
|
|
1526
1516
|
session.on(config.onEvent);
|
|
1527
1517
|
}
|
|
1528
|
-
const toolFilterOptions = this.resolveToolFilterOptions(config);
|
|
1529
1518
|
this.setupSessionFs(session, config);
|
|
1530
|
-
const replacedSession = this.sessions.get(sessionId);
|
|
1531
1519
|
this.sessions.set(sessionId, session);
|
|
1520
|
+
const toolFilterOptions = this.resolveToolFilterOptions(config);
|
|
1532
1521
|
const gitHubTokenProviderRegistrationId = this.registerGitHubTokenProvider(
|
|
1533
1522
|
config.gitHubTokenProvider,
|
|
1534
1523
|
sessionId
|
|
@@ -1621,7 +1610,6 @@ class CopilotClient {
|
|
|
1621
1610
|
defaultAgent: config.defaultAgent,
|
|
1622
1611
|
agent: config.agent,
|
|
1623
1612
|
skillDirectories: config.skillDirectories,
|
|
1624
|
-
...config.skillProvider ? { hasSkillProvider: true } : {},
|
|
1625
1613
|
pluginDirectories: config.pluginDirectories,
|
|
1626
1614
|
instructionDirectories: config.instructionDirectories,
|
|
1627
1615
|
disabledSkills: config.disabledSkills,
|
|
@@ -1666,13 +1654,7 @@ class CopilotClient {
|
|
|
1666
1654
|
this.commitGitHubTokenProvider(sessionId, gitHubTokenProviderRegistrationId);
|
|
1667
1655
|
} catch (e) {
|
|
1668
1656
|
session._markDisconnected();
|
|
1669
|
-
|
|
1670
|
-
if (replacedSession) {
|
|
1671
|
-
this.sessions.set(sessionId, replacedSession);
|
|
1672
|
-
} else {
|
|
1673
|
-
this.sessions.delete(sessionId);
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1657
|
+
this.sessions.delete(sessionId);
|
|
1676
1658
|
if (gitHubTokenProviderRegistrationId !== void 0) {
|
|
1677
1659
|
this.githubTokenProviders.delete(gitHubTokenProviderRegistrationId);
|
|
1678
1660
|
}
|
|
@@ -2648,20 +2630,6 @@ stderr: ${stderrOutput}` : ""}`
|
|
|
2648
2630
|
return await this.handleHooksInvoke(params);
|
|
2649
2631
|
}
|
|
2650
2632
|
);
|
|
2651
|
-
this.connection.onRequest(
|
|
2652
|
-
"skillProvider.list",
|
|
2653
|
-
async (params, token) => await this.resolveSkillProviderSession(params)._handleSkillProviderList(token)
|
|
2654
|
-
);
|
|
2655
|
-
this.connection.onRequest(
|
|
2656
|
-
"skillProvider.read",
|
|
2657
|
-
async (params, token) => {
|
|
2658
|
-
const session = this.resolveSkillProviderSession(params);
|
|
2659
|
-
if (typeof params.name !== "string") {
|
|
2660
|
-
throw new Error("Invalid skillProvider.read payload");
|
|
2661
|
-
}
|
|
2662
|
-
return await session._handleSkillProviderRead(params.name, token);
|
|
2663
|
-
}
|
|
2664
|
-
);
|
|
2665
2633
|
const connection = this.connection;
|
|
2666
2634
|
const messageWriter = this.messageWriter;
|
|
2667
2635
|
const cliProcess = this.isExternalServer ? null : this.cliProcess;
|
|
@@ -2818,16 +2786,6 @@ stderr: ${stderrOutput}` : ""}`
|
|
|
2818
2786
|
});
|
|
2819
2787
|
return { response };
|
|
2820
2788
|
}
|
|
2821
|
-
resolveSkillProviderSession(params) {
|
|
2822
|
-
if (!params || typeof params.sessionId !== "string") {
|
|
2823
|
-
throw new Error("Invalid skillProvider payload");
|
|
2824
|
-
}
|
|
2825
|
-
const session = this.sessions.get(params.sessionId);
|
|
2826
|
-
if (!session) {
|
|
2827
|
-
throw new Error(`Session not found: ${params.sessionId}`);
|
|
2828
|
-
}
|
|
2829
|
-
return session;
|
|
2830
|
-
}
|
|
2831
2789
|
async handleHooksInvoke(params) {
|
|
2832
2790
|
if (!params || typeof params.sessionId !== "string" || typeof params.hookType !== "string") {
|
|
2833
2791
|
throw new Error("Invalid hooks invoke payload");
|
package/dist/extension.d.ts
CHANGED
|
@@ -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/dist/extension.js
CHANGED
|
@@ -22,13 +22,11 @@ async function joinSession(config = {}) {
|
|
|
22
22
|
const client = new CopilotClient({ _internalConnection: { kind: "parent-process" } });
|
|
23
23
|
const {
|
|
24
24
|
extensionSdkPath: _stripped,
|
|
25
|
-
skillProvider: _strippedSkillProvider,
|
|
26
25
|
workflows,
|
|
27
26
|
requestedEnvironmentVariables,
|
|
28
27
|
...rest
|
|
29
28
|
} = config;
|
|
30
29
|
void _stripped;
|
|
31
|
-
void _strippedSkillProvider;
|
|
32
30
|
return client.resumeSessionForExtension(
|
|
33
31
|
sessionId,
|
|
34
32
|
{
|