@swmansion/argent 0.35.1-next.4 → 0.35.1-next.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -15
- package/bin/argent-android-devtools-0.4.0.apk +0 -0
- package/bin/darwin/argent-macos-helper +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +2353 -2063
- package/dist/client.js +302 -284
- package/dist/fatal-handlers.js +7 -1
- package/dist/fatal-handlers.js.map +1 -1
- package/dist/installer-help.js +2 -1
- package/dist/installer-help.js.map +1 -1
- package/dist/installer.mjs +972 -753
- package/dist/mcp-server.mjs +1558 -1429
- package/dist/tool-args.generated.d.ts +396 -318
- package/dist/tool-server.cjs +105318 -102566
- package/dylibs/libArgentAudio.dylib +0 -0
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
- package/dylibs/tcp/argent-audio-feeder +0 -0
- package/dylibs/tcp/libArgentAudio.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +2 -2
- package/skills/argent-android-emulator-setup/SKILL.md +2 -2
- package/skills/argent-create-e2e/SKILL.md +2 -1
- package/skills/argent-create-e2e/references/e2e-yaml.md +25 -2
- package/skills/argent-create-e2e/references/live-authoring.md +13 -2
- package/skills/argent-device-interact/SKILL.md +21 -94
- package/skills/argent-device-interact/references/advanced.md +64 -0
- package/skills/argent-ios-device-interact/SKILL.md +1 -1
- package/skills/argent-ios-device-setup/SKILL.md +1 -1
- package/skills/argent-ios-simulator-setup/SKILL.md +1 -1
- package/skills/argent-lens/SKILL.md +1 -1
- package/skills/argent-macos-app-interact/SKILL.md +1 -1
- package/skills/argent-metro-debugger/SKILL.md +4 -4
- package/skills/argent-native-profiler/SKILL.md +1 -1
- package/skills/argent-qa-e2e/SKILL.md +1 -1
- package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
- package/skills/argent-react-native-optimization/SKILL.md +1 -1
- package/skills/argent-react-native-profiler/SKILL.md +1 -1
- package/skills/argent-screen-recording/SKILL.md +1 -1
- package/skills/argent-screenshot-diff/SKILL.md +1 -1
- package/skills/argent-settings-permissions/SKILL.md +1 -1
- package/skills/argent-test-ui-flow/SKILL.md +1 -1
- package/skills/argent-tv-interact/SKILL.md +1 -1
package/dist/client.js
CHANGED
|
@@ -504,17 +504,17 @@ var require_visit = __commonJS({
|
|
|
504
504
|
visit.BREAK = BREAK;
|
|
505
505
|
visit.SKIP = SKIP;
|
|
506
506
|
visit.REMOVE = REMOVE;
|
|
507
|
-
function visit_(key, node, visitor,
|
|
508
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
507
|
+
function visit_(key, node, visitor, path15) {
|
|
508
|
+
const ctrl = callVisitor(key, node, visitor, path15);
|
|
509
509
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
510
|
-
replaceNode(key,
|
|
511
|
-
return visit_(key, ctrl, visitor,
|
|
510
|
+
replaceNode(key, path15, ctrl);
|
|
511
|
+
return visit_(key, ctrl, visitor, path15);
|
|
512
512
|
}
|
|
513
513
|
if (typeof ctrl !== "symbol") {
|
|
514
514
|
if (identity.isCollection(node)) {
|
|
515
|
-
|
|
515
|
+
path15 = Object.freeze(path15.concat(node));
|
|
516
516
|
for (let i = 0; i < node.items.length; ++i) {
|
|
517
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
517
|
+
const ci = visit_(i, node.items[i], visitor, path15);
|
|
518
518
|
if (typeof ci === "number")
|
|
519
519
|
i = ci - 1;
|
|
520
520
|
else if (ci === BREAK)
|
|
@@ -525,13 +525,13 @@ var require_visit = __commonJS({
|
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
527
|
} else if (identity.isPair(node)) {
|
|
528
|
-
|
|
529
|
-
const ck = visit_("key", node.key, visitor,
|
|
528
|
+
path15 = Object.freeze(path15.concat(node));
|
|
529
|
+
const ck = visit_("key", node.key, visitor, path15);
|
|
530
530
|
if (ck === BREAK)
|
|
531
531
|
return BREAK;
|
|
532
532
|
else if (ck === REMOVE)
|
|
533
533
|
node.key = null;
|
|
534
|
-
const cv = visit_("value", node.value, visitor,
|
|
534
|
+
const cv = visit_("value", node.value, visitor, path15);
|
|
535
535
|
if (cv === BREAK)
|
|
536
536
|
return BREAK;
|
|
537
537
|
else if (cv === REMOVE)
|
|
@@ -552,17 +552,17 @@ var require_visit = __commonJS({
|
|
|
552
552
|
visitAsync.BREAK = BREAK;
|
|
553
553
|
visitAsync.SKIP = SKIP;
|
|
554
554
|
visitAsync.REMOVE = REMOVE;
|
|
555
|
-
async function visitAsync_(key, node, visitor,
|
|
556
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
555
|
+
async function visitAsync_(key, node, visitor, path15) {
|
|
556
|
+
const ctrl = await callVisitor(key, node, visitor, path15);
|
|
557
557
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
558
|
-
replaceNode(key,
|
|
559
|
-
return visitAsync_(key, ctrl, visitor,
|
|
558
|
+
replaceNode(key, path15, ctrl);
|
|
559
|
+
return visitAsync_(key, ctrl, visitor, path15);
|
|
560
560
|
}
|
|
561
561
|
if (typeof ctrl !== "symbol") {
|
|
562
562
|
if (identity.isCollection(node)) {
|
|
563
|
-
|
|
563
|
+
path15 = Object.freeze(path15.concat(node));
|
|
564
564
|
for (let i = 0; i < node.items.length; ++i) {
|
|
565
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
565
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path15);
|
|
566
566
|
if (typeof ci === "number")
|
|
567
567
|
i = ci - 1;
|
|
568
568
|
else if (ci === BREAK)
|
|
@@ -573,13 +573,13 @@ var require_visit = __commonJS({
|
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
575
|
} else if (identity.isPair(node)) {
|
|
576
|
-
|
|
577
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
576
|
+
path15 = Object.freeze(path15.concat(node));
|
|
577
|
+
const ck = await visitAsync_("key", node.key, visitor, path15);
|
|
578
578
|
if (ck === BREAK)
|
|
579
579
|
return BREAK;
|
|
580
580
|
else if (ck === REMOVE)
|
|
581
581
|
node.key = null;
|
|
582
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
582
|
+
const cv = await visitAsync_("value", node.value, visitor, path15);
|
|
583
583
|
if (cv === BREAK)
|
|
584
584
|
return BREAK;
|
|
585
585
|
else if (cv === REMOVE)
|
|
@@ -606,23 +606,23 @@ var require_visit = __commonJS({
|
|
|
606
606
|
}
|
|
607
607
|
return visitor;
|
|
608
608
|
}
|
|
609
|
-
function callVisitor(key, node, visitor,
|
|
609
|
+
function callVisitor(key, node, visitor, path15) {
|
|
610
610
|
if (typeof visitor === "function")
|
|
611
|
-
return visitor(key, node,
|
|
611
|
+
return visitor(key, node, path15);
|
|
612
612
|
if (identity.isMap(node))
|
|
613
|
-
return visitor.Map?.(key, node,
|
|
613
|
+
return visitor.Map?.(key, node, path15);
|
|
614
614
|
if (identity.isSeq(node))
|
|
615
|
-
return visitor.Seq?.(key, node,
|
|
615
|
+
return visitor.Seq?.(key, node, path15);
|
|
616
616
|
if (identity.isPair(node))
|
|
617
|
-
return visitor.Pair?.(key, node,
|
|
617
|
+
return visitor.Pair?.(key, node, path15);
|
|
618
618
|
if (identity.isScalar(node))
|
|
619
|
-
return visitor.Scalar?.(key, node,
|
|
619
|
+
return visitor.Scalar?.(key, node, path15);
|
|
620
620
|
if (identity.isAlias(node))
|
|
621
|
-
return visitor.Alias?.(key, node,
|
|
621
|
+
return visitor.Alias?.(key, node, path15);
|
|
622
622
|
return void 0;
|
|
623
623
|
}
|
|
624
|
-
function replaceNode(key,
|
|
625
|
-
const parent =
|
|
624
|
+
function replaceNode(key, path15, node) {
|
|
625
|
+
const parent = path15[path15.length - 1];
|
|
626
626
|
if (identity.isCollection(parent)) {
|
|
627
627
|
parent.items[key] = node;
|
|
628
628
|
} else if (identity.isPair(parent)) {
|
|
@@ -1234,10 +1234,10 @@ var require_Collection = __commonJS({
|
|
|
1234
1234
|
var createNode = require_createNode();
|
|
1235
1235
|
var identity = require_identity();
|
|
1236
1236
|
var Node = require_Node();
|
|
1237
|
-
function collectionFromPath(schema,
|
|
1237
|
+
function collectionFromPath(schema, path15, value) {
|
|
1238
1238
|
let v = value;
|
|
1239
|
-
for (let i =
|
|
1240
|
-
const k =
|
|
1239
|
+
for (let i = path15.length - 1; i >= 0; --i) {
|
|
1240
|
+
const k = path15[i];
|
|
1241
1241
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
1242
1242
|
const a = [];
|
|
1243
1243
|
a[k] = v;
|
|
@@ -1256,7 +1256,7 @@ var require_Collection = __commonJS({
|
|
|
1256
1256
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
1257
1257
|
});
|
|
1258
1258
|
}
|
|
1259
|
-
var isEmptyPath = (
|
|
1259
|
+
var isEmptyPath = (path15) => path15 == null || typeof path15 === "object" && !!path15[Symbol.iterator]().next().done;
|
|
1260
1260
|
var Collection = class extends Node.NodeBase {
|
|
1261
1261
|
constructor(type, schema) {
|
|
1262
1262
|
super(type);
|
|
@@ -1286,11 +1286,11 @@ var require_Collection = __commonJS({
|
|
|
1286
1286
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
1287
1287
|
* that already exists in the map.
|
|
1288
1288
|
*/
|
|
1289
|
-
addIn(
|
|
1290
|
-
if (isEmptyPath(
|
|
1289
|
+
addIn(path15, value) {
|
|
1290
|
+
if (isEmptyPath(path15))
|
|
1291
1291
|
this.add(value);
|
|
1292
1292
|
else {
|
|
1293
|
-
const [key, ...rest] =
|
|
1293
|
+
const [key, ...rest] = path15;
|
|
1294
1294
|
const node = this.get(key, true);
|
|
1295
1295
|
if (identity.isCollection(node))
|
|
1296
1296
|
node.addIn(rest, value);
|
|
@@ -1304,8 +1304,8 @@ var require_Collection = __commonJS({
|
|
|
1304
1304
|
* Removes a value from the collection.
|
|
1305
1305
|
* @returns `true` if the item was found and removed.
|
|
1306
1306
|
*/
|
|
1307
|
-
deleteIn(
|
|
1308
|
-
const [key, ...rest] =
|
|
1307
|
+
deleteIn(path15) {
|
|
1308
|
+
const [key, ...rest] = path15;
|
|
1309
1309
|
if (rest.length === 0)
|
|
1310
1310
|
return this.delete(key);
|
|
1311
1311
|
const node = this.get(key, true);
|
|
@@ -1319,8 +1319,8 @@ var require_Collection = __commonJS({
|
|
|
1319
1319
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
1320
1320
|
* `true` (collections are always returned intact).
|
|
1321
1321
|
*/
|
|
1322
|
-
getIn(
|
|
1323
|
-
const [key, ...rest] =
|
|
1322
|
+
getIn(path15, keepScalar) {
|
|
1323
|
+
const [key, ...rest] = path15;
|
|
1324
1324
|
const node = this.get(key, true);
|
|
1325
1325
|
if (rest.length === 0)
|
|
1326
1326
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -1338,8 +1338,8 @@ var require_Collection = __commonJS({
|
|
|
1338
1338
|
/**
|
|
1339
1339
|
* Checks if the collection includes a value with the key `key`.
|
|
1340
1340
|
*/
|
|
1341
|
-
hasIn(
|
|
1342
|
-
const [key, ...rest] =
|
|
1341
|
+
hasIn(path15) {
|
|
1342
|
+
const [key, ...rest] = path15;
|
|
1343
1343
|
if (rest.length === 0)
|
|
1344
1344
|
return this.has(key);
|
|
1345
1345
|
const node = this.get(key, true);
|
|
@@ -1349,8 +1349,8 @@ var require_Collection = __commonJS({
|
|
|
1349
1349
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
1350
1350
|
* boolean to add/remove the item from the set.
|
|
1351
1351
|
*/
|
|
1352
|
-
setIn(
|
|
1353
|
-
const [key, ...rest] =
|
|
1352
|
+
setIn(path15, value) {
|
|
1353
|
+
const [key, ...rest] = path15;
|
|
1354
1354
|
if (rest.length === 0) {
|
|
1355
1355
|
this.set(key, value);
|
|
1356
1356
|
} else {
|
|
@@ -3865,9 +3865,9 @@ var require_Document = __commonJS({
|
|
|
3865
3865
|
this.contents.add(value);
|
|
3866
3866
|
}
|
|
3867
3867
|
/** Adds a value to the document. */
|
|
3868
|
-
addIn(
|
|
3868
|
+
addIn(path15, value) {
|
|
3869
3869
|
if (assertCollection(this.contents))
|
|
3870
|
-
this.contents.addIn(
|
|
3870
|
+
this.contents.addIn(path15, value);
|
|
3871
3871
|
}
|
|
3872
3872
|
/**
|
|
3873
3873
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3942,14 +3942,14 @@ var require_Document = __commonJS({
|
|
|
3942
3942
|
* Removes a value from the document.
|
|
3943
3943
|
* @returns `true` if the item was found and removed.
|
|
3944
3944
|
*/
|
|
3945
|
-
deleteIn(
|
|
3946
|
-
if (Collection.isEmptyPath(
|
|
3945
|
+
deleteIn(path15) {
|
|
3946
|
+
if (Collection.isEmptyPath(path15)) {
|
|
3947
3947
|
if (this.contents == null)
|
|
3948
3948
|
return false;
|
|
3949
3949
|
this.contents = null;
|
|
3950
3950
|
return true;
|
|
3951
3951
|
}
|
|
3952
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3952
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path15) : false;
|
|
3953
3953
|
}
|
|
3954
3954
|
/**
|
|
3955
3955
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3964,10 +3964,10 @@ var require_Document = __commonJS({
|
|
|
3964
3964
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3965
3965
|
* `true` (collections are always returned intact).
|
|
3966
3966
|
*/
|
|
3967
|
-
getIn(
|
|
3968
|
-
if (Collection.isEmptyPath(
|
|
3967
|
+
getIn(path15, keepScalar) {
|
|
3968
|
+
if (Collection.isEmptyPath(path15))
|
|
3969
3969
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3970
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
3970
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path15, keepScalar) : void 0;
|
|
3971
3971
|
}
|
|
3972
3972
|
/**
|
|
3973
3973
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3978,10 +3978,10 @@ var require_Document = __commonJS({
|
|
|
3978
3978
|
/**
|
|
3979
3979
|
* Checks if the document includes a value at `path`.
|
|
3980
3980
|
*/
|
|
3981
|
-
hasIn(
|
|
3982
|
-
if (Collection.isEmptyPath(
|
|
3981
|
+
hasIn(path15) {
|
|
3982
|
+
if (Collection.isEmptyPath(path15))
|
|
3983
3983
|
return this.contents !== void 0;
|
|
3984
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
3984
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path15) : false;
|
|
3985
3985
|
}
|
|
3986
3986
|
/**
|
|
3987
3987
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3998,13 +3998,13 @@ var require_Document = __commonJS({
|
|
|
3998
3998
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3999
3999
|
* boolean to add/remove the item from the set.
|
|
4000
4000
|
*/
|
|
4001
|
-
setIn(
|
|
4002
|
-
if (Collection.isEmptyPath(
|
|
4001
|
+
setIn(path15, value) {
|
|
4002
|
+
if (Collection.isEmptyPath(path15)) {
|
|
4003
4003
|
this.contents = value;
|
|
4004
4004
|
} else if (this.contents == null) {
|
|
4005
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
4005
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path15), value);
|
|
4006
4006
|
} else if (assertCollection(this.contents)) {
|
|
4007
|
-
this.contents.setIn(
|
|
4007
|
+
this.contents.setIn(path15, value);
|
|
4008
4008
|
}
|
|
4009
4009
|
}
|
|
4010
4010
|
/**
|
|
@@ -5965,9 +5965,9 @@ var require_cst_visit = __commonJS({
|
|
|
5965
5965
|
visit.BREAK = BREAK;
|
|
5966
5966
|
visit.SKIP = SKIP;
|
|
5967
5967
|
visit.REMOVE = REMOVE;
|
|
5968
|
-
visit.itemAtPath = (cst,
|
|
5968
|
+
visit.itemAtPath = (cst, path15) => {
|
|
5969
5969
|
let item = cst;
|
|
5970
|
-
for (const [field, index] of
|
|
5970
|
+
for (const [field, index] of path15) {
|
|
5971
5971
|
const tok = item?.[field];
|
|
5972
5972
|
if (tok && "items" in tok) {
|
|
5973
5973
|
item = tok.items[index];
|
|
@@ -5976,23 +5976,23 @@ var require_cst_visit = __commonJS({
|
|
|
5976
5976
|
}
|
|
5977
5977
|
return item;
|
|
5978
5978
|
};
|
|
5979
|
-
visit.parentCollection = (cst,
|
|
5980
|
-
const parent = visit.itemAtPath(cst,
|
|
5981
|
-
const field =
|
|
5979
|
+
visit.parentCollection = (cst, path15) => {
|
|
5980
|
+
const parent = visit.itemAtPath(cst, path15.slice(0, -1));
|
|
5981
|
+
const field = path15[path15.length - 1][0];
|
|
5982
5982
|
const coll = parent?.[field];
|
|
5983
5983
|
if (coll && "items" in coll)
|
|
5984
5984
|
return coll;
|
|
5985
5985
|
throw new Error("Parent collection not found");
|
|
5986
5986
|
};
|
|
5987
|
-
function _visit(
|
|
5988
|
-
let ctrl = visitor(item,
|
|
5987
|
+
function _visit(path15, item, visitor) {
|
|
5988
|
+
let ctrl = visitor(item, path15);
|
|
5989
5989
|
if (typeof ctrl === "symbol")
|
|
5990
5990
|
return ctrl;
|
|
5991
5991
|
for (const field of ["key", "value"]) {
|
|
5992
5992
|
const token = item[field];
|
|
5993
5993
|
if (token && "items" in token) {
|
|
5994
5994
|
for (let i = 0; i < token.items.length; ++i) {
|
|
5995
|
-
const ci = _visit(Object.freeze(
|
|
5995
|
+
const ci = _visit(Object.freeze(path15.concat([[field, i]])), token.items[i], visitor);
|
|
5996
5996
|
if (typeof ci === "number")
|
|
5997
5997
|
i = ci - 1;
|
|
5998
5998
|
else if (ci === BREAK)
|
|
@@ -6003,10 +6003,10 @@ var require_cst_visit = __commonJS({
|
|
|
6003
6003
|
}
|
|
6004
6004
|
}
|
|
6005
6005
|
if (typeof ctrl === "function" && field === "key")
|
|
6006
|
-
ctrl = ctrl(item,
|
|
6006
|
+
ctrl = ctrl(item, path15);
|
|
6007
6007
|
}
|
|
6008
6008
|
}
|
|
6009
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
6009
|
+
return typeof ctrl === "function" ? ctrl(item, path15) : ctrl;
|
|
6010
6010
|
}
|
|
6011
6011
|
exports.visit = visit;
|
|
6012
6012
|
}
|
|
@@ -7308,14 +7308,14 @@ var require_parser = __commonJS({
|
|
|
7308
7308
|
case "scalar":
|
|
7309
7309
|
case "single-quoted-scalar":
|
|
7310
7310
|
case "double-quoted-scalar": {
|
|
7311
|
-
const
|
|
7311
|
+
const fs10 = this.flowScalar(this.type);
|
|
7312
7312
|
if (atNextItem || it.value) {
|
|
7313
|
-
map.items.push({ start, key:
|
|
7313
|
+
map.items.push({ start, key: fs10, sep: [] });
|
|
7314
7314
|
this.onKeyLine = true;
|
|
7315
7315
|
} else if (it.sep) {
|
|
7316
|
-
this.stack.push(
|
|
7316
|
+
this.stack.push(fs10);
|
|
7317
7317
|
} else {
|
|
7318
|
-
Object.assign(it, { key:
|
|
7318
|
+
Object.assign(it, { key: fs10, sep: [] });
|
|
7319
7319
|
this.onKeyLine = true;
|
|
7320
7320
|
}
|
|
7321
7321
|
return;
|
|
@@ -7443,13 +7443,13 @@ var require_parser = __commonJS({
|
|
|
7443
7443
|
case "scalar":
|
|
7444
7444
|
case "single-quoted-scalar":
|
|
7445
7445
|
case "double-quoted-scalar": {
|
|
7446
|
-
const
|
|
7446
|
+
const fs10 = this.flowScalar(this.type);
|
|
7447
7447
|
if (!it || it.value)
|
|
7448
|
-
fc.items.push({ start: [], key:
|
|
7448
|
+
fc.items.push({ start: [], key: fs10, sep: [] });
|
|
7449
7449
|
else if (it.sep)
|
|
7450
|
-
this.stack.push(
|
|
7450
|
+
this.stack.push(fs10);
|
|
7451
7451
|
else
|
|
7452
|
-
Object.assign(it, { key:
|
|
7452
|
+
Object.assign(it, { key: fs10, sep: [] });
|
|
7453
7453
|
return;
|
|
7454
7454
|
}
|
|
7455
7455
|
case "flow-map-end":
|
|
@@ -7759,8 +7759,27 @@ var require_dist2 = __commonJS({
|
|
|
7759
7759
|
|
|
7760
7760
|
// ../configuration-core/src/flags.ts
|
|
7761
7761
|
import * as fs from "node:fs";
|
|
7762
|
+
import * as path2 from "node:path";
|
|
7763
|
+
|
|
7764
|
+
// ../configuration-core/src/home.ts
|
|
7765
|
+
import * as os from "node:os";
|
|
7762
7766
|
import * as path from "node:path";
|
|
7763
|
-
|
|
7767
|
+
var ARGENT_HOME_DIR_ENV = "ARGENT_HOME_DIR";
|
|
7768
|
+
function nonEmpty(value) {
|
|
7769
|
+
if (value == void 0) return null;
|
|
7770
|
+
const trimmed = value.trim();
|
|
7771
|
+
return trimmed === "" ? null : value;
|
|
7772
|
+
}
|
|
7773
|
+
function resolveHomeDir(options = {}) {
|
|
7774
|
+
if (options.homeDir) return options.homeDir;
|
|
7775
|
+
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
7776
|
+
}
|
|
7777
|
+
function argentHomeDir(options = {}) {
|
|
7778
|
+
const override = options.homeDir ? null : nonEmpty(process.env[ARGENT_HOME_DIR_ENV]);
|
|
7779
|
+
return override ? path.resolve(override.trim()) : path.join(resolveHomeDir(options), ".argent");
|
|
7780
|
+
}
|
|
7781
|
+
|
|
7782
|
+
// ../configuration-core/src/flags.ts
|
|
7764
7783
|
var FLAG_REGISTRY = [
|
|
7765
7784
|
{
|
|
7766
7785
|
name: "disable-auto-screenshot",
|
|
@@ -7824,26 +7843,25 @@ function getFlagDefinition(name, registry = FLAG_REGISTRY) {
|
|
|
7824
7843
|
}
|
|
7825
7844
|
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
7826
7845
|
function findProjectRoot(startDir) {
|
|
7827
|
-
let current =
|
|
7846
|
+
let current = path2.resolve(startDir);
|
|
7828
7847
|
while (true) {
|
|
7829
7848
|
for (const marker of PROJECT_MARKERS) {
|
|
7830
|
-
if (fs.existsSync(
|
|
7849
|
+
if (fs.existsSync(path2.join(current, marker))) return current;
|
|
7831
7850
|
}
|
|
7832
|
-
const parent =
|
|
7851
|
+
const parent = path2.dirname(current);
|
|
7833
7852
|
if (parent === current) return null;
|
|
7834
7853
|
current = parent;
|
|
7835
7854
|
}
|
|
7836
7855
|
}
|
|
7837
7856
|
function resolveProjectRoot(startDir) {
|
|
7838
|
-
return findProjectRoot(startDir) ??
|
|
7857
|
+
return findProjectRoot(startDir) ?? path2.resolve(startDir);
|
|
7839
7858
|
}
|
|
7840
7859
|
function getFlagsPath(scope, options = {}) {
|
|
7841
|
-
const home = options.homeDir ?? homedir();
|
|
7842
7860
|
if (scope === "global") {
|
|
7843
|
-
return
|
|
7861
|
+
return path2.join(argentHomeDir({ homeDir: options.homeDir }), "flags.json");
|
|
7844
7862
|
}
|
|
7845
7863
|
const cwd = options.cwd ?? process.cwd();
|
|
7846
|
-
return
|
|
7864
|
+
return path2.join(resolveProjectRoot(cwd), ".argent", "flags.json");
|
|
7847
7865
|
}
|
|
7848
7866
|
function readFlagsFile(filePath) {
|
|
7849
7867
|
let raw;
|
|
@@ -7886,17 +7904,7 @@ function isFeatureEnabled(name, options = {}, registry = FLAG_REGISTRY) {
|
|
|
7886
7904
|
|
|
7887
7905
|
// ../configuration-core/src/paths.ts
|
|
7888
7906
|
import * as fs2 from "node:fs";
|
|
7889
|
-
import * as
|
|
7890
|
-
import * as path2 from "node:path";
|
|
7891
|
-
function nonEmpty(value) {
|
|
7892
|
-
if (value == void 0) return null;
|
|
7893
|
-
const trimmed = value.trim();
|
|
7894
|
-
return trimmed === "" ? null : value;
|
|
7895
|
-
}
|
|
7896
|
-
function resolveHomeDir(options = {}) {
|
|
7897
|
-
if (options.homeDir) return options.homeDir;
|
|
7898
|
-
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
7899
|
-
}
|
|
7907
|
+
import * as path3 from "node:path";
|
|
7900
7908
|
function isHomeDir(dir, options = {}) {
|
|
7901
7909
|
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
7902
7910
|
}
|
|
@@ -7904,27 +7912,22 @@ function canonicalPath(p) {
|
|
|
7904
7912
|
try {
|
|
7905
7913
|
return fs2.realpathSync.native(p);
|
|
7906
7914
|
} catch {
|
|
7907
|
-
return
|
|
7915
|
+
return path3.resolve(p);
|
|
7908
7916
|
}
|
|
7909
7917
|
}
|
|
7910
|
-
function argentHomeDir() {
|
|
7911
|
-
return path2.join(resolveHomeDir(), ".argent");
|
|
7912
|
-
}
|
|
7913
7918
|
function configDir(scope = "global", options = {}) {
|
|
7914
|
-
if (scope === "global")
|
|
7915
|
-
return path2.join(resolveHomeDir(options), ".argent");
|
|
7916
|
-
}
|
|
7919
|
+
if (scope === "global") return argentHomeDir(options);
|
|
7917
7920
|
const cwd = options.cwd ?? process.cwd();
|
|
7918
|
-
return
|
|
7921
|
+
return path3.join(resolveProjectRoot(cwd), ".argent");
|
|
7919
7922
|
}
|
|
7920
7923
|
function configFilePath(scope = "global", options = {}) {
|
|
7921
|
-
return
|
|
7924
|
+
return path3.join(configDir(scope, options), "config.json");
|
|
7922
7925
|
}
|
|
7923
7926
|
|
|
7924
7927
|
// ../configuration-core/src/config.ts
|
|
7925
7928
|
import * as crypto from "node:crypto";
|
|
7926
7929
|
import * as fs3 from "node:fs";
|
|
7927
|
-
import * as
|
|
7930
|
+
import * as path4 from "node:path";
|
|
7928
7931
|
function readConfigObject(scope = "global", options = {}) {
|
|
7929
7932
|
try {
|
|
7930
7933
|
const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
|
|
@@ -7965,7 +7968,7 @@ function getAtPath(obj, dottedKey) {
|
|
|
7965
7968
|
// ../configuration-core/src/secrets.ts
|
|
7966
7969
|
var import_dotenv = __toESM(require_dist(), 1);
|
|
7967
7970
|
import * as fs4 from "node:fs";
|
|
7968
|
-
import * as
|
|
7971
|
+
import * as path5 from "node:path";
|
|
7969
7972
|
var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
|
|
7970
7973
|
var SECRETS_FILE_NAME = "secrets.env";
|
|
7971
7974
|
var SHARED_ENV_FILES = [".env.local", ".env"];
|
|
@@ -8029,20 +8032,20 @@ function secretSources(options = {}) {
|
|
|
8029
8032
|
const filePaths = [];
|
|
8030
8033
|
if (projectRoot) {
|
|
8031
8034
|
filePaths.push({
|
|
8032
|
-
path:
|
|
8035
|
+
path: path5.join(projectRoot, ".argent", SECRETS_FILE_NAME),
|
|
8033
8036
|
exposure: "dedicated"
|
|
8034
8037
|
});
|
|
8035
8038
|
for (const name of SHARED_ENV_FILES) {
|
|
8036
|
-
filePaths.push({ path:
|
|
8039
|
+
filePaths.push({ path: path5.join(projectRoot, name), exposure: "shared" });
|
|
8037
8040
|
}
|
|
8038
8041
|
}
|
|
8039
8042
|
filePaths.push({
|
|
8040
|
-
path:
|
|
8043
|
+
path: path5.join(argentHomeDir(options), SECRETS_FILE_NAME),
|
|
8041
8044
|
exposure: "dedicated"
|
|
8042
8045
|
});
|
|
8043
8046
|
const seen = /* @__PURE__ */ new Set();
|
|
8044
8047
|
for (const entry of filePaths) {
|
|
8045
|
-
const resolved =
|
|
8048
|
+
const resolved = path5.resolve(entry.path);
|
|
8046
8049
|
if (seen.has(resolved)) continue;
|
|
8047
8050
|
seen.add(resolved);
|
|
8048
8051
|
sources.push(fileSource(resolved, entry.exposure));
|
|
@@ -8159,6 +8162,15 @@ var CONFIG_SCHEMA = [
|
|
|
8159
8162
|
// drained/reset, not just the file rewritten.
|
|
8160
8163
|
manageCommand: "argent telemetry"
|
|
8161
8164
|
},
|
|
8165
|
+
{
|
|
8166
|
+
key: "autoUpdate.enabled",
|
|
8167
|
+
description: "Automatically update the global Argent installation. Project-local installs require confirmation.",
|
|
8168
|
+
scopes: ["global"],
|
|
8169
|
+
parse: asBoolean,
|
|
8170
|
+
merge: "prioritize-local",
|
|
8171
|
+
default: true,
|
|
8172
|
+
example: "false"
|
|
8173
|
+
},
|
|
8162
8174
|
{
|
|
8163
8175
|
key: "lens.agent",
|
|
8164
8176
|
description: "Coding-agent id remembered by `argent lens` to skip the picker.",
|
|
@@ -8247,7 +8259,8 @@ function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
|
|
|
8247
8259
|
}
|
|
8248
8260
|
|
|
8249
8261
|
// ../configuration-core/src/config-access.ts
|
|
8250
|
-
import * as
|
|
8262
|
+
import * as fs5 from "node:fs";
|
|
8263
|
+
import * as path6 from "node:path";
|
|
8251
8264
|
function readScopeValue(def, scope, options) {
|
|
8252
8265
|
if (!def.scopes.includes(scope)) return void 0;
|
|
8253
8266
|
const raw = getAtPath(readConfigObject(scope, options), def.key);
|
|
@@ -8281,17 +8294,16 @@ var UnknownConfigKeyError = class extends Error {
|
|
|
8281
8294
|
|
|
8282
8295
|
// ../argent-tools-client/src/launcher.ts
|
|
8283
8296
|
import * as net from "node:net";
|
|
8284
|
-
import * as
|
|
8285
|
-
import * as
|
|
8297
|
+
import * as fs6 from "node:fs";
|
|
8298
|
+
import * as path7 from "node:path";
|
|
8286
8299
|
import * as readline from "node:readline";
|
|
8287
|
-
import { homedir as homedir3 } from "node:os";
|
|
8288
8300
|
import { spawn, execFileSync } from "node:child_process";
|
|
8289
8301
|
import { createHash, randomBytes } from "node:crypto";
|
|
8290
8302
|
import { mkdir, writeFile, readFile, readdir, unlink, rename, chmod } from "node:fs/promises";
|
|
8291
|
-
var STATE_DIR =
|
|
8292
|
-
var STATE_FILE =
|
|
8293
|
-
var LOG_FILE =
|
|
8294
|
-
var LOCK_FILE =
|
|
8303
|
+
var STATE_DIR = argentHomeDir();
|
|
8304
|
+
var STATE_FILE = path7.join(STATE_DIR, "tool-server.json");
|
|
8305
|
+
var LOG_FILE = path7.join(STATE_DIR, "tool-server.log");
|
|
8306
|
+
var LOCK_FILE = path7.join(STATE_DIR, "tool-server.lock");
|
|
8295
8307
|
var AUTH_TOKEN_BYTES = 32;
|
|
8296
8308
|
var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
|
|
8297
8309
|
var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
|
|
@@ -8308,6 +8320,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
|
8308
8320
|
env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
|
|
8309
8321
|
}
|
|
8310
8322
|
env[AUTH_TOKEN_ENV] = options.token ?? "";
|
|
8323
|
+
env.ARGENT_SERVER_MANAGED = options.managed ?? "autospawn";
|
|
8311
8324
|
if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
|
|
8312
8325
|
if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
|
|
8313
8326
|
return env;
|
|
@@ -8316,7 +8329,7 @@ function generateToken() {
|
|
|
8316
8329
|
return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
|
|
8317
8330
|
}
|
|
8318
8331
|
function findFreePort() {
|
|
8319
|
-
return new Promise((
|
|
8332
|
+
return new Promise((resolve12, reject) => {
|
|
8320
8333
|
const srv = net.createServer();
|
|
8321
8334
|
srv.listen(0, "127.0.0.1", () => {
|
|
8322
8335
|
const addr = srv.address();
|
|
@@ -8327,7 +8340,7 @@ function findFreePort() {
|
|
|
8327
8340
|
const port = addr.port;
|
|
8328
8341
|
srv.close((err) => {
|
|
8329
8342
|
if (err) reject(err);
|
|
8330
|
-
else
|
|
8343
|
+
else resolve12(port);
|
|
8331
8344
|
});
|
|
8332
8345
|
});
|
|
8333
8346
|
srv.on("error", reject);
|
|
@@ -8369,7 +8382,7 @@ function isVersionNewer(a, b) {
|
|
|
8369
8382
|
function readBundlePackageVersion(bundlePath) {
|
|
8370
8383
|
try {
|
|
8371
8384
|
const pkg = JSON.parse(
|
|
8372
|
-
|
|
8385
|
+
fs6.readFileSync(path7.join(path7.dirname(bundlePath), "..", "package.json"), "utf8")
|
|
8373
8386
|
);
|
|
8374
8387
|
return typeof pkg.version === "string" ? pkg.version : void 0;
|
|
8375
8388
|
} catch {
|
|
@@ -8426,16 +8439,20 @@ function killSpawnedChild(child, pid) {
|
|
|
8426
8439
|
}
|
|
8427
8440
|
function resolveToolsServerNode() {
|
|
8428
8441
|
const { bun, deno, electron } = process.versions;
|
|
8429
|
-
return !(bun || deno || electron) &&
|
|
8442
|
+
return !(bun || deno || electron) && fs6.existsSync(process.execPath) ? process.execPath : "node";
|
|
8443
|
+
}
|
|
8444
|
+
function parseListeningPort(line) {
|
|
8445
|
+
const match = line.match(/Tools server listening on http:\/\/.+:(\d+)/);
|
|
8446
|
+
return match ? parseInt(match[1], 10) : null;
|
|
8430
8447
|
}
|
|
8431
8448
|
function spawnToolsServer(paths, port, options = {}) {
|
|
8432
|
-
return new Promise((
|
|
8449
|
+
return new Promise((resolve12, reject) => {
|
|
8433
8450
|
let logFd;
|
|
8434
8451
|
try {
|
|
8435
|
-
|
|
8436
|
-
logFd =
|
|
8452
|
+
fs6.mkdirSync(STATE_DIR, { recursive: true });
|
|
8453
|
+
logFd = fs6.openSync(LOG_FILE, "a");
|
|
8437
8454
|
} catch {
|
|
8438
|
-
logFd =
|
|
8455
|
+
logFd = fs6.openSync("/dev/null", "w");
|
|
8439
8456
|
}
|
|
8440
8457
|
const nodeBin = resolveToolsServerNode();
|
|
8441
8458
|
const child = spawn(nodeBin, [paths.bundlePath, "start"], {
|
|
@@ -8443,8 +8460,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
8443
8460
|
stdio: ["ignore", "pipe", logFd],
|
|
8444
8461
|
env: buildToolsServerEnv(paths, port, process.env, options)
|
|
8445
8462
|
});
|
|
8446
|
-
|
|
8447
|
-
child.unref();
|
|
8463
|
+
fs6.closeSync(logFd);
|
|
8448
8464
|
const pid = child.pid;
|
|
8449
8465
|
if (!pid) {
|
|
8450
8466
|
child.once(
|
|
@@ -8469,13 +8485,13 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
8469
8485
|
});
|
|
8470
8486
|
const rl = readline.createInterface({ input: child.stdout });
|
|
8471
8487
|
rl.on("line", (line) => {
|
|
8472
|
-
const
|
|
8473
|
-
if (
|
|
8474
|
-
const actualPort = parseInt(match[1], 10);
|
|
8488
|
+
const actualPort = parseListeningPort(line);
|
|
8489
|
+
if (actualPort !== null) {
|
|
8475
8490
|
rl.close();
|
|
8476
8491
|
child.stdout?.resume();
|
|
8477
8492
|
child.stdout?.unref?.();
|
|
8478
|
-
|
|
8493
|
+
child.unref();
|
|
8494
|
+
settle(() => resolve12({ port: actualPort, pid }));
|
|
8479
8495
|
}
|
|
8480
8496
|
});
|
|
8481
8497
|
child.on("error", (err) => {
|
|
@@ -8495,7 +8511,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
8495
8511
|
}
|
|
8496
8512
|
function stateFileForBundle(bundlePath) {
|
|
8497
8513
|
const key = createHash("sha256").update(bundlePath).digest("hex").slice(0, 12);
|
|
8498
|
-
return
|
|
8514
|
+
return path7.join(STATE_DIR, `tool-server-${key}.json`);
|
|
8499
8515
|
}
|
|
8500
8516
|
async function readStateFile(file) {
|
|
8501
8517
|
try {
|
|
@@ -8554,7 +8570,7 @@ async function readAllToolsServerStates() {
|
|
|
8554
8570
|
const out = [];
|
|
8555
8571
|
for (const name of names) {
|
|
8556
8572
|
if (!STATE_FILE_RE.test(name)) continue;
|
|
8557
|
-
const file =
|
|
8573
|
+
const file = path7.join(STATE_DIR, name);
|
|
8558
8574
|
const state = await readStateFile(file);
|
|
8559
8575
|
if (state) out.push({ file, state });
|
|
8560
8576
|
}
|
|
@@ -8570,7 +8586,7 @@ async function sweepDeadStateFiles() {
|
|
|
8570
8586
|
});
|
|
8571
8587
|
continue;
|
|
8572
8588
|
}
|
|
8573
|
-
if (
|
|
8589
|
+
if (fs6.existsSync(fresh.bundlePath)) continue;
|
|
8574
8590
|
if (!couldBeOurToolServer(fresh.pid, fresh.bundlePath)) continue;
|
|
8575
8591
|
await unlink(file).catch(() => {
|
|
8576
8592
|
});
|
|
@@ -8617,7 +8633,7 @@ async function killToolServer(bundlePath) {
|
|
|
8617
8633
|
await clearToolsServerState(bundlePath ?? state.bundlePath);
|
|
8618
8634
|
return alive;
|
|
8619
8635
|
}
|
|
8620
|
-
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) =>
|
|
8636
|
+
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs6.existsSync(p)) ?? "ps";
|
|
8621
8637
|
var PS_WIDTH_FLAGS = ["-ww"];
|
|
8622
8638
|
var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
8623
8639
|
function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
|
|
@@ -8664,13 +8680,13 @@ var LOCK_STALE_MS = 45e3;
|
|
|
8664
8680
|
var LOCK_POLL_MS = 100;
|
|
8665
8681
|
function spawnLockIsStale() {
|
|
8666
8682
|
try {
|
|
8667
|
-
const { pid, ts } = JSON.parse(
|
|
8683
|
+
const { pid, ts } = JSON.parse(fs6.readFileSync(LOCK_FILE, "utf8"));
|
|
8668
8684
|
if (typeof pid === "number" && pid > 0 && !isProcessAlive(pid)) return true;
|
|
8669
8685
|
if (typeof ts === "number" && Date.now() - ts > LOCK_STALE_MS) return true;
|
|
8670
8686
|
return false;
|
|
8671
8687
|
} catch {
|
|
8672
8688
|
try {
|
|
8673
|
-
return Date.now() -
|
|
8689
|
+
return Date.now() - fs6.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS;
|
|
8674
8690
|
} catch {
|
|
8675
8691
|
return true;
|
|
8676
8692
|
}
|
|
@@ -8678,7 +8694,7 @@ function spawnLockIsStale() {
|
|
|
8678
8694
|
}
|
|
8679
8695
|
async function acquireSpawnLock() {
|
|
8680
8696
|
try {
|
|
8681
|
-
|
|
8697
|
+
fs6.mkdirSync(STATE_DIR, { recursive: true });
|
|
8682
8698
|
} catch {
|
|
8683
8699
|
return null;
|
|
8684
8700
|
}
|
|
@@ -8686,11 +8702,11 @@ async function acquireSpawnLock() {
|
|
|
8686
8702
|
const deadline = Date.now() + LOCK_WAIT_TIMEOUT_MS;
|
|
8687
8703
|
for (; ; ) {
|
|
8688
8704
|
try {
|
|
8689
|
-
const fd =
|
|
8705
|
+
const fd = fs6.openSync(LOCK_FILE, "wx");
|
|
8690
8706
|
try {
|
|
8691
|
-
|
|
8707
|
+
fs6.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
|
|
8692
8708
|
} finally {
|
|
8693
|
-
|
|
8709
|
+
fs6.closeSync(fd);
|
|
8694
8710
|
}
|
|
8695
8711
|
let released = false;
|
|
8696
8712
|
return {
|
|
@@ -8698,8 +8714,8 @@ async function acquireSpawnLock() {
|
|
|
8698
8714
|
if (released) return;
|
|
8699
8715
|
released = true;
|
|
8700
8716
|
try {
|
|
8701
|
-
const cur = JSON.parse(
|
|
8702
|
-
if (cur.pid === process.pid && cur.nonce === nonce)
|
|
8717
|
+
const cur = JSON.parse(fs6.readFileSync(LOCK_FILE, "utf8"));
|
|
8718
|
+
if (cur.pid === process.pid && cur.nonce === nonce) fs6.unlinkSync(LOCK_FILE);
|
|
8703
8719
|
} catch {
|
|
8704
8720
|
}
|
|
8705
8721
|
}
|
|
@@ -8708,10 +8724,10 @@ async function acquireSpawnLock() {
|
|
|
8708
8724
|
if (err.code !== "EEXIST") return null;
|
|
8709
8725
|
if (spawnLockIsStale()) {
|
|
8710
8726
|
try {
|
|
8711
|
-
|
|
8727
|
+
fs6.unlinkSync(LOCK_FILE);
|
|
8712
8728
|
} catch {
|
|
8713
8729
|
}
|
|
8714
|
-
if (!
|
|
8730
|
+
if (!fs6.existsSync(LOCK_FILE)) continue;
|
|
8715
8731
|
}
|
|
8716
8732
|
if (Date.now() >= deadline) return null;
|
|
8717
8733
|
await new Promise((r) => setTimeout(r, LOCK_POLL_MS));
|
|
@@ -8751,7 +8767,7 @@ async function ensureToolsServer(paths) {
|
|
|
8751
8767
|
}
|
|
8752
8768
|
await clearToolsServerState(paths.bundlePath);
|
|
8753
8769
|
await sweepDeadStateFiles();
|
|
8754
|
-
if (!
|
|
8770
|
+
if (!fs6.existsSync(paths.bundlePath)) {
|
|
8755
8771
|
throw new Error(
|
|
8756
8772
|
`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.`
|
|
8757
8773
|
);
|
|
@@ -8784,7 +8800,7 @@ async function ensureToolsServer(paths) {
|
|
|
8784
8800
|
var import_yaml2 = __toESM(require_dist2(), 1);
|
|
8785
8801
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
8786
8802
|
import { maxHeaderSize } from "node:http";
|
|
8787
|
-
import * as
|
|
8803
|
+
import * as path13 from "node:path";
|
|
8788
8804
|
|
|
8789
8805
|
// ../registry/src/types.ts
|
|
8790
8806
|
var LINKED_CALL_HEADER = "x-argent-linked";
|
|
@@ -8845,8 +8861,8 @@ var UNEXPANDED_PATH = /^~|\$[A-Za-z0-9_{(]|`|%[A-Za-z_][A-Za-z0-9_]*%|^[A-Za-z][
|
|
|
8845
8861
|
function isUnexpandedPath(p) {
|
|
8846
8862
|
return UNEXPANDED_PATH.test(p);
|
|
8847
8863
|
}
|
|
8848
|
-
function isClientFileArgument({ spec, path:
|
|
8849
|
-
return spec.kind === "file" && spec.path === `\${${spec.target}}` &&
|
|
8864
|
+
function isClientFileArgument({ spec, path: path15 }) {
|
|
8865
|
+
return spec.kind === "file" && spec.path === `\${${spec.target}}` && path15.startsWith("/") && hasToolFileExtension(path15);
|
|
8850
8866
|
}
|
|
8851
8867
|
|
|
8852
8868
|
// ../registry/src/flow-platforms.ts
|
|
@@ -8854,26 +8870,26 @@ var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
|
|
|
8854
8870
|
var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
|
|
8855
8871
|
|
|
8856
8872
|
// ../registry/src/flow-file-refs.ts
|
|
8857
|
-
import * as
|
|
8858
|
-
import * as
|
|
8873
|
+
import * as fs8 from "node:fs/promises";
|
|
8874
|
+
import * as path9 from "node:path";
|
|
8859
8875
|
|
|
8860
8876
|
// ../registry/src/e2e-dirs.ts
|
|
8861
|
-
import * as
|
|
8862
|
-
import * as
|
|
8863
|
-
var E2E_DIR =
|
|
8864
|
-
var LEGACY_E2E_DIRS = Object.freeze([
|
|
8877
|
+
import * as fs7 from "node:fs/promises";
|
|
8878
|
+
import * as path8 from "node:path";
|
|
8879
|
+
var E2E_DIR = path8.join(".argent", "e2e");
|
|
8880
|
+
var LEGACY_E2E_DIRS = Object.freeze([path8.join(".argent", "flows")]);
|
|
8865
8881
|
var E2E_DIRS = Object.freeze([E2E_DIR, ...LEGACY_E2E_DIRS]);
|
|
8866
8882
|
function e2eDirFor(projectRoot) {
|
|
8867
|
-
return
|
|
8883
|
+
return path8.join(projectRoot, E2E_DIR);
|
|
8868
8884
|
}
|
|
8869
8885
|
function e2eDirsFor(projectRoot) {
|
|
8870
|
-
return E2E_DIRS.map((dir) =>
|
|
8886
|
+
return E2E_DIRS.map((dir) => path8.join(projectRoot, dir));
|
|
8871
8887
|
}
|
|
8872
8888
|
function e2eFileCandidates(projectRoot, name) {
|
|
8873
|
-
return e2eDirsFor(projectRoot).map((dir) =>
|
|
8889
|
+
return e2eDirsFor(projectRoot).map((dir) => path8.join(dir, `${name}.yaml`));
|
|
8874
8890
|
}
|
|
8875
8891
|
async function exists(file) {
|
|
8876
|
-
return
|
|
8892
|
+
return fs7.stat(file).then(
|
|
8877
8893
|
() => true,
|
|
8878
8894
|
() => false
|
|
8879
8895
|
);
|
|
@@ -8900,21 +8916,21 @@ async function pickE2eFile(candidates) {
|
|
|
8900
8916
|
function e2eShadowWarning(used, shadowed) {
|
|
8901
8917
|
return `${shadowed} is not used: ${used} has the same name and is read first.`;
|
|
8902
8918
|
}
|
|
8903
|
-
var E2E_DIR_NAMES = E2E_DIRS.map((dir) =>
|
|
8919
|
+
var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path8.basename(dir));
|
|
8904
8920
|
function e2eDirProject(dir) {
|
|
8905
8921
|
const trimmed = dir.length > 1 ? dir.replace(/[\\/]+$/, "") : dir;
|
|
8906
|
-
const argent =
|
|
8907
|
-
if (!E2E_DIR_NAMES.includes(
|
|
8922
|
+
const argent = path8.dirname(trimmed);
|
|
8923
|
+
if (!E2E_DIR_NAMES.includes(path8.basename(trimmed)) || path8.basename(argent) !== ".argent") {
|
|
8908
8924
|
return null;
|
|
8909
8925
|
}
|
|
8910
|
-
return
|
|
8926
|
+
return path8.dirname(argent);
|
|
8911
8927
|
}
|
|
8912
8928
|
function e2eRunFallbackDirs(anchorDir, target) {
|
|
8913
8929
|
if (target.includes("/") || target.includes("\\")) return [];
|
|
8914
8930
|
const project = e2eDirProject(anchorDir);
|
|
8915
8931
|
if (project === null) return [];
|
|
8916
|
-
const anchor =
|
|
8917
|
-
return e2eDirsFor(project).filter((dir) =>
|
|
8932
|
+
const anchor = path8.resolve(anchorDir);
|
|
8933
|
+
return e2eDirsFor(project).filter((dir) => path8.resolve(dir) !== anchor);
|
|
8918
8934
|
}
|
|
8919
8935
|
|
|
8920
8936
|
// ../registry/src/tool-ids.ts
|
|
@@ -8964,10 +8980,10 @@ function canonicalToolArgs(tool, args) {
|
|
|
8964
8980
|
// ../registry/src/flow-file-refs.ts
|
|
8965
8981
|
async function canonicalFlowPath(p) {
|
|
8966
8982
|
try {
|
|
8967
|
-
return await
|
|
8983
|
+
return await fs8.realpath(p);
|
|
8968
8984
|
} catch {
|
|
8969
8985
|
try {
|
|
8970
|
-
return
|
|
8986
|
+
return path9.join(await fs8.realpath(path9.dirname(p)), path9.basename(p));
|
|
8971
8987
|
} catch {
|
|
8972
8988
|
return p;
|
|
8973
8989
|
}
|
|
@@ -8976,7 +8992,7 @@ async function canonicalFlowPath(p) {
|
|
|
8976
8992
|
function completeRunExtension(value) {
|
|
8977
8993
|
if (value.endsWith(".yaml")) return value;
|
|
8978
8994
|
const candidate = `${value}.yaml`;
|
|
8979
|
-
return FLOW_FILE_NAME_PATTERN.test(
|
|
8995
|
+
return FLOW_FILE_NAME_PATTERN.test(path9.posix.basename(candidate)) ? candidate : value;
|
|
8980
8996
|
}
|
|
8981
8997
|
var MAX_RUN_DEPTH = 20;
|
|
8982
8998
|
var MAX_BLOCK_NESTING = 64;
|
|
@@ -8998,9 +9014,9 @@ function collectFlowRequests(doc) {
|
|
|
8998
9014
|
for (const step of steps) {
|
|
8999
9015
|
if (!isRecord(step)) continue;
|
|
9000
9016
|
const run = step.run;
|
|
9001
|
-
if (typeof run === "string" && !run.includes("\\") && !
|
|
9017
|
+
if (typeof run === "string" && !run.includes("\\") && !path9.posix.isAbsolute(run) && !/^[A-Za-z]:/.test(run)) {
|
|
9002
9018
|
const target = completeRunExtension(run);
|
|
9003
|
-
if (FLOW_FILE_NAME_PATTERN.test(
|
|
9019
|
+
if (FLOW_FILE_NAME_PATTERN.test(path9.posix.basename(target))) runTargets.add(target);
|
|
9004
9020
|
}
|
|
9005
9021
|
const snapshot = isRecord(step.snapshot) ? step.snapshot.name : step.snapshot;
|
|
9006
9022
|
if (typeof snapshot === "string" && FLOW_NAME_PATTERN.test(snapshot)) snapshots.add(snapshot);
|
|
@@ -9013,18 +9029,21 @@ function collectFlowRequests(doc) {
|
|
|
9013
9029
|
visit(step.steps, depth + 1);
|
|
9014
9030
|
}
|
|
9015
9031
|
};
|
|
9016
|
-
if (isRecord(doc))
|
|
9032
|
+
if (isRecord(doc)) {
|
|
9033
|
+
visit(doc.steps, 0);
|
|
9034
|
+
visit(doc.shutdown, 0);
|
|
9035
|
+
}
|
|
9017
9036
|
return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
|
|
9018
9037
|
}
|
|
9019
9038
|
function baselineKeyFor(canonicalPath2, flowName) {
|
|
9020
|
-
const stem =
|
|
9039
|
+
const stem = path9.basename(canonicalPath2, ".yaml");
|
|
9021
9040
|
return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
|
|
9022
9041
|
}
|
|
9023
9042
|
function flowMemberKey(anchorDir, target) {
|
|
9024
9043
|
return `${anchorDir}\0${target}`;
|
|
9025
9044
|
}
|
|
9026
9045
|
async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
|
|
9027
|
-
const entries = await
|
|
9046
|
+
const entries = await fs8.readdir(dir).catch(() => null);
|
|
9028
9047
|
if (entries === null || entries.includes(base)) return { state: "listed" };
|
|
9029
9048
|
const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
|
|
9030
9049
|
if (actual === void 0) return { state: "absent" };
|
|
@@ -9046,11 +9065,11 @@ function nestedFlowTarget(args) {
|
|
|
9046
9065
|
return { kind: "name", projectRoot, name, path: paths[0], paths };
|
|
9047
9066
|
}
|
|
9048
9067
|
if (name !== void 0 || !isResolvedAbsolute(flowPath)) return void 0;
|
|
9049
|
-
if (!FLOW_FILE_NAME_PATTERN.test(
|
|
9068
|
+
if (!FLOW_FILE_NAME_PATTERN.test(path9.basename(flowPath))) return void 0;
|
|
9050
9069
|
return { kind: "e2e_test_path", path: flowPath };
|
|
9051
9070
|
}
|
|
9052
9071
|
function isResolvedAbsolute(value) {
|
|
9053
|
-
return typeof value === "string" &&
|
|
9072
|
+
return typeof value === "string" && path9.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
|
|
9054
9073
|
}
|
|
9055
9074
|
|
|
9056
9075
|
// ../registry/src/failure-codes.ts
|
|
@@ -9518,9 +9537,9 @@ var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
|
|
|
9518
9537
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
9519
9538
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
9520
9539
|
var resolvedDuringInvocation = new AsyncLocalStorage();
|
|
9521
|
-
function valueAtPath(root,
|
|
9540
|
+
function valueAtPath(root, path15) {
|
|
9522
9541
|
let current = root;
|
|
9523
|
-
for (const key of
|
|
9542
|
+
for (const key of path15) {
|
|
9524
9543
|
if (current === null || typeof current !== "object") return void 0;
|
|
9525
9544
|
if (!Object.hasOwn(current, key)) return void 0;
|
|
9526
9545
|
current = current[key];
|
|
@@ -9578,11 +9597,10 @@ function describeParamIssues(error, params) {
|
|
|
9578
9597
|
}
|
|
9579
9598
|
|
|
9580
9599
|
// ../argent-tools-client/src/link-config.ts
|
|
9581
|
-
import * as
|
|
9582
|
-
import { homedir as homedir4 } from "node:os";
|
|
9600
|
+
import * as path10 from "node:path";
|
|
9583
9601
|
import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
|
|
9584
|
-
var LINK_DIR =
|
|
9585
|
-
var LINK_FILE =
|
|
9602
|
+
var LINK_DIR = argentHomeDir();
|
|
9603
|
+
var LINK_FILE = path10.join(LINK_DIR, "link.json");
|
|
9586
9604
|
async function readLinkConfig() {
|
|
9587
9605
|
try {
|
|
9588
9606
|
const raw = await readFile2(LINK_FILE, "utf8");
|
|
@@ -9635,14 +9653,14 @@ import {
|
|
|
9635
9653
|
writeFile as writeFile3
|
|
9636
9654
|
} from "node:fs/promises";
|
|
9637
9655
|
import { constants, tmpdir } from "node:os";
|
|
9638
|
-
import * as
|
|
9656
|
+
import * as path11 from "node:path";
|
|
9639
9657
|
|
|
9640
9658
|
// ../archive/src/index.ts
|
|
9641
9659
|
import { spawn as spawn2 } from "node:child_process";
|
|
9642
9660
|
import { once } from "node:events";
|
|
9643
9661
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
9644
9662
|
import { open, rm, readdir as readdir3 } from "node:fs/promises";
|
|
9645
|
-
import { basename as basename4, dirname as dirname5, join as
|
|
9663
|
+
import { basename as basename4, dirname as dirname5, join as join10, resolve as resolve8, sep as sep2 } from "node:path";
|
|
9646
9664
|
import { Writable } from "node:stream";
|
|
9647
9665
|
import { pipeline } from "node:stream/promises";
|
|
9648
9666
|
import zlib from "node:zlib";
|
|
@@ -9797,7 +9815,7 @@ async function runTar(archive, args, signal) {
|
|
|
9797
9815
|
child.on("error", (err) => {
|
|
9798
9816
|
childError = err;
|
|
9799
9817
|
});
|
|
9800
|
-
const closed = new Promise((
|
|
9818
|
+
const closed = new Promise((resolve12) => child.once("close", resolve12));
|
|
9801
9819
|
const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
|
|
9802
9820
|
maxLines: MAX_LISTING_LINES,
|
|
9803
9821
|
onOverflow: () => child.kill()
|
|
@@ -9846,16 +9864,16 @@ async function runTar(archive, args, signal) {
|
|
|
9846
9864
|
function normalizeTarMemberPath(memberPath) {
|
|
9847
9865
|
return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
9848
9866
|
}
|
|
9849
|
-
function isContainedPath(
|
|
9850
|
-
const slashed =
|
|
9867
|
+
function isContainedPath(path15, windows = process.platform === "win32") {
|
|
9868
|
+
const slashed = path15.replace(/\\/g, "/");
|
|
9851
9869
|
const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
|
|
9852
9870
|
return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
|
|
9853
9871
|
}
|
|
9854
9872
|
function isSafeTarMember(memberPath, destDir) {
|
|
9855
9873
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
9856
9874
|
if (!isContainedPath(normalized)) return false;
|
|
9857
|
-
const root =
|
|
9858
|
-
return
|
|
9875
|
+
const root = resolve8(destDir);
|
|
9876
|
+
return resolve8(destDir, normalized).startsWith(root + sep2);
|
|
9859
9877
|
}
|
|
9860
9878
|
async function readListing(archive, args, signal) {
|
|
9861
9879
|
try {
|
|
@@ -9907,7 +9925,7 @@ async function assertSafeArchive(archive, destDir, signal) {
|
|
|
9907
9925
|
async function resolveMember(destDir, expectedName) {
|
|
9908
9926
|
const entries = await readdir3(destDir);
|
|
9909
9927
|
if (entries.includes(expectedName)) {
|
|
9910
|
-
return
|
|
9928
|
+
return join10(destDir, expectedName);
|
|
9911
9929
|
}
|
|
9912
9930
|
const real = entries.filter((e) => !e.startsWith("._"));
|
|
9913
9931
|
if (real.length !== 1) {
|
|
@@ -9915,7 +9933,7 @@ async function resolveMember(destDir, expectedName) {
|
|
|
9915
9933
|
`Could not identify the extracted member (expected "${expectedName}", found ${real.length} entries).`
|
|
9916
9934
|
);
|
|
9917
9935
|
}
|
|
9918
|
-
return
|
|
9936
|
+
return join10(destDir, real[0]);
|
|
9919
9937
|
}
|
|
9920
9938
|
async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
|
|
9921
9939
|
signal?.throwIfAborted();
|
|
@@ -9968,20 +9986,20 @@ function interpolatePath(template, args) {
|
|
|
9968
9986
|
return missing ? null : out;
|
|
9969
9987
|
}
|
|
9970
9988
|
function callerPath(p) {
|
|
9971
|
-
const onCurrentDrive =
|
|
9972
|
-
if (!onCurrentDrive && (
|
|
9989
|
+
const onCurrentDrive = path11.sep === "\\" && /^[\\/](?![\\/])/.test(p);
|
|
9990
|
+
if (!onCurrentDrive && (path11.isAbsolute(p) || path11.win32.isAbsolute(p) || isUnexpandedPath(p))) {
|
|
9973
9991
|
return p;
|
|
9974
9992
|
}
|
|
9975
|
-
const { root } =
|
|
9993
|
+
const { root } = path11.parse(p);
|
|
9976
9994
|
const rest = p.slice(root.length);
|
|
9977
9995
|
if (!rest.split(/[\\/]/).includes("..")) {
|
|
9978
|
-
const resolved =
|
|
9979
|
-
const last = p.split(
|
|
9980
|
-
const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(
|
|
9981
|
-
return dirOnly ? `${resolved}${
|
|
9996
|
+
const resolved = path11.resolve(p);
|
|
9997
|
+
const last = p.split(path11.sep === "\\" ? /[\\/]/ : "/").at(-1);
|
|
9998
|
+
const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(path11.sep);
|
|
9999
|
+
return dirOnly ? `${resolved}${path11.sep}` : resolved;
|
|
9982
10000
|
}
|
|
9983
|
-
const base =
|
|
9984
|
-
return base.endsWith(
|
|
10001
|
+
const base = path11.resolve(root);
|
|
10002
|
+
return base.endsWith(path11.sep) ? `${base}${rest}` : `${base}${path11.sep}${rest}`;
|
|
9985
10003
|
}
|
|
9986
10004
|
async function specPath(spec, args) {
|
|
9987
10005
|
if (spec.kind !== "file" || !spec.paths?.length) return interpolatePath(spec.path, args);
|
|
@@ -10028,9 +10046,9 @@ function untrackArchive(archive) {
|
|
|
10028
10046
|
process.removeListener("exit", removePendingArchives);
|
|
10029
10047
|
}
|
|
10030
10048
|
function sha256File(filePath, signal) {
|
|
10031
|
-
return new Promise((
|
|
10049
|
+
return new Promise((resolve12, reject) => {
|
|
10032
10050
|
const hash = createHash2("sha256");
|
|
10033
|
-
createReadStream2(filePath, { signal }).on("data", (chunk) => hash.update(chunk)).on("end", () =>
|
|
10051
|
+
createReadStream2(filePath, { signal }).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve12(hash.digest("hex"))).on("error", reject);
|
|
10034
10052
|
});
|
|
10035
10053
|
}
|
|
10036
10054
|
function toolServerError(text) {
|
|
@@ -10089,7 +10107,7 @@ async function uploadTar(tarPath, format, endpoint, signal) {
|
|
|
10089
10107
|
}
|
|
10090
10108
|
async function uploadFile(sourcePath, endpoint, signal) {
|
|
10091
10109
|
const format = pickArchiveFormat(endpoint.formats);
|
|
10092
|
-
const tarPath =
|
|
10110
|
+
const tarPath = path11.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
|
|
10093
10111
|
trackArchive(tarPath);
|
|
10094
10112
|
try {
|
|
10095
10113
|
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
@@ -10164,7 +10182,7 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
10164
10182
|
wire.mtimeMs = st.mtimeMs;
|
|
10165
10183
|
}
|
|
10166
10184
|
if (opts.uploadEndpoint && st) {
|
|
10167
|
-
process.stderr.write(`Uploading ${
|
|
10185
|
+
process.stderr.write(`Uploading ${path11.basename(filePath)} to the remote tool-server...
|
|
10168
10186
|
`);
|
|
10169
10187
|
Object.assign(wire, await uploadFile(filePath, opts.uploadEndpoint, opts.signal));
|
|
10170
10188
|
}
|
|
@@ -10174,7 +10192,7 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
10174
10192
|
return out;
|
|
10175
10193
|
}
|
|
10176
10194
|
function isAllowedClientFilePath(p) {
|
|
10177
|
-
if (!
|
|
10195
|
+
if (!path11.isAbsolute(p)) return false;
|
|
10178
10196
|
const segments = p.split(/[\\/]+/);
|
|
10179
10197
|
if (segments.includes("..")) return false;
|
|
10180
10198
|
const file = segments[segments.length - 1] ?? "";
|
|
@@ -10185,7 +10203,7 @@ function isClientFileDirective2(value) {
|
|
|
10185
10203
|
return !!value && typeof value === "object" && value[CLIENT_FILE_MARKER2] === true && typeof value.path === "string" && typeof value.content === "string";
|
|
10186
10204
|
}
|
|
10187
10205
|
async function replaceFile(target, bytes, mode) {
|
|
10188
|
-
const temp =
|
|
10206
|
+
const temp = path11.join(path11.dirname(target), `.baseline-${randomUUID4()}.tmp`);
|
|
10189
10207
|
try {
|
|
10190
10208
|
await writeFile3(temp, bytes, { flag: "wx" });
|
|
10191
10209
|
if (mode !== void 0) await chmod3(temp, mode & 511);
|
|
@@ -10196,27 +10214,27 @@ async function replaceFile(target, bytes, mode) {
|
|
|
10196
10214
|
}
|
|
10197
10215
|
}
|
|
10198
10216
|
async function writeBaselineFile(file, bytes, allowedDirs) {
|
|
10199
|
-
if (!
|
|
10217
|
+
if (!path11.isAbsolute(file) || path11.normalize(file) !== file || file.split(/[\\/]/).includes("..") || !file.endsWith(".png") || !allowedDirs.includes(path11.dirname(file))) {
|
|
10200
10218
|
return allowedDirs.length === 0 ? "this call writes no baselines" : `${file} is not a baseline of this call (${allowedDirs.map((d) => `${d}/<name>.png`).join(", ")})`;
|
|
10201
10219
|
}
|
|
10202
10220
|
if (bytes.length > MAX_CONTENT_BYTES) {
|
|
10203
10221
|
return `${file}: the baseline is larger than the 32 MiB cap on a file this client writes`;
|
|
10204
10222
|
}
|
|
10205
|
-
const dir =
|
|
10223
|
+
const dir = path11.dirname(file);
|
|
10206
10224
|
await mkdir3(dir, { recursive: true });
|
|
10207
10225
|
const link = await lstat(file).catch(() => null);
|
|
10208
10226
|
const real = link === null ? null : await realpath2(file).catch(() => null);
|
|
10209
10227
|
if (link !== null && real === null) return `${file} is a symbolic link to a missing file`;
|
|
10210
10228
|
if (real !== null) {
|
|
10211
10229
|
if (!real.endsWith(".png")) return `${file} links to a file that is not a PNG file`;
|
|
10212
|
-
if (
|
|
10230
|
+
if (path11.dirname(real) !== await realpath2(dir)) {
|
|
10213
10231
|
return `${file} links outside its baseline directory`;
|
|
10214
10232
|
}
|
|
10215
10233
|
}
|
|
10216
10234
|
const existing = real === null ? null : await stat3(real);
|
|
10217
10235
|
if (existing !== null && !existing.isFile()) return `${file} is not a regular file`;
|
|
10218
10236
|
await replaceFile(
|
|
10219
|
-
real ??
|
|
10237
|
+
real ?? path11.join(await realpath2(dir), path11.basename(file)),
|
|
10220
10238
|
bytes,
|
|
10221
10239
|
existing?.mode
|
|
10222
10240
|
);
|
|
@@ -10242,7 +10260,7 @@ async function applyClientFileDirectives(result, opts = {}) {
|
|
|
10242
10260
|
if (isClientFileDirective2(value)) {
|
|
10243
10261
|
if (!isAllowedClientFilePath(value.path)) return null;
|
|
10244
10262
|
try {
|
|
10245
|
-
await mkdir3(
|
|
10263
|
+
await mkdir3(path11.dirname(value.path), { recursive: true });
|
|
10246
10264
|
await writeFile3(value.path, value.content, "utf8");
|
|
10247
10265
|
written.push(value.path);
|
|
10248
10266
|
return value.path;
|
|
@@ -10271,13 +10289,13 @@ async function applyClientFileDirectives(result, opts = {}) {
|
|
|
10271
10289
|
// ../argent-tools-client/src/flow-files.ts
|
|
10272
10290
|
var import_yaml = __toESM(require_dist2(), 1);
|
|
10273
10291
|
import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
|
|
10274
|
-
import * as
|
|
10292
|
+
import * as path12 from "node:path";
|
|
10275
10293
|
var INLINE_MEMBERS_BYTES = 256 * 1024;
|
|
10276
10294
|
function filesLogEnabled() {
|
|
10277
10295
|
return (process.env.ARGENT_E2E_FILES_LOG ?? process.env.ARGENT_FLOW_FILES_LOG) === "1";
|
|
10278
10296
|
}
|
|
10279
10297
|
function isWithin(inner, outer) {
|
|
10280
|
-
return inner === outer || inner.startsWith(outer.endsWith(
|
|
10298
|
+
return inner === outer || inner.startsWith(outer.endsWith(path12.sep) ? outer : outer + path12.sep);
|
|
10281
10299
|
}
|
|
10282
10300
|
function printable(text) {
|
|
10283
10301
|
return [...text].map(
|
|
@@ -10285,7 +10303,7 @@ function printable(text) {
|
|
|
10285
10303
|
).join("");
|
|
10286
10304
|
}
|
|
10287
10305
|
function isResolvedAbsolute2(value) {
|
|
10288
|
-
return typeof value === "string" &&
|
|
10306
|
+
return typeof value === "string" && path12.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
|
|
10289
10307
|
}
|
|
10290
10308
|
function namesValidFlow(args) {
|
|
10291
10309
|
let canonical;
|
|
@@ -10297,13 +10315,13 @@ function namesValidFlow(args) {
|
|
|
10297
10315
|
const { project_root, e2e_test_path: testPath, name } = canonical;
|
|
10298
10316
|
if (!isResolvedAbsolute2(project_root)) return false;
|
|
10299
10317
|
if (name === void 0) {
|
|
10300
|
-
return isResolvedAbsolute2(testPath) && FLOW_FILE_NAME_PATTERN.test(
|
|
10318
|
+
return isResolvedAbsolute2(testPath) && FLOW_FILE_NAME_PATTERN.test(path12.basename(testPath));
|
|
10301
10319
|
}
|
|
10302
10320
|
return testPath === void 0 && typeof name === "string" && FLOW_NAME_PATTERN.test(name);
|
|
10303
10321
|
}
|
|
10304
10322
|
function savedFlowProject(file) {
|
|
10305
|
-
if (!
|
|
10306
|
-
for (let dir =
|
|
10323
|
+
if (!path12.isAbsolute(file)) return null;
|
|
10324
|
+
for (let dir = path12.dirname(file); dir !== path12.dirname(dir); dir = path12.dirname(dir)) {
|
|
10307
10325
|
const project = e2eDirProject(dir);
|
|
10308
10326
|
if (project !== null) return project;
|
|
10309
10327
|
}
|
|
@@ -10318,11 +10336,11 @@ async function landing(spelled) {
|
|
|
10318
10336
|
const canonical = await canonicalFlowPath(spelled);
|
|
10319
10337
|
let at = spelled;
|
|
10320
10338
|
for (; ; ) {
|
|
10321
|
-
const parent =
|
|
10339
|
+
const parent = path12.dirname(at);
|
|
10322
10340
|
if (parent === at) return { canonical, fence: spelled, ...failure };
|
|
10323
10341
|
const real = await realpath3(parent).catch(() => null);
|
|
10324
10342
|
if (real !== null) {
|
|
10325
|
-
return { canonical, fence:
|
|
10343
|
+
return { canonical, fence: path12.join(real, path12.basename(at)), ...failure };
|
|
10326
10344
|
}
|
|
10327
10345
|
at = parent;
|
|
10328
10346
|
}
|
|
@@ -10330,10 +10348,10 @@ async function landing(spelled) {
|
|
|
10330
10348
|
}
|
|
10331
10349
|
async function closureRoots(rootPath, rootCanonical, projectRoot) {
|
|
10332
10350
|
const candidates = [];
|
|
10333
|
-
if (typeof projectRoot === "string" &&
|
|
10351
|
+
if (typeof projectRoot === "string" && path12.isAbsolute(projectRoot)) {
|
|
10334
10352
|
candidates.push(projectRoot, ...e2eDirsFor(projectRoot));
|
|
10335
10353
|
}
|
|
10336
|
-
candidates.push(
|
|
10354
|
+
candidates.push(path12.dirname(rootPath), path12.dirname(rootCanonical));
|
|
10337
10355
|
for (const file of [rootPath, rootCanonical]) {
|
|
10338
10356
|
const project = savedFlowProject(file);
|
|
10339
10357
|
if (project !== null) candidates.push(project);
|
|
@@ -10346,11 +10364,11 @@ async function closureRoots(rootPath, rootCanonical, projectRoot) {
|
|
|
10346
10364
|
return real.filter((root) => !real.some((other) => other !== root && isWithin(root, other)));
|
|
10347
10365
|
}
|
|
10348
10366
|
async function readFlowMember(anchorDir, target, roots, budget, opts) {
|
|
10349
|
-
const spelled = anchorDir +
|
|
10367
|
+
const spelled = anchorDir + path12.sep + target;
|
|
10350
10368
|
const { canonical, fence, missing, error } = await landing(spelled);
|
|
10351
10369
|
const spelling = await classifyOnDiskSpelling(
|
|
10352
|
-
|
|
10353
|
-
|
|
10370
|
+
path12.dirname(spelled),
|
|
10371
|
+
path12.posix.basename(target),
|
|
10354
10372
|
FLOW_FILE_NAME_PATTERN
|
|
10355
10373
|
);
|
|
10356
10374
|
const member = {
|
|
@@ -10375,7 +10393,7 @@ async function readFlowMember(anchorDir, target, roots, budget, opts) {
|
|
|
10375
10393
|
return { member: { ...member, state: "missing" }, sent: "missing" };
|
|
10376
10394
|
}
|
|
10377
10395
|
if (st.isDirectory()) return refuse("EISDIR: illegal operation on a directory, read");
|
|
10378
|
-
if (!/\.ya?ml$/i.test(
|
|
10396
|
+
if (!/\.ya?ml$/i.test(path12.basename(canonical))) {
|
|
10379
10397
|
return refuse(`${target} links to a file that is not a YAML file`);
|
|
10380
10398
|
}
|
|
10381
10399
|
const sent = await sendBytes(member, canonical, budget, opts);
|
|
@@ -10500,12 +10518,12 @@ function memberCollector(roots, opts) {
|
|
|
10500
10518
|
}
|
|
10501
10519
|
async function savedTest(target) {
|
|
10502
10520
|
for (const candidate of target.paths) {
|
|
10503
|
-
const found = await flow(
|
|
10521
|
+
const found = await flow(path12.dirname(candidate), path12.basename(candidate), true);
|
|
10504
10522
|
if (found !== void 0) return found;
|
|
10505
10523
|
}
|
|
10506
10524
|
let first;
|
|
10507
10525
|
for (const candidate of target.paths) {
|
|
10508
|
-
first ??= await flow(
|
|
10526
|
+
first ??= await flow(path12.dirname(candidate), path12.basename(candidate));
|
|
10509
10527
|
}
|
|
10510
10528
|
return first;
|
|
10511
10529
|
}
|
|
@@ -10542,7 +10560,7 @@ function memberCollector(roots, opts) {
|
|
|
10542
10560
|
const requests = collectFlowRequests(doc);
|
|
10543
10561
|
for (const name of requests.snapshots) snapshots.add(name);
|
|
10544
10562
|
for (const step of requests.toolSteps) await toolFiles(step);
|
|
10545
|
-
const anchorDir =
|
|
10563
|
+
const anchorDir = path12.dirname(file.canonical);
|
|
10546
10564
|
for (const target of requests.runTargets) {
|
|
10547
10565
|
const key = flowMemberKey(anchorDir, target);
|
|
10548
10566
|
if (visited.has(key)) continue;
|
|
@@ -10564,8 +10582,8 @@ function memberCollector(roots, opts) {
|
|
|
10564
10582
|
}
|
|
10565
10583
|
}
|
|
10566
10584
|
if (snapshots.size === 0) continue;
|
|
10567
|
-
const dir =
|
|
10568
|
-
|
|
10585
|
+
const dir = path12.join(
|
|
10586
|
+
path12.dirname(run.canonical),
|
|
10569
10587
|
"__baselines__",
|
|
10570
10588
|
baselineKeyFor(run.canonical, run.flowName)
|
|
10571
10589
|
);
|
|
@@ -10589,7 +10607,7 @@ function memberCollector(roots, opts) {
|
|
|
10589
10607
|
if (!name.endsWith(".png")) continue;
|
|
10590
10608
|
const compared = [...prefixes].some((prefix) => name.startsWith(prefix));
|
|
10591
10609
|
if (!updates && !compared) continue;
|
|
10592
|
-
const file =
|
|
10610
|
+
const file = path12.join(dir, name);
|
|
10593
10611
|
if (tools.has(file)) continue;
|
|
10594
10612
|
const member = { role: "baseline", key: file, path: file };
|
|
10595
10613
|
const entry = await baselineEntry(file, roots, updates && !compared);
|
|
@@ -10612,8 +10630,8 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
|
|
|
10612
10630
|
if (!namesValidFlow(args)) return {};
|
|
10613
10631
|
const canonical = await canonicalFlowPath(rootPath);
|
|
10614
10632
|
const spelling = await classifyOnDiskSpelling(
|
|
10615
|
-
|
|
10616
|
-
|
|
10633
|
+
path12.dirname(rootPath),
|
|
10634
|
+
path12.basename(rootPath),
|
|
10617
10635
|
FLOW_FILE_NAME_PATTERN
|
|
10618
10636
|
);
|
|
10619
10637
|
const collector = memberCollector(
|
|
@@ -10624,7 +10642,7 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
|
|
|
10624
10642
|
{
|
|
10625
10643
|
canonical,
|
|
10626
10644
|
text: rootBytes.toString("utf8"),
|
|
10627
|
-
flowName:
|
|
10645
|
+
flowName: path12.basename(rootPath, ".yaml"),
|
|
10628
10646
|
hop: 0,
|
|
10629
10647
|
updates: args.updateBaselines === true,
|
|
10630
10648
|
platform: callPlatform(args)
|
|
@@ -10653,31 +10671,31 @@ async function collectStepMembers(args, opts, recordingDirFor = e2eDirFor) {
|
|
|
10653
10671
|
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || !isResolvedAbsolute2(projectRoot) || step === void 0) {
|
|
10654
10672
|
return [];
|
|
10655
10673
|
}
|
|
10656
|
-
const recording =
|
|
10674
|
+
const recording = path12.join(recordingDirFor(projectRoot), `${name}.yaml`);
|
|
10657
10675
|
const collector = memberCollector(
|
|
10658
10676
|
await closureRoots(recording, (await landing(recording)).canonical, projectRoot),
|
|
10659
10677
|
opts
|
|
10660
10678
|
);
|
|
10661
10679
|
await collector.toolFiles(step);
|
|
10662
10680
|
if (canonicalToolId(step.tool) === "e2e-execute") {
|
|
10663
|
-
const self = await collector.flow(
|
|
10681
|
+
const self = await collector.flow(path12.dirname(recording), path12.basename(recording));
|
|
10664
10682
|
let runArgs = step.args;
|
|
10665
10683
|
const named = nestedFlowTarget(runArgs);
|
|
10666
10684
|
if (named?.kind === "e2e_test_path") {
|
|
10667
|
-
const stem =
|
|
10668
|
-
const base =
|
|
10669
|
-
const dir =
|
|
10670
|
-
const recordingDir =
|
|
10685
|
+
const stem = path12.basename(named.path, ".yaml");
|
|
10686
|
+
const base = path12.basename(named.path);
|
|
10687
|
+
const dir = path12.resolve(path12.dirname(named.path));
|
|
10688
|
+
const recordingDir = path12.dirname(recording);
|
|
10671
10689
|
const dirs = [recordingDir, ...e2eRunFallbackDirs(recordingDir, base)];
|
|
10672
|
-
if (dirs.some((d) =>
|
|
10673
|
-
await collector.flow(
|
|
10690
|
+
if (dirs.some((d) => path12.resolve(d) === dir)) {
|
|
10691
|
+
await collector.flow(path12.dirname(named.path), base);
|
|
10674
10692
|
runArgs = { ...runArgs, name: stem };
|
|
10675
10693
|
delete runArgs.e2e_test_path;
|
|
10676
10694
|
}
|
|
10677
10695
|
}
|
|
10678
10696
|
const target = nestedFlowTarget(runArgs);
|
|
10679
10697
|
if (target?.kind === "name") {
|
|
10680
|
-
await collector.flow(
|
|
10698
|
+
await collector.flow(path12.dirname(self.member.canonical), `${target.name}.yaml`);
|
|
10681
10699
|
const run = await collector.nestedRun(
|
|
10682
10700
|
target,
|
|
10683
10701
|
0,
|
|
@@ -10871,10 +10889,10 @@ function assertFiniteNumbers(args) {
|
|
|
10871
10889
|
if (typeof item === "object" && item !== null) {
|
|
10872
10890
|
pending.push({ value: item, key, parent: visit });
|
|
10873
10891
|
} else if (typeof item === "number" && !Number.isFinite(item)) {
|
|
10874
|
-
const
|
|
10875
|
-
for (let at = visit; at.parent; at = at.parent)
|
|
10876
|
-
|
|
10877
|
-
issues.push({ code: "invalid_type", path:
|
|
10892
|
+
const path15 = [key];
|
|
10893
|
+
for (let at = visit; at.parent; at = at.parent) path15.push(at.key);
|
|
10894
|
+
path15.reverse();
|
|
10895
|
+
issues.push({ code: "invalid_type", path: path15, message: `expected a number, got ${item}` });
|
|
10878
10896
|
if (issues.length === MAX_NON_FINITE_ISSUES) break;
|
|
10879
10897
|
}
|
|
10880
10898
|
}
|
|
@@ -11059,7 +11077,7 @@ function createToolsClient(options = {}) {
|
|
|
11059
11077
|
log: diagnose,
|
|
11060
11078
|
baselineDirs,
|
|
11061
11079
|
collectMembers: collectFlowMembers,
|
|
11062
|
-
collectStepMembers: olderServer ? (record, o) => collectStepMembers(record, o, (root) =>
|
|
11080
|
+
collectStepMembers: olderServer ? (record, o) => collectStepMembers(record, o, (root) => path13.join(root, LEGACY_E2E_DIRS[0])) : collectStepMembers,
|
|
11063
11081
|
toolFileInputs: (tool) => findTool(tools, tool)?.fileInputs,
|
|
11064
11082
|
signal: opts?.signal
|
|
11065
11083
|
});
|
|
@@ -11072,7 +11090,7 @@ function createToolsClient(options = {}) {
|
|
|
11072
11090
|
}
|
|
11073
11091
|
if (filesLogEnabled()) {
|
|
11074
11092
|
for (const file of applied.written) {
|
|
11075
|
-
if (baselineDirs.includes(
|
|
11093
|
+
if (baselineDirs.includes(path13.dirname(file))) {
|
|
11076
11094
|
diagnose(`[e2e-files] baseline ${file}: written`);
|
|
11077
11095
|
}
|
|
11078
11096
|
}
|
|
@@ -11216,7 +11234,7 @@ import {
|
|
|
11216
11234
|
} from "node:fs/promises";
|
|
11217
11235
|
import { constants as fsConstants } from "node:fs";
|
|
11218
11236
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
11219
|
-
import { basename as basename7,
|
|
11237
|
+
import { basename as basename7, extname as extname2, isAbsolute as isAbsolute6, join as join14, normalize as normalize2, resolve as resolve11, sep as sep5 } from "node:path";
|
|
11220
11238
|
import { createHash as createHash3 } from "node:crypto";
|
|
11221
11239
|
var ARTIFACT_MARKER2 = "__argentArtifact";
|
|
11222
11240
|
function isArtifactHandle(value) {
|
|
@@ -11240,16 +11258,16 @@ function projectSlug() {
|
|
|
11240
11258
|
return `${name}-${hash}`;
|
|
11241
11259
|
}
|
|
11242
11260
|
function artifactsRoot() {
|
|
11243
|
-
return process.env.ARGENT_ARTIFACTS_DIR ??
|
|
11261
|
+
return process.env.ARGENT_ARTIFACTS_DIR ?? join14(tmpdir2(), "argent-artifacts");
|
|
11244
11262
|
}
|
|
11245
11263
|
function artifactDir(deviceId) {
|
|
11246
11264
|
const parts = [artifactsRoot(), projectSlug(), sessionId()];
|
|
11247
11265
|
if (deviceId) parts.push(sanitizeSegment(deviceId));
|
|
11248
|
-
return
|
|
11266
|
+
return join14(...parts);
|
|
11249
11267
|
}
|
|
11250
11268
|
function durableBaseDir() {
|
|
11251
11269
|
const projectRoot = findProjectRoot(process.cwd());
|
|
11252
|
-
return projectRoot ??
|
|
11270
|
+
return projectRoot ?? resolveHomeDir();
|
|
11253
11271
|
}
|
|
11254
11272
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
|
|
11255
11273
|
var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
|
|
@@ -11263,9 +11281,9 @@ function configuredRecordingsDir() {
|
|
|
11263
11281
|
if (typeof value !== "string") return null;
|
|
11264
11282
|
const trimmed = value.trim();
|
|
11265
11283
|
if (trimmed === "") return null;
|
|
11266
|
-
const home =
|
|
11267
|
-
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep5}`) ?
|
|
11268
|
-
return
|
|
11284
|
+
const home = resolveHomeDir();
|
|
11285
|
+
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep5}`) ? join14(home, trimmed.slice(2)) : trimmed;
|
|
11286
|
+
return resolve11(durableBaseDir(), expanded);
|
|
11269
11287
|
}
|
|
11270
11288
|
var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
|
|
11271
11289
|
async function readCapped(res, cap) {
|
|
@@ -11298,10 +11316,10 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
11298
11316
|
const stem = filename.slice(0, filename.length - ext.length);
|
|
11299
11317
|
for (let i = 1; i <= 1e3; i++) {
|
|
11300
11318
|
const candidate = i === 1 ? filename : `${stem} (${i})${ext}`;
|
|
11301
|
-
const
|
|
11319
|
+
const path15 = join14(dir, candidate);
|
|
11302
11320
|
try {
|
|
11303
|
-
await write(
|
|
11304
|
-
return
|
|
11321
|
+
await write(path15);
|
|
11322
|
+
return path15;
|
|
11305
11323
|
} catch (err) {
|
|
11306
11324
|
if (err?.code === "EEXIST") continue;
|
|
11307
11325
|
throw err;
|
|
@@ -11321,21 +11339,21 @@ function durableSaveTarget(handle) {
|
|
|
11321
11339
|
if (configured) {
|
|
11322
11340
|
return {
|
|
11323
11341
|
dir: configured,
|
|
11324
|
-
path:
|
|
11342
|
+
path: join14(configured, sanitizeSegment(handle.filename)),
|
|
11325
11343
|
base: configured,
|
|
11326
11344
|
rel: ""
|
|
11327
11345
|
};
|
|
11328
11346
|
}
|
|
11329
11347
|
}
|
|
11330
11348
|
const base = durableBaseDir();
|
|
11331
|
-
const dir =
|
|
11332
|
-
return { dir, path:
|
|
11349
|
+
const dir = join14(base, rel);
|
|
11350
|
+
return { dir, path: join14(dir, sanitizeSegment(handle.filename)), base, rel };
|
|
11333
11351
|
}
|
|
11334
11352
|
async function confineToRealBase(dir, base, rel) {
|
|
11335
11353
|
try {
|
|
11336
11354
|
const realDir = await realpath4(dir);
|
|
11337
11355
|
const realBase = await realpath4(base);
|
|
11338
|
-
return realDir ===
|
|
11356
|
+
return realDir === join14(realBase, rel);
|
|
11339
11357
|
} catch {
|
|
11340
11358
|
return false;
|
|
11341
11359
|
}
|
|
@@ -11359,9 +11377,9 @@ async function resolveLocalFile(handle) {
|
|
|
11359
11377
|
}
|
|
11360
11378
|
async function downloadAndExtractArchive(handle, data, dir, signal) {
|
|
11361
11379
|
signal?.throwIfAborted();
|
|
11362
|
-
const attemptDir = await mkdtemp(
|
|
11363
|
-
const tarball =
|
|
11364
|
-
const extractDir =
|
|
11380
|
+
const attemptDir = await mkdtemp(join14(dir, "bundle-"));
|
|
11381
|
+
const tarball = join14(attemptDir, "download.tar");
|
|
11382
|
+
const extractDir = join14(attemptDir, "files");
|
|
11365
11383
|
try {
|
|
11366
11384
|
await writeFile4(tarball, data, { signal });
|
|
11367
11385
|
await mkdir4(extractDir);
|
|
@@ -11461,7 +11479,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
11461
11479
|
return await downloadAndExtractArchive(value, data, dir, ctx.signal);
|
|
11462
11480
|
}
|
|
11463
11481
|
if (value.size > 0 && data.length !== value.size) return null;
|
|
11464
|
-
const downloadedPath =
|
|
11482
|
+
const downloadedPath = join14(dir, sanitizeSegment(value.filename));
|
|
11465
11483
|
await writeFile4(downloadedPath, data);
|
|
11466
11484
|
if (value.mimeType.startsWith("image/")) {
|
|
11467
11485
|
images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
|
|
@@ -11495,12 +11513,12 @@ function getDeviceIdFromArgs(args) {
|
|
|
11495
11513
|
}
|
|
11496
11514
|
|
|
11497
11515
|
// src/bundled-paths.ts
|
|
11498
|
-
import * as
|
|
11499
|
-
import * as
|
|
11516
|
+
import * as fs9 from "node:fs";
|
|
11517
|
+
import * as path14 from "node:path";
|
|
11500
11518
|
function readPackageVersion() {
|
|
11501
11519
|
try {
|
|
11502
11520
|
const pkg = JSON.parse(
|
|
11503
|
-
|
|
11521
|
+
fs9.readFileSync(path14.join(import.meta.dirname, "..", "package.json"), "utf8")
|
|
11504
11522
|
);
|
|
11505
11523
|
return pkg.version;
|
|
11506
11524
|
} catch {
|
|
@@ -11511,15 +11529,15 @@ var PACKAGE_NAME = "@swmansion/argent";
|
|
|
11511
11529
|
function findDeclaringRoot(startDir) {
|
|
11512
11530
|
let dir = startDir;
|
|
11513
11531
|
for (; ; ) {
|
|
11514
|
-
if (
|
|
11532
|
+
if (fs9.existsSync(path14.join(dir, ".argent", "install.json"))) return dir;
|
|
11515
11533
|
try {
|
|
11516
|
-
const manifest = JSON.parse(
|
|
11534
|
+
const manifest = JSON.parse(fs9.readFileSync(path14.join(dir, "package.json"), "utf8"));
|
|
11517
11535
|
if (manifest.devDependencies?.[PACKAGE_NAME] || manifest.dependencies?.[PACKAGE_NAME] || manifest.optionalDependencies?.[PACKAGE_NAME]) {
|
|
11518
11536
|
return dir;
|
|
11519
11537
|
}
|
|
11520
11538
|
} catch {
|
|
11521
11539
|
}
|
|
11522
|
-
const parent =
|
|
11540
|
+
const parent = path14.dirname(dir);
|
|
11523
11541
|
if (parent === dir) return null;
|
|
11524
11542
|
dir = parent;
|
|
11525
11543
|
}
|
|
@@ -11527,12 +11545,12 @@ function findDeclaringRoot(startDir) {
|
|
|
11527
11545
|
function findStablePackageDir(startDir, packageRoot) {
|
|
11528
11546
|
let dir = startDir;
|
|
11529
11547
|
for (; ; ) {
|
|
11530
|
-
const candidate =
|
|
11548
|
+
const candidate = path14.join(dir, "node_modules", PACKAGE_NAME);
|
|
11531
11549
|
try {
|
|
11532
|
-
if (
|
|
11550
|
+
if (fs9.realpathSync(candidate) === packageRoot) return candidate;
|
|
11533
11551
|
} catch {
|
|
11534
11552
|
}
|
|
11535
|
-
const parent =
|
|
11553
|
+
const parent = path14.dirname(dir);
|
|
11536
11554
|
if (parent === dir) return void 0;
|
|
11537
11555
|
dir = parent;
|
|
11538
11556
|
}
|
|
@@ -11542,7 +11560,7 @@ function classifyInstall() {
|
|
|
11542
11560
|
let dir;
|
|
11543
11561
|
let cwd;
|
|
11544
11562
|
try {
|
|
11545
|
-
packageRoot =
|
|
11563
|
+
packageRoot = fs9.realpathSync(path14.join(import.meta.dirname, ".."));
|
|
11546
11564
|
cwd = process.cwd();
|
|
11547
11565
|
dir = cwd;
|
|
11548
11566
|
} catch {
|
|
@@ -11550,8 +11568,8 @@ function classifyInstall() {
|
|
|
11550
11568
|
}
|
|
11551
11569
|
for (; ; ) {
|
|
11552
11570
|
try {
|
|
11553
|
-
const nmReal =
|
|
11554
|
-
if (packageRoot === nmReal || packageRoot.startsWith(nmReal +
|
|
11571
|
+
const nmReal = fs9.realpathSync(path14.join(dir, "node_modules"));
|
|
11572
|
+
if (packageRoot === nmReal || packageRoot.startsWith(nmReal + path14.sep)) {
|
|
11555
11573
|
return {
|
|
11556
11574
|
kind: "local",
|
|
11557
11575
|
projectRoot: findDeclaringRoot(cwd) ?? dir,
|
|
@@ -11560,22 +11578,22 @@ function classifyInstall() {
|
|
|
11560
11578
|
}
|
|
11561
11579
|
} catch {
|
|
11562
11580
|
}
|
|
11563
|
-
const parent =
|
|
11581
|
+
const parent = path14.dirname(dir);
|
|
11564
11582
|
if (parent === dir) break;
|
|
11565
11583
|
dir = parent;
|
|
11566
11584
|
}
|
|
11567
|
-
if (packageRoot.includes(`${
|
|
11585
|
+
if (packageRoot.includes(`${path14.sep}.yarn${path14.sep}`)) {
|
|
11568
11586
|
const declRoot = findDeclaringRoot(cwd);
|
|
11569
11587
|
if (declRoot) return { kind: "local", projectRoot: declRoot };
|
|
11570
11588
|
}
|
|
11571
11589
|
return { kind: "global" };
|
|
11572
11590
|
}
|
|
11573
11591
|
var classifiedInstall = classifyInstall();
|
|
11574
|
-
var packageDir = classifiedInstall.stablePackageDir ??
|
|
11592
|
+
var packageDir = classifiedInstall.stablePackageDir ?? path14.join(import.meta.dirname, "..");
|
|
11575
11593
|
var BUNDLED_RUNTIME_PATHS = {
|
|
11576
|
-
bundlePath:
|
|
11577
|
-
simulatorServerDir:
|
|
11578
|
-
nativeDevtoolsDir:
|
|
11594
|
+
bundlePath: path14.join(packageDir, "dist", "tool-server.cjs"),
|
|
11595
|
+
simulatorServerDir: path14.join(packageDir, "bin"),
|
|
11596
|
+
nativeDevtoolsDir: path14.join(packageDir, "dylibs"),
|
|
11579
11597
|
version: readPackageVersion(),
|
|
11580
11598
|
installKind: classifiedInstall.kind,
|
|
11581
11599
|
installProjectRoot: classifiedInstall.projectRoot
|