@github/copilot-sdk 1.0.15-preview.0 → 1.0.15-preview.1

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
@@ -14,10 +14,14 @@ verified `github/copilot-cli` release assets when the SDK is published, so
14
14
  starting the SDK performs no runtime download. Set `COPILOT_CLI_PATH` to use an
15
15
  existing installation instead.
16
16
 
17
- The checked-in release pin is `copilotCliVersion` in `package.json`. Run
18
- `npm run set:cli-version -- <version>` to update it and regenerate the compiled
19
- metadata in `src/cliVersion.ts`. Packaging verifies release assets against the
20
- release's `SHA256SUMS.txt`.
17
+ The checked-in `copilotCliVersion` in `package.json` and compiled metadata in
18
+ `src/cliVersion.ts` use a development placeholder. The public SDK snapshot
19
+ replaces both with the CLI version published for that snapshot.
20
+
21
+ Do not change these pins for runtime-repository development. If they contain
22
+ `0.0.0-dev`, use the same-checkout runtime; release snapshot export owns replacing
23
+ development placeholders with a published CLI version. See
24
+ [checkout preparation](../CONTRIBUTING.md#testing-an-unreleased-runtime-api).
21
25
 
22
26
  `npm run pack:release` builds the main package and all platform packages. Set
23
27
  `COPILOT_CLI_DOWNLOAD_BASE_URL` to use a release mirror while packaging.
@@ -26,6 +30,12 @@ containing validated runtime npm package roots named for all eight platforms.
26
30
  This keeps `COPILOT_CLI_USE_NPM_PACKAGE` false and embeds those runtime files in
27
31
  the self-contained SDK platform packages.
28
32
 
33
+ In the runtime repository, packaging uses the prepared same-checkout runtime.
34
+ Set `COPILOT_SDK_RUNTIME_PLATFORMS` to the available target (for example,
35
+ `linux-x64`) for both `pack:release` and `verify:release-packages`. SDK CI checks
36
+ that target only; public release workflows leave this unset to package and
37
+ verify all eight platforms.
38
+
29
39
  ## Installation
30
40
 
31
41
  ```bash
@@ -34,7 +44,11 @@ npm install @github/copilot-sdk
34
44
 
35
45
  ## Run the Sample
36
46
 
37
- Try the interactive chat sample (from the repo root):
47
+ Try the interactive chat sample from the SDK root (`src/sdk` when nested).
48
+ In the runtime repository, first run `pnpm run build:cli` from the runtime root
49
+ to prepare the same-checkout executable, then return to `src/sdk`.
50
+ Building the Node SDK alone does not build the runtime. For dependency
51
+ prerequisites, see [development setup](#development).
38
52
 
39
53
  ```bash
40
54
  cd nodejs
@@ -1274,19 +1288,28 @@ try {
1274
1288
 
1275
1289
  ## Development
1276
1290
 
1277
- From the repository root:
1291
+ Follow [SDK development setup](../CONTRIBUTING.md#developing-an-sdk) first,
1292
+ including the harness and corrections-script dependencies. From the SDK root
1293
+ (`src/sdk` in the runtime repository, or the standalone repository root):
1278
1294
 
1279
1295
  ```bash
1280
- cd test/harness
1281
- npm ci
1296
+ npm run build:nodejs
1297
+ npm run test:nodejs
1298
+ npm run check:nodejs
1282
1299
  ```
1283
1300
 
1301
+ In the runtime layout, these build/test commands refresh the projection and
1302
+ prepare the checked-out runtime for tests. For focused unit tests after
1303
+ installing Node dependencies:
1304
+
1284
1305
  ```bash
1285
- cd nodejs
1286
- npm ci
1287
- npm test
1306
+ npm --prefix nodejs run test:unit
1288
1307
  ```
1289
1308
 
1309
+ For native Vitest selectors on E2Es, use the
1310
+ [prepared-runtime instructions](../CONTRIBUTING.md#testing-an-unreleased-runtime-api);
1311
+ the SDK facade does not forward selectors.
1312
+
1290
1313
  ## License
1291
1314
 
1292
1315
  MIT
@@ -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.87-0";
25
+ const COPILOT_CLI_VERSION = "1.0.89-0";
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 = {
@@ -1337,11 +1337,14 @@ class CopilotClient {
1337
1337
  async resumeSession(sessionId, config) {
1338
1338
  return this.resumeSessionInternal(sessionId, config);
1339
1339
  }
1340
- /** @internal */
1341
- async resumeSessionForExtension(sessionId, config, factories, extensionOptions) {
1342
- return this.resumeSessionInternal(sessionId, config, factories, extensionOptions);
1340
+ async resumeSessionForExtension(sessionId, config, contributions = {}, extensionOptions) {
1341
+ return this.resumeSessionInternal(sessionId, config, contributions, extensionOptions);
1343
1342
  }
1344
- async resumeSessionInternal(sessionId, config, factories, extensionOptions) {
1343
+ async resumeSessionInternal(sessionId, config, contributions = {}, extensionOptions) {
1344
+ const { factories, workflows } = Array.isArray(contributions) ? { factories: contributions, workflows: void 0 } : contributions;
1345
+ if (factories !== void 0 && workflows !== void 0) {
1346
+ throw new Error("Session configuration cannot include both factories and workflows");
1347
+ }
1345
1348
  if (config.gitHubToken !== void 0 && config.gitHubTokenProvider !== void 0) {
1346
1349
  throw new Error("gitHubToken and gitHubTokenProvider are mutually exclusive");
1347
1350
  }
@@ -1362,6 +1365,7 @@ class CopilotClient {
1362
1365
  session.registerCanvases(config.canvases);
1363
1366
  session.registerCommands(config.commands);
1364
1367
  session.registerFactories(factories);
1368
+ session.registerWorkflows(workflows);
1365
1369
  const {
1366
1370
  wireProvider: bearerWireProvider,
1367
1371
  wireProviders: bearerWireProviders,
@@ -1443,6 +1447,7 @@ class CopilotClient {
1443
1447
  toolSearch: config.toolSearch,
1444
1448
  canvases: config.canvases?.map((canvas) => canvas.declaration),
1445
1449
  factories: factories?.map((factory) => factory.meta),
1450
+ workflows: workflows?.map((workflow) => workflow.meta),
1446
1451
  requestCanvasRenderer: config.requestCanvasRenderer,
1447
1452
  requestExtensions: config.requestExtensions,
1448
1453
  extensionSdkPath: config.extensionSdkPath,
@@ -21,9 +21,12 @@ __export(extension_exports, {
21
21
  Canvas: () => import_canvas.Canvas,
22
22
  CanvasError: () => import_canvas.CanvasError,
23
23
  FactoryResumeError: () => import_factory.FactoryResumeError,
24
+ WorkflowResumeError: () => import_workflow.WorkflowResumeError,
24
25
  createCanvas: () => import_canvas.createCanvas,
25
26
  defineFactory: () => import_factory.defineFactory,
27
+ defineWorkflow: () => import_workflow.defineWorkflow,
26
28
  isFactoryRunTerminal: () => import_factory.isFactoryRunTerminal,
29
+ isWorkflowRunTerminal: () => import_workflow.isWorkflowRunTerminal,
27
30
  joinSession: () => joinSession
28
31
  });
29
32
  module.exports = __toCommonJS(extension_exports);
@@ -31,6 +34,7 @@ var import_client = require("./client.js");
31
34
  var import_types = require("./types.js");
32
35
  var import_canvas = require("./canvas.js");
33
36
  var import_factory = require("./factory.js");
37
+ var import_workflow = require("./workflow.js");
34
38
  async function joinSession(config = {}) {
35
39
  const sessionId = process.env.SESSION_ID;
36
40
  if (!sessionId) {
@@ -42,10 +46,14 @@ async function joinSession(config = {}) {
42
46
  const {
43
47
  extensionSdkPath: _stripped,
44
48
  factories,
49
+ workflows,
45
50
  requestedEnvironmentVariables,
46
51
  ...rest
47
52
  } = config;
48
53
  void _stripped;
54
+ if (factories !== void 0 && workflows !== void 0) {
55
+ throw new Error("joinSession cannot register both factories and workflows");
56
+ }
49
57
  return client.resumeSessionForExtension(
50
58
  sessionId,
51
59
  {
@@ -53,7 +61,7 @@ async function joinSession(config = {}) {
53
61
  onPermissionRequest: config.onPermissionRequest ?? import_types.defaultJoinSessionPermissionHandler,
54
62
  suppressResumeEvent: config.suppressResumeEvent ?? true
55
63
  },
56
- factories,
64
+ { factories, workflows },
57
65
  requestedEnvironmentVariables?.length ? { requestedEnvironmentVariables } : void 0
58
66
  );
59
67
  }
@@ -62,8 +70,11 @@ async function joinSession(config = {}) {
62
70
  Canvas,
63
71
  CanvasError,
64
72
  FactoryResumeError,
73
+ WorkflowResumeError,
65
74
  createCanvas,
66
75
  defineFactory,
76
+ defineWorkflow,
67
77
  isFactoryRunTerminal,
78
+ isWorkflowRunTerminal,
68
79
  joinSession
69
80
  });
@@ -1835,6 +1835,77 @@ function createSessionRpc(connection, sessionId) {
1835
1835
  }
1836
1836
  },
1837
1837
  /** @experimental */
1838
+ connectors: {
1839
+ /**
1840
+ * Returns feature availability and bounded polling limits for the EXPERIMENTAL session connector API. This method never performs a Connector service request.
1841
+ *
1842
+ * @returns Feature detection and hard polling limits for the EXPERIMENTAL session connector API.
1843
+ */
1844
+ getCapabilities: async () => connection.sendRequest("session.connectors.getCapabilities", { sessionId }),
1845
+ /**
1846
+ * Returns authoritative session Connector state from current availability, pinned account selection, cached catalog, and live MCP projection without performing a Connector service request.
1847
+ *
1848
+ * @returns Authoritative session connector state. Account IDs are opaque routing identifiers and credentials are never included.
1849
+ */
1850
+ getStatus: async () => connection.sendRequest("session.connectors.getStatus", { sessionId }),
1851
+ /**
1852
+ * Returns the cached Connector catalog for the pinned opaque account selection, fetching it only when this session has no cached catalog.
1853
+ *
1854
+ * @param params Pins a Connector operation to one host-owned GitHub account through its opaque selection ID. Provider tokens are never accepted.
1855
+ *
1856
+ * @returns Validated Connector catalog snapshot cached by the session.
1857
+ */
1858
+ list: async (params) => connection.sendRequest("session.connectors.list", { sessionId, ...params }),
1859
+ /**
1860
+ * Refreshes and validates the Connector catalog for the pinned opaque account selection.
1861
+ *
1862
+ * @param params Pins a Connector operation to one host-owned GitHub account through its opaque selection ID. Provider tokens are never accepted.
1863
+ *
1864
+ * @returns Validated Connector catalog snapshot cached by the session.
1865
+ */
1866
+ refresh: async (params) => connection.sendRequest("session.connectors.refresh", { sessionId, ...params }),
1867
+ /**
1868
+ * Initiates an idempotent Connector connection request without opening a browser. Returns connected when the service is immediately authoritative, consent_required with a validated URL, or pending with an opaque continuation ID.
1869
+ *
1870
+ * @param params Selects one Connector and the pinned host-owned account used for its service and MCP authorization.
1871
+ *
1872
+ * @returns Typed result of initiating or continuing a Connector connection.
1873
+ */
1874
+ connect: async (params) => connection.sendRequest("session.connectors.connect", { sessionId, ...params }),
1875
+ /**
1876
+ * Re-initiates an idempotent Connector connection request without browser or UI effects, with the same typed outcomes as connect.
1877
+ *
1878
+ * @param params Selects one Connector and the pinned host-owned account used for its service and MCP authorization.
1879
+ *
1880
+ * @returns Typed result of initiating or continuing a Connector connection.
1881
+ */
1882
+ reconnect: async (params) => connection.sendRequest("session.connectors.reconnect", { sessionId, ...params }),
1883
+ /**
1884
+ * Continues a pending Connector connection with caller-supplied attempt, interval, and deadline bounds. The runtime never opens the returned consent URL.
1885
+ *
1886
+ * @param params Explicitly bounded continuation of a pending Connector connection.
1887
+ *
1888
+ * @returns Typed result of initiating or continuing a Connector connection.
1889
+ */
1890
+ continueConnection: async (params) => connection.sendRequest("session.connectors.continueConnection", { sessionId, ...params }),
1891
+ /**
1892
+ * Disconnects one Connector for the pinned opaque account selection, refreshes the authoritative catalog, and removes its session-owned MCP projection.
1893
+ *
1894
+ * @param params Selects one Connector and the pinned host-owned account used for its service and MCP authorization.
1895
+ *
1896
+ * @returns Authoritative result after disconnect and MCP reconciliation.
1897
+ */
1898
+ disconnect: async (params) => connection.sendRequest("session.connectors.disconnect", { sessionId, ...params }),
1899
+ /**
1900
+ * Reconciles the authoritative cached or freshly requested Connector catalog into the session Connector MCP projection and returns live status.
1901
+ *
1902
+ * @param params Requests authoritative Connector-to-MCP reconciliation for the pinned account.
1903
+ *
1904
+ * @returns Authoritative session connector state. Account IDs are opaque routing identifiers and credentials are never included.
1905
+ */
1906
+ reconcile: async (params) => connection.sendRequest("session.connectors.reconcile", { sessionId, ...params })
1907
+ },
1908
+ /** @experimental */
1838
1909
  managedSettings: {
1839
1910
  /**
1840
1911
  * Waits for the live session's in-flight managed-settings application, then returns the retained effective snapshot used by runtime enforcement and by `session.managed_settings_resolved`. It does not perform another account, device, or server resolution, and rejects when resolution has not produced a snapshot.
@@ -1950,7 +2021,15 @@ function createSessionRpc(connection, sessionId) {
1950
2021
  *
1951
2022
  * @returns The selectable model entries synthesized for the models added by this call.
1952
2023
  */
1953
- add: async (params) => connection.sendRequest("session.provider.add", { sessionId, ...params })
2024
+ add: async (params) => connection.sendRequest("session.provider.add", { sessionId, ...params }),
2025
+ /**
2026
+ * Atomically updates the session's BYOK provider and model registry by applying the supplied snapshot, replacing existing entries, updating models, or removing entries absent from the snapshot.
2027
+ *
2028
+ * @param params Authoritative BYOK provider and model registry snapshot to apply atomically to the session.
2029
+ *
2030
+ * @returns The selectable model entries and selection ids synthesized for the synchronized BYOK models.
2031
+ */
2032
+ sync: async (params) => connection.sendRequest("session.provider.sync", { sessionId, ...params })
1954
2033
  },
1955
2034
  /** @experimental */
1956
2035
  options: {
@@ -2276,9 +2355,9 @@ function createSessionRpc(connection, sessionId) {
2276
2355
  */
2277
2356
  setRequired: async (params) => connection.sendRequest("session.permissions.setRequired", { sessionId, ...params }),
2278
2357
  /**
2279
- * Clears session-scoped tool permission approvals.
2358
+ * Clears session-scoped tool approvals and, for full resets, exact session-approved paths.
2280
2359
  *
2281
- * @param params Clears session-scoped tool permission approvals, and optionally the location-scoped ones.
2360
+ * @param params Clears session-scoped tool approvals and optionally clears location-scoped approvals and exact session-approved paths.
2282
2361
  *
2283
2362
  * @returns Indicates whether the operation succeeded.
2284
2363
  */
@@ -2294,9 +2373,9 @@ function createSessionRpc(connection, sessionId) {
2294
2373
  /** @experimental */
2295
2374
  paths: {
2296
2375
  /**
2297
- * Returns the session's allowed directories and primary working directory.
2376
+ * Returns the session's recursive directory grants, exact session-approved paths, and primary working directory.
2298
2377
  *
2299
- * @returns Snapshot of the session's allow-listed directories and primary working directory.
2378
+ * @returns Snapshot of the session's recursive directory grants, exact session-approved paths, and primary working directory.
2300
2379
  */
2301
2380
  list: async () => connection.sendRequest("session.permissions.paths.list", { sessionId }),
2302
2381
  /**
@@ -2971,6 +3050,23 @@ function createInternalSessionRpc(connection, sessionId) {
2971
3050
  unregisterExternalClient: async (params) => connection.sendRequest("session.mcp.unregisterExternalClient", { sessionId, ...params })
2972
3051
  },
2973
3052
  /** @experimental */
3053
+ connectors: {
3054
+ /**
3055
+ * Reconciles the authoritative Connector catalog into the session MCP projection during startup with a bounded deadline and fail-closed cleanup.
3056
+ *
3057
+ * @param params Pins a Connector operation to one host-owned GitHub account through its opaque selection ID. Provider tokens are never accepted.
3058
+ *
3059
+ * @returns Authoritative session connector state. Account IDs are opaque routing identifiers and credentials are never included.
3060
+ */
3061
+ reconcileForStartup: async (params) => connection.sendRequest("session.connectors.reconcileForStartup", { sessionId, ...params }),
3062
+ /**
3063
+ * Removes the runtime-owned Connector MCP projection without changing service-side connections.
3064
+ *
3065
+ * @returns Authoritative session connector state. Account IDs are opaque routing identifiers and credentials are never included.
3066
+ */
3067
+ withdrawProjection: async () => connection.sendRequest("session.connectors.withdrawProjection", { sessionId })
3068
+ },
3069
+ /** @experimental */
2974
3070
  commands: {
2975
3071
  /**
2976
3072
  * Finalizes persistence associated with a client-applied slash-command effect.
package/dist/cjs/index.js CHANGED
@@ -33,6 +33,7 @@ __export(index_exports, {
33
33
  SYSTEM_MESSAGE_SECTIONS: () => import_types2.SYSTEM_MESSAGE_SECTIONS,
34
34
  SessionFsSqliteTransactionFailure: () => import_types2.SessionFsSqliteTransactionFailure,
35
35
  ToolSet: () => import_toolSet.ToolSet,
36
+ WorkflowResumeError: () => import_workflow.WorkflowResumeError,
36
37
  approveAll: () => import_types2.approveAll,
37
38
  convertMcpCallToolResult: () => import_types2.convertMcpCallToolResult,
38
39
  createAttributedPermissionResult: () => import_types2.createAttributedPermissionResult,
@@ -40,7 +41,9 @@ __export(index_exports, {
40
41
  createSessionFsAdapter: () => import_types2.createSessionFsAdapter,
41
42
  defineFactory: () => import_factory.defineFactory,
42
43
  defineTool: () => import_types2.defineTool,
43
- isFactoryRunTerminal: () => import_factory.isFactoryRunTerminal
44
+ defineWorkflow: () => import_workflow.defineWorkflow,
45
+ isFactoryRunTerminal: () => import_factory.isFactoryRunTerminal,
46
+ isWorkflowRunTerminal: () => import_workflow.isWorkflowRunTerminal
44
47
  });
45
48
  module.exports = __toCommonJS(index_exports);
46
49
  var import_client = require("./client.js");
@@ -48,6 +51,7 @@ var import_types = require("./types.js");
48
51
  var import_toolSet = require("./toolSet.js");
49
52
  var import_session = require("./session.js");
50
53
  var import_factory = require("./factory.js");
54
+ var import_workflow = require("./workflow.js");
51
55
  var import_canvas = require("./canvas.js");
52
56
  var import_types2 = require("./types.js");
53
57
  // Annotate the CommonJS export names for ESM import in node:
@@ -67,6 +71,7 @@ var import_types2 = require("./types.js");
67
71
  SYSTEM_MESSAGE_SECTIONS,
68
72
  SessionFsSqliteTransactionFailure,
69
73
  ToolSet,
74
+ WorkflowResumeError,
70
75
  approveAll,
71
76
  convertMcpCallToolResult,
72
77
  createAttributedPermissionResult,
@@ -74,5 +79,7 @@ var import_types2 = require("./types.js");
74
79
  createSessionFsAdapter,
75
80
  defineFactory,
76
81
  defineTool,
77
- isFactoryRunTerminal
82
+ defineWorkflow,
83
+ isFactoryRunTerminal,
84
+ isWorkflowRunTerminal
78
85
  });