@swmansion/argent 0.34.1-next.3 → 0.34.1-next.31
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/LICENSE +1 -0
- package/assets/ios-screen-stream/Info.plist +12 -0
- package/assets/ios-screen-stream/ios-screen-stream.swift +321 -0
- package/bin/argent-android-devtools-0.4.0.apk +0 -0
- package/bin/darwin/argent-macos-helper +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/simulator-server +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/linux/simulator-server +0 -0
- package/bin/linux-arm64/simulator-server +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/bin/win32/simulator-server.exe +0 -0
- package/dist/cli-cmds.mjs +916 -557
- package/dist/client.js +342 -179
- package/dist/flow-script-runner.mjs +1 -0
- package/dist/installer-help.js +4 -0
- package/dist/installer-help.js.map +1 -1
- package/dist/installer.mjs +1150 -911
- package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentLaunchPerformanceTests.swift +21 -0
- package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Commands.swift +9 -3
- package/dist/mcp-server.mjs +544 -712
- package/dist/preview-ui/index.html +28 -2
- package/dist/tool-args.generated.d.ts +38 -8
- package/dist/tool-server.cjs +7004 -3444
- package/dylibs/libArgentAudio.dylib +0 -0
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +1 -1
- package/rules/argent.md +6 -23
- package/skills/argent-create-e2e/references/e2e-yaml.md +2 -2
- package/skills/argent-create-e2e/references/live-authoring.md +1 -1
- package/skills/argent-device-interact/references/foldables.md +22 -0
- package/skills/argent-ios-device-interact/SKILL.md +2 -2
- package/skills/argent-macos-app-interact/SKILL.md +15 -5
- package/skills/argent-macos-app-interact/references/e2e.md +1 -1
- package/skills/argent-native-profiler/SKILL.md +14 -2
- package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
- package/skills/argent-react-native-optimization/SKILL.md +10 -1
- package/skills/argent-react-native-profiler/SKILL.md +4 -3
- package/skills/argent-screen-recording/SKILL.md +3 -2
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:
|
|
4393
|
+
const { start, key, sep: sep7, value } = collItem;
|
|
4394
4394
|
const keyProps = resolveProps.resolveProps(start, {
|
|
4395
4395
|
indicator: "explicit-key-ind",
|
|
4396
|
-
next: key ??
|
|
4396
|
+
next: key ?? sep7?.[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 && !
|
|
4410
|
+
if (!keyProps.anchor && !keyProps.tag && !sep7) {
|
|
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(
|
|
4434
|
+
const valueProps = resolveProps.resolveProps(sep7 ?? [], {
|
|
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,
|
|
4450
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep7, 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
|
|
4541
|
+
let sep7 = "";
|
|
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 +=
|
|
4556
|
-
|
|
4555
|
+
comment += sep7 + cb;
|
|
4556
|
+
sep7 = "";
|
|
4557
4557
|
break;
|
|
4558
4558
|
}
|
|
4559
4559
|
case "newline":
|
|
4560
4560
|
if (comment)
|
|
4561
|
-
|
|
4561
|
+
sep7 += 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:
|
|
4604
|
+
const { start, key, sep: sep7, value } = collItem;
|
|
4605
4605
|
const props = resolveProps.resolveProps(start, {
|
|
4606
4606
|
flow: fcName,
|
|
4607
4607
|
indicator: "explicit-key-ind",
|
|
4608
|
-
next: key ??
|
|
4608
|
+
next: key ?? sep7?.[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 && !
|
|
4615
|
+
if (!props.anchor && !props.tag && !sep7 && !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 && !
|
|
4670
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
4669
|
+
if (!isMap && !sep7 && !props.found) {
|
|
4670
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep7, 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(
|
|
4682
|
+
const valueProps = resolveProps.resolveProps(sep7 ?? [], {
|
|
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 (
|
|
4694
|
-
for (const st of
|
|
4693
|
+
if (sep7)
|
|
4694
|
+
for (const st of sep7) {
|
|
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,
|
|
4711
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep7, 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
|
|
4891
|
+
let sep7 = "";
|
|
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 +=
|
|
4909
|
-
|
|
4908
|
+
value += sep7 + indent.slice(trimIndent) + content;
|
|
4909
|
+
sep7 = "\n";
|
|
4910
4910
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
4911
|
-
if (
|
|
4912
|
-
|
|
4913
|
-
else if (!prevMoreIndented &&
|
|
4914
|
-
|
|
4915
|
-
value +=
|
|
4916
|
-
|
|
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";
|
|
4917
4917
|
prevMoreIndented = true;
|
|
4918
4918
|
} else if (content === "") {
|
|
4919
|
-
if (
|
|
4919
|
+
if (sep7 === "\n")
|
|
4920
4920
|
value += "\n";
|
|
4921
4921
|
else
|
|
4922
|
-
|
|
4922
|
+
sep7 = "\n";
|
|
4923
4923
|
} else {
|
|
4924
|
-
value +=
|
|
4925
|
-
|
|
4924
|
+
value += sep7 + content;
|
|
4925
|
+
sep7 = " ";
|
|
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
|
|
5108
|
+
let sep7 = " ";
|
|
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 (
|
|
5114
|
-
res +=
|
|
5113
|
+
if (sep7 === "\n")
|
|
5114
|
+
res += sep7;
|
|
5115
5115
|
else
|
|
5116
|
-
|
|
5116
|
+
sep7 = "\n";
|
|
5117
5117
|
} else {
|
|
5118
|
-
res +=
|
|
5119
|
-
|
|
5118
|
+
res += sep7 + lm;
|
|
5119
|
+
sep7 = " ";
|
|
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 +
|
|
5126
|
+
return res + sep7 + (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:
|
|
5936
|
+
function stringifyItem({ start, key, sep: sep7, 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 (
|
|
5943
|
-
for (const st of
|
|
5942
|
+
if (sep7)
|
|
5943
|
+
for (const st of sep7)
|
|
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
|
|
7110
|
+
let sep7;
|
|
7111
7111
|
if (scalar.end) {
|
|
7112
|
-
|
|
7113
|
-
|
|
7112
|
+
sep7 = scalar.end;
|
|
7113
|
+
sep7.push(this.sourceToken);
|
|
7114
7114
|
delete scalar.end;
|
|
7115
7115
|
} else
|
|
7116
|
-
|
|
7116
|
+
sep7 = [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:
|
|
7121
|
+
items: [{ start, key: scalar, sep: sep7 }]
|
|
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
|
|
7275
|
-
|
|
7274
|
+
const sep7 = it.sep;
|
|
7275
|
+
sep7.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:
|
|
7282
|
+
items: [{ start: start2, key, sep: sep7 }]
|
|
7283
7283
|
});
|
|
7284
7284
|
} else if (start.length > 0) {
|
|
7285
7285
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -7308,14 +7308,14 @@ var require_parser = __commonJS({
|
|
|
7308
7308
|
case "scalar":
|
|
7309
7309
|
case "single-quoted-scalar":
|
|
7310
7310
|
case "double-quoted-scalar": {
|
|
7311
|
-
const
|
|
7311
|
+
const fs9 = this.flowScalar(this.type);
|
|
7312
7312
|
if (atNextItem || it.value) {
|
|
7313
|
-
map.items.push({ start, key:
|
|
7313
|
+
map.items.push({ start, key: fs9, sep: [] });
|
|
7314
7314
|
this.onKeyLine = true;
|
|
7315
7315
|
} else if (it.sep) {
|
|
7316
|
-
this.stack.push(
|
|
7316
|
+
this.stack.push(fs9);
|
|
7317
7317
|
} else {
|
|
7318
|
-
Object.assign(it, { key:
|
|
7318
|
+
Object.assign(it, { key: fs9, sep: [] });
|
|
7319
7319
|
this.onKeyLine = true;
|
|
7320
7320
|
}
|
|
7321
7321
|
return;
|
|
@@ -7443,13 +7443,13 @@ var require_parser = __commonJS({
|
|
|
7443
7443
|
case "scalar":
|
|
7444
7444
|
case "single-quoted-scalar":
|
|
7445
7445
|
case "double-quoted-scalar": {
|
|
7446
|
-
const
|
|
7446
|
+
const fs9 = this.flowScalar(this.type);
|
|
7447
7447
|
if (!it || it.value)
|
|
7448
|
-
fc.items.push({ start: [], key:
|
|
7448
|
+
fc.items.push({ start: [], key: fs9, sep: [] });
|
|
7449
7449
|
else if (it.sep)
|
|
7450
|
-
this.stack.push(
|
|
7450
|
+
this.stack.push(fs9);
|
|
7451
7451
|
else
|
|
7452
|
-
Object.assign(it, { key:
|
|
7452
|
+
Object.assign(it, { key: fs9, sep: [] });
|
|
7453
7453
|
return;
|
|
7454
7454
|
}
|
|
7455
7455
|
case "flow-map-end":
|
|
@@ -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
|
|
7477
|
-
|
|
7476
|
+
const sep7 = fc.end.splice(1, fc.end.length);
|
|
7477
|
+
sep7.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:
|
|
7482
|
+
items: [{ start, key: fc, sep: sep7 }]
|
|
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
|
|
7660
|
+
function parse2(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 =
|
|
7701
|
+
exports.parse = parse2;
|
|
7702
7702
|
exports.parseAllDocuments = parseAllDocuments;
|
|
7703
7703
|
exports.parseDocument = parseDocument;
|
|
7704
7704
|
exports.stringify = stringify;
|
|
@@ -7798,6 +7798,11 @@ var FLAG_REGISTRY = [
|
|
|
7798
7798
|
name: "forward-secrets",
|
|
7799
7799
|
description: "Over `argent link` or ARGENT_TOOLS_URL, resolve each `{{secret:NAME}}` a call names on this machine and send the value with the call, so a remote tool-server can type a secret it does not hold. The linked tool-server then receives every secret of this machine that a call names, so link only one you trust with all of them. Values go only over https:// with the certificate checked, or to a loopback address. Off by default."
|
|
7800
7800
|
},
|
|
7801
|
+
{
|
|
7802
|
+
name: "ios-audio-always-inserted",
|
|
7803
|
+
description: "Insert the iOS audio hook (libArgentAudio.dylib) into every app an armed simulator launches, so audio-input works without restart-app. Dormant until the app opens audio. On by default; `argent disable ios-audio-always-inserted` inserts it only on the first audio tool call, for apps launched after that call.",
|
|
7804
|
+
defaultEnabled: true
|
|
7805
|
+
},
|
|
7801
7806
|
{
|
|
7802
7807
|
name: "video-watermark",
|
|
7803
7808
|
description: "Overlay the argent corner watermark on recorded screen videos. On by default; turn it off with `argent disable video-watermark`.",
|
|
@@ -7805,7 +7810,7 @@ var FLAG_REGISTRY = [
|
|
|
7805
7810
|
},
|
|
7806
7811
|
{
|
|
7807
7812
|
name: "macos-apps",
|
|
7808
|
-
description: "
|
|
7813
|
+
description: "Control native Mac apps, including Mac Catalyst. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. On by default; turn it off with `argent disable macos-apps`.",
|
|
7809
7814
|
defaultEnabled: true
|
|
7810
7815
|
}
|
|
7811
7816
|
];
|
|
@@ -7875,6 +7880,7 @@ function isFeatureEnabled(name, options = {}, registry = FLAG_REGISTRY) {
|
|
|
7875
7880
|
}
|
|
7876
7881
|
|
|
7877
7882
|
// ../configuration-core/src/paths.ts
|
|
7883
|
+
import * as fs2 from "node:fs";
|
|
7878
7884
|
import * as os from "node:os";
|
|
7879
7885
|
import * as path2 from "node:path";
|
|
7880
7886
|
function nonEmpty(value) {
|
|
@@ -7886,6 +7892,16 @@ function resolveHomeDir(options = {}) {
|
|
|
7886
7892
|
if (options.homeDir) return options.homeDir;
|
|
7887
7893
|
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
7888
7894
|
}
|
|
7895
|
+
function isHomeDir(dir, options = {}) {
|
|
7896
|
+
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
7897
|
+
}
|
|
7898
|
+
function canonicalPath(p) {
|
|
7899
|
+
try {
|
|
7900
|
+
return fs2.realpathSync.native(p);
|
|
7901
|
+
} catch {
|
|
7902
|
+
return path2.resolve(p);
|
|
7903
|
+
}
|
|
7904
|
+
}
|
|
7889
7905
|
function argentHomeDir() {
|
|
7890
7906
|
return path2.join(resolveHomeDir(), ".argent");
|
|
7891
7907
|
}
|
|
@@ -7902,11 +7918,11 @@ function configFilePath(scope = "global", options = {}) {
|
|
|
7902
7918
|
|
|
7903
7919
|
// ../configuration-core/src/config.ts
|
|
7904
7920
|
import * as crypto from "node:crypto";
|
|
7905
|
-
import * as
|
|
7921
|
+
import * as fs3 from "node:fs";
|
|
7906
7922
|
import * as path3 from "node:path";
|
|
7907
7923
|
function readConfigObject(scope = "global", options = {}) {
|
|
7908
7924
|
try {
|
|
7909
|
-
const raw =
|
|
7925
|
+
const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
|
|
7910
7926
|
const json = JSON.parse(raw);
|
|
7911
7927
|
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
7912
7928
|
return json;
|
|
@@ -7943,7 +7959,7 @@ function getAtPath(obj, dottedKey) {
|
|
|
7943
7959
|
|
|
7944
7960
|
// ../configuration-core/src/secrets.ts
|
|
7945
7961
|
var import_dotenv = __toESM(require_dist(), 1);
|
|
7946
|
-
import * as
|
|
7962
|
+
import * as fs4 from "node:fs";
|
|
7947
7963
|
import * as path4 from "node:path";
|
|
7948
7964
|
var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
|
|
7949
7965
|
var SECRETS_FILE_NAME = "secrets.env";
|
|
@@ -7973,10 +7989,10 @@ function fileSource(filePath, exposure) {
|
|
|
7973
7989
|
names: [],
|
|
7974
7990
|
values: /* @__PURE__ */ new Map()
|
|
7975
7991
|
};
|
|
7976
|
-
if (!
|
|
7992
|
+
if (!fs4.statSync(filePath, { throwIfNoEntry: false })) return absent;
|
|
7977
7993
|
let content;
|
|
7978
7994
|
try {
|
|
7979
|
-
content =
|
|
7995
|
+
content = fs4.readFileSync(filePath, "utf8");
|
|
7980
7996
|
} catch {
|
|
7981
7997
|
return absent;
|
|
7982
7998
|
}
|
|
@@ -8002,7 +8018,9 @@ function fileSource(filePath, exposure) {
|
|
|
8002
8018
|
}
|
|
8003
8019
|
function secretSources(options = {}) {
|
|
8004
8020
|
const sources = [envSource(options.env ?? process.env)];
|
|
8005
|
-
const
|
|
8021
|
+
const home = resolveHomeDir(options);
|
|
8022
|
+
const found = findProjectRoot(options.cwd ?? process.cwd());
|
|
8023
|
+
const projectRoot = found && isHomeDir(found, options) ? home : found;
|
|
8006
8024
|
const filePaths = [];
|
|
8007
8025
|
if (projectRoot) {
|
|
8008
8026
|
filePaths.push({
|
|
@@ -8014,7 +8032,7 @@ function secretSources(options = {}) {
|
|
|
8014
8032
|
}
|
|
8015
8033
|
}
|
|
8016
8034
|
filePaths.push({
|
|
8017
|
-
path: path4.join(
|
|
8035
|
+
path: path4.join(home, ".argent", SECRETS_FILE_NAME),
|
|
8018
8036
|
exposure: "dedicated"
|
|
8019
8037
|
});
|
|
8020
8038
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -8136,14 +8154,6 @@ var CONFIG_SCHEMA = [
|
|
|
8136
8154
|
// drained/reset, not just the file rewritten.
|
|
8137
8155
|
manageCommand: "argent telemetry"
|
|
8138
8156
|
},
|
|
8139
|
-
{
|
|
8140
|
-
key: "allowlist.enabled",
|
|
8141
|
-
description: "Whether `argent update` re-applies editor auto-approve allowlist rules. Unset (the default) keeps the current behavior: update refreshes the rules for editors that already have argent configured. Set to `false` to keep update from touching editor allowlists. `false` in either scope wins, so a committed project opt-out holds for every teammate.",
|
|
8142
|
-
scopes: ["project", "global"],
|
|
8143
|
-
parse: asBoolean,
|
|
8144
|
-
merge: "prioritize-restrictive",
|
|
8145
|
-
example: "false"
|
|
8146
|
-
},
|
|
8147
8157
|
{
|
|
8148
8158
|
key: "lens.agent",
|
|
8149
8159
|
description: "Coding-agent id remembered by `argent lens` to skip the picker.",
|
|
@@ -8266,7 +8276,7 @@ var UnknownConfigKeyError = class extends Error {
|
|
|
8266
8276
|
|
|
8267
8277
|
// ../argent-tools-client/src/launcher.ts
|
|
8268
8278
|
import * as net from "node:net";
|
|
8269
|
-
import * as
|
|
8279
|
+
import * as fs5 from "node:fs";
|
|
8270
8280
|
import * as path6 from "node:path";
|
|
8271
8281
|
import * as readline from "node:readline";
|
|
8272
8282
|
import { homedir as homedir3 } from "node:os";
|
|
@@ -8280,6 +8290,7 @@ var LOCK_FILE = path6.join(STATE_DIR, "tool-server.lock");
|
|
|
8280
8290
|
var AUTH_TOKEN_BYTES = 32;
|
|
8281
8291
|
var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
|
|
8282
8292
|
var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
|
|
8293
|
+
var AUTOSPAWN_HOST = "127.0.0.1";
|
|
8283
8294
|
function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
8284
8295
|
const env = {
|
|
8285
8296
|
...baseEnv,
|
|
@@ -8291,7 +8302,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
|
8291
8302
|
if (options.idleTimeoutMinutes !== void 0) {
|
|
8292
8303
|
env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
|
|
8293
8304
|
}
|
|
8294
|
-
|
|
8305
|
+
env[AUTH_TOKEN_ENV] = options.token ?? "";
|
|
8295
8306
|
if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
|
|
8296
8307
|
if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
|
|
8297
8308
|
return env;
|
|
@@ -8300,7 +8311,7 @@ function generateToken() {
|
|
|
8300
8311
|
return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
|
|
8301
8312
|
}
|
|
8302
8313
|
function findFreePort() {
|
|
8303
|
-
return new Promise((
|
|
8314
|
+
return new Promise((resolve11, reject) => {
|
|
8304
8315
|
const srv = net.createServer();
|
|
8305
8316
|
srv.listen(0, "127.0.0.1", () => {
|
|
8306
8317
|
const addr = srv.address();
|
|
@@ -8311,21 +8322,21 @@ function findFreePort() {
|
|
|
8311
8322
|
const port = addr.port;
|
|
8312
8323
|
srv.close((err) => {
|
|
8313
8324
|
if (err) reject(err);
|
|
8314
|
-
else
|
|
8325
|
+
else resolve11(port);
|
|
8315
8326
|
});
|
|
8316
8327
|
});
|
|
8317
8328
|
srv.on("error", reject);
|
|
8318
8329
|
});
|
|
8319
8330
|
}
|
|
8320
8331
|
function isVersionNewer(a, b) {
|
|
8321
|
-
const
|
|
8332
|
+
const parse2 = (v) => {
|
|
8322
8333
|
const [core = "", ...preParts] = v.split("+")[0].split("-");
|
|
8323
8334
|
const nums = core.split(".").map((n) => Number.parseInt(n, 10));
|
|
8324
8335
|
if (nums.length === 0 || nums.some((n) => Number.isNaN(n))) return null;
|
|
8325
8336
|
return { nums, pre: preParts.length > 0 ? preParts.join("-").split(".") : [] };
|
|
8326
8337
|
};
|
|
8327
|
-
const pa =
|
|
8328
|
-
const pb =
|
|
8338
|
+
const pa = parse2(a);
|
|
8339
|
+
const pb = parse2(b);
|
|
8329
8340
|
if (!pa || !pb) return false;
|
|
8330
8341
|
for (let i = 0; i < 3; i++) {
|
|
8331
8342
|
const x = pa.nums[i] ?? 0;
|
|
@@ -8353,7 +8364,7 @@ function isVersionNewer(a, b) {
|
|
|
8353
8364
|
function readBundlePackageVersion(bundlePath) {
|
|
8354
8365
|
try {
|
|
8355
8366
|
const pkg = JSON.parse(
|
|
8356
|
-
|
|
8367
|
+
fs5.readFileSync(path6.join(path6.dirname(bundlePath), "..", "package.json"), "utf8")
|
|
8357
8368
|
);
|
|
8358
8369
|
return typeof pkg.version === "string" ? pkg.version : void 0;
|
|
8359
8370
|
} catch {
|
|
@@ -8408,23 +8419,26 @@ function killSpawnedChild(child, pid) {
|
|
|
8408
8419
|
}
|
|
8409
8420
|
}
|
|
8410
8421
|
}
|
|
8422
|
+
function resolveToolsServerNode() {
|
|
8423
|
+
const { bun, deno, electron } = process.versions;
|
|
8424
|
+
return !(bun || deno || electron) && fs5.existsSync(process.execPath) ? process.execPath : "node";
|
|
8425
|
+
}
|
|
8411
8426
|
function spawnToolsServer(paths, port, options = {}) {
|
|
8412
|
-
return new Promise((
|
|
8427
|
+
return new Promise((resolve11, reject) => {
|
|
8413
8428
|
let logFd;
|
|
8414
8429
|
try {
|
|
8415
|
-
|
|
8416
|
-
logFd =
|
|
8430
|
+
fs5.mkdirSync(STATE_DIR, { recursive: true });
|
|
8431
|
+
logFd = fs5.openSync(LOG_FILE, "a");
|
|
8417
8432
|
} catch {
|
|
8418
|
-
logFd =
|
|
8433
|
+
logFd = fs5.openSync("/dev/null", "w");
|
|
8419
8434
|
}
|
|
8420
|
-
const
|
|
8421
|
-
const nodeBin = !(bun || deno || electron) && fs4.existsSync(process.execPath) ? process.execPath : "node";
|
|
8435
|
+
const nodeBin = resolveToolsServerNode();
|
|
8422
8436
|
const child = spawn(nodeBin, [paths.bundlePath, "start"], {
|
|
8423
8437
|
detached: true,
|
|
8424
8438
|
stdio: ["ignore", "pipe", logFd],
|
|
8425
8439
|
env: buildToolsServerEnv(paths, port, process.env, options)
|
|
8426
8440
|
});
|
|
8427
|
-
|
|
8441
|
+
fs5.closeSync(logFd);
|
|
8428
8442
|
child.unref();
|
|
8429
8443
|
const pid = child.pid;
|
|
8430
8444
|
if (!pid) {
|
|
@@ -8456,7 +8470,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
8456
8470
|
rl.close();
|
|
8457
8471
|
child.stdout?.resume();
|
|
8458
8472
|
child.stdout?.unref?.();
|
|
8459
|
-
settle(() =>
|
|
8473
|
+
settle(() => resolve11({ port: actualPort, pid }));
|
|
8460
8474
|
}
|
|
8461
8475
|
});
|
|
8462
8476
|
child.on("error", (err) => {
|
|
@@ -8551,7 +8565,7 @@ async function sweepDeadStateFiles() {
|
|
|
8551
8565
|
});
|
|
8552
8566
|
continue;
|
|
8553
8567
|
}
|
|
8554
|
-
if (
|
|
8568
|
+
if (fs5.existsSync(fresh.bundlePath)) continue;
|
|
8555
8569
|
if (!couldBeOurToolServer(fresh.pid, fresh.bundlePath)) continue;
|
|
8556
8570
|
await unlink(file).catch(() => {
|
|
8557
8571
|
});
|
|
@@ -8598,7 +8612,7 @@ async function killToolServer(bundlePath) {
|
|
|
8598
8612
|
await clearToolsServerState(bundlePath ?? state.bundlePath);
|
|
8599
8613
|
return alive;
|
|
8600
8614
|
}
|
|
8601
|
-
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) =>
|
|
8615
|
+
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs5.existsSync(p)) ?? "ps";
|
|
8602
8616
|
var PS_WIDTH_FLAGS = ["-ww"];
|
|
8603
8617
|
var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
8604
8618
|
function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
|
|
@@ -8645,13 +8659,13 @@ var LOCK_STALE_MS = 45e3;
|
|
|
8645
8659
|
var LOCK_POLL_MS = 100;
|
|
8646
8660
|
function spawnLockIsStale() {
|
|
8647
8661
|
try {
|
|
8648
|
-
const { pid, ts } = JSON.parse(
|
|
8662
|
+
const { pid, ts } = JSON.parse(fs5.readFileSync(LOCK_FILE, "utf8"));
|
|
8649
8663
|
if (typeof pid === "number" && pid > 0 && !isProcessAlive(pid)) return true;
|
|
8650
8664
|
if (typeof ts === "number" && Date.now() - ts > LOCK_STALE_MS) return true;
|
|
8651
8665
|
return false;
|
|
8652
8666
|
} catch {
|
|
8653
8667
|
try {
|
|
8654
|
-
return Date.now() -
|
|
8668
|
+
return Date.now() - fs5.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS;
|
|
8655
8669
|
} catch {
|
|
8656
8670
|
return true;
|
|
8657
8671
|
}
|
|
@@ -8659,7 +8673,7 @@ function spawnLockIsStale() {
|
|
|
8659
8673
|
}
|
|
8660
8674
|
async function acquireSpawnLock() {
|
|
8661
8675
|
try {
|
|
8662
|
-
|
|
8676
|
+
fs5.mkdirSync(STATE_DIR, { recursive: true });
|
|
8663
8677
|
} catch {
|
|
8664
8678
|
return null;
|
|
8665
8679
|
}
|
|
@@ -8667,11 +8681,11 @@ async function acquireSpawnLock() {
|
|
|
8667
8681
|
const deadline = Date.now() + LOCK_WAIT_TIMEOUT_MS;
|
|
8668
8682
|
for (; ; ) {
|
|
8669
8683
|
try {
|
|
8670
|
-
const fd =
|
|
8684
|
+
const fd = fs5.openSync(LOCK_FILE, "wx");
|
|
8671
8685
|
try {
|
|
8672
|
-
|
|
8686
|
+
fs5.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
|
|
8673
8687
|
} finally {
|
|
8674
|
-
|
|
8688
|
+
fs5.closeSync(fd);
|
|
8675
8689
|
}
|
|
8676
8690
|
let released = false;
|
|
8677
8691
|
return {
|
|
@@ -8679,8 +8693,8 @@ async function acquireSpawnLock() {
|
|
|
8679
8693
|
if (released) return;
|
|
8680
8694
|
released = true;
|
|
8681
8695
|
try {
|
|
8682
|
-
const cur = JSON.parse(
|
|
8683
|
-
if (cur.pid === process.pid && cur.nonce === nonce)
|
|
8696
|
+
const cur = JSON.parse(fs5.readFileSync(LOCK_FILE, "utf8"));
|
|
8697
|
+
if (cur.pid === process.pid && cur.nonce === nonce) fs5.unlinkSync(LOCK_FILE);
|
|
8684
8698
|
} catch {
|
|
8685
8699
|
}
|
|
8686
8700
|
}
|
|
@@ -8689,10 +8703,10 @@ async function acquireSpawnLock() {
|
|
|
8689
8703
|
if (err.code !== "EEXIST") return null;
|
|
8690
8704
|
if (spawnLockIsStale()) {
|
|
8691
8705
|
try {
|
|
8692
|
-
|
|
8706
|
+
fs5.unlinkSync(LOCK_FILE);
|
|
8693
8707
|
} catch {
|
|
8694
8708
|
}
|
|
8695
|
-
if (!
|
|
8709
|
+
if (!fs5.existsSync(LOCK_FILE)) continue;
|
|
8696
8710
|
}
|
|
8697
8711
|
if (Date.now() >= deadline) return null;
|
|
8698
8712
|
await new Promise((r) => setTimeout(r, LOCK_POLL_MS));
|
|
@@ -8732,7 +8746,7 @@ async function ensureToolsServer(paths) {
|
|
|
8732
8746
|
}
|
|
8733
8747
|
await clearToolsServerState(paths.bundlePath);
|
|
8734
8748
|
await sweepDeadStateFiles();
|
|
8735
|
-
if (!
|
|
8749
|
+
if (!fs5.existsSync(paths.bundlePath)) {
|
|
8736
8750
|
throw new Error(
|
|
8737
8751
|
`The argent install serving this session is gone from disk (${paths.bundlePath}) \u2014 it was likely updated or removed. Restart the editor's MCP connection to reconnect.`
|
|
8738
8752
|
);
|
|
@@ -8742,6 +8756,7 @@ async function ensureToolsServer(paths) {
|
|
|
8742
8756
|
const port = await findFreePort();
|
|
8743
8757
|
const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
|
|
8744
8758
|
token,
|
|
8759
|
+
host: AUTOSPAWN_HOST,
|
|
8745
8760
|
idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES
|
|
8746
8761
|
});
|
|
8747
8762
|
await writeState({
|
|
@@ -8750,11 +8765,11 @@ async function ensureToolsServer(paths) {
|
|
|
8750
8765
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8751
8766
|
bundlePath: paths.bundlePath,
|
|
8752
8767
|
version: diskVersion,
|
|
8753
|
-
host:
|
|
8768
|
+
host: AUTOSPAWN_HOST,
|
|
8754
8769
|
token,
|
|
8755
8770
|
managed: "autospawn"
|
|
8756
8771
|
});
|
|
8757
|
-
return { url: formatUrl(
|
|
8772
|
+
return { url: formatUrl(AUTOSPAWN_HOST, actualPort), token };
|
|
8758
8773
|
} finally {
|
|
8759
8774
|
lock?.release();
|
|
8760
8775
|
}
|
|
@@ -8796,7 +8811,18 @@ function interpolateFileInputPath(template, args) {
|
|
|
8796
8811
|
});
|
|
8797
8812
|
return missing ? null : out;
|
|
8798
8813
|
}
|
|
8799
|
-
var TOOL_FILE_EXTENSIONS = [
|
|
8814
|
+
var TOOL_FILE_EXTENSIONS = [
|
|
8815
|
+
".png",
|
|
8816
|
+
".yaml",
|
|
8817
|
+
".wav",
|
|
8818
|
+
".mp3",
|
|
8819
|
+
".m4a",
|
|
8820
|
+
".aac",
|
|
8821
|
+
".caf",
|
|
8822
|
+
".aif",
|
|
8823
|
+
".aiff",
|
|
8824
|
+
".flac"
|
|
8825
|
+
];
|
|
8800
8826
|
function hasToolFileExtension(file) {
|
|
8801
8827
|
const name = file.toLowerCase();
|
|
8802
8828
|
return TOOL_FILE_EXTENSIONS.some((extension) => name.endsWith(extension));
|
|
@@ -8810,16 +8836,24 @@ function toolStepFiles(specs, args) {
|
|
|
8810
8836
|
}
|
|
8811
8837
|
return files;
|
|
8812
8838
|
}
|
|
8839
|
+
var UNEXPANDED_PATH = /^~|\$[A-Za-z0-9_{(]|`|%[A-Za-z_][A-Za-z0-9_]*%|^[A-Za-z][A-Za-z0-9+.-]+:/;
|
|
8840
|
+
function isUnexpandedPath(p) {
|
|
8841
|
+
return UNEXPANDED_PATH.test(p);
|
|
8842
|
+
}
|
|
8813
8843
|
function isClientFileArgument({ spec, path: path14 }) {
|
|
8814
8844
|
return spec.kind === "file" && spec.path === `\${${spec.target}}` && path14.startsWith("/") && hasToolFileExtension(path14);
|
|
8815
8845
|
}
|
|
8816
8846
|
|
|
8847
|
+
// ../registry/src/flow-platforms.ts
|
|
8848
|
+
var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
|
|
8849
|
+
var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
|
|
8850
|
+
|
|
8817
8851
|
// ../registry/src/flow-file-refs.ts
|
|
8818
|
-
import * as
|
|
8852
|
+
import * as fs7 from "node:fs/promises";
|
|
8819
8853
|
import * as path8 from "node:path";
|
|
8820
8854
|
|
|
8821
8855
|
// ../registry/src/e2e-dirs.ts
|
|
8822
|
-
import * as
|
|
8856
|
+
import * as fs6 from "node:fs/promises";
|
|
8823
8857
|
import * as path7 from "node:path";
|
|
8824
8858
|
var E2E_DIR = path7.join(".argent", "e2e");
|
|
8825
8859
|
var LEGACY_E2E_DIRS = Object.freeze([path7.join(".argent", "flows")]);
|
|
@@ -8834,7 +8868,7 @@ function e2eFileCandidates(projectRoot, name) {
|
|
|
8834
8868
|
return e2eDirsFor(projectRoot).map((dir) => path7.join(dir, `${name}.yaml`));
|
|
8835
8869
|
}
|
|
8836
8870
|
async function exists(file) {
|
|
8837
|
-
return
|
|
8871
|
+
return fs6.stat(file).then(
|
|
8838
8872
|
() => true,
|
|
8839
8873
|
() => false
|
|
8840
8874
|
);
|
|
@@ -8925,10 +8959,10 @@ function canonicalToolArgs(tool, args) {
|
|
|
8925
8959
|
// ../registry/src/flow-file-refs.ts
|
|
8926
8960
|
async function canonicalFlowPath(p) {
|
|
8927
8961
|
try {
|
|
8928
|
-
return await
|
|
8962
|
+
return await fs7.realpath(p);
|
|
8929
8963
|
} catch {
|
|
8930
8964
|
try {
|
|
8931
|
-
return path8.join(await
|
|
8965
|
+
return path8.join(await fs7.realpath(path8.dirname(p)), path8.basename(p));
|
|
8932
8966
|
} catch {
|
|
8933
8967
|
return p;
|
|
8934
8968
|
}
|
|
@@ -8944,6 +8978,9 @@ var MAX_BLOCK_NESTING = 64;
|
|
|
8944
8978
|
function isRecord(value) {
|
|
8945
8979
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8946
8980
|
}
|
|
8981
|
+
function flowYamlSource(content) {
|
|
8982
|
+
return content.replace(/^\s+/, (lead) => lead.replace(/[^\n]/g, "")).trimEnd();
|
|
8983
|
+
}
|
|
8947
8984
|
function collectFlowRequests(doc) {
|
|
8948
8985
|
const runTargets = /* @__PURE__ */ new Set();
|
|
8949
8986
|
const snapshots = /* @__PURE__ */ new Set();
|
|
@@ -8974,15 +9011,15 @@ function collectFlowRequests(doc) {
|
|
|
8974
9011
|
if (isRecord(doc)) visit(doc.steps, 0);
|
|
8975
9012
|
return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
|
|
8976
9013
|
}
|
|
8977
|
-
function baselineKeyFor(
|
|
8978
|
-
const stem = path8.basename(
|
|
9014
|
+
function baselineKeyFor(canonicalPath2, flowName) {
|
|
9015
|
+
const stem = path8.basename(canonicalPath2, ".yaml");
|
|
8979
9016
|
return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
|
|
8980
9017
|
}
|
|
8981
9018
|
function flowMemberKey(anchorDir, target) {
|
|
8982
9019
|
return `${anchorDir}\0${target}`;
|
|
8983
9020
|
}
|
|
8984
9021
|
async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
|
|
8985
|
-
const entries = await
|
|
9022
|
+
const entries = await fs7.readdir(dir).catch(() => null);
|
|
8986
9023
|
if (entries === null || entries.includes(base)) return { state: "listed" };
|
|
8987
9024
|
const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
|
|
8988
9025
|
if (actual === void 0) return { state: "absent" };
|
|
@@ -9211,12 +9248,15 @@ var FAILURE_CODES = {
|
|
|
9211
9248
|
DEBUGGER_CDP_PROTOCOL_ERROR: "DEBUGGER_CDP_PROTOCOL_ERROR",
|
|
9212
9249
|
DEBUGGER_CDP_CONNECT_FAILED: "DEBUGGER_CDP_CONNECT_FAILED",
|
|
9213
9250
|
DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN: "DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN",
|
|
9251
|
+
DEBUGGER_CDP_ORIGIN_REJECTED: "DEBUGGER_CDP_ORIGIN_REJECTED",
|
|
9214
9252
|
DEBUGGER_CDP_NOT_CONNECTED: "DEBUGGER_CDP_NOT_CONNECTED",
|
|
9215
9253
|
DEBUGGER_CDP_REQUEST_TIMEOUT: "DEBUGGER_CDP_REQUEST_TIMEOUT",
|
|
9216
9254
|
DEBUGGER_CDP_CONNECTION_CLOSED: "DEBUGGER_CDP_CONNECTION_CLOSED",
|
|
9217
9255
|
DEBUGGER_TARGET_DEVICE_MISMATCH: "DEBUGGER_TARGET_DEVICE_MISMATCH",
|
|
9218
9256
|
DEBUGGER_EVALUATE_EXPRESSION_THREW: "DEBUGGER_EVALUATE_EXPRESSION_THREW",
|
|
9219
9257
|
DEBUGGER_RELOAD_FAILED: "DEBUGGER_RELOAD_FAILED",
|
|
9258
|
+
// e2e-add-step refused a debugger-* call that answered `not_connected`.
|
|
9259
|
+
DEBUGGER_NOT_CONNECTED: "DEBUGGER_NOT_CONNECTED",
|
|
9220
9260
|
JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED: "JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED",
|
|
9221
9261
|
JS_RUNTIME_PAYLOAD_INVALID: "JS_RUNTIME_PAYLOAD_INVALID",
|
|
9222
9262
|
JS_RUNTIME_PAYLOAD_DEVICE_MISSING: "JS_RUNTIME_PAYLOAD_DEVICE_MISSING",
|
|
@@ -9285,6 +9325,32 @@ var FAILURE_CODES = {
|
|
|
9285
9325
|
NATIVE_PROFILER_PERFETTO_PROCESS_ERROR: "NATIVE_PROFILER_PERFETTO_PROCESS_ERROR",
|
|
9286
9326
|
NATIVE_PROFILER_PERFETTO_READY_TIMEOUT: "NATIVE_PROFILER_PERFETTO_READY_TIMEOUT",
|
|
9287
9327
|
NATIVE_PROFILER_PERFETTO_READY_EXITED: "NATIVE_PROFILER_PERFETTO_READY_EXITED",
|
|
9328
|
+
/**
|
|
9329
|
+
* native-profiler-launch-analysis. Input problems use TOOL_INPUT_INVALID and
|
|
9330
|
+
* devicectl steps IOS_DEVICECTL_COMMAND_FAILED.
|
|
9331
|
+
* @see [workflow.ts](../../tool-server/src/utils/ios-launch-time/workflow.ts)
|
|
9332
|
+
*/
|
|
9333
|
+
// Not macOS, or an Xcode that cannot record the launch on this target.
|
|
9334
|
+
LAUNCH_ANALYSIS_UNSUPPORTED_HOST: "LAUNCH_ANALYSIS_UNSUPPORTED_HOST",
|
|
9335
|
+
// No usable iPhone or simulator was selected, or Argent's runner holds it.
|
|
9336
|
+
LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE: "LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE",
|
|
9337
|
+
// The bundle_id app is not installed on the selected device.
|
|
9338
|
+
LAUNCH_ANALYSIS_APP_NOT_INSTALLED: "LAUNCH_ANALYSIS_APP_NOT_INSTALLED",
|
|
9339
|
+
// The runner's xcodebuild failed on code signing or provisioning.
|
|
9340
|
+
LAUNCH_ANALYSIS_SIGNING_FAILED: "LAUNCH_ANALYSIS_SIGNING_FAILED",
|
|
9341
|
+
// The iPhone's free developer profile has no slot for Argent's runner.
|
|
9342
|
+
LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT: "LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT",
|
|
9343
|
+
// simctl could not wait for boot, find, launch or terminate the app.
|
|
9344
|
+
LAUNCH_ANALYSIS_SIMCTL_FAILED: "LAUNCH_ANALYSIS_SIMCTL_FAILED",
|
|
9345
|
+
LAUNCH_ANALYSIS_RECORD_FAILED: "LAUNCH_ANALYSIS_RECORD_FAILED",
|
|
9346
|
+
// xctrace could not export the TOC, the CPU samples or the first-frame marker.
|
|
9347
|
+
LAUNCH_ANALYSIS_EXPORT_FAILED: "LAUNCH_ANALYSIS_EXPORT_FAILED",
|
|
9348
|
+
// The App Launch trace has no first frame of the app, so it has no launch window.
|
|
9349
|
+
LAUNCH_ANALYSIS_NO_FIRST_FRAME: "LAUNCH_ANALYSIS_NO_FIRST_FRAME",
|
|
9350
|
+
// The XCTest launch run of Argent's runner failed.
|
|
9351
|
+
LAUNCH_ANALYSIS_RUNNER_TEST_FAILED: "LAUNCH_ANALYSIS_RUNNER_TEST_FAILED",
|
|
9352
|
+
// The launch test ran, but Argent read no launch measurements from its result.
|
|
9353
|
+
LAUNCH_ANALYSIS_NO_SAMPLES: "LAUNCH_ANALYSIS_NO_SAMPLES",
|
|
9288
9354
|
// iOS and Android share one capture path (simulator-server frames into
|
|
9289
9355
|
// ffmpeg), so these name the failing stage, not the device family.
|
|
9290
9356
|
SCREEN_RECORDING_FACTORY_OPTIONS_MISSING: "SCREEN_RECORDING_FACTORY_OPTIONS_MISSING",
|
|
@@ -9299,6 +9365,19 @@ var FAILURE_CODES = {
|
|
|
9299
9365
|
SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
|
|
9300
9366
|
SCREEN_RECORDING_STREAM_UNAVAILABLE: "SCREEN_RECORDING_STREAM_UNAVAILABLE",
|
|
9301
9367
|
SCREEN_RECORDING_FFMPEG_NOT_FOUND: "SCREEN_RECORDING_FFMPEG_NOT_FOUND",
|
|
9368
|
+
// A cabled iPhone has no simulator-server: its frames come from a host-side
|
|
9369
|
+
// CoreMediaIO capture helper, which can fail in ways of its own.
|
|
9370
|
+
SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED",
|
|
9371
|
+
SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND: "SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND",
|
|
9372
|
+
SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED: "SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED",
|
|
9373
|
+
SCREEN_RECORDING_DEVICE_HELPER_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_FAILED",
|
|
9374
|
+
AUDIO_CLIP_CONVERSION_FAILED: "AUDIO_CLIP_CONVERSION_FAILED",
|
|
9375
|
+
AUDIO_HOOK_NOT_ACTIVE: "AUDIO_HOOK_NOT_ACTIVE",
|
|
9376
|
+
AUDIO_ENV_SETUP_FAILED: "AUDIO_ENV_SETUP_FAILED",
|
|
9377
|
+
AUDIO_WRONG_PLATFORM: "AUDIO_WRONG_PLATFORM",
|
|
9378
|
+
AUDIO_HOOK_UNAVAILABLE: "AUDIO_HOOK_UNAVAILABLE",
|
|
9379
|
+
AUDIO_INJECTION_NOT_OURS: "AUDIO_INJECTION_NOT_OURS",
|
|
9380
|
+
AUDIO_SIMULATOR_NOT_BOOTED: "AUDIO_SIMULATOR_NOT_BOOTED",
|
|
9302
9381
|
FLOW_PROJECT_ROOT_INVALID: "FLOW_PROJECT_ROOT_INVALID",
|
|
9303
9382
|
FLOW_NAME_INVALID: "FLOW_NAME_INVALID",
|
|
9304
9383
|
FLOW_NO_ACTIVE_RECORDING: "FLOW_NO_ACTIVE_RECORDING",
|
|
@@ -9362,6 +9441,8 @@ var FAILURE_CODES = {
|
|
|
9362
9441
|
MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
|
|
9363
9442
|
MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
|
|
9364
9443
|
MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
|
|
9444
|
+
/** The app's loaded Argent library lacks support for the requested operation. */
|
|
9445
|
+
MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
|
|
9365
9446
|
KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
|
|
9366
9447
|
KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
|
|
9367
9448
|
KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
|
|
@@ -9548,7 +9629,7 @@ import { spawn as spawn2 } from "node:child_process";
|
|
|
9548
9629
|
import { once } from "node:events";
|
|
9549
9630
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
9550
9631
|
import { open, rm, readdir as readdir3 } from "node:fs/promises";
|
|
9551
|
-
import { basename as basename4, dirname as dirname5, join as join9, resolve as
|
|
9632
|
+
import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve7, sep as sep2 } from "node:path";
|
|
9552
9633
|
import { Writable } from "node:stream";
|
|
9553
9634
|
import { pipeline } from "node:stream/promises";
|
|
9554
9635
|
import zlib from "node:zlib";
|
|
@@ -9646,7 +9727,7 @@ async function sniffFormat(archivePath) {
|
|
|
9646
9727
|
}
|
|
9647
9728
|
}
|
|
9648
9729
|
var ZSTD_FRAME_MAGIC = 4247762216;
|
|
9649
|
-
async function assertSingleCompleteZstdFrame(archivePath) {
|
|
9730
|
+
async function assertSingleCompleteZstdFrame(archivePath, signal) {
|
|
9650
9731
|
const fh = await open(archivePath, "r");
|
|
9651
9732
|
try {
|
|
9652
9733
|
const { size } = await fh.stat();
|
|
@@ -9656,6 +9737,7 @@ async function assertSingleCompleteZstdFrame(archivePath) {
|
|
|
9656
9737
|
let pos = 0;
|
|
9657
9738
|
const read = async (n) => {
|
|
9658
9739
|
if (pos < windowStart || pos + n > windowEnd) {
|
|
9740
|
+
signal?.throwIfAborted();
|
|
9659
9741
|
const { bytesRead } = await fh.read(window, 0, window.length, pos);
|
|
9660
9742
|
windowStart = pos;
|
|
9661
9743
|
windowEnd = pos + bytesRead;
|
|
@@ -9693,14 +9775,16 @@ function tarEnv(env) {
|
|
|
9693
9775
|
const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
|
|
9694
9776
|
return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
|
|
9695
9777
|
}
|
|
9696
|
-
async function runTar(archive, args) {
|
|
9778
|
+
async function runTar(archive, args, signal) {
|
|
9697
9779
|
const child = spawn2("tar", [...args, "-f", "-"], {
|
|
9780
|
+
signal,
|
|
9698
9781
|
env: tarEnv(process.env)
|
|
9699
9782
|
});
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9783
|
+
let childError;
|
|
9784
|
+
child.on("error", (err) => {
|
|
9785
|
+
childError = err;
|
|
9703
9786
|
});
|
|
9787
|
+
const closed = new Promise((resolve11) => child.once("close", resolve11));
|
|
9704
9788
|
const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
|
|
9705
9789
|
maxLines: MAX_LISTING_LINES,
|
|
9706
9790
|
onOverflow: () => child.kill()
|
|
@@ -9727,12 +9811,15 @@ async function runTar(archive, args) {
|
|
|
9727
9811
|
if (err) child.stdin?.destroy();
|
|
9728
9812
|
done(err);
|
|
9729
9813
|
}
|
|
9730
|
-
})
|
|
9814
|
+
}),
|
|
9815
|
+
{ signal }
|
|
9731
9816
|
).then(
|
|
9732
9817
|
() => null,
|
|
9733
9818
|
(err) => err
|
|
9734
9819
|
);
|
|
9735
|
-
const [code, feedError] = await Promise.all([
|
|
9820
|
+
const [code, feedError] = await Promise.all([closed, fed]);
|
|
9821
|
+
signal?.throwIfAborted();
|
|
9822
|
+
if (childError) throw childError;
|
|
9736
9823
|
if (stdout.overflowed()) {
|
|
9737
9824
|
throw new Error(
|
|
9738
9825
|
`tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
|
|
@@ -9754,24 +9841,25 @@ function isContainedPath(path14, windows = process.platform === "win32") {
|
|
|
9754
9841
|
function isSafeTarMember(memberPath, destDir) {
|
|
9755
9842
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
9756
9843
|
if (!isContainedPath(normalized)) return false;
|
|
9757
|
-
const root =
|
|
9758
|
-
return
|
|
9844
|
+
const root = resolve7(destDir);
|
|
9845
|
+
return resolve7(destDir, normalized).startsWith(root + sep2);
|
|
9759
9846
|
}
|
|
9760
|
-
async function readListing(archive, args) {
|
|
9847
|
+
async function readListing(archive, args, signal) {
|
|
9761
9848
|
try {
|
|
9762
|
-
return await runTar(archive, args);
|
|
9849
|
+
return await runTar(archive, args, signal);
|
|
9763
9850
|
} catch (err) {
|
|
9851
|
+
signal?.throwIfAborted();
|
|
9764
9852
|
throw new ArchiveError(
|
|
9765
9853
|
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
9766
9854
|
);
|
|
9767
9855
|
}
|
|
9768
9856
|
}
|
|
9769
|
-
async function listTarMembers(archive) {
|
|
9770
|
-
const stdout = await readListing(archive, ["-t"]);
|
|
9857
|
+
async function listTarMembers(archive, signal) {
|
|
9858
|
+
const stdout = await readListing(archive, ["-t"], signal);
|
|
9771
9859
|
return stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
9772
9860
|
}
|
|
9773
|
-
async function assertSafeMemberTypes(archive) {
|
|
9774
|
-
const stdout = await readListing(archive, ["-tv"]);
|
|
9861
|
+
async function assertSafeMemberTypes(archive, signal) {
|
|
9862
|
+
const stdout = await readListing(archive, ["-tv"], signal);
|
|
9775
9863
|
for (const line of stdout.split("\n")) {
|
|
9776
9864
|
if (!line.trim()) continue;
|
|
9777
9865
|
const type = line[0];
|
|
@@ -9791,8 +9879,8 @@ async function assertSafeMemberTypes(archive) {
|
|
|
9791
9879
|
);
|
|
9792
9880
|
}
|
|
9793
9881
|
}
|
|
9794
|
-
async function assertSafeArchive(archive, destDir) {
|
|
9795
|
-
const members = await listTarMembers(archive);
|
|
9882
|
+
async function assertSafeArchive(archive, destDir, signal) {
|
|
9883
|
+
const members = await listTarMembers(archive, signal);
|
|
9796
9884
|
if (members.length === 0) {
|
|
9797
9885
|
throw new ArchiveError("Archive is empty.");
|
|
9798
9886
|
}
|
|
@@ -9801,7 +9889,7 @@ async function assertSafeArchive(archive, destDir) {
|
|
|
9801
9889
|
throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
|
|
9802
9890
|
}
|
|
9803
9891
|
}
|
|
9804
|
-
await assertSafeMemberTypes(archive);
|
|
9892
|
+
await assertSafeMemberTypes(archive, signal);
|
|
9805
9893
|
}
|
|
9806
9894
|
async function resolveMember(destDir, expectedName) {
|
|
9807
9895
|
const entries = await readdir3(destDir);
|
|
@@ -9816,19 +9904,24 @@ async function resolveMember(destDir, expectedName) {
|
|
|
9816
9904
|
}
|
|
9817
9905
|
return join9(destDir, real[0]);
|
|
9818
9906
|
}
|
|
9819
|
-
async function safeExtractArchive(archivePath, destDir, expectedName) {
|
|
9907
|
+
async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
|
|
9908
|
+
signal?.throwIfAborted();
|
|
9820
9909
|
let archive;
|
|
9821
9910
|
try {
|
|
9822
9911
|
archive = { path: archivePath, format: await sniffFormat(archivePath) };
|
|
9823
|
-
if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
|
|
9912
|
+
if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath, signal);
|
|
9824
9913
|
} catch (err) {
|
|
9914
|
+
signal?.throwIfAborted();
|
|
9825
9915
|
throw new ArchiveError(
|
|
9826
9916
|
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
9827
9917
|
);
|
|
9828
9918
|
}
|
|
9829
|
-
await assertSafeArchive(archive, destDir);
|
|
9830
|
-
|
|
9831
|
-
|
|
9919
|
+
await assertSafeArchive(archive, destDir, signal);
|
|
9920
|
+
signal?.throwIfAborted();
|
|
9921
|
+
await runTar(archive, ["-x", "-C", destDir], signal);
|
|
9922
|
+
const member = await resolveMember(destDir, expectedName);
|
|
9923
|
+
signal?.throwIfAborted();
|
|
9924
|
+
return member;
|
|
9832
9925
|
}
|
|
9833
9926
|
|
|
9834
9927
|
// ../argent-tools-client/src/errors.ts
|
|
@@ -9861,6 +9954,22 @@ function interpolatePath(template, args) {
|
|
|
9861
9954
|
});
|
|
9862
9955
|
return missing ? null : out;
|
|
9863
9956
|
}
|
|
9957
|
+
function callerPath(p) {
|
|
9958
|
+
const onCurrentDrive = path10.sep === "\\" && /^[\\/](?![\\/])/.test(p);
|
|
9959
|
+
if (!onCurrentDrive && (path10.isAbsolute(p) || path10.win32.isAbsolute(p) || isUnexpandedPath(p))) {
|
|
9960
|
+
return p;
|
|
9961
|
+
}
|
|
9962
|
+
const { root } = path10.parse(p);
|
|
9963
|
+
const rest = p.slice(root.length);
|
|
9964
|
+
if (!rest.split(/[\\/]/).includes("..")) {
|
|
9965
|
+
const resolved = path10.resolve(p);
|
|
9966
|
+
const last = p.split(path10.sep === "\\" ? /[\\/]/ : "/").at(-1);
|
|
9967
|
+
const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(path10.sep);
|
|
9968
|
+
return dirOnly ? `${resolved}${path10.sep}` : resolved;
|
|
9969
|
+
}
|
|
9970
|
+
const base = path10.resolve(root);
|
|
9971
|
+
return base.endsWith(path10.sep) ? `${base}${rest}` : `${base}${path10.sep}${rest}`;
|
|
9972
|
+
}
|
|
9864
9973
|
async function specPath(spec, args) {
|
|
9865
9974
|
if (spec.kind !== "file" || !spec.paths?.length) return interpolatePath(spec.path, args);
|
|
9866
9975
|
const candidates = [];
|
|
@@ -9905,10 +10014,10 @@ function untrackArchive(archive) {
|
|
|
9905
10014
|
for (const s of ARCHIVE_SIGNALS) process.removeListener(s, removeArchivesOnSignal);
|
|
9906
10015
|
process.removeListener("exit", removePendingArchives);
|
|
9907
10016
|
}
|
|
9908
|
-
function sha256File(filePath) {
|
|
9909
|
-
return new Promise((
|
|
10017
|
+
function sha256File(filePath, signal) {
|
|
10018
|
+
return new Promise((resolve11, reject) => {
|
|
9910
10019
|
const hash = createHash2("sha256");
|
|
9911
|
-
createReadStream2(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () =>
|
|
10020
|
+
createReadStream2(filePath, { signal }).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve11(hash.digest("hex"))).on("error", reject);
|
|
9912
10021
|
});
|
|
9913
10022
|
}
|
|
9914
10023
|
function toolServerError(text) {
|
|
@@ -9971,7 +10080,7 @@ async function uploadFile(sourcePath, endpoint, signal) {
|
|
|
9971
10080
|
trackArchive(tarPath);
|
|
9972
10081
|
try {
|
|
9973
10082
|
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
9974
|
-
const contentHash = await sha256File(tarPath);
|
|
10083
|
+
const contentHash = await sha256File(tarPath, signal);
|
|
9975
10084
|
return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
|
|
9976
10085
|
} finally {
|
|
9977
10086
|
untrackArchive(tarPath);
|
|
@@ -10006,13 +10115,21 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
10006
10115
|
return args;
|
|
10007
10116
|
}
|
|
10008
10117
|
const record = args;
|
|
10009
|
-
|
|
10118
|
+
const planned = [];
|
|
10119
|
+
const callArgs = { ...record };
|
|
10010
10120
|
for (const spec of specs) {
|
|
10011
10121
|
if (spec.skipWhenSet && record[spec.skipWhenSet] !== void 0) continue;
|
|
10012
10122
|
if (spec.target in record && typeof record[spec.target] !== "string") continue;
|
|
10013
|
-
const
|
|
10014
|
-
if (
|
|
10015
|
-
if (spec.target in record && record[spec.target] !==
|
|
10123
|
+
const spelled = await specPath(spec, record);
|
|
10124
|
+
if (spelled === null) continue;
|
|
10125
|
+
if (spec.target in record && record[spec.target] !== spelled) continue;
|
|
10126
|
+
const filePath = callerPath(spelled);
|
|
10127
|
+
planned.push({ spec, filePath });
|
|
10128
|
+
if (spec.target in record) callArgs[spec.target] = filePath;
|
|
10129
|
+
}
|
|
10130
|
+
if (planned.length === 0) return args;
|
|
10131
|
+
const out = { ...record };
|
|
10132
|
+
for (const { spec, filePath } of planned) {
|
|
10016
10133
|
const wire = { [FILE_INPUT_MARKER2]: true, path: filePath };
|
|
10017
10134
|
if (spec.kind === "file") {
|
|
10018
10135
|
const read = await readFileInputWire(filePath, { includeContent: opts.includeContent });
|
|
@@ -10020,12 +10137,12 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
10020
10137
|
if (spec.collect === "flow" && opts.includeContent && wire.content !== void 0 && opts.collectMembers) {
|
|
10021
10138
|
Object.assign(
|
|
10022
10139
|
wire,
|
|
10023
|
-
await opts.collectMembers(filePath, Buffer.from(wire.content, "base64"),
|
|
10140
|
+
await opts.collectMembers(filePath, Buffer.from(wire.content, "base64"), callArgs, opts)
|
|
10024
10141
|
);
|
|
10025
10142
|
}
|
|
10026
10143
|
}
|
|
10027
10144
|
if (spec.kind === "probe" && spec.collect === "step" && opts.includeContent && opts.collectStepMembers) {
|
|
10028
|
-
wire.members = await opts.collectStepMembers(
|
|
10145
|
+
wire.members = await opts.collectStepMembers(callArgs, opts);
|
|
10029
10146
|
}
|
|
10030
10147
|
if (spec.kind === "tar-upload") {
|
|
10031
10148
|
const st = await stat3(filePath).catch(() => null);
|
|
@@ -10039,10 +10156,9 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
10039
10156
|
Object.assign(wire, await uploadFile(filePath, opts.uploadEndpoint, opts.signal));
|
|
10040
10157
|
}
|
|
10041
10158
|
}
|
|
10042
|
-
out = out ?? { ...record };
|
|
10043
10159
|
out[spec.target] = wire;
|
|
10044
10160
|
}
|
|
10045
|
-
return out
|
|
10161
|
+
return out;
|
|
10046
10162
|
}
|
|
10047
10163
|
function isAllowedClientFilePath(p) {
|
|
10048
10164
|
if (!path10.isAbsolute(p)) return false;
|
|
@@ -10406,7 +10522,7 @@ function memberCollector(roots, opts) {
|
|
|
10406
10522
|
for (let file = files.shift(); file !== void 0; file = files.shift()) {
|
|
10407
10523
|
let doc;
|
|
10408
10524
|
try {
|
|
10409
|
-
doc = (0, import_yaml.parse)(file.text
|
|
10525
|
+
doc = (0, import_yaml.parse)(flowYamlSource(file.text), { logLevel: "error" });
|
|
10410
10526
|
} catch {
|
|
10411
10527
|
continue;
|
|
10412
10528
|
}
|
|
@@ -10521,7 +10637,7 @@ function recordedStep(args) {
|
|
|
10521
10637
|
async function collectStepMembers(args, opts, recordingDirFor = e2eDirFor) {
|
|
10522
10638
|
const { name, project_root: projectRoot } = args;
|
|
10523
10639
|
const step = recordedStep(args);
|
|
10524
|
-
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) ||
|
|
10640
|
+
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || !isResolvedAbsolute2(projectRoot) || step === void 0) {
|
|
10525
10641
|
return [];
|
|
10526
10642
|
}
|
|
10527
10643
|
const recording = path11.join(recordingDirFor(projectRoot), `${name}.yaml`);
|
|
@@ -10607,7 +10723,10 @@ async function stepForOlderServer(args, listedId) {
|
|
|
10607
10723
|
async function e2eShadowWarningFor(tool, args) {
|
|
10608
10724
|
const id = canonicalToolId(tool);
|
|
10609
10725
|
if (id !== "e2e-execute" && id !== "e2e-read-prerequisite") return void 0;
|
|
10610
|
-
const
|
|
10726
|
+
const root = args?.project_root;
|
|
10727
|
+
const target = nestedFlowTarget(
|
|
10728
|
+
typeof root === "string" ? { ...args, project_root: callerPath(root) } : args
|
|
10729
|
+
);
|
|
10611
10730
|
if (target?.kind !== "name") return void 0;
|
|
10612
10731
|
const picked = await pickE2eFile(target.paths);
|
|
10613
10732
|
return picked.shadowed === void 0 ? void 0 : e2eShadowWarning(picked.path, picked.shadowed);
|
|
@@ -10771,7 +10890,7 @@ async function forwardedSecrets(args) {
|
|
|
10771
10890
|
}
|
|
10772
10891
|
let parsed;
|
|
10773
10892
|
try {
|
|
10774
|
-
parsed = text === void 0 ? void 0 : (0, import_yaml2.parse)(text
|
|
10893
|
+
parsed = text === void 0 ? void 0 : (0, import_yaml2.parse)(flowYamlSource(text), { logLevel: "error" });
|
|
10775
10894
|
} catch {
|
|
10776
10895
|
continue;
|
|
10777
10896
|
}
|
|
@@ -10802,6 +10921,34 @@ function secretsTransportRefusal(url) {
|
|
|
10802
10921
|
return void 0;
|
|
10803
10922
|
}
|
|
10804
10923
|
var FETCH_HEAD_BYTES = 256;
|
|
10924
|
+
function isRecord2(value) {
|
|
10925
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10926
|
+
}
|
|
10927
|
+
var PROJECT_PATH_ADVICE = {
|
|
10928
|
+
project_root: "Pass the absolute path to the project root directory - the same cwd the calling agent is working in.",
|
|
10929
|
+
e2e_test_path: "Pass the absolute path to the e2e test file."
|
|
10930
|
+
};
|
|
10931
|
+
function assertAbsoluteProjectPaths(meta, args) {
|
|
10932
|
+
if (!meta || !isRecord2(args)) return;
|
|
10933
|
+
const aliases = Object.entries(toolParamAliases(meta.name));
|
|
10934
|
+
for (const [param, advice] of Object.entries(PROJECT_PATH_ADVICE)) {
|
|
10935
|
+
const value = args[param];
|
|
10936
|
+
if (typeof value !== "string" || callerPath(value) === value) continue;
|
|
10937
|
+
const names = [param, ...aliases.filter(([, current]) => current === param).map(([f]) => f)];
|
|
10938
|
+
if (!meta.fileInputs?.some((spec) => names.some((n) => spec.path.includes(`\${${n}}`)))) {
|
|
10939
|
+
continue;
|
|
10940
|
+
}
|
|
10941
|
+
throw new Error(`${param} must be an absolute path (got "${value}"). ${advice}`);
|
|
10942
|
+
}
|
|
10943
|
+
}
|
|
10944
|
+
function failedRun(result) {
|
|
10945
|
+
if (!isRecord2(result)) return result;
|
|
10946
|
+
if (result.ok === true) return { ...result, ok: false };
|
|
10947
|
+
if (isRecord2(result.toolResult) && result.toolResult.ok === true) {
|
|
10948
|
+
return { ...result, toolResult: { ...result.toolResult, ok: false } };
|
|
10949
|
+
}
|
|
10950
|
+
return result;
|
|
10951
|
+
}
|
|
10805
10952
|
function createToolsClient(options = {}) {
|
|
10806
10953
|
let cached = null;
|
|
10807
10954
|
const doFetch = options.fetchImpl ?? ((url, init) => fetch(url, init));
|
|
@@ -10850,6 +10997,7 @@ function createToolsClient(options = {}) {
|
|
|
10850
10997
|
let finalArgs = canonicalToolArgs(name, args);
|
|
10851
10998
|
const { tools, uploadFormats } = await fetchToolList({ signal: opts?.signal });
|
|
10852
10999
|
const meta = findTool(tools, name);
|
|
11000
|
+
if (options.refuseRelativeProjectPaths) assertAbsoluteProjectPaths(meta, finalArgs);
|
|
10853
11001
|
const olderServer = meta !== null && !tools.some((t) => t.name === canonicalToolId(meta.name));
|
|
10854
11002
|
if (meta) {
|
|
10855
11003
|
finalArgs = await nameToE2ePathForOlderServer(meta.name, meta.fileInputs, finalArgs);
|
|
@@ -10887,7 +11035,7 @@ function createToolsClient(options = {}) {
|
|
|
10887
11035
|
}
|
|
10888
11036
|
}
|
|
10889
11037
|
}
|
|
10890
|
-
const result = applied.result;
|
|
11038
|
+
const result = applied.failed.length > 0 ? failedRun(applied.result) : applied.result;
|
|
10891
11039
|
if (shadowWarning === void 0 || typeof result !== "object" || result === null || Array.isArray(result) || typeof result.warning === "string") {
|
|
10892
11040
|
return result;
|
|
10893
11041
|
}
|
|
@@ -11014,10 +11162,19 @@ function createToolsClient(options = {}) {
|
|
|
11014
11162
|
}
|
|
11015
11163
|
|
|
11016
11164
|
// ../argent-tools-client/src/artifacts.ts
|
|
11017
|
-
import {
|
|
11165
|
+
import {
|
|
11166
|
+
copyFile,
|
|
11167
|
+
mkdir as mkdir4,
|
|
11168
|
+
mkdtemp,
|
|
11169
|
+
readFile as readFile6,
|
|
11170
|
+
realpath as realpath4,
|
|
11171
|
+
rm as rm3,
|
|
11172
|
+
stat as stat5,
|
|
11173
|
+
writeFile as writeFile4
|
|
11174
|
+
} from "node:fs/promises";
|
|
11018
11175
|
import { constants as fsConstants } from "node:fs";
|
|
11019
11176
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
11020
|
-
import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as
|
|
11177
|
+
import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve10, sep as sep5 } from "node:path";
|
|
11021
11178
|
import { createHash as createHash3 } from "node:crypto";
|
|
11022
11179
|
var ARTIFACT_MARKER2 = "__argentArtifact";
|
|
11023
11180
|
function isArtifactHandle(value) {
|
|
@@ -11065,8 +11222,8 @@ function configuredRecordingsDir() {
|
|
|
11065
11222
|
const trimmed = value.trim();
|
|
11066
11223
|
if (trimmed === "") return null;
|
|
11067
11224
|
const home = dirname9(argentHomeDir());
|
|
11068
|
-
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${
|
|
11069
|
-
return
|
|
11225
|
+
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep5}`) ? join13(home, trimmed.slice(2)) : trimmed;
|
|
11226
|
+
return resolve10(durableBaseDir(), expanded);
|
|
11070
11227
|
}
|
|
11071
11228
|
var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
|
|
11072
11229
|
async function readCapped(res, cap) {
|
|
@@ -11113,7 +11270,7 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
11113
11270
|
function durableSaveTarget(handle) {
|
|
11114
11271
|
if (typeof handle.saveDir !== "string" || !handle.saveDir || handle.archive) return null;
|
|
11115
11272
|
const rel = normalize2(handle.saveDir);
|
|
11116
|
-
if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${
|
|
11273
|
+
if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${sep5}`) || rel.split(sep5).includes("..")) {
|
|
11117
11274
|
return null;
|
|
11118
11275
|
}
|
|
11119
11276
|
if (!ALLOWED_SAVE_DIRS.has(rel)) return null;
|
|
@@ -11158,16 +11315,22 @@ async function resolveLocalFile(handle) {
|
|
|
11158
11315
|
return null;
|
|
11159
11316
|
}
|
|
11160
11317
|
}
|
|
11161
|
-
async function downloadAndExtractArchive(handle, data, dir) {
|
|
11162
|
-
|
|
11318
|
+
async function downloadAndExtractArchive(handle, data, dir, signal) {
|
|
11319
|
+
signal?.throwIfAborted();
|
|
11320
|
+
const attemptDir = await mkdtemp(join13(dir, "bundle-"));
|
|
11321
|
+
const tarball = join13(attemptDir, "download.tar");
|
|
11322
|
+
const extractDir = join13(attemptDir, "files");
|
|
11163
11323
|
try {
|
|
11164
|
-
await writeFile4(tarball, data);
|
|
11165
|
-
|
|
11324
|
+
await writeFile4(tarball, data, { signal });
|
|
11325
|
+
await mkdir4(extractDir);
|
|
11326
|
+
const member = await safeExtractArchive(tarball, extractDir, handle.filename, signal);
|
|
11327
|
+
await rm3(tarball);
|
|
11328
|
+
signal?.throwIfAborted();
|
|
11329
|
+
return member;
|
|
11166
11330
|
} catch {
|
|
11167
|
-
|
|
11168
|
-
} finally {
|
|
11169
|
-
await rm3(tarball, { force: true }).catch(() => {
|
|
11331
|
+
await rm3(attemptDir, { recursive: true, force: true }).catch(() => {
|
|
11170
11332
|
});
|
|
11333
|
+
return null;
|
|
11171
11334
|
}
|
|
11172
11335
|
}
|
|
11173
11336
|
async function materializeArtifacts(result, ctx) {
|
|
@@ -11253,7 +11416,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
11253
11416
|
if (!data) return null;
|
|
11254
11417
|
await ensureDir();
|
|
11255
11418
|
if (value.archive === "tar.gz") {
|
|
11256
|
-
return await downloadAndExtractArchive(value, data, dir);
|
|
11419
|
+
return await downloadAndExtractArchive(value, data, dir, ctx.signal);
|
|
11257
11420
|
}
|
|
11258
11421
|
if (value.size > 0 && data.length !== value.size) return null;
|
|
11259
11422
|
const downloadedPath = join13(dir, sanitizeSegment(value.filename));
|
|
@@ -11290,12 +11453,12 @@ function getDeviceIdFromArgs(args) {
|
|
|
11290
11453
|
}
|
|
11291
11454
|
|
|
11292
11455
|
// src/bundled-paths.ts
|
|
11293
|
-
import * as
|
|
11456
|
+
import * as fs8 from "node:fs";
|
|
11294
11457
|
import * as path13 from "node:path";
|
|
11295
11458
|
function readPackageVersion() {
|
|
11296
11459
|
try {
|
|
11297
11460
|
const pkg = JSON.parse(
|
|
11298
|
-
|
|
11461
|
+
fs8.readFileSync(path13.join(import.meta.dirname, "..", "package.json"), "utf8")
|
|
11299
11462
|
);
|
|
11300
11463
|
return pkg.version;
|
|
11301
11464
|
} catch {
|
|
@@ -11306,9 +11469,9 @@ var PACKAGE_NAME = "@swmansion/argent";
|
|
|
11306
11469
|
function findDeclaringRoot(startDir) {
|
|
11307
11470
|
let dir = startDir;
|
|
11308
11471
|
for (; ; ) {
|
|
11309
|
-
if (
|
|
11472
|
+
if (fs8.existsSync(path13.join(dir, ".argent", "install.json"))) return dir;
|
|
11310
11473
|
try {
|
|
11311
|
-
const manifest = JSON.parse(
|
|
11474
|
+
const manifest = JSON.parse(fs8.readFileSync(path13.join(dir, "package.json"), "utf8"));
|
|
11312
11475
|
if (manifest.devDependencies?.[PACKAGE_NAME] || manifest.dependencies?.[PACKAGE_NAME] || manifest.optionalDependencies?.[PACKAGE_NAME]) {
|
|
11313
11476
|
return dir;
|
|
11314
11477
|
}
|
|
@@ -11324,7 +11487,7 @@ function findStablePackageDir(startDir, packageRoot) {
|
|
|
11324
11487
|
for (; ; ) {
|
|
11325
11488
|
const candidate = path13.join(dir, "node_modules", PACKAGE_NAME);
|
|
11326
11489
|
try {
|
|
11327
|
-
if (
|
|
11490
|
+
if (fs8.realpathSync(candidate) === packageRoot) return candidate;
|
|
11328
11491
|
} catch {
|
|
11329
11492
|
}
|
|
11330
11493
|
const parent = path13.dirname(dir);
|
|
@@ -11337,7 +11500,7 @@ function classifyInstall() {
|
|
|
11337
11500
|
let dir;
|
|
11338
11501
|
let cwd;
|
|
11339
11502
|
try {
|
|
11340
|
-
packageRoot =
|
|
11503
|
+
packageRoot = fs8.realpathSync(path13.join(import.meta.dirname, ".."));
|
|
11341
11504
|
cwd = process.cwd();
|
|
11342
11505
|
dir = cwd;
|
|
11343
11506
|
} catch {
|
|
@@ -11345,7 +11508,7 @@ function classifyInstall() {
|
|
|
11345
11508
|
}
|
|
11346
11509
|
for (; ; ) {
|
|
11347
11510
|
try {
|
|
11348
|
-
const nmReal =
|
|
11511
|
+
const nmReal = fs8.realpathSync(path13.join(dir, "node_modules"));
|
|
11349
11512
|
if (packageRoot === nmReal || packageRoot.startsWith(nmReal + path13.sep)) {
|
|
11350
11513
|
return {
|
|
11351
11514
|
kind: "local",
|