@swmansion/argent 0.34.1-next.3 → 0.34.1-next.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -0
- package/assets/ios-screen-stream/Info.plist +12 -0
- package/assets/ios-screen-stream/ios-screen-stream.swift +321 -0
- package/bin/argent-android-devtools-0.4.0.apk +0 -0
- package/bin/darwin/argent-macos-helper +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/simulator-server +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/linux/simulator-server +0 -0
- package/bin/linux-arm64/simulator-server +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/bin/win32/simulator-server.exe +0 -0
- package/dist/cli-cmds.mjs +710 -412
- package/dist/client.js +202 -107
- package/dist/installer-help.js +4 -0
- package/dist/installer-help.js.map +1 -1
- package/dist/installer.mjs +1070 -837
- package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentLaunchPerformanceTests.swift +21 -0
- package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Commands.swift +9 -3
- package/dist/mcp-server.mjs +384 -621
- package/dist/preview-ui/index.html +28 -2
- package/dist/tool-args.generated.d.ts +38 -8
- package/dist/tool-server.cjs +6821 -3369
- package/dylibs/libArgentAudio.dylib +0 -0
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/macos/libNativeDevtoolsMacos.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/rules/argent.md +6 -23
- package/skills/argent-create-e2e/references/e2e-yaml.md +2 -2
- package/skills/argent-create-e2e/references/live-authoring.md +1 -1
- package/skills/argent-device-interact/references/foldables.md +22 -0
- package/skills/argent-ios-device-interact/SKILL.md +2 -2
- package/skills/argent-macos-app-interact/SKILL.md +15 -5
- package/skills/argent-macos-app-interact/references/e2e.md +1 -1
- package/skills/argent-native-profiler/SKILL.md +14 -2
- package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
- package/skills/argent-react-native-optimization/SKILL.md +10 -1
- package/skills/argent-react-native-profiler/SKILL.md +4 -3
- package/skills/argent-screen-recording/SKILL.md +3 -2
package/dist/cli-cmds.mjs
CHANGED
|
@@ -124,17 +124,17 @@ var require_visit = __commonJS({
|
|
|
124
124
|
visit2.BREAK = BREAK;
|
|
125
125
|
visit2.SKIP = SKIP;
|
|
126
126
|
visit2.REMOVE = REMOVE;
|
|
127
|
-
function visit_(key, node2, visitor,
|
|
128
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
127
|
+
function visit_(key, node2, visitor, path29) {
|
|
128
|
+
const ctrl = callVisitor(key, node2, visitor, path29);
|
|
129
129
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
130
|
-
replaceNode(key,
|
|
131
|
-
return visit_(key, ctrl, visitor,
|
|
130
|
+
replaceNode(key, path29, ctrl);
|
|
131
|
+
return visit_(key, ctrl, visitor, path29);
|
|
132
132
|
}
|
|
133
133
|
if (typeof ctrl !== "symbol") {
|
|
134
134
|
if (identity2.isCollection(node2)) {
|
|
135
|
-
|
|
135
|
+
path29 = Object.freeze(path29.concat(node2));
|
|
136
136
|
for (let i2 = 0; i2 < node2.items.length; ++i2) {
|
|
137
|
-
const ci = visit_(i2, node2.items[i2], visitor,
|
|
137
|
+
const ci = visit_(i2, node2.items[i2], visitor, path29);
|
|
138
138
|
if (typeof ci === "number")
|
|
139
139
|
i2 = ci - 1;
|
|
140
140
|
else if (ci === BREAK)
|
|
@@ -145,13 +145,13 @@ var require_visit = __commonJS({
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
} else if (identity2.isPair(node2)) {
|
|
148
|
-
|
|
149
|
-
const ck = visit_("key", node2.key, visitor,
|
|
148
|
+
path29 = Object.freeze(path29.concat(node2));
|
|
149
|
+
const ck = visit_("key", node2.key, visitor, path29);
|
|
150
150
|
if (ck === BREAK)
|
|
151
151
|
return BREAK;
|
|
152
152
|
else if (ck === REMOVE)
|
|
153
153
|
node2.key = null;
|
|
154
|
-
const cv = visit_("value", node2.value, visitor,
|
|
154
|
+
const cv = visit_("value", node2.value, visitor, path29);
|
|
155
155
|
if (cv === BREAK)
|
|
156
156
|
return BREAK;
|
|
157
157
|
else if (cv === REMOVE)
|
|
@@ -172,17 +172,17 @@ var require_visit = __commonJS({
|
|
|
172
172
|
visitAsync.BREAK = BREAK;
|
|
173
173
|
visitAsync.SKIP = SKIP;
|
|
174
174
|
visitAsync.REMOVE = REMOVE;
|
|
175
|
-
async function visitAsync_(key, node2, visitor,
|
|
176
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
175
|
+
async function visitAsync_(key, node2, visitor, path29) {
|
|
176
|
+
const ctrl = await callVisitor(key, node2, visitor, path29);
|
|
177
177
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
178
|
-
replaceNode(key,
|
|
179
|
-
return visitAsync_(key, ctrl, visitor,
|
|
178
|
+
replaceNode(key, path29, ctrl);
|
|
179
|
+
return visitAsync_(key, ctrl, visitor, path29);
|
|
180
180
|
}
|
|
181
181
|
if (typeof ctrl !== "symbol") {
|
|
182
182
|
if (identity2.isCollection(node2)) {
|
|
183
|
-
|
|
183
|
+
path29 = Object.freeze(path29.concat(node2));
|
|
184
184
|
for (let i2 = 0; i2 < node2.items.length; ++i2) {
|
|
185
|
-
const ci = await visitAsync_(i2, node2.items[i2], visitor,
|
|
185
|
+
const ci = await visitAsync_(i2, node2.items[i2], visitor, path29);
|
|
186
186
|
if (typeof ci === "number")
|
|
187
187
|
i2 = ci - 1;
|
|
188
188
|
else if (ci === BREAK)
|
|
@@ -193,13 +193,13 @@ var require_visit = __commonJS({
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
} else if (identity2.isPair(node2)) {
|
|
196
|
-
|
|
197
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
196
|
+
path29 = Object.freeze(path29.concat(node2));
|
|
197
|
+
const ck = await visitAsync_("key", node2.key, visitor, path29);
|
|
198
198
|
if (ck === BREAK)
|
|
199
199
|
return BREAK;
|
|
200
200
|
else if (ck === REMOVE)
|
|
201
201
|
node2.key = null;
|
|
202
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
202
|
+
const cv = await visitAsync_("value", node2.value, visitor, path29);
|
|
203
203
|
if (cv === BREAK)
|
|
204
204
|
return BREAK;
|
|
205
205
|
else if (cv === REMOVE)
|
|
@@ -226,23 +226,23 @@ var require_visit = __commonJS({
|
|
|
226
226
|
}
|
|
227
227
|
return visitor;
|
|
228
228
|
}
|
|
229
|
-
function callVisitor(key, node2, visitor,
|
|
229
|
+
function callVisitor(key, node2, visitor, path29) {
|
|
230
230
|
if (typeof visitor === "function")
|
|
231
|
-
return visitor(key, node2,
|
|
231
|
+
return visitor(key, node2, path29);
|
|
232
232
|
if (identity2.isMap(node2))
|
|
233
|
-
return visitor.Map?.(key, node2,
|
|
233
|
+
return visitor.Map?.(key, node2, path29);
|
|
234
234
|
if (identity2.isSeq(node2))
|
|
235
|
-
return visitor.Seq?.(key, node2,
|
|
235
|
+
return visitor.Seq?.(key, node2, path29);
|
|
236
236
|
if (identity2.isPair(node2))
|
|
237
|
-
return visitor.Pair?.(key, node2,
|
|
237
|
+
return visitor.Pair?.(key, node2, path29);
|
|
238
238
|
if (identity2.isScalar(node2))
|
|
239
|
-
return visitor.Scalar?.(key, node2,
|
|
239
|
+
return visitor.Scalar?.(key, node2, path29);
|
|
240
240
|
if (identity2.isAlias(node2))
|
|
241
|
-
return visitor.Alias?.(key, node2,
|
|
241
|
+
return visitor.Alias?.(key, node2, path29);
|
|
242
242
|
return void 0;
|
|
243
243
|
}
|
|
244
|
-
function replaceNode(key,
|
|
245
|
-
const parent =
|
|
244
|
+
function replaceNode(key, path29, node2) {
|
|
245
|
+
const parent = path29[path29.length - 1];
|
|
246
246
|
if (identity2.isCollection(parent)) {
|
|
247
247
|
parent.items[key] = node2;
|
|
248
248
|
} else if (identity2.isPair(parent)) {
|
|
@@ -854,10 +854,10 @@ var require_Collection = __commonJS({
|
|
|
854
854
|
var createNode = require_createNode();
|
|
855
855
|
var identity2 = require_identity();
|
|
856
856
|
var Node = require_Node();
|
|
857
|
-
function collectionFromPath(schema,
|
|
857
|
+
function collectionFromPath(schema, path29, value) {
|
|
858
858
|
let v = value;
|
|
859
|
-
for (let i2 =
|
|
860
|
-
const k =
|
|
859
|
+
for (let i2 = path29.length - 1; i2 >= 0; --i2) {
|
|
860
|
+
const k = path29[i2];
|
|
861
861
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
862
862
|
const a2 = [];
|
|
863
863
|
a2[k] = v;
|
|
@@ -876,7 +876,7 @@ var require_Collection = __commonJS({
|
|
|
876
876
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
877
877
|
});
|
|
878
878
|
}
|
|
879
|
-
var isEmptyPath = (
|
|
879
|
+
var isEmptyPath = (path29) => path29 == null || typeof path29 === "object" && !!path29[Symbol.iterator]().next().done;
|
|
880
880
|
var Collection = class extends Node.NodeBase {
|
|
881
881
|
constructor(type, schema) {
|
|
882
882
|
super(type);
|
|
@@ -906,11 +906,11 @@ var require_Collection = __commonJS({
|
|
|
906
906
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
907
907
|
* that already exists in the map.
|
|
908
908
|
*/
|
|
909
|
-
addIn(
|
|
910
|
-
if (isEmptyPath(
|
|
909
|
+
addIn(path29, value) {
|
|
910
|
+
if (isEmptyPath(path29))
|
|
911
911
|
this.add(value);
|
|
912
912
|
else {
|
|
913
|
-
const [key, ...rest] =
|
|
913
|
+
const [key, ...rest] = path29;
|
|
914
914
|
const node2 = this.get(key, true);
|
|
915
915
|
if (identity2.isCollection(node2))
|
|
916
916
|
node2.addIn(rest, value);
|
|
@@ -924,8 +924,8 @@ var require_Collection = __commonJS({
|
|
|
924
924
|
* Removes a value from the collection.
|
|
925
925
|
* @returns `true` if the item was found and removed.
|
|
926
926
|
*/
|
|
927
|
-
deleteIn(
|
|
928
|
-
const [key, ...rest] =
|
|
927
|
+
deleteIn(path29) {
|
|
928
|
+
const [key, ...rest] = path29;
|
|
929
929
|
if (rest.length === 0)
|
|
930
930
|
return this.delete(key);
|
|
931
931
|
const node2 = this.get(key, true);
|
|
@@ -939,8 +939,8 @@ var require_Collection = __commonJS({
|
|
|
939
939
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
940
940
|
* `true` (collections are always returned intact).
|
|
941
941
|
*/
|
|
942
|
-
getIn(
|
|
943
|
-
const [key, ...rest] =
|
|
942
|
+
getIn(path29, keepScalar) {
|
|
943
|
+
const [key, ...rest] = path29;
|
|
944
944
|
const node2 = this.get(key, true);
|
|
945
945
|
if (rest.length === 0)
|
|
946
946
|
return !keepScalar && identity2.isScalar(node2) ? node2.value : node2;
|
|
@@ -958,8 +958,8 @@ var require_Collection = __commonJS({
|
|
|
958
958
|
/**
|
|
959
959
|
* Checks if the collection includes a value with the key `key`.
|
|
960
960
|
*/
|
|
961
|
-
hasIn(
|
|
962
|
-
const [key, ...rest] =
|
|
961
|
+
hasIn(path29) {
|
|
962
|
+
const [key, ...rest] = path29;
|
|
963
963
|
if (rest.length === 0)
|
|
964
964
|
return this.has(key);
|
|
965
965
|
const node2 = this.get(key, true);
|
|
@@ -969,8 +969,8 @@ var require_Collection = __commonJS({
|
|
|
969
969
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
970
970
|
* boolean to add/remove the item from the set.
|
|
971
971
|
*/
|
|
972
|
-
setIn(
|
|
973
|
-
const [key, ...rest] =
|
|
972
|
+
setIn(path29, value) {
|
|
973
|
+
const [key, ...rest] = path29;
|
|
974
974
|
if (rest.length === 0) {
|
|
975
975
|
this.set(key, value);
|
|
976
976
|
} else {
|
|
@@ -3485,9 +3485,9 @@ var require_Document = __commonJS({
|
|
|
3485
3485
|
this.contents.add(value);
|
|
3486
3486
|
}
|
|
3487
3487
|
/** Adds a value to the document. */
|
|
3488
|
-
addIn(
|
|
3488
|
+
addIn(path29, value) {
|
|
3489
3489
|
if (assertCollection(this.contents))
|
|
3490
|
-
this.contents.addIn(
|
|
3490
|
+
this.contents.addIn(path29, value);
|
|
3491
3491
|
}
|
|
3492
3492
|
/**
|
|
3493
3493
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3562,14 +3562,14 @@ var require_Document = __commonJS({
|
|
|
3562
3562
|
* Removes a value from the document.
|
|
3563
3563
|
* @returns `true` if the item was found and removed.
|
|
3564
3564
|
*/
|
|
3565
|
-
deleteIn(
|
|
3566
|
-
if (Collection.isEmptyPath(
|
|
3565
|
+
deleteIn(path29) {
|
|
3566
|
+
if (Collection.isEmptyPath(path29)) {
|
|
3567
3567
|
if (this.contents == null)
|
|
3568
3568
|
return false;
|
|
3569
3569
|
this.contents = null;
|
|
3570
3570
|
return true;
|
|
3571
3571
|
}
|
|
3572
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3572
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path29) : false;
|
|
3573
3573
|
}
|
|
3574
3574
|
/**
|
|
3575
3575
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3584,10 +3584,10 @@ var require_Document = __commonJS({
|
|
|
3584
3584
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3585
3585
|
* `true` (collections are always returned intact).
|
|
3586
3586
|
*/
|
|
3587
|
-
getIn(
|
|
3588
|
-
if (Collection.isEmptyPath(
|
|
3587
|
+
getIn(path29, keepScalar) {
|
|
3588
|
+
if (Collection.isEmptyPath(path29))
|
|
3589
3589
|
return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3590
|
-
return identity2.isCollection(this.contents) ? this.contents.getIn(
|
|
3590
|
+
return identity2.isCollection(this.contents) ? this.contents.getIn(path29, keepScalar) : void 0;
|
|
3591
3591
|
}
|
|
3592
3592
|
/**
|
|
3593
3593
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3598,10 +3598,10 @@ var require_Document = __commonJS({
|
|
|
3598
3598
|
/**
|
|
3599
3599
|
* Checks if the document includes a value at `path`.
|
|
3600
3600
|
*/
|
|
3601
|
-
hasIn(
|
|
3602
|
-
if (Collection.isEmptyPath(
|
|
3601
|
+
hasIn(path29) {
|
|
3602
|
+
if (Collection.isEmptyPath(path29))
|
|
3603
3603
|
return this.contents !== void 0;
|
|
3604
|
-
return identity2.isCollection(this.contents) ? this.contents.hasIn(
|
|
3604
|
+
return identity2.isCollection(this.contents) ? this.contents.hasIn(path29) : false;
|
|
3605
3605
|
}
|
|
3606
3606
|
/**
|
|
3607
3607
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3618,13 +3618,13 @@ var require_Document = __commonJS({
|
|
|
3618
3618
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3619
3619
|
* boolean to add/remove the item from the set.
|
|
3620
3620
|
*/
|
|
3621
|
-
setIn(
|
|
3622
|
-
if (Collection.isEmptyPath(
|
|
3621
|
+
setIn(path29, value) {
|
|
3622
|
+
if (Collection.isEmptyPath(path29)) {
|
|
3623
3623
|
this.contents = value;
|
|
3624
3624
|
} else if (this.contents == null) {
|
|
3625
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3625
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path29), value);
|
|
3626
3626
|
} else if (assertCollection(this.contents)) {
|
|
3627
|
-
this.contents.setIn(
|
|
3627
|
+
this.contents.setIn(path29, value);
|
|
3628
3628
|
}
|
|
3629
3629
|
}
|
|
3630
3630
|
/**
|
|
@@ -5585,9 +5585,9 @@ var require_cst_visit = __commonJS({
|
|
|
5585
5585
|
visit2.BREAK = BREAK;
|
|
5586
5586
|
visit2.SKIP = SKIP;
|
|
5587
5587
|
visit2.REMOVE = REMOVE;
|
|
5588
|
-
visit2.itemAtPath = (cst,
|
|
5588
|
+
visit2.itemAtPath = (cst, path29) => {
|
|
5589
5589
|
let item = cst;
|
|
5590
|
-
for (const [field, index] of
|
|
5590
|
+
for (const [field, index] of path29) {
|
|
5591
5591
|
const tok = item?.[field];
|
|
5592
5592
|
if (tok && "items" in tok) {
|
|
5593
5593
|
item = tok.items[index];
|
|
@@ -5596,23 +5596,23 @@ var require_cst_visit = __commonJS({
|
|
|
5596
5596
|
}
|
|
5597
5597
|
return item;
|
|
5598
5598
|
};
|
|
5599
|
-
visit2.parentCollection = (cst,
|
|
5600
|
-
const parent = visit2.itemAtPath(cst,
|
|
5601
|
-
const field =
|
|
5599
|
+
visit2.parentCollection = (cst, path29) => {
|
|
5600
|
+
const parent = visit2.itemAtPath(cst, path29.slice(0, -1));
|
|
5601
|
+
const field = path29[path29.length - 1][0];
|
|
5602
5602
|
const coll = parent?.[field];
|
|
5603
5603
|
if (coll && "items" in coll)
|
|
5604
5604
|
return coll;
|
|
5605
5605
|
throw new Error("Parent collection not found");
|
|
5606
5606
|
};
|
|
5607
|
-
function _visit(
|
|
5608
|
-
let ctrl = visitor(item,
|
|
5607
|
+
function _visit(path29, item, visitor) {
|
|
5608
|
+
let ctrl = visitor(item, path29);
|
|
5609
5609
|
if (typeof ctrl === "symbol")
|
|
5610
5610
|
return ctrl;
|
|
5611
5611
|
for (const field of ["key", "value"]) {
|
|
5612
5612
|
const token = item[field];
|
|
5613
5613
|
if (token && "items" in token) {
|
|
5614
5614
|
for (let i2 = 0; i2 < token.items.length; ++i2) {
|
|
5615
|
-
const ci = _visit(Object.freeze(
|
|
5615
|
+
const ci = _visit(Object.freeze(path29.concat([[field, i2]])), token.items[i2], visitor);
|
|
5616
5616
|
if (typeof ci === "number")
|
|
5617
5617
|
i2 = ci - 1;
|
|
5618
5618
|
else if (ci === BREAK)
|
|
@@ -5623,10 +5623,10 @@ var require_cst_visit = __commonJS({
|
|
|
5623
5623
|
}
|
|
5624
5624
|
}
|
|
5625
5625
|
if (typeof ctrl === "function" && field === "key")
|
|
5626
|
-
ctrl = ctrl(item,
|
|
5626
|
+
ctrl = ctrl(item, path29);
|
|
5627
5627
|
}
|
|
5628
5628
|
}
|
|
5629
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5629
|
+
return typeof ctrl === "function" ? ctrl(item, path29) : ctrl;
|
|
5630
5630
|
}
|
|
5631
5631
|
exports.visit = visit2;
|
|
5632
5632
|
}
|
|
@@ -6928,14 +6928,14 @@ var require_parser = __commonJS({
|
|
|
6928
6928
|
case "scalar":
|
|
6929
6929
|
case "single-quoted-scalar":
|
|
6930
6930
|
case "double-quoted-scalar": {
|
|
6931
|
-
const
|
|
6931
|
+
const fs20 = this.flowScalar(this.type);
|
|
6932
6932
|
if (atNextItem || it.value) {
|
|
6933
|
-
map2.items.push({ start, key:
|
|
6933
|
+
map2.items.push({ start, key: fs20, sep: [] });
|
|
6934
6934
|
this.onKeyLine = true;
|
|
6935
6935
|
} else if (it.sep) {
|
|
6936
|
-
this.stack.push(
|
|
6936
|
+
this.stack.push(fs20);
|
|
6937
6937
|
} else {
|
|
6938
|
-
Object.assign(it, { key:
|
|
6938
|
+
Object.assign(it, { key: fs20, sep: [] });
|
|
6939
6939
|
this.onKeyLine = true;
|
|
6940
6940
|
}
|
|
6941
6941
|
return;
|
|
@@ -7063,13 +7063,13 @@ var require_parser = __commonJS({
|
|
|
7063
7063
|
case "scalar":
|
|
7064
7064
|
case "single-quoted-scalar":
|
|
7065
7065
|
case "double-quoted-scalar": {
|
|
7066
|
-
const
|
|
7066
|
+
const fs20 = this.flowScalar(this.type);
|
|
7067
7067
|
if (!it || it.value)
|
|
7068
|
-
fc.items.push({ start: [], key:
|
|
7068
|
+
fc.items.push({ start: [], key: fs20, sep: [] });
|
|
7069
7069
|
else if (it.sep)
|
|
7070
|
-
this.stack.push(
|
|
7070
|
+
this.stack.push(fs20);
|
|
7071
7071
|
else
|
|
7072
|
-
Object.assign(it, { key:
|
|
7072
|
+
Object.assign(it, { key: fs20, sep: [] });
|
|
7073
7073
|
return;
|
|
7074
7074
|
}
|
|
7075
7075
|
case "flow-map-end":
|
|
@@ -8916,8 +8916,8 @@ var require_src = __commonJS({
|
|
|
8916
8916
|
});
|
|
8917
8917
|
|
|
8918
8918
|
// ../argent-cli/src/run.ts
|
|
8919
|
-
import * as
|
|
8920
|
-
import * as
|
|
8919
|
+
import * as fs13 from "node:fs";
|
|
8920
|
+
import * as path19 from "node:path";
|
|
8921
8921
|
|
|
8922
8922
|
// ../argent-tools-client/src/launcher.ts
|
|
8923
8923
|
import * as net from "node:net";
|
|
@@ -8935,6 +8935,7 @@ var LOCK_FILE = path.join(STATE_DIR, "tool-server.lock");
|
|
|
8935
8935
|
var AUTH_TOKEN_BYTES = 32;
|
|
8936
8936
|
var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
|
|
8937
8937
|
var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
|
|
8938
|
+
var AUTOSPAWN_HOST = "127.0.0.1";
|
|
8938
8939
|
function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
8939
8940
|
const env = {
|
|
8940
8941
|
...baseEnv,
|
|
@@ -8946,7 +8947,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
|
8946
8947
|
if (options.idleTimeoutMinutes !== void 0) {
|
|
8947
8948
|
env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
|
|
8948
8949
|
}
|
|
8949
|
-
|
|
8950
|
+
env[AUTH_TOKEN_ENV] = options.token ?? "";
|
|
8950
8951
|
if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
|
|
8951
8952
|
if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
|
|
8952
8953
|
return env;
|
|
@@ -9069,6 +9070,10 @@ function killSpawnedChild(child, pid) {
|
|
|
9069
9070
|
}
|
|
9070
9071
|
}
|
|
9071
9072
|
}
|
|
9073
|
+
function resolveToolsServerNode() {
|
|
9074
|
+
const { bun, deno, electron } = process.versions;
|
|
9075
|
+
return !(bun || deno || electron) && fs.existsSync(process.execPath) ? process.execPath : "node";
|
|
9076
|
+
}
|
|
9072
9077
|
function spawnToolsServer(paths, port, options = {}) {
|
|
9073
9078
|
return new Promise((resolve13, reject) => {
|
|
9074
9079
|
let logFd;
|
|
@@ -9078,8 +9083,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
9078
9083
|
} catch {
|
|
9079
9084
|
logFd = fs.openSync("/dev/null", "w");
|
|
9080
9085
|
}
|
|
9081
|
-
const
|
|
9082
|
-
const nodeBin = !(bun || deno || electron) && fs.existsSync(process.execPath) ? process.execPath : "node";
|
|
9086
|
+
const nodeBin = resolveToolsServerNode();
|
|
9083
9087
|
const child = spawn(nodeBin, [paths.bundlePath, "start"], {
|
|
9084
9088
|
detached: true,
|
|
9085
9089
|
stdio: ["ignore", "pipe", logFd],
|
|
@@ -9412,6 +9416,7 @@ async function ensureToolsServer(paths) {
|
|
|
9412
9416
|
const port = await findFreePort();
|
|
9413
9417
|
const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
|
|
9414
9418
|
token,
|
|
9419
|
+
host: AUTOSPAWN_HOST,
|
|
9415
9420
|
idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES
|
|
9416
9421
|
});
|
|
9417
9422
|
await writeState({
|
|
@@ -9420,11 +9425,11 @@ async function ensureToolsServer(paths) {
|
|
|
9420
9425
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9421
9426
|
bundlePath: paths.bundlePath,
|
|
9422
9427
|
version: diskVersion,
|
|
9423
|
-
host:
|
|
9428
|
+
host: AUTOSPAWN_HOST,
|
|
9424
9429
|
token,
|
|
9425
9430
|
managed: "autospawn"
|
|
9426
9431
|
});
|
|
9427
|
-
return { url: formatUrl(
|
|
9432
|
+
return { url: formatUrl(AUTOSPAWN_HOST, actualPort), token };
|
|
9428
9433
|
} finally {
|
|
9429
9434
|
lock?.release();
|
|
9430
9435
|
}
|
|
@@ -9477,6 +9482,11 @@ var FLAG_REGISTRY = [
|
|
|
9477
9482
|
name: "forward-secrets",
|
|
9478
9483
|
description: "Over `argent link` or ARGENT_TOOLS_URL, resolve each `{{secret:NAME}}` a call names on this machine and send the value with the call, so a remote tool-server can type a secret it does not hold. The linked tool-server then receives every secret of this machine that a call names, so link only one you trust with all of them. Values go only over https:// with the certificate checked, or to a loopback address. Off by default."
|
|
9479
9484
|
},
|
|
9485
|
+
{
|
|
9486
|
+
name: "ios-audio-always-inserted",
|
|
9487
|
+
description: "Insert the iOS audio hook (libArgentAudio.dylib) into every app an armed simulator launches, so audio-input works without restart-app. Dormant until the app opens audio. On by default; `argent disable ios-audio-always-inserted` inserts it only on the first audio tool call, for apps launched after that call.",
|
|
9488
|
+
defaultEnabled: true
|
|
9489
|
+
},
|
|
9480
9490
|
{
|
|
9481
9491
|
name: "video-watermark",
|
|
9482
9492
|
description: "Overlay the argent corner watermark on recorded screen videos. On by default; turn it off with `argent disable video-watermark`.",
|
|
@@ -9484,7 +9494,7 @@ var FLAG_REGISTRY = [
|
|
|
9484
9494
|
},
|
|
9485
9495
|
{
|
|
9486
9496
|
name: "macos-apps",
|
|
9487
|
-
description: "
|
|
9497
|
+
description: "Control native Mac apps, including Mac Catalyst. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. On by default; turn it off with `argent disable macos-apps`.",
|
|
9488
9498
|
defaultEnabled: true
|
|
9489
9499
|
}
|
|
9490
9500
|
];
|
|
@@ -9585,6 +9595,7 @@ function isFeatureEnabled(name, options = {}, registry2 = FLAG_REGISTRY) {
|
|
|
9585
9595
|
}
|
|
9586
9596
|
|
|
9587
9597
|
// ../configuration-core/src/paths.ts
|
|
9598
|
+
import * as fs3 from "node:fs";
|
|
9588
9599
|
import * as os from "node:os";
|
|
9589
9600
|
import * as path3 from "node:path";
|
|
9590
9601
|
function nonEmpty(value) {
|
|
@@ -9596,6 +9607,16 @@ function resolveHomeDir(options = {}) {
|
|
|
9596
9607
|
if (options.homeDir) return options.homeDir;
|
|
9597
9608
|
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
9598
9609
|
}
|
|
9610
|
+
function isHomeDir(dir, options = {}) {
|
|
9611
|
+
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
9612
|
+
}
|
|
9613
|
+
function canonicalPath(p) {
|
|
9614
|
+
try {
|
|
9615
|
+
return fs3.realpathSync.native(p);
|
|
9616
|
+
} catch {
|
|
9617
|
+
return path3.resolve(p);
|
|
9618
|
+
}
|
|
9619
|
+
}
|
|
9599
9620
|
function argentHomeDir() {
|
|
9600
9621
|
return path3.join(resolveHomeDir(), ".argent");
|
|
9601
9622
|
}
|
|
@@ -9612,11 +9633,11 @@ function configFilePath(scope = "global", options = {}) {
|
|
|
9612
9633
|
|
|
9613
9634
|
// ../configuration-core/src/config.ts
|
|
9614
9635
|
import * as crypto from "node:crypto";
|
|
9615
|
-
import * as
|
|
9636
|
+
import * as fs4 from "node:fs";
|
|
9616
9637
|
import * as path4 from "node:path";
|
|
9617
9638
|
function readConfigObject(scope = "global", options = {}) {
|
|
9618
9639
|
try {
|
|
9619
|
-
const raw =
|
|
9640
|
+
const raw = fs4.readFileSync(configFilePath(scope, options), "utf8");
|
|
9620
9641
|
const json2 = JSON.parse(raw);
|
|
9621
9642
|
if (json2 && typeof json2 === "object" && !Array.isArray(json2)) {
|
|
9622
9643
|
return json2;
|
|
@@ -9692,9 +9713,9 @@ function acquireConfigLock(finalPath) {
|
|
|
9692
9713
|
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
9693
9714
|
for (; ; ) {
|
|
9694
9715
|
try {
|
|
9695
|
-
const fd =
|
|
9716
|
+
const fd = fs4.openSync(lockPath, "wx", 384);
|
|
9696
9717
|
try {
|
|
9697
|
-
|
|
9718
|
+
fs4.writeSync(fd, `${process.pid}
|
|
9698
9719
|
`);
|
|
9699
9720
|
} catch {
|
|
9700
9721
|
}
|
|
@@ -9702,8 +9723,8 @@ function acquireConfigLock(finalPath) {
|
|
|
9702
9723
|
} catch (err) {
|
|
9703
9724
|
if (err.code !== "EEXIST") return null;
|
|
9704
9725
|
try {
|
|
9705
|
-
if (Date.now() -
|
|
9706
|
-
|
|
9726
|
+
if (Date.now() - fs4.statSync(lockPath).mtimeMs > LOCK_STALE_MS2) {
|
|
9727
|
+
fs4.unlinkSync(lockPath);
|
|
9707
9728
|
continue;
|
|
9708
9729
|
}
|
|
9709
9730
|
} catch {
|
|
@@ -9715,35 +9736,35 @@ function acquireConfigLock(finalPath) {
|
|
|
9715
9736
|
}
|
|
9716
9737
|
function releaseConfigLock(lock) {
|
|
9717
9738
|
try {
|
|
9718
|
-
|
|
9739
|
+
fs4.closeSync(lock.fd);
|
|
9719
9740
|
} catch {
|
|
9720
9741
|
}
|
|
9721
9742
|
try {
|
|
9722
|
-
|
|
9743
|
+
fs4.unlinkSync(lock.lockPath);
|
|
9723
9744
|
} catch {
|
|
9724
9745
|
}
|
|
9725
9746
|
}
|
|
9726
9747
|
function updateConfig(mutate, scope = "global", options = {}) {
|
|
9727
9748
|
const dir = configDir(scope, options);
|
|
9728
|
-
|
|
9749
|
+
fs4.mkdirSync(dir, { recursive: true });
|
|
9729
9750
|
const finalPath = configFilePath(scope, options);
|
|
9730
9751
|
const lock = acquireConfigLock(finalPath);
|
|
9731
9752
|
try {
|
|
9732
9753
|
const next = readConfigObject(scope, options);
|
|
9733
9754
|
mutate(next);
|
|
9734
9755
|
const tmpPath = path4.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
9735
|
-
const fd =
|
|
9756
|
+
const fd = fs4.openSync(tmpPath, "wx", 384);
|
|
9736
9757
|
try {
|
|
9737
|
-
|
|
9738
|
-
|
|
9758
|
+
fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
9759
|
+
fs4.fsyncSync(fd);
|
|
9739
9760
|
} finally {
|
|
9740
|
-
|
|
9761
|
+
fs4.closeSync(fd);
|
|
9741
9762
|
}
|
|
9742
9763
|
try {
|
|
9743
|
-
|
|
9764
|
+
fs4.renameSync(tmpPath, finalPath);
|
|
9744
9765
|
} catch (err) {
|
|
9745
9766
|
try {
|
|
9746
|
-
|
|
9767
|
+
fs4.unlinkSync(tmpPath);
|
|
9747
9768
|
} catch {
|
|
9748
9769
|
}
|
|
9749
9770
|
throw err;
|
|
@@ -9755,7 +9776,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
9755
9776
|
|
|
9756
9777
|
// ../configuration-core/src/secrets.ts
|
|
9757
9778
|
var import_dotenv = __toESM(require_dist2(), 1);
|
|
9758
|
-
import * as
|
|
9779
|
+
import * as fs5 from "node:fs";
|
|
9759
9780
|
import * as path5 from "node:path";
|
|
9760
9781
|
var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
|
|
9761
9782
|
var SECRETS_FILE_NAME = "secrets.env";
|
|
@@ -9785,10 +9806,10 @@ function fileSource(filePath, exposure) {
|
|
|
9785
9806
|
names: [],
|
|
9786
9807
|
values: /* @__PURE__ */ new Map()
|
|
9787
9808
|
};
|
|
9788
|
-
if (!
|
|
9809
|
+
if (!fs5.statSync(filePath, { throwIfNoEntry: false })) return absent;
|
|
9789
9810
|
let content;
|
|
9790
9811
|
try {
|
|
9791
|
-
content =
|
|
9812
|
+
content = fs5.readFileSync(filePath, "utf8");
|
|
9792
9813
|
} catch {
|
|
9793
9814
|
return absent;
|
|
9794
9815
|
}
|
|
@@ -9814,7 +9835,9 @@ function fileSource(filePath, exposure) {
|
|
|
9814
9835
|
}
|
|
9815
9836
|
function secretSources(options = {}) {
|
|
9816
9837
|
const sources = [envSource(options.env ?? process.env)];
|
|
9817
|
-
const
|
|
9838
|
+
const home = resolveHomeDir(options);
|
|
9839
|
+
const found = findProjectRoot(options.cwd ?? process.cwd());
|
|
9840
|
+
const projectRoot = found && isHomeDir(found, options) ? home : found;
|
|
9818
9841
|
const filePaths = [];
|
|
9819
9842
|
if (projectRoot) {
|
|
9820
9843
|
filePaths.push({
|
|
@@ -9826,7 +9849,7 @@ function secretSources(options = {}) {
|
|
|
9826
9849
|
}
|
|
9827
9850
|
}
|
|
9828
9851
|
filePaths.push({
|
|
9829
|
-
path: path5.join(
|
|
9852
|
+
path: path5.join(home, ".argent", SECRETS_FILE_NAME),
|
|
9830
9853
|
exposure: "dedicated"
|
|
9831
9854
|
});
|
|
9832
9855
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -9966,14 +9989,6 @@ var CONFIG_SCHEMA = [
|
|
|
9966
9989
|
// drained/reset, not just the file rewritten.
|
|
9967
9990
|
manageCommand: "argent telemetry"
|
|
9968
9991
|
},
|
|
9969
|
-
{
|
|
9970
|
-
key: "allowlist.enabled",
|
|
9971
|
-
description: "Whether `argent update` re-applies editor auto-approve allowlist rules. Unset (the default) keeps the current behavior: update refreshes the rules for editors that already have argent configured. Set to `false` to keep update from touching editor allowlists. `false` in either scope wins, so a committed project opt-out holds for every teammate.",
|
|
9972
|
-
scopes: ["project", "global"],
|
|
9973
|
-
parse: asBoolean,
|
|
9974
|
-
merge: "prioritize-restrictive",
|
|
9975
|
-
example: "false"
|
|
9976
|
-
},
|
|
9977
9992
|
{
|
|
9978
9993
|
key: "lens.agent",
|
|
9979
9994
|
description: "Coding-agent id remembered by `argent lens` to skip the picker.",
|
|
@@ -10159,6 +10174,7 @@ function unsetConfigValue(key, scope = "global", options = {}, registry2 = CONFI
|
|
|
10159
10174
|
return removed;
|
|
10160
10175
|
}
|
|
10161
10176
|
function listConfig(options = {}, registry2 = CONFIG_SCHEMA) {
|
|
10177
|
+
const projectIsHome = isHomeDir(resolveProjectRoot(options.cwd ?? process.cwd()), options);
|
|
10162
10178
|
return registry2.map((def) => ({
|
|
10163
10179
|
key: def.key,
|
|
10164
10180
|
description: def.description,
|
|
@@ -10167,7 +10183,7 @@ function listConfig(options = {}, registry2 = CONFIG_SCHEMA) {
|
|
|
10167
10183
|
...describeExpectedValue(def) ? { expected: describeExpectedValue(def) } : {},
|
|
10168
10184
|
...def.example ? { example: def.example } : {},
|
|
10169
10185
|
effective: getConfigValue(def, options),
|
|
10170
|
-
project: readScopeValue(def, "project", options),
|
|
10186
|
+
project: projectIsHome ? void 0 : readScopeValue(def, "project", options),
|
|
10171
10187
|
global: readScopeValue(def, "global", options)
|
|
10172
10188
|
}));
|
|
10173
10189
|
}
|
|
@@ -10220,7 +10236,18 @@ function interpolateFileInputPath(template, args) {
|
|
|
10220
10236
|
});
|
|
10221
10237
|
return missing ? null : out;
|
|
10222
10238
|
}
|
|
10223
|
-
var TOOL_FILE_EXTENSIONS = [
|
|
10239
|
+
var TOOL_FILE_EXTENSIONS = [
|
|
10240
|
+
".png",
|
|
10241
|
+
".yaml",
|
|
10242
|
+
".wav",
|
|
10243
|
+
".mp3",
|
|
10244
|
+
".m4a",
|
|
10245
|
+
".aac",
|
|
10246
|
+
".caf",
|
|
10247
|
+
".aif",
|
|
10248
|
+
".aiff",
|
|
10249
|
+
".flac"
|
|
10250
|
+
];
|
|
10224
10251
|
function hasToolFileExtension(file2) {
|
|
10225
10252
|
const name = file2.toLowerCase();
|
|
10226
10253
|
return TOOL_FILE_EXTENSIONS.some((extension) => name.endsWith(extension));
|
|
@@ -10234,16 +10261,16 @@ function toolStepFiles(specs, args) {
|
|
|
10234
10261
|
}
|
|
10235
10262
|
return files;
|
|
10236
10263
|
}
|
|
10237
|
-
function isClientFileArgument({ spec, path:
|
|
10238
|
-
return spec.kind === "file" && spec.path === `\${${spec.target}}` &&
|
|
10264
|
+
function isClientFileArgument({ spec, path: path29 }) {
|
|
10265
|
+
return spec.kind === "file" && spec.path === `\${${spec.target}}` && path29.startsWith("/") && hasToolFileExtension(path29);
|
|
10239
10266
|
}
|
|
10240
10267
|
|
|
10241
10268
|
// ../registry/src/flow-file-refs.ts
|
|
10242
|
-
import * as
|
|
10269
|
+
import * as fs7 from "node:fs/promises";
|
|
10243
10270
|
import * as path8 from "node:path";
|
|
10244
10271
|
|
|
10245
10272
|
// ../registry/src/e2e-dirs.ts
|
|
10246
|
-
import * as
|
|
10273
|
+
import * as fs6 from "node:fs/promises";
|
|
10247
10274
|
import * as path7 from "node:path";
|
|
10248
10275
|
var E2E_DIR = path7.join(".argent", "e2e");
|
|
10249
10276
|
var LEGACY_E2E_DIRS = Object.freeze([path7.join(".argent", "flows")]);
|
|
@@ -10258,7 +10285,7 @@ function e2eFileCandidates(projectRoot, name) {
|
|
|
10258
10285
|
return e2eDirsFor(projectRoot).map((dir) => path7.join(dir, `${name}.yaml`));
|
|
10259
10286
|
}
|
|
10260
10287
|
async function exists(file2) {
|
|
10261
|
-
return
|
|
10288
|
+
return fs6.stat(file2).then(
|
|
10262
10289
|
() => true,
|
|
10263
10290
|
() => false
|
|
10264
10291
|
);
|
|
@@ -10352,10 +10379,10 @@ function canonicalToolArgs(tool, args) {
|
|
|
10352
10379
|
// ../registry/src/flow-file-refs.ts
|
|
10353
10380
|
async function canonicalFlowPath(p) {
|
|
10354
10381
|
try {
|
|
10355
|
-
return await
|
|
10382
|
+
return await fs7.realpath(p);
|
|
10356
10383
|
} catch {
|
|
10357
10384
|
try {
|
|
10358
|
-
return path8.join(await
|
|
10385
|
+
return path8.join(await fs7.realpath(path8.dirname(p)), path8.basename(p));
|
|
10359
10386
|
} catch {
|
|
10360
10387
|
return p;
|
|
10361
10388
|
}
|
|
@@ -10401,15 +10428,15 @@ function collectFlowRequests(doc) {
|
|
|
10401
10428
|
if (isRecord(doc)) visit2(doc.steps, 0);
|
|
10402
10429
|
return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
|
|
10403
10430
|
}
|
|
10404
|
-
function baselineKeyFor(
|
|
10405
|
-
const stem = path8.basename(
|
|
10431
|
+
function baselineKeyFor(canonicalPath2, flowName) {
|
|
10432
|
+
const stem = path8.basename(canonicalPath2, ".yaml");
|
|
10406
10433
|
return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
|
|
10407
10434
|
}
|
|
10408
10435
|
function flowMemberKey(anchorDir, target) {
|
|
10409
10436
|
return `${anchorDir}\0${target}`;
|
|
10410
10437
|
}
|
|
10411
10438
|
async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
|
|
10412
|
-
const entries = await
|
|
10439
|
+
const entries = await fs7.readdir(dir).catch(() => null);
|
|
10413
10440
|
if (entries === null || entries.includes(base)) return { state: "listed" };
|
|
10414
10441
|
const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
|
|
10415
10442
|
if (actual === void 0) return { state: "absent" };
|
|
@@ -10638,6 +10665,7 @@ var FAILURE_CODES = {
|
|
|
10638
10665
|
DEBUGGER_CDP_PROTOCOL_ERROR: "DEBUGGER_CDP_PROTOCOL_ERROR",
|
|
10639
10666
|
DEBUGGER_CDP_CONNECT_FAILED: "DEBUGGER_CDP_CONNECT_FAILED",
|
|
10640
10667
|
DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN: "DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN",
|
|
10668
|
+
DEBUGGER_CDP_ORIGIN_REJECTED: "DEBUGGER_CDP_ORIGIN_REJECTED",
|
|
10641
10669
|
DEBUGGER_CDP_NOT_CONNECTED: "DEBUGGER_CDP_NOT_CONNECTED",
|
|
10642
10670
|
DEBUGGER_CDP_REQUEST_TIMEOUT: "DEBUGGER_CDP_REQUEST_TIMEOUT",
|
|
10643
10671
|
DEBUGGER_CDP_CONNECTION_CLOSED: "DEBUGGER_CDP_CONNECTION_CLOSED",
|
|
@@ -10712,6 +10740,32 @@ var FAILURE_CODES = {
|
|
|
10712
10740
|
NATIVE_PROFILER_PERFETTO_PROCESS_ERROR: "NATIVE_PROFILER_PERFETTO_PROCESS_ERROR",
|
|
10713
10741
|
NATIVE_PROFILER_PERFETTO_READY_TIMEOUT: "NATIVE_PROFILER_PERFETTO_READY_TIMEOUT",
|
|
10714
10742
|
NATIVE_PROFILER_PERFETTO_READY_EXITED: "NATIVE_PROFILER_PERFETTO_READY_EXITED",
|
|
10743
|
+
/**
|
|
10744
|
+
* native-profiler-launch-analysis. Input problems use TOOL_INPUT_INVALID and
|
|
10745
|
+
* devicectl steps IOS_DEVICECTL_COMMAND_FAILED.
|
|
10746
|
+
* @see [workflow.ts](../../tool-server/src/utils/ios-launch-time/workflow.ts)
|
|
10747
|
+
*/
|
|
10748
|
+
// Not macOS, or an Xcode that cannot record the launch on this target.
|
|
10749
|
+
LAUNCH_ANALYSIS_UNSUPPORTED_HOST: "LAUNCH_ANALYSIS_UNSUPPORTED_HOST",
|
|
10750
|
+
// No usable iPhone or simulator was selected, or Argent's runner holds it.
|
|
10751
|
+
LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE: "LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE",
|
|
10752
|
+
// The bundle_id app is not installed on the selected device.
|
|
10753
|
+
LAUNCH_ANALYSIS_APP_NOT_INSTALLED: "LAUNCH_ANALYSIS_APP_NOT_INSTALLED",
|
|
10754
|
+
// The runner's xcodebuild failed on code signing or provisioning.
|
|
10755
|
+
LAUNCH_ANALYSIS_SIGNING_FAILED: "LAUNCH_ANALYSIS_SIGNING_FAILED",
|
|
10756
|
+
// The iPhone's free developer profile has no slot for Argent's runner.
|
|
10757
|
+
LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT: "LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT",
|
|
10758
|
+
// simctl could not wait for boot, find, launch or terminate the app.
|
|
10759
|
+
LAUNCH_ANALYSIS_SIMCTL_FAILED: "LAUNCH_ANALYSIS_SIMCTL_FAILED",
|
|
10760
|
+
LAUNCH_ANALYSIS_RECORD_FAILED: "LAUNCH_ANALYSIS_RECORD_FAILED",
|
|
10761
|
+
// xctrace could not export the TOC, the CPU samples or the first-frame marker.
|
|
10762
|
+
LAUNCH_ANALYSIS_EXPORT_FAILED: "LAUNCH_ANALYSIS_EXPORT_FAILED",
|
|
10763
|
+
// The App Launch trace has no first frame of the app, so it has no launch window.
|
|
10764
|
+
LAUNCH_ANALYSIS_NO_FIRST_FRAME: "LAUNCH_ANALYSIS_NO_FIRST_FRAME",
|
|
10765
|
+
// The XCTest launch run of Argent's runner failed.
|
|
10766
|
+
LAUNCH_ANALYSIS_RUNNER_TEST_FAILED: "LAUNCH_ANALYSIS_RUNNER_TEST_FAILED",
|
|
10767
|
+
// The launch test ran, but Argent read no launch measurements from its result.
|
|
10768
|
+
LAUNCH_ANALYSIS_NO_SAMPLES: "LAUNCH_ANALYSIS_NO_SAMPLES",
|
|
10715
10769
|
// iOS and Android share one capture path (simulator-server frames into
|
|
10716
10770
|
// ffmpeg), so these name the failing stage, not the device family.
|
|
10717
10771
|
SCREEN_RECORDING_FACTORY_OPTIONS_MISSING: "SCREEN_RECORDING_FACTORY_OPTIONS_MISSING",
|
|
@@ -10726,6 +10780,19 @@ var FAILURE_CODES = {
|
|
|
10726
10780
|
SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
|
|
10727
10781
|
SCREEN_RECORDING_STREAM_UNAVAILABLE: "SCREEN_RECORDING_STREAM_UNAVAILABLE",
|
|
10728
10782
|
SCREEN_RECORDING_FFMPEG_NOT_FOUND: "SCREEN_RECORDING_FFMPEG_NOT_FOUND",
|
|
10783
|
+
// A cabled iPhone has no simulator-server: its frames come from a host-side
|
|
10784
|
+
// CoreMediaIO capture helper, which can fail in ways of its own.
|
|
10785
|
+
SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED",
|
|
10786
|
+
SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND: "SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND",
|
|
10787
|
+
SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED: "SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED",
|
|
10788
|
+
SCREEN_RECORDING_DEVICE_HELPER_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_FAILED",
|
|
10789
|
+
AUDIO_CLIP_CONVERSION_FAILED: "AUDIO_CLIP_CONVERSION_FAILED",
|
|
10790
|
+
AUDIO_HOOK_NOT_ACTIVE: "AUDIO_HOOK_NOT_ACTIVE",
|
|
10791
|
+
AUDIO_ENV_SETUP_FAILED: "AUDIO_ENV_SETUP_FAILED",
|
|
10792
|
+
AUDIO_WRONG_PLATFORM: "AUDIO_WRONG_PLATFORM",
|
|
10793
|
+
AUDIO_HOOK_UNAVAILABLE: "AUDIO_HOOK_UNAVAILABLE",
|
|
10794
|
+
AUDIO_INJECTION_NOT_OURS: "AUDIO_INJECTION_NOT_OURS",
|
|
10795
|
+
AUDIO_SIMULATOR_NOT_BOOTED: "AUDIO_SIMULATOR_NOT_BOOTED",
|
|
10729
10796
|
FLOW_PROJECT_ROOT_INVALID: "FLOW_PROJECT_ROOT_INVALID",
|
|
10730
10797
|
FLOW_NAME_INVALID: "FLOW_NAME_INVALID",
|
|
10731
10798
|
FLOW_NO_ACTIVE_RECORDING: "FLOW_NO_ACTIVE_RECORDING",
|
|
@@ -10789,6 +10856,8 @@ var FAILURE_CODES = {
|
|
|
10789
10856
|
MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
|
|
10790
10857
|
MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
|
|
10791
10858
|
MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
|
|
10859
|
+
/** The app's loaded Argent library lacks support for the requested operation. */
|
|
10860
|
+
MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
|
|
10792
10861
|
KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
|
|
10793
10862
|
KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
|
|
10794
10863
|
KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
|
|
@@ -10858,13 +10927,19 @@ var FAILURE_COMMANDS = [
|
|
|
10858
10927
|
"ax_service",
|
|
10859
10928
|
"simulator_server",
|
|
10860
10929
|
"ffmpeg",
|
|
10930
|
+
"afconvert",
|
|
10861
10931
|
"cdp",
|
|
10862
10932
|
"electron",
|
|
10863
10933
|
"npm",
|
|
10864
10934
|
"npx",
|
|
10865
10935
|
"unknown",
|
|
10866
10936
|
"devicectl",
|
|
10867
|
-
"xcodebuild"
|
|
10937
|
+
"xcodebuild",
|
|
10938
|
+
"swiftc",
|
|
10939
|
+
// The host-side helper that captures a cabled iPhone's screen.
|
|
10940
|
+
"ios_screen_stream",
|
|
10941
|
+
// `xcrun xcresulttool`, which reads an XCTest result bundle.
|
|
10942
|
+
"xcresulttool"
|
|
10868
10943
|
];
|
|
10869
10944
|
var FAILURE_SIGNAL_NAMES = [
|
|
10870
10945
|
"SIGABRT",
|
|
@@ -11708,10 +11783,10 @@ function mergeDefs(...defs) {
|
|
|
11708
11783
|
function cloneDef(schema) {
|
|
11709
11784
|
return mergeDefs(schema._zod.def);
|
|
11710
11785
|
}
|
|
11711
|
-
function getElementAtPath(obj,
|
|
11712
|
-
if (!
|
|
11786
|
+
function getElementAtPath(obj, path29) {
|
|
11787
|
+
if (!path29)
|
|
11713
11788
|
return obj;
|
|
11714
|
-
return
|
|
11789
|
+
return path29.reduce((acc, key) => acc?.[key], obj);
|
|
11715
11790
|
}
|
|
11716
11791
|
function promiseAllObject(promisesObj) {
|
|
11717
11792
|
const keys = Object.keys(promisesObj);
|
|
@@ -12051,11 +12126,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
12051
12126
|
}
|
|
12052
12127
|
return false;
|
|
12053
12128
|
}
|
|
12054
|
-
function prefixIssues(
|
|
12129
|
+
function prefixIssues(path29, issues) {
|
|
12055
12130
|
return issues.map((iss) => {
|
|
12056
12131
|
var _a3;
|
|
12057
12132
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
12058
|
-
iss.path.unshift(
|
|
12133
|
+
iss.path.unshift(path29);
|
|
12059
12134
|
return iss;
|
|
12060
12135
|
});
|
|
12061
12136
|
}
|
|
@@ -12517,16 +12592,16 @@ function flattenError(error63, mapper = (issue2) => issue2.message) {
|
|
|
12517
12592
|
}
|
|
12518
12593
|
function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
12519
12594
|
const fieldErrors = { _errors: [] };
|
|
12520
|
-
const processError = (error64,
|
|
12595
|
+
const processError = (error64, path29 = []) => {
|
|
12521
12596
|
for (const issue2 of error64.issues) {
|
|
12522
12597
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
12523
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
12598
|
+
issue2.errors.map((issues) => processError({ issues }, [...path29, ...issue2.path]));
|
|
12524
12599
|
} else if (issue2.code === "invalid_key") {
|
|
12525
|
-
processError({ issues: issue2.issues }, [...
|
|
12600
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
12526
12601
|
} else if (issue2.code === "invalid_element") {
|
|
12527
|
-
processError({ issues: issue2.issues }, [...
|
|
12602
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
12528
12603
|
} else {
|
|
12529
|
-
const fullpath = [...
|
|
12604
|
+
const fullpath = [...path29, ...issue2.path];
|
|
12530
12605
|
if (fullpath.length === 0) {
|
|
12531
12606
|
fieldErrors._errors.push(mapper(issue2));
|
|
12532
12607
|
} else {
|
|
@@ -12565,17 +12640,17 @@ function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
|
12565
12640
|
}
|
|
12566
12641
|
function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
12567
12642
|
const result = { errors: [] };
|
|
12568
|
-
const processError = (error64,
|
|
12643
|
+
const processError = (error64, path29 = []) => {
|
|
12569
12644
|
var _a3;
|
|
12570
12645
|
for (const issue2 of error64.issues) {
|
|
12571
12646
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
12572
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
12647
|
+
issue2.errors.map((issues) => processError({ issues }, [...path29, ...issue2.path]));
|
|
12573
12648
|
} else if (issue2.code === "invalid_key") {
|
|
12574
|
-
processError({ issues: issue2.issues }, [...
|
|
12649
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
12575
12650
|
} else if (issue2.code === "invalid_element") {
|
|
12576
|
-
processError({ issues: issue2.issues }, [...
|
|
12651
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
12577
12652
|
} else {
|
|
12578
|
-
const fullpath = [...
|
|
12653
|
+
const fullpath = [...path29, ...issue2.path];
|
|
12579
12654
|
if (fullpath.length === 0) {
|
|
12580
12655
|
result.errors.push(mapper(issue2));
|
|
12581
12656
|
continue;
|
|
@@ -12614,8 +12689,8 @@ function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
|
12614
12689
|
}
|
|
12615
12690
|
function toDotPath(_path) {
|
|
12616
12691
|
const segs = [];
|
|
12617
|
-
const
|
|
12618
|
-
for (const seg of
|
|
12692
|
+
const path29 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
12693
|
+
for (const seg of path29) {
|
|
12619
12694
|
if (typeof seg === "number")
|
|
12620
12695
|
segs.push(`[${seg}]`);
|
|
12621
12696
|
else if (typeof seg === "symbol")
|
|
@@ -29753,13 +29828,13 @@ function resolveRef(ref, ctx) {
|
|
|
29753
29828
|
if (!ref.startsWith("#")) {
|
|
29754
29829
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
29755
29830
|
}
|
|
29756
|
-
const
|
|
29757
|
-
if (
|
|
29831
|
+
const path29 = ref.slice(1).split("/").filter(Boolean);
|
|
29832
|
+
if (path29.length === 0) {
|
|
29758
29833
|
return ctx.rootSchema;
|
|
29759
29834
|
}
|
|
29760
29835
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
29761
|
-
if (
|
|
29762
|
-
const key =
|
|
29836
|
+
if (path29[0] === defsKey) {
|
|
29837
|
+
const key = path29[1] === void 0 ? void 0 : decodeJSONPointerSegment(path29[1]);
|
|
29763
29838
|
if (!key || !ctx.defs[key]) {
|
|
29764
29839
|
throw new Error(`Reference not found: ${ref}`);
|
|
29765
29840
|
}
|
|
@@ -30612,9 +30687,9 @@ function date4(params) {
|
|
|
30612
30687
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
30613
30688
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
30614
30689
|
var resolvedDuringInvocation = new AsyncLocalStorage();
|
|
30615
|
-
function valueAtPath(root,
|
|
30690
|
+
function valueAtPath(root, path29) {
|
|
30616
30691
|
let current = root;
|
|
30617
|
-
for (const key of
|
|
30692
|
+
for (const key of path29) {
|
|
30618
30693
|
if (current === null || typeof current !== "object") return void 0;
|
|
30619
30694
|
if (!Object.hasOwn(current, key)) return void 0;
|
|
30620
30695
|
current = current[key];
|
|
@@ -30774,8 +30849,8 @@ function parseLinkTarget(input2) {
|
|
|
30774
30849
|
const host = u3.hostname.startsWith("[") ? u3.hostname.slice(1, -1) : u3.hostname;
|
|
30775
30850
|
if (!host) throw new Error(`URL "${input2}" is missing a host.`);
|
|
30776
30851
|
const port = u3.port ? Number(u3.port) : u3.protocol === "https:" ? 443 : 80;
|
|
30777
|
-
const
|
|
30778
|
-
const url2 = `${u3.protocol}//${u3.host}${
|
|
30852
|
+
const path29 = u3.pathname === "/" ? "" : u3.pathname.replace(/\/+$/, "");
|
|
30853
|
+
const url2 = `${u3.protocol}//${u3.host}${path29}`;
|
|
30779
30854
|
const token = u3.username ? decodeURIComponent(u3.username) : void 0;
|
|
30780
30855
|
return { url: url2, host, port, ...token ? { token } : {} };
|
|
30781
30856
|
}
|
|
@@ -30802,7 +30877,7 @@ import { spawn as spawn2 } from "node:child_process";
|
|
|
30802
30877
|
import { once } from "node:events";
|
|
30803
30878
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
30804
30879
|
import { open as open2, rm, readdir as readdir3 } from "node:fs/promises";
|
|
30805
|
-
import { basename as basename4, dirname as dirname5, join as join9, resolve as
|
|
30880
|
+
import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve7, sep as sep2 } from "node:path";
|
|
30806
30881
|
import { Writable } from "node:stream";
|
|
30807
30882
|
import { pipeline } from "node:stream/promises";
|
|
30808
30883
|
import zlib from "node:zlib";
|
|
@@ -30900,7 +30975,7 @@ async function sniffFormat(archivePath) {
|
|
|
30900
30975
|
}
|
|
30901
30976
|
}
|
|
30902
30977
|
var ZSTD_FRAME_MAGIC = 4247762216;
|
|
30903
|
-
async function assertSingleCompleteZstdFrame(archivePath) {
|
|
30978
|
+
async function assertSingleCompleteZstdFrame(archivePath, signal) {
|
|
30904
30979
|
const fh = await open2(archivePath, "r");
|
|
30905
30980
|
try {
|
|
30906
30981
|
const { size } = await fh.stat();
|
|
@@ -30910,6 +30985,7 @@ async function assertSingleCompleteZstdFrame(archivePath) {
|
|
|
30910
30985
|
let pos = 0;
|
|
30911
30986
|
const read = async (n3) => {
|
|
30912
30987
|
if (pos < windowStart || pos + n3 > windowEnd) {
|
|
30988
|
+
signal?.throwIfAborted();
|
|
30913
30989
|
const { bytesRead } = await fh.read(window2, 0, window2.length, pos);
|
|
30914
30990
|
windowStart = pos;
|
|
30915
30991
|
windowEnd = pos + bytesRead;
|
|
@@ -30947,14 +31023,16 @@ function tarEnv(env) {
|
|
|
30947
31023
|
const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
|
|
30948
31024
|
return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
|
|
30949
31025
|
}
|
|
30950
|
-
async function runTar(archive, args) {
|
|
31026
|
+
async function runTar(archive, args, signal) {
|
|
30951
31027
|
const child = spawn2("tar", [...args, "-f", "-"], {
|
|
31028
|
+
signal,
|
|
30952
31029
|
env: tarEnv(process.env)
|
|
30953
31030
|
});
|
|
30954
|
-
|
|
30955
|
-
|
|
30956
|
-
|
|
31031
|
+
let childError;
|
|
31032
|
+
child.on("error", (err) => {
|
|
31033
|
+
childError = err;
|
|
30957
31034
|
});
|
|
31035
|
+
const closed = new Promise((resolve13) => child.once("close", resolve13));
|
|
30958
31036
|
const stdout2 = collect(child.stdout, MAX_LISTING_BYTES, {
|
|
30959
31037
|
maxLines: MAX_LISTING_LINES,
|
|
30960
31038
|
onOverflow: () => child.kill()
|
|
@@ -30981,12 +31059,15 @@ async function runTar(archive, args) {
|
|
|
30981
31059
|
if (err) child.stdin?.destroy();
|
|
30982
31060
|
done(err);
|
|
30983
31061
|
}
|
|
30984
|
-
})
|
|
31062
|
+
}),
|
|
31063
|
+
{ signal }
|
|
30985
31064
|
).then(
|
|
30986
31065
|
() => null,
|
|
30987
31066
|
(err) => err
|
|
30988
31067
|
);
|
|
30989
|
-
const [code, feedError] = await Promise.all([
|
|
31068
|
+
const [code, feedError] = await Promise.all([closed, fed]);
|
|
31069
|
+
signal?.throwIfAborted();
|
|
31070
|
+
if (childError) throw childError;
|
|
30990
31071
|
if (stdout2.overflowed()) {
|
|
30991
31072
|
throw new Error(
|
|
30992
31073
|
`tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
|
|
@@ -31000,32 +31081,33 @@ async function runTar(archive, args) {
|
|
|
31000
31081
|
function normalizeTarMemberPath(memberPath) {
|
|
31001
31082
|
return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
31002
31083
|
}
|
|
31003
|
-
function isContainedPath(
|
|
31004
|
-
const slashed =
|
|
31084
|
+
function isContainedPath(path29, windows = process.platform === "win32") {
|
|
31085
|
+
const slashed = path29.replace(/\\/g, "/");
|
|
31005
31086
|
const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
|
|
31006
31087
|
return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
|
|
31007
31088
|
}
|
|
31008
31089
|
function isSafeTarMember(memberPath, destDir) {
|
|
31009
31090
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
31010
31091
|
if (!isContainedPath(normalized)) return false;
|
|
31011
|
-
const root =
|
|
31012
|
-
return
|
|
31092
|
+
const root = resolve7(destDir);
|
|
31093
|
+
return resolve7(destDir, normalized).startsWith(root + sep2);
|
|
31013
31094
|
}
|
|
31014
|
-
async function readListing(archive, args) {
|
|
31095
|
+
async function readListing(archive, args, signal) {
|
|
31015
31096
|
try {
|
|
31016
|
-
return await runTar(archive, args);
|
|
31097
|
+
return await runTar(archive, args, signal);
|
|
31017
31098
|
} catch (err) {
|
|
31099
|
+
signal?.throwIfAborted();
|
|
31018
31100
|
throw new ArchiveError(
|
|
31019
31101
|
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
31020
31102
|
);
|
|
31021
31103
|
}
|
|
31022
31104
|
}
|
|
31023
|
-
async function listTarMembers(archive) {
|
|
31024
|
-
const stdout2 = await readListing(archive, ["-t"]);
|
|
31105
|
+
async function listTarMembers(archive, signal) {
|
|
31106
|
+
const stdout2 = await readListing(archive, ["-t"], signal);
|
|
31025
31107
|
return stdout2.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
31026
31108
|
}
|
|
31027
|
-
async function assertSafeMemberTypes(archive) {
|
|
31028
|
-
const stdout2 = await readListing(archive, ["-tv"]);
|
|
31109
|
+
async function assertSafeMemberTypes(archive, signal) {
|
|
31110
|
+
const stdout2 = await readListing(archive, ["-tv"], signal);
|
|
31029
31111
|
for (const line of stdout2.split("\n")) {
|
|
31030
31112
|
if (!line.trim()) continue;
|
|
31031
31113
|
const type = line[0];
|
|
@@ -31045,8 +31127,8 @@ async function assertSafeMemberTypes(archive) {
|
|
|
31045
31127
|
);
|
|
31046
31128
|
}
|
|
31047
31129
|
}
|
|
31048
|
-
async function assertSafeArchive(archive, destDir) {
|
|
31049
|
-
const members2 = await listTarMembers(archive);
|
|
31130
|
+
async function assertSafeArchive(archive, destDir, signal) {
|
|
31131
|
+
const members2 = await listTarMembers(archive, signal);
|
|
31050
31132
|
if (members2.length === 0) {
|
|
31051
31133
|
throw new ArchiveError("Archive is empty.");
|
|
31052
31134
|
}
|
|
@@ -31055,7 +31137,7 @@ async function assertSafeArchive(archive, destDir) {
|
|
|
31055
31137
|
throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
|
|
31056
31138
|
}
|
|
31057
31139
|
}
|
|
31058
|
-
await assertSafeMemberTypes(archive);
|
|
31140
|
+
await assertSafeMemberTypes(archive, signal);
|
|
31059
31141
|
}
|
|
31060
31142
|
async function resolveMember(destDir, expectedName) {
|
|
31061
31143
|
const entries = await readdir3(destDir);
|
|
@@ -31070,19 +31152,24 @@ async function resolveMember(destDir, expectedName) {
|
|
|
31070
31152
|
}
|
|
31071
31153
|
return join9(destDir, real[0]);
|
|
31072
31154
|
}
|
|
31073
|
-
async function safeExtractArchive(archivePath, destDir, expectedName) {
|
|
31155
|
+
async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
|
|
31156
|
+
signal?.throwIfAborted();
|
|
31074
31157
|
let archive;
|
|
31075
31158
|
try {
|
|
31076
31159
|
archive = { path: archivePath, format: await sniffFormat(archivePath) };
|
|
31077
|
-
if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
|
|
31160
|
+
if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath, signal);
|
|
31078
31161
|
} catch (err) {
|
|
31162
|
+
signal?.throwIfAborted();
|
|
31079
31163
|
throw new ArchiveError(
|
|
31080
31164
|
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
31081
31165
|
);
|
|
31082
31166
|
}
|
|
31083
|
-
await assertSafeArchive(archive, destDir);
|
|
31084
|
-
|
|
31085
|
-
|
|
31167
|
+
await assertSafeArchive(archive, destDir, signal);
|
|
31168
|
+
signal?.throwIfAborted();
|
|
31169
|
+
await runTar(archive, ["-x", "-C", destDir], signal);
|
|
31170
|
+
const member = await resolveMember(destDir, expectedName);
|
|
31171
|
+
signal?.throwIfAborted();
|
|
31172
|
+
return member;
|
|
31086
31173
|
}
|
|
31087
31174
|
|
|
31088
31175
|
// ../argent-tools-client/src/errors.ts
|
|
@@ -31159,10 +31246,10 @@ function untrackArchive(archive) {
|
|
|
31159
31246
|
for (const s of ARCHIVE_SIGNALS) process.removeListener(s, removeArchivesOnSignal);
|
|
31160
31247
|
process.removeListener("exit", removePendingArchives);
|
|
31161
31248
|
}
|
|
31162
|
-
function sha256File(filePath) {
|
|
31249
|
+
function sha256File(filePath, signal) {
|
|
31163
31250
|
return new Promise((resolve13, reject) => {
|
|
31164
31251
|
const hash2 = createHash2("sha256");
|
|
31165
|
-
createReadStream2(filePath).on("data", (chunk) => hash2.update(chunk)).on("end", () => resolve13(hash2.digest("hex"))).on("error", reject);
|
|
31252
|
+
createReadStream2(filePath, { signal }).on("data", (chunk) => hash2.update(chunk)).on("end", () => resolve13(hash2.digest("hex"))).on("error", reject);
|
|
31166
31253
|
});
|
|
31167
31254
|
}
|
|
31168
31255
|
function toolServerError(text2) {
|
|
@@ -31225,7 +31312,7 @@ async function uploadFile(sourcePath, endpoint, signal) {
|
|
|
31225
31312
|
trackArchive(tarPath);
|
|
31226
31313
|
try {
|
|
31227
31314
|
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
31228
|
-
const contentHash = await sha256File(tarPath);
|
|
31315
|
+
const contentHash = await sha256File(tarPath, signal);
|
|
31229
31316
|
return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
|
|
31230
31317
|
} finally {
|
|
31231
31318
|
untrackArchive(tarPath);
|
|
@@ -32268,10 +32355,19 @@ function createToolsClient(options = {}) {
|
|
|
32268
32355
|
}
|
|
32269
32356
|
|
|
32270
32357
|
// ../argent-tools-client/src/artifacts.ts
|
|
32271
|
-
import {
|
|
32358
|
+
import {
|
|
32359
|
+
copyFile,
|
|
32360
|
+
mkdir as mkdir4,
|
|
32361
|
+
mkdtemp,
|
|
32362
|
+
readFile as readFile6,
|
|
32363
|
+
realpath as realpath4,
|
|
32364
|
+
rm as rm3,
|
|
32365
|
+
stat as stat5,
|
|
32366
|
+
writeFile as writeFile4
|
|
32367
|
+
} from "node:fs/promises";
|
|
32272
32368
|
import { constants as fsConstants } from "node:fs";
|
|
32273
32369
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
32274
|
-
import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as
|
|
32370
|
+
import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve9, sep as sep4 } from "node:path";
|
|
32275
32371
|
import { createHash as createHash3 } from "node:crypto";
|
|
32276
32372
|
var ARTIFACT_MARKER2 = "__argentArtifact";
|
|
32277
32373
|
function isArtifactHandle(value) {
|
|
@@ -32320,7 +32416,7 @@ function configuredRecordingsDir() {
|
|
|
32320
32416
|
if (trimmed === "") return null;
|
|
32321
32417
|
const home = dirname9(argentHomeDir());
|
|
32322
32418
|
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep4}`) ? join13(home, trimmed.slice(2)) : trimmed;
|
|
32323
|
-
return
|
|
32419
|
+
return resolve9(durableBaseDir(), expanded);
|
|
32324
32420
|
}
|
|
32325
32421
|
var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
|
|
32326
32422
|
async function readCapped(res, cap) {
|
|
@@ -32353,10 +32449,10 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
32353
32449
|
const stem = filename.slice(0, filename.length - ext.length);
|
|
32354
32450
|
for (let i2 = 1; i2 <= 1e3; i2++) {
|
|
32355
32451
|
const candidate = i2 === 1 ? filename : `${stem} (${i2})${ext}`;
|
|
32356
|
-
const
|
|
32452
|
+
const path29 = join13(dir, candidate);
|
|
32357
32453
|
try {
|
|
32358
|
-
await write(
|
|
32359
|
-
return
|
|
32454
|
+
await write(path29);
|
|
32455
|
+
return path29;
|
|
32360
32456
|
} catch (err) {
|
|
32361
32457
|
if (err?.code === "EEXIST") continue;
|
|
32362
32458
|
throw err;
|
|
@@ -32412,16 +32508,22 @@ async function resolveLocalFile(handle) {
|
|
|
32412
32508
|
return null;
|
|
32413
32509
|
}
|
|
32414
32510
|
}
|
|
32415
|
-
async function downloadAndExtractArchive(handle, data, dir) {
|
|
32416
|
-
|
|
32511
|
+
async function downloadAndExtractArchive(handle, data, dir, signal) {
|
|
32512
|
+
signal?.throwIfAborted();
|
|
32513
|
+
const attemptDir = await mkdtemp(join13(dir, "bundle-"));
|
|
32514
|
+
const tarball = join13(attemptDir, "download.tar");
|
|
32515
|
+
const extractDir = join13(attemptDir, "files");
|
|
32417
32516
|
try {
|
|
32418
|
-
await writeFile4(tarball, data);
|
|
32419
|
-
|
|
32517
|
+
await writeFile4(tarball, data, { signal });
|
|
32518
|
+
await mkdir4(extractDir);
|
|
32519
|
+
const member = await safeExtractArchive(tarball, extractDir, handle.filename, signal);
|
|
32520
|
+
await rm3(tarball);
|
|
32521
|
+
signal?.throwIfAborted();
|
|
32522
|
+
return member;
|
|
32420
32523
|
} catch {
|
|
32421
|
-
|
|
32422
|
-
} finally {
|
|
32423
|
-
await rm3(tarball, { force: true }).catch(() => {
|
|
32524
|
+
await rm3(attemptDir, { recursive: true, force: true }).catch(() => {
|
|
32424
32525
|
});
|
|
32526
|
+
return null;
|
|
32425
32527
|
}
|
|
32426
32528
|
}
|
|
32427
32529
|
async function materializeArtifacts(result, ctx) {
|
|
@@ -32507,7 +32609,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
32507
32609
|
if (!data) return null;
|
|
32508
32610
|
await ensureDir();
|
|
32509
32611
|
if (value.archive === "tar.gz") {
|
|
32510
|
-
return await downloadAndExtractArchive(value, data, dir);
|
|
32612
|
+
return await downloadAndExtractArchive(value, data, dir, ctx.signal);
|
|
32511
32613
|
}
|
|
32512
32614
|
if (value.size > 0 && data.length !== value.size) return null;
|
|
32513
32615
|
const downloadedPath = join13(dir, sanitizeSegment(value.filename));
|
|
@@ -34965,7 +35067,7 @@ function getSharedConfigurationFromEnvironment(signalIdentifier) {
|
|
|
34965
35067
|
init_esm();
|
|
34966
35068
|
|
|
34967
35069
|
// ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-node-http-env-configuration.js
|
|
34968
|
-
import * as
|
|
35070
|
+
import * as fs8 from "fs";
|
|
34969
35071
|
import * as path13 from "path";
|
|
34970
35072
|
init_esm();
|
|
34971
35073
|
function getStaticHeadersFromEnv(signalIdentifier) {
|
|
@@ -34987,7 +35089,7 @@ function appendRootPathToUrlIfNeeded(url2) {
|
|
|
34987
35089
|
return void 0;
|
|
34988
35090
|
}
|
|
34989
35091
|
}
|
|
34990
|
-
function appendResourcePathToUrl(url2,
|
|
35092
|
+
function appendResourcePathToUrl(url2, path29) {
|
|
34991
35093
|
try {
|
|
34992
35094
|
new URL(url2);
|
|
34993
35095
|
} catch {
|
|
@@ -34997,11 +35099,11 @@ function appendResourcePathToUrl(url2, path25) {
|
|
|
34997
35099
|
if (!url2.endsWith("/")) {
|
|
34998
35100
|
url2 = url2 + "/";
|
|
34999
35101
|
}
|
|
35000
|
-
url2 +=
|
|
35102
|
+
url2 += path29;
|
|
35001
35103
|
try {
|
|
35002
35104
|
new URL(url2);
|
|
35003
35105
|
} catch {
|
|
35004
|
-
diag2.warn(`Configuration: Provided URL appended with '${
|
|
35106
|
+
diag2.warn(`Configuration: Provided URL appended with '${path29}' is not a valid URL, using 'undefined' instead of '${url2}'`);
|
|
35005
35107
|
return void 0;
|
|
35006
35108
|
}
|
|
35007
35109
|
return url2;
|
|
@@ -35026,7 +35128,7 @@ function readFileFromEnv(signalSpecificEnvVar, nonSignalSpecificEnvVar, warningM
|
|
|
35026
35128
|
const filePath = signalSpecificPath ?? nonSignalSpecificPath;
|
|
35027
35129
|
if (filePath != null) {
|
|
35028
35130
|
try {
|
|
35029
|
-
return
|
|
35131
|
+
return fs8.readFileSync(path13.resolve(process.cwd(), filePath));
|
|
35030
35132
|
} catch {
|
|
35031
35133
|
diag2.warn(warningMessage);
|
|
35032
35134
|
return void 0;
|
|
@@ -35112,7 +35214,7 @@ var OTLPLogExporter = class extends OTLPExporterBase {
|
|
|
35112
35214
|
init_esm();
|
|
35113
35215
|
|
|
35114
35216
|
// ../telemetry/src/debug.ts
|
|
35115
|
-
import * as
|
|
35217
|
+
import * as fs9 from "node:fs";
|
|
35116
35218
|
|
|
35117
35219
|
// ../telemetry/src/paths.ts
|
|
35118
35220
|
import * as path14 from "node:path";
|
|
@@ -35150,8 +35252,8 @@ function emitDebugPayload(payload) {
|
|
|
35150
35252
|
} catch {
|
|
35151
35253
|
}
|
|
35152
35254
|
try {
|
|
35153
|
-
|
|
35154
|
-
|
|
35255
|
+
fs9.mkdirSync(argentHomeDir(), { recursive: true });
|
|
35256
|
+
fs9.appendFileSync(debugLogPath(), line + "\n");
|
|
35155
35257
|
} catch {
|
|
35156
35258
|
}
|
|
35157
35259
|
}
|
|
@@ -35337,7 +35439,8 @@ var DEVICE_KINDS = [
|
|
|
35337
35439
|
"emulator",
|
|
35338
35440
|
"vvd",
|
|
35339
35441
|
"device",
|
|
35340
|
-
"app"
|
|
35442
|
+
"app",
|
|
35443
|
+
"catalyst"
|
|
35341
35444
|
];
|
|
35342
35445
|
var DEBUGGER_NOT_CONNECTED_REASONS = [
|
|
35343
35446
|
"metro_not_running",
|
|
@@ -35475,7 +35578,8 @@ var ALLOWED = {
|
|
|
35475
35578
|
install_mode: INSTALL_MODE
|
|
35476
35579
|
},
|
|
35477
35580
|
"installation:allowlist_decision": {
|
|
35478
|
-
is_enabled: bool
|
|
35581
|
+
is_enabled: bool,
|
|
35582
|
+
decided_by: oneOf(["flag", "default", "prompt"])
|
|
35479
35583
|
},
|
|
35480
35584
|
"installation:stale_config_cleanup": {
|
|
35481
35585
|
removed_count: COUNT,
|
|
@@ -35662,9 +35766,9 @@ function isReplitAgent(env) {
|
|
|
35662
35766
|
}
|
|
35663
35767
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
35664
35768
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
35665
|
-
function safeExists(fileExists,
|
|
35769
|
+
function safeExists(fileExists, path29) {
|
|
35666
35770
|
try {
|
|
35667
|
-
return fileExists(
|
|
35771
|
+
return fileExists(path29);
|
|
35668
35772
|
} catch {
|
|
35669
35773
|
return false;
|
|
35670
35774
|
}
|
|
@@ -36079,13 +36183,12 @@ function isCi(env = process.env) {
|
|
|
36079
36183
|
if (GENERIC_CI_ENV_VARS.some((name) => Boolean(env[name]))) return true;
|
|
36080
36184
|
return isKnownVendorCi(env);
|
|
36081
36185
|
}
|
|
36082
|
-
var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
36083
36186
|
|
|
36084
36187
|
// ../telemetry/src/base-props.ts
|
|
36085
36188
|
var SESSION_ID2 = randomUUID5();
|
|
36086
36189
|
function readCliVersion() {
|
|
36087
36190
|
if (true) {
|
|
36088
|
-
return "0.34.1-next.
|
|
36191
|
+
return "0.34.1-next.30";
|
|
36089
36192
|
}
|
|
36090
36193
|
return "0.0.0";
|
|
36091
36194
|
}
|
|
@@ -36118,7 +36221,7 @@ function getBaseProps(runtime) {
|
|
|
36118
36221
|
|
|
36119
36222
|
// ../telemetry/src/identity.ts
|
|
36120
36223
|
import * as crypto2 from "node:crypto";
|
|
36121
|
-
import * as
|
|
36224
|
+
import * as fs10 from "node:fs";
|
|
36122
36225
|
import * as path15 from "node:path";
|
|
36123
36226
|
var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
|
|
36124
36227
|
var cached2 = null;
|
|
@@ -36215,17 +36318,17 @@ function resolveFingerprintOnce(resolveFingerprint) {
|
|
|
36215
36318
|
function isCorruptIdFile(filePath) {
|
|
36216
36319
|
let isRegularFile;
|
|
36217
36320
|
try {
|
|
36218
|
-
isRegularFile =
|
|
36321
|
+
isRegularFile = fs10.lstatSync(filePath).isFile();
|
|
36219
36322
|
} catch {
|
|
36220
36323
|
return false;
|
|
36221
36324
|
}
|
|
36222
36325
|
return isRegularFile && tryReadId(filePath) === null;
|
|
36223
36326
|
}
|
|
36224
36327
|
function writeIdFileAtomic(finalPath, id) {
|
|
36225
|
-
|
|
36328
|
+
fs10.mkdirSync(argentHomeDir(), { recursive: true });
|
|
36226
36329
|
let occupant;
|
|
36227
36330
|
try {
|
|
36228
|
-
occupant =
|
|
36331
|
+
occupant = fs10.lstatSync(finalPath);
|
|
36229
36332
|
} catch (err) {
|
|
36230
36333
|
if (err.code !== "ENOENT") throw err;
|
|
36231
36334
|
}
|
|
@@ -36236,24 +36339,24 @@ function writeIdFileAtomic(finalPath, id) {
|
|
|
36236
36339
|
argentHomeDir(),
|
|
36237
36340
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
36238
36341
|
);
|
|
36239
|
-
const fd =
|
|
36342
|
+
const fd = fs10.openSync(tmpPath, "wx", 384);
|
|
36240
36343
|
try {
|
|
36241
36344
|
try {
|
|
36242
|
-
|
|
36243
|
-
|
|
36345
|
+
fs10.writeSync(fd, id);
|
|
36346
|
+
fs10.fsyncSync(fd);
|
|
36244
36347
|
} finally {
|
|
36245
|
-
|
|
36348
|
+
fs10.closeSync(fd);
|
|
36246
36349
|
}
|
|
36247
|
-
|
|
36350
|
+
fs10.renameSync(tmpPath, finalPath);
|
|
36248
36351
|
} finally {
|
|
36249
36352
|
try {
|
|
36250
|
-
|
|
36353
|
+
fs10.unlinkSync(tmpPath);
|
|
36251
36354
|
} catch {
|
|
36252
36355
|
}
|
|
36253
36356
|
}
|
|
36254
36357
|
}
|
|
36255
36358
|
function mintRandomId(finalPath) {
|
|
36256
|
-
|
|
36359
|
+
fs10.mkdirSync(argentHomeDir(), { recursive: true });
|
|
36257
36360
|
let value = crypto2.randomUUID();
|
|
36258
36361
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
36259
36362
|
const tmpPath = path15.join(
|
|
@@ -36262,19 +36365,19 @@ function mintRandomId(finalPath) {
|
|
|
36262
36365
|
);
|
|
36263
36366
|
let fd;
|
|
36264
36367
|
try {
|
|
36265
|
-
fd =
|
|
36368
|
+
fd = fs10.openSync(tmpPath, "wx", 384);
|
|
36266
36369
|
} catch (err) {
|
|
36267
36370
|
if (err.code === "EEXIST") continue;
|
|
36268
36371
|
throw err;
|
|
36269
36372
|
}
|
|
36270
36373
|
try {
|
|
36271
36374
|
try {
|
|
36272
|
-
|
|
36273
|
-
|
|
36375
|
+
fs10.writeSync(fd, value);
|
|
36376
|
+
fs10.fsyncSync(fd);
|
|
36274
36377
|
} finally {
|
|
36275
|
-
|
|
36378
|
+
fs10.closeSync(fd);
|
|
36276
36379
|
}
|
|
36277
|
-
|
|
36380
|
+
fs10.linkSync(tmpPath, finalPath);
|
|
36278
36381
|
cached2 = { path: finalPath, id: value };
|
|
36279
36382
|
return value;
|
|
36280
36383
|
} catch (err) {
|
|
@@ -36293,7 +36396,7 @@ function mintRandomId(finalPath) {
|
|
|
36293
36396
|
throw err;
|
|
36294
36397
|
} finally {
|
|
36295
36398
|
try {
|
|
36296
|
-
|
|
36399
|
+
fs10.unlinkSync(tmpPath);
|
|
36297
36400
|
} catch {
|
|
36298
36401
|
}
|
|
36299
36402
|
}
|
|
@@ -36306,7 +36409,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
36306
36409
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
36307
36410
|
);
|
|
36308
36411
|
try {
|
|
36309
|
-
|
|
36412
|
+
fs10.renameSync(finalPath, claimed);
|
|
36310
36413
|
} catch {
|
|
36311
36414
|
return null;
|
|
36312
36415
|
}
|
|
@@ -36315,7 +36418,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
36315
36418
|
grabbed = tryReadId(claimed);
|
|
36316
36419
|
} finally {
|
|
36317
36420
|
try {
|
|
36318
|
-
|
|
36421
|
+
fs10.unlinkSync(claimed);
|
|
36319
36422
|
} catch {
|
|
36320
36423
|
}
|
|
36321
36424
|
}
|
|
@@ -36327,9 +36430,9 @@ function peekAnonId() {
|
|
|
36327
36430
|
function tryReadId(filePath) {
|
|
36328
36431
|
let raw;
|
|
36329
36432
|
try {
|
|
36330
|
-
const stats =
|
|
36433
|
+
const stats = fs10.lstatSync(filePath);
|
|
36331
36434
|
if (!stats.isFile()) return null;
|
|
36332
|
-
raw =
|
|
36435
|
+
raw = fs10.readFileSync(filePath, "utf8");
|
|
36333
36436
|
} catch (err) {
|
|
36334
36437
|
if (err.code === "ENOENT") return null;
|
|
36335
36438
|
return null;
|
|
@@ -36344,7 +36447,7 @@ import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_proce
|
|
|
36344
36447
|
|
|
36345
36448
|
// ../native-devtools-ios/src/index.ts
|
|
36346
36449
|
import * as path16 from "node:path";
|
|
36347
|
-
import * as
|
|
36450
|
+
import * as fs11 from "node:fs";
|
|
36348
36451
|
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path16.join(__dirname, "..", "dylibs");
|
|
36349
36452
|
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path16.join(__dirname, "..", "bin");
|
|
36350
36453
|
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path16.join(DYLIB_DIR, "tcp");
|
|
@@ -36364,9 +36467,9 @@ function platformBinDir() {
|
|
|
36364
36467
|
function simulatorServerBinaryPath() {
|
|
36365
36468
|
const binaryName = simulatorServerBinaryName();
|
|
36366
36469
|
const p = path16.join(platformBinDir(), binaryName);
|
|
36367
|
-
if (!
|
|
36470
|
+
if (!fs11.existsSync(p)) {
|
|
36368
36471
|
const flat = path16.join(BIN_DIR, binaryName);
|
|
36369
|
-
const migrationHint =
|
|
36472
|
+
const migrationHint = fs11.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
|
|
36370
36473
|
throw new Error(
|
|
36371
36474
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
36372
36475
|
);
|
|
@@ -36446,14 +36549,15 @@ function resolveHostFingerprintAsync() {
|
|
|
36446
36549
|
}
|
|
36447
36550
|
|
|
36448
36551
|
// ../telemetry/src/consent.ts
|
|
36449
|
-
import * as
|
|
36552
|
+
import * as fs12 from "node:fs";
|
|
36553
|
+
import * as path17 from "node:path";
|
|
36450
36554
|
var cache = /* @__PURE__ */ new Map();
|
|
36451
36555
|
var sessionOverride = null;
|
|
36452
36556
|
function readConfigOverrideAt(filePath) {
|
|
36453
36557
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
36454
36558
|
let stats;
|
|
36455
36559
|
try {
|
|
36456
|
-
stats =
|
|
36560
|
+
stats = fs12.lstatSync(filePath);
|
|
36457
36561
|
} catch {
|
|
36458
36562
|
cache.set(filePath, miss);
|
|
36459
36563
|
return null;
|
|
@@ -36470,7 +36574,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
36470
36574
|
}
|
|
36471
36575
|
let parsedEnabled = null;
|
|
36472
36576
|
try {
|
|
36473
|
-
const raw =
|
|
36577
|
+
const raw = fs12.readFileSync(filePath, "utf8");
|
|
36474
36578
|
const json2 = JSON.parse(raw);
|
|
36475
36579
|
if (json2 && typeof json2 === "object") {
|
|
36476
36580
|
const t2 = json2.telemetry;
|
|
@@ -36488,7 +36592,8 @@ function readPersistedConsent(cwd) {
|
|
|
36488
36592
|
const globalPath = configFilePath("global");
|
|
36489
36593
|
const projectPath = configFilePath("project", { cwd });
|
|
36490
36594
|
const global2 = readConfigOverrideAt(globalPath);
|
|
36491
|
-
const
|
|
36595
|
+
const projectRoot = path17.dirname(path17.dirname(projectPath));
|
|
36596
|
+
const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
|
|
36492
36597
|
if (project === false && global2 === false) {
|
|
36493
36598
|
return { enabled: false, detail: "config.json (project and global)" };
|
|
36494
36599
|
}
|
|
@@ -37025,10 +37130,11 @@ function isValidationIssue(value) {
|
|
|
37025
37130
|
}
|
|
37026
37131
|
|
|
37027
37132
|
// ../argent-cli/src/e2e.ts
|
|
37133
|
+
var import_yaml3 = __toESM(require_dist(), 1);
|
|
37028
37134
|
import * as fsp from "node:fs/promises";
|
|
37029
37135
|
import { constants as fsConstants2 } from "node:fs";
|
|
37030
37136
|
import { createHash as createHash5 } from "node:crypto";
|
|
37031
|
-
import * as
|
|
37137
|
+
import * as path18 from "node:path";
|
|
37032
37138
|
|
|
37033
37139
|
// ../argent-cli/src/command-args.ts
|
|
37034
37140
|
var UsageError = class extends Error {
|
|
@@ -37043,7 +37149,7 @@ function listChoices(choices) {
|
|
|
37043
37149
|
return `${quoted.slice(0, -1).join(", ")} or ${quoted[quoted.length - 1]}`;
|
|
37044
37150
|
}
|
|
37045
37151
|
function resolveName(tok, specs) {
|
|
37046
|
-
if (tok.startsWith("--")) return tok.slice(2)
|
|
37152
|
+
if (tok.startsWith("--")) return Object.hasOwn(specs, tok.slice(2)) ? tok.slice(2) : null;
|
|
37047
37153
|
const short = tok.slice(1);
|
|
37048
37154
|
for (const [name, spec] of Object.entries(specs)) {
|
|
37049
37155
|
if (spec.alias === short) return name;
|
|
@@ -37161,7 +37267,8 @@ warning, and each script step's output), then its outcome. After the last test
|
|
|
37161
37267
|
it lists every failed test with its reason and a command that re-runs that test
|
|
37162
37268
|
alone, then a final summary; --recursive walks subdirectories too
|
|
37163
37269
|
(__baselines__, node_modules and dot-directories other than .argent are
|
|
37164
|
-
skipped). A
|
|
37270
|
+
skipped). A directory run and list skip a YAML file that is not an e2e test.
|
|
37271
|
+
A test that fails its steps keeps the batch running, as does one the
|
|
37165
37272
|
server rejects up front \u2014 an invalid file, or a device it cannot resolve. A
|
|
37166
37273
|
transport failure, a rejection the server does not mark as validation, or a
|
|
37167
37274
|
reply that is not a report stops the batch and counts the remaining tests
|
|
@@ -37201,8 +37308,8 @@ Subcommands:
|
|
|
37201
37308
|
subdirectories), or in .argent/e2e and
|
|
37202
37309
|
.argent/flows (legacy) with notes on stderr.
|
|
37203
37310
|
--json prints { "e2eTests": [...] } instead, with
|
|
37204
|
-
path per entry, plus name,
|
|
37205
|
-
when no dir is given
|
|
37311
|
+
path and an optional warning per entry, plus name,
|
|
37312
|
+
legacy and shadowedBy when no dir is given
|
|
37206
37313
|
|
|
37207
37314
|
Options (run):
|
|
37208
37315
|
--device <id> Device id to run against (auto-detected when omitted)
|
|
@@ -37403,17 +37510,17 @@ function shellQuoteArg(arg) {
|
|
|
37403
37510
|
return `'${arg.replaceAll("'", "'\\''")}'`;
|
|
37404
37511
|
}
|
|
37405
37512
|
function optionSafePath(p) {
|
|
37406
|
-
return p.startsWith("-") ? `.${
|
|
37513
|
+
return p.startsWith("-") ? `.${path18.sep}${p}` : p;
|
|
37407
37514
|
}
|
|
37408
37515
|
function rerunCommand(flowPath, rel, projectRoot, args) {
|
|
37409
37516
|
const pathArg = (p) => shellQuoteArg(optionSafePath(p));
|
|
37410
|
-
const fromCwd =
|
|
37411
|
-
const shown =
|
|
37517
|
+
const fromCwd = path18.relative(projectRoot, flowPath);
|
|
37518
|
+
const shown = path18.isAbsolute(fromCwd) || fromCwd.split(/[\\/]+/).includes("..") ? flowPath : fromCwd;
|
|
37412
37519
|
const parts = ["argent e2e run", pathArg(shown)];
|
|
37413
37520
|
if (args.device) parts.push("--device", shellQuoteArg(args.device));
|
|
37414
37521
|
if (args.platform) parts.push("--platform", shellQuoteArg(args.platform));
|
|
37415
37522
|
if (args.updateBaselines) parts.push("--update-baselines");
|
|
37416
|
-
if (args.output) parts.push("--output", pathArg(
|
|
37523
|
+
if (args.output) parts.push("--output", pathArg(path18.join(args.output, path18.dirname(rel))));
|
|
37417
37524
|
return parts.join(" ");
|
|
37418
37525
|
}
|
|
37419
37526
|
var EXPORT_SOURCE_MARKER = ".argent-e2e-source";
|
|
@@ -37421,8 +37528,8 @@ var LEGACY_EXPORT_SOURCE_MARKER = ".argent-flow-source";
|
|
|
37421
37528
|
var MARKER_READ_RETRIES = 4;
|
|
37422
37529
|
var MARKER_READ_DELAY_MS = 5;
|
|
37423
37530
|
async function readExportMarker(dir) {
|
|
37424
|
-
const owner = await readMarkerFile(
|
|
37425
|
-
return owner !== void 0 ? owner : await readMarkerFile(
|
|
37531
|
+
const owner = await readMarkerFile(path18.join(dir, EXPORT_SOURCE_MARKER));
|
|
37532
|
+
return owner !== void 0 ? owner : await readMarkerFile(path18.join(dir, LEGACY_EXPORT_SOURCE_MARKER));
|
|
37426
37533
|
}
|
|
37427
37534
|
async function readMarkerFile(marker) {
|
|
37428
37535
|
for (let attempt = 0; ; attempt++) {
|
|
@@ -37459,7 +37566,7 @@ function occupiedBy(owner) {
|
|
|
37459
37566
|
async function takeExportDir(dir, flowPath) {
|
|
37460
37567
|
try {
|
|
37461
37568
|
await fsp.mkdir(dir, { recursive: true });
|
|
37462
|
-
await fsp.writeFile(
|
|
37569
|
+
await fsp.writeFile(path18.join(dir, EXPORT_SOURCE_MARKER), `${flowPath}
|
|
37463
37570
|
`, { flag: "wx" });
|
|
37464
37571
|
return null;
|
|
37465
37572
|
} catch (err) {
|
|
@@ -37478,7 +37585,7 @@ async function claimExportDirName(outputDir, flowPath, stem) {
|
|
|
37478
37585
|
}
|
|
37479
37586
|
const avoided = [];
|
|
37480
37587
|
for (const name of candidates) {
|
|
37481
|
-
const dir =
|
|
37588
|
+
const dir = path18.join(outputDir, name);
|
|
37482
37589
|
const claim2 = await classifyExportDir(dir, flowPath);
|
|
37483
37590
|
const reason = claim2.state === "foreign" ? occupiedBy(claim2.owner) : await takeExportDir(dir, flowPath);
|
|
37484
37591
|
if (reason !== null) {
|
|
@@ -37498,7 +37605,7 @@ async function claimExportDirName(outputDir, flowPath, stem) {
|
|
|
37498
37605
|
return null;
|
|
37499
37606
|
}
|
|
37500
37607
|
async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
37501
|
-
const stem =
|
|
37608
|
+
const stem = path18.basename(flowPath, ".yaml");
|
|
37502
37609
|
if (!SAFE_ARTIFACT_NAME.test(stem)) {
|
|
37503
37610
|
console.error(
|
|
37504
37611
|
`warning: skipping artifact export for unsafe e2e test filename ${JSON.stringify(stem)}`
|
|
@@ -37531,11 +37638,11 @@ async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
|
37531
37638
|
if (dir === null) {
|
|
37532
37639
|
const dirName = await claimExportDirName(outputDir, flowPath, stem);
|
|
37533
37640
|
if (dirName === null) return;
|
|
37534
|
-
dir =
|
|
37641
|
+
dir = path18.join(outputDir, dirName);
|
|
37535
37642
|
}
|
|
37536
|
-
const dest =
|
|
37537
|
-
const rel =
|
|
37538
|
-
if (rel.startsWith("..") ||
|
|
37643
|
+
const dest = path18.join(dir, fileName(role));
|
|
37644
|
+
const rel = path18.relative(outputDir, dest);
|
|
37645
|
+
if (rel.startsWith("..") || path18.isAbsolute(rel)) continue;
|
|
37539
37646
|
try {
|
|
37540
37647
|
await fsp.copyFile(value, dest);
|
|
37541
37648
|
s.artifacts[role] = dest;
|
|
@@ -37550,7 +37657,7 @@ async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
|
37550
37657
|
function keyFromBaselinePath(artifacts) {
|
|
37551
37658
|
const baseline = artifacts.baseline;
|
|
37552
37659
|
if (typeof baseline !== "string") return null;
|
|
37553
|
-
return
|
|
37660
|
+
return path18.basename(baseline).replace(/\.png$/, "");
|
|
37554
37661
|
}
|
|
37555
37662
|
function resolveArtifactDisplayPaths(report) {
|
|
37556
37663
|
for (const s of report.steps) {
|
|
@@ -37603,30 +37710,53 @@ async function isRunnableFlowFile(filePath) {
|
|
|
37603
37710
|
return false;
|
|
37604
37711
|
}
|
|
37605
37712
|
}
|
|
37713
|
+
var E2E_FILE_WARNING_TEXT = {
|
|
37714
|
+
"syntax-error": "has a YAML syntax error",
|
|
37715
|
+
"empty": "is empty"
|
|
37716
|
+
};
|
|
37717
|
+
async function checkE2eTestShape(filePath) {
|
|
37718
|
+
let content;
|
|
37719
|
+
try {
|
|
37720
|
+
content = (await fsp.readFile(filePath, "utf8")).trim();
|
|
37721
|
+
} catch {
|
|
37722
|
+
return "ok";
|
|
37723
|
+
}
|
|
37724
|
+
if (content.length === 0) return "empty";
|
|
37725
|
+
if (!content.includes("steps") && !/^version:/m.test(content)) return "skip";
|
|
37726
|
+
let parsed;
|
|
37727
|
+
try {
|
|
37728
|
+
parsed = (0, import_yaml3.parse)(content, { logLevel: "error" });
|
|
37729
|
+
} catch {
|
|
37730
|
+
return "syntax-error";
|
|
37731
|
+
}
|
|
37732
|
+
if (typeof parsed !== "object" || parsed === null) return "skip";
|
|
37733
|
+
const { version: version2 } = parsed;
|
|
37734
|
+
return Number.isInteger(version2) && Number(version2) > 1 || "steps" in parsed ? "ok" : "skip";
|
|
37735
|
+
}
|
|
37606
37736
|
async function resolveFlowRef(ref, projectRoot) {
|
|
37607
37737
|
if (!SAFE_FLOW_NAME.test(ref)) return { suppliedPath: ref, fromName: false };
|
|
37608
37738
|
const picked = await resolveE2eFile(projectRoot, ref);
|
|
37609
37739
|
return {
|
|
37610
|
-
suppliedPath:
|
|
37740
|
+
suppliedPath: path18.relative(projectRoot, picked.path),
|
|
37611
37741
|
fromName: true,
|
|
37612
|
-
...picked.shadowed === void 0 ? {} : { shadowed:
|
|
37742
|
+
...picked.shadowed === void 0 ? {} : { shadowed: path18.relative(projectRoot, picked.shadowed) }
|
|
37613
37743
|
};
|
|
37614
37744
|
}
|
|
37615
37745
|
async function savedFlowHint(projectRoot, missingPath) {
|
|
37616
|
-
const dirs = E2E_DIRS.map((rel) => ({ rel, abs:
|
|
37746
|
+
const dirs = E2E_DIRS.map((rel) => ({ rel, abs: path18.resolve(projectRoot, rel) }));
|
|
37617
37747
|
for (const { abs } of dirs) {
|
|
37618
|
-
const within =
|
|
37619
|
-
if (!within.startsWith("..") && !
|
|
37748
|
+
const within = path18.relative(abs, missingPath);
|
|
37749
|
+
if (!within.startsWith("..") && !path18.isAbsolute(within)) return "";
|
|
37620
37750
|
}
|
|
37621
|
-
const wanted = `${
|
|
37751
|
+
const wanted = `${path18.basename(missingPath, ".yaml")}.yaml`;
|
|
37622
37752
|
for (const { rel, abs } of dirs) {
|
|
37623
37753
|
const entries = await fsp.readdir(abs).catch(() => null);
|
|
37624
37754
|
if (entries === null) continue;
|
|
37625
37755
|
const actual = entries.includes(wanted) ? wanted : entries.find((name2) => name2.toLowerCase() === wanted.toLowerCase());
|
|
37626
37756
|
if (actual === void 0) continue;
|
|
37627
|
-
const name =
|
|
37757
|
+
const name = path18.basename(actual, ".yaml");
|
|
37628
37758
|
if (!SAFE_FLOW_NAME.test(name)) return "";
|
|
37629
|
-
if (!await isRunnableFlowFile(
|
|
37759
|
+
if (!await isRunnableFlowFile(path18.join(abs, actual))) return "";
|
|
37630
37760
|
return `
|
|
37631
37761
|
An e2e test named "${name}" is saved under ${rel} \u2014 did you mean: argent e2e run ${name}`;
|
|
37632
37762
|
}
|
|
@@ -37636,21 +37766,25 @@ async function collectFlowFiles(dir, recursive2) {
|
|
|
37636
37766
|
const found = [];
|
|
37637
37767
|
const walk = async (current, rel) => {
|
|
37638
37768
|
for (const entry of await fsp.readdir(current, { withFileTypes: true })) {
|
|
37639
|
-
const entryRel = rel ?
|
|
37769
|
+
const entryRel = rel ? path18.join(rel, entry.name) : entry.name;
|
|
37640
37770
|
if (entry.isDirectory()) {
|
|
37641
37771
|
if (recursive2 && entry.name !== "__baselines__" && entry.name !== "node_modules" && (entry.name === ".argent" || !entry.name.startsWith("."))) {
|
|
37642
|
-
await walk(
|
|
37772
|
+
await walk(path18.join(current, entry.name), entryRel).catch(() => {
|
|
37643
37773
|
});
|
|
37644
37774
|
}
|
|
37645
37775
|
continue;
|
|
37646
37776
|
}
|
|
37647
37777
|
if (!entry.name.endsWith(".yaml")) continue;
|
|
37648
|
-
if (!SAFE_FLOW_NAME.test(
|
|
37649
|
-
|
|
37778
|
+
if (!SAFE_FLOW_NAME.test(path18.basename(entry.name, ".yaml"))) continue;
|
|
37779
|
+
const filePath = path18.join(current, entry.name);
|
|
37780
|
+
if (!await isRunnableFlowFile(filePath)) continue;
|
|
37781
|
+
const shape = await checkE2eTestShape(filePath);
|
|
37782
|
+
if (shape === "skip") continue;
|
|
37783
|
+
found.push({ path: entryRel, ...shape !== "ok" && { warning: shape } });
|
|
37650
37784
|
}
|
|
37651
37785
|
};
|
|
37652
37786
|
await walk(dir, "");
|
|
37653
|
-
return found.sort();
|
|
37787
|
+
return found.sort((a2, b) => a2.path < b.path ? -1 : a2.path > b.path ? 1 : 0);
|
|
37654
37788
|
}
|
|
37655
37789
|
var RUN_TOOL_ID = "e2e-execute";
|
|
37656
37790
|
function buildRunPayload(flowPath, projectRoot, args) {
|
|
@@ -37783,7 +37917,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
37783
37917
|
};
|
|
37784
37918
|
let flows;
|
|
37785
37919
|
try {
|
|
37786
|
-
flows = await collectFlowFiles(dir, args.recursive);
|
|
37920
|
+
flows = (await collectFlowFiles(dir, args.recursive)).map((file2) => file2.path);
|
|
37787
37921
|
} catch {
|
|
37788
37922
|
return reject(`Could not read e2e test directory: ${dir}`);
|
|
37789
37923
|
}
|
|
@@ -37793,7 +37927,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
37793
37927
|
);
|
|
37794
37928
|
}
|
|
37795
37929
|
const { callTool, baseUrl } = runToolsClient(args, options);
|
|
37796
|
-
const outputBase = args.output ?
|
|
37930
|
+
const outputBase = args.output ? path18.resolve(args.output) : void 0;
|
|
37797
37931
|
const results = [];
|
|
37798
37932
|
const failures = [];
|
|
37799
37933
|
const batchStartedAt = Date.now();
|
|
@@ -37806,7 +37940,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
37806
37940
|
if (!args.json) console.log(` ${STATUS_GLYPH.skip} not run (batch stopped)`);
|
|
37807
37941
|
continue;
|
|
37808
37942
|
}
|
|
37809
|
-
const flowPath =
|
|
37943
|
+
const flowPath = path18.join(dir, rel);
|
|
37810
37944
|
const rerun = rerunCommand(flowPath, rel, projectRoot, args);
|
|
37811
37945
|
let report;
|
|
37812
37946
|
try {
|
|
@@ -37848,7 +37982,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
37848
37982
|
printWarnings(nestedStepWarnings(report.steps), args.json);
|
|
37849
37983
|
await exportAndResolveArtifacts(
|
|
37850
37984
|
report,
|
|
37851
|
-
outputBase ?
|
|
37985
|
+
outputBase ? path18.join(outputBase, path18.dirname(rel)) : void 0,
|
|
37852
37986
|
flowPath,
|
|
37853
37987
|
baseUrl
|
|
37854
37988
|
);
|
|
@@ -37951,9 +38085,9 @@ Pass the fully resolved path to the directory.`
|
|
|
37951
38085
|
let anyDir = false;
|
|
37952
38086
|
const dirs = listDir === void 0 ? E2E_DIRS : [listDir];
|
|
37953
38087
|
for (const dir of dirs) {
|
|
37954
|
-
let
|
|
38088
|
+
let files;
|
|
37955
38089
|
try {
|
|
37956
|
-
|
|
38090
|
+
files = await collectFlowFiles(path18.resolve(dir), listDir === void 0 || recursive2);
|
|
37957
38091
|
} catch (err) {
|
|
37958
38092
|
const code = err.code;
|
|
37959
38093
|
if (listDir === void 0 && (code === "ENOENT" || code === "ENOTDIR")) continue;
|
|
@@ -37962,20 +38096,22 @@ Pass the fully resolved path to the directory.`
|
|
|
37962
38096
|
);
|
|
37963
38097
|
}
|
|
37964
38098
|
anyDir = true;
|
|
37965
|
-
for (const rel of
|
|
37966
|
-
const shown =
|
|
38099
|
+
for (const { path: rel, warning } of files) {
|
|
38100
|
+
const shown = path18.join(dir, rel);
|
|
38101
|
+
const warningField = warning !== void 0 && { warning };
|
|
37967
38102
|
if (listDir !== void 0) {
|
|
37968
|
-
entries.push({ path: optionSafePath(shown) });
|
|
38103
|
+
entries.push({ path: optionSafePath(shown), ...warningField });
|
|
37969
38104
|
continue;
|
|
37970
38105
|
}
|
|
37971
|
-
const name =
|
|
38106
|
+
const name = path18.dirname(rel) === "." ? path18.basename(rel, ".yaml") : void 0;
|
|
37972
38107
|
const shadowedBy = name === void 0 ? void 0 : byName.get(name);
|
|
37973
38108
|
if (name !== void 0 && shadowedBy === void 0) byName.set(name, shown);
|
|
37974
38109
|
entries.push({
|
|
37975
38110
|
path: shown,
|
|
37976
38111
|
...name !== void 0 && { name },
|
|
37977
38112
|
legacy: dir !== E2E_DIR,
|
|
37978
|
-
...shadowedBy !== void 0 && { shadowedBy }
|
|
38113
|
+
...shadowedBy !== void 0 && { shadowedBy },
|
|
38114
|
+
...warningField
|
|
37979
38115
|
});
|
|
37980
38116
|
}
|
|
37981
38117
|
}
|
|
@@ -37999,6 +38135,8 @@ Pass the fully resolved path to the directory.`
|
|
|
37999
38135
|
console.error(
|
|
38000
38136
|
`warning: ${entry.path} is shadowed by ${entry.shadowedBy} when run by name`
|
|
38001
38137
|
);
|
|
38138
|
+
if (entry.warning !== void 0)
|
|
38139
|
+
console.error(`warning: ${entry.path} ${E2E_FILE_WARNING_TEXT[entry.warning]}`);
|
|
38002
38140
|
}
|
|
38003
38141
|
const legacyCount = entries.filter((entry) => entry.legacy).length;
|
|
38004
38142
|
if (legacyCount > 0) {
|
|
@@ -38055,10 +38193,10 @@ Pass the fully resolved path to the directory.`
|
|
|
38055
38193
|
}
|
|
38056
38194
|
if (suppliedPath.split(/[\\/]+/).includes("..")) {
|
|
38057
38195
|
let recovery = "Pass the fully resolved path to the e2e test's YAML.";
|
|
38058
|
-
const suppliedBase2 =
|
|
38196
|
+
const suppliedBase2 = path18.basename(suppliedPath);
|
|
38059
38197
|
if (suppliedBase2 !== ".." && suppliedBase2 !== ".") {
|
|
38060
38198
|
try {
|
|
38061
|
-
const resolved =
|
|
38199
|
+
const resolved = path18.join(await fsp.realpath(path18.dirname(suppliedPath)), suppliedBase2);
|
|
38062
38200
|
await fsp.stat(resolved);
|
|
38063
38201
|
recovery = `Did you mean: argent e2e run ${shellQuoteArg(resolved)}`;
|
|
38064
38202
|
} catch {
|
|
@@ -38070,7 +38208,7 @@ Pass the fully resolved path to the directory.`
|
|
|
38070
38208
|
2
|
|
38071
38209
|
);
|
|
38072
38210
|
}
|
|
38073
|
-
const resolvedPath =
|
|
38211
|
+
const resolvedPath = path18.resolve(projectRoot, suppliedPath);
|
|
38074
38212
|
let isDirectory = false;
|
|
38075
38213
|
try {
|
|
38076
38214
|
isDirectory = (await fsp.stat(resolvedPath)).isDirectory();
|
|
@@ -38093,16 +38231,16 @@ Pass the fully resolved path to the directory.`
|
|
|
38093
38231
|
}
|
|
38094
38232
|
const separatorTrimmedPath = suppliedPath.replace(/[\\/]+$/, "");
|
|
38095
38233
|
if (separatorTrimmedPath !== suppliedPath && separatorTrimmedPath !== "") {
|
|
38096
|
-
const hint = SAFE_FLOW_NAME.test(separatorTrimmedPath) ? `.${
|
|
38234
|
+
const hint = SAFE_FLOW_NAME.test(separatorTrimmedPath) ? `.${path18.sep}${separatorTrimmedPath}` : separatorTrimmedPath;
|
|
38097
38235
|
return fail(
|
|
38098
38236
|
`E2E test path must not end in a path separator \u2014 the separator claims a directory, which the kernel would refuse to open as a file, so the CLI would run a file this string does not name: ${suppliedPath}
|
|
38099
38237
|
Did you mean: argent e2e run ${shellQuoteArg(hint)}`,
|
|
38100
38238
|
2
|
|
38101
38239
|
);
|
|
38102
38240
|
}
|
|
38103
|
-
if (
|
|
38104
|
-
const looksLikeName = !suppliedPath.includes("/") && !suppliedPath.includes("\\") &&
|
|
38105
|
-
if (
|
|
38241
|
+
if (path18.extname(suppliedPath) !== ".yaml") {
|
|
38242
|
+
const looksLikeName = !suppliedPath.includes("/") && !suppliedPath.includes("\\") && path18.extname(suppliedPath) === "";
|
|
38243
|
+
if (path18.basename(suppliedPath).toLowerCase() === ".yaml") {
|
|
38106
38244
|
return fail(
|
|
38107
38245
|
`E2E test filename must have a non-empty name containing only letters, numbers, "_", or "-": ${suppliedPath}`,
|
|
38108
38246
|
2
|
|
@@ -38115,15 +38253,15 @@ Names run \`${E2E_DIRS.map((dir) => `${dir}/<name>.yaml`).join("` or `")}\`; pas
|
|
|
38115
38253
|
2
|
|
38116
38254
|
);
|
|
38117
38255
|
}
|
|
38118
|
-
if (
|
|
38256
|
+
if (path18.extname(suppliedPath).toLowerCase() === ".yaml") {
|
|
38119
38257
|
return fail(
|
|
38120
|
-
`E2E test extension must be lowercase .yaml, not ${
|
|
38258
|
+
`E2E test extension must be lowercase .yaml, not ${path18.extname(suppliedPath)}: ${suppliedPath}`,
|
|
38121
38259
|
2
|
|
38122
38260
|
);
|
|
38123
38261
|
}
|
|
38124
38262
|
return fail(`E2E test path must end in .yaml: ${suppliedPath}`, 2);
|
|
38125
38263
|
}
|
|
38126
|
-
const flowName =
|
|
38264
|
+
const flowName = path18.basename(suppliedPath, ".yaml");
|
|
38127
38265
|
if (!SAFE_FLOW_NAME.test(flowName)) {
|
|
38128
38266
|
return fail(
|
|
38129
38267
|
`E2E test filename must have a non-empty name containing only letters, numbers, "_", or "-": ${suppliedPath}`,
|
|
@@ -38147,12 +38285,12 @@ No e2e test named "${args.flowRef}" is saved in ${E2E_DIRS.join(" or ")} \u2014
|
|
|
38147
38285
|
}
|
|
38148
38286
|
return fail(`${detail}: ${flowPath}${recovery}`, 2);
|
|
38149
38287
|
}
|
|
38150
|
-
const suppliedBase =
|
|
38151
|
-
const siblings = await fsp.readdir(
|
|
38288
|
+
const suppliedBase = path18.basename(flowPath);
|
|
38289
|
+
const siblings = await fsp.readdir(path18.dirname(flowPath)).catch(() => null);
|
|
38152
38290
|
if (siblings !== null && !siblings.includes(suppliedBase)) {
|
|
38153
38291
|
const actual = siblings.find((name) => name.toLowerCase() === suppliedBase.toLowerCase());
|
|
38154
|
-
const actualRunnable = actual !== void 0 &&
|
|
38155
|
-
const recovery = actualRunnable ? fromName ? `Did you mean: argent e2e run ${
|
|
38292
|
+
const actualRunnable = actual !== void 0 && path18.extname(actual) === ".yaml" && SAFE_FLOW_NAME.test(path18.basename(actual, ".yaml"));
|
|
38293
|
+
const recovery = actualRunnable ? fromName ? `Did you mean: argent e2e run ${path18.basename(actual, ".yaml")}` : `Did you mean: argent e2e run ${shellQuoteArg(path18.join(path18.dirname(suppliedPath), actual))}` : actual !== void 0 ? `Rename ${actual} to ${suppliedBase} to run it \u2014 e2e test files must be lowercase .yaml.` : "Pass the e2e test file's name exactly as it appears on disk.";
|
|
38156
38294
|
return fail(
|
|
38157
38295
|
`E2E test path must name the file as it appears on disk \u2014 this filesystem matched ${JSON.stringify(suppliedBase)} case-insensitively${actual !== void 0 ? ` to ${JSON.stringify(actual)}` : ""}, so the test name (which keys the report, __baselines__/, and --output) would be one no file carries: ${suppliedPath}
|
|
38158
38296
|
${recovery}`,
|
|
@@ -38211,7 +38349,7 @@ ${recovery}`,
|
|
|
38211
38349
|
try {
|
|
38212
38350
|
await exportAndResolveArtifacts(
|
|
38213
38351
|
report,
|
|
38214
|
-
args.output ?
|
|
38352
|
+
args.output ? path18.resolve(args.output) : void 0,
|
|
38215
38353
|
flowPath,
|
|
38216
38354
|
baseUrl
|
|
38217
38355
|
);
|
|
@@ -38305,8 +38443,8 @@ async function fetchImageToFile(result, outPath) {
|
|
|
38305
38443
|
const res = await fetch(url2);
|
|
38306
38444
|
if (!res.ok) throw new Error(`Failed to download image: ${res.status} ${res.statusText}`);
|
|
38307
38445
|
const buf = Buffer.from(await res.arrayBuffer());
|
|
38308
|
-
|
|
38309
|
-
|
|
38446
|
+
fs13.mkdirSync(path19.dirname(path19.resolve(outPath)), { recursive: true });
|
|
38447
|
+
fs13.writeFileSync(outPath, buf);
|
|
38310
38448
|
}
|
|
38311
38449
|
function renderResult(result, outputHint, images, json2) {
|
|
38312
38450
|
if (json2) return JSON.stringify(result, null, 2);
|
|
@@ -38513,8 +38651,8 @@ settled=false or debugger-status's not_connected.
|
|
|
38513
38651
|
if (outPath && meta3.outputHint === "image") {
|
|
38514
38652
|
try {
|
|
38515
38653
|
if (images.length > 0) {
|
|
38516
|
-
|
|
38517
|
-
|
|
38654
|
+
fs13.mkdirSync(path19.dirname(path19.resolve(outPath)), { recursive: true });
|
|
38655
|
+
fs13.writeFileSync(outPath, images[0].data);
|
|
38518
38656
|
} else if (result && typeof result === "object") {
|
|
38519
38657
|
await fetchImageToFile(result, outPath);
|
|
38520
38658
|
}
|
|
@@ -38554,6 +38692,7 @@ function summarize(description, max = 80) {
|
|
|
38554
38692
|
if (firstLine.length <= max) return firstLine;
|
|
38555
38693
|
return firstLine.slice(0, max - 1).trimEnd() + "\u2026";
|
|
38556
38694
|
}
|
|
38695
|
+
var TOOLS_OPTIONS = { json: { kind: "boolean" } };
|
|
38557
38696
|
async function tools(argv, options) {
|
|
38558
38697
|
const { fetchTool, fetchTools } = createToolsClient({ paths: options.paths });
|
|
38559
38698
|
async function listTools(json3) {
|
|
@@ -38575,10 +38714,10 @@ async function tools(argv, options) {
|
|
|
38575
38714
|
console.log(`
|
|
38576
38715
|
${sorted.length} tools. Run \`argent tools describe <name>\` for details.`);
|
|
38577
38716
|
}
|
|
38578
|
-
async function describeTool(
|
|
38579
|
-
const meta3 = await fetchTool(
|
|
38717
|
+
async function describeTool(name2, json3) {
|
|
38718
|
+
const meta3 = await fetchTool(name2);
|
|
38580
38719
|
if (!meta3) {
|
|
38581
|
-
console.error(`Tool "${
|
|
38720
|
+
console.error(`Tool "${name2}" not found. Run \`argent tools\` to list available tools.`);
|
|
38582
38721
|
process.exit(1);
|
|
38583
38722
|
}
|
|
38584
38723
|
if (json3) {
|
|
@@ -38606,38 +38745,51 @@ Options:
|
|
|
38606
38745
|
Listing tools contacts the argent tool-server, starting one if none is running.
|
|
38607
38746
|
`);
|
|
38608
38747
|
}
|
|
38609
|
-
const json2 = argv.includes("--json");
|
|
38610
38748
|
const isHelpFlag = (a2) => a2 === "--help" || a2 === "-h";
|
|
38611
|
-
|
|
38612
|
-
|
|
38613
|
-
|
|
38749
|
+
if (argv.some(isHelpFlag)) {
|
|
38750
|
+
const [first, second] = argv.filter((a2) => !a2.startsWith("-") || isHelpFlag(a2));
|
|
38751
|
+
if (first === "describe" && second !== void 0 && !isHelpFlag(second)) {
|
|
38752
|
+
await describeTool(second, argv.includes("--json"));
|
|
38753
|
+
return;
|
|
38754
|
+
}
|
|
38614
38755
|
printUsage4();
|
|
38615
38756
|
return;
|
|
38616
38757
|
}
|
|
38758
|
+
const usageError = (message) => {
|
|
38759
|
+
console.error(`Error: ${message}
|
|
38760
|
+
`);
|
|
38761
|
+
printUsage4();
|
|
38762
|
+
process.exit(2);
|
|
38763
|
+
};
|
|
38764
|
+
let parsed;
|
|
38765
|
+
try {
|
|
38766
|
+
parsed = parseCommandArgs(argv, TOOLS_OPTIONS);
|
|
38767
|
+
} catch (err) {
|
|
38768
|
+
if (!(err instanceof UsageError)) throw err;
|
|
38769
|
+
return usageError(err.message);
|
|
38770
|
+
}
|
|
38771
|
+
const [sub, name, extra] = parsed.positionals;
|
|
38772
|
+
const json2 = parsed.options.json === true;
|
|
38617
38773
|
if (!sub) {
|
|
38618
38774
|
await listTools(json2);
|
|
38619
38775
|
return;
|
|
38620
38776
|
}
|
|
38621
38777
|
if (sub === "describe") {
|
|
38622
|
-
|
|
38623
|
-
if (
|
|
38624
|
-
console.error("Usage: argent tools describe <tool-name>");
|
|
38625
|
-
process.exit(1);
|
|
38626
|
-
}
|
|
38778
|
+
if (!name) return usageError("`argent tools describe` requires a <tool-name>");
|
|
38779
|
+
if (extra !== void 0) usageError(`Unexpected argument "${extra}"`);
|
|
38627
38780
|
await describeTool(name, json2);
|
|
38628
38781
|
return;
|
|
38629
38782
|
}
|
|
38630
|
-
|
|
38631
|
-
process.exit(1);
|
|
38783
|
+
usageError(`Unknown subcommand: tools ${sub}`);
|
|
38632
38784
|
}
|
|
38633
38785
|
|
|
38634
38786
|
// ../argent-cli/src/server.ts
|
|
38635
|
-
import * as
|
|
38636
|
-
import * as
|
|
38787
|
+
import * as fs14 from "node:fs";
|
|
38788
|
+
import * as path20 from "node:path";
|
|
38637
38789
|
import { constants as constants2, homedir as homedir5, networkInterfaces } from "node:os";
|
|
38638
38790
|
import { spawn as spawn4 } from "node:child_process";
|
|
38639
|
-
var STATE_DIR2 =
|
|
38640
|
-
var LOG_FILE2 =
|
|
38791
|
+
var STATE_DIR2 = path20.join(homedir5(), ".argent");
|
|
38792
|
+
var LOG_FILE2 = path20.join(STATE_DIR2, "tool-server.log");
|
|
38641
38793
|
async function describeForeignServers(ownBundlePath) {
|
|
38642
38794
|
const others = (await readAllToolsServerStates()).filter(
|
|
38643
38795
|
({ state: state2 }) => state2.bundlePath !== ownBundlePath && isToolsServerProcessAlive(state2.pid)
|
|
@@ -38701,19 +38853,39 @@ Stop one with: kill <pid>`);
|
|
|
38701
38853
|
}
|
|
38702
38854
|
}
|
|
38703
38855
|
function logsCmd(follow) {
|
|
38704
|
-
if (!
|
|
38856
|
+
if (!fs14.existsSync(LOG_FILE2)) {
|
|
38705
38857
|
console.log(`No log file at ${LOG_FILE2}`);
|
|
38706
38858
|
return;
|
|
38707
38859
|
}
|
|
38708
38860
|
if (!follow) {
|
|
38709
|
-
process.stdout.write(
|
|
38861
|
+
process.stdout.write(fs14.readFileSync(LOG_FILE2, "utf8"));
|
|
38710
38862
|
return;
|
|
38711
38863
|
}
|
|
38712
|
-
const
|
|
38864
|
+
const cannotFollow = (err) => {
|
|
38865
|
+
console.error(
|
|
38866
|
+
`argent server logs: cannot run \`tail\` to follow the log (${err.message}). Run \`argent server logs\` without -f to print it.`
|
|
38867
|
+
);
|
|
38868
|
+
process.exit(1);
|
|
38869
|
+
};
|
|
38870
|
+
let child;
|
|
38871
|
+
try {
|
|
38872
|
+
child = spawn4("tail", ["-f", LOG_FILE2], { stdio: "inherit" });
|
|
38873
|
+
} catch (err) {
|
|
38874
|
+
return cannotFollow(err);
|
|
38875
|
+
}
|
|
38876
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
38877
|
+
process.on(signal, () => {
|
|
38878
|
+
try {
|
|
38879
|
+
child.kill(signal);
|
|
38880
|
+
} catch {
|
|
38881
|
+
}
|
|
38882
|
+
});
|
|
38883
|
+
}
|
|
38713
38884
|
child.on(
|
|
38714
38885
|
"exit",
|
|
38715
38886
|
(code, signal) => process.exit(code ?? (signal ? 128 + (signalNumber(signal) ?? 0) : 0))
|
|
38716
38887
|
);
|
|
38888
|
+
child.on("error", cannotFollow);
|
|
38717
38889
|
}
|
|
38718
38890
|
var StartFlagError = class extends Error {
|
|
38719
38891
|
};
|
|
@@ -38933,10 +39105,20 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
38933
39105
|
idleTimeoutMinutes,
|
|
38934
39106
|
token
|
|
38935
39107
|
});
|
|
38936
|
-
const
|
|
38937
|
-
|
|
38938
|
-
|
|
38939
|
-
|
|
39108
|
+
const cannotStart = (err) => {
|
|
39109
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
39110
|
+
console.error(`argent server start: failed to spawn tool-server: ${message}`);
|
|
39111
|
+
process.exit(1);
|
|
39112
|
+
};
|
|
39113
|
+
let child;
|
|
39114
|
+
try {
|
|
39115
|
+
child = spawn4(resolveToolsServerNode(), [paths.bundlePath, "start"], {
|
|
39116
|
+
stdio: "inherit",
|
|
39117
|
+
env
|
|
39118
|
+
});
|
|
39119
|
+
} catch (err) {
|
|
39120
|
+
return cannotStart(err);
|
|
39121
|
+
}
|
|
38940
39122
|
const forward = (signal) => () => {
|
|
38941
39123
|
try {
|
|
38942
39124
|
child.kill(signal);
|
|
@@ -38945,8 +39127,10 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
38945
39127
|
};
|
|
38946
39128
|
const onInt = forward("SIGINT");
|
|
38947
39129
|
const onTerm = forward("SIGTERM");
|
|
39130
|
+
const onHup = forward("SIGHUP");
|
|
38948
39131
|
process.on("SIGINT", onInt);
|
|
38949
39132
|
process.on("SIGTERM", onTerm);
|
|
39133
|
+
process.on("SIGHUP", onHup);
|
|
38950
39134
|
let stateWritten = false;
|
|
38951
39135
|
const childPid = child.pid;
|
|
38952
39136
|
if (childPid !== void 0) {
|
|
@@ -38970,15 +39154,19 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
38970
39154
|
const cleanup = () => {
|
|
38971
39155
|
process.removeListener("SIGINT", onInt);
|
|
38972
39156
|
process.removeListener("SIGTERM", onTerm);
|
|
39157
|
+
process.removeListener("SIGHUP", onHup);
|
|
38973
39158
|
if (stateWritten) {
|
|
38974
|
-
|
|
38975
|
-
|
|
39159
|
+
const file2 = stateFileForBundle(paths.bundlePath);
|
|
39160
|
+
try {
|
|
39161
|
+
const cur = JSON.parse(fs14.readFileSync(file2, "utf8"));
|
|
39162
|
+
if (cur.pid === childPid) fs14.unlinkSync(file2);
|
|
39163
|
+
} catch {
|
|
39164
|
+
}
|
|
38976
39165
|
}
|
|
38977
39166
|
};
|
|
38978
39167
|
child.on("error", (err) => {
|
|
38979
39168
|
cleanup();
|
|
38980
|
-
|
|
38981
|
-
process.exit(1);
|
|
39169
|
+
cannotStart(err);
|
|
38982
39170
|
});
|
|
38983
39171
|
child.on("exit", (code, signal) => {
|
|
38984
39172
|
cleanup();
|
|
@@ -38990,51 +39178,96 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
38990
39178
|
function signalNumber(signal) {
|
|
38991
39179
|
return constants2.signals[signal] ?? null;
|
|
38992
39180
|
}
|
|
39181
|
+
var SUBCOMMAND_HELP = {
|
|
39182
|
+
status: `Usage: argent server status [--json]
|
|
39183
|
+
|
|
39184
|
+
Show the pid, port, and health of this install's tool-server.
|
|
39185
|
+
|
|
39186
|
+
Flags:
|
|
39187
|
+
--json Print machine-readable JSON.
|
|
39188
|
+
--help, -h Show this help.
|
|
39189
|
+
`,
|
|
39190
|
+
stop: `Usage: argent server stop
|
|
39191
|
+
|
|
39192
|
+
Terminate this install's tool-server.
|
|
39193
|
+
|
|
39194
|
+
Flags:
|
|
39195
|
+
--help, -h Show this help.
|
|
39196
|
+
`,
|
|
39197
|
+
logs: `Usage: argent server logs [-f]
|
|
39198
|
+
|
|
39199
|
+
Print the tool-server log (${LOG_FILE2}).
|
|
39200
|
+
|
|
39201
|
+
Flags:
|
|
39202
|
+
--follow, -f Keep printing new lines until Ctrl-C.
|
|
39203
|
+
--help, -h Show this help.
|
|
39204
|
+
`
|
|
39205
|
+
};
|
|
39206
|
+
var STATUS_OPTIONS = { json: { kind: "boolean" } };
|
|
39207
|
+
var STOP_OPTIONS = {};
|
|
39208
|
+
var LOGS_OPTIONS = { follow: { kind: "boolean", alias: "f" } };
|
|
39209
|
+
function parseSubcommandArgs(sub, argv, specs) {
|
|
39210
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
39211
|
+
console.log(SUBCOMMAND_HELP[sub]);
|
|
39212
|
+
return null;
|
|
39213
|
+
}
|
|
39214
|
+
try {
|
|
39215
|
+
const { positionals, options } = parseCommandArgs(argv, specs);
|
|
39216
|
+
if (positionals.length > 0) throw new UsageError(`Unexpected argument "${positionals[0]}"`);
|
|
39217
|
+
return options;
|
|
39218
|
+
} catch (err) {
|
|
39219
|
+
if (!(err instanceof UsageError)) throw err;
|
|
39220
|
+
console.error(`Error: ${err.message}
|
|
39221
|
+
`);
|
|
39222
|
+
console.log(SUBCOMMAND_HELP[sub]);
|
|
39223
|
+
process.exit(2);
|
|
39224
|
+
}
|
|
39225
|
+
}
|
|
38993
39226
|
function printServerHelp() {
|
|
38994
39227
|
console.log(`Usage:
|
|
38995
|
-
argent server start [flags] Spawn a long-lived tool-server
|
|
39228
|
+
argent server start [flags] Spawn a long-lived tool-server
|
|
38996
39229
|
argent server status [--json] Show tool-server pid, port, and health
|
|
38997
39230
|
argent server stop Terminate the running tool-server
|
|
38998
39231
|
argent server logs [-f] Print (or follow) the tool-server log
|
|
39232
|
+
|
|
39233
|
+
Run \`argent server <subcommand> --help\` for its flags.
|
|
38999
39234
|
`);
|
|
39000
39235
|
}
|
|
39001
39236
|
async function server(argv, options) {
|
|
39002
|
-
const sub = argv
|
|
39003
|
-
const json2 = argv.includes("--json");
|
|
39004
|
-
const follow = argv.includes("-f") || argv.includes("--follow");
|
|
39237
|
+
const [sub, ...rest] = argv;
|
|
39005
39238
|
if (!sub || sub === "--help" || sub === "-h") {
|
|
39006
39239
|
printServerHelp();
|
|
39007
39240
|
return;
|
|
39008
39241
|
}
|
|
39009
|
-
const rest = argv.slice(1);
|
|
39010
|
-
const actsOnServer = sub === "status" || sub === "stop" || sub === "logs";
|
|
39011
|
-
if (actsOnServer && (rest.includes("--help") || rest.includes("-h"))) {
|
|
39012
|
-
printServerHelp();
|
|
39013
|
-
return;
|
|
39014
|
-
}
|
|
39015
39242
|
switch (sub) {
|
|
39016
39243
|
case "start":
|
|
39017
39244
|
await startCmd(rest, options?.paths);
|
|
39018
39245
|
return;
|
|
39019
|
-
case "status":
|
|
39020
|
-
|
|
39246
|
+
case "status": {
|
|
39247
|
+
const parsed = parseSubcommandArgs("status", rest, STATUS_OPTIONS);
|
|
39248
|
+
if (parsed) await statusCmd(parsed.json === true, options?.paths);
|
|
39021
39249
|
return;
|
|
39250
|
+
}
|
|
39022
39251
|
case "stop":
|
|
39023
|
-
await stopCmd(options?.paths);
|
|
39252
|
+
if (parseSubcommandArgs("stop", rest, STOP_OPTIONS)) await stopCmd(options?.paths);
|
|
39024
39253
|
return;
|
|
39025
|
-
case "logs":
|
|
39026
|
-
|
|
39254
|
+
case "logs": {
|
|
39255
|
+
const parsed = parseSubcommandArgs("logs", rest, LOGS_OPTIONS);
|
|
39256
|
+
if (parsed) logsCmd(parsed.follow === true);
|
|
39027
39257
|
return;
|
|
39258
|
+
}
|
|
39028
39259
|
default:
|
|
39029
|
-
console.error(`Unknown subcommand: server ${sub}
|
|
39030
|
-
|
|
39260
|
+
console.error(`Error: Unknown subcommand: server ${sub}
|
|
39261
|
+
`);
|
|
39262
|
+
printServerHelp();
|
|
39263
|
+
process.exit(2);
|
|
39031
39264
|
}
|
|
39032
39265
|
}
|
|
39033
39266
|
|
|
39034
39267
|
// ../argent-cli/src/lens.ts
|
|
39035
|
-
import * as
|
|
39268
|
+
import * as fs15 from "node:fs";
|
|
39036
39269
|
import * as os2 from "node:os";
|
|
39037
|
-
import * as
|
|
39270
|
+
import * as path21 from "node:path";
|
|
39038
39271
|
|
|
39039
39272
|
// ../argent-cli/src/lens-terminal.ts
|
|
39040
39273
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
@@ -39252,12 +39485,12 @@ function isSessionAlive(session) {
|
|
|
39252
39485
|
// ../argent-cli/src/lens-pty.ts
|
|
39253
39486
|
import { chmodSync as chmodSync2, readdirSync as readdirSync2 } from "node:fs";
|
|
39254
39487
|
import { createRequire } from "node:module";
|
|
39255
|
-
import { dirname as
|
|
39488
|
+
import { dirname as dirname13, join as join19 } from "node:path";
|
|
39256
39489
|
var nodeRequire = createRequire(import.meta.url);
|
|
39257
39490
|
function ensureSpawnHelperExecutable(req = nodeRequire) {
|
|
39258
39491
|
if (process.platform !== "darwin") return;
|
|
39259
39492
|
try {
|
|
39260
|
-
const prebuilds = join19(
|
|
39493
|
+
const prebuilds = join19(dirname13(req.resolve("node-pty/package.json")), "prebuilds");
|
|
39261
39494
|
for (const entry of readdirSync2(prebuilds)) {
|
|
39262
39495
|
try {
|
|
39263
39496
|
chmodSync2(join19(prebuilds, entry, "spawn-helper"), 493);
|
|
@@ -39785,12 +40018,12 @@ async function lens(argv, options) {
|
|
|
39785
40018
|
await endSession(baseUrl);
|
|
39786
40019
|
process.exit(1);
|
|
39787
40020
|
}
|
|
39788
|
-
const seedFile =
|
|
39789
|
-
|
|
40021
|
+
const seedFile = path21.join(os2.tmpdir(), `argent-lens-seed-${process.pid}-${Date.now()}.txt`);
|
|
40022
|
+
fs15.writeFileSync(seedFile, buildSeedPrompt(), "utf8");
|
|
39790
40023
|
const launchCmd = agent.launch(shellQuote(process.cwd()), shellQuote(seedFile));
|
|
39791
40024
|
const removeSeedFile = () => {
|
|
39792
40025
|
try {
|
|
39793
|
-
|
|
40026
|
+
fs15.rmSync(seedFile, { force: true });
|
|
39794
40027
|
} catch {
|
|
39795
40028
|
}
|
|
39796
40029
|
};
|
|
@@ -39981,14 +40214,16 @@ async function endSession(baseUrl) {
|
|
|
39981
40214
|
|
|
39982
40215
|
// ../argent-cli/src/flags.ts
|
|
39983
40216
|
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
40217
|
+
import * as path23 from "node:path";
|
|
39984
40218
|
|
|
39985
40219
|
// ../argent-cli/src/secrets.ts
|
|
39986
40220
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
40221
|
+
var LIST_OPTIONS2 = { json: { kind: "boolean" } };
|
|
39987
40222
|
async function secrets(argv) {
|
|
39988
40223
|
const [sub, ...rest] = argv;
|
|
39989
40224
|
if (sub === void 0 || sub === "list") return cmdList(rest);
|
|
39990
40225
|
if (sub === "--help" || sub === "-h") return printUsage();
|
|
39991
|
-
if (sub === "--json") return cmdList([sub, ...rest]);
|
|
40226
|
+
if (sub === "--json") return cmdList(rest[0] === "list" ? [sub, ...rest.slice(1)] : argv);
|
|
39992
40227
|
console.error(`Error: unknown subcommand "secrets ${sub}". Try \`argent secrets --help\`.`);
|
|
39993
40228
|
process.exit(2);
|
|
39994
40229
|
}
|
|
@@ -40018,7 +40253,16 @@ Examples:
|
|
|
40018
40253
|
}
|
|
40019
40254
|
async function cmdList(argv) {
|
|
40020
40255
|
if (argv.includes("--help") || argv.includes("-h")) return printUsage();
|
|
40021
|
-
|
|
40256
|
+
let json2;
|
|
40257
|
+
try {
|
|
40258
|
+
const { positionals, options } = parseCommandArgs(argv, LIST_OPTIONS2);
|
|
40259
|
+
if (positionals.length > 0) throw new UsageError(`Unexpected argument "${positionals[0]}"`);
|
|
40260
|
+
json2 = options.json === true;
|
|
40261
|
+
} catch (err) {
|
|
40262
|
+
if (!(err instanceof UsageError)) throw err;
|
|
40263
|
+
console.error(`Error: ${err.message}. Try \`argent secrets --help\`.`);
|
|
40264
|
+
process.exit(2);
|
|
40265
|
+
}
|
|
40022
40266
|
const sources = secretSources();
|
|
40023
40267
|
const all = secretNames(sources);
|
|
40024
40268
|
if (json2) {
|
|
@@ -40086,6 +40330,19 @@ async function linkedSecretsNote() {
|
|
|
40086
40330
|
return `Note: a remote tool-server is linked (${routed.url}). ${note}`;
|
|
40087
40331
|
}
|
|
40088
40332
|
|
|
40333
|
+
// ../argent-cli/src/project-scope.ts
|
|
40334
|
+
import * as path22 from "node:path";
|
|
40335
|
+
function degenerateProjectScopeWarning(scope, file2) {
|
|
40336
|
+
if (scope !== "project") return null;
|
|
40337
|
+
if (isHomeDir(path22.dirname(path22.dirname(file2)))) {
|
|
40338
|
+
return `WARNING: no project found between ${process.cwd()} and your home directory \u2014 "project" scope resolved to the home directory, so this writes the GLOBAL ${path22.basename(file2, ".json")} file (${file2}).`;
|
|
40339
|
+
}
|
|
40340
|
+
if (findProjectRoot(process.cwd()) === null) {
|
|
40341
|
+
return `WARNING: no project markers (.argent, .git, package.json) found above ${process.cwd()} \u2014 treating it as the project root and creating ${file2}.`;
|
|
40342
|
+
}
|
|
40343
|
+
return null;
|
|
40344
|
+
}
|
|
40345
|
+
|
|
40089
40346
|
// ../argent-cli/src/flags.ts
|
|
40090
40347
|
function colorState(enabled) {
|
|
40091
40348
|
const label = (enabled ? "enabled" : "disabled").padEnd(8);
|
|
@@ -40154,18 +40411,21 @@ function runToggle(argv, command, registry2) {
|
|
|
40154
40411
|
process.exit(2);
|
|
40155
40412
|
}
|
|
40156
40413
|
const filePath = getFlagsPath(parsed.scope);
|
|
40414
|
+
const warning = degenerateProjectScopeWarning(parsed.scope, filePath);
|
|
40415
|
+
let wrote = true;
|
|
40157
40416
|
try {
|
|
40158
40417
|
if (command === "enable") {
|
|
40159
40418
|
setFlag(parsed.name, true, parsed.scope);
|
|
40160
40419
|
} else if (getFlagDefinition(parsed.name, registry2)?.defaultEnabled) {
|
|
40161
40420
|
setFlag(parsed.name, false, parsed.scope);
|
|
40162
40421
|
} else {
|
|
40163
|
-
unsetFlag(parsed.name, parsed.scope);
|
|
40422
|
+
wrote = unsetFlag(parsed.name, parsed.scope);
|
|
40164
40423
|
}
|
|
40165
40424
|
} catch (err) {
|
|
40166
40425
|
console.error(`Failed to ${command} flag: ${err instanceof Error ? err.message : String(err)}`);
|
|
40167
40426
|
process.exit(1);
|
|
40168
40427
|
}
|
|
40428
|
+
if (wrote && warning) console.error(import_picocolors2.default.yellow(warning));
|
|
40169
40429
|
if (command === "enable") {
|
|
40170
40430
|
console.log(`Enabled flag "${parsed.name}" (${parsed.scope}). Stored at ${filePath}.`);
|
|
40171
40431
|
} else {
|
|
@@ -40191,6 +40451,7 @@ function enable(argv, registry2 = FLAG_REGISTRY) {
|
|
|
40191
40451
|
function disable(argv, registry2 = FLAG_REGISTRY) {
|
|
40192
40452
|
runToggle(argv, "disable", registry2);
|
|
40193
40453
|
}
|
|
40454
|
+
var FLAGS_OPTIONS = { json: { kind: "boolean" } };
|
|
40194
40455
|
function flags(argv, registry2 = FLAG_REGISTRY) {
|
|
40195
40456
|
if (argv.includes("--help") || argv.includes("-h")) {
|
|
40196
40457
|
console.log(`Usage: argent flags [--json]
|
|
@@ -40205,8 +40466,20 @@ Options:
|
|
|
40205
40466
|
`);
|
|
40206
40467
|
return;
|
|
40207
40468
|
}
|
|
40208
|
-
|
|
40209
|
-
|
|
40469
|
+
let json2;
|
|
40470
|
+
try {
|
|
40471
|
+
const { positionals, options } = parseCommandArgs(argv, FLAGS_OPTIONS);
|
|
40472
|
+
if (positionals.length > 0) {
|
|
40473
|
+
throw new UsageError(`Unexpected extra argument: "${positionals[0]}"`);
|
|
40474
|
+
}
|
|
40475
|
+
json2 = options.json === true;
|
|
40476
|
+
} catch (err) {
|
|
40477
|
+
if (!(err instanceof UsageError)) throw err;
|
|
40478
|
+
console.error(`Error: ${err.message}`);
|
|
40479
|
+
process.exit(2);
|
|
40480
|
+
}
|
|
40481
|
+
const projectIsHome = isHomeDir(path23.dirname(path23.dirname(getFlagsPath("project"))));
|
|
40482
|
+
const projectFlags = projectIsHome ? {} : readFlags("project");
|
|
40210
40483
|
const globalFlags = readFlags("global");
|
|
40211
40484
|
const effective = {};
|
|
40212
40485
|
for (const [k, v] of Object.entries(globalFlags)) effective[k] = { value: v, scope: "global" };
|
|
@@ -40263,12 +40536,12 @@ Options:
|
|
|
40263
40536
|
}
|
|
40264
40537
|
console.log(`
|
|
40265
40538
|
Global: ${getFlagsPath("global")}`);
|
|
40266
|
-
console.log(` Project: ${getFlagsPath("project")}`);
|
|
40539
|
+
if (!projectIsHome) console.log(` Project: ${getFlagsPath("project")}`);
|
|
40267
40540
|
}
|
|
40268
40541
|
|
|
40269
40542
|
// ../argent-cli/src/config.ts
|
|
40270
40543
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
40271
|
-
import * as
|
|
40544
|
+
import * as path24 from "node:path";
|
|
40272
40545
|
function config2(argv) {
|
|
40273
40546
|
if (argv.length === 0 || argv[0] === "--help" || argv[0] === "-h") {
|
|
40274
40547
|
printUsage2();
|
|
@@ -40297,7 +40570,11 @@ Show every recognized configuration value, its effective (merged) value, and
|
|
|
40297
40570
|
the raw value stored at each scope.`);
|
|
40298
40571
|
return;
|
|
40299
40572
|
}
|
|
40300
|
-
const json2 = argv
|
|
40573
|
+
const { positionals, json: json2 } = parseArgs2(argv, LIST_OPTIONS3);
|
|
40574
|
+
if (positionals.length > 0) {
|
|
40575
|
+
console.error(`Error: unexpected extra argument "${positionals[0]}".`);
|
|
40576
|
+
process.exit(2);
|
|
40577
|
+
}
|
|
40301
40578
|
const entries = listConfig();
|
|
40302
40579
|
if (json2) {
|
|
40303
40580
|
console.log(JSON.stringify({ config: entries }, null, 2));
|
|
@@ -40331,7 +40608,7 @@ Print a configuration value. Without --scope, prints the effective value after
|
|
|
40331
40608
|
merging project and global. With --scope, prints only that scope's stored value.`);
|
|
40332
40609
|
return;
|
|
40333
40610
|
}
|
|
40334
|
-
const { positionals, scope, json: json2 } = parseArgs2(argv);
|
|
40611
|
+
const { positionals, scope, json: json2 } = parseArgs2(argv, GET_OPTIONS);
|
|
40335
40612
|
const key = positionals[0];
|
|
40336
40613
|
if (!key) {
|
|
40337
40614
|
console.error("Error: `argent config get` requires a <key>.");
|
|
@@ -40365,7 +40642,7 @@ write <project-root>/.argent/config.json. Booleans, numbers, and JSON arrays are
|
|
|
40365
40642
|
parsed (e.g. \`true\`, \`42\`, \`["a","b"]\`); anything else is stored as a string.`);
|
|
40366
40643
|
return;
|
|
40367
40644
|
}
|
|
40368
|
-
const { positionals, scope } = parseArgs2(argv);
|
|
40645
|
+
const { positionals, scope } = parseArgs2(argv, WRITE_OPTIONS);
|
|
40369
40646
|
const key = positionals[0];
|
|
40370
40647
|
const rawValue = positionals[1];
|
|
40371
40648
|
if (!key || rawValue === void 0) {
|
|
@@ -40377,7 +40654,7 @@ parsed (e.g. \`true\`, \`42\`, \`["a","b"]\`); anything else is stored as a stri
|
|
|
40377
40654
|
process.exit(2);
|
|
40378
40655
|
}
|
|
40379
40656
|
const targetScope = scope ?? "global";
|
|
40380
|
-
const warning =
|
|
40657
|
+
const warning = projectConfigWarning(targetScope);
|
|
40381
40658
|
try {
|
|
40382
40659
|
const stored = setConfigValue(key, coerceCliValue(rawValue), targetScope);
|
|
40383
40660
|
if (warning) console.error(import_picocolors3.default.yellow(warning));
|
|
@@ -40396,7 +40673,7 @@ Remove a configuration value at a scope (default global). Falls back to the
|
|
|
40396
40673
|
other scope / the default on the next read.`);
|
|
40397
40674
|
return;
|
|
40398
40675
|
}
|
|
40399
|
-
const { positionals, scope } = parseArgs2(argv);
|
|
40676
|
+
const { positionals, scope } = parseArgs2(argv, WRITE_OPTIONS);
|
|
40400
40677
|
const key = positionals[0];
|
|
40401
40678
|
if (!key) {
|
|
40402
40679
|
console.error("Error: `argent config unset` requires a <key>.");
|
|
@@ -40407,7 +40684,7 @@ other scope / the default on the next read.`);
|
|
|
40407
40684
|
process.exit(2);
|
|
40408
40685
|
}
|
|
40409
40686
|
const targetScope = scope ?? "global";
|
|
40410
|
-
const warning =
|
|
40687
|
+
const warning = projectConfigWarning(targetScope);
|
|
40411
40688
|
try {
|
|
40412
40689
|
const removed = unsetConfigValue(key, targetScope);
|
|
40413
40690
|
if (removed && warning) console.error(import_picocolors3.default.yellow(warning));
|
|
@@ -40420,13 +40697,14 @@ other scope / the default on the next read.`);
|
|
|
40420
40697
|
reportError(err);
|
|
40421
40698
|
}
|
|
40422
40699
|
}
|
|
40423
|
-
var
|
|
40424
|
-
|
|
40425
|
-
|
|
40426
|
-
};
|
|
40427
|
-
|
|
40700
|
+
var SCOPE_OPTION = { kind: "value", choices: ["global", "project"] };
|
|
40701
|
+
var JSON_OPTION = { kind: "boolean" };
|
|
40702
|
+
var LIST_OPTIONS3 = { json: JSON_OPTION };
|
|
40703
|
+
var GET_OPTIONS = { scope: SCOPE_OPTION, json: JSON_OPTION };
|
|
40704
|
+
var WRITE_OPTIONS = { scope: SCOPE_OPTION };
|
|
40705
|
+
function parseArgs2(argv, specs) {
|
|
40428
40706
|
try {
|
|
40429
|
-
const { positionals, options } = parseCommandArgs(argv,
|
|
40707
|
+
const { positionals, options } = parseCommandArgs(argv, specs);
|
|
40430
40708
|
return {
|
|
40431
40709
|
positionals,
|
|
40432
40710
|
scope: options.scope ?? null,
|
|
@@ -40443,18 +40721,10 @@ function wantsHelp(argv) {
|
|
|
40443
40721
|
}
|
|
40444
40722
|
function scopeLabel(scope) {
|
|
40445
40723
|
if (scope === "global") return "global";
|
|
40446
|
-
return `project: ${
|
|
40724
|
+
return `project: ${path24.dirname(configDir("project"))}`;
|
|
40447
40725
|
}
|
|
40448
|
-
function
|
|
40449
|
-
|
|
40450
|
-
const projDir = configDir("project");
|
|
40451
|
-
if (path21.resolve(projDir) === path21.resolve(configDir("global"))) {
|
|
40452
|
-
return `WARNING: no project found between ${process.cwd()} and your home directory \u2014 "project" scope resolved to the home directory, so this writes the GLOBAL config file (${path21.join(projDir, "config.json")}).`;
|
|
40453
|
-
}
|
|
40454
|
-
if (findProjectRoot(process.cwd()) === null) {
|
|
40455
|
-
return `WARNING: no project markers (.argent, .git, package.json) found above ${process.cwd()} \u2014 treating it as the project root and creating ${path21.join(projDir, "config.json")}.`;
|
|
40456
|
-
}
|
|
40457
|
-
return null;
|
|
40726
|
+
function projectConfigWarning(scope) {
|
|
40727
|
+
return degenerateProjectScopeWarning(scope, path24.join(configDir("project"), "config.json"));
|
|
40458
40728
|
}
|
|
40459
40729
|
function restartHint(key) {
|
|
40460
40730
|
if (key !== "android.adbServerPort") return null;
|
|
@@ -41280,7 +41550,7 @@ import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
|
41280
41550
|
import process$1 from "node:process";
|
|
41281
41551
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
41282
41552
|
import { existsSync as existsSync7, lstatSync as lstatSync3, readdirSync as readdirSync3 } from "node:fs";
|
|
41283
|
-
import { dirname as
|
|
41553
|
+
import { dirname as dirname17, join as join22 } from "node:path";
|
|
41284
41554
|
function isUnicodeSupported() {
|
|
41285
41555
|
if (process$1.platform !== "win32") {
|
|
41286
41556
|
return process$1.env.TERM !== "linux";
|
|
@@ -42168,7 +42438,9 @@ async function unlink3(argv) {
|
|
|
42168
42438
|
|
|
42169
42439
|
// ../argent-cli/src/telemetry.ts
|
|
42170
42440
|
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
42441
|
+
import * as path25 from "node:path";
|
|
42171
42442
|
var SCOPES = ["global", "project"];
|
|
42443
|
+
var SUBCOMMANDS = ["status", "enable", "disable"];
|
|
42172
42444
|
var TELEMETRY_OPTIONS = {
|
|
42173
42445
|
scope: { kind: "value", choices: SCOPES }
|
|
42174
42446
|
};
|
|
@@ -42177,8 +42449,14 @@ async function telemetry(args) {
|
|
|
42177
42449
|
let scope = "global";
|
|
42178
42450
|
const wantsHelp2 = args.includes("--help") || args.includes("-h");
|
|
42179
42451
|
if (!wantsHelp2) {
|
|
42452
|
+
if (sub !== void 0 && !SUBCOMMANDS.includes(sub)) {
|
|
42453
|
+
console.error(`Error: Unknown subcommand: telemetry ${sub}`);
|
|
42454
|
+
printUsage3();
|
|
42455
|
+
process.exit(2);
|
|
42456
|
+
}
|
|
42180
42457
|
try {
|
|
42181
|
-
const
|
|
42458
|
+
const specs = sub === "status" ? {} : TELEMETRY_OPTIONS;
|
|
42459
|
+
const { positionals, options } = parseCommandArgs(args.slice(1), specs);
|
|
42182
42460
|
if (positionals.length > 0) {
|
|
42183
42461
|
throw new UsageError(`Unexpected argument "${positionals[0]}".`);
|
|
42184
42462
|
}
|
|
@@ -42211,10 +42489,6 @@ async function telemetry(args) {
|
|
|
42211
42489
|
case "disable":
|
|
42212
42490
|
await cmdDisable(scope);
|
|
42213
42491
|
return;
|
|
42214
|
-
default:
|
|
42215
|
-
console.error(`Unknown subcommand: telemetry ${sub}`);
|
|
42216
|
-
await shutdown();
|
|
42217
|
-
process.exit(1);
|
|
42218
42492
|
}
|
|
42219
42493
|
}
|
|
42220
42494
|
function printUsage3() {
|
|
@@ -42252,9 +42526,14 @@ function describeSource(source) {
|
|
|
42252
42526
|
return "default (no opt-out set)";
|
|
42253
42527
|
}
|
|
42254
42528
|
}
|
|
42529
|
+
function projectConfigWarning2(scope) {
|
|
42530
|
+
return degenerateProjectScopeWarning(scope, path25.join(configDir("project"), "config.json"));
|
|
42531
|
+
}
|
|
42255
42532
|
async function cmdEnable(scope) {
|
|
42533
|
+
const warning = projectConfigWarning2(scope);
|
|
42256
42534
|
const wasEnabled = isEnabled();
|
|
42257
42535
|
markEnabled(scope);
|
|
42536
|
+
if (warning) console.error(import_picocolors5.default.yellow(warning));
|
|
42258
42537
|
const nowEnabled = isEnabled();
|
|
42259
42538
|
if (!nowEnabled) {
|
|
42260
42539
|
console.log(
|
|
@@ -42270,8 +42549,10 @@ async function cmdEnable(scope) {
|
|
|
42270
42549
|
await shutdown();
|
|
42271
42550
|
}
|
|
42272
42551
|
async function cmdDisable(scope) {
|
|
42552
|
+
const warning = projectConfigWarning2(scope);
|
|
42273
42553
|
const wasEnabled = isEnabled();
|
|
42274
42554
|
await markDisabled(scope);
|
|
42555
|
+
if (warning) console.error(import_picocolors5.default.yellow(warning));
|
|
42275
42556
|
if (!wasEnabled) {
|
|
42276
42557
|
console.log(import_picocolors5.default.dim(`Telemetry was already disabled (written at ${scopeLabel2(scope)}).`));
|
|
42277
42558
|
} else {
|
|
@@ -42282,8 +42563,8 @@ async function cmdDisable(scope) {
|
|
|
42282
42563
|
|
|
42283
42564
|
// ../argent-cli/src/providers.ts
|
|
42284
42565
|
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
42285
|
-
import * as
|
|
42286
|
-
import * as
|
|
42566
|
+
import * as fs19 from "node:fs";
|
|
42567
|
+
import * as path28 from "node:path";
|
|
42287
42568
|
|
|
42288
42569
|
// ../device-providers/src/contract.ts
|
|
42289
42570
|
var PROVIDER_SCHEMA_VERSION = 1;
|
|
@@ -42428,9 +42709,9 @@ var providerEnvelopeSchema = providerRecordSchema.extend({
|
|
|
42428
42709
|
});
|
|
42429
42710
|
|
|
42430
42711
|
// ../device-providers/src/read.ts
|
|
42431
|
-
import * as
|
|
42712
|
+
import * as fs16 from "node:fs";
|
|
42432
42713
|
import * as os3 from "node:os";
|
|
42433
|
-
import * as
|
|
42714
|
+
import * as path26 from "node:path";
|
|
42434
42715
|
var DISABLE_ENV = "ARGENT_DISABLE_DEVICE_PROVIDERS";
|
|
42435
42716
|
var OVERRIDE_ENV = "ARGENT_DEVICE_PROVIDERS";
|
|
42436
42717
|
function resolveHomeDir2() {
|
|
@@ -42439,7 +42720,7 @@ function resolveHomeDir2() {
|
|
|
42439
42720
|
return trimmed ? raw : os3.homedir();
|
|
42440
42721
|
}
|
|
42441
42722
|
function providersDirectory() {
|
|
42442
|
-
return
|
|
42723
|
+
return path26.join(resolveHomeDir2(), ".argent", "providers");
|
|
42443
42724
|
}
|
|
42444
42725
|
function discoveryDisabled() {
|
|
42445
42726
|
const raw = process.env[DISABLE_ENV];
|
|
@@ -42455,7 +42736,7 @@ function warnOnce(key, message) {
|
|
|
42455
42736
|
function readProviderFile(file2) {
|
|
42456
42737
|
let raw;
|
|
42457
42738
|
try {
|
|
42458
|
-
raw =
|
|
42739
|
+
raw = fs16.readFileSync(file2, "utf8");
|
|
42459
42740
|
} catch {
|
|
42460
42741
|
return void 0;
|
|
42461
42742
|
}
|
|
@@ -42505,15 +42786,15 @@ function discoverProviders() {
|
|
|
42505
42786
|
function descriptorFiles() {
|
|
42506
42787
|
const directory = providersDirectory();
|
|
42507
42788
|
try {
|
|
42508
|
-
return
|
|
42789
|
+
return fs16.readdirSync(directory).filter((name) => name.endsWith(".json")).sort().map((name) => path26.join(directory, name));
|
|
42509
42790
|
} catch {
|
|
42510
42791
|
return [];
|
|
42511
42792
|
}
|
|
42512
42793
|
}
|
|
42513
42794
|
|
|
42514
42795
|
// ../device-providers/src/write.ts
|
|
42515
|
-
import * as
|
|
42516
|
-
import * as
|
|
42796
|
+
import * as fs17 from "node:fs";
|
|
42797
|
+
import * as path27 from "node:path";
|
|
42517
42798
|
var ProviderValidationError = class extends Error {
|
|
42518
42799
|
/** One line per problem, `path: message`, in the order zod reported them. */
|
|
42519
42800
|
issues;
|
|
@@ -42565,20 +42846,20 @@ function publishProvider(record2, options = {}) {
|
|
|
42565
42846
|
);
|
|
42566
42847
|
}
|
|
42567
42848
|
const directory = providersDirectory();
|
|
42568
|
-
const file2 =
|
|
42849
|
+
const file2 = path27.join(directory, `${validated.id}.json`);
|
|
42569
42850
|
const body = JSON.stringify(canonicalize(candidate), null, 2) + "\n";
|
|
42570
42851
|
try {
|
|
42571
|
-
if (
|
|
42852
|
+
if (fs17.readFileSync(file2, "utf8") === body) return { changed: false, path: file2 };
|
|
42572
42853
|
} catch {
|
|
42573
42854
|
}
|
|
42574
|
-
|
|
42855
|
+
fs17.mkdirSync(directory, { recursive: true });
|
|
42575
42856
|
const temporary = `${file2}.${process.pid}.tmp`;
|
|
42576
42857
|
try {
|
|
42577
|
-
|
|
42578
|
-
|
|
42858
|
+
fs17.writeFileSync(temporary, body);
|
|
42859
|
+
fs17.renameSync(temporary, file2);
|
|
42579
42860
|
} catch (error63) {
|
|
42580
42861
|
try {
|
|
42581
|
-
|
|
42862
|
+
fs17.rmSync(temporary, { force: true });
|
|
42582
42863
|
} catch {
|
|
42583
42864
|
}
|
|
42584
42865
|
throw error63;
|
|
@@ -42589,9 +42870,9 @@ function withdrawProvider(id) {
|
|
|
42589
42870
|
if (!PROVIDER_ID_SHAPE.test(id)) {
|
|
42590
42871
|
throw new Error(`'${id}' is not a valid provider id (${String(PROVIDER_ID_SHAPE)}).`);
|
|
42591
42872
|
}
|
|
42592
|
-
const file2 =
|
|
42873
|
+
const file2 = path27.join(providersDirectory(), `${id}.json`);
|
|
42593
42874
|
try {
|
|
42594
|
-
|
|
42875
|
+
fs17.unlinkSync(file2);
|
|
42595
42876
|
return true;
|
|
42596
42877
|
} catch (e) {
|
|
42597
42878
|
if (e.code === "ENOENT") return false;
|
|
@@ -42621,7 +42902,7 @@ function pruneOrphanedProviders(options = {}) {
|
|
|
42621
42902
|
continue;
|
|
42622
42903
|
}
|
|
42623
42904
|
try {
|
|
42624
|
-
|
|
42905
|
+
fs17.unlinkSync(file2);
|
|
42625
42906
|
removed.push(entry);
|
|
42626
42907
|
} catch {
|
|
42627
42908
|
}
|
|
@@ -42631,7 +42912,7 @@ function pruneOrphanedProviders(options = {}) {
|
|
|
42631
42912
|
|
|
42632
42913
|
// ../argent-cli/src/providers-check.ts
|
|
42633
42914
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
42634
|
-
import * as
|
|
42915
|
+
import * as fs18 from "node:fs";
|
|
42635
42916
|
var KNOWN_CAPABILITIES = new Set(EXTERNAL_CAPABILITIES);
|
|
42636
42917
|
var PROBE_TIMEOUT_MS = 5e3;
|
|
42637
42918
|
function error62(message) {
|
|
@@ -42697,7 +42978,7 @@ async function checkDevices(devices, findings) {
|
|
|
42697
42978
|
);
|
|
42698
42979
|
} else {
|
|
42699
42980
|
try {
|
|
42700
|
-
|
|
42981
|
+
fs18.accessSync(device.deviceSet, fs18.constants.R_OK);
|
|
42701
42982
|
} catch {
|
|
42702
42983
|
findings.push(
|
|
42703
42984
|
error62(`${label}: deviceSet '${device.deviceSet}' is not readable by this user`)
|
|
@@ -42754,7 +43035,7 @@ async function checkDevices(devices, findings) {
|
|
|
42754
43035
|
);
|
|
42755
43036
|
} else {
|
|
42756
43037
|
try {
|
|
42757
|
-
|
|
43038
|
+
fs18.accessSync(device.nativeDevtools.socketPath, fs18.constants.R_OK | fs18.constants.W_OK);
|
|
42758
43039
|
} catch {
|
|
42759
43040
|
findings.push(
|
|
42760
43041
|
error62(
|
|
@@ -42825,7 +43106,7 @@ async function checkDescriptorFile(file2, expectedVersion) {
|
|
|
42825
43106
|
const report = { deviceCount: 0, findings, source: file2 };
|
|
42826
43107
|
let raw;
|
|
42827
43108
|
try {
|
|
42828
|
-
raw =
|
|
43109
|
+
raw = fs18.readFileSync(file2, "utf8");
|
|
42829
43110
|
} catch (e) {
|
|
42830
43111
|
findings.push(error62(`unreadable: ${e instanceof Error ? e.message : String(e)}`));
|
|
42831
43112
|
return report;
|
|
@@ -42886,12 +43167,20 @@ ${title}`);
|
|
|
42886
43167
|
}
|
|
42887
43168
|
|
|
42888
43169
|
// ../argent-cli/src/providers.ts
|
|
42889
|
-
var
|
|
43170
|
+
var SUBCOMMANDS2 = ["check", "list", "prune", "publish", "withdraw"];
|
|
43171
|
+
var SUBCOMMAND_FLAGS = {
|
|
43172
|
+
check: ["--file", "--json", "--schema-version"],
|
|
43173
|
+
list: ["--json"],
|
|
43174
|
+
prune: ["--dry-run", "--json"],
|
|
43175
|
+
publish: ["--file", "--json", "--pid", "--schema-version", "--stdin"],
|
|
43176
|
+
withdraw: ["--json"]
|
|
43177
|
+
};
|
|
42890
43178
|
var UsageError2 = class extends Error {
|
|
42891
43179
|
};
|
|
42892
43180
|
function parseArgs3(argv) {
|
|
42893
43181
|
const parsed = {
|
|
42894
43182
|
dryRun: false,
|
|
43183
|
+
flags: [],
|
|
42895
43184
|
json: false,
|
|
42896
43185
|
operands: [],
|
|
42897
43186
|
schemaVersion: PROVIDER_SCHEMA_VERSION,
|
|
@@ -42910,6 +43199,7 @@ function parseArgs3(argv) {
|
|
|
42910
43199
|
};
|
|
42911
43200
|
for (let i2 = 0; i2 < argv.length; i2++) {
|
|
42912
43201
|
const token = argv[i2];
|
|
43202
|
+
if (token.startsWith("--")) parsed.flags.push(token.split("=")[0]);
|
|
42913
43203
|
if (token === "--json") {
|
|
42914
43204
|
parsed.json = true;
|
|
42915
43205
|
} else if (token === "--dry-run") {
|
|
@@ -42961,7 +43251,7 @@ async function readDocument(args) {
|
|
|
42961
43251
|
}
|
|
42962
43252
|
if (args.file) {
|
|
42963
43253
|
try {
|
|
42964
|
-
return { raw:
|
|
43254
|
+
return { raw: fs19.readFileSync(args.file, "utf8"), source: args.file };
|
|
42965
43255
|
} catch (e) {
|
|
42966
43256
|
throw new UsageError2(
|
|
42967
43257
|
`cannot read ${args.file}: ${e instanceof Error ? e.message : String(e)}`
|
|
@@ -43094,7 +43384,7 @@ function runWithdraw(args) {
|
|
|
43094
43384
|
throw new UsageError2(`'${id}' is not a valid provider id (${String(PROVIDER_ID_SHAPE)})`);
|
|
43095
43385
|
}
|
|
43096
43386
|
const removed = withdrawProvider(id);
|
|
43097
|
-
const file2 =
|
|
43387
|
+
const file2 = path28.join(providersDirectory(), `${id}.json`);
|
|
43098
43388
|
if (args.json) {
|
|
43099
43389
|
console.log(JSON.stringify({ ok: true, path: file2, removed }, null, 2));
|
|
43100
43390
|
return;
|
|
@@ -43222,7 +43512,8 @@ Options:
|
|
|
43222
43512
|
later prune can remove this descriptor if that
|
|
43223
43513
|
process dies. Overrides any pid in the document.
|
|
43224
43514
|
--dry-run prune: report what would be removed, remove nothing.
|
|
43225
|
-
--schema-version <n>
|
|
43515
|
+
--schema-version <n> check, publish: the contract version to validate
|
|
43516
|
+
against (default ${PROVIDER_SCHEMA_VERSION}).
|
|
43226
43517
|
--json Emit a machine-readable report on stdout.
|
|
43227
43518
|
--help, -h Show this message.
|
|
43228
43519
|
|
|
@@ -43255,7 +43546,7 @@ async function providers(argv) {
|
|
|
43255
43546
|
if (subcommand === void 0) process.exit(2);
|
|
43256
43547
|
return;
|
|
43257
43548
|
}
|
|
43258
|
-
if (!
|
|
43549
|
+
if (!SUBCOMMANDS2.includes(subcommand)) {
|
|
43259
43550
|
console.error(`Unknown subcommand: "${subcommand}"`);
|
|
43260
43551
|
printHelp3();
|
|
43261
43552
|
process.exit(2);
|
|
@@ -43276,6 +43567,13 @@ async function providers(argv) {
|
|
|
43276
43567
|
console.error(`Unknown argument: "${args.operands[0]}"`);
|
|
43277
43568
|
process.exit(2);
|
|
43278
43569
|
}
|
|
43570
|
+
const stray = args.flags.find(
|
|
43571
|
+
(flag) => !SUBCOMMAND_FLAGS[subcommand].includes(flag)
|
|
43572
|
+
);
|
|
43573
|
+
if (stray !== void 0) {
|
|
43574
|
+
console.error(`${stray} does not apply to \`argent providers ${subcommand}\``);
|
|
43575
|
+
process.exit(2);
|
|
43576
|
+
}
|
|
43279
43577
|
try {
|
|
43280
43578
|
switch (subcommand) {
|
|
43281
43579
|
case "check":
|