@swmansion/argent 0.27.1-next.21 → 0.27.1-next.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/argent-android-devtools-0.2.0.apk +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +579 -352
- package/dist/client.js +402 -187
- package/dist/installer.mjs +144 -141
- package/dist/mcp-server.mjs +444 -229
- package/dist/tool-args.generated.d.ts +2 -2
- package/dist/tool-server.cjs +1249 -928
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +1 -1
- package/skills/argent-create-flow/references/flow-yaml.md +4 -2
- package/skills/argent-create-flow/references/live-authoring.md +19 -3
package/dist/cli-cmds.mjs
CHANGED
|
@@ -124,17 +124,17 @@ var require_visit = __commonJS({
|
|
|
124
124
|
visit.BREAK = BREAK;
|
|
125
125
|
visit.SKIP = SKIP;
|
|
126
126
|
visit.REMOVE = REMOVE;
|
|
127
|
-
function visit_(key, node, visitor,
|
|
128
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
127
|
+
function visit_(key, node, visitor, path24) {
|
|
128
|
+
const ctrl = callVisitor(key, node, visitor, path24);
|
|
129
129
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
130
|
-
replaceNode(key,
|
|
131
|
-
return visit_(key, ctrl, visitor,
|
|
130
|
+
replaceNode(key, path24, ctrl);
|
|
131
|
+
return visit_(key, ctrl, visitor, path24);
|
|
132
132
|
}
|
|
133
133
|
if (typeof ctrl !== "symbol") {
|
|
134
134
|
if (identity2.isCollection(node)) {
|
|
135
|
-
|
|
135
|
+
path24 = Object.freeze(path24.concat(node));
|
|
136
136
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
137
|
-
const ci = visit_(i2, node.items[i2], visitor,
|
|
137
|
+
const ci = visit_(i2, node.items[i2], visitor, path24);
|
|
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(node)) {
|
|
148
|
-
|
|
149
|
-
const ck = visit_("key", node.key, visitor,
|
|
148
|
+
path24 = Object.freeze(path24.concat(node));
|
|
149
|
+
const ck = visit_("key", node.key, visitor, path24);
|
|
150
150
|
if (ck === BREAK)
|
|
151
151
|
return BREAK;
|
|
152
152
|
else if (ck === REMOVE)
|
|
153
153
|
node.key = null;
|
|
154
|
-
const cv = visit_("value", node.value, visitor,
|
|
154
|
+
const cv = visit_("value", node.value, visitor, path24);
|
|
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, node, visitor,
|
|
176
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
175
|
+
async function visitAsync_(key, node, visitor, path24) {
|
|
176
|
+
const ctrl = await callVisitor(key, node, visitor, path24);
|
|
177
177
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
178
|
-
replaceNode(key,
|
|
179
|
-
return visitAsync_(key, ctrl, visitor,
|
|
178
|
+
replaceNode(key, path24, ctrl);
|
|
179
|
+
return visitAsync_(key, ctrl, visitor, path24);
|
|
180
180
|
}
|
|
181
181
|
if (typeof ctrl !== "symbol") {
|
|
182
182
|
if (identity2.isCollection(node)) {
|
|
183
|
-
|
|
183
|
+
path24 = Object.freeze(path24.concat(node));
|
|
184
184
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
185
|
-
const ci = await visitAsync_(i2, node.items[i2], visitor,
|
|
185
|
+
const ci = await visitAsync_(i2, node.items[i2], visitor, path24);
|
|
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(node)) {
|
|
196
|
-
|
|
197
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
196
|
+
path24 = Object.freeze(path24.concat(node));
|
|
197
|
+
const ck = await visitAsync_("key", node.key, visitor, path24);
|
|
198
198
|
if (ck === BREAK)
|
|
199
199
|
return BREAK;
|
|
200
200
|
else if (ck === REMOVE)
|
|
201
201
|
node.key = null;
|
|
202
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
202
|
+
const cv = await visitAsync_("value", node.value, visitor, path24);
|
|
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, node, visitor,
|
|
229
|
+
function callVisitor(key, node, visitor, path24) {
|
|
230
230
|
if (typeof visitor === "function")
|
|
231
|
-
return visitor(key, node,
|
|
231
|
+
return visitor(key, node, path24);
|
|
232
232
|
if (identity2.isMap(node))
|
|
233
|
-
return visitor.Map?.(key, node,
|
|
233
|
+
return visitor.Map?.(key, node, path24);
|
|
234
234
|
if (identity2.isSeq(node))
|
|
235
|
-
return visitor.Seq?.(key, node,
|
|
235
|
+
return visitor.Seq?.(key, node, path24);
|
|
236
236
|
if (identity2.isPair(node))
|
|
237
|
-
return visitor.Pair?.(key, node,
|
|
237
|
+
return visitor.Pair?.(key, node, path24);
|
|
238
238
|
if (identity2.isScalar(node))
|
|
239
|
-
return visitor.Scalar?.(key, node,
|
|
239
|
+
return visitor.Scalar?.(key, node, path24);
|
|
240
240
|
if (identity2.isAlias(node))
|
|
241
|
-
return visitor.Alias?.(key, node,
|
|
241
|
+
return visitor.Alias?.(key, node, path24);
|
|
242
242
|
return void 0;
|
|
243
243
|
}
|
|
244
|
-
function replaceNode(key,
|
|
245
|
-
const parent =
|
|
244
|
+
function replaceNode(key, path24, node) {
|
|
245
|
+
const parent = path24[path24.length - 1];
|
|
246
246
|
if (identity2.isCollection(parent)) {
|
|
247
247
|
parent.items[key] = node;
|
|
248
248
|
} else if (identity2.isPair(parent)) {
|
|
@@ -852,10 +852,10 @@ var require_Collection = __commonJS({
|
|
|
852
852
|
var createNode = require_createNode();
|
|
853
853
|
var identity2 = require_identity();
|
|
854
854
|
var Node = require_Node();
|
|
855
|
-
function collectionFromPath(schema,
|
|
855
|
+
function collectionFromPath(schema, path24, value) {
|
|
856
856
|
let v = value;
|
|
857
|
-
for (let i2 =
|
|
858
|
-
const k =
|
|
857
|
+
for (let i2 = path24.length - 1; i2 >= 0; --i2) {
|
|
858
|
+
const k = path24[i2];
|
|
859
859
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
860
860
|
const a2 = [];
|
|
861
861
|
a2[k] = v;
|
|
@@ -874,7 +874,7 @@ var require_Collection = __commonJS({
|
|
|
874
874
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
875
875
|
});
|
|
876
876
|
}
|
|
877
|
-
var isEmptyPath = (
|
|
877
|
+
var isEmptyPath = (path24) => path24 == null || typeof path24 === "object" && !!path24[Symbol.iterator]().next().done;
|
|
878
878
|
var Collection = class extends Node.NodeBase {
|
|
879
879
|
constructor(type, schema) {
|
|
880
880
|
super(type);
|
|
@@ -904,11 +904,11 @@ var require_Collection = __commonJS({
|
|
|
904
904
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
905
905
|
* that already exists in the map.
|
|
906
906
|
*/
|
|
907
|
-
addIn(
|
|
908
|
-
if (isEmptyPath(
|
|
907
|
+
addIn(path24, value) {
|
|
908
|
+
if (isEmptyPath(path24))
|
|
909
909
|
this.add(value);
|
|
910
910
|
else {
|
|
911
|
-
const [key, ...rest] =
|
|
911
|
+
const [key, ...rest] = path24;
|
|
912
912
|
const node = this.get(key, true);
|
|
913
913
|
if (identity2.isCollection(node))
|
|
914
914
|
node.addIn(rest, value);
|
|
@@ -922,8 +922,8 @@ var require_Collection = __commonJS({
|
|
|
922
922
|
* Removes a value from the collection.
|
|
923
923
|
* @returns `true` if the item was found and removed.
|
|
924
924
|
*/
|
|
925
|
-
deleteIn(
|
|
926
|
-
const [key, ...rest] =
|
|
925
|
+
deleteIn(path24) {
|
|
926
|
+
const [key, ...rest] = path24;
|
|
927
927
|
if (rest.length === 0)
|
|
928
928
|
return this.delete(key);
|
|
929
929
|
const node = this.get(key, true);
|
|
@@ -937,8 +937,8 @@ var require_Collection = __commonJS({
|
|
|
937
937
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
938
938
|
* `true` (collections are always returned intact).
|
|
939
939
|
*/
|
|
940
|
-
getIn(
|
|
941
|
-
const [key, ...rest] =
|
|
940
|
+
getIn(path24, keepScalar) {
|
|
941
|
+
const [key, ...rest] = path24;
|
|
942
942
|
const node = this.get(key, true);
|
|
943
943
|
if (rest.length === 0)
|
|
944
944
|
return !keepScalar && identity2.isScalar(node) ? node.value : node;
|
|
@@ -956,8 +956,8 @@ var require_Collection = __commonJS({
|
|
|
956
956
|
/**
|
|
957
957
|
* Checks if the collection includes a value with the key `key`.
|
|
958
958
|
*/
|
|
959
|
-
hasIn(
|
|
960
|
-
const [key, ...rest] =
|
|
959
|
+
hasIn(path24) {
|
|
960
|
+
const [key, ...rest] = path24;
|
|
961
961
|
if (rest.length === 0)
|
|
962
962
|
return this.has(key);
|
|
963
963
|
const node = this.get(key, true);
|
|
@@ -967,8 +967,8 @@ var require_Collection = __commonJS({
|
|
|
967
967
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
968
968
|
* boolean to add/remove the item from the set.
|
|
969
969
|
*/
|
|
970
|
-
setIn(
|
|
971
|
-
const [key, ...rest] =
|
|
970
|
+
setIn(path24, value) {
|
|
971
|
+
const [key, ...rest] = path24;
|
|
972
972
|
if (rest.length === 0) {
|
|
973
973
|
this.set(key, value);
|
|
974
974
|
} else {
|
|
@@ -3483,9 +3483,9 @@ var require_Document = __commonJS({
|
|
|
3483
3483
|
this.contents.add(value);
|
|
3484
3484
|
}
|
|
3485
3485
|
/** Adds a value to the document. */
|
|
3486
|
-
addIn(
|
|
3486
|
+
addIn(path24, value) {
|
|
3487
3487
|
if (assertCollection(this.contents))
|
|
3488
|
-
this.contents.addIn(
|
|
3488
|
+
this.contents.addIn(path24, value);
|
|
3489
3489
|
}
|
|
3490
3490
|
/**
|
|
3491
3491
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3560,14 +3560,14 @@ var require_Document = __commonJS({
|
|
|
3560
3560
|
* Removes a value from the document.
|
|
3561
3561
|
* @returns `true` if the item was found and removed.
|
|
3562
3562
|
*/
|
|
3563
|
-
deleteIn(
|
|
3564
|
-
if (Collection.isEmptyPath(
|
|
3563
|
+
deleteIn(path24) {
|
|
3564
|
+
if (Collection.isEmptyPath(path24)) {
|
|
3565
3565
|
if (this.contents == null)
|
|
3566
3566
|
return false;
|
|
3567
3567
|
this.contents = null;
|
|
3568
3568
|
return true;
|
|
3569
3569
|
}
|
|
3570
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3570
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path24) : false;
|
|
3571
3571
|
}
|
|
3572
3572
|
/**
|
|
3573
3573
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3582,10 +3582,10 @@ var require_Document = __commonJS({
|
|
|
3582
3582
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3583
3583
|
* `true` (collections are always returned intact).
|
|
3584
3584
|
*/
|
|
3585
|
-
getIn(
|
|
3586
|
-
if (Collection.isEmptyPath(
|
|
3585
|
+
getIn(path24, keepScalar) {
|
|
3586
|
+
if (Collection.isEmptyPath(path24))
|
|
3587
3587
|
return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3588
|
-
return identity2.isCollection(this.contents) ? this.contents.getIn(
|
|
3588
|
+
return identity2.isCollection(this.contents) ? this.contents.getIn(path24, keepScalar) : void 0;
|
|
3589
3589
|
}
|
|
3590
3590
|
/**
|
|
3591
3591
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3596,10 +3596,10 @@ var require_Document = __commonJS({
|
|
|
3596
3596
|
/**
|
|
3597
3597
|
* Checks if the document includes a value at `path`.
|
|
3598
3598
|
*/
|
|
3599
|
-
hasIn(
|
|
3600
|
-
if (Collection.isEmptyPath(
|
|
3599
|
+
hasIn(path24) {
|
|
3600
|
+
if (Collection.isEmptyPath(path24))
|
|
3601
3601
|
return this.contents !== void 0;
|
|
3602
|
-
return identity2.isCollection(this.contents) ? this.contents.hasIn(
|
|
3602
|
+
return identity2.isCollection(this.contents) ? this.contents.hasIn(path24) : false;
|
|
3603
3603
|
}
|
|
3604
3604
|
/**
|
|
3605
3605
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3616,13 +3616,13 @@ var require_Document = __commonJS({
|
|
|
3616
3616
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3617
3617
|
* boolean to add/remove the item from the set.
|
|
3618
3618
|
*/
|
|
3619
|
-
setIn(
|
|
3620
|
-
if (Collection.isEmptyPath(
|
|
3619
|
+
setIn(path24, value) {
|
|
3620
|
+
if (Collection.isEmptyPath(path24)) {
|
|
3621
3621
|
this.contents = value;
|
|
3622
3622
|
} else if (this.contents == null) {
|
|
3623
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3623
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path24), value);
|
|
3624
3624
|
} else if (assertCollection(this.contents)) {
|
|
3625
|
-
this.contents.setIn(
|
|
3625
|
+
this.contents.setIn(path24, value);
|
|
3626
3626
|
}
|
|
3627
3627
|
}
|
|
3628
3628
|
/**
|
|
@@ -5582,9 +5582,9 @@ var require_cst_visit = __commonJS({
|
|
|
5582
5582
|
visit.BREAK = BREAK;
|
|
5583
5583
|
visit.SKIP = SKIP;
|
|
5584
5584
|
visit.REMOVE = REMOVE;
|
|
5585
|
-
visit.itemAtPath = (cst,
|
|
5585
|
+
visit.itemAtPath = (cst, path24) => {
|
|
5586
5586
|
let item = cst;
|
|
5587
|
-
for (const [field, index] of
|
|
5587
|
+
for (const [field, index] of path24) {
|
|
5588
5588
|
const tok = item?.[field];
|
|
5589
5589
|
if (tok && "items" in tok) {
|
|
5590
5590
|
item = tok.items[index];
|
|
@@ -5593,23 +5593,23 @@ var require_cst_visit = __commonJS({
|
|
|
5593
5593
|
}
|
|
5594
5594
|
return item;
|
|
5595
5595
|
};
|
|
5596
|
-
visit.parentCollection = (cst,
|
|
5597
|
-
const parent = visit.itemAtPath(cst,
|
|
5598
|
-
const field =
|
|
5596
|
+
visit.parentCollection = (cst, path24) => {
|
|
5597
|
+
const parent = visit.itemAtPath(cst, path24.slice(0, -1));
|
|
5598
|
+
const field = path24[path24.length - 1][0];
|
|
5599
5599
|
const coll = parent?.[field];
|
|
5600
5600
|
if (coll && "items" in coll)
|
|
5601
5601
|
return coll;
|
|
5602
5602
|
throw new Error("Parent collection not found");
|
|
5603
5603
|
};
|
|
5604
|
-
function _visit(
|
|
5605
|
-
let ctrl = visitor(item,
|
|
5604
|
+
function _visit(path24, item, visitor) {
|
|
5605
|
+
let ctrl = visitor(item, path24);
|
|
5606
5606
|
if (typeof ctrl === "symbol")
|
|
5607
5607
|
return ctrl;
|
|
5608
5608
|
for (const field of ["key", "value"]) {
|
|
5609
5609
|
const token = item[field];
|
|
5610
5610
|
if (token && "items" in token) {
|
|
5611
5611
|
for (let i2 = 0; i2 < token.items.length; ++i2) {
|
|
5612
|
-
const ci = _visit(Object.freeze(
|
|
5612
|
+
const ci = _visit(Object.freeze(path24.concat([[field, i2]])), token.items[i2], visitor);
|
|
5613
5613
|
if (typeof ci === "number")
|
|
5614
5614
|
i2 = ci - 1;
|
|
5615
5615
|
else if (ci === BREAK)
|
|
@@ -5620,10 +5620,10 @@ var require_cst_visit = __commonJS({
|
|
|
5620
5620
|
}
|
|
5621
5621
|
}
|
|
5622
5622
|
if (typeof ctrl === "function" && field === "key")
|
|
5623
|
-
ctrl = ctrl(item,
|
|
5623
|
+
ctrl = ctrl(item, path24);
|
|
5624
5624
|
}
|
|
5625
5625
|
}
|
|
5626
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5626
|
+
return typeof ctrl === "function" ? ctrl(item, path24) : ctrl;
|
|
5627
5627
|
}
|
|
5628
5628
|
exports.visit = visit;
|
|
5629
5629
|
}
|
|
@@ -7378,7 +7378,7 @@ var require_dist = __commonJS({
|
|
|
7378
7378
|
var require_main = __commonJS({
|
|
7379
7379
|
"../../node_modules/dotenv/lib/main.js"(exports, module) {
|
|
7380
7380
|
var fs18 = __require("fs");
|
|
7381
|
-
var
|
|
7381
|
+
var path24 = __require("path");
|
|
7382
7382
|
var os4 = __require("os");
|
|
7383
7383
|
var crypto3 = __require("crypto");
|
|
7384
7384
|
var TIPS = [
|
|
@@ -7517,7 +7517,7 @@ var require_main = __commonJS({
|
|
|
7517
7517
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
7518
7518
|
}
|
|
7519
7519
|
} else {
|
|
7520
|
-
possibleVaultPath =
|
|
7520
|
+
possibleVaultPath = path24.resolve(process.cwd(), ".env.vault");
|
|
7521
7521
|
}
|
|
7522
7522
|
if (fs18.existsSync(possibleVaultPath)) {
|
|
7523
7523
|
return possibleVaultPath;
|
|
@@ -7525,7 +7525,7 @@ var require_main = __commonJS({
|
|
|
7525
7525
|
return null;
|
|
7526
7526
|
}
|
|
7527
7527
|
function _resolveHome(envPath) {
|
|
7528
|
-
return envPath[0] === "~" ?
|
|
7528
|
+
return envPath[0] === "~" ? path24.join(os4.homedir(), envPath.slice(1)) : envPath;
|
|
7529
7529
|
}
|
|
7530
7530
|
function _configVault(options) {
|
|
7531
7531
|
const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
@@ -7542,7 +7542,7 @@ var require_main = __commonJS({
|
|
|
7542
7542
|
return { parsed };
|
|
7543
7543
|
}
|
|
7544
7544
|
function configDotenv(options) {
|
|
7545
|
-
const dotenvPath =
|
|
7545
|
+
const dotenvPath = path24.resolve(process.cwd(), ".env");
|
|
7546
7546
|
let encoding = "utf8";
|
|
7547
7547
|
let processEnv = process.env;
|
|
7548
7548
|
if (options && options.processEnv != null) {
|
|
@@ -7570,13 +7570,13 @@ var require_main = __commonJS({
|
|
|
7570
7570
|
}
|
|
7571
7571
|
let lastError;
|
|
7572
7572
|
const parsedAll = {};
|
|
7573
|
-
for (const
|
|
7573
|
+
for (const path25 of optionPaths) {
|
|
7574
7574
|
try {
|
|
7575
|
-
const parsed = DotenvModule.parse(fs18.readFileSync(
|
|
7575
|
+
const parsed = DotenvModule.parse(fs18.readFileSync(path25, { encoding }));
|
|
7576
7576
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
7577
7577
|
} catch (e) {
|
|
7578
7578
|
if (debug) {
|
|
7579
|
-
_debug(`failed to load ${
|
|
7579
|
+
_debug(`failed to load ${path25} ${e.message}`);
|
|
7580
7580
|
}
|
|
7581
7581
|
lastError = e;
|
|
7582
7582
|
}
|
|
@@ -7589,7 +7589,7 @@ var require_main = __commonJS({
|
|
|
7589
7589
|
const shortPaths = [];
|
|
7590
7590
|
for (const filePath of optionPaths) {
|
|
7591
7591
|
try {
|
|
7592
|
-
const relative3 =
|
|
7592
|
+
const relative3 = path24.relative(process.cwd(), filePath);
|
|
7593
7593
|
shortPaths.push(relative3);
|
|
7594
7594
|
} catch (e) {
|
|
7595
7595
|
if (debug) {
|
|
@@ -8841,7 +8841,7 @@ var require_src = __commonJS({
|
|
|
8841
8841
|
|
|
8842
8842
|
// ../argent-cli/src/run.ts
|
|
8843
8843
|
import * as fs11 from "node:fs";
|
|
8844
|
-
import * as
|
|
8844
|
+
import * as path16 from "node:path";
|
|
8845
8845
|
|
|
8846
8846
|
// ../argent-tools-client/src/launcher.ts
|
|
8847
8847
|
import * as net from "node:net";
|
|
@@ -8882,7 +8882,7 @@ function generateAuthToken() {
|
|
|
8882
8882
|
return generateToken();
|
|
8883
8883
|
}
|
|
8884
8884
|
function findFreePort() {
|
|
8885
|
-
return new Promise((
|
|
8885
|
+
return new Promise((resolve12, reject) => {
|
|
8886
8886
|
const srv = net.createServer();
|
|
8887
8887
|
srv.listen(0, "127.0.0.1", () => {
|
|
8888
8888
|
const addr = srv.address();
|
|
@@ -8893,7 +8893,7 @@ function findFreePort() {
|
|
|
8893
8893
|
const port = addr.port;
|
|
8894
8894
|
srv.close((err) => {
|
|
8895
8895
|
if (err) reject(err);
|
|
8896
|
-
else
|
|
8896
|
+
else resolve12(port);
|
|
8897
8897
|
});
|
|
8898
8898
|
});
|
|
8899
8899
|
srv.on("error", reject);
|
|
@@ -8994,7 +8994,7 @@ function killSpawnedChild(child, pid) {
|
|
|
8994
8994
|
}
|
|
8995
8995
|
}
|
|
8996
8996
|
function spawnToolsServer(paths, port, options = {}) {
|
|
8997
|
-
return new Promise((
|
|
8997
|
+
return new Promise((resolve12, reject) => {
|
|
8998
8998
|
let logFd;
|
|
8999
8999
|
try {
|
|
9000
9000
|
fs.mkdirSync(STATE_DIR, { recursive: true });
|
|
@@ -9040,7 +9040,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
9040
9040
|
rl.close();
|
|
9041
9041
|
child.stdout?.resume();
|
|
9042
9042
|
child.stdout?.unref?.();
|
|
9043
|
-
settle(() =>
|
|
9043
|
+
settle(() => resolve12({ port: actualPort, pid }));
|
|
9044
9044
|
}
|
|
9045
9045
|
});
|
|
9046
9046
|
child.on("error", (err) => {
|
|
@@ -9353,6 +9353,12 @@ async function ensureToolsServer(paths) {
|
|
|
9353
9353
|
}
|
|
9354
9354
|
}
|
|
9355
9355
|
|
|
9356
|
+
// ../argent-tools-client/src/tools-client.ts
|
|
9357
|
+
import * as path6 from "node:path";
|
|
9358
|
+
|
|
9359
|
+
// ../registry/src/types.ts
|
|
9360
|
+
var LINKED_CALL_HEADER = "x-argent-linked";
|
|
9361
|
+
|
|
9356
9362
|
// ../registry/src/artifacts.ts
|
|
9357
9363
|
import { stat } from "node:fs/promises";
|
|
9358
9364
|
import { randomUUID } from "node:crypto";
|
|
@@ -9363,6 +9369,35 @@ var FLOW_NAME_CHARSET = "[A-Za-z0-9_-]+";
|
|
|
9363
9369
|
var FLOW_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}$`);
|
|
9364
9370
|
var FLOW_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.yaml$`);
|
|
9365
9371
|
var SCRIPT_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.mjs$`);
|
|
9372
|
+
function interpolateFileInputPath(template, args) {
|
|
9373
|
+
let missing = false;
|
|
9374
|
+
const out = template.replace(/\$\{([A-Za-z0-9_]+)\}/g, (_m, name) => {
|
|
9375
|
+
const v = args[name];
|
|
9376
|
+
if (typeof v !== "string" || v.length === 0) {
|
|
9377
|
+
missing = true;
|
|
9378
|
+
return "";
|
|
9379
|
+
}
|
|
9380
|
+
return v;
|
|
9381
|
+
});
|
|
9382
|
+
return missing ? null : out;
|
|
9383
|
+
}
|
|
9384
|
+
var TOOL_FILE_EXTENSIONS = [".png", ".yaml"];
|
|
9385
|
+
function hasToolFileExtension(file2) {
|
|
9386
|
+
const name = file2.toLowerCase();
|
|
9387
|
+
return TOOL_FILE_EXTENSIONS.some((extension) => name.endsWith(extension));
|
|
9388
|
+
}
|
|
9389
|
+
function toolStepFiles(specs, args) {
|
|
9390
|
+
const files = [];
|
|
9391
|
+
for (const spec of specs ?? []) {
|
|
9392
|
+
if (spec.skipWhenSet !== void 0 && args[spec.skipWhenSet] !== void 0) continue;
|
|
9393
|
+
const filled = interpolateFileInputPath(spec.path, args);
|
|
9394
|
+
if (filled !== null) files.push({ spec, path: filled });
|
|
9395
|
+
}
|
|
9396
|
+
return files;
|
|
9397
|
+
}
|
|
9398
|
+
function isClientFileArgument({ spec, path: path24 }) {
|
|
9399
|
+
return spec.kind === "file" && spec.path === `\${${spec.target}}` && path24.startsWith("/") && hasToolFileExtension(path24);
|
|
9400
|
+
}
|
|
9366
9401
|
|
|
9367
9402
|
// ../registry/src/flow-file-refs.ts
|
|
9368
9403
|
import * as fs2 from "node:fs/promises";
|
|
@@ -9391,6 +9426,8 @@ function isRecord(value) {
|
|
|
9391
9426
|
function collectFlowRequests(doc) {
|
|
9392
9427
|
const runTargets = /* @__PURE__ */ new Set();
|
|
9393
9428
|
const snapshots = /* @__PURE__ */ new Set();
|
|
9429
|
+
const toolSteps = [];
|
|
9430
|
+
const nested = [];
|
|
9394
9431
|
const seen = /* @__PURE__ */ new Set();
|
|
9395
9432
|
const visit = (steps, depth) => {
|
|
9396
9433
|
if (!Array.isArray(steps) || depth > MAX_BLOCK_NESTING || seen.has(steps)) return;
|
|
@@ -9404,11 +9441,17 @@ function collectFlowRequests(doc) {
|
|
|
9404
9441
|
}
|
|
9405
9442
|
const snapshot = isRecord(step.snapshot) ? step.snapshot.name : step.snapshot;
|
|
9406
9443
|
if (typeof snapshot === "string" && FLOW_NAME_PATTERN.test(snapshot)) snapshots.add(snapshot);
|
|
9444
|
+
if (typeof step.tool === "string") {
|
|
9445
|
+
const args = isRecord(step.args) ? step.args : {};
|
|
9446
|
+
toolSteps.push({ tool: step.tool, args });
|
|
9447
|
+
const target = step.tool === "flow-execute" ? nestedFlowTarget(args) : void 0;
|
|
9448
|
+
if (target !== void 0) nested.push({ target, args });
|
|
9449
|
+
}
|
|
9407
9450
|
visit(step.steps, depth + 1);
|
|
9408
9451
|
}
|
|
9409
9452
|
};
|
|
9410
9453
|
if (isRecord(doc)) visit(doc.steps, 0);
|
|
9411
|
-
return { runTargets: [...runTargets], snapshots: [...snapshots] };
|
|
9454
|
+
return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
|
|
9412
9455
|
}
|
|
9413
9456
|
function baselineKeyFor(canonicalPath, flowName) {
|
|
9414
9457
|
const stem = path2.basename(canonicalPath, ".yaml");
|
|
@@ -9424,6 +9467,26 @@ async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PA
|
|
|
9424
9467
|
if (actual === void 0) return { state: "absent" };
|
|
9425
9468
|
return { state: "case_folded", actual, addressable: addressable.test(actual) };
|
|
9426
9469
|
}
|
|
9470
|
+
function nestedFlowTarget(args) {
|
|
9471
|
+
if (typeof args !== "object" || args === null || Array.isArray(args)) return void 0;
|
|
9472
|
+
const { name, project_root: projectRoot, flow_path: flowPath } = args;
|
|
9473
|
+
if (flowPath === void 0) {
|
|
9474
|
+
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name)) return void 0;
|
|
9475
|
+
if (!isResolvedAbsolute(projectRoot)) return void 0;
|
|
9476
|
+
return {
|
|
9477
|
+
kind: "name",
|
|
9478
|
+
projectRoot,
|
|
9479
|
+
name,
|
|
9480
|
+
path: path2.join(projectRoot, ".argent", "flows", `${name}.yaml`)
|
|
9481
|
+
};
|
|
9482
|
+
}
|
|
9483
|
+
if (name !== void 0 || !isResolvedAbsolute(flowPath)) return void 0;
|
|
9484
|
+
if (!FLOW_FILE_NAME_PATTERN.test(path2.basename(flowPath))) return void 0;
|
|
9485
|
+
return { kind: "flow_path", path: flowPath };
|
|
9486
|
+
}
|
|
9487
|
+
function isResolvedAbsolute(value) {
|
|
9488
|
+
return typeof value === "string" && path2.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
|
|
9489
|
+
}
|
|
9427
9490
|
|
|
9428
9491
|
// ../registry/src/failure-codes.ts
|
|
9429
9492
|
var FAILURE_CODES = {
|
|
@@ -10545,10 +10608,10 @@ function mergeDefs(...defs) {
|
|
|
10545
10608
|
function cloneDef(schema) {
|
|
10546
10609
|
return mergeDefs(schema._zod.def);
|
|
10547
10610
|
}
|
|
10548
|
-
function getElementAtPath(obj,
|
|
10549
|
-
if (!
|
|
10611
|
+
function getElementAtPath(obj, path24) {
|
|
10612
|
+
if (!path24)
|
|
10550
10613
|
return obj;
|
|
10551
|
-
return
|
|
10614
|
+
return path24.reduce((acc, key) => acc?.[key], obj);
|
|
10552
10615
|
}
|
|
10553
10616
|
function promiseAllObject(promisesObj) {
|
|
10554
10617
|
const keys = Object.keys(promisesObj);
|
|
@@ -10957,11 +11020,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
10957
11020
|
}
|
|
10958
11021
|
return false;
|
|
10959
11022
|
}
|
|
10960
|
-
function prefixIssues(
|
|
11023
|
+
function prefixIssues(path24, issues) {
|
|
10961
11024
|
return issues.map((iss) => {
|
|
10962
11025
|
var _a3;
|
|
10963
11026
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
10964
|
-
iss.path.unshift(
|
|
11027
|
+
iss.path.unshift(path24);
|
|
10965
11028
|
return iss;
|
|
10966
11029
|
});
|
|
10967
11030
|
}
|
|
@@ -11108,16 +11171,16 @@ function flattenError(error52, mapper = (issue2) => issue2.message) {
|
|
|
11108
11171
|
}
|
|
11109
11172
|
function formatError(error52, mapper = (issue2) => issue2.message) {
|
|
11110
11173
|
const fieldErrors = { _errors: [] };
|
|
11111
|
-
const processError = (error53,
|
|
11174
|
+
const processError = (error53, path24 = []) => {
|
|
11112
11175
|
for (const issue2 of error53.issues) {
|
|
11113
11176
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
11114
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
11177
|
+
issue2.errors.map((issues) => processError({ issues }, [...path24, ...issue2.path]));
|
|
11115
11178
|
} else if (issue2.code === "invalid_key") {
|
|
11116
|
-
processError({ issues: issue2.issues }, [...
|
|
11179
|
+
processError({ issues: issue2.issues }, [...path24, ...issue2.path]);
|
|
11117
11180
|
} else if (issue2.code === "invalid_element") {
|
|
11118
|
-
processError({ issues: issue2.issues }, [...
|
|
11181
|
+
processError({ issues: issue2.issues }, [...path24, ...issue2.path]);
|
|
11119
11182
|
} else {
|
|
11120
|
-
const fullpath = [...
|
|
11183
|
+
const fullpath = [...path24, ...issue2.path];
|
|
11121
11184
|
if (fullpath.length === 0) {
|
|
11122
11185
|
fieldErrors._errors.push(mapper(issue2));
|
|
11123
11186
|
} else {
|
|
@@ -11144,17 +11207,17 @@ function formatError(error52, mapper = (issue2) => issue2.message) {
|
|
|
11144
11207
|
}
|
|
11145
11208
|
function treeifyError(error52, mapper = (issue2) => issue2.message) {
|
|
11146
11209
|
const result = { errors: [] };
|
|
11147
|
-
const processError = (error53,
|
|
11210
|
+
const processError = (error53, path24 = []) => {
|
|
11148
11211
|
var _a3, _b;
|
|
11149
11212
|
for (const issue2 of error53.issues) {
|
|
11150
11213
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
11151
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
11214
|
+
issue2.errors.map((issues) => processError({ issues }, [...path24, ...issue2.path]));
|
|
11152
11215
|
} else if (issue2.code === "invalid_key") {
|
|
11153
|
-
processError({ issues: issue2.issues }, [...
|
|
11216
|
+
processError({ issues: issue2.issues }, [...path24, ...issue2.path]);
|
|
11154
11217
|
} else if (issue2.code === "invalid_element") {
|
|
11155
|
-
processError({ issues: issue2.issues }, [...
|
|
11218
|
+
processError({ issues: issue2.issues }, [...path24, ...issue2.path]);
|
|
11156
11219
|
} else {
|
|
11157
|
-
const fullpath = [...
|
|
11220
|
+
const fullpath = [...path24, ...issue2.path];
|
|
11158
11221
|
if (fullpath.length === 0) {
|
|
11159
11222
|
result.errors.push(mapper(issue2));
|
|
11160
11223
|
continue;
|
|
@@ -11186,8 +11249,8 @@ function treeifyError(error52, mapper = (issue2) => issue2.message) {
|
|
|
11186
11249
|
}
|
|
11187
11250
|
function toDotPath(_path) {
|
|
11188
11251
|
const segs = [];
|
|
11189
|
-
const
|
|
11190
|
-
for (const seg of
|
|
11252
|
+
const path24 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
11253
|
+
for (const seg of path24) {
|
|
11191
11254
|
if (typeof seg === "number")
|
|
11192
11255
|
segs.push(`[${seg}]`);
|
|
11193
11256
|
else if (typeof seg === "symbol")
|
|
@@ -23879,13 +23942,13 @@ function resolveRef(ref, ctx) {
|
|
|
23879
23942
|
if (!ref.startsWith("#")) {
|
|
23880
23943
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
23881
23944
|
}
|
|
23882
|
-
const
|
|
23883
|
-
if (
|
|
23945
|
+
const path24 = ref.slice(1).split("/").filter(Boolean);
|
|
23946
|
+
if (path24.length === 0) {
|
|
23884
23947
|
return ctx.rootSchema;
|
|
23885
23948
|
}
|
|
23886
23949
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
23887
|
-
if (
|
|
23888
|
-
const key =
|
|
23950
|
+
if (path24[0] === defsKey) {
|
|
23951
|
+
const key = path24[1];
|
|
23889
23952
|
if (!key || !ctx.defs[key]) {
|
|
23890
23953
|
throw new Error(`Reference not found: ${ref}`);
|
|
23891
23954
|
}
|
|
@@ -24297,9 +24360,9 @@ config(en_default());
|
|
|
24297
24360
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
24298
24361
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
24299
24362
|
var resolvedDuringInvocation = new AsyncLocalStorage();
|
|
24300
|
-
function valueAtPath(root,
|
|
24363
|
+
function valueAtPath(root, path24) {
|
|
24301
24364
|
let current = root;
|
|
24302
|
-
for (const key of
|
|
24365
|
+
for (const key of path24) {
|
|
24303
24366
|
if (current === null || typeof current !== "object") return void 0;
|
|
24304
24367
|
if (!Object.hasOwn(current, key)) return void 0;
|
|
24305
24368
|
current = current[key];
|
|
@@ -24459,8 +24522,8 @@ function parseLinkTarget(input) {
|
|
|
24459
24522
|
const host = u3.hostname.startsWith("[") ? u3.hostname.slice(1, -1) : u3.hostname;
|
|
24460
24523
|
if (!host) throw new Error(`URL "${input}" is missing a host.`);
|
|
24461
24524
|
const port = u3.port ? Number(u3.port) : u3.protocol === "https:" ? 443 : 80;
|
|
24462
|
-
const
|
|
24463
|
-
const url2 = `${u3.protocol}//${u3.host}${
|
|
24525
|
+
const path24 = u3.pathname === "/" ? "" : u3.pathname.replace(/\/+$/, "");
|
|
24526
|
+
const url2 = `${u3.protocol}//${u3.host}${path24}`;
|
|
24464
24527
|
const token = u3.username ? decodeURIComponent(u3.username) : void 0;
|
|
24465
24528
|
return { url: url2, host, port, ...token ? { token } : {} };
|
|
24466
24529
|
}
|
|
@@ -24649,9 +24712,9 @@ function untrackArchive(archive) {
|
|
|
24649
24712
|
process.removeListener("exit", removePendingArchives);
|
|
24650
24713
|
}
|
|
24651
24714
|
function sha256File(filePath) {
|
|
24652
|
-
return new Promise((
|
|
24715
|
+
return new Promise((resolve12, reject) => {
|
|
24653
24716
|
const hash2 = createHash2("sha256");
|
|
24654
|
-
createReadStream(filePath).on("data", (chunk) => hash2.update(chunk)).on("end", () =>
|
|
24717
|
+
createReadStream(filePath).on("data", (chunk) => hash2.update(chunk)).on("end", () => resolve12(hash2.digest("hex"))).on("error", reject);
|
|
24655
24718
|
});
|
|
24656
24719
|
}
|
|
24657
24720
|
function toolServerError(text2) {
|
|
@@ -24759,6 +24822,9 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
24759
24822
|
);
|
|
24760
24823
|
}
|
|
24761
24824
|
}
|
|
24825
|
+
if (spec.kind === "probe" && spec.collect === "step" && opts.includeContent && opts.collectStepMembers) {
|
|
24826
|
+
wire.members = await opts.collectStepMembers(record2, opts);
|
|
24827
|
+
}
|
|
24762
24828
|
if (spec.kind === "tar-upload") {
|
|
24763
24829
|
const st = await stat2(filePath).catch(() => null);
|
|
24764
24830
|
if (st) {
|
|
@@ -24885,14 +24951,14 @@ function printable(text2) {
|
|
|
24885
24951
|
(c2) => c2 < " " || c2 === "\x7F" ? `\\u${c2.charCodeAt(0).toString(16).padStart(4, "0")}` : c2
|
|
24886
24952
|
).join("");
|
|
24887
24953
|
}
|
|
24888
|
-
function
|
|
24954
|
+
function isResolvedAbsolute2(value) {
|
|
24889
24955
|
return typeof value === "string" && path5.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
|
|
24890
24956
|
}
|
|
24891
24957
|
function namesValidFlow(args) {
|
|
24892
24958
|
const { project_root, flow_path, name } = args;
|
|
24893
|
-
if (!
|
|
24959
|
+
if (!isResolvedAbsolute2(project_root)) return false;
|
|
24894
24960
|
if (name === void 0) {
|
|
24895
|
-
return
|
|
24961
|
+
return isResolvedAbsolute2(flow_path) && FLOW_FILE_NAME_PATTERN.test(path5.basename(flow_path));
|
|
24896
24962
|
}
|
|
24897
24963
|
return flow_path === void 0 && typeof name === "string" && FLOW_NAME_PATTERN.test(name);
|
|
24898
24964
|
}
|
|
@@ -24978,6 +25044,29 @@ async function readFlowMember(anchorDir, target, roots, budget, opts) {
|
|
|
24978
25044
|
const sent = await sendBytes(member, canonical, budget, opts);
|
|
24979
25045
|
return { ...sent, text: sent.bytes?.toString("utf8") };
|
|
24980
25046
|
}
|
|
25047
|
+
async function readToolMember(file2, roots, budget, opts) {
|
|
25048
|
+
const member = { role: "tool", key: file2, path: file2 };
|
|
25049
|
+
const refuse = (reason) => ({
|
|
25050
|
+
member: { ...member, state: "refused", error: reason },
|
|
25051
|
+
sent: `refused (${reason})`
|
|
25052
|
+
});
|
|
25053
|
+
const { canonical } = await landing(file2);
|
|
25054
|
+
if (!roots.some((root) => isWithin(canonical, root))) {
|
|
25055
|
+
return refuse(`${file2} is outside every root this client serves (${roots.join(", ")})`);
|
|
25056
|
+
}
|
|
25057
|
+
if (!hasToolFileExtension(canonical)) {
|
|
25058
|
+
return refuse(`${file2} links to a file that is not one of ${TOOL_FILE_EXTENSIONS.join(", ")}`);
|
|
25059
|
+
}
|
|
25060
|
+
const st = await stat3(canonical).catch((err) => err);
|
|
25061
|
+
if (st instanceof Error) {
|
|
25062
|
+
if (st.code === "ENOENT" || st.code === "ENOTDIR") {
|
|
25063
|
+
return { member: { ...member, state: "missing" }, sent: "missing" };
|
|
25064
|
+
}
|
|
25065
|
+
return refuse(st.message);
|
|
25066
|
+
}
|
|
25067
|
+
if (st.isDirectory()) return refuse("EISDIR: illegal operation on a directory, read");
|
|
25068
|
+
return sendBytes(member, canonical, budget, opts);
|
|
25069
|
+
}
|
|
24981
25070
|
function callPlatform(args) {
|
|
24982
25071
|
if (typeof args.device === "string" && args.device.startsWith("chromium-cdp-")) return "chromium";
|
|
24983
25072
|
if (typeof args.platform !== "string") return void 0;
|
|
@@ -25032,51 +25121,15 @@ async function sendBytes(member, real, budget, opts) {
|
|
|
25032
25121
|
bytes
|
|
25033
25122
|
};
|
|
25034
25123
|
}
|
|
25035
|
-
|
|
25036
|
-
|
|
25037
|
-
path5.dirname(canonical),
|
|
25038
|
-
"__baselines__",
|
|
25039
|
-
baselineKeyFor(canonical, flowName)
|
|
25040
|
-
);
|
|
25041
|
-
const real = (await landing(dir)).canonical;
|
|
25042
|
-
if (!roots.some((root) => isWithin(real, root))) return;
|
|
25043
|
-
const updates = args.updateBaselines === true;
|
|
25044
|
-
if (updates) opts.baselineDirs?.push(dir);
|
|
25045
|
-
const platform = callPlatform(args);
|
|
25046
|
-
const prefixes = snapshots.map(
|
|
25047
|
-
(name) => `${name}__${platform === void 0 ? "" : `${platform}-`}`
|
|
25048
|
-
);
|
|
25049
|
-
const names = await readdir4(dir).catch(() => []);
|
|
25050
|
-
for (const name of names.sort()) {
|
|
25051
|
-
if (!name.endsWith(".png")) continue;
|
|
25052
|
-
if (!updates && !prefixes.some((prefix) => name.startsWith(prefix))) continue;
|
|
25053
|
-
const file2 = path5.join(dir, name);
|
|
25054
|
-
const member = { role: "baseline", key: file2, path: file2 };
|
|
25055
|
-
const entry = await baselineEntry(file2, roots, updates);
|
|
25056
|
-
if (entry.state === "refused") {
|
|
25057
|
-
emit({ ...member, state: "refused", error: entry.error }, `refused (${entry.error})`);
|
|
25058
|
-
} else if (entry.state === "missing") {
|
|
25059
|
-
emit({ ...member, state: "missing" }, "missing");
|
|
25060
|
-
} else if (updates) {
|
|
25061
|
-
emit({ ...member, state: "listed" }, "listed");
|
|
25062
|
-
} else {
|
|
25063
|
-
const sent = await sendBytes(member, entry.real, budget, opts);
|
|
25064
|
-
emit(sent.member, sent.sent);
|
|
25065
|
-
}
|
|
25066
|
-
}
|
|
25124
|
+
function nestedRunUpdates(parentUpdates, args) {
|
|
25125
|
+
return args.updateBaselines === true || parentUpdates && args.updateBaselines === void 0;
|
|
25067
25126
|
}
|
|
25068
|
-
|
|
25069
|
-
if (!namesValidFlow(args)) return {};
|
|
25070
|
-
const canonical = await canonicalFlowPath(rootPath);
|
|
25071
|
-
const spelling = await classifyOnDiskSpelling(
|
|
25072
|
-
path5.dirname(rootPath),
|
|
25073
|
-
path5.basename(rootPath),
|
|
25074
|
-
FLOW_FILE_NAME_PATTERN
|
|
25075
|
-
);
|
|
25076
|
-
const roots = await closureRoots(rootPath, canonical, args.project_root);
|
|
25127
|
+
function memberCollector(roots, opts) {
|
|
25077
25128
|
const members = [];
|
|
25078
|
-
const
|
|
25079
|
-
const
|
|
25129
|
+
const flows = /* @__PURE__ */ new Map();
|
|
25130
|
+
const tools2 = /* @__PURE__ */ new Set();
|
|
25131
|
+
const runs = /* @__PURE__ */ new Set();
|
|
25132
|
+
const baselineDirs = /* @__PURE__ */ new Map();
|
|
25080
25133
|
const budget = { inline: 0 };
|
|
25081
25134
|
const logging = process.env[FLOW_FILES_LOG_ENV] === "1";
|
|
25082
25135
|
const log2 = opts.log ?? ((line) => void process.stderr.write(`${line}
|
|
@@ -25086,42 +25139,194 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
|
|
|
25086
25139
|
const subject = member.role === "flow" ? member.canonical : member.key;
|
|
25087
25140
|
if (logging) log2(printable(`[flow-files] ${member.role} ${subject}: ${sent}`));
|
|
25088
25141
|
};
|
|
25089
|
-
|
|
25090
|
-
|
|
25091
|
-
|
|
25092
|
-
|
|
25093
|
-
|
|
25094
|
-
}
|
|
25095
|
-
|
|
25096
|
-
|
|
25097
|
-
|
|
25098
|
-
|
|
25099
|
-
|
|
25100
|
-
|
|
25101
|
-
|
|
25102
|
-
|
|
25103
|
-
|
|
25104
|
-
|
|
25105
|
-
|
|
25106
|
-
|
|
25107
|
-
|
|
25142
|
+
async function flow2(anchorDir, target) {
|
|
25143
|
+
const key = flowMemberKey(anchorDir, target);
|
|
25144
|
+
const known = flows.get(key);
|
|
25145
|
+
if (known !== void 0) return known;
|
|
25146
|
+
const { member, text: text2, sent } = await readFlowMember(anchorDir, target, roots, budget, opts);
|
|
25147
|
+
const entry = { member, ...text2 === void 0 ? {} : { text: text2 } };
|
|
25148
|
+
flows.set(key, entry);
|
|
25149
|
+
emit(member, sent);
|
|
25150
|
+
return entry;
|
|
25151
|
+
}
|
|
25152
|
+
async function toolFiles(step) {
|
|
25153
|
+
if (step.tool === "flow-execute") return;
|
|
25154
|
+
for (const file2 of toolStepFiles(opts.toolFileInputs?.(step.tool), step.args)) {
|
|
25155
|
+
const { unwrapWhenSet } = file2.spec;
|
|
25156
|
+
if (unwrapWhenSet !== void 0 && step.args[unwrapWhenSet] !== void 0) continue;
|
|
25157
|
+
if (!isClientFileArgument(file2) || tools2.has(file2.path)) continue;
|
|
25158
|
+
tools2.add(file2.path);
|
|
25159
|
+
const read = await readToolMember(file2.path, roots, budget, opts);
|
|
25160
|
+
emit(read.member, read.sent);
|
|
25161
|
+
}
|
|
25162
|
+
}
|
|
25163
|
+
async function nestedRun(target, hop, updates, platform) {
|
|
25164
|
+
const { member, text: text2 } = await flow2(path5.dirname(target.path), `${target.name}.yaml`);
|
|
25165
|
+
if (text2 === void 0 || hop >= MAX_RUN_DEPTH) return void 0;
|
|
25166
|
+
return { canonical: member.canonical, text: text2, flowName: target.name, hop, updates, platform };
|
|
25167
|
+
}
|
|
25168
|
+
async function walk(start) {
|
|
25169
|
+
const queue = [...start];
|
|
25170
|
+
for (let run2 = queue.shift(); run2 !== void 0; run2 = queue.shift()) {
|
|
25171
|
+
const id = [run2.canonical, run2.flowName, run2.updates, run2.platform ?? ""].join("\0");
|
|
25172
|
+
if (runs.has(id)) continue;
|
|
25173
|
+
runs.add(id);
|
|
25174
|
+
const snapshots = /* @__PURE__ */ new Set();
|
|
25175
|
+
const visited = /* @__PURE__ */ new Set();
|
|
25176
|
+
const files = [{ canonical: run2.canonical, text: run2.text, hop: run2.hop }];
|
|
25177
|
+
for (let file2 = files.shift(); file2 !== void 0; file2 = files.shift()) {
|
|
25178
|
+
let doc;
|
|
25179
|
+
try {
|
|
25180
|
+
doc = (0, import_yaml.parse)(file2.text.trim(), { logLevel: "error" });
|
|
25181
|
+
} catch {
|
|
25182
|
+
continue;
|
|
25183
|
+
}
|
|
25184
|
+
const requests = collectFlowRequests(doc);
|
|
25185
|
+
for (const name of requests.snapshots) snapshots.add(name);
|
|
25186
|
+
for (const step of requests.toolSteps) await toolFiles(step);
|
|
25187
|
+
const anchorDir = path5.dirname(file2.canonical);
|
|
25188
|
+
for (const target of requests.runTargets) {
|
|
25189
|
+
const key = flowMemberKey(anchorDir, target);
|
|
25190
|
+
if (visited.has(key)) continue;
|
|
25191
|
+
visited.add(key);
|
|
25192
|
+
const { member, text: text2 } = await flow2(anchorDir, target);
|
|
25193
|
+
if (text2 !== void 0 && file2.hop + 1 < MAX_RUN_DEPTH) {
|
|
25194
|
+
files.push({ canonical: member.canonical, text: text2, hop: file2.hop + 1 });
|
|
25195
|
+
}
|
|
25196
|
+
}
|
|
25197
|
+
for (const { target, args } of requests.nested) {
|
|
25198
|
+
if (target.kind !== "name") continue;
|
|
25199
|
+
const next = await nestedRun(
|
|
25200
|
+
target,
|
|
25201
|
+
file2.hop + 1,
|
|
25202
|
+
nestedRunUpdates(run2.updates, args),
|
|
25203
|
+
run2.platform
|
|
25204
|
+
);
|
|
25205
|
+
if (next !== void 0) queue.push(next);
|
|
25206
|
+
}
|
|
25207
|
+
}
|
|
25208
|
+
if (snapshots.size === 0) continue;
|
|
25209
|
+
const dir = path5.join(
|
|
25210
|
+
path5.dirname(run2.canonical),
|
|
25211
|
+
"__baselines__",
|
|
25212
|
+
baselineKeyFor(run2.canonical, run2.flowName)
|
|
25213
|
+
);
|
|
25214
|
+
const entry = baselineDirs.get(dir) ?? { prefixes: /* @__PURE__ */ new Set(), updates: false };
|
|
25215
|
+
baselineDirs.set(dir, entry);
|
|
25216
|
+
if (run2.updates) {
|
|
25217
|
+
entry.updates = true;
|
|
25218
|
+
} else {
|
|
25219
|
+
const platform = run2.platform === void 0 ? "" : `${run2.platform}-`;
|
|
25220
|
+
for (const name of snapshots) entry.prefixes.add(`${name}__${platform}`);
|
|
25221
|
+
}
|
|
25222
|
+
}
|
|
25223
|
+
}
|
|
25224
|
+
async function sendBaselines() {
|
|
25225
|
+
for (const [dir, { prefixes, updates }] of baselineDirs) {
|
|
25226
|
+
const real = (await landing(dir)).canonical;
|
|
25227
|
+
if (!roots.some((root) => isWithin(real, root))) continue;
|
|
25228
|
+
if (updates) opts.baselineDirs?.push(dir);
|
|
25229
|
+
const names = await readdir4(dir).catch(() => []);
|
|
25230
|
+
for (const name of names.sort()) {
|
|
25231
|
+
if (!name.endsWith(".png")) continue;
|
|
25232
|
+
const compared = [...prefixes].some((prefix) => name.startsWith(prefix));
|
|
25233
|
+
if (!updates && !compared) continue;
|
|
25234
|
+
const file2 = path5.join(dir, name);
|
|
25235
|
+
if (tools2.has(file2)) continue;
|
|
25236
|
+
const member = { role: "baseline", key: file2, path: file2 };
|
|
25237
|
+
const entry = await baselineEntry(file2, roots, updates && !compared);
|
|
25238
|
+
if (entry.state === "refused") {
|
|
25239
|
+
emit({ ...member, state: "refused", error: entry.error }, `refused (${entry.error})`);
|
|
25240
|
+
} else if (entry.state === "missing") {
|
|
25241
|
+
emit({ ...member, state: "missing" }, "missing");
|
|
25242
|
+
} else if (!compared) {
|
|
25243
|
+
emit({ ...member, state: "listed" }, "listed");
|
|
25244
|
+
} else {
|
|
25245
|
+
const sent = await sendBytes(member, entry.real, budget, opts);
|
|
25246
|
+
emit(sent.member, sent.sent);
|
|
25247
|
+
}
|
|
25108
25248
|
}
|
|
25109
25249
|
}
|
|
25110
25250
|
}
|
|
25111
|
-
|
|
25112
|
-
|
|
25113
|
-
|
|
25251
|
+
return { members, flow: flow2, toolFiles, nestedRun, walk, sendBaselines };
|
|
25252
|
+
}
|
|
25253
|
+
async function collectFlowMembers(rootPath, rootBytes, args, opts) {
|
|
25254
|
+
if (!namesValidFlow(args)) return {};
|
|
25255
|
+
const canonical = await canonicalFlowPath(rootPath);
|
|
25256
|
+
const spelling = await classifyOnDiskSpelling(
|
|
25257
|
+
path5.dirname(rootPath),
|
|
25258
|
+
path5.basename(rootPath),
|
|
25259
|
+
FLOW_FILE_NAME_PATTERN
|
|
25260
|
+
);
|
|
25261
|
+
const collector = memberCollector(
|
|
25262
|
+
await closureRoots(rootPath, canonical, args.project_root),
|
|
25263
|
+
opts
|
|
25264
|
+
);
|
|
25265
|
+
await collector.walk([
|
|
25266
|
+
{
|
|
25114
25267
|
canonical,
|
|
25115
|
-
|
|
25116
|
-
|
|
25117
|
-
|
|
25118
|
-
|
|
25119
|
-
|
|
25120
|
-
|
|
25121
|
-
|
|
25122
|
-
|
|
25268
|
+
text: rootBytes.toString("utf8"),
|
|
25269
|
+
flowName: path5.basename(rootPath, ".yaml"),
|
|
25270
|
+
hop: 0,
|
|
25271
|
+
updates: args.updateBaselines === true,
|
|
25272
|
+
platform: callPlatform(args)
|
|
25273
|
+
}
|
|
25274
|
+
]);
|
|
25275
|
+
await collector.sendBaselines();
|
|
25276
|
+
return { canonical, spelling, members: collector.members };
|
|
25277
|
+
}
|
|
25278
|
+
function recordedStep(args) {
|
|
25279
|
+
const { command, args: text2 } = args;
|
|
25280
|
+
if (typeof command !== "string") return void 0;
|
|
25281
|
+
if (text2 === void 0) return { tool: command, args: {} };
|
|
25282
|
+
if (typeof text2 !== "string") return void 0;
|
|
25283
|
+
let parsed;
|
|
25284
|
+
try {
|
|
25285
|
+
parsed = JSON.parse(text2);
|
|
25286
|
+
} catch {
|
|
25287
|
+
return void 0;
|
|
25123
25288
|
}
|
|
25124
|
-
|
|
25289
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
|
|
25290
|
+
return { tool: command, args: parsed };
|
|
25291
|
+
}
|
|
25292
|
+
async function collectStepMembers(args, opts) {
|
|
25293
|
+
const { name, project_root: projectRoot } = args;
|
|
25294
|
+
const step = recordedStep(args);
|
|
25295
|
+
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || typeof projectRoot !== "string" || !path5.isAbsolute(projectRoot) || step === void 0) {
|
|
25296
|
+
return [];
|
|
25297
|
+
}
|
|
25298
|
+
const recording = path5.join(projectRoot, ".argent", "flows", `${name}.yaml`);
|
|
25299
|
+
const collector = memberCollector(
|
|
25300
|
+
await closureRoots(recording, (await landing(recording)).canonical, projectRoot),
|
|
25301
|
+
opts
|
|
25302
|
+
);
|
|
25303
|
+
await collector.toolFiles(step);
|
|
25304
|
+
if (step.tool === "flow-execute") {
|
|
25305
|
+
const self2 = await collector.flow(path5.dirname(recording), path5.basename(recording));
|
|
25306
|
+
let runArgs = step.args;
|
|
25307
|
+
const named = nestedFlowTarget(runArgs);
|
|
25308
|
+
if (named?.kind === "flow_path") {
|
|
25309
|
+
const stem = path5.basename(named.path, ".yaml");
|
|
25310
|
+
if (path5.resolve(path5.dirname(named.path)) === path5.resolve(path5.dirname(recording))) {
|
|
25311
|
+
await collector.flow(path5.dirname(recording), path5.basename(named.path));
|
|
25312
|
+
runArgs = { ...runArgs, name: stem };
|
|
25313
|
+
delete runArgs.flow_path;
|
|
25314
|
+
}
|
|
25315
|
+
}
|
|
25316
|
+
const target = nestedFlowTarget(runArgs);
|
|
25317
|
+
if (target?.kind === "name") {
|
|
25318
|
+
await collector.flow(path5.dirname(self2.member.canonical), `${target.name}.yaml`);
|
|
25319
|
+
const run2 = await collector.nestedRun(
|
|
25320
|
+
target,
|
|
25321
|
+
0,
|
|
25322
|
+
runArgs.updateBaselines === true,
|
|
25323
|
+
callPlatform(runArgs)
|
|
25324
|
+
);
|
|
25325
|
+
if (run2 !== void 0) await collector.walk([run2]);
|
|
25326
|
+
}
|
|
25327
|
+
}
|
|
25328
|
+
await collector.sendBaselines();
|
|
25329
|
+
return collector.members;
|
|
25125
25330
|
}
|
|
25126
25331
|
|
|
25127
25332
|
// ../argent-tools-client/src/tools-client.ts
|
|
@@ -25282,7 +25487,8 @@ function createToolsClient(options = {}) {
|
|
|
25282
25487
|
opts?.signal?.throwIfAborted();
|
|
25283
25488
|
const { url: url2, token, remote } = await route();
|
|
25284
25489
|
let finalArgs = args;
|
|
25285
|
-
const
|
|
25490
|
+
const tools2 = await fetchTools({ signal: opts?.signal });
|
|
25491
|
+
const meta3 = tools2.find((t2) => t2.name === name) ?? null;
|
|
25286
25492
|
const baselineDirs = [];
|
|
25287
25493
|
if (meta3?.fileInputs?.length) {
|
|
25288
25494
|
if (remote) assertRequiredPresent(meta3, args);
|
|
@@ -25292,6 +25498,8 @@ function createToolsClient(options = {}) {
|
|
|
25292
25498
|
log: diagnose,
|
|
25293
25499
|
baselineDirs,
|
|
25294
25500
|
collectMembers: collectFlowMembers,
|
|
25501
|
+
collectStepMembers,
|
|
25502
|
+
toolFileInputs: (tool) => tools2.find((t2) => t2.name === tool)?.fileInputs,
|
|
25295
25503
|
signal: opts?.signal
|
|
25296
25504
|
});
|
|
25297
25505
|
}
|
|
@@ -25301,7 +25509,11 @@ function createToolsClient(options = {}) {
|
|
|
25301
25509
|
diagnose(`The baseline ${file2} was not written on this client: ${error52}`);
|
|
25302
25510
|
}
|
|
25303
25511
|
if (process.env.ARGENT_FLOW_FILES_LOG === "1") {
|
|
25304
|
-
for (const file2 of applied.written)
|
|
25512
|
+
for (const file2 of applied.written) {
|
|
25513
|
+
if (baselineDirs.includes(path6.dirname(file2))) {
|
|
25514
|
+
diagnose(`[flow-files] baseline ${file2}: written`);
|
|
25515
|
+
}
|
|
25516
|
+
}
|
|
25305
25517
|
}
|
|
25306
25518
|
return applied.result;
|
|
25307
25519
|
};
|
|
@@ -25313,6 +25525,9 @@ function createToolsClient(options = {}) {
|
|
|
25313
25525
|
method: "POST",
|
|
25314
25526
|
headers: {
|
|
25315
25527
|
"Content-Type": "application/json",
|
|
25528
|
+
// Tells the tool-server the call came over a link, a link to
|
|
25529
|
+
// 127.0.0.1 included, which nothing else in the request shows.
|
|
25530
|
+
...remote ? { [LINKED_CALL_HEADER]: "1" } : {},
|
|
25316
25531
|
// A proxy that compresses the stream holds each line until its buffer
|
|
25317
25532
|
// fills. `identity` keeps the stream uncompressed end to end.
|
|
25318
25533
|
...stream ? { "Accept": "application/x-ndjson", "Accept-Encoding": "identity" } : {},
|
|
@@ -25373,12 +25588,12 @@ function createToolsClient(options = {}) {
|
|
|
25373
25588
|
import { copyFile, mkdir as mkdir4, readFile as readFile5, realpath as realpath4, rm as rm3, stat as stat4, writeFile as writeFile4 } from "node:fs/promises";
|
|
25374
25589
|
import { constants as fsConstants } from "node:fs";
|
|
25375
25590
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
25376
|
-
import { basename as basename6, dirname as
|
|
25591
|
+
import { basename as basename6, dirname as dirname8, extname as extname2, isAbsolute as isAbsolute6, join as join11, normalize as normalize2, resolve as resolve7, sep as sep4 } from "node:path";
|
|
25377
25592
|
import { createHash as createHash3 } from "node:crypto";
|
|
25378
25593
|
|
|
25379
25594
|
// ../configuration-core/src/flags.ts
|
|
25380
25595
|
import * as fs3 from "node:fs";
|
|
25381
|
-
import * as
|
|
25596
|
+
import * as path7 from "node:path";
|
|
25382
25597
|
import { homedir as homedir3 } from "node:os";
|
|
25383
25598
|
var FLAG_REGISTRY = [
|
|
25384
25599
|
{
|
|
@@ -25420,26 +25635,26 @@ function getFlagDefinition(name, registry2 = FLAG_REGISTRY) {
|
|
|
25420
25635
|
}
|
|
25421
25636
|
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
25422
25637
|
function findProjectRoot(startDir) {
|
|
25423
|
-
let current =
|
|
25638
|
+
let current = path7.resolve(startDir);
|
|
25424
25639
|
while (true) {
|
|
25425
25640
|
for (const marker of PROJECT_MARKERS) {
|
|
25426
|
-
if (fs3.existsSync(
|
|
25641
|
+
if (fs3.existsSync(path7.join(current, marker))) return current;
|
|
25427
25642
|
}
|
|
25428
|
-
const parent =
|
|
25643
|
+
const parent = path7.dirname(current);
|
|
25429
25644
|
if (parent === current) return null;
|
|
25430
25645
|
current = parent;
|
|
25431
25646
|
}
|
|
25432
25647
|
}
|
|
25433
25648
|
function resolveProjectRoot(startDir) {
|
|
25434
|
-
return findProjectRoot(startDir) ??
|
|
25649
|
+
return findProjectRoot(startDir) ?? path7.resolve(startDir);
|
|
25435
25650
|
}
|
|
25436
25651
|
function getFlagsPath(scope, options = {}) {
|
|
25437
25652
|
const home = options.homeDir ?? homedir3();
|
|
25438
25653
|
if (scope === "global") {
|
|
25439
|
-
return
|
|
25654
|
+
return path7.join(home, ".argent", "flags.json");
|
|
25440
25655
|
}
|
|
25441
25656
|
const cwd = options.cwd ?? process.cwd();
|
|
25442
|
-
return
|
|
25657
|
+
return path7.join(resolveProjectRoot(cwd), ".argent", "flags.json");
|
|
25443
25658
|
}
|
|
25444
25659
|
function readFlagsFile(filePath) {
|
|
25445
25660
|
let raw;
|
|
@@ -25466,7 +25681,7 @@ function readFlagsFile(filePath) {
|
|
|
25466
25681
|
function writeFlagsFile(filePath, flags2) {
|
|
25467
25682
|
if (Object.keys(flags2).length === 0) {
|
|
25468
25683
|
if (fs3.existsSync(filePath)) fs3.rmSync(filePath, { force: true });
|
|
25469
|
-
const parent =
|
|
25684
|
+
const parent = path7.dirname(filePath);
|
|
25470
25685
|
try {
|
|
25471
25686
|
if (fs3.existsSync(parent) && fs3.readdirSync(parent).length === 0) {
|
|
25472
25687
|
fs3.rmdirSync(parent);
|
|
@@ -25475,7 +25690,7 @@ function writeFlagsFile(filePath, flags2) {
|
|
|
25475
25690
|
}
|
|
25476
25691
|
return;
|
|
25477
25692
|
}
|
|
25478
|
-
fs3.mkdirSync(
|
|
25693
|
+
fs3.mkdirSync(path7.dirname(filePath), { recursive: true });
|
|
25479
25694
|
const tmp = `${filePath}.${process.pid}.tmp`;
|
|
25480
25695
|
fs3.writeFileSync(tmp, JSON.stringify({ flags: flags2 }, null, 2) + "\n");
|
|
25481
25696
|
fs3.renameSync(tmp, filePath);
|
|
@@ -25507,7 +25722,7 @@ function isFlagEnabled(name, options = {}) {
|
|
|
25507
25722
|
|
|
25508
25723
|
// ../configuration-core/src/paths.ts
|
|
25509
25724
|
import * as os from "node:os";
|
|
25510
|
-
import * as
|
|
25725
|
+
import * as path8 from "node:path";
|
|
25511
25726
|
function nonEmpty(value) {
|
|
25512
25727
|
if (value == void 0) return null;
|
|
25513
25728
|
const trimmed = value.trim();
|
|
@@ -25518,23 +25733,23 @@ function resolveHomeDir(options = {}) {
|
|
|
25518
25733
|
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
25519
25734
|
}
|
|
25520
25735
|
function argentHomeDir() {
|
|
25521
|
-
return
|
|
25736
|
+
return path8.join(resolveHomeDir(), ".argent");
|
|
25522
25737
|
}
|
|
25523
25738
|
function configDir(scope = "global", options = {}) {
|
|
25524
25739
|
if (scope === "global") {
|
|
25525
|
-
return
|
|
25740
|
+
return path8.join(resolveHomeDir(options), ".argent");
|
|
25526
25741
|
}
|
|
25527
25742
|
const cwd = options.cwd ?? process.cwd();
|
|
25528
|
-
return
|
|
25743
|
+
return path8.join(resolveProjectRoot(cwd), ".argent");
|
|
25529
25744
|
}
|
|
25530
25745
|
function configFilePath(scope = "global", options = {}) {
|
|
25531
|
-
return
|
|
25746
|
+
return path8.join(configDir(scope, options), "config.json");
|
|
25532
25747
|
}
|
|
25533
25748
|
|
|
25534
25749
|
// ../configuration-core/src/config.ts
|
|
25535
25750
|
import * as crypto from "node:crypto";
|
|
25536
25751
|
import * as fs4 from "node:fs";
|
|
25537
|
-
import * as
|
|
25752
|
+
import * as path9 from "node:path";
|
|
25538
25753
|
function readConfigObject(scope = "global", options = {}) {
|
|
25539
25754
|
try {
|
|
25540
25755
|
const raw = fs4.readFileSync(configFilePath(scope, options), "utf8");
|
|
@@ -25652,7 +25867,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
25652
25867
|
try {
|
|
25653
25868
|
const next = readConfigObject(scope, options);
|
|
25654
25869
|
mutate(next);
|
|
25655
|
-
const tmpPath =
|
|
25870
|
+
const tmpPath = path9.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
25656
25871
|
const fd = fs4.openSync(tmpPath, "wx", 384);
|
|
25657
25872
|
try {
|
|
25658
25873
|
fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
@@ -25677,7 +25892,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
25677
25892
|
// ../configuration-core/src/secrets.ts
|
|
25678
25893
|
var import_dotenv = __toESM(require_main(), 1);
|
|
25679
25894
|
import * as fs5 from "node:fs";
|
|
25680
|
-
import * as
|
|
25895
|
+
import * as path10 from "node:path";
|
|
25681
25896
|
var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
|
|
25682
25897
|
var SECRETS_FILE_NAME = "secrets.env";
|
|
25683
25898
|
var SHARED_ENV_FILES = [".env.local", ".env"];
|
|
@@ -25739,20 +25954,20 @@ function secretSources(options = {}) {
|
|
|
25739
25954
|
const filePaths = [];
|
|
25740
25955
|
if (projectRoot) {
|
|
25741
25956
|
filePaths.push({
|
|
25742
|
-
path:
|
|
25957
|
+
path: path10.join(projectRoot, ".argent", SECRETS_FILE_NAME),
|
|
25743
25958
|
exposure: "dedicated"
|
|
25744
25959
|
});
|
|
25745
25960
|
for (const name of SHARED_ENV_FILES) {
|
|
25746
|
-
filePaths.push({ path:
|
|
25961
|
+
filePaths.push({ path: path10.join(projectRoot, name), exposure: "shared" });
|
|
25747
25962
|
}
|
|
25748
25963
|
}
|
|
25749
25964
|
filePaths.push({
|
|
25750
|
-
path:
|
|
25965
|
+
path: path10.join(resolveHomeDir(options), ".argent", SECRETS_FILE_NAME),
|
|
25751
25966
|
exposure: "dedicated"
|
|
25752
25967
|
});
|
|
25753
25968
|
const seen = /* @__PURE__ */ new Set();
|
|
25754
25969
|
for (const entry of filePaths) {
|
|
25755
|
-
const resolved =
|
|
25970
|
+
const resolved = path10.resolve(entry.path);
|
|
25756
25971
|
if (seen.has(resolved)) continue;
|
|
25757
25972
|
seen.add(resolved);
|
|
25758
25973
|
sources.push(fileSource(resolved, entry.exposure));
|
|
@@ -25817,7 +26032,7 @@ function applyMergePolicy(policy, local, global2) {
|
|
|
25817
26032
|
}
|
|
25818
26033
|
|
|
25819
26034
|
// ../configuration-core/src/config-schema.ts
|
|
25820
|
-
import { isAbsolute as
|
|
26035
|
+
import { isAbsolute as isAbsolute5 } from "node:path";
|
|
25821
26036
|
function asBoolean(raw) {
|
|
25822
26037
|
return typeof raw === "boolean" ? raw : void 0;
|
|
25823
26038
|
}
|
|
@@ -25899,7 +26114,7 @@ var CONFIG_SCHEMA = [
|
|
|
25899
26114
|
scopes: ["project", "global"],
|
|
25900
26115
|
parse: (raw) => {
|
|
25901
26116
|
const value = asString(raw);
|
|
25902
|
-
return value !== void 0 && (value === "~" || value.startsWith("~/") ||
|
|
26117
|
+
return value !== void 0 && (value === "~" || value.startsWith("~/") || isAbsolute5(value)) ? value : void 0;
|
|
25903
26118
|
},
|
|
25904
26119
|
expected: "an absolute path, or one starting with `~/`",
|
|
25905
26120
|
merge: "prioritize-local",
|
|
@@ -25950,7 +26165,7 @@ function getConfigDefinition(key, registry2 = CONFIG_SCHEMA) {
|
|
|
25950
26165
|
}
|
|
25951
26166
|
|
|
25952
26167
|
// ../configuration-core/src/config-access.ts
|
|
25953
|
-
import * as
|
|
26168
|
+
import * as path11 from "node:path";
|
|
25954
26169
|
function readScopeValue(def, scope, options) {
|
|
25955
26170
|
if (!def.scopes.includes(scope)) return void 0;
|
|
25956
26171
|
const raw = getAtPath(readConfigObject(scope, options), def.key);
|
|
@@ -26110,7 +26325,7 @@ function artifactDir(deviceId) {
|
|
|
26110
26325
|
}
|
|
26111
26326
|
function durableBaseDir() {
|
|
26112
26327
|
const projectRoot = findProjectRoot(process.cwd());
|
|
26113
|
-
return projectRoot ??
|
|
26328
|
+
return projectRoot ?? dirname8(argentHomeDir());
|
|
26114
26329
|
}
|
|
26115
26330
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
|
|
26116
26331
|
var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
|
|
@@ -26124,9 +26339,9 @@ function configuredRecordingsDir() {
|
|
|
26124
26339
|
if (typeof value !== "string") return null;
|
|
26125
26340
|
const trimmed = value.trim();
|
|
26126
26341
|
if (trimmed === "") return null;
|
|
26127
|
-
const home =
|
|
26342
|
+
const home = dirname8(argentHomeDir());
|
|
26128
26343
|
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep4}`) ? join11(home, trimmed.slice(2)) : trimmed;
|
|
26129
|
-
return
|
|
26344
|
+
return resolve7(durableBaseDir(), expanded);
|
|
26130
26345
|
}
|
|
26131
26346
|
var MAX_DURABLE_BYTES = 2 * 1024 * 1024 * 1024;
|
|
26132
26347
|
async function readCapped(res, cap) {
|
|
@@ -26159,10 +26374,10 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
26159
26374
|
const stem = filename.slice(0, filename.length - ext.length);
|
|
26160
26375
|
for (let i2 = 1; i2 <= 1e3; i2++) {
|
|
26161
26376
|
const candidate = i2 === 1 ? filename : `${stem} (${i2})${ext}`;
|
|
26162
|
-
const
|
|
26377
|
+
const path24 = join11(dir, candidate);
|
|
26163
26378
|
try {
|
|
26164
|
-
await write(
|
|
26165
|
-
return
|
|
26379
|
+
await write(path24);
|
|
26380
|
+
return path24;
|
|
26166
26381
|
} catch (err) {
|
|
26167
26382
|
if (err?.code === "EEXIST") continue;
|
|
26168
26383
|
throw err;
|
|
@@ -26173,7 +26388,7 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
26173
26388
|
function durableSaveTarget(handle) {
|
|
26174
26389
|
if (typeof handle.saveDir !== "string" || !handle.saveDir || handle.archive) return null;
|
|
26175
26390
|
const rel = normalize2(handle.saveDir);
|
|
26176
|
-
if (
|
|
26391
|
+
if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${sep4}`) || rel.split(sep4).includes("..")) {
|
|
26177
26392
|
return null;
|
|
26178
26393
|
}
|
|
26179
26394
|
if (!ALLOWED_SAVE_DIRS.has(rel)) return null;
|
|
@@ -26768,8 +26983,8 @@ var Deferred = class {
|
|
|
26768
26983
|
_resolve;
|
|
26769
26984
|
_reject;
|
|
26770
26985
|
constructor() {
|
|
26771
|
-
this._promise = new Promise((
|
|
26772
|
-
this._resolve =
|
|
26986
|
+
this._promise = new Promise((resolve12, reject) => {
|
|
26987
|
+
this._resolve = resolve12;
|
|
26773
26988
|
this._reject = reject;
|
|
26774
26989
|
});
|
|
26775
26990
|
}
|
|
@@ -27662,8 +27877,8 @@ var ExportOperation = class {
|
|
|
27662
27877
|
_metrics;
|
|
27663
27878
|
_exportScheduledResolve;
|
|
27664
27879
|
constructor(exporter, logRecords, exportTimeoutMillis, metrics) {
|
|
27665
|
-
this._exportScheduledPromise = new Promise((
|
|
27666
|
-
this._exportScheduledResolve =
|
|
27880
|
+
this._exportScheduledPromise = new Promise((resolve12) => {
|
|
27881
|
+
this._exportScheduledResolve = resolve12;
|
|
27667
27882
|
});
|
|
27668
27883
|
this._exportCompleted = this._executeExport(exporter, logRecords, exportTimeoutMillis);
|
|
27669
27884
|
this._metrics = metrics;
|
|
@@ -27688,7 +27903,7 @@ var ExportOperation = class {
|
|
|
27688
27903
|
}
|
|
27689
27904
|
}
|
|
27690
27905
|
async _exportWithTimeout(exporter, logRecords, exportTimeoutMillis) {
|
|
27691
|
-
return new Promise((
|
|
27906
|
+
return new Promise((resolve12, reject) => {
|
|
27692
27907
|
const timer = setTimeout(() => {
|
|
27693
27908
|
reject(new Error("Timeout"));
|
|
27694
27909
|
}, exportTimeoutMillis);
|
|
@@ -27696,7 +27911,7 @@ var ExportOperation = class {
|
|
|
27696
27911
|
this._metrics.finishLogs(logRecords.length, result.error);
|
|
27697
27912
|
clearTimeout(timer);
|
|
27698
27913
|
if (result.code === ExportResultCode.SUCCESS) {
|
|
27699
|
-
|
|
27914
|
+
resolve12();
|
|
27700
27915
|
} else {
|
|
27701
27916
|
reject(result.error ?? new Error("BatchLogRecordProcessor: log record export failed"));
|
|
27702
27917
|
}
|
|
@@ -28477,7 +28692,7 @@ function parseRetryAfterToMills(retryAfter) {
|
|
|
28477
28692
|
var DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${VERSION4}`;
|
|
28478
28693
|
var MAX_RESPONSE_BODY_SIZE = 4 * 1024 * 1024;
|
|
28479
28694
|
function sendWithHttp(request, url2, headers, compression, userAgent, agent, data, timeoutMillis) {
|
|
28480
|
-
return new Promise((
|
|
28695
|
+
return new Promise((resolve12) => {
|
|
28481
28696
|
const parsedUrl = new URL(url2);
|
|
28482
28697
|
if (userAgent) {
|
|
28483
28698
|
headers["User-Agent"] = `${userAgent} ${DEFAULT_USER_AGENT}`;
|
|
@@ -28496,7 +28711,7 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
|
|
|
28496
28711
|
responseSize += chunk.length;
|
|
28497
28712
|
if (responseSize > MAX_RESPONSE_BODY_SIZE) {
|
|
28498
28713
|
const sizeError = new Error(`OTLP export response body exceeded size limit of ${MAX_RESPONSE_BODY_SIZE} bytes`);
|
|
28499
|
-
|
|
28714
|
+
resolve12({ status: "failure", error: sizeError });
|
|
28500
28715
|
res.destroy();
|
|
28501
28716
|
return;
|
|
28502
28717
|
}
|
|
@@ -28504,18 +28719,18 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
|
|
|
28504
28719
|
});
|
|
28505
28720
|
res.on("end", () => {
|
|
28506
28721
|
if (res.statusCode && res.statusCode <= 299) {
|
|
28507
|
-
|
|
28722
|
+
resolve12({
|
|
28508
28723
|
status: "success",
|
|
28509
28724
|
data: Buffer.concat(responseData)
|
|
28510
28725
|
});
|
|
28511
28726
|
} else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
|
|
28512
|
-
|
|
28727
|
+
resolve12({
|
|
28513
28728
|
status: "retryable",
|
|
28514
28729
|
retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
|
|
28515
28730
|
});
|
|
28516
28731
|
} else {
|
|
28517
28732
|
const error52 = new OTLPExporterError(res.statusMessage, res.statusCode, Buffer.concat(responseData).toString());
|
|
28518
|
-
|
|
28733
|
+
resolve12({
|
|
28519
28734
|
status: "failure",
|
|
28520
28735
|
error: error52
|
|
28521
28736
|
});
|
|
@@ -28523,17 +28738,17 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
|
|
|
28523
28738
|
});
|
|
28524
28739
|
res.on("error", (error52) => {
|
|
28525
28740
|
if (res.statusCode && res.statusCode <= 299) {
|
|
28526
|
-
|
|
28741
|
+
resolve12({
|
|
28527
28742
|
status: "success"
|
|
28528
28743
|
});
|
|
28529
28744
|
} else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
|
|
28530
|
-
|
|
28745
|
+
resolve12({
|
|
28531
28746
|
status: "retryable",
|
|
28532
28747
|
error: error52,
|
|
28533
28748
|
retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
|
|
28534
28749
|
});
|
|
28535
28750
|
} else {
|
|
28536
|
-
|
|
28751
|
+
resolve12({
|
|
28537
28752
|
status: "failure",
|
|
28538
28753
|
error: error52
|
|
28539
28754
|
});
|
|
@@ -28542,26 +28757,26 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
|
|
|
28542
28757
|
});
|
|
28543
28758
|
req.setTimeout(timeoutMillis, () => {
|
|
28544
28759
|
req.destroy();
|
|
28545
|
-
|
|
28760
|
+
resolve12({
|
|
28546
28761
|
status: "retryable",
|
|
28547
28762
|
error: new Error("Request timed out")
|
|
28548
28763
|
});
|
|
28549
28764
|
});
|
|
28550
28765
|
req.on("error", (error52) => {
|
|
28551
28766
|
if (isHttpTransportNetworkErrorRetryable(error52)) {
|
|
28552
|
-
|
|
28767
|
+
resolve12({
|
|
28553
28768
|
status: "retryable",
|
|
28554
28769
|
error: error52
|
|
28555
28770
|
});
|
|
28556
28771
|
} else {
|
|
28557
|
-
|
|
28772
|
+
resolve12({
|
|
28558
28773
|
status: "failure",
|
|
28559
28774
|
error: error52
|
|
28560
28775
|
});
|
|
28561
28776
|
}
|
|
28562
28777
|
});
|
|
28563
28778
|
compressAndSend(req, compression, data, (error52) => {
|
|
28564
|
-
|
|
28779
|
+
resolve12({
|
|
28565
28780
|
status: "failure",
|
|
28566
28781
|
error: error52
|
|
28567
28782
|
});
|
|
@@ -28651,9 +28866,9 @@ var RetryingTransport = class {
|
|
|
28651
28866
|
this._transport = transport;
|
|
28652
28867
|
}
|
|
28653
28868
|
retry(data, timeoutMillis, inMillis) {
|
|
28654
|
-
return new Promise((
|
|
28869
|
+
return new Promise((resolve12, reject) => {
|
|
28655
28870
|
setTimeout(() => {
|
|
28656
|
-
this._transport.send(data, timeoutMillis).then(
|
|
28871
|
+
this._transport.send(data, timeoutMillis).then(resolve12, reject);
|
|
28657
28872
|
}, inMillis);
|
|
28658
28873
|
});
|
|
28659
28874
|
}
|
|
@@ -28767,7 +28982,7 @@ init_esm();
|
|
|
28767
28982
|
|
|
28768
28983
|
// ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-node-http-env-configuration.js
|
|
28769
28984
|
import * as fs6 from "fs";
|
|
28770
|
-
import * as
|
|
28985
|
+
import * as path12 from "path";
|
|
28771
28986
|
init_esm();
|
|
28772
28987
|
function getStaticHeadersFromEnv(signalIdentifier) {
|
|
28773
28988
|
const signalSpecificRawHeaders = getStringFromEnv(`OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`);
|
|
@@ -28788,7 +29003,7 @@ function appendRootPathToUrlIfNeeded(url2) {
|
|
|
28788
29003
|
return void 0;
|
|
28789
29004
|
}
|
|
28790
29005
|
}
|
|
28791
|
-
function appendResourcePathToUrl(url2,
|
|
29006
|
+
function appendResourcePathToUrl(url2, path24) {
|
|
28792
29007
|
try {
|
|
28793
29008
|
new URL(url2);
|
|
28794
29009
|
} catch {
|
|
@@ -28798,11 +29013,11 @@ function appendResourcePathToUrl(url2, path23) {
|
|
|
28798
29013
|
if (!url2.endsWith("/")) {
|
|
28799
29014
|
url2 = url2 + "/";
|
|
28800
29015
|
}
|
|
28801
|
-
url2 +=
|
|
29016
|
+
url2 += path24;
|
|
28802
29017
|
try {
|
|
28803
29018
|
new URL(url2);
|
|
28804
29019
|
} catch {
|
|
28805
|
-
diag2.warn(`Configuration: Provided URL appended with '${
|
|
29020
|
+
diag2.warn(`Configuration: Provided URL appended with '${path24}' is not a valid URL, using 'undefined' instead of '${url2}'`);
|
|
28806
29021
|
return void 0;
|
|
28807
29022
|
}
|
|
28808
29023
|
return url2;
|
|
@@ -28827,7 +29042,7 @@ function readFileFromEnv(signalSpecificEnvVar, nonSignalSpecificEnvVar, warningM
|
|
|
28827
29042
|
const filePath = signalSpecificPath ?? nonSignalSpecificPath;
|
|
28828
29043
|
if (filePath != null) {
|
|
28829
29044
|
try {
|
|
28830
|
-
return fs6.readFileSync(
|
|
29045
|
+
return fs6.readFileSync(path12.resolve(process.cwd(), filePath));
|
|
28831
29046
|
} catch {
|
|
28832
29047
|
diag2.warn(warningMessage);
|
|
28833
29048
|
return void 0;
|
|
@@ -28916,12 +29131,12 @@ init_esm();
|
|
|
28916
29131
|
import * as fs7 from "node:fs";
|
|
28917
29132
|
|
|
28918
29133
|
// ../telemetry/src/paths.ts
|
|
28919
|
-
import * as
|
|
29134
|
+
import * as path13 from "node:path";
|
|
28920
29135
|
function identityFilePath() {
|
|
28921
|
-
return
|
|
29136
|
+
return path13.join(argentHomeDir(), "telemetry-id");
|
|
28922
29137
|
}
|
|
28923
29138
|
function debugLogPath() {
|
|
28924
|
-
return
|
|
29139
|
+
return path13.join(argentHomeDir(), "telemetry-debug.log");
|
|
28925
29140
|
}
|
|
28926
29141
|
|
|
28927
29142
|
// ../telemetry/src/debug.ts
|
|
@@ -29454,9 +29669,9 @@ function isReplitAgent(env) {
|
|
|
29454
29669
|
}
|
|
29455
29670
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
29456
29671
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
29457
|
-
function safeExists(fileExists,
|
|
29672
|
+
function safeExists(fileExists, path24) {
|
|
29458
29673
|
try {
|
|
29459
|
-
return fileExists(
|
|
29674
|
+
return fileExists(path24);
|
|
29460
29675
|
} catch {
|
|
29461
29676
|
return false;
|
|
29462
29677
|
}
|
|
@@ -29877,7 +30092,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
29877
30092
|
var SESSION_ID2 = randomUUID5();
|
|
29878
30093
|
function readCliVersion() {
|
|
29879
30094
|
if (true) {
|
|
29880
|
-
return "0.27.1-next.
|
|
30095
|
+
return "0.27.1-next.23";
|
|
29881
30096
|
}
|
|
29882
30097
|
return "0.0.0";
|
|
29883
30098
|
}
|
|
@@ -29911,7 +30126,7 @@ function getBaseProps(runtime) {
|
|
|
29911
30126
|
// ../telemetry/src/identity.ts
|
|
29912
30127
|
import * as crypto2 from "node:crypto";
|
|
29913
30128
|
import * as fs8 from "node:fs";
|
|
29914
|
-
import * as
|
|
30129
|
+
import * as path14 from "node:path";
|
|
29915
30130
|
var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
|
|
29916
30131
|
var cached2 = null;
|
|
29917
30132
|
var fingerprintResolved = null;
|
|
@@ -30024,7 +30239,7 @@ function writeIdFileAtomic(finalPath, id) {
|
|
|
30024
30239
|
if (occupant && !occupant.isFile()) {
|
|
30025
30240
|
throw new Error("telemetry: refusing to replace a non-regular file at the identity path");
|
|
30026
30241
|
}
|
|
30027
|
-
const tmpPath =
|
|
30242
|
+
const tmpPath = path14.join(
|
|
30028
30243
|
argentHomeDir(),
|
|
30029
30244
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
30030
30245
|
);
|
|
@@ -30048,7 +30263,7 @@ function mintRandomId(finalPath) {
|
|
|
30048
30263
|
fs8.mkdirSync(argentHomeDir(), { recursive: true });
|
|
30049
30264
|
let value = crypto2.randomUUID();
|
|
30050
30265
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
30051
|
-
const tmpPath =
|
|
30266
|
+
const tmpPath = path14.join(
|
|
30052
30267
|
argentHomeDir(),
|
|
30053
30268
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
30054
30269
|
);
|
|
@@ -30093,7 +30308,7 @@ function mintRandomId(finalPath) {
|
|
|
30093
30308
|
throw new Error("telemetry: failed to create identity after retries");
|
|
30094
30309
|
}
|
|
30095
30310
|
function claimCorruptOccupant(finalPath) {
|
|
30096
|
-
const claimed =
|
|
30311
|
+
const claimed = path14.join(
|
|
30097
30312
|
argentHomeDir(),
|
|
30098
30313
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
30099
30314
|
);
|
|
@@ -30135,12 +30350,12 @@ function tryReadId(filePath) {
|
|
|
30135
30350
|
import { execFileSync as execFileSync2, spawn as spawn2 } from "node:child_process";
|
|
30136
30351
|
|
|
30137
30352
|
// ../native-devtools-ios/src/index.ts
|
|
30138
|
-
import * as
|
|
30353
|
+
import * as path15 from "node:path";
|
|
30139
30354
|
import * as fs9 from "node:fs";
|
|
30140
|
-
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ??
|
|
30141
|
-
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ??
|
|
30142
|
-
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ??
|
|
30143
|
-
var DYLIB_TVOS_DIR =
|
|
30355
|
+
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path15.join(__dirname, "..", "dylibs");
|
|
30356
|
+
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path15.join(__dirname, "..", "bin");
|
|
30357
|
+
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path15.join(DYLIB_DIR, "tcp");
|
|
30358
|
+
var DYLIB_TVOS_DIR = path15.join(DYLIB_DIR, "tvos");
|
|
30144
30359
|
function hostPlatformKey() {
|
|
30145
30360
|
if (process.platform === "linux" && process.arch === "arm64") {
|
|
30146
30361
|
return "linux-arm64";
|
|
@@ -30151,13 +30366,13 @@ function simulatorServerBinaryName() {
|
|
|
30151
30366
|
return process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
|
|
30152
30367
|
}
|
|
30153
30368
|
function platformBinDir() {
|
|
30154
|
-
return
|
|
30369
|
+
return path15.join(BIN_DIR, hostPlatformKey());
|
|
30155
30370
|
}
|
|
30156
30371
|
function simulatorServerBinaryPath() {
|
|
30157
30372
|
const binaryName = simulatorServerBinaryName();
|
|
30158
|
-
const p =
|
|
30373
|
+
const p = path15.join(platformBinDir(), binaryName);
|
|
30159
30374
|
if (!fs9.existsSync(p)) {
|
|
30160
|
-
const flat =
|
|
30375
|
+
const flat = path15.join(BIN_DIR, binaryName);
|
|
30161
30376
|
const migrationHint = fs9.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.` : "";
|
|
30162
30377
|
throw new Error(
|
|
30163
30378
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
@@ -30187,12 +30402,12 @@ function resolveHostFingerprint() {
|
|
|
30187
30402
|
}
|
|
30188
30403
|
}
|
|
30189
30404
|
function resolveHostFingerprintAsync() {
|
|
30190
|
-
return new Promise((
|
|
30405
|
+
return new Promise((resolve12) => {
|
|
30191
30406
|
let binary;
|
|
30192
30407
|
try {
|
|
30193
30408
|
binary = simulatorServerBinaryPath();
|
|
30194
30409
|
} catch {
|
|
30195
|
-
|
|
30410
|
+
resolve12(null);
|
|
30196
30411
|
return;
|
|
30197
30412
|
}
|
|
30198
30413
|
let settled = false;
|
|
@@ -30205,7 +30420,7 @@ function resolveHostFingerprintAsync() {
|
|
|
30205
30420
|
child?.kill("SIGKILL");
|
|
30206
30421
|
} catch {
|
|
30207
30422
|
}
|
|
30208
|
-
|
|
30423
|
+
resolve12(value);
|
|
30209
30424
|
};
|
|
30210
30425
|
const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
|
|
30211
30426
|
watchdog.unref?.();
|
|
@@ -30419,7 +30634,7 @@ var DRAIN_GRACE_MS = 250;
|
|
|
30419
30634
|
async function raceDrain(client2, timeoutMs) {
|
|
30420
30635
|
await Promise.race([
|
|
30421
30636
|
client2.shutdown(timeoutMs),
|
|
30422
|
-
new Promise((
|
|
30637
|
+
new Promise((resolve12) => setTimeout(resolve12, timeoutMs + DRAIN_GRACE_MS).unref())
|
|
30423
30638
|
]);
|
|
30424
30639
|
}
|
|
30425
30640
|
async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
@@ -30843,13 +31058,13 @@ function splitOptions(argv) {
|
|
|
30843
31058
|
return { json: json2, outPath, argvForFlags: rest };
|
|
30844
31059
|
}
|
|
30845
31060
|
async function readStdin() {
|
|
30846
|
-
return new Promise((
|
|
31061
|
+
return new Promise((resolve12, reject) => {
|
|
30847
31062
|
let data = "";
|
|
30848
31063
|
process.stdin.setEncoding("utf8");
|
|
30849
31064
|
process.stdin.on("data", (chunk) => {
|
|
30850
31065
|
data += chunk;
|
|
30851
31066
|
});
|
|
30852
|
-
process.stdin.on("end", () =>
|
|
31067
|
+
process.stdin.on("end", () => resolve12(data));
|
|
30853
31068
|
process.stdin.on("error", reject);
|
|
30854
31069
|
});
|
|
30855
31070
|
}
|
|
@@ -30881,7 +31096,7 @@ async function fetchImageToFile(result, outPath) {
|
|
|
30881
31096
|
const res = await fetch(url2);
|
|
30882
31097
|
if (!res.ok) throw new Error(`Failed to download image: ${res.status} ${res.statusText}`);
|
|
30883
31098
|
const buf = Buffer.from(await res.arrayBuffer());
|
|
30884
|
-
fs11.mkdirSync(
|
|
31099
|
+
fs11.mkdirSync(path16.dirname(path16.resolve(outPath)), { recursive: true });
|
|
30885
31100
|
fs11.writeFileSync(outPath, buf);
|
|
30886
31101
|
}
|
|
30887
31102
|
function renderResult(result, outputHint, images, json2) {
|
|
@@ -31076,7 +31291,7 @@ Examples:
|
|
|
31076
31291
|
if (outPath && meta3.outputHint === "image") {
|
|
31077
31292
|
try {
|
|
31078
31293
|
if (images.length > 0) {
|
|
31079
|
-
fs11.mkdirSync(
|
|
31294
|
+
fs11.mkdirSync(path16.dirname(path16.resolve(outPath)), { recursive: true });
|
|
31080
31295
|
fs11.writeFileSync(outPath, images[0].data);
|
|
31081
31296
|
} else if (result && typeof result === "object") {
|
|
31082
31297
|
await fetchImageToFile(result, outPath);
|
|
@@ -31103,7 +31318,7 @@ Examples:
|
|
|
31103
31318
|
import * as fsp from "node:fs/promises";
|
|
31104
31319
|
import { constants as fsConstants2 } from "node:fs";
|
|
31105
31320
|
import { createHash as createHash5 } from "node:crypto";
|
|
31106
|
-
import * as
|
|
31321
|
+
import * as path17 from "node:path";
|
|
31107
31322
|
|
|
31108
31323
|
// ../argent-cli/src/command-args.ts
|
|
31109
31324
|
var UsageError = class extends Error {
|
|
@@ -31230,12 +31445,22 @@ counts the remaining flows skipped.
|
|
|
31230
31445
|
|
|
31231
31446
|
The CLI sends a run to its tool-server: the local one that starts
|
|
31232
31447
|
automatically, or the one that \`argent link\` or ARGENT_TOOLS_URL names. Over
|
|
31233
|
-
a link, the CLI uploads
|
|
31234
|
-
|
|
31235
|
-
|
|
31236
|
-
|
|
31237
|
-
-
|
|
31238
|
-
- a tool: step
|
|
31448
|
+
a link, the CLI uploads these files and writes the new baselines that the run
|
|
31449
|
+
returns:
|
|
31450
|
+
- the flow file and the run: fragments that it reaches
|
|
31451
|
+
- each flow that a tool: flow-execute step names with name (a nested flow)
|
|
31452
|
+
- the snapshot baselines of each run
|
|
31453
|
+
- each .png or .yaml file that a tool: step takes as a file argument by an
|
|
31454
|
+
absolute path
|
|
31455
|
+
The tool-server rejects the flow before the first step when the flow, a
|
|
31456
|
+
fragment or a nested flow has one of these steps:
|
|
31457
|
+
- a script: step
|
|
31458
|
+
- a tool: flow-execute step that does not name its flow with name and an
|
|
31459
|
+
absolute project_root that has no .. segment
|
|
31460
|
+
- a tool: step that records a flow
|
|
31461
|
+
- a tool: step that takes a directory, an app or an output directory
|
|
31462
|
+
- a tool: step whose tool builds a file path from several arguments
|
|
31463
|
+
- a tool: step that names a relative path or a file other than .png or .yaml
|
|
31239
31464
|
Without a link, all step kinds run.
|
|
31240
31465
|
|
|
31241
31466
|
Subcommands:
|
|
@@ -31248,7 +31473,9 @@ Options (run):
|
|
|
31248
31473
|
--device <id> Device id to run against (auto-detected when omitted)
|
|
31249
31474
|
--platform <p> ios | android | chromium | vega | ios-remote \u2014 narrow
|
|
31250
31475
|
auto-detection (ios never picks a remote simulator)
|
|
31251
|
-
--update-baselines Write/refresh screenshot baselines instead of diffing
|
|
31476
|
+
--update-baselines Write/refresh screenshot baselines instead of diffing,
|
|
31477
|
+
also those of flows that tool: flow-execute steps run,
|
|
31478
|
+
unless such a step sets updateBaselines
|
|
31252
31479
|
--output <dir> Also write failed snapshot images (baseline/current/diff)
|
|
31253
31480
|
and failed-step screenshots (step-<n>-screen.png)
|
|
31254
31481
|
under <dir>/<flow>/ \u2014 a stable path for CI artifact
|
|
@@ -31423,28 +31650,28 @@ function renderFailedFlows(failed) {
|
|
|
31423
31650
|
}
|
|
31424
31651
|
var SAFE_ARTIFACT_NAME = FLOW_NAME_PATTERN;
|
|
31425
31652
|
var SAFE_FLOW_NAME = FLOW_NAME_PATTERN;
|
|
31426
|
-
var FLOWS_DIR =
|
|
31653
|
+
var FLOWS_DIR = path17.join(".argent", "flows");
|
|
31427
31654
|
var SHELL_SAFE_ARG = /^(?!=)[A-Za-z0-9_@%+=:,./-]+$/;
|
|
31428
31655
|
function shellQuoteArg(arg) {
|
|
31429
31656
|
if (SHELL_SAFE_ARG.test(arg)) return arg;
|
|
31430
31657
|
return `'${arg.replaceAll("'", "'\\''")}'`;
|
|
31431
31658
|
}
|
|
31432
31659
|
function rerunCommand(flowPath, rel, projectRoot, args) {
|
|
31433
|
-
const pathArg = (p) => shellQuoteArg(p.startsWith("-") ? `.${
|
|
31434
|
-
const fromCwd =
|
|
31435
|
-
const shown =
|
|
31660
|
+
const pathArg = (p) => shellQuoteArg(p.startsWith("-") ? `.${path17.sep}${p}` : p);
|
|
31661
|
+
const fromCwd = path17.relative(projectRoot, flowPath);
|
|
31662
|
+
const shown = path17.isAbsolute(fromCwd) || fromCwd.split(/[\\/]+/).includes("..") ? flowPath : fromCwd;
|
|
31436
31663
|
const parts = ["argent flow run", pathArg(shown)];
|
|
31437
31664
|
if (args.device) parts.push("--device", shellQuoteArg(args.device));
|
|
31438
31665
|
if (args.platform) parts.push("--platform", shellQuoteArg(args.platform));
|
|
31439
31666
|
if (args.updateBaselines) parts.push("--update-baselines");
|
|
31440
|
-
if (args.output) parts.push("--output", pathArg(
|
|
31667
|
+
if (args.output) parts.push("--output", pathArg(path17.join(args.output, path17.dirname(rel))));
|
|
31441
31668
|
return parts.join(" ");
|
|
31442
31669
|
}
|
|
31443
31670
|
var EXPORT_SOURCE_MARKER = ".argent-flow-source";
|
|
31444
31671
|
var MARKER_READ_RETRIES = 4;
|
|
31445
31672
|
var MARKER_READ_DELAY_MS = 5;
|
|
31446
31673
|
async function readExportMarker(dir) {
|
|
31447
|
-
const marker =
|
|
31674
|
+
const marker = path17.join(dir, EXPORT_SOURCE_MARKER);
|
|
31448
31675
|
for (let attempt = 0; ; attempt++) {
|
|
31449
31676
|
let owner;
|
|
31450
31677
|
try {
|
|
@@ -31454,7 +31681,7 @@ async function readExportMarker(dir) {
|
|
|
31454
31681
|
}
|
|
31455
31682
|
if (owner) return owner;
|
|
31456
31683
|
if (attempt === MARKER_READ_RETRIES) return null;
|
|
31457
|
-
await new Promise((
|
|
31684
|
+
await new Promise((resolve12) => setTimeout(resolve12, MARKER_READ_DELAY_MS));
|
|
31458
31685
|
}
|
|
31459
31686
|
}
|
|
31460
31687
|
async function classifyExportDir(dir, flowPath) {
|
|
@@ -31479,7 +31706,7 @@ function occupiedBy(owner) {
|
|
|
31479
31706
|
async function takeExportDir(dir, flowPath) {
|
|
31480
31707
|
try {
|
|
31481
31708
|
await fsp.mkdir(dir, { recursive: true });
|
|
31482
|
-
await fsp.writeFile(
|
|
31709
|
+
await fsp.writeFile(path17.join(dir, EXPORT_SOURCE_MARKER), `${flowPath}
|
|
31483
31710
|
`, { flag: "wx" });
|
|
31484
31711
|
return null;
|
|
31485
31712
|
} catch (err) {
|
|
@@ -31498,7 +31725,7 @@ async function claimExportDirName(outputDir, flowPath, stem) {
|
|
|
31498
31725
|
}
|
|
31499
31726
|
const avoided = [];
|
|
31500
31727
|
for (const name of candidates) {
|
|
31501
|
-
const dir =
|
|
31728
|
+
const dir = path17.join(outputDir, name);
|
|
31502
31729
|
const claim = await classifyExportDir(dir, flowPath);
|
|
31503
31730
|
const reason = claim.state === "foreign" ? occupiedBy(claim.owner) : await takeExportDir(dir, flowPath);
|
|
31504
31731
|
if (reason !== null) {
|
|
@@ -31518,7 +31745,7 @@ async function claimExportDirName(outputDir, flowPath, stem) {
|
|
|
31518
31745
|
return null;
|
|
31519
31746
|
}
|
|
31520
31747
|
async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
31521
|
-
const stem =
|
|
31748
|
+
const stem = path17.basename(flowPath, ".yaml");
|
|
31522
31749
|
if (!SAFE_ARTIFACT_NAME.test(stem)) {
|
|
31523
31750
|
console.error(
|
|
31524
31751
|
`warning: skipping artifact export for unsafe flow filename ${JSON.stringify(stem)}`
|
|
@@ -31551,11 +31778,11 @@ async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
|
31551
31778
|
if (dir === null) {
|
|
31552
31779
|
const dirName = await claimExportDirName(outputDir, flowPath, stem);
|
|
31553
31780
|
if (dirName === null) return;
|
|
31554
|
-
dir =
|
|
31781
|
+
dir = path17.join(outputDir, dirName);
|
|
31555
31782
|
}
|
|
31556
|
-
const dest =
|
|
31557
|
-
const rel =
|
|
31558
|
-
if (rel.startsWith("..") ||
|
|
31783
|
+
const dest = path17.join(dir, fileName(role));
|
|
31784
|
+
const rel = path17.relative(outputDir, dest);
|
|
31785
|
+
if (rel.startsWith("..") || path17.isAbsolute(rel)) continue;
|
|
31559
31786
|
try {
|
|
31560
31787
|
await fsp.copyFile(value, dest);
|
|
31561
31788
|
s.artifacts[role] = dest;
|
|
@@ -31570,7 +31797,7 @@ async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
|
31570
31797
|
function keyFromBaselinePath(artifacts) {
|
|
31571
31798
|
const baseline = artifacts.baseline;
|
|
31572
31799
|
if (typeof baseline !== "string") return null;
|
|
31573
|
-
return
|
|
31800
|
+
return path17.basename(baseline).replace(/\.png$/, "");
|
|
31574
31801
|
}
|
|
31575
31802
|
function resolveArtifactDisplayPaths(report) {
|
|
31576
31803
|
for (const s of report.steps) {
|
|
@@ -31582,7 +31809,7 @@ function resolveArtifactDisplayPaths(report) {
|
|
|
31582
31809
|
}
|
|
31583
31810
|
function exitAfterFlush(code, streams = [process.stdout, process.stderr]) {
|
|
31584
31811
|
return Promise.all(
|
|
31585
|
-
streams.map((s) => new Promise((
|
|
31812
|
+
streams.map((s) => new Promise((resolve12) => s.write("", () => resolve12())))
|
|
31586
31813
|
).then(() => process.exit(code));
|
|
31587
31814
|
}
|
|
31588
31815
|
function renderReport(report) {
|
|
@@ -31627,36 +31854,36 @@ async function collectRunnableFlowPaths(dir, relDir = "") {
|
|
|
31627
31854
|
const found = [];
|
|
31628
31855
|
const entries = await fsp.readdir(dir, { withFileTypes: true });
|
|
31629
31856
|
for (const entry of entries) {
|
|
31630
|
-
const rel = relDir ?
|
|
31857
|
+
const rel = relDir ? path17.join(relDir, entry.name) : entry.name;
|
|
31631
31858
|
if (entry.isDirectory()) {
|
|
31632
31859
|
if (entry.name === "__baselines__") continue;
|
|
31633
31860
|
found.push(
|
|
31634
|
-
...await collectRunnableFlowPaths(
|
|
31861
|
+
...await collectRunnableFlowPaths(path17.join(dir, entry.name), rel).catch(() => [])
|
|
31635
31862
|
);
|
|
31636
31863
|
continue;
|
|
31637
31864
|
}
|
|
31638
31865
|
if (!entry.name.endsWith(".yaml")) continue;
|
|
31639
|
-
if (!SAFE_FLOW_NAME.test(
|
|
31640
|
-
if (await isRunnableFlowFile(
|
|
31866
|
+
if (!SAFE_FLOW_NAME.test(path17.basename(entry.name, ".yaml"))) continue;
|
|
31867
|
+
if (await isRunnableFlowFile(path17.join(dir, entry.name))) found.push(rel);
|
|
31641
31868
|
}
|
|
31642
31869
|
return found;
|
|
31643
31870
|
}
|
|
31644
31871
|
function resolveFlowRef(ref) {
|
|
31645
31872
|
if (!SAFE_FLOW_NAME.test(ref)) return { suppliedPath: ref, fromName: false };
|
|
31646
|
-
return { suppliedPath:
|
|
31873
|
+
return { suppliedPath: path17.join(FLOWS_DIR, `${ref}.yaml`), fromName: true };
|
|
31647
31874
|
}
|
|
31648
31875
|
async function savedFlowHint(projectRoot, missingPath) {
|
|
31649
|
-
const dir =
|
|
31650
|
-
const within =
|
|
31651
|
-
if (!within.startsWith("..") && !
|
|
31652
|
-
const wanted = `${
|
|
31876
|
+
const dir = path17.resolve(projectRoot, FLOWS_DIR);
|
|
31877
|
+
const within = path17.relative(dir, missingPath);
|
|
31878
|
+
if (!within.startsWith("..") && !path17.isAbsolute(within)) return "";
|
|
31879
|
+
const wanted = `${path17.basename(missingPath, ".yaml")}.yaml`;
|
|
31653
31880
|
const entries = await fsp.readdir(dir).catch(() => null);
|
|
31654
31881
|
if (entries === null) return "";
|
|
31655
31882
|
const actual = entries.includes(wanted) ? wanted : entries.find((name2) => name2.toLowerCase() === wanted.toLowerCase());
|
|
31656
31883
|
if (actual === void 0) return "";
|
|
31657
|
-
const name =
|
|
31884
|
+
const name = path17.basename(actual, ".yaml");
|
|
31658
31885
|
if (!SAFE_FLOW_NAME.test(name)) return "";
|
|
31659
|
-
if (!await isRunnableFlowFile(
|
|
31886
|
+
if (!await isRunnableFlowFile(path17.join(dir, actual))) return "";
|
|
31660
31887
|
return `
|
|
31661
31888
|
A flow named "${name}" is saved under ${FLOWS_DIR} \u2014 did you mean: argent flow run ${name}`;
|
|
31662
31889
|
}
|
|
@@ -31664,17 +31891,17 @@ async function collectFlowFiles(dir, recursive) {
|
|
|
31664
31891
|
const found = [];
|
|
31665
31892
|
const walk = async (current, rel) => {
|
|
31666
31893
|
for (const entry of await fsp.readdir(current, { withFileTypes: true })) {
|
|
31667
|
-
const entryRel = rel ?
|
|
31894
|
+
const entryRel = rel ? path17.join(rel, entry.name) : entry.name;
|
|
31668
31895
|
if (entry.isDirectory()) {
|
|
31669
31896
|
if (recursive && !entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
31670
|
-
await walk(
|
|
31897
|
+
await walk(path17.join(current, entry.name), entryRel).catch(() => {
|
|
31671
31898
|
});
|
|
31672
31899
|
}
|
|
31673
31900
|
continue;
|
|
31674
31901
|
}
|
|
31675
31902
|
if (!entry.name.endsWith(".yaml")) continue;
|
|
31676
|
-
if (!SAFE_FLOW_NAME.test(
|
|
31677
|
-
if (await isRunnableFlowFile(
|
|
31903
|
+
if (!SAFE_FLOW_NAME.test(path17.basename(entry.name, ".yaml"))) continue;
|
|
31904
|
+
if (await isRunnableFlowFile(path17.join(current, entry.name))) found.push(entryRel);
|
|
31678
31905
|
}
|
|
31679
31906
|
};
|
|
31680
31907
|
await walk(dir, "");
|
|
@@ -31802,7 +32029,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
31802
32029
|
);
|
|
31803
32030
|
}
|
|
31804
32031
|
const { callTool, baseUrl } = runToolsClient(args, options);
|
|
31805
|
-
const outputBase = args.output ?
|
|
32032
|
+
const outputBase = args.output ? path17.resolve(args.output) : void 0;
|
|
31806
32033
|
const results = [];
|
|
31807
32034
|
const failures = [];
|
|
31808
32035
|
const batchStartedAt = Date.now();
|
|
@@ -31815,7 +32042,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
31815
32042
|
if (!args.json) console.log(` ${STATUS_GLYPH.skip} not run (batch stopped)`);
|
|
31816
32043
|
continue;
|
|
31817
32044
|
}
|
|
31818
|
-
const flowPath =
|
|
32045
|
+
const flowPath = path17.join(dir, rel);
|
|
31819
32046
|
const rerun = rerunCommand(flowPath, rel, projectRoot, args);
|
|
31820
32047
|
let report;
|
|
31821
32048
|
try {
|
|
@@ -31848,7 +32075,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
31848
32075
|
}
|
|
31849
32076
|
await exportAndResolveArtifacts(
|
|
31850
32077
|
report,
|
|
31851
|
-
outputBase ?
|
|
32078
|
+
outputBase ? path17.join(outputBase, path17.dirname(rel)) : void 0,
|
|
31852
32079
|
flowPath,
|
|
31853
32080
|
baseUrl
|
|
31854
32081
|
);
|
|
@@ -31893,9 +32120,9 @@ async function flow(argv, options) {
|
|
|
31893
32120
|
return;
|
|
31894
32121
|
}
|
|
31895
32122
|
if (sub === "list") {
|
|
31896
|
-
const dir =
|
|
32123
|
+
const dir = path17.join(process.cwd(), FLOWS_DIR);
|
|
31897
32124
|
try {
|
|
31898
|
-
const paths = (await collectRunnableFlowPaths(dir)).sort().map((rel) =>
|
|
32125
|
+
const paths = (await collectRunnableFlowPaths(dir)).sort().map((rel) => path17.join(FLOWS_DIR, rel));
|
|
31899
32126
|
if (paths.length === 0) console.log("No flows found in .argent/flows");
|
|
31900
32127
|
else console.log(paths.join("\n"));
|
|
31901
32128
|
} catch {
|
|
@@ -31947,10 +32174,10 @@ async function flow(argv, options) {
|
|
|
31947
32174
|
const { suppliedPath, fromName } = resolveFlowRef(args.flowRef);
|
|
31948
32175
|
if (suppliedPath.split(/[\\/]+/).includes("..")) {
|
|
31949
32176
|
let recovery = "Pass the fully resolved path to the flow's YAML.";
|
|
31950
|
-
const suppliedBase2 =
|
|
32177
|
+
const suppliedBase2 = path17.basename(suppliedPath);
|
|
31951
32178
|
if (suppliedBase2 !== ".." && suppliedBase2 !== ".") {
|
|
31952
32179
|
try {
|
|
31953
|
-
const resolved =
|
|
32180
|
+
const resolved = path17.join(await fsp.realpath(path17.dirname(suppliedPath)), suppliedBase2);
|
|
31954
32181
|
await fsp.stat(resolved);
|
|
31955
32182
|
recovery = `Did you mean: argent flow run ${shellQuoteArg(resolved)}`;
|
|
31956
32183
|
} catch {
|
|
@@ -31962,7 +32189,7 @@ async function flow(argv, options) {
|
|
|
31962
32189
|
2
|
|
31963
32190
|
);
|
|
31964
32191
|
}
|
|
31965
|
-
const resolvedPath =
|
|
32192
|
+
const resolvedPath = path17.resolve(projectRoot, suppliedPath);
|
|
31966
32193
|
let isDirectory = false;
|
|
31967
32194
|
try {
|
|
31968
32195
|
isDirectory = (await fsp.stat(resolvedPath)).isDirectory();
|
|
@@ -31985,16 +32212,16 @@ async function flow(argv, options) {
|
|
|
31985
32212
|
}
|
|
31986
32213
|
const separatorTrimmedPath = suppliedPath.replace(/[\\/]+$/, "");
|
|
31987
32214
|
if (separatorTrimmedPath !== suppliedPath && separatorTrimmedPath !== "") {
|
|
31988
|
-
const hint = SAFE_FLOW_NAME.test(separatorTrimmedPath) ? `.${
|
|
32215
|
+
const hint = SAFE_FLOW_NAME.test(separatorTrimmedPath) ? `.${path17.sep}${separatorTrimmedPath}` : separatorTrimmedPath;
|
|
31989
32216
|
return fail(
|
|
31990
32217
|
`Flow 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}
|
|
31991
32218
|
Did you mean: argent flow run ${shellQuoteArg(hint)}`,
|
|
31992
32219
|
2
|
|
31993
32220
|
);
|
|
31994
32221
|
}
|
|
31995
|
-
if (
|
|
31996
|
-
const looksLikeName = !suppliedPath.includes("/") && !suppliedPath.includes("\\") &&
|
|
31997
|
-
if (
|
|
32222
|
+
if (path17.extname(suppliedPath) !== ".yaml") {
|
|
32223
|
+
const looksLikeName = !suppliedPath.includes("/") && !suppliedPath.includes("\\") && path17.extname(suppliedPath) === "";
|
|
32224
|
+
if (path17.basename(suppliedPath).toLowerCase() === ".yaml") {
|
|
31998
32225
|
return fail(
|
|
31999
32226
|
`Flow filename must have a non-empty name containing only letters, numbers, "_", or "-": ${suppliedPath}`,
|
|
32000
32227
|
2
|
|
@@ -32007,15 +32234,15 @@ Names run \`${FLOWS_DIR}/<name>.yaml\`; pass a path ending in .yaml to run a flo
|
|
|
32007
32234
|
2
|
|
32008
32235
|
);
|
|
32009
32236
|
}
|
|
32010
|
-
if (
|
|
32237
|
+
if (path17.extname(suppliedPath).toLowerCase() === ".yaml") {
|
|
32011
32238
|
return fail(
|
|
32012
|
-
`Flow extension must be lowercase .yaml, not ${
|
|
32239
|
+
`Flow extension must be lowercase .yaml, not ${path17.extname(suppliedPath)}: ${suppliedPath}`,
|
|
32013
32240
|
2
|
|
32014
32241
|
);
|
|
32015
32242
|
}
|
|
32016
32243
|
return fail(`Flow path must end in .yaml: ${suppliedPath}`, 2);
|
|
32017
32244
|
}
|
|
32018
|
-
const flowName =
|
|
32245
|
+
const flowName = path17.basename(suppliedPath, ".yaml");
|
|
32019
32246
|
if (!SAFE_FLOW_NAME.test(flowName)) {
|
|
32020
32247
|
return fail(
|
|
32021
32248
|
`Flow filename must have a non-empty name containing only letters, numbers, "_", or "-": ${suppliedPath}`,
|
|
@@ -32039,12 +32266,12 @@ No flow named "${args.flowRef}" is saved there \u2014 run \`argent flow list\` t
|
|
|
32039
32266
|
}
|
|
32040
32267
|
return fail(`${detail}: ${flowPath}${recovery}`, 2);
|
|
32041
32268
|
}
|
|
32042
|
-
const suppliedBase =
|
|
32043
|
-
const siblings = await fsp.readdir(
|
|
32269
|
+
const suppliedBase = path17.basename(flowPath);
|
|
32270
|
+
const siblings = await fsp.readdir(path17.dirname(flowPath)).catch(() => null);
|
|
32044
32271
|
if (siblings !== null && !siblings.includes(suppliedBase)) {
|
|
32045
32272
|
const actual = siblings.find((name) => name.toLowerCase() === suppliedBase.toLowerCase());
|
|
32046
|
-
const actualRunnable = actual !== void 0 &&
|
|
32047
|
-
const recovery = actualRunnable ? fromName ? `Did you mean: argent flow run ${
|
|
32273
|
+
const actualRunnable = actual !== void 0 && path17.extname(actual) === ".yaml" && SAFE_FLOW_NAME.test(path17.basename(actual, ".yaml"));
|
|
32274
|
+
const recovery = actualRunnable ? fromName ? `Did you mean: argent flow run ${path17.basename(actual, ".yaml")}` : `Did you mean: argent flow run ${shellQuoteArg(path17.join(path17.dirname(suppliedPath), actual))}` : actual !== void 0 ? `Rename ${actual} to ${suppliedBase} to run it \u2014 flow files must be lowercase .yaml.` : "Pass the flow file's name exactly as it appears on disk.";
|
|
32048
32275
|
return fail(
|
|
32049
32276
|
`Flow 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 flow name (which keys the report, __baselines__/, and --output) would be one no file carries: ${suppliedPath}
|
|
32050
32277
|
${recovery}`,
|
|
@@ -32102,7 +32329,7 @@ ${recovery}`,
|
|
|
32102
32329
|
try {
|
|
32103
32330
|
await exportAndResolveArtifacts(
|
|
32104
32331
|
report,
|
|
32105
|
-
args.output ?
|
|
32332
|
+
args.output ? path17.resolve(args.output) : void 0,
|
|
32106
32333
|
flowPath,
|
|
32107
32334
|
baseUrl
|
|
32108
32335
|
);
|
|
@@ -32217,11 +32444,11 @@ Listing tools contacts the argent tool-server, starting one if none is running.
|
|
|
32217
32444
|
|
|
32218
32445
|
// ../argent-cli/src/server.ts
|
|
32219
32446
|
import * as fs12 from "node:fs";
|
|
32220
|
-
import * as
|
|
32447
|
+
import * as path18 from "node:path";
|
|
32221
32448
|
import { homedir as homedir5, networkInterfaces } from "node:os";
|
|
32222
32449
|
import { spawn as spawn3 } from "node:child_process";
|
|
32223
|
-
var STATE_DIR2 =
|
|
32224
|
-
var LOG_FILE2 =
|
|
32450
|
+
var STATE_DIR2 = path18.join(homedir5(), ".argent");
|
|
32451
|
+
var LOG_FILE2 = path18.join(STATE_DIR2, "tool-server.log");
|
|
32225
32452
|
async function describeForeignServers(ownBundlePath) {
|
|
32226
32453
|
const others = (await readAllToolsServerStates()).filter(
|
|
32227
32454
|
({ state: state2 }) => state2.bundlePath !== ownBundlePath && isToolsServerProcessAlive(state2.pid)
|
|
@@ -32607,7 +32834,7 @@ async function server(argv, options) {
|
|
|
32607
32834
|
// ../argent-cli/src/lens.ts
|
|
32608
32835
|
import * as fs13 from "node:fs";
|
|
32609
32836
|
import * as os2 from "node:os";
|
|
32610
|
-
import * as
|
|
32837
|
+
import * as path19 from "node:path";
|
|
32611
32838
|
|
|
32612
32839
|
// ../argent-cli/src/lens-terminal.ts
|
|
32613
32840
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
@@ -32825,12 +33052,12 @@ function isSessionAlive(session) {
|
|
|
32825
33052
|
// ../argent-cli/src/lens-pty.ts
|
|
32826
33053
|
import { chmodSync as chmodSync2, readdirSync as readdirSync2 } from "node:fs";
|
|
32827
33054
|
import { createRequire } from "node:module";
|
|
32828
|
-
import { dirname as
|
|
33055
|
+
import { dirname as dirname11, join as join17 } from "node:path";
|
|
32829
33056
|
var nodeRequire = createRequire(import.meta.url);
|
|
32830
33057
|
function ensureSpawnHelperExecutable(req = nodeRequire) {
|
|
32831
33058
|
if (process.platform !== "darwin") return;
|
|
32832
33059
|
try {
|
|
32833
|
-
const prebuilds = join17(
|
|
33060
|
+
const prebuilds = join17(dirname11(req.resolve("node-pty/package.json")), "prebuilds");
|
|
32834
33061
|
for (const entry of readdirSync2(prebuilds)) {
|
|
32835
33062
|
try {
|
|
32836
33063
|
chmodSync2(join17(prebuilds, entry, "spawn-helper"), 493);
|
|
@@ -32865,7 +33092,7 @@ function ptyInjectBeats(text2) {
|
|
|
32865
33092
|
];
|
|
32866
33093
|
}
|
|
32867
33094
|
function sleep(ms) {
|
|
32868
|
-
return new Promise((
|
|
33095
|
+
return new Promise((resolve12) => setTimeout(resolve12, ms));
|
|
32869
33096
|
}
|
|
32870
33097
|
var DEFAULT_COLS = 80;
|
|
32871
33098
|
var DEFAULT_ROWS = 24;
|
|
@@ -33086,7 +33313,7 @@ var SPAWN_GRACE_MS = 8e3;
|
|
|
33086
33313
|
var DEATH_CONFIRMATIONS = 3;
|
|
33087
33314
|
var SSE_RECONNECT_MS = 1e3;
|
|
33088
33315
|
function sleep2(ms) {
|
|
33089
|
-
return new Promise((
|
|
33316
|
+
return new Promise((resolve12) => setTimeout(resolve12, ms));
|
|
33090
33317
|
}
|
|
33091
33318
|
var TRUST_PROMPT_RE = /trust this folder|do you trust|yes,? i trust|trust the files in this/i;
|
|
33092
33319
|
async function dismissTrustPrompt(session) {
|
|
@@ -33357,7 +33584,7 @@ async function lens(argv, options) {
|
|
|
33357
33584
|
await endSession(baseUrl);
|
|
33358
33585
|
process.exit(1);
|
|
33359
33586
|
}
|
|
33360
|
-
const seedFile =
|
|
33587
|
+
const seedFile = path19.join(os2.tmpdir(), `argent-lens-seed-${process.pid}-${Date.now()}.txt`);
|
|
33361
33588
|
fs13.writeFileSync(seedFile, buildSeedPrompt(), "utf8");
|
|
33362
33589
|
const launchCmd = agent.launch(shellQuote(process.cwd()), shellQuote(seedFile));
|
|
33363
33590
|
const removeSeedFile = () => {
|
|
@@ -33721,7 +33948,7 @@ Options:
|
|
|
33721
33948
|
|
|
33722
33949
|
// ../argent-cli/src/config.ts
|
|
33723
33950
|
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
33724
|
-
import * as
|
|
33951
|
+
import * as path20 from "node:path";
|
|
33725
33952
|
function config2(argv) {
|
|
33726
33953
|
if (argv.length === 0 || argv[0] === "--help" || argv[0] === "-h") {
|
|
33727
33954
|
printUsage();
|
|
@@ -33892,16 +34119,16 @@ function wantsHelp(argv) {
|
|
|
33892
34119
|
}
|
|
33893
34120
|
function scopeLabel(scope) {
|
|
33894
34121
|
if (scope === "global") return "global";
|
|
33895
|
-
return `project: ${
|
|
34122
|
+
return `project: ${path20.dirname(configDir("project"))}`;
|
|
33896
34123
|
}
|
|
33897
34124
|
function degenerateProjectScopeWarning(scope) {
|
|
33898
34125
|
if (scope !== "project") return null;
|
|
33899
34126
|
const projDir = configDir("project");
|
|
33900
|
-
if (
|
|
33901
|
-
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 (${
|
|
34127
|
+
if (path20.resolve(projDir) === path20.resolve(configDir("global"))) {
|
|
34128
|
+
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 (${path20.join(projDir, "config.json")}).`;
|
|
33902
34129
|
}
|
|
33903
34130
|
if (findProjectRoot(process.cwd()) === null) {
|
|
33904
|
-
return `WARNING: no project markers (.argent, .git, package.json) found above ${process.cwd()} \u2014 treating it as the project root and creating ${
|
|
34131
|
+
return `WARNING: no project markers (.argent, .git, package.json) found above ${process.cwd()} \u2014 treating it as the project root and creating ${path20.join(projDir, "config.json")}.`;
|
|
33905
34132
|
}
|
|
33906
34133
|
return null;
|
|
33907
34134
|
}
|
|
@@ -34803,7 +35030,7 @@ import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
|
34803
35030
|
import process$1 from "node:process";
|
|
34804
35031
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
34805
35032
|
import { existsSync as existsSync7, lstatSync as lstatSync3, readdirSync as readdirSync3 } from "node:fs";
|
|
34806
|
-
import { dirname as
|
|
35033
|
+
import { dirname as dirname13, join as join20 } from "node:path";
|
|
34807
35034
|
function isUnicodeSupported() {
|
|
34808
35035
|
if (process$1.platform !== "win32") {
|
|
34809
35036
|
return process$1.env.TERM !== "linux";
|
|
@@ -35788,7 +36015,7 @@ async function cmdDisable(scope) {
|
|
|
35788
36015
|
// ../argent-cli/src/providers.ts
|
|
35789
36016
|
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
35790
36017
|
import * as fs17 from "node:fs";
|
|
35791
|
-
import * as
|
|
36018
|
+
import * as path23 from "node:path";
|
|
35792
36019
|
|
|
35793
36020
|
// ../device-providers/src/contract.ts
|
|
35794
36021
|
var PROVIDER_SCHEMA_VERSION = 1;
|
|
@@ -35935,7 +36162,7 @@ var providerEnvelopeSchema = providerRecordSchema.extend({
|
|
|
35935
36162
|
// ../device-providers/src/read.ts
|
|
35936
36163
|
import * as fs14 from "node:fs";
|
|
35937
36164
|
import * as os3 from "node:os";
|
|
35938
|
-
import * as
|
|
36165
|
+
import * as path21 from "node:path";
|
|
35939
36166
|
var DISABLE_ENV = "ARGENT_DISABLE_DEVICE_PROVIDERS";
|
|
35940
36167
|
var OVERRIDE_ENV = "ARGENT_DEVICE_PROVIDERS";
|
|
35941
36168
|
function resolveHomeDir2() {
|
|
@@ -35944,7 +36171,7 @@ function resolveHomeDir2() {
|
|
|
35944
36171
|
return trimmed ? raw : os3.homedir();
|
|
35945
36172
|
}
|
|
35946
36173
|
function providersDirectory() {
|
|
35947
|
-
return
|
|
36174
|
+
return path21.join(resolveHomeDir2(), ".argent", "providers");
|
|
35948
36175
|
}
|
|
35949
36176
|
function discoveryDisabled() {
|
|
35950
36177
|
const raw = process.env[DISABLE_ENV];
|
|
@@ -36010,7 +36237,7 @@ function discoverProviders() {
|
|
|
36010
36237
|
function descriptorFiles() {
|
|
36011
36238
|
const directory = providersDirectory();
|
|
36012
36239
|
try {
|
|
36013
|
-
return fs14.readdirSync(directory).filter((name) => name.endsWith(".json")).sort().map((name) =>
|
|
36240
|
+
return fs14.readdirSync(directory).filter((name) => name.endsWith(".json")).sort().map((name) => path21.join(directory, name));
|
|
36014
36241
|
} catch {
|
|
36015
36242
|
return [];
|
|
36016
36243
|
}
|
|
@@ -36018,7 +36245,7 @@ function descriptorFiles() {
|
|
|
36018
36245
|
|
|
36019
36246
|
// ../device-providers/src/write.ts
|
|
36020
36247
|
import * as fs15 from "node:fs";
|
|
36021
|
-
import * as
|
|
36248
|
+
import * as path22 from "node:path";
|
|
36022
36249
|
var ProviderValidationError = class extends Error {
|
|
36023
36250
|
/** One line per problem, `path: message`, in the order zod reported them. */
|
|
36024
36251
|
issues;
|
|
@@ -36070,7 +36297,7 @@ function publishProvider(record2, options = {}) {
|
|
|
36070
36297
|
);
|
|
36071
36298
|
}
|
|
36072
36299
|
const directory = providersDirectory();
|
|
36073
|
-
const file2 =
|
|
36300
|
+
const file2 = path22.join(directory, `${validated.id}.json`);
|
|
36074
36301
|
const body = JSON.stringify(canonicalize(candidate), null, 2) + "\n";
|
|
36075
36302
|
try {
|
|
36076
36303
|
if (fs15.readFileSync(file2, "utf8") === body) return { changed: false, path: file2 };
|
|
@@ -36094,7 +36321,7 @@ function withdrawProvider(id) {
|
|
|
36094
36321
|
if (!PROVIDER_ID_SHAPE.test(id)) {
|
|
36095
36322
|
throw new Error(`'${id}' is not a valid provider id (${String(PROVIDER_ID_SHAPE)}).`);
|
|
36096
36323
|
}
|
|
36097
|
-
const file2 =
|
|
36324
|
+
const file2 = path22.join(providersDirectory(), `${id}.json`);
|
|
36098
36325
|
try {
|
|
36099
36326
|
fs15.unlinkSync(file2);
|
|
36100
36327
|
return true;
|
|
@@ -36599,7 +36826,7 @@ function runWithdraw(args) {
|
|
|
36599
36826
|
throw new UsageError2(`'${id}' is not a valid provider id (${String(PROVIDER_ID_SHAPE)})`);
|
|
36600
36827
|
}
|
|
36601
36828
|
const removed = withdrawProvider(id);
|
|
36602
|
-
const file2 =
|
|
36829
|
+
const file2 = path23.join(providersDirectory(), `${id}.json`);
|
|
36603
36830
|
if (args.json) {
|
|
36604
36831
|
console.log(JSON.stringify({ ok: true, path: file2, removed }, null, 2));
|
|
36605
36832
|
return;
|