@github/copilot-sdk 1.0.15-unstable.35663726336.gcb2a8cc → 1.0.15

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.
@@ -16,26 +16,26 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var factory_exports = {};
20
- __export(factory_exports, {
21
- FACTORY_AGENT_OPTION_KEYS: () => FACTORY_AGENT_OPTION_KEYS,
22
- FactoryResumeError: () => FactoryResumeError,
23
- defineFactory: () => defineFactory,
24
- getFactoryDefinition: () => getFactoryDefinition,
25
- isFactoryRunTerminal: () => isFactoryRunTerminal
19
+ var workflow_exports = {};
20
+ __export(workflow_exports, {
21
+ WORKFLOW_AGENT_OPTION_KEYS: () => WORKFLOW_AGENT_OPTION_KEYS,
22
+ WorkflowResumeError: () => WorkflowResumeError,
23
+ defineWorkflow: () => defineWorkflow,
24
+ getWorkflowDefinition: () => getWorkflowDefinition,
25
+ isWorkflowRunTerminal: () => isWorkflowRunTerminal
26
26
  });
27
- module.exports = __toCommonJS(factory_exports);
28
- const FACTORY_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
27
+ module.exports = __toCommonJS(workflow_exports);
28
+ const WORKFLOW_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
29
29
  "completed",
30
30
  "halted",
31
31
  "paused",
32
32
  "cancelled",
33
33
  "error"
34
34
  ]);
35
- function isFactoryRunTerminal(status) {
36
- return FACTORY_TERMINAL_STATUSES.has(status);
35
+ function isWorkflowRunTerminal(status) {
36
+ return WORKFLOW_TERMINAL_STATUSES.has(status);
37
37
  }
38
- const FACTORY_AGENT_OPTION_KEYS = [
38
+ const WORKFLOW_AGENT_OPTION_KEYS = [
39
39
  "label",
40
40
  "schema",
41
41
  "model",
@@ -43,16 +43,16 @@ const FACTORY_AGENT_OPTION_KEYS = [
43
43
  "contextTier",
44
44
  "agent"
45
45
  ];
46
- class FactoryResumeError extends Error {
46
+ class WorkflowResumeError extends Error {
47
47
  constructor(code, message) {
48
48
  super(message);
49
49
  this.code = code;
50
- this.name = "FactoryResumeError";
50
+ this.name = "WorkflowResumeError";
51
51
  }
52
52
  code;
53
53
  }
54
- const factoryHandles = /* @__PURE__ */ new WeakMap();
55
- const MAX_FACTORY_TIMEOUT_SECONDS = 2147483647e-3;
54
+ const workflowHandles = /* @__PURE__ */ new WeakMap();
55
+ const MAX_WORKFLOW_TIMEOUT_SECONDS = 2147483647e-3;
56
56
  const NANO_AIU_PER_AIU = 1e9;
57
57
  function deepFreeze(value) {
58
58
  if (value !== null && typeof value === "object" && !Object.isFrozen(value)) {
@@ -71,24 +71,24 @@ function validateLimits(meta) {
71
71
  for (const field of ["maxConcurrentSubagents", "maxTotalSubagents"]) {
72
72
  const value = limits[field];
73
73
  if (value !== void 0 && (!Number.isInteger(value) || value <= 0)) {
74
- throw new Error(`Factory limit "${field}" must be a positive integer`);
74
+ throw new Error(`Workflow limit "${field}" must be a positive integer`);
75
75
  }
76
76
  }
77
77
  if (limits.timeoutSeconds !== void 0 && (!Number.isFinite(limits.timeoutSeconds) || limits.timeoutSeconds <= 0)) {
78
78
  throw new Error(
79
- 'Factory limit "timeoutSeconds" must be a positive, finite number of seconds'
79
+ 'Workflow limit "timeoutSeconds" must be a positive, finite number of seconds'
80
80
  );
81
81
  }
82
- if (limits.timeoutSeconds !== void 0 && limits.timeoutSeconds > MAX_FACTORY_TIMEOUT_SECONDS) {
82
+ if (limits.timeoutSeconds !== void 0 && limits.timeoutSeconds > MAX_WORKFLOW_TIMEOUT_SECONDS) {
83
83
  throw new Error(
84
- `Factory limit "timeoutSeconds" must not exceed ${MAX_FACTORY_TIMEOUT_SECONDS} seconds`
84
+ `Workflow limit "timeoutSeconds" must not exceed ${MAX_WORKFLOW_TIMEOUT_SECONDS} seconds`
85
85
  );
86
86
  }
87
87
  if (limits.maxAiCredits !== void 0) {
88
88
  const maxNanoAiu = Math.round(limits.maxAiCredits * NANO_AIU_PER_AIU);
89
89
  if (!Number.isFinite(limits.maxAiCredits) || limits.maxAiCredits <= 0 || !Number.isSafeInteger(maxNanoAiu) || maxNanoAiu < 1) {
90
90
  throw new Error(
91
- 'Factory limit "maxAiCredits" must be a positive, finite number that rounds to a safe positive integer nano-AIU ceiling'
91
+ 'Workflow limit "maxAiCredits" must be a positive, finite number that rounds to a safe positive integer nano-AIU ceiling'
92
92
  );
93
93
  }
94
94
  }
@@ -97,15 +97,15 @@ function validatePhases(meta) {
97
97
  const titles = /* @__PURE__ */ new Set();
98
98
  for (const phase of meta.phases) {
99
99
  if (phase.title.trim().length === 0) {
100
- throw new Error("Factory phase titles must not be empty");
100
+ throw new Error("Workflow phase titles must not be empty");
101
101
  }
102
102
  if (titles.has(phase.title)) {
103
- throw new Error(`Factory phase title "${phase.title}" is declared more than once`);
103
+ throw new Error(`Workflow phase title "${phase.title}" is declared more than once`);
104
104
  }
105
105
  titles.add(phase.title);
106
106
  }
107
107
  }
108
- function defineFactory(definition) {
108
+ function defineWorkflow(definition) {
109
109
  const meta = deepFreeze(structuredClone(definition.meta));
110
110
  validateLimits(meta);
111
111
  validatePhases(meta);
@@ -114,21 +114,21 @@ function defineFactory(definition) {
114
114
  run: definition.run
115
115
  };
116
116
  const handle = Object.freeze({ meta });
117
- factoryHandles.set(handle, stored);
117
+ workflowHandles.set(handle, stored);
118
118
  return handle;
119
119
  }
120
- function getFactoryDefinition(handle) {
121
- const definition = factoryHandles.get(handle);
120
+ function getWorkflowDefinition(handle) {
121
+ const definition = workflowHandles.get(handle);
122
122
  if (!definition) {
123
- throw new Error("Invalid factory handle");
123
+ throw new Error("Invalid workflow handle");
124
124
  }
125
125
  return definition;
126
126
  }
127
127
  // Annotate the CommonJS export names for ESM import in node:
128
128
  0 && (module.exports = {
129
- FACTORY_AGENT_OPTION_KEYS,
130
- FactoryResumeError,
131
- defineFactory,
132
- getFactoryDefinition,
133
- isFactoryRunTerminal
129
+ WORKFLOW_AGENT_OPTION_KEYS,
130
+ WorkflowResumeError,
131
+ defineWorkflow,
132
+ getWorkflowDefinition,
133
+ isWorkflowRunTerminal
134
134
  });
@@ -1,2 +1,2 @@
1
- export declare const COPILOT_CLI_VERSION = "1.0.87-unstable.r35651157977.g1aacd25";
1
+ export declare const COPILOT_CLI_VERSION = "1.0.89";
2
2
  export declare const COPILOT_CLI_USE_NPM_PACKAGE = false;
@@ -1,4 +1,4 @@
1
- const COPILOT_CLI_VERSION = "1.0.87-unstable.r35651157977.g1aacd25";
1
+ const COPILOT_CLI_VERSION = "1.0.89";
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
@@ -43,6 +43,7 @@ export declare class CopilotClient {
43
43
  private sessionFsConfig;
44
44
  private requestHandler;
45
45
  private extensionLaunchProvider?;
46
+ private installationConfirmationHandler?;
46
47
  private builtinPluginDirectories;
47
48
  private onGitHubTelemetry?;
48
49
  private clientGlobalHandlers;
package/dist/client.js CHANGED
@@ -22,6 +22,9 @@ import { ensureRuntimeBundle } from "./runtimeArtifacts.js";
22
22
  import { COPILOT_CLI_VERSION } from "./cliVersion.js";
23
23
  import { createSessionFsAdapter } from "./sessionFsProvider.js";
24
24
  import { createCopilotRequestAdapter } from "./copilotRequestHandler.js";
25
+ import {
26
+ createInstallationConfirmationAdapter
27
+ } from "./installationConfirmation.js";
25
28
  import { getTraceContext } from "./telemetry.js";
26
29
  import { toJsonSchema } from "./schema.js";
27
30
  import { ToolSet } from "./toolSet.js";
@@ -243,6 +246,7 @@ class CopilotClient {
243
246
  sessionFsConfig = null;
244
247
  requestHandler = null;
245
248
  extensionLaunchProvider;
249
+ installationConfirmationHandler;
246
250
  builtinPluginDirectories = [];
247
251
  onGitHubTelemetry;
248
252
  clientGlobalHandlers = {};
@@ -401,6 +405,7 @@ class CopilotClient {
401
405
  this.sessionFsConfig = options.sessionFs ?? null;
402
406
  this.requestHandler = options.requestHandler ?? null;
403
407
  this.extensionLaunchProvider = options.extensionLaunchProvider;
408
+ this.installationConfirmationHandler = options.installationConfirmationHandler;
404
409
  this.onGitHubTelemetry = options.onGitHubTelemetry;
405
410
  this.setupClientGlobalHandlers();
406
411
  const connEnv = conn.kind === "stdio" || conn.kind === "tcp" ? conn.env : void 0;
@@ -1215,6 +1220,7 @@ class CopilotClient {
1215
1220
  includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
1216
1221
  ...this.onGitHubTelemetry != null ? { enableGitHubTelemetryForwarding: true } : {},
1217
1222
  mcpServers: toWireMcpServers(config.mcpServers),
1223
+ ...config.diagnostics !== void 0 ? { diagnostics: config.diagnostics } : {},
1218
1224
  mcpOAuthTokenStorage: config.mcpOAuthTokenStorage,
1219
1225
  authClientIdMetadataUrl: config.authClientIdMetadataUrl,
1220
1226
  envValueMode: "direct",
@@ -1224,6 +1230,7 @@ class CopilotClient {
1224
1230
  agent: config.agent,
1225
1231
  configDir: config.configDirectory,
1226
1232
  enableConfigDiscovery: config.enableConfigDiscovery,
1233
+ refreshCustomInstructions: config.refreshCustomInstructions,
1227
1234
  skipEmbeddingRetrieval: config.skipEmbeddingRetrieval,
1228
1235
  embeddingCacheStorage: config.embeddingCacheStorage,
1229
1236
  organizationCustomInstructions: config.organizationCustomInstructions,
@@ -1316,10 +1323,11 @@ class CopilotClient {
1316
1323
  return this.resumeSessionInternal(sessionId, config);
1317
1324
  }
1318
1325
  /** @internal */
1319
- async resumeSessionForExtension(sessionId, config, factories, extensionOptions) {
1320
- return this.resumeSessionInternal(sessionId, config, factories, extensionOptions);
1326
+ async resumeSessionForExtension(sessionId, config, contributions = {}, extensionOptions) {
1327
+ return this.resumeSessionInternal(sessionId, config, contributions, extensionOptions);
1321
1328
  }
1322
- async resumeSessionInternal(sessionId, config, factories, extensionOptions) {
1329
+ async resumeSessionInternal(sessionId, config, contributions = {}, extensionOptions) {
1330
+ const { workflows } = contributions;
1323
1331
  if (config.gitHubToken !== void 0 && config.gitHubTokenProvider !== void 0) {
1324
1332
  throw new Error("gitHubToken and gitHubTokenProvider are mutually exclusive");
1325
1333
  }
@@ -1339,7 +1347,7 @@ class CopilotClient {
1339
1347
  session.registerTools(config.tools);
1340
1348
  session.registerCanvases(config.canvases);
1341
1349
  session.registerCommands(config.commands);
1342
- session.registerFactories(factories);
1350
+ session.registerWorkflows(workflows);
1343
1351
  const {
1344
1352
  wireProvider: bearerWireProvider,
1345
1353
  wireProviders: bearerWireProviders,
@@ -1420,7 +1428,7 @@ class CopilotClient {
1420
1428
  })),
1421
1429
  toolSearch: config.toolSearch,
1422
1430
  canvases: config.canvases?.map((canvas) => canvas.declaration),
1423
- factories: factories?.map((factory) => factory.meta),
1431
+ workflows: workflows?.map((workflow) => workflow.meta),
1424
1432
  requestCanvasRenderer: config.requestCanvasRenderer,
1425
1433
  requestExtensions: config.requestExtensions,
1426
1434
  extensionSdkPath: config.extensionSdkPath,
@@ -1461,6 +1469,7 @@ class CopilotClient {
1461
1469
  includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
1462
1470
  ...this.onGitHubTelemetry != null ? { enableGitHubTelemetryForwarding: true } : {},
1463
1471
  mcpServers: toWireMcpServers(config.mcpServers),
1472
+ ...config.diagnostics !== void 0 ? { diagnostics: config.diagnostics } : {},
1464
1473
  mcpOAuthTokenStorage: config.mcpOAuthTokenStorage,
1465
1474
  authClientIdMetadataUrl: config.authClientIdMetadataUrl,
1466
1475
  envValueMode: "direct",
@@ -1881,6 +1890,9 @@ class CopilotClient {
1881
1890
  if (this.options.mode === "empty") {
1882
1891
  env.COPILOT_DISABLE_KEYTAR = "1";
1883
1892
  }
1893
+ if (this.options.mode !== "empty") {
1894
+ env.COPILOT_RUNTIME_PROCESS_FILE_LOGGING = "1";
1895
+ }
1884
1896
  if (this.options.telemetry) {
1885
1897
  const t = this.options.telemetry;
1886
1898
  env.COPILOT_OTEL_ENABLED = "true";
@@ -2255,6 +2267,16 @@ stderr: ${stderrOutput}` : ""}`
2255
2267
  return session.clientSessionApis;
2256
2268
  });
2257
2269
  registerClientGlobalApiHandlers(this.connection, this.clientGlobalHandlers);
2270
+ if (this.installationConfirmationHandler) {
2271
+ const confirmation = createInstallationConfirmationAdapter(
2272
+ this.connection,
2273
+ this.installationConfirmationHandler
2274
+ );
2275
+ this.connection.onRequest(
2276
+ "installations.confirm",
2277
+ (params, token) => confirmation.confirm(params, token)
2278
+ );
2279
+ }
2258
2280
  this.connection.onRequest(
2259
2281
  "hooks.invoke",
2260
2282
  async (params) => {
@@ -1,6 +1,6 @@
1
1
  import type { CopilotSession } from "./session.js";
2
2
  import { type PermissionHandler, type ResumeSessionConfig } from "./types.js";
3
- import type { FactoryHandle } from "./factory.js";
3
+ import type { WorkflowHandle } from "./workflow.js";
4
4
  export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js";
5
5
  export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest" | "extensionSdkPath"> & {
6
6
  onPermissionRequest?: PermissionHandler;
@@ -34,15 +34,15 @@ export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest"
34
34
  */
35
35
  requestedEnvironmentVariables?: string[];
36
36
  /**
37
- * Factory handles to register when the extension joins the session.
37
+ * Workflow handles to register when the extension joins the session.
38
38
  *
39
- * @experimental Part of the experimental Agent Factories surface and may
39
+ * @experimental Part of the experimental Dynamic Workflows surface and may
40
40
  * change or be removed in future SDK or CLI releases.
41
41
  */
42
- factories?: FactoryHandle[];
42
+ workflows?: WorkflowHandle[];
43
43
  };
44
- export type { ExtensionInfo, FactoryLimits, FactoryMeta } from "./types.js";
45
- export { defineFactory, FactoryResumeError, isFactoryRunTerminal, type RunOptions, type ResumeOptions, type FactoryResumeErrorCode, type SessionFactoryApi, type FactoryAgentOptions, type FactoryContext, type FactoryDefinition, type FactoryHandle, type FactoryJsonSchema, type JsonValue, type FactoryPipelineStage, type FactoryStepOptions, type FactoryRunResult, type FactoryRunStatus, type FactoryRunSummary, type FactoryListRunsOptions, type FactoryRunsPage, type FactoryRunDetail, type FactoryProgressPage, type FactoryProgressLine, type FactoryPhaseObservation, type FactoryPhaseStatus, type FactoryAgentSummary, } from "./factory.js";
44
+ export type { ExtensionInfo } from "./types.js";
45
+ export { defineWorkflow, WorkflowResumeError, isWorkflowRunTerminal, type WorkflowRunOptions, type WorkflowResumeOptions, type WorkflowLimitOverrides, type WorkflowResumeErrorCode, type SessionWorkflowApi, type WorkflowAgentOptions, type WorkflowContext, type WorkflowDefinition, type WorkflowHandle, type JsonValue, type WorkflowJsonSchema, type WorkflowLimits, type WorkflowMeta, type WorkflowPipelineStage, type WorkflowStepOptions, type WorkflowRunResult, type WorkflowRunStatus, type WorkflowRunSummary, type WorkflowListRunsOptions, type WorkflowRunsPage, type WorkflowRunDetail, type WorkflowProgressPage, type WorkflowProgressLine, type WorkflowPhaseObservation, type WorkflowPhaseStatus, type WorkflowAgentSummary, } from "./workflow.js";
46
46
  /**
47
47
  * Joins the current foreground session.
48
48
  *
package/dist/extension.js CHANGED
@@ -8,10 +8,10 @@ import {
8
8
  createCanvas
9
9
  } from "./canvas.js";
10
10
  import {
11
- defineFactory,
12
- FactoryResumeError,
13
- isFactoryRunTerminal
14
- } from "./factory.js";
11
+ defineWorkflow,
12
+ WorkflowResumeError,
13
+ isWorkflowRunTerminal
14
+ } from "./workflow.js";
15
15
  async function joinSession(config = {}) {
16
16
  const sessionId = process.env.SESSION_ID;
17
17
  if (!sessionId) {
@@ -22,7 +22,7 @@ async function joinSession(config = {}) {
22
22
  const client = new CopilotClient({ _internalConnection: { kind: "parent-process" } });
23
23
  const {
24
24
  extensionSdkPath: _stripped,
25
- factories,
25
+ workflows,
26
26
  requestedEnvironmentVariables,
27
27
  ...rest
28
28
  } = config;
@@ -34,16 +34,16 @@ async function joinSession(config = {}) {
34
34
  onPermissionRequest: config.onPermissionRequest ?? defaultJoinSessionPermissionHandler,
35
35
  suppressResumeEvent: config.suppressResumeEvent ?? true
36
36
  },
37
- factories,
37
+ { workflows },
38
38
  requestedEnvironmentVariables?.length ? { requestedEnvironmentVariables } : void 0
39
39
  );
40
40
  }
41
41
  export {
42
42
  Canvas,
43
43
  CanvasError,
44
- FactoryResumeError,
44
+ WorkflowResumeError,
45
45
  createCanvas,
46
- defineFactory,
47
- isFactoryRunTerminal,
46
+ defineWorkflow,
47
+ isWorkflowRunTerminal,
48
48
  joinSession
49
49
  };