@swmansion/argent 0.35.1-next.9 → 0.35.1-next.90
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 +3275 -2158
- package/dist/cli.js +22 -3
- package/dist/cli.js.map +1 -1
- package/dist/client.js +844 -457
- package/dist/fatal-handlers.d.ts +1 -0
- package/dist/fatal-handlers.js +8 -2
- package/dist/fatal-handlers.js.map +1 -1
- package/dist/installer-help.js +4 -2
- package/dist/installer-help.js.map +1 -1
- package/dist/installer.mjs +823 -726
- package/dist/mcp-server.mjs +2107 -1563
- package/dist/tool-args.generated.d.ts +413 -326
- package/dist/tool-server.cjs +14071 -8488
- 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 +32 -5
- package/skills/argent-create-e2e/references/live-authoring.md +14 -4
- 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 +3 -2
- package/skills/argent-macos-app-interact/references/e2e.md +1 -0
- 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/installer.mjs
CHANGED
|
@@ -2052,7 +2052,7 @@ var require_parse = __commonJS({
|
|
|
2052
2052
|
"../../node_modules/semver/functions/parse.js"(exports, module) {
|
|
2053
2053
|
"use strict";
|
|
2054
2054
|
var SemVer = require_semver();
|
|
2055
|
-
var
|
|
2055
|
+
var parse6 = (version, options, throwErrors = false) => {
|
|
2056
2056
|
if (version instanceof SemVer) {
|
|
2057
2057
|
return version;
|
|
2058
2058
|
}
|
|
@@ -2065,7 +2065,7 @@ var require_parse = __commonJS({
|
|
|
2065
2065
|
throw er;
|
|
2066
2066
|
}
|
|
2067
2067
|
};
|
|
2068
|
-
module.exports =
|
|
2068
|
+
module.exports = parse6;
|
|
2069
2069
|
}
|
|
2070
2070
|
});
|
|
2071
2071
|
|
|
@@ -2073,9 +2073,9 @@ var require_parse = __commonJS({
|
|
|
2073
2073
|
var require_valid = __commonJS({
|
|
2074
2074
|
"../../node_modules/semver/functions/valid.js"(exports, module) {
|
|
2075
2075
|
"use strict";
|
|
2076
|
-
var
|
|
2076
|
+
var parse6 = require_parse();
|
|
2077
2077
|
var valid = (version, options) => {
|
|
2078
|
-
const v =
|
|
2078
|
+
const v = parse6(version, options);
|
|
2079
2079
|
return v ? v.version : null;
|
|
2080
2080
|
};
|
|
2081
2081
|
module.exports = valid;
|
|
@@ -2086,9 +2086,9 @@ var require_valid = __commonJS({
|
|
|
2086
2086
|
var require_clean = __commonJS({
|
|
2087
2087
|
"../../node_modules/semver/functions/clean.js"(exports, module) {
|
|
2088
2088
|
"use strict";
|
|
2089
|
-
var
|
|
2089
|
+
var parse6 = require_parse();
|
|
2090
2090
|
var clean = (version, options) => {
|
|
2091
|
-
const s =
|
|
2091
|
+
const s = parse6(version.trim().replace(/^[=v]+/, ""), options);
|
|
2092
2092
|
return s ? s.version : null;
|
|
2093
2093
|
};
|
|
2094
2094
|
module.exports = clean;
|
|
@@ -2123,10 +2123,10 @@ var require_inc = __commonJS({
|
|
|
2123
2123
|
var require_diff = __commonJS({
|
|
2124
2124
|
"../../node_modules/semver/functions/diff.js"(exports, module) {
|
|
2125
2125
|
"use strict";
|
|
2126
|
-
var
|
|
2126
|
+
var parse6 = require_parse();
|
|
2127
2127
|
var diff = (version1, version2) => {
|
|
2128
|
-
const v1 =
|
|
2129
|
-
const v2 =
|
|
2128
|
+
const v1 = parse6(version1, null, true);
|
|
2129
|
+
const v2 = parse6(version2, null, true);
|
|
2130
2130
|
const comparison = v1.compare(v2);
|
|
2131
2131
|
if (comparison === 0) {
|
|
2132
2132
|
return null;
|
|
@@ -2197,9 +2197,9 @@ var require_patch = __commonJS({
|
|
|
2197
2197
|
var require_prerelease = __commonJS({
|
|
2198
2198
|
"../../node_modules/semver/functions/prerelease.js"(exports, module) {
|
|
2199
2199
|
"use strict";
|
|
2200
|
-
var
|
|
2200
|
+
var parse6 = require_parse();
|
|
2201
2201
|
var prerelease = (version, options) => {
|
|
2202
|
-
const parsed =
|
|
2202
|
+
const parsed = parse6(version, options);
|
|
2203
2203
|
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
2204
2204
|
};
|
|
2205
2205
|
module.exports = prerelease;
|
|
@@ -2385,7 +2385,7 @@ var require_coerce = __commonJS({
|
|
|
2385
2385
|
"../../node_modules/semver/functions/coerce.js"(exports, module) {
|
|
2386
2386
|
"use strict";
|
|
2387
2387
|
var SemVer = require_semver();
|
|
2388
|
-
var
|
|
2388
|
+
var parse6 = require_parse();
|
|
2389
2389
|
var { safeRe: re2, t: t2 } = require_re();
|
|
2390
2390
|
var coerce = (version, options) => {
|
|
2391
2391
|
if (version instanceof SemVer) {
|
|
@@ -2420,7 +2420,7 @@ var require_coerce = __commonJS({
|
|
|
2420
2420
|
const patch = match[4] || "0";
|
|
2421
2421
|
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
2422
2422
|
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
2423
|
-
return
|
|
2423
|
+
return parse6(`${major2}.${minor}.${patch}${prerelease}${build}`, options);
|
|
2424
2424
|
};
|
|
2425
2425
|
module.exports = coerce;
|
|
2426
2426
|
}
|
|
@@ -2430,11 +2430,11 @@ var require_coerce = __commonJS({
|
|
|
2430
2430
|
var require_truncate = __commonJS({
|
|
2431
2431
|
"../../node_modules/semver/functions/truncate.js"(exports, module) {
|
|
2432
2432
|
"use strict";
|
|
2433
|
-
var
|
|
2434
|
-
var
|
|
2433
|
+
var parse6 = require_parse();
|
|
2434
|
+
var constants5 = require_constants();
|
|
2435
2435
|
var SemVer = require_semver();
|
|
2436
2436
|
var truncate = (version, truncation, options) => {
|
|
2437
|
-
if (!
|
|
2437
|
+
if (!constants5.RELEASE_TYPES.includes(truncation)) {
|
|
2438
2438
|
return null;
|
|
2439
2439
|
}
|
|
2440
2440
|
const clonedVersion = cloneInputVersion(version, options);
|
|
@@ -2442,7 +2442,7 @@ var require_truncate = __commonJS({
|
|
|
2442
2442
|
};
|
|
2443
2443
|
var cloneInputVersion = (version, options) => {
|
|
2444
2444
|
const versionStringToParse = version instanceof SemVer ? version.version : version;
|
|
2445
|
-
return
|
|
2445
|
+
return parse6(versionStringToParse, options);
|
|
2446
2446
|
};
|
|
2447
2447
|
var doTruncation = (version, truncation) => {
|
|
2448
2448
|
if (isPrerelease(truncation)) {
|
|
@@ -3483,10 +3483,10 @@ var require_semver2 = __commonJS({
|
|
|
3483
3483
|
"../../node_modules/semver/index.js"(exports, module) {
|
|
3484
3484
|
"use strict";
|
|
3485
3485
|
var internalRe = require_re();
|
|
3486
|
-
var
|
|
3486
|
+
var constants5 = require_constants();
|
|
3487
3487
|
var SemVer = require_semver();
|
|
3488
3488
|
var identifiers = require_identifiers();
|
|
3489
|
-
var
|
|
3489
|
+
var parse6 = require_parse();
|
|
3490
3490
|
var valid = require_valid();
|
|
3491
3491
|
var clean = require_clean();
|
|
3492
3492
|
var inc = require_inc();
|
|
@@ -3525,7 +3525,7 @@ var require_semver2 = __commonJS({
|
|
|
3525
3525
|
var simplifyRange = require_simplify();
|
|
3526
3526
|
var subset = require_subset();
|
|
3527
3527
|
module.exports = {
|
|
3528
|
-
parse:
|
|
3528
|
+
parse: parse6,
|
|
3529
3529
|
valid,
|
|
3530
3530
|
clean,
|
|
3531
3531
|
inc,
|
|
@@ -3567,8 +3567,8 @@ var require_semver2 = __commonJS({
|
|
|
3567
3567
|
re: internalRe.re,
|
|
3568
3568
|
src: internalRe.src,
|
|
3569
3569
|
tokens: internalRe.t,
|
|
3570
|
-
SEMVER_SPEC_VERSION:
|
|
3571
|
-
RELEASE_TYPES:
|
|
3570
|
+
SEMVER_SPEC_VERSION: constants5.SEMVER_SPEC_VERSION,
|
|
3571
|
+
RELEASE_TYPES: constants5.RELEASE_TYPES,
|
|
3572
3572
|
compareIdentifiers: identifiers.compareIdentifiers,
|
|
3573
3573
|
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
3574
3574
|
};
|
|
@@ -3652,17 +3652,17 @@ var require_visit = __commonJS({
|
|
|
3652
3652
|
visit2.BREAK = BREAK;
|
|
3653
3653
|
visit2.SKIP = SKIP;
|
|
3654
3654
|
visit2.REMOVE = REMOVE;
|
|
3655
|
-
function visit_(key, node, visitor,
|
|
3656
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
3655
|
+
function visit_(key, node, visitor, path35) {
|
|
3656
|
+
const ctrl = callVisitor(key, node, visitor, path35);
|
|
3657
3657
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
3658
|
-
replaceNode(key,
|
|
3659
|
-
return visit_(key, ctrl, visitor,
|
|
3658
|
+
replaceNode(key, path35, ctrl);
|
|
3659
|
+
return visit_(key, ctrl, visitor, path35);
|
|
3660
3660
|
}
|
|
3661
3661
|
if (typeof ctrl !== "symbol") {
|
|
3662
3662
|
if (identity2.isCollection(node)) {
|
|
3663
|
-
|
|
3663
|
+
path35 = Object.freeze(path35.concat(node));
|
|
3664
3664
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
3665
|
-
const ci = visit_(i2, node.items[i2], visitor,
|
|
3665
|
+
const ci = visit_(i2, node.items[i2], visitor, path35);
|
|
3666
3666
|
if (typeof ci === "number")
|
|
3667
3667
|
i2 = ci - 1;
|
|
3668
3668
|
else if (ci === BREAK)
|
|
@@ -3673,13 +3673,13 @@ var require_visit = __commonJS({
|
|
|
3673
3673
|
}
|
|
3674
3674
|
}
|
|
3675
3675
|
} else if (identity2.isPair(node)) {
|
|
3676
|
-
|
|
3677
|
-
const ck = visit_("key", node.key, visitor,
|
|
3676
|
+
path35 = Object.freeze(path35.concat(node));
|
|
3677
|
+
const ck = visit_("key", node.key, visitor, path35);
|
|
3678
3678
|
if (ck === BREAK)
|
|
3679
3679
|
return BREAK;
|
|
3680
3680
|
else if (ck === REMOVE)
|
|
3681
3681
|
node.key = null;
|
|
3682
|
-
const cv = visit_("value", node.value, visitor,
|
|
3682
|
+
const cv = visit_("value", node.value, visitor, path35);
|
|
3683
3683
|
if (cv === BREAK)
|
|
3684
3684
|
return BREAK;
|
|
3685
3685
|
else if (cv === REMOVE)
|
|
@@ -3700,17 +3700,17 @@ var require_visit = __commonJS({
|
|
|
3700
3700
|
visitAsync.BREAK = BREAK;
|
|
3701
3701
|
visitAsync.SKIP = SKIP;
|
|
3702
3702
|
visitAsync.REMOVE = REMOVE;
|
|
3703
|
-
async function visitAsync_(key, node, visitor,
|
|
3704
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
3703
|
+
async function visitAsync_(key, node, visitor, path35) {
|
|
3704
|
+
const ctrl = await callVisitor(key, node, visitor, path35);
|
|
3705
3705
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
3706
|
-
replaceNode(key,
|
|
3707
|
-
return visitAsync_(key, ctrl, visitor,
|
|
3706
|
+
replaceNode(key, path35, ctrl);
|
|
3707
|
+
return visitAsync_(key, ctrl, visitor, path35);
|
|
3708
3708
|
}
|
|
3709
3709
|
if (typeof ctrl !== "symbol") {
|
|
3710
3710
|
if (identity2.isCollection(node)) {
|
|
3711
|
-
|
|
3711
|
+
path35 = Object.freeze(path35.concat(node));
|
|
3712
3712
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
3713
|
-
const ci = await visitAsync_(i2, node.items[i2], visitor,
|
|
3713
|
+
const ci = await visitAsync_(i2, node.items[i2], visitor, path35);
|
|
3714
3714
|
if (typeof ci === "number")
|
|
3715
3715
|
i2 = ci - 1;
|
|
3716
3716
|
else if (ci === BREAK)
|
|
@@ -3721,13 +3721,13 @@ var require_visit = __commonJS({
|
|
|
3721
3721
|
}
|
|
3722
3722
|
}
|
|
3723
3723
|
} else if (identity2.isPair(node)) {
|
|
3724
|
-
|
|
3725
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
3724
|
+
path35 = Object.freeze(path35.concat(node));
|
|
3725
|
+
const ck = await visitAsync_("key", node.key, visitor, path35);
|
|
3726
3726
|
if (ck === BREAK)
|
|
3727
3727
|
return BREAK;
|
|
3728
3728
|
else if (ck === REMOVE)
|
|
3729
3729
|
node.key = null;
|
|
3730
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
3730
|
+
const cv = await visitAsync_("value", node.value, visitor, path35);
|
|
3731
3731
|
if (cv === BREAK)
|
|
3732
3732
|
return BREAK;
|
|
3733
3733
|
else if (cv === REMOVE)
|
|
@@ -3754,23 +3754,23 @@ var require_visit = __commonJS({
|
|
|
3754
3754
|
}
|
|
3755
3755
|
return visitor;
|
|
3756
3756
|
}
|
|
3757
|
-
function callVisitor(key, node, visitor,
|
|
3757
|
+
function callVisitor(key, node, visitor, path35) {
|
|
3758
3758
|
if (typeof visitor === "function")
|
|
3759
|
-
return visitor(key, node,
|
|
3759
|
+
return visitor(key, node, path35);
|
|
3760
3760
|
if (identity2.isMap(node))
|
|
3761
|
-
return visitor.Map?.(key, node,
|
|
3761
|
+
return visitor.Map?.(key, node, path35);
|
|
3762
3762
|
if (identity2.isSeq(node))
|
|
3763
|
-
return visitor.Seq?.(key, node,
|
|
3763
|
+
return visitor.Seq?.(key, node, path35);
|
|
3764
3764
|
if (identity2.isPair(node))
|
|
3765
|
-
return visitor.Pair?.(key, node,
|
|
3765
|
+
return visitor.Pair?.(key, node, path35);
|
|
3766
3766
|
if (identity2.isScalar(node))
|
|
3767
|
-
return visitor.Scalar?.(key, node,
|
|
3767
|
+
return visitor.Scalar?.(key, node, path35);
|
|
3768
3768
|
if (identity2.isAlias(node))
|
|
3769
|
-
return visitor.Alias?.(key, node,
|
|
3769
|
+
return visitor.Alias?.(key, node, path35);
|
|
3770
3770
|
return void 0;
|
|
3771
3771
|
}
|
|
3772
|
-
function replaceNode(key,
|
|
3773
|
-
const parent =
|
|
3772
|
+
function replaceNode(key, path35, node) {
|
|
3773
|
+
const parent = path35[path35.length - 1];
|
|
3774
3774
|
if (identity2.isCollection(parent)) {
|
|
3775
3775
|
parent.items[key] = node;
|
|
3776
3776
|
} else if (identity2.isPair(parent)) {
|
|
@@ -4382,10 +4382,10 @@ var require_Collection = __commonJS({
|
|
|
4382
4382
|
var createNode = require_createNode();
|
|
4383
4383
|
var identity2 = require_identity();
|
|
4384
4384
|
var Node = require_Node();
|
|
4385
|
-
function collectionFromPath(schema,
|
|
4385
|
+
function collectionFromPath(schema, path35, value) {
|
|
4386
4386
|
let v = value;
|
|
4387
|
-
for (let i2 =
|
|
4388
|
-
const k =
|
|
4387
|
+
for (let i2 = path35.length - 1; i2 >= 0; --i2) {
|
|
4388
|
+
const k = path35[i2];
|
|
4389
4389
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
4390
4390
|
const a2 = [];
|
|
4391
4391
|
a2[k] = v;
|
|
@@ -4404,7 +4404,7 @@ var require_Collection = __commonJS({
|
|
|
4404
4404
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
4405
4405
|
});
|
|
4406
4406
|
}
|
|
4407
|
-
var isEmptyPath = (
|
|
4407
|
+
var isEmptyPath = (path35) => path35 == null || typeof path35 === "object" && !!path35[Symbol.iterator]().next().done;
|
|
4408
4408
|
var Collection = class extends Node.NodeBase {
|
|
4409
4409
|
constructor(type, schema) {
|
|
4410
4410
|
super(type);
|
|
@@ -4434,11 +4434,11 @@ var require_Collection = __commonJS({
|
|
|
4434
4434
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
4435
4435
|
* that already exists in the map.
|
|
4436
4436
|
*/
|
|
4437
|
-
addIn(
|
|
4438
|
-
if (isEmptyPath(
|
|
4437
|
+
addIn(path35, value) {
|
|
4438
|
+
if (isEmptyPath(path35))
|
|
4439
4439
|
this.add(value);
|
|
4440
4440
|
else {
|
|
4441
|
-
const [key, ...rest] =
|
|
4441
|
+
const [key, ...rest] = path35;
|
|
4442
4442
|
const node = this.get(key, true);
|
|
4443
4443
|
if (identity2.isCollection(node))
|
|
4444
4444
|
node.addIn(rest, value);
|
|
@@ -4452,8 +4452,8 @@ var require_Collection = __commonJS({
|
|
|
4452
4452
|
* Removes a value from the collection.
|
|
4453
4453
|
* @returns `true` if the item was found and removed.
|
|
4454
4454
|
*/
|
|
4455
|
-
deleteIn(
|
|
4456
|
-
const [key, ...rest] =
|
|
4455
|
+
deleteIn(path35) {
|
|
4456
|
+
const [key, ...rest] = path35;
|
|
4457
4457
|
if (rest.length === 0)
|
|
4458
4458
|
return this.delete(key);
|
|
4459
4459
|
const node = this.get(key, true);
|
|
@@ -4467,8 +4467,8 @@ var require_Collection = __commonJS({
|
|
|
4467
4467
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
4468
4468
|
* `true` (collections are always returned intact).
|
|
4469
4469
|
*/
|
|
4470
|
-
getIn(
|
|
4471
|
-
const [key, ...rest] =
|
|
4470
|
+
getIn(path35, keepScalar) {
|
|
4471
|
+
const [key, ...rest] = path35;
|
|
4472
4472
|
const node = this.get(key, true);
|
|
4473
4473
|
if (rest.length === 0)
|
|
4474
4474
|
return !keepScalar && identity2.isScalar(node) ? node.value : node;
|
|
@@ -4486,8 +4486,8 @@ var require_Collection = __commonJS({
|
|
|
4486
4486
|
/**
|
|
4487
4487
|
* Checks if the collection includes a value with the key `key`.
|
|
4488
4488
|
*/
|
|
4489
|
-
hasIn(
|
|
4490
|
-
const [key, ...rest] =
|
|
4489
|
+
hasIn(path35) {
|
|
4490
|
+
const [key, ...rest] = path35;
|
|
4491
4491
|
if (rest.length === 0)
|
|
4492
4492
|
return this.has(key);
|
|
4493
4493
|
const node = this.get(key, true);
|
|
@@ -4497,8 +4497,8 @@ var require_Collection = __commonJS({
|
|
|
4497
4497
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
4498
4498
|
* boolean to add/remove the item from the set.
|
|
4499
4499
|
*/
|
|
4500
|
-
setIn(
|
|
4501
|
-
const [key, ...rest] =
|
|
4500
|
+
setIn(path35, value) {
|
|
4501
|
+
const [key, ...rest] = path35;
|
|
4502
4502
|
if (rest.length === 0) {
|
|
4503
4503
|
this.set(key, value);
|
|
4504
4504
|
} else {
|
|
@@ -7013,9 +7013,9 @@ var require_Document = __commonJS({
|
|
|
7013
7013
|
this.contents.add(value);
|
|
7014
7014
|
}
|
|
7015
7015
|
/** Adds a value to the document. */
|
|
7016
|
-
addIn(
|
|
7016
|
+
addIn(path35, value) {
|
|
7017
7017
|
if (assertCollection(this.contents))
|
|
7018
|
-
this.contents.addIn(
|
|
7018
|
+
this.contents.addIn(path35, value);
|
|
7019
7019
|
}
|
|
7020
7020
|
/**
|
|
7021
7021
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -7090,14 +7090,14 @@ var require_Document = __commonJS({
|
|
|
7090
7090
|
* Removes a value from the document.
|
|
7091
7091
|
* @returns `true` if the item was found and removed.
|
|
7092
7092
|
*/
|
|
7093
|
-
deleteIn(
|
|
7094
|
-
if (Collection.isEmptyPath(
|
|
7093
|
+
deleteIn(path35) {
|
|
7094
|
+
if (Collection.isEmptyPath(path35)) {
|
|
7095
7095
|
if (this.contents == null)
|
|
7096
7096
|
return false;
|
|
7097
7097
|
this.contents = null;
|
|
7098
7098
|
return true;
|
|
7099
7099
|
}
|
|
7100
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
7100
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path35) : false;
|
|
7101
7101
|
}
|
|
7102
7102
|
/**
|
|
7103
7103
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -7112,10 +7112,10 @@ var require_Document = __commonJS({
|
|
|
7112
7112
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
7113
7113
|
* `true` (collections are always returned intact).
|
|
7114
7114
|
*/
|
|
7115
|
-
getIn(
|
|
7116
|
-
if (Collection.isEmptyPath(
|
|
7115
|
+
getIn(path35, keepScalar) {
|
|
7116
|
+
if (Collection.isEmptyPath(path35))
|
|
7117
7117
|
return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
7118
|
-
return identity2.isCollection(this.contents) ? this.contents.getIn(
|
|
7118
|
+
return identity2.isCollection(this.contents) ? this.contents.getIn(path35, keepScalar) : void 0;
|
|
7119
7119
|
}
|
|
7120
7120
|
/**
|
|
7121
7121
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -7126,10 +7126,10 @@ var require_Document = __commonJS({
|
|
|
7126
7126
|
/**
|
|
7127
7127
|
* Checks if the document includes a value at `path`.
|
|
7128
7128
|
*/
|
|
7129
|
-
hasIn(
|
|
7130
|
-
if (Collection.isEmptyPath(
|
|
7129
|
+
hasIn(path35) {
|
|
7130
|
+
if (Collection.isEmptyPath(path35))
|
|
7131
7131
|
return this.contents !== void 0;
|
|
7132
|
-
return identity2.isCollection(this.contents) ? this.contents.hasIn(
|
|
7132
|
+
return identity2.isCollection(this.contents) ? this.contents.hasIn(path35) : false;
|
|
7133
7133
|
}
|
|
7134
7134
|
/**
|
|
7135
7135
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -7146,13 +7146,13 @@ var require_Document = __commonJS({
|
|
|
7146
7146
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
7147
7147
|
* boolean to add/remove the item from the set.
|
|
7148
7148
|
*/
|
|
7149
|
-
setIn(
|
|
7150
|
-
if (Collection.isEmptyPath(
|
|
7149
|
+
setIn(path35, value) {
|
|
7150
|
+
if (Collection.isEmptyPath(path35)) {
|
|
7151
7151
|
this.contents = value;
|
|
7152
7152
|
} else if (this.contents == null) {
|
|
7153
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
7153
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path35), value);
|
|
7154
7154
|
} else if (assertCollection(this.contents)) {
|
|
7155
|
-
this.contents.setIn(
|
|
7155
|
+
this.contents.setIn(path35, value);
|
|
7156
7156
|
}
|
|
7157
7157
|
}
|
|
7158
7158
|
/**
|
|
@@ -7538,10 +7538,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
7538
7538
|
let offset = bm.offset;
|
|
7539
7539
|
let commentEnd = null;
|
|
7540
7540
|
for (const collItem of bm.items) {
|
|
7541
|
-
const { start, key, sep:
|
|
7541
|
+
const { start, key, sep: sep10, value } = collItem;
|
|
7542
7542
|
const keyProps = resolveProps.resolveProps(start, {
|
|
7543
7543
|
indicator: "explicit-key-ind",
|
|
7544
|
-
next: key ??
|
|
7544
|
+
next: key ?? sep10?.[0],
|
|
7545
7545
|
offset,
|
|
7546
7546
|
onError,
|
|
7547
7547
|
parentIndent: bm.indent,
|
|
@@ -7555,7 +7555,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
7555
7555
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
7556
7556
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
7557
7557
|
}
|
|
7558
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
7558
|
+
if (!keyProps.anchor && !keyProps.tag && !sep10) {
|
|
7559
7559
|
commentEnd = keyProps.end;
|
|
7560
7560
|
if (keyProps.comment) {
|
|
7561
7561
|
if (map.comment)
|
|
@@ -7579,7 +7579,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
7579
7579
|
ctx.atKey = false;
|
|
7580
7580
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
7581
7581
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
7582
|
-
const valueProps = resolveProps.resolveProps(
|
|
7582
|
+
const valueProps = resolveProps.resolveProps(sep10 ?? [], {
|
|
7583
7583
|
indicator: "map-value-ind",
|
|
7584
7584
|
next: value,
|
|
7585
7585
|
offset: keyNode.range[2],
|
|
@@ -7595,7 +7595,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
7595
7595
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
7596
7596
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
7597
7597
|
}
|
|
7598
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
7598
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep10, null, valueProps, onError);
|
|
7599
7599
|
if (ctx.schema.compat)
|
|
7600
7600
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
7601
7601
|
offset = valueNode.range[2];
|
|
@@ -7686,7 +7686,7 @@ var require_resolve_end = __commonJS({
|
|
|
7686
7686
|
let comment = "";
|
|
7687
7687
|
if (end) {
|
|
7688
7688
|
let hasSpace = false;
|
|
7689
|
-
let
|
|
7689
|
+
let sep10 = "";
|
|
7690
7690
|
for (const token of end) {
|
|
7691
7691
|
const { source, type } = token;
|
|
7692
7692
|
switch (type) {
|
|
@@ -7700,13 +7700,13 @@ var require_resolve_end = __commonJS({
|
|
|
7700
7700
|
if (!comment)
|
|
7701
7701
|
comment = cb;
|
|
7702
7702
|
else
|
|
7703
|
-
comment +=
|
|
7704
|
-
|
|
7703
|
+
comment += sep10 + cb;
|
|
7704
|
+
sep10 = "";
|
|
7705
7705
|
break;
|
|
7706
7706
|
}
|
|
7707
7707
|
case "newline":
|
|
7708
7708
|
if (comment)
|
|
7709
|
-
|
|
7709
|
+
sep10 += source;
|
|
7710
7710
|
hasSpace = true;
|
|
7711
7711
|
break;
|
|
7712
7712
|
default:
|
|
@@ -7749,18 +7749,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7749
7749
|
let offset = fc.offset + fc.start.source.length;
|
|
7750
7750
|
for (let i2 = 0; i2 < fc.items.length; ++i2) {
|
|
7751
7751
|
const collItem = fc.items[i2];
|
|
7752
|
-
const { start, key, sep:
|
|
7752
|
+
const { start, key, sep: sep10, value } = collItem;
|
|
7753
7753
|
const props = resolveProps.resolveProps(start, {
|
|
7754
7754
|
flow: fcName,
|
|
7755
7755
|
indicator: "explicit-key-ind",
|
|
7756
|
-
next: key ??
|
|
7756
|
+
next: key ?? sep10?.[0],
|
|
7757
7757
|
offset,
|
|
7758
7758
|
onError,
|
|
7759
7759
|
parentIndent: fc.indent,
|
|
7760
7760
|
startOnNewline: false
|
|
7761
7761
|
});
|
|
7762
7762
|
if (!props.found) {
|
|
7763
|
-
if (!props.anchor && !props.tag && !
|
|
7763
|
+
if (!props.anchor && !props.tag && !sep10 && !value) {
|
|
7764
7764
|
if (i2 === 0 && props.comma)
|
|
7765
7765
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
7766
7766
|
else if (i2 < fc.items.length - 1)
|
|
@@ -7814,8 +7814,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7814
7814
|
}
|
|
7815
7815
|
}
|
|
7816
7816
|
}
|
|
7817
|
-
if (!isMap2 && !
|
|
7818
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
7817
|
+
if (!isMap2 && !sep10 && !props.found) {
|
|
7818
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep10, null, props, onError);
|
|
7819
7819
|
coll.items.push(valueNode);
|
|
7820
7820
|
offset = valueNode.range[2];
|
|
7821
7821
|
if (isBlock(value))
|
|
@@ -7827,7 +7827,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7827
7827
|
if (isBlock(key))
|
|
7828
7828
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
7829
7829
|
ctx.atKey = false;
|
|
7830
|
-
const valueProps = resolveProps.resolveProps(
|
|
7830
|
+
const valueProps = resolveProps.resolveProps(sep10 ?? [], {
|
|
7831
7831
|
flow: fcName,
|
|
7832
7832
|
indicator: "map-value-ind",
|
|
7833
7833
|
next: value,
|
|
@@ -7838,8 +7838,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7838
7838
|
});
|
|
7839
7839
|
if (valueProps.found) {
|
|
7840
7840
|
if (!isMap2 && !props.found && ctx.options.strict) {
|
|
7841
|
-
if (
|
|
7842
|
-
for (const st of
|
|
7841
|
+
if (sep10)
|
|
7842
|
+
for (const st of sep10) {
|
|
7843
7843
|
if (st === valueProps.found)
|
|
7844
7844
|
break;
|
|
7845
7845
|
if (st.type === "newline") {
|
|
@@ -7856,7 +7856,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7856
7856
|
else
|
|
7857
7857
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
7858
7858
|
}
|
|
7859
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
7859
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep10, null, valueProps, onError) : null;
|
|
7860
7860
|
if (valueNode) {
|
|
7861
7861
|
if (isBlock(value))
|
|
7862
7862
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -8036,7 +8036,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
8036
8036
|
chompStart = i2 + 1;
|
|
8037
8037
|
}
|
|
8038
8038
|
let value = "";
|
|
8039
|
-
let
|
|
8039
|
+
let sep10 = "";
|
|
8040
8040
|
let prevMoreIndented = false;
|
|
8041
8041
|
for (let i2 = 0; i2 < contentStart; ++i2)
|
|
8042
8042
|
value += lines[i2][0].slice(trimIndent) + "\n";
|
|
@@ -8053,24 +8053,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
8053
8053
|
indent = "";
|
|
8054
8054
|
}
|
|
8055
8055
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
8056
|
-
value +=
|
|
8057
|
-
|
|
8056
|
+
value += sep10 + indent.slice(trimIndent) + content;
|
|
8057
|
+
sep10 = "\n";
|
|
8058
8058
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
8059
|
-
if (
|
|
8060
|
-
|
|
8061
|
-
else if (!prevMoreIndented &&
|
|
8062
|
-
|
|
8063
|
-
value +=
|
|
8064
|
-
|
|
8059
|
+
if (sep10 === " ")
|
|
8060
|
+
sep10 = "\n";
|
|
8061
|
+
else if (!prevMoreIndented && sep10 === "\n")
|
|
8062
|
+
sep10 = "\n\n";
|
|
8063
|
+
value += sep10 + indent.slice(trimIndent) + content;
|
|
8064
|
+
sep10 = "\n";
|
|
8065
8065
|
prevMoreIndented = true;
|
|
8066
8066
|
} else if (content === "") {
|
|
8067
|
-
if (
|
|
8067
|
+
if (sep10 === "\n")
|
|
8068
8068
|
value += "\n";
|
|
8069
8069
|
else
|
|
8070
|
-
|
|
8070
|
+
sep10 = "\n";
|
|
8071
8071
|
} else {
|
|
8072
|
-
value +=
|
|
8073
|
-
|
|
8072
|
+
value += sep10 + content;
|
|
8073
|
+
sep10 = " ";
|
|
8074
8074
|
prevMoreIndented = false;
|
|
8075
8075
|
}
|
|
8076
8076
|
}
|
|
@@ -8253,25 +8253,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
8253
8253
|
trimBoth = /^[ \t]+|[ \t]+$/g;
|
|
8254
8254
|
}
|
|
8255
8255
|
let res = match[1].replace(trimEnd, "");
|
|
8256
|
-
let
|
|
8256
|
+
let sep10 = " ";
|
|
8257
8257
|
let pos = line.lastIndex;
|
|
8258
8258
|
while (match = line.exec(source)) {
|
|
8259
8259
|
const lm = match[1].replace(trimBoth, "");
|
|
8260
8260
|
if (lm === "") {
|
|
8261
|
-
if (
|
|
8262
|
-
res +=
|
|
8261
|
+
if (sep10 === "\n")
|
|
8262
|
+
res += sep10;
|
|
8263
8263
|
else
|
|
8264
|
-
|
|
8264
|
+
sep10 = "\n";
|
|
8265
8265
|
} else {
|
|
8266
|
-
res +=
|
|
8267
|
-
|
|
8266
|
+
res += sep10 + lm;
|
|
8267
|
+
sep10 = " ";
|
|
8268
8268
|
}
|
|
8269
8269
|
pos = line.lastIndex;
|
|
8270
8270
|
}
|
|
8271
8271
|
const last = /[ \t]*(.*)/sy;
|
|
8272
8272
|
last.lastIndex = pos;
|
|
8273
8273
|
match = last.exec(source);
|
|
8274
|
-
return res +
|
|
8274
|
+
return res + sep10 + (match?.[1] ?? "");
|
|
8275
8275
|
}
|
|
8276
8276
|
function doubleQuotedValue(source, onError) {
|
|
8277
8277
|
let res = "";
|
|
@@ -9081,14 +9081,14 @@ var require_cst_stringify = __commonJS({
|
|
|
9081
9081
|
}
|
|
9082
9082
|
}
|
|
9083
9083
|
}
|
|
9084
|
-
function stringifyItem({ start, key, sep:
|
|
9084
|
+
function stringifyItem({ start, key, sep: sep10, value }) {
|
|
9085
9085
|
let res = "";
|
|
9086
9086
|
for (const st of start)
|
|
9087
9087
|
res += st.source;
|
|
9088
9088
|
if (key)
|
|
9089
9089
|
res += stringifyToken(key);
|
|
9090
|
-
if (
|
|
9091
|
-
for (const st of
|
|
9090
|
+
if (sep10)
|
|
9091
|
+
for (const st of sep10)
|
|
9092
9092
|
res += st.source;
|
|
9093
9093
|
if (value)
|
|
9094
9094
|
res += stringifyToken(value);
|
|
@@ -9113,9 +9113,9 @@ var require_cst_visit = __commonJS({
|
|
|
9113
9113
|
visit2.BREAK = BREAK;
|
|
9114
9114
|
visit2.SKIP = SKIP;
|
|
9115
9115
|
visit2.REMOVE = REMOVE;
|
|
9116
|
-
visit2.itemAtPath = (cst,
|
|
9116
|
+
visit2.itemAtPath = (cst, path35) => {
|
|
9117
9117
|
let item = cst;
|
|
9118
|
-
for (const [field, index] of
|
|
9118
|
+
for (const [field, index] of path35) {
|
|
9119
9119
|
const tok = item?.[field];
|
|
9120
9120
|
if (tok && "items" in tok) {
|
|
9121
9121
|
item = tok.items[index];
|
|
@@ -9124,23 +9124,23 @@ var require_cst_visit = __commonJS({
|
|
|
9124
9124
|
}
|
|
9125
9125
|
return item;
|
|
9126
9126
|
};
|
|
9127
|
-
visit2.parentCollection = (cst,
|
|
9128
|
-
const parent = visit2.itemAtPath(cst,
|
|
9129
|
-
const field =
|
|
9127
|
+
visit2.parentCollection = (cst, path35) => {
|
|
9128
|
+
const parent = visit2.itemAtPath(cst, path35.slice(0, -1));
|
|
9129
|
+
const field = path35[path35.length - 1][0];
|
|
9130
9130
|
const coll = parent?.[field];
|
|
9131
9131
|
if (coll && "items" in coll)
|
|
9132
9132
|
return coll;
|
|
9133
9133
|
throw new Error("Parent collection not found");
|
|
9134
9134
|
};
|
|
9135
|
-
function _visit(
|
|
9136
|
-
let ctrl = visitor(item,
|
|
9135
|
+
function _visit(path35, item, visitor) {
|
|
9136
|
+
let ctrl = visitor(item, path35);
|
|
9137
9137
|
if (typeof ctrl === "symbol")
|
|
9138
9138
|
return ctrl;
|
|
9139
9139
|
for (const field of ["key", "value"]) {
|
|
9140
9140
|
const token = item[field];
|
|
9141
9141
|
if (token && "items" in token) {
|
|
9142
9142
|
for (let i2 = 0; i2 < token.items.length; ++i2) {
|
|
9143
|
-
const ci = _visit(Object.freeze(
|
|
9143
|
+
const ci = _visit(Object.freeze(path35.concat([[field, i2]])), token.items[i2], visitor);
|
|
9144
9144
|
if (typeof ci === "number")
|
|
9145
9145
|
i2 = ci - 1;
|
|
9146
9146
|
else if (ci === BREAK)
|
|
@@ -9151,10 +9151,10 @@ var require_cst_visit = __commonJS({
|
|
|
9151
9151
|
}
|
|
9152
9152
|
}
|
|
9153
9153
|
if (typeof ctrl === "function" && field === "key")
|
|
9154
|
-
ctrl = ctrl(item,
|
|
9154
|
+
ctrl = ctrl(item, path35);
|
|
9155
9155
|
}
|
|
9156
9156
|
}
|
|
9157
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
9157
|
+
return typeof ctrl === "function" ? ctrl(item, path35) : ctrl;
|
|
9158
9158
|
}
|
|
9159
9159
|
exports.visit = visit2;
|
|
9160
9160
|
}
|
|
@@ -10255,18 +10255,18 @@ var require_parser = __commonJS({
|
|
|
10255
10255
|
if (this.type === "map-value-ind") {
|
|
10256
10256
|
const prev = getPrevProps(this.peek(2));
|
|
10257
10257
|
const start = getFirstKeyStartProps(prev);
|
|
10258
|
-
let
|
|
10258
|
+
let sep10;
|
|
10259
10259
|
if (scalar.end) {
|
|
10260
|
-
|
|
10261
|
-
|
|
10260
|
+
sep10 = scalar.end;
|
|
10261
|
+
sep10.push(this.sourceToken);
|
|
10262
10262
|
delete scalar.end;
|
|
10263
10263
|
} else
|
|
10264
|
-
|
|
10264
|
+
sep10 = [this.sourceToken];
|
|
10265
10265
|
const map = {
|
|
10266
10266
|
type: "block-map",
|
|
10267
10267
|
offset: scalar.offset,
|
|
10268
10268
|
indent: scalar.indent,
|
|
10269
|
-
items: [{ start, key: scalar, sep:
|
|
10269
|
+
items: [{ start, key: scalar, sep: sep10 }]
|
|
10270
10270
|
};
|
|
10271
10271
|
this.onKeyLine = true;
|
|
10272
10272
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -10419,15 +10419,15 @@ var require_parser = __commonJS({
|
|
|
10419
10419
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
10420
10420
|
const start2 = getFirstKeyStartProps(it.start);
|
|
10421
10421
|
const key = it.key;
|
|
10422
|
-
const
|
|
10423
|
-
|
|
10422
|
+
const sep10 = it.sep;
|
|
10423
|
+
sep10.push(this.sourceToken);
|
|
10424
10424
|
delete it.key;
|
|
10425
10425
|
delete it.sep;
|
|
10426
10426
|
this.stack.push({
|
|
10427
10427
|
type: "block-map",
|
|
10428
10428
|
offset: this.offset,
|
|
10429
10429
|
indent: this.indent,
|
|
10430
|
-
items: [{ start: start2, key, sep:
|
|
10430
|
+
items: [{ start: start2, key, sep: sep10 }]
|
|
10431
10431
|
});
|
|
10432
10432
|
} else if (start.length > 0) {
|
|
10433
10433
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -10456,14 +10456,14 @@ var require_parser = __commonJS({
|
|
|
10456
10456
|
case "scalar":
|
|
10457
10457
|
case "single-quoted-scalar":
|
|
10458
10458
|
case "double-quoted-scalar": {
|
|
10459
|
-
const
|
|
10459
|
+
const fs29 = this.flowScalar(this.type);
|
|
10460
10460
|
if (atNextItem || it.value) {
|
|
10461
|
-
map.items.push({ start, key:
|
|
10461
|
+
map.items.push({ start, key: fs29, sep: [] });
|
|
10462
10462
|
this.onKeyLine = true;
|
|
10463
10463
|
} else if (it.sep) {
|
|
10464
|
-
this.stack.push(
|
|
10464
|
+
this.stack.push(fs29);
|
|
10465
10465
|
} else {
|
|
10466
|
-
Object.assign(it, { key:
|
|
10466
|
+
Object.assign(it, { key: fs29, sep: [] });
|
|
10467
10467
|
this.onKeyLine = true;
|
|
10468
10468
|
}
|
|
10469
10469
|
return;
|
|
@@ -10591,13 +10591,13 @@ var require_parser = __commonJS({
|
|
|
10591
10591
|
case "scalar":
|
|
10592
10592
|
case "single-quoted-scalar":
|
|
10593
10593
|
case "double-quoted-scalar": {
|
|
10594
|
-
const
|
|
10594
|
+
const fs29 = this.flowScalar(this.type);
|
|
10595
10595
|
if (!it || it.value)
|
|
10596
|
-
fc.items.push({ start: [], key:
|
|
10596
|
+
fc.items.push({ start: [], key: fs29, sep: [] });
|
|
10597
10597
|
else if (it.sep)
|
|
10598
|
-
this.stack.push(
|
|
10598
|
+
this.stack.push(fs29);
|
|
10599
10599
|
else
|
|
10600
|
-
Object.assign(it, { key:
|
|
10600
|
+
Object.assign(it, { key: fs29, sep: [] });
|
|
10601
10601
|
return;
|
|
10602
10602
|
}
|
|
10603
10603
|
case "flow-map-end":
|
|
@@ -10621,13 +10621,13 @@ var require_parser = __commonJS({
|
|
|
10621
10621
|
const prev = getPrevProps(parent);
|
|
10622
10622
|
const start = getFirstKeyStartProps(prev);
|
|
10623
10623
|
fixFlowSeqItems(fc);
|
|
10624
|
-
const
|
|
10625
|
-
|
|
10624
|
+
const sep10 = fc.end.splice(1, fc.end.length);
|
|
10625
|
+
sep10.push(this.sourceToken);
|
|
10626
10626
|
const map = {
|
|
10627
10627
|
type: "block-map",
|
|
10628
10628
|
offset: fc.offset,
|
|
10629
10629
|
indent: fc.indent,
|
|
10630
|
-
items: [{ start, key: fc, sep:
|
|
10630
|
+
items: [{ start, key: fc, sep: sep10 }]
|
|
10631
10631
|
};
|
|
10632
10632
|
this.onKeyLine = true;
|
|
10633
10633
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -10805,7 +10805,7 @@ var require_public_api = __commonJS({
|
|
|
10805
10805
|
}
|
|
10806
10806
|
return doc;
|
|
10807
10807
|
}
|
|
10808
|
-
function
|
|
10808
|
+
function parse6(src, reviver, options) {
|
|
10809
10809
|
let _reviver = void 0;
|
|
10810
10810
|
if (typeof reviver === "function") {
|
|
10811
10811
|
_reviver = reviver;
|
|
@@ -10846,7 +10846,7 @@ var require_public_api = __commonJS({
|
|
|
10846
10846
|
return value.toString(options);
|
|
10847
10847
|
return new Document2.Document(value, _replacer, options).toString(options);
|
|
10848
10848
|
}
|
|
10849
|
-
exports.parse =
|
|
10849
|
+
exports.parse = parse6;
|
|
10850
10850
|
exports.parseAllDocuments = parseAllDocuments;
|
|
10851
10851
|
exports.parseDocument = parseDocument2;
|
|
10852
10852
|
exports.stringify = stringify2;
|
|
@@ -11008,13 +11008,13 @@ var require_min_release_age = __commonJS({
|
|
|
11008
11008
|
return Number.isFinite(days) && days > 0 ? days * config_parse_1.DAY_MS : 0;
|
|
11009
11009
|
}
|
|
11010
11010
|
function probe(p, cwd) {
|
|
11011
|
-
return new Promise((
|
|
11011
|
+
return new Promise((resolve22) => {
|
|
11012
11012
|
(0, node_child_process_1.exec)(p.command, { cwd, timeout: PROBE_TIMEOUT_MS2, windowsHide: true }, (err, stdout2) => {
|
|
11013
11013
|
if (err) {
|
|
11014
|
-
|
|
11014
|
+
resolve22(0);
|
|
11015
11015
|
return;
|
|
11016
11016
|
}
|
|
11017
|
-
|
|
11017
|
+
resolve22(p.parse(stdout2));
|
|
11018
11018
|
});
|
|
11019
11019
|
});
|
|
11020
11020
|
}
|
|
@@ -11047,12 +11047,12 @@ var require_registry = __commonJS({
|
|
|
11047
11047
|
var node_https_1 = __importDefault(__require("node:https"));
|
|
11048
11048
|
var REQUEST_TIMEOUT_MS = 1e4;
|
|
11049
11049
|
function fetchRegistryInfo2(url) {
|
|
11050
|
-
return new Promise((
|
|
11050
|
+
return new Promise((resolve22) => {
|
|
11051
11051
|
let resolved = false;
|
|
11052
11052
|
const safeResolve = (value) => {
|
|
11053
11053
|
if (!resolved) {
|
|
11054
11054
|
resolved = true;
|
|
11055
|
-
|
|
11055
|
+
resolve22(value);
|
|
11056
11056
|
}
|
|
11057
11057
|
};
|
|
11058
11058
|
const req = node_https_1.default.get(url, { timeout: REQUEST_TIMEOUT_MS }, (res) => {
|
|
@@ -12992,8 +12992,8 @@ var Deferred = class {
|
|
|
12992
12992
|
_resolve;
|
|
12993
12993
|
_reject;
|
|
12994
12994
|
constructor() {
|
|
12995
|
-
this._promise = new Promise((
|
|
12996
|
-
this._resolve =
|
|
12995
|
+
this._promise = new Promise((resolve22, reject) => {
|
|
12996
|
+
this._resolve = resolve22;
|
|
12997
12997
|
this._reject = reject;
|
|
12998
12998
|
});
|
|
12999
12999
|
}
|
|
@@ -13886,8 +13886,8 @@ var ExportOperation = class {
|
|
|
13886
13886
|
_metrics;
|
|
13887
13887
|
_exportScheduledResolve;
|
|
13888
13888
|
constructor(exporter, logRecords, exportTimeoutMillis, metrics) {
|
|
13889
|
-
this._exportScheduledPromise = new Promise((
|
|
13890
|
-
this._exportScheduledResolve =
|
|
13889
|
+
this._exportScheduledPromise = new Promise((resolve22) => {
|
|
13890
|
+
this._exportScheduledResolve = resolve22;
|
|
13891
13891
|
});
|
|
13892
13892
|
this._exportCompleted = this._executeExport(exporter, logRecords, exportTimeoutMillis);
|
|
13893
13893
|
this._metrics = metrics;
|
|
@@ -13912,7 +13912,7 @@ var ExportOperation = class {
|
|
|
13912
13912
|
}
|
|
13913
13913
|
}
|
|
13914
13914
|
async _exportWithTimeout(exporter, logRecords, exportTimeoutMillis) {
|
|
13915
|
-
return new Promise((
|
|
13915
|
+
return new Promise((resolve22, reject) => {
|
|
13916
13916
|
const timer = setTimeout(() => {
|
|
13917
13917
|
reject(new Error("Timeout"));
|
|
13918
13918
|
}, exportTimeoutMillis);
|
|
@@ -13920,7 +13920,7 @@ var ExportOperation = class {
|
|
|
13920
13920
|
this._metrics.finishLogs(logRecords.length, result.error);
|
|
13921
13921
|
clearTimeout(timer);
|
|
13922
13922
|
if (result.code === ExportResultCode.SUCCESS) {
|
|
13923
|
-
|
|
13923
|
+
resolve22();
|
|
13924
13924
|
} else {
|
|
13925
13925
|
reject(result.error ?? new Error("BatchLogRecordProcessor: log record export failed"));
|
|
13926
13926
|
}
|
|
@@ -14701,7 +14701,7 @@ function parseRetryAfterToMills(retryAfter) {
|
|
|
14701
14701
|
var DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${VERSION4}`;
|
|
14702
14702
|
var MAX_RESPONSE_BODY_SIZE = 4 * 1024 * 1024;
|
|
14703
14703
|
function sendWithHttp(request, url, headers, compression, userAgent, agent, data, timeoutMillis) {
|
|
14704
|
-
return new Promise((
|
|
14704
|
+
return new Promise((resolve22) => {
|
|
14705
14705
|
const parsedUrl = new URL(url);
|
|
14706
14706
|
if (userAgent) {
|
|
14707
14707
|
headers["User-Agent"] = `${userAgent} ${DEFAULT_USER_AGENT}`;
|
|
@@ -14720,7 +14720,7 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
|
|
|
14720
14720
|
responseSize += chunk.length;
|
|
14721
14721
|
if (responseSize > MAX_RESPONSE_BODY_SIZE) {
|
|
14722
14722
|
const sizeError = new Error(`OTLP export response body exceeded size limit of ${MAX_RESPONSE_BODY_SIZE} bytes`);
|
|
14723
|
-
|
|
14723
|
+
resolve22({ status: "failure", error: sizeError });
|
|
14724
14724
|
res.destroy();
|
|
14725
14725
|
return;
|
|
14726
14726
|
}
|
|
@@ -14728,18 +14728,18 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
|
|
|
14728
14728
|
});
|
|
14729
14729
|
res.on("end", () => {
|
|
14730
14730
|
if (res.statusCode && res.statusCode <= 299) {
|
|
14731
|
-
|
|
14731
|
+
resolve22({
|
|
14732
14732
|
status: "success",
|
|
14733
14733
|
data: Buffer.concat(responseData)
|
|
14734
14734
|
});
|
|
14735
14735
|
} else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
|
|
14736
|
-
|
|
14736
|
+
resolve22({
|
|
14737
14737
|
status: "retryable",
|
|
14738
14738
|
retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
|
|
14739
14739
|
});
|
|
14740
14740
|
} else {
|
|
14741
14741
|
const error = new OTLPExporterError(res.statusMessage, res.statusCode, Buffer.concat(responseData).toString());
|
|
14742
|
-
|
|
14742
|
+
resolve22({
|
|
14743
14743
|
status: "failure",
|
|
14744
14744
|
error
|
|
14745
14745
|
});
|
|
@@ -14747,17 +14747,17 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
|
|
|
14747
14747
|
});
|
|
14748
14748
|
res.on("error", (error) => {
|
|
14749
14749
|
if (res.statusCode && res.statusCode <= 299) {
|
|
14750
|
-
|
|
14750
|
+
resolve22({
|
|
14751
14751
|
status: "success"
|
|
14752
14752
|
});
|
|
14753
14753
|
} else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
|
|
14754
|
-
|
|
14754
|
+
resolve22({
|
|
14755
14755
|
status: "retryable",
|
|
14756
14756
|
error,
|
|
14757
14757
|
retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
|
|
14758
14758
|
});
|
|
14759
14759
|
} else {
|
|
14760
|
-
|
|
14760
|
+
resolve22({
|
|
14761
14761
|
status: "failure",
|
|
14762
14762
|
error
|
|
14763
14763
|
});
|
|
@@ -14766,26 +14766,26 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
|
|
|
14766
14766
|
});
|
|
14767
14767
|
req.setTimeout(timeoutMillis, () => {
|
|
14768
14768
|
req.destroy();
|
|
14769
|
-
|
|
14769
|
+
resolve22({
|
|
14770
14770
|
status: "retryable",
|
|
14771
14771
|
error: new Error("Request timed out")
|
|
14772
14772
|
});
|
|
14773
14773
|
});
|
|
14774
14774
|
req.on("error", (error) => {
|
|
14775
14775
|
if (isHttpTransportNetworkErrorRetryable(error)) {
|
|
14776
|
-
|
|
14776
|
+
resolve22({
|
|
14777
14777
|
status: "retryable",
|
|
14778
14778
|
error
|
|
14779
14779
|
});
|
|
14780
14780
|
} else {
|
|
14781
|
-
|
|
14781
|
+
resolve22({
|
|
14782
14782
|
status: "failure",
|
|
14783
14783
|
error
|
|
14784
14784
|
});
|
|
14785
14785
|
}
|
|
14786
14786
|
});
|
|
14787
14787
|
compressAndSend(req, compression, data, (error) => {
|
|
14788
|
-
|
|
14788
|
+
resolve22({
|
|
14789
14789
|
status: "failure",
|
|
14790
14790
|
error
|
|
14791
14791
|
});
|
|
@@ -14875,9 +14875,9 @@ var RetryingTransport = class {
|
|
|
14875
14875
|
this._transport = transport;
|
|
14876
14876
|
}
|
|
14877
14877
|
retry(data, timeoutMillis, inMillis) {
|
|
14878
|
-
return new Promise((
|
|
14878
|
+
return new Promise((resolve22, reject) => {
|
|
14879
14879
|
setTimeout(() => {
|
|
14880
|
-
this._transport.send(data, timeoutMillis).then(
|
|
14880
|
+
this._transport.send(data, timeoutMillis).then(resolve22, reject);
|
|
14881
14881
|
}, inMillis);
|
|
14882
14882
|
});
|
|
14883
14883
|
}
|
|
@@ -15012,7 +15012,7 @@ function appendRootPathToUrlIfNeeded(url) {
|
|
|
15012
15012
|
return void 0;
|
|
15013
15013
|
}
|
|
15014
15014
|
}
|
|
15015
|
-
function appendResourcePathToUrl(url,
|
|
15015
|
+
function appendResourcePathToUrl(url, path35) {
|
|
15016
15016
|
try {
|
|
15017
15017
|
new URL(url);
|
|
15018
15018
|
} catch {
|
|
@@ -15022,11 +15022,11 @@ function appendResourcePathToUrl(url, path33) {
|
|
|
15022
15022
|
if (!url.endsWith("/")) {
|
|
15023
15023
|
url = url + "/";
|
|
15024
15024
|
}
|
|
15025
|
-
url +=
|
|
15025
|
+
url += path35;
|
|
15026
15026
|
try {
|
|
15027
15027
|
new URL(url);
|
|
15028
15028
|
} catch {
|
|
15029
|
-
diag2.warn(`Configuration: Provided URL appended with '${
|
|
15029
|
+
diag2.warn(`Configuration: Provided URL appended with '${path35}' is not a valid URL, using 'undefined' instead of '${url}'`);
|
|
15030
15030
|
return void 0;
|
|
15031
15031
|
}
|
|
15032
15032
|
return url;
|
|
@@ -15137,75 +15137,116 @@ var OTLPLogExporter = class extends OTLPExporterBase {
|
|
|
15137
15137
|
init_esm();
|
|
15138
15138
|
|
|
15139
15139
|
// ../telemetry/src/debug.ts
|
|
15140
|
-
import * as
|
|
15140
|
+
import * as fs9 from "node:fs";
|
|
15141
15141
|
|
|
15142
15142
|
// ../telemetry/src/paths.ts
|
|
15143
|
-
import * as
|
|
15143
|
+
import * as path9 from "node:path";
|
|
15144
15144
|
|
|
15145
15145
|
// ../configuration-core/src/flags.ts
|
|
15146
|
-
import * as
|
|
15146
|
+
import * as fs3 from "node:fs";
|
|
15147
|
+
import * as path3 from "node:path";
|
|
15148
|
+
|
|
15149
|
+
// ../configuration-core/src/home.ts
|
|
15150
|
+
import * as os from "node:os";
|
|
15147
15151
|
import * as path2 from "node:path";
|
|
15148
|
-
|
|
15152
|
+
var ARGENT_HOME_DIR_ENV = "ARGENT_HOME_DIR";
|
|
15153
|
+
function nonEmpty(value) {
|
|
15154
|
+
if (value == void 0) return null;
|
|
15155
|
+
const trimmed = value.trim();
|
|
15156
|
+
return trimmed === "" ? null : value;
|
|
15157
|
+
}
|
|
15158
|
+
function resolveHomeDir(options = {}) {
|
|
15159
|
+
if (options.homeDir) return options.homeDir;
|
|
15160
|
+
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
15161
|
+
}
|
|
15162
|
+
function argentHomeDir(options = {}) {
|
|
15163
|
+
const override = options.homeDir ? null : nonEmpty(process.env[ARGENT_HOME_DIR_ENV]);
|
|
15164
|
+
return override ? path2.resolve(override.trim()) : path2.join(resolveHomeDir(options), ".argent");
|
|
15165
|
+
}
|
|
15166
|
+
|
|
15167
|
+
// ../configuration-core/src/write-file.ts
|
|
15168
|
+
import * as fs2 from "node:fs";
|
|
15169
|
+
import { randomBytes } from "node:crypto";
|
|
15170
|
+
function writeFileAtomicSync(file, data, mode = 438) {
|
|
15171
|
+
const tmp = `${file}.${randomBytes(8).toString("hex")}.tmp`;
|
|
15172
|
+
try {
|
|
15173
|
+
fs2.writeFileSync(tmp, data, { flag: "wx", mode });
|
|
15174
|
+
fs2.renameSync(tmp, file);
|
|
15175
|
+
} catch (err) {
|
|
15176
|
+
fs2.rmSync(tmp, { force: true });
|
|
15177
|
+
if (err.code !== "EBUSY" || !writeOwnFileInPlace(file, data, mode)) {
|
|
15178
|
+
throw err;
|
|
15179
|
+
}
|
|
15180
|
+
}
|
|
15181
|
+
}
|
|
15182
|
+
var IN_PLACE_FLAGS = fs2.constants.O_WRONLY | fs2.constants.O_NOFOLLOW | fs2.constants.O_NONBLOCK;
|
|
15183
|
+
function writeOwnFileInPlace(file, data, mode) {
|
|
15184
|
+
const uid = process.getuid?.();
|
|
15185
|
+
if (uid === void 0) return false;
|
|
15186
|
+
let fd;
|
|
15187
|
+
try {
|
|
15188
|
+
fd = fs2.openSync(file, IN_PLACE_FLAGS);
|
|
15189
|
+
} catch {
|
|
15190
|
+
return false;
|
|
15191
|
+
}
|
|
15192
|
+
try {
|
|
15193
|
+
const stat6 = fs2.fstatSync(fd);
|
|
15194
|
+
if (!stat6.isFile() || stat6.uid !== uid && uid !== 0) return false;
|
|
15195
|
+
fs2.fchmodSync(fd, stat6.mode & mode & 511);
|
|
15196
|
+
fs2.ftruncateSync(fd);
|
|
15197
|
+
fs2.writeFileSync(fd, data);
|
|
15198
|
+
return true;
|
|
15199
|
+
} finally {
|
|
15200
|
+
fs2.closeSync(fd);
|
|
15201
|
+
}
|
|
15202
|
+
}
|
|
15203
|
+
|
|
15204
|
+
// ../configuration-core/src/flags.ts
|
|
15149
15205
|
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
15150
15206
|
function findProjectRoot(startDir) {
|
|
15151
|
-
let current =
|
|
15207
|
+
let current = path3.resolve(startDir);
|
|
15152
15208
|
while (true) {
|
|
15153
15209
|
for (const marker of PROJECT_MARKERS) {
|
|
15154
|
-
if (
|
|
15210
|
+
if (fs3.existsSync(path3.join(current, marker))) return current;
|
|
15155
15211
|
}
|
|
15156
|
-
const parent =
|
|
15212
|
+
const parent = path3.dirname(current);
|
|
15157
15213
|
if (parent === current) return null;
|
|
15158
15214
|
current = parent;
|
|
15159
15215
|
}
|
|
15160
15216
|
}
|
|
15161
15217
|
function resolveProjectRoot(startDir) {
|
|
15162
|
-
return findProjectRoot(startDir) ??
|
|
15218
|
+
return findProjectRoot(startDir) ?? path3.resolve(startDir);
|
|
15163
15219
|
}
|
|
15164
15220
|
|
|
15165
15221
|
// ../configuration-core/src/paths.ts
|
|
15166
|
-
import * as
|
|
15167
|
-
import * as
|
|
15168
|
-
import * as path3 from "node:path";
|
|
15169
|
-
function nonEmpty(value) {
|
|
15170
|
-
if (value == void 0) return null;
|
|
15171
|
-
const trimmed = value.trim();
|
|
15172
|
-
return trimmed === "" ? null : value;
|
|
15173
|
-
}
|
|
15174
|
-
function resolveHomeDir(options = {}) {
|
|
15175
|
-
if (options.homeDir) return options.homeDir;
|
|
15176
|
-
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
15177
|
-
}
|
|
15222
|
+
import * as fs4 from "node:fs";
|
|
15223
|
+
import * as path4 from "node:path";
|
|
15178
15224
|
function isHomeDir(dir, options = {}) {
|
|
15179
15225
|
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
15180
15226
|
}
|
|
15181
15227
|
function canonicalPath(p) {
|
|
15182
15228
|
try {
|
|
15183
|
-
return
|
|
15229
|
+
return fs4.realpathSync.native(p);
|
|
15184
15230
|
} catch {
|
|
15185
|
-
return
|
|
15231
|
+
return path4.resolve(p);
|
|
15186
15232
|
}
|
|
15187
15233
|
}
|
|
15188
|
-
function argentHomeDir() {
|
|
15189
|
-
return path3.join(resolveHomeDir(), ".argent");
|
|
15190
|
-
}
|
|
15191
15234
|
function configDir(scope = "global", options = {}) {
|
|
15192
|
-
if (scope === "global")
|
|
15193
|
-
return path3.join(resolveHomeDir(options), ".argent");
|
|
15194
|
-
}
|
|
15235
|
+
if (scope === "global") return argentHomeDir(options);
|
|
15195
15236
|
const cwd = options.cwd ?? process.cwd();
|
|
15196
|
-
return
|
|
15237
|
+
return path4.join(resolveProjectRoot(cwd), ".argent");
|
|
15197
15238
|
}
|
|
15198
15239
|
function configFilePath(scope = "global", options = {}) {
|
|
15199
|
-
return
|
|
15240
|
+
return path4.join(configDir(scope, options), "config.json");
|
|
15200
15241
|
}
|
|
15201
15242
|
|
|
15202
15243
|
// ../configuration-core/src/config.ts
|
|
15203
15244
|
import * as crypto from "node:crypto";
|
|
15204
|
-
import * as
|
|
15205
|
-
import * as
|
|
15245
|
+
import * as fs5 from "node:fs";
|
|
15246
|
+
import * as path5 from "node:path";
|
|
15206
15247
|
function readConfigObject(scope = "global", options = {}) {
|
|
15207
15248
|
try {
|
|
15208
|
-
const raw =
|
|
15249
|
+
const raw = fs5.readFileSync(configFilePath(scope, options), "utf8");
|
|
15209
15250
|
const json = JSON.parse(raw);
|
|
15210
15251
|
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
15211
15252
|
return json;
|
|
@@ -15263,9 +15304,9 @@ function acquireConfigLock(finalPath) {
|
|
|
15263
15304
|
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
15264
15305
|
for (; ; ) {
|
|
15265
15306
|
try {
|
|
15266
|
-
const fd =
|
|
15307
|
+
const fd = fs5.openSync(lockPath, "wx", 384);
|
|
15267
15308
|
try {
|
|
15268
|
-
|
|
15309
|
+
fs5.writeSync(fd, `${process.pid}
|
|
15269
15310
|
`);
|
|
15270
15311
|
} catch {
|
|
15271
15312
|
}
|
|
@@ -15273,8 +15314,8 @@ function acquireConfigLock(finalPath) {
|
|
|
15273
15314
|
} catch (err) {
|
|
15274
15315
|
if (err.code !== "EEXIST") return null;
|
|
15275
15316
|
try {
|
|
15276
|
-
if (Date.now() -
|
|
15277
|
-
|
|
15317
|
+
if (Date.now() - fs5.statSync(lockPath).mtimeMs > LOCK_STALE_MS) {
|
|
15318
|
+
fs5.unlinkSync(lockPath);
|
|
15278
15319
|
continue;
|
|
15279
15320
|
}
|
|
15280
15321
|
} catch {
|
|
@@ -15286,35 +15327,35 @@ function acquireConfigLock(finalPath) {
|
|
|
15286
15327
|
}
|
|
15287
15328
|
function releaseConfigLock(lock) {
|
|
15288
15329
|
try {
|
|
15289
|
-
|
|
15330
|
+
fs5.closeSync(lock.fd);
|
|
15290
15331
|
} catch {
|
|
15291
15332
|
}
|
|
15292
15333
|
try {
|
|
15293
|
-
|
|
15334
|
+
fs5.unlinkSync(lock.lockPath);
|
|
15294
15335
|
} catch {
|
|
15295
15336
|
}
|
|
15296
15337
|
}
|
|
15297
15338
|
function updateConfig(mutate, scope = "global", options = {}) {
|
|
15298
15339
|
const dir = configDir(scope, options);
|
|
15299
|
-
|
|
15340
|
+
fs5.mkdirSync(dir, { recursive: true });
|
|
15300
15341
|
const finalPath = configFilePath(scope, options);
|
|
15301
15342
|
const lock = acquireConfigLock(finalPath);
|
|
15302
15343
|
try {
|
|
15303
15344
|
const next = readConfigObject(scope, options);
|
|
15304
15345
|
mutate(next);
|
|
15305
|
-
const tmpPath =
|
|
15306
|
-
const fd =
|
|
15346
|
+
const tmpPath = path5.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
15347
|
+
const fd = fs5.openSync(tmpPath, "wx", 384);
|
|
15307
15348
|
try {
|
|
15308
|
-
|
|
15309
|
-
|
|
15349
|
+
fs5.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
15350
|
+
fs5.fsyncSync(fd);
|
|
15310
15351
|
} finally {
|
|
15311
|
-
|
|
15352
|
+
fs5.closeSync(fd);
|
|
15312
15353
|
}
|
|
15313
15354
|
try {
|
|
15314
|
-
|
|
15355
|
+
fs5.renameSync(tmpPath, finalPath);
|
|
15315
15356
|
} catch (err) {
|
|
15316
15357
|
try {
|
|
15317
|
-
|
|
15358
|
+
fs5.unlinkSync(tmpPath);
|
|
15318
15359
|
} catch {
|
|
15319
15360
|
}
|
|
15320
15361
|
throw err;
|
|
@@ -15348,8 +15389,8 @@ function setWhatsNewSeenVersion(version, options = {}) {
|
|
|
15348
15389
|
|
|
15349
15390
|
// ../configuration-core/src/secrets.ts
|
|
15350
15391
|
var import_dotenv = __toESM(require_dist(), 1);
|
|
15351
|
-
import * as
|
|
15352
|
-
import * as
|
|
15392
|
+
import * as fs6 from "node:fs";
|
|
15393
|
+
import * as path6 from "node:path";
|
|
15353
15394
|
|
|
15354
15395
|
// ../configuration-core/src/merge.ts
|
|
15355
15396
|
function mergeRestrictive(local, global2) {
|
|
@@ -15437,7 +15478,9 @@ var CONFIG_SCHEMA = [
|
|
|
15437
15478
|
default: true,
|
|
15438
15479
|
// Opt-in/out goes through the dedicated command so the live client is
|
|
15439
15480
|
// drained/reset, not just the file rewritten.
|
|
15440
|
-
manageCommand: "argent telemetry"
|
|
15481
|
+
manageCommand: "argent telemetry",
|
|
15482
|
+
// consent.ts keeps a ~/.argent opt-out under a moved home; show the same.
|
|
15483
|
+
userHomeOptOut: true
|
|
15441
15484
|
},
|
|
15442
15485
|
{
|
|
15443
15486
|
key: "autoUpdate.enabled",
|
|
@@ -15446,6 +15489,8 @@ var CONFIG_SCHEMA = [
|
|
|
15446
15489
|
parse: asBoolean,
|
|
15447
15490
|
merge: "prioritize-local",
|
|
15448
15491
|
default: true,
|
|
15492
|
+
// The global install is shared by every Argent home.
|
|
15493
|
+
userHomeOptOut: true,
|
|
15449
15494
|
example: "false"
|
|
15450
15495
|
},
|
|
15451
15496
|
{
|
|
@@ -15536,7 +15581,8 @@ function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
|
|
|
15536
15581
|
}
|
|
15537
15582
|
|
|
15538
15583
|
// ../configuration-core/src/config-access.ts
|
|
15539
|
-
import * as
|
|
15584
|
+
import * as fs7 from "node:fs";
|
|
15585
|
+
import * as path7 from "node:path";
|
|
15540
15586
|
function readScopeValue(def, scope, options) {
|
|
15541
15587
|
if (!def.scopes.includes(scope)) return void 0;
|
|
15542
15588
|
const raw = getAtPath(readConfigObject(scope, options), def.key);
|
|
@@ -15545,8 +15591,11 @@ function readScopeValue(def, scope, options) {
|
|
|
15545
15591
|
function getConfigValue(def, options = {}) {
|
|
15546
15592
|
const local = readScopeValue(def, "project", options);
|
|
15547
15593
|
const global2 = readScopeValue(def, "global", options);
|
|
15548
|
-
const merged = applyMergePolicy(def.merge, local, global2);
|
|
15549
|
-
return merged
|
|
15594
|
+
const merged = applyMergePolicy(def.merge, local, global2) ?? def.default;
|
|
15595
|
+
if (!def.userHomeOptOut) return merged;
|
|
15596
|
+
const userHome = { homeDir: resolveHomeDir(options) };
|
|
15597
|
+
if (argentHomeDir(options) === argentHomeDir(userHome)) return merged;
|
|
15598
|
+
return readScopeValue(def, "global", userHome) === false ? false : merged;
|
|
15550
15599
|
}
|
|
15551
15600
|
function getConfigValueByKey(key, options = {}, registry = CONFIG_SCHEMA) {
|
|
15552
15601
|
const def = requireDefinition(key, registry);
|
|
@@ -15567,13 +15616,23 @@ var UnknownConfigKeyError = class extends Error {
|
|
|
15567
15616
|
}
|
|
15568
15617
|
key;
|
|
15569
15618
|
};
|
|
15619
|
+
var AUTO_UPDATE_ENABLED_KEY = "autoUpdate.enabled";
|
|
15620
|
+
function isAutoUpdateEnabled() {
|
|
15621
|
+
return getConfigValueByKey(AUTO_UPDATE_ENABLED_KEY) === true;
|
|
15622
|
+
}
|
|
15623
|
+
|
|
15624
|
+
// ../configuration-core/src/cloud-android.ts
|
|
15625
|
+
import * as fs8 from "node:fs";
|
|
15626
|
+
import * as os2 from "node:os";
|
|
15627
|
+
import * as path8 from "node:path";
|
|
15628
|
+
var CLOUD_ANDROID_MARKER_TTL_MS = 2 * 6e4;
|
|
15570
15629
|
|
|
15571
15630
|
// ../telemetry/src/paths.ts
|
|
15572
15631
|
function identityFilePath() {
|
|
15573
|
-
return
|
|
15632
|
+
return path9.join(argentHomeDir(), "telemetry-id");
|
|
15574
15633
|
}
|
|
15575
15634
|
function debugLogPath() {
|
|
15576
|
-
return
|
|
15635
|
+
return path9.join(argentHomeDir(), "telemetry-debug.log");
|
|
15577
15636
|
}
|
|
15578
15637
|
|
|
15579
15638
|
// ../telemetry/src/debug.ts
|
|
@@ -15603,8 +15662,8 @@ function emitDebugPayload(payload) {
|
|
|
15603
15662
|
} catch {
|
|
15604
15663
|
}
|
|
15605
15664
|
try {
|
|
15606
|
-
|
|
15607
|
-
|
|
15665
|
+
fs9.mkdirSync(argentHomeDir(), { recursive: true });
|
|
15666
|
+
fs9.appendFileSync(debugLogPath(), line + "\n");
|
|
15608
15667
|
} catch {
|
|
15609
15668
|
}
|
|
15610
15669
|
}
|
|
@@ -15792,16 +15851,16 @@ var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
|
|
|
15792
15851
|
var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
|
|
15793
15852
|
|
|
15794
15853
|
// ../registry/src/flow-file-refs.ts
|
|
15795
|
-
import * as
|
|
15796
|
-
import * as
|
|
15854
|
+
import * as fs11 from "node:fs/promises";
|
|
15855
|
+
import * as path11 from "node:path";
|
|
15797
15856
|
|
|
15798
15857
|
// ../registry/src/e2e-dirs.ts
|
|
15799
|
-
import * as
|
|
15800
|
-
import * as
|
|
15801
|
-
var E2E_DIR =
|
|
15802
|
-
var LEGACY_E2E_DIRS = Object.freeze([
|
|
15858
|
+
import * as fs10 from "node:fs/promises";
|
|
15859
|
+
import * as path10 from "node:path";
|
|
15860
|
+
var E2E_DIR = path10.join(".argent", "e2e");
|
|
15861
|
+
var LEGACY_E2E_DIRS = Object.freeze([path10.join(".argent", "flows")]);
|
|
15803
15862
|
var E2E_DIRS = Object.freeze([E2E_DIR, ...LEGACY_E2E_DIRS]);
|
|
15804
|
-
var E2E_DIR_NAMES = E2E_DIRS.map((dir) =>
|
|
15863
|
+
var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path10.basename(dir));
|
|
15805
15864
|
|
|
15806
15865
|
// ../registry/src/tool-ids.ts
|
|
15807
15866
|
var TOOL_ID_ALIASES = Object.freeze({
|
|
@@ -15835,6 +15894,8 @@ var FAILURE_CODES = {
|
|
|
15835
15894
|
HTTP_CAPABILITY_UNSUPPORTED_OPERATION: "HTTP_CAPABILITY_UNSUPPORTED_OPERATION",
|
|
15836
15895
|
HTTP_DEVICE_RESOLUTION_FAILED: "HTTP_DEVICE_RESOLUTION_FAILED",
|
|
15837
15896
|
HTTP_DEPENDENCY_PREFLIGHT_MISSING: "HTTP_DEPENDENCY_PREFLIGHT_MISSING",
|
|
15897
|
+
// Another session holds a claim on the device the call names.
|
|
15898
|
+
DEVICE_IN_USE: "DEVICE_IN_USE",
|
|
15838
15899
|
// The client's POST /upload of a file input was refused, so the call was not sent.
|
|
15839
15900
|
FILE_INPUT_UPLOAD_FAILED: "FILE_INPUT_UPLOAD_FAILED",
|
|
15840
15901
|
CLI_RUN_TOOL_NOT_FOUND: "CLI_RUN_TOOL_NOT_FOUND",
|
|
@@ -16221,6 +16282,8 @@ var FAILURE_CODES = {
|
|
|
16221
16282
|
MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
|
|
16222
16283
|
/** The app's loaded Argent library lacks support for the requested operation. */
|
|
16223
16284
|
MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
|
|
16285
|
+
/** The user clicked, scrolled or typed in the app while argent's pointer moved, and took the pointer back. */
|
|
16286
|
+
MACOS_APP_POINTER_TAKEN_OVER: "MACOS_APP_POINTER_TAKEN_OVER",
|
|
16224
16287
|
KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
|
|
16225
16288
|
KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
|
|
16226
16289
|
KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
|
|
@@ -16252,6 +16315,17 @@ var FAILURE_CODES = {
|
|
|
16252
16315
|
BOOT_HARMONY_STOP_TIMEOUT: "BOOT_HARMONY_STOP_TIMEOUT",
|
|
16253
16316
|
BOOT_HARMONY_MANAGER_EXITED: "BOOT_HARMONY_MANAGER_EXITED",
|
|
16254
16317
|
BOOT_HARMONY_START_FAILED: "BOOT_HARMONY_START_FAILED",
|
|
16318
|
+
/**
|
|
16319
|
+
* Argent Cloud Android emulators
|
|
16320
|
+
* @see [leases.ts](../../tool-server/src/utils/cloud-android/leases.ts)
|
|
16321
|
+
*/
|
|
16322
|
+
CLOUD_ANDROID_ACCESS_DENIED: "CLOUD_ANDROID_ACCESS_DENIED",
|
|
16323
|
+
CLOUD_ANDROID_ACQUIRE_FAILED: "CLOUD_ANDROID_ACQUIRE_FAILED",
|
|
16324
|
+
CLOUD_ANDROID_ADB_KEY_MISSING: "CLOUD_ANDROID_ADB_KEY_MISSING",
|
|
16325
|
+
CLOUD_ANDROID_ADB_SERVER_REMOTE: "CLOUD_ANDROID_ADB_SERVER_REMOTE",
|
|
16326
|
+
CLOUD_ANDROID_CONNECT_FAILED: "CLOUD_ANDROID_CONNECT_FAILED",
|
|
16327
|
+
CLOUD_ANDROID_LEASE_IN_USE: "CLOUD_ANDROID_LEASE_IN_USE",
|
|
16328
|
+
CLOUD_ANDROID_NO_EMULATOR: "CLOUD_ANDROID_NO_EMULATOR",
|
|
16255
16329
|
/**
|
|
16256
16330
|
* External device providers
|
|
16257
16331
|
* @see [external-devices.ts](../../tool-server/src/utils/external-devices.ts)
|
|
@@ -16650,7 +16724,7 @@ function sanitize(event, raw) {
|
|
|
16650
16724
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
16651
16725
|
|
|
16652
16726
|
// ../telemetry/src/cloud-agent-detect.ts
|
|
16653
|
-
import { existsSync as
|
|
16727
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
16654
16728
|
var CLAUDE_CLOUD_ENV_KINDS = /* @__PURE__ */ new Set(["byoc", "anthropic_cloud"]);
|
|
16655
16729
|
var CLAUDE_REMOTE_ENTRYPOINTS = /* @__PURE__ */ new Set([
|
|
16656
16730
|
"remote",
|
|
@@ -16681,9 +16755,9 @@ function isReplitAgent(env) {
|
|
|
16681
16755
|
}
|
|
16682
16756
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
16683
16757
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
16684
|
-
function safeExists(fileExists,
|
|
16758
|
+
function safeExists(fileExists, path35) {
|
|
16685
16759
|
try {
|
|
16686
|
-
return fileExists(
|
|
16760
|
+
return fileExists(path35);
|
|
16687
16761
|
} catch {
|
|
16688
16762
|
return false;
|
|
16689
16763
|
}
|
|
@@ -16693,7 +16767,7 @@ function detectCloudAgent(env = process.env, opts = {}) {
|
|
|
16693
16767
|
if (isCursorCloud(env)) return "cursor";
|
|
16694
16768
|
if (isCopilotAgent(env)) return "copilot";
|
|
16695
16769
|
if (isReplitAgent(env)) return "replit";
|
|
16696
|
-
const fileExists = opts.fileExists ??
|
|
16770
|
+
const fileExists = opts.fileExists ?? existsSync4;
|
|
16697
16771
|
if (safeExists(fileExists, DEVIN_MARKER_PATH)) return "devin";
|
|
16698
16772
|
if (safeExists(fileExists, JULES_MARKER_PATH)) return "jules";
|
|
16699
16773
|
return null;
|
|
@@ -17103,7 +17177,7 @@ function isCi(env = process.env) {
|
|
|
17103
17177
|
var SESSION_ID = randomUUID4();
|
|
17104
17178
|
function readCliVersion() {
|
|
17105
17179
|
if (true) {
|
|
17106
|
-
return "0.35.1-next.
|
|
17180
|
+
return "0.35.1-next.90";
|
|
17107
17181
|
}
|
|
17108
17182
|
return "0.0.0";
|
|
17109
17183
|
}
|
|
@@ -17136,8 +17210,8 @@ function getBaseProps(runtime) {
|
|
|
17136
17210
|
|
|
17137
17211
|
// ../telemetry/src/identity.ts
|
|
17138
17212
|
import * as crypto2 from "node:crypto";
|
|
17139
|
-
import * as
|
|
17140
|
-
import * as
|
|
17213
|
+
import * as fs12 from "node:fs";
|
|
17214
|
+
import * as path12 from "node:path";
|
|
17141
17215
|
var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
|
|
17142
17216
|
var cached = null;
|
|
17143
17217
|
var fingerprintResolved = null;
|
|
@@ -17244,66 +17318,66 @@ function resolveFingerprintOnce(resolveFingerprint) {
|
|
|
17244
17318
|
function isCorruptIdFile(filePath) {
|
|
17245
17319
|
let isRegularFile;
|
|
17246
17320
|
try {
|
|
17247
|
-
isRegularFile =
|
|
17321
|
+
isRegularFile = fs12.lstatSync(filePath).isFile();
|
|
17248
17322
|
} catch {
|
|
17249
17323
|
return false;
|
|
17250
17324
|
}
|
|
17251
17325
|
return isRegularFile && tryReadId(filePath) === null;
|
|
17252
17326
|
}
|
|
17253
17327
|
function writeIdFileAtomic(finalPath, id) {
|
|
17254
|
-
|
|
17328
|
+
fs12.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17255
17329
|
let occupant;
|
|
17256
17330
|
try {
|
|
17257
|
-
occupant =
|
|
17331
|
+
occupant = fs12.lstatSync(finalPath);
|
|
17258
17332
|
} catch (err) {
|
|
17259
17333
|
if (err.code !== "ENOENT") throw err;
|
|
17260
17334
|
}
|
|
17261
17335
|
if (occupant && !occupant.isFile()) {
|
|
17262
17336
|
throw new Error("telemetry: refusing to replace a non-regular file at the identity path");
|
|
17263
17337
|
}
|
|
17264
|
-
const tmpPath =
|
|
17338
|
+
const tmpPath = path12.join(
|
|
17265
17339
|
argentHomeDir(),
|
|
17266
17340
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17267
17341
|
);
|
|
17268
|
-
const fd =
|
|
17342
|
+
const fd = fs12.openSync(tmpPath, "wx", 384);
|
|
17269
17343
|
try {
|
|
17270
17344
|
try {
|
|
17271
|
-
|
|
17272
|
-
|
|
17345
|
+
fs12.writeSync(fd, id);
|
|
17346
|
+
fs12.fsyncSync(fd);
|
|
17273
17347
|
} finally {
|
|
17274
|
-
|
|
17348
|
+
fs12.closeSync(fd);
|
|
17275
17349
|
}
|
|
17276
|
-
|
|
17350
|
+
fs12.renameSync(tmpPath, finalPath);
|
|
17277
17351
|
} finally {
|
|
17278
17352
|
try {
|
|
17279
|
-
|
|
17353
|
+
fs12.unlinkSync(tmpPath);
|
|
17280
17354
|
} catch {
|
|
17281
17355
|
}
|
|
17282
17356
|
}
|
|
17283
17357
|
}
|
|
17284
17358
|
function mintRandomId(finalPath) {
|
|
17285
|
-
|
|
17359
|
+
fs12.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17286
17360
|
let value = crypto2.randomUUID();
|
|
17287
17361
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
17288
|
-
const tmpPath =
|
|
17362
|
+
const tmpPath = path12.join(
|
|
17289
17363
|
argentHomeDir(),
|
|
17290
17364
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17291
17365
|
);
|
|
17292
17366
|
let fd;
|
|
17293
17367
|
try {
|
|
17294
|
-
fd =
|
|
17368
|
+
fd = fs12.openSync(tmpPath, "wx", 384);
|
|
17295
17369
|
} catch (err) {
|
|
17296
17370
|
if (err.code === "EEXIST") continue;
|
|
17297
17371
|
throw err;
|
|
17298
17372
|
}
|
|
17299
17373
|
try {
|
|
17300
17374
|
try {
|
|
17301
|
-
|
|
17302
|
-
|
|
17375
|
+
fs12.writeSync(fd, value);
|
|
17376
|
+
fs12.fsyncSync(fd);
|
|
17303
17377
|
} finally {
|
|
17304
|
-
|
|
17378
|
+
fs12.closeSync(fd);
|
|
17305
17379
|
}
|
|
17306
|
-
|
|
17380
|
+
fs12.linkSync(tmpPath, finalPath);
|
|
17307
17381
|
cached = { path: finalPath, id: value };
|
|
17308
17382
|
return value;
|
|
17309
17383
|
} catch (err) {
|
|
@@ -17322,7 +17396,7 @@ function mintRandomId(finalPath) {
|
|
|
17322
17396
|
throw err;
|
|
17323
17397
|
} finally {
|
|
17324
17398
|
try {
|
|
17325
|
-
|
|
17399
|
+
fs12.unlinkSync(tmpPath);
|
|
17326
17400
|
} catch {
|
|
17327
17401
|
}
|
|
17328
17402
|
}
|
|
@@ -17330,12 +17404,12 @@ function mintRandomId(finalPath) {
|
|
|
17330
17404
|
throw new Error("telemetry: failed to create identity after retries");
|
|
17331
17405
|
}
|
|
17332
17406
|
function claimCorruptOccupant(finalPath) {
|
|
17333
|
-
const claimed =
|
|
17407
|
+
const claimed = path12.join(
|
|
17334
17408
|
argentHomeDir(),
|
|
17335
17409
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
17336
17410
|
);
|
|
17337
17411
|
try {
|
|
17338
|
-
|
|
17412
|
+
fs12.renameSync(finalPath, claimed);
|
|
17339
17413
|
} catch {
|
|
17340
17414
|
return null;
|
|
17341
17415
|
}
|
|
@@ -17344,7 +17418,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17344
17418
|
grabbed = tryReadId(claimed);
|
|
17345
17419
|
} finally {
|
|
17346
17420
|
try {
|
|
17347
|
-
|
|
17421
|
+
fs12.unlinkSync(claimed);
|
|
17348
17422
|
} catch {
|
|
17349
17423
|
}
|
|
17350
17424
|
}
|
|
@@ -17353,7 +17427,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17353
17427
|
function deleteAnonId() {
|
|
17354
17428
|
cached = null;
|
|
17355
17429
|
try {
|
|
17356
|
-
|
|
17430
|
+
fs12.unlinkSync(identityFilePath());
|
|
17357
17431
|
} catch (err) {
|
|
17358
17432
|
if (err.code !== "ENOENT") throw err;
|
|
17359
17433
|
}
|
|
@@ -17361,9 +17435,9 @@ function deleteAnonId() {
|
|
|
17361
17435
|
function tryReadId(filePath) {
|
|
17362
17436
|
let raw;
|
|
17363
17437
|
try {
|
|
17364
|
-
const stats =
|
|
17438
|
+
const stats = fs12.lstatSync(filePath);
|
|
17365
17439
|
if (!stats.isFile()) return null;
|
|
17366
|
-
raw =
|
|
17440
|
+
raw = fs12.readFileSync(filePath, "utf8");
|
|
17367
17441
|
} catch (err) {
|
|
17368
17442
|
if (err.code === "ENOENT") return null;
|
|
17369
17443
|
return null;
|
|
@@ -17377,12 +17451,12 @@ function tryReadId(filePath) {
|
|
|
17377
17451
|
import { execFileSync, spawn } from "node:child_process";
|
|
17378
17452
|
|
|
17379
17453
|
// ../native-devtools-ios/src/index.ts
|
|
17380
|
-
import * as
|
|
17381
|
-
import * as
|
|
17382
|
-
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ??
|
|
17383
|
-
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ??
|
|
17384
|
-
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ??
|
|
17385
|
-
var DYLIB_TVOS_DIR =
|
|
17454
|
+
import * as path13 from "node:path";
|
|
17455
|
+
import * as fs13 from "node:fs";
|
|
17456
|
+
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path13.join(__dirname, "..", "dylibs");
|
|
17457
|
+
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path13.join(__dirname, "..", "bin");
|
|
17458
|
+
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path13.join(DYLIB_DIR, "tcp");
|
|
17459
|
+
var DYLIB_TVOS_DIR = path13.join(DYLIB_DIR, "tvos");
|
|
17386
17460
|
function hostPlatformKey() {
|
|
17387
17461
|
if (process.platform === "linux" && process.arch === "arm64") {
|
|
17388
17462
|
return "linux-arm64";
|
|
@@ -17393,14 +17467,14 @@ function simulatorServerBinaryName() {
|
|
|
17393
17467
|
return process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
|
|
17394
17468
|
}
|
|
17395
17469
|
function platformBinDir() {
|
|
17396
|
-
return
|
|
17470
|
+
return path13.join(BIN_DIR, hostPlatformKey());
|
|
17397
17471
|
}
|
|
17398
17472
|
function simulatorServerBinaryPath() {
|
|
17399
17473
|
const binaryName = simulatorServerBinaryName();
|
|
17400
|
-
const p =
|
|
17401
|
-
if (!
|
|
17402
|
-
const flat =
|
|
17403
|
-
const migrationHint =
|
|
17474
|
+
const p = path13.join(platformBinDir(), binaryName);
|
|
17475
|
+
if (!fs13.existsSync(p)) {
|
|
17476
|
+
const flat = path13.join(BIN_DIR, binaryName);
|
|
17477
|
+
const migrationHint = fs13.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
|
|
17404
17478
|
throw new Error(
|
|
17405
17479
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
17406
17480
|
);
|
|
@@ -17429,12 +17503,12 @@ function resolveHostFingerprint() {
|
|
|
17429
17503
|
}
|
|
17430
17504
|
}
|
|
17431
17505
|
function resolveHostFingerprintAsync() {
|
|
17432
|
-
return new Promise((
|
|
17506
|
+
return new Promise((resolve22) => {
|
|
17433
17507
|
let binary;
|
|
17434
17508
|
try {
|
|
17435
17509
|
binary = simulatorServerBinaryPath();
|
|
17436
17510
|
} catch {
|
|
17437
|
-
|
|
17511
|
+
resolve22(null);
|
|
17438
17512
|
return;
|
|
17439
17513
|
}
|
|
17440
17514
|
let settled = false;
|
|
@@ -17447,7 +17521,7 @@ function resolveHostFingerprintAsync() {
|
|
|
17447
17521
|
child?.kill("SIGKILL");
|
|
17448
17522
|
} catch {
|
|
17449
17523
|
}
|
|
17450
|
-
|
|
17524
|
+
resolve22(value);
|
|
17451
17525
|
};
|
|
17452
17526
|
const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
|
|
17453
17527
|
watchdog.unref?.();
|
|
@@ -17480,15 +17554,15 @@ function resolveHostFingerprintAsync() {
|
|
|
17480
17554
|
}
|
|
17481
17555
|
|
|
17482
17556
|
// ../telemetry/src/consent.ts
|
|
17483
|
-
import * as
|
|
17484
|
-
import * as
|
|
17557
|
+
import * as fs14 from "node:fs";
|
|
17558
|
+
import * as path14 from "node:path";
|
|
17485
17559
|
var cache = /* @__PURE__ */ new Map();
|
|
17486
17560
|
var sessionOverride = null;
|
|
17487
17561
|
function readConfigOverrideAt(filePath) {
|
|
17488
17562
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
17489
17563
|
let stats;
|
|
17490
17564
|
try {
|
|
17491
|
-
stats =
|
|
17565
|
+
stats = fs14.lstatSync(filePath);
|
|
17492
17566
|
} catch {
|
|
17493
17567
|
cache.set(filePath, miss);
|
|
17494
17568
|
return null;
|
|
@@ -17505,7 +17579,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
17505
17579
|
}
|
|
17506
17580
|
let parsedEnabled = null;
|
|
17507
17581
|
try {
|
|
17508
|
-
const raw =
|
|
17582
|
+
const raw = fs14.readFileSync(filePath, "utf8");
|
|
17509
17583
|
const json = JSON.parse(raw);
|
|
17510
17584
|
if (json && typeof json === "object") {
|
|
17511
17585
|
const t2 = json.telemetry;
|
|
@@ -17522,8 +17596,12 @@ function readConfigOverrideAt(filePath) {
|
|
|
17522
17596
|
function readPersistedConsent(cwd) {
|
|
17523
17597
|
const globalPath = configFilePath("global");
|
|
17524
17598
|
const projectPath = configFilePath("project", { cwd });
|
|
17599
|
+
const userConfigPath = path14.join(resolveHomeDir(), ".argent", "config.json");
|
|
17600
|
+
if (userConfigPath !== globalPath && readConfigOverrideAt(userConfigPath) === false) {
|
|
17601
|
+
return { enabled: false, detail: `${userConfigPath} (user)` };
|
|
17602
|
+
}
|
|
17525
17603
|
const global2 = readConfigOverrideAt(globalPath);
|
|
17526
|
-
const projectRoot =
|
|
17604
|
+
const projectRoot = path14.dirname(path14.dirname(projectPath));
|
|
17527
17605
|
const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
|
|
17528
17606
|
if (project === false && global2 === false) {
|
|
17529
17607
|
return { enabled: false, detail: "config.json (project and global)" };
|
|
@@ -17719,7 +17797,7 @@ var DRAIN_GRACE_MS = 250;
|
|
|
17719
17797
|
async function raceDrain(client2, timeoutMs) {
|
|
17720
17798
|
await Promise.race([
|
|
17721
17799
|
client2.shutdown(timeoutMs),
|
|
17722
|
-
new Promise((
|
|
17800
|
+
new Promise((resolve22) => setTimeout(resolve22, timeoutMs + DRAIN_GRACE_MS).unref())
|
|
17723
17801
|
]);
|
|
17724
17802
|
}
|
|
17725
17803
|
async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
@@ -17739,8 +17817,8 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
17739
17817
|
}
|
|
17740
17818
|
|
|
17741
17819
|
// ../argent-installer/src/mcp-configs.ts
|
|
17742
|
-
import * as
|
|
17743
|
-
import * as
|
|
17820
|
+
import * as fs21 from "node:fs";
|
|
17821
|
+
import * as path21 from "node:path";
|
|
17744
17822
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
17745
17823
|
import { homedir as homedir5 } from "node:os";
|
|
17746
17824
|
|
|
@@ -17755,11 +17833,11 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
|
|
|
17755
17833
|
|
|
17756
17834
|
// ../argent-installer/src/utils.ts
|
|
17757
17835
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
17758
|
-
import * as
|
|
17759
|
-
import * as
|
|
17836
|
+
import * as fs20 from "node:fs";
|
|
17837
|
+
import * as path20 from "node:path";
|
|
17760
17838
|
import * as dns from "node:dns";
|
|
17761
17839
|
import { createHash as createHash2 } from "node:crypto";
|
|
17762
|
-
import * as
|
|
17840
|
+
import * as os4 from "node:os";
|
|
17763
17841
|
import { execFileSync as execFileSync4, execSync } from "node:child_process";
|
|
17764
17842
|
|
|
17765
17843
|
// ../../node_modules/smol-toml/dist/error.js
|
|
@@ -19482,11 +19560,11 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
19482
19560
|
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
19483
19561
|
ensurePropertyComplete(offset + length);
|
|
19484
19562
|
},
|
|
19485
|
-
onSeparator: (
|
|
19563
|
+
onSeparator: (sep10, offset, length) => {
|
|
19486
19564
|
if (currentParent.type === "property") {
|
|
19487
|
-
if (
|
|
19565
|
+
if (sep10 === ":") {
|
|
19488
19566
|
currentParent.colonOffset = offset;
|
|
19489
|
-
} else if (
|
|
19567
|
+
} else if (sep10 === ",") {
|
|
19490
19568
|
ensurePropertyComplete(offset);
|
|
19491
19569
|
}
|
|
19492
19570
|
}
|
|
@@ -19502,12 +19580,12 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
19502
19580
|
}
|
|
19503
19581
|
return result;
|
|
19504
19582
|
}
|
|
19505
|
-
function findNodeAtLocation(root,
|
|
19583
|
+
function findNodeAtLocation(root, path35) {
|
|
19506
19584
|
if (!root) {
|
|
19507
19585
|
return void 0;
|
|
19508
19586
|
}
|
|
19509
19587
|
let node = root;
|
|
19510
|
-
for (let segment of
|
|
19588
|
+
for (let segment of path35) {
|
|
19511
19589
|
if (typeof segment === "string") {
|
|
19512
19590
|
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
19513
19591
|
return void 0;
|
|
@@ -19861,14 +19939,14 @@ function getNodeType(value) {
|
|
|
19861
19939
|
|
|
19862
19940
|
// ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
19863
19941
|
function setProperty(text2, originalPath, value, options) {
|
|
19864
|
-
const
|
|
19942
|
+
const path35 = originalPath.slice();
|
|
19865
19943
|
const errors = [];
|
|
19866
19944
|
const root = parseTree(text2, errors);
|
|
19867
19945
|
let parent = void 0;
|
|
19868
19946
|
let lastSegment = void 0;
|
|
19869
|
-
while (
|
|
19870
|
-
lastSegment =
|
|
19871
|
-
parent = findNodeAtLocation(root,
|
|
19947
|
+
while (path35.length > 0) {
|
|
19948
|
+
lastSegment = path35.pop();
|
|
19949
|
+
parent = findNodeAtLocation(root, path35);
|
|
19872
19950
|
if (parent === void 0 && value !== void 0) {
|
|
19873
19951
|
if (typeof lastSegment === "string") {
|
|
19874
19952
|
value = { [lastSegment]: value };
|
|
@@ -20054,8 +20132,8 @@ var ParseErrorCode;
|
|
|
20054
20132
|
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
20055
20133
|
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
20056
20134
|
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
20057
|
-
function modify(text2,
|
|
20058
|
-
return setProperty(text2,
|
|
20135
|
+
function modify(text2, path35, value, options) {
|
|
20136
|
+
return setProperty(text2, path35, value, options);
|
|
20059
20137
|
}
|
|
20060
20138
|
function applyEdits(text2, edits) {
|
|
20061
20139
|
let sortedEdits = edits.slice(0).sort((a2, b) => {
|
|
@@ -20079,39 +20157,39 @@ function applyEdits(text2, edits) {
|
|
|
20079
20157
|
}
|
|
20080
20158
|
|
|
20081
20159
|
// ../argent-installer/src/package-root.ts
|
|
20082
|
-
import * as
|
|
20083
|
-
import * as
|
|
20160
|
+
import * as fs15 from "node:fs";
|
|
20161
|
+
import * as path15 from "node:path";
|
|
20084
20162
|
function resolvePackageRoot(dirname20) {
|
|
20085
|
-
let current =
|
|
20163
|
+
let current = path15.resolve(dirname20);
|
|
20086
20164
|
while (true) {
|
|
20087
|
-
if (
|
|
20088
|
-
const parent =
|
|
20089
|
-
if (parent === current) return
|
|
20165
|
+
if (fs15.existsSync(path15.join(current, "package.json"))) return current;
|
|
20166
|
+
const parent = path15.dirname(current);
|
|
20167
|
+
if (parent === current) return path15.resolve(dirname20);
|
|
20090
20168
|
current = parent;
|
|
20091
20169
|
}
|
|
20092
20170
|
}
|
|
20093
20171
|
|
|
20094
20172
|
// ../argent-installer/src/package-manager.ts
|
|
20095
20173
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
20096
|
-
import * as
|
|
20097
|
-
import * as
|
|
20098
|
-
import * as
|
|
20174
|
+
import * as fs18 from "node:fs";
|
|
20175
|
+
import * as os3 from "node:os";
|
|
20176
|
+
import * as path18 from "node:path";
|
|
20099
20177
|
|
|
20100
20178
|
// ../argent-installer/src/topology.ts
|
|
20101
20179
|
var import_semver2 = __toESM(require_semver2(), 1);
|
|
20102
|
-
import * as
|
|
20103
|
-
import * as
|
|
20180
|
+
import * as fs17 from "node:fs";
|
|
20181
|
+
import * as path17 from "node:path";
|
|
20104
20182
|
import { createRequire } from "node:module";
|
|
20105
20183
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
20106
20184
|
|
|
20107
20185
|
// ../argent-installer/src/preflight.ts
|
|
20108
|
-
import * as
|
|
20109
|
-
import * as
|
|
20186
|
+
import * as fs16 from "node:fs";
|
|
20187
|
+
import * as path16 from "node:path";
|
|
20110
20188
|
function hasProjectPackageJson(projectRoot) {
|
|
20111
|
-
return
|
|
20189
|
+
return fs16.existsSync(path16.join(projectRoot, "package.json"));
|
|
20112
20190
|
}
|
|
20113
20191
|
function isYarnPnp(projectRoot) {
|
|
20114
|
-
return
|
|
20192
|
+
return fs16.existsSync(path16.join(projectRoot, ".pnp.cjs")) || fs16.existsSync(path16.join(projectRoot, ".pnp.loader.mjs"));
|
|
20115
20193
|
}
|
|
20116
20194
|
|
|
20117
20195
|
// ../argent-installer/src/topology.ts
|
|
@@ -20137,12 +20215,12 @@ function isTempRunnerPath(binaryPath) {
|
|
|
20137
20215
|
}
|
|
20138
20216
|
function isProjectBinPath(binaryPath) {
|
|
20139
20217
|
const norm = (p) => process.platform === "win32" ? p.toLowerCase() : canonicalPath(p);
|
|
20140
|
-
const binDir = norm(
|
|
20218
|
+
const binDir = norm(path17.dirname(path17.resolve(binaryPath)));
|
|
20141
20219
|
const prefix = process.env.npm_config_local_prefix;
|
|
20142
|
-
if (prefix && norm(
|
|
20143
|
-
for (let dir =
|
|
20144
|
-
if (norm(
|
|
20145
|
-
if (
|
|
20220
|
+
if (prefix && norm(path17.join(prefix, "node_modules", ".bin")) === binDir) return true;
|
|
20221
|
+
for (let dir = path17.resolve(process.cwd()); ; dir = path17.dirname(dir)) {
|
|
20222
|
+
if (norm(path17.join(dir, "node_modules", ".bin")) === binDir) return true;
|
|
20223
|
+
if (path17.dirname(dir) === dir) return false;
|
|
20146
20224
|
}
|
|
20147
20225
|
}
|
|
20148
20226
|
function getPermanentBinaryPaths() {
|
|
@@ -20190,8 +20268,8 @@ function getGloballyInstalledPackageRoot() {
|
|
|
20190
20268
|
}
|
|
20191
20269
|
function readShimScript(binaryPath) {
|
|
20192
20270
|
try {
|
|
20193
|
-
if (
|
|
20194
|
-
return
|
|
20271
|
+
if (fs17.statSync(binaryPath).size > 64 * 1024) return null;
|
|
20272
|
+
return fs17.readFileSync(binaryPath, "utf8");
|
|
20195
20273
|
} catch {
|
|
20196
20274
|
return null;
|
|
20197
20275
|
}
|
|
@@ -20202,7 +20280,7 @@ function shimTargetOf(binaryPath) {
|
|
|
20202
20280
|
const trailer = /^# cmd-shim-target=(.+)$/m.exec(shim);
|
|
20203
20281
|
if (trailer) return trailer[1].trim();
|
|
20204
20282
|
const relative5 = /"\$basedir(?:_abs)?"?\/'?([^"'\s]*node_modules\/[^"'\s]*)/.exec(shim);
|
|
20205
|
-
return relative5 ?
|
|
20283
|
+
return relative5 ? path17.resolve(canonicalPath(path17.dirname(binaryPath)), relative5[1]) : null;
|
|
20206
20284
|
}
|
|
20207
20285
|
function globalPackageRootOf(binaryPath) {
|
|
20208
20286
|
const root = packageRootOf(binaryPath);
|
|
@@ -20212,9 +20290,9 @@ function globalPackageRootOf(binaryPath) {
|
|
|
20212
20290
|
}
|
|
20213
20291
|
function packageRootOf(binaryPath) {
|
|
20214
20292
|
try {
|
|
20215
|
-
const realPath =
|
|
20216
|
-
const root = resolvePackageRoot(
|
|
20217
|
-
const pkg = JSON.parse(
|
|
20293
|
+
const realPath = fs17.realpathSync(binaryPath);
|
|
20294
|
+
const root = resolvePackageRoot(path17.dirname(realPath));
|
|
20295
|
+
const pkg = JSON.parse(fs17.readFileSync(path17.join(root, "package.json"), "utf8"));
|
|
20218
20296
|
return pkg.name === PACKAGE_NAME ? root : null;
|
|
20219
20297
|
} catch {
|
|
20220
20298
|
return null;
|
|
@@ -20223,8 +20301,8 @@ function packageRootOf(binaryPath) {
|
|
|
20223
20301
|
function cliPathOf(packageRoot) {
|
|
20224
20302
|
const binSub = argentBinSubpath(packageRoot);
|
|
20225
20303
|
if (!binSub) return null;
|
|
20226
|
-
const cli =
|
|
20227
|
-
return
|
|
20304
|
+
const cli = path17.join(packageRoot, binSub);
|
|
20305
|
+
return fs17.existsSync(cli) ? cli : null;
|
|
20228
20306
|
}
|
|
20229
20307
|
function getGloballyInstalledLaunchPaths() {
|
|
20230
20308
|
if (process.platform === "win32") return null;
|
|
@@ -20234,8 +20312,8 @@ function getGloballyInstalledLaunchPaths() {
|
|
|
20234
20312
|
const cli = packageRoot ? cliPathOf(packageRoot) : null;
|
|
20235
20313
|
if (!cli) return null;
|
|
20236
20314
|
try {
|
|
20237
|
-
const node =
|
|
20238
|
-
return
|
|
20315
|
+
const node = path17.join(fs17.realpathSync(path17.dirname(binaryPath)), "node");
|
|
20316
|
+
return fs17.existsSync(node) ? { node, cli } : null;
|
|
20239
20317
|
} catch {
|
|
20240
20318
|
return null;
|
|
20241
20319
|
}
|
|
@@ -20244,7 +20322,7 @@ function getGloballyInstalledVersion() {
|
|
|
20244
20322
|
const pkgRoot = getGloballyInstalledPackageRoot();
|
|
20245
20323
|
if (!pkgRoot) return null;
|
|
20246
20324
|
try {
|
|
20247
|
-
const pkg = JSON.parse(
|
|
20325
|
+
const pkg = JSON.parse(fs17.readFileSync(path17.join(pkgRoot, "package.json"), "utf8"));
|
|
20248
20326
|
return pkg.version ?? null;
|
|
20249
20327
|
} catch {
|
|
20250
20328
|
return null;
|
|
@@ -20253,7 +20331,7 @@ function getGloballyInstalledVersion() {
|
|
|
20253
20331
|
function readManifestDeclaration(projectRoot) {
|
|
20254
20332
|
try {
|
|
20255
20333
|
const pkg = JSON.parse(
|
|
20256
|
-
|
|
20334
|
+
fs17.readFileSync(path17.join(projectRoot, "package.json"), "utf8")
|
|
20257
20335
|
);
|
|
20258
20336
|
const spec = pkg.devDependencies?.[PACKAGE_NAME] ?? pkg.dependencies?.[PACKAGE_NAME] ?? pkg.optionalDependencies?.[PACKAGE_NAME];
|
|
20259
20337
|
return typeof spec === "string" ? spec : null;
|
|
@@ -20266,11 +20344,11 @@ function isDeclaredLocally(projectRoot) {
|
|
|
20266
20344
|
}
|
|
20267
20345
|
function resolveLocalArgentDir(projectRoot) {
|
|
20268
20346
|
try {
|
|
20269
|
-
const req = createRequire(
|
|
20270
|
-
return
|
|
20347
|
+
const req = createRequire(path17.join(projectRoot, "package.json"));
|
|
20348
|
+
return path17.dirname(req.resolve(`${PACKAGE_NAME}/package.json`));
|
|
20271
20349
|
} catch {
|
|
20272
|
-
const plain =
|
|
20273
|
-
return
|
|
20350
|
+
const plain = path17.join(projectRoot, "node_modules", PACKAGE_NAME);
|
|
20351
|
+
return fs17.existsSync(path17.join(plain, "package.json")) ? plain : null;
|
|
20274
20352
|
}
|
|
20275
20353
|
}
|
|
20276
20354
|
function probeLocalInstall(projectRoot) {
|
|
@@ -20278,7 +20356,7 @@ function probeLocalInstall(projectRoot) {
|
|
|
20278
20356
|
if (packageDir) {
|
|
20279
20357
|
let version;
|
|
20280
20358
|
try {
|
|
20281
|
-
const pkg = JSON.parse(
|
|
20359
|
+
const pkg = JSON.parse(fs17.readFileSync(path17.join(packageDir, "package.json"), "utf8"));
|
|
20282
20360
|
version = pkg.version ?? null;
|
|
20283
20361
|
} catch {
|
|
20284
20362
|
version = null;
|
|
@@ -20301,8 +20379,8 @@ function getLocallyInstalledVersion(projectRoot) {
|
|
|
20301
20379
|
}
|
|
20302
20380
|
function readLocalPackageVersionUncached(projectRoot) {
|
|
20303
20381
|
try {
|
|
20304
|
-
const pkgPath =
|
|
20305
|
-
const pkg = JSON.parse(
|
|
20382
|
+
const pkgPath = path17.join(projectRoot, "node_modules", PACKAGE_NAME, "package.json");
|
|
20383
|
+
const pkg = JSON.parse(fs17.readFileSync(pkgPath, "utf8"));
|
|
20306
20384
|
return pkg.version ?? null;
|
|
20307
20385
|
} catch {
|
|
20308
20386
|
return null;
|
|
@@ -20310,7 +20388,7 @@ function readLocalPackageVersionUncached(projectRoot) {
|
|
|
20310
20388
|
}
|
|
20311
20389
|
function argentBinSubpath(pkgDir) {
|
|
20312
20390
|
try {
|
|
20313
|
-
const pkg = JSON.parse(
|
|
20391
|
+
const pkg = JSON.parse(fs17.readFileSync(path17.join(pkgDir, "package.json"), "utf8"));
|
|
20314
20392
|
if (typeof pkg.bin === "string") return pkg.bin;
|
|
20315
20393
|
if (pkg.bin && typeof pkg.bin === "object") {
|
|
20316
20394
|
return pkg.bin[MCP_BINARY_NAME] ?? Object.values(pkg.bin)[0] ?? null;
|
|
@@ -20327,16 +20405,16 @@ function getLocalArgentBinRelPath(projectRoot) {
|
|
|
20327
20405
|
if (!binSub) return null;
|
|
20328
20406
|
let root = projectRoot;
|
|
20329
20407
|
try {
|
|
20330
|
-
root =
|
|
20408
|
+
root = fs17.realpathSync(projectRoot);
|
|
20331
20409
|
} catch {
|
|
20332
20410
|
}
|
|
20333
|
-
const stableRel =
|
|
20334
|
-
if (
|
|
20335
|
-
return stableRel.split(
|
|
20411
|
+
const stableRel = path17.join("node_modules", PACKAGE_NAME, binSub);
|
|
20412
|
+
if (fs17.existsSync(path17.join(root, stableRel))) {
|
|
20413
|
+
return stableRel.split(path17.sep).join("/");
|
|
20336
20414
|
}
|
|
20337
|
-
const abs =
|
|
20338
|
-
if (!
|
|
20339
|
-
return
|
|
20415
|
+
const abs = path17.join(pkgDir, binSub);
|
|
20416
|
+
if (!fs17.existsSync(abs)) return null;
|
|
20417
|
+
return path17.relative(root, abs).split(path17.sep).join("/");
|
|
20340
20418
|
}
|
|
20341
20419
|
|
|
20342
20420
|
// ../argent-installer/src/package-manager.ts
|
|
@@ -20369,10 +20447,10 @@ function detectGlobalPackageManager() {
|
|
|
20369
20447
|
return BUN_GLOBAL_ROOT.test(root) ? "bun" : lockfileOwnerOf(root) ?? "yarn";
|
|
20370
20448
|
}
|
|
20371
20449
|
if (process.platform === "win32") {
|
|
20372
|
-
if (
|
|
20450
|
+
if (fs18.existsSync(path18.join(npmCopyBeside(path18.dirname(binaryPath)), "package.json"))) {
|
|
20373
20451
|
return "npm";
|
|
20374
20452
|
}
|
|
20375
|
-
if (
|
|
20453
|
+
if (fs18.existsSync(binaryPath.replace(/\.exe$/i, "") + ".bunx")) return "bun";
|
|
20376
20454
|
}
|
|
20377
20455
|
const shim = readShimScript(binaryPath);
|
|
20378
20456
|
if (shim === null || !/node_modules[\\/]/.test(shim)) return "npm";
|
|
@@ -20381,23 +20459,23 @@ function detectGlobalPackageManager() {
|
|
|
20381
20459
|
return (target ? lockfileOwnerOf(target) : null) ?? "yarn";
|
|
20382
20460
|
}
|
|
20383
20461
|
function lockfileOwnerOf(root) {
|
|
20384
|
-
for (let dir =
|
|
20462
|
+
for (let dir = path18.dirname(root); path18.dirname(dir) !== dir; dir = path18.dirname(dir)) {
|
|
20385
20463
|
const pm = pmFromLockfile(dir);
|
|
20386
20464
|
if (pm) return pm;
|
|
20387
20465
|
}
|
|
20388
20466
|
return null;
|
|
20389
20467
|
}
|
|
20390
20468
|
function npmCopyBeside(binDir) {
|
|
20391
|
-
return process.platform === "win32" ?
|
|
20469
|
+
return process.platform === "win32" ? path18.join(binDir, "node_modules", PACKAGE_NAME) : path18.join(path18.dirname(binDir), "lib", "node_modules", PACKAGE_NAME);
|
|
20392
20470
|
}
|
|
20393
20471
|
function isInNpmLayout(binaryPath, root) {
|
|
20394
20472
|
const realRoot = canonicalPath(root);
|
|
20395
20473
|
let link = binaryPath;
|
|
20396
20474
|
for (let hop = 0; hop < 40; hop++) {
|
|
20397
|
-
const binDir = canonicalPath(
|
|
20475
|
+
const binDir = canonicalPath(path18.dirname(link));
|
|
20398
20476
|
if (canonicalPath(npmCopyBeside(binDir)) === realRoot) return true;
|
|
20399
20477
|
try {
|
|
20400
|
-
link =
|
|
20478
|
+
link = path18.resolve(binDir, fs18.readlinkSync(link));
|
|
20401
20479
|
} catch {
|
|
20402
20480
|
return false;
|
|
20403
20481
|
}
|
|
@@ -20416,7 +20494,7 @@ function asKnownPm(name) {
|
|
|
20416
20494
|
}
|
|
20417
20495
|
function pmFromPackageManagerField(dir) {
|
|
20418
20496
|
try {
|
|
20419
|
-
const pkg = JSON.parse(
|
|
20497
|
+
const pkg = JSON.parse(fs18.readFileSync(path18.join(dir, "package.json"), "utf8"));
|
|
20420
20498
|
if (typeof pkg.packageManager === "string") {
|
|
20421
20499
|
return asKnownPm(pkg.packageManager.split("@")[0]);
|
|
20422
20500
|
}
|
|
@@ -20427,7 +20505,7 @@ function pmFromPackageManagerField(dir) {
|
|
|
20427
20505
|
}
|
|
20428
20506
|
function pmFromDevEngines(dir) {
|
|
20429
20507
|
try {
|
|
20430
|
-
const pkg = JSON.parse(
|
|
20508
|
+
const pkg = JSON.parse(fs18.readFileSync(path18.join(dir, "package.json"), "utf8"));
|
|
20431
20509
|
const devEnginesPm = pkg.devEngines?.packageManager;
|
|
20432
20510
|
const names = /* @__PURE__ */ new Set();
|
|
20433
20511
|
for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
|
|
@@ -20440,7 +20518,7 @@ function pmFromDevEngines(dir) {
|
|
|
20440
20518
|
}
|
|
20441
20519
|
}
|
|
20442
20520
|
function pmFromLockfile(dir) {
|
|
20443
|
-
const has = (file) =>
|
|
20521
|
+
const has = (file) => fs18.existsSync(path18.join(dir, file));
|
|
20444
20522
|
if (has("pnpm-lock.yaml")) return "pnpm";
|
|
20445
20523
|
if (has("yarn.lock")) return "yarn";
|
|
20446
20524
|
if (has("bun.lock") || has("bun.lockb")) return "bun";
|
|
@@ -20448,15 +20526,15 @@ function pmFromLockfile(dir) {
|
|
|
20448
20526
|
return null;
|
|
20449
20527
|
}
|
|
20450
20528
|
function pmFromWorkspaceMarker(dir) {
|
|
20451
|
-
return
|
|
20529
|
+
return fs18.existsSync(path18.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
|
|
20452
20530
|
}
|
|
20453
20531
|
function detectProjectPackageManager(projectRoot) {
|
|
20454
|
-
let dir =
|
|
20532
|
+
let dir = path18.resolve(projectRoot);
|
|
20455
20533
|
for (; ; ) {
|
|
20456
20534
|
const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
|
|
20457
20535
|
if (pm) return pm;
|
|
20458
|
-
if (
|
|
20459
|
-
const parent =
|
|
20536
|
+
if (fs18.existsSync(path18.join(dir, ".git"))) break;
|
|
20537
|
+
const parent = path18.dirname(dir);
|
|
20460
20538
|
if (parent === dir) break;
|
|
20461
20539
|
dir = parent;
|
|
20462
20540
|
}
|
|
@@ -20476,8 +20554,8 @@ function globalInstallCommand(pm, pkg) {
|
|
|
20476
20554
|
}
|
|
20477
20555
|
function globalCommandOptions(pm) {
|
|
20478
20556
|
if (pm === "npm") return {};
|
|
20479
|
-
const home =
|
|
20480
|
-
const cwd =
|
|
20557
|
+
const home = os3.homedir();
|
|
20558
|
+
const cwd = fs18.existsSync(home) ? { cwd: home } : {};
|
|
20481
20559
|
if (pm !== "yarn" || !process.env.npm_config_user_agent?.startsWith("npm/")) return cwd;
|
|
20482
20560
|
const { npm_config_prefix: _npmPrefix, ...env } = process.env;
|
|
20483
20561
|
return { ...cwd, env };
|
|
@@ -20509,11 +20587,11 @@ function ownsGlobalInstall(pm, runningRoot) {
|
|
|
20509
20587
|
localBuild = !isRegistrySpec(dependency?.version);
|
|
20510
20588
|
} else {
|
|
20511
20589
|
const dir = pm === "bun" ? /^([^\r\n]+) node_modules \(/.exec(output)?.[1] : output;
|
|
20512
|
-
if (!dir || !
|
|
20513
|
-
pkg = pm === "npm" ?
|
|
20514
|
-
localBuild =
|
|
20590
|
+
if (!dir || !path18.isAbsolute(dir)) return false;
|
|
20591
|
+
pkg = pm === "npm" ? path18.join(dir, PACKAGE_NAME) : path18.join(dir, "node_modules", PACKAGE_NAME);
|
|
20592
|
+
localBuild = fs18.lstatSync(pkg).isSymbolicLink();
|
|
20515
20593
|
}
|
|
20516
|
-
return !localBuild && !!pkg &&
|
|
20594
|
+
return !localBuild && !!pkg && path18.isAbsolute(pkg) && fs18.realpathSync(pkg) === runningRoot;
|
|
20517
20595
|
} catch {
|
|
20518
20596
|
return false;
|
|
20519
20597
|
}
|
|
@@ -20568,15 +20646,15 @@ function localUninstallCommand(pm, pkg) {
|
|
|
20568
20646
|
}
|
|
20569
20647
|
|
|
20570
20648
|
// ../argent-installer/src/install-record.ts
|
|
20571
|
-
import * as
|
|
20572
|
-
import * as
|
|
20649
|
+
import * as fs19 from "node:fs";
|
|
20650
|
+
import * as path19 from "node:path";
|
|
20573
20651
|
function getInstallRecordPath(projectRoot) {
|
|
20574
|
-
return
|
|
20652
|
+
return path19.join(projectRoot, ".argent", "install.json");
|
|
20575
20653
|
}
|
|
20576
20654
|
function readInstallRecord(projectRoot) {
|
|
20577
20655
|
try {
|
|
20578
20656
|
const parsed = JSON.parse(
|
|
20579
|
-
|
|
20657
|
+
fs19.readFileSync(getInstallRecordPath(projectRoot), "utf8")
|
|
20580
20658
|
);
|
|
20581
20659
|
if (parsed && (parsed.mode === "local" || parsed.mode === "global")) return parsed;
|
|
20582
20660
|
return null;
|
|
@@ -20586,17 +20664,17 @@ function readInstallRecord(projectRoot) {
|
|
|
20586
20664
|
}
|
|
20587
20665
|
function writeInstallRecord(projectRoot, record) {
|
|
20588
20666
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20589
|
-
|
|
20590
|
-
|
|
20667
|
+
fs19.mkdirSync(path19.dirname(recordPath), { recursive: true });
|
|
20668
|
+
fs19.writeFileSync(recordPath, JSON.stringify(record, null, 2) + "\n");
|
|
20591
20669
|
}
|
|
20592
20670
|
function removeInstallRecord(projectRoot) {
|
|
20593
20671
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20594
20672
|
try {
|
|
20595
|
-
if (!
|
|
20596
|
-
|
|
20597
|
-
const dir =
|
|
20673
|
+
if (!fs19.existsSync(recordPath)) return false;
|
|
20674
|
+
fs19.rmSync(recordPath, { force: true });
|
|
20675
|
+
const dir = path19.dirname(recordPath);
|
|
20598
20676
|
try {
|
|
20599
|
-
if (
|
|
20677
|
+
if (fs19.existsSync(dir) && fs19.readdirSync(dir).length === 0) fs19.rmdirSync(dir);
|
|
20600
20678
|
} catch {
|
|
20601
20679
|
}
|
|
20602
20680
|
return true;
|
|
@@ -20624,9 +20702,9 @@ function resolveInstallModeFromFlags(opts) {
|
|
|
20624
20702
|
// ../argent-installer/src/utils.ts
|
|
20625
20703
|
var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
|
|
20626
20704
|
function resolveBundledDir(dirName) {
|
|
20627
|
-
const packagedDir =
|
|
20628
|
-
if (
|
|
20629
|
-
return
|
|
20705
|
+
const packagedDir = path20.join(PACKAGE_ROOT, dirName);
|
|
20706
|
+
if (fs20.existsSync(packagedDir)) return packagedDir;
|
|
20707
|
+
return path20.resolve(PACKAGE_ROOT, "..", "skills", dirName);
|
|
20630
20708
|
}
|
|
20631
20709
|
var SKILLS_DIR = resolveBundledDir("skills");
|
|
20632
20710
|
var RULES_DIR = resolveBundledDir("rules");
|
|
@@ -20638,18 +20716,18 @@ function buildArgentSkillsSource(version) {
|
|
|
20638
20716
|
}
|
|
20639
20717
|
function listBundledSkills(skillsDir = SKILLS_DIR) {
|
|
20640
20718
|
try {
|
|
20641
|
-
return
|
|
20719
|
+
return fs20.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs20.existsSync(path20.join(skillsDir, name, "SKILL.md"))).sort();
|
|
20642
20720
|
} catch {
|
|
20643
20721
|
return [];
|
|
20644
20722
|
}
|
|
20645
20723
|
}
|
|
20646
20724
|
function getProjectSkillLockPath(cwd = process.cwd()) {
|
|
20647
|
-
return
|
|
20725
|
+
return path20.join(cwd, "skills-lock.json");
|
|
20648
20726
|
}
|
|
20649
20727
|
function getGlobalSkillLockPath() {
|
|
20650
20728
|
const xdgStateHome = process.env.XDG_STATE_HOME;
|
|
20651
|
-
if (xdgStateHome) return
|
|
20652
|
-
return
|
|
20729
|
+
if (xdgStateHome) return path20.join(xdgStateHome, "skills", ".skill-lock.json");
|
|
20730
|
+
return path20.join(os4.homedir(), ".agents", ".skill-lock.json");
|
|
20653
20731
|
}
|
|
20654
20732
|
var ARGENT_SKILL_PREFIX = "argent-";
|
|
20655
20733
|
var LEGACY_ARGENT_SKILL_NAMES = [
|
|
@@ -20755,7 +20833,7 @@ function hashBundledContent(content) {
|
|
|
20755
20833
|
}
|
|
20756
20834
|
function listArgentSkillsInLock(lockPath) {
|
|
20757
20835
|
try {
|
|
20758
|
-
const raw =
|
|
20836
|
+
const raw = fs20.readFileSync(lockPath, "utf8");
|
|
20759
20837
|
const lock = JSON.parse(raw);
|
|
20760
20838
|
const tracked = lock.skills ?? {};
|
|
20761
20839
|
return Object.keys(tracked).filter((name) => name.startsWith(ARGENT_SKILL_PREFIX)).sort();
|
|
@@ -20778,21 +20856,21 @@ var PROJECT_ROOT_MARKERS = [
|
|
|
20778
20856
|
"opencode.jsonc",
|
|
20779
20857
|
"skills-lock.json"
|
|
20780
20858
|
];
|
|
20781
|
-
function resolveProjectRoot2(startDir, homeDir =
|
|
20782
|
-
const initialDir =
|
|
20859
|
+
function resolveProjectRoot2(startDir, homeDir = os4.homedir()) {
|
|
20860
|
+
const initialDir = path20.resolve(startDir);
|
|
20783
20861
|
const home = canonicalPath(homeDir);
|
|
20784
20862
|
let currentDir = initialDir;
|
|
20785
20863
|
while (true) {
|
|
20786
20864
|
if (currentDir !== initialDir && canonicalPath(currentDir) === home) {
|
|
20787
20865
|
return initialDir;
|
|
20788
20866
|
}
|
|
20789
|
-
if (PROJECT_ROOT_MARKERS.some((marker) =>
|
|
20867
|
+
if (PROJECT_ROOT_MARKERS.some((marker) => fs20.existsSync(path20.join(currentDir, marker)))) {
|
|
20790
20868
|
return currentDir;
|
|
20791
20869
|
}
|
|
20792
|
-
if (
|
|
20870
|
+
if (fs20.existsSync(path20.join(currentDir, ".git"))) {
|
|
20793
20871
|
return currentDir;
|
|
20794
20872
|
}
|
|
20795
|
-
const parentDir =
|
|
20873
|
+
const parentDir = path20.dirname(currentDir);
|
|
20796
20874
|
if (parentDir === currentDir) {
|
|
20797
20875
|
return initialDir;
|
|
20798
20876
|
}
|
|
@@ -20800,20 +20878,20 @@ function resolveProjectRoot2(startDir, homeDir = os3.homedir()) {
|
|
|
20800
20878
|
}
|
|
20801
20879
|
}
|
|
20802
20880
|
function readToml(filePath) {
|
|
20803
|
-
if (!
|
|
20881
|
+
if (!fs20.existsSync(filePath)) return {};
|
|
20804
20882
|
try {
|
|
20805
|
-
return parse(
|
|
20883
|
+
return parse(fs20.readFileSync(filePath, "utf8"));
|
|
20806
20884
|
} catch {
|
|
20807
20885
|
return {};
|
|
20808
20886
|
}
|
|
20809
20887
|
}
|
|
20810
20888
|
function writeToml(filePath, data) {
|
|
20811
|
-
|
|
20812
|
-
|
|
20889
|
+
fs20.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20890
|
+
fs20.writeFileSync(filePath, stringify(data) + "\n");
|
|
20813
20891
|
}
|
|
20814
20892
|
function readYaml(filePath) {
|
|
20815
|
-
if (!
|
|
20816
|
-
const text2 =
|
|
20893
|
+
if (!fs20.existsSync(filePath)) return new import_yaml.Document({});
|
|
20894
|
+
const text2 = fs20.readFileSync(filePath, "utf8");
|
|
20817
20895
|
const doc = (0, import_yaml.parseDocument)(text2);
|
|
20818
20896
|
if (doc.errors.length > 0) {
|
|
20819
20897
|
const messages = doc.errors.map((e) => e.message).join("; ");
|
|
@@ -20822,20 +20900,20 @@ function readYaml(filePath) {
|
|
|
20822
20900
|
return doc;
|
|
20823
20901
|
}
|
|
20824
20902
|
function writeYaml(filePath, doc) {
|
|
20825
|
-
|
|
20826
|
-
|
|
20903
|
+
fs20.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20904
|
+
fs20.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
|
|
20827
20905
|
}
|
|
20828
20906
|
function readJson(filePath) {
|
|
20829
|
-
if (!
|
|
20907
|
+
if (!fs20.existsSync(filePath)) return {};
|
|
20830
20908
|
try {
|
|
20831
|
-
return JSON.parse(
|
|
20909
|
+
return JSON.parse(fs20.readFileSync(filePath, "utf8"));
|
|
20832
20910
|
} catch {
|
|
20833
20911
|
return {};
|
|
20834
20912
|
}
|
|
20835
20913
|
}
|
|
20836
20914
|
function writeJson(filePath, data) {
|
|
20837
|
-
|
|
20838
|
-
|
|
20915
|
+
fs20.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20916
|
+
fs20.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
|
|
20839
20917
|
}
|
|
20840
20918
|
var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
|
|
20841
20919
|
function setJsoncIn(text2, jsonPath, value) {
|
|
@@ -20843,8 +20921,8 @@ function setJsoncIn(text2, jsonPath, value) {
|
|
|
20843
20921
|
return applyEdits(text2, edits);
|
|
20844
20922
|
}
|
|
20845
20923
|
function readJsoncFileRaw(filePath) {
|
|
20846
|
-
if (!
|
|
20847
|
-
let text2 =
|
|
20924
|
+
if (!fs20.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
|
|
20925
|
+
let text2 = fs20.readFileSync(filePath, "utf8");
|
|
20848
20926
|
const hadBom = text2.charCodeAt(0) === 65279;
|
|
20849
20927
|
if (hadBom) text2 = text2.slice(1);
|
|
20850
20928
|
const wasEmpty = text2.trim() === "";
|
|
@@ -20863,26 +20941,26 @@ function isEmptyPlainObject(value) {
|
|
|
20863
20941
|
return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0;
|
|
20864
20942
|
}
|
|
20865
20943
|
function removePath(targetPath) {
|
|
20866
|
-
const entry =
|
|
20944
|
+
const entry = fs20.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
20867
20945
|
if (!entry) return false;
|
|
20868
|
-
if (entry.isSymbolicLink())
|
|
20869
|
-
else
|
|
20946
|
+
if (entry.isSymbolicLink()) fs20.unlinkSync(targetPath);
|
|
20947
|
+
else fs20.rmSync(targetPath, { recursive: entry.isDirectory(), force: true });
|
|
20870
20948
|
return true;
|
|
20871
20949
|
}
|
|
20872
20950
|
function rmEmptyDir(dirPath) {
|
|
20873
20951
|
try {
|
|
20874
|
-
if (!
|
|
20875
|
-
if (!
|
|
20876
|
-
if (
|
|
20877
|
-
|
|
20952
|
+
if (!fs20.existsSync(dirPath)) return false;
|
|
20953
|
+
if (!fs20.statSync(dirPath).isDirectory()) return false;
|
|
20954
|
+
if (fs20.readdirSync(dirPath).length > 0) return false;
|
|
20955
|
+
fs20.rmdirSync(dirPath);
|
|
20878
20956
|
return true;
|
|
20879
20957
|
} catch {
|
|
20880
20958
|
return false;
|
|
20881
20959
|
}
|
|
20882
20960
|
}
|
|
20883
20961
|
function readJsonc(filePath) {
|
|
20884
|
-
if (!
|
|
20885
|
-
let raw =
|
|
20962
|
+
if (!fs20.existsSync(filePath)) return {};
|
|
20963
|
+
let raw = fs20.readFileSync(filePath, "utf8");
|
|
20886
20964
|
if (raw.charCodeAt(0) === 65279) raw = raw.slice(1);
|
|
20887
20965
|
if (raw.trim() === "") return {};
|
|
20888
20966
|
const parsed = parse3(raw, [], { allowTrailingComma: true });
|
|
@@ -20903,7 +20981,7 @@ function yamlSyntaxErrorLine(raw) {
|
|
|
20903
20981
|
function findConfigSyntaxErrorLine(filePath, jsonOptions) {
|
|
20904
20982
|
let raw;
|
|
20905
20983
|
try {
|
|
20906
|
-
raw =
|
|
20984
|
+
raw = fs20.readFileSync(filePath, "utf8");
|
|
20907
20985
|
} catch {
|
|
20908
20986
|
return null;
|
|
20909
20987
|
}
|
|
@@ -20929,18 +21007,18 @@ function editJsoncFile(filePath, jsonPath, value) {
|
|
|
20929
21007
|
}
|
|
20930
21008
|
const parsed = parse3(text2, [], { allowTrailingComma: true });
|
|
20931
21009
|
if (isEmptyPlainObject(parsed)) {
|
|
20932
|
-
|
|
20933
|
-
rmEmptyDir(
|
|
21010
|
+
fs20.rmSync(filePath, { force: true });
|
|
21011
|
+
rmEmptyDir(path20.dirname(filePath));
|
|
20934
21012
|
return;
|
|
20935
21013
|
}
|
|
20936
|
-
|
|
21014
|
+
fs20.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20937
21015
|
const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
|
|
20938
|
-
|
|
21016
|
+
fs20.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
|
|
20939
21017
|
}
|
|
20940
21018
|
var MAX_SYMLINK_HOPS = 40;
|
|
20941
21019
|
function realpathOrSelf(p) {
|
|
20942
21020
|
try {
|
|
20943
|
-
return
|
|
21021
|
+
return fs20.realpathSync(p);
|
|
20944
21022
|
} catch {
|
|
20945
21023
|
return p;
|
|
20946
21024
|
}
|
|
@@ -20950,13 +21028,13 @@ function resolveLinkedDestination(dest) {
|
|
|
20950
21028
|
for (let hop = 0; hop < MAX_SYMLINK_HOPS; hop++) {
|
|
20951
21029
|
let entry;
|
|
20952
21030
|
try {
|
|
20953
|
-
entry =
|
|
21031
|
+
entry = fs20.lstatSync(current);
|
|
20954
21032
|
} catch {
|
|
20955
|
-
return current === dest || dirExists(
|
|
21033
|
+
return current === dest || dirExists(path20.dirname(current)) ? current : dest;
|
|
20956
21034
|
}
|
|
20957
21035
|
if (!entry.isSymbolicLink()) return current;
|
|
20958
21036
|
try {
|
|
20959
|
-
current =
|
|
21037
|
+
current = path20.resolve(realpathOrSelf(path20.dirname(current)), fs20.readlinkSync(current));
|
|
20960
21038
|
} catch {
|
|
20961
21039
|
return dest;
|
|
20962
21040
|
}
|
|
@@ -20964,30 +21042,30 @@ function resolveLinkedDestination(dest) {
|
|
|
20964
21042
|
return dest;
|
|
20965
21043
|
}
|
|
20966
21044
|
function copyDir(src, dest) {
|
|
20967
|
-
if (!
|
|
21045
|
+
if (!fs20.existsSync(src) || !treeHasFiles(src)) return null;
|
|
20968
21046
|
const target = resolveLinkedDestination(dest);
|
|
20969
21047
|
copyTree(src, target);
|
|
20970
21048
|
return target;
|
|
20971
21049
|
}
|
|
20972
21050
|
function treeHasFiles(dir) {
|
|
20973
|
-
return
|
|
21051
|
+
return fs20.readdirSync(dir, { withFileTypes: true }).some((entry) => !entry.isDirectory() || treeHasFiles(path20.join(dir, entry.name)));
|
|
20974
21052
|
}
|
|
20975
21053
|
function copyTree(src, dest) {
|
|
20976
|
-
const entries =
|
|
20977
|
-
|
|
21054
|
+
const entries = fs20.readdirSync(src, { withFileTypes: true });
|
|
21055
|
+
fs20.mkdirSync(dest, { recursive: true });
|
|
20978
21056
|
for (const entry of entries) {
|
|
20979
|
-
const from =
|
|
20980
|
-
const to = resolveLinkedDestination(
|
|
21057
|
+
const from = path20.join(src, entry.name);
|
|
21058
|
+
const to = resolveLinkedDestination(path20.join(dest, entry.name));
|
|
20981
21059
|
if (entry.isDirectory()) copyTree(from, to);
|
|
20982
|
-
else
|
|
21060
|
+
else fs20.copyFileSync(from, to);
|
|
20983
21061
|
}
|
|
20984
21062
|
}
|
|
20985
21063
|
function readRetiredFile(targetDir, relativePath) {
|
|
20986
|
-
const entryPath =
|
|
21064
|
+
const entryPath = path20.join(resolveLinkedDestination(targetDir), ...relativePath.split("/"));
|
|
20987
21065
|
const file = resolveLinkedDestination(entryPath);
|
|
20988
21066
|
try {
|
|
20989
|
-
if (!
|
|
20990
|
-
return
|
|
21067
|
+
if (!fs20.statSync(file, { throwIfNoEntry: false })?.isFile()) return null;
|
|
21068
|
+
return fs20.readFileSync(file, "utf8");
|
|
20991
21069
|
} catch {
|
|
20992
21070
|
return null;
|
|
20993
21071
|
}
|
|
@@ -20995,7 +21073,7 @@ function readRetiredFile(targetDir, relativePath) {
|
|
|
20995
21073
|
function findRetiredFiles(retired, bundleDir, targetDir) {
|
|
20996
21074
|
const found = [];
|
|
20997
21075
|
for (const { path: relativePath, shipped } of retired) {
|
|
20998
|
-
if (bundleDir !== null &&
|
|
21076
|
+
if (bundleDir !== null && fs20.existsSync(path20.join(bundleDir, ...relativePath.split("/"))))
|
|
20999
21077
|
continue;
|
|
21000
21078
|
const content = readRetiredFile(targetDir, relativePath);
|
|
21001
21079
|
if (content === null) continue;
|
|
@@ -21011,17 +21089,17 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
21011
21089
|
const content = readRetiredFile(targetDir, relativePath);
|
|
21012
21090
|
if (content === null || hashBundledContent(content) !== sha256) continue;
|
|
21013
21091
|
const segments = relativePath.split("/");
|
|
21014
|
-
const entryPath =
|
|
21092
|
+
const entryPath = path20.join(dir, ...segments);
|
|
21015
21093
|
const file = resolveLinkedDestination(entryPath);
|
|
21016
21094
|
try {
|
|
21017
|
-
|
|
21095
|
+
fs20.rmSync(file);
|
|
21018
21096
|
if (file !== entryPath) removePath(entryPath);
|
|
21019
21097
|
removedPaths.push(relativePath);
|
|
21020
21098
|
} catch {
|
|
21021
21099
|
continue;
|
|
21022
21100
|
}
|
|
21023
21101
|
for (let depth = segments.length - 1; depth > 0; depth--) {
|
|
21024
|
-
if (!rmEmptyDir(
|
|
21102
|
+
if (!rmEmptyDir(path20.join(dir, ...segments.slice(0, depth)))) break;
|
|
21025
21103
|
}
|
|
21026
21104
|
}
|
|
21027
21105
|
const removedRoot = removedPaths.length > 0 && dir === targetDir && rmEmptyDir(dir);
|
|
@@ -21029,15 +21107,15 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
21029
21107
|
}
|
|
21030
21108
|
function dirExists(p) {
|
|
21031
21109
|
try {
|
|
21032
|
-
return
|
|
21110
|
+
return fs20.statSync(p).isDirectory();
|
|
21033
21111
|
} catch {
|
|
21034
21112
|
return false;
|
|
21035
21113
|
}
|
|
21036
21114
|
}
|
|
21037
21115
|
function getInstalledVersion() {
|
|
21038
21116
|
try {
|
|
21039
|
-
const pkgPath =
|
|
21040
|
-
const pkg = JSON.parse(
|
|
21117
|
+
const pkgPath = path20.join(PACKAGE_ROOT, "package.json");
|
|
21118
|
+
const pkg = JSON.parse(fs20.readFileSync(pkgPath, "utf8"));
|
|
21041
21119
|
return pkg.version ?? null;
|
|
21042
21120
|
} catch {
|
|
21043
21121
|
return null;
|
|
@@ -21082,12 +21160,12 @@ async function isOnline(timeoutMs = PROBE_TIMEOUT_MS) {
|
|
|
21082
21160
|
} catch {
|
|
21083
21161
|
return false;
|
|
21084
21162
|
}
|
|
21085
|
-
return new Promise((
|
|
21086
|
-
const timer = setTimeout(() =>
|
|
21163
|
+
return new Promise((resolve22) => {
|
|
21164
|
+
const timer = setTimeout(() => resolve22(false), timeoutMs);
|
|
21087
21165
|
timer.unref();
|
|
21088
21166
|
dns.lookup(host, (err) => {
|
|
21089
21167
|
clearTimeout(timer);
|
|
21090
|
-
|
|
21168
|
+
resolve22(!err);
|
|
21091
21169
|
});
|
|
21092
21170
|
});
|
|
21093
21171
|
}
|
|
@@ -21104,7 +21182,7 @@ function escapeStringRegexp(string) {
|
|
|
21104
21182
|
}
|
|
21105
21183
|
|
|
21106
21184
|
// ../argent-installer/src/mcp-configs.ts
|
|
21107
|
-
var TOOL_SERVER_BUNDLE =
|
|
21185
|
+
var TOOL_SERVER_BUNDLE = path21.join(import.meta.dirname, "tool-server.cjs");
|
|
21108
21186
|
function getAvailableToolIds() {
|
|
21109
21187
|
const out = execFileSync5("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
|
|
21110
21188
|
const tools = JSON.parse(out);
|
|
@@ -21167,10 +21245,10 @@ function hasCustomizingEnv(entry) {
|
|
|
21167
21245
|
}
|
|
21168
21246
|
function removeDirIfEmpty(dirPath) {
|
|
21169
21247
|
try {
|
|
21170
|
-
if (!
|
|
21171
|
-
if (!
|
|
21172
|
-
if (
|
|
21173
|
-
|
|
21248
|
+
if (!fs21.existsSync(dirPath)) return;
|
|
21249
|
+
if (!fs21.statSync(dirPath).isDirectory()) return;
|
|
21250
|
+
if (fs21.readdirSync(dirPath).length > 0) return;
|
|
21251
|
+
fs21.rmdirSync(dirPath);
|
|
21174
21252
|
} catch {
|
|
21175
21253
|
}
|
|
21176
21254
|
}
|
|
@@ -21208,7 +21286,7 @@ function isArgentManagedEntry(entry) {
|
|
|
21208
21286
|
return args.length === 1 && args[0] === "mcp";
|
|
21209
21287
|
case "node": {
|
|
21210
21288
|
if (args.length !== 2 || args[1] !== "mcp" || !args[0]) return false;
|
|
21211
|
-
if (
|
|
21289
|
+
if (path21.isAbsolute(args[0])) return false;
|
|
21212
21290
|
const normalized = args[0].split("\\").join("/");
|
|
21213
21291
|
return normalized.includes(`node_modules/${PACKAGE_NAME}/`);
|
|
21214
21292
|
}
|
|
@@ -21222,12 +21300,12 @@ function isArgentManagedEntry(entry) {
|
|
|
21222
21300
|
}
|
|
21223
21301
|
function isPinnedGlobalEntry(entry) {
|
|
21224
21302
|
const [cli, subcommand] = entry.args;
|
|
21225
|
-
return
|
|
21303
|
+
return path21.isAbsolute(entry.command) && path21.basename(entry.command) === "node" && entry.args.length === 2 && subcommand === "mcp" && path21.isAbsolute(cli) && cli.includes(`/node_modules/${PACKAGE_NAME}/`);
|
|
21226
21304
|
}
|
|
21227
21305
|
function writeTomlOrRemove(filePath, data) {
|
|
21228
21306
|
if (Object.keys(data).length === 0) {
|
|
21229
|
-
|
|
21230
|
-
removeDirIfEmpty(
|
|
21307
|
+
fs21.rmSync(filePath, { force: true });
|
|
21308
|
+
removeDirIfEmpty(path21.dirname(filePath));
|
|
21231
21309
|
return;
|
|
21232
21310
|
}
|
|
21233
21311
|
writeToml(filePath, data);
|
|
@@ -21236,12 +21314,12 @@ function dirHasEditorEvidence(dir, looksArgentOnly) {
|
|
|
21236
21314
|
return dirExists(dir) && !looksArgentOnly(dir);
|
|
21237
21315
|
}
|
|
21238
21316
|
function fileHasEditorEvidence(filePath, looksArgentOnly) {
|
|
21239
|
-
return
|
|
21317
|
+
return fs21.existsSync(filePath) && !looksArgentOnly(filePath);
|
|
21240
21318
|
}
|
|
21241
21319
|
function parseJsoncStrict(filePath) {
|
|
21242
21320
|
let raw;
|
|
21243
21321
|
try {
|
|
21244
|
-
raw =
|
|
21322
|
+
raw = fs21.readFileSync(filePath, "utf8");
|
|
21245
21323
|
} catch {
|
|
21246
21324
|
return null;
|
|
21247
21325
|
}
|
|
@@ -21254,14 +21332,14 @@ function parseJsoncStrict(filePath) {
|
|
|
21254
21332
|
}
|
|
21255
21333
|
function parseTomlStrict(filePath) {
|
|
21256
21334
|
try {
|
|
21257
|
-
return parse(
|
|
21335
|
+
return parse(fs21.readFileSync(filePath, "utf8"));
|
|
21258
21336
|
} catch {
|
|
21259
21337
|
return null;
|
|
21260
21338
|
}
|
|
21261
21339
|
}
|
|
21262
21340
|
function parseYamlStrict(filePath) {
|
|
21263
21341
|
try {
|
|
21264
|
-
const parsed = (0, import_yaml2.parse)(
|
|
21342
|
+
const parsed = (0, import_yaml2.parse)(fs21.readFileSync(filePath, "utf8"));
|
|
21265
21343
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
21266
21344
|
return parsed;
|
|
21267
21345
|
} catch {
|
|
@@ -21284,7 +21362,7 @@ function bundledManagedNames(kind) {
|
|
|
21284
21362
|
if (cached2) return cached2;
|
|
21285
21363
|
let names;
|
|
21286
21364
|
try {
|
|
21287
|
-
names = new Set(
|
|
21365
|
+
names = new Set(fs21.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
|
|
21288
21366
|
} catch {
|
|
21289
21367
|
names = /* @__PURE__ */ new Set();
|
|
21290
21368
|
}
|
|
@@ -21295,7 +21373,7 @@ function bundledManagedNames(kind) {
|
|
|
21295
21373
|
function managedDirLooksArgentOnly(dir, kind) {
|
|
21296
21374
|
let entries;
|
|
21297
21375
|
try {
|
|
21298
|
-
entries =
|
|
21376
|
+
entries = fs21.readdirSync(dir);
|
|
21299
21377
|
} catch {
|
|
21300
21378
|
return false;
|
|
21301
21379
|
}
|
|
@@ -21307,13 +21385,13 @@ function managedDirLooksArgentOnly(dir, kind) {
|
|
|
21307
21385
|
function cursorDirLooksArgentOnly(dir) {
|
|
21308
21386
|
let entries;
|
|
21309
21387
|
try {
|
|
21310
|
-
entries =
|
|
21388
|
+
entries = fs21.readdirSync(dir);
|
|
21311
21389
|
} catch {
|
|
21312
21390
|
return false;
|
|
21313
21391
|
}
|
|
21314
21392
|
if (entries.length === 0) return false;
|
|
21315
21393
|
return entries.every((entry) => {
|
|
21316
|
-
const full =
|
|
21394
|
+
const full = path21.join(dir, entry);
|
|
21317
21395
|
if (entry === "mcp.json") {
|
|
21318
21396
|
return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
21319
21397
|
}
|
|
@@ -21346,13 +21424,13 @@ function claudeSettingsLooksArgentOnly(filePath) {
|
|
|
21346
21424
|
function claudeDirLooksArgentOnly(dir) {
|
|
21347
21425
|
let entries;
|
|
21348
21426
|
try {
|
|
21349
|
-
entries =
|
|
21427
|
+
entries = fs21.readdirSync(dir);
|
|
21350
21428
|
} catch {
|
|
21351
21429
|
return false;
|
|
21352
21430
|
}
|
|
21353
21431
|
if (entries.length === 0) return false;
|
|
21354
21432
|
return entries.every((entry) => {
|
|
21355
|
-
const full =
|
|
21433
|
+
const full = path21.join(dir, entry);
|
|
21356
21434
|
if (entry === "settings.json") return claudeSettingsLooksArgentOnly(full);
|
|
21357
21435
|
if (entry === "rules" || entry === "agents" || entry === "skills") {
|
|
21358
21436
|
return managedDirLooksArgentOnly(full, entry);
|
|
@@ -21363,25 +21441,25 @@ function claudeDirLooksArgentOnly(dir) {
|
|
|
21363
21441
|
function vscodeDirLooksArgentOnly(dir) {
|
|
21364
21442
|
let entries;
|
|
21365
21443
|
try {
|
|
21366
|
-
entries =
|
|
21444
|
+
entries = fs21.readdirSync(dir);
|
|
21367
21445
|
} catch {
|
|
21368
21446
|
return false;
|
|
21369
21447
|
}
|
|
21370
21448
|
if (entries.length === 0) return false;
|
|
21371
21449
|
return entries.every(
|
|
21372
|
-
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21450
|
+
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(path21.join(dir, entry), "servers")
|
|
21373
21451
|
);
|
|
21374
21452
|
}
|
|
21375
21453
|
function windsurfDirLooksArgentOnly(dir) {
|
|
21376
21454
|
let entries;
|
|
21377
21455
|
try {
|
|
21378
|
-
entries =
|
|
21456
|
+
entries = fs21.readdirSync(dir);
|
|
21379
21457
|
} catch {
|
|
21380
21458
|
return false;
|
|
21381
21459
|
}
|
|
21382
21460
|
if (entries.length === 0) return false;
|
|
21383
21461
|
return entries.every(
|
|
21384
|
-
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(
|
|
21462
|
+
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(path21.join(dir, entry), "mcpServers")
|
|
21385
21463
|
);
|
|
21386
21464
|
}
|
|
21387
21465
|
function zedSettingsLooksArgentOnly(filePath) {
|
|
@@ -21412,25 +21490,25 @@ function zedSettingsLooksArgentOnly(filePath) {
|
|
|
21412
21490
|
function zedDirLooksArgentOnly(dir) {
|
|
21413
21491
|
let entries;
|
|
21414
21492
|
try {
|
|
21415
|
-
entries =
|
|
21493
|
+
entries = fs21.readdirSync(dir);
|
|
21416
21494
|
} catch {
|
|
21417
21495
|
return false;
|
|
21418
21496
|
}
|
|
21419
21497
|
if (entries.length === 0) return false;
|
|
21420
21498
|
return entries.every(
|
|
21421
|
-
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(
|
|
21499
|
+
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(path21.join(dir, entry))
|
|
21422
21500
|
);
|
|
21423
21501
|
}
|
|
21424
21502
|
function geminiDirLooksArgentOnly(dir) {
|
|
21425
21503
|
let entries;
|
|
21426
21504
|
try {
|
|
21427
|
-
entries =
|
|
21505
|
+
entries = fs21.readdirSync(dir);
|
|
21428
21506
|
} catch {
|
|
21429
21507
|
return false;
|
|
21430
21508
|
}
|
|
21431
21509
|
if (entries.length === 0) return false;
|
|
21432
21510
|
return entries.every((entry) => {
|
|
21433
|
-
const full =
|
|
21511
|
+
const full = path21.join(dir, entry);
|
|
21434
21512
|
if (entry === "settings.json") return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
21435
21513
|
if (entry === "rules" || entry === "agents") return managedDirLooksArgentOnly(full, entry);
|
|
21436
21514
|
return false;
|
|
@@ -21449,48 +21527,48 @@ function hermesConfigLooksArgentOnly(filePath) {
|
|
|
21449
21527
|
function hermesDirLooksArgentOnly(dir) {
|
|
21450
21528
|
let entries;
|
|
21451
21529
|
try {
|
|
21452
|
-
entries =
|
|
21530
|
+
entries = fs21.readdirSync(dir);
|
|
21453
21531
|
} catch {
|
|
21454
21532
|
return false;
|
|
21455
21533
|
}
|
|
21456
21534
|
if (entries.length === 0) return false;
|
|
21457
21535
|
return entries.every(
|
|
21458
|
-
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(
|
|
21536
|
+
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(path21.join(dir, entry))
|
|
21459
21537
|
);
|
|
21460
21538
|
}
|
|
21461
21539
|
function kiroDirLooksArgentOnly(dir) {
|
|
21462
21540
|
let entries;
|
|
21463
21541
|
try {
|
|
21464
|
-
entries =
|
|
21542
|
+
entries = fs21.readdirSync(dir);
|
|
21465
21543
|
} catch {
|
|
21466
21544
|
return false;
|
|
21467
21545
|
}
|
|
21468
21546
|
if (entries.length === 0) return false;
|
|
21469
21547
|
return entries.every((entry) => {
|
|
21470
21548
|
if (entry !== "settings") return false;
|
|
21471
|
-
const settingsDir =
|
|
21549
|
+
const settingsDir = path21.join(dir, entry);
|
|
21472
21550
|
let settingsEntries;
|
|
21473
21551
|
try {
|
|
21474
|
-
settingsEntries =
|
|
21552
|
+
settingsEntries = fs21.readdirSync(settingsDir);
|
|
21475
21553
|
} catch {
|
|
21476
21554
|
return false;
|
|
21477
21555
|
}
|
|
21478
21556
|
if (settingsEntries.length === 0) return false;
|
|
21479
21557
|
return settingsEntries.every(
|
|
21480
|
-
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21558
|
+
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(path21.join(settingsDir, name), "mcpServers")
|
|
21481
21559
|
);
|
|
21482
21560
|
});
|
|
21483
21561
|
}
|
|
21484
21562
|
function codexDirLooksArgentOnly(dir) {
|
|
21485
21563
|
let entries;
|
|
21486
21564
|
try {
|
|
21487
|
-
entries =
|
|
21565
|
+
entries = fs21.readdirSync(dir);
|
|
21488
21566
|
} catch {
|
|
21489
21567
|
return false;
|
|
21490
21568
|
}
|
|
21491
21569
|
if (entries.length === 0) return false;
|
|
21492
21570
|
return entries.every((entry) => {
|
|
21493
|
-
const full =
|
|
21571
|
+
const full = path21.join(dir, entry);
|
|
21494
21572
|
if (entry === "config.toml") {
|
|
21495
21573
|
const config = parseTomlStrict(full);
|
|
21496
21574
|
if (config === null) return false;
|
|
@@ -21515,7 +21593,7 @@ function codexDirLooksArgentOnly(dir) {
|
|
|
21515
21593
|
});
|
|
21516
21594
|
}
|
|
21517
21595
|
function cursorPermissionsPath() {
|
|
21518
|
-
return
|
|
21596
|
+
return path21.join(homedir5(), ".cursor", "permissions.json");
|
|
21519
21597
|
}
|
|
21520
21598
|
function cursorPermissionsList() {
|
|
21521
21599
|
const list = readJsonc(cursorPermissionsPath()).mcpAllowlist;
|
|
@@ -21524,13 +21602,13 @@ function cursorPermissionsList() {
|
|
|
21524
21602
|
var cursorAdapter = {
|
|
21525
21603
|
name: "Cursor",
|
|
21526
21604
|
detect() {
|
|
21527
|
-
return dirHasEditorEvidence(
|
|
21605
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".cursor"), cursorDirLooksArgentOnly) || dirHasEditorEvidence(path21.join(process.cwd(), ".cursor"), cursorDirLooksArgentOnly);
|
|
21528
21606
|
},
|
|
21529
21607
|
projectPath(root) {
|
|
21530
|
-
return
|
|
21608
|
+
return path21.join(root, ".cursor", "mcp.json");
|
|
21531
21609
|
},
|
|
21532
21610
|
globalPath() {
|
|
21533
|
-
return
|
|
21611
|
+
return path21.join(homedir5(), ".cursor", "mcp.json");
|
|
21534
21612
|
},
|
|
21535
21613
|
// Read and written as JSONC through readJsonc / editJsoncFile: path-targeted
|
|
21536
21614
|
// text edits that preserve user comments and foreign servers.
|
|
@@ -21542,7 +21620,7 @@ var cursorAdapter = {
|
|
|
21542
21620
|
});
|
|
21543
21621
|
},
|
|
21544
21622
|
remove(configPath) {
|
|
21545
|
-
if (!
|
|
21623
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21546
21624
|
const config = readJsonc(configPath);
|
|
21547
21625
|
const servers = config.mcpServers;
|
|
21548
21626
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21550,7 +21628,7 @@ var cursorAdapter = {
|
|
|
21550
21628
|
return true;
|
|
21551
21629
|
},
|
|
21552
21630
|
getArgentEntry(configPath) {
|
|
21553
|
-
if (!
|
|
21631
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21554
21632
|
const config = readJsonc(configPath);
|
|
21555
21633
|
const servers = config.mcpServers;
|
|
21556
21634
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21575,7 +21653,7 @@ var cursorAdapter = {
|
|
|
21575
21653
|
removeAllowlist(_root, scope) {
|
|
21576
21654
|
if (scope !== "global") return;
|
|
21577
21655
|
const permPath = cursorPermissionsPath();
|
|
21578
|
-
if (!
|
|
21656
|
+
if (!fs21.existsSync(permPath)) return;
|
|
21579
21657
|
const config = readJsonc(permPath);
|
|
21580
21658
|
const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : void 0;
|
|
21581
21659
|
if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
@@ -21588,7 +21666,7 @@ function claudeProjectKeysForRoot(projects, root) {
|
|
|
21588
21666
|
return Object.keys(projects).filter((key) => key === root || canonicalPath(key) === target);
|
|
21589
21667
|
}
|
|
21590
21668
|
function claudeDisabledListFinding(settingsPath, label, projectConfined) {
|
|
21591
|
-
if (!
|
|
21669
|
+
if (!fs21.existsSync(settingsPath)) return null;
|
|
21592
21670
|
const disabled = readJson(settingsPath).disabledMcpjsonServers;
|
|
21593
21671
|
if (!Array.isArray(disabled) || !disabled.includes(MCP_SERVER_KEY)) return null;
|
|
21594
21672
|
return {
|
|
@@ -21616,13 +21694,13 @@ var claudeAdapter = {
|
|
|
21616
21694
|
name: "Claude Code",
|
|
21617
21695
|
detect() {
|
|
21618
21696
|
const mcpJsonArgentOnly = (p) => jsonLooksArgentServerOnly(p, "mcpServers");
|
|
21619
|
-
return fileHasEditorEvidence(
|
|
21697
|
+
return fileHasEditorEvidence(path21.join(process.cwd(), ".mcp.json"), mcpJsonArgentOnly) || fileHasEditorEvidence(path21.join(homedir5(), ".claude.json"), mcpJsonArgentOnly) || dirHasEditorEvidence(path21.join(process.cwd(), ".claude"), claudeDirLooksArgentOnly) || dirHasEditorEvidence(path21.join(homedir5(), ".claude"), claudeDirLooksArgentOnly);
|
|
21620
21698
|
},
|
|
21621
21699
|
projectPath(root) {
|
|
21622
|
-
return
|
|
21700
|
+
return path21.join(root, ".mcp.json");
|
|
21623
21701
|
},
|
|
21624
21702
|
globalPath() {
|
|
21625
|
-
return
|
|
21703
|
+
return path21.join(homedir5(), ".claude.json");
|
|
21626
21704
|
},
|
|
21627
21705
|
// JSONC is a superset of JSON, so this config shares the one comment- and
|
|
21628
21706
|
// foreign-server-preserving write path (see the Cursor adapter).
|
|
@@ -21635,7 +21713,7 @@ var claudeAdapter = {
|
|
|
21635
21713
|
});
|
|
21636
21714
|
},
|
|
21637
21715
|
remove(configPath) {
|
|
21638
|
-
if (!
|
|
21716
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21639
21717
|
const config = readJsonc(configPath);
|
|
21640
21718
|
const servers = config.mcpServers;
|
|
21641
21719
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21649,7 +21727,7 @@ var claudeAdapter = {
|
|
|
21649
21727
|
return true;
|
|
21650
21728
|
},
|
|
21651
21729
|
getArgentEntry(configPath) {
|
|
21652
|
-
if (!
|
|
21730
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21653
21731
|
const config = readJsonc(configPath);
|
|
21654
21732
|
const servers = config.mcpServers;
|
|
21655
21733
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21662,7 +21740,7 @@ var claudeAdapter = {
|
|
|
21662
21740
|
// .mcp.json rejections (see claudeDisabledListFinding).
|
|
21663
21741
|
findShadowingConfigs(root, writtenScope) {
|
|
21664
21742
|
const findings = [];
|
|
21665
|
-
const claudeJsonPath =
|
|
21743
|
+
const claudeJsonPath = path21.join(homedir5(), ".claude.json");
|
|
21666
21744
|
const projects = readJson(claudeJsonPath).projects;
|
|
21667
21745
|
if (isRecord(projects)) {
|
|
21668
21746
|
for (const key of claudeProjectKeysForRoot(projects, root)) {
|
|
@@ -21699,9 +21777,9 @@ var claudeAdapter = {
|
|
|
21699
21777
|
}
|
|
21700
21778
|
if (writtenScope === "local") {
|
|
21701
21779
|
const candidates = [
|
|
21702
|
-
[
|
|
21703
|
-
[
|
|
21704
|
-
[
|
|
21780
|
+
[path21.join(root, ".claude", "settings.json"), ".claude/settings.json", true],
|
|
21781
|
+
[path21.join(root, ".claude", "settings.local.json"), ".claude/settings.local.json", true],
|
|
21782
|
+
[path21.join(homedir5(), ".claude", "settings.json"), "~/.claude/settings.json", false]
|
|
21705
21783
|
];
|
|
21706
21784
|
for (const [settingsPath, label, projectConfined] of candidates) {
|
|
21707
21785
|
const finding = claudeDisabledListFinding(settingsPath, label, projectConfined);
|
|
@@ -21720,10 +21798,10 @@ var claudeAdapter = {
|
|
|
21720
21798
|
var vscodeAdapter = {
|
|
21721
21799
|
name: "VS Code",
|
|
21722
21800
|
detect() {
|
|
21723
|
-
return dirHasEditorEvidence(
|
|
21801
|
+
return dirHasEditorEvidence(path21.join(process.cwd(), ".vscode"), vscodeDirLooksArgentOnly) || dirExists(path21.join(homedir5(), ".vscode"));
|
|
21724
21802
|
},
|
|
21725
21803
|
projectPath(root) {
|
|
21726
|
-
return
|
|
21804
|
+
return path21.join(root, ".vscode", "mcp.json");
|
|
21727
21805
|
},
|
|
21728
21806
|
globalPath() {
|
|
21729
21807
|
return null;
|
|
@@ -21739,7 +21817,7 @@ var vscodeAdapter = {
|
|
|
21739
21817
|
});
|
|
21740
21818
|
},
|
|
21741
21819
|
remove(configPath) {
|
|
21742
|
-
if (!
|
|
21820
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21743
21821
|
const config = readJsonc(configPath);
|
|
21744
21822
|
const servers = config.servers;
|
|
21745
21823
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21747,7 +21825,7 @@ var vscodeAdapter = {
|
|
|
21747
21825
|
return true;
|
|
21748
21826
|
},
|
|
21749
21827
|
getArgentEntry(configPath) {
|
|
21750
|
-
if (!
|
|
21828
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21751
21829
|
const config = readJsonc(configPath);
|
|
21752
21830
|
const servers = config.servers;
|
|
21753
21831
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21760,7 +21838,7 @@ var vscodeAdapter = {
|
|
|
21760
21838
|
findShadowingConfigs(_root, _writtenScope) {
|
|
21761
21839
|
const findings = [];
|
|
21762
21840
|
for (const userDir of vscodeUserDirs()) {
|
|
21763
|
-
const configPath =
|
|
21841
|
+
const configPath = path21.join(userDir, "mcp.json");
|
|
21764
21842
|
const entry = this.getArgentEntry(configPath);
|
|
21765
21843
|
if (!entry) continue;
|
|
21766
21844
|
findings.push({
|
|
@@ -21777,16 +21855,16 @@ var vscodeAdapter = {
|
|
|
21777
21855
|
function vscodeUserDirs() {
|
|
21778
21856
|
const bases = [];
|
|
21779
21857
|
if (process.platform === "darwin") {
|
|
21780
|
-
bases.push(
|
|
21858
|
+
bases.push(path21.join(homedir5(), "Library", "Application Support"));
|
|
21781
21859
|
} else if (process.platform === "win32") {
|
|
21782
21860
|
if (process.env.APPDATA) bases.push(process.env.APPDATA);
|
|
21783
21861
|
} else {
|
|
21784
|
-
bases.push(
|
|
21862
|
+
bases.push(path21.join(homedir5(), ".config"));
|
|
21785
21863
|
}
|
|
21786
21864
|
const dirs = [];
|
|
21787
21865
|
for (const base of bases) {
|
|
21788
21866
|
for (const product of ["Code", "Code - Insiders"]) {
|
|
21789
|
-
const dir =
|
|
21867
|
+
const dir = path21.join(base, product, "User");
|
|
21790
21868
|
if (dirExists(dir)) dirs.push(dir);
|
|
21791
21869
|
}
|
|
21792
21870
|
}
|
|
@@ -21794,18 +21872,18 @@ function vscodeUserDirs() {
|
|
|
21794
21872
|
}
|
|
21795
21873
|
function devinUserConfigPath() {
|
|
21796
21874
|
if (process.platform === "win32") {
|
|
21797
|
-
const appData = process.env.APPDATA ||
|
|
21798
|
-
return
|
|
21875
|
+
const appData = process.env.APPDATA || path21.join(homedir5(), "AppData", "Roaming");
|
|
21876
|
+
return path21.join(appData, "devin", "config.json");
|
|
21799
21877
|
}
|
|
21800
21878
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
21801
|
-
return
|
|
21879
|
+
return path21.join(xdg || path21.join(homedir5(), ".config"), "devin", "config.json");
|
|
21802
21880
|
}
|
|
21803
21881
|
var windsurfAdapter = {
|
|
21804
21882
|
name: "Devin Desktop",
|
|
21805
21883
|
telemetryName: "windsurf",
|
|
21806
21884
|
detect() {
|
|
21807
21885
|
return dirHasEditorEvidence(
|
|
21808
|
-
|
|
21886
|
+
path21.join(homedir5(), ".codeium", "windsurf"),
|
|
21809
21887
|
windsurfDirLooksArgentOnly
|
|
21810
21888
|
);
|
|
21811
21889
|
},
|
|
@@ -21813,7 +21891,7 @@ var windsurfAdapter = {
|
|
|
21813
21891
|
return null;
|
|
21814
21892
|
},
|
|
21815
21893
|
globalPath() {
|
|
21816
|
-
return
|
|
21894
|
+
return path21.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21817
21895
|
},
|
|
21818
21896
|
// JSONC-safe writes (see the Cursor adapter).
|
|
21819
21897
|
write(configPath, entry) {
|
|
@@ -21825,7 +21903,7 @@ var windsurfAdapter = {
|
|
|
21825
21903
|
});
|
|
21826
21904
|
},
|
|
21827
21905
|
remove(configPath) {
|
|
21828
|
-
if (!
|
|
21906
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21829
21907
|
const config = readJsonc(configPath);
|
|
21830
21908
|
const servers = config.mcpServers;
|
|
21831
21909
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21833,7 +21911,7 @@ var windsurfAdapter = {
|
|
|
21833
21911
|
return true;
|
|
21834
21912
|
},
|
|
21835
21913
|
getArgentEntry(configPath) {
|
|
21836
|
-
if (!
|
|
21914
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21837
21915
|
const config = readJsonc(configPath);
|
|
21838
21916
|
const servers = config.mcpServers;
|
|
21839
21917
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21845,7 +21923,7 @@ var windsurfAdapter = {
|
|
|
21845
21923
|
// servers survive. alwaysAllow serves the legacy Cascade agent; the Devin
|
|
21846
21924
|
// agent needs its own permission rule.
|
|
21847
21925
|
addAllowlist() {
|
|
21848
|
-
const configPath =
|
|
21926
|
+
const configPath = path21.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21849
21927
|
const config = readJsonc(configPath);
|
|
21850
21928
|
const servers = config.mcpServers;
|
|
21851
21929
|
if (!servers?.[MCP_SERVER_KEY]) return;
|
|
@@ -21855,8 +21933,8 @@ var windsurfAdapter = {
|
|
|
21855
21933
|
removeAllowlist(_root, scope) {
|
|
21856
21934
|
if (scope !== "global") return;
|
|
21857
21935
|
removeAllowRule(devinUserConfigPath(), DEVIN_PERMISSION_RULE);
|
|
21858
|
-
const configPath =
|
|
21859
|
-
if (!
|
|
21936
|
+
const configPath = path21.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21937
|
+
if (!fs21.existsSync(configPath)) return;
|
|
21860
21938
|
const config = readJsonc(configPath);
|
|
21861
21939
|
const servers = config.mcpServers;
|
|
21862
21940
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -21867,13 +21945,13 @@ var windsurfAdapter = {
|
|
|
21867
21945
|
var zedAdapter = {
|
|
21868
21946
|
name: "Zed",
|
|
21869
21947
|
detect() {
|
|
21870
|
-
return dirHasEditorEvidence(
|
|
21948
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".config", "zed"), zedDirLooksArgentOnly);
|
|
21871
21949
|
},
|
|
21872
21950
|
projectPath(root) {
|
|
21873
|
-
return
|
|
21951
|
+
return path21.join(root, ".zed", "settings.json");
|
|
21874
21952
|
},
|
|
21875
21953
|
globalPath() {
|
|
21876
|
-
return
|
|
21954
|
+
return path21.join(homedir5(), ".config", "zed", "settings.json");
|
|
21877
21955
|
},
|
|
21878
21956
|
// Read and written as JSONC through readJsonc / editJsoncFile so comments and
|
|
21879
21957
|
// formatting outside the touched key survive (see the Cursor adapter).
|
|
@@ -21886,7 +21964,7 @@ var zedAdapter = {
|
|
|
21886
21964
|
});
|
|
21887
21965
|
},
|
|
21888
21966
|
remove(configPath) {
|
|
21889
|
-
if (!
|
|
21967
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21890
21968
|
const config = readJsonc(configPath);
|
|
21891
21969
|
const servers = config.context_servers;
|
|
21892
21970
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21894,7 +21972,7 @@ var zedAdapter = {
|
|
|
21894
21972
|
return true;
|
|
21895
21973
|
},
|
|
21896
21974
|
getArgentEntry(configPath) {
|
|
21897
|
-
if (!
|
|
21975
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21898
21976
|
const config = readJsonc(configPath);
|
|
21899
21977
|
const servers = config.context_servers;
|
|
21900
21978
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21905,12 +21983,12 @@ var zedAdapter = {
|
|
|
21905
21983
|
// Zed has no server-level wildcard for MCP tools — each tool would need its
|
|
21906
21984
|
// own entry — so the global default is set to "allow" instead.
|
|
21907
21985
|
addAllowlist(root, scope) {
|
|
21908
|
-
const settingsPath = scope === "global" ?
|
|
21986
|
+
const settingsPath = scope === "global" ? path21.join(homedir5(), ".config", "zed", "settings.json") : path21.join(root, ".zed", "settings.json");
|
|
21909
21987
|
editJsoncFile(settingsPath, ["agent", "tool_permissions", "default"], "allow");
|
|
21910
21988
|
},
|
|
21911
21989
|
removeAllowlist(root, scope) {
|
|
21912
|
-
const settingsPath = scope === "global" ?
|
|
21913
|
-
if (!
|
|
21990
|
+
const settingsPath = scope === "global" ? path21.join(homedir5(), ".config", "zed", "settings.json") : path21.join(root, ".zed", "settings.json");
|
|
21991
|
+
if (!fs21.existsSync(settingsPath)) return;
|
|
21914
21992
|
const config = readJsonc(settingsPath);
|
|
21915
21993
|
const perms = config.agent?.tool_permissions;
|
|
21916
21994
|
if (!perms || perms.default !== "allow") return;
|
|
@@ -21920,13 +21998,13 @@ var zedAdapter = {
|
|
|
21920
21998
|
var geminiAdapter = {
|
|
21921
21999
|
name: "Gemini",
|
|
21922
22000
|
detect() {
|
|
21923
|
-
return dirHasEditorEvidence(
|
|
22001
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".gemini"), geminiDirLooksArgentOnly) || dirHasEditorEvidence(path21.join(process.cwd(), ".gemini"), geminiDirLooksArgentOnly);
|
|
21924
22002
|
},
|
|
21925
22003
|
projectPath(root) {
|
|
21926
|
-
return
|
|
22004
|
+
return path21.join(root, ".gemini", "settings.json");
|
|
21927
22005
|
},
|
|
21928
22006
|
globalPath() {
|
|
21929
|
-
return
|
|
22007
|
+
return path21.join(homedir5(), ".gemini", "settings.json");
|
|
21930
22008
|
},
|
|
21931
22009
|
// JSONC-safe writes (see the Cursor adapter).
|
|
21932
22010
|
write(configPath, entry) {
|
|
@@ -21938,7 +22016,7 @@ var geminiAdapter = {
|
|
|
21938
22016
|
});
|
|
21939
22017
|
},
|
|
21940
22018
|
remove(configPath) {
|
|
21941
|
-
if (!
|
|
22019
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21942
22020
|
const config = readJsonc(configPath);
|
|
21943
22021
|
const servers = config.mcpServers;
|
|
21944
22022
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21946,7 +22024,7 @@ var geminiAdapter = {
|
|
|
21946
22024
|
return true;
|
|
21947
22025
|
},
|
|
21948
22026
|
getArgentEntry(configPath) {
|
|
21949
|
-
if (!
|
|
22027
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21950
22028
|
const config = readJsonc(configPath);
|
|
21951
22029
|
const servers = config.mcpServers;
|
|
21952
22030
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21968,7 +22046,7 @@ var geminiAdapter = {
|
|
|
21968
22046
|
},
|
|
21969
22047
|
removeAllowlist(root, scope) {
|
|
21970
22048
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21971
|
-
if (!configPath || !
|
|
22049
|
+
if (!configPath || !fs21.existsSync(configPath)) {
|
|
21972
22050
|
return;
|
|
21973
22051
|
}
|
|
21974
22052
|
const config = readJsonc(configPath);
|
|
@@ -21982,13 +22060,13 @@ var CODEX_FILENAME = ".codex";
|
|
|
21982
22060
|
var codexAdapter = {
|
|
21983
22061
|
name: "Codex",
|
|
21984
22062
|
detect() {
|
|
21985
|
-
return dirHasEditorEvidence(
|
|
22063
|
+
return dirHasEditorEvidence(path21.join(homedir5(), CODEX_FILENAME), codexDirLooksArgentOnly) || dirHasEditorEvidence(path21.join(process.cwd(), CODEX_FILENAME), codexDirLooksArgentOnly);
|
|
21986
22064
|
},
|
|
21987
22065
|
projectPath(root) {
|
|
21988
|
-
return
|
|
22066
|
+
return path21.join(root, CODEX_FILENAME, "config.toml");
|
|
21989
22067
|
},
|
|
21990
22068
|
globalPath() {
|
|
21991
|
-
return
|
|
22069
|
+
return path21.join(homedir5(), CODEX_FILENAME, "config.toml");
|
|
21992
22070
|
},
|
|
21993
22071
|
write(configPath, entry) {
|
|
21994
22072
|
const config = readToml(configPath);
|
|
@@ -22004,7 +22082,7 @@ var codexAdapter = {
|
|
|
22004
22082
|
writeToml(configPath, config);
|
|
22005
22083
|
},
|
|
22006
22084
|
remove(configPath) {
|
|
22007
|
-
if (!
|
|
22085
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22008
22086
|
const config = readToml(configPath);
|
|
22009
22087
|
const servers = config.mcp_servers;
|
|
22010
22088
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22014,7 +22092,7 @@ var codexAdapter = {
|
|
|
22014
22092
|
return true;
|
|
22015
22093
|
},
|
|
22016
22094
|
getArgentEntry(configPath) {
|
|
22017
|
-
if (!
|
|
22095
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
22018
22096
|
const config = readToml(configPath);
|
|
22019
22097
|
const servers = config.mcp_servers;
|
|
22020
22098
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22046,7 +22124,7 @@ var codexAdapter = {
|
|
|
22046
22124
|
// them, and an emptied or removed table stays as it is.
|
|
22047
22125
|
refreshAllowlist(root, scope) {
|
|
22048
22126
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22049
|
-
if (!configPath || !
|
|
22127
|
+
if (!configPath || !fs21.existsSync(configPath)) return;
|
|
22050
22128
|
const config = readToml(configPath);
|
|
22051
22129
|
const toolsConfig = config.mcp_servers?.argent?.tools;
|
|
22052
22130
|
if (!toolsConfig) return;
|
|
@@ -22083,13 +22161,13 @@ var codexAdapter = {
|
|
|
22083
22161
|
var hermesAdapter = {
|
|
22084
22162
|
name: "Hermes",
|
|
22085
22163
|
detect() {
|
|
22086
|
-
return dirHasEditorEvidence(
|
|
22164
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".hermes"), hermesDirLooksArgentOnly);
|
|
22087
22165
|
},
|
|
22088
22166
|
projectPath() {
|
|
22089
22167
|
return null;
|
|
22090
22168
|
},
|
|
22091
22169
|
globalPath() {
|
|
22092
|
-
return
|
|
22170
|
+
return path21.join(homedir5(), ".hermes", "config.yaml");
|
|
22093
22171
|
},
|
|
22094
22172
|
write(configPath, entry) {
|
|
22095
22173
|
const doc = readYaml(configPath);
|
|
@@ -22108,7 +22186,7 @@ var hermesAdapter = {
|
|
|
22108
22186
|
writeYaml(configPath, doc);
|
|
22109
22187
|
},
|
|
22110
22188
|
remove(configPath) {
|
|
22111
|
-
if (!
|
|
22189
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22112
22190
|
const doc = readYaml(configPath);
|
|
22113
22191
|
const servers = doc.get("mcp_servers");
|
|
22114
22192
|
if (!(0, import_yaml2.isMap)(servers)) return false;
|
|
@@ -22121,7 +22199,7 @@ var hermesAdapter = {
|
|
|
22121
22199
|
return true;
|
|
22122
22200
|
},
|
|
22123
22201
|
getArgentEntry(configPath) {
|
|
22124
|
-
if (!
|
|
22202
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
22125
22203
|
const doc = readYaml(configPath);
|
|
22126
22204
|
const servers = doc.get("mcp_servers");
|
|
22127
22205
|
if (!(0, import_yaml2.isMap)(servers)) return null;
|
|
@@ -22148,10 +22226,10 @@ function hasOpenCodeBinary() {
|
|
|
22148
22226
|
}
|
|
22149
22227
|
function pickOpencodeConfig(dir, candidates) {
|
|
22150
22228
|
for (const name of candidates) {
|
|
22151
|
-
const candidate =
|
|
22152
|
-
if (
|
|
22229
|
+
const candidate = path21.join(dir, name);
|
|
22230
|
+
if (fs21.existsSync(candidate)) return candidate;
|
|
22153
22231
|
}
|
|
22154
|
-
return
|
|
22232
|
+
return path21.join(dir, "opencode.json");
|
|
22155
22233
|
}
|
|
22156
22234
|
var openCodeAdapter = {
|
|
22157
22235
|
name: "opencode",
|
|
@@ -22162,7 +22240,7 @@ var openCodeAdapter = {
|
|
|
22162
22240
|
return pickOpencodeConfig(root, OPENCODE_PROJECT_FILES);
|
|
22163
22241
|
},
|
|
22164
22242
|
globalPath() {
|
|
22165
|
-
return pickOpencodeConfig(
|
|
22243
|
+
return pickOpencodeConfig(path21.join(homedir5(), ".config", "opencode"), OPENCODE_GLOBAL_FILES);
|
|
22166
22244
|
},
|
|
22167
22245
|
write(configPath, entry) {
|
|
22168
22246
|
editJsoncFile(configPath, ["mcp", MCP_SERVER_KEY], {
|
|
@@ -22173,7 +22251,7 @@ var openCodeAdapter = {
|
|
|
22173
22251
|
});
|
|
22174
22252
|
},
|
|
22175
22253
|
remove(configPath) {
|
|
22176
|
-
if (!
|
|
22254
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22177
22255
|
const config = readJsonc(configPath);
|
|
22178
22256
|
const servers = config.mcp;
|
|
22179
22257
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22181,7 +22259,7 @@ var openCodeAdapter = {
|
|
|
22181
22259
|
return true;
|
|
22182
22260
|
},
|
|
22183
22261
|
getArgentEntry(configPath) {
|
|
22184
|
-
if (!
|
|
22262
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
22185
22263
|
const config = readJsonc(configPath);
|
|
22186
22264
|
const servers = config.mcp;
|
|
22187
22265
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22196,7 +22274,7 @@ var openCodeAdapter = {
|
|
|
22196
22274
|
},
|
|
22197
22275
|
removeAllowlist(root, scope) {
|
|
22198
22276
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22199
|
-
if (!configPath || !
|
|
22277
|
+
if (!configPath || !fs21.existsSync(configPath)) return;
|
|
22200
22278
|
const config = readJsonc(configPath);
|
|
22201
22279
|
const tools = config.tools;
|
|
22202
22280
|
if (!tools || !(OPENCODE_ALLOWLIST_PATTERN in tools)) return;
|
|
@@ -22207,13 +22285,13 @@ var KIRO_AUTO_APPROVE_ALL = ["*"];
|
|
|
22207
22285
|
var kiroAdapter = {
|
|
22208
22286
|
name: "Kiro",
|
|
22209
22287
|
detect() {
|
|
22210
|
-
return dirHasEditorEvidence(
|
|
22288
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".kiro"), kiroDirLooksArgentOnly) || dirHasEditorEvidence(path21.join(process.cwd(), ".kiro"), kiroDirLooksArgentOnly);
|
|
22211
22289
|
},
|
|
22212
22290
|
projectPath(root) {
|
|
22213
|
-
return
|
|
22291
|
+
return path21.join(root, ".kiro", "settings", "mcp.json");
|
|
22214
22292
|
},
|
|
22215
22293
|
globalPath() {
|
|
22216
|
-
return
|
|
22294
|
+
return path21.join(homedir5(), ".kiro", "settings", "mcp.json");
|
|
22217
22295
|
},
|
|
22218
22296
|
// Read and written as JSONC through readJsonc / editJsoncFile so comments and
|
|
22219
22297
|
// foreign servers survive (see the Cursor adapter).
|
|
@@ -22226,7 +22304,7 @@ var kiroAdapter = {
|
|
|
22226
22304
|
});
|
|
22227
22305
|
},
|
|
22228
22306
|
remove(configPath) {
|
|
22229
|
-
if (!
|
|
22307
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22230
22308
|
const config = readJsonc(configPath);
|
|
22231
22309
|
const servers = config.mcpServers;
|
|
22232
22310
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22234,7 +22312,7 @@ var kiroAdapter = {
|
|
|
22234
22312
|
return true;
|
|
22235
22313
|
},
|
|
22236
22314
|
getArgentEntry(configPath) {
|
|
22237
|
-
if (!
|
|
22315
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
22238
22316
|
const config = readJsonc(configPath);
|
|
22239
22317
|
const servers = config.mcpServers;
|
|
22240
22318
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22258,7 +22336,7 @@ var kiroAdapter = {
|
|
|
22258
22336
|
},
|
|
22259
22337
|
removeAllowlist(root, scope) {
|
|
22260
22338
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22261
|
-
if (!configPath || !
|
|
22339
|
+
if (!configPath || !fs21.existsSync(configPath)) return;
|
|
22262
22340
|
const config = readJsonc(configPath);
|
|
22263
22341
|
const servers = config.mcpServers;
|
|
22264
22342
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -22310,7 +22388,7 @@ function addAllowRule(settingsPath, rule) {
|
|
|
22310
22388
|
editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, rule]);
|
|
22311
22389
|
}
|
|
22312
22390
|
function removeAllowRule(settingsPath, rule) {
|
|
22313
|
-
if (!
|
|
22391
|
+
if (!fs21.existsSync(settingsPath)) return;
|
|
22314
22392
|
const config = readJsonc(settingsPath);
|
|
22315
22393
|
const permissions = config?.permissions;
|
|
22316
22394
|
const allow = permissions?.allow;
|
|
@@ -22320,7 +22398,7 @@ function removeAllowRule(settingsPath, rule) {
|
|
|
22320
22398
|
editJsoncFile(settingsPath, ["permissions", "allow"], next.length > 0 ? next : void 0);
|
|
22321
22399
|
}
|
|
22322
22400
|
function claudeSettingsPath(root, scope) {
|
|
22323
|
-
return scope === "global" ?
|
|
22401
|
+
return scope === "global" ? path21.join(homedir5(), ".claude", "settings.json") : path21.join(root, ".claude", "settings.json");
|
|
22324
22402
|
}
|
|
22325
22403
|
function addClaudePermission(root, scope) {
|
|
22326
22404
|
addAllowRule(claudeSettingsPath(root, scope), PERMISSION_RULE);
|
|
@@ -22333,13 +22411,13 @@ function formatCopyDestination(target, writtenPath, root) {
|
|
|
22333
22411
|
return `${target.label} -> ${formatManagedPathLabel(writtenPath, realpathOrSelf(root))}`;
|
|
22334
22412
|
}
|
|
22335
22413
|
function formatManagedPathLabel(targetPath, root) {
|
|
22336
|
-
for (const home of [
|
|
22337
|
-
if (targetPath === home || targetPath.startsWith(`${home}${
|
|
22414
|
+
for (const home of [path21.resolve(homedir5()), canonicalPath(homedir5())]) {
|
|
22415
|
+
if (targetPath === home || targetPath.startsWith(`${home}${path21.sep}`)) {
|
|
22338
22416
|
return `~${targetPath.slice(home.length)}`;
|
|
22339
22417
|
}
|
|
22340
22418
|
}
|
|
22341
|
-
const relative5 =
|
|
22342
|
-
if (relative5 && !relative5.startsWith("..") && !
|
|
22419
|
+
const relative5 = path21.relative(root, targetPath);
|
|
22420
|
+
if (relative5 && !relative5.startsWith("..") && !path21.isAbsolute(relative5)) {
|
|
22343
22421
|
return relative5;
|
|
22344
22422
|
}
|
|
22345
22423
|
return targetPath;
|
|
@@ -22353,7 +22431,7 @@ function addManagedTarget(targets, editorName, targetPath, root) {
|
|
|
22353
22431
|
}
|
|
22354
22432
|
function getAdapterBasePath(adapter, root, scope) {
|
|
22355
22433
|
const configPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(root);
|
|
22356
|
-
return configPath ?
|
|
22434
|
+
return configPath ? path21.dirname(configPath) : null;
|
|
22357
22435
|
}
|
|
22358
22436
|
function getManagedContentTargets(adapters, root, scope) {
|
|
22359
22437
|
const targets = {
|
|
@@ -22367,13 +22445,13 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
22367
22445
|
addManagedTarget(
|
|
22368
22446
|
targets.skillTargets,
|
|
22369
22447
|
"skills",
|
|
22370
|
-
|
|
22448
|
+
path21.join(workspaceBase, ".agents", "skills"),
|
|
22371
22449
|
root
|
|
22372
22450
|
);
|
|
22373
22451
|
addManagedTarget(
|
|
22374
22452
|
targets.skillsLockTargets,
|
|
22375
22453
|
"skills",
|
|
22376
|
-
|
|
22454
|
+
path21.join(workspaceBase, "skills-lock.json"),
|
|
22377
22455
|
root
|
|
22378
22456
|
);
|
|
22379
22457
|
for (const adapter of adapters) {
|
|
@@ -22381,21 +22459,21 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
22381
22459
|
case "Cursor": {
|
|
22382
22460
|
const base = getAdapterBasePath(adapter, root, scope);
|
|
22383
22461
|
if (!base) break;
|
|
22384
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22385
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22462
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(base, "skills"), root);
|
|
22463
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path21.join(base, "rules"), root);
|
|
22386
22464
|
break;
|
|
22387
22465
|
}
|
|
22388
22466
|
case "Claude Code": {
|
|
22389
|
-
const claudeBase = scope === "global" ?
|
|
22390
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22391
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22392
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22467
|
+
const claudeBase = scope === "global" ? path21.join(homedir5(), ".claude") : path21.join(root, ".claude");
|
|
22468
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(claudeBase, "skills"), root);
|
|
22469
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path21.join(claudeBase, "rules"), root);
|
|
22470
|
+
addManagedTarget(targets.agentTargets, adapter.name, path21.join(claudeBase, "agents"), root);
|
|
22393
22471
|
break;
|
|
22394
22472
|
}
|
|
22395
22473
|
case "Gemini": {
|
|
22396
|
-
const geminiBase = scope === "global" ?
|
|
22397
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22398
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22474
|
+
const geminiBase = scope === "global" ? path21.join(homedir5(), ".gemini") : path21.join(root, ".gemini");
|
|
22475
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path21.join(geminiBase, "rules"), root);
|
|
22476
|
+
addManagedTarget(targets.agentTargets, adapter.name, path21.join(geminiBase, "agents"), root);
|
|
22399
22477
|
break;
|
|
22400
22478
|
}
|
|
22401
22479
|
case "Codex": {
|
|
@@ -22405,19 +22483,19 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
22405
22483
|
break;
|
|
22406
22484
|
}
|
|
22407
22485
|
case "opencode": {
|
|
22408
|
-
const base = scope === "global" ?
|
|
22409
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22410
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22486
|
+
const base = scope === "global" ? path21.join(homedir5(), ".config", "opencode") : path21.join(root, ".opencode");
|
|
22487
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(base, "skills"), root);
|
|
22488
|
+
addManagedTarget(targets.agentTargets, adapter.name, path21.join(base, "agents"), root);
|
|
22411
22489
|
break;
|
|
22412
22490
|
}
|
|
22413
22491
|
case "Kiro": {
|
|
22414
|
-
const kiroBase = scope === "global" ?
|
|
22415
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22492
|
+
const kiroBase = scope === "global" ? path21.join(homedir5(), ".kiro") : path21.join(root, ".kiro");
|
|
22493
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(kiroBase, "skills"), root);
|
|
22416
22494
|
break;
|
|
22417
22495
|
}
|
|
22418
22496
|
case "Devin Desktop": {
|
|
22419
|
-
const devinBase = scope === "global" ?
|
|
22420
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22497
|
+
const devinBase = scope === "global" ? path21.join(process.env.XDG_CONFIG_HOME || path21.join(homedir5(), ".config"), "devin") : path21.join(root, ".devin");
|
|
22498
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(devinBase, "skills"), root);
|
|
22421
22499
|
break;
|
|
22422
22500
|
}
|
|
22423
22501
|
}
|
|
@@ -22431,12 +22509,12 @@ function stripFrontmatter(content) {
|
|
|
22431
22509
|
return match ? content.slice(match[0].length).trim() : content.trim();
|
|
22432
22510
|
}
|
|
22433
22511
|
function readAndConcatRules(rulesDir) {
|
|
22434
|
-
if (!
|
|
22435
|
-
const files =
|
|
22512
|
+
if (!fs21.existsSync(rulesDir)) return null;
|
|
22513
|
+
const files = fs21.readdirSync(rulesDir).filter((f) => f.endsWith(".md")).sort();
|
|
22436
22514
|
if (files.length === 0) return null;
|
|
22437
22515
|
const parts = [];
|
|
22438
22516
|
for (const file of files) {
|
|
22439
|
-
const raw =
|
|
22517
|
+
const raw = fs21.readFileSync(path21.join(rulesDir, file), "utf8");
|
|
22440
22518
|
const stripped = stripFrontmatter(raw);
|
|
22441
22519
|
if (stripped) parts.push(stripped);
|
|
22442
22520
|
}
|
|
@@ -22471,7 +22549,7 @@ function injectCodexRules(configPath, rulesDir) {
|
|
|
22471
22549
|
return configPath;
|
|
22472
22550
|
}
|
|
22473
22551
|
function removeCodexRules(configPath) {
|
|
22474
|
-
if (!
|
|
22552
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22475
22553
|
const config = readToml(configPath);
|
|
22476
22554
|
const existing = config.developer_instructions;
|
|
22477
22555
|
if (!existing || !existing.includes(ARGENT_RULES_START)) return false;
|
|
@@ -22563,10 +22641,10 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
22563
22641
|
}
|
|
22564
22642
|
|
|
22565
22643
|
// ../argent-installer/src/retired-files.ts
|
|
22566
|
-
import * as
|
|
22644
|
+
import * as path22 from "node:path";
|
|
22567
22645
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
22568
22646
|
function displayPath(entry, file) {
|
|
22569
|
-
return
|
|
22647
|
+
return path22.join(entry.location, ...file.relativePath.split("/"));
|
|
22570
22648
|
}
|
|
22571
22649
|
async function cleanupRetiredFiles(found, options) {
|
|
22572
22650
|
const result = { removed: [], declined: [], failed: [], removedRoots: [] };
|
|
@@ -22617,14 +22695,14 @@ async function reportRetiredFiles(found, interactive) {
|
|
|
22617
22695
|
|
|
22618
22696
|
// ../argent-installer/src/cli-record.ts
|
|
22619
22697
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
22620
|
-
import * as
|
|
22621
|
-
import * as
|
|
22698
|
+
import * as fs22 from "node:fs";
|
|
22699
|
+
import * as path23 from "node:path";
|
|
22622
22700
|
function cliRecordPath() {
|
|
22623
|
-
return
|
|
22701
|
+
return path23.join(argentHomeDir(), "cli.json");
|
|
22624
22702
|
}
|
|
22625
22703
|
function readCliRecord() {
|
|
22626
22704
|
try {
|
|
22627
|
-
const parsed = JSON.parse(
|
|
22705
|
+
const parsed = JSON.parse(fs22.readFileSync(cliRecordPath(), "utf8"));
|
|
22628
22706
|
if (typeof parsed?.cli === "string" && typeof parsed?.node === "string") return parsed;
|
|
22629
22707
|
return null;
|
|
22630
22708
|
} catch {
|
|
@@ -22634,7 +22712,7 @@ function readCliRecord() {
|
|
|
22634
22712
|
function resolveCliEntry(mode, projectRoot) {
|
|
22635
22713
|
if (mode === "local") {
|
|
22636
22714
|
const relative5 = getLocalArgentBinRelPath(projectRoot);
|
|
22637
|
-
return relative5 ?
|
|
22715
|
+
return relative5 ? path23.resolve(projectRoot, relative5) : null;
|
|
22638
22716
|
}
|
|
22639
22717
|
const packageRoot = getGloballyInstalledPackageRoot();
|
|
22640
22718
|
return packageRoot ? cliPathOf(packageRoot) : null;
|
|
@@ -22653,10 +22731,8 @@ function writeCliRecord(input) {
|
|
|
22653
22731
|
function persistCliRecord(record) {
|
|
22654
22732
|
const file = cliRecordPath();
|
|
22655
22733
|
try {
|
|
22656
|
-
|
|
22657
|
-
|
|
22658
|
-
fs19.writeFileSync(temporary, JSON.stringify(record, null, 2) + "\n");
|
|
22659
|
-
fs19.renameSync(temporary, file);
|
|
22734
|
+
fs22.mkdirSync(path23.dirname(file), { recursive: true });
|
|
22735
|
+
writeFileAtomicSync(file, JSON.stringify(record, null, 2) + "\n");
|
|
22660
22736
|
return file;
|
|
22661
22737
|
} catch {
|
|
22662
22738
|
return null;
|
|
@@ -22664,10 +22740,10 @@ function persistCliRecord(record) {
|
|
|
22664
22740
|
}
|
|
22665
22741
|
function healCliRecord(input) {
|
|
22666
22742
|
try {
|
|
22667
|
-
if (!
|
|
22743
|
+
if (!fs22.existsSync(input.cli)) return null;
|
|
22668
22744
|
const existing = readCliRecord();
|
|
22669
22745
|
if (existing) {
|
|
22670
|
-
const alive =
|
|
22746
|
+
const alive = fs22.existsSync(existing.node) && fs22.existsSync(existing.cli);
|
|
22671
22747
|
const ourVersion = import_semver4.default.valid(input.version);
|
|
22672
22748
|
const theirVersion = import_semver4.default.valid(existing.version);
|
|
22673
22749
|
const newerThanExisting = ourVersion !== null && (theirVersion === null || import_semver4.default.gt(ourVersion, theirVersion));
|
|
@@ -22688,11 +22764,11 @@ function removeCliRecordFor(installDir) {
|
|
|
22688
22764
|
if (!installDir) return false;
|
|
22689
22765
|
const record = readCliRecord();
|
|
22690
22766
|
if (!record) return false;
|
|
22691
|
-
const root =
|
|
22692
|
-
const relative5 =
|
|
22693
|
-
if (relative5.startsWith("..") ||
|
|
22767
|
+
const root = path23.resolve(installDir);
|
|
22768
|
+
const relative5 = path23.relative(root, path23.resolve(record.cli));
|
|
22769
|
+
if (relative5.startsWith("..") || path23.isAbsolute(relative5)) return false;
|
|
22694
22770
|
try {
|
|
22695
|
-
|
|
22771
|
+
fs22.rmSync(cliRecordPath(), { force: true });
|
|
22696
22772
|
return true;
|
|
22697
22773
|
} catch {
|
|
22698
22774
|
return false;
|
|
@@ -22728,9 +22804,11 @@ async function resolveTelemetryConsent(opts) {
|
|
|
22728
22804
|
printFirstRunNotice();
|
|
22729
22805
|
return { kind: "skipped" };
|
|
22730
22806
|
}
|
|
22731
|
-
const
|
|
22807
|
+
const state2 = getConsentState();
|
|
22808
|
+
const source = state2.source.source;
|
|
22732
22809
|
const envOwnsDecision = source === "env_do_not_track" || source === "env_argent_telemetry";
|
|
22733
|
-
|
|
22810
|
+
const configOptedOut = source === "config_file" && !state2.enabled;
|
|
22811
|
+
if (envOwnsDecision || configOptedOut || hasShownFirstRunNotice()) {
|
|
22734
22812
|
return { kind: "skipped" };
|
|
22735
22813
|
}
|
|
22736
22814
|
log.info(
|
|
@@ -22916,8 +22994,8 @@ async function promptInstallMode(defaultMode = "global") {
|
|
|
22916
22994
|
|
|
22917
22995
|
// ../argent-installer/src/install-runner.ts
|
|
22918
22996
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
22919
|
-
import * as
|
|
22920
|
-
import * as
|
|
22997
|
+
import * as fs25 from "node:fs";
|
|
22998
|
+
import * as path26 from "node:path";
|
|
22921
22999
|
|
|
22922
23000
|
// ../argent-installer/src/shell.ts
|
|
22923
23001
|
import { execFileSync as execFileSync6, spawn as spawn2 } from "node:child_process";
|
|
@@ -22949,7 +23027,7 @@ var ShellCommandError = class extends Error {
|
|
|
22949
23027
|
signal;
|
|
22950
23028
|
};
|
|
22951
23029
|
function runShellCommand(cmd, opts = {}) {
|
|
22952
|
-
return new Promise((
|
|
23030
|
+
return new Promise((resolve22, reject) => {
|
|
22953
23031
|
const child = spawn2(cmd.bin, cmd.args, {
|
|
22954
23032
|
stdio: ["ignore", "pipe", "pipe"],
|
|
22955
23033
|
shell: process.platform === "win32",
|
|
@@ -22965,7 +23043,7 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
22965
23043
|
stderr += chunk.toString();
|
|
22966
23044
|
});
|
|
22967
23045
|
child.on("close", (code, signal) => {
|
|
22968
|
-
if (code === 0)
|
|
23046
|
+
if (code === 0) resolve22();
|
|
22969
23047
|
else
|
|
22970
23048
|
reject(
|
|
22971
23049
|
new ShellCommandError(
|
|
@@ -22981,33 +23059,33 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
22981
23059
|
|
|
22982
23060
|
// ../argent-installer/src/skills.ts
|
|
22983
23061
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
22984
|
-
import * as
|
|
22985
|
-
import * as
|
|
23062
|
+
import * as fs24 from "node:fs";
|
|
23063
|
+
import * as path25 from "node:path";
|
|
22986
23064
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
22987
23065
|
|
|
22988
23066
|
// ../argent-installer/src/skills-runner.ts
|
|
22989
23067
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
22990
|
-
import * as
|
|
22991
|
-
import * as
|
|
23068
|
+
import * as fs23 from "node:fs";
|
|
23069
|
+
import * as path24 from "node:path";
|
|
22992
23070
|
var WIN32_DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
22993
23071
|
function findOnPath(bin, env, platform) {
|
|
22994
23072
|
const pathValue = env.PATH ?? env.Path ?? "";
|
|
22995
|
-
const dirs = pathValue.split(
|
|
23073
|
+
const dirs = pathValue.split(path24.delimiter).filter((dir) => path24.isAbsolute(dir));
|
|
22996
23074
|
if (platform === "win32") {
|
|
22997
23075
|
const exts = (env.PATHEXT ?? WIN32_DEFAULT_PATHEXT).split(";").filter(Boolean);
|
|
22998
23076
|
for (const dir of dirs) {
|
|
22999
23077
|
for (const ext of exts) {
|
|
23000
|
-
const candidate =
|
|
23001
|
-
if (
|
|
23078
|
+
const candidate = path24.join(dir, bin + ext);
|
|
23079
|
+
if (fs23.existsSync(candidate)) return candidate;
|
|
23002
23080
|
}
|
|
23003
23081
|
}
|
|
23004
23082
|
return null;
|
|
23005
23083
|
}
|
|
23006
23084
|
for (const dir of dirs) {
|
|
23007
|
-
const candidate =
|
|
23085
|
+
const candidate = path24.join(dir, bin);
|
|
23008
23086
|
try {
|
|
23009
|
-
if (!
|
|
23010
|
-
|
|
23087
|
+
if (!fs23.statSync(candidate).isFile()) continue;
|
|
23088
|
+
fs23.accessSync(candidate, fs23.constants.X_OK);
|
|
23011
23089
|
return candidate;
|
|
23012
23090
|
} catch {
|
|
23013
23091
|
}
|
|
@@ -23184,13 +23262,13 @@ function snapshotArgentSkills(projectRoot, scope, names) {
|
|
|
23184
23262
|
let candidates = names;
|
|
23185
23263
|
if (names.length === 0) {
|
|
23186
23264
|
try {
|
|
23187
|
-
candidates =
|
|
23265
|
+
candidates = fs24.readdirSync(targetPath).filter((n3) => n3.startsWith(ARGENT_SKILL_PREFIX));
|
|
23188
23266
|
} catch {
|
|
23189
23267
|
continue;
|
|
23190
23268
|
}
|
|
23191
23269
|
}
|
|
23192
23270
|
for (const name of candidates) {
|
|
23193
|
-
const stat6 =
|
|
23271
|
+
const stat6 = fs24.statSync(path25.join(targetPath, name, "SKILL.md"), { throwIfNoEntry: false });
|
|
23194
23272
|
if (!stat6?.isFile()) continue;
|
|
23195
23273
|
found.set(name, `${found.get(name) ?? ""}${stat6.ino}:${stat6.mtimeMs};`);
|
|
23196
23274
|
}
|
|
@@ -23208,7 +23286,7 @@ function pruneLegacySkillDirs(projectRoot, scope, bundled = new Set(listBundledS
|
|
|
23208
23286
|
const removed = /* @__PURE__ */ new Set();
|
|
23209
23287
|
for (const { targetPath } of skillTargets) {
|
|
23210
23288
|
for (const name of legacy) {
|
|
23211
|
-
const dir =
|
|
23289
|
+
const dir = path25.join(targetPath, name);
|
|
23212
23290
|
try {
|
|
23213
23291
|
if (removePath(dir)) removed.add(name);
|
|
23214
23292
|
} catch {
|
|
@@ -23228,13 +23306,13 @@ function listTrackedLegacySkills(projectRoot, scope, bundled = new Set(listBundl
|
|
|
23228
23306
|
}
|
|
23229
23307
|
function removeLockEntries(lockPath, names) {
|
|
23230
23308
|
try {
|
|
23231
|
-
const lock = JSON.parse(
|
|
23309
|
+
const lock = JSON.parse(fs24.readFileSync(lockPath, "utf8"));
|
|
23232
23310
|
const skills = lock.skills;
|
|
23233
23311
|
if (!skills) return [];
|
|
23234
23312
|
const removed = names.filter((name) => name in skills);
|
|
23235
23313
|
if (removed.length === 0) return [];
|
|
23236
23314
|
for (const name of removed) delete skills[name];
|
|
23237
|
-
|
|
23315
|
+
fs24.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + "\n");
|
|
23238
23316
|
return removed;
|
|
23239
23317
|
} catch {
|
|
23240
23318
|
return [];
|
|
@@ -23305,7 +23383,7 @@ async function runInstall(args) {
|
|
|
23305
23383
|
return runGlobal({ fromTar, nonInteractive, version: args.version, tel });
|
|
23306
23384
|
}
|
|
23307
23385
|
function installSpec(fromTar) {
|
|
23308
|
-
return
|
|
23386
|
+
return fs25.existsSync(fromTar) ? path26.resolve(fromTar) : fromTar;
|
|
23309
23387
|
}
|
|
23310
23388
|
async function installLocally(opts) {
|
|
23311
23389
|
const { fromTar, tel } = opts;
|
|
@@ -23612,8 +23690,8 @@ async function chooseAdapters(opts) {
|
|
|
23612
23690
|
|
|
23613
23691
|
// ../argent-installer/src/init-scope.ts
|
|
23614
23692
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
23615
|
-
import { existsSync as
|
|
23616
|
-
import { resolve as
|
|
23693
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
23694
|
+
import { resolve as resolve15 } from "node:path";
|
|
23617
23695
|
async function chooseScope(opts) {
|
|
23618
23696
|
if (opts.installMode === "local") {
|
|
23619
23697
|
return { scope: "local" };
|
|
@@ -23650,13 +23728,13 @@ async function chooseScope(opts) {
|
|
|
23650
23728
|
placeholder: process.cwd(),
|
|
23651
23729
|
validate(value) {
|
|
23652
23730
|
if (!value?.trim()) return "Path cannot be empty.";
|
|
23653
|
-
const resolved =
|
|
23654
|
-
if (!
|
|
23731
|
+
const resolved = resolve15(value.trim());
|
|
23732
|
+
if (!existsSync16(resolved))
|
|
23655
23733
|
return `Path does not exist: ${resolved}. Please verify and enter a valid path.`;
|
|
23656
23734
|
}
|
|
23657
23735
|
});
|
|
23658
23736
|
if (isCancel(customPathInput)) throw new InitCancelled("scope");
|
|
23659
|
-
return { scope: "custom", customRoot:
|
|
23737
|
+
return { scope: "custom", customRoot: resolve15(customPathInput.trim()) };
|
|
23660
23738
|
}
|
|
23661
23739
|
|
|
23662
23740
|
// ../argent-installer/src/init-mcp-write.ts
|
|
@@ -23956,8 +24034,8 @@ async function configureAllowlist(args) {
|
|
|
23956
24034
|
// ../argent-installer/src/init-skills.ts
|
|
23957
24035
|
var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
23958
24036
|
import { spawn as spawn3 } from "node:child_process";
|
|
23959
|
-
import * as
|
|
23960
|
-
import * as
|
|
24037
|
+
import * as os5 from "node:os";
|
|
24038
|
+
import * as path27 from "node:path";
|
|
23961
24039
|
var REF_MISSING = /Remote branch .* not found in upstream|couldn't find remote ref|unknown revision/i;
|
|
23962
24040
|
function meaningfulLine(err) {
|
|
23963
24041
|
const lines = (err instanceof Error ? err.message : String(err)).split("\n").map((l2) => l2.replace(/^[│┌└■◇\s]+/, "").trim()).filter((l2) => l2 && !/^npm (warn|notice)/i.test(l2));
|
|
@@ -23965,10 +24043,10 @@ function meaningfulLine(err) {
|
|
|
23965
24043
|
}
|
|
23966
24044
|
function bundledCopyFor(version) {
|
|
23967
24045
|
const local = probeLocalInstall(resolveProjectRoot2(process.cwd()));
|
|
23968
|
-
if (local.packageDir && local.version === version) return
|
|
24046
|
+
if (local.packageDir && local.version === version) return path27.join(local.packageDir, "skills");
|
|
23969
24047
|
const globalRoot = getGloballyInstalledPackageRoot();
|
|
23970
24048
|
if (globalRoot && getGloballyInstalledVersion() === version) {
|
|
23971
|
-
return
|
|
24049
|
+
return path27.join(globalRoot, "skills");
|
|
23972
24050
|
}
|
|
23973
24051
|
return SKILLS_DIR;
|
|
23974
24052
|
}
|
|
@@ -24073,7 +24151,7 @@ async function runSkillsStep(args) {
|
|
|
24073
24151
|
const useGitHubSource = online && !fromTar && version !== "unknown";
|
|
24074
24152
|
const skillsSource = useGitHubSource ? buildArgentSkillsSource(version) : SKILLS_DIR;
|
|
24075
24153
|
const bundledCopy = useGitHubSource ? bundledCopyFor(version) : SKILLS_DIR;
|
|
24076
|
-
const skillsRoot = scope === "global" ?
|
|
24154
|
+
const skillsRoot = scope === "global" ? os5.homedir() : effectiveRoot;
|
|
24077
24155
|
const skillsScope = scope === "global" ? "global" : "project";
|
|
24078
24156
|
const expected = listBundledSkills(bundledCopy);
|
|
24079
24157
|
const snapshot = () => snapshotArgentSkills(skillsRoot, skillsScope, expected);
|
|
@@ -24195,7 +24273,7 @@ async function runSkillsStep(args) {
|
|
|
24195
24273
|
async function runSkillsCli(runner, args, interactive, cwd) {
|
|
24196
24274
|
if (!runner) throw new Error(NO_SKILLS_RUNNER_MESSAGE);
|
|
24197
24275
|
const command = skillsCommand(runner, args);
|
|
24198
|
-
return new Promise((
|
|
24276
|
+
return new Promise((resolve22, reject) => {
|
|
24199
24277
|
const child = spawn3(command.file, command.args, {
|
|
24200
24278
|
env: npxChildEnv(),
|
|
24201
24279
|
stdio: interactive ? "inherit" : ["ignore", "pipe", "pipe"],
|
|
@@ -24214,7 +24292,7 @@ async function runSkillsCli(runner, args, interactive, cwd) {
|
|
|
24214
24292
|
}
|
|
24215
24293
|
child.on("close", (code, signal) => {
|
|
24216
24294
|
if (code === 0) {
|
|
24217
|
-
|
|
24295
|
+
resolve22();
|
|
24218
24296
|
} else {
|
|
24219
24297
|
const output = [stderr, stdout2].filter(Boolean).join("\n").trim();
|
|
24220
24298
|
reject(
|
|
@@ -24535,9 +24613,9 @@ function printBanner() {
|
|
|
24535
24613
|
// ../argent-installer/src/update.ts
|
|
24536
24614
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
24537
24615
|
var import_semver5 = __toESM(require_semver2(), 1);
|
|
24538
|
-
import * as
|
|
24539
|
-
import * as
|
|
24540
|
-
import * as
|
|
24616
|
+
import * as fs27 from "node:fs";
|
|
24617
|
+
import * as os7 from "node:os";
|
|
24618
|
+
import * as path33 from "node:path";
|
|
24541
24619
|
|
|
24542
24620
|
// ../argent-installer/src/install-targets.ts
|
|
24543
24621
|
function parseTargetFlags(args) {
|
|
@@ -24609,17 +24687,17 @@ async function resolveInstallableUpdateTarget(pm, current, cwd, candidate) {
|
|
|
24609
24687
|
|
|
24610
24688
|
// ../argent-tools-client/src/launcher.ts
|
|
24611
24689
|
import * as net from "node:net";
|
|
24612
|
-
import * as
|
|
24613
|
-
import * as
|
|
24690
|
+
import * as os6 from "node:os";
|
|
24691
|
+
import * as fs26 from "node:fs";
|
|
24692
|
+
import * as path28 from "node:path";
|
|
24614
24693
|
import * as readline from "node:readline";
|
|
24615
|
-
import { homedir as homedir7 } from "node:os";
|
|
24616
24694
|
import { spawn as spawn4, execFileSync as execFileSync9 } from "node:child_process";
|
|
24617
|
-
import { createHash as createHash3, randomBytes } from "node:crypto";
|
|
24618
|
-
import {
|
|
24619
|
-
var STATE_DIR =
|
|
24620
|
-
var STATE_FILE =
|
|
24621
|
-
var LOG_FILE =
|
|
24622
|
-
var LOCK_FILE =
|
|
24695
|
+
import { createHash as createHash3, randomBytes as randomBytes2 } from "node:crypto";
|
|
24696
|
+
import { readFile, readdir as readdir2, unlink } from "node:fs/promises";
|
|
24697
|
+
var STATE_DIR = argentHomeDir();
|
|
24698
|
+
var STATE_FILE = path28.join(STATE_DIR, "tool-server.json");
|
|
24699
|
+
var LOG_FILE = path28.join(STATE_DIR, "tool-server.log");
|
|
24700
|
+
var LOCK_FILE = path28.join(STATE_DIR, "tool-server.lock");
|
|
24623
24701
|
function isProcessAlive(pid) {
|
|
24624
24702
|
try {
|
|
24625
24703
|
process.kill(pid, 0);
|
|
@@ -24628,9 +24706,10 @@ function isProcessAlive(pid) {
|
|
|
24628
24706
|
return false;
|
|
24629
24707
|
}
|
|
24630
24708
|
}
|
|
24631
|
-
function stateFileForBundle(bundlePath) {
|
|
24709
|
+
function stateFileForBundle(bundlePath, cloudProfile) {
|
|
24632
24710
|
const key = createHash3("sha256").update(bundlePath).digest("hex").slice(0, 12);
|
|
24633
|
-
|
|
24711
|
+
const profile = cloudProfile ? `-cloud-${cloudProfile}` : "";
|
|
24712
|
+
return path28.join(STATE_DIR, `tool-server-${key}${profile}.json`);
|
|
24634
24713
|
}
|
|
24635
24714
|
async function readStateFile(file) {
|
|
24636
24715
|
try {
|
|
@@ -24640,16 +24719,22 @@ async function readStateFile(file) {
|
|
|
24640
24719
|
return null;
|
|
24641
24720
|
}
|
|
24642
24721
|
}
|
|
24643
|
-
async function readToolsServerState(bundlePath) {
|
|
24722
|
+
async function readToolsServerState(bundlePath, cloudProfile) {
|
|
24644
24723
|
if (bundlePath === void 0) return readStateFile(STATE_FILE);
|
|
24724
|
+
if (cloudProfile) {
|
|
24725
|
+
const own2 = await readStateFile(stateFileForBundle(bundlePath, cloudProfile));
|
|
24726
|
+
return own2?.cloudProfile === cloudProfile ? own2 : null;
|
|
24727
|
+
}
|
|
24645
24728
|
const own = await readStateFile(stateFileForBundle(bundlePath));
|
|
24646
24729
|
if (own) return own;
|
|
24647
24730
|
const legacy = await readStateFile(STATE_FILE);
|
|
24648
24731
|
return legacy && legacy.bundlePath === bundlePath ? legacy : null;
|
|
24649
24732
|
}
|
|
24650
|
-
async function clearToolsServerState(bundlePath) {
|
|
24733
|
+
async function clearToolsServerState(bundlePath, cloudProfile) {
|
|
24651
24734
|
const files = [STATE_FILE];
|
|
24652
|
-
if (bundlePath !== void 0) {
|
|
24735
|
+
if (bundlePath !== void 0 && cloudProfile) {
|
|
24736
|
+
files[0] = stateFileForBundle(bundlePath, cloudProfile);
|
|
24737
|
+
} else if (bundlePath !== void 0) {
|
|
24653
24738
|
files[0] = stateFileForBundle(bundlePath);
|
|
24654
24739
|
const legacy = await readStateFile(STATE_FILE);
|
|
24655
24740
|
if (legacy && legacy.bundlePath === bundlePath) files.push(STATE_FILE);
|
|
@@ -24661,7 +24746,7 @@ async function clearToolsServerState(bundlePath) {
|
|
|
24661
24746
|
}
|
|
24662
24747
|
}
|
|
24663
24748
|
}
|
|
24664
|
-
var STATE_FILE_RE = /^tool-server(-[0-9a-f]{12})?\.json$/;
|
|
24749
|
+
var STATE_FILE_RE = /^tool-server(-[0-9a-f]{12}(-cloud-[0-9a-f]{12})?)?\.json$/;
|
|
24665
24750
|
async function readAllToolsServerStates() {
|
|
24666
24751
|
let names;
|
|
24667
24752
|
try {
|
|
@@ -24672,7 +24757,7 @@ async function readAllToolsServerStates() {
|
|
|
24672
24757
|
const out = [];
|
|
24673
24758
|
for (const name of names) {
|
|
24674
24759
|
if (!STATE_FILE_RE.test(name)) continue;
|
|
24675
|
-
const file =
|
|
24760
|
+
const file = path28.join(STATE_DIR, name);
|
|
24676
24761
|
const state2 = await readStateFile(file);
|
|
24677
24762
|
if (state2) out.push({ file, state: state2 });
|
|
24678
24763
|
}
|
|
@@ -24707,32 +24792,32 @@ async function terminatePid(pid, stillOurs) {
|
|
|
24707
24792
|
}
|
|
24708
24793
|
await waitForExit(pid, SIGKILL_GRACE_MS);
|
|
24709
24794
|
}
|
|
24710
|
-
async function killToolServer(bundlePath) {
|
|
24711
|
-
const state2 = await readState(bundlePath);
|
|
24795
|
+
async function killToolServer(bundlePath, cloudProfile) {
|
|
24796
|
+
const state2 = await readState(bundlePath, cloudProfile);
|
|
24712
24797
|
if (!state2) return false;
|
|
24713
24798
|
const stillOurs = () => couldBeOurToolServer(state2.pid, state2.bundlePath);
|
|
24714
24799
|
const alive = isProcessAlive(state2.pid);
|
|
24715
24800
|
if (alive && !stillOurs()) return false;
|
|
24716
24801
|
if (alive) await terminatePid(state2.pid, stillOurs);
|
|
24717
|
-
await clearToolsServerState(bundlePath ?? state2.bundlePath);
|
|
24802
|
+
await clearToolsServerState(bundlePath ?? state2.bundlePath, cloudProfile);
|
|
24718
24803
|
return alive;
|
|
24719
24804
|
}
|
|
24720
24805
|
function isPathWithin(child, parent) {
|
|
24721
|
-
const rel =
|
|
24722
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
24806
|
+
const rel = path28.relative(parent, child);
|
|
24807
|
+
return rel !== "" && !rel.startsWith("..") && !path28.isAbsolute(rel);
|
|
24723
24808
|
}
|
|
24724
24809
|
function tryRealpath(p) {
|
|
24725
24810
|
try {
|
|
24726
|
-
return
|
|
24811
|
+
return fs26.realpathSync(p);
|
|
24727
24812
|
} catch {
|
|
24728
24813
|
return p;
|
|
24729
24814
|
}
|
|
24730
24815
|
}
|
|
24731
24816
|
async function killToolServerForInstallDir(packageDir) {
|
|
24732
|
-
const parents = /* @__PURE__ */ new Set([
|
|
24817
|
+
const parents = /* @__PURE__ */ new Set([path28.resolve(packageDir), tryRealpath(packageDir)]);
|
|
24733
24818
|
let killed = 0;
|
|
24734
24819
|
for (const { file, state: state2 } of await readAllToolsServerStates()) {
|
|
24735
|
-
const bundles = /* @__PURE__ */ new Set([
|
|
24820
|
+
const bundles = /* @__PURE__ */ new Set([path28.resolve(state2.bundlePath), tryRealpath(state2.bundlePath)]);
|
|
24736
24821
|
const matches2 = [...bundles].some((b) => [...parents].some((p) => isPathWithin(b, p)));
|
|
24737
24822
|
if (!matches2) continue;
|
|
24738
24823
|
const fresh = await readStateFile(file);
|
|
@@ -24750,7 +24835,7 @@ async function killToolServerForInstallDir(packageDir) {
|
|
|
24750
24835
|
}
|
|
24751
24836
|
return killed;
|
|
24752
24837
|
}
|
|
24753
|
-
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) =>
|
|
24838
|
+
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs26.existsSync(p)) ?? "ps";
|
|
24754
24839
|
var PS_WIDTH_FLAGS = ["-ww"];
|
|
24755
24840
|
var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
24756
24841
|
function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
|
|
@@ -24797,38 +24882,37 @@ function couldBeOurToolServer(pid, marker) {
|
|
|
24797
24882
|
var import_yaml4 = __toESM(require_dist2(), 1);
|
|
24798
24883
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
24799
24884
|
import { maxHeaderSize } from "node:http";
|
|
24800
|
-
import * as
|
|
24885
|
+
import * as path32 from "node:path";
|
|
24801
24886
|
|
|
24802
24887
|
// ../argent-tools-client/src/link-config.ts
|
|
24803
|
-
import * as
|
|
24804
|
-
import {
|
|
24805
|
-
|
|
24806
|
-
var
|
|
24807
|
-
var LINK_FILE = path27.join(LINK_DIR, "link.json");
|
|
24888
|
+
import * as path29 from "node:path";
|
|
24889
|
+
import { mkdir, readFile as readFile2, unlink as unlink2 } from "node:fs/promises";
|
|
24890
|
+
var LINK_DIR = argentHomeDir();
|
|
24891
|
+
var LINK_FILE = path29.join(LINK_DIR, "link.json");
|
|
24808
24892
|
|
|
24809
24893
|
// ../argent-tools-client/src/file-inputs.ts
|
|
24810
24894
|
import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
|
|
24811
|
-
import { createReadStream as createReadStream2, rmSync as
|
|
24895
|
+
import { createReadStream as createReadStream2, rmSync as rmSync7 } from "node:fs";
|
|
24812
24896
|
import {
|
|
24813
|
-
chmod
|
|
24897
|
+
chmod,
|
|
24814
24898
|
lstat,
|
|
24815
|
-
mkdir as
|
|
24899
|
+
mkdir as mkdir2,
|
|
24816
24900
|
readFile as readFile3,
|
|
24817
24901
|
realpath as realpath2,
|
|
24818
|
-
rename
|
|
24902
|
+
rename,
|
|
24819
24903
|
rm as rm2,
|
|
24820
24904
|
stat as stat3,
|
|
24821
|
-
writeFile
|
|
24905
|
+
writeFile
|
|
24822
24906
|
} from "node:fs/promises";
|
|
24823
|
-
import { constants as
|
|
24824
|
-
import * as
|
|
24907
|
+
import { constants as constants4, tmpdir } from "node:os";
|
|
24908
|
+
import * as path30 from "node:path";
|
|
24825
24909
|
|
|
24826
24910
|
// ../archive/src/index.ts
|
|
24827
24911
|
import { spawn as spawn5 } from "node:child_process";
|
|
24828
24912
|
import { once } from "node:events";
|
|
24829
24913
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
24830
24914
|
import { open, rm, readdir as readdir3 } from "node:fs/promises";
|
|
24831
|
-
import { basename as basename5, dirname as
|
|
24915
|
+
import { basename as basename5, dirname as dirname15, join as join28, resolve as resolve17, sep as sep4 } from "node:path";
|
|
24832
24916
|
import { Writable } from "node:stream";
|
|
24833
24917
|
import { pipeline } from "node:stream/promises";
|
|
24834
24918
|
import zlib2 from "node:zlib";
|
|
@@ -24846,28 +24930,41 @@ var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
|
|
|
24846
24930
|
// ../argent-tools-client/src/flow-files.ts
|
|
24847
24931
|
var import_yaml3 = __toESM(require_dist2(), 1);
|
|
24848
24932
|
import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
|
|
24849
|
-
import * as
|
|
24933
|
+
import * as path31 from "node:path";
|
|
24850
24934
|
var INLINE_MEMBERS_BYTES = 256 * 1024;
|
|
24851
24935
|
|
|
24936
|
+
// ../argent-tools-client/src/tools-client.ts
|
|
24937
|
+
var RECORDING_FILE_INPUT = {
|
|
24938
|
+
target: "__recording",
|
|
24939
|
+
path: `\${project_root}/${E2E_DIRS[0].split(path32.sep).join("/")}/\${name}.yaml`,
|
|
24940
|
+
paths: E2E_DIRS.map((dir) => `\${project_root}/${dir.split(path32.sep).join("/")}/\${name}.yaml`),
|
|
24941
|
+
kind: "file",
|
|
24942
|
+
optional: true,
|
|
24943
|
+
collect: "flow"
|
|
24944
|
+
};
|
|
24945
|
+
|
|
24852
24946
|
// ../argent-tools-client/src/artifacts.ts
|
|
24853
24947
|
import {
|
|
24854
24948
|
copyFile,
|
|
24855
|
-
mkdir as
|
|
24949
|
+
mkdir as mkdir3,
|
|
24856
24950
|
mkdtemp,
|
|
24857
24951
|
readFile as readFile6,
|
|
24858
24952
|
realpath as realpath4,
|
|
24859
24953
|
rm as rm3,
|
|
24860
24954
|
stat as stat5,
|
|
24861
|
-
writeFile as
|
|
24955
|
+
writeFile as writeFile2
|
|
24862
24956
|
} from "node:fs/promises";
|
|
24863
24957
|
import { constants as fsConstants } from "node:fs";
|
|
24864
24958
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
24865
|
-
import { basename as basename8,
|
|
24959
|
+
import { basename as basename8, extname as extname2, isAbsolute as isAbsolute10, join as join32, normalize as normalize2, resolve as resolve20, sep as sep8 } from "node:path";
|
|
24866
24960
|
import { createHash as createHash5 } from "node:crypto";
|
|
24867
24961
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
|
|
24868
24962
|
var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
|
|
24869
24963
|
var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
|
|
24870
24964
|
|
|
24965
|
+
// ../argent-tools-client/src/auto-capture.ts
|
|
24966
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
24967
|
+
|
|
24871
24968
|
// ../argent-installer/src/update.ts
|
|
24872
24969
|
function getRequestedVersion(args) {
|
|
24873
24970
|
for (let i2 = 0; i2 < args.length; i2 += 1) {
|
|
@@ -24937,7 +25034,7 @@ function resolveUpdatePackageAction(trigger, installed) {
|
|
|
24937
25034
|
return installed ? "standalone_update" : "standalone_install";
|
|
24938
25035
|
}
|
|
24939
25036
|
function isLivePinnedEntry(entry) {
|
|
24940
|
-
return entry !== null && isPinnedGlobalEntry(entry) &&
|
|
25037
|
+
return entry !== null && isPinnedGlobalEntry(entry) && fs27.existsSync(entry.command) && fs27.existsSync(entry.args[0]);
|
|
24941
25038
|
}
|
|
24942
25039
|
async function refreshConfiguration({
|
|
24943
25040
|
projectRoot,
|
|
@@ -25169,7 +25266,7 @@ async function update(args) {
|
|
|
25169
25266
|
const pm = mode === "local" ? detectProjectPackageManager(projectRoot) : detectGlobalPackageManager();
|
|
25170
25267
|
if (automatic) {
|
|
25171
25268
|
const globalRoot = getGloballyInstalledPackageRoot();
|
|
25172
|
-
if (!globallyInstalled || !globalRoot ||
|
|
25269
|
+
if (!globallyInstalled || !globalRoot || fs27.realpathSync(globalRoot) !== projectRoot || !isAutoUpdateEnabled() || !ownsGlobalInstall(pm, projectRoot)) {
|
|
25173
25270
|
spinner2.stop("Could not confirm an automatic update for this installation.");
|
|
25174
25271
|
return "noop";
|
|
25175
25272
|
}
|
|
@@ -25370,7 +25467,7 @@ async function update(args) {
|
|
|
25370
25467
|
process.exit(1);
|
|
25371
25468
|
}
|
|
25372
25469
|
if (automatic) {
|
|
25373
|
-
const runningRoot =
|
|
25470
|
+
const runningRoot = fs27.realpathSync(resolvePackageRoot(import.meta.dirname));
|
|
25374
25471
|
const result = requestedVersion ? await applyUpdateForTarget("global", runningRoot) : "noop";
|
|
25375
25472
|
if (result === "updated" && requestedVersion) {
|
|
25376
25473
|
writeCliRecord({
|
|
@@ -25379,7 +25476,7 @@ async function update(args) {
|
|
|
25379
25476
|
version: getGloballyInstalledVersion() ?? requestedVersion
|
|
25380
25477
|
});
|
|
25381
25478
|
await refreshConfiguration({
|
|
25382
|
-
projectRoot:
|
|
25479
|
+
projectRoot: os7.homedir(),
|
|
25383
25480
|
installMode: "global",
|
|
25384
25481
|
nonInteractive: true,
|
|
25385
25482
|
globalOnly: true
|
|
@@ -25393,7 +25490,7 @@ async function update(args) {
|
|
|
25393
25490
|
return;
|
|
25394
25491
|
}
|
|
25395
25492
|
const rootOverride = getProjectRootOverride(args);
|
|
25396
|
-
const projectRoot = rootOverride ?
|
|
25493
|
+
const projectRoot = rootOverride ? path33.resolve(rootOverride) : resolveProjectRoot2(process.cwd());
|
|
25397
25494
|
installMode = resolveInstallMode(projectRoot);
|
|
25398
25495
|
const flags = parseTargetFlags(args);
|
|
25399
25496
|
const localInstalled = installMode === "local" && probeLocalInstall(projectRoot).installed;
|
|
@@ -25473,8 +25570,8 @@ async function update(args) {
|
|
|
25473
25570
|
// ../argent-installer/src/uninstall.ts
|
|
25474
25571
|
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
25475
25572
|
var import_yaml5 = __toESM(require_dist2(), 1);
|
|
25476
|
-
import * as
|
|
25477
|
-
import * as
|
|
25573
|
+
import * as fs28 from "node:fs";
|
|
25574
|
+
import * as path34 from "node:path";
|
|
25478
25575
|
var UNINSTALL_TOOLSERVER_STOP_FAILED = {
|
|
25479
25576
|
error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
|
|
25480
25577
|
failure_stage: "installer_uninstall_toolserver_stop",
|
|
@@ -25495,10 +25592,10 @@ var UNINSTALL_UNCLASSIFIED_FAILED = {
|
|
|
25495
25592
|
};
|
|
25496
25593
|
function removeDirIfEmpty2(dirPath) {
|
|
25497
25594
|
try {
|
|
25498
|
-
if (!
|
|
25499
|
-
if (!
|
|
25500
|
-
if (
|
|
25501
|
-
|
|
25595
|
+
if (!fs28.existsSync(dirPath)) return false;
|
|
25596
|
+
if (!fs28.statSync(dirPath).isDirectory()) return false;
|
|
25597
|
+
if (fs28.readdirSync(dirPath).length > 0) return false;
|
|
25598
|
+
fs28.rmdirSync(dirPath);
|
|
25502
25599
|
return true;
|
|
25503
25600
|
} catch {
|
|
25504
25601
|
return false;
|
|
@@ -25508,9 +25605,9 @@ function collectBundledPaths(sourceDir) {
|
|
|
25508
25605
|
const files = [];
|
|
25509
25606
|
const directories = [];
|
|
25510
25607
|
function walk(currentDir, relativeDir = "") {
|
|
25511
|
-
for (const entry of
|
|
25512
|
-
const relativePath = relativeDir ?
|
|
25513
|
-
const absolutePath =
|
|
25608
|
+
for (const entry of fs28.readdirSync(currentDir, { withFileTypes: true })) {
|
|
25609
|
+
const relativePath = relativeDir ? path34.join(relativeDir, entry.name) : entry.name;
|
|
25610
|
+
const absolutePath = path34.join(currentDir, entry.name);
|
|
25514
25611
|
if (entry.isDirectory()) {
|
|
25515
25612
|
walk(absolutePath, relativePath);
|
|
25516
25613
|
directories.push(relativePath);
|
|
@@ -25523,15 +25620,15 @@ function collectBundledPaths(sourceDir) {
|
|
|
25523
25620
|
return { files, directories };
|
|
25524
25621
|
}
|
|
25525
25622
|
function removeBundledContent(sourceDir, targetDir) {
|
|
25526
|
-
if (!
|
|
25623
|
+
if (!fs28.existsSync(sourceDir) || !fs28.existsSync(targetDir)) {
|
|
25527
25624
|
return { removedPaths: [], removedRoot: false };
|
|
25528
25625
|
}
|
|
25529
25626
|
const { files, directories } = collectBundledPaths(sourceDir);
|
|
25530
25627
|
const removedPaths = [];
|
|
25531
25628
|
for (const relativePath of files) {
|
|
25532
|
-
const targetPath =
|
|
25629
|
+
const targetPath = path34.join(targetDir, relativePath);
|
|
25533
25630
|
try {
|
|
25534
|
-
const entry =
|
|
25631
|
+
const entry = fs28.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
25535
25632
|
if (!entry || entry.isDirectory()) continue;
|
|
25536
25633
|
removePath(targetPath);
|
|
25537
25634
|
removedPaths.push(relativePath);
|
|
@@ -25539,36 +25636,36 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
25539
25636
|
}
|
|
25540
25637
|
}
|
|
25541
25638
|
directories.sort(
|
|
25542
|
-
(a2, b) => b.split(
|
|
25639
|
+
(a2, b) => b.split(path34.sep).length - a2.split(path34.sep).length || b.length - a2.length
|
|
25543
25640
|
);
|
|
25544
25641
|
for (const relativePath of directories) {
|
|
25545
|
-
const targetPath =
|
|
25642
|
+
const targetPath = path34.join(targetDir, relativePath);
|
|
25546
25643
|
try {
|
|
25547
|
-
if (!
|
|
25548
|
-
if (!
|
|
25549
|
-
if (
|
|
25550
|
-
|
|
25644
|
+
if (!fs28.existsSync(targetPath)) continue;
|
|
25645
|
+
if (!fs28.statSync(targetPath).isDirectory()) continue;
|
|
25646
|
+
if (fs28.readdirSync(targetPath).length > 0) continue;
|
|
25647
|
+
fs28.rmdirSync(targetPath);
|
|
25551
25648
|
} catch {
|
|
25552
25649
|
}
|
|
25553
25650
|
}
|
|
25554
25651
|
let removedRoot = false;
|
|
25555
25652
|
try {
|
|
25556
|
-
if (
|
|
25557
|
-
if (
|
|
25558
|
-
|
|
25653
|
+
if (fs28.existsSync(targetDir) && fs28.statSync(targetDir).isDirectory()) {
|
|
25654
|
+
if (fs28.readdirSync(targetDir).length === 0) {
|
|
25655
|
+
fs28.rmdirSync(targetDir);
|
|
25559
25656
|
removedRoot = true;
|
|
25560
25657
|
}
|
|
25561
25658
|
}
|
|
25562
25659
|
} catch {
|
|
25563
25660
|
}
|
|
25564
25661
|
if (removedRoot) {
|
|
25565
|
-
removeDirIfEmpty2(
|
|
25662
|
+
removeDirIfEmpty2(path34.dirname(targetDir));
|
|
25566
25663
|
}
|
|
25567
25664
|
return { removedPaths, removedRoot };
|
|
25568
25665
|
}
|
|
25569
25666
|
function readBundledSkillName(skillFilePath, fallbackName) {
|
|
25570
25667
|
try {
|
|
25571
|
-
const content =
|
|
25668
|
+
const content = fs28.readFileSync(skillFilePath, "utf8");
|
|
25572
25669
|
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
|
|
25573
25670
|
if (!frontmatter) return fallbackName;
|
|
25574
25671
|
const data = (0, import_yaml5.parse)(frontmatter);
|
|
@@ -25579,23 +25676,23 @@ function readBundledSkillName(skillFilePath, fallbackName) {
|
|
|
25579
25676
|
}
|
|
25580
25677
|
}
|
|
25581
25678
|
function getBundledSkillNames(skillsDir) {
|
|
25582
|
-
if (!
|
|
25679
|
+
if (!fs28.existsSync(skillsDir)) return [];
|
|
25583
25680
|
const skillNames = [];
|
|
25584
|
-
for (const entry of
|
|
25681
|
+
for (const entry of fs28.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
25585
25682
|
if (!entry.isDirectory()) continue;
|
|
25586
|
-
const skillFilePath =
|
|
25587
|
-
if (!
|
|
25683
|
+
const skillFilePath = path34.join(skillsDir, entry.name, "SKILL.md");
|
|
25684
|
+
if (!fs28.existsSync(skillFilePath)) continue;
|
|
25588
25685
|
skillNames.push(readBundledSkillName(skillFilePath, entry.name));
|
|
25589
25686
|
}
|
|
25590
25687
|
return [...new Set(skillNames)].sort();
|
|
25591
25688
|
}
|
|
25592
25689
|
function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
25593
|
-
if (!
|
|
25690
|
+
if (!fs28.existsSync(targetDir)) {
|
|
25594
25691
|
return { removedPaths: [], removedRoot: false };
|
|
25595
25692
|
}
|
|
25596
25693
|
const removedPaths = [];
|
|
25597
25694
|
for (const skillName of skillNames) {
|
|
25598
|
-
const targetPath =
|
|
25695
|
+
const targetPath = path34.join(targetDir, skillName);
|
|
25599
25696
|
try {
|
|
25600
25697
|
if (removePath(targetPath)) removedPaths.push(skillName);
|
|
25601
25698
|
} catch {
|
|
@@ -25603,17 +25700,17 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
25603
25700
|
}
|
|
25604
25701
|
const removedRoot = removeDirIfEmpty2(targetDir);
|
|
25605
25702
|
if (removedRoot) {
|
|
25606
|
-
removeDirIfEmpty2(
|
|
25703
|
+
removeDirIfEmpty2(path34.dirname(targetDir));
|
|
25607
25704
|
}
|
|
25608
25705
|
return { removedPaths, removedRoot };
|
|
25609
25706
|
}
|
|
25610
25707
|
function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
25611
|
-
if (!
|
|
25708
|
+
if (!fs28.existsSync(lockPath)) {
|
|
25612
25709
|
return { removedSkills: [], removedFile: false };
|
|
25613
25710
|
}
|
|
25614
25711
|
let parsed;
|
|
25615
25712
|
try {
|
|
25616
|
-
parsed = JSON.parse(
|
|
25713
|
+
parsed = JSON.parse(fs28.readFileSync(lockPath, "utf8"));
|
|
25617
25714
|
} catch {
|
|
25618
25715
|
return { removedSkills: [], removedFile: false };
|
|
25619
25716
|
}
|
|
@@ -25640,10 +25737,10 @@ function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
|
25640
25737
|
parsed.skills && typeof parsed.skills === "object" && Object.keys(parsed.skills).length > 0
|
|
25641
25738
|
);
|
|
25642
25739
|
if (!hasSkills && otherKeys.length === 0) {
|
|
25643
|
-
|
|
25740
|
+
fs28.rmSync(lockPath, { force: true });
|
|
25644
25741
|
return { removedSkills, removedFile: true };
|
|
25645
25742
|
}
|
|
25646
|
-
|
|
25743
|
+
fs28.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
25647
25744
|
return { removedSkills, removedFile: false };
|
|
25648
25745
|
}
|
|
25649
25746
|
function cleanupBundledSkills(skillNames, targets) {
|
|
@@ -25846,7 +25943,7 @@ async function uninstall(args) {
|
|
|
25846
25943
|
),
|
|
25847
25944
|
{ ask: false }
|
|
25848
25945
|
);
|
|
25849
|
-
for (const root of retired.removedRoots) removeDirIfEmpty2(
|
|
25946
|
+
for (const root of retired.removedRoots) removeDirIfEmpty2(path34.dirname(root));
|
|
25850
25947
|
const retiredLines = formatRetiredCleanup(retired);
|
|
25851
25948
|
pruneResults.push(...retiredLines.removed.map((line) => `${import_picocolors13.default.green("+")} ${line}`));
|
|
25852
25949
|
const retiredKept = retiredLines.kept.map((line) => ` ${line}`);
|
|
@@ -25965,10 +26062,10 @@ async function uninstall(args) {
|
|
|
25965
26062
|
try {
|
|
25966
26063
|
execShellCommandSync(removable.cmd, { cwd: removable.cwd, env: removable.env });
|
|
25967
26064
|
const leftover = removable.kind === "global" ? getRemainingGlobalBinaryPath() : null;
|
|
25968
|
-
const removed = !leftover || removable.installDir !== null && !
|
|
26065
|
+
const removed = !leftover || removable.installDir !== null && !fs28.existsSync(removable.installDir);
|
|
25969
26066
|
if (removed) hasUninstalledPackage = true;
|
|
25970
26067
|
if (removed && removeCliRecordFor(removable.installDir)) {
|
|
25971
|
-
log.info(import_picocolors13.default.dim(
|
|
26068
|
+
log.info(import_picocolors13.default.dim(`Removed ${cliRecordPath()} (provider CLI discovery record).`));
|
|
25972
26069
|
}
|
|
25973
26070
|
if (leftover) {
|
|
25974
26071
|
throw new Error(
|