@swmansion/argent 0.35.1-next.67 → 0.35.1-next.68
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/dist/cli-cmds.mjs +958 -750
- package/dist/client.js +430 -267
- package/dist/installer.mjs +565 -541
- package/dist/mcp-server.mjs +461 -295
- package/dist/tool-server.cjs +5709 -4157
- package/package.json +2 -2
package/dist/cli-cmds.mjs
CHANGED
|
@@ -516,17 +516,17 @@ var require_visit = __commonJS({
|
|
|
516
516
|
visit3.BREAK = BREAK;
|
|
517
517
|
visit3.SKIP = SKIP;
|
|
518
518
|
visit3.REMOVE = REMOVE;
|
|
519
|
-
function visit_(key, node2, visitor,
|
|
520
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
519
|
+
function visit_(key, node2, visitor, path48) {
|
|
520
|
+
const ctrl = callVisitor(key, node2, visitor, path48);
|
|
521
521
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
522
|
-
replaceNode(key,
|
|
523
|
-
return visit_(key, ctrl, visitor,
|
|
522
|
+
replaceNode(key, path48, ctrl);
|
|
523
|
+
return visit_(key, ctrl, visitor, path48);
|
|
524
524
|
}
|
|
525
525
|
if (typeof ctrl !== "symbol") {
|
|
526
526
|
if (identity2.isCollection(node2)) {
|
|
527
|
-
|
|
527
|
+
path48 = Object.freeze(path48.concat(node2));
|
|
528
528
|
for (let i2 = 0; i2 < node2.items.length; ++i2) {
|
|
529
|
-
const ci = visit_(i2, node2.items[i2], visitor,
|
|
529
|
+
const ci = visit_(i2, node2.items[i2], visitor, path48);
|
|
530
530
|
if (typeof ci === "number")
|
|
531
531
|
i2 = ci - 1;
|
|
532
532
|
else if (ci === BREAK)
|
|
@@ -537,13 +537,13 @@ var require_visit = __commonJS({
|
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
539
|
} else if (identity2.isPair(node2)) {
|
|
540
|
-
|
|
541
|
-
const ck = visit_("key", node2.key, visitor,
|
|
540
|
+
path48 = Object.freeze(path48.concat(node2));
|
|
541
|
+
const ck = visit_("key", node2.key, visitor, path48);
|
|
542
542
|
if (ck === BREAK)
|
|
543
543
|
return BREAK;
|
|
544
544
|
else if (ck === REMOVE)
|
|
545
545
|
node2.key = null;
|
|
546
|
-
const cv = visit_("value", node2.value, visitor,
|
|
546
|
+
const cv = visit_("value", node2.value, visitor, path48);
|
|
547
547
|
if (cv === BREAK)
|
|
548
548
|
return BREAK;
|
|
549
549
|
else if (cv === REMOVE)
|
|
@@ -564,17 +564,17 @@ var require_visit = __commonJS({
|
|
|
564
564
|
visitAsync.BREAK = BREAK;
|
|
565
565
|
visitAsync.SKIP = SKIP;
|
|
566
566
|
visitAsync.REMOVE = REMOVE;
|
|
567
|
-
async function visitAsync_(key, node2, visitor,
|
|
568
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
567
|
+
async function visitAsync_(key, node2, visitor, path48) {
|
|
568
|
+
const ctrl = await callVisitor(key, node2, visitor, path48);
|
|
569
569
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
570
|
-
replaceNode(key,
|
|
571
|
-
return visitAsync_(key, ctrl, visitor,
|
|
570
|
+
replaceNode(key, path48, ctrl);
|
|
571
|
+
return visitAsync_(key, ctrl, visitor, path48);
|
|
572
572
|
}
|
|
573
573
|
if (typeof ctrl !== "symbol") {
|
|
574
574
|
if (identity2.isCollection(node2)) {
|
|
575
|
-
|
|
575
|
+
path48 = Object.freeze(path48.concat(node2));
|
|
576
576
|
for (let i2 = 0; i2 < node2.items.length; ++i2) {
|
|
577
|
-
const ci = await visitAsync_(i2, node2.items[i2], visitor,
|
|
577
|
+
const ci = await visitAsync_(i2, node2.items[i2], visitor, path48);
|
|
578
578
|
if (typeof ci === "number")
|
|
579
579
|
i2 = ci - 1;
|
|
580
580
|
else if (ci === BREAK)
|
|
@@ -585,13 +585,13 @@ var require_visit = __commonJS({
|
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
587
|
} else if (identity2.isPair(node2)) {
|
|
588
|
-
|
|
589
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
588
|
+
path48 = Object.freeze(path48.concat(node2));
|
|
589
|
+
const ck = await visitAsync_("key", node2.key, visitor, path48);
|
|
590
590
|
if (ck === BREAK)
|
|
591
591
|
return BREAK;
|
|
592
592
|
else if (ck === REMOVE)
|
|
593
593
|
node2.key = null;
|
|
594
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
594
|
+
const cv = await visitAsync_("value", node2.value, visitor, path48);
|
|
595
595
|
if (cv === BREAK)
|
|
596
596
|
return BREAK;
|
|
597
597
|
else if (cv === REMOVE)
|
|
@@ -618,23 +618,23 @@ var require_visit = __commonJS({
|
|
|
618
618
|
}
|
|
619
619
|
return visitor;
|
|
620
620
|
}
|
|
621
|
-
function callVisitor(key, node2, visitor,
|
|
621
|
+
function callVisitor(key, node2, visitor, path48) {
|
|
622
622
|
if (typeof visitor === "function")
|
|
623
|
-
return visitor(key, node2,
|
|
623
|
+
return visitor(key, node2, path48);
|
|
624
624
|
if (identity2.isMap(node2))
|
|
625
|
-
return visitor.Map?.(key, node2,
|
|
625
|
+
return visitor.Map?.(key, node2, path48);
|
|
626
626
|
if (identity2.isSeq(node2))
|
|
627
|
-
return visitor.Seq?.(key, node2,
|
|
627
|
+
return visitor.Seq?.(key, node2, path48);
|
|
628
628
|
if (identity2.isPair(node2))
|
|
629
|
-
return visitor.Pair?.(key, node2,
|
|
629
|
+
return visitor.Pair?.(key, node2, path48);
|
|
630
630
|
if (identity2.isScalar(node2))
|
|
631
|
-
return visitor.Scalar?.(key, node2,
|
|
631
|
+
return visitor.Scalar?.(key, node2, path48);
|
|
632
632
|
if (identity2.isAlias(node2))
|
|
633
|
-
return visitor.Alias?.(key, node2,
|
|
633
|
+
return visitor.Alias?.(key, node2, path48);
|
|
634
634
|
return void 0;
|
|
635
635
|
}
|
|
636
|
-
function replaceNode(key,
|
|
637
|
-
const parent =
|
|
636
|
+
function replaceNode(key, path48, node2) {
|
|
637
|
+
const parent = path48[path48.length - 1];
|
|
638
638
|
if (identity2.isCollection(parent)) {
|
|
639
639
|
parent.items[key] = node2;
|
|
640
640
|
} else if (identity2.isPair(parent)) {
|
|
@@ -1246,10 +1246,10 @@ var require_Collection = __commonJS({
|
|
|
1246
1246
|
var createNode = require_createNode();
|
|
1247
1247
|
var identity2 = require_identity();
|
|
1248
1248
|
var Node = require_Node();
|
|
1249
|
-
function collectionFromPath(schema,
|
|
1249
|
+
function collectionFromPath(schema, path48, value) {
|
|
1250
1250
|
let v = value;
|
|
1251
|
-
for (let i2 =
|
|
1252
|
-
const k =
|
|
1251
|
+
for (let i2 = path48.length - 1; i2 >= 0; --i2) {
|
|
1252
|
+
const k = path48[i2];
|
|
1253
1253
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
1254
1254
|
const a2 = [];
|
|
1255
1255
|
a2[k] = v;
|
|
@@ -1268,7 +1268,7 @@ var require_Collection = __commonJS({
|
|
|
1268
1268
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
1269
1269
|
});
|
|
1270
1270
|
}
|
|
1271
|
-
var isEmptyPath = (
|
|
1271
|
+
var isEmptyPath = (path48) => path48 == null || typeof path48 === "object" && !!path48[Symbol.iterator]().next().done;
|
|
1272
1272
|
var Collection = class extends Node.NodeBase {
|
|
1273
1273
|
constructor(type, schema) {
|
|
1274
1274
|
super(type);
|
|
@@ -1298,11 +1298,11 @@ var require_Collection = __commonJS({
|
|
|
1298
1298
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
1299
1299
|
* that already exists in the map.
|
|
1300
1300
|
*/
|
|
1301
|
-
addIn(
|
|
1302
|
-
if (isEmptyPath(
|
|
1301
|
+
addIn(path48, value) {
|
|
1302
|
+
if (isEmptyPath(path48))
|
|
1303
1303
|
this.add(value);
|
|
1304
1304
|
else {
|
|
1305
|
-
const [key, ...rest] =
|
|
1305
|
+
const [key, ...rest] = path48;
|
|
1306
1306
|
const node2 = this.get(key, true);
|
|
1307
1307
|
if (identity2.isCollection(node2))
|
|
1308
1308
|
node2.addIn(rest, value);
|
|
@@ -1316,8 +1316,8 @@ var require_Collection = __commonJS({
|
|
|
1316
1316
|
* Removes a value from the collection.
|
|
1317
1317
|
* @returns `true` if the item was found and removed.
|
|
1318
1318
|
*/
|
|
1319
|
-
deleteIn(
|
|
1320
|
-
const [key, ...rest] =
|
|
1319
|
+
deleteIn(path48) {
|
|
1320
|
+
const [key, ...rest] = path48;
|
|
1321
1321
|
if (rest.length === 0)
|
|
1322
1322
|
return this.delete(key);
|
|
1323
1323
|
const node2 = this.get(key, true);
|
|
@@ -1331,8 +1331,8 @@ var require_Collection = __commonJS({
|
|
|
1331
1331
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
1332
1332
|
* `true` (collections are always returned intact).
|
|
1333
1333
|
*/
|
|
1334
|
-
getIn(
|
|
1335
|
-
const [key, ...rest] =
|
|
1334
|
+
getIn(path48, keepScalar) {
|
|
1335
|
+
const [key, ...rest] = path48;
|
|
1336
1336
|
const node2 = this.get(key, true);
|
|
1337
1337
|
if (rest.length === 0)
|
|
1338
1338
|
return !keepScalar && identity2.isScalar(node2) ? node2.value : node2;
|
|
@@ -1350,8 +1350,8 @@ var require_Collection = __commonJS({
|
|
|
1350
1350
|
/**
|
|
1351
1351
|
* Checks if the collection includes a value with the key `key`.
|
|
1352
1352
|
*/
|
|
1353
|
-
hasIn(
|
|
1354
|
-
const [key, ...rest] =
|
|
1353
|
+
hasIn(path48) {
|
|
1354
|
+
const [key, ...rest] = path48;
|
|
1355
1355
|
if (rest.length === 0)
|
|
1356
1356
|
return this.has(key);
|
|
1357
1357
|
const node2 = this.get(key, true);
|
|
@@ -1361,8 +1361,8 @@ var require_Collection = __commonJS({
|
|
|
1361
1361
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
1362
1362
|
* boolean to add/remove the item from the set.
|
|
1363
1363
|
*/
|
|
1364
|
-
setIn(
|
|
1365
|
-
const [key, ...rest] =
|
|
1364
|
+
setIn(path48, value) {
|
|
1365
|
+
const [key, ...rest] = path48;
|
|
1366
1366
|
if (rest.length === 0) {
|
|
1367
1367
|
this.set(key, value);
|
|
1368
1368
|
} else {
|
|
@@ -3877,9 +3877,9 @@ var require_Document = __commonJS({
|
|
|
3877
3877
|
this.contents.add(value);
|
|
3878
3878
|
}
|
|
3879
3879
|
/** Adds a value to the document. */
|
|
3880
|
-
addIn(
|
|
3880
|
+
addIn(path48, value) {
|
|
3881
3881
|
if (assertCollection(this.contents))
|
|
3882
|
-
this.contents.addIn(
|
|
3882
|
+
this.contents.addIn(path48, value);
|
|
3883
3883
|
}
|
|
3884
3884
|
/**
|
|
3885
3885
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3954,14 +3954,14 @@ var require_Document = __commonJS({
|
|
|
3954
3954
|
* Removes a value from the document.
|
|
3955
3955
|
* @returns `true` if the item was found and removed.
|
|
3956
3956
|
*/
|
|
3957
|
-
deleteIn(
|
|
3958
|
-
if (Collection.isEmptyPath(
|
|
3957
|
+
deleteIn(path48) {
|
|
3958
|
+
if (Collection.isEmptyPath(path48)) {
|
|
3959
3959
|
if (this.contents == null)
|
|
3960
3960
|
return false;
|
|
3961
3961
|
this.contents = null;
|
|
3962
3962
|
return true;
|
|
3963
3963
|
}
|
|
3964
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3964
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path48) : false;
|
|
3965
3965
|
}
|
|
3966
3966
|
/**
|
|
3967
3967
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3976,10 +3976,10 @@ var require_Document = __commonJS({
|
|
|
3976
3976
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3977
3977
|
* `true` (collections are always returned intact).
|
|
3978
3978
|
*/
|
|
3979
|
-
getIn(
|
|
3980
|
-
if (Collection.isEmptyPath(
|
|
3979
|
+
getIn(path48, keepScalar) {
|
|
3980
|
+
if (Collection.isEmptyPath(path48))
|
|
3981
3981
|
return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3982
|
-
return identity2.isCollection(this.contents) ? this.contents.getIn(
|
|
3982
|
+
return identity2.isCollection(this.contents) ? this.contents.getIn(path48, keepScalar) : void 0;
|
|
3983
3983
|
}
|
|
3984
3984
|
/**
|
|
3985
3985
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3990,10 +3990,10 @@ var require_Document = __commonJS({
|
|
|
3990
3990
|
/**
|
|
3991
3991
|
* Checks if the document includes a value at `path`.
|
|
3992
3992
|
*/
|
|
3993
|
-
hasIn(
|
|
3994
|
-
if (Collection.isEmptyPath(
|
|
3993
|
+
hasIn(path48) {
|
|
3994
|
+
if (Collection.isEmptyPath(path48))
|
|
3995
3995
|
return this.contents !== void 0;
|
|
3996
|
-
return identity2.isCollection(this.contents) ? this.contents.hasIn(
|
|
3996
|
+
return identity2.isCollection(this.contents) ? this.contents.hasIn(path48) : false;
|
|
3997
3997
|
}
|
|
3998
3998
|
/**
|
|
3999
3999
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -4010,13 +4010,13 @@ var require_Document = __commonJS({
|
|
|
4010
4010
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
4011
4011
|
* boolean to add/remove the item from the set.
|
|
4012
4012
|
*/
|
|
4013
|
-
setIn(
|
|
4014
|
-
if (Collection.isEmptyPath(
|
|
4013
|
+
setIn(path48, value) {
|
|
4014
|
+
if (Collection.isEmptyPath(path48)) {
|
|
4015
4015
|
this.contents = value;
|
|
4016
4016
|
} else if (this.contents == null) {
|
|
4017
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
4017
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path48), value);
|
|
4018
4018
|
} else if (assertCollection(this.contents)) {
|
|
4019
|
-
this.contents.setIn(
|
|
4019
|
+
this.contents.setIn(path48, value);
|
|
4020
4020
|
}
|
|
4021
4021
|
}
|
|
4022
4022
|
/**
|
|
@@ -5977,9 +5977,9 @@ var require_cst_visit = __commonJS({
|
|
|
5977
5977
|
visit3.BREAK = BREAK;
|
|
5978
5978
|
visit3.SKIP = SKIP;
|
|
5979
5979
|
visit3.REMOVE = REMOVE;
|
|
5980
|
-
visit3.itemAtPath = (cst,
|
|
5980
|
+
visit3.itemAtPath = (cst, path48) => {
|
|
5981
5981
|
let item = cst;
|
|
5982
|
-
for (const [field, index] of
|
|
5982
|
+
for (const [field, index] of path48) {
|
|
5983
5983
|
const tok = item?.[field];
|
|
5984
5984
|
if (tok && "items" in tok) {
|
|
5985
5985
|
item = tok.items[index];
|
|
@@ -5988,23 +5988,23 @@ var require_cst_visit = __commonJS({
|
|
|
5988
5988
|
}
|
|
5989
5989
|
return item;
|
|
5990
5990
|
};
|
|
5991
|
-
visit3.parentCollection = (cst,
|
|
5992
|
-
const parent = visit3.itemAtPath(cst,
|
|
5993
|
-
const field =
|
|
5991
|
+
visit3.parentCollection = (cst, path48) => {
|
|
5992
|
+
const parent = visit3.itemAtPath(cst, path48.slice(0, -1));
|
|
5993
|
+
const field = path48[path48.length - 1][0];
|
|
5994
5994
|
const coll = parent?.[field];
|
|
5995
5995
|
if (coll && "items" in coll)
|
|
5996
5996
|
return coll;
|
|
5997
5997
|
throw new Error("Parent collection not found");
|
|
5998
5998
|
};
|
|
5999
|
-
function _visit(
|
|
6000
|
-
let ctrl = visitor(item,
|
|
5999
|
+
function _visit(path48, item, visitor) {
|
|
6000
|
+
let ctrl = visitor(item, path48);
|
|
6001
6001
|
if (typeof ctrl === "symbol")
|
|
6002
6002
|
return ctrl;
|
|
6003
6003
|
for (const field of ["key", "value"]) {
|
|
6004
6004
|
const token = item[field];
|
|
6005
6005
|
if (token && "items" in token) {
|
|
6006
6006
|
for (let i2 = 0; i2 < token.items.length; ++i2) {
|
|
6007
|
-
const ci = _visit(Object.freeze(
|
|
6007
|
+
const ci = _visit(Object.freeze(path48.concat([[field, i2]])), token.items[i2], visitor);
|
|
6008
6008
|
if (typeof ci === "number")
|
|
6009
6009
|
i2 = ci - 1;
|
|
6010
6010
|
else if (ci === BREAK)
|
|
@@ -6015,10 +6015,10 @@ var require_cst_visit = __commonJS({
|
|
|
6015
6015
|
}
|
|
6016
6016
|
}
|
|
6017
6017
|
if (typeof ctrl === "function" && field === "key")
|
|
6018
|
-
ctrl = ctrl(item,
|
|
6018
|
+
ctrl = ctrl(item, path48);
|
|
6019
6019
|
}
|
|
6020
6020
|
}
|
|
6021
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
6021
|
+
return typeof ctrl === "function" ? ctrl(item, path48) : ctrl;
|
|
6022
6022
|
}
|
|
6023
6023
|
exports.visit = visit3;
|
|
6024
6024
|
}
|
|
@@ -7320,14 +7320,14 @@ var require_parser = __commonJS({
|
|
|
7320
7320
|
case "scalar":
|
|
7321
7321
|
case "single-quoted-scalar":
|
|
7322
7322
|
case "double-quoted-scalar": {
|
|
7323
|
-
const
|
|
7323
|
+
const fs36 = this.flowScalar(this.type);
|
|
7324
7324
|
if (atNextItem || it.value) {
|
|
7325
|
-
map2.items.push({ start, key:
|
|
7325
|
+
map2.items.push({ start, key: fs36, sep: [] });
|
|
7326
7326
|
this.onKeyLine = true;
|
|
7327
7327
|
} else if (it.sep) {
|
|
7328
|
-
this.stack.push(
|
|
7328
|
+
this.stack.push(fs36);
|
|
7329
7329
|
} else {
|
|
7330
|
-
Object.assign(it, { key:
|
|
7330
|
+
Object.assign(it, { key: fs36, sep: [] });
|
|
7331
7331
|
this.onKeyLine = true;
|
|
7332
7332
|
}
|
|
7333
7333
|
return;
|
|
@@ -7455,13 +7455,13 @@ var require_parser = __commonJS({
|
|
|
7455
7455
|
case "scalar":
|
|
7456
7456
|
case "single-quoted-scalar":
|
|
7457
7457
|
case "double-quoted-scalar": {
|
|
7458
|
-
const
|
|
7458
|
+
const fs36 = this.flowScalar(this.type);
|
|
7459
7459
|
if (!it || it.value)
|
|
7460
|
-
fc.items.push({ start: [], key:
|
|
7460
|
+
fc.items.push({ start: [], key: fs36, sep: [] });
|
|
7461
7461
|
else if (it.sep)
|
|
7462
|
-
this.stack.push(
|
|
7462
|
+
this.stack.push(fs36);
|
|
7463
7463
|
else
|
|
7464
|
-
Object.assign(it, { key:
|
|
7464
|
+
Object.assign(it, { key: fs36, sep: [] });
|
|
7465
7465
|
return;
|
|
7466
7466
|
}
|
|
7467
7467
|
case "flow-map-end":
|
|
@@ -11193,14 +11193,14 @@ var require_dist3 = __commonJS({
|
|
|
11193
11193
|
});
|
|
11194
11194
|
|
|
11195
11195
|
// ../argent-cli/src/run.ts
|
|
11196
|
-
import * as
|
|
11197
|
-
import * as
|
|
11196
|
+
import * as fs15 from "node:fs";
|
|
11197
|
+
import * as path22 from "node:path";
|
|
11198
11198
|
|
|
11199
11199
|
// ../argent-tools-client/src/launcher.ts
|
|
11200
11200
|
import * as net from "node:net";
|
|
11201
|
-
import * as
|
|
11202
|
-
import * as
|
|
11203
|
-
import * as
|
|
11201
|
+
import * as os3 from "node:os";
|
|
11202
|
+
import * as fs7 from "node:fs";
|
|
11203
|
+
import * as path8 from "node:path";
|
|
11204
11204
|
import * as readline from "node:readline";
|
|
11205
11205
|
import { spawn, execFileSync } from "node:child_process";
|
|
11206
11206
|
import { createHash, randomBytes } from "node:crypto";
|
|
@@ -12025,14 +12025,141 @@ function clearRememberedAgent(options = {}) {
|
|
|
12025
12025
|
unsetConfigValue(LENS_AGENT_KEY, "global", options);
|
|
12026
12026
|
}
|
|
12027
12027
|
|
|
12028
|
+
// ../configuration-core/src/cloud-android.ts
|
|
12029
|
+
import * as fs6 from "node:fs";
|
|
12030
|
+
import * as os2 from "node:os";
|
|
12031
|
+
import * as path7 from "node:path";
|
|
12032
|
+
var CLOUD_URL_ENV = "ARGENT_CLOUD_URL";
|
|
12033
|
+
var CLOUD_API_KEY_ENV = "ARGENT_CLOUD_API_KEY";
|
|
12034
|
+
function isLoopbackHost(hostname3) {
|
|
12035
|
+
return hostname3 === "localhost" || hostname3 === "[::1]" || /^127(\.\d{1,3}){3}$/.test(hostname3);
|
|
12036
|
+
}
|
|
12037
|
+
function parseCloudAndroidCredential(env) {
|
|
12038
|
+
const rawUrl = env[CLOUD_URL_ENV]?.trim();
|
|
12039
|
+
const apiKey = env[CLOUD_API_KEY_ENV]?.trim();
|
|
12040
|
+
if (!rawUrl || !apiKey) return null;
|
|
12041
|
+
let url2;
|
|
12042
|
+
try {
|
|
12043
|
+
url2 = new URL(rawUrl);
|
|
12044
|
+
} catch {
|
|
12045
|
+
return null;
|
|
12046
|
+
}
|
|
12047
|
+
if (url2.username || url2.password || url2.search || url2.hash) return null;
|
|
12048
|
+
if (url2.protocol !== "https:" && !(url2.protocol === "http:" && isLoopbackHost(url2.hostname))) {
|
|
12049
|
+
return null;
|
|
12050
|
+
}
|
|
12051
|
+
return { baseUrl: `${url2.origin}${url2.pathname.replace(/\/+$/, "")}`, apiKey };
|
|
12052
|
+
}
|
|
12053
|
+
function cloudAndroidMarkersDir() {
|
|
12054
|
+
if (markersDirOverride) return markersDirOverride;
|
|
12055
|
+
let home2;
|
|
12056
|
+
try {
|
|
12057
|
+
home2 = os2.userInfo().homedir;
|
|
12058
|
+
} catch {
|
|
12059
|
+
home2 = "";
|
|
12060
|
+
}
|
|
12061
|
+
return path7.join(home2 || os2.homedir(), ".argent", "cloud-android-leases");
|
|
12062
|
+
}
|
|
12063
|
+
var markersDirOverride = null;
|
|
12064
|
+
function primaryGid() {
|
|
12065
|
+
try {
|
|
12066
|
+
return os2.userInfo().gid;
|
|
12067
|
+
} catch {
|
|
12068
|
+
return process.getgid?.();
|
|
12069
|
+
}
|
|
12070
|
+
}
|
|
12071
|
+
function untrusted(dir) {
|
|
12072
|
+
const uid = process.getuid?.();
|
|
12073
|
+
if (uid === void 0) return null;
|
|
12074
|
+
const otherCanWrite = (stat8) => {
|
|
12075
|
+
const ownPrivateGroup = process.platform === "linux" && stat8.gid === primaryGid();
|
|
12076
|
+
return (stat8.mode & 2) !== 0 || (stat8.mode & 16) !== 0 && !ownPrivateGroup;
|
|
12077
|
+
};
|
|
12078
|
+
let stat7;
|
|
12079
|
+
let parent;
|
|
12080
|
+
try {
|
|
12081
|
+
stat7 = fs6.lstatSync(dir);
|
|
12082
|
+
parent = fs6.statSync(path7.dirname(dir));
|
|
12083
|
+
} catch {
|
|
12084
|
+
return "it cannot be read";
|
|
12085
|
+
}
|
|
12086
|
+
if (!stat7.isDirectory()) return "it is not a directory";
|
|
12087
|
+
if (stat7.uid !== uid) return "another account owns it";
|
|
12088
|
+
if ((stat7.mode & 63) !== 0) return "other accounts can read or write it";
|
|
12089
|
+
if (parent.uid !== uid && parent.uid !== 0 || otherCanWrite(parent)) {
|
|
12090
|
+
return "other accounts can write its parent directory";
|
|
12091
|
+
}
|
|
12092
|
+
return null;
|
|
12093
|
+
}
|
|
12094
|
+
function trustedCloudAndroidMarkersDir() {
|
|
12095
|
+
const dir = cloudAndroidMarkersDir();
|
|
12096
|
+
return untrusted(dir) ? null : dir;
|
|
12097
|
+
}
|
|
12098
|
+
var CLOUD_ANDROID_MARKER_TTL_MS = 2 * 6e4;
|
|
12099
|
+
function readCloudAndroidMarker(file2) {
|
|
12100
|
+
try {
|
|
12101
|
+
const raw = JSON.parse(fs6.readFileSync(file2, "utf8"));
|
|
12102
|
+
if (typeof raw.pid !== "number" || typeof raw.lease !== "string") return null;
|
|
12103
|
+
if (typeof raw.serial !== "string") return null;
|
|
12104
|
+
return {
|
|
12105
|
+
serial: raw.serial,
|
|
12106
|
+
pid: raw.pid,
|
|
12107
|
+
lease: raw.lease,
|
|
12108
|
+
refreshedAt: fs6.statSync(file2).mtimeMs
|
|
12109
|
+
};
|
|
12110
|
+
} catch {
|
|
12111
|
+
return null;
|
|
12112
|
+
}
|
|
12113
|
+
}
|
|
12114
|
+
function readCloudAndroidMarkers(dir = trustedCloudAndroidMarkersDir()) {
|
|
12115
|
+
if (!dir) return [];
|
|
12116
|
+
let names;
|
|
12117
|
+
try {
|
|
12118
|
+
names = fs6.readdirSync(dir);
|
|
12119
|
+
} catch {
|
|
12120
|
+
return [];
|
|
12121
|
+
}
|
|
12122
|
+
return names.filter((name) => name.endsWith(".json")).map((name) => readCloudAndroidMarker(path7.join(dir, name))).filter((marker) => marker !== null);
|
|
12123
|
+
}
|
|
12124
|
+
function pidAlive(pid) {
|
|
12125
|
+
try {
|
|
12126
|
+
process.kill(pid, 0);
|
|
12127
|
+
return true;
|
|
12128
|
+
} catch (err) {
|
|
12129
|
+
return err.code === "EPERM";
|
|
12130
|
+
}
|
|
12131
|
+
}
|
|
12132
|
+
function isLiveCloudAndroidMarker(marker, now = Date.now()) {
|
|
12133
|
+
return now - marker.refreshedAt < CLOUD_ANDROID_MARKER_TTL_MS && pidAlive(marker.pid);
|
|
12134
|
+
}
|
|
12135
|
+
function cloudAndroidLeaseHolders(dir = trustedCloudAndroidMarkersDir()) {
|
|
12136
|
+
const now = Date.now();
|
|
12137
|
+
return new Set(
|
|
12138
|
+
readCloudAndroidMarkers(dir).filter((marker) => isLiveCloudAndroidMarker(marker, now)).map((marker) => marker.pid)
|
|
12139
|
+
);
|
|
12140
|
+
}
|
|
12141
|
+
|
|
12028
12142
|
// ../argent-tools-client/src/launcher.ts
|
|
12029
12143
|
var STATE_DIR = argentHomeDir();
|
|
12030
|
-
var STATE_FILE =
|
|
12031
|
-
var LOG_FILE =
|
|
12032
|
-
var LOCK_FILE =
|
|
12144
|
+
var STATE_FILE = path8.join(STATE_DIR, "tool-server.json");
|
|
12145
|
+
var LOG_FILE = path8.join(STATE_DIR, "tool-server.log");
|
|
12146
|
+
var LOCK_FILE = path8.join(STATE_DIR, "tool-server.lock");
|
|
12033
12147
|
var AUTH_TOKEN_BYTES = 32;
|
|
12034
12148
|
var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
|
|
12035
12149
|
var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
|
|
12150
|
+
var CLOUD_URL_ENV2 = "ARGENT_CLOUD_URL";
|
|
12151
|
+
var CLOUD_API_KEY_ENV2 = "ARGENT_CLOUD_API_KEY";
|
|
12152
|
+
function cloudCredential(env = process.env) {
|
|
12153
|
+
const parsed = parseCloudAndroidCredential(env);
|
|
12154
|
+
return parsed ? { url: parsed.baseUrl, apiKey: parsed.apiKey } : null;
|
|
12155
|
+
}
|
|
12156
|
+
function linkedCloudCredentialNotice(env = process.env) {
|
|
12157
|
+
if (!cloudCredential(env)) return null;
|
|
12158
|
+
return "[argent] ARGENT_CLOUD_URL and ARGENT_CLOUD_API_KEY are not used over a linked tool-server (ARGENT_TOOLS_URL or `argent link`): it never receives them. Unlink to use them on this machine.";
|
|
12159
|
+
}
|
|
12160
|
+
function cloudProfileId(credential) {
|
|
12161
|
+
return createHash("sha256").update(`argent-cloud-android\0${credential.url}\0${credential.apiKey}`).digest("hex").slice(0, 12);
|
|
12162
|
+
}
|
|
12036
12163
|
var AUTOSPAWN_HOST = "127.0.0.1";
|
|
12037
12164
|
function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
12038
12165
|
const env = {
|
|
@@ -12041,6 +12168,12 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
|
12041
12168
|
ARGENT_SIMULATOR_SERVER_DIR: paths.simulatorServerDir,
|
|
12042
12169
|
ARGENT_NATIVE_DEVTOOLS_DIR: paths.nativeDevtoolsDir
|
|
12043
12170
|
};
|
|
12171
|
+
delete env[CLOUD_API_KEY_ENV2];
|
|
12172
|
+
delete env[CLOUD_URL_ENV2];
|
|
12173
|
+
if (options.cloud) {
|
|
12174
|
+
env[CLOUD_URL_ENV2] = options.cloud.url;
|
|
12175
|
+
env[CLOUD_API_KEY_ENV2] = options.cloud.apiKey;
|
|
12176
|
+
}
|
|
12044
12177
|
if (options.host !== void 0) env.ARGENT_HOST = options.host;
|
|
12045
12178
|
if (options.idleTimeoutMinutes !== void 0) {
|
|
12046
12179
|
env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
|
|
@@ -12111,7 +12244,7 @@ function isVersionNewer(a2, b) {
|
|
|
12111
12244
|
function readBundlePackageVersion(bundlePath) {
|
|
12112
12245
|
try {
|
|
12113
12246
|
const pkg = JSON.parse(
|
|
12114
|
-
|
|
12247
|
+
fs7.readFileSync(path8.join(path8.dirname(bundlePath), "..", "package.json"), "utf8")
|
|
12115
12248
|
);
|
|
12116
12249
|
return typeof pkg.version === "string" ? pkg.version : void 0;
|
|
12117
12250
|
} catch {
|
|
@@ -12171,7 +12304,7 @@ function killSpawnedChild(child, pid) {
|
|
|
12171
12304
|
}
|
|
12172
12305
|
function resolveToolsServerNode() {
|
|
12173
12306
|
const { bun, deno, electron } = process.versions;
|
|
12174
|
-
return !(bun || deno || electron) &&
|
|
12307
|
+
return !(bun || deno || electron) && fs7.existsSync(process.execPath) ? process.execPath : "node";
|
|
12175
12308
|
}
|
|
12176
12309
|
function parseListeningPort(line) {
|
|
12177
12310
|
const match = line.match(/Tools server listening on http:\/\/.+:(\d+)/);
|
|
@@ -12181,10 +12314,10 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
12181
12314
|
return new Promise((resolve26, reject) => {
|
|
12182
12315
|
let logFd;
|
|
12183
12316
|
try {
|
|
12184
|
-
|
|
12185
|
-
logFd =
|
|
12317
|
+
fs7.mkdirSync(STATE_DIR, { recursive: true });
|
|
12318
|
+
logFd = fs7.openSync(LOG_FILE, "a");
|
|
12186
12319
|
} catch {
|
|
12187
|
-
logFd =
|
|
12320
|
+
logFd = fs7.openSync("/dev/null", "w");
|
|
12188
12321
|
}
|
|
12189
12322
|
const nodeBin = resolveToolsServerNode();
|
|
12190
12323
|
const child = spawn(nodeBin, [paths.bundlePath, "start"], {
|
|
@@ -12192,7 +12325,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
12192
12325
|
stdio: ["ignore", "pipe", logFd],
|
|
12193
12326
|
env: buildToolsServerEnv(paths, port, process.env, options)
|
|
12194
12327
|
});
|
|
12195
|
-
|
|
12328
|
+
fs7.closeSync(logFd);
|
|
12196
12329
|
const pid = child.pid;
|
|
12197
12330
|
if (!pid) {
|
|
12198
12331
|
child.once(
|
|
@@ -12241,9 +12374,10 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
12241
12374
|
rl.on("close", () => clearTimeout(timer));
|
|
12242
12375
|
});
|
|
12243
12376
|
}
|
|
12244
|
-
function stateFileForBundle(bundlePath) {
|
|
12377
|
+
function stateFileForBundle(bundlePath, cloudProfile) {
|
|
12245
12378
|
const key = createHash("sha256").update(bundlePath).digest("hex").slice(0, 12);
|
|
12246
|
-
|
|
12379
|
+
const profile = cloudProfile ? `-cloud-${cloudProfile}` : "";
|
|
12380
|
+
return path8.join(STATE_DIR, `tool-server-${key}${profile}.json`);
|
|
12247
12381
|
}
|
|
12248
12382
|
async function readStateFile(file2) {
|
|
12249
12383
|
try {
|
|
@@ -12253,16 +12387,20 @@ async function readStateFile(file2) {
|
|
|
12253
12387
|
return null;
|
|
12254
12388
|
}
|
|
12255
12389
|
}
|
|
12256
|
-
async function readToolsServerState(bundlePath) {
|
|
12390
|
+
async function readToolsServerState(bundlePath, cloudProfile) {
|
|
12257
12391
|
if (bundlePath === void 0) return readStateFile(STATE_FILE);
|
|
12392
|
+
if (cloudProfile) {
|
|
12393
|
+
const own3 = await readStateFile(stateFileForBundle(bundlePath, cloudProfile));
|
|
12394
|
+
return own3?.cloudProfile === cloudProfile ? own3 : null;
|
|
12395
|
+
}
|
|
12258
12396
|
const own2 = await readStateFile(stateFileForBundle(bundlePath));
|
|
12259
12397
|
if (own2) return own2;
|
|
12260
12398
|
const legacy = await readStateFile(STATE_FILE);
|
|
12261
12399
|
return legacy && legacy.bundlePath === bundlePath ? legacy : null;
|
|
12262
12400
|
}
|
|
12263
|
-
function
|
|
12401
|
+
function primaryGid2() {
|
|
12264
12402
|
try {
|
|
12265
|
-
return
|
|
12403
|
+
return os3.userInfo().gid;
|
|
12266
12404
|
} catch {
|
|
12267
12405
|
return process.getgid?.();
|
|
12268
12406
|
}
|
|
@@ -12272,19 +12410,19 @@ var UnsafeArgentHomeError = class extends Error {
|
|
|
12272
12410
|
};
|
|
12273
12411
|
function statHome() {
|
|
12274
12412
|
try {
|
|
12275
|
-
|
|
12276
|
-
|
|
12413
|
+
fs7.mkdirSync(path8.dirname(STATE_DIR), { recursive: true });
|
|
12414
|
+
fs7.mkdirSync(STATE_DIR, { mode: 448 });
|
|
12277
12415
|
} catch {
|
|
12278
12416
|
}
|
|
12279
12417
|
try {
|
|
12280
|
-
return
|
|
12418
|
+
return fs7.statSync(STATE_DIR);
|
|
12281
12419
|
} catch {
|
|
12282
12420
|
return null;
|
|
12283
12421
|
}
|
|
12284
12422
|
}
|
|
12285
12423
|
function isWritable(dir) {
|
|
12286
12424
|
try {
|
|
12287
|
-
|
|
12425
|
+
fs7.accessSync(dir, fs7.constants.W_OK);
|
|
12288
12426
|
return true;
|
|
12289
12427
|
} catch {
|
|
12290
12428
|
return false;
|
|
@@ -12300,7 +12438,7 @@ function assertPrivateArgentHome() {
|
|
|
12300
12438
|
`The Argent home ${STATE_DIR} belongs to another user. Change its owner or set ARGENT_HOME_DIR to a directory you own.`
|
|
12301
12439
|
);
|
|
12302
12440
|
}
|
|
12303
|
-
const ownPrivateGroup = process.platform === "linux" && stat7.gid ===
|
|
12441
|
+
const ownPrivateGroup = process.platform === "linux" && stat7.gid === primaryGid2();
|
|
12304
12442
|
const groupCanWrite = (stat7.mode & 16) !== 0 && !ownPrivateGroup;
|
|
12305
12443
|
if ((stat7.mode & 2) !== 0 || groupCanWrite) {
|
|
12306
12444
|
throw new UnsafeArgentHomeError(
|
|
@@ -12312,20 +12450,22 @@ async function writeToolsServerState(state2) {
|
|
|
12312
12450
|
writeToolsServerStateSync(state2);
|
|
12313
12451
|
}
|
|
12314
12452
|
function writeToolsServerStateSync(state2) {
|
|
12315
|
-
const target = stateFileForBundle(state2.bundlePath);
|
|
12316
|
-
|
|
12453
|
+
const target = stateFileForBundle(state2.bundlePath, state2.cloudProfile);
|
|
12454
|
+
fs7.mkdirSync(STATE_DIR, { recursive: true });
|
|
12317
12455
|
const tmp = `${target}.${randomBytes(8).toString("hex")}.tmp`;
|
|
12318
12456
|
try {
|
|
12319
|
-
|
|
12320
|
-
|
|
12457
|
+
fs7.writeFileSync(tmp, JSON.stringify(state2, null, 2) + "\n", { flag: "wx", mode: 384 });
|
|
12458
|
+
fs7.renameSync(tmp, target);
|
|
12321
12459
|
} catch (err) {
|
|
12322
|
-
|
|
12460
|
+
fs7.rmSync(tmp, { force: true });
|
|
12323
12461
|
throw err;
|
|
12324
12462
|
}
|
|
12325
12463
|
}
|
|
12326
|
-
async function clearToolsServerState(bundlePath) {
|
|
12464
|
+
async function clearToolsServerState(bundlePath, cloudProfile) {
|
|
12327
12465
|
const files = [STATE_FILE];
|
|
12328
|
-
if (bundlePath !== void 0) {
|
|
12466
|
+
if (bundlePath !== void 0 && cloudProfile) {
|
|
12467
|
+
files[0] = stateFileForBundle(bundlePath, cloudProfile);
|
|
12468
|
+
} else if (bundlePath !== void 0) {
|
|
12329
12469
|
files[0] = stateFileForBundle(bundlePath);
|
|
12330
12470
|
const legacy = await readStateFile(STATE_FILE);
|
|
12331
12471
|
if (legacy && legacy.bundlePath === bundlePath) files.push(STATE_FILE);
|
|
@@ -12337,7 +12477,7 @@ async function clearToolsServerState(bundlePath) {
|
|
|
12337
12477
|
}
|
|
12338
12478
|
}
|
|
12339
12479
|
}
|
|
12340
|
-
var STATE_FILE_RE = /^tool-server(-[0-9a-f]{12})?\.json$/;
|
|
12480
|
+
var STATE_FILE_RE = /^tool-server(-[0-9a-f]{12}(-cloud-[0-9a-f]{12})?)?\.json$/;
|
|
12341
12481
|
async function readAllToolsServerStates() {
|
|
12342
12482
|
let names;
|
|
12343
12483
|
try {
|
|
@@ -12348,7 +12488,7 @@ async function readAllToolsServerStates() {
|
|
|
12348
12488
|
const out = [];
|
|
12349
12489
|
for (const name of names) {
|
|
12350
12490
|
if (!STATE_FILE_RE.test(name)) continue;
|
|
12351
|
-
const file2 =
|
|
12491
|
+
const file2 = path8.join(STATE_DIR, name);
|
|
12352
12492
|
const state2 = await readStateFile(file2);
|
|
12353
12493
|
if (state2) out.push({ file: file2, state: state2 });
|
|
12354
12494
|
}
|
|
@@ -12364,7 +12504,7 @@ async function sweepDeadStateFiles() {
|
|
|
12364
12504
|
});
|
|
12365
12505
|
continue;
|
|
12366
12506
|
}
|
|
12367
|
-
if (
|
|
12507
|
+
if (fs7.existsSync(fresh.bundlePath)) continue;
|
|
12368
12508
|
if (!couldBeOurToolServer(fresh.pid, fresh.bundlePath)) continue;
|
|
12369
12509
|
await unlink(file2).catch(() => {
|
|
12370
12510
|
});
|
|
@@ -12401,17 +12541,26 @@ async function terminatePid(pid, stillOurs) {
|
|
|
12401
12541
|
}
|
|
12402
12542
|
await waitForExit(pid, SIGKILL_GRACE_MS);
|
|
12403
12543
|
}
|
|
12404
|
-
async function killToolServer(bundlePath) {
|
|
12405
|
-
const state2 = await readState(bundlePath);
|
|
12544
|
+
async function killToolServer(bundlePath, cloudProfile) {
|
|
12545
|
+
const state2 = await readState(bundlePath, cloudProfile);
|
|
12406
12546
|
if (!state2) return false;
|
|
12407
12547
|
const stillOurs = () => couldBeOurToolServer(state2.pid, state2.bundlePath);
|
|
12408
12548
|
const alive = isProcessAlive(state2.pid);
|
|
12409
12549
|
if (alive && !stillOurs()) return false;
|
|
12410
12550
|
if (alive) await terminatePid(state2.pid, stillOurs);
|
|
12411
|
-
await clearToolsServerState(bundlePath ?? state2.bundlePath);
|
|
12551
|
+
await clearToolsServerState(bundlePath ?? state2.bundlePath, cloudProfile);
|
|
12412
12552
|
return alive;
|
|
12413
12553
|
}
|
|
12414
|
-
|
|
12554
|
+
function clientCloudProfile(env = process.env) {
|
|
12555
|
+
const cloud = cloudCredential(env);
|
|
12556
|
+
return cloud ? cloudProfileId(cloud) : void 0;
|
|
12557
|
+
}
|
|
12558
|
+
async function otherToolServersOfBundle(bundlePath, cloudProfile) {
|
|
12559
|
+
return (await readAllToolsServerStates()).map(({ state: state2 }) => state2).filter(
|
|
12560
|
+
(state2) => state2.bundlePath === bundlePath && state2.cloudProfile !== cloudProfile && isProcessAlive(state2.pid)
|
|
12561
|
+
);
|
|
12562
|
+
}
|
|
12563
|
+
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs7.existsSync(p)) ?? "ps";
|
|
12415
12564
|
var PS_WIDTH_FLAGS = ["-ww"];
|
|
12416
12565
|
var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
12417
12566
|
function readProcessCommandLine(pid, flags2 = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
|
|
@@ -12458,13 +12607,13 @@ var LOCK_STALE_MS2 = 45e3;
|
|
|
12458
12607
|
var LOCK_POLL_MS = 100;
|
|
12459
12608
|
function spawnLockIsStale() {
|
|
12460
12609
|
try {
|
|
12461
|
-
const { pid, ts } = JSON.parse(
|
|
12610
|
+
const { pid, ts } = JSON.parse(fs7.readFileSync(LOCK_FILE, "utf8"));
|
|
12462
12611
|
if (typeof pid === "number" && pid > 0 && !isProcessAlive(pid)) return true;
|
|
12463
12612
|
if (typeof ts === "number" && Date.now() - ts > LOCK_STALE_MS2) return true;
|
|
12464
12613
|
return false;
|
|
12465
12614
|
} catch {
|
|
12466
12615
|
try {
|
|
12467
|
-
return Date.now() -
|
|
12616
|
+
return Date.now() - fs7.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS2;
|
|
12468
12617
|
} catch {
|
|
12469
12618
|
return true;
|
|
12470
12619
|
}
|
|
@@ -12472,7 +12621,7 @@ function spawnLockIsStale() {
|
|
|
12472
12621
|
}
|
|
12473
12622
|
async function acquireSpawnLock() {
|
|
12474
12623
|
try {
|
|
12475
|
-
|
|
12624
|
+
fs7.mkdirSync(STATE_DIR, { recursive: true });
|
|
12476
12625
|
} catch {
|
|
12477
12626
|
return null;
|
|
12478
12627
|
}
|
|
@@ -12480,11 +12629,11 @@ async function acquireSpawnLock() {
|
|
|
12480
12629
|
const deadline = Date.now() + LOCK_WAIT_TIMEOUT_MS;
|
|
12481
12630
|
for (; ; ) {
|
|
12482
12631
|
try {
|
|
12483
|
-
const fd =
|
|
12632
|
+
const fd = fs7.openSync(LOCK_FILE, "wx");
|
|
12484
12633
|
try {
|
|
12485
|
-
|
|
12634
|
+
fs7.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
|
|
12486
12635
|
} finally {
|
|
12487
|
-
|
|
12636
|
+
fs7.closeSync(fd);
|
|
12488
12637
|
}
|
|
12489
12638
|
let released = false;
|
|
12490
12639
|
return {
|
|
@@ -12492,8 +12641,8 @@ async function acquireSpawnLock() {
|
|
|
12492
12641
|
if (released) return;
|
|
12493
12642
|
released = true;
|
|
12494
12643
|
try {
|
|
12495
|
-
const cur = JSON.parse(
|
|
12496
|
-
if (cur.pid === process.pid && cur.nonce === nonce)
|
|
12644
|
+
const cur = JSON.parse(fs7.readFileSync(LOCK_FILE, "utf8"));
|
|
12645
|
+
if (cur.pid === process.pid && cur.nonce === nonce) fs7.unlinkSync(LOCK_FILE);
|
|
12497
12646
|
} catch {
|
|
12498
12647
|
}
|
|
12499
12648
|
}
|
|
@@ -12502,10 +12651,10 @@ async function acquireSpawnLock() {
|
|
|
12502
12651
|
if (err.code !== "EEXIST") return null;
|
|
12503
12652
|
if (spawnLockIsStale()) {
|
|
12504
12653
|
try {
|
|
12505
|
-
|
|
12654
|
+
fs7.unlinkSync(LOCK_FILE);
|
|
12506
12655
|
} catch {
|
|
12507
12656
|
}
|
|
12508
|
-
if (!
|
|
12657
|
+
if (!fs7.existsSync(LOCK_FILE)) continue;
|
|
12509
12658
|
}
|
|
12510
12659
|
if (Date.now() >= deadline) return null;
|
|
12511
12660
|
await new Promise((r2) => setTimeout(r2, LOCK_POLL_MS));
|
|
@@ -12515,7 +12664,8 @@ async function acquireSpawnLock() {
|
|
|
12515
12664
|
async function reusableHandle(state2, wantBundlePath, wantVersion) {
|
|
12516
12665
|
if (!state2 || !isProcessAlive(state2.pid)) return null;
|
|
12517
12666
|
if (wantBundlePath !== void 0 && state2.bundlePath !== wantBundlePath) return null;
|
|
12518
|
-
|
|
12667
|
+
const holdsLease = state2.cloudProfile !== void 0 && cloudAndroidLeaseHolders().has(state2.pid);
|
|
12668
|
+
if (wantBundlePath !== void 0 && state2.version !== void 0 && !holdsLease) {
|
|
12519
12669
|
const diskVersion = readBundlePackageVersion(wantBundlePath);
|
|
12520
12670
|
if (diskVersion !== void 0) {
|
|
12521
12671
|
if (diskVersion !== state2.version) return null;
|
|
@@ -12528,25 +12678,24 @@ async function reusableHandle(state2, wantBundlePath, wantVersion) {
|
|
|
12528
12678
|
if (!healthy) return null;
|
|
12529
12679
|
return { url: formatUrl(healthCheckHost(host), state2.port), token: state2.token ?? "" };
|
|
12530
12680
|
}
|
|
12531
|
-
async function ensureToolsServer(paths) {
|
|
12681
|
+
async function ensureToolsServer(paths, env = process.env) {
|
|
12532
12682
|
assertPrivateArgentHome();
|
|
12533
|
-
const
|
|
12534
|
-
|
|
12535
|
-
|
|
12536
|
-
|
|
12537
|
-
);
|
|
12683
|
+
const cloud = cloudCredential(env) ?? void 0;
|
|
12684
|
+
const cloudProfile = clientCloudProfile(env);
|
|
12685
|
+
const readOwnState = () => readState(paths.bundlePath, cloudProfile);
|
|
12686
|
+
const fast = await reusableHandle(await readOwnState(), paths.bundlePath, paths.version);
|
|
12538
12687
|
if (fast) return fast;
|
|
12539
12688
|
const lock = await acquireSpawnLock();
|
|
12540
12689
|
try {
|
|
12541
|
-
const state2 = await
|
|
12690
|
+
const state2 = await readOwnState();
|
|
12542
12691
|
const reuse = await reusableHandle(state2, paths.bundlePath, paths.version);
|
|
12543
12692
|
if (reuse) return reuse;
|
|
12544
12693
|
if (state2 && state2.managed === "autospawn" && state2.bundlePath === paths.bundlePath && isProcessAlive(state2.pid) && couldBeOurToolServer(state2.pid, state2.bundlePath)) {
|
|
12545
12694
|
await terminatePid(state2.pid, () => couldBeOurToolServer(state2.pid, state2.bundlePath));
|
|
12546
12695
|
}
|
|
12547
|
-
await clearToolsServerState(paths.bundlePath);
|
|
12696
|
+
await clearToolsServerState(paths.bundlePath, cloudProfile);
|
|
12548
12697
|
await sweepDeadStateFiles();
|
|
12549
|
-
if (!
|
|
12698
|
+
if (!fs7.existsSync(paths.bundlePath)) {
|
|
12550
12699
|
throw new Error(
|
|
12551
12700
|
`The argent install serving this session is gone from disk (${paths.bundlePath}) \u2014 it was likely updated or removed. Restart the editor's MCP connection to reconnect.`
|
|
12552
12701
|
);
|
|
@@ -12557,9 +12706,11 @@ async function ensureToolsServer(paths) {
|
|
|
12557
12706
|
const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
|
|
12558
12707
|
token,
|
|
12559
12708
|
host: AUTOSPAWN_HOST,
|
|
12560
|
-
idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES
|
|
12709
|
+
idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES,
|
|
12710
|
+
...cloud ? { cloud } : {}
|
|
12561
12711
|
});
|
|
12562
12712
|
await writeState({
|
|
12713
|
+
...cloudProfile ? { cloudProfile } : {},
|
|
12563
12714
|
port: actualPort,
|
|
12564
12715
|
pid,
|
|
12565
12716
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -12580,7 +12731,7 @@ var STATE_PATHS = { STATE_DIR, STATE_FILE, LOG_FILE, LOCK_FILE };
|
|
|
12580
12731
|
var import_yaml2 = __toESM(require_dist2(), 1);
|
|
12581
12732
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
12582
12733
|
import { maxHeaderSize } from "node:http";
|
|
12583
|
-
import * as
|
|
12734
|
+
import * as path14 from "node:path";
|
|
12584
12735
|
|
|
12585
12736
|
// ../registry/src/types.ts
|
|
12586
12737
|
var LINKED_CALL_HEADER = "x-argent-linked";
|
|
@@ -12642,8 +12793,8 @@ var UNEXPANDED_PATH = /^~|\$[A-Za-z0-9_{(]|`|%[A-Za-z_][A-Za-z0-9_]*%|^[A-Za-z][
|
|
|
12642
12793
|
function isUnexpandedPath(p) {
|
|
12643
12794
|
return UNEXPANDED_PATH.test(p);
|
|
12644
12795
|
}
|
|
12645
|
-
function isClientFileArgument({ spec, path:
|
|
12646
|
-
return spec.kind === "file" && spec.path === `\${${spec.target}}` &&
|
|
12796
|
+
function isClientFileArgument({ spec, path: path48 }) {
|
|
12797
|
+
return spec.kind === "file" && spec.path === `\${${spec.target}}` && path48.startsWith("/") && hasToolFileExtension(path48);
|
|
12647
12798
|
}
|
|
12648
12799
|
|
|
12649
12800
|
// ../registry/src/flow-platforms.ts
|
|
@@ -12651,26 +12802,26 @@ var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
|
|
|
12651
12802
|
var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
|
|
12652
12803
|
|
|
12653
12804
|
// ../registry/src/flow-file-refs.ts
|
|
12654
|
-
import * as
|
|
12655
|
-
import * as
|
|
12805
|
+
import * as fs9 from "node:fs/promises";
|
|
12806
|
+
import * as path10 from "node:path";
|
|
12656
12807
|
|
|
12657
12808
|
// ../registry/src/e2e-dirs.ts
|
|
12658
|
-
import * as
|
|
12659
|
-
import * as
|
|
12660
|
-
var E2E_DIR =
|
|
12661
|
-
var LEGACY_E2E_DIRS = Object.freeze([
|
|
12809
|
+
import * as fs8 from "node:fs/promises";
|
|
12810
|
+
import * as path9 from "node:path";
|
|
12811
|
+
var E2E_DIR = path9.join(".argent", "e2e");
|
|
12812
|
+
var LEGACY_E2E_DIRS = Object.freeze([path9.join(".argent", "flows")]);
|
|
12662
12813
|
var E2E_DIRS = Object.freeze([E2E_DIR, ...LEGACY_E2E_DIRS]);
|
|
12663
12814
|
function e2eDirFor(projectRoot) {
|
|
12664
|
-
return
|
|
12815
|
+
return path9.join(projectRoot, E2E_DIR);
|
|
12665
12816
|
}
|
|
12666
12817
|
function e2eDirsFor(projectRoot) {
|
|
12667
|
-
return E2E_DIRS.map((dir) =>
|
|
12818
|
+
return E2E_DIRS.map((dir) => path9.join(projectRoot, dir));
|
|
12668
12819
|
}
|
|
12669
12820
|
function e2eFileCandidates(projectRoot, name) {
|
|
12670
|
-
return e2eDirsFor(projectRoot).map((dir) =>
|
|
12821
|
+
return e2eDirsFor(projectRoot).map((dir) => path9.join(dir, `${name}.yaml`));
|
|
12671
12822
|
}
|
|
12672
12823
|
async function exists(file2) {
|
|
12673
|
-
return
|
|
12824
|
+
return fs8.stat(file2).then(
|
|
12674
12825
|
() => true,
|
|
12675
12826
|
() => false
|
|
12676
12827
|
);
|
|
@@ -12700,21 +12851,21 @@ function resolveE2eFile(projectRoot, name) {
|
|
|
12700
12851
|
function e2eShadowWarning(used, shadowed) {
|
|
12701
12852
|
return `${shadowed} is not used: ${used} has the same name and is read first.`;
|
|
12702
12853
|
}
|
|
12703
|
-
var E2E_DIR_NAMES = E2E_DIRS.map((dir) =>
|
|
12854
|
+
var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path9.basename(dir));
|
|
12704
12855
|
function e2eDirProject(dir) {
|
|
12705
12856
|
const trimmed = dir.length > 1 ? dir.replace(/[\\/]+$/, "") : dir;
|
|
12706
|
-
const argent =
|
|
12707
|
-
if (!E2E_DIR_NAMES.includes(
|
|
12857
|
+
const argent = path9.dirname(trimmed);
|
|
12858
|
+
if (!E2E_DIR_NAMES.includes(path9.basename(trimmed)) || path9.basename(argent) !== ".argent") {
|
|
12708
12859
|
return null;
|
|
12709
12860
|
}
|
|
12710
|
-
return
|
|
12861
|
+
return path9.dirname(argent);
|
|
12711
12862
|
}
|
|
12712
12863
|
function e2eRunFallbackDirs(anchorDir, target) {
|
|
12713
12864
|
if (target.includes("/") || target.includes("\\")) return [];
|
|
12714
12865
|
const project = e2eDirProject(anchorDir);
|
|
12715
12866
|
if (project === null) return [];
|
|
12716
|
-
const anchor2 =
|
|
12717
|
-
return e2eDirsFor(project).filter((dir) =>
|
|
12867
|
+
const anchor2 = path9.resolve(anchorDir);
|
|
12868
|
+
return e2eDirsFor(project).filter((dir) => path9.resolve(dir) !== anchor2);
|
|
12718
12869
|
}
|
|
12719
12870
|
|
|
12720
12871
|
// ../registry/src/tool-ids.ts
|
|
@@ -12764,10 +12915,10 @@ function canonicalToolArgs(tool, args) {
|
|
|
12764
12915
|
// ../registry/src/flow-file-refs.ts
|
|
12765
12916
|
async function canonicalFlowPath(p) {
|
|
12766
12917
|
try {
|
|
12767
|
-
return await
|
|
12918
|
+
return await fs9.realpath(p);
|
|
12768
12919
|
} catch {
|
|
12769
12920
|
try {
|
|
12770
|
-
return
|
|
12921
|
+
return path10.join(await fs9.realpath(path10.dirname(p)), path10.basename(p));
|
|
12771
12922
|
} catch {
|
|
12772
12923
|
return p;
|
|
12773
12924
|
}
|
|
@@ -12776,7 +12927,7 @@ async function canonicalFlowPath(p) {
|
|
|
12776
12927
|
function completeRunExtension(value) {
|
|
12777
12928
|
if (value.endsWith(".yaml")) return value;
|
|
12778
12929
|
const candidate = `${value}.yaml`;
|
|
12779
|
-
return FLOW_FILE_NAME_PATTERN.test(
|
|
12930
|
+
return FLOW_FILE_NAME_PATTERN.test(path10.posix.basename(candidate)) ? candidate : value;
|
|
12780
12931
|
}
|
|
12781
12932
|
var MAX_RUN_DEPTH = 20;
|
|
12782
12933
|
var MAX_BLOCK_NESTING = 64;
|
|
@@ -12798,9 +12949,9 @@ function collectFlowRequests(doc) {
|
|
|
12798
12949
|
for (const step of steps) {
|
|
12799
12950
|
if (!isRecord(step)) continue;
|
|
12800
12951
|
const run2 = step.run;
|
|
12801
|
-
if (typeof run2 === "string" && !run2.includes("\\") && !
|
|
12952
|
+
if (typeof run2 === "string" && !run2.includes("\\") && !path10.posix.isAbsolute(run2) && !/^[A-Za-z]:/.test(run2)) {
|
|
12802
12953
|
const target = completeRunExtension(run2);
|
|
12803
|
-
if (FLOW_FILE_NAME_PATTERN.test(
|
|
12954
|
+
if (FLOW_FILE_NAME_PATTERN.test(path10.posix.basename(target))) runTargets.add(target);
|
|
12804
12955
|
}
|
|
12805
12956
|
const snapshot = isRecord(step.snapshot) ? step.snapshot.name : step.snapshot;
|
|
12806
12957
|
if (typeof snapshot === "string" && FLOW_NAME_PATTERN.test(snapshot)) snapshots.add(snapshot);
|
|
@@ -12820,14 +12971,14 @@ function collectFlowRequests(doc) {
|
|
|
12820
12971
|
return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
|
|
12821
12972
|
}
|
|
12822
12973
|
function baselineKeyFor(canonicalPath2, flowName) {
|
|
12823
|
-
const stem =
|
|
12974
|
+
const stem = path10.basename(canonicalPath2, ".yaml");
|
|
12824
12975
|
return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
|
|
12825
12976
|
}
|
|
12826
12977
|
function flowMemberKey(anchorDir, target) {
|
|
12827
12978
|
return `${anchorDir}\0${target}`;
|
|
12828
12979
|
}
|
|
12829
12980
|
async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
|
|
12830
|
-
const entries = await
|
|
12981
|
+
const entries = await fs9.readdir(dir).catch(() => null);
|
|
12831
12982
|
if (entries === null || entries.includes(base)) return { state: "listed" };
|
|
12832
12983
|
const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
|
|
12833
12984
|
if (actual === void 0) return { state: "absent" };
|
|
@@ -12849,11 +13000,11 @@ function nestedFlowTarget(args) {
|
|
|
12849
13000
|
return { kind: "name", projectRoot, name, path: paths[0], paths };
|
|
12850
13001
|
}
|
|
12851
13002
|
if (name !== void 0 || !isResolvedAbsolute(flowPath)) return void 0;
|
|
12852
|
-
if (!FLOW_FILE_NAME_PATTERN.test(
|
|
13003
|
+
if (!FLOW_FILE_NAME_PATTERN.test(path10.basename(flowPath))) return void 0;
|
|
12853
13004
|
return { kind: "e2e_test_path", path: flowPath };
|
|
12854
13005
|
}
|
|
12855
13006
|
function isResolvedAbsolute(value) {
|
|
12856
|
-
return typeof value === "string" &&
|
|
13007
|
+
return typeof value === "string" && path10.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
|
|
12857
13008
|
}
|
|
12858
13009
|
|
|
12859
13010
|
// ../registry/src/failure-codes.ts
|
|
@@ -13287,6 +13438,17 @@ var FAILURE_CODES = {
|
|
|
13287
13438
|
BOOT_HARMONY_STOP_TIMEOUT: "BOOT_HARMONY_STOP_TIMEOUT",
|
|
13288
13439
|
BOOT_HARMONY_MANAGER_EXITED: "BOOT_HARMONY_MANAGER_EXITED",
|
|
13289
13440
|
BOOT_HARMONY_START_FAILED: "BOOT_HARMONY_START_FAILED",
|
|
13441
|
+
/**
|
|
13442
|
+
* Argent Cloud Android emulators
|
|
13443
|
+
* @see [leases.ts](../../tool-server/src/utils/cloud-android/leases.ts)
|
|
13444
|
+
*/
|
|
13445
|
+
CLOUD_ANDROID_ACCESS_DENIED: "CLOUD_ANDROID_ACCESS_DENIED",
|
|
13446
|
+
CLOUD_ANDROID_ACQUIRE_FAILED: "CLOUD_ANDROID_ACQUIRE_FAILED",
|
|
13447
|
+
CLOUD_ANDROID_ADB_KEY_MISSING: "CLOUD_ANDROID_ADB_KEY_MISSING",
|
|
13448
|
+
CLOUD_ANDROID_ADB_SERVER_REMOTE: "CLOUD_ANDROID_ADB_SERVER_REMOTE",
|
|
13449
|
+
CLOUD_ANDROID_CONNECT_FAILED: "CLOUD_ANDROID_CONNECT_FAILED",
|
|
13450
|
+
CLOUD_ANDROID_LEASE_IN_USE: "CLOUD_ANDROID_LEASE_IN_USE",
|
|
13451
|
+
CLOUD_ANDROID_NO_EMULATOR: "CLOUD_ANDROID_NO_EMULATOR",
|
|
13290
13452
|
/**
|
|
13291
13453
|
* External device providers
|
|
13292
13454
|
* @see [external-devices.ts](../../tool-server/src/utils/external-devices.ts)
|
|
@@ -14184,10 +14346,10 @@ function mergeDefs(...defs) {
|
|
|
14184
14346
|
function cloneDef(schema) {
|
|
14185
14347
|
return mergeDefs(schema._zod.def);
|
|
14186
14348
|
}
|
|
14187
|
-
function getElementAtPath(obj,
|
|
14188
|
-
if (!
|
|
14349
|
+
function getElementAtPath(obj, path48) {
|
|
14350
|
+
if (!path48)
|
|
14189
14351
|
return obj;
|
|
14190
|
-
return
|
|
14352
|
+
return path48.reduce((acc, key) => acc?.[key], obj);
|
|
14191
14353
|
}
|
|
14192
14354
|
function promiseAllObject(promisesObj) {
|
|
14193
14355
|
const keys = Object.keys(promisesObj);
|
|
@@ -14527,11 +14689,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
14527
14689
|
}
|
|
14528
14690
|
return false;
|
|
14529
14691
|
}
|
|
14530
|
-
function prefixIssues(
|
|
14692
|
+
function prefixIssues(path48, issues) {
|
|
14531
14693
|
return issues.map((iss) => {
|
|
14532
14694
|
var _a3;
|
|
14533
14695
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
14534
|
-
iss.path.unshift(
|
|
14696
|
+
iss.path.unshift(path48);
|
|
14535
14697
|
return iss;
|
|
14536
14698
|
});
|
|
14537
14699
|
}
|
|
@@ -14993,16 +15155,16 @@ function flattenError(error63, mapper = (issue2) => issue2.message) {
|
|
|
14993
15155
|
}
|
|
14994
15156
|
function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
14995
15157
|
const fieldErrors = { _errors: [] };
|
|
14996
|
-
const processError = (error64,
|
|
15158
|
+
const processError = (error64, path48 = []) => {
|
|
14997
15159
|
for (const issue2 of error64.issues) {
|
|
14998
15160
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
14999
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
15161
|
+
issue2.errors.map((issues) => processError({ issues }, [...path48, ...issue2.path]));
|
|
15000
15162
|
} else if (issue2.code === "invalid_key") {
|
|
15001
|
-
processError({ issues: issue2.issues }, [...
|
|
15163
|
+
processError({ issues: issue2.issues }, [...path48, ...issue2.path]);
|
|
15002
15164
|
} else if (issue2.code === "invalid_element") {
|
|
15003
|
-
processError({ issues: issue2.issues }, [...
|
|
15165
|
+
processError({ issues: issue2.issues }, [...path48, ...issue2.path]);
|
|
15004
15166
|
} else {
|
|
15005
|
-
const fullpath = [...
|
|
15167
|
+
const fullpath = [...path48, ...issue2.path];
|
|
15006
15168
|
if (fullpath.length === 0) {
|
|
15007
15169
|
fieldErrors._errors.push(mapper(issue2));
|
|
15008
15170
|
} else {
|
|
@@ -15041,17 +15203,17 @@ function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
|
15041
15203
|
}
|
|
15042
15204
|
function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
15043
15205
|
const result = { errors: [] };
|
|
15044
|
-
const processError = (error64,
|
|
15206
|
+
const processError = (error64, path48 = []) => {
|
|
15045
15207
|
var _a3;
|
|
15046
15208
|
for (const issue2 of error64.issues) {
|
|
15047
15209
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
15048
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
15210
|
+
issue2.errors.map((issues) => processError({ issues }, [...path48, ...issue2.path]));
|
|
15049
15211
|
} else if (issue2.code === "invalid_key") {
|
|
15050
|
-
processError({ issues: issue2.issues }, [...
|
|
15212
|
+
processError({ issues: issue2.issues }, [...path48, ...issue2.path]);
|
|
15051
15213
|
} else if (issue2.code === "invalid_element") {
|
|
15052
|
-
processError({ issues: issue2.issues }, [...
|
|
15214
|
+
processError({ issues: issue2.issues }, [...path48, ...issue2.path]);
|
|
15053
15215
|
} else {
|
|
15054
|
-
const fullpath = [...
|
|
15216
|
+
const fullpath = [...path48, ...issue2.path];
|
|
15055
15217
|
if (fullpath.length === 0) {
|
|
15056
15218
|
result.errors.push(mapper(issue2));
|
|
15057
15219
|
continue;
|
|
@@ -15090,8 +15252,8 @@ function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
|
15090
15252
|
}
|
|
15091
15253
|
function toDotPath(_path) {
|
|
15092
15254
|
const segs = [];
|
|
15093
|
-
const
|
|
15094
|
-
for (const seg of
|
|
15255
|
+
const path48 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
15256
|
+
for (const seg of path48) {
|
|
15095
15257
|
if (typeof seg === "number")
|
|
15096
15258
|
segs.push(`[${seg}]`);
|
|
15097
15259
|
else if (typeof seg === "symbol")
|
|
@@ -32229,13 +32391,13 @@ function resolveRef(ref, ctx) {
|
|
|
32229
32391
|
if (!ref.startsWith("#")) {
|
|
32230
32392
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
32231
32393
|
}
|
|
32232
|
-
const
|
|
32233
|
-
if (
|
|
32394
|
+
const path48 = ref.slice(1).split("/").filter(Boolean);
|
|
32395
|
+
if (path48.length === 0) {
|
|
32234
32396
|
return ctx.rootSchema;
|
|
32235
32397
|
}
|
|
32236
32398
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
32237
|
-
if (
|
|
32238
|
-
const key =
|
|
32399
|
+
if (path48[0] === defsKey) {
|
|
32400
|
+
const key = path48[1] === void 0 ? void 0 : decodeJSONPointerSegment(path48[1]);
|
|
32239
32401
|
if (!key || !ctx.defs[key]) {
|
|
32240
32402
|
throw new Error(`Reference not found: ${ref}`);
|
|
32241
32403
|
}
|
|
@@ -33088,9 +33250,9 @@ function date4(params) {
|
|
|
33088
33250
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
33089
33251
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
33090
33252
|
var resolvedDuringInvocation = new AsyncLocalStorage();
|
|
33091
|
-
function valueAtPath(root,
|
|
33253
|
+
function valueAtPath(root, path48) {
|
|
33092
33254
|
let current = root;
|
|
33093
|
-
for (const key of
|
|
33255
|
+
for (const key of path48) {
|
|
33094
33256
|
if (current === null || typeof current !== "object") return void 0;
|
|
33095
33257
|
if (!Object.hasOwn(current, key)) return void 0;
|
|
33096
33258
|
current = current[key];
|
|
@@ -33148,10 +33310,10 @@ function describeParamIssues(error63, params) {
|
|
|
33148
33310
|
}
|
|
33149
33311
|
|
|
33150
33312
|
// ../argent-tools-client/src/link-config.ts
|
|
33151
|
-
import * as
|
|
33313
|
+
import * as path11 from "node:path";
|
|
33152
33314
|
import { mkdir, writeFile, readFile as readFile2, unlink as unlink2, chmod } from "node:fs/promises";
|
|
33153
33315
|
var LINK_DIR = argentHomeDir();
|
|
33154
|
-
var LINK_FILE =
|
|
33316
|
+
var LINK_FILE = path11.join(LINK_DIR, "link.json");
|
|
33155
33317
|
async function readLinkConfig() {
|
|
33156
33318
|
try {
|
|
33157
33319
|
const raw = await readFile2(LINK_FILE, "utf8");
|
|
@@ -33249,8 +33411,8 @@ function parseLinkTarget(input2) {
|
|
|
33249
33411
|
const host = u3.hostname.startsWith("[") ? u3.hostname.slice(1, -1) : u3.hostname;
|
|
33250
33412
|
if (!host) throw new Error(`URL "${input2}" is missing a host.`);
|
|
33251
33413
|
const port = u3.port ? Number(u3.port) : u3.protocol === "https:" ? 443 : 80;
|
|
33252
|
-
const
|
|
33253
|
-
const url2 = `${u3.protocol}//${u3.host}${
|
|
33414
|
+
const path48 = u3.pathname === "/" ? "" : u3.pathname.replace(/\/+$/, "");
|
|
33415
|
+
const url2 = `${u3.protocol}//${u3.host}${path48}`;
|
|
33254
33416
|
const token = u3.username ? decodeURIComponent(u3.username) : void 0;
|
|
33255
33417
|
return { url: url2, host, port, ...token ? { token } : {} };
|
|
33256
33418
|
}
|
|
@@ -33270,14 +33432,14 @@ import {
|
|
|
33270
33432
|
writeFile as writeFile2
|
|
33271
33433
|
} from "node:fs/promises";
|
|
33272
33434
|
import { constants as constants2, tmpdir } from "node:os";
|
|
33273
|
-
import * as
|
|
33435
|
+
import * as path12 from "node:path";
|
|
33274
33436
|
|
|
33275
33437
|
// ../archive/src/index.ts
|
|
33276
33438
|
import { spawn as spawn2 } from "node:child_process";
|
|
33277
33439
|
import { once } from "node:events";
|
|
33278
33440
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
33279
33441
|
import { open as open2, rm, readdir as readdir3 } from "node:fs/promises";
|
|
33280
|
-
import { basename as basename4, dirname as
|
|
33442
|
+
import { basename as basename4, dirname as dirname6, join as join11, resolve as resolve8, sep as sep2 } from "node:path";
|
|
33281
33443
|
import { Writable } from "node:stream";
|
|
33282
33444
|
import { pipeline } from "node:stream/promises";
|
|
33283
33445
|
import zlib from "node:zlib";
|
|
@@ -33301,7 +33463,7 @@ function createCompressor(format2) {
|
|
|
33301
33463
|
}
|
|
33302
33464
|
function createTarArgs(sourcePath) {
|
|
33303
33465
|
const name = basename4(sourcePath);
|
|
33304
|
-
return ["-cf", "-", "-C",
|
|
33466
|
+
return ["-cf", "-", "-C", dirname6(sourcePath), /^[-@]/.test(name) ? `./${name}` : name];
|
|
33305
33467
|
}
|
|
33306
33468
|
var MAX_LISTING_BYTES = 32 << 20;
|
|
33307
33469
|
var MAX_LISTING_LINES = 1 << 18;
|
|
@@ -33481,8 +33643,8 @@ async function runTar(archive, args, signal) {
|
|
|
33481
33643
|
function normalizeTarMemberPath(memberPath) {
|
|
33482
33644
|
return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
33483
33645
|
}
|
|
33484
|
-
function isContainedPath(
|
|
33485
|
-
const slashed =
|
|
33646
|
+
function isContainedPath(path48, windows = process.platform === "win32") {
|
|
33647
|
+
const slashed = path48.replace(/\\/g, "/");
|
|
33486
33648
|
const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
|
|
33487
33649
|
return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
|
|
33488
33650
|
}
|
|
@@ -33542,7 +33704,7 @@ async function assertSafeArchive(archive, destDir, signal) {
|
|
|
33542
33704
|
async function resolveMember(destDir, expectedName) {
|
|
33543
33705
|
const entries = await readdir3(destDir);
|
|
33544
33706
|
if (entries.includes(expectedName)) {
|
|
33545
|
-
return
|
|
33707
|
+
return join11(destDir, expectedName);
|
|
33546
33708
|
}
|
|
33547
33709
|
const real = entries.filter((e) => !e.startsWith("._"));
|
|
33548
33710
|
if (real.length !== 1) {
|
|
@@ -33550,7 +33712,7 @@ async function resolveMember(destDir, expectedName) {
|
|
|
33550
33712
|
`Could not identify the extracted member (expected "${expectedName}", found ${real.length} entries).`
|
|
33551
33713
|
);
|
|
33552
33714
|
}
|
|
33553
|
-
return
|
|
33715
|
+
return join11(destDir, real[0]);
|
|
33554
33716
|
}
|
|
33555
33717
|
async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
|
|
33556
33718
|
signal?.throwIfAborted();
|
|
@@ -33603,20 +33765,20 @@ function interpolatePath(template, args) {
|
|
|
33603
33765
|
return missing ? null : out;
|
|
33604
33766
|
}
|
|
33605
33767
|
function callerPath(p) {
|
|
33606
|
-
const onCurrentDrive =
|
|
33607
|
-
if (!onCurrentDrive && (
|
|
33768
|
+
const onCurrentDrive = path12.sep === "\\" && /^[\\/](?![\\/])/.test(p);
|
|
33769
|
+
if (!onCurrentDrive && (path12.isAbsolute(p) || path12.win32.isAbsolute(p) || isUnexpandedPath(p))) {
|
|
33608
33770
|
return p;
|
|
33609
33771
|
}
|
|
33610
|
-
const { root } =
|
|
33772
|
+
const { root } = path12.parse(p);
|
|
33611
33773
|
const rest = p.slice(root.length);
|
|
33612
33774
|
if (!rest.split(/[\\/]/).includes("..")) {
|
|
33613
|
-
const resolved =
|
|
33614
|
-
const last = p.split(
|
|
33615
|
-
const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(
|
|
33616
|
-
return dirOnly ? `${resolved}${
|
|
33775
|
+
const resolved = path12.resolve(p);
|
|
33776
|
+
const last = p.split(path12.sep === "\\" ? /[\\/]/ : "/").at(-1);
|
|
33777
|
+
const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(path12.sep);
|
|
33778
|
+
return dirOnly ? `${resolved}${path12.sep}` : resolved;
|
|
33617
33779
|
}
|
|
33618
|
-
const base =
|
|
33619
|
-
return base.endsWith(
|
|
33780
|
+
const base = path12.resolve(root);
|
|
33781
|
+
return base.endsWith(path12.sep) ? `${base}${rest}` : `${base}${path12.sep}${rest}`;
|
|
33620
33782
|
}
|
|
33621
33783
|
async function specPath(spec, args) {
|
|
33622
33784
|
if (spec.kind !== "file" || !spec.paths?.length) return interpolatePath(spec.path, args);
|
|
@@ -33724,7 +33886,7 @@ async function uploadTar(tarPath, format2, endpoint, signal) {
|
|
|
33724
33886
|
}
|
|
33725
33887
|
async function uploadFile(sourcePath, endpoint, signal) {
|
|
33726
33888
|
const format2 = pickArchiveFormat(endpoint.formats);
|
|
33727
|
-
const tarPath =
|
|
33889
|
+
const tarPath = path12.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
|
|
33728
33890
|
trackArchive(tarPath);
|
|
33729
33891
|
try {
|
|
33730
33892
|
await createArchiveFile(await realpath2(sourcePath), tarPath, format2, signal);
|
|
@@ -33799,7 +33961,7 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
33799
33961
|
wire.mtimeMs = st.mtimeMs;
|
|
33800
33962
|
}
|
|
33801
33963
|
if (opts.uploadEndpoint && st) {
|
|
33802
|
-
process.stderr.write(`Uploading ${
|
|
33964
|
+
process.stderr.write(`Uploading ${path12.basename(filePath)} to the remote tool-server...
|
|
33803
33965
|
`);
|
|
33804
33966
|
Object.assign(wire, await uploadFile(filePath, opts.uploadEndpoint, opts.signal));
|
|
33805
33967
|
}
|
|
@@ -33809,7 +33971,7 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
33809
33971
|
return out;
|
|
33810
33972
|
}
|
|
33811
33973
|
function isAllowedClientFilePath(p) {
|
|
33812
|
-
if (!
|
|
33974
|
+
if (!path12.isAbsolute(p)) return false;
|
|
33813
33975
|
const segments = p.split(/[\\/]+/);
|
|
33814
33976
|
if (segments.includes("..")) return false;
|
|
33815
33977
|
const file2 = segments[segments.length - 1] ?? "";
|
|
@@ -33820,7 +33982,7 @@ function isClientFileDirective2(value) {
|
|
|
33820
33982
|
return !!value && typeof value === "object" && value[CLIENT_FILE_MARKER2] === true && typeof value.path === "string" && typeof value.content === "string";
|
|
33821
33983
|
}
|
|
33822
33984
|
async function replaceFile(target, bytes, mode) {
|
|
33823
|
-
const temp =
|
|
33985
|
+
const temp = path12.join(path12.dirname(target), `.baseline-${randomUUID4()}.tmp`);
|
|
33824
33986
|
try {
|
|
33825
33987
|
await writeFile2(temp, bytes, { flag: "wx" });
|
|
33826
33988
|
if (mode !== void 0) await chmod2(temp, mode & 511);
|
|
@@ -33831,27 +33993,27 @@ async function replaceFile(target, bytes, mode) {
|
|
|
33831
33993
|
}
|
|
33832
33994
|
}
|
|
33833
33995
|
async function writeBaselineFile(file2, bytes, allowedDirs) {
|
|
33834
|
-
if (!
|
|
33996
|
+
if (!path12.isAbsolute(file2) || path12.normalize(file2) !== file2 || file2.split(/[\\/]/).includes("..") || !file2.endsWith(".png") || !allowedDirs.includes(path12.dirname(file2))) {
|
|
33835
33997
|
return allowedDirs.length === 0 ? "this call writes no baselines" : `${file2} is not a baseline of this call (${allowedDirs.map((d) => `${d}/<name>.png`).join(", ")})`;
|
|
33836
33998
|
}
|
|
33837
33999
|
if (bytes.length > MAX_CONTENT_BYTES) {
|
|
33838
34000
|
return `${file2}: the baseline is larger than the 32 MiB cap on a file this client writes`;
|
|
33839
34001
|
}
|
|
33840
|
-
const dir =
|
|
34002
|
+
const dir = path12.dirname(file2);
|
|
33841
34003
|
await mkdir2(dir, { recursive: true });
|
|
33842
34004
|
const link2 = await lstat(file2).catch(() => null);
|
|
33843
34005
|
const real = link2 === null ? null : await realpath2(file2).catch(() => null);
|
|
33844
34006
|
if (link2 !== null && real === null) return `${file2} is a symbolic link to a missing file`;
|
|
33845
34007
|
if (real !== null) {
|
|
33846
34008
|
if (!real.endsWith(".png")) return `${file2} links to a file that is not a PNG file`;
|
|
33847
|
-
if (
|
|
34009
|
+
if (path12.dirname(real) !== await realpath2(dir)) {
|
|
33848
34010
|
return `${file2} links outside its baseline directory`;
|
|
33849
34011
|
}
|
|
33850
34012
|
}
|
|
33851
34013
|
const existing = real === null ? null : await stat3(real);
|
|
33852
34014
|
if (existing !== null && !existing.isFile()) return `${file2} is not a regular file`;
|
|
33853
34015
|
await replaceFile(
|
|
33854
|
-
real ??
|
|
34016
|
+
real ?? path12.join(await realpath2(dir), path12.basename(file2)),
|
|
33855
34017
|
bytes,
|
|
33856
34018
|
existing?.mode
|
|
33857
34019
|
);
|
|
@@ -33877,7 +34039,7 @@ async function applyClientFileDirectives(result, opts = {}) {
|
|
|
33877
34039
|
if (isClientFileDirective2(value)) {
|
|
33878
34040
|
if (!isAllowedClientFilePath(value.path)) return null;
|
|
33879
34041
|
try {
|
|
33880
|
-
await mkdir2(
|
|
34042
|
+
await mkdir2(path12.dirname(value.path), { recursive: true });
|
|
33881
34043
|
await writeFile2(value.path, value.content, "utf8");
|
|
33882
34044
|
written.push(value.path);
|
|
33883
34045
|
return value.path;
|
|
@@ -33906,13 +34068,13 @@ async function applyClientFileDirectives(result, opts = {}) {
|
|
|
33906
34068
|
// ../argent-tools-client/src/flow-files.ts
|
|
33907
34069
|
var import_yaml = __toESM(require_dist2(), 1);
|
|
33908
34070
|
import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
|
|
33909
|
-
import * as
|
|
34071
|
+
import * as path13 from "node:path";
|
|
33910
34072
|
var INLINE_MEMBERS_BYTES = 256 * 1024;
|
|
33911
34073
|
function filesLogEnabled() {
|
|
33912
34074
|
return (process.env.ARGENT_E2E_FILES_LOG ?? process.env.ARGENT_FLOW_FILES_LOG) === "1";
|
|
33913
34075
|
}
|
|
33914
34076
|
function isWithin(inner, outer) {
|
|
33915
|
-
return inner === outer || inner.startsWith(outer.endsWith(
|
|
34077
|
+
return inner === outer || inner.startsWith(outer.endsWith(path13.sep) ? outer : outer + path13.sep);
|
|
33916
34078
|
}
|
|
33917
34079
|
function printable(text2) {
|
|
33918
34080
|
return [...text2].map(
|
|
@@ -33920,7 +34082,7 @@ function printable(text2) {
|
|
|
33920
34082
|
).join("");
|
|
33921
34083
|
}
|
|
33922
34084
|
function isResolvedAbsolute2(value) {
|
|
33923
|
-
return typeof value === "string" &&
|
|
34085
|
+
return typeof value === "string" && path13.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
|
|
33924
34086
|
}
|
|
33925
34087
|
function namesValidFlow(args) {
|
|
33926
34088
|
let canonical;
|
|
@@ -33932,13 +34094,13 @@ function namesValidFlow(args) {
|
|
|
33932
34094
|
const { project_root, e2e_test_path: testPath, name } = canonical;
|
|
33933
34095
|
if (!isResolvedAbsolute2(project_root)) return false;
|
|
33934
34096
|
if (name === void 0) {
|
|
33935
|
-
return isResolvedAbsolute2(testPath) && FLOW_FILE_NAME_PATTERN.test(
|
|
34097
|
+
return isResolvedAbsolute2(testPath) && FLOW_FILE_NAME_PATTERN.test(path13.basename(testPath));
|
|
33936
34098
|
}
|
|
33937
34099
|
return testPath === void 0 && typeof name === "string" && FLOW_NAME_PATTERN.test(name);
|
|
33938
34100
|
}
|
|
33939
34101
|
function savedFlowProject(file2) {
|
|
33940
|
-
if (!
|
|
33941
|
-
for (let dir =
|
|
34102
|
+
if (!path13.isAbsolute(file2)) return null;
|
|
34103
|
+
for (let dir = path13.dirname(file2); dir !== path13.dirname(dir); dir = path13.dirname(dir)) {
|
|
33942
34104
|
const project = e2eDirProject(dir);
|
|
33943
34105
|
if (project !== null) return project;
|
|
33944
34106
|
}
|
|
@@ -33953,11 +34115,11 @@ async function landing(spelled) {
|
|
|
33953
34115
|
const canonical = await canonicalFlowPath(spelled);
|
|
33954
34116
|
let at = spelled;
|
|
33955
34117
|
for (; ; ) {
|
|
33956
|
-
const parent =
|
|
34118
|
+
const parent = path13.dirname(at);
|
|
33957
34119
|
if (parent === at) return { canonical, fence: spelled, ...failure2 };
|
|
33958
34120
|
const real = await realpath3(parent).catch(() => null);
|
|
33959
34121
|
if (real !== null) {
|
|
33960
|
-
return { canonical, fence:
|
|
34122
|
+
return { canonical, fence: path13.join(real, path13.basename(at)), ...failure2 };
|
|
33961
34123
|
}
|
|
33962
34124
|
at = parent;
|
|
33963
34125
|
}
|
|
@@ -33965,10 +34127,10 @@ async function landing(spelled) {
|
|
|
33965
34127
|
}
|
|
33966
34128
|
async function closureRoots(rootPath, rootCanonical, projectRoot) {
|
|
33967
34129
|
const candidates = [];
|
|
33968
|
-
if (typeof projectRoot === "string" &&
|
|
34130
|
+
if (typeof projectRoot === "string" && path13.isAbsolute(projectRoot)) {
|
|
33969
34131
|
candidates.push(projectRoot, ...e2eDirsFor(projectRoot));
|
|
33970
34132
|
}
|
|
33971
|
-
candidates.push(
|
|
34133
|
+
candidates.push(path13.dirname(rootPath), path13.dirname(rootCanonical));
|
|
33972
34134
|
for (const file2 of [rootPath, rootCanonical]) {
|
|
33973
34135
|
const project = savedFlowProject(file2);
|
|
33974
34136
|
if (project !== null) candidates.push(project);
|
|
@@ -33981,11 +34143,11 @@ async function closureRoots(rootPath, rootCanonical, projectRoot) {
|
|
|
33981
34143
|
return real.filter((root) => !real.some((other) => other !== root && isWithin(root, other)));
|
|
33982
34144
|
}
|
|
33983
34145
|
async function readFlowMember(anchorDir, target, roots, budget, opts) {
|
|
33984
|
-
const spelled = anchorDir +
|
|
34146
|
+
const spelled = anchorDir + path13.sep + target;
|
|
33985
34147
|
const { canonical, fence, missing, error: error63 } = await landing(spelled);
|
|
33986
34148
|
const spelling = await classifyOnDiskSpelling(
|
|
33987
|
-
|
|
33988
|
-
|
|
34149
|
+
path13.dirname(spelled),
|
|
34150
|
+
path13.posix.basename(target),
|
|
33989
34151
|
FLOW_FILE_NAME_PATTERN
|
|
33990
34152
|
);
|
|
33991
34153
|
const member = {
|
|
@@ -34010,7 +34172,7 @@ async function readFlowMember(anchorDir, target, roots, budget, opts) {
|
|
|
34010
34172
|
return { member: { ...member, state: "missing" }, sent: "missing" };
|
|
34011
34173
|
}
|
|
34012
34174
|
if (st.isDirectory()) return refuse("EISDIR: illegal operation on a directory, read");
|
|
34013
|
-
if (!/\.ya?ml$/i.test(
|
|
34175
|
+
if (!/\.ya?ml$/i.test(path13.basename(canonical))) {
|
|
34014
34176
|
return refuse(`${target} links to a file that is not a YAML file`);
|
|
34015
34177
|
}
|
|
34016
34178
|
const sent = await sendBytes(member, canonical, budget, opts);
|
|
@@ -34136,12 +34298,12 @@ function memberCollector(roots, opts) {
|
|
|
34136
34298
|
}
|
|
34137
34299
|
async function savedTest(target) {
|
|
34138
34300
|
for (const candidate of target.paths) {
|
|
34139
|
-
const found = await flow(
|
|
34301
|
+
const found = await flow(path13.dirname(candidate), path13.basename(candidate), true);
|
|
34140
34302
|
if (found !== void 0) return found;
|
|
34141
34303
|
}
|
|
34142
34304
|
let first;
|
|
34143
34305
|
for (const candidate of target.paths) {
|
|
34144
|
-
first ??= await flow(
|
|
34306
|
+
first ??= await flow(path13.dirname(candidate), path13.basename(candidate));
|
|
34145
34307
|
}
|
|
34146
34308
|
return first;
|
|
34147
34309
|
}
|
|
@@ -34151,9 +34313,9 @@ function memberCollector(roots, opts) {
|
|
|
34151
34313
|
return { canonical: member.canonical, text: text2, flowName: target.name, hop, updates, platform };
|
|
34152
34314
|
}
|
|
34153
34315
|
async function pathRun(target, hop, updates, platform) {
|
|
34154
|
-
const { member, text: text2 } = await flow(
|
|
34316
|
+
const { member, text: text2 } = await flow(path13.dirname(target.path), path13.basename(target.path));
|
|
34155
34317
|
if (text2 === void 0 || hop >= MAX_RUN_DEPTH) return void 0;
|
|
34156
|
-
const flowName =
|
|
34318
|
+
const flowName = path13.basename(target.path, ".yaml");
|
|
34157
34319
|
return { canonical: member.canonical, text: text2, flowName, hop, updates, platform };
|
|
34158
34320
|
}
|
|
34159
34321
|
async function runTarget(anchorDir, target) {
|
|
@@ -34184,7 +34346,7 @@ function memberCollector(roots, opts) {
|
|
|
34184
34346
|
const requests = collectFlowRequests(doc);
|
|
34185
34347
|
for (const name of requests.snapshots) snapshots.add(name);
|
|
34186
34348
|
for (const step of requests.toolSteps) await toolFiles(step);
|
|
34187
|
-
const anchorDir =
|
|
34349
|
+
const anchorDir = path13.dirname(file2.canonical);
|
|
34188
34350
|
for (const target of requests.runTargets) {
|
|
34189
34351
|
const key = flowMemberKey(anchorDir, target);
|
|
34190
34352
|
if (visited.has(key)) continue;
|
|
@@ -34201,8 +34363,8 @@ function memberCollector(roots, opts) {
|
|
|
34201
34363
|
}
|
|
34202
34364
|
}
|
|
34203
34365
|
if (snapshots.size === 0) continue;
|
|
34204
|
-
const dir =
|
|
34205
|
-
|
|
34366
|
+
const dir = path13.join(
|
|
34367
|
+
path13.dirname(run2.canonical),
|
|
34206
34368
|
"__baselines__",
|
|
34207
34369
|
baselineKeyFor(run2.canonical, run2.flowName)
|
|
34208
34370
|
);
|
|
@@ -34227,7 +34389,7 @@ function memberCollector(roots, opts) {
|
|
|
34227
34389
|
if (!name.endsWith(".png")) continue;
|
|
34228
34390
|
const compared = [...prefixes].some((prefix) => name.startsWith(prefix));
|
|
34229
34391
|
if (!updates && !compared) continue;
|
|
34230
|
-
const file2 =
|
|
34392
|
+
const file2 = path13.join(dir, name);
|
|
34231
34393
|
if (tools2.has(file2)) continue;
|
|
34232
34394
|
const member = { role: "baseline", key: file2, path: file2 };
|
|
34233
34395
|
const entry = await baselineEntry(file2, roots, updates && !compared);
|
|
@@ -34250,19 +34412,19 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
|
|
|
34250
34412
|
if (!namesValidFlow(args)) return {};
|
|
34251
34413
|
const canonical = await canonicalFlowPath(rootPath);
|
|
34252
34414
|
const spelling = await classifyOnDiskSpelling(
|
|
34253
|
-
|
|
34254
|
-
|
|
34415
|
+
path13.dirname(rootPath),
|
|
34416
|
+
path13.basename(rootPath),
|
|
34255
34417
|
FLOW_FILE_NAME_PATTERN
|
|
34256
34418
|
);
|
|
34257
34419
|
const collector = memberCollector(
|
|
34258
|
-
opts.scanOnly ? [
|
|
34420
|
+
opts.scanOnly ? [path13.parse(path13.resolve(rootPath)).root] : await closureRoots(rootPath, canonical, args.project_root),
|
|
34259
34421
|
opts
|
|
34260
34422
|
);
|
|
34261
34423
|
await collector.walk([
|
|
34262
34424
|
{
|
|
34263
34425
|
canonical,
|
|
34264
34426
|
text: rootBytes.toString("utf8"),
|
|
34265
|
-
flowName:
|
|
34427
|
+
flowName: path13.basename(rootPath, ".yaml"),
|
|
34266
34428
|
hop: 0,
|
|
34267
34429
|
updates: args.updateBaselines === true,
|
|
34268
34430
|
platform: callPlatform(args)
|
|
@@ -34291,31 +34453,31 @@ async function collectStepMembers(args, opts, recordingDirFor = e2eDirFor) {
|
|
|
34291
34453
|
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || !isResolvedAbsolute2(projectRoot) || step === void 0) {
|
|
34292
34454
|
return [];
|
|
34293
34455
|
}
|
|
34294
|
-
const recording =
|
|
34456
|
+
const recording = path13.join(recordingDirFor(projectRoot), `${name}.yaml`);
|
|
34295
34457
|
const collector = memberCollector(
|
|
34296
|
-
opts.scanOnly ? [
|
|
34458
|
+
opts.scanOnly ? [path13.parse(recording).root] : await closureRoots(recording, (await landing(recording)).canonical, projectRoot),
|
|
34297
34459
|
opts
|
|
34298
34460
|
);
|
|
34299
34461
|
await collector.toolFiles(step);
|
|
34300
34462
|
if (canonicalToolId(step.tool) === "e2e-execute") {
|
|
34301
|
-
const self2 = await collector.flow(
|
|
34463
|
+
const self2 = await collector.flow(path13.dirname(recording), path13.basename(recording));
|
|
34302
34464
|
let runArgs = step.args;
|
|
34303
34465
|
const named = nestedFlowTarget(runArgs);
|
|
34304
34466
|
if (named?.kind === "e2e_test_path") {
|
|
34305
|
-
const stem =
|
|
34306
|
-
const base =
|
|
34307
|
-
const dir =
|
|
34308
|
-
const recordingDir =
|
|
34467
|
+
const stem = path13.basename(named.path, ".yaml");
|
|
34468
|
+
const base = path13.basename(named.path);
|
|
34469
|
+
const dir = path13.resolve(path13.dirname(named.path));
|
|
34470
|
+
const recordingDir = path13.dirname(recording);
|
|
34309
34471
|
const dirs = [recordingDir, ...e2eRunFallbackDirs(recordingDir, base)];
|
|
34310
|
-
if (dirs.some((d) =>
|
|
34311
|
-
await collector.flow(
|
|
34472
|
+
if (dirs.some((d) => path13.resolve(d) === dir)) {
|
|
34473
|
+
await collector.flow(path13.dirname(named.path), base);
|
|
34312
34474
|
runArgs = { ...runArgs, name: stem };
|
|
34313
34475
|
delete runArgs.e2e_test_path;
|
|
34314
34476
|
}
|
|
34315
34477
|
}
|
|
34316
34478
|
const target = nestedFlowTarget(runArgs);
|
|
34317
34479
|
if (target?.kind === "name") {
|
|
34318
|
-
await collector.flow(
|
|
34480
|
+
await collector.flow(path13.dirname(self2.member.canonical), `${target.name}.yaml`);
|
|
34319
34481
|
const run2 = await collector.nestedRun(
|
|
34320
34482
|
target,
|
|
34321
34483
|
0,
|
|
@@ -34509,10 +34671,10 @@ function assertFiniteNumbers(args) {
|
|
|
34509
34671
|
if (typeof item === "object" && item !== null) {
|
|
34510
34672
|
pending.push({ value: item, key, parent: visit3 });
|
|
34511
34673
|
} else if (typeof item === "number" && !Number.isFinite(item)) {
|
|
34512
|
-
const
|
|
34513
|
-
for (let at = visit3; at.parent; at = at.parent)
|
|
34514
|
-
|
|
34515
|
-
issues.push({ code: "invalid_type", path:
|
|
34674
|
+
const path48 = [key];
|
|
34675
|
+
for (let at = visit3; at.parent; at = at.parent) path48.push(at.key);
|
|
34676
|
+
path48.reverse();
|
|
34677
|
+
issues.push({ code: "invalid_type", path: path48, message: `expected a number, got ${item}` });
|
|
34516
34678
|
if (issues.length === MAX_NON_FINITE_ISSUES) break;
|
|
34517
34679
|
}
|
|
34518
34680
|
}
|
|
@@ -34621,8 +34783,8 @@ var RECORDING_TOOLS = /* @__PURE__ */ new Set([
|
|
|
34621
34783
|
]);
|
|
34622
34784
|
var RECORDING_FILE_INPUT = {
|
|
34623
34785
|
target: "__recording",
|
|
34624
|
-
path: `\${project_root}/${E2E_DIRS[0].split(
|
|
34625
|
-
paths: E2E_DIRS.map((dir) => `\${project_root}/${dir.split(
|
|
34786
|
+
path: `\${project_root}/${E2E_DIRS[0].split(path14.sep).join("/")}/\${name}.yaml`,
|
|
34787
|
+
paths: E2E_DIRS.map((dir) => `\${project_root}/${dir.split(path14.sep).join("/")}/\${name}.yaml`),
|
|
34626
34788
|
kind: "file",
|
|
34627
34789
|
optional: true,
|
|
34628
34790
|
collect: "flow"
|
|
@@ -34671,6 +34833,7 @@ function failedRun(result) {
|
|
|
34671
34833
|
}
|
|
34672
34834
|
function createToolsClient(options = {}) {
|
|
34673
34835
|
let cached3 = null;
|
|
34836
|
+
let linkedNoticeShown = false;
|
|
34674
34837
|
const doFetch = options.fetchImpl ?? ((url2, init3) => fetch(url2, init3));
|
|
34675
34838
|
const diagnose = options.onDiagnostic ?? ((message) => void process.stderr.write(`${message}
|
|
34676
34839
|
`));
|
|
@@ -34679,6 +34842,11 @@ function createToolsClient(options = {}) {
|
|
|
34679
34842
|
assertPrivateArgentHome();
|
|
34680
34843
|
const resolved = await getResolvedToolsUrl();
|
|
34681
34844
|
if (resolved.url) {
|
|
34845
|
+
if (!linkedNoticeShown) {
|
|
34846
|
+
linkedNoticeShown = true;
|
|
34847
|
+
const notice = linkedCloudCredentialNotice();
|
|
34848
|
+
if (notice) diagnose(notice);
|
|
34849
|
+
}
|
|
34682
34850
|
return { url: resolved.url, token: resolved.token ?? "", remote: true };
|
|
34683
34851
|
}
|
|
34684
34852
|
if (!cached3) {
|
|
@@ -34733,7 +34901,7 @@ function createToolsClient(options = {}) {
|
|
|
34733
34901
|
let unwrittenBaselines2 = [];
|
|
34734
34902
|
const memberOptions = {
|
|
34735
34903
|
collectMembers: collectFlowMembers,
|
|
34736
|
-
collectStepMembers: olderServer ? (record2, o) => collectStepMembers(record2, o, (root) =>
|
|
34904
|
+
collectStepMembers: olderServer ? (record2, o) => collectStepMembers(record2, o, (root) => path14.join(root, LEGACY_E2E_DIRS[0])) : collectStepMembers,
|
|
34737
34905
|
toolFileInputs: (tool) => findTool(tools2, tool)?.fileInputs,
|
|
34738
34906
|
signal: opts?.signal
|
|
34739
34907
|
};
|
|
@@ -34766,7 +34934,7 @@ function createToolsClient(options = {}) {
|
|
|
34766
34934
|
}
|
|
34767
34935
|
if (filesLogEnabled()) {
|
|
34768
34936
|
for (const file2 of applied.written) {
|
|
34769
|
-
if (baselineDirs.includes(
|
|
34937
|
+
if (baselineDirs.includes(path14.dirname(file2))) {
|
|
34770
34938
|
diagnose(`[e2e-files] baseline ${file2}: written`);
|
|
34771
34939
|
}
|
|
34772
34940
|
}
|
|
@@ -34915,7 +35083,7 @@ import {
|
|
|
34915
35083
|
} from "node:fs/promises";
|
|
34916
35084
|
import { constants as fsConstants } from "node:fs";
|
|
34917
35085
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
34918
|
-
import { basename as basename7, extname as extname2, isAbsolute as isAbsolute6, join as
|
|
35086
|
+
import { basename as basename7, extname as extname2, isAbsolute as isAbsolute6, join as join15, normalize as normalize2, resolve as resolve11, sep as sep6 } from "node:path";
|
|
34919
35087
|
import { createHash as createHash3 } from "node:crypto";
|
|
34920
35088
|
var ARTIFACT_MARKER2 = "__argentArtifact";
|
|
34921
35089
|
function isArtifactHandle(value) {
|
|
@@ -34939,12 +35107,12 @@ function projectSlug() {
|
|
|
34939
35107
|
return `${name}-${hash2}`;
|
|
34940
35108
|
}
|
|
34941
35109
|
function artifactsRoot() {
|
|
34942
|
-
return process.env.ARGENT_ARTIFACTS_DIR ??
|
|
35110
|
+
return process.env.ARGENT_ARTIFACTS_DIR ?? join15(tmpdir2(), "argent-artifacts");
|
|
34943
35111
|
}
|
|
34944
35112
|
function artifactDir(deviceId) {
|
|
34945
35113
|
const parts = [artifactsRoot(), projectSlug(), sessionId()];
|
|
34946
35114
|
if (deviceId) parts.push(sanitizeSegment(deviceId));
|
|
34947
|
-
return
|
|
35115
|
+
return join15(...parts);
|
|
34948
35116
|
}
|
|
34949
35117
|
function durableBaseDir() {
|
|
34950
35118
|
const projectRoot = findProjectRoot(process.cwd());
|
|
@@ -34963,7 +35131,7 @@ function configuredRecordingsDir() {
|
|
|
34963
35131
|
const trimmed = value.trim();
|
|
34964
35132
|
if (trimmed === "") return null;
|
|
34965
35133
|
const home2 = resolveHomeDir();
|
|
34966
|
-
const expanded = trimmed === "~" ? home2 : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep6}`) ?
|
|
35134
|
+
const expanded = trimmed === "~" ? home2 : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep6}`) ? join15(home2, trimmed.slice(2)) : trimmed;
|
|
34967
35135
|
return resolve11(durableBaseDir(), expanded);
|
|
34968
35136
|
}
|
|
34969
35137
|
var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
|
|
@@ -34997,10 +35165,10 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
34997
35165
|
const stem = filename.slice(0, filename.length - ext.length);
|
|
34998
35166
|
for (let i2 = 1; i2 <= 1e3; i2++) {
|
|
34999
35167
|
const candidate = i2 === 1 ? filename : `${stem} (${i2})${ext}`;
|
|
35000
|
-
const
|
|
35168
|
+
const path48 = join15(dir, candidate);
|
|
35001
35169
|
try {
|
|
35002
|
-
await write(
|
|
35003
|
-
return
|
|
35170
|
+
await write(path48);
|
|
35171
|
+
return path48;
|
|
35004
35172
|
} catch (err) {
|
|
35005
35173
|
if (err?.code === "EEXIST") continue;
|
|
35006
35174
|
throw err;
|
|
@@ -35020,21 +35188,21 @@ function durableSaveTarget(handle) {
|
|
|
35020
35188
|
if (configured) {
|
|
35021
35189
|
return {
|
|
35022
35190
|
dir: configured,
|
|
35023
|
-
path:
|
|
35191
|
+
path: join15(configured, sanitizeSegment(handle.filename)),
|
|
35024
35192
|
base: configured,
|
|
35025
35193
|
rel: ""
|
|
35026
35194
|
};
|
|
35027
35195
|
}
|
|
35028
35196
|
}
|
|
35029
35197
|
const base = durableBaseDir();
|
|
35030
|
-
const dir =
|
|
35031
|
-
return { dir, path:
|
|
35198
|
+
const dir = join15(base, rel);
|
|
35199
|
+
return { dir, path: join15(dir, sanitizeSegment(handle.filename)), base, rel };
|
|
35032
35200
|
}
|
|
35033
35201
|
async function confineToRealBase(dir, base, rel) {
|
|
35034
35202
|
try {
|
|
35035
35203
|
const realDir = await realpath4(dir);
|
|
35036
35204
|
const realBase = await realpath4(base);
|
|
35037
|
-
return realDir ===
|
|
35205
|
+
return realDir === join15(realBase, rel);
|
|
35038
35206
|
} catch {
|
|
35039
35207
|
return false;
|
|
35040
35208
|
}
|
|
@@ -35058,9 +35226,9 @@ async function resolveLocalFile(handle) {
|
|
|
35058
35226
|
}
|
|
35059
35227
|
async function downloadAndExtractArchive(handle, data, dir, signal) {
|
|
35060
35228
|
signal?.throwIfAborted();
|
|
35061
|
-
const attemptDir = await mkdtemp(
|
|
35062
|
-
const tarball =
|
|
35063
|
-
const extractDir =
|
|
35229
|
+
const attemptDir = await mkdtemp(join15(dir, "bundle-"));
|
|
35230
|
+
const tarball = join15(attemptDir, "download.tar");
|
|
35231
|
+
const extractDir = join15(attemptDir, "files");
|
|
35064
35232
|
try {
|
|
35065
35233
|
await writeFile3(tarball, data, { signal });
|
|
35066
35234
|
await mkdir3(extractDir);
|
|
@@ -35160,7 +35328,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
35160
35328
|
return await downloadAndExtractArchive(value, data, dir, ctx.signal);
|
|
35161
35329
|
}
|
|
35162
35330
|
if (value.size > 0 && data.length !== value.size) return null;
|
|
35163
|
-
const downloadedPath =
|
|
35331
|
+
const downloadedPath = join15(dir, sanitizeSegment(value.filename));
|
|
35164
35332
|
await writeFile3(downloadedPath, data);
|
|
35165
35333
|
if (value.mimeType.startsWith("image/")) {
|
|
35166
35334
|
images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
|
|
@@ -37615,8 +37783,8 @@ function getSharedConfigurationFromEnvironment(signalIdentifier) {
|
|
|
37615
37783
|
init_esm();
|
|
37616
37784
|
|
|
37617
37785
|
// ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-node-http-env-configuration.js
|
|
37618
|
-
import * as
|
|
37619
|
-
import * as
|
|
37786
|
+
import * as fs10 from "fs";
|
|
37787
|
+
import * as path15 from "path";
|
|
37620
37788
|
init_esm();
|
|
37621
37789
|
function getStaticHeadersFromEnv(signalIdentifier) {
|
|
37622
37790
|
const signalSpecificRawHeaders = getStringFromEnv(`OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`);
|
|
@@ -37637,7 +37805,7 @@ function appendRootPathToUrlIfNeeded(url2) {
|
|
|
37637
37805
|
return void 0;
|
|
37638
37806
|
}
|
|
37639
37807
|
}
|
|
37640
|
-
function appendResourcePathToUrl(url2,
|
|
37808
|
+
function appendResourcePathToUrl(url2, path48) {
|
|
37641
37809
|
try {
|
|
37642
37810
|
new URL(url2);
|
|
37643
37811
|
} catch {
|
|
@@ -37647,11 +37815,11 @@ function appendResourcePathToUrl(url2, path47) {
|
|
|
37647
37815
|
if (!url2.endsWith("/")) {
|
|
37648
37816
|
url2 = url2 + "/";
|
|
37649
37817
|
}
|
|
37650
|
-
url2 +=
|
|
37818
|
+
url2 += path48;
|
|
37651
37819
|
try {
|
|
37652
37820
|
new URL(url2);
|
|
37653
37821
|
} catch {
|
|
37654
|
-
diag2.warn(`Configuration: Provided URL appended with '${
|
|
37822
|
+
diag2.warn(`Configuration: Provided URL appended with '${path48}' is not a valid URL, using 'undefined' instead of '${url2}'`);
|
|
37655
37823
|
return void 0;
|
|
37656
37824
|
}
|
|
37657
37825
|
return url2;
|
|
@@ -37676,7 +37844,7 @@ function readFileFromEnv(signalSpecificEnvVar, nonSignalSpecificEnvVar, warningM
|
|
|
37676
37844
|
const filePath = signalSpecificPath ?? nonSignalSpecificPath;
|
|
37677
37845
|
if (filePath != null) {
|
|
37678
37846
|
try {
|
|
37679
|
-
return
|
|
37847
|
+
return fs10.readFileSync(path15.resolve(process.cwd(), filePath));
|
|
37680
37848
|
} catch {
|
|
37681
37849
|
diag2.warn(warningMessage);
|
|
37682
37850
|
return void 0;
|
|
@@ -37762,15 +37930,15 @@ var OTLPLogExporter = class extends OTLPExporterBase {
|
|
|
37762
37930
|
init_esm();
|
|
37763
37931
|
|
|
37764
37932
|
// ../telemetry/src/debug.ts
|
|
37765
|
-
import * as
|
|
37933
|
+
import * as fs11 from "node:fs";
|
|
37766
37934
|
|
|
37767
37935
|
// ../telemetry/src/paths.ts
|
|
37768
|
-
import * as
|
|
37936
|
+
import * as path16 from "node:path";
|
|
37769
37937
|
function identityFilePath() {
|
|
37770
|
-
return
|
|
37938
|
+
return path16.join(argentHomeDir(), "telemetry-id");
|
|
37771
37939
|
}
|
|
37772
37940
|
function debugLogPath() {
|
|
37773
|
-
return
|
|
37941
|
+
return path16.join(argentHomeDir(), "telemetry-debug.log");
|
|
37774
37942
|
}
|
|
37775
37943
|
|
|
37776
37944
|
// ../telemetry/src/debug.ts
|
|
@@ -37800,8 +37968,8 @@ function emitDebugPayload(payload) {
|
|
|
37800
37968
|
} catch {
|
|
37801
37969
|
}
|
|
37802
37970
|
try {
|
|
37803
|
-
|
|
37804
|
-
|
|
37971
|
+
fs11.mkdirSync(argentHomeDir(), { recursive: true });
|
|
37972
|
+
fs11.appendFileSync(debugLogPath(), line + "\n");
|
|
37805
37973
|
} catch {
|
|
37806
37974
|
}
|
|
37807
37975
|
}
|
|
@@ -38314,9 +38482,9 @@ function isReplitAgent(env) {
|
|
|
38314
38482
|
}
|
|
38315
38483
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
38316
38484
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
38317
|
-
function safeExists(fileExists,
|
|
38485
|
+
function safeExists(fileExists, path48) {
|
|
38318
38486
|
try {
|
|
38319
|
-
return fileExists(
|
|
38487
|
+
return fileExists(path48);
|
|
38320
38488
|
} catch {
|
|
38321
38489
|
return false;
|
|
38322
38490
|
}
|
|
@@ -38736,7 +38904,7 @@ function isCi(env = process.env) {
|
|
|
38736
38904
|
var SESSION_ID2 = randomUUID5();
|
|
38737
38905
|
function readCliVersion() {
|
|
38738
38906
|
if (true) {
|
|
38739
|
-
return "0.35.1-next.
|
|
38907
|
+
return "0.35.1-next.68";
|
|
38740
38908
|
}
|
|
38741
38909
|
return "0.0.0";
|
|
38742
38910
|
}
|
|
@@ -38769,8 +38937,8 @@ function getBaseProps(runtime) {
|
|
|
38769
38937
|
|
|
38770
38938
|
// ../telemetry/src/identity.ts
|
|
38771
38939
|
import * as crypto2 from "node:crypto";
|
|
38772
|
-
import * as
|
|
38773
|
-
import * as
|
|
38940
|
+
import * as fs12 from "node:fs";
|
|
38941
|
+
import * as path17 from "node:path";
|
|
38774
38942
|
var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
|
|
38775
38943
|
var cached2 = null;
|
|
38776
38944
|
var fingerprintResolved = null;
|
|
@@ -38866,66 +39034,66 @@ function resolveFingerprintOnce(resolveFingerprint) {
|
|
|
38866
39034
|
function isCorruptIdFile(filePath) {
|
|
38867
39035
|
let isRegularFile;
|
|
38868
39036
|
try {
|
|
38869
|
-
isRegularFile =
|
|
39037
|
+
isRegularFile = fs12.lstatSync(filePath).isFile();
|
|
38870
39038
|
} catch {
|
|
38871
39039
|
return false;
|
|
38872
39040
|
}
|
|
38873
39041
|
return isRegularFile && tryReadId(filePath) === null;
|
|
38874
39042
|
}
|
|
38875
39043
|
function writeIdFileAtomic(finalPath, id) {
|
|
38876
|
-
|
|
39044
|
+
fs12.mkdirSync(argentHomeDir(), { recursive: true });
|
|
38877
39045
|
let occupant;
|
|
38878
39046
|
try {
|
|
38879
|
-
occupant =
|
|
39047
|
+
occupant = fs12.lstatSync(finalPath);
|
|
38880
39048
|
} catch (err) {
|
|
38881
39049
|
if (err.code !== "ENOENT") throw err;
|
|
38882
39050
|
}
|
|
38883
39051
|
if (occupant && !occupant.isFile()) {
|
|
38884
39052
|
throw new Error("telemetry: refusing to replace a non-regular file at the identity path");
|
|
38885
39053
|
}
|
|
38886
|
-
const tmpPath =
|
|
39054
|
+
const tmpPath = path17.join(
|
|
38887
39055
|
argentHomeDir(),
|
|
38888
39056
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
38889
39057
|
);
|
|
38890
|
-
const fd =
|
|
39058
|
+
const fd = fs12.openSync(tmpPath, "wx", 384);
|
|
38891
39059
|
try {
|
|
38892
39060
|
try {
|
|
38893
|
-
|
|
38894
|
-
|
|
39061
|
+
fs12.writeSync(fd, id);
|
|
39062
|
+
fs12.fsyncSync(fd);
|
|
38895
39063
|
} finally {
|
|
38896
|
-
|
|
39064
|
+
fs12.closeSync(fd);
|
|
38897
39065
|
}
|
|
38898
|
-
|
|
39066
|
+
fs12.renameSync(tmpPath, finalPath);
|
|
38899
39067
|
} finally {
|
|
38900
39068
|
try {
|
|
38901
|
-
|
|
39069
|
+
fs12.unlinkSync(tmpPath);
|
|
38902
39070
|
} catch {
|
|
38903
39071
|
}
|
|
38904
39072
|
}
|
|
38905
39073
|
}
|
|
38906
39074
|
function mintRandomId(finalPath) {
|
|
38907
|
-
|
|
39075
|
+
fs12.mkdirSync(argentHomeDir(), { recursive: true });
|
|
38908
39076
|
let value = crypto2.randomUUID();
|
|
38909
39077
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
38910
|
-
const tmpPath =
|
|
39078
|
+
const tmpPath = path17.join(
|
|
38911
39079
|
argentHomeDir(),
|
|
38912
39080
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
38913
39081
|
);
|
|
38914
39082
|
let fd;
|
|
38915
39083
|
try {
|
|
38916
|
-
fd =
|
|
39084
|
+
fd = fs12.openSync(tmpPath, "wx", 384);
|
|
38917
39085
|
} catch (err) {
|
|
38918
39086
|
if (err.code === "EEXIST") continue;
|
|
38919
39087
|
throw err;
|
|
38920
39088
|
}
|
|
38921
39089
|
try {
|
|
38922
39090
|
try {
|
|
38923
|
-
|
|
38924
|
-
|
|
39091
|
+
fs12.writeSync(fd, value);
|
|
39092
|
+
fs12.fsyncSync(fd);
|
|
38925
39093
|
} finally {
|
|
38926
|
-
|
|
39094
|
+
fs12.closeSync(fd);
|
|
38927
39095
|
}
|
|
38928
|
-
|
|
39096
|
+
fs12.linkSync(tmpPath, finalPath);
|
|
38929
39097
|
cached2 = { path: finalPath, id: value };
|
|
38930
39098
|
return value;
|
|
38931
39099
|
} catch (err) {
|
|
@@ -38944,7 +39112,7 @@ function mintRandomId(finalPath) {
|
|
|
38944
39112
|
throw err;
|
|
38945
39113
|
} finally {
|
|
38946
39114
|
try {
|
|
38947
|
-
|
|
39115
|
+
fs12.unlinkSync(tmpPath);
|
|
38948
39116
|
} catch {
|
|
38949
39117
|
}
|
|
38950
39118
|
}
|
|
@@ -38952,12 +39120,12 @@ function mintRandomId(finalPath) {
|
|
|
38952
39120
|
throw new Error("telemetry: failed to create identity after retries");
|
|
38953
39121
|
}
|
|
38954
39122
|
function claimCorruptOccupant(finalPath) {
|
|
38955
|
-
const claimed =
|
|
39123
|
+
const claimed = path17.join(
|
|
38956
39124
|
argentHomeDir(),
|
|
38957
39125
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
38958
39126
|
);
|
|
38959
39127
|
try {
|
|
38960
|
-
|
|
39128
|
+
fs12.renameSync(finalPath, claimed);
|
|
38961
39129
|
} catch {
|
|
38962
39130
|
return null;
|
|
38963
39131
|
}
|
|
@@ -38966,7 +39134,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
38966
39134
|
grabbed = tryReadId(claimed);
|
|
38967
39135
|
} finally {
|
|
38968
39136
|
try {
|
|
38969
|
-
|
|
39137
|
+
fs12.unlinkSync(claimed);
|
|
38970
39138
|
} catch {
|
|
38971
39139
|
}
|
|
38972
39140
|
}
|
|
@@ -38978,9 +39146,9 @@ function peekAnonId() {
|
|
|
38978
39146
|
function tryReadId(filePath) {
|
|
38979
39147
|
let raw;
|
|
38980
39148
|
try {
|
|
38981
|
-
const stats =
|
|
39149
|
+
const stats = fs12.lstatSync(filePath);
|
|
38982
39150
|
if (!stats.isFile()) return null;
|
|
38983
|
-
raw =
|
|
39151
|
+
raw = fs12.readFileSync(filePath, "utf8");
|
|
38984
39152
|
} catch (err) {
|
|
38985
39153
|
if (err.code === "ENOENT") return null;
|
|
38986
39154
|
return null;
|
|
@@ -38994,12 +39162,12 @@ function tryReadId(filePath) {
|
|
|
38994
39162
|
import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_process";
|
|
38995
39163
|
|
|
38996
39164
|
// ../native-devtools-ios/src/index.ts
|
|
38997
|
-
import * as
|
|
38998
|
-
import * as
|
|
38999
|
-
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ??
|
|
39000
|
-
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ??
|
|
39001
|
-
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ??
|
|
39002
|
-
var DYLIB_TVOS_DIR =
|
|
39165
|
+
import * as path18 from "node:path";
|
|
39166
|
+
import * as fs13 from "node:fs";
|
|
39167
|
+
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path18.join(__dirname, "..", "dylibs");
|
|
39168
|
+
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path18.join(__dirname, "..", "bin");
|
|
39169
|
+
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path18.join(DYLIB_DIR, "tcp");
|
|
39170
|
+
var DYLIB_TVOS_DIR = path18.join(DYLIB_DIR, "tvos");
|
|
39003
39171
|
function hostPlatformKey() {
|
|
39004
39172
|
if (process.platform === "linux" && process.arch === "arm64") {
|
|
39005
39173
|
return "linux-arm64";
|
|
@@ -39010,14 +39178,14 @@ function simulatorServerBinaryName() {
|
|
|
39010
39178
|
return process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
|
|
39011
39179
|
}
|
|
39012
39180
|
function platformBinDir() {
|
|
39013
|
-
return
|
|
39181
|
+
return path18.join(BIN_DIR, hostPlatformKey());
|
|
39014
39182
|
}
|
|
39015
39183
|
function simulatorServerBinaryPath() {
|
|
39016
39184
|
const binaryName = simulatorServerBinaryName();
|
|
39017
|
-
const p =
|
|
39018
|
-
if (!
|
|
39019
|
-
const flat =
|
|
39020
|
-
const migrationHint =
|
|
39185
|
+
const p = path18.join(platformBinDir(), binaryName);
|
|
39186
|
+
if (!fs13.existsSync(p)) {
|
|
39187
|
+
const flat = path18.join(BIN_DIR, binaryName);
|
|
39188
|
+
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.` : "";
|
|
39021
39189
|
throw new Error(
|
|
39022
39190
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
39023
39191
|
);
|
|
@@ -39097,15 +39265,15 @@ function resolveHostFingerprintAsync() {
|
|
|
39097
39265
|
}
|
|
39098
39266
|
|
|
39099
39267
|
// ../telemetry/src/consent.ts
|
|
39100
|
-
import * as
|
|
39101
|
-
import * as
|
|
39268
|
+
import * as fs14 from "node:fs";
|
|
39269
|
+
import * as path19 from "node:path";
|
|
39102
39270
|
var cache = /* @__PURE__ */ new Map();
|
|
39103
39271
|
var sessionOverride = null;
|
|
39104
39272
|
function readConfigOverrideAt(filePath) {
|
|
39105
39273
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
39106
39274
|
let stats;
|
|
39107
39275
|
try {
|
|
39108
|
-
stats =
|
|
39276
|
+
stats = fs14.lstatSync(filePath);
|
|
39109
39277
|
} catch {
|
|
39110
39278
|
cache.set(filePath, miss);
|
|
39111
39279
|
return null;
|
|
@@ -39122,7 +39290,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
39122
39290
|
}
|
|
39123
39291
|
let parsedEnabled = null;
|
|
39124
39292
|
try {
|
|
39125
|
-
const raw =
|
|
39293
|
+
const raw = fs14.readFileSync(filePath, "utf8");
|
|
39126
39294
|
const json2 = JSON.parse(raw);
|
|
39127
39295
|
if (json2 && typeof json2 === "object") {
|
|
39128
39296
|
const t2 = json2.telemetry;
|
|
@@ -39139,12 +39307,12 @@ function readConfigOverrideAt(filePath) {
|
|
|
39139
39307
|
function readPersistedConsent(cwd) {
|
|
39140
39308
|
const globalPath = configFilePath("global");
|
|
39141
39309
|
const projectPath = configFilePath("project", { cwd });
|
|
39142
|
-
const userConfigPath =
|
|
39310
|
+
const userConfigPath = path19.join(resolveHomeDir(), ".argent", "config.json");
|
|
39143
39311
|
if (userConfigPath !== globalPath && readConfigOverrideAt(userConfigPath) === false) {
|
|
39144
39312
|
return { enabled: false, detail: `${userConfigPath} (user)` };
|
|
39145
39313
|
}
|
|
39146
39314
|
const global2 = readConfigOverrideAt(globalPath);
|
|
39147
|
-
const projectRoot =
|
|
39315
|
+
const projectRoot = path19.dirname(path19.dirname(projectPath));
|
|
39148
39316
|
const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
|
|
39149
39317
|
if (project === false && global2 === false) {
|
|
39150
39318
|
return { enabled: false, detail: "config.json (project and global)" };
|
|
@@ -39690,7 +39858,7 @@ var import_yaml4 = __toESM(require_dist2(), 1);
|
|
|
39690
39858
|
import * as fsp2 from "node:fs/promises";
|
|
39691
39859
|
import { constants as fsConstants2 } from "node:fs";
|
|
39692
39860
|
import { createHash as createHash5 } from "node:crypto";
|
|
39693
|
-
import * as
|
|
39861
|
+
import * as path21 from "node:path";
|
|
39694
39862
|
|
|
39695
39863
|
// ../argent-cli/src/command-args.ts
|
|
39696
39864
|
var UsageError = class extends Error {
|
|
@@ -39770,7 +39938,7 @@ function parseCommandArgs(argv, specs) {
|
|
|
39770
39938
|
// ../argent-cli/src/e2e-suite.ts
|
|
39771
39939
|
var import_yaml3 = __toESM(require_dist2(), 1);
|
|
39772
39940
|
import * as fsp from "node:fs/promises";
|
|
39773
|
-
import * as
|
|
39941
|
+
import * as path20 from "node:path";
|
|
39774
39942
|
var SUITE_CONFIG_FILE = "suite.config.yaml";
|
|
39775
39943
|
var SuiteConfigError = class extends Error {
|
|
39776
39944
|
constructor(message) {
|
|
@@ -39837,7 +40005,7 @@ function parseSuiteConfig(text2) {
|
|
|
39837
40005
|
async function readSuiteConfig(dir) {
|
|
39838
40006
|
let text2;
|
|
39839
40007
|
try {
|
|
39840
|
-
text2 = await fsp.readFile(
|
|
40008
|
+
text2 = await fsp.readFile(path20.join(dir, SUITE_CONFIG_FILE), "utf8");
|
|
39841
40009
|
} catch (err) {
|
|
39842
40010
|
const code = err.code;
|
|
39843
40011
|
throw new SuiteConfigError(
|
|
@@ -39852,24 +40020,24 @@ function unlistedWarning(file2, manifest) {
|
|
|
39852
40020
|
async function planDirectoryRun(runDir, collected, manifests) {
|
|
39853
40021
|
const byDir = /* @__PURE__ */ new Map();
|
|
39854
40022
|
for (const rel of collected) {
|
|
39855
|
-
const dir =
|
|
40023
|
+
const dir = path20.dirname(rel);
|
|
39856
40024
|
const files = byDir.get(dir);
|
|
39857
40025
|
if (files) files.push(rel);
|
|
39858
40026
|
else byDir.set(dir, [rel]);
|
|
39859
40027
|
}
|
|
39860
|
-
const testless = manifests.filter((manifest) => !byDir.has(
|
|
40028
|
+
const testless = manifests.filter((manifest) => !byDir.has(path20.dirname(manifest)));
|
|
39861
40029
|
const suiteEntries = /* @__PURE__ */ new Map();
|
|
39862
40030
|
const unlisted = [];
|
|
39863
|
-
for (const dir of new Set(manifests.map((manifest) =>
|
|
40031
|
+
for (const dir of new Set(manifests.map((manifest) => path20.dirname(manifest)))) {
|
|
39864
40032
|
const files = byDir.get(dir) ?? [];
|
|
39865
|
-
const manifest =
|
|
40033
|
+
const manifest = path20.join(dir, SUITE_CONFIG_FILE);
|
|
39866
40034
|
let config3;
|
|
39867
40035
|
let ordered = files;
|
|
39868
40036
|
try {
|
|
39869
|
-
config3 = await readSuiteConfig(
|
|
40037
|
+
config3 = await readSuiteConfig(path20.join(runDir, dir));
|
|
39870
40038
|
if (config3.tests) {
|
|
39871
40039
|
ordered = config3.tests.map((name) => {
|
|
39872
|
-
const file2 = files.find((f) =>
|
|
40040
|
+
const file2 = files.find((f) => path20.basename(f, ".yaml") === name);
|
|
39873
40041
|
if (file2 === void 0) {
|
|
39874
40042
|
throw new SuiteConfigError(
|
|
39875
40043
|
`tests entry ${JSON.stringify(name)} names no e2e test in this directory`
|
|
@@ -39903,7 +40071,7 @@ async function planDirectoryRun(runDir, collected, manifests) {
|
|
|
39903
40071
|
}
|
|
39904
40072
|
const entries = [];
|
|
39905
40073
|
for (const rel of [...collected, ...testless].sort()) {
|
|
39906
|
-
const dir =
|
|
40074
|
+
const dir = path20.dirname(rel);
|
|
39907
40075
|
const inSuite = suiteEntries.get(dir);
|
|
39908
40076
|
if (inSuite === void 0) entries.push({ kind: "test", path: rel });
|
|
39909
40077
|
else if ((byDir.get(dir)?.[0] ?? rel) === rel) entries.push(...inSuite);
|
|
@@ -40133,7 +40301,7 @@ function parseRunArgs(argv) {
|
|
|
40133
40301
|
if (options.output !== void 0) out.output = options.output;
|
|
40134
40302
|
if (options.var !== void 0) out.vars = parseVarFlags(options.var);
|
|
40135
40303
|
if (options["secrets-file"] !== void 0) {
|
|
40136
|
-
out.secretsFile =
|
|
40304
|
+
out.secretsFile = path21.resolve(options["secrets-file"]);
|
|
40137
40305
|
}
|
|
40138
40306
|
if (out.json && out.jsonStream) {
|
|
40139
40307
|
throw new FlagParseException("--json and --json-stream cannot be combined");
|
|
@@ -40305,20 +40473,20 @@ function shellQuoteArg(arg) {
|
|
|
40305
40473
|
return `'${arg.replaceAll("'", "'\\''")}'`;
|
|
40306
40474
|
}
|
|
40307
40475
|
function optionSafePath(p) {
|
|
40308
|
-
return p.startsWith("-") ? `.${
|
|
40476
|
+
return p.startsWith("-") ? `.${path21.sep}${p}` : p;
|
|
40309
40477
|
}
|
|
40310
40478
|
function rerunCommand(flowPath, rel, projectRoot, args) {
|
|
40311
40479
|
const pathArg = (p) => shellQuoteArg(optionSafePath(p));
|
|
40312
|
-
const fromCwd =
|
|
40313
|
-
const shown =
|
|
40480
|
+
const fromCwd = path21.relative(projectRoot, flowPath) || ".";
|
|
40481
|
+
const shown = path21.isAbsolute(fromCwd) || fromCwd.split(/[\\/]+/).includes("..") ? flowPath : fromCwd;
|
|
40314
40482
|
const parts = [
|
|
40315
40483
|
"argent e2e run",
|
|
40316
|
-
pathArg(SAFE_FLOW_NAME.test(shown) ? `.${
|
|
40484
|
+
pathArg(SAFE_FLOW_NAME.test(shown) ? `.${path21.sep}${shown}` : shown)
|
|
40317
40485
|
];
|
|
40318
40486
|
if (args.device) parts.push("--device", shellQuoteArg(args.device));
|
|
40319
40487
|
if (args.platform) parts.push("--platform", shellQuoteArg(args.platform));
|
|
40320
40488
|
if (args.updateBaselines) parts.push("--update-baselines");
|
|
40321
|
-
if (args.output) parts.push("--output", pathArg(
|
|
40489
|
+
if (args.output) parts.push("--output", pathArg(path21.join(args.output, path21.dirname(rel))));
|
|
40322
40490
|
for (const [name, value] of Object.entries(args.vars ?? {})) {
|
|
40323
40491
|
parts.push("--var", shellQuoteArg(`${name}=${value}`));
|
|
40324
40492
|
}
|
|
@@ -40330,8 +40498,8 @@ var LEGACY_EXPORT_SOURCE_MARKER = ".argent-flow-source";
|
|
|
40330
40498
|
var MARKER_READ_RETRIES = 4;
|
|
40331
40499
|
var MARKER_READ_DELAY_MS = 5;
|
|
40332
40500
|
async function readExportMarker(dir) {
|
|
40333
|
-
const owner = await readMarkerFile(
|
|
40334
|
-
return owner !== void 0 ? owner : await readMarkerFile(
|
|
40501
|
+
const owner = await readMarkerFile(path21.join(dir, EXPORT_SOURCE_MARKER));
|
|
40502
|
+
return owner !== void 0 ? owner : await readMarkerFile(path21.join(dir, LEGACY_EXPORT_SOURCE_MARKER));
|
|
40335
40503
|
}
|
|
40336
40504
|
async function readMarkerFile(marker) {
|
|
40337
40505
|
for (let attempt = 0; ; attempt++) {
|
|
@@ -40368,7 +40536,7 @@ function occupiedBy(owner) {
|
|
|
40368
40536
|
async function takeExportDir(dir, flowPath) {
|
|
40369
40537
|
try {
|
|
40370
40538
|
await fsp2.mkdir(dir, { recursive: true });
|
|
40371
|
-
await fsp2.writeFile(
|
|
40539
|
+
await fsp2.writeFile(path21.join(dir, EXPORT_SOURCE_MARKER), `${flowPath}
|
|
40372
40540
|
`, { flag: "wx" });
|
|
40373
40541
|
return null;
|
|
40374
40542
|
} catch (err) {
|
|
@@ -40387,7 +40555,7 @@ async function claimExportDirName(outputDir, flowPath, stem) {
|
|
|
40387
40555
|
}
|
|
40388
40556
|
const avoided = [];
|
|
40389
40557
|
for (const name of candidates) {
|
|
40390
|
-
const dir =
|
|
40558
|
+
const dir = path21.join(outputDir, name);
|
|
40391
40559
|
const claim2 = await classifyExportDir(dir, flowPath);
|
|
40392
40560
|
const reason = claim2.state === "foreign" ? occupiedBy(claim2.owner) : await takeExportDir(dir, flowPath);
|
|
40393
40561
|
if (reason !== null) {
|
|
@@ -40407,7 +40575,7 @@ async function claimExportDirName(outputDir, flowPath, stem) {
|
|
|
40407
40575
|
return null;
|
|
40408
40576
|
}
|
|
40409
40577
|
async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
40410
|
-
const stem =
|
|
40578
|
+
const stem = path21.basename(flowPath, ".yaml");
|
|
40411
40579
|
if (!SAFE_ARTIFACT_NAME.test(stem)) {
|
|
40412
40580
|
console.error(
|
|
40413
40581
|
`warning: skipping artifact export for unsafe e2e test filename ${JSON.stringify(stem)}`
|
|
@@ -40440,11 +40608,11 @@ async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
|
40440
40608
|
if (dir === null) {
|
|
40441
40609
|
const dirName = await claimExportDirName(outputDir, flowPath, stem);
|
|
40442
40610
|
if (dirName === null) return;
|
|
40443
|
-
dir =
|
|
40611
|
+
dir = path21.join(outputDir, dirName);
|
|
40444
40612
|
}
|
|
40445
|
-
const dest =
|
|
40446
|
-
const rel =
|
|
40447
|
-
if (rel.startsWith("..") ||
|
|
40613
|
+
const dest = path21.join(dir, fileName(role));
|
|
40614
|
+
const rel = path21.relative(outputDir, dest);
|
|
40615
|
+
if (rel.startsWith("..") || path21.isAbsolute(rel)) continue;
|
|
40448
40616
|
try {
|
|
40449
40617
|
await fsp2.copyFile(value, dest);
|
|
40450
40618
|
s.artifacts[role] = dest;
|
|
@@ -40459,7 +40627,7 @@ async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
|
40459
40627
|
function keyFromBaselinePath(artifacts) {
|
|
40460
40628
|
const baseline = artifacts.baseline;
|
|
40461
40629
|
if (typeof baseline !== "string") return null;
|
|
40462
|
-
return
|
|
40630
|
+
return path21.basename(baseline).replace(/\.png$/, "");
|
|
40463
40631
|
}
|
|
40464
40632
|
function resolveArtifactDisplayPaths(report) {
|
|
40465
40633
|
for (const s of report.steps) {
|
|
@@ -40544,26 +40712,26 @@ async function resolveFlowRef(ref, projectRoot) {
|
|
|
40544
40712
|
if (!SAFE_FLOW_NAME.test(ref)) return { suppliedPath: ref, fromName: false };
|
|
40545
40713
|
const picked = await resolveE2eFile(projectRoot, ref);
|
|
40546
40714
|
return {
|
|
40547
|
-
suppliedPath:
|
|
40715
|
+
suppliedPath: path21.relative(projectRoot, picked.path),
|
|
40548
40716
|
fromName: true,
|
|
40549
|
-
...picked.shadowed === void 0 ? {} : { shadowed:
|
|
40717
|
+
...picked.shadowed === void 0 ? {} : { shadowed: path21.relative(projectRoot, picked.shadowed) }
|
|
40550
40718
|
};
|
|
40551
40719
|
}
|
|
40552
40720
|
async function savedFlowHint(sub, projectRoot, missingPath) {
|
|
40553
|
-
const dirs = E2E_DIRS.map((rel) => ({ rel, abs:
|
|
40721
|
+
const dirs = E2E_DIRS.map((rel) => ({ rel, abs: path21.resolve(projectRoot, rel) }));
|
|
40554
40722
|
for (const { abs } of dirs) {
|
|
40555
|
-
const within =
|
|
40556
|
-
if (!within.startsWith("..") && !
|
|
40723
|
+
const within = path21.relative(abs, missingPath);
|
|
40724
|
+
if (!within.startsWith("..") && !path21.isAbsolute(within)) return "";
|
|
40557
40725
|
}
|
|
40558
|
-
const wanted = `${
|
|
40726
|
+
const wanted = `${path21.basename(missingPath, ".yaml")}.yaml`;
|
|
40559
40727
|
for (const { rel, abs } of dirs) {
|
|
40560
40728
|
const entries = await fsp2.readdir(abs).catch(() => null);
|
|
40561
40729
|
if (entries === null) continue;
|
|
40562
40730
|
const actual = entries.includes(wanted) ? wanted : entries.find((name2) => name2.toLowerCase() === wanted.toLowerCase());
|
|
40563
40731
|
if (actual === void 0) continue;
|
|
40564
|
-
const name =
|
|
40732
|
+
const name = path21.basename(actual, ".yaml");
|
|
40565
40733
|
if (!SAFE_FLOW_NAME.test(name)) return "";
|
|
40566
|
-
if (!await isRunnableFlowFile(
|
|
40734
|
+
if (!await isRunnableFlowFile(path21.join(abs, actual))) return "";
|
|
40567
40735
|
return `
|
|
40568
40736
|
An e2e test named "${name}" is saved under ${rel} \u2014 did you mean: argent e2e ${sub} ${name}`;
|
|
40569
40737
|
}
|
|
@@ -40573,10 +40741,10 @@ async function resolveE2eTarget(sub, ref, { suppliedPath, fromName }, projectRoo
|
|
|
40573
40741
|
const refuse = (message) => ({ kind: "refused", message });
|
|
40574
40742
|
if (suppliedPath.split(/[\\/]+/).includes("..")) {
|
|
40575
40743
|
let recovery = "Pass the fully resolved path to the e2e test's YAML.";
|
|
40576
|
-
const suppliedBase2 =
|
|
40744
|
+
const suppliedBase2 = path21.basename(suppliedPath);
|
|
40577
40745
|
if (suppliedBase2 !== ".." && suppliedBase2 !== ".") {
|
|
40578
40746
|
try {
|
|
40579
|
-
const resolved =
|
|
40747
|
+
const resolved = path21.join(await fsp2.realpath(path21.dirname(suppliedPath)), suppliedBase2);
|
|
40580
40748
|
await fsp2.stat(resolved);
|
|
40581
40749
|
recovery = `Did you mean: argent e2e ${sub} ${shellQuoteArg(resolved)}`;
|
|
40582
40750
|
} catch {
|
|
@@ -40587,7 +40755,7 @@ async function resolveE2eTarget(sub, ref, { suppliedPath, fromName }, projectRoo
|
|
|
40587
40755
|
` + recovery
|
|
40588
40756
|
);
|
|
40589
40757
|
}
|
|
40590
|
-
const resolvedPath =
|
|
40758
|
+
const resolvedPath = path21.resolve(projectRoot, suppliedPath);
|
|
40591
40759
|
let isDirectory = false;
|
|
40592
40760
|
try {
|
|
40593
40761
|
isDirectory = (await fsp2.stat(resolvedPath)).isDirectory();
|
|
@@ -40604,15 +40772,15 @@ async function resolveE2eTarget(sub, ref, { suppliedPath, fromName }, projectRoo
|
|
|
40604
40772
|
}
|
|
40605
40773
|
const separatorTrimmedPath = suppliedPath.replace(/[\\/]+$/, "");
|
|
40606
40774
|
if (separatorTrimmedPath !== suppliedPath && separatorTrimmedPath !== "") {
|
|
40607
|
-
const hint = SAFE_FLOW_NAME.test(separatorTrimmedPath) ? `.${
|
|
40775
|
+
const hint = SAFE_FLOW_NAME.test(separatorTrimmedPath) ? `.${path21.sep}${separatorTrimmedPath}` : separatorTrimmedPath;
|
|
40608
40776
|
return refuse(
|
|
40609
40777
|
`E2E test path must not end in a path separator \u2014 the separator claims a directory, which the kernel would refuse to open as a file, so the CLI would ${sub} a file this string does not name: ${suppliedPath}
|
|
40610
40778
|
Did you mean: argent e2e ${sub} ${shellQuoteArg(hint)}`
|
|
40611
40779
|
);
|
|
40612
40780
|
}
|
|
40613
|
-
if (
|
|
40614
|
-
const looksLikeName = !suppliedPath.includes("/") && !suppliedPath.includes("\\") &&
|
|
40615
|
-
if (
|
|
40781
|
+
if (path21.extname(suppliedPath) !== ".yaml") {
|
|
40782
|
+
const looksLikeName = !suppliedPath.includes("/") && !suppliedPath.includes("\\") && path21.extname(suppliedPath) === "";
|
|
40783
|
+
if (path21.basename(suppliedPath).toLowerCase() === ".yaml") {
|
|
40616
40784
|
return refuse(
|
|
40617
40785
|
`E2E test filename must have a non-empty name containing only letters, numbers, "_", or "-": ${suppliedPath}`
|
|
40618
40786
|
);
|
|
@@ -40623,14 +40791,14 @@ Did you mean: argent e2e ${sub} ${shellQuoteArg(hint)}`
|
|
|
40623
40791
|
Names ${sub} \`${E2E_DIRS.map((dir) => `${dir}/<name>.yaml`).join("` or `")}\`; pass a path ending in .yaml to ${sub} an e2e test file kept elsewhere.`
|
|
40624
40792
|
);
|
|
40625
40793
|
}
|
|
40626
|
-
if (
|
|
40794
|
+
if (path21.extname(suppliedPath).toLowerCase() === ".yaml") {
|
|
40627
40795
|
return refuse(
|
|
40628
|
-
`E2E test extension must be lowercase .yaml, not ${
|
|
40796
|
+
`E2E test extension must be lowercase .yaml, not ${path21.extname(suppliedPath)}: ${suppliedPath}`
|
|
40629
40797
|
);
|
|
40630
40798
|
}
|
|
40631
40799
|
return refuse(`E2E test path must end in .yaml: ${suppliedPath}`);
|
|
40632
40800
|
}
|
|
40633
|
-
const flowName =
|
|
40801
|
+
const flowName = path21.basename(suppliedPath, ".yaml");
|
|
40634
40802
|
if (!SAFE_FLOW_NAME.test(flowName)) {
|
|
40635
40803
|
return refuse(
|
|
40636
40804
|
`E2E test filename must have a non-empty name containing only letters, numbers, "_", or "-": ${suppliedPath}`
|
|
@@ -40653,12 +40821,12 @@ No e2e test named "${ref}" is saved in ${E2E_DIRS.join(" or ")} \u2014 run \`arg
|
|
|
40653
40821
|
}
|
|
40654
40822
|
return refuse(`${detail}: ${flowPath}${recovery}`);
|
|
40655
40823
|
}
|
|
40656
|
-
const suppliedBase =
|
|
40657
|
-
const siblings = await fsp2.readdir(
|
|
40824
|
+
const suppliedBase = path21.basename(flowPath);
|
|
40825
|
+
const siblings = await fsp2.readdir(path21.dirname(flowPath)).catch(() => null);
|
|
40658
40826
|
if (siblings !== null && !siblings.includes(suppliedBase)) {
|
|
40659
40827
|
const actual = siblings.find((name) => name.toLowerCase() === suppliedBase.toLowerCase());
|
|
40660
|
-
const actualRunnable = actual !== void 0 &&
|
|
40661
|
-
const recovery = actualRunnable ? fromName ? `Did you mean: argent e2e ${sub} ${
|
|
40828
|
+
const actualRunnable = actual !== void 0 && path21.extname(actual) === ".yaml" && SAFE_FLOW_NAME.test(path21.basename(actual, ".yaml"));
|
|
40829
|
+
const recovery = actualRunnable ? fromName ? `Did you mean: argent e2e ${sub} ${path21.basename(actual, ".yaml")}` : `Did you mean: argent e2e ${sub} ${shellQuoteArg(path21.join(path21.dirname(suppliedPath), actual))}` : actual !== void 0 ? `Rename ${actual} to ${suppliedBase} to ${sub} it \u2014 e2e test files must be lowercase .yaml.` : "Pass the e2e test file's name exactly as it appears on disk.";
|
|
40662
40830
|
return refuse(
|
|
40663
40831
|
`E2E test path must name the file as it appears on disk \u2014 this filesystem matched ${JSON.stringify(suppliedBase)} case-insensitively${actual !== void 0 ? ` to ${JSON.stringify(actual)}` : ""}, so the test name (which keys the report, __baselines__/, and --output) would be one no file carries: ${suppliedPath}
|
|
40664
40832
|
${recovery}`
|
|
@@ -40671,10 +40839,10 @@ async function collectFlowFiles(dir, recursive2) {
|
|
|
40671
40839
|
const manifests = [];
|
|
40672
40840
|
const walk = async (current, rel) => {
|
|
40673
40841
|
for (const entry of await fsp2.readdir(current, { withFileTypes: true })) {
|
|
40674
|
-
const entryRel = rel ?
|
|
40842
|
+
const entryRel = rel ? path21.join(rel, entry.name) : entry.name;
|
|
40675
40843
|
if (entry.isDirectory()) {
|
|
40676
40844
|
if (recursive2 && entry.name !== "__baselines__" && entry.name !== "node_modules" && (entry.name === ".argent" || !entry.name.startsWith("."))) {
|
|
40677
|
-
await walk(
|
|
40845
|
+
await walk(path21.join(current, entry.name), entryRel).catch(() => {
|
|
40678
40846
|
});
|
|
40679
40847
|
}
|
|
40680
40848
|
continue;
|
|
@@ -40684,8 +40852,8 @@ async function collectFlowFiles(dir, recursive2) {
|
|
|
40684
40852
|
continue;
|
|
40685
40853
|
}
|
|
40686
40854
|
if (!entry.name.endsWith(".yaml")) continue;
|
|
40687
|
-
if (!SAFE_FLOW_NAME.test(
|
|
40688
|
-
const filePath =
|
|
40855
|
+
if (!SAFE_FLOW_NAME.test(path21.basename(entry.name, ".yaml"))) continue;
|
|
40856
|
+
const filePath = path21.join(current, entry.name);
|
|
40689
40857
|
if (!await isRunnableFlowFile(filePath)) continue;
|
|
40690
40858
|
const shape = await checkE2eTestShape(filePath);
|
|
40691
40859
|
if (shape === "skip") continue;
|
|
@@ -40873,7 +41041,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
40873
41041
|
]
|
|
40874
41042
|
);
|
|
40875
41043
|
const { callTool, baseUrl } = runToolsClient(args, options);
|
|
40876
|
-
const outputBase = args.output ?
|
|
41044
|
+
const outputBase = args.output ? path21.resolve(args.output) : void 0;
|
|
40877
41045
|
const results = [];
|
|
40878
41046
|
const failures = [];
|
|
40879
41047
|
const batchStartedAt = Date.now();
|
|
@@ -40909,7 +41077,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
40909
41077
|
path: rel,
|
|
40910
41078
|
headline: verdict,
|
|
40911
41079
|
detail: entry.message,
|
|
40912
|
-
rerun: rerunCommand(
|
|
41080
|
+
rerun: rerunCommand(path21.join(dir, entry.dir), rel, projectRoot, args)
|
|
40913
41081
|
});
|
|
40914
41082
|
continue;
|
|
40915
41083
|
}
|
|
@@ -40926,7 +41094,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
40926
41094
|
skip(rel, "skipped (earlier test failed)", `earlier test failed: ${failedEarlier}`);
|
|
40927
41095
|
continue;
|
|
40928
41096
|
}
|
|
40929
|
-
const flowPath =
|
|
41097
|
+
const flowPath = path21.join(dir, rel);
|
|
40930
41098
|
const rerun = rerunCommand(flowPath, rel, projectRoot, args);
|
|
40931
41099
|
let report;
|
|
40932
41100
|
try {
|
|
@@ -40964,7 +41132,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
40964
41132
|
printWarnings(nestedStepWarnings(report.steps), args.json);
|
|
40965
41133
|
await exportAndResolveArtifacts(
|
|
40966
41134
|
report,
|
|
40967
|
-
outputBase ?
|
|
41135
|
+
outputBase ? path21.join(outputBase, path21.dirname(rel)) : void 0,
|
|
40968
41136
|
flowPath,
|
|
40969
41137
|
baseUrl
|
|
40970
41138
|
);
|
|
@@ -41162,7 +41330,7 @@ Pass the fully resolved path to the directory.`
|
|
|
41162
41330
|
for (const dir of dirs) {
|
|
41163
41331
|
let found;
|
|
41164
41332
|
try {
|
|
41165
|
-
found = await collectFlowFiles(
|
|
41333
|
+
found = await collectFlowFiles(path21.resolve(dir), listDir === void 0 || recursive2);
|
|
41166
41334
|
} catch (err) {
|
|
41167
41335
|
const code = err.code;
|
|
41168
41336
|
if (listDir === void 0 && (code === "ENOENT" || code === "ENOTDIR")) continue;
|
|
@@ -41173,11 +41341,11 @@ Pass the fully resolved path to the directory.`
|
|
|
41173
41341
|
anyDir = true;
|
|
41174
41342
|
const fileWarnings = new Map(found.files.map((file2) => [file2.path, file2.warning]));
|
|
41175
41343
|
const plan = await planDirectoryRun(
|
|
41176
|
-
|
|
41344
|
+
path21.resolve(dir),
|
|
41177
41345
|
found.files.map((file2) => file2.path),
|
|
41178
41346
|
found.manifests
|
|
41179
41347
|
);
|
|
41180
|
-
const show = (rel) => optionSafePath(
|
|
41348
|
+
const show = (rel) => optionSafePath(path21.join(dir, rel));
|
|
41181
41349
|
const add = (rel, inSuite, notRun) => {
|
|
41182
41350
|
const shown = show(rel);
|
|
41183
41351
|
const fileWarning = fileWarnings.get(rel);
|
|
@@ -41186,7 +41354,7 @@ Pass the fully resolved path to the directory.`
|
|
|
41186
41354
|
if (listDir !== void 0) {
|
|
41187
41355
|
entry = { path: shown };
|
|
41188
41356
|
} else {
|
|
41189
|
-
const name =
|
|
41357
|
+
const name = path21.dirname(rel) === "." ? path21.basename(rel, ".yaml") : void 0;
|
|
41190
41358
|
const shadowedBy = name === void 0 ? void 0 : byName.get(name);
|
|
41191
41359
|
if (name !== void 0 && shadowedBy === void 0) byName.set(name, shown);
|
|
41192
41360
|
entry = {
|
|
@@ -41196,7 +41364,7 @@ Pass the fully resolved path to the directory.`
|
|
|
41196
41364
|
...shadowedBy !== void 0 && { shadowedBy }
|
|
41197
41365
|
};
|
|
41198
41366
|
}
|
|
41199
|
-
if (inSuite) entry.suite = optionSafePath(
|
|
41367
|
+
if (inSuite) entry.suite = optionSafePath(path21.dirname(path21.join(dir, rel)));
|
|
41200
41368
|
if (warning !== void 0) entry.warning = warning;
|
|
41201
41369
|
const notes = notRun?.notes ?? [
|
|
41202
41370
|
...entry.shadowedBy === void 0 ? [] : [`warning: ${shown} is shadowed by ${entry.shadowedBy} when run by name`],
|
|
@@ -41396,7 +41564,7 @@ Pass the fully resolved path to the directory.`
|
|
|
41396
41564
|
try {
|
|
41397
41565
|
await exportAndResolveArtifacts(
|
|
41398
41566
|
report,
|
|
41399
|
-
args.output ?
|
|
41567
|
+
args.output ? path21.resolve(args.output) : void 0,
|
|
41400
41568
|
flowPath,
|
|
41401
41569
|
baseUrl
|
|
41402
41570
|
);
|
|
@@ -41502,8 +41670,8 @@ async function fetchImageToFile(result, outPath) {
|
|
|
41502
41670
|
const res = await fetch(url2);
|
|
41503
41671
|
if (!res.ok) throw new Error(`Failed to download image: ${res.status} ${res.statusText}`);
|
|
41504
41672
|
const buf = Buffer.from(await res.arrayBuffer());
|
|
41505
|
-
|
|
41506
|
-
|
|
41673
|
+
fs15.mkdirSync(path22.dirname(path22.resolve(outPath)), { recursive: true });
|
|
41674
|
+
fs15.writeFileSync(outPath, buf);
|
|
41507
41675
|
}
|
|
41508
41676
|
function renderResult(result, outputHint, images, json2) {
|
|
41509
41677
|
if (json2) return JSON.stringify(result, null, 2);
|
|
@@ -41715,8 +41883,8 @@ settled=false or debugger-status's not_connected.
|
|
|
41715
41883
|
if (outPath && meta3.outputHint === "image") {
|
|
41716
41884
|
try {
|
|
41717
41885
|
if (images.length > 0) {
|
|
41718
|
-
|
|
41719
|
-
|
|
41886
|
+
fs15.mkdirSync(path22.dirname(path22.resolve(outPath)), { recursive: true });
|
|
41887
|
+
fs15.writeFileSync(outPath, images[0].data);
|
|
41720
41888
|
} else if (result && typeof result === "object") {
|
|
41721
41889
|
await fetchImageToFile(result, outPath);
|
|
41722
41890
|
}
|
|
@@ -41848,7 +42016,7 @@ Listing tools contacts the argent tool-server, starting one if none is running.
|
|
|
41848
42016
|
}
|
|
41849
42017
|
|
|
41850
42018
|
// ../argent-cli/src/server.ts
|
|
41851
|
-
import * as
|
|
42019
|
+
import * as fs16 from "node:fs";
|
|
41852
42020
|
import * as readline2 from "node:readline";
|
|
41853
42021
|
import { constants as constants3, networkInterfaces } from "node:os";
|
|
41854
42022
|
import { spawn as spawn4 } from "node:child_process";
|
|
@@ -41861,14 +42029,36 @@ async function describeForeignServers(ownBundlePath) {
|
|
|
41861
42029
|
const list = others.map(({ state: state2 }) => `pid ${state2.pid} (${state2.bundlePath})`).join(", ");
|
|
41862
42030
|
return `Note: ${others.length} tool-server(s) from other argent installs: ${list}`;
|
|
41863
42031
|
}
|
|
42032
|
+
async function describeOtherServersOfInstall(paths) {
|
|
42033
|
+
if (!paths) return { line: null, servers: [] };
|
|
42034
|
+
const others = await otherToolServersOfBundle(paths.bundlePath, clientCloudProfile());
|
|
42035
|
+
const servers = others.map((state2) => ({
|
|
42036
|
+
pid: state2.pid,
|
|
42037
|
+
url: formatUrl(state2.host ?? "127.0.0.1", state2.port)
|
|
42038
|
+
}));
|
|
42039
|
+
if (servers.length === 0) return { line: null, servers };
|
|
42040
|
+
const list = servers.map((s) => `pid ${s.pid}`).join(", ");
|
|
42041
|
+
return {
|
|
42042
|
+
line: `Note: this install also runs ${servers.length} tool-server(s) for clients with another environment: ${list}. Run this command in that client's environment to reach one.`,
|
|
42043
|
+
servers
|
|
42044
|
+
};
|
|
42045
|
+
}
|
|
41864
42046
|
async function statusCmd(json2, paths) {
|
|
41865
|
-
const state2 = await readToolsServerState(paths?.bundlePath);
|
|
42047
|
+
const state2 = await readToolsServerState(paths?.bundlePath, clientCloudProfile());
|
|
42048
|
+
const others = await describeOtherServersOfInstall(paths);
|
|
41866
42049
|
if (!state2) {
|
|
41867
42050
|
const foreign = await describeForeignServers(paths?.bundlePath);
|
|
41868
42051
|
if (json2) {
|
|
41869
|
-
console.log(
|
|
42052
|
+
console.log(
|
|
42053
|
+
JSON.stringify(
|
|
42054
|
+
{ running: false, ...others.servers.length ? { otherServers: others.servers } : {} },
|
|
42055
|
+
null,
|
|
42056
|
+
2
|
|
42057
|
+
)
|
|
42058
|
+
);
|
|
41870
42059
|
} else {
|
|
41871
42060
|
console.log("tool-server: not running (no state file for this install)");
|
|
42061
|
+
if (others.line) console.log(others.line);
|
|
41872
42062
|
if (foreign) console.log(foreign);
|
|
41873
42063
|
}
|
|
41874
42064
|
return;
|
|
@@ -41880,7 +42070,14 @@ async function statusCmd(json2, paths) {
|
|
|
41880
42070
|
const { token, ...publicState } = state2;
|
|
41881
42071
|
console.log(
|
|
41882
42072
|
JSON.stringify(
|
|
41883
|
-
{
|
|
42073
|
+
{
|
|
42074
|
+
running: alive && healthy,
|
|
42075
|
+
...publicState,
|
|
42076
|
+
hasToken: !!token,
|
|
42077
|
+
alive,
|
|
42078
|
+
healthy,
|
|
42079
|
+
...others.servers.length ? { otherServers: others.servers } : {}
|
|
42080
|
+
},
|
|
41884
42081
|
null,
|
|
41885
42082
|
2
|
|
41886
42083
|
)
|
|
@@ -41897,18 +42094,24 @@ async function statusCmd(json2, paths) {
|
|
|
41897
42094
|
console.log(`
|
|
41898
42095
|
State file is stale; next \`argent\` invocation will respawn the server.`);
|
|
41899
42096
|
}
|
|
42097
|
+
if (others.line) console.log(`
|
|
42098
|
+
${others.line}`);
|
|
41900
42099
|
}
|
|
41901
42100
|
async function stopCmd(paths) {
|
|
41902
|
-
const
|
|
42101
|
+
const profile = clientCloudProfile();
|
|
42102
|
+
const state2 = await readToolsServerState(paths?.bundlePath, profile);
|
|
42103
|
+
const others = await describeOtherServersOfInstall(paths);
|
|
41903
42104
|
if (!state2) {
|
|
41904
42105
|
console.log("tool-server: not running");
|
|
42106
|
+
if (others.line) console.log(others.line);
|
|
41905
42107
|
const foreign = await describeForeignServers(paths?.bundlePath);
|
|
41906
42108
|
if (foreign) console.log(`${foreign}
|
|
41907
42109
|
Stop one with: kill <pid>`);
|
|
41908
42110
|
return;
|
|
41909
42111
|
}
|
|
41910
|
-
if (await killToolServer(paths?.bundlePath)) {
|
|
42112
|
+
if (await killToolServer(paths?.bundlePath, profile)) {
|
|
41911
42113
|
console.log(`tool-server stopped (pid ${state2.pid}).`);
|
|
42114
|
+
if (others.line) console.log(others.line);
|
|
41912
42115
|
} else {
|
|
41913
42116
|
console.log(
|
|
41914
42117
|
`tool-server: not running (pid ${state2.pid} is gone or not an argent tool-server).`
|
|
@@ -41916,12 +42119,12 @@ Stop one with: kill <pid>`);
|
|
|
41916
42119
|
}
|
|
41917
42120
|
}
|
|
41918
42121
|
function logsCmd(follow) {
|
|
41919
|
-
if (!
|
|
42122
|
+
if (!fs16.existsSync(LOG_FILE2)) {
|
|
41920
42123
|
console.log(`No log file at ${LOG_FILE2}`);
|
|
41921
42124
|
return;
|
|
41922
42125
|
}
|
|
41923
42126
|
if (!follow) {
|
|
41924
|
-
process.stdout.write(
|
|
42127
|
+
process.stdout.write(fs16.readFileSync(LOG_FILE2, "utf8"));
|
|
41925
42128
|
return;
|
|
41926
42129
|
}
|
|
41927
42130
|
const cannotFollow = (err) => {
|
|
@@ -42116,6 +42319,11 @@ async function startCmd(argv, paths) {
|
|
|
42116
42319
|
printStartHelp();
|
|
42117
42320
|
return;
|
|
42118
42321
|
}
|
|
42322
|
+
if (clientCloudProfile()) {
|
|
42323
|
+
console.error(
|
|
42324
|
+
"argent server start: ARGENT_CLOUD_URL and ARGENT_CLOUD_API_KEY are not passed to this server. A client with them starts and joins a tool-server of its own."
|
|
42325
|
+
);
|
|
42326
|
+
}
|
|
42119
42327
|
try {
|
|
42120
42328
|
assertPrivateArgentHome();
|
|
42121
42329
|
} catch (err) {
|
|
@@ -42255,8 +42463,8 @@ async function runForeground(paths, { port, host, idleTimeoutMinutes, token }, j
|
|
|
42255
42463
|
if (stateWritten) {
|
|
42256
42464
|
const file2 = stateFileForBundle(paths.bundlePath);
|
|
42257
42465
|
try {
|
|
42258
|
-
const cur = JSON.parse(
|
|
42259
|
-
if (cur.pid === childPid)
|
|
42466
|
+
const cur = JSON.parse(fs16.readFileSync(file2, "utf8"));
|
|
42467
|
+
if (cur.pid === childPid) fs16.unlinkSync(file2);
|
|
42260
42468
|
} catch {
|
|
42261
42469
|
}
|
|
42262
42470
|
}
|
|
@@ -42366,9 +42574,9 @@ async function server(argv, options) {
|
|
|
42366
42574
|
}
|
|
42367
42575
|
|
|
42368
42576
|
// ../argent-cli/src/lens.ts
|
|
42369
|
-
import * as
|
|
42370
|
-
import * as
|
|
42371
|
-
import * as
|
|
42577
|
+
import * as fs17 from "node:fs";
|
|
42578
|
+
import * as os4 from "node:os";
|
|
42579
|
+
import * as path23 from "node:path";
|
|
42372
42580
|
|
|
42373
42581
|
// ../argent-cli/src/lens-terminal.ts
|
|
42374
42582
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
@@ -42584,17 +42792,17 @@ function isSessionAlive(session) {
|
|
|
42584
42792
|
}
|
|
42585
42793
|
|
|
42586
42794
|
// ../argent-cli/src/lens-pty.ts
|
|
42587
|
-
import { chmodSync, readdirSync as
|
|
42795
|
+
import { chmodSync, readdirSync as readdirSync3 } from "node:fs";
|
|
42588
42796
|
import { createRequire } from "node:module";
|
|
42589
|
-
import { dirname as
|
|
42797
|
+
import { dirname as dirname14, join as join22 } from "node:path";
|
|
42590
42798
|
var nodeRequire = createRequire(import.meta.url);
|
|
42591
42799
|
function ensureSpawnHelperExecutable(req = nodeRequire) {
|
|
42592
42800
|
if (process.platform !== "darwin") return;
|
|
42593
42801
|
try {
|
|
42594
|
-
const prebuilds =
|
|
42595
|
-
for (const entry of
|
|
42802
|
+
const prebuilds = join22(dirname14(req.resolve("node-pty/package.json")), "prebuilds");
|
|
42803
|
+
for (const entry of readdirSync3(prebuilds)) {
|
|
42596
42804
|
try {
|
|
42597
|
-
chmodSync(
|
|
42805
|
+
chmodSync(join22(prebuilds, entry, "spawn-helper"), 493);
|
|
42598
42806
|
} catch {
|
|
42599
42807
|
}
|
|
42600
42808
|
}
|
|
@@ -43122,12 +43330,12 @@ async function lens(argv, options) {
|
|
|
43122
43330
|
await endSession(baseUrl);
|
|
43123
43331
|
process.exit(1);
|
|
43124
43332
|
}
|
|
43125
|
-
const seedFile =
|
|
43126
|
-
|
|
43333
|
+
const seedFile = path23.join(os4.tmpdir(), `argent-lens-seed-${process.pid}-${Date.now()}.txt`);
|
|
43334
|
+
fs17.writeFileSync(seedFile, buildSeedPrompt(), "utf8");
|
|
43127
43335
|
const launchCmd = agent.launch(shellQuote(process.cwd()), shellQuote(seedFile));
|
|
43128
43336
|
const removeSeedFile = () => {
|
|
43129
43337
|
try {
|
|
43130
|
-
|
|
43338
|
+
fs17.rmSync(seedFile, { force: true });
|
|
43131
43339
|
} catch {
|
|
43132
43340
|
}
|
|
43133
43341
|
};
|
|
@@ -43329,7 +43537,7 @@ async function endSession(baseUrl) {
|
|
|
43329
43537
|
|
|
43330
43538
|
// ../argent-cli/src/flags.ts
|
|
43331
43539
|
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
43332
|
-
import * as
|
|
43540
|
+
import * as path25 from "node:path";
|
|
43333
43541
|
|
|
43334
43542
|
// ../argent-cli/src/secrets.ts
|
|
43335
43543
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -43474,12 +43682,12 @@ async function linkedSecretsNote(secretsFile) {
|
|
|
43474
43682
|
}
|
|
43475
43683
|
|
|
43476
43684
|
// ../argent-cli/src/project-scope.ts
|
|
43477
|
-
import * as
|
|
43685
|
+
import * as path24 from "node:path";
|
|
43478
43686
|
function degenerateProjectScopeWarning(scope, file2) {
|
|
43479
43687
|
if (scope !== "project") return null;
|
|
43480
|
-
if (isHomeDir(
|
|
43481
|
-
const name =
|
|
43482
|
-
const writes = canonicalPath(
|
|
43688
|
+
if (isHomeDir(path24.dirname(path24.dirname(file2)))) {
|
|
43689
|
+
const name = path24.basename(file2, ".json");
|
|
43690
|
+
const writes = canonicalPath(path24.dirname(file2)) === canonicalPath(argentHomeDir()) ? `the GLOBAL ${name} file (${file2})` : `${file2}, the global ${name} file of the default Argent home (the global one of ARGENT_HOME_DIR is ${path24.join(argentHomeDir(), path24.basename(file2))})`;
|
|
43483
43691
|
return `WARNING: no project found between ${process.cwd()} and your home directory \u2014 "project" scope resolved to the home directory, so this writes ${writes}.`;
|
|
43484
43692
|
}
|
|
43485
43693
|
if (findProjectRoot(process.cwd()) === null) {
|
|
@@ -43624,7 +43832,7 @@ Options:
|
|
|
43624
43832
|
console.error(`Error: ${err.message}`);
|
|
43625
43833
|
process.exit(2);
|
|
43626
43834
|
}
|
|
43627
|
-
const projectIsHome = isHomeDir(
|
|
43835
|
+
const projectIsHome = isHomeDir(path25.dirname(path25.dirname(getFlagsPath("project"))));
|
|
43628
43836
|
const projectFlags = projectIsHome ? {} : readFlags("project");
|
|
43629
43837
|
const globalFlags = readFlags("global");
|
|
43630
43838
|
const effective = {};
|
|
@@ -43687,7 +43895,7 @@ Options:
|
|
|
43687
43895
|
|
|
43688
43896
|
// ../argent-cli/src/config.ts
|
|
43689
43897
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
43690
|
-
import * as
|
|
43898
|
+
import * as path26 from "node:path";
|
|
43691
43899
|
function config2(argv) {
|
|
43692
43900
|
if (argv.length === 0 || argv[0] === "--help" || argv[0] === "-h") {
|
|
43693
43901
|
printUsage2();
|
|
@@ -43867,10 +44075,10 @@ function wantsHelp(argv) {
|
|
|
43867
44075
|
}
|
|
43868
44076
|
function scopeLabel(scope) {
|
|
43869
44077
|
if (scope === "global") return "global";
|
|
43870
|
-
return `project: ${
|
|
44078
|
+
return `project: ${path26.dirname(configDir("project"))}`;
|
|
43871
44079
|
}
|
|
43872
44080
|
function projectConfigWarning(scope) {
|
|
43873
|
-
return degenerateProjectScopeWarning(scope,
|
|
44081
|
+
return degenerateProjectScopeWarning(scope, path26.join(configDir("project"), "config.json"));
|
|
43874
44082
|
}
|
|
43875
44083
|
function restartHint(key) {
|
|
43876
44084
|
if (key !== "android.adbServerPort") return null;
|
|
@@ -44696,8 +44904,8 @@ var n2 = class extends y {
|
|
|
44696
44904
|
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
44697
44905
|
import process$1 from "node:process";
|
|
44698
44906
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
44699
|
-
import { existsSync as existsSync8, lstatSync as
|
|
44700
|
-
import { dirname as
|
|
44907
|
+
import { existsSync as existsSync8, lstatSync as lstatSync4, readdirSync as readdirSync4 } from "node:fs";
|
|
44908
|
+
import { dirname as dirname18, join as join26 } from "node:path";
|
|
44701
44909
|
function isUnicodeSupported() {
|
|
44702
44910
|
if (process$1.platform !== "win32") {
|
|
44703
44911
|
return process$1.env.TERM !== "linux";
|
|
@@ -45152,7 +45360,7 @@ ${i2}
|
|
|
45152
45360
|
|
|
45153
45361
|
// ../argent-cli/src/link.ts
|
|
45154
45362
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
45155
|
-
import * as
|
|
45363
|
+
import * as path27 from "node:path";
|
|
45156
45364
|
var WILDCARD_HOSTS = /* @__PURE__ */ new Set(["0.0.0.0", "::", "::0", ""]);
|
|
45157
45365
|
function isLoopback2(host) {
|
|
45158
45366
|
return host === "127.0.0.1" || host === "localhost" || host === "::1";
|
|
@@ -45533,7 +45741,7 @@ async function link(argv) {
|
|
|
45533
45741
|
}
|
|
45534
45742
|
if (token)
|
|
45535
45743
|
console.log(
|
|
45536
|
-
import_picocolors4.default.dim(` auth: token stored in ${
|
|
45744
|
+
import_picocolors4.default.dim(` auth: token stored in ${path27.join(argentHomeDir(), "link.json")} (0600)`)
|
|
45537
45745
|
);
|
|
45538
45746
|
printSecurityCaveat(host, token, url2);
|
|
45539
45747
|
if (process.env.ARGENT_TOOLS_URL) {
|
|
@@ -45591,7 +45799,7 @@ async function unlink3(argv) {
|
|
|
45591
45799
|
|
|
45592
45800
|
// ../argent-cli/src/telemetry.ts
|
|
45593
45801
|
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
45594
|
-
import * as
|
|
45802
|
+
import * as path28 from "node:path";
|
|
45595
45803
|
var SCOPES = ["global", "project"];
|
|
45596
45804
|
var SUBCOMMANDS = ["status", "enable", "disable"];
|
|
45597
45805
|
var TELEMETRY_OPTIONS = {
|
|
@@ -45681,7 +45889,7 @@ function describeSource(source) {
|
|
|
45681
45889
|
}
|
|
45682
45890
|
}
|
|
45683
45891
|
function projectConfigWarning2(scope) {
|
|
45684
|
-
return degenerateProjectScopeWarning(scope,
|
|
45892
|
+
return degenerateProjectScopeWarning(scope, path28.join(configDir("project"), "config.json"));
|
|
45685
45893
|
}
|
|
45686
45894
|
async function cmdEnable(scope) {
|
|
45687
45895
|
const warning = projectConfigWarning2(scope);
|
|
@@ -45717,8 +45925,8 @@ async function cmdDisable(scope) {
|
|
|
45717
45925
|
|
|
45718
45926
|
// ../argent-cli/src/providers.ts
|
|
45719
45927
|
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
45720
|
-
import * as
|
|
45721
|
-
import * as
|
|
45928
|
+
import * as fs21 from "node:fs";
|
|
45929
|
+
import * as path31 from "node:path";
|
|
45722
45930
|
|
|
45723
45931
|
// ../device-providers/src/contract.ts
|
|
45724
45932
|
var PROVIDER_SCHEMA_VERSION = 1;
|
|
@@ -45863,20 +46071,20 @@ var providerEnvelopeSchema = providerRecordSchema.extend({
|
|
|
45863
46071
|
});
|
|
45864
46072
|
|
|
45865
46073
|
// ../device-providers/src/read.ts
|
|
45866
|
-
import * as
|
|
45867
|
-
import * as
|
|
45868
|
-
import * as
|
|
46074
|
+
import * as fs18 from "node:fs";
|
|
46075
|
+
import * as os5 from "node:os";
|
|
46076
|
+
import * as path29 from "node:path";
|
|
45869
46077
|
var DISABLE_ENV = "ARGENT_DISABLE_DEVICE_PROVIDERS";
|
|
45870
46078
|
var OVERRIDE_ENV = "ARGENT_DEVICE_PROVIDERS";
|
|
45871
46079
|
function argentHomeDir2() {
|
|
45872
46080
|
const override = process.env.ARGENT_HOME_DIR?.trim();
|
|
45873
|
-
if (override) return
|
|
46081
|
+
if (override) return path29.resolve(override);
|
|
45874
46082
|
const raw = process.platform === "win32" ? process.env.USERPROFILE : process.env.HOME;
|
|
45875
46083
|
const trimmed = raw?.trim();
|
|
45876
|
-
return
|
|
46084
|
+
return path29.join(trimmed ? raw : os5.homedir(), ".argent");
|
|
45877
46085
|
}
|
|
45878
46086
|
function providersDirectory() {
|
|
45879
|
-
return
|
|
46087
|
+
return path29.join(argentHomeDir2(), "providers");
|
|
45880
46088
|
}
|
|
45881
46089
|
function discoveryDisabled() {
|
|
45882
46090
|
const raw = process.env[DISABLE_ENV];
|
|
@@ -45892,7 +46100,7 @@ function warnOnce(key, message) {
|
|
|
45892
46100
|
function readProviderFile(file2) {
|
|
45893
46101
|
let raw;
|
|
45894
46102
|
try {
|
|
45895
|
-
raw =
|
|
46103
|
+
raw = fs18.readFileSync(file2, "utf8");
|
|
45896
46104
|
} catch {
|
|
45897
46105
|
return void 0;
|
|
45898
46106
|
}
|
|
@@ -45942,15 +46150,15 @@ function discoverProviders() {
|
|
|
45942
46150
|
function descriptorFiles() {
|
|
45943
46151
|
const directory = providersDirectory();
|
|
45944
46152
|
try {
|
|
45945
|
-
return
|
|
46153
|
+
return fs18.readdirSync(directory).filter((name) => name.endsWith(".json")).sort().map((name) => path29.join(directory, name));
|
|
45946
46154
|
} catch {
|
|
45947
46155
|
return [];
|
|
45948
46156
|
}
|
|
45949
46157
|
}
|
|
45950
46158
|
|
|
45951
46159
|
// ../device-providers/src/write.ts
|
|
45952
|
-
import * as
|
|
45953
|
-
import * as
|
|
46160
|
+
import * as fs19 from "node:fs";
|
|
46161
|
+
import * as path30 from "node:path";
|
|
45954
46162
|
var ProviderValidationError = class extends Error {
|
|
45955
46163
|
/** One line per problem, `path: message`, in the order zod reported them. */
|
|
45956
46164
|
issues;
|
|
@@ -46002,20 +46210,20 @@ function publishProvider(record2, options = {}) {
|
|
|
46002
46210
|
);
|
|
46003
46211
|
}
|
|
46004
46212
|
const directory = providersDirectory();
|
|
46005
|
-
const file2 =
|
|
46213
|
+
const file2 = path30.join(directory, `${validated.id}.json`);
|
|
46006
46214
|
const body = JSON.stringify(canonicalize(candidate), null, 2) + "\n";
|
|
46007
46215
|
try {
|
|
46008
|
-
if (
|
|
46216
|
+
if (fs19.readFileSync(file2, "utf8") === body) return { changed: false, path: file2 };
|
|
46009
46217
|
} catch {
|
|
46010
46218
|
}
|
|
46011
|
-
|
|
46219
|
+
fs19.mkdirSync(directory, { recursive: true });
|
|
46012
46220
|
const temporary = `${file2}.${process.pid}.tmp`;
|
|
46013
46221
|
try {
|
|
46014
|
-
|
|
46015
|
-
|
|
46222
|
+
fs19.writeFileSync(temporary, body);
|
|
46223
|
+
fs19.renameSync(temporary, file2);
|
|
46016
46224
|
} catch (error63) {
|
|
46017
46225
|
try {
|
|
46018
|
-
|
|
46226
|
+
fs19.rmSync(temporary, { force: true });
|
|
46019
46227
|
} catch {
|
|
46020
46228
|
}
|
|
46021
46229
|
throw error63;
|
|
@@ -46026,9 +46234,9 @@ function withdrawProvider(id) {
|
|
|
46026
46234
|
if (!PROVIDER_ID_SHAPE.test(id)) {
|
|
46027
46235
|
throw new Error(`'${id}' is not a valid provider id (${String(PROVIDER_ID_SHAPE)}).`);
|
|
46028
46236
|
}
|
|
46029
|
-
const file2 =
|
|
46237
|
+
const file2 = path30.join(providersDirectory(), `${id}.json`);
|
|
46030
46238
|
try {
|
|
46031
|
-
|
|
46239
|
+
fs19.unlinkSync(file2);
|
|
46032
46240
|
return true;
|
|
46033
46241
|
} catch (e) {
|
|
46034
46242
|
if (e.code === "ENOENT") return false;
|
|
@@ -46058,7 +46266,7 @@ function pruneOrphanedProviders(options = {}) {
|
|
|
46058
46266
|
continue;
|
|
46059
46267
|
}
|
|
46060
46268
|
try {
|
|
46061
|
-
|
|
46269
|
+
fs19.unlinkSync(file2);
|
|
46062
46270
|
removed.push(entry);
|
|
46063
46271
|
} catch {
|
|
46064
46272
|
}
|
|
@@ -46068,7 +46276,7 @@ function pruneOrphanedProviders(options = {}) {
|
|
|
46068
46276
|
|
|
46069
46277
|
// ../argent-cli/src/providers-check.ts
|
|
46070
46278
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
46071
|
-
import * as
|
|
46279
|
+
import * as fs20 from "node:fs";
|
|
46072
46280
|
var KNOWN_CAPABILITIES = new Set(EXTERNAL_CAPABILITIES);
|
|
46073
46281
|
var PROBE_TIMEOUT_MS = 5e3;
|
|
46074
46282
|
function error62(message) {
|
|
@@ -46134,7 +46342,7 @@ async function checkDevices(devices, findings) {
|
|
|
46134
46342
|
);
|
|
46135
46343
|
} else {
|
|
46136
46344
|
try {
|
|
46137
|
-
|
|
46345
|
+
fs20.accessSync(device.deviceSet, fs20.constants.R_OK);
|
|
46138
46346
|
} catch {
|
|
46139
46347
|
findings.push(
|
|
46140
46348
|
error62(`${label}: deviceSet '${device.deviceSet}' is not readable by this user`)
|
|
@@ -46191,7 +46399,7 @@ async function checkDevices(devices, findings) {
|
|
|
46191
46399
|
);
|
|
46192
46400
|
} else {
|
|
46193
46401
|
try {
|
|
46194
|
-
|
|
46402
|
+
fs20.accessSync(device.nativeDevtools.socketPath, fs20.constants.R_OK | fs20.constants.W_OK);
|
|
46195
46403
|
} catch {
|
|
46196
46404
|
findings.push(
|
|
46197
46405
|
error62(
|
|
@@ -46262,7 +46470,7 @@ async function checkDescriptorFile(file2, expectedVersion) {
|
|
|
46262
46470
|
const report = { deviceCount: 0, findings, source: file2 };
|
|
46263
46471
|
let raw;
|
|
46264
46472
|
try {
|
|
46265
|
-
raw =
|
|
46473
|
+
raw = fs20.readFileSync(file2, "utf8");
|
|
46266
46474
|
} catch (e) {
|
|
46267
46475
|
findings.push(error62(`unreadable: ${e instanceof Error ? e.message : String(e)}`));
|
|
46268
46476
|
return report;
|
|
@@ -46407,7 +46615,7 @@ async function readDocument(args) {
|
|
|
46407
46615
|
}
|
|
46408
46616
|
if (args.file) {
|
|
46409
46617
|
try {
|
|
46410
|
-
return { raw:
|
|
46618
|
+
return { raw: fs21.readFileSync(args.file, "utf8"), source: args.file };
|
|
46411
46619
|
} catch (e) {
|
|
46412
46620
|
throw new UsageError2(
|
|
46413
46621
|
`cannot read ${args.file}: ${e instanceof Error ? e.message : String(e)}`
|
|
@@ -46540,7 +46748,7 @@ function runWithdraw(args) {
|
|
|
46540
46748
|
throw new UsageError2(`'${id}' is not a valid provider id (${String(PROVIDER_ID_SHAPE)})`);
|
|
46541
46749
|
}
|
|
46542
46750
|
const removed = withdrawProvider(id);
|
|
46543
|
-
const file2 =
|
|
46751
|
+
const file2 = path31.join(providersDirectory(), `${id}.json`);
|
|
46544
46752
|
if (args.json) {
|
|
46545
46753
|
console.log(JSON.stringify({ ok: true, path: file2, removed }, null, 2));
|
|
46546
46754
|
return;
|
|
@@ -46682,7 +46890,7 @@ this build does not know pass through to the file untouched, so publishing
|
|
|
46682
46890
|
through an older install than the one reading loses nothing.
|
|
46683
46891
|
|
|
46684
46892
|
To spawn these commands without relying on PATH \u2014 which an editor extension
|
|
46685
|
-
host frequently cannot \u2014 read ${
|
|
46893
|
+
host frequently cannot \u2014 read ${path31.join(argentHomeDir(), "cli.json")}, written by \`argent init\`
|
|
46686
46894
|
and \`argent update\` and healed best-effort on every \`argent mcp\` start:
|
|
46687
46895
|
|
|
46688
46896
|
{ "node": "/abs/path/to/node", "cli": "/abs/path/to/dist/cli.js",
|
|
@@ -46755,17 +46963,17 @@ async function providers(argv) {
|
|
|
46755
46963
|
|
|
46756
46964
|
// ../argent-cli/src/doctor.ts
|
|
46757
46965
|
var import_picocolors8 = __toESM(require_picocolors(), 1);
|
|
46758
|
-
import * as
|
|
46759
|
-
import * as
|
|
46966
|
+
import * as fs35 from "node:fs";
|
|
46967
|
+
import * as path47 from "node:path";
|
|
46760
46968
|
import { execFile } from "node:child_process";
|
|
46761
46969
|
import { promisify } from "node:util";
|
|
46762
|
-
import { homedir as
|
|
46970
|
+
import { homedir as homedir9 } from "node:os";
|
|
46763
46971
|
|
|
46764
46972
|
// ../argent-installer/src/mcp-configs.ts
|
|
46765
|
-
import * as
|
|
46766
|
-
import * as
|
|
46973
|
+
import * as fs28 from "node:fs";
|
|
46974
|
+
import * as path38 from "node:path";
|
|
46767
46975
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
46768
|
-
import { homedir as
|
|
46976
|
+
import { homedir as homedir6 } from "node:os";
|
|
46769
46977
|
|
|
46770
46978
|
// ../argent-installer/src/constants.ts
|
|
46771
46979
|
var PACKAGE_NAME = "@swmansion/argent";
|
|
@@ -46777,11 +46985,11 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
|
|
|
46777
46985
|
|
|
46778
46986
|
// ../argent-installer/src/utils.ts
|
|
46779
46987
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
46780
|
-
import * as
|
|
46781
|
-
import * as
|
|
46988
|
+
import * as fs27 from "node:fs";
|
|
46989
|
+
import * as path37 from "node:path";
|
|
46782
46990
|
import * as dns from "node:dns";
|
|
46783
46991
|
import { createHash as createHash6 } from "node:crypto";
|
|
46784
|
-
import * as
|
|
46992
|
+
import * as os7 from "node:os";
|
|
46785
46993
|
import { execFileSync as execFileSync7, execSync } from "node:child_process";
|
|
46786
46994
|
|
|
46787
46995
|
// ../../node_modules/smol-toml/dist/error.js
|
|
@@ -48524,12 +48732,12 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
48524
48732
|
}
|
|
48525
48733
|
return result;
|
|
48526
48734
|
}
|
|
48527
|
-
function findNodeAtLocation(root,
|
|
48735
|
+
function findNodeAtLocation(root, path48) {
|
|
48528
48736
|
if (!root) {
|
|
48529
48737
|
return void 0;
|
|
48530
48738
|
}
|
|
48531
48739
|
let node2 = root;
|
|
48532
|
-
for (let segment of
|
|
48740
|
+
for (let segment of path48) {
|
|
48533
48741
|
if (typeof segment === "string") {
|
|
48534
48742
|
if (node2.type !== "object" || !Array.isArray(node2.children)) {
|
|
48535
48743
|
return void 0;
|
|
@@ -48883,14 +49091,14 @@ function getNodeType(value) {
|
|
|
48883
49091
|
|
|
48884
49092
|
// ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
48885
49093
|
function setProperty(text2, originalPath, value, options) {
|
|
48886
|
-
const
|
|
49094
|
+
const path48 = originalPath.slice();
|
|
48887
49095
|
const errors = [];
|
|
48888
49096
|
const root = parseTree(text2, errors);
|
|
48889
49097
|
let parent = void 0;
|
|
48890
49098
|
let lastSegment = void 0;
|
|
48891
|
-
while (
|
|
48892
|
-
lastSegment =
|
|
48893
|
-
parent = findNodeAtLocation(root,
|
|
49099
|
+
while (path48.length > 0) {
|
|
49100
|
+
lastSegment = path48.pop();
|
|
49101
|
+
parent = findNodeAtLocation(root, path48);
|
|
48894
49102
|
if (parent === void 0 && value !== void 0) {
|
|
48895
49103
|
if (typeof lastSegment === "string") {
|
|
48896
49104
|
value = { [lastSegment]: value };
|
|
@@ -49076,8 +49284,8 @@ var ParseErrorCode;
|
|
|
49076
49284
|
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
49077
49285
|
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
49078
49286
|
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
49079
|
-
function modify(text2,
|
|
49080
|
-
return setProperty(text2,
|
|
49287
|
+
function modify(text2, path48, value, options) {
|
|
49288
|
+
return setProperty(text2, path48, value, options);
|
|
49081
49289
|
}
|
|
49082
49290
|
function applyEdits(text2, edits) {
|
|
49083
49291
|
let sortedEdits = edits.slice(0).sort((a2, b) => {
|
|
@@ -49101,36 +49309,36 @@ function applyEdits(text2, edits) {
|
|
|
49101
49309
|
}
|
|
49102
49310
|
|
|
49103
49311
|
// ../argent-installer/src/package-root.ts
|
|
49104
|
-
import * as
|
|
49105
|
-
import * as
|
|
49106
|
-
function resolvePackageRoot(
|
|
49107
|
-
let current =
|
|
49312
|
+
import * as fs22 from "node:fs";
|
|
49313
|
+
import * as path32 from "node:path";
|
|
49314
|
+
function resolvePackageRoot(dirname28) {
|
|
49315
|
+
let current = path32.resolve(dirname28);
|
|
49108
49316
|
while (true) {
|
|
49109
|
-
if (
|
|
49110
|
-
const parent =
|
|
49111
|
-
if (parent === current) return
|
|
49317
|
+
if (fs22.existsSync(path32.join(current, "package.json"))) return current;
|
|
49318
|
+
const parent = path32.dirname(current);
|
|
49319
|
+
if (parent === current) return path32.resolve(dirname28);
|
|
49112
49320
|
current = parent;
|
|
49113
49321
|
}
|
|
49114
49322
|
}
|
|
49115
49323
|
|
|
49116
49324
|
// ../argent-installer/src/package-manager.ts
|
|
49117
49325
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
49118
|
-
import * as
|
|
49119
|
-
import * as
|
|
49120
|
-
import * as
|
|
49326
|
+
import * as fs25 from "node:fs";
|
|
49327
|
+
import * as os6 from "node:os";
|
|
49328
|
+
import * as path35 from "node:path";
|
|
49121
49329
|
|
|
49122
49330
|
// ../argent-installer/src/topology.ts
|
|
49123
49331
|
var import_semver2 = __toESM(require_semver2(), 1);
|
|
49124
|
-
import * as
|
|
49125
|
-
import * as
|
|
49332
|
+
import * as fs24 from "node:fs";
|
|
49333
|
+
import * as path34 from "node:path";
|
|
49126
49334
|
import { createRequire as createRequire2 } from "node:module";
|
|
49127
49335
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
49128
49336
|
|
|
49129
49337
|
// ../argent-installer/src/preflight.ts
|
|
49130
|
-
import * as
|
|
49131
|
-
import * as
|
|
49338
|
+
import * as fs23 from "node:fs";
|
|
49339
|
+
import * as path33 from "node:path";
|
|
49132
49340
|
function isYarnPnp(projectRoot) {
|
|
49133
|
-
return
|
|
49341
|
+
return fs23.existsSync(path33.join(projectRoot, ".pnp.cjs")) || fs23.existsSync(path33.join(projectRoot, ".pnp.loader.mjs"));
|
|
49134
49342
|
}
|
|
49135
49343
|
|
|
49136
49344
|
// ../argent-installer/src/topology.ts
|
|
@@ -49156,12 +49364,12 @@ function isTempRunnerPath(binaryPath) {
|
|
|
49156
49364
|
}
|
|
49157
49365
|
function isProjectBinPath(binaryPath) {
|
|
49158
49366
|
const norm = (p) => process.platform === "win32" ? p.toLowerCase() : canonicalPath(p);
|
|
49159
|
-
const binDir = norm(
|
|
49367
|
+
const binDir = norm(path34.dirname(path34.resolve(binaryPath)));
|
|
49160
49368
|
const prefix = process.env.npm_config_local_prefix;
|
|
49161
|
-
if (prefix && norm(
|
|
49162
|
-
for (let dir =
|
|
49163
|
-
if (norm(
|
|
49164
|
-
if (
|
|
49369
|
+
if (prefix && norm(path34.join(prefix, "node_modules", ".bin")) === binDir) return true;
|
|
49370
|
+
for (let dir = path34.resolve(process.cwd()); ; dir = path34.dirname(dir)) {
|
|
49371
|
+
if (norm(path34.join(dir, "node_modules", ".bin")) === binDir) return true;
|
|
49372
|
+
if (path34.dirname(dir) === dir) return false;
|
|
49165
49373
|
}
|
|
49166
49374
|
}
|
|
49167
49375
|
function getPermanentBinaryPaths() {
|
|
@@ -49199,8 +49407,8 @@ function getGloballyInstalledPackageRoot() {
|
|
|
49199
49407
|
}
|
|
49200
49408
|
function readShimScript(binaryPath) {
|
|
49201
49409
|
try {
|
|
49202
|
-
if (
|
|
49203
|
-
return
|
|
49410
|
+
if (fs24.statSync(binaryPath).size > 64 * 1024) return null;
|
|
49411
|
+
return fs24.readFileSync(binaryPath, "utf8");
|
|
49204
49412
|
} catch {
|
|
49205
49413
|
return null;
|
|
49206
49414
|
}
|
|
@@ -49211,7 +49419,7 @@ function shimTargetOf(binaryPath) {
|
|
|
49211
49419
|
const trailer = /^# cmd-shim-target=(.+)$/m.exec(shim);
|
|
49212
49420
|
if (trailer) return trailer[1].trim();
|
|
49213
49421
|
const relative6 = /"\$basedir(?:_abs)?"?\/'?([^"'\s]*node_modules\/[^"'\s]*)/.exec(shim);
|
|
49214
|
-
return relative6 ?
|
|
49422
|
+
return relative6 ? path34.resolve(canonicalPath(path34.dirname(binaryPath)), relative6[1]) : null;
|
|
49215
49423
|
}
|
|
49216
49424
|
function globalPackageRootOf(binaryPath) {
|
|
49217
49425
|
const root = packageRootOf(binaryPath);
|
|
@@ -49221,9 +49429,9 @@ function globalPackageRootOf(binaryPath) {
|
|
|
49221
49429
|
}
|
|
49222
49430
|
function packageRootOf(binaryPath) {
|
|
49223
49431
|
try {
|
|
49224
|
-
const realPath =
|
|
49225
|
-
const root = resolvePackageRoot(
|
|
49226
|
-
const pkg = JSON.parse(
|
|
49432
|
+
const realPath = fs24.realpathSync(binaryPath);
|
|
49433
|
+
const root = resolvePackageRoot(path34.dirname(realPath));
|
|
49434
|
+
const pkg = JSON.parse(fs24.readFileSync(path34.join(root, "package.json"), "utf8"));
|
|
49227
49435
|
return pkg.name === PACKAGE_NAME ? root : null;
|
|
49228
49436
|
} catch {
|
|
49229
49437
|
return null;
|
|
@@ -49233,7 +49441,7 @@ function getGloballyInstalledVersion() {
|
|
|
49233
49441
|
const pkgRoot = getGloballyInstalledPackageRoot();
|
|
49234
49442
|
if (!pkgRoot) return null;
|
|
49235
49443
|
try {
|
|
49236
|
-
const pkg = JSON.parse(
|
|
49444
|
+
const pkg = JSON.parse(fs24.readFileSync(path34.join(pkgRoot, "package.json"), "utf8"));
|
|
49237
49445
|
return pkg.version ?? null;
|
|
49238
49446
|
} catch {
|
|
49239
49447
|
return null;
|
|
@@ -49242,7 +49450,7 @@ function getGloballyInstalledVersion() {
|
|
|
49242
49450
|
function readManifestDeclaration(projectRoot) {
|
|
49243
49451
|
try {
|
|
49244
49452
|
const pkg = JSON.parse(
|
|
49245
|
-
|
|
49453
|
+
fs24.readFileSync(path34.join(projectRoot, "package.json"), "utf8")
|
|
49246
49454
|
);
|
|
49247
49455
|
const spec = pkg.devDependencies?.[PACKAGE_NAME] ?? pkg.dependencies?.[PACKAGE_NAME] ?? pkg.optionalDependencies?.[PACKAGE_NAME];
|
|
49248
49456
|
return typeof spec === "string" ? spec : null;
|
|
@@ -49255,11 +49463,11 @@ function isDeclaredLocally(projectRoot) {
|
|
|
49255
49463
|
}
|
|
49256
49464
|
function resolveLocalArgentDir(projectRoot) {
|
|
49257
49465
|
try {
|
|
49258
|
-
const req = createRequire2(
|
|
49259
|
-
return
|
|
49466
|
+
const req = createRequire2(path34.join(projectRoot, "package.json"));
|
|
49467
|
+
return path34.dirname(req.resolve(`${PACKAGE_NAME}/package.json`));
|
|
49260
49468
|
} catch {
|
|
49261
|
-
const plain =
|
|
49262
|
-
return
|
|
49469
|
+
const plain = path34.join(projectRoot, "node_modules", PACKAGE_NAME);
|
|
49470
|
+
return fs24.existsSync(path34.join(plain, "package.json")) ? plain : null;
|
|
49263
49471
|
}
|
|
49264
49472
|
}
|
|
49265
49473
|
function probeLocalInstall(projectRoot) {
|
|
@@ -49267,7 +49475,7 @@ function probeLocalInstall(projectRoot) {
|
|
|
49267
49475
|
if (packageDir) {
|
|
49268
49476
|
let version2;
|
|
49269
49477
|
try {
|
|
49270
|
-
const pkg = JSON.parse(
|
|
49478
|
+
const pkg = JSON.parse(fs24.readFileSync(path34.join(packageDir, "package.json"), "utf8"));
|
|
49271
49479
|
version2 = pkg.version ?? null;
|
|
49272
49480
|
} catch {
|
|
49273
49481
|
version2 = null;
|
|
@@ -49310,10 +49518,10 @@ function detectGlobalPackageManager() {
|
|
|
49310
49518
|
return BUN_GLOBAL_ROOT.test(root) ? "bun" : lockfileOwnerOf(root) ?? "yarn";
|
|
49311
49519
|
}
|
|
49312
49520
|
if (process.platform === "win32") {
|
|
49313
|
-
if (
|
|
49521
|
+
if (fs25.existsSync(path35.join(npmCopyBeside(path35.dirname(binaryPath)), "package.json"))) {
|
|
49314
49522
|
return "npm";
|
|
49315
49523
|
}
|
|
49316
|
-
if (
|
|
49524
|
+
if (fs25.existsSync(binaryPath.replace(/\.exe$/i, "") + ".bunx")) return "bun";
|
|
49317
49525
|
}
|
|
49318
49526
|
const shim = readShimScript(binaryPath);
|
|
49319
49527
|
if (shim === null || !/node_modules[\\/]/.test(shim)) return "npm";
|
|
@@ -49322,23 +49530,23 @@ function detectGlobalPackageManager() {
|
|
|
49322
49530
|
return (target ? lockfileOwnerOf(target) : null) ?? "yarn";
|
|
49323
49531
|
}
|
|
49324
49532
|
function lockfileOwnerOf(root) {
|
|
49325
|
-
for (let dir =
|
|
49533
|
+
for (let dir = path35.dirname(root); path35.dirname(dir) !== dir; dir = path35.dirname(dir)) {
|
|
49326
49534
|
const pm = pmFromLockfile(dir);
|
|
49327
49535
|
if (pm) return pm;
|
|
49328
49536
|
}
|
|
49329
49537
|
return null;
|
|
49330
49538
|
}
|
|
49331
49539
|
function npmCopyBeside(binDir) {
|
|
49332
|
-
return process.platform === "win32" ?
|
|
49540
|
+
return process.platform === "win32" ? path35.join(binDir, "node_modules", PACKAGE_NAME) : path35.join(path35.dirname(binDir), "lib", "node_modules", PACKAGE_NAME);
|
|
49333
49541
|
}
|
|
49334
49542
|
function isInNpmLayout(binaryPath, root) {
|
|
49335
49543
|
const realRoot = canonicalPath(root);
|
|
49336
49544
|
let link2 = binaryPath;
|
|
49337
49545
|
for (let hop = 0; hop < 40; hop++) {
|
|
49338
|
-
const binDir = canonicalPath(
|
|
49546
|
+
const binDir = canonicalPath(path35.dirname(link2));
|
|
49339
49547
|
if (canonicalPath(npmCopyBeside(binDir)) === realRoot) return true;
|
|
49340
49548
|
try {
|
|
49341
|
-
link2 =
|
|
49549
|
+
link2 = path35.resolve(binDir, fs25.readlinkSync(link2));
|
|
49342
49550
|
} catch {
|
|
49343
49551
|
return false;
|
|
49344
49552
|
}
|
|
@@ -49354,7 +49562,7 @@ function asKnownPm(name) {
|
|
|
49354
49562
|
}
|
|
49355
49563
|
function pmFromPackageManagerField(dir) {
|
|
49356
49564
|
try {
|
|
49357
|
-
const pkg = JSON.parse(
|
|
49565
|
+
const pkg = JSON.parse(fs25.readFileSync(path35.join(dir, "package.json"), "utf8"));
|
|
49358
49566
|
if (typeof pkg.packageManager === "string") {
|
|
49359
49567
|
return asKnownPm(pkg.packageManager.split("@")[0]);
|
|
49360
49568
|
}
|
|
@@ -49365,7 +49573,7 @@ function pmFromPackageManagerField(dir) {
|
|
|
49365
49573
|
}
|
|
49366
49574
|
function pmFromDevEngines(dir) {
|
|
49367
49575
|
try {
|
|
49368
|
-
const pkg = JSON.parse(
|
|
49576
|
+
const pkg = JSON.parse(fs25.readFileSync(path35.join(dir, "package.json"), "utf8"));
|
|
49369
49577
|
const devEnginesPm = pkg.devEngines?.packageManager;
|
|
49370
49578
|
const names = /* @__PURE__ */ new Set();
|
|
49371
49579
|
for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
|
|
@@ -49378,7 +49586,7 @@ function pmFromDevEngines(dir) {
|
|
|
49378
49586
|
}
|
|
49379
49587
|
}
|
|
49380
49588
|
function pmFromLockfile(dir) {
|
|
49381
|
-
const has = (file2) =>
|
|
49589
|
+
const has = (file2) => fs25.existsSync(path35.join(dir, file2));
|
|
49382
49590
|
if (has("pnpm-lock.yaml")) return "pnpm";
|
|
49383
49591
|
if (has("yarn.lock")) return "yarn";
|
|
49384
49592
|
if (has("bun.lock") || has("bun.lockb")) return "bun";
|
|
@@ -49386,15 +49594,15 @@ function pmFromLockfile(dir) {
|
|
|
49386
49594
|
return null;
|
|
49387
49595
|
}
|
|
49388
49596
|
function pmFromWorkspaceMarker(dir) {
|
|
49389
|
-
return
|
|
49597
|
+
return fs25.existsSync(path35.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
|
|
49390
49598
|
}
|
|
49391
49599
|
function detectProjectPackageManager(projectRoot) {
|
|
49392
|
-
let dir =
|
|
49600
|
+
let dir = path35.resolve(projectRoot);
|
|
49393
49601
|
for (; ; ) {
|
|
49394
49602
|
const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
|
|
49395
49603
|
if (pm) return pm;
|
|
49396
|
-
if (
|
|
49397
|
-
const parent =
|
|
49604
|
+
if (fs25.existsSync(path35.join(dir, ".git"))) break;
|
|
49605
|
+
const parent = path35.dirname(dir);
|
|
49398
49606
|
if (parent === dir) break;
|
|
49399
49607
|
dir = parent;
|
|
49400
49608
|
}
|
|
@@ -49426,15 +49634,15 @@ function projectInstallCommand(pm) {
|
|
|
49426
49634
|
}
|
|
49427
49635
|
|
|
49428
49636
|
// ../argent-installer/src/install-record.ts
|
|
49429
|
-
import * as
|
|
49430
|
-
import * as
|
|
49637
|
+
import * as fs26 from "node:fs";
|
|
49638
|
+
import * as path36 from "node:path";
|
|
49431
49639
|
function getInstallRecordPath(projectRoot) {
|
|
49432
|
-
return
|
|
49640
|
+
return path36.join(projectRoot, ".argent", "install.json");
|
|
49433
49641
|
}
|
|
49434
49642
|
function readInstallRecord(projectRoot) {
|
|
49435
49643
|
try {
|
|
49436
49644
|
const parsed = JSON.parse(
|
|
49437
|
-
|
|
49645
|
+
fs26.readFileSync(getInstallRecordPath(projectRoot), "utf8")
|
|
49438
49646
|
);
|
|
49439
49647
|
if (parsed && (parsed.mode === "local" || parsed.mode === "global")) return parsed;
|
|
49440
49648
|
return null;
|
|
@@ -49451,16 +49659,16 @@ function resolveInstallMode(projectRoot) {
|
|
|
49451
49659
|
// ../argent-installer/src/utils.ts
|
|
49452
49660
|
var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
|
|
49453
49661
|
function resolveBundledDir(dirName) {
|
|
49454
|
-
const packagedDir =
|
|
49455
|
-
if (
|
|
49456
|
-
return
|
|
49662
|
+
const packagedDir = path37.join(PACKAGE_ROOT, dirName);
|
|
49663
|
+
if (fs27.existsSync(packagedDir)) return packagedDir;
|
|
49664
|
+
return path37.resolve(PACKAGE_ROOT, "..", "skills", dirName);
|
|
49457
49665
|
}
|
|
49458
49666
|
var SKILLS_DIR = resolveBundledDir("skills");
|
|
49459
49667
|
var RULES_DIR = resolveBundledDir("rules");
|
|
49460
49668
|
var AGENTS_DIR = resolveBundledDir("agents");
|
|
49461
49669
|
function listBundledSkills(skillsDir = SKILLS_DIR) {
|
|
49462
49670
|
try {
|
|
49463
|
-
return
|
|
49671
|
+
return fs27.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs27.existsSync(path37.join(skillsDir, name, "SKILL.md"))).sort();
|
|
49464
49672
|
} catch {
|
|
49465
49673
|
return [];
|
|
49466
49674
|
}
|
|
@@ -49514,21 +49722,21 @@ var PROJECT_ROOT_MARKERS = [
|
|
|
49514
49722
|
"opencode.jsonc",
|
|
49515
49723
|
"skills-lock.json"
|
|
49516
49724
|
];
|
|
49517
|
-
function resolveProjectRoot2(startDir, homeDir =
|
|
49518
|
-
const initialDir =
|
|
49725
|
+
function resolveProjectRoot2(startDir, homeDir = os7.homedir()) {
|
|
49726
|
+
const initialDir = path37.resolve(startDir);
|
|
49519
49727
|
const home2 = canonicalPath(homeDir);
|
|
49520
49728
|
let currentDir = initialDir;
|
|
49521
49729
|
while (true) {
|
|
49522
49730
|
if (currentDir !== initialDir && canonicalPath(currentDir) === home2) {
|
|
49523
49731
|
return initialDir;
|
|
49524
49732
|
}
|
|
49525
|
-
if (PROJECT_ROOT_MARKERS.some((marker) =>
|
|
49733
|
+
if (PROJECT_ROOT_MARKERS.some((marker) => fs27.existsSync(path37.join(currentDir, marker)))) {
|
|
49526
49734
|
return currentDir;
|
|
49527
49735
|
}
|
|
49528
|
-
if (
|
|
49736
|
+
if (fs27.existsSync(path37.join(currentDir, ".git"))) {
|
|
49529
49737
|
return currentDir;
|
|
49530
49738
|
}
|
|
49531
|
-
const parentDir =
|
|
49739
|
+
const parentDir = path37.dirname(currentDir);
|
|
49532
49740
|
if (parentDir === currentDir) {
|
|
49533
49741
|
return initialDir;
|
|
49534
49742
|
}
|
|
@@ -49536,20 +49744,20 @@ function resolveProjectRoot2(startDir, homeDir = os6.homedir()) {
|
|
|
49536
49744
|
}
|
|
49537
49745
|
}
|
|
49538
49746
|
function readToml(filePath) {
|
|
49539
|
-
if (!
|
|
49747
|
+
if (!fs27.existsSync(filePath)) return {};
|
|
49540
49748
|
try {
|
|
49541
|
-
return parse5(
|
|
49749
|
+
return parse5(fs27.readFileSync(filePath, "utf8"));
|
|
49542
49750
|
} catch {
|
|
49543
49751
|
return {};
|
|
49544
49752
|
}
|
|
49545
49753
|
}
|
|
49546
49754
|
function writeToml(filePath, data) {
|
|
49547
|
-
|
|
49548
|
-
|
|
49755
|
+
fs27.mkdirSync(path37.dirname(filePath), { recursive: true });
|
|
49756
|
+
fs27.writeFileSync(filePath, stringify(data) + "\n");
|
|
49549
49757
|
}
|
|
49550
49758
|
function readYaml(filePath) {
|
|
49551
|
-
if (!
|
|
49552
|
-
const text2 =
|
|
49759
|
+
if (!fs27.existsSync(filePath)) return new import_yaml5.Document({});
|
|
49760
|
+
const text2 = fs27.readFileSync(filePath, "utf8");
|
|
49553
49761
|
const doc = (0, import_yaml5.parseDocument)(text2);
|
|
49554
49762
|
if (doc.errors.length > 0) {
|
|
49555
49763
|
const messages = doc.errors.map((e) => e.message).join("; ");
|
|
@@ -49558,20 +49766,20 @@ function readYaml(filePath) {
|
|
|
49558
49766
|
return doc;
|
|
49559
49767
|
}
|
|
49560
49768
|
function writeYaml(filePath, doc) {
|
|
49561
|
-
|
|
49562
|
-
|
|
49769
|
+
fs27.mkdirSync(path37.dirname(filePath), { recursive: true });
|
|
49770
|
+
fs27.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
|
|
49563
49771
|
}
|
|
49564
49772
|
function readJson(filePath) {
|
|
49565
|
-
if (!
|
|
49773
|
+
if (!fs27.existsSync(filePath)) return {};
|
|
49566
49774
|
try {
|
|
49567
|
-
return JSON.parse(
|
|
49775
|
+
return JSON.parse(fs27.readFileSync(filePath, "utf8"));
|
|
49568
49776
|
} catch {
|
|
49569
49777
|
return {};
|
|
49570
49778
|
}
|
|
49571
49779
|
}
|
|
49572
49780
|
function writeJson(filePath, data) {
|
|
49573
|
-
|
|
49574
|
-
|
|
49781
|
+
fs27.mkdirSync(path37.dirname(filePath), { recursive: true });
|
|
49782
|
+
fs27.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
|
|
49575
49783
|
}
|
|
49576
49784
|
var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
|
|
49577
49785
|
function setJsoncIn(text2, jsonPath, value) {
|
|
@@ -49579,8 +49787,8 @@ function setJsoncIn(text2, jsonPath, value) {
|
|
|
49579
49787
|
return applyEdits(text2, edits);
|
|
49580
49788
|
}
|
|
49581
49789
|
function readJsoncFileRaw(filePath) {
|
|
49582
|
-
if (!
|
|
49583
|
-
let text2 =
|
|
49790
|
+
if (!fs27.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
|
|
49791
|
+
let text2 = fs27.readFileSync(filePath, "utf8");
|
|
49584
49792
|
const hadBom = text2.charCodeAt(0) === 65279;
|
|
49585
49793
|
if (hadBom) text2 = text2.slice(1);
|
|
49586
49794
|
const wasEmpty = text2.trim() === "";
|
|
@@ -49600,18 +49808,18 @@ function isEmptyPlainObject(value) {
|
|
|
49600
49808
|
}
|
|
49601
49809
|
function rmEmptyDir(dirPath) {
|
|
49602
49810
|
try {
|
|
49603
|
-
if (!
|
|
49604
|
-
if (!
|
|
49605
|
-
if (
|
|
49606
|
-
|
|
49811
|
+
if (!fs27.existsSync(dirPath)) return false;
|
|
49812
|
+
if (!fs27.statSync(dirPath).isDirectory()) return false;
|
|
49813
|
+
if (fs27.readdirSync(dirPath).length > 0) return false;
|
|
49814
|
+
fs27.rmdirSync(dirPath);
|
|
49607
49815
|
return true;
|
|
49608
49816
|
} catch {
|
|
49609
49817
|
return false;
|
|
49610
49818
|
}
|
|
49611
49819
|
}
|
|
49612
49820
|
function readJsonc(filePath) {
|
|
49613
|
-
if (!
|
|
49614
|
-
let raw =
|
|
49821
|
+
if (!fs27.existsSync(filePath)) return {};
|
|
49822
|
+
let raw = fs27.readFileSync(filePath, "utf8");
|
|
49615
49823
|
if (raw.charCodeAt(0) === 65279) raw = raw.slice(1);
|
|
49616
49824
|
if (raw.trim() === "") return {};
|
|
49617
49825
|
const parsed = parse7(raw, [], { allowTrailingComma: true });
|
|
@@ -49632,7 +49840,7 @@ function yamlSyntaxErrorLine(raw) {
|
|
|
49632
49840
|
function findConfigSyntaxErrorLine(filePath, jsonOptions) {
|
|
49633
49841
|
let raw;
|
|
49634
49842
|
try {
|
|
49635
|
-
raw =
|
|
49843
|
+
raw = fs27.readFileSync(filePath, "utf8");
|
|
49636
49844
|
} catch {
|
|
49637
49845
|
return null;
|
|
49638
49846
|
}
|
|
@@ -49658,25 +49866,25 @@ function editJsoncFile(filePath, jsonPath, value) {
|
|
|
49658
49866
|
}
|
|
49659
49867
|
const parsed = parse7(text2, [], { allowTrailingComma: true });
|
|
49660
49868
|
if (isEmptyPlainObject(parsed)) {
|
|
49661
|
-
|
|
49662
|
-
rmEmptyDir(
|
|
49869
|
+
fs27.rmSync(filePath, { force: true });
|
|
49870
|
+
rmEmptyDir(path37.dirname(filePath));
|
|
49663
49871
|
return;
|
|
49664
49872
|
}
|
|
49665
|
-
|
|
49873
|
+
fs27.mkdirSync(path37.dirname(filePath), { recursive: true });
|
|
49666
49874
|
const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
|
|
49667
|
-
|
|
49875
|
+
fs27.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
|
|
49668
49876
|
}
|
|
49669
49877
|
function dirExists(p) {
|
|
49670
49878
|
try {
|
|
49671
|
-
return
|
|
49879
|
+
return fs27.statSync(p).isDirectory();
|
|
49672
49880
|
} catch {
|
|
49673
49881
|
return false;
|
|
49674
49882
|
}
|
|
49675
49883
|
}
|
|
49676
49884
|
function getInstalledVersion() {
|
|
49677
49885
|
try {
|
|
49678
|
-
const pkgPath =
|
|
49679
|
-
const pkg = JSON.parse(
|
|
49886
|
+
const pkgPath = path37.join(PACKAGE_ROOT, "package.json");
|
|
49887
|
+
const pkg = JSON.parse(fs27.readFileSync(pkgPath, "utf8"));
|
|
49680
49888
|
return pkg.version ?? null;
|
|
49681
49889
|
} catch {
|
|
49682
49890
|
return null;
|
|
@@ -49695,7 +49903,7 @@ function escapeStringRegexp(string4) {
|
|
|
49695
49903
|
}
|
|
49696
49904
|
|
|
49697
49905
|
// ../argent-installer/src/mcp-configs.ts
|
|
49698
|
-
var TOOL_SERVER_BUNDLE =
|
|
49906
|
+
var TOOL_SERVER_BUNDLE = path38.join(import.meta.dirname, "tool-server.cjs");
|
|
49699
49907
|
function getAvailableToolIds() {
|
|
49700
49908
|
const out = execFileSync8("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
|
|
49701
49909
|
const tools2 = JSON.parse(out);
|
|
@@ -49721,10 +49929,10 @@ function hasEnv(entry) {
|
|
|
49721
49929
|
}
|
|
49722
49930
|
function removeDirIfEmpty(dirPath) {
|
|
49723
49931
|
try {
|
|
49724
|
-
if (!
|
|
49725
|
-
if (!
|
|
49726
|
-
if (
|
|
49727
|
-
|
|
49932
|
+
if (!fs28.existsSync(dirPath)) return;
|
|
49933
|
+
if (!fs28.statSync(dirPath).isDirectory()) return;
|
|
49934
|
+
if (fs28.readdirSync(dirPath).length > 0) return;
|
|
49935
|
+
fs28.rmdirSync(dirPath);
|
|
49728
49936
|
} catch {
|
|
49729
49937
|
}
|
|
49730
49938
|
}
|
|
@@ -49755,12 +49963,12 @@ function normalizeServerEntry(raw) {
|
|
|
49755
49963
|
}
|
|
49756
49964
|
function isPinnedGlobalEntry(entry) {
|
|
49757
49965
|
const [cli, subcommand] = entry.args;
|
|
49758
|
-
return
|
|
49966
|
+
return path38.isAbsolute(entry.command) && path38.basename(entry.command) === "node" && entry.args.length === 2 && subcommand === "mcp" && path38.isAbsolute(cli) && cli.includes(`/node_modules/${PACKAGE_NAME}/`);
|
|
49759
49967
|
}
|
|
49760
49968
|
function writeTomlOrRemove(filePath, data) {
|
|
49761
49969
|
if (Object.keys(data).length === 0) {
|
|
49762
|
-
|
|
49763
|
-
removeDirIfEmpty(
|
|
49970
|
+
fs28.rmSync(filePath, { force: true });
|
|
49971
|
+
removeDirIfEmpty(path38.dirname(filePath));
|
|
49764
49972
|
return;
|
|
49765
49973
|
}
|
|
49766
49974
|
writeToml(filePath, data);
|
|
@@ -49769,12 +49977,12 @@ function dirHasEditorEvidence(dir, looksArgentOnly) {
|
|
|
49769
49977
|
return dirExists(dir) && !looksArgentOnly(dir);
|
|
49770
49978
|
}
|
|
49771
49979
|
function fileHasEditorEvidence(filePath, looksArgentOnly) {
|
|
49772
|
-
return
|
|
49980
|
+
return fs28.existsSync(filePath) && !looksArgentOnly(filePath);
|
|
49773
49981
|
}
|
|
49774
49982
|
function parseJsoncStrict(filePath) {
|
|
49775
49983
|
let raw;
|
|
49776
49984
|
try {
|
|
49777
|
-
raw =
|
|
49985
|
+
raw = fs28.readFileSync(filePath, "utf8");
|
|
49778
49986
|
} catch {
|
|
49779
49987
|
return null;
|
|
49780
49988
|
}
|
|
@@ -49787,14 +49995,14 @@ function parseJsoncStrict(filePath) {
|
|
|
49787
49995
|
}
|
|
49788
49996
|
function parseTomlStrict(filePath) {
|
|
49789
49997
|
try {
|
|
49790
|
-
return parse5(
|
|
49998
|
+
return parse5(fs28.readFileSync(filePath, "utf8"));
|
|
49791
49999
|
} catch {
|
|
49792
50000
|
return null;
|
|
49793
50001
|
}
|
|
49794
50002
|
}
|
|
49795
50003
|
function parseYamlStrict(filePath) {
|
|
49796
50004
|
try {
|
|
49797
|
-
const parsed = (0, import_yaml6.parse)(
|
|
50005
|
+
const parsed = (0, import_yaml6.parse)(fs28.readFileSync(filePath, "utf8"));
|
|
49798
50006
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
49799
50007
|
return parsed;
|
|
49800
50008
|
} catch {
|
|
@@ -49817,7 +50025,7 @@ function bundledManagedNames(kind) {
|
|
|
49817
50025
|
if (cached3) return cached3;
|
|
49818
50026
|
let names;
|
|
49819
50027
|
try {
|
|
49820
|
-
names = new Set(
|
|
50028
|
+
names = new Set(fs28.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
|
|
49821
50029
|
} catch {
|
|
49822
50030
|
names = /* @__PURE__ */ new Set();
|
|
49823
50031
|
}
|
|
@@ -49828,7 +50036,7 @@ function bundledManagedNames(kind) {
|
|
|
49828
50036
|
function managedDirLooksArgentOnly(dir, kind) {
|
|
49829
50037
|
let entries;
|
|
49830
50038
|
try {
|
|
49831
|
-
entries =
|
|
50039
|
+
entries = fs28.readdirSync(dir);
|
|
49832
50040
|
} catch {
|
|
49833
50041
|
return false;
|
|
49834
50042
|
}
|
|
@@ -49840,13 +50048,13 @@ function managedDirLooksArgentOnly(dir, kind) {
|
|
|
49840
50048
|
function cursorDirLooksArgentOnly(dir) {
|
|
49841
50049
|
let entries;
|
|
49842
50050
|
try {
|
|
49843
|
-
entries =
|
|
50051
|
+
entries = fs28.readdirSync(dir);
|
|
49844
50052
|
} catch {
|
|
49845
50053
|
return false;
|
|
49846
50054
|
}
|
|
49847
50055
|
if (entries.length === 0) return false;
|
|
49848
50056
|
return entries.every((entry) => {
|
|
49849
|
-
const full =
|
|
50057
|
+
const full = path38.join(dir, entry);
|
|
49850
50058
|
if (entry === "mcp.json") {
|
|
49851
50059
|
return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
49852
50060
|
}
|
|
@@ -49879,13 +50087,13 @@ function claudeSettingsLooksArgentOnly(filePath) {
|
|
|
49879
50087
|
function claudeDirLooksArgentOnly(dir) {
|
|
49880
50088
|
let entries;
|
|
49881
50089
|
try {
|
|
49882
|
-
entries =
|
|
50090
|
+
entries = fs28.readdirSync(dir);
|
|
49883
50091
|
} catch {
|
|
49884
50092
|
return false;
|
|
49885
50093
|
}
|
|
49886
50094
|
if (entries.length === 0) return false;
|
|
49887
50095
|
return entries.every((entry) => {
|
|
49888
|
-
const full =
|
|
50096
|
+
const full = path38.join(dir, entry);
|
|
49889
50097
|
if (entry === "settings.json") return claudeSettingsLooksArgentOnly(full);
|
|
49890
50098
|
if (entry === "rules" || entry === "agents" || entry === "skills") {
|
|
49891
50099
|
return managedDirLooksArgentOnly(full, entry);
|
|
@@ -49896,25 +50104,25 @@ function claudeDirLooksArgentOnly(dir) {
|
|
|
49896
50104
|
function vscodeDirLooksArgentOnly(dir) {
|
|
49897
50105
|
let entries;
|
|
49898
50106
|
try {
|
|
49899
|
-
entries =
|
|
50107
|
+
entries = fs28.readdirSync(dir);
|
|
49900
50108
|
} catch {
|
|
49901
50109
|
return false;
|
|
49902
50110
|
}
|
|
49903
50111
|
if (entries.length === 0) return false;
|
|
49904
50112
|
return entries.every(
|
|
49905
|
-
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(
|
|
50113
|
+
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(path38.join(dir, entry), "servers")
|
|
49906
50114
|
);
|
|
49907
50115
|
}
|
|
49908
50116
|
function windsurfDirLooksArgentOnly(dir) {
|
|
49909
50117
|
let entries;
|
|
49910
50118
|
try {
|
|
49911
|
-
entries =
|
|
50119
|
+
entries = fs28.readdirSync(dir);
|
|
49912
50120
|
} catch {
|
|
49913
50121
|
return false;
|
|
49914
50122
|
}
|
|
49915
50123
|
if (entries.length === 0) return false;
|
|
49916
50124
|
return entries.every(
|
|
49917
|
-
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(
|
|
50125
|
+
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(path38.join(dir, entry), "mcpServers")
|
|
49918
50126
|
);
|
|
49919
50127
|
}
|
|
49920
50128
|
function zedSettingsLooksArgentOnly(filePath) {
|
|
@@ -49945,25 +50153,25 @@ function zedSettingsLooksArgentOnly(filePath) {
|
|
|
49945
50153
|
function zedDirLooksArgentOnly(dir) {
|
|
49946
50154
|
let entries;
|
|
49947
50155
|
try {
|
|
49948
|
-
entries =
|
|
50156
|
+
entries = fs28.readdirSync(dir);
|
|
49949
50157
|
} catch {
|
|
49950
50158
|
return false;
|
|
49951
50159
|
}
|
|
49952
50160
|
if (entries.length === 0) return false;
|
|
49953
50161
|
return entries.every(
|
|
49954
|
-
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(
|
|
50162
|
+
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(path38.join(dir, entry))
|
|
49955
50163
|
);
|
|
49956
50164
|
}
|
|
49957
50165
|
function geminiDirLooksArgentOnly(dir) {
|
|
49958
50166
|
let entries;
|
|
49959
50167
|
try {
|
|
49960
|
-
entries =
|
|
50168
|
+
entries = fs28.readdirSync(dir);
|
|
49961
50169
|
} catch {
|
|
49962
50170
|
return false;
|
|
49963
50171
|
}
|
|
49964
50172
|
if (entries.length === 0) return false;
|
|
49965
50173
|
return entries.every((entry) => {
|
|
49966
|
-
const full =
|
|
50174
|
+
const full = path38.join(dir, entry);
|
|
49967
50175
|
if (entry === "settings.json") return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
49968
50176
|
if (entry === "rules" || entry === "agents") return managedDirLooksArgentOnly(full, entry);
|
|
49969
50177
|
return false;
|
|
@@ -49982,48 +50190,48 @@ function hermesConfigLooksArgentOnly(filePath) {
|
|
|
49982
50190
|
function hermesDirLooksArgentOnly(dir) {
|
|
49983
50191
|
let entries;
|
|
49984
50192
|
try {
|
|
49985
|
-
entries =
|
|
50193
|
+
entries = fs28.readdirSync(dir);
|
|
49986
50194
|
} catch {
|
|
49987
50195
|
return false;
|
|
49988
50196
|
}
|
|
49989
50197
|
if (entries.length === 0) return false;
|
|
49990
50198
|
return entries.every(
|
|
49991
|
-
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(
|
|
50199
|
+
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(path38.join(dir, entry))
|
|
49992
50200
|
);
|
|
49993
50201
|
}
|
|
49994
50202
|
function kiroDirLooksArgentOnly(dir) {
|
|
49995
50203
|
let entries;
|
|
49996
50204
|
try {
|
|
49997
|
-
entries =
|
|
50205
|
+
entries = fs28.readdirSync(dir);
|
|
49998
50206
|
} catch {
|
|
49999
50207
|
return false;
|
|
50000
50208
|
}
|
|
50001
50209
|
if (entries.length === 0) return false;
|
|
50002
50210
|
return entries.every((entry) => {
|
|
50003
50211
|
if (entry !== "settings") return false;
|
|
50004
|
-
const settingsDir =
|
|
50212
|
+
const settingsDir = path38.join(dir, entry);
|
|
50005
50213
|
let settingsEntries;
|
|
50006
50214
|
try {
|
|
50007
|
-
settingsEntries =
|
|
50215
|
+
settingsEntries = fs28.readdirSync(settingsDir);
|
|
50008
50216
|
} catch {
|
|
50009
50217
|
return false;
|
|
50010
50218
|
}
|
|
50011
50219
|
if (settingsEntries.length === 0) return false;
|
|
50012
50220
|
return settingsEntries.every(
|
|
50013
|
-
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(
|
|
50221
|
+
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(path38.join(settingsDir, name), "mcpServers")
|
|
50014
50222
|
);
|
|
50015
50223
|
});
|
|
50016
50224
|
}
|
|
50017
50225
|
function codexDirLooksArgentOnly(dir) {
|
|
50018
50226
|
let entries;
|
|
50019
50227
|
try {
|
|
50020
|
-
entries =
|
|
50228
|
+
entries = fs28.readdirSync(dir);
|
|
50021
50229
|
} catch {
|
|
50022
50230
|
return false;
|
|
50023
50231
|
}
|
|
50024
50232
|
if (entries.length === 0) return false;
|
|
50025
50233
|
return entries.every((entry) => {
|
|
50026
|
-
const full =
|
|
50234
|
+
const full = path38.join(dir, entry);
|
|
50027
50235
|
if (entry === "config.toml") {
|
|
50028
50236
|
const config3 = parseTomlStrict(full);
|
|
50029
50237
|
if (config3 === null) return false;
|
|
@@ -50048,7 +50256,7 @@ function codexDirLooksArgentOnly(dir) {
|
|
|
50048
50256
|
});
|
|
50049
50257
|
}
|
|
50050
50258
|
function cursorPermissionsPath() {
|
|
50051
|
-
return
|
|
50259
|
+
return path38.join(homedir6(), ".cursor", "permissions.json");
|
|
50052
50260
|
}
|
|
50053
50261
|
function cursorPermissionsList() {
|
|
50054
50262
|
const list = readJsonc(cursorPermissionsPath()).mcpAllowlist;
|
|
@@ -50057,13 +50265,13 @@ function cursorPermissionsList() {
|
|
|
50057
50265
|
var cursorAdapter = {
|
|
50058
50266
|
name: "Cursor",
|
|
50059
50267
|
detect() {
|
|
50060
|
-
return dirHasEditorEvidence(
|
|
50268
|
+
return dirHasEditorEvidence(path38.join(homedir6(), ".cursor"), cursorDirLooksArgentOnly) || dirHasEditorEvidence(path38.join(process.cwd(), ".cursor"), cursorDirLooksArgentOnly);
|
|
50061
50269
|
},
|
|
50062
50270
|
projectPath(root) {
|
|
50063
|
-
return
|
|
50271
|
+
return path38.join(root, ".cursor", "mcp.json");
|
|
50064
50272
|
},
|
|
50065
50273
|
globalPath() {
|
|
50066
|
-
return
|
|
50274
|
+
return path38.join(homedir6(), ".cursor", "mcp.json");
|
|
50067
50275
|
},
|
|
50068
50276
|
// Read and written as JSONC through readJsonc / editJsoncFile: path-targeted
|
|
50069
50277
|
// text edits that preserve user comments and foreign servers.
|
|
@@ -50075,7 +50283,7 @@ var cursorAdapter = {
|
|
|
50075
50283
|
});
|
|
50076
50284
|
},
|
|
50077
50285
|
remove(configPath) {
|
|
50078
|
-
if (!
|
|
50286
|
+
if (!fs28.existsSync(configPath)) return false;
|
|
50079
50287
|
const config3 = readJsonc(configPath);
|
|
50080
50288
|
const servers = config3.mcpServers;
|
|
50081
50289
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -50083,7 +50291,7 @@ var cursorAdapter = {
|
|
|
50083
50291
|
return true;
|
|
50084
50292
|
},
|
|
50085
50293
|
getArgentEntry(configPath) {
|
|
50086
|
-
if (!
|
|
50294
|
+
if (!fs28.existsSync(configPath)) return null;
|
|
50087
50295
|
const config3 = readJsonc(configPath);
|
|
50088
50296
|
const servers = config3.mcpServers;
|
|
50089
50297
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -50108,7 +50316,7 @@ var cursorAdapter = {
|
|
|
50108
50316
|
removeAllowlist(_root, scope) {
|
|
50109
50317
|
if (scope !== "global") return;
|
|
50110
50318
|
const permPath = cursorPermissionsPath();
|
|
50111
|
-
if (!
|
|
50319
|
+
if (!fs28.existsSync(permPath)) return;
|
|
50112
50320
|
const config3 = readJsonc(permPath);
|
|
50113
50321
|
const list = Array.isArray(config3.mcpAllowlist) ? config3.mcpAllowlist : void 0;
|
|
50114
50322
|
if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
@@ -50121,7 +50329,7 @@ function claudeProjectKeysForRoot(projects, root) {
|
|
|
50121
50329
|
return Object.keys(projects).filter((key) => key === root || canonicalPath(key) === target);
|
|
50122
50330
|
}
|
|
50123
50331
|
function claudeDisabledListFinding(settingsPath, label, projectConfined) {
|
|
50124
|
-
if (!
|
|
50332
|
+
if (!fs28.existsSync(settingsPath)) return null;
|
|
50125
50333
|
const disabled = readJson(settingsPath).disabledMcpjsonServers;
|
|
50126
50334
|
if (!Array.isArray(disabled) || !disabled.includes(MCP_SERVER_KEY)) return null;
|
|
50127
50335
|
return {
|
|
@@ -50149,13 +50357,13 @@ var claudeAdapter = {
|
|
|
50149
50357
|
name: "Claude Code",
|
|
50150
50358
|
detect() {
|
|
50151
50359
|
const mcpJsonArgentOnly = (p) => jsonLooksArgentServerOnly(p, "mcpServers");
|
|
50152
|
-
return fileHasEditorEvidence(
|
|
50360
|
+
return fileHasEditorEvidence(path38.join(process.cwd(), ".mcp.json"), mcpJsonArgentOnly) || fileHasEditorEvidence(path38.join(homedir6(), ".claude.json"), mcpJsonArgentOnly) || dirHasEditorEvidence(path38.join(process.cwd(), ".claude"), claudeDirLooksArgentOnly) || dirHasEditorEvidence(path38.join(homedir6(), ".claude"), claudeDirLooksArgentOnly);
|
|
50153
50361
|
},
|
|
50154
50362
|
projectPath(root) {
|
|
50155
|
-
return
|
|
50363
|
+
return path38.join(root, ".mcp.json");
|
|
50156
50364
|
},
|
|
50157
50365
|
globalPath() {
|
|
50158
|
-
return
|
|
50366
|
+
return path38.join(homedir6(), ".claude.json");
|
|
50159
50367
|
},
|
|
50160
50368
|
// JSONC is a superset of JSON, so this config shares the one comment- and
|
|
50161
50369
|
// foreign-server-preserving write path (see the Cursor adapter).
|
|
@@ -50168,7 +50376,7 @@ var claudeAdapter = {
|
|
|
50168
50376
|
});
|
|
50169
50377
|
},
|
|
50170
50378
|
remove(configPath) {
|
|
50171
|
-
if (!
|
|
50379
|
+
if (!fs28.existsSync(configPath)) return false;
|
|
50172
50380
|
const config3 = readJsonc(configPath);
|
|
50173
50381
|
const servers = config3.mcpServers;
|
|
50174
50382
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -50182,7 +50390,7 @@ var claudeAdapter = {
|
|
|
50182
50390
|
return true;
|
|
50183
50391
|
},
|
|
50184
50392
|
getArgentEntry(configPath) {
|
|
50185
|
-
if (!
|
|
50393
|
+
if (!fs28.existsSync(configPath)) return null;
|
|
50186
50394
|
const config3 = readJsonc(configPath);
|
|
50187
50395
|
const servers = config3.mcpServers;
|
|
50188
50396
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -50195,7 +50403,7 @@ var claudeAdapter = {
|
|
|
50195
50403
|
// .mcp.json rejections (see claudeDisabledListFinding).
|
|
50196
50404
|
findShadowingConfigs(root, writtenScope) {
|
|
50197
50405
|
const findings = [];
|
|
50198
|
-
const claudeJsonPath =
|
|
50406
|
+
const claudeJsonPath = path38.join(homedir6(), ".claude.json");
|
|
50199
50407
|
const projects = readJson(claudeJsonPath).projects;
|
|
50200
50408
|
if (isRecord3(projects)) {
|
|
50201
50409
|
for (const key of claudeProjectKeysForRoot(projects, root)) {
|
|
@@ -50232,9 +50440,9 @@ var claudeAdapter = {
|
|
|
50232
50440
|
}
|
|
50233
50441
|
if (writtenScope === "local") {
|
|
50234
50442
|
const candidates = [
|
|
50235
|
-
[
|
|
50236
|
-
[
|
|
50237
|
-
[
|
|
50443
|
+
[path38.join(root, ".claude", "settings.json"), ".claude/settings.json", true],
|
|
50444
|
+
[path38.join(root, ".claude", "settings.local.json"), ".claude/settings.local.json", true],
|
|
50445
|
+
[path38.join(homedir6(), ".claude", "settings.json"), "~/.claude/settings.json", false]
|
|
50238
50446
|
];
|
|
50239
50447
|
for (const [settingsPath, label, projectConfined] of candidates) {
|
|
50240
50448
|
const finding = claudeDisabledListFinding(settingsPath, label, projectConfined);
|
|
@@ -50253,10 +50461,10 @@ var claudeAdapter = {
|
|
|
50253
50461
|
var vscodeAdapter = {
|
|
50254
50462
|
name: "VS Code",
|
|
50255
50463
|
detect() {
|
|
50256
|
-
return dirHasEditorEvidence(
|
|
50464
|
+
return dirHasEditorEvidence(path38.join(process.cwd(), ".vscode"), vscodeDirLooksArgentOnly) || dirExists(path38.join(homedir6(), ".vscode"));
|
|
50257
50465
|
},
|
|
50258
50466
|
projectPath(root) {
|
|
50259
|
-
return
|
|
50467
|
+
return path38.join(root, ".vscode", "mcp.json");
|
|
50260
50468
|
},
|
|
50261
50469
|
globalPath() {
|
|
50262
50470
|
return null;
|
|
@@ -50272,7 +50480,7 @@ var vscodeAdapter = {
|
|
|
50272
50480
|
});
|
|
50273
50481
|
},
|
|
50274
50482
|
remove(configPath) {
|
|
50275
|
-
if (!
|
|
50483
|
+
if (!fs28.existsSync(configPath)) return false;
|
|
50276
50484
|
const config3 = readJsonc(configPath);
|
|
50277
50485
|
const servers = config3.servers;
|
|
50278
50486
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -50280,7 +50488,7 @@ var vscodeAdapter = {
|
|
|
50280
50488
|
return true;
|
|
50281
50489
|
},
|
|
50282
50490
|
getArgentEntry(configPath) {
|
|
50283
|
-
if (!
|
|
50491
|
+
if (!fs28.existsSync(configPath)) return null;
|
|
50284
50492
|
const config3 = readJsonc(configPath);
|
|
50285
50493
|
const servers = config3.servers;
|
|
50286
50494
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -50293,7 +50501,7 @@ var vscodeAdapter = {
|
|
|
50293
50501
|
findShadowingConfigs(_root, _writtenScope) {
|
|
50294
50502
|
const findings = [];
|
|
50295
50503
|
for (const userDir of vscodeUserDirs()) {
|
|
50296
|
-
const configPath =
|
|
50504
|
+
const configPath = path38.join(userDir, "mcp.json");
|
|
50297
50505
|
const entry = this.getArgentEntry(configPath);
|
|
50298
50506
|
if (!entry) continue;
|
|
50299
50507
|
findings.push({
|
|
@@ -50310,16 +50518,16 @@ var vscodeAdapter = {
|
|
|
50310
50518
|
function vscodeUserDirs() {
|
|
50311
50519
|
const bases = [];
|
|
50312
50520
|
if (process.platform === "darwin") {
|
|
50313
|
-
bases.push(
|
|
50521
|
+
bases.push(path38.join(homedir6(), "Library", "Application Support"));
|
|
50314
50522
|
} else if (process.platform === "win32") {
|
|
50315
50523
|
if (process.env.APPDATA) bases.push(process.env.APPDATA);
|
|
50316
50524
|
} else {
|
|
50317
|
-
bases.push(
|
|
50525
|
+
bases.push(path38.join(homedir6(), ".config"));
|
|
50318
50526
|
}
|
|
50319
50527
|
const dirs = [];
|
|
50320
50528
|
for (const base of bases) {
|
|
50321
50529
|
for (const product of ["Code", "Code - Insiders"]) {
|
|
50322
|
-
const dir =
|
|
50530
|
+
const dir = path38.join(base, product, "User");
|
|
50323
50531
|
if (dirExists(dir)) dirs.push(dir);
|
|
50324
50532
|
}
|
|
50325
50533
|
}
|
|
@@ -50327,18 +50535,18 @@ function vscodeUserDirs() {
|
|
|
50327
50535
|
}
|
|
50328
50536
|
function devinUserConfigPath() {
|
|
50329
50537
|
if (process.platform === "win32") {
|
|
50330
|
-
const appData = process.env.APPDATA ||
|
|
50331
|
-
return
|
|
50538
|
+
const appData = process.env.APPDATA || path38.join(homedir6(), "AppData", "Roaming");
|
|
50539
|
+
return path38.join(appData, "devin", "config.json");
|
|
50332
50540
|
}
|
|
50333
50541
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
50334
|
-
return
|
|
50542
|
+
return path38.join(xdg || path38.join(homedir6(), ".config"), "devin", "config.json");
|
|
50335
50543
|
}
|
|
50336
50544
|
var windsurfAdapter = {
|
|
50337
50545
|
name: "Devin Desktop",
|
|
50338
50546
|
telemetryName: "windsurf",
|
|
50339
50547
|
detect() {
|
|
50340
50548
|
return dirHasEditorEvidence(
|
|
50341
|
-
|
|
50549
|
+
path38.join(homedir6(), ".codeium", "windsurf"),
|
|
50342
50550
|
windsurfDirLooksArgentOnly
|
|
50343
50551
|
);
|
|
50344
50552
|
},
|
|
@@ -50346,7 +50554,7 @@ var windsurfAdapter = {
|
|
|
50346
50554
|
return null;
|
|
50347
50555
|
},
|
|
50348
50556
|
globalPath() {
|
|
50349
|
-
return
|
|
50557
|
+
return path38.join(homedir6(), ".codeium", "windsurf", "mcp_config.json");
|
|
50350
50558
|
},
|
|
50351
50559
|
// JSONC-safe writes (see the Cursor adapter).
|
|
50352
50560
|
write(configPath, entry) {
|
|
@@ -50358,7 +50566,7 @@ var windsurfAdapter = {
|
|
|
50358
50566
|
});
|
|
50359
50567
|
},
|
|
50360
50568
|
remove(configPath) {
|
|
50361
|
-
if (!
|
|
50569
|
+
if (!fs28.existsSync(configPath)) return false;
|
|
50362
50570
|
const config3 = readJsonc(configPath);
|
|
50363
50571
|
const servers = config3.mcpServers;
|
|
50364
50572
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -50366,7 +50574,7 @@ var windsurfAdapter = {
|
|
|
50366
50574
|
return true;
|
|
50367
50575
|
},
|
|
50368
50576
|
getArgentEntry(configPath) {
|
|
50369
|
-
if (!
|
|
50577
|
+
if (!fs28.existsSync(configPath)) return null;
|
|
50370
50578
|
const config3 = readJsonc(configPath);
|
|
50371
50579
|
const servers = config3.mcpServers;
|
|
50372
50580
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -50378,7 +50586,7 @@ var windsurfAdapter = {
|
|
|
50378
50586
|
// servers survive. alwaysAllow serves the legacy Cascade agent; the Devin
|
|
50379
50587
|
// agent needs its own permission rule.
|
|
50380
50588
|
addAllowlist() {
|
|
50381
|
-
const configPath =
|
|
50589
|
+
const configPath = path38.join(homedir6(), ".codeium", "windsurf", "mcp_config.json");
|
|
50382
50590
|
const config3 = readJsonc(configPath);
|
|
50383
50591
|
const servers = config3.mcpServers;
|
|
50384
50592
|
if (!servers?.[MCP_SERVER_KEY]) return;
|
|
@@ -50388,8 +50596,8 @@ var windsurfAdapter = {
|
|
|
50388
50596
|
removeAllowlist(_root, scope) {
|
|
50389
50597
|
if (scope !== "global") return;
|
|
50390
50598
|
removeAllowRule(devinUserConfigPath(), DEVIN_PERMISSION_RULE);
|
|
50391
|
-
const configPath =
|
|
50392
|
-
if (!
|
|
50599
|
+
const configPath = path38.join(homedir6(), ".codeium", "windsurf", "mcp_config.json");
|
|
50600
|
+
if (!fs28.existsSync(configPath)) return;
|
|
50393
50601
|
const config3 = readJsonc(configPath);
|
|
50394
50602
|
const servers = config3.mcpServers;
|
|
50395
50603
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -50400,13 +50608,13 @@ var windsurfAdapter = {
|
|
|
50400
50608
|
var zedAdapter = {
|
|
50401
50609
|
name: "Zed",
|
|
50402
50610
|
detect() {
|
|
50403
|
-
return dirHasEditorEvidence(
|
|
50611
|
+
return dirHasEditorEvidence(path38.join(homedir6(), ".config", "zed"), zedDirLooksArgentOnly);
|
|
50404
50612
|
},
|
|
50405
50613
|
projectPath(root) {
|
|
50406
|
-
return
|
|
50614
|
+
return path38.join(root, ".zed", "settings.json");
|
|
50407
50615
|
},
|
|
50408
50616
|
globalPath() {
|
|
50409
|
-
return
|
|
50617
|
+
return path38.join(homedir6(), ".config", "zed", "settings.json");
|
|
50410
50618
|
},
|
|
50411
50619
|
// Read and written as JSONC through readJsonc / editJsoncFile so comments and
|
|
50412
50620
|
// formatting outside the touched key survive (see the Cursor adapter).
|
|
@@ -50419,7 +50627,7 @@ var zedAdapter = {
|
|
|
50419
50627
|
});
|
|
50420
50628
|
},
|
|
50421
50629
|
remove(configPath) {
|
|
50422
|
-
if (!
|
|
50630
|
+
if (!fs28.existsSync(configPath)) return false;
|
|
50423
50631
|
const config3 = readJsonc(configPath);
|
|
50424
50632
|
const servers = config3.context_servers;
|
|
50425
50633
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -50427,7 +50635,7 @@ var zedAdapter = {
|
|
|
50427
50635
|
return true;
|
|
50428
50636
|
},
|
|
50429
50637
|
getArgentEntry(configPath) {
|
|
50430
|
-
if (!
|
|
50638
|
+
if (!fs28.existsSync(configPath)) return null;
|
|
50431
50639
|
const config3 = readJsonc(configPath);
|
|
50432
50640
|
const servers = config3.context_servers;
|
|
50433
50641
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -50438,12 +50646,12 @@ var zedAdapter = {
|
|
|
50438
50646
|
// Zed has no server-level wildcard for MCP tools — each tool would need its
|
|
50439
50647
|
// own entry — so the global default is set to "allow" instead.
|
|
50440
50648
|
addAllowlist(root, scope) {
|
|
50441
|
-
const settingsPath = scope === "global" ?
|
|
50649
|
+
const settingsPath = scope === "global" ? path38.join(homedir6(), ".config", "zed", "settings.json") : path38.join(root, ".zed", "settings.json");
|
|
50442
50650
|
editJsoncFile(settingsPath, ["agent", "tool_permissions", "default"], "allow");
|
|
50443
50651
|
},
|
|
50444
50652
|
removeAllowlist(root, scope) {
|
|
50445
|
-
const settingsPath = scope === "global" ?
|
|
50446
|
-
if (!
|
|
50653
|
+
const settingsPath = scope === "global" ? path38.join(homedir6(), ".config", "zed", "settings.json") : path38.join(root, ".zed", "settings.json");
|
|
50654
|
+
if (!fs28.existsSync(settingsPath)) return;
|
|
50447
50655
|
const config3 = readJsonc(settingsPath);
|
|
50448
50656
|
const perms = config3.agent?.tool_permissions;
|
|
50449
50657
|
if (!perms || perms.default !== "allow") return;
|
|
@@ -50453,13 +50661,13 @@ var zedAdapter = {
|
|
|
50453
50661
|
var geminiAdapter = {
|
|
50454
50662
|
name: "Gemini",
|
|
50455
50663
|
detect() {
|
|
50456
|
-
return dirHasEditorEvidence(
|
|
50664
|
+
return dirHasEditorEvidence(path38.join(homedir6(), ".gemini"), geminiDirLooksArgentOnly) || dirHasEditorEvidence(path38.join(process.cwd(), ".gemini"), geminiDirLooksArgentOnly);
|
|
50457
50665
|
},
|
|
50458
50666
|
projectPath(root) {
|
|
50459
|
-
return
|
|
50667
|
+
return path38.join(root, ".gemini", "settings.json");
|
|
50460
50668
|
},
|
|
50461
50669
|
globalPath() {
|
|
50462
|
-
return
|
|
50670
|
+
return path38.join(homedir6(), ".gemini", "settings.json");
|
|
50463
50671
|
},
|
|
50464
50672
|
// JSONC-safe writes (see the Cursor adapter).
|
|
50465
50673
|
write(configPath, entry) {
|
|
@@ -50471,7 +50679,7 @@ var geminiAdapter = {
|
|
|
50471
50679
|
});
|
|
50472
50680
|
},
|
|
50473
50681
|
remove(configPath) {
|
|
50474
|
-
if (!
|
|
50682
|
+
if (!fs28.existsSync(configPath)) return false;
|
|
50475
50683
|
const config3 = readJsonc(configPath);
|
|
50476
50684
|
const servers = config3.mcpServers;
|
|
50477
50685
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -50479,7 +50687,7 @@ var geminiAdapter = {
|
|
|
50479
50687
|
return true;
|
|
50480
50688
|
},
|
|
50481
50689
|
getArgentEntry(configPath) {
|
|
50482
|
-
if (!
|
|
50690
|
+
if (!fs28.existsSync(configPath)) return null;
|
|
50483
50691
|
const config3 = readJsonc(configPath);
|
|
50484
50692
|
const servers = config3.mcpServers;
|
|
50485
50693
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -50501,7 +50709,7 @@ var geminiAdapter = {
|
|
|
50501
50709
|
},
|
|
50502
50710
|
removeAllowlist(root, scope) {
|
|
50503
50711
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
50504
|
-
if (!configPath || !
|
|
50712
|
+
if (!configPath || !fs28.existsSync(configPath)) {
|
|
50505
50713
|
return;
|
|
50506
50714
|
}
|
|
50507
50715
|
const config3 = readJsonc(configPath);
|
|
@@ -50515,13 +50723,13 @@ var CODEX_FILENAME = ".codex";
|
|
|
50515
50723
|
var codexAdapter = {
|
|
50516
50724
|
name: "Codex",
|
|
50517
50725
|
detect() {
|
|
50518
|
-
return dirHasEditorEvidence(
|
|
50726
|
+
return dirHasEditorEvidence(path38.join(homedir6(), CODEX_FILENAME), codexDirLooksArgentOnly) || dirHasEditorEvidence(path38.join(process.cwd(), CODEX_FILENAME), codexDirLooksArgentOnly);
|
|
50519
50727
|
},
|
|
50520
50728
|
projectPath(root) {
|
|
50521
|
-
return
|
|
50729
|
+
return path38.join(root, CODEX_FILENAME, "config.toml");
|
|
50522
50730
|
},
|
|
50523
50731
|
globalPath() {
|
|
50524
|
-
return
|
|
50732
|
+
return path38.join(homedir6(), CODEX_FILENAME, "config.toml");
|
|
50525
50733
|
},
|
|
50526
50734
|
write(configPath, entry) {
|
|
50527
50735
|
const config3 = readToml(configPath);
|
|
@@ -50537,7 +50745,7 @@ var codexAdapter = {
|
|
|
50537
50745
|
writeToml(configPath, config3);
|
|
50538
50746
|
},
|
|
50539
50747
|
remove(configPath) {
|
|
50540
|
-
if (!
|
|
50748
|
+
if (!fs28.existsSync(configPath)) return false;
|
|
50541
50749
|
const config3 = readToml(configPath);
|
|
50542
50750
|
const servers = config3.mcp_servers;
|
|
50543
50751
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -50547,7 +50755,7 @@ var codexAdapter = {
|
|
|
50547
50755
|
return true;
|
|
50548
50756
|
},
|
|
50549
50757
|
getArgentEntry(configPath) {
|
|
50550
|
-
if (!
|
|
50758
|
+
if (!fs28.existsSync(configPath)) return null;
|
|
50551
50759
|
const config3 = readToml(configPath);
|
|
50552
50760
|
const servers = config3.mcp_servers;
|
|
50553
50761
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -50579,7 +50787,7 @@ var codexAdapter = {
|
|
|
50579
50787
|
// them, and an emptied or removed table stays as it is.
|
|
50580
50788
|
refreshAllowlist(root, scope) {
|
|
50581
50789
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
50582
|
-
if (!configPath || !
|
|
50790
|
+
if (!configPath || !fs28.existsSync(configPath)) return;
|
|
50583
50791
|
const config3 = readToml(configPath);
|
|
50584
50792
|
const toolsConfig = config3.mcp_servers?.argent?.tools;
|
|
50585
50793
|
if (!toolsConfig) return;
|
|
@@ -50616,13 +50824,13 @@ var codexAdapter = {
|
|
|
50616
50824
|
var hermesAdapter = {
|
|
50617
50825
|
name: "Hermes",
|
|
50618
50826
|
detect() {
|
|
50619
|
-
return dirHasEditorEvidence(
|
|
50827
|
+
return dirHasEditorEvidence(path38.join(homedir6(), ".hermes"), hermesDirLooksArgentOnly);
|
|
50620
50828
|
},
|
|
50621
50829
|
projectPath() {
|
|
50622
50830
|
return null;
|
|
50623
50831
|
},
|
|
50624
50832
|
globalPath() {
|
|
50625
|
-
return
|
|
50833
|
+
return path38.join(homedir6(), ".hermes", "config.yaml");
|
|
50626
50834
|
},
|
|
50627
50835
|
write(configPath, entry) {
|
|
50628
50836
|
const doc = readYaml(configPath);
|
|
@@ -50641,7 +50849,7 @@ var hermesAdapter = {
|
|
|
50641
50849
|
writeYaml(configPath, doc);
|
|
50642
50850
|
},
|
|
50643
50851
|
remove(configPath) {
|
|
50644
|
-
if (!
|
|
50852
|
+
if (!fs28.existsSync(configPath)) return false;
|
|
50645
50853
|
const doc = readYaml(configPath);
|
|
50646
50854
|
const servers = doc.get("mcp_servers");
|
|
50647
50855
|
if (!(0, import_yaml6.isMap)(servers)) return false;
|
|
@@ -50654,7 +50862,7 @@ var hermesAdapter = {
|
|
|
50654
50862
|
return true;
|
|
50655
50863
|
},
|
|
50656
50864
|
getArgentEntry(configPath) {
|
|
50657
|
-
if (!
|
|
50865
|
+
if (!fs28.existsSync(configPath)) return null;
|
|
50658
50866
|
const doc = readYaml(configPath);
|
|
50659
50867
|
const servers = doc.get("mcp_servers");
|
|
50660
50868
|
if (!(0, import_yaml6.isMap)(servers)) return null;
|
|
@@ -50681,10 +50889,10 @@ function hasOpenCodeBinary() {
|
|
|
50681
50889
|
}
|
|
50682
50890
|
function pickOpencodeConfig(dir, candidates) {
|
|
50683
50891
|
for (const name of candidates) {
|
|
50684
|
-
const candidate =
|
|
50685
|
-
if (
|
|
50892
|
+
const candidate = path38.join(dir, name);
|
|
50893
|
+
if (fs28.existsSync(candidate)) return candidate;
|
|
50686
50894
|
}
|
|
50687
|
-
return
|
|
50895
|
+
return path38.join(dir, "opencode.json");
|
|
50688
50896
|
}
|
|
50689
50897
|
var openCodeAdapter = {
|
|
50690
50898
|
name: "opencode",
|
|
@@ -50695,7 +50903,7 @@ var openCodeAdapter = {
|
|
|
50695
50903
|
return pickOpencodeConfig(root, OPENCODE_PROJECT_FILES);
|
|
50696
50904
|
},
|
|
50697
50905
|
globalPath() {
|
|
50698
|
-
return pickOpencodeConfig(
|
|
50906
|
+
return pickOpencodeConfig(path38.join(homedir6(), ".config", "opencode"), OPENCODE_GLOBAL_FILES);
|
|
50699
50907
|
},
|
|
50700
50908
|
write(configPath, entry) {
|
|
50701
50909
|
editJsoncFile(configPath, ["mcp", MCP_SERVER_KEY], {
|
|
@@ -50706,7 +50914,7 @@ var openCodeAdapter = {
|
|
|
50706
50914
|
});
|
|
50707
50915
|
},
|
|
50708
50916
|
remove(configPath) {
|
|
50709
|
-
if (!
|
|
50917
|
+
if (!fs28.existsSync(configPath)) return false;
|
|
50710
50918
|
const config3 = readJsonc(configPath);
|
|
50711
50919
|
const servers = config3.mcp;
|
|
50712
50920
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -50714,7 +50922,7 @@ var openCodeAdapter = {
|
|
|
50714
50922
|
return true;
|
|
50715
50923
|
},
|
|
50716
50924
|
getArgentEntry(configPath) {
|
|
50717
|
-
if (!
|
|
50925
|
+
if (!fs28.existsSync(configPath)) return null;
|
|
50718
50926
|
const config3 = readJsonc(configPath);
|
|
50719
50927
|
const servers = config3.mcp;
|
|
50720
50928
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -50729,7 +50937,7 @@ var openCodeAdapter = {
|
|
|
50729
50937
|
},
|
|
50730
50938
|
removeAllowlist(root, scope) {
|
|
50731
50939
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
50732
|
-
if (!configPath || !
|
|
50940
|
+
if (!configPath || !fs28.existsSync(configPath)) return;
|
|
50733
50941
|
const config3 = readJsonc(configPath);
|
|
50734
50942
|
const tools2 = config3.tools;
|
|
50735
50943
|
if (!tools2 || !(OPENCODE_ALLOWLIST_PATTERN in tools2)) return;
|
|
@@ -50740,13 +50948,13 @@ var KIRO_AUTO_APPROVE_ALL = ["*"];
|
|
|
50740
50948
|
var kiroAdapter = {
|
|
50741
50949
|
name: "Kiro",
|
|
50742
50950
|
detect() {
|
|
50743
|
-
return dirHasEditorEvidence(
|
|
50951
|
+
return dirHasEditorEvidence(path38.join(homedir6(), ".kiro"), kiroDirLooksArgentOnly) || dirHasEditorEvidence(path38.join(process.cwd(), ".kiro"), kiroDirLooksArgentOnly);
|
|
50744
50952
|
},
|
|
50745
50953
|
projectPath(root) {
|
|
50746
|
-
return
|
|
50954
|
+
return path38.join(root, ".kiro", "settings", "mcp.json");
|
|
50747
50955
|
},
|
|
50748
50956
|
globalPath() {
|
|
50749
|
-
return
|
|
50957
|
+
return path38.join(homedir6(), ".kiro", "settings", "mcp.json");
|
|
50750
50958
|
},
|
|
50751
50959
|
// Read and written as JSONC through readJsonc / editJsoncFile so comments and
|
|
50752
50960
|
// foreign servers survive (see the Cursor adapter).
|
|
@@ -50759,7 +50967,7 @@ var kiroAdapter = {
|
|
|
50759
50967
|
});
|
|
50760
50968
|
},
|
|
50761
50969
|
remove(configPath) {
|
|
50762
|
-
if (!
|
|
50970
|
+
if (!fs28.existsSync(configPath)) return false;
|
|
50763
50971
|
const config3 = readJsonc(configPath);
|
|
50764
50972
|
const servers = config3.mcpServers;
|
|
50765
50973
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -50767,7 +50975,7 @@ var kiroAdapter = {
|
|
|
50767
50975
|
return true;
|
|
50768
50976
|
},
|
|
50769
50977
|
getArgentEntry(configPath) {
|
|
50770
|
-
if (!
|
|
50978
|
+
if (!fs28.existsSync(configPath)) return null;
|
|
50771
50979
|
const config3 = readJsonc(configPath);
|
|
50772
50980
|
const servers = config3.mcpServers;
|
|
50773
50981
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -50791,7 +50999,7 @@ var kiroAdapter = {
|
|
|
50791
50999
|
},
|
|
50792
51000
|
removeAllowlist(root, scope) {
|
|
50793
51001
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
50794
|
-
if (!configPath || !
|
|
51002
|
+
if (!configPath || !fs28.existsSync(configPath)) return;
|
|
50795
51003
|
const config3 = readJsonc(configPath);
|
|
50796
51004
|
const servers = config3.mcpServers;
|
|
50797
51005
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -50843,7 +51051,7 @@ function addAllowRule(settingsPath, rule) {
|
|
|
50843
51051
|
editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, rule]);
|
|
50844
51052
|
}
|
|
50845
51053
|
function removeAllowRule(settingsPath, rule) {
|
|
50846
|
-
if (!
|
|
51054
|
+
if (!fs28.existsSync(settingsPath)) return;
|
|
50847
51055
|
const config3 = readJsonc(settingsPath);
|
|
50848
51056
|
const permissions = config3?.permissions;
|
|
50849
51057
|
const allow = permissions?.allow;
|
|
@@ -50853,7 +51061,7 @@ function removeAllowRule(settingsPath, rule) {
|
|
|
50853
51061
|
editJsoncFile(settingsPath, ["permissions", "allow"], next.length > 0 ? next : void 0);
|
|
50854
51062
|
}
|
|
50855
51063
|
function claudeSettingsPath(root, scope) {
|
|
50856
|
-
return scope === "global" ?
|
|
51064
|
+
return scope === "global" ? path38.join(homedir6(), ".claude", "settings.json") : path38.join(root, ".claude", "settings.json");
|
|
50857
51065
|
}
|
|
50858
51066
|
function addClaudePermission(root, scope) {
|
|
50859
51067
|
addAllowRule(claudeSettingsPath(root, scope), PERMISSION_RULE);
|
|
@@ -50862,13 +51070,13 @@ function removeClaudePermission(root, scope) {
|
|
|
50862
51070
|
removeAllowRule(claudeSettingsPath(root, scope), PERMISSION_RULE);
|
|
50863
51071
|
}
|
|
50864
51072
|
function formatManagedPathLabel(targetPath, root) {
|
|
50865
|
-
for (const home2 of [
|
|
50866
|
-
if (targetPath === home2 || targetPath.startsWith(`${home2}${
|
|
51073
|
+
for (const home2 of [path38.resolve(homedir6()), canonicalPath(homedir6())]) {
|
|
51074
|
+
if (targetPath === home2 || targetPath.startsWith(`${home2}${path38.sep}`)) {
|
|
50867
51075
|
return `~${targetPath.slice(home2.length)}`;
|
|
50868
51076
|
}
|
|
50869
51077
|
}
|
|
50870
|
-
const relative6 =
|
|
50871
|
-
if (relative6 && !relative6.startsWith("..") && !
|
|
51078
|
+
const relative6 = path38.relative(root, targetPath);
|
|
51079
|
+
if (relative6 && !relative6.startsWith("..") && !path38.isAbsolute(relative6)) {
|
|
50872
51080
|
return relative6;
|
|
50873
51081
|
}
|
|
50874
51082
|
return targetPath;
|
|
@@ -50882,7 +51090,7 @@ function addManagedTarget(targets, editorName, targetPath, root) {
|
|
|
50882
51090
|
}
|
|
50883
51091
|
function getAdapterBasePath(adapter, root, scope) {
|
|
50884
51092
|
const configPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(root);
|
|
50885
|
-
return configPath ?
|
|
51093
|
+
return configPath ? path38.dirname(configPath) : null;
|
|
50886
51094
|
}
|
|
50887
51095
|
function getManagedContentTargets(adapters, root, scope) {
|
|
50888
51096
|
const targets = {
|
|
@@ -50892,17 +51100,17 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
50892
51100
|
codexConfigTargets: [],
|
|
50893
51101
|
skillsLockTargets: []
|
|
50894
51102
|
};
|
|
50895
|
-
const workspaceBase = scope === "global" ?
|
|
51103
|
+
const workspaceBase = scope === "global" ? homedir6() : root;
|
|
50896
51104
|
addManagedTarget(
|
|
50897
51105
|
targets.skillTargets,
|
|
50898
51106
|
"skills",
|
|
50899
|
-
|
|
51107
|
+
path38.join(workspaceBase, ".agents", "skills"),
|
|
50900
51108
|
root
|
|
50901
51109
|
);
|
|
50902
51110
|
addManagedTarget(
|
|
50903
51111
|
targets.skillsLockTargets,
|
|
50904
51112
|
"skills",
|
|
50905
|
-
|
|
51113
|
+
path38.join(workspaceBase, "skills-lock.json"),
|
|
50906
51114
|
root
|
|
50907
51115
|
);
|
|
50908
51116
|
for (const adapter of adapters) {
|
|
@@ -50910,21 +51118,21 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
50910
51118
|
case "Cursor": {
|
|
50911
51119
|
const base = getAdapterBasePath(adapter, root, scope);
|
|
50912
51120
|
if (!base) break;
|
|
50913
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
50914
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
51121
|
+
addManagedTarget(targets.skillTargets, adapter.name, path38.join(base, "skills"), root);
|
|
51122
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path38.join(base, "rules"), root);
|
|
50915
51123
|
break;
|
|
50916
51124
|
}
|
|
50917
51125
|
case "Claude Code": {
|
|
50918
|
-
const claudeBase = scope === "global" ?
|
|
50919
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
50920
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
50921
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
51126
|
+
const claudeBase = scope === "global" ? path38.join(homedir6(), ".claude") : path38.join(root, ".claude");
|
|
51127
|
+
addManagedTarget(targets.skillTargets, adapter.name, path38.join(claudeBase, "skills"), root);
|
|
51128
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path38.join(claudeBase, "rules"), root);
|
|
51129
|
+
addManagedTarget(targets.agentTargets, adapter.name, path38.join(claudeBase, "agents"), root);
|
|
50922
51130
|
break;
|
|
50923
51131
|
}
|
|
50924
51132
|
case "Gemini": {
|
|
50925
|
-
const geminiBase = scope === "global" ?
|
|
50926
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
50927
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
51133
|
+
const geminiBase = scope === "global" ? path38.join(homedir6(), ".gemini") : path38.join(root, ".gemini");
|
|
51134
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path38.join(geminiBase, "rules"), root);
|
|
51135
|
+
addManagedTarget(targets.agentTargets, adapter.name, path38.join(geminiBase, "agents"), root);
|
|
50928
51136
|
break;
|
|
50929
51137
|
}
|
|
50930
51138
|
case "Codex": {
|
|
@@ -50934,19 +51142,19 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
50934
51142
|
break;
|
|
50935
51143
|
}
|
|
50936
51144
|
case "opencode": {
|
|
50937
|
-
const base = scope === "global" ?
|
|
50938
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
50939
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
51145
|
+
const base = scope === "global" ? path38.join(homedir6(), ".config", "opencode") : path38.join(root, ".opencode");
|
|
51146
|
+
addManagedTarget(targets.skillTargets, adapter.name, path38.join(base, "skills"), root);
|
|
51147
|
+
addManagedTarget(targets.agentTargets, adapter.name, path38.join(base, "agents"), root);
|
|
50940
51148
|
break;
|
|
50941
51149
|
}
|
|
50942
51150
|
case "Kiro": {
|
|
50943
|
-
const kiroBase = scope === "global" ?
|
|
50944
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
51151
|
+
const kiroBase = scope === "global" ? path38.join(homedir6(), ".kiro") : path38.join(root, ".kiro");
|
|
51152
|
+
addManagedTarget(targets.skillTargets, adapter.name, path38.join(kiroBase, "skills"), root);
|
|
50945
51153
|
break;
|
|
50946
51154
|
}
|
|
50947
51155
|
case "Devin Desktop": {
|
|
50948
|
-
const devinBase = scope === "global" ?
|
|
50949
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
51156
|
+
const devinBase = scope === "global" ? path38.join(process.env.XDG_CONFIG_HOME || path38.join(homedir6(), ".config"), "devin") : path38.join(root, ".devin");
|
|
51157
|
+
addManagedTarget(targets.skillTargets, adapter.name, path38.join(devinBase, "skills"), root);
|
|
50950
51158
|
break;
|
|
50951
51159
|
}
|
|
50952
51160
|
}
|
|
@@ -50963,12 +51171,12 @@ function removeArgentSection(existing) {
|
|
|
50963
51171
|
}
|
|
50964
51172
|
|
|
50965
51173
|
// ../argent-installer/src/retired-files.ts
|
|
50966
|
-
import * as
|
|
51174
|
+
import * as path39 from "node:path";
|
|
50967
51175
|
|
|
50968
51176
|
// ../argent-installer/src/cli-record.ts
|
|
50969
51177
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
50970
|
-
import * as
|
|
50971
|
-
import * as
|
|
51178
|
+
import * as fs29 from "node:fs";
|
|
51179
|
+
import * as path40 from "node:path";
|
|
50972
51180
|
|
|
50973
51181
|
// ../argent-installer/src/init-telemetry.ts
|
|
50974
51182
|
var INSTALL_GLOBAL_PACKAGE_FAILED = {
|
|
@@ -51021,21 +51229,21 @@ var INSTALL_UNCLASSIFIED_FAILED = {
|
|
|
51021
51229
|
};
|
|
51022
51230
|
|
|
51023
51231
|
// ../argent-installer/src/install-runner.ts
|
|
51024
|
-
import * as
|
|
51025
|
-
import * as
|
|
51232
|
+
import * as fs32 from "node:fs";
|
|
51233
|
+
import * as path43 from "node:path";
|
|
51026
51234
|
|
|
51027
51235
|
// ../argent-installer/src/shell.ts
|
|
51028
51236
|
import { execFileSync as execFileSync9, spawn as spawn5 } from "node:child_process";
|
|
51029
51237
|
|
|
51030
51238
|
// ../argent-installer/src/skills.ts
|
|
51031
51239
|
import { execFileSync as execFileSync11 } from "node:child_process";
|
|
51032
|
-
import * as
|
|
51033
|
-
import * as
|
|
51240
|
+
import * as fs31 from "node:fs";
|
|
51241
|
+
import * as path42 from "node:path";
|
|
51034
51242
|
|
|
51035
51243
|
// ../argent-installer/src/skills-runner.ts
|
|
51036
51244
|
import { execFileSync as execFileSync10 } from "node:child_process";
|
|
51037
|
-
import * as
|
|
51038
|
-
import * as
|
|
51245
|
+
import * as fs30 from "node:fs";
|
|
51246
|
+
import * as path41 from "node:path";
|
|
51039
51247
|
|
|
51040
51248
|
// ../argent-installer/src/init-scope.ts
|
|
51041
51249
|
import { existsSync as existsSync19 } from "node:fs";
|
|
@@ -51043,14 +51251,14 @@ import { resolve as resolve23 } from "node:path";
|
|
|
51043
51251
|
|
|
51044
51252
|
// ../argent-installer/src/init-skills.ts
|
|
51045
51253
|
import { spawn as spawn6 } from "node:child_process";
|
|
51046
|
-
import * as
|
|
51047
|
-
import * as
|
|
51254
|
+
import * as os8 from "node:os";
|
|
51255
|
+
import * as path44 from "node:path";
|
|
51048
51256
|
|
|
51049
51257
|
// ../argent-installer/src/update.ts
|
|
51050
51258
|
var import_semver5 = __toESM(require_semver2(), 1);
|
|
51051
|
-
import * as
|
|
51052
|
-
import * as
|
|
51053
|
-
import * as
|
|
51259
|
+
import * as fs33 from "node:fs";
|
|
51260
|
+
import * as os9 from "node:os";
|
|
51261
|
+
import * as path45 from "node:path";
|
|
51054
51262
|
|
|
51055
51263
|
// ../argent-installer/src/update-target.ts
|
|
51056
51264
|
var import_update_core = __toESM(require_dist3(), 1);
|
|
@@ -51095,8 +51303,8 @@ var UPDATE_UNCLASSIFIED_FAILED = {
|
|
|
51095
51303
|
|
|
51096
51304
|
// ../argent-installer/src/uninstall.ts
|
|
51097
51305
|
var import_yaml7 = __toESM(require_dist2(), 1);
|
|
51098
|
-
import * as
|
|
51099
|
-
import * as
|
|
51306
|
+
import * as fs34 from "node:fs";
|
|
51307
|
+
import * as path46 from "node:path";
|
|
51100
51308
|
var UNINSTALL_TOOLSERVER_STOP_FAILED = {
|
|
51101
51309
|
error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
|
|
51102
51310
|
failure_stage: "installer_uninstall_toolserver_stop",
|
|
@@ -51135,11 +51343,11 @@ function check2(status2, label, extra = {}) {
|
|
|
51135
51343
|
return { status: status2, label, ...extra };
|
|
51136
51344
|
}
|
|
51137
51345
|
function home(p) {
|
|
51138
|
-
const h2 =
|
|
51139
|
-
return p === h2 || p.startsWith(h2 +
|
|
51346
|
+
const h2 = homedir9();
|
|
51347
|
+
return p === h2 || p.startsWith(h2 + path47.sep) ? `~${p.slice(h2.length)}` : p;
|
|
51140
51348
|
}
|
|
51141
51349
|
function installSection(ctx) {
|
|
51142
|
-
const packageRoot =
|
|
51350
|
+
const packageRoot = path47.dirname(path47.dirname(ctx.paths.bundlePath));
|
|
51143
51351
|
const checks = [check2("info", `Running v${ctx.running}`, { detail: home(packageRoot) })];
|
|
51144
51352
|
const mode = resolveInstallMode(ctx.projectRoot);
|
|
51145
51353
|
if (ctx.globalOnPath) {
|
|
@@ -51184,15 +51392,15 @@ function classifyArgentOnPath(entry, ctx) {
|
|
|
51184
51392
|
function classifyNodeScript(entry, ctx) {
|
|
51185
51393
|
const script = entry.args.find((arg) => !arg.startsWith("-"));
|
|
51186
51394
|
if (!script) return entryCheck("info", entry, "custom command, not checked");
|
|
51187
|
-
if (
|
|
51188
|
-
return
|
|
51395
|
+
if (path47.isAbsolute(script)) {
|
|
51396
|
+
return fs35.existsSync(script) ? entryCheck("ok", entry) : entryCheck("error", entry, `${script} does not exist`, {
|
|
51189
51397
|
fix: `${ctx.argentCommand} init`
|
|
51190
51398
|
});
|
|
51191
51399
|
}
|
|
51192
|
-
if (!
|
|
51400
|
+
if (!fs35.existsSync(path47.resolve(ctx.projectRoot, script))) {
|
|
51193
51401
|
return entryCheck("error", entry, `${script} does not exist`, { fix: ctx.projectInstallFix });
|
|
51194
51402
|
}
|
|
51195
|
-
if (!
|
|
51403
|
+
if (!fs35.existsSync(path47.resolve(ctx.cwd, script))) {
|
|
51196
51404
|
return entryCheck("error", entry, `${script} is relative to ${home(ctx.projectRoot)}`, {
|
|
51197
51405
|
detail: "an editor started in this folder cannot find it",
|
|
51198
51406
|
fix: `Start the editor in ${home(ctx.projectRoot)}`
|
|
@@ -51201,13 +51409,13 @@ function classifyNodeScript(entry, ctx) {
|
|
|
51201
51409
|
return entryCheck("ok", entry);
|
|
51202
51410
|
}
|
|
51203
51411
|
function classifyPinnedEntry(entry, initFix) {
|
|
51204
|
-
const missing = [entry.command, entry.args[0]].find((p) => !
|
|
51412
|
+
const missing = [entry.command, entry.args[0]].find((p) => !fs35.existsSync(p));
|
|
51205
51413
|
return missing ? entryCheck("error", entry, `${missing} does not exist`, { fix: initFix }) : entryCheck("ok", entry);
|
|
51206
51414
|
}
|
|
51207
51415
|
function isRunnableFile(file2) {
|
|
51208
51416
|
try {
|
|
51209
|
-
if (!
|
|
51210
|
-
if (process.platform !== "win32")
|
|
51417
|
+
if (!fs35.statSync(file2).isFile()) return false;
|
|
51418
|
+
if (process.platform !== "win32") fs35.accessSync(file2, fs35.constants.X_OK);
|
|
51211
51419
|
return true;
|
|
51212
51420
|
} catch {
|
|
51213
51421
|
return false;
|
|
@@ -51215,7 +51423,7 @@ function isRunnableFile(file2) {
|
|
|
51215
51423
|
}
|
|
51216
51424
|
function isOnPath(command) {
|
|
51217
51425
|
const names = process.platform === "win32" ? [".cmd", ".exe"].map((ext) => command + ext) : [command];
|
|
51218
|
-
return (process.env.PATH ?? "").split(
|
|
51426
|
+
return (process.env.PATH ?? "").split(path47.delimiter).some((dir) => dir !== "" && names.some((name) => isRunnableFile(path47.join(dir, name))));
|
|
51219
51427
|
}
|
|
51220
51428
|
function classifyPackageRunner(entry, ctx) {
|
|
51221
51429
|
if (!isOnPath(entry.command)) {
|
|
@@ -51250,7 +51458,7 @@ function classifyMcpEntry(entry, ctx) {
|
|
|
51250
51458
|
if (entry.command === MCP_BINARY_NAME) return classifyArgentOnPath(entry, ctx);
|
|
51251
51459
|
if (Object.hasOwn(RUNNER_PACKAGES, entry.command)) return classifyPackageRunner(entry, ctx);
|
|
51252
51460
|
if (isPinnedGlobalEntry(entry)) return classifyPinnedEntry(entry, initFix);
|
|
51253
|
-
if (
|
|
51461
|
+
if (path47.isAbsolute(entry.command) && !fs35.existsSync(entry.command)) {
|
|
51254
51462
|
return entryCheck("error", entry, `${entry.command} does not exist`, { fix: initFix });
|
|
51255
51463
|
}
|
|
51256
51464
|
return entryCheck("info", entry, "custom command, not checked");
|
|
@@ -51268,7 +51476,7 @@ function syntaxCheck(adapterName, configPath) {
|
|
|
51268
51476
|
EDITOR_JSON_OPTIONS[adapterName] ?? JSONC_OPTIONS
|
|
51269
51477
|
);
|
|
51270
51478
|
if (line === null) return null;
|
|
51271
|
-
const format2 =
|
|
51479
|
+
const format2 = path47.extname(configPath).slice(1).toUpperCase();
|
|
51272
51480
|
return check2("error", `the config has a ${format2} syntax error on line ${line}`, {
|
|
51273
51481
|
fix: `Fix line ${line} of ${home(configPath)}. The editor loads no MCP servers from it until then`
|
|
51274
51482
|
});
|
|
@@ -51285,14 +51493,14 @@ function editorCheck(result, { adapter, scope, configPath }, initFix) {
|
|
|
51285
51493
|
};
|
|
51286
51494
|
}
|
|
51287
51495
|
function brokenUnconfiguredConfigs({ projectRoot, cwd }, configured) {
|
|
51288
|
-
const seen = new Set(configured.map((c2) =>
|
|
51496
|
+
const seen = new Set(configured.map((c2) => path47.resolve(c2.configPath)));
|
|
51289
51497
|
const aboveRepo = crossesGitRoot(cwd, projectRoot);
|
|
51290
51498
|
return ALL_ADAPTERS.flatMap(
|
|
51291
51499
|
(adapter) => ["project", "global"].flatMap((scope) => {
|
|
51292
51500
|
if (scope === "project" && !readsConfigAt(adapter.name, aboveRepo)) return [];
|
|
51293
51501
|
const configPath = scope === "project" ? adapter.projectPath(projectRoot) : adapter.globalPath();
|
|
51294
|
-
if (!configPath || seen.has(
|
|
51295
|
-
seen.add(
|
|
51502
|
+
if (!configPath || seen.has(path47.resolve(configPath))) return [];
|
|
51503
|
+
seen.add(path47.resolve(configPath));
|
|
51296
51504
|
const result = syntaxCheck(adapter.name, configPath);
|
|
51297
51505
|
return result ? [{ adapter, scope, configPath, result }] : [];
|
|
51298
51506
|
})
|
|
@@ -51301,7 +51509,7 @@ function brokenUnconfiguredConfigs({ projectRoot, cwd }, configured) {
|
|
|
51301
51509
|
function mayHoldArgentEntry({ scope, configPath }) {
|
|
51302
51510
|
if (scope === "project") return true;
|
|
51303
51511
|
try {
|
|
51304
|
-
return
|
|
51512
|
+
return fs35.readFileSync(configPath, "utf8").includes(MCP_SERVER_KEY);
|
|
51305
51513
|
} catch {
|
|
51306
51514
|
return false;
|
|
51307
51515
|
}
|
|
@@ -51341,7 +51549,7 @@ function editorsSection(ctx) {
|
|
|
51341
51549
|
}
|
|
51342
51550
|
function listRuleFiles(rulesDir = RULES_DIR) {
|
|
51343
51551
|
try {
|
|
51344
|
-
return
|
|
51552
|
+
return fs35.readdirSync(rulesDir).filter((f) => f.endsWith(".md"));
|
|
51345
51553
|
} catch {
|
|
51346
51554
|
return [];
|
|
51347
51555
|
}
|
|
@@ -51361,8 +51569,8 @@ function summarizeList(items, shown = 5) {
|
|
|
51361
51569
|
}
|
|
51362
51570
|
function localContentDir(ctx, name) {
|
|
51363
51571
|
if (!ctx.localPackageDir) return void 0;
|
|
51364
|
-
const dir =
|
|
51365
|
-
return
|
|
51572
|
+
const dir = path47.join(ctx.localPackageDir, name);
|
|
51573
|
+
return fs35.existsSync(dir) ? dir : void 0;
|
|
51366
51574
|
}
|
|
51367
51575
|
function skillsSection(ctx) {
|
|
51368
51576
|
const checks = [];
|
|
@@ -51370,7 +51578,7 @@ function skillsSection(ctx) {
|
|
|
51370
51578
|
const initFix = `${ctx.argentCommand} init`;
|
|
51371
51579
|
const bundled = listBundledSkills(localContentDir(ctx, "skills"));
|
|
51372
51580
|
const missing = bundled.filter(
|
|
51373
|
-
(skill) => !skillDirs.some((dir) =>
|
|
51581
|
+
(skill) => !skillDirs.some((dir) => fs35.existsSync(path47.join(dir, skill)))
|
|
51374
51582
|
);
|
|
51375
51583
|
if (bundled.length > 0 && missing.length === bundled.length) {
|
|
51376
51584
|
checks.push(check2("warn", "No argent skills installed", { fix: initFix }));
|
|
@@ -51390,7 +51598,7 @@ function skillsSection(ctx) {
|
|
|
51390
51598
|
}
|
|
51391
51599
|
const ruleFiles = listRuleFiles(localContentDir(ctx, "rules"));
|
|
51392
51600
|
for (const dir of ruleDirs) {
|
|
51393
|
-
const absent = ruleFiles.filter((f) => !
|
|
51601
|
+
const absent = ruleFiles.filter((f) => !fs35.existsSync(path47.join(dir, f)));
|
|
51394
51602
|
checks.push(
|
|
51395
51603
|
absent.length === 0 ? check2("ok", `Rules present in ${home(dir)}`) : check2("warn", `Rules missing in ${home(dir)}`, {
|
|
51396
51604
|
detail: absent.join(", "),
|
|
@@ -51417,16 +51625,16 @@ async function probeHostDeps(paths) {
|
|
|
51417
51625
|
}
|
|
51418
51626
|
function xcodesIn(dir) {
|
|
51419
51627
|
try {
|
|
51420
|
-
return
|
|
51628
|
+
return fs35.readdirSync(dir).filter((name) => /^Xcode(?:[-_ ].*)?\.app$/.test(name)).map((name) => path47.join(dir, name));
|
|
51421
51629
|
} catch {
|
|
51422
51630
|
return [];
|
|
51423
51631
|
}
|
|
51424
51632
|
}
|
|
51425
51633
|
function installedXcodes() {
|
|
51426
|
-
return [...xcodesIn("/Applications"), ...xcodesIn(
|
|
51634
|
+
return [...xcodesIn("/Applications"), ...xcodesIn(path47.join(homedir9(), "Applications"))];
|
|
51427
51635
|
}
|
|
51428
51636
|
function selectXcodeFix(xcodeApps) {
|
|
51429
|
-
const app = xcodeApps.find((p) =>
|
|
51637
|
+
const app = xcodeApps.find((p) => path47.basename(p) === "Xcode.app") ?? xcodeApps[0];
|
|
51430
51638
|
const developerDir = `${app ?? "/Applications/Xcode.app"}/Contents/Developer`;
|
|
51431
51639
|
const select2 = formatShellCommand({ bin: "sudo", args: ["xcode-select", "-s", developerDir] });
|
|
51432
51640
|
const run2 = process.env.DEVELOPER_DIR ? `unset DEVELOPER_DIR (it overrides xcode-select), then run ${select2}` : `run ${select2}`;
|
|
@@ -51473,7 +51681,7 @@ async function toolchainSection(ctx) {
|
|
|
51473
51681
|
}
|
|
51474
51682
|
function isGlobalConfigPath(entry) {
|
|
51475
51683
|
const globalPath = entry.adapter.globalPath();
|
|
51476
|
-
return globalPath !== null &&
|
|
51684
|
+
return globalPath !== null && path47.resolve(globalPath) === path47.resolve(entry.configPath);
|
|
51477
51685
|
}
|
|
51478
51686
|
function findConfigured(projectRoot) {
|
|
51479
51687
|
return findConfiguredAdapterScopes(ALL_ADAPTERS, projectRoot).filter(
|
|
@@ -51490,28 +51698,28 @@ function hasClaudeProjectConfig(dir) {
|
|
|
51490
51698
|
}
|
|
51491
51699
|
function ancestorsInRepo(dir, homeDir) {
|
|
51492
51700
|
const ancestors = ancestorsBelowHome(dir, homeDir);
|
|
51493
|
-
const repoIndex = [dir, ...ancestors].findIndex((d) =>
|
|
51701
|
+
const repoIndex = [dir, ...ancestors].findIndex((d) => fs35.existsSync(path47.join(d, ".git")));
|
|
51494
51702
|
return repoIndex === -1 ? ancestors : ancestors.slice(0, repoIndex);
|
|
51495
51703
|
}
|
|
51496
51704
|
function ancestorsBelowHome(dir, homeDir) {
|
|
51497
51705
|
const ancestors = [];
|
|
51498
|
-
let current =
|
|
51499
|
-
while (current !== homeDir && current !==
|
|
51706
|
+
let current = path47.dirname(dir);
|
|
51707
|
+
while (current !== homeDir && current !== path47.dirname(current)) {
|
|
51500
51708
|
ancestors.push(current);
|
|
51501
|
-
current =
|
|
51709
|
+
current = path47.dirname(current);
|
|
51502
51710
|
}
|
|
51503
51711
|
return ancestors;
|
|
51504
51712
|
}
|
|
51505
|
-
function resolveDoctorRoot(cwd, homeDir =
|
|
51713
|
+
function resolveDoctorRoot(cwd, homeDir = homedir9()) {
|
|
51506
51714
|
const projectRoot = resolveProjectRoot2(cwd, homeDir);
|
|
51507
|
-
const resolvedHome =
|
|
51715
|
+
const resolvedHome = path47.resolve(homeDir);
|
|
51508
51716
|
if (projectRoot === resolvedHome || hasProjectConfig(projectRoot)) return projectRoot;
|
|
51509
51717
|
return ancestorsInRepo(projectRoot, resolvedHome).find(hasProjectConfig) ?? ancestorsBelowHome(projectRoot, resolvedHome).find(hasClaudeProjectConfig) ?? projectRoot;
|
|
51510
51718
|
}
|
|
51511
51719
|
function crossesGitRoot(cwd, projectRoot) {
|
|
51512
|
-
const dirs = [cwd, ...ancestorsBelowHome(cwd,
|
|
51720
|
+
const dirs = [cwd, ...ancestorsBelowHome(cwd, path47.resolve(homedir9()))];
|
|
51513
51721
|
const rootIndex = dirs.indexOf(projectRoot);
|
|
51514
|
-
return rootIndex > 0 && dirs.slice(0, rootIndex).some((d) =>
|
|
51722
|
+
return rootIndex > 0 && dirs.slice(0, rootIndex).some((d) => fs35.existsSync(path47.join(d, ".git")));
|
|
51515
51723
|
}
|
|
51516
51724
|
function readsConfigAt(editor, aboveRepo) {
|
|
51517
51725
|
return !aboveRepo || editor === "Claude Code";
|
|
@@ -51524,10 +51732,10 @@ function configuredFor(projectRoot, cwd) {
|
|
|
51524
51732
|
}
|
|
51525
51733
|
function offPathBinDir() {
|
|
51526
51734
|
const bin = process.argv[1];
|
|
51527
|
-
if (!bin ||
|
|
51528
|
-
const dir =
|
|
51529
|
-
if (
|
|
51530
|
-
return (process.env.PATH ?? "").split(
|
|
51735
|
+
if (!bin || path47.basename(bin) !== MCP_BINARY_NAME) return null;
|
|
51736
|
+
const dir = path47.dirname(bin);
|
|
51737
|
+
if (path47.basename(dir) === ".bin") return null;
|
|
51738
|
+
return (process.env.PATH ?? "").split(path47.delimiter).includes(dir) ? null : dir;
|
|
51531
51739
|
}
|
|
51532
51740
|
function globalInstallFix() {
|
|
51533
51741
|
const binDir = offPathBinDir();
|