@moxxy/cli 0.14.9 → 0.14.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { z as z$1, createMutex, defineTunnelProvider, definePlugin, defineProvider, defineTool, MoxxyError, asTurnId, defineMode, asPluginId, defineCommand, defineChannel, defineWorkflowExecutor, toFriendlyError, estimateTextTokens, classifyHttpStatus, createStuckLoopDetector, runCompactionIfNeeded, runElisionIfNeeded, collectProviderStream, usageEventFields, isContextOverflowError, emitRequestsAndDetectStuck, executeToolUses, buildSystemPromptWithSkills, projectMessages, defineCompactor, defineCacheStrategy, denyByDefaultResolver, createAllowListResolver, zodToJsonSchema, fileDiffSummary, runSingleShotTurn, toolResultBytes, defineSurface, runManualCompaction, isFileDiffDisplay, renderFrontmatter, defineEmbedder, migrateModeName, skillFrontmatterSchema, asSkillId, startChannelWith, parseFrontmatterFile, createDeferredPermissionResolver, getInstallHint, defineTranscriber, summarizeTokensByModel, moxxyPackageSchema, encodeLoginPrompt, classifyNetworkError, addModelTotals, createJsonFileStore, ISOLATION_RANK, MOXXY_PCM16_24KHZ_MIME, fileDiffVerb, parseFrontmatter, createCallbackResolver, countNodes, autoAllowResolver, asSessionId, asToolCallId, defineViewRenderer, DEFAULT_VIEW_TAGS, isSafeViewUrl, evaluateToolRule, summarizeSessionTokensFromEvents, toDiffRows, diffGutterNo, computeElisionState, toolResultStubbed, toolResultStub, conversationalStubbed, conversationalStub, asEventId } from '@moxxy/sdk';
3
+ import { z as z$1, createMutex, defineTunnelProvider, definePlugin, defineProvider, defineTool, MoxxyError, asTurnId, defineMode, asPluginId, defineCommand, defineChannel, defineWorkflowExecutor, toFriendlyError, estimateTextTokens, classifyHttpStatus, createStuckLoopDetector, runCompactionIfNeeded, runElisionIfNeeded, collectProviderStream, usageEventFields, isContextOverflowError, nextBackoffMs, emitRequestsAndDetectStuck, executeToolUses, buildSystemPromptWithSkills, projectMessages, defineCompactor, defineCacheStrategy, denyByDefaultResolver, createAllowListResolver, zodToJsonSchema, fileDiffSummary, sleepWithAbort, runSingleShotTurn, toolResultBytes, defineSurface, runManualCompaction, isFileDiffDisplay, renderFrontmatter, defineEmbedder, migrateModeName, skillFrontmatterSchema, asSkillId, startChannelWith, parseFrontmatterFile, createDeferredPermissionResolver, getInstallHint, defineTranscriber, summarizeTokensByModel, moxxyPackageSchema, encodeLoginPrompt, classifyNetworkError, addModelTotals, createJsonFileStore, ISOLATION_RANK, MOXXY_PCM16_24KHZ_MIME, fileDiffVerb, parseFrontmatter, createCallbackResolver, countNodes, autoAllowResolver, asSessionId, asToolCallId, defineViewRenderer, DEFAULT_VIEW_TAGS, isSafeViewUrl, evaluateToolRule, summarizeSessionTokensFromEvents, toDiffRows, diffGutterNo, computeElisionState, toolResultStubbed, toolResultStub, conversationalStubbed, conversationalStub, asEventId } from '@moxxy/sdk';
4
4
  import * as fs32 from 'fs';
5
5
  import fs32__default, { existsSync, promises, readFileSync, ReadStream, mkdirSync, writeFileSync, rmSync, statSync, readdirSync, openSync, closeSync, unlinkSync, renameSync, realpathSync, chmodSync, watch, lstatSync, createReadStream } from 'fs';
6
6
  import * as path3 from 'path';
@@ -886,14 +886,13 @@ function createSubagentSpawner(rt3) {
886
886
  return runChildTurn({ rt: rt3, spec, retainSession: spec.retainSession === true });
887
887
  },
888
888
  async spawnAll(specs) {
889
- const settled = await Promise.all(specs.map(async (spec) => {
890
- try {
891
- return await runChildTurn({ rt: rt3, spec, retainSession: spec.retainSession === true });
892
- } catch (err) {
893
- return spawnFailureResult(spec, err);
894
- }
895
- }));
896
- return settled;
889
+ const outcomes = await Promise.allSettled(specs.map((spec) => runChildTurn({ rt: rt3, spec, retainSession: spec.retainSession === true })));
890
+ return outcomes.map((outcome, i2) => {
891
+ if (outcome.status === "fulfilled")
892
+ return outcome.value;
893
+ const spec = specs[i2];
894
+ return spawnFailureResult(spec ?? { }, outcome.reason);
895
+ });
897
896
  },
898
897
  async continue(args) {
899
898
  return continueChildTurn(args);
@@ -1297,7 +1296,7 @@ function toposortPluginManifests(manifests) {
1297
1296
  const order = [];
1298
1297
  const visited = /* @__PURE__ */ new Set();
1299
1298
  const onStack = /* @__PURE__ */ new Set();
1300
- const path60 = [];
1299
+ const path59 = [];
1301
1300
  const visitRoot = (root) => {
1302
1301
  if (visited.has(root))
1303
1302
  return;
@@ -1306,7 +1305,7 @@ function toposortPluginManifests(manifests) {
1306
1305
  return;
1307
1306
  const stack = [{ name: root, deps: pluginDeps(rootManifest.requirements), next: 0 }];
1308
1307
  onStack.add(root);
1309
- path60.push(root);
1308
+ path59.push(root);
1310
1309
  while (stack.length > 0) {
1311
1310
  const frame = stack[stack.length - 1];
1312
1311
  if (!frame)
@@ -1318,20 +1317,20 @@ function toposortPluginManifests(manifests) {
1318
1317
  if (visited.has(dep))
1319
1318
  continue;
1320
1319
  if (onStack.has(dep)) {
1321
- const startIdx = path60.indexOf(dep);
1322
- throw new PluginCycleError(path60.slice(startIdx).concat(dep));
1320
+ const startIdx = path59.indexOf(dep);
1321
+ throw new PluginCycleError(path59.slice(startIdx).concat(dep));
1323
1322
  }
1324
1323
  const depManifest = byPackage.get(dep);
1325
1324
  if (!depManifest)
1326
1325
  continue;
1327
1326
  onStack.add(dep);
1328
- path60.push(dep);
1327
+ path59.push(dep);
1329
1328
  stack.push({ name: dep, deps: pluginDeps(depManifest.requirements), next: 0 });
1330
1329
  continue;
1331
1330
  }
1332
1331
  const done = stack.pop();
1333
1332
  onStack.delete(done.name);
1334
- path60.pop();
1333
+ path59.pop();
1335
1334
  visited.add(done.name);
1336
1335
  const manifest = byPackage.get(done.name);
1337
1336
  if (manifest)
@@ -2948,8 +2947,8 @@ var init_skills = __esm({
2948
2947
  });
2949
2948
  function formatZodIssues(error2) {
2950
2949
  return error2.issues.map((iss) => {
2951
- const path60 = iss.path.length ? iss.path.join(".") : "(root)";
2952
- return `${path60}: ${iss.message}`;
2950
+ const path59 = iss.path.length ? iss.path.join(".") : "(root)";
2951
+ return `${path59}: ${iss.message}`;
2953
2952
  }).join("; ");
2954
2953
  }
2955
2954
  function emptyLog() {
@@ -9232,17 +9231,17 @@ var require_visit = __commonJS({
9232
9231
  visit.BREAK = BREAK;
9233
9232
  visit.SKIP = SKIP;
9234
9233
  visit.REMOVE = REMOVE;
9235
- function visit_(key, node, visitor, path60) {
9236
- const ctrl = callVisitor(key, node, visitor, path60);
9234
+ function visit_(key, node, visitor, path59) {
9235
+ const ctrl = callVisitor(key, node, visitor, path59);
9237
9236
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
9238
- replaceNode(key, path60, ctrl);
9239
- return visit_(key, ctrl, visitor, path60);
9237
+ replaceNode(key, path59, ctrl);
9238
+ return visit_(key, ctrl, visitor, path59);
9240
9239
  }
9241
9240
  if (typeof ctrl !== "symbol") {
9242
9241
  if (identity.isCollection(node)) {
9243
- path60 = Object.freeze(path60.concat(node));
9242
+ path59 = Object.freeze(path59.concat(node));
9244
9243
  for (let i2 = 0; i2 < node.items.length; ++i2) {
9245
- const ci = visit_(i2, node.items[i2], visitor, path60);
9244
+ const ci = visit_(i2, node.items[i2], visitor, path59);
9246
9245
  if (typeof ci === "number")
9247
9246
  i2 = ci - 1;
9248
9247
  else if (ci === BREAK)
@@ -9253,13 +9252,13 @@ var require_visit = __commonJS({
9253
9252
  }
9254
9253
  }
9255
9254
  } else if (identity.isPair(node)) {
9256
- path60 = Object.freeze(path60.concat(node));
9257
- const ck = visit_("key", node.key, visitor, path60);
9255
+ path59 = Object.freeze(path59.concat(node));
9256
+ const ck = visit_("key", node.key, visitor, path59);
9258
9257
  if (ck === BREAK)
9259
9258
  return BREAK;
9260
9259
  else if (ck === REMOVE)
9261
9260
  node.key = null;
9262
- const cv = visit_("value", node.value, visitor, path60);
9261
+ const cv = visit_("value", node.value, visitor, path59);
9263
9262
  if (cv === BREAK)
9264
9263
  return BREAK;
9265
9264
  else if (cv === REMOVE)
@@ -9280,17 +9279,17 @@ var require_visit = __commonJS({
9280
9279
  visitAsync.BREAK = BREAK;
9281
9280
  visitAsync.SKIP = SKIP;
9282
9281
  visitAsync.REMOVE = REMOVE;
9283
- async function visitAsync_(key, node, visitor, path60) {
9284
- const ctrl = await callVisitor(key, node, visitor, path60);
9282
+ async function visitAsync_(key, node, visitor, path59) {
9283
+ const ctrl = await callVisitor(key, node, visitor, path59);
9285
9284
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
9286
- replaceNode(key, path60, ctrl);
9287
- return visitAsync_(key, ctrl, visitor, path60);
9285
+ replaceNode(key, path59, ctrl);
9286
+ return visitAsync_(key, ctrl, visitor, path59);
9288
9287
  }
9289
9288
  if (typeof ctrl !== "symbol") {
9290
9289
  if (identity.isCollection(node)) {
9291
- path60 = Object.freeze(path60.concat(node));
9290
+ path59 = Object.freeze(path59.concat(node));
9292
9291
  for (let i2 = 0; i2 < node.items.length; ++i2) {
9293
- const ci = await visitAsync_(i2, node.items[i2], visitor, path60);
9292
+ const ci = await visitAsync_(i2, node.items[i2], visitor, path59);
9294
9293
  if (typeof ci === "number")
9295
9294
  i2 = ci - 1;
9296
9295
  else if (ci === BREAK)
@@ -9301,13 +9300,13 @@ var require_visit = __commonJS({
9301
9300
  }
9302
9301
  }
9303
9302
  } else if (identity.isPair(node)) {
9304
- path60 = Object.freeze(path60.concat(node));
9305
- const ck = await visitAsync_("key", node.key, visitor, path60);
9303
+ path59 = Object.freeze(path59.concat(node));
9304
+ const ck = await visitAsync_("key", node.key, visitor, path59);
9306
9305
  if (ck === BREAK)
9307
9306
  return BREAK;
9308
9307
  else if (ck === REMOVE)
9309
9308
  node.key = null;
9310
- const cv = await visitAsync_("value", node.value, visitor, path60);
9309
+ const cv = await visitAsync_("value", node.value, visitor, path59);
9311
9310
  if (cv === BREAK)
9312
9311
  return BREAK;
9313
9312
  else if (cv === REMOVE)
@@ -9334,23 +9333,23 @@ var require_visit = __commonJS({
9334
9333
  }
9335
9334
  return visitor;
9336
9335
  }
9337
- function callVisitor(key, node, visitor, path60) {
9336
+ function callVisitor(key, node, visitor, path59) {
9338
9337
  if (typeof visitor === "function")
9339
- return visitor(key, node, path60);
9338
+ return visitor(key, node, path59);
9340
9339
  if (identity.isMap(node))
9341
- return visitor.Map?.(key, node, path60);
9340
+ return visitor.Map?.(key, node, path59);
9342
9341
  if (identity.isSeq(node))
9343
- return visitor.Seq?.(key, node, path60);
9342
+ return visitor.Seq?.(key, node, path59);
9344
9343
  if (identity.isPair(node))
9345
- return visitor.Pair?.(key, node, path60);
9344
+ return visitor.Pair?.(key, node, path59);
9346
9345
  if (identity.isScalar(node))
9347
- return visitor.Scalar?.(key, node, path60);
9346
+ return visitor.Scalar?.(key, node, path59);
9348
9347
  if (identity.isAlias(node))
9349
- return visitor.Alias?.(key, node, path60);
9348
+ return visitor.Alias?.(key, node, path59);
9350
9349
  return void 0;
9351
9350
  }
9352
- function replaceNode(key, path60, node) {
9353
- const parent = path60[path60.length - 1];
9351
+ function replaceNode(key, path59, node) {
9352
+ const parent = path59[path59.length - 1];
9354
9353
  if (identity.isCollection(parent)) {
9355
9354
  parent.items[key] = node;
9356
9355
  } else if (identity.isPair(parent)) {
@@ -9951,10 +9950,10 @@ var require_Collection = __commonJS({
9951
9950
  var createNode2 = require_createNode();
9952
9951
  var identity = require_identity();
9953
9952
  var Node = require_Node();
9954
- function collectionFromPath(schema, path60, value) {
9953
+ function collectionFromPath(schema, path59, value) {
9955
9954
  let v3 = value;
9956
- for (let i2 = path60.length - 1; i2 >= 0; --i2) {
9957
- const k3 = path60[i2];
9955
+ for (let i2 = path59.length - 1; i2 >= 0; --i2) {
9956
+ const k3 = path59[i2];
9958
9957
  if (typeof k3 === "number" && Number.isInteger(k3) && k3 >= 0) {
9959
9958
  const a2 = [];
9960
9959
  a2[k3] = v3;
@@ -9973,7 +9972,7 @@ var require_Collection = __commonJS({
9973
9972
  sourceObjects: /* @__PURE__ */ new Map()
9974
9973
  });
9975
9974
  }
9976
- var isEmptyPath = (path60) => path60 == null || typeof path60 === "object" && !!path60[Symbol.iterator]().next().done;
9975
+ var isEmptyPath = (path59) => path59 == null || typeof path59 === "object" && !!path59[Symbol.iterator]().next().done;
9977
9976
  var Collection = class extends Node.NodeBase {
9978
9977
  constructor(type, schema) {
9979
9978
  super(type);
@@ -10003,11 +10002,11 @@ var require_Collection = __commonJS({
10003
10002
  * be a Pair instance or a `{ key, value }` object, which may not have a key
10004
10003
  * that already exists in the map.
10005
10004
  */
10006
- addIn(path60, value) {
10007
- if (isEmptyPath(path60))
10005
+ addIn(path59, value) {
10006
+ if (isEmptyPath(path59))
10008
10007
  this.add(value);
10009
10008
  else {
10010
- const [key, ...rest] = path60;
10009
+ const [key, ...rest] = path59;
10011
10010
  const node = this.get(key, true);
10012
10011
  if (identity.isCollection(node))
10013
10012
  node.addIn(rest, value);
@@ -10021,8 +10020,8 @@ var require_Collection = __commonJS({
10021
10020
  * Removes a value from the collection.
10022
10021
  * @returns `true` if the item was found and removed.
10023
10022
  */
10024
- deleteIn(path60) {
10025
- const [key, ...rest] = path60;
10023
+ deleteIn(path59) {
10024
+ const [key, ...rest] = path59;
10026
10025
  if (rest.length === 0)
10027
10026
  return this.delete(key);
10028
10027
  const node = this.get(key, true);
@@ -10036,8 +10035,8 @@ var require_Collection = __commonJS({
10036
10035
  * scalar values from their surrounding node; to disable set `keepScalar` to
10037
10036
  * `true` (collections are always returned intact).
10038
10037
  */
10039
- getIn(path60, keepScalar) {
10040
- const [key, ...rest] = path60;
10038
+ getIn(path59, keepScalar) {
10039
+ const [key, ...rest] = path59;
10041
10040
  const node = this.get(key, true);
10042
10041
  if (rest.length === 0)
10043
10042
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -10055,8 +10054,8 @@ var require_Collection = __commonJS({
10055
10054
  /**
10056
10055
  * Checks if the collection includes a value with the key `key`.
10057
10056
  */
10058
- hasIn(path60) {
10059
- const [key, ...rest] = path60;
10057
+ hasIn(path59) {
10058
+ const [key, ...rest] = path59;
10060
10059
  if (rest.length === 0)
10061
10060
  return this.has(key);
10062
10061
  const node = this.get(key, true);
@@ -10066,8 +10065,8 @@ var require_Collection = __commonJS({
10066
10065
  * Sets a value in this collection. For `!!set`, `value` needs to be a
10067
10066
  * boolean to add/remove the item from the set.
10068
10067
  */
10069
- setIn(path60, value) {
10070
- const [key, ...rest] = path60;
10068
+ setIn(path59, value) {
10069
+ const [key, ...rest] = path59;
10071
10070
  if (rest.length === 0) {
10072
10071
  this.set(key, value);
10073
10072
  } else {
@@ -12547,9 +12546,9 @@ var require_Document = __commonJS({
12547
12546
  this.contents.add(value);
12548
12547
  }
12549
12548
  /** Adds a value to the document. */
12550
- addIn(path60, value) {
12549
+ addIn(path59, value) {
12551
12550
  if (assertCollection(this.contents))
12552
- this.contents.addIn(path60, value);
12551
+ this.contents.addIn(path59, value);
12553
12552
  }
12554
12553
  /**
12555
12554
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -12624,14 +12623,14 @@ var require_Document = __commonJS({
12624
12623
  * Removes a value from the document.
12625
12624
  * @returns `true` if the item was found and removed.
12626
12625
  */
12627
- deleteIn(path60) {
12628
- if (Collection.isEmptyPath(path60)) {
12626
+ deleteIn(path59) {
12627
+ if (Collection.isEmptyPath(path59)) {
12629
12628
  if (this.contents == null)
12630
12629
  return false;
12631
12630
  this.contents = null;
12632
12631
  return true;
12633
12632
  }
12634
- return assertCollection(this.contents) ? this.contents.deleteIn(path60) : false;
12633
+ return assertCollection(this.contents) ? this.contents.deleteIn(path59) : false;
12635
12634
  }
12636
12635
  /**
12637
12636
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -12646,10 +12645,10 @@ var require_Document = __commonJS({
12646
12645
  * scalar values from their surrounding node; to disable set `keepScalar` to
12647
12646
  * `true` (collections are always returned intact).
12648
12647
  */
12649
- getIn(path60, keepScalar) {
12650
- if (Collection.isEmptyPath(path60))
12648
+ getIn(path59, keepScalar) {
12649
+ if (Collection.isEmptyPath(path59))
12651
12650
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
12652
- return identity.isCollection(this.contents) ? this.contents.getIn(path60, keepScalar) : void 0;
12651
+ return identity.isCollection(this.contents) ? this.contents.getIn(path59, keepScalar) : void 0;
12653
12652
  }
12654
12653
  /**
12655
12654
  * Checks if the document includes a value with the key `key`.
@@ -12660,10 +12659,10 @@ var require_Document = __commonJS({
12660
12659
  /**
12661
12660
  * Checks if the document includes a value at `path`.
12662
12661
  */
12663
- hasIn(path60) {
12664
- if (Collection.isEmptyPath(path60))
12662
+ hasIn(path59) {
12663
+ if (Collection.isEmptyPath(path59))
12665
12664
  return this.contents !== void 0;
12666
- return identity.isCollection(this.contents) ? this.contents.hasIn(path60) : false;
12665
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path59) : false;
12667
12666
  }
12668
12667
  /**
12669
12668
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -12680,13 +12679,13 @@ var require_Document = __commonJS({
12680
12679
  * Sets a value in this document. For `!!set`, `value` needs to be a
12681
12680
  * boolean to add/remove the item from the set.
12682
12681
  */
12683
- setIn(path60, value) {
12684
- if (Collection.isEmptyPath(path60)) {
12682
+ setIn(path59, value) {
12683
+ if (Collection.isEmptyPath(path59)) {
12685
12684
  this.contents = value;
12686
12685
  } else if (this.contents == null) {
12687
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path60), value);
12686
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path59), value);
12688
12687
  } else if (assertCollection(this.contents)) {
12689
- this.contents.setIn(path60, value);
12688
+ this.contents.setIn(path59, value);
12690
12689
  }
12691
12690
  }
12692
12691
  /**
@@ -14626,9 +14625,9 @@ var require_cst_visit = __commonJS({
14626
14625
  visit.BREAK = BREAK;
14627
14626
  visit.SKIP = SKIP;
14628
14627
  visit.REMOVE = REMOVE;
14629
- visit.itemAtPath = (cst, path60) => {
14628
+ visit.itemAtPath = (cst, path59) => {
14630
14629
  let item = cst;
14631
- for (const [field, index] of path60) {
14630
+ for (const [field, index] of path59) {
14632
14631
  const tok = item?.[field];
14633
14632
  if (tok && "items" in tok) {
14634
14633
  item = tok.items[index];
@@ -14637,23 +14636,23 @@ var require_cst_visit = __commonJS({
14637
14636
  }
14638
14637
  return item;
14639
14638
  };
14640
- visit.parentCollection = (cst, path60) => {
14641
- const parent = visit.itemAtPath(cst, path60.slice(0, -1));
14642
- const field = path60[path60.length - 1][0];
14639
+ visit.parentCollection = (cst, path59) => {
14640
+ const parent = visit.itemAtPath(cst, path59.slice(0, -1));
14641
+ const field = path59[path59.length - 1][0];
14643
14642
  const coll = parent?.[field];
14644
14643
  if (coll && "items" in coll)
14645
14644
  return coll;
14646
14645
  throw new Error("Parent collection not found");
14647
14646
  };
14648
- function _visit(path60, item, visitor) {
14649
- let ctrl = visitor(item, path60);
14647
+ function _visit(path59, item, visitor) {
14648
+ let ctrl = visitor(item, path59);
14650
14649
  if (typeof ctrl === "symbol")
14651
14650
  return ctrl;
14652
14651
  for (const field of ["key", "value"]) {
14653
14652
  const token = item[field];
14654
14653
  if (token && "items" in token) {
14655
14654
  for (let i2 = 0; i2 < token.items.length; ++i2) {
14656
- const ci = _visit(Object.freeze(path60.concat([[field, i2]])), token.items[i2], visitor);
14655
+ const ci = _visit(Object.freeze(path59.concat([[field, i2]])), token.items[i2], visitor);
14657
14656
  if (typeof ci === "number")
14658
14657
  i2 = ci - 1;
14659
14658
  else if (ci === BREAK)
@@ -14664,10 +14663,10 @@ var require_cst_visit = __commonJS({
14664
14663
  }
14665
14664
  }
14666
14665
  if (typeof ctrl === "function" && field === "key")
14667
- ctrl = ctrl(item, path60);
14666
+ ctrl = ctrl(item, path59);
14668
14667
  }
14669
14668
  }
14670
- return typeof ctrl === "function" ? ctrl(item, path60) : ctrl;
14669
+ return typeof ctrl === "function" ? ctrl(item, path59) : ctrl;
14671
14670
  }
14672
14671
  exports.visit = visit;
14673
14672
  }
@@ -17389,14 +17388,14 @@ var require_url_state_machine = __commonJS({
17389
17388
  return url2.replace(/\u0009|\u000A|\u000D/g, "");
17390
17389
  }
17391
17390
  function shortenPath(url2) {
17392
- const path60 = url2.path;
17393
- if (path60.length === 0) {
17391
+ const path59 = url2.path;
17392
+ if (path59.length === 0) {
17394
17393
  return;
17395
17394
  }
17396
- if (url2.scheme === "file" && path60.length === 1 && isNormalizedWindowsDriveLetter(path60[0])) {
17395
+ if (url2.scheme === "file" && path59.length === 1 && isNormalizedWindowsDriveLetter(path59[0])) {
17397
17396
  return;
17398
17397
  }
17399
- path60.pop();
17398
+ path59.pop();
17400
17399
  }
17401
17400
  function includesCredentials(url2) {
17402
17401
  return url2.username !== "" || url2.password !== "";
@@ -26619,14 +26618,14 @@ __export(fileFromPath_exports, {
26619
26618
  fileFromPathSync: () => fileFromPathSync,
26620
26619
  isFile: () => isFile
26621
26620
  });
26622
- function createFileFromPath(path60, { mtimeMs, size }, filenameOrOptions, options = {}) {
26621
+ function createFileFromPath(path59, { mtimeMs, size }, filenameOrOptions, options = {}) {
26623
26622
  let filename;
26624
26623
  if (isPlainObject_default2(filenameOrOptions)) {
26625
26624
  [options, filename] = [filenameOrOptions, void 0];
26626
26625
  } else {
26627
26626
  filename = filenameOrOptions;
26628
26627
  }
26629
- const file = new FileFromPath({ path: path60, size, lastModified: mtimeMs });
26628
+ const file = new FileFromPath({ path: path59, size, lastModified: mtimeMs });
26630
26629
  if (!filename) {
26631
26630
  filename = file.name;
26632
26631
  }
@@ -26635,13 +26634,13 @@ function createFileFromPath(path60, { mtimeMs, size }, filenameOrOptions, option
26635
26634
  lastModified: file.lastModified
26636
26635
  });
26637
26636
  }
26638
- function fileFromPathSync(path60, filenameOrOptions, options = {}) {
26639
- const stats = statSync(path60);
26640
- return createFileFromPath(path60, stats, filenameOrOptions, options);
26637
+ function fileFromPathSync(path59, filenameOrOptions, options = {}) {
26638
+ const stats = statSync(path59);
26639
+ return createFileFromPath(path59, stats, filenameOrOptions, options);
26641
26640
  }
26642
- async function fileFromPath2(path60, filenameOrOptions, options) {
26643
- const stats = await promises.stat(path60);
26644
- return createFileFromPath(path60, stats, filenameOrOptions, options);
26641
+ async function fileFromPath2(path59, filenameOrOptions, options) {
26642
+ const stats = await promises.stat(path59);
26643
+ return createFileFromPath(path59, stats, filenameOrOptions, options);
26645
26644
  }
26646
26645
  var import_node_domexception, __classPrivateFieldSet4, __classPrivateFieldGet5, _FileFromPath_path, _FileFromPath_start, MESSAGE, FileFromPath;
26647
26646
  var init_fileFromPath = __esm({
@@ -30500,7 +30499,7 @@ var require_has_flag = __commonJS({
30500
30499
  // ../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js
30501
30500
  var require_supports_color = __commonJS({
30502
30501
  "../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module) {
30503
- var os18 = __require("os");
30502
+ var os17 = __require("os");
30504
30503
  var tty2 = __require("tty");
30505
30504
  var hasFlag2 = require_has_flag();
30506
30505
  var { env: env3 } = process;
@@ -30548,7 +30547,7 @@ var require_supports_color = __commonJS({
30548
30547
  return min;
30549
30548
  }
30550
30549
  if (process.platform === "win32") {
30551
- const osRelease = os18.release().split(".");
30550
+ const osRelease = os17.release().split(".");
30552
30551
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
30553
30552
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
30554
30553
  }
@@ -42773,8 +42772,8 @@ var require_utils2 = __commonJS({
42773
42772
  }
42774
42773
  return ind;
42775
42774
  }
42776
- function removeDotSegments(path60) {
42777
- let input = path60;
42775
+ function removeDotSegments(path59) {
42776
+ let input = path59;
42778
42777
  const output = [];
42779
42778
  let nextSlash = -1;
42780
42779
  let len = 0;
@@ -43025,8 +43024,8 @@ var require_schemes = __commonJS({
43025
43024
  wsComponent.secure = void 0;
43026
43025
  }
43027
43026
  if (wsComponent.resourceName) {
43028
- const [path60, query] = wsComponent.resourceName.split("?");
43029
- wsComponent.path = path60 && path60 !== "/" ? path60 : void 0;
43027
+ const [path59, query] = wsComponent.resourceName.split("?");
43028
+ wsComponent.path = path59 && path59 !== "/" ? path59 : void 0;
43030
43029
  wsComponent.query = query;
43031
43030
  wsComponent.resourceName = void 0;
43032
43031
  }
@@ -47184,7 +47183,7 @@ var require_windows = __commonJS({
47184
47183
  module.exports = isexe;
47185
47184
  isexe.sync = sync;
47186
47185
  var fs47 = __require("fs");
47187
- function checkPathExt(path60, options) {
47186
+ function checkPathExt(path59, options) {
47188
47187
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
47189
47188
  if (!pathext) {
47190
47189
  return true;
@@ -47195,25 +47194,25 @@ var require_windows = __commonJS({
47195
47194
  }
47196
47195
  for (var i2 = 0; i2 < pathext.length; i2++) {
47197
47196
  var p3 = pathext[i2].toLowerCase();
47198
- if (p3 && path60.substr(-p3.length).toLowerCase() === p3) {
47197
+ if (p3 && path59.substr(-p3.length).toLowerCase() === p3) {
47199
47198
  return true;
47200
47199
  }
47201
47200
  }
47202
47201
  return false;
47203
47202
  }
47204
- function checkStat(stat2, path60, options) {
47203
+ function checkStat(stat2, path59, options) {
47205
47204
  if (!stat2.isSymbolicLink() && !stat2.isFile()) {
47206
47205
  return false;
47207
47206
  }
47208
- return checkPathExt(path60, options);
47207
+ return checkPathExt(path59, options);
47209
47208
  }
47210
- function isexe(path60, options, cb) {
47211
- fs47.stat(path60, function(er2, stat2) {
47212
- cb(er2, er2 ? false : checkStat(stat2, path60, options));
47209
+ function isexe(path59, options, cb) {
47210
+ fs47.stat(path59, function(er2, stat2) {
47211
+ cb(er2, er2 ? false : checkStat(stat2, path59, options));
47213
47212
  });
47214
47213
  }
47215
- function sync(path60, options) {
47216
- return checkStat(fs47.statSync(path60), path60, options);
47214
+ function sync(path59, options) {
47215
+ return checkStat(fs47.statSync(path59), path59, options);
47217
47216
  }
47218
47217
  }
47219
47218
  });
@@ -47224,13 +47223,13 @@ var require_mode = __commonJS({
47224
47223
  module.exports = isexe;
47225
47224
  isexe.sync = sync;
47226
47225
  var fs47 = __require("fs");
47227
- function isexe(path60, options, cb) {
47228
- fs47.stat(path60, function(er2, stat2) {
47226
+ function isexe(path59, options, cb) {
47227
+ fs47.stat(path59, function(er2, stat2) {
47229
47228
  cb(er2, er2 ? false : checkStat(stat2, options));
47230
47229
  });
47231
47230
  }
47232
- function sync(path60, options) {
47233
- return checkStat(fs47.statSync(path60), options);
47231
+ function sync(path59, options) {
47232
+ return checkStat(fs47.statSync(path59), options);
47234
47233
  }
47235
47234
  function checkStat(stat2, options) {
47236
47235
  return stat2.isFile() && checkMode(stat2, options);
@@ -47263,7 +47262,7 @@ var require_isexe = __commonJS({
47263
47262
  }
47264
47263
  module.exports = isexe;
47265
47264
  isexe.sync = sync;
47266
- function isexe(path60, options, cb) {
47265
+ function isexe(path59, options, cb) {
47267
47266
  if (typeof options === "function") {
47268
47267
  cb = options;
47269
47268
  options = {};
@@ -47273,7 +47272,7 @@ var require_isexe = __commonJS({
47273
47272
  throw new TypeError("callback not provided");
47274
47273
  }
47275
47274
  return new Promise(function(resolve17, reject) {
47276
- isexe(path60, options || {}, function(er2, is) {
47275
+ isexe(path59, options || {}, function(er2, is) {
47277
47276
  if (er2) {
47278
47277
  reject(er2);
47279
47278
  } else {
@@ -47282,7 +47281,7 @@ var require_isexe = __commonJS({
47282
47281
  });
47283
47282
  });
47284
47283
  }
47285
- core(path60, options || {}, function(er2, is) {
47284
+ core(path59, options || {}, function(er2, is) {
47286
47285
  if (er2) {
47287
47286
  if (er2.code === "EACCES" || options && options.ignoreErrors) {
47288
47287
  er2 = null;
@@ -47292,9 +47291,9 @@ var require_isexe = __commonJS({
47292
47291
  cb(er2, is);
47293
47292
  });
47294
47293
  }
47295
- function sync(path60, options) {
47294
+ function sync(path59, options) {
47296
47295
  try {
47297
- return core.sync(path60, options || {});
47296
+ return core.sync(path59, options || {});
47298
47297
  } catch (er2) {
47299
47298
  if (options && options.ignoreErrors || er2.code === "EACCES") {
47300
47299
  return false;
@@ -47310,7 +47309,7 @@ var require_isexe = __commonJS({
47310
47309
  var require_which = __commonJS({
47311
47310
  "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
47312
47311
  var isWindows3 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
47313
- var path60 = __require("path");
47312
+ var path59 = __require("path");
47314
47313
  var COLON = isWindows3 ? ";" : ":";
47315
47314
  var isexe = require_isexe();
47316
47315
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -47348,7 +47347,7 @@ var require_which = __commonJS({
47348
47347
  return opt.all && found.length ? resolve17(found) : reject(getNotFoundError(cmd));
47349
47348
  const ppRaw = pathEnv[i2];
47350
47349
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
47351
- const pCmd = path60.join(pathPart, cmd);
47350
+ const pCmd = path59.join(pathPart, cmd);
47352
47351
  const p3 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
47353
47352
  resolve17(subStep(p3, i2, 0));
47354
47353
  });
@@ -47375,7 +47374,7 @@ var require_which = __commonJS({
47375
47374
  for (let i2 = 0; i2 < pathEnv.length; i2++) {
47376
47375
  const ppRaw = pathEnv[i2];
47377
47376
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
47378
- const pCmd = path60.join(pathPart, cmd);
47377
+ const pCmd = path59.join(pathPart, cmd);
47379
47378
  const p3 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
47380
47379
  for (let j3 = 0; j3 < pathExt.length; j3++) {
47381
47380
  const cur = p3 + pathExt[j3];
@@ -47421,7 +47420,7 @@ var require_path_key = __commonJS({
47421
47420
  // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
47422
47421
  var require_resolveCommand = __commonJS({
47423
47422
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
47424
- var path60 = __require("path");
47423
+ var path59 = __require("path");
47425
47424
  var which = require_which();
47426
47425
  var getPathKey = require_path_key();
47427
47426
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -47439,7 +47438,7 @@ var require_resolveCommand = __commonJS({
47439
47438
  try {
47440
47439
  resolved = which.sync(parsed.command, {
47441
47440
  path: env3[getPathKey({ env: env3 })],
47442
- pathExt: withoutPathExt ? path60.delimiter : void 0
47441
+ pathExt: withoutPathExt ? path59.delimiter : void 0
47443
47442
  });
47444
47443
  } catch (e3) {
47445
47444
  } finally {
@@ -47448,7 +47447,7 @@ var require_resolveCommand = __commonJS({
47448
47447
  }
47449
47448
  }
47450
47449
  if (resolved) {
47451
- resolved = path60.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
47450
+ resolved = path59.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
47452
47451
  }
47453
47452
  return resolved;
47454
47453
  }
@@ -47499,8 +47498,8 @@ var require_shebang_command = __commonJS({
47499
47498
  if (!match) {
47500
47499
  return null;
47501
47500
  }
47502
- const [path60, argument] = match[0].replace(/#! ?/, "").split(" ");
47503
- const binary = path60.split("/").pop();
47501
+ const [path59, argument] = match[0].replace(/#! ?/, "").split(" ");
47502
+ const binary = path59.split("/").pop();
47504
47503
  if (binary === "env") {
47505
47504
  return argument;
47506
47505
  }
@@ -47533,7 +47532,7 @@ var require_readShebang = __commonJS({
47533
47532
  // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
47534
47533
  var require_parse = __commonJS({
47535
47534
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
47536
- var path60 = __require("path");
47535
+ var path59 = __require("path");
47537
47536
  var resolveCommand = require_resolveCommand();
47538
47537
  var escape4 = require_escape();
47539
47538
  var readShebang = require_readShebang();
@@ -47558,7 +47557,7 @@ var require_parse = __commonJS({
47558
47557
  const needsShell = !isExecutableRegExp.test(commandFile);
47559
47558
  if (parsed.options.forceShell || needsShell) {
47560
47559
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
47561
- parsed.command = path60.normalize(parsed.command);
47560
+ parsed.command = path59.normalize(parsed.command);
47562
47561
  parsed.command = escape4.command(parsed.command);
47563
47562
  parsed.args = parsed.args.map((arg) => escape4.argument(arg, needsDoubleEscapeMetaChars));
47564
47563
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -75496,10 +75495,10 @@ var require_react_reconciler_development = __commonJS({
75496
75495
  var setErrorHandler = null;
75497
75496
  var setSuspenseHandler = null;
75498
75497
  {
75499
- var copyWithDeleteImpl = function(obj, path60, index2) {
75500
- var key = path60[index2];
75498
+ var copyWithDeleteImpl = function(obj, path59, index2) {
75499
+ var key = path59[index2];
75501
75500
  var updated = isArray(obj) ? obj.slice() : assign({}, obj);
75502
- if (index2 + 1 === path60.length) {
75501
+ if (index2 + 1 === path59.length) {
75503
75502
  if (isArray(updated)) {
75504
75503
  updated.splice(key, 1);
75505
75504
  } else {
@@ -75507,11 +75506,11 @@ var require_react_reconciler_development = __commonJS({
75507
75506
  }
75508
75507
  return updated;
75509
75508
  }
75510
- updated[key] = copyWithDeleteImpl(obj[key], path60, index2 + 1);
75509
+ updated[key] = copyWithDeleteImpl(obj[key], path59, index2 + 1);
75511
75510
  return updated;
75512
75511
  };
75513
- var copyWithDelete = function(obj, path60) {
75514
- return copyWithDeleteImpl(obj, path60, 0);
75512
+ var copyWithDelete = function(obj, path59) {
75513
+ return copyWithDeleteImpl(obj, path59, 0);
75515
75514
  };
75516
75515
  var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
75517
75516
  var oldKey = oldPath[index2];
@@ -75549,17 +75548,17 @@ var require_react_reconciler_development = __commonJS({
75549
75548
  }
75550
75549
  return copyWithRenameImpl(obj, oldPath, newPath, 0);
75551
75550
  };
75552
- var copyWithSetImpl = function(obj, path60, index2, value) {
75553
- if (index2 >= path60.length) {
75551
+ var copyWithSetImpl = function(obj, path59, index2, value) {
75552
+ if (index2 >= path59.length) {
75554
75553
  return value;
75555
75554
  }
75556
- var key = path60[index2];
75555
+ var key = path59[index2];
75557
75556
  var updated = isArray(obj) ? obj.slice() : assign({}, obj);
75558
- updated[key] = copyWithSetImpl(obj[key], path60, index2 + 1, value);
75557
+ updated[key] = copyWithSetImpl(obj[key], path59, index2 + 1, value);
75559
75558
  return updated;
75560
75559
  };
75561
- var copyWithSet = function(obj, path60, value) {
75562
- return copyWithSetImpl(obj, path60, 0, value);
75560
+ var copyWithSet = function(obj, path59, value) {
75561
+ return copyWithSetImpl(obj, path59, 0, value);
75563
75562
  };
75564
75563
  var findHook = function(fiber, id) {
75565
75564
  var currentHook2 = fiber.memoizedState;
@@ -75569,10 +75568,10 @@ var require_react_reconciler_development = __commonJS({
75569
75568
  }
75570
75569
  return currentHook2;
75571
75570
  };
75572
- overrideHookState = function(fiber, id, path60, value) {
75571
+ overrideHookState = function(fiber, id, path59, value) {
75573
75572
  var hook = findHook(fiber, id);
75574
75573
  if (hook !== null) {
75575
- var newState = copyWithSet(hook.memoizedState, path60, value);
75574
+ var newState = copyWithSet(hook.memoizedState, path59, value);
75576
75575
  hook.memoizedState = newState;
75577
75576
  hook.baseState = newState;
75578
75577
  fiber.memoizedProps = assign({}, fiber.memoizedProps);
@@ -75582,10 +75581,10 @@ var require_react_reconciler_development = __commonJS({
75582
75581
  }
75583
75582
  }
75584
75583
  };
75585
- overrideHookStateDeletePath = function(fiber, id, path60) {
75584
+ overrideHookStateDeletePath = function(fiber, id, path59) {
75586
75585
  var hook = findHook(fiber, id);
75587
75586
  if (hook !== null) {
75588
- var newState = copyWithDelete(hook.memoizedState, path60);
75587
+ var newState = copyWithDelete(hook.memoizedState, path59);
75589
75588
  hook.memoizedState = newState;
75590
75589
  hook.baseState = newState;
75591
75590
  fiber.memoizedProps = assign({}, fiber.memoizedProps);
@@ -75608,8 +75607,8 @@ var require_react_reconciler_development = __commonJS({
75608
75607
  }
75609
75608
  }
75610
75609
  };
75611
- overrideProps = function(fiber, path60, value) {
75612
- fiber.pendingProps = copyWithSet(fiber.memoizedProps, path60, value);
75610
+ overrideProps = function(fiber, path59, value) {
75611
+ fiber.pendingProps = copyWithSet(fiber.memoizedProps, path59, value);
75613
75612
  if (fiber.alternate) {
75614
75613
  fiber.alternate.pendingProps = fiber.pendingProps;
75615
75614
  }
@@ -75618,8 +75617,8 @@ var require_react_reconciler_development = __commonJS({
75618
75617
  scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
75619
75618
  }
75620
75619
  };
75621
- overridePropsDeletePath = function(fiber, path60) {
75622
- fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path60);
75620
+ overridePropsDeletePath = function(fiber, path59) {
75621
+ fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path59);
75623
75622
  if (fiber.alternate) {
75624
75623
  fiber.alternate.pendingProps = fiber.pendingProps;
75625
75624
  }
@@ -83061,8 +83060,8 @@ var init_ErrorOverview = __esm({
83061
83060
  init_dist7();
83062
83061
  init_Box();
83063
83062
  init_Text();
83064
- cleanupPath = (path60) => {
83065
- return path60?.replace(`file://${cwd()}/`, "");
83063
+ cleanupPath = (path59) => {
83064
+ return path59?.replace(`file://${cwd()}/`, "");
83066
83065
  };
83067
83066
  stackUtils = new import_stack_utils.default({
83068
83067
  cwd: cwd(),
@@ -92855,10 +92854,10 @@ var require_segments = __commonJS({
92855
92854
  const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
92856
92855
  const nodes = buildNodes(segs);
92857
92856
  const graph = buildGraph(nodes, version);
92858
- const path60 = dijkstra.find_path(graph.map, "start", "end");
92857
+ const path59 = dijkstra.find_path(graph.map, "start", "end");
92859
92858
  const optimizedSegs = [];
92860
- for (let i2 = 1; i2 < path60.length - 1; i2++) {
92861
- optimizedSegs.push(graph.table[path60[i2]].node);
92859
+ for (let i2 = 1; i2 < path59.length - 1; i2++) {
92860
+ optimizedSegs.push(graph.table[path59[i2]].node);
92862
92861
  }
92863
92862
  return exports.fromArray(mergeSegments(optimizedSegs));
92864
92863
  };
@@ -95310,7 +95309,7 @@ var require_png2 = __commonJS({
95310
95309
  });
95311
95310
  png.pack();
95312
95311
  };
95313
- exports.renderToFile = function renderToFile(path60, qrData, options, cb) {
95312
+ exports.renderToFile = function renderToFile(path59, qrData, options, cb) {
95314
95313
  if (typeof cb === "undefined") {
95315
95314
  cb = options;
95316
95315
  options = void 0;
@@ -95321,7 +95320,7 @@ var require_png2 = __commonJS({
95321
95320
  called = true;
95322
95321
  cb.apply(null, args);
95323
95322
  };
95324
- const stream = fs47.createWriteStream(path60);
95323
+ const stream = fs47.createWriteStream(path59);
95325
95324
  stream.on("error", done);
95326
95325
  stream.on("close", done);
95327
95326
  exports.renderToFileStream(stream, qrData, options);
@@ -95383,14 +95382,14 @@ var require_utf8 = __commonJS({
95383
95382
  }
95384
95383
  return output;
95385
95384
  };
95386
- exports.renderToFile = function renderToFile(path60, qrData, options, cb) {
95385
+ exports.renderToFile = function renderToFile(path59, qrData, options, cb) {
95387
95386
  if (typeof cb === "undefined") {
95388
95387
  cb = options;
95389
95388
  options = void 0;
95390
95389
  }
95391
95390
  const fs47 = __require("fs");
95392
95391
  const utf8 = exports.render(qrData, options);
95393
- fs47.writeFile(path60, utf8, cb);
95392
+ fs47.writeFile(path59, utf8, cb);
95394
95393
  };
95395
95394
  }
95396
95395
  });
@@ -95511,7 +95510,7 @@ var require_svg_tag = __commonJS({
95511
95510
  return str2;
95512
95511
  }
95513
95512
  function qrToPath(data, size, margin) {
95514
- let path60 = "";
95513
+ let path59 = "";
95515
95514
  let moveBy = 0;
95516
95515
  let newRow = false;
95517
95516
  let lineLength = 0;
@@ -95522,19 +95521,19 @@ var require_svg_tag = __commonJS({
95522
95521
  if (data[i2]) {
95523
95522
  lineLength++;
95524
95523
  if (!(i2 > 0 && col > 0 && data[i2 - 1])) {
95525
- path60 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
95524
+ path59 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
95526
95525
  moveBy = 0;
95527
95526
  newRow = false;
95528
95527
  }
95529
95528
  if (!(col + 1 < size && data[i2 + 1])) {
95530
- path60 += svgCmd("h", lineLength);
95529
+ path59 += svgCmd("h", lineLength);
95531
95530
  lineLength = 0;
95532
95531
  }
95533
95532
  } else {
95534
95533
  moveBy++;
95535
95534
  }
95536
95535
  }
95537
- return path60;
95536
+ return path59;
95538
95537
  }
95539
95538
  exports.render = function render2(qrData, options, cb) {
95540
95539
  const opts = Utils.getOptions(options);
@@ -95542,10 +95541,10 @@ var require_svg_tag = __commonJS({
95542
95541
  const data = qrData.modules.data;
95543
95542
  const qrcodesize = size + opts.margin * 2;
95544
95543
  const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + ' d="M0 0h' + qrcodesize + "v" + qrcodesize + 'H0z"/>';
95545
- const path60 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
95544
+ const path59 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
95546
95545
  const viewBox = 'viewBox="0 0 ' + qrcodesize + " " + qrcodesize + '"';
95547
95546
  const width = !opts.width ? "" : 'width="' + opts.width + '" height="' + opts.width + '" ';
95548
- const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path60 + "</svg>\n";
95547
+ const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path59 + "</svg>\n";
95549
95548
  if (typeof cb === "function") {
95550
95549
  cb(null, svgTag);
95551
95550
  }
@@ -95559,7 +95558,7 @@ var require_svg = __commonJS({
95559
95558
  "../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg.js"(exports) {
95560
95559
  var svgTagRenderer = require_svg_tag();
95561
95560
  exports.render = svgTagRenderer.render;
95562
- exports.renderToFile = function renderToFile(path60, qrData, options, cb) {
95561
+ exports.renderToFile = function renderToFile(path59, qrData, options, cb) {
95563
95562
  if (typeof cb === "undefined") {
95564
95563
  cb = options;
95565
95564
  options = void 0;
@@ -95567,7 +95566,7 @@ var require_svg = __commonJS({
95567
95566
  const fs47 = __require("fs");
95568
95567
  const svgTag = exports.render(qrData, options);
95569
95568
  const xmlStr = '<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">' + svgTag;
95570
- fs47.writeFile(path60, xmlStr, cb);
95569
+ fs47.writeFile(path59, xmlStr, cb);
95571
95570
  };
95572
95571
  }
95573
95572
  });
@@ -95725,8 +95724,8 @@ var require_server = __commonJS({
95725
95724
  cb
95726
95725
  };
95727
95726
  }
95728
- function getTypeFromFilename(path60) {
95729
- return path60.slice((path60.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
95727
+ function getTypeFromFilename(path59) {
95728
+ return path59.slice((path59.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
95730
95729
  }
95731
95730
  function getRendererFromType(type) {
95732
95731
  switch (type) {
@@ -95790,17 +95789,17 @@ var require_server = __commonJS({
95790
95789
  const renderer2 = getRendererFromType(params.opts.type);
95791
95790
  return render2(renderer2.renderToBuffer, text, params);
95792
95791
  };
95793
- exports.toFile = function toFile3(path60, text, opts, cb) {
95794
- if (typeof path60 !== "string" || !(typeof text === "string" || typeof text === "object")) {
95792
+ exports.toFile = function toFile3(path59, text, opts, cb) {
95793
+ if (typeof path59 !== "string" || !(typeof text === "string" || typeof text === "object")) {
95795
95794
  throw new Error("Invalid argument");
95796
95795
  }
95797
95796
  if (arguments.length < 3 && !canPromise()) {
95798
95797
  throw new Error("Too few arguments provided");
95799
95798
  }
95800
95799
  const params = checkParams(text, opts, cb);
95801
- const type = params.opts.type || getTypeFromFilename(path60);
95800
+ const type = params.opts.type || getTypeFromFilename(path59);
95802
95801
  const renderer2 = getRendererFromType(type);
95803
- const renderToFile = renderer2.renderToFile.bind(null, path60);
95802
+ const renderToFile = renderer2.renderToFile.bind(null, path59);
95804
95803
  return render2(renderToFile, text, params);
95805
95804
  };
95806
95805
  exports.toFileStream = function toFileStream(stream, text, opts) {
@@ -96620,14 +96619,14 @@ var require_util2 = __commonJS({
96620
96619
  }
96621
96620
  const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
96622
96621
  let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
96623
- let path60 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
96622
+ let path59 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
96624
96623
  if (origin[origin.length - 1] === "/") {
96625
96624
  origin = origin.slice(0, origin.length - 1);
96626
96625
  }
96627
- if (path60 && path60[0] !== "/") {
96628
- path60 = `/${path60}`;
96626
+ if (path59 && path59[0] !== "/") {
96627
+ path59 = `/${path59}`;
96629
96628
  }
96630
- return new URL(`${origin}${path60}`);
96629
+ return new URL(`${origin}${path59}`);
96631
96630
  }
96632
96631
  if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
96633
96632
  throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -97077,39 +97076,39 @@ var require_diagnostics = __commonJS({
97077
97076
  });
97078
97077
  diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
97079
97078
  const {
97080
- request: { method, path: path60, origin }
97079
+ request: { method, path: path59, origin }
97081
97080
  } = evt;
97082
- debuglog("sending request to %s %s/%s", method, origin, path60);
97081
+ debuglog("sending request to %s %s/%s", method, origin, path59);
97083
97082
  });
97084
97083
  diagnosticsChannel.channel("undici:request:headers").subscribe((evt) => {
97085
97084
  const {
97086
- request: { method, path: path60, origin },
97085
+ request: { method, path: path59, origin },
97087
97086
  response: { statusCode }
97088
97087
  } = evt;
97089
97088
  debuglog(
97090
97089
  "received response to %s %s/%s - HTTP %d",
97091
97090
  method,
97092
97091
  origin,
97093
- path60,
97092
+ path59,
97094
97093
  statusCode
97095
97094
  );
97096
97095
  });
97097
97096
  diagnosticsChannel.channel("undici:request:trailers").subscribe((evt) => {
97098
97097
  const {
97099
- request: { method, path: path60, origin }
97098
+ request: { method, path: path59, origin }
97100
97099
  } = evt;
97101
- debuglog("trailers received from %s %s/%s", method, origin, path60);
97100
+ debuglog("trailers received from %s %s/%s", method, origin, path59);
97102
97101
  });
97103
97102
  diagnosticsChannel.channel("undici:request:error").subscribe((evt) => {
97104
97103
  const {
97105
- request: { method, path: path60, origin },
97104
+ request: { method, path: path59, origin },
97106
97105
  error: error2
97107
97106
  } = evt;
97108
97107
  debuglog(
97109
97108
  "request to %s %s/%s errored - %s",
97110
97109
  method,
97111
97110
  origin,
97112
- path60,
97111
+ path59,
97113
97112
  error2.message
97114
97113
  );
97115
97114
  });
@@ -97158,9 +97157,9 @@ var require_diagnostics = __commonJS({
97158
97157
  });
97159
97158
  diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
97160
97159
  const {
97161
- request: { method, path: path60, origin }
97160
+ request: { method, path: path59, origin }
97162
97161
  } = evt;
97163
- debuglog("sending request to %s %s/%s", method, origin, path60);
97162
+ debuglog("sending request to %s %s/%s", method, origin, path59);
97164
97163
  });
97165
97164
  }
97166
97165
  diagnosticsChannel.channel("undici:websocket:open").subscribe((evt) => {
@@ -97222,7 +97221,7 @@ var require_request = __commonJS({
97222
97221
  var kHandler = /* @__PURE__ */ Symbol("handler");
97223
97222
  var Request4 = class {
97224
97223
  constructor(origin, {
97225
- path: path60,
97224
+ path: path59,
97226
97225
  method,
97227
97226
  body,
97228
97227
  headers,
@@ -97237,11 +97236,11 @@ var require_request = __commonJS({
97237
97236
  expectContinue,
97238
97237
  servername
97239
97238
  }, handler) {
97240
- if (typeof path60 !== "string") {
97239
+ if (typeof path59 !== "string") {
97241
97240
  throw new InvalidArgumentError("path must be a string");
97242
- } else if (path60[0] !== "/" && !(path60.startsWith("http://") || path60.startsWith("https://")) && method !== "CONNECT") {
97241
+ } else if (path59[0] !== "/" && !(path59.startsWith("http://") || path59.startsWith("https://")) && method !== "CONNECT") {
97243
97242
  throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
97244
- } else if (invalidPathRegex.test(path60)) {
97243
+ } else if (invalidPathRegex.test(path59)) {
97245
97244
  throw new InvalidArgumentError("invalid request path");
97246
97245
  }
97247
97246
  if (typeof method !== "string") {
@@ -97307,7 +97306,7 @@ var require_request = __commonJS({
97307
97306
  this.completed = false;
97308
97307
  this.aborted = false;
97309
97308
  this.upgrade = upgrade || null;
97310
- this.path = query ? buildURL(path60, query) : path60;
97309
+ this.path = query ? buildURL(path59, query) : path59;
97311
97310
  this.origin = origin;
97312
97311
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
97313
97312
  this.blocking = blocking == null ? false : blocking;
@@ -101845,7 +101844,7 @@ var require_client_h1 = __commonJS({
101845
101844
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
101846
101845
  }
101847
101846
  function writeH1(client2, request) {
101848
- const { method, path: path60, host, upgrade, blocking, reset } = request;
101847
+ const { method, path: path59, host, upgrade, blocking, reset } = request;
101849
101848
  let { body, headers, contentLength } = request;
101850
101849
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
101851
101850
  if (util.isFormDataLike(body)) {
@@ -101911,7 +101910,7 @@ var require_client_h1 = __commonJS({
101911
101910
  if (blocking) {
101912
101911
  socket[kBlocking] = true;
101913
101912
  }
101914
- let header = `${method} ${path60} HTTP/1.1\r
101913
+ let header = `${method} ${path59} HTTP/1.1\r
101915
101914
  `;
101916
101915
  if (typeof host === "string") {
101917
101916
  header += `host: ${host}\r
@@ -102436,7 +102435,7 @@ var require_client_h2 = __commonJS({
102436
102435
  }
102437
102436
  function writeH2(client2, request) {
102438
102437
  const session = client2[kHTTP2Session];
102439
- const { method, path: path60, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
102438
+ const { method, path: path59, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
102440
102439
  let { body } = request;
102441
102440
  if (upgrade) {
102442
102441
  util.errorRequest(client2, request, new Error("Upgrade not supported for H2"));
@@ -102503,7 +102502,7 @@ var require_client_h2 = __commonJS({
102503
102502
  });
102504
102503
  return true;
102505
102504
  }
102506
- headers[HTTP2_HEADER_PATH] = path60;
102505
+ headers[HTTP2_HEADER_PATH] = path59;
102507
102506
  headers[HTTP2_HEADER_SCHEME] = "https";
102508
102507
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
102509
102508
  if (body && typeof body.read === "function") {
@@ -102855,9 +102854,9 @@ var require_redirect_handler = __commonJS({
102855
102854
  return this.handler.onHeaders(statusCode, headers, resume, statusText);
102856
102855
  }
102857
102856
  const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
102858
- const path60 = search ? `${pathname}${search}` : pathname;
102857
+ const path59 = search ? `${pathname}${search}` : pathname;
102859
102858
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
102860
- this.opts.path = path60;
102859
+ this.opts.path = path59;
102861
102860
  this.opts.origin = origin;
102862
102861
  this.opts.maxRedirections = 0;
102863
102862
  this.opts.query = null;
@@ -104082,10 +104081,10 @@ var require_proxy_agent = __commonJS({
104082
104081
  };
104083
104082
  const {
104084
104083
  origin,
104085
- path: path60 = "/",
104084
+ path: path59 = "/",
104086
104085
  headers = {}
104087
104086
  } = opts;
104088
- opts.path = origin + path60;
104087
+ opts.path = origin + path59;
104089
104088
  if (!("host" in headers) && !("Host" in headers)) {
104090
104089
  const { host } = new URL3(origin);
104091
104090
  headers.host = host;
@@ -105993,20 +105992,20 @@ var require_mock_utils = __commonJS({
105993
105992
  }
105994
105993
  return true;
105995
105994
  }
105996
- function safeUrl(path60) {
105997
- if (typeof path60 !== "string") {
105998
- return path60;
105995
+ function safeUrl(path59) {
105996
+ if (typeof path59 !== "string") {
105997
+ return path59;
105999
105998
  }
106000
- const pathSegments = path60.split("?");
105999
+ const pathSegments = path59.split("?");
106001
106000
  if (pathSegments.length !== 2) {
106002
- return path60;
106001
+ return path59;
106003
106002
  }
106004
106003
  const qp = new URLSearchParams(pathSegments.pop());
106005
106004
  qp.sort();
106006
106005
  return [...pathSegments, qp.toString()].join("?");
106007
106006
  }
106008
- function matchKey(mockDispatch2, { path: path60, method, body, headers }) {
106009
- const pathMatch = matchValue(mockDispatch2.path, path60);
106007
+ function matchKey(mockDispatch2, { path: path59, method, body, headers }) {
106008
+ const pathMatch = matchValue(mockDispatch2.path, path59);
106010
106009
  const methodMatch = matchValue(mockDispatch2.method, method);
106011
106010
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
106012
106011
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -106028,7 +106027,7 @@ var require_mock_utils = __commonJS({
106028
106027
  function getMockDispatch(mockDispatches, key) {
106029
106028
  const basePath = key.query ? buildURL(key.path, key.query) : key.path;
106030
106029
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
106031
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path60 }) => matchValue(safeUrl(path60), resolvedPath));
106030
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path59 }) => matchValue(safeUrl(path59), resolvedPath));
106032
106031
  if (matchedMockDispatches.length === 0) {
106033
106032
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
106034
106033
  }
@@ -106066,9 +106065,9 @@ var require_mock_utils = __commonJS({
106066
106065
  }
106067
106066
  }
106068
106067
  function buildKey(opts) {
106069
- const { path: path60, method, body, headers, query } = opts;
106068
+ const { path: path59, method, body, headers, query } = opts;
106070
106069
  return {
106071
- path: path60,
106070
+ path: path59,
106072
106071
  method,
106073
106072
  body,
106074
106073
  headers,
@@ -106526,10 +106525,10 @@ var require_pending_interceptors_formatter = __commonJS({
106526
106525
  }
106527
106526
  format(pendingInterceptors) {
106528
106527
  const withPrettyHeaders = pendingInterceptors.map(
106529
- ({ method, path: path60, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
106528
+ ({ method, path: path59, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
106530
106529
  Method: method,
106531
106530
  Origin: origin,
106532
- Path: path60,
106531
+ Path: path59,
106533
106532
  "Status code": statusCode,
106534
106533
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
106535
106534
  Invocations: timesInvoked,
@@ -111368,9 +111367,9 @@ var require_util7 = __commonJS({
111368
111367
  }
111369
111368
  }
111370
111369
  }
111371
- function validateCookiePath(path60) {
111372
- for (let i2 = 0; i2 < path60.length; ++i2) {
111373
- const code = path60.charCodeAt(i2);
111370
+ function validateCookiePath(path59) {
111371
+ for (let i2 = 0; i2 < path59.length; ++i2) {
111372
+ const code = path59.charCodeAt(i2);
111374
111373
  if (code < 32 || // exclude CTLs (0-31)
111375
111374
  code === 127 || // DEL
111376
111375
  code === 59) {
@@ -114030,11 +114029,11 @@ var require_undici = __commonJS({
114030
114029
  if (typeof opts.path !== "string") {
114031
114030
  throw new InvalidArgumentError("invalid opts.path");
114032
114031
  }
114033
- let path60 = opts.path;
114032
+ let path59 = opts.path;
114034
114033
  if (!opts.path.startsWith("/")) {
114035
- path60 = `/${path60}`;
114034
+ path59 = `/${path59}`;
114036
114035
  }
114037
- url2 = new URL(util.parseOrigin(url2).origin + path60);
114036
+ url2 = new URL(util.parseOrigin(url2).origin + path59);
114038
114037
  } else {
114039
114038
  if (!opts) {
114040
114039
  opts = typeof url2 === "object" ? url2 : {};
@@ -119935,11 +119934,11 @@ function parseBody(body) {
119935
119934
  return { ok: false, value: null };
119936
119935
  }
119937
119936
  }
119938
- function readJsonPath(parsed, path60) {
119937
+ function readJsonPath(parsed, path59) {
119939
119938
  if (!parsed.ok)
119940
119939
  return null;
119941
119940
  let cur = parsed.value;
119942
- for (const seg of path60.split(".")) {
119941
+ for (const seg of path59.split(".")) {
119943
119942
  if (cur === null || cur === void 0 || typeof cur !== "object")
119944
119943
  return null;
119945
119944
  cur = cur[seg];
@@ -122088,6 +122087,67 @@ async function brokerExec(args, { caps, cwd: cwd2, signal }) {
122088
122087
  });
122089
122088
  }
122090
122089
 
122090
+ // ../plugin-security/dist/shim.js
122091
+ var BROKER_CLIENT_SOURCE = `
122092
+ const broker = {
122093
+ fs: {
122094
+ readFile: (filePath, opts) => rpc('fs.readFile', [filePath, opts || {}]),
122095
+ writeFile: (filePath, data) => rpc('fs.writeFile', [filePath, data]),
122096
+ readdir: (dirPath) => rpc('fs.readdir', [dirPath]),
122097
+ stat: (filePath) => rpc('fs.stat', [filePath]),
122098
+ },
122099
+ fetch: (url, init) => rpc('fetch', [url, init || {}]),
122100
+ exec: (cmd, args, opts) => rpc('exec', [cmd, args || [], opts || {}]),
122101
+ };`;
122102
+ var SYNTHETIC_CTX_SOURCE = `
122103
+ const ctx = {
122104
+ sessionId: syntheticCtx.sessionId,
122105
+ turnId: syntheticCtx.turnId,
122106
+ callId: syntheticCtx.callId,
122107
+ cwd: syntheticCtx.cwd,
122108
+ signal: abortController.signal,
122109
+ log: { length: 0, at: () => undefined, slice: () => [], ofType: () => [], byTurn: () => [], toJSON: () => [] },
122110
+ logger: { debug: () => {}, info: () => {}, warn: () => {}, error: () => {} },
122111
+ fs: broker.fs,
122112
+ fetch: broker.fetch,
122113
+ exec: broker.exec,
122114
+ };`;
122115
+
122116
+ // ../plugin-security/dist/broker-limiter.js
122117
+ var DEFAULT_MAX_INFLIGHT_BROKER_OPS = 128;
122118
+ var BrokerOpLimiter = class {
122119
+ limit;
122120
+ #inflight = 0;
122121
+ /**
122122
+ * @param max Ceiling on concurrent ops. Coerced to a finite integer >= 1
122123
+ * (a NaN / <1 value would otherwise disable the guard or wedge every op),
122124
+ * defaulting to {@link DEFAULT_MAX_INFLIGHT_BROKER_OPS}.
122125
+ */
122126
+ constructor(max) {
122127
+ const n2 = Math.floor(Number(max ?? DEFAULT_MAX_INFLIGHT_BROKER_OPS));
122128
+ this.limit = Number.isFinite(n2) ? Math.max(1, n2) : DEFAULT_MAX_INFLIGHT_BROKER_OPS;
122129
+ }
122130
+ /** Current number of ops counted as in-flight. */
122131
+ get inflight() {
122132
+ return this.#inflight;
122133
+ }
122134
+ /**
122135
+ * Reserve a slot. Returns `true` (slot taken — the caller MUST later call
122136
+ * {@link release} exactly once) or `false` (at capacity — reject the op).
122137
+ */
122138
+ tryAcquire() {
122139
+ if (this.#inflight >= this.limit)
122140
+ return false;
122141
+ this.#inflight++;
122142
+ return true;
122143
+ }
122144
+ /** Free a slot previously taken by {@link tryAcquire}. Never goes negative. */
122145
+ release() {
122146
+ if (this.#inflight > 0)
122147
+ this.#inflight--;
122148
+ }
122149
+ };
122150
+
122091
122151
  // ../plugin-security/dist/index.js
122092
122152
  var IN_PROCESS_STRENGTHS = /* @__PURE__ */ new Set(["none", "inproc"]);
122093
122153
  var DEFAULT_ISOLATOR = "inproc";
@@ -122277,17 +122337,7 @@ function rpc(op, args) {
122277
122337
  parentPort.postMessage({ type: 'broker-request', id, op, args });
122278
122338
  });
122279
122339
  }
122280
-
122281
- const broker = {
122282
- fs: {
122283
- readFile: (filePath, opts) => rpc('fs.readFile', [filePath, opts || {}]),
122284
- writeFile: (filePath, data) => rpc('fs.writeFile', [filePath, data]),
122285
- readdir: (dirPath) => rpc('fs.readdir', [dirPath]),
122286
- stat: (filePath) => rpc('fs.stat', [filePath]),
122287
- },
122288
- fetch: (url, init) => rpc('fetch', [url, init || {}]),
122289
- exec: (cmd, args, opts) => rpc('exec', [cmd, args || [], opts || {}]),
122290
- };
122340
+ ${BROKER_CLIENT_SOURCE}
122291
122341
 
122292
122342
  try {
122293
122343
  const mod = await import(moduleUrl);
@@ -122300,18 +122350,7 @@ try {
122300
122350
  errorMessage: "worker shim: export '" + exportName + "' from " + moduleUrl + " is " + (typeof fn) + ", expected function",
122301
122351
  });
122302
122352
  } else {
122303
- const ctx = {
122304
- sessionId: syntheticCtx.sessionId,
122305
- turnId: syntheticCtx.turnId,
122306
- callId: syntheticCtx.callId,
122307
- cwd: syntheticCtx.cwd,
122308
- signal: abortController.signal,
122309
- log: { length: 0, at: () => undefined, slice: () => [], ofType: () => [], byTurn: () => [], toJSON: () => [] },
122310
- logger: { debug: () => {}, info: () => {}, warn: () => {}, error: () => {} },
122311
- fs: broker.fs,
122312
- fetch: broker.fetch,
122313
- exec: broker.exec,
122314
- };
122353
+ ${SYNTHETIC_CTX_SOURCE}
122315
122354
  const out = await fn(input, ctx);
122316
122355
  parentPort.postMessage({ type: 'result', ok: true, value: out });
122317
122356
  }
@@ -122328,6 +122367,7 @@ try {
122328
122367
  function createWorkerIsolator(opts = {}) {
122329
122368
  const defaultMemMb = opts.defaultMemMb ?? 256;
122330
122369
  const defaultTimeMs = opts.defaultTimeMs ?? 6e4;
122370
+ const maxInflightBrokerOps = opts.maxInflightBrokerOps ?? DEFAULT_MAX_INFLIGHT_BROKER_OPS;
122331
122371
  return {
122332
122372
  name: "worker",
122333
122373
  strength: "worker",
@@ -122373,6 +122413,7 @@ function createWorkerIsolator(opts = {}) {
122373
122413
  const onHostAbortLink = () => brokerAbort.abort();
122374
122414
  signal.addEventListener("abort", onHostAbortLink, { once: true });
122375
122415
  cleanup.add(() => signal.removeEventListener("abort", onHostAbortLink));
122416
+ const brokerLimiter = new BrokerOpLimiter(maxInflightBrokerOps);
122376
122417
  let terminated = false;
122377
122418
  let detachMessage = () => {
122378
122419
  };
@@ -122418,6 +122459,20 @@ function createWorkerIsolator(opts = {}) {
122418
122459
  if (msg.type === "broker-request") {
122419
122460
  if (terminated)
122420
122461
  return;
122462
+ if (!brokerLimiter.tryAcquire()) {
122463
+ const overflow = {
122464
+ type: "broker-response",
122465
+ id: msg.id,
122466
+ ok: false,
122467
+ errorName: "Error",
122468
+ errorMessage: `[security:worker] too many concurrent brokered ops (limit ${brokerLimiter.limit})`
122469
+ };
122470
+ try {
122471
+ worker.postMessage(overflow);
122472
+ } catch {
122473
+ }
122474
+ return;
122475
+ }
122421
122476
  void handleBrokerRequest(msg, {
122422
122477
  caps,
122423
122478
  cwd: call.cwd,
@@ -122429,6 +122484,8 @@ function createWorkerIsolator(opts = {}) {
122429
122484
  worker.postMessage(response);
122430
122485
  } catch {
122431
122486
  }
122487
+ }).finally(() => {
122488
+ brokerLimiter.release();
122432
122489
  });
122433
122490
  return;
122434
122491
  }
@@ -122503,17 +122560,7 @@ function rpc(op, args) {
122503
122560
  send({ type: 'broker-request', id, op, args });
122504
122561
  });
122505
122562
  }
122506
-
122507
- const broker = {
122508
- fs: {
122509
- readFile: (filePath, opts) => rpc('fs.readFile', [filePath, opts || {}]),
122510
- writeFile: (filePath, data) => rpc('fs.writeFile', [filePath, data]),
122511
- readdir: (dirPath) => rpc('fs.readdir', [dirPath]),
122512
- stat: (filePath) => rpc('fs.stat', [filePath]),
122513
- },
122514
- fetch: (url, init) => rpc('fetch', [url, init || {}]),
122515
- exec: (cmd, args, opts) => rpc('exec', [cmd, args || [], opts || {}]),
122516
- };
122563
+ ${BROKER_CLIENT_SOURCE}
122517
122564
 
122518
122565
  stdin.setEncoding('utf8');
122519
122566
  stdin.on('data', (chunk) => {
@@ -122569,18 +122616,7 @@ async function runTask() {
122569
122616
  send({ type: 'result', ok: false, errorName: 'Error', errorMessage: "subprocess shim: export '" + exportName + "' is " + (typeof fn) });
122570
122617
  return;
122571
122618
  }
122572
- const ctx = {
122573
- sessionId: syntheticCtx.sessionId,
122574
- turnId: syntheticCtx.turnId,
122575
- callId: syntheticCtx.callId,
122576
- cwd: syntheticCtx.cwd,
122577
- signal: abortController.signal,
122578
- log: { length: 0, at: () => undefined, slice: () => [], ofType: () => [], byTurn: () => [], toJSON: () => [] },
122579
- logger: { debug: () => {}, info: () => {}, warn: () => {}, error: () => {} },
122580
- fs: broker.fs,
122581
- fetch: broker.fetch,
122582
- exec: broker.exec,
122583
- };
122619
+ ${SYNTHETIC_CTX_SOURCE}
122584
122620
  try {
122585
122621
  const out = await fn(input, ctx);
122586
122622
  send({ type: 'result', ok: true, value: out });
@@ -122591,14 +122627,13 @@ async function runTask() {
122591
122627
  `;
122592
122628
  var KILL_GRACE_MS = 2e3;
122593
122629
  var DEFAULT_MAX_OUTPUT_BYTES = 8 * 1024 * 1024;
122594
- var DEFAULT_MAX_INFLIGHT_BROKER_OPS = 128;
122595
122630
  var MAX_STDERR_BYTES2 = 64 * 1024;
122596
122631
  var ABORT_GRACE_MS = 150;
122597
122632
  function createSubprocessIsolator(opts = {}) {
122598
122633
  const defaultTimeMs = opts.defaultTimeMs ?? 6e4;
122599
122634
  const defaultMemMb = opts.defaultMemMb ?? 256;
122600
122635
  const maxOutputBytes = opts.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES;
122601
- const maxInflightBrokerOps = Math.max(1, Math.floor(opts.maxInflightBrokerOps ?? DEFAULT_MAX_INFLIGHT_BROKER_OPS));
122636
+ const maxInflightBrokerOps = opts.maxInflightBrokerOps ?? DEFAULT_MAX_INFLIGHT_BROKER_OPS;
122602
122637
  const nodePath2 = opts.nodePath ?? process.execPath;
122603
122638
  return {
122604
122639
  name: "subprocess",
@@ -122637,7 +122672,7 @@ function createSubprocessIsolator(opts = {}) {
122637
122672
  signal.addEventListener("abort", onHostAbortLink, { once: true });
122638
122673
  let torndown = false;
122639
122674
  let outputBytes = 0;
122640
- let inflightBrokerOps = 0;
122675
+ const brokerLimiter = new BrokerOpLimiter(maxInflightBrokerOps);
122641
122676
  let killEscalation;
122642
122677
  const cleanup = /* @__PURE__ */ new Set();
122643
122678
  cleanup.add(() => signal.removeEventListener("abort", onHostAbortLink));
@@ -122715,13 +122750,13 @@ function createSubprocessIsolator(opts = {}) {
122715
122750
  if (msg.type === "broker-request") {
122716
122751
  if (torndown)
122717
122752
  return;
122718
- if (inflightBrokerOps >= maxInflightBrokerOps) {
122753
+ if (!brokerLimiter.tryAcquire()) {
122719
122754
  const overflow = {
122720
122755
  type: "broker-response",
122721
122756
  id: msg.id,
122722
122757
  ok: false,
122723
122758
  errorName: "Error",
122724
- errorMessage: `[security:subprocess] too many concurrent brokered ops (limit ${maxInflightBrokerOps})`
122759
+ errorMessage: `[security:subprocess] too many concurrent brokered ops (limit ${brokerLimiter.limit})`
122725
122760
  };
122726
122761
  try {
122727
122762
  child.stdin.write(JSON.stringify(overflow) + "\n");
@@ -122729,7 +122764,6 @@ function createSubprocessIsolator(opts = {}) {
122729
122764
  }
122730
122765
  return;
122731
122766
  }
122732
- inflightBrokerOps++;
122733
122767
  void handleBrokerRequest(msg, {
122734
122768
  caps,
122735
122769
  cwd: call.cwd,
@@ -122746,7 +122780,7 @@ function createSubprocessIsolator(opts = {}) {
122746
122780
  }
122747
122781
  }
122748
122782
  }).finally(() => {
122749
- inflightBrokerOps--;
122783
+ brokerLimiter.release();
122750
122784
  });
122751
122785
  return;
122752
122786
  }
@@ -123660,13 +123694,13 @@ var MultipartBody = class {
123660
123694
  }
123661
123695
  };
123662
123696
  var fileFromPathWarned = false;
123663
- async function fileFromPath3(path60, ...args) {
123697
+ async function fileFromPath3(path59, ...args) {
123664
123698
  const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => (init_fileFromPath(), fileFromPath_exports));
123665
123699
  if (!fileFromPathWarned) {
123666
- console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path60)}) instead`);
123700
+ console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path59)}) instead`);
123667
123701
  fileFromPathWarned = true;
123668
123702
  }
123669
- return await _fileFromPath(path60, ...args);
123703
+ return await _fileFromPath(path59, ...args);
123670
123704
  }
123671
123705
  var defaultHttpAgent = new import_agentkeepalive.default({ keepAlive: true, timeout: 5 * 60 * 1e3 });
123672
123706
  var defaultHttpsAgent = new import_agentkeepalive.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 });
@@ -124389,29 +124423,29 @@ var APIClient = class {
124389
124423
  defaultIdempotencyKey() {
124390
124424
  return `stainless-node-retry-${uuid4()}`;
124391
124425
  }
124392
- get(path60, opts) {
124393
- return this.methodRequest("get", path60, opts);
124426
+ get(path59, opts) {
124427
+ return this.methodRequest("get", path59, opts);
124394
124428
  }
124395
- post(path60, opts) {
124396
- return this.methodRequest("post", path60, opts);
124429
+ post(path59, opts) {
124430
+ return this.methodRequest("post", path59, opts);
124397
124431
  }
124398
- patch(path60, opts) {
124399
- return this.methodRequest("patch", path60, opts);
124432
+ patch(path59, opts) {
124433
+ return this.methodRequest("patch", path59, opts);
124400
124434
  }
124401
- put(path60, opts) {
124402
- return this.methodRequest("put", path60, opts);
124435
+ put(path59, opts) {
124436
+ return this.methodRequest("put", path59, opts);
124403
124437
  }
124404
- delete(path60, opts) {
124405
- return this.methodRequest("delete", path60, opts);
124438
+ delete(path59, opts) {
124439
+ return this.methodRequest("delete", path59, opts);
124406
124440
  }
124407
- methodRequest(method, path60, opts) {
124441
+ methodRequest(method, path59, opts) {
124408
124442
  return this.request(Promise.resolve(opts).then(async (opts2) => {
124409
124443
  const body = opts2 && isBlobLike(opts2?.body) ? new DataView(await opts2.body.arrayBuffer()) : opts2?.body instanceof DataView ? opts2.body : opts2?.body instanceof ArrayBuffer ? new DataView(opts2.body) : opts2 && ArrayBuffer.isView(opts2?.body) ? new DataView(opts2.body.buffer) : opts2?.body;
124410
- return { method, path: path60, ...opts2, body };
124444
+ return { method, path: path59, ...opts2, body };
124411
124445
  }));
124412
124446
  }
124413
- getAPIList(path60, Page3, opts) {
124414
- return this.requestAPIList(Page3, { method: "get", path: path60, ...opts });
124447
+ getAPIList(path59, Page3, opts) {
124448
+ return this.requestAPIList(Page3, { method: "get", path: path59, ...opts });
124415
124449
  }
124416
124450
  calculateContentLength(body) {
124417
124451
  if (typeof body === "string") {
@@ -124430,10 +124464,10 @@ var APIClient = class {
124430
124464
  }
124431
124465
  buildRequest(inputOptions, { retryCount = 0 } = {}) {
124432
124466
  const options = { ...inputOptions };
124433
- const { method, path: path60, query, headers = {} } = options;
124467
+ const { method, path: path59, query, headers = {} } = options;
124434
124468
  const body = ArrayBuffer.isView(options.body) || options.__binaryRequest && typeof options.body === "string" ? options.body : isMultipartBody(options.body) ? options.body.body : options.body ? JSON.stringify(options.body, null, 2) : null;
124435
124469
  const contentLength = this.calculateContentLength(body);
124436
- const url2 = this.buildURL(path60, query);
124470
+ const url2 = this.buildURL(path59, query);
124437
124471
  if ("timeout" in options)
124438
124472
  validatePositiveInteger("timeout", options.timeout);
124439
124473
  options.timeout = options.timeout ?? this.timeout;
@@ -124557,8 +124591,8 @@ var APIClient = class {
124557
124591
  const request = this.makeRequest(options, null);
124558
124592
  return new PagePromise(this, request, Page3);
124559
124593
  }
124560
- buildURL(path60, query) {
124561
- const url2 = isAbsoluteURL(path60) ? new URL(path60) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path60.startsWith("/") ? path60.slice(1) : path60));
124594
+ buildURL(path59, query) {
124595
+ const url2 = isAbsoluteURL(path59) ? new URL(path59) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path59.startsWith("/") ? path59.slice(1) : path59));
124562
124596
  const defaultQuery = this.defaultQuery();
124563
124597
  if (!isEmptyObj(defaultQuery)) {
124564
124598
  query = { ...defaultQuery, ...query };
@@ -127892,13 +127926,13 @@ var MultipartBody2 = class {
127892
127926
  }
127893
127927
  };
127894
127928
  var fileFromPathWarned2 = false;
127895
- async function fileFromPath5(path60, ...args) {
127929
+ async function fileFromPath5(path59, ...args) {
127896
127930
  const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => (init_fileFromPath(), fileFromPath_exports));
127897
127931
  if (!fileFromPathWarned2) {
127898
- console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path60)}) instead`);
127932
+ console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path59)}) instead`);
127899
127933
  fileFromPathWarned2 = true;
127900
127934
  }
127901
- return await _fileFromPath(path60, ...args);
127935
+ return await _fileFromPath(path59, ...args);
127902
127936
  }
127903
127937
  var defaultHttpAgent2 = new import_agentkeepalive2.default({ keepAlive: true, timeout: 5 * 60 * 1e3 });
127904
127938
  var defaultHttpsAgent2 = new import_agentkeepalive2.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 });
@@ -128676,29 +128710,29 @@ var APIClient2 = class {
128676
128710
  defaultIdempotencyKey() {
128677
128711
  return `stainless-node-retry-${uuid42()}`;
128678
128712
  }
128679
- get(path60, opts) {
128680
- return this.methodRequest("get", path60, opts);
128713
+ get(path59, opts) {
128714
+ return this.methodRequest("get", path59, opts);
128681
128715
  }
128682
- post(path60, opts) {
128683
- return this.methodRequest("post", path60, opts);
128716
+ post(path59, opts) {
128717
+ return this.methodRequest("post", path59, opts);
128684
128718
  }
128685
- patch(path60, opts) {
128686
- return this.methodRequest("patch", path60, opts);
128719
+ patch(path59, opts) {
128720
+ return this.methodRequest("patch", path59, opts);
128687
128721
  }
128688
- put(path60, opts) {
128689
- return this.methodRequest("put", path60, opts);
128722
+ put(path59, opts) {
128723
+ return this.methodRequest("put", path59, opts);
128690
128724
  }
128691
- delete(path60, opts) {
128692
- return this.methodRequest("delete", path60, opts);
128725
+ delete(path59, opts) {
128726
+ return this.methodRequest("delete", path59, opts);
128693
128727
  }
128694
- methodRequest(method, path60, opts) {
128728
+ methodRequest(method, path59, opts) {
128695
128729
  return this.request(Promise.resolve(opts).then(async (opts2) => {
128696
128730
  const body = opts2 && isBlobLike2(opts2?.body) ? new DataView(await opts2.body.arrayBuffer()) : opts2?.body instanceof DataView ? opts2.body : opts2?.body instanceof ArrayBuffer ? new DataView(opts2.body) : opts2 && ArrayBuffer.isView(opts2?.body) ? new DataView(opts2.body.buffer) : opts2?.body;
128697
- return { method, path: path60, ...opts2, body };
128731
+ return { method, path: path59, ...opts2, body };
128698
128732
  }));
128699
128733
  }
128700
- getAPIList(path60, Page3, opts) {
128701
- return this.requestAPIList(Page3, { method: "get", path: path60, ...opts });
128734
+ getAPIList(path59, Page3, opts) {
128735
+ return this.requestAPIList(Page3, { method: "get", path: path59, ...opts });
128702
128736
  }
128703
128737
  calculateContentLength(body) {
128704
128738
  if (typeof body === "string") {
@@ -128717,10 +128751,10 @@ var APIClient2 = class {
128717
128751
  }
128718
128752
  buildRequest(inputOptions, { retryCount = 0 } = {}) {
128719
128753
  const options = { ...inputOptions };
128720
- const { method, path: path60, query, headers = {} } = options;
128754
+ const { method, path: path59, query, headers = {} } = options;
128721
128755
  const body = ArrayBuffer.isView(options.body) || options.__binaryRequest && typeof options.body === "string" ? options.body : isMultipartBody2(options.body) ? options.body.body : options.body ? JSON.stringify(options.body, null, 2) : null;
128722
128756
  const contentLength = this.calculateContentLength(body);
128723
- const url2 = this.buildURL(path60, query);
128757
+ const url2 = this.buildURL(path59, query);
128724
128758
  if ("timeout" in options)
128725
128759
  validatePositiveInteger2("timeout", options.timeout);
128726
128760
  options.timeout = options.timeout ?? this.timeout;
@@ -128836,8 +128870,8 @@ var APIClient2 = class {
128836
128870
  const request = this.makeRequest(options, null);
128837
128871
  return new PagePromise2(this, request, Page3);
128838
128872
  }
128839
- buildURL(path60, query) {
128840
- const url2 = isAbsoluteURL2(path60) ? new URL(path60) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path60.startsWith("/") ? path60.slice(1) : path60));
128873
+ buildURL(path59, query) {
128874
+ const url2 = isAbsoluteURL2(path59) ? new URL(path59) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path59.startsWith("/") ? path59.slice(1) : path59));
128841
128875
  const defaultQuery = this.defaultQuery();
128842
128876
  if (!isEmptyObj2(defaultQuery)) {
128843
128877
  query = { ...defaultQuery, ...query };
@@ -134421,11 +134455,11 @@ function buildAuthUrl(input) {
134421
134455
  }
134422
134456
  async function runAuthorizationCodeFlow(opts) {
134423
134457
  const port = opts.redirectPort ?? 8765;
134424
- const path60 = opts.redirectPath ?? "/callback";
134458
+ const path59 = opts.redirectPath ?? "/callback";
134425
134459
  const codeVerifier = generateCodeVerifier();
134426
134460
  const codeChallenge = computeCodeChallenge(codeVerifier);
134427
134461
  const state = generateState();
134428
- const redirectUri = `http://localhost:${port}${path60}`;
134462
+ const redirectUri = `http://localhost:${port}${path59}`;
134429
134463
  const authUrl = buildAuthUrl({
134430
134464
  authUrl: opts.authUrl,
134431
134465
  clientId: opts.clientId,
@@ -134437,7 +134471,7 @@ async function runAuthorizationCodeFlow(opts) {
134437
134471
  });
134438
134472
  const codePromise = waitForCallback({
134439
134473
  port,
134440
- path: path60,
134474
+ path: path59,
134441
134475
  expectedState: state,
134442
134476
  timeoutMs: opts.timeoutMs ?? 3e5,
134443
134477
  ...opts.signal ? { signal: opts.signal } : {}
@@ -134984,11 +135018,11 @@ function buildOauthAuthorizeTool(deps) {
134984
135018
  const { computeCodeChallenge: computeCodeChallenge2 } = await Promise.resolve().then(() => (init_pkce(), pkce_exports));
134985
135019
  const challenge = computeCodeChallenge2(verifier);
134986
135020
  const port = input.redirectPort ?? 8765;
134987
- const path60 = input.redirectPath ?? "/callback";
135021
+ const path59 = input.redirectPath ?? "/callback";
134988
135022
  const url2 = buildAuthUrl({
134989
135023
  authUrl: input.authUrl,
134990
135024
  clientId: input.clientId,
134991
- redirectUri: `http://localhost:${port}${path60}`,
135025
+ redirectUri: `http://localhost:${port}${path59}`,
134992
135026
  scopes: input.scopes,
134993
135027
  codeChallenge: challenge,
134994
135028
  state,
@@ -135132,7 +135166,7 @@ async function runOauthLogin(profile, ctx) {
135132
135166
  }
135133
135167
  async function runBrowserFlow(profile, ctx) {
135134
135168
  const port = profile.redirect?.port ?? 8765;
135135
- const path60 = profile.redirect?.path ?? "/callback";
135169
+ const path59 = profile.redirect?.path ?? "/callback";
135136
135170
  const serviceName = profile.displayName ?? profile.id;
135137
135171
  return runAuthorizationCodeFlow({
135138
135172
  authUrl: profile.authUrl,
@@ -135141,7 +135175,7 @@ async function runBrowserFlow(profile, ctx) {
135141
135175
  ...profile.clientSecret ? { clientSecret: profile.clientSecret } : {},
135142
135176
  scopes: profile.scopes,
135143
135177
  redirectPort: port,
135144
- redirectPath: path60,
135178
+ redirectPath: path59,
135145
135179
  ...profile.extraAuthParams ? { extraAuthParams: profile.extraAuthParams } : {},
135146
135180
  timeoutMs: DEFAULT_BROWSER_TIMEOUT_MS,
135147
135181
  ...ctx.signal ? { signal: ctx.signal } : {},
@@ -135153,7 +135187,7 @@ If your browser doesn't open automatically, paste this URL:
135153
135187
 
135154
135188
  ${url2}
135155
135189
 
135156
- Waiting for callback on http://localhost:${port}${path60} (5 min timeout)\u2026
135190
+ Waiting for callback on http://localhost:${port}${path59} (5 min timeout)\u2026
135157
135191
 
135158
135192
  `);
135159
135193
  }
@@ -138100,24 +138134,9 @@ var builtinToolsPlugin = definePlugin({
138100
138134
  });
138101
138135
  var DEFAULT_MODE_NAME = "default";
138102
138136
  var MAX_CONSECUTIVE_RETRIES = 6;
138103
- function retryBackoffMs(attempt) {
138104
- const base2 = 500;
138105
- const cap = 3e4;
138106
- return Math.min(cap, base2 * 2 ** Math.max(0, attempt - 1));
138107
- }
138108
- var sleepImpl2 = (ms, signal) => new Promise((resolve17) => {
138109
- if (signal.aborted)
138110
- return resolve17();
138111
- const timer = setTimeout(() => {
138112
- signal.removeEventListener("abort", onAbort);
138113
- resolve17();
138114
- }, ms);
138115
- const onAbort = () => {
138116
- clearTimeout(timer);
138117
- resolve17();
138118
- };
138119
- signal.addEventListener("abort", onAbort, { once: true });
138120
- });
138137
+ var RETRY_BACKOFF_BASE_MS = 500;
138138
+ var RETRY_BACKOFF_CAP_MS = 3e4;
138139
+ var sleepImpl2 = (ms, signal) => sleepWithAbort(ms, signal);
138121
138140
  async function* runDefaultMode(ctx) {
138122
138141
  const requestedMaxIterations = ctx.maxIterations;
138123
138142
  const maxIterations = typeof requestedMaxIterations === "number" && Number.isFinite(requestedMaxIterations) ? Math.max(1, Math.floor(requestedMaxIterations)) : 500;
@@ -138225,7 +138244,7 @@ async function* runDefaultMode(ctx) {
138225
138244
  });
138226
138245
  return;
138227
138246
  }
138228
- await sleepImpl2(retryBackoffMs(consecutiveRetries), ctx.signal);
138247
+ await sleepImpl2(nextBackoffMs(consecutiveRetries, RETRY_BACKOFF_BASE_MS, RETRY_BACKOFF_CAP_MS), ctx.signal);
138229
138248
  if (ctx.signal.aborted) {
138230
138249
  yield await ctx.emit({
138231
138250
  type: "abort",
@@ -138402,24 +138421,9 @@ function detectGoalTerminal(log, batch) {
138402
138421
  }
138403
138422
 
138404
138423
  // ../mode-goal/dist/goal-loop.js
138405
- function retryBackoffMs2(attempt) {
138406
- const base2 = 500;
138407
- const cap = 3e4;
138408
- return Math.min(cap, base2 * 2 ** Math.max(0, attempt - 1));
138409
- }
138410
- var sleepImpl3 = (ms, signal) => new Promise((resolve17) => {
138411
- if (signal.aborted)
138412
- return resolve17();
138413
- const timer = setTimeout(() => {
138414
- signal.removeEventListener("abort", onAbort);
138415
- resolve17();
138416
- }, ms);
138417
- const onAbort = () => {
138418
- clearTimeout(timer);
138419
- resolve17();
138420
- };
138421
- signal.addEventListener("abort", onAbort, { once: true });
138422
- });
138424
+ var RETRY_BACKOFF_BASE_MS2 = 500;
138425
+ var RETRY_BACKOFF_CAP_MS2 = 3e4;
138426
+ var sleepImpl3 = (ms, signal) => sleepWithAbort(ms, signal);
138423
138427
  async function* runGoalMode(ctx) {
138424
138428
  if (ctx.signal.aborted) {
138425
138429
  yield await ctx.emit({
@@ -138568,7 +138572,7 @@ async function* runGoalMode(ctx) {
138568
138572
  });
138569
138573
  return;
138570
138574
  }
138571
- await sleepImpl3(retryBackoffMs2(consecutiveRetries), ctx.signal);
138575
+ await sleepImpl3(nextBackoffMs(consecutiveRetries, RETRY_BACKOFF_BASE_MS2, RETRY_BACKOFF_CAP_MS2), ctx.signal);
138572
138576
  if (ctx.signal.aborted) {
138573
138577
  yield await ctx.emit({
138574
138578
  type: "abort",
@@ -139703,7 +139707,7 @@ function runnerSocketPath() {
139703
139707
  const override = process.env.MOXXY_RUNNER_SOCKET;
139704
139708
  if (override)
139705
139709
  return override;
139706
- return platformSocket("serve", path3__default.join(os3__default.homedir(), ".moxxy", "serve.sock"));
139710
+ return platformSocket("serve", moxxyPath("serve.sock"));
139707
139711
  }
139708
139712
  function isRunnerUp(socketPath = runnerSocketPath()) {
139709
139713
  return new Promise((resolve17) => {
@@ -141801,8 +141805,8 @@ var CollabHubClient = class _CollabHubClient {
141801
141805
  peerFiles(agentId) {
141802
141806
  return this.peer.request(CollabHubMethod.PeerFiles, { agentId });
141803
141807
  }
141804
- peerRead(agentId, path60) {
141805
- return this.peer.request(CollabHubMethod.PeerRead, { agentId, path: path60 });
141808
+ peerRead(agentId, path59) {
141809
+ return this.peer.request(CollabHubMethod.PeerRead, { agentId, path: path59 });
141806
141810
  }
141807
141811
  peerDiff(agentId) {
141808
141812
  return this.peer.request(CollabHubMethod.PeerDiff, { agentId });
@@ -142076,11 +142080,11 @@ var collabPeerRead = defineTool({
142076
142080
  description: "Read a file from another agent's in-progress work \u2014 get their real interface instead of guessing.",
142077
142081
  inputSchema: z.object({ agentId: z.string(), path: z.string() }),
142078
142082
  permission: { action: "allow" },
142079
- handler: async ({ agentId, path: path60 }) => {
142083
+ handler: async ({ agentId, path: path59 }) => {
142080
142084
  const c2 = await getProcessHubClient();
142081
142085
  if (!c2)
142082
142086
  return NOT_IN_COLLAB;
142083
- return c2.peerRead(agentId, path60);
142087
+ return c2.peerRead(agentId, path59);
142084
142088
  }
142085
142089
  });
142086
142090
  var collabPeerDiff = defineTool({
@@ -142970,13 +142974,52 @@ ${input}`
142970
142974
  return null;
142971
142975
  }
142972
142976
  }
142973
- var MAX_RUN_RECORDS = 200;
142974
142977
  function moxxyHome2() {
142975
142978
  return process.env.MOXXY_HOME ?? join(homedir(), ".moxxy");
142976
142979
  }
142980
+ function collabLockPath() {
142981
+ return process.env.MOXXY_COLLAB_LOCK || join(moxxyHome2(), "collab", "active.lock");
142982
+ }
142977
142983
  function collabRunsDir() {
142978
142984
  return join(moxxyHome2(), "collab", "runs");
142979
142985
  }
142986
+ function parseCollabLock(raw) {
142987
+ let info;
142988
+ try {
142989
+ info = JSON.parse(raw);
142990
+ } catch {
142991
+ return null;
142992
+ }
142993
+ if (typeof info !== "object" || info === null)
142994
+ return null;
142995
+ const rec = info;
142996
+ if (typeof rec.pid !== "number" || !Number.isInteger(rec.pid) || rec.pid <= 0)
142997
+ return null;
142998
+ return {
142999
+ pid: rec.pid,
143000
+ sessionId: typeof rec.sessionId === "string" ? rec.sessionId : "",
143001
+ task: typeof rec.task === "string" ? rec.task : "",
143002
+ startedAtMs: typeof rec.startedAtMs === "number" ? rec.startedAtMs : 0
143003
+ };
143004
+ }
143005
+ function readCollabLock() {
143006
+ try {
143007
+ return parseCollabLock(readFileSync(collabLockPath(), "utf8"));
143008
+ } catch {
143009
+ return null;
143010
+ }
143011
+ }
143012
+ function isCollabHolderAlive(pid) {
143013
+ try {
143014
+ process.kill(pid, 0);
143015
+ return true;
143016
+ } catch (err) {
143017
+ return err.code === "EPERM";
143018
+ }
143019
+ }
143020
+
143021
+ // ../mode-collaborative/dist/archive.js
143022
+ var MAX_RUN_RECORDS = 200;
142980
143023
  function writeRunRecord(rec) {
142981
143024
  try {
142982
143025
  const dir = collabRunsDir();
@@ -143104,8 +143147,8 @@ async function addWorktree(args) {
143104
143147
  if (r2.code !== 0)
143105
143148
  throw new Error(`git worktree add failed: ${r2.stderr.trim() || r2.stdout.trim()}`);
143106
143149
  }
143107
- async function removeWorktree(repoCwd, path60) {
143108
- await git(repoCwd, ["worktree", "remove", "--force", path60]);
143150
+ async function removeWorktree(repoCwd, path59) {
143151
+ await git(repoCwd, ["worktree", "remove", "--force", path59]);
143109
143152
  await git(repoCwd, ["worktree", "prune"]);
143110
143153
  }
143111
143154
  async function commitAll(worktreeCwd, message) {
@@ -143126,9 +143169,9 @@ async function changedFiles(worktreeCwd) {
143126
143169
  if (!rec)
143127
143170
  continue;
143128
143171
  const status = rec.slice(0, 2).trim();
143129
- const path60 = rec.slice(3);
143130
- if (path60)
143131
- out.push({ status, path: path60 });
143172
+ const path59 = rec.slice(3);
143173
+ if (path59)
143174
+ out.push({ status, path: path59 });
143132
143175
  if (status.startsWith("R") || status.startsWith("C"))
143133
143176
  i2++;
143134
143177
  }
@@ -143222,9 +143265,9 @@ function peerReaderFor(worktrees, baseSha) {
143222
143265
  async files(agentId) {
143223
143266
  return changedFiles(dirFor(agentId));
143224
143267
  },
143225
- async read(agentId, path60) {
143268
+ async read(agentId, path59) {
143226
143269
  const dir = dirFor(agentId);
143227
- return readFile(await resolveWithinReal(dir, path60), "utf8");
143270
+ return readFile(await resolveWithinReal(dir, path59), "utf8");
143228
143271
  },
143229
143272
  async diff(agentId) {
143230
143273
  return diffVsBase(dirFor(agentId), baseSha);
@@ -143236,8 +143279,8 @@ function cwdPeerReader(cwd2) {
143236
143279
  async files() {
143237
143280
  return await isGitRepo(cwd2) ? changedFiles(cwd2) : [];
143238
143281
  },
143239
- async read(_agentId, path60) {
143240
- return readFile(await resolveWithinReal(cwd2, path60), "utf8");
143282
+ async read(_agentId, path59) {
143283
+ return readFile(await resolveWithinReal(cwd2, path59), "utf8");
143241
143284
  },
143242
143285
  async diff() {
143243
143286
  return "";
@@ -143440,30 +143483,12 @@ async function integrate(input) {
143440
143483
  }
143441
143484
  return { merged, conflicts, resolvedByOwnership, stagingBranch: branchName, promoted };
143442
143485
  }
143443
- var COLLAB_LOCK_PATH = join(homedir(), ".moxxy", "collab", "active.lock");
143444
- function collabLockPath() {
143445
- return process.env.MOXXY_COLLAB_LOCK || COLLAB_LOCK_PATH;
143446
- }
143447
- function readRaw() {
143448
- try {
143449
- return JSON.parse(readFileSync(collabLockPath(), "utf8"));
143450
- } catch {
143451
- return null;
143452
- }
143453
- }
143454
- function isAlive(pid) {
143455
- try {
143456
- process.kill(pid, 0);
143457
- return true;
143458
- } catch (err) {
143459
- return err.code === "EPERM";
143460
- }
143461
- }
143486
+ join(homedir(), ".moxxy", "collab", "active.lock");
143462
143487
  function readActiveCollab() {
143463
- const info = readRaw();
143488
+ const info = readCollabLock();
143464
143489
  if (!info)
143465
143490
  return null;
143466
- if (!isAlive(info.pid)) {
143491
+ if (!isCollabHolderAlive(info.pid)) {
143467
143492
  try {
143468
143493
  unlinkSync(collabLockPath());
143469
143494
  } catch {
@@ -143473,13 +143498,13 @@ function readActiveCollab() {
143473
143498
  return info;
143474
143499
  }
143475
143500
  function tryAcquireCollabLock(args) {
143476
- const path60 = collabLockPath();
143477
- mkdirSync(dirname(path60), { recursive: true });
143501
+ const path59 = collabLockPath();
143502
+ mkdirSync(dirname(path59), { recursive: true });
143478
143503
  const info = { pid: process.pid, ...args };
143479
143504
  const payload = JSON.stringify(info);
143480
143505
  for (let attempt = 0; attempt < 5; attempt++) {
143481
143506
  try {
143482
- const fd = openSync(path60, "wx");
143507
+ const fd = openSync(path59, "wx");
143483
143508
  try {
143484
143509
  writeFileSync(fd, payload);
143485
143510
  } finally {
@@ -143489,23 +143514,23 @@ function tryAcquireCollabLock(args) {
143489
143514
  } catch (err) {
143490
143515
  if (err.code !== "EEXIST")
143491
143516
  throw err;
143492
- const existing = readRaw();
143493
- if (existing && existing.sessionId !== args.sessionId && isAlive(existing.pid)) {
143517
+ const existing = readCollabLock();
143518
+ if (existing && existing.sessionId !== args.sessionId && isCollabHolderAlive(existing.pid)) {
143494
143519
  return { ok: false, holder: existing };
143495
143520
  }
143496
143521
  try {
143497
- unlinkSync(path60);
143522
+ unlinkSync(path59);
143498
143523
  } catch {
143499
143524
  }
143500
143525
  }
143501
143526
  }
143502
- const holder = readActiveCollab() ?? readRaw();
143527
+ const holder = readActiveCollab() ?? readCollabLock();
143503
143528
  if (holder)
143504
143529
  return { ok: false, holder };
143505
143530
  return { ok: false, holder: info };
143506
143531
  }
143507
143532
  function releaseCollabLock(sessionId) {
143508
- const info = readRaw();
143533
+ const info = readCollabLock();
143509
143534
  if (info && info.sessionId === sessionId) {
143510
143535
  try {
143511
143536
  unlinkSync(collabLockPath());
@@ -143839,11 +143864,11 @@ function lastUserPromptText(ctx) {
143839
143864
  }
143840
143865
  return void 0;
143841
143866
  }
143842
- function readRoster(path60, maxAgents) {
143843
- if (!existsSync(path60))
143867
+ function readRoster(path59, maxAgents) {
143868
+ if (!existsSync(path59))
143844
143869
  return [];
143845
143870
  try {
143846
- const raw = JSON.parse(readFileSync(path60, "utf8"));
143871
+ const raw = JSON.parse(readFileSync(path59, "utf8"));
143847
143872
  if (!Array.isArray(raw))
143848
143873
  return [];
143849
143874
  const seen = /* @__PURE__ */ new Set();
@@ -144377,11 +144402,11 @@ var collabArchitectMode = defineMode({
144377
144402
  run: (ctx) => runCollabAgentLoop(ctx, { systemPrompt: COLLAB_ARCHITECT_PROMPT })
144378
144403
  });
144379
144404
  function peerSystemPrompt(env3) {
144380
- const path60 = env3[COLLAB_ENV.CharterFile]?.trim();
144381
- if (!path60)
144405
+ const path59 = env3[COLLAB_ENV.CharterFile]?.trim();
144406
+ if (!path59)
144382
144407
  return COLLAB_PEER_PROMPT;
144383
144408
  try {
144384
- return peerPromptWithCharter(readFileSync(path60, "utf8"));
144409
+ return peerPromptWithCharter(readFileSync(path59, "utf8"));
144385
144410
  } catch {
144386
144411
  return COLLAB_PEER_PROMPT;
144387
144412
  }
@@ -149401,11 +149426,14 @@ var ipcInputSchemas = {
149401
149426
  before: z.number().int().nonnegative().nullable(),
149402
149427
  limit: z.number().int().positive().max(2e3)
149403
149428
  }),
149404
- // Reads + parses archived collab run files off disk (~/.moxxy/collab/runs).
149405
- // The handler already clamps `limit` and bounds its file scan, but this is a
149406
- // filesystem-touching command, so it gets the boundary check the module header
149407
- // promises: a positive, bounded page size (matching the handler's 200 ceiling)
149408
- // so a hostile renderer can't push a non-integer/NaN/huge window across.
149429
+ // Collaboration control. All three touch the on-disk collab store
149430
+ // (~/.moxxy/collab/{active.lock,runs}) a filesystem-touching surface so
149431
+ // each gets the boundary check the module header promises:
149432
+ // - active: no-arg pin the payload to "nothing" so no args smuggle across;
149433
+ // - history: a positive, bounded page size (matching the handler's 200
149434
+ // ceiling) so a hostile renderer can't push a non-integer/NaN/huge window;
149435
+ // - end: an optional, bounded workspace slug (the target runner to abort).
149436
+ "collab.active": z.undefined(),
149409
149437
  "collab.history": z.object({ limit: z.number().int().positive().max(200) }).partial().optional(),
149410
149438
  "collab.end": z.object({ workspaceId: optionalWorkspace }).optional(),
149411
149439
  // Vault writes are security-sensitive: lock the key name to a safe slug
@@ -153867,8 +153895,8 @@ function formatIssues(error2, raw) {
153867
153895
  const field = rest.join(".");
153868
153896
  return field ? `${where}: ${field} ${msg}` : `${where} ${msg}`;
153869
153897
  }
153870
- const path60 = iss.path.join(".");
153871
- return path60 ? `${path60} ${msg}` : `workflow ${msg}`;
153898
+ const path59 = iss.path.join(".");
153899
+ return path59 ? `${path59} ${msg}` : `workflow ${msg}`;
153872
153900
  });
153873
153901
  }
153874
153902
  function validateWorkflow(raw) {