@swmansion/argent 0.35.1-next.4 → 0.35.1-next.41
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 +16 -15
- package/bin/argent-android-devtools-0.4.0.apk +0 -0
- package/bin/darwin/argent-macos-helper +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +2353 -2063
- package/dist/client.js +302 -284
- package/dist/fatal-handlers.js +7 -1
- package/dist/fatal-handlers.js.map +1 -1
- package/dist/installer-help.js +2 -1
- package/dist/installer-help.js.map +1 -1
- package/dist/installer.mjs +972 -753
- package/dist/mcp-server.mjs +1558 -1429
- package/dist/tool-args.generated.d.ts +396 -318
- package/dist/tool-server.cjs +105318 -102566
- package/dylibs/libArgentAudio.dylib +0 -0
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
- package/dylibs/tcp/argent-audio-feeder +0 -0
- package/dylibs/tcp/libArgentAudio.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +2 -2
- package/skills/argent-android-emulator-setup/SKILL.md +2 -2
- package/skills/argent-create-e2e/SKILL.md +2 -1
- package/skills/argent-create-e2e/references/e2e-yaml.md +25 -2
- package/skills/argent-create-e2e/references/live-authoring.md +13 -2
- package/skills/argent-device-interact/SKILL.md +21 -94
- package/skills/argent-device-interact/references/advanced.md +64 -0
- package/skills/argent-ios-device-interact/SKILL.md +1 -1
- package/skills/argent-ios-device-setup/SKILL.md +1 -1
- package/skills/argent-ios-simulator-setup/SKILL.md +1 -1
- package/skills/argent-lens/SKILL.md +1 -1
- package/skills/argent-macos-app-interact/SKILL.md +1 -1
- package/skills/argent-metro-debugger/SKILL.md +4 -4
- package/skills/argent-native-profiler/SKILL.md +1 -1
- package/skills/argent-qa-e2e/SKILL.md +1 -1
- package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
- package/skills/argent-react-native-optimization/SKILL.md +1 -1
- package/skills/argent-react-native-profiler/SKILL.md +1 -1
- package/skills/argent-screen-recording/SKILL.md +1 -1
- package/skills/argent-screenshot-diff/SKILL.md +1 -1
- package/skills/argent-settings-permissions/SKILL.md +1 -1
- package/skills/argent-test-ui-flow/SKILL.md +1 -1
- package/skills/argent-tv-interact/SKILL.md +1 -1
package/dist/mcp-server.mjs
CHANGED
|
@@ -2990,7 +2990,7 @@ var require_compile = __commonJS({
|
|
|
2990
2990
|
const schOrFunc = root.refs[ref];
|
|
2991
2991
|
if (schOrFunc)
|
|
2992
2992
|
return schOrFunc;
|
|
2993
|
-
let _sch =
|
|
2993
|
+
let _sch = resolve13.call(this, root, ref);
|
|
2994
2994
|
if (_sch === void 0) {
|
|
2995
2995
|
const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
|
|
2996
2996
|
const { schemaId } = this.opts;
|
|
@@ -3017,7 +3017,7 @@ var require_compile = __commonJS({
|
|
|
3017
3017
|
function sameSchemaEnv(s1, s2) {
|
|
3018
3018
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
3019
3019
|
}
|
|
3020
|
-
function
|
|
3020
|
+
function resolve13(root, ref) {
|
|
3021
3021
|
let sch;
|
|
3022
3022
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
3023
3023
|
ref = sch;
|
|
@@ -3235,8 +3235,8 @@ var require_utils = __commonJS({
|
|
|
3235
3235
|
}
|
|
3236
3236
|
return ind;
|
|
3237
3237
|
}
|
|
3238
|
-
function removeDotSegments(
|
|
3239
|
-
let input =
|
|
3238
|
+
function removeDotSegments(path19) {
|
|
3239
|
+
let input = path19;
|
|
3240
3240
|
const output = [];
|
|
3241
3241
|
let nextSlash = -1;
|
|
3242
3242
|
let len = 0;
|
|
@@ -3488,8 +3488,8 @@ var require_schemes = __commonJS({
|
|
|
3488
3488
|
wsComponent.secure = void 0;
|
|
3489
3489
|
}
|
|
3490
3490
|
if (wsComponent.resourceName) {
|
|
3491
|
-
const [
|
|
3492
|
-
wsComponent.path =
|
|
3491
|
+
const [path19, query] = wsComponent.resourceName.split("?");
|
|
3492
|
+
wsComponent.path = path19 && path19 !== "/" ? path19 : void 0;
|
|
3493
3493
|
wsComponent.query = query;
|
|
3494
3494
|
wsComponent.resourceName = void 0;
|
|
3495
3495
|
}
|
|
@@ -3648,7 +3648,7 @@ var require_fast_uri = __commonJS({
|
|
|
3648
3648
|
}
|
|
3649
3649
|
return uri;
|
|
3650
3650
|
}
|
|
3651
|
-
function
|
|
3651
|
+
function resolve13(baseURI, relativeURI, options) {
|
|
3652
3652
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
3653
3653
|
const resolved = resolveComponent(parse4(baseURI, schemelessOptions), parse4(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
3654
3654
|
schemelessOptions.skipEscape = true;
|
|
@@ -3906,7 +3906,7 @@ var require_fast_uri = __commonJS({
|
|
|
3906
3906
|
var fastUri = {
|
|
3907
3907
|
SCHEMES,
|
|
3908
3908
|
normalize: normalize3,
|
|
3909
|
-
resolve:
|
|
3909
|
+
resolve: resolve13,
|
|
3910
3910
|
resolveComponent,
|
|
3911
3911
|
equal,
|
|
3912
3912
|
serialize,
|
|
@@ -9697,7 +9697,7 @@ var require_compile2 = __commonJS({
|
|
|
9697
9697
|
const schOrFunc = root.refs[ref];
|
|
9698
9698
|
if (schOrFunc)
|
|
9699
9699
|
return schOrFunc;
|
|
9700
|
-
let _sch =
|
|
9700
|
+
let _sch = resolve13.call(this, root, ref);
|
|
9701
9701
|
if (_sch === void 0) {
|
|
9702
9702
|
const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
|
|
9703
9703
|
const { schemaId } = this.opts;
|
|
@@ -9724,7 +9724,7 @@ var require_compile2 = __commonJS({
|
|
|
9724
9724
|
function sameSchemaEnv(s1, s2) {
|
|
9725
9725
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
9726
9726
|
}
|
|
9727
|
-
function
|
|
9727
|
+
function resolve13(root, ref) {
|
|
9728
9728
|
let sch;
|
|
9729
9729
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
9730
9730
|
ref = sch;
|
|
@@ -12577,12 +12577,12 @@ var require_dist = __commonJS({
|
|
|
12577
12577
|
throw new Error(`Unknown format "${name}"`);
|
|
12578
12578
|
return f;
|
|
12579
12579
|
};
|
|
12580
|
-
function addFormats(ajv, list,
|
|
12580
|
+
function addFormats(ajv, list, fs14, exportName) {
|
|
12581
12581
|
var _a3;
|
|
12582
12582
|
var _b;
|
|
12583
12583
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
12584
12584
|
for (const f of list)
|
|
12585
|
-
ajv.addFormat(f,
|
|
12585
|
+
ajv.addFormat(f, fs14[f]);
|
|
12586
12586
|
}
|
|
12587
12587
|
module.exports = exports = formatsPlugin;
|
|
12588
12588
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -12590,6 +12590,398 @@ var require_dist = __commonJS({
|
|
|
12590
12590
|
}
|
|
12591
12591
|
});
|
|
12592
12592
|
|
|
12593
|
+
// ../../node_modules/dotenv/dist/index.cjs
|
|
12594
|
+
var require_dist2 = __commonJS({
|
|
12595
|
+
"../../node_modules/dotenv/dist/index.cjs"(exports, module) {
|
|
12596
|
+
var j = (e, n) => () => {
|
|
12597
|
+
try {
|
|
12598
|
+
return n || e((n = { exports: {} }).exports, n), n.exports;
|
|
12599
|
+
} catch (t) {
|
|
12600
|
+
throw n = 0, t;
|
|
12601
|
+
}
|
|
12602
|
+
};
|
|
12603
|
+
var k = j((xe, U) => {
|
|
12604
|
+
function G(e) {
|
|
12605
|
+
return typeof e == "string" ? !["false", "0", "no", "off", ""].includes(e.toLowerCase()) : !!e;
|
|
12606
|
+
}
|
|
12607
|
+
function Y(e = process.env) {
|
|
12608
|
+
let n = {};
|
|
12609
|
+
for (let t of ["ENCODING", "PATH", "QUIET", "DEBUG", "OVERRIDE", "FAST"]) {
|
|
12610
|
+
let o = e[`DOTENV_${t}`] != null ? e[`DOTENV_${t}`] : e[`DOTENV_CONFIG_${t}`];
|
|
12611
|
+
o != null && (n[t.toLowerCase()] = t === "ENCODING" || t === "PATH" ? o : G(o));
|
|
12612
|
+
}
|
|
12613
|
+
return n;
|
|
12614
|
+
}
|
|
12615
|
+
U.exports = { parseBoolean: G, optionsFromEnv: Y };
|
|
12616
|
+
});
|
|
12617
|
+
var N = j((ye, x) => {
|
|
12618
|
+
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);
|
|
12619
|
+
for (let e = 48; e <= 57; e++) b[e] = 1;
|
|
12620
|
+
for (let e = 65; e <= 90; e++) b[e] = 1;
|
|
12621
|
+
for (let e = 97; e <= 122; e++) b[e] = 1;
|
|
12622
|
+
b[45] = 1;
|
|
12623
|
+
b[46] = 1;
|
|
12624
|
+
b[95] = 1;
|
|
12625
|
+
function ne(e) {
|
|
12626
|
+
let n = {}, t = e.toString();
|
|
12627
|
+
t = t.replace(/\r\n?/mg, `
|
|
12628
|
+
`);
|
|
12629
|
+
let o;
|
|
12630
|
+
for (; (o = re.exec(t)) != null; ) {
|
|
12631
|
+
let r = o[1], s = o[2] || "";
|
|
12632
|
+
s = s.trim();
|
|
12633
|
+
let i = s[0];
|
|
12634
|
+
s = s.replace(/^(['"`])([\s\S]*)\1$/mg, "$2"), i === '"' && (s = s.replace(/\\n/g, `
|
|
12635
|
+
`), s = s.replace(/\\r/g, "\r")), n[r] = s;
|
|
12636
|
+
}
|
|
12637
|
+
return n;
|
|
12638
|
+
}
|
|
12639
|
+
function w(e) {
|
|
12640
|
+
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);
|
|
12641
|
+
}
|
|
12642
|
+
function q(e) {
|
|
12643
|
+
return e === 10 || e === 8232 || e === 8233;
|
|
12644
|
+
}
|
|
12645
|
+
function oe(e) {
|
|
12646
|
+
let n = {}, t = typeof e == "string" ? e : e.toString();
|
|
12647
|
+
t.indexOf("\r") !== -1 && (t = t.replace(/\r\n?/g, `
|
|
12648
|
+
`));
|
|
12649
|
+
let o = t.length, r = 0;
|
|
12650
|
+
for (; r < o; ) {
|
|
12651
|
+
let s = t.charCodeAt(r);
|
|
12652
|
+
for (; r < o && w(s); ) r++, s = t.charCodeAt(r);
|
|
12653
|
+
if (r >= o) break;
|
|
12654
|
+
if (s === 35) {
|
|
12655
|
+
for (; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
12656
|
+
continue;
|
|
12657
|
+
}
|
|
12658
|
+
let i = -1;
|
|
12659
|
+
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) {
|
|
12660
|
+
let v = t.charCodeAt(r + 6);
|
|
12661
|
+
if (w(v)) {
|
|
12662
|
+
let u = r + 7;
|
|
12663
|
+
for (; u < o && w(t.charCodeAt(u)); ) u++;
|
|
12664
|
+
b[t.charCodeAt(u)] && (i = r + 6, r = u);
|
|
12665
|
+
} else s = t.charCodeAt(r);
|
|
12666
|
+
}
|
|
12667
|
+
let l = r, d = 0;
|
|
12668
|
+
for (; r < o && (d = t.charCodeAt(r), b[d]); ) r++;
|
|
12669
|
+
if (r === l) {
|
|
12670
|
+
for (; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
12671
|
+
continue;
|
|
12672
|
+
}
|
|
12673
|
+
let h = t.slice(l, r), f = r;
|
|
12674
|
+
if (r >= o && (d = 0), w(d)) do
|
|
12675
|
+
r++, d = r < o ? t.charCodeAt(r) : 0;
|
|
12676
|
+
while (w(d));
|
|
12677
|
+
if (d === 61) r++;
|
|
12678
|
+
else if (d === 58 && r === f && r + 1 < o && w(t.charCodeAt(r + 1))) r += 2;
|
|
12679
|
+
else {
|
|
12680
|
+
for (r = i === -1 ? f : i; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
12681
|
+
continue;
|
|
12682
|
+
}
|
|
12683
|
+
let c = r, a = r;
|
|
12684
|
+
for (; a < o && w(t.charCodeAt(a)); ) a++;
|
|
12685
|
+
let g = t.charCodeAt(a), p, y = false;
|
|
12686
|
+
if (g === 39 || g === 34 || g === 96) {
|
|
12687
|
+
let v = t[a], u = t.indexOf(v, a + 1), m = -1, C = -1;
|
|
12688
|
+
for (; u !== -1; ) {
|
|
12689
|
+
let O = t.charCodeAt(u - 1) === 92, E = u + 1;
|
|
12690
|
+
for (; E < o && !q(t.charCodeAt(E)) && w(t.charCodeAt(E)); ) E++;
|
|
12691
|
+
if ((E === o || q(t.charCodeAt(E)) || t.charCodeAt(E) === 35) && (m = u, C = E), !O) break;
|
|
12692
|
+
u = t.indexOf(v, u + 1);
|
|
12693
|
+
}
|
|
12694
|
+
if (m !== -1) {
|
|
12695
|
+
if (p = t.slice(a + 1, m), r = C, t.charCodeAt(r) === 35) for (; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
12696
|
+
y = true;
|
|
12697
|
+
}
|
|
12698
|
+
}
|
|
12699
|
+
if (!y) {
|
|
12700
|
+
let v = t.indexOf(`
|
|
12701
|
+
`, c);
|
|
12702
|
+
v === -1 && (v = o);
|
|
12703
|
+
let u;
|
|
12704
|
+
if (o < 4096) u = t.indexOf("#", c), (u === -1 || u > v) && (u = v);
|
|
12705
|
+
else for (u = c; u < v && t.charCodeAt(u) !== 35; ) u++;
|
|
12706
|
+
let m = c, C = u;
|
|
12707
|
+
for (; m < C && w(t.charCodeAt(m)); ) m++;
|
|
12708
|
+
for (; C > m && w(t.charCodeAt(C - 1)); ) C--;
|
|
12709
|
+
let O = t.charCodeAt(m);
|
|
12710
|
+
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++;
|
|
12711
|
+
}
|
|
12712
|
+
g === 34 && (y || a < r) && p.indexOf("\\") !== -1 && (p = p.replace(/\\n/g, `
|
|
12713
|
+
`).replace(/\\r/g, "\r")), n[h] = p;
|
|
12714
|
+
}
|
|
12715
|
+
return n;
|
|
12716
|
+
}
|
|
12717
|
+
function se(e, n) {
|
|
12718
|
+
return n && $(n.fast) ? oe(e) : ne(e);
|
|
12719
|
+
}
|
|
12720
|
+
function T(e) {
|
|
12721
|
+
console.log(`\u2506 ${e}`);
|
|
12722
|
+
}
|
|
12723
|
+
function ie(e) {
|
|
12724
|
+
console.error(`\u25C7 ${e}`);
|
|
12725
|
+
}
|
|
12726
|
+
function V(e) {
|
|
12727
|
+
return e[0] === "~" ? I.join(Z.homedir(), e.slice(1)) : e;
|
|
12728
|
+
}
|
|
12729
|
+
function ce(e = {}) {
|
|
12730
|
+
let n = { ...e };
|
|
12731
|
+
for (let t of Object.keys(n)) n[t] === void 0 && delete n[t];
|
|
12732
|
+
return { ...B(), ...n };
|
|
12733
|
+
}
|
|
12734
|
+
function ae(e) {
|
|
12735
|
+
e = ce(e);
|
|
12736
|
+
let n = I.resolve(process.cwd(), ".env"), t = "utf8", o = process.env;
|
|
12737
|
+
e && e.processEnv != null && (o = e.processEnv);
|
|
12738
|
+
let r = $(e && e.debug);
|
|
12739
|
+
e && e.encoding ? t = e.encoding : r && T("no encoding is specified (UTF-8 is used by default)");
|
|
12740
|
+
let s = [n];
|
|
12741
|
+
if (e && e.path) if (!Array.isArray(e.path)) s = [V(e.path)];
|
|
12742
|
+
else {
|
|
12743
|
+
s = [];
|
|
12744
|
+
for (let c of e.path) s.push(V(c));
|
|
12745
|
+
}
|
|
12746
|
+
let i, l = {}, d = { fast: e.fast };
|
|
12747
|
+
for (let c of s) try {
|
|
12748
|
+
let a = A.parse(z.readFileSync(c, { encoding: t }), d);
|
|
12749
|
+
A.populate(l, a, e);
|
|
12750
|
+
} catch (a) {
|
|
12751
|
+
r && T(`failed to load ${c} ${a.message}`), i = a;
|
|
12752
|
+
}
|
|
12753
|
+
let h = A.populate(o, l, e), f = $(Object.prototype.hasOwnProperty.call(e, "quiet") ? e.quiet : B(o).quiet);
|
|
12754
|
+
if (r || !f) {
|
|
12755
|
+
let c = Object.keys(h).length, a = [];
|
|
12756
|
+
for (let g of s) try {
|
|
12757
|
+
let p = I.relative(process.cwd(), g instanceof ee ? te(g) : g);
|
|
12758
|
+
a.push(p);
|
|
12759
|
+
} catch (p) {
|
|
12760
|
+
r && T(`failed to load ${g} ${p.message}`), i = p;
|
|
12761
|
+
}
|
|
12762
|
+
ie(`injected env (${c}) from ${a.join(",")}`);
|
|
12763
|
+
}
|
|
12764
|
+
return i ? { parsed: l, error: i } : { parsed: l };
|
|
12765
|
+
}
|
|
12766
|
+
function le(e) {
|
|
12767
|
+
return A.configDotenv(e);
|
|
12768
|
+
}
|
|
12769
|
+
function fe(e, n, t = {}) {
|
|
12770
|
+
let o = $(t && t.debug), r = $(t && t.override), s = {};
|
|
12771
|
+
if (e === null || typeof e != "object" || n === null || typeof n != "object") {
|
|
12772
|
+
let i = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
12773
|
+
throw i.code = "OBJECT_REQUIRED", i;
|
|
12774
|
+
}
|
|
12775
|
+
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]);
|
|
12776
|
+
return s;
|
|
12777
|
+
}
|
|
12778
|
+
var A = { configDotenv: ae, config: le, parse: se, populate: fe };
|
|
12779
|
+
x.exports.configDotenv = A.configDotenv;
|
|
12780
|
+
x.exports.config = A.config;
|
|
12781
|
+
x.exports.parse = A.parse;
|
|
12782
|
+
x.exports.populate = A.populate;
|
|
12783
|
+
x.exports = A;
|
|
12784
|
+
});
|
|
12785
|
+
var M = j((Te, W) => {
|
|
12786
|
+
var _ = __require("child_process"), ue = __require("fs"), L = __require("path");
|
|
12787
|
+
function de(e) {
|
|
12788
|
+
let n = ['"'], t = 0;
|
|
12789
|
+
for (let o of e) {
|
|
12790
|
+
if (o === "\\") {
|
|
12791
|
+
t++;
|
|
12792
|
+
continue;
|
|
12793
|
+
}
|
|
12794
|
+
o === '"' ? n.push("\\".repeat(t * 2 + 1), '"') : n.push("\\".repeat(t), o), t = 0;
|
|
12795
|
+
}
|
|
12796
|
+
return n.push("\\".repeat(t * 2), '"'), n.join("");
|
|
12797
|
+
}
|
|
12798
|
+
function H(e, n = 1) {
|
|
12799
|
+
for (let t = 0; t < n; t++) {
|
|
12800
|
+
let o = [];
|
|
12801
|
+
for (let r of e) {
|
|
12802
|
+
let s = r.charCodeAt(0), i = s >= 48 && s <= 57 || s >= 65 && s <= 90 || s >= 97 && s <= 122, l = "\\/:._-".includes(r);
|
|
12803
|
+
!i && !l && s < 128 && o.push("^"), o.push(r);
|
|
12804
|
+
}
|
|
12805
|
+
e = o.join("");
|
|
12806
|
+
}
|
|
12807
|
+
return e;
|
|
12808
|
+
}
|
|
12809
|
+
function P(e, n) {
|
|
12810
|
+
let t = Object.keys(e).reverse().find((o) => o.toUpperCase() === n);
|
|
12811
|
+
return t === void 0 ? void 0 : e[t];
|
|
12812
|
+
}
|
|
12813
|
+
function pe(e, n, t) {
|
|
12814
|
+
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(";")];
|
|
12815
|
+
for (let l of i) for (let d of s) {
|
|
12816
|
+
let h = L.resolve(t, l.replace(/^"|"$/g, ""), e + d);
|
|
12817
|
+
try {
|
|
12818
|
+
if (ue.statSync(h).isFile()) return h;
|
|
12819
|
+
} catch {
|
|
12820
|
+
}
|
|
12821
|
+
}
|
|
12822
|
+
}
|
|
12823
|
+
function he(e, n, t) {
|
|
12824
|
+
if (process.platform !== "win32") return _.spawn(e, n, t);
|
|
12825
|
+
let o = t.env || process.env, r = pe(e, o, t.cwd || process.cwd());
|
|
12826
|
+
if (r && /\.(?:exe|com)$/i.test(r)) return _.spawn(r, n, t);
|
|
12827
|
+
let s = /\.(?:bat|cmd)$/i.test(r || e), i = [H(L.normalize(r || e))];
|
|
12828
|
+
for (let d of n) i.push(H(de(d), s ? 2 : 1));
|
|
12829
|
+
let l = i.join(" ");
|
|
12830
|
+
return _.spawn(P(o, "COMSPEC") || "cmd.exe", ["/d", "/v:off", "/s", "/c", `"${l}"`], { ...t, windowsVerbatimArguments: true });
|
|
12831
|
+
}
|
|
12832
|
+
W.exports = he;
|
|
12833
|
+
});
|
|
12834
|
+
var X = j(($e, F) => {
|
|
12835
|
+
var ge = __require("fs"), me = __require("os"), Q = __require("path"), ve = __require("child_process"), Ce = M(), R = N(), { optionsFromEnv: J } = k();
|
|
12836
|
+
function D() {
|
|
12837
|
+
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(`
|
|
12838
|
+
`));
|
|
12839
|
+
}
|
|
12840
|
+
function we(e) {
|
|
12841
|
+
let n = [], t = false, o, r, s, i, l = -1;
|
|
12842
|
+
for (let h = 0; h < e.length; h++) {
|
|
12843
|
+
let f = e[h];
|
|
12844
|
+
if (f === "--") {
|
|
12845
|
+
l = h + 1;
|
|
12846
|
+
break;
|
|
12847
|
+
}
|
|
12848
|
+
if (f === "--help" || f === "-h") return { help: true };
|
|
12849
|
+
if (f === "--quiet" || f === "-q") {
|
|
12850
|
+
o = true;
|
|
12851
|
+
continue;
|
|
12852
|
+
}
|
|
12853
|
+
if (f === "--debug") {
|
|
12854
|
+
r = true;
|
|
12855
|
+
continue;
|
|
12856
|
+
}
|
|
12857
|
+
if (f === "--override") {
|
|
12858
|
+
s = true;
|
|
12859
|
+
continue;
|
|
12860
|
+
}
|
|
12861
|
+
if (f === "--fast") {
|
|
12862
|
+
i = true;
|
|
12863
|
+
continue;
|
|
12864
|
+
}
|
|
12865
|
+
if (f === "-f" || f === "--file" || f.startsWith("-f=") || f.startsWith("--file=")) {
|
|
12866
|
+
let c = f.indexOf("="), a = c === -1 ? f : f.slice(0, c), g = c === -1 ? e[++h] : f.slice(c + 1);
|
|
12867
|
+
if (!g || g === "--") return { error: `${a} requires a path` };
|
|
12868
|
+
let p = g.split(",").map((y) => y.trim()).filter(Boolean);
|
|
12869
|
+
if (p.length === 0) return { error: `${a} requires a path` };
|
|
12870
|
+
n.push(...p), t = true;
|
|
12871
|
+
continue;
|
|
12872
|
+
}
|
|
12873
|
+
if (f.startsWith("-")) return { error: `unknown option: ${f}` };
|
|
12874
|
+
l = h;
|
|
12875
|
+
break;
|
|
12876
|
+
}
|
|
12877
|
+
let d = l === -1 ? [] : e.slice(l);
|
|
12878
|
+
return { paths: n, pathSet: t, quiet: o, debug: r, override: s, fast: i, command: d };
|
|
12879
|
+
}
|
|
12880
|
+
function Ae(e) {
|
|
12881
|
+
return e[0] === "~" ? Q.join(me.homedir(), e.slice(1)) : e;
|
|
12882
|
+
}
|
|
12883
|
+
function Ee(e) {
|
|
12884
|
+
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 };
|
|
12885
|
+
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;
|
|
12886
|
+
}
|
|
12887
|
+
function be(e) {
|
|
12888
|
+
let n = {}, t = [], o = { override: e.override, debug: e.debug };
|
|
12889
|
+
for (let s of e.paths) {
|
|
12890
|
+
let i = Q.resolve(process.cwd(), Ae(s));
|
|
12891
|
+
try {
|
|
12892
|
+
let l = R.parse(ge.readFileSync(i, { encoding: e.encoding }), { fast: e.fast });
|
|
12893
|
+
R.populate(n, l, o), t.push(s);
|
|
12894
|
+
} catch (l) {
|
|
12895
|
+
if (e.debug && console.log(`\u2506 failed to load ${s} ${l.message}`), !(e.defaultPath && l.code === "ENOENT")) throw l;
|
|
12896
|
+
}
|
|
12897
|
+
}
|
|
12898
|
+
return { injected: R.populate(process.env, n, o), loadedPaths: t };
|
|
12899
|
+
}
|
|
12900
|
+
function K(e) {
|
|
12901
|
+
let n = e[0];
|
|
12902
|
+
if (n === "--help" || n === "-h") {
|
|
12903
|
+
D();
|
|
12904
|
+
return;
|
|
12905
|
+
}
|
|
12906
|
+
if (n !== "run") {
|
|
12907
|
+
D(), process.exitCode = 1;
|
|
12908
|
+
return;
|
|
12909
|
+
}
|
|
12910
|
+
let t = we(e.slice(1));
|
|
12911
|
+
if (t.help) {
|
|
12912
|
+
D();
|
|
12913
|
+
return;
|
|
12914
|
+
}
|
|
12915
|
+
if (t.error) {
|
|
12916
|
+
console.error(`dotenv: ${t.error}`), D(), process.exitCode = 1;
|
|
12917
|
+
return;
|
|
12918
|
+
}
|
|
12919
|
+
if (t.command.length === 0) {
|
|
12920
|
+
D(), process.exitCode = 1;
|
|
12921
|
+
return;
|
|
12922
|
+
}
|
|
12923
|
+
let o = Ee(t);
|
|
12924
|
+
try {
|
|
12925
|
+
let c = be(o);
|
|
12926
|
+
if (!(o.quiet == null ? J().quiet : o.quiet)) {
|
|
12927
|
+
let g = `\u25C7 injected env (${Object.keys(c.injected).length})`;
|
|
12928
|
+
c.loadedPaths.length > 0 && (g += ` from ${c.loadedPaths.join(", ")}`), console.error(g);
|
|
12929
|
+
}
|
|
12930
|
+
} catch (c) {
|
|
12931
|
+
console.error(`dotenv: ${c.message}`), process.exitCode = 1;
|
|
12932
|
+
return;
|
|
12933
|
+
}
|
|
12934
|
+
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;
|
|
12935
|
+
function h(c) {
|
|
12936
|
+
if (!(!i.pid || i.exitCode !== null || i.signalCode !== null)) {
|
|
12937
|
+
if (process.platform === "win32") {
|
|
12938
|
+
ve.spawnSync("taskkill", ["/pid", String(i.pid), "/T", "/F"], { stdio: "ignore" });
|
|
12939
|
+
return;
|
|
12940
|
+
}
|
|
12941
|
+
try {
|
|
12942
|
+
process.kill(s ? -i.pid : i.pid, c);
|
|
12943
|
+
} catch (a) {
|
|
12944
|
+
if (a.code !== "ESRCH") throw a;
|
|
12945
|
+
}
|
|
12946
|
+
}
|
|
12947
|
+
}
|
|
12948
|
+
function f() {
|
|
12949
|
+
for (let [c, a] of l) process.removeListener(c, a);
|
|
12950
|
+
}
|
|
12951
|
+
for (let c of ["SIGINT", "SIGTERM", "SIGHUP", "SIGQUIT"]) {
|
|
12952
|
+
let a = () => {
|
|
12953
|
+
if (c === "SIGINT") {
|
|
12954
|
+
if (d++, r && process.platform !== "win32" && d === 1) return;
|
|
12955
|
+
if (d > 1) {
|
|
12956
|
+
h(d === 2 ? "SIGTERM" : "SIGKILL");
|
|
12957
|
+
return;
|
|
12958
|
+
}
|
|
12959
|
+
}
|
|
12960
|
+
h(c);
|
|
12961
|
+
};
|
|
12962
|
+
l.set(c, a), process.on(c, a);
|
|
12963
|
+
}
|
|
12964
|
+
i.on("error", function(c) {
|
|
12965
|
+
f(), console.error(`dotenv: ${c.message}`), process.exitCode = 1;
|
|
12966
|
+
}), i.on("exit", function(c, a) {
|
|
12967
|
+
f(), typeof c == "number" ? process.exit(c) : (setInterval(() => {
|
|
12968
|
+
}, 1e3), process.kill(process.pid, a));
|
|
12969
|
+
});
|
|
12970
|
+
}
|
|
12971
|
+
F.exports = K;
|
|
12972
|
+
__require.main === F && K(process.argv.slice(2));
|
|
12973
|
+
});
|
|
12974
|
+
var S = N();
|
|
12975
|
+
var qe = X();
|
|
12976
|
+
module.exports = S;
|
|
12977
|
+
module.exports.config = S.config;
|
|
12978
|
+
module.exports.configDotenv = S.configDotenv;
|
|
12979
|
+
module.exports.parse = S.parse;
|
|
12980
|
+
module.exports.populate = S.populate;
|
|
12981
|
+
__require.main === module && qe(process.argv.slice(2));
|
|
12982
|
+
}
|
|
12983
|
+
});
|
|
12984
|
+
|
|
12593
12985
|
// ../../node_modules/yaml/dist/nodes/identity.js
|
|
12594
12986
|
var require_identity = __commonJS({
|
|
12595
12987
|
"../../node_modules/yaml/dist/nodes/identity.js"(exports) {
|
|
@@ -12667,17 +13059,17 @@ var require_visit = __commonJS({
|
|
|
12667
13059
|
visit.BREAK = BREAK;
|
|
12668
13060
|
visit.SKIP = SKIP;
|
|
12669
13061
|
visit.REMOVE = REMOVE;
|
|
12670
|
-
function visit_(key, node2, visitor,
|
|
12671
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
13062
|
+
function visit_(key, node2, visitor, path19) {
|
|
13063
|
+
const ctrl = callVisitor(key, node2, visitor, path19);
|
|
12672
13064
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
12673
|
-
replaceNode(key,
|
|
12674
|
-
return visit_(key, ctrl, visitor,
|
|
13065
|
+
replaceNode(key, path19, ctrl);
|
|
13066
|
+
return visit_(key, ctrl, visitor, path19);
|
|
12675
13067
|
}
|
|
12676
13068
|
if (typeof ctrl !== "symbol") {
|
|
12677
13069
|
if (identity.isCollection(node2)) {
|
|
12678
|
-
|
|
13070
|
+
path19 = Object.freeze(path19.concat(node2));
|
|
12679
13071
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
12680
|
-
const ci = visit_(i, node2.items[i], visitor,
|
|
13072
|
+
const ci = visit_(i, node2.items[i], visitor, path19);
|
|
12681
13073
|
if (typeof ci === "number")
|
|
12682
13074
|
i = ci - 1;
|
|
12683
13075
|
else if (ci === BREAK)
|
|
@@ -12688,13 +13080,13 @@ var require_visit = __commonJS({
|
|
|
12688
13080
|
}
|
|
12689
13081
|
}
|
|
12690
13082
|
} else if (identity.isPair(node2)) {
|
|
12691
|
-
|
|
12692
|
-
const ck = visit_("key", node2.key, visitor,
|
|
13083
|
+
path19 = Object.freeze(path19.concat(node2));
|
|
13084
|
+
const ck = visit_("key", node2.key, visitor, path19);
|
|
12693
13085
|
if (ck === BREAK)
|
|
12694
13086
|
return BREAK;
|
|
12695
13087
|
else if (ck === REMOVE)
|
|
12696
13088
|
node2.key = null;
|
|
12697
|
-
const cv = visit_("value", node2.value, visitor,
|
|
13089
|
+
const cv = visit_("value", node2.value, visitor, path19);
|
|
12698
13090
|
if (cv === BREAK)
|
|
12699
13091
|
return BREAK;
|
|
12700
13092
|
else if (cv === REMOVE)
|
|
@@ -12715,17 +13107,17 @@ var require_visit = __commonJS({
|
|
|
12715
13107
|
visitAsync.BREAK = BREAK;
|
|
12716
13108
|
visitAsync.SKIP = SKIP;
|
|
12717
13109
|
visitAsync.REMOVE = REMOVE;
|
|
12718
|
-
async function visitAsync_(key, node2, visitor,
|
|
12719
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
13110
|
+
async function visitAsync_(key, node2, visitor, path19) {
|
|
13111
|
+
const ctrl = await callVisitor(key, node2, visitor, path19);
|
|
12720
13112
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
12721
|
-
replaceNode(key,
|
|
12722
|
-
return visitAsync_(key, ctrl, visitor,
|
|
13113
|
+
replaceNode(key, path19, ctrl);
|
|
13114
|
+
return visitAsync_(key, ctrl, visitor, path19);
|
|
12723
13115
|
}
|
|
12724
13116
|
if (typeof ctrl !== "symbol") {
|
|
12725
13117
|
if (identity.isCollection(node2)) {
|
|
12726
|
-
|
|
13118
|
+
path19 = Object.freeze(path19.concat(node2));
|
|
12727
13119
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
12728
|
-
const ci = await visitAsync_(i, node2.items[i], visitor,
|
|
13120
|
+
const ci = await visitAsync_(i, node2.items[i], visitor, path19);
|
|
12729
13121
|
if (typeof ci === "number")
|
|
12730
13122
|
i = ci - 1;
|
|
12731
13123
|
else if (ci === BREAK)
|
|
@@ -12736,13 +13128,13 @@ var require_visit = __commonJS({
|
|
|
12736
13128
|
}
|
|
12737
13129
|
}
|
|
12738
13130
|
} else if (identity.isPair(node2)) {
|
|
12739
|
-
|
|
12740
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
13131
|
+
path19 = Object.freeze(path19.concat(node2));
|
|
13132
|
+
const ck = await visitAsync_("key", node2.key, visitor, path19);
|
|
12741
13133
|
if (ck === BREAK)
|
|
12742
13134
|
return BREAK;
|
|
12743
13135
|
else if (ck === REMOVE)
|
|
12744
13136
|
node2.key = null;
|
|
12745
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
13137
|
+
const cv = await visitAsync_("value", node2.value, visitor, path19);
|
|
12746
13138
|
if (cv === BREAK)
|
|
12747
13139
|
return BREAK;
|
|
12748
13140
|
else if (cv === REMOVE)
|
|
@@ -12769,23 +13161,23 @@ var require_visit = __commonJS({
|
|
|
12769
13161
|
}
|
|
12770
13162
|
return visitor;
|
|
12771
13163
|
}
|
|
12772
|
-
function callVisitor(key, node2, visitor,
|
|
13164
|
+
function callVisitor(key, node2, visitor, path19) {
|
|
12773
13165
|
if (typeof visitor === "function")
|
|
12774
|
-
return visitor(key, node2,
|
|
13166
|
+
return visitor(key, node2, path19);
|
|
12775
13167
|
if (identity.isMap(node2))
|
|
12776
|
-
return visitor.Map?.(key, node2,
|
|
13168
|
+
return visitor.Map?.(key, node2, path19);
|
|
12777
13169
|
if (identity.isSeq(node2))
|
|
12778
|
-
return visitor.Seq?.(key, node2,
|
|
13170
|
+
return visitor.Seq?.(key, node2, path19);
|
|
12779
13171
|
if (identity.isPair(node2))
|
|
12780
|
-
return visitor.Pair?.(key, node2,
|
|
13172
|
+
return visitor.Pair?.(key, node2, path19);
|
|
12781
13173
|
if (identity.isScalar(node2))
|
|
12782
|
-
return visitor.Scalar?.(key, node2,
|
|
13174
|
+
return visitor.Scalar?.(key, node2, path19);
|
|
12783
13175
|
if (identity.isAlias(node2))
|
|
12784
|
-
return visitor.Alias?.(key, node2,
|
|
13176
|
+
return visitor.Alias?.(key, node2, path19);
|
|
12785
13177
|
return void 0;
|
|
12786
13178
|
}
|
|
12787
|
-
function replaceNode(key,
|
|
12788
|
-
const parent =
|
|
13179
|
+
function replaceNode(key, path19, node2) {
|
|
13180
|
+
const parent = path19[path19.length - 1];
|
|
12789
13181
|
if (identity.isCollection(parent)) {
|
|
12790
13182
|
parent.items[key] = node2;
|
|
12791
13183
|
} else if (identity.isPair(parent)) {
|
|
@@ -13397,10 +13789,10 @@ var require_Collection = __commonJS({
|
|
|
13397
13789
|
var createNode = require_createNode();
|
|
13398
13790
|
var identity = require_identity();
|
|
13399
13791
|
var Node = require_Node();
|
|
13400
|
-
function collectionFromPath(schema,
|
|
13792
|
+
function collectionFromPath(schema, path19, value) {
|
|
13401
13793
|
let v = value;
|
|
13402
|
-
for (let i =
|
|
13403
|
-
const k =
|
|
13794
|
+
for (let i = path19.length - 1; i >= 0; --i) {
|
|
13795
|
+
const k = path19[i];
|
|
13404
13796
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
13405
13797
|
const a = [];
|
|
13406
13798
|
a[k] = v;
|
|
@@ -13419,7 +13811,7 @@ var require_Collection = __commonJS({
|
|
|
13419
13811
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
13420
13812
|
});
|
|
13421
13813
|
}
|
|
13422
|
-
var isEmptyPath = (
|
|
13814
|
+
var isEmptyPath = (path19) => path19 == null || typeof path19 === "object" && !!path19[Symbol.iterator]().next().done;
|
|
13423
13815
|
var Collection = class extends Node.NodeBase {
|
|
13424
13816
|
constructor(type, schema) {
|
|
13425
13817
|
super(type);
|
|
@@ -13449,11 +13841,11 @@ var require_Collection = __commonJS({
|
|
|
13449
13841
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
13450
13842
|
* that already exists in the map.
|
|
13451
13843
|
*/
|
|
13452
|
-
addIn(
|
|
13453
|
-
if (isEmptyPath(
|
|
13844
|
+
addIn(path19, value) {
|
|
13845
|
+
if (isEmptyPath(path19))
|
|
13454
13846
|
this.add(value);
|
|
13455
13847
|
else {
|
|
13456
|
-
const [key, ...rest] =
|
|
13848
|
+
const [key, ...rest] = path19;
|
|
13457
13849
|
const node2 = this.get(key, true);
|
|
13458
13850
|
if (identity.isCollection(node2))
|
|
13459
13851
|
node2.addIn(rest, value);
|
|
@@ -13467,8 +13859,8 @@ var require_Collection = __commonJS({
|
|
|
13467
13859
|
* Removes a value from the collection.
|
|
13468
13860
|
* @returns `true` if the item was found and removed.
|
|
13469
13861
|
*/
|
|
13470
|
-
deleteIn(
|
|
13471
|
-
const [key, ...rest] =
|
|
13862
|
+
deleteIn(path19) {
|
|
13863
|
+
const [key, ...rest] = path19;
|
|
13472
13864
|
if (rest.length === 0)
|
|
13473
13865
|
return this.delete(key);
|
|
13474
13866
|
const node2 = this.get(key, true);
|
|
@@ -13482,8 +13874,8 @@ var require_Collection = __commonJS({
|
|
|
13482
13874
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
13483
13875
|
* `true` (collections are always returned intact).
|
|
13484
13876
|
*/
|
|
13485
|
-
getIn(
|
|
13486
|
-
const [key, ...rest] =
|
|
13877
|
+
getIn(path19, keepScalar) {
|
|
13878
|
+
const [key, ...rest] = path19;
|
|
13487
13879
|
const node2 = this.get(key, true);
|
|
13488
13880
|
if (rest.length === 0)
|
|
13489
13881
|
return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
|
|
@@ -13501,8 +13893,8 @@ var require_Collection = __commonJS({
|
|
|
13501
13893
|
/**
|
|
13502
13894
|
* Checks if the collection includes a value with the key `key`.
|
|
13503
13895
|
*/
|
|
13504
|
-
hasIn(
|
|
13505
|
-
const [key, ...rest] =
|
|
13896
|
+
hasIn(path19) {
|
|
13897
|
+
const [key, ...rest] = path19;
|
|
13506
13898
|
if (rest.length === 0)
|
|
13507
13899
|
return this.has(key);
|
|
13508
13900
|
const node2 = this.get(key, true);
|
|
@@ -13512,8 +13904,8 @@ var require_Collection = __commonJS({
|
|
|
13512
13904
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
13513
13905
|
* boolean to add/remove the item from the set.
|
|
13514
13906
|
*/
|
|
13515
|
-
setIn(
|
|
13516
|
-
const [key, ...rest] =
|
|
13907
|
+
setIn(path19, value) {
|
|
13908
|
+
const [key, ...rest] = path19;
|
|
13517
13909
|
if (rest.length === 0) {
|
|
13518
13910
|
this.set(key, value);
|
|
13519
13911
|
} else {
|
|
@@ -16028,9 +16420,9 @@ var require_Document = __commonJS({
|
|
|
16028
16420
|
this.contents.add(value);
|
|
16029
16421
|
}
|
|
16030
16422
|
/** Adds a value to the document. */
|
|
16031
|
-
addIn(
|
|
16423
|
+
addIn(path19, value) {
|
|
16032
16424
|
if (assertCollection(this.contents))
|
|
16033
|
-
this.contents.addIn(
|
|
16425
|
+
this.contents.addIn(path19, value);
|
|
16034
16426
|
}
|
|
16035
16427
|
/**
|
|
16036
16428
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -16105,14 +16497,14 @@ var require_Document = __commonJS({
|
|
|
16105
16497
|
* Removes a value from the document.
|
|
16106
16498
|
* @returns `true` if the item was found and removed.
|
|
16107
16499
|
*/
|
|
16108
|
-
deleteIn(
|
|
16109
|
-
if (Collection.isEmptyPath(
|
|
16500
|
+
deleteIn(path19) {
|
|
16501
|
+
if (Collection.isEmptyPath(path19)) {
|
|
16110
16502
|
if (this.contents == null)
|
|
16111
16503
|
return false;
|
|
16112
16504
|
this.contents = null;
|
|
16113
16505
|
return true;
|
|
16114
16506
|
}
|
|
16115
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
16507
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path19) : false;
|
|
16116
16508
|
}
|
|
16117
16509
|
/**
|
|
16118
16510
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -16127,10 +16519,10 @@ var require_Document = __commonJS({
|
|
|
16127
16519
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
16128
16520
|
* `true` (collections are always returned intact).
|
|
16129
16521
|
*/
|
|
16130
|
-
getIn(
|
|
16131
|
-
if (Collection.isEmptyPath(
|
|
16522
|
+
getIn(path19, keepScalar) {
|
|
16523
|
+
if (Collection.isEmptyPath(path19))
|
|
16132
16524
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
16133
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
16525
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path19, keepScalar) : void 0;
|
|
16134
16526
|
}
|
|
16135
16527
|
/**
|
|
16136
16528
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -16141,10 +16533,10 @@ var require_Document = __commonJS({
|
|
|
16141
16533
|
/**
|
|
16142
16534
|
* Checks if the document includes a value at `path`.
|
|
16143
16535
|
*/
|
|
16144
|
-
hasIn(
|
|
16145
|
-
if (Collection.isEmptyPath(
|
|
16536
|
+
hasIn(path19) {
|
|
16537
|
+
if (Collection.isEmptyPath(path19))
|
|
16146
16538
|
return this.contents !== void 0;
|
|
16147
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
16539
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path19) : false;
|
|
16148
16540
|
}
|
|
16149
16541
|
/**
|
|
16150
16542
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -16161,13 +16553,13 @@ var require_Document = __commonJS({
|
|
|
16161
16553
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
16162
16554
|
* boolean to add/remove the item from the set.
|
|
16163
16555
|
*/
|
|
16164
|
-
setIn(
|
|
16165
|
-
if (Collection.isEmptyPath(
|
|
16556
|
+
setIn(path19, value) {
|
|
16557
|
+
if (Collection.isEmptyPath(path19)) {
|
|
16166
16558
|
this.contents = value;
|
|
16167
16559
|
} else if (this.contents == null) {
|
|
16168
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
16560
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path19), value);
|
|
16169
16561
|
} else if (assertCollection(this.contents)) {
|
|
16170
|
-
this.contents.setIn(
|
|
16562
|
+
this.contents.setIn(path19, value);
|
|
16171
16563
|
}
|
|
16172
16564
|
}
|
|
16173
16565
|
/**
|
|
@@ -18128,9 +18520,9 @@ var require_cst_visit = __commonJS({
|
|
|
18128
18520
|
visit.BREAK = BREAK;
|
|
18129
18521
|
visit.SKIP = SKIP;
|
|
18130
18522
|
visit.REMOVE = REMOVE;
|
|
18131
|
-
visit.itemAtPath = (cst,
|
|
18523
|
+
visit.itemAtPath = (cst, path19) => {
|
|
18132
18524
|
let item = cst;
|
|
18133
|
-
for (const [field, index] of
|
|
18525
|
+
for (const [field, index] of path19) {
|
|
18134
18526
|
const tok = item?.[field];
|
|
18135
18527
|
if (tok && "items" in tok) {
|
|
18136
18528
|
item = tok.items[index];
|
|
@@ -18139,23 +18531,23 @@ var require_cst_visit = __commonJS({
|
|
|
18139
18531
|
}
|
|
18140
18532
|
return item;
|
|
18141
18533
|
};
|
|
18142
|
-
visit.parentCollection = (cst,
|
|
18143
|
-
const parent = visit.itemAtPath(cst,
|
|
18144
|
-
const field =
|
|
18534
|
+
visit.parentCollection = (cst, path19) => {
|
|
18535
|
+
const parent = visit.itemAtPath(cst, path19.slice(0, -1));
|
|
18536
|
+
const field = path19[path19.length - 1][0];
|
|
18145
18537
|
const coll = parent?.[field];
|
|
18146
18538
|
if (coll && "items" in coll)
|
|
18147
18539
|
return coll;
|
|
18148
18540
|
throw new Error("Parent collection not found");
|
|
18149
18541
|
};
|
|
18150
|
-
function _visit(
|
|
18151
|
-
let ctrl = visitor(item,
|
|
18542
|
+
function _visit(path19, item, visitor) {
|
|
18543
|
+
let ctrl = visitor(item, path19);
|
|
18152
18544
|
if (typeof ctrl === "symbol")
|
|
18153
18545
|
return ctrl;
|
|
18154
18546
|
for (const field of ["key", "value"]) {
|
|
18155
18547
|
const token = item[field];
|
|
18156
18548
|
if (token && "items" in token) {
|
|
18157
18549
|
for (let i = 0; i < token.items.length; ++i) {
|
|
18158
|
-
const ci = _visit(Object.freeze(
|
|
18550
|
+
const ci = _visit(Object.freeze(path19.concat([[field, i]])), token.items[i], visitor);
|
|
18159
18551
|
if (typeof ci === "number")
|
|
18160
18552
|
i = ci - 1;
|
|
18161
18553
|
else if (ci === BREAK)
|
|
@@ -18166,10 +18558,10 @@ var require_cst_visit = __commonJS({
|
|
|
18166
18558
|
}
|
|
18167
18559
|
}
|
|
18168
18560
|
if (typeof ctrl === "function" && field === "key")
|
|
18169
|
-
ctrl = ctrl(item,
|
|
18561
|
+
ctrl = ctrl(item, path19);
|
|
18170
18562
|
}
|
|
18171
18563
|
}
|
|
18172
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
18564
|
+
return typeof ctrl === "function" ? ctrl(item, path19) : ctrl;
|
|
18173
18565
|
}
|
|
18174
18566
|
exports.visit = visit;
|
|
18175
18567
|
}
|
|
@@ -19471,14 +19863,14 @@ var require_parser = __commonJS({
|
|
|
19471
19863
|
case "scalar":
|
|
19472
19864
|
case "single-quoted-scalar":
|
|
19473
19865
|
case "double-quoted-scalar": {
|
|
19474
|
-
const
|
|
19866
|
+
const fs14 = this.flowScalar(this.type);
|
|
19475
19867
|
if (atNextItem || it.value) {
|
|
19476
|
-
map.items.push({ start, key:
|
|
19868
|
+
map.items.push({ start, key: fs14, sep: [] });
|
|
19477
19869
|
this.onKeyLine = true;
|
|
19478
19870
|
} else if (it.sep) {
|
|
19479
|
-
this.stack.push(
|
|
19871
|
+
this.stack.push(fs14);
|
|
19480
19872
|
} else {
|
|
19481
|
-
Object.assign(it, { key:
|
|
19873
|
+
Object.assign(it, { key: fs14, sep: [] });
|
|
19482
19874
|
this.onKeyLine = true;
|
|
19483
19875
|
}
|
|
19484
19876
|
return;
|
|
@@ -19606,13 +19998,13 @@ var require_parser = __commonJS({
|
|
|
19606
19998
|
case "scalar":
|
|
19607
19999
|
case "single-quoted-scalar":
|
|
19608
20000
|
case "double-quoted-scalar": {
|
|
19609
|
-
const
|
|
20001
|
+
const fs14 = this.flowScalar(this.type);
|
|
19610
20002
|
if (!it || it.value)
|
|
19611
|
-
fc.items.push({ start: [], key:
|
|
20003
|
+
fc.items.push({ start: [], key: fs14, sep: [] });
|
|
19612
20004
|
else if (it.sep)
|
|
19613
|
-
this.stack.push(
|
|
20005
|
+
this.stack.push(fs14);
|
|
19614
20006
|
else
|
|
19615
|
-
Object.assign(it, { key:
|
|
20007
|
+
Object.assign(it, { key: fs14, sep: [] });
|
|
19616
20008
|
return;
|
|
19617
20009
|
}
|
|
19618
20010
|
case "flow-map-end":
|
|
@@ -19869,7 +20261,7 @@ var require_public_api = __commonJS({
|
|
|
19869
20261
|
});
|
|
19870
20262
|
|
|
19871
20263
|
// ../../node_modules/yaml/dist/index.js
|
|
19872
|
-
var
|
|
20264
|
+
var require_dist3 = __commonJS({
|
|
19873
20265
|
"../../node_modules/yaml/dist/index.js"(exports) {
|
|
19874
20266
|
"use strict";
|
|
19875
20267
|
var composer = require_composer();
|
|
@@ -19920,398 +20312,6 @@ var require_dist2 = __commonJS({
|
|
|
19920
20312
|
}
|
|
19921
20313
|
});
|
|
19922
20314
|
|
|
19923
|
-
// ../../node_modules/dotenv/dist/index.cjs
|
|
19924
|
-
var require_dist3 = __commonJS({
|
|
19925
|
-
"../../node_modules/dotenv/dist/index.cjs"(exports, module) {
|
|
19926
|
-
var j = (e, n) => () => {
|
|
19927
|
-
try {
|
|
19928
|
-
return n || e((n = { exports: {} }).exports, n), n.exports;
|
|
19929
|
-
} catch (t) {
|
|
19930
|
-
throw n = 0, t;
|
|
19931
|
-
}
|
|
19932
|
-
};
|
|
19933
|
-
var k = j((xe, U) => {
|
|
19934
|
-
function G(e) {
|
|
19935
|
-
return typeof e == "string" ? !["false", "0", "no", "off", ""].includes(e.toLowerCase()) : !!e;
|
|
19936
|
-
}
|
|
19937
|
-
function Y(e = process.env) {
|
|
19938
|
-
let n = {};
|
|
19939
|
-
for (let t of ["ENCODING", "PATH", "QUIET", "DEBUG", "OVERRIDE", "FAST"]) {
|
|
19940
|
-
let o = e[`DOTENV_${t}`] != null ? e[`DOTENV_${t}`] : e[`DOTENV_CONFIG_${t}`];
|
|
19941
|
-
o != null && (n[t.toLowerCase()] = t === "ENCODING" || t === "PATH" ? o : G(o));
|
|
19942
|
-
}
|
|
19943
|
-
return n;
|
|
19944
|
-
}
|
|
19945
|
-
U.exports = { parseBoolean: G, optionsFromEnv: Y };
|
|
19946
|
-
});
|
|
19947
|
-
var N = j((ye, x) => {
|
|
19948
|
-
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);
|
|
19949
|
-
for (let e = 48; e <= 57; e++) b[e] = 1;
|
|
19950
|
-
for (let e = 65; e <= 90; e++) b[e] = 1;
|
|
19951
|
-
for (let e = 97; e <= 122; e++) b[e] = 1;
|
|
19952
|
-
b[45] = 1;
|
|
19953
|
-
b[46] = 1;
|
|
19954
|
-
b[95] = 1;
|
|
19955
|
-
function ne(e) {
|
|
19956
|
-
let n = {}, t = e.toString();
|
|
19957
|
-
t = t.replace(/\r\n?/mg, `
|
|
19958
|
-
`);
|
|
19959
|
-
let o;
|
|
19960
|
-
for (; (o = re.exec(t)) != null; ) {
|
|
19961
|
-
let r = o[1], s = o[2] || "";
|
|
19962
|
-
s = s.trim();
|
|
19963
|
-
let i = s[0];
|
|
19964
|
-
s = s.replace(/^(['"`])([\s\S]*)\1$/mg, "$2"), i === '"' && (s = s.replace(/\\n/g, `
|
|
19965
|
-
`), s = s.replace(/\\r/g, "\r")), n[r] = s;
|
|
19966
|
-
}
|
|
19967
|
-
return n;
|
|
19968
|
-
}
|
|
19969
|
-
function w(e) {
|
|
19970
|
-
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);
|
|
19971
|
-
}
|
|
19972
|
-
function q(e) {
|
|
19973
|
-
return e === 10 || e === 8232 || e === 8233;
|
|
19974
|
-
}
|
|
19975
|
-
function oe(e) {
|
|
19976
|
-
let n = {}, t = typeof e == "string" ? e : e.toString();
|
|
19977
|
-
t.indexOf("\r") !== -1 && (t = t.replace(/\r\n?/g, `
|
|
19978
|
-
`));
|
|
19979
|
-
let o = t.length, r = 0;
|
|
19980
|
-
for (; r < o; ) {
|
|
19981
|
-
let s = t.charCodeAt(r);
|
|
19982
|
-
for (; r < o && w(s); ) r++, s = t.charCodeAt(r);
|
|
19983
|
-
if (r >= o) break;
|
|
19984
|
-
if (s === 35) {
|
|
19985
|
-
for (; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
19986
|
-
continue;
|
|
19987
|
-
}
|
|
19988
|
-
let i = -1;
|
|
19989
|
-
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) {
|
|
19990
|
-
let v = t.charCodeAt(r + 6);
|
|
19991
|
-
if (w(v)) {
|
|
19992
|
-
let u = r + 7;
|
|
19993
|
-
for (; u < o && w(t.charCodeAt(u)); ) u++;
|
|
19994
|
-
b[t.charCodeAt(u)] && (i = r + 6, r = u);
|
|
19995
|
-
} else s = t.charCodeAt(r);
|
|
19996
|
-
}
|
|
19997
|
-
let l = r, d = 0;
|
|
19998
|
-
for (; r < o && (d = t.charCodeAt(r), b[d]); ) r++;
|
|
19999
|
-
if (r === l) {
|
|
20000
|
-
for (; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
20001
|
-
continue;
|
|
20002
|
-
}
|
|
20003
|
-
let h = t.slice(l, r), f = r;
|
|
20004
|
-
if (r >= o && (d = 0), w(d)) do
|
|
20005
|
-
r++, d = r < o ? t.charCodeAt(r) : 0;
|
|
20006
|
-
while (w(d));
|
|
20007
|
-
if (d === 61) r++;
|
|
20008
|
-
else if (d === 58 && r === f && r + 1 < o && w(t.charCodeAt(r + 1))) r += 2;
|
|
20009
|
-
else {
|
|
20010
|
-
for (r = i === -1 ? f : i; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
20011
|
-
continue;
|
|
20012
|
-
}
|
|
20013
|
-
let c = r, a = r;
|
|
20014
|
-
for (; a < o && w(t.charCodeAt(a)); ) a++;
|
|
20015
|
-
let g = t.charCodeAt(a), p, y = false;
|
|
20016
|
-
if (g === 39 || g === 34 || g === 96) {
|
|
20017
|
-
let v = t[a], u = t.indexOf(v, a + 1), m = -1, C = -1;
|
|
20018
|
-
for (; u !== -1; ) {
|
|
20019
|
-
let O = t.charCodeAt(u - 1) === 92, E = u + 1;
|
|
20020
|
-
for (; E < o && !q(t.charCodeAt(E)) && w(t.charCodeAt(E)); ) E++;
|
|
20021
|
-
if ((E === o || q(t.charCodeAt(E)) || t.charCodeAt(E) === 35) && (m = u, C = E), !O) break;
|
|
20022
|
-
u = t.indexOf(v, u + 1);
|
|
20023
|
-
}
|
|
20024
|
-
if (m !== -1) {
|
|
20025
|
-
if (p = t.slice(a + 1, m), r = C, t.charCodeAt(r) === 35) for (; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
20026
|
-
y = true;
|
|
20027
|
-
}
|
|
20028
|
-
}
|
|
20029
|
-
if (!y) {
|
|
20030
|
-
let v = t.indexOf(`
|
|
20031
|
-
`, c);
|
|
20032
|
-
v === -1 && (v = o);
|
|
20033
|
-
let u;
|
|
20034
|
-
if (o < 4096) u = t.indexOf("#", c), (u === -1 || u > v) && (u = v);
|
|
20035
|
-
else for (u = c; u < v && t.charCodeAt(u) !== 35; ) u++;
|
|
20036
|
-
let m = c, C = u;
|
|
20037
|
-
for (; m < C && w(t.charCodeAt(m)); ) m++;
|
|
20038
|
-
for (; C > m && w(t.charCodeAt(C - 1)); ) C--;
|
|
20039
|
-
let O = t.charCodeAt(m);
|
|
20040
|
-
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++;
|
|
20041
|
-
}
|
|
20042
|
-
g === 34 && (y || a < r) && p.indexOf("\\") !== -1 && (p = p.replace(/\\n/g, `
|
|
20043
|
-
`).replace(/\\r/g, "\r")), n[h] = p;
|
|
20044
|
-
}
|
|
20045
|
-
return n;
|
|
20046
|
-
}
|
|
20047
|
-
function se(e, n) {
|
|
20048
|
-
return n && $(n.fast) ? oe(e) : ne(e);
|
|
20049
|
-
}
|
|
20050
|
-
function T(e) {
|
|
20051
|
-
console.log(`\u2506 ${e}`);
|
|
20052
|
-
}
|
|
20053
|
-
function ie(e) {
|
|
20054
|
-
console.error(`\u25C7 ${e}`);
|
|
20055
|
-
}
|
|
20056
|
-
function V(e) {
|
|
20057
|
-
return e[0] === "~" ? I.join(Z.homedir(), e.slice(1)) : e;
|
|
20058
|
-
}
|
|
20059
|
-
function ce(e = {}) {
|
|
20060
|
-
let n = { ...e };
|
|
20061
|
-
for (let t of Object.keys(n)) n[t] === void 0 && delete n[t];
|
|
20062
|
-
return { ...B(), ...n };
|
|
20063
|
-
}
|
|
20064
|
-
function ae(e) {
|
|
20065
|
-
e = ce(e);
|
|
20066
|
-
let n = I.resolve(process.cwd(), ".env"), t = "utf8", o = process.env;
|
|
20067
|
-
e && e.processEnv != null && (o = e.processEnv);
|
|
20068
|
-
let r = $(e && e.debug);
|
|
20069
|
-
e && e.encoding ? t = e.encoding : r && T("no encoding is specified (UTF-8 is used by default)");
|
|
20070
|
-
let s = [n];
|
|
20071
|
-
if (e && e.path) if (!Array.isArray(e.path)) s = [V(e.path)];
|
|
20072
|
-
else {
|
|
20073
|
-
s = [];
|
|
20074
|
-
for (let c of e.path) s.push(V(c));
|
|
20075
|
-
}
|
|
20076
|
-
let i, l = {}, d = { fast: e.fast };
|
|
20077
|
-
for (let c of s) try {
|
|
20078
|
-
let a = A.parse(z.readFileSync(c, { encoding: t }), d);
|
|
20079
|
-
A.populate(l, a, e);
|
|
20080
|
-
} catch (a) {
|
|
20081
|
-
r && T(`failed to load ${c} ${a.message}`), i = a;
|
|
20082
|
-
}
|
|
20083
|
-
let h = A.populate(o, l, e), f = $(Object.prototype.hasOwnProperty.call(e, "quiet") ? e.quiet : B(o).quiet);
|
|
20084
|
-
if (r || !f) {
|
|
20085
|
-
let c = Object.keys(h).length, a = [];
|
|
20086
|
-
for (let g of s) try {
|
|
20087
|
-
let p = I.relative(process.cwd(), g instanceof ee ? te(g) : g);
|
|
20088
|
-
a.push(p);
|
|
20089
|
-
} catch (p) {
|
|
20090
|
-
r && T(`failed to load ${g} ${p.message}`), i = p;
|
|
20091
|
-
}
|
|
20092
|
-
ie(`injected env (${c}) from ${a.join(",")}`);
|
|
20093
|
-
}
|
|
20094
|
-
return i ? { parsed: l, error: i } : { parsed: l };
|
|
20095
|
-
}
|
|
20096
|
-
function le(e) {
|
|
20097
|
-
return A.configDotenv(e);
|
|
20098
|
-
}
|
|
20099
|
-
function fe(e, n, t = {}) {
|
|
20100
|
-
let o = $(t && t.debug), r = $(t && t.override), s = {};
|
|
20101
|
-
if (e === null || typeof e != "object" || n === null || typeof n != "object") {
|
|
20102
|
-
let i = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
20103
|
-
throw i.code = "OBJECT_REQUIRED", i;
|
|
20104
|
-
}
|
|
20105
|
-
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]);
|
|
20106
|
-
return s;
|
|
20107
|
-
}
|
|
20108
|
-
var A = { configDotenv: ae, config: le, parse: se, populate: fe };
|
|
20109
|
-
x.exports.configDotenv = A.configDotenv;
|
|
20110
|
-
x.exports.config = A.config;
|
|
20111
|
-
x.exports.parse = A.parse;
|
|
20112
|
-
x.exports.populate = A.populate;
|
|
20113
|
-
x.exports = A;
|
|
20114
|
-
});
|
|
20115
|
-
var M = j((Te, W) => {
|
|
20116
|
-
var _ = __require("child_process"), ue = __require("fs"), L = __require("path");
|
|
20117
|
-
function de(e) {
|
|
20118
|
-
let n = ['"'], t = 0;
|
|
20119
|
-
for (let o of e) {
|
|
20120
|
-
if (o === "\\") {
|
|
20121
|
-
t++;
|
|
20122
|
-
continue;
|
|
20123
|
-
}
|
|
20124
|
-
o === '"' ? n.push("\\".repeat(t * 2 + 1), '"') : n.push("\\".repeat(t), o), t = 0;
|
|
20125
|
-
}
|
|
20126
|
-
return n.push("\\".repeat(t * 2), '"'), n.join("");
|
|
20127
|
-
}
|
|
20128
|
-
function H(e, n = 1) {
|
|
20129
|
-
for (let t = 0; t < n; t++) {
|
|
20130
|
-
let o = [];
|
|
20131
|
-
for (let r of e) {
|
|
20132
|
-
let s = r.charCodeAt(0), i = s >= 48 && s <= 57 || s >= 65 && s <= 90 || s >= 97 && s <= 122, l = "\\/:._-".includes(r);
|
|
20133
|
-
!i && !l && s < 128 && o.push("^"), o.push(r);
|
|
20134
|
-
}
|
|
20135
|
-
e = o.join("");
|
|
20136
|
-
}
|
|
20137
|
-
return e;
|
|
20138
|
-
}
|
|
20139
|
-
function P(e, n) {
|
|
20140
|
-
let t = Object.keys(e).reverse().find((o) => o.toUpperCase() === n);
|
|
20141
|
-
return t === void 0 ? void 0 : e[t];
|
|
20142
|
-
}
|
|
20143
|
-
function pe(e, n, t) {
|
|
20144
|
-
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(";")];
|
|
20145
|
-
for (let l of i) for (let d of s) {
|
|
20146
|
-
let h = L.resolve(t, l.replace(/^"|"$/g, ""), e + d);
|
|
20147
|
-
try {
|
|
20148
|
-
if (ue.statSync(h).isFile()) return h;
|
|
20149
|
-
} catch {
|
|
20150
|
-
}
|
|
20151
|
-
}
|
|
20152
|
-
}
|
|
20153
|
-
function he(e, n, t) {
|
|
20154
|
-
if (process.platform !== "win32") return _.spawn(e, n, t);
|
|
20155
|
-
let o = t.env || process.env, r = pe(e, o, t.cwd || process.cwd());
|
|
20156
|
-
if (r && /\.(?:exe|com)$/i.test(r)) return _.spawn(r, n, t);
|
|
20157
|
-
let s = /\.(?:bat|cmd)$/i.test(r || e), i = [H(L.normalize(r || e))];
|
|
20158
|
-
for (let d of n) i.push(H(de(d), s ? 2 : 1));
|
|
20159
|
-
let l = i.join(" ");
|
|
20160
|
-
return _.spawn(P(o, "COMSPEC") || "cmd.exe", ["/d", "/v:off", "/s", "/c", `"${l}"`], { ...t, windowsVerbatimArguments: true });
|
|
20161
|
-
}
|
|
20162
|
-
W.exports = he;
|
|
20163
|
-
});
|
|
20164
|
-
var X = j(($e, F) => {
|
|
20165
|
-
var ge = __require("fs"), me = __require("os"), Q = __require("path"), ve = __require("child_process"), Ce = M(), R = N(), { optionsFromEnv: J } = k();
|
|
20166
|
-
function D() {
|
|
20167
|
-
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(`
|
|
20168
|
-
`));
|
|
20169
|
-
}
|
|
20170
|
-
function we(e) {
|
|
20171
|
-
let n = [], t = false, o, r, s, i, l = -1;
|
|
20172
|
-
for (let h = 0; h < e.length; h++) {
|
|
20173
|
-
let f = e[h];
|
|
20174
|
-
if (f === "--") {
|
|
20175
|
-
l = h + 1;
|
|
20176
|
-
break;
|
|
20177
|
-
}
|
|
20178
|
-
if (f === "--help" || f === "-h") return { help: true };
|
|
20179
|
-
if (f === "--quiet" || f === "-q") {
|
|
20180
|
-
o = true;
|
|
20181
|
-
continue;
|
|
20182
|
-
}
|
|
20183
|
-
if (f === "--debug") {
|
|
20184
|
-
r = true;
|
|
20185
|
-
continue;
|
|
20186
|
-
}
|
|
20187
|
-
if (f === "--override") {
|
|
20188
|
-
s = true;
|
|
20189
|
-
continue;
|
|
20190
|
-
}
|
|
20191
|
-
if (f === "--fast") {
|
|
20192
|
-
i = true;
|
|
20193
|
-
continue;
|
|
20194
|
-
}
|
|
20195
|
-
if (f === "-f" || f === "--file" || f.startsWith("-f=") || f.startsWith("--file=")) {
|
|
20196
|
-
let c = f.indexOf("="), a = c === -1 ? f : f.slice(0, c), g = c === -1 ? e[++h] : f.slice(c + 1);
|
|
20197
|
-
if (!g || g === "--") return { error: `${a} requires a path` };
|
|
20198
|
-
let p = g.split(",").map((y) => y.trim()).filter(Boolean);
|
|
20199
|
-
if (p.length === 0) return { error: `${a} requires a path` };
|
|
20200
|
-
n.push(...p), t = true;
|
|
20201
|
-
continue;
|
|
20202
|
-
}
|
|
20203
|
-
if (f.startsWith("-")) return { error: `unknown option: ${f}` };
|
|
20204
|
-
l = h;
|
|
20205
|
-
break;
|
|
20206
|
-
}
|
|
20207
|
-
let d = l === -1 ? [] : e.slice(l);
|
|
20208
|
-
return { paths: n, pathSet: t, quiet: o, debug: r, override: s, fast: i, command: d };
|
|
20209
|
-
}
|
|
20210
|
-
function Ae(e) {
|
|
20211
|
-
return e[0] === "~" ? Q.join(me.homedir(), e.slice(1)) : e;
|
|
20212
|
-
}
|
|
20213
|
-
function Ee(e) {
|
|
20214
|
-
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 };
|
|
20215
|
-
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;
|
|
20216
|
-
}
|
|
20217
|
-
function be(e) {
|
|
20218
|
-
let n = {}, t = [], o = { override: e.override, debug: e.debug };
|
|
20219
|
-
for (let s of e.paths) {
|
|
20220
|
-
let i = Q.resolve(process.cwd(), Ae(s));
|
|
20221
|
-
try {
|
|
20222
|
-
let l = R.parse(ge.readFileSync(i, { encoding: e.encoding }), { fast: e.fast });
|
|
20223
|
-
R.populate(n, l, o), t.push(s);
|
|
20224
|
-
} catch (l) {
|
|
20225
|
-
if (e.debug && console.log(`\u2506 failed to load ${s} ${l.message}`), !(e.defaultPath && l.code === "ENOENT")) throw l;
|
|
20226
|
-
}
|
|
20227
|
-
}
|
|
20228
|
-
return { injected: R.populate(process.env, n, o), loadedPaths: t };
|
|
20229
|
-
}
|
|
20230
|
-
function K(e) {
|
|
20231
|
-
let n = e[0];
|
|
20232
|
-
if (n === "--help" || n === "-h") {
|
|
20233
|
-
D();
|
|
20234
|
-
return;
|
|
20235
|
-
}
|
|
20236
|
-
if (n !== "run") {
|
|
20237
|
-
D(), process.exitCode = 1;
|
|
20238
|
-
return;
|
|
20239
|
-
}
|
|
20240
|
-
let t = we(e.slice(1));
|
|
20241
|
-
if (t.help) {
|
|
20242
|
-
D();
|
|
20243
|
-
return;
|
|
20244
|
-
}
|
|
20245
|
-
if (t.error) {
|
|
20246
|
-
console.error(`dotenv: ${t.error}`), D(), process.exitCode = 1;
|
|
20247
|
-
return;
|
|
20248
|
-
}
|
|
20249
|
-
if (t.command.length === 0) {
|
|
20250
|
-
D(), process.exitCode = 1;
|
|
20251
|
-
return;
|
|
20252
|
-
}
|
|
20253
|
-
let o = Ee(t);
|
|
20254
|
-
try {
|
|
20255
|
-
let c = be(o);
|
|
20256
|
-
if (!(o.quiet == null ? J().quiet : o.quiet)) {
|
|
20257
|
-
let g = `\u25C7 injected env (${Object.keys(c.injected).length})`;
|
|
20258
|
-
c.loadedPaths.length > 0 && (g += ` from ${c.loadedPaths.join(", ")}`), console.error(g);
|
|
20259
|
-
}
|
|
20260
|
-
} catch (c) {
|
|
20261
|
-
console.error(`dotenv: ${c.message}`), process.exitCode = 1;
|
|
20262
|
-
return;
|
|
20263
|
-
}
|
|
20264
|
-
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;
|
|
20265
|
-
function h(c) {
|
|
20266
|
-
if (!(!i.pid || i.exitCode !== null || i.signalCode !== null)) {
|
|
20267
|
-
if (process.platform === "win32") {
|
|
20268
|
-
ve.spawnSync("taskkill", ["/pid", String(i.pid), "/T", "/F"], { stdio: "ignore" });
|
|
20269
|
-
return;
|
|
20270
|
-
}
|
|
20271
|
-
try {
|
|
20272
|
-
process.kill(s ? -i.pid : i.pid, c);
|
|
20273
|
-
} catch (a) {
|
|
20274
|
-
if (a.code !== "ESRCH") throw a;
|
|
20275
|
-
}
|
|
20276
|
-
}
|
|
20277
|
-
}
|
|
20278
|
-
function f() {
|
|
20279
|
-
for (let [c, a] of l) process.removeListener(c, a);
|
|
20280
|
-
}
|
|
20281
|
-
for (let c of ["SIGINT", "SIGTERM", "SIGHUP", "SIGQUIT"]) {
|
|
20282
|
-
let a = () => {
|
|
20283
|
-
if (c === "SIGINT") {
|
|
20284
|
-
if (d++, r && process.platform !== "win32" && d === 1) return;
|
|
20285
|
-
if (d > 1) {
|
|
20286
|
-
h(d === 2 ? "SIGTERM" : "SIGKILL");
|
|
20287
|
-
return;
|
|
20288
|
-
}
|
|
20289
|
-
}
|
|
20290
|
-
h(c);
|
|
20291
|
-
};
|
|
20292
|
-
l.set(c, a), process.on(c, a);
|
|
20293
|
-
}
|
|
20294
|
-
i.on("error", function(c) {
|
|
20295
|
-
f(), console.error(`dotenv: ${c.message}`), process.exitCode = 1;
|
|
20296
|
-
}), i.on("exit", function(c, a) {
|
|
20297
|
-
f(), typeof c == "number" ? process.exit(c) : (setInterval(() => {
|
|
20298
|
-
}, 1e3), process.kill(process.pid, a));
|
|
20299
|
-
});
|
|
20300
|
-
}
|
|
20301
|
-
F.exports = K;
|
|
20302
|
-
__require.main === F && K(process.argv.slice(2));
|
|
20303
|
-
});
|
|
20304
|
-
var S = N();
|
|
20305
|
-
var qe = X();
|
|
20306
|
-
module.exports = S;
|
|
20307
|
-
module.exports.config = S.config;
|
|
20308
|
-
module.exports.configDotenv = S.configDotenv;
|
|
20309
|
-
module.exports.parse = S.parse;
|
|
20310
|
-
module.exports.populate = S.populate;
|
|
20311
|
-
__require.main === module && qe(process.argv.slice(2));
|
|
20312
|
-
}
|
|
20313
|
-
});
|
|
20314
|
-
|
|
20315
20315
|
// ../../node_modules/semver/internal/constants.js
|
|
20316
20316
|
var require_constants = __commonJS({
|
|
20317
20317
|
"../../node_modules/semver/internal/constants.js"(exports, module) {
|
|
@@ -22307,9 +22307,7 @@ var require_semver2 = __commonJS({
|
|
|
22307
22307
|
});
|
|
22308
22308
|
|
|
22309
22309
|
// ../argent-mcp/src/mcp-server.ts
|
|
22310
|
-
import {
|
|
22311
|
-
import { dirname as dirname11 } from "node:path";
|
|
22312
|
-
import { homedir as homedir5 } from "node:os";
|
|
22310
|
+
import { join as join19 } from "node:path";
|
|
22313
22311
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
22314
22312
|
|
|
22315
22313
|
// ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
@@ -22552,10 +22550,10 @@ function mergeDefs(...defs) {
|
|
|
22552
22550
|
function cloneDef(schema) {
|
|
22553
22551
|
return mergeDefs(schema._zod.def);
|
|
22554
22552
|
}
|
|
22555
|
-
function getElementAtPath(obj,
|
|
22556
|
-
if (!
|
|
22553
|
+
function getElementAtPath(obj, path19) {
|
|
22554
|
+
if (!path19)
|
|
22557
22555
|
return obj;
|
|
22558
|
-
return
|
|
22556
|
+
return path19.reduce((acc, key) => acc?.[key], obj);
|
|
22559
22557
|
}
|
|
22560
22558
|
function promiseAllObject(promisesObj) {
|
|
22561
22559
|
const keys = Object.keys(promisesObj);
|
|
@@ -22895,11 +22893,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
22895
22893
|
}
|
|
22896
22894
|
return false;
|
|
22897
22895
|
}
|
|
22898
|
-
function prefixIssues(
|
|
22896
|
+
function prefixIssues(path19, issues) {
|
|
22899
22897
|
return issues.map((iss) => {
|
|
22900
22898
|
var _a3;
|
|
22901
22899
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
22902
|
-
iss.path.unshift(
|
|
22900
|
+
iss.path.unshift(path19);
|
|
22903
22901
|
return iss;
|
|
22904
22902
|
});
|
|
22905
22903
|
}
|
|
@@ -23357,16 +23355,16 @@ function flattenError(error2, mapper = (issue2) => issue2.message) {
|
|
|
23357
23355
|
}
|
|
23358
23356
|
function formatError(error2, mapper = (issue2) => issue2.message) {
|
|
23359
23357
|
const fieldErrors = { _errors: [] };
|
|
23360
|
-
const processError = (error3,
|
|
23358
|
+
const processError = (error3, path19 = []) => {
|
|
23361
23359
|
for (const issue2 of error3.issues) {
|
|
23362
23360
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
23363
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
23361
|
+
issue2.errors.map((issues) => processError({ issues }, [...path19, ...issue2.path]));
|
|
23364
23362
|
} else if (issue2.code === "invalid_key") {
|
|
23365
|
-
processError({ issues: issue2.issues }, [...
|
|
23363
|
+
processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
|
|
23366
23364
|
} else if (issue2.code === "invalid_element") {
|
|
23367
|
-
processError({ issues: issue2.issues }, [...
|
|
23365
|
+
processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
|
|
23368
23366
|
} else {
|
|
23369
|
-
const fullpath = [...
|
|
23367
|
+
const fullpath = [...path19, ...issue2.path];
|
|
23370
23368
|
if (fullpath.length === 0) {
|
|
23371
23369
|
fieldErrors._errors.push(mapper(issue2));
|
|
23372
23370
|
} else {
|
|
@@ -25666,7 +25664,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
25666
25664
|
var NONE = 0;
|
|
25667
25665
|
var ASSUMED = 1;
|
|
25668
25666
|
var PROVEN = 2;
|
|
25669
|
-
function isRecursive(inst, stack,
|
|
25667
|
+
function isRecursive(inst, stack, resolve13) {
|
|
25670
25668
|
const cached2 = recursive.get(inst);
|
|
25671
25669
|
if (cached2 !== void 0)
|
|
25672
25670
|
return cached2 ? PROVEN : NONE;
|
|
@@ -25676,7 +25674,7 @@ function isRecursive(inst, stack, resolve12) {
|
|
|
25676
25674
|
let result = NONE;
|
|
25677
25675
|
const check = (child) => {
|
|
25678
25676
|
if (result !== PROVEN && child?._zod) {
|
|
25679
|
-
const answer = isRecursive(child, stack,
|
|
25677
|
+
const answer = isRecursive(child, stack, resolve13);
|
|
25680
25678
|
if (answer > result)
|
|
25681
25679
|
result = answer;
|
|
25682
25680
|
}
|
|
@@ -25687,7 +25685,7 @@ function isRecursive(inst, stack, resolve12) {
|
|
|
25687
25685
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
25688
25686
|
if (spread && !desc.enumerable)
|
|
25689
25687
|
continue;
|
|
25690
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
25688
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve13) : NONE;
|
|
25691
25689
|
if (child > answer)
|
|
25692
25690
|
answer = child;
|
|
25693
25691
|
}
|
|
@@ -25751,7 +25749,7 @@ function isRecursive(inst, stack, resolve12) {
|
|
|
25751
25749
|
break;
|
|
25752
25750
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
25753
25751
|
case "lazy": {
|
|
25754
|
-
const inner = def._cachedInner ?? (
|
|
25752
|
+
const inner = def._cachedInner ?? (resolve13 ? inst._zod.innerType : void 0);
|
|
25755
25753
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
25756
25754
|
break;
|
|
25757
25755
|
}
|
|
@@ -30329,12 +30327,12 @@ var StdioServerTransport = class {
|
|
|
30329
30327
|
this.onclose?.();
|
|
30330
30328
|
}
|
|
30331
30329
|
send(message) {
|
|
30332
|
-
return new Promise((
|
|
30330
|
+
return new Promise((resolve13) => {
|
|
30333
30331
|
const json = serializeMessage(message);
|
|
30334
30332
|
if (this._stdout.write(json)) {
|
|
30335
|
-
|
|
30333
|
+
resolve13();
|
|
30336
30334
|
} else {
|
|
30337
|
-
this._stdout.once("drain",
|
|
30335
|
+
this._stdout.once("drain", resolve13);
|
|
30338
30336
|
}
|
|
30339
30337
|
});
|
|
30340
30338
|
}
|
|
@@ -30954,7 +30952,7 @@ var Protocol = class {
|
|
|
30954
30952
|
return;
|
|
30955
30953
|
}
|
|
30956
30954
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
30957
|
-
await new Promise((
|
|
30955
|
+
await new Promise((resolve13) => setTimeout(resolve13, pollInterval));
|
|
30958
30956
|
options?.signal?.throwIfAborted();
|
|
30959
30957
|
}
|
|
30960
30958
|
} catch (error2) {
|
|
@@ -30971,7 +30969,7 @@ var Protocol = class {
|
|
|
30971
30969
|
*/
|
|
30972
30970
|
request(request, resultSchema, options) {
|
|
30973
30971
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
30974
|
-
return new Promise((
|
|
30972
|
+
return new Promise((resolve13, reject) => {
|
|
30975
30973
|
const earlyReject = (error2) => {
|
|
30976
30974
|
reject(error2);
|
|
30977
30975
|
};
|
|
@@ -31049,7 +31047,7 @@ var Protocol = class {
|
|
|
31049
31047
|
if (!parseResult.success) {
|
|
31050
31048
|
reject(parseResult.error);
|
|
31051
31049
|
} else {
|
|
31052
|
-
|
|
31050
|
+
resolve13(parseResult.data);
|
|
31053
31051
|
}
|
|
31054
31052
|
} catch (error2) {
|
|
31055
31053
|
reject(error2);
|
|
@@ -31311,12 +31309,12 @@ var Protocol = class {
|
|
|
31311
31309
|
}
|
|
31312
31310
|
} catch {
|
|
31313
31311
|
}
|
|
31314
|
-
return new Promise((
|
|
31312
|
+
return new Promise((resolve13, reject) => {
|
|
31315
31313
|
if (signal.aborted) {
|
|
31316
31314
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
31317
31315
|
return;
|
|
31318
31316
|
}
|
|
31319
|
-
const timeoutId = setTimeout(
|
|
31317
|
+
const timeoutId = setTimeout(resolve13, interval);
|
|
31320
31318
|
signal.addEventListener("abort", () => {
|
|
31321
31319
|
clearTimeout(timeoutId);
|
|
31322
31320
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -32098,17 +32096,659 @@ var Server = class extends Protocol {
|
|
|
32098
32096
|
|
|
32099
32097
|
// ../argent-tools-client/src/launcher.ts
|
|
32100
32098
|
import * as net from "node:net";
|
|
32101
|
-
import * as
|
|
32102
|
-
import * as
|
|
32099
|
+
import * as fs6 from "node:fs";
|
|
32100
|
+
import * as path7 from "node:path";
|
|
32103
32101
|
import * as readline from "node:readline";
|
|
32104
|
-
import { homedir } from "node:os";
|
|
32105
32102
|
import { spawn, execFileSync } from "node:child_process";
|
|
32106
32103
|
import { createHash, randomBytes } from "node:crypto";
|
|
32107
32104
|
import { mkdir, writeFile, readFile, readdir, unlink, rename, chmod } from "node:fs/promises";
|
|
32108
|
-
|
|
32109
|
-
|
|
32110
|
-
|
|
32111
|
-
|
|
32105
|
+
|
|
32106
|
+
// ../configuration-core/src/flags.ts
|
|
32107
|
+
import * as fs from "node:fs";
|
|
32108
|
+
import * as path2 from "node:path";
|
|
32109
|
+
|
|
32110
|
+
// ../configuration-core/src/home.ts
|
|
32111
|
+
import * as os from "node:os";
|
|
32112
|
+
import * as path from "node:path";
|
|
32113
|
+
var ARGENT_HOME_DIR_ENV = "ARGENT_HOME_DIR";
|
|
32114
|
+
function nonEmpty(value) {
|
|
32115
|
+
if (value == void 0) return null;
|
|
32116
|
+
const trimmed = value.trim();
|
|
32117
|
+
return trimmed === "" ? null : value;
|
|
32118
|
+
}
|
|
32119
|
+
function resolveHomeDir(options = {}) {
|
|
32120
|
+
if (options.homeDir) return options.homeDir;
|
|
32121
|
+
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
32122
|
+
}
|
|
32123
|
+
function argentHomeDir(options = {}) {
|
|
32124
|
+
const override = options.homeDir ? null : nonEmpty(process.env[ARGENT_HOME_DIR_ENV]);
|
|
32125
|
+
return override ? path.resolve(override.trim()) : path.join(resolveHomeDir(options), ".argent");
|
|
32126
|
+
}
|
|
32127
|
+
|
|
32128
|
+
// ../configuration-core/src/flags.ts
|
|
32129
|
+
var FLAG_REGISTRY = [
|
|
32130
|
+
{
|
|
32131
|
+
name: "disable-auto-screenshot",
|
|
32132
|
+
description: "Disable the automatic screenshot captured after interaction tools."
|
|
32133
|
+
},
|
|
32134
|
+
{
|
|
32135
|
+
name: "disable-auto-describe",
|
|
32136
|
+
description: "Disable the accessibility element tree appended after interaction tools."
|
|
32137
|
+
},
|
|
32138
|
+
{
|
|
32139
|
+
name: "argent-lens",
|
|
32140
|
+
description: "Argent Lens \u2014 the propose_variant / await_user_selection tools and the Electron preview window for staging UI design variants and letting a human pick among them. Off by default while the feature is in development."
|
|
32141
|
+
},
|
|
32142
|
+
{
|
|
32143
|
+
name: "artifacts-list-endpoint",
|
|
32144
|
+
description: "Expose GET /artifacts for remote artifact inventory consumers."
|
|
32145
|
+
},
|
|
32146
|
+
{
|
|
32147
|
+
name: "tool-server-event-log",
|
|
32148
|
+
description: "Write structured tool-server lifecycle events to a JSONL file."
|
|
32149
|
+
},
|
|
32150
|
+
{
|
|
32151
|
+
name: "boot-sound",
|
|
32152
|
+
description: "Default boot-device's `sound` argument to true so Android emulators boot with audio output instead of muted. Only the argument's default changes \u2014 an explicit `sound: false` on a call still boots muted."
|
|
32153
|
+
},
|
|
32154
|
+
{
|
|
32155
|
+
name: "microinteractions",
|
|
32156
|
+
description: "Amplify device actions with matching animations of the host window, so what happens on the guest is also visible on the desktop. Purely cosmetic, macOS only, and never affects whether the underlying action succeeds. Off by default."
|
|
32157
|
+
},
|
|
32158
|
+
{
|
|
32159
|
+
name: "harmonyos",
|
|
32160
|
+
description: "HarmonyOS support: list, boot and drive HarmonyOS phones and DevEco Studio emulators over `hdc`. Off by default while the platform is experimental."
|
|
32161
|
+
},
|
|
32162
|
+
{
|
|
32163
|
+
name: "forward-secrets",
|
|
32164
|
+
description: "Over `argent link` or ARGENT_TOOLS_URL, resolve each `{{secret:NAME}}` a call names on this machine and send the value with the call, so a remote tool-server can type a secret it does not hold. The linked tool-server then receives every secret of this machine that a call names, so link only one you trust with all of them. Values go only over https:// with the certificate checked, or to a loopback address. Off by default."
|
|
32165
|
+
},
|
|
32166
|
+
{
|
|
32167
|
+
name: "ios-audio-always-inserted",
|
|
32168
|
+
description: "Insert the iOS audio hook (libArgentAudio.dylib) into every app an armed simulator launches, so audio-input works without restart-app. Dormant until the app opens audio. On by default; `argent disable ios-audio-always-inserted` inserts it only on the first audio tool call, for apps launched after that call.",
|
|
32169
|
+
defaultEnabled: true
|
|
32170
|
+
},
|
|
32171
|
+
{
|
|
32172
|
+
name: "video-watermark",
|
|
32173
|
+
description: "Overlay the argent corner watermark on recorded screen videos. On by default; turn it off with `argent disable video-watermark`.",
|
|
32174
|
+
defaultEnabled: true
|
|
32175
|
+
},
|
|
32176
|
+
{
|
|
32177
|
+
name: "whats-new",
|
|
32178
|
+
description: "After an update, tell the agent the highlights of the new Argent version on its first tool call. On by default; turn it off with `argent disable whats-new`.",
|
|
32179
|
+
defaultEnabled: true
|
|
32180
|
+
},
|
|
32181
|
+
{
|
|
32182
|
+
name: "macos-apps",
|
|
32183
|
+
description: "Control native Mac apps, including Mac Catalyst. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. On by default; turn it off with `argent disable macos-apps`.",
|
|
32184
|
+
defaultEnabled: true
|
|
32185
|
+
}
|
|
32186
|
+
];
|
|
32187
|
+
function getFlagDefinition(name, registry2 = FLAG_REGISTRY) {
|
|
32188
|
+
return registry2.find((def) => def.name === name);
|
|
32189
|
+
}
|
|
32190
|
+
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
32191
|
+
function findProjectRoot(startDir) {
|
|
32192
|
+
let current = path2.resolve(startDir);
|
|
32193
|
+
while (true) {
|
|
32194
|
+
for (const marker of PROJECT_MARKERS) {
|
|
32195
|
+
if (fs.existsSync(path2.join(current, marker))) return current;
|
|
32196
|
+
}
|
|
32197
|
+
const parent = path2.dirname(current);
|
|
32198
|
+
if (parent === current) return null;
|
|
32199
|
+
current = parent;
|
|
32200
|
+
}
|
|
32201
|
+
}
|
|
32202
|
+
function resolveProjectRoot(startDir) {
|
|
32203
|
+
return findProjectRoot(startDir) ?? path2.resolve(startDir);
|
|
32204
|
+
}
|
|
32205
|
+
function getFlagsPath(scope, options = {}) {
|
|
32206
|
+
if (scope === "global") {
|
|
32207
|
+
return path2.join(argentHomeDir({ homeDir: options.homeDir }), "flags.json");
|
|
32208
|
+
}
|
|
32209
|
+
const cwd = options.cwd ?? process.cwd();
|
|
32210
|
+
return path2.join(resolveProjectRoot(cwd), ".argent", "flags.json");
|
|
32211
|
+
}
|
|
32212
|
+
function readFlagsFile(filePath) {
|
|
32213
|
+
let raw2;
|
|
32214
|
+
try {
|
|
32215
|
+
raw2 = fs.readFileSync(filePath, "utf8");
|
|
32216
|
+
} catch {
|
|
32217
|
+
return {};
|
|
32218
|
+
}
|
|
32219
|
+
let parsed;
|
|
32220
|
+
try {
|
|
32221
|
+
parsed = JSON.parse(raw2);
|
|
32222
|
+
} catch {
|
|
32223
|
+
return {};
|
|
32224
|
+
}
|
|
32225
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
32226
|
+
const flags = parsed.flags;
|
|
32227
|
+
if (!flags || typeof flags !== "object" || Array.isArray(flags)) return {};
|
|
32228
|
+
const out = {};
|
|
32229
|
+
for (const [k, v] of Object.entries(flags)) {
|
|
32230
|
+
if (typeof v === "boolean") out[k] = v;
|
|
32231
|
+
}
|
|
32232
|
+
return out;
|
|
32233
|
+
}
|
|
32234
|
+
function readFlags(scope, options = {}) {
|
|
32235
|
+
return readFlagsFile(getFlagsPath(scope, options));
|
|
32236
|
+
}
|
|
32237
|
+
function isFlagEnabled(name, options = {}) {
|
|
32238
|
+
const projectFlags = readFlags("project", options);
|
|
32239
|
+
if (Object.hasOwn(projectFlags, name)) return projectFlags[name];
|
|
32240
|
+
const globalFlags = readFlags("global", options);
|
|
32241
|
+
if (Object.hasOwn(globalFlags, name)) return globalFlags[name];
|
|
32242
|
+
return options.default ?? false;
|
|
32243
|
+
}
|
|
32244
|
+
function isFeatureEnabled(name, options = {}, registry2 = FLAG_REGISTRY) {
|
|
32245
|
+
return isFlagEnabled(name, {
|
|
32246
|
+
...options,
|
|
32247
|
+
default: getFlagDefinition(name, registry2)?.defaultEnabled ?? false
|
|
32248
|
+
});
|
|
32249
|
+
}
|
|
32250
|
+
|
|
32251
|
+
// ../configuration-core/src/paths.ts
|
|
32252
|
+
import * as fs2 from "node:fs";
|
|
32253
|
+
import * as path3 from "node:path";
|
|
32254
|
+
function isHomeDir(dir, options = {}) {
|
|
32255
|
+
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
32256
|
+
}
|
|
32257
|
+
function canonicalPath(p) {
|
|
32258
|
+
try {
|
|
32259
|
+
return fs2.realpathSync.native(p);
|
|
32260
|
+
} catch {
|
|
32261
|
+
return path3.resolve(p);
|
|
32262
|
+
}
|
|
32263
|
+
}
|
|
32264
|
+
function configDir(scope = "global", options = {}) {
|
|
32265
|
+
if (scope === "global") return argentHomeDir(options);
|
|
32266
|
+
const cwd = options.cwd ?? process.cwd();
|
|
32267
|
+
return path3.join(resolveProjectRoot(cwd), ".argent");
|
|
32268
|
+
}
|
|
32269
|
+
function configFilePath(scope = "global", options = {}) {
|
|
32270
|
+
return path3.join(configDir(scope, options), "config.json");
|
|
32271
|
+
}
|
|
32272
|
+
|
|
32273
|
+
// ../configuration-core/src/config.ts
|
|
32274
|
+
import * as crypto from "node:crypto";
|
|
32275
|
+
import * as fs3 from "node:fs";
|
|
32276
|
+
import * as path4 from "node:path";
|
|
32277
|
+
function readConfigObject(scope = "global", options = {}) {
|
|
32278
|
+
try {
|
|
32279
|
+
const raw2 = fs3.readFileSync(configFilePath(scope, options), "utf8");
|
|
32280
|
+
const json = JSON.parse(raw2);
|
|
32281
|
+
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
32282
|
+
return json;
|
|
32283
|
+
}
|
|
32284
|
+
} catch {
|
|
32285
|
+
}
|
|
32286
|
+
return {};
|
|
32287
|
+
}
|
|
32288
|
+
var FORBIDDEN_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
32289
|
+
function splitKey(dottedKey) {
|
|
32290
|
+
const parts = dottedKey.split(".");
|
|
32291
|
+
if (parts.length === 0 || parts.some((p) => p === "")) {
|
|
32292
|
+
throw new Error(`Invalid config key "${dottedKey}": empty path segment`);
|
|
32293
|
+
}
|
|
32294
|
+
for (const p of parts) {
|
|
32295
|
+
if (FORBIDDEN_SEGMENTS.has(p)) {
|
|
32296
|
+
throw new Error(`Invalid config key "${dottedKey}": forbidden segment "${p}"`);
|
|
32297
|
+
}
|
|
32298
|
+
}
|
|
32299
|
+
return parts;
|
|
32300
|
+
}
|
|
32301
|
+
function isPlainObject3(value) {
|
|
32302
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
32303
|
+
}
|
|
32304
|
+
function getAtPath(obj, dottedKey) {
|
|
32305
|
+
const parts = splitKey(dottedKey);
|
|
32306
|
+
let cur = obj;
|
|
32307
|
+
for (const part of parts) {
|
|
32308
|
+
if (!isPlainObject3(cur)) return void 0;
|
|
32309
|
+
cur = cur[part];
|
|
32310
|
+
}
|
|
32311
|
+
return cur;
|
|
32312
|
+
}
|
|
32313
|
+
function setAtPath(obj, dottedKey, value) {
|
|
32314
|
+
const parts = splitKey(dottedKey);
|
|
32315
|
+
let cur = obj;
|
|
32316
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
32317
|
+
const part = parts[i];
|
|
32318
|
+
const next = cur[part];
|
|
32319
|
+
if (!isPlainObject3(next)) {
|
|
32320
|
+
cur[part] = {};
|
|
32321
|
+
}
|
|
32322
|
+
cur = cur[part];
|
|
32323
|
+
}
|
|
32324
|
+
cur[parts[parts.length - 1]] = value;
|
|
32325
|
+
}
|
|
32326
|
+
var LOCK_STALE_MS = 1e4;
|
|
32327
|
+
var LOCK_MAX_WAIT_MS = 2e3;
|
|
32328
|
+
var LOCK_RETRY_MS = 25;
|
|
32329
|
+
function sleepSync(ms) {
|
|
32330
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
32331
|
+
}
|
|
32332
|
+
function acquireConfigLock(finalPath) {
|
|
32333
|
+
const lockPath = finalPath + ".lock";
|
|
32334
|
+
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
32335
|
+
for (; ; ) {
|
|
32336
|
+
try {
|
|
32337
|
+
const fd = fs3.openSync(lockPath, "wx", 384);
|
|
32338
|
+
try {
|
|
32339
|
+
fs3.writeSync(fd, `${process.pid}
|
|
32340
|
+
`);
|
|
32341
|
+
} catch {
|
|
32342
|
+
}
|
|
32343
|
+
return { fd, lockPath };
|
|
32344
|
+
} catch (err) {
|
|
32345
|
+
if (err.code !== "EEXIST") return null;
|
|
32346
|
+
try {
|
|
32347
|
+
if (Date.now() - fs3.statSync(lockPath).mtimeMs > LOCK_STALE_MS) {
|
|
32348
|
+
fs3.unlinkSync(lockPath);
|
|
32349
|
+
continue;
|
|
32350
|
+
}
|
|
32351
|
+
} catch {
|
|
32352
|
+
}
|
|
32353
|
+
if (Date.now() >= deadline) return null;
|
|
32354
|
+
sleepSync(LOCK_RETRY_MS);
|
|
32355
|
+
}
|
|
32356
|
+
}
|
|
32357
|
+
}
|
|
32358
|
+
function releaseConfigLock(lock) {
|
|
32359
|
+
try {
|
|
32360
|
+
fs3.closeSync(lock.fd);
|
|
32361
|
+
} catch {
|
|
32362
|
+
}
|
|
32363
|
+
try {
|
|
32364
|
+
fs3.unlinkSync(lock.lockPath);
|
|
32365
|
+
} catch {
|
|
32366
|
+
}
|
|
32367
|
+
}
|
|
32368
|
+
function updateConfig(mutate, scope = "global", options = {}) {
|
|
32369
|
+
const dir = configDir(scope, options);
|
|
32370
|
+
fs3.mkdirSync(dir, { recursive: true });
|
|
32371
|
+
const finalPath = configFilePath(scope, options);
|
|
32372
|
+
const lock = acquireConfigLock(finalPath);
|
|
32373
|
+
try {
|
|
32374
|
+
const next = readConfigObject(scope, options);
|
|
32375
|
+
mutate(next);
|
|
32376
|
+
const tmpPath = path4.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
32377
|
+
const fd = fs3.openSync(tmpPath, "wx", 384);
|
|
32378
|
+
try {
|
|
32379
|
+
fs3.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
32380
|
+
fs3.fsyncSync(fd);
|
|
32381
|
+
} finally {
|
|
32382
|
+
fs3.closeSync(fd);
|
|
32383
|
+
}
|
|
32384
|
+
try {
|
|
32385
|
+
fs3.renameSync(tmpPath, finalPath);
|
|
32386
|
+
} catch (err) {
|
|
32387
|
+
try {
|
|
32388
|
+
fs3.unlinkSync(tmpPath);
|
|
32389
|
+
} catch {
|
|
32390
|
+
}
|
|
32391
|
+
throw err;
|
|
32392
|
+
}
|
|
32393
|
+
} finally {
|
|
32394
|
+
if (lock) releaseConfigLock(lock);
|
|
32395
|
+
}
|
|
32396
|
+
}
|
|
32397
|
+
|
|
32398
|
+
// ../configuration-core/src/whats-new.ts
|
|
32399
|
+
var WHATS_NEW_SEEN_KEY = "notices.whats_new_seen";
|
|
32400
|
+
function getWhatsNewSeenVersion(options = {}) {
|
|
32401
|
+
const value = getAtPath(readConfigObject("global", options), WHATS_NEW_SEEN_KEY);
|
|
32402
|
+
return typeof value === "string" ? value : null;
|
|
32403
|
+
}
|
|
32404
|
+
function setWhatsNewSeenVersion(version2, options = {}) {
|
|
32405
|
+
let recorded = false;
|
|
32406
|
+
updateConfig(
|
|
32407
|
+
(config2) => {
|
|
32408
|
+
const value = getAtPath(config2, WHATS_NEW_SEEN_KEY);
|
|
32409
|
+
const seen = typeof value === "string" ? value : null;
|
|
32410
|
+
if (options.ifSeen !== void 0 && options.ifSeen !== seen) return;
|
|
32411
|
+
setAtPath(config2, WHATS_NEW_SEEN_KEY, version2);
|
|
32412
|
+
recorded = true;
|
|
32413
|
+
},
|
|
32414
|
+
"global",
|
|
32415
|
+
options
|
|
32416
|
+
);
|
|
32417
|
+
return recorded;
|
|
32418
|
+
}
|
|
32419
|
+
|
|
32420
|
+
// ../configuration-core/src/secrets.ts
|
|
32421
|
+
var import_dotenv = __toESM(require_dist2(), 1);
|
|
32422
|
+
import * as fs4 from "node:fs";
|
|
32423
|
+
import * as path5 from "node:path";
|
|
32424
|
+
var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
|
|
32425
|
+
var SECRETS_FILE_NAME = "secrets.env";
|
|
32426
|
+
var SHARED_ENV_FILES = [".env.local", ".env"];
|
|
32427
|
+
var SECRET_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
32428
|
+
function envSource(env) {
|
|
32429
|
+
const values = /* @__PURE__ */ new Map();
|
|
32430
|
+
for (const [key, value] of Object.entries(env)) {
|
|
32431
|
+
if (value === void 0 || !key.startsWith(SECRET_ENV_PREFIX)) continue;
|
|
32432
|
+
const name = key.slice(SECRET_ENV_PREFIX.length);
|
|
32433
|
+
if (SECRET_NAME_RE.test(name)) values.set(name, value);
|
|
32434
|
+
}
|
|
32435
|
+
return {
|
|
32436
|
+
label: `environment (${SECRET_ENV_PREFIX}*)`,
|
|
32437
|
+
kind: "env",
|
|
32438
|
+
present: true,
|
|
32439
|
+
names: [...values.keys()].sort(),
|
|
32440
|
+
values
|
|
32441
|
+
};
|
|
32442
|
+
}
|
|
32443
|
+
function fileSource(filePath, exposure) {
|
|
32444
|
+
const label = filePath;
|
|
32445
|
+
const absent = {
|
|
32446
|
+
label,
|
|
32447
|
+
kind: "file",
|
|
32448
|
+
present: false,
|
|
32449
|
+
names: [],
|
|
32450
|
+
values: /* @__PURE__ */ new Map()
|
|
32451
|
+
};
|
|
32452
|
+
if (!fs4.statSync(filePath, { throwIfNoEntry: false })) return absent;
|
|
32453
|
+
let content;
|
|
32454
|
+
try {
|
|
32455
|
+
content = fs4.readFileSync(filePath, "utf8");
|
|
32456
|
+
} catch {
|
|
32457
|
+
return absent;
|
|
32458
|
+
}
|
|
32459
|
+
const values = /* @__PURE__ */ new Map();
|
|
32460
|
+
let skippedUnprefixed = false;
|
|
32461
|
+
for (const [key, value] of Object.entries((0, import_dotenv.parse)(content))) {
|
|
32462
|
+
const prefixed = key.startsWith(SECRET_ENV_PREFIX);
|
|
32463
|
+
if (exposure === "shared" && !prefixed) {
|
|
32464
|
+
skippedUnprefixed = true;
|
|
32465
|
+
continue;
|
|
32466
|
+
}
|
|
32467
|
+
const name = prefixed ? key.slice(SECRET_ENV_PREFIX.length) : key;
|
|
32468
|
+
if (SECRET_NAME_RE.test(name)) values.set(name, value);
|
|
32469
|
+
}
|
|
32470
|
+
return {
|
|
32471
|
+
label,
|
|
32472
|
+
kind: "file",
|
|
32473
|
+
present: true,
|
|
32474
|
+
names: [...values.keys()].sort(),
|
|
32475
|
+
values,
|
|
32476
|
+
...values.size === 0 && skippedUnprefixed ? { needsPrefix: true } : {}
|
|
32477
|
+
};
|
|
32478
|
+
}
|
|
32479
|
+
function secretSources(options = {}) {
|
|
32480
|
+
const sources = [envSource(options.env ?? process.env)];
|
|
32481
|
+
const home = resolveHomeDir(options);
|
|
32482
|
+
const found = findProjectRoot(options.cwd ?? process.cwd());
|
|
32483
|
+
const projectRoot = found && isHomeDir(found, options) ? home : found;
|
|
32484
|
+
const filePaths = [];
|
|
32485
|
+
if (projectRoot) {
|
|
32486
|
+
filePaths.push({
|
|
32487
|
+
path: path5.join(projectRoot, ".argent", SECRETS_FILE_NAME),
|
|
32488
|
+
exposure: "dedicated"
|
|
32489
|
+
});
|
|
32490
|
+
for (const name of SHARED_ENV_FILES) {
|
|
32491
|
+
filePaths.push({ path: path5.join(projectRoot, name), exposure: "shared" });
|
|
32492
|
+
}
|
|
32493
|
+
}
|
|
32494
|
+
filePaths.push({
|
|
32495
|
+
path: path5.join(argentHomeDir(options), SECRETS_FILE_NAME),
|
|
32496
|
+
exposure: "dedicated"
|
|
32497
|
+
});
|
|
32498
|
+
const seen = /* @__PURE__ */ new Set();
|
|
32499
|
+
for (const entry of filePaths) {
|
|
32500
|
+
const resolved = path5.resolve(entry.path);
|
|
32501
|
+
if (seen.has(resolved)) continue;
|
|
32502
|
+
seen.add(resolved);
|
|
32503
|
+
sources.push(fileSource(resolved, entry.exposure));
|
|
32504
|
+
}
|
|
32505
|
+
return sources;
|
|
32506
|
+
}
|
|
32507
|
+
function encodeClientSecrets(values) {
|
|
32508
|
+
return Buffer.from(JSON.stringify(Object.fromEntries(values)), "utf8").toString("base64");
|
|
32509
|
+
}
|
|
32510
|
+
function lookupSecret(name, sources) {
|
|
32511
|
+
for (const source of sources) {
|
|
32512
|
+
const value = source.values.get(name);
|
|
32513
|
+
if (value !== void 0) return value;
|
|
32514
|
+
}
|
|
32515
|
+
return void 0;
|
|
32516
|
+
}
|
|
32517
|
+
var SECRET_PLACEHOLDER_RE = /\{\{secret:([A-Za-z_][A-Za-z0-9_]*)\}\}/g;
|
|
32518
|
+
function placeholderNames(text) {
|
|
32519
|
+
return Array.from(text.matchAll(SECRET_PLACEHOLDER_RE), (match) => match[1]);
|
|
32520
|
+
}
|
|
32521
|
+
var REDUNDANT_PREFIX_RE = /^argent_secret_/i;
|
|
32522
|
+
function lookupPlaceholderSecret(rawName, sources) {
|
|
32523
|
+
const value = lookupSecret(rawName, sources);
|
|
32524
|
+
if (value !== void 0 || !REDUNDANT_PREFIX_RE.test(rawName)) return { name: rawName, value };
|
|
32525
|
+
const name = rawName.replace(REDUNDANT_PREFIX_RE, "");
|
|
32526
|
+
return { name, value: lookupSecret(name, sources) };
|
|
32527
|
+
}
|
|
32528
|
+
|
|
32529
|
+
// ../configuration-core/src/merge.ts
|
|
32530
|
+
function mergeRestrictive(local, global) {
|
|
32531
|
+
if (local === void 0) return global;
|
|
32532
|
+
if (global === void 0) return local;
|
|
32533
|
+
if (typeof local === "boolean" && typeof global === "boolean") {
|
|
32534
|
+
return local && global;
|
|
32535
|
+
}
|
|
32536
|
+
if (typeof local === "number" && typeof global === "number") {
|
|
32537
|
+
return Math.min(local, global);
|
|
32538
|
+
}
|
|
32539
|
+
return local;
|
|
32540
|
+
}
|
|
32541
|
+
function toArray(value) {
|
|
32542
|
+
return Array.isArray(value) ? value : null;
|
|
32543
|
+
}
|
|
32544
|
+
function mergeUnion(local, global) {
|
|
32545
|
+
const l = toArray(local);
|
|
32546
|
+
const g = toArray(global);
|
|
32547
|
+
if (l === null && g === null) return local ?? global;
|
|
32548
|
+
const merged = [...g ?? [], ...l ?? []];
|
|
32549
|
+
return Array.from(new Set(merged));
|
|
32550
|
+
}
|
|
32551
|
+
function mergeIntersection(local, global) {
|
|
32552
|
+
const l = toArray(local);
|
|
32553
|
+
const g = toArray(global);
|
|
32554
|
+
if (l === null && g === null) return local ?? global;
|
|
32555
|
+
if (l === null) return global;
|
|
32556
|
+
if (g === null) return local;
|
|
32557
|
+
const globalSet = new Set(g);
|
|
32558
|
+
return l.filter((item) => globalSet.has(item));
|
|
32559
|
+
}
|
|
32560
|
+
function applyMergePolicy(policy, local, global) {
|
|
32561
|
+
if (typeof policy === "function") return policy({ local, global });
|
|
32562
|
+
switch (policy) {
|
|
32563
|
+
case "prioritize-local":
|
|
32564
|
+
return local ?? global;
|
|
32565
|
+
case "prioritize-global":
|
|
32566
|
+
return global ?? local;
|
|
32567
|
+
case "prioritize-restrictive":
|
|
32568
|
+
return mergeRestrictive(local, global);
|
|
32569
|
+
case "union":
|
|
32570
|
+
return mergeUnion(local, global);
|
|
32571
|
+
case "intersection":
|
|
32572
|
+
return mergeIntersection(local, global);
|
|
32573
|
+
default: {
|
|
32574
|
+
const _exhaustive = policy;
|
|
32575
|
+
return _exhaustive;
|
|
32576
|
+
}
|
|
32577
|
+
}
|
|
32578
|
+
}
|
|
32579
|
+
|
|
32580
|
+
// ../configuration-core/src/config-schema.ts
|
|
32581
|
+
import { isAbsolute } from "node:path";
|
|
32582
|
+
function asBoolean(raw2) {
|
|
32583
|
+
return typeof raw2 === "boolean" ? raw2 : void 0;
|
|
32584
|
+
}
|
|
32585
|
+
function asString(raw2) {
|
|
32586
|
+
if (typeof raw2 !== "string") return void 0;
|
|
32587
|
+
const trimmed = raw2.trim();
|
|
32588
|
+
return trimmed === "" ? void 0 : trimmed;
|
|
32589
|
+
}
|
|
32590
|
+
function asPositiveInteger(raw2) {
|
|
32591
|
+
return typeof raw2 === "number" && Number.isSafeInteger(raw2) && raw2 > 0 ? raw2 : void 0;
|
|
32592
|
+
}
|
|
32593
|
+
var MIN_SCRIPT_HEAP_LIMIT_MB = 32;
|
|
32594
|
+
var MIN_SCRIPT_TIMEOUT_MS = 100;
|
|
32595
|
+
function asStringArray(raw2) {
|
|
32596
|
+
if (!Array.isArray(raw2)) return void 0;
|
|
32597
|
+
const out = [];
|
|
32598
|
+
for (const item of raw2) {
|
|
32599
|
+
if (typeof item === "string" && item.trim() !== "") out.push(item.trim());
|
|
32600
|
+
}
|
|
32601
|
+
return out;
|
|
32602
|
+
}
|
|
32603
|
+
var CONFIG_SCHEMA = [
|
|
32604
|
+
{
|
|
32605
|
+
key: "telemetry.enabled",
|
|
32606
|
+
description: "Whether anonymous opt-out telemetry is enabled (on by default; environment opt-outs like DO_NOT_TRACK are not reflected here \u2014 `argent telemetry status` shows effective consent). `false` in either scope wins, so a committed project opt-out holds for every teammate.",
|
|
32607
|
+
scopes: ["project", "global"],
|
|
32608
|
+
parse: asBoolean,
|
|
32609
|
+
merge: "prioritize-restrictive",
|
|
32610
|
+
// Opt-out: consent.ts reads an unstored value as enabled, so the config
|
|
32611
|
+
// surface must show the same rather than "(unset)".
|
|
32612
|
+
default: true,
|
|
32613
|
+
// Opt-in/out goes through the dedicated command so the live client is
|
|
32614
|
+
// drained/reset, not just the file rewritten.
|
|
32615
|
+
manageCommand: "argent telemetry"
|
|
32616
|
+
},
|
|
32617
|
+
{
|
|
32618
|
+
key: "autoUpdate.enabled",
|
|
32619
|
+
description: "Automatically update the global Argent installation. Project-local installs require confirmation.",
|
|
32620
|
+
scopes: ["global"],
|
|
32621
|
+
parse: asBoolean,
|
|
32622
|
+
merge: "prioritize-local",
|
|
32623
|
+
default: true,
|
|
32624
|
+
example: "false"
|
|
32625
|
+
},
|
|
32626
|
+
{
|
|
32627
|
+
key: "lens.agent",
|
|
32628
|
+
description: "Coding-agent id remembered by `argent lens` to skip the picker.",
|
|
32629
|
+
scopes: ["project", "global"],
|
|
32630
|
+
parse: asString,
|
|
32631
|
+
merge: "prioritize-local",
|
|
32632
|
+
example: "claude"
|
|
32633
|
+
},
|
|
32634
|
+
{
|
|
32635
|
+
key: "ios.additionalDeviceSets",
|
|
32636
|
+
description: "Additional CoreSimulator device-set directories whose simulators argent should see alongside the default set. Absolute paths (or ~/\u2026); relative entries resolve against the project root (project scope) or home (global scope).",
|
|
32637
|
+
scopes: ["project", "global"],
|
|
32638
|
+
parse: asStringArray,
|
|
32639
|
+
// Additive rather than shadowing: global baseline first, project extras
|
|
32640
|
+
// after, deduplicated. `getAdditionalIosDeviceSets` re-implements this union
|
|
32641
|
+
// (path resolution must precede dedup) and guards on the preset staying "union".
|
|
32642
|
+
merge: "union",
|
|
32643
|
+
example: '["~/DeviceSets/ci"]'
|
|
32644
|
+
},
|
|
32645
|
+
{
|
|
32646
|
+
key: "android.sdkRoot",
|
|
32647
|
+
description: "Android SDK root argent uses instead of `ANDROID_HOME`, for hosts whose SDK is not where the environment says (Nix, custom layouts). Absolute or `~/`-prefixed. Applies to the tool-server and to the simulator-server it starts. `adb` on PATH still wins, as it does with the environment variable.",
|
|
32648
|
+
scopes: ["project", "global"],
|
|
32649
|
+
parse: (raw2) => {
|
|
32650
|
+
const value = asString(raw2);
|
|
32651
|
+
return value !== void 0 && (value === "~" || value.startsWith("~/") || isAbsolute(value)) ? value : void 0;
|
|
32652
|
+
},
|
|
32653
|
+
expected: "an absolute path, or one starting with `~/`",
|
|
32654
|
+
merge: "prioritize-local",
|
|
32655
|
+
example: "~/Library/Android/sdk"
|
|
32656
|
+
},
|
|
32657
|
+
{
|
|
32658
|
+
key: "android.adbServerPort",
|
|
32659
|
+
description: "Port of the adb server argent uses, for hosts that run Android devices on a server other than the default 5037 (a device pool with its own server, for example). Applies when the tool-server starts, to the tool-server and every adb and simulator-server it runs. `ANDROID_ADB_SERVER_PORT` or `ADB_SERVER_SOCKET` in the tool-server's environment still wins, as it does for adb itself.",
|
|
32660
|
+
scopes: ["project", "global"],
|
|
32661
|
+
parse: (raw2) => {
|
|
32662
|
+
const value = asPositiveInteger(raw2);
|
|
32663
|
+
return value !== void 0 && value < 65536 ? value : void 0;
|
|
32664
|
+
},
|
|
32665
|
+
expected: "a TCP port, 1-65535",
|
|
32666
|
+
merge: "prioritize-local",
|
|
32667
|
+
example: "5038"
|
|
32668
|
+
},
|
|
32669
|
+
{
|
|
32670
|
+
key: "recordings.directory",
|
|
32671
|
+
description: "Directory where finished screen recordings (mp4) are saved on the client host. Absolute, `~`-prefixed, or relative to the project root (home dir when not in a project). Unset \u21D2 `.argent/recordings` under the project root.",
|
|
32672
|
+
scopes: ["project", "global"],
|
|
32673
|
+
parse: asString,
|
|
32674
|
+
// Resolved on the client (the machine the mp4 is persisted to), so with a
|
|
32675
|
+
// remote `argent link` tool-server it is the *client's* config that decides.
|
|
32676
|
+
merge: "prioritize-local",
|
|
32677
|
+
example: "~/Movies/argent"
|
|
32678
|
+
},
|
|
32679
|
+
// Global-scope only: a checked-in `.argent/config.json` must not raise the
|
|
32680
|
+
// ceiling on how much of the machine a script step may occupy. `merge` is
|
|
32681
|
+
// nominal here — the project scope of a global-only key is never read.
|
|
32682
|
+
{
|
|
32683
|
+
key: "scripts.maxTimeoutMs",
|
|
32684
|
+
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.`,
|
|
32685
|
+
scopes: ["global"],
|
|
32686
|
+
parse: (raw2) => {
|
|
32687
|
+
const value = asPositiveInteger(raw2);
|
|
32688
|
+
return value !== void 0 && value >= MIN_SCRIPT_TIMEOUT_MS ? value : void 0;
|
|
32689
|
+
},
|
|
32690
|
+
expected: `a whole number of milliseconds, at least ${MIN_SCRIPT_TIMEOUT_MS}`,
|
|
32691
|
+
merge: "prioritize-global",
|
|
32692
|
+
default: 5 * 6e4,
|
|
32693
|
+
example: "300000"
|
|
32694
|
+
},
|
|
32695
|
+
{
|
|
32696
|
+
key: "scripts.heapLimitMb",
|
|
32697
|
+
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.`,
|
|
32698
|
+
scopes: ["global"],
|
|
32699
|
+
parse: (raw2) => {
|
|
32700
|
+
const value = asPositiveInteger(raw2);
|
|
32701
|
+
return value !== void 0 && value >= MIN_SCRIPT_HEAP_LIMIT_MB ? value : void 0;
|
|
32702
|
+
},
|
|
32703
|
+
expected: `a whole number of MiB, at least ${MIN_SCRIPT_HEAP_LIMIT_MB}`,
|
|
32704
|
+
merge: "prioritize-global",
|
|
32705
|
+
default: 512,
|
|
32706
|
+
example: "512"
|
|
32707
|
+
}
|
|
32708
|
+
];
|
|
32709
|
+
function getConfigDefinition(key, registry2 = CONFIG_SCHEMA) {
|
|
32710
|
+
return registry2.find((def) => def.key === key);
|
|
32711
|
+
}
|
|
32712
|
+
|
|
32713
|
+
// ../configuration-core/src/config-access.ts
|
|
32714
|
+
import * as fs5 from "node:fs";
|
|
32715
|
+
import * as path6 from "node:path";
|
|
32716
|
+
function readScopeValue(def, scope, options) {
|
|
32717
|
+
if (!def.scopes.includes(scope)) return void 0;
|
|
32718
|
+
const raw2 = getAtPath(readConfigObject(scope, options), def.key);
|
|
32719
|
+
return raw2 === void 0 ? void 0 : def.parse(raw2);
|
|
32720
|
+
}
|
|
32721
|
+
function getConfigValue(def, options = {}) {
|
|
32722
|
+
const local = readScopeValue(def, "project", options);
|
|
32723
|
+
const global = readScopeValue(def, "global", options);
|
|
32724
|
+
const merged = applyMergePolicy(def.merge, local, global);
|
|
32725
|
+
return merged ?? def.default;
|
|
32726
|
+
}
|
|
32727
|
+
function getConfigValueByKey(key, options = {}, registry2 = CONFIG_SCHEMA) {
|
|
32728
|
+
const def = requireDefinition(key, registry2);
|
|
32729
|
+
return getConfigValue(def, options);
|
|
32730
|
+
}
|
|
32731
|
+
function requireDefinition(key, registry2 = CONFIG_SCHEMA) {
|
|
32732
|
+
const def = getConfigDefinition(key, registry2);
|
|
32733
|
+
if (!def) {
|
|
32734
|
+
throw new UnknownConfigKeyError(key);
|
|
32735
|
+
}
|
|
32736
|
+
return def;
|
|
32737
|
+
}
|
|
32738
|
+
var UnknownConfigKeyError = class extends Error {
|
|
32739
|
+
constructor(key) {
|
|
32740
|
+
super(`Unknown configuration key "${key}".`);
|
|
32741
|
+
this.key = key;
|
|
32742
|
+
this.name = "UnknownConfigKeyError";
|
|
32743
|
+
}
|
|
32744
|
+
key;
|
|
32745
|
+
};
|
|
32746
|
+
|
|
32747
|
+
// ../argent-tools-client/src/launcher.ts
|
|
32748
|
+
var STATE_DIR = argentHomeDir();
|
|
32749
|
+
var STATE_FILE = path7.join(STATE_DIR, "tool-server.json");
|
|
32750
|
+
var LOG_FILE = path7.join(STATE_DIR, "tool-server.log");
|
|
32751
|
+
var LOCK_FILE = path7.join(STATE_DIR, "tool-server.lock");
|
|
32112
32752
|
var AUTH_TOKEN_BYTES = 32;
|
|
32113
32753
|
var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
|
|
32114
32754
|
var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
|
|
@@ -32125,6 +32765,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
|
32125
32765
|
env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
|
|
32126
32766
|
}
|
|
32127
32767
|
env[AUTH_TOKEN_ENV] = options.token ?? "";
|
|
32768
|
+
env.ARGENT_SERVER_MANAGED = options.managed ?? "autospawn";
|
|
32128
32769
|
if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
|
|
32129
32770
|
if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
|
|
32130
32771
|
return env;
|
|
@@ -32133,7 +32774,7 @@ function generateToken() {
|
|
|
32133
32774
|
return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
|
|
32134
32775
|
}
|
|
32135
32776
|
function findFreePort() {
|
|
32136
|
-
return new Promise((
|
|
32777
|
+
return new Promise((resolve13, reject) => {
|
|
32137
32778
|
const srv = net.createServer();
|
|
32138
32779
|
srv.listen(0, "127.0.0.1", () => {
|
|
32139
32780
|
const addr = srv.address();
|
|
@@ -32144,7 +32785,7 @@ function findFreePort() {
|
|
|
32144
32785
|
const port = addr.port;
|
|
32145
32786
|
srv.close((err) => {
|
|
32146
32787
|
if (err) reject(err);
|
|
32147
|
-
else
|
|
32788
|
+
else resolve13(port);
|
|
32148
32789
|
});
|
|
32149
32790
|
});
|
|
32150
32791
|
srv.on("error", reject);
|
|
@@ -32186,7 +32827,7 @@ function isVersionNewer(a, b) {
|
|
|
32186
32827
|
function readBundlePackageVersion(bundlePath) {
|
|
32187
32828
|
try {
|
|
32188
32829
|
const pkg = JSON.parse(
|
|
32189
|
-
|
|
32830
|
+
fs6.readFileSync(path7.join(path7.dirname(bundlePath), "..", "package.json"), "utf8")
|
|
32190
32831
|
);
|
|
32191
32832
|
return typeof pkg.version === "string" ? pkg.version : void 0;
|
|
32192
32833
|
} catch {
|
|
@@ -32243,16 +32884,20 @@ function killSpawnedChild(child, pid) {
|
|
|
32243
32884
|
}
|
|
32244
32885
|
function resolveToolsServerNode() {
|
|
32245
32886
|
const { bun, deno, electron } = process.versions;
|
|
32246
|
-
return !(bun || deno || electron) &&
|
|
32887
|
+
return !(bun || deno || electron) && fs6.existsSync(process.execPath) ? process.execPath : "node";
|
|
32888
|
+
}
|
|
32889
|
+
function parseListeningPort(line) {
|
|
32890
|
+
const match = line.match(/Tools server listening on http:\/\/.+:(\d+)/);
|
|
32891
|
+
return match ? parseInt(match[1], 10) : null;
|
|
32247
32892
|
}
|
|
32248
32893
|
function spawnToolsServer(paths, port, options = {}) {
|
|
32249
|
-
return new Promise((
|
|
32894
|
+
return new Promise((resolve13, reject) => {
|
|
32250
32895
|
let logFd;
|
|
32251
32896
|
try {
|
|
32252
|
-
|
|
32253
|
-
logFd =
|
|
32897
|
+
fs6.mkdirSync(STATE_DIR, { recursive: true });
|
|
32898
|
+
logFd = fs6.openSync(LOG_FILE, "a");
|
|
32254
32899
|
} catch {
|
|
32255
|
-
logFd =
|
|
32900
|
+
logFd = fs6.openSync("/dev/null", "w");
|
|
32256
32901
|
}
|
|
32257
32902
|
const nodeBin = resolveToolsServerNode();
|
|
32258
32903
|
const child = spawn(nodeBin, [paths.bundlePath, "start"], {
|
|
@@ -32260,8 +32905,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
32260
32905
|
stdio: ["ignore", "pipe", logFd],
|
|
32261
32906
|
env: buildToolsServerEnv(paths, port, process.env, options)
|
|
32262
32907
|
});
|
|
32263
|
-
|
|
32264
|
-
child.unref();
|
|
32908
|
+
fs6.closeSync(logFd);
|
|
32265
32909
|
const pid = child.pid;
|
|
32266
32910
|
if (!pid) {
|
|
32267
32911
|
child.once(
|
|
@@ -32286,13 +32930,13 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
32286
32930
|
});
|
|
32287
32931
|
const rl = readline.createInterface({ input: child.stdout });
|
|
32288
32932
|
rl.on("line", (line) => {
|
|
32289
|
-
const
|
|
32290
|
-
if (
|
|
32291
|
-
const actualPort = parseInt(match[1], 10);
|
|
32933
|
+
const actualPort = parseListeningPort(line);
|
|
32934
|
+
if (actualPort !== null) {
|
|
32292
32935
|
rl.close();
|
|
32293
32936
|
child.stdout?.resume();
|
|
32294
32937
|
child.stdout?.unref?.();
|
|
32295
|
-
|
|
32938
|
+
child.unref();
|
|
32939
|
+
settle2(() => resolve13({ port: actualPort, pid }));
|
|
32296
32940
|
}
|
|
32297
32941
|
});
|
|
32298
32942
|
child.on("error", (err) => {
|
|
@@ -32312,7 +32956,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
32312
32956
|
}
|
|
32313
32957
|
function stateFileForBundle(bundlePath) {
|
|
32314
32958
|
const key = createHash("sha256").update(bundlePath).digest("hex").slice(0, 12);
|
|
32315
|
-
return
|
|
32959
|
+
return path7.join(STATE_DIR, `tool-server-${key}.json`);
|
|
32316
32960
|
}
|
|
32317
32961
|
async function readStateFile(file) {
|
|
32318
32962
|
try {
|
|
@@ -32371,7 +33015,7 @@ async function readAllToolsServerStates() {
|
|
|
32371
33015
|
const out = [];
|
|
32372
33016
|
for (const name of names) {
|
|
32373
33017
|
if (!STATE_FILE_RE.test(name)) continue;
|
|
32374
|
-
const file =
|
|
33018
|
+
const file = path7.join(STATE_DIR, name);
|
|
32375
33019
|
const state = await readStateFile(file);
|
|
32376
33020
|
if (state) out.push({ file, state });
|
|
32377
33021
|
}
|
|
@@ -32387,7 +33031,7 @@ async function sweepDeadStateFiles() {
|
|
|
32387
33031
|
});
|
|
32388
33032
|
continue;
|
|
32389
33033
|
}
|
|
32390
|
-
if (
|
|
33034
|
+
if (fs6.existsSync(fresh.bundlePath)) continue;
|
|
32391
33035
|
if (!couldBeOurToolServer(fresh.pid, fresh.bundlePath)) continue;
|
|
32392
33036
|
await unlink(file).catch(() => {
|
|
32393
33037
|
});
|
|
@@ -32424,7 +33068,7 @@ async function terminatePid(pid, stillOurs) {
|
|
|
32424
33068
|
}
|
|
32425
33069
|
await waitForExit(pid, SIGKILL_GRACE_MS);
|
|
32426
33070
|
}
|
|
32427
|
-
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) =>
|
|
33071
|
+
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs6.existsSync(p)) ?? "ps";
|
|
32428
33072
|
var PS_WIDTH_FLAGS = ["-ww"];
|
|
32429
33073
|
var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
32430
33074
|
function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
|
|
@@ -32453,761 +33097,145 @@ function couldBeOurToolServer(pid, marker) {
|
|
|
32453
33097
|
if (ours.test(readProcessCommandLine(pid, PS_WIDTH_FLAGS, env))) return true;
|
|
32454
33098
|
failure2 = void 0;
|
|
32455
33099
|
if (!nonAscii) break;
|
|
32456
|
-
} catch (err) {
|
|
32457
|
-
failure2 = String(err);
|
|
32458
|
-
if (err.code === "ETIMEDOUT") break;
|
|
32459
|
-
}
|
|
32460
|
-
}
|
|
32461
|
-
if (failure2 !== void 0) {
|
|
32462
|
-
process.stderr.write(
|
|
32463
|
-
`[launcher] ps could not read pid ${pid}'s command line; leaving it alone: ${failure2}
|
|
32464
|
-
`
|
|
32465
|
-
);
|
|
32466
|
-
}
|
|
32467
|
-
return false;
|
|
32468
|
-
}
|
|
32469
|
-
var LOCK_WAIT_TIMEOUT_MS = 3e4;
|
|
32470
|
-
var LOCK_STALE_MS = 45e3;
|
|
32471
|
-
var LOCK_POLL_MS = 100;
|
|
32472
|
-
function spawnLockIsStale() {
|
|
32473
|
-
try {
|
|
32474
|
-
const { pid, ts } = JSON.parse(fs.readFileSync(LOCK_FILE, "utf8"));
|
|
32475
|
-
if (typeof pid === "number" && pid > 0 && !isProcessAlive(pid)) return true;
|
|
32476
|
-
if (typeof ts === "number" && Date.now() - ts > LOCK_STALE_MS) return true;
|
|
32477
|
-
return false;
|
|
32478
|
-
} catch {
|
|
32479
|
-
try {
|
|
32480
|
-
return Date.now() - fs.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS;
|
|
32481
|
-
} catch {
|
|
32482
|
-
return true;
|
|
32483
|
-
}
|
|
32484
|
-
}
|
|
32485
|
-
}
|
|
32486
|
-
async function acquireSpawnLock() {
|
|
32487
|
-
try {
|
|
32488
|
-
fs.mkdirSync(STATE_DIR, { recursive: true });
|
|
32489
|
-
} catch {
|
|
32490
|
-
return null;
|
|
32491
|
-
}
|
|
32492
|
-
const nonce = randomBytes(8).toString("hex");
|
|
32493
|
-
const deadline = Date.now() + LOCK_WAIT_TIMEOUT_MS;
|
|
32494
|
-
for (; ; ) {
|
|
32495
|
-
try {
|
|
32496
|
-
const fd = fs.openSync(LOCK_FILE, "wx");
|
|
32497
|
-
try {
|
|
32498
|
-
fs.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
|
|
32499
|
-
} finally {
|
|
32500
|
-
fs.closeSync(fd);
|
|
32501
|
-
}
|
|
32502
|
-
let released = false;
|
|
32503
|
-
return {
|
|
32504
|
-
release: () => {
|
|
32505
|
-
if (released) return;
|
|
32506
|
-
released = true;
|
|
32507
|
-
try {
|
|
32508
|
-
const cur = JSON.parse(fs.readFileSync(LOCK_FILE, "utf8"));
|
|
32509
|
-
if (cur.pid === process.pid && cur.nonce === nonce) fs.unlinkSync(LOCK_FILE);
|
|
32510
|
-
} catch {
|
|
32511
|
-
}
|
|
32512
|
-
}
|
|
32513
|
-
};
|
|
32514
|
-
} catch (err) {
|
|
32515
|
-
if (err.code !== "EEXIST") return null;
|
|
32516
|
-
if (spawnLockIsStale()) {
|
|
32517
|
-
try {
|
|
32518
|
-
fs.unlinkSync(LOCK_FILE);
|
|
32519
|
-
} catch {
|
|
32520
|
-
}
|
|
32521
|
-
if (!fs.existsSync(LOCK_FILE)) continue;
|
|
32522
|
-
}
|
|
32523
|
-
if (Date.now() >= deadline) return null;
|
|
32524
|
-
await new Promise((r) => setTimeout(r, LOCK_POLL_MS));
|
|
32525
|
-
}
|
|
32526
|
-
}
|
|
32527
|
-
}
|
|
32528
|
-
async function reusableHandle(state, wantBundlePath, wantVersion) {
|
|
32529
|
-
if (!state || !isProcessAlive(state.pid)) return null;
|
|
32530
|
-
if (wantBundlePath !== void 0 && state.bundlePath !== wantBundlePath) return null;
|
|
32531
|
-
if (wantBundlePath !== void 0 && state.version !== void 0) {
|
|
32532
|
-
const diskVersion = readBundlePackageVersion(wantBundlePath);
|
|
32533
|
-
if (diskVersion !== void 0) {
|
|
32534
|
-
if (diskVersion !== state.version) return null;
|
|
32535
|
-
} else if (wantVersion !== void 0 && state.version !== wantVersion && isVersionNewer(wantVersion, state.version)) {
|
|
32536
|
-
return null;
|
|
32537
|
-
}
|
|
32538
|
-
}
|
|
32539
|
-
const host = state.host ?? "127.0.0.1";
|
|
32540
|
-
const healthy = await isToolsServerHealthy(state.port, host, 2e3, state.token);
|
|
32541
|
-
if (!healthy) return null;
|
|
32542
|
-
return { url: formatUrl(healthCheckHost(host), state.port), token: state.token ?? "" };
|
|
32543
|
-
}
|
|
32544
|
-
async function ensureToolsServer(paths) {
|
|
32545
|
-
const fast = await reusableHandle(
|
|
32546
|
-
await readState(paths.bundlePath),
|
|
32547
|
-
paths.bundlePath,
|
|
32548
|
-
paths.version
|
|
32549
|
-
);
|
|
32550
|
-
if (fast) return fast;
|
|
32551
|
-
const lock = await acquireSpawnLock();
|
|
32552
|
-
try {
|
|
32553
|
-
const state = await readState(paths.bundlePath);
|
|
32554
|
-
const reuse = await reusableHandle(state, paths.bundlePath, paths.version);
|
|
32555
|
-
if (reuse) return reuse;
|
|
32556
|
-
if (state && state.managed === "autospawn" && state.bundlePath === paths.bundlePath && isProcessAlive(state.pid) && couldBeOurToolServer(state.pid, state.bundlePath)) {
|
|
32557
|
-
await terminatePid(state.pid, () => couldBeOurToolServer(state.pid, state.bundlePath));
|
|
32558
|
-
}
|
|
32559
|
-
await clearToolsServerState(paths.bundlePath);
|
|
32560
|
-
await sweepDeadStateFiles();
|
|
32561
|
-
if (!fs.existsSync(paths.bundlePath)) {
|
|
32562
|
-
throw new Error(
|
|
32563
|
-
`The argent install serving this session is gone from disk (${paths.bundlePath}) \u2014 it was likely updated or removed. Restart the editor's MCP connection to reconnect.`
|
|
32564
|
-
);
|
|
32565
|
-
}
|
|
32566
|
-
const diskVersion = readBundlePackageVersion(paths.bundlePath) ?? paths.version;
|
|
32567
|
-
const token = generateToken();
|
|
32568
|
-
const port = await findFreePort();
|
|
32569
|
-
const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
|
|
32570
|
-
token,
|
|
32571
|
-
host: AUTOSPAWN_HOST,
|
|
32572
|
-
idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES
|
|
32573
|
-
});
|
|
32574
|
-
await writeState({
|
|
32575
|
-
port: actualPort,
|
|
32576
|
-
pid,
|
|
32577
|
-
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
32578
|
-
bundlePath: paths.bundlePath,
|
|
32579
|
-
version: diskVersion,
|
|
32580
|
-
host: AUTOSPAWN_HOST,
|
|
32581
|
-
token,
|
|
32582
|
-
managed: "autospawn"
|
|
32583
|
-
});
|
|
32584
|
-
return { url: formatUrl(AUTOSPAWN_HOST, actualPort), token };
|
|
32585
|
-
} finally {
|
|
32586
|
-
lock?.release();
|
|
32587
|
-
}
|
|
32588
|
-
}
|
|
32589
|
-
|
|
32590
|
-
// ../argent-tools-client/src/tools-client.ts
|
|
32591
|
-
var import_yaml2 = __toESM(require_dist2(), 1);
|
|
32592
|
-
import { readFile as readFile5 } from "node:fs/promises";
|
|
32593
|
-
import { maxHeaderSize } from "node:http";
|
|
32594
|
-
import * as path12 from "node:path";
|
|
32595
|
-
|
|
32596
|
-
// ../configuration-core/src/flags.ts
|
|
32597
|
-
import * as fs2 from "node:fs";
|
|
32598
|
-
import * as path2 from "node:path";
|
|
32599
|
-
import { homedir as homedir2 } from "node:os";
|
|
32600
|
-
var FLAG_REGISTRY = [
|
|
32601
|
-
{
|
|
32602
|
-
name: "disable-auto-screenshot",
|
|
32603
|
-
description: "Disable the automatic screenshot captured after interaction tools."
|
|
32604
|
-
},
|
|
32605
|
-
{
|
|
32606
|
-
name: "disable-auto-describe",
|
|
32607
|
-
description: "Disable the accessibility element tree appended after interaction tools."
|
|
32608
|
-
},
|
|
32609
|
-
{
|
|
32610
|
-
name: "argent-lens",
|
|
32611
|
-
description: "Argent Lens \u2014 the propose_variant / await_user_selection tools and the Electron preview window for staging UI design variants and letting a human pick among them. Off by default while the feature is in development."
|
|
32612
|
-
},
|
|
32613
|
-
{
|
|
32614
|
-
name: "artifacts-list-endpoint",
|
|
32615
|
-
description: "Expose GET /artifacts for remote artifact inventory consumers."
|
|
32616
|
-
},
|
|
32617
|
-
{
|
|
32618
|
-
name: "tool-server-event-log",
|
|
32619
|
-
description: "Write structured tool-server lifecycle events to a JSONL file."
|
|
32620
|
-
},
|
|
32621
|
-
{
|
|
32622
|
-
name: "boot-sound",
|
|
32623
|
-
description: "Default boot-device's `sound` argument to true so Android emulators boot with audio output instead of muted. Only the argument's default changes \u2014 an explicit `sound: false` on a call still boots muted."
|
|
32624
|
-
},
|
|
32625
|
-
{
|
|
32626
|
-
name: "microinteractions",
|
|
32627
|
-
description: "Amplify device actions with matching animations of the host window, so what happens on the guest is also visible on the desktop. Purely cosmetic, macOS only, and never affects whether the underlying action succeeds. Off by default."
|
|
32628
|
-
},
|
|
32629
|
-
{
|
|
32630
|
-
name: "harmonyos",
|
|
32631
|
-
description: "HarmonyOS support: list, boot and drive HarmonyOS phones and DevEco Studio emulators over `hdc`. Off by default while the platform is experimental."
|
|
32632
|
-
},
|
|
32633
|
-
{
|
|
32634
|
-
name: "forward-secrets",
|
|
32635
|
-
description: "Over `argent link` or ARGENT_TOOLS_URL, resolve each `{{secret:NAME}}` a call names on this machine and send the value with the call, so a remote tool-server can type a secret it does not hold. The linked tool-server then receives every secret of this machine that a call names, so link only one you trust with all of them. Values go only over https:// with the certificate checked, or to a loopback address. Off by default."
|
|
32636
|
-
},
|
|
32637
|
-
{
|
|
32638
|
-
name: "ios-audio-always-inserted",
|
|
32639
|
-
description: "Insert the iOS audio hook (libArgentAudio.dylib) into every app an armed simulator launches, so audio-input works without restart-app. Dormant until the app opens audio. On by default; `argent disable ios-audio-always-inserted` inserts it only on the first audio tool call, for apps launched after that call.",
|
|
32640
|
-
defaultEnabled: true
|
|
32641
|
-
},
|
|
32642
|
-
{
|
|
32643
|
-
name: "video-watermark",
|
|
32644
|
-
description: "Overlay the argent corner watermark on recorded screen videos. On by default; turn it off with `argent disable video-watermark`.",
|
|
32645
|
-
defaultEnabled: true
|
|
32646
|
-
},
|
|
32647
|
-
{
|
|
32648
|
-
name: "whats-new",
|
|
32649
|
-
description: "After an update, tell the agent the highlights of the new Argent version on its first tool call. On by default; turn it off with `argent disable whats-new`.",
|
|
32650
|
-
defaultEnabled: true
|
|
32651
|
-
},
|
|
32652
|
-
{
|
|
32653
|
-
name: "macos-apps",
|
|
32654
|
-
description: "Control native Mac apps, including Mac Catalyst. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. On by default; turn it off with `argent disable macos-apps`.",
|
|
32655
|
-
defaultEnabled: true
|
|
32656
|
-
}
|
|
32657
|
-
];
|
|
32658
|
-
function getFlagDefinition(name, registry2 = FLAG_REGISTRY) {
|
|
32659
|
-
return registry2.find((def) => def.name === name);
|
|
32660
|
-
}
|
|
32661
|
-
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
32662
|
-
function findProjectRoot(startDir) {
|
|
32663
|
-
let current = path2.resolve(startDir);
|
|
32664
|
-
while (true) {
|
|
32665
|
-
for (const marker of PROJECT_MARKERS) {
|
|
32666
|
-
if (fs2.existsSync(path2.join(current, marker))) return current;
|
|
32667
|
-
}
|
|
32668
|
-
const parent = path2.dirname(current);
|
|
32669
|
-
if (parent === current) return null;
|
|
32670
|
-
current = parent;
|
|
32671
|
-
}
|
|
32672
|
-
}
|
|
32673
|
-
function resolveProjectRoot(startDir) {
|
|
32674
|
-
return findProjectRoot(startDir) ?? path2.resolve(startDir);
|
|
32675
|
-
}
|
|
32676
|
-
function getFlagsPath(scope, options = {}) {
|
|
32677
|
-
const home = options.homeDir ?? homedir2();
|
|
32678
|
-
if (scope === "global") {
|
|
32679
|
-
return path2.join(home, ".argent", "flags.json");
|
|
32680
|
-
}
|
|
32681
|
-
const cwd = options.cwd ?? process.cwd();
|
|
32682
|
-
return path2.join(resolveProjectRoot(cwd), ".argent", "flags.json");
|
|
32683
|
-
}
|
|
32684
|
-
function readFlagsFile(filePath) {
|
|
32685
|
-
let raw2;
|
|
32686
|
-
try {
|
|
32687
|
-
raw2 = fs2.readFileSync(filePath, "utf8");
|
|
32688
|
-
} catch {
|
|
32689
|
-
return {};
|
|
32690
|
-
}
|
|
32691
|
-
let parsed;
|
|
32692
|
-
try {
|
|
32693
|
-
parsed = JSON.parse(raw2);
|
|
32694
|
-
} catch {
|
|
32695
|
-
return {};
|
|
32696
|
-
}
|
|
32697
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
32698
|
-
const flags = parsed.flags;
|
|
32699
|
-
if (!flags || typeof flags !== "object" || Array.isArray(flags)) return {};
|
|
32700
|
-
const out = {};
|
|
32701
|
-
for (const [k, v] of Object.entries(flags)) {
|
|
32702
|
-
if (typeof v === "boolean") out[k] = v;
|
|
32703
|
-
}
|
|
32704
|
-
return out;
|
|
32705
|
-
}
|
|
32706
|
-
function readFlags(scope, options = {}) {
|
|
32707
|
-
return readFlagsFile(getFlagsPath(scope, options));
|
|
32708
|
-
}
|
|
32709
|
-
function isFlagEnabled(name, options = {}) {
|
|
32710
|
-
const projectFlags = readFlags("project", options);
|
|
32711
|
-
if (Object.hasOwn(projectFlags, name)) return projectFlags[name];
|
|
32712
|
-
const globalFlags = readFlags("global", options);
|
|
32713
|
-
if (Object.hasOwn(globalFlags, name)) return globalFlags[name];
|
|
32714
|
-
return options.default ?? false;
|
|
32715
|
-
}
|
|
32716
|
-
function isFeatureEnabled(name, options = {}, registry2 = FLAG_REGISTRY) {
|
|
32717
|
-
return isFlagEnabled(name, {
|
|
32718
|
-
...options,
|
|
32719
|
-
default: getFlagDefinition(name, registry2)?.defaultEnabled ?? false
|
|
32720
|
-
});
|
|
32721
|
-
}
|
|
32722
|
-
|
|
32723
|
-
// ../configuration-core/src/paths.ts
|
|
32724
|
-
import * as fs3 from "node:fs";
|
|
32725
|
-
import * as os from "node:os";
|
|
32726
|
-
import * as path3 from "node:path";
|
|
32727
|
-
function nonEmpty(value) {
|
|
32728
|
-
if (value == void 0) return null;
|
|
32729
|
-
const trimmed = value.trim();
|
|
32730
|
-
return trimmed === "" ? null : value;
|
|
32731
|
-
}
|
|
32732
|
-
function resolveHomeDir(options = {}) {
|
|
32733
|
-
if (options.homeDir) return options.homeDir;
|
|
32734
|
-
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
32735
|
-
}
|
|
32736
|
-
function isHomeDir(dir, options = {}) {
|
|
32737
|
-
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
32738
|
-
}
|
|
32739
|
-
function canonicalPath(p) {
|
|
32740
|
-
try {
|
|
32741
|
-
return fs3.realpathSync.native(p);
|
|
32742
|
-
} catch {
|
|
32743
|
-
return path3.resolve(p);
|
|
32744
|
-
}
|
|
32745
|
-
}
|
|
32746
|
-
function argentHomeDir() {
|
|
32747
|
-
return path3.join(resolveHomeDir(), ".argent");
|
|
32748
|
-
}
|
|
32749
|
-
function configDir(scope = "global", options = {}) {
|
|
32750
|
-
if (scope === "global") {
|
|
32751
|
-
return path3.join(resolveHomeDir(options), ".argent");
|
|
32752
|
-
}
|
|
32753
|
-
const cwd = options.cwd ?? process.cwd();
|
|
32754
|
-
return path3.join(resolveProjectRoot(cwd), ".argent");
|
|
32755
|
-
}
|
|
32756
|
-
function configFilePath(scope = "global", options = {}) {
|
|
32757
|
-
return path3.join(configDir(scope, options), "config.json");
|
|
32758
|
-
}
|
|
32759
|
-
|
|
32760
|
-
// ../configuration-core/src/config.ts
|
|
32761
|
-
import * as crypto from "node:crypto";
|
|
32762
|
-
import * as fs4 from "node:fs";
|
|
32763
|
-
import * as path4 from "node:path";
|
|
32764
|
-
function readConfigObject(scope = "global", options = {}) {
|
|
32765
|
-
try {
|
|
32766
|
-
const raw2 = fs4.readFileSync(configFilePath(scope, options), "utf8");
|
|
32767
|
-
const json = JSON.parse(raw2);
|
|
32768
|
-
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
32769
|
-
return json;
|
|
32770
|
-
}
|
|
32771
|
-
} catch {
|
|
32772
|
-
}
|
|
32773
|
-
return {};
|
|
32774
|
-
}
|
|
32775
|
-
var FORBIDDEN_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
32776
|
-
function splitKey(dottedKey) {
|
|
32777
|
-
const parts = dottedKey.split(".");
|
|
32778
|
-
if (parts.length === 0 || parts.some((p) => p === "")) {
|
|
32779
|
-
throw new Error(`Invalid config key "${dottedKey}": empty path segment`);
|
|
32780
|
-
}
|
|
32781
|
-
for (const p of parts) {
|
|
32782
|
-
if (FORBIDDEN_SEGMENTS.has(p)) {
|
|
32783
|
-
throw new Error(`Invalid config key "${dottedKey}": forbidden segment "${p}"`);
|
|
32784
|
-
}
|
|
32785
|
-
}
|
|
32786
|
-
return parts;
|
|
32787
|
-
}
|
|
32788
|
-
function isPlainObject3(value) {
|
|
32789
|
-
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
32790
|
-
}
|
|
32791
|
-
function getAtPath(obj, dottedKey) {
|
|
32792
|
-
const parts = splitKey(dottedKey);
|
|
32793
|
-
let cur = obj;
|
|
32794
|
-
for (const part of parts) {
|
|
32795
|
-
if (!isPlainObject3(cur)) return void 0;
|
|
32796
|
-
cur = cur[part];
|
|
32797
|
-
}
|
|
32798
|
-
return cur;
|
|
32799
|
-
}
|
|
32800
|
-
function setAtPath(obj, dottedKey, value) {
|
|
32801
|
-
const parts = splitKey(dottedKey);
|
|
32802
|
-
let cur = obj;
|
|
32803
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
32804
|
-
const part = parts[i];
|
|
32805
|
-
const next = cur[part];
|
|
32806
|
-
if (!isPlainObject3(next)) {
|
|
32807
|
-
cur[part] = {};
|
|
32808
|
-
}
|
|
32809
|
-
cur = cur[part];
|
|
32810
|
-
}
|
|
32811
|
-
cur[parts[parts.length - 1]] = value;
|
|
32812
|
-
}
|
|
32813
|
-
var LOCK_STALE_MS2 = 1e4;
|
|
32814
|
-
var LOCK_MAX_WAIT_MS = 2e3;
|
|
32815
|
-
var LOCK_RETRY_MS = 25;
|
|
32816
|
-
function sleepSync(ms) {
|
|
32817
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
32818
|
-
}
|
|
32819
|
-
function acquireConfigLock(finalPath) {
|
|
32820
|
-
const lockPath = finalPath + ".lock";
|
|
32821
|
-
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
32822
|
-
for (; ; ) {
|
|
32823
|
-
try {
|
|
32824
|
-
const fd = fs4.openSync(lockPath, "wx", 384);
|
|
32825
|
-
try {
|
|
32826
|
-
fs4.writeSync(fd, `${process.pid}
|
|
32827
|
-
`);
|
|
32828
|
-
} catch {
|
|
32829
|
-
}
|
|
32830
|
-
return { fd, lockPath };
|
|
32831
|
-
} catch (err) {
|
|
32832
|
-
if (err.code !== "EEXIST") return null;
|
|
32833
|
-
try {
|
|
32834
|
-
if (Date.now() - fs4.statSync(lockPath).mtimeMs > LOCK_STALE_MS2) {
|
|
32835
|
-
fs4.unlinkSync(lockPath);
|
|
32836
|
-
continue;
|
|
32837
|
-
}
|
|
32838
|
-
} catch {
|
|
32839
|
-
}
|
|
32840
|
-
if (Date.now() >= deadline) return null;
|
|
32841
|
-
sleepSync(LOCK_RETRY_MS);
|
|
33100
|
+
} catch (err) {
|
|
33101
|
+
failure2 = String(err);
|
|
33102
|
+
if (err.code === "ETIMEDOUT") break;
|
|
32842
33103
|
}
|
|
32843
33104
|
}
|
|
33105
|
+
if (failure2 !== void 0) {
|
|
33106
|
+
process.stderr.write(
|
|
33107
|
+
`[launcher] ps could not read pid ${pid}'s command line; leaving it alone: ${failure2}
|
|
33108
|
+
`
|
|
33109
|
+
);
|
|
33110
|
+
}
|
|
33111
|
+
return false;
|
|
32844
33112
|
}
|
|
32845
|
-
|
|
33113
|
+
var LOCK_WAIT_TIMEOUT_MS = 3e4;
|
|
33114
|
+
var LOCK_STALE_MS2 = 45e3;
|
|
33115
|
+
var LOCK_POLL_MS = 100;
|
|
33116
|
+
function spawnLockIsStale() {
|
|
32846
33117
|
try {
|
|
32847
|
-
|
|
33118
|
+
const { pid, ts } = JSON.parse(fs6.readFileSync(LOCK_FILE, "utf8"));
|
|
33119
|
+
if (typeof pid === "number" && pid > 0 && !isProcessAlive(pid)) return true;
|
|
33120
|
+
if (typeof ts === "number" && Date.now() - ts > LOCK_STALE_MS2) return true;
|
|
33121
|
+
return false;
|
|
32848
33122
|
} catch {
|
|
33123
|
+
try {
|
|
33124
|
+
return Date.now() - fs6.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS2;
|
|
33125
|
+
} catch {
|
|
33126
|
+
return true;
|
|
33127
|
+
}
|
|
32849
33128
|
}
|
|
33129
|
+
}
|
|
33130
|
+
async function acquireSpawnLock() {
|
|
32850
33131
|
try {
|
|
32851
|
-
|
|
33132
|
+
fs6.mkdirSync(STATE_DIR, { recursive: true });
|
|
32852
33133
|
} catch {
|
|
33134
|
+
return null;
|
|
32853
33135
|
}
|
|
32854
|
-
|
|
32855
|
-
|
|
32856
|
-
|
|
32857
|
-
fs4.mkdirSync(dir, { recursive: true });
|
|
32858
|
-
const finalPath = configFilePath(scope, options);
|
|
32859
|
-
const lock = acquireConfigLock(finalPath);
|
|
32860
|
-
try {
|
|
32861
|
-
const next = readConfigObject(scope, options);
|
|
32862
|
-
mutate(next);
|
|
32863
|
-
const tmpPath = path4.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
32864
|
-
const fd = fs4.openSync(tmpPath, "wx", 384);
|
|
32865
|
-
try {
|
|
32866
|
-
fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
32867
|
-
fs4.fsyncSync(fd);
|
|
32868
|
-
} finally {
|
|
32869
|
-
fs4.closeSync(fd);
|
|
32870
|
-
}
|
|
33136
|
+
const nonce = randomBytes(8).toString("hex");
|
|
33137
|
+
const deadline = Date.now() + LOCK_WAIT_TIMEOUT_MS;
|
|
33138
|
+
for (; ; ) {
|
|
32871
33139
|
try {
|
|
32872
|
-
|
|
32873
|
-
} catch (err) {
|
|
33140
|
+
const fd = fs6.openSync(LOCK_FILE, "wx");
|
|
32874
33141
|
try {
|
|
32875
|
-
|
|
32876
|
-
}
|
|
33142
|
+
fs6.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
|
|
33143
|
+
} finally {
|
|
33144
|
+
fs6.closeSync(fd);
|
|
32877
33145
|
}
|
|
32878
|
-
|
|
33146
|
+
let released = false;
|
|
33147
|
+
return {
|
|
33148
|
+
release: () => {
|
|
33149
|
+
if (released) return;
|
|
33150
|
+
released = true;
|
|
33151
|
+
try {
|
|
33152
|
+
const cur = JSON.parse(fs6.readFileSync(LOCK_FILE, "utf8"));
|
|
33153
|
+
if (cur.pid === process.pid && cur.nonce === nonce) fs6.unlinkSync(LOCK_FILE);
|
|
33154
|
+
} catch {
|
|
33155
|
+
}
|
|
33156
|
+
}
|
|
33157
|
+
};
|
|
33158
|
+
} catch (err) {
|
|
33159
|
+
if (err.code !== "EEXIST") return null;
|
|
33160
|
+
if (spawnLockIsStale()) {
|
|
33161
|
+
try {
|
|
33162
|
+
fs6.unlinkSync(LOCK_FILE);
|
|
33163
|
+
} catch {
|
|
33164
|
+
}
|
|
33165
|
+
if (!fs6.existsSync(LOCK_FILE)) continue;
|
|
33166
|
+
}
|
|
33167
|
+
if (Date.now() >= deadline) return null;
|
|
33168
|
+
await new Promise((r) => setTimeout(r, LOCK_POLL_MS));
|
|
32879
33169
|
}
|
|
32880
|
-
} finally {
|
|
32881
|
-
if (lock) releaseConfigLock(lock);
|
|
32882
|
-
}
|
|
32883
|
-
}
|
|
32884
|
-
|
|
32885
|
-
// ../configuration-core/src/whats-new.ts
|
|
32886
|
-
var WHATS_NEW_SEEN_KEY = "notices.whats_new_seen";
|
|
32887
|
-
function getWhatsNewSeenVersion(options = {}) {
|
|
32888
|
-
const value = getAtPath(readConfigObject("global", options), WHATS_NEW_SEEN_KEY);
|
|
32889
|
-
return typeof value === "string" ? value : null;
|
|
32890
|
-
}
|
|
32891
|
-
function setWhatsNewSeenVersion(version2, options = {}) {
|
|
32892
|
-
updateConfig((config2) => setAtPath(config2, WHATS_NEW_SEEN_KEY, version2), "global", options);
|
|
32893
|
-
}
|
|
32894
|
-
|
|
32895
|
-
// ../configuration-core/src/secrets.ts
|
|
32896
|
-
var import_dotenv = __toESM(require_dist3(), 1);
|
|
32897
|
-
import * as fs5 from "node:fs";
|
|
32898
|
-
import * as path5 from "node:path";
|
|
32899
|
-
var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
|
|
32900
|
-
var SECRETS_FILE_NAME = "secrets.env";
|
|
32901
|
-
var SHARED_ENV_FILES = [".env.local", ".env"];
|
|
32902
|
-
var SECRET_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
32903
|
-
function envSource(env) {
|
|
32904
|
-
const values = /* @__PURE__ */ new Map();
|
|
32905
|
-
for (const [key, value] of Object.entries(env)) {
|
|
32906
|
-
if (value === void 0 || !key.startsWith(SECRET_ENV_PREFIX)) continue;
|
|
32907
|
-
const name = key.slice(SECRET_ENV_PREFIX.length);
|
|
32908
|
-
if (SECRET_NAME_RE.test(name)) values.set(name, value);
|
|
32909
33170
|
}
|
|
32910
|
-
return {
|
|
32911
|
-
label: `environment (${SECRET_ENV_PREFIX}*)`,
|
|
32912
|
-
kind: "env",
|
|
32913
|
-
present: true,
|
|
32914
|
-
names: [...values.keys()].sort(),
|
|
32915
|
-
values
|
|
32916
|
-
};
|
|
32917
33171
|
}
|
|
32918
|
-
function
|
|
32919
|
-
|
|
32920
|
-
|
|
32921
|
-
|
|
32922
|
-
|
|
32923
|
-
|
|
32924
|
-
|
|
32925
|
-
|
|
32926
|
-
|
|
32927
|
-
if (!fs5.statSync(filePath, { throwIfNoEntry: false })) return absent;
|
|
32928
|
-
let content;
|
|
32929
|
-
try {
|
|
32930
|
-
content = fs5.readFileSync(filePath, "utf8");
|
|
32931
|
-
} catch {
|
|
32932
|
-
return absent;
|
|
32933
|
-
}
|
|
32934
|
-
const values = /* @__PURE__ */ new Map();
|
|
32935
|
-
let skippedUnprefixed = false;
|
|
32936
|
-
for (const [key, value] of Object.entries((0, import_dotenv.parse)(content))) {
|
|
32937
|
-
const prefixed = key.startsWith(SECRET_ENV_PREFIX);
|
|
32938
|
-
if (exposure === "shared" && !prefixed) {
|
|
32939
|
-
skippedUnprefixed = true;
|
|
32940
|
-
continue;
|
|
33172
|
+
async function reusableHandle(state, wantBundlePath, wantVersion) {
|
|
33173
|
+
if (!state || !isProcessAlive(state.pid)) return null;
|
|
33174
|
+
if (wantBundlePath !== void 0 && state.bundlePath !== wantBundlePath) return null;
|
|
33175
|
+
if (wantBundlePath !== void 0 && state.version !== void 0) {
|
|
33176
|
+
const diskVersion = readBundlePackageVersion(wantBundlePath);
|
|
33177
|
+
if (diskVersion !== void 0) {
|
|
33178
|
+
if (diskVersion !== state.version) return null;
|
|
33179
|
+
} else if (wantVersion !== void 0 && state.version !== wantVersion && isVersionNewer(wantVersion, state.version)) {
|
|
33180
|
+
return null;
|
|
32941
33181
|
}
|
|
32942
|
-
const name = prefixed ? key.slice(SECRET_ENV_PREFIX.length) : key;
|
|
32943
|
-
if (SECRET_NAME_RE.test(name)) values.set(name, value);
|
|
32944
33182
|
}
|
|
32945
|
-
|
|
32946
|
-
|
|
32947
|
-
|
|
32948
|
-
|
|
32949
|
-
names: [...values.keys()].sort(),
|
|
32950
|
-
values,
|
|
32951
|
-
...values.size === 0 && skippedUnprefixed ? { needsPrefix: true } : {}
|
|
32952
|
-
};
|
|
33183
|
+
const host = state.host ?? "127.0.0.1";
|
|
33184
|
+
const healthy = await isToolsServerHealthy(state.port, host, 2e3, state.token);
|
|
33185
|
+
if (!healthy) return null;
|
|
33186
|
+
return { url: formatUrl(healthCheckHost(host), state.port), token: state.token ?? "" };
|
|
32953
33187
|
}
|
|
32954
|
-
function
|
|
32955
|
-
const
|
|
32956
|
-
|
|
32957
|
-
|
|
32958
|
-
|
|
32959
|
-
|
|
32960
|
-
if (
|
|
32961
|
-
|
|
32962
|
-
|
|
32963
|
-
|
|
32964
|
-
|
|
32965
|
-
|
|
32966
|
-
|
|
33188
|
+
async function ensureToolsServer(paths) {
|
|
33189
|
+
const fast = await reusableHandle(
|
|
33190
|
+
await readState(paths.bundlePath),
|
|
33191
|
+
paths.bundlePath,
|
|
33192
|
+
paths.version
|
|
33193
|
+
);
|
|
33194
|
+
if (fast) return fast;
|
|
33195
|
+
const lock = await acquireSpawnLock();
|
|
33196
|
+
try {
|
|
33197
|
+
const state = await readState(paths.bundlePath);
|
|
33198
|
+
const reuse = await reusableHandle(state, paths.bundlePath, paths.version);
|
|
33199
|
+
if (reuse) return reuse;
|
|
33200
|
+
if (state && state.managed === "autospawn" && state.bundlePath === paths.bundlePath && isProcessAlive(state.pid) && couldBeOurToolServer(state.pid, state.bundlePath)) {
|
|
33201
|
+
await terminatePid(state.pid, () => couldBeOurToolServer(state.pid, state.bundlePath));
|
|
32967
33202
|
}
|
|
32968
|
-
|
|
32969
|
-
|
|
32970
|
-
|
|
32971
|
-
|
|
32972
|
-
|
|
32973
|
-
|
|
32974
|
-
for (const entry of filePaths) {
|
|
32975
|
-
const resolved = path5.resolve(entry.path);
|
|
32976
|
-
if (seen.has(resolved)) continue;
|
|
32977
|
-
seen.add(resolved);
|
|
32978
|
-
sources.push(fileSource(resolved, entry.exposure));
|
|
32979
|
-
}
|
|
32980
|
-
return sources;
|
|
32981
|
-
}
|
|
32982
|
-
function encodeClientSecrets(values) {
|
|
32983
|
-
return Buffer.from(JSON.stringify(Object.fromEntries(values)), "utf8").toString("base64");
|
|
32984
|
-
}
|
|
32985
|
-
function lookupSecret(name, sources) {
|
|
32986
|
-
for (const source of sources) {
|
|
32987
|
-
const value = source.values.get(name);
|
|
32988
|
-
if (value !== void 0) return value;
|
|
32989
|
-
}
|
|
32990
|
-
return void 0;
|
|
32991
|
-
}
|
|
32992
|
-
var SECRET_PLACEHOLDER_RE = /\{\{secret:([A-Za-z_][A-Za-z0-9_]*)\}\}/g;
|
|
32993
|
-
function placeholderNames(text) {
|
|
32994
|
-
return Array.from(text.matchAll(SECRET_PLACEHOLDER_RE), (match) => match[1]);
|
|
32995
|
-
}
|
|
32996
|
-
var REDUNDANT_PREFIX_RE = /^argent_secret_/i;
|
|
32997
|
-
function lookupPlaceholderSecret(rawName, sources) {
|
|
32998
|
-
const value = lookupSecret(rawName, sources);
|
|
32999
|
-
if (value !== void 0 || !REDUNDANT_PREFIX_RE.test(rawName)) return { name: rawName, value };
|
|
33000
|
-
const name = rawName.replace(REDUNDANT_PREFIX_RE, "");
|
|
33001
|
-
return { name, value: lookupSecret(name, sources) };
|
|
33002
|
-
}
|
|
33003
|
-
|
|
33004
|
-
// ../configuration-core/src/merge.ts
|
|
33005
|
-
function mergeRestrictive(local, global) {
|
|
33006
|
-
if (local === void 0) return global;
|
|
33007
|
-
if (global === void 0) return local;
|
|
33008
|
-
if (typeof local === "boolean" && typeof global === "boolean") {
|
|
33009
|
-
return local && global;
|
|
33010
|
-
}
|
|
33011
|
-
if (typeof local === "number" && typeof global === "number") {
|
|
33012
|
-
return Math.min(local, global);
|
|
33013
|
-
}
|
|
33014
|
-
return local;
|
|
33015
|
-
}
|
|
33016
|
-
function toArray(value) {
|
|
33017
|
-
return Array.isArray(value) ? value : null;
|
|
33018
|
-
}
|
|
33019
|
-
function mergeUnion(local, global) {
|
|
33020
|
-
const l = toArray(local);
|
|
33021
|
-
const g = toArray(global);
|
|
33022
|
-
if (l === null && g === null) return local ?? global;
|
|
33023
|
-
const merged = [...g ?? [], ...l ?? []];
|
|
33024
|
-
return Array.from(new Set(merged));
|
|
33025
|
-
}
|
|
33026
|
-
function mergeIntersection(local, global) {
|
|
33027
|
-
const l = toArray(local);
|
|
33028
|
-
const g = toArray(global);
|
|
33029
|
-
if (l === null && g === null) return local ?? global;
|
|
33030
|
-
if (l === null) return global;
|
|
33031
|
-
if (g === null) return local;
|
|
33032
|
-
const globalSet = new Set(g);
|
|
33033
|
-
return l.filter((item) => globalSet.has(item));
|
|
33034
|
-
}
|
|
33035
|
-
function applyMergePolicy(policy, local, global) {
|
|
33036
|
-
if (typeof policy === "function") return policy({ local, global });
|
|
33037
|
-
switch (policy) {
|
|
33038
|
-
case "prioritize-local":
|
|
33039
|
-
return local ?? global;
|
|
33040
|
-
case "prioritize-global":
|
|
33041
|
-
return global ?? local;
|
|
33042
|
-
case "prioritize-restrictive":
|
|
33043
|
-
return mergeRestrictive(local, global);
|
|
33044
|
-
case "union":
|
|
33045
|
-
return mergeUnion(local, global);
|
|
33046
|
-
case "intersection":
|
|
33047
|
-
return mergeIntersection(local, global);
|
|
33048
|
-
default: {
|
|
33049
|
-
const _exhaustive = policy;
|
|
33050
|
-
return _exhaustive;
|
|
33203
|
+
await clearToolsServerState(paths.bundlePath);
|
|
33204
|
+
await sweepDeadStateFiles();
|
|
33205
|
+
if (!fs6.existsSync(paths.bundlePath)) {
|
|
33206
|
+
throw new Error(
|
|
33207
|
+
`The argent install serving this session is gone from disk (${paths.bundlePath}) \u2014 it was likely updated or removed. Restart the editor's MCP connection to reconnect.`
|
|
33208
|
+
);
|
|
33051
33209
|
}
|
|
33210
|
+
const diskVersion = readBundlePackageVersion(paths.bundlePath) ?? paths.version;
|
|
33211
|
+
const token = generateToken();
|
|
33212
|
+
const port = await findFreePort();
|
|
33213
|
+
const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
|
|
33214
|
+
token,
|
|
33215
|
+
host: AUTOSPAWN_HOST,
|
|
33216
|
+
idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES
|
|
33217
|
+
});
|
|
33218
|
+
await writeState({
|
|
33219
|
+
port: actualPort,
|
|
33220
|
+
pid,
|
|
33221
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
33222
|
+
bundlePath: paths.bundlePath,
|
|
33223
|
+
version: diskVersion,
|
|
33224
|
+
host: AUTOSPAWN_HOST,
|
|
33225
|
+
token,
|
|
33226
|
+
managed: "autospawn"
|
|
33227
|
+
});
|
|
33228
|
+
return { url: formatUrl(AUTOSPAWN_HOST, actualPort), token };
|
|
33229
|
+
} finally {
|
|
33230
|
+
lock?.release();
|
|
33052
33231
|
}
|
|
33053
33232
|
}
|
|
33054
33233
|
|
|
33055
|
-
// ../
|
|
33056
|
-
|
|
33057
|
-
|
|
33058
|
-
|
|
33059
|
-
|
|
33060
|
-
function asString(raw2) {
|
|
33061
|
-
if (typeof raw2 !== "string") return void 0;
|
|
33062
|
-
const trimmed = raw2.trim();
|
|
33063
|
-
return trimmed === "" ? void 0 : trimmed;
|
|
33064
|
-
}
|
|
33065
|
-
function asPositiveInteger(raw2) {
|
|
33066
|
-
return typeof raw2 === "number" && Number.isSafeInteger(raw2) && raw2 > 0 ? raw2 : void 0;
|
|
33067
|
-
}
|
|
33068
|
-
var MIN_SCRIPT_HEAP_LIMIT_MB = 32;
|
|
33069
|
-
var MIN_SCRIPT_TIMEOUT_MS = 100;
|
|
33070
|
-
function asStringArray(raw2) {
|
|
33071
|
-
if (!Array.isArray(raw2)) return void 0;
|
|
33072
|
-
const out = [];
|
|
33073
|
-
for (const item of raw2) {
|
|
33074
|
-
if (typeof item === "string" && item.trim() !== "") out.push(item.trim());
|
|
33075
|
-
}
|
|
33076
|
-
return out;
|
|
33077
|
-
}
|
|
33078
|
-
var CONFIG_SCHEMA = [
|
|
33079
|
-
{
|
|
33080
|
-
key: "telemetry.enabled",
|
|
33081
|
-
description: "Whether anonymous opt-out telemetry is enabled (on by default; environment opt-outs like DO_NOT_TRACK are not reflected here \u2014 `argent telemetry status` shows effective consent). `false` in either scope wins, so a committed project opt-out holds for every teammate.",
|
|
33082
|
-
scopes: ["project", "global"],
|
|
33083
|
-
parse: asBoolean,
|
|
33084
|
-
merge: "prioritize-restrictive",
|
|
33085
|
-
// Opt-out: consent.ts reads an unstored value as enabled, so the config
|
|
33086
|
-
// surface must show the same rather than "(unset)".
|
|
33087
|
-
default: true,
|
|
33088
|
-
// Opt-in/out goes through the dedicated command so the live client is
|
|
33089
|
-
// drained/reset, not just the file rewritten.
|
|
33090
|
-
manageCommand: "argent telemetry"
|
|
33091
|
-
},
|
|
33092
|
-
{
|
|
33093
|
-
key: "lens.agent",
|
|
33094
|
-
description: "Coding-agent id remembered by `argent lens` to skip the picker.",
|
|
33095
|
-
scopes: ["project", "global"],
|
|
33096
|
-
parse: asString,
|
|
33097
|
-
merge: "prioritize-local",
|
|
33098
|
-
example: "claude"
|
|
33099
|
-
},
|
|
33100
|
-
{
|
|
33101
|
-
key: "ios.additionalDeviceSets",
|
|
33102
|
-
description: "Additional CoreSimulator device-set directories whose simulators argent should see alongside the default set. Absolute paths (or ~/\u2026); relative entries resolve against the project root (project scope) or home (global scope).",
|
|
33103
|
-
scopes: ["project", "global"],
|
|
33104
|
-
parse: asStringArray,
|
|
33105
|
-
// Additive rather than shadowing: global baseline first, project extras
|
|
33106
|
-
// after, deduplicated. `getAdditionalIosDeviceSets` re-implements this union
|
|
33107
|
-
// (path resolution must precede dedup) and guards on the preset staying "union".
|
|
33108
|
-
merge: "union",
|
|
33109
|
-
example: '["~/DeviceSets/ci"]'
|
|
33110
|
-
},
|
|
33111
|
-
{
|
|
33112
|
-
key: "android.sdkRoot",
|
|
33113
|
-
description: "Android SDK root argent uses instead of `ANDROID_HOME`, for hosts whose SDK is not where the environment says (Nix, custom layouts). Absolute or `~/`-prefixed. Applies to the tool-server and to the simulator-server it starts. `adb` on PATH still wins, as it does with the environment variable.",
|
|
33114
|
-
scopes: ["project", "global"],
|
|
33115
|
-
parse: (raw2) => {
|
|
33116
|
-
const value = asString(raw2);
|
|
33117
|
-
return value !== void 0 && (value === "~" || value.startsWith("~/") || isAbsolute2(value)) ? value : void 0;
|
|
33118
|
-
},
|
|
33119
|
-
expected: "an absolute path, or one starting with `~/`",
|
|
33120
|
-
merge: "prioritize-local",
|
|
33121
|
-
example: "~/Library/Android/sdk"
|
|
33122
|
-
},
|
|
33123
|
-
{
|
|
33124
|
-
key: "android.adbServerPort",
|
|
33125
|
-
description: "Port of the adb server argent uses, for hosts that run Android devices on a server other than the default 5037 (a device pool with its own server, for example). Applies when the tool-server starts, to the tool-server and every adb and simulator-server it runs. `ANDROID_ADB_SERVER_PORT` or `ADB_SERVER_SOCKET` in the tool-server's environment still wins, as it does for adb itself.",
|
|
33126
|
-
scopes: ["project", "global"],
|
|
33127
|
-
parse: (raw2) => {
|
|
33128
|
-
const value = asPositiveInteger(raw2);
|
|
33129
|
-
return value !== void 0 && value < 65536 ? value : void 0;
|
|
33130
|
-
},
|
|
33131
|
-
expected: "a TCP port, 1-65535",
|
|
33132
|
-
merge: "prioritize-local",
|
|
33133
|
-
example: "5038"
|
|
33134
|
-
},
|
|
33135
|
-
{
|
|
33136
|
-
key: "recordings.directory",
|
|
33137
|
-
description: "Directory where finished screen recordings (mp4) are saved on the client host. Absolute, `~`-prefixed, or relative to the project root (home dir when not in a project). Unset \u21D2 `.argent/recordings` under the project root.",
|
|
33138
|
-
scopes: ["project", "global"],
|
|
33139
|
-
parse: asString,
|
|
33140
|
-
// Resolved on the client (the machine the mp4 is persisted to), so with a
|
|
33141
|
-
// remote `argent link` tool-server it is the *client's* config that decides.
|
|
33142
|
-
merge: "prioritize-local",
|
|
33143
|
-
example: "~/Movies/argent"
|
|
33144
|
-
},
|
|
33145
|
-
// Global-scope only: a checked-in `.argent/config.json` must not raise the
|
|
33146
|
-
// ceiling on how much of the machine a script step may occupy. `merge` is
|
|
33147
|
-
// nominal here — the project scope of a global-only key is never read.
|
|
33148
|
-
{
|
|
33149
|
-
key: "scripts.maxTimeoutMs",
|
|
33150
|
-
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.`,
|
|
33151
|
-
scopes: ["global"],
|
|
33152
|
-
parse: (raw2) => {
|
|
33153
|
-
const value = asPositiveInteger(raw2);
|
|
33154
|
-
return value !== void 0 && value >= MIN_SCRIPT_TIMEOUT_MS ? value : void 0;
|
|
33155
|
-
},
|
|
33156
|
-
expected: `a whole number of milliseconds, at least ${MIN_SCRIPT_TIMEOUT_MS}`,
|
|
33157
|
-
merge: "prioritize-global",
|
|
33158
|
-
default: 5 * 6e4,
|
|
33159
|
-
example: "300000"
|
|
33160
|
-
},
|
|
33161
|
-
{
|
|
33162
|
-
key: "scripts.heapLimitMb",
|
|
33163
|
-
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.`,
|
|
33164
|
-
scopes: ["global"],
|
|
33165
|
-
parse: (raw2) => {
|
|
33166
|
-
const value = asPositiveInteger(raw2);
|
|
33167
|
-
return value !== void 0 && value >= MIN_SCRIPT_HEAP_LIMIT_MB ? value : void 0;
|
|
33168
|
-
},
|
|
33169
|
-
expected: `a whole number of MiB, at least ${MIN_SCRIPT_HEAP_LIMIT_MB}`,
|
|
33170
|
-
merge: "prioritize-global",
|
|
33171
|
-
default: 512,
|
|
33172
|
-
example: "512"
|
|
33173
|
-
}
|
|
33174
|
-
];
|
|
33175
|
-
function getConfigDefinition(key, registry2 = CONFIG_SCHEMA) {
|
|
33176
|
-
return registry2.find((def) => def.key === key);
|
|
33177
|
-
}
|
|
33178
|
-
|
|
33179
|
-
// ../configuration-core/src/config-access.ts
|
|
33180
|
-
import * as path6 from "node:path";
|
|
33181
|
-
function readScopeValue(def, scope, options) {
|
|
33182
|
-
if (!def.scopes.includes(scope)) return void 0;
|
|
33183
|
-
const raw2 = getAtPath(readConfigObject(scope, options), def.key);
|
|
33184
|
-
return raw2 === void 0 ? void 0 : def.parse(raw2);
|
|
33185
|
-
}
|
|
33186
|
-
function getConfigValue(def, options = {}) {
|
|
33187
|
-
const local = readScopeValue(def, "project", options);
|
|
33188
|
-
const global = readScopeValue(def, "global", options);
|
|
33189
|
-
const merged = applyMergePolicy(def.merge, local, global);
|
|
33190
|
-
return merged ?? def.default;
|
|
33191
|
-
}
|
|
33192
|
-
function getConfigValueByKey(key, options = {}, registry2 = CONFIG_SCHEMA) {
|
|
33193
|
-
const def = requireDefinition(key, registry2);
|
|
33194
|
-
return getConfigValue(def, options);
|
|
33195
|
-
}
|
|
33196
|
-
function requireDefinition(key, registry2 = CONFIG_SCHEMA) {
|
|
33197
|
-
const def = getConfigDefinition(key, registry2);
|
|
33198
|
-
if (!def) {
|
|
33199
|
-
throw new UnknownConfigKeyError(key);
|
|
33200
|
-
}
|
|
33201
|
-
return def;
|
|
33202
|
-
}
|
|
33203
|
-
var UnknownConfigKeyError = class extends Error {
|
|
33204
|
-
constructor(key) {
|
|
33205
|
-
super(`Unknown configuration key "${key}".`);
|
|
33206
|
-
this.key = key;
|
|
33207
|
-
this.name = "UnknownConfigKeyError";
|
|
33208
|
-
}
|
|
33209
|
-
key;
|
|
33210
|
-
};
|
|
33234
|
+
// ../argent-tools-client/src/tools-client.ts
|
|
33235
|
+
var import_yaml2 = __toESM(require_dist3(), 1);
|
|
33236
|
+
import { readFile as readFile5 } from "node:fs/promises";
|
|
33237
|
+
import { maxHeaderSize } from "node:http";
|
|
33238
|
+
import * as path13 from "node:path";
|
|
33211
33239
|
|
|
33212
33240
|
// ../registry/src/types.ts
|
|
33213
33241
|
var LINKED_CALL_HEADER = "x-argent-linked";
|
|
@@ -33268,8 +33296,8 @@ var UNEXPANDED_PATH = /^~|\$[A-Za-z0-9_{(]|`|%[A-Za-z_][A-Za-z0-9_]*%|^[A-Za-z][
|
|
|
33268
33296
|
function isUnexpandedPath(p) {
|
|
33269
33297
|
return UNEXPANDED_PATH.test(p);
|
|
33270
33298
|
}
|
|
33271
|
-
function isClientFileArgument({ spec, path:
|
|
33272
|
-
return spec.kind === "file" && spec.path === `\${${spec.target}}` &&
|
|
33299
|
+
function isClientFileArgument({ spec, path: path19 }) {
|
|
33300
|
+
return spec.kind === "file" && spec.path === `\${${spec.target}}` && path19.startsWith("/") && hasToolFileExtension(path19);
|
|
33273
33301
|
}
|
|
33274
33302
|
|
|
33275
33303
|
// ../registry/src/flow-platforms.ts
|
|
@@ -33277,26 +33305,26 @@ var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
|
|
|
33277
33305
|
var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
|
|
33278
33306
|
|
|
33279
33307
|
// ../registry/src/flow-file-refs.ts
|
|
33280
|
-
import * as
|
|
33281
|
-
import * as
|
|
33308
|
+
import * as fs8 from "node:fs/promises";
|
|
33309
|
+
import * as path9 from "node:path";
|
|
33282
33310
|
|
|
33283
33311
|
// ../registry/src/e2e-dirs.ts
|
|
33284
|
-
import * as
|
|
33285
|
-
import * as
|
|
33286
|
-
var E2E_DIR =
|
|
33287
|
-
var LEGACY_E2E_DIRS = Object.freeze([
|
|
33312
|
+
import * as fs7 from "node:fs/promises";
|
|
33313
|
+
import * as path8 from "node:path";
|
|
33314
|
+
var E2E_DIR = path8.join(".argent", "e2e");
|
|
33315
|
+
var LEGACY_E2E_DIRS = Object.freeze([path8.join(".argent", "flows")]);
|
|
33288
33316
|
var E2E_DIRS = Object.freeze([E2E_DIR, ...LEGACY_E2E_DIRS]);
|
|
33289
33317
|
function e2eDirFor(projectRoot) {
|
|
33290
|
-
return
|
|
33318
|
+
return path8.join(projectRoot, E2E_DIR);
|
|
33291
33319
|
}
|
|
33292
33320
|
function e2eDirsFor(projectRoot) {
|
|
33293
|
-
return E2E_DIRS.map((dir) =>
|
|
33321
|
+
return E2E_DIRS.map((dir) => path8.join(projectRoot, dir));
|
|
33294
33322
|
}
|
|
33295
33323
|
function e2eFileCandidates(projectRoot, name) {
|
|
33296
|
-
return e2eDirsFor(projectRoot).map((dir) =>
|
|
33324
|
+
return e2eDirsFor(projectRoot).map((dir) => path8.join(dir, `${name}.yaml`));
|
|
33297
33325
|
}
|
|
33298
33326
|
async function exists(file) {
|
|
33299
|
-
return
|
|
33327
|
+
return fs7.stat(file).then(
|
|
33300
33328
|
() => true,
|
|
33301
33329
|
() => false
|
|
33302
33330
|
);
|
|
@@ -33323,21 +33351,21 @@ async function pickE2eFile(candidates) {
|
|
|
33323
33351
|
function e2eShadowWarning(used, shadowed) {
|
|
33324
33352
|
return `${shadowed} is not used: ${used} has the same name and is read first.`;
|
|
33325
33353
|
}
|
|
33326
|
-
var E2E_DIR_NAMES = E2E_DIRS.map((dir) =>
|
|
33354
|
+
var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path8.basename(dir));
|
|
33327
33355
|
function e2eDirProject(dir) {
|
|
33328
33356
|
const trimmed = dir.length > 1 ? dir.replace(/[\\/]+$/, "") : dir;
|
|
33329
|
-
const argent =
|
|
33330
|
-
if (!E2E_DIR_NAMES.includes(
|
|
33357
|
+
const argent = path8.dirname(trimmed);
|
|
33358
|
+
if (!E2E_DIR_NAMES.includes(path8.basename(trimmed)) || path8.basename(argent) !== ".argent") {
|
|
33331
33359
|
return null;
|
|
33332
33360
|
}
|
|
33333
|
-
return
|
|
33361
|
+
return path8.dirname(argent);
|
|
33334
33362
|
}
|
|
33335
33363
|
function e2eRunFallbackDirs(anchorDir, target) {
|
|
33336
33364
|
if (target.includes("/") || target.includes("\\")) return [];
|
|
33337
33365
|
const project = e2eDirProject(anchorDir);
|
|
33338
33366
|
if (project === null) return [];
|
|
33339
|
-
const anchor2 =
|
|
33340
|
-
return e2eDirsFor(project).filter((dir) =>
|
|
33367
|
+
const anchor2 = path8.resolve(anchorDir);
|
|
33368
|
+
return e2eDirsFor(project).filter((dir) => path8.resolve(dir) !== anchor2);
|
|
33341
33369
|
}
|
|
33342
33370
|
|
|
33343
33371
|
// ../registry/src/tool-ids.ts
|
|
@@ -33387,10 +33415,10 @@ function canonicalToolArgs(tool, args) {
|
|
|
33387
33415
|
// ../registry/src/flow-file-refs.ts
|
|
33388
33416
|
async function canonicalFlowPath(p) {
|
|
33389
33417
|
try {
|
|
33390
|
-
return await
|
|
33418
|
+
return await fs8.realpath(p);
|
|
33391
33419
|
} catch {
|
|
33392
33420
|
try {
|
|
33393
|
-
return
|
|
33421
|
+
return path9.join(await fs8.realpath(path9.dirname(p)), path9.basename(p));
|
|
33394
33422
|
} catch {
|
|
33395
33423
|
return p;
|
|
33396
33424
|
}
|
|
@@ -33399,7 +33427,7 @@ async function canonicalFlowPath(p) {
|
|
|
33399
33427
|
function completeRunExtension(value) {
|
|
33400
33428
|
if (value.endsWith(".yaml")) return value;
|
|
33401
33429
|
const candidate = `${value}.yaml`;
|
|
33402
|
-
return FLOW_FILE_NAME_PATTERN.test(
|
|
33430
|
+
return FLOW_FILE_NAME_PATTERN.test(path9.posix.basename(candidate)) ? candidate : value;
|
|
33403
33431
|
}
|
|
33404
33432
|
var MAX_RUN_DEPTH = 20;
|
|
33405
33433
|
var MAX_BLOCK_NESTING = 64;
|
|
@@ -33421,9 +33449,9 @@ function collectFlowRequests(doc) {
|
|
|
33421
33449
|
for (const step of steps) {
|
|
33422
33450
|
if (!isRecord(step)) continue;
|
|
33423
33451
|
const run = step.run;
|
|
33424
|
-
if (typeof run === "string" && !run.includes("\\") && !
|
|
33452
|
+
if (typeof run === "string" && !run.includes("\\") && !path9.posix.isAbsolute(run) && !/^[A-Za-z]:/.test(run)) {
|
|
33425
33453
|
const target = completeRunExtension(run);
|
|
33426
|
-
if (FLOW_FILE_NAME_PATTERN.test(
|
|
33454
|
+
if (FLOW_FILE_NAME_PATTERN.test(path9.posix.basename(target))) runTargets.add(target);
|
|
33427
33455
|
}
|
|
33428
33456
|
const snapshot = isRecord(step.snapshot) ? step.snapshot.name : step.snapshot;
|
|
33429
33457
|
if (typeof snapshot === "string" && FLOW_NAME_PATTERN.test(snapshot)) snapshots.add(snapshot);
|
|
@@ -33436,18 +33464,21 @@ function collectFlowRequests(doc) {
|
|
|
33436
33464
|
visit(step.steps, depth + 1);
|
|
33437
33465
|
}
|
|
33438
33466
|
};
|
|
33439
|
-
if (isRecord(doc))
|
|
33467
|
+
if (isRecord(doc)) {
|
|
33468
|
+
visit(doc.steps, 0);
|
|
33469
|
+
visit(doc.shutdown, 0);
|
|
33470
|
+
}
|
|
33440
33471
|
return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
|
|
33441
33472
|
}
|
|
33442
33473
|
function baselineKeyFor(canonicalPath2, flowName) {
|
|
33443
|
-
const stem =
|
|
33474
|
+
const stem = path9.basename(canonicalPath2, ".yaml");
|
|
33444
33475
|
return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
|
|
33445
33476
|
}
|
|
33446
33477
|
function flowMemberKey(anchorDir, target) {
|
|
33447
33478
|
return `${anchorDir}\0${target}`;
|
|
33448
33479
|
}
|
|
33449
33480
|
async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
|
|
33450
|
-
const entries = await
|
|
33481
|
+
const entries = await fs8.readdir(dir).catch(() => null);
|
|
33451
33482
|
if (entries === null || entries.includes(base)) return { state: "listed" };
|
|
33452
33483
|
const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
|
|
33453
33484
|
if (actual === void 0) return { state: "absent" };
|
|
@@ -33469,11 +33500,11 @@ function nestedFlowTarget(args) {
|
|
|
33469
33500
|
return { kind: "name", projectRoot, name, path: paths[0], paths };
|
|
33470
33501
|
}
|
|
33471
33502
|
if (name !== void 0 || !isResolvedAbsolute(flowPath)) return void 0;
|
|
33472
|
-
if (!FLOW_FILE_NAME_PATTERN.test(
|
|
33503
|
+
if (!FLOW_FILE_NAME_PATTERN.test(path9.basename(flowPath))) return void 0;
|
|
33473
33504
|
return { kind: "e2e_test_path", path: flowPath };
|
|
33474
33505
|
}
|
|
33475
33506
|
function isResolvedAbsolute(value) {
|
|
33476
|
-
return typeof value === "string" &&
|
|
33507
|
+
return typeof value === "string" && path9.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
|
|
33477
33508
|
}
|
|
33478
33509
|
|
|
33479
33510
|
// ../registry/src/failure-codes.ts
|
|
@@ -33991,9 +34022,9 @@ var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
|
|
|
33991
34022
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
33992
34023
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
33993
34024
|
var resolvedDuringInvocation = new AsyncLocalStorage();
|
|
33994
|
-
function valueAtPath(root,
|
|
34025
|
+
function valueAtPath(root, path19) {
|
|
33995
34026
|
let current = root;
|
|
33996
|
-
for (const key of
|
|
34027
|
+
for (const key of path19) {
|
|
33997
34028
|
if (current === null || typeof current !== "object") return void 0;
|
|
33998
34029
|
if (!Object.hasOwn(current, key)) return void 0;
|
|
33999
34030
|
current = current[key];
|
|
@@ -34051,11 +34082,10 @@ function describeParamIssues(error2, params) {
|
|
|
34051
34082
|
}
|
|
34052
34083
|
|
|
34053
34084
|
// ../argent-tools-client/src/link-config.ts
|
|
34054
|
-
import * as
|
|
34055
|
-
import { homedir as homedir4 } from "node:os";
|
|
34085
|
+
import * as path10 from "node:path";
|
|
34056
34086
|
import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
|
|
34057
|
-
var LINK_DIR =
|
|
34058
|
-
var LINK_FILE =
|
|
34087
|
+
var LINK_DIR = argentHomeDir();
|
|
34088
|
+
var LINK_FILE = path10.join(LINK_DIR, "link.json");
|
|
34059
34089
|
async function readLinkConfig() {
|
|
34060
34090
|
try {
|
|
34061
34091
|
const raw2 = await readFile2(LINK_FILE, "utf8");
|
|
@@ -34108,14 +34138,14 @@ import {
|
|
|
34108
34138
|
writeFile as writeFile3
|
|
34109
34139
|
} from "node:fs/promises";
|
|
34110
34140
|
import { constants, tmpdir } from "node:os";
|
|
34111
|
-
import * as
|
|
34141
|
+
import * as path11 from "node:path";
|
|
34112
34142
|
|
|
34113
34143
|
// ../archive/src/index.ts
|
|
34114
34144
|
import { spawn as spawn2 } from "node:child_process";
|
|
34115
34145
|
import { once } from "node:events";
|
|
34116
34146
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
34117
34147
|
import { open as open2, rm, readdir as readdir3 } from "node:fs/promises";
|
|
34118
|
-
import { basename as basename4, dirname as dirname5, join as
|
|
34148
|
+
import { basename as basename4, dirname as dirname5, join as join10, resolve as resolve8, sep as sep2 } from "node:path";
|
|
34119
34149
|
import { Writable } from "node:stream";
|
|
34120
34150
|
import { pipeline } from "node:stream/promises";
|
|
34121
34151
|
import zlib from "node:zlib";
|
|
@@ -34270,7 +34300,7 @@ async function runTar(archive, args, signal) {
|
|
|
34270
34300
|
child.on("error", (err) => {
|
|
34271
34301
|
childError = err;
|
|
34272
34302
|
});
|
|
34273
|
-
const closed = new Promise((
|
|
34303
|
+
const closed = new Promise((resolve13) => child.once("close", resolve13));
|
|
34274
34304
|
const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
|
|
34275
34305
|
maxLines: MAX_LISTING_LINES,
|
|
34276
34306
|
onOverflow: () => child.kill()
|
|
@@ -34319,16 +34349,16 @@ async function runTar(archive, args, signal) {
|
|
|
34319
34349
|
function normalizeTarMemberPath(memberPath) {
|
|
34320
34350
|
return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
34321
34351
|
}
|
|
34322
|
-
function isContainedPath(
|
|
34323
|
-
const slashed =
|
|
34352
|
+
function isContainedPath(path19, windows = process.platform === "win32") {
|
|
34353
|
+
const slashed = path19.replace(/\\/g, "/");
|
|
34324
34354
|
const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
|
|
34325
34355
|
return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
|
|
34326
34356
|
}
|
|
34327
34357
|
function isSafeTarMember(memberPath, destDir) {
|
|
34328
34358
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
34329
34359
|
if (!isContainedPath(normalized)) return false;
|
|
34330
|
-
const root =
|
|
34331
|
-
return
|
|
34360
|
+
const root = resolve8(destDir);
|
|
34361
|
+
return resolve8(destDir, normalized).startsWith(root + sep2);
|
|
34332
34362
|
}
|
|
34333
34363
|
async function readListing(archive, args, signal) {
|
|
34334
34364
|
try {
|
|
@@ -34380,7 +34410,7 @@ async function assertSafeArchive(archive, destDir, signal) {
|
|
|
34380
34410
|
async function resolveMember(destDir, expectedName) {
|
|
34381
34411
|
const entries = await readdir3(destDir);
|
|
34382
34412
|
if (entries.includes(expectedName)) {
|
|
34383
|
-
return
|
|
34413
|
+
return join10(destDir, expectedName);
|
|
34384
34414
|
}
|
|
34385
34415
|
const real = entries.filter((e) => !e.startsWith("._"));
|
|
34386
34416
|
if (real.length !== 1) {
|
|
@@ -34388,7 +34418,7 @@ async function resolveMember(destDir, expectedName) {
|
|
|
34388
34418
|
`Could not identify the extracted member (expected "${expectedName}", found ${real.length} entries).`
|
|
34389
34419
|
);
|
|
34390
34420
|
}
|
|
34391
|
-
return
|
|
34421
|
+
return join10(destDir, real[0]);
|
|
34392
34422
|
}
|
|
34393
34423
|
async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
|
|
34394
34424
|
signal?.throwIfAborted();
|
|
@@ -34441,20 +34471,20 @@ function interpolatePath(template, args) {
|
|
|
34441
34471
|
return missing ? null : out;
|
|
34442
34472
|
}
|
|
34443
34473
|
function callerPath(p) {
|
|
34444
|
-
const onCurrentDrive =
|
|
34445
|
-
if (!onCurrentDrive && (
|
|
34474
|
+
const onCurrentDrive = path11.sep === "\\" && /^[\\/](?![\\/])/.test(p);
|
|
34475
|
+
if (!onCurrentDrive && (path11.isAbsolute(p) || path11.win32.isAbsolute(p) || isUnexpandedPath(p))) {
|
|
34446
34476
|
return p;
|
|
34447
34477
|
}
|
|
34448
|
-
const { root } =
|
|
34478
|
+
const { root } = path11.parse(p);
|
|
34449
34479
|
const rest = p.slice(root.length);
|
|
34450
34480
|
if (!rest.split(/[\\/]/).includes("..")) {
|
|
34451
|
-
const resolved =
|
|
34452
|
-
const last = p.split(
|
|
34453
|
-
const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(
|
|
34454
|
-
return dirOnly ? `${resolved}${
|
|
34481
|
+
const resolved = path11.resolve(p);
|
|
34482
|
+
const last = p.split(path11.sep === "\\" ? /[\\/]/ : "/").at(-1);
|
|
34483
|
+
const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(path11.sep);
|
|
34484
|
+
return dirOnly ? `${resolved}${path11.sep}` : resolved;
|
|
34455
34485
|
}
|
|
34456
|
-
const base =
|
|
34457
|
-
return base.endsWith(
|
|
34486
|
+
const base = path11.resolve(root);
|
|
34487
|
+
return base.endsWith(path11.sep) ? `${base}${rest}` : `${base}${path11.sep}${rest}`;
|
|
34458
34488
|
}
|
|
34459
34489
|
async function specPath(spec, args) {
|
|
34460
34490
|
if (spec.kind !== "file" || !spec.paths?.length) return interpolatePath(spec.path, args);
|
|
@@ -34501,9 +34531,9 @@ function untrackArchive(archive) {
|
|
|
34501
34531
|
process.removeListener("exit", removePendingArchives);
|
|
34502
34532
|
}
|
|
34503
34533
|
function sha256File(filePath, signal) {
|
|
34504
|
-
return new Promise((
|
|
34534
|
+
return new Promise((resolve13, reject) => {
|
|
34505
34535
|
const hash = createHash2("sha256");
|
|
34506
|
-
createReadStream2(filePath, { signal }).on("data", (chunk) => hash.update(chunk)).on("end", () =>
|
|
34536
|
+
createReadStream2(filePath, { signal }).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve13(hash.digest("hex"))).on("error", reject);
|
|
34507
34537
|
});
|
|
34508
34538
|
}
|
|
34509
34539
|
function toolServerError(text) {
|
|
@@ -34562,7 +34592,7 @@ async function uploadTar(tarPath, format, endpoint, signal) {
|
|
|
34562
34592
|
}
|
|
34563
34593
|
async function uploadFile(sourcePath, endpoint, signal) {
|
|
34564
34594
|
const format = pickArchiveFormat(endpoint.formats);
|
|
34565
|
-
const tarPath =
|
|
34595
|
+
const tarPath = path11.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
|
|
34566
34596
|
trackArchive(tarPath);
|
|
34567
34597
|
try {
|
|
34568
34598
|
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
@@ -34637,7 +34667,7 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
34637
34667
|
wire.mtimeMs = st.mtimeMs;
|
|
34638
34668
|
}
|
|
34639
34669
|
if (opts.uploadEndpoint && st) {
|
|
34640
|
-
process.stderr.write(`Uploading ${
|
|
34670
|
+
process.stderr.write(`Uploading ${path11.basename(filePath)} to the remote tool-server...
|
|
34641
34671
|
`);
|
|
34642
34672
|
Object.assign(wire, await uploadFile(filePath, opts.uploadEndpoint, opts.signal));
|
|
34643
34673
|
}
|
|
@@ -34647,7 +34677,7 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
34647
34677
|
return out;
|
|
34648
34678
|
}
|
|
34649
34679
|
function isAllowedClientFilePath(p) {
|
|
34650
|
-
if (!
|
|
34680
|
+
if (!path11.isAbsolute(p)) return false;
|
|
34651
34681
|
const segments = p.split(/[\\/]+/);
|
|
34652
34682
|
if (segments.includes("..")) return false;
|
|
34653
34683
|
const file = segments[segments.length - 1] ?? "";
|
|
@@ -34658,7 +34688,7 @@ function isClientFileDirective2(value) {
|
|
|
34658
34688
|
return !!value && typeof value === "object" && value[CLIENT_FILE_MARKER2] === true && typeof value.path === "string" && typeof value.content === "string";
|
|
34659
34689
|
}
|
|
34660
34690
|
async function replaceFile(target, bytes, mode) {
|
|
34661
|
-
const temp =
|
|
34691
|
+
const temp = path11.join(path11.dirname(target), `.baseline-${randomUUID4()}.tmp`);
|
|
34662
34692
|
try {
|
|
34663
34693
|
await writeFile3(temp, bytes, { flag: "wx" });
|
|
34664
34694
|
if (mode !== void 0) await chmod3(temp, mode & 511);
|
|
@@ -34669,27 +34699,27 @@ async function replaceFile(target, bytes, mode) {
|
|
|
34669
34699
|
}
|
|
34670
34700
|
}
|
|
34671
34701
|
async function writeBaselineFile(file, bytes, allowedDirs) {
|
|
34672
|
-
if (!
|
|
34702
|
+
if (!path11.isAbsolute(file) || path11.normalize(file) !== file || file.split(/[\\/]/).includes("..") || !file.endsWith(".png") || !allowedDirs.includes(path11.dirname(file))) {
|
|
34673
34703
|
return allowedDirs.length === 0 ? "this call writes no baselines" : `${file} is not a baseline of this call (${allowedDirs.map((d) => `${d}/<name>.png`).join(", ")})`;
|
|
34674
34704
|
}
|
|
34675
34705
|
if (bytes.length > MAX_CONTENT_BYTES) {
|
|
34676
34706
|
return `${file}: the baseline is larger than the 32 MiB cap on a file this client writes`;
|
|
34677
34707
|
}
|
|
34678
|
-
const dir =
|
|
34708
|
+
const dir = path11.dirname(file);
|
|
34679
34709
|
await mkdir3(dir, { recursive: true });
|
|
34680
34710
|
const link = await lstat(file).catch(() => null);
|
|
34681
34711
|
const real = link === null ? null : await realpath2(file).catch(() => null);
|
|
34682
34712
|
if (link !== null && real === null) return `${file} is a symbolic link to a missing file`;
|
|
34683
34713
|
if (real !== null) {
|
|
34684
34714
|
if (!real.endsWith(".png")) return `${file} links to a file that is not a PNG file`;
|
|
34685
|
-
if (
|
|
34715
|
+
if (path11.dirname(real) !== await realpath2(dir)) {
|
|
34686
34716
|
return `${file} links outside its baseline directory`;
|
|
34687
34717
|
}
|
|
34688
34718
|
}
|
|
34689
34719
|
const existing = real === null ? null : await stat3(real);
|
|
34690
34720
|
if (existing !== null && !existing.isFile()) return `${file} is not a regular file`;
|
|
34691
34721
|
await replaceFile(
|
|
34692
|
-
real ??
|
|
34722
|
+
real ?? path11.join(await realpath2(dir), path11.basename(file)),
|
|
34693
34723
|
bytes,
|
|
34694
34724
|
existing?.mode
|
|
34695
34725
|
);
|
|
@@ -34715,7 +34745,7 @@ async function applyClientFileDirectives(result, opts = {}) {
|
|
|
34715
34745
|
if (isClientFileDirective2(value)) {
|
|
34716
34746
|
if (!isAllowedClientFilePath(value.path)) return null;
|
|
34717
34747
|
try {
|
|
34718
|
-
await mkdir3(
|
|
34748
|
+
await mkdir3(path11.dirname(value.path), { recursive: true });
|
|
34719
34749
|
await writeFile3(value.path, value.content, "utf8");
|
|
34720
34750
|
written.push(value.path);
|
|
34721
34751
|
return value.path;
|
|
@@ -34742,15 +34772,15 @@ async function applyClientFileDirectives(result, opts = {}) {
|
|
|
34742
34772
|
}
|
|
34743
34773
|
|
|
34744
34774
|
// ../argent-tools-client/src/flow-files.ts
|
|
34745
|
-
var import_yaml = __toESM(
|
|
34775
|
+
var import_yaml = __toESM(require_dist3(), 1);
|
|
34746
34776
|
import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
|
|
34747
|
-
import * as
|
|
34777
|
+
import * as path12 from "node:path";
|
|
34748
34778
|
var INLINE_MEMBERS_BYTES = 256 * 1024;
|
|
34749
34779
|
function filesLogEnabled() {
|
|
34750
34780
|
return (process.env.ARGENT_E2E_FILES_LOG ?? process.env.ARGENT_FLOW_FILES_LOG) === "1";
|
|
34751
34781
|
}
|
|
34752
34782
|
function isWithin(inner, outer) {
|
|
34753
|
-
return inner === outer || inner.startsWith(outer.endsWith(
|
|
34783
|
+
return inner === outer || inner.startsWith(outer.endsWith(path12.sep) ? outer : outer + path12.sep);
|
|
34754
34784
|
}
|
|
34755
34785
|
function printable(text) {
|
|
34756
34786
|
return [...text].map(
|
|
@@ -34758,7 +34788,7 @@ function printable(text) {
|
|
|
34758
34788
|
).join("");
|
|
34759
34789
|
}
|
|
34760
34790
|
function isResolvedAbsolute2(value) {
|
|
34761
|
-
return typeof value === "string" &&
|
|
34791
|
+
return typeof value === "string" && path12.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
|
|
34762
34792
|
}
|
|
34763
34793
|
function namesValidFlow(args) {
|
|
34764
34794
|
let canonical;
|
|
@@ -34770,13 +34800,13 @@ function namesValidFlow(args) {
|
|
|
34770
34800
|
const { project_root, e2e_test_path: testPath, name } = canonical;
|
|
34771
34801
|
if (!isResolvedAbsolute2(project_root)) return false;
|
|
34772
34802
|
if (name === void 0) {
|
|
34773
|
-
return isResolvedAbsolute2(testPath) && FLOW_FILE_NAME_PATTERN.test(
|
|
34803
|
+
return isResolvedAbsolute2(testPath) && FLOW_FILE_NAME_PATTERN.test(path12.basename(testPath));
|
|
34774
34804
|
}
|
|
34775
34805
|
return testPath === void 0 && typeof name === "string" && FLOW_NAME_PATTERN.test(name);
|
|
34776
34806
|
}
|
|
34777
34807
|
function savedFlowProject(file) {
|
|
34778
|
-
if (!
|
|
34779
|
-
for (let dir =
|
|
34808
|
+
if (!path12.isAbsolute(file)) return null;
|
|
34809
|
+
for (let dir = path12.dirname(file); dir !== path12.dirname(dir); dir = path12.dirname(dir)) {
|
|
34780
34810
|
const project = e2eDirProject(dir);
|
|
34781
34811
|
if (project !== null) return project;
|
|
34782
34812
|
}
|
|
@@ -34791,11 +34821,11 @@ async function landing(spelled) {
|
|
|
34791
34821
|
const canonical = await canonicalFlowPath(spelled);
|
|
34792
34822
|
let at = spelled;
|
|
34793
34823
|
for (; ; ) {
|
|
34794
|
-
const parent =
|
|
34824
|
+
const parent = path12.dirname(at);
|
|
34795
34825
|
if (parent === at) return { canonical, fence: spelled, ...failure2 };
|
|
34796
34826
|
const real = await realpath3(parent).catch(() => null);
|
|
34797
34827
|
if (real !== null) {
|
|
34798
|
-
return { canonical, fence:
|
|
34828
|
+
return { canonical, fence: path12.join(real, path12.basename(at)), ...failure2 };
|
|
34799
34829
|
}
|
|
34800
34830
|
at = parent;
|
|
34801
34831
|
}
|
|
@@ -34803,10 +34833,10 @@ async function landing(spelled) {
|
|
|
34803
34833
|
}
|
|
34804
34834
|
async function closureRoots(rootPath, rootCanonical, projectRoot) {
|
|
34805
34835
|
const candidates = [];
|
|
34806
|
-
if (typeof projectRoot === "string" &&
|
|
34836
|
+
if (typeof projectRoot === "string" && path12.isAbsolute(projectRoot)) {
|
|
34807
34837
|
candidates.push(projectRoot, ...e2eDirsFor(projectRoot));
|
|
34808
34838
|
}
|
|
34809
|
-
candidates.push(
|
|
34839
|
+
candidates.push(path12.dirname(rootPath), path12.dirname(rootCanonical));
|
|
34810
34840
|
for (const file of [rootPath, rootCanonical]) {
|
|
34811
34841
|
const project = savedFlowProject(file);
|
|
34812
34842
|
if (project !== null) candidates.push(project);
|
|
@@ -34819,11 +34849,11 @@ async function closureRoots(rootPath, rootCanonical, projectRoot) {
|
|
|
34819
34849
|
return real.filter((root) => !real.some((other) => other !== root && isWithin(root, other)));
|
|
34820
34850
|
}
|
|
34821
34851
|
async function readFlowMember(anchorDir, target, roots, budget, opts) {
|
|
34822
|
-
const spelled = anchorDir +
|
|
34852
|
+
const spelled = anchorDir + path12.sep + target;
|
|
34823
34853
|
const { canonical, fence, missing, error: error2 } = await landing(spelled);
|
|
34824
34854
|
const spelling = await classifyOnDiskSpelling(
|
|
34825
|
-
|
|
34826
|
-
|
|
34855
|
+
path12.dirname(spelled),
|
|
34856
|
+
path12.posix.basename(target),
|
|
34827
34857
|
FLOW_FILE_NAME_PATTERN
|
|
34828
34858
|
);
|
|
34829
34859
|
const member = {
|
|
@@ -34848,7 +34878,7 @@ async function readFlowMember(anchorDir, target, roots, budget, opts) {
|
|
|
34848
34878
|
return { member: { ...member, state: "missing" }, sent: "missing" };
|
|
34849
34879
|
}
|
|
34850
34880
|
if (st.isDirectory()) return refuse("EISDIR: illegal operation on a directory, read");
|
|
34851
|
-
if (!/\.ya?ml$/i.test(
|
|
34881
|
+
if (!/\.ya?ml$/i.test(path12.basename(canonical))) {
|
|
34852
34882
|
return refuse(`${target} links to a file that is not a YAML file`);
|
|
34853
34883
|
}
|
|
34854
34884
|
const sent = await sendBytes(member, canonical, budget, opts);
|
|
@@ -34973,12 +35003,12 @@ function memberCollector(roots, opts) {
|
|
|
34973
35003
|
}
|
|
34974
35004
|
async function savedTest(target) {
|
|
34975
35005
|
for (const candidate of target.paths) {
|
|
34976
|
-
const found = await flow(
|
|
35006
|
+
const found = await flow(path12.dirname(candidate), path12.basename(candidate), true);
|
|
34977
35007
|
if (found !== void 0) return found;
|
|
34978
35008
|
}
|
|
34979
35009
|
let first;
|
|
34980
35010
|
for (const candidate of target.paths) {
|
|
34981
|
-
first ??= await flow(
|
|
35011
|
+
first ??= await flow(path12.dirname(candidate), path12.basename(candidate));
|
|
34982
35012
|
}
|
|
34983
35013
|
return first;
|
|
34984
35014
|
}
|
|
@@ -35015,7 +35045,7 @@ function memberCollector(roots, opts) {
|
|
|
35015
35045
|
const requests = collectFlowRequests(doc);
|
|
35016
35046
|
for (const name of requests.snapshots) snapshots.add(name);
|
|
35017
35047
|
for (const step of requests.toolSteps) await toolFiles(step);
|
|
35018
|
-
const anchorDir =
|
|
35048
|
+
const anchorDir = path12.dirname(file.canonical);
|
|
35019
35049
|
for (const target of requests.runTargets) {
|
|
35020
35050
|
const key = flowMemberKey(anchorDir, target);
|
|
35021
35051
|
if (visited.has(key)) continue;
|
|
@@ -35037,8 +35067,8 @@ function memberCollector(roots, opts) {
|
|
|
35037
35067
|
}
|
|
35038
35068
|
}
|
|
35039
35069
|
if (snapshots.size === 0) continue;
|
|
35040
|
-
const dir =
|
|
35041
|
-
|
|
35070
|
+
const dir = path12.join(
|
|
35071
|
+
path12.dirname(run.canonical),
|
|
35042
35072
|
"__baselines__",
|
|
35043
35073
|
baselineKeyFor(run.canonical, run.flowName)
|
|
35044
35074
|
);
|
|
@@ -35062,7 +35092,7 @@ function memberCollector(roots, opts) {
|
|
|
35062
35092
|
if (!name.endsWith(".png")) continue;
|
|
35063
35093
|
const compared = [...prefixes].some((prefix) => name.startsWith(prefix));
|
|
35064
35094
|
if (!updates && !compared) continue;
|
|
35065
|
-
const file =
|
|
35095
|
+
const file = path12.join(dir, name);
|
|
35066
35096
|
if (tools.has(file)) continue;
|
|
35067
35097
|
const member = { role: "baseline", key: file, path: file };
|
|
35068
35098
|
const entry = await baselineEntry(file, roots, updates && !compared);
|
|
@@ -35085,8 +35115,8 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
|
|
|
35085
35115
|
if (!namesValidFlow(args)) return {};
|
|
35086
35116
|
const canonical = await canonicalFlowPath(rootPath);
|
|
35087
35117
|
const spelling = await classifyOnDiskSpelling(
|
|
35088
|
-
|
|
35089
|
-
|
|
35118
|
+
path12.dirname(rootPath),
|
|
35119
|
+
path12.basename(rootPath),
|
|
35090
35120
|
FLOW_FILE_NAME_PATTERN
|
|
35091
35121
|
);
|
|
35092
35122
|
const collector = memberCollector(
|
|
@@ -35097,7 +35127,7 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
|
|
|
35097
35127
|
{
|
|
35098
35128
|
canonical,
|
|
35099
35129
|
text: rootBytes.toString("utf8"),
|
|
35100
|
-
flowName:
|
|
35130
|
+
flowName: path12.basename(rootPath, ".yaml"),
|
|
35101
35131
|
hop: 0,
|
|
35102
35132
|
updates: args.updateBaselines === true,
|
|
35103
35133
|
platform: callPlatform(args)
|
|
@@ -35126,31 +35156,31 @@ async function collectStepMembers(args, opts, recordingDirFor = e2eDirFor) {
|
|
|
35126
35156
|
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || !isResolvedAbsolute2(projectRoot) || step === void 0) {
|
|
35127
35157
|
return [];
|
|
35128
35158
|
}
|
|
35129
|
-
const recording =
|
|
35159
|
+
const recording = path12.join(recordingDirFor(projectRoot), `${name}.yaml`);
|
|
35130
35160
|
const collector = memberCollector(
|
|
35131
35161
|
await closureRoots(recording, (await landing(recording)).canonical, projectRoot),
|
|
35132
35162
|
opts
|
|
35133
35163
|
);
|
|
35134
35164
|
await collector.toolFiles(step);
|
|
35135
35165
|
if (canonicalToolId(step.tool) === "e2e-execute") {
|
|
35136
|
-
const self = await collector.flow(
|
|
35166
|
+
const self = await collector.flow(path12.dirname(recording), path12.basename(recording));
|
|
35137
35167
|
let runArgs = step.args;
|
|
35138
35168
|
const named = nestedFlowTarget(runArgs);
|
|
35139
35169
|
if (named?.kind === "e2e_test_path") {
|
|
35140
|
-
const stem =
|
|
35141
|
-
const base =
|
|
35142
|
-
const dir =
|
|
35143
|
-
const recordingDir =
|
|
35170
|
+
const stem = path12.basename(named.path, ".yaml");
|
|
35171
|
+
const base = path12.basename(named.path);
|
|
35172
|
+
const dir = path12.resolve(path12.dirname(named.path));
|
|
35173
|
+
const recordingDir = path12.dirname(recording);
|
|
35144
35174
|
const dirs = [recordingDir, ...e2eRunFallbackDirs(recordingDir, base)];
|
|
35145
|
-
if (dirs.some((d) =>
|
|
35146
|
-
await collector.flow(
|
|
35175
|
+
if (dirs.some((d) => path12.resolve(d) === dir)) {
|
|
35176
|
+
await collector.flow(path12.dirname(named.path), base);
|
|
35147
35177
|
runArgs = { ...runArgs, name: stem };
|
|
35148
35178
|
delete runArgs.e2e_test_path;
|
|
35149
35179
|
}
|
|
35150
35180
|
}
|
|
35151
35181
|
const target = nestedFlowTarget(runArgs);
|
|
35152
35182
|
if (target?.kind === "name") {
|
|
35153
|
-
await collector.flow(
|
|
35183
|
+
await collector.flow(path12.dirname(self.member.canonical), `${target.name}.yaml`);
|
|
35154
35184
|
const run = await collector.nestedRun(
|
|
35155
35185
|
target,
|
|
35156
35186
|
0,
|
|
@@ -35344,10 +35374,10 @@ function assertFiniteNumbers(args) {
|
|
|
35344
35374
|
if (typeof item === "object" && item !== null) {
|
|
35345
35375
|
pending.push({ value: item, key, parent: visit });
|
|
35346
35376
|
} else if (typeof item === "number" && !Number.isFinite(item)) {
|
|
35347
|
-
const
|
|
35348
|
-
for (let at = visit; at.parent; at = at.parent)
|
|
35349
|
-
|
|
35350
|
-
issues.push({ code: "invalid_type", path:
|
|
35377
|
+
const path19 = [key];
|
|
35378
|
+
for (let at = visit; at.parent; at = at.parent) path19.push(at.key);
|
|
35379
|
+
path19.reverse();
|
|
35380
|
+
issues.push({ code: "invalid_type", path: path19, message: `expected a number, got ${item}` });
|
|
35351
35381
|
if (issues.length === MAX_NON_FINITE_ISSUES) break;
|
|
35352
35382
|
}
|
|
35353
35383
|
}
|
|
@@ -35532,7 +35562,7 @@ function createToolsClient(options = {}) {
|
|
|
35532
35562
|
log: diagnose,
|
|
35533
35563
|
baselineDirs,
|
|
35534
35564
|
collectMembers: collectFlowMembers,
|
|
35535
|
-
collectStepMembers: olderServer ? (record2, o) => collectStepMembers(record2, o, (root) =>
|
|
35565
|
+
collectStepMembers: olderServer ? (record2, o) => collectStepMembers(record2, o, (root) => path13.join(root, LEGACY_E2E_DIRS[0])) : collectStepMembers,
|
|
35536
35566
|
toolFileInputs: (tool) => findTool(tools, tool)?.fileInputs,
|
|
35537
35567
|
signal: opts?.signal
|
|
35538
35568
|
});
|
|
@@ -35545,7 +35575,7 @@ function createToolsClient(options = {}) {
|
|
|
35545
35575
|
}
|
|
35546
35576
|
if (filesLogEnabled()) {
|
|
35547
35577
|
for (const file of applied.written) {
|
|
35548
|
-
if (baselineDirs.includes(
|
|
35578
|
+
if (baselineDirs.includes(path13.dirname(file))) {
|
|
35549
35579
|
diagnose(`[e2e-files] baseline ${file}: written`);
|
|
35550
35580
|
}
|
|
35551
35581
|
}
|
|
@@ -35689,7 +35719,7 @@ import {
|
|
|
35689
35719
|
} from "node:fs/promises";
|
|
35690
35720
|
import { constants as fsConstants } from "node:fs";
|
|
35691
35721
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
35692
|
-
import { basename as basename7,
|
|
35722
|
+
import { basename as basename7, extname as extname2, isAbsolute as isAbsolute6, join as join14, normalize as normalize2, resolve as resolve11, sep as sep5 } from "node:path";
|
|
35693
35723
|
import { createHash as createHash3 } from "node:crypto";
|
|
35694
35724
|
var ARTIFACT_MARKER2 = "__argentArtifact";
|
|
35695
35725
|
function isArtifactHandle(value) {
|
|
@@ -35713,16 +35743,16 @@ function projectSlug() {
|
|
|
35713
35743
|
return `${name}-${hash}`;
|
|
35714
35744
|
}
|
|
35715
35745
|
function artifactsRoot() {
|
|
35716
|
-
return process.env.ARGENT_ARTIFACTS_DIR ??
|
|
35746
|
+
return process.env.ARGENT_ARTIFACTS_DIR ?? join14(tmpdir2(), "argent-artifacts");
|
|
35717
35747
|
}
|
|
35718
35748
|
function artifactDir(deviceId) {
|
|
35719
35749
|
const parts = [artifactsRoot(), projectSlug(), sessionId()];
|
|
35720
35750
|
if (deviceId) parts.push(sanitizeSegment(deviceId));
|
|
35721
|
-
return
|
|
35751
|
+
return join14(...parts);
|
|
35722
35752
|
}
|
|
35723
35753
|
function durableBaseDir() {
|
|
35724
35754
|
const projectRoot = findProjectRoot(process.cwd());
|
|
35725
|
-
return projectRoot ??
|
|
35755
|
+
return projectRoot ?? resolveHomeDir();
|
|
35726
35756
|
}
|
|
35727
35757
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
|
|
35728
35758
|
var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
|
|
@@ -35736,9 +35766,9 @@ function configuredRecordingsDir() {
|
|
|
35736
35766
|
if (typeof value !== "string") return null;
|
|
35737
35767
|
const trimmed = value.trim();
|
|
35738
35768
|
if (trimmed === "") return null;
|
|
35739
|
-
const home =
|
|
35740
|
-
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep5}`) ?
|
|
35741
|
-
return
|
|
35769
|
+
const home = resolveHomeDir();
|
|
35770
|
+
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep5}`) ? join14(home, trimmed.slice(2)) : trimmed;
|
|
35771
|
+
return resolve11(durableBaseDir(), expanded);
|
|
35742
35772
|
}
|
|
35743
35773
|
var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
|
|
35744
35774
|
async function readCapped(res, cap) {
|
|
@@ -35771,10 +35801,10 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
35771
35801
|
const stem = filename.slice(0, filename.length - ext.length);
|
|
35772
35802
|
for (let i = 1; i <= 1e3; i++) {
|
|
35773
35803
|
const candidate = i === 1 ? filename : `${stem} (${i})${ext}`;
|
|
35774
|
-
const
|
|
35804
|
+
const path19 = join14(dir, candidate);
|
|
35775
35805
|
try {
|
|
35776
|
-
await write(
|
|
35777
|
-
return
|
|
35806
|
+
await write(path19);
|
|
35807
|
+
return path19;
|
|
35778
35808
|
} catch (err) {
|
|
35779
35809
|
if (err?.code === "EEXIST") continue;
|
|
35780
35810
|
throw err;
|
|
@@ -35794,21 +35824,21 @@ function durableSaveTarget(handle) {
|
|
|
35794
35824
|
if (configured) {
|
|
35795
35825
|
return {
|
|
35796
35826
|
dir: configured,
|
|
35797
|
-
path:
|
|
35827
|
+
path: join14(configured, sanitizeSegment(handle.filename)),
|
|
35798
35828
|
base: configured,
|
|
35799
35829
|
rel: ""
|
|
35800
35830
|
};
|
|
35801
35831
|
}
|
|
35802
35832
|
}
|
|
35803
35833
|
const base = durableBaseDir();
|
|
35804
|
-
const dir =
|
|
35805
|
-
return { dir, path:
|
|
35834
|
+
const dir = join14(base, rel);
|
|
35835
|
+
return { dir, path: join14(dir, sanitizeSegment(handle.filename)), base, rel };
|
|
35806
35836
|
}
|
|
35807
35837
|
async function confineToRealBase(dir, base, rel) {
|
|
35808
35838
|
try {
|
|
35809
35839
|
const realDir = await realpath4(dir);
|
|
35810
35840
|
const realBase = await realpath4(base);
|
|
35811
|
-
return realDir ===
|
|
35841
|
+
return realDir === join14(realBase, rel);
|
|
35812
35842
|
} catch {
|
|
35813
35843
|
return false;
|
|
35814
35844
|
}
|
|
@@ -35832,9 +35862,9 @@ async function resolveLocalFile(handle) {
|
|
|
35832
35862
|
}
|
|
35833
35863
|
async function downloadAndExtractArchive(handle, data, dir, signal) {
|
|
35834
35864
|
signal?.throwIfAborted();
|
|
35835
|
-
const attemptDir = await mkdtemp(
|
|
35836
|
-
const tarball =
|
|
35837
|
-
const extractDir =
|
|
35865
|
+
const attemptDir = await mkdtemp(join14(dir, "bundle-"));
|
|
35866
|
+
const tarball = join14(attemptDir, "download.tar");
|
|
35867
|
+
const extractDir = join14(attemptDir, "files");
|
|
35838
35868
|
try {
|
|
35839
35869
|
await writeFile4(tarball, data, { signal });
|
|
35840
35870
|
await mkdir4(extractDir);
|
|
@@ -35934,7 +35964,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
35934
35964
|
return await downloadAndExtractArchive(value, data, dir, ctx.signal);
|
|
35935
35965
|
}
|
|
35936
35966
|
if (value.size > 0 && data.length !== value.size) return null;
|
|
35937
|
-
const downloadedPath =
|
|
35967
|
+
const downloadedPath = join14(dir, sanitizeSegment(value.filename));
|
|
35938
35968
|
await writeFile4(downloadedPath, data);
|
|
35939
35969
|
if (value.mimeType.startsWith("image/")) {
|
|
35940
35970
|
images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
|
|
@@ -35968,10 +35998,10 @@ function getDeviceIdFromArgs(args) {
|
|
|
35968
35998
|
}
|
|
35969
35999
|
|
|
35970
36000
|
// ../telemetry/src/debug.ts
|
|
35971
|
-
import * as
|
|
36001
|
+
import * as fs9 from "node:fs";
|
|
35972
36002
|
|
|
35973
36003
|
// ../telemetry/src/paths.ts
|
|
35974
|
-
import * as
|
|
36004
|
+
import * as path14 from "node:path";
|
|
35975
36005
|
|
|
35976
36006
|
// ../telemetry/src/events.ts
|
|
35977
36007
|
var PLATFORMS = [
|
|
@@ -36296,37 +36326,37 @@ var ALLOWED = {
|
|
|
36296
36326
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
36297
36327
|
|
|
36298
36328
|
// ../telemetry/src/cloud-agent-detect.ts
|
|
36299
|
-
import { existsSync as
|
|
36329
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
36300
36330
|
|
|
36301
36331
|
// ../telemetry/src/base-props.ts
|
|
36302
36332
|
var SESSION_ID2 = randomUUID5();
|
|
36303
36333
|
|
|
36304
36334
|
// ../telemetry/src/identity.ts
|
|
36305
36335
|
import * as crypto2 from "node:crypto";
|
|
36306
|
-
import * as
|
|
36307
|
-
import * as
|
|
36336
|
+
import * as fs10 from "node:fs";
|
|
36337
|
+
import * as path15 from "node:path";
|
|
36308
36338
|
|
|
36309
36339
|
// ../telemetry/src/fingerprint.ts
|
|
36310
36340
|
import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_process";
|
|
36311
36341
|
|
|
36312
36342
|
// ../native-devtools-ios/src/index.ts
|
|
36313
|
-
import * as
|
|
36314
|
-
import * as
|
|
36315
|
-
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ??
|
|
36316
|
-
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ??
|
|
36317
|
-
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ??
|
|
36318
|
-
var DYLIB_TVOS_DIR =
|
|
36343
|
+
import * as path16 from "node:path";
|
|
36344
|
+
import * as fs11 from "node:fs";
|
|
36345
|
+
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path16.join(__dirname, "..", "dylibs");
|
|
36346
|
+
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path16.join(__dirname, "..", "bin");
|
|
36347
|
+
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path16.join(DYLIB_DIR, "tcp");
|
|
36348
|
+
var DYLIB_TVOS_DIR = path16.join(DYLIB_DIR, "tvos");
|
|
36319
36349
|
|
|
36320
36350
|
// ../telemetry/src/consent.ts
|
|
36321
|
-
import * as
|
|
36322
|
-
import * as
|
|
36351
|
+
import * as fs12 from "node:fs";
|
|
36352
|
+
import * as path17 from "node:path";
|
|
36323
36353
|
var cache = /* @__PURE__ */ new Map();
|
|
36324
36354
|
var sessionOverride = null;
|
|
36325
36355
|
function readConfigOverrideAt(filePath) {
|
|
36326
36356
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
36327
36357
|
let stats;
|
|
36328
36358
|
try {
|
|
36329
|
-
stats =
|
|
36359
|
+
stats = fs12.lstatSync(filePath);
|
|
36330
36360
|
} catch {
|
|
36331
36361
|
cache.set(filePath, miss);
|
|
36332
36362
|
return null;
|
|
@@ -36343,7 +36373,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
36343
36373
|
}
|
|
36344
36374
|
let parsedEnabled = null;
|
|
36345
36375
|
try {
|
|
36346
|
-
const raw2 =
|
|
36376
|
+
const raw2 = fs12.readFileSync(filePath, "utf8");
|
|
36347
36377
|
const json = JSON.parse(raw2);
|
|
36348
36378
|
if (json && typeof json === "object") {
|
|
36349
36379
|
const t = json.telemetry;
|
|
@@ -36360,8 +36390,12 @@ function readConfigOverrideAt(filePath) {
|
|
|
36360
36390
|
function readPersistedConsent(cwd) {
|
|
36361
36391
|
const globalPath = configFilePath("global");
|
|
36362
36392
|
const projectPath = configFilePath("project", { cwd });
|
|
36393
|
+
const userConfigPath = path17.join(resolveHomeDir(), ".argent", "config.json");
|
|
36394
|
+
if (userConfigPath !== globalPath && readConfigOverrideAt(userConfigPath) === false) {
|
|
36395
|
+
return { enabled: false, detail: `${userConfigPath} (user)` };
|
|
36396
|
+
}
|
|
36363
36397
|
const global = readConfigOverrideAt(globalPath);
|
|
36364
|
-
const projectRoot =
|
|
36398
|
+
const projectRoot = path17.dirname(path17.dirname(projectPath));
|
|
36365
36399
|
const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
|
|
36366
36400
|
if (project === false && global === false) {
|
|
36367
36401
|
return { enabled: false, detail: "config.json (project and global)" };
|
|
@@ -36741,8 +36775,13 @@ async function flowRunToMcpContent(result, ctx) {
|
|
|
36741
36775
|
});
|
|
36742
36776
|
if (typeof result.warning === "string")
|
|
36743
36777
|
blocks.push({ type: "text", text: `\u26A0 ${result.warning}` });
|
|
36778
|
+
let inShutdown = false;
|
|
36744
36779
|
for (let i = 0; i < result.steps.length; i++) {
|
|
36745
36780
|
const step = result.steps[i];
|
|
36781
|
+
if (step.shutdown === true && !inShutdown) {
|
|
36782
|
+
inShutdown = true;
|
|
36783
|
+
blocks.push({ type: "text", text: "shutdown:" });
|
|
36784
|
+
}
|
|
36746
36785
|
const num = step.index !== void 0 ? step.index + 1 : i + 1;
|
|
36747
36786
|
const glyph = step.status ? `${STATUS_GLYPH[step.status] ?? "\u2022"} ` : "";
|
|
36748
36787
|
const reason = step.reason ?? step.error;
|
|
@@ -36769,11 +36808,17 @@ async function flowRunToMcpContent(result, ctx) {
|
|
|
36769
36808
|
}
|
|
36770
36809
|
}
|
|
36771
36810
|
for (const write of result.baselineWrites ?? []) {
|
|
36772
|
-
const { path:
|
|
36773
|
-
if (typeof
|
|
36774
|
-
blocks.push({ type: "text", text: `\u2717 baseline not written: ${
|
|
36811
|
+
const { path: path19, error: error2 } = isRecord3(write) ? write : {};
|
|
36812
|
+
if (typeof path19 === "string" && typeof error2 === "string") {
|
|
36813
|
+
blocks.push({ type: "text", text: `\u2717 baseline not written: ${path19}: ${error2}` });
|
|
36775
36814
|
}
|
|
36776
36815
|
}
|
|
36816
|
+
if (result.shutdownFailed === true) {
|
|
36817
|
+
blocks.push({
|
|
36818
|
+
type: "text",
|
|
36819
|
+
text: "\u26A0 shutdown did not finish: a shutdown step failed, so the run may have left state behind."
|
|
36820
|
+
});
|
|
36821
|
+
}
|
|
36777
36822
|
if (result.ok !== void 0) {
|
|
36778
36823
|
const counted = (result.passed ?? 0) + (result.failed ?? 0) + (result.errored ?? 0) + (result.skipped ?? 0);
|
|
36779
36824
|
const note = result.ok && counted === 0 ? " (no test steps)" : "";
|
|
@@ -37817,15 +37862,15 @@ function debuggerLogRegistryText(result) {
|
|
|
37817
37862
|
}
|
|
37818
37863
|
|
|
37819
37864
|
// ../argent-mcp/src/instructions.ts
|
|
37820
|
-
var SERVER_INSTRUCTIONS = "Argent
|
|
37865
|
+
var SERVER_INSTRUCTIONS = "Argent controls iOS, Android, Chromium, Mac, TV, and HarmonyOS apps. Use the platform named by the user; otherwise prefer an already-running device from `list-devices` (do not default to iOS). In a single-platform project, boot that platform. Prefer Argent tools over raw `xcrun`/`adb`; use `launch-app`/`open-url` instead of tapping home-screen icons. Load `argent-create-e2e` (`argent-qa-e2e` for acceptance tests) before the first action if an e2e test may be needed (recording is not retroactive), and load the matching `argent-*` skill before React Native build/debug, profiling, physical phone, Mac app, or TV work. Interaction tools return a screenshot + accessibility tree with normalized [0,1] tap frames (or an unchanged note / `-`+`+` diff referencing an earlier screenshot/tree id). Take tap coordinates from that tree \u2014 never guess from pixels \u2014 and call `describe` only without a fresh tree. After two failed taps, re-discover. Use `await-ui-element` instead of polling. Do not stop simulator servers when finishing; call `stop-all-simulator-servers` only when asked to clean up or when a skill tells you to recycle a device's services, scoped with `devices: [...]` (the tool-server is shared across agents), and never stop a user-started Metro. CLI: `argent --help`.";
|
|
37821
37866
|
|
|
37822
37867
|
// ../argent-mcp/src/installed-version.ts
|
|
37823
|
-
import * as
|
|
37824
|
-
import * as
|
|
37868
|
+
import * as fs13 from "node:fs";
|
|
37869
|
+
import * as path18 from "node:path";
|
|
37825
37870
|
function getInstalledVersion() {
|
|
37826
37871
|
try {
|
|
37827
|
-
const pkgPath =
|
|
37828
|
-
const pkg = JSON.parse(
|
|
37872
|
+
const pkgPath = path18.resolve(import.meta.dirname, "..", "package.json");
|
|
37873
|
+
const pkg = JSON.parse(fs13.readFileSync(pkgPath, "utf8"));
|
|
37829
37874
|
return pkg.version ?? "unknown";
|
|
37830
37875
|
} catch {
|
|
37831
37876
|
return "unknown";
|
|
@@ -37880,9 +37925,9 @@ async function untilAborted(work, signal) {
|
|
|
37880
37925
|
}
|
|
37881
37926
|
let onAbort = () => {
|
|
37882
37927
|
};
|
|
37883
|
-
const aborted2 = new Promise((
|
|
37884
|
-
onAbort =
|
|
37885
|
-
if (signal.aborted)
|
|
37928
|
+
const aborted2 = new Promise((resolve13) => {
|
|
37929
|
+
onAbort = resolve13;
|
|
37930
|
+
if (signal.aborted) resolve13();
|
|
37886
37931
|
else signal.addEventListener("abort", onAbort, { once: true });
|
|
37887
37932
|
});
|
|
37888
37933
|
try {
|
|
@@ -37943,6 +37988,94 @@ function createToolCaller(deps) {
|
|
|
37943
37988
|
};
|
|
37944
37989
|
}
|
|
37945
37990
|
|
|
37991
|
+
// ../argent-mcp/src/call-log.ts
|
|
37992
|
+
import {
|
|
37993
|
+
appendFileSync as appendFileSync2,
|
|
37994
|
+
chmodSync as chmodSync2,
|
|
37995
|
+
linkSync as linkSync2,
|
|
37996
|
+
mkdirSync as mkdirSync6,
|
|
37997
|
+
readFileSync as readFileSync8,
|
|
37998
|
+
renameSync as renameSync4,
|
|
37999
|
+
rmSync as rmSync3,
|
|
38000
|
+
statSync as statSync4
|
|
38001
|
+
} from "node:fs";
|
|
38002
|
+
import { appendFile } from "node:fs/promises";
|
|
38003
|
+
import { dirname as dirname10 } from "node:path";
|
|
38004
|
+
var CALL_LOG_MAX_BYTES = 10 * 1024 * 1024;
|
|
38005
|
+
var STAT_EVERY_BYTES = 1024 * 1024;
|
|
38006
|
+
function createCallLog(file, maxBytes = CALL_LOG_MAX_BYTES) {
|
|
38007
|
+
let dirReady = false;
|
|
38008
|
+
let checked = false;
|
|
38009
|
+
let estimate = 0;
|
|
38010
|
+
let sinceStat = 0;
|
|
38011
|
+
function check() {
|
|
38012
|
+
sinceStat = 0;
|
|
38013
|
+
estimate = 0;
|
|
38014
|
+
const st = statSync4(file, { throwIfNoEntry: false });
|
|
38015
|
+
if (!st) return;
|
|
38016
|
+
if (st.mode & 63) {
|
|
38017
|
+
try {
|
|
38018
|
+
chmodSync2(file, st.mode & 448);
|
|
38019
|
+
} catch {
|
|
38020
|
+
}
|
|
38021
|
+
}
|
|
38022
|
+
if (st.size < maxBytes) {
|
|
38023
|
+
estimate = st.size;
|
|
38024
|
+
return;
|
|
38025
|
+
}
|
|
38026
|
+
rotate(file, st);
|
|
38027
|
+
}
|
|
38028
|
+
return async function write(entry) {
|
|
38029
|
+
try {
|
|
38030
|
+
if (!dirReady) {
|
|
38031
|
+
mkdirSync6(dirname10(file), { recursive: true, mode: 448 });
|
|
38032
|
+
dirReady = true;
|
|
38033
|
+
}
|
|
38034
|
+
if (!checked || estimate >= maxBytes || sinceStat >= STAT_EVERY_BYTES) {
|
|
38035
|
+
checked = true;
|
|
38036
|
+
check();
|
|
38037
|
+
}
|
|
38038
|
+
const line = JSON.stringify(entry) + "\n";
|
|
38039
|
+
const bytes = Buffer.byteLength(line);
|
|
38040
|
+
estimate += bytes;
|
|
38041
|
+
sinceStat += bytes;
|
|
38042
|
+
await appendFile(file, line, { mode: 384 });
|
|
38043
|
+
} catch {
|
|
38044
|
+
}
|
|
38045
|
+
};
|
|
38046
|
+
}
|
|
38047
|
+
function rotate(file, measured) {
|
|
38048
|
+
const aside = `${file}.${process.pid}.rotating`;
|
|
38049
|
+
try {
|
|
38050
|
+
renameSync4(file, aside);
|
|
38051
|
+
} catch {
|
|
38052
|
+
return;
|
|
38053
|
+
}
|
|
38054
|
+
let moved;
|
|
38055
|
+
try {
|
|
38056
|
+
moved = statSync4(aside);
|
|
38057
|
+
} catch {
|
|
38058
|
+
return;
|
|
38059
|
+
}
|
|
38060
|
+
if (moved.ino === measured.ino && moved.dev === measured.dev) {
|
|
38061
|
+
try {
|
|
38062
|
+
renameSync4(aside, `${file}.1`);
|
|
38063
|
+
} catch {
|
|
38064
|
+
}
|
|
38065
|
+
return;
|
|
38066
|
+
}
|
|
38067
|
+
try {
|
|
38068
|
+
linkSync2(aside, file);
|
|
38069
|
+
} catch {
|
|
38070
|
+
try {
|
|
38071
|
+
appendFileSync2(file, readFileSync8(aside), { mode: 384 });
|
|
38072
|
+
} catch {
|
|
38073
|
+
return;
|
|
38074
|
+
}
|
|
38075
|
+
}
|
|
38076
|
+
rmSync3(aside, { force: true });
|
|
38077
|
+
}
|
|
38078
|
+
|
|
37946
38079
|
// ../argent-mcp/src/whats-new.ts
|
|
37947
38080
|
var import_semver = __toESM(require_semver2(), 1);
|
|
37948
38081
|
|
|
@@ -37987,11 +38120,15 @@ function formatWhatsNewNote(version2, highlights) {
|
|
|
37987
38120
|
].join("\n");
|
|
37988
38121
|
}
|
|
37989
38122
|
function takeWhatsNewNote(current) {
|
|
37990
|
-
|
|
37991
|
-
|
|
37992
|
-
|
|
37993
|
-
|
|
37994
|
-
|
|
38123
|
+
let seen = getWhatsNewSeenVersion();
|
|
38124
|
+
while (isNewerThanSeen(current, seen)) {
|
|
38125
|
+
if (setWhatsNewSeenVersion(current, { ifSeen: seen })) {
|
|
38126
|
+
const highlights = highlightsSince(seen, current);
|
|
38127
|
+
return highlights.length > 0 ? formatWhatsNewNote(current, highlights) : void 0;
|
|
38128
|
+
}
|
|
38129
|
+
seen = getWhatsNewSeenVersion();
|
|
38130
|
+
}
|
|
38131
|
+
return void 0;
|
|
37995
38132
|
}
|
|
37996
38133
|
|
|
37997
38134
|
// ../argent-mcp/src/mcp-server.ts
|
|
@@ -38017,6 +38154,8 @@ async function startMcpServer(options) {
|
|
|
38017
38154
|
const autoScreenshotOn = autoScreenshotEnabled();
|
|
38018
38155
|
const autoDescribeOn = autoDescribeEnabled();
|
|
38019
38156
|
const whatsNewOn = whatsNewEnabled();
|
|
38157
|
+
const installedVersion = getInstalledVersion();
|
|
38158
|
+
const highlightsVersion = true ? "0.35.1-next.41" : installedVersion;
|
|
38020
38159
|
const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
|
|
38021
38160
|
const trees = createTreeMemory();
|
|
38022
38161
|
const screenshots = createScreenshotMemory();
|
|
@@ -38061,18 +38200,8 @@ async function startMcpServer(options) {
|
|
|
38061
38200
|
}
|
|
38062
38201
|
return reconnectPromise;
|
|
38063
38202
|
}
|
|
38064
|
-
const LOG_FILE2 = process.env.ARGENT_MCP_LOG ??
|
|
38065
|
-
|
|
38066
|
-
async function spyLog(entry) {
|
|
38067
|
-
try {
|
|
38068
|
-
if (!logDirReady) {
|
|
38069
|
-
await mkdir5(dirname11(LOG_FILE2), { recursive: true });
|
|
38070
|
-
logDirReady = true;
|
|
38071
|
-
}
|
|
38072
|
-
await appendFile(LOG_FILE2, JSON.stringify(entry) + "\n");
|
|
38073
|
-
} catch {
|
|
38074
|
-
}
|
|
38075
|
-
}
|
|
38203
|
+
const LOG_FILE2 = process.env.ARGENT_MCP_LOG ?? join19(argentHomeDir(), "mcp-calls.log");
|
|
38204
|
+
const spyLog = createCallLog(LOG_FILE2);
|
|
38076
38205
|
const { fetchTools, callTool } = createToolCaller({
|
|
38077
38206
|
getHandle: () => ({ url: TOOLS_URL, token: AUTH_TOKEN }),
|
|
38078
38207
|
remote,
|
|
@@ -38183,14 +38312,14 @@ ${shown.text}` }];
|
|
|
38183
38312
|
if (!whatsNewOn || whatsNewChecked) return [];
|
|
38184
38313
|
whatsNewChecked = true;
|
|
38185
38314
|
try {
|
|
38186
|
-
const note = takeWhatsNewNote(
|
|
38315
|
+
const note = takeWhatsNewNote(highlightsVersion);
|
|
38187
38316
|
return note ? [{ type: "text", text: note }] : [];
|
|
38188
38317
|
} catch {
|
|
38189
38318
|
return [];
|
|
38190
38319
|
}
|
|
38191
38320
|
}
|
|
38192
38321
|
const server = new Server(
|
|
38193
|
-
{ name: "argent", version:
|
|
38322
|
+
{ name: "argent", version: installedVersion },
|
|
38194
38323
|
{
|
|
38195
38324
|
capabilities: { tools: {} },
|
|
38196
38325
|
instructions: SERVER_INSTRUCTIONS
|
|
@@ -38269,7 +38398,7 @@ ${shown.text}` }];
|
|
|
38269
38398
|
content = [...content, { type: "text", text: screenshotIdLine(id) }];
|
|
38270
38399
|
}
|
|
38271
38400
|
}
|
|
38272
|
-
if (udid && autoDescribeOn && canonicalToolId(params.name) === "describe") {
|
|
38401
|
+
if (udid && autoDescribeOn && canonicalToolId(params.name) === "describe" && params.arguments?.raw !== true) {
|
|
38273
38402
|
const tree = describedTree(result);
|
|
38274
38403
|
if (tree !== void 0) {
|
|
38275
38404
|
treeUdid = udid;
|