@moxxy/cli 0.12.5 → 0.12.6

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
@@ -884,7 +884,7 @@ async function* runTurn(session, prompt, opts = {}) {
884
884
  yield queue.shift();
885
885
  if (done)
886
886
  break;
887
- await new Promise((resolve13) => waiters.push(resolve13));
887
+ await new Promise((resolve12) => waiters.push(resolve12));
888
888
  }
889
889
  } finally {
890
890
  unsubscribe();
@@ -2567,8 +2567,8 @@ var init_tools2 = __esm({
2567
2567
  const parseResult = tool.inputSchema.safeParse(input);
2568
2568
  if (!parseResult.success) {
2569
2569
  const issues = parseResult.error.issues.map((iss) => {
2570
- const path60 = iss.path.length ? iss.path.join(".") : "(root)";
2571
- return `${path60}: ${iss.message}`;
2570
+ const path59 = iss.path.length ? iss.path.join(".") : "(root)";
2571
+ return `${path59}: ${iss.message}`;
2572
2572
  }).join("; ");
2573
2573
  throw new Error(`Invalid input for ${name}: ${issues}`);
2574
2574
  }
@@ -3540,8 +3540,6 @@ var init_session = __esm({
3540
3540
  activeSynthesizer: this.synthesizers.getActiveName()
3541
3541
  };
3542
3542
  }
3543
- registerHookOptions(_hooks) {
3544
- }
3545
3543
  };
3546
3544
  }
3547
3545
  });
@@ -8406,17 +8404,17 @@ var require_visit = __commonJS({
8406
8404
  visit.BREAK = BREAK;
8407
8405
  visit.SKIP = SKIP;
8408
8406
  visit.REMOVE = REMOVE;
8409
- function visit_(key, node, visitor, path60) {
8410
- const ctrl = callVisitor(key, node, visitor, path60);
8407
+ function visit_(key, node, visitor, path59) {
8408
+ const ctrl = callVisitor(key, node, visitor, path59);
8411
8409
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
8412
- replaceNode(key, path60, ctrl);
8413
- return visit_(key, ctrl, visitor, path60);
8410
+ replaceNode(key, path59, ctrl);
8411
+ return visit_(key, ctrl, visitor, path59);
8414
8412
  }
8415
8413
  if (typeof ctrl !== "symbol") {
8416
8414
  if (identity.isCollection(node)) {
8417
- path60 = Object.freeze(path60.concat(node));
8415
+ path59 = Object.freeze(path59.concat(node));
8418
8416
  for (let i2 = 0; i2 < node.items.length; ++i2) {
8419
- const ci = visit_(i2, node.items[i2], visitor, path60);
8417
+ const ci = visit_(i2, node.items[i2], visitor, path59);
8420
8418
  if (typeof ci === "number")
8421
8419
  i2 = ci - 1;
8422
8420
  else if (ci === BREAK)
@@ -8427,13 +8425,13 @@ var require_visit = __commonJS({
8427
8425
  }
8428
8426
  }
8429
8427
  } else if (identity.isPair(node)) {
8430
- path60 = Object.freeze(path60.concat(node));
8431
- const ck = visit_("key", node.key, visitor, path60);
8428
+ path59 = Object.freeze(path59.concat(node));
8429
+ const ck = visit_("key", node.key, visitor, path59);
8432
8430
  if (ck === BREAK)
8433
8431
  return BREAK;
8434
8432
  else if (ck === REMOVE)
8435
8433
  node.key = null;
8436
- const cv = visit_("value", node.value, visitor, path60);
8434
+ const cv = visit_("value", node.value, visitor, path59);
8437
8435
  if (cv === BREAK)
8438
8436
  return BREAK;
8439
8437
  else if (cv === REMOVE)
@@ -8454,17 +8452,17 @@ var require_visit = __commonJS({
8454
8452
  visitAsync.BREAK = BREAK;
8455
8453
  visitAsync.SKIP = SKIP;
8456
8454
  visitAsync.REMOVE = REMOVE;
8457
- async function visitAsync_(key, node, visitor, path60) {
8458
- const ctrl = await callVisitor(key, node, visitor, path60);
8455
+ async function visitAsync_(key, node, visitor, path59) {
8456
+ const ctrl = await callVisitor(key, node, visitor, path59);
8459
8457
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
8460
- replaceNode(key, path60, ctrl);
8461
- return visitAsync_(key, ctrl, visitor, path60);
8458
+ replaceNode(key, path59, ctrl);
8459
+ return visitAsync_(key, ctrl, visitor, path59);
8462
8460
  }
8463
8461
  if (typeof ctrl !== "symbol") {
8464
8462
  if (identity.isCollection(node)) {
8465
- path60 = Object.freeze(path60.concat(node));
8463
+ path59 = Object.freeze(path59.concat(node));
8466
8464
  for (let i2 = 0; i2 < node.items.length; ++i2) {
8467
- const ci = await visitAsync_(i2, node.items[i2], visitor, path60);
8465
+ const ci = await visitAsync_(i2, node.items[i2], visitor, path59);
8468
8466
  if (typeof ci === "number")
8469
8467
  i2 = ci - 1;
8470
8468
  else if (ci === BREAK)
@@ -8475,13 +8473,13 @@ var require_visit = __commonJS({
8475
8473
  }
8476
8474
  }
8477
8475
  } else if (identity.isPair(node)) {
8478
- path60 = Object.freeze(path60.concat(node));
8479
- const ck = await visitAsync_("key", node.key, visitor, path60);
8476
+ path59 = Object.freeze(path59.concat(node));
8477
+ const ck = await visitAsync_("key", node.key, visitor, path59);
8480
8478
  if (ck === BREAK)
8481
8479
  return BREAK;
8482
8480
  else if (ck === REMOVE)
8483
8481
  node.key = null;
8484
- const cv = await visitAsync_("value", node.value, visitor, path60);
8482
+ const cv = await visitAsync_("value", node.value, visitor, path59);
8485
8483
  if (cv === BREAK)
8486
8484
  return BREAK;
8487
8485
  else if (cv === REMOVE)
@@ -8508,23 +8506,23 @@ var require_visit = __commonJS({
8508
8506
  }
8509
8507
  return visitor;
8510
8508
  }
8511
- function callVisitor(key, node, visitor, path60) {
8509
+ function callVisitor(key, node, visitor, path59) {
8512
8510
  if (typeof visitor === "function")
8513
- return visitor(key, node, path60);
8511
+ return visitor(key, node, path59);
8514
8512
  if (identity.isMap(node))
8515
- return visitor.Map?.(key, node, path60);
8513
+ return visitor.Map?.(key, node, path59);
8516
8514
  if (identity.isSeq(node))
8517
- return visitor.Seq?.(key, node, path60);
8515
+ return visitor.Seq?.(key, node, path59);
8518
8516
  if (identity.isPair(node))
8519
- return visitor.Pair?.(key, node, path60);
8517
+ return visitor.Pair?.(key, node, path59);
8520
8518
  if (identity.isScalar(node))
8521
- return visitor.Scalar?.(key, node, path60);
8519
+ return visitor.Scalar?.(key, node, path59);
8522
8520
  if (identity.isAlias(node))
8523
- return visitor.Alias?.(key, node, path60);
8521
+ return visitor.Alias?.(key, node, path59);
8524
8522
  return void 0;
8525
8523
  }
8526
- function replaceNode(key, path60, node) {
8527
- const parent = path60[path60.length - 1];
8524
+ function replaceNode(key, path59, node) {
8525
+ const parent = path59[path59.length - 1];
8528
8526
  if (identity.isCollection(parent)) {
8529
8527
  parent.items[key] = node;
8530
8528
  } else if (identity.isPair(parent)) {
@@ -9125,10 +9123,10 @@ var require_Collection = __commonJS({
9125
9123
  var createNode2 = require_createNode();
9126
9124
  var identity = require_identity();
9127
9125
  var Node = require_Node();
9128
- function collectionFromPath(schema, path60, value) {
9126
+ function collectionFromPath(schema, path59, value) {
9129
9127
  let v3 = value;
9130
- for (let i2 = path60.length - 1; i2 >= 0; --i2) {
9131
- const k3 = path60[i2];
9128
+ for (let i2 = path59.length - 1; i2 >= 0; --i2) {
9129
+ const k3 = path59[i2];
9132
9130
  if (typeof k3 === "number" && Number.isInteger(k3) && k3 >= 0) {
9133
9131
  const a2 = [];
9134
9132
  a2[k3] = v3;
@@ -9147,7 +9145,7 @@ var require_Collection = __commonJS({
9147
9145
  sourceObjects: /* @__PURE__ */ new Map()
9148
9146
  });
9149
9147
  }
9150
- var isEmptyPath = (path60) => path60 == null || typeof path60 === "object" && !!path60[Symbol.iterator]().next().done;
9148
+ var isEmptyPath = (path59) => path59 == null || typeof path59 === "object" && !!path59[Symbol.iterator]().next().done;
9151
9149
  var Collection = class extends Node.NodeBase {
9152
9150
  constructor(type, schema) {
9153
9151
  super(type);
@@ -9177,11 +9175,11 @@ var require_Collection = __commonJS({
9177
9175
  * be a Pair instance or a `{ key, value }` object, which may not have a key
9178
9176
  * that already exists in the map.
9179
9177
  */
9180
- addIn(path60, value) {
9181
- if (isEmptyPath(path60))
9178
+ addIn(path59, value) {
9179
+ if (isEmptyPath(path59))
9182
9180
  this.add(value);
9183
9181
  else {
9184
- const [key, ...rest] = path60;
9182
+ const [key, ...rest] = path59;
9185
9183
  const node = this.get(key, true);
9186
9184
  if (identity.isCollection(node))
9187
9185
  node.addIn(rest, value);
@@ -9195,8 +9193,8 @@ var require_Collection = __commonJS({
9195
9193
  * Removes a value from the collection.
9196
9194
  * @returns `true` if the item was found and removed.
9197
9195
  */
9198
- deleteIn(path60) {
9199
- const [key, ...rest] = path60;
9196
+ deleteIn(path59) {
9197
+ const [key, ...rest] = path59;
9200
9198
  if (rest.length === 0)
9201
9199
  return this.delete(key);
9202
9200
  const node = this.get(key, true);
@@ -9210,8 +9208,8 @@ var require_Collection = __commonJS({
9210
9208
  * scalar values from their surrounding node; to disable set `keepScalar` to
9211
9209
  * `true` (collections are always returned intact).
9212
9210
  */
9213
- getIn(path60, keepScalar) {
9214
- const [key, ...rest] = path60;
9211
+ getIn(path59, keepScalar) {
9212
+ const [key, ...rest] = path59;
9215
9213
  const node = this.get(key, true);
9216
9214
  if (rest.length === 0)
9217
9215
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -9229,8 +9227,8 @@ var require_Collection = __commonJS({
9229
9227
  /**
9230
9228
  * Checks if the collection includes a value with the key `key`.
9231
9229
  */
9232
- hasIn(path60) {
9233
- const [key, ...rest] = path60;
9230
+ hasIn(path59) {
9231
+ const [key, ...rest] = path59;
9234
9232
  if (rest.length === 0)
9235
9233
  return this.has(key);
9236
9234
  const node = this.get(key, true);
@@ -9240,8 +9238,8 @@ var require_Collection = __commonJS({
9240
9238
  * Sets a value in this collection. For `!!set`, `value` needs to be a
9241
9239
  * boolean to add/remove the item from the set.
9242
9240
  */
9243
- setIn(path60, value) {
9244
- const [key, ...rest] = path60;
9241
+ setIn(path59, value) {
9242
+ const [key, ...rest] = path59;
9245
9243
  if (rest.length === 0) {
9246
9244
  this.set(key, value);
9247
9245
  } else {
@@ -11721,9 +11719,9 @@ var require_Document = __commonJS({
11721
11719
  this.contents.add(value);
11722
11720
  }
11723
11721
  /** Adds a value to the document. */
11724
- addIn(path60, value) {
11722
+ addIn(path59, value) {
11725
11723
  if (assertCollection(this.contents))
11726
- this.contents.addIn(path60, value);
11724
+ this.contents.addIn(path59, value);
11727
11725
  }
11728
11726
  /**
11729
11727
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -11798,14 +11796,14 @@ var require_Document = __commonJS({
11798
11796
  * Removes a value from the document.
11799
11797
  * @returns `true` if the item was found and removed.
11800
11798
  */
11801
- deleteIn(path60) {
11802
- if (Collection.isEmptyPath(path60)) {
11799
+ deleteIn(path59) {
11800
+ if (Collection.isEmptyPath(path59)) {
11803
11801
  if (this.contents == null)
11804
11802
  return false;
11805
11803
  this.contents = null;
11806
11804
  return true;
11807
11805
  }
11808
- return assertCollection(this.contents) ? this.contents.deleteIn(path60) : false;
11806
+ return assertCollection(this.contents) ? this.contents.deleteIn(path59) : false;
11809
11807
  }
11810
11808
  /**
11811
11809
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -11820,10 +11818,10 @@ var require_Document = __commonJS({
11820
11818
  * scalar values from their surrounding node; to disable set `keepScalar` to
11821
11819
  * `true` (collections are always returned intact).
11822
11820
  */
11823
- getIn(path60, keepScalar) {
11824
- if (Collection.isEmptyPath(path60))
11821
+ getIn(path59, keepScalar) {
11822
+ if (Collection.isEmptyPath(path59))
11825
11823
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
11826
- return identity.isCollection(this.contents) ? this.contents.getIn(path60, keepScalar) : void 0;
11824
+ return identity.isCollection(this.contents) ? this.contents.getIn(path59, keepScalar) : void 0;
11827
11825
  }
11828
11826
  /**
11829
11827
  * Checks if the document includes a value with the key `key`.
@@ -11834,10 +11832,10 @@ var require_Document = __commonJS({
11834
11832
  /**
11835
11833
  * Checks if the document includes a value at `path`.
11836
11834
  */
11837
- hasIn(path60) {
11838
- if (Collection.isEmptyPath(path60))
11835
+ hasIn(path59) {
11836
+ if (Collection.isEmptyPath(path59))
11839
11837
  return this.contents !== void 0;
11840
- return identity.isCollection(this.contents) ? this.contents.hasIn(path60) : false;
11838
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path59) : false;
11841
11839
  }
11842
11840
  /**
11843
11841
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -11854,13 +11852,13 @@ var require_Document = __commonJS({
11854
11852
  * Sets a value in this document. For `!!set`, `value` needs to be a
11855
11853
  * boolean to add/remove the item from the set.
11856
11854
  */
11857
- setIn(path60, value) {
11858
- if (Collection.isEmptyPath(path60)) {
11855
+ setIn(path59, value) {
11856
+ if (Collection.isEmptyPath(path59)) {
11859
11857
  this.contents = value;
11860
11858
  } else if (this.contents == null) {
11861
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path60), value);
11859
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path59), value);
11862
11860
  } else if (assertCollection(this.contents)) {
11863
- this.contents.setIn(path60, value);
11861
+ this.contents.setIn(path59, value);
11864
11862
  }
11865
11863
  }
11866
11864
  /**
@@ -13800,9 +13798,9 @@ var require_cst_visit = __commonJS({
13800
13798
  visit.BREAK = BREAK;
13801
13799
  visit.SKIP = SKIP;
13802
13800
  visit.REMOVE = REMOVE;
13803
- visit.itemAtPath = (cst, path60) => {
13801
+ visit.itemAtPath = (cst, path59) => {
13804
13802
  let item = cst;
13805
- for (const [field, index] of path60) {
13803
+ for (const [field, index] of path59) {
13806
13804
  const tok = item?.[field];
13807
13805
  if (tok && "items" in tok) {
13808
13806
  item = tok.items[index];
@@ -13811,23 +13809,23 @@ var require_cst_visit = __commonJS({
13811
13809
  }
13812
13810
  return item;
13813
13811
  };
13814
- visit.parentCollection = (cst, path60) => {
13815
- const parent = visit.itemAtPath(cst, path60.slice(0, -1));
13816
- const field = path60[path60.length - 1][0];
13812
+ visit.parentCollection = (cst, path59) => {
13813
+ const parent = visit.itemAtPath(cst, path59.slice(0, -1));
13814
+ const field = path59[path59.length - 1][0];
13817
13815
  const coll = parent?.[field];
13818
13816
  if (coll && "items" in coll)
13819
13817
  return coll;
13820
13818
  throw new Error("Parent collection not found");
13821
13819
  };
13822
- function _visit(path60, item, visitor) {
13823
- let ctrl = visitor(item, path60);
13820
+ function _visit(path59, item, visitor) {
13821
+ let ctrl = visitor(item, path59);
13824
13822
  if (typeof ctrl === "symbol")
13825
13823
  return ctrl;
13826
13824
  for (const field of ["key", "value"]) {
13827
13825
  const token = item[field];
13828
13826
  if (token && "items" in token) {
13829
13827
  for (let i2 = 0; i2 < token.items.length; ++i2) {
13830
- const ci = _visit(Object.freeze(path60.concat([[field, i2]])), token.items[i2], visitor);
13828
+ const ci = _visit(Object.freeze(path59.concat([[field, i2]])), token.items[i2], visitor);
13831
13829
  if (typeof ci === "number")
13832
13830
  i2 = ci - 1;
13833
13831
  else if (ci === BREAK)
@@ -13838,10 +13836,10 @@ var require_cst_visit = __commonJS({
13838
13836
  }
13839
13837
  }
13840
13838
  if (typeof ctrl === "function" && field === "key")
13841
- ctrl = ctrl(item, path60);
13839
+ ctrl = ctrl(item, path59);
13842
13840
  }
13843
13841
  }
13844
- return typeof ctrl === "function" ? ctrl(item, path60) : ctrl;
13842
+ return typeof ctrl === "function" ? ctrl(item, path59) : ctrl;
13845
13843
  }
13846
13844
  exports.visit = visit;
13847
13845
  }
@@ -16563,14 +16561,14 @@ var require_url_state_machine = __commonJS({
16563
16561
  return url2.replace(/\u0009|\u000A|\u000D/g, "");
16564
16562
  }
16565
16563
  function shortenPath(url2) {
16566
- const path60 = url2.path;
16567
- if (path60.length === 0) {
16564
+ const path59 = url2.path;
16565
+ if (path59.length === 0) {
16568
16566
  return;
16569
16567
  }
16570
- if (url2.scheme === "file" && path60.length === 1 && isNormalizedWindowsDriveLetter(path60[0])) {
16568
+ if (url2.scheme === "file" && path59.length === 1 && isNormalizedWindowsDriveLetter(path59[0])) {
16571
16569
  return;
16572
16570
  }
16573
- path60.pop();
16571
+ path59.pop();
16574
16572
  }
16575
16573
  function includesCredentials(url2) {
16576
16574
  return url2.username !== "" || url2.password !== "";
@@ -21337,7 +21335,7 @@ function consumeBody() {
21337
21335
  let accum = [];
21338
21336
  let accumBytes = 0;
21339
21337
  let abort = false;
21340
- return new Body.Promise(function(resolve13, reject) {
21338
+ return new Body.Promise(function(resolve12, reject) {
21341
21339
  let resTimeout;
21342
21340
  if (_this4.timeout) {
21343
21341
  resTimeout = setTimeout(function() {
@@ -21371,7 +21369,7 @@ function consumeBody() {
21371
21369
  }
21372
21370
  clearTimeout(resTimeout);
21373
21371
  try {
21374
- resolve13(Buffer.concat(accum, accumBytes));
21372
+ resolve12(Buffer.concat(accum, accumBytes));
21375
21373
  } catch (err) {
21376
21374
  reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err));
21377
21375
  }
@@ -21634,7 +21632,7 @@ function fetch3(url2, opts) {
21634
21632
  throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
21635
21633
  }
21636
21634
  Body.Promise = fetch3.Promise;
21637
- return new fetch3.Promise(function(resolve13, reject) {
21635
+ return new fetch3.Promise(function(resolve12, reject) {
21638
21636
  const request = new Request2(url2, opts);
21639
21637
  const options = getNodeRequestOptions(request);
21640
21638
  const send = (options.protocol === "https:" ? https : http).request;
@@ -21767,7 +21765,7 @@ function fetch3(url2, opts) {
21767
21765
  requestOpts.body = void 0;
21768
21766
  requestOpts.headers.delete("content-length");
21769
21767
  }
21770
- resolve13(fetch3(new Request2(locationURL, requestOpts)));
21768
+ resolve12(fetch3(new Request2(locationURL, requestOpts)));
21771
21769
  finalize();
21772
21770
  return;
21773
21771
  }
@@ -21788,7 +21786,7 @@ function fetch3(url2, opts) {
21788
21786
  const codings = headers.get("Content-Encoding");
21789
21787
  if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
21790
21788
  response = new Response3(body, response_options);
21791
- resolve13(response);
21789
+ resolve12(response);
21792
21790
  return;
21793
21791
  }
21794
21792
  const zlibOptions = {
@@ -21798,7 +21796,7 @@ function fetch3(url2, opts) {
21798
21796
  if (codings == "gzip" || codings == "x-gzip") {
21799
21797
  body = body.pipe(zlib.createGunzip(zlibOptions));
21800
21798
  response = new Response3(body, response_options);
21801
- resolve13(response);
21799
+ resolve12(response);
21802
21800
  return;
21803
21801
  }
21804
21802
  if (codings == "deflate" || codings == "x-deflate") {
@@ -21810,12 +21808,12 @@ function fetch3(url2, opts) {
21810
21808
  body = body.pipe(zlib.createInflateRaw());
21811
21809
  }
21812
21810
  response = new Response3(body, response_options);
21813
- resolve13(response);
21811
+ resolve12(response);
21814
21812
  });
21815
21813
  raw.on("end", function() {
21816
21814
  if (!response) {
21817
21815
  response = new Response3(body, response_options);
21818
- resolve13(response);
21816
+ resolve12(response);
21819
21817
  }
21820
21818
  });
21821
21819
  return;
@@ -21823,11 +21821,11 @@ function fetch3(url2, opts) {
21823
21821
  if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
21824
21822
  body = body.pipe(zlib.createBrotliDecompress());
21825
21823
  response = new Response3(body, response_options);
21826
- resolve13(response);
21824
+ resolve12(response);
21827
21825
  return;
21828
21826
  }
21829
21827
  response = new Response3(body, response_options);
21830
- resolve13(response);
21828
+ resolve12(response);
21831
21829
  });
21832
21830
  writeToStream(req, request);
21833
21831
  });
@@ -25793,14 +25791,14 @@ __export(fileFromPath_exports, {
25793
25791
  fileFromPathSync: () => fileFromPathSync,
25794
25792
  isFile: () => isFile
25795
25793
  });
25796
- function createFileFromPath(path60, { mtimeMs, size }, filenameOrOptions, options = {}) {
25794
+ function createFileFromPath(path59, { mtimeMs, size }, filenameOrOptions, options = {}) {
25797
25795
  let filename;
25798
25796
  if (isPlainObject_default2(filenameOrOptions)) {
25799
25797
  [options, filename] = [filenameOrOptions, void 0];
25800
25798
  } else {
25801
25799
  filename = filenameOrOptions;
25802
25800
  }
25803
- const file = new FileFromPath({ path: path60, size, lastModified: mtimeMs });
25801
+ const file = new FileFromPath({ path: path59, size, lastModified: mtimeMs });
25804
25802
  if (!filename) {
25805
25803
  filename = file.name;
25806
25804
  }
@@ -25809,13 +25807,13 @@ function createFileFromPath(path60, { mtimeMs, size }, filenameOrOptions, option
25809
25807
  lastModified: file.lastModified
25810
25808
  });
25811
25809
  }
25812
- function fileFromPathSync(path60, filenameOrOptions, options = {}) {
25813
- const stats = statSync(path60);
25814
- return createFileFromPath(path60, stats, filenameOrOptions, options);
25810
+ function fileFromPathSync(path59, filenameOrOptions, options = {}) {
25811
+ const stats = statSync(path59);
25812
+ return createFileFromPath(path59, stats, filenameOrOptions, options);
25815
25813
  }
25816
- async function fileFromPath2(path60, filenameOrOptions, options) {
25817
- const stats = await promises.stat(path60);
25818
- return createFileFromPath(path60, stats, filenameOrOptions, options);
25814
+ async function fileFromPath2(path59, filenameOrOptions, options) {
25815
+ const stats = await promises.stat(path59);
25816
+ return createFileFromPath(path59, stats, filenameOrOptions, options);
25819
25817
  }
25820
25818
  var import_node_domexception, __classPrivateFieldSet4, __classPrivateFieldGet5, _FileFromPath_path, _FileFromPath_start, MESSAGE, FileFromPath;
25821
25819
  var init_fileFromPath = __esm({
@@ -35346,7 +35344,7 @@ var require_frameworks = __commonJS({
35346
35344
  end: () => resolveResponse({ status: 204 }),
35347
35345
  respond: (json) => resolveResponse({ jsonBody: json }),
35348
35346
  unauthorized: () => resolveResponse({ status: 401, body: WRONG_TOKEN_ERROR }),
35349
- handlerReturn: new Promise((resolve13) => resolveResponse = resolve13)
35347
+ handlerReturn: new Promise((resolve12) => resolveResponse = resolve12)
35350
35348
  };
35351
35349
  };
35352
35350
  var bun = (request) => {
@@ -35370,8 +35368,8 @@ var require_frameworks = __commonJS({
35370
35368
  };
35371
35369
  var cloudflare = (event) => {
35372
35370
  let resolveResponse;
35373
- event.respondWith(new Promise((resolve13) => {
35374
- resolveResponse = resolve13;
35371
+ event.respondWith(new Promise((resolve12) => {
35372
+ resolveResponse = resolve12;
35375
35373
  }));
35376
35374
  return {
35377
35375
  get update() {
@@ -35455,12 +35453,12 @@ var require_frameworks = __commonJS({
35455
35453
  const secretHeaderFromRequest = req.headers[SECRET_HEADER_LOWERCASE];
35456
35454
  return {
35457
35455
  get update() {
35458
- return new Promise((resolve13, reject) => {
35456
+ return new Promise((resolve12, reject) => {
35459
35457
  const chunks = [];
35460
35458
  req.on("data", (chunk) => chunks.push(chunk)).once("end", () => {
35461
35459
  const raw = Buffer.concat(chunks).toString("utf-8");
35462
35460
  try {
35463
- resolve13(JSON.parse(raw));
35461
+ resolve12(JSON.parse(raw));
35464
35462
  } catch (err) {
35465
35463
  reject(err);
35466
35464
  }
@@ -35710,7 +35708,7 @@ var require_webhook = __commonJS({
35710
35708
  function timeoutIfNecessary(task, onTimeout, timeout) {
35711
35709
  if (timeout === Infinity)
35712
35710
  return task;
35713
- return new Promise((resolve13, reject) => {
35711
+ return new Promise((resolve12, reject) => {
35714
35712
  const handle2 = setTimeout(() => {
35715
35713
  debugErr(`Request timed out after ${timeout} ms`);
35716
35714
  if (onTimeout === "throw") {
@@ -35718,7 +35716,7 @@ var require_webhook = __commonJS({
35718
35716
  } else {
35719
35717
  if (typeof onTimeout === "function")
35720
35718
  onTimeout();
35721
- resolve13();
35719
+ resolve12();
35722
35720
  }
35723
35721
  const now = Date.now();
35724
35722
  task.finally(() => {
@@ -35726,7 +35724,7 @@ var require_webhook = __commonJS({
35726
35724
  debugErr(`Request completed ${diff2} ms after timeout!`);
35727
35725
  });
35728
35726
  }, timeout);
35729
- task.then(resolve13).catch(reject).finally(() => clearTimeout(handle2));
35727
+ task.then(resolve12).catch(reject).finally(() => clearTimeout(handle2));
35730
35728
  });
35731
35729
  }
35732
35730
  }
@@ -38337,7 +38335,7 @@ var init_protocol = __esm({
38337
38335
  return;
38338
38336
  }
38339
38337
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
38340
- await new Promise((resolve13) => setTimeout(resolve13, pollInterval));
38338
+ await new Promise((resolve12) => setTimeout(resolve12, pollInterval));
38341
38339
  options?.signal?.throwIfAborted();
38342
38340
  }
38343
38341
  } catch (error2) {
@@ -38354,7 +38352,7 @@ var init_protocol = __esm({
38354
38352
  */
38355
38353
  request(request, resultSchema, options) {
38356
38354
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
38357
- return new Promise((resolve13, reject) => {
38355
+ return new Promise((resolve12, reject) => {
38358
38356
  const earlyReject = (error2) => {
38359
38357
  reject(error2);
38360
38358
  };
@@ -38432,7 +38430,7 @@ var init_protocol = __esm({
38432
38430
  if (!parseResult.success) {
38433
38431
  reject(parseResult.error);
38434
38432
  } else {
38435
- resolve13(parseResult.data);
38433
+ resolve12(parseResult.data);
38436
38434
  }
38437
38435
  } catch (error2) {
38438
38436
  reject(error2);
@@ -38693,12 +38691,12 @@ var init_protocol = __esm({
38693
38691
  }
38694
38692
  } catch {
38695
38693
  }
38696
- return new Promise((resolve13, reject) => {
38694
+ return new Promise((resolve12, reject) => {
38697
38695
  if (signal.aborted) {
38698
38696
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
38699
38697
  return;
38700
38698
  }
38701
- const timeoutId = setTimeout(resolve13, interval);
38699
+ const timeoutId = setTimeout(resolve12, interval);
38702
38700
  signal.addEventListener("abort", () => {
38703
38701
  clearTimeout(timeoutId);
38704
38702
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -41703,7 +41701,7 @@ var require_compile = __commonJS({
41703
41701
  const schOrFunc = root.refs[ref];
41704
41702
  if (schOrFunc)
41705
41703
  return schOrFunc;
41706
- let _sch = resolve13.call(this, root, ref);
41704
+ let _sch = resolve12.call(this, root, ref);
41707
41705
  if (_sch === void 0) {
41708
41706
  const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
41709
41707
  const { schemaId } = this.opts;
@@ -41730,7 +41728,7 @@ var require_compile = __commonJS({
41730
41728
  function sameSchemaEnv(s1, s2) {
41731
41729
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
41732
41730
  }
41733
- function resolve13(root, ref) {
41731
+ function resolve12(root, ref) {
41734
41732
  let sch;
41735
41733
  while (typeof (sch = this.refs[ref]) == "string")
41736
41734
  ref = sch;
@@ -41947,8 +41945,8 @@ var require_utils2 = __commonJS({
41947
41945
  }
41948
41946
  return ind;
41949
41947
  }
41950
- function removeDotSegments(path60) {
41951
- let input = path60;
41948
+ function removeDotSegments(path59) {
41949
+ let input = path59;
41952
41950
  const output = [];
41953
41951
  let nextSlash = -1;
41954
41952
  let len = 0;
@@ -42199,8 +42197,8 @@ var require_schemes = __commonJS({
42199
42197
  wsComponent.secure = void 0;
42200
42198
  }
42201
42199
  if (wsComponent.resourceName) {
42202
- const [path60, query] = wsComponent.resourceName.split("?");
42203
- wsComponent.path = path60 && path60 !== "/" ? path60 : void 0;
42200
+ const [path59, query] = wsComponent.resourceName.split("?");
42201
+ wsComponent.path = path59 && path59 !== "/" ? path59 : void 0;
42204
42202
  wsComponent.query = query;
42205
42203
  wsComponent.resourceName = void 0;
42206
42204
  }
@@ -42358,7 +42356,7 @@ var require_fast_uri = __commonJS({
42358
42356
  }
42359
42357
  return uri;
42360
42358
  }
42361
- function resolve13(baseURI, relativeURI, options) {
42359
+ function resolve12(baseURI, relativeURI, options) {
42362
42360
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
42363
42361
  const resolved = resolveComponent(parse2(baseURI, schemelessOptions), parse2(relativeURI, schemelessOptions), schemelessOptions, true);
42364
42362
  schemelessOptions.skipEscape = true;
@@ -42616,7 +42614,7 @@ var require_fast_uri = __commonJS({
42616
42614
  var fastUri = {
42617
42615
  SCHEMES,
42618
42616
  normalize: normalize4,
42619
- resolve: resolve13,
42617
+ resolve: resolve12,
42620
42618
  resolveComponent,
42621
42619
  equal,
42622
42620
  serialize,
@@ -46358,7 +46356,7 @@ var require_windows = __commonJS({
46358
46356
  module.exports = isexe;
46359
46357
  isexe.sync = sync;
46360
46358
  var fs45 = __require("fs");
46361
- function checkPathExt(path60, options) {
46359
+ function checkPathExt(path59, options) {
46362
46360
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
46363
46361
  if (!pathext) {
46364
46362
  return true;
@@ -46369,25 +46367,25 @@ var require_windows = __commonJS({
46369
46367
  }
46370
46368
  for (var i2 = 0; i2 < pathext.length; i2++) {
46371
46369
  var p3 = pathext[i2].toLowerCase();
46372
- if (p3 && path60.substr(-p3.length).toLowerCase() === p3) {
46370
+ if (p3 && path59.substr(-p3.length).toLowerCase() === p3) {
46373
46371
  return true;
46374
46372
  }
46375
46373
  }
46376
46374
  return false;
46377
46375
  }
46378
- function checkStat(stat2, path60, options) {
46376
+ function checkStat(stat2, path59, options) {
46379
46377
  if (!stat2.isSymbolicLink() && !stat2.isFile()) {
46380
46378
  return false;
46381
46379
  }
46382
- return checkPathExt(path60, options);
46380
+ return checkPathExt(path59, options);
46383
46381
  }
46384
- function isexe(path60, options, cb) {
46385
- fs45.stat(path60, function(er2, stat2) {
46386
- cb(er2, er2 ? false : checkStat(stat2, path60, options));
46382
+ function isexe(path59, options, cb) {
46383
+ fs45.stat(path59, function(er2, stat2) {
46384
+ cb(er2, er2 ? false : checkStat(stat2, path59, options));
46387
46385
  });
46388
46386
  }
46389
- function sync(path60, options) {
46390
- return checkStat(fs45.statSync(path60), path60, options);
46387
+ function sync(path59, options) {
46388
+ return checkStat(fs45.statSync(path59), path59, options);
46391
46389
  }
46392
46390
  }
46393
46391
  });
@@ -46398,13 +46396,13 @@ var require_mode = __commonJS({
46398
46396
  module.exports = isexe;
46399
46397
  isexe.sync = sync;
46400
46398
  var fs45 = __require("fs");
46401
- function isexe(path60, options, cb) {
46402
- fs45.stat(path60, function(er2, stat2) {
46399
+ function isexe(path59, options, cb) {
46400
+ fs45.stat(path59, function(er2, stat2) {
46403
46401
  cb(er2, er2 ? false : checkStat(stat2, options));
46404
46402
  });
46405
46403
  }
46406
- function sync(path60, options) {
46407
- return checkStat(fs45.statSync(path60), options);
46404
+ function sync(path59, options) {
46405
+ return checkStat(fs45.statSync(path59), options);
46408
46406
  }
46409
46407
  function checkStat(stat2, options) {
46410
46408
  return stat2.isFile() && checkMode(stat2, options);
@@ -46437,7 +46435,7 @@ var require_isexe = __commonJS({
46437
46435
  }
46438
46436
  module.exports = isexe;
46439
46437
  isexe.sync = sync;
46440
- function isexe(path60, options, cb) {
46438
+ function isexe(path59, options, cb) {
46441
46439
  if (typeof options === "function") {
46442
46440
  cb = options;
46443
46441
  options = {};
@@ -46446,17 +46444,17 @@ var require_isexe = __commonJS({
46446
46444
  if (typeof Promise !== "function") {
46447
46445
  throw new TypeError("callback not provided");
46448
46446
  }
46449
- return new Promise(function(resolve13, reject) {
46450
- isexe(path60, options || {}, function(er2, is) {
46447
+ return new Promise(function(resolve12, reject) {
46448
+ isexe(path59, options || {}, function(er2, is) {
46451
46449
  if (er2) {
46452
46450
  reject(er2);
46453
46451
  } else {
46454
- resolve13(is);
46452
+ resolve12(is);
46455
46453
  }
46456
46454
  });
46457
46455
  });
46458
46456
  }
46459
- core(path60, options || {}, function(er2, is) {
46457
+ core(path59, options || {}, function(er2, is) {
46460
46458
  if (er2) {
46461
46459
  if (er2.code === "EACCES" || options && options.ignoreErrors) {
46462
46460
  er2 = null;
@@ -46466,9 +46464,9 @@ var require_isexe = __commonJS({
46466
46464
  cb(er2, is);
46467
46465
  });
46468
46466
  }
46469
- function sync(path60, options) {
46467
+ function sync(path59, options) {
46470
46468
  try {
46471
- return core.sync(path60, options || {});
46469
+ return core.sync(path59, options || {});
46472
46470
  } catch (er2) {
46473
46471
  if (options && options.ignoreErrors || er2.code === "EACCES") {
46474
46472
  return false;
@@ -46484,7 +46482,7 @@ var require_isexe = __commonJS({
46484
46482
  var require_which = __commonJS({
46485
46483
  "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
46486
46484
  var isWindows3 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
46487
- var path60 = __require("path");
46485
+ var path59 = __require("path");
46488
46486
  var COLON = isWindows3 ? ";" : ":";
46489
46487
  var isexe = require_isexe();
46490
46488
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -46517,27 +46515,27 @@ var require_which = __commonJS({
46517
46515
  opt = {};
46518
46516
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
46519
46517
  const found = [];
46520
- const step = (i2) => new Promise((resolve13, reject) => {
46518
+ const step = (i2) => new Promise((resolve12, reject) => {
46521
46519
  if (i2 === pathEnv.length)
46522
- return opt.all && found.length ? resolve13(found) : reject(getNotFoundError(cmd));
46520
+ return opt.all && found.length ? resolve12(found) : reject(getNotFoundError(cmd));
46523
46521
  const ppRaw = pathEnv[i2];
46524
46522
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
46525
- const pCmd = path60.join(pathPart, cmd);
46523
+ const pCmd = path59.join(pathPart, cmd);
46526
46524
  const p3 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
46527
- resolve13(subStep(p3, i2, 0));
46525
+ resolve12(subStep(p3, i2, 0));
46528
46526
  });
46529
- const subStep = (p3, i2, ii) => new Promise((resolve13, reject) => {
46527
+ const subStep = (p3, i2, ii) => new Promise((resolve12, reject) => {
46530
46528
  if (ii === pathExt.length)
46531
- return resolve13(step(i2 + 1));
46529
+ return resolve12(step(i2 + 1));
46532
46530
  const ext = pathExt[ii];
46533
46531
  isexe(p3 + ext, { pathExt: pathExtExe }, (er2, is) => {
46534
46532
  if (!er2 && is) {
46535
46533
  if (opt.all)
46536
46534
  found.push(p3 + ext);
46537
46535
  else
46538
- return resolve13(p3 + ext);
46536
+ return resolve12(p3 + ext);
46539
46537
  }
46540
- return resolve13(subStep(p3, i2, ii + 1));
46538
+ return resolve12(subStep(p3, i2, ii + 1));
46541
46539
  });
46542
46540
  });
46543
46541
  return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
@@ -46549,7 +46547,7 @@ var require_which = __commonJS({
46549
46547
  for (let i2 = 0; i2 < pathEnv.length; i2++) {
46550
46548
  const ppRaw = pathEnv[i2];
46551
46549
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
46552
- const pCmd = path60.join(pathPart, cmd);
46550
+ const pCmd = path59.join(pathPart, cmd);
46553
46551
  const p3 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
46554
46552
  for (let j3 = 0; j3 < pathExt.length; j3++) {
46555
46553
  const cur = p3 + pathExt[j3];
@@ -46595,7 +46593,7 @@ var require_path_key = __commonJS({
46595
46593
  // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
46596
46594
  var require_resolveCommand = __commonJS({
46597
46595
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
46598
- var path60 = __require("path");
46596
+ var path59 = __require("path");
46599
46597
  var which = require_which();
46600
46598
  var getPathKey = require_path_key();
46601
46599
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -46613,7 +46611,7 @@ var require_resolveCommand = __commonJS({
46613
46611
  try {
46614
46612
  resolved = which.sync(parsed.command, {
46615
46613
  path: env3[getPathKey({ env: env3 })],
46616
- pathExt: withoutPathExt ? path60.delimiter : void 0
46614
+ pathExt: withoutPathExt ? path59.delimiter : void 0
46617
46615
  });
46618
46616
  } catch (e3) {
46619
46617
  } finally {
@@ -46622,7 +46620,7 @@ var require_resolveCommand = __commonJS({
46622
46620
  }
46623
46621
  }
46624
46622
  if (resolved) {
46625
- resolved = path60.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
46623
+ resolved = path59.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
46626
46624
  }
46627
46625
  return resolved;
46628
46626
  }
@@ -46673,8 +46671,8 @@ var require_shebang_command = __commonJS({
46673
46671
  if (!match) {
46674
46672
  return null;
46675
46673
  }
46676
- const [path60, argument] = match[0].replace(/#! ?/, "").split(" ");
46677
- const binary = path60.split("/").pop();
46674
+ const [path59, argument] = match[0].replace(/#! ?/, "").split(" ");
46675
+ const binary = path59.split("/").pop();
46678
46676
  if (binary === "env") {
46679
46677
  return argument;
46680
46678
  }
@@ -46707,7 +46705,7 @@ var require_readShebang = __commonJS({
46707
46705
  // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
46708
46706
  var require_parse = __commonJS({
46709
46707
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
46710
- var path60 = __require("path");
46708
+ var path59 = __require("path");
46711
46709
  var resolveCommand = require_resolveCommand();
46712
46710
  var escape4 = require_escape();
46713
46711
  var readShebang = require_readShebang();
@@ -46732,7 +46730,7 @@ var require_parse = __commonJS({
46732
46730
  const needsShell = !isExecutableRegExp.test(commandFile);
46733
46731
  if (parsed.options.forceShell || needsShell) {
46734
46732
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
46735
- parsed.command = path60.normalize(parsed.command);
46733
+ parsed.command = path59.normalize(parsed.command);
46736
46734
  parsed.command = escape4.command(parsed.command);
46737
46735
  parsed.args = parsed.args.map((arg) => escape4.argument(arg, needsDoubleEscapeMetaChars));
46738
46736
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -46933,7 +46931,7 @@ var init_stdio2 = __esm({
46933
46931
  if (this._process) {
46934
46932
  throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");
46935
46933
  }
46936
- return new Promise((resolve13, reject) => {
46934
+ return new Promise((resolve12, reject) => {
46937
46935
  this._process = (0, import_cross_spawn.default)(this._serverParams.command, this._serverParams.args ?? [], {
46938
46936
  // merge default env with server env because mcp server needs some env vars
46939
46937
  env: {
@@ -46950,7 +46948,7 @@ var init_stdio2 = __esm({
46950
46948
  this.onerror?.(error2);
46951
46949
  });
46952
46950
  this._process.on("spawn", () => {
46953
- resolve13();
46951
+ resolve12();
46954
46952
  });
46955
46953
  this._process.on("close", (_code) => {
46956
46954
  this._process = void 0;
@@ -47009,22 +47007,22 @@ var init_stdio2 = __esm({
47009
47007
  if (this._process) {
47010
47008
  const processToClose = this._process;
47011
47009
  this._process = void 0;
47012
- const closePromise = new Promise((resolve13) => {
47010
+ const closePromise = new Promise((resolve12) => {
47013
47011
  processToClose.once("close", () => {
47014
- resolve13();
47012
+ resolve12();
47015
47013
  });
47016
47014
  });
47017
47015
  try {
47018
47016
  processToClose.stdin?.end();
47019
47017
  } catch {
47020
47018
  }
47021
- await Promise.race([closePromise, new Promise((resolve13) => setTimeout(resolve13, 2e3).unref())]);
47019
+ await Promise.race([closePromise, new Promise((resolve12) => setTimeout(resolve12, 2e3).unref())]);
47022
47020
  if (processToClose.exitCode === null) {
47023
47021
  try {
47024
47022
  processToClose.kill("SIGTERM");
47025
47023
  } catch {
47026
47024
  }
47027
- await Promise.race([closePromise, new Promise((resolve13) => setTimeout(resolve13, 2e3).unref())]);
47025
+ await Promise.race([closePromise, new Promise((resolve12) => setTimeout(resolve12, 2e3).unref())]);
47028
47026
  }
47029
47027
  if (processToClose.exitCode === null) {
47030
47028
  try {
@@ -47036,15 +47034,15 @@ var init_stdio2 = __esm({
47036
47034
  this._readBuffer.clear();
47037
47035
  }
47038
47036
  send(message) {
47039
- return new Promise((resolve13) => {
47037
+ return new Promise((resolve12) => {
47040
47038
  if (!this._process?.stdin) {
47041
47039
  throw new Error("Not connected");
47042
47040
  }
47043
47041
  const json = serializeMessage(message);
47044
47042
  if (this._process.stdin.write(json)) {
47045
- resolve13();
47043
+ resolve12();
47046
47044
  } else {
47047
- this._process.stdin.once("drain", resolve13);
47045
+ this._process.stdin.once("drain", resolve12);
47048
47046
  }
47049
47047
  });
47050
47048
  }
@@ -48473,7 +48471,7 @@ var init_sse = __esm({
48473
48471
  }
48474
48472
  _startOrAuth() {
48475
48473
  const fetchImpl2 = this?._eventSourceInit?.fetch ?? this._fetch ?? fetch;
48476
- return new Promise((resolve13, reject) => {
48474
+ return new Promise((resolve12, reject) => {
48477
48475
  this._eventSource = new EventSource(this._url.href, {
48478
48476
  ...this._eventSourceInit,
48479
48477
  fetch: async (url2, init3) => {
@@ -48494,7 +48492,7 @@ var init_sse = __esm({
48494
48492
  this._abortController = new AbortController();
48495
48493
  this._eventSource.onerror = (event) => {
48496
48494
  if (event.code === 401 && this._authProvider) {
48497
- this._authThenStart().then(resolve13, reject);
48495
+ this._authThenStart().then(resolve12, reject);
48498
48496
  return;
48499
48497
  }
48500
48498
  const error2 = new SseError(event.code, event.message, event);
@@ -48516,7 +48514,7 @@ var init_sse = __esm({
48516
48514
  void this.close();
48517
48515
  return;
48518
48516
  }
48519
- resolve13();
48517
+ resolve12();
48520
48518
  });
48521
48519
  this._eventSource.onmessage = (event) => {
48522
48520
  const messageEvent = event;
@@ -49056,20 +49054,27 @@ async function defaultClientFactory(server, options = { servers: [] }) {
49056
49054
  return {
49057
49055
  async listTools() {
49058
49056
  const result = await client.listTools();
49059
- return { tools: result.tools ?? [] };
49057
+ return { tools: (result.tools ?? []).map(toToolDescriptor) };
49060
49058
  },
49061
49059
  async callTool(args) {
49062
49060
  const result = await client.callTool(args);
49063
- return {
49064
- content: result.content,
49061
+ const out = {
49062
+ content: result.content?.map(toContentBlock),
49065
49063
  isError: result.isError
49066
49064
  };
49065
+ return out;
49067
49066
  },
49068
49067
  async close() {
49069
49068
  await client.close();
49070
49069
  }
49071
49070
  };
49072
49071
  }
49072
+ function toToolDescriptor(t2) {
49073
+ return t2;
49074
+ }
49075
+ function toContentBlock(block) {
49076
+ return block;
49077
+ }
49073
49078
  async function createTransport(server) {
49074
49079
  const kind3 = server.kind ?? "stdio";
49075
49080
  if (kind3 === "stdio") {
@@ -49110,7 +49115,7 @@ var init_types2 = __esm({
49110
49115
  }
49111
49116
  });
49112
49117
  async function runMcpCallWithFallback(callPromise, signal, toolName) {
49113
- return await new Promise((resolve13, reject) => {
49118
+ return await new Promise((resolve12, reject) => {
49114
49119
  let settled = false;
49115
49120
  const settle = (fn) => {
49116
49121
  if (settled)
@@ -49127,7 +49132,7 @@ async function runMcpCallWithFallback(callPromise, signal, toolName) {
49127
49132
  settle(() => reject(new Error(`MCP tool "${toolName}" timed out after ${MCP_CALL_TIMEOUT_MS}ms`)));
49128
49133
  }, MCP_CALL_TIMEOUT_MS);
49129
49134
  signal.addEventListener("abort", onAbort, { once: true });
49130
- callPromise.then((v3) => settle(() => resolve13(v3)), (err) => settle(() => reject(err instanceof Error ? err : new Error(String(err)))));
49135
+ callPromise.then((v3) => settle(() => resolve12(v3)), (err) => settle(() => reject(err instanceof Error ? err : new Error(String(err)))));
49131
49136
  });
49132
49137
  }
49133
49138
  async function wrapMcpServerTools(opts) {
@@ -51869,14 +51874,14 @@ var require_react_development = __commonJS({
51869
51874
  var thenableResult = result;
51870
51875
  var wasAwaited = false;
51871
51876
  var thenable = {
51872
- then: function(resolve13, reject) {
51877
+ then: function(resolve12, reject) {
51873
51878
  wasAwaited = true;
51874
51879
  thenableResult.then(function(returnValue2) {
51875
51880
  popActScope(prevActScopeDepth);
51876
51881
  if (actScopeDepth === 0) {
51877
- recursivelyFlushAsyncActWork(returnValue2, resolve13, reject);
51882
+ recursivelyFlushAsyncActWork(returnValue2, resolve12, reject);
51878
51883
  } else {
51879
- resolve13(returnValue2);
51884
+ resolve12(returnValue2);
51880
51885
  }
51881
51886
  }, function(error3) {
51882
51887
  popActScope(prevActScopeDepth);
@@ -51906,20 +51911,20 @@ var require_react_development = __commonJS({
51906
51911
  ReactCurrentActQueue.current = null;
51907
51912
  }
51908
51913
  var _thenable = {
51909
- then: function(resolve13, reject) {
51914
+ then: function(resolve12, reject) {
51910
51915
  if (ReactCurrentActQueue.current === null) {
51911
51916
  ReactCurrentActQueue.current = [];
51912
- recursivelyFlushAsyncActWork(returnValue, resolve13, reject);
51917
+ recursivelyFlushAsyncActWork(returnValue, resolve12, reject);
51913
51918
  } else {
51914
- resolve13(returnValue);
51919
+ resolve12(returnValue);
51915
51920
  }
51916
51921
  }
51917
51922
  };
51918
51923
  return _thenable;
51919
51924
  } else {
51920
51925
  var _thenable2 = {
51921
- then: function(resolve13, reject) {
51922
- resolve13(returnValue);
51926
+ then: function(resolve12, reject) {
51927
+ resolve12(returnValue);
51923
51928
  }
51924
51929
  };
51925
51930
  return _thenable2;
@@ -51935,7 +51940,7 @@ var require_react_development = __commonJS({
51935
51940
  actScopeDepth = prevActScopeDepth;
51936
51941
  }
51937
51942
  }
51938
- function recursivelyFlushAsyncActWork(returnValue, resolve13, reject) {
51943
+ function recursivelyFlushAsyncActWork(returnValue, resolve12, reject) {
51939
51944
  {
51940
51945
  var queue = ReactCurrentActQueue.current;
51941
51946
  if (queue !== null) {
@@ -51944,16 +51949,16 @@ var require_react_development = __commonJS({
51944
51949
  enqueueTask(function() {
51945
51950
  if (queue.length === 0) {
51946
51951
  ReactCurrentActQueue.current = null;
51947
- resolve13(returnValue);
51952
+ resolve12(returnValue);
51948
51953
  } else {
51949
- recursivelyFlushAsyncActWork(returnValue, resolve13, reject);
51954
+ recursivelyFlushAsyncActWork(returnValue, resolve12, reject);
51950
51955
  }
51951
51956
  });
51952
51957
  } catch (error3) {
51953
51958
  reject(error3);
51954
51959
  }
51955
51960
  } else {
51956
- resolve13(returnValue);
51961
+ resolve12(returnValue);
51957
51962
  }
51958
51963
  }
51959
51964
  }
@@ -74567,10 +74572,10 @@ var require_react_reconciler_development = __commonJS({
74567
74572
  var setErrorHandler = null;
74568
74573
  var setSuspenseHandler = null;
74569
74574
  {
74570
- var copyWithDeleteImpl = function(obj, path60, index2) {
74571
- var key = path60[index2];
74575
+ var copyWithDeleteImpl = function(obj, path59, index2) {
74576
+ var key = path59[index2];
74572
74577
  var updated = isArray(obj) ? obj.slice() : assign({}, obj);
74573
- if (index2 + 1 === path60.length) {
74578
+ if (index2 + 1 === path59.length) {
74574
74579
  if (isArray(updated)) {
74575
74580
  updated.splice(key, 1);
74576
74581
  } else {
@@ -74578,11 +74583,11 @@ var require_react_reconciler_development = __commonJS({
74578
74583
  }
74579
74584
  return updated;
74580
74585
  }
74581
- updated[key] = copyWithDeleteImpl(obj[key], path60, index2 + 1);
74586
+ updated[key] = copyWithDeleteImpl(obj[key], path59, index2 + 1);
74582
74587
  return updated;
74583
74588
  };
74584
- var copyWithDelete = function(obj, path60) {
74585
- return copyWithDeleteImpl(obj, path60, 0);
74589
+ var copyWithDelete = function(obj, path59) {
74590
+ return copyWithDeleteImpl(obj, path59, 0);
74586
74591
  };
74587
74592
  var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
74588
74593
  var oldKey = oldPath[index2];
@@ -74620,17 +74625,17 @@ var require_react_reconciler_development = __commonJS({
74620
74625
  }
74621
74626
  return copyWithRenameImpl(obj, oldPath, newPath, 0);
74622
74627
  };
74623
- var copyWithSetImpl = function(obj, path60, index2, value) {
74624
- if (index2 >= path60.length) {
74628
+ var copyWithSetImpl = function(obj, path59, index2, value) {
74629
+ if (index2 >= path59.length) {
74625
74630
  return value;
74626
74631
  }
74627
- var key = path60[index2];
74632
+ var key = path59[index2];
74628
74633
  var updated = isArray(obj) ? obj.slice() : assign({}, obj);
74629
- updated[key] = copyWithSetImpl(obj[key], path60, index2 + 1, value);
74634
+ updated[key] = copyWithSetImpl(obj[key], path59, index2 + 1, value);
74630
74635
  return updated;
74631
74636
  };
74632
- var copyWithSet = function(obj, path60, value) {
74633
- return copyWithSetImpl(obj, path60, 0, value);
74637
+ var copyWithSet = function(obj, path59, value) {
74638
+ return copyWithSetImpl(obj, path59, 0, value);
74634
74639
  };
74635
74640
  var findHook = function(fiber, id) {
74636
74641
  var currentHook2 = fiber.memoizedState;
@@ -74640,10 +74645,10 @@ var require_react_reconciler_development = __commonJS({
74640
74645
  }
74641
74646
  return currentHook2;
74642
74647
  };
74643
- overrideHookState = function(fiber, id, path60, value) {
74648
+ overrideHookState = function(fiber, id, path59, value) {
74644
74649
  var hook = findHook(fiber, id);
74645
74650
  if (hook !== null) {
74646
- var newState = copyWithSet(hook.memoizedState, path60, value);
74651
+ var newState = copyWithSet(hook.memoizedState, path59, value);
74647
74652
  hook.memoizedState = newState;
74648
74653
  hook.baseState = newState;
74649
74654
  fiber.memoizedProps = assign({}, fiber.memoizedProps);
@@ -74653,10 +74658,10 @@ var require_react_reconciler_development = __commonJS({
74653
74658
  }
74654
74659
  }
74655
74660
  };
74656
- overrideHookStateDeletePath = function(fiber, id, path60) {
74661
+ overrideHookStateDeletePath = function(fiber, id, path59) {
74657
74662
  var hook = findHook(fiber, id);
74658
74663
  if (hook !== null) {
74659
- var newState = copyWithDelete(hook.memoizedState, path60);
74664
+ var newState = copyWithDelete(hook.memoizedState, path59);
74660
74665
  hook.memoizedState = newState;
74661
74666
  hook.baseState = newState;
74662
74667
  fiber.memoizedProps = assign({}, fiber.memoizedProps);
@@ -74679,8 +74684,8 @@ var require_react_reconciler_development = __commonJS({
74679
74684
  }
74680
74685
  }
74681
74686
  };
74682
- overrideProps = function(fiber, path60, value) {
74683
- fiber.pendingProps = copyWithSet(fiber.memoizedProps, path60, value);
74687
+ overrideProps = function(fiber, path59, value) {
74688
+ fiber.pendingProps = copyWithSet(fiber.memoizedProps, path59, value);
74684
74689
  if (fiber.alternate) {
74685
74690
  fiber.alternate.pendingProps = fiber.pendingProps;
74686
74691
  }
@@ -74689,8 +74694,8 @@ var require_react_reconciler_development = __commonJS({
74689
74694
  scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
74690
74695
  }
74691
74696
  };
74692
- overridePropsDeletePath = function(fiber, path60) {
74693
- fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path60);
74697
+ overridePropsDeletePath = function(fiber, path59) {
74698
+ fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path59);
74694
74699
  if (fiber.alternate) {
74695
74700
  fiber.alternate.pendingProps = fiber.pendingProps;
74696
74701
  }
@@ -79785,11 +79790,11 @@ var init_devtools = __esm({
79785
79790
  devtools_stub_default.connectToDevTools();
79786
79791
  }
79787
79792
  });
79788
- var import_react_reconciler, import_constants18, diff, cleanupYogaNode, reconciler_default;
79793
+ var import_react_reconciler, import_constants17, diff, cleanupYogaNode, reconciler_default;
79789
79794
  var init_reconciler = __esm({
79790
79795
  async "../../node_modules/.pnpm/ink@5.2.1_@types+react@18.3.28_react@18.3.1/node_modules/ink/build/reconciler.js"() {
79791
79796
  import_react_reconciler = __toESM(require_react_reconciler());
79792
- import_constants18 = __toESM(require_constants3());
79797
+ import_constants17 = __toESM(require_constants3());
79793
79798
  await init_src();
79794
79799
  await init_dom();
79795
79800
  await init_styles();
@@ -79939,7 +79944,7 @@ $ npm install --save-dev react-devtools-core
79939
79944
  scheduleTimeout: setTimeout,
79940
79945
  cancelTimeout: clearTimeout,
79941
79946
  noTimeout: -1,
79942
- getCurrentEventPriority: () => import_constants18.DefaultEventPriority,
79947
+ getCurrentEventPriority: () => import_constants17.DefaultEventPriority,
79943
79948
  beforeActiveInstanceBlur() {
79944
79949
  },
79945
79950
  afterActiveInstanceBlur() {
@@ -82132,8 +82137,8 @@ var init_ErrorOverview = __esm({
82132
82137
  init_dist7();
82133
82138
  init_Box();
82134
82139
  init_Text();
82135
- cleanupPath = (path60) => {
82136
- return path60?.replace(`file://${cwd()}/`, "");
82140
+ cleanupPath = (path59) => {
82141
+ return path59?.replace(`file://${cwd()}/`, "");
82137
82142
  };
82138
82143
  stackUtils = new import_stack_utils.default({
82139
82144
  cwd: cwd(),
@@ -82628,8 +82633,8 @@ var init_ink = __esm({
82628
82633
  }
82629
82634
  }
82630
82635
  async waitUntilExit() {
82631
- this.exitPromise ||= new Promise((resolve13, reject) => {
82632
- this.resolveExitPromise = resolve13;
82636
+ this.exitPromise ||= new Promise((resolve12, reject) => {
82637
+ this.resolveExitPromise = resolve12;
82633
82638
  this.rejectExitPromise = reject;
82634
82639
  });
82635
82640
  return this.exitPromise;
@@ -87095,14 +87100,14 @@ function usePermissionQueue(session, registerInteractiveResolver) {
87095
87100
  if (yoloRef.current) {
87096
87101
  return { mode: "allow", reason: "yolo mode" };
87097
87102
  }
87098
- return new Promise((resolve13) => {
87099
- setPendingPermissions((prev) => [...prev, { call, ctx, resolve: resolve13 }]);
87103
+ return new Promise((resolve12) => {
87104
+ setPendingPermissions((prev) => [...prev, { call, ctx, resolve: resolve12 }]);
87100
87105
  });
87101
87106
  });
87102
87107
  session.setApprovalResolver({
87103
87108
  name: "tui-approval",
87104
- confirm: (request) => new Promise((resolve13) => {
87105
- setPendingApproval({ request, resolve: resolve13 });
87109
+ confirm: (request) => new Promise((resolve12) => {
87110
+ setPendingApproval({ request, resolve: resolve12 });
87106
87111
  })
87107
87112
  });
87108
87113
  return () => {
@@ -87185,14 +87190,14 @@ async function startVoiceRecording(opts = {}) {
87185
87190
  while (Buffer$1.concat(stderrChunks).byteLength > 16384)
87186
87191
  stderrChunks.shift();
87187
87192
  });
87188
- const closed = new Promise((resolve13) => {
87193
+ const closed = new Promise((resolve12) => {
87189
87194
  child.once("close", (code, signal) => {
87190
87195
  closeState = { code, signal };
87191
- resolve13();
87196
+ resolve12();
87192
87197
  });
87193
87198
  });
87194
- await new Promise((resolve13, reject) => {
87195
- child.once("spawn", resolve13);
87199
+ await new Promise((resolve12, reject) => {
87200
+ child.once("spawn", resolve12);
87196
87201
  child.once("error", (err) => reject(toSpawnError(command, err)));
87197
87202
  });
87198
87203
  let stopPromise = null;
@@ -87215,14 +87220,14 @@ async function checkVoiceCaptureAvailable(opts = {}) {
87215
87220
  const child = (opts.spawnImpl ?? spawn)(command, ["-version"], {
87216
87221
  stdio: ["ignore", "ignore", "ignore"]
87217
87222
  });
87218
- return new Promise((resolve13) => {
87223
+ return new Promise((resolve12) => {
87219
87224
  let settled = false;
87220
87225
  const done = (check) => {
87221
87226
  if (settled)
87222
87227
  return;
87223
87228
  settled = true;
87224
87229
  clearTimeout(timer);
87225
- resolve13(check);
87230
+ resolve12(check);
87226
87231
  };
87227
87232
  const timer = setTimeout(() => {
87228
87233
  if (!child.killed)
@@ -89366,9 +89371,9 @@ var init_SessionView = __esm({
89366
89371
  }, onApprovalDecide: (decision) => {
89367
89372
  if (!pendingApproval)
89368
89373
  return;
89369
- const { resolve: resolve13 } = pendingApproval;
89374
+ const { resolve: resolve12 } = pendingApproval;
89370
89375
  permissions.setPendingApproval(null);
89371
- resolve13(decision);
89376
+ resolve12(decision);
89372
89377
  }, onPickerSelect: handlePickerSelect, onPickerCancel: () => setPicker(null), onSubmit: handleSubmit, onPasteText: images.handlePasteText }), (0, import_jsx_runtime36.jsx)(StatusLine, { busyStartedAt: turn.busy && !pendingPermission && !pendingApproval ? turn.busyStartedAt : null, queueCount: turn.queueCount, modeName, modeBadge, provider: providerName2, model: activeModel2, mcp: mcpStatus, contextUsed, ...contextWindow ? { contextWindow } : {}, ...version ? { version } : {}, ...updateAvailable ? { updateLatest: updateAvailable.latest } : {} })] });
89373
89378
  };
89374
89379
  }
@@ -91336,10 +91341,10 @@ var require_segments = __commonJS({
91336
91341
  const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
91337
91342
  const nodes = buildNodes(segs);
91338
91343
  const graph = buildGraph(nodes, version);
91339
- const path60 = dijkstra.find_path(graph.map, "start", "end");
91344
+ const path59 = dijkstra.find_path(graph.map, "start", "end");
91340
91345
  const optimizedSegs = [];
91341
- for (let i2 = 1; i2 < path60.length - 1; i2++) {
91342
- optimizedSegs.push(graph.table[path60[i2]].node);
91346
+ for (let i2 = 1; i2 < path59.length - 1; i2++) {
91347
+ optimizedSegs.push(graph.table[path59[i2]].node);
91343
91348
  }
91344
91349
  return exports.fromArray(mergeSegments(optimizedSegs));
91345
91350
  };
@@ -93791,7 +93796,7 @@ var require_png2 = __commonJS({
93791
93796
  });
93792
93797
  png.pack();
93793
93798
  };
93794
- exports.renderToFile = function renderToFile(path60, qrData, options, cb) {
93799
+ exports.renderToFile = function renderToFile(path59, qrData, options, cb) {
93795
93800
  if (typeof cb === "undefined") {
93796
93801
  cb = options;
93797
93802
  options = void 0;
@@ -93802,7 +93807,7 @@ var require_png2 = __commonJS({
93802
93807
  called = true;
93803
93808
  cb.apply(null, args);
93804
93809
  };
93805
- const stream = fs45.createWriteStream(path60);
93810
+ const stream = fs45.createWriteStream(path59);
93806
93811
  stream.on("error", done);
93807
93812
  stream.on("close", done);
93808
93813
  exports.renderToFileStream(stream, qrData, options);
@@ -93864,14 +93869,14 @@ var require_utf8 = __commonJS({
93864
93869
  }
93865
93870
  return output;
93866
93871
  };
93867
- exports.renderToFile = function renderToFile(path60, qrData, options, cb) {
93872
+ exports.renderToFile = function renderToFile(path59, qrData, options, cb) {
93868
93873
  if (typeof cb === "undefined") {
93869
93874
  cb = options;
93870
93875
  options = void 0;
93871
93876
  }
93872
93877
  const fs45 = __require("fs");
93873
93878
  const utf8 = exports.render(qrData, options);
93874
- fs45.writeFile(path60, utf8, cb);
93879
+ fs45.writeFile(path59, utf8, cb);
93875
93880
  };
93876
93881
  }
93877
93882
  });
@@ -93992,7 +93997,7 @@ var require_svg_tag = __commonJS({
93992
93997
  return str2;
93993
93998
  }
93994
93999
  function qrToPath(data, size, margin) {
93995
- let path60 = "";
94000
+ let path59 = "";
93996
94001
  let moveBy = 0;
93997
94002
  let newRow = false;
93998
94003
  let lineLength = 0;
@@ -94003,19 +94008,19 @@ var require_svg_tag = __commonJS({
94003
94008
  if (data[i2]) {
94004
94009
  lineLength++;
94005
94010
  if (!(i2 > 0 && col > 0 && data[i2 - 1])) {
94006
- path60 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
94011
+ path59 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
94007
94012
  moveBy = 0;
94008
94013
  newRow = false;
94009
94014
  }
94010
94015
  if (!(col + 1 < size && data[i2 + 1])) {
94011
- path60 += svgCmd("h", lineLength);
94016
+ path59 += svgCmd("h", lineLength);
94012
94017
  lineLength = 0;
94013
94018
  }
94014
94019
  } else {
94015
94020
  moveBy++;
94016
94021
  }
94017
94022
  }
94018
- return path60;
94023
+ return path59;
94019
94024
  }
94020
94025
  exports.render = function render2(qrData, options, cb) {
94021
94026
  const opts = Utils.getOptions(options);
@@ -94023,10 +94028,10 @@ var require_svg_tag = __commonJS({
94023
94028
  const data = qrData.modules.data;
94024
94029
  const qrcodesize = size + opts.margin * 2;
94025
94030
  const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + ' d="M0 0h' + qrcodesize + "v" + qrcodesize + 'H0z"/>';
94026
- const path60 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
94031
+ const path59 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
94027
94032
  const viewBox = 'viewBox="0 0 ' + qrcodesize + " " + qrcodesize + '"';
94028
94033
  const width = !opts.width ? "" : 'width="' + opts.width + '" height="' + opts.width + '" ';
94029
- const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path60 + "</svg>\n";
94034
+ const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path59 + "</svg>\n";
94030
94035
  if (typeof cb === "function") {
94031
94036
  cb(null, svgTag);
94032
94037
  }
@@ -94040,7 +94045,7 @@ var require_svg = __commonJS({
94040
94045
  "../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg.js"(exports) {
94041
94046
  var svgTagRenderer = require_svg_tag();
94042
94047
  exports.render = svgTagRenderer.render;
94043
- exports.renderToFile = function renderToFile(path60, qrData, options, cb) {
94048
+ exports.renderToFile = function renderToFile(path59, qrData, options, cb) {
94044
94049
  if (typeof cb === "undefined") {
94045
94050
  cb = options;
94046
94051
  options = void 0;
@@ -94048,7 +94053,7 @@ var require_svg = __commonJS({
94048
94053
  const fs45 = __require("fs");
94049
94054
  const svgTag = exports.render(qrData, options);
94050
94055
  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;
94051
- fs45.writeFile(path60, xmlStr, cb);
94056
+ fs45.writeFile(path59, xmlStr, cb);
94052
94057
  };
94053
94058
  }
94054
94059
  });
@@ -94151,10 +94156,10 @@ var require_browser2 = __commonJS({
94151
94156
  text = canvas;
94152
94157
  canvas = void 0;
94153
94158
  }
94154
- return new Promise(function(resolve13, reject) {
94159
+ return new Promise(function(resolve12, reject) {
94155
94160
  try {
94156
94161
  const data = QRCode2.create(text, opts);
94157
- resolve13(renderFunc(data, canvas, opts));
94162
+ resolve12(renderFunc(data, canvas, opts));
94158
94163
  } catch (e3) {
94159
94164
  reject(e3);
94160
94165
  }
@@ -94206,8 +94211,8 @@ var require_server = __commonJS({
94206
94211
  cb
94207
94212
  };
94208
94213
  }
94209
- function getTypeFromFilename(path60) {
94210
- return path60.slice((path60.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
94214
+ function getTypeFromFilename(path59) {
94215
+ return path59.slice((path59.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
94211
94216
  }
94212
94217
  function getRendererFromType(type) {
94213
94218
  switch (type) {
@@ -94235,11 +94240,11 @@ var require_server = __commonJS({
94235
94240
  }
94236
94241
  function render2(renderFunc, text, params) {
94237
94242
  if (!params.cb) {
94238
- return new Promise(function(resolve13, reject) {
94243
+ return new Promise(function(resolve12, reject) {
94239
94244
  try {
94240
94245
  const data = QRCode2.create(text, params.opts);
94241
94246
  return renderFunc(data, params.opts, function(err, data2) {
94242
- return err ? reject(err) : resolve13(data2);
94247
+ return err ? reject(err) : resolve12(data2);
94243
94248
  });
94244
94249
  } catch (e3) {
94245
94250
  reject(e3);
@@ -94271,17 +94276,17 @@ var require_server = __commonJS({
94271
94276
  const renderer2 = getRendererFromType(params.opts.type);
94272
94277
  return render2(renderer2.renderToBuffer, text, params);
94273
94278
  };
94274
- exports.toFile = function toFile3(path60, text, opts, cb) {
94275
- if (typeof path60 !== "string" || !(typeof text === "string" || typeof text === "object")) {
94279
+ exports.toFile = function toFile3(path59, text, opts, cb) {
94280
+ if (typeof path59 !== "string" || !(typeof text === "string" || typeof text === "object")) {
94276
94281
  throw new Error("Invalid argument");
94277
94282
  }
94278
94283
  if (arguments.length < 3 && !canPromise()) {
94279
94284
  throw new Error("Too few arguments provided");
94280
94285
  }
94281
94286
  const params = checkParams(text, opts, cb);
94282
- const type = params.opts.type || getTypeFromFilename(path60);
94287
+ const type = params.opts.type || getTypeFromFilename(path59);
94283
94288
  const renderer2 = getRendererFromType(type);
94284
- const renderToFile = renderer2.renderToFile.bind(null, path60);
94289
+ const renderToFile = renderer2.renderToFile.bind(null, path59);
94285
94290
  return render2(renderToFile, text, params);
94286
94291
  };
94287
94292
  exports.toFileStream = function toFileStream(stream, text, opts) {
@@ -95101,14 +95106,14 @@ var require_util2 = __commonJS({
95101
95106
  }
95102
95107
  const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
95103
95108
  let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
95104
- let path60 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
95109
+ let path59 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
95105
95110
  if (origin[origin.length - 1] === "/") {
95106
95111
  origin = origin.slice(0, origin.length - 1);
95107
95112
  }
95108
- if (path60 && path60[0] !== "/") {
95109
- path60 = `/${path60}`;
95113
+ if (path59 && path59[0] !== "/") {
95114
+ path59 = `/${path59}`;
95110
95115
  }
95111
- return new URL(`${origin}${path60}`);
95116
+ return new URL(`${origin}${path59}`);
95112
95117
  }
95113
95118
  if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
95114
95119
  throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -95558,39 +95563,39 @@ var require_diagnostics = __commonJS({
95558
95563
  });
95559
95564
  diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
95560
95565
  const {
95561
- request: { method, path: path60, origin }
95566
+ request: { method, path: path59, origin }
95562
95567
  } = evt;
95563
- debuglog("sending request to %s %s/%s", method, origin, path60);
95568
+ debuglog("sending request to %s %s/%s", method, origin, path59);
95564
95569
  });
95565
95570
  diagnosticsChannel.channel("undici:request:headers").subscribe((evt) => {
95566
95571
  const {
95567
- request: { method, path: path60, origin },
95572
+ request: { method, path: path59, origin },
95568
95573
  response: { statusCode }
95569
95574
  } = evt;
95570
95575
  debuglog(
95571
95576
  "received response to %s %s/%s - HTTP %d",
95572
95577
  method,
95573
95578
  origin,
95574
- path60,
95579
+ path59,
95575
95580
  statusCode
95576
95581
  );
95577
95582
  });
95578
95583
  diagnosticsChannel.channel("undici:request:trailers").subscribe((evt) => {
95579
95584
  const {
95580
- request: { method, path: path60, origin }
95585
+ request: { method, path: path59, origin }
95581
95586
  } = evt;
95582
- debuglog("trailers received from %s %s/%s", method, origin, path60);
95587
+ debuglog("trailers received from %s %s/%s", method, origin, path59);
95583
95588
  });
95584
95589
  diagnosticsChannel.channel("undici:request:error").subscribe((evt) => {
95585
95590
  const {
95586
- request: { method, path: path60, origin },
95591
+ request: { method, path: path59, origin },
95587
95592
  error: error2
95588
95593
  } = evt;
95589
95594
  debuglog(
95590
95595
  "request to %s %s/%s errored - %s",
95591
95596
  method,
95592
95597
  origin,
95593
- path60,
95598
+ path59,
95594
95599
  error2.message
95595
95600
  );
95596
95601
  });
@@ -95639,9 +95644,9 @@ var require_diagnostics = __commonJS({
95639
95644
  });
95640
95645
  diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
95641
95646
  const {
95642
- request: { method, path: path60, origin }
95647
+ request: { method, path: path59, origin }
95643
95648
  } = evt;
95644
- debuglog("sending request to %s %s/%s", method, origin, path60);
95649
+ debuglog("sending request to %s %s/%s", method, origin, path59);
95645
95650
  });
95646
95651
  }
95647
95652
  diagnosticsChannel.channel("undici:websocket:open").subscribe((evt) => {
@@ -95703,7 +95708,7 @@ var require_request = __commonJS({
95703
95708
  var kHandler = /* @__PURE__ */ Symbol("handler");
95704
95709
  var Request4 = class {
95705
95710
  constructor(origin, {
95706
- path: path60,
95711
+ path: path59,
95707
95712
  method,
95708
95713
  body,
95709
95714
  headers,
@@ -95718,11 +95723,11 @@ var require_request = __commonJS({
95718
95723
  expectContinue,
95719
95724
  servername
95720
95725
  }, handler) {
95721
- if (typeof path60 !== "string") {
95726
+ if (typeof path59 !== "string") {
95722
95727
  throw new InvalidArgumentError("path must be a string");
95723
- } else if (path60[0] !== "/" && !(path60.startsWith("http://") || path60.startsWith("https://")) && method !== "CONNECT") {
95728
+ } else if (path59[0] !== "/" && !(path59.startsWith("http://") || path59.startsWith("https://")) && method !== "CONNECT") {
95724
95729
  throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
95725
- } else if (invalidPathRegex.test(path60)) {
95730
+ } else if (invalidPathRegex.test(path59)) {
95726
95731
  throw new InvalidArgumentError("invalid request path");
95727
95732
  }
95728
95733
  if (typeof method !== "string") {
@@ -95788,7 +95793,7 @@ var require_request = __commonJS({
95788
95793
  this.completed = false;
95789
95794
  this.aborted = false;
95790
95795
  this.upgrade = upgrade || null;
95791
- this.path = query ? buildURL(path60, query) : path60;
95796
+ this.path = query ? buildURL(path59, query) : path59;
95792
95797
  this.origin = origin;
95793
95798
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
95794
95799
  this.blocking = blocking == null ? false : blocking;
@@ -96111,9 +96116,9 @@ var require_dispatcher_base = __commonJS({
96111
96116
  }
96112
96117
  close(callback) {
96113
96118
  if (callback === void 0) {
96114
- return new Promise((resolve13, reject) => {
96119
+ return new Promise((resolve12, reject) => {
96115
96120
  this.close((err, data) => {
96116
- return err ? reject(err) : resolve13(data);
96121
+ return err ? reject(err) : resolve12(data);
96117
96122
  });
96118
96123
  });
96119
96124
  }
@@ -96151,12 +96156,12 @@ var require_dispatcher_base = __commonJS({
96151
96156
  err = null;
96152
96157
  }
96153
96158
  if (callback === void 0) {
96154
- return new Promise((resolve13, reject) => {
96159
+ return new Promise((resolve12, reject) => {
96155
96160
  this.destroy(err, (err2, data) => {
96156
96161
  return err2 ? (
96157
96162
  /* istanbul ignore next: should never error */
96158
96163
  reject(err2)
96159
- ) : resolve13(data);
96164
+ ) : resolve12(data);
96160
96165
  });
96161
96166
  });
96162
96167
  }
@@ -98406,8 +98411,8 @@ var require_util3 = __commonJS({
98406
98411
  function createDeferredPromise() {
98407
98412
  let res;
98408
98413
  let rej;
98409
- const promise = new Promise((resolve13, reject) => {
98410
- res = resolve13;
98414
+ const promise = new Promise((resolve12, reject) => {
98415
+ res = resolve12;
98411
98416
  rej = reject;
98412
98417
  });
98413
98418
  return { promise, resolve: res, reject: rej };
@@ -100326,7 +100331,7 @@ var require_client_h1 = __commonJS({
100326
100331
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
100327
100332
  }
100328
100333
  function writeH1(client, request) {
100329
- const { method, path: path60, host, upgrade, blocking, reset } = request;
100334
+ const { method, path: path59, host, upgrade, blocking, reset } = request;
100330
100335
  let { body, headers, contentLength } = request;
100331
100336
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
100332
100337
  if (util.isFormDataLike(body)) {
@@ -100392,7 +100397,7 @@ var require_client_h1 = __commonJS({
100392
100397
  if (blocking) {
100393
100398
  socket[kBlocking] = true;
100394
100399
  }
100395
- let header = `${method} ${path60} HTTP/1.1\r
100400
+ let header = `${method} ${path59} HTTP/1.1\r
100396
100401
  `;
100397
100402
  if (typeof host === "string") {
100398
100403
  header += `host: ${host}\r
@@ -100579,12 +100584,12 @@ upgrade: ${upgrade}\r
100579
100584
  cb();
100580
100585
  }
100581
100586
  }
100582
- const waitForDrain = () => new Promise((resolve13, reject) => {
100587
+ const waitForDrain = () => new Promise((resolve12, reject) => {
100583
100588
  assert(callback === null);
100584
100589
  if (socket[kError]) {
100585
100590
  reject(socket[kError]);
100586
100591
  } else {
100587
- callback = resolve13;
100592
+ callback = resolve12;
100588
100593
  }
100589
100594
  });
100590
100595
  socket.on("close", onDrain).on("drain", onDrain);
@@ -100917,7 +100922,7 @@ var require_client_h2 = __commonJS({
100917
100922
  }
100918
100923
  function writeH2(client, request) {
100919
100924
  const session = client[kHTTP2Session];
100920
- const { method, path: path60, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
100925
+ const { method, path: path59, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
100921
100926
  let { body } = request;
100922
100927
  if (upgrade) {
100923
100928
  util.errorRequest(client, request, new Error("Upgrade not supported for H2"));
@@ -100984,7 +100989,7 @@ var require_client_h2 = __commonJS({
100984
100989
  });
100985
100990
  return true;
100986
100991
  }
100987
- headers[HTTP2_HEADER_PATH] = path60;
100992
+ headers[HTTP2_HEADER_PATH] = path59;
100988
100993
  headers[HTTP2_HEADER_SCHEME] = "https";
100989
100994
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
100990
100995
  if (body && typeof body.read === "function") {
@@ -101220,12 +101225,12 @@ var require_client_h2 = __commonJS({
101220
101225
  cb();
101221
101226
  }
101222
101227
  }
101223
- const waitForDrain = () => new Promise((resolve13, reject) => {
101228
+ const waitForDrain = () => new Promise((resolve12, reject) => {
101224
101229
  assert(callback === null);
101225
101230
  if (socket[kError]) {
101226
101231
  reject(socket[kError]);
101227
101232
  } else {
101228
- callback = resolve13;
101233
+ callback = resolve12;
101229
101234
  }
101230
101235
  });
101231
101236
  h2stream.on("close", onDrain).on("drain", onDrain);
@@ -101336,9 +101341,9 @@ var require_redirect_handler = __commonJS({
101336
101341
  return this.handler.onHeaders(statusCode, headers, resume, statusText);
101337
101342
  }
101338
101343
  const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
101339
- const path60 = search ? `${pathname}${search}` : pathname;
101344
+ const path59 = search ? `${pathname}${search}` : pathname;
101340
101345
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
101341
- this.opts.path = path60;
101346
+ this.opts.path = path59;
101342
101347
  this.opts.origin = origin;
101343
101348
  this.opts.maxRedirections = 0;
101344
101349
  this.opts.query = null;
@@ -101698,16 +101703,16 @@ var require_client2 = __commonJS({
101698
101703
  return this[kNeedDrain] < 2;
101699
101704
  }
101700
101705
  async [kClose]() {
101701
- return new Promise((resolve13) => {
101706
+ return new Promise((resolve12) => {
101702
101707
  if (this[kSize]) {
101703
- this[kClosedResolve] = resolve13;
101708
+ this[kClosedResolve] = resolve12;
101704
101709
  } else {
101705
- resolve13(null);
101710
+ resolve12(null);
101706
101711
  }
101707
101712
  });
101708
101713
  }
101709
101714
  async [kDestroy](err) {
101710
- return new Promise((resolve13) => {
101715
+ return new Promise((resolve12) => {
101711
101716
  const requests = this[kQueue].splice(this[kPendingIdx]);
101712
101717
  for (let i2 = 0; i2 < requests.length; i2++) {
101713
101718
  const request = requests[i2];
@@ -101718,7 +101723,7 @@ var require_client2 = __commonJS({
101718
101723
  this[kClosedResolve]();
101719
101724
  this[kClosedResolve] = null;
101720
101725
  }
101721
- resolve13(null);
101726
+ resolve12(null);
101722
101727
  };
101723
101728
  if (this[kHTTPContext]) {
101724
101729
  this[kHTTPContext].destroy(err, callback);
@@ -101769,7 +101774,7 @@ var require_client2 = __commonJS({
101769
101774
  });
101770
101775
  }
101771
101776
  try {
101772
- const socket = await new Promise((resolve13, reject) => {
101777
+ const socket = await new Promise((resolve12, reject) => {
101773
101778
  client[kConnector]({
101774
101779
  host,
101775
101780
  hostname,
@@ -101781,7 +101786,7 @@ var require_client2 = __commonJS({
101781
101786
  if (err) {
101782
101787
  reject(err);
101783
101788
  } else {
101784
- resolve13(socket2);
101789
+ resolve12(socket2);
101785
101790
  }
101786
101791
  });
101787
101792
  });
@@ -102115,8 +102120,8 @@ var require_pool_base = __commonJS({
102115
102120
  if (this[kQueue].isEmpty()) {
102116
102121
  await Promise.all(this[kClients].map((c2) => c2.close()));
102117
102122
  } else {
102118
- await new Promise((resolve13) => {
102119
- this[kClosedResolve] = resolve13;
102123
+ await new Promise((resolve12) => {
102124
+ this[kClosedResolve] = resolve12;
102120
102125
  });
102121
102126
  }
102122
102127
  }
@@ -102563,10 +102568,10 @@ var require_proxy_agent = __commonJS({
102563
102568
  };
102564
102569
  const {
102565
102570
  origin,
102566
- path: path60 = "/",
102571
+ path: path59 = "/",
102567
102572
  headers = {}
102568
102573
  } = opts;
102569
- opts.path = origin + path60;
102574
+ opts.path = origin + path59;
102570
102575
  if (!("host" in headers) && !("Host" in headers)) {
102571
102576
  const { host } = new URL3(origin);
102572
102577
  headers.host = host;
@@ -103323,7 +103328,7 @@ var require_readable = __commonJS({
103323
103328
  if (this._readableState.closeEmitted) {
103324
103329
  return null;
103325
103330
  }
103326
- return await new Promise((resolve13, reject) => {
103331
+ return await new Promise((resolve12, reject) => {
103327
103332
  if (this[kContentLength] > limit2) {
103328
103333
  this.destroy(new AbortError2());
103329
103334
  }
@@ -103336,7 +103341,7 @@ var require_readable = __commonJS({
103336
103341
  if (signal?.aborted) {
103337
103342
  reject(signal.reason ?? new AbortError2());
103338
103343
  } else {
103339
- resolve13(null);
103344
+ resolve12(null);
103340
103345
  }
103341
103346
  }).on("error", noop3).on("data", function(chunk) {
103342
103347
  limit2 -= chunk.length;
@@ -103355,7 +103360,7 @@ var require_readable = __commonJS({
103355
103360
  }
103356
103361
  async function consume(stream, type) {
103357
103362
  assert(!stream[kConsume]);
103358
- return new Promise((resolve13, reject) => {
103363
+ return new Promise((resolve12, reject) => {
103359
103364
  if (isUnusable(stream)) {
103360
103365
  const rState = stream._readableState;
103361
103366
  if (rState.destroyed && rState.closeEmitted === false) {
@@ -103372,7 +103377,7 @@ var require_readable = __commonJS({
103372
103377
  stream[kConsume] = {
103373
103378
  type,
103374
103379
  stream,
103375
- resolve: resolve13,
103380
+ resolve: resolve12,
103376
103381
  reject,
103377
103382
  length: 0,
103378
103383
  body: []
@@ -103442,18 +103447,18 @@ var require_readable = __commonJS({
103442
103447
  return buffer;
103443
103448
  }
103444
103449
  function consumeEnd(consume2) {
103445
- const { type, body, resolve: resolve13, stream, length } = consume2;
103450
+ const { type, body, resolve: resolve12, stream, length } = consume2;
103446
103451
  try {
103447
103452
  if (type === "text") {
103448
- resolve13(chunksDecode(body, length));
103453
+ resolve12(chunksDecode(body, length));
103449
103454
  } else if (type === "json") {
103450
- resolve13(JSON.parse(chunksDecode(body, length)));
103455
+ resolve12(JSON.parse(chunksDecode(body, length)));
103451
103456
  } else if (type === "arrayBuffer") {
103452
- resolve13(chunksConcat(body, length).buffer);
103457
+ resolve12(chunksConcat(body, length).buffer);
103453
103458
  } else if (type === "blob") {
103454
- resolve13(new Blob(body, { type: stream[kContentType] }));
103459
+ resolve12(new Blob(body, { type: stream[kContentType] }));
103455
103460
  } else if (type === "bytes") {
103456
- resolve13(chunksConcat(body, length));
103461
+ resolve12(chunksConcat(body, length));
103457
103462
  }
103458
103463
  consumeFinish(consume2);
103459
103464
  } catch (err) {
@@ -103709,9 +103714,9 @@ var require_api_request = __commonJS({
103709
103714
  };
103710
103715
  function request(opts, callback) {
103711
103716
  if (callback === void 0) {
103712
- return new Promise((resolve13, reject) => {
103717
+ return new Promise((resolve12, reject) => {
103713
103718
  request.call(this, opts, (err, data) => {
103714
- return err ? reject(err) : resolve13(data);
103719
+ return err ? reject(err) : resolve12(data);
103715
103720
  });
103716
103721
  });
103717
103722
  }
@@ -103933,9 +103938,9 @@ var require_api_stream = __commonJS({
103933
103938
  };
103934
103939
  function stream(opts, factory2, callback) {
103935
103940
  if (callback === void 0) {
103936
- return new Promise((resolve13, reject) => {
103941
+ return new Promise((resolve12, reject) => {
103937
103942
  stream.call(this, opts, factory2, (err, data) => {
103938
- return err ? reject(err) : resolve13(data);
103943
+ return err ? reject(err) : resolve12(data);
103939
103944
  });
103940
103945
  });
103941
103946
  }
@@ -104218,9 +104223,9 @@ var require_api_upgrade = __commonJS({
104218
104223
  };
104219
104224
  function upgrade(opts, callback) {
104220
104225
  if (callback === void 0) {
104221
- return new Promise((resolve13, reject) => {
104226
+ return new Promise((resolve12, reject) => {
104222
104227
  upgrade.call(this, opts, (err, data) => {
104223
- return err ? reject(err) : resolve13(data);
104228
+ return err ? reject(err) : resolve12(data);
104224
104229
  });
104225
104230
  });
104226
104231
  }
@@ -104311,9 +104316,9 @@ var require_api_connect = __commonJS({
104311
104316
  };
104312
104317
  function connect(opts, callback) {
104313
104318
  if (callback === void 0) {
104314
- return new Promise((resolve13, reject) => {
104319
+ return new Promise((resolve12, reject) => {
104315
104320
  connect.call(this, opts, (err, data) => {
104316
- return err ? reject(err) : resolve13(data);
104321
+ return err ? reject(err) : resolve12(data);
104317
104322
  });
104318
104323
  });
104319
104324
  }
@@ -104474,20 +104479,20 @@ var require_mock_utils = __commonJS({
104474
104479
  }
104475
104480
  return true;
104476
104481
  }
104477
- function safeUrl(path60) {
104478
- if (typeof path60 !== "string") {
104479
- return path60;
104482
+ function safeUrl(path59) {
104483
+ if (typeof path59 !== "string") {
104484
+ return path59;
104480
104485
  }
104481
- const pathSegments = path60.split("?");
104486
+ const pathSegments = path59.split("?");
104482
104487
  if (pathSegments.length !== 2) {
104483
- return path60;
104488
+ return path59;
104484
104489
  }
104485
104490
  const qp = new URLSearchParams(pathSegments.pop());
104486
104491
  qp.sort();
104487
104492
  return [...pathSegments, qp.toString()].join("?");
104488
104493
  }
104489
- function matchKey(mockDispatch2, { path: path60, method, body, headers }) {
104490
- const pathMatch = matchValue(mockDispatch2.path, path60);
104494
+ function matchKey(mockDispatch2, { path: path59, method, body, headers }) {
104495
+ const pathMatch = matchValue(mockDispatch2.path, path59);
104491
104496
  const methodMatch = matchValue(mockDispatch2.method, method);
104492
104497
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
104493
104498
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -104509,7 +104514,7 @@ var require_mock_utils = __commonJS({
104509
104514
  function getMockDispatch(mockDispatches, key) {
104510
104515
  const basePath = key.query ? buildURL(key.path, key.query) : key.path;
104511
104516
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
104512
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path60 }) => matchValue(safeUrl(path60), resolvedPath));
104517
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path59 }) => matchValue(safeUrl(path59), resolvedPath));
104513
104518
  if (matchedMockDispatches.length === 0) {
104514
104519
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
104515
104520
  }
@@ -104547,9 +104552,9 @@ var require_mock_utils = __commonJS({
104547
104552
  }
104548
104553
  }
104549
104554
  function buildKey(opts) {
104550
- const { path: path60, method, body, headers, query } = opts;
104555
+ const { path: path59, method, body, headers, query } = opts;
104551
104556
  return {
104552
- path: path60,
104557
+ path: path59,
104553
104558
  method,
104554
104559
  body,
104555
104560
  headers,
@@ -105007,10 +105012,10 @@ var require_pending_interceptors_formatter = __commonJS({
105007
105012
  }
105008
105013
  format(pendingInterceptors) {
105009
105014
  const withPrettyHeaders = pendingInterceptors.map(
105010
- ({ method, path: path60, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
105015
+ ({ method, path: path59, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
105011
105016
  Method: method,
105012
105017
  Origin: origin,
105013
- Path: path60,
105018
+ Path: path59,
105014
105019
  "Status code": statusCode,
105015
105020
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
105016
105021
  Invocations: timesInvoked,
@@ -108135,7 +108140,7 @@ var require_fetch = __commonJS({
108135
108140
  function dispatch3({ body }) {
108136
108141
  const url2 = requestCurrentURL(request);
108137
108142
  const agent = fetchParams.controller.dispatcher;
108138
- return new Promise((resolve13, reject) => agent.dispatch(
108143
+ return new Promise((resolve12, reject) => agent.dispatch(
108139
108144
  {
108140
108145
  path: url2.pathname + url2.search,
108141
108146
  origin: url2.origin,
@@ -108211,7 +108216,7 @@ var require_fetch = __commonJS({
108211
108216
  }
108212
108217
  }
108213
108218
  const onError2 = this.onError.bind(this);
108214
- resolve13({
108219
+ resolve12({
108215
108220
  status,
108216
108221
  statusText,
108217
108222
  headersList,
@@ -108257,7 +108262,7 @@ var require_fetch = __commonJS({
108257
108262
  for (let i2 = 0; i2 < rawHeaders.length; i2 += 2) {
108258
108263
  headersList.append(bufferToLowerCasedHeaderName(rawHeaders[i2]), rawHeaders[i2 + 1].toString("latin1"), true);
108259
108264
  }
108260
- resolve13({
108265
+ resolve12({
108261
108266
  status,
108262
108267
  statusText: STATUS_CODES2[status],
108263
108268
  headersList,
@@ -109849,9 +109854,9 @@ var require_util7 = __commonJS({
109849
109854
  }
109850
109855
  }
109851
109856
  }
109852
- function validateCookiePath(path60) {
109853
- for (let i2 = 0; i2 < path60.length; ++i2) {
109854
- const code = path60.charCodeAt(i2);
109857
+ function validateCookiePath(path59) {
109858
+ for (let i2 = 0; i2 < path59.length; ++i2) {
109859
+ const code = path59.charCodeAt(i2);
109855
109860
  if (code < 32 || // exclude CTLs (0-31)
109856
109861
  code === 127 || // DEL
109857
109862
  code === 59) {
@@ -111908,8 +111913,8 @@ var require_util9 = __commonJS({
111908
111913
  return true;
111909
111914
  }
111910
111915
  function delay(ms) {
111911
- return new Promise((resolve13) => {
111912
- setTimeout(resolve13, ms).unref();
111916
+ return new Promise((resolve12) => {
111917
+ setTimeout(resolve12, ms).unref();
111913
111918
  });
111914
111919
  }
111915
111920
  module.exports = {
@@ -112511,11 +112516,11 @@ var require_undici = __commonJS({
112511
112516
  if (typeof opts.path !== "string") {
112512
112517
  throw new InvalidArgumentError("invalid opts.path");
112513
112518
  }
112514
- let path60 = opts.path;
112519
+ let path59 = opts.path;
112515
112520
  if (!opts.path.startsWith("/")) {
112516
- path60 = `/${path60}`;
112521
+ path59 = `/${path59}`;
112517
112522
  }
112518
- url2 = new URL(util.parseOrigin(url2).origin + path60);
112523
+ url2 = new URL(util.parseOrigin(url2).origin + path59);
112519
112524
  } else {
112520
112525
  if (!opts) {
112521
112526
  opts = typeof url2 === "object" ? url2 : {};
@@ -112857,7 +112862,7 @@ function classify(input, signals) {
112857
112862
  }
112858
112863
  var CMD_TIMEOUT_MS = 5 * 6e4;
112859
112864
  function runCmd(cmd, args, cwd2) {
112860
- return new Promise((resolve13) => {
112865
+ return new Promise((resolve12) => {
112861
112866
  const child = spawn(cmd, [...args], { cwd: cwd2, stdio: ["ignore", "pipe", "pipe"] });
112862
112867
  let output = "";
112863
112868
  const onData = (d2) => {
@@ -112868,11 +112873,11 @@ function runCmd(cmd, args, cwd2) {
112868
112873
  const timer = setTimeout(() => child.kill("SIGKILL"), CMD_TIMEOUT_MS);
112869
112874
  child.on("error", (err) => {
112870
112875
  clearTimeout(timer);
112871
- resolve13({ exitCode: -1, output: `${cmd} failed to start: ${err.message}` });
112876
+ resolve12({ exitCode: -1, output: `${cmd} failed to start: ${err.message}` });
112872
112877
  });
112873
112878
  child.on("close", (code) => {
112874
112879
  clearTimeout(timer);
112875
- resolve13({ exitCode: code ?? -1, output });
112880
+ resolve12({ exitCode: code ?? -1, output });
112876
112881
  });
112877
112882
  });
112878
112883
  }
@@ -112953,7 +112958,7 @@ function shortName(pkg) {
112953
112958
  return pkg.startsWith(SCOPE) ? pkg.slice(SCOPE.length) : pkg;
112954
112959
  }
112955
112960
  function run(cmd, args, cwd2, timeoutMs = BUILD_TIMEOUT_MS) {
112956
- return new Promise((resolve13) => {
112961
+ return new Promise((resolve12) => {
112957
112962
  const child = spawn(cmd, [...args], { cwd: cwd2, stdio: ["ignore", "pipe", "pipe"] });
112958
112963
  let output = "";
112959
112964
  const onData = (d2) => {
@@ -112964,11 +112969,11 @@ function run(cmd, args, cwd2, timeoutMs = BUILD_TIMEOUT_MS) {
112964
112969
  const timer = setTimeout(() => child.kill("SIGKILL"), timeoutMs);
112965
112970
  child.on("error", (err) => {
112966
112971
  clearTimeout(timer);
112967
- resolve13({ code: -1, output: `${cmd} failed to start: ${err.message}` });
112972
+ resolve12({ code: -1, output: `${cmd} failed to start: ${err.message}` });
112968
112973
  });
112969
112974
  child.on("close", (code) => {
112970
112975
  clearTimeout(timer);
112971
- resolve13({ code: code ?? -1, output });
112976
+ resolve12({ code: code ?? -1, output });
112972
112977
  });
112973
112978
  });
112974
112979
  }
@@ -114027,7 +114032,7 @@ async function findFile(dir, names) {
114027
114032
  var scopeSchema = z$1.enum(["user", "project"]);
114028
114033
  var scopeSchemaOptional = scopeSchema.optional().default("project");
114029
114034
  var USER_YAML = () => moxxyPath("config.yaml");
114030
- var MAX_CONFIG_SEARCH_DEPTH2 = 12;
114035
+ var PROJECT_YAML_NAMES = ["moxxy.config.yaml", "moxxy.config.yml"];
114031
114036
  async function findScopePath(scope, cwd2) {
114032
114037
  if (scope === "user") {
114033
114038
  const yaml = USER_YAML();
@@ -114038,22 +114043,7 @@ async function findScopePath(scope, cwd2) {
114038
114043
  return null;
114039
114044
  }
114040
114045
  }
114041
- let cursor = path3.resolve(cwd2);
114042
- for (let i2 = 0; i2 < MAX_CONFIG_SEARCH_DEPTH2; i2++) {
114043
- for (const name of ["moxxy.config.yaml", "moxxy.config.yml"]) {
114044
- const candidate = path3.join(cursor, name);
114045
- try {
114046
- await promises.access(candidate);
114047
- return candidate;
114048
- } catch {
114049
- }
114050
- }
114051
- const parent = path3.dirname(cursor);
114052
- if (parent === cursor)
114053
- break;
114054
- cursor = parent;
114055
- }
114056
- return null;
114046
+ return findUpward(cwd2, PROJECT_YAML_NAMES);
114057
114047
  }
114058
114048
  function scopeDefaultPath(scope, cwd2) {
114059
114049
  return scope === "user" ? USER_YAML() : path3.join(cwd2, "moxxy.config.yaml");
@@ -116382,13 +116372,13 @@ var MultipartBody = class {
116382
116372
  }
116383
116373
  };
116384
116374
  var fileFromPathWarned = false;
116385
- async function fileFromPath3(path60, ...args) {
116375
+ async function fileFromPath3(path59, ...args) {
116386
116376
  const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => (init_fileFromPath(), fileFromPath_exports));
116387
116377
  if (!fileFromPathWarned) {
116388
- console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path60)}) instead`);
116378
+ console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path59)}) instead`);
116389
116379
  fileFromPathWarned = true;
116390
116380
  }
116391
- return await _fileFromPath(path60, ...args);
116381
+ return await _fileFromPath(path59, ...args);
116392
116382
  }
116393
116383
  var defaultHttpAgent = new import_agentkeepalive.default({ keepAlive: true, timeout: 5 * 60 * 1e3 });
116394
116384
  var defaultHttpsAgent = new import_agentkeepalive.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 });
@@ -117009,8 +116999,8 @@ function _addRequestID(value, response) {
117009
116999
  }
117010
117000
  var APIPromise = class _APIPromise extends Promise {
117011
117001
  constructor(responsePromise, parseResponse2 = defaultParseResponse) {
117012
- super((resolve13) => {
117013
- resolve13(null);
117002
+ super((resolve12) => {
117003
+ resolve12(null);
117014
117004
  });
117015
117005
  this.responsePromise = responsePromise;
117016
117006
  this.parseResponse = parseResponse2;
@@ -117111,29 +117101,29 @@ var APIClient = class {
117111
117101
  defaultIdempotencyKey() {
117112
117102
  return `stainless-node-retry-${uuid4()}`;
117113
117103
  }
117114
- get(path60, opts) {
117115
- return this.methodRequest("get", path60, opts);
117104
+ get(path59, opts) {
117105
+ return this.methodRequest("get", path59, opts);
117116
117106
  }
117117
- post(path60, opts) {
117118
- return this.methodRequest("post", path60, opts);
117107
+ post(path59, opts) {
117108
+ return this.methodRequest("post", path59, opts);
117119
117109
  }
117120
- patch(path60, opts) {
117121
- return this.methodRequest("patch", path60, opts);
117110
+ patch(path59, opts) {
117111
+ return this.methodRequest("patch", path59, opts);
117122
117112
  }
117123
- put(path60, opts) {
117124
- return this.methodRequest("put", path60, opts);
117113
+ put(path59, opts) {
117114
+ return this.methodRequest("put", path59, opts);
117125
117115
  }
117126
- delete(path60, opts) {
117127
- return this.methodRequest("delete", path60, opts);
117116
+ delete(path59, opts) {
117117
+ return this.methodRequest("delete", path59, opts);
117128
117118
  }
117129
- methodRequest(method, path60, opts) {
117119
+ methodRequest(method, path59, opts) {
117130
117120
  return this.request(Promise.resolve(opts).then(async (opts2) => {
117131
117121
  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;
117132
- return { method, path: path60, ...opts2, body };
117122
+ return { method, path: path59, ...opts2, body };
117133
117123
  }));
117134
117124
  }
117135
- getAPIList(path60, Page3, opts) {
117136
- return this.requestAPIList(Page3, { method: "get", path: path60, ...opts });
117125
+ getAPIList(path59, Page3, opts) {
117126
+ return this.requestAPIList(Page3, { method: "get", path: path59, ...opts });
117137
117127
  }
117138
117128
  calculateContentLength(body) {
117139
117129
  if (typeof body === "string") {
@@ -117152,10 +117142,10 @@ var APIClient = class {
117152
117142
  }
117153
117143
  buildRequest(inputOptions, { retryCount = 0 } = {}) {
117154
117144
  const options = { ...inputOptions };
117155
- const { method, path: path60, query, headers = {} } = options;
117145
+ const { method, path: path59, query, headers = {} } = options;
117156
117146
  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;
117157
117147
  const contentLength = this.calculateContentLength(body);
117158
- const url2 = this.buildURL(path60, query);
117148
+ const url2 = this.buildURL(path59, query);
117159
117149
  if ("timeout" in options)
117160
117150
  validatePositiveInteger("timeout", options.timeout);
117161
117151
  options.timeout = options.timeout ?? this.timeout;
@@ -117279,8 +117269,8 @@ var APIClient = class {
117279
117269
  const request = this.makeRequest(options, null);
117280
117270
  return new PagePromise(this, request, Page3);
117281
117271
  }
117282
- buildURL(path60, query) {
117283
- const url2 = isAbsoluteURL(path60) ? new URL(path60) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path60.startsWith("/") ? path60.slice(1) : path60));
117272
+ buildURL(path59, query) {
117273
+ const url2 = isAbsoluteURL(path59) ? new URL(path59) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path59.startsWith("/") ? path59.slice(1) : path59));
117284
117274
  const defaultQuery = this.defaultQuery();
117285
117275
  if (!isEmptyObj(defaultQuery)) {
117286
117276
  query = { ...defaultQuery, ...query };
@@ -117602,7 +117592,7 @@ var startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
117602
117592
  var isAbsoluteURL = (url2) => {
117603
117593
  return startsWithSchemeRegexp.test(url2);
117604
117594
  };
117605
- var sleep = (ms) => new Promise((resolve13) => setTimeout(resolve13, ms));
117595
+ var sleep = (ms) => new Promise((resolve12) => setTimeout(resolve12, ms));
117606
117596
  var validatePositiveInteger = (name, n2) => {
117607
117597
  if (typeof n2 !== "number" || !Number.isInteger(n2)) {
117608
117598
  throw new AnthropicError(`${name} must be an integer`);
@@ -118212,12 +118202,12 @@ var BetaMessageStream = class _BetaMessageStream {
118212
118202
  }
118213
118203
  return this._emit("error", new AnthropicError(String(error2)));
118214
118204
  });
118215
- __classPrivateFieldSet7(this, _BetaMessageStream_connectedPromise, new Promise((resolve13, reject) => {
118216
- __classPrivateFieldSet7(this, _BetaMessageStream_resolveConnectedPromise, resolve13, "f");
118205
+ __classPrivateFieldSet7(this, _BetaMessageStream_connectedPromise, new Promise((resolve12, reject) => {
118206
+ __classPrivateFieldSet7(this, _BetaMessageStream_resolveConnectedPromise, resolve12, "f");
118217
118207
  __classPrivateFieldSet7(this, _BetaMessageStream_rejectConnectedPromise, reject, "f");
118218
118208
  }));
118219
- __classPrivateFieldSet7(this, _BetaMessageStream_endPromise, new Promise((resolve13, reject) => {
118220
- __classPrivateFieldSet7(this, _BetaMessageStream_resolveEndPromise, resolve13, "f");
118209
+ __classPrivateFieldSet7(this, _BetaMessageStream_endPromise, new Promise((resolve12, reject) => {
118210
+ __classPrivateFieldSet7(this, _BetaMessageStream_resolveEndPromise, resolve12, "f");
118221
118211
  __classPrivateFieldSet7(this, _BetaMessageStream_rejectEndPromise, reject, "f");
118222
118212
  }));
118223
118213
  __classPrivateFieldGet8(this, _BetaMessageStream_connectedPromise, "f").catch(() => {
@@ -118375,11 +118365,11 @@ var BetaMessageStream = class _BetaMessageStream {
118375
118365
  * const message = await stream.emitted('message') // rejects if the stream errors
118376
118366
  */
118377
118367
  emitted(event) {
118378
- return new Promise((resolve13, reject) => {
118368
+ return new Promise((resolve12, reject) => {
118379
118369
  __classPrivateFieldSet7(this, _BetaMessageStream_catchingPromiseCreated, true);
118380
118370
  if (event !== "error")
118381
118371
  this.once("error", reject);
118382
- this.once(event, resolve13);
118372
+ this.once(event, resolve12);
118383
118373
  });
118384
118374
  }
118385
118375
  async done() {
@@ -118660,7 +118650,7 @@ var BetaMessageStream = class _BetaMessageStream {
118660
118650
  if (done) {
118661
118651
  return { value: void 0, done: true };
118662
118652
  }
118663
- return new Promise((resolve13, reject) => readQueue.push({ resolve: resolve13, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
118653
+ return new Promise((resolve12, reject) => readQueue.push({ resolve: resolve12, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
118664
118654
  }
118665
118655
  const chunk = pushQueue.shift();
118666
118656
  return { value: chunk, done: false };
@@ -118932,12 +118922,12 @@ var MessageStream = class _MessageStream {
118932
118922
  }
118933
118923
  return this._emit("error", new AnthropicError(String(error2)));
118934
118924
  });
118935
- __classPrivateFieldSet8(this, _MessageStream_connectedPromise, new Promise((resolve13, reject) => {
118936
- __classPrivateFieldSet8(this, _MessageStream_resolveConnectedPromise, resolve13, "f");
118925
+ __classPrivateFieldSet8(this, _MessageStream_connectedPromise, new Promise((resolve12, reject) => {
118926
+ __classPrivateFieldSet8(this, _MessageStream_resolveConnectedPromise, resolve12, "f");
118937
118927
  __classPrivateFieldSet8(this, _MessageStream_rejectConnectedPromise, reject, "f");
118938
118928
  }));
118939
- __classPrivateFieldSet8(this, _MessageStream_endPromise, new Promise((resolve13, reject) => {
118940
- __classPrivateFieldSet8(this, _MessageStream_resolveEndPromise, resolve13, "f");
118929
+ __classPrivateFieldSet8(this, _MessageStream_endPromise, new Promise((resolve12, reject) => {
118930
+ __classPrivateFieldSet8(this, _MessageStream_resolveEndPromise, resolve12, "f");
118941
118931
  __classPrivateFieldSet8(this, _MessageStream_rejectEndPromise, reject, "f");
118942
118932
  }));
118943
118933
  __classPrivateFieldGet9(this, _MessageStream_connectedPromise, "f").catch(() => {
@@ -119095,11 +119085,11 @@ var MessageStream = class _MessageStream {
119095
119085
  * const message = await stream.emitted('message') // rejects if the stream errors
119096
119086
  */
119097
119087
  emitted(event) {
119098
- return new Promise((resolve13, reject) => {
119088
+ return new Promise((resolve12, reject) => {
119099
119089
  __classPrivateFieldSet8(this, _MessageStream_catchingPromiseCreated, true);
119100
119090
  if (event !== "error")
119101
119091
  this.once("error", reject);
119102
- this.once(event, resolve13);
119092
+ this.once(event, resolve12);
119103
119093
  });
119104
119094
  }
119105
119095
  async done() {
@@ -119380,7 +119370,7 @@ var MessageStream = class _MessageStream {
119380
119370
  if (done) {
119381
119371
  return { value: void 0, done: true };
119382
119372
  }
119383
- return new Promise((resolve13, reject) => readQueue.push({ resolve: resolve13, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
119373
+ return new Promise((resolve12, reject) => readQueue.push({ resolve: resolve12, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
119384
119374
  }
119385
119375
  const chunk = pushQueue.shift();
119386
119376
  return { value: chunk, done: false };
@@ -120482,13 +120472,13 @@ var MultipartBody2 = class {
120482
120472
  }
120483
120473
  };
120484
120474
  var fileFromPathWarned2 = false;
120485
- async function fileFromPath5(path60, ...args) {
120475
+ async function fileFromPath5(path59, ...args) {
120486
120476
  const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => (init_fileFromPath(), fileFromPath_exports));
120487
120477
  if (!fileFromPathWarned2) {
120488
- console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path60)}) instead`);
120478
+ console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path59)}) instead`);
120489
120479
  fileFromPathWarned2 = true;
120490
120480
  }
120491
- return await _fileFromPath(path60, ...args);
120481
+ return await _fileFromPath(path59, ...args);
120492
120482
  }
120493
120483
  var defaultHttpAgent2 = new import_agentkeepalive2.default({ keepAlive: true, timeout: 5 * 60 * 1e3 });
120494
120484
  var defaultHttpsAgent2 = new import_agentkeepalive2.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 });
@@ -121163,8 +121153,8 @@ function _addRequestID2(value, response) {
121163
121153
  }
121164
121154
  var APIPromise2 = class _APIPromise extends Promise {
121165
121155
  constructor(responsePromise, parseResponse2 = defaultParseResponse2) {
121166
- super((resolve13) => {
121167
- resolve13(null);
121156
+ super((resolve12) => {
121157
+ resolve12(null);
121168
121158
  });
121169
121159
  this.responsePromise = responsePromise;
121170
121160
  this.parseResponse = parseResponse2;
@@ -121266,29 +121256,29 @@ var APIClient2 = class {
121266
121256
  defaultIdempotencyKey() {
121267
121257
  return `stainless-node-retry-${uuid42()}`;
121268
121258
  }
121269
- get(path60, opts) {
121270
- return this.methodRequest("get", path60, opts);
121259
+ get(path59, opts) {
121260
+ return this.methodRequest("get", path59, opts);
121271
121261
  }
121272
- post(path60, opts) {
121273
- return this.methodRequest("post", path60, opts);
121262
+ post(path59, opts) {
121263
+ return this.methodRequest("post", path59, opts);
121274
121264
  }
121275
- patch(path60, opts) {
121276
- return this.methodRequest("patch", path60, opts);
121265
+ patch(path59, opts) {
121266
+ return this.methodRequest("patch", path59, opts);
121277
121267
  }
121278
- put(path60, opts) {
121279
- return this.methodRequest("put", path60, opts);
121268
+ put(path59, opts) {
121269
+ return this.methodRequest("put", path59, opts);
121280
121270
  }
121281
- delete(path60, opts) {
121282
- return this.methodRequest("delete", path60, opts);
121271
+ delete(path59, opts) {
121272
+ return this.methodRequest("delete", path59, opts);
121283
121273
  }
121284
- methodRequest(method, path60, opts) {
121274
+ methodRequest(method, path59, opts) {
121285
121275
  return this.request(Promise.resolve(opts).then(async (opts2) => {
121286
121276
  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;
121287
- return { method, path: path60, ...opts2, body };
121277
+ return { method, path: path59, ...opts2, body };
121288
121278
  }));
121289
121279
  }
121290
- getAPIList(path60, Page3, opts) {
121291
- return this.requestAPIList(Page3, { method: "get", path: path60, ...opts });
121280
+ getAPIList(path59, Page3, opts) {
121281
+ return this.requestAPIList(Page3, { method: "get", path: path59, ...opts });
121292
121282
  }
121293
121283
  calculateContentLength(body) {
121294
121284
  if (typeof body === "string") {
@@ -121307,10 +121297,10 @@ var APIClient2 = class {
121307
121297
  }
121308
121298
  buildRequest(inputOptions, { retryCount = 0 } = {}) {
121309
121299
  const options = { ...inputOptions };
121310
- const { method, path: path60, query, headers = {} } = options;
121300
+ const { method, path: path59, query, headers = {} } = options;
121311
121301
  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;
121312
121302
  const contentLength = this.calculateContentLength(body);
121313
- const url2 = this.buildURL(path60, query);
121303
+ const url2 = this.buildURL(path59, query);
121314
121304
  if ("timeout" in options)
121315
121305
  validatePositiveInteger2("timeout", options.timeout);
121316
121306
  options.timeout = options.timeout ?? this.timeout;
@@ -121426,8 +121416,8 @@ var APIClient2 = class {
121426
121416
  const request = this.makeRequest(options, null);
121427
121417
  return new PagePromise2(this, request, Page3);
121428
121418
  }
121429
- buildURL(path60, query) {
121430
- const url2 = isAbsoluteURL2(path60) ? new URL(path60) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path60.startsWith("/") ? path60.slice(1) : path60));
121419
+ buildURL(path59, query) {
121420
+ const url2 = isAbsoluteURL2(path59) ? new URL(path59) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path59.startsWith("/") ? path59.slice(1) : path59));
121431
121421
  const defaultQuery = this.defaultQuery();
121432
121422
  if (!isEmptyObj2(defaultQuery)) {
121433
121423
  query = { ...defaultQuery, ...query };
@@ -121739,7 +121729,7 @@ var startsWithSchemeRegexp2 = /^[a-z][a-z0-9+.-]*:/i;
121739
121729
  var isAbsoluteURL2 = (url2) => {
121740
121730
  return startsWithSchemeRegexp2.test(url2);
121741
121731
  };
121742
- var sleep2 = (ms) => new Promise((resolve13) => setTimeout(resolve13, ms));
121732
+ var sleep2 = (ms) => new Promise((resolve12) => setTimeout(resolve12, ms));
121743
121733
  var validatePositiveInteger2 = (name, n2) => {
121744
121734
  if (typeof n2 !== "number" || !Number.isInteger(n2)) {
121745
121735
  throw new OpenAIError(`${name} must be an integer`);
@@ -122170,12 +122160,12 @@ var EventStream = class {
122170
122160
  _EventStream_errored.set(this, false);
122171
122161
  _EventStream_aborted.set(this, false);
122172
122162
  _EventStream_catchingPromiseCreated.set(this, false);
122173
- __classPrivateFieldSet11(this, _EventStream_connectedPromise, new Promise((resolve13, reject) => {
122174
- __classPrivateFieldSet11(this, _EventStream_resolveConnectedPromise, resolve13, "f");
122163
+ __classPrivateFieldSet11(this, _EventStream_connectedPromise, new Promise((resolve12, reject) => {
122164
+ __classPrivateFieldSet11(this, _EventStream_resolveConnectedPromise, resolve12, "f");
122175
122165
  __classPrivateFieldSet11(this, _EventStream_rejectConnectedPromise, reject, "f");
122176
122166
  }));
122177
- __classPrivateFieldSet11(this, _EventStream_endPromise, new Promise((resolve13, reject) => {
122178
- __classPrivateFieldSet11(this, _EventStream_resolveEndPromise, resolve13, "f");
122167
+ __classPrivateFieldSet11(this, _EventStream_endPromise, new Promise((resolve12, reject) => {
122168
+ __classPrivateFieldSet11(this, _EventStream_resolveEndPromise, resolve12, "f");
122179
122169
  __classPrivateFieldSet11(this, _EventStream_rejectEndPromise, reject, "f");
122180
122170
  }));
122181
122171
  __classPrivateFieldGet12(this, _EventStream_connectedPromise, "f").catch(() => {
@@ -122259,11 +122249,11 @@ var EventStream = class {
122259
122249
  * const message = await stream.emitted('message') // rejects if the stream errors
122260
122250
  */
122261
122251
  emitted(event) {
122262
- return new Promise((resolve13, reject) => {
122252
+ return new Promise((resolve12, reject) => {
122263
122253
  __classPrivateFieldSet11(this, _EventStream_catchingPromiseCreated, true);
122264
122254
  if (event !== "error")
122265
122255
  this.once("error", reject);
122266
- this.once(event, resolve13);
122256
+ this.once(event, resolve12);
122267
122257
  });
122268
122258
  }
122269
122259
  async done() {
@@ -122414,7 +122404,7 @@ var AssistantStream = class _AssistantStream extends EventStream {
122414
122404
  if (done) {
122415
122405
  return { value: void 0, done: true };
122416
122406
  }
122417
- return new Promise((resolve13, reject) => readQueue.push({ resolve: resolve13, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
122407
+ return new Promise((resolve12, reject) => readQueue.push({ resolve: resolve12, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
122418
122408
  }
122419
122409
  const chunk = pushQueue.shift();
122420
122410
  return { value: chunk, done: false };
@@ -124019,7 +124009,7 @@ var ChatCompletionStream = class _ChatCompletionStream extends AbstractChatCompl
124019
124009
  if (done) {
124020
124010
  return { value: void 0, done: true };
124021
124011
  }
124022
- return new Promise((resolve13, reject) => readQueue.push({ resolve: resolve13, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
124012
+ return new Promise((resolve12, reject) => readQueue.push({ resolve: resolve12, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
124023
124013
  }
124024
124014
  const chunk = pushQueue.shift();
124025
124015
  return { value: chunk, done: false };
@@ -125665,7 +125655,7 @@ var ResponseStream = class _ResponseStream extends EventStream {
125665
125655
  if (done) {
125666
125656
  return { value: void 0, done: true };
125667
125657
  }
125668
- return new Promise((resolve13, reject) => readQueue.push({ resolve: resolve13, reject })).then((event2) => event2 ? { value: event2, done: false } : { value: void 0, done: true });
125658
+ return new Promise((resolve12, reject) => readQueue.push({ resolve: resolve12, reject })).then((event2) => event2 ? { value: event2, done: false } : { value: void 0, done: true });
125669
125659
  }
125670
125660
  const event = pushQueue.shift();
125671
125661
  return { value: event, done: false };
@@ -126431,22 +126421,23 @@ var OpenAIProvider = class {
126431
126421
  const tokenLimitKey = usesCompletionTokens ? "max_completion_tokens" : "max_tokens";
126432
126422
  const emitReasoning = req.reasoning != null && req.reasoning !== false;
126433
126423
  const reasoningEffort = typeof req.reasoning === "object" ? req.reasoning.effort : void 0;
126424
+ const params = {
126425
+ model,
126426
+ messages,
126427
+ ...tools ? { tools } : {},
126428
+ ...req.temperature !== void 0 ? { temperature: req.temperature } : {},
126429
+ ...req.maxTokens ? { [tokenLimitKey]: req.maxTokens } : {},
126430
+ ...emitReasoning && usesCompletionTokens && reasoningEffort ? { reasoning_effort: reasoningEffort } : {},
126431
+ stream: true,
126432
+ // OpenAI only emits the final `usage` chunk when this is set;
126433
+ // without it `raw.usage` is null on every chunk and token usage
126434
+ // (and cache-read counts) are silently lost for every streamed turn.
126435
+ stream_options: { include_usage: true }
126436
+ };
126434
126437
  let stream;
126435
126438
  try {
126436
126439
  stream = await this.client.chat.completions.create(
126437
- {
126438
- model,
126439
- messages,
126440
- ...tools ? { tools } : {},
126441
- ...req.temperature !== void 0 ? { temperature: req.temperature } : {},
126442
- ...req.maxTokens ? { [tokenLimitKey]: req.maxTokens } : {},
126443
- ...emitReasoning && usesCompletionTokens && reasoningEffort ? { reasoning_effort: reasoningEffort } : {},
126444
- stream: true,
126445
- // OpenAI only emits the final `usage` chunk when this is set;
126446
- // without it `raw.usage` is null on every chunk and token usage
126447
- // (and cache-read counts) are silently lost for every streamed turn.
126448
- stream_options: { include_usage: true }
126449
- },
126440
+ params,
126450
126441
  // Pass the AbortSignal into the SDK request options so cancelling
126451
126442
  // mid-stream tears down the underlying HTTP request instead of just
126452
126443
  // stopping our consumption loop. Without this, Esc / Ctrl+C felt
@@ -126625,7 +126616,7 @@ var openaiPlugin = definePlugin({
126625
126616
  init_pkce();
126626
126617
  async function openInBrowser(url2) {
126627
126618
  const { cmd, args, verbatim } = browserOpenCommand(url2);
126628
- await new Promise((resolve13, reject) => {
126619
+ await new Promise((resolve12, reject) => {
126629
126620
  const child = spawn(cmd, args, {
126630
126621
  stdio: "ignore",
126631
126622
  detached: true,
@@ -126635,7 +126626,7 @@ async function openInBrowser(url2) {
126635
126626
  });
126636
126627
  child.once("error", reject);
126637
126628
  child.unref();
126638
- setTimeout(resolve13, 50);
126629
+ setTimeout(resolve12, 50);
126639
126630
  });
126640
126631
  }
126641
126632
  function browserOpenCommand(url2, platform2 = process.platform) {
@@ -126651,7 +126642,7 @@ function browserOpenCommand(url2, platform2 = process.platform) {
126651
126642
  return { cmd: "xdg-open", args: [url2] };
126652
126643
  }
126653
126644
  function waitForCallback(opts) {
126654
- return new Promise((resolve13, reject) => {
126645
+ return new Promise((resolve12, reject) => {
126655
126646
  const servers = [];
126656
126647
  let settled = false;
126657
126648
  const settle = (fn) => {
@@ -126728,7 +126719,7 @@ function waitForCallback(opts) {
126728
126719
  }
126729
126720
  res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
126730
126721
  res.end(htmlPage("Authorized", "You can close this window \u2014 moxxy received the token."));
126731
- settle(() => resolve13(code));
126722
+ settle(() => resolve12(code));
126732
126723
  };
126733
126724
  const onFatalError = (e3) => {
126734
126725
  if (e3.code === "EADDRINUSE") {
@@ -126852,11 +126843,11 @@ function buildAuthUrl(input) {
126852
126843
  }
126853
126844
  async function runAuthorizationCodeFlow(opts) {
126854
126845
  const port = opts.redirectPort ?? 8765;
126855
- const path60 = opts.redirectPath ?? "/callback";
126846
+ const path59 = opts.redirectPath ?? "/callback";
126856
126847
  const codeVerifier = generateCodeVerifier();
126857
126848
  const codeChallenge = computeCodeChallenge(codeVerifier);
126858
126849
  const state = generateState();
126859
- const redirectUri = `http://localhost:${port}${path60}`;
126850
+ const redirectUri = `http://localhost:${port}${path59}`;
126860
126851
  const authUrl = buildAuthUrl({
126861
126852
  authUrl: opts.authUrl,
126862
126853
  clientId: opts.clientId,
@@ -126868,7 +126859,7 @@ async function runAuthorizationCodeFlow(opts) {
126868
126859
  });
126869
126860
  const codePromise = waitForCallback({
126870
126861
  port,
126871
- path: path60,
126862
+ path: path59,
126872
126863
  expectedState: state,
126873
126864
  timeoutMs: opts.timeoutMs ?? 3e5,
126874
126865
  ...opts.signal ? { signal: opts.signal } : {}
@@ -126925,10 +126916,10 @@ function abortedError(label3) {
126925
126916
  });
126926
126917
  }
126927
126918
  function sleep3(ms, signal, label3) {
126928
- return new Promise((resolve13, reject) => {
126919
+ return new Promise((resolve12, reject) => {
126929
126920
  if (signal?.aborted)
126930
126921
  return reject(abortedError(label3));
126931
- const t2 = setTimeout(resolve13, ms);
126922
+ const t2 = setTimeout(resolve12, ms);
126932
126923
  const onAbort = () => {
126933
126924
  clearTimeout(t2);
126934
126925
  reject(abortedError(label3));
@@ -127010,7 +127001,6 @@ function classifyDeviceTokenResponse(res, json, state) {
127010
127001
  }
127011
127002
 
127012
127003
  // ../plugin-oauth/dist/oauth/device-flow.js
127013
- var DEVICE_POLL_SAFETY_MARGIN_MS = 0;
127014
127004
  async function runDeviceCodeFlow(opts) {
127015
127005
  const auth2 = await requestDeviceAuthorization({
127016
127006
  deviceUrl: opts.deviceUrl,
@@ -127026,7 +127016,7 @@ async function runDeviceCodeFlow(opts) {
127026
127016
  interval: auth2.intervalSec
127027
127017
  });
127028
127018
  return pollUntil((state) => pollOnce(opts, auth2.deviceCode, state), {
127029
- intervalMs: auth2.intervalSec * 1e3 + DEVICE_POLL_SAFETY_MARGIN_MS,
127019
+ intervalMs: auth2.intervalSec * 1e3,
127030
127020
  timeoutMs: Math.min(opts.timeoutMs ?? auth2.expiresInSec * 1e3, auth2.expiresInSec * 1e3),
127031
127021
  label: "OAuth device flow",
127032
127022
  leadingWait: true,
@@ -127233,7 +127223,7 @@ async function acquireFileLock(lockPath, staleMs, pollMs, waitMs) {
127233
127223
  }
127234
127224
  }
127235
127225
  function sleep4(ms) {
127236
- return new Promise((resolve13) => setTimeout(resolve13, ms));
127226
+ return new Promise((resolve12) => setTimeout(resolve12, ms));
127237
127227
  }
127238
127228
  async function refreshAndStore(vault, spec, stored, retried = false) {
127239
127229
  if (!stored.tokenSet.refreshToken) {
@@ -127388,11 +127378,11 @@ function buildOauthAuthorizeTool(deps) {
127388
127378
  const { computeCodeChallenge: computeCodeChallenge2 } = await Promise.resolve().then(() => (init_pkce(), pkce_exports));
127389
127379
  const challenge = computeCodeChallenge2(verifier);
127390
127380
  const port = input.redirectPort ?? 8765;
127391
- const path60 = input.redirectPath ?? "/callback";
127381
+ const path59 = input.redirectPath ?? "/callback";
127392
127382
  const url2 = buildAuthUrl({
127393
127383
  authUrl: input.authUrl,
127394
127384
  clientId: input.clientId,
127395
- redirectUri: `http://localhost:${port}${path60}`,
127385
+ redirectUri: `http://localhost:${port}${path59}`,
127396
127386
  scopes: input.scopes,
127397
127387
  codeChallenge: challenge,
127398
127388
  state,
@@ -127514,7 +127504,7 @@ function summarizeTokens(provider, tokens, opts = {}) {
127514
127504
  init_pkce();
127515
127505
  var DEFAULT_BROWSER_TIMEOUT_MS = 5 * 60 * 1e3;
127516
127506
  var DEFAULT_DEVICE_TIMEOUT_MS = 10 * 60 * 1e3;
127517
- var DEVICE_POLL_SAFETY_MARGIN_MS2 = 3e3;
127507
+ var DEVICE_POLL_SAFETY_MARGIN_MS = 3e3;
127518
127508
  async function runOauthLogin(profile, ctx) {
127519
127509
  const tokens = ctx.headless ? await runDeviceFlow(profile, ctx) : await runBrowserFlow(profile, ctx);
127520
127510
  const accountId = profile.extractAccountId?.(tokens);
@@ -127536,7 +127526,7 @@ async function runOauthLogin(profile, ctx) {
127536
127526
  }
127537
127527
  async function runBrowserFlow(profile, ctx) {
127538
127528
  const port = profile.redirect?.port ?? 8765;
127539
- const path60 = profile.redirect?.path ?? "/callback";
127529
+ const path59 = profile.redirect?.path ?? "/callback";
127540
127530
  const serviceName = profile.displayName ?? profile.id;
127541
127531
  return runAuthorizationCodeFlow({
127542
127532
  authUrl: profile.authUrl,
@@ -127545,7 +127535,7 @@ async function runBrowserFlow(profile, ctx) {
127545
127535
  ...profile.clientSecret ? { clientSecret: profile.clientSecret } : {},
127546
127536
  scopes: profile.scopes,
127547
127537
  redirectPort: port,
127548
- redirectPath: path60,
127538
+ redirectPath: path59,
127549
127539
  ...profile.extraAuthParams ? { extraAuthParams: profile.extraAuthParams } : {},
127550
127540
  timeoutMs: DEFAULT_BROWSER_TIMEOUT_MS,
127551
127541
  ...ctx.signal ? { signal: ctx.signal } : {},
@@ -127557,7 +127547,7 @@ If your browser doesn't open automatically, paste this URL:
127557
127547
 
127558
127548
  ${url2}
127559
127549
 
127560
- Waiting for callback on http://localhost:${port}${path60} (5 min timeout)\u2026
127550
+ Waiting for callback on http://localhost:${port}${path59} (5 min timeout)\u2026
127561
127551
 
127562
127552
  `);
127563
127553
  }
@@ -127594,7 +127584,7 @@ Polling every ${Math.round(init3.intervalMs / 1e3)}s (${Math.round(init3.expires
127594
127584
  `);
127595
127585
  const timeoutMs = Math.min(init3.expiresInMs, DEFAULT_DEVICE_TIMEOUT_MS);
127596
127586
  return pollUntil((state) => adapter.poll(init3, state), {
127597
- intervalMs: init3.intervalMs + DEVICE_POLL_SAFETY_MARGIN_MS2,
127587
+ intervalMs: init3.intervalMs + DEVICE_POLL_SAFETY_MARGIN_MS,
127598
127588
  timeoutMs,
127599
127589
  label: `${profile.id} device flow`,
127600
127590
  leadingWait: true,
@@ -128534,7 +128524,7 @@ async function refreshClaudeUnderLock(vault, baseline) {
128534
128524
  }
128535
128525
  var fetchImpl = fetch;
128536
128526
  var openBrowserImpl = openInBrowser;
128537
- var sleepImpl = (ms) => new Promise((resolve13) => setTimeout(resolve13, ms));
128527
+ var sleepImpl = (ms) => new Promise((resolve12) => setTimeout(resolve12, ms));
128538
128528
  var TOKEN_POST_MAX_ATTEMPTS = 3;
128539
128529
  var TOKEN_POST_BACKOFF_MS = [600, 1800];
128540
128530
  async function exchangeClaudeCode(code, state, verifier) {
@@ -128878,14 +128868,15 @@ var WhisperTranscriber = class {
128878
128868
  ...language ? { language } : {},
128879
128869
  ...opts.prompt ? { prompt: opts.prompt } : {}
128880
128870
  }, { signal: opts.signal }));
128881
- const r2 = response2;
128871
+ const r2 = requireTextResponse(response2);
128882
128872
  const result = { text: r2.text };
128883
- if (r2.language)
128873
+ if (typeof r2.language === "string")
128884
128874
  result.language = r2.language;
128885
128875
  if (typeof r2.duration === "number")
128886
128876
  result.durationSec = r2.duration;
128887
- if (r2.segments)
128877
+ if (Array.isArray(r2.segments)) {
128888
128878
  result.segments = r2.segments.map((s2) => ({ start: s2.start, end: s2.end, text: s2.text }));
128879
+ }
128889
128880
  return result;
128890
128881
  }
128891
128882
  const response = await this.run(() => this.client.audio.transcriptions.create({
@@ -128894,7 +128885,7 @@ var WhisperTranscriber = class {
128894
128885
  ...language ? { language } : {},
128895
128886
  ...opts.prompt ? { prompt: opts.prompt } : {}
128896
128887
  }, { signal: opts.signal }));
128897
- return { text: response.text };
128888
+ return { text: requireTextResponse(response).text };
128898
128889
  }
128899
128890
  /**
128900
128891
  * Run an SDK transcription call, translating failures into structured
@@ -128931,6 +128922,16 @@ var WhisperTranscriber = class {
128931
128922
  }
128932
128923
  }
128933
128924
  };
128925
+ function requireTextResponse(response) {
128926
+ if (!response || typeof response !== "object" || typeof response.text !== "string") {
128927
+ throw new MoxxyError({
128928
+ code: "PROVIDER_UNKNOWN_RESPONSE",
128929
+ message: "OpenAI transcription response was missing a text field.",
128930
+ context: { provider: WHISPER_PROVIDER_ID }
128931
+ });
128932
+ }
128933
+ return response;
128934
+ }
128934
128935
 
128935
128936
  // ../plugin-stt-whisper/dist/index.js
128936
128937
  function buildWhisperPlugin(opts = {}) {
@@ -129025,7 +129026,18 @@ var CodexOAuthTranscriber = class {
129025
129026
  context: { provider: CODEX_PROVIDER_ID, url: this.endpoint }
129026
129027
  });
129027
129028
  }
129028
- return { text: payload.text.trim() };
129029
+ const obj = payload;
129030
+ const result = { text: obj.text.trim() };
129031
+ if (typeof obj.language === "string")
129032
+ result.language = obj.language;
129033
+ if (typeof obj.duration === "number")
129034
+ result.durationSec = obj.duration;
129035
+ if (Array.isArray(obj.segments)) {
129036
+ const segments = obj.segments.filter((s2) => !!s2 && typeof s2 === "object" && typeof s2.start === "number" && typeof s2.end === "number" && typeof s2.text === "string").map((s2) => ({ start: s2.start, end: s2.end, text: s2.text }));
129037
+ if (segments.length > 0)
129038
+ result.segments = segments;
129039
+ }
129040
+ return result;
129029
129041
  }
129030
129042
  async loadTokens() {
129031
129043
  try {
@@ -129094,12 +129106,16 @@ function buildWhisperCodexPlugin(opts) {
129094
129106
  name: OPENAI_CODEX_TRANSCRIBER_NAME,
129095
129107
  displayName: "OpenAI Codex transcription (OAuth)",
129096
129108
  createClient: (config) => {
129109
+ const cfg = config ?? {};
129110
+ const configBaseUrl = typeof cfg.baseUrl === "string" ? cfg.baseUrl : void 0;
129111
+ const configSessionIdProvider = typeof cfg.sessionIdProvider === "function" ? cfg.sessionIdProvider : void 0;
129112
+ const baseUrl = configBaseUrl ?? opts.baseUrl;
129113
+ const sessionIdProvider = configSessionIdProvider ?? opts.sessionIdProvider;
129097
129114
  const merged = {
129098
129115
  vault: opts.vault,
129099
- ...opts.baseUrl ? { baseUrl: opts.baseUrl } : {},
129116
+ ...baseUrl ? { baseUrl } : {},
129100
129117
  ...opts.fetch ? { fetch: opts.fetch } : {},
129101
- ...opts.sessionIdProvider ? { sessionIdProvider: opts.sessionIdProvider } : {},
129102
- ...config
129118
+ ...sessionIdProvider ? { sessionIdProvider } : {}
129103
129119
  };
129104
129120
  return new CodexOAuthTranscriber(merged);
129105
129121
  }
@@ -129200,7 +129216,7 @@ var bashTool = defineTool({
129200
129216
  if (ctx.signal.aborted) {
129201
129217
  throw new MoxxyError({ code: "ABORTED", message: `Bash aborted before start: ${command}` });
129202
129218
  }
129203
- return await new Promise((resolve13, reject) => {
129219
+ return await new Promise((resolve12, reject) => {
129204
129220
  const child = spawn("/bin/sh", ["-lc", command], {
129205
129221
  cwd: cwd2 ?? ctx.cwd,
129206
129222
  env: env3 ? { ...process.env, ...env3 } : process.env,
@@ -129253,9 +129269,9 @@ ${err.text.trimEnd()}
129253
129269
  ` : "") + `[exit ${code ?? "null"}]`;
129254
129270
  const dropped = out.dropped + err.dropped;
129255
129271
  if (dropped === 0) {
129256
- resolve13(clampString(combined, OUTPUT_LIMIT));
129272
+ resolve12(clampString(combined, OUTPUT_LIMIT));
129257
129273
  } else {
129258
- resolve13(combined.slice(0, OUTPUT_LIMIT) + `
129274
+ resolve12(combined.slice(0, OUTPUT_LIMIT) + `
129259
129275
  ... [truncated ${combined.length + dropped - OUTPUT_LIMIT} chars]`);
129260
129276
  }
129261
129277
  });
@@ -129854,10 +129870,10 @@ var sleepTool = defineTool({
129854
129870
  if (ctx.signal.aborted) {
129855
129871
  throw new MoxxyError({ code: "ABORTED", message: "Sleep aborted before start" });
129856
129872
  }
129857
- await new Promise((resolve13, reject) => {
129873
+ await new Promise((resolve12, reject) => {
129858
129874
  const timer = setTimeout(() => {
129859
129875
  ctx.signal.removeEventListener("abort", onAbort);
129860
- resolve13();
129876
+ resolve12();
129861
129877
  }, totalMs);
129862
129878
  const onAbort = () => {
129863
129879
  clearTimeout(timer);
@@ -129930,16 +129946,16 @@ function retryBackoffMs(attempt) {
129930
129946
  const cap = 3e4;
129931
129947
  return Math.min(cap, base2 * 2 ** Math.max(0, attempt - 1));
129932
129948
  }
129933
- var sleepImpl2 = (ms, signal) => new Promise((resolve13) => {
129949
+ var sleepImpl2 = (ms, signal) => new Promise((resolve12) => {
129934
129950
  if (signal.aborted)
129935
- return resolve13();
129951
+ return resolve12();
129936
129952
  const timer = setTimeout(() => {
129937
129953
  signal.removeEventListener("abort", onAbort);
129938
- resolve13();
129954
+ resolve12();
129939
129955
  }, ms);
129940
129956
  const onAbort = () => {
129941
129957
  clearTimeout(timer);
129942
- resolve13();
129958
+ resolve12();
129943
129959
  };
129944
129960
  signal.addEventListener("abort", onAbort, { once: true });
129945
129961
  });
@@ -130778,20 +130794,17 @@ function parseFollowups(text) {
130778
130794
  function parseNumberedBlock(text, headerRegex) {
130779
130795
  const lines = text.split("\n");
130780
130796
  const items = [];
130781
- let inBlock = false;
130782
130797
  for (const raw of lines) {
130783
130798
  const line = raw.trim();
130784
130799
  if (!line)
130785
130800
  continue;
130786
130801
  if (headerRegex.test(line)) {
130787
- inBlock = true;
130788
130802
  continue;
130789
130803
  }
130790
130804
  const m3 = /^(?:\d+[.)]|[-*•])\s*(.+)$/.exec(line);
130791
130805
  if (m3) {
130792
130806
  items.push(m3[1].trim());
130793
- inBlock = true;
130794
- } else if (inBlock && items.length > 0 && !/^[A-Z]/.test(line)) ;
130807
+ }
130795
130808
  }
130796
130809
  return items;
130797
130810
  }
@@ -131388,11 +131401,11 @@ var TelegramPermissionResolver = class {
131388
131401
  if (!this.deciderFn) {
131389
131402
  return { mode: "deny", reason: "no decider attached (bot not running)" };
131390
131403
  }
131391
- const decision = await new Promise((resolve13) => {
131392
- this.pending.set(call.callId, { callId: call.callId, call, ctx, resolve: resolve13 });
131404
+ const decision = await new Promise((resolve12) => {
131405
+ this.pending.set(call.callId, { callId: call.callId, call, ctx, resolve: resolve12 });
131393
131406
  this.deciderFn(call, ctx).catch((err) => {
131394
131407
  this.pending.delete(call.callId);
131395
- resolve13({ mode: "deny", reason: err instanceof Error ? err.message : String(err) });
131408
+ resolve12({ mode: "deny", reason: err instanceof Error ? err.message : String(err) });
131396
131409
  });
131397
131410
  });
131398
131411
  if (decision.mode === "allow_session")
@@ -131430,11 +131443,11 @@ var TelegramApprovalResolver = class {
131430
131443
  return { optionId: request.defaultOptionId ?? request.options[0]?.id ?? "approve" };
131431
131444
  }
131432
131445
  const id = `appr_${this.nextId++}`;
131433
- return new Promise((resolve13) => {
131434
- this.pending.set(id, { id, request, resolve: resolve13 });
131446
+ return new Promise((resolve12) => {
131447
+ this.pending.set(id, { id, request, resolve: resolve12 });
131435
131448
  this.deciderFn(id, request).catch((err) => {
131436
131449
  this.pending.delete(id);
131437
- resolve13({
131450
+ resolve12({
131438
131451
  optionId: request.defaultOptionId ?? request.options[0]?.id ?? "cancel",
131439
131452
  text: `decider failed: ${err instanceof Error ? err.message : String(err)}`
131440
131453
  });
@@ -132900,17 +132913,9 @@ var TelegramChannel = class {
132900
132913
  handleVoice(ctx, token) {
132901
132914
  return handleVoiceMessage(ctx, {
132902
132915
  session: this.session,
132903
- model: this.model,
132904
- activeModelOverride: this.activeModelOverride,
132905
- yolo: this.yolo,
132906
- busy: this.busy,
132907
- turnController: this.turnController,
132908
- handle: this.handle
132916
+ busy: this.busy
132909
132917
  }, {
132910
132918
  pairing: this.pairing,
132911
- approvalResolver: this.approvalResolver,
132912
- permissionResolver: this.permissionResolver,
132913
- framePump: this.framePump,
132914
132919
  token,
132915
132920
  ...this.opts.logger ? { logger: this.opts.logger } : {}
132916
132921
  }, {
@@ -133983,8 +133988,8 @@ async function runPairFlow(ctx) {
133983
133988
  });
133984
133989
  session.setPermissionResolver(channel.permissionResolver);
133985
133990
  let issuedResolve = null;
133986
- const issued = new Promise((resolve13) => {
133987
- issuedResolve = resolve13;
133991
+ const issued = new Promise((resolve12) => {
133992
+ issuedResolve = resolve12;
133988
133993
  });
133989
133994
  const unsubscribe = channel.onPairingIssued((e3) => {
133990
133995
  issuedResolve?.(e3);
@@ -134360,6 +134365,22 @@ function reply(res, status, body) {
134360
134365
  res.writeHead(status, { "content-type": "application/json" });
134361
134366
  res.end(JSON.stringify(body));
134362
134367
  }
134368
+ async function driveTurn(session, prompt, runOptions, res) {
134369
+ const controller = new AbortController();
134370
+ const onClose = () => controller.abort();
134371
+ res.on("close", onClose);
134372
+ const events = [];
134373
+ try {
134374
+ for await (const event of session.runTurn(prompt, { ...runOptions, signal: controller.signal })) {
134375
+ events.push(event);
134376
+ }
134377
+ } finally {
134378
+ res.off("close", onClose);
134379
+ }
134380
+ const finalAssistant = events.findLast?.((e3) => e3.type === "assistant_message");
134381
+ const assistant = finalAssistant && finalAssistant.type === "assistant_message" ? finalAssistant.content : "";
134382
+ return { events, assistant };
134383
+ }
134363
134384
  async function handleTurn(req, res, ctx) {
134364
134385
  if (!checkAuth(req, ctx.authToken)) {
134365
134386
  reply(res, 401, { error: "unauthorized" });
@@ -134373,27 +134394,17 @@ async function handleTurn(req, res, ctx) {
134373
134394
  reply(res, 400, { error: "bad_request", message: err instanceof Error ? err.message : String(err) });
134374
134395
  return;
134375
134396
  }
134376
- const controller = new AbortController();
134377
- const onClose = () => controller.abort();
134378
- res.on("close", onClose);
134379
- const events = [];
134397
+ let result;
134380
134398
  try {
134381
- for await (const event of ctx.session.runTurn(body.prompt, {
134399
+ result = await driveTurn(ctx.session, body.prompt, {
134382
134400
  ...body.model ? { model: body.model } : {},
134383
- ...body.systemPrompt ? { systemPrompt: body.systemPrompt } : {},
134384
- signal: controller.signal
134385
- })) {
134386
- events.push(event);
134387
- }
134401
+ ...body.systemPrompt ? { systemPrompt: body.systemPrompt } : {}
134402
+ }, res);
134388
134403
  } catch (err) {
134389
134404
  reply(res, 500, { error: "turn_failed", message: err instanceof Error ? err.message : String(err) });
134390
134405
  return;
134391
- } finally {
134392
- res.off("close", onClose);
134393
134406
  }
134394
- const finalAssistant = events.findLast?.((e3) => e3.type === "assistant_message");
134395
- const assistant = finalAssistant && finalAssistant.type === "assistant_message" ? finalAssistant.content : "";
134396
- reply(res, 200, { events, assistant });
134407
+ reply(res, 200, { events: result.events, assistant: result.assistant });
134397
134408
  }
134398
134409
  async function handleTurnAudio(req, res, ctx) {
134399
134410
  if (!checkAuth(req, ctx.authToken)) {
@@ -134434,12 +134445,12 @@ async function handleTurnAudio(req, res, ctx) {
134434
134445
  const systemPrompt = url2.searchParams.get("systemPrompt") ?? void 0;
134435
134446
  let transcript;
134436
134447
  try {
134437
- const result = await transcriber.transcribe(new Uint8Array(bytes), {
134448
+ const result2 = await transcriber.transcribe(new Uint8Array(bytes), {
134438
134449
  mimeType: contentType,
134439
134450
  ...language ? { language } : {},
134440
134451
  ...promptHint ? { prompt: promptHint } : {}
134441
134452
  });
134442
- transcript = result.text.trim();
134453
+ transcript = result2.text.trim();
134443
134454
  } catch (err) {
134444
134455
  ctx.logger?.warn("http audio transcription failed", { err: err instanceof Error ? err.message : String(err) });
134445
134456
  reply(res, 502, { error: "transcription_failed", message: err instanceof Error ? err.message : String(err) });
@@ -134449,27 +134460,17 @@ async function handleTurnAudio(req, res, ctx) {
134449
134460
  reply(res, 422, { error: "empty_transcript", message: "transcriber returned empty text" });
134450
134461
  return;
134451
134462
  }
134452
- const controller = new AbortController();
134453
- const onClose = () => controller.abort();
134454
- res.on("close", onClose);
134455
- const events = [];
134463
+ let result;
134456
134464
  try {
134457
- for await (const event of ctx.session.runTurn(transcript, {
134465
+ result = await driveTurn(ctx.session, transcript, {
134458
134466
  ...model ? { model } : {},
134459
- ...systemPrompt ? { systemPrompt } : {},
134460
- signal: controller.signal
134461
- })) {
134462
- events.push(event);
134463
- }
134467
+ ...systemPrompt ? { systemPrompt } : {}
134468
+ }, res);
134464
134469
  } catch (err) {
134465
134470
  reply(res, 500, { error: "turn_failed", message: err instanceof Error ? err.message : String(err) });
134466
134471
  return;
134467
- } finally {
134468
- res.off("close", onClose);
134469
134472
  }
134470
- const finalAssistant = events.findLast?.((e3) => e3.type === "assistant_message");
134471
- const assistant = finalAssistant && finalAssistant.type === "assistant_message" ? finalAssistant.content : "";
134472
- reply(res, 200, { transcript, events, assistant });
134473
+ reply(res, 200, { transcript, events: result.events, assistant: result.assistant });
134473
134474
  }
134474
134475
  async function handleTurnStream(req, res, ctx) {
134475
134476
  if (!checkAuth(req, ctx.authToken)) {
@@ -134571,11 +134572,11 @@ var HttpChannel = class {
134571
134572
  this.server = server;
134572
134573
  let rejectRunning;
134573
134574
  let resolveRunning;
134574
- const running = new Promise((resolve13, reject) => {
134575
- resolveRunning = resolve13;
134575
+ const running = new Promise((resolve12, reject) => {
134576
+ resolveRunning = resolve12;
134576
134577
  rejectRunning = reject;
134577
134578
  });
134578
- const listening = new Promise((resolve13, reject) => {
134579
+ const listening = new Promise((resolve12, reject) => {
134579
134580
  const onListenError = (err) => reject(err);
134580
134581
  server.once("error", onListenError);
134581
134582
  server.listen(this.port, this.host, () => {
@@ -134591,7 +134592,7 @@ var HttpChannel = class {
134591
134592
  port: this.boundPortValue,
134592
134593
  authEnabled: this.authToken !== null
134593
134594
  });
134594
- resolve13();
134595
+ resolve12();
134595
134596
  });
134596
134597
  });
134597
134598
  await listening;
@@ -134599,10 +134600,10 @@ var HttpChannel = class {
134599
134600
  return {
134600
134601
  running,
134601
134602
  stop: async () => {
134602
- await new Promise((resolve13) => {
134603
+ await new Promise((resolve12) => {
134603
134604
  if (!this.server)
134604
- return resolve13();
134605
- this.server.close(() => resolve13());
134605
+ return resolve12();
134606
+ this.server.close(() => resolve12());
134606
134607
  });
134607
134608
  }
134608
134609
  };
@@ -134745,17 +134746,17 @@ function isAddrInUse(err) {
134745
134746
  }
134746
134747
  async function captureStdout(cmd, args) {
134747
134748
  const { spawn: spawn15 } = await import('child_process');
134748
- return await new Promise((resolve13) => {
134749
+ return await new Promise((resolve12) => {
134749
134750
  let out = "";
134750
134751
  try {
134751
134752
  const child = spawn15(cmd, [...args], { stdio: ["ignore", "pipe", "ignore"] });
134752
134753
  child.stdout.on("data", (b3) => {
134753
134754
  out += b3.toString();
134754
134755
  });
134755
- child.on("error", () => resolve13(""));
134756
- child.on("close", () => resolve13(out));
134756
+ child.on("error", () => resolve12(""));
134757
+ child.on("close", () => resolve12(out));
134757
134758
  } catch {
134758
- resolve13("");
134759
+ resolve12("");
134759
134760
  }
134760
134761
  });
134761
134762
  }
@@ -134882,7 +134883,7 @@ var WebChannel = class {
134882
134883
  await this.openTunnel();
134883
134884
  this.publishSurface?.({ url: this.shareUrl, nextViewId: () => `v_srv_${++this.viewSeq}` });
134884
134885
  this.publishControls?.({ retunnel: () => this.retunnel() });
134885
- const running = new Promise((resolve13) => server.once("close", () => resolve13()));
134886
+ const running = new Promise((resolve12) => server.once("close", () => resolve12()));
134886
134887
  return { running, stop: () => this.stop() };
134887
134888
  }
134888
134889
  /**
@@ -134895,7 +134896,7 @@ var WebChannel = class {
134895
134896
  * surface actually got (the share URL embeds the real port either way).
134896
134897
  */
134897
134898
  async bindServerWithRetry(server) {
134898
- const tryListen = () => new Promise((resolve13, reject) => {
134899
+ const tryListen = () => new Promise((resolve12, reject) => {
134899
134900
  const onError2 = (err) => {
134900
134901
  server.off("listening", onListening);
134901
134902
  reject(err);
@@ -134906,7 +134907,7 @@ var WebChannel = class {
134906
134907
  if (addr && typeof addr === "object")
134907
134908
  this.port = addr.port;
134908
134909
  this.logger?.info?.("web channel listening", { url: this.url });
134909
- resolve13();
134910
+ resolve12();
134910
134911
  };
134911
134912
  server.once("error", onError2);
134912
134913
  server.once("listening", onListening);
@@ -134987,8 +134988,8 @@ var WebChannel = class {
134987
134988
  }
134988
134989
  }
134989
134990
  this.clients.clear();
134990
- await new Promise((resolve13) => this.wss ? this.wss.close(() => resolve13()) : resolve13());
134991
- await new Promise((resolve13) => this.server ? this.server.close(() => resolve13()) : resolve13());
134991
+ await new Promise((resolve12) => this.wss ? this.wss.close(() => resolve12()) : resolve12());
134992
+ await new Promise((resolve12) => this.server ? this.server.close(() => resolve12()) : resolve12());
134992
134993
  }
134993
134994
  validToken(reqUrl) {
134994
134995
  try {
@@ -135388,9 +135389,9 @@ async function createWebSocketTransportServer(opts) {
135388
135389
  for (const handler of connectionHandlers)
135389
135390
  handler(transport);
135390
135391
  });
135391
- await new Promise((resolve13, reject) => {
135392
+ await new Promise((resolve12, reject) => {
135392
135393
  wss.once("error", reject);
135393
- wss.once("listening", resolve13);
135394
+ wss.once("listening", resolve12);
135394
135395
  });
135395
135396
  const bound = wss.address();
135396
135397
  const boundPort = typeof bound === "object" && bound !== null ? bound.port : opts.port;
@@ -135411,10 +135412,10 @@ async function createWebSocketTransportServer(opts) {
135411
135412
  return connections;
135412
135413
  },
135413
135414
  close() {
135414
- return new Promise((resolve13) => {
135415
+ return new Promise((resolve12) => {
135415
135416
  for (const client of wss.clients)
135416
135417
  client.terminate();
135417
- wss.close(() => resolve13());
135418
+ wss.close(() => resolve12());
135418
135419
  });
135419
135420
  }
135420
135421
  };
@@ -135466,8 +135467,8 @@ var JsonRpcPeer = class {
135466
135467
  if (this.closed)
135467
135468
  return Promise.reject(new RpcError("rpc peer is closed"));
135468
135469
  const id = this.nextId++;
135469
- return new Promise((resolve13, reject) => {
135470
- this.pending.set(id, { resolve: resolve13, reject });
135470
+ return new Promise((resolve12, reject) => {
135471
+ this.pending.set(id, { resolve: resolve12, reject });
135471
135472
  const frame = { id, method, ...params !== void 0 ? { params } : {} };
135472
135473
  this.transport.send(frame);
135473
135474
  });
@@ -135619,11 +135620,11 @@ async function createUnixSocketServer(socketPath, logger = stderrLogger) {
135619
135620
  for (const handler of connectionHandlers)
135620
135621
  handler(transport);
135621
135622
  });
135622
- await new Promise((resolve13, reject) => {
135623
+ await new Promise((resolve12, reject) => {
135623
135624
  server.once("error", reject);
135624
135625
  server.listen(socketPath, () => {
135625
135626
  server.removeListener("error", reject);
135626
- resolve13();
135627
+ resolve12();
135627
135628
  });
135628
135629
  });
135629
135630
  if (process.platform !== "win32") {
@@ -135642,7 +135643,7 @@ async function createUnixSocketServer(socketPath, logger = stderrLogger) {
135642
135643
  connectionHandlers.push(handler);
135643
135644
  },
135644
135645
  close() {
135645
- return new Promise((resolve13) => {
135646
+ return new Promise((resolve12) => {
135646
135647
  server.close(() => {
135647
135648
  if (process.platform !== "win32") {
135648
135649
  try {
@@ -135650,7 +135651,7 @@ async function createUnixSocketServer(socketPath, logger = stderrLogger) {
135650
135651
  } catch {
135651
135652
  }
135652
135653
  }
135653
- resolve13();
135654
+ resolve12();
135654
135655
  });
135655
135656
  });
135656
135657
  }
@@ -135659,7 +135660,7 @@ async function createUnixSocketServer(socketPath, logger = stderrLogger) {
135659
135660
  var DEFAULT_CONNECT_TIMEOUT_MS = 1e4;
135660
135661
  function connectUnixSocket(socketPath, opts = {}) {
135661
135662
  const timeoutMs = opts.timeoutMs ?? DEFAULT_CONNECT_TIMEOUT_MS;
135662
- return new Promise((resolve13, reject) => {
135663
+ return new Promise((resolve12, reject) => {
135663
135664
  const socket = net.connect(socketPath);
135664
135665
  let settled = false;
135665
135666
  const timer = setTimeout(() => {
@@ -135684,7 +135685,7 @@ function connectUnixSocket(socketPath, opts = {}) {
135684
135685
  settled = true;
135685
135686
  clearTimeout(timer);
135686
135687
  socket.removeListener("error", onError2);
135687
- resolve13(new NdjsonTransport(socket));
135688
+ resolve12(new NdjsonTransport(socket));
135688
135689
  });
135689
135690
  });
135690
135691
  }
@@ -135716,11 +135717,11 @@ function warnWindowsPipeAclOnce(logger, pipePath) {
135716
135717
  async function reclaimStaleSocket(socketPath) {
135717
135718
  if (!fs28__default.existsSync(socketPath))
135718
135719
  return;
135719
- const alive = await new Promise((resolve13) => {
135720
+ const alive = await new Promise((resolve12) => {
135720
135721
  const probe = net.connect(socketPath);
135721
135722
  const finish = (up) => {
135722
135723
  probe.destroy();
135723
- resolve13(up);
135724
+ resolve12(up);
135724
135725
  };
135725
135726
  probe.once("connect", () => finish(true));
135726
135727
  probe.once("error", () => finish(false));
@@ -135745,11 +135746,11 @@ function runnerSocketPath() {
135745
135746
  return platformSocket("serve", path3__default.join(os5__default.homedir(), ".moxxy", "serve.sock"));
135746
135747
  }
135747
135748
  function isRunnerUp(socketPath = runnerSocketPath()) {
135748
- return new Promise((resolve13) => {
135749
+ return new Promise((resolve12) => {
135749
135750
  const socket = net.connect(socketPath);
135750
135751
  const finish = (up) => {
135751
135752
  socket.destroy();
135752
- resolve13(up);
135753
+ resolve12(up);
135753
135754
  };
135754
135755
  socket.once("connect", () => finish(true));
135755
135756
  socket.once("error", () => finish(false));
@@ -136565,7 +136566,7 @@ var TurnStream = class {
136565
136566
  yield this.queue.shift();
136566
136567
  if (this.done)
136567
136568
  break;
136568
- await new Promise((resolve13) => this.waiters.push(resolve13));
136569
+ await new Promise((resolve12) => this.waiters.push(resolve12));
136569
136570
  }
136570
136571
  if (this.error)
136571
136572
  throw new Error(this.error);
@@ -137200,7 +137201,7 @@ async function isMoxxyProcess(pid) {
137200
137201
  }
137201
137202
  async function pidCommand2(pid) {
137202
137203
  const { spawn: spawn15 } = await import('child_process');
137203
- return await new Promise((resolve13) => {
137204
+ return await new Promise((resolve12) => {
137204
137205
  let out = "";
137205
137206
  try {
137206
137207
  const child = spawn15("ps", ["-p", String(pid), "-o", "command="], {
@@ -137209,10 +137210,10 @@ async function pidCommand2(pid) {
137209
137210
  child.stdout.on("data", (b3) => {
137210
137211
  out += b3.toString();
137211
137212
  });
137212
- child.on("error", () => resolve13(""));
137213
- child.on("close", () => resolve13(out.trim()));
137213
+ child.on("error", () => resolve12(""));
137214
+ child.on("close", () => resolve12(out.trim()));
137214
137215
  } catch {
137215
- resolve13("");
137216
+ resolve12("");
137216
137217
  }
137217
137218
  });
137218
137219
  }
@@ -137242,7 +137243,7 @@ async function pidsListeningOnPort(port) {
137242
137243
  }
137243
137244
  async function runLsof(args) {
137244
137245
  const { spawn: spawn15 } = await import('child_process');
137245
- return await new Promise((resolve13) => {
137246
+ return await new Promise((resolve12) => {
137246
137247
  let out = "";
137247
137248
  try {
137248
137249
  const child = spawn15("lsof", [...args], {
@@ -137251,10 +137252,10 @@ async function runLsof(args) {
137251
137252
  child.stdout.on("data", (b3) => {
137252
137253
  out += b3.toString();
137253
137254
  });
137254
- child.on("error", () => resolve13([]));
137255
- child.on("close", () => resolve13(parsePids(out)));
137255
+ child.on("error", () => resolve12([]));
137256
+ child.on("close", () => resolve12(parsePids(out)));
137256
137257
  } catch {
137257
- resolve13([]);
137258
+ resolve12([]);
137258
137259
  }
137259
137260
  });
137260
137261
  }
@@ -137794,8 +137795,8 @@ var MobileSessionHost = class {
137794
137795
  for (const controller of this.turns.values())
137795
137796
  controller.abort();
137796
137797
  this.turns.clear();
137797
- for (const resolve13 of this.pendingAsks.values())
137798
- resolve13({ mode: "deny" });
137798
+ for (const resolve12 of this.pendingAsks.values())
137799
+ resolve12({ mode: "deny" });
137799
137800
  this.pendingAsks.clear();
137800
137801
  this.session.setApprovalResolver(null);
137801
137802
  }
@@ -137845,17 +137846,17 @@ var MobileSessionHost = class {
137845
137846
  }
137846
137847
  openAsk(req) {
137847
137848
  const requestId = `ask-${++this.askCounter}`;
137848
- return new Promise((resolve13) => {
137849
- this.pendingAsks.set(requestId, resolve13);
137849
+ return new Promise((resolve12) => {
137850
+ this.pendingAsks.set(requestId, resolve12);
137850
137851
  this.bus.broadcast("ask.request", { ...req, requestId });
137851
137852
  });
137852
137853
  }
137853
137854
  answerAsk(requestId, response) {
137854
- const resolve13 = this.pendingAsks.get(requestId);
137855
- if (!resolve13)
137855
+ const resolve12 = this.pendingAsks.get(requestId);
137856
+ if (!resolve12)
137856
137857
  return;
137857
137858
  this.pendingAsks.delete(requestId);
137858
- resolve13(response);
137859
+ resolve12(response);
137859
137860
  }
137860
137861
  };
137861
137862
  var TOKEN_FILE = "mobile-token";
@@ -138079,8 +138080,8 @@ var MobileChannel = class {
138079
138080
  throw err;
138080
138081
  }
138081
138082
  let resolveRunning;
138082
- const running = new Promise((resolve13) => {
138083
- resolveRunning = resolve13;
138083
+ const running = new Promise((resolve12) => {
138084
+ resolveRunning = resolve12;
138084
138085
  });
138085
138086
  return {
138086
138087
  running,
@@ -138640,7 +138641,7 @@ ${tail}` : " (no stderr captured)")
138640
138641
  throw new MoxxyError({ code: "NETWORK_ABORTED", message: "browser_session aborted" });
138641
138642
  const id = randomUUID();
138642
138643
  const req = { id, method, params };
138643
- return new Promise((resolve13, reject) => {
138644
+ return new Promise((resolve12, reject) => {
138644
138645
  const onAbort = () => {
138645
138646
  if (this.pending.delete(id))
138646
138647
  reject(new MoxxyError({ code: "NETWORK_ABORTED", message: "browser_session aborted" }));
@@ -138649,7 +138650,7 @@ ${tail}` : " (no stderr captured)")
138649
138650
  this.pending.set(id, {
138650
138651
  resolve: (v3) => {
138651
138652
  cleanup();
138652
- resolve13(v3);
138653
+ resolve12(v3);
138653
138654
  },
138654
138655
  reject: (e3) => {
138655
138656
  cleanup();
@@ -138802,9 +138803,12 @@ function buildBrowserSurface(deps) {
138802
138803
  fails = 0;
138803
138804
  emit2({ type: "frame", base64: frame.base64, mime: frame.mediaType, url: frame.url });
138804
138805
  } catch (err) {
138805
- if (++fails === FAIL_GRACE && !last) {
138806
+ if (++fails === FAIL_GRACE) {
138806
138807
  const message = err instanceof Error ? err.message : String(err);
138807
- emit2({ type: "status", text: `Browser unavailable: ${message}` });
138808
+ emit2({
138809
+ type: "status",
138810
+ text: last ? `Browser disconnected: ${message}` : `Browser unavailable: ${message}`
138811
+ });
138808
138812
  }
138809
138813
  } finally {
138810
138814
  inFlight = false;
@@ -139072,7 +139076,7 @@ function buildTerminalTool() {
139072
139076
  });
139073
139077
  }
139074
139078
  function runCommand(proc, command, marker, timeoutMs) {
139075
- return new Promise((resolve13) => {
139079
+ return new Promise((resolve12) => {
139076
139080
  let acc = "";
139077
139081
  let settled = false;
139078
139082
  const finish = (exitCode, timedOut) => {
@@ -139081,7 +139085,7 @@ function runCommand(proc, command, marker, timeoutMs) {
139081
139085
  settled = true;
139082
139086
  unsub();
139083
139087
  clearTimeout(timer);
139084
- resolve13({ output: cleanOutput(acc, command, marker), exitCode, timedOut });
139088
+ resolve12({ output: cleanOutput(acc, command, marker), exitCode, timedOut });
139085
139089
  };
139086
139090
  const sentinel2 = new RegExp(`${marker} (\\d+)`);
139087
139091
  const carry = marker.length + 32;
@@ -139164,26 +139168,21 @@ function buildDispatchAgentTool(deps) {
139164
139168
  function resolveSpec(input, deps) {
139165
139169
  const requested = input.agentType ?? "default";
139166
139170
  const def = deps.getAgent(requested) ?? DEFAULT_AGENT;
139171
+ const systemPrompt = input.systemPrompt ?? def.systemPrompt;
139172
+ const model = input.model ?? def.model;
139173
+ const mode = input.mode ?? def.mode;
139174
+ const allowedTools = input.allowedTools ?? def.allowedTools;
139167
139175
  const merged = {
139168
139176
  prompt: input.prompt,
139169
139177
  label: input.label ?? def.name,
139170
139178
  // The requested kind, surfaced in subagent_* payloads for group rendering.
139171
- agentType: requested
139179
+ agentType: requested,
139180
+ ...systemPrompt !== void 0 && { systemPrompt },
139181
+ ...model !== void 0 && { model },
139182
+ ...mode !== void 0 && { mode },
139183
+ ...def.maxIterations !== void 0 && { maxIterations: def.maxIterations },
139184
+ ...allowedTools !== void 0 && { allowedTools }
139172
139185
  };
139173
- const systemPrompt = input.systemPrompt ?? def.systemPrompt;
139174
- if (systemPrompt !== void 0)
139175
- merged.systemPrompt = systemPrompt;
139176
- const model = input.model ?? def.model;
139177
- if (model !== void 0)
139178
- merged.model = model;
139179
- const mode = input.mode ?? def.mode;
139180
- if (mode !== void 0)
139181
- merged.mode = mode;
139182
- if (def.maxIterations !== void 0)
139183
- merged.maxIterations = def.maxIterations;
139184
- const allowedTools = input.allowedTools ?? def.allowedTools;
139185
- if (allowedTools !== void 0)
139186
- merged.allowedTools = allowedTools;
139187
139186
  return merged;
139188
139187
  }
139189
139188
 
@@ -139333,7 +139332,7 @@ async function ensurePackageJson(dir) {
139333
139332
  }
139334
139333
  }
139335
139334
  function runNpm(args, signal) {
139336
- return new Promise((resolve13, reject) => {
139335
+ return new Promise((resolve12, reject) => {
139337
139336
  if (signal?.aborted) {
139338
139337
  reject(new Error("npm aborted before start"));
139339
139338
  return;
@@ -139359,7 +139358,7 @@ function runNpm(args, signal) {
139359
139358
  });
139360
139359
  child.on("close", (code) => {
139361
139360
  signal?.removeEventListener("abort", onAbort);
139362
- resolve13({ exitCode: code ?? -1, stdout, stderr });
139361
+ resolve12({ exitCode: code ?? -1, stdout, stderr });
139363
139362
  });
139364
139363
  });
139365
139364
  }
@@ -140148,7 +140147,7 @@ function buildViewPlugin(opts) {
140148
140147
  }
140149
140148
  var IS_DARWIN = process.platform === "darwin";
140150
140149
  function runProcess(cmd, args, opts = {}) {
140151
- return new Promise((resolve13, reject) => {
140150
+ return new Promise((resolve12, reject) => {
140152
140151
  const child = spawn(cmd, [...args], { stdio: ["pipe", "pipe", "pipe"] });
140153
140152
  const stdoutChunks = [];
140154
140153
  let stderr = "";
@@ -140192,7 +140191,7 @@ function runProcess(cmd, args, opts = {}) {
140192
140191
  if (timer)
140193
140192
  clearTimeout(timer);
140194
140193
  opts.signal?.removeEventListener("abort", onAbort);
140195
- resolve13({
140194
+ resolve12({
140196
140195
  exitCode: code ?? -1,
140197
140196
  stdout: Buffer.concat(stdoutChunks).toString("utf8"),
140198
140197
  stderr
@@ -141434,12 +141433,8 @@ var WebhookConfigStore = class {
141434
141433
  const raw = await readFile(this.file, "utf8");
141435
141434
  const parsed = fileSchema2.safeParse(JSON.parse(raw));
141436
141435
  this.cache = parsed.success ? parsed.data.config : webhookConfigSchema.parse({});
141437
- } catch (err) {
141438
- if (err.code === "ENOENT") {
141439
- this.cache = webhookConfigSchema.parse({});
141440
- } else {
141441
- this.cache = webhookConfigSchema.parse({});
141442
- }
141436
+ } catch {
141437
+ this.cache = webhookConfigSchema.parse({});
141443
141438
  }
141444
141439
  }
141445
141440
  async persist(config) {
@@ -141594,11 +141589,11 @@ function parseBody(body) {
141594
141589
  return { ok: false, value: null };
141595
141590
  }
141596
141591
  }
141597
- function readJsonPath(parsed, path60) {
141592
+ function readJsonPath(parsed, path59) {
141598
141593
  if (!parsed.ok)
141599
141594
  return null;
141600
141595
  let cur = parsed.value;
141601
- for (const seg of path60.split(".")) {
141596
+ for (const seg of path59.split(".")) {
141602
141597
  if (cur === null || cur === void 0 || typeof cur !== "object")
141603
141598
  return null;
141604
141599
  cur = cur[seg];
@@ -141787,14 +141782,14 @@ var WebhookServer = class {
141787
141782
  });
141788
141783
  });
141789
141784
  this.server = server;
141790
- await new Promise((resolve13, reject) => {
141785
+ await new Promise((resolve12, reject) => {
141791
141786
  server.once("error", reject);
141792
141787
  server.listen(this.opts.port, this.opts.host, () => {
141793
141788
  this.opts.logger?.info?.("webhooks: listening", {
141794
141789
  host: this.opts.host,
141795
141790
  port: this.opts.port
141796
141791
  });
141797
- resolve13();
141792
+ resolve12();
141798
141793
  });
141799
141794
  });
141800
141795
  return {
@@ -141808,7 +141803,7 @@ var WebhookServer = class {
141808
141803
  return;
141809
141804
  const s2 = this.server;
141810
141805
  this.server = null;
141811
- await new Promise((resolve13) => s2.close(() => resolve13()));
141806
+ await new Promise((resolve12) => s2.close(() => resolve12()));
141812
141807
  }
141813
141808
  async handle(req, res) {
141814
141809
  const url2 = req.url ?? "/";
@@ -143002,7 +142997,7 @@ var inprocIsolator = {
143002
142997
  internal.abort(signal.reason ?? new Error(`[security:inproc] tool '${call.toolName}' aborted`));
143003
142998
  }
143004
142999
  };
143005
- return new Promise((resolve13, reject) => {
143000
+ return new Promise((resolve12, reject) => {
143006
143001
  if (signal.aborted) {
143007
143002
  onExternalAbort();
143008
143003
  reject(new Error(`[security:inproc] tool '${call.toolName}' aborted`));
@@ -143022,7 +143017,7 @@ var inprocIsolator = {
143022
143017
  runHandler(handler, call.input, handlerSignal).then((out) => {
143023
143018
  clearTimeout(timer);
143024
143019
  signal.removeEventListener("abort", onAbort);
143025
- resolve13(out);
143020
+ resolve12(out);
143026
143021
  }, (err) => {
143027
143022
  clearTimeout(timer);
143028
143023
  signal.removeEventListener("abort", onAbort);
@@ -143333,7 +143328,7 @@ async function brokerExec(args, { caps, cwd: cwd2, signal }) {
143333
143328
  throw new Error(`[broker:exec] command '${command}' is outside the tool's declared commands allowlist`);
143334
143329
  }
143335
143330
  }
143336
- return await new Promise((resolve13, reject) => {
143331
+ return await new Promise((resolve12, reject) => {
143337
143332
  const child = spawn(command, [...argv], {
143338
143333
  cwd: opts.cwd ?? cwd2,
143339
143334
  // Filter the parent env through the tool's `caps.env` allowlist (or a
@@ -143381,7 +143376,7 @@ async function brokerExec(args, { caps, cwd: cwd2, signal }) {
143381
143376
  finish(() => reject(e3));
143382
143377
  });
143383
143378
  child.on("close", (exitCode) => {
143384
- finish(() => resolve13({
143379
+ finish(() => resolve12({
143385
143380
  stdout: Buffer.concat(outChunks).toString("utf8"),
143386
143381
  stderr: Buffer.concat(errChunks).toString("utf8"),
143387
143382
  exitCode
@@ -143651,7 +143646,7 @@ function createWorkerIsolator(opts = {}) {
143651
143646
  maxYoungGenerationSizeMb: Math.max(16, Math.floor(memMb / 4))
143652
143647
  }
143653
143648
  });
143654
- return new Promise((resolve13, reject) => {
143649
+ return new Promise((resolve12, reject) => {
143655
143650
  const cleanup = /* @__PURE__ */ new Set();
143656
143651
  let settled = false;
143657
143652
  let terminated = false;
@@ -143707,7 +143702,7 @@ function createWorkerIsolator(opts = {}) {
143707
143702
  if (settled)
143708
143703
  return;
143709
143704
  if (msg.ok) {
143710
- finish(() => resolve13(msg.value));
143705
+ finish(() => resolve12(msg.value));
143711
143706
  } else {
143712
143707
  const e3 = new Error(msg.errorMessage);
143713
143708
  e3.name = msg.errorName;
@@ -143856,7 +143851,7 @@ function createSubprocessIsolator(opts = {}) {
143856
143851
  env: env3,
143857
143852
  stdio: ["pipe", "pipe", "pipe"]
143858
143853
  });
143859
- return new Promise((resolve13, reject) => {
143854
+ return new Promise((resolve12, reject) => {
143860
143855
  let stderr = "";
143861
143856
  let stdoutBuffer = "";
143862
143857
  let settled = false;
@@ -143930,7 +143925,7 @@ function createSubprocessIsolator(opts = {}) {
143930
143925
  return;
143931
143926
  }
143932
143927
  if (msg.ok) {
143933
- finish(() => resolve13(msg.value));
143928
+ finish(() => resolve12(msg.value));
143934
143929
  } else {
143935
143930
  const e3 = new Error(msg.errorMessage);
143936
143931
  e3.name = msg.errorName;
@@ -144037,6 +144032,9 @@ async function invoke(call, caps, _signal) {
144037
144032
  const inputPtr = exports.alloc(inputBytes.length);
144038
144033
  new Uint8Array(exports.memory.buffer, inputPtr, inputBytes.length).set(inputBytes);
144039
144034
  const packed = handler(inputPtr, inputBytes.length);
144035
+ if (typeof packed !== "bigint") {
144036
+ throw new Error(`[security:wasm] handler must return i64 (got ${typeof packed}); check the (i32,i32)->i64 calling convention`);
144037
+ }
144040
144038
  const outputPtr = Number(packed >> 32n & 0xffffffffn);
144041
144039
  const outputLen = Number(packed & 0xffffffffn);
144042
144040
  if (outputLen === 0)
@@ -144792,8 +144790,8 @@ function formatIssues(error2, raw) {
144792
144790
  const field = rest.join(".");
144793
144791
  return field ? `${where}: ${field} ${msg}` : `${where} ${msg}`;
144794
144792
  }
144795
- const path60 = iss.path.join(".");
144796
- return path60 ? `${path60} ${msg}` : `workflow ${msg}`;
144793
+ const path59 = iss.path.join(".");
144794
+ return path59 ? `${path59} ${msg}` : `workflow ${msg}`;
144797
144795
  });
144798
144796
  }
144799
144797
  function validateWorkflow(raw) {
@@ -147496,60 +147494,23 @@ function scopedSessionView(session, allowedTools, triggerName) {
147496
147494
  return parent.execute(name, input, signal, opts);
147497
147495
  }
147498
147496
  };
147499
- return {
147500
- get id() {
147501
- return session.id;
147502
- },
147503
- get log() {
147504
- return session.log;
147505
- },
147506
- get signal() {
147507
- return session.signal;
147508
- },
147509
- tools,
147510
- get skills() {
147511
- return session.skills;
147512
- },
147513
- get providers() {
147514
- return session.providers;
147515
- },
147516
- get modes() {
147517
- return session.modes;
147518
- },
147519
- get compactors() {
147520
- return session.compactors;
147521
- },
147522
- get cacheStrategies() {
147523
- return session.cacheStrategies;
147524
- },
147525
- resolver: resolver2,
147526
- get approvalResolver() {
147527
- return session.approvalResolver;
147528
- },
147529
- get elisionSettings() {
147530
- return session.elisionSettings;
147531
- },
147532
- get lazyTools() {
147533
- return session.lazyTools;
147534
- },
147535
- get dispatcher() {
147536
- return session.dispatcher;
147537
- },
147538
- get pluginHost() {
147539
- return session.pluginHost;
147540
- },
147541
- // Read-through AND write-through: runTurn records the resolved model on
147542
- // the session it was handed, and that must land on the real session, not
147543
- // this per-fire view.
147544
- get lastResolvedModel() {
147545
- return session.lastResolvedModel;
147546
- },
147547
- set lastResolvedModel(model) {
147548
- session.lastResolvedModel = model;
147549
- },
147550
- startTurn: () => session.startTurn(),
147551
- appContext: () => session.appContext()
147552
- };
147497
+ const view = Object.create(session);
147498
+ Object.defineProperties(view, {
147499
+ tools: { value: tools, enumerable: true },
147500
+ resolver: { value: resolver2, enumerable: true },
147501
+ // Write-through: `runTurn` records the resolved model on the session it
147502
+ // was handed; that must land on the real session, not this per-fire view.
147503
+ // An own data property on the prototype-chained view would otherwise
147504
+ // shadow the real one on write, so install an explicit accessor.
147505
+ lastResolvedModel: {
147506
+ get: () => session.lastResolvedModel,
147507
+ set: (model) => {
147508
+ session.lastResolvedModel = model;
147509
+ },
147510
+ enumerable: true
147511
+ }
147512
+ });
147513
+ return view;
147553
147514
  }
147554
147515
 
147555
147516
  // src/setup/register-plugins.ts
@@ -148188,7 +148149,11 @@ async function runPromptCommand(argv) {
148188
148149
  ${stdinBuf}` : prompt;
148189
148150
  const allowTools = parseList(argv.flags["allow-tools"]);
148190
148151
  const allowAll = hasBoolFlag(argv, "allow-all");
148191
- const outputFormat = stringFlag(argv, "output-format") ?? "text";
148152
+ const outputFormat = parseOutputFormat(stringFlag(argv, "output-format"));
148153
+ if (outputFormat === null) {
148154
+ printError(`--output-format must be one of: ${OUTPUT_FORMATS.join(", ")}`);
148155
+ return 2;
148156
+ }
148192
148157
  const model = stringFlag(argv, "model");
148193
148158
  const resolver2 = allowAll ? denyByDefaultResolver : allowTools.length > 0 ? createAllowListResolver(allowTools) : denyByDefaultResolver;
148194
148159
  const session = await setupSession({
@@ -148230,6 +148195,11 @@ ${stdinBuf}` : prompt;
148230
148195
  }
148231
148196
  return exitCode;
148232
148197
  }
148198
+ var OUTPUT_FORMATS = ["text", "json", "stream-json"];
148199
+ function parseOutputFormat(raw) {
148200
+ if (raw === void 0) return "text";
148201
+ return OUTPUT_FORMATS.includes(raw) ? raw : null;
148202
+ }
148233
148203
  function parseList(v3) {
148234
148204
  if (typeof v3 !== "string" || !v3) return [];
148235
148205
  return v3.split(",").map((s2) => s2.trim()).filter(Boolean);
@@ -148670,7 +148640,7 @@ function makeStdinLinePrompt(input) {
148670
148640
  const queued = lineQueue.shift();
148671
148641
  if (queued !== void 0) return Promise.resolve(queued);
148672
148642
  if (stdinEnded) return Promise.resolve("");
148673
- return new Promise((resolve13) => lineWaiters.push(resolve13));
148643
+ return new Promise((resolve12) => lineWaiters.push(resolve12));
148674
148644
  };
148675
148645
  return async (question, promptOpts) => {
148676
148646
  process.stdout.write(encodeLoginPrompt({ question, mask: promptOpts?.mask === true }));
@@ -148827,8 +148797,8 @@ function titleCase(s2) {
148827
148797
  // src/commands/run-tui.ts
148828
148798
  async function killStaleRunnerAt(socketPath) {
148829
148799
  if (!existsSync(socketPath)) return;
148830
- const pid = await new Promise((resolve13) => {
148831
- if (process.platform === "win32") return resolve13(null);
148800
+ const pid = await new Promise((resolve12) => {
148801
+ if (process.platform === "win32") return resolve12(null);
148832
148802
  let out = "";
148833
148803
  try {
148834
148804
  const child = spawn("lsof", ["-t", socketPath], {
@@ -148837,13 +148807,13 @@ async function killStaleRunnerAt(socketPath) {
148837
148807
  child.stdout.on("data", (b3) => {
148838
148808
  out += b3.toString();
148839
148809
  });
148840
- child.on("error", () => resolve13(null));
148810
+ child.on("error", () => resolve12(null));
148841
148811
  child.on("close", () => {
148842
148812
  const parsed = parseInt(out.trim().split("\n")[0] ?? "", 10);
148843
- resolve13(Number.isFinite(parsed) && parsed > 0 ? parsed : null);
148813
+ resolve12(Number.isFinite(parsed) && parsed > 0 ? parsed : null);
148844
148814
  });
148845
148815
  } catch {
148846
- resolve13(null);
148816
+ resolve12(null);
148847
148817
  }
148848
148818
  });
148849
148819
  if (pid && pid !== process.pid) {
@@ -149296,19 +149266,25 @@ async function removeAuditEntry(slug) {
149296
149266
  }
149297
149267
  function groupSimilarPrompts(entries) {
149298
149268
  const groups = [];
149269
+ const groupTokenSets = [];
149299
149270
  for (const entry of entries) {
149300
149271
  const tokens = tokenize8(entry.originatingPrompt);
149301
149272
  let placed = false;
149302
- for (const group of groups) {
149303
- const groupTokens = new Set(group.flatMap((e3) => tokenize8(e3.originatingPrompt)));
149304
- const overlap = tokens.filter((t2) => groupTokens.has(t2)).length;
149273
+ for (let i2 = 0; i2 < groups.length; i2 += 1) {
149274
+ const groupTokens = groupTokenSets[i2];
149275
+ let overlap = 0;
149276
+ for (const t2 of tokens) if (groupTokens.has(t2)) overlap += 1;
149305
149277
  if (overlap >= 2) {
149306
- group.push(entry);
149278
+ groups[i2].push(entry);
149279
+ for (const t2 of tokens) groupTokens.add(t2);
149307
149280
  placed = true;
149308
149281
  break;
149309
149282
  }
149310
149283
  }
149311
- if (!placed) groups.push([entry]);
149284
+ if (!placed) {
149285
+ groups.push([entry]);
149286
+ groupTokenSets.push(new Set(tokens));
149287
+ }
149312
149288
  }
149313
149289
  return groups;
149314
149290
  }
@@ -152637,14 +152613,14 @@ var HELP14 = formatHelp({
152637
152613
  async function runCommand2(cmd) {
152638
152614
  const [bin, ...args] = cmd;
152639
152615
  if (!bin) return 1;
152640
- return new Promise((resolve13) => {
152616
+ return new Promise((resolve12) => {
152641
152617
  const proc = spawn(bin, args, {
152642
152618
  stdio: "inherit",
152643
152619
  // npm/pnpm/yarn/bun are `.cmd` shims on Windows — needs a shell to launch.
152644
152620
  shell: process.platform === "win32"
152645
152621
  });
152646
- proc.on("error", () => resolve13(127));
152647
- proc.on("exit", (code) => resolve13(code ?? 1));
152622
+ proc.on("error", () => resolve12(127));
152623
+ proc.on("exit", (code) => resolve12(code ?? 1));
152648
152624
  });
152649
152625
  }
152650
152626
  async function runUpdateCommand(argv, deps = {}) {