@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/cli-cmds.mjs
CHANGED
|
@@ -124,17 +124,17 @@ var require_visit = __commonJS({
|
|
|
124
124
|
visit2.BREAK = BREAK;
|
|
125
125
|
visit2.SKIP = SKIP;
|
|
126
126
|
visit2.REMOVE = REMOVE;
|
|
127
|
-
function visit_(key, node2, visitor,
|
|
128
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
127
|
+
function visit_(key, node2, visitor, path29) {
|
|
128
|
+
const ctrl = callVisitor(key, node2, visitor, path29);
|
|
129
129
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
130
|
-
replaceNode(key,
|
|
131
|
-
return visit_(key, ctrl, visitor,
|
|
130
|
+
replaceNode(key, path29, ctrl);
|
|
131
|
+
return visit_(key, ctrl, visitor, path29);
|
|
132
132
|
}
|
|
133
133
|
if (typeof ctrl !== "symbol") {
|
|
134
134
|
if (identity2.isCollection(node2)) {
|
|
135
|
-
|
|
135
|
+
path29 = Object.freeze(path29.concat(node2));
|
|
136
136
|
for (let i2 = 0; i2 < node2.items.length; ++i2) {
|
|
137
|
-
const ci = visit_(i2, node2.items[i2], visitor,
|
|
137
|
+
const ci = visit_(i2, node2.items[i2], visitor, path29);
|
|
138
138
|
if (typeof ci === "number")
|
|
139
139
|
i2 = ci - 1;
|
|
140
140
|
else if (ci === BREAK)
|
|
@@ -145,13 +145,13 @@ var require_visit = __commonJS({
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
} else if (identity2.isPair(node2)) {
|
|
148
|
-
|
|
149
|
-
const ck = visit_("key", node2.key, visitor,
|
|
148
|
+
path29 = Object.freeze(path29.concat(node2));
|
|
149
|
+
const ck = visit_("key", node2.key, visitor, path29);
|
|
150
150
|
if (ck === BREAK)
|
|
151
151
|
return BREAK;
|
|
152
152
|
else if (ck === REMOVE)
|
|
153
153
|
node2.key = null;
|
|
154
|
-
const cv = visit_("value", node2.value, visitor,
|
|
154
|
+
const cv = visit_("value", node2.value, visitor, path29);
|
|
155
155
|
if (cv === BREAK)
|
|
156
156
|
return BREAK;
|
|
157
157
|
else if (cv === REMOVE)
|
|
@@ -172,17 +172,17 @@ var require_visit = __commonJS({
|
|
|
172
172
|
visitAsync.BREAK = BREAK;
|
|
173
173
|
visitAsync.SKIP = SKIP;
|
|
174
174
|
visitAsync.REMOVE = REMOVE;
|
|
175
|
-
async function visitAsync_(key, node2, visitor,
|
|
176
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
175
|
+
async function visitAsync_(key, node2, visitor, path29) {
|
|
176
|
+
const ctrl = await callVisitor(key, node2, visitor, path29);
|
|
177
177
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
178
|
-
replaceNode(key,
|
|
179
|
-
return visitAsync_(key, ctrl, visitor,
|
|
178
|
+
replaceNode(key, path29, ctrl);
|
|
179
|
+
return visitAsync_(key, ctrl, visitor, path29);
|
|
180
180
|
}
|
|
181
181
|
if (typeof ctrl !== "symbol") {
|
|
182
182
|
if (identity2.isCollection(node2)) {
|
|
183
|
-
|
|
183
|
+
path29 = Object.freeze(path29.concat(node2));
|
|
184
184
|
for (let i2 = 0; i2 < node2.items.length; ++i2) {
|
|
185
|
-
const ci = await visitAsync_(i2, node2.items[i2], visitor,
|
|
185
|
+
const ci = await visitAsync_(i2, node2.items[i2], visitor, path29);
|
|
186
186
|
if (typeof ci === "number")
|
|
187
187
|
i2 = ci - 1;
|
|
188
188
|
else if (ci === BREAK)
|
|
@@ -193,13 +193,13 @@ var require_visit = __commonJS({
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
} else if (identity2.isPair(node2)) {
|
|
196
|
-
|
|
197
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
196
|
+
path29 = Object.freeze(path29.concat(node2));
|
|
197
|
+
const ck = await visitAsync_("key", node2.key, visitor, path29);
|
|
198
198
|
if (ck === BREAK)
|
|
199
199
|
return BREAK;
|
|
200
200
|
else if (ck === REMOVE)
|
|
201
201
|
node2.key = null;
|
|
202
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
202
|
+
const cv = await visitAsync_("value", node2.value, visitor, path29);
|
|
203
203
|
if (cv === BREAK)
|
|
204
204
|
return BREAK;
|
|
205
205
|
else if (cv === REMOVE)
|
|
@@ -226,23 +226,23 @@ var require_visit = __commonJS({
|
|
|
226
226
|
}
|
|
227
227
|
return visitor;
|
|
228
228
|
}
|
|
229
|
-
function callVisitor(key, node2, visitor,
|
|
229
|
+
function callVisitor(key, node2, visitor, path29) {
|
|
230
230
|
if (typeof visitor === "function")
|
|
231
|
-
return visitor(key, node2,
|
|
231
|
+
return visitor(key, node2, path29);
|
|
232
232
|
if (identity2.isMap(node2))
|
|
233
|
-
return visitor.Map?.(key, node2,
|
|
233
|
+
return visitor.Map?.(key, node2, path29);
|
|
234
234
|
if (identity2.isSeq(node2))
|
|
235
|
-
return visitor.Seq?.(key, node2,
|
|
235
|
+
return visitor.Seq?.(key, node2, path29);
|
|
236
236
|
if (identity2.isPair(node2))
|
|
237
|
-
return visitor.Pair?.(key, node2,
|
|
237
|
+
return visitor.Pair?.(key, node2, path29);
|
|
238
238
|
if (identity2.isScalar(node2))
|
|
239
|
-
return visitor.Scalar?.(key, node2,
|
|
239
|
+
return visitor.Scalar?.(key, node2, path29);
|
|
240
240
|
if (identity2.isAlias(node2))
|
|
241
|
-
return visitor.Alias?.(key, node2,
|
|
241
|
+
return visitor.Alias?.(key, node2, path29);
|
|
242
242
|
return void 0;
|
|
243
243
|
}
|
|
244
|
-
function replaceNode(key,
|
|
245
|
-
const parent =
|
|
244
|
+
function replaceNode(key, path29, node2) {
|
|
245
|
+
const parent = path29[path29.length - 1];
|
|
246
246
|
if (identity2.isCollection(parent)) {
|
|
247
247
|
parent.items[key] = node2;
|
|
248
248
|
} else if (identity2.isPair(parent)) {
|
|
@@ -854,10 +854,10 @@ var require_Collection = __commonJS({
|
|
|
854
854
|
var createNode = require_createNode();
|
|
855
855
|
var identity2 = require_identity();
|
|
856
856
|
var Node = require_Node();
|
|
857
|
-
function collectionFromPath(schema,
|
|
857
|
+
function collectionFromPath(schema, path29, value) {
|
|
858
858
|
let v = value;
|
|
859
|
-
for (let i2 =
|
|
860
|
-
const k =
|
|
859
|
+
for (let i2 = path29.length - 1; i2 >= 0; --i2) {
|
|
860
|
+
const k = path29[i2];
|
|
861
861
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
862
862
|
const a2 = [];
|
|
863
863
|
a2[k] = v;
|
|
@@ -876,7 +876,7 @@ var require_Collection = __commonJS({
|
|
|
876
876
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
877
877
|
});
|
|
878
878
|
}
|
|
879
|
-
var isEmptyPath = (
|
|
879
|
+
var isEmptyPath = (path29) => path29 == null || typeof path29 === "object" && !!path29[Symbol.iterator]().next().done;
|
|
880
880
|
var Collection = class extends Node.NodeBase {
|
|
881
881
|
constructor(type, schema) {
|
|
882
882
|
super(type);
|
|
@@ -906,11 +906,11 @@ var require_Collection = __commonJS({
|
|
|
906
906
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
907
907
|
* that already exists in the map.
|
|
908
908
|
*/
|
|
909
|
-
addIn(
|
|
910
|
-
if (isEmptyPath(
|
|
909
|
+
addIn(path29, value) {
|
|
910
|
+
if (isEmptyPath(path29))
|
|
911
911
|
this.add(value);
|
|
912
912
|
else {
|
|
913
|
-
const [key, ...rest] =
|
|
913
|
+
const [key, ...rest] = path29;
|
|
914
914
|
const node2 = this.get(key, true);
|
|
915
915
|
if (identity2.isCollection(node2))
|
|
916
916
|
node2.addIn(rest, value);
|
|
@@ -924,8 +924,8 @@ var require_Collection = __commonJS({
|
|
|
924
924
|
* Removes a value from the collection.
|
|
925
925
|
* @returns `true` if the item was found and removed.
|
|
926
926
|
*/
|
|
927
|
-
deleteIn(
|
|
928
|
-
const [key, ...rest] =
|
|
927
|
+
deleteIn(path29) {
|
|
928
|
+
const [key, ...rest] = path29;
|
|
929
929
|
if (rest.length === 0)
|
|
930
930
|
return this.delete(key);
|
|
931
931
|
const node2 = this.get(key, true);
|
|
@@ -939,8 +939,8 @@ var require_Collection = __commonJS({
|
|
|
939
939
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
940
940
|
* `true` (collections are always returned intact).
|
|
941
941
|
*/
|
|
942
|
-
getIn(
|
|
943
|
-
const [key, ...rest] =
|
|
942
|
+
getIn(path29, keepScalar) {
|
|
943
|
+
const [key, ...rest] = path29;
|
|
944
944
|
const node2 = this.get(key, true);
|
|
945
945
|
if (rest.length === 0)
|
|
946
946
|
return !keepScalar && identity2.isScalar(node2) ? node2.value : node2;
|
|
@@ -958,8 +958,8 @@ var require_Collection = __commonJS({
|
|
|
958
958
|
/**
|
|
959
959
|
* Checks if the collection includes a value with the key `key`.
|
|
960
960
|
*/
|
|
961
|
-
hasIn(
|
|
962
|
-
const [key, ...rest] =
|
|
961
|
+
hasIn(path29) {
|
|
962
|
+
const [key, ...rest] = path29;
|
|
963
963
|
if (rest.length === 0)
|
|
964
964
|
return this.has(key);
|
|
965
965
|
const node2 = this.get(key, true);
|
|
@@ -969,8 +969,8 @@ var require_Collection = __commonJS({
|
|
|
969
969
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
970
970
|
* boolean to add/remove the item from the set.
|
|
971
971
|
*/
|
|
972
|
-
setIn(
|
|
973
|
-
const [key, ...rest] =
|
|
972
|
+
setIn(path29, value) {
|
|
973
|
+
const [key, ...rest] = path29;
|
|
974
974
|
if (rest.length === 0) {
|
|
975
975
|
this.set(key, value);
|
|
976
976
|
} else {
|
|
@@ -3485,9 +3485,9 @@ var require_Document = __commonJS({
|
|
|
3485
3485
|
this.contents.add(value);
|
|
3486
3486
|
}
|
|
3487
3487
|
/** Adds a value to the document. */
|
|
3488
|
-
addIn(
|
|
3488
|
+
addIn(path29, value) {
|
|
3489
3489
|
if (assertCollection(this.contents))
|
|
3490
|
-
this.contents.addIn(
|
|
3490
|
+
this.contents.addIn(path29, value);
|
|
3491
3491
|
}
|
|
3492
3492
|
/**
|
|
3493
3493
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3562,14 +3562,14 @@ var require_Document = __commonJS({
|
|
|
3562
3562
|
* Removes a value from the document.
|
|
3563
3563
|
* @returns `true` if the item was found and removed.
|
|
3564
3564
|
*/
|
|
3565
|
-
deleteIn(
|
|
3566
|
-
if (Collection.isEmptyPath(
|
|
3565
|
+
deleteIn(path29) {
|
|
3566
|
+
if (Collection.isEmptyPath(path29)) {
|
|
3567
3567
|
if (this.contents == null)
|
|
3568
3568
|
return false;
|
|
3569
3569
|
this.contents = null;
|
|
3570
3570
|
return true;
|
|
3571
3571
|
}
|
|
3572
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3572
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path29) : false;
|
|
3573
3573
|
}
|
|
3574
3574
|
/**
|
|
3575
3575
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3584,10 +3584,10 @@ var require_Document = __commonJS({
|
|
|
3584
3584
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3585
3585
|
* `true` (collections are always returned intact).
|
|
3586
3586
|
*/
|
|
3587
|
-
getIn(
|
|
3588
|
-
if (Collection.isEmptyPath(
|
|
3587
|
+
getIn(path29, keepScalar) {
|
|
3588
|
+
if (Collection.isEmptyPath(path29))
|
|
3589
3589
|
return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3590
|
-
return identity2.isCollection(this.contents) ? this.contents.getIn(
|
|
3590
|
+
return identity2.isCollection(this.contents) ? this.contents.getIn(path29, keepScalar) : void 0;
|
|
3591
3591
|
}
|
|
3592
3592
|
/**
|
|
3593
3593
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3598,10 +3598,10 @@ var require_Document = __commonJS({
|
|
|
3598
3598
|
/**
|
|
3599
3599
|
* Checks if the document includes a value at `path`.
|
|
3600
3600
|
*/
|
|
3601
|
-
hasIn(
|
|
3602
|
-
if (Collection.isEmptyPath(
|
|
3601
|
+
hasIn(path29) {
|
|
3602
|
+
if (Collection.isEmptyPath(path29))
|
|
3603
3603
|
return this.contents !== void 0;
|
|
3604
|
-
return identity2.isCollection(this.contents) ? this.contents.hasIn(
|
|
3604
|
+
return identity2.isCollection(this.contents) ? this.contents.hasIn(path29) : false;
|
|
3605
3605
|
}
|
|
3606
3606
|
/**
|
|
3607
3607
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3618,13 +3618,13 @@ var require_Document = __commonJS({
|
|
|
3618
3618
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3619
3619
|
* boolean to add/remove the item from the set.
|
|
3620
3620
|
*/
|
|
3621
|
-
setIn(
|
|
3622
|
-
if (Collection.isEmptyPath(
|
|
3621
|
+
setIn(path29, value) {
|
|
3622
|
+
if (Collection.isEmptyPath(path29)) {
|
|
3623
3623
|
this.contents = value;
|
|
3624
3624
|
} else if (this.contents == null) {
|
|
3625
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3625
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path29), value);
|
|
3626
3626
|
} else if (assertCollection(this.contents)) {
|
|
3627
|
-
this.contents.setIn(
|
|
3627
|
+
this.contents.setIn(path29, value);
|
|
3628
3628
|
}
|
|
3629
3629
|
}
|
|
3630
3630
|
/**
|
|
@@ -5585,9 +5585,9 @@ var require_cst_visit = __commonJS({
|
|
|
5585
5585
|
visit2.BREAK = BREAK;
|
|
5586
5586
|
visit2.SKIP = SKIP;
|
|
5587
5587
|
visit2.REMOVE = REMOVE;
|
|
5588
|
-
visit2.itemAtPath = (cst,
|
|
5588
|
+
visit2.itemAtPath = (cst, path29) => {
|
|
5589
5589
|
let item = cst;
|
|
5590
|
-
for (const [field, index] of
|
|
5590
|
+
for (const [field, index] of path29) {
|
|
5591
5591
|
const tok = item?.[field];
|
|
5592
5592
|
if (tok && "items" in tok) {
|
|
5593
5593
|
item = tok.items[index];
|
|
@@ -5596,23 +5596,23 @@ var require_cst_visit = __commonJS({
|
|
|
5596
5596
|
}
|
|
5597
5597
|
return item;
|
|
5598
5598
|
};
|
|
5599
|
-
visit2.parentCollection = (cst,
|
|
5600
|
-
const parent = visit2.itemAtPath(cst,
|
|
5601
|
-
const field =
|
|
5599
|
+
visit2.parentCollection = (cst, path29) => {
|
|
5600
|
+
const parent = visit2.itemAtPath(cst, path29.slice(0, -1));
|
|
5601
|
+
const field = path29[path29.length - 1][0];
|
|
5602
5602
|
const coll = parent?.[field];
|
|
5603
5603
|
if (coll && "items" in coll)
|
|
5604
5604
|
return coll;
|
|
5605
5605
|
throw new Error("Parent collection not found");
|
|
5606
5606
|
};
|
|
5607
|
-
function _visit(
|
|
5608
|
-
let ctrl = visitor(item,
|
|
5607
|
+
function _visit(path29, item, visitor) {
|
|
5608
|
+
let ctrl = visitor(item, path29);
|
|
5609
5609
|
if (typeof ctrl === "symbol")
|
|
5610
5610
|
return ctrl;
|
|
5611
5611
|
for (const field of ["key", "value"]) {
|
|
5612
5612
|
const token = item[field];
|
|
5613
5613
|
if (token && "items" in token) {
|
|
5614
5614
|
for (let i2 = 0; i2 < token.items.length; ++i2) {
|
|
5615
|
-
const ci = _visit(Object.freeze(
|
|
5615
|
+
const ci = _visit(Object.freeze(path29.concat([[field, i2]])), token.items[i2], visitor);
|
|
5616
5616
|
if (typeof ci === "number")
|
|
5617
5617
|
i2 = ci - 1;
|
|
5618
5618
|
else if (ci === BREAK)
|
|
@@ -5623,10 +5623,10 @@ var require_cst_visit = __commonJS({
|
|
|
5623
5623
|
}
|
|
5624
5624
|
}
|
|
5625
5625
|
if (typeof ctrl === "function" && field === "key")
|
|
5626
|
-
ctrl = ctrl(item,
|
|
5626
|
+
ctrl = ctrl(item, path29);
|
|
5627
5627
|
}
|
|
5628
5628
|
}
|
|
5629
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5629
|
+
return typeof ctrl === "function" ? ctrl(item, path29) : ctrl;
|
|
5630
5630
|
}
|
|
5631
5631
|
exports.visit = visit2;
|
|
5632
5632
|
}
|
|
@@ -6928,14 +6928,14 @@ var require_parser = __commonJS({
|
|
|
6928
6928
|
case "scalar":
|
|
6929
6929
|
case "single-quoted-scalar":
|
|
6930
6930
|
case "double-quoted-scalar": {
|
|
6931
|
-
const
|
|
6931
|
+
const fs20 = this.flowScalar(this.type);
|
|
6932
6932
|
if (atNextItem || it.value) {
|
|
6933
|
-
map2.items.push({ start, key:
|
|
6933
|
+
map2.items.push({ start, key: fs20, sep: [] });
|
|
6934
6934
|
this.onKeyLine = true;
|
|
6935
6935
|
} else if (it.sep) {
|
|
6936
|
-
this.stack.push(
|
|
6936
|
+
this.stack.push(fs20);
|
|
6937
6937
|
} else {
|
|
6938
|
-
Object.assign(it, { key:
|
|
6938
|
+
Object.assign(it, { key: fs20, sep: [] });
|
|
6939
6939
|
this.onKeyLine = true;
|
|
6940
6940
|
}
|
|
6941
6941
|
return;
|
|
@@ -7063,13 +7063,13 @@ var require_parser = __commonJS({
|
|
|
7063
7063
|
case "scalar":
|
|
7064
7064
|
case "single-quoted-scalar":
|
|
7065
7065
|
case "double-quoted-scalar": {
|
|
7066
|
-
const
|
|
7066
|
+
const fs20 = this.flowScalar(this.type);
|
|
7067
7067
|
if (!it || it.value)
|
|
7068
|
-
fc.items.push({ start: [], key:
|
|
7068
|
+
fc.items.push({ start: [], key: fs20, sep: [] });
|
|
7069
7069
|
else if (it.sep)
|
|
7070
|
-
this.stack.push(
|
|
7070
|
+
this.stack.push(fs20);
|
|
7071
7071
|
else
|
|
7072
|
-
Object.assign(it, { key:
|
|
7072
|
+
Object.assign(it, { key: fs20, sep: [] });
|
|
7073
7073
|
return;
|
|
7074
7074
|
}
|
|
7075
7075
|
case "flow-map-end":
|
|
@@ -8916,8 +8916,8 @@ var require_src = __commonJS({
|
|
|
8916
8916
|
});
|
|
8917
8917
|
|
|
8918
8918
|
// ../argent-cli/src/run.ts
|
|
8919
|
-
import * as
|
|
8920
|
-
import * as
|
|
8919
|
+
import * as fs13 from "node:fs";
|
|
8920
|
+
import * as path19 from "node:path";
|
|
8921
8921
|
|
|
8922
8922
|
// ../argent-tools-client/src/launcher.ts
|
|
8923
8923
|
import * as net from "node:net";
|
|
@@ -8935,6 +8935,7 @@ var LOCK_FILE = path.join(STATE_DIR, "tool-server.lock");
|
|
|
8935
8935
|
var AUTH_TOKEN_BYTES = 32;
|
|
8936
8936
|
var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
|
|
8937
8937
|
var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
|
|
8938
|
+
var AUTOSPAWN_HOST = "127.0.0.1";
|
|
8938
8939
|
function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
8939
8940
|
const env = {
|
|
8940
8941
|
...baseEnv,
|
|
@@ -8946,7 +8947,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
|
8946
8947
|
if (options.idleTimeoutMinutes !== void 0) {
|
|
8947
8948
|
env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
|
|
8948
8949
|
}
|
|
8949
|
-
|
|
8950
|
+
env[AUTH_TOKEN_ENV] = options.token ?? "";
|
|
8950
8951
|
if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
|
|
8951
8952
|
if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
|
|
8952
8953
|
return env;
|
|
@@ -9415,6 +9416,7 @@ async function ensureToolsServer(paths) {
|
|
|
9415
9416
|
const port = await findFreePort();
|
|
9416
9417
|
const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
|
|
9417
9418
|
token,
|
|
9419
|
+
host: AUTOSPAWN_HOST,
|
|
9418
9420
|
idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES
|
|
9419
9421
|
});
|
|
9420
9422
|
await writeState({
|
|
@@ -9423,11 +9425,11 @@ async function ensureToolsServer(paths) {
|
|
|
9423
9425
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9424
9426
|
bundlePath: paths.bundlePath,
|
|
9425
9427
|
version: diskVersion,
|
|
9426
|
-
host:
|
|
9428
|
+
host: AUTOSPAWN_HOST,
|
|
9427
9429
|
token,
|
|
9428
9430
|
managed: "autospawn"
|
|
9429
9431
|
});
|
|
9430
|
-
return { url: formatUrl(
|
|
9432
|
+
return { url: formatUrl(AUTOSPAWN_HOST, actualPort), token };
|
|
9431
9433
|
} finally {
|
|
9432
9434
|
lock?.release();
|
|
9433
9435
|
}
|
|
@@ -9593,6 +9595,7 @@ function isFeatureEnabled(name, options = {}, registry2 = FLAG_REGISTRY) {
|
|
|
9593
9595
|
}
|
|
9594
9596
|
|
|
9595
9597
|
// ../configuration-core/src/paths.ts
|
|
9598
|
+
import * as fs3 from "node:fs";
|
|
9596
9599
|
import * as os from "node:os";
|
|
9597
9600
|
import * as path3 from "node:path";
|
|
9598
9601
|
function nonEmpty(value) {
|
|
@@ -9604,6 +9607,16 @@ function resolveHomeDir(options = {}) {
|
|
|
9604
9607
|
if (options.homeDir) return options.homeDir;
|
|
9605
9608
|
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
9606
9609
|
}
|
|
9610
|
+
function isHomeDir(dir, options = {}) {
|
|
9611
|
+
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
9612
|
+
}
|
|
9613
|
+
function canonicalPath(p) {
|
|
9614
|
+
try {
|
|
9615
|
+
return fs3.realpathSync.native(p);
|
|
9616
|
+
} catch {
|
|
9617
|
+
return path3.resolve(p);
|
|
9618
|
+
}
|
|
9619
|
+
}
|
|
9607
9620
|
function argentHomeDir() {
|
|
9608
9621
|
return path3.join(resolveHomeDir(), ".argent");
|
|
9609
9622
|
}
|
|
@@ -9620,11 +9633,11 @@ function configFilePath(scope = "global", options = {}) {
|
|
|
9620
9633
|
|
|
9621
9634
|
// ../configuration-core/src/config.ts
|
|
9622
9635
|
import * as crypto from "node:crypto";
|
|
9623
|
-
import * as
|
|
9636
|
+
import * as fs4 from "node:fs";
|
|
9624
9637
|
import * as path4 from "node:path";
|
|
9625
9638
|
function readConfigObject(scope = "global", options = {}) {
|
|
9626
9639
|
try {
|
|
9627
|
-
const raw =
|
|
9640
|
+
const raw = fs4.readFileSync(configFilePath(scope, options), "utf8");
|
|
9628
9641
|
const json2 = JSON.parse(raw);
|
|
9629
9642
|
if (json2 && typeof json2 === "object" && !Array.isArray(json2)) {
|
|
9630
9643
|
return json2;
|
|
@@ -9700,9 +9713,9 @@ function acquireConfigLock(finalPath) {
|
|
|
9700
9713
|
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
9701
9714
|
for (; ; ) {
|
|
9702
9715
|
try {
|
|
9703
|
-
const fd =
|
|
9716
|
+
const fd = fs4.openSync(lockPath, "wx", 384);
|
|
9704
9717
|
try {
|
|
9705
|
-
|
|
9718
|
+
fs4.writeSync(fd, `${process.pid}
|
|
9706
9719
|
`);
|
|
9707
9720
|
} catch {
|
|
9708
9721
|
}
|
|
@@ -9710,8 +9723,8 @@ function acquireConfigLock(finalPath) {
|
|
|
9710
9723
|
} catch (err) {
|
|
9711
9724
|
if (err.code !== "EEXIST") return null;
|
|
9712
9725
|
try {
|
|
9713
|
-
if (Date.now() -
|
|
9714
|
-
|
|
9726
|
+
if (Date.now() - fs4.statSync(lockPath).mtimeMs > LOCK_STALE_MS2) {
|
|
9727
|
+
fs4.unlinkSync(lockPath);
|
|
9715
9728
|
continue;
|
|
9716
9729
|
}
|
|
9717
9730
|
} catch {
|
|
@@ -9723,35 +9736,35 @@ function acquireConfigLock(finalPath) {
|
|
|
9723
9736
|
}
|
|
9724
9737
|
function releaseConfigLock(lock) {
|
|
9725
9738
|
try {
|
|
9726
|
-
|
|
9739
|
+
fs4.closeSync(lock.fd);
|
|
9727
9740
|
} catch {
|
|
9728
9741
|
}
|
|
9729
9742
|
try {
|
|
9730
|
-
|
|
9743
|
+
fs4.unlinkSync(lock.lockPath);
|
|
9731
9744
|
} catch {
|
|
9732
9745
|
}
|
|
9733
9746
|
}
|
|
9734
9747
|
function updateConfig(mutate, scope = "global", options = {}) {
|
|
9735
9748
|
const dir = configDir(scope, options);
|
|
9736
|
-
|
|
9749
|
+
fs4.mkdirSync(dir, { recursive: true });
|
|
9737
9750
|
const finalPath = configFilePath(scope, options);
|
|
9738
9751
|
const lock = acquireConfigLock(finalPath);
|
|
9739
9752
|
try {
|
|
9740
9753
|
const next = readConfigObject(scope, options);
|
|
9741
9754
|
mutate(next);
|
|
9742
9755
|
const tmpPath = path4.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
9743
|
-
const fd =
|
|
9756
|
+
const fd = fs4.openSync(tmpPath, "wx", 384);
|
|
9744
9757
|
try {
|
|
9745
|
-
|
|
9746
|
-
|
|
9758
|
+
fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
9759
|
+
fs4.fsyncSync(fd);
|
|
9747
9760
|
} finally {
|
|
9748
|
-
|
|
9761
|
+
fs4.closeSync(fd);
|
|
9749
9762
|
}
|
|
9750
9763
|
try {
|
|
9751
|
-
|
|
9764
|
+
fs4.renameSync(tmpPath, finalPath);
|
|
9752
9765
|
} catch (err) {
|
|
9753
9766
|
try {
|
|
9754
|
-
|
|
9767
|
+
fs4.unlinkSync(tmpPath);
|
|
9755
9768
|
} catch {
|
|
9756
9769
|
}
|
|
9757
9770
|
throw err;
|
|
@@ -9763,7 +9776,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
9763
9776
|
|
|
9764
9777
|
// ../configuration-core/src/secrets.ts
|
|
9765
9778
|
var import_dotenv = __toESM(require_dist2(), 1);
|
|
9766
|
-
import * as
|
|
9779
|
+
import * as fs5 from "node:fs";
|
|
9767
9780
|
import * as path5 from "node:path";
|
|
9768
9781
|
var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
|
|
9769
9782
|
var SECRETS_FILE_NAME = "secrets.env";
|
|
@@ -9793,10 +9806,10 @@ function fileSource(filePath, exposure) {
|
|
|
9793
9806
|
names: [],
|
|
9794
9807
|
values: /* @__PURE__ */ new Map()
|
|
9795
9808
|
};
|
|
9796
|
-
if (!
|
|
9809
|
+
if (!fs5.statSync(filePath, { throwIfNoEntry: false })) return absent;
|
|
9797
9810
|
let content;
|
|
9798
9811
|
try {
|
|
9799
|
-
content =
|
|
9812
|
+
content = fs5.readFileSync(filePath, "utf8");
|
|
9800
9813
|
} catch {
|
|
9801
9814
|
return absent;
|
|
9802
9815
|
}
|
|
@@ -9822,7 +9835,9 @@ function fileSource(filePath, exposure) {
|
|
|
9822
9835
|
}
|
|
9823
9836
|
function secretSources(options = {}) {
|
|
9824
9837
|
const sources = [envSource(options.env ?? process.env)];
|
|
9825
|
-
const
|
|
9838
|
+
const home = resolveHomeDir(options);
|
|
9839
|
+
const found = findProjectRoot(options.cwd ?? process.cwd());
|
|
9840
|
+
const projectRoot = found && isHomeDir(found, options) ? home : found;
|
|
9826
9841
|
const filePaths = [];
|
|
9827
9842
|
if (projectRoot) {
|
|
9828
9843
|
filePaths.push({
|
|
@@ -9834,7 +9849,7 @@ function secretSources(options = {}) {
|
|
|
9834
9849
|
}
|
|
9835
9850
|
}
|
|
9836
9851
|
filePaths.push({
|
|
9837
|
-
path: path5.join(
|
|
9852
|
+
path: path5.join(home, ".argent", SECRETS_FILE_NAME),
|
|
9838
9853
|
exposure: "dedicated"
|
|
9839
9854
|
});
|
|
9840
9855
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -10159,6 +10174,7 @@ function unsetConfigValue(key, scope = "global", options = {}, registry2 = CONFI
|
|
|
10159
10174
|
return removed;
|
|
10160
10175
|
}
|
|
10161
10176
|
function listConfig(options = {}, registry2 = CONFIG_SCHEMA) {
|
|
10177
|
+
const projectIsHome = isHomeDir(resolveProjectRoot(options.cwd ?? process.cwd()), options);
|
|
10162
10178
|
return registry2.map((def) => ({
|
|
10163
10179
|
key: def.key,
|
|
10164
10180
|
description: def.description,
|
|
@@ -10167,7 +10183,7 @@ function listConfig(options = {}, registry2 = CONFIG_SCHEMA) {
|
|
|
10167
10183
|
...describeExpectedValue(def) ? { expected: describeExpectedValue(def) } : {},
|
|
10168
10184
|
...def.example ? { example: def.example } : {},
|
|
10169
10185
|
effective: getConfigValue(def, options),
|
|
10170
|
-
project: readScopeValue(def, "project", options),
|
|
10186
|
+
project: projectIsHome ? void 0 : readScopeValue(def, "project", options),
|
|
10171
10187
|
global: readScopeValue(def, "global", options)
|
|
10172
10188
|
}));
|
|
10173
10189
|
}
|
|
@@ -10245,16 +10261,16 @@ function toolStepFiles(specs, args) {
|
|
|
10245
10261
|
}
|
|
10246
10262
|
return files;
|
|
10247
10263
|
}
|
|
10248
|
-
function isClientFileArgument({ spec, path:
|
|
10249
|
-
return spec.kind === "file" && spec.path === `\${${spec.target}}` &&
|
|
10264
|
+
function isClientFileArgument({ spec, path: path29 }) {
|
|
10265
|
+
return spec.kind === "file" && spec.path === `\${${spec.target}}` && path29.startsWith("/") && hasToolFileExtension(path29);
|
|
10250
10266
|
}
|
|
10251
10267
|
|
|
10252
10268
|
// ../registry/src/flow-file-refs.ts
|
|
10253
|
-
import * as
|
|
10269
|
+
import * as fs7 from "node:fs/promises";
|
|
10254
10270
|
import * as path8 from "node:path";
|
|
10255
10271
|
|
|
10256
10272
|
// ../registry/src/e2e-dirs.ts
|
|
10257
|
-
import * as
|
|
10273
|
+
import * as fs6 from "node:fs/promises";
|
|
10258
10274
|
import * as path7 from "node:path";
|
|
10259
10275
|
var E2E_DIR = path7.join(".argent", "e2e");
|
|
10260
10276
|
var LEGACY_E2E_DIRS = Object.freeze([path7.join(".argent", "flows")]);
|
|
@@ -10269,7 +10285,7 @@ function e2eFileCandidates(projectRoot, name) {
|
|
|
10269
10285
|
return e2eDirsFor(projectRoot).map((dir) => path7.join(dir, `${name}.yaml`));
|
|
10270
10286
|
}
|
|
10271
10287
|
async function exists(file2) {
|
|
10272
|
-
return
|
|
10288
|
+
return fs6.stat(file2).then(
|
|
10273
10289
|
() => true,
|
|
10274
10290
|
() => false
|
|
10275
10291
|
);
|
|
@@ -10363,10 +10379,10 @@ function canonicalToolArgs(tool, args) {
|
|
|
10363
10379
|
// ../registry/src/flow-file-refs.ts
|
|
10364
10380
|
async function canonicalFlowPath(p) {
|
|
10365
10381
|
try {
|
|
10366
|
-
return await
|
|
10382
|
+
return await fs7.realpath(p);
|
|
10367
10383
|
} catch {
|
|
10368
10384
|
try {
|
|
10369
|
-
return path8.join(await
|
|
10385
|
+
return path8.join(await fs7.realpath(path8.dirname(p)), path8.basename(p));
|
|
10370
10386
|
} catch {
|
|
10371
10387
|
return p;
|
|
10372
10388
|
}
|
|
@@ -10412,15 +10428,15 @@ function collectFlowRequests(doc) {
|
|
|
10412
10428
|
if (isRecord(doc)) visit2(doc.steps, 0);
|
|
10413
10429
|
return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
|
|
10414
10430
|
}
|
|
10415
|
-
function baselineKeyFor(
|
|
10416
|
-
const stem = path8.basename(
|
|
10431
|
+
function baselineKeyFor(canonicalPath2, flowName) {
|
|
10432
|
+
const stem = path8.basename(canonicalPath2, ".yaml");
|
|
10417
10433
|
return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
|
|
10418
10434
|
}
|
|
10419
10435
|
function flowMemberKey(anchorDir, target) {
|
|
10420
10436
|
return `${anchorDir}\0${target}`;
|
|
10421
10437
|
}
|
|
10422
10438
|
async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
|
|
10423
|
-
const entries = await
|
|
10439
|
+
const entries = await fs7.readdir(dir).catch(() => null);
|
|
10424
10440
|
if (entries === null || entries.includes(base)) return { state: "listed" };
|
|
10425
10441
|
const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
|
|
10426
10442
|
if (actual === void 0) return { state: "absent" };
|
|
@@ -11767,10 +11783,10 @@ function mergeDefs(...defs) {
|
|
|
11767
11783
|
function cloneDef(schema) {
|
|
11768
11784
|
return mergeDefs(schema._zod.def);
|
|
11769
11785
|
}
|
|
11770
|
-
function getElementAtPath(obj,
|
|
11771
|
-
if (!
|
|
11786
|
+
function getElementAtPath(obj, path29) {
|
|
11787
|
+
if (!path29)
|
|
11772
11788
|
return obj;
|
|
11773
|
-
return
|
|
11789
|
+
return path29.reduce((acc, key) => acc?.[key], obj);
|
|
11774
11790
|
}
|
|
11775
11791
|
function promiseAllObject(promisesObj) {
|
|
11776
11792
|
const keys = Object.keys(promisesObj);
|
|
@@ -12110,11 +12126,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
12110
12126
|
}
|
|
12111
12127
|
return false;
|
|
12112
12128
|
}
|
|
12113
|
-
function prefixIssues(
|
|
12129
|
+
function prefixIssues(path29, issues) {
|
|
12114
12130
|
return issues.map((iss) => {
|
|
12115
12131
|
var _a3;
|
|
12116
12132
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
12117
|
-
iss.path.unshift(
|
|
12133
|
+
iss.path.unshift(path29);
|
|
12118
12134
|
return iss;
|
|
12119
12135
|
});
|
|
12120
12136
|
}
|
|
@@ -12576,16 +12592,16 @@ function flattenError(error63, mapper = (issue2) => issue2.message) {
|
|
|
12576
12592
|
}
|
|
12577
12593
|
function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
12578
12594
|
const fieldErrors = { _errors: [] };
|
|
12579
|
-
const processError = (error64,
|
|
12595
|
+
const processError = (error64, path29 = []) => {
|
|
12580
12596
|
for (const issue2 of error64.issues) {
|
|
12581
12597
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
12582
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
12598
|
+
issue2.errors.map((issues) => processError({ issues }, [...path29, ...issue2.path]));
|
|
12583
12599
|
} else if (issue2.code === "invalid_key") {
|
|
12584
|
-
processError({ issues: issue2.issues }, [...
|
|
12600
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
12585
12601
|
} else if (issue2.code === "invalid_element") {
|
|
12586
|
-
processError({ issues: issue2.issues }, [...
|
|
12602
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
12587
12603
|
} else {
|
|
12588
|
-
const fullpath = [...
|
|
12604
|
+
const fullpath = [...path29, ...issue2.path];
|
|
12589
12605
|
if (fullpath.length === 0) {
|
|
12590
12606
|
fieldErrors._errors.push(mapper(issue2));
|
|
12591
12607
|
} else {
|
|
@@ -12624,17 +12640,17 @@ function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
|
12624
12640
|
}
|
|
12625
12641
|
function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
12626
12642
|
const result = { errors: [] };
|
|
12627
|
-
const processError = (error64,
|
|
12643
|
+
const processError = (error64, path29 = []) => {
|
|
12628
12644
|
var _a3;
|
|
12629
12645
|
for (const issue2 of error64.issues) {
|
|
12630
12646
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
12631
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
12647
|
+
issue2.errors.map((issues) => processError({ issues }, [...path29, ...issue2.path]));
|
|
12632
12648
|
} else if (issue2.code === "invalid_key") {
|
|
12633
|
-
processError({ issues: issue2.issues }, [...
|
|
12649
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
12634
12650
|
} else if (issue2.code === "invalid_element") {
|
|
12635
|
-
processError({ issues: issue2.issues }, [...
|
|
12651
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
12636
12652
|
} else {
|
|
12637
|
-
const fullpath = [...
|
|
12653
|
+
const fullpath = [...path29, ...issue2.path];
|
|
12638
12654
|
if (fullpath.length === 0) {
|
|
12639
12655
|
result.errors.push(mapper(issue2));
|
|
12640
12656
|
continue;
|
|
@@ -12673,8 +12689,8 @@ function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
|
12673
12689
|
}
|
|
12674
12690
|
function toDotPath(_path) {
|
|
12675
12691
|
const segs = [];
|
|
12676
|
-
const
|
|
12677
|
-
for (const seg of
|
|
12692
|
+
const path29 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
12693
|
+
for (const seg of path29) {
|
|
12678
12694
|
if (typeof seg === "number")
|
|
12679
12695
|
segs.push(`[${seg}]`);
|
|
12680
12696
|
else if (typeof seg === "symbol")
|
|
@@ -29812,13 +29828,13 @@ function resolveRef(ref, ctx) {
|
|
|
29812
29828
|
if (!ref.startsWith("#")) {
|
|
29813
29829
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
29814
29830
|
}
|
|
29815
|
-
const
|
|
29816
|
-
if (
|
|
29831
|
+
const path29 = ref.slice(1).split("/").filter(Boolean);
|
|
29832
|
+
if (path29.length === 0) {
|
|
29817
29833
|
return ctx.rootSchema;
|
|
29818
29834
|
}
|
|
29819
29835
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
29820
|
-
if (
|
|
29821
|
-
const key =
|
|
29836
|
+
if (path29[0] === defsKey) {
|
|
29837
|
+
const key = path29[1] === void 0 ? void 0 : decodeJSONPointerSegment(path29[1]);
|
|
29822
29838
|
if (!key || !ctx.defs[key]) {
|
|
29823
29839
|
throw new Error(`Reference not found: ${ref}`);
|
|
29824
29840
|
}
|
|
@@ -30671,9 +30687,9 @@ function date4(params) {
|
|
|
30671
30687
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
30672
30688
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
30673
30689
|
var resolvedDuringInvocation = new AsyncLocalStorage();
|
|
30674
|
-
function valueAtPath(root,
|
|
30690
|
+
function valueAtPath(root, path29) {
|
|
30675
30691
|
let current = root;
|
|
30676
|
-
for (const key of
|
|
30692
|
+
for (const key of path29) {
|
|
30677
30693
|
if (current === null || typeof current !== "object") return void 0;
|
|
30678
30694
|
if (!Object.hasOwn(current, key)) return void 0;
|
|
30679
30695
|
current = current[key];
|
|
@@ -30833,8 +30849,8 @@ function parseLinkTarget(input2) {
|
|
|
30833
30849
|
const host = u3.hostname.startsWith("[") ? u3.hostname.slice(1, -1) : u3.hostname;
|
|
30834
30850
|
if (!host) throw new Error(`URL "${input2}" is missing a host.`);
|
|
30835
30851
|
const port = u3.port ? Number(u3.port) : u3.protocol === "https:" ? 443 : 80;
|
|
30836
|
-
const
|
|
30837
|
-
const url2 = `${u3.protocol}//${u3.host}${
|
|
30852
|
+
const path29 = u3.pathname === "/" ? "" : u3.pathname.replace(/\/+$/, "");
|
|
30853
|
+
const url2 = `${u3.protocol}//${u3.host}${path29}`;
|
|
30838
30854
|
const token = u3.username ? decodeURIComponent(u3.username) : void 0;
|
|
30839
30855
|
return { url: url2, host, port, ...token ? { token } : {} };
|
|
30840
30856
|
}
|
|
@@ -30861,7 +30877,7 @@ import { spawn as spawn2 } from "node:child_process";
|
|
|
30861
30877
|
import { once } from "node:events";
|
|
30862
30878
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
30863
30879
|
import { open as open2, rm, readdir as readdir3 } from "node:fs/promises";
|
|
30864
|
-
import { basename as basename4, dirname as dirname5, join as join9, resolve as
|
|
30880
|
+
import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve7, sep as sep2 } from "node:path";
|
|
30865
30881
|
import { Writable } from "node:stream";
|
|
30866
30882
|
import { pipeline } from "node:stream/promises";
|
|
30867
30883
|
import zlib from "node:zlib";
|
|
@@ -31065,16 +31081,16 @@ async function runTar(archive, args, signal) {
|
|
|
31065
31081
|
function normalizeTarMemberPath(memberPath) {
|
|
31066
31082
|
return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
31067
31083
|
}
|
|
31068
|
-
function isContainedPath(
|
|
31069
|
-
const slashed =
|
|
31084
|
+
function isContainedPath(path29, windows = process.platform === "win32") {
|
|
31085
|
+
const slashed = path29.replace(/\\/g, "/");
|
|
31070
31086
|
const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
|
|
31071
31087
|
return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
|
|
31072
31088
|
}
|
|
31073
31089
|
function isSafeTarMember(memberPath, destDir) {
|
|
31074
31090
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
31075
31091
|
if (!isContainedPath(normalized)) return false;
|
|
31076
|
-
const root =
|
|
31077
|
-
return
|
|
31092
|
+
const root = resolve7(destDir);
|
|
31093
|
+
return resolve7(destDir, normalized).startsWith(root + sep2);
|
|
31078
31094
|
}
|
|
31079
31095
|
async function readListing(archive, args, signal) {
|
|
31080
31096
|
try {
|
|
@@ -31230,10 +31246,10 @@ function untrackArchive(archive) {
|
|
|
31230
31246
|
for (const s of ARCHIVE_SIGNALS) process.removeListener(s, removeArchivesOnSignal);
|
|
31231
31247
|
process.removeListener("exit", removePendingArchives);
|
|
31232
31248
|
}
|
|
31233
|
-
function sha256File(filePath) {
|
|
31249
|
+
function sha256File(filePath, signal) {
|
|
31234
31250
|
return new Promise((resolve13, reject) => {
|
|
31235
31251
|
const hash2 = createHash2("sha256");
|
|
31236
|
-
createReadStream2(filePath).on("data", (chunk) => hash2.update(chunk)).on("end", () => resolve13(hash2.digest("hex"))).on("error", reject);
|
|
31252
|
+
createReadStream2(filePath, { signal }).on("data", (chunk) => hash2.update(chunk)).on("end", () => resolve13(hash2.digest("hex"))).on("error", reject);
|
|
31237
31253
|
});
|
|
31238
31254
|
}
|
|
31239
31255
|
function toolServerError(text2) {
|
|
@@ -31296,7 +31312,7 @@ async function uploadFile(sourcePath, endpoint, signal) {
|
|
|
31296
31312
|
trackArchive(tarPath);
|
|
31297
31313
|
try {
|
|
31298
31314
|
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
31299
|
-
const contentHash = await sha256File(tarPath);
|
|
31315
|
+
const contentHash = await sha256File(tarPath, signal);
|
|
31300
31316
|
return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
|
|
31301
31317
|
} finally {
|
|
31302
31318
|
untrackArchive(tarPath);
|
|
@@ -32351,7 +32367,7 @@ import {
|
|
|
32351
32367
|
} from "node:fs/promises";
|
|
32352
32368
|
import { constants as fsConstants } from "node:fs";
|
|
32353
32369
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
32354
|
-
import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as
|
|
32370
|
+
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";
|
|
32355
32371
|
import { createHash as createHash3 } from "node:crypto";
|
|
32356
32372
|
var ARTIFACT_MARKER2 = "__argentArtifact";
|
|
32357
32373
|
function isArtifactHandle(value) {
|
|
@@ -32400,7 +32416,7 @@ function configuredRecordingsDir() {
|
|
|
32400
32416
|
if (trimmed === "") return null;
|
|
32401
32417
|
const home = dirname9(argentHomeDir());
|
|
32402
32418
|
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep4}`) ? join13(home, trimmed.slice(2)) : trimmed;
|
|
32403
|
-
return
|
|
32419
|
+
return resolve9(durableBaseDir(), expanded);
|
|
32404
32420
|
}
|
|
32405
32421
|
var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
|
|
32406
32422
|
async function readCapped(res, cap) {
|
|
@@ -32433,10 +32449,10 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
32433
32449
|
const stem = filename.slice(0, filename.length - ext.length);
|
|
32434
32450
|
for (let i2 = 1; i2 <= 1e3; i2++) {
|
|
32435
32451
|
const candidate = i2 === 1 ? filename : `${stem} (${i2})${ext}`;
|
|
32436
|
-
const
|
|
32452
|
+
const path29 = join13(dir, candidate);
|
|
32437
32453
|
try {
|
|
32438
|
-
await write(
|
|
32439
|
-
return
|
|
32454
|
+
await write(path29);
|
|
32455
|
+
return path29;
|
|
32440
32456
|
} catch (err) {
|
|
32441
32457
|
if (err?.code === "EEXIST") continue;
|
|
32442
32458
|
throw err;
|
|
@@ -35051,7 +35067,7 @@ function getSharedConfigurationFromEnvironment(signalIdentifier) {
|
|
|
35051
35067
|
init_esm();
|
|
35052
35068
|
|
|
35053
35069
|
// ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-node-http-env-configuration.js
|
|
35054
|
-
import * as
|
|
35070
|
+
import * as fs8 from "fs";
|
|
35055
35071
|
import * as path13 from "path";
|
|
35056
35072
|
init_esm();
|
|
35057
35073
|
function getStaticHeadersFromEnv(signalIdentifier) {
|
|
@@ -35073,7 +35089,7 @@ function appendRootPathToUrlIfNeeded(url2) {
|
|
|
35073
35089
|
return void 0;
|
|
35074
35090
|
}
|
|
35075
35091
|
}
|
|
35076
|
-
function appendResourcePathToUrl(url2,
|
|
35092
|
+
function appendResourcePathToUrl(url2, path29) {
|
|
35077
35093
|
try {
|
|
35078
35094
|
new URL(url2);
|
|
35079
35095
|
} catch {
|
|
@@ -35083,11 +35099,11 @@ function appendResourcePathToUrl(url2, path25) {
|
|
|
35083
35099
|
if (!url2.endsWith("/")) {
|
|
35084
35100
|
url2 = url2 + "/";
|
|
35085
35101
|
}
|
|
35086
|
-
url2 +=
|
|
35102
|
+
url2 += path29;
|
|
35087
35103
|
try {
|
|
35088
35104
|
new URL(url2);
|
|
35089
35105
|
} catch {
|
|
35090
|
-
diag2.warn(`Configuration: Provided URL appended with '${
|
|
35106
|
+
diag2.warn(`Configuration: Provided URL appended with '${path29}' is not a valid URL, using 'undefined' instead of '${url2}'`);
|
|
35091
35107
|
return void 0;
|
|
35092
35108
|
}
|
|
35093
35109
|
return url2;
|
|
@@ -35112,7 +35128,7 @@ function readFileFromEnv(signalSpecificEnvVar, nonSignalSpecificEnvVar, warningM
|
|
|
35112
35128
|
const filePath = signalSpecificPath ?? nonSignalSpecificPath;
|
|
35113
35129
|
if (filePath != null) {
|
|
35114
35130
|
try {
|
|
35115
|
-
return
|
|
35131
|
+
return fs8.readFileSync(path13.resolve(process.cwd(), filePath));
|
|
35116
35132
|
} catch {
|
|
35117
35133
|
diag2.warn(warningMessage);
|
|
35118
35134
|
return void 0;
|
|
@@ -35198,7 +35214,7 @@ var OTLPLogExporter = class extends OTLPExporterBase {
|
|
|
35198
35214
|
init_esm();
|
|
35199
35215
|
|
|
35200
35216
|
// ../telemetry/src/debug.ts
|
|
35201
|
-
import * as
|
|
35217
|
+
import * as fs9 from "node:fs";
|
|
35202
35218
|
|
|
35203
35219
|
// ../telemetry/src/paths.ts
|
|
35204
35220
|
import * as path14 from "node:path";
|
|
@@ -35236,8 +35252,8 @@ function emitDebugPayload(payload) {
|
|
|
35236
35252
|
} catch {
|
|
35237
35253
|
}
|
|
35238
35254
|
try {
|
|
35239
|
-
|
|
35240
|
-
|
|
35255
|
+
fs9.mkdirSync(argentHomeDir(), { recursive: true });
|
|
35256
|
+
fs9.appendFileSync(debugLogPath(), line + "\n");
|
|
35241
35257
|
} catch {
|
|
35242
35258
|
}
|
|
35243
35259
|
}
|
|
@@ -35750,9 +35766,9 @@ function isReplitAgent(env) {
|
|
|
35750
35766
|
}
|
|
35751
35767
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
35752
35768
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
35753
|
-
function safeExists(fileExists,
|
|
35769
|
+
function safeExists(fileExists, path29) {
|
|
35754
35770
|
try {
|
|
35755
|
-
return fileExists(
|
|
35771
|
+
return fileExists(path29);
|
|
35756
35772
|
} catch {
|
|
35757
35773
|
return false;
|
|
35758
35774
|
}
|
|
@@ -36172,7 +36188,7 @@ function isCi(env = process.env) {
|
|
|
36172
36188
|
var SESSION_ID2 = randomUUID5();
|
|
36173
36189
|
function readCliVersion() {
|
|
36174
36190
|
if (true) {
|
|
36175
|
-
return "0.34.1-next.
|
|
36191
|
+
return "0.34.1-next.30";
|
|
36176
36192
|
}
|
|
36177
36193
|
return "0.0.0";
|
|
36178
36194
|
}
|
|
@@ -36205,7 +36221,7 @@ function getBaseProps(runtime) {
|
|
|
36205
36221
|
|
|
36206
36222
|
// ../telemetry/src/identity.ts
|
|
36207
36223
|
import * as crypto2 from "node:crypto";
|
|
36208
|
-
import * as
|
|
36224
|
+
import * as fs10 from "node:fs";
|
|
36209
36225
|
import * as path15 from "node:path";
|
|
36210
36226
|
var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
|
|
36211
36227
|
var cached2 = null;
|
|
@@ -36302,17 +36318,17 @@ function resolveFingerprintOnce(resolveFingerprint) {
|
|
|
36302
36318
|
function isCorruptIdFile(filePath) {
|
|
36303
36319
|
let isRegularFile;
|
|
36304
36320
|
try {
|
|
36305
|
-
isRegularFile =
|
|
36321
|
+
isRegularFile = fs10.lstatSync(filePath).isFile();
|
|
36306
36322
|
} catch {
|
|
36307
36323
|
return false;
|
|
36308
36324
|
}
|
|
36309
36325
|
return isRegularFile && tryReadId(filePath) === null;
|
|
36310
36326
|
}
|
|
36311
36327
|
function writeIdFileAtomic(finalPath, id) {
|
|
36312
|
-
|
|
36328
|
+
fs10.mkdirSync(argentHomeDir(), { recursive: true });
|
|
36313
36329
|
let occupant;
|
|
36314
36330
|
try {
|
|
36315
|
-
occupant =
|
|
36331
|
+
occupant = fs10.lstatSync(finalPath);
|
|
36316
36332
|
} catch (err) {
|
|
36317
36333
|
if (err.code !== "ENOENT") throw err;
|
|
36318
36334
|
}
|
|
@@ -36323,24 +36339,24 @@ function writeIdFileAtomic(finalPath, id) {
|
|
|
36323
36339
|
argentHomeDir(),
|
|
36324
36340
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
36325
36341
|
);
|
|
36326
|
-
const fd =
|
|
36342
|
+
const fd = fs10.openSync(tmpPath, "wx", 384);
|
|
36327
36343
|
try {
|
|
36328
36344
|
try {
|
|
36329
|
-
|
|
36330
|
-
|
|
36345
|
+
fs10.writeSync(fd, id);
|
|
36346
|
+
fs10.fsyncSync(fd);
|
|
36331
36347
|
} finally {
|
|
36332
|
-
|
|
36348
|
+
fs10.closeSync(fd);
|
|
36333
36349
|
}
|
|
36334
|
-
|
|
36350
|
+
fs10.renameSync(tmpPath, finalPath);
|
|
36335
36351
|
} finally {
|
|
36336
36352
|
try {
|
|
36337
|
-
|
|
36353
|
+
fs10.unlinkSync(tmpPath);
|
|
36338
36354
|
} catch {
|
|
36339
36355
|
}
|
|
36340
36356
|
}
|
|
36341
36357
|
}
|
|
36342
36358
|
function mintRandomId(finalPath) {
|
|
36343
|
-
|
|
36359
|
+
fs10.mkdirSync(argentHomeDir(), { recursive: true });
|
|
36344
36360
|
let value = crypto2.randomUUID();
|
|
36345
36361
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
36346
36362
|
const tmpPath = path15.join(
|
|
@@ -36349,19 +36365,19 @@ function mintRandomId(finalPath) {
|
|
|
36349
36365
|
);
|
|
36350
36366
|
let fd;
|
|
36351
36367
|
try {
|
|
36352
|
-
fd =
|
|
36368
|
+
fd = fs10.openSync(tmpPath, "wx", 384);
|
|
36353
36369
|
} catch (err) {
|
|
36354
36370
|
if (err.code === "EEXIST") continue;
|
|
36355
36371
|
throw err;
|
|
36356
36372
|
}
|
|
36357
36373
|
try {
|
|
36358
36374
|
try {
|
|
36359
|
-
|
|
36360
|
-
|
|
36375
|
+
fs10.writeSync(fd, value);
|
|
36376
|
+
fs10.fsyncSync(fd);
|
|
36361
36377
|
} finally {
|
|
36362
|
-
|
|
36378
|
+
fs10.closeSync(fd);
|
|
36363
36379
|
}
|
|
36364
|
-
|
|
36380
|
+
fs10.linkSync(tmpPath, finalPath);
|
|
36365
36381
|
cached2 = { path: finalPath, id: value };
|
|
36366
36382
|
return value;
|
|
36367
36383
|
} catch (err) {
|
|
@@ -36380,7 +36396,7 @@ function mintRandomId(finalPath) {
|
|
|
36380
36396
|
throw err;
|
|
36381
36397
|
} finally {
|
|
36382
36398
|
try {
|
|
36383
|
-
|
|
36399
|
+
fs10.unlinkSync(tmpPath);
|
|
36384
36400
|
} catch {
|
|
36385
36401
|
}
|
|
36386
36402
|
}
|
|
@@ -36393,7 +36409,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
36393
36409
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
36394
36410
|
);
|
|
36395
36411
|
try {
|
|
36396
|
-
|
|
36412
|
+
fs10.renameSync(finalPath, claimed);
|
|
36397
36413
|
} catch {
|
|
36398
36414
|
return null;
|
|
36399
36415
|
}
|
|
@@ -36402,7 +36418,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
36402
36418
|
grabbed = tryReadId(claimed);
|
|
36403
36419
|
} finally {
|
|
36404
36420
|
try {
|
|
36405
|
-
|
|
36421
|
+
fs10.unlinkSync(claimed);
|
|
36406
36422
|
} catch {
|
|
36407
36423
|
}
|
|
36408
36424
|
}
|
|
@@ -36414,9 +36430,9 @@ function peekAnonId() {
|
|
|
36414
36430
|
function tryReadId(filePath) {
|
|
36415
36431
|
let raw;
|
|
36416
36432
|
try {
|
|
36417
|
-
const stats =
|
|
36433
|
+
const stats = fs10.lstatSync(filePath);
|
|
36418
36434
|
if (!stats.isFile()) return null;
|
|
36419
|
-
raw =
|
|
36435
|
+
raw = fs10.readFileSync(filePath, "utf8");
|
|
36420
36436
|
} catch (err) {
|
|
36421
36437
|
if (err.code === "ENOENT") return null;
|
|
36422
36438
|
return null;
|
|
@@ -36431,7 +36447,7 @@ import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_proce
|
|
|
36431
36447
|
|
|
36432
36448
|
// ../native-devtools-ios/src/index.ts
|
|
36433
36449
|
import * as path16 from "node:path";
|
|
36434
|
-
import * as
|
|
36450
|
+
import * as fs11 from "node:fs";
|
|
36435
36451
|
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path16.join(__dirname, "..", "dylibs");
|
|
36436
36452
|
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path16.join(__dirname, "..", "bin");
|
|
36437
36453
|
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path16.join(DYLIB_DIR, "tcp");
|
|
@@ -36451,9 +36467,9 @@ function platformBinDir() {
|
|
|
36451
36467
|
function simulatorServerBinaryPath() {
|
|
36452
36468
|
const binaryName = simulatorServerBinaryName();
|
|
36453
36469
|
const p = path16.join(platformBinDir(), binaryName);
|
|
36454
|
-
if (!
|
|
36470
|
+
if (!fs11.existsSync(p)) {
|
|
36455
36471
|
const flat = path16.join(BIN_DIR, binaryName);
|
|
36456
|
-
const migrationHint =
|
|
36472
|
+
const migrationHint = fs11.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
|
|
36457
36473
|
throw new Error(
|
|
36458
36474
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
36459
36475
|
);
|
|
@@ -36533,14 +36549,15 @@ function resolveHostFingerprintAsync() {
|
|
|
36533
36549
|
}
|
|
36534
36550
|
|
|
36535
36551
|
// ../telemetry/src/consent.ts
|
|
36536
|
-
import * as
|
|
36552
|
+
import * as fs12 from "node:fs";
|
|
36553
|
+
import * as path17 from "node:path";
|
|
36537
36554
|
var cache = /* @__PURE__ */ new Map();
|
|
36538
36555
|
var sessionOverride = null;
|
|
36539
36556
|
function readConfigOverrideAt(filePath) {
|
|
36540
36557
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
36541
36558
|
let stats;
|
|
36542
36559
|
try {
|
|
36543
|
-
stats =
|
|
36560
|
+
stats = fs12.lstatSync(filePath);
|
|
36544
36561
|
} catch {
|
|
36545
36562
|
cache.set(filePath, miss);
|
|
36546
36563
|
return null;
|
|
@@ -36557,7 +36574,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
36557
36574
|
}
|
|
36558
36575
|
let parsedEnabled = null;
|
|
36559
36576
|
try {
|
|
36560
|
-
const raw =
|
|
36577
|
+
const raw = fs12.readFileSync(filePath, "utf8");
|
|
36561
36578
|
const json2 = JSON.parse(raw);
|
|
36562
36579
|
if (json2 && typeof json2 === "object") {
|
|
36563
36580
|
const t2 = json2.telemetry;
|
|
@@ -36575,7 +36592,8 @@ function readPersistedConsent(cwd) {
|
|
|
36575
36592
|
const globalPath = configFilePath("global");
|
|
36576
36593
|
const projectPath = configFilePath("project", { cwd });
|
|
36577
36594
|
const global2 = readConfigOverrideAt(globalPath);
|
|
36578
|
-
const
|
|
36595
|
+
const projectRoot = path17.dirname(path17.dirname(projectPath));
|
|
36596
|
+
const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
|
|
36579
36597
|
if (project === false && global2 === false) {
|
|
36580
36598
|
return { enabled: false, detail: "config.json (project and global)" };
|
|
36581
36599
|
}
|
|
@@ -37116,7 +37134,7 @@ var import_yaml3 = __toESM(require_dist(), 1);
|
|
|
37116
37134
|
import * as fsp from "node:fs/promises";
|
|
37117
37135
|
import { constants as fsConstants2 } from "node:fs";
|
|
37118
37136
|
import { createHash as createHash5 } from "node:crypto";
|
|
37119
|
-
import * as
|
|
37137
|
+
import * as path18 from "node:path";
|
|
37120
37138
|
|
|
37121
37139
|
// ../argent-cli/src/command-args.ts
|
|
37122
37140
|
var UsageError = class extends Error {
|
|
@@ -37131,7 +37149,7 @@ function listChoices(choices) {
|
|
|
37131
37149
|
return `${quoted.slice(0, -1).join(", ")} or ${quoted[quoted.length - 1]}`;
|
|
37132
37150
|
}
|
|
37133
37151
|
function resolveName(tok, specs) {
|
|
37134
|
-
if (tok.startsWith("--")) return tok.slice(2)
|
|
37152
|
+
if (tok.startsWith("--")) return Object.hasOwn(specs, tok.slice(2)) ? tok.slice(2) : null;
|
|
37135
37153
|
const short = tok.slice(1);
|
|
37136
37154
|
for (const [name, spec] of Object.entries(specs)) {
|
|
37137
37155
|
if (spec.alias === short) return name;
|
|
@@ -37492,17 +37510,17 @@ function shellQuoteArg(arg) {
|
|
|
37492
37510
|
return `'${arg.replaceAll("'", "'\\''")}'`;
|
|
37493
37511
|
}
|
|
37494
37512
|
function optionSafePath(p) {
|
|
37495
|
-
return p.startsWith("-") ? `.${
|
|
37513
|
+
return p.startsWith("-") ? `.${path18.sep}${p}` : p;
|
|
37496
37514
|
}
|
|
37497
37515
|
function rerunCommand(flowPath, rel, projectRoot, args) {
|
|
37498
37516
|
const pathArg = (p) => shellQuoteArg(optionSafePath(p));
|
|
37499
|
-
const fromCwd =
|
|
37500
|
-
const shown =
|
|
37517
|
+
const fromCwd = path18.relative(projectRoot, flowPath);
|
|
37518
|
+
const shown = path18.isAbsolute(fromCwd) || fromCwd.split(/[\\/]+/).includes("..") ? flowPath : fromCwd;
|
|
37501
37519
|
const parts = ["argent e2e run", pathArg(shown)];
|
|
37502
37520
|
if (args.device) parts.push("--device", shellQuoteArg(args.device));
|
|
37503
37521
|
if (args.platform) parts.push("--platform", shellQuoteArg(args.platform));
|
|
37504
37522
|
if (args.updateBaselines) parts.push("--update-baselines");
|
|
37505
|
-
if (args.output) parts.push("--output", pathArg(
|
|
37523
|
+
if (args.output) parts.push("--output", pathArg(path18.join(args.output, path18.dirname(rel))));
|
|
37506
37524
|
return parts.join(" ");
|
|
37507
37525
|
}
|
|
37508
37526
|
var EXPORT_SOURCE_MARKER = ".argent-e2e-source";
|
|
@@ -37510,8 +37528,8 @@ var LEGACY_EXPORT_SOURCE_MARKER = ".argent-flow-source";
|
|
|
37510
37528
|
var MARKER_READ_RETRIES = 4;
|
|
37511
37529
|
var MARKER_READ_DELAY_MS = 5;
|
|
37512
37530
|
async function readExportMarker(dir) {
|
|
37513
|
-
const owner = await readMarkerFile(
|
|
37514
|
-
return owner !== void 0 ? owner : await readMarkerFile(
|
|
37531
|
+
const owner = await readMarkerFile(path18.join(dir, EXPORT_SOURCE_MARKER));
|
|
37532
|
+
return owner !== void 0 ? owner : await readMarkerFile(path18.join(dir, LEGACY_EXPORT_SOURCE_MARKER));
|
|
37515
37533
|
}
|
|
37516
37534
|
async function readMarkerFile(marker) {
|
|
37517
37535
|
for (let attempt = 0; ; attempt++) {
|
|
@@ -37548,7 +37566,7 @@ function occupiedBy(owner) {
|
|
|
37548
37566
|
async function takeExportDir(dir, flowPath) {
|
|
37549
37567
|
try {
|
|
37550
37568
|
await fsp.mkdir(dir, { recursive: true });
|
|
37551
|
-
await fsp.writeFile(
|
|
37569
|
+
await fsp.writeFile(path18.join(dir, EXPORT_SOURCE_MARKER), `${flowPath}
|
|
37552
37570
|
`, { flag: "wx" });
|
|
37553
37571
|
return null;
|
|
37554
37572
|
} catch (err) {
|
|
@@ -37567,7 +37585,7 @@ async function claimExportDirName(outputDir, flowPath, stem) {
|
|
|
37567
37585
|
}
|
|
37568
37586
|
const avoided = [];
|
|
37569
37587
|
for (const name of candidates) {
|
|
37570
|
-
const dir =
|
|
37588
|
+
const dir = path18.join(outputDir, name);
|
|
37571
37589
|
const claim2 = await classifyExportDir(dir, flowPath);
|
|
37572
37590
|
const reason = claim2.state === "foreign" ? occupiedBy(claim2.owner) : await takeExportDir(dir, flowPath);
|
|
37573
37591
|
if (reason !== null) {
|
|
@@ -37587,7 +37605,7 @@ async function claimExportDirName(outputDir, flowPath, stem) {
|
|
|
37587
37605
|
return null;
|
|
37588
37606
|
}
|
|
37589
37607
|
async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
37590
|
-
const stem =
|
|
37608
|
+
const stem = path18.basename(flowPath, ".yaml");
|
|
37591
37609
|
if (!SAFE_ARTIFACT_NAME.test(stem)) {
|
|
37592
37610
|
console.error(
|
|
37593
37611
|
`warning: skipping artifact export for unsafe e2e test filename ${JSON.stringify(stem)}`
|
|
@@ -37620,11 +37638,11 @@ async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
|
37620
37638
|
if (dir === null) {
|
|
37621
37639
|
const dirName = await claimExportDirName(outputDir, flowPath, stem);
|
|
37622
37640
|
if (dirName === null) return;
|
|
37623
|
-
dir =
|
|
37641
|
+
dir = path18.join(outputDir, dirName);
|
|
37624
37642
|
}
|
|
37625
|
-
const dest =
|
|
37626
|
-
const rel =
|
|
37627
|
-
if (rel.startsWith("..") ||
|
|
37643
|
+
const dest = path18.join(dir, fileName(role));
|
|
37644
|
+
const rel = path18.relative(outputDir, dest);
|
|
37645
|
+
if (rel.startsWith("..") || path18.isAbsolute(rel)) continue;
|
|
37628
37646
|
try {
|
|
37629
37647
|
await fsp.copyFile(value, dest);
|
|
37630
37648
|
s.artifacts[role] = dest;
|
|
@@ -37639,7 +37657,7 @@ async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
|
37639
37657
|
function keyFromBaselinePath(artifacts) {
|
|
37640
37658
|
const baseline = artifacts.baseline;
|
|
37641
37659
|
if (typeof baseline !== "string") return null;
|
|
37642
|
-
return
|
|
37660
|
+
return path18.basename(baseline).replace(/\.png$/, "");
|
|
37643
37661
|
}
|
|
37644
37662
|
function resolveArtifactDisplayPaths(report) {
|
|
37645
37663
|
for (const s of report.steps) {
|
|
@@ -37719,26 +37737,26 @@ async function resolveFlowRef(ref, projectRoot) {
|
|
|
37719
37737
|
if (!SAFE_FLOW_NAME.test(ref)) return { suppliedPath: ref, fromName: false };
|
|
37720
37738
|
const picked = await resolveE2eFile(projectRoot, ref);
|
|
37721
37739
|
return {
|
|
37722
|
-
suppliedPath:
|
|
37740
|
+
suppliedPath: path18.relative(projectRoot, picked.path),
|
|
37723
37741
|
fromName: true,
|
|
37724
|
-
...picked.shadowed === void 0 ? {} : { shadowed:
|
|
37742
|
+
...picked.shadowed === void 0 ? {} : { shadowed: path18.relative(projectRoot, picked.shadowed) }
|
|
37725
37743
|
};
|
|
37726
37744
|
}
|
|
37727
37745
|
async function savedFlowHint(projectRoot, missingPath) {
|
|
37728
|
-
const dirs = E2E_DIRS.map((rel) => ({ rel, abs:
|
|
37746
|
+
const dirs = E2E_DIRS.map((rel) => ({ rel, abs: path18.resolve(projectRoot, rel) }));
|
|
37729
37747
|
for (const { abs } of dirs) {
|
|
37730
|
-
const within =
|
|
37731
|
-
if (!within.startsWith("..") && !
|
|
37748
|
+
const within = path18.relative(abs, missingPath);
|
|
37749
|
+
if (!within.startsWith("..") && !path18.isAbsolute(within)) return "";
|
|
37732
37750
|
}
|
|
37733
|
-
const wanted = `${
|
|
37751
|
+
const wanted = `${path18.basename(missingPath, ".yaml")}.yaml`;
|
|
37734
37752
|
for (const { rel, abs } of dirs) {
|
|
37735
37753
|
const entries = await fsp.readdir(abs).catch(() => null);
|
|
37736
37754
|
if (entries === null) continue;
|
|
37737
37755
|
const actual = entries.includes(wanted) ? wanted : entries.find((name2) => name2.toLowerCase() === wanted.toLowerCase());
|
|
37738
37756
|
if (actual === void 0) continue;
|
|
37739
|
-
const name =
|
|
37757
|
+
const name = path18.basename(actual, ".yaml");
|
|
37740
37758
|
if (!SAFE_FLOW_NAME.test(name)) return "";
|
|
37741
|
-
if (!await isRunnableFlowFile(
|
|
37759
|
+
if (!await isRunnableFlowFile(path18.join(abs, actual))) return "";
|
|
37742
37760
|
return `
|
|
37743
37761
|
An e2e test named "${name}" is saved under ${rel} \u2014 did you mean: argent e2e run ${name}`;
|
|
37744
37762
|
}
|
|
@@ -37748,17 +37766,17 @@ async function collectFlowFiles(dir, recursive2) {
|
|
|
37748
37766
|
const found = [];
|
|
37749
37767
|
const walk = async (current, rel) => {
|
|
37750
37768
|
for (const entry of await fsp.readdir(current, { withFileTypes: true })) {
|
|
37751
|
-
const entryRel = rel ?
|
|
37769
|
+
const entryRel = rel ? path18.join(rel, entry.name) : entry.name;
|
|
37752
37770
|
if (entry.isDirectory()) {
|
|
37753
37771
|
if (recursive2 && entry.name !== "__baselines__" && entry.name !== "node_modules" && (entry.name === ".argent" || !entry.name.startsWith("."))) {
|
|
37754
|
-
await walk(
|
|
37772
|
+
await walk(path18.join(current, entry.name), entryRel).catch(() => {
|
|
37755
37773
|
});
|
|
37756
37774
|
}
|
|
37757
37775
|
continue;
|
|
37758
37776
|
}
|
|
37759
37777
|
if (!entry.name.endsWith(".yaml")) continue;
|
|
37760
|
-
if (!SAFE_FLOW_NAME.test(
|
|
37761
|
-
const filePath =
|
|
37778
|
+
if (!SAFE_FLOW_NAME.test(path18.basename(entry.name, ".yaml"))) continue;
|
|
37779
|
+
const filePath = path18.join(current, entry.name);
|
|
37762
37780
|
if (!await isRunnableFlowFile(filePath)) continue;
|
|
37763
37781
|
const shape = await checkE2eTestShape(filePath);
|
|
37764
37782
|
if (shape === "skip") continue;
|
|
@@ -37909,7 +37927,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
37909
37927
|
);
|
|
37910
37928
|
}
|
|
37911
37929
|
const { callTool, baseUrl } = runToolsClient(args, options);
|
|
37912
|
-
const outputBase = args.output ?
|
|
37930
|
+
const outputBase = args.output ? path18.resolve(args.output) : void 0;
|
|
37913
37931
|
const results = [];
|
|
37914
37932
|
const failures = [];
|
|
37915
37933
|
const batchStartedAt = Date.now();
|
|
@@ -37922,7 +37940,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
37922
37940
|
if (!args.json) console.log(` ${STATUS_GLYPH.skip} not run (batch stopped)`);
|
|
37923
37941
|
continue;
|
|
37924
37942
|
}
|
|
37925
|
-
const flowPath =
|
|
37943
|
+
const flowPath = path18.join(dir, rel);
|
|
37926
37944
|
const rerun = rerunCommand(flowPath, rel, projectRoot, args);
|
|
37927
37945
|
let report;
|
|
37928
37946
|
try {
|
|
@@ -37964,7 +37982,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
37964
37982
|
printWarnings(nestedStepWarnings(report.steps), args.json);
|
|
37965
37983
|
await exportAndResolveArtifacts(
|
|
37966
37984
|
report,
|
|
37967
|
-
outputBase ?
|
|
37985
|
+
outputBase ? path18.join(outputBase, path18.dirname(rel)) : void 0,
|
|
37968
37986
|
flowPath,
|
|
37969
37987
|
baseUrl
|
|
37970
37988
|
);
|
|
@@ -38069,7 +38087,7 @@ Pass the fully resolved path to the directory.`
|
|
|
38069
38087
|
for (const dir of dirs) {
|
|
38070
38088
|
let files;
|
|
38071
38089
|
try {
|
|
38072
|
-
files = await collectFlowFiles(
|
|
38090
|
+
files = await collectFlowFiles(path18.resolve(dir), listDir === void 0 || recursive2);
|
|
38073
38091
|
} catch (err) {
|
|
38074
38092
|
const code = err.code;
|
|
38075
38093
|
if (listDir === void 0 && (code === "ENOENT" || code === "ENOTDIR")) continue;
|
|
@@ -38079,13 +38097,13 @@ Pass the fully resolved path to the directory.`
|
|
|
38079
38097
|
}
|
|
38080
38098
|
anyDir = true;
|
|
38081
38099
|
for (const { path: rel, warning } of files) {
|
|
38082
|
-
const shown =
|
|
38100
|
+
const shown = path18.join(dir, rel);
|
|
38083
38101
|
const warningField = warning !== void 0 && { warning };
|
|
38084
38102
|
if (listDir !== void 0) {
|
|
38085
38103
|
entries.push({ path: optionSafePath(shown), ...warningField });
|
|
38086
38104
|
continue;
|
|
38087
38105
|
}
|
|
38088
|
-
const name =
|
|
38106
|
+
const name = path18.dirname(rel) === "." ? path18.basename(rel, ".yaml") : void 0;
|
|
38089
38107
|
const shadowedBy = name === void 0 ? void 0 : byName.get(name);
|
|
38090
38108
|
if (name !== void 0 && shadowedBy === void 0) byName.set(name, shown);
|
|
38091
38109
|
entries.push({
|
|
@@ -38175,10 +38193,10 @@ Pass the fully resolved path to the directory.`
|
|
|
38175
38193
|
}
|
|
38176
38194
|
if (suppliedPath.split(/[\\/]+/).includes("..")) {
|
|
38177
38195
|
let recovery = "Pass the fully resolved path to the e2e test's YAML.";
|
|
38178
|
-
const suppliedBase2 =
|
|
38196
|
+
const suppliedBase2 = path18.basename(suppliedPath);
|
|
38179
38197
|
if (suppliedBase2 !== ".." && suppliedBase2 !== ".") {
|
|
38180
38198
|
try {
|
|
38181
|
-
const resolved =
|
|
38199
|
+
const resolved = path18.join(await fsp.realpath(path18.dirname(suppliedPath)), suppliedBase2);
|
|
38182
38200
|
await fsp.stat(resolved);
|
|
38183
38201
|
recovery = `Did you mean: argent e2e run ${shellQuoteArg(resolved)}`;
|
|
38184
38202
|
} catch {
|
|
@@ -38190,7 +38208,7 @@ Pass the fully resolved path to the directory.`
|
|
|
38190
38208
|
2
|
|
38191
38209
|
);
|
|
38192
38210
|
}
|
|
38193
|
-
const resolvedPath =
|
|
38211
|
+
const resolvedPath = path18.resolve(projectRoot, suppliedPath);
|
|
38194
38212
|
let isDirectory = false;
|
|
38195
38213
|
try {
|
|
38196
38214
|
isDirectory = (await fsp.stat(resolvedPath)).isDirectory();
|
|
@@ -38213,16 +38231,16 @@ Pass the fully resolved path to the directory.`
|
|
|
38213
38231
|
}
|
|
38214
38232
|
const separatorTrimmedPath = suppliedPath.replace(/[\\/]+$/, "");
|
|
38215
38233
|
if (separatorTrimmedPath !== suppliedPath && separatorTrimmedPath !== "") {
|
|
38216
|
-
const hint = SAFE_FLOW_NAME.test(separatorTrimmedPath) ? `.${
|
|
38234
|
+
const hint = SAFE_FLOW_NAME.test(separatorTrimmedPath) ? `.${path18.sep}${separatorTrimmedPath}` : separatorTrimmedPath;
|
|
38217
38235
|
return fail(
|
|
38218
38236
|
`E2E test path must not end in a path separator \u2014 the separator claims a directory, which the kernel would refuse to open as a file, so the CLI would run a file this string does not name: ${suppliedPath}
|
|
38219
38237
|
Did you mean: argent e2e run ${shellQuoteArg(hint)}`,
|
|
38220
38238
|
2
|
|
38221
38239
|
);
|
|
38222
38240
|
}
|
|
38223
|
-
if (
|
|
38224
|
-
const looksLikeName = !suppliedPath.includes("/") && !suppliedPath.includes("\\") &&
|
|
38225
|
-
if (
|
|
38241
|
+
if (path18.extname(suppliedPath) !== ".yaml") {
|
|
38242
|
+
const looksLikeName = !suppliedPath.includes("/") && !suppliedPath.includes("\\") && path18.extname(suppliedPath) === "";
|
|
38243
|
+
if (path18.basename(suppliedPath).toLowerCase() === ".yaml") {
|
|
38226
38244
|
return fail(
|
|
38227
38245
|
`E2E test filename must have a non-empty name containing only letters, numbers, "_", or "-": ${suppliedPath}`,
|
|
38228
38246
|
2
|
|
@@ -38235,15 +38253,15 @@ Names run \`${E2E_DIRS.map((dir) => `${dir}/<name>.yaml`).join("` or `")}\`; pas
|
|
|
38235
38253
|
2
|
|
38236
38254
|
);
|
|
38237
38255
|
}
|
|
38238
|
-
if (
|
|
38256
|
+
if (path18.extname(suppliedPath).toLowerCase() === ".yaml") {
|
|
38239
38257
|
return fail(
|
|
38240
|
-
`E2E test extension must be lowercase .yaml, not ${
|
|
38258
|
+
`E2E test extension must be lowercase .yaml, not ${path18.extname(suppliedPath)}: ${suppliedPath}`,
|
|
38241
38259
|
2
|
|
38242
38260
|
);
|
|
38243
38261
|
}
|
|
38244
38262
|
return fail(`E2E test path must end in .yaml: ${suppliedPath}`, 2);
|
|
38245
38263
|
}
|
|
38246
|
-
const flowName =
|
|
38264
|
+
const flowName = path18.basename(suppliedPath, ".yaml");
|
|
38247
38265
|
if (!SAFE_FLOW_NAME.test(flowName)) {
|
|
38248
38266
|
return fail(
|
|
38249
38267
|
`E2E test filename must have a non-empty name containing only letters, numbers, "_", or "-": ${suppliedPath}`,
|
|
@@ -38267,12 +38285,12 @@ No e2e test named "${args.flowRef}" is saved in ${E2E_DIRS.join(" or ")} \u2014
|
|
|
38267
38285
|
}
|
|
38268
38286
|
return fail(`${detail}: ${flowPath}${recovery}`, 2);
|
|
38269
38287
|
}
|
|
38270
|
-
const suppliedBase =
|
|
38271
|
-
const siblings = await fsp.readdir(
|
|
38288
|
+
const suppliedBase = path18.basename(flowPath);
|
|
38289
|
+
const siblings = await fsp.readdir(path18.dirname(flowPath)).catch(() => null);
|
|
38272
38290
|
if (siblings !== null && !siblings.includes(suppliedBase)) {
|
|
38273
38291
|
const actual = siblings.find((name) => name.toLowerCase() === suppliedBase.toLowerCase());
|
|
38274
|
-
const actualRunnable = actual !== void 0 &&
|
|
38275
|
-
const recovery = actualRunnable ? fromName ? `Did you mean: argent e2e run ${
|
|
38292
|
+
const actualRunnable = actual !== void 0 && path18.extname(actual) === ".yaml" && SAFE_FLOW_NAME.test(path18.basename(actual, ".yaml"));
|
|
38293
|
+
const recovery = actualRunnable ? fromName ? `Did you mean: argent e2e run ${path18.basename(actual, ".yaml")}` : `Did you mean: argent e2e run ${shellQuoteArg(path18.join(path18.dirname(suppliedPath), actual))}` : actual !== void 0 ? `Rename ${actual} to ${suppliedBase} to run it \u2014 e2e test files must be lowercase .yaml.` : "Pass the e2e test file's name exactly as it appears on disk.";
|
|
38276
38294
|
return fail(
|
|
38277
38295
|
`E2E test path must name the file as it appears on disk \u2014 this filesystem matched ${JSON.stringify(suppliedBase)} case-insensitively${actual !== void 0 ? ` to ${JSON.stringify(actual)}` : ""}, so the test name (which keys the report, __baselines__/, and --output) would be one no file carries: ${suppliedPath}
|
|
38278
38296
|
${recovery}`,
|
|
@@ -38331,7 +38349,7 @@ ${recovery}`,
|
|
|
38331
38349
|
try {
|
|
38332
38350
|
await exportAndResolveArtifacts(
|
|
38333
38351
|
report,
|
|
38334
|
-
args.output ?
|
|
38352
|
+
args.output ? path18.resolve(args.output) : void 0,
|
|
38335
38353
|
flowPath,
|
|
38336
38354
|
baseUrl
|
|
38337
38355
|
);
|
|
@@ -38425,8 +38443,8 @@ async function fetchImageToFile(result, outPath) {
|
|
|
38425
38443
|
const res = await fetch(url2);
|
|
38426
38444
|
if (!res.ok) throw new Error(`Failed to download image: ${res.status} ${res.statusText}`);
|
|
38427
38445
|
const buf = Buffer.from(await res.arrayBuffer());
|
|
38428
|
-
|
|
38429
|
-
|
|
38446
|
+
fs13.mkdirSync(path19.dirname(path19.resolve(outPath)), { recursive: true });
|
|
38447
|
+
fs13.writeFileSync(outPath, buf);
|
|
38430
38448
|
}
|
|
38431
38449
|
function renderResult(result, outputHint, images, json2) {
|
|
38432
38450
|
if (json2) return JSON.stringify(result, null, 2);
|
|
@@ -38633,8 +38651,8 @@ settled=false or debugger-status's not_connected.
|
|
|
38633
38651
|
if (outPath && meta3.outputHint === "image") {
|
|
38634
38652
|
try {
|
|
38635
38653
|
if (images.length > 0) {
|
|
38636
|
-
|
|
38637
|
-
|
|
38654
|
+
fs13.mkdirSync(path19.dirname(path19.resolve(outPath)), { recursive: true });
|
|
38655
|
+
fs13.writeFileSync(outPath, images[0].data);
|
|
38638
38656
|
} else if (result && typeof result === "object") {
|
|
38639
38657
|
await fetchImageToFile(result, outPath);
|
|
38640
38658
|
}
|
|
@@ -38674,6 +38692,7 @@ function summarize(description, max = 80) {
|
|
|
38674
38692
|
if (firstLine.length <= max) return firstLine;
|
|
38675
38693
|
return firstLine.slice(0, max - 1).trimEnd() + "\u2026";
|
|
38676
38694
|
}
|
|
38695
|
+
var TOOLS_OPTIONS = { json: { kind: "boolean" } };
|
|
38677
38696
|
async function tools(argv, options) {
|
|
38678
38697
|
const { fetchTool, fetchTools } = createToolsClient({ paths: options.paths });
|
|
38679
38698
|
async function listTools(json3) {
|
|
@@ -38695,10 +38714,10 @@ async function tools(argv, options) {
|
|
|
38695
38714
|
console.log(`
|
|
38696
38715
|
${sorted.length} tools. Run \`argent tools describe <name>\` for details.`);
|
|
38697
38716
|
}
|
|
38698
|
-
async function describeTool(
|
|
38699
|
-
const meta3 = await fetchTool(
|
|
38717
|
+
async function describeTool(name2, json3) {
|
|
38718
|
+
const meta3 = await fetchTool(name2);
|
|
38700
38719
|
if (!meta3) {
|
|
38701
|
-
console.error(`Tool "${
|
|
38720
|
+
console.error(`Tool "${name2}" not found. Run \`argent tools\` to list available tools.`);
|
|
38702
38721
|
process.exit(1);
|
|
38703
38722
|
}
|
|
38704
38723
|
if (json3) {
|
|
@@ -38726,38 +38745,51 @@ Options:
|
|
|
38726
38745
|
Listing tools contacts the argent tool-server, starting one if none is running.
|
|
38727
38746
|
`);
|
|
38728
38747
|
}
|
|
38729
|
-
const json2 = argv.includes("--json");
|
|
38730
38748
|
const isHelpFlag = (a2) => a2 === "--help" || a2 === "-h";
|
|
38731
|
-
|
|
38732
|
-
|
|
38733
|
-
|
|
38749
|
+
if (argv.some(isHelpFlag)) {
|
|
38750
|
+
const [first, second] = argv.filter((a2) => !a2.startsWith("-") || isHelpFlag(a2));
|
|
38751
|
+
if (first === "describe" && second !== void 0 && !isHelpFlag(second)) {
|
|
38752
|
+
await describeTool(second, argv.includes("--json"));
|
|
38753
|
+
return;
|
|
38754
|
+
}
|
|
38734
38755
|
printUsage4();
|
|
38735
38756
|
return;
|
|
38736
38757
|
}
|
|
38758
|
+
const usageError = (message) => {
|
|
38759
|
+
console.error(`Error: ${message}
|
|
38760
|
+
`);
|
|
38761
|
+
printUsage4();
|
|
38762
|
+
process.exit(2);
|
|
38763
|
+
};
|
|
38764
|
+
let parsed;
|
|
38765
|
+
try {
|
|
38766
|
+
parsed = parseCommandArgs(argv, TOOLS_OPTIONS);
|
|
38767
|
+
} catch (err) {
|
|
38768
|
+
if (!(err instanceof UsageError)) throw err;
|
|
38769
|
+
return usageError(err.message);
|
|
38770
|
+
}
|
|
38771
|
+
const [sub, name, extra] = parsed.positionals;
|
|
38772
|
+
const json2 = parsed.options.json === true;
|
|
38737
38773
|
if (!sub) {
|
|
38738
38774
|
await listTools(json2);
|
|
38739
38775
|
return;
|
|
38740
38776
|
}
|
|
38741
38777
|
if (sub === "describe") {
|
|
38742
|
-
|
|
38743
|
-
if (
|
|
38744
|
-
console.error("Usage: argent tools describe <tool-name>");
|
|
38745
|
-
process.exit(1);
|
|
38746
|
-
}
|
|
38778
|
+
if (!name) return usageError("`argent tools describe` requires a <tool-name>");
|
|
38779
|
+
if (extra !== void 0) usageError(`Unexpected argument "${extra}"`);
|
|
38747
38780
|
await describeTool(name, json2);
|
|
38748
38781
|
return;
|
|
38749
38782
|
}
|
|
38750
|
-
|
|
38751
|
-
process.exit(1);
|
|
38783
|
+
usageError(`Unknown subcommand: tools ${sub}`);
|
|
38752
38784
|
}
|
|
38753
38785
|
|
|
38754
38786
|
// ../argent-cli/src/server.ts
|
|
38755
|
-
import * as
|
|
38756
|
-
import * as
|
|
38787
|
+
import * as fs14 from "node:fs";
|
|
38788
|
+
import * as path20 from "node:path";
|
|
38757
38789
|
import { constants as constants2, homedir as homedir5, networkInterfaces } from "node:os";
|
|
38758
38790
|
import { spawn as spawn4 } from "node:child_process";
|
|
38759
|
-
var STATE_DIR2 =
|
|
38760
|
-
var LOG_FILE2 =
|
|
38791
|
+
var STATE_DIR2 = path20.join(homedir5(), ".argent");
|
|
38792
|
+
var LOG_FILE2 = path20.join(STATE_DIR2, "tool-server.log");
|
|
38761
38793
|
async function describeForeignServers(ownBundlePath) {
|
|
38762
38794
|
const others = (await readAllToolsServerStates()).filter(
|
|
38763
38795
|
({ state: state2 }) => state2.bundlePath !== ownBundlePath && isToolsServerProcessAlive(state2.pid)
|
|
@@ -38821,19 +38853,39 @@ Stop one with: kill <pid>`);
|
|
|
38821
38853
|
}
|
|
38822
38854
|
}
|
|
38823
38855
|
function logsCmd(follow) {
|
|
38824
|
-
if (!
|
|
38856
|
+
if (!fs14.existsSync(LOG_FILE2)) {
|
|
38825
38857
|
console.log(`No log file at ${LOG_FILE2}`);
|
|
38826
38858
|
return;
|
|
38827
38859
|
}
|
|
38828
38860
|
if (!follow) {
|
|
38829
|
-
process.stdout.write(
|
|
38861
|
+
process.stdout.write(fs14.readFileSync(LOG_FILE2, "utf8"));
|
|
38830
38862
|
return;
|
|
38831
38863
|
}
|
|
38832
|
-
const
|
|
38864
|
+
const cannotFollow = (err) => {
|
|
38865
|
+
console.error(
|
|
38866
|
+
`argent server logs: cannot run \`tail\` to follow the log (${err.message}). Run \`argent server logs\` without -f to print it.`
|
|
38867
|
+
);
|
|
38868
|
+
process.exit(1);
|
|
38869
|
+
};
|
|
38870
|
+
let child;
|
|
38871
|
+
try {
|
|
38872
|
+
child = spawn4("tail", ["-f", LOG_FILE2], { stdio: "inherit" });
|
|
38873
|
+
} catch (err) {
|
|
38874
|
+
return cannotFollow(err);
|
|
38875
|
+
}
|
|
38876
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
38877
|
+
process.on(signal, () => {
|
|
38878
|
+
try {
|
|
38879
|
+
child.kill(signal);
|
|
38880
|
+
} catch {
|
|
38881
|
+
}
|
|
38882
|
+
});
|
|
38883
|
+
}
|
|
38833
38884
|
child.on(
|
|
38834
38885
|
"exit",
|
|
38835
38886
|
(code, signal) => process.exit(code ?? (signal ? 128 + (signalNumber(signal) ?? 0) : 0))
|
|
38836
38887
|
);
|
|
38888
|
+
child.on("error", cannotFollow);
|
|
38837
38889
|
}
|
|
38838
38890
|
var StartFlagError = class extends Error {
|
|
38839
38891
|
};
|
|
@@ -39075,8 +39127,10 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
39075
39127
|
};
|
|
39076
39128
|
const onInt = forward("SIGINT");
|
|
39077
39129
|
const onTerm = forward("SIGTERM");
|
|
39130
|
+
const onHup = forward("SIGHUP");
|
|
39078
39131
|
process.on("SIGINT", onInt);
|
|
39079
39132
|
process.on("SIGTERM", onTerm);
|
|
39133
|
+
process.on("SIGHUP", onHup);
|
|
39080
39134
|
let stateWritten = false;
|
|
39081
39135
|
const childPid = child.pid;
|
|
39082
39136
|
if (childPid !== void 0) {
|
|
@@ -39100,9 +39154,14 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
39100
39154
|
const cleanup = () => {
|
|
39101
39155
|
process.removeListener("SIGINT", onInt);
|
|
39102
39156
|
process.removeListener("SIGTERM", onTerm);
|
|
39157
|
+
process.removeListener("SIGHUP", onHup);
|
|
39103
39158
|
if (stateWritten) {
|
|
39104
|
-
|
|
39105
|
-
|
|
39159
|
+
const file2 = stateFileForBundle(paths.bundlePath);
|
|
39160
|
+
try {
|
|
39161
|
+
const cur = JSON.parse(fs14.readFileSync(file2, "utf8"));
|
|
39162
|
+
if (cur.pid === childPid) fs14.unlinkSync(file2);
|
|
39163
|
+
} catch {
|
|
39164
|
+
}
|
|
39106
39165
|
}
|
|
39107
39166
|
};
|
|
39108
39167
|
child.on("error", (err) => {
|
|
@@ -39119,51 +39178,96 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
39119
39178
|
function signalNumber(signal) {
|
|
39120
39179
|
return constants2.signals[signal] ?? null;
|
|
39121
39180
|
}
|
|
39181
|
+
var SUBCOMMAND_HELP = {
|
|
39182
|
+
status: `Usage: argent server status [--json]
|
|
39183
|
+
|
|
39184
|
+
Show the pid, port, and health of this install's tool-server.
|
|
39185
|
+
|
|
39186
|
+
Flags:
|
|
39187
|
+
--json Print machine-readable JSON.
|
|
39188
|
+
--help, -h Show this help.
|
|
39189
|
+
`,
|
|
39190
|
+
stop: `Usage: argent server stop
|
|
39191
|
+
|
|
39192
|
+
Terminate this install's tool-server.
|
|
39193
|
+
|
|
39194
|
+
Flags:
|
|
39195
|
+
--help, -h Show this help.
|
|
39196
|
+
`,
|
|
39197
|
+
logs: `Usage: argent server logs [-f]
|
|
39198
|
+
|
|
39199
|
+
Print the tool-server log (${LOG_FILE2}).
|
|
39200
|
+
|
|
39201
|
+
Flags:
|
|
39202
|
+
--follow, -f Keep printing new lines until Ctrl-C.
|
|
39203
|
+
--help, -h Show this help.
|
|
39204
|
+
`
|
|
39205
|
+
};
|
|
39206
|
+
var STATUS_OPTIONS = { json: { kind: "boolean" } };
|
|
39207
|
+
var STOP_OPTIONS = {};
|
|
39208
|
+
var LOGS_OPTIONS = { follow: { kind: "boolean", alias: "f" } };
|
|
39209
|
+
function parseSubcommandArgs(sub, argv, specs) {
|
|
39210
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
39211
|
+
console.log(SUBCOMMAND_HELP[sub]);
|
|
39212
|
+
return null;
|
|
39213
|
+
}
|
|
39214
|
+
try {
|
|
39215
|
+
const { positionals, options } = parseCommandArgs(argv, specs);
|
|
39216
|
+
if (positionals.length > 0) throw new UsageError(`Unexpected argument "${positionals[0]}"`);
|
|
39217
|
+
return options;
|
|
39218
|
+
} catch (err) {
|
|
39219
|
+
if (!(err instanceof UsageError)) throw err;
|
|
39220
|
+
console.error(`Error: ${err.message}
|
|
39221
|
+
`);
|
|
39222
|
+
console.log(SUBCOMMAND_HELP[sub]);
|
|
39223
|
+
process.exit(2);
|
|
39224
|
+
}
|
|
39225
|
+
}
|
|
39122
39226
|
function printServerHelp() {
|
|
39123
39227
|
console.log(`Usage:
|
|
39124
|
-
argent server start [flags] Spawn a long-lived tool-server
|
|
39228
|
+
argent server start [flags] Spawn a long-lived tool-server
|
|
39125
39229
|
argent server status [--json] Show tool-server pid, port, and health
|
|
39126
39230
|
argent server stop Terminate the running tool-server
|
|
39127
39231
|
argent server logs [-f] Print (or follow) the tool-server log
|
|
39232
|
+
|
|
39233
|
+
Run \`argent server <subcommand> --help\` for its flags.
|
|
39128
39234
|
`);
|
|
39129
39235
|
}
|
|
39130
39236
|
async function server(argv, options) {
|
|
39131
|
-
const sub = argv
|
|
39132
|
-
const json2 = argv.includes("--json");
|
|
39133
|
-
const follow = argv.includes("-f") || argv.includes("--follow");
|
|
39237
|
+
const [sub, ...rest] = argv;
|
|
39134
39238
|
if (!sub || sub === "--help" || sub === "-h") {
|
|
39135
39239
|
printServerHelp();
|
|
39136
39240
|
return;
|
|
39137
39241
|
}
|
|
39138
|
-
const rest = argv.slice(1);
|
|
39139
|
-
const actsOnServer = sub === "status" || sub === "stop" || sub === "logs";
|
|
39140
|
-
if (actsOnServer && (rest.includes("--help") || rest.includes("-h"))) {
|
|
39141
|
-
printServerHelp();
|
|
39142
|
-
return;
|
|
39143
|
-
}
|
|
39144
39242
|
switch (sub) {
|
|
39145
39243
|
case "start":
|
|
39146
39244
|
await startCmd(rest, options?.paths);
|
|
39147
39245
|
return;
|
|
39148
|
-
case "status":
|
|
39149
|
-
|
|
39246
|
+
case "status": {
|
|
39247
|
+
const parsed = parseSubcommandArgs("status", rest, STATUS_OPTIONS);
|
|
39248
|
+
if (parsed) await statusCmd(parsed.json === true, options?.paths);
|
|
39150
39249
|
return;
|
|
39250
|
+
}
|
|
39151
39251
|
case "stop":
|
|
39152
|
-
await stopCmd(options?.paths);
|
|
39252
|
+
if (parseSubcommandArgs("stop", rest, STOP_OPTIONS)) await stopCmd(options?.paths);
|
|
39153
39253
|
return;
|
|
39154
|
-
case "logs":
|
|
39155
|
-
|
|
39254
|
+
case "logs": {
|
|
39255
|
+
const parsed = parseSubcommandArgs("logs", rest, LOGS_OPTIONS);
|
|
39256
|
+
if (parsed) logsCmd(parsed.follow === true);
|
|
39156
39257
|
return;
|
|
39258
|
+
}
|
|
39157
39259
|
default:
|
|
39158
|
-
console.error(`Unknown subcommand: server ${sub}
|
|
39159
|
-
|
|
39260
|
+
console.error(`Error: Unknown subcommand: server ${sub}
|
|
39261
|
+
`);
|
|
39262
|
+
printServerHelp();
|
|
39263
|
+
process.exit(2);
|
|
39160
39264
|
}
|
|
39161
39265
|
}
|
|
39162
39266
|
|
|
39163
39267
|
// ../argent-cli/src/lens.ts
|
|
39164
|
-
import * as
|
|
39268
|
+
import * as fs15 from "node:fs";
|
|
39165
39269
|
import * as os2 from "node:os";
|
|
39166
|
-
import * as
|
|
39270
|
+
import * as path21 from "node:path";
|
|
39167
39271
|
|
|
39168
39272
|
// ../argent-cli/src/lens-terminal.ts
|
|
39169
39273
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
@@ -39381,12 +39485,12 @@ function isSessionAlive(session) {
|
|
|
39381
39485
|
// ../argent-cli/src/lens-pty.ts
|
|
39382
39486
|
import { chmodSync as chmodSync2, readdirSync as readdirSync2 } from "node:fs";
|
|
39383
39487
|
import { createRequire } from "node:module";
|
|
39384
|
-
import { dirname as
|
|
39488
|
+
import { dirname as dirname13, join as join19 } from "node:path";
|
|
39385
39489
|
var nodeRequire = createRequire(import.meta.url);
|
|
39386
39490
|
function ensureSpawnHelperExecutable(req = nodeRequire) {
|
|
39387
39491
|
if (process.platform !== "darwin") return;
|
|
39388
39492
|
try {
|
|
39389
|
-
const prebuilds = join19(
|
|
39493
|
+
const prebuilds = join19(dirname13(req.resolve("node-pty/package.json")), "prebuilds");
|
|
39390
39494
|
for (const entry of readdirSync2(prebuilds)) {
|
|
39391
39495
|
try {
|
|
39392
39496
|
chmodSync2(join19(prebuilds, entry, "spawn-helper"), 493);
|
|
@@ -39914,12 +40018,12 @@ async function lens(argv, options) {
|
|
|
39914
40018
|
await endSession(baseUrl);
|
|
39915
40019
|
process.exit(1);
|
|
39916
40020
|
}
|
|
39917
|
-
const seedFile =
|
|
39918
|
-
|
|
40021
|
+
const seedFile = path21.join(os2.tmpdir(), `argent-lens-seed-${process.pid}-${Date.now()}.txt`);
|
|
40022
|
+
fs15.writeFileSync(seedFile, buildSeedPrompt(), "utf8");
|
|
39919
40023
|
const launchCmd = agent.launch(shellQuote(process.cwd()), shellQuote(seedFile));
|
|
39920
40024
|
const removeSeedFile = () => {
|
|
39921
40025
|
try {
|
|
39922
|
-
|
|
40026
|
+
fs15.rmSync(seedFile, { force: true });
|
|
39923
40027
|
} catch {
|
|
39924
40028
|
}
|
|
39925
40029
|
};
|
|
@@ -40110,14 +40214,16 @@ async function endSession(baseUrl) {
|
|
|
40110
40214
|
|
|
40111
40215
|
// ../argent-cli/src/flags.ts
|
|
40112
40216
|
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
40217
|
+
import * as path23 from "node:path";
|
|
40113
40218
|
|
|
40114
40219
|
// ../argent-cli/src/secrets.ts
|
|
40115
40220
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
40221
|
+
var LIST_OPTIONS2 = { json: { kind: "boolean" } };
|
|
40116
40222
|
async function secrets(argv) {
|
|
40117
40223
|
const [sub, ...rest] = argv;
|
|
40118
40224
|
if (sub === void 0 || sub === "list") return cmdList(rest);
|
|
40119
40225
|
if (sub === "--help" || sub === "-h") return printUsage();
|
|
40120
|
-
if (sub === "--json") return cmdList([sub, ...rest]);
|
|
40226
|
+
if (sub === "--json") return cmdList(rest[0] === "list" ? [sub, ...rest.slice(1)] : argv);
|
|
40121
40227
|
console.error(`Error: unknown subcommand "secrets ${sub}". Try \`argent secrets --help\`.`);
|
|
40122
40228
|
process.exit(2);
|
|
40123
40229
|
}
|
|
@@ -40147,7 +40253,16 @@ Examples:
|
|
|
40147
40253
|
}
|
|
40148
40254
|
async function cmdList(argv) {
|
|
40149
40255
|
if (argv.includes("--help") || argv.includes("-h")) return printUsage();
|
|
40150
|
-
|
|
40256
|
+
let json2;
|
|
40257
|
+
try {
|
|
40258
|
+
const { positionals, options } = parseCommandArgs(argv, LIST_OPTIONS2);
|
|
40259
|
+
if (positionals.length > 0) throw new UsageError(`Unexpected argument "${positionals[0]}"`);
|
|
40260
|
+
json2 = options.json === true;
|
|
40261
|
+
} catch (err) {
|
|
40262
|
+
if (!(err instanceof UsageError)) throw err;
|
|
40263
|
+
console.error(`Error: ${err.message}. Try \`argent secrets --help\`.`);
|
|
40264
|
+
process.exit(2);
|
|
40265
|
+
}
|
|
40151
40266
|
const sources = secretSources();
|
|
40152
40267
|
const all = secretNames(sources);
|
|
40153
40268
|
if (json2) {
|
|
@@ -40215,6 +40330,19 @@ async function linkedSecretsNote() {
|
|
|
40215
40330
|
return `Note: a remote tool-server is linked (${routed.url}). ${note}`;
|
|
40216
40331
|
}
|
|
40217
40332
|
|
|
40333
|
+
// ../argent-cli/src/project-scope.ts
|
|
40334
|
+
import * as path22 from "node:path";
|
|
40335
|
+
function degenerateProjectScopeWarning(scope, file2) {
|
|
40336
|
+
if (scope !== "project") return null;
|
|
40337
|
+
if (isHomeDir(path22.dirname(path22.dirname(file2)))) {
|
|
40338
|
+
return `WARNING: no project found between ${process.cwd()} and your home directory \u2014 "project" scope resolved to the home directory, so this writes the GLOBAL ${path22.basename(file2, ".json")} file (${file2}).`;
|
|
40339
|
+
}
|
|
40340
|
+
if (findProjectRoot(process.cwd()) === null) {
|
|
40341
|
+
return `WARNING: no project markers (.argent, .git, package.json) found above ${process.cwd()} \u2014 treating it as the project root and creating ${file2}.`;
|
|
40342
|
+
}
|
|
40343
|
+
return null;
|
|
40344
|
+
}
|
|
40345
|
+
|
|
40218
40346
|
// ../argent-cli/src/flags.ts
|
|
40219
40347
|
function colorState(enabled) {
|
|
40220
40348
|
const label = (enabled ? "enabled" : "disabled").padEnd(8);
|
|
@@ -40283,18 +40411,21 @@ function runToggle(argv, command, registry2) {
|
|
|
40283
40411
|
process.exit(2);
|
|
40284
40412
|
}
|
|
40285
40413
|
const filePath = getFlagsPath(parsed.scope);
|
|
40414
|
+
const warning = degenerateProjectScopeWarning(parsed.scope, filePath);
|
|
40415
|
+
let wrote = true;
|
|
40286
40416
|
try {
|
|
40287
40417
|
if (command === "enable") {
|
|
40288
40418
|
setFlag(parsed.name, true, parsed.scope);
|
|
40289
40419
|
} else if (getFlagDefinition(parsed.name, registry2)?.defaultEnabled) {
|
|
40290
40420
|
setFlag(parsed.name, false, parsed.scope);
|
|
40291
40421
|
} else {
|
|
40292
|
-
unsetFlag(parsed.name, parsed.scope);
|
|
40422
|
+
wrote = unsetFlag(parsed.name, parsed.scope);
|
|
40293
40423
|
}
|
|
40294
40424
|
} catch (err) {
|
|
40295
40425
|
console.error(`Failed to ${command} flag: ${err instanceof Error ? err.message : String(err)}`);
|
|
40296
40426
|
process.exit(1);
|
|
40297
40427
|
}
|
|
40428
|
+
if (wrote && warning) console.error(import_picocolors2.default.yellow(warning));
|
|
40298
40429
|
if (command === "enable") {
|
|
40299
40430
|
console.log(`Enabled flag "${parsed.name}" (${parsed.scope}). Stored at ${filePath}.`);
|
|
40300
40431
|
} else {
|
|
@@ -40320,6 +40451,7 @@ function enable(argv, registry2 = FLAG_REGISTRY) {
|
|
|
40320
40451
|
function disable(argv, registry2 = FLAG_REGISTRY) {
|
|
40321
40452
|
runToggle(argv, "disable", registry2);
|
|
40322
40453
|
}
|
|
40454
|
+
var FLAGS_OPTIONS = { json: { kind: "boolean" } };
|
|
40323
40455
|
function flags(argv, registry2 = FLAG_REGISTRY) {
|
|
40324
40456
|
if (argv.includes("--help") || argv.includes("-h")) {
|
|
40325
40457
|
console.log(`Usage: argent flags [--json]
|
|
@@ -40334,8 +40466,20 @@ Options:
|
|
|
40334
40466
|
`);
|
|
40335
40467
|
return;
|
|
40336
40468
|
}
|
|
40337
|
-
|
|
40338
|
-
|
|
40469
|
+
let json2;
|
|
40470
|
+
try {
|
|
40471
|
+
const { positionals, options } = parseCommandArgs(argv, FLAGS_OPTIONS);
|
|
40472
|
+
if (positionals.length > 0) {
|
|
40473
|
+
throw new UsageError(`Unexpected extra argument: "${positionals[0]}"`);
|
|
40474
|
+
}
|
|
40475
|
+
json2 = options.json === true;
|
|
40476
|
+
} catch (err) {
|
|
40477
|
+
if (!(err instanceof UsageError)) throw err;
|
|
40478
|
+
console.error(`Error: ${err.message}`);
|
|
40479
|
+
process.exit(2);
|
|
40480
|
+
}
|
|
40481
|
+
const projectIsHome = isHomeDir(path23.dirname(path23.dirname(getFlagsPath("project"))));
|
|
40482
|
+
const projectFlags = projectIsHome ? {} : readFlags("project");
|
|
40339
40483
|
const globalFlags = readFlags("global");
|
|
40340
40484
|
const effective = {};
|
|
40341
40485
|
for (const [k, v] of Object.entries(globalFlags)) effective[k] = { value: v, scope: "global" };
|
|
@@ -40392,12 +40536,12 @@ Options:
|
|
|
40392
40536
|
}
|
|
40393
40537
|
console.log(`
|
|
40394
40538
|
Global: ${getFlagsPath("global")}`);
|
|
40395
|
-
console.log(` Project: ${getFlagsPath("project")}`);
|
|
40539
|
+
if (!projectIsHome) console.log(` Project: ${getFlagsPath("project")}`);
|
|
40396
40540
|
}
|
|
40397
40541
|
|
|
40398
40542
|
// ../argent-cli/src/config.ts
|
|
40399
40543
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
40400
|
-
import * as
|
|
40544
|
+
import * as path24 from "node:path";
|
|
40401
40545
|
function config2(argv) {
|
|
40402
40546
|
if (argv.length === 0 || argv[0] === "--help" || argv[0] === "-h") {
|
|
40403
40547
|
printUsage2();
|
|
@@ -40426,7 +40570,11 @@ Show every recognized configuration value, its effective (merged) value, and
|
|
|
40426
40570
|
the raw value stored at each scope.`);
|
|
40427
40571
|
return;
|
|
40428
40572
|
}
|
|
40429
|
-
const json2 = argv
|
|
40573
|
+
const { positionals, json: json2 } = parseArgs2(argv, LIST_OPTIONS3);
|
|
40574
|
+
if (positionals.length > 0) {
|
|
40575
|
+
console.error(`Error: unexpected extra argument "${positionals[0]}".`);
|
|
40576
|
+
process.exit(2);
|
|
40577
|
+
}
|
|
40430
40578
|
const entries = listConfig();
|
|
40431
40579
|
if (json2) {
|
|
40432
40580
|
console.log(JSON.stringify({ config: entries }, null, 2));
|
|
@@ -40460,7 +40608,7 @@ Print a configuration value. Without --scope, prints the effective value after
|
|
|
40460
40608
|
merging project and global. With --scope, prints only that scope's stored value.`);
|
|
40461
40609
|
return;
|
|
40462
40610
|
}
|
|
40463
|
-
const { positionals, scope, json: json2 } = parseArgs2(argv);
|
|
40611
|
+
const { positionals, scope, json: json2 } = parseArgs2(argv, GET_OPTIONS);
|
|
40464
40612
|
const key = positionals[0];
|
|
40465
40613
|
if (!key) {
|
|
40466
40614
|
console.error("Error: `argent config get` requires a <key>.");
|
|
@@ -40494,7 +40642,7 @@ write <project-root>/.argent/config.json. Booleans, numbers, and JSON arrays are
|
|
|
40494
40642
|
parsed (e.g. \`true\`, \`42\`, \`["a","b"]\`); anything else is stored as a string.`);
|
|
40495
40643
|
return;
|
|
40496
40644
|
}
|
|
40497
|
-
const { positionals, scope } = parseArgs2(argv);
|
|
40645
|
+
const { positionals, scope } = parseArgs2(argv, WRITE_OPTIONS);
|
|
40498
40646
|
const key = positionals[0];
|
|
40499
40647
|
const rawValue = positionals[1];
|
|
40500
40648
|
if (!key || rawValue === void 0) {
|
|
@@ -40506,7 +40654,7 @@ parsed (e.g. \`true\`, \`42\`, \`["a","b"]\`); anything else is stored as a stri
|
|
|
40506
40654
|
process.exit(2);
|
|
40507
40655
|
}
|
|
40508
40656
|
const targetScope = scope ?? "global";
|
|
40509
|
-
const warning =
|
|
40657
|
+
const warning = projectConfigWarning(targetScope);
|
|
40510
40658
|
try {
|
|
40511
40659
|
const stored = setConfigValue(key, coerceCliValue(rawValue), targetScope);
|
|
40512
40660
|
if (warning) console.error(import_picocolors3.default.yellow(warning));
|
|
@@ -40525,7 +40673,7 @@ Remove a configuration value at a scope (default global). Falls back to the
|
|
|
40525
40673
|
other scope / the default on the next read.`);
|
|
40526
40674
|
return;
|
|
40527
40675
|
}
|
|
40528
|
-
const { positionals, scope } = parseArgs2(argv);
|
|
40676
|
+
const { positionals, scope } = parseArgs2(argv, WRITE_OPTIONS);
|
|
40529
40677
|
const key = positionals[0];
|
|
40530
40678
|
if (!key) {
|
|
40531
40679
|
console.error("Error: `argent config unset` requires a <key>.");
|
|
@@ -40536,7 +40684,7 @@ other scope / the default on the next read.`);
|
|
|
40536
40684
|
process.exit(2);
|
|
40537
40685
|
}
|
|
40538
40686
|
const targetScope = scope ?? "global";
|
|
40539
|
-
const warning =
|
|
40687
|
+
const warning = projectConfigWarning(targetScope);
|
|
40540
40688
|
try {
|
|
40541
40689
|
const removed = unsetConfigValue(key, targetScope);
|
|
40542
40690
|
if (removed && warning) console.error(import_picocolors3.default.yellow(warning));
|
|
@@ -40549,13 +40697,14 @@ other scope / the default on the next read.`);
|
|
|
40549
40697
|
reportError(err);
|
|
40550
40698
|
}
|
|
40551
40699
|
}
|
|
40552
|
-
var
|
|
40553
|
-
|
|
40554
|
-
|
|
40555
|
-
};
|
|
40556
|
-
|
|
40700
|
+
var SCOPE_OPTION = { kind: "value", choices: ["global", "project"] };
|
|
40701
|
+
var JSON_OPTION = { kind: "boolean" };
|
|
40702
|
+
var LIST_OPTIONS3 = { json: JSON_OPTION };
|
|
40703
|
+
var GET_OPTIONS = { scope: SCOPE_OPTION, json: JSON_OPTION };
|
|
40704
|
+
var WRITE_OPTIONS = { scope: SCOPE_OPTION };
|
|
40705
|
+
function parseArgs2(argv, specs) {
|
|
40557
40706
|
try {
|
|
40558
|
-
const { positionals, options } = parseCommandArgs(argv,
|
|
40707
|
+
const { positionals, options } = parseCommandArgs(argv, specs);
|
|
40559
40708
|
return {
|
|
40560
40709
|
positionals,
|
|
40561
40710
|
scope: options.scope ?? null,
|
|
@@ -40572,18 +40721,10 @@ function wantsHelp(argv) {
|
|
|
40572
40721
|
}
|
|
40573
40722
|
function scopeLabel(scope) {
|
|
40574
40723
|
if (scope === "global") return "global";
|
|
40575
|
-
return `project: ${
|
|
40724
|
+
return `project: ${path24.dirname(configDir("project"))}`;
|
|
40576
40725
|
}
|
|
40577
|
-
function
|
|
40578
|
-
|
|
40579
|
-
const projDir = configDir("project");
|
|
40580
|
-
if (path21.resolve(projDir) === path21.resolve(configDir("global"))) {
|
|
40581
|
-
return `WARNING: no project found between ${process.cwd()} and your home directory \u2014 "project" scope resolved to the home directory, so this writes the GLOBAL config file (${path21.join(projDir, "config.json")}).`;
|
|
40582
|
-
}
|
|
40583
|
-
if (findProjectRoot(process.cwd()) === null) {
|
|
40584
|
-
return `WARNING: no project markers (.argent, .git, package.json) found above ${process.cwd()} \u2014 treating it as the project root and creating ${path21.join(projDir, "config.json")}.`;
|
|
40585
|
-
}
|
|
40586
|
-
return null;
|
|
40726
|
+
function projectConfigWarning(scope) {
|
|
40727
|
+
return degenerateProjectScopeWarning(scope, path24.join(configDir("project"), "config.json"));
|
|
40587
40728
|
}
|
|
40588
40729
|
function restartHint(key) {
|
|
40589
40730
|
if (key !== "android.adbServerPort") return null;
|
|
@@ -41409,7 +41550,7 @@ import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
|
41409
41550
|
import process$1 from "node:process";
|
|
41410
41551
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
41411
41552
|
import { existsSync as existsSync7, lstatSync as lstatSync3, readdirSync as readdirSync3 } from "node:fs";
|
|
41412
|
-
import { dirname as
|
|
41553
|
+
import { dirname as dirname17, join as join22 } from "node:path";
|
|
41413
41554
|
function isUnicodeSupported() {
|
|
41414
41555
|
if (process$1.platform !== "win32") {
|
|
41415
41556
|
return process$1.env.TERM !== "linux";
|
|
@@ -42297,7 +42438,9 @@ async function unlink3(argv) {
|
|
|
42297
42438
|
|
|
42298
42439
|
// ../argent-cli/src/telemetry.ts
|
|
42299
42440
|
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
42441
|
+
import * as path25 from "node:path";
|
|
42300
42442
|
var SCOPES = ["global", "project"];
|
|
42443
|
+
var SUBCOMMANDS = ["status", "enable", "disable"];
|
|
42301
42444
|
var TELEMETRY_OPTIONS = {
|
|
42302
42445
|
scope: { kind: "value", choices: SCOPES }
|
|
42303
42446
|
};
|
|
@@ -42306,8 +42449,14 @@ async function telemetry(args) {
|
|
|
42306
42449
|
let scope = "global";
|
|
42307
42450
|
const wantsHelp2 = args.includes("--help") || args.includes("-h");
|
|
42308
42451
|
if (!wantsHelp2) {
|
|
42452
|
+
if (sub !== void 0 && !SUBCOMMANDS.includes(sub)) {
|
|
42453
|
+
console.error(`Error: Unknown subcommand: telemetry ${sub}`);
|
|
42454
|
+
printUsage3();
|
|
42455
|
+
process.exit(2);
|
|
42456
|
+
}
|
|
42309
42457
|
try {
|
|
42310
|
-
const
|
|
42458
|
+
const specs = sub === "status" ? {} : TELEMETRY_OPTIONS;
|
|
42459
|
+
const { positionals, options } = parseCommandArgs(args.slice(1), specs);
|
|
42311
42460
|
if (positionals.length > 0) {
|
|
42312
42461
|
throw new UsageError(`Unexpected argument "${positionals[0]}".`);
|
|
42313
42462
|
}
|
|
@@ -42340,10 +42489,6 @@ async function telemetry(args) {
|
|
|
42340
42489
|
case "disable":
|
|
42341
42490
|
await cmdDisable(scope);
|
|
42342
42491
|
return;
|
|
42343
|
-
default:
|
|
42344
|
-
console.error(`Unknown subcommand: telemetry ${sub}`);
|
|
42345
|
-
await shutdown();
|
|
42346
|
-
process.exit(1);
|
|
42347
42492
|
}
|
|
42348
42493
|
}
|
|
42349
42494
|
function printUsage3() {
|
|
@@ -42381,9 +42526,14 @@ function describeSource(source) {
|
|
|
42381
42526
|
return "default (no opt-out set)";
|
|
42382
42527
|
}
|
|
42383
42528
|
}
|
|
42529
|
+
function projectConfigWarning2(scope) {
|
|
42530
|
+
return degenerateProjectScopeWarning(scope, path25.join(configDir("project"), "config.json"));
|
|
42531
|
+
}
|
|
42384
42532
|
async function cmdEnable(scope) {
|
|
42533
|
+
const warning = projectConfigWarning2(scope);
|
|
42385
42534
|
const wasEnabled = isEnabled();
|
|
42386
42535
|
markEnabled(scope);
|
|
42536
|
+
if (warning) console.error(import_picocolors5.default.yellow(warning));
|
|
42387
42537
|
const nowEnabled = isEnabled();
|
|
42388
42538
|
if (!nowEnabled) {
|
|
42389
42539
|
console.log(
|
|
@@ -42399,8 +42549,10 @@ async function cmdEnable(scope) {
|
|
|
42399
42549
|
await shutdown();
|
|
42400
42550
|
}
|
|
42401
42551
|
async function cmdDisable(scope) {
|
|
42552
|
+
const warning = projectConfigWarning2(scope);
|
|
42402
42553
|
const wasEnabled = isEnabled();
|
|
42403
42554
|
await markDisabled(scope);
|
|
42555
|
+
if (warning) console.error(import_picocolors5.default.yellow(warning));
|
|
42404
42556
|
if (!wasEnabled) {
|
|
42405
42557
|
console.log(import_picocolors5.default.dim(`Telemetry was already disabled (written at ${scopeLabel2(scope)}).`));
|
|
42406
42558
|
} else {
|
|
@@ -42411,8 +42563,8 @@ async function cmdDisable(scope) {
|
|
|
42411
42563
|
|
|
42412
42564
|
// ../argent-cli/src/providers.ts
|
|
42413
42565
|
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
42414
|
-
import * as
|
|
42415
|
-
import * as
|
|
42566
|
+
import * as fs19 from "node:fs";
|
|
42567
|
+
import * as path28 from "node:path";
|
|
42416
42568
|
|
|
42417
42569
|
// ../device-providers/src/contract.ts
|
|
42418
42570
|
var PROVIDER_SCHEMA_VERSION = 1;
|
|
@@ -42557,9 +42709,9 @@ var providerEnvelopeSchema = providerRecordSchema.extend({
|
|
|
42557
42709
|
});
|
|
42558
42710
|
|
|
42559
42711
|
// ../device-providers/src/read.ts
|
|
42560
|
-
import * as
|
|
42712
|
+
import * as fs16 from "node:fs";
|
|
42561
42713
|
import * as os3 from "node:os";
|
|
42562
|
-
import * as
|
|
42714
|
+
import * as path26 from "node:path";
|
|
42563
42715
|
var DISABLE_ENV = "ARGENT_DISABLE_DEVICE_PROVIDERS";
|
|
42564
42716
|
var OVERRIDE_ENV = "ARGENT_DEVICE_PROVIDERS";
|
|
42565
42717
|
function resolveHomeDir2() {
|
|
@@ -42568,7 +42720,7 @@ function resolveHomeDir2() {
|
|
|
42568
42720
|
return trimmed ? raw : os3.homedir();
|
|
42569
42721
|
}
|
|
42570
42722
|
function providersDirectory() {
|
|
42571
|
-
return
|
|
42723
|
+
return path26.join(resolveHomeDir2(), ".argent", "providers");
|
|
42572
42724
|
}
|
|
42573
42725
|
function discoveryDisabled() {
|
|
42574
42726
|
const raw = process.env[DISABLE_ENV];
|
|
@@ -42584,7 +42736,7 @@ function warnOnce(key, message) {
|
|
|
42584
42736
|
function readProviderFile(file2) {
|
|
42585
42737
|
let raw;
|
|
42586
42738
|
try {
|
|
42587
|
-
raw =
|
|
42739
|
+
raw = fs16.readFileSync(file2, "utf8");
|
|
42588
42740
|
} catch {
|
|
42589
42741
|
return void 0;
|
|
42590
42742
|
}
|
|
@@ -42634,15 +42786,15 @@ function discoverProviders() {
|
|
|
42634
42786
|
function descriptorFiles() {
|
|
42635
42787
|
const directory = providersDirectory();
|
|
42636
42788
|
try {
|
|
42637
|
-
return
|
|
42789
|
+
return fs16.readdirSync(directory).filter((name) => name.endsWith(".json")).sort().map((name) => path26.join(directory, name));
|
|
42638
42790
|
} catch {
|
|
42639
42791
|
return [];
|
|
42640
42792
|
}
|
|
42641
42793
|
}
|
|
42642
42794
|
|
|
42643
42795
|
// ../device-providers/src/write.ts
|
|
42644
|
-
import * as
|
|
42645
|
-
import * as
|
|
42796
|
+
import * as fs17 from "node:fs";
|
|
42797
|
+
import * as path27 from "node:path";
|
|
42646
42798
|
var ProviderValidationError = class extends Error {
|
|
42647
42799
|
/** One line per problem, `path: message`, in the order zod reported them. */
|
|
42648
42800
|
issues;
|
|
@@ -42694,20 +42846,20 @@ function publishProvider(record2, options = {}) {
|
|
|
42694
42846
|
);
|
|
42695
42847
|
}
|
|
42696
42848
|
const directory = providersDirectory();
|
|
42697
|
-
const file2 =
|
|
42849
|
+
const file2 = path27.join(directory, `${validated.id}.json`);
|
|
42698
42850
|
const body = JSON.stringify(canonicalize(candidate), null, 2) + "\n";
|
|
42699
42851
|
try {
|
|
42700
|
-
if (
|
|
42852
|
+
if (fs17.readFileSync(file2, "utf8") === body) return { changed: false, path: file2 };
|
|
42701
42853
|
} catch {
|
|
42702
42854
|
}
|
|
42703
|
-
|
|
42855
|
+
fs17.mkdirSync(directory, { recursive: true });
|
|
42704
42856
|
const temporary = `${file2}.${process.pid}.tmp`;
|
|
42705
42857
|
try {
|
|
42706
|
-
|
|
42707
|
-
|
|
42858
|
+
fs17.writeFileSync(temporary, body);
|
|
42859
|
+
fs17.renameSync(temporary, file2);
|
|
42708
42860
|
} catch (error63) {
|
|
42709
42861
|
try {
|
|
42710
|
-
|
|
42862
|
+
fs17.rmSync(temporary, { force: true });
|
|
42711
42863
|
} catch {
|
|
42712
42864
|
}
|
|
42713
42865
|
throw error63;
|
|
@@ -42718,9 +42870,9 @@ function withdrawProvider(id) {
|
|
|
42718
42870
|
if (!PROVIDER_ID_SHAPE.test(id)) {
|
|
42719
42871
|
throw new Error(`'${id}' is not a valid provider id (${String(PROVIDER_ID_SHAPE)}).`);
|
|
42720
42872
|
}
|
|
42721
|
-
const file2 =
|
|
42873
|
+
const file2 = path27.join(providersDirectory(), `${id}.json`);
|
|
42722
42874
|
try {
|
|
42723
|
-
|
|
42875
|
+
fs17.unlinkSync(file2);
|
|
42724
42876
|
return true;
|
|
42725
42877
|
} catch (e) {
|
|
42726
42878
|
if (e.code === "ENOENT") return false;
|
|
@@ -42750,7 +42902,7 @@ function pruneOrphanedProviders(options = {}) {
|
|
|
42750
42902
|
continue;
|
|
42751
42903
|
}
|
|
42752
42904
|
try {
|
|
42753
|
-
|
|
42905
|
+
fs17.unlinkSync(file2);
|
|
42754
42906
|
removed.push(entry);
|
|
42755
42907
|
} catch {
|
|
42756
42908
|
}
|
|
@@ -42760,7 +42912,7 @@ function pruneOrphanedProviders(options = {}) {
|
|
|
42760
42912
|
|
|
42761
42913
|
// ../argent-cli/src/providers-check.ts
|
|
42762
42914
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
42763
|
-
import * as
|
|
42915
|
+
import * as fs18 from "node:fs";
|
|
42764
42916
|
var KNOWN_CAPABILITIES = new Set(EXTERNAL_CAPABILITIES);
|
|
42765
42917
|
var PROBE_TIMEOUT_MS = 5e3;
|
|
42766
42918
|
function error62(message) {
|
|
@@ -42826,7 +42978,7 @@ async function checkDevices(devices, findings) {
|
|
|
42826
42978
|
);
|
|
42827
42979
|
} else {
|
|
42828
42980
|
try {
|
|
42829
|
-
|
|
42981
|
+
fs18.accessSync(device.deviceSet, fs18.constants.R_OK);
|
|
42830
42982
|
} catch {
|
|
42831
42983
|
findings.push(
|
|
42832
42984
|
error62(`${label}: deviceSet '${device.deviceSet}' is not readable by this user`)
|
|
@@ -42883,7 +43035,7 @@ async function checkDevices(devices, findings) {
|
|
|
42883
43035
|
);
|
|
42884
43036
|
} else {
|
|
42885
43037
|
try {
|
|
42886
|
-
|
|
43038
|
+
fs18.accessSync(device.nativeDevtools.socketPath, fs18.constants.R_OK | fs18.constants.W_OK);
|
|
42887
43039
|
} catch {
|
|
42888
43040
|
findings.push(
|
|
42889
43041
|
error62(
|
|
@@ -42954,7 +43106,7 @@ async function checkDescriptorFile(file2, expectedVersion) {
|
|
|
42954
43106
|
const report = { deviceCount: 0, findings, source: file2 };
|
|
42955
43107
|
let raw;
|
|
42956
43108
|
try {
|
|
42957
|
-
raw =
|
|
43109
|
+
raw = fs18.readFileSync(file2, "utf8");
|
|
42958
43110
|
} catch (e) {
|
|
42959
43111
|
findings.push(error62(`unreadable: ${e instanceof Error ? e.message : String(e)}`));
|
|
42960
43112
|
return report;
|
|
@@ -43015,12 +43167,20 @@ ${title}`);
|
|
|
43015
43167
|
}
|
|
43016
43168
|
|
|
43017
43169
|
// ../argent-cli/src/providers.ts
|
|
43018
|
-
var
|
|
43170
|
+
var SUBCOMMANDS2 = ["check", "list", "prune", "publish", "withdraw"];
|
|
43171
|
+
var SUBCOMMAND_FLAGS = {
|
|
43172
|
+
check: ["--file", "--json", "--schema-version"],
|
|
43173
|
+
list: ["--json"],
|
|
43174
|
+
prune: ["--dry-run", "--json"],
|
|
43175
|
+
publish: ["--file", "--json", "--pid", "--schema-version", "--stdin"],
|
|
43176
|
+
withdraw: ["--json"]
|
|
43177
|
+
};
|
|
43019
43178
|
var UsageError2 = class extends Error {
|
|
43020
43179
|
};
|
|
43021
43180
|
function parseArgs3(argv) {
|
|
43022
43181
|
const parsed = {
|
|
43023
43182
|
dryRun: false,
|
|
43183
|
+
flags: [],
|
|
43024
43184
|
json: false,
|
|
43025
43185
|
operands: [],
|
|
43026
43186
|
schemaVersion: PROVIDER_SCHEMA_VERSION,
|
|
@@ -43039,6 +43199,7 @@ function parseArgs3(argv) {
|
|
|
43039
43199
|
};
|
|
43040
43200
|
for (let i2 = 0; i2 < argv.length; i2++) {
|
|
43041
43201
|
const token = argv[i2];
|
|
43202
|
+
if (token.startsWith("--")) parsed.flags.push(token.split("=")[0]);
|
|
43042
43203
|
if (token === "--json") {
|
|
43043
43204
|
parsed.json = true;
|
|
43044
43205
|
} else if (token === "--dry-run") {
|
|
@@ -43090,7 +43251,7 @@ async function readDocument(args) {
|
|
|
43090
43251
|
}
|
|
43091
43252
|
if (args.file) {
|
|
43092
43253
|
try {
|
|
43093
|
-
return { raw:
|
|
43254
|
+
return { raw: fs19.readFileSync(args.file, "utf8"), source: args.file };
|
|
43094
43255
|
} catch (e) {
|
|
43095
43256
|
throw new UsageError2(
|
|
43096
43257
|
`cannot read ${args.file}: ${e instanceof Error ? e.message : String(e)}`
|
|
@@ -43223,7 +43384,7 @@ function runWithdraw(args) {
|
|
|
43223
43384
|
throw new UsageError2(`'${id}' is not a valid provider id (${String(PROVIDER_ID_SHAPE)})`);
|
|
43224
43385
|
}
|
|
43225
43386
|
const removed = withdrawProvider(id);
|
|
43226
|
-
const file2 =
|
|
43387
|
+
const file2 = path28.join(providersDirectory(), `${id}.json`);
|
|
43227
43388
|
if (args.json) {
|
|
43228
43389
|
console.log(JSON.stringify({ ok: true, path: file2, removed }, null, 2));
|
|
43229
43390
|
return;
|
|
@@ -43351,7 +43512,8 @@ Options:
|
|
|
43351
43512
|
later prune can remove this descriptor if that
|
|
43352
43513
|
process dies. Overrides any pid in the document.
|
|
43353
43514
|
--dry-run prune: report what would be removed, remove nothing.
|
|
43354
|
-
--schema-version <n>
|
|
43515
|
+
--schema-version <n> check, publish: the contract version to validate
|
|
43516
|
+
against (default ${PROVIDER_SCHEMA_VERSION}).
|
|
43355
43517
|
--json Emit a machine-readable report on stdout.
|
|
43356
43518
|
--help, -h Show this message.
|
|
43357
43519
|
|
|
@@ -43384,7 +43546,7 @@ async function providers(argv) {
|
|
|
43384
43546
|
if (subcommand === void 0) process.exit(2);
|
|
43385
43547
|
return;
|
|
43386
43548
|
}
|
|
43387
|
-
if (!
|
|
43549
|
+
if (!SUBCOMMANDS2.includes(subcommand)) {
|
|
43388
43550
|
console.error(`Unknown subcommand: "${subcommand}"`);
|
|
43389
43551
|
printHelp3();
|
|
43390
43552
|
process.exit(2);
|
|
@@ -43405,6 +43567,13 @@ async function providers(argv) {
|
|
|
43405
43567
|
console.error(`Unknown argument: "${args.operands[0]}"`);
|
|
43406
43568
|
process.exit(2);
|
|
43407
43569
|
}
|
|
43570
|
+
const stray = args.flags.find(
|
|
43571
|
+
(flag) => !SUBCOMMAND_FLAGS[subcommand].includes(flag)
|
|
43572
|
+
);
|
|
43573
|
+
if (stray !== void 0) {
|
|
43574
|
+
console.error(`${stray} does not apply to \`argent providers ${subcommand}\``);
|
|
43575
|
+
process.exit(2);
|
|
43576
|
+
}
|
|
43408
43577
|
try {
|
|
43409
43578
|
switch (subcommand) {
|
|
43410
43579
|
case "check":
|