@github/copilot-sdk 1.0.17-unstable.37553872417.gc9f6176 → 1.0.17

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 CHANGED
@@ -369,6 +369,7 @@ 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).
372
373
 
373
374
  ```typescript
374
375
  const session = await client.createSession({
@@ -1120,6 +1121,46 @@ const session = await client.createSession({
1120
1121
  });
1121
1122
  ```
1122
1123
 
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
+
1123
1164
  ### Multiple Sessions
1124
1165
 
1125
1166
  ```typescript
@@ -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.92-4.unstable.r37553872417.gc9f6176";
25
+ const COPILOT_CLI_VERSION = "1.0.93";
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 = {
@@ -1204,6 +1204,9 @@ 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
+ }
1207
1210
  if (!this.connection) {
1208
1211
  await this.start();
1209
1212
  }
@@ -1263,6 +1266,9 @@ class CopilotClient {
1263
1266
  if (config.hooks) {
1264
1267
  s.registerHooks(config.hooks);
1265
1268
  }
1269
+ if (config.skillProvider) {
1270
+ s.registerSkillProvider(config.skillProvider);
1271
+ }
1266
1272
  if (transformCallbacks) {
1267
1273
  s.registerTransformCallbacks(transformCallbacks);
1268
1274
  }
@@ -1369,6 +1375,7 @@ class CopilotClient {
1369
1375
  enableSessionStore: config.enableSessionStore,
1370
1376
  enableSkills: config.enableSkills,
1371
1377
  skillDirectories: config.skillDirectories,
1378
+ ...config.skillProvider ? { hasSkillProvider: true } : {},
1372
1379
  pluginDirectories: config.pluginDirectories,
1373
1380
  instructionDirectories: config.instructionDirectories,
1374
1381
  disabledSkills: config.disabledSkills,
@@ -1522,6 +1529,9 @@ class CopilotClient {
1522
1529
  if (config.hooks) {
1523
1530
  session.registerHooks(config.hooks);
1524
1531
  }
1532
+ if (config.skillProvider) {
1533
+ session.registerSkillProvider(config.skillProvider);
1534
+ }
1525
1535
  const modeDefaults = this.configDefaultsForMode();
1526
1536
  config = { ...modeDefaults, ...config };
1527
1537
  config.customAgentsLocalOnly ??= modeDefaults.customAgentsLocalOnly;
@@ -1535,9 +1545,10 @@ class CopilotClient {
1535
1545
  if (config.onEvent) {
1536
1546
  session.on(config.onEvent);
1537
1547
  }
1548
+ const toolFilterOptions = this.resolveToolFilterOptions(config);
1538
1549
  this.setupSessionFs(session, config);
1550
+ const replacedSession = this.sessions.get(sessionId);
1539
1551
  this.sessions.set(sessionId, session);
1540
- const toolFilterOptions = this.resolveToolFilterOptions(config);
1541
1552
  const gitHubTokenProviderRegistrationId = this.registerGitHubTokenProvider(
1542
1553
  config.gitHubTokenProvider,
1543
1554
  sessionId
@@ -1630,6 +1641,7 @@ class CopilotClient {
1630
1641
  defaultAgent: config.defaultAgent,
1631
1642
  agent: config.agent,
1632
1643
  skillDirectories: config.skillDirectories,
1644
+ ...config.skillProvider ? { hasSkillProvider: true } : {},
1633
1645
  pluginDirectories: config.pluginDirectories,
1634
1646
  instructionDirectories: config.instructionDirectories,
1635
1647
  disabledSkills: config.disabledSkills,
@@ -1674,7 +1686,13 @@ class CopilotClient {
1674
1686
  this.commitGitHubTokenProvider(sessionId, gitHubTokenProviderRegistrationId);
1675
1687
  } catch (e) {
1676
1688
  session._markDisconnected();
1677
- this.sessions.delete(sessionId);
1689
+ if (this.sessions.get(sessionId) === session) {
1690
+ if (replacedSession) {
1691
+ this.sessions.set(sessionId, replacedSession);
1692
+ } else {
1693
+ this.sessions.delete(sessionId);
1694
+ }
1695
+ }
1678
1696
  if (gitHubTokenProviderRegistrationId !== void 0) {
1679
1697
  this.githubTokenProviders.delete(gitHubTokenProviderRegistrationId);
1680
1698
  }
@@ -2650,6 +2668,20 @@ stderr: ${stderrOutput}` : ""}`
2650
2668
  return await this.handleHooksInvoke(params);
2651
2669
  }
2652
2670
  );
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
+ );
2653
2685
  const connection = this.connection;
2654
2686
  const messageWriter = this.messageWriter;
2655
2687
  const cliProcess = this.isExternalServer ? null : this.cliProcess;
@@ -2806,6 +2838,16 @@ stderr: ${stderrOutput}` : ""}`
2806
2838
  });
2807
2839
  return { response };
2808
2840
  }
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
+ }
2809
2851
  async handleHooksInvoke(params) {
2810
2852
  if (!params || typeof params.sessionId !== "string" || typeof params.hookType !== "string") {
2811
2853
  throw new Error("Invalid hooks invoke payload");
@@ -41,11 +41,13 @@ 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,
44
45
  workflows,
45
46
  requestedEnvironmentVariables,
46
47
  ...rest
47
48
  } = config;
48
49
  void _stripped;
50
+ void _strippedSkillProvider;
49
51
  return client.resumeSessionForExtension(
50
52
  sessionId,
51
53
  {
@@ -666,21 +666,15 @@ function createServerRpc(connection) {
666
666
  /** @experimental */
667
667
  settings: {
668
668
  /**
669
- * Drops this runtime process's in-memory user settings cache so the next settings read observes disk.
670
- */
671
- reload: async () => connection.sendRequest("user.settings.reload", {}),
672
- /**
673
- * Lists every known user setting (settings.json overlaid with the legacy config.json, config.json wins), each with its effective value, its default, and whether it is at the default — so settings the user has never set still appear with their default value. Does not include repository- or enterprise-managed overrides that the runtime layers on top at session time.
669
+ * Lists every known user setting from settings.json, each with its effective value, its default, and whether it is at the default — so settings the user has never set still appear with their default value. Does not include repository- or enterprise-managed overrides that the runtime layers on top at session time.
674
670
  *
675
- * @returns Per-key metadata for every known user setting (settings.json overlaid with the legacy config.json, config.json wins), including settings left at their default. Excludes repository- and enterprise-managed overrides.
671
+ * @returns Per-key metadata for every known user setting in settings.json, including settings left at their default. Excludes repository- and enterprise-managed overrides.
676
672
  */
677
673
  get: async () => connection.sendRequest("user.settings.get", {}),
678
674
  /**
679
- * Writes one or more user settings to settings.json, replacing each provided top-level key. A key whose value is null is removed. Returns the keys whose new value is shadowed by a legacy config.json entry (config.json wins on read), which the runtime leaves in place — such writes do not take effect until the legacy value is removed.
675
+ * Writes one or more user settings to settings.json, replacing each provided top-level key. A key whose value is null is removed.
680
676
  *
681
677
  * @param params Partial user settings to write to settings.json. Each top-level key is written individually, replacing the existing value; a key whose value is null is removed.
682
- *
683
- * @returns Outcome of writing user settings.
684
678
  */
685
679
  set: async (params) => connection.sendRequest("user.settings.set", params)
686
680
  }
@@ -980,6 +974,37 @@ function createServerRpc(connection) {
980
974
  * @returns Outcome of an agentRegistry.spawn call.
981
975
  */
982
976
  spawn: async (params) => connection.sendRequest("agentRegistry.spawn", params)
977
+ },
978
+ /** @experimental */
979
+ connectors: {
980
+ /**
981
+ * Returns feature availability.
982
+ *
983
+ * @returns Feature availability.
984
+ */
985
+ getCapabilities: async () => connection.sendRequest("connectors.getCapabilities", {}),
986
+ /**
987
+ * Returns eligible accounts.
988
+ *
989
+ * @returns Eligible accounts.
990
+ */
991
+ getAccounts: async () => connection.sendRequest("connectors.getAccounts", {}),
992
+ /**
993
+ * Lists entries for the selected account.
994
+ *
995
+ * @param params Selected account.
996
+ *
997
+ * @returns Entries for the selected account.
998
+ */
999
+ list: async (params) => connection.sendRequest("connectors.list", params),
1000
+ /**
1001
+ * Refreshes entries for the selected account.
1002
+ *
1003
+ * @param params Selected account.
1004
+ *
1005
+ * @returns Entries for the selected account.
1006
+ */
1007
+ refresh: async (params) => connection.sendRequest("connectors.refresh", params)
983
1008
  }
984
1009
  };
985
1010
  }
@@ -1035,6 +1060,133 @@ function createInternalServerRpc(connection) {
1035
1060
  */
1036
1061
  connect: async (params) => connection.sendRequest("connect", params),
1037
1062
  /** @experimental */
1063
+ agents: {
1064
+ /**
1065
+ * 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.
1066
+ *
1067
+ * @returns The agents this runtime ships, named so a consumer can tell them apart from authored ones.
1068
+ */
1069
+ getBuiltins: async () => connection.sendRequest("agents.getBuiltins", {}),
1070
+ /**
1071
+ * 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.
1072
+ *
1073
+ * @param params The feature flags to evaluate shipped agents against.
1074
+ *
1075
+ * @returns The shipped agents available under the requested flags.
1076
+ */
1077
+ getAvailableBuiltins: async (params) => connection.sendRequest("agents.getAvailableBuiltins", params),
1078
+ /**
1079
+ * 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.
1080
+ *
1081
+ * @param params The shipped agent whose definition to load.
1082
+ *
1083
+ * @returns One shipped agent's definition.
1084
+ */
1085
+ getBuiltinDefinition: async (params) => connection.sendRequest("agents.getBuiltinDefinition", params),
1086
+ /**
1087
+ * 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`.
1088
+ *
1089
+ * @param params The shipped agent whose listing entry to load.
1090
+ *
1091
+ * @returns One shipped agent, projected for a listing.
1092
+ */
1093
+ getBuiltinListingDefinition: async (params) => connection.sendRequest("agents.getBuiltinListingDefinition", params),
1094
+ /**
1095
+ * 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.
1096
+ *
1097
+ * @param params The models a custom agent asks for, and the models actually available.
1098
+ *
1099
+ * @returns The model to switch to, and the warning to show when the agent's preference could not be met.
1100
+ */
1101
+ customAgentInitialModelDecision: async (params) => connection.sendRequest("agents.customAgentInitialModelDecision", params)
1102
+ },
1103
+ /** @experimental */
1104
+ globalState: {
1105
+ /**
1106
+ * Reads the host's machine-wide state: which plugins are installed and the one-off flags and timestamps that record what the user has already been shown or migrated. This is the state that outlives a single session and a single workspace, so a host reads it to decide whether to run a first-launch step, offer an onboarding prompt, or skip one it has already completed. The stored credentials are deliberately not part of this result; a caller that needs an authenticated identity asks the account methods for it instead. Reading is non-destructive and every field is optional, because a fresh install has recorded nothing yet.
1107
+ *
1108
+ * @returns The host's machine-wide state. Every field is optional because a fresh install has recorded nothing yet, so a reader must treat an absent field as `not yet`, never as a negative answer. Stored credentials are deliberately absent from this shape.
1109
+ */
1110
+ load: async () => connection.sendRequest("globalState.load", {}),
1111
+ /**
1112
+ * Reads the host's machine-wide state exactly as `globalState.load` does, but from a caller-supplied configuration directory instead of the one the server resolved for itself. Use this when a consumer scopes a session to its own Copilot home — the SDK's per-session `configDir` override — so the state read matches the directory that session actually uses. An absent or empty `configDir` resolves the server's own home, making this identical to `globalState.load`. The stored credentials are omitted here for the same reason they are omitted from `globalState.load`: a caller that needs an authenticated identity asks the account methods instead, so pointing this at another directory cannot be used to read the credentials kept in it.
1113
+ *
1114
+ * @param params Selects the configuration directory whose machine-wide state to read.
1115
+ *
1116
+ * @returns The host's machine-wide state. Every field is optional because a fresh install has recorded nothing yet, so a reader must treat an absent field as `not yet`, never as a negative answer. Stored credentials are deliberately absent from this shape.
1117
+ */
1118
+ loadForConfigDir: async (params) => connection.sendRequest("globalState.loadForConfigDir", params),
1119
+ /**
1120
+ * Records one top-level key in the host's machine-wide state, the counterpart to `globalState.load`. A host calls this to remember that it has shown an onboarding step, asked a one-off question, or completed a migration, so the next run can skip it. Only the named key is replaced and the rest of the document is preserved, which lets two writers record different flags without overwriting each other; passing no value removes the key instead. Only the keys a host records itself are writable: `appInstallNudgeResponded`, `appTipShown`, `askedSetupTerminals`, `autoFeedbackLastPromptedAt`, `firstLaunchAt`, `recentModelIds`, `sandboxCredentialProxyCaDeclined` and `sandboxOnboardingShown`. Every other key is refused, including `installedPlugins`, the stored credentials, `trustedFolders`, the staff flags and the signed-in accounts. Plugin enablement must use the plugin APIs, which apply repository and managed-policy checks.
1121
+ *
1122
+ * @param params A single top-level key to record in the host's machine-wide state. The write replaces only that key and leaves the rest of the document untouched, so two writers recording different one-off flags do not overwrite each other. The stored credential keys cannot be written through this method.
1123
+ */
1124
+ writeKey: async (params) => connection.sendRequest("globalState.writeKey", params)
1125
+ },
1126
+ /** @experimental */
1127
+ gitHubRepository: {
1128
+ /**
1129
+ * 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'.
1130
+ *
1131
+ * @param params Working-tree path whose owning GitHub repository should be resolved.
1132
+ *
1133
+ * @returns The GitHub repository that owns the requested path, when the selected remote (`origin`, else the first) is on a GitHub host.
1134
+ */
1135
+ atPath: async (params) => connection.sendRequest("gitHubRepository.atPath", params)
1136
+ },
1137
+ /** @experimental */
1138
+ gitHubOwners: {
1139
+ /**
1140
+ * 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.
1141
+ *
1142
+ * @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.
1143
+ */
1144
+ nextRequestId: async () => connection.sendRequest("gitHubOwners.nextRequestId", {}),
1145
+ /**
1146
+ * 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`.
1147
+ *
1148
+ * @param params Credential to list owners under, and the request id that makes the listing cancellable.
1149
+ *
1150
+ * @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.
1151
+ */
1152
+ list: async (params) => connection.sendRequest("gitHubOwners.list", params),
1153
+ /**
1154
+ * 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.
1155
+ *
1156
+ * @param params The owner listing to abandon.
1157
+ *
1158
+ * @returns Whether the id named a running owner listing.
1159
+ */
1160
+ cancel: async (params) => connection.sendRequest("gitHubOwners.cancel", params)
1161
+ },
1162
+ /** @experimental */
1163
+ git: {
1164
+ /**
1165
+ * 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.
1166
+ *
1167
+ * @param params Working-tree path a git query applies to.
1168
+ *
1169
+ * @returns The remote the checked-out branch tracks.
1170
+ */
1171
+ currentBranchRemote: async (params) => connection.sendRequest("git.currentBranchRemote", params),
1172
+ /**
1173
+ * 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.
1174
+ *
1175
+ * @param params Working-tree path a git query applies to.
1176
+ *
1177
+ * @returns Updated working directory and git context. Emitted as the new payload of `session.context_changed`.
1178
+ */
1179
+ workingDirectoryContext: async (params) => connection.sendRequest("git.workingDirectoryContext", params),
1180
+ /**
1181
+ * 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.
1182
+ *
1183
+ * @param params Git working tree whose GitHub remotes should be listed.
1184
+ *
1185
+ * @returns The GitHub repositories a working tree's remotes point at.
1186
+ */
1187
+ reposFromRemotes: async (params) => connection.sendRequest("git.reposFromRemotes", params)
1188
+ },
1189
+ /** @experimental */
1038
1190
  sessions: {
1039
1191
  /**
1040
1192
  * Reads lightweight persisted metadata for one local session without opening it.
@@ -1074,6 +1226,30 @@ function createInternalServerRpc(connection) {
1074
1226
  * @param params Session ID to delete from disk.
1075
1227
  */
1076
1228
  delete: async (params) => connection.sendRequest("sessions.delete", params),
1229
+ /**
1230
+ * 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.
1231
+ *
1232
+ * @param params Identity, state location and starting context for a workspace record.
1233
+ *
1234
+ * @returns The workspace record that was written.
1235
+ */
1236
+ createWorkspace: async (params) => connection.sendRequest("sessions.createWorkspace", params),
1237
+ /**
1238
+ * 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.
1239
+ *
1240
+ * @param params Where the session's state lives, as a root directory and the session ID under it.
1241
+ *
1242
+ * @returns The workspace record on disk, omitted when the session has none.
1243
+ */
1244
+ loadWorkspace: async (params) => connection.sendRequest("sessions.loadWorkspace", params),
1245
+ /**
1246
+ * 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`.
1247
+ *
1248
+ * @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.
1249
+ *
1250
+ * @returns The merge completed. The record carries the supplied workspace-schema fields, but a stored `fork_count` stays.
1251
+ */
1252
+ updateWorkspaceFields: async (params) => connection.sendRequest("sessions.updateWorkspaceFields", params),
1077
1253
  /**
1078
1254
  * 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.
1079
1255
  *
@@ -1948,11 +2124,17 @@ function createSessionRpc(connection, sessionId) {
1948
2124
  /** @experimental */
1949
2125
  mcp: {
1950
2126
  /**
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.
2127
+ * Lists materialized MCP servers and their connection status. Cache misses may start and wait for MCP servers.
1952
2128
  *
1953
2129
  * @returns MCP servers configured for the session, with their connection status and host-level state.
1954
2130
  */
1955
2131
  list: async () => connection.sendRequest("session.mcp.list", { sessionId }),
2132
+ /**
2133
+ * 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.
2134
+ *
2135
+ * @returns Effective MCP configuration with optional live observations from matching already materialized servers.
2136
+ */
2137
+ listConfigured: async () => connection.sendRequest("session.mcp.listConfigured", { sessionId }),
1956
2138
  /**
1957
2139
  * 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.
1958
2140
  *
@@ -3401,6 +3583,12 @@ function createInternalSessionRpc(connection, sessionId) {
3401
3583
  },
3402
3584
  /** @experimental */
3403
3585
  mcp: {
3586
+ /**
3587
+ * 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.
3588
+ *
3589
+ * @param params Records which IDE the host is connected to, or clears it.
3590
+ */
3591
+ setConnectedIdeInfo: async (params) => connection.sendRequest("session.mcp.setConnectedIdeInfo", { ...params, sessionId }),
3404
3592
  /**
3405
3593
  * Reloads MCP server connections for the session with an explicit host-provided configuration.
3406
3594
  *
@@ -284,6 +284,7 @@ class CopilotSession {
284
284
  elicitationHandler;
285
285
  exitPlanModeHandler;
286
286
  autoModeSwitchHandler;
287
+ skillProvider;
287
288
  hooks;
288
289
  transformCallbacks;
289
290
  _rpc = null;
@@ -696,6 +697,7 @@ class CopilotSession {
696
697
  this.elicitationHandler = void 0;
697
698
  this.exitPlanModeHandler = void 0;
698
699
  this.autoModeSwitchHandler = void 0;
700
+ this.skillProvider = void 0;
699
701
  this.commandHandlers.clear();
700
702
  this.canvases.clear();
701
703
  this.workflows.clear();
@@ -1602,6 +1604,68 @@ class CopilotSession {
1602
1604
  registerUserInputHandler(handler) {
1603
1605
  this.userInputHandler = handler;
1604
1606
  }
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
+ }
1605
1669
  /**
1606
1670
  * Registers hook handlers for session lifecycle events.
1607
1671
  *
@@ -1955,6 +2019,9 @@ function toCanvasRpcError(error) {
1955
2019
  const message = error instanceof Error ? error.message : String(error);
1956
2020
  return new import_node.ResponseError(import_node.ErrorCodes.InternalError, message, { code, message });
1957
2021
  }
2022
+ function skillProviderFailure(operation) {
2023
+ return new import_node.ResponseError(import_node.ErrorCodes.InternalError, `Skill provider ${operation} failed`);
2024
+ }
1958
2025
  function strictJsonValidationError(context, category, message, path) {
1959
2026
  return new import_node.ResponseError(import_node.ErrorCodes.InternalError, message, {
1960
2027
  code: context.code,
@@ -1,2 +1,2 @@
1
- export declare const COPILOT_CLI_VERSION = "1.0.92-4.unstable.r37553872417.gc9f6176";
1
+ export declare const COPILOT_CLI_VERSION = "1.0.93";
2
2
  export declare const COPILOT_CLI_USE_NPM_PACKAGE = false;
@@ -1,4 +1,4 @@
1
- const COPILOT_CLI_VERSION = "1.0.92-4.unstable.r37553872417.gc9f6176";
1
+ const COPILOT_CLI_VERSION = "1.0.93";
2
2
  const COPILOT_CLI_USE_NPM_PACKAGE = false;
3
3
  export {
4
4
  COPILOT_CLI_USE_NPM_PACKAGE,
package/dist/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
  }