open-agents-ai 0.186.43 → 0.186.45

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.
Files changed (2) hide show
  1. package/dist/index.js +864 -645
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1440,7 +1440,7 @@ ${stdinInput ?? ""}`);
1440
1440
  }
1441
1441
  runCommand(command, timeout2, stdinInput) {
1442
1442
  const start2 = performance.now();
1443
- return new Promise((resolve37) => {
1443
+ return new Promise((resolve38) => {
1444
1444
  const child = spawn("bash", ["-c", command], {
1445
1445
  cwd: this.workingDir,
1446
1446
  env: {
@@ -1471,7 +1471,7 @@ ${stdinInput ?? ""}`);
1471
1471
  clearTimeout(timer);
1472
1472
  if (exitFlushTimer)
1473
1473
  clearTimeout(exitFlushTimer);
1474
- resolve37(result);
1474
+ resolve38(result);
1475
1475
  };
1476
1476
  const timer = setTimeout(() => {
1477
1477
  killed = true;
@@ -3215,7 +3215,7 @@ ${JSON.stringify(extracted, null, 2)}`);
3215
3215
  return null;
3216
3216
  }
3217
3217
  runProcess(cmd, args, timeoutMs) {
3218
- return new Promise((resolve37, reject) => {
3218
+ return new Promise((resolve38, reject) => {
3219
3219
  const proc = execFile3(cmd, args, {
3220
3220
  timeout: timeoutMs,
3221
3221
  maxBuffer: 10 * 1024 * 1024,
@@ -3225,7 +3225,7 @@ ${JSON.stringify(extracted, null, 2)}`);
3225
3225
  reject(new Error(`Process timeout after ${timeoutMs}ms`));
3226
3226
  return;
3227
3227
  }
3228
- resolve37({
3228
+ resolve38({
3229
3229
  stdout: String(stdout),
3230
3230
  stderr: String(stderr),
3231
3231
  exitCode: error ? error.code ?? 1 : 0
@@ -8279,9 +8279,8 @@ process.on('unhandledRejection', (reason) => {
8279
8279
  model: _cModel,
8280
8280
  max_turns: 8,
8281
8281
  timeout_s: 90,
8282
- isolate: true,
8282
+ sandbox: 'container',
8283
8283
  profile: 'cohere-mesh',
8284
- working_directory: '/tmp/cohere-mesh',
8285
8284
  }),
8286
8285
  signal: AbortSignal.timeout(120000),
8287
8286
  });
@@ -11847,7 +11846,7 @@ var init_custom_tool = __esm({
11847
11846
  }
11848
11847
  /** Execute a single shell command and return output */
11849
11848
  runCommand(command) {
11850
- return new Promise((resolve37) => {
11849
+ return new Promise((resolve38) => {
11851
11850
  const child = spawn4("bash", ["-c", command], {
11852
11851
  cwd: this.workingDir,
11853
11852
  env: { ...process.env, CI: "true", NO_COLOR: "1" },
@@ -11872,11 +11871,11 @@ var init_custom_tool = __esm({
11872
11871
  child.kill("SIGTERM");
11873
11872
  } catch {
11874
11873
  }
11875
- resolve37({ success: false, output: stdout, error: "Command timed out after 60s" });
11874
+ resolve38({ success: false, output: stdout, error: "Command timed out after 60s" });
11876
11875
  }, 6e4);
11877
11876
  child.on("close", (code8) => {
11878
11877
  clearTimeout(timer);
11879
- resolve37({
11878
+ resolve38({
11880
11879
  success: code8 === 0,
11881
11880
  output: stdout + (stderr && code8 === 0 ? `
11882
11881
  STDERR:
@@ -11886,7 +11885,7 @@ ${stderr}` : ""),
11886
11885
  });
11887
11886
  child.on("error", (err) => {
11888
11887
  clearTimeout(timer);
11889
- resolve37({ success: false, output: stdout, error: err.message });
11888
+ resolve38({ success: false, output: stdout, error: err.message });
11890
11889
  });
11891
11890
  });
11892
11891
  }
@@ -13534,7 +13533,7 @@ import { writeFile as writeFile8, mkdtemp, rm, readdir as readdir3, stat } from
13534
13533
  import { join as join20 } from "node:path";
13535
13534
  import { tmpdir as tmpdir2 } from "node:os";
13536
13535
  function runProcess(cmd, args, options2) {
13537
- return new Promise((resolve37) => {
13536
+ return new Promise((resolve38) => {
13538
13537
  const proc = spawn6(cmd, args, {
13539
13538
  cwd: options2.cwd,
13540
13539
  timeout: options2.timeout,
@@ -13564,7 +13563,7 @@ function runProcess(cmd, args, options2) {
13564
13563
  }
13565
13564
  });
13566
13565
  proc.on("error", (err) => {
13567
- resolve37({
13566
+ resolve38({
13568
13567
  stdout,
13569
13568
  stderr: stderr || err.message,
13570
13569
  exitCode: 1,
@@ -13576,7 +13575,7 @@ function runProcess(cmd, args, options2) {
13576
13575
  if (signal === "SIGTERM" || signal === "SIGKILL") {
13577
13576
  timedOut = true;
13578
13577
  }
13579
- resolve37({
13578
+ resolve38({
13580
13579
  stdout,
13581
13580
  stderr,
13582
13581
  exitCode: code8 ?? (timedOut ? 124 : 1),
@@ -23611,8 +23610,8 @@ var init_multiaddr = __esm({
23611
23610
  // ../node_modules/p-defer/index.js
23612
23611
  function pDefer() {
23613
23612
  const deferred = {};
23614
- deferred.promise = new Promise((resolve37, reject) => {
23615
- deferred.resolve = resolve37;
23613
+ deferred.promise = new Promise((resolve38, reject) => {
23614
+ deferred.resolve = resolve38;
23616
23615
  deferred.reject = reject;
23617
23616
  });
23618
23617
  return deferred;
@@ -23744,12 +23743,12 @@ function _pushable(getNext, options2) {
23744
23743
  if (ended) {
23745
23744
  return { done: true };
23746
23745
  }
23747
- return await new Promise((resolve37, reject) => {
23746
+ return await new Promise((resolve38, reject) => {
23748
23747
  onNext = (next) => {
23749
23748
  onNext = null;
23750
23749
  buffer2.push(next);
23751
23750
  try {
23752
- resolve37(getNext(buffer2));
23751
+ resolve38(getNext(buffer2));
23753
23752
  } catch (err) {
23754
23753
  reject(err);
23755
23754
  }
@@ -23825,7 +23824,7 @@ function _pushable(getNext, options2) {
23825
23824
  let cancel;
23826
23825
  let listener;
23827
23826
  if (signal != null) {
23828
- cancel = new Promise((resolve37, reject) => {
23827
+ cancel = new Promise((resolve38, reject) => {
23829
23828
  listener = () => {
23830
23829
  reject(new AbortError2());
23831
23830
  };
@@ -23917,7 +23916,7 @@ function pTimeout(promise, options2) {
23917
23916
  } = options2;
23918
23917
  let timer;
23919
23918
  let abortHandler;
23920
- const wrappedPromise = new Promise((resolve37, reject) => {
23919
+ const wrappedPromise = new Promise((resolve38, reject) => {
23921
23920
  if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
23922
23921
  throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
23923
23922
  }
@@ -23931,7 +23930,7 @@ function pTimeout(promise, options2) {
23931
23930
  };
23932
23931
  signal.addEventListener("abort", abortHandler, { once: true });
23933
23932
  }
23934
- promise.then(resolve37, reject);
23933
+ promise.then(resolve38, reject);
23935
23934
  if (milliseconds === Number.POSITIVE_INFINITY) {
23936
23935
  return;
23937
23936
  }
@@ -23939,7 +23938,7 @@ function pTimeout(promise, options2) {
23939
23938
  timer = customTimers.setTimeout.call(void 0, () => {
23940
23939
  if (fallback) {
23941
23940
  try {
23942
- resolve37(fallback());
23941
+ resolve38(fallback());
23943
23942
  } catch (error) {
23944
23943
  reject(error);
23945
23944
  }
@@ -23949,7 +23948,7 @@ function pTimeout(promise, options2) {
23949
23948
  promise.cancel();
23950
23949
  }
23951
23950
  if (message2 === false) {
23952
- resolve37();
23951
+ resolve38();
23953
23952
  } else if (message2 instanceof Error) {
23954
23953
  reject(message2);
23955
23954
  } else {
@@ -23987,7 +23986,7 @@ var init_p_timeout = __esm({
23987
23986
  // ../node_modules/p-event/index.js
23988
23987
  function pEventMultiple(emitter, event, options2) {
23989
23988
  let cancel;
23990
- const returnValue = new Promise((resolve37, reject) => {
23989
+ const returnValue = new Promise((resolve38, reject) => {
23991
23990
  options2 = {
23992
23991
  rejectionEvents: ["error"],
23993
23992
  multiArgs: false,
@@ -24018,7 +24017,7 @@ function pEventMultiple(emitter, event, options2) {
24018
24017
  items.push(value2);
24019
24018
  if (options2.count === items.length) {
24020
24019
  cancel();
24021
- resolve37(items);
24020
+ resolve38(items);
24022
24021
  }
24023
24022
  };
24024
24023
  const rejectHandler = (...arguments_) => {
@@ -24049,7 +24048,7 @@ function pEventMultiple(emitter, event, options2) {
24049
24048
  }, { once: true });
24050
24049
  }
24051
24050
  if (options2.resolveImmediately) {
24052
- resolve37(items);
24051
+ resolve38(items);
24053
24052
  }
24054
24053
  });
24055
24054
  returnValue.cancel = cancel;
@@ -24176,7 +24175,7 @@ async function raceSignal(promise, signal, opts) {
24176
24175
  try {
24177
24176
  return await Promise.race([
24178
24177
  promise,
24179
- new Promise((resolve37, reject) => {
24178
+ new Promise((resolve38, reject) => {
24180
24179
  listener = () => {
24181
24180
  reject(translateError(signal));
24182
24181
  };
@@ -29909,10 +29908,10 @@ function createDelay({ clearTimeout: defaultClear, setTimeout: defaultSet } = {}
29909
29908
  signal.removeEventListener("abort", signalListener);
29910
29909
  }
29911
29910
  };
29912
- const delayPromise = new Promise((resolve37, reject) => {
29911
+ const delayPromise = new Promise((resolve38, reject) => {
29913
29912
  settle = () => {
29914
29913
  cleanup();
29915
- resolve37(value2);
29914
+ resolve38(value2);
29916
29915
  };
29917
29916
  rejectFunction = reject;
29918
29917
  timeoutId = (defaultSet ?? setTimeout)(settle, milliseconds);
@@ -31377,7 +31376,7 @@ async function raceEvent(emitter, eventName, signal, opts) {
31377
31376
  if (signal?.aborted === true) {
31378
31377
  return Promise.reject(error);
31379
31378
  }
31380
- return new Promise((resolve37, reject) => {
31379
+ return new Promise((resolve38, reject) => {
31381
31380
  function removeListeners() {
31382
31381
  removeListener(signal, "abort", abortListener);
31383
31382
  removeListener(emitter, eventName, eventListener);
@@ -31394,7 +31393,7 @@ async function raceEvent(emitter, eventName, signal, opts) {
31394
31393
  return;
31395
31394
  }
31396
31395
  removeListeners();
31397
- resolve37(evt);
31396
+ resolve38(evt);
31398
31397
  };
31399
31398
  const errorEventListener = (evt) => {
31400
31399
  removeListeners();
@@ -31901,7 +31900,7 @@ var init_channel = __esm({
31901
31900
  name: requestEvent.name,
31902
31901
  identifier: requestEvent.identifier
31903
31902
  });
31904
- await new Promise((resolve37) => {
31903
+ await new Promise((resolve38) => {
31905
31904
  const releaseEventListener = (event2) => {
31906
31905
  if (event2?.data == null) {
31907
31906
  return;
@@ -31913,7 +31912,7 @@ var init_channel = __esm({
31913
31912
  };
31914
31913
  if (releaseEvent.type === releaseType && releaseEvent.identifier === requestEvent.identifier) {
31915
31914
  channel.removeEventListener("message", releaseEventListener);
31916
- resolve37();
31915
+ resolve38();
31917
31916
  }
31918
31917
  };
31919
31918
  channel.addEventListener("message", releaseEventListener);
@@ -31975,11 +31974,11 @@ var init_cluster = __esm({
31975
31974
  name: requestEvent.name,
31976
31975
  identifier: requestEvent.identifier
31977
31976
  });
31978
- await new Promise((resolve37) => {
31977
+ await new Promise((resolve38) => {
31979
31978
  const releaseEventListener = (releaseEvent) => {
31980
31979
  if (releaseEvent.type === releaseType && releaseEvent.identifier === requestEvent.identifier) {
31981
31980
  worker2.removeListener("message", releaseEventListener);
31982
- resolve37();
31981
+ resolve38();
31983
31982
  }
31984
31983
  };
31985
31984
  worker2.on("message", releaseEventListener);
@@ -32064,7 +32063,7 @@ var init_channel2 = __esm({
32064
32063
  identifier: id,
32065
32064
  name: this.name
32066
32065
  });
32067
- return new Promise((resolve37, reject) => {
32066
+ return new Promise((resolve38, reject) => {
32068
32067
  const abortListener = () => {
32069
32068
  this.channel.postMessage({
32070
32069
  type: abortType,
@@ -32082,7 +32081,7 @@ var init_channel2 = __esm({
32082
32081
  if (event.data?.type === grantType) {
32083
32082
  this.channel.removeEventListener("message", listener);
32084
32083
  options2?.signal?.removeEventListener("abort", abortListener);
32085
- resolve37(() => {
32084
+ resolve38(() => {
32086
32085
  this.channel.postMessage({
32087
32086
  type: releaseType,
32088
32087
  identifier: id,
@@ -32147,7 +32146,7 @@ var init_cluster2 = __esm({
32147
32146
  identifier: id,
32148
32147
  name: this.name
32149
32148
  });
32150
- return new Promise((resolve37, reject) => {
32149
+ return new Promise((resolve38, reject) => {
32151
32150
  const abortListener = () => {
32152
32151
  process.send?.({
32153
32152
  type: abortType,
@@ -32165,7 +32164,7 @@ var init_cluster2 = __esm({
32165
32164
  if (event.type === grantType) {
32166
32165
  process.removeListener("message", listener);
32167
32166
  options2?.signal?.removeEventListener("abort", abortListener);
32168
- resolve37(() => {
32167
+ resolve38(() => {
32169
32168
  process.send?.({
32170
32169
  type: releaseType,
32171
32170
  identifier: id,
@@ -32314,8 +32313,8 @@ function getImplementation(opts) {
32314
32313
  async function createReleasable(queue, options2) {
32315
32314
  let res;
32316
32315
  let rej;
32317
- const p2 = new Promise((resolve37, reject) => {
32318
- res = resolve37;
32316
+ const p2 = new Promise((resolve38, reject) => {
32317
+ res = resolve38;
32319
32318
  rej = reject;
32320
32319
  });
32321
32320
  const listener = () => {
@@ -32325,10 +32324,10 @@ async function createReleasable(queue, options2) {
32325
32324
  once: true
32326
32325
  });
32327
32326
  queue.add(async () => {
32328
- await new Promise((resolve37) => {
32327
+ await new Promise((resolve38) => {
32329
32328
  res(() => {
32330
32329
  options2?.signal?.removeEventListener("abort", listener);
32331
- resolve37();
32330
+ resolve38();
32332
32331
  });
32333
32332
  });
32334
32333
  }, {
@@ -40040,7 +40039,7 @@ var init_dist3 = __esm({
40040
40039
  // Assign unique ID if not provided
40041
40040
  id: options2.id ?? (this.#idAssigner++).toString()
40042
40041
  };
40043
- return new Promise((resolve37, reject) => {
40042
+ return new Promise((resolve38, reject) => {
40044
40043
  const taskSymbol = /* @__PURE__ */ Symbol(`task-${options2.id}`);
40045
40044
  this.#queue.enqueue(async () => {
40046
40045
  this.#pending++;
@@ -40078,7 +40077,7 @@ var init_dist3 = __esm({
40078
40077
  })]);
40079
40078
  }
40080
40079
  const result = await operation;
40081
- resolve37(result);
40080
+ resolve38(result);
40082
40081
  this.emit("completed", result);
40083
40082
  } catch (error) {
40084
40083
  reject(error);
@@ -40235,13 +40234,13 @@ var init_dist3 = __esm({
40235
40234
  });
40236
40235
  }
40237
40236
  async #onEvent(event, filter2) {
40238
- return new Promise((resolve37) => {
40237
+ return new Promise((resolve38) => {
40239
40238
  const listener = () => {
40240
40239
  if (filter2 && !filter2()) {
40241
40240
  return;
40242
40241
  }
40243
40242
  this.off(event, listener);
40244
- resolve37();
40243
+ resolve38();
40245
40244
  };
40246
40245
  this.on(event, listener);
40247
40246
  });
@@ -45377,7 +45376,7 @@ async function onAttemptFailure({ error, attemptNumber, retriesConsumed, startTi
45377
45376
  const finalDelay = Math.min(delayTime, remainingTime);
45378
45377
  options2.signal?.throwIfAborted();
45379
45378
  if (finalDelay > 0) {
45380
- await new Promise((resolve37, reject) => {
45379
+ await new Promise((resolve38, reject) => {
45381
45380
  const onAbort = () => {
45382
45381
  clearTimeout(timeoutToken);
45383
45382
  options2.signal?.removeEventListener("abort", onAbort);
@@ -45385,7 +45384,7 @@ async function onAttemptFailure({ error, attemptNumber, retriesConsumed, startTi
45385
45384
  };
45386
45385
  const timeoutToken = setTimeout(() => {
45387
45386
  options2.signal?.removeEventListener("abort", onAbort);
45388
- resolve37();
45387
+ resolve38();
45389
45388
  }, finalDelay);
45390
45389
  if (options2.unref) {
45391
45390
  timeoutToken.unref?.();
@@ -47462,12 +47461,12 @@ var init_connection2 = __esm({
47462
47461
  for (let i2 = 0; i2 < middleware.length; i2++) {
47463
47462
  const mw = middleware[i2];
47464
47463
  stream.log.trace("running middleware", i2, mw);
47465
- await new Promise((resolve37, reject) => {
47464
+ await new Promise((resolve38, reject) => {
47466
47465
  try {
47467
47466
  const result = mw(stream, connection, (s2, c4) => {
47468
47467
  stream = s2;
47469
47468
  connection = c4;
47470
- resolve37();
47469
+ resolve38();
47471
47470
  });
47472
47471
  if (result instanceof Promise) {
47473
47472
  result.catch(reject);
@@ -52466,7 +52465,7 @@ async function randomDelay() {
52466
52465
  const min = 200;
52467
52466
  const max = 1e3;
52468
52467
  const delay3 = Math.random() * (max - min) + min;
52469
- await new Promise((resolve37) => setTimeout(resolve37, delay3));
52468
+ await new Promise((resolve38) => setTimeout(resolve38, delay3));
52470
52469
  }
52471
52470
  function DsName(name10) {
52472
52471
  return new Key(keyPrefix + name10);
@@ -59522,11 +59521,11 @@ function __metadata(metadataKey, metadataValue) {
59522
59521
  }
59523
59522
  function __awaiter(thisArg, _arguments, P, generator) {
59524
59523
  function adopt(value2) {
59525
- return value2 instanceof P ? value2 : new P(function(resolve37) {
59526
- resolve37(value2);
59524
+ return value2 instanceof P ? value2 : new P(function(resolve38) {
59525
+ resolve38(value2);
59527
59526
  });
59528
59527
  }
59529
- return new (P || (P = Promise))(function(resolve37, reject) {
59528
+ return new (P || (P = Promise))(function(resolve38, reject) {
59530
59529
  function fulfilled(value2) {
59531
59530
  try {
59532
59531
  step(generator.next(value2));
@@ -59542,7 +59541,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
59542
59541
  }
59543
59542
  }
59544
59543
  function step(result) {
59545
- result.done ? resolve37(result.value) : adopt(result.value).then(fulfilled, rejected);
59544
+ result.done ? resolve38(result.value) : adopt(result.value).then(fulfilled, rejected);
59546
59545
  }
59547
59546
  step((generator = generator.apply(thisArg, _arguments || [])).next());
59548
59547
  });
@@ -59733,14 +59732,14 @@ function __asyncValues(o2) {
59733
59732
  }, i2);
59734
59733
  function verb(n2) {
59735
59734
  i2[n2] = o2[n2] && function(v) {
59736
- return new Promise(function(resolve37, reject) {
59737
- v = o2[n2](v), settle(resolve37, reject, v.done, v.value);
59735
+ return new Promise(function(resolve38, reject) {
59736
+ v = o2[n2](v), settle(resolve38, reject, v.done, v.value);
59738
59737
  });
59739
59738
  };
59740
59739
  }
59741
- function settle(resolve37, reject, d2, v) {
59740
+ function settle(resolve38, reject, d2, v) {
59742
59741
  Promise.resolve(v).then(function(v2) {
59743
- resolve37({ value: v2, done: d2 });
59742
+ resolve38({ value: v2, done: d2 });
59744
59743
  }, reject);
59745
59744
  }
59746
59745
  }
@@ -65268,11 +65267,11 @@ function __metadata2(metadataKey, metadataValue) {
65268
65267
  }
65269
65268
  function __awaiter2(thisArg, _arguments, P, generator) {
65270
65269
  function adopt(value2) {
65271
- return value2 instanceof P ? value2 : new P(function(resolve37) {
65272
- resolve37(value2);
65270
+ return value2 instanceof P ? value2 : new P(function(resolve38) {
65271
+ resolve38(value2);
65273
65272
  });
65274
65273
  }
65275
- return new (P || (P = Promise))(function(resolve37, reject) {
65274
+ return new (P || (P = Promise))(function(resolve38, reject) {
65276
65275
  function fulfilled(value2) {
65277
65276
  try {
65278
65277
  step(generator.next(value2));
@@ -65288,7 +65287,7 @@ function __awaiter2(thisArg, _arguments, P, generator) {
65288
65287
  }
65289
65288
  }
65290
65289
  function step(result) {
65291
- result.done ? resolve37(result.value) : adopt(result.value).then(fulfilled, rejected);
65290
+ result.done ? resolve38(result.value) : adopt(result.value).then(fulfilled, rejected);
65292
65291
  }
65293
65292
  step((generator = generator.apply(thisArg, _arguments || [])).next());
65294
65293
  });
@@ -65466,14 +65465,14 @@ function __asyncValues2(o2) {
65466
65465
  }, i2);
65467
65466
  function verb(n2) {
65468
65467
  i2[n2] = o2[n2] && function(v) {
65469
- return new Promise(function(resolve37, reject) {
65470
- v = o2[n2](v), settle(resolve37, reject, v.done, v.value);
65468
+ return new Promise(function(resolve38, reject) {
65469
+ v = o2[n2](v), settle(resolve38, reject, v.done, v.value);
65471
65470
  });
65472
65471
  };
65473
65472
  }
65474
- function settle(resolve37, reject, d2, v) {
65473
+ function settle(resolve38, reject, d2, v) {
65475
65474
  Promise.resolve(v).then(function(v2) {
65476
- resolve37({ value: v2, done: d2 });
65475
+ resolve38({ value: v2, done: d2 });
65477
65476
  }, reject);
65478
65477
  }
65479
65478
  }
@@ -83883,10 +83882,10 @@ var require_axios = __commonJS({
83883
83882
  }
83884
83883
  };
83885
83884
  var CanceledError$1 = CanceledError;
83886
- function settle(resolve37, reject, response) {
83885
+ function settle(resolve38, reject, response) {
83887
83886
  const validateStatus = response.config.validateStatus;
83888
83887
  if (!response.status || !validateStatus || validateStatus(response.status)) {
83889
- resolve37(response);
83888
+ resolve38(response);
83890
83889
  } else {
83891
83890
  reject(
83892
83891
  new AxiosError$1(
@@ -84478,7 +84477,7 @@ var require_axios = __commonJS({
84478
84477
  }
84479
84478
  var isHttpAdapterSupported = typeof process !== "undefined" && utils$1.kindOf(process) === "process";
84480
84479
  var wrapAsync = (asyncExecutor) => {
84481
- return new Promise((resolve37, reject) => {
84480
+ return new Promise((resolve38, reject) => {
84482
84481
  let onDone;
84483
84482
  let isDone;
84484
84483
  const done = (value2, isRejected) => {
@@ -84488,7 +84487,7 @@ var require_axios = __commonJS({
84488
84487
  };
84489
84488
  const _resolve = (value2) => {
84490
84489
  done(value2);
84491
- resolve37(value2);
84490
+ resolve38(value2);
84492
84491
  };
84493
84492
  const _reject = (reason) => {
84494
84493
  done(reason, true);
@@ -84535,7 +84534,7 @@ var require_axios = __commonJS({
84535
84534
  }
84536
84535
  };
84537
84536
  var httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
84538
- return wrapAsync(async function dispatchHttpRequest(resolve37, reject, onDone) {
84537
+ return wrapAsync(async function dispatchHttpRequest(resolve38, reject, onDone) {
84539
84538
  let { data, lookup, family, httpVersion = 1, http2Options } = config;
84540
84539
  const { responseType, responseEncoding } = config;
84541
84540
  const method = config.method.toUpperCase();
@@ -84625,7 +84624,7 @@ var require_axios = __commonJS({
84625
84624
  }
84626
84625
  let convertedData;
84627
84626
  if (method !== "GET") {
84628
- return settle(resolve37, reject, {
84627
+ return settle(resolve38, reject, {
84629
84628
  status: 405,
84630
84629
  statusText: "method not allowed",
84631
84630
  headers: {},
@@ -84647,7 +84646,7 @@ var require_axios = __commonJS({
84647
84646
  } else if (responseType === "stream") {
84648
84647
  convertedData = stream__default["default"].Readable.from(convertedData);
84649
84648
  }
84650
- return settle(resolve37, reject, {
84649
+ return settle(resolve38, reject, {
84651
84650
  data: convertedData,
84652
84651
  status: 200,
84653
84652
  statusText: "OK",
@@ -84888,7 +84887,7 @@ var require_axios = __commonJS({
84888
84887
  };
84889
84888
  if (responseType === "stream") {
84890
84889
  response.data = responseStream;
84891
- settle(resolve37, reject, response);
84890
+ settle(resolve38, reject, response);
84892
84891
  } else {
84893
84892
  const responseBuffer = [];
84894
84893
  let totalResponseBytes = 0;
@@ -84938,7 +84937,7 @@ var require_axios = __commonJS({
84938
84937
  } catch (err) {
84939
84938
  return reject(AxiosError$1.from(err, null, config, response.request, response));
84940
84939
  }
84941
- settle(resolve37, reject, response);
84940
+ settle(resolve38, reject, response);
84942
84941
  });
84943
84942
  }
84944
84943
  abortEmitter.once("abort", (err) => {
@@ -85188,7 +85187,7 @@ var require_axios = __commonJS({
85188
85187
  };
85189
85188
  var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
85190
85189
  var xhrAdapter = isXHRAdapterSupported && function(config) {
85191
- return new Promise(function dispatchXhrRequest(resolve37, reject) {
85190
+ return new Promise(function dispatchXhrRequest(resolve38, reject) {
85192
85191
  const _config2 = resolveConfig(config);
85193
85192
  let requestData = _config2.data;
85194
85193
  const requestHeaders = AxiosHeaders$1.from(_config2.headers).normalize();
@@ -85223,7 +85222,7 @@ var require_axios = __commonJS({
85223
85222
  };
85224
85223
  settle(
85225
85224
  function _resolve(value2) {
85226
- resolve37(value2);
85225
+ resolve38(value2);
85227
85226
  done();
85228
85227
  },
85229
85228
  function _reject(err) {
@@ -85615,8 +85614,8 @@ var require_axios = __commonJS({
85615
85614
  config
85616
85615
  );
85617
85616
  !isStreamResponse && unsubscribe && unsubscribe();
85618
- return await new Promise((resolve37, reject) => {
85619
- settle(resolve37, reject, {
85617
+ return await new Promise((resolve38, reject) => {
85618
+ settle(resolve38, reject, {
85620
85619
  data: responseData,
85621
85620
  headers: AxiosHeaders$1.from(response.headers),
85622
85621
  status: response.status,
@@ -86020,8 +86019,8 @@ var require_axios = __commonJS({
86020
86019
  throw new TypeError("executor must be a function.");
86021
86020
  }
86022
86021
  let resolvePromise;
86023
- this.promise = new Promise(function promiseExecutor(resolve37) {
86024
- resolvePromise = resolve37;
86022
+ this.promise = new Promise(function promiseExecutor(resolve38) {
86023
+ resolvePromise = resolve38;
86025
86024
  });
86026
86025
  const token = this;
86027
86026
  this.promise.then((cancel) => {
@@ -86034,9 +86033,9 @@ var require_axios = __commonJS({
86034
86033
  });
86035
86034
  this.promise.then = (onfulfilled) => {
86036
86035
  let _resolve;
86037
- const promise = new Promise((resolve37) => {
86038
- token.subscribe(resolve37);
86039
- _resolve = resolve37;
86036
+ const promise = new Promise((resolve38) => {
86037
+ token.subscribe(resolve38);
86038
+ _resolve = resolve38;
86040
86039
  }).then(onfulfilled);
86041
86040
  promise.cancel = function reject() {
86042
86041
  token.unsubscribe(_resolve);
@@ -86264,8 +86263,8 @@ var require_util = __commonJS({
86264
86263
  }
86265
86264
  const duration = backoff.duration();
86266
86265
  log22(`Promise rejected attempt #${backoff.attempts}, retrying in ${duration}ms: ${e2.message}`);
86267
- await new Promise((resolve37) => {
86268
- setTimeout(resolve37, duration);
86266
+ await new Promise((resolve38) => {
86267
+ setTimeout(resolve38, duration);
86269
86268
  });
86270
86269
  return retryPromise(fn, attempts, backoff);
86271
86270
  }
@@ -86370,7 +86369,7 @@ var require_util = __commonJS({
86370
86369
  return resolver;
86371
86370
  }
86372
86371
  async function retrieveTlsAlpnCertificate(host, port, timeout2 = 3e4) {
86373
- return new Promise((resolve37, reject) => {
86372
+ return new Promise((resolve38, reject) => {
86374
86373
  let result;
86375
86374
  const socket = tls2.connect({
86376
86375
  host,
@@ -86393,7 +86392,7 @@ var require_util = __commonJS({
86393
86392
  });
86394
86393
  socket.on("end", () => {
86395
86394
  if (result) {
86396
- return resolve37(result.toString());
86395
+ return resolve38(result.toString());
86397
86396
  }
86398
86397
  return reject(new Error("TLS ALPN lookup failed to retrieve certificate"));
86399
86398
  });
@@ -86534,8 +86533,8 @@ var require_axios2 = __commonJS({
86534
86533
  retryAfter = retryDefaultDelay * config.retryAttempt;
86535
86534
  log22(`Unable to locate or parse retry-after response header, waiting ${retryAfter} seconds`);
86536
86535
  }
86537
- await new Promise((resolve37) => {
86538
- setTimeout(resolve37, retryAfter * 1e3);
86536
+ await new Promise((resolve38) => {
86537
+ setTimeout(resolve38, retryAfter * 1e3);
86539
86538
  });
86540
86539
  return instance(config);
86541
86540
  }
@@ -105764,10 +105763,10 @@ function createDelay2({ clearTimeout: defaultClear, setTimeout: defaultSet } = {
105764
105763
  signal.removeEventListener("abort", signalListener);
105765
105764
  }
105766
105765
  };
105767
- const delayPromise = new Promise((resolve37, reject) => {
105766
+ const delayPromise = new Promise((resolve38, reject) => {
105768
105767
  settle = () => {
105769
105768
  cleanup();
105770
- resolve37(value2);
105769
+ resolve38(value2);
105771
105770
  };
105772
105771
  rejectFunction = reject;
105773
105772
  timeoutId = (defaultSet ?? setTimeout)(settle, milliseconds);
@@ -112569,9 +112568,9 @@ var require_dispatcher_base = __commonJS({
112569
112568
  }
112570
112569
  close(callback) {
112571
112570
  if (callback === void 0) {
112572
- return new Promise((resolve37, reject) => {
112571
+ return new Promise((resolve38, reject) => {
112573
112572
  this.close((err, data) => {
112574
- return err ? reject(err) : resolve37(data);
112573
+ return err ? reject(err) : resolve38(data);
112575
112574
  });
112576
112575
  });
112577
112576
  }
@@ -112609,9 +112608,9 @@ var require_dispatcher_base = __commonJS({
112609
112608
  err = null;
112610
112609
  }
112611
112610
  if (callback === void 0) {
112612
- return new Promise((resolve37, reject) => {
112611
+ return new Promise((resolve38, reject) => {
112613
112612
  this.destroy(err, (err2, data) => {
112614
- return err2 ? reject(err2) : resolve37(data);
112613
+ return err2 ? reject(err2) : resolve38(data);
112615
112614
  });
112616
112615
  });
112617
112616
  }
@@ -116088,8 +116087,8 @@ var require_promise = __commonJS({
116088
116087
  function createDeferredPromise2() {
116089
116088
  let res;
116090
116089
  let rej;
116091
- const promise = new Promise((resolve37, reject) => {
116092
- res = resolve37;
116090
+ const promise = new Promise((resolve38, reject) => {
116091
+ res = resolve38;
116093
116092
  rej = reject;
116094
116093
  });
116095
116094
  return { promise, resolve: res, reject: rej };
@@ -117390,12 +117389,12 @@ upgrade: ${upgrade}\r
117390
117389
  cb();
117391
117390
  }
117392
117391
  }
117393
- const waitForDrain = () => new Promise((resolve37, reject) => {
117392
+ const waitForDrain = () => new Promise((resolve38, reject) => {
117394
117393
  assert(callback === null);
117395
117394
  if (socket[kError]) {
117396
117395
  reject(socket[kError]);
117397
117396
  } else {
117398
- callback = resolve37;
117397
+ callback = resolve38;
117399
117398
  }
117400
117399
  });
117401
117400
  socket.on("close", onDrain).on("drain", onDrain);
@@ -118240,12 +118239,12 @@ var require_client_h2 = __commonJS({
118240
118239
  cb();
118241
118240
  }
118242
118241
  }
118243
- const waitForDrain = () => new Promise((resolve37, reject) => {
118242
+ const waitForDrain = () => new Promise((resolve38, reject) => {
118244
118243
  assert(callback === null);
118245
118244
  if (socket[kError]) {
118246
118245
  reject(socket[kError]);
118247
118246
  } else {
118248
- callback = resolve37;
118247
+ callback = resolve38;
118249
118248
  }
118250
118249
  });
118251
118250
  h2stream.on("close", onDrain).on("drain", onDrain);
@@ -118556,16 +118555,16 @@ var require_client2 = __commonJS({
118556
118555
  return this[kNeedDrain] < 2;
118557
118556
  }
118558
118557
  [kClose]() {
118559
- return new Promise((resolve37) => {
118558
+ return new Promise((resolve38) => {
118560
118559
  if (this[kSize]) {
118561
- this[kClosedResolve] = resolve37;
118560
+ this[kClosedResolve] = resolve38;
118562
118561
  } else {
118563
- resolve37(null);
118562
+ resolve38(null);
118564
118563
  }
118565
118564
  });
118566
118565
  }
118567
118566
  [kDestroy](err) {
118568
- return new Promise((resolve37) => {
118567
+ return new Promise((resolve38) => {
118569
118568
  const requests = this[kQueue].splice(this[kPendingIdx]);
118570
118569
  for (let i2 = 0; i2 < requests.length; i2++) {
118571
118570
  const request = requests[i2];
@@ -118576,7 +118575,7 @@ var require_client2 = __commonJS({
118576
118575
  this[kClosedResolve]();
118577
118576
  this[kClosedResolve] = null;
118578
118577
  }
118579
- resolve37(null);
118578
+ resolve38(null);
118580
118579
  };
118581
118580
  if (this[kHTTPContext]) {
118582
118581
  this[kHTTPContext].destroy(err, callback);
@@ -118981,8 +118980,8 @@ var require_pool_base = __commonJS({
118981
118980
  }
118982
118981
  return Promise.all(closeAll);
118983
118982
  } else {
118984
- return new Promise((resolve37) => {
118985
- this[kClosedResolve] = resolve37;
118983
+ return new Promise((resolve38) => {
118984
+ this[kClosedResolve] = resolve38;
118986
118985
  });
118987
118986
  }
118988
118987
  }
@@ -120074,10 +120073,10 @@ var require_socks5_proxy_agent = __commonJS({
120074
120073
  const proxyHost = this[kProxyUrl].hostname;
120075
120074
  const proxyPort = parseInt(this[kProxyUrl].port) || 1080;
120076
120075
  debug("creating SOCKS5 connection to", proxyHost, proxyPort);
120077
- const socket = await new Promise((resolve37, reject) => {
120076
+ const socket = await new Promise((resolve38, reject) => {
120078
120077
  const onConnect = () => {
120079
120078
  socket2.removeListener("error", onError);
120080
- resolve37(socket2);
120079
+ resolve38(socket2);
120081
120080
  };
120082
120081
  const onError = (err) => {
120083
120082
  socket2.removeListener("connect", onConnect);
@@ -120096,14 +120095,14 @@ var require_socks5_proxy_agent = __commonJS({
120096
120095
  socket.destroy();
120097
120096
  });
120098
120097
  await socks5Client.handshake();
120099
- await new Promise((resolve37, reject) => {
120098
+ await new Promise((resolve38, reject) => {
120100
120099
  const timeout2 = setTimeout(() => {
120101
120100
  reject(new Error("SOCKS5 authentication timeout"));
120102
120101
  }, 5e3);
120103
120102
  const onAuthenticated = () => {
120104
120103
  clearTimeout(timeout2);
120105
120104
  socks5Client.removeListener("error", onError);
120106
- resolve37();
120105
+ resolve38();
120107
120106
  };
120108
120107
  const onError = (err) => {
120109
120108
  clearTimeout(timeout2);
@@ -120112,14 +120111,14 @@ var require_socks5_proxy_agent = __commonJS({
120112
120111
  };
120113
120112
  if (socks5Client.state === "authenticated") {
120114
120113
  clearTimeout(timeout2);
120115
- resolve37();
120114
+ resolve38();
120116
120115
  } else {
120117
120116
  socks5Client.once("authenticated", onAuthenticated);
120118
120117
  socks5Client.once("error", onError);
120119
120118
  }
120120
120119
  });
120121
120120
  await socks5Client.connect(targetHost, targetPort);
120122
- await new Promise((resolve37, reject) => {
120121
+ await new Promise((resolve38, reject) => {
120123
120122
  const timeout2 = setTimeout(() => {
120124
120123
  reject(new Error("SOCKS5 connection timeout"));
120125
120124
  }, 5e3);
@@ -120127,7 +120126,7 @@ var require_socks5_proxy_agent = __commonJS({
120127
120126
  debug("SOCKS5 tunnel established to", targetHost, targetPort, "via", info);
120128
120127
  clearTimeout(timeout2);
120129
120128
  socks5Client.removeListener("error", onError);
120130
- resolve37();
120129
+ resolve38();
120131
120130
  };
120132
120131
  const onError = (err) => {
120133
120132
  clearTimeout(timeout2);
@@ -120168,8 +120167,8 @@ var require_socks5_proxy_agent = __commonJS({
120168
120167
  servername: targetHost,
120169
120168
  ...connectOpts.tls || {}
120170
120169
  });
120171
- await new Promise((resolve37, reject) => {
120172
- finalSocket.once("secureConnect", resolve37);
120170
+ await new Promise((resolve38, reject) => {
120171
+ finalSocket.once("secureConnect", resolve38);
120173
120172
  finalSocket.once("error", reject);
120174
120173
  });
120175
120174
  }
@@ -121194,7 +121193,7 @@ var require_readable = __commonJS({
121194
121193
  if (this._readableState.closeEmitted) {
121195
121194
  return Promise.resolve(null);
121196
121195
  }
121197
- return new Promise((resolve37, reject) => {
121196
+ return new Promise((resolve38, reject) => {
121198
121197
  if (this[kContentLength] && this[kContentLength] > limit || this[kBytesRead] > limit) {
121199
121198
  this.destroy(new AbortError6());
121200
121199
  }
@@ -121208,11 +121207,11 @@ var require_readable = __commonJS({
121208
121207
  if (signal.aborted) {
121209
121208
  reject(signal.reason ?? new AbortError6());
121210
121209
  } else {
121211
- resolve37(null);
121210
+ resolve38(null);
121212
121211
  }
121213
121212
  });
121214
121213
  } else {
121215
- this.on("close", resolve37);
121214
+ this.on("close", resolve38);
121216
121215
  }
121217
121216
  this.on("error", noop2).on("data", () => {
121218
121217
  if (this[kBytesRead] > limit) {
@@ -121240,7 +121239,7 @@ var require_readable = __commonJS({
121240
121239
  }
121241
121240
  function consume(stream, type) {
121242
121241
  assert(!stream[kConsume]);
121243
- return new Promise((resolve37, reject) => {
121242
+ return new Promise((resolve38, reject) => {
121244
121243
  if (isUnusable(stream)) {
121245
121244
  const rState = stream._readableState;
121246
121245
  if (rState.destroyed && rState.closeEmitted === false) {
@@ -121255,7 +121254,7 @@ var require_readable = __commonJS({
121255
121254
  stream[kConsume] = {
121256
121255
  type,
121257
121256
  stream,
121258
- resolve: resolve37,
121257
+ resolve: resolve38,
121259
121258
  reject,
121260
121259
  length: 0,
121261
121260
  body: []
@@ -121329,18 +121328,18 @@ var require_readable = __commonJS({
121329
121328
  return buffer2;
121330
121329
  }
121331
121330
  function consumeEnd(consume2, encoding) {
121332
- const { type, body, resolve: resolve37, stream, length: length4 } = consume2;
121331
+ const { type, body, resolve: resolve38, stream, length: length4 } = consume2;
121333
121332
  try {
121334
121333
  if (type === "text") {
121335
- resolve37(chunksDecode(body, length4, encoding));
121334
+ resolve38(chunksDecode(body, length4, encoding));
121336
121335
  } else if (type === "json") {
121337
- resolve37(JSON.parse(chunksDecode(body, length4, encoding)));
121336
+ resolve38(JSON.parse(chunksDecode(body, length4, encoding)));
121338
121337
  } else if (type === "arrayBuffer") {
121339
- resolve37(chunksConcat(body, length4).buffer);
121338
+ resolve38(chunksConcat(body, length4).buffer);
121340
121339
  } else if (type === "blob") {
121341
- resolve37(new Blob(body, { type: stream[kContentType] }));
121340
+ resolve38(new Blob(body, { type: stream[kContentType] }));
121342
121341
  } else if (type === "bytes") {
121343
- resolve37(chunksConcat(body, length4));
121342
+ resolve38(chunksConcat(body, length4));
121344
121343
  }
121345
121344
  consumeFinish(consume2);
121346
121345
  } catch (err) {
@@ -121530,9 +121529,9 @@ var require_api_request = __commonJS({
121530
121529
  };
121531
121530
  function request(opts, callback) {
121532
121531
  if (callback === void 0) {
121533
- return new Promise((resolve37, reject) => {
121532
+ return new Promise((resolve38, reject) => {
121534
121533
  request.call(this, opts, (err, data) => {
121535
- return err ? reject(err) : resolve37(data);
121534
+ return err ? reject(err) : resolve38(data);
121536
121535
  });
121537
121536
  });
121538
121537
  }
@@ -121744,9 +121743,9 @@ var require_api_stream = __commonJS({
121744
121743
  };
121745
121744
  function stream(opts, factory, callback) {
121746
121745
  if (callback === void 0) {
121747
- return new Promise((resolve37, reject) => {
121746
+ return new Promise((resolve38, reject) => {
121748
121747
  stream.call(this, opts, factory, (err, data) => {
121749
- return err ? reject(err) : resolve37(data);
121748
+ return err ? reject(err) : resolve38(data);
121750
121749
  });
121751
121750
  });
121752
121751
  }
@@ -122034,9 +122033,9 @@ var require_api_upgrade = __commonJS({
122034
122033
  };
122035
122034
  function upgrade(opts, callback) {
122036
122035
  if (callback === void 0) {
122037
- return new Promise((resolve37, reject) => {
122036
+ return new Promise((resolve38, reject) => {
122038
122037
  upgrade.call(this, opts, (err, data) => {
122039
- return err ? reject(err) : resolve37(data);
122038
+ return err ? reject(err) : resolve38(data);
122040
122039
  });
122041
122040
  });
122042
122041
  }
@@ -122129,9 +122128,9 @@ var require_api_connect = __commonJS({
122129
122128
  };
122130
122129
  function connect3(opts, callback) {
122131
122130
  if (callback === void 0) {
122132
- return new Promise((resolve37, reject) => {
122131
+ return new Promise((resolve38, reject) => {
122133
122132
  connect3.call(this, opts, (err, data) => {
122134
- return err ? reject(err) : resolve37(data);
122133
+ return err ? reject(err) : resolve38(data);
122135
122134
  });
122136
122135
  });
122137
122136
  }
@@ -123405,7 +123404,7 @@ var require_snapshot_recorder = __commonJS({
123405
123404
  "../node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
123406
123405
  "use strict";
123407
123406
  var { writeFile: writeFile21, readFile: readFile24, mkdir: mkdir16 } = __require("node:fs/promises");
123408
- var { dirname: dirname25, resolve: resolve37 } = __require("node:path");
123407
+ var { dirname: dirname26, resolve: resolve38 } = __require("node:path");
123409
123408
  var { setTimeout: setTimeout3, clearTimeout: clearTimeout3 } = __require("node:timers");
123410
123409
  var { InvalidArgumentError, UndiciError } = require_errors2();
123411
123410
  var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
@@ -123606,7 +123605,7 @@ var require_snapshot_recorder = __commonJS({
123606
123605
  throw new InvalidArgumentError("Snapshot path is required");
123607
123606
  }
123608
123607
  try {
123609
- const data = await readFile24(resolve37(path5), "utf8");
123608
+ const data = await readFile24(resolve38(path5), "utf8");
123610
123609
  const parsed = JSON.parse(data);
123611
123610
  if (Array.isArray(parsed)) {
123612
123611
  this.#snapshots.clear();
@@ -123635,8 +123634,8 @@ var require_snapshot_recorder = __commonJS({
123635
123634
  if (!path5) {
123636
123635
  throw new InvalidArgumentError("Snapshot path is required");
123637
123636
  }
123638
- const resolvedPath = resolve37(path5);
123639
- await mkdir16(dirname25(resolvedPath), { recursive: true });
123637
+ const resolvedPath = resolve38(path5);
123638
+ await mkdir16(dirname26(resolvedPath), { recursive: true });
123640
123639
  const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
123641
123640
  hash,
123642
123641
  snapshot
@@ -130477,7 +130476,7 @@ var require_fetch = __commonJS({
130477
130476
  const agent = fetchParams.controller.dispatcher;
130478
130477
  const path5 = url.pathname + url.search;
130479
130478
  const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
130480
- return new Promise((resolve37, reject) => agent.dispatch(
130479
+ return new Promise((resolve38, reject) => agent.dispatch(
130481
130480
  {
130482
130481
  path: hasTrailingQuestionMark ? `${path5}?` : path5,
130483
130482
  origin: url.origin,
@@ -130557,7 +130556,7 @@ var require_fetch = __commonJS({
130557
130556
  }
130558
130557
  }
130559
130558
  const onError = this.onError.bind(this);
130560
- resolve37({
130559
+ resolve38({
130561
130560
  status,
130562
130561
  statusText,
130563
130562
  headersList,
@@ -130610,7 +130609,7 @@ var require_fetch = __commonJS({
130610
130609
  headersList.append(headerName, String(value2), true);
130611
130610
  }
130612
130611
  }
130613
- resolve37({
130612
+ resolve38({
130614
130613
  status,
130615
130614
  statusText: STATUS_CODES2[status],
130616
130615
  headersList,
@@ -130626,7 +130625,7 @@ var require_fetch = __commonJS({
130626
130625
  for (let i2 = 0; i2 < rawHeaders.length; i2 += 2) {
130627
130626
  headersList.append(bufferToLowerCasedHeaderName(rawHeaders[i2]), rawHeaders[i2 + 1].toString("latin1"), true);
130628
130627
  }
130629
- resolve37({
130628
+ resolve38({
130630
130629
  status,
130631
130630
  statusText: STATUS_CODES2[status],
130632
130631
  headersList,
@@ -135228,7 +135227,7 @@ function toBytes(data) {
135228
135227
  throw new InvalidParametersError("Unsupported data type");
135229
135228
  }
135230
135229
  async function readResponse2(stream, options2) {
135231
- return new Promise((resolve37, reject) => {
135230
+ return new Promise((resolve38, reject) => {
135232
135231
  let readHeaders2 = false;
135233
135232
  const parser2 = new HTTPParser("RESPONSE");
135234
135233
  parser2[HTTPParser.kOnHeadersComplete] = (info) => {
@@ -135237,7 +135236,7 @@ async function readResponse2(stream, options2) {
135237
135236
  for (let i2 = 0; i2 < info.headers.length; i2 += 2) {
135238
135237
  headers.push([info.headers[i2], info.headers[i2 + 1]]);
135239
135238
  }
135240
- resolve37(new Response2(null, {
135239
+ resolve38(new Response2(null, {
135241
135240
  status: info.statusCode,
135242
135241
  statusText: info.statusMessage,
135243
135242
  headers: new Headers(headers)
@@ -209465,11 +209464,11 @@ var init_mdns = __esm({
209465
209464
  clearInterval(this._queryInterval);
209466
209465
  this._queryInterval = null;
209467
209466
  }
209468
- await new Promise((resolve37) => {
209467
+ await new Promise((resolve38) => {
209469
209468
  if (this.mdns != null) {
209470
- this.mdns.destroy(resolve37);
209469
+ this.mdns.destroy(resolve38);
209471
209470
  } else {
209472
- resolve37();
209471
+ resolve38();
209473
209472
  }
209474
209473
  });
209475
209474
  this.mdns = void 0;
@@ -210399,9 +210398,9 @@ var init_listener2 = __esm({
210399
210398
  return;
210400
210399
  }
210401
210400
  const netConfig = this.status.netConfig;
210402
- await new Promise((resolve37, reject) => {
210401
+ await new Promise((resolve38, reject) => {
210403
210402
  this.server.once("error", reject);
210404
- this.server.listen(netConfig, resolve37);
210403
+ this.server.listen(netConfig, resolve38);
210405
210404
  });
210406
210405
  this.status = { ...this.status, code: TCPListenerStatusCode.ACTIVE };
210407
210406
  this.log("listening on %s", this.server.address());
@@ -210494,7 +210493,7 @@ var init_tcp = __esm({
210494
210493
  options2.signal.throwIfAborted();
210495
210494
  options2.onProgress?.(new CustomProgressEvent("tcp:open-connection"));
210496
210495
  let rawSocket;
210497
- return new Promise((resolve37, reject) => {
210496
+ return new Promise((resolve38, reject) => {
210498
210497
  const start2 = Date.now();
210499
210498
  const cOpts = multiaddrToNetConfig(ma, {
210500
210499
  ...this.opts.dialOpts ?? {},
@@ -210536,7 +210535,7 @@ var init_tcp = __esm({
210536
210535
  reject(err);
210537
210536
  return;
210538
210537
  }
210539
- resolve37(rawSocket);
210538
+ resolve38(rawSocket);
210540
210539
  };
210541
210540
  rawSocket.on("error", onError);
210542
210541
  rawSocket.on("timeout", onTimeout);
@@ -214924,14 +214923,14 @@ ${key.data.toString("base64")}
214924
214923
  };
214925
214924
  var Pbkdf2Provider = class extends core__namespace.Pbkdf2Provider {
214926
214925
  async onDeriveBits(algorithm, baseKey, length4) {
214927
- return new Promise((resolve37, reject) => {
214926
+ return new Promise((resolve38, reject) => {
214928
214927
  const salt = core__namespace.BufferSourceConverter.toArrayBuffer(algorithm.salt);
214929
214928
  const hash = algorithm.hash.name.replace("-", "");
214930
214929
  crypto14.pbkdf2(getCryptoKey(baseKey).data, buffer2.Buffer.from(salt), algorithm.iterations, length4 >> 3, hash, (err, derivedBits) => {
214931
214930
  if (err) {
214932
214931
  reject(err);
214933
214932
  } else {
214934
- resolve37(new Uint8Array(derivedBits).buffer);
214933
+ resolve38(new Uint8Array(derivedBits).buffer);
214935
214934
  }
214936
214935
  });
214937
214936
  });
@@ -215621,7 +215620,7 @@ var init_tls = __esm({
215621
215620
  socket.emit("error", new HandshakeTimeoutError());
215622
215621
  };
215623
215622
  options2?.signal?.addEventListener("abort", onAbort);
215624
- return new Promise((resolve37, reject) => {
215623
+ return new Promise((resolve38, reject) => {
215625
215624
  const verifyRemote = () => {
215626
215625
  const remote = socket.getPeerCertificate();
215627
215626
  verifyPeerCertificate(remote.raw, options2?.remotePeer, log22).then((remotePeer) => {
@@ -215636,7 +215635,7 @@ var init_tls = __esm({
215636
215635
  reject(err);
215637
215636
  }
215638
215637
  }
215639
- resolve37({
215638
+ resolve38({
215640
215639
  remotePeer,
215641
215640
  connection: toMessageStream2(connection, socket),
215642
215641
  streamMuxer
@@ -221879,12 +221878,12 @@ var require_parser2 = __commonJS({
221879
221878
  };
221880
221879
  Parser2.prototype.parseStringPromise = function(str) {
221881
221880
  return new Promise(/* @__PURE__ */ (function(_this) {
221882
- return function(resolve37, reject) {
221881
+ return function(resolve38, reject) {
221883
221882
  return _this.parseString(str, function(err, value2) {
221884
221883
  if (err) {
221885
221884
  return reject(err);
221886
221885
  } else {
221887
- return resolve37(value2);
221886
+ return resolve38(value2);
221888
221887
  }
221889
221888
  });
221890
221889
  };
@@ -222210,7 +222209,7 @@ function initRequest(url, init2) {
222210
222209
  }
222211
222210
  }
222212
222211
  async function fetch3(url, init2 = {}) {
222213
- return new Promise((resolve37, reject) => {
222212
+ return new Promise((resolve38, reject) => {
222214
222213
  const request = initRequest(new URL(url), init2);
222215
222214
  if (init2.body != null) {
222216
222215
  request.write(init2.body);
@@ -222229,7 +222228,7 @@ async function fetch3(url, init2 = {}) {
222229
222228
  body += chunk.toString();
222230
222229
  });
222231
222230
  response.on("end", () => {
222232
- resolve37(body);
222231
+ resolve38(body);
222233
222232
  });
222234
222233
  response.on("error", (err) => {
222235
222234
  reject(err);
@@ -222377,7 +222376,7 @@ var init_broadcast_advert = __esm({
222377
222376
  // ../node_modules/freeport-promise/dist/src/index.js
222378
222377
  import { createServer } from "net";
222379
222378
  async function freeport() {
222380
- return await new Promise((resolve37, reject) => {
222379
+ return await new Promise((resolve38, reject) => {
222381
222380
  const server = createServer();
222382
222381
  let port = 0;
222383
222382
  server.once("listening", () => {
@@ -222392,7 +222391,7 @@ async function freeport() {
222392
222391
  server.close();
222393
222392
  });
222394
222393
  server.once("close", () => {
222395
- resolve37(port);
222394
+ resolve38(port);
222396
222395
  });
222397
222396
  server.once("error", reject);
222398
222397
  server.listen(0, "127.0.0.1");
@@ -222456,7 +222455,7 @@ async function createLocation(ssdp, advert) {
222456
222455
  advert.location = {};
222457
222456
  await Promise.all(ssdp.sockets.map(async (socket) => Promise.all(findAllInterfaces(socket.type === "udp4" && advert.ipv4, socket.type === "udp6" && advert.ipv6).map(async (iface) => {
222458
222457
  await freeport().then(async (port) => {
222459
- await new Promise((resolve37, reject) => {
222458
+ await new Promise((resolve38, reject) => {
222460
222459
  let location = "http://";
222461
222460
  if (socket.type === "udp6") {
222462
222461
  location += `[${iface.address}]`;
@@ -222470,7 +222469,7 @@ async function createLocation(ssdp, advert) {
222470
222469
  });
222471
222470
  const addr = socket.address();
222472
222471
  server.listen(port, addr.address, () => {
222473
- resolve37();
222472
+ resolve38();
222474
222473
  });
222475
222474
  server.on("error", (err) => {
222476
222475
  reject(err);
@@ -222480,9 +222479,9 @@ async function createLocation(ssdp, advert) {
222480
222479
  });
222481
222480
  }))));
222482
222481
  return async () => {
222483
- await Promise.all(servers.map(async (server) => new Promise((resolve37, reject) => {
222482
+ await Promise.all(servers.map(async (server) => new Promise((resolve38, reject) => {
222484
222483
  server.close();
222485
- resolve37();
222484
+ resolve38();
222486
222485
  })));
222487
222486
  };
222488
222487
  }
@@ -222675,10 +222674,10 @@ function parseAdvertOptions(ssdp, options2) {
222675
222674
  }, options2);
222676
222675
  const details = opts.details;
222677
222676
  opts.details = async () => {
222678
- return new Promise((resolve37, reject) => {
222677
+ return new Promise((resolve38, reject) => {
222679
222678
  try {
222680
222679
  const builder = new import_xml2js3.default.Builder();
222681
- resolve37(builder.buildObject(details));
222680
+ resolve38(builder.buildObject(details));
222682
222681
  } catch (error) {
222683
222682
  reject(error);
222684
222683
  }
@@ -222757,7 +222756,7 @@ import { createSocket } from "node:dgram";
222757
222756
  async function createSockets(ssdp, signal) {
222758
222757
  const sockets = [];
222759
222758
  await Promise.allSettled((ssdp.options.sockets ?? []).map(async (options2) => {
222760
- return new Promise((resolve37, reject) => {
222759
+ return new Promise((resolve38, reject) => {
222761
222760
  const socket = createSocket({
222762
222761
  type: options2.type ?? "udp4",
222763
222762
  ipv6Only: options2.type === "udp6",
@@ -222781,7 +222780,7 @@ async function createSockets(ssdp, signal) {
222781
222780
  socket.setMulticastTTL(options2.maxHops);
222782
222781
  }
222783
222782
  sockets.push(socket);
222784
- resolve37();
222783
+ resolve38();
222785
222784
  } catch (error) {
222786
222785
  error.message = `Adding membership ${options2.broadcast?.address} failed - ${error.message}`;
222787
222786
  reject(error);
@@ -222946,14 +222945,14 @@ var init_utils37 = __esm({
222946
222945
  // ../node_modules/@achingbrain/ssdp/dist/src/send-ssdp-message.js
222947
222946
  function sendSsdpMessage(ssdp, status, headers, remote) {
222948
222947
  Promise.all(ssdp.sockets.map(async (socket) => {
222949
- await new Promise((resolve37, reject) => {
222948
+ await new Promise((resolve38, reject) => {
222950
222949
  if (socket.closed) {
222951
- resolve37();
222950
+ resolve38();
222952
222951
  return;
222953
222952
  }
222954
222953
  const recipient = remote ?? socket.options.broadcast;
222955
222954
  if (recipient != null && addressFamilyMismatch(recipient, socket)) {
222956
- resolve37();
222955
+ resolve38();
222957
222956
  return;
222958
222957
  }
222959
222958
  if (headers.LOCATION != null) {
@@ -222978,7 +222977,7 @@ function sendSsdpMessage(ssdp, status, headers, remote) {
222978
222977
  reject(error);
222979
222978
  return;
222980
222979
  }
222981
- resolve37();
222980
+ resolve38();
222982
222981
  });
222983
222982
  });
222984
222983
  })).catch((err) => {
@@ -223035,9 +223034,9 @@ var init_ssdp = __esm({
223035
223034
  async stop() {
223036
223035
  await adverts.stopAll();
223037
223036
  await Promise.all(this.sockets.map(async (socket) => {
223038
- await new Promise((resolve37) => {
223037
+ await new Promise((resolve38) => {
223039
223038
  socket.on("close", () => {
223040
- resolve37();
223039
+ resolve38();
223041
223040
  });
223042
223041
  socket.close();
223043
223042
  socket.closed = true;
@@ -225628,12 +225627,12 @@ var init_RTCSctpTransport = __esm({
225628
225627
 
225629
225628
  // ../node_modules/node-datachannel/dist/esm/polyfill/RTCPeerConnection.mjs
225630
225629
  function createDeferredPromise() {
225631
- let resolve37, reject;
225630
+ let resolve38, reject;
225632
225631
  const promise = new Promise(function(_resolve, _reject) {
225633
- resolve37 = _resolve;
225632
+ resolve38 = _resolve;
225634
225633
  reject = _reject;
225635
225634
  });
225636
- promise.resolve = resolve37;
225635
+ promise.resolve = resolve38;
225637
225636
  promise.reject = reject;
225638
225637
  return promise;
225639
225638
  }
@@ -225950,14 +225949,14 @@ var init_RTCPeerConnection = __esm({
225950
225949
  throw new DOMException("Not implemented");
225951
225950
  }
225952
225951
  getStats() {
225953
- return new Promise((resolve37) => {
225952
+ return new Promise((resolve38) => {
225954
225953
  const report = /* @__PURE__ */ new Map();
225955
225954
  const cp2 = __privateGet9(this, _peerConnection)?.getSelectedCandidatePair();
225956
225955
  const bytesSent = __privateGet9(this, _peerConnection)?.bytesSent();
225957
225956
  const bytesReceived = __privateGet9(this, _peerConnection)?.bytesReceived();
225958
225957
  const rtt = __privateGet9(this, _peerConnection)?.rtt();
225959
225958
  if (!cp2) {
225960
- return resolve37(report);
225959
+ return resolve38(report);
225961
225960
  }
225962
225961
  const localIdRs = getRandomString(8);
225963
225962
  const localId = "RTCIceCandidate_" + localIdRs;
@@ -226012,7 +226011,7 @@ var init_RTCPeerConnection = __esm({
226012
226011
  dataChannelsOpened: __privateGet9(this, _dataChannels).size,
226013
226012
  dataChannelsClosed: __privateGet9(this, _dataChannelsClosed)
226014
226013
  });
226015
- return resolve37(report);
226014
+ return resolve38(report);
226016
226015
  });
226017
226016
  }
226018
226017
  getTransceivers() {
@@ -226843,14 +226842,14 @@ var init_get_port = __esm({
226843
226842
  }
226844
226843
  return results;
226845
226844
  };
226846
- checkAvailablePort = (options2) => new Promise((resolve37, reject) => {
226845
+ checkAvailablePort = (options2) => new Promise((resolve38, reject) => {
226847
226846
  const server = net3.createServer();
226848
226847
  server.unref();
226849
226848
  server.on("error", reject);
226850
226849
  server.listen(options2, () => {
226851
226850
  const { port } = server.address();
226852
226851
  server.close(() => {
226853
- resolve37(port);
226852
+ resolve38(port);
226854
226853
  });
226855
226854
  });
226856
226855
  });
@@ -226923,12 +226922,12 @@ var resolveValue, sleep, validateOptions, createTimeoutError, handleFallback, ha
226923
226922
  var init_p_wait_for = __esm({
226924
226923
  "../node_modules/p-wait-for/index.js"() {
226925
226924
  resolveValue = /* @__PURE__ */ Symbol("resolveValue");
226926
- sleep = (ms, signal) => new Promise((resolve37, reject) => {
226925
+ sleep = (ms, signal) => new Promise((resolve38, reject) => {
226927
226926
  if (signal?.aborted) {
226928
226927
  reject(signal.reason);
226929
226928
  return;
226930
226929
  }
226931
- const timeout2 = setTimeout(resolve37, ms);
226930
+ const timeout2 = setTimeout(resolve38, ms);
226932
226931
  if (signal) {
226933
226932
  signal.addEventListener("abort", () => {
226934
226933
  clearTimeout(timeout2);
@@ -231902,10 +231901,10 @@ var init_listener5 = __esm({
231902
231901
  ...config,
231903
231902
  ipv6Only: config.type === "ip6"
231904
231903
  });
231905
- await new Promise((resolve37, reject) => {
231904
+ await new Promise((resolve38, reject) => {
231906
231905
  const onListening = () => {
231907
231906
  removeListeners();
231908
- resolve37();
231907
+ resolve38();
231909
231908
  };
231910
231909
  const onError = (err) => {
231911
231910
  this.metrics.errors?.increment({ [`${this.addr} listen_error`]: true });
@@ -237298,15 +237297,15 @@ var init_ls = __esm({
237298
237297
  });
237299
237298
 
237300
237299
  // ../node_modules/@helia/unixfs/dist/src/commands/mkdir.js
237301
- async function mkdir5(parentCid, dirname25, blockstore, options2 = {}) {
237302
- if (dirname25.includes("/")) {
237300
+ async function mkdir5(parentCid, dirname26, blockstore, options2 = {}) {
237301
+ if (dirname26.includes("/")) {
237303
237302
  throw new InvalidParametersError4("Path must not have slashes");
237304
237303
  }
237305
237304
  const entry = await exporter2(parentCid, blockstore, options2);
237306
237305
  if (entry.type !== "directory") {
237307
237306
  throw new NotADirectoryError(`${parentCid.toString()} was not a UnixFS directory`);
237308
237307
  }
237309
- log16("creating %s", dirname25);
237308
+ log16("creating %s", dirname26);
237310
237309
  const metadata = new UnixFS({
237311
237310
  type: "directory",
237312
237311
  mode: options2.mode,
@@ -237322,9 +237321,9 @@ async function mkdir5(parentCid, dirname25, blockstore, options2 = {}) {
237322
237321
  await blockstore.put(emptyDirCid, buf);
237323
237322
  const [directory, pblink] = await Promise.all([
237324
237323
  cidToDirectory(parentCid, blockstore, options2),
237325
- cidToPBLink(emptyDirCid, dirname25, blockstore, options2)
237324
+ cidToPBLink(emptyDirCid, dirname26, blockstore, options2)
237326
237325
  ]);
237327
- log16("adding empty dir called %s to %c", dirname25, parentCid);
237326
+ log16("adding empty dir called %s to %c", dirname26, parentCid);
237328
237327
  const result = await addLink(directory, pblink, blockstore, {
237329
237328
  ...options2,
237330
237329
  allowOverwriting: options2.force
@@ -237823,8 +237822,8 @@ var init_unixfs2 = __esm({
237823
237822
  async *ls(cid, options2 = {}) {
237824
237823
  yield* ls(cid, this.components.blockstore, options2);
237825
237824
  }
237826
- async mkdir(cid, dirname25, options2 = {}) {
237827
- return mkdir5(cid, dirname25, this.components.blockstore, options2);
237825
+ async mkdir(cid, dirname26, options2 = {}) {
237826
+ return mkdir5(cid, dirname26, this.components.blockstore, options2);
237828
237827
  }
237829
237828
  async rm(cid, path5, options2 = {}) {
237830
237829
  return rm2(cid, path5, this.components.blockstore, options2);
@@ -242365,41 +242364,41 @@ var require_queue = __commonJS({
242365
242364
  queue.drained = drained;
242366
242365
  return queue;
242367
242366
  function push(value2) {
242368
- var p2 = new Promise(function(resolve37, reject) {
242367
+ var p2 = new Promise(function(resolve38, reject) {
242369
242368
  pushCb(value2, function(err, result) {
242370
242369
  if (err) {
242371
242370
  reject(err);
242372
242371
  return;
242373
242372
  }
242374
- resolve37(result);
242373
+ resolve38(result);
242375
242374
  });
242376
242375
  });
242377
242376
  p2.catch(noop2);
242378
242377
  return p2;
242379
242378
  }
242380
242379
  function unshift(value2) {
242381
- var p2 = new Promise(function(resolve37, reject) {
242380
+ var p2 = new Promise(function(resolve38, reject) {
242382
242381
  unshiftCb(value2, function(err, result) {
242383
242382
  if (err) {
242384
242383
  reject(err);
242385
242384
  return;
242386
242385
  }
242387
- resolve37(result);
242386
+ resolve38(result);
242388
242387
  });
242389
242388
  });
242390
242389
  p2.catch(noop2);
242391
242390
  return p2;
242392
242391
  }
242393
242392
  function drained() {
242394
- var p2 = new Promise(function(resolve37) {
242393
+ var p2 = new Promise(function(resolve38) {
242395
242394
  process.nextTick(function() {
242396
242395
  if (queue.idle()) {
242397
- resolve37();
242396
+ resolve38();
242398
242397
  } else {
242399
242398
  var previousDrain = queue.drain;
242400
242399
  queue.drain = function() {
242401
242400
  if (typeof previousDrain === "function") previousDrain();
242402
- resolve37();
242401
+ resolve38();
242403
242402
  queue.drain = previousDrain;
242404
242403
  };
242405
242404
  }
@@ -242885,9 +242884,9 @@ var require_stream4 = __commonJS({
242885
242884
  });
242886
242885
  }
242887
242886
  _getStat(filepath) {
242888
- return new Promise((resolve37, reject) => {
242887
+ return new Promise((resolve38, reject) => {
242889
242888
  this._stat(filepath, this._fsStatSettings, (error, stats) => {
242890
- return error === null ? resolve37(stats) : reject(error);
242889
+ return error === null ? resolve38(stats) : reject(error);
242891
242890
  });
242892
242891
  });
242893
242892
  }
@@ -242911,10 +242910,10 @@ var require_async6 = __commonJS({
242911
242910
  this._readerStream = new stream_1.default(this._settings);
242912
242911
  }
242913
242912
  dynamic(root, options2) {
242914
- return new Promise((resolve37, reject) => {
242913
+ return new Promise((resolve38, reject) => {
242915
242914
  this._walkAsync(root, options2, (error, entries) => {
242916
242915
  if (error === null) {
242917
- resolve37(entries);
242916
+ resolve38(entries);
242918
242917
  } else {
242919
242918
  reject(error);
242920
242919
  }
@@ -242924,10 +242923,10 @@ var require_async6 = __commonJS({
242924
242923
  async static(patterns, options2) {
242925
242924
  const entries = [];
242926
242925
  const stream = this._readerStream.static(patterns, options2);
242927
- return new Promise((resolve37, reject) => {
242926
+ return new Promise((resolve38, reject) => {
242928
242927
  stream.once("error", reject);
242929
242928
  stream.on("data", (entry) => entries.push(entry));
242930
- stream.once("end", () => resolve37(entries));
242929
+ stream.once("end", () => resolve38(entries));
242931
242930
  });
242932
242931
  }
242933
242932
  };
@@ -243769,7 +243768,7 @@ async function retryAsyncOperation(fn, maxRetries, delayMs) {
243769
243768
  return await fn();
243770
243769
  } catch (error) {
243771
243770
  if (i2 < maxRetries - 1) {
243772
- await new Promise((resolve37) => setTimeout(resolve37, delayMs));
243771
+ await new Promise((resolve38) => setTimeout(resolve38, delayMs));
243773
243772
  } else {
243774
243773
  throw error;
243775
243774
  }
@@ -243790,11 +243789,11 @@ var init_lib3 = __esm({
243790
243789
  // File is locked, add data for later
243791
243790
  #add(data) {
243792
243791
  this.#nextData = data;
243793
- this.#nextPromise ||= new Promise((resolve37, reject) => {
243794
- this.#next = [resolve37, reject];
243792
+ this.#nextPromise ||= new Promise((resolve38, reject) => {
243793
+ this.#next = [resolve38, reject];
243795
243794
  });
243796
- return new Promise((resolve37, reject) => {
243797
- this.#nextPromise?.then(resolve37).catch(reject);
243795
+ return new Promise((resolve38, reject) => {
243796
+ this.#nextPromise?.then(resolve38).catch(reject);
243798
243797
  });
243799
243798
  }
243800
243799
  // File isn't locked, write data
@@ -244325,7 +244324,7 @@ Justification: ${justification || "(none provided)"}`,
244325
244324
  })();
244326
244325
  const ipfsResult = await Promise.race([
244327
244326
  ipfsPromise,
244328
- new Promise((resolve37) => setTimeout(() => resolve37(null), 2e3))
244327
+ new Promise((resolve38) => setTimeout(() => resolve38(null), 2e3))
244329
244328
  ]);
244330
244329
  if (ipfsResult && ipfsResult.success) {
244331
244330
  const cidData = JSON.parse(ipfsResult.output);
@@ -244846,7 +244845,7 @@ print("__OA_REPL_READY__")
244846
244845
  return;
244847
244846
  const sockId = randomBytes8(8).toString("hex");
244848
244847
  this.ipcPath = join23(tmpdir3(), `oa-repl-ipc-${sockId}.sock`);
244849
- return new Promise((resolve37, reject) => {
244848
+ return new Promise((resolve38, reject) => {
244850
244849
  this.ipcServer = createServer2((conn) => {
244851
244850
  let buffer2 = new Uint8Array(0);
244852
244851
  conn.on("data", (chunk) => {
@@ -244862,7 +244861,7 @@ print("__OA_REPL_READY__")
244862
244861
  });
244863
244862
  });
244864
244863
  this.ipcServer.on("error", reject);
244865
- this.ipcServer.listen(this.ipcPath, () => resolve37());
244864
+ this.ipcServer.listen(this.ipcPath, () => resolve38());
244866
244865
  });
244867
244866
  }
244868
244867
  async processIpcBuffer(conn, input) {
@@ -244925,9 +244924,9 @@ print("__OA_REPL_READY__")
244925
244924
  }
244926
244925
  // ── Code execution ─────────────────────────────────────────────────────
244927
244926
  executeCode(code8, isInit = false) {
244928
- return new Promise((resolve37) => {
244927
+ return new Promise((resolve38) => {
244929
244928
  if (!this.proc?.stdin || !this.proc?.stdout || !this.proc?.stderr) {
244930
- resolve37({ success: false, output: "REPL process not available", error: "No process", durationMs: 0 });
244929
+ resolve38({ success: false, output: "REPL process not available", error: "No process", durationMs: 0 });
244931
244930
  return;
244932
244931
  }
244933
244932
  const sentinel = `__OA_SENTINEL_${randomBytes8(6).toString("hex")}__`;
@@ -244937,7 +244936,7 @@ print("__OA_REPL_READY__")
244937
244936
  const timeout2 = setTimeout(() => {
244938
244937
  if (!resolved) {
244939
244938
  resolved = true;
244940
- resolve37({
244939
+ resolve38({
244941
244940
  success: false,
244942
244941
  output: stdout || "Execution timed out",
244943
244942
  error: `Timeout after ${this.execTimeout / 1e3}s`,
@@ -244954,13 +244953,13 @@ print("__OA_REPL_READY__")
244954
244953
  if (isInit) {
244955
244954
  const ready = cleanOutput.includes("__OA_REPL_READY__");
244956
244955
  const displayOutput = cleanOutput.replace("__OA_REPL_READY__", "").trim();
244957
- resolve37({
244956
+ resolve38({
244958
244957
  success: ready,
244959
244958
  output: displayOutput || "REPL initialized",
244960
244959
  durationMs: 0
244961
244960
  });
244962
244961
  } else {
244963
- resolve37({
244962
+ resolve38({
244964
244963
  success: true,
244965
244964
  output: cleanOutput || "(no output)",
244966
244965
  durationMs: 0
@@ -244969,7 +244968,7 @@ print("__OA_REPL_READY__")
244969
244968
  }
244970
244969
  if (stdout.length > 2e5) {
244971
244970
  cleanup();
244972
- resolve37({
244971
+ resolve38({
244973
244972
  success: true,
244974
244973
  output: stdout.slice(0, 2e5) + "\n[output truncated at 200KB]",
244975
244974
  durationMs: 0
@@ -245068,9 +245067,9 @@ print("${sentinel}")
245068
245067
  if (!this.proc || this.proc.killed) {
245069
245068
  return { success: false, path: "" };
245070
245069
  }
245071
- const { mkdirSync: mkdirSync34, writeFileSync: writeFileSync32 } = await import("node:fs");
245070
+ const { mkdirSync: mkdirSync35, writeFileSync: writeFileSync33 } = await import("node:fs");
245072
245071
  const sessionDir = join23(this.cwd, ".oa", "rlm");
245073
- mkdirSync34(sessionDir, { recursive: true });
245072
+ mkdirSync35(sessionDir, { recursive: true });
245074
245073
  const sessionPath = join23(sessionDir, "session.json");
245075
245074
  try {
245076
245075
  const inspectCode = `
@@ -245094,7 +245093,7 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
245094
245093
  trajectoryCount: this.trajectory.length,
245095
245094
  subCallCount: this.subCallCount
245096
245095
  };
245097
- writeFileSync32(sessionPath, JSON.stringify(sessionData, null, 2), "utf8");
245096
+ writeFileSync33(sessionPath, JSON.stringify(sessionData, null, 2), "utf8");
245098
245097
  return { success: true, path: sessionPath };
245099
245098
  }
245100
245099
  } catch {
@@ -245106,9 +245105,9 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
245106
245105
  * what was previously computed. */
245107
245106
  async loadSessionInfo() {
245108
245107
  try {
245109
- const { readFileSync: readFileSync49, existsSync: existsSync61 } = await import("node:fs");
245108
+ const { readFileSync: readFileSync49, existsSync: existsSync62 } = await import("node:fs");
245110
245109
  const sessionPath = join23(this.cwd, ".oa", "rlm", "session.json");
245111
- if (!existsSync61(sessionPath))
245110
+ if (!existsSync62(sessionPath))
245112
245111
  return null;
245113
245112
  return JSON.parse(readFileSync49(sessionPath, "utf8"));
245114
245113
  } catch {
@@ -245674,10 +245673,10 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
245674
245673
  * Optionally filter by task type for phase-aware context (FSM paper insight).
245675
245674
  */
245676
245675
  getTopMemoriesSync(k = 5, taskType) {
245677
- const { readFileSync: readFileSync49, existsSync: existsSync61 } = __require("node:fs");
245676
+ const { readFileSync: readFileSync49, existsSync: existsSync62 } = __require("node:fs");
245678
245677
  const metaDir = join24(this.cwd, ".oa", "memory", "metabolism");
245679
245678
  const storeFile = join24(metaDir, "store.json");
245680
- if (!existsSync61(storeFile))
245679
+ if (!existsSync62(storeFile))
245681
245680
  return "";
245682
245681
  let store2 = [];
245683
245682
  try {
@@ -245703,10 +245702,10 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
245703
245702
  /** Update memory scores based on task outcome. Called after task completion.
245704
245703
  * Memories used in successful tasks get boosted. Memories present during failures get decayed. */
245705
245704
  updateFromOutcomeSync(surfacedMemoryText, succeeded) {
245706
- const { readFileSync: readFileSync49, writeFileSync: writeFileSync32, existsSync: existsSync61, mkdirSync: mkdirSync34 } = __require("node:fs");
245705
+ const { readFileSync: readFileSync49, writeFileSync: writeFileSync33, existsSync: existsSync62, mkdirSync: mkdirSync35 } = __require("node:fs");
245707
245706
  const metaDir = join24(this.cwd, ".oa", "memory", "metabolism");
245708
245707
  const storeFile = join24(metaDir, "store.json");
245709
- if (!existsSync61(storeFile))
245708
+ if (!existsSync62(storeFile))
245710
245709
  return;
245711
245710
  let store2 = [];
245712
245711
  try {
@@ -245734,8 +245733,8 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
245734
245733
  updated = true;
245735
245734
  }
245736
245735
  if (updated) {
245737
- mkdirSync34(metaDir, { recursive: true });
245738
- writeFileSync32(storeFile, JSON.stringify(store2, null, 2));
245736
+ mkdirSync35(metaDir, { recursive: true });
245737
+ writeFileSync33(storeFile, JSON.stringify(store2, null, 2));
245739
245738
  }
245740
245739
  }
245741
245740
  // ── Storage ──────────────────────────────────────────────────────────
@@ -246157,9 +246156,9 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
246157
246156
  // Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
246158
246157
  /** Retrieve top-K strategies for context injection. Returns "" if none. */
246159
246158
  getRelevantStrategiesSync(k = 3, taskType) {
246160
- const { readFileSync: readFileSync49, existsSync: existsSync61 } = __require("node:fs");
246159
+ const { readFileSync: readFileSync49, existsSync: existsSync62 } = __require("node:fs");
246161
246160
  const archiveFile = join26(this.cwd, ".oa", "arche", "variants.json");
246162
- if (!existsSync61(archiveFile))
246161
+ if (!existsSync62(archiveFile))
246163
246162
  return "";
246164
246163
  let variants = [];
246165
246164
  try {
@@ -246181,12 +246180,12 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
246181
246180
  }
246182
246181
  /** Archive a strategy variant synchronously (for task completion path) */
246183
246182
  archiveVariantSync(strategy, outcome, tags = []) {
246184
- const { readFileSync: readFileSync49, writeFileSync: writeFileSync32, existsSync: existsSync61, mkdirSync: mkdirSync34 } = __require("node:fs");
246183
+ const { readFileSync: readFileSync49, writeFileSync: writeFileSync33, existsSync: existsSync62, mkdirSync: mkdirSync35 } = __require("node:fs");
246185
246184
  const dir = join26(this.cwd, ".oa", "arche");
246186
246185
  const archiveFile = join26(dir, "variants.json");
246187
246186
  let variants = [];
246188
246187
  try {
246189
- if (existsSync61(archiveFile))
246188
+ if (existsSync62(archiveFile))
246190
246189
  variants = JSON.parse(readFileSync49(archiveFile, "utf8"));
246191
246190
  } catch {
246192
246191
  }
@@ -246202,8 +246201,8 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
246202
246201
  });
246203
246202
  if (variants.length > 50)
246204
246203
  variants = variants.slice(-50);
246205
- mkdirSync34(dir, { recursive: true });
246206
- writeFileSync32(archiveFile, JSON.stringify(variants, null, 2));
246204
+ mkdirSync35(dir, { recursive: true });
246205
+ writeFileSync33(archiveFile, JSON.stringify(variants, null, 2));
246207
246206
  }
246208
246207
  async saveArchive(variants) {
246209
246208
  const dir = join26(this.cwd, ".oa", "arche");
@@ -247167,9 +247166,9 @@ var init_vision = __esm({
247167
247166
  if (ollamaResult)
247168
247167
  return ollamaResult;
247169
247168
  try {
247170
- const { execSync: execSync36 } = await import("node:child_process");
247169
+ const { execSync: execSync37 } = await import("node:child_process");
247171
247170
  try {
247172
- execSync36("pip3 install --user moondream 2>/dev/null || pip install --user moondream 2>/dev/null", {
247171
+ execSync37("pip3 install --user moondream 2>/dev/null || pip install --user moondream 2>/dev/null", {
247173
247172
  timeout: 12e4,
247174
247173
  stdio: "pipe"
247175
247174
  });
@@ -247182,7 +247181,7 @@ var init_vision = __esm({
247182
247181
  } catch {
247183
247182
  }
247184
247183
  try {
247185
- execSync36("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
247184
+ execSync37("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
247186
247185
  const retryOllama = await this.tryOllamaVision(buffer2, filename, action, prompt, length4, start2);
247187
247186
  if (retryOllama)
247188
247187
  return retryOllama;
@@ -247290,8 +247289,8 @@ Coordinates are normalized (0-1). Multiply by image width/height for pixel value
247290
247289
  const errText = await res.text().catch(() => "");
247291
247290
  if (res.status === 404 || /not found|does not exist/i.test(errText)) {
247292
247291
  try {
247293
- const { execSync: execSync36 } = await import("node:child_process");
247294
- execSync36("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
247292
+ const { execSync: execSync37 } = await import("node:child_process");
247293
+ execSync37("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
247295
247294
  res = await fetch(`${ollamaHost}/api/generate`, {
247296
247295
  method: "POST",
247297
247296
  headers: { "Content-Type": "application/json" },
@@ -253449,7 +253448,7 @@ import { spawn as spawn14 } from "node:child_process";
253449
253448
  async function runShell(options2) {
253450
253449
  const { command, args = [], cwd: cwd4, env: env2, timeoutMs = DEFAULT_TIMEOUT_MS } = options2;
253451
253450
  const mergedEnv = env2 ? { ...process.env, ...env2 } : process.env;
253452
- return new Promise((resolve37) => {
253451
+ return new Promise((resolve38) => {
253453
253452
  const start2 = Date.now();
253454
253453
  let timedOut = false;
253455
253454
  const child = spawn14(command, args, {
@@ -253473,7 +253472,7 @@ async function runShell(options2) {
253473
253472
  clearTimeout(timer);
253474
253473
  const durationMs = Date.now() - start2;
253475
253474
  const exitCode = timedOut ? -1 : code8 ?? -1;
253476
- resolve37({
253475
+ resolve38({
253477
253476
  stdout,
253478
253477
  stderr,
253479
253478
  exitCode,
@@ -253485,7 +253484,7 @@ async function runShell(options2) {
253485
253484
  child.on("error", (err) => {
253486
253485
  clearTimeout(timer);
253487
253486
  const durationMs = Date.now() - start2;
253488
- resolve37({
253487
+ resolve38({
253489
253488
  stdout,
253490
253489
  stderr: stderr + err.message,
253491
253490
  exitCode: -1,
@@ -253600,7 +253599,7 @@ async function applyUnifiedDiff(patch) {
253600
253599
  }
253601
253600
  function runWithStdin(options2) {
253602
253601
  const { command, args, cwd: cwd4, stdin } = options2;
253603
- return new Promise((resolve37) => {
253602
+ return new Promise((resolve38) => {
253604
253603
  const child = spawn15(command, args, {
253605
253604
  cwd: cwd4,
253606
253605
  stdio: ["pipe", "pipe", "pipe"]
@@ -253617,10 +253616,10 @@ function runWithStdin(options2) {
253617
253616
  child.stdin.end();
253618
253617
  child.on("close", (code8) => {
253619
253618
  const exitCode = code8 ?? -1;
253620
- resolve37({ success: exitCode === 0, exitCode, stdout, stderr });
253619
+ resolve38({ success: exitCode === 0, exitCode, stdout, stderr });
253621
253620
  });
253622
253621
  child.on("error", (err) => {
253623
- resolve37({ success: false, exitCode: -1, stdout, stderr: err.message });
253622
+ resolve38({ success: false, exitCode: -1, stdout, stderr: err.message });
253624
253623
  });
253625
253624
  });
253626
253625
  }
@@ -257496,8 +257495,8 @@ ${this.options.dynamicContext}`,
257496
257495
  async waitIfPaused() {
257497
257496
  if (!this._paused)
257498
257497
  return true;
257499
- await new Promise((resolve37) => {
257500
- this._pauseResolve = resolve37;
257498
+ await new Promise((resolve38) => {
257499
+ this._pauseResolve = resolve38;
257501
257500
  });
257502
257501
  return !this.aborted;
257503
257502
  }
@@ -258776,14 +258775,14 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
258776
258775
  waitForSudoPassword(timeoutMs = 12e4) {
258777
258776
  if (this._sudoPassword)
258778
258777
  return Promise.resolve(this._sudoPassword);
258779
- return new Promise((resolve37) => {
258778
+ return new Promise((resolve38) => {
258780
258779
  const timer = setTimeout(() => {
258781
258780
  this._sudoResolve = null;
258782
- resolve37(null);
258781
+ resolve38(null);
258783
258782
  }, timeoutMs);
258784
258783
  this._sudoResolve = (pw) => {
258785
258784
  clearTimeout(timer);
258786
- resolve37(pw);
258785
+ resolve38(pw);
258787
258786
  };
258788
258787
  });
258789
258788
  }
@@ -258916,10 +258915,10 @@ ${marker}` : marker);
258916
258915
  if (!this._workingDirectory)
258917
258916
  return;
258918
258917
  try {
258919
- const { mkdirSync: mkdirSync34, writeFileSync: writeFileSync32 } = __require("node:fs");
258920
- const { join: join82 } = __require("node:path");
258921
- const sessionDir = join82(this._workingDirectory, ".oa", "session", this._sessionId);
258922
- mkdirSync34(sessionDir, { recursive: true });
258918
+ const { mkdirSync: mkdirSync35, writeFileSync: writeFileSync33 } = __require("node:fs");
258919
+ const { join: join83 } = __require("node:path");
258920
+ const sessionDir = join83(this._workingDirectory, ".oa", "session", this._sessionId);
258921
+ mkdirSync35(sessionDir, { recursive: true });
258923
258922
  const checkpoint = {
258924
258923
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
258925
258924
  sessionId: this._sessionId,
@@ -258931,7 +258930,7 @@ ${marker}` : marker);
258931
258930
  memexEntryCount: this._memexArchive.size,
258932
258931
  fileRegistrySize: this._fileRegistry.size
258933
258932
  };
258934
- writeFileSync32(join82(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
258933
+ writeFileSync33(join83(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
258935
258934
  } catch {
258936
258935
  }
258937
258936
  }
@@ -260068,17 +260067,17 @@ ${transcript}`
260068
260067
  const buffer2 = Buffer.from(rawBase64, "base64");
260069
260068
  let resizedBase64 = null;
260070
260069
  try {
260071
- const { execSync: execSync36 } = await import("node:child_process");
260072
- const { writeFileSync: writeFileSync32, readFileSync: readFileSync49, unlinkSync: unlinkSync13 } = await import("node:fs");
260073
- const { join: join82 } = await import("node:path");
260070
+ const { execSync: execSync37 } = await import("node:child_process");
260071
+ const { writeFileSync: writeFileSync33, readFileSync: readFileSync49, unlinkSync: unlinkSync13 } = await import("node:fs");
260072
+ const { join: join83 } = await import("node:path");
260074
260073
  const { tmpdir: tmpdir11 } = await import("node:os");
260075
- const tmpIn = join82(tmpdir11(), `oa_img_in_${Date.now()}.png`);
260076
- const tmpOut = join82(tmpdir11(), `oa_img_out_${Date.now()}.jpg`);
260077
- writeFileSync32(tmpIn, buffer2);
260074
+ const tmpIn = join83(tmpdir11(), `oa_img_in_${Date.now()}.png`);
260075
+ const tmpOut = join83(tmpdir11(), `oa_img_out_${Date.now()}.jpg`);
260076
+ writeFileSync33(tmpIn, buffer2);
260078
260077
  const pyBin = process.platform === "win32" ? "python" : "python3";
260079
260078
  const escapedIn = tmpIn.replace(/\\/g, "\\\\");
260080
260079
  const escapedOut = tmpOut.replace(/\\/g, "\\\\");
260081
- execSync36(`${pyBin} -c "from PIL import Image; img = Image.open('${escapedIn}'); img.thumbnail((512, 512), Image.LANCZOS); img = img.convert('RGB'); img.save('${escapedOut}', 'JPEG', quality=75)"`, { timeout: 1e4, stdio: "pipe" });
260080
+ execSync37(`${pyBin} -c "from PIL import Image; img = Image.open('${escapedIn}'); img.thumbnail((512, 512), Image.LANCZOS); img = img.convert('RGB'); img.save('${escapedOut}', 'JPEG', quality=75)"`, { timeout: 1e4, stdio: "pipe" });
260082
260081
  const resizedBuf = readFileSync49(tmpOut);
260083
260082
  resizedBase64 = `data:image/jpeg;base64,${resizedBuf.toString("base64")}`;
260084
260083
  try {
@@ -260132,8 +260131,8 @@ ${transcript}`
260132
260131
  if (!res.ok && model === "moondream" && res.status === 404) {
260133
260132
  this.emit({ type: "status", content: `Pulling moondream vision model...`, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
260134
260133
  try {
260135
- const { execSync: execSync36 } = await import("node:child_process");
260136
- execSync36("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
260134
+ const { execSync: execSync37 } = await import("node:child_process");
260135
+ execSync37("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
260137
260136
  res = await fetch(`${ollamaHost}/api/generate`, {
260138
260137
  method: "POST",
260139
260138
  headers: { "Content-Type": "application/json" },
@@ -260907,12 +260906,12 @@ var init_nexusBackend = __esm({
260907
260906
  const deadline = Date.now() + (request.timeoutMs ?? 12e4);
260908
260907
  try {
260909
260908
  while (!done && Date.now() < deadline) {
260910
- await new Promise((resolve37) => {
260909
+ await new Promise((resolve38) => {
260911
260910
  let resolved = false;
260912
260911
  const finish = () => {
260913
260912
  if (!resolved) {
260914
260913
  resolved = true;
260915
- resolve37();
260914
+ resolve38();
260916
260915
  }
260917
260916
  };
260918
260917
  let watcher = null;
@@ -261996,9 +261995,9 @@ function ensureTranscribeCliBackground() {
261996
261995
  }
261997
261996
  try {
261998
261997
  const { exec: exec4 } = await import("node:child_process");
261999
- return new Promise((resolve37) => {
261998
+ return new Promise((resolve38) => {
262000
261999
  exec4("npm i -g transcribe-cli", { timeout: 18e4 }, (err) => {
262001
- resolve37(!err);
262000
+ resolve38(!err);
262002
262001
  });
262003
262002
  });
262004
262003
  } catch {
@@ -262057,7 +262056,7 @@ var init_listen = __esm({
262057
262056
  return this._ready;
262058
262057
  }
262059
262058
  async start() {
262060
- return new Promise((resolve37, reject) => {
262059
+ return new Promise((resolve38, reject) => {
262061
262060
  const timeout2 = setTimeout(() => {
262062
262061
  reject(new Error("Whisper fallback: model load timeout (5 min). First run downloads the model."));
262063
262062
  }, 3e5);
@@ -262085,7 +262084,7 @@ var init_listen = __esm({
262085
262084
  this._ready = true;
262086
262085
  clearTimeout(timeout2);
262087
262086
  this.emit("ready");
262088
- resolve37();
262087
+ resolve38();
262089
262088
  break;
262090
262089
  case "transcript":
262091
262090
  this.emit("transcript", {
@@ -262289,11 +262288,11 @@ var init_listen = __esm({
262289
262288
  this.liveTranscriber.on("error", (err) => {
262290
262289
  this.emit("error", err);
262291
262290
  });
262292
- await new Promise((resolve37, reject) => {
262291
+ await new Promise((resolve38, reject) => {
262293
262292
  const timeout2 = setTimeout(() => reject(new Error("Model load timeout (60s)")), 6e4);
262294
262293
  this.liveTranscriber.on("ready", () => {
262295
262294
  clearTimeout(timeout2);
262296
- resolve37();
262295
+ resolve38();
262297
262296
  });
262298
262297
  this.liveTranscriber.on("error", (err) => {
262299
262298
  clearTimeout(timeout2);
@@ -262455,11 +262454,11 @@ transcribe-cli error: ${transcribeCliError}` : "";
262455
262454
  sampleWidth: 2,
262456
262455
  chunkDuration: 3
262457
262456
  });
262458
- await new Promise((resolve37, reject) => {
262457
+ await new Promise((resolve38, reject) => {
262459
262458
  const timeout2 = setTimeout(() => reject(new Error("Model load timeout (60s)")), 6e4);
262460
262459
  transcriber.on("ready", () => {
262461
262460
  clearTimeout(timeout2);
262462
- resolve37();
262461
+ resolve38();
262463
262462
  });
262464
262463
  transcriber.on("error", (err) => {
262465
262464
  clearTimeout(timeout2);
@@ -267833,8 +267832,8 @@ var init_voice_session = __esm({
267833
267832
  socket.destroy();
267834
267833
  }
267835
267834
  });
267836
- await new Promise((resolve37, reject) => {
267837
- this.server.listen(port, "127.0.0.1", () => resolve37());
267835
+ await new Promise((resolve38, reject) => {
267836
+ this.server.listen(port, "127.0.0.1", () => resolve38());
267838
267837
  this.server.on("error", reject);
267839
267838
  });
267840
267839
  try {
@@ -268057,7 +268056,7 @@ var init_voice_session = __esm({
268057
268056
  }
268058
268057
  // ── Cloudflared tunnel ────────────────────────────────────────────────
268059
268058
  startCloudflared(port) {
268060
- return new Promise((resolve37, reject) => {
268059
+ return new Promise((resolve38, reject) => {
268061
268060
  const timeout2 = setTimeout(() => {
268062
268061
  reject(new Error("Cloudflared tunnel start timeout (30s)"));
268063
268062
  }, 3e4);
@@ -268075,7 +268074,7 @@ var init_voice_session = __esm({
268075
268074
  if (urlMatch && !urlFound) {
268076
268075
  urlFound = true;
268077
268076
  clearTimeout(timeout2);
268078
- resolve37(urlMatch[0]);
268077
+ resolve38(urlMatch[0]);
268079
268078
  }
268080
268079
  };
268081
268080
  this.cloudflaredProcess.stdout?.on("data", handleOutput);
@@ -268115,13 +268114,13 @@ var init_voice_session = __esm({
268115
268114
  }
268116
268115
  // ── Helpers ───────────────────────────────────────────────────────────
268117
268116
  findFreePort() {
268118
- return new Promise((resolve37, reject) => {
268117
+ return new Promise((resolve38, reject) => {
268119
268118
  const srv = createServer3();
268120
268119
  srv.listen(0, "127.0.0.1", () => {
268121
268120
  const addr = srv.address();
268122
268121
  if (addr && typeof addr === "object") {
268123
268122
  const port = addr.port;
268124
- srv.close(() => resolve37(port));
268123
+ srv.close(() => resolve38(port));
268125
268124
  } else {
268126
268125
  srv.close(() => reject(new Error("Could not find free port")));
268127
268126
  }
@@ -268244,8 +268243,8 @@ async function collectSystemMetricsAsync() {
268244
268243
  vramUtilization: 0
268245
268244
  };
268246
268245
  try {
268247
- const smi = await new Promise((resolve37, reject) => {
268248
- exec("nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total,name --format=csv,noheader,nounits 2>/dev/null", { encoding: "utf8", timeout: 3e3 }, (err, stdout) => err ? reject(err) : resolve37(stdout));
268246
+ const smi = await new Promise((resolve38, reject) => {
268247
+ exec("nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total,name --format=csv,noheader,nounits 2>/dev/null", { encoding: "utf8", timeout: 3e3 }, (err, stdout) => err ? reject(err) : resolve38(stdout));
268249
268248
  });
268250
268249
  const line = smi.trim().split("\n")[0];
268251
268250
  if (line) {
@@ -268448,8 +268447,8 @@ var init_expose = __esm({
268448
268447
  throw new Error("Gateway already running");
268449
268448
  const port = await this.findFreePort();
268450
268449
  this.server = this.createProxyServer(port);
268451
- await new Promise((resolve37, reject) => {
268452
- this.server.listen(port, "127.0.0.1", () => resolve37());
268450
+ await new Promise((resolve38, reject) => {
268451
+ this.server.listen(port, "127.0.0.1", () => resolve38());
268453
268452
  this.server.on("error", reject);
268454
268453
  });
268455
268454
  let lastStartErr;
@@ -268520,8 +268519,8 @@ var init_expose = __esm({
268520
268519
  this._cloudflaredPid = state.pid;
268521
268520
  this._proxyPort = state.proxyPort;
268522
268521
  this.server = this.createProxyServer(state.proxyPort);
268523
- await new Promise((resolve37, reject) => {
268524
- this.server.listen(state.proxyPort, "127.0.0.1", () => resolve37());
268522
+ await new Promise((resolve38, reject) => {
268523
+ this.server.listen(state.proxyPort, "127.0.0.1", () => resolve38());
268525
268524
  this.server.on("error", reject);
268526
268525
  });
268527
268526
  this._stats.status = "active";
@@ -268546,8 +268545,8 @@ var init_expose = __esm({
268546
268545
  }
268547
268546
  this._cloudflaredPid = null;
268548
268547
  if (this.server) {
268549
- await new Promise((resolve37) => {
268550
- this.server.close(() => resolve37());
268548
+ await new Promise((resolve38) => {
268549
+ this.server.close(() => resolve38());
268551
268550
  });
268552
268551
  this.server = null;
268553
268552
  }
@@ -268916,7 +268915,7 @@ var init_expose = __esm({
268916
268915
  _proxyPort = 0;
268917
268916
  startCloudflared(port) {
268918
268917
  this._proxyPort = port;
268919
- return new Promise((resolve37, reject) => {
268918
+ return new Promise((resolve38, reject) => {
268920
268919
  const TUNNEL_TIMEOUT_MS = 6e4;
268921
268920
  const timeout2 = setTimeout(() => {
268922
268921
  reject(new Error("Cloudflared tunnel start timeout (60s). Slow network? Try again."));
@@ -268960,7 +268959,7 @@ var init_expose = __esm({
268960
268959
  this.cloudflaredProcess?.unref();
268961
268960
  this.cloudflaredProcess?.stdout?.destroy();
268962
268961
  this.cloudflaredProcess?.stderr?.destroy();
268963
- resolve37(urlMatch[0]);
268962
+ resolve38(urlMatch[0]);
268964
268963
  }
268965
268964
  };
268966
268965
  this.cloudflaredProcess.stdout?.on("data", handleOutput);
@@ -269079,13 +269078,13 @@ ${this.formatConnectionInfo()}`);
269079
269078
  }
269080
269079
  // ── Helpers ─────────────────────────────────────────────────────────────
269081
269080
  findFreePort() {
269082
- return new Promise((resolve37, reject) => {
269081
+ return new Promise((resolve38, reject) => {
269083
269082
  const srv = createServer4();
269084
269083
  srv.listen(0, "127.0.0.1", () => {
269085
269084
  const addr = srv.address();
269086
269085
  if (addr && typeof addr === "object") {
269087
269086
  const port = addr.port;
269088
- srv.close(() => resolve37(port));
269087
+ srv.close(() => resolve38(port));
269089
269088
  } else {
269090
269089
  srv.close(() => reject(new Error("Could not find free port")));
269091
269090
  }
@@ -270032,8 +270031,8 @@ var init_peer_mesh = __esm({
270032
270031
  this.wss.on("connection", (ws, req2) => {
270033
270032
  this.handleInboundConnection(ws, req2.url ?? "");
270034
270033
  });
270035
- await new Promise((resolve37, reject) => {
270036
- this.server.listen(port, "127.0.0.1", () => resolve37());
270034
+ await new Promise((resolve38, reject) => {
270035
+ this.server.listen(port, "127.0.0.1", () => resolve38());
270037
270036
  this.server.on("error", reject);
270038
270037
  });
270039
270038
  this.pingTimer = setInterval(() => this.pingAll(), PING_INTERVAL_MS);
@@ -270072,7 +270071,7 @@ var init_peer_mesh = __esm({
270072
270071
  this.wss = null;
270073
270072
  }
270074
270073
  if (this.server) {
270075
- await new Promise((resolve37) => this.server.close(() => resolve37()));
270074
+ await new Promise((resolve38) => this.server.close(() => resolve38()));
270076
270075
  this.server = null;
270077
270076
  }
270078
270077
  this.emit("stopped");
@@ -270090,7 +270089,7 @@ var init_peer_mesh = __esm({
270090
270089
  if (!wsUrl.includes("/p2p"))
270091
270090
  wsUrl += "/p2p";
270092
270091
  wsUrl += `?key=${encodeURIComponent(this._authKey)}`;
270093
- return new Promise((resolve37, reject) => {
270092
+ return new Promise((resolve38, reject) => {
270094
270093
  const ws = new import_websocket5.default(wsUrl, { handshakeTimeout: 1e4 });
270095
270094
  let resolved = false;
270096
270095
  const timeout2 = setTimeout(() => {
@@ -270130,7 +270129,7 @@ var init_peer_mesh = __esm({
270130
270129
  this.connections.set(peer.peerId, ws);
270131
270130
  this.setupPeerHandlers(ws, peer.peerId);
270132
270131
  this.emit("peer_connected", peer);
270133
- resolve37(peer);
270132
+ resolve38(peer);
270134
270133
  } else {
270135
270134
  this.handleMessage(msg, ws);
270136
270135
  }
@@ -270185,12 +270184,12 @@ var init_peer_mesh = __esm({
270185
270184
  throw new Error(`Peer ${peerId} not connected`);
270186
270185
  }
270187
270186
  const msgId = randomBytes17(8).toString("hex");
270188
- return new Promise((resolve37, reject) => {
270187
+ return new Promise((resolve38, reject) => {
270189
270188
  const timeout2 = setTimeout(() => {
270190
270189
  this.pendingRequests.delete(msgId);
270191
270190
  reject(new Error(`Inference timeout (${timeoutMs}ms)`));
270192
270191
  }, timeoutMs);
270193
- this.pendingRequests.set(msgId, { resolve: resolve37, reject, timeout: timeout2, chunks: [] });
270192
+ this.pendingRequests.set(msgId, { resolve: resolve38, reject, timeout: timeout2, chunks: [] });
270194
270193
  this.sendMsg(ws, "infer_request", request, msgId);
270195
270194
  });
270196
270195
  }
@@ -270412,13 +270411,13 @@ var init_peer_mesh = __esm({
270412
270411
  ws.send(JSON.stringify(msg));
270413
270412
  }
270414
270413
  findFreePort() {
270415
- return new Promise((resolve37, reject) => {
270414
+ return new Promise((resolve38, reject) => {
270416
270415
  const srv = createServer5();
270417
270416
  srv.listen(0, "127.0.0.1", () => {
270418
270417
  const addr = srv.address();
270419
270418
  if (addr && typeof addr === "object") {
270420
270419
  const port = addr.port;
270421
- srv.close(() => resolve37(port));
270420
+ srv.close(() => resolve38(port));
270422
270421
  } else {
270423
270422
  srv.close(() => reject(new Error("Could not find free port")));
270424
270423
  }
@@ -271081,15 +271080,15 @@ async function fetchOpenAIModels(baseUrl, apiKey) {
271081
271080
  async function fetchPeerModels(peerId, authKey) {
271082
271081
  try {
271083
271082
  const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports));
271084
- const { existsSync: existsSync61, readFileSync: readFileSync49 } = await import("node:fs");
271085
- const { join: join82 } = await import("node:path");
271083
+ const { existsSync: existsSync62, readFileSync: readFileSync49 } = await import("node:fs");
271084
+ const { join: join83 } = await import("node:path");
271086
271085
  const cwd4 = process.cwd();
271087
271086
  const nexusTool = new NexusTool2(cwd4);
271088
271087
  const nexusDir = nexusTool.getNexusDir();
271089
271088
  let isLocalPeer = false;
271090
271089
  try {
271091
- const statusPath = join82(nexusDir, "status.json");
271092
- if (existsSync61(statusPath)) {
271090
+ const statusPath = join83(nexusDir, "status.json");
271091
+ if (existsSync62(statusPath)) {
271093
271092
  const status = JSON.parse(readFileSync49(statusPath, "utf8"));
271094
271093
  if (status.peerId === peerId)
271095
271094
  isLocalPeer = true;
@@ -271097,8 +271096,8 @@ async function fetchPeerModels(peerId, authKey) {
271097
271096
  } catch {
271098
271097
  }
271099
271098
  if (isLocalPeer) {
271100
- const pricingPath = join82(nexusDir, "pricing.json");
271101
- if (existsSync61(pricingPath)) {
271099
+ const pricingPath = join83(nexusDir, "pricing.json");
271100
+ if (existsSync62(pricingPath)) {
271102
271101
  try {
271103
271102
  const pricing = JSON.parse(readFileSync49(pricingPath, "utf8"));
271104
271103
  const localModels = (pricing.models || []).map((m2) => ({
@@ -271114,8 +271113,8 @@ async function fetchPeerModels(peerId, authKey) {
271114
271113
  }
271115
271114
  }
271116
271115
  }
271117
- const cachePath = join82(nexusDir, "peer-models-cache.json");
271118
- if (existsSync61(cachePath)) {
271116
+ const cachePath = join83(nexusDir, "peer-models-cache.json");
271117
+ if (existsSync62(cachePath)) {
271119
271118
  try {
271120
271119
  const cache7 = JSON.parse(readFileSync49(cachePath, "utf8"));
271121
271120
  if (cache7.peerId === peerId && cache7.models?.length > 0) {
@@ -271232,8 +271231,8 @@ async function fetchPeerModels(peerId, authKey) {
271232
271231
  } catch {
271233
271232
  }
271234
271233
  if (isLocalPeer) {
271235
- const pricingPath = join82(nexusDir, "pricing.json");
271236
- if (existsSync61(pricingPath)) {
271234
+ const pricingPath = join83(nexusDir, "pricing.json");
271235
+ if (existsSync62(pricingPath)) {
271237
271236
  try {
271238
271237
  const pricing = JSON.parse(readFileSync49(pricingPath, "utf8"));
271239
271238
  return (pricing.models || []).map((m2) => ({
@@ -272400,7 +272399,7 @@ function tuiSelect(opts) {
272400
272399
  const maxVisible = opts.maxVisible ?? Math.max(3, contentArea - selectChrome);
272401
272400
  let scrollOffset = 0;
272402
272401
  let lastRenderedLines = 0;
272403
- return new Promise((resolve37) => {
272402
+ return new Promise((resolve38) => {
272404
272403
  const stdin = process.stdin;
272405
272404
  const hadRawMode = stdin.isRaw;
272406
272405
  const savedRlListeners = [];
@@ -272577,7 +272576,7 @@ function tuiSelect(opts) {
272577
272576
  if (!isSkippable(itemIdx) && matchSet.has(itemIdx)) {
272578
272577
  cursor = itemIdx;
272579
272578
  cleanup();
272580
- resolve37({ confirmed: true, key: items[cursor].key, index: cursor });
272579
+ resolve38({ confirmed: true, key: items[cursor].key, index: cursor });
272581
272580
  return;
272582
272581
  } else if (!isSkippable(itemIdx)) {
272583
272582
  cursor = itemIdx;
@@ -272653,7 +272652,7 @@ function tuiSelect(opts) {
272653
272652
  items.splice(deletedIdx, 1);
272654
272653
  if (items.length === 0) {
272655
272654
  cleanup();
272656
- resolve37({ confirmed: false, key: null, index: -1 });
272655
+ resolve38({ confirmed: false, key: null, index: -1 });
272657
272656
  return;
272658
272657
  }
272659
272658
  updateFilter();
@@ -272746,7 +272745,7 @@ function tuiSelect(opts) {
272746
272745
  done: () => render(),
272747
272746
  resolve: (result) => {
272748
272747
  cleanup();
272749
- resolve37(result);
272748
+ resolve38(result);
272750
272749
  },
272751
272750
  getInput: (prompt, prefill) => getInputFromUser(prompt, prefill),
272752
272751
  render: () => render(),
@@ -272759,7 +272758,7 @@ function tuiSelect(opts) {
272759
272758
  return;
272760
272759
  }
272761
272760
  cleanup();
272762
- resolve37({ confirmed: true, key: items[cursor].key, index: cursor });
272761
+ resolve38({ confirmed: true, key: items[cursor].key, index: cursor });
272763
272762
  }
272764
272763
  } else if (seq === "\x1B" || seq === "\x1B\x1B") {
272765
272764
  if (filter2) {
@@ -272772,14 +272771,14 @@ function tuiSelect(opts) {
272772
272771
  render();
272773
272772
  } else if (hasBreadcrumbs) {
272774
272773
  cleanup();
272775
- resolve37({ confirmed: false, key: "__back__", index: cursor });
272774
+ resolve38({ confirmed: false, key: "__back__", index: cursor });
272776
272775
  } else {
272777
272776
  cleanup();
272778
- resolve37({ confirmed: false, key: null, index: cursor });
272777
+ resolve38({ confirmed: false, key: null, index: cursor });
272779
272778
  }
272780
272779
  } else if (seq === "") {
272781
272780
  cleanup();
272782
- resolve37({ confirmed: false, key: null, index: cursor });
272781
+ resolve38({ confirmed: false, key: null, index: cursor });
272783
272782
  } else if (seq === "\x7F" || seq === "\b") {
272784
272783
  if (filter2.length > 0) {
272785
272784
  filter2 = filter2.slice(0, -1);
@@ -272793,7 +272792,7 @@ function tuiSelect(opts) {
272793
272792
  render();
272794
272793
  } else if (hasBreadcrumbs) {
272795
272794
  cleanup();
272796
- resolve37({ confirmed: false, key: "__back__", index: cursor });
272795
+ resolve38({ confirmed: false, key: "__back__", index: cursor });
272797
272796
  }
272798
272797
  } else if (seq.length === 1 && seq.charCodeAt(0) >= 32 && seq.charCodeAt(0) < 127) {
272799
272798
  if (opts.onCustomKey && !isSkippable(cursor) && matchSet.has(cursor)) {
@@ -272801,7 +272800,7 @@ function tuiSelect(opts) {
272801
272800
  done: () => render(),
272802
272801
  resolve: (result) => {
272803
272802
  cleanup();
272804
- resolve37(result);
272803
+ resolve38(result);
272805
272804
  },
272806
272805
  getInput: (prompt, prefill) => getInputFromUser(prompt, prefill),
272807
272806
  render: () => render(),
@@ -273036,7 +273035,7 @@ import { homedir as homedir14 } from "node:os";
273036
273035
  import { execSync as execSync28, spawn as spawn19, execFile as execFile7 } from "node:child_process";
273037
273036
  import { fileURLToPath as fileURLToPath12 } from "node:url";
273038
273037
  function execAsync(cmd, opts = {}) {
273039
- return new Promise((resolve37, reject) => {
273038
+ return new Promise((resolve38, reject) => {
273040
273039
  const child = spawn19("bash", ["-c", cmd], {
273041
273040
  stdio: ["ignore", "pipe", "pipe"],
273042
273041
  timeout: opts.timeout ?? 3e5,
@@ -273052,7 +273051,7 @@ function execAsync(cmd, opts = {}) {
273052
273051
  });
273053
273052
  child.on("close", (code8, signal) => {
273054
273053
  if (code8 === 0)
273055
- resolve37(stdout.trim());
273054
+ resolve38(stdout.trim());
273056
273055
  else
273057
273056
  reject(new Error(`Exit ${code8}${signal ? ` (signal: ${signal})` : ""}: ${stderr.slice(0, 500)}`));
273058
273057
  });
@@ -273777,7 +273776,7 @@ async function clonePersonaPlexVoice(inputWav, voiceName, onInfo) {
273777
273776
  }
273778
273777
  log22(`Cloning voice "${voiceName}" from ${inputWav}...`);
273779
273778
  log22("This requires loading the full 7B model \u2014 may take 30-60s...");
273780
- return new Promise((resolve37) => {
273779
+ return new Promise((resolve38) => {
273781
273780
  const child = spawn19(venvPython2, [
273782
273781
  cloneScript,
273783
273782
  "--input",
@@ -273805,10 +273804,10 @@ async function clonePersonaPlexVoice(inputWav, voiceName, onInfo) {
273805
273804
  child.on("close", (code8) => {
273806
273805
  if (code8 === 0 && existsSync38(outputPt)) {
273807
273806
  log22(`Voice "${voiceName}" cloned successfully.`);
273808
- resolve37(outputPt);
273807
+ resolve38(outputPt);
273809
273808
  } else {
273810
273809
  log22(`Voice cloning failed (exit ${code8}).`);
273811
- resolve37(null);
273810
+ resolve38(null);
273812
273811
  }
273813
273812
  });
273814
273813
  });
@@ -274145,12 +274144,12 @@ function calculateContextWindow(specs, modelSizeGB2, kvBytesPerToken, archMax) {
274145
274144
  return { numCtx, label };
274146
274145
  }
274147
274146
  function ask(rl, question) {
274148
- return new Promise((resolve37) => {
274149
- rl.question(question, (answer) => resolve37(answer.trim()));
274147
+ return new Promise((resolve38) => {
274148
+ rl.question(question, (answer) => resolve38(answer.trim()));
274150
274149
  });
274151
274150
  }
274152
274151
  function askSecret(rl, question) {
274153
- return new Promise((resolve37) => {
274152
+ return new Promise((resolve38) => {
274154
274153
  process.stdout.write(question);
274155
274154
  let secret = "";
274156
274155
  const stdin = process.stdin;
@@ -274168,7 +274167,7 @@ function askSecret(rl, question) {
274168
274167
  stdin.setRawMode(hadRawMode ?? false);
274169
274168
  }
274170
274169
  process.stdout.write("\n");
274171
- resolve37(secret.trim());
274170
+ resolve38(secret.trim());
274172
274171
  return;
274173
274172
  } else if (c4 === "") {
274174
274173
  stdin.removeListener("data", onData);
@@ -274176,7 +274175,7 @@ function askSecret(rl, question) {
274176
274175
  stdin.setRawMode(hadRawMode ?? false);
274177
274176
  }
274178
274177
  process.stdout.write("\n");
274179
- resolve37("");
274178
+ resolve38("");
274180
274179
  return;
274181
274180
  } else if (c4 === "\x7F" || c4 === "\b") {
274182
274181
  if (secret.length > 0) {
@@ -274411,7 +274410,7 @@ async function ensureOllamaRunning(backendUrl, rl) {
274411
274410
  return false;
274412
274411
  }
274413
274412
  for (let i2 = 0; i2 < 5; i2++) {
274414
- await new Promise((resolve37) => setTimeout(resolve37, 2e3));
274413
+ await new Promise((resolve38) => setTimeout(resolve38, 2e3));
274415
274414
  try {
274416
274415
  const resp = await fetch(`${backendUrl}/api/tags`, {
274417
274416
  signal: AbortSignal.timeout(3e3)
@@ -274880,7 +274879,7 @@ async function doSetup(config, rl) {
274880
274879
  try {
274881
274880
  const child = spawn20("ollama", ["serve"], { stdio: "ignore", detached: true });
274882
274881
  child.unref();
274883
- await new Promise((resolve37) => setTimeout(resolve37, 3e3));
274882
+ await new Promise((resolve38) => setTimeout(resolve38, 3e3));
274884
274883
  try {
274885
274884
  models = await fetchOllamaModels(config.backendUrl);
274886
274885
  process.stdout.write(` ${c3.green("\u2714")} Ollama is running.
@@ -274908,7 +274907,7 @@ async function doSetup(config, rl) {
274908
274907
  try {
274909
274908
  const child = spawn20("ollama", ["serve"], { stdio: "ignore", detached: true });
274910
274909
  child.unref();
274911
- await new Promise((resolve37) => setTimeout(resolve37, 3e3));
274910
+ await new Promise((resolve38) => setTimeout(resolve38, 3e3));
274912
274911
  try {
274913
274912
  models = await fetchOllamaModels(config.backendUrl);
274914
274913
  process.stdout.write(` ${c3.green("\u2714")} Ollama is running.
@@ -276225,12 +276224,12 @@ function stopNeovimMode() {
276225
276224
  } catch {
276226
276225
  }
276227
276226
  const s2 = _state;
276228
- return new Promise((resolve37) => {
276227
+ return new Promise((resolve38) => {
276229
276228
  setTimeout(() => {
276230
276229
  if (s2 && !s2.cleanedUp) {
276231
276230
  doCleanup(s2);
276232
276231
  }
276233
- resolve37();
276232
+ resolve38();
276234
276233
  }, 300);
276235
276234
  });
276236
276235
  }
@@ -279204,7 +279203,7 @@ var init_voice = __esm({
279204
279203
  this.speaking = false;
279205
279204
  }
279206
279205
  sleep(ms) {
279207
- return new Promise((resolve37) => setTimeout(resolve37, ms));
279206
+ return new Promise((resolve38) => setTimeout(resolve38, ms));
279208
279207
  }
279209
279208
  // -------------------------------------------------------------------------
279210
279209
  // Synthesis pipeline
@@ -279470,7 +279469,7 @@ var init_voice = __esm({
279470
279469
  const cmd = this.getPlayCommand(path5);
279471
279470
  if (!cmd)
279472
279471
  return;
279473
- return new Promise((resolve37) => {
279472
+ return new Promise((resolve38) => {
279474
279473
  const child = nodeSpawn(cmd[0], cmd.slice(1), {
279475
279474
  stdio: "ignore",
279476
279475
  detached: false
@@ -279479,12 +279478,12 @@ var init_voice = __esm({
279479
279478
  child.on("close", () => {
279480
279479
  if (this.currentPlayback === child)
279481
279480
  this.currentPlayback = null;
279482
- resolve37();
279481
+ resolve38();
279483
279482
  });
279484
279483
  child.on("error", () => {
279485
279484
  if (this.currentPlayback === child)
279486
279485
  this.currentPlayback = null;
279487
- resolve37();
279486
+ resolve38();
279488
279487
  });
279489
279488
  setTimeout(() => {
279490
279489
  if (this.currentPlayback === child) {
@@ -279494,7 +279493,7 @@ var init_voice = __esm({
279494
279493
  }
279495
279494
  this.currentPlayback = null;
279496
279495
  }
279497
- resolve37();
279496
+ resolve38();
279498
279497
  }, 15e3);
279499
279498
  });
279500
279499
  }
@@ -279569,7 +279568,7 @@ var init_voice = __esm({
279569
279568
  /** Non-blocking shell execution — async alternative to execSync.
279570
279569
  * Returns stdout string on exit 0, rejects otherwise. */
279571
279570
  asyncShell(command, timeoutMs = 3e4) {
279572
- return new Promise((resolve37, reject) => {
279571
+ return new Promise((resolve38, reject) => {
279573
279572
  const proc = nodeSpawn("sh", ["-c", command], {
279574
279573
  stdio: ["ignore", "pipe", "pipe"],
279575
279574
  cwd: tmpdir9()
@@ -279590,7 +279589,7 @@ var init_voice = __esm({
279590
279589
  proc.on("close", (code8) => {
279591
279590
  clearTimeout(timer);
279592
279591
  if (code8 === 0)
279593
- resolve37(stdout.trim());
279592
+ resolve38(stdout.trim());
279594
279593
  else
279595
279594
  reject(new Error(stderr.slice(0, 300) || `Exit code ${code8}`));
279596
279595
  });
@@ -280126,7 +280125,7 @@ if __name__ == '__main__':
280126
280125
  const venvPy = luxttsVenvPy();
280127
280126
  if (!existsSync43(venvPy))
280128
280127
  return false;
280129
- return new Promise((resolve37) => {
280128
+ return new Promise((resolve38) => {
280130
280129
  const env2 = { ...process.env, LUXTTS_REPO_PATH: luxttsRepoDir() };
280131
280130
  const daemon = nodeSpawn(venvPy, [luxttsInferScript()], {
280132
280131
  stdio: ["pipe", "pipe", "pipe"],
@@ -280153,7 +280152,7 @@ if __name__ == '__main__':
280153
280152
  status: "running"
280154
280153
  });
280155
280154
  }
280156
- resolve37(true);
280155
+ resolve38(true);
280157
280156
  } else if (msg.type === "result" || msg.type === "error") {
280158
280157
  const pending = this._luxttsPending.get(msg.id);
280159
280158
  if (pending) {
@@ -280178,25 +280177,25 @@ if __name__ == '__main__':
280178
280177
  });
280179
280178
  daemon.on("error", () => {
280180
280179
  this._luxttsDaemon = null;
280181
- resolve37(false);
280180
+ resolve38(false);
280182
280181
  });
280183
280182
  setTimeout(() => {
280184
280183
  if (this._luxttsDaemon === daemon && !this._luxttsPending.has("__ready__")) {
280185
- resolve37(false);
280184
+ resolve38(false);
280186
280185
  }
280187
280186
  }, 6e4);
280188
280187
  });
280189
280188
  }
280190
280189
  /** Send a request to the LuxTTS daemon and await the response */
280191
280190
  luxttsRequest(req2) {
280192
- return new Promise((resolve37, reject) => {
280191
+ return new Promise((resolve38, reject) => {
280193
280192
  if (!this._luxttsDaemon || this._luxttsDaemon.killed) {
280194
280193
  reject(new Error("LuxTTS daemon not running"));
280195
280194
  return;
280196
280195
  }
280197
280196
  const id = `req_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
280198
280197
  req2.id = id;
280199
- this._luxttsPending.set(id, { resolve: resolve37, reject });
280198
+ this._luxttsPending.set(id, { resolve: resolve38, reject });
280200
280199
  this._luxttsDaemon.stdin.write(JSON.stringify(req2) + "\n");
280201
280200
  setTimeout(() => {
280202
280201
  if (this._luxttsPending.has(id)) {
@@ -281072,9 +281071,9 @@ async function handleSlashCommand(input, ctx3) {
281072
281071
  renderInfo("No wallet configured. Ask the agent to create one via the nexus tool.");
281073
281072
  }
281074
281073
  } else if (sub === "name") {
281075
- const { homedir: homedir22 } = __require("node:os");
281074
+ const { homedir: homedir23 } = __require("node:os");
281076
281075
  const { existsSync: ex, readFileSync: rf, writeFileSync: wf, mkdirSync: mkd } = __require("node:fs");
281077
- const namePath = __require("node:path").join(homedir22(), ".open-agents", "agent-name");
281076
+ const namePath = __require("node:path").join(homedir23(), ".open-agents", "agent-name");
281078
281077
  if (rest2) {
281079
281078
  const customName = rest2.replace(/[^a-zA-Z0-9_\-.\s]/g, "").trim().slice(0, 40);
281080
281079
  if (!customName) {
@@ -281778,8 +281777,8 @@ async function handleSlashCommand(input, ctx3) {
281778
281777
  writeFileSync21(jwtFile, JSON.stringify(jwtPayload, null, 2));
281779
281778
  renderInfo(`Launching fortemi-react from ${fDir}...`);
281780
281779
  try {
281781
- const { spawn: spawn23 } = __require("node:child_process");
281782
- const child = spawn23("npx", ["vite", "dev", "--host", "0.0.0.0", "--port", "3000"], {
281780
+ const { spawn: spawn24 } = __require("node:child_process");
281781
+ const child = spawn24("npx", ["vite", "dev", "--host", "0.0.0.0", "--port", "3000"], {
281783
281782
  cwd: join61(fDir, "apps", "standalone"),
281784
281783
  stdio: "ignore",
281785
281784
  detached: true,
@@ -282726,8 +282725,8 @@ Clone a new voice: /voice clone <wav-file> [name]`);
282726
282725
  let sponsorName = (config.header.message || "").replace(/^\/+/, "").trim();
282727
282726
  if (!sponsorName || sponsorName.length < 2) {
282728
282727
  try {
282729
- const { homedir: homedir22 } = __require("os");
282730
- const namePath = __require("path").join(homedir22(), ".open-agents", "agent-name");
282728
+ const { homedir: homedir23 } = __require("os");
282729
+ const namePath = __require("path").join(homedir23(), ".open-agents", "agent-name");
282731
282730
  if (existsSync44(namePath))
282732
282731
  sponsorName = readFileSync33(namePath, "utf8").trim();
282733
282732
  } catch {
@@ -284132,12 +284131,12 @@ async function handleVoiceMenu(ctx3, save2, hasLocal) {
284132
284131
  continue;
284133
284132
  }
284134
284133
  const { basename: basename19, join: pathJoin } = await import("node:path");
284135
- const { copyFileSync: copyFileSync3, mkdirSync: mkdirSync34, existsSync: exists2 } = await import("node:fs");
284136
- const { homedir: homedir22 } = await import("node:os");
284134
+ const { copyFileSync: copyFileSync3, mkdirSync: mkdirSync35, existsSync: exists2 } = await import("node:fs");
284135
+ const { homedir: homedir23 } = await import("node:os");
284137
284136
  const modelName = basename19(onnxDrop.path, ".onnx").replace(/[^a-zA-Z0-9_-]/g, "-");
284138
- const destDir = pathJoin(homedir22(), ".open-agents", "voice", "models", modelName);
284137
+ const destDir = pathJoin(homedir23(), ".open-agents", "voice", "models", modelName);
284139
284138
  if (!exists2(destDir))
284140
- mkdirSync34(destDir, { recursive: true });
284139
+ mkdirSync35(destDir, { recursive: true });
284141
284140
  copyFileSync3(onnxDrop.path, pathJoin(destDir, "model.onnx"));
284142
284141
  copyFileSync3(jsonDrop.path, pathJoin(destDir, "config.json"));
284143
284142
  const { registerCustomOnnxModel: registerCustomOnnxModel2 } = await Promise.resolve().then(() => (init_voice(), voice_exports));
@@ -284830,10 +284829,10 @@ async function handleSponsoredEndpoint(ctx3, local) {
284830
284829
  sponsors.push(...verified);
284831
284830
  if (verified.length > 0) {
284832
284831
  try {
284833
- const { mkdirSync: mkdirSync34, writeFileSync: writeFileSync32 } = __require("node:fs");
284834
- mkdirSync34(sponsorDir2, { recursive: true });
284832
+ const { mkdirSync: mkdirSync35, writeFileSync: writeFileSync33 } = __require("node:fs");
284833
+ mkdirSync35(sponsorDir2, { recursive: true });
284835
284834
  const cached = verified.map((s2) => ({ ...s2, lastVerified: Date.now() }));
284836
- writeFileSync32(knownFile, JSON.stringify(cached, null, 2));
284835
+ writeFileSync33(knownFile, JSON.stringify(cached, null, 2));
284837
284836
  } catch {
284838
284837
  }
284839
284838
  }
@@ -284997,11 +284996,11 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local) {
284997
284996
  const models = await fetchModels(peerUrl, authKey);
284998
284997
  if (models.length > 0) {
284999
284998
  try {
285000
- const { writeFileSync: writeFileSync32, mkdirSync: mkdirSync34 } = await import("node:fs");
285001
- const { join: join82, dirname: dirname25 } = await import("node:path");
285002
- const cachePath = join82(ctx3.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
285003
- mkdirSync34(dirname25(cachePath), { recursive: true });
285004
- writeFileSync32(cachePath, JSON.stringify({
284999
+ const { writeFileSync: writeFileSync33, mkdirSync: mkdirSync35 } = await import("node:fs");
285000
+ const { join: join83, dirname: dirname26 } = await import("node:path");
285001
+ const cachePath = join83(ctx3.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
285002
+ mkdirSync35(dirname26(cachePath), { recursive: true });
285003
+ writeFileSync33(cachePath, JSON.stringify({
285005
285004
  peerId,
285006
285005
  cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
285007
285006
  models: models.map((m2) => ({ name: m2.name, size: m2.size, parameterSize: m2.parameterSize }))
@@ -285050,7 +285049,7 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local) {
285050
285049
  }
285051
285050
  }
285052
285051
  async function handleParallel(arg, ctx3) {
285053
- const { execSync: execSync36 } = await import("node:child_process");
285052
+ const { execSync: execSync37 } = await import("node:child_process");
285054
285053
  const baseUrl = ctx3.config.backendUrl || "http://localhost:11434";
285055
285054
  const isRemote = ctx3.config.backendType === "nexus";
285056
285055
  if (isRemote) {
@@ -285074,7 +285073,7 @@ async function handleParallel(arg, ctx3) {
285074
285073
  }
285075
285074
  let systemdVal = "";
285076
285075
  try {
285077
- const out = execSync36("systemctl show ollama.service -p Environment 2>/dev/null || true", { encoding: "utf8" });
285076
+ const out = execSync37("systemctl show ollama.service -p Environment 2>/dev/null || true", { encoding: "utf8" });
285078
285077
  const match = out.match(/OLLAMA_NUM_PARALLEL=(\d+)/);
285079
285078
  if (match)
285080
285079
  systemdVal = match[1];
@@ -285103,7 +285102,7 @@ async function handleParallel(arg, ctx3) {
285103
285102
  }
285104
285103
  const isSystemd = (() => {
285105
285104
  try {
285106
- const out = execSync36("systemctl is-active ollama.service 2>/dev/null", { encoding: "utf8" }).trim();
285105
+ const out = execSync37("systemctl is-active ollama.service 2>/dev/null", { encoding: "utf8" }).trim();
285107
285106
  return out === "active" || out === "inactive";
285108
285107
  } catch {
285109
285108
  return false;
@@ -285117,10 +285116,10 @@ async function handleParallel(arg, ctx3) {
285117
285116
  const overrideContent = `[Service]
285118
285117
  Environment="OLLAMA_NUM_PARALLEL=${n2}"
285119
285118
  `;
285120
- execSync36(`sudo mkdir -p ${overrideDir}`, { stdio: "pipe" });
285121
- execSync36(`echo '${overrideContent}' | sudo tee ${overrideFile} > /dev/null`, { stdio: "pipe" });
285122
- execSync36("sudo systemctl daemon-reload", { stdio: "pipe" });
285123
- execSync36("sudo systemctl restart ollama.service", { stdio: "pipe" });
285119
+ execSync37(`sudo mkdir -p ${overrideDir}`, { stdio: "pipe" });
285120
+ execSync37(`echo '${overrideContent}' | sudo tee ${overrideFile} > /dev/null`, { stdio: "pipe" });
285121
+ execSync37("sudo systemctl daemon-reload", { stdio: "pipe" });
285122
+ execSync37("sudo systemctl restart ollama.service", { stdio: "pipe" });
285124
285123
  let ready = false;
285125
285124
  for (let i2 = 0; i2 < 30 && !ready; i2++) {
285126
285125
  await new Promise((r2) => setTimeout(r2, 500));
@@ -285147,13 +285146,13 @@ Environment="OLLAMA_NUM_PARALLEL=${n2}"
285147
285146
  renderInfo(`Setting OLLAMA_NUM_PARALLEL=${n2}...`);
285148
285147
  try {
285149
285148
  try {
285150
- execSync36("pkill -f 'ollama serve' 2>/dev/null || true", { stdio: "pipe" });
285149
+ execSync37("pkill -f 'ollama serve' 2>/dev/null || true", { stdio: "pipe" });
285151
285150
  } catch {
285152
285151
  }
285153
285152
  await new Promise((r2) => setTimeout(r2, 1e3));
285154
285153
  process.env.OLLAMA_NUM_PARALLEL = String(n2);
285155
- const { spawn: spawn23 } = await import("node:child_process");
285156
- const child = spawn23("ollama", ["serve"], {
285154
+ const { spawn: spawn24 } = await import("node:child_process");
285155
+ const child = spawn24("ollama", ["serve"], {
285157
285156
  stdio: "ignore",
285158
285157
  detached: true,
285159
285158
  env: { ...process.env, OLLAMA_NUM_PARALLEL: String(n2) }
@@ -285199,18 +285198,18 @@ async function handleUpdate(subcommand, ctx3) {
285199
285198
  let currentVersion = "0.0.0";
285200
285199
  try {
285201
285200
  const { createRequire: createRequire7 } = await import("node:module");
285202
- const { fileURLToPath: fileURLToPath17 } = await import("node:url");
285203
- const { dirname: dirname25, join: join82 } = await import("node:path");
285204
- const { existsSync: existsSync61 } = await import("node:fs");
285201
+ const { fileURLToPath: fileURLToPath18 } = await import("node:url");
285202
+ const { dirname: dirname26, join: join83 } = await import("node:path");
285203
+ const { existsSync: existsSync62 } = await import("node:fs");
285205
285204
  const req2 = createRequire7(import.meta.url);
285206
- const thisDir = dirname25(fileURLToPath17(import.meta.url));
285205
+ const thisDir = dirname26(fileURLToPath18(import.meta.url));
285207
285206
  const candidates = [
285208
- join82(thisDir, "..", "package.json"),
285209
- join82(thisDir, "..", "..", "package.json"),
285210
- join82(thisDir, "..", "..", "..", "package.json")
285207
+ join83(thisDir, "..", "package.json"),
285208
+ join83(thisDir, "..", "..", "package.json"),
285209
+ join83(thisDir, "..", "..", "..", "package.json")
285211
285210
  ];
285212
285211
  for (const pkgPath of candidates) {
285213
- if (existsSync61(pkgPath)) {
285212
+ if (existsSync62(pkgPath)) {
285214
285213
  const pkg = req2(pkgPath);
285215
285214
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli") {
285216
285215
  currentVersion = pkg.version ?? "0.0.0";
@@ -285465,11 +285464,11 @@ async function handleUpdate(subcommand, ctx3) {
285465
285464
  const targetVersion = info?.latestVersion ?? currentVersion;
285466
285465
  const installOverlay = startInstallOverlay(targetVersion);
285467
285466
  let installError = "";
285468
- const runInstall2 = (cmd) => new Promise((resolve37) => {
285467
+ const runInstall2 = (cmd) => new Promise((resolve38) => {
285469
285468
  const child = exec4(cmd, { timeout: 18e4 }, (err, _stdout, stderr) => {
285470
285469
  if (err)
285471
285470
  installError = (stderr || err.message || "").trim();
285472
- resolve37(!err);
285471
+ resolve38(!err);
285473
285472
  });
285474
285473
  child.stdout?.on("data", (chunk) => {
285475
285474
  const text = String(chunk);
@@ -285664,8 +285663,8 @@ async function handleUpdate(subcommand, ctx3) {
285664
285663
  }
285665
285664
  if (doRebuild) {
285666
285665
  installOverlay.setStatus("Rebuilding native modules...");
285667
- await new Promise((resolve37) => {
285668
- const child = exec4(`${sudoPrefix}npm rebuild -g open-agents-ai 2>/dev/null || true`, { timeout: 12e4 }, () => resolve37(true));
285666
+ await new Promise((resolve38) => {
285667
+ const child = exec4(`${sudoPrefix}npm rebuild -g open-agents-ai 2>/dev/null || true`, { timeout: 12e4 }, () => resolve38(true));
285669
285668
  child.stdout?.resume();
285670
285669
  child.stderr?.resume();
285671
285670
  });
@@ -285697,8 +285696,8 @@ async function handleUpdate(subcommand, ctx3) {
285697
285696
  const venvPip2 = isWin2 ? pathJoin(venvDir, "Scripts", "pip.exe") : pathJoin(venvDir, "bin", "pip");
285698
285697
  if (fsExists(venvPip2)) {
285699
285698
  installOverlay.setStatus("Upgrading Python packages...");
285700
- await new Promise((resolve37) => {
285701
- const child = exec4(`"${venvPip2}" install --upgrade moondream-station pytesseract Pillow opencv-python-headless numpy 2>/dev/null || true`, { timeout: 3e5 }, (err) => resolve37(!err));
285699
+ await new Promise((resolve38) => {
285700
+ const child = exec4(`"${venvPip2}" install --upgrade moondream-station pytesseract Pillow opencv-python-headless numpy 2>/dev/null || true`, { timeout: 3e5 }, (err) => resolve38(!err));
285702
285701
  child.stdout?.resume();
285703
285702
  child.stderr?.resume();
285704
285703
  });
@@ -286090,16 +286089,16 @@ async function showExposeDashboard(gateway, rl, ctx3) {
286090
286089
  renderDashboard();
286091
286090
  }, 1e3);
286092
286091
  let stopGateway = false;
286093
- await new Promise((resolve37) => {
286092
+ await new Promise((resolve38) => {
286094
286093
  const onData = (data) => {
286095
286094
  const key = data.toString();
286096
286095
  if (key === "q" || key === "Q" || key === "\x1B" || key === "") {
286097
- resolve37();
286096
+ resolve38();
286098
286097
  return;
286099
286098
  }
286100
286099
  if (key === "s" || key === "S") {
286101
286100
  stopGateway = true;
286102
- resolve37();
286101
+ resolve38();
286103
286102
  return;
286104
286103
  }
286105
286104
  if (key === "c" || key === "C") {
@@ -286108,18 +286107,18 @@ async function showExposeDashboard(gateway, rl, ctx3) {
286108
286107
  const cmd = `/endpoint ${id} --auth ${gateway.authKey ?? ""}`;
286109
286108
  let copied = false;
286110
286109
  try {
286111
- const { execSync: execSync36 } = __require("node:child_process");
286110
+ const { execSync: execSync37 } = __require("node:child_process");
286112
286111
  const platform6 = process.platform;
286113
286112
  if (platform6 === "darwin") {
286114
- execSync36("pbcopy", { input: cmd, timeout: 3e3 });
286113
+ execSync37("pbcopy", { input: cmd, timeout: 3e3 });
286115
286114
  copied = true;
286116
286115
  } else if (platform6 === "win32") {
286117
- execSync36("clip", { input: cmd, timeout: 3e3 });
286116
+ execSync37("clip", { input: cmd, timeout: 3e3 });
286118
286117
  copied = true;
286119
286118
  } else {
286120
286119
  for (const tool of ["xclip -selection clipboard", "xsel --clipboard --input", "wl-copy"]) {
286121
286120
  try {
286122
- execSync36(tool, { input: cmd, timeout: 3e3, stdio: ["pipe", "pipe", "pipe"] });
286121
+ execSync37(tool, { input: cmd, timeout: 3e3, stdio: ["pipe", "pipe", "pipe"] });
286123
286122
  copied = true;
286124
286123
  break;
286125
286124
  } catch {
@@ -286150,8 +286149,8 @@ async function showExposeDashboard(gateway, rl, ctx3) {
286150
286149
  process.stdout.write("\x1B[?1002h\x1B[?1006h");
286151
286150
  }
286152
286151
  };
286153
- const origResolve = resolve37;
286154
- resolve37 = (() => {
286152
+ const origResolve = resolve38;
286153
+ resolve38 = (() => {
286155
286154
  cleanup();
286156
286155
  origResolve();
286157
286156
  });
@@ -293789,8 +293788,8 @@ async function collectNetworkMetrics() {
293789
293788
  }
293790
293789
  if (plat === "darwin") {
293791
293790
  try {
293792
- const output = await new Promise((resolve37, reject) => {
293793
- exec3("netstat -ib 2>/dev/null | head -30", { encoding: "utf8", timeout: 3e3 }, (err, stdout) => err ? reject(err) : resolve37(stdout));
293791
+ const output = await new Promise((resolve38, reject) => {
293792
+ exec3("netstat -ib 2>/dev/null | head -30", { encoding: "utf8", timeout: 3e3 }, (err, stdout) => err ? reject(err) : resolve38(stdout));
293794
293793
  });
293795
293794
  let rxBytes = 0, txBytes = 0;
293796
293795
  for (const line of output.split("\n")) {
@@ -293824,8 +293823,8 @@ async function collectGpuMetrics() {
293824
293823
  if (_nvidiaSmiAvailable === false)
293825
293824
  return noGpu;
293826
293825
  try {
293827
- const smi = await new Promise((resolve37, reject) => {
293828
- exec3("nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total,name --format=csv,noheader,nounits 2>/dev/null", { encoding: "utf8", timeout: 3e3 }, (err, stdout) => err ? reject(err) : resolve37(stdout));
293826
+ const smi = await new Promise((resolve38, reject) => {
293827
+ exec3("nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total,name --format=csv,noheader,nounits 2>/dev/null", { encoding: "utf8", timeout: 3e3 }, (err, stdout) => err ? reject(err) : resolve38(stdout));
293829
293828
  });
293830
293829
  _nvidiaSmiAvailable = true;
293831
293830
  const line = smi.trim().split("\n")[0];
@@ -299125,7 +299124,7 @@ var init_profiles = __esm({
299125
299124
  },
299126
299125
  "cohere-mesh": {
299127
299126
  name: "cohere-mesh",
299128
- description: "COHERE mesh queries \u2014 web search/fetch only, no file or shell access",
299127
+ description: "COHERE mesh queries \u2014 Docker sandbox, web search/fetch only",
299129
299128
  tools: {
299130
299129
  allow: ["web_search", "web_fetch", "task_complete"],
299131
299130
  deny: [
@@ -299149,6 +299148,7 @@ var init_profiles = __esm({
299149
299148
  },
299150
299149
  commands: { deny: ["destroy", "update", "sponsor", "expose", "quit"] },
299151
299150
  limits: { max_turns: 8, timeout_s: 90 },
299151
+ sandbox: "container",
299152
299152
  encrypted: false,
299153
299153
  created: "2026-03-31T00:00:00Z"
299154
299154
  }
@@ -299156,6 +299156,200 @@ var init_profiles = __esm({
299156
299156
  }
299157
299157
  });
299158
299158
 
299159
+ // packages/cli/dist/docker.js
299160
+ import { execSync as execSync35, spawn as spawn21 } from "node:child_process";
299161
+ import { existsSync as existsSync57, mkdirSync as mkdirSync30, writeFileSync as writeFileSync28 } from "node:fs";
299162
+ import { join as join75, resolve as resolve32, dirname as dirname22 } from "node:path";
299163
+ import { homedir as homedir20 } from "node:os";
299164
+ import { fileURLToPath as fileURLToPath14 } from "node:url";
299165
+ function getDockerDir() {
299166
+ try {
299167
+ if (typeof __dirname !== "undefined") {
299168
+ return join75(__dirname, "..", "..", "..", "docker");
299169
+ }
299170
+ } catch {
299171
+ }
299172
+ try {
299173
+ const thisDir = dirname22(fileURLToPath14(import.meta.url));
299174
+ return join75(thisDir, "..", "..", "..", "docker");
299175
+ } catch {
299176
+ }
299177
+ return join75(process.cwd(), "docker");
299178
+ }
299179
+ function isDockerAvailable() {
299180
+ try {
299181
+ execSync35("docker info", { stdio: "pipe", timeout: 1e4 });
299182
+ return true;
299183
+ } catch {
299184
+ return false;
299185
+ }
299186
+ }
299187
+ function isOaImageBuilt() {
299188
+ try {
299189
+ const out = execSync35(`docker images -q ${OA_IMAGE}:${OA_IMAGE_TAG}`, {
299190
+ stdio: "pipe",
299191
+ timeout: 5e3
299192
+ }).toString().trim();
299193
+ return out.length > 0;
299194
+ } catch {
299195
+ return false;
299196
+ }
299197
+ }
299198
+ async function ensureOaImage(force = false) {
299199
+ if (!force && isOaImageBuilt()) {
299200
+ return { ok: true, message: `Image ${OA_IMAGE}:${OA_IMAGE_TAG} already exists` };
299201
+ }
299202
+ let buildContext;
299203
+ const dockerDir = getDockerDir();
299204
+ if (existsSync57(join75(dockerDir, "Dockerfile"))) {
299205
+ buildContext = dockerDir;
299206
+ } else {
299207
+ buildContext = join75(homedir20(), ".oa", "docker-build");
299208
+ mkdirSync30(buildContext, { recursive: true });
299209
+ writeDockerfiles(buildContext);
299210
+ }
299211
+ try {
299212
+ console.log(`[oa-docker] Building image ${OA_IMAGE}:${OA_IMAGE_TAG}...`);
299213
+ execSync35(`docker build -t ${OA_IMAGE}:${OA_IMAGE_TAG} ${buildContext}`, {
299214
+ stdio: "inherit",
299215
+ timeout: 6e5
299216
+ // 10 min
299217
+ });
299218
+ return { ok: true, message: `Image ${OA_IMAGE}:${OA_IMAGE_TAG} built successfully` };
299219
+ } catch (err) {
299220
+ return {
299221
+ ok: false,
299222
+ message: `Image build failed: ${err instanceof Error ? err.message : String(err)}`
299223
+ };
299224
+ }
299225
+ }
299226
+ function writeDockerfiles(dir) {
299227
+ const dockerfile = `FROM node:22-slim
299228
+ RUN apt-get update && apt-get install -y --no-install-recommends \\
299229
+ curl ca-certificates git openssh-server sudo ripgrep procps python3 \\
299230
+ && rm -rf /var/lib/apt/lists/* && apt-get clean
299231
+ RUN mkdir -p /var/run/sshd && ssh-keygen -A \\
299232
+ && sed -i 's/#PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config \\
299233
+ && sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config \\
299234
+ && echo "AllowUsers node" >> /etc/ssh/sshd_config
299235
+ RUN npm install -g open-agents-ai@latest
299236
+ RUN mkdir -p /workspace && chown node:node /workspace \\
299237
+ && mkdir -p /home/node/.oa /home/node/.open-agents \\
299238
+ && chown -R node:node /home/node/.oa /home/node/.open-agents /home/node
299239
+ RUN echo "node ALL=(ALL) NOPASSWD: /usr/bin/npm, /usr/bin/node, /usr/bin/apt-get" > /etc/sudoers.d/node \\
299240
+ && chmod 440 /etc/sudoers.d/node
299241
+ COPY docker-entrypoint.sh /usr/local/bin/
299242
+ RUN chmod +x /usr/local/bin/docker-entrypoint.sh
299243
+ ENV OPEN_AGENTS_BACKEND_TYPE=ollama NODE_ENV=production
299244
+ EXPOSE 22
299245
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \\
299246
+ CMD pgrep sshd > /dev/null || exit 1
299247
+ ENTRYPOINT ["docker-entrypoint.sh"]
299248
+ CMD ["sshd", "-D", "-e"]
299249
+ `;
299250
+ const entrypoint = `#!/bin/bash
299251
+ set -e
299252
+ if [ -n "$SSH_PASSWORD" ]; then
299253
+ echo "node:\${SSH_PASSWORD}" | chpasswd
299254
+ else
299255
+ SSH_PASSWORD=$(head -c 16 /dev/urandom | base64)
299256
+ echo "node:\${SSH_PASSWORD}" | chpasswd
299257
+ echo "[oa-docker] Generated SSH password: \${SSH_PASSWORD}"
299258
+ fi
299259
+ if [ -n "$SSH_PUBLIC_KEY" ]; then
299260
+ mkdir -p /home/node/.ssh
299261
+ echo "$SSH_PUBLIC_KEY" > /home/node/.ssh/authorized_keys
299262
+ chmod 700 /home/node/.ssh && chmod 600 /home/node/.ssh/authorized_keys
299263
+ chown -R node:node /home/node/.ssh
299264
+ fi
299265
+ if [ -z "$OLLAMA_HOST" ] && [ "\${OPEN_AGENTS_BACKEND_TYPE}" = "ollama" ]; then
299266
+ export OLLAMA_HOST="http://host.docker.internal:11434"
299267
+ fi
299268
+ OA_CONFIG="/home/node/.open-agents/config.json"
299269
+ mkdir -p /home/node/.open-agents
299270
+ cat > "$OA_CONFIG" <<EOCFG
299271
+ {
299272
+ "backendType": "\${OPEN_AGENTS_BACKEND_TYPE:-ollama}",
299273
+ "backendUrl": "\${OLLAMA_HOST:-http://host.docker.internal:11434}",
299274
+ "model": "\${OPEN_AGENTS_MODEL:-qwen3:4b}"
299275
+ }
299276
+ EOCFG
299277
+ chown node:node "$OA_CONFIG"
299278
+ chown -R node:node /workspace /home/node/.oa /home/node/.open-agents 2>/dev/null || true
299279
+ if [ "$1" = "oa" ]; then shift; exec su - node -c "cd /workspace && oa $*"; fi
299280
+ exec "$@"
299281
+ `;
299282
+ writeFileSync28(join75(dir, "Dockerfile"), dockerfile);
299283
+ writeFileSync28(join75(dir, "docker-entrypoint.sh"), entrypoint, { mode: 493 });
299284
+ }
299285
+ function hasNvidiaGpu() {
299286
+ try {
299287
+ execSync35("nvidia-smi --query-gpu=name --format=csv,noheader", {
299288
+ stdio: "pipe",
299289
+ timeout: 5e3
299290
+ });
299291
+ const runtimes = execSync35("docker info --format '{{json .Runtimes}}'", {
299292
+ stdio: "pipe",
299293
+ timeout: 5e3
299294
+ }).toString();
299295
+ return runtimes.includes("nvidia");
299296
+ } catch {
299297
+ return false;
299298
+ }
299299
+ }
299300
+ function runInContainer(opts) {
299301
+ const args = ["run", "--rm"];
299302
+ if (opts.name) {
299303
+ args.push("--name", opts.name);
299304
+ }
299305
+ args.push("--add-host", "host.docker.internal:host-gateway");
299306
+ if (opts.gpu && hasNvidiaGpu()) {
299307
+ args.push("--gpus", "all");
299308
+ }
299309
+ args.push("--memory", "4g");
299310
+ args.push("--cpus", "2");
299311
+ const timeout2 = (opts.timeoutS || 120) + 30;
299312
+ args.push("--stop-timeout", String(timeout2));
299313
+ if (opts.workingDir) {
299314
+ const hostDir = resolve32(opts.workingDir);
299315
+ args.push("-v", `${hostDir}:/workspace`);
299316
+ }
299317
+ const ollamaHost = opts.ollamaHost || process.env["OLLAMA_HOST"] || "http://host.docker.internal:11434";
299318
+ args.push("-e", `OLLAMA_HOST=${ollamaHost}`);
299319
+ args.push("-e", "OPEN_AGENTS_BACKEND_TYPE=ollama");
299320
+ if (opts.model) {
299321
+ args.push("-e", `OPEN_AGENTS_MODEL=${opts.model}`);
299322
+ }
299323
+ if (opts.env) {
299324
+ for (const [k, v] of Object.entries(opts.env)) {
299325
+ if (k.startsWith("OA_") || k === "OLLAMA_HOST" || k === "OPENAI_API_KEY") {
299326
+ args.push("-e", `${k}=${v}`);
299327
+ }
299328
+ }
299329
+ }
299330
+ args.push(`${OA_IMAGE}:${OA_IMAGE_TAG}`);
299331
+ args.push("oa");
299332
+ const oaArgs = [opts.task, "--json"];
299333
+ if (opts.model)
299334
+ oaArgs.push("--model", opts.model);
299335
+ if (opts.maxTurns)
299336
+ oaArgs.push("--max-turns", String(opts.maxTurns));
299337
+ if (opts.timeoutS)
299338
+ oaArgs.push("--timeout", String(opts.timeoutS));
299339
+ args.push(...oaArgs);
299340
+ return spawn21("docker", args, {
299341
+ stdio: ["ignore", "pipe", "pipe"]
299342
+ });
299343
+ }
299344
+ var OA_IMAGE, OA_IMAGE_TAG;
299345
+ var init_docker = __esm({
299346
+ "packages/cli/dist/docker.js"() {
299347
+ "use strict";
299348
+ OA_IMAGE = "open-agents";
299349
+ OA_IMAGE_TAG = "latest";
299350
+ }
299351
+ });
299352
+
299159
299353
  // packages/cli/dist/api/serve.js
299160
299354
  var serve_exports = {};
299161
299355
  __export(serve_exports, {
@@ -299165,23 +299359,23 @@ __export(serve_exports, {
299165
299359
  import * as http5 from "node:http";
299166
299360
  import * as https3 from "node:https";
299167
299361
  import { createRequire as createRequire4 } from "node:module";
299168
- import { fileURLToPath as fileURLToPath14 } from "node:url";
299169
- import { dirname as dirname22, join as join75, resolve as resolve32 } from "node:path";
299170
- import { spawn as spawn21 } from "node:child_process";
299171
- import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync28, readFileSync as readFileSync46, readdirSync as readdirSync22, existsSync as existsSync57 } from "node:fs";
299362
+ import { fileURLToPath as fileURLToPath15 } from "node:url";
299363
+ import { dirname as dirname23, join as join76, resolve as resolve33 } from "node:path";
299364
+ import { spawn as spawn22 } from "node:child_process";
299365
+ import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync29, readFileSync as readFileSync46, readdirSync as readdirSync22, existsSync as existsSync58 } from "node:fs";
299172
299366
  import { randomBytes as randomBytes19, randomUUID as randomUUID5 } from "node:crypto";
299173
299367
  function getVersion3() {
299174
299368
  try {
299175
299369
  const require3 = createRequire4(import.meta.url);
299176
- const thisDir = dirname22(fileURLToPath14(import.meta.url));
299370
+ const thisDir = dirname23(fileURLToPath15(import.meta.url));
299177
299371
  const candidates = [
299178
- join75(thisDir, "..", "package.json"),
299179
- join75(thisDir, "..", "..", "package.json"),
299180
- join75(thisDir, "..", "..", "..", "package.json")
299372
+ join76(thisDir, "..", "package.json"),
299373
+ join76(thisDir, "..", "..", "package.json"),
299374
+ join76(thisDir, "..", "..", "..", "package.json")
299181
299375
  ];
299182
299376
  for (const pkgPath of candidates) {
299183
299377
  try {
299184
- if (!existsSync57(pkgPath))
299378
+ if (!existsSync58(pkgPath))
299185
299379
  continue;
299186
299380
  const pkg = require3(pkgPath);
299187
299381
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli" || pkg.name === "@open-agents/monorepo") {
@@ -299393,10 +299587,10 @@ function corsHeaders(req2, res) {
299393
299587
  return true;
299394
299588
  }
299395
299589
  function readBody(req2) {
299396
- return new Promise((resolve37, reject) => {
299590
+ return new Promise((resolve38, reject) => {
299397
299591
  const chunks = [];
299398
299592
  req2.on("data", (chunk) => chunks.push(chunk));
299399
- req2.on("end", () => resolve37(Buffer.concat(chunks).toString("utf-8")));
299593
+ req2.on("end", () => resolve38(Buffer.concat(chunks).toString("utf-8")));
299400
299594
  req2.on("error", reject);
299401
299595
  });
299402
299596
  }
@@ -299417,7 +299611,7 @@ function backendAuthHeaders(endpoint) {
299417
299611
  return {};
299418
299612
  }
299419
299613
  function ollamaRequest(ollamaUrl, path5, method, body) {
299420
- return new Promise((resolve37, reject) => {
299614
+ return new Promise((resolve38, reject) => {
299421
299615
  const url = new URL(path5, ollamaUrl);
299422
299616
  const isHttps = url.protocol === "https:";
299423
299617
  const options2 = {
@@ -299436,7 +299630,7 @@ function ollamaRequest(ollamaUrl, path5, method, body) {
299436
299630
  const chunks = [];
299437
299631
  proxyRes.on("data", (chunk) => chunks.push(chunk));
299438
299632
  proxyRes.on("end", () => {
299439
- resolve37({
299633
+ resolve38({
299440
299634
  status: proxyRes.statusCode ?? 500,
299441
299635
  headers: proxyRes.headers,
299442
299636
  body: Buffer.concat(chunks).toString("utf-8")
@@ -299481,14 +299675,14 @@ function ollamaStream(ollamaUrl, path5, method, body, onData, onEnd, onError) {
299481
299675
  proxyReq.end();
299482
299676
  }
299483
299677
  function jobsDir() {
299484
- const root = resolve32(process.cwd());
299485
- const dir = join75(root, ".oa", "jobs");
299486
- mkdirSync30(dir, { recursive: true });
299678
+ const root = resolve33(process.cwd());
299679
+ const dir = join76(root, ".oa", "jobs");
299680
+ mkdirSync31(dir, { recursive: true });
299487
299681
  return dir;
299488
299682
  }
299489
299683
  function loadJob(id) {
299490
- const file = join75(jobsDir(), `${id}.json`);
299491
- if (!existsSync57(file))
299684
+ const file = join76(jobsDir(), `${id}.json`);
299685
+ if (!existsSync58(file))
299492
299686
  return null;
299493
299687
  try {
299494
299688
  return JSON.parse(readFileSync46(file, "utf-8"));
@@ -299498,13 +299692,13 @@ function loadJob(id) {
299498
299692
  }
299499
299693
  function listJobs() {
299500
299694
  const dir = jobsDir();
299501
- if (!existsSync57(dir))
299695
+ if (!existsSync58(dir))
299502
299696
  return [];
299503
299697
  const files = readdirSync22(dir).filter((f2) => f2.endsWith(".json")).sort();
299504
299698
  const jobs = [];
299505
299699
  for (const file of files) {
299506
299700
  try {
299507
- jobs.push(JSON.parse(readFileSync46(join75(dir, file), "utf-8")));
299701
+ jobs.push(JSON.parse(readFileSync46(join76(dir, file), "utf-8")));
299508
299702
  } catch {
299509
299703
  }
299510
299704
  }
@@ -299934,13 +300128,26 @@ async function handleV1Run(req2, res) {
299934
300128
  jsonResponse(res, 400, { error: "Task too long", message: "Max 50,000 characters", length: task.length });
299935
300129
  return;
299936
300130
  }
299937
- const sandbox = requestBody["sandbox"] || process.env["OA_DEFAULT_SANDBOX"] || "none";
300131
+ const profileName = requestBody["profile"] || req2.headers["x-tool-profile"] || void 0;
300132
+ let activeProfile = null;
300133
+ if (profileName) {
300134
+ const profilePassword = req2.headers["x-profile-password"];
300135
+ activeProfile = PRESET_PROFILES[profileName] || loadProfile(profileName, profilePassword);
300136
+ if (!activeProfile) {
300137
+ jsonResponse(res, 400, { error: "Profile not found or wrong password", profile: profileName });
300138
+ return;
300139
+ }
300140
+ }
300141
+ const sandbox = requestBody["sandbox"] || activeProfile?.sandbox || process.env["OA_DEFAULT_SANDBOX"] || "none";
299938
300142
  if (sandbox === "container") {
299939
- try {
299940
- const { execSync: es } = __require("node:child_process");
299941
- es("docker --version", { stdio: "pipe", timeout: 5e3 });
299942
- } catch {
299943
- jsonResponse(res, 400, { error: "Container sandbox unavailable", message: "Docker not found. Install Docker or use sandbox:'none'." });
300143
+ if (!isDockerAvailable()) {
300144
+ jsonResponse(res, 400, { error: "Container sandbox unavailable", message: "Docker not found or daemon not running. Install Docker or use sandbox:'none'." });
300145
+ return;
300146
+ }
300147
+ if (!isOaImageBuilt()) {
300148
+ ensureOaImage().catch(() => {
300149
+ });
300150
+ jsonResponse(res, 503, { error: "Container image not ready", message: "Building open-agents Docker image. Retry in ~2 minutes." });
299944
300151
  return;
299945
300152
  }
299946
300153
  }
@@ -299950,13 +300157,13 @@ async function handleV1Run(req2, res) {
299950
300157
  const isolate = requestBody["isolate"] === true;
299951
300158
  let cwd4;
299952
300159
  if (workingDir) {
299953
- cwd4 = resolve32(workingDir);
300160
+ cwd4 = resolve33(workingDir);
299954
300161
  } else if (isolate) {
299955
- const wsDir = join75(dir, "..", "workspaces", id);
299956
- mkdirSync30(wsDir, { recursive: true });
300162
+ const wsDir = join76(dir, "..", "workspaces", id);
300163
+ mkdirSync31(wsDir, { recursive: true });
299957
300164
  cwd4 = wsDir;
299958
300165
  } else {
299959
- cwd4 = resolve32(process.cwd());
300166
+ cwd4 = resolve33(process.cwd());
299960
300167
  }
299961
300168
  const authUser = req2._authUser || "anonymous";
299962
300169
  const authScope = req2._authScope || "admin";
@@ -299982,15 +300189,7 @@ async function handleV1Run(req2, res) {
299982
300189
  const timeout2 = requestBody["timeout_s"];
299983
300190
  if (timeout2 && timeout2 > 0)
299984
300191
  args.push("--timeout", String(timeout2));
299985
- const profileName = requestBody["profile"] || req2.headers["x-tool-profile"] || void 0;
299986
- let activeProfile = null;
299987
- if (profileName) {
299988
- const profilePassword = req2.headers["x-profile-password"];
299989
- activeProfile = PRESET_PROFILES[profileName] || loadProfile(profileName, profilePassword);
299990
- if (!activeProfile) {
299991
- jsonResponse(res, 400, { error: "Profile not found or wrong password", profile: profileName });
299992
- return;
299993
- }
300192
+ if (activeProfile) {
299994
300193
  if (activeProfile.limits.max_turns && !requestBody["max_turns"]) {
299995
300194
  args.push("--max-turns", String(activeProfile.limits.max_turns));
299996
300195
  }
@@ -300022,15 +300221,34 @@ async function handleV1Run(req2, res) {
300022
300221
  }
300023
300222
  }
300024
300223
  }
300025
- const child = spawn21(process.execPath, [oaBin, ...args], {
300026
- cwd: cwd4,
300027
- env: runEnv,
300028
- stdio: ["ignore", "pipe", "pipe"],
300029
- detached: true
300030
- });
300031
- child.unref();
300224
+ let child;
300225
+ if (sandbox === "container") {
300226
+ const gpuEnabled = requestBody["gpu"] === true || hasNvidiaGpu();
300227
+ child = runInContainer({
300228
+ task,
300229
+ model: modelArg,
300230
+ maxTurns,
300231
+ timeoutS: timeout2,
300232
+ workingDir: workingDir || void 0,
300233
+ env: runEnv,
300234
+ profile: profileName,
300235
+ gpu: gpuEnabled,
300236
+ name: `oa-${id}`,
300237
+ ollamaHost: runEnv["OLLAMA_HOST"]
300238
+ });
300239
+ job.sandbox = "container";
300240
+ } else {
300241
+ child = spawn22(process.execPath, [oaBin, ...args], {
300242
+ cwd: cwd4,
300243
+ env: runEnv,
300244
+ stdio: ["ignore", "pipe", "pipe"],
300245
+ detached: true
300246
+ });
300247
+ child.unref();
300248
+ job.sandbox = sandbox;
300249
+ }
300032
300250
  job.pid = child.pid ?? 0;
300033
- writeFileSync28(join75(dir, `${id}.json`), JSON.stringify(job, null, 2));
300251
+ writeFileSync29(join76(dir, `${id}.json`), JSON.stringify(job, null, 2));
300034
300252
  runningProcesses.set(id, child);
300035
300253
  if (streamMode) {
300036
300254
  res.writeHead(200, {
@@ -300057,7 +300275,7 @@ async function handleV1Run(req2, res) {
300057
300275
  job.status = code8 === 0 ? "completed" : "failed";
300058
300276
  job.completedAt = (/* @__PURE__ */ new Date()).toISOString();
300059
300277
  try {
300060
- writeFileSync28(join75(dir, `${id}.json`), JSON.stringify(job, null, 2));
300278
+ writeFileSync29(join76(dir, `${id}.json`), JSON.stringify(job, null, 2));
300061
300279
  } catch {
300062
300280
  }
300063
300281
  runningProcesses.delete(id);
@@ -300097,7 +300315,7 @@ async function handleV1Run(req2, res) {
300097
300315
  job.completedAt = (/* @__PURE__ */ new Date()).toISOString();
300098
300316
  }
300099
300317
  try {
300100
- writeFileSync28(join75(dir, `${id}.json`), JSON.stringify(job, null, 2));
300318
+ writeFileSync29(join76(dir, `${id}.json`), JSON.stringify(job, null, 2));
300101
300319
  } catch {
300102
300320
  }
300103
300321
  runningProcesses.delete(id);
@@ -300146,7 +300364,7 @@ function handleV1RunsDelete(res, id) {
300146
300364
  job.error = "Aborted via API";
300147
300365
  const dir = jobsDir();
300148
300366
  try {
300149
- writeFileSync28(join75(dir, `${id}.json`), JSON.stringify(job, null, 2));
300367
+ writeFileSync29(join76(dir, `${id}.json`), JSON.stringify(job, null, 2));
300150
300368
  } catch {
300151
300369
  }
300152
300370
  runningProcesses.delete(id);
@@ -300258,7 +300476,7 @@ async function handlePostCommand(res, cmd) {
300258
300476
  return;
300259
300477
  }
300260
300478
  try {
300261
- const child = spawn21("node", [oaBin, "run", `/${cmd}`, "--json"], {
300479
+ const child = spawn22("node", [oaBin, "run", `/${cmd}`, "--json"], {
300262
300480
  env: { ...process.env, __OPEN_AGENTS_NO_AUTO_RUN: "" },
300263
300481
  stdio: ["ignore", "pipe", "pipe"],
300264
300482
  timeout: 3e4
@@ -300271,9 +300489,9 @@ async function handlePostCommand(res, cmd) {
300271
300489
  child.stderr?.on("data", (chunk) => {
300272
300490
  stderr += chunk.toString();
300273
300491
  });
300274
- await new Promise((resolve37) => {
300275
- child.on("exit", () => resolve37());
300276
- child.on("error", () => resolve37());
300492
+ await new Promise((resolve38) => {
300493
+ child.on("exit", () => resolve38());
300494
+ child.on("error", () => resolve38());
300277
300495
  });
300278
300496
  jsonResponse(res, 200, {
300279
300497
  command: cmd,
@@ -300369,8 +300587,8 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
300369
300587
  if (pathname === "/v1/files" && method === "GET") {
300370
300588
  const dir = urlObj.searchParams.get("path") || process.cwd();
300371
300589
  try {
300372
- const entries = readdirSync22(resolve32(dir), { withFileTypes: true }).filter((e2) => !e2.name.startsWith(".") && e2.name !== "node_modules").slice(0, 100).map((e2) => ({ name: e2.name, type: e2.isDirectory() ? "dir" : "file" }));
300373
- jsonResponse(res, 200, { path: resolve32(dir), entries });
300590
+ const entries = readdirSync22(resolve33(dir), { withFileTypes: true }).filter((e2) => !e2.name.startsWith(".") && e2.name !== "node_modules").slice(0, 100).map((e2) => ({ name: e2.name, type: e2.isDirectory() ? "dir" : "file" }));
300591
+ jsonResponse(res, 200, { path: resolve33(dir), entries });
300374
300592
  } catch (e2) {
300375
300593
  jsonResponse(res, 400, { error: e2.message });
300376
300594
  }
@@ -300444,7 +300662,7 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
300444
300662
  }
300445
300663
  const sessionId = chatBody.session_id;
300446
300664
  const model = chatBody.model || loadConfig().model;
300447
- const cwdPath = resolve32(process.cwd());
300665
+ const cwdPath = resolve33(process.cwd());
300448
300666
  const session = getSession(sessionId, model, cwdPath);
300449
300667
  addUserMessage(session, chatBody.message);
300450
300668
  compactSession(session);
@@ -300468,7 +300686,7 @@ ${historyLines}
300468
300686
  };
300469
300687
  if (currentCfg.apiKey)
300470
300688
  runEnv["OA_API_KEY_INHERIT"] = currentCfg.apiKey;
300471
- const child = spawn21(process.execPath, [oaBin, ...args], {
300689
+ const child = spawn22(process.execPath, [oaBin, ...args], {
300472
300690
  cwd: cwdPath,
300473
300691
  env: runEnv,
300474
300692
  stdio: ["ignore", "pipe", "pipe"]
@@ -300510,7 +300728,7 @@ ${historyLines}
300510
300728
  });
300511
300729
  child.stderr?.on("data", () => {
300512
300730
  });
300513
- await new Promise((resolve37) => {
300731
+ await new Promise((resolve38) => {
300514
300732
  child.on("close", () => {
300515
300733
  if (lineBuffer.trim())
300516
300734
  finalLines.push(lineBuffer);
@@ -300557,7 +300775,7 @@ ${historyLines}
300557
300775
  addAssistantMessage(session, fullContent);
300558
300776
  res.write("data: [DONE]\n\n");
300559
300777
  res.end();
300560
- resolve37();
300778
+ resolve38();
300561
300779
  });
300562
300780
  });
300563
300781
  return;
@@ -300583,7 +300801,7 @@ ${historyLines}
300583
300801
  });
300584
300802
  child.stderr?.on("data", () => {
300585
300803
  });
300586
- await new Promise((resolve37) => child.on("close", resolve37));
300804
+ await new Promise((resolve38) => child.on("close", resolve38));
300587
300805
  if (nonStreamBuf.trim())
300588
300806
  nonStreamLines.push(nonStreamBuf);
300589
300807
  const rawNonStream = nonStreamLines.join("\n").trim();
@@ -300839,19 +301057,19 @@ function startApiServer(options2 = {}) {
300839
301057
  const config = loadConfig();
300840
301058
  const ollamaUrl = options2.ollamaUrl ?? config.backendUrl;
300841
301059
  const cwd4 = process.cwd();
300842
- initAuditLog(join75(cwd4, ".oa"));
300843
- initUsageTracker(join75(cwd4, ".oa"));
301060
+ initAuditLog(join76(cwd4, ".oa"));
301061
+ initUsageTracker(join76(cwd4, ".oa"));
300844
301062
  const retentionDays = parseInt(process.env["OA_JOB_RETENTION_DAYS"] ?? "30", 10);
300845
301063
  if (retentionDays > 0) {
300846
301064
  try {
300847
- const jobsDir3 = join75(cwd4, ".oa", "jobs");
300848
- if (existsSync57(jobsDir3)) {
301065
+ const jobsDir3 = join76(cwd4, ".oa", "jobs");
301066
+ if (existsSync58(jobsDir3)) {
300849
301067
  const cutoff = Date.now() - retentionDays * 864e5;
300850
301068
  for (const f2 of readdirSync22(jobsDir3)) {
300851
301069
  if (!f2.endsWith(".json"))
300852
301070
  continue;
300853
301071
  try {
300854
- const jobPath = join75(jobsDir3, f2);
301072
+ const jobPath = join76(jobsDir3, f2);
300855
301073
  const job = JSON.parse(readFileSync46(jobPath, "utf-8"));
300856
301074
  const jobTime = new Date(job.startedAt ?? job.completedAt ?? 0).getTime();
300857
301075
  if (jobTime > 0 && jobTime < cutoff && job.status !== "running") {
@@ -300872,8 +301090,8 @@ function startApiServer(options2 = {}) {
300872
301090
  if (useTls) {
300873
301091
  try {
300874
301092
  tlsOpts = {
300875
- cert: readFileSync46(resolve32(tlsCert)),
300876
- key: readFileSync46(resolve32(tlsKey))
301093
+ cert: readFileSync46(resolve33(tlsCert)),
301094
+ key: readFileSync46(resolve33(tlsKey))
300877
301095
  };
300878
301096
  } catch (e2) {
300879
301097
  log22(`
@@ -301009,8 +301227,8 @@ async function apiServeCommand(opts, config) {
301009
301227
  verbose: opts.verbose,
301010
301228
  ollamaUrl: config.backendUrl
301011
301229
  });
301012
- await new Promise((resolve37) => {
301013
- server.on("close", resolve37);
301230
+ await new Promise((resolve38) => {
301231
+ server.on("close", resolve38);
301014
301232
  });
301015
301233
  }
301016
301234
  var endpointRegistry, modelRouteMap, endpointUsage, metrics, startedAt, _corsOrigins, _corsLocalOnly, runningProcesses, perKeyUsage;
@@ -301028,6 +301246,7 @@ var init_serve = __esm({
301028
301246
  init_oa_directory();
301029
301247
  init_render();
301030
301248
  init_profiles();
301249
+ init_docker();
301031
301250
  endpointRegistry = [];
301032
301251
  modelRouteMap = /* @__PURE__ */ new Map();
301033
301252
  endpointUsage = /* @__PURE__ */ new Map();
@@ -301047,13 +301266,13 @@ var init_serve = __esm({
301047
301266
 
301048
301267
  // packages/cli/dist/tui/interactive.js
301049
301268
  import { cwd } from "node:process";
301050
- import { resolve as resolve33, join as join76, dirname as dirname23, extname as extname11 } from "node:path";
301269
+ import { resolve as resolve34, join as join77, dirname as dirname24, extname as extname11 } from "node:path";
301051
301270
  import { createRequire as createRequire5 } from "node:module";
301052
- import { fileURLToPath as fileURLToPath15 } from "node:url";
301053
- import { readFileSync as readFileSync47, writeFileSync as writeFileSync29, appendFileSync as appendFileSync6, rmSync as rmSync3, readdirSync as readdirSync23, mkdirSync as mkdirSync31 } from "node:fs";
301054
- import { existsSync as existsSync58 } from "node:fs";
301055
- import { execSync as execSync35 } from "node:child_process";
301056
- import { homedir as homedir20 } from "node:os";
301271
+ import { fileURLToPath as fileURLToPath16 } from "node:url";
301272
+ import { readFileSync as readFileSync47, writeFileSync as writeFileSync30, appendFileSync as appendFileSync6, rmSync as rmSync3, readdirSync as readdirSync23, mkdirSync as mkdirSync32 } from "node:fs";
301273
+ import { existsSync as existsSync59 } from "node:fs";
301274
+ import { execSync as execSync36 } from "node:child_process";
301275
+ import { homedir as homedir21 } from "node:os";
301057
301276
  function formatTimeAgo(date) {
301058
301277
  const seconds = Math.floor((Date.now() - date.getTime()) / 1e3);
301059
301278
  if (seconds < 60)
@@ -301070,14 +301289,14 @@ function formatTimeAgo(date) {
301070
301289
  function getVersion4() {
301071
301290
  try {
301072
301291
  const require3 = createRequire5(import.meta.url);
301073
- const thisDir = dirname23(fileURLToPath15(import.meta.url));
301292
+ const thisDir = dirname24(fileURLToPath16(import.meta.url));
301074
301293
  const candidates = [
301075
- join76(thisDir, "..", "package.json"),
301076
- join76(thisDir, "..", "..", "package.json"),
301077
- join76(thisDir, "..", "..", "..", "package.json")
301294
+ join77(thisDir, "..", "package.json"),
301295
+ join77(thisDir, "..", "..", "package.json"),
301296
+ join77(thisDir, "..", "..", "..", "package.json")
301078
301297
  ];
301079
301298
  for (const pkgPath of candidates) {
301080
- if (existsSync58(pkgPath)) {
301299
+ if (existsSync59(pkgPath)) {
301081
301300
  const pkg = require3(pkgPath);
301082
301301
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli" || pkg.name === "@open-agents/monorepo") {
301083
301302
  return pkg.version ?? "0.0.0";
@@ -301317,15 +301536,15 @@ Use task_status("${taskId}") or task_output("${taskId}") to check progress.`
301317
301536
  function gatherMemorySnippets(root) {
301318
301537
  const snippets = [];
301319
301538
  const dirs = [
301320
- join76(root, ".oa", "memory"),
301321
- join76(root, ".open-agents", "memory")
301539
+ join77(root, ".oa", "memory"),
301540
+ join77(root, ".open-agents", "memory")
301322
301541
  ];
301323
301542
  for (const dir of dirs) {
301324
- if (!existsSync58(dir))
301543
+ if (!existsSync59(dir))
301325
301544
  continue;
301326
301545
  try {
301327
301546
  for (const f2 of readdirSync23(dir).filter((f3) => f3.endsWith(".json"))) {
301328
- const data = JSON.parse(readFileSync47(join76(dir, f2), "utf-8"));
301547
+ const data = JSON.parse(readFileSync47(join77(dir, f2), "utf-8"));
301329
301548
  for (const val of Object.values(data)) {
301330
301549
  const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
301331
301550
  if (v.length > 10)
@@ -301482,8 +301701,8 @@ ${metabolismMemories}
301482
301701
  } catch {
301483
301702
  }
301484
301703
  try {
301485
- const archeFile = join76(repoRoot, ".oa", "arche", "variants.json");
301486
- if (existsSync58(archeFile)) {
301704
+ const archeFile = join77(repoRoot, ".oa", "arche", "variants.json");
301705
+ if (existsSync59(archeFile)) {
301487
301706
  const variants = JSON.parse(readFileSync47(archeFile, "utf8"));
301488
301707
  if (variants.length > 0) {
301489
301708
  let filtered = variants;
@@ -301653,8 +301872,8 @@ RULES:
301653
301872
  const compactionThreshold = modelTier === "small" ? 12e3 : modelTier === "medium" ? 24e3 : 4e4;
301654
301873
  let identityInjection = "";
301655
301874
  try {
301656
- const ikStateFile = join76(repoRoot, ".oa", "identity", "self-state.json");
301657
- if (existsSync58(ikStateFile)) {
301875
+ const ikStateFile = join77(repoRoot, ".oa", "identity", "self-state.json");
301876
+ if (existsSync59(ikStateFile)) {
301658
301877
  const selfState = JSON.parse(readFileSync47(ikStateFile, "utf8"));
301659
301878
  const lines = [
301660
301879
  `[Identity State v${selfState.version}]`,
@@ -302306,13 +302525,13 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
302306
302525
  });
302307
302526
  }
302308
302527
  try {
302309
- const ikDir = join76(repoRoot, ".oa", "identity");
302310
- const ikFile = join76(ikDir, "self-state.json");
302528
+ const ikDir = join77(repoRoot, ".oa", "identity");
302529
+ const ikFile = join77(ikDir, "self-state.json");
302311
302530
  let ikState;
302312
- if (existsSync58(ikFile)) {
302531
+ if (existsSync59(ikFile)) {
302313
302532
  ikState = JSON.parse(readFileSync47(ikFile, "utf8"));
302314
302533
  } else {
302315
- mkdirSync31(ikDir, { recursive: true });
302534
+ mkdirSync32(ikDir, { recursive: true });
302316
302535
  const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
302317
302536
  ikState = {
302318
302537
  self_id: `oa-${machineId}`,
@@ -302338,7 +302557,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
302338
302557
  }
302339
302558
  ikState.session_count = (ikState.session_count || 0) + 1;
302340
302559
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
302341
- writeFileSync29(ikFile, JSON.stringify(ikState, null, 2));
302560
+ writeFileSync30(ikFile, JSON.stringify(ikState, null, 2));
302342
302561
  } catch (ikErr) {
302343
302562
  try {
302344
302563
  console.error("[IK-OBSERVE]", ikErr);
@@ -302353,14 +302572,14 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
302353
302572
  } else {
302354
302573
  renderTaskIncomplete(result.turns, result.toolCalls, result.durationMs, tokens);
302355
302574
  try {
302356
- const ikFile = join76(repoRoot, ".oa", "identity", "self-state.json");
302357
- if (existsSync58(ikFile)) {
302575
+ const ikFile = join77(repoRoot, ".oa", "identity", "self-state.json");
302576
+ if (existsSync59(ikFile)) {
302358
302577
  const ikState = JSON.parse(readFileSync47(ikFile, "utf8"));
302359
302578
  ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
302360
302579
  ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
302361
302580
  ikState.session_count = (ikState.session_count || 0) + 1;
302362
302581
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
302363
- writeFileSync29(ikFile, JSON.stringify(ikState, null, 2));
302582
+ writeFileSync30(ikFile, JSON.stringify(ikState, null, 2));
302364
302583
  }
302365
302584
  } catch {
302366
302585
  }
@@ -302438,7 +302657,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
302438
302657
  } };
302439
302658
  }
302440
302659
  async function startInteractive(config, repoPath) {
302441
- const repoRoot = resolve33(repoPath ?? cwd());
302660
+ const repoRoot = resolve34(repoPath ?? cwd());
302442
302661
  const resumeFlag = process.env.__OA_RESUMED ?? "";
302443
302662
  const isResumed = resumeFlag !== "";
302444
302663
  const hasTaskToResume = resumeFlag === "1";
@@ -302457,9 +302676,9 @@ async function startInteractive(config, repoPath) {
302457
302676
  process.stdin.pause();
302458
302677
  }
302459
302678
  try {
302460
- const oaDir = join76(repoRoot, ".oa");
302461
- const nexusPidFile = join76(oaDir, "nexus", "daemon.pid");
302462
- if (existsSync58(nexusPidFile)) {
302679
+ const oaDir = join77(repoRoot, ".oa");
302680
+ const nexusPidFile = join77(oaDir, "nexus", "daemon.pid");
302681
+ if (existsSync59(nexusPidFile)) {
302463
302682
  const pid = parseInt(readFileSync47(nexusPidFile, "utf8").trim(), 10);
302464
302683
  if (pid > 0) {
302465
302684
  try {
@@ -302718,14 +302937,14 @@ Review its full output in the [${id}] tab or via full_sub_agent(action='output',
302718
302937
  renderInfo(msg);
302719
302938
  statusBar.endContentWrite();
302720
302939
  }
302721
- }, () => new Promise((resolve37) => {
302940
+ }, () => new Promise((resolve38) => {
302722
302941
  depSudoPromptPending = true;
302723
302942
  depSudoResolver = (pw) => {
302724
302943
  depSudoPromptPending = false;
302725
302944
  depSudoResolver = null;
302726
302945
  if (pw)
302727
302946
  sessionSudoPassword = pw;
302728
- resolve37(pw);
302947
+ resolve38(pw);
302729
302948
  };
302730
302949
  const pwPrompt = `
302731
302950
  ${c3.bold(c3.yellow("\u{1F511} Password needed for dependency install:"))}
@@ -302797,7 +303016,7 @@ Review its full output in the [${id}] tab or via full_sub_agent(action='output',
302797
303016
  let p2pGateway = null;
302798
303017
  let peerMesh = null;
302799
303018
  let inferenceRouter = null;
302800
- const secretVault = new SecretVault(join76(repoRoot, ".oa", "vault.enc"));
303019
+ const secretVault = new SecretVault(join77(repoRoot, ".oa", "vault.enc"));
302801
303020
  let adminSessionKey = null;
302802
303021
  const callSubAgents = /* @__PURE__ */ new Map();
302803
303022
  const streamRenderer = new StreamRenderer();
@@ -303020,12 +303239,12 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
303020
303239
  const hits = allCompletions.filter((c4) => c4.toLowerCase().startsWith(lower));
303021
303240
  return [hits, line];
303022
303241
  }
303023
- const HISTORY_DIR = join76(homedir20(), ".open-agents");
303024
- const HISTORY_FILE = join76(HISTORY_DIR, "repl-history");
303242
+ const HISTORY_DIR = join77(homedir21(), ".open-agents");
303243
+ const HISTORY_FILE = join77(HISTORY_DIR, "repl-history");
303025
303244
  const MAX_HISTORY_LINES = 500;
303026
303245
  let savedHistory = [];
303027
303246
  try {
303028
- if (existsSync58(HISTORY_FILE)) {
303247
+ if (existsSync59(HISTORY_FILE)) {
303029
303248
  const raw = readFileSync47(HISTORY_FILE, "utf8").trim();
303030
303249
  if (raw)
303031
303250
  savedHistory = raw.split("\n").reverse();
@@ -303129,12 +303348,12 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
303129
303348
  if (!line.trim())
303130
303349
  return;
303131
303350
  try {
303132
- mkdirSync31(HISTORY_DIR, { recursive: true });
303351
+ mkdirSync32(HISTORY_DIR, { recursive: true });
303133
303352
  appendFileSync6(HISTORY_FILE, line + "\n", "utf8");
303134
303353
  if (Math.random() < 0.02) {
303135
303354
  const all2 = readFileSync47(HISTORY_FILE, "utf8").trim().split("\n");
303136
303355
  if (all2.length > MAX_HISTORY_LINES) {
303137
- writeFileSync29(HISTORY_FILE, all2.slice(-MAX_HISTORY_LINES).join("\n") + "\n", "utf8");
303356
+ writeFileSync30(HISTORY_FILE, all2.slice(-MAX_HISTORY_LINES).join("\n") + "\n", "utf8");
303138
303357
  }
303139
303358
  }
303140
303359
  } catch {
@@ -303311,10 +303530,10 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
303311
303530
  const { unlinkSync: _rmStale } = await import("node:fs");
303312
303531
  const { homedir: _hdir } = await import("node:os");
303313
303532
  for (const dp of [
303314
- join76(repoRoot, ".oa", "nexus", "nexus-daemon.mjs"),
303315
- join76(_hdir(), ".open-agents", ".oa", "nexus", "nexus-daemon.mjs")
303533
+ join77(repoRoot, ".oa", "nexus", "nexus-daemon.mjs"),
303534
+ join77(_hdir(), ".open-agents", ".oa", "nexus", "nexus-daemon.mjs")
303316
303535
  ]) {
303317
- if (existsSync58(dp))
303536
+ if (existsSync59(dp))
303318
303537
  try {
303319
303538
  _rmStale(dp);
303320
303539
  } catch {
@@ -303326,8 +303545,8 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
303326
303545
  const autoNexus = new NexusTool(repoRoot);
303327
303546
  const _registerNexusDaemon = () => {
303328
303547
  try {
303329
- const nexusPidFile = join76(repoRoot, ".oa", "nexus", "daemon.pid");
303330
- if (existsSync58(nexusPidFile)) {
303548
+ const nexusPidFile = join77(repoRoot, ".oa", "nexus", "daemon.pid");
303549
+ if (existsSync59(nexusPidFile)) {
303331
303550
  const nPid = parseInt(readFileSync47(nexusPidFile, "utf8").trim(), 10);
303332
303551
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
303333
303552
  registry2.register({ name: "Nexus", pid: nPid, startedAt: Date.now(), status: "running" });
@@ -303369,7 +303588,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
303369
303588
  } catch {
303370
303589
  }
303371
303590
  try {
303372
- const oaDir = join76(repoRoot, ".oa");
303591
+ const oaDir = join77(repoRoot, ".oa");
303373
303592
  const reconnected = await ExposeGateway.checkAndReconnect(oaDir, {
303374
303593
  onInfo: (msg) => writeContent(() => renderInfo(msg)),
303375
303594
  onError: (msg) => writeContent(() => renderWarning(msg))
@@ -303401,7 +303620,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
303401
303620
  } catch {
303402
303621
  }
303403
303622
  try {
303404
- const oaDir = join76(repoRoot, ".oa");
303623
+ const oaDir = join77(repoRoot, ".oa");
303405
303624
  const reconnectedP2P = await ExposeP2PGateway.checkAndReconnect(oaDir, new NexusTool(repoRoot), {
303406
303625
  onInfo: (msg) => writeContent(() => renderInfo(msg)),
303407
303626
  onError: (msg) => writeContent(() => renderWarning(msg))
@@ -303442,10 +303661,10 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
303442
303661
  }
303443
303662
  try {
303444
303663
  const { homedir: _hd, hostname: _hn, userInfo: _ui } = await import("node:os");
303445
- const globalNamePath = join76(_hd(), ".open-agents", "agent-name");
303664
+ const globalNamePath = join77(_hd(), ".open-agents", "agent-name");
303446
303665
  let agName = "";
303447
303666
  try {
303448
- if (existsSync58(globalNamePath))
303667
+ if (existsSync59(globalNamePath))
303449
303668
  agName = readFileSync47(globalNamePath, "utf8").trim();
303450
303669
  } catch {
303451
303670
  }
@@ -303475,10 +303694,10 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
303475
303694
  }
303476
303695
  if (!ollamaAlive) {
303477
303696
  try {
303478
- const savedSponsorsPath = join76(repoRoot, ".oa", "sponsor", "known-sponsors.json");
303697
+ const savedSponsorsPath = join77(repoRoot, ".oa", "sponsor", "known-sponsors.json");
303479
303698
  let savedSponsors = [];
303480
303699
  try {
303481
- if (existsSync58(savedSponsorsPath)) {
303700
+ if (existsSync59(savedSponsorsPath)) {
303482
303701
  savedSponsors = JSON.parse(readFileSync47(savedSponsorsPath, "utf8"));
303483
303702
  const oneHourAgo = Date.now() - 36e5;
303484
303703
  savedSponsors = savedSponsors.filter((s2) => (s2.lastVerified || 0) > oneHourAgo);
@@ -304437,7 +304656,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
304437
304656
  kind,
304438
304657
  targetUrl,
304439
304658
  authKey,
304440
- stateDir: join76(repoRoot, ".oa"),
304659
+ stateDir: join77(repoRoot, ".oa"),
304441
304660
  passthrough: passthrough ?? false,
304442
304661
  loadbalance: loadbalance ?? false,
304443
304662
  endpointAuth: passthrough ? currentConfig.apiKey : void 0,
@@ -304483,7 +304702,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
304483
304702
  await tunnelGateway.stop();
304484
304703
  tunnelGateway = null;
304485
304704
  }
304486
- const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir: join76(repoRoot, ".oa") });
304705
+ const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir: join77(repoRoot, ".oa") });
304487
304706
  newTunnel.on("stats", (stats) => {
304488
304707
  statusBar.setExposeStatus({
304489
304708
  status: stats.status,
@@ -304572,8 +304791,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
304572
304791
  if (!result.success)
304573
304792
  throw new Error(result.error || "Connect failed");
304574
304793
  try {
304575
- const nexusPidFile = join76(repoRoot, ".oa", "nexus", "daemon.pid");
304576
- if (existsSync58(nexusPidFile)) {
304794
+ const nexusPidFile = join77(repoRoot, ".oa", "nexus", "daemon.pid");
304795
+ if (existsSync59(nexusPidFile)) {
304577
304796
  const pid = parseInt(readFileSync47(nexusPidFile, "utf8").trim(), 10);
304578
304797
  if (pid > 0) {
304579
304798
  registry2.register({
@@ -304770,15 +304989,15 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
304770
304989
  writeContent(() => renderInfo(`Killed ${bgKilled} background task(s).`));
304771
304990
  }
304772
304991
  try {
304773
- const nexusDir = join76(repoRoot, OA_DIR, "nexus");
304774
- const pidFile = join76(nexusDir, "daemon.pid");
304775
- if (existsSync58(pidFile)) {
304992
+ const nexusDir = join77(repoRoot, OA_DIR, "nexus");
304993
+ const pidFile = join77(nexusDir, "daemon.pid");
304994
+ if (existsSync59(pidFile)) {
304776
304995
  const pid = parseInt(readFileSync47(pidFile, "utf8").trim(), 10);
304777
304996
  if (pid > 0) {
304778
304997
  try {
304779
304998
  if (process.platform === "win32") {
304780
304999
  try {
304781
- execSync35(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
305000
+ execSync36(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
304782
305001
  } catch {
304783
305002
  }
304784
305003
  } else {
@@ -304795,17 +305014,17 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
304795
305014
  } catch {
304796
305015
  }
304797
305016
  try {
304798
- const voiceDir2 = join76(homedir20(), ".open-agents", "voice");
305017
+ const voiceDir2 = join77(homedir21(), ".open-agents", "voice");
304799
305018
  const voicePidFiles = ["luxtts-daemon.pid", "piper-daemon.pid"];
304800
305019
  for (const pf of voicePidFiles) {
304801
- const pidPath = join76(voiceDir2, pf);
304802
- if (existsSync58(pidPath)) {
305020
+ const pidPath = join77(voiceDir2, pf);
305021
+ if (existsSync59(pidPath)) {
304803
305022
  try {
304804
305023
  const pid = parseInt(readFileSync47(pidPath, "utf8").trim(), 10);
304805
305024
  if (pid > 0) {
304806
305025
  if (process.platform === "win32") {
304807
305026
  try {
304808
- execSync35(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
305027
+ execSync36(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
304809
305028
  } catch {
304810
305029
  }
304811
305030
  } else {
@@ -304822,11 +305041,11 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
304822
305041
  } catch {
304823
305042
  }
304824
305043
  try {
304825
- execSync35(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
305044
+ execSync36(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
304826
305045
  } catch {
304827
305046
  }
304828
- const oaPath = join76(repoRoot, OA_DIR);
304829
- if (existsSync58(oaPath)) {
305047
+ const oaPath = join77(repoRoot, OA_DIR);
305048
+ if (existsSync59(oaPath)) {
304830
305049
  let deleted = false;
304831
305050
  for (let attempt = 0; attempt < 3; attempt++) {
304832
305051
  try {
@@ -304836,14 +305055,14 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
304836
305055
  } catch (err) {
304837
305056
  if (attempt < 2) {
304838
305057
  try {
304839
- execSync35(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.3", { timeout: 3e3, stdio: "ignore" });
305058
+ execSync36(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.3", { timeout: 3e3, stdio: "ignore" });
304840
305059
  } catch {
304841
305060
  }
304842
305061
  } else {
304843
305062
  writeContent(() => renderWarning(`Could not fully remove ${OA_DIR}/: ${err instanceof Error ? err.message : String(err)}`));
304844
305063
  if (process.platform === "win32") {
304845
305064
  try {
304846
- execSync35(`rd /s /q "${oaPath}"`, { timeout: 1e4, stdio: "ignore" });
305065
+ execSync36(`rd /s /q "${oaPath}"`, { timeout: 1e4, stdio: "ignore" });
304847
305066
  deleted = true;
304848
305067
  } catch {
304849
305068
  }
@@ -304909,18 +305128,18 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
304909
305128
  try {
304910
305129
  const { isPersonaPlexRunning: isPersonaPlexRunning2 } = await Promise.resolve().then(() => (init_personaplex(), personaplex_exports));
304911
305130
  if (isPersonaPlexRunning2()) {
304912
- const ppPidFile = join76(homedir20(), ".open-agents", "voice", "personaplex", "daemon.pid");
304913
- const ppPortFile = join76(homedir20(), ".open-agents", "voice", "personaplex", "daemon.port");
304914
- if (existsSync58(ppPidFile)) {
305131
+ const ppPidFile = join77(homedir21(), ".open-agents", "voice", "personaplex", "daemon.pid");
305132
+ const ppPortFile = join77(homedir21(), ".open-agents", "voice", "personaplex", "daemon.port");
305133
+ if (existsSync59(ppPidFile)) {
304915
305134
  const ppPid = parseInt(readFileSync47(ppPidFile, "utf8").trim(), 10);
304916
- const ppPort = existsSync58(ppPortFile) ? parseInt(readFileSync47(ppPortFile, "utf8").trim(), 10) : void 0;
305135
+ const ppPort = existsSync59(ppPortFile) ? parseInt(readFileSync47(ppPortFile, "utf8").trim(), 10) : void 0;
304917
305136
  if (ppPid > 0 && !registry2.daemons.has("PersonaPlex")) {
304918
305137
  registry2.register({ name: "PersonaPlex", pid: ppPid, port: ppPort, startedAt: Date.now(), status: "running" });
304919
305138
  }
304920
305139
  }
304921
305140
  }
304922
- const nexusPidFile = join76(repoRoot, ".oa", "nexus", "daemon.pid");
304923
- if (existsSync58(nexusPidFile)) {
305141
+ const nexusPidFile = join77(repoRoot, ".oa", "nexus", "daemon.pid");
305142
+ if (existsSync59(nexusPidFile)) {
304924
305143
  const nPid = parseInt(readFileSync47(nexusPidFile, "utf8").trim(), 10);
304925
305144
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
304926
305145
  try {
@@ -305263,8 +305482,8 @@ Execute this skill now. Follow the behavioral guidance above.`;
305263
305482
  }
305264
305483
  }
305265
305484
  const cleanPath = input.replace(/^['"]|['"]$/g, "").trim();
305266
- const isImage = isImagePath(cleanPath) && existsSync58(resolve33(repoRoot, cleanPath));
305267
- const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync58(resolve33(repoRoot, cleanPath));
305485
+ const isImage = isImagePath(cleanPath) && existsSync59(resolve34(repoRoot, cleanPath));
305486
+ const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync59(resolve34(repoRoot, cleanPath));
305268
305487
  if (activeTask) {
305269
305488
  if (activeTask.runner.isPaused) {
305270
305489
  activeTask.runner.resume();
@@ -305272,7 +305491,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
305272
305491
  }
305273
305492
  if (isImage) {
305274
305493
  try {
305275
- const imgPath = resolve33(repoRoot, cleanPath);
305494
+ const imgPath = resolve34(repoRoot, cleanPath);
305276
305495
  const imgBuffer = readFileSync47(imgPath);
305277
305496
  const base642 = imgBuffer.toString("base64");
305278
305497
  const ext = extname11(cleanPath).toLowerCase();
@@ -305286,7 +305505,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
305286
305505
  } else if (isMedia) {
305287
305506
  writeContent(() => renderInfo(`Transcribing: ${cleanPath}...`));
305288
305507
  const engine = getListenEngine();
305289
- const result = await engine.transcribeFile(resolve33(repoRoot, cleanPath), repoRoot);
305508
+ const result = await engine.transcribeFile(resolve34(repoRoot, cleanPath), repoRoot);
305290
305509
  if (result) {
305291
305510
  const transcript = `[Transcription of ${cleanPath}]
305292
305511
  ${result.text}`;
@@ -305430,7 +305649,7 @@ ${result.text}`;
305430
305649
  const ext = cleanPath.toLowerCase().split(".").pop() || "";
305431
305650
  if (cloneExts.includes("." + ext)) {
305432
305651
  writeContent(() => renderInfo(`Setting voice clone reference: ${cleanPath}`));
305433
- const msg = await voiceEngine.setCloneVoice(resolve33(repoRoot, cleanPath));
305652
+ const msg = await voiceEngine.setCloneVoice(resolve34(repoRoot, cleanPath));
305434
305653
  writeContent(() => renderInfo(msg));
305435
305654
  showPrompt();
305436
305655
  return;
@@ -305439,7 +305658,7 @@ ${result.text}`;
305439
305658
  if (isMedia && fullInput === input) {
305440
305659
  writeContent(() => renderInfo(`Transcribing: ${cleanPath}...`));
305441
305660
  const engine = getListenEngine();
305442
- const result = await engine.transcribeFile(resolve33(repoRoot, cleanPath), repoRoot);
305661
+ const result = await engine.transcribeFile(resolve34(repoRoot, cleanPath), repoRoot);
305443
305662
  if (result) {
305444
305663
  fullInput = `The user has provided an audio/video file: ${cleanPath}.
305445
305664
 
@@ -305488,7 +305707,7 @@ Summarize or analyze this transcription as appropriate.`;
305488
305707
 
305489
305708
  NEW TASK: ${fullInput}`;
305490
305709
  restoredSessionContext = null;
305491
- } else if (existsSync58(join76(repoRoot, ".oa", "context", "session-diary.md"))) {
305710
+ } else if (existsSync59(join77(repoRoot, ".oa", "context", "session-diary.md"))) {
305492
305711
  taskInput = `[Previous sessions exist \u2014 file_read(".oa/context/session-diary.md") to recall]
305493
305712
 
305494
305713
  ${fullInput}`;
@@ -305759,7 +305978,7 @@ ${c3.dim("(Use /quit to exit)")}
305759
305978
  };
305760
305979
  }
305761
305980
  async function runWithTUI(task, config, repoPath, callbacks) {
305762
- const repoRoot = resolve33(repoPath ?? cwd());
305981
+ const repoRoot = resolve34(repoPath ?? cwd());
305763
305982
  const needsSetup = isFirstRun() || !await isModelAvailable(config);
305764
305983
  if (needsSetup && config.backendType === "ollama") {
305765
305984
  const setupModel = await runSetupWizard(config);
@@ -305806,13 +306025,13 @@ async function runWithTUI(task, config, repoPath, callbacks) {
305806
306025
  const handle2 = startTask(task, config, repoRoot);
305807
306026
  await handle2.promise;
305808
306027
  try {
305809
- const ikDir = join76(repoRoot, ".oa", "identity");
305810
- const ikFile = join76(ikDir, "self-state.json");
306028
+ const ikDir = join77(repoRoot, ".oa", "identity");
306029
+ const ikFile = join77(ikDir, "self-state.json");
305811
306030
  let ikState;
305812
- if (existsSync58(ikFile)) {
306031
+ if (existsSync59(ikFile)) {
305813
306032
  ikState = JSON.parse(readFileSync47(ikFile, "utf8"));
305814
306033
  } else {
305815
- mkdirSync31(ikDir, { recursive: true });
306034
+ mkdirSync32(ikDir, { recursive: true });
305816
306035
  ikState = {
305817
306036
  self_id: `oa-${Date.now().toString(36)}`,
305818
306037
  version: 1,
@@ -305834,7 +306053,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
305834
306053
  ikState.homeostasis.coherence = Math.min(1, ikState.homeostasis.coherence + 0.05);
305835
306054
  ikState.session_count = (ikState.session_count || 0) + 1;
305836
306055
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
305837
- writeFileSync29(ikFile, JSON.stringify(ikState, null, 2));
306056
+ writeFileSync30(ikFile, JSON.stringify(ikState, null, 2));
305838
306057
  } catch (ikErr) {
305839
306058
  }
305840
306059
  try {
@@ -305843,11 +306062,11 @@ async function runWithTUI(task, config, repoPath, callbacks) {
305843
306062
  ec.archiveVariantSync(`Task: ${task.slice(0, 200)}`, "success \u2014 completed", ["general"]);
305844
306063
  } catch {
305845
306064
  try {
305846
- const archeDir = join76(repoRoot, ".oa", "arche");
305847
- const archeFile = join76(archeDir, "variants.json");
306065
+ const archeDir = join77(repoRoot, ".oa", "arche");
306066
+ const archeFile = join77(archeDir, "variants.json");
305848
306067
  let variants = [];
305849
306068
  try {
305850
- if (existsSync58(archeFile))
306069
+ if (existsSync59(archeFile))
305851
306070
  variants = JSON.parse(readFileSync47(archeFile, "utf8"));
305852
306071
  } catch {
305853
306072
  }
@@ -305863,14 +306082,14 @@ async function runWithTUI(task, config, repoPath, callbacks) {
305863
306082
  });
305864
306083
  if (variants.length > 50)
305865
306084
  variants = variants.slice(-50);
305866
- mkdirSync31(archeDir, { recursive: true });
305867
- writeFileSync29(archeFile, JSON.stringify(variants, null, 2));
306085
+ mkdirSync32(archeDir, { recursive: true });
306086
+ writeFileSync30(archeFile, JSON.stringify(variants, null, 2));
305868
306087
  } catch {
305869
306088
  }
305870
306089
  }
305871
306090
  try {
305872
- const metaFile = join76(repoRoot, ".oa", "memory", "metabolism", "store.json");
305873
- if (existsSync58(metaFile)) {
306091
+ const metaFile = join77(repoRoot, ".oa", "memory", "metabolism", "store.json");
306092
+ if (existsSync59(metaFile)) {
305874
306093
  const store2 = JSON.parse(readFileSync47(metaFile, "utf8"));
305875
306094
  const surfaced = store2.filter((m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15).sort((a2, b) => b.scores.utility * b.scores.confidence - a2.scores.utility * a2.scores.confidence).slice(0, 5);
305876
306095
  let updated = false;
@@ -305882,7 +306101,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
305882
306101
  updated = true;
305883
306102
  }
305884
306103
  if (updated) {
305885
- writeFileSync29(metaFile, JSON.stringify(store2, null, 2));
306104
+ writeFileSync30(metaFile, JSON.stringify(store2, null, 2));
305886
306105
  }
305887
306106
  }
305888
306107
  } catch {
@@ -305935,9 +306154,9 @@ Rules:
305935
306154
  try {
305936
306155
  const { initDb: initDb2 } = __require("@open-agents/memory");
305937
306156
  const { ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
305938
- const dbDir = join76(repoRoot, ".oa", "memory");
305939
- mkdirSync31(dbDir, { recursive: true });
305940
- const db = initDb2(join76(dbDir, "structured.db"));
306157
+ const dbDir = join77(repoRoot, ".oa", "memory");
306158
+ mkdirSync32(dbDir, { recursive: true });
306159
+ const db = initDb2(join77(dbDir, "structured.db"));
305941
306160
  const memStore = new ProceduralMemoryStore2(db);
305942
306161
  memStore.createWithEmbedding({
305943
306162
  content: content.slice(0, 600),
@@ -305952,11 +306171,11 @@ Rules:
305952
306171
  db.close();
305953
306172
  } catch {
305954
306173
  }
305955
- const metaDir = join76(repoRoot, ".oa", "memory", "metabolism");
305956
- const storeFile = join76(metaDir, "store.json");
306174
+ const metaDir = join77(repoRoot, ".oa", "memory", "metabolism");
306175
+ const storeFile = join77(metaDir, "store.json");
305957
306176
  let store2 = [];
305958
306177
  try {
305959
- if (existsSync58(storeFile))
306178
+ if (existsSync59(storeFile))
305960
306179
  store2 = JSON.parse(readFileSync47(storeFile, "utf8"));
305961
306180
  } catch {
305962
306181
  }
@@ -305973,25 +306192,25 @@ Rules:
305973
306192
  });
305974
306193
  if (store2.length > 100)
305975
306194
  store2 = store2.slice(-100);
305976
- mkdirSync31(metaDir, { recursive: true });
305977
- writeFileSync29(storeFile, JSON.stringify(store2, null, 2));
306195
+ mkdirSync32(metaDir, { recursive: true });
306196
+ writeFileSync30(storeFile, JSON.stringify(store2, null, 2));
305978
306197
  }
305979
306198
  }
305980
306199
  } catch {
305981
306200
  }
305982
306201
  try {
305983
- const cohereSettingsFile = join76(repoRoot, ".oa", "settings.json");
306202
+ const cohereSettingsFile = join77(repoRoot, ".oa", "settings.json");
305984
306203
  let cohereActive = false;
305985
306204
  try {
305986
- if (existsSync58(cohereSettingsFile)) {
306205
+ if (existsSync59(cohereSettingsFile)) {
305987
306206
  const settings = JSON.parse(readFileSync47(cohereSettingsFile, "utf8"));
305988
306207
  cohereActive = settings.cohere === true;
305989
306208
  }
305990
306209
  } catch {
305991
306210
  }
305992
306211
  if (cohereActive) {
305993
- const metaFile = join76(repoRoot, ".oa", "memory", "metabolism", "store.json");
305994
- if (existsSync58(metaFile)) {
306212
+ const metaFile = join77(repoRoot, ".oa", "memory", "metabolism", "store.json");
306213
+ if (existsSync59(metaFile)) {
305995
306214
  const store2 = JSON.parse(readFileSync47(metaFile, "utf8"));
305996
306215
  const latest = store2.filter((m2) => m2.sourceTrace === "trajectory-extraction" || m2.sourceTrace === "llm-trajectory-extraction").slice(-1)[0];
305997
306216
  if (latest && latest.scores?.confidence >= 0.6) {
@@ -306017,17 +306236,17 @@ Rules:
306017
306236
  }
306018
306237
  } catch (err) {
306019
306238
  try {
306020
- const ikFile = join76(repoRoot, ".oa", "identity", "self-state.json");
306021
- if (existsSync58(ikFile)) {
306239
+ const ikFile = join77(repoRoot, ".oa", "identity", "self-state.json");
306240
+ if (existsSync59(ikFile)) {
306022
306241
  const ikState = JSON.parse(readFileSync47(ikFile, "utf8"));
306023
306242
  ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
306024
306243
  ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
306025
306244
  ikState.session_count = (ikState.session_count || 0) + 1;
306026
306245
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
306027
- writeFileSync29(ikFile, JSON.stringify(ikState, null, 2));
306246
+ writeFileSync30(ikFile, JSON.stringify(ikState, null, 2));
306028
306247
  }
306029
- const metaFile = join76(repoRoot, ".oa", "memory", "metabolism", "store.json");
306030
- if (existsSync58(metaFile)) {
306248
+ const metaFile = join77(repoRoot, ".oa", "memory", "metabolism", "store.json");
306249
+ if (existsSync59(metaFile)) {
306031
306250
  const store2 = JSON.parse(readFileSync47(metaFile, "utf8"));
306032
306251
  const surfaced = store2.filter((m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15).sort((a2, b) => b.scores.utility * b.scores.confidence - a2.scores.utility * a2.scores.confidence).slice(0, 5);
306033
306252
  for (const item of surfaced) {
@@ -306036,14 +306255,14 @@ Rules:
306036
306255
  item.scores.utility = Math.max(0, (item.scores.utility || 0.5) - 0.05);
306037
306256
  item.scores.confidence = Math.max(0, (item.scores.confidence || 0.5) - 0.02);
306038
306257
  }
306039
- writeFileSync29(metaFile, JSON.stringify(store2, null, 2));
306258
+ writeFileSync30(metaFile, JSON.stringify(store2, null, 2));
306040
306259
  }
306041
306260
  try {
306042
- const archeDir = join76(repoRoot, ".oa", "arche");
306043
- const archeFile = join76(archeDir, "variants.json");
306261
+ const archeDir = join77(repoRoot, ".oa", "arche");
306262
+ const archeFile = join77(archeDir, "variants.json");
306044
306263
  let variants = [];
306045
306264
  try {
306046
- if (existsSync58(archeFile))
306265
+ if (existsSync59(archeFile))
306047
306266
  variants = JSON.parse(readFileSync47(archeFile, "utf8"));
306048
306267
  } catch {
306049
306268
  }
@@ -306059,8 +306278,8 @@ Rules:
306059
306278
  });
306060
306279
  if (variants.length > 50)
306061
306280
  variants = variants.slice(-50);
306062
- mkdirSync31(archeDir, { recursive: true });
306063
- writeFileSync29(archeFile, JSON.stringify(variants, null, 2));
306281
+ mkdirSync32(archeDir, { recursive: true });
306282
+ writeFileSync30(archeFile, JSON.stringify(variants, null, 2));
306064
306283
  } catch {
306065
306284
  }
306066
306285
  } catch {
@@ -306129,15 +306348,15 @@ __export(run_exports, {
306129
306348
  runCommand: () => runCommand,
306130
306349
  statusCommand: () => statusCommand
306131
306350
  });
306132
- import { resolve as resolve34 } from "node:path";
306133
- import { spawn as spawn22 } from "node:child_process";
306134
- import { mkdirSync as mkdirSync32, writeFileSync as writeFileSync30, readFileSync as readFileSync48, readdirSync as readdirSync24, existsSync as existsSync59 } from "node:fs";
306351
+ import { resolve as resolve35 } from "node:path";
306352
+ import { spawn as spawn23 } from "node:child_process";
306353
+ import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync31, readFileSync as readFileSync48, readdirSync as readdirSync24, existsSync as existsSync60 } from "node:fs";
306135
306354
  import { randomBytes as randomBytes20 } from "node:crypto";
306136
- import { join as join77 } from "node:path";
306355
+ import { join as join78 } from "node:path";
306137
306356
  function jobsDir2(repoPath) {
306138
- const root = resolve34(repoPath ?? process.cwd());
306139
- const dir = join77(root, ".oa", "jobs");
306140
- mkdirSync32(dir, { recursive: true });
306357
+ const root = resolve35(repoPath ?? process.cwd());
306358
+ const dir = join78(root, ".oa", "jobs");
306359
+ mkdirSync33(dir, { recursive: true });
306141
306360
  return dir;
306142
306361
  }
306143
306362
  async function runCommand(opts, config) {
@@ -306228,7 +306447,7 @@ function extractSummary(captured) {
306228
306447
  async function runBackground(task, config, opts) {
306229
306448
  const id = `job-${randomBytes20(3).toString("hex")}`;
306230
306449
  const dir = jobsDir2(opts.repoPath);
306231
- const repoRoot = resolve34(opts.repoPath ?? process.cwd());
306450
+ const repoRoot = resolve35(opts.repoPath ?? process.cwd());
306232
306451
  const job = {
306233
306452
  id,
306234
306453
  pid: 0,
@@ -306240,7 +306459,7 @@ async function runBackground(task, config, opts) {
306240
306459
  const args = [task, "--json"];
306241
306460
  if (config.model)
306242
306461
  args.push("--model", config.model);
306243
- const child = spawn22(process.execPath, [oaBin, ...args], {
306462
+ const child = spawn23(process.execPath, [oaBin, ...args], {
306244
306463
  cwd: repoRoot,
306245
306464
  env: { ...process.env, OA_JOB_ID: id },
306246
306465
  stdio: ["ignore", "pipe", "pipe"],
@@ -306248,7 +306467,7 @@ async function runBackground(task, config, opts) {
306248
306467
  });
306249
306468
  child.unref();
306250
306469
  job.pid = child.pid ?? 0;
306251
- writeFileSync30(join77(dir, `${id}.json`), JSON.stringify(job, null, 2));
306470
+ writeFileSync31(join78(dir, `${id}.json`), JSON.stringify(job, null, 2));
306252
306471
  let output = "";
306253
306472
  child.stdout?.on("data", (chunk) => {
306254
306473
  output += chunk.toString();
@@ -306264,7 +306483,7 @@ async function runBackground(task, config, opts) {
306264
306483
  job.summary = result.summary;
306265
306484
  job.durationMs = result.durationMs;
306266
306485
  job.error = result.error;
306267
- writeFileSync30(join77(dir, `${id}.json`), JSON.stringify(job, null, 2));
306486
+ writeFileSync31(join78(dir, `${id}.json`), JSON.stringify(job, null, 2));
306268
306487
  } catch {
306269
306488
  }
306270
306489
  });
@@ -306280,8 +306499,8 @@ async function runBackground(task, config, opts) {
306280
306499
  }
306281
306500
  function statusCommand(jobId, repoPath) {
306282
306501
  const dir = jobsDir2(repoPath);
306283
- const file = join77(dir, `${jobId}.json`);
306284
- if (!existsSync59(file)) {
306502
+ const file = join78(dir, `${jobId}.json`);
306503
+ if (!existsSync60(file)) {
306285
306504
  console.error(`Job not found: ${jobId}`);
306286
306505
  console.log(`Available jobs: oa jobs`);
306287
306506
  process.exit(1);
@@ -306309,7 +306528,7 @@ function jobsCommand(repoPath) {
306309
306528
  console.log("Jobs:");
306310
306529
  for (const file of files) {
306311
306530
  try {
306312
- const job = JSON.parse(readFileSync48(join77(dir, file), "utf-8"));
306531
+ const job = JSON.parse(readFileSync48(join78(dir, file), "utf-8"));
306313
306532
  const icon = job.status === "completed" ? "\u2713" : job.status === "failed" ? "\u2717" : "\u25CF";
306314
306533
  const runtime = job.completedAt ? `${((new Date(job.completedAt).getTime() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s` : `${((Date.now() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s`;
306315
306534
  console.log(` ${icon} ${job.id} [${job.status}] ${runtime} \u2014 ${job.task.slice(0, 60)}`);
@@ -306329,7 +306548,7 @@ import { glob as glob2 } from "glob";
306329
306548
  import ignore from "ignore";
306330
306549
  import { readFile as readFile23, stat as stat5 } from "node:fs/promises";
306331
306550
  import { createHash as createHash6 } from "node:crypto";
306332
- import { join as join78, relative as relative4, extname as extname12, basename as basename18 } from "node:path";
306551
+ import { join as join79, relative as relative4, extname as extname12, basename as basename18 } from "node:path";
306333
306552
  var DEFAULT_EXCLUDE, LANGUAGE_MAP, CodebaseIndexer;
306334
306553
  var init_codebase_indexer = __esm({
306335
306554
  "packages/indexer/dist/codebase-indexer.js"() {
@@ -306373,7 +306592,7 @@ var init_codebase_indexer = __esm({
306373
306592
  const ig = ignore.default();
306374
306593
  if (this.config.respectGitignore) {
306375
306594
  try {
306376
- const gitignoreContent = await readFile23(join78(this.config.rootDir, ".gitignore"), "utf-8");
306595
+ const gitignoreContent = await readFile23(join79(this.config.rootDir, ".gitignore"), "utf-8");
306377
306596
  ig.add(gitignoreContent);
306378
306597
  } catch {
306379
306598
  }
@@ -306388,7 +306607,7 @@ var init_codebase_indexer = __esm({
306388
306607
  for (const relativePath of files) {
306389
306608
  if (ig.ignores(relativePath))
306390
306609
  continue;
306391
- const fullPath = join78(this.config.rootDir, relativePath);
306610
+ const fullPath = join79(this.config.rootDir, relativePath);
306392
306611
  try {
306393
306612
  const fileStat = await stat5(fullPath);
306394
306613
  if (fileStat.size > this.config.maxFileSize)
@@ -306434,7 +306653,7 @@ var init_codebase_indexer = __esm({
306434
306653
  if (!child) {
306435
306654
  child = {
306436
306655
  name: part,
306437
- path: join78(current.path, part),
306656
+ path: join79(current.path, part),
306438
306657
  type: "directory",
306439
306658
  children: []
306440
306659
  };
@@ -306516,14 +306735,14 @@ var index_repo_exports = {};
306516
306735
  __export(index_repo_exports, {
306517
306736
  indexRepoCommand: () => indexRepoCommand
306518
306737
  });
306519
- import { resolve as resolve35 } from "node:path";
306520
- import { existsSync as existsSync60, statSync as statSync17 } from "node:fs";
306738
+ import { resolve as resolve36 } from "node:path";
306739
+ import { existsSync as existsSync61, statSync as statSync17 } from "node:fs";
306521
306740
  import { cwd as cwd2 } from "node:process";
306522
306741
  async function indexRepoCommand(opts, _config2) {
306523
- const repoRoot = resolve35(opts.repoPath ?? cwd2());
306742
+ const repoRoot = resolve36(opts.repoPath ?? cwd2());
306524
306743
  printHeader("Index Repository");
306525
306744
  printInfo(`Indexing: ${repoRoot}`);
306526
- if (!existsSync60(repoRoot)) {
306745
+ if (!existsSync61(repoRoot)) {
306527
306746
  printError(`Path does not exist: ${repoRoot}`);
306528
306747
  process.exit(1);
306529
306748
  }
@@ -306775,8 +306994,8 @@ var config_exports2 = {};
306775
306994
  __export(config_exports2, {
306776
306995
  configCommand: () => configCommand
306777
306996
  });
306778
- import { join as join79, resolve as resolve36 } from "node:path";
306779
- import { homedir as homedir21 } from "node:os";
306997
+ import { join as join80, resolve as resolve37 } from "node:path";
306998
+ import { homedir as homedir22 } from "node:os";
306780
306999
  import { cwd as cwd3 } from "node:process";
306781
307000
  function redactIfSensitive(key, value2) {
306782
307001
  if (SENSITIVE_KEYS.has(key) && typeof value2 === "string" && value2.length > 0) {
@@ -306808,7 +307027,7 @@ async function configCommand(opts, config) {
306808
307027
  return handleShow(opts, config);
306809
307028
  }
306810
307029
  function handleShow(opts, config) {
306811
- const repoRoot = resolve36(opts.repoPath ?? cwd3());
307030
+ const repoRoot = resolve37(opts.repoPath ?? cwd3());
306812
307031
  printHeader("Configuration");
306813
307032
  const resolved = resolveSettings(repoRoot);
306814
307033
  printSection("Core Inference");
@@ -306858,7 +307077,7 @@ function handleShow(opts, config) {
306858
307077
  }
306859
307078
  }
306860
307079
  printSection("Config File");
306861
- printInfo(`~/.open-agents/config.json (${join79(homedir21(), ".open-agents", "config.json")})`);
307080
+ printInfo(`~/.open-agents/config.json (${join80(homedir22(), ".open-agents", "config.json")})`);
306862
307081
  printSection("Priority Chain");
306863
307082
  printInfo(" 1. CLI flags (--model, --backend-url, etc.)");
306864
307083
  printInfo(" 2. Project .oa/settings.json (--local)");
@@ -306891,13 +307110,13 @@ function handleSet(opts, _config2) {
306891
307110
  process.exit(1);
306892
307111
  }
306893
307112
  if (opts.local) {
306894
- const repoRoot = resolve36(opts.repoPath ?? cwd3());
307113
+ const repoRoot = resolve37(opts.repoPath ?? cwd3());
306895
307114
  try {
306896
307115
  initOaDirectory(repoRoot);
306897
307116
  const coerced = coerceForSettings(key, value2);
306898
307117
  saveProjectSettings(repoRoot, { [key]: coerced });
306899
307118
  printSuccess(`Project override set: ${key} = ${redactIfSensitive(key, value2)}`);
306900
- printInfo(`Saved to ${join79(repoRoot, ".oa", "settings.json")}`);
307119
+ printInfo(`Saved to ${join80(repoRoot, ".oa", "settings.json")}`);
306901
307120
  printInfo("This override applies only when running in this workspace.");
306902
307121
  } catch (err) {
306903
307122
  printError(`Failed to save: ${err instanceof Error ? err.message : String(err)}`);
@@ -307005,14 +307224,14 @@ async function serveCommand(opts, config) {
307005
307224
  printInfo(`Backend: ${config.backendType} (${ollamaUrl})`);
307006
307225
  try {
307007
307226
  const server = startApiServer({ port, ollamaUrl });
307008
- await new Promise((resolve37) => {
307227
+ await new Promise((resolve38) => {
307009
307228
  process.on("SIGINT", () => {
307010
307229
  server.close();
307011
- resolve37();
307230
+ resolve38();
307012
307231
  });
307013
307232
  process.on("SIGTERM", () => {
307014
307233
  server.close();
307015
- resolve37();
307234
+ resolve38();
307016
307235
  });
307017
307236
  });
307018
307237
  } catch (err) {
@@ -307040,8 +307259,8 @@ __export(eval_exports, {
307040
307259
  evalCommand: () => evalCommand
307041
307260
  });
307042
307261
  import { tmpdir as tmpdir10 } from "node:os";
307043
- import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync31 } from "node:fs";
307044
- import { join as join80 } from "node:path";
307262
+ import { mkdirSync as mkdirSync34, writeFileSync as writeFileSync32 } from "node:fs";
307263
+ import { join as join81 } from "node:path";
307045
307264
  async function evalCommand(opts, config) {
307046
307265
  const suiteName = opts.suite ?? "basic";
307047
307266
  const suite = SUITES[suiteName];
@@ -307166,9 +307385,9 @@ async function evalCommand(opts, config) {
307166
307385
  process.exit(failed > 0 ? 1 : 0);
307167
307386
  }
307168
307387
  function createTempEvalRepo() {
307169
- const dir = join80(tmpdir10(), `open-agents-eval-${Date.now()}`);
307170
- mkdirSync33(dir, { recursive: true });
307171
- writeFileSync31(join80(dir, "package.json"), JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n", "utf8");
307388
+ const dir = join81(tmpdir10(), `open-agents-eval-${Date.now()}`);
307389
+ mkdirSync34(dir, { recursive: true });
307390
+ writeFileSync32(join81(dir, "package.json"), JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n", "utf8");
307172
307391
  return dir;
307173
307392
  }
307174
307393
  var BASIC_SUITE, FULL_SUITE, SUITES;
@@ -307227,8 +307446,8 @@ init_output();
307227
307446
  init_updater();
307228
307447
  import { parseArgs as nodeParseArgs2 } from "node:util";
307229
307448
  import { createRequire as createRequire6 } from "node:module";
307230
- import { fileURLToPath as fileURLToPath16 } from "node:url";
307231
- import { dirname as dirname24, join as join81 } from "node:path";
307449
+ import { fileURLToPath as fileURLToPath17 } from "node:url";
307450
+ import { dirname as dirname25, join as join82 } from "node:path";
307232
307451
 
307233
307452
  // packages/cli/dist/cli.js
307234
307453
  import { createInterface } from "node:readline";
@@ -307335,7 +307554,7 @@ init_output();
307335
307554
  function getVersion5() {
307336
307555
  try {
307337
307556
  const require3 = createRequire6(import.meta.url);
307338
- const pkgPath = join81(dirname24(fileURLToPath16(import.meta.url)), "..", "package.json");
307557
+ const pkgPath = join82(dirname25(fileURLToPath17(import.meta.url)), "..", "package.json");
307339
307558
  const pkg = require3(pkgPath);
307340
307559
  return pkg.version;
307341
307560
  } catch {
@@ -307610,12 +307829,12 @@ function crashLog(label, err) {
307610
307829
  const logLine = `[${timestamp}] ${label}: ${msg}
307611
307830
  `;
307612
307831
  try {
307613
- const { appendFileSync: appendFileSync7, mkdirSync: mkdirSync34 } = __require("node:fs");
307614
- const { join: join82 } = __require("node:path");
307615
- const { homedir: homedir22 } = __require("node:os");
307616
- const logDir = join82(homedir22(), ".open-agents");
307617
- mkdirSync34(logDir, { recursive: true });
307618
- appendFileSync7(join82(logDir, "crash.log"), logLine);
307832
+ const { appendFileSync: appendFileSync7, mkdirSync: mkdirSync35 } = __require("node:fs");
307833
+ const { join: join83 } = __require("node:path");
307834
+ const { homedir: homedir23 } = __require("node:os");
307835
+ const logDir = join83(homedir23(), ".open-agents");
307836
+ mkdirSync35(logDir, { recursive: true });
307837
+ appendFileSync7(join83(logDir, "crash.log"), logLine);
307619
307838
  } catch {
307620
307839
  }
307621
307840
  try {