@github/copilot-sdk-win32-x64 1.0.17-preview.5 → 1.0.17-preview.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5004,6 +5004,37 @@ function createServerRpc(connection) {
5004
5004
  * @returns Outcome of an agentRegistry.spawn call.
5005
5005
  */
5006
5006
  spawn: async (params) => connection.sendRequest("agentRegistry.spawn", params)
5007
+ },
5008
+ /** @experimental */
5009
+ connectors: {
5010
+ /**
5011
+ * Returns feature availability.
5012
+ *
5013
+ * @returns Feature availability.
5014
+ */
5015
+ getCapabilities: async () => connection.sendRequest("connectors.getCapabilities", {}),
5016
+ /**
5017
+ * Returns eligible accounts.
5018
+ *
5019
+ * @returns Eligible accounts.
5020
+ */
5021
+ getAccounts: async () => connection.sendRequest("connectors.getAccounts", {}),
5022
+ /**
5023
+ * Lists entries for the selected account.
5024
+ *
5025
+ * @param params Selected account.
5026
+ *
5027
+ * @returns Entries for the selected account.
5028
+ */
5029
+ list: async (params) => connection.sendRequest("connectors.list", params),
5030
+ /**
5031
+ * Refreshes entries for the selected account.
5032
+ *
5033
+ * @param params Selected account.
5034
+ *
5035
+ * @returns Entries for the selected account.
5036
+ */
5037
+ refresh: async (params) => connection.sendRequest("connectors.refresh", params)
5007
5038
  }
5008
5039
  };
5009
5040
  }
@@ -5059,6 +5090,110 @@ function createInternalServerRpc(connection) {
5059
5090
  */
5060
5091
  connect: async (params) => connection.sendRequest("connect", params),
5061
5092
  /** @experimental */
5093
+ agents: {
5094
+ /**
5095
+ * Lists the agents this runtime ships, by name. A consumer separating shipped agents from ones the user or a plugin authored should compare against these names rather than against `AgentInfo.source`: an authored agent may carry the `builtin` source while not being one of these, and the runtime treats the two as separate questions. `disableableNames` is the subset a user may turn off, which a client needs to decide whether to offer a toggle. `yamlBasedNames` is the subset backed by a shipped YAML definition, which a client needs before asking the runtime to load one.
5096
+ *
5097
+ * @returns The agents this runtime ships, named so a consumer can tell them apart from authored ones.
5098
+ */
5099
+ getBuiltins: async () => connection.sendRequest("agents.getBuiltins", {}),
5100
+ /**
5101
+ * Lists the shipped agents a client should offer right now, filtered by the feature flags it passes. `getBuiltins` names every agent the runtime knows about; some of those are gated, so a client rendering a picker wants this narrower list together with the description to show beside each name.
5102
+ *
5103
+ * @param params The feature flags to evaluate shipped agents against.
5104
+ *
5105
+ * @returns The shipped agents available under the requested flags.
5106
+ */
5107
+ getAvailableBuiltins: async (params) => connection.sendRequest("agents.getAvailableBuiltins", params),
5108
+ /**
5109
+ * Loads one shipped agent's YAML definition, for a client that needs what the agent declares rather than only its name. `getBuiltins` reports which names have a definition to load: a name outside its `yamlBasedNames` is special-cased in code and has none. The definition crosses as its own JSON rather than as contract-typed fields, because the runtime parses it with the agent schema's tolerant shape and re-typing it here would drop the keys that shape accepts and this one does not. The projected `__nativeCustomAgent` view the runtime derives is included, so a caller reading the declared model and a caller rendering the agent see the same definition.
5110
+ *
5111
+ * @param params The shipped agent whose definition to load.
5112
+ *
5113
+ * @returns One shipped agent's definition.
5114
+ */
5115
+ getBuiltinDefinition: async (params) => connection.sendRequest("agents.getBuiltinDefinition", params),
5116
+ /**
5117
+ * Projects one shipped agent the way a picker lists it, reading only the metadata at the head of the definition file and stopping before the prompt body. `getBuiltinDefinition` answers the whole definition instead, so a client listing every shipped agent should prefer this one: the cost of a listing grows with the number of agents, and the prompt body is the part a listing never shows. The two also differ in shape. This returns the projected custom agent on its own, whereas `getBuiltinDefinition` returns the authored definition with that projection nested under `__nativeCustomAgent`.
5118
+ *
5119
+ * @param params The shipped agent whose listing entry to load.
5120
+ *
5121
+ * @returns One shipped agent, projected for a listing.
5122
+ */
5123
+ getBuiltinListingDefinition: async (params) => connection.sendRequest("agents.getBuiltinListingDefinition", params),
5124
+ /**
5125
+ * Resolves the model a custom agent asks for against the models actually available, and answers both the model to switch to and the warning a user should see when the agent's preference cannot be met. A custom agent may name several acceptable models in preference order, so the decision is a match rather than a lookup, and an agent whose preference is unavailable is a normal outcome that produces a warning rather than an error. A host must call this rather than pick the first available name itself, because the preference order and the wording of the warning are what keep one installation's agent selection the same as another's.
5126
+ *
5127
+ * @param params The models a custom agent asks for, and the models actually available.
5128
+ *
5129
+ * @returns The model to switch to, and the warning to show when the agent's preference could not be met.
5130
+ */
5131
+ customAgentInitialModelDecision: async (params) => connection.sendRequest("agents.customAgentInitialModelDecision", params)
5132
+ },
5133
+ /** @experimental */
5134
+ gitHubRepository: {
5135
+ /**
5136
+ * Resolves the GitHub repository that owns a working-tree path by reading the selected git remote configured for it, preferring `origin`. Returns a null `repository` when the path is inside a git working tree but that selected remote does not resolve to a GitHub host. Fails when the path is not inside a git working tree at all, so a caller can tell 'not a repository' apart from 'a repository with no GitHub remote'.
5137
+ *
5138
+ * @param params Working-tree path whose owning GitHub repository should be resolved.
5139
+ *
5140
+ * @returns The GitHub repository that owns the requested path, when the selected remote (`origin`, else the first) is on a GitHub host.
5141
+ */
5142
+ atPath: async (params) => connection.sendRequest("gitHubRepository.atPath", params)
5143
+ },
5144
+ /** @experimental */
5145
+ gitHubOwners: {
5146
+ /**
5147
+ * Registers a cancellable owner listing and returns its request id. Separate from `gitHubOwners.list` so the id exists before the listing starts: a caller that abandons the listing the moment it begins would otherwise have nothing to name in `gitHubOwners.cancel`. The id serves one listing only. Long-abandoned unused ids can be released by later allocations.
5148
+ *
5149
+ * @returns A freshly registered request id. Registering it before the listing starts is what lets a cancel that races the request still find the owner listing slot. The id serves one listing only. Long-abandoned unused ids can be released by later allocations.
5150
+ */
5151
+ nextRequestId: async () => connection.sendRequest("gitHubOwners.nextRequestId", {}),
5152
+ /**
5153
+ * Lists the logins the authenticated user may act as — their own account first, then the organizations they belong to — by asking the GitHub API under the supplied credential. No credential travels in the request: `authInfo` selects one the runtime already holds, and the runtime resolves the token and the GitHub host from it. A failure the caller should render arrives as `message`; one it should raise arrives as `throwError`.
5154
+ *
5155
+ * @param params Credential to list owners under, and the request id that makes the listing cancellable.
5156
+ *
5157
+ * @returns Outcome of an owner listing. Exactly one of `owners` and `message` is present, except that `throwError` reports a failure the caller is expected to raise rather than render.
5158
+ */
5159
+ list: async (params) => connection.sendRequest("gitHubOwners.list", params),
5160
+ /**
5161
+ * Abandons an owner listing started with the given request id. Answers `canceled: true` while a listing with that id is running. Answers `canceled: false` when the id was never registered, was registered but not used, was released after being abandoned, or its listing has ended. Canceling an unused id releases it, and a later `list` with that id is refused. The cancel acts only on owner listings and never reaches another request of the host.
5162
+ *
5163
+ * @param params The owner listing to abandon.
5164
+ *
5165
+ * @returns Whether the id named a running owner listing.
5166
+ */
5167
+ cancel: async (params) => connection.sendRequest("gitHubOwners.cancel", params)
5168
+ },
5169
+ /** @experimental */
5170
+ git: {
5171
+ /**
5172
+ * Reads the remote that the branch checked out in a working tree tracks, as `branch.<name>.remote` configures it. Reports `origin` rather than failing whenever there is no tracking configuration to read — on a detached HEAD, on a branch with no upstream, or when git itself fails — because a caller asking which remote to talk to needs an answer it can act on, not an error. Marked internal because it exists to carry a CLI call site off the napi boundary onto the SDK contract; it is migration plumbing, not a surface consumers are meant to depend on.
5173
+ *
5174
+ * @param params Working-tree path a git query applies to.
5175
+ *
5176
+ * @returns The remote the checked-out branch tracks.
5177
+ */
5178
+ currentBranchRemote: async (params) => connection.sendRequest("git.currentBranchRemote", params),
5179
+ /**
5180
+ * Collects the repository context of a working directory in one call: working tree root, repository identifier and host, current branch, and the HEAD and base commits. Every repository field is omitted when the path is not inside a git working tree, and the requested path is echoed back as `cwd`. The answer is the same `SessionWorkingDirectoryContext` that `session.metadata.recordContextChange` accepts, so a caller polling for a context change can forward the result unchanged. Marked internal because it exists to carry a CLI call site off the napi boundary onto the SDK contract; it is migration plumbing, not a surface consumers are meant to depend on. It can become public once an SDK consumer needs to derive session context from a directory itself.
5181
+ *
5182
+ * @param params Working-tree path a git query applies to.
5183
+ *
5184
+ * @returns Updated working directory and git context. Emitted as the new payload of `session.context_changed`.
5185
+ */
5186
+ workingDirectoryContext: async (params) => connection.sendRequest("git.workingDirectoryContext", params),
5187
+ /**
5188
+ * Lists the GitHub repositories a working tree's remotes point at, one entry per distinct repository, so a caller can resolve a base and head repository without parsing remote URLs itself. When several remotes name the same repository, only the first is listed, and the entry keeps that remote name. Remotes pointing at no GitHub host are left out, so an empty list means the tree reaches GitHub through no remote. Failing to read the remotes is reported as an error rather than as an empty list, because the two mean different things to a caller. Marked internal because it exists to carry a CLI call site off the napi boundary onto the SDK contract; it is migration plumbing, not a surface consumers are meant to depend on.
5189
+ *
5190
+ * @param params Git working tree whose GitHub remotes should be listed.
5191
+ *
5192
+ * @returns The GitHub repositories a working tree's remotes point at.
5193
+ */
5194
+ reposFromRemotes: async (params) => connection.sendRequest("git.reposFromRemotes", params)
5195
+ },
5196
+ /** @experimental */
5062
5197
  sessions: {
5063
5198
  /**
5064
5199
  * Reads lightweight persisted metadata for one local session without opening it.
@@ -5098,6 +5233,30 @@ function createInternalServerRpc(connection) {
5098
5233
  * @param params Session ID to delete from disk.
5099
5234
  */
5100
5235
  delete: async (params) => connection.sendRequest("sessions.delete", params),
5236
+ /**
5237
+ * Creates the workspace record for a session that has not been opened yet. A host that hands a session off to another application — writing the record and then launching that application against the session ID — needs the record on disk before any session exists to carry it, which the session-scoped workspace methods cannot do. Replaces any existing record and resets the checkpoint index. When writing to the local filesystem, a stored `fork_count` survives on disk. Returns the record it built, so a surviving stored `fork_count` can differ from the answer.
5238
+ *
5239
+ * @param params Identity, state location and starting context for a workspace record.
5240
+ *
5241
+ * @returns The workspace record that was written.
5242
+ */
5243
+ createWorkspace: async (params) => connection.sendRequest("sessions.createWorkspace", params),
5244
+ /**
5245
+ * Reads a session's workspace record straight from disk, without opening the session. Resuming by session ID has to know where the session lives before it can connect, so the lookup cannot come from the session-scoped workspace methods, which resolve their location from a live session's context. Returns no record when the file is absent.
5246
+ *
5247
+ * @param params Where the session's state lives, as a root directory and the session ID under it.
5248
+ *
5249
+ * @returns The workspace record on disk, omitted when the session has none.
5250
+ */
5251
+ loadWorkspace: async (params) => connection.sendRequest("sessions.loadWorkspace", params),
5252
+ /**
5253
+ * Merges fields into a session's workspace record on disk, creating the record when it is absent. The counterpart to `sessions.loadWorkspace`, for the same before-the-session-exists case. It preserves stored workspace-schema fields the request does not supply, does not preserve stored keys outside the workspace schema, and never replaces a stored `fork_count`.
5254
+ *
5255
+ * @param params Where the session's state lives, plus workspace-schema fields to merge into its workspace record. Stored keys outside the schema are not preserved, and a stored `fork_count` is never replaced.
5256
+ *
5257
+ * @returns The merge completed. The record carries the supplied workspace-schema fields, but a stored `fork_count` stays.
5258
+ */
5259
+ updateWorkspaceFields: async (params) => connection.sendRequest("sessions.updateWorkspaceFields", params),
5101
5260
  /**
5102
5261
  * Gets the dynamic-context board entry count associated with a session, when available. Internal: this exists solely so CLI telemetry events (`rem_spawn_gate`, `rem_consolidation_complete`) can pair START / END board counts around the detached rem-agent spawn. "Dynamic context board" is a runtime-internal concept that is not part of the public SDK contract; the long-term plan is to relocate the telemetry emission into the runtime so this method can be deleted entirely.
5103
5262
  *
@@ -7431,6 +7590,12 @@ function createInternalSessionRpc(connection, sessionId) {
7431
7590
  },
7432
7591
  /** @experimental */
7433
7592
  mcp: {
7593
+ /**
7594
+ * Records the IDE the host is connected to, so the agent's system prompt can name it and its workspace folder. Null or an omitted `ide` clears the recorded value, which is how a host reports that it is disconnected; there is no separate clear method. Both `ideName` and `workspaceFolder` are required together, because half a state cannot be attributed to a project.
7595
+ *
7596
+ * @param params Records which IDE the host is connected to, or clears it.
7597
+ */
7598
+ setConnectedIdeInfo: async (params) => connection.sendRequest("session.mcp.setConnectedIdeInfo", { ...params, sessionId }),
7434
7599
  /**
7435
7600
  * Reloads MCP server connections for the session with an explicit host-provided configuration.
7436
7601
  *
@@ -9330,6 +9495,7 @@ var CopilotSession = class {
9330
9495
  elicitationHandler;
9331
9496
  exitPlanModeHandler;
9332
9497
  autoModeSwitchHandler;
9498
+ skillProvider;
9333
9499
  hooks;
9334
9500
  transformCallbacks;
9335
9501
  _rpc = null;
@@ -9742,6 +9908,7 @@ var CopilotSession = class {
9742
9908
  this.elicitationHandler = void 0;
9743
9909
  this.exitPlanModeHandler = void 0;
9744
9910
  this.autoModeSwitchHandler = void 0;
9911
+ this.skillProvider = void 0;
9745
9912
  this.commandHandlers.clear();
9746
9913
  this.canvases.clear();
9747
9914
  this.workflows.clear();
@@ -10648,6 +10815,68 @@ var CopilotSession = class {
10648
10815
  registerUserInputHandler(handler) {
10649
10816
  this.userInputHandler = handler;
10650
10817
  }
10818
+ /**
10819
+ * Registers the session's skill provider.
10820
+ *
10821
+ * @param provider - The skill provider, or undefined to remove it
10822
+ * @internal This method is typically called internally when creating a session.
10823
+ */
10824
+ registerSkillProvider(provider) {
10825
+ this.skillProvider = provider;
10826
+ }
10827
+ /**
10828
+ * Handles a `skillProvider.list` request from the runtime.
10829
+ *
10830
+ * @internal This method is for internal use by the SDK.
10831
+ */
10832
+ async _handleSkillProviderList(token) {
10833
+ const provider = this.requireSkillProvider();
10834
+ return await this.callSkillProvider("listSkills", token, async (options) => ({
10835
+ skills: await provider.listSkills(options) ?? []
10836
+ }));
10837
+ }
10838
+ /**
10839
+ * Handles a `skillProvider.read` request from the runtime.
10840
+ *
10841
+ * @internal This method is for internal use by the SDK.
10842
+ */
10843
+ async _handleSkillProviderRead(name, token) {
10844
+ const provider = this.requireSkillProvider();
10845
+ return await this.callSkillProvider("readSkill", token, async (options) => ({
10846
+ markdown: await provider.readSkill(name, options) ?? null
10847
+ }));
10848
+ }
10849
+ requireSkillProvider() {
10850
+ if (!this.skillProvider) {
10851
+ throw new Error(`No skill provider for session: ${this.sessionId}`);
10852
+ }
10853
+ return this.skillProvider;
10854
+ }
10855
+ /**
10856
+ * Runs a provider call with an abort signal tied to the runtime's request
10857
+ * cancellation. Failures are logged locally and reported generically.
10858
+ */
10859
+ async callSkillProvider(operation, token, call) {
10860
+ const controller = new AbortController();
10861
+ const subscription = token?.onCancellationRequested(() => controller.abort());
10862
+ if (token?.isCancellationRequested) {
10863
+ controller.abort();
10864
+ }
10865
+ try {
10866
+ return await call({ signal: controller.signal });
10867
+ } catch (error) {
10868
+ if (controller.signal.aborted) {
10869
+ throw new import_node.ResponseError(-32800, `Skill provider ${operation} cancelled`);
10870
+ }
10871
+ console.error(`Skill provider ${operation} failed`, {
10872
+ sessionId: this.sessionId,
10873
+ error
10874
+ });
10875
+ throw skillProviderFailure(operation);
10876
+ } finally {
10877
+ subscription?.dispose();
10878
+ }
10879
+ }
10651
10880
  /**
10652
10881
  * Registers hook handlers for session lifecycle events.
10653
10882
  *
@@ -11001,6 +11230,9 @@ function toCanvasRpcError(error) {
11001
11230
  const message = error instanceof Error ? error.message : String(error);
11002
11231
  return new import_node.ResponseError(import_node.ErrorCodes.InternalError, message, { code, message });
11003
11232
  }
11233
+ function skillProviderFailure(operation) {
11234
+ return new import_node.ResponseError(import_node.ErrorCodes.InternalError, `Skill provider ${operation} failed`);
11235
+ }
11004
11236
  function strictJsonValidationError(context, category, message, path) {
11005
11237
  return new import_node.ResponseError(import_node.ErrorCodes.InternalError, message, {
11006
11238
  code: context.code,
@@ -12707,6 +12939,9 @@ var CopilotClient = class _CopilotClient {
12707
12939
  if (config.gitHubToken !== void 0 && config.gitHubTokenProvider !== void 0) {
12708
12940
  throw new Error("gitHubToken and gitHubTokenProvider are mutually exclusive");
12709
12941
  }
12942
+ if (config.cloud != null && config.skillProvider) {
12943
+ throw new Error("Skill providers are not supported for cloud sessions.");
12944
+ }
12710
12945
  if (!this.connection) {
12711
12946
  await this.start();
12712
12947
  }
@@ -12766,6 +13001,9 @@ var CopilotClient = class _CopilotClient {
12766
13001
  if (config.hooks) {
12767
13002
  s.registerHooks(config.hooks);
12768
13003
  }
13004
+ if (config.skillProvider) {
13005
+ s.registerSkillProvider(config.skillProvider);
13006
+ }
12769
13007
  if (transformCallbacks) {
12770
13008
  s.registerTransformCallbacks(transformCallbacks);
12771
13009
  }
@@ -12872,6 +13110,7 @@ var CopilotClient = class _CopilotClient {
12872
13110
  enableSessionStore: config.enableSessionStore,
12873
13111
  enableSkills: config.enableSkills,
12874
13112
  skillDirectories: config.skillDirectories,
13113
+ ...config.skillProvider ? { hasSkillProvider: true } : {},
12875
13114
  pluginDirectories: config.pluginDirectories,
12876
13115
  instructionDirectories: config.instructionDirectories,
12877
13116
  disabledSkills: config.disabledSkills,
@@ -13025,6 +13264,9 @@ var CopilotClient = class _CopilotClient {
13025
13264
  if (config.hooks) {
13026
13265
  session.registerHooks(config.hooks);
13027
13266
  }
13267
+ if (config.skillProvider) {
13268
+ session.registerSkillProvider(config.skillProvider);
13269
+ }
13028
13270
  const modeDefaults = this.configDefaultsForMode();
13029
13271
  config = { ...modeDefaults, ...config };
13030
13272
  config.customAgentsLocalOnly ??= modeDefaults.customAgentsLocalOnly;
@@ -13038,9 +13280,10 @@ var CopilotClient = class _CopilotClient {
13038
13280
  if (config.onEvent) {
13039
13281
  session.on(config.onEvent);
13040
13282
  }
13283
+ const toolFilterOptions = this.resolveToolFilterOptions(config);
13041
13284
  this.setupSessionFs(session, config);
13285
+ const replacedSession = this.sessions.get(sessionId);
13042
13286
  this.sessions.set(sessionId, session);
13043
- const toolFilterOptions = this.resolveToolFilterOptions(config);
13044
13287
  const gitHubTokenProviderRegistrationId = this.registerGitHubTokenProvider(
13045
13288
  config.gitHubTokenProvider,
13046
13289
  sessionId
@@ -13133,6 +13376,7 @@ var CopilotClient = class _CopilotClient {
13133
13376
  defaultAgent: config.defaultAgent,
13134
13377
  agent: config.agent,
13135
13378
  skillDirectories: config.skillDirectories,
13379
+ ...config.skillProvider ? { hasSkillProvider: true } : {},
13136
13380
  pluginDirectories: config.pluginDirectories,
13137
13381
  instructionDirectories: config.instructionDirectories,
13138
13382
  disabledSkills: config.disabledSkills,
@@ -13177,7 +13421,13 @@ var CopilotClient = class _CopilotClient {
13177
13421
  this.commitGitHubTokenProvider(sessionId, gitHubTokenProviderRegistrationId);
13178
13422
  } catch (e) {
13179
13423
  session._markDisconnected();
13180
- this.sessions.delete(sessionId);
13424
+ if (this.sessions.get(sessionId) === session) {
13425
+ if (replacedSession) {
13426
+ this.sessions.set(sessionId, replacedSession);
13427
+ } else {
13428
+ this.sessions.delete(sessionId);
13429
+ }
13430
+ }
13181
13431
  if (gitHubTokenProviderRegistrationId !== void 0) {
13182
13432
  this.githubTokenProviders.delete(gitHubTokenProviderRegistrationId);
13183
13433
  }
@@ -14153,6 +14403,20 @@ stderr: ${stderrOutput}` : ""}`
14153
14403
  return await this.handleHooksInvoke(params);
14154
14404
  }
14155
14405
  );
14406
+ this.connection.onRequest(
14407
+ "skillProvider.list",
14408
+ async (params, token) => await this.resolveSkillProviderSession(params)._handleSkillProviderList(token)
14409
+ );
14410
+ this.connection.onRequest(
14411
+ "skillProvider.read",
14412
+ async (params, token) => {
14413
+ const session = this.resolveSkillProviderSession(params);
14414
+ if (typeof params.name !== "string") {
14415
+ throw new Error("Invalid skillProvider.read payload");
14416
+ }
14417
+ return await session._handleSkillProviderRead(params.name, token);
14418
+ }
14419
+ );
14156
14420
  const connection = this.connection;
14157
14421
  const messageWriter = this.messageWriter;
14158
14422
  const cliProcess = this.isExternalServer ? null : this.cliProcess;
@@ -14309,6 +14573,16 @@ stderr: ${stderrOutput}` : ""}`
14309
14573
  });
14310
14574
  return { response };
14311
14575
  }
14576
+ resolveSkillProviderSession(params) {
14577
+ if (!params || typeof params.sessionId !== "string") {
14578
+ throw new Error("Invalid skillProvider payload");
14579
+ }
14580
+ const session = this.sessions.get(params.sessionId);
14581
+ if (!session) {
14582
+ throw new Error(`Session not found: ${params.sessionId}`);
14583
+ }
14584
+ return session;
14585
+ }
14312
14586
  async handleHooksInvoke(params) {
14313
14587
  if (!params || typeof params.sessionId !== "string" || typeof params.hookType !== "string") {
14314
14588
  throw new Error("Invalid hooks invoke payload");
@@ -59,6 +59,7 @@ export declare class CopilotSession {
59
59
  private elicitationHandler?;
60
60
  private exitPlanModeHandler?;
61
61
  private autoModeSwitchHandler?;
62
+ private skillProvider?;
62
63
  private hooks?;
63
64
  private transformCallbacks?;
64
65
  private _rpc;
@@ -235,6 +236,12 @@ export declare class CopilotSession {
235
236
  private _confirm;
236
237
  private _select;
237
238
  private _input;
239
+ private requireSkillProvider;
240
+ /**
241
+ * Runs a provider call with an abort signal tied to the runtime's request
242
+ * cancellation. Failures are logged locally and reported generically.
243
+ */
244
+ private callSkillProvider;
238
245
  /**
239
246
  * Retrieves all events and messages from this session's history.
240
247
  *
@@ -50,6 +50,8 @@ export type { SessionFsSqliteTransactionErrorClass } from "./sessionFsProvider.j
50
50
  export { SessionFsSqliteTransactionFailure } from "./sessionFsProvider.js";
51
51
  export { SessionFsWriteFailure } from "./sessionFsProvider.js";
52
52
  export type { LlmInferenceHeaders } from "./generated/rpc.js";
53
+ import type { SkillProviderDescriptor } from "./generated/rpc.js";
54
+ export type { SkillProviderDescriptor };
53
55
  export type { PermissionDecisionContext, PermissionDecisionOutcome, PermissionDecisionSurface, PermissionResponseCapability, } from "./generated/rpc.js";
54
56
  export type { PermissionDecisionSource } from "./generated/session-events.js";
55
57
  export type { CopilotRequestContext } from "./copilotRequestHandler.js";
@@ -1893,6 +1895,57 @@ export interface ManagedSettings {
1893
1895
  }
1894
1896
  /** Selects the model-facing shape of the built-in `ask_user` tool. */
1895
1897
  export type AskUserVariant = "legacy" | "elicitation";
1898
+ /**
1899
+ * Supplies session-scoped skills from the host's own storage, such as a
1900
+ * database, instead of `SKILL.md` files on disk.
1901
+ *
1902
+ * The runtime calls {@link SkillProvider.listSkills} when it builds the
1903
+ * session's skill catalog, and {@link SkillProvider.readSkill} each time it
1904
+ * needs a skill's instructions: when the model loads the skill through the
1905
+ * `skill` tool, when a user runs `/skill-name`, or when a custom agent lists
1906
+ * the skill. Calls may run concurrently, including on behalf of sub-agents, and
1907
+ * each call must finish within 30 seconds. Errors thrown by a provider are
1908
+ * never shown to the model.
1909
+ *
1910
+ * Supply a provider with {@link SessionConfigBase.skillProvider}. Providers
1911
+ * aren't supported for cloud sessions.
1912
+ *
1913
+ * @experimental Session-scoped skill providers are experimental and may change
1914
+ * or be removed in future SDK or CLI releases.
1915
+ */
1916
+ export interface SkillProvider {
1917
+ /**
1918
+ * Returns catalog metadata for every skill the provider supplies. The
1919
+ * descriptors are authoritative: names must be unique ignoring case, and
1920
+ * the runtime validates their limits.
1921
+ */
1922
+ listSkills(options: SkillProviderCallOptions): SkillProviderDescriptor[] | Promise<SkillProviderDescriptor[]>;
1923
+ /**
1924
+ * Returns the `SKILL.md` text for the named skill, or `null`/`undefined`
1925
+ * when the skill no longer exists.
1926
+ *
1927
+ * YAML frontmatter is optional. Fields it omits come from the skill's
1928
+ * descriptor, fields it declares must match the descriptor, and
1929
+ * `allowed-tools` can only be set there. Text whose first line is `---` is
1930
+ * parsed as frontmatter.
1931
+ *
1932
+ * @param name - The skill's name, as listed by {@link SkillProvider.listSkills}.
1933
+ */
1934
+ readSkill(name: string, options: SkillProviderCallOptions): string | null | undefined | Promise<string | null | undefined>;
1935
+ }
1936
+ /**
1937
+ * Per-call options passed to {@link SkillProvider} methods.
1938
+ *
1939
+ * @experimental Session-scoped skill providers are experimental and may change
1940
+ * or be removed in future SDK or CLI releases.
1941
+ */
1942
+ export interface SkillProviderCallOptions {
1943
+ /**
1944
+ * Aborted when the runtime cancels the call, for example when it times out
1945
+ * or the session disconnects. The runtime ignores any later result.
1946
+ */
1947
+ signal: AbortSignal;
1948
+ }
1896
1949
  /**
1897
1950
  * Shared configuration fields used by both {@link SessionConfig} (for
1898
1951
  * creating a new session) and {@link ResumeSessionConfig} (for resuming
@@ -2312,6 +2365,22 @@ export interface SessionConfigBase {
2312
2365
  * Directories to load skills from.
2313
2366
  */
2314
2367
  skillDirectories?: string[];
2368
+ /**
2369
+ * Supplies skills from the host's own storage instead of `SKILL.md` files on
2370
+ * disk. Provider skills join the session's skill catalog alongside file-based
2371
+ * skills. See {@link SkillProvider}.
2372
+ *
2373
+ * Supplying a provider enables skills unless `enableSkills` is set explicitly,
2374
+ * so set `enableSkills: true` when the client runs in `"empty"` mode. With
2375
+ * `enableSkills: false` the provider stays bound but receives no calls.
2376
+ *
2377
+ * The provider isn't persisted. Pass it again when resuming the session;
2378
+ * resuming without one removes the provider's skills.
2379
+ *
2380
+ * @experimental Session-scoped skill providers are experimental and may change
2381
+ * or be removed in future SDK or CLI releases.
2382
+ */
2383
+ skillProvider?: SkillProvider;
2315
2384
  /**
2316
2385
  * Local filesystem paths to Open Plugins-format directories
2317
2386
  * (https://open-plugins.com/) to load for this session.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@github/copilot-sdk-win32-x64",
3
- "version": "1.0.17-preview.5",
3
+ "version": "1.0.17-preview.6",
4
4
  "description": "Platform runtime for @github/copilot-sdk (win32-x64)",
5
5
  "repository": {
6
6
  "type": "git",
Binary file
Binary file
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/prebuilds/win32-x64/runtime.node
3
- size: 107126048 bytes
4
- sha256: 144ede5b5f9f80d9f748663abe5d1b9e4e088965b607e801bb53cc435d4eea42
3
+ size: 108733216 bytes
4
+ sha256: 846875d5ac7d520a98d81a283869455a390f3333b955f153b5aa1a19df8dfdda
Binary file