@swmansion/argent 0.29.1-next.9 → 0.30.0
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/README.md +2 -2
- package/bin/argent-android-devtools-0.3.0.apk +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/tcp/ax-service +0 -0
- package/bin/win32/simulator-server.exe +0 -0
- package/dist/cli-cmds.mjs +1186 -865
- package/dist/cli.js +3 -2
- package/dist/cli.js.map +1 -1
- package/dist/client.js +758 -517
- package/dist/flow-script-runner.mjs +1 -1
- package/dist/installer.mjs +1025 -832
- package/dist/mcp-server.mjs +826 -579
- package/dist/tool-args.generated.d.ts +53 -39
- package/dist/tool-server.cjs +5035 -2797
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.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 +7 -7
- package/rules/argent.md +10 -10
- package/skills/{argent-create-flow → argent-create-e2e}/SKILL.md +16 -16
- package/skills/{argent-create-flow/references/flow-yaml.md → argent-create-e2e/references/e2e-yaml.md} +33 -33
- package/skills/{argent-create-flow → argent-create-e2e}/references/live-authoring.md +62 -62
- package/skills/{argent-create-flow → argent-create-e2e}/references/reliability-and-recovery.md +18 -18
- package/skills/argent-device-interact/SKILL.md +10 -8
- package/skills/argent-device-interact/references/chromium.md +1 -1
- package/skills/argent-ios-device-interact/SKILL.md +1 -1
- package/skills/argent-metro-debugger/SKILL.md +1 -1
- package/skills/argent-native-profiler/SKILL.md +1 -1
- package/skills/{argent-qa-flows → argent-qa-e2e}/SKILL.md +23 -23
- package/skills/argent-react-native-optimization/SKILL.md +2 -2
- package/skills/argent-react-native-profiler/SKILL.md +3 -3
- package/skills/argent-screen-recording/SKILL.md +1 -1
- package/skills/argent-test-ui-flow/SKILL.md +4 -4
package/dist/client.js
CHANGED
|
@@ -35,322 +35,395 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
35
35
|
mod
|
|
36
36
|
));
|
|
37
37
|
|
|
38
|
-
// ../../node_modules/dotenv/
|
|
39
|
-
var
|
|
40
|
-
"../../node_modules/dotenv/
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
function parseBoolean(value) {
|
|
59
|
-
if (typeof value === "string") {
|
|
60
|
-
return !["false", "0", "no", "off", ""].includes(value.toLowerCase());
|
|
61
|
-
}
|
|
62
|
-
return Boolean(value);
|
|
63
|
-
}
|
|
64
|
-
function supportsAnsi() {
|
|
65
|
-
return process.stdout.isTTY;
|
|
66
|
-
}
|
|
67
|
-
function dim(text) {
|
|
68
|
-
return supportsAnsi() ? `\x1B[2m${text}\x1B[0m` : text;
|
|
69
|
-
}
|
|
70
|
-
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
71
|
-
function parse(src) {
|
|
72
|
-
const obj = {};
|
|
73
|
-
let lines = src.toString();
|
|
74
|
-
lines = lines.replace(/\r\n?/mg, "\n");
|
|
75
|
-
let match;
|
|
76
|
-
while ((match = LINE.exec(lines)) != null) {
|
|
77
|
-
const key = match[1];
|
|
78
|
-
let value = match[2] || "";
|
|
79
|
-
value = value.trim();
|
|
80
|
-
const maybeQuote = value[0];
|
|
81
|
-
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
|
|
82
|
-
if (maybeQuote === '"') {
|
|
83
|
-
value = value.replace(/\\n/g, "\n");
|
|
84
|
-
value = value.replace(/\\r/g, "\r");
|
|
85
|
-
}
|
|
86
|
-
obj[key] = value;
|
|
87
|
-
}
|
|
88
|
-
return obj;
|
|
89
|
-
}
|
|
90
|
-
function _parseVault(options) {
|
|
91
|
-
options = options || {};
|
|
92
|
-
const vaultPath = _vaultPath(options);
|
|
93
|
-
options.path = vaultPath;
|
|
94
|
-
const result = DotenvModule.configDotenv(options);
|
|
95
|
-
if (!result.parsed) {
|
|
96
|
-
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
97
|
-
err.code = "MISSING_DATA";
|
|
98
|
-
throw err;
|
|
99
|
-
}
|
|
100
|
-
const keys = _dotenvKey(options).split(",");
|
|
101
|
-
const length = keys.length;
|
|
102
|
-
let decrypted;
|
|
103
|
-
for (let i = 0; i < length; i++) {
|
|
104
|
-
try {
|
|
105
|
-
const key = keys[i].trim();
|
|
106
|
-
const attrs = _instructions(result, key);
|
|
107
|
-
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
108
|
-
break;
|
|
109
|
-
} catch (error) {
|
|
110
|
-
if (i + 1 >= length) {
|
|
111
|
-
throw error;
|
|
112
|
-
}
|
|
38
|
+
// ../../node_modules/dotenv/dist/index.cjs
|
|
39
|
+
var require_dist = __commonJS({
|
|
40
|
+
"../../node_modules/dotenv/dist/index.cjs"(exports, module) {
|
|
41
|
+
var j = (e, n) => () => {
|
|
42
|
+
try {
|
|
43
|
+
return n || e((n = { exports: {} }).exports, n), n.exports;
|
|
44
|
+
} catch (t) {
|
|
45
|
+
throw n = 0, t;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var k = j((xe, U) => {
|
|
49
|
+
function G(e) {
|
|
50
|
+
return typeof e == "string" ? !["false", "0", "no", "off", ""].includes(e.toLowerCase()) : !!e;
|
|
51
|
+
}
|
|
52
|
+
function Y(e = process.env) {
|
|
53
|
+
let n = {};
|
|
54
|
+
for (let t of ["ENCODING", "PATH", "QUIET", "DEBUG", "OVERRIDE", "FAST"]) {
|
|
55
|
+
let o = e[`DOTENV_${t}`] != null ? e[`DOTENV_${t}`] : e[`DOTENV_CONFIG_${t}`];
|
|
56
|
+
o != null && (n[t.toLowerCase()] = t === "ENCODING" || t === "PATH" ? o : G(o));
|
|
113
57
|
}
|
|
58
|
+
return n;
|
|
114
59
|
}
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
60
|
+
U.exports = { parseBoolean: G, optionsFromEnv: Y };
|
|
61
|
+
});
|
|
62
|
+
var N = j((ye, x) => {
|
|
63
|
+
var z = __require("fs"), I = __require("path"), Z = __require("os"), { URL: ee, fileURLToPath: te } = __require("url"), { parseBoolean: $, optionsFromEnv: B } = k(), re = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg, b = new Uint8Array(256);
|
|
64
|
+
for (let e = 48; e <= 57; e++) b[e] = 1;
|
|
65
|
+
for (let e = 65; e <= 90; e++) b[e] = 1;
|
|
66
|
+
for (let e = 97; e <= 122; e++) b[e] = 1;
|
|
67
|
+
b[45] = 1;
|
|
68
|
+
b[46] = 1;
|
|
69
|
+
b[95] = 1;
|
|
70
|
+
function ne(e) {
|
|
71
|
+
let n = {}, t = e.toString();
|
|
72
|
+
t = t.replace(/\r\n?/mg, `
|
|
73
|
+
`);
|
|
74
|
+
let o;
|
|
75
|
+
for (; (o = re.exec(t)) != null; ) {
|
|
76
|
+
let r = o[1], s = o[2] || "";
|
|
77
|
+
s = s.trim();
|
|
78
|
+
let i = s[0];
|
|
79
|
+
s = s.replace(/^(['"`])([\s\S]*)\1$/mg, "$2"), i === '"' && (s = s.replace(/\\n/g, `
|
|
80
|
+
`), s = s.replace(/\\r/g, "\r")), n[r] = s;
|
|
81
|
+
}
|
|
82
|
+
return n;
|
|
129
83
|
}
|
|
130
|
-
|
|
131
|
-
return
|
|
84
|
+
function w(e) {
|
|
85
|
+
return e <= 32 ? e === 32 || e >= 9 && e <= 13 : e >= 160 && (e === 160 || e === 5760 || e >= 8192 && e <= 8202 || e === 8232 || e === 8233 || e === 8239 || e === 8287 || e === 12288 || e === 65279);
|
|
132
86
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
87
|
+
function q(e) {
|
|
88
|
+
return e === 10 || e === 8232 || e === 8233;
|
|
89
|
+
}
|
|
90
|
+
function oe(e) {
|
|
91
|
+
let n = {}, t = typeof e == "string" ? e : e.toString();
|
|
92
|
+
t.indexOf("\r") !== -1 && (t = t.replace(/\r\n?/g, `
|
|
93
|
+
`));
|
|
94
|
+
let o = t.length, r = 0;
|
|
95
|
+
for (; r < o; ) {
|
|
96
|
+
let s = t.charCodeAt(r);
|
|
97
|
+
for (; r < o && w(s); ) r++, s = t.charCodeAt(r);
|
|
98
|
+
if (r >= o) break;
|
|
99
|
+
if (s === 35) {
|
|
100
|
+
for (; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
let i = -1;
|
|
104
|
+
if (s === 101 && r + 6 < o && t.charCodeAt(r + 1) === 120 && t.charCodeAt(r + 2) === 112 && t.charCodeAt(r + 3) === 111 && t.charCodeAt(r + 4) === 114 && t.charCodeAt(r + 5) === 116) {
|
|
105
|
+
let v = t.charCodeAt(r + 6);
|
|
106
|
+
if (w(v)) {
|
|
107
|
+
let u = r + 7;
|
|
108
|
+
for (; u < o && w(t.charCodeAt(u)); ) u++;
|
|
109
|
+
b[t.charCodeAt(u)] && (i = r + 6, r = u);
|
|
110
|
+
} else s = t.charCodeAt(r);
|
|
111
|
+
}
|
|
112
|
+
let l = r, d = 0;
|
|
113
|
+
for (; r < o && (d = t.charCodeAt(r), b[d]); ) r++;
|
|
114
|
+
if (r === l) {
|
|
115
|
+
for (; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
let h = t.slice(l, r), f = r;
|
|
119
|
+
if (r >= o && (d = 0), w(d)) do
|
|
120
|
+
r++, d = r < o ? t.charCodeAt(r) : 0;
|
|
121
|
+
while (w(d));
|
|
122
|
+
if (d === 61) r++;
|
|
123
|
+
else if (d === 58 && r === f && r + 1 < o && w(t.charCodeAt(r + 1))) r += 2;
|
|
124
|
+
else {
|
|
125
|
+
for (r = i === -1 ? f : i; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
let c = r, a = r;
|
|
129
|
+
for (; a < o && w(t.charCodeAt(a)); ) a++;
|
|
130
|
+
let g = t.charCodeAt(a), p, y = false;
|
|
131
|
+
if (g === 39 || g === 34 || g === 96) {
|
|
132
|
+
let v = t[a], u = t.indexOf(v, a + 1), m = -1, C = -1;
|
|
133
|
+
for (; u !== -1; ) {
|
|
134
|
+
let O = t.charCodeAt(u - 1) === 92, E = u + 1;
|
|
135
|
+
for (; E < o && !q(t.charCodeAt(E)) && w(t.charCodeAt(E)); ) E++;
|
|
136
|
+
if ((E === o || q(t.charCodeAt(E)) || t.charCodeAt(E) === 35) && (m = u, C = E), !O) break;
|
|
137
|
+
u = t.indexOf(v, u + 1);
|
|
138
|
+
}
|
|
139
|
+
if (m !== -1) {
|
|
140
|
+
if (p = t.slice(a + 1, m), r = C, t.charCodeAt(r) === 35) for (; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
141
|
+
y = true;
|
|
175
142
|
}
|
|
176
143
|
}
|
|
177
|
-
|
|
178
|
-
|
|
144
|
+
if (!y) {
|
|
145
|
+
let v = t.indexOf(`
|
|
146
|
+
`, c);
|
|
147
|
+
v === -1 && (v = o);
|
|
148
|
+
let u;
|
|
149
|
+
if (o < 4096) u = t.indexOf("#", c), (u === -1 || u > v) && (u = v);
|
|
150
|
+
else for (u = c; u < v && t.charCodeAt(u) !== 35; ) u++;
|
|
151
|
+
let m = c, C = u;
|
|
152
|
+
for (; m < C && w(t.charCodeAt(m)); ) m++;
|
|
153
|
+
for (; C > m && w(t.charCodeAt(C - 1)); ) C--;
|
|
154
|
+
let O = t.charCodeAt(m);
|
|
155
|
+
if (p = t.slice(m, C), p.includes("\u2028") || p.includes("\u2029") ? p = p.replace(/^(['"`])([\s\S]*)\1$/mg, "$2") : C - m >= 2 && (O === 39 || O === 34 || O === 96) && t.charCodeAt(C - 1) === O && (p = t.slice(m + 1, C - 1)), r = u, u < v) for (; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
156
|
+
}
|
|
157
|
+
g === 34 && (y || a < r) && p.indexOf("\\") !== -1 && (p = p.replace(/\\n/g, `
|
|
158
|
+
`).replace(/\\r/g, "\r")), n[h] = p;
|
|
179
159
|
}
|
|
180
|
-
|
|
181
|
-
possibleVaultPath = path13.resolve(process.cwd(), ".env.vault");
|
|
160
|
+
return n;
|
|
182
161
|
}
|
|
183
|
-
|
|
184
|
-
return
|
|
162
|
+
function se(e, n) {
|
|
163
|
+
return n && $(n.fast) ? oe(e) : ne(e);
|
|
185
164
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
165
|
+
function T(e) {
|
|
166
|
+
console.log(`\u2506 ${e}`);
|
|
167
|
+
}
|
|
168
|
+
function ie(e) {
|
|
169
|
+
console.error(`\u25C7 ${e}`);
|
|
170
|
+
}
|
|
171
|
+
function V(e) {
|
|
172
|
+
return e[0] === "~" ? I.join(Z.homedir(), e.slice(1)) : e;
|
|
173
|
+
}
|
|
174
|
+
function ce(e = {}) {
|
|
175
|
+
let n = { ...e };
|
|
176
|
+
for (let t of Object.keys(n)) n[t] === void 0 && delete n[t];
|
|
177
|
+
return { ...B(), ...n };
|
|
178
|
+
}
|
|
179
|
+
function ae(e) {
|
|
180
|
+
e = ce(e);
|
|
181
|
+
let n = I.resolve(process.cwd(), ".env"), t = "utf8", o = process.env;
|
|
182
|
+
e && e.processEnv != null && (o = e.processEnv);
|
|
183
|
+
let r = $(e && e.debug);
|
|
184
|
+
e && e.encoding ? t = e.encoding : r && T("no encoding is specified (UTF-8 is used by default)");
|
|
185
|
+
let s = [n];
|
|
186
|
+
if (e && e.path) if (!Array.isArray(e.path)) s = [V(e.path)];
|
|
187
|
+
else {
|
|
188
|
+
s = [];
|
|
189
|
+
for (let c of e.path) s.push(V(c));
|
|
190
|
+
}
|
|
191
|
+
let i, l = {}, d = { fast: e.fast };
|
|
192
|
+
for (let c of s) try {
|
|
193
|
+
let a = A.parse(z.readFileSync(c, { encoding: t }), d);
|
|
194
|
+
A.populate(l, a, e);
|
|
195
|
+
} catch (a) {
|
|
196
|
+
r && T(`failed to load ${c} ${a.message}`), i = a;
|
|
197
|
+
}
|
|
198
|
+
let h = A.populate(o, l, e), f = $(Object.prototype.hasOwnProperty.call(e, "quiet") ? e.quiet : B(o).quiet);
|
|
199
|
+
if (r || !f) {
|
|
200
|
+
let c = Object.keys(h).length, a = [];
|
|
201
|
+
for (let g of s) try {
|
|
202
|
+
let p = I.relative(process.cwd(), g instanceof ee ? te(g) : g);
|
|
203
|
+
a.push(p);
|
|
204
|
+
} catch (p) {
|
|
205
|
+
r && T(`failed to load ${g} ${p.message}`), i = p;
|
|
206
|
+
}
|
|
207
|
+
ie(`injected env (${c}) from ${a.join(",")}`);
|
|
219
208
|
}
|
|
209
|
+
return i ? { parsed: l, error: i } : { parsed: l };
|
|
220
210
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
211
|
+
function le(e) {
|
|
212
|
+
return A.configDotenv(e);
|
|
213
|
+
}
|
|
214
|
+
function fe(e, n, t = {}) {
|
|
215
|
+
let o = $(t && t.debug), r = $(t && t.override), s = {};
|
|
216
|
+
if (e === null || typeof e != "object" || n === null || typeof n != "object") {
|
|
217
|
+
let i = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
218
|
+
throw i.code = "OBJECT_REQUIRED", i;
|
|
219
|
+
}
|
|
220
|
+
for (let i of Object.keys(n)) Object.prototype.hasOwnProperty.call(e, i) ? (r === true && (e[i] = n[i], s[i] = n[i]), o && T(r === true ? `"${i}" is already defined and WAS overwritten` : `"${i}" is already defined and was NOT overwritten`)) : (e[i] = n[i], s[i] = n[i]);
|
|
221
|
+
return s;
|
|
222
|
+
}
|
|
223
|
+
var A = { configDotenv: ae, config: le, parse: se, populate: fe };
|
|
224
|
+
x.exports.configDotenv = A.configDotenv;
|
|
225
|
+
x.exports.config = A.config;
|
|
226
|
+
x.exports.parse = A.parse;
|
|
227
|
+
x.exports.populate = A.populate;
|
|
228
|
+
x.exports = A;
|
|
229
|
+
});
|
|
230
|
+
var M = j((Te, W) => {
|
|
231
|
+
var _ = __require("child_process"), ue = __require("fs"), L = __require("path");
|
|
232
|
+
function de(e) {
|
|
233
|
+
let n = ['"'], t = 0;
|
|
234
|
+
for (let o of e) {
|
|
235
|
+
if (o === "\\") {
|
|
236
|
+
t++;
|
|
237
|
+
continue;
|
|
229
238
|
}
|
|
239
|
+
o === '"' ? n.push("\\".repeat(t * 2 + 1), '"') : n.push("\\".repeat(t), o), t = 0;
|
|
230
240
|
}
|
|
241
|
+
return n.push("\\".repeat(t * 2), '"'), n.join("");
|
|
231
242
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
} catch (e) {
|
|
239
|
-
if (debug) {
|
|
240
|
-
_debug(`failed to load ${path14} ${e.message}`);
|
|
241
|
-
}
|
|
242
|
-
lastError = e;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
const populated = DotenvModule.populate(processEnv, parsedAll, options);
|
|
246
|
-
debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
|
|
247
|
-
quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
|
|
248
|
-
if (debug || !quiet) {
|
|
249
|
-
const keysCount = Object.keys(populated).length;
|
|
250
|
-
const shortPaths = [];
|
|
251
|
-
for (const filePath of optionPaths) {
|
|
252
|
-
try {
|
|
253
|
-
const relative2 = path13.relative(process.cwd(), filePath);
|
|
254
|
-
shortPaths.push(relative2);
|
|
255
|
-
} catch (e) {
|
|
256
|
-
if (debug) {
|
|
257
|
-
_debug(`failed to load ${filePath} ${e.message}`);
|
|
258
|
-
}
|
|
259
|
-
lastError = e;
|
|
243
|
+
function H(e, n = 1) {
|
|
244
|
+
for (let t = 0; t < n; t++) {
|
|
245
|
+
let o = [];
|
|
246
|
+
for (let r of e) {
|
|
247
|
+
let s = r.charCodeAt(0), i = s >= 48 && s <= 57 || s >= 65 && s <= 90 || s >= 97 && s <= 122, l = "\\/:._-".includes(r);
|
|
248
|
+
!i && !l && s < 128 && o.push("^"), o.push(r);
|
|
260
249
|
}
|
|
250
|
+
e = o.join("");
|
|
261
251
|
}
|
|
262
|
-
|
|
252
|
+
return e;
|
|
263
253
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
return { parsed: parsedAll };
|
|
254
|
+
function P(e, n) {
|
|
255
|
+
let t = Object.keys(e).reverse().find((o) => o.toUpperCase() === n);
|
|
256
|
+
return t === void 0 ? void 0 : e[t];
|
|
268
257
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
258
|
+
function pe(e, n, t) {
|
|
259
|
+
let o = (P(n, "PATHEXT") || ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean), s = o.some((l) => e.toLowerCase().endsWith(l.toLowerCase())) ? ["", ...o] : [...o, ""], i = /[\\/]/.test(e) ? [t] : [t, ...(P(n, "PATH") || "").split(";")];
|
|
260
|
+
for (let l of i) for (let d of s) {
|
|
261
|
+
let h = L.resolve(t, l.replace(/^"|"$/g, ""), e + d);
|
|
262
|
+
try {
|
|
263
|
+
if (ue.statSync(h).isFile()) return h;
|
|
264
|
+
} catch {
|
|
265
|
+
}
|
|
266
|
+
}
|
|
273
267
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
return
|
|
268
|
+
function he(e, n, t) {
|
|
269
|
+
if (process.platform !== "win32") return _.spawn(e, n, t);
|
|
270
|
+
let o = t.env || process.env, r = pe(e, o, t.cwd || process.cwd());
|
|
271
|
+
if (r && /\.(?:exe|com)$/i.test(r)) return _.spawn(r, n, t);
|
|
272
|
+
let s = /\.(?:bat|cmd)$/i.test(r || e), i = [H(L.normalize(r || e))];
|
|
273
|
+
for (let d of n) i.push(H(de(d), s ? 2 : 1));
|
|
274
|
+
let l = i.join(" ");
|
|
275
|
+
return _.spawn(P(o, "COMSPEC") || "cmd.exe", ["/d", "/v:off", "/s", "/c", `"${l}"`], { ...t, windowsVerbatimArguments: true });
|
|
278
276
|
}
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
277
|
+
W.exports = he;
|
|
278
|
+
});
|
|
279
|
+
var X = j(($e, F) => {
|
|
280
|
+
var ge = __require("fs"), me = __require("os"), Q = __require("path"), ve = __require("child_process"), Ce = M(), R = N(), { optionsFromEnv: J } = k();
|
|
281
|
+
function D() {
|
|
282
|
+
console.log(["Usage: dotenv run [--help] [-q|--quiet] [--debug] [--override] [--fast] [-f|--file <paths>] [--] <command> [args...]", "", "Run a command with environment variables from a .env file.", "Place dotenv options before the command; all following arguments go to the command.", "", "Options:", " -f, --file <paths> .env paths, comma-separated or repeated (default: .env)", " -q, --quiet suppress the injected env message", " --debug enable debug logging", " --override override existing environment variables", " --fast use the faster character-scanner parser", "", "Environment variables (DOTENV_CONFIG_* names remain as fallbacks):", " DOTENV_PATH, DOTENV_ENCODING, DOTENV_QUIET,", " DOTENV_DEBUG, DOTENV_OVERRIDE,", " DOTENV_FAST"].join(`
|
|
283
|
+
`));
|
|
284
|
+
}
|
|
285
|
+
function we(e) {
|
|
286
|
+
let n = [], t = false, o, r, s, i, l = -1;
|
|
287
|
+
for (let h = 0; h < e.length; h++) {
|
|
288
|
+
let f = e[h];
|
|
289
|
+
if (f === "--") {
|
|
290
|
+
l = h + 1;
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
if (f === "--help" || f === "-h") return { help: true };
|
|
294
|
+
if (f === "--quiet" || f === "-q") {
|
|
295
|
+
o = true;
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
if (f === "--debug") {
|
|
299
|
+
r = true;
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
if (f === "--override") {
|
|
303
|
+
s = true;
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
if (f === "--fast") {
|
|
307
|
+
i = true;
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
if (f === "-f" || f === "--file" || f.startsWith("-f=") || f.startsWith("--file=")) {
|
|
311
|
+
let c = f.indexOf("="), a = c === -1 ? f : f.slice(0, c), g = c === -1 ? e[++h] : f.slice(c + 1);
|
|
312
|
+
if (!g || g === "--") return { error: `${a} requires a path` };
|
|
313
|
+
let p = g.split(",").map((y) => y.trim()).filter(Boolean);
|
|
314
|
+
if (p.length === 0) return { error: `${a} requires a path` };
|
|
315
|
+
n.push(...p), t = true;
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
if (f.startsWith("-")) return { error: `unknown option: ${f}` };
|
|
319
|
+
l = h;
|
|
320
|
+
break;
|
|
305
321
|
}
|
|
322
|
+
let d = l === -1 ? [] : e.slice(l);
|
|
323
|
+
return { paths: n, pathSet: t, quiet: o, debug: r, override: s, fast: i, command: d };
|
|
306
324
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const debug = Boolean(options && options.debug);
|
|
310
|
-
const override = Boolean(options && options.override);
|
|
311
|
-
const populated = {};
|
|
312
|
-
if (typeof parsed !== "object") {
|
|
313
|
-
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
314
|
-
err.code = "OBJECT_REQUIRED";
|
|
315
|
-
throw err;
|
|
325
|
+
function Ae(e) {
|
|
326
|
+
return e[0] === "~" ? Q.join(me.homedir(), e.slice(1)) : e;
|
|
316
327
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
328
|
+
function Ee(e) {
|
|
329
|
+
let n = J(), t = { encoding: n.encoding || "utf8", quiet: n.quiet, debug: n.debug === true, override: n.override === true, fast: n.fast === true, paths: [".env"], defaultPath: true };
|
|
330
|
+
return n.path != null && (t.paths = [n.path], t.defaultPath = false), e.pathSet && (t.paths = e.paths, t.defaultPath = false), e.quiet != null && (t.quiet = e.quiet), e.debug != null && (t.debug = e.debug), e.override != null && (t.override = e.override), e.fast != null && (t.fast = e.fast), t;
|
|
331
|
+
}
|
|
332
|
+
function be(e) {
|
|
333
|
+
let n = {}, t = [], o = { override: e.override, debug: e.debug };
|
|
334
|
+
for (let s of e.paths) {
|
|
335
|
+
let i = Q.resolve(process.cwd(), Ae(s));
|
|
336
|
+
try {
|
|
337
|
+
let l = R.parse(ge.readFileSync(i, { encoding: e.encoding }), { fast: e.fast });
|
|
338
|
+
R.populate(n, l, o), t.push(s);
|
|
339
|
+
} catch (l) {
|
|
340
|
+
if (e.debug && console.log(`\u2506 failed to load ${s} ${l.message}`), !(e.defaultPath && l.code === "ENOENT")) throw l;
|
|
322
341
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
342
|
+
}
|
|
343
|
+
return { injected: R.populate(process.env, n, o), loadedPaths: t };
|
|
344
|
+
}
|
|
345
|
+
function K(e) {
|
|
346
|
+
let n = e[0];
|
|
347
|
+
if (n === "--help" || n === "-h") {
|
|
348
|
+
D();
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (n !== "run") {
|
|
352
|
+
D(), process.exitCode = 1;
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
let t = we(e.slice(1));
|
|
356
|
+
if (t.help) {
|
|
357
|
+
D();
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (t.error) {
|
|
361
|
+
console.error(`dotenv: ${t.error}`), D(), process.exitCode = 1;
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
if (t.command.length === 0) {
|
|
365
|
+
D(), process.exitCode = 1;
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
let o = Ee(t);
|
|
369
|
+
try {
|
|
370
|
+
let c = be(o);
|
|
371
|
+
if (!(o.quiet == null ? J().quiet : o.quiet)) {
|
|
372
|
+
let g = `\u25C7 injected env (${Object.keys(c.injected).length})`;
|
|
373
|
+
c.loadedPaths.length > 0 && (g += ` from ${c.loadedPaths.join(", ")}`), console.error(g);
|
|
374
|
+
}
|
|
375
|
+
} catch (c) {
|
|
376
|
+
console.error(`dotenv: ${c.message}`), process.exitCode = 1;
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
let r = !!process.stdin.isTTY, s = process.platform !== "win32" && !r, i = Ce(t.command[0], t.command.slice(1), { stdio: "inherit", detached: s }), l = /* @__PURE__ */ new Map(), d = 0;
|
|
380
|
+
function h(c) {
|
|
381
|
+
if (!(!i.pid || i.exitCode !== null || i.signalCode !== null)) {
|
|
382
|
+
if (process.platform === "win32") {
|
|
383
|
+
ve.spawnSync("taskkill", ["/pid", String(i.pid), "/T", "/F"], { stdio: "ignore" });
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
try {
|
|
387
|
+
process.kill(s ? -i.pid : i.pid, c);
|
|
388
|
+
} catch (a) {
|
|
389
|
+
if (a.code !== "ESRCH") throw a;
|
|
328
390
|
}
|
|
329
391
|
}
|
|
330
|
-
} else {
|
|
331
|
-
processEnv[key] = parsed[key];
|
|
332
|
-
populated[key] = parsed[key];
|
|
333
392
|
}
|
|
393
|
+
function f() {
|
|
394
|
+
for (let [c, a] of l) process.removeListener(c, a);
|
|
395
|
+
}
|
|
396
|
+
for (let c of ["SIGINT", "SIGTERM", "SIGHUP", "SIGQUIT"]) {
|
|
397
|
+
let a = () => {
|
|
398
|
+
if (c === "SIGINT") {
|
|
399
|
+
if (d++, r && process.platform !== "win32" && d === 1) return;
|
|
400
|
+
if (d > 1) {
|
|
401
|
+
h(d === 2 ? "SIGTERM" : "SIGKILL");
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
h(c);
|
|
406
|
+
};
|
|
407
|
+
l.set(c, a), process.on(c, a);
|
|
408
|
+
}
|
|
409
|
+
i.on("error", function(c) {
|
|
410
|
+
f(), console.error(`dotenv: ${c.message}`), process.exitCode = 1;
|
|
411
|
+
}), i.on("exit", function(c, a) {
|
|
412
|
+
f(), typeof c == "number" ? process.exit(c) : (setInterval(() => {
|
|
413
|
+
}, 1e3), process.kill(process.pid, a));
|
|
414
|
+
});
|
|
334
415
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
module.exports.configDotenv = DotenvModule.configDotenv;
|
|
347
|
-
module.exports._configVault = DotenvModule._configVault;
|
|
348
|
-
module.exports._parseVault = DotenvModule._parseVault;
|
|
349
|
-
module.exports.config = DotenvModule.config;
|
|
350
|
-
module.exports.decrypt = DotenvModule.decrypt;
|
|
351
|
-
module.exports.parse = DotenvModule.parse;
|
|
352
|
-
module.exports.populate = DotenvModule.populate;
|
|
353
|
-
module.exports = DotenvModule;
|
|
416
|
+
F.exports = K;
|
|
417
|
+
__require.main === F && K(process.argv.slice(2));
|
|
418
|
+
});
|
|
419
|
+
var S = N();
|
|
420
|
+
var qe = X();
|
|
421
|
+
module.exports = S;
|
|
422
|
+
module.exports.config = S.config;
|
|
423
|
+
module.exports.configDotenv = S.configDotenv;
|
|
424
|
+
module.exports.parse = S.parse;
|
|
425
|
+
module.exports.populate = S.populate;
|
|
426
|
+
__require.main === module && qe(process.argv.slice(2));
|
|
354
427
|
}
|
|
355
428
|
});
|
|
356
429
|
|
|
@@ -431,17 +504,17 @@ var require_visit = __commonJS({
|
|
|
431
504
|
visit.BREAK = BREAK;
|
|
432
505
|
visit.SKIP = SKIP;
|
|
433
506
|
visit.REMOVE = REMOVE;
|
|
434
|
-
function visit_(key, node, visitor,
|
|
435
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
507
|
+
function visit_(key, node, visitor, path14) {
|
|
508
|
+
const ctrl = callVisitor(key, node, visitor, path14);
|
|
436
509
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
437
|
-
replaceNode(key,
|
|
438
|
-
return visit_(key, ctrl, visitor,
|
|
510
|
+
replaceNode(key, path14, ctrl);
|
|
511
|
+
return visit_(key, ctrl, visitor, path14);
|
|
439
512
|
}
|
|
440
513
|
if (typeof ctrl !== "symbol") {
|
|
441
514
|
if (identity.isCollection(node)) {
|
|
442
|
-
|
|
515
|
+
path14 = Object.freeze(path14.concat(node));
|
|
443
516
|
for (let i = 0; i < node.items.length; ++i) {
|
|
444
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
517
|
+
const ci = visit_(i, node.items[i], visitor, path14);
|
|
445
518
|
if (typeof ci === "number")
|
|
446
519
|
i = ci - 1;
|
|
447
520
|
else if (ci === BREAK)
|
|
@@ -452,13 +525,13 @@ var require_visit = __commonJS({
|
|
|
452
525
|
}
|
|
453
526
|
}
|
|
454
527
|
} else if (identity.isPair(node)) {
|
|
455
|
-
|
|
456
|
-
const ck = visit_("key", node.key, visitor,
|
|
528
|
+
path14 = Object.freeze(path14.concat(node));
|
|
529
|
+
const ck = visit_("key", node.key, visitor, path14);
|
|
457
530
|
if (ck === BREAK)
|
|
458
531
|
return BREAK;
|
|
459
532
|
else if (ck === REMOVE)
|
|
460
533
|
node.key = null;
|
|
461
|
-
const cv = visit_("value", node.value, visitor,
|
|
534
|
+
const cv = visit_("value", node.value, visitor, path14);
|
|
462
535
|
if (cv === BREAK)
|
|
463
536
|
return BREAK;
|
|
464
537
|
else if (cv === REMOVE)
|
|
@@ -479,17 +552,17 @@ var require_visit = __commonJS({
|
|
|
479
552
|
visitAsync.BREAK = BREAK;
|
|
480
553
|
visitAsync.SKIP = SKIP;
|
|
481
554
|
visitAsync.REMOVE = REMOVE;
|
|
482
|
-
async function visitAsync_(key, node, visitor,
|
|
483
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
555
|
+
async function visitAsync_(key, node, visitor, path14) {
|
|
556
|
+
const ctrl = await callVisitor(key, node, visitor, path14);
|
|
484
557
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
485
|
-
replaceNode(key,
|
|
486
|
-
return visitAsync_(key, ctrl, visitor,
|
|
558
|
+
replaceNode(key, path14, ctrl);
|
|
559
|
+
return visitAsync_(key, ctrl, visitor, path14);
|
|
487
560
|
}
|
|
488
561
|
if (typeof ctrl !== "symbol") {
|
|
489
562
|
if (identity.isCollection(node)) {
|
|
490
|
-
|
|
563
|
+
path14 = Object.freeze(path14.concat(node));
|
|
491
564
|
for (let i = 0; i < node.items.length; ++i) {
|
|
492
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
565
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path14);
|
|
493
566
|
if (typeof ci === "number")
|
|
494
567
|
i = ci - 1;
|
|
495
568
|
else if (ci === BREAK)
|
|
@@ -500,13 +573,13 @@ var require_visit = __commonJS({
|
|
|
500
573
|
}
|
|
501
574
|
}
|
|
502
575
|
} else if (identity.isPair(node)) {
|
|
503
|
-
|
|
504
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
576
|
+
path14 = Object.freeze(path14.concat(node));
|
|
577
|
+
const ck = await visitAsync_("key", node.key, visitor, path14);
|
|
505
578
|
if (ck === BREAK)
|
|
506
579
|
return BREAK;
|
|
507
580
|
else if (ck === REMOVE)
|
|
508
581
|
node.key = null;
|
|
509
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
582
|
+
const cv = await visitAsync_("value", node.value, visitor, path14);
|
|
510
583
|
if (cv === BREAK)
|
|
511
584
|
return BREAK;
|
|
512
585
|
else if (cv === REMOVE)
|
|
@@ -533,23 +606,23 @@ var require_visit = __commonJS({
|
|
|
533
606
|
}
|
|
534
607
|
return visitor;
|
|
535
608
|
}
|
|
536
|
-
function callVisitor(key, node, visitor,
|
|
609
|
+
function callVisitor(key, node, visitor, path14) {
|
|
537
610
|
if (typeof visitor === "function")
|
|
538
|
-
return visitor(key, node,
|
|
611
|
+
return visitor(key, node, path14);
|
|
539
612
|
if (identity.isMap(node))
|
|
540
|
-
return visitor.Map?.(key, node,
|
|
613
|
+
return visitor.Map?.(key, node, path14);
|
|
541
614
|
if (identity.isSeq(node))
|
|
542
|
-
return visitor.Seq?.(key, node,
|
|
615
|
+
return visitor.Seq?.(key, node, path14);
|
|
543
616
|
if (identity.isPair(node))
|
|
544
|
-
return visitor.Pair?.(key, node,
|
|
617
|
+
return visitor.Pair?.(key, node, path14);
|
|
545
618
|
if (identity.isScalar(node))
|
|
546
|
-
return visitor.Scalar?.(key, node,
|
|
619
|
+
return visitor.Scalar?.(key, node, path14);
|
|
547
620
|
if (identity.isAlias(node))
|
|
548
|
-
return visitor.Alias?.(key, node,
|
|
621
|
+
return visitor.Alias?.(key, node, path14);
|
|
549
622
|
return void 0;
|
|
550
623
|
}
|
|
551
|
-
function replaceNode(key,
|
|
552
|
-
const parent =
|
|
624
|
+
function replaceNode(key, path14, node) {
|
|
625
|
+
const parent = path14[path14.length - 1];
|
|
553
626
|
if (identity.isCollection(parent)) {
|
|
554
627
|
parent.items[key] = node;
|
|
555
628
|
} else if (identity.isPair(parent)) {
|
|
@@ -1161,10 +1234,10 @@ var require_Collection = __commonJS({
|
|
|
1161
1234
|
var createNode = require_createNode();
|
|
1162
1235
|
var identity = require_identity();
|
|
1163
1236
|
var Node = require_Node();
|
|
1164
|
-
function collectionFromPath(schema,
|
|
1237
|
+
function collectionFromPath(schema, path14, value) {
|
|
1165
1238
|
let v = value;
|
|
1166
|
-
for (let i =
|
|
1167
|
-
const k =
|
|
1239
|
+
for (let i = path14.length - 1; i >= 0; --i) {
|
|
1240
|
+
const k = path14[i];
|
|
1168
1241
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
1169
1242
|
const a = [];
|
|
1170
1243
|
a[k] = v;
|
|
@@ -1183,7 +1256,7 @@ var require_Collection = __commonJS({
|
|
|
1183
1256
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
1184
1257
|
});
|
|
1185
1258
|
}
|
|
1186
|
-
var isEmptyPath = (
|
|
1259
|
+
var isEmptyPath = (path14) => path14 == null || typeof path14 === "object" && !!path14[Symbol.iterator]().next().done;
|
|
1187
1260
|
var Collection = class extends Node.NodeBase {
|
|
1188
1261
|
constructor(type, schema) {
|
|
1189
1262
|
super(type);
|
|
@@ -1213,11 +1286,11 @@ var require_Collection = __commonJS({
|
|
|
1213
1286
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
1214
1287
|
* that already exists in the map.
|
|
1215
1288
|
*/
|
|
1216
|
-
addIn(
|
|
1217
|
-
if (isEmptyPath(
|
|
1289
|
+
addIn(path14, value) {
|
|
1290
|
+
if (isEmptyPath(path14))
|
|
1218
1291
|
this.add(value);
|
|
1219
1292
|
else {
|
|
1220
|
-
const [key, ...rest] =
|
|
1293
|
+
const [key, ...rest] = path14;
|
|
1221
1294
|
const node = this.get(key, true);
|
|
1222
1295
|
if (identity.isCollection(node))
|
|
1223
1296
|
node.addIn(rest, value);
|
|
@@ -1231,8 +1304,8 @@ var require_Collection = __commonJS({
|
|
|
1231
1304
|
* Removes a value from the collection.
|
|
1232
1305
|
* @returns `true` if the item was found and removed.
|
|
1233
1306
|
*/
|
|
1234
|
-
deleteIn(
|
|
1235
|
-
const [key, ...rest] =
|
|
1307
|
+
deleteIn(path14) {
|
|
1308
|
+
const [key, ...rest] = path14;
|
|
1236
1309
|
if (rest.length === 0)
|
|
1237
1310
|
return this.delete(key);
|
|
1238
1311
|
const node = this.get(key, true);
|
|
@@ -1246,8 +1319,8 @@ var require_Collection = __commonJS({
|
|
|
1246
1319
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
1247
1320
|
* `true` (collections are always returned intact).
|
|
1248
1321
|
*/
|
|
1249
|
-
getIn(
|
|
1250
|
-
const [key, ...rest] =
|
|
1322
|
+
getIn(path14, keepScalar) {
|
|
1323
|
+
const [key, ...rest] = path14;
|
|
1251
1324
|
const node = this.get(key, true);
|
|
1252
1325
|
if (rest.length === 0)
|
|
1253
1326
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -1265,8 +1338,8 @@ var require_Collection = __commonJS({
|
|
|
1265
1338
|
/**
|
|
1266
1339
|
* Checks if the collection includes a value with the key `key`.
|
|
1267
1340
|
*/
|
|
1268
|
-
hasIn(
|
|
1269
|
-
const [key, ...rest] =
|
|
1341
|
+
hasIn(path14) {
|
|
1342
|
+
const [key, ...rest] = path14;
|
|
1270
1343
|
if (rest.length === 0)
|
|
1271
1344
|
return this.has(key);
|
|
1272
1345
|
const node = this.get(key, true);
|
|
@@ -1276,8 +1349,8 @@ var require_Collection = __commonJS({
|
|
|
1276
1349
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
1277
1350
|
* boolean to add/remove the item from the set.
|
|
1278
1351
|
*/
|
|
1279
|
-
setIn(
|
|
1280
|
-
const [key, ...rest] =
|
|
1352
|
+
setIn(path14, value) {
|
|
1353
|
+
const [key, ...rest] = path14;
|
|
1281
1354
|
if (rest.length === 0) {
|
|
1282
1355
|
this.set(key, value);
|
|
1283
1356
|
} else {
|
|
@@ -3792,9 +3865,9 @@ var require_Document = __commonJS({
|
|
|
3792
3865
|
this.contents.add(value);
|
|
3793
3866
|
}
|
|
3794
3867
|
/** Adds a value to the document. */
|
|
3795
|
-
addIn(
|
|
3868
|
+
addIn(path14, value) {
|
|
3796
3869
|
if (assertCollection(this.contents))
|
|
3797
|
-
this.contents.addIn(
|
|
3870
|
+
this.contents.addIn(path14, value);
|
|
3798
3871
|
}
|
|
3799
3872
|
/**
|
|
3800
3873
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3869,14 +3942,14 @@ var require_Document = __commonJS({
|
|
|
3869
3942
|
* Removes a value from the document.
|
|
3870
3943
|
* @returns `true` if the item was found and removed.
|
|
3871
3944
|
*/
|
|
3872
|
-
deleteIn(
|
|
3873
|
-
if (Collection.isEmptyPath(
|
|
3945
|
+
deleteIn(path14) {
|
|
3946
|
+
if (Collection.isEmptyPath(path14)) {
|
|
3874
3947
|
if (this.contents == null)
|
|
3875
3948
|
return false;
|
|
3876
3949
|
this.contents = null;
|
|
3877
3950
|
return true;
|
|
3878
3951
|
}
|
|
3879
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3952
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path14) : false;
|
|
3880
3953
|
}
|
|
3881
3954
|
/**
|
|
3882
3955
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3891,10 +3964,10 @@ var require_Document = __commonJS({
|
|
|
3891
3964
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3892
3965
|
* `true` (collections are always returned intact).
|
|
3893
3966
|
*/
|
|
3894
|
-
getIn(
|
|
3895
|
-
if (Collection.isEmptyPath(
|
|
3967
|
+
getIn(path14, keepScalar) {
|
|
3968
|
+
if (Collection.isEmptyPath(path14))
|
|
3896
3969
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3897
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
3970
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path14, keepScalar) : void 0;
|
|
3898
3971
|
}
|
|
3899
3972
|
/**
|
|
3900
3973
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3905,10 +3978,10 @@ var require_Document = __commonJS({
|
|
|
3905
3978
|
/**
|
|
3906
3979
|
* Checks if the document includes a value at `path`.
|
|
3907
3980
|
*/
|
|
3908
|
-
hasIn(
|
|
3909
|
-
if (Collection.isEmptyPath(
|
|
3981
|
+
hasIn(path14) {
|
|
3982
|
+
if (Collection.isEmptyPath(path14))
|
|
3910
3983
|
return this.contents !== void 0;
|
|
3911
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
3984
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path14) : false;
|
|
3912
3985
|
}
|
|
3913
3986
|
/**
|
|
3914
3987
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3925,13 +3998,13 @@ var require_Document = __commonJS({
|
|
|
3925
3998
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3926
3999
|
* boolean to add/remove the item from the set.
|
|
3927
4000
|
*/
|
|
3928
|
-
setIn(
|
|
3929
|
-
if (Collection.isEmptyPath(
|
|
4001
|
+
setIn(path14, value) {
|
|
4002
|
+
if (Collection.isEmptyPath(path14)) {
|
|
3930
4003
|
this.contents = value;
|
|
3931
4004
|
} else if (this.contents == null) {
|
|
3932
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
4005
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path14), value);
|
|
3933
4006
|
} else if (assertCollection(this.contents)) {
|
|
3934
|
-
this.contents.setIn(
|
|
4007
|
+
this.contents.setIn(path14, value);
|
|
3935
4008
|
}
|
|
3936
4009
|
}
|
|
3937
4010
|
/**
|
|
@@ -5892,9 +5965,9 @@ var require_cst_visit = __commonJS({
|
|
|
5892
5965
|
visit.BREAK = BREAK;
|
|
5893
5966
|
visit.SKIP = SKIP;
|
|
5894
5967
|
visit.REMOVE = REMOVE;
|
|
5895
|
-
visit.itemAtPath = (cst,
|
|
5968
|
+
visit.itemAtPath = (cst, path14) => {
|
|
5896
5969
|
let item = cst;
|
|
5897
|
-
for (const [field, index] of
|
|
5970
|
+
for (const [field, index] of path14) {
|
|
5898
5971
|
const tok = item?.[field];
|
|
5899
5972
|
if (tok && "items" in tok) {
|
|
5900
5973
|
item = tok.items[index];
|
|
@@ -5903,23 +5976,23 @@ var require_cst_visit = __commonJS({
|
|
|
5903
5976
|
}
|
|
5904
5977
|
return item;
|
|
5905
5978
|
};
|
|
5906
|
-
visit.parentCollection = (cst,
|
|
5907
|
-
const parent = visit.itemAtPath(cst,
|
|
5908
|
-
const field =
|
|
5979
|
+
visit.parentCollection = (cst, path14) => {
|
|
5980
|
+
const parent = visit.itemAtPath(cst, path14.slice(0, -1));
|
|
5981
|
+
const field = path14[path14.length - 1][0];
|
|
5909
5982
|
const coll = parent?.[field];
|
|
5910
5983
|
if (coll && "items" in coll)
|
|
5911
5984
|
return coll;
|
|
5912
5985
|
throw new Error("Parent collection not found");
|
|
5913
5986
|
};
|
|
5914
|
-
function _visit(
|
|
5915
|
-
let ctrl = visitor(item,
|
|
5987
|
+
function _visit(path14, item, visitor) {
|
|
5988
|
+
let ctrl = visitor(item, path14);
|
|
5916
5989
|
if (typeof ctrl === "symbol")
|
|
5917
5990
|
return ctrl;
|
|
5918
5991
|
for (const field of ["key", "value"]) {
|
|
5919
5992
|
const token = item[field];
|
|
5920
5993
|
if (token && "items" in token) {
|
|
5921
5994
|
for (let i = 0; i < token.items.length; ++i) {
|
|
5922
|
-
const ci = _visit(Object.freeze(
|
|
5995
|
+
const ci = _visit(Object.freeze(path14.concat([[field, i]])), token.items[i], visitor);
|
|
5923
5996
|
if (typeof ci === "number")
|
|
5924
5997
|
i = ci - 1;
|
|
5925
5998
|
else if (ci === BREAK)
|
|
@@ -5930,10 +6003,10 @@ var require_cst_visit = __commonJS({
|
|
|
5930
6003
|
}
|
|
5931
6004
|
}
|
|
5932
6005
|
if (typeof ctrl === "function" && field === "key")
|
|
5933
|
-
ctrl = ctrl(item,
|
|
6006
|
+
ctrl = ctrl(item, path14);
|
|
5934
6007
|
}
|
|
5935
6008
|
}
|
|
5936
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
6009
|
+
return typeof ctrl === "function" ? ctrl(item, path14) : ctrl;
|
|
5937
6010
|
}
|
|
5938
6011
|
exports.visit = visit;
|
|
5939
6012
|
}
|
|
@@ -7235,14 +7308,14 @@ var require_parser = __commonJS({
|
|
|
7235
7308
|
case "scalar":
|
|
7236
7309
|
case "single-quoted-scalar":
|
|
7237
7310
|
case "double-quoted-scalar": {
|
|
7238
|
-
const
|
|
7311
|
+
const fs8 = this.flowScalar(this.type);
|
|
7239
7312
|
if (atNextItem || it.value) {
|
|
7240
|
-
map.items.push({ start, key:
|
|
7313
|
+
map.items.push({ start, key: fs8, sep: [] });
|
|
7241
7314
|
this.onKeyLine = true;
|
|
7242
7315
|
} else if (it.sep) {
|
|
7243
|
-
this.stack.push(
|
|
7316
|
+
this.stack.push(fs8);
|
|
7244
7317
|
} else {
|
|
7245
|
-
Object.assign(it, { key:
|
|
7318
|
+
Object.assign(it, { key: fs8, sep: [] });
|
|
7246
7319
|
this.onKeyLine = true;
|
|
7247
7320
|
}
|
|
7248
7321
|
return;
|
|
@@ -7370,13 +7443,13 @@ var require_parser = __commonJS({
|
|
|
7370
7443
|
case "scalar":
|
|
7371
7444
|
case "single-quoted-scalar":
|
|
7372
7445
|
case "double-quoted-scalar": {
|
|
7373
|
-
const
|
|
7446
|
+
const fs8 = this.flowScalar(this.type);
|
|
7374
7447
|
if (!it || it.value)
|
|
7375
|
-
fc.items.push({ start: [], key:
|
|
7448
|
+
fc.items.push({ start: [], key: fs8, sep: [] });
|
|
7376
7449
|
else if (it.sep)
|
|
7377
|
-
this.stack.push(
|
|
7450
|
+
this.stack.push(fs8);
|
|
7378
7451
|
else
|
|
7379
|
-
Object.assign(it, { key:
|
|
7452
|
+
Object.assign(it, { key: fs8, sep: [] });
|
|
7380
7453
|
return;
|
|
7381
7454
|
}
|
|
7382
7455
|
case "flow-map-end":
|
|
@@ -7633,7 +7706,7 @@ var require_public_api = __commonJS({
|
|
|
7633
7706
|
});
|
|
7634
7707
|
|
|
7635
7708
|
// ../../node_modules/yaml/dist/index.js
|
|
7636
|
-
var
|
|
7709
|
+
var require_dist2 = __commonJS({
|
|
7637
7710
|
"../../node_modules/yaml/dist/index.js"(exports) {
|
|
7638
7711
|
"use strict";
|
|
7639
7712
|
var composer = require_composer();
|
|
@@ -7856,7 +7929,7 @@ function getAtPath(obj, dottedKey) {
|
|
|
7856
7929
|
}
|
|
7857
7930
|
|
|
7858
7931
|
// ../configuration-core/src/secrets.ts
|
|
7859
|
-
var import_dotenv = __toESM(
|
|
7932
|
+
var import_dotenv = __toESM(require_dist(), 1);
|
|
7860
7933
|
import * as fs3 from "node:fs";
|
|
7861
7934
|
import * as path4 from "node:path";
|
|
7862
7935
|
|
|
@@ -8002,7 +8075,7 @@ var CONFIG_SCHEMA = [
|
|
|
8002
8075
|
// nominal here — the project scope of a global-only key is never read.
|
|
8003
8076
|
{
|
|
8004
8077
|
key: "scripts.maxTimeoutMs",
|
|
8005
|
-
description: `Upper bound, in milliseconds, on the time limit
|
|
8078
|
+
description: `Upper bound, in milliseconds, on the time limit an e2e test \`script\` step may ask for (default 300000 \u2014 five minutes). Bounds how long one script can occupy the host. Values below ${MIN_SCRIPT_TIMEOUT_MS} ms are refused: the step starts a Node process before the script runs, so a smaller ceiling ends a script that did nothing wrong.`,
|
|
8006
8079
|
scopes: ["global"],
|
|
8007
8080
|
parse: (raw) => {
|
|
8008
8081
|
const value = asPositiveInteger(raw);
|
|
@@ -8015,7 +8088,7 @@ var CONFIG_SCHEMA = [
|
|
|
8015
8088
|
},
|
|
8016
8089
|
{
|
|
8017
8090
|
key: "scripts.heapLimitMb",
|
|
8018
|
-
description: `Old-space heap limit, in MiB, given to each
|
|
8091
|
+
description: `Old-space heap limit, in MiB, given to each e2e test \`script\` process (default 512). Values below ${MIN_SCRIPT_HEAP_LIMIT_MB} MiB are refused: that is already below what importing a real npm dependency needs, and under about 5 MiB the process dies inside V8's own startup before any script runs.`,
|
|
8019
8092
|
scopes: ["global"],
|
|
8020
8093
|
parse: (raw) => {
|
|
8021
8094
|
const value = asPositiveInteger(raw);
|
|
@@ -8100,7 +8173,7 @@ function generateToken() {
|
|
|
8100
8173
|
return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
|
|
8101
8174
|
}
|
|
8102
8175
|
function findFreePort() {
|
|
8103
|
-
return new Promise((
|
|
8176
|
+
return new Promise((resolve9, reject) => {
|
|
8104
8177
|
const srv = net.createServer();
|
|
8105
8178
|
srv.listen(0, "127.0.0.1", () => {
|
|
8106
8179
|
const addr = srv.address();
|
|
@@ -8111,7 +8184,7 @@ function findFreePort() {
|
|
|
8111
8184
|
const port = addr.port;
|
|
8112
8185
|
srv.close((err) => {
|
|
8113
8186
|
if (err) reject(err);
|
|
8114
|
-
else
|
|
8187
|
+
else resolve9(port);
|
|
8115
8188
|
});
|
|
8116
8189
|
});
|
|
8117
8190
|
srv.on("error", reject);
|
|
@@ -8209,7 +8282,7 @@ function killSpawnedChild(child, pid) {
|
|
|
8209
8282
|
}
|
|
8210
8283
|
}
|
|
8211
8284
|
function spawnToolsServer(paths, port, options = {}) {
|
|
8212
|
-
return new Promise((
|
|
8285
|
+
return new Promise((resolve9, reject) => {
|
|
8213
8286
|
let logFd;
|
|
8214
8287
|
try {
|
|
8215
8288
|
fs4.mkdirSync(STATE_DIR, { recursive: true });
|
|
@@ -8255,7 +8328,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
8255
8328
|
rl.close();
|
|
8256
8329
|
child.stdout?.resume();
|
|
8257
8330
|
child.stdout?.unref?.();
|
|
8258
|
-
settle(() =>
|
|
8331
|
+
settle(() => resolve9({ port: actualPort, pid }));
|
|
8259
8332
|
}
|
|
8260
8333
|
});
|
|
8261
8334
|
child.on("error", (err) => {
|
|
@@ -8560,10 +8633,11 @@ async function ensureToolsServer(paths) {
|
|
|
8560
8633
|
}
|
|
8561
8634
|
|
|
8562
8635
|
// ../argent-tools-client/src/tools-client.ts
|
|
8563
|
-
import * as
|
|
8636
|
+
import * as path12 from "node:path";
|
|
8564
8637
|
|
|
8565
8638
|
// ../registry/src/types.ts
|
|
8566
8639
|
var LINKED_CALL_HEADER = "x-argent-linked";
|
|
8640
|
+
var E2E_DIR_CLIENT_HEADER = "x-argent-e2e-dir";
|
|
8567
8641
|
|
|
8568
8642
|
// ../registry/src/artifacts.ts
|
|
8569
8643
|
import { stat } from "node:fs/promises";
|
|
@@ -8601,19 +8675,95 @@ function toolStepFiles(specs, args) {
|
|
|
8601
8675
|
}
|
|
8602
8676
|
return files;
|
|
8603
8677
|
}
|
|
8604
|
-
function isClientFileArgument({ spec, path:
|
|
8605
|
-
return spec.kind === "file" && spec.path === `\${${spec.target}}` &&
|
|
8678
|
+
function isClientFileArgument({ spec, path: path14 }) {
|
|
8679
|
+
return spec.kind === "file" && spec.path === `\${${spec.target}}` && path14.startsWith("/") && hasToolFileExtension(path14);
|
|
8606
8680
|
}
|
|
8607
8681
|
|
|
8608
8682
|
// ../registry/src/flow-file-refs.ts
|
|
8683
|
+
import * as fs6 from "node:fs/promises";
|
|
8684
|
+
import * as path8 from "node:path";
|
|
8685
|
+
|
|
8686
|
+
// ../registry/src/e2e-dirs.ts
|
|
8609
8687
|
import * as fs5 from "node:fs/promises";
|
|
8610
8688
|
import * as path7 from "node:path";
|
|
8689
|
+
var E2E_DIR = path7.join(".argent", "e2e");
|
|
8690
|
+
var LEGACY_E2E_DIRS = Object.freeze([path7.join(".argent", "flows")]);
|
|
8691
|
+
var E2E_DIRS = Object.freeze([E2E_DIR, ...LEGACY_E2E_DIRS]);
|
|
8692
|
+
function e2eDirFor(projectRoot) {
|
|
8693
|
+
return path7.join(projectRoot, E2E_DIR);
|
|
8694
|
+
}
|
|
8695
|
+
function e2eDirsFor(projectRoot) {
|
|
8696
|
+
return E2E_DIRS.map((dir) => path7.join(projectRoot, dir));
|
|
8697
|
+
}
|
|
8698
|
+
function e2eFileCandidates(projectRoot, name) {
|
|
8699
|
+
return e2eDirsFor(projectRoot).map((dir) => path7.join(dir, `${name}.yaml`));
|
|
8700
|
+
}
|
|
8701
|
+
async function exists(file) {
|
|
8702
|
+
return fs5.stat(file).then(
|
|
8703
|
+
() => true,
|
|
8704
|
+
() => false
|
|
8705
|
+
);
|
|
8706
|
+
}
|
|
8707
|
+
async function pickE2eFile(candidates) {
|
|
8708
|
+
for (let i = 0; i < candidates.length; i++) {
|
|
8709
|
+
if (!await exists(candidates[i])) continue;
|
|
8710
|
+
let shadowed;
|
|
8711
|
+
for (const later of candidates.slice(i + 1)) {
|
|
8712
|
+
if (await exists(later)) {
|
|
8713
|
+
shadowed = later;
|
|
8714
|
+
break;
|
|
8715
|
+
}
|
|
8716
|
+
}
|
|
8717
|
+
return {
|
|
8718
|
+
path: candidates[i],
|
|
8719
|
+
exists: true,
|
|
8720
|
+
legacy: i > 0,
|
|
8721
|
+
...shadowed === void 0 ? {} : { shadowed }
|
|
8722
|
+
};
|
|
8723
|
+
}
|
|
8724
|
+
return { path: candidates[0], exists: false, legacy: false };
|
|
8725
|
+
}
|
|
8726
|
+
function e2eShadowWarning(used, shadowed) {
|
|
8727
|
+
return `${shadowed} is not used: ${used} has the same name and is read first.`;
|
|
8728
|
+
}
|
|
8729
|
+
var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path7.basename(dir));
|
|
8730
|
+
function e2eDirProject(dir) {
|
|
8731
|
+
const trimmed = dir.length > 1 ? dir.replace(/[\\/]+$/, "") : dir;
|
|
8732
|
+
const argent = path7.dirname(trimmed);
|
|
8733
|
+
if (!E2E_DIR_NAMES.includes(path7.basename(trimmed)) || path7.basename(argent) !== ".argent") {
|
|
8734
|
+
return null;
|
|
8735
|
+
}
|
|
8736
|
+
return path7.dirname(argent);
|
|
8737
|
+
}
|
|
8738
|
+
function e2eRunFallbackDirs(anchorDir, target) {
|
|
8739
|
+
if (target.includes("/") || target.includes("\\")) return [];
|
|
8740
|
+
const project = e2eDirProject(anchorDir);
|
|
8741
|
+
if (project === null) return [];
|
|
8742
|
+
const anchor = path7.resolve(anchorDir);
|
|
8743
|
+
return e2eDirsFor(project).filter((dir) => path7.resolve(dir) !== anchor);
|
|
8744
|
+
}
|
|
8745
|
+
|
|
8746
|
+
// ../registry/src/tool-ids.ts
|
|
8747
|
+
var TOOL_ID_ALIASES = Object.freeze({
|
|
8748
|
+
"flow-start-recording": "e2e-start-recording",
|
|
8749
|
+
"flow-add-step": "e2e-add-step",
|
|
8750
|
+
"flow-add-echo": "e2e-add-echo",
|
|
8751
|
+
"flow-add-script": "e2e-add-script",
|
|
8752
|
+
"flow-finish-recording": "e2e-finish-recording",
|
|
8753
|
+
"flow-read-prerequisite": "e2e-read-prerequisite",
|
|
8754
|
+
"flow-execute": "e2e-execute"
|
|
8755
|
+
});
|
|
8756
|
+
function canonicalToolId(id) {
|
|
8757
|
+
return Object.hasOwn(TOOL_ID_ALIASES, id) ? TOOL_ID_ALIASES[id] : id;
|
|
8758
|
+
}
|
|
8759
|
+
|
|
8760
|
+
// ../registry/src/flow-file-refs.ts
|
|
8611
8761
|
async function canonicalFlowPath(p) {
|
|
8612
8762
|
try {
|
|
8613
|
-
return await
|
|
8763
|
+
return await fs6.realpath(p);
|
|
8614
8764
|
} catch {
|
|
8615
8765
|
try {
|
|
8616
|
-
return
|
|
8766
|
+
return path8.join(await fs6.realpath(path8.dirname(p)), path8.basename(p));
|
|
8617
8767
|
} catch {
|
|
8618
8768
|
return p;
|
|
8619
8769
|
}
|
|
@@ -8622,7 +8772,7 @@ async function canonicalFlowPath(p) {
|
|
|
8622
8772
|
function completeRunExtension(value) {
|
|
8623
8773
|
if (value.endsWith(".yaml")) return value;
|
|
8624
8774
|
const candidate = `${value}.yaml`;
|
|
8625
|
-
return FLOW_FILE_NAME_PATTERN.test(
|
|
8775
|
+
return FLOW_FILE_NAME_PATTERN.test(path8.posix.basename(candidate)) ? candidate : value;
|
|
8626
8776
|
}
|
|
8627
8777
|
var MAX_RUN_DEPTH = 20;
|
|
8628
8778
|
var MAX_BLOCK_NESTING = 64;
|
|
@@ -8641,16 +8791,16 @@ function collectFlowRequests(doc) {
|
|
|
8641
8791
|
for (const step of steps) {
|
|
8642
8792
|
if (!isRecord(step)) continue;
|
|
8643
8793
|
const run = step.run;
|
|
8644
|
-
if (typeof run === "string" && !run.includes("\\") && !
|
|
8794
|
+
if (typeof run === "string" && !run.includes("\\") && !path8.posix.isAbsolute(run) && !/^[A-Za-z]:/.test(run)) {
|
|
8645
8795
|
const target = completeRunExtension(run);
|
|
8646
|
-
if (FLOW_FILE_NAME_PATTERN.test(
|
|
8796
|
+
if (FLOW_FILE_NAME_PATTERN.test(path8.posix.basename(target))) runTargets.add(target);
|
|
8647
8797
|
}
|
|
8648
8798
|
const snapshot = isRecord(step.snapshot) ? step.snapshot.name : step.snapshot;
|
|
8649
8799
|
if (typeof snapshot === "string" && FLOW_NAME_PATTERN.test(snapshot)) snapshots.add(snapshot);
|
|
8650
8800
|
if (typeof step.tool === "string") {
|
|
8651
8801
|
const args = isRecord(step.args) ? step.args : {};
|
|
8652
8802
|
toolSteps.push({ tool: step.tool, args });
|
|
8653
|
-
const target = step.tool === "
|
|
8803
|
+
const target = canonicalToolId(step.tool) === "e2e-execute" ? nestedFlowTarget(args) : void 0;
|
|
8654
8804
|
if (target !== void 0) nested.push({ target, args });
|
|
8655
8805
|
}
|
|
8656
8806
|
visit(step.steps, depth + 1);
|
|
@@ -8660,14 +8810,14 @@ function collectFlowRequests(doc) {
|
|
|
8660
8810
|
return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
|
|
8661
8811
|
}
|
|
8662
8812
|
function baselineKeyFor(canonicalPath, flowName) {
|
|
8663
|
-
const stem =
|
|
8813
|
+
const stem = path8.basename(canonicalPath, ".yaml");
|
|
8664
8814
|
return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
|
|
8665
8815
|
}
|
|
8666
8816
|
function flowMemberKey(anchorDir, target) {
|
|
8667
8817
|
return `${anchorDir}\0${target}`;
|
|
8668
8818
|
}
|
|
8669
8819
|
async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
|
|
8670
|
-
const entries = await
|
|
8820
|
+
const entries = await fs6.readdir(dir).catch(() => null);
|
|
8671
8821
|
if (entries === null || entries.includes(base)) return { state: "listed" };
|
|
8672
8822
|
const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
|
|
8673
8823
|
if (actual === void 0) return { state: "absent" };
|
|
@@ -8679,19 +8829,15 @@ function nestedFlowTarget(args) {
|
|
|
8679
8829
|
if (flowPath === void 0) {
|
|
8680
8830
|
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name)) return void 0;
|
|
8681
8831
|
if (!isResolvedAbsolute(projectRoot)) return void 0;
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
projectRoot,
|
|
8685
|
-
name,
|
|
8686
|
-
path: path7.join(projectRoot, ".argent", "flows", `${name}.yaml`)
|
|
8687
|
-
};
|
|
8832
|
+
const paths = e2eFileCandidates(projectRoot, name);
|
|
8833
|
+
return { kind: "name", projectRoot, name, path: paths[0], paths };
|
|
8688
8834
|
}
|
|
8689
8835
|
if (name !== void 0 || !isResolvedAbsolute(flowPath)) return void 0;
|
|
8690
|
-
if (!FLOW_FILE_NAME_PATTERN.test(
|
|
8836
|
+
if (!FLOW_FILE_NAME_PATTERN.test(path8.basename(flowPath))) return void 0;
|
|
8691
8837
|
return { kind: "flow_path", path: flowPath };
|
|
8692
8838
|
}
|
|
8693
8839
|
function isResolvedAbsolute(value) {
|
|
8694
|
-
return typeof value === "string" &&
|
|
8840
|
+
return typeof value === "string" && path8.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
|
|
8695
8841
|
}
|
|
8696
8842
|
|
|
8697
8843
|
// ../registry/src/failure-codes.ts
|
|
@@ -8811,6 +8957,11 @@ var FAILURE_CODES = {
|
|
|
8811
8957
|
// a device that is not foldable, no hinge route, a remote simulator.
|
|
8812
8958
|
IOS_FOLD_FAILED: "IOS_FOLD_FAILED",
|
|
8813
8959
|
IOS_FOLD_UNSUPPORTED: "IOS_FOLD_UNSUPPORTED",
|
|
8960
|
+
// The hinge of a foldable Android emulator: the console refused the move or
|
|
8961
|
+
// the guest never committed the state vs. nothing to fold — a phone profile,
|
|
8962
|
+
// a physical device.
|
|
8963
|
+
ANDROID_FOLD_FAILED: "ANDROID_FOLD_FAILED",
|
|
8964
|
+
ANDROID_FOLD_UNSUPPORTED: "ANDROID_FOLD_UNSUPPORTED",
|
|
8814
8965
|
PASTE_CLIPBOARD_SET_FAILED: "PASTE_CLIPBOARD_SET_FAILED",
|
|
8815
8966
|
PASTE_CLIPBOARD_UNSUPPORTED: "PASTE_CLIPBOARD_UNSUPPORTED",
|
|
8816
8967
|
SETTINGS_PERMISSION_UNSUPPORTED: "SETTINGS_PERMISSION_UNSUPPORTED",
|
|
@@ -9016,9 +9167,9 @@ var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
|
|
|
9016
9167
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
9017
9168
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
9018
9169
|
var resolvedDuringInvocation = new AsyncLocalStorage();
|
|
9019
|
-
function valueAtPath(root,
|
|
9170
|
+
function valueAtPath(root, path14) {
|
|
9020
9171
|
let current = root;
|
|
9021
|
-
for (const key of
|
|
9172
|
+
for (const key of path14) {
|
|
9022
9173
|
if (current === null || typeof current !== "object") return void 0;
|
|
9023
9174
|
if (!Object.hasOwn(current, key)) return void 0;
|
|
9024
9175
|
current = current[key];
|
|
@@ -9076,11 +9227,11 @@ function describeParamIssues(error, params) {
|
|
|
9076
9227
|
}
|
|
9077
9228
|
|
|
9078
9229
|
// ../argent-tools-client/src/link-config.ts
|
|
9079
|
-
import * as
|
|
9230
|
+
import * as path9 from "node:path";
|
|
9080
9231
|
import { homedir as homedir4 } from "node:os";
|
|
9081
9232
|
import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
|
|
9082
|
-
var LINK_DIR =
|
|
9083
|
-
var LINK_FILE =
|
|
9233
|
+
var LINK_DIR = path9.join(homedir4(), ".argent");
|
|
9234
|
+
var LINK_FILE = path9.join(LINK_DIR, "link.json");
|
|
9084
9235
|
async function readLinkConfig() {
|
|
9085
9236
|
try {
|
|
9086
9237
|
const raw = await readFile2(LINK_FILE, "utf8");
|
|
@@ -9129,22 +9280,22 @@ import {
|
|
|
9129
9280
|
realpath as realpath2,
|
|
9130
9281
|
rename as rename2,
|
|
9131
9282
|
rm as rm2,
|
|
9132
|
-
stat as
|
|
9283
|
+
stat as stat3,
|
|
9133
9284
|
writeFile as writeFile3
|
|
9134
9285
|
} from "node:fs/promises";
|
|
9135
9286
|
import { constants, tmpdir } from "node:os";
|
|
9136
|
-
import * as
|
|
9287
|
+
import * as path10 from "node:path";
|
|
9137
9288
|
|
|
9138
9289
|
// ../archive/src/index.ts
|
|
9139
9290
|
import { execFile } from "node:child_process";
|
|
9140
9291
|
import { rm, readdir as readdir3 } from "node:fs/promises";
|
|
9141
|
-
import { basename as
|
|
9292
|
+
import { basename as basename4, dirname as dirname5, join as join9, posix as posix2, resolve as resolve6, sep as sep2 } from "node:path";
|
|
9142
9293
|
import { promisify } from "node:util";
|
|
9143
9294
|
var execFileAsync = promisify(execFile);
|
|
9144
9295
|
var ArchiveError = class extends Error {
|
|
9145
9296
|
};
|
|
9146
9297
|
function createTarGzArgs(sourcePath, target) {
|
|
9147
|
-
return ["-czf", target, "-C",
|
|
9298
|
+
return ["-czf", target, "-C", dirname5(sourcePath), basename4(sourcePath)];
|
|
9148
9299
|
}
|
|
9149
9300
|
async function createTarGzFile(sourcePath, tarPath) {
|
|
9150
9301
|
try {
|
|
@@ -9166,8 +9317,8 @@ function isSafeTarMember(memberPath, destDir) {
|
|
|
9166
9317
|
if (relative2 === ".." || relative2.startsWith("../") || relative2.split("/").includes("..")) {
|
|
9167
9318
|
return false;
|
|
9168
9319
|
}
|
|
9169
|
-
const root =
|
|
9170
|
-
const resolved =
|
|
9320
|
+
const root = resolve6(destDir);
|
|
9321
|
+
const resolved = resolve6(destDir, relative2);
|
|
9171
9322
|
return resolved === root || resolved.startsWith(root + sep2);
|
|
9172
9323
|
}
|
|
9173
9324
|
async function listTarMembers(tarPath) {
|
|
@@ -9221,7 +9372,7 @@ async function assertSafeArchive(tarPath, destDir) {
|
|
|
9221
9372
|
async function resolveMember(destDir, expectedName) {
|
|
9222
9373
|
const entries = await readdir3(destDir);
|
|
9223
9374
|
if (entries.includes(expectedName)) {
|
|
9224
|
-
return
|
|
9375
|
+
return join9(destDir, expectedName);
|
|
9225
9376
|
}
|
|
9226
9377
|
const real = entries.filter((e) => !e.startsWith("._"));
|
|
9227
9378
|
if (real.length !== 1) {
|
|
@@ -9229,7 +9380,7 @@ async function resolveMember(destDir, expectedName) {
|
|
|
9229
9380
|
`Could not identify the extracted member (expected "${expectedName}", found ${real.length} entries).`
|
|
9230
9381
|
);
|
|
9231
9382
|
}
|
|
9232
|
-
return
|
|
9383
|
+
return join9(destDir, real[0]);
|
|
9233
9384
|
}
|
|
9234
9385
|
async function safeExtractTarGz(tarPath, destDir, expectedName) {
|
|
9235
9386
|
await assertSafeArchive(tarPath, destDir);
|
|
@@ -9267,6 +9418,16 @@ function interpolatePath(template, args) {
|
|
|
9267
9418
|
});
|
|
9268
9419
|
return missing ? null : out;
|
|
9269
9420
|
}
|
|
9421
|
+
async function specPath(spec, args) {
|
|
9422
|
+
if (spec.kind !== "file" || !spec.paths?.length) return interpolatePath(spec.path, args);
|
|
9423
|
+
const candidates = [];
|
|
9424
|
+
for (const template of spec.paths) {
|
|
9425
|
+
const filled = interpolatePath(template, args);
|
|
9426
|
+
if (filled === null) return null;
|
|
9427
|
+
candidates.push(filled);
|
|
9428
|
+
}
|
|
9429
|
+
return (await pickE2eFile(candidates)).path;
|
|
9430
|
+
}
|
|
9270
9431
|
var pendingArchives = /* @__PURE__ */ new Set();
|
|
9271
9432
|
var ARCHIVE_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
9272
9433
|
function removePendingArchives() {
|
|
@@ -9302,9 +9463,9 @@ function untrackArchive(archive) {
|
|
|
9302
9463
|
process.removeListener("exit", removePendingArchives);
|
|
9303
9464
|
}
|
|
9304
9465
|
function sha256File(filePath) {
|
|
9305
|
-
return new Promise((
|
|
9466
|
+
return new Promise((resolve9, reject) => {
|
|
9306
9467
|
const hash = createHash2("sha256");
|
|
9307
|
-
createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () =>
|
|
9468
|
+
createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve9(hash.digest("hex"))).on("error", reject);
|
|
9308
9469
|
});
|
|
9309
9470
|
}
|
|
9310
9471
|
function toolServerError(text) {
|
|
@@ -9331,7 +9492,7 @@ function uploadFailure(url, res, text, bytes) {
|
|
|
9331
9492
|
});
|
|
9332
9493
|
}
|
|
9333
9494
|
async function uploadTar(tarPath, endpoint, signal) {
|
|
9334
|
-
const { size } = await
|
|
9495
|
+
const { size } = await stat3(tarPath);
|
|
9335
9496
|
const init = {
|
|
9336
9497
|
method: "POST",
|
|
9337
9498
|
headers: {
|
|
@@ -9355,7 +9516,7 @@ async function uploadTar(tarPath, endpoint, signal) {
|
|
|
9355
9516
|
return json.uploadId;
|
|
9356
9517
|
}
|
|
9357
9518
|
async function uploadFile(sourcePath, endpoint, signal) {
|
|
9358
|
-
const tarPath =
|
|
9519
|
+
const tarPath = path10.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
|
|
9359
9520
|
trackArchive(tarPath);
|
|
9360
9521
|
try {
|
|
9361
9522
|
await createTarGzFile(await realpath2(sourcePath), tarPath);
|
|
@@ -9370,7 +9531,7 @@ async function uploadFile(sourcePath, endpoint, signal) {
|
|
|
9370
9531
|
async function readFileInputWire(filePath, opts) {
|
|
9371
9532
|
let st;
|
|
9372
9533
|
try {
|
|
9373
|
-
st = await
|
|
9534
|
+
st = await stat3(filePath);
|
|
9374
9535
|
} catch {
|
|
9375
9536
|
return null;
|
|
9376
9537
|
}
|
|
@@ -9398,7 +9559,7 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
9398
9559
|
for (const spec of specs) {
|
|
9399
9560
|
if (spec.skipWhenSet && record[spec.skipWhenSet] !== void 0) continue;
|
|
9400
9561
|
if (spec.target in record && typeof record[spec.target] !== "string") continue;
|
|
9401
|
-
const filePath =
|
|
9562
|
+
const filePath = await specPath(spec, record);
|
|
9402
9563
|
if (filePath === null) continue;
|
|
9403
9564
|
if (spec.target in record && record[spec.target] !== filePath) continue;
|
|
9404
9565
|
const wire = { [FILE_INPUT_MARKER2]: true, path: filePath };
|
|
@@ -9416,13 +9577,13 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
9416
9577
|
wire.members = await opts.collectStepMembers(record, opts);
|
|
9417
9578
|
}
|
|
9418
9579
|
if (spec.kind === "tar-upload") {
|
|
9419
|
-
const st = await
|
|
9580
|
+
const st = await stat3(filePath).catch(() => null);
|
|
9420
9581
|
if (st) {
|
|
9421
9582
|
wire.size = st.size;
|
|
9422
9583
|
wire.mtimeMs = st.mtimeMs;
|
|
9423
9584
|
}
|
|
9424
9585
|
if (opts.uploadEndpoint && st) {
|
|
9425
|
-
process.stderr.write(`Uploading ${
|
|
9586
|
+
process.stderr.write(`Uploading ${path10.basename(filePath)} to the remote tool-server...
|
|
9426
9587
|
`);
|
|
9427
9588
|
Object.assign(wire, await uploadFile(filePath, opts.uploadEndpoint, opts.signal));
|
|
9428
9589
|
}
|
|
@@ -9433,18 +9594,18 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
9433
9594
|
return out ?? args;
|
|
9434
9595
|
}
|
|
9435
9596
|
function isAllowedClientFilePath(p) {
|
|
9436
|
-
if (!
|
|
9597
|
+
if (!path10.isAbsolute(p)) return false;
|
|
9437
9598
|
const segments = p.split(/[\\/]+/);
|
|
9438
9599
|
if (segments.includes("..")) return false;
|
|
9439
9600
|
const file = segments[segments.length - 1] ?? "";
|
|
9440
9601
|
if (!FLOW_FILE_NAME_PATTERN.test(file)) return false;
|
|
9441
|
-
return segments
|
|
9602
|
+
return e2eDirProject(segments.slice(0, -1).join("/")) !== null;
|
|
9442
9603
|
}
|
|
9443
9604
|
function isClientFileDirective2(value) {
|
|
9444
9605
|
return !!value && typeof value === "object" && value[CLIENT_FILE_MARKER2] === true && typeof value.path === "string" && typeof value.content === "string";
|
|
9445
9606
|
}
|
|
9446
9607
|
async function replaceFile(target, bytes, mode) {
|
|
9447
|
-
const temp =
|
|
9608
|
+
const temp = path10.join(path10.dirname(target), `.baseline-${randomUUID4()}.tmp`);
|
|
9448
9609
|
try {
|
|
9449
9610
|
await writeFile3(temp, bytes, { flag: "wx" });
|
|
9450
9611
|
if (mode !== void 0) await chmod3(temp, mode & 511);
|
|
@@ -9455,27 +9616,27 @@ async function replaceFile(target, bytes, mode) {
|
|
|
9455
9616
|
}
|
|
9456
9617
|
}
|
|
9457
9618
|
async function writeBaselineFile(file, bytes, allowedDirs) {
|
|
9458
|
-
if (!
|
|
9619
|
+
if (!path10.isAbsolute(file) || path10.normalize(file) !== file || file.split(/[\\/]/).includes("..") || !file.endsWith(".png") || !allowedDirs.includes(path10.dirname(file))) {
|
|
9459
9620
|
return allowedDirs.length === 0 ? "this call writes no baselines" : `${file} is not a baseline of this call (${allowedDirs.map((d) => `${d}/<name>.png`).join(", ")})`;
|
|
9460
9621
|
}
|
|
9461
9622
|
if (bytes.length > MAX_CONTENT_BYTES) {
|
|
9462
9623
|
return `${file}: the baseline is larger than the 32 MiB cap on a file this client writes`;
|
|
9463
9624
|
}
|
|
9464
|
-
const dir =
|
|
9625
|
+
const dir = path10.dirname(file);
|
|
9465
9626
|
await mkdir3(dir, { recursive: true });
|
|
9466
9627
|
const link = await lstat(file).catch(() => null);
|
|
9467
9628
|
const real = link === null ? null : await realpath2(file).catch(() => null);
|
|
9468
9629
|
if (link !== null && real === null) return `${file} is a symbolic link to a missing file`;
|
|
9469
9630
|
if (real !== null) {
|
|
9470
9631
|
if (!real.endsWith(".png")) return `${file} links to a file that is not a PNG file`;
|
|
9471
|
-
if (
|
|
9632
|
+
if (path10.dirname(real) !== await realpath2(dir)) {
|
|
9472
9633
|
return `${file} links outside its baseline directory`;
|
|
9473
9634
|
}
|
|
9474
9635
|
}
|
|
9475
|
-
const existing = real === null ? null : await
|
|
9636
|
+
const existing = real === null ? null : await stat3(real);
|
|
9476
9637
|
if (existing !== null && !existing.isFile()) return `${file} is not a regular file`;
|
|
9477
9638
|
await replaceFile(
|
|
9478
|
-
real ??
|
|
9639
|
+
real ?? path10.join(await realpath2(dir), path10.basename(file)),
|
|
9479
9640
|
bytes,
|
|
9480
9641
|
existing?.mode
|
|
9481
9642
|
);
|
|
@@ -9501,7 +9662,7 @@ async function applyClientFileDirectives(result, opts = {}) {
|
|
|
9501
9662
|
if (isClientFileDirective2(value)) {
|
|
9502
9663
|
if (!isAllowedClientFilePath(value.path)) return null;
|
|
9503
9664
|
try {
|
|
9504
|
-
await mkdir3(
|
|
9665
|
+
await mkdir3(path10.dirname(value.path), { recursive: true });
|
|
9505
9666
|
await writeFile3(value.path, value.content, "utf8");
|
|
9506
9667
|
written.push(value.path);
|
|
9507
9668
|
return value.path;
|
|
@@ -9528,13 +9689,15 @@ async function applyClientFileDirectives(result, opts = {}) {
|
|
|
9528
9689
|
}
|
|
9529
9690
|
|
|
9530
9691
|
// ../argent-tools-client/src/flow-files.ts
|
|
9531
|
-
var import_yaml = __toESM(
|
|
9532
|
-
import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as
|
|
9533
|
-
import * as
|
|
9692
|
+
var import_yaml = __toESM(require_dist2(), 1);
|
|
9693
|
+
import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
|
|
9694
|
+
import * as path11 from "node:path";
|
|
9534
9695
|
var INLINE_MEMBERS_BYTES = 256 * 1024;
|
|
9535
|
-
|
|
9696
|
+
function filesLogEnabled() {
|
|
9697
|
+
return (process.env.ARGENT_E2E_FILES_LOG ?? process.env.ARGENT_FLOW_FILES_LOG) === "1";
|
|
9698
|
+
}
|
|
9536
9699
|
function isWithin(inner, outer) {
|
|
9537
|
-
return inner === outer || inner.startsWith(outer.endsWith(
|
|
9700
|
+
return inner === outer || inner.startsWith(outer.endsWith(path11.sep) ? outer : outer + path11.sep);
|
|
9538
9701
|
}
|
|
9539
9702
|
function printable(text) {
|
|
9540
9703
|
return [...text].map(
|
|
@@ -9542,23 +9705,21 @@ function printable(text) {
|
|
|
9542
9705
|
).join("");
|
|
9543
9706
|
}
|
|
9544
9707
|
function isResolvedAbsolute2(value) {
|
|
9545
|
-
return typeof value === "string" &&
|
|
9708
|
+
return typeof value === "string" && path11.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
|
|
9546
9709
|
}
|
|
9547
9710
|
function namesValidFlow(args) {
|
|
9548
9711
|
const { project_root, flow_path, name } = args;
|
|
9549
9712
|
if (!isResolvedAbsolute2(project_root)) return false;
|
|
9550
9713
|
if (name === void 0) {
|
|
9551
|
-
return isResolvedAbsolute2(flow_path) && FLOW_FILE_NAME_PATTERN.test(
|
|
9714
|
+
return isResolvedAbsolute2(flow_path) && FLOW_FILE_NAME_PATTERN.test(path11.basename(flow_path));
|
|
9552
9715
|
}
|
|
9553
9716
|
return flow_path === void 0 && typeof name === "string" && FLOW_NAME_PATTERN.test(name);
|
|
9554
9717
|
}
|
|
9555
9718
|
function savedFlowProject(file) {
|
|
9556
|
-
if (!
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
if (
|
|
9560
|
-
return parts.slice(0, i).join(path10.sep) || path10.sep;
|
|
9561
|
-
}
|
|
9719
|
+
if (!path11.isAbsolute(file)) return null;
|
|
9720
|
+
for (let dir = path11.dirname(file); dir !== path11.dirname(dir); dir = path11.dirname(dir)) {
|
|
9721
|
+
const project = e2eDirProject(dir);
|
|
9722
|
+
if (project !== null) return project;
|
|
9562
9723
|
}
|
|
9563
9724
|
return null;
|
|
9564
9725
|
}
|
|
@@ -9571,11 +9732,11 @@ async function landing(spelled) {
|
|
|
9571
9732
|
const canonical = await canonicalFlowPath(spelled);
|
|
9572
9733
|
let at = spelled;
|
|
9573
9734
|
for (; ; ) {
|
|
9574
|
-
const parent =
|
|
9735
|
+
const parent = path11.dirname(at);
|
|
9575
9736
|
if (parent === at) return { canonical, fence: spelled, ...failure };
|
|
9576
9737
|
const real = await realpath3(parent).catch(() => null);
|
|
9577
9738
|
if (real !== null) {
|
|
9578
|
-
return { canonical, fence:
|
|
9739
|
+
return { canonical, fence: path11.join(real, path11.basename(at)), ...failure };
|
|
9579
9740
|
}
|
|
9580
9741
|
at = parent;
|
|
9581
9742
|
}
|
|
@@ -9583,10 +9744,10 @@ async function landing(spelled) {
|
|
|
9583
9744
|
}
|
|
9584
9745
|
async function closureRoots(rootPath, rootCanonical, projectRoot) {
|
|
9585
9746
|
const candidates = [];
|
|
9586
|
-
if (typeof projectRoot === "string" &&
|
|
9587
|
-
candidates.push(projectRoot,
|
|
9747
|
+
if (typeof projectRoot === "string" && path11.isAbsolute(projectRoot)) {
|
|
9748
|
+
candidates.push(projectRoot, ...e2eDirsFor(projectRoot));
|
|
9588
9749
|
}
|
|
9589
|
-
candidates.push(
|
|
9750
|
+
candidates.push(path11.dirname(rootPath), path11.dirname(rootCanonical));
|
|
9590
9751
|
for (const file of [rootPath, rootCanonical]) {
|
|
9591
9752
|
const project = savedFlowProject(file);
|
|
9592
9753
|
if (project !== null) candidates.push(project);
|
|
@@ -9599,11 +9760,11 @@ async function closureRoots(rootPath, rootCanonical, projectRoot) {
|
|
|
9599
9760
|
return real.filter((root) => !real.some((other) => other !== root && isWithin(root, other)));
|
|
9600
9761
|
}
|
|
9601
9762
|
async function readFlowMember(anchorDir, target, roots, budget, opts) {
|
|
9602
|
-
const spelled = anchorDir +
|
|
9763
|
+
const spelled = anchorDir + path11.sep + target;
|
|
9603
9764
|
const { canonical, fence, missing, error } = await landing(spelled);
|
|
9604
9765
|
const spelling = await classifyOnDiskSpelling(
|
|
9605
|
-
|
|
9606
|
-
|
|
9766
|
+
path11.dirname(spelled),
|
|
9767
|
+
path11.posix.basename(target),
|
|
9607
9768
|
FLOW_FILE_NAME_PATTERN
|
|
9608
9769
|
);
|
|
9609
9770
|
const member = {
|
|
@@ -9622,13 +9783,13 @@ async function readFlowMember(anchorDir, target, roots, budget, opts) {
|
|
|
9622
9783
|
}
|
|
9623
9784
|
if (error !== void 0) return refuse(error);
|
|
9624
9785
|
if (missing) return { member: { ...member, state: "missing" }, sent: "missing" };
|
|
9625
|
-
const st = await
|
|
9786
|
+
const st = await stat4(canonical).catch((err) => err);
|
|
9626
9787
|
if (st instanceof Error) {
|
|
9627
9788
|
if (st.code !== "ENOENT") return refuse(st.message);
|
|
9628
9789
|
return { member: { ...member, state: "missing" }, sent: "missing" };
|
|
9629
9790
|
}
|
|
9630
9791
|
if (st.isDirectory()) return refuse("EISDIR: illegal operation on a directory, read");
|
|
9631
|
-
if (!/\.ya?ml$/i.test(
|
|
9792
|
+
if (!/\.ya?ml$/i.test(path11.basename(canonical))) {
|
|
9632
9793
|
return refuse(`${target} links to a file that is not a YAML file`);
|
|
9633
9794
|
}
|
|
9634
9795
|
const sent = await sendBytes(member, canonical, budget, opts);
|
|
@@ -9647,7 +9808,7 @@ async function readToolMember(file, roots, budget, opts) {
|
|
|
9647
9808
|
if (!hasToolFileExtension(canonical)) {
|
|
9648
9809
|
return refuse(`${file} links to a file that is not one of ${TOOL_FILE_EXTENSIONS.join(", ")}`);
|
|
9649
9810
|
}
|
|
9650
|
-
const st = await
|
|
9811
|
+
const st = await stat4(canonical).catch((err) => err);
|
|
9651
9812
|
if (st instanceof Error) {
|
|
9652
9813
|
if (st.code === "ENOENT" || st.code === "ENOTDIR") {
|
|
9653
9814
|
return { member: { ...member, state: "missing" }, sent: "missing" };
|
|
@@ -9671,7 +9832,7 @@ async function baselineEntry(file, roots, forWrite) {
|
|
|
9671
9832
|
};
|
|
9672
9833
|
}
|
|
9673
9834
|
if (error !== void 0) return { state: "refused", error };
|
|
9674
|
-
const st = await
|
|
9835
|
+
const st = await stat4(canonical).catch((err) => err);
|
|
9675
9836
|
if (st instanceof Error) {
|
|
9676
9837
|
if (st.code !== "ENOENT") return { state: "refused", error: st.message };
|
|
9677
9838
|
return forWrite ? { state: "refused", error: `${file} is a symbolic link to a missing file` } : { state: "missing" };
|
|
@@ -9721,7 +9882,7 @@ function memberCollector(roots, opts) {
|
|
|
9721
9882
|
const runs = /* @__PURE__ */ new Set();
|
|
9722
9883
|
const baselineDirs = /* @__PURE__ */ new Map();
|
|
9723
9884
|
const budget = { inline: 0 };
|
|
9724
|
-
const logging =
|
|
9885
|
+
const logging = filesLogEnabled();
|
|
9725
9886
|
const log = opts.log ?? ((line) => void process.stderr.write(`${line}
|
|
9726
9887
|
`));
|
|
9727
9888
|
const emit = (member, sent) => {
|
|
@@ -9729,18 +9890,19 @@ function memberCollector(roots, opts) {
|
|
|
9729
9890
|
const subject = member.role === "flow" ? member.canonical : member.key;
|
|
9730
9891
|
if (logging) log(printable(`[flow-files] ${member.role} ${subject}: ${sent}`));
|
|
9731
9892
|
};
|
|
9732
|
-
async function flow(anchorDir, target) {
|
|
9893
|
+
async function flow(anchorDir, target, onlyPresent) {
|
|
9733
9894
|
const key = flowMemberKey(anchorDir, target);
|
|
9734
9895
|
const known = flows.get(key);
|
|
9735
|
-
if (known !== void 0) return known;
|
|
9896
|
+
if (known !== void 0) return onlyPresent && known.text === void 0 ? void 0 : known;
|
|
9736
9897
|
const { member, text, sent } = await readFlowMember(anchorDir, target, roots, budget, opts);
|
|
9898
|
+
if (onlyPresent && text === void 0) return void 0;
|
|
9737
9899
|
const entry = { member, ...text === void 0 ? {} : { text } };
|
|
9738
9900
|
flows.set(key, entry);
|
|
9739
9901
|
emit(member, sent);
|
|
9740
9902
|
return entry;
|
|
9741
9903
|
}
|
|
9742
9904
|
async function toolFiles(step) {
|
|
9743
|
-
if (step.tool === "
|
|
9905
|
+
if (canonicalToolId(step.tool) === "e2e-execute") return;
|
|
9744
9906
|
for (const file of toolStepFiles(opts.toolFileInputs?.(step.tool), step.args)) {
|
|
9745
9907
|
const { unwrapWhenSet } = file.spec;
|
|
9746
9908
|
if (unwrapWhenSet !== void 0 && step.args[unwrapWhenSet] !== void 0) continue;
|
|
@@ -9750,11 +9912,31 @@ function memberCollector(roots, opts) {
|
|
|
9750
9912
|
emit(read.member, read.sent);
|
|
9751
9913
|
}
|
|
9752
9914
|
}
|
|
9915
|
+
async function savedTest(target) {
|
|
9916
|
+
for (const candidate of target.paths) {
|
|
9917
|
+
const found = await flow(path11.dirname(candidate), path11.basename(candidate), true);
|
|
9918
|
+
if (found !== void 0) return found;
|
|
9919
|
+
}
|
|
9920
|
+
let first;
|
|
9921
|
+
for (const candidate of target.paths) {
|
|
9922
|
+
first ??= await flow(path11.dirname(candidate), path11.basename(candidate));
|
|
9923
|
+
}
|
|
9924
|
+
return first;
|
|
9925
|
+
}
|
|
9753
9926
|
async function nestedRun(target, hop, updates, platform) {
|
|
9754
|
-
const { member, text } = await
|
|
9927
|
+
const { member, text } = await savedTest(target);
|
|
9755
9928
|
if (text === void 0 || hop >= MAX_RUN_DEPTH) return void 0;
|
|
9756
9929
|
return { canonical: member.canonical, text, flowName: target.name, hop, updates, platform };
|
|
9757
9930
|
}
|
|
9931
|
+
async function runTarget(anchorDir, target) {
|
|
9932
|
+
const found = await flow(anchorDir, target);
|
|
9933
|
+
if (found.member.spelling?.state !== "absent") return found;
|
|
9934
|
+
for (const dir of e2eRunFallbackDirs(anchorDir, target)) {
|
|
9935
|
+
const other = await flow(dir, target, true);
|
|
9936
|
+
if (other !== void 0) return other;
|
|
9937
|
+
}
|
|
9938
|
+
return found;
|
|
9939
|
+
}
|
|
9758
9940
|
async function walk(start) {
|
|
9759
9941
|
const queue = [...start];
|
|
9760
9942
|
for (let run = queue.shift(); run !== void 0; run = queue.shift()) {
|
|
@@ -9774,12 +9956,12 @@ function memberCollector(roots, opts) {
|
|
|
9774
9956
|
const requests = collectFlowRequests(doc);
|
|
9775
9957
|
for (const name of requests.snapshots) snapshots.add(name);
|
|
9776
9958
|
for (const step of requests.toolSteps) await toolFiles(step);
|
|
9777
|
-
const anchorDir =
|
|
9959
|
+
const anchorDir = path11.dirname(file.canonical);
|
|
9778
9960
|
for (const target of requests.runTargets) {
|
|
9779
9961
|
const key = flowMemberKey(anchorDir, target);
|
|
9780
9962
|
if (visited.has(key)) continue;
|
|
9781
9963
|
visited.add(key);
|
|
9782
|
-
const { member, text } = await
|
|
9964
|
+
const { member, text } = await runTarget(anchorDir, target);
|
|
9783
9965
|
if (text !== void 0 && file.hop + 1 < MAX_RUN_DEPTH) {
|
|
9784
9966
|
files.push({ canonical: member.canonical, text, hop: file.hop + 1 });
|
|
9785
9967
|
}
|
|
@@ -9796,8 +9978,8 @@ function memberCollector(roots, opts) {
|
|
|
9796
9978
|
}
|
|
9797
9979
|
}
|
|
9798
9980
|
if (snapshots.size === 0) continue;
|
|
9799
|
-
const dir =
|
|
9800
|
-
|
|
9981
|
+
const dir = path11.join(
|
|
9982
|
+
path11.dirname(run.canonical),
|
|
9801
9983
|
"__baselines__",
|
|
9802
9984
|
baselineKeyFor(run.canonical, run.flowName)
|
|
9803
9985
|
);
|
|
@@ -9821,7 +10003,7 @@ function memberCollector(roots, opts) {
|
|
|
9821
10003
|
if (!name.endsWith(".png")) continue;
|
|
9822
10004
|
const compared = [...prefixes].some((prefix) => name.startsWith(prefix));
|
|
9823
10005
|
if (!updates && !compared) continue;
|
|
9824
|
-
const file =
|
|
10006
|
+
const file = path11.join(dir, name);
|
|
9825
10007
|
if (tools.has(file)) continue;
|
|
9826
10008
|
const member = { role: "baseline", key: file, path: file };
|
|
9827
10009
|
const entry = await baselineEntry(file, roots, updates && !compared);
|
|
@@ -9844,8 +10026,8 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
|
|
|
9844
10026
|
if (!namesValidFlow(args)) return {};
|
|
9845
10027
|
const canonical = await canonicalFlowPath(rootPath);
|
|
9846
10028
|
const spelling = await classifyOnDiskSpelling(
|
|
9847
|
-
|
|
9848
|
-
|
|
10029
|
+
path11.dirname(rootPath),
|
|
10030
|
+
path11.basename(rootPath),
|
|
9849
10031
|
FLOW_FILE_NAME_PATTERN
|
|
9850
10032
|
);
|
|
9851
10033
|
const collector = memberCollector(
|
|
@@ -9856,7 +10038,7 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
|
|
|
9856
10038
|
{
|
|
9857
10039
|
canonical,
|
|
9858
10040
|
text: rootBytes.toString("utf8"),
|
|
9859
|
-
flowName:
|
|
10041
|
+
flowName: path11.basename(rootPath, ".yaml"),
|
|
9860
10042
|
hop: 0,
|
|
9861
10043
|
updates: args.updateBaselines === true,
|
|
9862
10044
|
platform: callPlatform(args)
|
|
@@ -9879,33 +10061,37 @@ function recordedStep(args) {
|
|
|
9879
10061
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
|
|
9880
10062
|
return { tool: command, args: parsed };
|
|
9881
10063
|
}
|
|
9882
|
-
async function collectStepMembers(args, opts) {
|
|
10064
|
+
async function collectStepMembers(args, opts, recordingDirFor = e2eDirFor) {
|
|
9883
10065
|
const { name, project_root: projectRoot } = args;
|
|
9884
10066
|
const step = recordedStep(args);
|
|
9885
|
-
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || typeof projectRoot !== "string" || !
|
|
10067
|
+
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || typeof projectRoot !== "string" || !path11.isAbsolute(projectRoot) || step === void 0) {
|
|
9886
10068
|
return [];
|
|
9887
10069
|
}
|
|
9888
|
-
const recording =
|
|
10070
|
+
const recording = path11.join(recordingDirFor(projectRoot), `${name}.yaml`);
|
|
9889
10071
|
const collector = memberCollector(
|
|
9890
10072
|
await closureRoots(recording, (await landing(recording)).canonical, projectRoot),
|
|
9891
10073
|
opts
|
|
9892
10074
|
);
|
|
9893
10075
|
await collector.toolFiles(step);
|
|
9894
|
-
if (step.tool === "
|
|
9895
|
-
const self = await collector.flow(
|
|
10076
|
+
if (canonicalToolId(step.tool) === "e2e-execute") {
|
|
10077
|
+
const self = await collector.flow(path11.dirname(recording), path11.basename(recording));
|
|
9896
10078
|
let runArgs = step.args;
|
|
9897
10079
|
const named = nestedFlowTarget(runArgs);
|
|
9898
10080
|
if (named?.kind === "flow_path") {
|
|
9899
|
-
const stem =
|
|
9900
|
-
|
|
9901
|
-
|
|
10081
|
+
const stem = path11.basename(named.path, ".yaml");
|
|
10082
|
+
const base = path11.basename(named.path);
|
|
10083
|
+
const dir = path11.resolve(path11.dirname(named.path));
|
|
10084
|
+
const recordingDir = path11.dirname(recording);
|
|
10085
|
+
const dirs = [recordingDir, ...e2eRunFallbackDirs(recordingDir, base)];
|
|
10086
|
+
if (dirs.some((d) => path11.resolve(d) === dir)) {
|
|
10087
|
+
await collector.flow(path11.dirname(named.path), base);
|
|
9902
10088
|
runArgs = { ...runArgs, name: stem };
|
|
9903
10089
|
delete runArgs.flow_path;
|
|
9904
10090
|
}
|
|
9905
10091
|
}
|
|
9906
10092
|
const target = nestedFlowTarget(runArgs);
|
|
9907
10093
|
if (target?.kind === "name") {
|
|
9908
|
-
await collector.flow(
|
|
10094
|
+
await collector.flow(path11.dirname(self.member.canonical), `${target.name}.yaml`);
|
|
9909
10095
|
const run = await collector.nestedRun(
|
|
9910
10096
|
target,
|
|
9911
10097
|
0,
|
|
@@ -9918,6 +10104,43 @@ async function collectStepMembers(args, opts) {
|
|
|
9918
10104
|
await collector.sendBaselines();
|
|
9919
10105
|
return collector.members;
|
|
9920
10106
|
}
|
|
10107
|
+
async function nameToE2ePathForOlderServer(tool, fileInputs, args) {
|
|
10108
|
+
const id = canonicalToolId(tool);
|
|
10109
|
+
if (id !== "e2e-execute" && id !== "e2e-read-prerequisite") return args;
|
|
10110
|
+
const spec = fileInputs?.find((s) => s.target === "flow_file");
|
|
10111
|
+
if (spec === void 0 || spec.kind !== "file" || spec.paths?.length) return args;
|
|
10112
|
+
const target = nestedFlowTarget(args);
|
|
10113
|
+
if (target?.kind !== "name") return args;
|
|
10114
|
+
const picked = await pickE2eFile(target.paths);
|
|
10115
|
+
if (!picked.exists || picked.legacy) return args;
|
|
10116
|
+
const { name: _name, ...rest } = args;
|
|
10117
|
+
return { ...rest, flow_path: picked.path };
|
|
10118
|
+
}
|
|
10119
|
+
async function stepForOlderServer(args, listedId) {
|
|
10120
|
+
if (typeof args !== "object" || args === null || Array.isArray(args)) return args;
|
|
10121
|
+
const record = args;
|
|
10122
|
+
if (typeof record.command !== "string") return args;
|
|
10123
|
+
const command = listedId(record.command) ?? record.command;
|
|
10124
|
+
const step = recordedStep({ ...record, command });
|
|
10125
|
+
const target = step && canonicalToolId(step.tool) === "e2e-execute" && nestedFlowTarget(step.args);
|
|
10126
|
+
if (target && target.kind === "name") {
|
|
10127
|
+
const picked = await pickE2eFile(target.paths);
|
|
10128
|
+
if (picked.exists && !picked.legacy) {
|
|
10129
|
+
throw new Error(
|
|
10130
|
+
`Cannot record a nested ${record.command} of "${target.name}": the tool-server runs an older argent that records and runs nested e2e tests only from .argent/flows/, and "${target.name}" is ${picked.path}. Upgrade the tool-server to record it, or run it with e2e-execute outside the recording.`
|
|
10131
|
+
);
|
|
10132
|
+
}
|
|
10133
|
+
}
|
|
10134
|
+
return command === record.command ? args : { ...record, command };
|
|
10135
|
+
}
|
|
10136
|
+
async function e2eShadowWarningFor(tool, args) {
|
|
10137
|
+
const id = canonicalToolId(tool);
|
|
10138
|
+
if (id !== "e2e-execute" && id !== "e2e-read-prerequisite") return void 0;
|
|
10139
|
+
const target = nestedFlowTarget(args);
|
|
10140
|
+
if (target?.kind !== "name") return void 0;
|
|
10141
|
+
const picked = await pickE2eFile(target.paths);
|
|
10142
|
+
return picked.shadowed === void 0 ? void 0 : e2eShadowWarning(picked.path, picked.shadowed);
|
|
10143
|
+
}
|
|
9921
10144
|
|
|
9922
10145
|
// ../argent-tools-client/src/tools-client.ts
|
|
9923
10146
|
function authHeaders2(token) {
|
|
@@ -9995,6 +10218,10 @@ function errorBodyMessage(body) {
|
|
|
9995
10218
|
if (Array.isArray(body.issues) && typeof body.message === "string") return body.message;
|
|
9996
10219
|
return body.error ?? body.message;
|
|
9997
10220
|
}
|
|
10221
|
+
function findTool(tools, name) {
|
|
10222
|
+
const id = canonicalToolId(name);
|
|
10223
|
+
return tools.find((t) => t.name === name) ?? tools.find((t) => canonicalToolId(t.name) === id) ?? null;
|
|
10224
|
+
}
|
|
9998
10225
|
function assertRequiredPresent(meta, args) {
|
|
9999
10226
|
const record = typeof args === "object" && args !== null ? args : {};
|
|
10000
10227
|
const schema = meta.inputSchema;
|
|
@@ -10070,26 +10297,33 @@ function createToolsClient(options = {}) {
|
|
|
10070
10297
|
return json.tools;
|
|
10071
10298
|
}
|
|
10072
10299
|
async function fetchTool(name, opts) {
|
|
10073
|
-
|
|
10074
|
-
return tools.find((t) => t.name === name) ?? null;
|
|
10300
|
+
return findTool(await fetchTools(opts), name);
|
|
10075
10301
|
}
|
|
10076
10302
|
async function callTool(name, args, opts) {
|
|
10077
10303
|
opts?.signal?.throwIfAborted();
|
|
10078
10304
|
const { url, token, remote } = await route();
|
|
10079
10305
|
let finalArgs = args;
|
|
10080
10306
|
const tools = await fetchTools({ signal: opts?.signal });
|
|
10081
|
-
const meta = tools
|
|
10307
|
+
const meta = findTool(tools, name);
|
|
10308
|
+
const olderServer = meta !== null && !tools.some((t) => t.name === canonicalToolId(meta.name));
|
|
10309
|
+
if (meta) {
|
|
10310
|
+
finalArgs = await nameToE2ePathForOlderServer(meta.name, meta.fileInputs, args);
|
|
10311
|
+
}
|
|
10312
|
+
if (olderServer && canonicalToolId(meta.name) === "e2e-add-step") {
|
|
10313
|
+
finalArgs = await stepForOlderServer(finalArgs, (tool) => findTool(tools, tool)?.name);
|
|
10314
|
+
}
|
|
10315
|
+
const shadowWarning = await e2eShadowWarningFor(name, args);
|
|
10082
10316
|
const baselineDirs = [];
|
|
10083
10317
|
if (meta?.fileInputs?.length) {
|
|
10084
|
-
if (remote) assertRequiredPresent(meta,
|
|
10085
|
-
finalArgs = await prepareFileInputs(meta.fileInputs,
|
|
10318
|
+
if (remote) assertRequiredPresent(meta, finalArgs);
|
|
10319
|
+
finalArgs = await prepareFileInputs(meta.fileInputs, finalArgs ?? {}, {
|
|
10086
10320
|
includeContent: remote,
|
|
10087
10321
|
uploadEndpoint: remote ? { url, token } : void 0,
|
|
10088
10322
|
log: diagnose,
|
|
10089
10323
|
baselineDirs,
|
|
10090
10324
|
collectMembers: collectFlowMembers,
|
|
10091
|
-
collectStepMembers,
|
|
10092
|
-
toolFileInputs: (tool) => tools
|
|
10325
|
+
collectStepMembers: olderServer ? (record, o) => collectStepMembers(record, o, (root) => path12.join(root, LEGACY_E2E_DIRS[0])) : collectStepMembers,
|
|
10326
|
+
toolFileInputs: (tool) => findTool(tools, tool)?.fileInputs,
|
|
10093
10327
|
signal: opts?.signal
|
|
10094
10328
|
});
|
|
10095
10329
|
}
|
|
@@ -10098,19 +10332,23 @@ function createToolsClient(options = {}) {
|
|
|
10098
10332
|
for (const { path: file, error } of applied.failed) {
|
|
10099
10333
|
diagnose(`The baseline ${file} was not written on this client: ${error}`);
|
|
10100
10334
|
}
|
|
10101
|
-
if (
|
|
10335
|
+
if (filesLogEnabled()) {
|
|
10102
10336
|
for (const file of applied.written) {
|
|
10103
|
-
if (baselineDirs.includes(
|
|
10337
|
+
if (baselineDirs.includes(path12.dirname(file))) {
|
|
10104
10338
|
diagnose(`[flow-files] baseline ${file}: written`);
|
|
10105
10339
|
}
|
|
10106
10340
|
}
|
|
10107
10341
|
}
|
|
10108
|
-
|
|
10342
|
+
const result = applied.result;
|
|
10343
|
+
if (shadowWarning === void 0 || typeof result !== "object" || result === null || Array.isArray(result) || typeof result.warning === "string") {
|
|
10344
|
+
return result;
|
|
10345
|
+
}
|
|
10346
|
+
return { ...result, warning: shadowWarning };
|
|
10109
10347
|
};
|
|
10110
10348
|
const stream = opts?.onProgress !== void 0 || carriesMembers(finalArgs);
|
|
10111
10349
|
const sentOnce = carriesUpload(finalArgs);
|
|
10112
10350
|
const res = await doFetch(
|
|
10113
|
-
`${url}/tools/${encodeURIComponent(name)}`,
|
|
10351
|
+
`${url}/tools/${encodeURIComponent(meta?.name ?? name)}`,
|
|
10114
10352
|
{
|
|
10115
10353
|
method: "POST",
|
|
10116
10354
|
headers: {
|
|
@@ -10118,6 +10356,9 @@ function createToolsClient(options = {}) {
|
|
|
10118
10356
|
// Tells the tool-server the call came over a link, a link to
|
|
10119
10357
|
// 127.0.0.1 included, which nothing else in the request shows.
|
|
10120
10358
|
...remote ? { [LINKED_CALL_HEADER]: "1" } : {},
|
|
10359
|
+
// Tells the tool-server this client writes recordings under
|
|
10360
|
+
// `.argent/e2e/`; an older client writes only `.argent/flows/`.
|
|
10361
|
+
[E2E_DIR_CLIENT_HEADER]: "1",
|
|
10121
10362
|
// A proxy that compresses the stream holds each line until its buffer
|
|
10122
10363
|
// fills. `identity` keeps the stream uncompressed end to end.
|
|
10123
10364
|
...stream ? { "Accept": "application/x-ndjson", "Accept-Encoding": "identity" } : {},
|
|
@@ -10175,10 +10416,10 @@ function createToolsClient(options = {}) {
|
|
|
10175
10416
|
}
|
|
10176
10417
|
|
|
10177
10418
|
// ../argent-tools-client/src/artifacts.ts
|
|
10178
|
-
import { copyFile, mkdir as mkdir4, readFile as readFile5, realpath as realpath4, rm as rm3, stat as
|
|
10419
|
+
import { copyFile, mkdir as mkdir4, readFile as readFile5, realpath as realpath4, rm as rm3, stat as stat5, writeFile as writeFile4 } from "node:fs/promises";
|
|
10179
10420
|
import { constants as fsConstants } from "node:fs";
|
|
10180
10421
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
10181
|
-
import { basename as
|
|
10422
|
+
import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve8, sep as sep4 } from "node:path";
|
|
10182
10423
|
import { createHash as createHash3 } from "node:crypto";
|
|
10183
10424
|
var ARTIFACT_MARKER2 = "__argentArtifact";
|
|
10184
10425
|
function isArtifactHandle(value) {
|
|
@@ -10198,20 +10439,20 @@ function sanitizeSegment(segment) {
|
|
|
10198
10439
|
function projectSlug() {
|
|
10199
10440
|
const cwd = process.cwd();
|
|
10200
10441
|
const hash = createHash3("sha1").update(cwd).digest("hex").slice(0, 6);
|
|
10201
|
-
const name = sanitizeSegment(
|
|
10442
|
+
const name = sanitizeSegment(basename7(cwd)) || "root";
|
|
10202
10443
|
return `${name}-${hash}`;
|
|
10203
10444
|
}
|
|
10204
10445
|
function artifactsRoot() {
|
|
10205
|
-
return process.env.ARGENT_ARTIFACTS_DIR ??
|
|
10446
|
+
return process.env.ARGENT_ARTIFACTS_DIR ?? join13(tmpdir2(), "argent-artifacts");
|
|
10206
10447
|
}
|
|
10207
10448
|
function artifactDir(deviceId) {
|
|
10208
10449
|
const parts = [artifactsRoot(), projectSlug(), sessionId()];
|
|
10209
10450
|
if (deviceId) parts.push(sanitizeSegment(deviceId));
|
|
10210
|
-
return
|
|
10451
|
+
return join13(...parts);
|
|
10211
10452
|
}
|
|
10212
10453
|
function durableBaseDir() {
|
|
10213
10454
|
const projectRoot = findProjectRoot(process.cwd());
|
|
10214
|
-
return projectRoot ??
|
|
10455
|
+
return projectRoot ?? dirname9(argentHomeDir());
|
|
10215
10456
|
}
|
|
10216
10457
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
|
|
10217
10458
|
var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
|
|
@@ -10225,9 +10466,9 @@ function configuredRecordingsDir() {
|
|
|
10225
10466
|
if (typeof value !== "string") return null;
|
|
10226
10467
|
const trimmed = value.trim();
|
|
10227
10468
|
if (trimmed === "") return null;
|
|
10228
|
-
const home =
|
|
10229
|
-
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep4}`) ?
|
|
10230
|
-
return
|
|
10469
|
+
const home = dirname9(argentHomeDir());
|
|
10470
|
+
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep4}`) ? join13(home, trimmed.slice(2)) : trimmed;
|
|
10471
|
+
return resolve8(durableBaseDir(), expanded);
|
|
10231
10472
|
}
|
|
10232
10473
|
var MAX_DURABLE_BYTES = 2 * 1024 * 1024 * 1024;
|
|
10233
10474
|
async function readCapped(res, cap) {
|
|
@@ -10260,10 +10501,10 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
10260
10501
|
const stem = filename.slice(0, filename.length - ext.length);
|
|
10261
10502
|
for (let i = 1; i <= 1e3; i++) {
|
|
10262
10503
|
const candidate = i === 1 ? filename : `${stem} (${i})${ext}`;
|
|
10263
|
-
const
|
|
10504
|
+
const path14 = join13(dir, candidate);
|
|
10264
10505
|
try {
|
|
10265
|
-
await write(
|
|
10266
|
-
return
|
|
10506
|
+
await write(path14);
|
|
10507
|
+
return path14;
|
|
10267
10508
|
} catch (err) {
|
|
10268
10509
|
if (err?.code === "EEXIST") continue;
|
|
10269
10510
|
throw err;
|
|
@@ -10283,21 +10524,21 @@ function durableSaveTarget(handle) {
|
|
|
10283
10524
|
if (configured) {
|
|
10284
10525
|
return {
|
|
10285
10526
|
dir: configured,
|
|
10286
|
-
path:
|
|
10527
|
+
path: join13(configured, sanitizeSegment(handle.filename)),
|
|
10287
10528
|
base: configured,
|
|
10288
10529
|
rel: ""
|
|
10289
10530
|
};
|
|
10290
10531
|
}
|
|
10291
10532
|
}
|
|
10292
10533
|
const base = durableBaseDir();
|
|
10293
|
-
const dir =
|
|
10294
|
-
return { dir, path:
|
|
10534
|
+
const dir = join13(base, rel);
|
|
10535
|
+
return { dir, path: join13(dir, sanitizeSegment(handle.filename)), base, rel };
|
|
10295
10536
|
}
|
|
10296
10537
|
async function confineToRealBase(dir, base, rel) {
|
|
10297
10538
|
try {
|
|
10298
10539
|
const realDir = await realpath4(dir);
|
|
10299
10540
|
const realBase = await realpath4(base);
|
|
10300
|
-
return realDir ===
|
|
10541
|
+
return realDir === join13(realBase, rel);
|
|
10301
10542
|
} catch {
|
|
10302
10543
|
return false;
|
|
10303
10544
|
}
|
|
@@ -10305,7 +10546,7 @@ async function confineToRealBase(dir, base, rel) {
|
|
|
10305
10546
|
async function resolveLocalFile(handle) {
|
|
10306
10547
|
if (!handle.hostPath) return null;
|
|
10307
10548
|
try {
|
|
10308
|
-
const st = await
|
|
10549
|
+
const st = await stat5(handle.hostPath);
|
|
10309
10550
|
if (handle.archive) {
|
|
10310
10551
|
return st.isDirectory() ? handle.hostPath : null;
|
|
10311
10552
|
}
|
|
@@ -10320,7 +10561,7 @@ async function resolveLocalFile(handle) {
|
|
|
10320
10561
|
}
|
|
10321
10562
|
}
|
|
10322
10563
|
async function downloadAndExtractArchive(handle, data, dir) {
|
|
10323
|
-
const tarball =
|
|
10564
|
+
const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
|
|
10324
10565
|
try {
|
|
10325
10566
|
await writeFile4(tarball, data);
|
|
10326
10567
|
return await safeExtractTarGz(tarball, dir, handle.filename);
|
|
@@ -10348,7 +10589,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
10348
10589
|
const localPath = await resolveLocalFile(value);
|
|
10349
10590
|
const saveTarget = durableSaveTarget(value);
|
|
10350
10591
|
if (saveTarget) {
|
|
10351
|
-
const filename =
|
|
10592
|
+
const filename = basename7(saveTarget.path);
|
|
10352
10593
|
try {
|
|
10353
10594
|
await mkdir4(saveTarget.dir, { recursive: true });
|
|
10354
10595
|
if (!await confineToRealBase(saveTarget.dir, saveTarget.base, saveTarget.rel)) {
|
|
@@ -10412,7 +10653,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
10412
10653
|
return await downloadAndExtractArchive(value, data, dir);
|
|
10413
10654
|
}
|
|
10414
10655
|
if (value.size > 0 && data.length !== value.size) return null;
|
|
10415
|
-
const downloadedPath =
|
|
10656
|
+
const downloadedPath = join13(dir, sanitizeSegment(value.filename));
|
|
10416
10657
|
await writeFile4(downloadedPath, data);
|
|
10417
10658
|
if (value.mimeType.startsWith("image/")) {
|
|
10418
10659
|
images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
|
|
@@ -10446,12 +10687,12 @@ function getDeviceIdFromArgs(args) {
|
|
|
10446
10687
|
}
|
|
10447
10688
|
|
|
10448
10689
|
// src/bundled-paths.ts
|
|
10449
|
-
import * as
|
|
10450
|
-
import * as
|
|
10690
|
+
import * as fs7 from "node:fs";
|
|
10691
|
+
import * as path13 from "node:path";
|
|
10451
10692
|
function readPackageVersion() {
|
|
10452
10693
|
try {
|
|
10453
10694
|
const pkg = JSON.parse(
|
|
10454
|
-
|
|
10695
|
+
fs7.readFileSync(path13.join(import.meta.dirname, "..", "package.json"), "utf8")
|
|
10455
10696
|
);
|
|
10456
10697
|
return pkg.version;
|
|
10457
10698
|
} catch {
|
|
@@ -10462,15 +10703,15 @@ var PACKAGE_NAME = "@swmansion/argent";
|
|
|
10462
10703
|
function findDeclaringRoot(startDir) {
|
|
10463
10704
|
let dir = startDir;
|
|
10464
10705
|
for (; ; ) {
|
|
10465
|
-
if (
|
|
10706
|
+
if (fs7.existsSync(path13.join(dir, ".argent", "install.json"))) return dir;
|
|
10466
10707
|
try {
|
|
10467
|
-
const manifest = JSON.parse(
|
|
10708
|
+
const manifest = JSON.parse(fs7.readFileSync(path13.join(dir, "package.json"), "utf8"));
|
|
10468
10709
|
if (manifest.devDependencies?.[PACKAGE_NAME] || manifest.dependencies?.[PACKAGE_NAME] || manifest.optionalDependencies?.[PACKAGE_NAME]) {
|
|
10469
10710
|
return dir;
|
|
10470
10711
|
}
|
|
10471
10712
|
} catch {
|
|
10472
10713
|
}
|
|
10473
|
-
const parent =
|
|
10714
|
+
const parent = path13.dirname(dir);
|
|
10474
10715
|
if (parent === dir) return null;
|
|
10475
10716
|
dir = parent;
|
|
10476
10717
|
}
|
|
@@ -10478,12 +10719,12 @@ function findDeclaringRoot(startDir) {
|
|
|
10478
10719
|
function findStablePackageDir(startDir, packageRoot) {
|
|
10479
10720
|
let dir = startDir;
|
|
10480
10721
|
for (; ; ) {
|
|
10481
|
-
const candidate =
|
|
10722
|
+
const candidate = path13.join(dir, "node_modules", PACKAGE_NAME);
|
|
10482
10723
|
try {
|
|
10483
|
-
if (
|
|
10724
|
+
if (fs7.realpathSync(candidate) === packageRoot) return candidate;
|
|
10484
10725
|
} catch {
|
|
10485
10726
|
}
|
|
10486
|
-
const parent =
|
|
10727
|
+
const parent = path13.dirname(dir);
|
|
10487
10728
|
if (parent === dir) return void 0;
|
|
10488
10729
|
dir = parent;
|
|
10489
10730
|
}
|
|
@@ -10493,7 +10734,7 @@ function classifyInstall() {
|
|
|
10493
10734
|
let dir;
|
|
10494
10735
|
let cwd;
|
|
10495
10736
|
try {
|
|
10496
|
-
packageRoot =
|
|
10737
|
+
packageRoot = fs7.realpathSync(path13.join(import.meta.dirname, ".."));
|
|
10497
10738
|
cwd = process.cwd();
|
|
10498
10739
|
dir = cwd;
|
|
10499
10740
|
} catch {
|
|
@@ -10501,8 +10742,8 @@ function classifyInstall() {
|
|
|
10501
10742
|
}
|
|
10502
10743
|
for (; ; ) {
|
|
10503
10744
|
try {
|
|
10504
|
-
const nmReal =
|
|
10505
|
-
if (packageRoot === nmReal || packageRoot.startsWith(nmReal +
|
|
10745
|
+
const nmReal = fs7.realpathSync(path13.join(dir, "node_modules"));
|
|
10746
|
+
if (packageRoot === nmReal || packageRoot.startsWith(nmReal + path13.sep)) {
|
|
10506
10747
|
return {
|
|
10507
10748
|
kind: "local",
|
|
10508
10749
|
projectRoot: findDeclaringRoot(cwd) ?? dir,
|
|
@@ -10511,22 +10752,22 @@ function classifyInstall() {
|
|
|
10511
10752
|
}
|
|
10512
10753
|
} catch {
|
|
10513
10754
|
}
|
|
10514
|
-
const parent =
|
|
10755
|
+
const parent = path13.dirname(dir);
|
|
10515
10756
|
if (parent === dir) break;
|
|
10516
10757
|
dir = parent;
|
|
10517
10758
|
}
|
|
10518
|
-
if (packageRoot.includes(`${
|
|
10759
|
+
if (packageRoot.includes(`${path13.sep}.yarn${path13.sep}`)) {
|
|
10519
10760
|
const declRoot = findDeclaringRoot(cwd);
|
|
10520
10761
|
if (declRoot) return { kind: "local", projectRoot: declRoot };
|
|
10521
10762
|
}
|
|
10522
10763
|
return { kind: "global" };
|
|
10523
10764
|
}
|
|
10524
10765
|
var classifiedInstall = classifyInstall();
|
|
10525
|
-
var packageDir = classifiedInstall.stablePackageDir ??
|
|
10766
|
+
var packageDir = classifiedInstall.stablePackageDir ?? path13.join(import.meta.dirname, "..");
|
|
10526
10767
|
var BUNDLED_RUNTIME_PATHS = {
|
|
10527
|
-
bundlePath:
|
|
10528
|
-
simulatorServerDir:
|
|
10529
|
-
nativeDevtoolsDir:
|
|
10768
|
+
bundlePath: path13.join(packageDir, "dist", "tool-server.cjs"),
|
|
10769
|
+
simulatorServerDir: path13.join(packageDir, "bin"),
|
|
10770
|
+
nativeDevtoolsDir: path13.join(packageDir, "dylibs"),
|
|
10530
10771
|
version: readPackageVersion(),
|
|
10531
10772
|
installKind: classifiedInstall.kind,
|
|
10532
10773
|
installProjectRoot: classifiedInstall.projectRoot
|
|
@@ -10564,7 +10805,7 @@ function createArgentClient() {
|
|
|
10564
10805
|
}
|
|
10565
10806
|
async function listTools(options) {
|
|
10566
10807
|
const tools = await client.fetchTools({ signal: options?.signal });
|
|
10567
|
-
return tools.map(({ name, description, inputSchema }) => ({ name, description, inputSchema }));
|
|
10808
|
+
return tools.filter((tool) => tool.aliasOf === void 0).map(({ name, description, inputSchema }) => ({ name, description, inputSchema }));
|
|
10568
10809
|
}
|
|
10569
10810
|
async function callTool(name, args = {}, options) {
|
|
10570
10811
|
try {
|