@gluecharm-lab/easyspecs-cli 0.0.23 → 0.0.24

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/main.cjs CHANGED
@@ -13851,6 +13851,7 @@ var path21 = __toESM(require("path"));
13851
13851
 
13852
13852
  // src/opencodeCli.ts
13853
13853
  var import_child_process = require("child_process");
13854
+ var import_node_events = require("node:events");
13854
13855
 
13855
13856
  // src/analysis/openCodeSessionStewardship.ts
13856
13857
  var TITLE_MAX_LEN = 80;
@@ -13975,6 +13976,7 @@ function logOpenCodeSessionFollowUpStart(diagnosticLog, p) {
13975
13976
  }
13976
13977
 
13977
13978
  // src/opencodeCli.ts
13979
+ var SHARED_OPEN_CODE_ABORT_LISTENER_BUDGET = 512;
13978
13980
  var USE_SHELL = process.platform === "win32";
13979
13981
  function resolveExecutable(executable) {
13980
13982
  const t = executable?.trim();
@@ -14175,6 +14177,9 @@ ${truncateForDiag(outBody, DIAG_STDOUT_MAX)}`);
14175
14177
  }
14176
14178
  };
14177
14179
  if (sig) {
14180
+ if ((0, import_node_events.getMaxListeners)(sig) < SHARED_OPEN_CODE_ABORT_LISTENER_BUDGET) {
14181
+ (0, import_node_events.setMaxListeners)(SHARED_OPEN_CODE_ABORT_LISTENER_BUDGET, sig);
14182
+ }
14178
14183
  onAbort = () => {
14179
14184
  child.kill("SIGTERM");
14180
14185
  settle(
@@ -20567,11 +20572,13 @@ async function drainWorkstationPool(p) {
20567
20572
  void persist();
20568
20573
  pump();
20569
20574
  };
20575
+ let poolAbortListenerRegistered = false;
20570
20576
  if (abortSignal) {
20571
20577
  if (abortSignal.aborted) {
20572
20578
  onPipelineAbort();
20573
20579
  } else {
20574
- abortSignal.addEventListener("abort", onPipelineAbort, { once: true });
20580
+ abortSignal.addEventListener("abort", onPipelineAbort);
20581
+ poolAbortListenerRegistered = true;
20575
20582
  }
20576
20583
  }
20577
20584
  const runOne = async (id) => {
@@ -20643,29 +20650,35 @@ async function drainWorkstationPool(p) {
20643
20650
  await p.onItemComplete?.(id);
20644
20651
  pump();
20645
20652
  };
20646
- while (true) {
20647
- while (fifo.length > 0 && active < maxC && !abortSignal?.aborted) {
20648
- const id = fifo.shift();
20649
- const it = byId.get(id);
20650
- if (!it || it.status !== "pending" || !parentsDone(it, byId)) {
20651
- continue;
20653
+ try {
20654
+ while (true) {
20655
+ while (fifo.length > 0 && active < maxC && !abortSignal?.aborted) {
20656
+ const id = fifo.shift();
20657
+ const it = byId.get(id);
20658
+ if (!it || it.status !== "pending" || !parentsDone(it, byId)) {
20659
+ continue;
20660
+ }
20661
+ active += 1;
20662
+ void runOne(id);
20652
20663
  }
20653
- active += 1;
20654
- void runOne(id);
20655
- }
20656
- const pendingOrRunning = active > 0 || [...byId.values()].some((v) => v.status === "pending") || fifo.length > 0;
20657
- if (!pendingOrRunning) {
20658
- break;
20659
- }
20660
- if (abortSignal?.aborted) {
20661
- if (active === 0) {
20664
+ const pendingOrRunning = active > 0 || [...byId.values()].some((v) => v.status === "pending") || fifo.length > 0;
20665
+ if (!pendingOrRunning) {
20662
20666
  break;
20663
20667
  }
20664
- await waitTurn();
20665
- continue;
20668
+ if (abortSignal?.aborted) {
20669
+ if (active === 0) {
20670
+ break;
20671
+ }
20672
+ await waitTurn();
20673
+ continue;
20674
+ }
20675
+ if (fifo.length === 0 || active >= maxC) {
20676
+ await waitTurn();
20677
+ }
20666
20678
  }
20667
- if (fifo.length === 0 || active >= maxC) {
20668
- await waitTurn();
20679
+ } finally {
20680
+ if (poolAbortListenerRegistered && abortSignal) {
20681
+ abortSignal.removeEventListener("abort", onPipelineAbort);
20669
20682
  }
20670
20683
  }
20671
20684
  return { cancelled: abortSignal?.aborted === true, skippedWorkItemIds };
@@ -27074,11 +27087,13 @@ async function runAceAutoLearnPool(p) {
27074
27087
  fifo.length = 0;
27075
27088
  pump();
27076
27089
  };
27090
+ let poolAbortListenerRegistered = false;
27077
27091
  if (abortSignal) {
27078
27092
  if (abortSignal.aborted) {
27079
27093
  onPipelineAbort();
27080
27094
  } else {
27081
- abortSignal.addEventListener("abort", onPipelineAbort, { once: true });
27095
+ abortSignal.addEventListener("abort", onPipelineAbort);
27096
+ poolAbortListenerRegistered = true;
27082
27097
  }
27083
27098
  }
27084
27099
  const traceRel = (abs) => path58.relative(contextDir2, abs).split(path58.sep).join("/");
@@ -27103,25 +27118,31 @@ async function runAceAutoLearnPool(p) {
27103
27118
  p.log?.(`[ace] ace auto-learn: finished ${rel} ok=${r.ok}`);
27104
27119
  pump();
27105
27120
  };
27106
- while (true) {
27107
- while (fifo.length > 0 && active < maxC && !abortSignal?.aborted) {
27108
- const traceAbs = fifo.shift();
27109
- active += 1;
27110
- void runOne(traceAbs);
27111
- }
27112
- const pendingOrRunning = active > 0 || fifo.length > 0;
27113
- if (!pendingOrRunning) {
27114
- break;
27115
- }
27116
- if (abortSignal?.aborted) {
27117
- if (active === 0) {
27121
+ try {
27122
+ while (true) {
27123
+ while (fifo.length > 0 && active < maxC && !abortSignal?.aborted) {
27124
+ const traceAbs = fifo.shift();
27125
+ active += 1;
27126
+ void runOne(traceAbs);
27127
+ }
27128
+ const pendingOrRunning = active > 0 || fifo.length > 0;
27129
+ if (!pendingOrRunning) {
27118
27130
  break;
27119
27131
  }
27120
- await waitTurn();
27121
- continue;
27132
+ if (abortSignal?.aborted) {
27133
+ if (active === 0) {
27134
+ break;
27135
+ }
27136
+ await waitTurn();
27137
+ continue;
27138
+ }
27139
+ if (fifo.length === 0 || active >= maxC) {
27140
+ await waitTurn();
27141
+ }
27122
27142
  }
27123
- if (fifo.length === 0 || active >= maxC) {
27124
- await waitTurn();
27143
+ } finally {
27144
+ if (poolAbortListenerRegistered && abortSignal) {
27145
+ abortSignal.removeEventListener("abort", onPipelineAbort);
27125
27146
  }
27126
27147
  }
27127
27148
  return { cancelled: abortSignal?.aborted === true, completed, failed };
@@ -27590,7 +27611,7 @@ function formatCliStderrLine(line, useAnsi) {
27590
27611
  }
27591
27612
 
27592
27613
  // src/cli/main.ts
27593
- var PKG_VERSION = "0.0.23";
27614
+ var PKG_VERSION = "0.0.24";
27594
27615
  function isNonEmptyFactoryFailureArray(x) {
27595
27616
  if (!Array.isArray(x) || x.length === 0) {
27596
27617
  return false;