@swmansion/argent 0.29.1-next.9 → 0.30.0
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 +2 -2
- package/bin/argent-android-devtools-0.3.0.apk +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/simulator-server +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/linux/simulator-server +0 -0
- package/bin/linux-arm64/simulator-server +0 -0
- package/bin/tcp/ax-service +0 -0
- package/bin/win32/simulator-server.exe +0 -0
- package/dist/cli-cmds.mjs +1186 -865
- package/dist/cli.js +3 -2
- package/dist/cli.js.map +1 -1
- package/dist/client.js +758 -517
- package/dist/flow-script-runner.mjs +1 -1
- package/dist/installer.mjs +1025 -832
- package/dist/mcp-server.mjs +826 -579
- package/dist/tool-args.generated.d.ts +53 -39
- package/dist/tool-server.cjs +5035 -2797
- 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 +7 -7
- package/rules/argent.md +10 -10
- package/skills/{argent-create-flow → argent-create-e2e}/SKILL.md +16 -16
- package/skills/{argent-create-flow/references/flow-yaml.md → argent-create-e2e/references/e2e-yaml.md} +33 -33
- package/skills/{argent-create-flow → argent-create-e2e}/references/live-authoring.md +62 -62
- package/skills/{argent-create-flow → argent-create-e2e}/references/reliability-and-recovery.md +18 -18
- package/skills/argent-device-interact/SKILL.md +10 -8
- package/skills/argent-device-interact/references/chromium.md +1 -1
- package/skills/argent-ios-device-interact/SKILL.md +1 -1
- package/skills/argent-metro-debugger/SKILL.md +1 -1
- package/skills/argent-native-profiler/SKILL.md +1 -1
- package/skills/{argent-qa-flows → argent-qa-e2e}/SKILL.md +23 -23
- package/skills/argent-react-native-optimization/SKILL.md +2 -2
- package/skills/argent-react-native-profiler/SKILL.md +3 -3
- package/skills/argent-screen-recording/SKILL.md +1 -1
- package/skills/argent-test-ui-flow/SKILL.md +4 -4
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 = resolve10.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 resolve10(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(path17) {
|
|
3239
|
+
let input = path17;
|
|
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 [path17, query] = wsComponent.resourceName.split("?");
|
|
3492
|
+
wsComponent.path = path17 && path17 !== "/" ? path17 : 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 resolve10(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: resolve10,
|
|
3910
3910
|
resolveComponent,
|
|
3911
3911
|
equal,
|
|
3912
3912
|
serialize,
|
|
@@ -6882,12 +6882,12 @@ var require_dist = __commonJS({
|
|
|
6882
6882
|
throw new Error(`Unknown format "${name}"`);
|
|
6883
6883
|
return f;
|
|
6884
6884
|
};
|
|
6885
|
-
function addFormats(ajv, list,
|
|
6885
|
+
function addFormats(ajv, list, fs12, exportName) {
|
|
6886
6886
|
var _a3;
|
|
6887
6887
|
var _b;
|
|
6888
6888
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
6889
6889
|
for (const f of list)
|
|
6890
|
-
ajv.addFormat(f,
|
|
6890
|
+
ajv.addFormat(f, fs12[f]);
|
|
6891
6891
|
}
|
|
6892
6892
|
module.exports = exports = formatsPlugin;
|
|
6893
6893
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -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, node2, visitor,
|
|
6976
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
6975
|
+
function visit_(key, node2, visitor, path17) {
|
|
6976
|
+
const ctrl = callVisitor(key, node2, visitor, path17);
|
|
6977
6977
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
6978
|
-
replaceNode(key,
|
|
6979
|
-
return visit_(key, ctrl, visitor,
|
|
6978
|
+
replaceNode(key, path17, ctrl);
|
|
6979
|
+
return visit_(key, ctrl, visitor, path17);
|
|
6980
6980
|
}
|
|
6981
6981
|
if (typeof ctrl !== "symbol") {
|
|
6982
6982
|
if (identity.isCollection(node2)) {
|
|
6983
|
-
|
|
6983
|
+
path17 = Object.freeze(path17.concat(node2));
|
|
6984
6984
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
6985
|
-
const ci = visit_(i, node2.items[i], visitor,
|
|
6985
|
+
const ci = visit_(i, node2.items[i], visitor, path17);
|
|
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(node2)) {
|
|
6996
|
-
|
|
6997
|
-
const ck = visit_("key", node2.key, visitor,
|
|
6996
|
+
path17 = Object.freeze(path17.concat(node2));
|
|
6997
|
+
const ck = visit_("key", node2.key, visitor, path17);
|
|
6998
6998
|
if (ck === BREAK)
|
|
6999
6999
|
return BREAK;
|
|
7000
7000
|
else if (ck === REMOVE)
|
|
7001
7001
|
node2.key = null;
|
|
7002
|
-
const cv = visit_("value", node2.value, visitor,
|
|
7002
|
+
const cv = visit_("value", node2.value, visitor, path17);
|
|
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, node2, visitor,
|
|
7024
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
7023
|
+
async function visitAsync_(key, node2, visitor, path17) {
|
|
7024
|
+
const ctrl = await callVisitor(key, node2, visitor, path17);
|
|
7025
7025
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
7026
|
-
replaceNode(key,
|
|
7027
|
-
return visitAsync_(key, ctrl, visitor,
|
|
7026
|
+
replaceNode(key, path17, ctrl);
|
|
7027
|
+
return visitAsync_(key, ctrl, visitor, path17);
|
|
7028
7028
|
}
|
|
7029
7029
|
if (typeof ctrl !== "symbol") {
|
|
7030
7030
|
if (identity.isCollection(node2)) {
|
|
7031
|
-
|
|
7031
|
+
path17 = Object.freeze(path17.concat(node2));
|
|
7032
7032
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
7033
|
-
const ci = await visitAsync_(i, node2.items[i], visitor,
|
|
7033
|
+
const ci = await visitAsync_(i, node2.items[i], visitor, path17);
|
|
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(node2)) {
|
|
7044
|
-
|
|
7045
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
7044
|
+
path17 = Object.freeze(path17.concat(node2));
|
|
7045
|
+
const ck = await visitAsync_("key", node2.key, visitor, path17);
|
|
7046
7046
|
if (ck === BREAK)
|
|
7047
7047
|
return BREAK;
|
|
7048
7048
|
else if (ck === REMOVE)
|
|
7049
7049
|
node2.key = null;
|
|
7050
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
7050
|
+
const cv = await visitAsync_("value", node2.value, visitor, path17);
|
|
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, node2, visitor,
|
|
7077
|
+
function callVisitor(key, node2, visitor, path17) {
|
|
7078
7078
|
if (typeof visitor === "function")
|
|
7079
|
-
return visitor(key, node2,
|
|
7079
|
+
return visitor(key, node2, path17);
|
|
7080
7080
|
if (identity.isMap(node2))
|
|
7081
|
-
return visitor.Map?.(key, node2,
|
|
7081
|
+
return visitor.Map?.(key, node2, path17);
|
|
7082
7082
|
if (identity.isSeq(node2))
|
|
7083
|
-
return visitor.Seq?.(key, node2,
|
|
7083
|
+
return visitor.Seq?.(key, node2, path17);
|
|
7084
7084
|
if (identity.isPair(node2))
|
|
7085
|
-
return visitor.Pair?.(key, node2,
|
|
7085
|
+
return visitor.Pair?.(key, node2, path17);
|
|
7086
7086
|
if (identity.isScalar(node2))
|
|
7087
|
-
return visitor.Scalar?.(key, node2,
|
|
7087
|
+
return visitor.Scalar?.(key, node2, path17);
|
|
7088
7088
|
if (identity.isAlias(node2))
|
|
7089
|
-
return visitor.Alias?.(key, node2,
|
|
7089
|
+
return visitor.Alias?.(key, node2, path17);
|
|
7090
7090
|
return void 0;
|
|
7091
7091
|
}
|
|
7092
|
-
function replaceNode(key,
|
|
7093
|
-
const parent =
|
|
7092
|
+
function replaceNode(key, path17, node2) {
|
|
7093
|
+
const parent = path17[path17.length - 1];
|
|
7094
7094
|
if (identity.isCollection(parent)) {
|
|
7095
7095
|
parent.items[key] = node2;
|
|
7096
7096
|
} else if (identity.isPair(parent)) {
|
|
@@ -7702,10 +7702,10 @@ var require_Collection = __commonJS({
|
|
|
7702
7702
|
var createNode = require_createNode();
|
|
7703
7703
|
var identity = require_identity();
|
|
7704
7704
|
var Node = require_Node();
|
|
7705
|
-
function collectionFromPath(schema,
|
|
7705
|
+
function collectionFromPath(schema, path17, value) {
|
|
7706
7706
|
let v = value;
|
|
7707
|
-
for (let i =
|
|
7708
|
-
const k =
|
|
7707
|
+
for (let i = path17.length - 1; i >= 0; --i) {
|
|
7708
|
+
const k = path17[i];
|
|
7709
7709
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
7710
7710
|
const a = [];
|
|
7711
7711
|
a[k] = v;
|
|
@@ -7724,7 +7724,7 @@ var require_Collection = __commonJS({
|
|
|
7724
7724
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
7725
7725
|
});
|
|
7726
7726
|
}
|
|
7727
|
-
var isEmptyPath = (
|
|
7727
|
+
var isEmptyPath = (path17) => path17 == null || typeof path17 === "object" && !!path17[Symbol.iterator]().next().done;
|
|
7728
7728
|
var Collection = class extends Node.NodeBase {
|
|
7729
7729
|
constructor(type, schema) {
|
|
7730
7730
|
super(type);
|
|
@@ -7754,11 +7754,11 @@ var require_Collection = __commonJS({
|
|
|
7754
7754
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
7755
7755
|
* that already exists in the map.
|
|
7756
7756
|
*/
|
|
7757
|
-
addIn(
|
|
7758
|
-
if (isEmptyPath(
|
|
7757
|
+
addIn(path17, value) {
|
|
7758
|
+
if (isEmptyPath(path17))
|
|
7759
7759
|
this.add(value);
|
|
7760
7760
|
else {
|
|
7761
|
-
const [key, ...rest] =
|
|
7761
|
+
const [key, ...rest] = path17;
|
|
7762
7762
|
const node2 = this.get(key, true);
|
|
7763
7763
|
if (identity.isCollection(node2))
|
|
7764
7764
|
node2.addIn(rest, value);
|
|
@@ -7772,8 +7772,8 @@ var require_Collection = __commonJS({
|
|
|
7772
7772
|
* Removes a value from the collection.
|
|
7773
7773
|
* @returns `true` if the item was found and removed.
|
|
7774
7774
|
*/
|
|
7775
|
-
deleteIn(
|
|
7776
|
-
const [key, ...rest] =
|
|
7775
|
+
deleteIn(path17) {
|
|
7776
|
+
const [key, ...rest] = path17;
|
|
7777
7777
|
if (rest.length === 0)
|
|
7778
7778
|
return this.delete(key);
|
|
7779
7779
|
const node2 = this.get(key, true);
|
|
@@ -7787,8 +7787,8 @@ var require_Collection = __commonJS({
|
|
|
7787
7787
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
7788
7788
|
* `true` (collections are always returned intact).
|
|
7789
7789
|
*/
|
|
7790
|
-
getIn(
|
|
7791
|
-
const [key, ...rest] =
|
|
7790
|
+
getIn(path17, keepScalar) {
|
|
7791
|
+
const [key, ...rest] = path17;
|
|
7792
7792
|
const node2 = this.get(key, true);
|
|
7793
7793
|
if (rest.length === 0)
|
|
7794
7794
|
return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
|
|
@@ -7806,8 +7806,8 @@ var require_Collection = __commonJS({
|
|
|
7806
7806
|
/**
|
|
7807
7807
|
* Checks if the collection includes a value with the key `key`.
|
|
7808
7808
|
*/
|
|
7809
|
-
hasIn(
|
|
7810
|
-
const [key, ...rest] =
|
|
7809
|
+
hasIn(path17) {
|
|
7810
|
+
const [key, ...rest] = path17;
|
|
7811
7811
|
if (rest.length === 0)
|
|
7812
7812
|
return this.has(key);
|
|
7813
7813
|
const node2 = this.get(key, true);
|
|
@@ -7817,8 +7817,8 @@ var require_Collection = __commonJS({
|
|
|
7817
7817
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
7818
7818
|
* boolean to add/remove the item from the set.
|
|
7819
7819
|
*/
|
|
7820
|
-
setIn(
|
|
7821
|
-
const [key, ...rest] =
|
|
7820
|
+
setIn(path17, value) {
|
|
7821
|
+
const [key, ...rest] = path17;
|
|
7822
7822
|
if (rest.length === 0) {
|
|
7823
7823
|
this.set(key, value);
|
|
7824
7824
|
} else {
|
|
@@ -10333,9 +10333,9 @@ var require_Document = __commonJS({
|
|
|
10333
10333
|
this.contents.add(value);
|
|
10334
10334
|
}
|
|
10335
10335
|
/** Adds a value to the document. */
|
|
10336
|
-
addIn(
|
|
10336
|
+
addIn(path17, value) {
|
|
10337
10337
|
if (assertCollection(this.contents))
|
|
10338
|
-
this.contents.addIn(
|
|
10338
|
+
this.contents.addIn(path17, value);
|
|
10339
10339
|
}
|
|
10340
10340
|
/**
|
|
10341
10341
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -10410,14 +10410,14 @@ var require_Document = __commonJS({
|
|
|
10410
10410
|
* Removes a value from the document.
|
|
10411
10411
|
* @returns `true` if the item was found and removed.
|
|
10412
10412
|
*/
|
|
10413
|
-
deleteIn(
|
|
10414
|
-
if (Collection.isEmptyPath(
|
|
10413
|
+
deleteIn(path17) {
|
|
10414
|
+
if (Collection.isEmptyPath(path17)) {
|
|
10415
10415
|
if (this.contents == null)
|
|
10416
10416
|
return false;
|
|
10417
10417
|
this.contents = null;
|
|
10418
10418
|
return true;
|
|
10419
10419
|
}
|
|
10420
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
10420
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path17) : false;
|
|
10421
10421
|
}
|
|
10422
10422
|
/**
|
|
10423
10423
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -10432,10 +10432,10 @@ var require_Document = __commonJS({
|
|
|
10432
10432
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
10433
10433
|
* `true` (collections are always returned intact).
|
|
10434
10434
|
*/
|
|
10435
|
-
getIn(
|
|
10436
|
-
if (Collection.isEmptyPath(
|
|
10435
|
+
getIn(path17, keepScalar) {
|
|
10436
|
+
if (Collection.isEmptyPath(path17))
|
|
10437
10437
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
10438
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
10438
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path17, keepScalar) : void 0;
|
|
10439
10439
|
}
|
|
10440
10440
|
/**
|
|
10441
10441
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -10446,10 +10446,10 @@ var require_Document = __commonJS({
|
|
|
10446
10446
|
/**
|
|
10447
10447
|
* Checks if the document includes a value at `path`.
|
|
10448
10448
|
*/
|
|
10449
|
-
hasIn(
|
|
10450
|
-
if (Collection.isEmptyPath(
|
|
10449
|
+
hasIn(path17) {
|
|
10450
|
+
if (Collection.isEmptyPath(path17))
|
|
10451
10451
|
return this.contents !== void 0;
|
|
10452
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
10452
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path17) : false;
|
|
10453
10453
|
}
|
|
10454
10454
|
/**
|
|
10455
10455
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -10466,13 +10466,13 @@ var require_Document = __commonJS({
|
|
|
10466
10466
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
10467
10467
|
* boolean to add/remove the item from the set.
|
|
10468
10468
|
*/
|
|
10469
|
-
setIn(
|
|
10470
|
-
if (Collection.isEmptyPath(
|
|
10469
|
+
setIn(path17, value) {
|
|
10470
|
+
if (Collection.isEmptyPath(path17)) {
|
|
10471
10471
|
this.contents = value;
|
|
10472
10472
|
} else if (this.contents == null) {
|
|
10473
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
10473
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path17), value);
|
|
10474
10474
|
} else if (assertCollection(this.contents)) {
|
|
10475
|
-
this.contents.setIn(
|
|
10475
|
+
this.contents.setIn(path17, value);
|
|
10476
10476
|
}
|
|
10477
10477
|
}
|
|
10478
10478
|
/**
|
|
@@ -12433,9 +12433,9 @@ var require_cst_visit = __commonJS({
|
|
|
12433
12433
|
visit.BREAK = BREAK;
|
|
12434
12434
|
visit.SKIP = SKIP;
|
|
12435
12435
|
visit.REMOVE = REMOVE;
|
|
12436
|
-
visit.itemAtPath = (cst,
|
|
12436
|
+
visit.itemAtPath = (cst, path17) => {
|
|
12437
12437
|
let item = cst;
|
|
12438
|
-
for (const [field, index] of
|
|
12438
|
+
for (const [field, index] of path17) {
|
|
12439
12439
|
const tok = item?.[field];
|
|
12440
12440
|
if (tok && "items" in tok) {
|
|
12441
12441
|
item = tok.items[index];
|
|
@@ -12444,23 +12444,23 @@ var require_cst_visit = __commonJS({
|
|
|
12444
12444
|
}
|
|
12445
12445
|
return item;
|
|
12446
12446
|
};
|
|
12447
|
-
visit.parentCollection = (cst,
|
|
12448
|
-
const parent = visit.itemAtPath(cst,
|
|
12449
|
-
const field =
|
|
12447
|
+
visit.parentCollection = (cst, path17) => {
|
|
12448
|
+
const parent = visit.itemAtPath(cst, path17.slice(0, -1));
|
|
12449
|
+
const field = path17[path17.length - 1][0];
|
|
12450
12450
|
const coll = parent?.[field];
|
|
12451
12451
|
if (coll && "items" in coll)
|
|
12452
12452
|
return coll;
|
|
12453
12453
|
throw new Error("Parent collection not found");
|
|
12454
12454
|
};
|
|
12455
|
-
function _visit(
|
|
12456
|
-
let ctrl = visitor(item,
|
|
12455
|
+
function _visit(path17, item, visitor) {
|
|
12456
|
+
let ctrl = visitor(item, path17);
|
|
12457
12457
|
if (typeof ctrl === "symbol")
|
|
12458
12458
|
return ctrl;
|
|
12459
12459
|
for (const field of ["key", "value"]) {
|
|
12460
12460
|
const token = item[field];
|
|
12461
12461
|
if (token && "items" in token) {
|
|
12462
12462
|
for (let i = 0; i < token.items.length; ++i) {
|
|
12463
|
-
const ci = _visit(Object.freeze(
|
|
12463
|
+
const ci = _visit(Object.freeze(path17.concat([[field, i]])), token.items[i], visitor);
|
|
12464
12464
|
if (typeof ci === "number")
|
|
12465
12465
|
i = ci - 1;
|
|
12466
12466
|
else if (ci === BREAK)
|
|
@@ -12471,10 +12471,10 @@ var require_cst_visit = __commonJS({
|
|
|
12471
12471
|
}
|
|
12472
12472
|
}
|
|
12473
12473
|
if (typeof ctrl === "function" && field === "key")
|
|
12474
|
-
ctrl = ctrl(item,
|
|
12474
|
+
ctrl = ctrl(item, path17);
|
|
12475
12475
|
}
|
|
12476
12476
|
}
|
|
12477
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
12477
|
+
return typeof ctrl === "function" ? ctrl(item, path17) : ctrl;
|
|
12478
12478
|
}
|
|
12479
12479
|
exports.visit = visit;
|
|
12480
12480
|
}
|
|
@@ -13776,14 +13776,14 @@ var require_parser = __commonJS({
|
|
|
13776
13776
|
case "scalar":
|
|
13777
13777
|
case "single-quoted-scalar":
|
|
13778
13778
|
case "double-quoted-scalar": {
|
|
13779
|
-
const
|
|
13779
|
+
const fs12 = this.flowScalar(this.type);
|
|
13780
13780
|
if (atNextItem || it.value) {
|
|
13781
|
-
map.items.push({ start, key:
|
|
13781
|
+
map.items.push({ start, key: fs12, sep: [] });
|
|
13782
13782
|
this.onKeyLine = true;
|
|
13783
13783
|
} else if (it.sep) {
|
|
13784
|
-
this.stack.push(
|
|
13784
|
+
this.stack.push(fs12);
|
|
13785
13785
|
} else {
|
|
13786
|
-
Object.assign(it, { key:
|
|
13786
|
+
Object.assign(it, { key: fs12, sep: [] });
|
|
13787
13787
|
this.onKeyLine = true;
|
|
13788
13788
|
}
|
|
13789
13789
|
return;
|
|
@@ -13911,13 +13911,13 @@ var require_parser = __commonJS({
|
|
|
13911
13911
|
case "scalar":
|
|
13912
13912
|
case "single-quoted-scalar":
|
|
13913
13913
|
case "double-quoted-scalar": {
|
|
13914
|
-
const
|
|
13914
|
+
const fs12 = this.flowScalar(this.type);
|
|
13915
13915
|
if (!it || it.value)
|
|
13916
|
-
fc.items.push({ start: [], key:
|
|
13916
|
+
fc.items.push({ start: [], key: fs12, sep: [] });
|
|
13917
13917
|
else if (it.sep)
|
|
13918
|
-
this.stack.push(
|
|
13918
|
+
this.stack.push(fs12);
|
|
13919
13919
|
else
|
|
13920
|
-
Object.assign(it, { key:
|
|
13920
|
+
Object.assign(it, { key: fs12, sep: [] });
|
|
13921
13921
|
return;
|
|
13922
13922
|
}
|
|
13923
13923
|
case "flow-map-end":
|
|
@@ -14225,328 +14225,401 @@ var require_dist2 = __commonJS({
|
|
|
14225
14225
|
}
|
|
14226
14226
|
});
|
|
14227
14227
|
|
|
14228
|
-
// ../../node_modules/dotenv/
|
|
14229
|
-
var
|
|
14230
|
-
"../../node_modules/dotenv/
|
|
14231
|
-
var
|
|
14232
|
-
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
"\u25C8 encrypted .env [www.dotenvx.com]",
|
|
14237
|
-
"\u25C8 secrets for agents [www.dotenvx.com]",
|
|
14238
|
-
"\u2301 auth for agents [www.vestauth.com]",
|
|
14239
|
-
"\u2318 custom filepath { path: '/custom/path/.env' }",
|
|
14240
|
-
"\u2318 enable debugging { debug: true }",
|
|
14241
|
-
"\u2318 override existing { override: true }",
|
|
14242
|
-
"\u2318 suppress logs { quiet: true }",
|
|
14243
|
-
"\u2318 multiple files { path: ['.env.local', '.env'] }"
|
|
14244
|
-
];
|
|
14245
|
-
function _getRandomTip() {
|
|
14246
|
-
return TIPS[Math.floor(Math.random() * TIPS.length)];
|
|
14247
|
-
}
|
|
14248
|
-
function parseBoolean(value) {
|
|
14249
|
-
if (typeof value === "string") {
|
|
14250
|
-
return !["false", "0", "no", "off", ""].includes(value.toLowerCase());
|
|
14251
|
-
}
|
|
14252
|
-
return Boolean(value);
|
|
14253
|
-
}
|
|
14254
|
-
function supportsAnsi() {
|
|
14255
|
-
return process.stdout.isTTY;
|
|
14256
|
-
}
|
|
14257
|
-
function dim(text) {
|
|
14258
|
-
return supportsAnsi() ? `\x1B[2m${text}\x1B[0m` : text;
|
|
14259
|
-
}
|
|
14260
|
-
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
14261
|
-
function parse3(src) {
|
|
14262
|
-
const obj = {};
|
|
14263
|
-
let lines = src.toString();
|
|
14264
|
-
lines = lines.replace(/\r\n?/mg, "\n");
|
|
14265
|
-
let match;
|
|
14266
|
-
while ((match = LINE.exec(lines)) != null) {
|
|
14267
|
-
const key = match[1];
|
|
14268
|
-
let value = match[2] || "";
|
|
14269
|
-
value = value.trim();
|
|
14270
|
-
const maybeQuote = value[0];
|
|
14271
|
-
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
|
|
14272
|
-
if (maybeQuote === '"') {
|
|
14273
|
-
value = value.replace(/\\n/g, "\n");
|
|
14274
|
-
value = value.replace(/\\r/g, "\r");
|
|
14275
|
-
}
|
|
14276
|
-
obj[key] = value;
|
|
14277
|
-
}
|
|
14278
|
-
return obj;
|
|
14279
|
-
}
|
|
14280
|
-
function _parseVault(options) {
|
|
14281
|
-
options = options || {};
|
|
14282
|
-
const vaultPath = _vaultPath(options);
|
|
14283
|
-
options.path = vaultPath;
|
|
14284
|
-
const result = DotenvModule.configDotenv(options);
|
|
14285
|
-
if (!result.parsed) {
|
|
14286
|
-
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
14287
|
-
err.code = "MISSING_DATA";
|
|
14288
|
-
throw err;
|
|
14228
|
+
// ../../node_modules/dotenv/dist/index.cjs
|
|
14229
|
+
var require_dist3 = __commonJS({
|
|
14230
|
+
"../../node_modules/dotenv/dist/index.cjs"(exports, module) {
|
|
14231
|
+
var j = (e, n) => () => {
|
|
14232
|
+
try {
|
|
14233
|
+
return n || e((n = { exports: {} }).exports, n), n.exports;
|
|
14234
|
+
} catch (t) {
|
|
14235
|
+
throw n = 0, t;
|
|
14289
14236
|
}
|
|
14290
|
-
|
|
14291
|
-
|
|
14292
|
-
|
|
14293
|
-
|
|
14294
|
-
|
|
14295
|
-
|
|
14296
|
-
|
|
14297
|
-
|
|
14298
|
-
|
|
14299
|
-
|
|
14300
|
-
if (i + 1 >= length) {
|
|
14301
|
-
throw error2;
|
|
14302
|
-
}
|
|
14237
|
+
};
|
|
14238
|
+
var k = j((xe, U) => {
|
|
14239
|
+
function G(e) {
|
|
14240
|
+
return typeof e == "string" ? !["false", "0", "no", "off", ""].includes(e.toLowerCase()) : !!e;
|
|
14241
|
+
}
|
|
14242
|
+
function Y(e = process.env) {
|
|
14243
|
+
let n = {};
|
|
14244
|
+
for (let t of ["ENCODING", "PATH", "QUIET", "DEBUG", "OVERRIDE", "FAST"]) {
|
|
14245
|
+
let o = e[`DOTENV_${t}`] != null ? e[`DOTENV_${t}`] : e[`DOTENV_CONFIG_${t}`];
|
|
14246
|
+
o != null && (n[t.toLowerCase()] = t === "ENCODING" || t === "PATH" ? o : G(o));
|
|
14303
14247
|
}
|
|
14248
|
+
return n;
|
|
14304
14249
|
}
|
|
14305
|
-
|
|
14306
|
-
}
|
|
14307
|
-
|
|
14308
|
-
|
|
14309
|
-
|
|
14310
|
-
|
|
14311
|
-
|
|
14312
|
-
|
|
14313
|
-
|
|
14314
|
-
|
|
14315
|
-
|
|
14316
|
-
|
|
14317
|
-
|
|
14318
|
-
|
|
14250
|
+
U.exports = { parseBoolean: G, optionsFromEnv: Y };
|
|
14251
|
+
});
|
|
14252
|
+
var N = j((ye, x) => {
|
|
14253
|
+
var z = __require("fs"), I = __require("path"), Z = __require("os"), { URL: ee, fileURLToPath: te } = __require("url"), { parseBoolean: $, optionsFromEnv: B } = k(), re = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg, b = new Uint8Array(256);
|
|
14254
|
+
for (let e = 48; e <= 57; e++) b[e] = 1;
|
|
14255
|
+
for (let e = 65; e <= 90; e++) b[e] = 1;
|
|
14256
|
+
for (let e = 97; e <= 122; e++) b[e] = 1;
|
|
14257
|
+
b[45] = 1;
|
|
14258
|
+
b[46] = 1;
|
|
14259
|
+
b[95] = 1;
|
|
14260
|
+
function ne(e) {
|
|
14261
|
+
let n = {}, t = e.toString();
|
|
14262
|
+
t = t.replace(/\r\n?/mg, `
|
|
14263
|
+
`);
|
|
14264
|
+
let o;
|
|
14265
|
+
for (; (o = re.exec(t)) != null; ) {
|
|
14266
|
+
let r = o[1], s = o[2] || "";
|
|
14267
|
+
s = s.trim();
|
|
14268
|
+
let i = s[0];
|
|
14269
|
+
s = s.replace(/^(['"`])([\s\S]*)\1$/mg, "$2"), i === '"' && (s = s.replace(/\\n/g, `
|
|
14270
|
+
`), s = s.replace(/\\r/g, "\r")), n[r] = s;
|
|
14271
|
+
}
|
|
14272
|
+
return n;
|
|
14319
14273
|
}
|
|
14320
|
-
|
|
14321
|
-
return
|
|
14274
|
+
function w(e) {
|
|
14275
|
+
return e <= 32 ? e === 32 || e >= 9 && e <= 13 : e >= 160 && (e === 160 || e === 5760 || e >= 8192 && e <= 8202 || e === 8232 || e === 8233 || e === 8239 || e === 8287 || e === 12288 || e === 65279);
|
|
14322
14276
|
}
|
|
14323
|
-
|
|
14324
|
-
|
|
14325
|
-
|
|
14326
|
-
|
|
14327
|
-
|
|
14328
|
-
|
|
14329
|
-
|
|
14330
|
-
|
|
14331
|
-
|
|
14332
|
-
|
|
14333
|
-
|
|
14277
|
+
function q(e) {
|
|
14278
|
+
return e === 10 || e === 8232 || e === 8233;
|
|
14279
|
+
}
|
|
14280
|
+
function oe(e) {
|
|
14281
|
+
let n = {}, t = typeof e == "string" ? e : e.toString();
|
|
14282
|
+
t.indexOf("\r") !== -1 && (t = t.replace(/\r\n?/g, `
|
|
14283
|
+
`));
|
|
14284
|
+
let o = t.length, r = 0;
|
|
14285
|
+
for (; r < o; ) {
|
|
14286
|
+
let s = t.charCodeAt(r);
|
|
14287
|
+
for (; r < o && w(s); ) r++, s = t.charCodeAt(r);
|
|
14288
|
+
if (r >= o) break;
|
|
14289
|
+
if (s === 35) {
|
|
14290
|
+
for (; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
14291
|
+
continue;
|
|
14292
|
+
}
|
|
14293
|
+
let i = -1;
|
|
14294
|
+
if (s === 101 && r + 6 < o && t.charCodeAt(r + 1) === 120 && t.charCodeAt(r + 2) === 112 && t.charCodeAt(r + 3) === 111 && t.charCodeAt(r + 4) === 114 && t.charCodeAt(r + 5) === 116) {
|
|
14295
|
+
let v = t.charCodeAt(r + 6);
|
|
14296
|
+
if (w(v)) {
|
|
14297
|
+
let u = r + 7;
|
|
14298
|
+
for (; u < o && w(t.charCodeAt(u)); ) u++;
|
|
14299
|
+
b[t.charCodeAt(u)] && (i = r + 6, r = u);
|
|
14300
|
+
} else s = t.charCodeAt(r);
|
|
14301
|
+
}
|
|
14302
|
+
let l = r, d = 0;
|
|
14303
|
+
for (; r < o && (d = t.charCodeAt(r), b[d]); ) r++;
|
|
14304
|
+
if (r === l) {
|
|
14305
|
+
for (; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
14306
|
+
continue;
|
|
14307
|
+
}
|
|
14308
|
+
let h = t.slice(l, r), f = r;
|
|
14309
|
+
if (r >= o && (d = 0), w(d)) do
|
|
14310
|
+
r++, d = r < o ? t.charCodeAt(r) : 0;
|
|
14311
|
+
while (w(d));
|
|
14312
|
+
if (d === 61) r++;
|
|
14313
|
+
else if (d === 58 && r === f && r + 1 < o && w(t.charCodeAt(r + 1))) r += 2;
|
|
14314
|
+
else {
|
|
14315
|
+
for (r = i === -1 ? f : i; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
14316
|
+
continue;
|
|
14317
|
+
}
|
|
14318
|
+
let c = r, a = r;
|
|
14319
|
+
for (; a < o && w(t.charCodeAt(a)); ) a++;
|
|
14320
|
+
let g = t.charCodeAt(a), p, y = false;
|
|
14321
|
+
if (g === 39 || g === 34 || g === 96) {
|
|
14322
|
+
let v = t[a], u = t.indexOf(v, a + 1), m = -1, C = -1;
|
|
14323
|
+
for (; u !== -1; ) {
|
|
14324
|
+
let O = t.charCodeAt(u - 1) === 92, E = u + 1;
|
|
14325
|
+
for (; E < o && !q(t.charCodeAt(E)) && w(t.charCodeAt(E)); ) E++;
|
|
14326
|
+
if ((E === o || q(t.charCodeAt(E)) || t.charCodeAt(E) === 35) && (m = u, C = E), !O) break;
|
|
14327
|
+
u = t.indexOf(v, u + 1);
|
|
14328
|
+
}
|
|
14329
|
+
if (m !== -1) {
|
|
14330
|
+
if (p = t.slice(a + 1, m), r = C, t.charCodeAt(r) === 35) for (; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
14331
|
+
y = true;
|
|
14332
|
+
}
|
|
14333
|
+
}
|
|
14334
|
+
if (!y) {
|
|
14335
|
+
let v = t.indexOf(`
|
|
14336
|
+
`, c);
|
|
14337
|
+
v === -1 && (v = o);
|
|
14338
|
+
let u;
|
|
14339
|
+
if (o < 4096) u = t.indexOf("#", c), (u === -1 || u > v) && (u = v);
|
|
14340
|
+
else for (u = c; u < v && t.charCodeAt(u) !== 35; ) u++;
|
|
14341
|
+
let m = c, C = u;
|
|
14342
|
+
for (; m < C && w(t.charCodeAt(m)); ) m++;
|
|
14343
|
+
for (; C > m && w(t.charCodeAt(C - 1)); ) C--;
|
|
14344
|
+
let O = t.charCodeAt(m);
|
|
14345
|
+
if (p = t.slice(m, C), p.includes("\u2028") || p.includes("\u2029") ? p = p.replace(/^(['"`])([\s\S]*)\1$/mg, "$2") : C - m >= 2 && (O === 39 || O === 34 || O === 96) && t.charCodeAt(C - 1) === O && (p = t.slice(m + 1, C - 1)), r = u, u < v) for (; r < o && !q(t.charCodeAt(r)); ) r++;
|
|
14346
|
+
}
|
|
14347
|
+
g === 34 && (y || a < r) && p.indexOf("\\") !== -1 && (p = p.replace(/\\n/g, `
|
|
14348
|
+
`).replace(/\\r/g, "\r")), n[h] = p;
|
|
14334
14349
|
}
|
|
14335
|
-
|
|
14350
|
+
return n;
|
|
14336
14351
|
}
|
|
14337
|
-
|
|
14338
|
-
|
|
14339
|
-
const err = new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
14340
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
14341
|
-
throw err;
|
|
14352
|
+
function se(e, n) {
|
|
14353
|
+
return n && $(n.fast) ? oe(e) : ne(e);
|
|
14342
14354
|
}
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
14346
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
14347
|
-
throw err;
|
|
14355
|
+
function T(e) {
|
|
14356
|
+
console.log(`\u2506 ${e}`);
|
|
14348
14357
|
}
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
if (!ciphertext) {
|
|
14352
|
-
const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
|
|
14353
|
-
err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
|
|
14354
|
-
throw err;
|
|
14358
|
+
function ie(e) {
|
|
14359
|
+
console.error(`\u25C7 ${e}`);
|
|
14355
14360
|
}
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14361
|
+
function V(e) {
|
|
14362
|
+
return e[0] === "~" ? I.join(Z.homedir(), e.slice(1)) : e;
|
|
14363
|
+
}
|
|
14364
|
+
function ce(e = {}) {
|
|
14365
|
+
let n = { ...e };
|
|
14366
|
+
for (let t of Object.keys(n)) n[t] === void 0 && delete n[t];
|
|
14367
|
+
return { ...B(), ...n };
|
|
14368
|
+
}
|
|
14369
|
+
function ae(e) {
|
|
14370
|
+
e = ce(e);
|
|
14371
|
+
let n = I.resolve(process.cwd(), ".env"), t = "utf8", o = process.env;
|
|
14372
|
+
e && e.processEnv != null && (o = e.processEnv);
|
|
14373
|
+
let r = $(e && e.debug);
|
|
14374
|
+
e && e.encoding ? t = e.encoding : r && T("no encoding is specified (UTF-8 is used by default)");
|
|
14375
|
+
let s = [n];
|
|
14376
|
+
if (e && e.path) if (!Array.isArray(e.path)) s = [V(e.path)];
|
|
14377
|
+
else {
|
|
14378
|
+
s = [];
|
|
14379
|
+
for (let c of e.path) s.push(V(c));
|
|
14380
|
+
}
|
|
14381
|
+
let i, l = {}, d = { fast: e.fast };
|
|
14382
|
+
for (let c of s) try {
|
|
14383
|
+
let a = A.parse(z.readFileSync(c, { encoding: t }), d);
|
|
14384
|
+
A.populate(l, a, e);
|
|
14385
|
+
} catch (a) {
|
|
14386
|
+
r && T(`failed to load ${c} ${a.message}`), i = a;
|
|
14387
|
+
}
|
|
14388
|
+
let h = A.populate(o, l, e), f = $(Object.prototype.hasOwnProperty.call(e, "quiet") ? e.quiet : B(o).quiet);
|
|
14389
|
+
if (r || !f) {
|
|
14390
|
+
let c = Object.keys(h).length, a = [];
|
|
14391
|
+
for (let g of s) try {
|
|
14392
|
+
let p = I.relative(process.cwd(), g instanceof ee ? te(g) : g);
|
|
14393
|
+
a.push(p);
|
|
14394
|
+
} catch (p) {
|
|
14395
|
+
r && T(`failed to load ${g} ${p.message}`), i = p;
|
|
14366
14396
|
}
|
|
14367
|
-
|
|
14368
|
-
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
14397
|
+
ie(`injected env (${c}) from ${a.join(",")}`);
|
|
14369
14398
|
}
|
|
14370
|
-
|
|
14371
|
-
possibleVaultPath = path16.resolve(process.cwd(), ".env.vault");
|
|
14399
|
+
return i ? { parsed: l, error: i } : { parsed: l };
|
|
14372
14400
|
}
|
|
14373
|
-
|
|
14374
|
-
return
|
|
14401
|
+
function le(e) {
|
|
14402
|
+
return A.configDotenv(e);
|
|
14375
14403
|
}
|
|
14376
|
-
|
|
14377
|
-
|
|
14378
|
-
|
|
14379
|
-
|
|
14380
|
-
|
|
14381
|
-
function _configVault(options) {
|
|
14382
|
-
const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
14383
|
-
const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
|
|
14384
|
-
if (debug || !quiet) {
|
|
14385
|
-
_log("loading env from encrypted .env.vault");
|
|
14386
|
-
}
|
|
14387
|
-
const parsed = DotenvModule._parseVault(options);
|
|
14388
|
-
let processEnv = process.env;
|
|
14389
|
-
if (options && options.processEnv != null) {
|
|
14390
|
-
processEnv = options.processEnv;
|
|
14391
|
-
}
|
|
14392
|
-
DotenvModule.populate(processEnv, parsed, options);
|
|
14393
|
-
return { parsed };
|
|
14394
|
-
}
|
|
14395
|
-
function configDotenv(options) {
|
|
14396
|
-
const dotenvPath = path16.resolve(process.cwd(), ".env");
|
|
14397
|
-
let encoding = "utf8";
|
|
14398
|
-
let processEnv = process.env;
|
|
14399
|
-
if (options && options.processEnv != null) {
|
|
14400
|
-
processEnv = options.processEnv;
|
|
14401
|
-
}
|
|
14402
|
-
let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
14403
|
-
let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
|
|
14404
|
-
if (options && options.encoding) {
|
|
14405
|
-
encoding = options.encoding;
|
|
14406
|
-
} else {
|
|
14407
|
-
if (debug) {
|
|
14408
|
-
_debug("no encoding is specified (UTF-8 is used by default)");
|
|
14404
|
+
function fe(e, n, t = {}) {
|
|
14405
|
+
let o = $(t && t.debug), r = $(t && t.override), s = {};
|
|
14406
|
+
if (e === null || typeof e != "object" || n === null || typeof n != "object") {
|
|
14407
|
+
let i = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
14408
|
+
throw i.code = "OBJECT_REQUIRED", i;
|
|
14409
14409
|
}
|
|
14410
|
+
for (let i of Object.keys(n)) Object.prototype.hasOwnProperty.call(e, i) ? (r === true && (e[i] = n[i], s[i] = n[i]), o && T(r === true ? `"${i}" is already defined and WAS overwritten` : `"${i}" is already defined and was NOT overwritten`)) : (e[i] = n[i], s[i] = n[i]);
|
|
14411
|
+
return s;
|
|
14410
14412
|
}
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
|
|
14417
|
-
|
|
14418
|
-
|
|
14413
|
+
var A = { configDotenv: ae, config: le, parse: se, populate: fe };
|
|
14414
|
+
x.exports.configDotenv = A.configDotenv;
|
|
14415
|
+
x.exports.config = A.config;
|
|
14416
|
+
x.exports.parse = A.parse;
|
|
14417
|
+
x.exports.populate = A.populate;
|
|
14418
|
+
x.exports = A;
|
|
14419
|
+
});
|
|
14420
|
+
var M = j((Te, W) => {
|
|
14421
|
+
var _ = __require("child_process"), ue = __require("fs"), L = __require("path");
|
|
14422
|
+
function de(e) {
|
|
14423
|
+
let n = ['"'], t = 0;
|
|
14424
|
+
for (let o of e) {
|
|
14425
|
+
if (o === "\\") {
|
|
14426
|
+
t++;
|
|
14427
|
+
continue;
|
|
14419
14428
|
}
|
|
14429
|
+
o === '"' ? n.push("\\".repeat(t * 2 + 1), '"') : n.push("\\".repeat(t), o), t = 0;
|
|
14420
14430
|
}
|
|
14431
|
+
return n.push("\\".repeat(t * 2), '"'), n.join("");
|
|
14421
14432
|
}
|
|
14422
|
-
|
|
14423
|
-
|
|
14424
|
-
|
|
14425
|
-
|
|
14426
|
-
|
|
14427
|
-
|
|
14428
|
-
} catch (e) {
|
|
14429
|
-
if (debug) {
|
|
14430
|
-
_debug(`failed to load ${path17} ${e.message}`);
|
|
14433
|
+
function H(e, n = 1) {
|
|
14434
|
+
for (let t = 0; t < n; t++) {
|
|
14435
|
+
let o = [];
|
|
14436
|
+
for (let r of e) {
|
|
14437
|
+
let s = r.charCodeAt(0), i = s >= 48 && s <= 57 || s >= 65 && s <= 90 || s >= 97 && s <= 122, l = "\\/:._-".includes(r);
|
|
14438
|
+
!i && !l && s < 128 && o.push("^"), o.push(r);
|
|
14431
14439
|
}
|
|
14432
|
-
|
|
14440
|
+
e = o.join("");
|
|
14433
14441
|
}
|
|
14442
|
+
return e;
|
|
14443
|
+
}
|
|
14444
|
+
function P(e, n) {
|
|
14445
|
+
let t = Object.keys(e).reverse().find((o) => o.toUpperCase() === n);
|
|
14446
|
+
return t === void 0 ? void 0 : e[t];
|
|
14434
14447
|
}
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
const keysCount = Object.keys(populated).length;
|
|
14440
|
-
const shortPaths = [];
|
|
14441
|
-
for (const filePath of optionPaths) {
|
|
14448
|
+
function pe(e, n, t) {
|
|
14449
|
+
let o = (P(n, "PATHEXT") || ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean), s = o.some((l) => e.toLowerCase().endsWith(l.toLowerCase())) ? ["", ...o] : [...o, ""], i = /[\\/]/.test(e) ? [t] : [t, ...(P(n, "PATH") || "").split(";")];
|
|
14450
|
+
for (let l of i) for (let d of s) {
|
|
14451
|
+
let h = L.resolve(t, l.replace(/^"|"$/g, ""), e + d);
|
|
14442
14452
|
try {
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
} catch (e) {
|
|
14446
|
-
if (debug) {
|
|
14447
|
-
_debug(`failed to load ${filePath} ${e.message}`);
|
|
14448
|
-
}
|
|
14449
|
-
lastError = e;
|
|
14453
|
+
if (ue.statSync(h).isFile()) return h;
|
|
14454
|
+
} catch {
|
|
14450
14455
|
}
|
|
14451
14456
|
}
|
|
14452
|
-
_log(`injected env (${keysCount}) from ${shortPaths.join(",")} ${dim(`// tip: ${_getRandomTip()}`)}`);
|
|
14453
14457
|
}
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
return
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
|
|
14462
|
-
return DotenvModule.configDotenv(options);
|
|
14458
|
+
function he(e, n, t) {
|
|
14459
|
+
if (process.platform !== "win32") return _.spawn(e, n, t);
|
|
14460
|
+
let o = t.env || process.env, r = pe(e, o, t.cwd || process.cwd());
|
|
14461
|
+
if (r && /\.(?:exe|com)$/i.test(r)) return _.spawn(r, n, t);
|
|
14462
|
+
let s = /\.(?:bat|cmd)$/i.test(r || e), i = [H(L.normalize(r || e))];
|
|
14463
|
+
for (let d of n) i.push(H(de(d), s ? 2 : 1));
|
|
14464
|
+
let l = i.join(" ");
|
|
14465
|
+
return _.spawn(P(o, "COMSPEC") || "cmd.exe", ["/d", "/v:off", "/s", "/c", `"${l}"`], { ...t, windowsVerbatimArguments: true });
|
|
14463
14466
|
}
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
|
|
14467
|
-
|
|
14467
|
+
W.exports = he;
|
|
14468
|
+
});
|
|
14469
|
+
var X = j(($e, F) => {
|
|
14470
|
+
var ge = __require("fs"), me = __require("os"), Q = __require("path"), ve = __require("child_process"), Ce = M(), R = N(), { optionsFromEnv: J } = k();
|
|
14471
|
+
function D() {
|
|
14472
|
+
console.log(["Usage: dotenv run [--help] [-q|--quiet] [--debug] [--override] [--fast] [-f|--file <paths>] [--] <command> [args...]", "", "Run a command with environment variables from a .env file.", "Place dotenv options before the command; all following arguments go to the command.", "", "Options:", " -f, --file <paths> .env paths, comma-separated or repeated (default: .env)", " -q, --quiet suppress the injected env message", " --debug enable debug logging", " --override override existing environment variables", " --fast use the faster character-scanner parser", "", "Environment variables (DOTENV_CONFIG_* names remain as fallbacks):", " DOTENV_PATH, DOTENV_ENCODING, DOTENV_QUIET,", " DOTENV_DEBUG, DOTENV_OVERRIDE,", " DOTENV_FAST"].join(`
|
|
14473
|
+
`));
|
|
14468
14474
|
}
|
|
14469
|
-
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
|
|
14494
|
-
|
|
14475
|
+
function we(e) {
|
|
14476
|
+
let n = [], t = false, o, r, s, i, l = -1;
|
|
14477
|
+
for (let h = 0; h < e.length; h++) {
|
|
14478
|
+
let f = e[h];
|
|
14479
|
+
if (f === "--") {
|
|
14480
|
+
l = h + 1;
|
|
14481
|
+
break;
|
|
14482
|
+
}
|
|
14483
|
+
if (f === "--help" || f === "-h") return { help: true };
|
|
14484
|
+
if (f === "--quiet" || f === "-q") {
|
|
14485
|
+
o = true;
|
|
14486
|
+
continue;
|
|
14487
|
+
}
|
|
14488
|
+
if (f === "--debug") {
|
|
14489
|
+
r = true;
|
|
14490
|
+
continue;
|
|
14491
|
+
}
|
|
14492
|
+
if (f === "--override") {
|
|
14493
|
+
s = true;
|
|
14494
|
+
continue;
|
|
14495
|
+
}
|
|
14496
|
+
if (f === "--fast") {
|
|
14497
|
+
i = true;
|
|
14498
|
+
continue;
|
|
14499
|
+
}
|
|
14500
|
+
if (f === "-f" || f === "--file" || f.startsWith("-f=") || f.startsWith("--file=")) {
|
|
14501
|
+
let c = f.indexOf("="), a = c === -1 ? f : f.slice(0, c), g = c === -1 ? e[++h] : f.slice(c + 1);
|
|
14502
|
+
if (!g || g === "--") return { error: `${a} requires a path` };
|
|
14503
|
+
let p = g.split(",").map((y) => y.trim()).filter(Boolean);
|
|
14504
|
+
if (p.length === 0) return { error: `${a} requires a path` };
|
|
14505
|
+
n.push(...p), t = true;
|
|
14506
|
+
continue;
|
|
14507
|
+
}
|
|
14508
|
+
if (f.startsWith("-")) return { error: `unknown option: ${f}` };
|
|
14509
|
+
l = h;
|
|
14510
|
+
break;
|
|
14495
14511
|
}
|
|
14512
|
+
let d = l === -1 ? [] : e.slice(l);
|
|
14513
|
+
return { paths: n, pathSet: t, quiet: o, debug: r, override: s, fast: i, command: d };
|
|
14496
14514
|
}
|
|
14497
|
-
|
|
14498
|
-
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
|
|
14502
|
-
|
|
14503
|
-
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
14504
|
-
err.code = "OBJECT_REQUIRED";
|
|
14505
|
-
throw err;
|
|
14515
|
+
function Ae(e) {
|
|
14516
|
+
return e[0] === "~" ? Q.join(me.homedir(), e.slice(1)) : e;
|
|
14517
|
+
}
|
|
14518
|
+
function Ee(e) {
|
|
14519
|
+
let n = J(), t = { encoding: n.encoding || "utf8", quiet: n.quiet, debug: n.debug === true, override: n.override === true, fast: n.fast === true, paths: [".env"], defaultPath: true };
|
|
14520
|
+
return n.path != null && (t.paths = [n.path], t.defaultPath = false), e.pathSet && (t.paths = e.paths, t.defaultPath = false), e.quiet != null && (t.quiet = e.quiet), e.debug != null && (t.debug = e.debug), e.override != null && (t.override = e.override), e.fast != null && (t.fast = e.fast), t;
|
|
14506
14521
|
}
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
|
|
14511
|
-
|
|
14522
|
+
function be(e) {
|
|
14523
|
+
let n = {}, t = [], o = { override: e.override, debug: e.debug };
|
|
14524
|
+
for (let s of e.paths) {
|
|
14525
|
+
let i = Q.resolve(process.cwd(), Ae(s));
|
|
14526
|
+
try {
|
|
14527
|
+
let l = R.parse(ge.readFileSync(i, { encoding: e.encoding }), { fast: e.fast });
|
|
14528
|
+
R.populate(n, l, o), t.push(s);
|
|
14529
|
+
} catch (l) {
|
|
14530
|
+
if (e.debug && console.log(`\u2506 failed to load ${s} ${l.message}`), !(e.defaultPath && l.code === "ENOENT")) throw l;
|
|
14512
14531
|
}
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
|
|
14532
|
+
}
|
|
14533
|
+
return { injected: R.populate(process.env, n, o), loadedPaths: t };
|
|
14534
|
+
}
|
|
14535
|
+
function K(e) {
|
|
14536
|
+
let n = e[0];
|
|
14537
|
+
if (n === "--help" || n === "-h") {
|
|
14538
|
+
D();
|
|
14539
|
+
return;
|
|
14540
|
+
}
|
|
14541
|
+
if (n !== "run") {
|
|
14542
|
+
D(), process.exitCode = 1;
|
|
14543
|
+
return;
|
|
14544
|
+
}
|
|
14545
|
+
let t = we(e.slice(1));
|
|
14546
|
+
if (t.help) {
|
|
14547
|
+
D();
|
|
14548
|
+
return;
|
|
14549
|
+
}
|
|
14550
|
+
if (t.error) {
|
|
14551
|
+
console.error(`dotenv: ${t.error}`), D(), process.exitCode = 1;
|
|
14552
|
+
return;
|
|
14553
|
+
}
|
|
14554
|
+
if (t.command.length === 0) {
|
|
14555
|
+
D(), process.exitCode = 1;
|
|
14556
|
+
return;
|
|
14557
|
+
}
|
|
14558
|
+
let o = Ee(t);
|
|
14559
|
+
try {
|
|
14560
|
+
let c = be(o);
|
|
14561
|
+
if (!(o.quiet == null ? J().quiet : o.quiet)) {
|
|
14562
|
+
let g = `\u25C7 injected env (${Object.keys(c.injected).length})`;
|
|
14563
|
+
c.loadedPaths.length > 0 && (g += ` from ${c.loadedPaths.join(", ")}`), console.error(g);
|
|
14564
|
+
}
|
|
14565
|
+
} catch (c) {
|
|
14566
|
+
console.error(`dotenv: ${c.message}`), process.exitCode = 1;
|
|
14567
|
+
return;
|
|
14568
|
+
}
|
|
14569
|
+
let r = !!process.stdin.isTTY, s = process.platform !== "win32" && !r, i = Ce(t.command[0], t.command.slice(1), { stdio: "inherit", detached: s }), l = /* @__PURE__ */ new Map(), d = 0;
|
|
14570
|
+
function h(c) {
|
|
14571
|
+
if (!(!i.pid || i.exitCode !== null || i.signalCode !== null)) {
|
|
14572
|
+
if (process.platform === "win32") {
|
|
14573
|
+
ve.spawnSync("taskkill", ["/pid", String(i.pid), "/T", "/F"], { stdio: "ignore" });
|
|
14574
|
+
return;
|
|
14575
|
+
}
|
|
14576
|
+
try {
|
|
14577
|
+
process.kill(s ? -i.pid : i.pid, c);
|
|
14578
|
+
} catch (a) {
|
|
14579
|
+
if (a.code !== "ESRCH") throw a;
|
|
14518
14580
|
}
|
|
14519
14581
|
}
|
|
14520
|
-
} else {
|
|
14521
|
-
processEnv[key] = parsed[key];
|
|
14522
|
-
populated[key] = parsed[key];
|
|
14523
14582
|
}
|
|
14583
|
+
function f() {
|
|
14584
|
+
for (let [c, a] of l) process.removeListener(c, a);
|
|
14585
|
+
}
|
|
14586
|
+
for (let c of ["SIGINT", "SIGTERM", "SIGHUP", "SIGQUIT"]) {
|
|
14587
|
+
let a = () => {
|
|
14588
|
+
if (c === "SIGINT") {
|
|
14589
|
+
if (d++, r && process.platform !== "win32" && d === 1) return;
|
|
14590
|
+
if (d > 1) {
|
|
14591
|
+
h(d === 2 ? "SIGTERM" : "SIGKILL");
|
|
14592
|
+
return;
|
|
14593
|
+
}
|
|
14594
|
+
}
|
|
14595
|
+
h(c);
|
|
14596
|
+
};
|
|
14597
|
+
l.set(c, a), process.on(c, a);
|
|
14598
|
+
}
|
|
14599
|
+
i.on("error", function(c) {
|
|
14600
|
+
f(), console.error(`dotenv: ${c.message}`), process.exitCode = 1;
|
|
14601
|
+
}), i.on("exit", function(c, a) {
|
|
14602
|
+
f(), typeof c == "number" ? process.exit(c) : (setInterval(() => {
|
|
14603
|
+
}, 1e3), process.kill(process.pid, a));
|
|
14604
|
+
});
|
|
14524
14605
|
}
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
module.exports.configDotenv = DotenvModule.configDotenv;
|
|
14537
|
-
module.exports._configVault = DotenvModule._configVault;
|
|
14538
|
-
module.exports._parseVault = DotenvModule._parseVault;
|
|
14539
|
-
module.exports.config = DotenvModule.config;
|
|
14540
|
-
module.exports.decrypt = DotenvModule.decrypt;
|
|
14541
|
-
module.exports.parse = DotenvModule.parse;
|
|
14542
|
-
module.exports.populate = DotenvModule.populate;
|
|
14543
|
-
module.exports = DotenvModule;
|
|
14606
|
+
F.exports = K;
|
|
14607
|
+
__require.main === F && K(process.argv.slice(2));
|
|
14608
|
+
});
|
|
14609
|
+
var S = N();
|
|
14610
|
+
var qe = X();
|
|
14611
|
+
module.exports = S;
|
|
14612
|
+
module.exports.config = S.config;
|
|
14613
|
+
module.exports.configDotenv = S.configDotenv;
|
|
14614
|
+
module.exports.parse = S.parse;
|
|
14615
|
+
module.exports.populate = S.populate;
|
|
14616
|
+
__require.main === module && qe(process.argv.slice(2));
|
|
14544
14617
|
}
|
|
14545
14618
|
});
|
|
14546
14619
|
|
|
14547
14620
|
// ../argent-mcp/src/mcp-server.ts
|
|
14548
14621
|
import { appendFile, mkdir as mkdir5 } from "node:fs/promises";
|
|
14549
|
-
import { dirname as
|
|
14622
|
+
import { dirname as dirname10 } from "node:path";
|
|
14550
14623
|
import { homedir as homedir5 } from "node:os";
|
|
14551
14624
|
|
|
14552
14625
|
// ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
@@ -14789,10 +14862,10 @@ function mergeDefs(...defs) {
|
|
|
14789
14862
|
function cloneDef(schema) {
|
|
14790
14863
|
return mergeDefs(schema._zod.def);
|
|
14791
14864
|
}
|
|
14792
|
-
function getElementAtPath(obj,
|
|
14793
|
-
if (!
|
|
14865
|
+
function getElementAtPath(obj, path17) {
|
|
14866
|
+
if (!path17)
|
|
14794
14867
|
return obj;
|
|
14795
|
-
return
|
|
14868
|
+
return path17.reduce((acc, key) => acc?.[key], obj);
|
|
14796
14869
|
}
|
|
14797
14870
|
function promiseAllObject(promisesObj) {
|
|
14798
14871
|
const keys = Object.keys(promisesObj);
|
|
@@ -15132,11 +15205,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
15132
15205
|
}
|
|
15133
15206
|
return false;
|
|
15134
15207
|
}
|
|
15135
|
-
function prefixIssues(
|
|
15208
|
+
function prefixIssues(path17, issues) {
|
|
15136
15209
|
return issues.map((iss) => {
|
|
15137
15210
|
var _a3;
|
|
15138
15211
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
15139
|
-
iss.path.unshift(
|
|
15212
|
+
iss.path.unshift(path17);
|
|
15140
15213
|
return iss;
|
|
15141
15214
|
});
|
|
15142
15215
|
}
|
|
@@ -15594,16 +15667,16 @@ function flattenError(error2, mapper = (issue2) => issue2.message) {
|
|
|
15594
15667
|
}
|
|
15595
15668
|
function formatError(error2, mapper = (issue2) => issue2.message) {
|
|
15596
15669
|
const fieldErrors = { _errors: [] };
|
|
15597
|
-
const processError = (error3,
|
|
15670
|
+
const processError = (error3, path17 = []) => {
|
|
15598
15671
|
for (const issue2 of error3.issues) {
|
|
15599
15672
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
15600
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
15673
|
+
issue2.errors.map((issues) => processError({ issues }, [...path17, ...issue2.path]));
|
|
15601
15674
|
} else if (issue2.code === "invalid_key") {
|
|
15602
|
-
processError({ issues: issue2.issues }, [...
|
|
15675
|
+
processError({ issues: issue2.issues }, [...path17, ...issue2.path]);
|
|
15603
15676
|
} else if (issue2.code === "invalid_element") {
|
|
15604
|
-
processError({ issues: issue2.issues }, [...
|
|
15677
|
+
processError({ issues: issue2.issues }, [...path17, ...issue2.path]);
|
|
15605
15678
|
} else {
|
|
15606
|
-
const fullpath = [...
|
|
15679
|
+
const fullpath = [...path17, ...issue2.path];
|
|
15607
15680
|
if (fullpath.length === 0) {
|
|
15608
15681
|
fieldErrors._errors.push(mapper(issue2));
|
|
15609
15682
|
} else {
|
|
@@ -17903,7 +17976,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
17903
17976
|
var NONE = 0;
|
|
17904
17977
|
var ASSUMED = 1;
|
|
17905
17978
|
var PROVEN = 2;
|
|
17906
|
-
function isRecursive(inst, stack,
|
|
17979
|
+
function isRecursive(inst, stack, resolve10) {
|
|
17907
17980
|
const cached2 = recursive.get(inst);
|
|
17908
17981
|
if (cached2 !== void 0)
|
|
17909
17982
|
return cached2 ? PROVEN : NONE;
|
|
@@ -17913,7 +17986,7 @@ function isRecursive(inst, stack, resolve9) {
|
|
|
17913
17986
|
let result = NONE;
|
|
17914
17987
|
const check = (child) => {
|
|
17915
17988
|
if (result !== PROVEN && child?._zod) {
|
|
17916
|
-
const answer = isRecursive(child, stack,
|
|
17989
|
+
const answer = isRecursive(child, stack, resolve10);
|
|
17917
17990
|
if (answer > result)
|
|
17918
17991
|
result = answer;
|
|
17919
17992
|
}
|
|
@@ -17924,7 +17997,7 @@ function isRecursive(inst, stack, resolve9) {
|
|
|
17924
17997
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
17925
17998
|
if (spread && !desc.enumerable)
|
|
17926
17999
|
continue;
|
|
17927
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
18000
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve10) : NONE;
|
|
17928
18001
|
if (child > answer)
|
|
17929
18002
|
answer = child;
|
|
17930
18003
|
}
|
|
@@ -17988,7 +18061,7 @@ function isRecursive(inst, stack, resolve9) {
|
|
|
17988
18061
|
break;
|
|
17989
18062
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
17990
18063
|
case "lazy": {
|
|
17991
|
-
const inner = def._cachedInner ?? (
|
|
18064
|
+
const inner = def._cachedInner ?? (resolve10 ? inst._zod.innerType : void 0);
|
|
17992
18065
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
17993
18066
|
break;
|
|
17994
18067
|
}
|
|
@@ -22566,12 +22639,12 @@ var StdioServerTransport = class {
|
|
|
22566
22639
|
this.onclose?.();
|
|
22567
22640
|
}
|
|
22568
22641
|
send(message) {
|
|
22569
|
-
return new Promise((
|
|
22642
|
+
return new Promise((resolve10) => {
|
|
22570
22643
|
const json = serializeMessage(message);
|
|
22571
22644
|
if (this._stdout.write(json)) {
|
|
22572
|
-
|
|
22645
|
+
resolve10();
|
|
22573
22646
|
} else {
|
|
22574
|
-
this._stdout.once("drain",
|
|
22647
|
+
this._stdout.once("drain", resolve10);
|
|
22575
22648
|
}
|
|
22576
22649
|
});
|
|
22577
22650
|
}
|
|
@@ -23191,7 +23264,7 @@ var Protocol = class {
|
|
|
23191
23264
|
return;
|
|
23192
23265
|
}
|
|
23193
23266
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
23194
|
-
await new Promise((
|
|
23267
|
+
await new Promise((resolve10) => setTimeout(resolve10, pollInterval));
|
|
23195
23268
|
options?.signal?.throwIfAborted();
|
|
23196
23269
|
}
|
|
23197
23270
|
} catch (error2) {
|
|
@@ -23208,7 +23281,7 @@ var Protocol = class {
|
|
|
23208
23281
|
*/
|
|
23209
23282
|
request(request, resultSchema, options) {
|
|
23210
23283
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
23211
|
-
return new Promise((
|
|
23284
|
+
return new Promise((resolve10, reject) => {
|
|
23212
23285
|
const earlyReject = (error2) => {
|
|
23213
23286
|
reject(error2);
|
|
23214
23287
|
};
|
|
@@ -23286,7 +23359,7 @@ var Protocol = class {
|
|
|
23286
23359
|
if (!parseResult.success) {
|
|
23287
23360
|
reject(parseResult.error);
|
|
23288
23361
|
} else {
|
|
23289
|
-
|
|
23362
|
+
resolve10(parseResult.data);
|
|
23290
23363
|
}
|
|
23291
23364
|
} catch (error2) {
|
|
23292
23365
|
reject(error2);
|
|
@@ -23548,12 +23621,12 @@ var Protocol = class {
|
|
|
23548
23621
|
}
|
|
23549
23622
|
} catch {
|
|
23550
23623
|
}
|
|
23551
|
-
return new Promise((
|
|
23624
|
+
return new Promise((resolve10, reject) => {
|
|
23552
23625
|
if (signal.aborted) {
|
|
23553
23626
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
23554
23627
|
return;
|
|
23555
23628
|
}
|
|
23556
|
-
const timeoutId = setTimeout(
|
|
23629
|
+
const timeoutId = setTimeout(resolve10, interval);
|
|
23557
23630
|
signal.addEventListener("abort", () => {
|
|
23558
23631
|
clearTimeout(timeoutId);
|
|
23559
23632
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -24369,7 +24442,7 @@ function generateToken() {
|
|
|
24369
24442
|
return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
|
|
24370
24443
|
}
|
|
24371
24444
|
function findFreePort() {
|
|
24372
|
-
return new Promise((
|
|
24445
|
+
return new Promise((resolve10, reject) => {
|
|
24373
24446
|
const srv = net.createServer();
|
|
24374
24447
|
srv.listen(0, "127.0.0.1", () => {
|
|
24375
24448
|
const addr = srv.address();
|
|
@@ -24380,7 +24453,7 @@ function findFreePort() {
|
|
|
24380
24453
|
const port = addr.port;
|
|
24381
24454
|
srv.close((err) => {
|
|
24382
24455
|
if (err) reject(err);
|
|
24383
|
-
else
|
|
24456
|
+
else resolve10(port);
|
|
24384
24457
|
});
|
|
24385
24458
|
});
|
|
24386
24459
|
srv.on("error", reject);
|
|
@@ -24478,7 +24551,7 @@ function killSpawnedChild(child, pid) {
|
|
|
24478
24551
|
}
|
|
24479
24552
|
}
|
|
24480
24553
|
function spawnToolsServer(paths, port, options = {}) {
|
|
24481
|
-
return new Promise((
|
|
24554
|
+
return new Promise((resolve10, reject) => {
|
|
24482
24555
|
let logFd;
|
|
24483
24556
|
try {
|
|
24484
24557
|
fs.mkdirSync(STATE_DIR, { recursive: true });
|
|
@@ -24524,7 +24597,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
24524
24597
|
rl.close();
|
|
24525
24598
|
child.stdout?.resume();
|
|
24526
24599
|
child.stdout?.unref?.();
|
|
24527
|
-
settle2(() =>
|
|
24600
|
+
settle2(() => resolve10({ port: actualPort, pid }));
|
|
24528
24601
|
}
|
|
24529
24602
|
});
|
|
24530
24603
|
child.on("error", (err) => {
|
|
@@ -24819,10 +24892,11 @@ async function ensureToolsServer(paths) {
|
|
|
24819
24892
|
}
|
|
24820
24893
|
|
|
24821
24894
|
// ../argent-tools-client/src/tools-client.ts
|
|
24822
|
-
import * as
|
|
24895
|
+
import * as path7 from "node:path";
|
|
24823
24896
|
|
|
24824
24897
|
// ../registry/src/types.ts
|
|
24825
24898
|
var LINKED_CALL_HEADER = "x-argent-linked";
|
|
24899
|
+
var E2E_DIR_CLIENT_HEADER = "x-argent-e2e-dir";
|
|
24826
24900
|
|
|
24827
24901
|
// ../registry/src/artifacts.ts
|
|
24828
24902
|
import { stat } from "node:fs/promises";
|
|
@@ -24860,19 +24934,95 @@ function toolStepFiles(specs, args) {
|
|
|
24860
24934
|
}
|
|
24861
24935
|
return files;
|
|
24862
24936
|
}
|
|
24863
|
-
function isClientFileArgument({ spec, path:
|
|
24864
|
-
return spec.kind === "file" && spec.path === `\${${spec.target}}` &&
|
|
24937
|
+
function isClientFileArgument({ spec, path: path17 }) {
|
|
24938
|
+
return spec.kind === "file" && spec.path === `\${${spec.target}}` && path17.startsWith("/") && hasToolFileExtension(path17);
|
|
24865
24939
|
}
|
|
24866
24940
|
|
|
24867
24941
|
// ../registry/src/flow-file-refs.ts
|
|
24942
|
+
import * as fs3 from "node:fs/promises";
|
|
24943
|
+
import * as path3 from "node:path";
|
|
24944
|
+
|
|
24945
|
+
// ../registry/src/e2e-dirs.ts
|
|
24868
24946
|
import * as fs2 from "node:fs/promises";
|
|
24869
24947
|
import * as path2 from "node:path";
|
|
24948
|
+
var E2E_DIR = path2.join(".argent", "e2e");
|
|
24949
|
+
var LEGACY_E2E_DIRS = Object.freeze([path2.join(".argent", "flows")]);
|
|
24950
|
+
var E2E_DIRS = Object.freeze([E2E_DIR, ...LEGACY_E2E_DIRS]);
|
|
24951
|
+
function e2eDirFor(projectRoot) {
|
|
24952
|
+
return path2.join(projectRoot, E2E_DIR);
|
|
24953
|
+
}
|
|
24954
|
+
function e2eDirsFor(projectRoot) {
|
|
24955
|
+
return E2E_DIRS.map((dir) => path2.join(projectRoot, dir));
|
|
24956
|
+
}
|
|
24957
|
+
function e2eFileCandidates(projectRoot, name) {
|
|
24958
|
+
return e2eDirsFor(projectRoot).map((dir) => path2.join(dir, `${name}.yaml`));
|
|
24959
|
+
}
|
|
24960
|
+
async function exists(file) {
|
|
24961
|
+
return fs2.stat(file).then(
|
|
24962
|
+
() => true,
|
|
24963
|
+
() => false
|
|
24964
|
+
);
|
|
24965
|
+
}
|
|
24966
|
+
async function pickE2eFile(candidates) {
|
|
24967
|
+
for (let i = 0; i < candidates.length; i++) {
|
|
24968
|
+
if (!await exists(candidates[i])) continue;
|
|
24969
|
+
let shadowed;
|
|
24970
|
+
for (const later of candidates.slice(i + 1)) {
|
|
24971
|
+
if (await exists(later)) {
|
|
24972
|
+
shadowed = later;
|
|
24973
|
+
break;
|
|
24974
|
+
}
|
|
24975
|
+
}
|
|
24976
|
+
return {
|
|
24977
|
+
path: candidates[i],
|
|
24978
|
+
exists: true,
|
|
24979
|
+
legacy: i > 0,
|
|
24980
|
+
...shadowed === void 0 ? {} : { shadowed }
|
|
24981
|
+
};
|
|
24982
|
+
}
|
|
24983
|
+
return { path: candidates[0], exists: false, legacy: false };
|
|
24984
|
+
}
|
|
24985
|
+
function e2eShadowWarning(used, shadowed) {
|
|
24986
|
+
return `${shadowed} is not used: ${used} has the same name and is read first.`;
|
|
24987
|
+
}
|
|
24988
|
+
var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path2.basename(dir));
|
|
24989
|
+
function e2eDirProject(dir) {
|
|
24990
|
+
const trimmed = dir.length > 1 ? dir.replace(/[\\/]+$/, "") : dir;
|
|
24991
|
+
const argent = path2.dirname(trimmed);
|
|
24992
|
+
if (!E2E_DIR_NAMES.includes(path2.basename(trimmed)) || path2.basename(argent) !== ".argent") {
|
|
24993
|
+
return null;
|
|
24994
|
+
}
|
|
24995
|
+
return path2.dirname(argent);
|
|
24996
|
+
}
|
|
24997
|
+
function e2eRunFallbackDirs(anchorDir, target) {
|
|
24998
|
+
if (target.includes("/") || target.includes("\\")) return [];
|
|
24999
|
+
const project = e2eDirProject(anchorDir);
|
|
25000
|
+
if (project === null) return [];
|
|
25001
|
+
const anchor2 = path2.resolve(anchorDir);
|
|
25002
|
+
return e2eDirsFor(project).filter((dir) => path2.resolve(dir) !== anchor2);
|
|
25003
|
+
}
|
|
25004
|
+
|
|
25005
|
+
// ../registry/src/tool-ids.ts
|
|
25006
|
+
var TOOL_ID_ALIASES = Object.freeze({
|
|
25007
|
+
"flow-start-recording": "e2e-start-recording",
|
|
25008
|
+
"flow-add-step": "e2e-add-step",
|
|
25009
|
+
"flow-add-echo": "e2e-add-echo",
|
|
25010
|
+
"flow-add-script": "e2e-add-script",
|
|
25011
|
+
"flow-finish-recording": "e2e-finish-recording",
|
|
25012
|
+
"flow-read-prerequisite": "e2e-read-prerequisite",
|
|
25013
|
+
"flow-execute": "e2e-execute"
|
|
25014
|
+
});
|
|
25015
|
+
function canonicalToolId(id) {
|
|
25016
|
+
return Object.hasOwn(TOOL_ID_ALIASES, id) ? TOOL_ID_ALIASES[id] : id;
|
|
25017
|
+
}
|
|
25018
|
+
|
|
25019
|
+
// ../registry/src/flow-file-refs.ts
|
|
24870
25020
|
async function canonicalFlowPath(p) {
|
|
24871
25021
|
try {
|
|
24872
|
-
return await
|
|
25022
|
+
return await fs3.realpath(p);
|
|
24873
25023
|
} catch {
|
|
24874
25024
|
try {
|
|
24875
|
-
return
|
|
25025
|
+
return path3.join(await fs3.realpath(path3.dirname(p)), path3.basename(p));
|
|
24876
25026
|
} catch {
|
|
24877
25027
|
return p;
|
|
24878
25028
|
}
|
|
@@ -24881,7 +25031,7 @@ async function canonicalFlowPath(p) {
|
|
|
24881
25031
|
function completeRunExtension(value) {
|
|
24882
25032
|
if (value.endsWith(".yaml")) return value;
|
|
24883
25033
|
const candidate = `${value}.yaml`;
|
|
24884
|
-
return FLOW_FILE_NAME_PATTERN.test(
|
|
25034
|
+
return FLOW_FILE_NAME_PATTERN.test(path3.posix.basename(candidate)) ? candidate : value;
|
|
24885
25035
|
}
|
|
24886
25036
|
var MAX_RUN_DEPTH = 20;
|
|
24887
25037
|
var MAX_BLOCK_NESTING = 64;
|
|
@@ -24900,16 +25050,16 @@ function collectFlowRequests(doc) {
|
|
|
24900
25050
|
for (const step of steps) {
|
|
24901
25051
|
if (!isRecord(step)) continue;
|
|
24902
25052
|
const run = step.run;
|
|
24903
|
-
if (typeof run === "string" && !run.includes("\\") && !
|
|
25053
|
+
if (typeof run === "string" && !run.includes("\\") && !path3.posix.isAbsolute(run) && !/^[A-Za-z]:/.test(run)) {
|
|
24904
25054
|
const target = completeRunExtension(run);
|
|
24905
|
-
if (FLOW_FILE_NAME_PATTERN.test(
|
|
25055
|
+
if (FLOW_FILE_NAME_PATTERN.test(path3.posix.basename(target))) runTargets.add(target);
|
|
24906
25056
|
}
|
|
24907
25057
|
const snapshot = isRecord(step.snapshot) ? step.snapshot.name : step.snapshot;
|
|
24908
25058
|
if (typeof snapshot === "string" && FLOW_NAME_PATTERN.test(snapshot)) snapshots.add(snapshot);
|
|
24909
25059
|
if (typeof step.tool === "string") {
|
|
24910
25060
|
const args = isRecord(step.args) ? step.args : {};
|
|
24911
25061
|
toolSteps.push({ tool: step.tool, args });
|
|
24912
|
-
const target = step.tool === "
|
|
25062
|
+
const target = canonicalToolId(step.tool) === "e2e-execute" ? nestedFlowTarget(args) : void 0;
|
|
24913
25063
|
if (target !== void 0) nested.push({ target, args });
|
|
24914
25064
|
}
|
|
24915
25065
|
visit(step.steps, depth + 1);
|
|
@@ -24919,14 +25069,14 @@ function collectFlowRequests(doc) {
|
|
|
24919
25069
|
return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
|
|
24920
25070
|
}
|
|
24921
25071
|
function baselineKeyFor(canonicalPath, flowName) {
|
|
24922
|
-
const stem =
|
|
25072
|
+
const stem = path3.basename(canonicalPath, ".yaml");
|
|
24923
25073
|
return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
|
|
24924
25074
|
}
|
|
24925
25075
|
function flowMemberKey(anchorDir, target) {
|
|
24926
25076
|
return `${anchorDir}\0${target}`;
|
|
24927
25077
|
}
|
|
24928
25078
|
async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
|
|
24929
|
-
const entries = await
|
|
25079
|
+
const entries = await fs3.readdir(dir).catch(() => null);
|
|
24930
25080
|
if (entries === null || entries.includes(base)) return { state: "listed" };
|
|
24931
25081
|
const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
|
|
24932
25082
|
if (actual === void 0) return { state: "absent" };
|
|
@@ -24938,19 +25088,15 @@ function nestedFlowTarget(args) {
|
|
|
24938
25088
|
if (flowPath === void 0) {
|
|
24939
25089
|
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name)) return void 0;
|
|
24940
25090
|
if (!isResolvedAbsolute(projectRoot)) return void 0;
|
|
24941
|
-
|
|
24942
|
-
|
|
24943
|
-
projectRoot,
|
|
24944
|
-
name,
|
|
24945
|
-
path: path2.join(projectRoot, ".argent", "flows", `${name}.yaml`)
|
|
24946
|
-
};
|
|
25091
|
+
const paths = e2eFileCandidates(projectRoot, name);
|
|
25092
|
+
return { kind: "name", projectRoot, name, path: paths[0], paths };
|
|
24947
25093
|
}
|
|
24948
25094
|
if (name !== void 0 || !isResolvedAbsolute(flowPath)) return void 0;
|
|
24949
|
-
if (!FLOW_FILE_NAME_PATTERN.test(
|
|
25095
|
+
if (!FLOW_FILE_NAME_PATTERN.test(path3.basename(flowPath))) return void 0;
|
|
24950
25096
|
return { kind: "flow_path", path: flowPath };
|
|
24951
25097
|
}
|
|
24952
25098
|
function isResolvedAbsolute(value) {
|
|
24953
|
-
return typeof value === "string" &&
|
|
25099
|
+
return typeof value === "string" && path3.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
|
|
24954
25100
|
}
|
|
24955
25101
|
|
|
24956
25102
|
// ../registry/src/failure-codes.ts
|
|
@@ -25070,6 +25216,11 @@ var FAILURE_CODES = {
|
|
|
25070
25216
|
// a device that is not foldable, no hinge route, a remote simulator.
|
|
25071
25217
|
IOS_FOLD_FAILED: "IOS_FOLD_FAILED",
|
|
25072
25218
|
IOS_FOLD_UNSUPPORTED: "IOS_FOLD_UNSUPPORTED",
|
|
25219
|
+
// The hinge of a foldable Android emulator: the console refused the move or
|
|
25220
|
+
// the guest never committed the state vs. nothing to fold — a phone profile,
|
|
25221
|
+
// a physical device.
|
|
25222
|
+
ANDROID_FOLD_FAILED: "ANDROID_FOLD_FAILED",
|
|
25223
|
+
ANDROID_FOLD_UNSUPPORTED: "ANDROID_FOLD_UNSUPPORTED",
|
|
25073
25224
|
PASTE_CLIPBOARD_SET_FAILED: "PASTE_CLIPBOARD_SET_FAILED",
|
|
25074
25225
|
PASTE_CLIPBOARD_UNSUPPORTED: "PASTE_CLIPBOARD_UNSUPPORTED",
|
|
25075
25226
|
SETTINGS_PERMISSION_UNSUPPORTED: "SETTINGS_PERMISSION_UNSUPPORTED",
|
|
@@ -25314,9 +25465,9 @@ var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
|
|
|
25314
25465
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
25315
25466
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
25316
25467
|
var resolvedDuringInvocation = new AsyncLocalStorage();
|
|
25317
|
-
function valueAtPath(root,
|
|
25468
|
+
function valueAtPath(root, path17) {
|
|
25318
25469
|
let current = root;
|
|
25319
|
-
for (const key of
|
|
25470
|
+
for (const key of path17) {
|
|
25320
25471
|
if (current === null || typeof current !== "object") return void 0;
|
|
25321
25472
|
if (!Object.hasOwn(current, key)) return void 0;
|
|
25322
25473
|
current = current[key];
|
|
@@ -25374,11 +25525,11 @@ function describeParamIssues(error2, params) {
|
|
|
25374
25525
|
}
|
|
25375
25526
|
|
|
25376
25527
|
// ../argent-tools-client/src/link-config.ts
|
|
25377
|
-
import * as
|
|
25528
|
+
import * as path4 from "node:path";
|
|
25378
25529
|
import { homedir as homedir2 } from "node:os";
|
|
25379
25530
|
import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
|
|
25380
|
-
var LINK_DIR =
|
|
25381
|
-
var LINK_FILE =
|
|
25531
|
+
var LINK_DIR = path4.join(homedir2(), ".argent");
|
|
25532
|
+
var LINK_FILE = path4.join(LINK_DIR, "link.json");
|
|
25382
25533
|
async function readLinkConfig() {
|
|
25383
25534
|
try {
|
|
25384
25535
|
const raw = await readFile2(LINK_FILE, "utf8");
|
|
@@ -25427,22 +25578,22 @@ import {
|
|
|
25427
25578
|
realpath as realpath2,
|
|
25428
25579
|
rename as rename2,
|
|
25429
25580
|
rm as rm2,
|
|
25430
|
-
stat as
|
|
25581
|
+
stat as stat3,
|
|
25431
25582
|
writeFile as writeFile3
|
|
25432
25583
|
} from "node:fs/promises";
|
|
25433
25584
|
import { constants, tmpdir } from "node:os";
|
|
25434
|
-
import * as
|
|
25585
|
+
import * as path5 from "node:path";
|
|
25435
25586
|
|
|
25436
25587
|
// ../archive/src/index.ts
|
|
25437
25588
|
import { execFile } from "node:child_process";
|
|
25438
25589
|
import { rm, readdir as readdir3 } from "node:fs/promises";
|
|
25439
|
-
import { basename as
|
|
25590
|
+
import { basename as basename4, dirname as dirname4, join as join5, posix as posix2, resolve as resolve3, sep as sep2 } from "node:path";
|
|
25440
25591
|
import { promisify } from "node:util";
|
|
25441
25592
|
var execFileAsync = promisify(execFile);
|
|
25442
25593
|
var ArchiveError = class extends Error {
|
|
25443
25594
|
};
|
|
25444
25595
|
function createTarGzArgs(sourcePath, target) {
|
|
25445
|
-
return ["-czf", target, "-C",
|
|
25596
|
+
return ["-czf", target, "-C", dirname4(sourcePath), basename4(sourcePath)];
|
|
25446
25597
|
}
|
|
25447
25598
|
async function createTarGzFile(sourcePath, tarPath) {
|
|
25448
25599
|
try {
|
|
@@ -25464,8 +25615,8 @@ function isSafeTarMember(memberPath, destDir) {
|
|
|
25464
25615
|
if (relative2 === ".." || relative2.startsWith("../") || relative2.split("/").includes("..")) {
|
|
25465
25616
|
return false;
|
|
25466
25617
|
}
|
|
25467
|
-
const root =
|
|
25468
|
-
const resolved =
|
|
25618
|
+
const root = resolve3(destDir);
|
|
25619
|
+
const resolved = resolve3(destDir, relative2);
|
|
25469
25620
|
return resolved === root || resolved.startsWith(root + sep2);
|
|
25470
25621
|
}
|
|
25471
25622
|
async function listTarMembers(tarPath) {
|
|
@@ -25519,7 +25670,7 @@ async function assertSafeArchive(tarPath, destDir) {
|
|
|
25519
25670
|
async function resolveMember(destDir, expectedName) {
|
|
25520
25671
|
const entries = await readdir3(destDir);
|
|
25521
25672
|
if (entries.includes(expectedName)) {
|
|
25522
|
-
return
|
|
25673
|
+
return join5(destDir, expectedName);
|
|
25523
25674
|
}
|
|
25524
25675
|
const real = entries.filter((e) => !e.startsWith("._"));
|
|
25525
25676
|
if (real.length !== 1) {
|
|
@@ -25527,7 +25678,7 @@ async function resolveMember(destDir, expectedName) {
|
|
|
25527
25678
|
`Could not identify the extracted member (expected "${expectedName}", found ${real.length} entries).`
|
|
25528
25679
|
);
|
|
25529
25680
|
}
|
|
25530
|
-
return
|
|
25681
|
+
return join5(destDir, real[0]);
|
|
25531
25682
|
}
|
|
25532
25683
|
async function safeExtractTarGz(tarPath, destDir, expectedName) {
|
|
25533
25684
|
await assertSafeArchive(tarPath, destDir);
|
|
@@ -25565,6 +25716,16 @@ function interpolatePath(template, args) {
|
|
|
25565
25716
|
});
|
|
25566
25717
|
return missing ? null : out;
|
|
25567
25718
|
}
|
|
25719
|
+
async function specPath(spec, args) {
|
|
25720
|
+
if (spec.kind !== "file" || !spec.paths?.length) return interpolatePath(spec.path, args);
|
|
25721
|
+
const candidates = [];
|
|
25722
|
+
for (const template of spec.paths) {
|
|
25723
|
+
const filled = interpolatePath(template, args);
|
|
25724
|
+
if (filled === null) return null;
|
|
25725
|
+
candidates.push(filled);
|
|
25726
|
+
}
|
|
25727
|
+
return (await pickE2eFile(candidates)).path;
|
|
25728
|
+
}
|
|
25568
25729
|
var pendingArchives = /* @__PURE__ */ new Set();
|
|
25569
25730
|
var ARCHIVE_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
25570
25731
|
function removePendingArchives() {
|
|
@@ -25600,9 +25761,9 @@ function untrackArchive(archive) {
|
|
|
25600
25761
|
process.removeListener("exit", removePendingArchives);
|
|
25601
25762
|
}
|
|
25602
25763
|
function sha256File(filePath) {
|
|
25603
|
-
return new Promise((
|
|
25764
|
+
return new Promise((resolve10, reject) => {
|
|
25604
25765
|
const hash = createHash2("sha256");
|
|
25605
|
-
createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () =>
|
|
25766
|
+
createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve10(hash.digest("hex"))).on("error", reject);
|
|
25606
25767
|
});
|
|
25607
25768
|
}
|
|
25608
25769
|
function toolServerError(text) {
|
|
@@ -25629,7 +25790,7 @@ function uploadFailure(url, res, text, bytes) {
|
|
|
25629
25790
|
});
|
|
25630
25791
|
}
|
|
25631
25792
|
async function uploadTar(tarPath, endpoint, signal) {
|
|
25632
|
-
const { size } = await
|
|
25793
|
+
const { size } = await stat3(tarPath);
|
|
25633
25794
|
const init = {
|
|
25634
25795
|
method: "POST",
|
|
25635
25796
|
headers: {
|
|
@@ -25653,7 +25814,7 @@ async function uploadTar(tarPath, endpoint, signal) {
|
|
|
25653
25814
|
return json.uploadId;
|
|
25654
25815
|
}
|
|
25655
25816
|
async function uploadFile(sourcePath, endpoint, signal) {
|
|
25656
|
-
const tarPath =
|
|
25817
|
+
const tarPath = path5.join(tmpdir(), `argent-upload-${randomUUID3()}.tar.gz`);
|
|
25657
25818
|
trackArchive(tarPath);
|
|
25658
25819
|
try {
|
|
25659
25820
|
await createTarGzFile(await realpath2(sourcePath), tarPath);
|
|
@@ -25668,7 +25829,7 @@ async function uploadFile(sourcePath, endpoint, signal) {
|
|
|
25668
25829
|
async function readFileInputWire(filePath, opts) {
|
|
25669
25830
|
let st;
|
|
25670
25831
|
try {
|
|
25671
|
-
st = await
|
|
25832
|
+
st = await stat3(filePath);
|
|
25672
25833
|
} catch {
|
|
25673
25834
|
return null;
|
|
25674
25835
|
}
|
|
@@ -25696,7 +25857,7 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
25696
25857
|
for (const spec of specs) {
|
|
25697
25858
|
if (spec.skipWhenSet && record2[spec.skipWhenSet] !== void 0) continue;
|
|
25698
25859
|
if (spec.target in record2 && typeof record2[spec.target] !== "string") continue;
|
|
25699
|
-
const filePath =
|
|
25860
|
+
const filePath = await specPath(spec, record2);
|
|
25700
25861
|
if (filePath === null) continue;
|
|
25701
25862
|
if (spec.target in record2 && record2[spec.target] !== filePath) continue;
|
|
25702
25863
|
const wire = { [FILE_INPUT_MARKER2]: true, path: filePath };
|
|
@@ -25714,13 +25875,13 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
25714
25875
|
wire.members = await opts.collectStepMembers(record2, opts);
|
|
25715
25876
|
}
|
|
25716
25877
|
if (spec.kind === "tar-upload") {
|
|
25717
|
-
const st = await
|
|
25878
|
+
const st = await stat3(filePath).catch(() => null);
|
|
25718
25879
|
if (st) {
|
|
25719
25880
|
wire.size = st.size;
|
|
25720
25881
|
wire.mtimeMs = st.mtimeMs;
|
|
25721
25882
|
}
|
|
25722
25883
|
if (opts.uploadEndpoint && st) {
|
|
25723
|
-
process.stderr.write(`Uploading ${
|
|
25884
|
+
process.stderr.write(`Uploading ${path5.basename(filePath)} to the remote tool-server...
|
|
25724
25885
|
`);
|
|
25725
25886
|
Object.assign(wire, await uploadFile(filePath, opts.uploadEndpoint, opts.signal));
|
|
25726
25887
|
}
|
|
@@ -25731,18 +25892,18 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
25731
25892
|
return out ?? args;
|
|
25732
25893
|
}
|
|
25733
25894
|
function isAllowedClientFilePath(p) {
|
|
25734
|
-
if (!
|
|
25895
|
+
if (!path5.isAbsolute(p)) return false;
|
|
25735
25896
|
const segments = p.split(/[\\/]+/);
|
|
25736
25897
|
if (segments.includes("..")) return false;
|
|
25737
25898
|
const file = segments[segments.length - 1] ?? "";
|
|
25738
25899
|
if (!FLOW_FILE_NAME_PATTERN.test(file)) return false;
|
|
25739
|
-
return segments
|
|
25900
|
+
return e2eDirProject(segments.slice(0, -1).join("/")) !== null;
|
|
25740
25901
|
}
|
|
25741
25902
|
function isClientFileDirective2(value) {
|
|
25742
25903
|
return !!value && typeof value === "object" && value[CLIENT_FILE_MARKER2] === true && typeof value.path === "string" && typeof value.content === "string";
|
|
25743
25904
|
}
|
|
25744
25905
|
async function replaceFile(target, bytes, mode) {
|
|
25745
|
-
const temp =
|
|
25906
|
+
const temp = path5.join(path5.dirname(target), `.baseline-${randomUUID3()}.tmp`);
|
|
25746
25907
|
try {
|
|
25747
25908
|
await writeFile3(temp, bytes, { flag: "wx" });
|
|
25748
25909
|
if (mode !== void 0) await chmod3(temp, mode & 511);
|
|
@@ -25753,27 +25914,27 @@ async function replaceFile(target, bytes, mode) {
|
|
|
25753
25914
|
}
|
|
25754
25915
|
}
|
|
25755
25916
|
async function writeBaselineFile(file, bytes, allowedDirs) {
|
|
25756
|
-
if (!
|
|
25917
|
+
if (!path5.isAbsolute(file) || path5.normalize(file) !== file || file.split(/[\\/]/).includes("..") || !file.endsWith(".png") || !allowedDirs.includes(path5.dirname(file))) {
|
|
25757
25918
|
return allowedDirs.length === 0 ? "this call writes no baselines" : `${file} is not a baseline of this call (${allowedDirs.map((d) => `${d}/<name>.png`).join(", ")})`;
|
|
25758
25919
|
}
|
|
25759
25920
|
if (bytes.length > MAX_CONTENT_BYTES) {
|
|
25760
25921
|
return `${file}: the baseline is larger than the 32 MiB cap on a file this client writes`;
|
|
25761
25922
|
}
|
|
25762
|
-
const dir =
|
|
25923
|
+
const dir = path5.dirname(file);
|
|
25763
25924
|
await mkdir3(dir, { recursive: true });
|
|
25764
25925
|
const link = await lstat(file).catch(() => null);
|
|
25765
25926
|
const real = link === null ? null : await realpath2(file).catch(() => null);
|
|
25766
25927
|
if (link !== null && real === null) return `${file} is a symbolic link to a missing file`;
|
|
25767
25928
|
if (real !== null) {
|
|
25768
25929
|
if (!real.endsWith(".png")) return `${file} links to a file that is not a PNG file`;
|
|
25769
|
-
if (
|
|
25930
|
+
if (path5.dirname(real) !== await realpath2(dir)) {
|
|
25770
25931
|
return `${file} links outside its baseline directory`;
|
|
25771
25932
|
}
|
|
25772
25933
|
}
|
|
25773
|
-
const existing = real === null ? null : await
|
|
25934
|
+
const existing = real === null ? null : await stat3(real);
|
|
25774
25935
|
if (existing !== null && !existing.isFile()) return `${file} is not a regular file`;
|
|
25775
25936
|
await replaceFile(
|
|
25776
|
-
real ??
|
|
25937
|
+
real ?? path5.join(await realpath2(dir), path5.basename(file)),
|
|
25777
25938
|
bytes,
|
|
25778
25939
|
existing?.mode
|
|
25779
25940
|
);
|
|
@@ -25799,7 +25960,7 @@ async function applyClientFileDirectives(result, opts = {}) {
|
|
|
25799
25960
|
if (isClientFileDirective2(value)) {
|
|
25800
25961
|
if (!isAllowedClientFilePath(value.path)) return null;
|
|
25801
25962
|
try {
|
|
25802
|
-
await mkdir3(
|
|
25963
|
+
await mkdir3(path5.dirname(value.path), { recursive: true });
|
|
25803
25964
|
await writeFile3(value.path, value.content, "utf8");
|
|
25804
25965
|
written.push(value.path);
|
|
25805
25966
|
return value.path;
|
|
@@ -25827,12 +25988,14 @@ async function applyClientFileDirectives(result, opts = {}) {
|
|
|
25827
25988
|
|
|
25828
25989
|
// ../argent-tools-client/src/flow-files.ts
|
|
25829
25990
|
var import_yaml = __toESM(require_dist2(), 1);
|
|
25830
|
-
import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as
|
|
25831
|
-
import * as
|
|
25991
|
+
import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
|
|
25992
|
+
import * as path6 from "node:path";
|
|
25832
25993
|
var INLINE_MEMBERS_BYTES = 256 * 1024;
|
|
25833
|
-
|
|
25994
|
+
function filesLogEnabled() {
|
|
25995
|
+
return (process.env.ARGENT_E2E_FILES_LOG ?? process.env.ARGENT_FLOW_FILES_LOG) === "1";
|
|
25996
|
+
}
|
|
25834
25997
|
function isWithin(inner, outer) {
|
|
25835
|
-
return inner === outer || inner.startsWith(outer.endsWith(
|
|
25998
|
+
return inner === outer || inner.startsWith(outer.endsWith(path6.sep) ? outer : outer + path6.sep);
|
|
25836
25999
|
}
|
|
25837
26000
|
function printable(text) {
|
|
25838
26001
|
return [...text].map(
|
|
@@ -25840,23 +26003,21 @@ function printable(text) {
|
|
|
25840
26003
|
).join("");
|
|
25841
26004
|
}
|
|
25842
26005
|
function isResolvedAbsolute2(value) {
|
|
25843
|
-
return typeof value === "string" &&
|
|
26006
|
+
return typeof value === "string" && path6.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
|
|
25844
26007
|
}
|
|
25845
26008
|
function namesValidFlow(args) {
|
|
25846
26009
|
const { project_root, flow_path, name } = args;
|
|
25847
26010
|
if (!isResolvedAbsolute2(project_root)) return false;
|
|
25848
26011
|
if (name === void 0) {
|
|
25849
|
-
return isResolvedAbsolute2(flow_path) && FLOW_FILE_NAME_PATTERN.test(
|
|
26012
|
+
return isResolvedAbsolute2(flow_path) && FLOW_FILE_NAME_PATTERN.test(path6.basename(flow_path));
|
|
25850
26013
|
}
|
|
25851
26014
|
return flow_path === void 0 && typeof name === "string" && FLOW_NAME_PATTERN.test(name);
|
|
25852
26015
|
}
|
|
25853
26016
|
function savedFlowProject(file) {
|
|
25854
|
-
if (!
|
|
25855
|
-
|
|
25856
|
-
|
|
25857
|
-
if (
|
|
25858
|
-
return parts.slice(0, i).join(path5.sep) || path5.sep;
|
|
25859
|
-
}
|
|
26017
|
+
if (!path6.isAbsolute(file)) return null;
|
|
26018
|
+
for (let dir = path6.dirname(file); dir !== path6.dirname(dir); dir = path6.dirname(dir)) {
|
|
26019
|
+
const project = e2eDirProject(dir);
|
|
26020
|
+
if (project !== null) return project;
|
|
25860
26021
|
}
|
|
25861
26022
|
return null;
|
|
25862
26023
|
}
|
|
@@ -25869,11 +26030,11 @@ async function landing(spelled) {
|
|
|
25869
26030
|
const canonical = await canonicalFlowPath(spelled);
|
|
25870
26031
|
let at = spelled;
|
|
25871
26032
|
for (; ; ) {
|
|
25872
|
-
const parent =
|
|
26033
|
+
const parent = path6.dirname(at);
|
|
25873
26034
|
if (parent === at) return { canonical, fence: spelled, ...failure2 };
|
|
25874
26035
|
const real = await realpath3(parent).catch(() => null);
|
|
25875
26036
|
if (real !== null) {
|
|
25876
|
-
return { canonical, fence:
|
|
26037
|
+
return { canonical, fence: path6.join(real, path6.basename(at)), ...failure2 };
|
|
25877
26038
|
}
|
|
25878
26039
|
at = parent;
|
|
25879
26040
|
}
|
|
@@ -25881,10 +26042,10 @@ async function landing(spelled) {
|
|
|
25881
26042
|
}
|
|
25882
26043
|
async function closureRoots(rootPath, rootCanonical, projectRoot) {
|
|
25883
26044
|
const candidates = [];
|
|
25884
|
-
if (typeof projectRoot === "string" &&
|
|
25885
|
-
candidates.push(projectRoot,
|
|
26045
|
+
if (typeof projectRoot === "string" && path6.isAbsolute(projectRoot)) {
|
|
26046
|
+
candidates.push(projectRoot, ...e2eDirsFor(projectRoot));
|
|
25886
26047
|
}
|
|
25887
|
-
candidates.push(
|
|
26048
|
+
candidates.push(path6.dirname(rootPath), path6.dirname(rootCanonical));
|
|
25888
26049
|
for (const file of [rootPath, rootCanonical]) {
|
|
25889
26050
|
const project = savedFlowProject(file);
|
|
25890
26051
|
if (project !== null) candidates.push(project);
|
|
@@ -25897,11 +26058,11 @@ async function closureRoots(rootPath, rootCanonical, projectRoot) {
|
|
|
25897
26058
|
return real.filter((root) => !real.some((other) => other !== root && isWithin(root, other)));
|
|
25898
26059
|
}
|
|
25899
26060
|
async function readFlowMember(anchorDir, target, roots, budget, opts) {
|
|
25900
|
-
const spelled = anchorDir +
|
|
26061
|
+
const spelled = anchorDir + path6.sep + target;
|
|
25901
26062
|
const { canonical, fence, missing, error: error2 } = await landing(spelled);
|
|
25902
26063
|
const spelling = await classifyOnDiskSpelling(
|
|
25903
|
-
|
|
25904
|
-
|
|
26064
|
+
path6.dirname(spelled),
|
|
26065
|
+
path6.posix.basename(target),
|
|
25905
26066
|
FLOW_FILE_NAME_PATTERN
|
|
25906
26067
|
);
|
|
25907
26068
|
const member = {
|
|
@@ -25920,13 +26081,13 @@ async function readFlowMember(anchorDir, target, roots, budget, opts) {
|
|
|
25920
26081
|
}
|
|
25921
26082
|
if (error2 !== void 0) return refuse(error2);
|
|
25922
26083
|
if (missing) return { member: { ...member, state: "missing" }, sent: "missing" };
|
|
25923
|
-
const st = await
|
|
26084
|
+
const st = await stat4(canonical).catch((err) => err);
|
|
25924
26085
|
if (st instanceof Error) {
|
|
25925
26086
|
if (st.code !== "ENOENT") return refuse(st.message);
|
|
25926
26087
|
return { member: { ...member, state: "missing" }, sent: "missing" };
|
|
25927
26088
|
}
|
|
25928
26089
|
if (st.isDirectory()) return refuse("EISDIR: illegal operation on a directory, read");
|
|
25929
|
-
if (!/\.ya?ml$/i.test(
|
|
26090
|
+
if (!/\.ya?ml$/i.test(path6.basename(canonical))) {
|
|
25930
26091
|
return refuse(`${target} links to a file that is not a YAML file`);
|
|
25931
26092
|
}
|
|
25932
26093
|
const sent = await sendBytes(member, canonical, budget, opts);
|
|
@@ -25945,7 +26106,7 @@ async function readToolMember(file, roots, budget, opts) {
|
|
|
25945
26106
|
if (!hasToolFileExtension(canonical)) {
|
|
25946
26107
|
return refuse(`${file} links to a file that is not one of ${TOOL_FILE_EXTENSIONS.join(", ")}`);
|
|
25947
26108
|
}
|
|
25948
|
-
const st = await
|
|
26109
|
+
const st = await stat4(canonical).catch((err) => err);
|
|
25949
26110
|
if (st instanceof Error) {
|
|
25950
26111
|
if (st.code === "ENOENT" || st.code === "ENOTDIR") {
|
|
25951
26112
|
return { member: { ...member, state: "missing" }, sent: "missing" };
|
|
@@ -25969,7 +26130,7 @@ async function baselineEntry(file, roots, forWrite) {
|
|
|
25969
26130
|
};
|
|
25970
26131
|
}
|
|
25971
26132
|
if (error2 !== void 0) return { state: "refused", error: error2 };
|
|
25972
|
-
const st = await
|
|
26133
|
+
const st = await stat4(canonical).catch((err) => err);
|
|
25973
26134
|
if (st instanceof Error) {
|
|
25974
26135
|
if (st.code !== "ENOENT") return { state: "refused", error: st.message };
|
|
25975
26136
|
return forWrite ? { state: "refused", error: `${file} is a symbolic link to a missing file` } : { state: "missing" };
|
|
@@ -26019,7 +26180,7 @@ function memberCollector(roots, opts) {
|
|
|
26019
26180
|
const runs = /* @__PURE__ */ new Set();
|
|
26020
26181
|
const baselineDirs = /* @__PURE__ */ new Map();
|
|
26021
26182
|
const budget = { inline: 0 };
|
|
26022
|
-
const logging =
|
|
26183
|
+
const logging = filesLogEnabled();
|
|
26023
26184
|
const log = opts.log ?? ((line) => void process.stderr.write(`${line}
|
|
26024
26185
|
`));
|
|
26025
26186
|
const emit = (member, sent) => {
|
|
@@ -26027,18 +26188,19 @@ function memberCollector(roots, opts) {
|
|
|
26027
26188
|
const subject = member.role === "flow" ? member.canonical : member.key;
|
|
26028
26189
|
if (logging) log(printable(`[flow-files] ${member.role} ${subject}: ${sent}`));
|
|
26029
26190
|
};
|
|
26030
|
-
async function flow(anchorDir, target) {
|
|
26191
|
+
async function flow(anchorDir, target, onlyPresent) {
|
|
26031
26192
|
const key = flowMemberKey(anchorDir, target);
|
|
26032
26193
|
const known = flows.get(key);
|
|
26033
|
-
if (known !== void 0) return known;
|
|
26194
|
+
if (known !== void 0) return onlyPresent && known.text === void 0 ? void 0 : known;
|
|
26034
26195
|
const { member, text, sent } = await readFlowMember(anchorDir, target, roots, budget, opts);
|
|
26196
|
+
if (onlyPresent && text === void 0) return void 0;
|
|
26035
26197
|
const entry = { member, ...text === void 0 ? {} : { text } };
|
|
26036
26198
|
flows.set(key, entry);
|
|
26037
26199
|
emit(member, sent);
|
|
26038
26200
|
return entry;
|
|
26039
26201
|
}
|
|
26040
26202
|
async function toolFiles(step) {
|
|
26041
|
-
if (step.tool === "
|
|
26203
|
+
if (canonicalToolId(step.tool) === "e2e-execute") return;
|
|
26042
26204
|
for (const file of toolStepFiles(opts.toolFileInputs?.(step.tool), step.args)) {
|
|
26043
26205
|
const { unwrapWhenSet } = file.spec;
|
|
26044
26206
|
if (unwrapWhenSet !== void 0 && step.args[unwrapWhenSet] !== void 0) continue;
|
|
@@ -26048,11 +26210,31 @@ function memberCollector(roots, opts) {
|
|
|
26048
26210
|
emit(read.member, read.sent);
|
|
26049
26211
|
}
|
|
26050
26212
|
}
|
|
26213
|
+
async function savedTest(target) {
|
|
26214
|
+
for (const candidate of target.paths) {
|
|
26215
|
+
const found = await flow(path6.dirname(candidate), path6.basename(candidate), true);
|
|
26216
|
+
if (found !== void 0) return found;
|
|
26217
|
+
}
|
|
26218
|
+
let first;
|
|
26219
|
+
for (const candidate of target.paths) {
|
|
26220
|
+
first ??= await flow(path6.dirname(candidate), path6.basename(candidate));
|
|
26221
|
+
}
|
|
26222
|
+
return first;
|
|
26223
|
+
}
|
|
26051
26224
|
async function nestedRun(target, hop, updates, platform) {
|
|
26052
|
-
const { member, text } = await
|
|
26225
|
+
const { member, text } = await savedTest(target);
|
|
26053
26226
|
if (text === void 0 || hop >= MAX_RUN_DEPTH) return void 0;
|
|
26054
26227
|
return { canonical: member.canonical, text, flowName: target.name, hop, updates, platform };
|
|
26055
26228
|
}
|
|
26229
|
+
async function runTarget(anchorDir, target) {
|
|
26230
|
+
const found = await flow(anchorDir, target);
|
|
26231
|
+
if (found.member.spelling?.state !== "absent") return found;
|
|
26232
|
+
for (const dir of e2eRunFallbackDirs(anchorDir, target)) {
|
|
26233
|
+
const other = await flow(dir, target, true);
|
|
26234
|
+
if (other !== void 0) return other;
|
|
26235
|
+
}
|
|
26236
|
+
return found;
|
|
26237
|
+
}
|
|
26056
26238
|
async function walk(start) {
|
|
26057
26239
|
const queue = [...start];
|
|
26058
26240
|
for (let run = queue.shift(); run !== void 0; run = queue.shift()) {
|
|
@@ -26072,12 +26254,12 @@ function memberCollector(roots, opts) {
|
|
|
26072
26254
|
const requests = collectFlowRequests(doc);
|
|
26073
26255
|
for (const name of requests.snapshots) snapshots.add(name);
|
|
26074
26256
|
for (const step of requests.toolSteps) await toolFiles(step);
|
|
26075
|
-
const anchorDir =
|
|
26257
|
+
const anchorDir = path6.dirname(file.canonical);
|
|
26076
26258
|
for (const target of requests.runTargets) {
|
|
26077
26259
|
const key = flowMemberKey(anchorDir, target);
|
|
26078
26260
|
if (visited.has(key)) continue;
|
|
26079
26261
|
visited.add(key);
|
|
26080
|
-
const { member, text } = await
|
|
26262
|
+
const { member, text } = await runTarget(anchorDir, target);
|
|
26081
26263
|
if (text !== void 0 && file.hop + 1 < MAX_RUN_DEPTH) {
|
|
26082
26264
|
files.push({ canonical: member.canonical, text, hop: file.hop + 1 });
|
|
26083
26265
|
}
|
|
@@ -26094,8 +26276,8 @@ function memberCollector(roots, opts) {
|
|
|
26094
26276
|
}
|
|
26095
26277
|
}
|
|
26096
26278
|
if (snapshots.size === 0) continue;
|
|
26097
|
-
const dir =
|
|
26098
|
-
|
|
26279
|
+
const dir = path6.join(
|
|
26280
|
+
path6.dirname(run.canonical),
|
|
26099
26281
|
"__baselines__",
|
|
26100
26282
|
baselineKeyFor(run.canonical, run.flowName)
|
|
26101
26283
|
);
|
|
@@ -26119,7 +26301,7 @@ function memberCollector(roots, opts) {
|
|
|
26119
26301
|
if (!name.endsWith(".png")) continue;
|
|
26120
26302
|
const compared = [...prefixes].some((prefix) => name.startsWith(prefix));
|
|
26121
26303
|
if (!updates && !compared) continue;
|
|
26122
|
-
const file =
|
|
26304
|
+
const file = path6.join(dir, name);
|
|
26123
26305
|
if (tools.has(file)) continue;
|
|
26124
26306
|
const member = { role: "baseline", key: file, path: file };
|
|
26125
26307
|
const entry = await baselineEntry(file, roots, updates && !compared);
|
|
@@ -26142,8 +26324,8 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
|
|
|
26142
26324
|
if (!namesValidFlow(args)) return {};
|
|
26143
26325
|
const canonical = await canonicalFlowPath(rootPath);
|
|
26144
26326
|
const spelling = await classifyOnDiskSpelling(
|
|
26145
|
-
|
|
26146
|
-
|
|
26327
|
+
path6.dirname(rootPath),
|
|
26328
|
+
path6.basename(rootPath),
|
|
26147
26329
|
FLOW_FILE_NAME_PATTERN
|
|
26148
26330
|
);
|
|
26149
26331
|
const collector = memberCollector(
|
|
@@ -26154,7 +26336,7 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
|
|
|
26154
26336
|
{
|
|
26155
26337
|
canonical,
|
|
26156
26338
|
text: rootBytes.toString("utf8"),
|
|
26157
|
-
flowName:
|
|
26339
|
+
flowName: path6.basename(rootPath, ".yaml"),
|
|
26158
26340
|
hop: 0,
|
|
26159
26341
|
updates: args.updateBaselines === true,
|
|
26160
26342
|
platform: callPlatform(args)
|
|
@@ -26177,33 +26359,37 @@ function recordedStep(args) {
|
|
|
26177
26359
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
|
|
26178
26360
|
return { tool: command, args: parsed };
|
|
26179
26361
|
}
|
|
26180
|
-
async function collectStepMembers(args, opts) {
|
|
26362
|
+
async function collectStepMembers(args, opts, recordingDirFor = e2eDirFor) {
|
|
26181
26363
|
const { name, project_root: projectRoot } = args;
|
|
26182
26364
|
const step = recordedStep(args);
|
|
26183
|
-
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || typeof projectRoot !== "string" || !
|
|
26365
|
+
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || typeof projectRoot !== "string" || !path6.isAbsolute(projectRoot) || step === void 0) {
|
|
26184
26366
|
return [];
|
|
26185
26367
|
}
|
|
26186
|
-
const recording =
|
|
26368
|
+
const recording = path6.join(recordingDirFor(projectRoot), `${name}.yaml`);
|
|
26187
26369
|
const collector = memberCollector(
|
|
26188
26370
|
await closureRoots(recording, (await landing(recording)).canonical, projectRoot),
|
|
26189
26371
|
opts
|
|
26190
26372
|
);
|
|
26191
26373
|
await collector.toolFiles(step);
|
|
26192
|
-
if (step.tool === "
|
|
26193
|
-
const self = await collector.flow(
|
|
26374
|
+
if (canonicalToolId(step.tool) === "e2e-execute") {
|
|
26375
|
+
const self = await collector.flow(path6.dirname(recording), path6.basename(recording));
|
|
26194
26376
|
let runArgs = step.args;
|
|
26195
26377
|
const named = nestedFlowTarget(runArgs);
|
|
26196
26378
|
if (named?.kind === "flow_path") {
|
|
26197
|
-
const stem =
|
|
26198
|
-
|
|
26199
|
-
|
|
26379
|
+
const stem = path6.basename(named.path, ".yaml");
|
|
26380
|
+
const base = path6.basename(named.path);
|
|
26381
|
+
const dir = path6.resolve(path6.dirname(named.path));
|
|
26382
|
+
const recordingDir = path6.dirname(recording);
|
|
26383
|
+
const dirs = [recordingDir, ...e2eRunFallbackDirs(recordingDir, base)];
|
|
26384
|
+
if (dirs.some((d) => path6.resolve(d) === dir)) {
|
|
26385
|
+
await collector.flow(path6.dirname(named.path), base);
|
|
26200
26386
|
runArgs = { ...runArgs, name: stem };
|
|
26201
26387
|
delete runArgs.flow_path;
|
|
26202
26388
|
}
|
|
26203
26389
|
}
|
|
26204
26390
|
const target = nestedFlowTarget(runArgs);
|
|
26205
26391
|
if (target?.kind === "name") {
|
|
26206
|
-
await collector.flow(
|
|
26392
|
+
await collector.flow(path6.dirname(self.member.canonical), `${target.name}.yaml`);
|
|
26207
26393
|
const run = await collector.nestedRun(
|
|
26208
26394
|
target,
|
|
26209
26395
|
0,
|
|
@@ -26216,6 +26402,43 @@ async function collectStepMembers(args, opts) {
|
|
|
26216
26402
|
await collector.sendBaselines();
|
|
26217
26403
|
return collector.members;
|
|
26218
26404
|
}
|
|
26405
|
+
async function nameToE2ePathForOlderServer(tool, fileInputs, args) {
|
|
26406
|
+
const id = canonicalToolId(tool);
|
|
26407
|
+
if (id !== "e2e-execute" && id !== "e2e-read-prerequisite") return args;
|
|
26408
|
+
const spec = fileInputs?.find((s) => s.target === "flow_file");
|
|
26409
|
+
if (spec === void 0 || spec.kind !== "file" || spec.paths?.length) return args;
|
|
26410
|
+
const target = nestedFlowTarget(args);
|
|
26411
|
+
if (target?.kind !== "name") return args;
|
|
26412
|
+
const picked = await pickE2eFile(target.paths);
|
|
26413
|
+
if (!picked.exists || picked.legacy) return args;
|
|
26414
|
+
const { name: _name, ...rest } = args;
|
|
26415
|
+
return { ...rest, flow_path: picked.path };
|
|
26416
|
+
}
|
|
26417
|
+
async function stepForOlderServer(args, listedId) {
|
|
26418
|
+
if (typeof args !== "object" || args === null || Array.isArray(args)) return args;
|
|
26419
|
+
const record2 = args;
|
|
26420
|
+
if (typeof record2.command !== "string") return args;
|
|
26421
|
+
const command = listedId(record2.command) ?? record2.command;
|
|
26422
|
+
const step = recordedStep({ ...record2, command });
|
|
26423
|
+
const target = step && canonicalToolId(step.tool) === "e2e-execute" && nestedFlowTarget(step.args);
|
|
26424
|
+
if (target && target.kind === "name") {
|
|
26425
|
+
const picked = await pickE2eFile(target.paths);
|
|
26426
|
+
if (picked.exists && !picked.legacy) {
|
|
26427
|
+
throw new Error(
|
|
26428
|
+
`Cannot record a nested ${record2.command} of "${target.name}": the tool-server runs an older argent that records and runs nested e2e tests only from .argent/flows/, and "${target.name}" is ${picked.path}. Upgrade the tool-server to record it, or run it with e2e-execute outside the recording.`
|
|
26429
|
+
);
|
|
26430
|
+
}
|
|
26431
|
+
}
|
|
26432
|
+
return command === record2.command ? args : { ...record2, command };
|
|
26433
|
+
}
|
|
26434
|
+
async function e2eShadowWarningFor(tool, args) {
|
|
26435
|
+
const id = canonicalToolId(tool);
|
|
26436
|
+
if (id !== "e2e-execute" && id !== "e2e-read-prerequisite") return void 0;
|
|
26437
|
+
const target = nestedFlowTarget(args);
|
|
26438
|
+
if (target?.kind !== "name") return void 0;
|
|
26439
|
+
const picked = await pickE2eFile(target.paths);
|
|
26440
|
+
return picked.shadowed === void 0 ? void 0 : e2eShadowWarning(picked.path, picked.shadowed);
|
|
26441
|
+
}
|
|
26219
26442
|
|
|
26220
26443
|
// ../argent-tools-client/src/tools-client.ts
|
|
26221
26444
|
function authHeaders2(token) {
|
|
@@ -26293,6 +26516,10 @@ function errorBodyMessage(body) {
|
|
|
26293
26516
|
if (Array.isArray(body.issues) && typeof body.message === "string") return body.message;
|
|
26294
26517
|
return body.error ?? body.message;
|
|
26295
26518
|
}
|
|
26519
|
+
function findTool(tools, name) {
|
|
26520
|
+
const id = canonicalToolId(name);
|
|
26521
|
+
return tools.find((t) => t.name === name) ?? tools.find((t) => canonicalToolId(t.name) === id) ?? null;
|
|
26522
|
+
}
|
|
26296
26523
|
function assertRequiredPresent(meta2, args) {
|
|
26297
26524
|
const record2 = typeof args === "object" && args !== null ? args : {};
|
|
26298
26525
|
const schema = meta2.inputSchema;
|
|
@@ -26368,26 +26595,33 @@ function createToolsClient(options = {}) {
|
|
|
26368
26595
|
return json.tools;
|
|
26369
26596
|
}
|
|
26370
26597
|
async function fetchTool(name, opts) {
|
|
26371
|
-
|
|
26372
|
-
return tools.find((t) => t.name === name) ?? null;
|
|
26598
|
+
return findTool(await fetchTools(opts), name);
|
|
26373
26599
|
}
|
|
26374
26600
|
async function callTool(name, args, opts) {
|
|
26375
26601
|
opts?.signal?.throwIfAborted();
|
|
26376
26602
|
const { url, token, remote } = await route();
|
|
26377
26603
|
let finalArgs = args;
|
|
26378
26604
|
const tools = await fetchTools({ signal: opts?.signal });
|
|
26379
|
-
const meta2 = tools
|
|
26605
|
+
const meta2 = findTool(tools, name);
|
|
26606
|
+
const olderServer = meta2 !== null && !tools.some((t) => t.name === canonicalToolId(meta2.name));
|
|
26607
|
+
if (meta2) {
|
|
26608
|
+
finalArgs = await nameToE2ePathForOlderServer(meta2.name, meta2.fileInputs, args);
|
|
26609
|
+
}
|
|
26610
|
+
if (olderServer && canonicalToolId(meta2.name) === "e2e-add-step") {
|
|
26611
|
+
finalArgs = await stepForOlderServer(finalArgs, (tool) => findTool(tools, tool)?.name);
|
|
26612
|
+
}
|
|
26613
|
+
const shadowWarning = await e2eShadowWarningFor(name, args);
|
|
26380
26614
|
const baselineDirs = [];
|
|
26381
26615
|
if (meta2?.fileInputs?.length) {
|
|
26382
|
-
if (remote) assertRequiredPresent(meta2,
|
|
26383
|
-
finalArgs = await prepareFileInputs(meta2.fileInputs,
|
|
26616
|
+
if (remote) assertRequiredPresent(meta2, finalArgs);
|
|
26617
|
+
finalArgs = await prepareFileInputs(meta2.fileInputs, finalArgs ?? {}, {
|
|
26384
26618
|
includeContent: remote,
|
|
26385
26619
|
uploadEndpoint: remote ? { url, token } : void 0,
|
|
26386
26620
|
log: diagnose,
|
|
26387
26621
|
baselineDirs,
|
|
26388
26622
|
collectMembers: collectFlowMembers,
|
|
26389
|
-
collectStepMembers,
|
|
26390
|
-
toolFileInputs: (tool) => tools
|
|
26623
|
+
collectStepMembers: olderServer ? (record2, o) => collectStepMembers(record2, o, (root) => path7.join(root, LEGACY_E2E_DIRS[0])) : collectStepMembers,
|
|
26624
|
+
toolFileInputs: (tool) => findTool(tools, tool)?.fileInputs,
|
|
26391
26625
|
signal: opts?.signal
|
|
26392
26626
|
});
|
|
26393
26627
|
}
|
|
@@ -26396,19 +26630,23 @@ function createToolsClient(options = {}) {
|
|
|
26396
26630
|
for (const { path: file, error: error2 } of applied.failed) {
|
|
26397
26631
|
diagnose(`The baseline ${file} was not written on this client: ${error2}`);
|
|
26398
26632
|
}
|
|
26399
|
-
if (
|
|
26633
|
+
if (filesLogEnabled()) {
|
|
26400
26634
|
for (const file of applied.written) {
|
|
26401
|
-
if (baselineDirs.includes(
|
|
26635
|
+
if (baselineDirs.includes(path7.dirname(file))) {
|
|
26402
26636
|
diagnose(`[flow-files] baseline ${file}: written`);
|
|
26403
26637
|
}
|
|
26404
26638
|
}
|
|
26405
26639
|
}
|
|
26406
|
-
|
|
26640
|
+
const result = applied.result;
|
|
26641
|
+
if (shadowWarning === void 0 || typeof result !== "object" || result === null || Array.isArray(result) || typeof result.warning === "string") {
|
|
26642
|
+
return result;
|
|
26643
|
+
}
|
|
26644
|
+
return { ...result, warning: shadowWarning };
|
|
26407
26645
|
};
|
|
26408
26646
|
const stream = opts?.onProgress !== void 0 || carriesMembers(finalArgs);
|
|
26409
26647
|
const sentOnce = carriesUpload(finalArgs);
|
|
26410
26648
|
const res = await doFetch(
|
|
26411
|
-
`${url}/tools/${encodeURIComponent(name)}`,
|
|
26649
|
+
`${url}/tools/${encodeURIComponent(meta2?.name ?? name)}`,
|
|
26412
26650
|
{
|
|
26413
26651
|
method: "POST",
|
|
26414
26652
|
headers: {
|
|
@@ -26416,6 +26654,9 @@ function createToolsClient(options = {}) {
|
|
|
26416
26654
|
// Tells the tool-server the call came over a link, a link to
|
|
26417
26655
|
// 127.0.0.1 included, which nothing else in the request shows.
|
|
26418
26656
|
...remote ? { [LINKED_CALL_HEADER]: "1" } : {},
|
|
26657
|
+
// Tells the tool-server this client writes recordings under
|
|
26658
|
+
// `.argent/e2e/`; an older client writes only `.argent/flows/`.
|
|
26659
|
+
[E2E_DIR_CLIENT_HEADER]: "1",
|
|
26419
26660
|
// A proxy that compresses the stream holds each line until its buffer
|
|
26420
26661
|
// fills. `identity` keeps the stream uncompressed end to end.
|
|
26421
26662
|
...stream ? { "Accept": "application/x-ndjson", "Accept-Encoding": "identity" } : {},
|
|
@@ -26473,43 +26714,43 @@ function createToolsClient(options = {}) {
|
|
|
26473
26714
|
}
|
|
26474
26715
|
|
|
26475
26716
|
// ../argent-tools-client/src/artifacts.ts
|
|
26476
|
-
import { copyFile, mkdir as mkdir4, readFile as readFile5, realpath as realpath4, rm as rm3, stat as
|
|
26717
|
+
import { copyFile, mkdir as mkdir4, readFile as readFile5, realpath as realpath4, rm as rm3, stat as stat5, writeFile as writeFile4 } from "node:fs/promises";
|
|
26477
26718
|
import { constants as fsConstants } from "node:fs";
|
|
26478
26719
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
26479
|
-
import { basename as
|
|
26720
|
+
import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve8, sep as sep4 } from "node:path";
|
|
26480
26721
|
import { createHash as createHash3 } from "node:crypto";
|
|
26481
26722
|
|
|
26482
26723
|
// ../configuration-core/src/flags.ts
|
|
26483
|
-
import * as
|
|
26484
|
-
import * as
|
|
26724
|
+
import * as fs4 from "node:fs";
|
|
26725
|
+
import * as path8 from "node:path";
|
|
26485
26726
|
import { homedir as homedir3 } from "node:os";
|
|
26486
26727
|
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
26487
26728
|
function findProjectRoot(startDir) {
|
|
26488
|
-
let current =
|
|
26729
|
+
let current = path8.resolve(startDir);
|
|
26489
26730
|
while (true) {
|
|
26490
26731
|
for (const marker of PROJECT_MARKERS) {
|
|
26491
|
-
if (
|
|
26732
|
+
if (fs4.existsSync(path8.join(current, marker))) return current;
|
|
26492
26733
|
}
|
|
26493
|
-
const parent =
|
|
26734
|
+
const parent = path8.dirname(current);
|
|
26494
26735
|
if (parent === current) return null;
|
|
26495
26736
|
current = parent;
|
|
26496
26737
|
}
|
|
26497
26738
|
}
|
|
26498
26739
|
function resolveProjectRoot(startDir) {
|
|
26499
|
-
return findProjectRoot(startDir) ??
|
|
26740
|
+
return findProjectRoot(startDir) ?? path8.resolve(startDir);
|
|
26500
26741
|
}
|
|
26501
26742
|
function getFlagsPath(scope, options = {}) {
|
|
26502
26743
|
const home = options.homeDir ?? homedir3();
|
|
26503
26744
|
if (scope === "global") {
|
|
26504
|
-
return
|
|
26745
|
+
return path8.join(home, ".argent", "flags.json");
|
|
26505
26746
|
}
|
|
26506
26747
|
const cwd = options.cwd ?? process.cwd();
|
|
26507
|
-
return
|
|
26748
|
+
return path8.join(resolveProjectRoot(cwd), ".argent", "flags.json");
|
|
26508
26749
|
}
|
|
26509
26750
|
function readFlagsFile(filePath) {
|
|
26510
26751
|
let raw;
|
|
26511
26752
|
try {
|
|
26512
|
-
raw =
|
|
26753
|
+
raw = fs4.readFileSync(filePath, "utf8");
|
|
26513
26754
|
} catch {
|
|
26514
26755
|
return {};
|
|
26515
26756
|
}
|
|
@@ -26541,7 +26782,7 @@ function isFlagEnabled(name, options = {}) {
|
|
|
26541
26782
|
|
|
26542
26783
|
// ../configuration-core/src/paths.ts
|
|
26543
26784
|
import * as os from "node:os";
|
|
26544
|
-
import * as
|
|
26785
|
+
import * as path9 from "node:path";
|
|
26545
26786
|
function nonEmpty(value) {
|
|
26546
26787
|
if (value == void 0) return null;
|
|
26547
26788
|
const trimmed = value.trim();
|
|
@@ -26552,26 +26793,26 @@ function resolveHomeDir(options = {}) {
|
|
|
26552
26793
|
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
26553
26794
|
}
|
|
26554
26795
|
function argentHomeDir() {
|
|
26555
|
-
return
|
|
26796
|
+
return path9.join(resolveHomeDir(), ".argent");
|
|
26556
26797
|
}
|
|
26557
26798
|
function configDir(scope = "global", options = {}) {
|
|
26558
26799
|
if (scope === "global") {
|
|
26559
|
-
return
|
|
26800
|
+
return path9.join(resolveHomeDir(options), ".argent");
|
|
26560
26801
|
}
|
|
26561
26802
|
const cwd = options.cwd ?? process.cwd();
|
|
26562
|
-
return
|
|
26803
|
+
return path9.join(resolveProjectRoot(cwd), ".argent");
|
|
26563
26804
|
}
|
|
26564
26805
|
function configFilePath(scope = "global", options = {}) {
|
|
26565
|
-
return
|
|
26806
|
+
return path9.join(configDir(scope, options), "config.json");
|
|
26566
26807
|
}
|
|
26567
26808
|
|
|
26568
26809
|
// ../configuration-core/src/config.ts
|
|
26569
26810
|
import * as crypto from "node:crypto";
|
|
26570
|
-
import * as
|
|
26571
|
-
import * as
|
|
26811
|
+
import * as fs5 from "node:fs";
|
|
26812
|
+
import * as path10 from "node:path";
|
|
26572
26813
|
function readConfigObject(scope = "global", options = {}) {
|
|
26573
26814
|
try {
|
|
26574
|
-
const raw =
|
|
26815
|
+
const raw = fs5.readFileSync(configFilePath(scope, options), "utf8");
|
|
26575
26816
|
const json = JSON.parse(raw);
|
|
26576
26817
|
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
26577
26818
|
return json;
|
|
@@ -26616,9 +26857,9 @@ function acquireConfigLock(finalPath) {
|
|
|
26616
26857
|
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
26617
26858
|
for (; ; ) {
|
|
26618
26859
|
try {
|
|
26619
|
-
const fd =
|
|
26860
|
+
const fd = fs5.openSync(lockPath, "wx", 384);
|
|
26620
26861
|
try {
|
|
26621
|
-
|
|
26862
|
+
fs5.writeSync(fd, `${process.pid}
|
|
26622
26863
|
`);
|
|
26623
26864
|
} catch {
|
|
26624
26865
|
}
|
|
@@ -26626,8 +26867,8 @@ function acquireConfigLock(finalPath) {
|
|
|
26626
26867
|
} catch (err) {
|
|
26627
26868
|
if (err.code !== "EEXIST") return null;
|
|
26628
26869
|
try {
|
|
26629
|
-
if (Date.now() -
|
|
26630
|
-
|
|
26870
|
+
if (Date.now() - fs5.statSync(lockPath).mtimeMs > LOCK_STALE_MS2) {
|
|
26871
|
+
fs5.unlinkSync(lockPath);
|
|
26631
26872
|
continue;
|
|
26632
26873
|
}
|
|
26633
26874
|
} catch {
|
|
@@ -26639,35 +26880,35 @@ function acquireConfigLock(finalPath) {
|
|
|
26639
26880
|
}
|
|
26640
26881
|
function releaseConfigLock(lock) {
|
|
26641
26882
|
try {
|
|
26642
|
-
|
|
26883
|
+
fs5.closeSync(lock.fd);
|
|
26643
26884
|
} catch {
|
|
26644
26885
|
}
|
|
26645
26886
|
try {
|
|
26646
|
-
|
|
26887
|
+
fs5.unlinkSync(lock.lockPath);
|
|
26647
26888
|
} catch {
|
|
26648
26889
|
}
|
|
26649
26890
|
}
|
|
26650
26891
|
function updateConfig(mutate, scope = "global", options = {}) {
|
|
26651
26892
|
const dir = configDir(scope, options);
|
|
26652
|
-
|
|
26893
|
+
fs5.mkdirSync(dir, { recursive: true });
|
|
26653
26894
|
const finalPath = configFilePath(scope, options);
|
|
26654
26895
|
const lock = acquireConfigLock(finalPath);
|
|
26655
26896
|
try {
|
|
26656
26897
|
const next = readConfigObject(scope, options);
|
|
26657
26898
|
mutate(next);
|
|
26658
|
-
const tmpPath =
|
|
26659
|
-
const fd =
|
|
26899
|
+
const tmpPath = path10.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
26900
|
+
const fd = fs5.openSync(tmpPath, "wx", 384);
|
|
26660
26901
|
try {
|
|
26661
|
-
|
|
26662
|
-
|
|
26902
|
+
fs5.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
26903
|
+
fs5.fsyncSync(fd);
|
|
26663
26904
|
} finally {
|
|
26664
|
-
|
|
26905
|
+
fs5.closeSync(fd);
|
|
26665
26906
|
}
|
|
26666
26907
|
try {
|
|
26667
|
-
|
|
26908
|
+
fs5.renameSync(tmpPath, finalPath);
|
|
26668
26909
|
} catch (err) {
|
|
26669
26910
|
try {
|
|
26670
|
-
|
|
26911
|
+
fs5.unlinkSync(tmpPath);
|
|
26671
26912
|
} catch {
|
|
26672
26913
|
}
|
|
26673
26914
|
throw err;
|
|
@@ -26678,9 +26919,9 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
26678
26919
|
}
|
|
26679
26920
|
|
|
26680
26921
|
// ../configuration-core/src/secrets.ts
|
|
26681
|
-
var import_dotenv = __toESM(
|
|
26682
|
-
import * as
|
|
26683
|
-
import * as
|
|
26922
|
+
var import_dotenv = __toESM(require_dist3(), 1);
|
|
26923
|
+
import * as fs6 from "node:fs";
|
|
26924
|
+
import * as path11 from "node:path";
|
|
26684
26925
|
|
|
26685
26926
|
// ../configuration-core/src/merge.ts
|
|
26686
26927
|
function mergeRestrictive(local, global) {
|
|
@@ -26824,7 +27065,7 @@ var CONFIG_SCHEMA = [
|
|
|
26824
27065
|
// nominal here — the project scope of a global-only key is never read.
|
|
26825
27066
|
{
|
|
26826
27067
|
key: "scripts.maxTimeoutMs",
|
|
26827
|
-
description: `Upper bound, in milliseconds, on the time limit
|
|
27068
|
+
description: `Upper bound, in milliseconds, on the time limit an e2e test \`script\` step may ask for (default 300000 \u2014 five minutes). Bounds how long one script can occupy the host. Values below ${MIN_SCRIPT_TIMEOUT_MS} ms are refused: the step starts a Node process before the script runs, so a smaller ceiling ends a script that did nothing wrong.`,
|
|
26828
27069
|
scopes: ["global"],
|
|
26829
27070
|
parse: (raw) => {
|
|
26830
27071
|
const value = asPositiveInteger(raw);
|
|
@@ -26837,7 +27078,7 @@ var CONFIG_SCHEMA = [
|
|
|
26837
27078
|
},
|
|
26838
27079
|
{
|
|
26839
27080
|
key: "scripts.heapLimitMb",
|
|
26840
|
-
description: `Old-space heap limit, in MiB, given to each
|
|
27081
|
+
description: `Old-space heap limit, in MiB, given to each e2e test \`script\` process (default 512). Values below ${MIN_SCRIPT_HEAP_LIMIT_MB} MiB are refused: that is already below what importing a real npm dependency needs, and under about 5 MiB the process dies inside V8's own startup before any script runs.`,
|
|
26841
27082
|
scopes: ["global"],
|
|
26842
27083
|
parse: (raw) => {
|
|
26843
27084
|
const value = asPositiveInteger(raw);
|
|
@@ -26854,7 +27095,7 @@ function getConfigDefinition(key, registry2 = CONFIG_SCHEMA) {
|
|
|
26854
27095
|
}
|
|
26855
27096
|
|
|
26856
27097
|
// ../configuration-core/src/config-access.ts
|
|
26857
|
-
import * as
|
|
27098
|
+
import * as path12 from "node:path";
|
|
26858
27099
|
function readScopeValue(def, scope, options) {
|
|
26859
27100
|
if (!def.scopes.includes(scope)) return void 0;
|
|
26860
27101
|
const raw = getAtPath(readConfigObject(scope, options), def.key);
|
|
@@ -26905,20 +27146,20 @@ function sanitizeSegment(segment) {
|
|
|
26905
27146
|
function projectSlug() {
|
|
26906
27147
|
const cwd = process.cwd();
|
|
26907
27148
|
const hash = createHash3("sha1").update(cwd).digest("hex").slice(0, 6);
|
|
26908
|
-
const name = sanitizeSegment(
|
|
27149
|
+
const name = sanitizeSegment(basename7(cwd)) || "root";
|
|
26909
27150
|
return `${name}-${hash}`;
|
|
26910
27151
|
}
|
|
26911
27152
|
function artifactsRoot() {
|
|
26912
|
-
return process.env.ARGENT_ARTIFACTS_DIR ??
|
|
27153
|
+
return process.env.ARGENT_ARTIFACTS_DIR ?? join13(tmpdir2(), "argent-artifacts");
|
|
26913
27154
|
}
|
|
26914
27155
|
function artifactDir(deviceId) {
|
|
26915
27156
|
const parts = [artifactsRoot(), projectSlug(), sessionId()];
|
|
26916
27157
|
if (deviceId) parts.push(sanitizeSegment(deviceId));
|
|
26917
|
-
return
|
|
27158
|
+
return join13(...parts);
|
|
26918
27159
|
}
|
|
26919
27160
|
function durableBaseDir() {
|
|
26920
27161
|
const projectRoot = findProjectRoot(process.cwd());
|
|
26921
|
-
return projectRoot ??
|
|
27162
|
+
return projectRoot ?? dirname9(argentHomeDir());
|
|
26922
27163
|
}
|
|
26923
27164
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
|
|
26924
27165
|
var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
|
|
@@ -26932,9 +27173,9 @@ function configuredRecordingsDir() {
|
|
|
26932
27173
|
if (typeof value !== "string") return null;
|
|
26933
27174
|
const trimmed = value.trim();
|
|
26934
27175
|
if (trimmed === "") return null;
|
|
26935
|
-
const home =
|
|
26936
|
-
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep4}`) ?
|
|
26937
|
-
return
|
|
27176
|
+
const home = dirname9(argentHomeDir());
|
|
27177
|
+
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep4}`) ? join13(home, trimmed.slice(2)) : trimmed;
|
|
27178
|
+
return resolve8(durableBaseDir(), expanded);
|
|
26938
27179
|
}
|
|
26939
27180
|
var MAX_DURABLE_BYTES = 2 * 1024 * 1024 * 1024;
|
|
26940
27181
|
async function readCapped(res, cap) {
|
|
@@ -26967,10 +27208,10 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
26967
27208
|
const stem = filename.slice(0, filename.length - ext.length);
|
|
26968
27209
|
for (let i = 1; i <= 1e3; i++) {
|
|
26969
27210
|
const candidate = i === 1 ? filename : `${stem} (${i})${ext}`;
|
|
26970
|
-
const
|
|
27211
|
+
const path17 = join13(dir, candidate);
|
|
26971
27212
|
try {
|
|
26972
|
-
await write(
|
|
26973
|
-
return
|
|
27213
|
+
await write(path17);
|
|
27214
|
+
return path17;
|
|
26974
27215
|
} catch (err) {
|
|
26975
27216
|
if (err?.code === "EEXIST") continue;
|
|
26976
27217
|
throw err;
|
|
@@ -26990,21 +27231,21 @@ function durableSaveTarget(handle) {
|
|
|
26990
27231
|
if (configured) {
|
|
26991
27232
|
return {
|
|
26992
27233
|
dir: configured,
|
|
26993
|
-
path:
|
|
27234
|
+
path: join13(configured, sanitizeSegment(handle.filename)),
|
|
26994
27235
|
base: configured,
|
|
26995
27236
|
rel: ""
|
|
26996
27237
|
};
|
|
26997
27238
|
}
|
|
26998
27239
|
}
|
|
26999
27240
|
const base = durableBaseDir();
|
|
27000
|
-
const dir =
|
|
27001
|
-
return { dir, path:
|
|
27241
|
+
const dir = join13(base, rel);
|
|
27242
|
+
return { dir, path: join13(dir, sanitizeSegment(handle.filename)), base, rel };
|
|
27002
27243
|
}
|
|
27003
27244
|
async function confineToRealBase(dir, base, rel) {
|
|
27004
27245
|
try {
|
|
27005
27246
|
const realDir = await realpath4(dir);
|
|
27006
27247
|
const realBase = await realpath4(base);
|
|
27007
|
-
return realDir ===
|
|
27248
|
+
return realDir === join13(realBase, rel);
|
|
27008
27249
|
} catch {
|
|
27009
27250
|
return false;
|
|
27010
27251
|
}
|
|
@@ -27012,7 +27253,7 @@ async function confineToRealBase(dir, base, rel) {
|
|
|
27012
27253
|
async function resolveLocalFile(handle) {
|
|
27013
27254
|
if (!handle.hostPath) return null;
|
|
27014
27255
|
try {
|
|
27015
|
-
const st = await
|
|
27256
|
+
const st = await stat5(handle.hostPath);
|
|
27016
27257
|
if (handle.archive) {
|
|
27017
27258
|
return st.isDirectory() ? handle.hostPath : null;
|
|
27018
27259
|
}
|
|
@@ -27027,7 +27268,7 @@ async function resolveLocalFile(handle) {
|
|
|
27027
27268
|
}
|
|
27028
27269
|
}
|
|
27029
27270
|
async function downloadAndExtractArchive(handle, data, dir) {
|
|
27030
|
-
const tarball =
|
|
27271
|
+
const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
|
|
27031
27272
|
try {
|
|
27032
27273
|
await writeFile4(tarball, data);
|
|
27033
27274
|
return await safeExtractTarGz(tarball, dir, handle.filename);
|
|
@@ -27055,7 +27296,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
27055
27296
|
const localPath = await resolveLocalFile(value);
|
|
27056
27297
|
const saveTarget = durableSaveTarget(value);
|
|
27057
27298
|
if (saveTarget) {
|
|
27058
|
-
const filename =
|
|
27299
|
+
const filename = basename7(saveTarget.path);
|
|
27059
27300
|
try {
|
|
27060
27301
|
await mkdir4(saveTarget.dir, { recursive: true });
|
|
27061
27302
|
if (!await confineToRealBase(saveTarget.dir, saveTarget.base, saveTarget.rel)) {
|
|
@@ -27119,7 +27360,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
27119
27360
|
return await downloadAndExtractArchive(value, data, dir);
|
|
27120
27361
|
}
|
|
27121
27362
|
if (value.size > 0 && data.length !== value.size) return null;
|
|
27122
|
-
const downloadedPath =
|
|
27363
|
+
const downloadedPath = join13(dir, sanitizeSegment(value.filename));
|
|
27123
27364
|
await writeFile4(downloadedPath, data);
|
|
27124
27365
|
if (value.mimeType.startsWith("image/")) {
|
|
27125
27366
|
images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
|
|
@@ -27153,10 +27394,10 @@ function getDeviceIdFromArgs(args) {
|
|
|
27153
27394
|
}
|
|
27154
27395
|
|
|
27155
27396
|
// ../telemetry/src/debug.ts
|
|
27156
|
-
import * as
|
|
27397
|
+
import * as fs7 from "node:fs";
|
|
27157
27398
|
|
|
27158
27399
|
// ../telemetry/src/paths.ts
|
|
27159
|
-
import * as
|
|
27400
|
+
import * as path13 from "node:path";
|
|
27160
27401
|
|
|
27161
27402
|
// ../telemetry/src/events.ts
|
|
27162
27403
|
var PLATFORMS = [
|
|
@@ -27381,6 +27622,7 @@ var ALLOWED = {
|
|
|
27381
27622
|
"tool:invoke": {
|
|
27382
27623
|
device_provider: DEVICE_PROVIDER,
|
|
27383
27624
|
tool: TOOL_NAME,
|
|
27625
|
+
alias_used: bool,
|
|
27384
27626
|
tool_invocation_id: UUID,
|
|
27385
27627
|
platform: PLATFORM,
|
|
27386
27628
|
device_kind: DEVICE_KIND,
|
|
@@ -27389,6 +27631,7 @@ var ALLOWED = {
|
|
|
27389
27631
|
"tool:complete": {
|
|
27390
27632
|
device_provider: DEVICE_PROVIDER,
|
|
27391
27633
|
tool: TOOL_NAME,
|
|
27634
|
+
alias_used: bool,
|
|
27392
27635
|
tool_invocation_id: UUID,
|
|
27393
27636
|
platform: PLATFORM,
|
|
27394
27637
|
device_kind: DEVICE_KIND,
|
|
@@ -27398,6 +27641,7 @@ var ALLOWED = {
|
|
|
27398
27641
|
"tool:fail": {
|
|
27399
27642
|
device_provider: DEVICE_PROVIDER,
|
|
27400
27643
|
tool: TOOL_NAME,
|
|
27644
|
+
alias_used: bool,
|
|
27401
27645
|
tool_invocation_id: UUID,
|
|
27402
27646
|
platform: PLATFORM,
|
|
27403
27647
|
device_kind: DEVICE_KIND,
|
|
@@ -27416,6 +27660,7 @@ var ALLOWED = {
|
|
|
27416
27660
|
},
|
|
27417
27661
|
"cli:run_fail": {
|
|
27418
27662
|
tool: TOOL_NAME,
|
|
27663
|
+
alias_used: bool,
|
|
27419
27664
|
duration_ms: DURATION_MS,
|
|
27420
27665
|
...FAILURE_SIGNAL
|
|
27421
27666
|
},
|
|
@@ -27844,29 +28089,29 @@ var SESSION_ID2 = randomUUID5();
|
|
|
27844
28089
|
|
|
27845
28090
|
// ../telemetry/src/identity.ts
|
|
27846
28091
|
import * as crypto2 from "node:crypto";
|
|
27847
|
-
import * as
|
|
27848
|
-
import * as
|
|
28092
|
+
import * as fs8 from "node:fs";
|
|
28093
|
+
import * as path14 from "node:path";
|
|
27849
28094
|
|
|
27850
28095
|
// ../telemetry/src/fingerprint.ts
|
|
27851
28096
|
import { execFileSync as execFileSync2, spawn as spawn2 } from "node:child_process";
|
|
27852
28097
|
|
|
27853
28098
|
// ../native-devtools-ios/src/index.ts
|
|
27854
|
-
import * as
|
|
27855
|
-
import * as
|
|
27856
|
-
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ??
|
|
27857
|
-
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ??
|
|
27858
|
-
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ??
|
|
27859
|
-
var DYLIB_TVOS_DIR =
|
|
28099
|
+
import * as path15 from "node:path";
|
|
28100
|
+
import * as fs9 from "node:fs";
|
|
28101
|
+
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path15.join(__dirname, "..", "dylibs");
|
|
28102
|
+
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path15.join(__dirname, "..", "bin");
|
|
28103
|
+
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path15.join(DYLIB_DIR, "tcp");
|
|
28104
|
+
var DYLIB_TVOS_DIR = path15.join(DYLIB_DIR, "tvos");
|
|
27860
28105
|
|
|
27861
28106
|
// ../telemetry/src/consent.ts
|
|
27862
|
-
import * as
|
|
28107
|
+
import * as fs10 from "node:fs";
|
|
27863
28108
|
var cache = /* @__PURE__ */ new Map();
|
|
27864
28109
|
var sessionOverride = null;
|
|
27865
28110
|
function readConfigOverrideAt(filePath) {
|
|
27866
28111
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
27867
28112
|
let stats;
|
|
27868
28113
|
try {
|
|
27869
|
-
stats =
|
|
28114
|
+
stats = fs10.lstatSync(filePath);
|
|
27870
28115
|
} catch {
|
|
27871
28116
|
cache.set(filePath, miss);
|
|
27872
28117
|
return null;
|
|
@@ -27883,7 +28128,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
27883
28128
|
}
|
|
27884
28129
|
let parsedEnabled = null;
|
|
27885
28130
|
try {
|
|
27886
|
-
const raw =
|
|
28131
|
+
const raw = fs10.readFileSync(filePath, "utf8");
|
|
27887
28132
|
const json = JSON.parse(raw);
|
|
27888
28133
|
if (json && typeof json === "object") {
|
|
27889
28134
|
const t = json.telemetry;
|
|
@@ -28127,8 +28372,10 @@ async function flowRunToMcpContent(result, ctx) {
|
|
|
28127
28372
|
}
|
|
28128
28373
|
blocks.push({
|
|
28129
28374
|
type: "text",
|
|
28130
|
-
text: `Running
|
|
28375
|
+
text: `Running e2e test "${result.flow}"${result.device ? ` on ${result.device}` : ""} (${result.steps.length} steps)`
|
|
28131
28376
|
});
|
|
28377
|
+
if (typeof result.warning === "string")
|
|
28378
|
+
blocks.push({ type: "text", text: `\u26A0 ${result.warning}` });
|
|
28132
28379
|
for (let i = 0; i < result.steps.length; i++) {
|
|
28133
28380
|
const step = result.steps[i];
|
|
28134
28381
|
const num = step.index !== void 0 ? step.index + 1 : i + 1;
|
|
@@ -28157,9 +28404,9 @@ async function flowRunToMcpContent(result, ctx) {
|
|
|
28157
28404
|
}
|
|
28158
28405
|
}
|
|
28159
28406
|
for (const write of result.baselineWrites ?? []) {
|
|
28160
|
-
const { path:
|
|
28161
|
-
if (typeof
|
|
28162
|
-
blocks.push({ type: "text", text: `\u2717 baseline not written: ${
|
|
28407
|
+
const { path: path17, error: error2 } = isRecord2(write) ? write : {};
|
|
28408
|
+
if (typeof path17 === "string" && typeof error2 === "string") {
|
|
28409
|
+
blocks.push({ type: "text", text: `\u2717 baseline not written: ${path17}: ${error2}` });
|
|
28163
28410
|
}
|
|
28164
28411
|
}
|
|
28165
28412
|
if (result.ok !== void 0) {
|
|
@@ -28170,7 +28417,7 @@ async function flowRunToMcpContent(result, ctx) {
|
|
|
28170
28417
|
text: `${result.ok ? "PASS" : "FAIL"} \u2014 ${result.passed ?? 0} passed, ${result.failed ?? 0} failed, ${result.errored ?? 0} errored, ${result.skipped ?? 0} skipped${note}${durationSuffix(result.durationMs)}`
|
|
28171
28418
|
});
|
|
28172
28419
|
} else {
|
|
28173
|
-
blocks.push({ type: "text", text: `
|
|
28420
|
+
blocks.push({ type: "text", text: `E2E test "${result.flow}" complete.` });
|
|
28174
28421
|
}
|
|
28175
28422
|
return blocks;
|
|
28176
28423
|
}
|
|
@@ -28325,12 +28572,12 @@ function toMcpToolList(tools) {
|
|
|
28325
28572
|
}
|
|
28326
28573
|
|
|
28327
28574
|
// ../argent-mcp/src/installed-version.ts
|
|
28328
|
-
import * as
|
|
28329
|
-
import * as
|
|
28575
|
+
import * as fs11 from "node:fs";
|
|
28576
|
+
import * as path16 from "node:path";
|
|
28330
28577
|
function getInstalledVersion() {
|
|
28331
28578
|
try {
|
|
28332
|
-
const pkgPath =
|
|
28333
|
-
const pkg = JSON.parse(
|
|
28579
|
+
const pkgPath = path16.resolve(import.meta.dirname, "..", "package.json");
|
|
28580
|
+
const pkg = JSON.parse(fs11.readFileSync(pkgPath, "utf8"));
|
|
28334
28581
|
return pkg.version ?? "unknown";
|
|
28335
28582
|
} catch {
|
|
28336
28583
|
return "unknown";
|
|
@@ -28474,7 +28721,7 @@ async function startMcpServer(options) {
|
|
|
28474
28721
|
async function spyLog(entry) {
|
|
28475
28722
|
try {
|
|
28476
28723
|
if (!logDirReady) {
|
|
28477
|
-
await mkdir5(
|
|
28724
|
+
await mkdir5(dirname10(LOG_FILE2), { recursive: true });
|
|
28478
28725
|
logDirReady = true;
|
|
28479
28726
|
}
|
|
28480
28727
|
await appendFile(LOG_FILE2, JSON.stringify(entry) + "\n");
|
|
@@ -28535,7 +28782,7 @@ async function startMcpServer(options) {
|
|
|
28535
28782
|
deviceId: getDeviceIdFromArgs(params.arguments)
|
|
28536
28783
|
};
|
|
28537
28784
|
let content;
|
|
28538
|
-
if (params.name === "
|
|
28785
|
+
if (canonicalToolId(params.name) === "e2e-execute" && result && typeof result === "object" && "flow" in result && "steps" in result) {
|
|
28539
28786
|
content = await flowRunToMcpContent(result, ctx);
|
|
28540
28787
|
} else if (params.name === "screenshot-diff" && isScreenshotDiffResult(result)) {
|
|
28541
28788
|
content = await screenshotDiffToMcpContent(result, ctx);
|