@swmansion/argent 0.35.1-next.45 → 0.35.1-next.46

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/client.js CHANGED
@@ -4390,10 +4390,10 @@ var require_resolve_block_map = __commonJS({
4390
4390
  let offset = bm.offset;
4391
4391
  let commentEnd = null;
4392
4392
  for (const collItem of bm.items) {
4393
- const { start, key, sep: sep7, value } = collItem;
4393
+ const { start, key, sep: sep8, value } = collItem;
4394
4394
  const keyProps = resolveProps.resolveProps(start, {
4395
4395
  indicator: "explicit-key-ind",
4396
- next: key ?? sep7?.[0],
4396
+ next: key ?? sep8?.[0],
4397
4397
  offset,
4398
4398
  onError,
4399
4399
  parentIndent: bm.indent,
@@ -4407,7 +4407,7 @@ var require_resolve_block_map = __commonJS({
4407
4407
  else if ("indent" in key && key.indent !== bm.indent)
4408
4408
  onError(offset, "BAD_INDENT", startColMsg);
4409
4409
  }
4410
- if (!keyProps.anchor && !keyProps.tag && !sep7) {
4410
+ if (!keyProps.anchor && !keyProps.tag && !sep8) {
4411
4411
  commentEnd = keyProps.end;
4412
4412
  if (keyProps.comment) {
4413
4413
  if (map.comment)
@@ -4431,7 +4431,7 @@ var require_resolve_block_map = __commonJS({
4431
4431
  ctx.atKey = false;
4432
4432
  if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
4433
4433
  onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
4434
- const valueProps = resolveProps.resolveProps(sep7 ?? [], {
4434
+ const valueProps = resolveProps.resolveProps(sep8 ?? [], {
4435
4435
  indicator: "map-value-ind",
4436
4436
  next: value,
4437
4437
  offset: keyNode.range[2],
@@ -4447,7 +4447,7 @@ var require_resolve_block_map = __commonJS({
4447
4447
  if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
4448
4448
  onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
4449
4449
  }
4450
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep7, null, valueProps, onError);
4450
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep8, null, valueProps, onError);
4451
4451
  if (ctx.schema.compat)
4452
4452
  utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
4453
4453
  offset = valueNode.range[2];
@@ -4538,7 +4538,7 @@ var require_resolve_end = __commonJS({
4538
4538
  let comment = "";
4539
4539
  if (end) {
4540
4540
  let hasSpace = false;
4541
- let sep7 = "";
4541
+ let sep8 = "";
4542
4542
  for (const token of end) {
4543
4543
  const { source, type } = token;
4544
4544
  switch (type) {
@@ -4552,13 +4552,13 @@ var require_resolve_end = __commonJS({
4552
4552
  if (!comment)
4553
4553
  comment = cb;
4554
4554
  else
4555
- comment += sep7 + cb;
4556
- sep7 = "";
4555
+ comment += sep8 + cb;
4556
+ sep8 = "";
4557
4557
  break;
4558
4558
  }
4559
4559
  case "newline":
4560
4560
  if (comment)
4561
- sep7 += source;
4561
+ sep8 += source;
4562
4562
  hasSpace = true;
4563
4563
  break;
4564
4564
  default:
@@ -4601,18 +4601,18 @@ var require_resolve_flow_collection = __commonJS({
4601
4601
  let offset = fc.offset + fc.start.source.length;
4602
4602
  for (let i = 0; i < fc.items.length; ++i) {
4603
4603
  const collItem = fc.items[i];
4604
- const { start, key, sep: sep7, value } = collItem;
4604
+ const { start, key, sep: sep8, value } = collItem;
4605
4605
  const props = resolveProps.resolveProps(start, {
4606
4606
  flow: fcName,
4607
4607
  indicator: "explicit-key-ind",
4608
- next: key ?? sep7?.[0],
4608
+ next: key ?? sep8?.[0],
4609
4609
  offset,
4610
4610
  onError,
4611
4611
  parentIndent: fc.indent,
4612
4612
  startOnNewline: false
4613
4613
  });
4614
4614
  if (!props.found) {
4615
- if (!props.anchor && !props.tag && !sep7 && !value) {
4615
+ if (!props.anchor && !props.tag && !sep8 && !value) {
4616
4616
  if (i === 0 && props.comma)
4617
4617
  onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
4618
4618
  else if (i < fc.items.length - 1)
@@ -4666,8 +4666,8 @@ var require_resolve_flow_collection = __commonJS({
4666
4666
  }
4667
4667
  }
4668
4668
  }
4669
- if (!isMap && !sep7 && !props.found) {
4670
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep7, null, props, onError);
4669
+ if (!isMap && !sep8 && !props.found) {
4670
+ const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep8, null, props, onError);
4671
4671
  coll.items.push(valueNode);
4672
4672
  offset = valueNode.range[2];
4673
4673
  if (isBlock(value))
@@ -4679,7 +4679,7 @@ var require_resolve_flow_collection = __commonJS({
4679
4679
  if (isBlock(key))
4680
4680
  onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
4681
4681
  ctx.atKey = false;
4682
- const valueProps = resolveProps.resolveProps(sep7 ?? [], {
4682
+ const valueProps = resolveProps.resolveProps(sep8 ?? [], {
4683
4683
  flow: fcName,
4684
4684
  indicator: "map-value-ind",
4685
4685
  next: value,
@@ -4690,8 +4690,8 @@ var require_resolve_flow_collection = __commonJS({
4690
4690
  });
4691
4691
  if (valueProps.found) {
4692
4692
  if (!isMap && !props.found && ctx.options.strict) {
4693
- if (sep7)
4694
- for (const st of sep7) {
4693
+ if (sep8)
4694
+ for (const st of sep8) {
4695
4695
  if (st === valueProps.found)
4696
4696
  break;
4697
4697
  if (st.type === "newline") {
@@ -4708,7 +4708,7 @@ var require_resolve_flow_collection = __commonJS({
4708
4708
  else
4709
4709
  onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
4710
4710
  }
4711
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep7, null, valueProps, onError) : null;
4711
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep8, null, valueProps, onError) : null;
4712
4712
  if (valueNode) {
4713
4713
  if (isBlock(value))
4714
4714
  onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
@@ -4888,7 +4888,7 @@ var require_resolve_block_scalar = __commonJS({
4888
4888
  chompStart = i + 1;
4889
4889
  }
4890
4890
  let value = "";
4891
- let sep7 = "";
4891
+ let sep8 = "";
4892
4892
  let prevMoreIndented = false;
4893
4893
  for (let i = 0; i < contentStart; ++i)
4894
4894
  value += lines[i][0].slice(trimIndent) + "\n";
@@ -4905,24 +4905,24 @@ var require_resolve_block_scalar = __commonJS({
4905
4905
  indent = "";
4906
4906
  }
4907
4907
  if (type === Scalar.Scalar.BLOCK_LITERAL) {
4908
- value += sep7 + indent.slice(trimIndent) + content;
4909
- sep7 = "\n";
4908
+ value += sep8 + indent.slice(trimIndent) + content;
4909
+ sep8 = "\n";
4910
4910
  } else if (indent.length > trimIndent || content[0] === " ") {
4911
- if (sep7 === " ")
4912
- sep7 = "\n";
4913
- else if (!prevMoreIndented && sep7 === "\n")
4914
- sep7 = "\n\n";
4915
- value += sep7 + indent.slice(trimIndent) + content;
4916
- sep7 = "\n";
4911
+ if (sep8 === " ")
4912
+ sep8 = "\n";
4913
+ else if (!prevMoreIndented && sep8 === "\n")
4914
+ sep8 = "\n\n";
4915
+ value += sep8 + indent.slice(trimIndent) + content;
4916
+ sep8 = "\n";
4917
4917
  prevMoreIndented = true;
4918
4918
  } else if (content === "") {
4919
- if (sep7 === "\n")
4919
+ if (sep8 === "\n")
4920
4920
  value += "\n";
4921
4921
  else
4922
- sep7 = "\n";
4922
+ sep8 = "\n";
4923
4923
  } else {
4924
- value += sep7 + content;
4925
- sep7 = " ";
4924
+ value += sep8 + content;
4925
+ sep8 = " ";
4926
4926
  prevMoreIndented = false;
4927
4927
  }
4928
4928
  }
@@ -5105,25 +5105,25 @@ var require_resolve_flow_scalar = __commonJS({
5105
5105
  trimBoth = /^[ \t]+|[ \t]+$/g;
5106
5106
  }
5107
5107
  let res = match[1].replace(trimEnd, "");
5108
- let sep7 = " ";
5108
+ let sep8 = " ";
5109
5109
  let pos = line.lastIndex;
5110
5110
  while (match = line.exec(source)) {
5111
5111
  const lm = match[1].replace(trimBoth, "");
5112
5112
  if (lm === "") {
5113
- if (sep7 === "\n")
5114
- res += sep7;
5113
+ if (sep8 === "\n")
5114
+ res += sep8;
5115
5115
  else
5116
- sep7 = "\n";
5116
+ sep8 = "\n";
5117
5117
  } else {
5118
- res += sep7 + lm;
5119
- sep7 = " ";
5118
+ res += sep8 + lm;
5119
+ sep8 = " ";
5120
5120
  }
5121
5121
  pos = line.lastIndex;
5122
5122
  }
5123
5123
  const last = /[ \t]*(.*)/sy;
5124
5124
  last.lastIndex = pos;
5125
5125
  match = last.exec(source);
5126
- return res + sep7 + (match?.[1] ?? "");
5126
+ return res + sep8 + (match?.[1] ?? "");
5127
5127
  }
5128
5128
  function doubleQuotedValue(source, onError) {
5129
5129
  let res = "";
@@ -5933,14 +5933,14 @@ var require_cst_stringify = __commonJS({
5933
5933
  }
5934
5934
  }
5935
5935
  }
5936
- function stringifyItem({ start, key, sep: sep7, value }) {
5936
+ function stringifyItem({ start, key, sep: sep8, value }) {
5937
5937
  let res = "";
5938
5938
  for (const st of start)
5939
5939
  res += st.source;
5940
5940
  if (key)
5941
5941
  res += stringifyToken(key);
5942
- if (sep7)
5943
- for (const st of sep7)
5942
+ if (sep8)
5943
+ for (const st of sep8)
5944
5944
  res += st.source;
5945
5945
  if (value)
5946
5946
  res += stringifyToken(value);
@@ -7107,18 +7107,18 @@ var require_parser = __commonJS({
7107
7107
  if (this.type === "map-value-ind") {
7108
7108
  const prev = getPrevProps(this.peek(2));
7109
7109
  const start = getFirstKeyStartProps(prev);
7110
- let sep7;
7110
+ let sep8;
7111
7111
  if (scalar.end) {
7112
- sep7 = scalar.end;
7113
- sep7.push(this.sourceToken);
7112
+ sep8 = scalar.end;
7113
+ sep8.push(this.sourceToken);
7114
7114
  delete scalar.end;
7115
7115
  } else
7116
- sep7 = [this.sourceToken];
7116
+ sep8 = [this.sourceToken];
7117
7117
  const map = {
7118
7118
  type: "block-map",
7119
7119
  offset: scalar.offset,
7120
7120
  indent: scalar.indent,
7121
- items: [{ start, key: scalar, sep: sep7 }]
7121
+ items: [{ start, key: scalar, sep: sep8 }]
7122
7122
  };
7123
7123
  this.onKeyLine = true;
7124
7124
  this.stack[this.stack.length - 1] = map;
@@ -7271,15 +7271,15 @@ var require_parser = __commonJS({
7271
7271
  } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
7272
7272
  const start2 = getFirstKeyStartProps(it.start);
7273
7273
  const key = it.key;
7274
- const sep7 = it.sep;
7275
- sep7.push(this.sourceToken);
7274
+ const sep8 = it.sep;
7275
+ sep8.push(this.sourceToken);
7276
7276
  delete it.key;
7277
7277
  delete it.sep;
7278
7278
  this.stack.push({
7279
7279
  type: "block-map",
7280
7280
  offset: this.offset,
7281
7281
  indent: this.indent,
7282
- items: [{ start: start2, key, sep: sep7 }]
7282
+ items: [{ start: start2, key, sep: sep8 }]
7283
7283
  });
7284
7284
  } else if (start.length > 0) {
7285
7285
  it.sep = it.sep.concat(start, this.sourceToken);
@@ -7473,13 +7473,13 @@ var require_parser = __commonJS({
7473
7473
  const prev = getPrevProps(parent);
7474
7474
  const start = getFirstKeyStartProps(prev);
7475
7475
  fixFlowSeqItems(fc);
7476
- const sep7 = fc.end.splice(1, fc.end.length);
7477
- sep7.push(this.sourceToken);
7476
+ const sep8 = fc.end.splice(1, fc.end.length);
7477
+ sep8.push(this.sourceToken);
7478
7478
  const map = {
7479
7479
  type: "block-map",
7480
7480
  offset: fc.offset,
7481
7481
  indent: fc.indent,
7482
- items: [{ start, key: fc, sep: sep7 }]
7482
+ items: [{ start, key: fc, sep: sep8 }]
7483
7483
  };
7484
7484
  this.onKeyLine = true;
7485
7485
  this.stack[this.stack.length - 1] = map;
@@ -7657,7 +7657,7 @@ var require_public_api = __commonJS({
7657
7657
  }
7658
7658
  return doc;
7659
7659
  }
7660
- function parse2(src, reviver, options) {
7660
+ function parse3(src, reviver, options) {
7661
7661
  let _reviver = void 0;
7662
7662
  if (typeof reviver === "function") {
7663
7663
  _reviver = reviver;
@@ -7698,7 +7698,7 @@ var require_public_api = __commonJS({
7698
7698
  return value.toString(options);
7699
7699
  return new Document.Document(value, _replacer, options).toString(options);
7700
7700
  }
7701
- exports.parse = parse2;
7701
+ exports.parse = parse3;
7702
7702
  exports.parseAllDocuments = parseAllDocuments;
7703
7703
  exports.parseDocument = parseDocument;
7704
7704
  exports.stringify = stringify;
@@ -8055,6 +8055,15 @@ function secretSources(options = {}) {
8055
8055
  function encodeClientSecrets(values) {
8056
8056
  return Buffer.from(JSON.stringify(Object.fromEntries(values)), "utf8").toString("base64");
8057
8057
  }
8058
+ function summarizeSecretSources(sources) {
8059
+ return sources.map(({ values: _values, ...summary }) => ({
8060
+ ...summary,
8061
+ names: [...summary.names]
8062
+ }));
8063
+ }
8064
+ function encodeSecretSourceSummaries(sources) {
8065
+ return Buffer.from(JSON.stringify(sources), "utf8").toString("base64");
8066
+ }
8058
8067
  function lookupSecret(name, sources) {
8059
8068
  for (const source of sources) {
8060
8069
  const value = source.values.get(name);
@@ -8347,14 +8356,14 @@ function findFreePort() {
8347
8356
  });
8348
8357
  }
8349
8358
  function isVersionNewer(a, b) {
8350
- const parse2 = (v) => {
8359
+ const parse3 = (v) => {
8351
8360
  const [core = "", ...preParts] = v.split("+")[0].split("-");
8352
8361
  const nums = core.split(".").map((n) => Number.parseInt(n, 10));
8353
8362
  if (nums.length === 0 || nums.some((n) => Number.isNaN(n))) return null;
8354
8363
  return { nums, pre: preParts.length > 0 ? preParts.join("-").split(".") : [] };
8355
8364
  };
8356
- const pa = parse2(a);
8357
- const pb = parse2(b);
8365
+ const pa = parse3(a);
8366
+ const pb = parse3(b);
8358
8367
  if (!pa || !pb) return false;
8359
8368
  for (let i = 0; i < 3; i++) {
8360
8369
  const x = pa.nums[i] ?? 0;
@@ -8806,6 +8815,7 @@ import * as path13 from "node:path";
8806
8815
  var LINKED_CALL_HEADER = "x-argent-linked";
8807
8816
  var E2E_DIR_CLIENT_HEADER = "x-argent-e2e-dir";
8808
8817
  var CLIENT_SECRETS_HEADER = "x-argent-client-secrets";
8818
+ var CLIENT_SECRET_SOURCES_HEADER = "x-argent-client-secret-sources";
8809
8819
 
8810
8820
  // ../registry/src/artifacts.ts
8811
8821
  import { stat } from "node:fs/promises";
@@ -10486,7 +10496,7 @@ function memberCollector(roots, opts) {
10486
10496
  const runs = /* @__PURE__ */ new Set();
10487
10497
  const baselineDirs = /* @__PURE__ */ new Map();
10488
10498
  const budget = { inline: 0 };
10489
- const logging = filesLogEnabled();
10499
+ const logging = filesLogEnabled() && opts.scanOnly !== true;
10490
10500
  const log = opts.log ?? ((line) => void process.stderr.write(`${line}
10491
10501
  `));
10492
10502
  const emit = (member, sent) => {
@@ -10506,6 +10516,7 @@ function memberCollector(roots, opts) {
10506
10516
  return entry;
10507
10517
  }
10508
10518
  async function toolFiles(step) {
10519
+ if (opts.scanOnly) return;
10509
10520
  if (canonicalToolId(step.tool) === "e2e-execute") return;
10510
10521
  for (const file of toolStepFiles(opts.toolFileInputs?.(step.tool), step.args)) {
10511
10522
  const { unwrapWhenSet } = file.spec;
@@ -10532,6 +10543,12 @@ function memberCollector(roots, opts) {
10532
10543
  if (text === void 0 || hop >= MAX_RUN_DEPTH) return void 0;
10533
10544
  return { canonical: member.canonical, text, flowName: target.name, hop, updates, platform };
10534
10545
  }
10546
+ async function pathRun(target, hop, updates, platform) {
10547
+ const { member, text } = await flow(path12.dirname(target.path), path12.basename(target.path));
10548
+ if (text === void 0 || hop >= MAX_RUN_DEPTH) return void 0;
10549
+ const flowName = path12.basename(target.path, ".yaml");
10550
+ return { canonical: member.canonical, text, flowName, hop, updates, platform };
10551
+ }
10535
10552
  async function runTarget(anchorDir, target) {
10536
10553
  const found = await flow(anchorDir, target);
10537
10554
  if (found.member.spelling?.state !== "absent") return found;
@@ -10571,13 +10588,8 @@ function memberCollector(roots, opts) {
10571
10588
  }
10572
10589
  }
10573
10590
  for (const { target, args } of requests.nested) {
10574
- if (target.kind !== "name") continue;
10575
- const next = await nestedRun(
10576
- target,
10577
- file.hop + 1,
10578
- nestedRunUpdates(run.updates, args),
10579
- run.platform
10580
- );
10591
+ const updates = nestedRunUpdates(run.updates, args);
10592
+ const next = target.kind === "name" ? await nestedRun(target, file.hop + 1, updates, run.platform) : opts.scanOnly ? await pathRun(target, file.hop + 1, updates, run.platform) : void 0;
10581
10593
  if (next !== void 0) queue.push(next);
10582
10594
  }
10583
10595
  }
@@ -10598,6 +10610,7 @@ function memberCollector(roots, opts) {
10598
10610
  }
10599
10611
  }
10600
10612
  async function sendBaselines() {
10613
+ if (opts.scanOnly) return;
10601
10614
  for (const [dir, { prefixes, updates }] of baselineDirs) {
10602
10615
  const real = (await landing(dir)).canonical;
10603
10616
  if (!roots.some((root) => isWithin(real, root))) continue;
@@ -10635,7 +10648,7 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
10635
10648
  FLOW_FILE_NAME_PATTERN
10636
10649
  );
10637
10650
  const collector = memberCollector(
10638
- await closureRoots(rootPath, canonical, args.project_root),
10651
+ opts.scanOnly ? [path12.parse(path12.resolve(rootPath)).root] : await closureRoots(rootPath, canonical, args.project_root),
10639
10652
  opts
10640
10653
  );
10641
10654
  await collector.walk([
@@ -10673,7 +10686,7 @@ async function collectStepMembers(args, opts, recordingDirFor = e2eDirFor) {
10673
10686
  }
10674
10687
  const recording = path12.join(recordingDirFor(projectRoot), `${name}.yaml`);
10675
10688
  const collector = memberCollector(
10676
- await closureRoots(recording, (await landing(recording)).canonical, projectRoot),
10689
+ opts.scanOnly ? [path12.parse(recording).root] : await closureRoots(recording, (await landing(recording)).canonical, projectRoot),
10677
10690
  opts
10678
10691
  );
10679
10692
  await collector.toolFiles(step);
@@ -10919,8 +10932,25 @@ function carriesMembers(args) {
10919
10932
  function carriesUpload(args) {
10920
10933
  return carriesMembers(args) || wiresOf(args).some((wire) => typeof wire.uploadId === "string");
10921
10934
  }
10922
- async function forwardedSecrets(args) {
10923
- if (!isFeatureEnabled("forward-secrets")) return void 0;
10935
+ function secretValues(names, sources) {
10936
+ const values = /* @__PURE__ */ new Map();
10937
+ for (const rawName of names) {
10938
+ const { name, value } = lookupPlaceholderSecret(rawName, sources);
10939
+ if (value !== void 0) values.set(name, value);
10940
+ }
10941
+ return values;
10942
+ }
10943
+ async function callerSecrets(scanned, remote) {
10944
+ if (remote && !isFeatureEnabled("forward-secrets")) return void 0;
10945
+ const names = await placeholderNamesIn(scanned);
10946
+ if (remote) {
10947
+ return names.size === 0 ? void 0 : { values: secretValues(names, secretSources()) };
10948
+ }
10949
+ if (names.size === 0) return { values: /* @__PURE__ */ new Map() };
10950
+ const sources = secretSources();
10951
+ return { values: secretValues(names, sources), sources: summarizeSecretSources(sources) };
10952
+ }
10953
+ async function placeholderNamesIn(args) {
10924
10954
  const names = /* @__PURE__ */ new Set();
10925
10955
  const scan = (text) => {
10926
10956
  for (const name of placeholderNames(text)) names.add(name);
@@ -10957,15 +10987,33 @@ async function forwardedSecrets(args) {
10957
10987
  }
10958
10988
  };
10959
10989
  await visit(args);
10960
- if (names.size === 0) return void 0;
10961
- const sources = secretSources();
10962
- const values = /* @__PURE__ */ new Map();
10963
- for (const rawName of names) {
10964
- const { name, value } = lookupPlaceholderSecret(rawName, sources);
10965
- if (value !== void 0) values.set(name, value);
10966
- }
10967
- return values;
10968
- }
10990
+ return names;
10991
+ }
10992
+ async function localScanArgs(meta, args, prepare) {
10993
+ const scanned = [args];
10994
+ const collecting = meta?.fileInputs?.filter((spec) => spec.collect !== void 0) ?? [];
10995
+ if (meta && RECORDING_TOOLS.has(canonicalToolId(meta.name))) {
10996
+ collecting.push(RECORDING_FILE_INPUT);
10997
+ }
10998
+ if (collecting.length > 0) {
10999
+ scanned.push(await prepare(collecting).catch(() => void 0));
11000
+ }
11001
+ return scanned;
11002
+ }
11003
+ var RECORDING_TOOLS = /* @__PURE__ */ new Set([
11004
+ "e2e-start-recording",
11005
+ "e2e-add-script",
11006
+ "e2e-add-step",
11007
+ "e2e-finish-recording"
11008
+ ]);
11009
+ var RECORDING_FILE_INPUT = {
11010
+ target: "__recording",
11011
+ path: `\${project_root}/${E2E_DIRS[0].split(path13.sep).join("/")}/\${name}.yaml`,
11012
+ paths: E2E_DIRS.map((dir) => `\${project_root}/${dir.split(path13.sep).join("/")}/\${name}.yaml`),
11013
+ kind: "file",
11014
+ optional: true,
11015
+ collect: "flow"
11016
+ };
10969
11017
  function secretsTransportRefusal(url) {
10970
11018
  if (!URL.canParse(url)) return `${url} is not a URL`;
10971
11019
  const { protocol, hostname } = new URL(url);
@@ -11069,6 +11117,23 @@ function createToolsClient(options = {}) {
11069
11117
  const shadowWarning = await e2eShadowWarningFor(name, args);
11070
11118
  const baselineDirs = [];
11071
11119
  let unwrittenBaselines = [];
11120
+ const memberOptions = {
11121
+ collectMembers: collectFlowMembers,
11122
+ collectStepMembers: olderServer ? (record, o) => collectStepMembers(record, o, (root) => path13.join(root, LEGACY_E2E_DIRS[0])) : collectStepMembers,
11123
+ toolFileInputs: (tool) => findTool(tools, tool)?.fileInputs,
11124
+ signal: opts?.signal
11125
+ };
11126
+ const scanned = remote ? void 0 : await localScanArgs(
11127
+ meta,
11128
+ finalArgs,
11129
+ (specs) => prepareFileInputs(specs, finalArgs ?? {}, {
11130
+ includeContent: true,
11131
+ scanOnly: true,
11132
+ log: () => {
11133
+ },
11134
+ ...memberOptions
11135
+ })
11136
+ );
11072
11137
  if (meta?.fileInputs?.length) {
11073
11138
  if (remote) assertRequiredPresent(meta, finalArgs);
11074
11139
  finalArgs = await prepareFileInputs(meta.fileInputs, finalArgs ?? {}, {
@@ -11076,10 +11141,7 @@ function createToolsClient(options = {}) {
11076
11141
  uploadEndpoint: remote ? { url, token, formats: uploadFormats } : void 0,
11077
11142
  log: diagnose,
11078
11143
  baselineDirs,
11079
- collectMembers: collectFlowMembers,
11080
- collectStepMembers: olderServer ? (record, o) => collectStepMembers(record, o, (root) => path13.join(root, LEGACY_E2E_DIRS[0])) : collectStepMembers,
11081
- toolFileInputs: (tool) => findTool(tools, tool)?.fileInputs,
11082
- signal: opts?.signal
11144
+ ...memberOptions
11083
11145
  });
11084
11146
  }
11085
11147
  const settle = async (data2) => {
@@ -11104,9 +11166,9 @@ function createToolsClient(options = {}) {
11104
11166
  const unwrittenFailure = () => unwrittenBaselines.length > 0 ? `Baselines not written on this client: ${unwrittenBaselines.join(", ")}` : void 0;
11105
11167
  const stream = opts?.onProgress !== void 0 || carriesMembers(finalArgs);
11106
11168
  const sentOnce = carriesUpload(finalArgs);
11107
- const forwarded = remote ? await forwardedSecrets(finalArgs) : void 0;
11108
- const encodedSecrets = forwarded ? encodeClientSecrets(forwarded) : void 0;
11109
- const clientSecrets = forwarded?.size ? forwarded : void 0;
11169
+ const sent = await callerSecrets(remote ? finalArgs : scanned, remote);
11170
+ const encodedSecrets = sent ? encodeClientSecrets(sent.values) : void 0;
11171
+ const clientSecrets = sent?.values.size ? sent.values : void 0;
11110
11172
  const refusal = clientSecrets ? secretsTransportRefusal(url) : void 0;
11111
11173
  if (refusal !== void 0) {
11112
11174
  throw new Error(
@@ -11129,16 +11191,21 @@ function createToolsClient(options = {}) {
11129
11191
  ...stream ? { "Accept": "application/x-ndjson", "Accept-Encoding": "identity" } : {},
11130
11192
  ...authHeaders2(token)
11131
11193
  };
11132
- if (clientSecrets !== void 0 && encodedSecrets !== void 0) {
11133
- const headBytes = toolUrl.length + FETCH_HEAD_BYTES + Object.entries(headers).reduce(
11134
- (sum, [key, value]) => sum + key.length + value.length + 4,
11135
- 0
11136
- );
11137
- if (headBytes > maxHeaderSize) {
11138
- throw new Error(
11139
- `forward-secrets would send ${[...clientSecrets.keys()].join(", ")} in an ${CLIENT_SECRETS_HEADER} header of ${encodedSecrets.length} bytes, which takes the request headers past the ${maxHeaderSize} bytes a tool-server accepts, so the call was not sent. Define a secret this large on the machine running the tool-server instead.`
11194
+ const headBytes = () => toolUrl.length + FETCH_HEAD_BYTES + Object.entries(headers).reduce((sum, [key, value]) => sum + key.length + value.length + 4, 0);
11195
+ if (sent?.sources) {
11196
+ headers[CLIENT_SECRET_SOURCES_HEADER] = encodeSecretSourceSummaries(sent.sources);
11197
+ if (headBytes() > maxHeaderSize) {
11198
+ headers[CLIENT_SECRET_SOURCES_HEADER] = encodeSecretSourceSummaries(
11199
+ sent.sources.map((source) => ({ ...source, names: [] }))
11140
11200
  );
11141
11201
  }
11202
+ if (headBytes() > maxHeaderSize) delete headers[CLIENT_SECRET_SOURCES_HEADER];
11203
+ }
11204
+ if (clientSecrets !== void 0 && encodedSecrets !== void 0 && headBytes() > maxHeaderSize) {
11205
+ const names = [...clientSecrets.keys()].join(", ");
11206
+ throw new Error(
11207
+ remote ? `forward-secrets would send ${names} in an ${CLIENT_SECRETS_HEADER} header of ${encodedSecrets.length} bytes, which takes the request headers past the ${maxHeaderSize} bytes a tool-server accepts, so the call was not sent. Define a secret this large on the machine running the tool-server instead.` : `The values of ${names} take the ${CLIENT_SECRETS_HEADER} header to ${encodedSecrets.length} bytes, past the ${maxHeaderSize} bytes of request headers the tool-server accepts, so the call was not sent. One call can send about 11 KiB of secret values: split the text across several calls.`
11208
+ );
11142
11209
  }
11143
11210
  const res = await doFetch(
11144
11211
  toolUrl,
@@ -11197,7 +11264,7 @@ function createToolsClient(options = {}) {
11197
11264
  const headersRefused = res.status === 431 || res.status === 400 && errorBodyMessage(json) === void 0;
11198
11265
  if (clientSecrets && headersRefused) {
11199
11266
  throw new ToolInvocationError(
11200
- `The tool-server, or a proxy in front of it, refused the request headers (${res.status}), as it does when they are too large. The ${CLIENT_SECRETS_HEADER} header carried ${[...clientSecrets.keys()].join(", ")}; define a secret this large on the machine running the tool-server instead.`
11267
+ `The tool-server, or a proxy in front of it, refused the request headers (${res.status}), as it does when they are too large. The ${CLIENT_SECRETS_HEADER} header carried ${[...clientSecrets.keys()].join(", ")}; ` + (remote ? `define a secret this large on the machine running the tool-server instead.` : `split the text across several calls.`)
11201
11268
  );
11202
11269
  }
11203
11270
  if (!res.ok) {
@@ -11234,7 +11301,7 @@ import {
11234
11301
  } from "node:fs/promises";
11235
11302
  import { constants as fsConstants } from "node:fs";
11236
11303
  import { tmpdir as tmpdir2 } from "node:os";
11237
- import { basename as basename7, extname as extname2, isAbsolute as isAbsolute6, join as join14, normalize as normalize2, resolve as resolve11, sep as sep5 } from "node:path";
11304
+ import { basename as basename7, extname as extname2, isAbsolute as isAbsolute6, join as join14, normalize as normalize2, resolve as resolve11, sep as sep6 } from "node:path";
11238
11305
  import { createHash as createHash3 } from "node:crypto";
11239
11306
  var ARTIFACT_MARKER2 = "__argentArtifact";
11240
11307
  function isArtifactHandle(value) {
@@ -11282,7 +11349,7 @@ function configuredRecordingsDir() {
11282
11349
  const trimmed = value.trim();
11283
11350
  if (trimmed === "") return null;
11284
11351
  const home = resolveHomeDir();
11285
- const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep5}`) ? join14(home, trimmed.slice(2)) : trimmed;
11352
+ const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep6}`) ? join14(home, trimmed.slice(2)) : trimmed;
11286
11353
  return resolve11(durableBaseDir(), expanded);
11287
11354
  }
11288
11355
  var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
@@ -11330,7 +11397,7 @@ async function writeDurableUnique(dir, filename, write) {
11330
11397
  function durableSaveTarget(handle) {
11331
11398
  if (typeof handle.saveDir !== "string" || !handle.saveDir || handle.archive) return null;
11332
11399
  const rel = normalize2(handle.saveDir);
11333
- if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${sep5}`) || rel.split(sep5).includes("..")) {
11400
+ if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${sep6}`) || rel.split(sep6).includes("..")) {
11334
11401
  return null;
11335
11402
  }
11336
11403
  if (!ALLOWED_SAVE_DIRS.has(rel)) return null;