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

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/dist/session.js CHANGED
@@ -266,6 +266,7 @@ class CopilotSession {
266
266
  elicitationHandler;
267
267
  exitPlanModeHandler;
268
268
  autoModeSwitchHandler;
269
+ skillProvider;
269
270
  hooks;
270
271
  transformCallbacks;
271
272
  _rpc = null;
@@ -678,6 +679,7 @@ class CopilotSession {
678
679
  this.elicitationHandler = void 0;
679
680
  this.exitPlanModeHandler = void 0;
680
681
  this.autoModeSwitchHandler = void 0;
682
+ this.skillProvider = void 0;
681
683
  this.commandHandlers.clear();
682
684
  this.canvases.clear();
683
685
  this.workflows.clear();
@@ -1584,6 +1586,68 @@ class CopilotSession {
1584
1586
  registerUserInputHandler(handler) {
1585
1587
  this.userInputHandler = handler;
1586
1588
  }
1589
+ /**
1590
+ * Registers the session's skill provider.
1591
+ *
1592
+ * @param provider - The skill provider, or undefined to remove it
1593
+ * @internal This method is typically called internally when creating a session.
1594
+ */
1595
+ registerSkillProvider(provider) {
1596
+ this.skillProvider = provider;
1597
+ }
1598
+ /**
1599
+ * Handles a `skillProvider.list` request from the runtime.
1600
+ *
1601
+ * @internal This method is for internal use by the SDK.
1602
+ */
1603
+ async _handleSkillProviderList(token) {
1604
+ const provider = this.requireSkillProvider();
1605
+ return await this.callSkillProvider("listSkills", token, async (options) => ({
1606
+ skills: await provider.listSkills(options) ?? []
1607
+ }));
1608
+ }
1609
+ /**
1610
+ * Handles a `skillProvider.read` request from the runtime.
1611
+ *
1612
+ * @internal This method is for internal use by the SDK.
1613
+ */
1614
+ async _handleSkillProviderRead(name, token) {
1615
+ const provider = this.requireSkillProvider();
1616
+ return await this.callSkillProvider("readSkill", token, async (options) => ({
1617
+ markdown: await provider.readSkill(name, options) ?? null
1618
+ }));
1619
+ }
1620
+ requireSkillProvider() {
1621
+ if (!this.skillProvider) {
1622
+ throw new Error(`No skill provider for session: ${this.sessionId}`);
1623
+ }
1624
+ return this.skillProvider;
1625
+ }
1626
+ /**
1627
+ * Runs a provider call with an abort signal tied to the runtime's request
1628
+ * cancellation. Failures are logged locally and reported generically.
1629
+ */
1630
+ async callSkillProvider(operation, token, call) {
1631
+ const controller = new AbortController();
1632
+ const subscription = token?.onCancellationRequested(() => controller.abort());
1633
+ if (token?.isCancellationRequested) {
1634
+ controller.abort();
1635
+ }
1636
+ try {
1637
+ return await call({ signal: controller.signal });
1638
+ } catch (error) {
1639
+ if (controller.signal.aborted) {
1640
+ throw new ResponseError(-32800, `Skill provider ${operation} cancelled`);
1641
+ }
1642
+ console.error(`Skill provider ${operation} failed`, {
1643
+ sessionId: this.sessionId,
1644
+ error
1645
+ });
1646
+ throw skillProviderFailure(operation);
1647
+ } finally {
1648
+ subscription?.dispose();
1649
+ }
1650
+ }
1587
1651
  /**
1588
1652
  * Registers hook handlers for session lifecycle events.
1589
1653
  *
@@ -1937,6 +2001,9 @@ function toCanvasRpcError(error) {
1937
2001
  const message = error instanceof Error ? error.message : String(error);
1938
2002
  return new ResponseError(ErrorCodes.InternalError, message, { code, message });
1939
2003
  }
2004
+ function skillProviderFailure(operation) {
2005
+ return new ResponseError(ErrorCodes.InternalError, `Skill provider ${operation} failed`);
2006
+ }
1940
2007
  function strictJsonValidationError(context, category, message, path) {
1941
2008
  return new ResponseError(ErrorCodes.InternalError, message, {
1942
2009
  code: context.code,
package/dist/types.d.ts CHANGED
@@ -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";
@@ -1869,6 +1871,11 @@ export interface ManagedSettingsPermissions {
1869
1871
  * values are forwarded so newer runtime policies fail closed.
1870
1872
  */
1871
1873
  disableBypassPermissionsMode?: string;
1874
+ /**
1875
+ * When true, prevents Assisted Permissions from being activated. Omit or
1876
+ * set to false to impose no restriction.
1877
+ */
1878
+ disableAssistedPermissionsMode?: boolean;
1872
1879
  /** Operations that must always be denied. Unioned across managed layers. */
1873
1880
  deny?: string[];
1874
1881
  /**
@@ -1880,6 +1887,13 @@ export interface ManagedSettingsPermissions {
1880
1887
  * (across managed layers) must admit an operation for it to be allowed.
1881
1888
  */
1882
1889
  allow?: string[];
1890
+ /**
1891
+ * Closed-world host boundary expressed as `Domain(hostname)`, `Domain(IP)`,
1892
+ * or `Domain(*.example.com)` rules. Schemes, ports, paths, queries, and
1893
+ * fragments are rejected. Multiple managed layers intersect their lists;
1894
+ * an empty list denies all hosts.
1895
+ */
1896
+ limitTo?: string[];
1883
1897
  }
1884
1898
  /**
1885
1899
  * Host-injected enterprise managed settings. The first supported contract is
@@ -1893,6 +1907,57 @@ export interface ManagedSettings {
1893
1907
  }
1894
1908
  /** Selects the model-facing shape of the built-in `ask_user` tool. */
1895
1909
  export type AskUserVariant = "legacy" | "elicitation";
1910
+ /**
1911
+ * Supplies session-scoped skills from the host's own storage, such as a
1912
+ * database, instead of `SKILL.md` files on disk.
1913
+ *
1914
+ * The runtime calls {@link SkillProvider.listSkills} when it builds the
1915
+ * session's skill catalog, and {@link SkillProvider.readSkill} each time it
1916
+ * needs a skill's instructions: when the model loads the skill through the
1917
+ * `skill` tool, when a user runs `/skill-name`, or when a custom agent lists
1918
+ * the skill. Calls may run concurrently, including on behalf of sub-agents, and
1919
+ * each call must finish within 30 seconds. Errors thrown by a provider are
1920
+ * never shown to the model.
1921
+ *
1922
+ * Supply a provider with {@link SessionConfigBase.skillProvider}. Providers
1923
+ * aren't supported for cloud sessions.
1924
+ *
1925
+ * @experimental Session-scoped skill providers are experimental and may change
1926
+ * or be removed in future SDK or CLI releases.
1927
+ */
1928
+ export interface SkillProvider {
1929
+ /**
1930
+ * Returns catalog metadata for every skill the provider supplies. The
1931
+ * descriptors are authoritative: names must be unique ignoring case, and
1932
+ * the runtime validates their limits.
1933
+ */
1934
+ listSkills(options: SkillProviderCallOptions): SkillProviderDescriptor[] | Promise<SkillProviderDescriptor[]>;
1935
+ /**
1936
+ * Returns the `SKILL.md` text for the named skill, or `null`/`undefined`
1937
+ * when the skill no longer exists.
1938
+ *
1939
+ * YAML frontmatter is optional. Fields it omits come from the skill's
1940
+ * descriptor, fields it declares must match the descriptor, and
1941
+ * `allowed-tools` can only be set there. Text whose first line is `---` is
1942
+ * parsed as frontmatter.
1943
+ *
1944
+ * @param name - The skill's name, as listed by {@link SkillProvider.listSkills}.
1945
+ */
1946
+ readSkill(name: string, options: SkillProviderCallOptions): string | null | undefined | Promise<string | null | undefined>;
1947
+ }
1948
+ /**
1949
+ * Per-call options passed to {@link SkillProvider} methods.
1950
+ *
1951
+ * @experimental Session-scoped skill providers are experimental and may change
1952
+ * or be removed in future SDK or CLI releases.
1953
+ */
1954
+ export interface SkillProviderCallOptions {
1955
+ /**
1956
+ * Aborted when the runtime cancels the call, for example when it times out
1957
+ * or the session disconnects. The runtime ignores any later result.
1958
+ */
1959
+ signal: AbortSignal;
1960
+ }
1896
1961
  /**
1897
1962
  * Shared configuration fields used by both {@link SessionConfig} (for
1898
1963
  * creating a new session) and {@link ResumeSessionConfig} (for resuming
@@ -2312,6 +2377,22 @@ export interface SessionConfigBase {
2312
2377
  * Directories to load skills from.
2313
2378
  */
2314
2379
  skillDirectories?: string[];
2380
+ /**
2381
+ * Supplies skills from the host's own storage instead of `SKILL.md` files on
2382
+ * disk. Provider skills join the session's skill catalog alongside file-based
2383
+ * skills. See {@link SkillProvider}.
2384
+ *
2385
+ * Supplying a provider enables skills unless `enableSkills` is set explicitly,
2386
+ * so set `enableSkills: true` when the client runs in `"empty"` mode. With
2387
+ * `enableSkills: false` the provider stays bound but receives no calls.
2388
+ *
2389
+ * The provider isn't persisted. Pass it again when resuming the session;
2390
+ * resuming without one removes the provider's skills.
2391
+ *
2392
+ * @experimental Session-scoped skill providers are experimental and may change
2393
+ * or be removed in future SDK or CLI releases.
2394
+ */
2395
+ skillProvider?: SkillProvider;
2315
2396
  /**
2316
2397
  * Local filesystem paths to Open Plugins-format directories
2317
2398
  * (https://open-plugins.com/) to load for this session.
@@ -2377,6 +2458,12 @@ export interface SessionConfigBase {
2377
2458
  * if omitted, the runtime is expected to reject session creation (fail-closed).
2378
2459
  */
2379
2460
  enableManagedSettings?: boolean;
2461
+ /**
2462
+ * When true, locked managed model controls are enforced for this session.
2463
+ * Conflicting model changes are rejected, and locked startup values replace
2464
+ * conflicting session options. Overridable managed defaults remain mutable.
2465
+ */
2466
+ enforceManagedModelDefaults?: boolean;
2380
2467
  /**
2381
2468
  * Host-injected enterprise managed settings for this session.
2382
2469
  *
package/package.json CHANGED
@@ -5,8 +5,8 @@
5
5
  "url": "https://github.com/github/copilot-agent-runtime.git",
6
6
  "directory": "src/sdk/nodejs"
7
7
  },
8
- "version": "1.0.17-unstable.37553872417.gc9f6176",
9
- "copilotCliVersion": "1.0.92-4.unstable.r37553872417.gc9f6176",
8
+ "version": "1.0.18-preview.0",
9
+ "copilotCliVersion": "1.0.94-0",
10
10
  "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
11
11
  "main": "./dist/cjs/index.js",
12
12
  "types": "./dist/index.d.ts",
@@ -103,18 +103,18 @@
103
103
  "README.md"
104
104
  ],
105
105
  "copilotRuntime": {
106
- "sourceSha": "c9f6176371c5f61d81a031ed0f237096a436fd69",
107
- "version": "1.0.92-4.unstable.r37553872417.gc9f6176",
106
+ "sourceSha": "5e60ea8ecadacaa0c999ec02e40541e13a165349",
107
+ "version": "1.0.94-0",
108
108
  "visibility": "public"
109
109
  },
110
110
  "optionalDependencies": {
111
- "@github/copilot-sdk-darwin-arm64": "1.0.17-unstable.37553872417.gc9f6176",
112
- "@github/copilot-sdk-darwin-x64": "1.0.17-unstable.37553872417.gc9f6176",
113
- "@github/copilot-sdk-linux-arm64": "1.0.17-unstable.37553872417.gc9f6176",
114
- "@github/copilot-sdk-linux-x64": "1.0.17-unstable.37553872417.gc9f6176",
115
- "@github/copilot-sdk-linuxmusl-arm64": "1.0.17-unstable.37553872417.gc9f6176",
116
- "@github/copilot-sdk-linuxmusl-x64": "1.0.17-unstable.37553872417.gc9f6176",
117
- "@github/copilot-sdk-win32-arm64": "1.0.17-unstable.37553872417.gc9f6176",
118
- "@github/copilot-sdk-win32-x64": "1.0.17-unstable.37553872417.gc9f6176"
111
+ "@github/copilot-sdk-darwin-arm64": "1.0.18-preview.0",
112
+ "@github/copilot-sdk-darwin-x64": "1.0.18-preview.0",
113
+ "@github/copilot-sdk-linux-arm64": "1.0.18-preview.0",
114
+ "@github/copilot-sdk-linux-x64": "1.0.18-preview.0",
115
+ "@github/copilot-sdk-linuxmusl-arm64": "1.0.18-preview.0",
116
+ "@github/copilot-sdk-linuxmusl-x64": "1.0.18-preview.0",
117
+ "@github/copilot-sdk-win32-arm64": "1.0.18-preview.0",
118
+ "@github/copilot-sdk-win32-x64": "1.0.18-preview.0"
119
119
  }
120
120
  }