@swmansion/argent 0.27.1-next.21 → 0.27.1-next.23
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/bin/argent-android-devtools-0.2.0.apk +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/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +579 -352
- package/dist/client.js +402 -187
- package/dist/installer.mjs +144 -141
- package/dist/mcp-server.mjs +444 -229
- package/dist/tool-args.generated.d.ts +2 -2
- package/dist/tool-server.cjs +1249 -928
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +1 -1
- package/skills/argent-create-flow/references/flow-yaml.md +4 -2
- package/skills/argent-create-flow/references/live-authoring.md +19 -3
package/dist/mcp-server.mjs
CHANGED
|
@@ -2990,7 +2990,7 @@ var require_compile = __commonJS({
|
|
|
2990
2990
|
const schOrFunc = root.refs[ref];
|
|
2991
2991
|
if (schOrFunc)
|
|
2992
2992
|
return schOrFunc;
|
|
2993
|
-
let _sch =
|
|
2993
|
+
let _sch = resolve9.call(this, root, ref);
|
|
2994
2994
|
if (_sch === void 0) {
|
|
2995
2995
|
const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
|
|
2996
2996
|
const { schemaId } = this.opts;
|
|
@@ -3017,7 +3017,7 @@ var require_compile = __commonJS({
|
|
|
3017
3017
|
function sameSchemaEnv(s1, s2) {
|
|
3018
3018
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
3019
3019
|
}
|
|
3020
|
-
function
|
|
3020
|
+
function resolve9(root, ref) {
|
|
3021
3021
|
let sch;
|
|
3022
3022
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
3023
3023
|
ref = sch;
|
|
@@ -3235,8 +3235,8 @@ var require_utils = __commonJS({
|
|
|
3235
3235
|
}
|
|
3236
3236
|
return ind;
|
|
3237
3237
|
}
|
|
3238
|
-
function removeDotSegments(
|
|
3239
|
-
let input =
|
|
3238
|
+
function removeDotSegments(path16) {
|
|
3239
|
+
let input = path16;
|
|
3240
3240
|
const output = [];
|
|
3241
3241
|
let nextSlash = -1;
|
|
3242
3242
|
let len = 0;
|
|
@@ -3488,8 +3488,8 @@ var require_schemes = __commonJS({
|
|
|
3488
3488
|
wsComponent.secure = void 0;
|
|
3489
3489
|
}
|
|
3490
3490
|
if (wsComponent.resourceName) {
|
|
3491
|
-
const [
|
|
3492
|
-
wsComponent.path =
|
|
3491
|
+
const [path16, query] = wsComponent.resourceName.split("?");
|
|
3492
|
+
wsComponent.path = path16 && path16 !== "/" ? path16 : void 0;
|
|
3493
3493
|
wsComponent.query = query;
|
|
3494
3494
|
wsComponent.resourceName = void 0;
|
|
3495
3495
|
}
|
|
@@ -3648,7 +3648,7 @@ var require_fast_uri = __commonJS({
|
|
|
3648
3648
|
}
|
|
3649
3649
|
return uri;
|
|
3650
3650
|
}
|
|
3651
|
-
function
|
|
3651
|
+
function resolve9(baseURI, relativeURI, options) {
|
|
3652
3652
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
3653
3653
|
const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
3654
3654
|
schemelessOptions.skipEscape = true;
|
|
@@ -3906,7 +3906,7 @@ var require_fast_uri = __commonJS({
|
|
|
3906
3906
|
var fastUri = {
|
|
3907
3907
|
SCHEMES,
|
|
3908
3908
|
normalize: normalize3,
|
|
3909
|
-
resolve:
|
|
3909
|
+
resolve: resolve9,
|
|
3910
3910
|
resolveComponent,
|
|
3911
3911
|
equal,
|
|
3912
3912
|
serialize,
|
|
@@ -6972,17 +6972,17 @@ var require_visit = __commonJS({
|
|
|
6972
6972
|
visit.BREAK = BREAK;
|
|
6973
6973
|
visit.SKIP = SKIP;
|
|
6974
6974
|
visit.REMOVE = REMOVE;
|
|
6975
|
-
function visit_(key, node, visitor,
|
|
6976
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
6975
|
+
function visit_(key, node, visitor, path16) {
|
|
6976
|
+
const ctrl = callVisitor(key, node, visitor, path16);
|
|
6977
6977
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
6978
|
-
replaceNode(key,
|
|
6979
|
-
return visit_(key, ctrl, visitor,
|
|
6978
|
+
replaceNode(key, path16, ctrl);
|
|
6979
|
+
return visit_(key, ctrl, visitor, path16);
|
|
6980
6980
|
}
|
|
6981
6981
|
if (typeof ctrl !== "symbol") {
|
|
6982
6982
|
if (identity.isCollection(node)) {
|
|
6983
|
-
|
|
6983
|
+
path16 = Object.freeze(path16.concat(node));
|
|
6984
6984
|
for (let i = 0; i < node.items.length; ++i) {
|
|
6985
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
6985
|
+
const ci = visit_(i, node.items[i], visitor, path16);
|
|
6986
6986
|
if (typeof ci === "number")
|
|
6987
6987
|
i = ci - 1;
|
|
6988
6988
|
else if (ci === BREAK)
|
|
@@ -6993,13 +6993,13 @@ var require_visit = __commonJS({
|
|
|
6993
6993
|
}
|
|
6994
6994
|
}
|
|
6995
6995
|
} else if (identity.isPair(node)) {
|
|
6996
|
-
|
|
6997
|
-
const ck = visit_("key", node.key, visitor,
|
|
6996
|
+
path16 = Object.freeze(path16.concat(node));
|
|
6997
|
+
const ck = visit_("key", node.key, visitor, path16);
|
|
6998
6998
|
if (ck === BREAK)
|
|
6999
6999
|
return BREAK;
|
|
7000
7000
|
else if (ck === REMOVE)
|
|
7001
7001
|
node.key = null;
|
|
7002
|
-
const cv = visit_("value", node.value, visitor,
|
|
7002
|
+
const cv = visit_("value", node.value, visitor, path16);
|
|
7003
7003
|
if (cv === BREAK)
|
|
7004
7004
|
return BREAK;
|
|
7005
7005
|
else if (cv === REMOVE)
|
|
@@ -7020,17 +7020,17 @@ var require_visit = __commonJS({
|
|
|
7020
7020
|
visitAsync.BREAK = BREAK;
|
|
7021
7021
|
visitAsync.SKIP = SKIP;
|
|
7022
7022
|
visitAsync.REMOVE = REMOVE;
|
|
7023
|
-
async function visitAsync_(key, node, visitor,
|
|
7024
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
7023
|
+
async function visitAsync_(key, node, visitor, path16) {
|
|
7024
|
+
const ctrl = await callVisitor(key, node, visitor, path16);
|
|
7025
7025
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
7026
|
-
replaceNode(key,
|
|
7027
|
-
return visitAsync_(key, ctrl, visitor,
|
|
7026
|
+
replaceNode(key, path16, ctrl);
|
|
7027
|
+
return visitAsync_(key, ctrl, visitor, path16);
|
|
7028
7028
|
}
|
|
7029
7029
|
if (typeof ctrl !== "symbol") {
|
|
7030
7030
|
if (identity.isCollection(node)) {
|
|
7031
|
-
|
|
7031
|
+
path16 = Object.freeze(path16.concat(node));
|
|
7032
7032
|
for (let i = 0; i < node.items.length; ++i) {
|
|
7033
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
7033
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path16);
|
|
7034
7034
|
if (typeof ci === "number")
|
|
7035
7035
|
i = ci - 1;
|
|
7036
7036
|
else if (ci === BREAK)
|
|
@@ -7041,13 +7041,13 @@ var require_visit = __commonJS({
|
|
|
7041
7041
|
}
|
|
7042
7042
|
}
|
|
7043
7043
|
} else if (identity.isPair(node)) {
|
|
7044
|
-
|
|
7045
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
7044
|
+
path16 = Object.freeze(path16.concat(node));
|
|
7045
|
+
const ck = await visitAsync_("key", node.key, visitor, path16);
|
|
7046
7046
|
if (ck === BREAK)
|
|
7047
7047
|
return BREAK;
|
|
7048
7048
|
else if (ck === REMOVE)
|
|
7049
7049
|
node.key = null;
|
|
7050
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
7050
|
+
const cv = await visitAsync_("value", node.value, visitor, path16);
|
|
7051
7051
|
if (cv === BREAK)
|
|
7052
7052
|
return BREAK;
|
|
7053
7053
|
else if (cv === REMOVE)
|
|
@@ -7074,23 +7074,23 @@ var require_visit = __commonJS({
|
|
|
7074
7074
|
}
|
|
7075
7075
|
return visitor;
|
|
7076
7076
|
}
|
|
7077
|
-
function callVisitor(key, node, visitor,
|
|
7077
|
+
function callVisitor(key, node, visitor, path16) {
|
|
7078
7078
|
if (typeof visitor === "function")
|
|
7079
|
-
return visitor(key, node,
|
|
7079
|
+
return visitor(key, node, path16);
|
|
7080
7080
|
if (identity.isMap(node))
|
|
7081
|
-
return visitor.Map?.(key, node,
|
|
7081
|
+
return visitor.Map?.(key, node, path16);
|
|
7082
7082
|
if (identity.isSeq(node))
|
|
7083
|
-
return visitor.Seq?.(key, node,
|
|
7083
|
+
return visitor.Seq?.(key, node, path16);
|
|
7084
7084
|
if (identity.isPair(node))
|
|
7085
|
-
return visitor.Pair?.(key, node,
|
|
7085
|
+
return visitor.Pair?.(key, node, path16);
|
|
7086
7086
|
if (identity.isScalar(node))
|
|
7087
|
-
return visitor.Scalar?.(key, node,
|
|
7087
|
+
return visitor.Scalar?.(key, node, path16);
|
|
7088
7088
|
if (identity.isAlias(node))
|
|
7089
|
-
return visitor.Alias?.(key, node,
|
|
7089
|
+
return visitor.Alias?.(key, node, path16);
|
|
7090
7090
|
return void 0;
|
|
7091
7091
|
}
|
|
7092
|
-
function replaceNode(key,
|
|
7093
|
-
const parent =
|
|
7092
|
+
function replaceNode(key, path16, node) {
|
|
7093
|
+
const parent = path16[path16.length - 1];
|
|
7094
7094
|
if (identity.isCollection(parent)) {
|
|
7095
7095
|
parent.items[key] = node;
|
|
7096
7096
|
} else if (identity.isPair(parent)) {
|
|
@@ -7700,10 +7700,10 @@ var require_Collection = __commonJS({
|
|
|
7700
7700
|
var createNode = require_createNode();
|
|
7701
7701
|
var identity = require_identity();
|
|
7702
7702
|
var Node = require_Node();
|
|
7703
|
-
function collectionFromPath(schema,
|
|
7703
|
+
function collectionFromPath(schema, path16, value) {
|
|
7704
7704
|
let v = value;
|
|
7705
|
-
for (let i =
|
|
7706
|
-
const k =
|
|
7705
|
+
for (let i = path16.length - 1; i >= 0; --i) {
|
|
7706
|
+
const k = path16[i];
|
|
7707
7707
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
7708
7708
|
const a = [];
|
|
7709
7709
|
a[k] = v;
|
|
@@ -7722,7 +7722,7 @@ var require_Collection = __commonJS({
|
|
|
7722
7722
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
7723
7723
|
});
|
|
7724
7724
|
}
|
|
7725
|
-
var isEmptyPath = (
|
|
7725
|
+
var isEmptyPath = (path16) => path16 == null || typeof path16 === "object" && !!path16[Symbol.iterator]().next().done;
|
|
7726
7726
|
var Collection = class extends Node.NodeBase {
|
|
7727
7727
|
constructor(type, schema) {
|
|
7728
7728
|
super(type);
|
|
@@ -7752,11 +7752,11 @@ var require_Collection = __commonJS({
|
|
|
7752
7752
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
7753
7753
|
* that already exists in the map.
|
|
7754
7754
|
*/
|
|
7755
|
-
addIn(
|
|
7756
|
-
if (isEmptyPath(
|
|
7755
|
+
addIn(path16, value) {
|
|
7756
|
+
if (isEmptyPath(path16))
|
|
7757
7757
|
this.add(value);
|
|
7758
7758
|
else {
|
|
7759
|
-
const [key, ...rest] =
|
|
7759
|
+
const [key, ...rest] = path16;
|
|
7760
7760
|
const node = this.get(key, true);
|
|
7761
7761
|
if (identity.isCollection(node))
|
|
7762
7762
|
node.addIn(rest, value);
|
|
@@ -7770,8 +7770,8 @@ var require_Collection = __commonJS({
|
|
|
7770
7770
|
* Removes a value from the collection.
|
|
7771
7771
|
* @returns `true` if the item was found and removed.
|
|
7772
7772
|
*/
|
|
7773
|
-
deleteIn(
|
|
7774
|
-
const [key, ...rest] =
|
|
7773
|
+
deleteIn(path16) {
|
|
7774
|
+
const [key, ...rest] = path16;
|
|
7775
7775
|
if (rest.length === 0)
|
|
7776
7776
|
return this.delete(key);
|
|
7777
7777
|
const node = this.get(key, true);
|
|
@@ -7785,8 +7785,8 @@ var require_Collection = __commonJS({
|
|
|
7785
7785
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
7786
7786
|
* `true` (collections are always returned intact).
|
|
7787
7787
|
*/
|
|
7788
|
-
getIn(
|
|
7789
|
-
const [key, ...rest] =
|
|
7788
|
+
getIn(path16, keepScalar) {
|
|
7789
|
+
const [key, ...rest] = path16;
|
|
7790
7790
|
const node = this.get(key, true);
|
|
7791
7791
|
if (rest.length === 0)
|
|
7792
7792
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -7804,8 +7804,8 @@ var require_Collection = __commonJS({
|
|
|
7804
7804
|
/**
|
|
7805
7805
|
* Checks if the collection includes a value with the key `key`.
|
|
7806
7806
|
*/
|
|
7807
|
-
hasIn(
|
|
7808
|
-
const [key, ...rest] =
|
|
7807
|
+
hasIn(path16) {
|
|
7808
|
+
const [key, ...rest] = path16;
|
|
7809
7809
|
if (rest.length === 0)
|
|
7810
7810
|
return this.has(key);
|
|
7811
7811
|
const node = this.get(key, true);
|
|
@@ -7815,8 +7815,8 @@ var require_Collection = __commonJS({
|
|
|
7815
7815
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
7816
7816
|
* boolean to add/remove the item from the set.
|
|
7817
7817
|
*/
|
|
7818
|
-
setIn(
|
|
7819
|
-
const [key, ...rest] =
|
|
7818
|
+
setIn(path16, value) {
|
|
7819
|
+
const [key, ...rest] = path16;
|
|
7820
7820
|
if (rest.length === 0) {
|
|
7821
7821
|
this.set(key, value);
|
|
7822
7822
|
} else {
|
|
@@ -10331,9 +10331,9 @@ var require_Document = __commonJS({
|
|
|
10331
10331
|
this.contents.add(value);
|
|
10332
10332
|
}
|
|
10333
10333
|
/** Adds a value to the document. */
|
|
10334
|
-
addIn(
|
|
10334
|
+
addIn(path16, value) {
|
|
10335
10335
|
if (assertCollection(this.contents))
|
|
10336
|
-
this.contents.addIn(
|
|
10336
|
+
this.contents.addIn(path16, value);
|
|
10337
10337
|
}
|
|
10338
10338
|
/**
|
|
10339
10339
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -10408,14 +10408,14 @@ var require_Document = __commonJS({
|
|
|
10408
10408
|
* Removes a value from the document.
|
|
10409
10409
|
* @returns `true` if the item was found and removed.
|
|
10410
10410
|
*/
|
|
10411
|
-
deleteIn(
|
|
10412
|
-
if (Collection.isEmptyPath(
|
|
10411
|
+
deleteIn(path16) {
|
|
10412
|
+
if (Collection.isEmptyPath(path16)) {
|
|
10413
10413
|
if (this.contents == null)
|
|
10414
10414
|
return false;
|
|
10415
10415
|
this.contents = null;
|
|
10416
10416
|
return true;
|
|
10417
10417
|
}
|
|
10418
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
10418
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path16) : false;
|
|
10419
10419
|
}
|
|
10420
10420
|
/**
|
|
10421
10421
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -10430,10 +10430,10 @@ var require_Document = __commonJS({
|
|
|
10430
10430
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
10431
10431
|
* `true` (collections are always returned intact).
|
|
10432
10432
|
*/
|
|
10433
|
-
getIn(
|
|
10434
|
-
if (Collection.isEmptyPath(
|
|
10433
|
+
getIn(path16, keepScalar) {
|
|
10434
|
+
if (Collection.isEmptyPath(path16))
|
|
10435
10435
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
10436
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
10436
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path16, keepScalar) : void 0;
|
|
10437
10437
|
}
|
|
10438
10438
|
/**
|
|
10439
10439
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -10444,10 +10444,10 @@ var require_Document = __commonJS({
|
|
|
10444
10444
|
/**
|
|
10445
10445
|
* Checks if the document includes a value at `path`.
|
|
10446
10446
|
*/
|
|
10447
|
-
hasIn(
|
|
10448
|
-
if (Collection.isEmptyPath(
|
|
10447
|
+
hasIn(path16) {
|
|
10448
|
+
if (Collection.isEmptyPath(path16))
|
|
10449
10449
|
return this.contents !== void 0;
|
|
10450
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
10450
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path16) : false;
|
|
10451
10451
|
}
|
|
10452
10452
|
/**
|
|
10453
10453
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -10464,13 +10464,13 @@ var require_Document = __commonJS({
|
|
|
10464
10464
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
10465
10465
|
* boolean to add/remove the item from the set.
|
|
10466
10466
|
*/
|
|
10467
|
-
setIn(
|
|
10468
|
-
if (Collection.isEmptyPath(
|
|
10467
|
+
setIn(path16, value) {
|
|
10468
|
+
if (Collection.isEmptyPath(path16)) {
|
|
10469
10469
|
this.contents = value;
|
|
10470
10470
|
} else if (this.contents == null) {
|
|
10471
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
10471
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path16), value);
|
|
10472
10472
|
} else if (assertCollection(this.contents)) {
|
|
10473
|
-
this.contents.setIn(
|
|
10473
|
+
this.contents.setIn(path16, value);
|
|
10474
10474
|
}
|
|
10475
10475
|
}
|
|
10476
10476
|
/**
|
|
@@ -12430,9 +12430,9 @@ var require_cst_visit = __commonJS({
|
|
|
12430
12430
|
visit.BREAK = BREAK;
|
|
12431
12431
|
visit.SKIP = SKIP;
|
|
12432
12432
|
visit.REMOVE = REMOVE;
|
|
12433
|
-
visit.itemAtPath = (cst,
|
|
12433
|
+
visit.itemAtPath = (cst, path16) => {
|
|
12434
12434
|
let item = cst;
|
|
12435
|
-
for (const [field, index] of
|
|
12435
|
+
for (const [field, index] of path16) {
|
|
12436
12436
|
const tok = item?.[field];
|
|
12437
12437
|
if (tok && "items" in tok) {
|
|
12438
12438
|
item = tok.items[index];
|
|
@@ -12441,23 +12441,23 @@ var require_cst_visit = __commonJS({
|
|
|
12441
12441
|
}
|
|
12442
12442
|
return item;
|
|
12443
12443
|
};
|
|
12444
|
-
visit.parentCollection = (cst,
|
|
12445
|
-
const parent = visit.itemAtPath(cst,
|
|
12446
|
-
const field =
|
|
12444
|
+
visit.parentCollection = (cst, path16) => {
|
|
12445
|
+
const parent = visit.itemAtPath(cst, path16.slice(0, -1));
|
|
12446
|
+
const field = path16[path16.length - 1][0];
|
|
12447
12447
|
const coll = parent?.[field];
|
|
12448
12448
|
if (coll && "items" in coll)
|
|
12449
12449
|
return coll;
|
|
12450
12450
|
throw new Error("Parent collection not found");
|
|
12451
12451
|
};
|
|
12452
|
-
function _visit(
|
|
12453
|
-
let ctrl = visitor(item,
|
|
12452
|
+
function _visit(path16, item, visitor) {
|
|
12453
|
+
let ctrl = visitor(item, path16);
|
|
12454
12454
|
if (typeof ctrl === "symbol")
|
|
12455
12455
|
return ctrl;
|
|
12456
12456
|
for (const field of ["key", "value"]) {
|
|
12457
12457
|
const token = item[field];
|
|
12458
12458
|
if (token && "items" in token) {
|
|
12459
12459
|
for (let i = 0; i < token.items.length; ++i) {
|
|
12460
|
-
const ci = _visit(Object.freeze(
|
|
12460
|
+
const ci = _visit(Object.freeze(path16.concat([[field, i]])), token.items[i], visitor);
|
|
12461
12461
|
if (typeof ci === "number")
|
|
12462
12462
|
i = ci - 1;
|
|
12463
12463
|
else if (ci === BREAK)
|
|
@@ -12468,10 +12468,10 @@ var require_cst_visit = __commonJS({
|
|
|
12468
12468
|
}
|
|
12469
12469
|
}
|
|
12470
12470
|
if (typeof ctrl === "function" && field === "key")
|
|
12471
|
-
ctrl = ctrl(item,
|
|
12471
|
+
ctrl = ctrl(item, path16);
|
|
12472
12472
|
}
|
|
12473
12473
|
}
|
|
12474
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
12474
|
+
return typeof ctrl === "function" ? ctrl(item, path16) : ctrl;
|
|
12475
12475
|
}
|
|
12476
12476
|
exports.visit = visit;
|
|
12477
12477
|
}
|
|
@@ -14226,7 +14226,7 @@ var require_dist2 = __commonJS({
|
|
|
14226
14226
|
var require_main = __commonJS({
|
|
14227
14227
|
"../../node_modules/dotenv/lib/main.js"(exports, module) {
|
|
14228
14228
|
var fs11 = __require("fs");
|
|
14229
|
-
var
|
|
14229
|
+
var path16 = __require("path");
|
|
14230
14230
|
var os2 = __require("os");
|
|
14231
14231
|
var crypto3 = __require("crypto");
|
|
14232
14232
|
var TIPS = [
|
|
@@ -14365,7 +14365,7 @@ var require_main = __commonJS({
|
|
|
14365
14365
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
14366
14366
|
}
|
|
14367
14367
|
} else {
|
|
14368
|
-
possibleVaultPath =
|
|
14368
|
+
possibleVaultPath = path16.resolve(process.cwd(), ".env.vault");
|
|
14369
14369
|
}
|
|
14370
14370
|
if (fs11.existsSync(possibleVaultPath)) {
|
|
14371
14371
|
return possibleVaultPath;
|
|
@@ -14373,7 +14373,7 @@ var require_main = __commonJS({
|
|
|
14373
14373
|
return null;
|
|
14374
14374
|
}
|
|
14375
14375
|
function _resolveHome(envPath) {
|
|
14376
|
-
return envPath[0] === "~" ?
|
|
14376
|
+
return envPath[0] === "~" ? path16.join(os2.homedir(), envPath.slice(1)) : envPath;
|
|
14377
14377
|
}
|
|
14378
14378
|
function _configVault(options) {
|
|
14379
14379
|
const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
@@ -14390,7 +14390,7 @@ var require_main = __commonJS({
|
|
|
14390
14390
|
return { parsed };
|
|
14391
14391
|
}
|
|
14392
14392
|
function configDotenv(options) {
|
|
14393
|
-
const dotenvPath =
|
|
14393
|
+
const dotenvPath = path16.resolve(process.cwd(), ".env");
|
|
14394
14394
|
let encoding = "utf8";
|
|
14395
14395
|
let processEnv = process.env;
|
|
14396
14396
|
if (options && options.processEnv != null) {
|
|
@@ -14418,13 +14418,13 @@ var require_main = __commonJS({
|
|
|
14418
14418
|
}
|
|
14419
14419
|
let lastError;
|
|
14420
14420
|
const parsedAll = {};
|
|
14421
|
-
for (const
|
|
14421
|
+
for (const path17 of optionPaths) {
|
|
14422
14422
|
try {
|
|
14423
|
-
const parsed = DotenvModule.parse(fs11.readFileSync(
|
|
14423
|
+
const parsed = DotenvModule.parse(fs11.readFileSync(path17, { encoding }));
|
|
14424
14424
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
14425
14425
|
} catch (e) {
|
|
14426
14426
|
if (debug) {
|
|
14427
|
-
_debug(`failed to load ${
|
|
14427
|
+
_debug(`failed to load ${path17} ${e.message}`);
|
|
14428
14428
|
}
|
|
14429
14429
|
lastError = e;
|
|
14430
14430
|
}
|
|
@@ -14437,7 +14437,7 @@ var require_main = __commonJS({
|
|
|
14437
14437
|
const shortPaths = [];
|
|
14438
14438
|
for (const filePath of optionPaths) {
|
|
14439
14439
|
try {
|
|
14440
|
-
const relative2 =
|
|
14440
|
+
const relative2 = path16.relative(process.cwd(), filePath);
|
|
14441
14441
|
shortPaths.push(relative2);
|
|
14442
14442
|
} catch (e) {
|
|
14443
14443
|
if (debug) {
|
|
@@ -14543,7 +14543,7 @@ var require_main = __commonJS({
|
|
|
14543
14543
|
|
|
14544
14544
|
// ../argent-mcp/src/mcp-server.ts
|
|
14545
14545
|
import { appendFile, mkdir as mkdir5 } from "node:fs/promises";
|
|
14546
|
-
import { dirname as
|
|
14546
|
+
import { dirname as dirname9 } from "node:path";
|
|
14547
14547
|
import { homedir as homedir5 } from "node:os";
|
|
14548
14548
|
|
|
14549
14549
|
// ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
@@ -14789,10 +14789,10 @@ function mergeDefs(...defs) {
|
|
|
14789
14789
|
function cloneDef(schema) {
|
|
14790
14790
|
return mergeDefs(schema._zod.def);
|
|
14791
14791
|
}
|
|
14792
|
-
function getElementAtPath(obj,
|
|
14793
|
-
if (!
|
|
14792
|
+
function getElementAtPath(obj, path16) {
|
|
14793
|
+
if (!path16)
|
|
14794
14794
|
return obj;
|
|
14795
|
-
return
|
|
14795
|
+
return path16.reduce((acc, key) => acc?.[key], obj);
|
|
14796
14796
|
}
|
|
14797
14797
|
function promiseAllObject(promisesObj) {
|
|
14798
14798
|
const keys = Object.keys(promisesObj);
|
|
@@ -15201,11 +15201,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
15201
15201
|
}
|
|
15202
15202
|
return false;
|
|
15203
15203
|
}
|
|
15204
|
-
function prefixIssues(
|
|
15204
|
+
function prefixIssues(path16, issues) {
|
|
15205
15205
|
return issues.map((iss) => {
|
|
15206
15206
|
var _a3;
|
|
15207
15207
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
15208
|
-
iss.path.unshift(
|
|
15208
|
+
iss.path.unshift(path16);
|
|
15209
15209
|
return iss;
|
|
15210
15210
|
});
|
|
15211
15211
|
}
|
|
@@ -15352,16 +15352,16 @@ function flattenError(error2, mapper = (issue2) => issue2.message) {
|
|
|
15352
15352
|
}
|
|
15353
15353
|
function formatError(error2, mapper = (issue2) => issue2.message) {
|
|
15354
15354
|
const fieldErrors = { _errors: [] };
|
|
15355
|
-
const processError = (error3,
|
|
15355
|
+
const processError = (error3, path16 = []) => {
|
|
15356
15356
|
for (const issue2 of error3.issues) {
|
|
15357
15357
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
15358
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
15358
|
+
issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
|
|
15359
15359
|
} else if (issue2.code === "invalid_key") {
|
|
15360
|
-
processError({ issues: issue2.issues }, [...
|
|
15360
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
15361
15361
|
} else if (issue2.code === "invalid_element") {
|
|
15362
|
-
processError({ issues: issue2.issues }, [...
|
|
15362
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
15363
15363
|
} else {
|
|
15364
|
-
const fullpath = [...
|
|
15364
|
+
const fullpath = [...path16, ...issue2.path];
|
|
15365
15365
|
if (fullpath.length === 0) {
|
|
15366
15366
|
fieldErrors._errors.push(mapper(issue2));
|
|
15367
15367
|
} else {
|
|
@@ -21353,12 +21353,12 @@ var StdioServerTransport = class {
|
|
|
21353
21353
|
this.onclose?.();
|
|
21354
21354
|
}
|
|
21355
21355
|
send(message) {
|
|
21356
|
-
return new Promise((
|
|
21356
|
+
return new Promise((resolve9) => {
|
|
21357
21357
|
const json = serializeMessage(message);
|
|
21358
21358
|
if (this._stdout.write(json)) {
|
|
21359
|
-
|
|
21359
|
+
resolve9();
|
|
21360
21360
|
} else {
|
|
21361
|
-
this._stdout.once("drain",
|
|
21361
|
+
this._stdout.once("drain", resolve9);
|
|
21362
21362
|
}
|
|
21363
21363
|
});
|
|
21364
21364
|
}
|
|
@@ -21956,7 +21956,7 @@ var Protocol = class {
|
|
|
21956
21956
|
return;
|
|
21957
21957
|
}
|
|
21958
21958
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
21959
|
-
await new Promise((
|
|
21959
|
+
await new Promise((resolve9) => setTimeout(resolve9, pollInterval));
|
|
21960
21960
|
options?.signal?.throwIfAborted();
|
|
21961
21961
|
}
|
|
21962
21962
|
} catch (error2) {
|
|
@@ -21973,7 +21973,7 @@ var Protocol = class {
|
|
|
21973
21973
|
*/
|
|
21974
21974
|
request(request, resultSchema, options) {
|
|
21975
21975
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
21976
|
-
return new Promise((
|
|
21976
|
+
return new Promise((resolve9, reject) => {
|
|
21977
21977
|
const earlyReject = (error2) => {
|
|
21978
21978
|
reject(error2);
|
|
21979
21979
|
};
|
|
@@ -22051,7 +22051,7 @@ var Protocol = class {
|
|
|
22051
22051
|
if (!parseResult.success) {
|
|
22052
22052
|
reject(parseResult.error);
|
|
22053
22053
|
} else {
|
|
22054
|
-
|
|
22054
|
+
resolve9(parseResult.data);
|
|
22055
22055
|
}
|
|
22056
22056
|
} catch (error2) {
|
|
22057
22057
|
reject(error2);
|
|
@@ -22312,12 +22312,12 @@ var Protocol = class {
|
|
|
22312
22312
|
}
|
|
22313
22313
|
} catch {
|
|
22314
22314
|
}
|
|
22315
|
-
return new Promise((
|
|
22315
|
+
return new Promise((resolve9, reject) => {
|
|
22316
22316
|
if (signal.aborted) {
|
|
22317
22317
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
22318
22318
|
return;
|
|
22319
22319
|
}
|
|
22320
|
-
const timeoutId = setTimeout(
|
|
22320
|
+
const timeoutId = setTimeout(resolve9, interval);
|
|
22321
22321
|
signal.addEventListener("abort", () => {
|
|
22322
22322
|
clearTimeout(timeoutId);
|
|
22323
22323
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -23142,7 +23142,7 @@ function generateToken() {
|
|
|
23142
23142
|
return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
|
|
23143
23143
|
}
|
|
23144
23144
|
function findFreePort() {
|
|
23145
|
-
return new Promise((
|
|
23145
|
+
return new Promise((resolve9, reject) => {
|
|
23146
23146
|
const srv = net.createServer();
|
|
23147
23147
|
srv.listen(0, "127.0.0.1", () => {
|
|
23148
23148
|
const addr = srv.address();
|
|
@@ -23153,7 +23153,7 @@ function findFreePort() {
|
|
|
23153
23153
|
const port = addr.port;
|
|
23154
23154
|
srv.close((err) => {
|
|
23155
23155
|
if (err) reject(err);
|
|
23156
|
-
else
|
|
23156
|
+
else resolve9(port);
|
|
23157
23157
|
});
|
|
23158
23158
|
});
|
|
23159
23159
|
srv.on("error", reject);
|
|
@@ -23251,7 +23251,7 @@ function killSpawnedChild(child, pid) {
|
|
|
23251
23251
|
}
|
|
23252
23252
|
}
|
|
23253
23253
|
function spawnToolsServer(paths, port, options = {}) {
|
|
23254
|
-
return new Promise((
|
|
23254
|
+
return new Promise((resolve9, reject) => {
|
|
23255
23255
|
let logFd;
|
|
23256
23256
|
try {
|
|
23257
23257
|
fs.mkdirSync(STATE_DIR, { recursive: true });
|
|
@@ -23297,7 +23297,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
23297
23297
|
rl.close();
|
|
23298
23298
|
child.stdout?.resume();
|
|
23299
23299
|
child.stdout?.unref?.();
|
|
23300
|
-
settle(() =>
|
|
23300
|
+
settle(() => resolve9({ port: actualPort, pid }));
|
|
23301
23301
|
}
|
|
23302
23302
|
});
|
|
23303
23303
|
child.on("error", (err) => {
|
|
@@ -23591,6 +23591,12 @@ async function ensureToolsServer(paths) {
|
|
|
23591
23591
|
}
|
|
23592
23592
|
}
|
|
23593
23593
|
|
|
23594
|
+
// ../argent-tools-client/src/tools-client.ts
|
|
23595
|
+
import * as path6 from "node:path";
|
|
23596
|
+
|
|
23597
|
+
// ../registry/src/types.ts
|
|
23598
|
+
var LINKED_CALL_HEADER = "x-argent-linked";
|
|
23599
|
+
|
|
23594
23600
|
// ../registry/src/artifacts.ts
|
|
23595
23601
|
import { stat } from "node:fs/promises";
|
|
23596
23602
|
import { randomUUID } from "node:crypto";
|
|
@@ -23601,6 +23607,35 @@ var FLOW_NAME_CHARSET = "[A-Za-z0-9_-]+";
|
|
|
23601
23607
|
var FLOW_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}$`);
|
|
23602
23608
|
var FLOW_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.yaml$`);
|
|
23603
23609
|
var SCRIPT_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.mjs$`);
|
|
23610
|
+
function interpolateFileInputPath(template, args) {
|
|
23611
|
+
let missing = false;
|
|
23612
|
+
const out = template.replace(/\$\{([A-Za-z0-9_]+)\}/g, (_m, name) => {
|
|
23613
|
+
const v = args[name];
|
|
23614
|
+
if (typeof v !== "string" || v.length === 0) {
|
|
23615
|
+
missing = true;
|
|
23616
|
+
return "";
|
|
23617
|
+
}
|
|
23618
|
+
return v;
|
|
23619
|
+
});
|
|
23620
|
+
return missing ? null : out;
|
|
23621
|
+
}
|
|
23622
|
+
var TOOL_FILE_EXTENSIONS = [".png", ".yaml"];
|
|
23623
|
+
function hasToolFileExtension(file) {
|
|
23624
|
+
const name = file.toLowerCase();
|
|
23625
|
+
return TOOL_FILE_EXTENSIONS.some((extension) => name.endsWith(extension));
|
|
23626
|
+
}
|
|
23627
|
+
function toolStepFiles(specs, args) {
|
|
23628
|
+
const files = [];
|
|
23629
|
+
for (const spec of specs ?? []) {
|
|
23630
|
+
if (spec.skipWhenSet !== void 0 && args[spec.skipWhenSet] !== void 0) continue;
|
|
23631
|
+
const filled = interpolateFileInputPath(spec.path, args);
|
|
23632
|
+
if (filled !== null) files.push({ spec, path: filled });
|
|
23633
|
+
}
|
|
23634
|
+
return files;
|
|
23635
|
+
}
|
|
23636
|
+
function isClientFileArgument({ spec, path: path16 }) {
|
|
23637
|
+
return spec.kind === "file" && spec.path === `\${${spec.target}}` && path16.startsWith("/") && hasToolFileExtension(path16);
|
|
23638
|
+
}
|
|
23604
23639
|
|
|
23605
23640
|
// ../registry/src/flow-file-refs.ts
|
|
23606
23641
|
import * as fs2 from "node:fs/promises";
|
|
@@ -23629,6 +23664,8 @@ function isRecord(value) {
|
|
|
23629
23664
|
function collectFlowRequests(doc) {
|
|
23630
23665
|
const runTargets = /* @__PURE__ */ new Set();
|
|
23631
23666
|
const snapshots = /* @__PURE__ */ new Set();
|
|
23667
|
+
const toolSteps = [];
|
|
23668
|
+
const nested = [];
|
|
23632
23669
|
const seen = /* @__PURE__ */ new Set();
|
|
23633
23670
|
const visit = (steps, depth) => {
|
|
23634
23671
|
if (!Array.isArray(steps) || depth > MAX_BLOCK_NESTING || seen.has(steps)) return;
|
|
@@ -23642,11 +23679,17 @@ function collectFlowRequests(doc) {
|
|
|
23642
23679
|
}
|
|
23643
23680
|
const snapshot = isRecord(step.snapshot) ? step.snapshot.name : step.snapshot;
|
|
23644
23681
|
if (typeof snapshot === "string" && FLOW_NAME_PATTERN.test(snapshot)) snapshots.add(snapshot);
|
|
23682
|
+
if (typeof step.tool === "string") {
|
|
23683
|
+
const args = isRecord(step.args) ? step.args : {};
|
|
23684
|
+
toolSteps.push({ tool: step.tool, args });
|
|
23685
|
+
const target = step.tool === "flow-execute" ? nestedFlowTarget(args) : void 0;
|
|
23686
|
+
if (target !== void 0) nested.push({ target, args });
|
|
23687
|
+
}
|
|
23645
23688
|
visit(step.steps, depth + 1);
|
|
23646
23689
|
}
|
|
23647
23690
|
};
|
|
23648
23691
|
if (isRecord(doc)) visit(doc.steps, 0);
|
|
23649
|
-
return { runTargets: [...runTargets], snapshots: [...snapshots] };
|
|
23692
|
+
return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
|
|
23650
23693
|
}
|
|
23651
23694
|
function baselineKeyFor(canonicalPath, flowName) {
|
|
23652
23695
|
const stem = path2.basename(canonicalPath, ".yaml");
|
|
@@ -23662,6 +23705,26 @@ async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PA
|
|
|
23662
23705
|
if (actual === void 0) return { state: "absent" };
|
|
23663
23706
|
return { state: "case_folded", actual, addressable: addressable.test(actual) };
|
|
23664
23707
|
}
|
|
23708
|
+
function nestedFlowTarget(args) {
|
|
23709
|
+
if (typeof args !== "object" || args === null || Array.isArray(args)) return void 0;
|
|
23710
|
+
const { name, project_root: projectRoot, flow_path: flowPath } = args;
|
|
23711
|
+
if (flowPath === void 0) {
|
|
23712
|
+
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name)) return void 0;
|
|
23713
|
+
if (!isResolvedAbsolute(projectRoot)) return void 0;
|
|
23714
|
+
return {
|
|
23715
|
+
kind: "name",
|
|
23716
|
+
projectRoot,
|
|
23717
|
+
name,
|
|
23718
|
+
path: path2.join(projectRoot, ".argent", "flows", `${name}.yaml`)
|
|
23719
|
+
};
|
|
23720
|
+
}
|
|
23721
|
+
if (name !== void 0 || !isResolvedAbsolute(flowPath)) return void 0;
|
|
23722
|
+
if (!FLOW_FILE_NAME_PATTERN.test(path2.basename(flowPath))) return void 0;
|
|
23723
|
+
return { kind: "flow_path", path: flowPath };
|
|
23724
|
+
}
|
|
23725
|
+
function isResolvedAbsolute(value) {
|
|
23726
|
+
return typeof value === "string" && path2.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
|
|
23727
|
+
}
|
|
23665
23728
|
|
|
23666
23729
|
// ../registry/src/failure-codes.ts
|
|
23667
23730
|
var FAILURE_CODES = {
|
|
@@ -24021,9 +24084,9 @@ var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
|
|
|
24021
24084
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
24022
24085
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
24023
24086
|
var resolvedDuringInvocation = new AsyncLocalStorage();
|
|
24024
|
-
function valueAtPath(root,
|
|
24087
|
+
function valueAtPath(root, path16) {
|
|
24025
24088
|
let current = root;
|
|
24026
|
-
for (const key of
|
|
24089
|
+
for (const key of path16) {
|
|
24027
24090
|
if (current === null || typeof current !== "object") return void 0;
|
|
24028
24091
|
if (!Object.hasOwn(current, key)) return void 0;
|
|
24029
24092
|
current = current[key];
|
|
@@ -24307,9 +24370,9 @@ function untrackArchive(archive) {
|
|
|
24307
24370
|
process.removeListener("exit", removePendingArchives);
|
|
24308
24371
|
}
|
|
24309
24372
|
function sha256File(filePath) {
|
|
24310
|
-
return new Promise((
|
|
24373
|
+
return new Promise((resolve9, reject) => {
|
|
24311
24374
|
const hash = createHash2("sha256");
|
|
24312
|
-
createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () =>
|
|
24375
|
+
createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve9(hash.digest("hex"))).on("error", reject);
|
|
24313
24376
|
});
|
|
24314
24377
|
}
|
|
24315
24378
|
function toolServerError(text) {
|
|
@@ -24417,6 +24480,9 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
24417
24480
|
);
|
|
24418
24481
|
}
|
|
24419
24482
|
}
|
|
24483
|
+
if (spec.kind === "probe" && spec.collect === "step" && opts.includeContent && opts.collectStepMembers) {
|
|
24484
|
+
wire.members = await opts.collectStepMembers(record2, opts);
|
|
24485
|
+
}
|
|
24420
24486
|
if (spec.kind === "tar-upload") {
|
|
24421
24487
|
const st = await stat2(filePath).catch(() => null);
|
|
24422
24488
|
if (st) {
|
|
@@ -24543,14 +24609,14 @@ function printable(text) {
|
|
|
24543
24609
|
(c) => c < " " || c === "\x7F" ? `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}` : c
|
|
24544
24610
|
).join("");
|
|
24545
24611
|
}
|
|
24546
|
-
function
|
|
24612
|
+
function isResolvedAbsolute2(value) {
|
|
24547
24613
|
return typeof value === "string" && path5.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
|
|
24548
24614
|
}
|
|
24549
24615
|
function namesValidFlow(args) {
|
|
24550
24616
|
const { project_root, flow_path, name } = args;
|
|
24551
|
-
if (!
|
|
24617
|
+
if (!isResolvedAbsolute2(project_root)) return false;
|
|
24552
24618
|
if (name === void 0) {
|
|
24553
|
-
return
|
|
24619
|
+
return isResolvedAbsolute2(flow_path) && FLOW_FILE_NAME_PATTERN.test(path5.basename(flow_path));
|
|
24554
24620
|
}
|
|
24555
24621
|
return flow_path === void 0 && typeof name === "string" && FLOW_NAME_PATTERN.test(name);
|
|
24556
24622
|
}
|
|
@@ -24636,6 +24702,29 @@ async function readFlowMember(anchorDir, target, roots, budget, opts) {
|
|
|
24636
24702
|
const sent = await sendBytes(member, canonical, budget, opts);
|
|
24637
24703
|
return { ...sent, text: sent.bytes?.toString("utf8") };
|
|
24638
24704
|
}
|
|
24705
|
+
async function readToolMember(file, roots, budget, opts) {
|
|
24706
|
+
const member = { role: "tool", key: file, path: file };
|
|
24707
|
+
const refuse = (reason) => ({
|
|
24708
|
+
member: { ...member, state: "refused", error: reason },
|
|
24709
|
+
sent: `refused (${reason})`
|
|
24710
|
+
});
|
|
24711
|
+
const { canonical } = await landing(file);
|
|
24712
|
+
if (!roots.some((root) => isWithin(canonical, root))) {
|
|
24713
|
+
return refuse(`${file} is outside every root this client serves (${roots.join(", ")})`);
|
|
24714
|
+
}
|
|
24715
|
+
if (!hasToolFileExtension(canonical)) {
|
|
24716
|
+
return refuse(`${file} links to a file that is not one of ${TOOL_FILE_EXTENSIONS.join(", ")}`);
|
|
24717
|
+
}
|
|
24718
|
+
const st = await stat3(canonical).catch((err) => err);
|
|
24719
|
+
if (st instanceof Error) {
|
|
24720
|
+
if (st.code === "ENOENT" || st.code === "ENOTDIR") {
|
|
24721
|
+
return { member: { ...member, state: "missing" }, sent: "missing" };
|
|
24722
|
+
}
|
|
24723
|
+
return refuse(st.message);
|
|
24724
|
+
}
|
|
24725
|
+
if (st.isDirectory()) return refuse("EISDIR: illegal operation on a directory, read");
|
|
24726
|
+
return sendBytes(member, canonical, budget, opts);
|
|
24727
|
+
}
|
|
24639
24728
|
function callPlatform(args) {
|
|
24640
24729
|
if (typeof args.device === "string" && args.device.startsWith("chromium-cdp-")) return "chromium";
|
|
24641
24730
|
if (typeof args.platform !== "string") return void 0;
|
|
@@ -24690,51 +24779,15 @@ async function sendBytes(member, real, budget, opts) {
|
|
|
24690
24779
|
bytes
|
|
24691
24780
|
};
|
|
24692
24781
|
}
|
|
24693
|
-
|
|
24694
|
-
|
|
24695
|
-
path5.dirname(canonical),
|
|
24696
|
-
"__baselines__",
|
|
24697
|
-
baselineKeyFor(canonical, flowName)
|
|
24698
|
-
);
|
|
24699
|
-
const real = (await landing(dir)).canonical;
|
|
24700
|
-
if (!roots.some((root) => isWithin(real, root))) return;
|
|
24701
|
-
const updates = args.updateBaselines === true;
|
|
24702
|
-
if (updates) opts.baselineDirs?.push(dir);
|
|
24703
|
-
const platform = callPlatform(args);
|
|
24704
|
-
const prefixes = snapshots.map(
|
|
24705
|
-
(name) => `${name}__${platform === void 0 ? "" : `${platform}-`}`
|
|
24706
|
-
);
|
|
24707
|
-
const names = await readdir4(dir).catch(() => []);
|
|
24708
|
-
for (const name of names.sort()) {
|
|
24709
|
-
if (!name.endsWith(".png")) continue;
|
|
24710
|
-
if (!updates && !prefixes.some((prefix) => name.startsWith(prefix))) continue;
|
|
24711
|
-
const file = path5.join(dir, name);
|
|
24712
|
-
const member = { role: "baseline", key: file, path: file };
|
|
24713
|
-
const entry = await baselineEntry(file, roots, updates);
|
|
24714
|
-
if (entry.state === "refused") {
|
|
24715
|
-
emit({ ...member, state: "refused", error: entry.error }, `refused (${entry.error})`);
|
|
24716
|
-
} else if (entry.state === "missing") {
|
|
24717
|
-
emit({ ...member, state: "missing" }, "missing");
|
|
24718
|
-
} else if (updates) {
|
|
24719
|
-
emit({ ...member, state: "listed" }, "listed");
|
|
24720
|
-
} else {
|
|
24721
|
-
const sent = await sendBytes(member, entry.real, budget, opts);
|
|
24722
|
-
emit(sent.member, sent.sent);
|
|
24723
|
-
}
|
|
24724
|
-
}
|
|
24782
|
+
function nestedRunUpdates(parentUpdates, args) {
|
|
24783
|
+
return args.updateBaselines === true || parentUpdates && args.updateBaselines === void 0;
|
|
24725
24784
|
}
|
|
24726
|
-
|
|
24727
|
-
if (!namesValidFlow(args)) return {};
|
|
24728
|
-
const canonical = await canonicalFlowPath(rootPath);
|
|
24729
|
-
const spelling = await classifyOnDiskSpelling(
|
|
24730
|
-
path5.dirname(rootPath),
|
|
24731
|
-
path5.basename(rootPath),
|
|
24732
|
-
FLOW_FILE_NAME_PATTERN
|
|
24733
|
-
);
|
|
24734
|
-
const roots = await closureRoots(rootPath, canonical, args.project_root);
|
|
24785
|
+
function memberCollector(roots, opts) {
|
|
24735
24786
|
const members = [];
|
|
24736
|
-
const
|
|
24737
|
-
const
|
|
24787
|
+
const flows = /* @__PURE__ */ new Map();
|
|
24788
|
+
const tools = /* @__PURE__ */ new Set();
|
|
24789
|
+
const runs = /* @__PURE__ */ new Set();
|
|
24790
|
+
const baselineDirs = /* @__PURE__ */ new Map();
|
|
24738
24791
|
const budget = { inline: 0 };
|
|
24739
24792
|
const logging = process.env[FLOW_FILES_LOG_ENV] === "1";
|
|
24740
24793
|
const log = opts.log ?? ((line) => void process.stderr.write(`${line}
|
|
@@ -24744,42 +24797,194 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
|
|
|
24744
24797
|
const subject = member.role === "flow" ? member.canonical : member.key;
|
|
24745
24798
|
if (logging) log(printable(`[flow-files] ${member.role} ${subject}: ${sent}`));
|
|
24746
24799
|
};
|
|
24747
|
-
|
|
24748
|
-
|
|
24749
|
-
|
|
24750
|
-
|
|
24751
|
-
|
|
24752
|
-
}
|
|
24753
|
-
|
|
24754
|
-
|
|
24755
|
-
|
|
24756
|
-
|
|
24757
|
-
|
|
24758
|
-
|
|
24759
|
-
|
|
24760
|
-
|
|
24761
|
-
|
|
24762
|
-
|
|
24763
|
-
|
|
24764
|
-
|
|
24765
|
-
|
|
24800
|
+
async function flow(anchorDir, target) {
|
|
24801
|
+
const key = flowMemberKey(anchorDir, target);
|
|
24802
|
+
const known = flows.get(key);
|
|
24803
|
+
if (known !== void 0) return known;
|
|
24804
|
+
const { member, text, sent } = await readFlowMember(anchorDir, target, roots, budget, opts);
|
|
24805
|
+
const entry = { member, ...text === void 0 ? {} : { text } };
|
|
24806
|
+
flows.set(key, entry);
|
|
24807
|
+
emit(member, sent);
|
|
24808
|
+
return entry;
|
|
24809
|
+
}
|
|
24810
|
+
async function toolFiles(step) {
|
|
24811
|
+
if (step.tool === "flow-execute") return;
|
|
24812
|
+
for (const file of toolStepFiles(opts.toolFileInputs?.(step.tool), step.args)) {
|
|
24813
|
+
const { unwrapWhenSet } = file.spec;
|
|
24814
|
+
if (unwrapWhenSet !== void 0 && step.args[unwrapWhenSet] !== void 0) continue;
|
|
24815
|
+
if (!isClientFileArgument(file) || tools.has(file.path)) continue;
|
|
24816
|
+
tools.add(file.path);
|
|
24817
|
+
const read = await readToolMember(file.path, roots, budget, opts);
|
|
24818
|
+
emit(read.member, read.sent);
|
|
24819
|
+
}
|
|
24820
|
+
}
|
|
24821
|
+
async function nestedRun(target, hop, updates, platform) {
|
|
24822
|
+
const { member, text } = await flow(path5.dirname(target.path), `${target.name}.yaml`);
|
|
24823
|
+
if (text === void 0 || hop >= MAX_RUN_DEPTH) return void 0;
|
|
24824
|
+
return { canonical: member.canonical, text, flowName: target.name, hop, updates, platform };
|
|
24825
|
+
}
|
|
24826
|
+
async function walk(start) {
|
|
24827
|
+
const queue = [...start];
|
|
24828
|
+
for (let run = queue.shift(); run !== void 0; run = queue.shift()) {
|
|
24829
|
+
const id = [run.canonical, run.flowName, run.updates, run.platform ?? ""].join("\0");
|
|
24830
|
+
if (runs.has(id)) continue;
|
|
24831
|
+
runs.add(id);
|
|
24832
|
+
const snapshots = /* @__PURE__ */ new Set();
|
|
24833
|
+
const visited = /* @__PURE__ */ new Set();
|
|
24834
|
+
const files = [{ canonical: run.canonical, text: run.text, hop: run.hop }];
|
|
24835
|
+
for (let file = files.shift(); file !== void 0; file = files.shift()) {
|
|
24836
|
+
let doc;
|
|
24837
|
+
try {
|
|
24838
|
+
doc = (0, import_yaml.parse)(file.text.trim(), { logLevel: "error" });
|
|
24839
|
+
} catch {
|
|
24840
|
+
continue;
|
|
24841
|
+
}
|
|
24842
|
+
const requests = collectFlowRequests(doc);
|
|
24843
|
+
for (const name of requests.snapshots) snapshots.add(name);
|
|
24844
|
+
for (const step of requests.toolSteps) await toolFiles(step);
|
|
24845
|
+
const anchorDir = path5.dirname(file.canonical);
|
|
24846
|
+
for (const target of requests.runTargets) {
|
|
24847
|
+
const key = flowMemberKey(anchorDir, target);
|
|
24848
|
+
if (visited.has(key)) continue;
|
|
24849
|
+
visited.add(key);
|
|
24850
|
+
const { member, text } = await flow(anchorDir, target);
|
|
24851
|
+
if (text !== void 0 && file.hop + 1 < MAX_RUN_DEPTH) {
|
|
24852
|
+
files.push({ canonical: member.canonical, text, hop: file.hop + 1 });
|
|
24853
|
+
}
|
|
24854
|
+
}
|
|
24855
|
+
for (const { target, args } of requests.nested) {
|
|
24856
|
+
if (target.kind !== "name") continue;
|
|
24857
|
+
const next = await nestedRun(
|
|
24858
|
+
target,
|
|
24859
|
+
file.hop + 1,
|
|
24860
|
+
nestedRunUpdates(run.updates, args),
|
|
24861
|
+
run.platform
|
|
24862
|
+
);
|
|
24863
|
+
if (next !== void 0) queue.push(next);
|
|
24864
|
+
}
|
|
24865
|
+
}
|
|
24866
|
+
if (snapshots.size === 0) continue;
|
|
24867
|
+
const dir = path5.join(
|
|
24868
|
+
path5.dirname(run.canonical),
|
|
24869
|
+
"__baselines__",
|
|
24870
|
+
baselineKeyFor(run.canonical, run.flowName)
|
|
24871
|
+
);
|
|
24872
|
+
const entry = baselineDirs.get(dir) ?? { prefixes: /* @__PURE__ */ new Set(), updates: false };
|
|
24873
|
+
baselineDirs.set(dir, entry);
|
|
24874
|
+
if (run.updates) {
|
|
24875
|
+
entry.updates = true;
|
|
24876
|
+
} else {
|
|
24877
|
+
const platform = run.platform === void 0 ? "" : `${run.platform}-`;
|
|
24878
|
+
for (const name of snapshots) entry.prefixes.add(`${name}__${platform}`);
|
|
24879
|
+
}
|
|
24880
|
+
}
|
|
24881
|
+
}
|
|
24882
|
+
async function sendBaselines() {
|
|
24883
|
+
for (const [dir, { prefixes, updates }] of baselineDirs) {
|
|
24884
|
+
const real = (await landing(dir)).canonical;
|
|
24885
|
+
if (!roots.some((root) => isWithin(real, root))) continue;
|
|
24886
|
+
if (updates) opts.baselineDirs?.push(dir);
|
|
24887
|
+
const names = await readdir4(dir).catch(() => []);
|
|
24888
|
+
for (const name of names.sort()) {
|
|
24889
|
+
if (!name.endsWith(".png")) continue;
|
|
24890
|
+
const compared = [...prefixes].some((prefix) => name.startsWith(prefix));
|
|
24891
|
+
if (!updates && !compared) continue;
|
|
24892
|
+
const file = path5.join(dir, name);
|
|
24893
|
+
if (tools.has(file)) continue;
|
|
24894
|
+
const member = { role: "baseline", key: file, path: file };
|
|
24895
|
+
const entry = await baselineEntry(file, roots, updates && !compared);
|
|
24896
|
+
if (entry.state === "refused") {
|
|
24897
|
+
emit({ ...member, state: "refused", error: entry.error }, `refused (${entry.error})`);
|
|
24898
|
+
} else if (entry.state === "missing") {
|
|
24899
|
+
emit({ ...member, state: "missing" }, "missing");
|
|
24900
|
+
} else if (!compared) {
|
|
24901
|
+
emit({ ...member, state: "listed" }, "listed");
|
|
24902
|
+
} else {
|
|
24903
|
+
const sent = await sendBytes(member, entry.real, budget, opts);
|
|
24904
|
+
emit(sent.member, sent.sent);
|
|
24905
|
+
}
|
|
24766
24906
|
}
|
|
24767
24907
|
}
|
|
24768
24908
|
}
|
|
24769
|
-
|
|
24770
|
-
|
|
24771
|
-
|
|
24909
|
+
return { members, flow, toolFiles, nestedRun, walk, sendBaselines };
|
|
24910
|
+
}
|
|
24911
|
+
async function collectFlowMembers(rootPath, rootBytes, args, opts) {
|
|
24912
|
+
if (!namesValidFlow(args)) return {};
|
|
24913
|
+
const canonical = await canonicalFlowPath(rootPath);
|
|
24914
|
+
const spelling = await classifyOnDiskSpelling(
|
|
24915
|
+
path5.dirname(rootPath),
|
|
24916
|
+
path5.basename(rootPath),
|
|
24917
|
+
FLOW_FILE_NAME_PATTERN
|
|
24918
|
+
);
|
|
24919
|
+
const collector = memberCollector(
|
|
24920
|
+
await closureRoots(rootPath, canonical, args.project_root),
|
|
24921
|
+
opts
|
|
24922
|
+
);
|
|
24923
|
+
await collector.walk([
|
|
24924
|
+
{
|
|
24772
24925
|
canonical,
|
|
24773
|
-
|
|
24774
|
-
|
|
24775
|
-
|
|
24776
|
-
|
|
24777
|
-
|
|
24778
|
-
|
|
24779
|
-
|
|
24780
|
-
|
|
24926
|
+
text: rootBytes.toString("utf8"),
|
|
24927
|
+
flowName: path5.basename(rootPath, ".yaml"),
|
|
24928
|
+
hop: 0,
|
|
24929
|
+
updates: args.updateBaselines === true,
|
|
24930
|
+
platform: callPlatform(args)
|
|
24931
|
+
}
|
|
24932
|
+
]);
|
|
24933
|
+
await collector.sendBaselines();
|
|
24934
|
+
return { canonical, spelling, members: collector.members };
|
|
24935
|
+
}
|
|
24936
|
+
function recordedStep(args) {
|
|
24937
|
+
const { command, args: text } = args;
|
|
24938
|
+
if (typeof command !== "string") return void 0;
|
|
24939
|
+
if (text === void 0) return { tool: command, args: {} };
|
|
24940
|
+
if (typeof text !== "string") return void 0;
|
|
24941
|
+
let parsed;
|
|
24942
|
+
try {
|
|
24943
|
+
parsed = JSON.parse(text);
|
|
24944
|
+
} catch {
|
|
24945
|
+
return void 0;
|
|
24946
|
+
}
|
|
24947
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
|
|
24948
|
+
return { tool: command, args: parsed };
|
|
24949
|
+
}
|
|
24950
|
+
async function collectStepMembers(args, opts) {
|
|
24951
|
+
const { name, project_root: projectRoot } = args;
|
|
24952
|
+
const step = recordedStep(args);
|
|
24953
|
+
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || typeof projectRoot !== "string" || !path5.isAbsolute(projectRoot) || step === void 0) {
|
|
24954
|
+
return [];
|
|
24955
|
+
}
|
|
24956
|
+
const recording = path5.join(projectRoot, ".argent", "flows", `${name}.yaml`);
|
|
24957
|
+
const collector = memberCollector(
|
|
24958
|
+
await closureRoots(recording, (await landing(recording)).canonical, projectRoot),
|
|
24959
|
+
opts
|
|
24960
|
+
);
|
|
24961
|
+
await collector.toolFiles(step);
|
|
24962
|
+
if (step.tool === "flow-execute") {
|
|
24963
|
+
const self = await collector.flow(path5.dirname(recording), path5.basename(recording));
|
|
24964
|
+
let runArgs = step.args;
|
|
24965
|
+
const named = nestedFlowTarget(runArgs);
|
|
24966
|
+
if (named?.kind === "flow_path") {
|
|
24967
|
+
const stem = path5.basename(named.path, ".yaml");
|
|
24968
|
+
if (path5.resolve(path5.dirname(named.path)) === path5.resolve(path5.dirname(recording))) {
|
|
24969
|
+
await collector.flow(path5.dirname(recording), path5.basename(named.path));
|
|
24970
|
+
runArgs = { ...runArgs, name: stem };
|
|
24971
|
+
delete runArgs.flow_path;
|
|
24972
|
+
}
|
|
24973
|
+
}
|
|
24974
|
+
const target = nestedFlowTarget(runArgs);
|
|
24975
|
+
if (target?.kind === "name") {
|
|
24976
|
+
await collector.flow(path5.dirname(self.member.canonical), `${target.name}.yaml`);
|
|
24977
|
+
const run = await collector.nestedRun(
|
|
24978
|
+
target,
|
|
24979
|
+
0,
|
|
24980
|
+
runArgs.updateBaselines === true,
|
|
24981
|
+
callPlatform(runArgs)
|
|
24982
|
+
);
|
|
24983
|
+
if (run !== void 0) await collector.walk([run]);
|
|
24984
|
+
}
|
|
24781
24985
|
}
|
|
24782
|
-
|
|
24986
|
+
await collector.sendBaselines();
|
|
24987
|
+
return collector.members;
|
|
24783
24988
|
}
|
|
24784
24989
|
|
|
24785
24990
|
// ../argent-tools-client/src/tools-client.ts
|
|
@@ -24940,7 +25145,8 @@ function createToolsClient(options = {}) {
|
|
|
24940
25145
|
opts?.signal?.throwIfAborted();
|
|
24941
25146
|
const { url, token, remote } = await route();
|
|
24942
25147
|
let finalArgs = args;
|
|
24943
|
-
const
|
|
25148
|
+
const tools = await fetchTools({ signal: opts?.signal });
|
|
25149
|
+
const meta2 = tools.find((t) => t.name === name) ?? null;
|
|
24944
25150
|
const baselineDirs = [];
|
|
24945
25151
|
if (meta2?.fileInputs?.length) {
|
|
24946
25152
|
if (remote) assertRequiredPresent(meta2, args);
|
|
@@ -24950,6 +25156,8 @@ function createToolsClient(options = {}) {
|
|
|
24950
25156
|
log: diagnose,
|
|
24951
25157
|
baselineDirs,
|
|
24952
25158
|
collectMembers: collectFlowMembers,
|
|
25159
|
+
collectStepMembers,
|
|
25160
|
+
toolFileInputs: (tool) => tools.find((t) => t.name === tool)?.fileInputs,
|
|
24953
25161
|
signal: opts?.signal
|
|
24954
25162
|
});
|
|
24955
25163
|
}
|
|
@@ -24959,7 +25167,11 @@ function createToolsClient(options = {}) {
|
|
|
24959
25167
|
diagnose(`The baseline ${file} was not written on this client: ${error2}`);
|
|
24960
25168
|
}
|
|
24961
25169
|
if (process.env.ARGENT_FLOW_FILES_LOG === "1") {
|
|
24962
|
-
for (const file of applied.written)
|
|
25170
|
+
for (const file of applied.written) {
|
|
25171
|
+
if (baselineDirs.includes(path6.dirname(file))) {
|
|
25172
|
+
diagnose(`[flow-files] baseline ${file}: written`);
|
|
25173
|
+
}
|
|
25174
|
+
}
|
|
24963
25175
|
}
|
|
24964
25176
|
return applied.result;
|
|
24965
25177
|
};
|
|
@@ -24971,6 +25183,9 @@ function createToolsClient(options = {}) {
|
|
|
24971
25183
|
method: "POST",
|
|
24972
25184
|
headers: {
|
|
24973
25185
|
"Content-Type": "application/json",
|
|
25186
|
+
// Tells the tool-server the call came over a link, a link to
|
|
25187
|
+
// 127.0.0.1 included, which nothing else in the request shows.
|
|
25188
|
+
...remote ? { [LINKED_CALL_HEADER]: "1" } : {},
|
|
24974
25189
|
// A proxy that compresses the stream holds each line until its buffer
|
|
24975
25190
|
// fills. `identity` keeps the stream uncompressed end to end.
|
|
24976
25191
|
...stream ? { "Accept": "application/x-ndjson", "Accept-Encoding": "identity" } : {},
|
|
@@ -25031,35 +25246,35 @@ function createToolsClient(options = {}) {
|
|
|
25031
25246
|
import { copyFile, mkdir as mkdir4, readFile as readFile5, realpath as realpath4, rm as rm3, stat as stat4, writeFile as writeFile4 } from "node:fs/promises";
|
|
25032
25247
|
import { constants as fsConstants } from "node:fs";
|
|
25033
25248
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
25034
|
-
import { basename as basename6, dirname as
|
|
25249
|
+
import { basename as basename6, dirname as dirname8, extname as extname2, isAbsolute as isAbsolute6, join as join11, normalize as normalize2, resolve as resolve7, sep as sep4 } from "node:path";
|
|
25035
25250
|
import { createHash as createHash3 } from "node:crypto";
|
|
25036
25251
|
|
|
25037
25252
|
// ../configuration-core/src/flags.ts
|
|
25038
25253
|
import * as fs3 from "node:fs";
|
|
25039
|
-
import * as
|
|
25254
|
+
import * as path7 from "node:path";
|
|
25040
25255
|
import { homedir as homedir3 } from "node:os";
|
|
25041
25256
|
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
25042
25257
|
function findProjectRoot(startDir) {
|
|
25043
|
-
let current =
|
|
25258
|
+
let current = path7.resolve(startDir);
|
|
25044
25259
|
while (true) {
|
|
25045
25260
|
for (const marker of PROJECT_MARKERS) {
|
|
25046
|
-
if (fs3.existsSync(
|
|
25261
|
+
if (fs3.existsSync(path7.join(current, marker))) return current;
|
|
25047
25262
|
}
|
|
25048
|
-
const parent =
|
|
25263
|
+
const parent = path7.dirname(current);
|
|
25049
25264
|
if (parent === current) return null;
|
|
25050
25265
|
current = parent;
|
|
25051
25266
|
}
|
|
25052
25267
|
}
|
|
25053
25268
|
function resolveProjectRoot(startDir) {
|
|
25054
|
-
return findProjectRoot(startDir) ??
|
|
25269
|
+
return findProjectRoot(startDir) ?? path7.resolve(startDir);
|
|
25055
25270
|
}
|
|
25056
25271
|
function getFlagsPath(scope, options = {}) {
|
|
25057
25272
|
const home = options.homeDir ?? homedir3();
|
|
25058
25273
|
if (scope === "global") {
|
|
25059
|
-
return
|
|
25274
|
+
return path7.join(home, ".argent", "flags.json");
|
|
25060
25275
|
}
|
|
25061
25276
|
const cwd = options.cwd ?? process.cwd();
|
|
25062
|
-
return
|
|
25277
|
+
return path7.join(resolveProjectRoot(cwd), ".argent", "flags.json");
|
|
25063
25278
|
}
|
|
25064
25279
|
function readFlagsFile(filePath) {
|
|
25065
25280
|
let raw;
|
|
@@ -25096,7 +25311,7 @@ function isFlagEnabled(name, options = {}) {
|
|
|
25096
25311
|
|
|
25097
25312
|
// ../configuration-core/src/paths.ts
|
|
25098
25313
|
import * as os from "node:os";
|
|
25099
|
-
import * as
|
|
25314
|
+
import * as path8 from "node:path";
|
|
25100
25315
|
function nonEmpty(value) {
|
|
25101
25316
|
if (value == void 0) return null;
|
|
25102
25317
|
const trimmed = value.trim();
|
|
@@ -25107,23 +25322,23 @@ function resolveHomeDir(options = {}) {
|
|
|
25107
25322
|
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
25108
25323
|
}
|
|
25109
25324
|
function argentHomeDir() {
|
|
25110
|
-
return
|
|
25325
|
+
return path8.join(resolveHomeDir(), ".argent");
|
|
25111
25326
|
}
|
|
25112
25327
|
function configDir(scope = "global", options = {}) {
|
|
25113
25328
|
if (scope === "global") {
|
|
25114
|
-
return
|
|
25329
|
+
return path8.join(resolveHomeDir(options), ".argent");
|
|
25115
25330
|
}
|
|
25116
25331
|
const cwd = options.cwd ?? process.cwd();
|
|
25117
|
-
return
|
|
25332
|
+
return path8.join(resolveProjectRoot(cwd), ".argent");
|
|
25118
25333
|
}
|
|
25119
25334
|
function configFilePath(scope = "global", options = {}) {
|
|
25120
|
-
return
|
|
25335
|
+
return path8.join(configDir(scope, options), "config.json");
|
|
25121
25336
|
}
|
|
25122
25337
|
|
|
25123
25338
|
// ../configuration-core/src/config.ts
|
|
25124
25339
|
import * as crypto from "node:crypto";
|
|
25125
25340
|
import * as fs4 from "node:fs";
|
|
25126
|
-
import * as
|
|
25341
|
+
import * as path9 from "node:path";
|
|
25127
25342
|
function readConfigObject(scope = "global", options = {}) {
|
|
25128
25343
|
try {
|
|
25129
25344
|
const raw = fs4.readFileSync(configFilePath(scope, options), "utf8");
|
|
@@ -25210,7 +25425,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
25210
25425
|
try {
|
|
25211
25426
|
const next = readConfigObject(scope, options);
|
|
25212
25427
|
mutate(next);
|
|
25213
|
-
const tmpPath =
|
|
25428
|
+
const tmpPath = path9.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
25214
25429
|
const fd = fs4.openSync(tmpPath, "wx", 384);
|
|
25215
25430
|
try {
|
|
25216
25431
|
fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
@@ -25235,7 +25450,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
25235
25450
|
// ../configuration-core/src/secrets.ts
|
|
25236
25451
|
var import_dotenv = __toESM(require_main(), 1);
|
|
25237
25452
|
import * as fs5 from "node:fs";
|
|
25238
|
-
import * as
|
|
25453
|
+
import * as path10 from "node:path";
|
|
25239
25454
|
|
|
25240
25455
|
// ../configuration-core/src/merge.ts
|
|
25241
25456
|
function mergeRestrictive(local, global) {
|
|
@@ -25289,7 +25504,7 @@ function applyMergePolicy(policy, local, global) {
|
|
|
25289
25504
|
}
|
|
25290
25505
|
|
|
25291
25506
|
// ../configuration-core/src/config-schema.ts
|
|
25292
|
-
import { isAbsolute as
|
|
25507
|
+
import { isAbsolute as isAbsolute5 } from "node:path";
|
|
25293
25508
|
function asBoolean(raw) {
|
|
25294
25509
|
return typeof raw === "boolean" ? raw : void 0;
|
|
25295
25510
|
}
|
|
@@ -25358,7 +25573,7 @@ var CONFIG_SCHEMA = [
|
|
|
25358
25573
|
scopes: ["project", "global"],
|
|
25359
25574
|
parse: (raw) => {
|
|
25360
25575
|
const value = asString(raw);
|
|
25361
|
-
return value !== void 0 && (value === "~" || value.startsWith("~/") ||
|
|
25576
|
+
return value !== void 0 && (value === "~" || value.startsWith("~/") || isAbsolute5(value)) ? value : void 0;
|
|
25362
25577
|
},
|
|
25363
25578
|
expected: "an absolute path, or one starting with `~/`",
|
|
25364
25579
|
merge: "prioritize-local",
|
|
@@ -25409,7 +25624,7 @@ function getConfigDefinition(key, registry2 = CONFIG_SCHEMA) {
|
|
|
25409
25624
|
}
|
|
25410
25625
|
|
|
25411
25626
|
// ../configuration-core/src/config-access.ts
|
|
25412
|
-
import * as
|
|
25627
|
+
import * as path11 from "node:path";
|
|
25413
25628
|
function readScopeValue(def, scope, options) {
|
|
25414
25629
|
if (!def.scopes.includes(scope)) return void 0;
|
|
25415
25630
|
const raw = getAtPath(readConfigObject(scope, options), def.key);
|
|
@@ -25473,7 +25688,7 @@ function artifactDir(deviceId) {
|
|
|
25473
25688
|
}
|
|
25474
25689
|
function durableBaseDir() {
|
|
25475
25690
|
const projectRoot = findProjectRoot(process.cwd());
|
|
25476
|
-
return projectRoot ??
|
|
25691
|
+
return projectRoot ?? dirname8(argentHomeDir());
|
|
25477
25692
|
}
|
|
25478
25693
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
|
|
25479
25694
|
var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
|
|
@@ -25487,9 +25702,9 @@ function configuredRecordingsDir() {
|
|
|
25487
25702
|
if (typeof value !== "string") return null;
|
|
25488
25703
|
const trimmed = value.trim();
|
|
25489
25704
|
if (trimmed === "") return null;
|
|
25490
|
-
const home =
|
|
25705
|
+
const home = dirname8(argentHomeDir());
|
|
25491
25706
|
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep4}`) ? join11(home, trimmed.slice(2)) : trimmed;
|
|
25492
|
-
return
|
|
25707
|
+
return resolve7(durableBaseDir(), expanded);
|
|
25493
25708
|
}
|
|
25494
25709
|
var MAX_DURABLE_BYTES = 2 * 1024 * 1024 * 1024;
|
|
25495
25710
|
async function readCapped(res, cap) {
|
|
@@ -25522,10 +25737,10 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
25522
25737
|
const stem = filename.slice(0, filename.length - ext.length);
|
|
25523
25738
|
for (let i = 1; i <= 1e3; i++) {
|
|
25524
25739
|
const candidate = i === 1 ? filename : `${stem} (${i})${ext}`;
|
|
25525
|
-
const
|
|
25740
|
+
const path16 = join11(dir, candidate);
|
|
25526
25741
|
try {
|
|
25527
|
-
await write(
|
|
25528
|
-
return
|
|
25742
|
+
await write(path16);
|
|
25743
|
+
return path16;
|
|
25529
25744
|
} catch (err) {
|
|
25530
25745
|
if (err?.code === "EEXIST") continue;
|
|
25531
25746
|
throw err;
|
|
@@ -25536,7 +25751,7 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
25536
25751
|
function durableSaveTarget(handle) {
|
|
25537
25752
|
if (typeof handle.saveDir !== "string" || !handle.saveDir || handle.archive) return null;
|
|
25538
25753
|
const rel = normalize2(handle.saveDir);
|
|
25539
|
-
if (
|
|
25754
|
+
if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${sep4}`) || rel.split(sep4).includes("..")) {
|
|
25540
25755
|
return null;
|
|
25541
25756
|
}
|
|
25542
25757
|
if (!ALLOWED_SAVE_DIRS.has(rel)) return null;
|
|
@@ -25711,7 +25926,7 @@ function getDeviceIdFromArgs(args) {
|
|
|
25711
25926
|
import * as fs6 from "node:fs";
|
|
25712
25927
|
|
|
25713
25928
|
// ../telemetry/src/paths.ts
|
|
25714
|
-
import * as
|
|
25929
|
+
import * as path12 from "node:path";
|
|
25715
25930
|
|
|
25716
25931
|
// ../telemetry/src/events.ts
|
|
25717
25932
|
var PLATFORMS = [
|
|
@@ -26400,18 +26615,18 @@ var SESSION_ID2 = randomUUID5();
|
|
|
26400
26615
|
// ../telemetry/src/identity.ts
|
|
26401
26616
|
import * as crypto2 from "node:crypto";
|
|
26402
26617
|
import * as fs7 from "node:fs";
|
|
26403
|
-
import * as
|
|
26618
|
+
import * as path13 from "node:path";
|
|
26404
26619
|
|
|
26405
26620
|
// ../telemetry/src/fingerprint.ts
|
|
26406
26621
|
import { execFileSync as execFileSync2, spawn as spawn2 } from "node:child_process";
|
|
26407
26622
|
|
|
26408
26623
|
// ../native-devtools-ios/src/index.ts
|
|
26409
|
-
import * as
|
|
26624
|
+
import * as path14 from "node:path";
|
|
26410
26625
|
import * as fs8 from "node:fs";
|
|
26411
|
-
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ??
|
|
26412
|
-
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ??
|
|
26413
|
-
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ??
|
|
26414
|
-
var DYLIB_TVOS_DIR =
|
|
26626
|
+
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path14.join(__dirname, "..", "dylibs");
|
|
26627
|
+
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path14.join(__dirname, "..", "bin");
|
|
26628
|
+
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path14.join(DYLIB_DIR, "tcp");
|
|
26629
|
+
var DYLIB_TVOS_DIR = path14.join(DYLIB_DIR, "tvos");
|
|
26415
26630
|
|
|
26416
26631
|
// ../telemetry/src/consent.ts
|
|
26417
26632
|
import * as fs9 from "node:fs";
|
|
@@ -26712,9 +26927,9 @@ async function flowRunToMcpContent(result, ctx) {
|
|
|
26712
26927
|
}
|
|
26713
26928
|
}
|
|
26714
26929
|
for (const write of result.baselineWrites ?? []) {
|
|
26715
|
-
const { path:
|
|
26716
|
-
if (typeof
|
|
26717
|
-
blocks.push({ type: "text", text: `\u2717 baseline not written: ${
|
|
26930
|
+
const { path: path16, error: error2 } = isRecord2(write) ? write : {};
|
|
26931
|
+
if (typeof path16 === "string" && typeof error2 === "string") {
|
|
26932
|
+
blocks.push({ type: "text", text: `\u2717 baseline not written: ${path16}: ${error2}` });
|
|
26718
26933
|
}
|
|
26719
26934
|
}
|
|
26720
26935
|
if (result.ok !== void 0) {
|
|
@@ -26872,10 +27087,10 @@ function toMcpToolList(tools) {
|
|
|
26872
27087
|
|
|
26873
27088
|
// ../argent-mcp/src/installed-version.ts
|
|
26874
27089
|
import * as fs10 from "node:fs";
|
|
26875
|
-
import * as
|
|
27090
|
+
import * as path15 from "node:path";
|
|
26876
27091
|
function getInstalledVersion() {
|
|
26877
27092
|
try {
|
|
26878
|
-
const pkgPath =
|
|
27093
|
+
const pkgPath = path15.resolve(import.meta.dirname, "..", "package.json");
|
|
26879
27094
|
const pkg = JSON.parse(fs10.readFileSync(pkgPath, "utf8"));
|
|
26880
27095
|
return pkg.version ?? "unknown";
|
|
26881
27096
|
} catch {
|
|
@@ -27020,7 +27235,7 @@ async function startMcpServer(options) {
|
|
|
27020
27235
|
async function spyLog(entry) {
|
|
27021
27236
|
try {
|
|
27022
27237
|
if (!logDirReady) {
|
|
27023
|
-
await mkdir5(
|
|
27238
|
+
await mkdir5(dirname9(LOG_FILE2), { recursive: true });
|
|
27024
27239
|
logDirReady = true;
|
|
27025
27240
|
}
|
|
27026
27241
|
await appendFile(LOG_FILE2, JSON.stringify(entry) + "\n");
|