agent-relay 6.0.2 → 6.0.3

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/index.cjs CHANGED
@@ -4531,15 +4531,15 @@ var require_route = __commonJS({
4531
4531
  };
4532
4532
  }
4533
4533
  function wrapConversion(toModel, graph) {
4534
- const path24 = [graph[toModel].parent, toModel];
4534
+ const path25 = [graph[toModel].parent, toModel];
4535
4535
  let fn2 = conversions[graph[toModel].parent][toModel];
4536
4536
  let cur = graph[toModel].parent;
4537
4537
  while (graph[cur].parent) {
4538
- path24.unshift(graph[cur].parent);
4538
+ path25.unshift(graph[cur].parent);
4539
4539
  fn2 = link2(conversions[graph[cur].parent][cur], fn2);
4540
4540
  cur = graph[cur].parent;
4541
4541
  }
4542
- fn2.conversion = path24;
4542
+ fn2.conversion = path25;
4543
4543
  return fn2;
4544
4544
  }
4545
4545
  module2.exports = function(fromModel) {
@@ -5505,7 +5505,7 @@ var require_ignore = __commonJS({
5505
5505
  // path matching.
5506
5506
  // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
5507
5507
  // @returns {TestResult} true if a file is ignored
5508
- test(path24, checkUnignored, mode) {
5508
+ test(path25, checkUnignored, mode) {
5509
5509
  let ignored = false;
5510
5510
  let unignored = false;
5511
5511
  let matchedRule;
@@ -5514,7 +5514,7 @@ var require_ignore = __commonJS({
5514
5514
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
5515
5515
  return;
5516
5516
  }
5517
- const matched = rule[mode].test(path24);
5517
+ const matched = rule[mode].test(path25);
5518
5518
  if (!matched) {
5519
5519
  return;
5520
5520
  }
@@ -5535,17 +5535,17 @@ var require_ignore = __commonJS({
5535
5535
  var throwError = (message, Ctor) => {
5536
5536
  throw new Ctor(message);
5537
5537
  };
5538
- var checkPath = (path24, originalPath, doThrow) => {
5539
- if (!isString(path24)) {
5538
+ var checkPath = (path25, originalPath, doThrow) => {
5539
+ if (!isString(path25)) {
5540
5540
  return doThrow(
5541
5541
  `path must be a string, but got \`${originalPath}\``,
5542
5542
  TypeError
5543
5543
  );
5544
5544
  }
5545
- if (!path24) {
5545
+ if (!path25) {
5546
5546
  return doThrow(`path must not be empty`, TypeError);
5547
5547
  }
5548
- if (checkPath.isNotRelative(path24)) {
5548
+ if (checkPath.isNotRelative(path25)) {
5549
5549
  const r = "`path.relative()`d";
5550
5550
  return doThrow(
5551
5551
  `path should be a ${r} string, but got "${originalPath}"`,
@@ -5554,7 +5554,7 @@ var require_ignore = __commonJS({
5554
5554
  }
5555
5555
  return true;
5556
5556
  };
5557
- var isNotRelative = (path24) => REGEX_TEST_INVALID_PATH.test(path24);
5557
+ var isNotRelative = (path25) => REGEX_TEST_INVALID_PATH.test(path25);
5558
5558
  checkPath.isNotRelative = isNotRelative;
5559
5559
  checkPath.convert = (p2) => p2;
5560
5560
  var Ignore = class {
@@ -5584,19 +5584,19 @@ var require_ignore = __commonJS({
5584
5584
  }
5585
5585
  // @returns {TestResult}
5586
5586
  _test(originalPath, cache, checkUnignored, slices) {
5587
- const path24 = originalPath && checkPath.convert(originalPath);
5587
+ const path25 = originalPath && checkPath.convert(originalPath);
5588
5588
  checkPath(
5589
- path24,
5589
+ path25,
5590
5590
  originalPath,
5591
5591
  this._strictPathCheck ? throwError : RETURN_FALSE
5592
5592
  );
5593
- return this._t(path24, cache, checkUnignored, slices);
5593
+ return this._t(path25, cache, checkUnignored, slices);
5594
5594
  }
5595
- checkIgnore(path24) {
5596
- if (!REGEX_TEST_TRAILING_SLASH.test(path24)) {
5597
- return this.test(path24);
5595
+ checkIgnore(path25) {
5596
+ if (!REGEX_TEST_TRAILING_SLASH.test(path25)) {
5597
+ return this.test(path25);
5598
5598
  }
5599
- const slices = path24.split(SLASH).filter(Boolean);
5599
+ const slices = path25.split(SLASH).filter(Boolean);
5600
5600
  slices.pop();
5601
5601
  if (slices.length) {
5602
5602
  const parent = this._t(
@@ -5609,18 +5609,18 @@ var require_ignore = __commonJS({
5609
5609
  return parent;
5610
5610
  }
5611
5611
  }
5612
- return this._rules.test(path24, false, MODE_CHECK_IGNORE);
5612
+ return this._rules.test(path25, false, MODE_CHECK_IGNORE);
5613
5613
  }
5614
- _t(path24, cache, checkUnignored, slices) {
5615
- if (path24 in cache) {
5616
- return cache[path24];
5614
+ _t(path25, cache, checkUnignored, slices) {
5615
+ if (path25 in cache) {
5616
+ return cache[path25];
5617
5617
  }
5618
5618
  if (!slices) {
5619
- slices = path24.split(SLASH).filter(Boolean);
5619
+ slices = path25.split(SLASH).filter(Boolean);
5620
5620
  }
5621
5621
  slices.pop();
5622
5622
  if (!slices.length) {
5623
- return cache[path24] = this._rules.test(path24, checkUnignored, MODE_IGNORE);
5623
+ return cache[path25] = this._rules.test(path25, checkUnignored, MODE_IGNORE);
5624
5624
  }
5625
5625
  const parent = this._t(
5626
5626
  slices.join(SLASH) + SLASH,
@@ -5628,29 +5628,29 @@ var require_ignore = __commonJS({
5628
5628
  checkUnignored,
5629
5629
  slices
5630
5630
  );
5631
- return cache[path24] = parent.ignored ? parent : this._rules.test(path24, checkUnignored, MODE_IGNORE);
5631
+ return cache[path25] = parent.ignored ? parent : this._rules.test(path25, checkUnignored, MODE_IGNORE);
5632
5632
  }
5633
- ignores(path24) {
5634
- return this._test(path24, this._ignoreCache, false).ignored;
5633
+ ignores(path25) {
5634
+ return this._test(path25, this._ignoreCache, false).ignored;
5635
5635
  }
5636
5636
  createFilter() {
5637
- return (path24) => !this.ignores(path24);
5637
+ return (path25) => !this.ignores(path25);
5638
5638
  }
5639
5639
  filter(paths) {
5640
5640
  return makeArray(paths).filter(this.createFilter());
5641
5641
  }
5642
5642
  // @returns {TestResult}
5643
- test(path24) {
5644
- return this._test(path24, this._testCache, true);
5643
+ test(path25) {
5644
+ return this._test(path25, this._testCache, true);
5645
5645
  }
5646
5646
  };
5647
5647
  var factory = (options) => new Ignore(options);
5648
- var isPathValid = (path24) => checkPath(path24 && checkPath.convert(path24), path24, RETURN_FALSE);
5648
+ var isPathValid = (path25) => checkPath(path25 && checkPath.convert(path25), path25, RETURN_FALSE);
5649
5649
  var setupWindows = () => {
5650
5650
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
5651
5651
  checkPath.convert = makePosix;
5652
5652
  const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
5653
- checkPath.isNotRelative = (path24) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path24) || isNotRelative(path24);
5653
+ checkPath.isNotRelative = (path25) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path25) || isNotRelative(path25);
5654
5654
  };
5655
5655
  if (
5656
5656
  // Detect `process` so that it can run in browsers.
@@ -5742,17 +5742,17 @@ var require_visit = __commonJS({
5742
5742
  visit.BREAK = BREAK;
5743
5743
  visit.SKIP = SKIP;
5744
5744
  visit.REMOVE = REMOVE;
5745
- function visit_(key, node, visitor, path24) {
5746
- const ctrl = callVisitor(key, node, visitor, path24);
5745
+ function visit_(key, node, visitor, path25) {
5746
+ const ctrl = callVisitor(key, node, visitor, path25);
5747
5747
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
5748
- replaceNode(key, path24, ctrl);
5749
- return visit_(key, ctrl, visitor, path24);
5748
+ replaceNode(key, path25, ctrl);
5749
+ return visit_(key, ctrl, visitor, path25);
5750
5750
  }
5751
5751
  if (typeof ctrl !== "symbol") {
5752
5752
  if (identity.isCollection(node)) {
5753
- path24 = Object.freeze(path24.concat(node));
5753
+ path25 = Object.freeze(path25.concat(node));
5754
5754
  for (let i = 0; i < node.items.length; ++i) {
5755
- const ci2 = visit_(i, node.items[i], visitor, path24);
5755
+ const ci2 = visit_(i, node.items[i], visitor, path25);
5756
5756
  if (typeof ci2 === "number")
5757
5757
  i = ci2 - 1;
5758
5758
  else if (ci2 === BREAK)
@@ -5763,13 +5763,13 @@ var require_visit = __commonJS({
5763
5763
  }
5764
5764
  }
5765
5765
  } else if (identity.isPair(node)) {
5766
- path24 = Object.freeze(path24.concat(node));
5767
- const ck = visit_("key", node.key, visitor, path24);
5766
+ path25 = Object.freeze(path25.concat(node));
5767
+ const ck = visit_("key", node.key, visitor, path25);
5768
5768
  if (ck === BREAK)
5769
5769
  return BREAK;
5770
5770
  else if (ck === REMOVE)
5771
5771
  node.key = null;
5772
- const cv = visit_("value", node.value, visitor, path24);
5772
+ const cv = visit_("value", node.value, visitor, path25);
5773
5773
  if (cv === BREAK)
5774
5774
  return BREAK;
5775
5775
  else if (cv === REMOVE)
@@ -5790,17 +5790,17 @@ var require_visit = __commonJS({
5790
5790
  visitAsync.BREAK = BREAK;
5791
5791
  visitAsync.SKIP = SKIP;
5792
5792
  visitAsync.REMOVE = REMOVE;
5793
- async function visitAsync_(key, node, visitor, path24) {
5794
- const ctrl = await callVisitor(key, node, visitor, path24);
5793
+ async function visitAsync_(key, node, visitor, path25) {
5794
+ const ctrl = await callVisitor(key, node, visitor, path25);
5795
5795
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
5796
- replaceNode(key, path24, ctrl);
5797
- return visitAsync_(key, ctrl, visitor, path24);
5796
+ replaceNode(key, path25, ctrl);
5797
+ return visitAsync_(key, ctrl, visitor, path25);
5798
5798
  }
5799
5799
  if (typeof ctrl !== "symbol") {
5800
5800
  if (identity.isCollection(node)) {
5801
- path24 = Object.freeze(path24.concat(node));
5801
+ path25 = Object.freeze(path25.concat(node));
5802
5802
  for (let i = 0; i < node.items.length; ++i) {
5803
- const ci2 = await visitAsync_(i, node.items[i], visitor, path24);
5803
+ const ci2 = await visitAsync_(i, node.items[i], visitor, path25);
5804
5804
  if (typeof ci2 === "number")
5805
5805
  i = ci2 - 1;
5806
5806
  else if (ci2 === BREAK)
@@ -5811,13 +5811,13 @@ var require_visit = __commonJS({
5811
5811
  }
5812
5812
  }
5813
5813
  } else if (identity.isPair(node)) {
5814
- path24 = Object.freeze(path24.concat(node));
5815
- const ck = await visitAsync_("key", node.key, visitor, path24);
5814
+ path25 = Object.freeze(path25.concat(node));
5815
+ const ck = await visitAsync_("key", node.key, visitor, path25);
5816
5816
  if (ck === BREAK)
5817
5817
  return BREAK;
5818
5818
  else if (ck === REMOVE)
5819
5819
  node.key = null;
5820
- const cv = await visitAsync_("value", node.value, visitor, path24);
5820
+ const cv = await visitAsync_("value", node.value, visitor, path25);
5821
5821
  if (cv === BREAK)
5822
5822
  return BREAK;
5823
5823
  else if (cv === REMOVE)
@@ -5844,23 +5844,23 @@ var require_visit = __commonJS({
5844
5844
  }
5845
5845
  return visitor;
5846
5846
  }
5847
- function callVisitor(key, node, visitor, path24) {
5847
+ function callVisitor(key, node, visitor, path25) {
5848
5848
  if (typeof visitor === "function")
5849
- return visitor(key, node, path24);
5849
+ return visitor(key, node, path25);
5850
5850
  if (identity.isMap(node))
5851
- return visitor.Map?.(key, node, path24);
5851
+ return visitor.Map?.(key, node, path25);
5852
5852
  if (identity.isSeq(node))
5853
- return visitor.Seq?.(key, node, path24);
5853
+ return visitor.Seq?.(key, node, path25);
5854
5854
  if (identity.isPair(node))
5855
- return visitor.Pair?.(key, node, path24);
5855
+ return visitor.Pair?.(key, node, path25);
5856
5856
  if (identity.isScalar(node))
5857
- return visitor.Scalar?.(key, node, path24);
5857
+ return visitor.Scalar?.(key, node, path25);
5858
5858
  if (identity.isAlias(node))
5859
- return visitor.Alias?.(key, node, path24);
5859
+ return visitor.Alias?.(key, node, path25);
5860
5860
  return void 0;
5861
5861
  }
5862
- function replaceNode(key, path24, node) {
5863
- const parent = path24[path24.length - 1];
5862
+ function replaceNode(key, path25, node) {
5863
+ const parent = path25[path25.length - 1];
5864
5864
  if (identity.isCollection(parent)) {
5865
5865
  parent.items[key] = node;
5866
5866
  } else if (identity.isPair(parent)) {
@@ -6468,10 +6468,10 @@ var require_Collection = __commonJS({
6468
6468
  var createNode = require_createNode();
6469
6469
  var identity = require_identity();
6470
6470
  var Node = require_Node();
6471
- function collectionFromPath(schema, path24, value) {
6471
+ function collectionFromPath(schema, path25, value) {
6472
6472
  let v2 = value;
6473
- for (let i = path24.length - 1; i >= 0; --i) {
6474
- const k2 = path24[i];
6473
+ for (let i = path25.length - 1; i >= 0; --i) {
6474
+ const k2 = path25[i];
6475
6475
  if (typeof k2 === "number" && Number.isInteger(k2) && k2 >= 0) {
6476
6476
  const a = [];
6477
6477
  a[k2] = v2;
@@ -6490,7 +6490,7 @@ var require_Collection = __commonJS({
6490
6490
  sourceObjects: /* @__PURE__ */ new Map()
6491
6491
  });
6492
6492
  }
6493
- var isEmptyPath = (path24) => path24 == null || typeof path24 === "object" && !!path24[Symbol.iterator]().next().done;
6493
+ var isEmptyPath = (path25) => path25 == null || typeof path25 === "object" && !!path25[Symbol.iterator]().next().done;
6494
6494
  var Collection = class extends Node.NodeBase {
6495
6495
  constructor(type, schema) {
6496
6496
  super(type);
@@ -6520,11 +6520,11 @@ var require_Collection = __commonJS({
6520
6520
  * be a Pair instance or a `{ key, value }` object, which may not have a key
6521
6521
  * that already exists in the map.
6522
6522
  */
6523
- addIn(path24, value) {
6524
- if (isEmptyPath(path24))
6523
+ addIn(path25, value) {
6524
+ if (isEmptyPath(path25))
6525
6525
  this.add(value);
6526
6526
  else {
6527
- const [key, ...rest] = path24;
6527
+ const [key, ...rest] = path25;
6528
6528
  const node = this.get(key, true);
6529
6529
  if (identity.isCollection(node))
6530
6530
  node.addIn(rest, value);
@@ -6538,8 +6538,8 @@ var require_Collection = __commonJS({
6538
6538
  * Removes a value from the collection.
6539
6539
  * @returns `true` if the item was found and removed.
6540
6540
  */
6541
- deleteIn(path24) {
6542
- const [key, ...rest] = path24;
6541
+ deleteIn(path25) {
6542
+ const [key, ...rest] = path25;
6543
6543
  if (rest.length === 0)
6544
6544
  return this.delete(key);
6545
6545
  const node = this.get(key, true);
@@ -6553,8 +6553,8 @@ var require_Collection = __commonJS({
6553
6553
  * scalar values from their surrounding node; to disable set `keepScalar` to
6554
6554
  * `true` (collections are always returned intact).
6555
6555
  */
6556
- getIn(path24, keepScalar) {
6557
- const [key, ...rest] = path24;
6556
+ getIn(path25, keepScalar) {
6557
+ const [key, ...rest] = path25;
6558
6558
  const node = this.get(key, true);
6559
6559
  if (rest.length === 0)
6560
6560
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -6572,8 +6572,8 @@ var require_Collection = __commonJS({
6572
6572
  /**
6573
6573
  * Checks if the collection includes a value with the key `key`.
6574
6574
  */
6575
- hasIn(path24) {
6576
- const [key, ...rest] = path24;
6575
+ hasIn(path25) {
6576
+ const [key, ...rest] = path25;
6577
6577
  if (rest.length === 0)
6578
6578
  return this.has(key);
6579
6579
  const node = this.get(key, true);
@@ -6583,8 +6583,8 @@ var require_Collection = __commonJS({
6583
6583
  * Sets a value in this collection. For `!!set`, `value` needs to be a
6584
6584
  * boolean to add/remove the item from the set.
6585
6585
  */
6586
- setIn(path24, value) {
6587
- const [key, ...rest] = path24;
6586
+ setIn(path25, value) {
6587
+ const [key, ...rest] = path25;
6588
6588
  if (rest.length === 0) {
6589
6589
  this.set(key, value);
6590
6590
  } else {
@@ -9096,9 +9096,9 @@ var require_Document = __commonJS({
9096
9096
  this.contents.add(value);
9097
9097
  }
9098
9098
  /** Adds a value to the document. */
9099
- addIn(path24, value) {
9099
+ addIn(path25, value) {
9100
9100
  if (assertCollection(this.contents))
9101
- this.contents.addIn(path24, value);
9101
+ this.contents.addIn(path25, value);
9102
9102
  }
9103
9103
  /**
9104
9104
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -9173,14 +9173,14 @@ var require_Document = __commonJS({
9173
9173
  * Removes a value from the document.
9174
9174
  * @returns `true` if the item was found and removed.
9175
9175
  */
9176
- deleteIn(path24) {
9177
- if (Collection.isEmptyPath(path24)) {
9176
+ deleteIn(path25) {
9177
+ if (Collection.isEmptyPath(path25)) {
9178
9178
  if (this.contents == null)
9179
9179
  return false;
9180
9180
  this.contents = null;
9181
9181
  return true;
9182
9182
  }
9183
- return assertCollection(this.contents) ? this.contents.deleteIn(path24) : false;
9183
+ return assertCollection(this.contents) ? this.contents.deleteIn(path25) : false;
9184
9184
  }
9185
9185
  /**
9186
9186
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -9195,10 +9195,10 @@ var require_Document = __commonJS({
9195
9195
  * scalar values from their surrounding node; to disable set `keepScalar` to
9196
9196
  * `true` (collections are always returned intact).
9197
9197
  */
9198
- getIn(path24, keepScalar) {
9199
- if (Collection.isEmptyPath(path24))
9198
+ getIn(path25, keepScalar) {
9199
+ if (Collection.isEmptyPath(path25))
9200
9200
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
9201
- return identity.isCollection(this.contents) ? this.contents.getIn(path24, keepScalar) : void 0;
9201
+ return identity.isCollection(this.contents) ? this.contents.getIn(path25, keepScalar) : void 0;
9202
9202
  }
9203
9203
  /**
9204
9204
  * Checks if the document includes a value with the key `key`.
@@ -9209,10 +9209,10 @@ var require_Document = __commonJS({
9209
9209
  /**
9210
9210
  * Checks if the document includes a value at `path`.
9211
9211
  */
9212
- hasIn(path24) {
9213
- if (Collection.isEmptyPath(path24))
9212
+ hasIn(path25) {
9213
+ if (Collection.isEmptyPath(path25))
9214
9214
  return this.contents !== void 0;
9215
- return identity.isCollection(this.contents) ? this.contents.hasIn(path24) : false;
9215
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path25) : false;
9216
9216
  }
9217
9217
  /**
9218
9218
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -9229,13 +9229,13 @@ var require_Document = __commonJS({
9229
9229
  * Sets a value in this document. For `!!set`, `value` needs to be a
9230
9230
  * boolean to add/remove the item from the set.
9231
9231
  */
9232
- setIn(path24, value) {
9233
- if (Collection.isEmptyPath(path24)) {
9232
+ setIn(path25, value) {
9233
+ if (Collection.isEmptyPath(path25)) {
9234
9234
  this.contents = value;
9235
9235
  } else if (this.contents == null) {
9236
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path24), value);
9236
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path25), value);
9237
9237
  } else if (assertCollection(this.contents)) {
9238
- this.contents.setIn(path24, value);
9238
+ this.contents.setIn(path25, value);
9239
9239
  }
9240
9240
  }
9241
9241
  /**
@@ -11192,9 +11192,9 @@ var require_cst_visit = __commonJS({
11192
11192
  visit.BREAK = BREAK;
11193
11193
  visit.SKIP = SKIP;
11194
11194
  visit.REMOVE = REMOVE;
11195
- visit.itemAtPath = (cst, path24) => {
11195
+ visit.itemAtPath = (cst, path25) => {
11196
11196
  let item = cst;
11197
- for (const [field, index] of path24) {
11197
+ for (const [field, index] of path25) {
11198
11198
  const tok = item?.[field];
11199
11199
  if (tok && "items" in tok) {
11200
11200
  item = tok.items[index];
@@ -11203,23 +11203,23 @@ var require_cst_visit = __commonJS({
11203
11203
  }
11204
11204
  return item;
11205
11205
  };
11206
- visit.parentCollection = (cst, path24) => {
11207
- const parent = visit.itemAtPath(cst, path24.slice(0, -1));
11208
- const field = path24[path24.length - 1][0];
11206
+ visit.parentCollection = (cst, path25) => {
11207
+ const parent = visit.itemAtPath(cst, path25.slice(0, -1));
11208
+ const field = path25[path25.length - 1][0];
11209
11209
  const coll = parent?.[field];
11210
11210
  if (coll && "items" in coll)
11211
11211
  return coll;
11212
11212
  throw new Error("Parent collection not found");
11213
11213
  };
11214
- function _visit(path24, item, visitor) {
11215
- let ctrl = visitor(item, path24);
11214
+ function _visit(path25, item, visitor) {
11215
+ let ctrl = visitor(item, path25);
11216
11216
  if (typeof ctrl === "symbol")
11217
11217
  return ctrl;
11218
11218
  for (const field of ["key", "value"]) {
11219
11219
  const token = item[field];
11220
11220
  if (token && "items" in token) {
11221
11221
  for (let i = 0; i < token.items.length; ++i) {
11222
- const ci2 = _visit(Object.freeze(path24.concat([[field, i]])), token.items[i], visitor);
11222
+ const ci2 = _visit(Object.freeze(path25.concat([[field, i]])), token.items[i], visitor);
11223
11223
  if (typeof ci2 === "number")
11224
11224
  i = ci2 - 1;
11225
11225
  else if (ci2 === BREAK)
@@ -11230,10 +11230,10 @@ var require_cst_visit = __commonJS({
11230
11230
  }
11231
11231
  }
11232
11232
  if (typeof ctrl === "function" && field === "key")
11233
- ctrl = ctrl(item, path24);
11233
+ ctrl = ctrl(item, path25);
11234
11234
  }
11235
11235
  }
11236
- return typeof ctrl === "function" ? ctrl(item, path24) : ctrl;
11236
+ return typeof ctrl === "function" ? ctrl(item, path25) : ctrl;
11237
11237
  }
11238
11238
  exports2.visit = visit;
11239
11239
  }
@@ -12518,14 +12518,14 @@ var require_parser = __commonJS({
12518
12518
  case "scalar":
12519
12519
  case "single-quoted-scalar":
12520
12520
  case "double-quoted-scalar": {
12521
- const fs12 = this.flowScalar(this.type);
12521
+ const fs13 = this.flowScalar(this.type);
12522
12522
  if (atNextItem || it2.value) {
12523
- map2.items.push({ start, key: fs12, sep: [] });
12523
+ map2.items.push({ start, key: fs13, sep: [] });
12524
12524
  this.onKeyLine = true;
12525
12525
  } else if (it2.sep) {
12526
- this.stack.push(fs12);
12526
+ this.stack.push(fs13);
12527
12527
  } else {
12528
- Object.assign(it2, { key: fs12, sep: [] });
12528
+ Object.assign(it2, { key: fs13, sep: [] });
12529
12529
  this.onKeyLine = true;
12530
12530
  }
12531
12531
  return;
@@ -12653,13 +12653,13 @@ var require_parser = __commonJS({
12653
12653
  case "scalar":
12654
12654
  case "single-quoted-scalar":
12655
12655
  case "double-quoted-scalar": {
12656
- const fs12 = this.flowScalar(this.type);
12656
+ const fs13 = this.flowScalar(this.type);
12657
12657
  if (!it2 || it2.value)
12658
- fc.items.push({ start: [], key: fs12, sep: [] });
12658
+ fc.items.push({ start: [], key: fs13, sep: [] });
12659
12659
  else if (it2.sep)
12660
- this.stack.push(fs12);
12660
+ this.stack.push(fs13);
12661
12661
  else
12662
- Object.assign(it2, { key: fs12, sep: [] });
12662
+ Object.assign(it2, { key: fs13, sep: [] });
12663
12663
  return;
12664
12664
  }
12665
12665
  case "flow-map-end":
@@ -15801,13 +15801,60 @@ function baseVisible(segment) {
15801
15801
  function isZeroWidthCluster(segment) {
15802
15802
  return zeroWidthClusterRegex.test(segment);
15803
15803
  }
15804
- function trailingHalfwidthWidth(segment, eastAsianWidthOptions) {
15805
- let extra = 0;
15806
- if (segment.length > 1) {
15807
- for (const char of segment.slice(1)) {
15808
- if (char >= "\uFF00" && char <= "\uFFEF") {
15809
- extra += eastAsianWidth(char.codePointAt(0), eastAsianWidthOptions);
15804
+ function isHangulLeadingJamo(codePoint) {
15805
+ return codePoint >= 4352 && codePoint <= 4447 || codePoint >= 43360 && codePoint <= 43388;
15806
+ }
15807
+ function isHangulVowelJamo(codePoint) {
15808
+ return codePoint >= 4448 && codePoint <= 4519 || codePoint >= 55216 && codePoint <= 55238;
15809
+ }
15810
+ function isHangulTrailingJamo(codePoint) {
15811
+ return codePoint >= 4520 && codePoint <= 4607 || codePoint >= 55243 && codePoint <= 55291;
15812
+ }
15813
+ function isHangulJamo(codePoint) {
15814
+ return isHangulLeadingJamo(codePoint) || isHangulVowelJamo(codePoint) || isHangulTrailingJamo(codePoint);
15815
+ }
15816
+ function hangulClusterWidth(visibleSegment, eastAsianWidthOptions) {
15817
+ const codePoints = [];
15818
+ for (const character of visibleSegment) {
15819
+ if (zeroWidthClusterRegex.test(character)) {
15820
+ continue;
15821
+ }
15822
+ codePoints.push(character.codePointAt(0));
15823
+ }
15824
+ if (codePoints.length === 0) {
15825
+ return void 0;
15826
+ }
15827
+ let width = 0;
15828
+ for (let index = 0; index < codePoints.length; index++) {
15829
+ const codePoint = codePoints[index];
15830
+ if (!isHangulJamo(codePoint)) {
15831
+ if (width === 0) {
15832
+ return void 0;
15810
15833
  }
15834
+ for (let remaining = index; remaining < codePoints.length; remaining++) {
15835
+ width += eastAsianWidth(codePoints[remaining], eastAsianWidthOptions);
15836
+ }
15837
+ return width;
15838
+ }
15839
+ if (isHangulLeadingJamo(codePoint) && isHangulVowelJamo(codePoints[index + 1])) {
15840
+ width += 2;
15841
+ index += isHangulTrailingJamo(codePoints[index + 2]) ? 2 : 1;
15842
+ continue;
15843
+ }
15844
+ width += eastAsianWidth(codePoint, eastAsianWidthOptions);
15845
+ }
15846
+ return width;
15847
+ }
15848
+ function trailingHalfwidthWidth(visibleSegment, eastAsianWidthOptions) {
15849
+ let extra = 0;
15850
+ let first = true;
15851
+ for (const character of visibleSegment) {
15852
+ if (first) {
15853
+ first = false;
15854
+ continue;
15855
+ }
15856
+ if (character >= "\uFF00" && character <= "\uFFEF") {
15857
+ extra += eastAsianWidth(character.codePointAt(0), eastAsianWidthOptions);
15811
15858
  }
15812
15859
  }
15813
15860
  return extra;
@@ -15840,9 +15887,15 @@ function stringWidth2(input, options = {}) {
15840
15887
  width += 2;
15841
15888
  continue;
15842
15889
  }
15843
- const codePoint = baseVisible(segment).codePointAt(0);
15890
+ const visibleSegment = baseVisible(segment);
15891
+ const hangulWidth = hangulClusterWidth(visibleSegment, eastAsianWidthOptions);
15892
+ if (hangulWidth !== void 0) {
15893
+ width += hangulWidth;
15894
+ continue;
15895
+ }
15896
+ const codePoint = visibleSegment.codePointAt(0);
15844
15897
  width += eastAsianWidth(codePoint, eastAsianWidthOptions);
15845
- width += trailingHalfwidthWidth(segment, eastAsianWidthOptions);
15898
+ width += trailingHalfwidthWidth(visibleSegment, eastAsianWidthOptions);
15846
15899
  }
15847
15900
  return width;
15848
15901
  }
@@ -19260,8 +19313,8 @@ var init_supermemory = __esm({
19260
19313
  /**
19261
19314
  * Make a fetch request to the Supermemory API
19262
19315
  */
19263
- async fetch(path24, options) {
19264
- const url2 = `${this.endpoint}${path24}`;
19316
+ async fetch(path25, options) {
19317
+ const url2 = `${this.endpoint}${path25}`;
19265
19318
  const controller = new AbortController();
19266
19319
  const timeoutId = setTimeout(() => controller.abort(), this.timeout);
19267
19320
  try {
@@ -20243,11 +20296,13 @@ __export(index_exports, {
20243
20296
  createWorkflowRenderer: () => createWorkflowRenderer,
20244
20297
  customStepsFileExists: () => customStepsFileExists,
20245
20298
  detectCompletion: () => detectCompletion,
20299
+ ensureLocalSdkWorkflowRuntime: () => ensureLocalSdkWorkflowRuntime,
20246
20300
  estimateContextTokens: () => estimateContextTokens,
20247
20301
  estimateTokens: () => estimateTokens,
20248
20302
  execCustomVerification: () => execCustomVerification,
20249
20303
  executeApiStep: () => executeApiStep,
20250
20304
  findGitRoot: () => findGitRoot,
20305
+ findLocalSdkWorkspace: () => findLocalSdkWorkspace,
20251
20306
  findRelayPtyBinary: () => findRelayPtyBinary,
20252
20307
  followLogs: () => followLogs,
20253
20308
  formatDryRunReport: () => formatDryRunReport,
@@ -20257,6 +20312,7 @@ __export(index_exports, {
20257
20312
  formatResultMessage: () => formatResultMessage,
20258
20313
  formatRunSummaryTable: () => formatRunSummaryTable,
20259
20314
  formatStepOutput: () => formatStepOutput,
20315
+ formatWorkflowParseError: () => formatWorkflowParseError,
20260
20316
  generateAgentName: () => generateAgentName,
20261
20317
  generateErrorId: () => generateErrorId,
20262
20318
  generateRequestId: () => generateRequestId,
@@ -20313,6 +20369,7 @@ __export(index_exports, {
20313
20369
  parseMessages: () => parseMessages,
20314
20370
  parseProposalCommand: () => parseProposalCommand,
20315
20371
  parseSpawnEnv: () => parseSpawnEnv,
20372
+ parseTsxStderr: () => parseTsxStderr,
20316
20373
  parseVoteCommand: () => parseVoteCommand,
20317
20374
  printUpdateNotification: () => printUpdateNotification,
20318
20375
  readInbox: () => readInbox,
@@ -20332,6 +20389,7 @@ __export(index_exports, {
20332
20389
  resolveTemplateForShell: () => resolveTemplateForShell,
20333
20390
  resolveVariables: () => resolveVariables,
20334
20391
  routerLog: () => routerLog,
20392
+ runScriptWorkflow: () => runScriptWorkflow,
20335
20393
  runVerification: () => runVerification,
20336
20394
  runWorkflow: () => runWorkflow,
20337
20395
  scrubForChannel: () => scrubForChannel,
@@ -20407,7 +20465,7 @@ var BrokerTransport = class {
20407
20465
  return this.baseUrl.replace(/^http/, "ws") + "/ws";
20408
20466
  }
20409
20467
  // ── HTTP ─────────────────────────────────────────────────────────────
20410
- async request(path24, init) {
20468
+ async request(path25, init) {
20411
20469
  const headers = new Headers(init?.headers);
20412
20470
  if (!headers.has("Content-Type")) {
20413
20471
  headers.set("Content-Type", "application/json");
@@ -20416,7 +20474,7 @@ var BrokerTransport = class {
20416
20474
  headers.set("X-API-Key", this.apiKey);
20417
20475
  }
20418
20476
  const signal = init?.signal ?? AbortSignal.timeout(this.requestTimeoutMs);
20419
- const res = await fetch(`${this.baseUrl}${path24}`, { ...init, headers, signal });
20477
+ const res = await fetch(`${this.baseUrl}${path25}`, { ...init, headers, signal });
20420
20478
  if (!res.ok) {
20421
20479
  let body;
20422
20480
  try {
@@ -21736,8 +21794,8 @@ function getErrorMap() {
21736
21794
 
21737
21795
  // node_modules/zod/v3/helpers/parseUtil.js
21738
21796
  var makeIssue = (params) => {
21739
- const { data, path: path24, errorMaps, issueData } = params;
21740
- const fullPath = [...path24, ...issueData.path || []];
21797
+ const { data, path: path25, errorMaps, issueData } = params;
21798
+ const fullPath = [...path25, ...issueData.path || []];
21741
21799
  const fullIssue = {
21742
21800
  ...issueData,
21743
21801
  path: fullPath
@@ -21853,11 +21911,11 @@ var errorUtil;
21853
21911
 
21854
21912
  // node_modules/zod/v3/types.js
21855
21913
  var ParseInputLazyPath = class {
21856
- constructor(parent, value, path24, key) {
21914
+ constructor(parent, value, path25, key) {
21857
21915
  this._cachedPath = [];
21858
21916
  this.parent = parent;
21859
21917
  this.data = value;
21860
- this._path = path24;
21918
+ this._path = path25;
21861
21919
  this._key = key;
21862
21920
  }
21863
21921
  get path() {
@@ -28364,10 +28422,10 @@ function mergeDefs(...defs) {
28364
28422
  function cloneDef(schema) {
28365
28423
  return mergeDefs(schema._zod.def);
28366
28424
  }
28367
- function getElementAtPath(obj, path24) {
28368
- if (!path24)
28425
+ function getElementAtPath(obj, path25) {
28426
+ if (!path25)
28369
28427
  return obj;
28370
- return path24.reduce((acc, key) => acc?.[key], obj);
28428
+ return path25.reduce((acc, key) => acc?.[key], obj);
28371
28429
  }
28372
28430
  function promiseAllObject(promisesObj) {
28373
28431
  const keys = Object.keys(promisesObj);
@@ -28750,11 +28808,11 @@ function aborted(x, startIndex = 0) {
28750
28808
  }
28751
28809
  return false;
28752
28810
  }
28753
- function prefixIssues(path24, issues) {
28811
+ function prefixIssues(path25, issues) {
28754
28812
  return issues.map((iss) => {
28755
28813
  var _a2;
28756
28814
  (_a2 = iss).path ?? (_a2.path = []);
28757
- iss.path.unshift(path24);
28815
+ iss.path.unshift(path25);
28758
28816
  return iss;
28759
28817
  });
28760
28818
  }
@@ -28937,7 +28995,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
28937
28995
  }
28938
28996
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
28939
28997
  const result = { errors: [] };
28940
- const processError = (error49, path24 = []) => {
28998
+ const processError = (error49, path25 = []) => {
28941
28999
  var _a2, _b;
28942
29000
  for (const issue2 of error49.issues) {
28943
29001
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -28947,7 +29005,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
28947
29005
  } else if (issue2.code === "invalid_element") {
28948
29006
  processError({ issues: issue2.issues }, issue2.path);
28949
29007
  } else {
28950
- const fullpath = [...path24, ...issue2.path];
29008
+ const fullpath = [...path25, ...issue2.path];
28951
29009
  if (fullpath.length === 0) {
28952
29010
  result.errors.push(mapper(issue2));
28953
29011
  continue;
@@ -28979,8 +29037,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
28979
29037
  }
28980
29038
  function toDotPath(_path) {
28981
29039
  const segs = [];
28982
- const path24 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
28983
- for (const seg of path24) {
29040
+ const path25 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
29041
+ for (const seg of path25) {
28984
29042
  if (typeof seg === "number")
28985
29043
  segs.push(`[${seg}]`);
28986
29044
  else if (typeof seg === "symbol")
@@ -40957,13 +41015,13 @@ function resolveRef(ref, ctx) {
40957
41015
  if (!ref.startsWith("#")) {
40958
41016
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
40959
41017
  }
40960
- const path24 = ref.slice(1).split("/").filter(Boolean);
40961
- if (path24.length === 0) {
41018
+ const path25 = ref.slice(1).split("/").filter(Boolean);
41019
+ if (path25.length === 0) {
40962
41020
  return ctx.rootSchema;
40963
41021
  }
40964
41022
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
40965
- if (path24[0] === defsKey) {
40966
- const key = path24[1];
41023
+ if (path25[0] === defsKey) {
41024
+ const key = path25[1];
40967
41025
  if (!key || !ctx.defs[key]) {
40968
41026
  throw new Error(`Reference not found: ${ref}`);
40969
41027
  }
@@ -43120,8 +43178,8 @@ var HttpClient = class _HttpClient {
43120
43178
  version: this._originVersion
43121
43179
  }));
43122
43180
  }
43123
- async request(method, path24, body, query, options) {
43124
- const url2 = new URL(path24, this._baseUrl);
43181
+ async request(method, path25, body, query, options) {
43182
+ const url2 = new URL(path25, this._baseUrl);
43125
43183
  if (query) {
43126
43184
  for (const [k2, v2] of Object.entries(query)) {
43127
43185
  if (v2 !== void 0)
@@ -43191,20 +43249,20 @@ var HttpClient = class _HttpClient {
43191
43249
  return camelizeKeys(parsedData);
43192
43250
  }
43193
43251
  }
43194
- get(path24, query, options) {
43195
- return this.request("GET", path24, void 0, query, options);
43252
+ get(path25, query, options) {
43253
+ return this.request("GET", path25, void 0, query, options);
43196
43254
  }
43197
- post(path24, body, options) {
43198
- return this.request("POST", path24, body, void 0, options);
43255
+ post(path25, body, options) {
43256
+ return this.request("POST", path25, body, void 0, options);
43199
43257
  }
43200
- patch(path24, body, options) {
43201
- return this.request("PATCH", path24, body, void 0, options);
43258
+ patch(path25, body, options) {
43259
+ return this.request("PATCH", path25, body, void 0, options);
43202
43260
  }
43203
- put(path24, body, options) {
43204
- return this.request("PUT", path24, body, void 0, options);
43261
+ put(path25, body, options) {
43262
+ return this.request("PUT", path25, body, void 0, options);
43205
43263
  }
43206
- async delete(path24, options) {
43207
- await this.request("DELETE", path24, void 0, void 0, options);
43264
+ async delete(path25, options) {
43265
+ await this.request("DELETE", path25, void 0, void 0, options);
43208
43266
  }
43209
43267
  };
43210
43268
 
@@ -45896,6 +45954,23 @@ var RelayAdapter = class {
45896
45954
  }
45897
45955
  };
45898
45956
 
45957
+ // packages/workflow-types/src/index.ts
45958
+ function isDeterministicStep(step) {
45959
+ return step.type === "deterministic";
45960
+ }
45961
+ function isWorktreeStep(step) {
45962
+ return step.type === "worktree";
45963
+ }
45964
+ function isIntegrationStep(step) {
45965
+ return step.type === "integration";
45966
+ }
45967
+ function isCustomStep(step) {
45968
+ return step.use !== void 0;
45969
+ }
45970
+ function isAgentStep(step) {
45971
+ return step.type !== "deterministic" && step.type !== "worktree" && step.type !== "integration";
45972
+ }
45973
+
45899
45974
  // packages/sdk/dist/workflows/types.js
45900
45975
  function isRestrictedAgent(agent) {
45901
45976
  const perms = agent.permissions;
@@ -45913,21 +45988,6 @@ function isRestrictedAgent(agent) {
45913
45988
  return true;
45914
45989
  return false;
45915
45990
  }
45916
- function isDeterministicStep(step) {
45917
- return step.type === "deterministic";
45918
- }
45919
- function isWorktreeStep(step) {
45920
- return step.type === "worktree";
45921
- }
45922
- function isIntegrationStep(step) {
45923
- return step.type === "integration";
45924
- }
45925
- function isCustomStep(step) {
45926
- return step.use !== void 0;
45927
- }
45928
- function isAgentStep(step) {
45929
- return step.type !== "deterministic" && step.type !== "worktree" && step.type !== "integration";
45930
- }
45931
45991
 
45932
45992
  // packages/sdk/dist/workflows/runner.js
45933
45993
  var import_node_child_process8 = require("node:child_process");
@@ -46194,9 +46254,9 @@ async function resolveCli(cli) {
46194
46254
  for (const binary of def.binaries) {
46195
46255
  try {
46196
46256
  const { stdout } = await execFileAsync("which", [binary]);
46197
- const path24 = stdout.trim();
46198
- if (path24) {
46199
- const result = { binary, path: path24 };
46257
+ const path25 = stdout.trim();
46258
+ if (path25) {
46259
+ const result = { binary, path: path25 };
46200
46260
  resolveCache.set(cli, result);
46201
46261
  return result;
46202
46262
  }
@@ -46229,13 +46289,13 @@ function resolveCliSync(cli) {
46229
46289
  const def = getCliDefinition(cli);
46230
46290
  if (!def)
46231
46291
  return void 0;
46232
- const { execFileSync: execFileSync2 } = require("node:child_process");
46292
+ const { execFileSync: execFileSync3 } = require("node:child_process");
46233
46293
  for (const binary of def.binaries) {
46234
46294
  try {
46235
- const stdout = execFileSync2("which", [binary], { stdio: ["pipe", "pipe", "ignore"] });
46236
- const path24 = stdout.toString().trim();
46237
- if (path24) {
46238
- const result = { binary, path: path24 };
46295
+ const stdout = execFileSync3("which", [binary], { stdio: ["pipe", "pipe", "ignore"] });
46296
+ const path25 = stdout.toString().trim();
46297
+ if (path25) {
46298
+ const result = { binary, path: path25 };
46239
46299
  resolveCache.set(cli, result);
46240
46300
  return result;
46241
46301
  }
@@ -47540,8 +47600,8 @@ var RelayFileClient = class {
47540
47600
  signal: options.signal
47541
47601
  });
47542
47602
  }
47543
- async readFile(workspaceId, path24, correlationId, signal) {
47544
- const query = buildQuery({ path: path24 });
47603
+ async readFile(workspaceId, path25, correlationId, signal) {
47604
+ const query = buildQuery({ path: path25 });
47545
47605
  return this.request({
47546
47606
  method: "GET",
47547
47607
  path: `/v1/workspaces/${encodeURIComponent(workspaceId)}/fs/file${query}`,
@@ -47582,8 +47642,8 @@ var RelayFileClient = class {
47582
47642
  });
47583
47643
  }
47584
47644
  async writeFile(input) {
47585
- const { workspaceId, path: path24, correlationId, baseRevision, content, contentType, encoding, semantics, signal } = input;
47586
- const query = buildQuery({ path: path24 });
47645
+ const { workspaceId, path: path25, correlationId, baseRevision, content, contentType, encoding, semantics, signal } = input;
47646
+ const query = buildQuery({ path: path25 });
47587
47647
  return this.request({
47588
47648
  method: "PUT",
47589
47649
  path: `/v1/workspaces/${encodeURIComponent(workspaceId)}/fs/file${query}`,
@@ -54398,18 +54458,18 @@ function extractDecisions(trajectory2) {
54398
54458
  }
54399
54459
  return decisions;
54400
54460
  }
54401
- function expandPath(path24) {
54402
- if (path24.startsWith("~")) {
54403
- return (0, import_path4.join)(process.env.HOME ?? "", path24.slice(1));
54461
+ function expandPath(path25) {
54462
+ if (path25.startsWith("~")) {
54463
+ return (0, import_path4.join)(process.env.HOME ?? "", path25.slice(1));
54404
54464
  }
54405
- return path24;
54465
+ return path25;
54406
54466
  }
54407
54467
  var indexLocks = /* @__PURE__ */ new Map();
54408
- function withIndexLock(path24, task) {
54409
- const prev = indexLocks.get(path24) ?? Promise.resolve();
54468
+ function withIndexLock(path25, task) {
54469
+ const prev = indexLocks.get(path25) ?? Promise.resolve();
54410
54470
  const next = prev.then(task, task);
54411
54471
  indexLocks.set(
54412
- path24,
54472
+ path25,
54413
54473
  next.catch(() => void 0)
54414
54474
  );
54415
54475
  return next;
@@ -54565,8 +54625,8 @@ var FileStorage = class {
54565
54625
  const validation = validateTrajectory(input);
54566
54626
  if (!validation.success) {
54567
54627
  const issues = validation.errors?.issues.map((issue2) => {
54568
- const path24 = issue2.path.length > 0 ? issue2.path.join(".") : "root";
54569
- return `${path24}: ${issue2.message}`;
54628
+ const path25 = issue2.path.length > 0 ? issue2.path.join(".") : "root";
54629
+ return `${path25}: ${issue2.message}`;
54570
54630
  }).join("; ") ?? "unknown validation error";
54571
54631
  throw new Error(`Cannot save invalid trajectory: ${issues}`);
54572
54632
  }
@@ -54775,18 +54835,18 @@ var FileStorage = class {
54775
54835
  *
54776
54836
  * Does NOT log. Callers choose whether to warn, swallow, or throw.
54777
54837
  */
54778
- async readTrajectoryFile(path24) {
54838
+ async readTrajectoryFile(path25) {
54779
54839
  let content;
54780
54840
  try {
54781
- content = await (0, import_promises7.readFile)(path24, "utf-8");
54841
+ content = await (0, import_promises7.readFile)(path25, "utf-8");
54782
54842
  } catch (error48) {
54783
- return { ok: false, reason: "io_error", path: path24, error: error48 };
54843
+ return { ok: false, reason: "io_error", path: path25, error: error48 };
54784
54844
  }
54785
54845
  let data;
54786
54846
  try {
54787
54847
  data = JSON.parse(content);
54788
54848
  } catch (error48) {
54789
- return { ok: false, reason: "malformed_json", path: path24, error: error48 };
54849
+ return { ok: false, reason: "malformed_json", path: path25, error: error48 };
54790
54850
  }
54791
54851
  const validation = validateTrajectory(data);
54792
54852
  if (validation.success) {
@@ -54795,7 +54855,7 @@ var FileStorage = class {
54795
54855
  return {
54796
54856
  ok: false,
54797
54857
  reason: "schema_violation",
54798
- path: path24,
54858
+ path: path25,
54799
54859
  error: validation.errors
54800
54860
  };
54801
54861
  }
@@ -54804,8 +54864,8 @@ var FileStorage = class {
54804
54864
  * trajectory. Returns null for any failure and writes nothing to the
54805
54865
  * console — so nothing leaks into test output or the CLI spinner.
54806
54866
  */
54807
- async readTrajectoryOrNull(path24) {
54808
- const result = await this.readTrajectoryFile(path24);
54867
+ async readTrajectoryOrNull(path25) {
54868
+ const result = await this.readTrajectoryFile(path25);
54809
54869
  return result.ok ? result.trajectory : null;
54810
54870
  }
54811
54871
  /**
@@ -62808,6 +62868,282 @@ function pythonVerifyCommand() {
62808
62868
  ].join("\n");
62809
62869
  }
62810
62870
 
62871
+ // packages/sdk/dist/workflows/run-script.js
62872
+ var import_node_fs23 = __toESM(require("node:fs"), 1);
62873
+ var import_node_path32 = __toESM(require("node:path"), 1);
62874
+ var import_node_child_process9 = require("node:child_process");
62875
+ function diag(msg) {
62876
+ try {
62877
+ process.stderr.write(`[agent-relay] ${msg}
62878
+ `);
62879
+ } catch {
62880
+ try {
62881
+ process.stdout.write(`[agent-relay] ${msg}
62882
+ `);
62883
+ } catch {
62884
+ }
62885
+ }
62886
+ }
62887
+ function findLocalSdkWorkspace(startDir) {
62888
+ let current = import_node_path32.default.resolve(startDir);
62889
+ const root = import_node_path32.default.parse(current).root;
62890
+ while (true) {
62891
+ const packageJsonPath = import_node_path32.default.join(current, "package.json");
62892
+ const sdkDir = import_node_path32.default.join(current, "packages", "sdk");
62893
+ const sdkPackageJsonPath = import_node_path32.default.join(sdkDir, "package.json");
62894
+ try {
62895
+ if (import_node_fs23.default.existsSync(packageJsonPath) && import_node_fs23.default.existsSync(sdkPackageJsonPath)) {
62896
+ const pkg = JSON.parse(import_node_fs23.default.readFileSync(packageJsonPath, "utf8"));
62897
+ const sdkPkg = JSON.parse(import_node_fs23.default.readFileSync(sdkPackageJsonPath, "utf8"));
62898
+ if (pkg.name === "agent-relay" && sdkPkg.name === "@agent-relay/sdk") {
62899
+ return { rootDir: current, sdkDir };
62900
+ }
62901
+ }
62902
+ } catch {
62903
+ }
62904
+ if (current === root)
62905
+ return null;
62906
+ current = import_node_path32.default.dirname(current);
62907
+ }
62908
+ }
62909
+ function ensureLocalSdkWorkflowRuntime(startDir, execRunner = import_node_child_process9.execFileSync) {
62910
+ const workspace = findLocalSdkWorkspace(startDir);
62911
+ if (!workspace)
62912
+ return;
62913
+ const workflowsEntry = import_node_path32.default.join(workspace.sdkDir, "dist", "workflows", "index.js");
62914
+ if (import_node_fs23.default.existsSync(workflowsEntry))
62915
+ return;
62916
+ console.log("[agent-relay] Detected local @agent-relay/sdk workspace without built workflows runtime; building packages/sdk...");
62917
+ execRunner("npm", ["run", "build:sdk"], {
62918
+ cwd: workspace.rootDir,
62919
+ stdio: "inherit",
62920
+ env: process.env
62921
+ });
62922
+ if (!import_node_fs23.default.existsSync(workflowsEntry)) {
62923
+ throw new Error(`Local SDK workflows runtime is still missing after build: ${workflowsEntry}`);
62924
+ }
62925
+ }
62926
+ function parseTsxStderr(stderr) {
62927
+ const clean = stderr.replace(/\x1b\[[0-9;]*m/g, "");
62928
+ const inlineMatch = clean.match(/(\/[^\s:]+\.(?:ts|tsx|mts|cts)):(\d+):(\d+):\s*ERROR:\s*([^\n]+)/);
62929
+ if (inlineMatch) {
62930
+ return {
62931
+ file: inlineMatch[1],
62932
+ line: Number(inlineMatch[2]),
62933
+ column: Number(inlineMatch[3]),
62934
+ message: inlineMatch[4].trim()
62935
+ };
62936
+ }
62937
+ const prettyError = clean.match(/✘\s*\[ERROR\]\s*([^\n]+)/);
62938
+ if (prettyError) {
62939
+ const locationMatch = clean.match(/(\/[^\s:]+\.(?:ts|tsx|mts|cts)):(\d+):(\d+):/);
62940
+ if (locationMatch) {
62941
+ return {
62942
+ file: locationMatch[1],
62943
+ line: Number(locationMatch[2]),
62944
+ column: Number(locationMatch[3]),
62945
+ message: prettyError[1].trim()
62946
+ };
62947
+ }
62948
+ }
62949
+ if (/Transform failed with \d+ error/i.test(clean) || /TransformError/.test(clean)) {
62950
+ const looseMatch = clean.match(/(\/[^\s:]+\.(?:ts|tsx|mts|cts)):(\d+):(\d+)/);
62951
+ if (looseMatch) {
62952
+ return {
62953
+ file: looseMatch[1],
62954
+ line: Number(looseMatch[2]),
62955
+ column: Number(looseMatch[3]),
62956
+ message: "TypeScript parse error (see tsx output above)"
62957
+ };
62958
+ }
62959
+ }
62960
+ return null;
62961
+ }
62962
+ function formatWorkflowParseError(parsed) {
62963
+ const where = parsed.line !== void 0 ? `${parsed.file}:${parsed.line}${parsed.column !== void 0 ? `:${parsed.column}` : ""}` : parsed.file;
62964
+ const hints = [];
62965
+ const text = parsed.message;
62966
+ if (/Expected "\}" but found/i.test(text) || /Unterminated template literal/i.test(text)) {
62967
+ hints.push("Likely a JavaScript template literal metacharacter inside a `command:` or `task:` block. Inside workflow .ts files every `command: \\`...\\`` is a JavaScript template literal \u2014 backticks terminate it and `${...}` triggers JS interpolation before the shell ever sees the string.", "Fixes: use single quotes instead of backticks in prose/commit messages; for shell variables use `$VAR` (no braces) or escape as `\\${VAR}`; never write literal `\\n` inside a shell comment (it becomes a real newline).");
62968
+ }
62969
+ if (/Unexpected "\$"/.test(text)) {
62970
+ hints.push("Unexpected `$` inside a template literal usually means `${...}` was interpreted as JS interpolation. Escape it as `\\${...}` or drop the braces and use plain `$VAR`.");
62971
+ }
62972
+ if (/Expected identifier/.test(text) && /template/i.test(text)) {
62973
+ hints.push("A template literal interpolation `${...}` needs a valid JS expression inside. If you meant a shell variable, escape the `$` or drop the braces.");
62974
+ }
62975
+ const lines = ["", `Workflow file failed to parse: ${where}`, ` ${text}`];
62976
+ if (parsed.lineText) {
62977
+ lines.push(` | ${parsed.lineText}`);
62978
+ if (parsed.column !== void 0 && parsed.column >= 0) {
62979
+ lines.push(` | ${" ".repeat(parsed.column)}^`);
62980
+ }
62981
+ }
62982
+ if (hints.length > 0) {
62983
+ lines.push("");
62984
+ for (const hint of hints) {
62985
+ lines.push(`Hint: ${hint}`);
62986
+ }
62987
+ }
62988
+ lines.push("");
62989
+ const wrapped = new Error(lines.join("\n"));
62990
+ wrapped.code = "WORKFLOW_PARSE_ERROR";
62991
+ return wrapped;
62992
+ }
62993
+ async function spawnRunnerWithStderrCapture(command, args, env) {
62994
+ return new Promise((resolve4) => {
62995
+ const child = (0, import_node_child_process9.spawn)(command, args, {
62996
+ stdio: ["inherit", "inherit", "pipe"],
62997
+ env
62998
+ });
62999
+ let stderrBuf = "";
63000
+ child.stderr?.on("data", (chunk) => {
63001
+ const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
63002
+ stderrBuf += text;
63003
+ try {
63004
+ process.stderr.write(text);
63005
+ } catch {
63006
+ }
63007
+ });
63008
+ child.on("error", (err) => {
63009
+ resolve4({ status: null, stderr: stderrBuf, error: err });
63010
+ });
63011
+ child.on("close", (status) => {
63012
+ resolve4({ status, stderr: stderrBuf });
63013
+ });
63014
+ });
63015
+ }
63016
+ async function runScriptWorkflow(filePath, options = {}) {
63017
+ diag(`runScriptWorkflow: resolving ${filePath}`);
63018
+ const resolved = import_node_path32.default.resolve(filePath);
63019
+ if (!import_node_fs23.default.existsSync(resolved)) {
63020
+ throw new Error(`File not found: ${resolved}`);
63021
+ }
63022
+ const ext = import_node_path32.default.extname(resolved).toLowerCase();
63023
+ const runIdFile = import_node_path32.default.join(process.cwd(), ".agent-relay", `script-run-id-${process.pid}-${Date.now()}.txt`);
63024
+ try {
63025
+ import_node_fs23.default.mkdirSync(import_node_path32.default.dirname(runIdFile), { recursive: true });
63026
+ } catch {
63027
+ }
63028
+ const childEnv = { ...process.env, AGENT_RELAY_RUN_ID_FILE: runIdFile };
63029
+ if (options.dryRun)
63030
+ childEnv.DRY_RUN = "true";
63031
+ if (options.resume)
63032
+ childEnv.RESUME_RUN_ID = options.resume;
63033
+ if (options.startFrom)
63034
+ childEnv.START_FROM = options.startFrom;
63035
+ if (options.previousRunId)
63036
+ childEnv.PREVIOUS_RUN_ID = options.previousRunId;
63037
+ const augmentErrorWithRunId = (err) => {
63038
+ try {
63039
+ if (import_node_fs23.default.existsSync(runIdFile)) {
63040
+ const runId = import_node_fs23.default.readFileSync(runIdFile, "utf8").trim();
63041
+ if (runId && typeof err?.message === "string" && !err.message.includes("Run ID:")) {
63042
+ err.message += `
63043
+ Run ID: ${runId}`;
63044
+ }
63045
+ }
63046
+ } catch {
63047
+ } finally {
63048
+ try {
63049
+ import_node_fs23.default.rmSync(runIdFile, { force: true });
63050
+ } catch {
63051
+ }
63052
+ }
63053
+ throw err;
63054
+ };
63055
+ const cleanupRunIdFile = () => {
63056
+ try {
63057
+ import_node_fs23.default.rmSync(runIdFile, { force: true });
63058
+ } catch {
63059
+ }
63060
+ };
63061
+ if (ext === ".ts" || ext === ".tsx") {
63062
+ diag("runScriptWorkflow: ensureLocalSdkWorkflowRuntime start");
63063
+ ensureLocalSdkWorkflowRuntime(import_node_path32.default.dirname(resolved));
63064
+ diag("runScriptWorkflow: ensureLocalSdkWorkflowRuntime done");
63065
+ const wrapRunnerError = (runner, result) => {
63066
+ const parsed = parseTsxStderr(result.stderr);
63067
+ if (parsed) {
63068
+ return formatWorkflowParseError(parsed);
63069
+ }
63070
+ return new Error(`${runner} exited with code ${result.status}`);
63071
+ };
63072
+ const runners = [
63073
+ {
63074
+ label: "node --experimental-strip-types",
63075
+ bin: "node",
63076
+ preArgs: ["--experimental-strip-types", "--no-warnings=ExperimentalWarning"]
63077
+ },
63078
+ { label: "tsx", bin: "tsx", preArgs: [] },
63079
+ { label: "ts-node", bin: "ts-node", preArgs: [] }
63080
+ ];
63081
+ for (const { label, bin, preArgs } of runners) {
63082
+ diag(`runScriptWorkflow: trying runner ${label}`);
63083
+ const result = await spawnRunnerWithStderrCapture(bin, [...preArgs, resolved], childEnv);
63084
+ if (result.error) {
63085
+ if (result.error.code === "ENOENT") {
63086
+ diag(`runScriptWorkflow: runner ${label} returned ENOENT \u2014 trying next`);
63087
+ continue;
63088
+ }
63089
+ return augmentErrorWithRunId(result.error);
63090
+ }
63091
+ if (result.status !== 0) {
63092
+ if (bin === "node" && result.status === 9) {
63093
+ diag(`runScriptWorkflow: runner ${label} unsupported on this Node (exit 9) \u2014 trying next`);
63094
+ continue;
63095
+ }
63096
+ return augmentErrorWithRunId(wrapRunnerError(label, result));
63097
+ }
63098
+ diag(`runScriptWorkflow: runner ${label} completed exit=0`);
63099
+ cleanupRunIdFile();
63100
+ return;
63101
+ }
63102
+ diag("runScriptWorkflow: falling back to npx tsx");
63103
+ const npxResult = await spawnRunnerWithStderrCapture("npx", ["tsx", resolved], childEnv);
63104
+ if (npxResult.error) {
63105
+ return augmentErrorWithRunId(npxResult.error);
63106
+ }
63107
+ if (npxResult.status !== 0) {
63108
+ return augmentErrorWithRunId(wrapRunnerError("npx tsx", npxResult));
63109
+ }
63110
+ diag("runScriptWorkflow: npx tsx completed");
63111
+ cleanupRunIdFile();
63112
+ return;
63113
+ }
63114
+ if (ext === ".py") {
63115
+ const runners = ["python3", "python"];
63116
+ for (const runner of runners) {
63117
+ diag(`runScriptWorkflow: trying runner ${runner}`);
63118
+ const spawnResult = (0, import_node_child_process9.spawnSync)(runner, [resolved], {
63119
+ stdio: "inherit",
63120
+ env: childEnv
63121
+ });
63122
+ if (spawnResult.error) {
63123
+ if (spawnResult.error.code === "ENOENT") {
63124
+ diag(`runScriptWorkflow: runner ${runner} returned ENOENT \u2014 trying next`);
63125
+ continue;
63126
+ }
63127
+ return augmentErrorWithRunId(spawnResult.error);
63128
+ }
63129
+ if (spawnResult.status !== 0) {
63130
+ const err = new Error(`${runner} exited with code ${spawnResult.status}`);
63131
+ return augmentErrorWithRunId(err);
63132
+ }
63133
+ diag(`runScriptWorkflow: runner ${runner} completed exit=0`);
63134
+ cleanupRunIdFile();
63135
+ return;
63136
+ }
63137
+ cleanupRunIdFile();
63138
+ throw new Error("Python not found. Install Python 3.10+ to run .py workflow files.");
63139
+ }
63140
+ try {
63141
+ import_node_fs23.default.rmSync(runIdFile, { force: true });
63142
+ } catch {
63143
+ }
63144
+ throw new Error(`Unsupported file type: ${ext}. Use .yaml, .yml, .ts, or .py`);
63145
+ }
63146
+
62811
63147
  // packages/utils/dist/name-generator.js
62812
63148
  var ADJECTIVES = [
62813
63149
  "Blue",
@@ -62959,8 +63295,8 @@ function isValidAgentName(name) {
62959
63295
  }
62960
63296
 
62961
63297
  // packages/utils/dist/logger.js
62962
- var import_node_fs23 = __toESM(require("node:fs"), 1);
62963
- var import_node_path32 = __toESM(require("node:path"), 1);
63298
+ var import_node_fs24 = __toESM(require("node:fs"), 1);
63299
+ var import_node_path33 = __toESM(require("node:path"), 1);
62964
63300
  function getLogFile() {
62965
63301
  return process.env.AGENT_RELAY_LOG_FILE;
62966
63302
  }
@@ -62978,9 +63314,9 @@ var LEVEL_PRIORITY = {
62978
63314
  };
62979
63315
  var createdLogDirs = /* @__PURE__ */ new Set();
62980
63316
  function ensureLogDir(logFile) {
62981
- const logDir = import_node_path32.default.dirname(logFile);
62982
- if (!createdLogDirs.has(logDir) && !import_node_fs23.default.existsSync(logDir)) {
62983
- import_node_fs23.default.mkdirSync(logDir, { recursive: true });
63317
+ const logDir = import_node_path33.default.dirname(logFile);
63318
+ if (!createdLogDirs.has(logDir) && !import_node_fs24.default.existsSync(logDir)) {
63319
+ import_node_fs24.default.mkdirSync(logDir, { recursive: true });
62984
63320
  createdLogDirs.add(logDir);
62985
63321
  }
62986
63322
  }
@@ -63009,7 +63345,7 @@ function log(level, component, msg, extra) {
63009
63345
  const logFile = getLogFile();
63010
63346
  if (logFile) {
63011
63347
  ensureLogDir(logFile);
63012
- import_node_fs23.default.appendFileSync(logFile, formatted + "\n");
63348
+ import_node_fs24.default.appendFileSync(logFile, formatted + "\n");
63013
63349
  return;
63014
63350
  }
63015
63351
  if (level === "ERROR" || level === "WARN") {
@@ -63279,14 +63615,14 @@ function benchmarkPatterns(iterations = 1e4) {
63279
63615
  }
63280
63616
 
63281
63617
  // packages/utils/dist/command-resolver.js
63282
- var import_node_child_process9 = require("node:child_process");
63283
- var import_node_fs24 = __toESM(require("node:fs"), 1);
63618
+ var import_node_child_process10 = require("node:child_process");
63619
+ var import_node_fs25 = __toESM(require("node:fs"), 1);
63284
63620
  function resolveCommand(command) {
63285
63621
  if (command.startsWith("/")) {
63286
63622
  return resolveSymlinks(command);
63287
63623
  }
63288
63624
  try {
63289
- const output = (0, import_node_child_process9.execSync)(`which ${command}`, {
63625
+ const output = (0, import_node_child_process10.execSync)(`which ${command}`, {
63290
63626
  encoding: "utf-8",
63291
63627
  stdio: ["pipe", "pipe", "pipe"],
63292
63628
  // Ensure we have a reasonable PATH
@@ -63306,7 +63642,7 @@ function resolveCommand(command) {
63306
63642
  }
63307
63643
  function resolveSymlinks(filePath) {
63308
63644
  try {
63309
- const resolved = import_node_fs24.default.realpathSync(filePath);
63645
+ const resolved = import_node_fs25.default.realpathSync(filePath);
63310
63646
  if (resolved !== filePath && process.env.DEBUG_SPAWN === "1") {
63311
63647
  console.log(`[command-resolver] Resolved symlink: ${filePath} -> ${resolved}`);
63312
63648
  }
@@ -63320,7 +63656,7 @@ function resolveSymlinks(filePath) {
63320
63656
  }
63321
63657
  function commandExists(command) {
63322
63658
  try {
63323
- (0, import_node_child_process9.execSync)(`which ${command}`, {
63659
+ (0, import_node_child_process10.execSync)(`which ${command}`, {
63324
63660
  encoding: "utf-8",
63325
63661
  stdio: ["pipe", "pipe", "pipe"]
63326
63662
  });
@@ -63331,9 +63667,9 @@ function commandExists(command) {
63331
63667
  }
63332
63668
 
63333
63669
  // packages/utils/dist/git-remote.js
63334
- var fs8 = __toESM(require("node:fs"), 1);
63335
- var path20 = __toESM(require("node:path"), 1);
63336
- var import_node_child_process10 = require("node:child_process");
63670
+ var fs9 = __toESM(require("node:fs"), 1);
63671
+ var path21 = __toESM(require("node:path"), 1);
63672
+ var import_node_child_process11 = require("node:child_process");
63337
63673
  function parseGitRemoteUrl(url2) {
63338
63674
  if (!url2)
63339
63675
  return null;
@@ -63349,11 +63685,11 @@ function parseGitRemoteUrl(url2) {
63349
63685
  }
63350
63686
  function getGitRemoteUrl(workingDirectory, remoteName = "origin") {
63351
63687
  try {
63352
- const gitDir = path20.join(workingDirectory, ".git");
63353
- if (!fs8.existsSync(gitDir)) {
63688
+ const gitDir = path21.join(workingDirectory, ".git");
63689
+ if (!fs9.existsSync(gitDir)) {
63354
63690
  return null;
63355
63691
  }
63356
- const result = (0, import_node_child_process10.execSync)(`git remote get-url ${remoteName}`, {
63692
+ const result = (0, import_node_child_process11.execSync)(`git remote get-url ${remoteName}`, {
63357
63693
  cwd: workingDirectory,
63358
63694
  encoding: "utf-8",
63359
63695
  timeout: 5e3,
@@ -63362,11 +63698,11 @@ function getGitRemoteUrl(workingDirectory, remoteName = "origin") {
63362
63698
  return result.trim() || null;
63363
63699
  } catch {
63364
63700
  try {
63365
- const configPath = path20.join(workingDirectory, ".git", "config");
63366
- if (!fs8.existsSync(configPath)) {
63701
+ const configPath = path21.join(workingDirectory, ".git", "config");
63702
+ if (!fs9.existsSync(configPath)) {
63367
63703
  return null;
63368
63704
  }
63369
- const config2 = fs8.readFileSync(configPath, "utf-8");
63705
+ const config2 = fs9.readFileSync(configPath, "utf-8");
63370
63706
  const remoteSection = new RegExp(`\\[remote\\s+"${remoteName}"\\][^\\[]*url\\s*=\\s*([^\\n]+)`, "i");
63371
63707
  const match = config2.match(remoteSection);
63372
63708
  return match?.[1]?.trim() || null;
@@ -63383,13 +63719,13 @@ function getRepoFullName(workingDirectory) {
63383
63719
  return parseGitRemoteUrl(remoteUrl);
63384
63720
  }
63385
63721
  function findGitRoot(startPath) {
63386
- let currentPath = path20.resolve(startPath);
63387
- const root = path20.parse(currentPath).root;
63722
+ let currentPath = path21.resolve(startPath);
63723
+ const root = path21.parse(currentPath).root;
63388
63724
  while (currentPath !== root) {
63389
- if (fs8.existsSync(path20.join(currentPath, ".git"))) {
63725
+ if (fs9.existsSync(path21.join(currentPath, ".git"))) {
63390
63726
  return currentPath;
63391
63727
  }
63392
- currentPath = path20.dirname(currentPath);
63728
+ currentPath = path21.dirname(currentPath);
63393
63729
  }
63394
63730
  return null;
63395
63731
  }
@@ -63406,8 +63742,8 @@ function getRepoFullNameFromPath(workingDirectory) {
63406
63742
  }
63407
63743
 
63408
63744
  // packages/utils/dist/update-checker.js
63409
- var import_node_fs25 = __toESM(require("node:fs"), 1);
63410
- var import_node_path33 = __toESM(require("node:path"), 1);
63745
+ var import_node_fs26 = __toESM(require("node:fs"), 1);
63746
+ var import_node_path34 = __toESM(require("node:path"), 1);
63411
63747
  var import_node_https2 = __toESM(require("node:https"), 1);
63412
63748
  var import_node_os11 = __toESM(require("node:os"), 1);
63413
63749
  var import_compare_versions = __toESM(require_umd(), 1);
@@ -63415,15 +63751,15 @@ var PACKAGE_NAME = "agent-relay";
63415
63751
  var CHECK_INTERVAL_MS = 60 * 60 * 1e3;
63416
63752
  var NPM_REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
63417
63753
  function getCachePath() {
63418
- const cacheDir = import_node_path33.default.join(import_node_os11.default.homedir(), ".agent-relay");
63419
- return import_node_path33.default.join(cacheDir, "update-cache.json");
63754
+ const cacheDir = import_node_path34.default.join(import_node_os11.default.homedir(), ".agent-relay");
63755
+ return import_node_path34.default.join(cacheDir, "update-cache.json");
63420
63756
  }
63421
63757
  function readCache() {
63422
63758
  try {
63423
63759
  const cachePath = getCachePath();
63424
- if (!import_node_fs25.default.existsSync(cachePath))
63760
+ if (!import_node_fs26.default.existsSync(cachePath))
63425
63761
  return null;
63426
- const data = import_node_fs25.default.readFileSync(cachePath, "utf-8");
63762
+ const data = import_node_fs26.default.readFileSync(cachePath, "utf-8");
63427
63763
  return JSON.parse(data);
63428
63764
  } catch {
63429
63765
  return null;
@@ -63432,11 +63768,11 @@ function readCache() {
63432
63768
  function writeCache(cache) {
63433
63769
  try {
63434
63770
  const cachePath = getCachePath();
63435
- const cacheDir = import_node_path33.default.dirname(cachePath);
63436
- if (!import_node_fs25.default.existsSync(cacheDir)) {
63437
- import_node_fs25.default.mkdirSync(cacheDir, { recursive: true });
63771
+ const cacheDir = import_node_path34.default.dirname(cachePath);
63772
+ if (!import_node_fs26.default.existsSync(cacheDir)) {
63773
+ import_node_fs26.default.mkdirSync(cacheDir, { recursive: true });
63438
63774
  }
63439
- import_node_fs25.default.writeFileSync(cachePath, JSON.stringify(cache, null, 2));
63775
+ import_node_fs26.default.writeFileSync(cachePath, JSON.stringify(cache, null, 2));
63440
63776
  } catch {
63441
63777
  }
63442
63778
  }
@@ -63715,9 +64051,9 @@ function validateModelForCli(cli, model) {
63715
64051
  }
63716
64052
 
63717
64053
  // packages/utils/dist/relay-pty-path.js
63718
- var import_node_fs26 = __toESM(require("node:fs"), 1);
64054
+ var import_node_fs27 = __toESM(require("node:fs"), 1);
63719
64055
  var import_node_os12 = __toESM(require("node:os"), 1);
63720
- var import_node_path34 = __toESM(require("node:path"), 1);
64056
+ var import_node_path35 = __toESM(require("node:path"), 1);
63721
64057
  var SUPPORTED_PLATFORMS = {
63722
64058
  darwin: {
63723
64059
  arm64: "relay-pty-darwin-arm64",
@@ -63765,23 +64101,23 @@ function findRelayPtyBinary(callerDirname) {
63765
64101
  const scopedMatch = normalizedCaller.match(/^(.+?\/node_modules)\/@agent-relay\//);
63766
64102
  const directMatch = normalizedCaller.match(/^(.+?\/node_modules\/agent-relay)/);
63767
64103
  if (scopedMatch) {
63768
- packageRoots.push(import_node_path34.default.join(scopedMatch[1], "agent-relay"));
64104
+ packageRoots.push(import_node_path35.default.join(scopedMatch[1], "agent-relay"));
63769
64105
  }
63770
64106
  if (directMatch) {
63771
64107
  packageRoots.push(directMatch[1]);
63772
64108
  }
63773
64109
  if (!normalizedCaller.includes("node_modules")) {
63774
- packageRoots.push(import_node_path34.default.join(callerDirname, "..", "..", ".."));
64110
+ packageRoots.push(import_node_path35.default.join(callerDirname, "..", "..", ".."));
63775
64111
  }
63776
64112
  const home = process.env.HOME || process.env.USERPROFILE || "";
63777
64113
  if (home) {
63778
- const npxCacheBase = import_node_path34.default.join(home, ".npm", "_npx");
63779
- if (import_node_fs26.default.existsSync(npxCacheBase)) {
64114
+ const npxCacheBase = import_node_path35.default.join(home, ".npm", "_npx");
64115
+ if (import_node_fs27.default.existsSync(npxCacheBase)) {
63780
64116
  try {
63781
- const entries = import_node_fs26.default.readdirSync(npxCacheBase);
64117
+ const entries = import_node_fs27.default.readdirSync(npxCacheBase);
63782
64118
  for (const entry of entries) {
63783
- const npxPackage = import_node_path34.default.join(npxCacheBase, entry, "node_modules", "agent-relay");
63784
- if (import_node_fs26.default.existsSync(npxPackage)) {
64119
+ const npxPackage = import_node_path35.default.join(npxCacheBase, entry, "node_modules", "agent-relay");
64120
+ if (import_node_fs27.default.existsSync(npxPackage)) {
63785
64121
  packageRoots.push(npxPackage);
63786
64122
  }
63787
64123
  }
@@ -63789,42 +64125,42 @@ function findRelayPtyBinary(callerDirname) {
63789
64125
  }
63790
64126
  }
63791
64127
  }
63792
- packageRoots.push(import_node_path34.default.join(process.cwd(), "node_modules", "agent-relay"));
64128
+ packageRoots.push(import_node_path35.default.join(process.cwd(), "node_modules", "agent-relay"));
63793
64129
  if (home) {
63794
- packageRoots.push(import_node_path34.default.join(home, ".nvm", "versions", "node", process.version, "lib", "node_modules", "agent-relay"));
63795
- packageRoots.push(import_node_path34.default.join(home, ".volta", "tools", "image", "packages", "agent-relay", "lib", "node_modules", "agent-relay"));
63796
- packageRoots.push(import_node_path34.default.join(home, ".fnm", "node-versions", process.version, "installation", "lib", "node_modules", "agent-relay"));
63797
- packageRoots.push(import_node_path34.default.join(home, "n", "lib", "node_modules", "agent-relay"));
63798
- packageRoots.push(import_node_path34.default.join(home, ".asdf", "installs", "nodejs", process.version.replace("v", ""), "lib", "node_modules", "agent-relay"));
63799
- packageRoots.push(import_node_path34.default.join(home, ".local", "share", "pnpm", "global", "node_modules", "agent-relay"));
63800
- packageRoots.push(import_node_path34.default.join(home, ".config", "yarn", "global", "node_modules", "agent-relay"));
63801
- packageRoots.push(import_node_path34.default.join(home, ".yarn", "global", "node_modules", "agent-relay"));
63802
- }
63803
- const bashInstallerDir = process.env.AGENT_RELAY_INSTALL_DIR ? import_node_path34.default.join(process.env.AGENT_RELAY_INSTALL_DIR, "bin") : home ? import_node_path34.default.join(home, ".agent-relay", "bin") : null;
63804
- const bashInstallerBinDir = process.env.AGENT_RELAY_BIN_DIR || (home ? import_node_path34.default.join(home, ".local", "bin") : null);
63805
- const nodePrefix = import_node_path34.default.resolve(import_node_path34.default.dirname(process.execPath), "..");
63806
- packageRoots.push(import_node_path34.default.join(nodePrefix, "lib", "node_modules", "agent-relay"));
64130
+ packageRoots.push(import_node_path35.default.join(home, ".nvm", "versions", "node", process.version, "lib", "node_modules", "agent-relay"));
64131
+ packageRoots.push(import_node_path35.default.join(home, ".volta", "tools", "image", "packages", "agent-relay", "lib", "node_modules", "agent-relay"));
64132
+ packageRoots.push(import_node_path35.default.join(home, ".fnm", "node-versions", process.version, "installation", "lib", "node_modules", "agent-relay"));
64133
+ packageRoots.push(import_node_path35.default.join(home, "n", "lib", "node_modules", "agent-relay"));
64134
+ packageRoots.push(import_node_path35.default.join(home, ".asdf", "installs", "nodejs", process.version.replace("v", ""), "lib", "node_modules", "agent-relay"));
64135
+ packageRoots.push(import_node_path35.default.join(home, ".local", "share", "pnpm", "global", "node_modules", "agent-relay"));
64136
+ packageRoots.push(import_node_path35.default.join(home, ".config", "yarn", "global", "node_modules", "agent-relay"));
64137
+ packageRoots.push(import_node_path35.default.join(home, ".yarn", "global", "node_modules", "agent-relay"));
64138
+ }
64139
+ const bashInstallerDir = process.env.AGENT_RELAY_INSTALL_DIR ? import_node_path35.default.join(process.env.AGENT_RELAY_INSTALL_DIR, "bin") : home ? import_node_path35.default.join(home, ".agent-relay", "bin") : null;
64140
+ const bashInstallerBinDir = process.env.AGENT_RELAY_BIN_DIR || (home ? import_node_path35.default.join(home, ".local", "bin") : null);
64141
+ const nodePrefix = import_node_path35.default.resolve(import_node_path35.default.dirname(process.execPath), "..");
64142
+ packageRoots.push(import_node_path35.default.join(nodePrefix, "lib", "node_modules", "agent-relay"));
63807
64143
  packageRoots.push("/usr/local/lib/node_modules/agent-relay");
63808
64144
  packageRoots.push("/opt/homebrew/lib/node_modules/agent-relay");
63809
64145
  packageRoots.push("/usr/lib/node_modules/agent-relay");
63810
64146
  const candidates = [];
63811
64147
  for (const root of packageRoots) {
63812
64148
  if (platformBinary) {
63813
- candidates.push(import_node_path34.default.join(root, "bin", platformBinary));
64149
+ candidates.push(import_node_path35.default.join(root, "bin", platformBinary));
63814
64150
  }
63815
- candidates.push(import_node_path34.default.join(root, "bin", "relay-pty"));
64151
+ candidates.push(import_node_path35.default.join(root, "bin", "relay-pty"));
63816
64152
  }
63817
64153
  if (bashInstallerDir) {
63818
64154
  if (platformBinary) {
63819
- candidates.push(import_node_path34.default.join(bashInstallerDir, platformBinary));
64155
+ candidates.push(import_node_path35.default.join(bashInstallerDir, platformBinary));
63820
64156
  }
63821
- candidates.push(import_node_path34.default.join(bashInstallerDir, "relay-pty"));
64157
+ candidates.push(import_node_path35.default.join(bashInstallerDir, "relay-pty"));
63822
64158
  }
63823
64159
  if (bashInstallerBinDir) {
63824
64160
  if (platformBinary) {
63825
- candidates.push(import_node_path34.default.join(bashInstallerBinDir, platformBinary));
64161
+ candidates.push(import_node_path35.default.join(bashInstallerBinDir, platformBinary));
63826
64162
  }
63827
- candidates.push(import_node_path34.default.join(bashInstallerBinDir, "relay-pty"));
64163
+ candidates.push(import_node_path35.default.join(bashInstallerBinDir, "relay-pty"));
63828
64164
  }
63829
64165
  candidates.push("/app/bin/relay-pty");
63830
64166
  candidates.push("/usr/local/bin/relay-pty");
@@ -63839,7 +64175,7 @@ function findRelayPtyBinary(callerDirname) {
63839
64175
  }
63840
64176
  function isExecutable2(filePath) {
63841
64177
  try {
63842
- import_node_fs26.default.accessSync(filePath, import_node_fs26.default.constants.X_OK);
64178
+ import_node_fs27.default.accessSync(filePath, import_node_fs27.default.constants.X_OK);
63843
64179
  return true;
63844
64180
  } catch {
63845
64181
  return false;
@@ -63848,9 +64184,9 @@ function isExecutable2(filePath) {
63848
64184
  function isPlatformCompatibleBinary(filePath) {
63849
64185
  let fd;
63850
64186
  try {
63851
- fd = import_node_fs26.default.openSync(filePath, "r");
64187
+ fd = import_node_fs27.default.openSync(filePath, "r");
63852
64188
  const header = Buffer.alloc(4);
63853
- const bytesRead = import_node_fs26.default.readSync(fd, header, 0, 4, 0);
64189
+ const bytesRead = import_node_fs27.default.readSync(fd, header, 0, 4, 0);
63854
64190
  if (bytesRead < 4) {
63855
64191
  return false;
63856
64192
  }
@@ -63868,7 +64204,7 @@ function isPlatformCompatibleBinary(filePath) {
63868
64204
  } finally {
63869
64205
  if (fd !== void 0) {
63870
64206
  try {
63871
- import_node_fs26.default.closeSync(fd);
64207
+ import_node_fs27.default.closeSync(fd);
63872
64208
  } catch {
63873
64209
  }
63874
64210
  }
@@ -64484,12 +64820,12 @@ var HookRegistry = class {
64484
64820
  };
64485
64821
 
64486
64822
  // packages/trajectory/dist/integration.js
64487
- var import_node_child_process11 = require("node:child_process");
64823
+ var import_node_child_process12 = require("node:child_process");
64488
64824
 
64489
64825
  // packages/config/dist/project-namespace.js
64490
64826
  var import_node_crypto16 = __toESM(require("node:crypto"), 1);
64491
- var import_node_path35 = __toESM(require("node:path"), 1);
64492
- var import_node_fs27 = __toESM(require("node:fs"), 1);
64827
+ var import_node_path36 = __toESM(require("node:path"), 1);
64828
+ var import_node_fs28 = __toESM(require("node:fs"), 1);
64493
64829
  var import_node_os13 = __toESM(require("node:os"), 1);
64494
64830
  function getGlobalBaseDir2() {
64495
64831
  if (process.env.AGENT_RELAY_DATA_DIR) {
@@ -64497,65 +64833,65 @@ function getGlobalBaseDir2() {
64497
64833
  }
64498
64834
  const xdgDataHome = process.env.XDG_DATA_HOME;
64499
64835
  if (xdgDataHome) {
64500
- return import_node_path35.default.join(xdgDataHome, "agent-relay");
64836
+ return import_node_path36.default.join(xdgDataHome, "agent-relay");
64501
64837
  }
64502
- return import_node_path35.default.join(import_node_os13.default.homedir(), ".agent-relay");
64838
+ return import_node_path36.default.join(import_node_os13.default.homedir(), ".agent-relay");
64503
64839
  }
64504
64840
  var GLOBAL_BASE_DIR2 = getGlobalBaseDir2();
64505
64841
  var PROJECT_DATA_DIR = ".agent-relay";
64506
64842
  function hashPath(projectPath) {
64507
- const normalized = import_node_path35.default.resolve(projectPath);
64843
+ const normalized = import_node_path36.default.resolve(projectPath);
64508
64844
  const hash2 = import_node_crypto16.default.createHash("sha256").update(normalized).digest("hex");
64509
64845
  return hash2.substring(0, 12);
64510
64846
  }
64511
64847
  function findProjectRoot(startDir = process.cwd()) {
64512
64848
  if (process.env.AGENT_RELAY_PROJECT) {
64513
- return import_node_path35.default.resolve(process.env.AGENT_RELAY_PROJECT);
64849
+ return import_node_path36.default.resolve(process.env.AGENT_RELAY_PROJECT);
64514
64850
  }
64515
- let current = import_node_path35.default.resolve(startDir);
64516
- const root = import_node_path35.default.parse(current).root;
64851
+ let current = import_node_path36.default.resolve(startDir);
64852
+ const root = import_node_path36.default.parse(current).root;
64517
64853
  const markers = [".git", "package.json", "Cargo.toml", "go.mod", "pyproject.toml", ".agent-relay"];
64518
64854
  while (current !== root) {
64519
64855
  for (const marker of markers) {
64520
- if (import_node_fs27.default.existsSync(import_node_path35.default.join(current, marker))) {
64856
+ if (import_node_fs28.default.existsSync(import_node_path36.default.join(current, marker))) {
64521
64857
  return current;
64522
64858
  }
64523
64859
  }
64524
- current = import_node_path35.default.dirname(current);
64860
+ current = import_node_path36.default.dirname(current);
64525
64861
  }
64526
- return import_node_path35.default.resolve(startDir);
64862
+ return import_node_path36.default.resolve(startDir);
64527
64863
  }
64528
64864
  function getProjectPaths2(projectRoot) {
64529
64865
  const root = projectRoot ?? findProjectRoot();
64530
64866
  const projectId = hashPath(root);
64531
- const dataDir = import_node_path35.default.join(root, PROJECT_DATA_DIR);
64867
+ const dataDir = import_node_path36.default.join(root, PROJECT_DATA_DIR);
64532
64868
  return {
64533
64869
  dataDir,
64534
- teamDir: import_node_path35.default.join(dataDir, "team"),
64535
- dbPath: import_node_path35.default.join(dataDir, "messages.sqlite"),
64536
- socketPath: import_node_path35.default.join(dataDir, "relay.sock"),
64870
+ teamDir: import_node_path36.default.join(dataDir, "team"),
64871
+ dbPath: import_node_path36.default.join(dataDir, "messages.sqlite"),
64872
+ socketPath: import_node_path36.default.join(dataDir, "relay.sock"),
64537
64873
  projectRoot: root,
64538
64874
  projectId
64539
64875
  };
64540
64876
  }
64541
64877
 
64542
64878
  // packages/config/dist/trajectory-config.js
64543
- var import_node_fs28 = require("node:fs");
64544
- var import_node_path36 = require("node:path");
64879
+ var import_node_fs29 = require("node:fs");
64880
+ var import_node_path37 = require("node:path");
64545
64881
  var import_node_os14 = require("node:os");
64546
64882
  var import_node_crypto17 = require("node:crypto");
64547
64883
  function getAgentRelayConfigDir() {
64548
- return process.env.AGENT_RELAY_CONFIG_DIR ?? (0, import_node_path36.join)((0, import_node_os14.homedir)(), ".config", "agent-relay");
64884
+ return process.env.AGENT_RELAY_CONFIG_DIR ?? (0, import_node_path37.join)((0, import_node_os14.homedir)(), ".config", "agent-relay");
64549
64885
  }
64550
64886
  var configCache = null;
64551
64887
  function getRelayConfigPath(_projectRoot) {
64552
- return (0, import_node_path36.join)(getAgentRelayConfigDir(), "relay.json");
64888
+ return (0, import_node_path37.join)(getAgentRelayConfigDir(), "relay.json");
64553
64889
  }
64554
64890
  function readRelayConfig(projectRoot) {
64555
64891
  const configPath = getRelayConfigPath(projectRoot);
64556
64892
  if (configCache && configCache.path === configPath) {
64557
64893
  try {
64558
- const stat2 = (0, import_node_fs28.statSync)(configPath);
64894
+ const stat2 = (0, import_node_fs29.statSync)(configPath);
64559
64895
  if (stat2.mtimeMs === configCache.mtime) {
64560
64896
  return configCache.config;
64561
64897
  }
@@ -64563,13 +64899,13 @@ function readRelayConfig(projectRoot) {
64563
64899
  }
64564
64900
  }
64565
64901
  try {
64566
- if (!(0, import_node_fs28.existsSync)(configPath)) {
64902
+ if (!(0, import_node_fs29.existsSync)(configPath)) {
64567
64903
  return {};
64568
64904
  }
64569
- const content = (0, import_node_fs28.readFileSync)(configPath, "utf-8");
64905
+ const content = (0, import_node_fs29.readFileSync)(configPath, "utf-8");
64570
64906
  const config2 = JSON.parse(content);
64571
64907
  try {
64572
- const stat2 = (0, import_node_fs28.statSync)(configPath);
64908
+ const stat2 = (0, import_node_fs29.statSync)(configPath);
64573
64909
  configCache = { path: configPath, config: config2, mtime: stat2.mtimeMs };
64574
64910
  } catch {
64575
64911
  }
@@ -64589,12 +64925,12 @@ function getProjectHash(projectRoot) {
64589
64925
  }
64590
64926
  function getUserTrajectoriesDir(projectRoot) {
64591
64927
  const projectHash = getProjectHash(projectRoot);
64592
- const configDir = process.env.XDG_CONFIG_HOME || (0, import_node_path36.join)((0, import_node_os14.homedir)(), ".config");
64593
- return (0, import_node_path36.join)(configDir, "agent-relay", "trajectories", projectHash);
64928
+ const configDir = process.env.XDG_CONFIG_HOME || (0, import_node_path37.join)((0, import_node_os14.homedir)(), ".config");
64929
+ return (0, import_node_path37.join)(configDir, "agent-relay", "trajectories", projectHash);
64594
64930
  }
64595
64931
  function getRepoTrajectoriesDir(projectRoot) {
64596
64932
  const root = projectRoot ?? getProjectPaths2().projectRoot;
64597
- return (0, import_node_path36.join)(root, ".trajectories");
64933
+ return (0, import_node_path37.join)(root, ".trajectories");
64598
64934
  }
64599
64935
  function getPrimaryTrajectoriesDir(projectRoot) {
64600
64936
  if (shouldStoreInRepo(projectRoot)) {
@@ -64613,7 +64949,7 @@ function getTrajectoryEnvVars(projectRoot) {
64613
64949
  async function runTrail(args) {
64614
64950
  return new Promise((resolve4) => {
64615
64951
  const trajectoryEnv = getTrajectoryEnvVars();
64616
- const proc = (0, import_node_child_process11.spawn)("trail", args, {
64952
+ const proc = (0, import_node_child_process12.spawn)("trail", args, {
64617
64953
  cwd: getProjectPaths2().projectRoot,
64618
64954
  env: { ...process.env, ...trajectoryEnv },
64619
64955
  stdio: ["pipe", "pipe", "pipe"]
@@ -64884,7 +65220,7 @@ var TrajectoryIntegration = class {
64884
65220
  */
64885
65221
  isTrailInstalledSync() {
64886
65222
  try {
64887
- (0, import_node_child_process11.execSync)("which trail", { stdio: "pipe" });
65223
+ (0, import_node_child_process12.execSync)("which trail", { stdio: "pipe" });
64888
65224
  return true;
64889
65225
  } catch {
64890
65226
  return false;
@@ -65234,8 +65570,8 @@ var HookEmitter = class {
65234
65570
  };
65235
65571
 
65236
65572
  // packages/hooks/dist/inbox-check/utils.js
65237
- var import_node_fs29 = require("node:fs");
65238
- var import_node_path37 = require("node:path");
65573
+ var import_node_fs30 = require("node:fs");
65574
+ var import_node_path38 = require("node:path");
65239
65575
  var DEFAULT_INBOX_DIR = "/tmp/agent-relay";
65240
65576
  function getAgentName() {
65241
65577
  return process.env.AGENT_RELAY_NAME;
@@ -65245,16 +65581,16 @@ function getInboxPath(config2) {
65245
65581
  if (!agentName) {
65246
65582
  throw new Error("Agent name not configured. Set AGENT_RELAY_NAME env var.");
65247
65583
  }
65248
- return (0, import_node_path37.join)(config2.inboxDir, agentName, "inbox.md");
65584
+ return (0, import_node_path38.join)(config2.inboxDir, agentName, "inbox.md");
65249
65585
  }
65250
65586
  function inboxExists(inboxPath) {
65251
- return (0, import_node_fs29.existsSync)(inboxPath);
65587
+ return (0, import_node_fs30.existsSync)(inboxPath);
65252
65588
  }
65253
65589
  function readInbox(inboxPath) {
65254
65590
  if (!inboxExists(inboxPath)) {
65255
65591
  return "";
65256
65592
  }
65257
- return (0, import_node_fs29.readFileSync)(inboxPath, "utf-8");
65593
+ return (0, import_node_fs30.readFileSync)(inboxPath, "utf-8");
65258
65594
  }
65259
65595
  function hasUnreadMessages(inboxPath) {
65260
65596
  const content = readInbox(inboxPath);
@@ -65416,11 +65752,13 @@ init_dist2();
65416
65752
  createWorkflowRenderer,
65417
65753
  customStepsFileExists,
65418
65754
  detectCompletion,
65755
+ ensureLocalSdkWorkflowRuntime,
65419
65756
  estimateContextTokens,
65420
65757
  estimateTokens,
65421
65758
  execCustomVerification,
65422
65759
  executeApiStep,
65423
65760
  findGitRoot,
65761
+ findLocalSdkWorkspace,
65424
65762
  findRelayPtyBinary,
65425
65763
  followLogs,
65426
65764
  formatDryRunReport,
@@ -65430,6 +65768,7 @@ init_dist2();
65430
65768
  formatResultMessage,
65431
65769
  formatRunSummaryTable,
65432
65770
  formatStepOutput,
65771
+ formatWorkflowParseError,
65433
65772
  generateAgentName,
65434
65773
  generateErrorId,
65435
65774
  generateRequestId,
@@ -65486,6 +65825,7 @@ init_dist2();
65486
65825
  parseMessages,
65487
65826
  parseProposalCommand,
65488
65827
  parseSpawnEnv,
65828
+ parseTsxStderr,
65489
65829
  parseVoteCommand,
65490
65830
  printUpdateNotification,
65491
65831
  readInbox,
@@ -65505,6 +65845,7 @@ init_dist2();
65505
65845
  resolveTemplateForShell,
65506
65846
  resolveVariables,
65507
65847
  routerLog,
65848
+ runScriptWorkflow,
65508
65849
  runVerification,
65509
65850
  runWorkflow,
65510
65851
  scrubForChannel,