@swmansion/argent 0.27.1-next.22 → 0.27.1-next.23

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/cli-cmds.mjs CHANGED
@@ -124,17 +124,17 @@ var require_visit = __commonJS({
124
124
  visit.BREAK = BREAK;
125
125
  visit.SKIP = SKIP;
126
126
  visit.REMOVE = REMOVE;
127
- function visit_(key, node, visitor, path23) {
128
- const ctrl = callVisitor(key, node, visitor, path23);
127
+ function visit_(key, node, visitor, path24) {
128
+ const ctrl = callVisitor(key, node, visitor, path24);
129
129
  if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
130
- replaceNode(key, path23, ctrl);
131
- return visit_(key, ctrl, visitor, path23);
130
+ replaceNode(key, path24, ctrl);
131
+ return visit_(key, ctrl, visitor, path24);
132
132
  }
133
133
  if (typeof ctrl !== "symbol") {
134
134
  if (identity2.isCollection(node)) {
135
- path23 = Object.freeze(path23.concat(node));
135
+ path24 = Object.freeze(path24.concat(node));
136
136
  for (let i2 = 0; i2 < node.items.length; ++i2) {
137
- const ci = visit_(i2, node.items[i2], visitor, path23);
137
+ const ci = visit_(i2, node.items[i2], visitor, path24);
138
138
  if (typeof ci === "number")
139
139
  i2 = ci - 1;
140
140
  else if (ci === BREAK)
@@ -145,13 +145,13 @@ var require_visit = __commonJS({
145
145
  }
146
146
  }
147
147
  } else if (identity2.isPair(node)) {
148
- path23 = Object.freeze(path23.concat(node));
149
- const ck = visit_("key", node.key, visitor, path23);
148
+ path24 = Object.freeze(path24.concat(node));
149
+ const ck = visit_("key", node.key, visitor, path24);
150
150
  if (ck === BREAK)
151
151
  return BREAK;
152
152
  else if (ck === REMOVE)
153
153
  node.key = null;
154
- const cv = visit_("value", node.value, visitor, path23);
154
+ const cv = visit_("value", node.value, visitor, path24);
155
155
  if (cv === BREAK)
156
156
  return BREAK;
157
157
  else if (cv === REMOVE)
@@ -172,17 +172,17 @@ var require_visit = __commonJS({
172
172
  visitAsync.BREAK = BREAK;
173
173
  visitAsync.SKIP = SKIP;
174
174
  visitAsync.REMOVE = REMOVE;
175
- async function visitAsync_(key, node, visitor, path23) {
176
- const ctrl = await callVisitor(key, node, visitor, path23);
175
+ async function visitAsync_(key, node, visitor, path24) {
176
+ const ctrl = await callVisitor(key, node, visitor, path24);
177
177
  if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
178
- replaceNode(key, path23, ctrl);
179
- return visitAsync_(key, ctrl, visitor, path23);
178
+ replaceNode(key, path24, ctrl);
179
+ return visitAsync_(key, ctrl, visitor, path24);
180
180
  }
181
181
  if (typeof ctrl !== "symbol") {
182
182
  if (identity2.isCollection(node)) {
183
- path23 = Object.freeze(path23.concat(node));
183
+ path24 = Object.freeze(path24.concat(node));
184
184
  for (let i2 = 0; i2 < node.items.length; ++i2) {
185
- const ci = await visitAsync_(i2, node.items[i2], visitor, path23);
185
+ const ci = await visitAsync_(i2, node.items[i2], visitor, path24);
186
186
  if (typeof ci === "number")
187
187
  i2 = ci - 1;
188
188
  else if (ci === BREAK)
@@ -193,13 +193,13 @@ var require_visit = __commonJS({
193
193
  }
194
194
  }
195
195
  } else if (identity2.isPair(node)) {
196
- path23 = Object.freeze(path23.concat(node));
197
- const ck = await visitAsync_("key", node.key, visitor, path23);
196
+ path24 = Object.freeze(path24.concat(node));
197
+ const ck = await visitAsync_("key", node.key, visitor, path24);
198
198
  if (ck === BREAK)
199
199
  return BREAK;
200
200
  else if (ck === REMOVE)
201
201
  node.key = null;
202
- const cv = await visitAsync_("value", node.value, visitor, path23);
202
+ const cv = await visitAsync_("value", node.value, visitor, path24);
203
203
  if (cv === BREAK)
204
204
  return BREAK;
205
205
  else if (cv === REMOVE)
@@ -226,23 +226,23 @@ var require_visit = __commonJS({
226
226
  }
227
227
  return visitor;
228
228
  }
229
- function callVisitor(key, node, visitor, path23) {
229
+ function callVisitor(key, node, visitor, path24) {
230
230
  if (typeof visitor === "function")
231
- return visitor(key, node, path23);
231
+ return visitor(key, node, path24);
232
232
  if (identity2.isMap(node))
233
- return visitor.Map?.(key, node, path23);
233
+ return visitor.Map?.(key, node, path24);
234
234
  if (identity2.isSeq(node))
235
- return visitor.Seq?.(key, node, path23);
235
+ return visitor.Seq?.(key, node, path24);
236
236
  if (identity2.isPair(node))
237
- return visitor.Pair?.(key, node, path23);
237
+ return visitor.Pair?.(key, node, path24);
238
238
  if (identity2.isScalar(node))
239
- return visitor.Scalar?.(key, node, path23);
239
+ return visitor.Scalar?.(key, node, path24);
240
240
  if (identity2.isAlias(node))
241
- return visitor.Alias?.(key, node, path23);
241
+ return visitor.Alias?.(key, node, path24);
242
242
  return void 0;
243
243
  }
244
- function replaceNode(key, path23, node) {
245
- const parent = path23[path23.length - 1];
244
+ function replaceNode(key, path24, node) {
245
+ const parent = path24[path24.length - 1];
246
246
  if (identity2.isCollection(parent)) {
247
247
  parent.items[key] = node;
248
248
  } else if (identity2.isPair(parent)) {
@@ -852,10 +852,10 @@ var require_Collection = __commonJS({
852
852
  var createNode = require_createNode();
853
853
  var identity2 = require_identity();
854
854
  var Node = require_Node();
855
- function collectionFromPath(schema, path23, value) {
855
+ function collectionFromPath(schema, path24, value) {
856
856
  let v = value;
857
- for (let i2 = path23.length - 1; i2 >= 0; --i2) {
858
- const k = path23[i2];
857
+ for (let i2 = path24.length - 1; i2 >= 0; --i2) {
858
+ const k = path24[i2];
859
859
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
860
860
  const a2 = [];
861
861
  a2[k] = v;
@@ -874,7 +874,7 @@ var require_Collection = __commonJS({
874
874
  sourceObjects: /* @__PURE__ */ new Map()
875
875
  });
876
876
  }
877
- var isEmptyPath = (path23) => path23 == null || typeof path23 === "object" && !!path23[Symbol.iterator]().next().done;
877
+ var isEmptyPath = (path24) => path24 == null || typeof path24 === "object" && !!path24[Symbol.iterator]().next().done;
878
878
  var Collection = class extends Node.NodeBase {
879
879
  constructor(type, schema) {
880
880
  super(type);
@@ -904,11 +904,11 @@ var require_Collection = __commonJS({
904
904
  * be a Pair instance or a `{ key, value }` object, which may not have a key
905
905
  * that already exists in the map.
906
906
  */
907
- addIn(path23, value) {
908
- if (isEmptyPath(path23))
907
+ addIn(path24, value) {
908
+ if (isEmptyPath(path24))
909
909
  this.add(value);
910
910
  else {
911
- const [key, ...rest] = path23;
911
+ const [key, ...rest] = path24;
912
912
  const node = this.get(key, true);
913
913
  if (identity2.isCollection(node))
914
914
  node.addIn(rest, value);
@@ -922,8 +922,8 @@ var require_Collection = __commonJS({
922
922
  * Removes a value from the collection.
923
923
  * @returns `true` if the item was found and removed.
924
924
  */
925
- deleteIn(path23) {
926
- const [key, ...rest] = path23;
925
+ deleteIn(path24) {
926
+ const [key, ...rest] = path24;
927
927
  if (rest.length === 0)
928
928
  return this.delete(key);
929
929
  const node = this.get(key, true);
@@ -937,8 +937,8 @@ var require_Collection = __commonJS({
937
937
  * scalar values from their surrounding node; to disable set `keepScalar` to
938
938
  * `true` (collections are always returned intact).
939
939
  */
940
- getIn(path23, keepScalar) {
941
- const [key, ...rest] = path23;
940
+ getIn(path24, keepScalar) {
941
+ const [key, ...rest] = path24;
942
942
  const node = this.get(key, true);
943
943
  if (rest.length === 0)
944
944
  return !keepScalar && identity2.isScalar(node) ? node.value : node;
@@ -956,8 +956,8 @@ var require_Collection = __commonJS({
956
956
  /**
957
957
  * Checks if the collection includes a value with the key `key`.
958
958
  */
959
- hasIn(path23) {
960
- const [key, ...rest] = path23;
959
+ hasIn(path24) {
960
+ const [key, ...rest] = path24;
961
961
  if (rest.length === 0)
962
962
  return this.has(key);
963
963
  const node = this.get(key, true);
@@ -967,8 +967,8 @@ var require_Collection = __commonJS({
967
967
  * Sets a value in this collection. For `!!set`, `value` needs to be a
968
968
  * boolean to add/remove the item from the set.
969
969
  */
970
- setIn(path23, value) {
971
- const [key, ...rest] = path23;
970
+ setIn(path24, value) {
971
+ const [key, ...rest] = path24;
972
972
  if (rest.length === 0) {
973
973
  this.set(key, value);
974
974
  } else {
@@ -3483,9 +3483,9 @@ var require_Document = __commonJS({
3483
3483
  this.contents.add(value);
3484
3484
  }
3485
3485
  /** Adds a value to the document. */
3486
- addIn(path23, value) {
3486
+ addIn(path24, value) {
3487
3487
  if (assertCollection(this.contents))
3488
- this.contents.addIn(path23, value);
3488
+ this.contents.addIn(path24, value);
3489
3489
  }
3490
3490
  /**
3491
3491
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -3560,14 +3560,14 @@ var require_Document = __commonJS({
3560
3560
  * Removes a value from the document.
3561
3561
  * @returns `true` if the item was found and removed.
3562
3562
  */
3563
- deleteIn(path23) {
3564
- if (Collection.isEmptyPath(path23)) {
3563
+ deleteIn(path24) {
3564
+ if (Collection.isEmptyPath(path24)) {
3565
3565
  if (this.contents == null)
3566
3566
  return false;
3567
3567
  this.contents = null;
3568
3568
  return true;
3569
3569
  }
3570
- return assertCollection(this.contents) ? this.contents.deleteIn(path23) : false;
3570
+ return assertCollection(this.contents) ? this.contents.deleteIn(path24) : false;
3571
3571
  }
3572
3572
  /**
3573
3573
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -3582,10 +3582,10 @@ var require_Document = __commonJS({
3582
3582
  * scalar values from their surrounding node; to disable set `keepScalar` to
3583
3583
  * `true` (collections are always returned intact).
3584
3584
  */
3585
- getIn(path23, keepScalar) {
3586
- if (Collection.isEmptyPath(path23))
3585
+ getIn(path24, keepScalar) {
3586
+ if (Collection.isEmptyPath(path24))
3587
3587
  return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
3588
- return identity2.isCollection(this.contents) ? this.contents.getIn(path23, keepScalar) : void 0;
3588
+ return identity2.isCollection(this.contents) ? this.contents.getIn(path24, keepScalar) : void 0;
3589
3589
  }
3590
3590
  /**
3591
3591
  * Checks if the document includes a value with the key `key`.
@@ -3596,10 +3596,10 @@ var require_Document = __commonJS({
3596
3596
  /**
3597
3597
  * Checks if the document includes a value at `path`.
3598
3598
  */
3599
- hasIn(path23) {
3600
- if (Collection.isEmptyPath(path23))
3599
+ hasIn(path24) {
3600
+ if (Collection.isEmptyPath(path24))
3601
3601
  return this.contents !== void 0;
3602
- return identity2.isCollection(this.contents) ? this.contents.hasIn(path23) : false;
3602
+ return identity2.isCollection(this.contents) ? this.contents.hasIn(path24) : false;
3603
3603
  }
3604
3604
  /**
3605
3605
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -3616,13 +3616,13 @@ var require_Document = __commonJS({
3616
3616
  * Sets a value in this document. For `!!set`, `value` needs to be a
3617
3617
  * boolean to add/remove the item from the set.
3618
3618
  */
3619
- setIn(path23, value) {
3620
- if (Collection.isEmptyPath(path23)) {
3619
+ setIn(path24, value) {
3620
+ if (Collection.isEmptyPath(path24)) {
3621
3621
  this.contents = value;
3622
3622
  } else if (this.contents == null) {
3623
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path23), value);
3623
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path24), value);
3624
3624
  } else if (assertCollection(this.contents)) {
3625
- this.contents.setIn(path23, value);
3625
+ this.contents.setIn(path24, value);
3626
3626
  }
3627
3627
  }
3628
3628
  /**
@@ -5582,9 +5582,9 @@ var require_cst_visit = __commonJS({
5582
5582
  visit.BREAK = BREAK;
5583
5583
  visit.SKIP = SKIP;
5584
5584
  visit.REMOVE = REMOVE;
5585
- visit.itemAtPath = (cst, path23) => {
5585
+ visit.itemAtPath = (cst, path24) => {
5586
5586
  let item = cst;
5587
- for (const [field, index] of path23) {
5587
+ for (const [field, index] of path24) {
5588
5588
  const tok = item?.[field];
5589
5589
  if (tok && "items" in tok) {
5590
5590
  item = tok.items[index];
@@ -5593,23 +5593,23 @@ var require_cst_visit = __commonJS({
5593
5593
  }
5594
5594
  return item;
5595
5595
  };
5596
- visit.parentCollection = (cst, path23) => {
5597
- const parent = visit.itemAtPath(cst, path23.slice(0, -1));
5598
- const field = path23[path23.length - 1][0];
5596
+ visit.parentCollection = (cst, path24) => {
5597
+ const parent = visit.itemAtPath(cst, path24.slice(0, -1));
5598
+ const field = path24[path24.length - 1][0];
5599
5599
  const coll = parent?.[field];
5600
5600
  if (coll && "items" in coll)
5601
5601
  return coll;
5602
5602
  throw new Error("Parent collection not found");
5603
5603
  };
5604
- function _visit(path23, item, visitor) {
5605
- let ctrl = visitor(item, path23);
5604
+ function _visit(path24, item, visitor) {
5605
+ let ctrl = visitor(item, path24);
5606
5606
  if (typeof ctrl === "symbol")
5607
5607
  return ctrl;
5608
5608
  for (const field of ["key", "value"]) {
5609
5609
  const token = item[field];
5610
5610
  if (token && "items" in token) {
5611
5611
  for (let i2 = 0; i2 < token.items.length; ++i2) {
5612
- const ci = _visit(Object.freeze(path23.concat([[field, i2]])), token.items[i2], visitor);
5612
+ const ci = _visit(Object.freeze(path24.concat([[field, i2]])), token.items[i2], visitor);
5613
5613
  if (typeof ci === "number")
5614
5614
  i2 = ci - 1;
5615
5615
  else if (ci === BREAK)
@@ -5620,10 +5620,10 @@ var require_cst_visit = __commonJS({
5620
5620
  }
5621
5621
  }
5622
5622
  if (typeof ctrl === "function" && field === "key")
5623
- ctrl = ctrl(item, path23);
5623
+ ctrl = ctrl(item, path24);
5624
5624
  }
5625
5625
  }
5626
- return typeof ctrl === "function" ? ctrl(item, path23) : ctrl;
5626
+ return typeof ctrl === "function" ? ctrl(item, path24) : ctrl;
5627
5627
  }
5628
5628
  exports.visit = visit;
5629
5629
  }
@@ -7378,7 +7378,7 @@ var require_dist = __commonJS({
7378
7378
  var require_main = __commonJS({
7379
7379
  "../../node_modules/dotenv/lib/main.js"(exports, module) {
7380
7380
  var fs18 = __require("fs");
7381
- var path23 = __require("path");
7381
+ var path24 = __require("path");
7382
7382
  var os4 = __require("os");
7383
7383
  var crypto3 = __require("crypto");
7384
7384
  var TIPS = [
@@ -7517,7 +7517,7 @@ var require_main = __commonJS({
7517
7517
  possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
7518
7518
  }
7519
7519
  } else {
7520
- possibleVaultPath = path23.resolve(process.cwd(), ".env.vault");
7520
+ possibleVaultPath = path24.resolve(process.cwd(), ".env.vault");
7521
7521
  }
7522
7522
  if (fs18.existsSync(possibleVaultPath)) {
7523
7523
  return possibleVaultPath;
@@ -7525,7 +7525,7 @@ var require_main = __commonJS({
7525
7525
  return null;
7526
7526
  }
7527
7527
  function _resolveHome(envPath) {
7528
- return envPath[0] === "~" ? path23.join(os4.homedir(), envPath.slice(1)) : envPath;
7528
+ return envPath[0] === "~" ? path24.join(os4.homedir(), envPath.slice(1)) : envPath;
7529
7529
  }
7530
7530
  function _configVault(options) {
7531
7531
  const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
@@ -7542,7 +7542,7 @@ var require_main = __commonJS({
7542
7542
  return { parsed };
7543
7543
  }
7544
7544
  function configDotenv(options) {
7545
- const dotenvPath = path23.resolve(process.cwd(), ".env");
7545
+ const dotenvPath = path24.resolve(process.cwd(), ".env");
7546
7546
  let encoding = "utf8";
7547
7547
  let processEnv = process.env;
7548
7548
  if (options && options.processEnv != null) {
@@ -7570,13 +7570,13 @@ var require_main = __commonJS({
7570
7570
  }
7571
7571
  let lastError;
7572
7572
  const parsedAll = {};
7573
- for (const path24 of optionPaths) {
7573
+ for (const path25 of optionPaths) {
7574
7574
  try {
7575
- const parsed = DotenvModule.parse(fs18.readFileSync(path24, { encoding }));
7575
+ const parsed = DotenvModule.parse(fs18.readFileSync(path25, { encoding }));
7576
7576
  DotenvModule.populate(parsedAll, parsed, options);
7577
7577
  } catch (e) {
7578
7578
  if (debug) {
7579
- _debug(`failed to load ${path24} ${e.message}`);
7579
+ _debug(`failed to load ${path25} ${e.message}`);
7580
7580
  }
7581
7581
  lastError = e;
7582
7582
  }
@@ -7589,7 +7589,7 @@ var require_main = __commonJS({
7589
7589
  const shortPaths = [];
7590
7590
  for (const filePath of optionPaths) {
7591
7591
  try {
7592
- const relative3 = path23.relative(process.cwd(), filePath);
7592
+ const relative3 = path24.relative(process.cwd(), filePath);
7593
7593
  shortPaths.push(relative3);
7594
7594
  } catch (e) {
7595
7595
  if (debug) {
@@ -8841,7 +8841,7 @@ var require_src = __commonJS({
8841
8841
 
8842
8842
  // ../argent-cli/src/run.ts
8843
8843
  import * as fs11 from "node:fs";
8844
- import * as path15 from "node:path";
8844
+ import * as path16 from "node:path";
8845
8845
 
8846
8846
  // ../argent-tools-client/src/launcher.ts
8847
8847
  import * as net from "node:net";
@@ -8882,7 +8882,7 @@ function generateAuthToken() {
8882
8882
  return generateToken();
8883
8883
  }
8884
8884
  function findFreePort() {
8885
- return new Promise((resolve11, reject) => {
8885
+ return new Promise((resolve12, reject) => {
8886
8886
  const srv = net.createServer();
8887
8887
  srv.listen(0, "127.0.0.1", () => {
8888
8888
  const addr = srv.address();
@@ -8893,7 +8893,7 @@ function findFreePort() {
8893
8893
  const port = addr.port;
8894
8894
  srv.close((err) => {
8895
8895
  if (err) reject(err);
8896
- else resolve11(port);
8896
+ else resolve12(port);
8897
8897
  });
8898
8898
  });
8899
8899
  srv.on("error", reject);
@@ -8994,7 +8994,7 @@ function killSpawnedChild(child, pid) {
8994
8994
  }
8995
8995
  }
8996
8996
  function spawnToolsServer(paths, port, options = {}) {
8997
- return new Promise((resolve11, reject) => {
8997
+ return new Promise((resolve12, reject) => {
8998
8998
  let logFd;
8999
8999
  try {
9000
9000
  fs.mkdirSync(STATE_DIR, { recursive: true });
@@ -9040,7 +9040,7 @@ function spawnToolsServer(paths, port, options = {}) {
9040
9040
  rl.close();
9041
9041
  child.stdout?.resume();
9042
9042
  child.stdout?.unref?.();
9043
- settle(() => resolve11({ port: actualPort, pid }));
9043
+ settle(() => resolve12({ port: actualPort, pid }));
9044
9044
  }
9045
9045
  });
9046
9046
  child.on("error", (err) => {
@@ -9353,6 +9353,12 @@ async function ensureToolsServer(paths) {
9353
9353
  }
9354
9354
  }
9355
9355
 
9356
+ // ../argent-tools-client/src/tools-client.ts
9357
+ import * as path6 from "node:path";
9358
+
9359
+ // ../registry/src/types.ts
9360
+ var LINKED_CALL_HEADER = "x-argent-linked";
9361
+
9356
9362
  // ../registry/src/artifacts.ts
9357
9363
  import { stat } from "node:fs/promises";
9358
9364
  import { randomUUID } from "node:crypto";
@@ -9389,8 +9395,8 @@ function toolStepFiles(specs, args) {
9389
9395
  }
9390
9396
  return files;
9391
9397
  }
9392
- function isClientFileArgument({ spec, path: path23 }) {
9393
- return spec.kind === "file" && spec.path === `\${${spec.target}}` && path23.startsWith("/") && hasToolFileExtension(path23);
9398
+ function isClientFileArgument({ spec, path: path24 }) {
9399
+ return spec.kind === "file" && spec.path === `\${${spec.target}}` && path24.startsWith("/") && hasToolFileExtension(path24);
9394
9400
  }
9395
9401
 
9396
9402
  // ../registry/src/flow-file-refs.ts
@@ -9421,6 +9427,7 @@ function collectFlowRequests(doc) {
9421
9427
  const runTargets = /* @__PURE__ */ new Set();
9422
9428
  const snapshots = /* @__PURE__ */ new Set();
9423
9429
  const toolSteps = [];
9430
+ const nested = [];
9424
9431
  const seen = /* @__PURE__ */ new Set();
9425
9432
  const visit = (steps, depth) => {
9426
9433
  if (!Array.isArray(steps) || depth > MAX_BLOCK_NESTING || seen.has(steps)) return;
@@ -9435,13 +9442,16 @@ function collectFlowRequests(doc) {
9435
9442
  const snapshot = isRecord(step.snapshot) ? step.snapshot.name : step.snapshot;
9436
9443
  if (typeof snapshot === "string" && FLOW_NAME_PATTERN.test(snapshot)) snapshots.add(snapshot);
9437
9444
  if (typeof step.tool === "string") {
9438
- toolSteps.push({ tool: step.tool, args: isRecord(step.args) ? step.args : {} });
9445
+ const args = isRecord(step.args) ? step.args : {};
9446
+ toolSteps.push({ tool: step.tool, args });
9447
+ const target = step.tool === "flow-execute" ? nestedFlowTarget(args) : void 0;
9448
+ if (target !== void 0) nested.push({ target, args });
9439
9449
  }
9440
9450
  visit(step.steps, depth + 1);
9441
9451
  }
9442
9452
  };
9443
9453
  if (isRecord(doc)) visit(doc.steps, 0);
9444
- return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps };
9454
+ return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
9445
9455
  }
9446
9456
  function baselineKeyFor(canonicalPath, flowName) {
9447
9457
  const stem = path2.basename(canonicalPath, ".yaml");
@@ -9457,6 +9467,26 @@ async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PA
9457
9467
  if (actual === void 0) return { state: "absent" };
9458
9468
  return { state: "case_folded", actual, addressable: addressable.test(actual) };
9459
9469
  }
9470
+ function nestedFlowTarget(args) {
9471
+ if (typeof args !== "object" || args === null || Array.isArray(args)) return void 0;
9472
+ const { name, project_root: projectRoot, flow_path: flowPath } = args;
9473
+ if (flowPath === void 0) {
9474
+ if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name)) return void 0;
9475
+ if (!isResolvedAbsolute(projectRoot)) return void 0;
9476
+ return {
9477
+ kind: "name",
9478
+ projectRoot,
9479
+ name,
9480
+ path: path2.join(projectRoot, ".argent", "flows", `${name}.yaml`)
9481
+ };
9482
+ }
9483
+ if (name !== void 0 || !isResolvedAbsolute(flowPath)) return void 0;
9484
+ if (!FLOW_FILE_NAME_PATTERN.test(path2.basename(flowPath))) return void 0;
9485
+ return { kind: "flow_path", path: flowPath };
9486
+ }
9487
+ function isResolvedAbsolute(value) {
9488
+ return typeof value === "string" && path2.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
9489
+ }
9460
9490
 
9461
9491
  // ../registry/src/failure-codes.ts
9462
9492
  var FAILURE_CODES = {
@@ -10578,10 +10608,10 @@ function mergeDefs(...defs) {
10578
10608
  function cloneDef(schema) {
10579
10609
  return mergeDefs(schema._zod.def);
10580
10610
  }
10581
- function getElementAtPath(obj, path23) {
10582
- if (!path23)
10611
+ function getElementAtPath(obj, path24) {
10612
+ if (!path24)
10583
10613
  return obj;
10584
- return path23.reduce((acc, key) => acc?.[key], obj);
10614
+ return path24.reduce((acc, key) => acc?.[key], obj);
10585
10615
  }
10586
10616
  function promiseAllObject(promisesObj) {
10587
10617
  const keys = Object.keys(promisesObj);
@@ -10990,11 +11020,11 @@ function explicitlyAborted(x, startIndex = 0) {
10990
11020
  }
10991
11021
  return false;
10992
11022
  }
10993
- function prefixIssues(path23, issues) {
11023
+ function prefixIssues(path24, issues) {
10994
11024
  return issues.map((iss) => {
10995
11025
  var _a3;
10996
11026
  (_a3 = iss).path ?? (_a3.path = []);
10997
- iss.path.unshift(path23);
11027
+ iss.path.unshift(path24);
10998
11028
  return iss;
10999
11029
  });
11000
11030
  }
@@ -11141,16 +11171,16 @@ function flattenError(error52, mapper = (issue2) => issue2.message) {
11141
11171
  }
11142
11172
  function formatError(error52, mapper = (issue2) => issue2.message) {
11143
11173
  const fieldErrors = { _errors: [] };
11144
- const processError = (error53, path23 = []) => {
11174
+ const processError = (error53, path24 = []) => {
11145
11175
  for (const issue2 of error53.issues) {
11146
11176
  if (issue2.code === "invalid_union" && issue2.errors.length) {
11147
- issue2.errors.map((issues) => processError({ issues }, [...path23, ...issue2.path]));
11177
+ issue2.errors.map((issues) => processError({ issues }, [...path24, ...issue2.path]));
11148
11178
  } else if (issue2.code === "invalid_key") {
11149
- processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
11179
+ processError({ issues: issue2.issues }, [...path24, ...issue2.path]);
11150
11180
  } else if (issue2.code === "invalid_element") {
11151
- processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
11181
+ processError({ issues: issue2.issues }, [...path24, ...issue2.path]);
11152
11182
  } else {
11153
- const fullpath = [...path23, ...issue2.path];
11183
+ const fullpath = [...path24, ...issue2.path];
11154
11184
  if (fullpath.length === 0) {
11155
11185
  fieldErrors._errors.push(mapper(issue2));
11156
11186
  } else {
@@ -11177,17 +11207,17 @@ function formatError(error52, mapper = (issue2) => issue2.message) {
11177
11207
  }
11178
11208
  function treeifyError(error52, mapper = (issue2) => issue2.message) {
11179
11209
  const result = { errors: [] };
11180
- const processError = (error53, path23 = []) => {
11210
+ const processError = (error53, path24 = []) => {
11181
11211
  var _a3, _b;
11182
11212
  for (const issue2 of error53.issues) {
11183
11213
  if (issue2.code === "invalid_union" && issue2.errors.length) {
11184
- issue2.errors.map((issues) => processError({ issues }, [...path23, ...issue2.path]));
11214
+ issue2.errors.map((issues) => processError({ issues }, [...path24, ...issue2.path]));
11185
11215
  } else if (issue2.code === "invalid_key") {
11186
- processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
11216
+ processError({ issues: issue2.issues }, [...path24, ...issue2.path]);
11187
11217
  } else if (issue2.code === "invalid_element") {
11188
- processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
11218
+ processError({ issues: issue2.issues }, [...path24, ...issue2.path]);
11189
11219
  } else {
11190
- const fullpath = [...path23, ...issue2.path];
11220
+ const fullpath = [...path24, ...issue2.path];
11191
11221
  if (fullpath.length === 0) {
11192
11222
  result.errors.push(mapper(issue2));
11193
11223
  continue;
@@ -11219,8 +11249,8 @@ function treeifyError(error52, mapper = (issue2) => issue2.message) {
11219
11249
  }
11220
11250
  function toDotPath(_path) {
11221
11251
  const segs = [];
11222
- const path23 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
11223
- for (const seg of path23) {
11252
+ const path24 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
11253
+ for (const seg of path24) {
11224
11254
  if (typeof seg === "number")
11225
11255
  segs.push(`[${seg}]`);
11226
11256
  else if (typeof seg === "symbol")
@@ -23912,13 +23942,13 @@ function resolveRef(ref, ctx) {
23912
23942
  if (!ref.startsWith("#")) {
23913
23943
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
23914
23944
  }
23915
- const path23 = ref.slice(1).split("/").filter(Boolean);
23916
- if (path23.length === 0) {
23945
+ const path24 = ref.slice(1).split("/").filter(Boolean);
23946
+ if (path24.length === 0) {
23917
23947
  return ctx.rootSchema;
23918
23948
  }
23919
23949
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
23920
- if (path23[0] === defsKey) {
23921
- const key = path23[1];
23950
+ if (path24[0] === defsKey) {
23951
+ const key = path24[1];
23922
23952
  if (!key || !ctx.defs[key]) {
23923
23953
  throw new Error(`Reference not found: ${ref}`);
23924
23954
  }
@@ -24330,9 +24360,9 @@ config(en_default());
24330
24360
  import { randomUUID as randomUUID2 } from "node:crypto";
24331
24361
  import { AsyncLocalStorage } from "node:async_hooks";
24332
24362
  var resolvedDuringInvocation = new AsyncLocalStorage();
24333
- function valueAtPath(root, path23) {
24363
+ function valueAtPath(root, path24) {
24334
24364
  let current = root;
24335
- for (const key of path23) {
24365
+ for (const key of path24) {
24336
24366
  if (current === null || typeof current !== "object") return void 0;
24337
24367
  if (!Object.hasOwn(current, key)) return void 0;
24338
24368
  current = current[key];
@@ -24492,8 +24522,8 @@ function parseLinkTarget(input) {
24492
24522
  const host = u3.hostname.startsWith("[") ? u3.hostname.slice(1, -1) : u3.hostname;
24493
24523
  if (!host) throw new Error(`URL "${input}" is missing a host.`);
24494
24524
  const port = u3.port ? Number(u3.port) : u3.protocol === "https:" ? 443 : 80;
24495
- const path23 = u3.pathname === "/" ? "" : u3.pathname.replace(/\/+$/, "");
24496
- const url2 = `${u3.protocol}//${u3.host}${path23}`;
24525
+ const path24 = u3.pathname === "/" ? "" : u3.pathname.replace(/\/+$/, "");
24526
+ const url2 = `${u3.protocol}//${u3.host}${path24}`;
24497
24527
  const token = u3.username ? decodeURIComponent(u3.username) : void 0;
24498
24528
  return { url: url2, host, port, ...token ? { token } : {} };
24499
24529
  }
@@ -24682,9 +24712,9 @@ function untrackArchive(archive) {
24682
24712
  process.removeListener("exit", removePendingArchives);
24683
24713
  }
24684
24714
  function sha256File(filePath) {
24685
- return new Promise((resolve11, reject) => {
24715
+ return new Promise((resolve12, reject) => {
24686
24716
  const hash2 = createHash2("sha256");
24687
- createReadStream(filePath).on("data", (chunk) => hash2.update(chunk)).on("end", () => resolve11(hash2.digest("hex"))).on("error", reject);
24717
+ createReadStream(filePath).on("data", (chunk) => hash2.update(chunk)).on("end", () => resolve12(hash2.digest("hex"))).on("error", reject);
24688
24718
  });
24689
24719
  }
24690
24720
  function toolServerError(text2) {
@@ -24792,6 +24822,9 @@ async function prepareFileInputs(specs, args, opts) {
24792
24822
  );
24793
24823
  }
24794
24824
  }
24825
+ if (spec.kind === "probe" && spec.collect === "step" && opts.includeContent && opts.collectStepMembers) {
24826
+ wire.members = await opts.collectStepMembers(record2, opts);
24827
+ }
24795
24828
  if (spec.kind === "tar-upload") {
24796
24829
  const st = await stat2(filePath).catch(() => null);
24797
24830
  if (st) {
@@ -24918,14 +24951,14 @@ function printable(text2) {
24918
24951
  (c2) => c2 < " " || c2 === "\x7F" ? `\\u${c2.charCodeAt(0).toString(16).padStart(4, "0")}` : c2
24919
24952
  ).join("");
24920
24953
  }
24921
- function isResolvedAbsolute(value) {
24954
+ function isResolvedAbsolute2(value) {
24922
24955
  return typeof value === "string" && path5.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
24923
24956
  }
24924
24957
  function namesValidFlow(args) {
24925
24958
  const { project_root, flow_path, name } = args;
24926
- if (!isResolvedAbsolute(project_root)) return false;
24959
+ if (!isResolvedAbsolute2(project_root)) return false;
24927
24960
  if (name === void 0) {
24928
- return isResolvedAbsolute(flow_path) && FLOW_FILE_NAME_PATTERN.test(path5.basename(flow_path));
24961
+ return isResolvedAbsolute2(flow_path) && FLOW_FILE_NAME_PATTERN.test(path5.basename(flow_path));
24929
24962
  }
24930
24963
  return flow_path === void 0 && typeof name === "string" && FLOW_NAME_PATTERN.test(name);
24931
24964
  }
@@ -25088,52 +25121,15 @@ async function sendBytes(member, real, budget, opts) {
25088
25121
  bytes
25089
25122
  };
25090
25123
  }
25091
- async function collectBaselineMembers(canonical, flowName, snapshots, args, roots, budget, opts, sent, emit) {
25092
- const dir = path5.join(
25093
- path5.dirname(canonical),
25094
- "__baselines__",
25095
- baselineKeyFor(canonical, flowName)
25096
- );
25097
- const real = (await landing(dir)).canonical;
25098
- if (!roots.some((root) => isWithin(real, root))) return;
25099
- const updates = args.updateBaselines === true;
25100
- if (updates) opts.baselineDirs?.push(dir);
25101
- const platform = callPlatform(args);
25102
- const prefixes = snapshots.map(
25103
- (name) => `${name}__${platform === void 0 ? "" : `${platform}-`}`
25104
- );
25105
- const names = await readdir4(dir).catch(() => []);
25106
- for (const name of names.sort()) {
25107
- if (!name.endsWith(".png")) continue;
25108
- if (!updates && !prefixes.some((prefix) => name.startsWith(prefix))) continue;
25109
- const file2 = path5.join(dir, name);
25110
- if (sent.has(file2)) continue;
25111
- const member = { role: "baseline", key: file2, path: file2 };
25112
- const entry = await baselineEntry(file2, roots, updates);
25113
- if (entry.state === "refused") {
25114
- emit({ ...member, state: "refused", error: entry.error }, `refused (${entry.error})`);
25115
- } else if (entry.state === "missing") {
25116
- emit({ ...member, state: "missing" }, "missing");
25117
- } else if (updates) {
25118
- emit({ ...member, state: "listed" }, "listed");
25119
- } else {
25120
- const sent2 = await sendBytes(member, entry.real, budget, opts);
25121
- emit(sent2.member, sent2.sent);
25122
- }
25123
- }
25124
+ function nestedRunUpdates(parentUpdates, args) {
25125
+ return args.updateBaselines === true || parentUpdates && args.updateBaselines === void 0;
25124
25126
  }
25125
- async function collectFlowMembers(rootPath, rootBytes, args, opts) {
25126
- if (!namesValidFlow(args)) return {};
25127
- const canonical = await canonicalFlowPath(rootPath);
25128
- const spelling = await classifyOnDiskSpelling(
25129
- path5.dirname(rootPath),
25130
- path5.basename(rootPath),
25131
- FLOW_FILE_NAME_PATTERN
25132
- );
25133
- const roots = await closureRoots(rootPath, canonical, args.project_root);
25127
+ function memberCollector(roots, opts) {
25134
25128
  const members = [];
25135
- const seen = /* @__PURE__ */ new Set();
25136
- const snapshots = /* @__PURE__ */ new Set();
25129
+ const flows = /* @__PURE__ */ new Map();
25130
+ const tools2 = /* @__PURE__ */ new Set();
25131
+ const runs = /* @__PURE__ */ new Set();
25132
+ const baselineDirs = /* @__PURE__ */ new Map();
25137
25133
  const budget = { inline: 0 };
25138
25134
  const logging = process.env[FLOW_FILES_LOG_ENV] === "1";
25139
25135
  const log2 = opts.log ?? ((line) => void process.stderr.write(`${line}
@@ -25143,54 +25139,194 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
25143
25139
  const subject = member.role === "flow" ? member.canonical : member.key;
25144
25140
  if (logging) log2(printable(`[flow-files] ${member.role} ${subject}: ${sent}`));
25145
25141
  };
25146
- const queue = [{ canonical, text: rootBytes.toString("utf8"), hop: 0 }];
25147
- for (let file2 = queue.shift(); file2 !== void 0; file2 = queue.shift()) {
25148
- let doc;
25149
- try {
25150
- doc = (0, import_yaml.parse)(file2.text.trim(), { logLevel: "error" });
25151
- } catch {
25152
- continue;
25142
+ async function flow2(anchorDir, target) {
25143
+ const key = flowMemberKey(anchorDir, target);
25144
+ const known = flows.get(key);
25145
+ if (known !== void 0) return known;
25146
+ const { member, text: text2, sent } = await readFlowMember(anchorDir, target, roots, budget, opts);
25147
+ const entry = { member, ...text2 === void 0 ? {} : { text: text2 } };
25148
+ flows.set(key, entry);
25149
+ emit(member, sent);
25150
+ return entry;
25151
+ }
25152
+ async function toolFiles(step) {
25153
+ if (step.tool === "flow-execute") return;
25154
+ for (const file2 of toolStepFiles(opts.toolFileInputs?.(step.tool), step.args)) {
25155
+ const { unwrapWhenSet } = file2.spec;
25156
+ if (unwrapWhenSet !== void 0 && step.args[unwrapWhenSet] !== void 0) continue;
25157
+ if (!isClientFileArgument(file2) || tools2.has(file2.path)) continue;
25158
+ tools2.add(file2.path);
25159
+ const read = await readToolMember(file2.path, roots, budget, opts);
25160
+ emit(read.member, read.sent);
25161
+ }
25162
+ }
25163
+ async function nestedRun(target, hop, updates, platform) {
25164
+ const { member, text: text2 } = await flow2(path5.dirname(target.path), `${target.name}.yaml`);
25165
+ if (text2 === void 0 || hop >= MAX_RUN_DEPTH) return void 0;
25166
+ return { canonical: member.canonical, text: text2, flowName: target.name, hop, updates, platform };
25167
+ }
25168
+ async function walk(start) {
25169
+ const queue = [...start];
25170
+ for (let run2 = queue.shift(); run2 !== void 0; run2 = queue.shift()) {
25171
+ const id = [run2.canonical, run2.flowName, run2.updates, run2.platform ?? ""].join("\0");
25172
+ if (runs.has(id)) continue;
25173
+ runs.add(id);
25174
+ const snapshots = /* @__PURE__ */ new Set();
25175
+ const visited = /* @__PURE__ */ new Set();
25176
+ const files = [{ canonical: run2.canonical, text: run2.text, hop: run2.hop }];
25177
+ for (let file2 = files.shift(); file2 !== void 0; file2 = files.shift()) {
25178
+ let doc;
25179
+ try {
25180
+ doc = (0, import_yaml.parse)(file2.text.trim(), { logLevel: "error" });
25181
+ } catch {
25182
+ continue;
25183
+ }
25184
+ const requests = collectFlowRequests(doc);
25185
+ for (const name of requests.snapshots) snapshots.add(name);
25186
+ for (const step of requests.toolSteps) await toolFiles(step);
25187
+ const anchorDir = path5.dirname(file2.canonical);
25188
+ for (const target of requests.runTargets) {
25189
+ const key = flowMemberKey(anchorDir, target);
25190
+ if (visited.has(key)) continue;
25191
+ visited.add(key);
25192
+ const { member, text: text2 } = await flow2(anchorDir, target);
25193
+ if (text2 !== void 0 && file2.hop + 1 < MAX_RUN_DEPTH) {
25194
+ files.push({ canonical: member.canonical, text: text2, hop: file2.hop + 1 });
25195
+ }
25196
+ }
25197
+ for (const { target, args } of requests.nested) {
25198
+ if (target.kind !== "name") continue;
25199
+ const next = await nestedRun(
25200
+ target,
25201
+ file2.hop + 1,
25202
+ nestedRunUpdates(run2.updates, args),
25203
+ run2.platform
25204
+ );
25205
+ if (next !== void 0) queue.push(next);
25206
+ }
25207
+ }
25208
+ if (snapshots.size === 0) continue;
25209
+ const dir = path5.join(
25210
+ path5.dirname(run2.canonical),
25211
+ "__baselines__",
25212
+ baselineKeyFor(run2.canonical, run2.flowName)
25213
+ );
25214
+ const entry = baselineDirs.get(dir) ?? { prefixes: /* @__PURE__ */ new Set(), updates: false };
25215
+ baselineDirs.set(dir, entry);
25216
+ if (run2.updates) {
25217
+ entry.updates = true;
25218
+ } else {
25219
+ const platform = run2.platform === void 0 ? "" : `${run2.platform}-`;
25220
+ for (const name of snapshots) entry.prefixes.add(`${name}__${platform}`);
25221
+ }
25222
+ }
25223
+ }
25224
+ async function sendBaselines() {
25225
+ for (const [dir, { prefixes, updates }] of baselineDirs) {
25226
+ const real = (await landing(dir)).canonical;
25227
+ if (!roots.some((root) => isWithin(real, root))) continue;
25228
+ if (updates) opts.baselineDirs?.push(dir);
25229
+ const names = await readdir4(dir).catch(() => []);
25230
+ for (const name of names.sort()) {
25231
+ if (!name.endsWith(".png")) continue;
25232
+ const compared = [...prefixes].some((prefix) => name.startsWith(prefix));
25233
+ if (!updates && !compared) continue;
25234
+ const file2 = path5.join(dir, name);
25235
+ if (tools2.has(file2)) continue;
25236
+ const member = { role: "baseline", key: file2, path: file2 };
25237
+ const entry = await baselineEntry(file2, roots, updates && !compared);
25238
+ if (entry.state === "refused") {
25239
+ emit({ ...member, state: "refused", error: entry.error }, `refused (${entry.error})`);
25240
+ } else if (entry.state === "missing") {
25241
+ emit({ ...member, state: "missing" }, "missing");
25242
+ } else if (!compared) {
25243
+ emit({ ...member, state: "listed" }, "listed");
25244
+ } else {
25245
+ const sent = await sendBytes(member, entry.real, budget, opts);
25246
+ emit(sent.member, sent.sent);
25247
+ }
25248
+ }
25153
25249
  }
25154
- const requests = collectFlowRequests(doc);
25155
- for (const name of requests.snapshots) snapshots.add(name);
25156
- for (const step of requests.toolSteps) {
25157
- if (step.tool === "flow-execute") continue;
25158
- for (const file3 of toolStepFiles(opts.toolFileInputs?.(step.tool), step.args)) {
25159
- const { unwrapWhenSet } = file3.spec;
25160
- if (unwrapWhenSet !== void 0 && step.args[unwrapWhenSet] !== void 0) continue;
25161
- if (!isClientFileArgument(file3) || seen.has(file3.path)) continue;
25162
- seen.add(file3.path);
25163
- const read = await readToolMember(file3.path, roots, budget, opts);
25164
- emit(read.member, read.sent);
25165
- }
25166
- }
25167
- const anchorDir = path5.dirname(file2.canonical);
25168
- for (const target of requests.runTargets) {
25169
- const key = flowMemberKey(anchorDir, target);
25170
- if (seen.has(key)) continue;
25171
- seen.add(key);
25172
- const { member, text: text2, sent } = await readFlowMember(anchorDir, target, roots, budget, opts);
25173
- emit(member, sent);
25174
- if (text2 !== void 0 && file2.hop + 1 < MAX_RUN_DEPTH) {
25175
- queue.push({ canonical: member.canonical, text: text2, hop: file2.hop + 1 });
25176
- }
25177
- }
25178
- }
25179
- if (snapshots.size > 0) {
25180
- const flowName = path5.basename(rootPath, ".yaml");
25181
- await collectBaselineMembers(
25250
+ }
25251
+ return { members, flow: flow2, toolFiles, nestedRun, walk, sendBaselines };
25252
+ }
25253
+ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
25254
+ if (!namesValidFlow(args)) return {};
25255
+ const canonical = await canonicalFlowPath(rootPath);
25256
+ const spelling = await classifyOnDiskSpelling(
25257
+ path5.dirname(rootPath),
25258
+ path5.basename(rootPath),
25259
+ FLOW_FILE_NAME_PATTERN
25260
+ );
25261
+ const collector = memberCollector(
25262
+ await closureRoots(rootPath, canonical, args.project_root),
25263
+ opts
25264
+ );
25265
+ await collector.walk([
25266
+ {
25182
25267
  canonical,
25183
- flowName,
25184
- [...snapshots],
25185
- args,
25186
- roots,
25187
- budget,
25188
- opts,
25189
- seen,
25190
- emit
25191
- );
25268
+ text: rootBytes.toString("utf8"),
25269
+ flowName: path5.basename(rootPath, ".yaml"),
25270
+ hop: 0,
25271
+ updates: args.updateBaselines === true,
25272
+ platform: callPlatform(args)
25273
+ }
25274
+ ]);
25275
+ await collector.sendBaselines();
25276
+ return { canonical, spelling, members: collector.members };
25277
+ }
25278
+ function recordedStep(args) {
25279
+ const { command, args: text2 } = args;
25280
+ if (typeof command !== "string") return void 0;
25281
+ if (text2 === void 0) return { tool: command, args: {} };
25282
+ if (typeof text2 !== "string") return void 0;
25283
+ let parsed;
25284
+ try {
25285
+ parsed = JSON.parse(text2);
25286
+ } catch {
25287
+ return void 0;
25192
25288
  }
25193
- return { canonical, spelling, members };
25289
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
25290
+ return { tool: command, args: parsed };
25291
+ }
25292
+ async function collectStepMembers(args, opts) {
25293
+ const { name, project_root: projectRoot } = args;
25294
+ const step = recordedStep(args);
25295
+ if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || typeof projectRoot !== "string" || !path5.isAbsolute(projectRoot) || step === void 0) {
25296
+ return [];
25297
+ }
25298
+ const recording = path5.join(projectRoot, ".argent", "flows", `${name}.yaml`);
25299
+ const collector = memberCollector(
25300
+ await closureRoots(recording, (await landing(recording)).canonical, projectRoot),
25301
+ opts
25302
+ );
25303
+ await collector.toolFiles(step);
25304
+ if (step.tool === "flow-execute") {
25305
+ const self2 = await collector.flow(path5.dirname(recording), path5.basename(recording));
25306
+ let runArgs = step.args;
25307
+ const named = nestedFlowTarget(runArgs);
25308
+ if (named?.kind === "flow_path") {
25309
+ const stem = path5.basename(named.path, ".yaml");
25310
+ if (path5.resolve(path5.dirname(named.path)) === path5.resolve(path5.dirname(recording))) {
25311
+ await collector.flow(path5.dirname(recording), path5.basename(named.path));
25312
+ runArgs = { ...runArgs, name: stem };
25313
+ delete runArgs.flow_path;
25314
+ }
25315
+ }
25316
+ const target = nestedFlowTarget(runArgs);
25317
+ if (target?.kind === "name") {
25318
+ await collector.flow(path5.dirname(self2.member.canonical), `${target.name}.yaml`);
25319
+ const run2 = await collector.nestedRun(
25320
+ target,
25321
+ 0,
25322
+ runArgs.updateBaselines === true,
25323
+ callPlatform(runArgs)
25324
+ );
25325
+ if (run2 !== void 0) await collector.walk([run2]);
25326
+ }
25327
+ }
25328
+ await collector.sendBaselines();
25329
+ return collector.members;
25194
25330
  }
25195
25331
 
25196
25332
  // ../argent-tools-client/src/tools-client.ts
@@ -25362,6 +25498,7 @@ function createToolsClient(options = {}) {
25362
25498
  log: diagnose,
25363
25499
  baselineDirs,
25364
25500
  collectMembers: collectFlowMembers,
25501
+ collectStepMembers,
25365
25502
  toolFileInputs: (tool) => tools2.find((t2) => t2.name === tool)?.fileInputs,
25366
25503
  signal: opts?.signal
25367
25504
  });
@@ -25372,7 +25509,11 @@ function createToolsClient(options = {}) {
25372
25509
  diagnose(`The baseline ${file2} was not written on this client: ${error52}`);
25373
25510
  }
25374
25511
  if (process.env.ARGENT_FLOW_FILES_LOG === "1") {
25375
- for (const file2 of applied.written) diagnose(`[flow-files] baseline ${file2}: written`);
25512
+ for (const file2 of applied.written) {
25513
+ if (baselineDirs.includes(path6.dirname(file2))) {
25514
+ diagnose(`[flow-files] baseline ${file2}: written`);
25515
+ }
25516
+ }
25376
25517
  }
25377
25518
  return applied.result;
25378
25519
  };
@@ -25384,6 +25525,9 @@ function createToolsClient(options = {}) {
25384
25525
  method: "POST",
25385
25526
  headers: {
25386
25527
  "Content-Type": "application/json",
25528
+ // Tells the tool-server the call came over a link, a link to
25529
+ // 127.0.0.1 included, which nothing else in the request shows.
25530
+ ...remote ? { [LINKED_CALL_HEADER]: "1" } : {},
25387
25531
  // A proxy that compresses the stream holds each line until its buffer
25388
25532
  // fills. `identity` keeps the stream uncompressed end to end.
25389
25533
  ...stream ? { "Accept": "application/x-ndjson", "Accept-Encoding": "identity" } : {},
@@ -25444,12 +25588,12 @@ function createToolsClient(options = {}) {
25444
25588
  import { copyFile, mkdir as mkdir4, readFile as readFile5, realpath as realpath4, rm as rm3, stat as stat4, writeFile as writeFile4 } from "node:fs/promises";
25445
25589
  import { constants as fsConstants } from "node:fs";
25446
25590
  import { tmpdir as tmpdir2 } from "node:os";
25447
- import { basename as basename6, dirname as dirname7, extname as extname2, isAbsolute as isAbsolute5, join as join11, normalize as normalize2, resolve as resolve6, sep as sep4 } from "node:path";
25591
+ import { basename as basename6, dirname as dirname8, extname as extname2, isAbsolute as isAbsolute6, join as join11, normalize as normalize2, resolve as resolve7, sep as sep4 } from "node:path";
25448
25592
  import { createHash as createHash3 } from "node:crypto";
25449
25593
 
25450
25594
  // ../configuration-core/src/flags.ts
25451
25595
  import * as fs3 from "node:fs";
25452
- import * as path6 from "node:path";
25596
+ import * as path7 from "node:path";
25453
25597
  import { homedir as homedir3 } from "node:os";
25454
25598
  var FLAG_REGISTRY = [
25455
25599
  {
@@ -25491,26 +25635,26 @@ function getFlagDefinition(name, registry2 = FLAG_REGISTRY) {
25491
25635
  }
25492
25636
  var PROJECT_MARKERS = [".argent", ".git", "package.json"];
25493
25637
  function findProjectRoot(startDir) {
25494
- let current = path6.resolve(startDir);
25638
+ let current = path7.resolve(startDir);
25495
25639
  while (true) {
25496
25640
  for (const marker of PROJECT_MARKERS) {
25497
- if (fs3.existsSync(path6.join(current, marker))) return current;
25641
+ if (fs3.existsSync(path7.join(current, marker))) return current;
25498
25642
  }
25499
- const parent = path6.dirname(current);
25643
+ const parent = path7.dirname(current);
25500
25644
  if (parent === current) return null;
25501
25645
  current = parent;
25502
25646
  }
25503
25647
  }
25504
25648
  function resolveProjectRoot(startDir) {
25505
- return findProjectRoot(startDir) ?? path6.resolve(startDir);
25649
+ return findProjectRoot(startDir) ?? path7.resolve(startDir);
25506
25650
  }
25507
25651
  function getFlagsPath(scope, options = {}) {
25508
25652
  const home = options.homeDir ?? homedir3();
25509
25653
  if (scope === "global") {
25510
- return path6.join(home, ".argent", "flags.json");
25654
+ return path7.join(home, ".argent", "flags.json");
25511
25655
  }
25512
25656
  const cwd = options.cwd ?? process.cwd();
25513
- return path6.join(resolveProjectRoot(cwd), ".argent", "flags.json");
25657
+ return path7.join(resolveProjectRoot(cwd), ".argent", "flags.json");
25514
25658
  }
25515
25659
  function readFlagsFile(filePath) {
25516
25660
  let raw;
@@ -25537,7 +25681,7 @@ function readFlagsFile(filePath) {
25537
25681
  function writeFlagsFile(filePath, flags2) {
25538
25682
  if (Object.keys(flags2).length === 0) {
25539
25683
  if (fs3.existsSync(filePath)) fs3.rmSync(filePath, { force: true });
25540
- const parent = path6.dirname(filePath);
25684
+ const parent = path7.dirname(filePath);
25541
25685
  try {
25542
25686
  if (fs3.existsSync(parent) && fs3.readdirSync(parent).length === 0) {
25543
25687
  fs3.rmdirSync(parent);
@@ -25546,7 +25690,7 @@ function writeFlagsFile(filePath, flags2) {
25546
25690
  }
25547
25691
  return;
25548
25692
  }
25549
- fs3.mkdirSync(path6.dirname(filePath), { recursive: true });
25693
+ fs3.mkdirSync(path7.dirname(filePath), { recursive: true });
25550
25694
  const tmp = `${filePath}.${process.pid}.tmp`;
25551
25695
  fs3.writeFileSync(tmp, JSON.stringify({ flags: flags2 }, null, 2) + "\n");
25552
25696
  fs3.renameSync(tmp, filePath);
@@ -25578,7 +25722,7 @@ function isFlagEnabled(name, options = {}) {
25578
25722
 
25579
25723
  // ../configuration-core/src/paths.ts
25580
25724
  import * as os from "node:os";
25581
- import * as path7 from "node:path";
25725
+ import * as path8 from "node:path";
25582
25726
  function nonEmpty(value) {
25583
25727
  if (value == void 0) return null;
25584
25728
  const trimmed = value.trim();
@@ -25589,23 +25733,23 @@ function resolveHomeDir(options = {}) {
25589
25733
  return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
25590
25734
  }
25591
25735
  function argentHomeDir() {
25592
- return path7.join(resolveHomeDir(), ".argent");
25736
+ return path8.join(resolveHomeDir(), ".argent");
25593
25737
  }
25594
25738
  function configDir(scope = "global", options = {}) {
25595
25739
  if (scope === "global") {
25596
- return path7.join(resolveHomeDir(options), ".argent");
25740
+ return path8.join(resolveHomeDir(options), ".argent");
25597
25741
  }
25598
25742
  const cwd = options.cwd ?? process.cwd();
25599
- return path7.join(resolveProjectRoot(cwd), ".argent");
25743
+ return path8.join(resolveProjectRoot(cwd), ".argent");
25600
25744
  }
25601
25745
  function configFilePath(scope = "global", options = {}) {
25602
- return path7.join(configDir(scope, options), "config.json");
25746
+ return path8.join(configDir(scope, options), "config.json");
25603
25747
  }
25604
25748
 
25605
25749
  // ../configuration-core/src/config.ts
25606
25750
  import * as crypto from "node:crypto";
25607
25751
  import * as fs4 from "node:fs";
25608
- import * as path8 from "node:path";
25752
+ import * as path9 from "node:path";
25609
25753
  function readConfigObject(scope = "global", options = {}) {
25610
25754
  try {
25611
25755
  const raw = fs4.readFileSync(configFilePath(scope, options), "utf8");
@@ -25723,7 +25867,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
25723
25867
  try {
25724
25868
  const next = readConfigObject(scope, options);
25725
25869
  mutate(next);
25726
- const tmpPath = path8.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
25870
+ const tmpPath = path9.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
25727
25871
  const fd = fs4.openSync(tmpPath, "wx", 384);
25728
25872
  try {
25729
25873
  fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
@@ -25748,7 +25892,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
25748
25892
  // ../configuration-core/src/secrets.ts
25749
25893
  var import_dotenv = __toESM(require_main(), 1);
25750
25894
  import * as fs5 from "node:fs";
25751
- import * as path9 from "node:path";
25895
+ import * as path10 from "node:path";
25752
25896
  var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
25753
25897
  var SECRETS_FILE_NAME = "secrets.env";
25754
25898
  var SHARED_ENV_FILES = [".env.local", ".env"];
@@ -25810,20 +25954,20 @@ function secretSources(options = {}) {
25810
25954
  const filePaths = [];
25811
25955
  if (projectRoot) {
25812
25956
  filePaths.push({
25813
- path: path9.join(projectRoot, ".argent", SECRETS_FILE_NAME),
25957
+ path: path10.join(projectRoot, ".argent", SECRETS_FILE_NAME),
25814
25958
  exposure: "dedicated"
25815
25959
  });
25816
25960
  for (const name of SHARED_ENV_FILES) {
25817
- filePaths.push({ path: path9.join(projectRoot, name), exposure: "shared" });
25961
+ filePaths.push({ path: path10.join(projectRoot, name), exposure: "shared" });
25818
25962
  }
25819
25963
  }
25820
25964
  filePaths.push({
25821
- path: path9.join(resolveHomeDir(options), ".argent", SECRETS_FILE_NAME),
25965
+ path: path10.join(resolveHomeDir(options), ".argent", SECRETS_FILE_NAME),
25822
25966
  exposure: "dedicated"
25823
25967
  });
25824
25968
  const seen = /* @__PURE__ */ new Set();
25825
25969
  for (const entry of filePaths) {
25826
- const resolved = path9.resolve(entry.path);
25970
+ const resolved = path10.resolve(entry.path);
25827
25971
  if (seen.has(resolved)) continue;
25828
25972
  seen.add(resolved);
25829
25973
  sources.push(fileSource(resolved, entry.exposure));
@@ -25888,7 +26032,7 @@ function applyMergePolicy(policy, local, global2) {
25888
26032
  }
25889
26033
 
25890
26034
  // ../configuration-core/src/config-schema.ts
25891
- import { isAbsolute as isAbsolute4 } from "node:path";
26035
+ import { isAbsolute as isAbsolute5 } from "node:path";
25892
26036
  function asBoolean(raw) {
25893
26037
  return typeof raw === "boolean" ? raw : void 0;
25894
26038
  }
@@ -25970,7 +26114,7 @@ var CONFIG_SCHEMA = [
25970
26114
  scopes: ["project", "global"],
25971
26115
  parse: (raw) => {
25972
26116
  const value = asString(raw);
25973
- return value !== void 0 && (value === "~" || value.startsWith("~/") || isAbsolute4(value)) ? value : void 0;
26117
+ return value !== void 0 && (value === "~" || value.startsWith("~/") || isAbsolute5(value)) ? value : void 0;
25974
26118
  },
25975
26119
  expected: "an absolute path, or one starting with `~/`",
25976
26120
  merge: "prioritize-local",
@@ -26021,7 +26165,7 @@ function getConfigDefinition(key, registry2 = CONFIG_SCHEMA) {
26021
26165
  }
26022
26166
 
26023
26167
  // ../configuration-core/src/config-access.ts
26024
- import * as path10 from "node:path";
26168
+ import * as path11 from "node:path";
26025
26169
  function readScopeValue(def, scope, options) {
26026
26170
  if (!def.scopes.includes(scope)) return void 0;
26027
26171
  const raw = getAtPath(readConfigObject(scope, options), def.key);
@@ -26181,7 +26325,7 @@ function artifactDir(deviceId) {
26181
26325
  }
26182
26326
  function durableBaseDir() {
26183
26327
  const projectRoot = findProjectRoot(process.cwd());
26184
- return projectRoot ?? dirname7(argentHomeDir());
26328
+ return projectRoot ?? dirname8(argentHomeDir());
26185
26329
  }
26186
26330
  var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
26187
26331
  var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
@@ -26195,9 +26339,9 @@ function configuredRecordingsDir() {
26195
26339
  if (typeof value !== "string") return null;
26196
26340
  const trimmed = value.trim();
26197
26341
  if (trimmed === "") return null;
26198
- const home = dirname7(argentHomeDir());
26342
+ const home = dirname8(argentHomeDir());
26199
26343
  const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep4}`) ? join11(home, trimmed.slice(2)) : trimmed;
26200
- return resolve6(durableBaseDir(), expanded);
26344
+ return resolve7(durableBaseDir(), expanded);
26201
26345
  }
26202
26346
  var MAX_DURABLE_BYTES = 2 * 1024 * 1024 * 1024;
26203
26347
  async function readCapped(res, cap) {
@@ -26230,10 +26374,10 @@ async function writeDurableUnique(dir, filename, write) {
26230
26374
  const stem = filename.slice(0, filename.length - ext.length);
26231
26375
  for (let i2 = 1; i2 <= 1e3; i2++) {
26232
26376
  const candidate = i2 === 1 ? filename : `${stem} (${i2})${ext}`;
26233
- const path23 = join11(dir, candidate);
26377
+ const path24 = join11(dir, candidate);
26234
26378
  try {
26235
- await write(path23);
26236
- return path23;
26379
+ await write(path24);
26380
+ return path24;
26237
26381
  } catch (err) {
26238
26382
  if (err?.code === "EEXIST") continue;
26239
26383
  throw err;
@@ -26244,7 +26388,7 @@ async function writeDurableUnique(dir, filename, write) {
26244
26388
  function durableSaveTarget(handle) {
26245
26389
  if (typeof handle.saveDir !== "string" || !handle.saveDir || handle.archive) return null;
26246
26390
  const rel = normalize2(handle.saveDir);
26247
- if (isAbsolute5(rel) || rel === ".." || rel.startsWith(`..${sep4}`) || rel.split(sep4).includes("..")) {
26391
+ if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${sep4}`) || rel.split(sep4).includes("..")) {
26248
26392
  return null;
26249
26393
  }
26250
26394
  if (!ALLOWED_SAVE_DIRS.has(rel)) return null;
@@ -26839,8 +26983,8 @@ var Deferred = class {
26839
26983
  _resolve;
26840
26984
  _reject;
26841
26985
  constructor() {
26842
- this._promise = new Promise((resolve11, reject) => {
26843
- this._resolve = resolve11;
26986
+ this._promise = new Promise((resolve12, reject) => {
26987
+ this._resolve = resolve12;
26844
26988
  this._reject = reject;
26845
26989
  });
26846
26990
  }
@@ -27733,8 +27877,8 @@ var ExportOperation = class {
27733
27877
  _metrics;
27734
27878
  _exportScheduledResolve;
27735
27879
  constructor(exporter, logRecords, exportTimeoutMillis, metrics) {
27736
- this._exportScheduledPromise = new Promise((resolve11) => {
27737
- this._exportScheduledResolve = resolve11;
27880
+ this._exportScheduledPromise = new Promise((resolve12) => {
27881
+ this._exportScheduledResolve = resolve12;
27738
27882
  });
27739
27883
  this._exportCompleted = this._executeExport(exporter, logRecords, exportTimeoutMillis);
27740
27884
  this._metrics = metrics;
@@ -27759,7 +27903,7 @@ var ExportOperation = class {
27759
27903
  }
27760
27904
  }
27761
27905
  async _exportWithTimeout(exporter, logRecords, exportTimeoutMillis) {
27762
- return new Promise((resolve11, reject) => {
27906
+ return new Promise((resolve12, reject) => {
27763
27907
  const timer = setTimeout(() => {
27764
27908
  reject(new Error("Timeout"));
27765
27909
  }, exportTimeoutMillis);
@@ -27767,7 +27911,7 @@ var ExportOperation = class {
27767
27911
  this._metrics.finishLogs(logRecords.length, result.error);
27768
27912
  clearTimeout(timer);
27769
27913
  if (result.code === ExportResultCode.SUCCESS) {
27770
- resolve11();
27914
+ resolve12();
27771
27915
  } else {
27772
27916
  reject(result.error ?? new Error("BatchLogRecordProcessor: log record export failed"));
27773
27917
  }
@@ -28548,7 +28692,7 @@ function parseRetryAfterToMills(retryAfter) {
28548
28692
  var DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${VERSION4}`;
28549
28693
  var MAX_RESPONSE_BODY_SIZE = 4 * 1024 * 1024;
28550
28694
  function sendWithHttp(request, url2, headers, compression, userAgent, agent, data, timeoutMillis) {
28551
- return new Promise((resolve11) => {
28695
+ return new Promise((resolve12) => {
28552
28696
  const parsedUrl = new URL(url2);
28553
28697
  if (userAgent) {
28554
28698
  headers["User-Agent"] = `${userAgent} ${DEFAULT_USER_AGENT}`;
@@ -28567,7 +28711,7 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
28567
28711
  responseSize += chunk.length;
28568
28712
  if (responseSize > MAX_RESPONSE_BODY_SIZE) {
28569
28713
  const sizeError = new Error(`OTLP export response body exceeded size limit of ${MAX_RESPONSE_BODY_SIZE} bytes`);
28570
- resolve11({ status: "failure", error: sizeError });
28714
+ resolve12({ status: "failure", error: sizeError });
28571
28715
  res.destroy();
28572
28716
  return;
28573
28717
  }
@@ -28575,18 +28719,18 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
28575
28719
  });
28576
28720
  res.on("end", () => {
28577
28721
  if (res.statusCode && res.statusCode <= 299) {
28578
- resolve11({
28722
+ resolve12({
28579
28723
  status: "success",
28580
28724
  data: Buffer.concat(responseData)
28581
28725
  });
28582
28726
  } else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
28583
- resolve11({
28727
+ resolve12({
28584
28728
  status: "retryable",
28585
28729
  retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
28586
28730
  });
28587
28731
  } else {
28588
28732
  const error52 = new OTLPExporterError(res.statusMessage, res.statusCode, Buffer.concat(responseData).toString());
28589
- resolve11({
28733
+ resolve12({
28590
28734
  status: "failure",
28591
28735
  error: error52
28592
28736
  });
@@ -28594,17 +28738,17 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
28594
28738
  });
28595
28739
  res.on("error", (error52) => {
28596
28740
  if (res.statusCode && res.statusCode <= 299) {
28597
- resolve11({
28741
+ resolve12({
28598
28742
  status: "success"
28599
28743
  });
28600
28744
  } else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
28601
- resolve11({
28745
+ resolve12({
28602
28746
  status: "retryable",
28603
28747
  error: error52,
28604
28748
  retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
28605
28749
  });
28606
28750
  } else {
28607
- resolve11({
28751
+ resolve12({
28608
28752
  status: "failure",
28609
28753
  error: error52
28610
28754
  });
@@ -28613,26 +28757,26 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
28613
28757
  });
28614
28758
  req.setTimeout(timeoutMillis, () => {
28615
28759
  req.destroy();
28616
- resolve11({
28760
+ resolve12({
28617
28761
  status: "retryable",
28618
28762
  error: new Error("Request timed out")
28619
28763
  });
28620
28764
  });
28621
28765
  req.on("error", (error52) => {
28622
28766
  if (isHttpTransportNetworkErrorRetryable(error52)) {
28623
- resolve11({
28767
+ resolve12({
28624
28768
  status: "retryable",
28625
28769
  error: error52
28626
28770
  });
28627
28771
  } else {
28628
- resolve11({
28772
+ resolve12({
28629
28773
  status: "failure",
28630
28774
  error: error52
28631
28775
  });
28632
28776
  }
28633
28777
  });
28634
28778
  compressAndSend(req, compression, data, (error52) => {
28635
- resolve11({
28779
+ resolve12({
28636
28780
  status: "failure",
28637
28781
  error: error52
28638
28782
  });
@@ -28722,9 +28866,9 @@ var RetryingTransport = class {
28722
28866
  this._transport = transport;
28723
28867
  }
28724
28868
  retry(data, timeoutMillis, inMillis) {
28725
- return new Promise((resolve11, reject) => {
28869
+ return new Promise((resolve12, reject) => {
28726
28870
  setTimeout(() => {
28727
- this._transport.send(data, timeoutMillis).then(resolve11, reject);
28871
+ this._transport.send(data, timeoutMillis).then(resolve12, reject);
28728
28872
  }, inMillis);
28729
28873
  });
28730
28874
  }
@@ -28838,7 +28982,7 @@ init_esm();
28838
28982
 
28839
28983
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-node-http-env-configuration.js
28840
28984
  import * as fs6 from "fs";
28841
- import * as path11 from "path";
28985
+ import * as path12 from "path";
28842
28986
  init_esm();
28843
28987
  function getStaticHeadersFromEnv(signalIdentifier) {
28844
28988
  const signalSpecificRawHeaders = getStringFromEnv(`OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`);
@@ -28859,7 +29003,7 @@ function appendRootPathToUrlIfNeeded(url2) {
28859
29003
  return void 0;
28860
29004
  }
28861
29005
  }
28862
- function appendResourcePathToUrl(url2, path23) {
29006
+ function appendResourcePathToUrl(url2, path24) {
28863
29007
  try {
28864
29008
  new URL(url2);
28865
29009
  } catch {
@@ -28869,11 +29013,11 @@ function appendResourcePathToUrl(url2, path23) {
28869
29013
  if (!url2.endsWith("/")) {
28870
29014
  url2 = url2 + "/";
28871
29015
  }
28872
- url2 += path23;
29016
+ url2 += path24;
28873
29017
  try {
28874
29018
  new URL(url2);
28875
29019
  } catch {
28876
- diag2.warn(`Configuration: Provided URL appended with '${path23}' is not a valid URL, using 'undefined' instead of '${url2}'`);
29020
+ diag2.warn(`Configuration: Provided URL appended with '${path24}' is not a valid URL, using 'undefined' instead of '${url2}'`);
28877
29021
  return void 0;
28878
29022
  }
28879
29023
  return url2;
@@ -28898,7 +29042,7 @@ function readFileFromEnv(signalSpecificEnvVar, nonSignalSpecificEnvVar, warningM
28898
29042
  const filePath = signalSpecificPath ?? nonSignalSpecificPath;
28899
29043
  if (filePath != null) {
28900
29044
  try {
28901
- return fs6.readFileSync(path11.resolve(process.cwd(), filePath));
29045
+ return fs6.readFileSync(path12.resolve(process.cwd(), filePath));
28902
29046
  } catch {
28903
29047
  diag2.warn(warningMessage);
28904
29048
  return void 0;
@@ -28987,12 +29131,12 @@ init_esm();
28987
29131
  import * as fs7 from "node:fs";
28988
29132
 
28989
29133
  // ../telemetry/src/paths.ts
28990
- import * as path12 from "node:path";
29134
+ import * as path13 from "node:path";
28991
29135
  function identityFilePath() {
28992
- return path12.join(argentHomeDir(), "telemetry-id");
29136
+ return path13.join(argentHomeDir(), "telemetry-id");
28993
29137
  }
28994
29138
  function debugLogPath() {
28995
- return path12.join(argentHomeDir(), "telemetry-debug.log");
29139
+ return path13.join(argentHomeDir(), "telemetry-debug.log");
28996
29140
  }
28997
29141
 
28998
29142
  // ../telemetry/src/debug.ts
@@ -29525,9 +29669,9 @@ function isReplitAgent(env) {
29525
29669
  }
29526
29670
  var DEVIN_MARKER_PATH = "/opt/.devin";
29527
29671
  var JULES_MARKER_PATH = "/opt/environment_summary.sh";
29528
- function safeExists(fileExists, path23) {
29672
+ function safeExists(fileExists, path24) {
29529
29673
  try {
29530
- return fileExists(path23);
29674
+ return fileExists(path24);
29531
29675
  } catch {
29532
29676
  return false;
29533
29677
  }
@@ -29948,7 +30092,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
29948
30092
  var SESSION_ID2 = randomUUID5();
29949
30093
  function readCliVersion() {
29950
30094
  if (true) {
29951
- return "0.27.1-next.22";
30095
+ return "0.27.1-next.23";
29952
30096
  }
29953
30097
  return "0.0.0";
29954
30098
  }
@@ -29982,7 +30126,7 @@ function getBaseProps(runtime) {
29982
30126
  // ../telemetry/src/identity.ts
29983
30127
  import * as crypto2 from "node:crypto";
29984
30128
  import * as fs8 from "node:fs";
29985
- import * as path13 from "node:path";
30129
+ import * as path14 from "node:path";
29986
30130
  var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
29987
30131
  var cached2 = null;
29988
30132
  var fingerprintResolved = null;
@@ -30095,7 +30239,7 @@ function writeIdFileAtomic(finalPath, id) {
30095
30239
  if (occupant && !occupant.isFile()) {
30096
30240
  throw new Error("telemetry: refusing to replace a non-regular file at the identity path");
30097
30241
  }
30098
- const tmpPath = path13.join(
30242
+ const tmpPath = path14.join(
30099
30243
  argentHomeDir(),
30100
30244
  `.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
30101
30245
  );
@@ -30119,7 +30263,7 @@ function mintRandomId(finalPath) {
30119
30263
  fs8.mkdirSync(argentHomeDir(), { recursive: true });
30120
30264
  let value = crypto2.randomUUID();
30121
30265
  for (let attempt = 0; attempt < 3; attempt++) {
30122
- const tmpPath = path13.join(
30266
+ const tmpPath = path14.join(
30123
30267
  argentHomeDir(),
30124
30268
  `.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
30125
30269
  );
@@ -30164,7 +30308,7 @@ function mintRandomId(finalPath) {
30164
30308
  throw new Error("telemetry: failed to create identity after retries");
30165
30309
  }
30166
30310
  function claimCorruptOccupant(finalPath) {
30167
- const claimed = path13.join(
30311
+ const claimed = path14.join(
30168
30312
  argentHomeDir(),
30169
30313
  `.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
30170
30314
  );
@@ -30206,12 +30350,12 @@ function tryReadId(filePath) {
30206
30350
  import { execFileSync as execFileSync2, spawn as spawn2 } from "node:child_process";
30207
30351
 
30208
30352
  // ../native-devtools-ios/src/index.ts
30209
- import * as path14 from "node:path";
30353
+ import * as path15 from "node:path";
30210
30354
  import * as fs9 from "node:fs";
30211
- var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path14.join(__dirname, "..", "dylibs");
30212
- var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path14.join(__dirname, "..", "bin");
30213
- var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path14.join(DYLIB_DIR, "tcp");
30214
- var DYLIB_TVOS_DIR = path14.join(DYLIB_DIR, "tvos");
30355
+ var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path15.join(__dirname, "..", "dylibs");
30356
+ var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path15.join(__dirname, "..", "bin");
30357
+ var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path15.join(DYLIB_DIR, "tcp");
30358
+ var DYLIB_TVOS_DIR = path15.join(DYLIB_DIR, "tvos");
30215
30359
  function hostPlatformKey() {
30216
30360
  if (process.platform === "linux" && process.arch === "arm64") {
30217
30361
  return "linux-arm64";
@@ -30222,13 +30366,13 @@ function simulatorServerBinaryName() {
30222
30366
  return process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
30223
30367
  }
30224
30368
  function platformBinDir() {
30225
- return path14.join(BIN_DIR, hostPlatformKey());
30369
+ return path15.join(BIN_DIR, hostPlatformKey());
30226
30370
  }
30227
30371
  function simulatorServerBinaryPath() {
30228
30372
  const binaryName = simulatorServerBinaryName();
30229
- const p = path14.join(platformBinDir(), binaryName);
30373
+ const p = path15.join(platformBinDir(), binaryName);
30230
30374
  if (!fs9.existsSync(p)) {
30231
- const flat = path14.join(BIN_DIR, binaryName);
30375
+ const flat = path15.join(BIN_DIR, binaryName);
30232
30376
  const migrationHint = fs9.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
30233
30377
  throw new Error(
30234
30378
  `simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
@@ -30258,12 +30402,12 @@ function resolveHostFingerprint() {
30258
30402
  }
30259
30403
  }
30260
30404
  function resolveHostFingerprintAsync() {
30261
- return new Promise((resolve11) => {
30405
+ return new Promise((resolve12) => {
30262
30406
  let binary;
30263
30407
  try {
30264
30408
  binary = simulatorServerBinaryPath();
30265
30409
  } catch {
30266
- resolve11(null);
30410
+ resolve12(null);
30267
30411
  return;
30268
30412
  }
30269
30413
  let settled = false;
@@ -30276,7 +30420,7 @@ function resolveHostFingerprintAsync() {
30276
30420
  child?.kill("SIGKILL");
30277
30421
  } catch {
30278
30422
  }
30279
- resolve11(value);
30423
+ resolve12(value);
30280
30424
  };
30281
30425
  const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
30282
30426
  watchdog.unref?.();
@@ -30490,7 +30634,7 @@ var DRAIN_GRACE_MS = 250;
30490
30634
  async function raceDrain(client2, timeoutMs) {
30491
30635
  await Promise.race([
30492
30636
  client2.shutdown(timeoutMs),
30493
- new Promise((resolve11) => setTimeout(resolve11, timeoutMs + DRAIN_GRACE_MS).unref())
30637
+ new Promise((resolve12) => setTimeout(resolve12, timeoutMs + DRAIN_GRACE_MS).unref())
30494
30638
  ]);
30495
30639
  }
30496
30640
  async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
@@ -30914,13 +31058,13 @@ function splitOptions(argv) {
30914
31058
  return { json: json2, outPath, argvForFlags: rest };
30915
31059
  }
30916
31060
  async function readStdin() {
30917
- return new Promise((resolve11, reject) => {
31061
+ return new Promise((resolve12, reject) => {
30918
31062
  let data = "";
30919
31063
  process.stdin.setEncoding("utf8");
30920
31064
  process.stdin.on("data", (chunk) => {
30921
31065
  data += chunk;
30922
31066
  });
30923
- process.stdin.on("end", () => resolve11(data));
31067
+ process.stdin.on("end", () => resolve12(data));
30924
31068
  process.stdin.on("error", reject);
30925
31069
  });
30926
31070
  }
@@ -30952,7 +31096,7 @@ async function fetchImageToFile(result, outPath) {
30952
31096
  const res = await fetch(url2);
30953
31097
  if (!res.ok) throw new Error(`Failed to download image: ${res.status} ${res.statusText}`);
30954
31098
  const buf = Buffer.from(await res.arrayBuffer());
30955
- fs11.mkdirSync(path15.dirname(path15.resolve(outPath)), { recursive: true });
31099
+ fs11.mkdirSync(path16.dirname(path16.resolve(outPath)), { recursive: true });
30956
31100
  fs11.writeFileSync(outPath, buf);
30957
31101
  }
30958
31102
  function renderResult(result, outputHint, images, json2) {
@@ -31147,7 +31291,7 @@ Examples:
31147
31291
  if (outPath && meta3.outputHint === "image") {
31148
31292
  try {
31149
31293
  if (images.length > 0) {
31150
- fs11.mkdirSync(path15.dirname(path15.resolve(outPath)), { recursive: true });
31294
+ fs11.mkdirSync(path16.dirname(path16.resolve(outPath)), { recursive: true });
31151
31295
  fs11.writeFileSync(outPath, images[0].data);
31152
31296
  } else if (result && typeof result === "object") {
31153
31297
  await fetchImageToFile(result, outPath);
@@ -31174,7 +31318,7 @@ Examples:
31174
31318
  import * as fsp from "node:fs/promises";
31175
31319
  import { constants as fsConstants2 } from "node:fs";
31176
31320
  import { createHash as createHash5 } from "node:crypto";
31177
- import * as path16 from "node:path";
31321
+ import * as path17 from "node:path";
31178
31322
 
31179
31323
  // ../argent-cli/src/command-args.ts
31180
31324
  var UsageError = class extends Error {
@@ -31301,13 +31445,19 @@ counts the remaining flows skipped.
31301
31445
 
31302
31446
  The CLI sends a run to its tool-server: the local one that starts
31303
31447
  automatically, or the one that \`argent link\` or ARGENT_TOOLS_URL names. Over
31304
- a link, the CLI uploads the flow file, the run: fragments that it reaches and
31305
- the snapshot baselines that the run compares. It also uploads each .png or
31306
- .yaml file that a tool: step takes as a file argument by an absolute path. The
31307
- CLI writes the new baselines that the run returns. The tool-server rejects the
31308
- flow before the first step when the flow or a fragment has one of these steps:
31448
+ a link, the CLI uploads these files and writes the new baselines that the run
31449
+ returns:
31450
+ - the flow file and the run: fragments that it reaches
31451
+ - each flow that a tool: flow-execute step names with name (a nested flow)
31452
+ - the snapshot baselines of each run
31453
+ - each .png or .yaml file that a tool: step takes as a file argument by an
31454
+ absolute path
31455
+ The tool-server rejects the flow before the first step when the flow, a
31456
+ fragment or a nested flow has one of these steps:
31309
31457
  - a script: step
31310
- - a tool: step that runs or records a flow
31458
+ - a tool: flow-execute step that does not name its flow with name and an
31459
+ absolute project_root that has no .. segment
31460
+ - a tool: step that records a flow
31311
31461
  - a tool: step that takes a directory, an app or an output directory
31312
31462
  - a tool: step whose tool builds a file path from several arguments
31313
31463
  - a tool: step that names a relative path or a file other than .png or .yaml
@@ -31323,7 +31473,9 @@ Options (run):
31323
31473
  --device <id> Device id to run against (auto-detected when omitted)
31324
31474
  --platform <p> ios | android | chromium | vega | ios-remote \u2014 narrow
31325
31475
  auto-detection (ios never picks a remote simulator)
31326
- --update-baselines Write/refresh screenshot baselines instead of diffing
31476
+ --update-baselines Write/refresh screenshot baselines instead of diffing,
31477
+ also those of flows that tool: flow-execute steps run,
31478
+ unless such a step sets updateBaselines
31327
31479
  --output <dir> Also write failed snapshot images (baseline/current/diff)
31328
31480
  and failed-step screenshots (step-<n>-screen.png)
31329
31481
  under <dir>/<flow>/ \u2014 a stable path for CI artifact
@@ -31498,28 +31650,28 @@ function renderFailedFlows(failed) {
31498
31650
  }
31499
31651
  var SAFE_ARTIFACT_NAME = FLOW_NAME_PATTERN;
31500
31652
  var SAFE_FLOW_NAME = FLOW_NAME_PATTERN;
31501
- var FLOWS_DIR = path16.join(".argent", "flows");
31653
+ var FLOWS_DIR = path17.join(".argent", "flows");
31502
31654
  var SHELL_SAFE_ARG = /^(?!=)[A-Za-z0-9_@%+=:,./-]+$/;
31503
31655
  function shellQuoteArg(arg) {
31504
31656
  if (SHELL_SAFE_ARG.test(arg)) return arg;
31505
31657
  return `'${arg.replaceAll("'", "'\\''")}'`;
31506
31658
  }
31507
31659
  function rerunCommand(flowPath, rel, projectRoot, args) {
31508
- const pathArg = (p) => shellQuoteArg(p.startsWith("-") ? `.${path16.sep}${p}` : p);
31509
- const fromCwd = path16.relative(projectRoot, flowPath);
31510
- const shown = path16.isAbsolute(fromCwd) || fromCwd.split(/[\\/]+/).includes("..") ? flowPath : fromCwd;
31660
+ const pathArg = (p) => shellQuoteArg(p.startsWith("-") ? `.${path17.sep}${p}` : p);
31661
+ const fromCwd = path17.relative(projectRoot, flowPath);
31662
+ const shown = path17.isAbsolute(fromCwd) || fromCwd.split(/[\\/]+/).includes("..") ? flowPath : fromCwd;
31511
31663
  const parts = ["argent flow run", pathArg(shown)];
31512
31664
  if (args.device) parts.push("--device", shellQuoteArg(args.device));
31513
31665
  if (args.platform) parts.push("--platform", shellQuoteArg(args.platform));
31514
31666
  if (args.updateBaselines) parts.push("--update-baselines");
31515
- if (args.output) parts.push("--output", pathArg(path16.join(args.output, path16.dirname(rel))));
31667
+ if (args.output) parts.push("--output", pathArg(path17.join(args.output, path17.dirname(rel))));
31516
31668
  return parts.join(" ");
31517
31669
  }
31518
31670
  var EXPORT_SOURCE_MARKER = ".argent-flow-source";
31519
31671
  var MARKER_READ_RETRIES = 4;
31520
31672
  var MARKER_READ_DELAY_MS = 5;
31521
31673
  async function readExportMarker(dir) {
31522
- const marker = path16.join(dir, EXPORT_SOURCE_MARKER);
31674
+ const marker = path17.join(dir, EXPORT_SOURCE_MARKER);
31523
31675
  for (let attempt = 0; ; attempt++) {
31524
31676
  let owner;
31525
31677
  try {
@@ -31529,7 +31681,7 @@ async function readExportMarker(dir) {
31529
31681
  }
31530
31682
  if (owner) return owner;
31531
31683
  if (attempt === MARKER_READ_RETRIES) return null;
31532
- await new Promise((resolve11) => setTimeout(resolve11, MARKER_READ_DELAY_MS));
31684
+ await new Promise((resolve12) => setTimeout(resolve12, MARKER_READ_DELAY_MS));
31533
31685
  }
31534
31686
  }
31535
31687
  async function classifyExportDir(dir, flowPath) {
@@ -31554,7 +31706,7 @@ function occupiedBy(owner) {
31554
31706
  async function takeExportDir(dir, flowPath) {
31555
31707
  try {
31556
31708
  await fsp.mkdir(dir, { recursive: true });
31557
- await fsp.writeFile(path16.join(dir, EXPORT_SOURCE_MARKER), `${flowPath}
31709
+ await fsp.writeFile(path17.join(dir, EXPORT_SOURCE_MARKER), `${flowPath}
31558
31710
  `, { flag: "wx" });
31559
31711
  return null;
31560
31712
  } catch (err) {
@@ -31573,7 +31725,7 @@ async function claimExportDirName(outputDir, flowPath, stem) {
31573
31725
  }
31574
31726
  const avoided = [];
31575
31727
  for (const name of candidates) {
31576
- const dir = path16.join(outputDir, name);
31728
+ const dir = path17.join(outputDir, name);
31577
31729
  const claim = await classifyExportDir(dir, flowPath);
31578
31730
  const reason = claim.state === "foreign" ? occupiedBy(claim.owner) : await takeExportDir(dir, flowPath);
31579
31731
  if (reason !== null) {
@@ -31593,7 +31745,7 @@ async function claimExportDirName(outputDir, flowPath, stem) {
31593
31745
  return null;
31594
31746
  }
31595
31747
  async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
31596
- const stem = path16.basename(flowPath, ".yaml");
31748
+ const stem = path17.basename(flowPath, ".yaml");
31597
31749
  if (!SAFE_ARTIFACT_NAME.test(stem)) {
31598
31750
  console.error(
31599
31751
  `warning: skipping artifact export for unsafe flow filename ${JSON.stringify(stem)}`
@@ -31626,11 +31778,11 @@ async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
31626
31778
  if (dir === null) {
31627
31779
  const dirName = await claimExportDirName(outputDir, flowPath, stem);
31628
31780
  if (dirName === null) return;
31629
- dir = path16.join(outputDir, dirName);
31781
+ dir = path17.join(outputDir, dirName);
31630
31782
  }
31631
- const dest = path16.join(dir, fileName(role));
31632
- const rel = path16.relative(outputDir, dest);
31633
- if (rel.startsWith("..") || path16.isAbsolute(rel)) continue;
31783
+ const dest = path17.join(dir, fileName(role));
31784
+ const rel = path17.relative(outputDir, dest);
31785
+ if (rel.startsWith("..") || path17.isAbsolute(rel)) continue;
31634
31786
  try {
31635
31787
  await fsp.copyFile(value, dest);
31636
31788
  s.artifacts[role] = dest;
@@ -31645,7 +31797,7 @@ async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
31645
31797
  function keyFromBaselinePath(artifacts) {
31646
31798
  const baseline = artifacts.baseline;
31647
31799
  if (typeof baseline !== "string") return null;
31648
- return path16.basename(baseline).replace(/\.png$/, "");
31800
+ return path17.basename(baseline).replace(/\.png$/, "");
31649
31801
  }
31650
31802
  function resolveArtifactDisplayPaths(report) {
31651
31803
  for (const s of report.steps) {
@@ -31657,7 +31809,7 @@ function resolveArtifactDisplayPaths(report) {
31657
31809
  }
31658
31810
  function exitAfterFlush(code, streams = [process.stdout, process.stderr]) {
31659
31811
  return Promise.all(
31660
- streams.map((s) => new Promise((resolve11) => s.write("", () => resolve11())))
31812
+ streams.map((s) => new Promise((resolve12) => s.write("", () => resolve12())))
31661
31813
  ).then(() => process.exit(code));
31662
31814
  }
31663
31815
  function renderReport(report) {
@@ -31702,36 +31854,36 @@ async function collectRunnableFlowPaths(dir, relDir = "") {
31702
31854
  const found = [];
31703
31855
  const entries = await fsp.readdir(dir, { withFileTypes: true });
31704
31856
  for (const entry of entries) {
31705
- const rel = relDir ? path16.join(relDir, entry.name) : entry.name;
31857
+ const rel = relDir ? path17.join(relDir, entry.name) : entry.name;
31706
31858
  if (entry.isDirectory()) {
31707
31859
  if (entry.name === "__baselines__") continue;
31708
31860
  found.push(
31709
- ...await collectRunnableFlowPaths(path16.join(dir, entry.name), rel).catch(() => [])
31861
+ ...await collectRunnableFlowPaths(path17.join(dir, entry.name), rel).catch(() => [])
31710
31862
  );
31711
31863
  continue;
31712
31864
  }
31713
31865
  if (!entry.name.endsWith(".yaml")) continue;
31714
- if (!SAFE_FLOW_NAME.test(path16.basename(entry.name, ".yaml"))) continue;
31715
- if (await isRunnableFlowFile(path16.join(dir, entry.name))) found.push(rel);
31866
+ if (!SAFE_FLOW_NAME.test(path17.basename(entry.name, ".yaml"))) continue;
31867
+ if (await isRunnableFlowFile(path17.join(dir, entry.name))) found.push(rel);
31716
31868
  }
31717
31869
  return found;
31718
31870
  }
31719
31871
  function resolveFlowRef(ref) {
31720
31872
  if (!SAFE_FLOW_NAME.test(ref)) return { suppliedPath: ref, fromName: false };
31721
- return { suppliedPath: path16.join(FLOWS_DIR, `${ref}.yaml`), fromName: true };
31873
+ return { suppliedPath: path17.join(FLOWS_DIR, `${ref}.yaml`), fromName: true };
31722
31874
  }
31723
31875
  async function savedFlowHint(projectRoot, missingPath) {
31724
- const dir = path16.resolve(projectRoot, FLOWS_DIR);
31725
- const within = path16.relative(dir, missingPath);
31726
- if (!within.startsWith("..") && !path16.isAbsolute(within)) return "";
31727
- const wanted = `${path16.basename(missingPath, ".yaml")}.yaml`;
31876
+ const dir = path17.resolve(projectRoot, FLOWS_DIR);
31877
+ const within = path17.relative(dir, missingPath);
31878
+ if (!within.startsWith("..") && !path17.isAbsolute(within)) return "";
31879
+ const wanted = `${path17.basename(missingPath, ".yaml")}.yaml`;
31728
31880
  const entries = await fsp.readdir(dir).catch(() => null);
31729
31881
  if (entries === null) return "";
31730
31882
  const actual = entries.includes(wanted) ? wanted : entries.find((name2) => name2.toLowerCase() === wanted.toLowerCase());
31731
31883
  if (actual === void 0) return "";
31732
- const name = path16.basename(actual, ".yaml");
31884
+ const name = path17.basename(actual, ".yaml");
31733
31885
  if (!SAFE_FLOW_NAME.test(name)) return "";
31734
- if (!await isRunnableFlowFile(path16.join(dir, actual))) return "";
31886
+ if (!await isRunnableFlowFile(path17.join(dir, actual))) return "";
31735
31887
  return `
31736
31888
  A flow named "${name}" is saved under ${FLOWS_DIR} \u2014 did you mean: argent flow run ${name}`;
31737
31889
  }
@@ -31739,17 +31891,17 @@ async function collectFlowFiles(dir, recursive) {
31739
31891
  const found = [];
31740
31892
  const walk = async (current, rel) => {
31741
31893
  for (const entry of await fsp.readdir(current, { withFileTypes: true })) {
31742
- const entryRel = rel ? path16.join(rel, entry.name) : entry.name;
31894
+ const entryRel = rel ? path17.join(rel, entry.name) : entry.name;
31743
31895
  if (entry.isDirectory()) {
31744
31896
  if (recursive && !entry.name.startsWith(".") && entry.name !== "node_modules") {
31745
- await walk(path16.join(current, entry.name), entryRel).catch(() => {
31897
+ await walk(path17.join(current, entry.name), entryRel).catch(() => {
31746
31898
  });
31747
31899
  }
31748
31900
  continue;
31749
31901
  }
31750
31902
  if (!entry.name.endsWith(".yaml")) continue;
31751
- if (!SAFE_FLOW_NAME.test(path16.basename(entry.name, ".yaml"))) continue;
31752
- if (await isRunnableFlowFile(path16.join(current, entry.name))) found.push(entryRel);
31903
+ if (!SAFE_FLOW_NAME.test(path17.basename(entry.name, ".yaml"))) continue;
31904
+ if (await isRunnableFlowFile(path17.join(current, entry.name))) found.push(entryRel);
31753
31905
  }
31754
31906
  };
31755
31907
  await walk(dir, "");
@@ -31877,7 +32029,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
31877
32029
  );
31878
32030
  }
31879
32031
  const { callTool, baseUrl } = runToolsClient(args, options);
31880
- const outputBase = args.output ? path16.resolve(args.output) : void 0;
32032
+ const outputBase = args.output ? path17.resolve(args.output) : void 0;
31881
32033
  const results = [];
31882
32034
  const failures = [];
31883
32035
  const batchStartedAt = Date.now();
@@ -31890,7 +32042,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
31890
32042
  if (!args.json) console.log(` ${STATUS_GLYPH.skip} not run (batch stopped)`);
31891
32043
  continue;
31892
32044
  }
31893
- const flowPath = path16.join(dir, rel);
32045
+ const flowPath = path17.join(dir, rel);
31894
32046
  const rerun = rerunCommand(flowPath, rel, projectRoot, args);
31895
32047
  let report;
31896
32048
  try {
@@ -31923,7 +32075,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
31923
32075
  }
31924
32076
  await exportAndResolveArtifacts(
31925
32077
  report,
31926
- outputBase ? path16.join(outputBase, path16.dirname(rel)) : void 0,
32078
+ outputBase ? path17.join(outputBase, path17.dirname(rel)) : void 0,
31927
32079
  flowPath,
31928
32080
  baseUrl
31929
32081
  );
@@ -31968,9 +32120,9 @@ async function flow(argv, options) {
31968
32120
  return;
31969
32121
  }
31970
32122
  if (sub === "list") {
31971
- const dir = path16.join(process.cwd(), FLOWS_DIR);
32123
+ const dir = path17.join(process.cwd(), FLOWS_DIR);
31972
32124
  try {
31973
- const paths = (await collectRunnableFlowPaths(dir)).sort().map((rel) => path16.join(FLOWS_DIR, rel));
32125
+ const paths = (await collectRunnableFlowPaths(dir)).sort().map((rel) => path17.join(FLOWS_DIR, rel));
31974
32126
  if (paths.length === 0) console.log("No flows found in .argent/flows");
31975
32127
  else console.log(paths.join("\n"));
31976
32128
  } catch {
@@ -32022,10 +32174,10 @@ async function flow(argv, options) {
32022
32174
  const { suppliedPath, fromName } = resolveFlowRef(args.flowRef);
32023
32175
  if (suppliedPath.split(/[\\/]+/).includes("..")) {
32024
32176
  let recovery = "Pass the fully resolved path to the flow's YAML.";
32025
- const suppliedBase2 = path16.basename(suppliedPath);
32177
+ const suppliedBase2 = path17.basename(suppliedPath);
32026
32178
  if (suppliedBase2 !== ".." && suppliedBase2 !== ".") {
32027
32179
  try {
32028
- const resolved = path16.join(await fsp.realpath(path16.dirname(suppliedPath)), suppliedBase2);
32180
+ const resolved = path17.join(await fsp.realpath(path17.dirname(suppliedPath)), suppliedBase2);
32029
32181
  await fsp.stat(resolved);
32030
32182
  recovery = `Did you mean: argent flow run ${shellQuoteArg(resolved)}`;
32031
32183
  } catch {
@@ -32037,7 +32189,7 @@ async function flow(argv, options) {
32037
32189
  2
32038
32190
  );
32039
32191
  }
32040
- const resolvedPath = path16.resolve(projectRoot, suppliedPath);
32192
+ const resolvedPath = path17.resolve(projectRoot, suppliedPath);
32041
32193
  let isDirectory = false;
32042
32194
  try {
32043
32195
  isDirectory = (await fsp.stat(resolvedPath)).isDirectory();
@@ -32060,16 +32212,16 @@ async function flow(argv, options) {
32060
32212
  }
32061
32213
  const separatorTrimmedPath = suppliedPath.replace(/[\\/]+$/, "");
32062
32214
  if (separatorTrimmedPath !== suppliedPath && separatorTrimmedPath !== "") {
32063
- const hint = SAFE_FLOW_NAME.test(separatorTrimmedPath) ? `.${path16.sep}${separatorTrimmedPath}` : separatorTrimmedPath;
32215
+ const hint = SAFE_FLOW_NAME.test(separatorTrimmedPath) ? `.${path17.sep}${separatorTrimmedPath}` : separatorTrimmedPath;
32064
32216
  return fail(
32065
32217
  `Flow path must not end in a path separator \u2014 the separator claims a directory, which the kernel would refuse to open as a file, so the CLI would run a file this string does not name: ${suppliedPath}
32066
32218
  Did you mean: argent flow run ${shellQuoteArg(hint)}`,
32067
32219
  2
32068
32220
  );
32069
32221
  }
32070
- if (path16.extname(suppliedPath) !== ".yaml") {
32071
- const looksLikeName = !suppliedPath.includes("/") && !suppliedPath.includes("\\") && path16.extname(suppliedPath) === "";
32072
- if (path16.basename(suppliedPath).toLowerCase() === ".yaml") {
32222
+ if (path17.extname(suppliedPath) !== ".yaml") {
32223
+ const looksLikeName = !suppliedPath.includes("/") && !suppliedPath.includes("\\") && path17.extname(suppliedPath) === "";
32224
+ if (path17.basename(suppliedPath).toLowerCase() === ".yaml") {
32073
32225
  return fail(
32074
32226
  `Flow filename must have a non-empty name containing only letters, numbers, "_", or "-": ${suppliedPath}`,
32075
32227
  2
@@ -32082,15 +32234,15 @@ Names run \`${FLOWS_DIR}/<name>.yaml\`; pass a path ending in .yaml to run a flo
32082
32234
  2
32083
32235
  );
32084
32236
  }
32085
- if (path16.extname(suppliedPath).toLowerCase() === ".yaml") {
32237
+ if (path17.extname(suppliedPath).toLowerCase() === ".yaml") {
32086
32238
  return fail(
32087
- `Flow extension must be lowercase .yaml, not ${path16.extname(suppliedPath)}: ${suppliedPath}`,
32239
+ `Flow extension must be lowercase .yaml, not ${path17.extname(suppliedPath)}: ${suppliedPath}`,
32088
32240
  2
32089
32241
  );
32090
32242
  }
32091
32243
  return fail(`Flow path must end in .yaml: ${suppliedPath}`, 2);
32092
32244
  }
32093
- const flowName = path16.basename(suppliedPath, ".yaml");
32245
+ const flowName = path17.basename(suppliedPath, ".yaml");
32094
32246
  if (!SAFE_FLOW_NAME.test(flowName)) {
32095
32247
  return fail(
32096
32248
  `Flow filename must have a non-empty name containing only letters, numbers, "_", or "-": ${suppliedPath}`,
@@ -32114,12 +32266,12 @@ No flow named "${args.flowRef}" is saved there \u2014 run \`argent flow list\` t
32114
32266
  }
32115
32267
  return fail(`${detail}: ${flowPath}${recovery}`, 2);
32116
32268
  }
32117
- const suppliedBase = path16.basename(flowPath);
32118
- const siblings = await fsp.readdir(path16.dirname(flowPath)).catch(() => null);
32269
+ const suppliedBase = path17.basename(flowPath);
32270
+ const siblings = await fsp.readdir(path17.dirname(flowPath)).catch(() => null);
32119
32271
  if (siblings !== null && !siblings.includes(suppliedBase)) {
32120
32272
  const actual = siblings.find((name) => name.toLowerCase() === suppliedBase.toLowerCase());
32121
- const actualRunnable = actual !== void 0 && path16.extname(actual) === ".yaml" && SAFE_FLOW_NAME.test(path16.basename(actual, ".yaml"));
32122
- const recovery = actualRunnable ? fromName ? `Did you mean: argent flow run ${path16.basename(actual, ".yaml")}` : `Did you mean: argent flow run ${shellQuoteArg(path16.join(path16.dirname(suppliedPath), actual))}` : actual !== void 0 ? `Rename ${actual} to ${suppliedBase} to run it \u2014 flow files must be lowercase .yaml.` : "Pass the flow file's name exactly as it appears on disk.";
32273
+ const actualRunnable = actual !== void 0 && path17.extname(actual) === ".yaml" && SAFE_FLOW_NAME.test(path17.basename(actual, ".yaml"));
32274
+ const recovery = actualRunnable ? fromName ? `Did you mean: argent flow run ${path17.basename(actual, ".yaml")}` : `Did you mean: argent flow run ${shellQuoteArg(path17.join(path17.dirname(suppliedPath), actual))}` : actual !== void 0 ? `Rename ${actual} to ${suppliedBase} to run it \u2014 flow files must be lowercase .yaml.` : "Pass the flow file's name exactly as it appears on disk.";
32123
32275
  return fail(
32124
32276
  `Flow path must name the file as it appears on disk \u2014 this filesystem matched ${JSON.stringify(suppliedBase)} case-insensitively${actual !== void 0 ? ` to ${JSON.stringify(actual)}` : ""}, so the flow name (which keys the report, __baselines__/, and --output) would be one no file carries: ${suppliedPath}
32125
32277
  ${recovery}`,
@@ -32177,7 +32329,7 @@ ${recovery}`,
32177
32329
  try {
32178
32330
  await exportAndResolveArtifacts(
32179
32331
  report,
32180
- args.output ? path16.resolve(args.output) : void 0,
32332
+ args.output ? path17.resolve(args.output) : void 0,
32181
32333
  flowPath,
32182
32334
  baseUrl
32183
32335
  );
@@ -32292,11 +32444,11 @@ Listing tools contacts the argent tool-server, starting one if none is running.
32292
32444
 
32293
32445
  // ../argent-cli/src/server.ts
32294
32446
  import * as fs12 from "node:fs";
32295
- import * as path17 from "node:path";
32447
+ import * as path18 from "node:path";
32296
32448
  import { homedir as homedir5, networkInterfaces } from "node:os";
32297
32449
  import { spawn as spawn3 } from "node:child_process";
32298
- var STATE_DIR2 = path17.join(homedir5(), ".argent");
32299
- var LOG_FILE2 = path17.join(STATE_DIR2, "tool-server.log");
32450
+ var STATE_DIR2 = path18.join(homedir5(), ".argent");
32451
+ var LOG_FILE2 = path18.join(STATE_DIR2, "tool-server.log");
32300
32452
  async function describeForeignServers(ownBundlePath) {
32301
32453
  const others = (await readAllToolsServerStates()).filter(
32302
32454
  ({ state: state2 }) => state2.bundlePath !== ownBundlePath && isToolsServerProcessAlive(state2.pid)
@@ -32682,7 +32834,7 @@ async function server(argv, options) {
32682
32834
  // ../argent-cli/src/lens.ts
32683
32835
  import * as fs13 from "node:fs";
32684
32836
  import * as os2 from "node:os";
32685
- import * as path18 from "node:path";
32837
+ import * as path19 from "node:path";
32686
32838
 
32687
32839
  // ../argent-cli/src/lens-terminal.ts
32688
32840
  import { execFileSync as execFileSync3 } from "node:child_process";
@@ -32900,12 +33052,12 @@ function isSessionAlive(session) {
32900
33052
  // ../argent-cli/src/lens-pty.ts
32901
33053
  import { chmodSync as chmodSync2, readdirSync as readdirSync2 } from "node:fs";
32902
33054
  import { createRequire } from "node:module";
32903
- import { dirname as dirname10, join as join17 } from "node:path";
33055
+ import { dirname as dirname11, join as join17 } from "node:path";
32904
33056
  var nodeRequire = createRequire(import.meta.url);
32905
33057
  function ensureSpawnHelperExecutable(req = nodeRequire) {
32906
33058
  if (process.platform !== "darwin") return;
32907
33059
  try {
32908
- const prebuilds = join17(dirname10(req.resolve("node-pty/package.json")), "prebuilds");
33060
+ const prebuilds = join17(dirname11(req.resolve("node-pty/package.json")), "prebuilds");
32909
33061
  for (const entry of readdirSync2(prebuilds)) {
32910
33062
  try {
32911
33063
  chmodSync2(join17(prebuilds, entry, "spawn-helper"), 493);
@@ -32940,7 +33092,7 @@ function ptyInjectBeats(text2) {
32940
33092
  ];
32941
33093
  }
32942
33094
  function sleep(ms) {
32943
- return new Promise((resolve11) => setTimeout(resolve11, ms));
33095
+ return new Promise((resolve12) => setTimeout(resolve12, ms));
32944
33096
  }
32945
33097
  var DEFAULT_COLS = 80;
32946
33098
  var DEFAULT_ROWS = 24;
@@ -33161,7 +33313,7 @@ var SPAWN_GRACE_MS = 8e3;
33161
33313
  var DEATH_CONFIRMATIONS = 3;
33162
33314
  var SSE_RECONNECT_MS = 1e3;
33163
33315
  function sleep2(ms) {
33164
- return new Promise((resolve11) => setTimeout(resolve11, ms));
33316
+ return new Promise((resolve12) => setTimeout(resolve12, ms));
33165
33317
  }
33166
33318
  var TRUST_PROMPT_RE = /trust this folder|do you trust|yes,? i trust|trust the files in this/i;
33167
33319
  async function dismissTrustPrompt(session) {
@@ -33432,7 +33584,7 @@ async function lens(argv, options) {
33432
33584
  await endSession(baseUrl);
33433
33585
  process.exit(1);
33434
33586
  }
33435
- const seedFile = path18.join(os2.tmpdir(), `argent-lens-seed-${process.pid}-${Date.now()}.txt`);
33587
+ const seedFile = path19.join(os2.tmpdir(), `argent-lens-seed-${process.pid}-${Date.now()}.txt`);
33436
33588
  fs13.writeFileSync(seedFile, buildSeedPrompt(), "utf8");
33437
33589
  const launchCmd = agent.launch(shellQuote(process.cwd()), shellQuote(seedFile));
33438
33590
  const removeSeedFile = () => {
@@ -33796,7 +33948,7 @@ Options:
33796
33948
 
33797
33949
  // ../argent-cli/src/config.ts
33798
33950
  var import_picocolors2 = __toESM(require_picocolors(), 1);
33799
- import * as path19 from "node:path";
33951
+ import * as path20 from "node:path";
33800
33952
  function config2(argv) {
33801
33953
  if (argv.length === 0 || argv[0] === "--help" || argv[0] === "-h") {
33802
33954
  printUsage();
@@ -33967,16 +34119,16 @@ function wantsHelp(argv) {
33967
34119
  }
33968
34120
  function scopeLabel(scope) {
33969
34121
  if (scope === "global") return "global";
33970
- return `project: ${path19.dirname(configDir("project"))}`;
34122
+ return `project: ${path20.dirname(configDir("project"))}`;
33971
34123
  }
33972
34124
  function degenerateProjectScopeWarning(scope) {
33973
34125
  if (scope !== "project") return null;
33974
34126
  const projDir = configDir("project");
33975
- if (path19.resolve(projDir) === path19.resolve(configDir("global"))) {
33976
- return `WARNING: no project found between ${process.cwd()} and your home directory \u2014 "project" scope resolved to the home directory, so this writes the GLOBAL config file (${path19.join(projDir, "config.json")}).`;
34127
+ if (path20.resolve(projDir) === path20.resolve(configDir("global"))) {
34128
+ return `WARNING: no project found between ${process.cwd()} and your home directory \u2014 "project" scope resolved to the home directory, so this writes the GLOBAL config file (${path20.join(projDir, "config.json")}).`;
33977
34129
  }
33978
34130
  if (findProjectRoot(process.cwd()) === null) {
33979
- return `WARNING: no project markers (.argent, .git, package.json) found above ${process.cwd()} \u2014 treating it as the project root and creating ${path19.join(projDir, "config.json")}.`;
34131
+ return `WARNING: no project markers (.argent, .git, package.json) found above ${process.cwd()} \u2014 treating it as the project root and creating ${path20.join(projDir, "config.json")}.`;
33980
34132
  }
33981
34133
  return null;
33982
34134
  }
@@ -34878,7 +35030,7 @@ import { styleText as styleText2, stripVTControlCharacters } from "node:util";
34878
35030
  import process$1 from "node:process";
34879
35031
  var import_sisteransi2 = __toESM(require_src(), 1);
34880
35032
  import { existsSync as existsSync7, lstatSync as lstatSync3, readdirSync as readdirSync3 } from "node:fs";
34881
- import { dirname as dirname12, join as join20 } from "node:path";
35033
+ import { dirname as dirname13, join as join20 } from "node:path";
34882
35034
  function isUnicodeSupported() {
34883
35035
  if (process$1.platform !== "win32") {
34884
35036
  return process$1.env.TERM !== "linux";
@@ -35863,7 +36015,7 @@ async function cmdDisable(scope) {
35863
36015
  // ../argent-cli/src/providers.ts
35864
36016
  var import_picocolors7 = __toESM(require_picocolors(), 1);
35865
36017
  import * as fs17 from "node:fs";
35866
- import * as path22 from "node:path";
36018
+ import * as path23 from "node:path";
35867
36019
 
35868
36020
  // ../device-providers/src/contract.ts
35869
36021
  var PROVIDER_SCHEMA_VERSION = 1;
@@ -36010,7 +36162,7 @@ var providerEnvelopeSchema = providerRecordSchema.extend({
36010
36162
  // ../device-providers/src/read.ts
36011
36163
  import * as fs14 from "node:fs";
36012
36164
  import * as os3 from "node:os";
36013
- import * as path20 from "node:path";
36165
+ import * as path21 from "node:path";
36014
36166
  var DISABLE_ENV = "ARGENT_DISABLE_DEVICE_PROVIDERS";
36015
36167
  var OVERRIDE_ENV = "ARGENT_DEVICE_PROVIDERS";
36016
36168
  function resolveHomeDir2() {
@@ -36019,7 +36171,7 @@ function resolveHomeDir2() {
36019
36171
  return trimmed ? raw : os3.homedir();
36020
36172
  }
36021
36173
  function providersDirectory() {
36022
- return path20.join(resolveHomeDir2(), ".argent", "providers");
36174
+ return path21.join(resolveHomeDir2(), ".argent", "providers");
36023
36175
  }
36024
36176
  function discoveryDisabled() {
36025
36177
  const raw = process.env[DISABLE_ENV];
@@ -36085,7 +36237,7 @@ function discoverProviders() {
36085
36237
  function descriptorFiles() {
36086
36238
  const directory = providersDirectory();
36087
36239
  try {
36088
- return fs14.readdirSync(directory).filter((name) => name.endsWith(".json")).sort().map((name) => path20.join(directory, name));
36240
+ return fs14.readdirSync(directory).filter((name) => name.endsWith(".json")).sort().map((name) => path21.join(directory, name));
36089
36241
  } catch {
36090
36242
  return [];
36091
36243
  }
@@ -36093,7 +36245,7 @@ function descriptorFiles() {
36093
36245
 
36094
36246
  // ../device-providers/src/write.ts
36095
36247
  import * as fs15 from "node:fs";
36096
- import * as path21 from "node:path";
36248
+ import * as path22 from "node:path";
36097
36249
  var ProviderValidationError = class extends Error {
36098
36250
  /** One line per problem, `path: message`, in the order zod reported them. */
36099
36251
  issues;
@@ -36145,7 +36297,7 @@ function publishProvider(record2, options = {}) {
36145
36297
  );
36146
36298
  }
36147
36299
  const directory = providersDirectory();
36148
- const file2 = path21.join(directory, `${validated.id}.json`);
36300
+ const file2 = path22.join(directory, `${validated.id}.json`);
36149
36301
  const body = JSON.stringify(canonicalize(candidate), null, 2) + "\n";
36150
36302
  try {
36151
36303
  if (fs15.readFileSync(file2, "utf8") === body) return { changed: false, path: file2 };
@@ -36169,7 +36321,7 @@ function withdrawProvider(id) {
36169
36321
  if (!PROVIDER_ID_SHAPE.test(id)) {
36170
36322
  throw new Error(`'${id}' is not a valid provider id (${String(PROVIDER_ID_SHAPE)}).`);
36171
36323
  }
36172
- const file2 = path21.join(providersDirectory(), `${id}.json`);
36324
+ const file2 = path22.join(providersDirectory(), `${id}.json`);
36173
36325
  try {
36174
36326
  fs15.unlinkSync(file2);
36175
36327
  return true;
@@ -36674,7 +36826,7 @@ function runWithdraw(args) {
36674
36826
  throw new UsageError2(`'${id}' is not a valid provider id (${String(PROVIDER_ID_SHAPE)})`);
36675
36827
  }
36676
36828
  const removed = withdrawProvider(id);
36677
- const file2 = path22.join(providersDirectory(), `${id}.json`);
36829
+ const file2 = path23.join(providersDirectory(), `${id}.json`);
36678
36830
  if (args.json) {
36679
36831
  console.log(JSON.stringify({ ok: true, path: file2, removed }, null, 2));
36680
36832
  return;