@github/copilot-sdk 1.0.15-preview.3 → 1.0.15-preview.4

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.
@@ -28,17 +28,7 @@ var import_canvas = require("./canvas.js");
28
28
  var import_telemetry = require("./telemetry.js");
29
29
  var import_schema = require("./schema.js");
30
30
  var import_types = require("./types.js");
31
- var import_factory = require("./factory.js");
32
31
  var import_workflow = require("./workflow.js");
33
- function isFactoryResumeErrorCode(value) {
34
- return value === "not_found" || value === "non_resumable" || value === "already_active" || value === "factory_already_running" || value === "factory_limits_invalid" || value === "factory_session_disposed" || value === "factory_storage_unavailable" || value === "factory_storage_corrupt";
35
- }
36
- function copyDefinedFactoryAgentOption(source, target, key) {
37
- const value = source[key];
38
- if (value !== void 0) {
39
- target[key] = value;
40
- }
41
- }
42
32
  function isWorkflowResumeErrorCode(value) {
43
33
  return value === "not_found" || value === "non_resumable" || value === "workflow_run_not_resumable" || value === "already_active" || value === "workflow_already_running" || value === "workflow_limits_invalid" || value === "workflow_session_disposed" || value === "workflow_storage_unavailable" || value === "workflow_storage_corrupt";
44
34
  }
@@ -48,14 +38,6 @@ function copyDefinedWorkflowAgentOption(source, target, key) {
48
38
  target[key] = value;
49
39
  }
50
40
  }
51
- const factoryExecutionStore = new import_node_async_hooks.AsyncLocalStorage();
52
- function throwIfFactoryExecutionIsActive() {
53
- if (factoryExecutionStore.getStore()?.active) {
54
- throw new Error(
55
- "factory.run, factory.resume, and factory.pause are not allowed while a factory body is running on this call path."
56
- );
57
- }
58
- }
59
41
  const workflowExecutionStore = new import_node_async_hooks.AsyncLocalStorage();
60
42
  function throwIfWorkflowExecutionIsActive() {
61
43
  if (workflowExecutionStore.getStore()?.active) {
@@ -68,10 +50,6 @@ function runInWorkflowHelperScope(helperScope, callback) {
68
50
  const current = workflowExecutionStore.getStore();
69
51
  return workflowExecutionStore.run({ active: current?.active ?? false, helperScope }, callback);
70
52
  }
71
- function runInFactoryHelperScope(helperScope, callback) {
72
- const current = factoryExecutionStore.getStore();
73
- return factoryExecutionStore.run({ active: current?.active ?? false, helperScope }, callback);
74
- }
75
53
  function deserializeHookInput(raw) {
76
54
  if (!raw || typeof raw !== "object" || typeof raw.timestamp !== "number") {
77
55
  return raw;
@@ -94,68 +72,20 @@ function isOpenCanvasInstance(value) {
94
72
  }
95
73
  const FACTORY_LOG_FLUSH_DELAY_MS = 10;
96
74
  const MAX_FACTORY_FANOUT_ITEMS = 4096;
97
- function assertFactoryFanoutSize(kind, size) {
75
+ function assertWorkflowFanoutSize(kind, size) {
98
76
  if (size > MAX_FACTORY_FANOUT_ITEMS) {
99
77
  throw new Error(
100
78
  `${kind}() accepts at most ${MAX_FACTORY_FANOUT_ITEMS} items; got ${size}.`
101
79
  );
102
80
  }
103
81
  }
104
- async function runFactoryParallel(thunks) {
105
- if (!Array.isArray(thunks)) {
106
- throw new Error(
107
- "parallel() expects an array of functions, not promises. Wrap each call: () => agent(...)"
108
- );
109
- }
110
- assertFactoryFanoutSize("parallel", thunks.length);
111
- if (thunks.some((thunk) => typeof thunk !== "function")) {
112
- throw new Error(
113
- "parallel() expects an array of functions, not promises. Wrap each call: () => agent(...)"
114
- );
115
- }
116
- return Promise.all(
117
- thunks.map(
118
- (thunk) => Promise.resolve().then(() => runInFactoryHelperScope("parallel", thunk)).catch((error) => {
119
- if (isFactoryFatalError(error)) {
120
- throw error;
121
- }
122
- return null;
123
- })
124
- )
125
- );
126
- }
127
- async function runFactoryPipeline(items, ...stages) {
128
- if (!Array.isArray(items)) {
129
- throw new Error("pipeline(items, ...stages): items must be an array");
130
- }
131
- assertFactoryFanoutSize("pipeline", items.length);
132
- return Promise.all(
133
- items.map(async (item, index) => {
134
- let previous = item;
135
- for (const stage of stages) {
136
- try {
137
- previous = await runInFactoryHelperScope(
138
- "pipeline",
139
- () => stage(previous, item, index)
140
- );
141
- } catch (error) {
142
- if (isFactoryFatalError(error)) {
143
- throw error;
144
- }
145
- return null;
146
- }
147
- }
148
- return previous;
149
- })
150
- );
151
- }
152
82
  async function runWorkflowParallel(thunks) {
153
83
  if (!Array.isArray(thunks)) {
154
84
  throw new Error(
155
85
  "parallel() expects an array of functions, not promises. Wrap each call: () => agent(...)"
156
86
  );
157
87
  }
158
- assertFactoryFanoutSize("parallel", thunks.length);
88
+ assertWorkflowFanoutSize("parallel", thunks.length);
159
89
  if (thunks.some((thunk) => typeof thunk !== "function")) {
160
90
  throw new Error(
161
91
  "parallel() expects an array of functions, not promises. Wrap each call: () => agent(...)"
@@ -164,7 +94,7 @@ async function runWorkflowParallel(thunks) {
164
94
  return Promise.all(
165
95
  thunks.map(
166
96
  (thunk) => Promise.resolve().then(() => runInWorkflowHelperScope("parallel", thunk)).catch((error) => {
167
- if (isFactoryFatalError(error)) {
97
+ if (isWorkflowFatalError(error)) {
168
98
  throw error;
169
99
  }
170
100
  return null;
@@ -176,7 +106,7 @@ async function runWorkflowPipeline(items, ...stages) {
176
106
  if (!Array.isArray(items)) {
177
107
  throw new Error("pipeline(items, ...stages): items must be an array");
178
108
  }
179
- assertFactoryFanoutSize("pipeline", items.length);
109
+ assertWorkflowFanoutSize("pipeline", items.length);
180
110
  return Promise.all(
181
111
  items.map(async (item, index) => {
182
112
  let previous = item;
@@ -187,7 +117,7 @@ async function runWorkflowPipeline(items, ...stages) {
187
117
  () => stage(previous, item, index)
188
118
  );
189
119
  } catch (error) {
190
- if (isFactoryFatalError(error)) {
120
+ if (isWorkflowFatalError(error)) {
191
121
  throw error;
192
122
  }
193
123
  return null;
@@ -197,85 +127,6 @@ async function runWorkflowPipeline(items, ...stages) {
197
127
  })
198
128
  );
199
129
  }
200
- class FactoryProgressBuffer {
201
- constructor(send) {
202
- this.send = send;
203
- }
204
- send;
205
- nextSeq = 0;
206
- pending = [];
207
- flushTimer;
208
- flushTail = Promise.resolve();
209
- flushError;
210
- flushFailed = false;
211
- closed = false;
212
- enqueue(kind, text) {
213
- if (this.closed) {
214
- throw new Error("Cannot log after the factory run has settled");
215
- }
216
- this.pending.push({ seq: this.nextSeq++, kind, text });
217
- this.scheduleFlush();
218
- }
219
- async flush() {
220
- this.clearFlushTimer();
221
- const lines = this.pending.splice(0);
222
- if (lines.length > 0) {
223
- this.flushTail = this.flushTail.then(async () => {
224
- try {
225
- await this.send(lines);
226
- } catch (error) {
227
- if (!this.flushFailed) {
228
- this.flushFailed = true;
229
- this.flushError = error;
230
- }
231
- }
232
- });
233
- }
234
- await this.flushTail;
235
- if (this.flushFailed) {
236
- throw this.flushError;
237
- }
238
- }
239
- async close() {
240
- this.closed = true;
241
- this.clearFlushTimer();
242
- const lines = this.pending.splice(0);
243
- await this.flushTail;
244
- if (this.flushFailed) {
245
- console.warn(
246
- "Ignoring a background factory progress flush failure after the factory body settled",
247
- this.flushError
248
- );
249
- }
250
- if (lines.length > 0) {
251
- try {
252
- await this.send(lines);
253
- } catch (error) {
254
- console.warn(
255
- "Failed to flush final factory progress after the factory body settled",
256
- error
257
- );
258
- }
259
- }
260
- }
261
- scheduleFlush() {
262
- if (this.flushTimer !== void 0) {
263
- return;
264
- }
265
- this.flushTimer = setTimeout(() => {
266
- this.flushTimer = void 0;
267
- void this.flush().catch(() => {
268
- });
269
- }, FACTORY_LOG_FLUSH_DELAY_MS);
270
- this.flushTimer.unref?.();
271
- }
272
- clearFlushTimer() {
273
- if (this.flushTimer !== void 0) {
274
- clearTimeout(this.flushTimer);
275
- this.flushTimer = void 0;
276
- }
277
- }
278
- }
279
130
  class WorkflowProgressBuffer {
280
131
  constructor(send) {
281
132
  this.send = send;
@@ -355,38 +206,30 @@ class WorkflowProgressBuffer {
355
206
  }
356
207
  }
357
208
  }
358
- async function awaitFactoryOperation(operation, signal) {
209
+ async function awaitWorkflowOperation(operation, signal) {
359
210
  let rejectAbort;
360
211
  const abortPromise = new Promise((_resolve, reject) => {
361
212
  rejectAbort = reject;
362
213
  });
363
- const onAbort = () => rejectAbort?.(signal.reason ?? new DOMException("Factory run was aborted", "AbortError"));
214
+ const onAbort = () => rejectAbort?.(signal.reason ?? new DOMException("Workflow run was aborted", "AbortError"));
364
215
  signal.addEventListener("abort", onAbort, { once: true });
365
216
  try {
366
- throwIfFactoryAborted(signal);
217
+ throwIfWorkflowAborted(signal);
367
218
  return await Promise.race([operation(), abortPromise]);
368
219
  } finally {
369
220
  signal.removeEventListener("abort", onAbort);
370
221
  }
371
222
  }
372
- async function awaitWorkflowOperation(operation, signal) {
373
- return awaitFactoryOperation(operation, signal);
374
- }
375
- function throwIfFactoryAborted(signal) {
376
- if (signal.aborted) {
377
- throw signal.reason ?? new DOMException("Factory run was aborted", "AbortError");
378
- }
379
- }
380
223
  function throwIfWorkflowAborted(signal) {
381
224
  if (signal.aborted) {
382
225
  throw signal.reason ?? new DOMException("Workflow run was aborted", "AbortError");
383
226
  }
384
227
  }
385
- function isFactoryAbortError(error) {
228
+ function isWorkflowAbortError(error) {
386
229
  return typeof error === "object" && error !== null && "name" in error && error.name === "AbortError";
387
230
  }
388
- function isFactoryFatalError(error) {
389
- return isFactoryAbortError(error) || error instanceof import_node.ResponseError || error instanceof import_node.ConnectionError;
231
+ function isWorkflowFatalError(error) {
232
+ return isWorkflowAbortError(error) || error instanceof import_node.ResponseError || error instanceof import_node.ConnectionError;
390
233
  }
391
234
  const TOOL_SEARCH_TOOL_NAME = "tool_search_tool";
392
235
  class CopilotSession {
@@ -418,8 +261,6 @@ class CopilotSession {
418
261
  canvases = /* @__PURE__ */ new Map();
419
262
  bearerTokenProviders = /* @__PURE__ */ new Map();
420
263
  commandHandlers = /* @__PURE__ */ new Map();
421
- factories = /* @__PURE__ */ new Map();
422
- factoryAbortControllers = /* @__PURE__ */ new Map();
423
264
  workflows = /* @__PURE__ */ new Map();
424
265
  workflowAbortControllers = /* @__PURE__ */ new Map();
425
266
  permissionHandler;
@@ -443,68 +284,11 @@ class CopilotSession {
443
284
  /** @internal Client session API handlers, populated by CopilotClient during create/resume. */
444
285
  clientSessionApis = {};
445
286
  /**
446
- * Friendly factory API for running registered factories by name or handle.
287
+ * Friendly workflow API for running registered workflows by name or handle.
447
288
  *
448
- * @experimental Part of the experimental Agent Factories surface and may
289
+ * @experimental Part of the experimental Dynamic Workflows surface and may
449
290
  * change or be removed in future SDK or CLI releases.
450
291
  */
451
- factory = {
452
- run: (async (nameOrHandle, options) => {
453
- throwIfFactoryExecutionIsActive();
454
- const name = typeof nameOrHandle === "string" ? nameOrHandle : (0, import_factory.getFactoryDefinition)(nameOrHandle).meta.name;
455
- if (options?.resumeFromRunId !== void 0) {
456
- return this.factory.resume(options.resumeFromRunId, {
457
- limits: options.limits,
458
- notifyOnComplete: options.notifyOnComplete,
459
- logPhaseNames: options.logPhaseNames
460
- });
461
- }
462
- const envelope = await this.rpc.factory.run({
463
- name,
464
- args: options?.args === void 0 ? {} : options.args,
465
- options: {
466
- limits: options?.limits,
467
- notifyOnComplete: options?.notifyOnComplete,
468
- logPhaseNames: options?.logPhaseNames
469
- }
470
- });
471
- return this.settleFactoryRun(envelope);
472
- }),
473
- resume: (async (runId, options) => {
474
- throwIfFactoryExecutionIsActive();
475
- let response;
476
- try {
477
- response = await this.rpc.factory.resume({
478
- runId,
479
- limits: options?.limits,
480
- notifyOnComplete: options?.notifyOnComplete,
481
- logPhaseNames: options?.logPhaseNames
482
- });
483
- } catch (error) {
484
- if (error instanceof import_node.ResponseError && typeof error.data === "object" && error.data !== null) {
485
- const code = error.data.code;
486
- if (isFactoryResumeErrorCode(code)) {
487
- throw new import_factory.FactoryResumeError(code, error.message);
488
- }
489
- }
490
- throw error;
491
- }
492
- return this.settleFactoryRun(response.run);
493
- }),
494
- getRun: async (runId) => this.rpc.factory.getRun({ runId }),
495
- waitForRun: (runId, options) => this.waitForFactoryRun(runId, options?.signal),
496
- listRuns: (async (options) => {
497
- const page = await this.rpc.factory.listRuns(options ?? {});
498
- return options === void 0 ? page.runs : page;
499
- }),
500
- getRunDetail: (runId) => this.rpc.factory.getRunDetail({ runId }),
501
- getRunProgress: (runId, options = {}) => this.rpc.factory.getRunProgress({ runId, ...options }),
502
- pause: async (runId) => {
503
- throwIfFactoryExecutionIsActive();
504
- return this.rpc.factory.pause({ runId });
505
- },
506
- cancel: async (runId) => this.rpc.factory.cancel({ runId })
507
- };
508
292
  workflow = {
509
293
  run: (async (nameOrHandle, options) => {
510
294
  throwIfWorkflowExecutionIsActive();
@@ -555,93 +339,6 @@ class CopilotSession {
555
339
  },
556
340
  cancel: async (runId) => this.rpc.workflow.cancel({ runId })
557
341
  };
558
- /**
559
- * Resolve a start/resume envelope into the terminal envelope callers expect.
560
- *
561
- * The CLI may answer `session.factory.run` and `session.factory.resume`
562
- * before the run settles, so a non-terminal envelope is followed by a wait
563
- * on the run's terminal state.
564
- */
565
- settleFactoryRun(envelope) {
566
- if ((0, import_factory.isFactoryRunTerminal)(envelope.status)) {
567
- return Promise.resolve(envelope);
568
- }
569
- return this.waitForFactoryRun(envelope.runId);
570
- }
571
- /**
572
- * Resolve when a factory run reaches a terminal status.
573
- *
574
- * The subscription is installed *before* the first read so a transition
575
- * landing between the two cannot be missed, and re-reads are serialized so
576
- * overlapping invalidation events cannot interleave — the run's revision
577
- * advances once per operation, so a burst of events is common and must
578
- * collapse into a single in-flight read. A bounded periodic re-read keeps a
579
- * dropped invalidation from leaving the wait pending forever.
580
- */
581
- waitForFactoryRun(runId, signal) {
582
- const abortError = () => signal?.reason ?? new DOMException("Factory run wait was aborted", "AbortError");
583
- if (signal?.aborted === true) {
584
- return Promise.reject(abortError());
585
- }
586
- return new Promise((resolve, reject) => {
587
- let settled = false;
588
- let reading = false;
589
- let rereadRequested = false;
590
- let pollHandle;
591
- let unsubscribe;
592
- let onAbort;
593
- const finish = (complete) => {
594
- if (settled) {
595
- return;
596
- }
597
- settled = true;
598
- if (pollHandle !== void 0) {
599
- clearInterval(pollHandle);
600
- }
601
- unsubscribe?.();
602
- if (onAbort !== void 0) {
603
- signal?.removeEventListener("abort", onAbort);
604
- }
605
- complete();
606
- };
607
- const read = async () => {
608
- if (settled) {
609
- return;
610
- }
611
- if (reading) {
612
- rereadRequested = true;
613
- return;
614
- }
615
- reading = true;
616
- try {
617
- do {
618
- rereadRequested = false;
619
- const envelope = await this.rpc.factory.getRun({ runId });
620
- if ((0, import_factory.isFactoryRunTerminal)(envelope.status)) {
621
- finish(() => resolve(envelope));
622
- return;
623
- }
624
- } while (rereadRequested && !settled);
625
- } catch (error) {
626
- finish(() => reject(error));
627
- } finally {
628
- reading = false;
629
- }
630
- };
631
- if (signal !== void 0) {
632
- onAbort = () => finish(() => reject(abortError()));
633
- signal.addEventListener("abort", onAbort, { once: true });
634
- }
635
- unsubscribe = this.on("factory.run_updated", (event) => {
636
- if (event.data.runId === runId) {
637
- void read();
638
- }
639
- });
640
- pollHandle = setInterval(() => void read(), 5e3);
641
- pollHandle.unref?.();
642
- void read();
643
- });
644
- }
645
342
  settleWorkflowRun(envelope) {
646
343
  if ((0, import_workflow.isWorkflowRunTerminal)(envelope.status)) {
647
344
  return Promise.resolve(envelope);
@@ -712,7 +409,7 @@ class CopilotSession {
712
409
  onAbort = () => finish(() => reject(abortError()));
713
410
  signal.addEventListener("abort", onAbort, { once: true });
714
411
  }
715
- unsubscribe = this.on("factory.run_updated", (event) => {
412
+ unsubscribe = this.on("workflow.run_updated", (event) => {
716
413
  if (event.data.runId === runId) {
717
414
  void read();
718
415
  }
@@ -978,13 +675,6 @@ class CopilotSession {
978
675
  this.autoModeSwitchHandler = void 0;
979
676
  this.commandHandlers.clear();
980
677
  this.canvases.clear();
981
- this.factories.clear();
982
- for (const controllersForRun of this.factoryAbortControllers.values()) {
983
- for (const controller of controllersForRun.values()) {
984
- controller.abort();
985
- }
986
- }
987
- this.factoryAbortControllers.clear();
988
678
  this.workflows.clear();
989
679
  for (const controllersForRun of this.workflowAbortControllers.values()) {
990
680
  for (const controller of controllersForRun.values()) {
@@ -1439,192 +1129,6 @@ class CopilotSession {
1439
1129
  }
1440
1130
  };
1441
1131
  }
1442
- /**
1443
- * Registers factory closures and reverse-RPC handlers for this session.
1444
- *
1445
- * @param factories - Factory handles declared by the joining extension.
1446
- * @internal Called by the SDK when an extension joins a session.
1447
- */
1448
- registerFactories(factories) {
1449
- this.factories.clear();
1450
- if (!factories || factories.length === 0) {
1451
- delete this.clientSessionApis.factory;
1452
- return;
1453
- }
1454
- for (const handle of factories) {
1455
- const definition = (0, import_factory.getFactoryDefinition)(handle);
1456
- if (this.factories.has(definition.meta.name)) {
1457
- throw new Error(
1458
- `Duplicate factory name "${definition.meta.name}". Factory names must be unique within a joinSession call.`
1459
- );
1460
- }
1461
- this.factories.set(definition.meta.name, definition);
1462
- }
1463
- const self = this;
1464
- this.clientSessionApis.factory = {
1465
- async execute(params) {
1466
- const definition = self.factories.get(params.name);
1467
- if (!definition) {
1468
- const message = `No factory registered with name "${params.name}"`;
1469
- throw new import_node.ResponseError(import_node.ErrorCodes.InvalidParams, message, {
1470
- code: "factory_not_found",
1471
- name: params.name
1472
- });
1473
- }
1474
- const controller = new AbortController();
1475
- let controllersForRun = self.factoryAbortControllers.get(params.runId);
1476
- if (controllersForRun === void 0) {
1477
- controllersForRun = /* @__PURE__ */ new Map();
1478
- self.factoryAbortControllers.set(params.runId, controllersForRun);
1479
- }
1480
- controllersForRun.set(params.executionToken, controller);
1481
- const progress = new FactoryProgressBuffer(async (lines) => {
1482
- await self.rpc.factory.log({
1483
- runId: params.runId,
1484
- executionToken: params.executionToken,
1485
- lines
1486
- });
1487
- });
1488
- try {
1489
- const context = {
1490
- runId: params.runId,
1491
- args: params.args,
1492
- session: self,
1493
- signal: controller.signal,
1494
- phase: (title) => {
1495
- throwIfFactoryAborted(controller.signal);
1496
- progress.enqueue("phase", title);
1497
- },
1498
- log: (message) => {
1499
- throwIfFactoryAborted(controller.signal);
1500
- progress.enqueue("log", message);
1501
- },
1502
- agent: async (prompt, options = {}) => {
1503
- await progress.flush();
1504
- const opts = {};
1505
- for (const key of import_factory.FACTORY_AGENT_OPTION_KEYS) {
1506
- copyDefinedFactoryAgentOption(options, opts, key);
1507
- }
1508
- const response = await awaitFactoryOperation(
1509
- () => self.rpc.factory.agent({
1510
- factoryRunId: params.runId,
1511
- executionToken: params.executionToken,
1512
- prompt,
1513
- opts
1514
- }),
1515
- controller.signal
1516
- );
1517
- return response.result ?? null;
1518
- },
1519
- step: async (key, producer, options = {}) => {
1520
- await progress.flush();
1521
- if (options.volatile) {
1522
- throwIfFactoryAborted(controller.signal);
1523
- return producer();
1524
- }
1525
- const cached = await awaitFactoryOperation(
1526
- () => self.rpc.factory.journal.get({
1527
- runId: params.runId,
1528
- executionToken: params.executionToken,
1529
- key
1530
- }),
1531
- controller.signal
1532
- );
1533
- if (cached.hit) {
1534
- if (cached.resultJson === void 0) {
1535
- throw new Error(
1536
- `step("${key}") journal returned a hit without a result`
1537
- );
1538
- }
1539
- assertFactoryStepResult(cached.resultJson, key);
1540
- return cached.resultJson;
1541
- }
1542
- const result2 = await producer();
1543
- assertFactoryStepResult(result2, key);
1544
- await awaitFactoryOperation(
1545
- () => self.rpc.factory.journal.put({
1546
- runId: params.runId,
1547
- executionToken: params.executionToken,
1548
- key,
1549
- resultJson: result2
1550
- }),
1551
- controller.signal
1552
- );
1553
- return result2;
1554
- },
1555
- pause: async (key) => {
1556
- if (typeof key !== "string" || key.length === 0) {
1557
- throw new Error("Factory pause checkpoint key must not be empty");
1558
- }
1559
- const helperScope = factoryExecutionStore.getStore()?.helperScope;
1560
- if (helperScope !== void 0) {
1561
- throw new Error(
1562
- `Factory pause checkpoints are not allowed inside ${helperScope}() branches`
1563
- );
1564
- }
1565
- await progress.flush();
1566
- const response = await awaitFactoryOperation(
1567
- () => self.internalRpc.factory.pauseAtCheckpoint({
1568
- runId: params.runId,
1569
- executionToken: params.executionToken,
1570
- key
1571
- }),
1572
- controller.signal
1573
- );
1574
- switch (response.action) {
1575
- case "continue":
1576
- return;
1577
- case "pause":
1578
- await awaitFactoryOperation(
1579
- () => new Promise(() => {
1580
- }),
1581
- controller.signal
1582
- );
1583
- }
1584
- },
1585
- parallel: runFactoryParallel,
1586
- pipeline: runFactoryPipeline,
1587
- factory: async () => {
1588
- throw new Error("nested factories are not supported");
1589
- }
1590
- };
1591
- const execution = { active: true };
1592
- const result = await factoryExecutionStore.run(execution, async () => {
1593
- try {
1594
- return await definition.run(context);
1595
- } finally {
1596
- execution.active = false;
1597
- }
1598
- });
1599
- if (result === void 0) {
1600
- return {};
1601
- }
1602
- assertFactoryResult(result);
1603
- return { result };
1604
- } finally {
1605
- try {
1606
- await progress.close();
1607
- } finally {
1608
- const controllersForRun2 = self.factoryAbortControllers.get(params.runId);
1609
- if (controllersForRun2?.get(params.executionToken) === controller) {
1610
- controllersForRun2.delete(params.executionToken);
1611
- if (controllersForRun2.size === 0) {
1612
- self.factoryAbortControllers.delete(params.runId);
1613
- }
1614
- }
1615
- }
1616
- }
1617
- },
1618
- async abort(params) {
1619
- const controllersForRun = self.factoryAbortControllers.get(params.runId);
1620
- const controller = controllersForRun?.get(params.executionToken);
1621
- if (controller !== void 0) {
1622
- controller.abort(new DOMException("Factory run was aborted", "AbortError"));
1623
- }
1624
- return {};
1625
- }
1626
- };
1627
- }
1628
1132
  /**
1629
1133
  * Registers workflow closures and reverse-RPC handlers for this session.
1630
1134
  *
@@ -2491,20 +1995,6 @@ function assertStrictJson(value, context) {
2491
1995
  };
2492
1996
  visit(value, "$", context.allowTopLevelUndefined);
2493
1997
  }
2494
- function assertFactoryResult(value) {
2495
- assertStrictJson(value, {
2496
- code: "factory_result_not_json",
2497
- label: "Factory result",
2498
- allowTopLevelUndefined: true
2499
- });
2500
- }
2501
- function assertFactoryStepResult(value, key) {
2502
- assertStrictJson(value, {
2503
- code: "factory_step_not_json",
2504
- label: `Factory step "${key}" result`,
2505
- allowTopLevelUndefined: false
2506
- });
2507
- }
2508
1998
  function assertWorkflowResult(value) {
2509
1999
  assertStrictJson(value, {
2510
2000
  code: "workflow_result_not_json",
@@ -1,2 +1,2 @@
1
- export declare const COPILOT_CLI_VERSION = "1.0.89-3";
1
+ export declare const COPILOT_CLI_VERSION = "1.0.89-7";
2
2
  export declare const COPILOT_CLI_USE_NPM_PACKAGE = false;
@@ -1,4 +1,4 @@
1
- const COPILOT_CLI_VERSION = "1.0.89-3";
1
+ const COPILOT_CLI_VERSION = "1.0.89-7";
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;