@swmansion/argent 0.34.1-next.29 → 0.34.1-next.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-cmds.mjs +520 -351
- package/dist/client.js +82 -67
- package/dist/installer.mjs +830 -680
- package/dist/mcp-server.mjs +250 -207
- package/dist/tool-server.cjs +1577 -1560
- package/package.json +1 -1
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 = resolve11.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 resolve11(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(path18) {
|
|
3239
|
+
let input = path18;
|
|
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 [path18, query] = wsComponent.resourceName.split("?");
|
|
3492
|
+
wsComponent.path = path18 && path18 !== "/" ? path18 : 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 resolve11(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: resolve11,
|
|
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, fs13, 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, fs13[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, path18) {
|
|
6976
|
+
const ctrl = callVisitor(key, node2, visitor, path18);
|
|
6977
6977
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
6978
|
-
replaceNode(key,
|
|
6979
|
-
return visit_(key, ctrl, visitor,
|
|
6978
|
+
replaceNode(key, path18, ctrl);
|
|
6979
|
+
return visit_(key, ctrl, visitor, path18);
|
|
6980
6980
|
}
|
|
6981
6981
|
if (typeof ctrl !== "symbol") {
|
|
6982
6982
|
if (identity.isCollection(node2)) {
|
|
6983
|
-
|
|
6983
|
+
path18 = Object.freeze(path18.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, path18);
|
|
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
|
+
path18 = Object.freeze(path18.concat(node2));
|
|
6997
|
+
const ck = visit_("key", node2.key, visitor, path18);
|
|
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, path18);
|
|
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, path18) {
|
|
7024
|
+
const ctrl = await callVisitor(key, node2, visitor, path18);
|
|
7025
7025
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
7026
|
-
replaceNode(key,
|
|
7027
|
-
return visitAsync_(key, ctrl, visitor,
|
|
7026
|
+
replaceNode(key, path18, ctrl);
|
|
7027
|
+
return visitAsync_(key, ctrl, visitor, path18);
|
|
7028
7028
|
}
|
|
7029
7029
|
if (typeof ctrl !== "symbol") {
|
|
7030
7030
|
if (identity.isCollection(node2)) {
|
|
7031
|
-
|
|
7031
|
+
path18 = Object.freeze(path18.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, path18);
|
|
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
|
+
path18 = Object.freeze(path18.concat(node2));
|
|
7045
|
+
const ck = await visitAsync_("key", node2.key, visitor, path18);
|
|
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, path18);
|
|
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, path18) {
|
|
7078
7078
|
if (typeof visitor === "function")
|
|
7079
|
-
return visitor(key, node2,
|
|
7079
|
+
return visitor(key, node2, path18);
|
|
7080
7080
|
if (identity.isMap(node2))
|
|
7081
|
-
return visitor.Map?.(key, node2,
|
|
7081
|
+
return visitor.Map?.(key, node2, path18);
|
|
7082
7082
|
if (identity.isSeq(node2))
|
|
7083
|
-
return visitor.Seq?.(key, node2,
|
|
7083
|
+
return visitor.Seq?.(key, node2, path18);
|
|
7084
7084
|
if (identity.isPair(node2))
|
|
7085
|
-
return visitor.Pair?.(key, node2,
|
|
7085
|
+
return visitor.Pair?.(key, node2, path18);
|
|
7086
7086
|
if (identity.isScalar(node2))
|
|
7087
|
-
return visitor.Scalar?.(key, node2,
|
|
7087
|
+
return visitor.Scalar?.(key, node2, path18);
|
|
7088
7088
|
if (identity.isAlias(node2))
|
|
7089
|
-
return visitor.Alias?.(key, node2,
|
|
7089
|
+
return visitor.Alias?.(key, node2, path18);
|
|
7090
7090
|
return void 0;
|
|
7091
7091
|
}
|
|
7092
|
-
function replaceNode(key,
|
|
7093
|
-
const parent =
|
|
7092
|
+
function replaceNode(key, path18, node2) {
|
|
7093
|
+
const parent = path18[path18.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, path18, value) {
|
|
7706
7706
|
let v = value;
|
|
7707
|
-
for (let i =
|
|
7708
|
-
const k =
|
|
7707
|
+
for (let i = path18.length - 1; i >= 0; --i) {
|
|
7708
|
+
const k = path18[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 = (path18) => path18 == null || typeof path18 === "object" && !!path18[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(path18, value) {
|
|
7758
|
+
if (isEmptyPath(path18))
|
|
7759
7759
|
this.add(value);
|
|
7760
7760
|
else {
|
|
7761
|
-
const [key, ...rest] =
|
|
7761
|
+
const [key, ...rest] = path18;
|
|
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(path18) {
|
|
7776
|
+
const [key, ...rest] = path18;
|
|
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(path18, keepScalar) {
|
|
7791
|
+
const [key, ...rest] = path18;
|
|
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(path18) {
|
|
7810
|
+
const [key, ...rest] = path18;
|
|
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(path18, value) {
|
|
7821
|
+
const [key, ...rest] = path18;
|
|
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(path18, value) {
|
|
10337
10337
|
if (assertCollection(this.contents))
|
|
10338
|
-
this.contents.addIn(
|
|
10338
|
+
this.contents.addIn(path18, 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(path18) {
|
|
10414
|
+
if (Collection.isEmptyPath(path18)) {
|
|
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(path18) : 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(path18, keepScalar) {
|
|
10436
|
+
if (Collection.isEmptyPath(path18))
|
|
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(path18, 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(path18) {
|
|
10450
|
+
if (Collection.isEmptyPath(path18))
|
|
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(path18) : 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(path18, value) {
|
|
10470
|
+
if (Collection.isEmptyPath(path18)) {
|
|
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(path18), value);
|
|
10474
10474
|
} else if (assertCollection(this.contents)) {
|
|
10475
|
-
this.contents.setIn(
|
|
10475
|
+
this.contents.setIn(path18, 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, path18) => {
|
|
12437
12437
|
let item = cst;
|
|
12438
|
-
for (const [field, index] of
|
|
12438
|
+
for (const [field, index] of path18) {
|
|
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, path18) => {
|
|
12448
|
+
const parent = visit.itemAtPath(cst, path18.slice(0, -1));
|
|
12449
|
+
const field = path18[path18.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(path18, item, visitor) {
|
|
12456
|
+
let ctrl = visitor(item, path18);
|
|
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(path18.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, path18);
|
|
12475
12475
|
}
|
|
12476
12476
|
}
|
|
12477
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
12477
|
+
return typeof ctrl === "function" ? ctrl(item, path18) : 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 fs13 = this.flowScalar(this.type);
|
|
13780
13780
|
if (atNextItem || it.value) {
|
|
13781
|
-
map.items.push({ start, key:
|
|
13781
|
+
map.items.push({ start, key: fs13, sep: [] });
|
|
13782
13782
|
this.onKeyLine = true;
|
|
13783
13783
|
} else if (it.sep) {
|
|
13784
|
-
this.stack.push(
|
|
13784
|
+
this.stack.push(fs13);
|
|
13785
13785
|
} else {
|
|
13786
|
-
Object.assign(it, { key:
|
|
13786
|
+
Object.assign(it, { key: fs13, 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 fs13 = this.flowScalar(this.type);
|
|
13915
13915
|
if (!it || it.value)
|
|
13916
|
-
fc.items.push({ start: [], key:
|
|
13916
|
+
fc.items.push({ start: [], key: fs13, sep: [] });
|
|
13917
13917
|
else if (it.sep)
|
|
13918
|
-
this.stack.push(
|
|
13918
|
+
this.stack.push(fs13);
|
|
13919
13919
|
else
|
|
13920
|
-
Object.assign(it, { key:
|
|
13920
|
+
Object.assign(it, { key: fs13, sep: [] });
|
|
13921
13921
|
return;
|
|
13922
13922
|
}
|
|
13923
13923
|
case "flow-map-end":
|
|
@@ -14619,8 +14619,9 @@ var require_dist3 = __commonJS({
|
|
|
14619
14619
|
|
|
14620
14620
|
// ../argent-mcp/src/mcp-server.ts
|
|
14621
14621
|
import { appendFile, mkdir as mkdir5 } from "node:fs/promises";
|
|
14622
|
-
import { dirname as
|
|
14622
|
+
import { dirname as dirname11 } from "node:path";
|
|
14623
14623
|
import { homedir as homedir5 } from "node:os";
|
|
14624
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
14624
14625
|
|
|
14625
14626
|
// ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
14626
14627
|
import process2 from "node:process";
|
|
@@ -14862,10 +14863,10 @@ function mergeDefs(...defs) {
|
|
|
14862
14863
|
function cloneDef(schema) {
|
|
14863
14864
|
return mergeDefs(schema._zod.def);
|
|
14864
14865
|
}
|
|
14865
|
-
function getElementAtPath(obj,
|
|
14866
|
-
if (!
|
|
14866
|
+
function getElementAtPath(obj, path18) {
|
|
14867
|
+
if (!path18)
|
|
14867
14868
|
return obj;
|
|
14868
|
-
return
|
|
14869
|
+
return path18.reduce((acc, key) => acc?.[key], obj);
|
|
14869
14870
|
}
|
|
14870
14871
|
function promiseAllObject(promisesObj) {
|
|
14871
14872
|
const keys = Object.keys(promisesObj);
|
|
@@ -15205,11 +15206,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
15205
15206
|
}
|
|
15206
15207
|
return false;
|
|
15207
15208
|
}
|
|
15208
|
-
function prefixIssues(
|
|
15209
|
+
function prefixIssues(path18, issues) {
|
|
15209
15210
|
return issues.map((iss) => {
|
|
15210
15211
|
var _a3;
|
|
15211
15212
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
15212
|
-
iss.path.unshift(
|
|
15213
|
+
iss.path.unshift(path18);
|
|
15213
15214
|
return iss;
|
|
15214
15215
|
});
|
|
15215
15216
|
}
|
|
@@ -15667,16 +15668,16 @@ function flattenError(error2, mapper = (issue2) => issue2.message) {
|
|
|
15667
15668
|
}
|
|
15668
15669
|
function formatError(error2, mapper = (issue2) => issue2.message) {
|
|
15669
15670
|
const fieldErrors = { _errors: [] };
|
|
15670
|
-
const processError = (error3,
|
|
15671
|
+
const processError = (error3, path18 = []) => {
|
|
15671
15672
|
for (const issue2 of error3.issues) {
|
|
15672
15673
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
15673
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
15674
|
+
issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
|
|
15674
15675
|
} else if (issue2.code === "invalid_key") {
|
|
15675
|
-
processError({ issues: issue2.issues }, [...
|
|
15676
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
15676
15677
|
} else if (issue2.code === "invalid_element") {
|
|
15677
|
-
processError({ issues: issue2.issues }, [...
|
|
15678
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
15678
15679
|
} else {
|
|
15679
|
-
const fullpath = [...
|
|
15680
|
+
const fullpath = [...path18, ...issue2.path];
|
|
15680
15681
|
if (fullpath.length === 0) {
|
|
15681
15682
|
fieldErrors._errors.push(mapper(issue2));
|
|
15682
15683
|
} else {
|
|
@@ -17976,7 +17977,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
17976
17977
|
var NONE = 0;
|
|
17977
17978
|
var ASSUMED = 1;
|
|
17978
17979
|
var PROVEN = 2;
|
|
17979
|
-
function isRecursive(inst, stack,
|
|
17980
|
+
function isRecursive(inst, stack, resolve11) {
|
|
17980
17981
|
const cached2 = recursive.get(inst);
|
|
17981
17982
|
if (cached2 !== void 0)
|
|
17982
17983
|
return cached2 ? PROVEN : NONE;
|
|
@@ -17986,7 +17987,7 @@ function isRecursive(inst, stack, resolve10) {
|
|
|
17986
17987
|
let result = NONE;
|
|
17987
17988
|
const check = (child) => {
|
|
17988
17989
|
if (result !== PROVEN && child?._zod) {
|
|
17989
|
-
const answer = isRecursive(child, stack,
|
|
17990
|
+
const answer = isRecursive(child, stack, resolve11);
|
|
17990
17991
|
if (answer > result)
|
|
17991
17992
|
result = answer;
|
|
17992
17993
|
}
|
|
@@ -17997,7 +17998,7 @@ function isRecursive(inst, stack, resolve10) {
|
|
|
17997
17998
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
17998
17999
|
if (spread && !desc.enumerable)
|
|
17999
18000
|
continue;
|
|
18000
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
18001
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve11) : NONE;
|
|
18001
18002
|
if (child > answer)
|
|
18002
18003
|
answer = child;
|
|
18003
18004
|
}
|
|
@@ -18061,7 +18062,7 @@ function isRecursive(inst, stack, resolve10) {
|
|
|
18061
18062
|
break;
|
|
18062
18063
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
18063
18064
|
case "lazy": {
|
|
18064
|
-
const inner = def._cachedInner ?? (
|
|
18065
|
+
const inner = def._cachedInner ?? (resolve11 ? inst._zod.innerType : void 0);
|
|
18065
18066
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
18066
18067
|
break;
|
|
18067
18068
|
}
|
|
@@ -22639,12 +22640,12 @@ var StdioServerTransport = class {
|
|
|
22639
22640
|
this.onclose?.();
|
|
22640
22641
|
}
|
|
22641
22642
|
send(message) {
|
|
22642
|
-
return new Promise((
|
|
22643
|
+
return new Promise((resolve11) => {
|
|
22643
22644
|
const json = serializeMessage(message);
|
|
22644
22645
|
if (this._stdout.write(json)) {
|
|
22645
|
-
|
|
22646
|
+
resolve11();
|
|
22646
22647
|
} else {
|
|
22647
|
-
this._stdout.once("drain",
|
|
22648
|
+
this._stdout.once("drain", resolve11);
|
|
22648
22649
|
}
|
|
22649
22650
|
});
|
|
22650
22651
|
}
|
|
@@ -23264,7 +23265,7 @@ var Protocol = class {
|
|
|
23264
23265
|
return;
|
|
23265
23266
|
}
|
|
23266
23267
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
23267
|
-
await new Promise((
|
|
23268
|
+
await new Promise((resolve11) => setTimeout(resolve11, pollInterval));
|
|
23268
23269
|
options?.signal?.throwIfAborted();
|
|
23269
23270
|
}
|
|
23270
23271
|
} catch (error2) {
|
|
@@ -23281,7 +23282,7 @@ var Protocol = class {
|
|
|
23281
23282
|
*/
|
|
23282
23283
|
request(request, resultSchema, options) {
|
|
23283
23284
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
23284
|
-
return new Promise((
|
|
23285
|
+
return new Promise((resolve11, reject) => {
|
|
23285
23286
|
const earlyReject = (error2) => {
|
|
23286
23287
|
reject(error2);
|
|
23287
23288
|
};
|
|
@@ -23359,7 +23360,7 @@ var Protocol = class {
|
|
|
23359
23360
|
if (!parseResult.success) {
|
|
23360
23361
|
reject(parseResult.error);
|
|
23361
23362
|
} else {
|
|
23362
|
-
|
|
23363
|
+
resolve11(parseResult.data);
|
|
23363
23364
|
}
|
|
23364
23365
|
} catch (error2) {
|
|
23365
23366
|
reject(error2);
|
|
@@ -23621,12 +23622,12 @@ var Protocol = class {
|
|
|
23621
23622
|
}
|
|
23622
23623
|
} catch {
|
|
23623
23624
|
}
|
|
23624
|
-
return new Promise((
|
|
23625
|
+
return new Promise((resolve11, reject) => {
|
|
23625
23626
|
if (signal.aborted) {
|
|
23626
23627
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
23627
23628
|
return;
|
|
23628
23629
|
}
|
|
23629
|
-
const timeoutId = setTimeout(
|
|
23630
|
+
const timeoutId = setTimeout(resolve11, interval);
|
|
23630
23631
|
signal.addEventListener("abort", () => {
|
|
23631
23632
|
clearTimeout(timeoutId);
|
|
23632
23633
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -24422,6 +24423,7 @@ var LOCK_FILE = path.join(STATE_DIR, "tool-server.lock");
|
|
|
24422
24423
|
var AUTH_TOKEN_BYTES = 32;
|
|
24423
24424
|
var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
|
|
24424
24425
|
var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
|
|
24426
|
+
var AUTOSPAWN_HOST = "127.0.0.1";
|
|
24425
24427
|
function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
24426
24428
|
const env = {
|
|
24427
24429
|
...baseEnv,
|
|
@@ -24433,7 +24435,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
|
24433
24435
|
if (options.idleTimeoutMinutes !== void 0) {
|
|
24434
24436
|
env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
|
|
24435
24437
|
}
|
|
24436
|
-
|
|
24438
|
+
env[AUTH_TOKEN_ENV] = options.token ?? "";
|
|
24437
24439
|
if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
|
|
24438
24440
|
if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
|
|
24439
24441
|
return env;
|
|
@@ -24442,7 +24444,7 @@ function generateToken() {
|
|
|
24442
24444
|
return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
|
|
24443
24445
|
}
|
|
24444
24446
|
function findFreePort() {
|
|
24445
|
-
return new Promise((
|
|
24447
|
+
return new Promise((resolve11, reject) => {
|
|
24446
24448
|
const srv = net.createServer();
|
|
24447
24449
|
srv.listen(0, "127.0.0.1", () => {
|
|
24448
24450
|
const addr = srv.address();
|
|
@@ -24453,7 +24455,7 @@ function findFreePort() {
|
|
|
24453
24455
|
const port = addr.port;
|
|
24454
24456
|
srv.close((err) => {
|
|
24455
24457
|
if (err) reject(err);
|
|
24456
|
-
else
|
|
24458
|
+
else resolve11(port);
|
|
24457
24459
|
});
|
|
24458
24460
|
});
|
|
24459
24461
|
srv.on("error", reject);
|
|
@@ -24555,7 +24557,7 @@ function resolveToolsServerNode() {
|
|
|
24555
24557
|
return !(bun || deno || electron) && fs.existsSync(process.execPath) ? process.execPath : "node";
|
|
24556
24558
|
}
|
|
24557
24559
|
function spawnToolsServer(paths, port, options = {}) {
|
|
24558
|
-
return new Promise((
|
|
24560
|
+
return new Promise((resolve11, reject) => {
|
|
24559
24561
|
let logFd;
|
|
24560
24562
|
try {
|
|
24561
24563
|
fs.mkdirSync(STATE_DIR, { recursive: true });
|
|
@@ -24601,7 +24603,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
24601
24603
|
rl.close();
|
|
24602
24604
|
child.stdout?.resume();
|
|
24603
24605
|
child.stdout?.unref?.();
|
|
24604
|
-
settle2(() =>
|
|
24606
|
+
settle2(() => resolve11({ port: actualPort, pid }));
|
|
24605
24607
|
}
|
|
24606
24608
|
});
|
|
24607
24609
|
child.on("error", (err) => {
|
|
@@ -24877,6 +24879,7 @@ async function ensureToolsServer(paths) {
|
|
|
24877
24879
|
const port = await findFreePort();
|
|
24878
24880
|
const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
|
|
24879
24881
|
token,
|
|
24882
|
+
host: AUTOSPAWN_HOST,
|
|
24880
24883
|
idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES
|
|
24881
24884
|
});
|
|
24882
24885
|
await writeState({
|
|
@@ -24885,11 +24888,11 @@ async function ensureToolsServer(paths) {
|
|
|
24885
24888
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
24886
24889
|
bundlePath: paths.bundlePath,
|
|
24887
24890
|
version: diskVersion,
|
|
24888
|
-
host:
|
|
24891
|
+
host: AUTOSPAWN_HOST,
|
|
24889
24892
|
token,
|
|
24890
24893
|
managed: "autospawn"
|
|
24891
24894
|
});
|
|
24892
|
-
return { url: formatUrl(
|
|
24895
|
+
return { url: formatUrl(AUTOSPAWN_HOST, actualPort), token };
|
|
24893
24896
|
} finally {
|
|
24894
24897
|
lock?.release();
|
|
24895
24898
|
}
|
|
@@ -25024,6 +25027,7 @@ function isFeatureEnabled(name, options = {}, registry2 = FLAG_REGISTRY) {
|
|
|
25024
25027
|
}
|
|
25025
25028
|
|
|
25026
25029
|
// ../configuration-core/src/paths.ts
|
|
25030
|
+
import * as fs3 from "node:fs";
|
|
25027
25031
|
import * as os from "node:os";
|
|
25028
25032
|
import * as path3 from "node:path";
|
|
25029
25033
|
function nonEmpty(value) {
|
|
@@ -25035,6 +25039,16 @@ function resolveHomeDir(options = {}) {
|
|
|
25035
25039
|
if (options.homeDir) return options.homeDir;
|
|
25036
25040
|
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
25037
25041
|
}
|
|
25042
|
+
function isHomeDir(dir, options = {}) {
|
|
25043
|
+
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
25044
|
+
}
|
|
25045
|
+
function canonicalPath(p) {
|
|
25046
|
+
try {
|
|
25047
|
+
return fs3.realpathSync.native(p);
|
|
25048
|
+
} catch {
|
|
25049
|
+
return path3.resolve(p);
|
|
25050
|
+
}
|
|
25051
|
+
}
|
|
25038
25052
|
function argentHomeDir() {
|
|
25039
25053
|
return path3.join(resolveHomeDir(), ".argent");
|
|
25040
25054
|
}
|
|
@@ -25051,11 +25065,11 @@ function configFilePath(scope = "global", options = {}) {
|
|
|
25051
25065
|
|
|
25052
25066
|
// ../configuration-core/src/config.ts
|
|
25053
25067
|
import * as crypto from "node:crypto";
|
|
25054
|
-
import * as
|
|
25068
|
+
import * as fs4 from "node:fs";
|
|
25055
25069
|
import * as path4 from "node:path";
|
|
25056
25070
|
function readConfigObject(scope = "global", options = {}) {
|
|
25057
25071
|
try {
|
|
25058
|
-
const raw2 =
|
|
25072
|
+
const raw2 = fs4.readFileSync(configFilePath(scope, options), "utf8");
|
|
25059
25073
|
const json = JSON.parse(raw2);
|
|
25060
25074
|
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
25061
25075
|
return json;
|
|
@@ -25100,9 +25114,9 @@ function acquireConfigLock(finalPath) {
|
|
|
25100
25114
|
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
25101
25115
|
for (; ; ) {
|
|
25102
25116
|
try {
|
|
25103
|
-
const fd =
|
|
25117
|
+
const fd = fs4.openSync(lockPath, "wx", 384);
|
|
25104
25118
|
try {
|
|
25105
|
-
|
|
25119
|
+
fs4.writeSync(fd, `${process.pid}
|
|
25106
25120
|
`);
|
|
25107
25121
|
} catch {
|
|
25108
25122
|
}
|
|
@@ -25110,8 +25124,8 @@ function acquireConfigLock(finalPath) {
|
|
|
25110
25124
|
} catch (err) {
|
|
25111
25125
|
if (err.code !== "EEXIST") return null;
|
|
25112
25126
|
try {
|
|
25113
|
-
if (Date.now() -
|
|
25114
|
-
|
|
25127
|
+
if (Date.now() - fs4.statSync(lockPath).mtimeMs > LOCK_STALE_MS2) {
|
|
25128
|
+
fs4.unlinkSync(lockPath);
|
|
25115
25129
|
continue;
|
|
25116
25130
|
}
|
|
25117
25131
|
} catch {
|
|
@@ -25123,35 +25137,35 @@ function acquireConfigLock(finalPath) {
|
|
|
25123
25137
|
}
|
|
25124
25138
|
function releaseConfigLock(lock) {
|
|
25125
25139
|
try {
|
|
25126
|
-
|
|
25140
|
+
fs4.closeSync(lock.fd);
|
|
25127
25141
|
} catch {
|
|
25128
25142
|
}
|
|
25129
25143
|
try {
|
|
25130
|
-
|
|
25144
|
+
fs4.unlinkSync(lock.lockPath);
|
|
25131
25145
|
} catch {
|
|
25132
25146
|
}
|
|
25133
25147
|
}
|
|
25134
25148
|
function updateConfig(mutate, scope = "global", options = {}) {
|
|
25135
25149
|
const dir = configDir(scope, options);
|
|
25136
|
-
|
|
25150
|
+
fs4.mkdirSync(dir, { recursive: true });
|
|
25137
25151
|
const finalPath = configFilePath(scope, options);
|
|
25138
25152
|
const lock = acquireConfigLock(finalPath);
|
|
25139
25153
|
try {
|
|
25140
25154
|
const next = readConfigObject(scope, options);
|
|
25141
25155
|
mutate(next);
|
|
25142
25156
|
const tmpPath = path4.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
25143
|
-
const fd =
|
|
25157
|
+
const fd = fs4.openSync(tmpPath, "wx", 384);
|
|
25144
25158
|
try {
|
|
25145
|
-
|
|
25146
|
-
|
|
25159
|
+
fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
25160
|
+
fs4.fsyncSync(fd);
|
|
25147
25161
|
} finally {
|
|
25148
|
-
|
|
25162
|
+
fs4.closeSync(fd);
|
|
25149
25163
|
}
|
|
25150
25164
|
try {
|
|
25151
|
-
|
|
25165
|
+
fs4.renameSync(tmpPath, finalPath);
|
|
25152
25166
|
} catch (err) {
|
|
25153
25167
|
try {
|
|
25154
|
-
|
|
25168
|
+
fs4.unlinkSync(tmpPath);
|
|
25155
25169
|
} catch {
|
|
25156
25170
|
}
|
|
25157
25171
|
throw err;
|
|
@@ -25163,7 +25177,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
25163
25177
|
|
|
25164
25178
|
// ../configuration-core/src/secrets.ts
|
|
25165
25179
|
var import_dotenv = __toESM(require_dist3(), 1);
|
|
25166
|
-
import * as
|
|
25180
|
+
import * as fs5 from "node:fs";
|
|
25167
25181
|
import * as path5 from "node:path";
|
|
25168
25182
|
var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
|
|
25169
25183
|
var SECRETS_FILE_NAME = "secrets.env";
|
|
@@ -25193,10 +25207,10 @@ function fileSource(filePath, exposure) {
|
|
|
25193
25207
|
names: [],
|
|
25194
25208
|
values: /* @__PURE__ */ new Map()
|
|
25195
25209
|
};
|
|
25196
|
-
if (!
|
|
25210
|
+
if (!fs5.statSync(filePath, { throwIfNoEntry: false })) return absent;
|
|
25197
25211
|
let content;
|
|
25198
25212
|
try {
|
|
25199
|
-
content =
|
|
25213
|
+
content = fs5.readFileSync(filePath, "utf8");
|
|
25200
25214
|
} catch {
|
|
25201
25215
|
return absent;
|
|
25202
25216
|
}
|
|
@@ -25222,7 +25236,9 @@ function fileSource(filePath, exposure) {
|
|
|
25222
25236
|
}
|
|
25223
25237
|
function secretSources(options = {}) {
|
|
25224
25238
|
const sources = [envSource(options.env ?? process.env)];
|
|
25225
|
-
const
|
|
25239
|
+
const home = resolveHomeDir(options);
|
|
25240
|
+
const found = findProjectRoot(options.cwd ?? process.cwd());
|
|
25241
|
+
const projectRoot = found && isHomeDir(found, options) ? home : found;
|
|
25226
25242
|
const filePaths = [];
|
|
25227
25243
|
if (projectRoot) {
|
|
25228
25244
|
filePaths.push({
|
|
@@ -25234,7 +25250,7 @@ function secretSources(options = {}) {
|
|
|
25234
25250
|
}
|
|
25235
25251
|
}
|
|
25236
25252
|
filePaths.push({
|
|
25237
|
-
path: path5.join(
|
|
25253
|
+
path: path5.join(home, ".argent", SECRETS_FILE_NAME),
|
|
25238
25254
|
exposure: "dedicated"
|
|
25239
25255
|
});
|
|
25240
25256
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -25531,16 +25547,16 @@ function toolStepFiles(specs, args) {
|
|
|
25531
25547
|
}
|
|
25532
25548
|
return files;
|
|
25533
25549
|
}
|
|
25534
|
-
function isClientFileArgument({ spec, path:
|
|
25535
|
-
return spec.kind === "file" && spec.path === `\${${spec.target}}` &&
|
|
25550
|
+
function isClientFileArgument({ spec, path: path18 }) {
|
|
25551
|
+
return spec.kind === "file" && spec.path === `\${${spec.target}}` && path18.startsWith("/") && hasToolFileExtension(path18);
|
|
25536
25552
|
}
|
|
25537
25553
|
|
|
25538
25554
|
// ../registry/src/flow-file-refs.ts
|
|
25539
|
-
import * as
|
|
25555
|
+
import * as fs7 from "node:fs/promises";
|
|
25540
25556
|
import * as path8 from "node:path";
|
|
25541
25557
|
|
|
25542
25558
|
// ../registry/src/e2e-dirs.ts
|
|
25543
|
-
import * as
|
|
25559
|
+
import * as fs6 from "node:fs/promises";
|
|
25544
25560
|
import * as path7 from "node:path";
|
|
25545
25561
|
var E2E_DIR = path7.join(".argent", "e2e");
|
|
25546
25562
|
var LEGACY_E2E_DIRS = Object.freeze([path7.join(".argent", "flows")]);
|
|
@@ -25555,7 +25571,7 @@ function e2eFileCandidates(projectRoot, name) {
|
|
|
25555
25571
|
return e2eDirsFor(projectRoot).map((dir) => path7.join(dir, `${name}.yaml`));
|
|
25556
25572
|
}
|
|
25557
25573
|
async function exists(file) {
|
|
25558
|
-
return
|
|
25574
|
+
return fs6.stat(file).then(
|
|
25559
25575
|
() => true,
|
|
25560
25576
|
() => false
|
|
25561
25577
|
);
|
|
@@ -25646,10 +25662,10 @@ function canonicalToolArgs(tool, args) {
|
|
|
25646
25662
|
// ../registry/src/flow-file-refs.ts
|
|
25647
25663
|
async function canonicalFlowPath(p) {
|
|
25648
25664
|
try {
|
|
25649
|
-
return await
|
|
25665
|
+
return await fs7.realpath(p);
|
|
25650
25666
|
} catch {
|
|
25651
25667
|
try {
|
|
25652
|
-
return path8.join(await
|
|
25668
|
+
return path8.join(await fs7.realpath(path8.dirname(p)), path8.basename(p));
|
|
25653
25669
|
} catch {
|
|
25654
25670
|
return p;
|
|
25655
25671
|
}
|
|
@@ -25695,15 +25711,15 @@ function collectFlowRequests(doc) {
|
|
|
25695
25711
|
if (isRecord(doc)) visit(doc.steps, 0);
|
|
25696
25712
|
return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
|
|
25697
25713
|
}
|
|
25698
|
-
function baselineKeyFor(
|
|
25699
|
-
const stem = path8.basename(
|
|
25714
|
+
function baselineKeyFor(canonicalPath2, flowName) {
|
|
25715
|
+
const stem = path8.basename(canonicalPath2, ".yaml");
|
|
25700
25716
|
return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
|
|
25701
25717
|
}
|
|
25702
25718
|
function flowMemberKey(anchorDir, target) {
|
|
25703
25719
|
return `${anchorDir}\0${target}`;
|
|
25704
25720
|
}
|
|
25705
25721
|
async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
|
|
25706
|
-
const entries = await
|
|
25722
|
+
const entries = await fs7.readdir(dir).catch(() => null);
|
|
25707
25723
|
if (entries === null || entries.includes(base)) return { state: "listed" };
|
|
25708
25724
|
const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
|
|
25709
25725
|
if (actual === void 0) return { state: "absent" };
|
|
@@ -26237,9 +26253,9 @@ var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
|
|
|
26237
26253
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
26238
26254
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
26239
26255
|
var resolvedDuringInvocation = new AsyncLocalStorage();
|
|
26240
|
-
function valueAtPath(root,
|
|
26256
|
+
function valueAtPath(root, path18) {
|
|
26241
26257
|
let current = root;
|
|
26242
|
-
for (const key of
|
|
26258
|
+
for (const key of path18) {
|
|
26243
26259
|
if (current === null || typeof current !== "object") return void 0;
|
|
26244
26260
|
if (!Object.hasOwn(current, key)) return void 0;
|
|
26245
26261
|
current = current[key];
|
|
@@ -26361,7 +26377,7 @@ import { spawn as spawn2 } from "node:child_process";
|
|
|
26361
26377
|
import { once } from "node:events";
|
|
26362
26378
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
26363
26379
|
import { open as open2, rm, readdir as readdir3 } from "node:fs/promises";
|
|
26364
|
-
import { basename as basename4, dirname as dirname5, join as join9, resolve as
|
|
26380
|
+
import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve7, sep as sep2 } from "node:path";
|
|
26365
26381
|
import { Writable } from "node:stream";
|
|
26366
26382
|
import { pipeline } from "node:stream/promises";
|
|
26367
26383
|
import zlib from "node:zlib";
|
|
@@ -26516,7 +26532,7 @@ async function runTar(archive, args, signal) {
|
|
|
26516
26532
|
child.on("error", (err) => {
|
|
26517
26533
|
childError = err;
|
|
26518
26534
|
});
|
|
26519
|
-
const closed = new Promise((
|
|
26535
|
+
const closed = new Promise((resolve11) => child.once("close", resolve11));
|
|
26520
26536
|
const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
|
|
26521
26537
|
maxLines: MAX_LISTING_LINES,
|
|
26522
26538
|
onOverflow: () => child.kill()
|
|
@@ -26565,16 +26581,16 @@ async function runTar(archive, args, signal) {
|
|
|
26565
26581
|
function normalizeTarMemberPath(memberPath) {
|
|
26566
26582
|
return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
26567
26583
|
}
|
|
26568
|
-
function isContainedPath(
|
|
26569
|
-
const slashed =
|
|
26584
|
+
function isContainedPath(path18, windows = process.platform === "win32") {
|
|
26585
|
+
const slashed = path18.replace(/\\/g, "/");
|
|
26570
26586
|
const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
|
|
26571
26587
|
return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
|
|
26572
26588
|
}
|
|
26573
26589
|
function isSafeTarMember(memberPath, destDir) {
|
|
26574
26590
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
26575
26591
|
if (!isContainedPath(normalized)) return false;
|
|
26576
|
-
const root =
|
|
26577
|
-
return
|
|
26592
|
+
const root = resolve7(destDir);
|
|
26593
|
+
return resolve7(destDir, normalized).startsWith(root + sep2);
|
|
26578
26594
|
}
|
|
26579
26595
|
async function readListing(archive, args, signal) {
|
|
26580
26596
|
try {
|
|
@@ -26730,10 +26746,10 @@ function untrackArchive(archive) {
|
|
|
26730
26746
|
for (const s of ARCHIVE_SIGNALS) process.removeListener(s, removeArchivesOnSignal);
|
|
26731
26747
|
process.removeListener("exit", removePendingArchives);
|
|
26732
26748
|
}
|
|
26733
|
-
function sha256File(filePath) {
|
|
26734
|
-
return new Promise((
|
|
26749
|
+
function sha256File(filePath, signal) {
|
|
26750
|
+
return new Promise((resolve11, reject) => {
|
|
26735
26751
|
const hash = createHash2("sha256");
|
|
26736
|
-
createReadStream2(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () =>
|
|
26752
|
+
createReadStream2(filePath, { signal }).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve11(hash.digest("hex"))).on("error", reject);
|
|
26737
26753
|
});
|
|
26738
26754
|
}
|
|
26739
26755
|
function toolServerError(text) {
|
|
@@ -26796,7 +26812,7 @@ async function uploadFile(sourcePath, endpoint, signal) {
|
|
|
26796
26812
|
trackArchive(tarPath);
|
|
26797
26813
|
try {
|
|
26798
26814
|
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
26799
|
-
const contentHash = await sha256File(tarPath);
|
|
26815
|
+
const contentHash = await sha256File(tarPath, signal);
|
|
26800
26816
|
return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
|
|
26801
26817
|
} finally {
|
|
26802
26818
|
untrackArchive(tarPath);
|
|
@@ -27851,7 +27867,7 @@ import {
|
|
|
27851
27867
|
} from "node:fs/promises";
|
|
27852
27868
|
import { constants as fsConstants } from "node:fs";
|
|
27853
27869
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
27854
|
-
import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as
|
|
27870
|
+
import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve9, sep as sep4 } from "node:path";
|
|
27855
27871
|
import { createHash as createHash3 } from "node:crypto";
|
|
27856
27872
|
var ARTIFACT_MARKER2 = "__argentArtifact";
|
|
27857
27873
|
function isArtifactHandle(value) {
|
|
@@ -27900,7 +27916,7 @@ function configuredRecordingsDir() {
|
|
|
27900
27916
|
if (trimmed === "") return null;
|
|
27901
27917
|
const home = dirname9(argentHomeDir());
|
|
27902
27918
|
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep4}`) ? join13(home, trimmed.slice(2)) : trimmed;
|
|
27903
|
-
return
|
|
27919
|
+
return resolve9(durableBaseDir(), expanded);
|
|
27904
27920
|
}
|
|
27905
27921
|
var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
|
|
27906
27922
|
async function readCapped(res, cap) {
|
|
@@ -27933,10 +27949,10 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
27933
27949
|
const stem = filename.slice(0, filename.length - ext.length);
|
|
27934
27950
|
for (let i = 1; i <= 1e3; i++) {
|
|
27935
27951
|
const candidate = i === 1 ? filename : `${stem} (${i})${ext}`;
|
|
27936
|
-
const
|
|
27952
|
+
const path18 = join13(dir, candidate);
|
|
27937
27953
|
try {
|
|
27938
|
-
await write(
|
|
27939
|
-
return
|
|
27954
|
+
await write(path18);
|
|
27955
|
+
return path18;
|
|
27940
27956
|
} catch (err) {
|
|
27941
27957
|
if (err?.code === "EEXIST") continue;
|
|
27942
27958
|
throw err;
|
|
@@ -28130,7 +28146,7 @@ function getDeviceIdFromArgs(args) {
|
|
|
28130
28146
|
}
|
|
28131
28147
|
|
|
28132
28148
|
// ../telemetry/src/debug.ts
|
|
28133
|
-
import * as
|
|
28149
|
+
import * as fs8 from "node:fs";
|
|
28134
28150
|
|
|
28135
28151
|
// ../telemetry/src/paths.ts
|
|
28136
28152
|
import * as path13 from "node:path";
|
|
@@ -28465,7 +28481,7 @@ var SESSION_ID2 = randomUUID5();
|
|
|
28465
28481
|
|
|
28466
28482
|
// ../telemetry/src/identity.ts
|
|
28467
28483
|
import * as crypto2 from "node:crypto";
|
|
28468
|
-
import * as
|
|
28484
|
+
import * as fs9 from "node:fs";
|
|
28469
28485
|
import * as path14 from "node:path";
|
|
28470
28486
|
|
|
28471
28487
|
// ../telemetry/src/fingerprint.ts
|
|
@@ -28473,21 +28489,22 @@ import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_proce
|
|
|
28473
28489
|
|
|
28474
28490
|
// ../native-devtools-ios/src/index.ts
|
|
28475
28491
|
import * as path15 from "node:path";
|
|
28476
|
-
import * as
|
|
28492
|
+
import * as fs10 from "node:fs";
|
|
28477
28493
|
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path15.join(__dirname, "..", "dylibs");
|
|
28478
28494
|
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path15.join(__dirname, "..", "bin");
|
|
28479
28495
|
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path15.join(DYLIB_DIR, "tcp");
|
|
28480
28496
|
var DYLIB_TVOS_DIR = path15.join(DYLIB_DIR, "tvos");
|
|
28481
28497
|
|
|
28482
28498
|
// ../telemetry/src/consent.ts
|
|
28483
|
-
import * as
|
|
28499
|
+
import * as fs11 from "node:fs";
|
|
28500
|
+
import * as path16 from "node:path";
|
|
28484
28501
|
var cache = /* @__PURE__ */ new Map();
|
|
28485
28502
|
var sessionOverride = null;
|
|
28486
28503
|
function readConfigOverrideAt(filePath) {
|
|
28487
28504
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
28488
28505
|
let stats;
|
|
28489
28506
|
try {
|
|
28490
|
-
stats =
|
|
28507
|
+
stats = fs11.lstatSync(filePath);
|
|
28491
28508
|
} catch {
|
|
28492
28509
|
cache.set(filePath, miss);
|
|
28493
28510
|
return null;
|
|
@@ -28504,7 +28521,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
28504
28521
|
}
|
|
28505
28522
|
let parsedEnabled = null;
|
|
28506
28523
|
try {
|
|
28507
|
-
const raw2 =
|
|
28524
|
+
const raw2 = fs11.readFileSync(filePath, "utf8");
|
|
28508
28525
|
const json = JSON.parse(raw2);
|
|
28509
28526
|
if (json && typeof json === "object") {
|
|
28510
28527
|
const t = json.telemetry;
|
|
@@ -28522,7 +28539,8 @@ function readPersistedConsent(cwd) {
|
|
|
28522
28539
|
const globalPath = configFilePath("global");
|
|
28523
28540
|
const projectPath = configFilePath("project", { cwd });
|
|
28524
28541
|
const global = readConfigOverrideAt(globalPath);
|
|
28525
|
-
const
|
|
28542
|
+
const projectRoot = path16.dirname(path16.dirname(projectPath));
|
|
28543
|
+
const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
|
|
28526
28544
|
if (project === false && global === false) {
|
|
28527
28545
|
return { enabled: false, detail: "config.json (project and global)" };
|
|
28528
28546
|
}
|
|
@@ -28613,7 +28631,7 @@ var PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
|
28613
28631
|
function imageBlock(data, mimeType) {
|
|
28614
28632
|
return { type: "image", data: data.toString("base64"), mimeType };
|
|
28615
28633
|
}
|
|
28616
|
-
async function fetchPngBytes(url) {
|
|
28634
|
+
async function fetchPngBytes(url, signal) {
|
|
28617
28635
|
try {
|
|
28618
28636
|
let buf;
|
|
28619
28637
|
if (url.startsWith("file://")) {
|
|
@@ -28621,7 +28639,7 @@ async function fetchPngBytes(url) {
|
|
|
28621
28639
|
const { fileURLToPath } = await import("node:url");
|
|
28622
28640
|
buf = await readFile8(fileURLToPath(url));
|
|
28623
28641
|
} else {
|
|
28624
|
-
const res = await fetch(url);
|
|
28642
|
+
const res = await fetch(url, { signal });
|
|
28625
28643
|
if (!res.ok) return null;
|
|
28626
28644
|
buf = Buffer.from(await res.arrayBuffer());
|
|
28627
28645
|
}
|
|
@@ -28644,7 +28662,7 @@ async function toMcpContent(result, outputHint, ctx, args) {
|
|
|
28644
28662
|
blocks2.push(saved);
|
|
28645
28663
|
return blocks2;
|
|
28646
28664
|
}
|
|
28647
|
-
return legacyImageContent(rewritten, suppressImage);
|
|
28665
|
+
return legacyImageContent(rewritten, suppressImage, ctx.signal);
|
|
28648
28666
|
}
|
|
28649
28667
|
const blocks = [{ type: "text", text: stringifyForText(rewritten) }];
|
|
28650
28668
|
if (!suppressImage) for (const img of images) blocks.push(imageBlock(img.data, img.mimeType));
|
|
@@ -28658,13 +28676,13 @@ async function toMcpContent(result, outputHint, ctx, args) {
|
|
|
28658
28676
|
function stringifyForText(value) {
|
|
28659
28677
|
return JSON.stringify(value ?? null, null, 2);
|
|
28660
28678
|
}
|
|
28661
|
-
async function legacyImageContent(result, suppressImage) {
|
|
28679
|
+
async function legacyImageContent(result, suppressImage, signal) {
|
|
28662
28680
|
if (result && typeof result === "object" && "url" in result) {
|
|
28663
28681
|
const r = result;
|
|
28664
28682
|
if (suppressImage) {
|
|
28665
28683
|
return [{ type: "text", text: `Saved: ${r.path ?? ""}` }];
|
|
28666
28684
|
}
|
|
28667
|
-
const buf = await fetchPngBytes(r.url);
|
|
28685
|
+
const buf = await fetchPngBytes(r.url, signal);
|
|
28668
28686
|
if (buf) {
|
|
28669
28687
|
return [imageBlock(buf, "image/png"), { type: "text", text: `Saved: ${r.path ?? ""}` }];
|
|
28670
28688
|
}
|
|
@@ -28781,9 +28799,9 @@ async function flowRunToMcpContent(result, ctx) {
|
|
|
28781
28799
|
}
|
|
28782
28800
|
}
|
|
28783
28801
|
for (const write of result.baselineWrites ?? []) {
|
|
28784
|
-
const { path:
|
|
28785
|
-
if (typeof
|
|
28786
|
-
blocks.push({ type: "text", text: `\u2717 baseline not written: ${
|
|
28802
|
+
const { path: path18, error: error2 } = isRecord2(write) ? write : {};
|
|
28803
|
+
if (typeof path18 === "string" && typeof error2 === "string") {
|
|
28804
|
+
blocks.push({ type: "text", text: `\u2717 baseline not written: ${path18}: ${error2}` });
|
|
28787
28805
|
}
|
|
28788
28806
|
}
|
|
28789
28807
|
if (result.ok !== void 0) {
|
|
@@ -29227,12 +29245,12 @@ ${stopped.join("\n")}`;
|
|
|
29227
29245
|
var SERVER_INSTRUCTIONS = "Argent \u2014 iOS Simulator, Android Emulator, and Chromium app control for interacting, testing, profiling and debugging mobile and Chromium applications. Use the platform the user named; otherwise prefer a device list-devices shows already running, and do not default to iOS. In a single-platform project, boot that platform. Prefer these tools over raw xcrun or adb commands, which are a fallback. Prefer launch-app or open-url over tapping home-screen icons. If the task may need a saved e2e test, load the argent-create-e2e skill (argent-qa-e2e for acceptance tests) before the first launch or in-app action: recording is not retroactive. Load the matching argent-* skill before React Native build or debug work, profiling, a physical phone, a Mac app or a TV. Interaction tools return the screen after the action: a screenshot plus the accessibility element tree with normalized tap frames. Take coordinates from that tree; call describe only when no fresh tree is available \u2014 never guess coordinates from pixels. A result names an identical earlier tree by its tree id in place of repeating it. If a tap fails twice, stop retrying and call a discovery tool again. Use await-ui-element to wait for the UI instead of polling with screenshots. Do not stop simulator servers when a task finishes: the next task reuses them. Call stop-all-simulator-servers when the user asks to clean up or ends the session, or when a skill tells you to recycle a device's services, always with devices: [...] naming the devices this session used. Never stop a Metro the user started unless they ask. One tool-server is shared by every agent using this argent install, so an unscoped call tears down their devices too \u2014 reserve it for a deliberate machine-wide cleanup. The argent CLI manages the toolkit: argent --help lists its commands.";
|
|
29228
29246
|
|
|
29229
29247
|
// ../argent-mcp/src/installed-version.ts
|
|
29230
|
-
import * as
|
|
29231
|
-
import * as
|
|
29248
|
+
import * as fs12 from "node:fs";
|
|
29249
|
+
import * as path17 from "node:path";
|
|
29232
29250
|
function getInstalledVersion() {
|
|
29233
29251
|
try {
|
|
29234
|
-
const pkgPath =
|
|
29235
|
-
const pkg = JSON.parse(
|
|
29252
|
+
const pkgPath = path17.resolve(import.meta.dirname, "..", "package.json");
|
|
29253
|
+
const pkg = JSON.parse(fs12.readFileSync(pkgPath, "utf8"));
|
|
29236
29254
|
return pkg.version ?? "unknown";
|
|
29237
29255
|
} catch {
|
|
29238
29256
|
return "unknown";
|
|
@@ -29287,9 +29305,9 @@ async function untilAborted(work, signal) {
|
|
|
29287
29305
|
}
|
|
29288
29306
|
let onAbort = () => {
|
|
29289
29307
|
};
|
|
29290
|
-
const aborted2 = new Promise((
|
|
29291
|
-
onAbort =
|
|
29292
|
-
if (signal.aborted)
|
|
29308
|
+
const aborted2 = new Promise((resolve11) => {
|
|
29309
|
+
onAbort = resolve11;
|
|
29310
|
+
if (signal.aborted) resolve11();
|
|
29293
29311
|
else signal.addEventListener("abort", onAbort, { once: true });
|
|
29294
29312
|
});
|
|
29295
29313
|
try {
|
|
@@ -29332,7 +29350,7 @@ function createToolCaller(deps) {
|
|
|
29332
29350
|
parseUrl(url);
|
|
29333
29351
|
return fetchWithReconnect(() => rebase(url), deps.reconnect, {
|
|
29334
29352
|
init: () => withHeaders(init),
|
|
29335
|
-
// A call that carried an upload is sent once and never
|
|
29353
|
+
// A call that carried an upload is sent once and never timed out: the
|
|
29336
29354
|
// tool-server consumes the upload when it reads the call, so a second
|
|
29337
29355
|
// attempt could only fail.
|
|
29338
29356
|
fetchTimeoutMs: meta2.longRunning || meta2.carriesUpload ? null : timeout,
|
|
@@ -29350,6 +29368,19 @@ function createToolCaller(deps) {
|
|
|
29350
29368
|
}
|
|
29351
29369
|
|
|
29352
29370
|
// ../argent-mcp/src/mcp-server.ts
|
|
29371
|
+
var SAVES_FILES_AFTER_CANCEL = /* @__PURE__ */ new Set(["screen-recording-stop", "native-profiler-stop"]);
|
|
29372
|
+
async function withDeadline(signal, ms, work) {
|
|
29373
|
+
const deadline = new AbortController();
|
|
29374
|
+
const timer = setTimeout(
|
|
29375
|
+
() => deadline.abort(new DOMException("The operation was aborted due to timeout", "TimeoutError")),
|
|
29376
|
+
ms
|
|
29377
|
+
);
|
|
29378
|
+
try {
|
|
29379
|
+
return await work(AbortSignal.any([signal, deadline.signal]));
|
|
29380
|
+
} finally {
|
|
29381
|
+
clearTimeout(timer);
|
|
29382
|
+
}
|
|
29383
|
+
}
|
|
29353
29384
|
async function startMcpServer(options) {
|
|
29354
29385
|
if (shouldShowFirstRunNotice()) {
|
|
29355
29386
|
process.stderr.write(`[argent] ${FIRST_RUN_NOTICE}
|
|
@@ -29406,7 +29437,7 @@ async function startMcpServer(options) {
|
|
|
29406
29437
|
async function spyLog(entry) {
|
|
29407
29438
|
try {
|
|
29408
29439
|
if (!logDirReady) {
|
|
29409
|
-
await mkdir5(
|
|
29440
|
+
await mkdir5(dirname11(LOG_FILE2), { recursive: true });
|
|
29410
29441
|
logDirReady = true;
|
|
29411
29442
|
}
|
|
29412
29443
|
await appendFile(LOG_FILE2, JSON.stringify(entry) + "\n");
|
|
@@ -29419,16 +29450,15 @@ async function startMcpServer(options) {
|
|
|
29419
29450
|
reconnect,
|
|
29420
29451
|
extraHeaders: aiClientHeaders
|
|
29421
29452
|
});
|
|
29422
|
-
async function awaitScreenSettled(udid, toolName) {
|
|
29453
|
+
async function awaitScreenSettled(udid, toolName, signal) {
|
|
29423
29454
|
const maxWaitMs = getAutoScreenshotDelayMs(toolName);
|
|
29424
29455
|
if (maxWaitMs === 0) return true;
|
|
29425
29456
|
const started = Date.now();
|
|
29426
29457
|
try {
|
|
29427
|
-
const idle = await
|
|
29428
|
-
|
|
29429
|
-
|
|
29430
|
-
|
|
29431
|
-
{ signal: AbortSignal.timeout(maxWaitMs + captureTimeoutMs) }
|
|
29458
|
+
const idle = await withDeadline(
|
|
29459
|
+
signal,
|
|
29460
|
+
maxWaitMs + captureTimeoutMs,
|
|
29461
|
+
(s) => callTool("await-screen-idle", { udid, timeoutMs: maxWaitMs }, { signal: s })
|
|
29432
29462
|
);
|
|
29433
29463
|
await spyLog({
|
|
29434
29464
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -29439,7 +29469,10 @@ async function startMcpServer(options) {
|
|
|
29439
29469
|
});
|
|
29440
29470
|
return idle.result?.settled === true;
|
|
29441
29471
|
} catch {
|
|
29442
|
-
await
|
|
29472
|
+
await sleep(Math.max(0, maxWaitMs - (Date.now() - started)), void 0, { signal }).catch(
|
|
29473
|
+
() => {
|
|
29474
|
+
}
|
|
29475
|
+
);
|
|
29443
29476
|
return false;
|
|
29444
29477
|
}
|
|
29445
29478
|
}
|
|
@@ -29449,7 +29482,8 @@ async function startMcpServer(options) {
|
|
|
29449
29482
|
const blocks = await toMcpContent(result, "image", {
|
|
29450
29483
|
toolsUrl: TOOLS_URL,
|
|
29451
29484
|
authToken: AUTH_TOKEN,
|
|
29452
|
-
deviceId: udid
|
|
29485
|
+
deviceId: udid,
|
|
29486
|
+
signal
|
|
29453
29487
|
});
|
|
29454
29488
|
if (!blocks.some((b) => b.type === "image")) return [];
|
|
29455
29489
|
return [{ type: "text", text: "--- Screen after action ---" }, ...blocks];
|
|
@@ -29494,10 +29528,10 @@ ${shown.text}` }];
|
|
|
29494
29528
|
instructions: SERVER_INSTRUCTIONS
|
|
29495
29529
|
}
|
|
29496
29530
|
);
|
|
29497
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
29531
|
+
server.setRequestHandler(ListToolsRequestSchema, async (_request, { signal }) => {
|
|
29498
29532
|
try {
|
|
29499
29533
|
const keywordFacts = !showsSchemaKeywords(server.getClientVersion()?.name);
|
|
29500
|
-
const tools = toMcpToolList(await fetchTools(), { keywordFacts });
|
|
29534
|
+
const tools = toMcpToolList(await fetchTools({ signal }), { keywordFacts });
|
|
29501
29535
|
await spyLog({
|
|
29502
29536
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
29503
29537
|
event: "list_tools",
|
|
@@ -29513,8 +29547,9 @@ ${shown.text}` }];
|
|
|
29513
29547
|
return { tools: [] };
|
|
29514
29548
|
}
|
|
29515
29549
|
});
|
|
29516
|
-
server.setRequestHandler(CallToolRequestSchema, async ({ params }, { signal
|
|
29550
|
+
server.setRequestHandler(CallToolRequestSchema, async ({ params }, { signal }) => {
|
|
29517
29551
|
const t0 = Date.now();
|
|
29552
|
+
const callSignal = SAVES_FILES_AFTER_CANCEL.has(canonicalToolId(params.name)) ? void 0 : signal;
|
|
29518
29553
|
let treeUdid;
|
|
29519
29554
|
await spyLog({
|
|
29520
29555
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -29523,7 +29558,11 @@ ${shown.text}` }];
|
|
|
29523
29558
|
args: params.arguments
|
|
29524
29559
|
});
|
|
29525
29560
|
try {
|
|
29526
|
-
const { result, outputHint, note, profiling } = await callTool(
|
|
29561
|
+
const { result, outputHint, note, profiling } = await callTool(
|
|
29562
|
+
params.name,
|
|
29563
|
+
params.arguments,
|
|
29564
|
+
{ signal: callSignal }
|
|
29565
|
+
);
|
|
29527
29566
|
await spyLog({
|
|
29528
29567
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
29529
29568
|
event: "tool_result",
|
|
@@ -29535,7 +29574,8 @@ ${shown.text}` }];
|
|
|
29535
29574
|
const ctx = {
|
|
29536
29575
|
toolsUrl: TOOLS_URL,
|
|
29537
29576
|
authToken: AUTH_TOKEN,
|
|
29538
|
-
deviceId: getDeviceIdFromArgs(params.arguments)
|
|
29577
|
+
deviceId: getDeviceIdFromArgs(params.arguments),
|
|
29578
|
+
signal: callSignal
|
|
29539
29579
|
};
|
|
29540
29580
|
const devicesText = canonicalToolId(params.name) === "list-devices" ? listDevicesText(result) : void 0;
|
|
29541
29581
|
let content;
|
|
@@ -29569,22 +29609,24 @@ ${shown.text}` }];
|
|
|
29569
29609
|
];
|
|
29570
29610
|
} else if (udid && (wantScreenshot || wantTree) && profiling) {
|
|
29571
29611
|
if (params.name !== "describe") {
|
|
29572
|
-
await awaitScreenSettled(udid, params.name);
|
|
29612
|
+
await awaitScreenSettled(udid, params.name, signal);
|
|
29573
29613
|
content = [...content, { type: "text", text: PROFILING_CAPTURE_SKIPPED_NOTE }];
|
|
29574
29614
|
}
|
|
29575
29615
|
} else if (udid && (wantScreenshot || wantTree)) {
|
|
29576
|
-
const screenSettled = await awaitScreenSettled(udid, params.name);
|
|
29577
|
-
const signal = AbortSignal.timeout(captureTimeoutMs);
|
|
29578
|
-
const screenshot = wantScreenshot ? captureScreenshotBlocks(udid, signal) : Promise.resolve([]);
|
|
29579
|
-
if (!screenSettled) await screenshot;
|
|
29616
|
+
const screenSettled = await awaitScreenSettled(udid, params.name, signal);
|
|
29580
29617
|
if (wantTree) treeUdid = udid;
|
|
29581
|
-
const
|
|
29582
|
-
|
|
29618
|
+
const captured = await withDeadline(signal, captureTimeoutMs, async (captureSignal) => {
|
|
29619
|
+
const screenshot = wantScreenshot ? captureScreenshotBlocks(udid, captureSignal) : Promise.resolve([]);
|
|
29620
|
+
if (!screenSettled) await screenshot;
|
|
29621
|
+
const tree = wantTree ? captureTreeBlocks(udid, params.name, captureSignal) : Promise.resolve([]);
|
|
29622
|
+
return [...await screenshot, ...await tree];
|
|
29623
|
+
});
|
|
29624
|
+
content = [...content, ...captured];
|
|
29583
29625
|
}
|
|
29584
29626
|
if (note) {
|
|
29585
29627
|
content = [{ type: "text", text: note }, ...content];
|
|
29586
29628
|
}
|
|
29587
|
-
if (treeUdid !== void 0 &&
|
|
29629
|
+
if (treeUdid !== void 0 && signal.aborted) trees.forget(treeUdid);
|
|
29588
29630
|
return { content };
|
|
29589
29631
|
} catch (err) {
|
|
29590
29632
|
if (treeUdid !== void 0) trees.forget(treeUdid);
|
|
@@ -29594,6 +29636,7 @@ ${shown.text}` }];
|
|
|
29594
29636
|
name: params.name,
|
|
29595
29637
|
durationMs: Date.now() - t0,
|
|
29596
29638
|
isError: true,
|
|
29639
|
+
...signal.aborted ? { cancelled: true } : {},
|
|
29597
29640
|
error: String(err instanceof Error ? err.message : err)
|
|
29598
29641
|
});
|
|
29599
29642
|
return {
|