@swmansion/argent 0.35.1-next.5 → 0.35.1-next.7
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/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/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +33 -3
- package/dist/installer.mjs +1 -1
- package/dist/mcp-server.mjs +1 -1
- package/dist/tool-args.generated.d.ts +4 -0
- package/dist/tool-server.cjs +338 -184
- 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/argent-audio-feeder +0 -0
- package/dylibs/tcp/libArgentAudio.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 +2 -2
- package/skills/argent-create-e2e/references/e2e-yaml.md +6 -1
|
Binary file
|
|
Binary file
|
package/bin/darwin/ax-service
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/tcp/ax-service
CHANGED
|
Binary file
|
package/dist/cli-cmds.mjs
CHANGED
|
@@ -38585,7 +38585,7 @@ function isCi(env = process.env) {
|
|
|
38585
38585
|
var SESSION_ID2 = randomUUID5();
|
|
38586
38586
|
function readCliVersion() {
|
|
38587
38587
|
if (true) {
|
|
38588
|
-
return "0.35.1-next.
|
|
38588
|
+
return "0.35.1-next.7";
|
|
38589
38589
|
}
|
|
38590
38590
|
return "0.0.0";
|
|
38591
38591
|
}
|
|
@@ -39602,7 +39602,12 @@ function parseCommandArgs(argv, specs) {
|
|
|
39602
39602
|
if (spec.choices && !spec.choices.includes(value)) {
|
|
39603
39603
|
throw new UsageError(`${display} must be ${listChoices(spec.choices)}, got "${value}"`);
|
|
39604
39604
|
}
|
|
39605
|
-
|
|
39605
|
+
if (spec.repeatable) {
|
|
39606
|
+
const seen = options[name];
|
|
39607
|
+
options[name] = Array.isArray(seen) ? [...seen, value] : [value];
|
|
39608
|
+
} else {
|
|
39609
|
+
options[name] = value;
|
|
39610
|
+
}
|
|
39606
39611
|
}
|
|
39607
39612
|
return { positionals, options };
|
|
39608
39613
|
}
|
|
@@ -39875,6 +39880,8 @@ Options (run):
|
|
|
39875
39880
|
--update-baselines Write/refresh screenshot baselines instead of diffing,
|
|
39876
39881
|
also those of tests that tool: e2e-execute steps run,
|
|
39877
39882
|
unless such a step sets updateBaselines
|
|
39883
|
+
--env NAME=value Override a script environment value for this run.
|
|
39884
|
+
Repeatable. Values may contain {{secret:NAME}}
|
|
39878
39885
|
--output <dir> Also write failed snapshot images (baseline/current/diff)
|
|
39879
39886
|
and failed-step screenshots (step-<n>-screen.png)
|
|
39880
39887
|
under <dir>/<test>/ \u2014 a stable path for CI artifact
|
|
@@ -39897,6 +39904,7 @@ Examples:
|
|
|
39897
39904
|
argent e2e run .argent/e2e/checkout.yaml --output e2e-artifacts --json
|
|
39898
39905
|
argent e2e run ~/shared-e2e/checkout.yaml --device <UDID> --update-baselines
|
|
39899
39906
|
argent e2e run .argent/e2e --recursive
|
|
39907
|
+
argent e2e run checkout --env API_URL=https://staging.example.com
|
|
39900
39908
|
`);
|
|
39901
39909
|
}
|
|
39902
39910
|
var RUN_OPTIONS = {
|
|
@@ -39908,7 +39916,8 @@ var RUN_OPTIONS = {
|
|
|
39908
39916
|
// The tool-server's schema rejection carries no error_kind, so in a directory
|
|
39909
39917
|
// run it would stop the whole batch.
|
|
39910
39918
|
"platform": { kind: "value", choices: SELECTABLE_PLATFORMS },
|
|
39911
|
-
"output": { kind: "value" }
|
|
39919
|
+
"output": { kind: "value" },
|
|
39920
|
+
"env": { kind: "value", repeatable: true }
|
|
39912
39921
|
};
|
|
39913
39922
|
var LIST_OPTIONS = {
|
|
39914
39923
|
json: { kind: "boolean" },
|
|
@@ -39941,11 +39950,28 @@ function parseRunArgs(argv) {
|
|
|
39941
39950
|
if (options.device !== void 0) out.device = options.device;
|
|
39942
39951
|
if (options.platform !== void 0) out.platform = options.platform;
|
|
39943
39952
|
if (options.output !== void 0) out.output = options.output;
|
|
39953
|
+
if (options.env !== void 0) out.env = parseEnvFlags(options.env);
|
|
39944
39954
|
if (out.json && out.jsonStream) {
|
|
39945
39955
|
throw new FlagParseException("--json and --json-stream cannot be combined");
|
|
39946
39956
|
}
|
|
39947
39957
|
return out;
|
|
39948
39958
|
}
|
|
39959
|
+
var ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
39960
|
+
function parseEnvFlags(values) {
|
|
39961
|
+
const env = {};
|
|
39962
|
+
for (const entry of values) {
|
|
39963
|
+
const eq = entry.indexOf("=");
|
|
39964
|
+
const name = eq === -1 ? entry : entry.slice(0, eq);
|
|
39965
|
+
if (eq === -1 || !ENV_NAME_RE.test(name) || name === "__proto__") {
|
|
39966
|
+
throw new FlagParseException(
|
|
39967
|
+
`--env takes NAME=value with a name of letters, digits and _, not starting with a digit; got ${JSON.stringify(entry)}`
|
|
39968
|
+
);
|
|
39969
|
+
}
|
|
39970
|
+
delete env[name];
|
|
39971
|
+
env[name] = entry.slice(eq + 1);
|
|
39972
|
+
}
|
|
39973
|
+
return env;
|
|
39974
|
+
}
|
|
39949
39975
|
function renderEchoLine(s) {
|
|
39950
39976
|
if (!s.message) return void 0;
|
|
39951
39977
|
const indent = stepIndent(s.depth);
|
|
@@ -40087,6 +40113,9 @@ function rerunCommand(flowPath, rel, projectRoot, args) {
|
|
|
40087
40113
|
if (args.platform) parts.push("--platform", shellQuoteArg(args.platform));
|
|
40088
40114
|
if (args.updateBaselines) parts.push("--update-baselines");
|
|
40089
40115
|
if (args.output) parts.push("--output", pathArg(path19.join(args.output, path19.dirname(rel))));
|
|
40116
|
+
for (const [name, value] of Object.entries(args.env ?? {})) {
|
|
40117
|
+
parts.push("--env", shellQuoteArg(`${name}=${value}`));
|
|
40118
|
+
}
|
|
40090
40119
|
return parts.join(" ");
|
|
40091
40120
|
}
|
|
40092
40121
|
var EXPORT_SOURCE_MARKER = ".argent-e2e-source";
|
|
@@ -40371,6 +40400,7 @@ function buildRunPayload(flowPath, projectRoot, args) {
|
|
|
40371
40400
|
if (args.device) payload.device = args.device;
|
|
40372
40401
|
if (args.platform) payload.platform = args.platform;
|
|
40373
40402
|
if (args.updateBaselines) payload.updateBaselines = true;
|
|
40403
|
+
if (args.env) payload.env = args.env;
|
|
40374
40404
|
return payload;
|
|
40375
40405
|
}
|
|
40376
40406
|
function writeJsonStreamRecord(record2) {
|
package/dist/installer.mjs
CHANGED
|
@@ -17103,7 +17103,7 @@ function isCi(env = process.env) {
|
|
|
17103
17103
|
var SESSION_ID = randomUUID4();
|
|
17104
17104
|
function readCliVersion() {
|
|
17105
17105
|
if (true) {
|
|
17106
|
-
return "0.35.1-next.
|
|
17106
|
+
return "0.35.1-next.7";
|
|
17107
17107
|
}
|
|
17108
17108
|
return "0.0.0";
|
|
17109
17109
|
}
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -38044,7 +38044,7 @@ async function startMcpServer(options) {
|
|
|
38044
38044
|
const autoDescribeOn = autoDescribeEnabled();
|
|
38045
38045
|
const whatsNewOn = whatsNewEnabled();
|
|
38046
38046
|
const installedVersion = getInstalledVersion();
|
|
38047
|
-
const highlightsVersion = true ? "0.35.1-next.
|
|
38047
|
+
const highlightsVersion = true ? "0.35.1-next.7" : installedVersion;
|
|
38048
38048
|
const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
|
|
38049
38049
|
const trees = createTreeMemory();
|
|
38050
38050
|
const screenshots = createScreenshotMemory();
|
|
@@ -287,6 +287,10 @@ export interface ArgentToolArgs {
|
|
|
287
287
|
updateBaselines?: boolean;
|
|
288
288
|
/** Set to true to confirm the execution prerequisite has been met. Required when a fragment defines an executionPrerequisite: without it, the call runs no step and returns the prerequisite text. Not a dry run: an e2e test with no prerequisite runs in full. To read a prerequisite without running, read executionPrerequisite in the YAML file. */
|
|
289
289
|
prerequisiteAcknowledged?: boolean;
|
|
290
|
+
/** Script environment overrides for this run, including run: fragments. Names match [A-Za-z_][A-Za-z0-9_]*, except __proto__. Values can include {{secret:NAME}}. A missing secret rejects the run before any step. */
|
|
291
|
+
env?: {
|
|
292
|
+
[key: string]: string;
|
|
293
|
+
};
|
|
290
294
|
/** @deprecated Renamed to `e2e_test_path`. */
|
|
291
295
|
flow_path?: string;
|
|
292
296
|
/** @deprecated Renamed to `e2e_test_file`. */
|
package/dist/tool-server.cjs
CHANGED
|
@@ -72957,7 +72957,7 @@ function isCi(env = process.env) {
|
|
|
72957
72957
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
72958
72958
|
function readCliVersion() {
|
|
72959
72959
|
if (true) {
|
|
72960
|
-
return "0.35.1-next.
|
|
72960
|
+
return "0.35.1-next.7";
|
|
72961
72961
|
}
|
|
72962
72962
|
return "0.0.0";
|
|
72963
72963
|
}
|
|
@@ -75590,67 +75590,102 @@ ${describeSecretSources(sources)}
|
|
|
75590
75590
|
});
|
|
75591
75591
|
return { text: resolved, secrets };
|
|
75592
75592
|
}
|
|
75593
|
-
|
|
75594
|
-
|
|
75593
|
+
var MIN_FRAGMENT = 6;
|
|
75594
|
+
function redactSecrets(text, secrets) {
|
|
75595
|
+
return secretRedactor(secrets)(text);
|
|
75595
75596
|
}
|
|
75596
|
-
function
|
|
75597
|
-
const ordered =
|
|
75598
|
-
|
|
75599
|
-
const
|
|
75600
|
-
const
|
|
75601
|
-
|
|
75602
|
-
|
|
75603
|
-
|
|
75604
|
-
|
|
75605
|
-
|
|
75606
|
-
|
|
75607
|
-
if (marker > 0 && !valueLeavesMarker(text, at, at + marker, ordered)) {
|
|
75608
|
-
at += marker;
|
|
75609
|
-
continue;
|
|
75597
|
+
function secretRedactor(secrets) {
|
|
75598
|
+
const ordered = secrets.filter(({ value }) => value.length > 0).sort((a, b) => b.value.length - a.value.length || (a.name < b.name ? -1 : +(a.name > b.name)));
|
|
75599
|
+
const none = ordered.length;
|
|
75600
|
+
const spellings = ordered.map(({ value }) => [...spellingsOf(value)]);
|
|
75601
|
+
const windows = /* @__PURE__ */ new Map();
|
|
75602
|
+
spellings.forEach((forms, id) => {
|
|
75603
|
+
for (const spelling of forms) {
|
|
75604
|
+
for (let i = 0; i + MIN_FRAGMENT <= spelling.length; i++) {
|
|
75605
|
+
const window2 = spelling.slice(i, i + MIN_FRAGMENT);
|
|
75606
|
+
if (!windows.has(window2)) windows.set(window2, id);
|
|
75607
|
+
}
|
|
75610
75608
|
}
|
|
75611
|
-
|
|
75612
|
-
|
|
75613
|
-
|
|
75614
|
-
|
|
75615
|
-
|
|
75616
|
-
|
|
75617
|
-
|
|
75609
|
+
});
|
|
75610
|
+
const claims = (text, opts = {}) => {
|
|
75611
|
+
const owner = new Int32Array(text.length).fill(none);
|
|
75612
|
+
if (none === 0) return owner;
|
|
75613
|
+
const claim2 = (from2, to, id) => {
|
|
75614
|
+
for (let i = from2; i < to; i++) owner[i] = Math.min(owner[i], id);
|
|
75615
|
+
};
|
|
75616
|
+
spellings.forEach((forms, id) => {
|
|
75617
|
+
for (const spelling of forms) {
|
|
75618
|
+
if (spelling.length >= MIN_FRAGMENT) continue;
|
|
75619
|
+
for (let at = text.indexOf(spelling); at !== -1; at = text.indexOf(spelling, at + 1)) {
|
|
75620
|
+
claim2(at, at + spelling.length, id);
|
|
75621
|
+
}
|
|
75622
|
+
}
|
|
75623
|
+
});
|
|
75624
|
+
if (windows.size > 0) {
|
|
75625
|
+
for (let p = 0; p + MIN_FRAGMENT <= text.length; p++) {
|
|
75626
|
+
const id = windows.get(text.slice(p, p + MIN_FRAGMENT));
|
|
75627
|
+
if (id !== void 0) claim2(p, p + MIN_FRAGMENT, id);
|
|
75628
|
+
}
|
|
75618
75629
|
}
|
|
75619
|
-
|
|
75620
|
-
|
|
75621
|
-
|
|
75622
|
-
|
|
75623
|
-
|
|
75630
|
+
if (opts.cut) {
|
|
75631
|
+
spellings.forEach((forms, id) => {
|
|
75632
|
+
for (const spelling of forms) {
|
|
75633
|
+
const longest = Math.min(MIN_FRAGMENT - 1, spelling.length - 1, text.length);
|
|
75634
|
+
for (let n = longest; n > 0; n--) {
|
|
75635
|
+
if (text.endsWith(spelling.slice(0, n))) {
|
|
75636
|
+
claim2(text.length - n, text.length, id);
|
|
75637
|
+
break;
|
|
75638
|
+
}
|
|
75639
|
+
}
|
|
75640
|
+
}
|
|
75641
|
+
});
|
|
75642
|
+
}
|
|
75643
|
+
for (let i = 0; i + 1 < text.length; i++) {
|
|
75644
|
+
const high = text.charCodeAt(i);
|
|
75645
|
+
const low = text.charCodeAt(i + 1);
|
|
75646
|
+
if (high < 55296 || high > 56319 || low < 56320 || low > 57343) continue;
|
|
75647
|
+
const id = Math.min(owner[i], owner[i + 1]);
|
|
75648
|
+
owner[i] = id;
|
|
75649
|
+
owner[i + 1] = id;
|
|
75650
|
+
i++;
|
|
75651
|
+
}
|
|
75652
|
+
return owner;
|
|
75624
75653
|
};
|
|
75625
|
-
|
|
75626
|
-
|
|
75627
|
-
|
|
75628
|
-
for (
|
|
75629
|
-
if (at
|
|
75654
|
+
const render2 = (text, owner) => {
|
|
75655
|
+
let out = "";
|
|
75656
|
+
let copied = 0;
|
|
75657
|
+
for (let at = 0; at < text.length; at++) {
|
|
75658
|
+
if (owner[at] === none) continue;
|
|
75659
|
+
const { name } = ordered[owner[at]];
|
|
75660
|
+
let end = at + 1;
|
|
75661
|
+
while (end < text.length && ordered[owner[end]]?.name === name) end++;
|
|
75662
|
+
out += `${text.slice(copied, at)}${SECRET_PLACEHOLDER_MARKER}${name}}}`;
|
|
75663
|
+
copied = end;
|
|
75664
|
+
at = end - 1;
|
|
75630
75665
|
}
|
|
75631
|
-
|
|
75632
|
-
|
|
75633
|
-
|
|
75634
|
-
|
|
75635
|
-
|
|
75636
|
-
|
|
75637
|
-
}
|
|
75638
|
-
|
|
75639
|
-
return secrets.filter(({ value }) => value.length > 0).sort((a, b) => b.value.length - a.value.length);
|
|
75666
|
+
return copied === 0 ? text : out + text.slice(copied);
|
|
75667
|
+
};
|
|
75668
|
+
const redact2 = ((text, opts) => none === 0 || text.length === 0 ? text : render2(text, claims(text, opts)));
|
|
75669
|
+
return Object.assign(redact2, {
|
|
75670
|
+
claims,
|
|
75671
|
+
render: render2,
|
|
75672
|
+
names: new Set(ordered.map(({ name }) => name))
|
|
75673
|
+
});
|
|
75640
75674
|
}
|
|
75641
|
-
function
|
|
75642
|
-
|
|
75643
|
-
|
|
75644
|
-
|
|
75645
|
-
|
|
75646
|
-
|
|
75675
|
+
function spellingsOf(value) {
|
|
75676
|
+
const spellings = /* @__PURE__ */ new Set([value, JSON.stringify(value).slice(1, -1)]);
|
|
75677
|
+
try {
|
|
75678
|
+
spellings.add(encodeURIComponent(value));
|
|
75679
|
+
} catch {
|
|
75680
|
+
}
|
|
75681
|
+
return spellings;
|
|
75647
75682
|
}
|
|
75648
75683
|
function redactSecretsFromError(err, secrets) {
|
|
75649
75684
|
const forms = secrets.flatMap((secret) => {
|
|
75650
75685
|
const quoted = secret.value.replaceAll("'", "'\\''");
|
|
75651
75686
|
return quoted === secret.value ? [secret] : [secret, { name: secret.name, value: quoted }];
|
|
75652
75687
|
});
|
|
75653
|
-
const scrub = (s) =>
|
|
75688
|
+
const scrub = (s) => redactSecrets(s, forms);
|
|
75654
75689
|
if (err instanceof Error) {
|
|
75655
75690
|
err.message = scrub(err.message);
|
|
75656
75691
|
if (err.stack) err.stack = scrub(err.stack);
|
|
@@ -76452,6 +76487,7 @@ function toYamlStep(step) {
|
|
|
76452
76487
|
case "script": {
|
|
76453
76488
|
const body = { path: step.path };
|
|
76454
76489
|
if (step.timeout !== void 0) body.timeout = step.timeout;
|
|
76490
|
+
if (step.env) body.env = step.env;
|
|
76455
76491
|
return { script: body };
|
|
76456
76492
|
}
|
|
76457
76493
|
case "tool": {
|
|
@@ -77299,17 +77335,46 @@ function parseScriptStep(raw, body) {
|
|
|
77299
77335
|
);
|
|
77300
77336
|
}
|
|
77301
77337
|
if (body === null || typeof body !== "object" || Array.isArray(body)) {
|
|
77302
|
-
badEntry(
|
|
77338
|
+
badEntry(
|
|
77339
|
+
raw,
|
|
77340
|
+
"script needs { path, timeout?, env? }, e.g. `script: { path: scripts/seed.mjs }`"
|
|
77341
|
+
);
|
|
77303
77342
|
}
|
|
77304
77343
|
const b = body;
|
|
77305
|
-
rejectUnknownKeys(raw, b, ["path", "timeout"], "script");
|
|
77344
|
+
rejectUnknownKeys(raw, b, ["path", "timeout", "env"], "script");
|
|
77306
77345
|
const step = {
|
|
77307
77346
|
kind: "script",
|
|
77308
77347
|
path: parseScriptPath(raw, b.path)
|
|
77309
77348
|
};
|
|
77310
77349
|
if (b.timeout !== void 0) step.timeout = parseScriptTimeout(raw, b.timeout);
|
|
77350
|
+
if (b.env !== void 0) {
|
|
77351
|
+
const problem = flowEnvProblem(b.env);
|
|
77352
|
+
if (problem) badEntry(raw, `script.env ${problem}`);
|
|
77353
|
+
step.env = b.env;
|
|
77354
|
+
}
|
|
77311
77355
|
return step;
|
|
77312
77356
|
}
|
|
77357
|
+
var ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
77358
|
+
function flowEnvProblem(value) {
|
|
77359
|
+
if (value === null || typeof value !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) {
|
|
77360
|
+
return "must be a map of variable names to string values, e.g. `env: { API_URL: https://example.com }`";
|
|
77361
|
+
}
|
|
77362
|
+
for (const [name, entry] of Object.entries(value)) {
|
|
77363
|
+
if (!ENV_NAME_RE.test(name)) {
|
|
77364
|
+
return `has an invalid variable name ${JSON.stringify(name)}: use letters, digits and _, not starting with a digit`;
|
|
77365
|
+
}
|
|
77366
|
+
if (name === "__proto__") return "cannot set __proto__";
|
|
77367
|
+
if (typeof entry === "number" || typeof entry === "boolean") {
|
|
77368
|
+
return `has a non-string value for ${name}: quote it, e.g. \`${name}: "${entry}"\``;
|
|
77369
|
+
}
|
|
77370
|
+
if (typeof entry !== "string") return `has a non-string value for ${name}`;
|
|
77371
|
+
if (entry.includes("\0")) return `has a NUL character in the value of ${name}`;
|
|
77372
|
+
if (entry.includes(OUTPUT_REFERENCE_MARKER)) {
|
|
77373
|
+
return `uses unsupported template syntax in ${name}: only {{secret:NAME}} placeholders are resolved`;
|
|
77374
|
+
}
|
|
77375
|
+
}
|
|
77376
|
+
return void 0;
|
|
77377
|
+
}
|
|
77313
77378
|
function parseScriptPath(raw, value) {
|
|
77314
77379
|
if (typeof value !== "string" || value.length === 0) {
|
|
77315
77380
|
badEntry(
|
|
@@ -77799,6 +77864,7 @@ function serializeFlow(flow) {
|
|
|
77799
77864
|
const doc = {
|
|
77800
77865
|
version: FLOW_FILE_VERSION,
|
|
77801
77866
|
...flow.requires ? { requires: requiresToYaml(flow.requires) } : {},
|
|
77867
|
+
...flow.env ? { env: flow.env } : {},
|
|
77802
77868
|
steps: flow.steps.map(toYamlStep)
|
|
77803
77869
|
};
|
|
77804
77870
|
if (flow.executionPrerequisite) doc.executionPrerequisite = flow.executionPrerequisite;
|
|
@@ -77869,7 +77935,13 @@ function parseFlow(content) {
|
|
|
77869
77935
|
);
|
|
77870
77936
|
}
|
|
77871
77937
|
if (!("steps" in parsed2) || !Array.isArray(parsed2.steps)) throw notAFlow();
|
|
77872
|
-
const topKeys2 = [
|
|
77938
|
+
const topKeys2 = [
|
|
77939
|
+
"version",
|
|
77940
|
+
"executionPrerequisite",
|
|
77941
|
+
"requires",
|
|
77942
|
+
"env",
|
|
77943
|
+
"steps"
|
|
77944
|
+
];
|
|
77873
77945
|
const unknownTop = Object.keys(parsed2).filter((k) => !topKeys2.includes(k));
|
|
77874
77946
|
if (unknownTop.length > 0) {
|
|
77875
77947
|
throw new FailureError(
|
|
@@ -77886,9 +77958,21 @@ function parseFlow(content) {
|
|
|
77886
77958
|
if (raw !== null && typeof raw === "object") return fromYamlStep(raw);
|
|
77887
77959
|
return badEntry(raw, "step must be an object");
|
|
77888
77960
|
});
|
|
77961
|
+
if (parsed2.env !== void 0) {
|
|
77962
|
+
const problem = flowEnvProblem(parsed2.env);
|
|
77963
|
+
if (problem) {
|
|
77964
|
+
throw new FailureError(`Invalid e2e test file: env ${problem}`, {
|
|
77965
|
+
error_code: FAILURE_CODES.FLOW_FILE_INVALID,
|
|
77966
|
+
failure_stage: "flow_file_parse",
|
|
77967
|
+
failure_area: "tool_server",
|
|
77968
|
+
error_kind: "validation"
|
|
77969
|
+
});
|
|
77970
|
+
}
|
|
77971
|
+
}
|
|
77889
77972
|
const flow = {
|
|
77890
77973
|
executionPrerequisite: parsed2.executionPrerequisite ?? "",
|
|
77891
77974
|
...parsed2.requires === void 0 ? {} : { requires: parseRequires(parsed2.requires) },
|
|
77975
|
+
...parsed2.env === void 0 ? {} : { env: parsed2.env },
|
|
77892
77976
|
steps
|
|
77893
77977
|
};
|
|
77894
77978
|
validateFlow(flow);
|
|
@@ -163485,16 +163569,12 @@ function captureAbortSignal(env, budgetMs) {
|
|
|
163485
163569
|
}
|
|
163486
163570
|
function comparePixels(a, b, maskTopFraction = 0, maskBottomFraction = 0) {
|
|
163487
163571
|
if (a.width !== b.width || a.height !== b.height) return "moving";
|
|
163488
|
-
const
|
|
163489
|
-
const
|
|
163490
|
-
a.height - maskedRows,
|
|
163491
|
-
Math.floor(a.height * maskBottomFraction)
|
|
163492
|
-
);
|
|
163493
|
-
const total = a.width * (a.height - maskedRows - maskedBottomRows);
|
|
163572
|
+
const { start: start2, end } = unmaskedBytes(a, maskTopFraction, maskBottomFraction);
|
|
163573
|
+
const total = (end - start2) / 4;
|
|
163494
163574
|
if (total <= 0) return "still";
|
|
163495
|
-
const limit = Math.min(a.data.length, b.data.length,
|
|
163575
|
+
const limit = Math.min(a.data.length, b.data.length, end);
|
|
163496
163576
|
let changed = 0;
|
|
163497
|
-
for (let o =
|
|
163577
|
+
for (let o = start2; o + 2 < limit; o += 4) {
|
|
163498
163578
|
const dr = a.data[o] - b.data[o];
|
|
163499
163579
|
const dg = a.data[o + 1] - b.data[o + 1];
|
|
163500
163580
|
const db = a.data[o + 2] - b.data[o + 2];
|
|
@@ -163507,11 +163587,29 @@ function comparePixels(a, b, maskTopFraction = 0, maskBottomFraction = 0) {
|
|
|
163507
163587
|
if (changed > motionThreshold) return "moving";
|
|
163508
163588
|
return changed >= LOCALIZED_MOTION_MIN_PIXELS ? "localized" : "still";
|
|
163509
163589
|
}
|
|
163590
|
+
function unmaskedBytes(frame2, maskTopFraction, maskBottomFraction) {
|
|
163591
|
+
const maskedRows = Math.min(frame2.height, Math.floor(frame2.height * maskTopFraction));
|
|
163592
|
+
const maskedBottomRows = Math.min(
|
|
163593
|
+
frame2.height - maskedRows,
|
|
163594
|
+
Math.floor(frame2.height * maskBottomFraction)
|
|
163595
|
+
);
|
|
163596
|
+
return {
|
|
163597
|
+
start: maskedRows * frame2.width * 4,
|
|
163598
|
+
end: (frame2.height - maskedBottomRows) * frame2.width * 4
|
|
163599
|
+
};
|
|
163600
|
+
}
|
|
163601
|
+
function identicalPixels(a, b, maskTopFraction, maskBottomFraction) {
|
|
163602
|
+
if (a.width !== b.width || a.height !== b.height) return false;
|
|
163603
|
+
const { start: start2, end } = unmaskedBytes(a, maskTopFraction, maskBottomFraction);
|
|
163604
|
+
return a.data.subarray(start2, end).equals(b.data.subarray(start2, end));
|
|
163605
|
+
}
|
|
163510
163606
|
var SNAPSHOT_SETTLE_POLL_MS = 100;
|
|
163511
163607
|
var SNAPSHOT_SETTLE_TIMEOUT_MS = 3e3;
|
|
163512
163608
|
var SNAPSHOT_QUIET_AFTER_ACTION_MS = 300;
|
|
163513
163609
|
var ANDROID_SNAPSHOT_QUIET_AFTER_ACTION_MS = 400;
|
|
163514
163610
|
var SNAPSHOT_LOCALIZED_POLLS = 3;
|
|
163611
|
+
var SNAPSHOT_SLOW_START_WINDOW_MS = 2e3;
|
|
163612
|
+
var SNAPSHOT_SLOW_START_POLLS = 3;
|
|
163515
163613
|
var HOME_INDICATOR_MASK_FRACTION = 0.02;
|
|
163516
163614
|
async function settlesOnPixels(device) {
|
|
163517
163615
|
if (device.platform === "android") return device.kind === "emulator";
|
|
@@ -163520,24 +163618,38 @@ async function settlesOnPixels(device) {
|
|
|
163520
163618
|
}
|
|
163521
163619
|
async function settleOnPixels(env) {
|
|
163522
163620
|
const deadline = Date.now() + SNAPSHOT_SETTLE_TIMEOUT_MS;
|
|
163523
|
-
const
|
|
163621
|
+
const lastActionAt = env.lastActionAt ?? 0;
|
|
163622
|
+
const quietAfter = lastActionAt + (env.device.platform === "android" ? ANDROID_SNAPSHOT_QUIET_AFTER_ACTION_MS : SNAPSHOT_QUIET_AFTER_ACTION_MS);
|
|
163524
163623
|
const maskTopFraction = await statusBarMaskFraction(env.device);
|
|
163525
163624
|
const maskBottomFraction = maskTopFraction > 0 ? HOME_INDICATOR_MASK_FRACTION : 0;
|
|
163526
|
-
|
|
163625
|
+
const compare = (a, b) => comparePixels(a, b, maskTopFraction, maskBottomFraction);
|
|
163626
|
+
const identical = (a, b) => identicalPixels(a, b, maskTopFraction, maskBottomFraction);
|
|
163627
|
+
const mayStillBeChanging = (recent2, frame2) => {
|
|
163628
|
+
if (Date.now() - lastActionAt >= SNAPSHOT_SLOW_START_WINDOW_MS) return false;
|
|
163629
|
+
if (recent2.length < SNAPSHOT_SLOW_START_POLLS) return true;
|
|
163630
|
+
return compare(recent2[0], frame2) === "moving";
|
|
163631
|
+
};
|
|
163632
|
+
const first = await capturePixelsWithin(env, deadline, true);
|
|
163633
|
+
let recent = first ? [first] : [];
|
|
163527
163634
|
let compared = false;
|
|
163528
163635
|
let localizedPolls = 0;
|
|
163529
163636
|
while (Date.now() < deadline) {
|
|
163530
163637
|
if (!await sleepOrAbort(SNAPSHOT_SETTLE_POLL_MS, env.signal)) return "aborted";
|
|
163531
163638
|
const frame2 = await capturePixelsWithin(env, deadline, false);
|
|
163532
163639
|
if (env.signal?.aborted) return "aborted";
|
|
163533
|
-
if (
|
|
163640
|
+
if (!frame2) {
|
|
163641
|
+
recent = [];
|
|
163642
|
+
continue;
|
|
163643
|
+
}
|
|
163644
|
+
const previous = recent.at(-1);
|
|
163645
|
+
if (previous) {
|
|
163534
163646
|
compared = true;
|
|
163535
|
-
const change =
|
|
163647
|
+
const change = compare(previous, frame2);
|
|
163536
163648
|
localizedPolls = change === "localized" ? localizedPolls + 1 : 0;
|
|
163537
|
-
const settled = change === "still" || localizedPolls >= SNAPSHOT_LOCALIZED_POLLS;
|
|
163649
|
+
const settled = (change === "still" || localizedPolls >= SNAPSHOT_LOCALIZED_POLLS) && (identical(previous, frame2) || !mayStillBeChanging(recent, frame2));
|
|
163538
163650
|
if (settled && Date.now() >= quietAfter) return "still";
|
|
163539
163651
|
}
|
|
163540
|
-
|
|
163652
|
+
recent = [...recent, frame2].slice(-SNAPSHOT_SLOW_START_POLLS);
|
|
163541
163653
|
}
|
|
163542
163654
|
return compared ? "moving" : "blind";
|
|
163543
163655
|
}
|
|
@@ -166456,11 +166568,7 @@ var FlowScriptExecutor = class {
|
|
|
166456
166568
|
);
|
|
166457
166569
|
}
|
|
166458
166570
|
const timeoutMs = clampTimeout(request4.timeoutMs, bounds.maxTimeoutMs, notes);
|
|
166459
|
-
const capture = new ScriptLogCapture(
|
|
166460
|
-
() => request4.secrets ?? [],
|
|
166461
|
-
SCRIPT_STEP_LOG_LIMIT_BYTES,
|
|
166462
|
-
request4.logBudget
|
|
166463
|
-
);
|
|
166571
|
+
const capture = new ScriptLogCapture(SCRIPT_STEP_LOG_LIMIT_BYTES, request4.logBudget);
|
|
166464
166572
|
const scriptPath = realPathOrSelf(path65.resolve(cwd, request4.scriptPath));
|
|
166465
166573
|
let child;
|
|
166466
166574
|
try {
|
|
@@ -166510,8 +166618,9 @@ var FlowScriptExecutor = class {
|
|
|
166510
166618
|
};
|
|
166511
166619
|
child = (0, import_node_child_process54.fork)(scriptPath, [], forkOptions);
|
|
166512
166620
|
} catch (err) {
|
|
166621
|
+
const reason2 = redactSecrets(errorMessage5(err), request4.secrets ?? []);
|
|
166513
166622
|
return emptyResult(
|
|
166514
|
-
{ kind: "spawn", message: `Could not start the script process: ${
|
|
166623
|
+
{ kind: "spawn", message: `Could not start the script process: ${reason2}` },
|
|
166515
166624
|
{ notes, durationMs: Date.now() - startedAt }
|
|
166516
166625
|
);
|
|
166517
166626
|
}
|
|
@@ -166592,8 +166701,10 @@ var FlowScriptExecutor = class {
|
|
|
166592
166701
|
child.stderr?.destroy();
|
|
166593
166702
|
lifeline?.destroy?.();
|
|
166594
166703
|
if (child.connected) child.disconnect();
|
|
166595
|
-
const
|
|
166596
|
-
const
|
|
166704
|
+
const secrets = request4.secrets ?? [];
|
|
166705
|
+
const redact2 = secretRedactor(secrets);
|
|
166706
|
+
const { text: log, truncated: logTruncated } = redactedLog(capture, redact2);
|
|
166707
|
+
const verdict = redactVerdict(
|
|
166597
166708
|
classifyOutcome({
|
|
166598
166709
|
exit,
|
|
166599
166710
|
spawnProblem,
|
|
@@ -166606,12 +166717,12 @@ var FlowScriptExecutor = class {
|
|
|
166606
166717
|
heapFatalSeen: capture.heapFatalSeen,
|
|
166607
166718
|
heapLimitMb: bounds.heapLimitMb
|
|
166608
166719
|
}),
|
|
166609
|
-
|
|
166720
|
+
secrets.length > 0 ? redact2 : void 0
|
|
166610
166721
|
);
|
|
166611
166722
|
return {
|
|
166612
166723
|
...verdict,
|
|
166613
166724
|
log,
|
|
166614
|
-
logTruncated
|
|
166725
|
+
logTruncated,
|
|
166615
166726
|
durationMs: Date.now() - startedAt,
|
|
166616
166727
|
queuedMs: 0,
|
|
166617
166728
|
notes
|
|
@@ -166662,54 +166773,82 @@ function classifyOutcome(input2) {
|
|
|
166662
166773
|
`The script stopped its own process with exit code ${exit.code ?? 0} instead of returning; no output was captured.`
|
|
166663
166774
|
);
|
|
166664
166775
|
}
|
|
166665
|
-
function
|
|
166666
|
-
if (
|
|
166667
|
-
if (verdict.output)
|
|
166668
|
-
const collision = scrubDocument(verdict.output, secrets);
|
|
166669
|
-
if (collision) {
|
|
166670
|
-
return failed2(
|
|
166671
|
-
"output",
|
|
166672
|
-
`Two keys in the script's output become "${collision}" once the secret in them is redacted, so one would silently replace the other. Rename one of them.`
|
|
166673
|
-
);
|
|
166674
|
-
}
|
|
166675
|
-
}
|
|
166776
|
+
function redactVerdict(verdict, redact2) {
|
|
166777
|
+
if (!redact2) return verdict;
|
|
166778
|
+
if (verdict.output) redactDocument(verdict.output, redact2);
|
|
166676
166779
|
const failure3 = verdict.failure;
|
|
166677
166780
|
if (!failure3) return verdict;
|
|
166678
166781
|
return {
|
|
166679
166782
|
...verdict,
|
|
166680
166783
|
failure: {
|
|
166681
166784
|
...failure3,
|
|
166682
|
-
message:
|
|
166683
|
-
...failure3.stack ? { stack:
|
|
166785
|
+
message: redactClamped(failure3.message, redact2),
|
|
166786
|
+
...failure3.stack ? { stack: redactClamped(failure3.stack, redact2) } : {}
|
|
166684
166787
|
}
|
|
166685
166788
|
};
|
|
166686
166789
|
}
|
|
166687
|
-
function
|
|
166790
|
+
function redactedLog(capture, redact2) {
|
|
166791
|
+
const { parts: parts2 } = capture;
|
|
166792
|
+
const joined = parts2.map((part) => part.text).join("");
|
|
166793
|
+
if (redact2.names.size === 0) return { text: joined, truncated: capture.truncated };
|
|
166794
|
+
const result = clampRedacted(capture, redact2, joined);
|
|
166795
|
+
capture.settle(Buffer.byteLength(result.text, "utf8"));
|
|
166796
|
+
return result;
|
|
166797
|
+
}
|
|
166798
|
+
function clampRedacted(capture, redact2, joined) {
|
|
166799
|
+
const { parts: parts2 } = capture;
|
|
166800
|
+
const owner = redact2.claims(joined, { cut: capture.truncated });
|
|
166801
|
+
for (const stream of ["stdout", "stderr"]) {
|
|
166802
|
+
const own2 = parts2.filter((part) => part.stream === stream);
|
|
166803
|
+
const claims = redact2.claims(own2.map((part) => part.text).join(""), {
|
|
166804
|
+
cut: capture.truncated
|
|
166805
|
+
});
|
|
166806
|
+
let from2 = 0;
|
|
166807
|
+
let at = 0;
|
|
166808
|
+
for (const part of parts2) {
|
|
166809
|
+
if (part.stream === stream) {
|
|
166810
|
+
for (let i = 0; i < part.text.length; i++) {
|
|
166811
|
+
owner[at + i] = Math.min(owner[at + i], claims[from2 + i]);
|
|
166812
|
+
}
|
|
166813
|
+
from2 += part.text.length;
|
|
166814
|
+
}
|
|
166815
|
+
at += part.text.length;
|
|
166816
|
+
}
|
|
166817
|
+
}
|
|
166818
|
+
const text = redact2.render(joined, owner);
|
|
166819
|
+
const buffer = Buffer.from(text, "utf8");
|
|
166820
|
+
const limit = capture.renderLimit;
|
|
166821
|
+
if (buffer.length <= limit) {
|
|
166822
|
+
return { text, truncated: capture.truncated };
|
|
166823
|
+
}
|
|
166824
|
+
const cut = buffer.subarray(0, utf8SafeCut(buffer, limit)).toString("utf8");
|
|
166825
|
+
const open5 = text.lastIndexOf(SECRET_PLACEHOLDER_MARKER, cut.length - 1);
|
|
166826
|
+
const name = open5 === -1 ? void 0 : MARKER_AT_RE.exec(text.slice(open5))?.[1];
|
|
166827
|
+
const end = name !== void 0 && redact2.names.has(name) ? open5 + SECRET_PLACEHOLDER_MARKER.length + name.length + 2 : -1;
|
|
166828
|
+
if (end > cut.length) {
|
|
166829
|
+
return { text: text.slice(0, end), truncated: capture.truncated || end < text.length };
|
|
166830
|
+
}
|
|
166831
|
+
return { text: cut, truncated: true };
|
|
166832
|
+
}
|
|
166833
|
+
var MARKER_AT_RE = /^\{\{secret:([A-Za-z_][A-Za-z0-9_]*)\}\}/;
|
|
166834
|
+
var OMISSION_RE = /… \[\d+ more characters omitted]$/;
|
|
166835
|
+
function redactClamped(text, redact2) {
|
|
166836
|
+
const omission = OMISSION_RE.exec(text);
|
|
166837
|
+
if (!omission) return redact2(text);
|
|
166838
|
+
return redact2(text.slice(0, omission.index), { cut: true }) + omission[0];
|
|
166839
|
+
}
|
|
166840
|
+
function redactDocument(root, redact2) {
|
|
166688
166841
|
const pending = [root];
|
|
166689
166842
|
while (pending.length > 0) {
|
|
166690
166843
|
const node2 = pending.pop();
|
|
166691
|
-
if (Array.isArray(node2)) {
|
|
166692
|
-
for (let i = 0; i < node2.length; i++) {
|
|
166693
|
-
const value = node2[i];
|
|
166694
|
-
if (typeof value === "string") node2[i] = scrubSecretValues(value, secrets);
|
|
166695
|
-
else if (value !== null && typeof value === "object") pending.push(value);
|
|
166696
|
-
}
|
|
166697
|
-
continue;
|
|
166698
|
-
}
|
|
166699
166844
|
if (node2 === null || typeof node2 !== "object") continue;
|
|
166700
166845
|
const record2 = node2;
|
|
166701
166846
|
for (const key2 of Object.keys(record2)) {
|
|
166702
166847
|
const value = record2[key2];
|
|
166703
|
-
if (typeof value === "string") record2[key2] =
|
|
166848
|
+
if (typeof value === "string") record2[key2] = redact2(value);
|
|
166704
166849
|
else if (value !== null && typeof value === "object") pending.push(value);
|
|
166705
|
-
const scrubbedKey = scrubSecretValues(key2, secrets);
|
|
166706
|
-
if (scrubbedKey === key2) continue;
|
|
166707
|
-
if (Object.prototype.hasOwnProperty.call(record2, scrubbedKey)) return scrubbedKey;
|
|
166708
|
-
record2[scrubbedKey] = record2[key2];
|
|
166709
|
-
delete record2[key2];
|
|
166710
166850
|
}
|
|
166711
166851
|
}
|
|
166712
|
-
return void 0;
|
|
166713
166852
|
}
|
|
166714
166853
|
function commitOutput(outputJson) {
|
|
166715
166854
|
const bytes = Buffer.byteLength(outputJson, "utf8");
|
|
@@ -166766,17 +166905,6 @@ var IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
|
166766
166905
|
function memberPath(key2) {
|
|
166767
166906
|
return IDENTIFIER_RE.test(key2) ? `.${key2}` : `[${JSON.stringify(key2)}]`;
|
|
166768
166907
|
}
|
|
166769
|
-
function redactTruncated(text, secrets) {
|
|
166770
|
-
const scrubbed = scrubSecretValues(text, secrets);
|
|
166771
|
-
const omission = OMISSION_RE.exec(scrubbed);
|
|
166772
|
-
if (!omission) return scrubbed;
|
|
166773
|
-
const head = scrubbed.slice(0, omission.index);
|
|
166774
|
-
const partial2 = partialSecretTail(head, secrets);
|
|
166775
|
-
if (partial2 === 0) return scrubbed;
|
|
166776
|
-
const omitted = Number(omission[1]) + partial2;
|
|
166777
|
-
return `${head.slice(0, head.length - partial2)}${omissionMarker(omitted)}`;
|
|
166778
|
-
}
|
|
166779
|
-
var OMISSION_RE = /… \[(\d+) more characters omitted]$/;
|
|
166780
166908
|
function omissionMarker(omitted) {
|
|
166781
166909
|
return `\u2026 [${omitted} more characters omitted]`;
|
|
166782
166910
|
}
|
|
@@ -166906,6 +167034,22 @@ function probeTypeStripping(nodeOptions) {
|
|
|
166906
167034
|
}
|
|
166907
167035
|
});
|
|
166908
167036
|
}
|
|
167037
|
+
function mergeScriptEnv(...layers) {
|
|
167038
|
+
const env = {};
|
|
167039
|
+
for (const layer of layers) {
|
|
167040
|
+
for (const [name, value] of Object.entries(layer ?? {})) setEnvName(env, name, value);
|
|
167041
|
+
}
|
|
167042
|
+
return env;
|
|
167043
|
+
}
|
|
167044
|
+
function setEnvName(env, name, value) {
|
|
167045
|
+
if (process.platform === "win32") {
|
|
167046
|
+
const lower = name.toLowerCase();
|
|
167047
|
+
for (const existing of Object.keys(env)) {
|
|
167048
|
+
if (existing !== name && existing.toLowerCase() === lower) delete env[existing];
|
|
167049
|
+
}
|
|
167050
|
+
}
|
|
167051
|
+
env[name] = value;
|
|
167052
|
+
}
|
|
166909
167053
|
function buildChildEnv(overrides) {
|
|
166910
167054
|
const caseInsensitive = process.platform === "win32";
|
|
166911
167055
|
const allowed = new Set(
|
|
@@ -166940,7 +167084,7 @@ function buildChildEnv(overrides) {
|
|
|
166940
167084
|
`${name} cannot be set for a script: it steers the runner's own process (reserved names: ${reservedEnvNamesForMessage()}).`
|
|
166941
167085
|
);
|
|
166942
167086
|
}
|
|
166943
|
-
env
|
|
167087
|
+
setEnvName(env, name, value);
|
|
166944
167088
|
}
|
|
166945
167089
|
env[RUNNER_ACTIVATION_ENV] = "1";
|
|
166946
167090
|
return env;
|
|
@@ -167033,12 +167177,12 @@ function hasExited(child) {
|
|
|
167033
167177
|
return child.exitCode !== null || child.signalCode !== null;
|
|
167034
167178
|
}
|
|
167035
167179
|
var ScriptLogCapture = class {
|
|
167036
|
-
constructor(
|
|
167037
|
-
this.
|
|
167180
|
+
constructor(stepLimitBytes, runBudget) {
|
|
167181
|
+
this.stepLimitBytes = stepLimitBytes;
|
|
167038
167182
|
this.runBudget = runBudget;
|
|
167039
167183
|
this.stepRemaining = stepLimitBytes;
|
|
167040
167184
|
}
|
|
167041
|
-
|
|
167185
|
+
stepLimitBytes;
|
|
167042
167186
|
runBudget;
|
|
167043
167187
|
parts = [];
|
|
167044
167188
|
streams = /* @__PURE__ */ new Map();
|
|
@@ -167054,24 +167198,33 @@ var ScriptLogCapture = class {
|
|
|
167054
167198
|
*/
|
|
167055
167199
|
push(stream, chunk) {
|
|
167056
167200
|
const state3 = this.stateFor(stream);
|
|
167057
|
-
this.consume(state3, state3.decoder.write(chunk)
|
|
167201
|
+
this.consume(stream, state3, state3.decoder.write(chunk));
|
|
167058
167202
|
}
|
|
167059
167203
|
end() {
|
|
167060
|
-
for (const state3 of this.streams
|
|
167061
|
-
this.consume(state3, state3.decoder.end()
|
|
167204
|
+
for (const [stream, state3] of this.streams) {
|
|
167205
|
+
this.consume(stream, state3, state3.decoder.end());
|
|
167062
167206
|
if (state3.collapser) {
|
|
167063
|
-
this.append(state3.collapser.end());
|
|
167207
|
+
this.append(stream, state3.collapser.end());
|
|
167064
167208
|
if (state3.collapser.collapsed) this.truncatedFlag = true;
|
|
167065
167209
|
}
|
|
167066
167210
|
}
|
|
167067
167211
|
this.streams.clear();
|
|
167068
167212
|
}
|
|
167069
|
-
get text() {
|
|
167070
|
-
return scrubSecretValues(this.parts.join(""), this.secrets());
|
|
167071
|
-
}
|
|
167072
167213
|
get truncated() {
|
|
167073
167214
|
return this.truncatedFlag;
|
|
167074
167215
|
}
|
|
167216
|
+
/** What the redacted log may take: the step's limit, and what the run budget holds. */
|
|
167217
|
+
get renderLimit() {
|
|
167218
|
+
const charged = this.stepLimitBytes - this.stepRemaining;
|
|
167219
|
+
const runRemaining = this.runBudget ? Math.max(0, this.runBudget.remainingBytes) : Number.POSITIVE_INFINITY;
|
|
167220
|
+
return Math.min(this.stepLimitBytes, charged + runRemaining);
|
|
167221
|
+
}
|
|
167222
|
+
/** Charges the run budget for the log as returned, in place of the raw bytes captured. */
|
|
167223
|
+
settle(returnedBytes) {
|
|
167224
|
+
if (this.runBudget) {
|
|
167225
|
+
this.runBudget.remainingBytes += this.stepLimitBytes - this.stepRemaining - returnedBytes;
|
|
167226
|
+
}
|
|
167227
|
+
}
|
|
167075
167228
|
get heapFatalSeen() {
|
|
167076
167229
|
return this.heapFatalFlag;
|
|
167077
167230
|
}
|
|
@@ -167090,40 +167243,19 @@ var ScriptLogCapture = class {
|
|
|
167090
167243
|
if (!state3) {
|
|
167091
167244
|
state3 = {
|
|
167092
167245
|
decoder: new import_node_string_decoder.StringDecoder("utf8"),
|
|
167093
|
-
holdback: "",
|
|
167094
167246
|
...stream === "stderr" ? { collapser: new V8FrameCollapser(), watchForHeapFatal: true } : {}
|
|
167095
167247
|
};
|
|
167096
167248
|
this.streams.set(stream, state3);
|
|
167097
167249
|
}
|
|
167098
167250
|
return state3;
|
|
167099
167251
|
}
|
|
167100
|
-
consume(state3, text
|
|
167101
|
-
if (!text
|
|
167252
|
+
consume(stream, state3, text) {
|
|
167253
|
+
if (!text) return;
|
|
167102
167254
|
if (state3.watchForHeapFatal) this.watchForHeapFatal(text);
|
|
167103
|
-
|
|
167104
|
-
const held = state3.holdback;
|
|
167105
|
-
const pending = held + text;
|
|
167106
|
-
const { emit, held: keep } = scrubSecretChunk(pending, secrets, final);
|
|
167107
|
-
const split = pending.length - keep;
|
|
167108
|
-
state3.holdback = pending.slice(split);
|
|
167109
|
-
this.release(state3, held.slice(0, split), emit);
|
|
167255
|
+
this.append(stream, state3.collapser ? state3.collapser.write(text) : text);
|
|
167110
167256
|
if (state3.collapser?.collapsed) this.truncatedFlag = true;
|
|
167111
|
-
if (!state3.holdback) state3.holdbackAt = void 0;
|
|
167112
|
-
else if (split >= held.length) state3.holdbackAt = this.parts.push("") - 1;
|
|
167113
|
-
}
|
|
167114
|
-
release(state3, released, emit) {
|
|
167115
|
-
const at = state3.holdbackAt;
|
|
167116
|
-
if (at === void 0 || !emit) {
|
|
167117
|
-
this.append(state3.collapser ? state3.collapser.write(emit) : emit);
|
|
167118
|
-
return;
|
|
167119
|
-
}
|
|
167120
|
-
const head = scrubSecretValues(released, this.secrets());
|
|
167121
|
-
const headText = emit.startsWith(head) ? head : "";
|
|
167122
|
-
this.append(state3.collapser ? state3.collapser.write(headText) : headText, at);
|
|
167123
|
-
const tailText = emit.slice(headText.length);
|
|
167124
|
-
this.append(state3.collapser ? state3.collapser.write(tailText) : tailText);
|
|
167125
167257
|
}
|
|
167126
|
-
append(
|
|
167258
|
+
append(stream, text) {
|
|
167127
167259
|
if (!text) return;
|
|
167128
167260
|
const runRemaining = this.runBudget ? Math.max(0, this.runBudget.remainingBytes) : Number.POSITIVE_INFINITY;
|
|
167129
167261
|
const allowed = Math.min(this.stepRemaining, runRemaining);
|
|
@@ -167132,45 +167264,19 @@ var ScriptLogCapture = class {
|
|
|
167132
167264
|
return;
|
|
167133
167265
|
}
|
|
167134
167266
|
const buffer = Buffer.from(text, "utf8");
|
|
167135
|
-
|
|
167267
|
+
const taken = buffer.length <= allowed ? buffer.length : utf8SafeCut(buffer, allowed);
|
|
167136
167268
|
if (taken < buffer.length) {
|
|
167137
167269
|
this.truncatedFlag = true;
|
|
167138
167270
|
this.cut = true;
|
|
167139
|
-
taken = withoutPartialMarker(buffer, taken);
|
|
167140
167271
|
}
|
|
167141
167272
|
if (taken > 0) {
|
|
167142
167273
|
const kept = taken === buffer.length ? text : buffer.subarray(0, taken).toString("utf8");
|
|
167143
|
-
|
|
167144
|
-
else this.parts[at] += kept;
|
|
167274
|
+
this.parts.push({ stream, text: kept });
|
|
167145
167275
|
this.stepRemaining -= taken;
|
|
167146
167276
|
if (this.runBudget) this.runBudget.remainingBytes -= taken;
|
|
167147
167277
|
}
|
|
167148
167278
|
}
|
|
167149
167279
|
};
|
|
167150
|
-
function withoutPartialMarker(buffer, taken) {
|
|
167151
|
-
const text = buffer.subarray(0, taken).toString("utf8");
|
|
167152
|
-
const open5 = text.lastIndexOf(SECRET_PLACEHOLDER_MARKER);
|
|
167153
|
-
if (open5 >= 0 && !text.includes("}}", open5 + SECRET_PLACEHOLDER_MARKER.length)) {
|
|
167154
|
-
return Buffer.byteLength(text.slice(0, open5), "utf8");
|
|
167155
|
-
}
|
|
167156
|
-
for (let n = Math.min(SECRET_PLACEHOLDER_MARKER.length - 1, text.length); n > 0; n--) {
|
|
167157
|
-
if (text.endsWith(SECRET_PLACEHOLDER_MARKER.slice(0, n))) return taken - n;
|
|
167158
|
-
}
|
|
167159
|
-
return taken;
|
|
167160
|
-
}
|
|
167161
|
-
function partialSecretTail(text, secrets) {
|
|
167162
|
-
let keep = 0;
|
|
167163
|
-
for (const { value } of secrets) {
|
|
167164
|
-
const longest = Math.min(value.length - 1, text.length);
|
|
167165
|
-
for (let n = longest; n > keep; n--) {
|
|
167166
|
-
if (text.endsWith(value.slice(0, n))) {
|
|
167167
|
-
keep = n;
|
|
167168
|
-
break;
|
|
167169
|
-
}
|
|
167170
|
-
}
|
|
167171
|
-
}
|
|
167172
|
-
return keep;
|
|
167173
|
-
}
|
|
167174
167280
|
function utf8SafeCut(buffer, max) {
|
|
167175
167281
|
let cut = Math.min(max, buffer.length);
|
|
167176
167282
|
while (cut > 0 && (buffer[cut] & 192) === 128) cut -= 1;
|
|
@@ -167276,6 +167382,27 @@ function describeDuration(ms3) {
|
|
|
167276
167382
|
}
|
|
167277
167383
|
|
|
167278
167384
|
// ../tool-server/src/tools/flows/flow-script-step.ts
|
|
167385
|
+
init_capability();
|
|
167386
|
+
function resolveScriptEnv(env, projectRoot, clientSecrets) {
|
|
167387
|
+
const resolved = {};
|
|
167388
|
+
const secrets = [];
|
|
167389
|
+
for (const [name, value] of Object.entries(env)) {
|
|
167390
|
+
const { text, secrets: found } = resolveSecretPlaceholders(value, {
|
|
167391
|
+
cwd: projectRoot,
|
|
167392
|
+
...clientSecrets ? { clientSecrets } : {}
|
|
167393
|
+
});
|
|
167394
|
+
if (text.includes("\0")) {
|
|
167395
|
+
throw new InvalidToolInputError(
|
|
167396
|
+
`The value of ${name} holds a NUL character, which an environment value cannot carry.`
|
|
167397
|
+
);
|
|
167398
|
+
}
|
|
167399
|
+
resolved[name] = text;
|
|
167400
|
+
for (const secret of found) {
|
|
167401
|
+
if (!secrets.some((s) => s.name === secret.name)) secrets.push(secret);
|
|
167402
|
+
}
|
|
167403
|
+
}
|
|
167404
|
+
return { env: resolved, secrets };
|
|
167405
|
+
}
|
|
167279
167406
|
async function runFlowScriptStep(request4) {
|
|
167280
167407
|
const { flowDir, step } = request4;
|
|
167281
167408
|
const target = step.path;
|
|
@@ -167309,14 +167436,24 @@ async function runFlowScriptStep(request4) {
|
|
|
167309
167436
|
if (refusal !== void 0) {
|
|
167310
167437
|
return { ran: "no", outcome: { status: "error", reason: refusal } };
|
|
167311
167438
|
}
|
|
167439
|
+
let resolved;
|
|
167440
|
+
try {
|
|
167441
|
+
if (request4.env) {
|
|
167442
|
+
resolved = resolveScriptEnv(request4.env, request4.projectRoot, request4.clientSecrets);
|
|
167443
|
+
}
|
|
167444
|
+
} catch (err) {
|
|
167445
|
+
return {
|
|
167446
|
+
ran: "no",
|
|
167447
|
+
outcome: { status: "error", reason: err instanceof Error ? err.message : String(err) }
|
|
167448
|
+
};
|
|
167449
|
+
}
|
|
167312
167450
|
const result = await flowScriptExecutor().execute({
|
|
167313
167451
|
scriptPath: canonical,
|
|
167314
167452
|
output: {},
|
|
167315
167453
|
...step.timeout !== void 0 ? { timeoutMs: step.timeout } : {},
|
|
167316
167454
|
projectRoot: request4.projectRoot,
|
|
167317
167455
|
flowDir,
|
|
167318
|
-
|
|
167319
|
-
// nothing for the executor to redact out of the captured log.
|
|
167456
|
+
...resolved ? { env: resolved.env, secrets: resolved.secrets } : {},
|
|
167320
167457
|
...request4.logBudget ? { logBudget: request4.logBudget } : {},
|
|
167321
167458
|
...request4.signal ? { signal: request4.signal } : {}
|
|
167322
167459
|
});
|
|
@@ -170816,8 +170953,15 @@ var zodSchema75 = external_exports.object({
|
|
|
170816
170953
|
),
|
|
170817
170954
|
prerequisiteAcknowledged: external_exports.boolean().optional().describe(
|
|
170818
170955
|
"Set to true to confirm the execution prerequisite has been met. Required when a fragment defines an executionPrerequisite: without it, the call runs no step and returns the prerequisite text. Not a dry run: an e2e test with no prerequisite runs in full. To read a prerequisite without running, read executionPrerequisite in the YAML file."
|
|
170956
|
+
),
|
|
170957
|
+
env: external_exports.record(external_exports.string(), external_exports.string()).optional().describe(
|
|
170958
|
+
"Script environment overrides for this run, including run: fragments. Names match [A-Za-z_][A-Za-z0-9_]*, except __proto__. Values can include {{secret:NAME}}. A missing secret rejects the run before any step."
|
|
170819
170959
|
)
|
|
170820
170960
|
}).superRefine((params, ctx) => {
|
|
170961
|
+
const envProblem = params.env === void 0 ? void 0 : flowEnvProblem(params.env);
|
|
170962
|
+
if (envProblem) {
|
|
170963
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: envProblem, path: ["env"] });
|
|
170964
|
+
}
|
|
170821
170965
|
if (params.name === void 0 === (params.e2e_test_path === void 0)) {
|
|
170822
170966
|
ctx.addIssue({
|
|
170823
170967
|
code: external_exports.ZodIssueCode.custom,
|
|
@@ -170902,6 +171046,8 @@ Without a link, every step kind runs.`,
|
|
|
170902
171046
|
error_kind: "validation"
|
|
170903
171047
|
});
|
|
170904
171048
|
}
|
|
171049
|
+
const runEnv = mergeScriptEnv(params.env);
|
|
171050
|
+
resolveScriptEnv(runEnv, params.project_root, ctx?.clientSecrets);
|
|
170905
171051
|
const rootEntry = {
|
|
170906
171052
|
canonical: clientProject && rootInput ? clientRootCanonical(rootInput, params.name, flow) : canonicalPath2,
|
|
170907
171053
|
display: flowName
|
|
@@ -171003,6 +171149,7 @@ Without a link, every step kind runs.`,
|
|
|
171003
171149
|
snapshotApps: /* @__PURE__ */ new Map(),
|
|
171004
171150
|
secret: ctx?.flowSecret ?? {},
|
|
171005
171151
|
projectRoot: params.project_root,
|
|
171152
|
+
runEnv,
|
|
171006
171153
|
scriptLogBudget: createScriptLogBudget(),
|
|
171007
171154
|
networkCaptureNoted: /* @__PURE__ */ new Map(),
|
|
171008
171155
|
...!resolved.booted && device?.platform === "chromium" ? { attachedDeviceId: device.id } : {},
|
|
@@ -171012,6 +171159,7 @@ Without a link, every step kind runs.`,
|
|
|
171012
171159
|
try {
|
|
171013
171160
|
await execSteps(state3, flow.steps, {
|
|
171014
171161
|
runStack: seed,
|
|
171162
|
+
fileEnv: flow.env ?? {},
|
|
171015
171163
|
rootDisplay: rootEntry.display,
|
|
171016
171164
|
depth: 0,
|
|
171017
171165
|
legacyPoints: flowFormatVersion(flow) < 2
|
|
@@ -171358,7 +171506,9 @@ async function execSteps(state3, steps, scope) {
|
|
|
171358
171506
|
startedAt -= state3.hoistedBootMs;
|
|
171359
171507
|
state3.hoistedBootMs = void 0;
|
|
171360
171508
|
}
|
|
171361
|
-
if (JSON.stringify(step).includes(SECRET_PLACEHOLDER_MARKER))
|
|
171509
|
+
if (step.kind !== "script" && JSON.stringify(step).includes(SECRET_PLACEHOLDER_MARKER)) {
|
|
171510
|
+
state3.secret.typed = true;
|
|
171511
|
+
}
|
|
171362
171512
|
const report = await inCoordinateSpace(
|
|
171363
171513
|
scope.legacyPoints && step.kind === "tool" ? "native" : "upright",
|
|
171364
171514
|
() => execLeafStep(state3, step, index, scope)
|
|
@@ -171551,6 +171701,7 @@ async function execRunStep(state3, step, scope) {
|
|
|
171551
171701
|
fragment.steps,
|
|
171552
171702
|
childScope(scope, {
|
|
171553
171703
|
runStack: [...scope.runStack, { canonical, display }],
|
|
171704
|
+
fileEnv: mergeScriptEnv(fragment.env, scope.fileEnv),
|
|
171554
171705
|
legacyPoints: flowFormatVersion(fragment) < 2
|
|
171555
171706
|
})
|
|
171556
171707
|
);
|
|
@@ -171559,10 +171710,13 @@ function oneLineReason(text) {
|
|
|
171559
171710
|
return text.replace(/\\/g, "\\\\").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
|
|
171560
171711
|
}
|
|
171561
171712
|
async function runScriptStep(state3, step, scope) {
|
|
171713
|
+
const env = mergeScriptEnv(scope.fileEnv, step.env, state3.runEnv);
|
|
171562
171714
|
const { outcome } = await runFlowScriptStep({
|
|
171563
171715
|
flowDir: scopeFlowDir(scope),
|
|
171564
171716
|
step,
|
|
171565
171717
|
projectRoot: state3.projectRoot,
|
|
171718
|
+
env,
|
|
171719
|
+
...state3.ctx?.clientSecrets ? { clientSecrets: state3.ctx.clientSecrets } : {},
|
|
171566
171720
|
logBudget: state3.scriptLogBudget,
|
|
171567
171721
|
...state3.signal ? { signal: state3.signal } : {}
|
|
171568
171722
|
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swmansion/argent",
|
|
3
|
-
"version": "0.35.1-next.
|
|
3
|
+
"version": "0.35.1-next.7",
|
|
4
4
|
"mcpName": "io.github.software-mansion/argent",
|
|
5
5
|
"description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"vitest": "^5.0.5",
|
|
99
99
|
"yaml": "^2.9.1"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "f08fda01f14d7105db692d16edacac7cf588a706"
|
|
102
102
|
}
|
|
@@ -249,12 +249,17 @@ A `run:` target is a YAML path resolved against the directory of the test file c
|
|
|
249
249
|
```yaml
|
|
250
250
|
- script: { path: ../../scripts/seed-order.mjs }
|
|
251
251
|
- script: { path: ../../scripts/seed-order.mjs, timeout: 60000 }
|
|
252
|
+
- script: { path: ../../scripts/seed-order.mjs, env: { API_TOKEN: "{{secret:API_TOKEN}}" } }
|
|
252
253
|
```
|
|
253
254
|
|
|
254
255
|
Use the map form shown above. A bare `script: scripts/seed.mjs` is invalid.
|
|
255
256
|
|
|
256
257
|
`path` is relative to the test file that contains the step. Use an `.mjs` or `.js` file, or an `.mts` or `.ts` file for TypeScript, and match the file name's letter case. `timeout` is in milliseconds, as in `e2e-add-script`.
|
|
257
258
|
|
|
259
|
+
Add `env` to the YAML after recording. Use top-level `env` for script defaults, step `env` for one script, and `--env NAME=value` or `e2e-execute.env` for run overrides. The last layer to set a name wins. A `run:` fragment fills missing defaults. Pass overrides explicitly to a separate `tool: e2e-execute` run.
|
|
260
|
+
|
|
261
|
+
Quote non-string YAML scalars, such as `PORT: "8080"`. Use `{{secret:NAME}}` for credentials and keep credentials out of logs. If a secret is missing, check the secret sources for the run's project root. See [Environment values](https://docs.swmansion.com/argent/docs/reference/e2e-yaml#environment-values) for the value rules and redaction limits.
|
|
262
|
+
|
|
258
263
|
`.mjs` and `.mts` are always ES modules. `.js` and `.ts` take their module type from the project's `package.json` `type` field; with no `type`, Node reads a file with `import`, `export` or top-level `await` as an ES module, and each other file as CommonJS. So prefer `.mjs` or `.mts` for a new script and use `.js` or `.ts` for a script the project already has. `.cjs` and `.cts` are invalid: under `"type": "module"`, use `import` in the script, not `require`.
|
|
259
264
|
|
|
260
265
|
Node runs `.mts` and `.ts` by removing the types, and it does not read `tsconfig.json`. In an `.mts` or `.ts` script:
|
|
@@ -269,7 +274,7 @@ Over a link (`argent link` or `ARGENT_TOOLS_URL`, also to 127.0.0.1), `e2e-add-s
|
|
|
269
274
|
|
|
270
275
|
## Snapshots and CLI runs
|
|
271
276
|
|
|
272
|
-
`argent e2e run <name> [--device <id>] [--platform ios|android|chromium|vega|macos|ios-remote] [--update-baselines] [--output <dir>] [--json]` runs without an LLM and exits non-zero on failure.
|
|
277
|
+
`argent e2e run <name> [--device <id>] [--platform ios|android|chromium|vega|macos|ios-remote] [--update-baselines] [--env NAME=value] [--output <dir>] [--json]` runs without an LLM and exits non-zero on failure.
|
|
273
278
|
|
|
274
279
|
A screenshot is human evidence. A `snapshot:` is executable visual verification. A missing baseline or excessive mismatch fails. A `cropOn` size change also fails. Use snapshots for color, layout, size, spacing, typography, clipping, overflow, images, icons, or stable component appearance. Use full screen for global changes and `cropOn` for one component.
|
|
275
280
|
|