@swmansion/argent 0.34.1-next.4 → 0.34.1-next.40
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 +923 -558
- package/dist/client.js +345 -179
- package/dist/flow-script-runner.mjs +1 -0
- package/dist/installer-help.js +4 -0
- package/dist/installer-help.js.map +1 -1
- package/dist/installer.mjs +1219 -922
- 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 +558 -712
- package/dist/preview-ui/index.html +28 -2
- package/dist/tool-args.generated.d.ts +58 -12
- package/dist/tool-server.cjs +11444 -5226
- 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/SKILL.md +22 -21
- 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-metro-debugger/SKILL.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/skills/argent-screenshot-diff/SKILL.md +1 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -124,17 +124,17 @@ var require_visit = __commonJS({
|
|
|
124
124
|
visit2.BREAK = BREAK;
|
|
125
125
|
visit2.SKIP = SKIP;
|
|
126
126
|
visit2.REMOVE = REMOVE;
|
|
127
|
-
function visit_(key, node2, visitor,
|
|
128
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
127
|
+
function visit_(key, node2, visitor, path29) {
|
|
128
|
+
const ctrl = callVisitor(key, node2, visitor, path29);
|
|
129
129
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
130
|
-
replaceNode(key,
|
|
131
|
-
return visit_(key, ctrl, visitor,
|
|
130
|
+
replaceNode(key, path29, ctrl);
|
|
131
|
+
return visit_(key, ctrl, visitor, path29);
|
|
132
132
|
}
|
|
133
133
|
if (typeof ctrl !== "symbol") {
|
|
134
134
|
if (identity2.isCollection(node2)) {
|
|
135
|
-
|
|
135
|
+
path29 = Object.freeze(path29.concat(node2));
|
|
136
136
|
for (let i2 = 0; i2 < node2.items.length; ++i2) {
|
|
137
|
-
const ci = visit_(i2, node2.items[i2], visitor,
|
|
137
|
+
const ci = visit_(i2, node2.items[i2], visitor, path29);
|
|
138
138
|
if (typeof ci === "number")
|
|
139
139
|
i2 = ci - 1;
|
|
140
140
|
else if (ci === BREAK)
|
|
@@ -145,13 +145,13 @@ var require_visit = __commonJS({
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
} else if (identity2.isPair(node2)) {
|
|
148
|
-
|
|
149
|
-
const ck = visit_("key", node2.key, visitor,
|
|
148
|
+
path29 = Object.freeze(path29.concat(node2));
|
|
149
|
+
const ck = visit_("key", node2.key, visitor, path29);
|
|
150
150
|
if (ck === BREAK)
|
|
151
151
|
return BREAK;
|
|
152
152
|
else if (ck === REMOVE)
|
|
153
153
|
node2.key = null;
|
|
154
|
-
const cv = visit_("value", node2.value, visitor,
|
|
154
|
+
const cv = visit_("value", node2.value, visitor, path29);
|
|
155
155
|
if (cv === BREAK)
|
|
156
156
|
return BREAK;
|
|
157
157
|
else if (cv === REMOVE)
|
|
@@ -172,17 +172,17 @@ var require_visit = __commonJS({
|
|
|
172
172
|
visitAsync.BREAK = BREAK;
|
|
173
173
|
visitAsync.SKIP = SKIP;
|
|
174
174
|
visitAsync.REMOVE = REMOVE;
|
|
175
|
-
async function visitAsync_(key, node2, visitor,
|
|
176
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
175
|
+
async function visitAsync_(key, node2, visitor, path29) {
|
|
176
|
+
const ctrl = await callVisitor(key, node2, visitor, path29);
|
|
177
177
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
178
|
-
replaceNode(key,
|
|
179
|
-
return visitAsync_(key, ctrl, visitor,
|
|
178
|
+
replaceNode(key, path29, ctrl);
|
|
179
|
+
return visitAsync_(key, ctrl, visitor, path29);
|
|
180
180
|
}
|
|
181
181
|
if (typeof ctrl !== "symbol") {
|
|
182
182
|
if (identity2.isCollection(node2)) {
|
|
183
|
-
|
|
183
|
+
path29 = Object.freeze(path29.concat(node2));
|
|
184
184
|
for (let i2 = 0; i2 < node2.items.length; ++i2) {
|
|
185
|
-
const ci = await visitAsync_(i2, node2.items[i2], visitor,
|
|
185
|
+
const ci = await visitAsync_(i2, node2.items[i2], visitor, path29);
|
|
186
186
|
if (typeof ci === "number")
|
|
187
187
|
i2 = ci - 1;
|
|
188
188
|
else if (ci === BREAK)
|
|
@@ -193,13 +193,13 @@ var require_visit = __commonJS({
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
} else if (identity2.isPair(node2)) {
|
|
196
|
-
|
|
197
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
196
|
+
path29 = Object.freeze(path29.concat(node2));
|
|
197
|
+
const ck = await visitAsync_("key", node2.key, visitor, path29);
|
|
198
198
|
if (ck === BREAK)
|
|
199
199
|
return BREAK;
|
|
200
200
|
else if (ck === REMOVE)
|
|
201
201
|
node2.key = null;
|
|
202
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
202
|
+
const cv = await visitAsync_("value", node2.value, visitor, path29);
|
|
203
203
|
if (cv === BREAK)
|
|
204
204
|
return BREAK;
|
|
205
205
|
else if (cv === REMOVE)
|
|
@@ -226,23 +226,23 @@ var require_visit = __commonJS({
|
|
|
226
226
|
}
|
|
227
227
|
return visitor;
|
|
228
228
|
}
|
|
229
|
-
function callVisitor(key, node2, visitor,
|
|
229
|
+
function callVisitor(key, node2, visitor, path29) {
|
|
230
230
|
if (typeof visitor === "function")
|
|
231
|
-
return visitor(key, node2,
|
|
231
|
+
return visitor(key, node2, path29);
|
|
232
232
|
if (identity2.isMap(node2))
|
|
233
|
-
return visitor.Map?.(key, node2,
|
|
233
|
+
return visitor.Map?.(key, node2, path29);
|
|
234
234
|
if (identity2.isSeq(node2))
|
|
235
|
-
return visitor.Seq?.(key, node2,
|
|
235
|
+
return visitor.Seq?.(key, node2, path29);
|
|
236
236
|
if (identity2.isPair(node2))
|
|
237
|
-
return visitor.Pair?.(key, node2,
|
|
237
|
+
return visitor.Pair?.(key, node2, path29);
|
|
238
238
|
if (identity2.isScalar(node2))
|
|
239
|
-
return visitor.Scalar?.(key, node2,
|
|
239
|
+
return visitor.Scalar?.(key, node2, path29);
|
|
240
240
|
if (identity2.isAlias(node2))
|
|
241
|
-
return visitor.Alias?.(key, node2,
|
|
241
|
+
return visitor.Alias?.(key, node2, path29);
|
|
242
242
|
return void 0;
|
|
243
243
|
}
|
|
244
|
-
function replaceNode(key,
|
|
245
|
-
const parent =
|
|
244
|
+
function replaceNode(key, path29, node2) {
|
|
245
|
+
const parent = path29[path29.length - 1];
|
|
246
246
|
if (identity2.isCollection(parent)) {
|
|
247
247
|
parent.items[key] = node2;
|
|
248
248
|
} else if (identity2.isPair(parent)) {
|
|
@@ -854,10 +854,10 @@ var require_Collection = __commonJS({
|
|
|
854
854
|
var createNode = require_createNode();
|
|
855
855
|
var identity2 = require_identity();
|
|
856
856
|
var Node = require_Node();
|
|
857
|
-
function collectionFromPath(schema,
|
|
857
|
+
function collectionFromPath(schema, path29, value) {
|
|
858
858
|
let v = value;
|
|
859
|
-
for (let i2 =
|
|
860
|
-
const k =
|
|
859
|
+
for (let i2 = path29.length - 1; i2 >= 0; --i2) {
|
|
860
|
+
const k = path29[i2];
|
|
861
861
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
862
862
|
const a2 = [];
|
|
863
863
|
a2[k] = v;
|
|
@@ -876,7 +876,7 @@ var require_Collection = __commonJS({
|
|
|
876
876
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
877
877
|
});
|
|
878
878
|
}
|
|
879
|
-
var isEmptyPath = (
|
|
879
|
+
var isEmptyPath = (path29) => path29 == null || typeof path29 === "object" && !!path29[Symbol.iterator]().next().done;
|
|
880
880
|
var Collection = class extends Node.NodeBase {
|
|
881
881
|
constructor(type, schema) {
|
|
882
882
|
super(type);
|
|
@@ -906,11 +906,11 @@ var require_Collection = __commonJS({
|
|
|
906
906
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
907
907
|
* that already exists in the map.
|
|
908
908
|
*/
|
|
909
|
-
addIn(
|
|
910
|
-
if (isEmptyPath(
|
|
909
|
+
addIn(path29, value) {
|
|
910
|
+
if (isEmptyPath(path29))
|
|
911
911
|
this.add(value);
|
|
912
912
|
else {
|
|
913
|
-
const [key, ...rest] =
|
|
913
|
+
const [key, ...rest] = path29;
|
|
914
914
|
const node2 = this.get(key, true);
|
|
915
915
|
if (identity2.isCollection(node2))
|
|
916
916
|
node2.addIn(rest, value);
|
|
@@ -924,8 +924,8 @@ var require_Collection = __commonJS({
|
|
|
924
924
|
* Removes a value from the collection.
|
|
925
925
|
* @returns `true` if the item was found and removed.
|
|
926
926
|
*/
|
|
927
|
-
deleteIn(
|
|
928
|
-
const [key, ...rest] =
|
|
927
|
+
deleteIn(path29) {
|
|
928
|
+
const [key, ...rest] = path29;
|
|
929
929
|
if (rest.length === 0)
|
|
930
930
|
return this.delete(key);
|
|
931
931
|
const node2 = this.get(key, true);
|
|
@@ -939,8 +939,8 @@ var require_Collection = __commonJS({
|
|
|
939
939
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
940
940
|
* `true` (collections are always returned intact).
|
|
941
941
|
*/
|
|
942
|
-
getIn(
|
|
943
|
-
const [key, ...rest] =
|
|
942
|
+
getIn(path29, keepScalar) {
|
|
943
|
+
const [key, ...rest] = path29;
|
|
944
944
|
const node2 = this.get(key, true);
|
|
945
945
|
if (rest.length === 0)
|
|
946
946
|
return !keepScalar && identity2.isScalar(node2) ? node2.value : node2;
|
|
@@ -958,8 +958,8 @@ var require_Collection = __commonJS({
|
|
|
958
958
|
/**
|
|
959
959
|
* Checks if the collection includes a value with the key `key`.
|
|
960
960
|
*/
|
|
961
|
-
hasIn(
|
|
962
|
-
const [key, ...rest] =
|
|
961
|
+
hasIn(path29) {
|
|
962
|
+
const [key, ...rest] = path29;
|
|
963
963
|
if (rest.length === 0)
|
|
964
964
|
return this.has(key);
|
|
965
965
|
const node2 = this.get(key, true);
|
|
@@ -969,8 +969,8 @@ var require_Collection = __commonJS({
|
|
|
969
969
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
970
970
|
* boolean to add/remove the item from the set.
|
|
971
971
|
*/
|
|
972
|
-
setIn(
|
|
973
|
-
const [key, ...rest] =
|
|
972
|
+
setIn(path29, value) {
|
|
973
|
+
const [key, ...rest] = path29;
|
|
974
974
|
if (rest.length === 0) {
|
|
975
975
|
this.set(key, value);
|
|
976
976
|
} else {
|
|
@@ -3485,9 +3485,9 @@ var require_Document = __commonJS({
|
|
|
3485
3485
|
this.contents.add(value);
|
|
3486
3486
|
}
|
|
3487
3487
|
/** Adds a value to the document. */
|
|
3488
|
-
addIn(
|
|
3488
|
+
addIn(path29, value) {
|
|
3489
3489
|
if (assertCollection(this.contents))
|
|
3490
|
-
this.contents.addIn(
|
|
3490
|
+
this.contents.addIn(path29, value);
|
|
3491
3491
|
}
|
|
3492
3492
|
/**
|
|
3493
3493
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3562,14 +3562,14 @@ var require_Document = __commonJS({
|
|
|
3562
3562
|
* Removes a value from the document.
|
|
3563
3563
|
* @returns `true` if the item was found and removed.
|
|
3564
3564
|
*/
|
|
3565
|
-
deleteIn(
|
|
3566
|
-
if (Collection.isEmptyPath(
|
|
3565
|
+
deleteIn(path29) {
|
|
3566
|
+
if (Collection.isEmptyPath(path29)) {
|
|
3567
3567
|
if (this.contents == null)
|
|
3568
3568
|
return false;
|
|
3569
3569
|
this.contents = null;
|
|
3570
3570
|
return true;
|
|
3571
3571
|
}
|
|
3572
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3572
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path29) : false;
|
|
3573
3573
|
}
|
|
3574
3574
|
/**
|
|
3575
3575
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3584,10 +3584,10 @@ var require_Document = __commonJS({
|
|
|
3584
3584
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3585
3585
|
* `true` (collections are always returned intact).
|
|
3586
3586
|
*/
|
|
3587
|
-
getIn(
|
|
3588
|
-
if (Collection.isEmptyPath(
|
|
3587
|
+
getIn(path29, keepScalar) {
|
|
3588
|
+
if (Collection.isEmptyPath(path29))
|
|
3589
3589
|
return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3590
|
-
return identity2.isCollection(this.contents) ? this.contents.getIn(
|
|
3590
|
+
return identity2.isCollection(this.contents) ? this.contents.getIn(path29, keepScalar) : void 0;
|
|
3591
3591
|
}
|
|
3592
3592
|
/**
|
|
3593
3593
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3598,10 +3598,10 @@ var require_Document = __commonJS({
|
|
|
3598
3598
|
/**
|
|
3599
3599
|
* Checks if the document includes a value at `path`.
|
|
3600
3600
|
*/
|
|
3601
|
-
hasIn(
|
|
3602
|
-
if (Collection.isEmptyPath(
|
|
3601
|
+
hasIn(path29) {
|
|
3602
|
+
if (Collection.isEmptyPath(path29))
|
|
3603
3603
|
return this.contents !== void 0;
|
|
3604
|
-
return identity2.isCollection(this.contents) ? this.contents.hasIn(
|
|
3604
|
+
return identity2.isCollection(this.contents) ? this.contents.hasIn(path29) : false;
|
|
3605
3605
|
}
|
|
3606
3606
|
/**
|
|
3607
3607
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3618,13 +3618,13 @@ var require_Document = __commonJS({
|
|
|
3618
3618
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3619
3619
|
* boolean to add/remove the item from the set.
|
|
3620
3620
|
*/
|
|
3621
|
-
setIn(
|
|
3622
|
-
if (Collection.isEmptyPath(
|
|
3621
|
+
setIn(path29, value) {
|
|
3622
|
+
if (Collection.isEmptyPath(path29)) {
|
|
3623
3623
|
this.contents = value;
|
|
3624
3624
|
} else if (this.contents == null) {
|
|
3625
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3625
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path29), value);
|
|
3626
3626
|
} else if (assertCollection(this.contents)) {
|
|
3627
|
-
this.contents.setIn(
|
|
3627
|
+
this.contents.setIn(path29, value);
|
|
3628
3628
|
}
|
|
3629
3629
|
}
|
|
3630
3630
|
/**
|
|
@@ -4010,10 +4010,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
4010
4010
|
let offset = bm.offset;
|
|
4011
4011
|
let commentEnd = null;
|
|
4012
4012
|
for (const collItem of bm.items) {
|
|
4013
|
-
const { start, key, sep:
|
|
4013
|
+
const { start, key, sep: sep7, value } = collItem;
|
|
4014
4014
|
const keyProps = resolveProps.resolveProps(start, {
|
|
4015
4015
|
indicator: "explicit-key-ind",
|
|
4016
|
-
next: key ??
|
|
4016
|
+
next: key ?? sep7?.[0],
|
|
4017
4017
|
offset,
|
|
4018
4018
|
onError,
|
|
4019
4019
|
parentIndent: bm.indent,
|
|
@@ -4027,7 +4027,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4027
4027
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
4028
4028
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
4029
4029
|
}
|
|
4030
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
4030
|
+
if (!keyProps.anchor && !keyProps.tag && !sep7) {
|
|
4031
4031
|
commentEnd = keyProps.end;
|
|
4032
4032
|
if (keyProps.comment) {
|
|
4033
4033
|
if (map2.comment)
|
|
@@ -4051,7 +4051,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4051
4051
|
ctx.atKey = false;
|
|
4052
4052
|
if (utilMapIncludes.mapIncludes(ctx, map2.items, keyNode))
|
|
4053
4053
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
4054
|
-
const valueProps = resolveProps.resolveProps(
|
|
4054
|
+
const valueProps = resolveProps.resolveProps(sep7 ?? [], {
|
|
4055
4055
|
indicator: "map-value-ind",
|
|
4056
4056
|
next: value,
|
|
4057
4057
|
offset: keyNode.range[2],
|
|
@@ -4067,7 +4067,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4067
4067
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
4068
4068
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
4069
4069
|
}
|
|
4070
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
4070
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep7, null, valueProps, onError);
|
|
4071
4071
|
if (ctx.schema.compat)
|
|
4072
4072
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
4073
4073
|
offset = valueNode.range[2];
|
|
@@ -4158,7 +4158,7 @@ var require_resolve_end = __commonJS({
|
|
|
4158
4158
|
let comment = "";
|
|
4159
4159
|
if (end) {
|
|
4160
4160
|
let hasSpace = false;
|
|
4161
|
-
let
|
|
4161
|
+
let sep7 = "";
|
|
4162
4162
|
for (const token of end) {
|
|
4163
4163
|
const { source, type } = token;
|
|
4164
4164
|
switch (type) {
|
|
@@ -4172,13 +4172,13 @@ var require_resolve_end = __commonJS({
|
|
|
4172
4172
|
if (!comment)
|
|
4173
4173
|
comment = cb;
|
|
4174
4174
|
else
|
|
4175
|
-
comment +=
|
|
4176
|
-
|
|
4175
|
+
comment += sep7 + cb;
|
|
4176
|
+
sep7 = "";
|
|
4177
4177
|
break;
|
|
4178
4178
|
}
|
|
4179
4179
|
case "newline":
|
|
4180
4180
|
if (comment)
|
|
4181
|
-
|
|
4181
|
+
sep7 += source;
|
|
4182
4182
|
hasSpace = true;
|
|
4183
4183
|
break;
|
|
4184
4184
|
default:
|
|
@@ -4221,18 +4221,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4221
4221
|
let offset = fc.offset + fc.start.source.length;
|
|
4222
4222
|
for (let i2 = 0; i2 < fc.items.length; ++i2) {
|
|
4223
4223
|
const collItem = fc.items[i2];
|
|
4224
|
-
const { start, key, sep:
|
|
4224
|
+
const { start, key, sep: sep7, value } = collItem;
|
|
4225
4225
|
const props = resolveProps.resolveProps(start, {
|
|
4226
4226
|
flow: fcName,
|
|
4227
4227
|
indicator: "explicit-key-ind",
|
|
4228
|
-
next: key ??
|
|
4228
|
+
next: key ?? sep7?.[0],
|
|
4229
4229
|
offset,
|
|
4230
4230
|
onError,
|
|
4231
4231
|
parentIndent: fc.indent,
|
|
4232
4232
|
startOnNewline: false
|
|
4233
4233
|
});
|
|
4234
4234
|
if (!props.found) {
|
|
4235
|
-
if (!props.anchor && !props.tag && !
|
|
4235
|
+
if (!props.anchor && !props.tag && !sep7 && !value) {
|
|
4236
4236
|
if (i2 === 0 && props.comma)
|
|
4237
4237
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
4238
4238
|
else if (i2 < fc.items.length - 1)
|
|
@@ -4286,8 +4286,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4286
4286
|
}
|
|
4287
4287
|
}
|
|
4288
4288
|
}
|
|
4289
|
-
if (!isMap && !
|
|
4290
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
4289
|
+
if (!isMap && !sep7 && !props.found) {
|
|
4290
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep7, null, props, onError);
|
|
4291
4291
|
coll.items.push(valueNode);
|
|
4292
4292
|
offset = valueNode.range[2];
|
|
4293
4293
|
if (isBlock(value))
|
|
@@ -4299,7 +4299,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4299
4299
|
if (isBlock(key))
|
|
4300
4300
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
4301
4301
|
ctx.atKey = false;
|
|
4302
|
-
const valueProps = resolveProps.resolveProps(
|
|
4302
|
+
const valueProps = resolveProps.resolveProps(sep7 ?? [], {
|
|
4303
4303
|
flow: fcName,
|
|
4304
4304
|
indicator: "map-value-ind",
|
|
4305
4305
|
next: value,
|
|
@@ -4310,8 +4310,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4310
4310
|
});
|
|
4311
4311
|
if (valueProps.found) {
|
|
4312
4312
|
if (!isMap && !props.found && ctx.options.strict) {
|
|
4313
|
-
if (
|
|
4314
|
-
for (const st of
|
|
4313
|
+
if (sep7)
|
|
4314
|
+
for (const st of sep7) {
|
|
4315
4315
|
if (st === valueProps.found)
|
|
4316
4316
|
break;
|
|
4317
4317
|
if (st.type === "newline") {
|
|
@@ -4328,7 +4328,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4328
4328
|
else
|
|
4329
4329
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
4330
4330
|
}
|
|
4331
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
4331
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep7, null, valueProps, onError) : null;
|
|
4332
4332
|
if (valueNode) {
|
|
4333
4333
|
if (isBlock(value))
|
|
4334
4334
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -4508,7 +4508,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
4508
4508
|
chompStart = i2 + 1;
|
|
4509
4509
|
}
|
|
4510
4510
|
let value = "";
|
|
4511
|
-
let
|
|
4511
|
+
let sep7 = "";
|
|
4512
4512
|
let prevMoreIndented = false;
|
|
4513
4513
|
for (let i2 = 0; i2 < contentStart; ++i2)
|
|
4514
4514
|
value += lines[i2][0].slice(trimIndent) + "\n";
|
|
@@ -4525,24 +4525,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
4525
4525
|
indent = "";
|
|
4526
4526
|
}
|
|
4527
4527
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
4528
|
-
value +=
|
|
4529
|
-
|
|
4528
|
+
value += sep7 + indent.slice(trimIndent) + content;
|
|
4529
|
+
sep7 = "\n";
|
|
4530
4530
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
4531
|
-
if (
|
|
4532
|
-
|
|
4533
|
-
else if (!prevMoreIndented &&
|
|
4534
|
-
|
|
4535
|
-
value +=
|
|
4536
|
-
|
|
4531
|
+
if (sep7 === " ")
|
|
4532
|
+
sep7 = "\n";
|
|
4533
|
+
else if (!prevMoreIndented && sep7 === "\n")
|
|
4534
|
+
sep7 = "\n\n";
|
|
4535
|
+
value += sep7 + indent.slice(trimIndent) + content;
|
|
4536
|
+
sep7 = "\n";
|
|
4537
4537
|
prevMoreIndented = true;
|
|
4538
4538
|
} else if (content === "") {
|
|
4539
|
-
if (
|
|
4539
|
+
if (sep7 === "\n")
|
|
4540
4540
|
value += "\n";
|
|
4541
4541
|
else
|
|
4542
|
-
|
|
4542
|
+
sep7 = "\n";
|
|
4543
4543
|
} else {
|
|
4544
|
-
value +=
|
|
4545
|
-
|
|
4544
|
+
value += sep7 + content;
|
|
4545
|
+
sep7 = " ";
|
|
4546
4546
|
prevMoreIndented = false;
|
|
4547
4547
|
}
|
|
4548
4548
|
}
|
|
@@ -4725,25 +4725,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
4725
4725
|
trimBoth = /^[ \t]+|[ \t]+$/g;
|
|
4726
4726
|
}
|
|
4727
4727
|
let res = match[1].replace(trimEnd, "");
|
|
4728
|
-
let
|
|
4728
|
+
let sep7 = " ";
|
|
4729
4729
|
let pos = line.lastIndex;
|
|
4730
4730
|
while (match = line.exec(source)) {
|
|
4731
4731
|
const lm = match[1].replace(trimBoth, "");
|
|
4732
4732
|
if (lm === "") {
|
|
4733
|
-
if (
|
|
4734
|
-
res +=
|
|
4733
|
+
if (sep7 === "\n")
|
|
4734
|
+
res += sep7;
|
|
4735
4735
|
else
|
|
4736
|
-
|
|
4736
|
+
sep7 = "\n";
|
|
4737
4737
|
} else {
|
|
4738
|
-
res +=
|
|
4739
|
-
|
|
4738
|
+
res += sep7 + lm;
|
|
4739
|
+
sep7 = " ";
|
|
4740
4740
|
}
|
|
4741
4741
|
pos = line.lastIndex;
|
|
4742
4742
|
}
|
|
4743
4743
|
const last = /[ \t]*(.*)/sy;
|
|
4744
4744
|
last.lastIndex = pos;
|
|
4745
4745
|
match = last.exec(source);
|
|
4746
|
-
return res +
|
|
4746
|
+
return res + sep7 + (match?.[1] ?? "");
|
|
4747
4747
|
}
|
|
4748
4748
|
function doubleQuotedValue(source, onError) {
|
|
4749
4749
|
let res = "";
|
|
@@ -5553,14 +5553,14 @@ var require_cst_stringify = __commonJS({
|
|
|
5553
5553
|
}
|
|
5554
5554
|
}
|
|
5555
5555
|
}
|
|
5556
|
-
function stringifyItem({ start, key, sep:
|
|
5556
|
+
function stringifyItem({ start, key, sep: sep7, value }) {
|
|
5557
5557
|
let res = "";
|
|
5558
5558
|
for (const st of start)
|
|
5559
5559
|
res += st.source;
|
|
5560
5560
|
if (key)
|
|
5561
5561
|
res += stringifyToken(key);
|
|
5562
|
-
if (
|
|
5563
|
-
for (const st of
|
|
5562
|
+
if (sep7)
|
|
5563
|
+
for (const st of sep7)
|
|
5564
5564
|
res += st.source;
|
|
5565
5565
|
if (value)
|
|
5566
5566
|
res += stringifyToken(value);
|
|
@@ -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
|
}
|
|
@@ -6727,18 +6727,18 @@ var require_parser = __commonJS({
|
|
|
6727
6727
|
if (this.type === "map-value-ind") {
|
|
6728
6728
|
const prev = getPrevProps(this.peek(2));
|
|
6729
6729
|
const start = getFirstKeyStartProps(prev);
|
|
6730
|
-
let
|
|
6730
|
+
let sep7;
|
|
6731
6731
|
if (scalar.end) {
|
|
6732
|
-
|
|
6733
|
-
|
|
6732
|
+
sep7 = scalar.end;
|
|
6733
|
+
sep7.push(this.sourceToken);
|
|
6734
6734
|
delete scalar.end;
|
|
6735
6735
|
} else
|
|
6736
|
-
|
|
6736
|
+
sep7 = [this.sourceToken];
|
|
6737
6737
|
const map2 = {
|
|
6738
6738
|
type: "block-map",
|
|
6739
6739
|
offset: scalar.offset,
|
|
6740
6740
|
indent: scalar.indent,
|
|
6741
|
-
items: [{ start, key: scalar, sep:
|
|
6741
|
+
items: [{ start, key: scalar, sep: sep7 }]
|
|
6742
6742
|
};
|
|
6743
6743
|
this.onKeyLine = true;
|
|
6744
6744
|
this.stack[this.stack.length - 1] = map2;
|
|
@@ -6891,15 +6891,15 @@ var require_parser = __commonJS({
|
|
|
6891
6891
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
6892
6892
|
const start2 = getFirstKeyStartProps(it.start);
|
|
6893
6893
|
const key = it.key;
|
|
6894
|
-
const
|
|
6895
|
-
|
|
6894
|
+
const sep7 = it.sep;
|
|
6895
|
+
sep7.push(this.sourceToken);
|
|
6896
6896
|
delete it.key;
|
|
6897
6897
|
delete it.sep;
|
|
6898
6898
|
this.stack.push({
|
|
6899
6899
|
type: "block-map",
|
|
6900
6900
|
offset: this.offset,
|
|
6901
6901
|
indent: this.indent,
|
|
6902
|
-
items: [{ start: start2, key, sep:
|
|
6902
|
+
items: [{ start: start2, key, sep: sep7 }]
|
|
6903
6903
|
});
|
|
6904
6904
|
} else if (start.length > 0) {
|
|
6905
6905
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -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":
|
|
@@ -7093,13 +7093,13 @@ var require_parser = __commonJS({
|
|
|
7093
7093
|
const prev = getPrevProps(parent);
|
|
7094
7094
|
const start = getFirstKeyStartProps(prev);
|
|
7095
7095
|
fixFlowSeqItems(fc);
|
|
7096
|
-
const
|
|
7097
|
-
|
|
7096
|
+
const sep7 = fc.end.splice(1, fc.end.length);
|
|
7097
|
+
sep7.push(this.sourceToken);
|
|
7098
7098
|
const map2 = {
|
|
7099
7099
|
type: "block-map",
|
|
7100
7100
|
offset: fc.offset,
|
|
7101
7101
|
indent: fc.indent,
|
|
7102
|
-
items: [{ start, key: fc, sep:
|
|
7102
|
+
items: [{ start, key: fc, sep: sep7 }]
|
|
7103
7103
|
};
|
|
7104
7104
|
this.onKeyLine = true;
|
|
7105
7105
|
this.stack[this.stack.length - 1] = map2;
|
|
@@ -7277,7 +7277,7 @@ var require_public_api = __commonJS({
|
|
|
7277
7277
|
}
|
|
7278
7278
|
return doc;
|
|
7279
7279
|
}
|
|
7280
|
-
function
|
|
7280
|
+
function parse4(src, reviver, options) {
|
|
7281
7281
|
let _reviver = void 0;
|
|
7282
7282
|
if (typeof reviver === "function") {
|
|
7283
7283
|
_reviver = reviver;
|
|
@@ -7318,7 +7318,7 @@ var require_public_api = __commonJS({
|
|
|
7318
7318
|
return value.toString(options);
|
|
7319
7319
|
return new Document.Document(value, _replacer, options).toString(options);
|
|
7320
7320
|
}
|
|
7321
|
-
exports.parse =
|
|
7321
|
+
exports.parse = parse4;
|
|
7322
7322
|
exports.parseAllDocuments = parseAllDocuments;
|
|
7323
7323
|
exports.parseDocument = parseDocument;
|
|
7324
7324
|
exports.stringify = stringify;
|
|
@@ -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;
|
|
@@ -8958,7 +8959,7 @@ function generateAuthToken() {
|
|
|
8958
8959
|
return generateToken();
|
|
8959
8960
|
}
|
|
8960
8961
|
function findFreePort() {
|
|
8961
|
-
return new Promise((
|
|
8962
|
+
return new Promise((resolve14, reject) => {
|
|
8962
8963
|
const srv = net.createServer();
|
|
8963
8964
|
srv.listen(0, "127.0.0.1", () => {
|
|
8964
8965
|
const addr = srv.address();
|
|
@@ -8969,21 +8970,21 @@ function findFreePort() {
|
|
|
8969
8970
|
const port = addr.port;
|
|
8970
8971
|
srv.close((err) => {
|
|
8971
8972
|
if (err) reject(err);
|
|
8972
|
-
else
|
|
8973
|
+
else resolve14(port);
|
|
8973
8974
|
});
|
|
8974
8975
|
});
|
|
8975
8976
|
srv.on("error", reject);
|
|
8976
8977
|
});
|
|
8977
8978
|
}
|
|
8978
8979
|
function isVersionNewer(a2, b) {
|
|
8979
|
-
const
|
|
8980
|
+
const parse4 = (v) => {
|
|
8980
8981
|
const [core = "", ...preParts] = v.split("+")[0].split("-");
|
|
8981
8982
|
const nums = core.split(".").map((n3) => Number.parseInt(n3, 10));
|
|
8982
8983
|
if (nums.length === 0 || nums.some((n3) => Number.isNaN(n3))) return null;
|
|
8983
8984
|
return { nums, pre: preParts.length > 0 ? preParts.join("-").split(".") : [] };
|
|
8984
8985
|
};
|
|
8985
|
-
const pa =
|
|
8986
|
-
const pb =
|
|
8986
|
+
const pa = parse4(a2);
|
|
8987
|
+
const pb = parse4(b);
|
|
8987
8988
|
if (!pa || !pb) return false;
|
|
8988
8989
|
for (let i2 = 0; i2 < 3; i2++) {
|
|
8989
8990
|
const x = pa.nums[i2] ?? 0;
|
|
@@ -9069,8 +9070,12 @@ 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
|
-
return new Promise((
|
|
9078
|
+
return new Promise((resolve14, reject) => {
|
|
9074
9079
|
let logFd;
|
|
9075
9080
|
try {
|
|
9076
9081
|
fs.mkdirSync(STATE_DIR, { recursive: true });
|
|
@@ -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],
|
|
@@ -9117,7 +9121,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
9117
9121
|
rl.close();
|
|
9118
9122
|
child.stdout?.resume();
|
|
9119
9123
|
child.stdout?.unref?.();
|
|
9120
|
-
settle2(() =>
|
|
9124
|
+
settle2(() => resolve14({ port: actualPort, pid }));
|
|
9121
9125
|
}
|
|
9122
9126
|
});
|
|
9123
9127
|
child.on("error", (err) => {
|
|
@@ -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,24 @@ function toolStepFiles(specs, args) {
|
|
|
10234
10261
|
}
|
|
10235
10262
|
return files;
|
|
10236
10263
|
}
|
|
10237
|
-
|
|
10238
|
-
|
|
10264
|
+
var UNEXPANDED_PATH = /^~|\$[A-Za-z0-9_{(]|`|%[A-Za-z_][A-Za-z0-9_]*%|^[A-Za-z][A-Za-z0-9+.-]+:/;
|
|
10265
|
+
function isUnexpandedPath(p) {
|
|
10266
|
+
return UNEXPANDED_PATH.test(p);
|
|
10267
|
+
}
|
|
10268
|
+
function isClientFileArgument({ spec, path: path29 }) {
|
|
10269
|
+
return spec.kind === "file" && spec.path === `\${${spec.target}}` && path29.startsWith("/") && hasToolFileExtension(path29);
|
|
10239
10270
|
}
|
|
10240
10271
|
|
|
10272
|
+
// ../registry/src/flow-platforms.ts
|
|
10273
|
+
var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
|
|
10274
|
+
var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
|
|
10275
|
+
|
|
10241
10276
|
// ../registry/src/flow-file-refs.ts
|
|
10242
|
-
import * as
|
|
10277
|
+
import * as fs7 from "node:fs/promises";
|
|
10243
10278
|
import * as path8 from "node:path";
|
|
10244
10279
|
|
|
10245
10280
|
// ../registry/src/e2e-dirs.ts
|
|
10246
|
-
import * as
|
|
10281
|
+
import * as fs6 from "node:fs/promises";
|
|
10247
10282
|
import * as path7 from "node:path";
|
|
10248
10283
|
var E2E_DIR = path7.join(".argent", "e2e");
|
|
10249
10284
|
var LEGACY_E2E_DIRS = Object.freeze([path7.join(".argent", "flows")]);
|
|
@@ -10258,7 +10293,7 @@ function e2eFileCandidates(projectRoot, name) {
|
|
|
10258
10293
|
return e2eDirsFor(projectRoot).map((dir) => path7.join(dir, `${name}.yaml`));
|
|
10259
10294
|
}
|
|
10260
10295
|
async function exists(file2) {
|
|
10261
|
-
return
|
|
10296
|
+
return fs6.stat(file2).then(
|
|
10262
10297
|
() => true,
|
|
10263
10298
|
() => false
|
|
10264
10299
|
);
|
|
@@ -10352,10 +10387,10 @@ function canonicalToolArgs(tool, args) {
|
|
|
10352
10387
|
// ../registry/src/flow-file-refs.ts
|
|
10353
10388
|
async function canonicalFlowPath(p) {
|
|
10354
10389
|
try {
|
|
10355
|
-
return await
|
|
10390
|
+
return await fs7.realpath(p);
|
|
10356
10391
|
} catch {
|
|
10357
10392
|
try {
|
|
10358
|
-
return path8.join(await
|
|
10393
|
+
return path8.join(await fs7.realpath(path8.dirname(p)), path8.basename(p));
|
|
10359
10394
|
} catch {
|
|
10360
10395
|
return p;
|
|
10361
10396
|
}
|
|
@@ -10371,6 +10406,9 @@ var MAX_BLOCK_NESTING = 64;
|
|
|
10371
10406
|
function isRecord(value) {
|
|
10372
10407
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10373
10408
|
}
|
|
10409
|
+
function flowYamlSource(content) {
|
|
10410
|
+
return content.replace(/^\s+/, (lead) => lead.replace(/[^\n]/g, "")).trimEnd();
|
|
10411
|
+
}
|
|
10374
10412
|
function collectFlowRequests(doc) {
|
|
10375
10413
|
const runTargets = /* @__PURE__ */ new Set();
|
|
10376
10414
|
const snapshots = /* @__PURE__ */ new Set();
|
|
@@ -10401,15 +10439,15 @@ function collectFlowRequests(doc) {
|
|
|
10401
10439
|
if (isRecord(doc)) visit2(doc.steps, 0);
|
|
10402
10440
|
return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
|
|
10403
10441
|
}
|
|
10404
|
-
function baselineKeyFor(
|
|
10405
|
-
const stem = path8.basename(
|
|
10442
|
+
function baselineKeyFor(canonicalPath2, flowName) {
|
|
10443
|
+
const stem = path8.basename(canonicalPath2, ".yaml");
|
|
10406
10444
|
return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
|
|
10407
10445
|
}
|
|
10408
10446
|
function flowMemberKey(anchorDir, target) {
|
|
10409
10447
|
return `${anchorDir}\0${target}`;
|
|
10410
10448
|
}
|
|
10411
10449
|
async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
|
|
10412
|
-
const entries = await
|
|
10450
|
+
const entries = await fs7.readdir(dir).catch(() => null);
|
|
10413
10451
|
if (entries === null || entries.includes(base)) return { state: "listed" };
|
|
10414
10452
|
const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
|
|
10415
10453
|
if (actual === void 0) return { state: "absent" };
|
|
@@ -10519,6 +10557,9 @@ var FAILURE_CODES = {
|
|
|
10519
10557
|
ANDROID_ADB_COMMAND_FAILED: "ANDROID_ADB_COMMAND_FAILED",
|
|
10520
10558
|
ANDROID_ADB_BOOT_TERMINAL_STATE: "ANDROID_ADB_BOOT_TERMINAL_STATE",
|
|
10521
10559
|
ANDROID_ADB_BOOT_TIMEOUT: "ANDROID_ADB_BOOT_TIMEOUT",
|
|
10560
|
+
ANDROID_NETWORK_RESTORE_TIMEOUT: "ANDROID_NETWORK_RESTORE_TIMEOUT",
|
|
10561
|
+
ANDROID_OFFLINE_TIMEOUT: "ANDROID_OFFLINE_TIMEOUT",
|
|
10562
|
+
ANDROID_OFFLINE_UNSUPPORTED: "ANDROID_OFFLINE_UNSUPPORTED",
|
|
10522
10563
|
SIMULATOR_NETWORK_TIMEOUT: "SIMULATOR_NETWORK_TIMEOUT",
|
|
10523
10564
|
SIMULATOR_NETWORK_CONNECTION_REFUSED: "SIMULATOR_NETWORK_CONNECTION_REFUSED",
|
|
10524
10565
|
SIMULATOR_NETWORK_CONNECTION_RESET: "SIMULATOR_NETWORK_CONNECTION_RESET",
|
|
@@ -10638,12 +10679,15 @@ var FAILURE_CODES = {
|
|
|
10638
10679
|
DEBUGGER_CDP_PROTOCOL_ERROR: "DEBUGGER_CDP_PROTOCOL_ERROR",
|
|
10639
10680
|
DEBUGGER_CDP_CONNECT_FAILED: "DEBUGGER_CDP_CONNECT_FAILED",
|
|
10640
10681
|
DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN: "DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN",
|
|
10682
|
+
DEBUGGER_CDP_ORIGIN_REJECTED: "DEBUGGER_CDP_ORIGIN_REJECTED",
|
|
10641
10683
|
DEBUGGER_CDP_NOT_CONNECTED: "DEBUGGER_CDP_NOT_CONNECTED",
|
|
10642
10684
|
DEBUGGER_CDP_REQUEST_TIMEOUT: "DEBUGGER_CDP_REQUEST_TIMEOUT",
|
|
10643
10685
|
DEBUGGER_CDP_CONNECTION_CLOSED: "DEBUGGER_CDP_CONNECTION_CLOSED",
|
|
10644
10686
|
DEBUGGER_TARGET_DEVICE_MISMATCH: "DEBUGGER_TARGET_DEVICE_MISMATCH",
|
|
10645
10687
|
DEBUGGER_EVALUATE_EXPRESSION_THREW: "DEBUGGER_EVALUATE_EXPRESSION_THREW",
|
|
10646
10688
|
DEBUGGER_RELOAD_FAILED: "DEBUGGER_RELOAD_FAILED",
|
|
10689
|
+
// e2e-add-step refused a debugger-* call that answered `not_connected`.
|
|
10690
|
+
DEBUGGER_NOT_CONNECTED: "DEBUGGER_NOT_CONNECTED",
|
|
10647
10691
|
JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED: "JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED",
|
|
10648
10692
|
JS_RUNTIME_PAYLOAD_INVALID: "JS_RUNTIME_PAYLOAD_INVALID",
|
|
10649
10693
|
JS_RUNTIME_PAYLOAD_DEVICE_MISSING: "JS_RUNTIME_PAYLOAD_DEVICE_MISSING",
|
|
@@ -10712,6 +10756,32 @@ var FAILURE_CODES = {
|
|
|
10712
10756
|
NATIVE_PROFILER_PERFETTO_PROCESS_ERROR: "NATIVE_PROFILER_PERFETTO_PROCESS_ERROR",
|
|
10713
10757
|
NATIVE_PROFILER_PERFETTO_READY_TIMEOUT: "NATIVE_PROFILER_PERFETTO_READY_TIMEOUT",
|
|
10714
10758
|
NATIVE_PROFILER_PERFETTO_READY_EXITED: "NATIVE_PROFILER_PERFETTO_READY_EXITED",
|
|
10759
|
+
/**
|
|
10760
|
+
* native-profiler-launch-analysis. Input problems use TOOL_INPUT_INVALID and
|
|
10761
|
+
* devicectl steps IOS_DEVICECTL_COMMAND_FAILED.
|
|
10762
|
+
* @see [workflow.ts](../../tool-server/src/utils/ios-launch-time/workflow.ts)
|
|
10763
|
+
*/
|
|
10764
|
+
// Not macOS, or an Xcode that cannot record the launch on this target.
|
|
10765
|
+
LAUNCH_ANALYSIS_UNSUPPORTED_HOST: "LAUNCH_ANALYSIS_UNSUPPORTED_HOST",
|
|
10766
|
+
// No usable iPhone or simulator was selected, or Argent's runner holds it.
|
|
10767
|
+
LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE: "LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE",
|
|
10768
|
+
// The bundle_id app is not installed on the selected device.
|
|
10769
|
+
LAUNCH_ANALYSIS_APP_NOT_INSTALLED: "LAUNCH_ANALYSIS_APP_NOT_INSTALLED",
|
|
10770
|
+
// The runner's xcodebuild failed on code signing or provisioning.
|
|
10771
|
+
LAUNCH_ANALYSIS_SIGNING_FAILED: "LAUNCH_ANALYSIS_SIGNING_FAILED",
|
|
10772
|
+
// The iPhone's free developer profile has no slot for Argent's runner.
|
|
10773
|
+
LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT: "LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT",
|
|
10774
|
+
// simctl could not wait for boot, find, launch or terminate the app.
|
|
10775
|
+
LAUNCH_ANALYSIS_SIMCTL_FAILED: "LAUNCH_ANALYSIS_SIMCTL_FAILED",
|
|
10776
|
+
LAUNCH_ANALYSIS_RECORD_FAILED: "LAUNCH_ANALYSIS_RECORD_FAILED",
|
|
10777
|
+
// xctrace could not export the TOC, the CPU samples or the first-frame marker.
|
|
10778
|
+
LAUNCH_ANALYSIS_EXPORT_FAILED: "LAUNCH_ANALYSIS_EXPORT_FAILED",
|
|
10779
|
+
// The App Launch trace has no first frame of the app, so it has no launch window.
|
|
10780
|
+
LAUNCH_ANALYSIS_NO_FIRST_FRAME: "LAUNCH_ANALYSIS_NO_FIRST_FRAME",
|
|
10781
|
+
// The XCTest launch run of Argent's runner failed.
|
|
10782
|
+
LAUNCH_ANALYSIS_RUNNER_TEST_FAILED: "LAUNCH_ANALYSIS_RUNNER_TEST_FAILED",
|
|
10783
|
+
// The launch test ran, but Argent read no launch measurements from its result.
|
|
10784
|
+
LAUNCH_ANALYSIS_NO_SAMPLES: "LAUNCH_ANALYSIS_NO_SAMPLES",
|
|
10715
10785
|
// iOS and Android share one capture path (simulator-server frames into
|
|
10716
10786
|
// ffmpeg), so these name the failing stage, not the device family.
|
|
10717
10787
|
SCREEN_RECORDING_FACTORY_OPTIONS_MISSING: "SCREEN_RECORDING_FACTORY_OPTIONS_MISSING",
|
|
@@ -10726,6 +10796,19 @@ var FAILURE_CODES = {
|
|
|
10726
10796
|
SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
|
|
10727
10797
|
SCREEN_RECORDING_STREAM_UNAVAILABLE: "SCREEN_RECORDING_STREAM_UNAVAILABLE",
|
|
10728
10798
|
SCREEN_RECORDING_FFMPEG_NOT_FOUND: "SCREEN_RECORDING_FFMPEG_NOT_FOUND",
|
|
10799
|
+
// A cabled iPhone has no simulator-server: its frames come from a host-side
|
|
10800
|
+
// CoreMediaIO capture helper, which can fail in ways of its own.
|
|
10801
|
+
SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED",
|
|
10802
|
+
SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND: "SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND",
|
|
10803
|
+
SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED: "SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED",
|
|
10804
|
+
SCREEN_RECORDING_DEVICE_HELPER_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_FAILED",
|
|
10805
|
+
AUDIO_CLIP_CONVERSION_FAILED: "AUDIO_CLIP_CONVERSION_FAILED",
|
|
10806
|
+
AUDIO_HOOK_NOT_ACTIVE: "AUDIO_HOOK_NOT_ACTIVE",
|
|
10807
|
+
AUDIO_ENV_SETUP_FAILED: "AUDIO_ENV_SETUP_FAILED",
|
|
10808
|
+
AUDIO_WRONG_PLATFORM: "AUDIO_WRONG_PLATFORM",
|
|
10809
|
+
AUDIO_HOOK_UNAVAILABLE: "AUDIO_HOOK_UNAVAILABLE",
|
|
10810
|
+
AUDIO_INJECTION_NOT_OURS: "AUDIO_INJECTION_NOT_OURS",
|
|
10811
|
+
AUDIO_SIMULATOR_NOT_BOOTED: "AUDIO_SIMULATOR_NOT_BOOTED",
|
|
10729
10812
|
FLOW_PROJECT_ROOT_INVALID: "FLOW_PROJECT_ROOT_INVALID",
|
|
10730
10813
|
FLOW_NAME_INVALID: "FLOW_NAME_INVALID",
|
|
10731
10814
|
FLOW_NO_ACTIVE_RECORDING: "FLOW_NO_ACTIVE_RECORDING",
|
|
@@ -10789,6 +10872,8 @@ var FAILURE_CODES = {
|
|
|
10789
10872
|
MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
|
|
10790
10873
|
MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
|
|
10791
10874
|
MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
|
|
10875
|
+
/** The app's loaded Argent library lacks support for the requested operation. */
|
|
10876
|
+
MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
|
|
10792
10877
|
KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
|
|
10793
10878
|
KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
|
|
10794
10879
|
KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
|
|
@@ -10858,13 +10943,19 @@ var FAILURE_COMMANDS = [
|
|
|
10858
10943
|
"ax_service",
|
|
10859
10944
|
"simulator_server",
|
|
10860
10945
|
"ffmpeg",
|
|
10946
|
+
"afconvert",
|
|
10861
10947
|
"cdp",
|
|
10862
10948
|
"electron",
|
|
10863
10949
|
"npm",
|
|
10864
10950
|
"npx",
|
|
10865
10951
|
"unknown",
|
|
10866
10952
|
"devicectl",
|
|
10867
|
-
"xcodebuild"
|
|
10953
|
+
"xcodebuild",
|
|
10954
|
+
"swiftc",
|
|
10955
|
+
// The host-side helper that captures a cabled iPhone's screen.
|
|
10956
|
+
"ios_screen_stream",
|
|
10957
|
+
// `xcrun xcresulttool`, which reads an XCTest result bundle.
|
|
10958
|
+
"xcresulttool"
|
|
10868
10959
|
];
|
|
10869
10960
|
var FAILURE_SIGNAL_NAMES = [
|
|
10870
10961
|
"SIGABRT",
|
|
@@ -11708,10 +11799,10 @@ function mergeDefs(...defs) {
|
|
|
11708
11799
|
function cloneDef(schema) {
|
|
11709
11800
|
return mergeDefs(schema._zod.def);
|
|
11710
11801
|
}
|
|
11711
|
-
function getElementAtPath(obj,
|
|
11712
|
-
if (!
|
|
11802
|
+
function getElementAtPath(obj, path29) {
|
|
11803
|
+
if (!path29)
|
|
11713
11804
|
return obj;
|
|
11714
|
-
return
|
|
11805
|
+
return path29.reduce((acc, key) => acc?.[key], obj);
|
|
11715
11806
|
}
|
|
11716
11807
|
function promiseAllObject(promisesObj) {
|
|
11717
11808
|
const keys = Object.keys(promisesObj);
|
|
@@ -12051,11 +12142,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
12051
12142
|
}
|
|
12052
12143
|
return false;
|
|
12053
12144
|
}
|
|
12054
|
-
function prefixIssues(
|
|
12145
|
+
function prefixIssues(path29, issues) {
|
|
12055
12146
|
return issues.map((iss) => {
|
|
12056
12147
|
var _a3;
|
|
12057
12148
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
12058
|
-
iss.path.unshift(
|
|
12149
|
+
iss.path.unshift(path29);
|
|
12059
12150
|
return iss;
|
|
12060
12151
|
});
|
|
12061
12152
|
}
|
|
@@ -12517,16 +12608,16 @@ function flattenError(error63, mapper = (issue2) => issue2.message) {
|
|
|
12517
12608
|
}
|
|
12518
12609
|
function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
12519
12610
|
const fieldErrors = { _errors: [] };
|
|
12520
|
-
const processError = (error64,
|
|
12611
|
+
const processError = (error64, path29 = []) => {
|
|
12521
12612
|
for (const issue2 of error64.issues) {
|
|
12522
12613
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
12523
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
12614
|
+
issue2.errors.map((issues) => processError({ issues }, [...path29, ...issue2.path]));
|
|
12524
12615
|
} else if (issue2.code === "invalid_key") {
|
|
12525
|
-
processError({ issues: issue2.issues }, [...
|
|
12616
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
12526
12617
|
} else if (issue2.code === "invalid_element") {
|
|
12527
|
-
processError({ issues: issue2.issues }, [...
|
|
12618
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
12528
12619
|
} else {
|
|
12529
|
-
const fullpath = [...
|
|
12620
|
+
const fullpath = [...path29, ...issue2.path];
|
|
12530
12621
|
if (fullpath.length === 0) {
|
|
12531
12622
|
fieldErrors._errors.push(mapper(issue2));
|
|
12532
12623
|
} else {
|
|
@@ -12565,17 +12656,17 @@ function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
|
12565
12656
|
}
|
|
12566
12657
|
function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
12567
12658
|
const result = { errors: [] };
|
|
12568
|
-
const processError = (error64,
|
|
12659
|
+
const processError = (error64, path29 = []) => {
|
|
12569
12660
|
var _a3;
|
|
12570
12661
|
for (const issue2 of error64.issues) {
|
|
12571
12662
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
12572
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
12663
|
+
issue2.errors.map((issues) => processError({ issues }, [...path29, ...issue2.path]));
|
|
12573
12664
|
} else if (issue2.code === "invalid_key") {
|
|
12574
|
-
processError({ issues: issue2.issues }, [...
|
|
12665
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
12575
12666
|
} else if (issue2.code === "invalid_element") {
|
|
12576
|
-
processError({ issues: issue2.issues }, [...
|
|
12667
|
+
processError({ issues: issue2.issues }, [...path29, ...issue2.path]);
|
|
12577
12668
|
} else {
|
|
12578
|
-
const fullpath = [...
|
|
12669
|
+
const fullpath = [...path29, ...issue2.path];
|
|
12579
12670
|
if (fullpath.length === 0) {
|
|
12580
12671
|
result.errors.push(mapper(issue2));
|
|
12581
12672
|
continue;
|
|
@@ -12614,8 +12705,8 @@ function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
|
12614
12705
|
}
|
|
12615
12706
|
function toDotPath(_path) {
|
|
12616
12707
|
const segs = [];
|
|
12617
|
-
const
|
|
12618
|
-
for (const seg of
|
|
12708
|
+
const path29 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
12709
|
+
for (const seg of path29) {
|
|
12619
12710
|
if (typeof seg === "number")
|
|
12620
12711
|
segs.push(`[${seg}]`);
|
|
12621
12712
|
else if (typeof seg === "symbol")
|
|
@@ -12749,18 +12840,18 @@ var validateAsync = async (schema, value, _ctx) => {
|
|
|
12749
12840
|
return result.issues.length === 0;
|
|
12750
12841
|
};
|
|
12751
12842
|
var _encode = (_Err) => {
|
|
12752
|
-
const
|
|
12843
|
+
const parse4 = _parse(_Err);
|
|
12753
12844
|
const fn = (schema, value, _ctx, _params) => {
|
|
12754
12845
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
12755
|
-
return
|
|
12846
|
+
return parse4(schema, value, ctx, finalizeParams(fn, _params));
|
|
12756
12847
|
};
|
|
12757
12848
|
return fn;
|
|
12758
12849
|
};
|
|
12759
12850
|
var encode = /* @__PURE__ */ _encode($ZodRealError);
|
|
12760
12851
|
var _decode = (_Err) => {
|
|
12761
|
-
const
|
|
12852
|
+
const parse4 = _parse(_Err);
|
|
12762
12853
|
const fn = (schema, value, _ctx, _params) => {
|
|
12763
|
-
return
|
|
12854
|
+
return parse4(schema, value, _ctx, finalizeParams(fn, _params));
|
|
12764
12855
|
};
|
|
12765
12856
|
return fn;
|
|
12766
12857
|
};
|
|
@@ -14255,7 +14346,7 @@ function capSize(inst, size) {
|
|
|
14255
14346
|
if (!caps.length)
|
|
14256
14347
|
return;
|
|
14257
14348
|
const cap = Math.min(...caps.map((c2) => c2[0]));
|
|
14258
|
-
const
|
|
14349
|
+
const parse4 = inst._zod.parse;
|
|
14259
14350
|
inst._zod.parse = (payload, ctx) => {
|
|
14260
14351
|
const n3 = size(payload.value);
|
|
14261
14352
|
if (n3 > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
|
|
@@ -14269,7 +14360,7 @@ function capSize(inst, size) {
|
|
|
14269
14360
|
}
|
|
14270
14361
|
}
|
|
14271
14362
|
}
|
|
14272
|
-
return
|
|
14363
|
+
return parse4(payload, ctx);
|
|
14273
14364
|
};
|
|
14274
14365
|
}
|
|
14275
14366
|
var arraySize = (input2) => Array.isArray(input2) ? input2.length : -1;
|
|
@@ -15958,7 +16049,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
15958
16049
|
var NONE = 0;
|
|
15959
16050
|
var ASSUMED = 1;
|
|
15960
16051
|
var PROVEN = 2;
|
|
15961
|
-
function isRecursive(inst, stack,
|
|
16052
|
+
function isRecursive(inst, stack, resolve14) {
|
|
15962
16053
|
const cached3 = recursive.get(inst);
|
|
15963
16054
|
if (cached3 !== void 0)
|
|
15964
16055
|
return cached3 ? PROVEN : NONE;
|
|
@@ -15968,7 +16059,7 @@ function isRecursive(inst, stack, resolve13) {
|
|
|
15968
16059
|
let result = NONE;
|
|
15969
16060
|
const check2 = (child) => {
|
|
15970
16061
|
if (result !== PROVEN && child?._zod) {
|
|
15971
|
-
const answer = isRecursive(child, stack,
|
|
16062
|
+
const answer = isRecursive(child, stack, resolve14);
|
|
15972
16063
|
if (answer > result)
|
|
15973
16064
|
result = answer;
|
|
15974
16065
|
}
|
|
@@ -15979,7 +16070,7 @@ function isRecursive(inst, stack, resolve13) {
|
|
|
15979
16070
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
15980
16071
|
if (spread && !desc.enumerable)
|
|
15981
16072
|
continue;
|
|
15982
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
16073
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve14) : NONE;
|
|
15983
16074
|
if (child > answer)
|
|
15984
16075
|
answer = child;
|
|
15985
16076
|
}
|
|
@@ -16043,7 +16134,7 @@ function isRecursive(inst, stack, resolve13) {
|
|
|
16043
16134
|
break;
|
|
16044
16135
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
16045
16136
|
case "lazy": {
|
|
16046
|
-
const inner = def._cachedInner ?? (
|
|
16137
|
+
const inner = def._cachedInner ?? (resolve14 ? inst._zod.innerType : void 0);
|
|
16047
16138
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
16048
16139
|
break;
|
|
16049
16140
|
}
|
|
@@ -29753,13 +29844,13 @@ function resolveRef(ref, ctx) {
|
|
|
29753
29844
|
if (!ref.startsWith("#")) {
|
|
29754
29845
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
29755
29846
|
}
|
|
29756
|
-
const
|
|
29757
|
-
if (
|
|
29847
|
+
const path29 = ref.slice(1).split("/").filter(Boolean);
|
|
29848
|
+
if (path29.length === 0) {
|
|
29758
29849
|
return ctx.rootSchema;
|
|
29759
29850
|
}
|
|
29760
29851
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
29761
|
-
if (
|
|
29762
|
-
const key =
|
|
29852
|
+
if (path29[0] === defsKey) {
|
|
29853
|
+
const key = path29[1] === void 0 ? void 0 : decodeJSONPointerSegment(path29[1]);
|
|
29763
29854
|
if (!key || !ctx.defs[key]) {
|
|
29764
29855
|
throw new Error(`Reference not found: ${ref}`);
|
|
29765
29856
|
}
|
|
@@ -30612,9 +30703,9 @@ function date4(params) {
|
|
|
30612
30703
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
30613
30704
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
30614
30705
|
var resolvedDuringInvocation = new AsyncLocalStorage();
|
|
30615
|
-
function valueAtPath(root,
|
|
30706
|
+
function valueAtPath(root, path29) {
|
|
30616
30707
|
let current = root;
|
|
30617
|
-
for (const key of
|
|
30708
|
+
for (const key of path29) {
|
|
30618
30709
|
if (current === null || typeof current !== "object") return void 0;
|
|
30619
30710
|
if (!Object.hasOwn(current, key)) return void 0;
|
|
30620
30711
|
current = current[key];
|
|
@@ -30774,8 +30865,8 @@ function parseLinkTarget(input2) {
|
|
|
30774
30865
|
const host = u3.hostname.startsWith("[") ? u3.hostname.slice(1, -1) : u3.hostname;
|
|
30775
30866
|
if (!host) throw new Error(`URL "${input2}" is missing a host.`);
|
|
30776
30867
|
const port = u3.port ? Number(u3.port) : u3.protocol === "https:" ? 443 : 80;
|
|
30777
|
-
const
|
|
30778
|
-
const url2 = `${u3.protocol}//${u3.host}${
|
|
30868
|
+
const path29 = u3.pathname === "/" ? "" : u3.pathname.replace(/\/+$/, "");
|
|
30869
|
+
const url2 = `${u3.protocol}//${u3.host}${path29}`;
|
|
30779
30870
|
const token = u3.username ? decodeURIComponent(u3.username) : void 0;
|
|
30780
30871
|
return { url: url2, host, port, ...token ? { token } : {} };
|
|
30781
30872
|
}
|
|
@@ -30802,7 +30893,7 @@ import { spawn as spawn2 } from "node:child_process";
|
|
|
30802
30893
|
import { once } from "node:events";
|
|
30803
30894
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
30804
30895
|
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
|
|
30896
|
+
import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve7, sep as sep2 } from "node:path";
|
|
30806
30897
|
import { Writable } from "node:stream";
|
|
30807
30898
|
import { pipeline } from "node:stream/promises";
|
|
30808
30899
|
import zlib from "node:zlib";
|
|
@@ -30900,7 +30991,7 @@ async function sniffFormat(archivePath) {
|
|
|
30900
30991
|
}
|
|
30901
30992
|
}
|
|
30902
30993
|
var ZSTD_FRAME_MAGIC = 4247762216;
|
|
30903
|
-
async function assertSingleCompleteZstdFrame(archivePath) {
|
|
30994
|
+
async function assertSingleCompleteZstdFrame(archivePath, signal) {
|
|
30904
30995
|
const fh = await open2(archivePath, "r");
|
|
30905
30996
|
try {
|
|
30906
30997
|
const { size } = await fh.stat();
|
|
@@ -30910,6 +31001,7 @@ async function assertSingleCompleteZstdFrame(archivePath) {
|
|
|
30910
31001
|
let pos = 0;
|
|
30911
31002
|
const read = async (n3) => {
|
|
30912
31003
|
if (pos < windowStart || pos + n3 > windowEnd) {
|
|
31004
|
+
signal?.throwIfAborted();
|
|
30913
31005
|
const { bytesRead } = await fh.read(window2, 0, window2.length, pos);
|
|
30914
31006
|
windowStart = pos;
|
|
30915
31007
|
windowEnd = pos + bytesRead;
|
|
@@ -30947,14 +31039,16 @@ function tarEnv(env) {
|
|
|
30947
31039
|
const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
|
|
30948
31040
|
return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
|
|
30949
31041
|
}
|
|
30950
|
-
async function runTar(archive, args) {
|
|
31042
|
+
async function runTar(archive, args, signal) {
|
|
30951
31043
|
const child = spawn2("tar", [...args, "-f", "-"], {
|
|
31044
|
+
signal,
|
|
30952
31045
|
env: tarEnv(process.env)
|
|
30953
31046
|
});
|
|
30954
|
-
|
|
30955
|
-
|
|
30956
|
-
|
|
31047
|
+
let childError;
|
|
31048
|
+
child.on("error", (err) => {
|
|
31049
|
+
childError = err;
|
|
30957
31050
|
});
|
|
31051
|
+
const closed = new Promise((resolve14) => child.once("close", resolve14));
|
|
30958
31052
|
const stdout2 = collect(child.stdout, MAX_LISTING_BYTES, {
|
|
30959
31053
|
maxLines: MAX_LISTING_LINES,
|
|
30960
31054
|
onOverflow: () => child.kill()
|
|
@@ -30981,12 +31075,15 @@ async function runTar(archive, args) {
|
|
|
30981
31075
|
if (err) child.stdin?.destroy();
|
|
30982
31076
|
done(err);
|
|
30983
31077
|
}
|
|
30984
|
-
})
|
|
31078
|
+
}),
|
|
31079
|
+
{ signal }
|
|
30985
31080
|
).then(
|
|
30986
31081
|
() => null,
|
|
30987
31082
|
(err) => err
|
|
30988
31083
|
);
|
|
30989
|
-
const [code, feedError] = await Promise.all([
|
|
31084
|
+
const [code, feedError] = await Promise.all([closed, fed]);
|
|
31085
|
+
signal?.throwIfAborted();
|
|
31086
|
+
if (childError) throw childError;
|
|
30990
31087
|
if (stdout2.overflowed()) {
|
|
30991
31088
|
throw new Error(
|
|
30992
31089
|
`tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
|
|
@@ -31000,32 +31097,33 @@ async function runTar(archive, args) {
|
|
|
31000
31097
|
function normalizeTarMemberPath(memberPath) {
|
|
31001
31098
|
return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
31002
31099
|
}
|
|
31003
|
-
function isContainedPath(
|
|
31004
|
-
const slashed =
|
|
31100
|
+
function isContainedPath(path29, windows = process.platform === "win32") {
|
|
31101
|
+
const slashed = path29.replace(/\\/g, "/");
|
|
31005
31102
|
const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
|
|
31006
31103
|
return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
|
|
31007
31104
|
}
|
|
31008
31105
|
function isSafeTarMember(memberPath, destDir) {
|
|
31009
31106
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
31010
31107
|
if (!isContainedPath(normalized)) return false;
|
|
31011
|
-
const root =
|
|
31012
|
-
return
|
|
31108
|
+
const root = resolve7(destDir);
|
|
31109
|
+
return resolve7(destDir, normalized).startsWith(root + sep2);
|
|
31013
31110
|
}
|
|
31014
|
-
async function readListing(archive, args) {
|
|
31111
|
+
async function readListing(archive, args, signal) {
|
|
31015
31112
|
try {
|
|
31016
|
-
return await runTar(archive, args);
|
|
31113
|
+
return await runTar(archive, args, signal);
|
|
31017
31114
|
} catch (err) {
|
|
31115
|
+
signal?.throwIfAborted();
|
|
31018
31116
|
throw new ArchiveError(
|
|
31019
31117
|
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
31020
31118
|
);
|
|
31021
31119
|
}
|
|
31022
31120
|
}
|
|
31023
|
-
async function listTarMembers(archive) {
|
|
31024
|
-
const stdout2 = await readListing(archive, ["-t"]);
|
|
31121
|
+
async function listTarMembers(archive, signal) {
|
|
31122
|
+
const stdout2 = await readListing(archive, ["-t"], signal);
|
|
31025
31123
|
return stdout2.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
31026
31124
|
}
|
|
31027
|
-
async function assertSafeMemberTypes(archive) {
|
|
31028
|
-
const stdout2 = await readListing(archive, ["-tv"]);
|
|
31125
|
+
async function assertSafeMemberTypes(archive, signal) {
|
|
31126
|
+
const stdout2 = await readListing(archive, ["-tv"], signal);
|
|
31029
31127
|
for (const line of stdout2.split("\n")) {
|
|
31030
31128
|
if (!line.trim()) continue;
|
|
31031
31129
|
const type = line[0];
|
|
@@ -31045,8 +31143,8 @@ async function assertSafeMemberTypes(archive) {
|
|
|
31045
31143
|
);
|
|
31046
31144
|
}
|
|
31047
31145
|
}
|
|
31048
|
-
async function assertSafeArchive(archive, destDir) {
|
|
31049
|
-
const members2 = await listTarMembers(archive);
|
|
31146
|
+
async function assertSafeArchive(archive, destDir, signal) {
|
|
31147
|
+
const members2 = await listTarMembers(archive, signal);
|
|
31050
31148
|
if (members2.length === 0) {
|
|
31051
31149
|
throw new ArchiveError("Archive is empty.");
|
|
31052
31150
|
}
|
|
@@ -31055,7 +31153,7 @@ async function assertSafeArchive(archive, destDir) {
|
|
|
31055
31153
|
throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
|
|
31056
31154
|
}
|
|
31057
31155
|
}
|
|
31058
|
-
await assertSafeMemberTypes(archive);
|
|
31156
|
+
await assertSafeMemberTypes(archive, signal);
|
|
31059
31157
|
}
|
|
31060
31158
|
async function resolveMember(destDir, expectedName) {
|
|
31061
31159
|
const entries = await readdir3(destDir);
|
|
@@ -31070,19 +31168,24 @@ async function resolveMember(destDir, expectedName) {
|
|
|
31070
31168
|
}
|
|
31071
31169
|
return join9(destDir, real[0]);
|
|
31072
31170
|
}
|
|
31073
|
-
async function safeExtractArchive(archivePath, destDir, expectedName) {
|
|
31171
|
+
async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
|
|
31172
|
+
signal?.throwIfAborted();
|
|
31074
31173
|
let archive;
|
|
31075
31174
|
try {
|
|
31076
31175
|
archive = { path: archivePath, format: await sniffFormat(archivePath) };
|
|
31077
|
-
if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
|
|
31176
|
+
if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath, signal);
|
|
31078
31177
|
} catch (err) {
|
|
31178
|
+
signal?.throwIfAborted();
|
|
31079
31179
|
throw new ArchiveError(
|
|
31080
31180
|
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
31081
31181
|
);
|
|
31082
31182
|
}
|
|
31083
|
-
await assertSafeArchive(archive, destDir);
|
|
31084
|
-
|
|
31085
|
-
|
|
31183
|
+
await assertSafeArchive(archive, destDir, signal);
|
|
31184
|
+
signal?.throwIfAborted();
|
|
31185
|
+
await runTar(archive, ["-x", "-C", destDir], signal);
|
|
31186
|
+
const member = await resolveMember(destDir, expectedName);
|
|
31187
|
+
signal?.throwIfAborted();
|
|
31188
|
+
return member;
|
|
31086
31189
|
}
|
|
31087
31190
|
|
|
31088
31191
|
// ../argent-tools-client/src/errors.ts
|
|
@@ -31115,6 +31218,22 @@ function interpolatePath(template, args) {
|
|
|
31115
31218
|
});
|
|
31116
31219
|
return missing ? null : out;
|
|
31117
31220
|
}
|
|
31221
|
+
function callerPath(p) {
|
|
31222
|
+
const onCurrentDrive = path10.sep === "\\" && /^[\\/](?![\\/])/.test(p);
|
|
31223
|
+
if (!onCurrentDrive && (path10.isAbsolute(p) || path10.win32.isAbsolute(p) || isUnexpandedPath(p))) {
|
|
31224
|
+
return p;
|
|
31225
|
+
}
|
|
31226
|
+
const { root } = path10.parse(p);
|
|
31227
|
+
const rest = p.slice(root.length);
|
|
31228
|
+
if (!rest.split(/[\\/]/).includes("..")) {
|
|
31229
|
+
const resolved = path10.resolve(p);
|
|
31230
|
+
const last = p.split(path10.sep === "\\" ? /[\\/]/ : "/").at(-1);
|
|
31231
|
+
const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(path10.sep);
|
|
31232
|
+
return dirOnly ? `${resolved}${path10.sep}` : resolved;
|
|
31233
|
+
}
|
|
31234
|
+
const base = path10.resolve(root);
|
|
31235
|
+
return base.endsWith(path10.sep) ? `${base}${rest}` : `${base}${path10.sep}${rest}`;
|
|
31236
|
+
}
|
|
31118
31237
|
async function specPath(spec, args) {
|
|
31119
31238
|
if (spec.kind !== "file" || !spec.paths?.length) return interpolatePath(spec.path, args);
|
|
31120
31239
|
const candidates = [];
|
|
@@ -31159,10 +31278,10 @@ function untrackArchive(archive) {
|
|
|
31159
31278
|
for (const s of ARCHIVE_SIGNALS) process.removeListener(s, removeArchivesOnSignal);
|
|
31160
31279
|
process.removeListener("exit", removePendingArchives);
|
|
31161
31280
|
}
|
|
31162
|
-
function sha256File(filePath) {
|
|
31163
|
-
return new Promise((
|
|
31281
|
+
function sha256File(filePath, signal) {
|
|
31282
|
+
return new Promise((resolve14, reject) => {
|
|
31164
31283
|
const hash2 = createHash2("sha256");
|
|
31165
|
-
createReadStream2(filePath).on("data", (chunk) => hash2.update(chunk)).on("end", () =>
|
|
31284
|
+
createReadStream2(filePath, { signal }).on("data", (chunk) => hash2.update(chunk)).on("end", () => resolve14(hash2.digest("hex"))).on("error", reject);
|
|
31166
31285
|
});
|
|
31167
31286
|
}
|
|
31168
31287
|
function toolServerError(text2) {
|
|
@@ -31225,7 +31344,7 @@ async function uploadFile(sourcePath, endpoint, signal) {
|
|
|
31225
31344
|
trackArchive(tarPath);
|
|
31226
31345
|
try {
|
|
31227
31346
|
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
31228
|
-
const contentHash = await sha256File(tarPath);
|
|
31347
|
+
const contentHash = await sha256File(tarPath, signal);
|
|
31229
31348
|
return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
|
|
31230
31349
|
} finally {
|
|
31231
31350
|
untrackArchive(tarPath);
|
|
@@ -31260,13 +31379,21 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
31260
31379
|
return args;
|
|
31261
31380
|
}
|
|
31262
31381
|
const record2 = args;
|
|
31263
|
-
|
|
31382
|
+
const planned = [];
|
|
31383
|
+
const callArgs = { ...record2 };
|
|
31264
31384
|
for (const spec of specs) {
|
|
31265
31385
|
if (spec.skipWhenSet && record2[spec.skipWhenSet] !== void 0) continue;
|
|
31266
31386
|
if (spec.target in record2 && typeof record2[spec.target] !== "string") continue;
|
|
31267
|
-
const
|
|
31268
|
-
if (
|
|
31269
|
-
if (spec.target in record2 && record2[spec.target] !==
|
|
31387
|
+
const spelled = await specPath(spec, record2);
|
|
31388
|
+
if (spelled === null) continue;
|
|
31389
|
+
if (spec.target in record2 && record2[spec.target] !== spelled) continue;
|
|
31390
|
+
const filePath = callerPath(spelled);
|
|
31391
|
+
planned.push({ spec, filePath });
|
|
31392
|
+
if (spec.target in record2) callArgs[spec.target] = filePath;
|
|
31393
|
+
}
|
|
31394
|
+
if (planned.length === 0) return args;
|
|
31395
|
+
const out = { ...record2 };
|
|
31396
|
+
for (const { spec, filePath } of planned) {
|
|
31270
31397
|
const wire = { [FILE_INPUT_MARKER2]: true, path: filePath };
|
|
31271
31398
|
if (spec.kind === "file") {
|
|
31272
31399
|
const read = await readFileInputWire(filePath, { includeContent: opts.includeContent });
|
|
@@ -31274,12 +31401,12 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
31274
31401
|
if (spec.collect === "flow" && opts.includeContent && wire.content !== void 0 && opts.collectMembers) {
|
|
31275
31402
|
Object.assign(
|
|
31276
31403
|
wire,
|
|
31277
|
-
await opts.collectMembers(filePath, Buffer.from(wire.content, "base64"),
|
|
31404
|
+
await opts.collectMembers(filePath, Buffer.from(wire.content, "base64"), callArgs, opts)
|
|
31278
31405
|
);
|
|
31279
31406
|
}
|
|
31280
31407
|
}
|
|
31281
31408
|
if (spec.kind === "probe" && spec.collect === "step" && opts.includeContent && opts.collectStepMembers) {
|
|
31282
|
-
wire.members = await opts.collectStepMembers(
|
|
31409
|
+
wire.members = await opts.collectStepMembers(callArgs, opts);
|
|
31283
31410
|
}
|
|
31284
31411
|
if (spec.kind === "tar-upload") {
|
|
31285
31412
|
const st = await stat3(filePath).catch(() => null);
|
|
@@ -31293,10 +31420,9 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
31293
31420
|
Object.assign(wire, await uploadFile(filePath, opts.uploadEndpoint, opts.signal));
|
|
31294
31421
|
}
|
|
31295
31422
|
}
|
|
31296
|
-
out = out ?? { ...record2 };
|
|
31297
31423
|
out[spec.target] = wire;
|
|
31298
31424
|
}
|
|
31299
|
-
return out
|
|
31425
|
+
return out;
|
|
31300
31426
|
}
|
|
31301
31427
|
function isAllowedClientFilePath(p) {
|
|
31302
31428
|
if (!path10.isAbsolute(p)) return false;
|
|
@@ -31660,7 +31786,7 @@ function memberCollector(roots, opts) {
|
|
|
31660
31786
|
for (let file2 = files.shift(); file2 !== void 0; file2 = files.shift()) {
|
|
31661
31787
|
let doc;
|
|
31662
31788
|
try {
|
|
31663
|
-
doc = (0, import_yaml.parse)(file2.text
|
|
31789
|
+
doc = (0, import_yaml.parse)(flowYamlSource(file2.text), { logLevel: "error" });
|
|
31664
31790
|
} catch {
|
|
31665
31791
|
continue;
|
|
31666
31792
|
}
|
|
@@ -31775,7 +31901,7 @@ function recordedStep(args) {
|
|
|
31775
31901
|
async function collectStepMembers(args, opts, recordingDirFor = e2eDirFor) {
|
|
31776
31902
|
const { name, project_root: projectRoot } = args;
|
|
31777
31903
|
const step = recordedStep(args);
|
|
31778
|
-
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) ||
|
|
31904
|
+
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || !isResolvedAbsolute2(projectRoot) || step === void 0) {
|
|
31779
31905
|
return [];
|
|
31780
31906
|
}
|
|
31781
31907
|
const recording = path11.join(recordingDirFor(projectRoot), `${name}.yaml`);
|
|
@@ -31861,7 +31987,10 @@ async function stepForOlderServer(args, listedId) {
|
|
|
31861
31987
|
async function e2eShadowWarningFor(tool, args) {
|
|
31862
31988
|
const id = canonicalToolId(tool);
|
|
31863
31989
|
if (id !== "e2e-execute" && id !== "e2e-read-prerequisite") return void 0;
|
|
31864
|
-
const
|
|
31990
|
+
const root = args?.project_root;
|
|
31991
|
+
const target = nestedFlowTarget(
|
|
31992
|
+
typeof root === "string" ? { ...args, project_root: callerPath(root) } : args
|
|
31993
|
+
);
|
|
31865
31994
|
if (target?.kind !== "name") return void 0;
|
|
31866
31995
|
const picked = await pickE2eFile(target.paths);
|
|
31867
31996
|
return picked.shadowed === void 0 ? void 0 : e2eShadowWarning(picked.path, picked.shadowed);
|
|
@@ -32025,7 +32154,7 @@ async function forwardedSecrets(args) {
|
|
|
32025
32154
|
}
|
|
32026
32155
|
let parsed;
|
|
32027
32156
|
try {
|
|
32028
|
-
parsed = text2 === void 0 ? void 0 : (0, import_yaml2.parse)(text2
|
|
32157
|
+
parsed = text2 === void 0 ? void 0 : (0, import_yaml2.parse)(flowYamlSource(text2), { logLevel: "error" });
|
|
32029
32158
|
} catch {
|
|
32030
32159
|
continue;
|
|
32031
32160
|
}
|
|
@@ -32056,6 +32185,34 @@ function secretsTransportRefusal(url2) {
|
|
|
32056
32185
|
return void 0;
|
|
32057
32186
|
}
|
|
32058
32187
|
var FETCH_HEAD_BYTES = 256;
|
|
32188
|
+
function isRecord2(value) {
|
|
32189
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
32190
|
+
}
|
|
32191
|
+
var PROJECT_PATH_ADVICE = {
|
|
32192
|
+
project_root: "Pass the absolute path to the project root directory - the same cwd the calling agent is working in.",
|
|
32193
|
+
e2e_test_path: "Pass the absolute path to the e2e test file."
|
|
32194
|
+
};
|
|
32195
|
+
function assertAbsoluteProjectPaths(meta3, args) {
|
|
32196
|
+
if (!meta3 || !isRecord2(args)) return;
|
|
32197
|
+
const aliases = Object.entries(toolParamAliases(meta3.name));
|
|
32198
|
+
for (const [param, advice] of Object.entries(PROJECT_PATH_ADVICE)) {
|
|
32199
|
+
const value = args[param];
|
|
32200
|
+
if (typeof value !== "string" || callerPath(value) === value) continue;
|
|
32201
|
+
const names = [param, ...aliases.filter(([, current]) => current === param).map(([f]) => f)];
|
|
32202
|
+
if (!meta3.fileInputs?.some((spec) => names.some((n3) => spec.path.includes(`\${${n3}}`)))) {
|
|
32203
|
+
continue;
|
|
32204
|
+
}
|
|
32205
|
+
throw new Error(`${param} must be an absolute path (got "${value}"). ${advice}`);
|
|
32206
|
+
}
|
|
32207
|
+
}
|
|
32208
|
+
function failedRun(result) {
|
|
32209
|
+
if (!isRecord2(result)) return result;
|
|
32210
|
+
if (result.ok === true) return { ...result, ok: false };
|
|
32211
|
+
if (isRecord2(result.toolResult) && result.toolResult.ok === true) {
|
|
32212
|
+
return { ...result, toolResult: { ...result.toolResult, ok: false } };
|
|
32213
|
+
}
|
|
32214
|
+
return result;
|
|
32215
|
+
}
|
|
32059
32216
|
function createToolsClient(options = {}) {
|
|
32060
32217
|
let cached3 = null;
|
|
32061
32218
|
const doFetch = options.fetchImpl ?? ((url2, init2) => fetch(url2, init2));
|
|
@@ -32104,6 +32261,7 @@ function createToolsClient(options = {}) {
|
|
|
32104
32261
|
let finalArgs = canonicalToolArgs(name, args);
|
|
32105
32262
|
const { tools: tools2, uploadFormats } = await fetchToolList({ signal: opts?.signal });
|
|
32106
32263
|
const meta3 = findTool(tools2, name);
|
|
32264
|
+
if (options.refuseRelativeProjectPaths) assertAbsoluteProjectPaths(meta3, finalArgs);
|
|
32107
32265
|
const olderServer = meta3 !== null && !tools2.some((t2) => t2.name === canonicalToolId(meta3.name));
|
|
32108
32266
|
if (meta3) {
|
|
32109
32267
|
finalArgs = await nameToE2ePathForOlderServer(meta3.name, meta3.fileInputs, finalArgs);
|
|
@@ -32141,7 +32299,7 @@ function createToolsClient(options = {}) {
|
|
|
32141
32299
|
}
|
|
32142
32300
|
}
|
|
32143
32301
|
}
|
|
32144
|
-
const result = applied.result;
|
|
32302
|
+
const result = applied.failed.length > 0 ? failedRun(applied.result) : applied.result;
|
|
32145
32303
|
if (shadowWarning === void 0 || typeof result !== "object" || result === null || Array.isArray(result) || typeof result.warning === "string") {
|
|
32146
32304
|
return result;
|
|
32147
32305
|
}
|
|
@@ -32268,10 +32426,19 @@ function createToolsClient(options = {}) {
|
|
|
32268
32426
|
}
|
|
32269
32427
|
|
|
32270
32428
|
// ../argent-tools-client/src/artifacts.ts
|
|
32271
|
-
import {
|
|
32429
|
+
import {
|
|
32430
|
+
copyFile,
|
|
32431
|
+
mkdir as mkdir4,
|
|
32432
|
+
mkdtemp,
|
|
32433
|
+
readFile as readFile6,
|
|
32434
|
+
realpath as realpath4,
|
|
32435
|
+
rm as rm3,
|
|
32436
|
+
stat as stat5,
|
|
32437
|
+
writeFile as writeFile4
|
|
32438
|
+
} from "node:fs/promises";
|
|
32272
32439
|
import { constants as fsConstants } from "node:fs";
|
|
32273
32440
|
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
|
|
32441
|
+
import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve10, sep as sep5 } from "node:path";
|
|
32275
32442
|
import { createHash as createHash3 } from "node:crypto";
|
|
32276
32443
|
var ARTIFACT_MARKER2 = "__argentArtifact";
|
|
32277
32444
|
function isArtifactHandle(value) {
|
|
@@ -32319,8 +32486,8 @@ function configuredRecordingsDir() {
|
|
|
32319
32486
|
const trimmed = value.trim();
|
|
32320
32487
|
if (trimmed === "") return null;
|
|
32321
32488
|
const home = dirname9(argentHomeDir());
|
|
32322
|
-
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${
|
|
32323
|
-
return
|
|
32489
|
+
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep5}`) ? join13(home, trimmed.slice(2)) : trimmed;
|
|
32490
|
+
return resolve10(durableBaseDir(), expanded);
|
|
32324
32491
|
}
|
|
32325
32492
|
var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
|
|
32326
32493
|
async function readCapped(res, cap) {
|
|
@@ -32353,10 +32520,10 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
32353
32520
|
const stem = filename.slice(0, filename.length - ext.length);
|
|
32354
32521
|
for (let i2 = 1; i2 <= 1e3; i2++) {
|
|
32355
32522
|
const candidate = i2 === 1 ? filename : `${stem} (${i2})${ext}`;
|
|
32356
|
-
const
|
|
32523
|
+
const path29 = join13(dir, candidate);
|
|
32357
32524
|
try {
|
|
32358
|
-
await write(
|
|
32359
|
-
return
|
|
32525
|
+
await write(path29);
|
|
32526
|
+
return path29;
|
|
32360
32527
|
} catch (err) {
|
|
32361
32528
|
if (err?.code === "EEXIST") continue;
|
|
32362
32529
|
throw err;
|
|
@@ -32367,7 +32534,7 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
32367
32534
|
function durableSaveTarget(handle) {
|
|
32368
32535
|
if (typeof handle.saveDir !== "string" || !handle.saveDir || handle.archive) return null;
|
|
32369
32536
|
const rel = normalize2(handle.saveDir);
|
|
32370
|
-
if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${
|
|
32537
|
+
if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${sep5}`) || rel.split(sep5).includes("..")) {
|
|
32371
32538
|
return null;
|
|
32372
32539
|
}
|
|
32373
32540
|
if (!ALLOWED_SAVE_DIRS.has(rel)) return null;
|
|
@@ -32412,16 +32579,22 @@ async function resolveLocalFile(handle) {
|
|
|
32412
32579
|
return null;
|
|
32413
32580
|
}
|
|
32414
32581
|
}
|
|
32415
|
-
async function downloadAndExtractArchive(handle, data, dir) {
|
|
32416
|
-
|
|
32582
|
+
async function downloadAndExtractArchive(handle, data, dir, signal) {
|
|
32583
|
+
signal?.throwIfAborted();
|
|
32584
|
+
const attemptDir = await mkdtemp(join13(dir, "bundle-"));
|
|
32585
|
+
const tarball = join13(attemptDir, "download.tar");
|
|
32586
|
+
const extractDir = join13(attemptDir, "files");
|
|
32417
32587
|
try {
|
|
32418
|
-
await writeFile4(tarball, data);
|
|
32419
|
-
|
|
32588
|
+
await writeFile4(tarball, data, { signal });
|
|
32589
|
+
await mkdir4(extractDir);
|
|
32590
|
+
const member = await safeExtractArchive(tarball, extractDir, handle.filename, signal);
|
|
32591
|
+
await rm3(tarball);
|
|
32592
|
+
signal?.throwIfAborted();
|
|
32593
|
+
return member;
|
|
32420
32594
|
} catch {
|
|
32421
|
-
|
|
32422
|
-
} finally {
|
|
32423
|
-
await rm3(tarball, { force: true }).catch(() => {
|
|
32595
|
+
await rm3(attemptDir, { recursive: true, force: true }).catch(() => {
|
|
32424
32596
|
});
|
|
32597
|
+
return null;
|
|
32425
32598
|
}
|
|
32426
32599
|
}
|
|
32427
32600
|
async function materializeArtifacts(result, ctx) {
|
|
@@ -32507,7 +32680,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
32507
32680
|
if (!data) return null;
|
|
32508
32681
|
await ensureDir();
|
|
32509
32682
|
if (value.archive === "tar.gz") {
|
|
32510
|
-
return await downloadAndExtractArchive(value, data, dir);
|
|
32683
|
+
return await downloadAndExtractArchive(value, data, dir, ctx.signal);
|
|
32511
32684
|
}
|
|
32512
32685
|
if (value.size > 0 && data.length !== value.size) return null;
|
|
32513
32686
|
const downloadedPath = join13(dir, sanitizeSegment(value.filename));
|
|
@@ -32967,8 +33140,8 @@ var Deferred = class {
|
|
|
32967
33140
|
_resolve;
|
|
32968
33141
|
_reject;
|
|
32969
33142
|
constructor() {
|
|
32970
|
-
this._promise = new Promise((
|
|
32971
|
-
this._resolve =
|
|
33143
|
+
this._promise = new Promise((resolve14, reject) => {
|
|
33144
|
+
this._resolve = resolve14;
|
|
32972
33145
|
this._reject = reject;
|
|
32973
33146
|
});
|
|
32974
33147
|
}
|
|
@@ -33861,8 +34034,8 @@ var ExportOperation = class {
|
|
|
33861
34034
|
_metrics;
|
|
33862
34035
|
_exportScheduledResolve;
|
|
33863
34036
|
constructor(exporter, logRecords, exportTimeoutMillis, metrics) {
|
|
33864
|
-
this._exportScheduledPromise = new Promise((
|
|
33865
|
-
this._exportScheduledResolve =
|
|
34037
|
+
this._exportScheduledPromise = new Promise((resolve14) => {
|
|
34038
|
+
this._exportScheduledResolve = resolve14;
|
|
33866
34039
|
});
|
|
33867
34040
|
this._exportCompleted = this._executeExport(exporter, logRecords, exportTimeoutMillis);
|
|
33868
34041
|
this._metrics = metrics;
|
|
@@ -33887,7 +34060,7 @@ var ExportOperation = class {
|
|
|
33887
34060
|
}
|
|
33888
34061
|
}
|
|
33889
34062
|
async _exportWithTimeout(exporter, logRecords, exportTimeoutMillis) {
|
|
33890
|
-
return new Promise((
|
|
34063
|
+
return new Promise((resolve14, reject) => {
|
|
33891
34064
|
const timer = setTimeout(() => {
|
|
33892
34065
|
reject(new Error("Timeout"));
|
|
33893
34066
|
}, exportTimeoutMillis);
|
|
@@ -33895,7 +34068,7 @@ var ExportOperation = class {
|
|
|
33895
34068
|
this._metrics.finishLogs(logRecords.length, result.error);
|
|
33896
34069
|
clearTimeout(timer);
|
|
33897
34070
|
if (result.code === ExportResultCode.SUCCESS) {
|
|
33898
|
-
|
|
34071
|
+
resolve14();
|
|
33899
34072
|
} else {
|
|
33900
34073
|
reject(result.error ?? new Error("BatchLogRecordProcessor: log record export failed"));
|
|
33901
34074
|
}
|
|
@@ -34676,7 +34849,7 @@ function parseRetryAfterToMills(retryAfter) {
|
|
|
34676
34849
|
var DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${VERSION4}`;
|
|
34677
34850
|
var MAX_RESPONSE_BODY_SIZE = 4 * 1024 * 1024;
|
|
34678
34851
|
function sendWithHttp(request, url2, headers, compression, userAgent, agent, data, timeoutMillis) {
|
|
34679
|
-
return new Promise((
|
|
34852
|
+
return new Promise((resolve14) => {
|
|
34680
34853
|
const parsedUrl = new URL(url2);
|
|
34681
34854
|
if (userAgent) {
|
|
34682
34855
|
headers["User-Agent"] = `${userAgent} ${DEFAULT_USER_AGENT}`;
|
|
@@ -34695,7 +34868,7 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
|
|
|
34695
34868
|
responseSize += chunk.length;
|
|
34696
34869
|
if (responseSize > MAX_RESPONSE_BODY_SIZE) {
|
|
34697
34870
|
const sizeError = new Error(`OTLP export response body exceeded size limit of ${MAX_RESPONSE_BODY_SIZE} bytes`);
|
|
34698
|
-
|
|
34871
|
+
resolve14({ status: "failure", error: sizeError });
|
|
34699
34872
|
res.destroy();
|
|
34700
34873
|
return;
|
|
34701
34874
|
}
|
|
@@ -34703,18 +34876,18 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
|
|
|
34703
34876
|
});
|
|
34704
34877
|
res.on("end", () => {
|
|
34705
34878
|
if (res.statusCode && res.statusCode <= 299) {
|
|
34706
|
-
|
|
34879
|
+
resolve14({
|
|
34707
34880
|
status: "success",
|
|
34708
34881
|
data: Buffer.concat(responseData)
|
|
34709
34882
|
});
|
|
34710
34883
|
} else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
|
|
34711
|
-
|
|
34884
|
+
resolve14({
|
|
34712
34885
|
status: "retryable",
|
|
34713
34886
|
retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
|
|
34714
34887
|
});
|
|
34715
34888
|
} else {
|
|
34716
34889
|
const error63 = new OTLPExporterError(res.statusMessage, res.statusCode, Buffer.concat(responseData).toString());
|
|
34717
|
-
|
|
34890
|
+
resolve14({
|
|
34718
34891
|
status: "failure",
|
|
34719
34892
|
error: error63
|
|
34720
34893
|
});
|
|
@@ -34722,17 +34895,17 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
|
|
|
34722
34895
|
});
|
|
34723
34896
|
res.on("error", (error63) => {
|
|
34724
34897
|
if (res.statusCode && res.statusCode <= 299) {
|
|
34725
|
-
|
|
34898
|
+
resolve14({
|
|
34726
34899
|
status: "success"
|
|
34727
34900
|
});
|
|
34728
34901
|
} else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
|
|
34729
|
-
|
|
34902
|
+
resolve14({
|
|
34730
34903
|
status: "retryable",
|
|
34731
34904
|
error: error63,
|
|
34732
34905
|
retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
|
|
34733
34906
|
});
|
|
34734
34907
|
} else {
|
|
34735
|
-
|
|
34908
|
+
resolve14({
|
|
34736
34909
|
status: "failure",
|
|
34737
34910
|
error: error63
|
|
34738
34911
|
});
|
|
@@ -34741,26 +34914,26 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
|
|
|
34741
34914
|
});
|
|
34742
34915
|
req.setTimeout(timeoutMillis, () => {
|
|
34743
34916
|
req.destroy();
|
|
34744
|
-
|
|
34917
|
+
resolve14({
|
|
34745
34918
|
status: "retryable",
|
|
34746
34919
|
error: new Error("Request timed out")
|
|
34747
34920
|
});
|
|
34748
34921
|
});
|
|
34749
34922
|
req.on("error", (error63) => {
|
|
34750
34923
|
if (isHttpTransportNetworkErrorRetryable(error63)) {
|
|
34751
|
-
|
|
34924
|
+
resolve14({
|
|
34752
34925
|
status: "retryable",
|
|
34753
34926
|
error: error63
|
|
34754
34927
|
});
|
|
34755
34928
|
} else {
|
|
34756
|
-
|
|
34929
|
+
resolve14({
|
|
34757
34930
|
status: "failure",
|
|
34758
34931
|
error: error63
|
|
34759
34932
|
});
|
|
34760
34933
|
}
|
|
34761
34934
|
});
|
|
34762
34935
|
compressAndSend(req, compression, data, (error63) => {
|
|
34763
|
-
|
|
34936
|
+
resolve14({
|
|
34764
34937
|
status: "failure",
|
|
34765
34938
|
error: error63
|
|
34766
34939
|
});
|
|
@@ -34850,9 +35023,9 @@ var RetryingTransport = class {
|
|
|
34850
35023
|
this._transport = transport;
|
|
34851
35024
|
}
|
|
34852
35025
|
retry(data, timeoutMillis, inMillis) {
|
|
34853
|
-
return new Promise((
|
|
35026
|
+
return new Promise((resolve14, reject) => {
|
|
34854
35027
|
setTimeout(() => {
|
|
34855
|
-
this._transport.send(data, timeoutMillis).then(
|
|
35028
|
+
this._transport.send(data, timeoutMillis).then(resolve14, reject);
|
|
34856
35029
|
}, inMillis);
|
|
34857
35030
|
});
|
|
34858
35031
|
}
|
|
@@ -34965,7 +35138,7 @@ function getSharedConfigurationFromEnvironment(signalIdentifier) {
|
|
|
34965
35138
|
init_esm();
|
|
34966
35139
|
|
|
34967
35140
|
// ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-node-http-env-configuration.js
|
|
34968
|
-
import * as
|
|
35141
|
+
import * as fs8 from "fs";
|
|
34969
35142
|
import * as path13 from "path";
|
|
34970
35143
|
init_esm();
|
|
34971
35144
|
function getStaticHeadersFromEnv(signalIdentifier) {
|
|
@@ -34987,7 +35160,7 @@ function appendRootPathToUrlIfNeeded(url2) {
|
|
|
34987
35160
|
return void 0;
|
|
34988
35161
|
}
|
|
34989
35162
|
}
|
|
34990
|
-
function appendResourcePathToUrl(url2,
|
|
35163
|
+
function appendResourcePathToUrl(url2, path29) {
|
|
34991
35164
|
try {
|
|
34992
35165
|
new URL(url2);
|
|
34993
35166
|
} catch {
|
|
@@ -34997,11 +35170,11 @@ function appendResourcePathToUrl(url2, path25) {
|
|
|
34997
35170
|
if (!url2.endsWith("/")) {
|
|
34998
35171
|
url2 = url2 + "/";
|
|
34999
35172
|
}
|
|
35000
|
-
url2 +=
|
|
35173
|
+
url2 += path29;
|
|
35001
35174
|
try {
|
|
35002
35175
|
new URL(url2);
|
|
35003
35176
|
} catch {
|
|
35004
|
-
diag2.warn(`Configuration: Provided URL appended with '${
|
|
35177
|
+
diag2.warn(`Configuration: Provided URL appended with '${path29}' is not a valid URL, using 'undefined' instead of '${url2}'`);
|
|
35005
35178
|
return void 0;
|
|
35006
35179
|
}
|
|
35007
35180
|
return url2;
|
|
@@ -35026,7 +35199,7 @@ function readFileFromEnv(signalSpecificEnvVar, nonSignalSpecificEnvVar, warningM
|
|
|
35026
35199
|
const filePath = signalSpecificPath ?? nonSignalSpecificPath;
|
|
35027
35200
|
if (filePath != null) {
|
|
35028
35201
|
try {
|
|
35029
|
-
return
|
|
35202
|
+
return fs8.readFileSync(path13.resolve(process.cwd(), filePath));
|
|
35030
35203
|
} catch {
|
|
35031
35204
|
diag2.warn(warningMessage);
|
|
35032
35205
|
return void 0;
|
|
@@ -35112,7 +35285,7 @@ var OTLPLogExporter = class extends OTLPExporterBase {
|
|
|
35112
35285
|
init_esm();
|
|
35113
35286
|
|
|
35114
35287
|
// ../telemetry/src/debug.ts
|
|
35115
|
-
import * as
|
|
35288
|
+
import * as fs9 from "node:fs";
|
|
35116
35289
|
|
|
35117
35290
|
// ../telemetry/src/paths.ts
|
|
35118
35291
|
import * as path14 from "node:path";
|
|
@@ -35150,8 +35323,8 @@ function emitDebugPayload(payload) {
|
|
|
35150
35323
|
} catch {
|
|
35151
35324
|
}
|
|
35152
35325
|
try {
|
|
35153
|
-
|
|
35154
|
-
|
|
35326
|
+
fs9.mkdirSync(argentHomeDir(), { recursive: true });
|
|
35327
|
+
fs9.appendFileSync(debugLogPath(), line + "\n");
|
|
35155
35328
|
} catch {
|
|
35156
35329
|
}
|
|
35157
35330
|
}
|
|
@@ -35337,7 +35510,8 @@ var DEVICE_KINDS = [
|
|
|
35337
35510
|
"emulator",
|
|
35338
35511
|
"vvd",
|
|
35339
35512
|
"device",
|
|
35340
|
-
"app"
|
|
35513
|
+
"app",
|
|
35514
|
+
"catalyst"
|
|
35341
35515
|
];
|
|
35342
35516
|
var DEBUGGER_NOT_CONNECTED_REASONS = [
|
|
35343
35517
|
"metro_not_running",
|
|
@@ -35475,7 +35649,8 @@ var ALLOWED = {
|
|
|
35475
35649
|
install_mode: INSTALL_MODE
|
|
35476
35650
|
},
|
|
35477
35651
|
"installation:allowlist_decision": {
|
|
35478
|
-
is_enabled: bool
|
|
35652
|
+
is_enabled: bool,
|
|
35653
|
+
decided_by: oneOf(["flag", "default", "prompt"])
|
|
35479
35654
|
},
|
|
35480
35655
|
"installation:stale_config_cleanup": {
|
|
35481
35656
|
removed_count: COUNT,
|
|
@@ -35662,9 +35837,9 @@ function isReplitAgent(env) {
|
|
|
35662
35837
|
}
|
|
35663
35838
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
35664
35839
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
35665
|
-
function safeExists(fileExists,
|
|
35840
|
+
function safeExists(fileExists, path29) {
|
|
35666
35841
|
try {
|
|
35667
|
-
return fileExists(
|
|
35842
|
+
return fileExists(path29);
|
|
35668
35843
|
} catch {
|
|
35669
35844
|
return false;
|
|
35670
35845
|
}
|
|
@@ -36079,13 +36254,12 @@ function isCi(env = process.env) {
|
|
|
36079
36254
|
if (GENERIC_CI_ENV_VARS.some((name) => Boolean(env[name]))) return true;
|
|
36080
36255
|
return isKnownVendorCi(env);
|
|
36081
36256
|
}
|
|
36082
|
-
var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
36083
36257
|
|
|
36084
36258
|
// ../telemetry/src/base-props.ts
|
|
36085
36259
|
var SESSION_ID2 = randomUUID5();
|
|
36086
36260
|
function readCliVersion() {
|
|
36087
36261
|
if (true) {
|
|
36088
|
-
return "0.34.1-next.
|
|
36262
|
+
return "0.34.1-next.39";
|
|
36089
36263
|
}
|
|
36090
36264
|
return "0.0.0";
|
|
36091
36265
|
}
|
|
@@ -36118,7 +36292,7 @@ function getBaseProps(runtime) {
|
|
|
36118
36292
|
|
|
36119
36293
|
// ../telemetry/src/identity.ts
|
|
36120
36294
|
import * as crypto2 from "node:crypto";
|
|
36121
|
-
import * as
|
|
36295
|
+
import * as fs10 from "node:fs";
|
|
36122
36296
|
import * as path15 from "node:path";
|
|
36123
36297
|
var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
|
|
36124
36298
|
var cached2 = null;
|
|
@@ -36215,17 +36389,17 @@ function resolveFingerprintOnce(resolveFingerprint) {
|
|
|
36215
36389
|
function isCorruptIdFile(filePath) {
|
|
36216
36390
|
let isRegularFile;
|
|
36217
36391
|
try {
|
|
36218
|
-
isRegularFile =
|
|
36392
|
+
isRegularFile = fs10.lstatSync(filePath).isFile();
|
|
36219
36393
|
} catch {
|
|
36220
36394
|
return false;
|
|
36221
36395
|
}
|
|
36222
36396
|
return isRegularFile && tryReadId(filePath) === null;
|
|
36223
36397
|
}
|
|
36224
36398
|
function writeIdFileAtomic(finalPath, id) {
|
|
36225
|
-
|
|
36399
|
+
fs10.mkdirSync(argentHomeDir(), { recursive: true });
|
|
36226
36400
|
let occupant;
|
|
36227
36401
|
try {
|
|
36228
|
-
occupant =
|
|
36402
|
+
occupant = fs10.lstatSync(finalPath);
|
|
36229
36403
|
} catch (err) {
|
|
36230
36404
|
if (err.code !== "ENOENT") throw err;
|
|
36231
36405
|
}
|
|
@@ -36236,24 +36410,24 @@ function writeIdFileAtomic(finalPath, id) {
|
|
|
36236
36410
|
argentHomeDir(),
|
|
36237
36411
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
36238
36412
|
);
|
|
36239
|
-
const fd =
|
|
36413
|
+
const fd = fs10.openSync(tmpPath, "wx", 384);
|
|
36240
36414
|
try {
|
|
36241
36415
|
try {
|
|
36242
|
-
|
|
36243
|
-
|
|
36416
|
+
fs10.writeSync(fd, id);
|
|
36417
|
+
fs10.fsyncSync(fd);
|
|
36244
36418
|
} finally {
|
|
36245
|
-
|
|
36419
|
+
fs10.closeSync(fd);
|
|
36246
36420
|
}
|
|
36247
|
-
|
|
36421
|
+
fs10.renameSync(tmpPath, finalPath);
|
|
36248
36422
|
} finally {
|
|
36249
36423
|
try {
|
|
36250
|
-
|
|
36424
|
+
fs10.unlinkSync(tmpPath);
|
|
36251
36425
|
} catch {
|
|
36252
36426
|
}
|
|
36253
36427
|
}
|
|
36254
36428
|
}
|
|
36255
36429
|
function mintRandomId(finalPath) {
|
|
36256
|
-
|
|
36430
|
+
fs10.mkdirSync(argentHomeDir(), { recursive: true });
|
|
36257
36431
|
let value = crypto2.randomUUID();
|
|
36258
36432
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
36259
36433
|
const tmpPath = path15.join(
|
|
@@ -36262,19 +36436,19 @@ function mintRandomId(finalPath) {
|
|
|
36262
36436
|
);
|
|
36263
36437
|
let fd;
|
|
36264
36438
|
try {
|
|
36265
|
-
fd =
|
|
36439
|
+
fd = fs10.openSync(tmpPath, "wx", 384);
|
|
36266
36440
|
} catch (err) {
|
|
36267
36441
|
if (err.code === "EEXIST") continue;
|
|
36268
36442
|
throw err;
|
|
36269
36443
|
}
|
|
36270
36444
|
try {
|
|
36271
36445
|
try {
|
|
36272
|
-
|
|
36273
|
-
|
|
36446
|
+
fs10.writeSync(fd, value);
|
|
36447
|
+
fs10.fsyncSync(fd);
|
|
36274
36448
|
} finally {
|
|
36275
|
-
|
|
36449
|
+
fs10.closeSync(fd);
|
|
36276
36450
|
}
|
|
36277
|
-
|
|
36451
|
+
fs10.linkSync(tmpPath, finalPath);
|
|
36278
36452
|
cached2 = { path: finalPath, id: value };
|
|
36279
36453
|
return value;
|
|
36280
36454
|
} catch (err) {
|
|
@@ -36293,7 +36467,7 @@ function mintRandomId(finalPath) {
|
|
|
36293
36467
|
throw err;
|
|
36294
36468
|
} finally {
|
|
36295
36469
|
try {
|
|
36296
|
-
|
|
36470
|
+
fs10.unlinkSync(tmpPath);
|
|
36297
36471
|
} catch {
|
|
36298
36472
|
}
|
|
36299
36473
|
}
|
|
@@ -36306,7 +36480,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
36306
36480
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
36307
36481
|
);
|
|
36308
36482
|
try {
|
|
36309
|
-
|
|
36483
|
+
fs10.renameSync(finalPath, claimed);
|
|
36310
36484
|
} catch {
|
|
36311
36485
|
return null;
|
|
36312
36486
|
}
|
|
@@ -36315,7 +36489,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
36315
36489
|
grabbed = tryReadId(claimed);
|
|
36316
36490
|
} finally {
|
|
36317
36491
|
try {
|
|
36318
|
-
|
|
36492
|
+
fs10.unlinkSync(claimed);
|
|
36319
36493
|
} catch {
|
|
36320
36494
|
}
|
|
36321
36495
|
}
|
|
@@ -36327,9 +36501,9 @@ function peekAnonId() {
|
|
|
36327
36501
|
function tryReadId(filePath) {
|
|
36328
36502
|
let raw;
|
|
36329
36503
|
try {
|
|
36330
|
-
const stats =
|
|
36504
|
+
const stats = fs10.lstatSync(filePath);
|
|
36331
36505
|
if (!stats.isFile()) return null;
|
|
36332
|
-
raw =
|
|
36506
|
+
raw = fs10.readFileSync(filePath, "utf8");
|
|
36333
36507
|
} catch (err) {
|
|
36334
36508
|
if (err.code === "ENOENT") return null;
|
|
36335
36509
|
return null;
|
|
@@ -36344,7 +36518,7 @@ import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_proce
|
|
|
36344
36518
|
|
|
36345
36519
|
// ../native-devtools-ios/src/index.ts
|
|
36346
36520
|
import * as path16 from "node:path";
|
|
36347
|
-
import * as
|
|
36521
|
+
import * as fs11 from "node:fs";
|
|
36348
36522
|
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path16.join(__dirname, "..", "dylibs");
|
|
36349
36523
|
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path16.join(__dirname, "..", "bin");
|
|
36350
36524
|
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path16.join(DYLIB_DIR, "tcp");
|
|
@@ -36364,9 +36538,9 @@ function platformBinDir() {
|
|
|
36364
36538
|
function simulatorServerBinaryPath() {
|
|
36365
36539
|
const binaryName = simulatorServerBinaryName();
|
|
36366
36540
|
const p = path16.join(platformBinDir(), binaryName);
|
|
36367
|
-
if (!
|
|
36541
|
+
if (!fs11.existsSync(p)) {
|
|
36368
36542
|
const flat = path16.join(BIN_DIR, binaryName);
|
|
36369
|
-
const migrationHint =
|
|
36543
|
+
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
36544
|
throw new Error(
|
|
36371
36545
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
36372
36546
|
);
|
|
@@ -36395,12 +36569,12 @@ function resolveHostFingerprint() {
|
|
|
36395
36569
|
}
|
|
36396
36570
|
}
|
|
36397
36571
|
function resolveHostFingerprintAsync() {
|
|
36398
|
-
return new Promise((
|
|
36572
|
+
return new Promise((resolve14) => {
|
|
36399
36573
|
let binary;
|
|
36400
36574
|
try {
|
|
36401
36575
|
binary = simulatorServerBinaryPath();
|
|
36402
36576
|
} catch {
|
|
36403
|
-
|
|
36577
|
+
resolve14(null);
|
|
36404
36578
|
return;
|
|
36405
36579
|
}
|
|
36406
36580
|
let settled = false;
|
|
@@ -36413,7 +36587,7 @@ function resolveHostFingerprintAsync() {
|
|
|
36413
36587
|
child?.kill("SIGKILL");
|
|
36414
36588
|
} catch {
|
|
36415
36589
|
}
|
|
36416
|
-
|
|
36590
|
+
resolve14(value);
|
|
36417
36591
|
};
|
|
36418
36592
|
const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
|
|
36419
36593
|
watchdog.unref?.();
|
|
@@ -36446,14 +36620,15 @@ function resolveHostFingerprintAsync() {
|
|
|
36446
36620
|
}
|
|
36447
36621
|
|
|
36448
36622
|
// ../telemetry/src/consent.ts
|
|
36449
|
-
import * as
|
|
36623
|
+
import * as fs12 from "node:fs";
|
|
36624
|
+
import * as path17 from "node:path";
|
|
36450
36625
|
var cache = /* @__PURE__ */ new Map();
|
|
36451
36626
|
var sessionOverride = null;
|
|
36452
36627
|
function readConfigOverrideAt(filePath) {
|
|
36453
36628
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
36454
36629
|
let stats;
|
|
36455
36630
|
try {
|
|
36456
|
-
stats =
|
|
36631
|
+
stats = fs12.lstatSync(filePath);
|
|
36457
36632
|
} catch {
|
|
36458
36633
|
cache.set(filePath, miss);
|
|
36459
36634
|
return null;
|
|
@@ -36470,7 +36645,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
36470
36645
|
}
|
|
36471
36646
|
let parsedEnabled = null;
|
|
36472
36647
|
try {
|
|
36473
|
-
const raw =
|
|
36648
|
+
const raw = fs12.readFileSync(filePath, "utf8");
|
|
36474
36649
|
const json2 = JSON.parse(raw);
|
|
36475
36650
|
if (json2 && typeof json2 === "object") {
|
|
36476
36651
|
const t2 = json2.telemetry;
|
|
@@ -36488,7 +36663,8 @@ function readPersistedConsent(cwd) {
|
|
|
36488
36663
|
const globalPath = configFilePath("global");
|
|
36489
36664
|
const projectPath = configFilePath("project", { cwd });
|
|
36490
36665
|
const global2 = readConfigOverrideAt(globalPath);
|
|
36491
|
-
const
|
|
36666
|
+
const projectRoot = path17.dirname(path17.dirname(projectPath));
|
|
36667
|
+
const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
|
|
36492
36668
|
if (project === false && global2 === false) {
|
|
36493
36669
|
return { enabled: false, detail: "config.json (project and global)" };
|
|
36494
36670
|
}
|
|
@@ -36627,7 +36803,7 @@ var DRAIN_GRACE_MS = 250;
|
|
|
36627
36803
|
async function raceDrain(client2, timeoutMs) {
|
|
36628
36804
|
await Promise.race([
|
|
36629
36805
|
client2.shutdown(timeoutMs),
|
|
36630
|
-
new Promise((
|
|
36806
|
+
new Promise((resolve14) => setTimeout(resolve14, timeoutMs + DRAIN_GRACE_MS).unref())
|
|
36631
36807
|
]);
|
|
36632
36808
|
}
|
|
36633
36809
|
async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
@@ -36713,6 +36889,9 @@ function booleanLiteral(raw) {
|
|
|
36713
36889
|
return void 0;
|
|
36714
36890
|
}
|
|
36715
36891
|
function coerceScalar(raw, type, field) {
|
|
36892
|
+
if (Array.isArray(type) && type.length === 2 && type.includes("null")) {
|
|
36893
|
+
type = type.find((member) => member === "integer" || member === "number");
|
|
36894
|
+
}
|
|
36716
36895
|
if (type === "number") {
|
|
36717
36896
|
if (raw.trim() === "")
|
|
36718
36897
|
throw new FlagParseException(`--${field} expected a number, got "${raw}"`);
|
|
@@ -36921,7 +37100,7 @@ function renderType(prop) {
|
|
|
36921
37100
|
const suffix = isScalarType(prop.items?.type) ? " (repeatable)" : "";
|
|
36922
37101
|
return `array<${item}>${suffix}`;
|
|
36923
37102
|
}
|
|
36924
|
-
return prop.type ?? "any";
|
|
37103
|
+
return Array.isArray(prop.type) ? prop.type.join(" | ") : prop.type ?? "any";
|
|
36925
37104
|
}
|
|
36926
37105
|
|
|
36927
37106
|
// ../argent-cli/src/run-validation.ts
|
|
@@ -37025,10 +37204,11 @@ function isValidationIssue(value) {
|
|
|
37025
37204
|
}
|
|
37026
37205
|
|
|
37027
37206
|
// ../argent-cli/src/e2e.ts
|
|
37207
|
+
var import_yaml3 = __toESM(require_dist(), 1);
|
|
37028
37208
|
import * as fsp from "node:fs/promises";
|
|
37029
37209
|
import { constants as fsConstants2 } from "node:fs";
|
|
37030
37210
|
import { createHash as createHash5 } from "node:crypto";
|
|
37031
|
-
import * as
|
|
37211
|
+
import * as path18 from "node:path";
|
|
37032
37212
|
|
|
37033
37213
|
// ../argent-cli/src/command-args.ts
|
|
37034
37214
|
var UsageError = class extends Error {
|
|
@@ -37043,7 +37223,7 @@ function listChoices(choices) {
|
|
|
37043
37223
|
return `${quoted.slice(0, -1).join(", ")} or ${quoted[quoted.length - 1]}`;
|
|
37044
37224
|
}
|
|
37045
37225
|
function resolveName(tok, specs) {
|
|
37046
|
-
if (tok.startsWith("--")) return tok.slice(2)
|
|
37226
|
+
if (tok.startsWith("--")) return Object.hasOwn(specs, tok.slice(2)) ? tok.slice(2) : null;
|
|
37047
37227
|
const short = tok.slice(1);
|
|
37048
37228
|
for (const [name, spec] of Object.entries(specs)) {
|
|
37049
37229
|
if (spec.alias === short) return name;
|
|
@@ -37130,7 +37310,8 @@ async function offersMacosPlatform() {
|
|
|
37130
37310
|
}
|
|
37131
37311
|
async function printHelp(toStderr = false) {
|
|
37132
37312
|
const print = toStderr ? console.error : console.log;
|
|
37133
|
-
const
|
|
37313
|
+
const offersMacos = await offersMacosPlatform();
|
|
37314
|
+
const platforms = SELECTABLE_PLATFORMS.filter((p) => p !== "macos" || offersMacos);
|
|
37134
37315
|
print(`Usage: argent e2e <subcommand> [options]
|
|
37135
37316
|
|
|
37136
37317
|
Run a YAML e2e test without an LLM in the loop. \`run\` takes any of these forms:
|
|
@@ -37161,7 +37342,8 @@ warning, and each script step's output), then its outcome. After the last test
|
|
|
37161
37342
|
it lists every failed test with its reason and a command that re-runs that test
|
|
37162
37343
|
alone, then a final summary; --recursive walks subdirectories too
|
|
37163
37344
|
(__baselines__, node_modules and dot-directories other than .argent are
|
|
37164
|
-
skipped). A
|
|
37345
|
+
skipped). A directory run and list skip a YAML file that is not an e2e test.
|
|
37346
|
+
A test that fails its steps keeps the batch running, as does one the
|
|
37165
37347
|
server rejects up front \u2014 an invalid file, or a device it cannot resolve. A
|
|
37166
37348
|
transport failure, a rejection the server does not mark as validation, or a
|
|
37167
37349
|
reply that is not a report stops the batch and counts the remaining tests
|
|
@@ -37201,12 +37383,12 @@ Subcommands:
|
|
|
37201
37383
|
subdirectories), or in .argent/e2e and
|
|
37202
37384
|
.argent/flows (legacy) with notes on stderr.
|
|
37203
37385
|
--json prints { "e2eTests": [...] } instead, with
|
|
37204
|
-
path per entry, plus name,
|
|
37205
|
-
when no dir is given
|
|
37386
|
+
path and an optional warning per entry, plus name,
|
|
37387
|
+
legacy and shadowedBy when no dir is given
|
|
37206
37388
|
|
|
37207
37389
|
Options (run):
|
|
37208
37390
|
--device <id> Device id to run against (auto-detected when omitted)
|
|
37209
|
-
--platform <p>
|
|
37391
|
+
--platform <p> ${platforms.join(" | ")} \u2014 narrow
|
|
37210
37392
|
auto-detection (ios never picks a remote simulator)
|
|
37211
37393
|
--update-baselines Write/refresh screenshot baselines instead of diffing,
|
|
37212
37394
|
also those of tests that tool: e2e-execute steps run,
|
|
@@ -37241,7 +37423,9 @@ var RUN_OPTIONS = {
|
|
|
37241
37423
|
"json-stream": { kind: "boolean" },
|
|
37242
37424
|
"recursive": { kind: "boolean", alias: "r" },
|
|
37243
37425
|
"device": { kind: "value" },
|
|
37244
|
-
|
|
37426
|
+
// The tool-server's schema rejection carries no error_kind, so in a directory
|
|
37427
|
+
// run it would stop the whole batch.
|
|
37428
|
+
"platform": { kind: "value", choices: SELECTABLE_PLATFORMS },
|
|
37245
37429
|
"output": { kind: "value" }
|
|
37246
37430
|
};
|
|
37247
37431
|
var LIST_OPTIONS = {
|
|
@@ -37268,7 +37452,7 @@ function parseRunArgs(argv) {
|
|
|
37268
37452
|
json: options.json === true,
|
|
37269
37453
|
jsonStream: options["json-stream"] === true
|
|
37270
37454
|
};
|
|
37271
|
-
for (const name of ["device", "
|
|
37455
|
+
for (const name of ["device", "output"]) {
|
|
37272
37456
|
if (options[name] === "") throw new FlagParseException(`--${name} requires a value`);
|
|
37273
37457
|
}
|
|
37274
37458
|
if (positionals[0] !== void 0) out.flowRef = positionals[0];
|
|
@@ -37367,15 +37551,19 @@ function renderBatchSummary(counts, durationMs) {
|
|
|
37367
37551
|
return `${verdict} \u2014 ${counts.total} e2e test${counts.total === 1 ? "" : "s"}: ${counts.passed} passed, ${counts.failed} failed, ${counts.skipped} skipped${durationSuffix(durationMs)}`;
|
|
37368
37552
|
}
|
|
37369
37553
|
function summarizeFailure(report) {
|
|
37554
|
+
const unwritten = unwrittenBaselines(report);
|
|
37370
37555
|
let n3 = 0;
|
|
37371
37556
|
for (const s of report.steps) {
|
|
37372
37557
|
if (s.kind === "echo") continue;
|
|
37373
37558
|
n3++;
|
|
37374
37559
|
if (s.status === "fail" || s.status === "error") {
|
|
37375
|
-
const
|
|
37560
|
+
const lines = s.reason ? [String(s.reason)] : [];
|
|
37561
|
+
for (const line of unwritten) lines.push(`baseline not written: ${line}`);
|
|
37562
|
+
const detail = lines.length ? lines.join("\n") : void 0;
|
|
37376
37563
|
return { headline: `step ${n3} ${stepLabel(s, e2eTestOf(report))}`, detail };
|
|
37377
37564
|
}
|
|
37378
37565
|
}
|
|
37566
|
+
if (unwritten.length) return { headline: "baselines not written", detail: unwritten.join("\n") };
|
|
37379
37567
|
return { headline: "failed with no failing step" };
|
|
37380
37568
|
}
|
|
37381
37569
|
function renderFailedFlow(f) {
|
|
@@ -37403,17 +37591,17 @@ function shellQuoteArg(arg) {
|
|
|
37403
37591
|
return `'${arg.replaceAll("'", "'\\''")}'`;
|
|
37404
37592
|
}
|
|
37405
37593
|
function optionSafePath(p) {
|
|
37406
|
-
return p.startsWith("-") ? `.${
|
|
37594
|
+
return p.startsWith("-") ? `.${path18.sep}${p}` : p;
|
|
37407
37595
|
}
|
|
37408
37596
|
function rerunCommand(flowPath, rel, projectRoot, args) {
|
|
37409
37597
|
const pathArg = (p) => shellQuoteArg(optionSafePath(p));
|
|
37410
|
-
const fromCwd =
|
|
37411
|
-
const shown =
|
|
37598
|
+
const fromCwd = path18.relative(projectRoot, flowPath);
|
|
37599
|
+
const shown = path18.isAbsolute(fromCwd) || fromCwd.split(/[\\/]+/).includes("..") ? flowPath : fromCwd;
|
|
37412
37600
|
const parts = ["argent e2e run", pathArg(shown)];
|
|
37413
37601
|
if (args.device) parts.push("--device", shellQuoteArg(args.device));
|
|
37414
37602
|
if (args.platform) parts.push("--platform", shellQuoteArg(args.platform));
|
|
37415
37603
|
if (args.updateBaselines) parts.push("--update-baselines");
|
|
37416
|
-
if (args.output) parts.push("--output", pathArg(
|
|
37604
|
+
if (args.output) parts.push("--output", pathArg(path18.join(args.output, path18.dirname(rel))));
|
|
37417
37605
|
return parts.join(" ");
|
|
37418
37606
|
}
|
|
37419
37607
|
var EXPORT_SOURCE_MARKER = ".argent-e2e-source";
|
|
@@ -37421,8 +37609,8 @@ var LEGACY_EXPORT_SOURCE_MARKER = ".argent-flow-source";
|
|
|
37421
37609
|
var MARKER_READ_RETRIES = 4;
|
|
37422
37610
|
var MARKER_READ_DELAY_MS = 5;
|
|
37423
37611
|
async function readExportMarker(dir) {
|
|
37424
|
-
const owner = await readMarkerFile(
|
|
37425
|
-
return owner !== void 0 ? owner : await readMarkerFile(
|
|
37612
|
+
const owner = await readMarkerFile(path18.join(dir, EXPORT_SOURCE_MARKER));
|
|
37613
|
+
return owner !== void 0 ? owner : await readMarkerFile(path18.join(dir, LEGACY_EXPORT_SOURCE_MARKER));
|
|
37426
37614
|
}
|
|
37427
37615
|
async function readMarkerFile(marker) {
|
|
37428
37616
|
for (let attempt = 0; ; attempt++) {
|
|
@@ -37434,7 +37622,7 @@ async function readMarkerFile(marker) {
|
|
|
37434
37622
|
}
|
|
37435
37623
|
if (owner) return owner;
|
|
37436
37624
|
if (attempt === MARKER_READ_RETRIES) return null;
|
|
37437
|
-
await new Promise((
|
|
37625
|
+
await new Promise((resolve14) => setTimeout(resolve14, MARKER_READ_DELAY_MS));
|
|
37438
37626
|
}
|
|
37439
37627
|
}
|
|
37440
37628
|
async function classifyExportDir(dir, flowPath) {
|
|
@@ -37459,7 +37647,7 @@ function occupiedBy(owner) {
|
|
|
37459
37647
|
async function takeExportDir(dir, flowPath) {
|
|
37460
37648
|
try {
|
|
37461
37649
|
await fsp.mkdir(dir, { recursive: true });
|
|
37462
|
-
await fsp.writeFile(
|
|
37650
|
+
await fsp.writeFile(path18.join(dir, EXPORT_SOURCE_MARKER), `${flowPath}
|
|
37463
37651
|
`, { flag: "wx" });
|
|
37464
37652
|
return null;
|
|
37465
37653
|
} catch (err) {
|
|
@@ -37478,7 +37666,7 @@ async function claimExportDirName(outputDir, flowPath, stem) {
|
|
|
37478
37666
|
}
|
|
37479
37667
|
const avoided = [];
|
|
37480
37668
|
for (const name of candidates) {
|
|
37481
|
-
const dir =
|
|
37669
|
+
const dir = path18.join(outputDir, name);
|
|
37482
37670
|
const claim2 = await classifyExportDir(dir, flowPath);
|
|
37483
37671
|
const reason = claim2.state === "foreign" ? occupiedBy(claim2.owner) : await takeExportDir(dir, flowPath);
|
|
37484
37672
|
if (reason !== null) {
|
|
@@ -37498,7 +37686,7 @@ async function claimExportDirName(outputDir, flowPath, stem) {
|
|
|
37498
37686
|
return null;
|
|
37499
37687
|
}
|
|
37500
37688
|
async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
37501
|
-
const stem =
|
|
37689
|
+
const stem = path18.basename(flowPath, ".yaml");
|
|
37502
37690
|
if (!SAFE_ARTIFACT_NAME.test(stem)) {
|
|
37503
37691
|
console.error(
|
|
37504
37692
|
`warning: skipping artifact export for unsafe e2e test filename ${JSON.stringify(stem)}`
|
|
@@ -37531,11 +37719,11 @@ async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
|
37531
37719
|
if (dir === null) {
|
|
37532
37720
|
const dirName = await claimExportDirName(outputDir, flowPath, stem);
|
|
37533
37721
|
if (dirName === null) return;
|
|
37534
|
-
dir =
|
|
37722
|
+
dir = path18.join(outputDir, dirName);
|
|
37535
37723
|
}
|
|
37536
|
-
const dest =
|
|
37537
|
-
const rel =
|
|
37538
|
-
if (rel.startsWith("..") ||
|
|
37724
|
+
const dest = path18.join(dir, fileName(role));
|
|
37725
|
+
const rel = path18.relative(outputDir, dest);
|
|
37726
|
+
if (rel.startsWith("..") || path18.isAbsolute(rel)) continue;
|
|
37539
37727
|
try {
|
|
37540
37728
|
await fsp.copyFile(value, dest);
|
|
37541
37729
|
s.artifacts[role] = dest;
|
|
@@ -37550,7 +37738,7 @@ async function exportFailureArtifacts(report, outputDir, flowPath, ctx) {
|
|
|
37550
37738
|
function keyFromBaselinePath(artifacts) {
|
|
37551
37739
|
const baseline = artifacts.baseline;
|
|
37552
37740
|
if (typeof baseline !== "string") return null;
|
|
37553
|
-
return
|
|
37741
|
+
return path18.basename(baseline).replace(/\.png$/, "");
|
|
37554
37742
|
}
|
|
37555
37743
|
function resolveArtifactDisplayPaths(report) {
|
|
37556
37744
|
for (const s of report.steps) {
|
|
@@ -37562,7 +37750,7 @@ function resolveArtifactDisplayPaths(report) {
|
|
|
37562
37750
|
}
|
|
37563
37751
|
function exitAfterFlush(code, streams = [process.stdout, process.stderr]) {
|
|
37564
37752
|
return Promise.all(
|
|
37565
|
-
streams.map((s) => new Promise((
|
|
37753
|
+
streams.map((s) => new Promise((resolve14) => s.write("", () => resolve14())))
|
|
37566
37754
|
).then(() => process.exit(code));
|
|
37567
37755
|
}
|
|
37568
37756
|
function renderReport(report) {
|
|
@@ -37603,30 +37791,53 @@ async function isRunnableFlowFile(filePath) {
|
|
|
37603
37791
|
return false;
|
|
37604
37792
|
}
|
|
37605
37793
|
}
|
|
37794
|
+
var E2E_FILE_WARNING_TEXT = {
|
|
37795
|
+
"syntax-error": "has a YAML syntax error",
|
|
37796
|
+
"empty": "is empty"
|
|
37797
|
+
};
|
|
37798
|
+
async function checkE2eTestShape(filePath) {
|
|
37799
|
+
let content;
|
|
37800
|
+
try {
|
|
37801
|
+
content = (await fsp.readFile(filePath, "utf8")).trim();
|
|
37802
|
+
} catch {
|
|
37803
|
+
return "ok";
|
|
37804
|
+
}
|
|
37805
|
+
if (content.length === 0) return "empty";
|
|
37806
|
+
if (!content.includes("steps") && !/^version:/m.test(content)) return "skip";
|
|
37807
|
+
let parsed;
|
|
37808
|
+
try {
|
|
37809
|
+
parsed = (0, import_yaml3.parse)(content, { logLevel: "error" });
|
|
37810
|
+
} catch {
|
|
37811
|
+
return "syntax-error";
|
|
37812
|
+
}
|
|
37813
|
+
if (typeof parsed !== "object" || parsed === null) return "skip";
|
|
37814
|
+
const { version: version2 } = parsed;
|
|
37815
|
+
return Number.isInteger(version2) && Number(version2) > 1 || "steps" in parsed ? "ok" : "skip";
|
|
37816
|
+
}
|
|
37606
37817
|
async function resolveFlowRef(ref, projectRoot) {
|
|
37607
37818
|
if (!SAFE_FLOW_NAME.test(ref)) return { suppliedPath: ref, fromName: false };
|
|
37608
37819
|
const picked = await resolveE2eFile(projectRoot, ref);
|
|
37609
37820
|
return {
|
|
37610
|
-
suppliedPath:
|
|
37821
|
+
suppliedPath: path18.relative(projectRoot, picked.path),
|
|
37611
37822
|
fromName: true,
|
|
37612
|
-
...picked.shadowed === void 0 ? {} : { shadowed:
|
|
37823
|
+
...picked.shadowed === void 0 ? {} : { shadowed: path18.relative(projectRoot, picked.shadowed) }
|
|
37613
37824
|
};
|
|
37614
37825
|
}
|
|
37615
37826
|
async function savedFlowHint(projectRoot, missingPath) {
|
|
37616
|
-
const dirs = E2E_DIRS.map((rel) => ({ rel, abs:
|
|
37827
|
+
const dirs = E2E_DIRS.map((rel) => ({ rel, abs: path18.resolve(projectRoot, rel) }));
|
|
37617
37828
|
for (const { abs } of dirs) {
|
|
37618
|
-
const within =
|
|
37619
|
-
if (!within.startsWith("..") && !
|
|
37829
|
+
const within = path18.relative(abs, missingPath);
|
|
37830
|
+
if (!within.startsWith("..") && !path18.isAbsolute(within)) return "";
|
|
37620
37831
|
}
|
|
37621
|
-
const wanted = `${
|
|
37832
|
+
const wanted = `${path18.basename(missingPath, ".yaml")}.yaml`;
|
|
37622
37833
|
for (const { rel, abs } of dirs) {
|
|
37623
37834
|
const entries = await fsp.readdir(abs).catch(() => null);
|
|
37624
37835
|
if (entries === null) continue;
|
|
37625
37836
|
const actual = entries.includes(wanted) ? wanted : entries.find((name2) => name2.toLowerCase() === wanted.toLowerCase());
|
|
37626
37837
|
if (actual === void 0) continue;
|
|
37627
|
-
const name =
|
|
37838
|
+
const name = path18.basename(actual, ".yaml");
|
|
37628
37839
|
if (!SAFE_FLOW_NAME.test(name)) return "";
|
|
37629
|
-
if (!await isRunnableFlowFile(
|
|
37840
|
+
if (!await isRunnableFlowFile(path18.join(abs, actual))) return "";
|
|
37630
37841
|
return `
|
|
37631
37842
|
An e2e test named "${name}" is saved under ${rel} \u2014 did you mean: argent e2e run ${name}`;
|
|
37632
37843
|
}
|
|
@@ -37636,21 +37847,25 @@ async function collectFlowFiles(dir, recursive2) {
|
|
|
37636
37847
|
const found = [];
|
|
37637
37848
|
const walk = async (current, rel) => {
|
|
37638
37849
|
for (const entry of await fsp.readdir(current, { withFileTypes: true })) {
|
|
37639
|
-
const entryRel = rel ?
|
|
37850
|
+
const entryRel = rel ? path18.join(rel, entry.name) : entry.name;
|
|
37640
37851
|
if (entry.isDirectory()) {
|
|
37641
37852
|
if (recursive2 && entry.name !== "__baselines__" && entry.name !== "node_modules" && (entry.name === ".argent" || !entry.name.startsWith("."))) {
|
|
37642
|
-
await walk(
|
|
37853
|
+
await walk(path18.join(current, entry.name), entryRel).catch(() => {
|
|
37643
37854
|
});
|
|
37644
37855
|
}
|
|
37645
37856
|
continue;
|
|
37646
37857
|
}
|
|
37647
37858
|
if (!entry.name.endsWith(".yaml")) continue;
|
|
37648
|
-
if (!SAFE_FLOW_NAME.test(
|
|
37649
|
-
|
|
37859
|
+
if (!SAFE_FLOW_NAME.test(path18.basename(entry.name, ".yaml"))) continue;
|
|
37860
|
+
const filePath = path18.join(current, entry.name);
|
|
37861
|
+
if (!await isRunnableFlowFile(filePath)) continue;
|
|
37862
|
+
const shape = await checkE2eTestShape(filePath);
|
|
37863
|
+
if (shape === "skip") continue;
|
|
37864
|
+
found.push({ path: entryRel, ...shape !== "ok" && { warning: shape } });
|
|
37650
37865
|
}
|
|
37651
37866
|
};
|
|
37652
37867
|
await walk(dir, "");
|
|
37653
|
-
return found.sort();
|
|
37868
|
+
return found.sort((a2, b) => a2.path < b.path ? -1 : a2.path > b.path ? 1 : 0);
|
|
37654
37869
|
}
|
|
37655
37870
|
var RUN_TOOL_ID = "e2e-execute";
|
|
37656
37871
|
function buildRunPayload(flowPath, projectRoot, args) {
|
|
@@ -37783,7 +37998,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
37783
37998
|
};
|
|
37784
37999
|
let flows;
|
|
37785
38000
|
try {
|
|
37786
|
-
flows = await collectFlowFiles(dir, args.recursive);
|
|
38001
|
+
flows = (await collectFlowFiles(dir, args.recursive)).map((file2) => file2.path);
|
|
37787
38002
|
} catch {
|
|
37788
38003
|
return reject(`Could not read e2e test directory: ${dir}`);
|
|
37789
38004
|
}
|
|
@@ -37793,7 +38008,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
37793
38008
|
);
|
|
37794
38009
|
}
|
|
37795
38010
|
const { callTool, baseUrl } = runToolsClient(args, options);
|
|
37796
|
-
const outputBase = args.output ?
|
|
38011
|
+
const outputBase = args.output ? path18.resolve(args.output) : void 0;
|
|
37797
38012
|
const results = [];
|
|
37798
38013
|
const failures = [];
|
|
37799
38014
|
const batchStartedAt = Date.now();
|
|
@@ -37806,7 +38021,7 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
37806
38021
|
if (!args.json) console.log(` ${STATUS_GLYPH.skip} not run (batch stopped)`);
|
|
37807
38022
|
continue;
|
|
37808
38023
|
}
|
|
37809
|
-
const flowPath =
|
|
38024
|
+
const flowPath = path18.join(dir, rel);
|
|
37810
38025
|
const rerun = rerunCommand(flowPath, rel, projectRoot, args);
|
|
37811
38026
|
let report;
|
|
37812
38027
|
try {
|
|
@@ -37848,21 +38063,12 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
|
|
|
37848
38063
|
printWarnings(nestedStepWarnings(report.steps), args.json);
|
|
37849
38064
|
await exportAndResolveArtifacts(
|
|
37850
38065
|
report,
|
|
37851
|
-
outputBase ?
|
|
38066
|
+
outputBase ? path18.join(outputBase, path18.dirname(rel)) : void 0,
|
|
37852
38067
|
flowPath,
|
|
37853
38068
|
baseUrl
|
|
37854
38069
|
);
|
|
37855
|
-
|
|
37856
|
-
results.push({ path: rel, status: report.ok && !unwritten.length ? "pass" : "fail", report });
|
|
38070
|
+
results.push({ path: rel, status: report.ok ? "pass" : "fail", report });
|
|
37857
38071
|
if (!report.ok) failures.push({ path: rel, ...summarizeFailure(report), rerun });
|
|
37858
|
-
else if (unwritten.length) {
|
|
37859
|
-
failures.push({
|
|
37860
|
-
path: rel,
|
|
37861
|
-
headline: "baselines not written",
|
|
37862
|
-
detail: unwritten.join("\n"),
|
|
37863
|
-
rerun
|
|
37864
|
-
});
|
|
37865
|
-
}
|
|
37866
38072
|
if (!args.json) {
|
|
37867
38073
|
for (const line of renderFailedSteps(report)) console.log(line);
|
|
37868
38074
|
console.log(` ${renderSummary(report, { withDevice: true })}`);
|
|
@@ -37951,9 +38157,9 @@ Pass the fully resolved path to the directory.`
|
|
|
37951
38157
|
let anyDir = false;
|
|
37952
38158
|
const dirs = listDir === void 0 ? E2E_DIRS : [listDir];
|
|
37953
38159
|
for (const dir of dirs) {
|
|
37954
|
-
let
|
|
38160
|
+
let files;
|
|
37955
38161
|
try {
|
|
37956
|
-
|
|
38162
|
+
files = await collectFlowFiles(path18.resolve(dir), listDir === void 0 || recursive2);
|
|
37957
38163
|
} catch (err) {
|
|
37958
38164
|
const code = err.code;
|
|
37959
38165
|
if (listDir === void 0 && (code === "ENOENT" || code === "ENOTDIR")) continue;
|
|
@@ -37962,20 +38168,22 @@ Pass the fully resolved path to the directory.`
|
|
|
37962
38168
|
);
|
|
37963
38169
|
}
|
|
37964
38170
|
anyDir = true;
|
|
37965
|
-
for (const rel of
|
|
37966
|
-
const shown =
|
|
38171
|
+
for (const { path: rel, warning } of files) {
|
|
38172
|
+
const shown = path18.join(dir, rel);
|
|
38173
|
+
const warningField = warning !== void 0 && { warning };
|
|
37967
38174
|
if (listDir !== void 0) {
|
|
37968
|
-
entries.push({ path: optionSafePath(shown) });
|
|
38175
|
+
entries.push({ path: optionSafePath(shown), ...warningField });
|
|
37969
38176
|
continue;
|
|
37970
38177
|
}
|
|
37971
|
-
const name =
|
|
38178
|
+
const name = path18.dirname(rel) === "." ? path18.basename(rel, ".yaml") : void 0;
|
|
37972
38179
|
const shadowedBy = name === void 0 ? void 0 : byName.get(name);
|
|
37973
38180
|
if (name !== void 0 && shadowedBy === void 0) byName.set(name, shown);
|
|
37974
38181
|
entries.push({
|
|
37975
38182
|
path: shown,
|
|
37976
38183
|
...name !== void 0 && { name },
|
|
37977
38184
|
legacy: dir !== E2E_DIR,
|
|
37978
|
-
...shadowedBy !== void 0 && { shadowedBy }
|
|
38185
|
+
...shadowedBy !== void 0 && { shadowedBy },
|
|
38186
|
+
...warningField
|
|
37979
38187
|
});
|
|
37980
38188
|
}
|
|
37981
38189
|
}
|
|
@@ -37999,6 +38207,8 @@ Pass the fully resolved path to the directory.`
|
|
|
37999
38207
|
console.error(
|
|
38000
38208
|
`warning: ${entry.path} is shadowed by ${entry.shadowedBy} when run by name`
|
|
38001
38209
|
);
|
|
38210
|
+
if (entry.warning !== void 0)
|
|
38211
|
+
console.error(`warning: ${entry.path} ${E2E_FILE_WARNING_TEXT[entry.warning]}`);
|
|
38002
38212
|
}
|
|
38003
38213
|
const legacyCount = entries.filter((entry) => entry.legacy).length;
|
|
38004
38214
|
if (legacyCount > 0) {
|
|
@@ -38055,10 +38265,10 @@ Pass the fully resolved path to the directory.`
|
|
|
38055
38265
|
}
|
|
38056
38266
|
if (suppliedPath.split(/[\\/]+/).includes("..")) {
|
|
38057
38267
|
let recovery = "Pass the fully resolved path to the e2e test's YAML.";
|
|
38058
|
-
const suppliedBase2 =
|
|
38268
|
+
const suppliedBase2 = path18.basename(suppliedPath);
|
|
38059
38269
|
if (suppliedBase2 !== ".." && suppliedBase2 !== ".") {
|
|
38060
38270
|
try {
|
|
38061
|
-
const resolved =
|
|
38271
|
+
const resolved = path18.join(await fsp.realpath(path18.dirname(suppliedPath)), suppliedBase2);
|
|
38062
38272
|
await fsp.stat(resolved);
|
|
38063
38273
|
recovery = `Did you mean: argent e2e run ${shellQuoteArg(resolved)}`;
|
|
38064
38274
|
} catch {
|
|
@@ -38070,7 +38280,7 @@ Pass the fully resolved path to the directory.`
|
|
|
38070
38280
|
2
|
|
38071
38281
|
);
|
|
38072
38282
|
}
|
|
38073
|
-
const resolvedPath =
|
|
38283
|
+
const resolvedPath = path18.resolve(projectRoot, suppliedPath);
|
|
38074
38284
|
let isDirectory = false;
|
|
38075
38285
|
try {
|
|
38076
38286
|
isDirectory = (await fsp.stat(resolvedPath)).isDirectory();
|
|
@@ -38093,16 +38303,16 @@ Pass the fully resolved path to the directory.`
|
|
|
38093
38303
|
}
|
|
38094
38304
|
const separatorTrimmedPath = suppliedPath.replace(/[\\/]+$/, "");
|
|
38095
38305
|
if (separatorTrimmedPath !== suppliedPath && separatorTrimmedPath !== "") {
|
|
38096
|
-
const hint = SAFE_FLOW_NAME.test(separatorTrimmedPath) ? `.${
|
|
38306
|
+
const hint = SAFE_FLOW_NAME.test(separatorTrimmedPath) ? `.${path18.sep}${separatorTrimmedPath}` : separatorTrimmedPath;
|
|
38097
38307
|
return fail(
|
|
38098
38308
|
`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
38309
|
Did you mean: argent e2e run ${shellQuoteArg(hint)}`,
|
|
38100
38310
|
2
|
|
38101
38311
|
);
|
|
38102
38312
|
}
|
|
38103
|
-
if (
|
|
38104
|
-
const looksLikeName = !suppliedPath.includes("/") && !suppliedPath.includes("\\") &&
|
|
38105
|
-
if (
|
|
38313
|
+
if (path18.extname(suppliedPath) !== ".yaml") {
|
|
38314
|
+
const looksLikeName = !suppliedPath.includes("/") && !suppliedPath.includes("\\") && path18.extname(suppliedPath) === "";
|
|
38315
|
+
if (path18.basename(suppliedPath).toLowerCase() === ".yaml") {
|
|
38106
38316
|
return fail(
|
|
38107
38317
|
`E2E test filename must have a non-empty name containing only letters, numbers, "_", or "-": ${suppliedPath}`,
|
|
38108
38318
|
2
|
|
@@ -38115,15 +38325,15 @@ Names run \`${E2E_DIRS.map((dir) => `${dir}/<name>.yaml`).join("` or `")}\`; pas
|
|
|
38115
38325
|
2
|
|
38116
38326
|
);
|
|
38117
38327
|
}
|
|
38118
|
-
if (
|
|
38328
|
+
if (path18.extname(suppliedPath).toLowerCase() === ".yaml") {
|
|
38119
38329
|
return fail(
|
|
38120
|
-
`E2E test extension must be lowercase .yaml, not ${
|
|
38330
|
+
`E2E test extension must be lowercase .yaml, not ${path18.extname(suppliedPath)}: ${suppliedPath}`,
|
|
38121
38331
|
2
|
|
38122
38332
|
);
|
|
38123
38333
|
}
|
|
38124
38334
|
return fail(`E2E test path must end in .yaml: ${suppliedPath}`, 2);
|
|
38125
38335
|
}
|
|
38126
|
-
const flowName =
|
|
38336
|
+
const flowName = path18.basename(suppliedPath, ".yaml");
|
|
38127
38337
|
if (!SAFE_FLOW_NAME.test(flowName)) {
|
|
38128
38338
|
return fail(
|
|
38129
38339
|
`E2E test filename must have a non-empty name containing only letters, numbers, "_", or "-": ${suppliedPath}`,
|
|
@@ -38147,12 +38357,12 @@ No e2e test named "${args.flowRef}" is saved in ${E2E_DIRS.join(" or ")} \u2014
|
|
|
38147
38357
|
}
|
|
38148
38358
|
return fail(`${detail}: ${flowPath}${recovery}`, 2);
|
|
38149
38359
|
}
|
|
38150
|
-
const suppliedBase =
|
|
38151
|
-
const siblings = await fsp.readdir(
|
|
38360
|
+
const suppliedBase = path18.basename(flowPath);
|
|
38361
|
+
const siblings = await fsp.readdir(path18.dirname(flowPath)).catch(() => null);
|
|
38152
38362
|
if (siblings !== null && !siblings.includes(suppliedBase)) {
|
|
38153
38363
|
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 ${
|
|
38364
|
+
const actualRunnable = actual !== void 0 && path18.extname(actual) === ".yaml" && SAFE_FLOW_NAME.test(path18.basename(actual, ".yaml"));
|
|
38365
|
+
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
38366
|
return fail(
|
|
38157
38367
|
`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
38368
|
${recovery}`,
|
|
@@ -38211,7 +38421,7 @@ ${recovery}`,
|
|
|
38211
38421
|
try {
|
|
38212
38422
|
await exportAndResolveArtifacts(
|
|
38213
38423
|
report,
|
|
38214
|
-
args.output ?
|
|
38424
|
+
args.output ? path18.resolve(args.output) : void 0,
|
|
38215
38425
|
flowPath,
|
|
38216
38426
|
baseUrl
|
|
38217
38427
|
);
|
|
@@ -38232,12 +38442,7 @@ ${renderSummary(report, { withDevice: true })}`);
|
|
|
38232
38442
|
} else {
|
|
38233
38443
|
console.log(renderReport(report));
|
|
38234
38444
|
}
|
|
38235
|
-
|
|
38236
|
-
if (!args.json && !args.jsonStream) {
|
|
38237
|
-
for (const line of unwritten)
|
|
38238
|
-
console.log(` ${STATUS_GLYPH.error} baseline not written: ${line}`);
|
|
38239
|
-
}
|
|
38240
|
-
return exitAfterFlush(report.ok && unwritten.length === 0 ? 0 : 1);
|
|
38445
|
+
return exitAfterFlush(report.ok ? 0 : 1);
|
|
38241
38446
|
}
|
|
38242
38447
|
|
|
38243
38448
|
// ../argent-cli/src/run.ts
|
|
@@ -38267,13 +38472,13 @@ function splitOptions(argv) {
|
|
|
38267
38472
|
return { json: json2, outPath, argvForFlags: rest };
|
|
38268
38473
|
}
|
|
38269
38474
|
async function readStdin() {
|
|
38270
|
-
return new Promise((
|
|
38475
|
+
return new Promise((resolve14, reject) => {
|
|
38271
38476
|
let data = "";
|
|
38272
38477
|
process.stdin.setEncoding("utf8");
|
|
38273
38478
|
process.stdin.on("data", (chunk) => {
|
|
38274
38479
|
data += chunk;
|
|
38275
38480
|
});
|
|
38276
|
-
process.stdin.on("end", () =>
|
|
38481
|
+
process.stdin.on("end", () => resolve14(data));
|
|
38277
38482
|
process.stdin.on("error", reject);
|
|
38278
38483
|
});
|
|
38279
38484
|
}
|
|
@@ -38305,8 +38510,8 @@ async function fetchImageToFile(result, outPath) {
|
|
|
38305
38510
|
const res = await fetch(url2);
|
|
38306
38511
|
if (!res.ok) throw new Error(`Failed to download image: ${res.status} ${res.statusText}`);
|
|
38307
38512
|
const buf = Buffer.from(await res.arrayBuffer());
|
|
38308
|
-
|
|
38309
|
-
|
|
38513
|
+
fs13.mkdirSync(path19.dirname(path19.resolve(outPath)), { recursive: true });
|
|
38514
|
+
fs13.writeFileSync(outPath, buf);
|
|
38310
38515
|
}
|
|
38311
38516
|
function renderResult(result, outputHint, images, json2) {
|
|
38312
38517
|
if (json2) return JSON.stringify(result, null, 2);
|
|
@@ -38513,8 +38718,8 @@ settled=false or debugger-status's not_connected.
|
|
|
38513
38718
|
if (outPath && meta3.outputHint === "image") {
|
|
38514
38719
|
try {
|
|
38515
38720
|
if (images.length > 0) {
|
|
38516
|
-
|
|
38517
|
-
|
|
38721
|
+
fs13.mkdirSync(path19.dirname(path19.resolve(outPath)), { recursive: true });
|
|
38722
|
+
fs13.writeFileSync(outPath, images[0].data);
|
|
38518
38723
|
} else if (result && typeof result === "object") {
|
|
38519
38724
|
await fetchImageToFile(result, outPath);
|
|
38520
38725
|
}
|
|
@@ -38535,7 +38740,7 @@ settled=false or debugger-status's not_connected.
|
|
|
38535
38740
|
console.log(`Wrote: ${outPath}`);
|
|
38536
38741
|
}
|
|
38537
38742
|
if (failure2) {
|
|
38538
|
-
await new Promise((
|
|
38743
|
+
await new Promise((resolve14) => process.stdout.write("", () => resolve14()));
|
|
38539
38744
|
console.error(failure2);
|
|
38540
38745
|
await trackRunFailure(toolName, startedAt, {
|
|
38541
38746
|
error_code: FAILURE_CODES.CLI_RUN_TOOL_RESULT_FAILED,
|
|
@@ -38554,6 +38759,7 @@ function summarize(description, max = 80) {
|
|
|
38554
38759
|
if (firstLine.length <= max) return firstLine;
|
|
38555
38760
|
return firstLine.slice(0, max - 1).trimEnd() + "\u2026";
|
|
38556
38761
|
}
|
|
38762
|
+
var TOOLS_OPTIONS = { json: { kind: "boolean" } };
|
|
38557
38763
|
async function tools(argv, options) {
|
|
38558
38764
|
const { fetchTool, fetchTools } = createToolsClient({ paths: options.paths });
|
|
38559
38765
|
async function listTools(json3) {
|
|
@@ -38575,10 +38781,10 @@ async function tools(argv, options) {
|
|
|
38575
38781
|
console.log(`
|
|
38576
38782
|
${sorted.length} tools. Run \`argent tools describe <name>\` for details.`);
|
|
38577
38783
|
}
|
|
38578
|
-
async function describeTool(
|
|
38579
|
-
const meta3 = await fetchTool(
|
|
38784
|
+
async function describeTool(name2, json3) {
|
|
38785
|
+
const meta3 = await fetchTool(name2);
|
|
38580
38786
|
if (!meta3) {
|
|
38581
|
-
console.error(`Tool "${
|
|
38787
|
+
console.error(`Tool "${name2}" not found. Run \`argent tools\` to list available tools.`);
|
|
38582
38788
|
process.exit(1);
|
|
38583
38789
|
}
|
|
38584
38790
|
if (json3) {
|
|
@@ -38606,38 +38812,51 @@ Options:
|
|
|
38606
38812
|
Listing tools contacts the argent tool-server, starting one if none is running.
|
|
38607
38813
|
`);
|
|
38608
38814
|
}
|
|
38609
|
-
const json2 = argv.includes("--json");
|
|
38610
38815
|
const isHelpFlag = (a2) => a2 === "--help" || a2 === "-h";
|
|
38611
|
-
|
|
38612
|
-
|
|
38613
|
-
|
|
38816
|
+
if (argv.some(isHelpFlag)) {
|
|
38817
|
+
const [first, second] = argv.filter((a2) => !a2.startsWith("-") || isHelpFlag(a2));
|
|
38818
|
+
if (first === "describe" && second !== void 0 && !isHelpFlag(second)) {
|
|
38819
|
+
await describeTool(second, argv.includes("--json"));
|
|
38820
|
+
return;
|
|
38821
|
+
}
|
|
38614
38822
|
printUsage4();
|
|
38615
38823
|
return;
|
|
38616
38824
|
}
|
|
38825
|
+
const usageError = (message) => {
|
|
38826
|
+
console.error(`Error: ${message}
|
|
38827
|
+
`);
|
|
38828
|
+
printUsage4();
|
|
38829
|
+
process.exit(2);
|
|
38830
|
+
};
|
|
38831
|
+
let parsed;
|
|
38832
|
+
try {
|
|
38833
|
+
parsed = parseCommandArgs(argv, TOOLS_OPTIONS);
|
|
38834
|
+
} catch (err) {
|
|
38835
|
+
if (!(err instanceof UsageError)) throw err;
|
|
38836
|
+
return usageError(err.message);
|
|
38837
|
+
}
|
|
38838
|
+
const [sub, name, extra] = parsed.positionals;
|
|
38839
|
+
const json2 = parsed.options.json === true;
|
|
38617
38840
|
if (!sub) {
|
|
38618
38841
|
await listTools(json2);
|
|
38619
38842
|
return;
|
|
38620
38843
|
}
|
|
38621
38844
|
if (sub === "describe") {
|
|
38622
|
-
|
|
38623
|
-
if (
|
|
38624
|
-
console.error("Usage: argent tools describe <tool-name>");
|
|
38625
|
-
process.exit(1);
|
|
38626
|
-
}
|
|
38845
|
+
if (!name) return usageError("`argent tools describe` requires a <tool-name>");
|
|
38846
|
+
if (extra !== void 0) usageError(`Unexpected argument "${extra}"`);
|
|
38627
38847
|
await describeTool(name, json2);
|
|
38628
38848
|
return;
|
|
38629
38849
|
}
|
|
38630
|
-
|
|
38631
|
-
process.exit(1);
|
|
38850
|
+
usageError(`Unknown subcommand: tools ${sub}`);
|
|
38632
38851
|
}
|
|
38633
38852
|
|
|
38634
38853
|
// ../argent-cli/src/server.ts
|
|
38635
|
-
import * as
|
|
38636
|
-
import * as
|
|
38854
|
+
import * as fs14 from "node:fs";
|
|
38855
|
+
import * as path20 from "node:path";
|
|
38637
38856
|
import { constants as constants2, homedir as homedir5, networkInterfaces } from "node:os";
|
|
38638
38857
|
import { spawn as spawn4 } from "node:child_process";
|
|
38639
|
-
var STATE_DIR2 =
|
|
38640
|
-
var LOG_FILE2 =
|
|
38858
|
+
var STATE_DIR2 = path20.join(homedir5(), ".argent");
|
|
38859
|
+
var LOG_FILE2 = path20.join(STATE_DIR2, "tool-server.log");
|
|
38641
38860
|
async function describeForeignServers(ownBundlePath) {
|
|
38642
38861
|
const others = (await readAllToolsServerStates()).filter(
|
|
38643
38862
|
({ state: state2 }) => state2.bundlePath !== ownBundlePath && isToolsServerProcessAlive(state2.pid)
|
|
@@ -38701,19 +38920,39 @@ Stop one with: kill <pid>`);
|
|
|
38701
38920
|
}
|
|
38702
38921
|
}
|
|
38703
38922
|
function logsCmd(follow) {
|
|
38704
|
-
if (!
|
|
38923
|
+
if (!fs14.existsSync(LOG_FILE2)) {
|
|
38705
38924
|
console.log(`No log file at ${LOG_FILE2}`);
|
|
38706
38925
|
return;
|
|
38707
38926
|
}
|
|
38708
38927
|
if (!follow) {
|
|
38709
|
-
process.stdout.write(
|
|
38928
|
+
process.stdout.write(fs14.readFileSync(LOG_FILE2, "utf8"));
|
|
38710
38929
|
return;
|
|
38711
38930
|
}
|
|
38712
|
-
const
|
|
38931
|
+
const cannotFollow = (err) => {
|
|
38932
|
+
console.error(
|
|
38933
|
+
`argent server logs: cannot run \`tail\` to follow the log (${err.message}). Run \`argent server logs\` without -f to print it.`
|
|
38934
|
+
);
|
|
38935
|
+
process.exit(1);
|
|
38936
|
+
};
|
|
38937
|
+
let child;
|
|
38938
|
+
try {
|
|
38939
|
+
child = spawn4("tail", ["-f", LOG_FILE2], { stdio: "inherit" });
|
|
38940
|
+
} catch (err) {
|
|
38941
|
+
return cannotFollow(err);
|
|
38942
|
+
}
|
|
38943
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
38944
|
+
process.on(signal, () => {
|
|
38945
|
+
try {
|
|
38946
|
+
child.kill(signal);
|
|
38947
|
+
} catch {
|
|
38948
|
+
}
|
|
38949
|
+
});
|
|
38950
|
+
}
|
|
38713
38951
|
child.on(
|
|
38714
38952
|
"exit",
|
|
38715
38953
|
(code, signal) => process.exit(code ?? (signal ? 128 + (signalNumber(signal) ?? 0) : 0))
|
|
38716
38954
|
);
|
|
38955
|
+
child.on("error", cannotFollow);
|
|
38717
38956
|
}
|
|
38718
38957
|
var StartFlagError = class extends Error {
|
|
38719
38958
|
};
|
|
@@ -38726,9 +38965,9 @@ var START_OPTIONS = {
|
|
|
38726
38965
|
"host": { kind: "value" },
|
|
38727
38966
|
"idle-timeout": { kind: "value" }
|
|
38728
38967
|
};
|
|
38729
|
-
function parseOrStartFlagError(
|
|
38968
|
+
function parseOrStartFlagError(parse4) {
|
|
38730
38969
|
try {
|
|
38731
|
-
return
|
|
38970
|
+
return parse4();
|
|
38732
38971
|
} catch (err) {
|
|
38733
38972
|
if (err instanceof UsageError) throw new StartFlagError(err.message);
|
|
38734
38973
|
throw err;
|
|
@@ -38933,10 +39172,20 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
38933
39172
|
idleTimeoutMinutes,
|
|
38934
39173
|
token
|
|
38935
39174
|
});
|
|
38936
|
-
const
|
|
38937
|
-
|
|
38938
|
-
|
|
38939
|
-
|
|
39175
|
+
const cannotStart = (err) => {
|
|
39176
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
39177
|
+
console.error(`argent server start: failed to spawn tool-server: ${message}`);
|
|
39178
|
+
process.exit(1);
|
|
39179
|
+
};
|
|
39180
|
+
let child;
|
|
39181
|
+
try {
|
|
39182
|
+
child = spawn4(resolveToolsServerNode(), [paths.bundlePath, "start"], {
|
|
39183
|
+
stdio: "inherit",
|
|
39184
|
+
env
|
|
39185
|
+
});
|
|
39186
|
+
} catch (err) {
|
|
39187
|
+
return cannotStart(err);
|
|
39188
|
+
}
|
|
38940
39189
|
const forward = (signal) => () => {
|
|
38941
39190
|
try {
|
|
38942
39191
|
child.kill(signal);
|
|
@@ -38945,8 +39194,10 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
38945
39194
|
};
|
|
38946
39195
|
const onInt = forward("SIGINT");
|
|
38947
39196
|
const onTerm = forward("SIGTERM");
|
|
39197
|
+
const onHup = forward("SIGHUP");
|
|
38948
39198
|
process.on("SIGINT", onInt);
|
|
38949
39199
|
process.on("SIGTERM", onTerm);
|
|
39200
|
+
process.on("SIGHUP", onHup);
|
|
38950
39201
|
let stateWritten = false;
|
|
38951
39202
|
const childPid = child.pid;
|
|
38952
39203
|
if (childPid !== void 0) {
|
|
@@ -38970,15 +39221,19 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
38970
39221
|
const cleanup = () => {
|
|
38971
39222
|
process.removeListener("SIGINT", onInt);
|
|
38972
39223
|
process.removeListener("SIGTERM", onTerm);
|
|
39224
|
+
process.removeListener("SIGHUP", onHup);
|
|
38973
39225
|
if (stateWritten) {
|
|
38974
|
-
|
|
38975
|
-
|
|
39226
|
+
const file2 = stateFileForBundle(paths.bundlePath);
|
|
39227
|
+
try {
|
|
39228
|
+
const cur = JSON.parse(fs14.readFileSync(file2, "utf8"));
|
|
39229
|
+
if (cur.pid === childPid) fs14.unlinkSync(file2);
|
|
39230
|
+
} catch {
|
|
39231
|
+
}
|
|
38976
39232
|
}
|
|
38977
39233
|
};
|
|
38978
39234
|
child.on("error", (err) => {
|
|
38979
39235
|
cleanup();
|
|
38980
|
-
|
|
38981
|
-
process.exit(1);
|
|
39236
|
+
cannotStart(err);
|
|
38982
39237
|
});
|
|
38983
39238
|
child.on("exit", (code, signal) => {
|
|
38984
39239
|
cleanup();
|
|
@@ -38990,51 +39245,96 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
38990
39245
|
function signalNumber(signal) {
|
|
38991
39246
|
return constants2.signals[signal] ?? null;
|
|
38992
39247
|
}
|
|
39248
|
+
var SUBCOMMAND_HELP = {
|
|
39249
|
+
status: `Usage: argent server status [--json]
|
|
39250
|
+
|
|
39251
|
+
Show the pid, port, and health of this install's tool-server.
|
|
39252
|
+
|
|
39253
|
+
Flags:
|
|
39254
|
+
--json Print machine-readable JSON.
|
|
39255
|
+
--help, -h Show this help.
|
|
39256
|
+
`,
|
|
39257
|
+
stop: `Usage: argent server stop
|
|
39258
|
+
|
|
39259
|
+
Terminate this install's tool-server.
|
|
39260
|
+
|
|
39261
|
+
Flags:
|
|
39262
|
+
--help, -h Show this help.
|
|
39263
|
+
`,
|
|
39264
|
+
logs: `Usage: argent server logs [-f]
|
|
39265
|
+
|
|
39266
|
+
Print the tool-server log (${LOG_FILE2}).
|
|
39267
|
+
|
|
39268
|
+
Flags:
|
|
39269
|
+
--follow, -f Keep printing new lines until Ctrl-C.
|
|
39270
|
+
--help, -h Show this help.
|
|
39271
|
+
`
|
|
39272
|
+
};
|
|
39273
|
+
var STATUS_OPTIONS = { json: { kind: "boolean" } };
|
|
39274
|
+
var STOP_OPTIONS = {};
|
|
39275
|
+
var LOGS_OPTIONS = { follow: { kind: "boolean", alias: "f" } };
|
|
39276
|
+
function parseSubcommandArgs(sub, argv, specs) {
|
|
39277
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
39278
|
+
console.log(SUBCOMMAND_HELP[sub]);
|
|
39279
|
+
return null;
|
|
39280
|
+
}
|
|
39281
|
+
try {
|
|
39282
|
+
const { positionals, options } = parseCommandArgs(argv, specs);
|
|
39283
|
+
if (positionals.length > 0) throw new UsageError(`Unexpected argument "${positionals[0]}"`);
|
|
39284
|
+
return options;
|
|
39285
|
+
} catch (err) {
|
|
39286
|
+
if (!(err instanceof UsageError)) throw err;
|
|
39287
|
+
console.error(`Error: ${err.message}
|
|
39288
|
+
`);
|
|
39289
|
+
console.log(SUBCOMMAND_HELP[sub]);
|
|
39290
|
+
process.exit(2);
|
|
39291
|
+
}
|
|
39292
|
+
}
|
|
38993
39293
|
function printServerHelp() {
|
|
38994
39294
|
console.log(`Usage:
|
|
38995
|
-
argent server start [flags] Spawn a long-lived tool-server
|
|
39295
|
+
argent server start [flags] Spawn a long-lived tool-server
|
|
38996
39296
|
argent server status [--json] Show tool-server pid, port, and health
|
|
38997
39297
|
argent server stop Terminate the running tool-server
|
|
38998
39298
|
argent server logs [-f] Print (or follow) the tool-server log
|
|
39299
|
+
|
|
39300
|
+
Run \`argent server <subcommand> --help\` for its flags.
|
|
38999
39301
|
`);
|
|
39000
39302
|
}
|
|
39001
39303
|
async function server(argv, options) {
|
|
39002
|
-
const sub = argv
|
|
39003
|
-
const json2 = argv.includes("--json");
|
|
39004
|
-
const follow = argv.includes("-f") || argv.includes("--follow");
|
|
39304
|
+
const [sub, ...rest] = argv;
|
|
39005
39305
|
if (!sub || sub === "--help" || sub === "-h") {
|
|
39006
39306
|
printServerHelp();
|
|
39007
39307
|
return;
|
|
39008
39308
|
}
|
|
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
39309
|
switch (sub) {
|
|
39016
39310
|
case "start":
|
|
39017
39311
|
await startCmd(rest, options?.paths);
|
|
39018
39312
|
return;
|
|
39019
|
-
case "status":
|
|
39020
|
-
|
|
39313
|
+
case "status": {
|
|
39314
|
+
const parsed = parseSubcommandArgs("status", rest, STATUS_OPTIONS);
|
|
39315
|
+
if (parsed) await statusCmd(parsed.json === true, options?.paths);
|
|
39021
39316
|
return;
|
|
39317
|
+
}
|
|
39022
39318
|
case "stop":
|
|
39023
|
-
await stopCmd(options?.paths);
|
|
39319
|
+
if (parseSubcommandArgs("stop", rest, STOP_OPTIONS)) await stopCmd(options?.paths);
|
|
39024
39320
|
return;
|
|
39025
|
-
case "logs":
|
|
39026
|
-
|
|
39321
|
+
case "logs": {
|
|
39322
|
+
const parsed = parseSubcommandArgs("logs", rest, LOGS_OPTIONS);
|
|
39323
|
+
if (parsed) logsCmd(parsed.follow === true);
|
|
39027
39324
|
return;
|
|
39325
|
+
}
|
|
39028
39326
|
default:
|
|
39029
|
-
console.error(`Unknown subcommand: server ${sub}
|
|
39030
|
-
|
|
39327
|
+
console.error(`Error: Unknown subcommand: server ${sub}
|
|
39328
|
+
`);
|
|
39329
|
+
printServerHelp();
|
|
39330
|
+
process.exit(2);
|
|
39031
39331
|
}
|
|
39032
39332
|
}
|
|
39033
39333
|
|
|
39034
39334
|
// ../argent-cli/src/lens.ts
|
|
39035
|
-
import * as
|
|
39335
|
+
import * as fs15 from "node:fs";
|
|
39036
39336
|
import * as os2 from "node:os";
|
|
39037
|
-
import * as
|
|
39337
|
+
import * as path21 from "node:path";
|
|
39038
39338
|
|
|
39039
39339
|
// ../argent-cli/src/lens-terminal.ts
|
|
39040
39340
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
@@ -39252,12 +39552,12 @@ function isSessionAlive(session) {
|
|
|
39252
39552
|
// ../argent-cli/src/lens-pty.ts
|
|
39253
39553
|
import { chmodSync as chmodSync2, readdirSync as readdirSync2 } from "node:fs";
|
|
39254
39554
|
import { createRequire } from "node:module";
|
|
39255
|
-
import { dirname as
|
|
39555
|
+
import { dirname as dirname13, join as join19 } from "node:path";
|
|
39256
39556
|
var nodeRequire = createRequire(import.meta.url);
|
|
39257
39557
|
function ensureSpawnHelperExecutable(req = nodeRequire) {
|
|
39258
39558
|
if (process.platform !== "darwin") return;
|
|
39259
39559
|
try {
|
|
39260
|
-
const prebuilds = join19(
|
|
39560
|
+
const prebuilds = join19(dirname13(req.resolve("node-pty/package.json")), "prebuilds");
|
|
39261
39561
|
for (const entry of readdirSync2(prebuilds)) {
|
|
39262
39562
|
try {
|
|
39263
39563
|
chmodSync2(join19(prebuilds, entry, "spawn-helper"), 493);
|
|
@@ -39292,7 +39592,7 @@ function ptyInjectBeats(text2) {
|
|
|
39292
39592
|
];
|
|
39293
39593
|
}
|
|
39294
39594
|
function sleep(ms) {
|
|
39295
|
-
return new Promise((
|
|
39595
|
+
return new Promise((resolve14) => setTimeout(resolve14, ms));
|
|
39296
39596
|
}
|
|
39297
39597
|
var DEFAULT_COLS = 80;
|
|
39298
39598
|
var DEFAULT_ROWS = 24;
|
|
@@ -39402,10 +39702,10 @@ function parseSseBuffer(buffer) {
|
|
|
39402
39702
|
const events = [];
|
|
39403
39703
|
let rest = normalised;
|
|
39404
39704
|
for (; ; ) {
|
|
39405
|
-
const
|
|
39406
|
-
if (
|
|
39407
|
-
const rawFrame = rest.slice(0,
|
|
39408
|
-
rest = rest.slice(
|
|
39705
|
+
const sep7 = rest.indexOf("\n\n");
|
|
39706
|
+
if (sep7 === -1) break;
|
|
39707
|
+
const rawFrame = rest.slice(0, sep7);
|
|
39708
|
+
rest = rest.slice(sep7 + 2);
|
|
39409
39709
|
let event = "message";
|
|
39410
39710
|
const dataLines = [];
|
|
39411
39711
|
for (const line of rawFrame.split("\n")) {
|
|
@@ -39513,7 +39813,7 @@ var SPAWN_GRACE_MS = 8e3;
|
|
|
39513
39813
|
var DEATH_CONFIRMATIONS = 3;
|
|
39514
39814
|
var SSE_RECONNECT_MS = 1e3;
|
|
39515
39815
|
function sleep2(ms) {
|
|
39516
|
-
return new Promise((
|
|
39816
|
+
return new Promise((resolve14) => setTimeout(resolve14, ms));
|
|
39517
39817
|
}
|
|
39518
39818
|
var TRUST_PROMPT_RE = /trust this folder|do you trust|yes,? i trust|trust the files in this/i;
|
|
39519
39819
|
async function dismissTrustPrompt(session) {
|
|
@@ -39785,12 +40085,12 @@ async function lens(argv, options) {
|
|
|
39785
40085
|
await endSession(baseUrl);
|
|
39786
40086
|
process.exit(1);
|
|
39787
40087
|
}
|
|
39788
|
-
const seedFile =
|
|
39789
|
-
|
|
40088
|
+
const seedFile = path21.join(os2.tmpdir(), `argent-lens-seed-${process.pid}-${Date.now()}.txt`);
|
|
40089
|
+
fs15.writeFileSync(seedFile, buildSeedPrompt(), "utf8");
|
|
39790
40090
|
const launchCmd = agent.launch(shellQuote(process.cwd()), shellQuote(seedFile));
|
|
39791
40091
|
const removeSeedFile = () => {
|
|
39792
40092
|
try {
|
|
39793
|
-
|
|
40093
|
+
fs15.rmSync(seedFile, { force: true });
|
|
39794
40094
|
} catch {
|
|
39795
40095
|
}
|
|
39796
40096
|
};
|
|
@@ -39981,14 +40281,16 @@ async function endSession(baseUrl) {
|
|
|
39981
40281
|
|
|
39982
40282
|
// ../argent-cli/src/flags.ts
|
|
39983
40283
|
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
40284
|
+
import * as path23 from "node:path";
|
|
39984
40285
|
|
|
39985
40286
|
// ../argent-cli/src/secrets.ts
|
|
39986
40287
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
40288
|
+
var LIST_OPTIONS2 = { json: { kind: "boolean" } };
|
|
39987
40289
|
async function secrets(argv) {
|
|
39988
40290
|
const [sub, ...rest] = argv;
|
|
39989
40291
|
if (sub === void 0 || sub === "list") return cmdList(rest);
|
|
39990
40292
|
if (sub === "--help" || sub === "-h") return printUsage();
|
|
39991
|
-
if (sub === "--json") return cmdList([sub, ...rest]);
|
|
40293
|
+
if (sub === "--json") return cmdList(rest[0] === "list" ? [sub, ...rest.slice(1)] : argv);
|
|
39992
40294
|
console.error(`Error: unknown subcommand "secrets ${sub}". Try \`argent secrets --help\`.`);
|
|
39993
40295
|
process.exit(2);
|
|
39994
40296
|
}
|
|
@@ -40018,7 +40320,16 @@ Examples:
|
|
|
40018
40320
|
}
|
|
40019
40321
|
async function cmdList(argv) {
|
|
40020
40322
|
if (argv.includes("--help") || argv.includes("-h")) return printUsage();
|
|
40021
|
-
|
|
40323
|
+
let json2;
|
|
40324
|
+
try {
|
|
40325
|
+
const { positionals, options } = parseCommandArgs(argv, LIST_OPTIONS2);
|
|
40326
|
+
if (positionals.length > 0) throw new UsageError(`Unexpected argument "${positionals[0]}"`);
|
|
40327
|
+
json2 = options.json === true;
|
|
40328
|
+
} catch (err) {
|
|
40329
|
+
if (!(err instanceof UsageError)) throw err;
|
|
40330
|
+
console.error(`Error: ${err.message}. Try \`argent secrets --help\`.`);
|
|
40331
|
+
process.exit(2);
|
|
40332
|
+
}
|
|
40022
40333
|
const sources = secretSources();
|
|
40023
40334
|
const all = secretNames(sources);
|
|
40024
40335
|
if (json2) {
|
|
@@ -40086,6 +40397,19 @@ async function linkedSecretsNote() {
|
|
|
40086
40397
|
return `Note: a remote tool-server is linked (${routed.url}). ${note}`;
|
|
40087
40398
|
}
|
|
40088
40399
|
|
|
40400
|
+
// ../argent-cli/src/project-scope.ts
|
|
40401
|
+
import * as path22 from "node:path";
|
|
40402
|
+
function degenerateProjectScopeWarning(scope, file2) {
|
|
40403
|
+
if (scope !== "project") return null;
|
|
40404
|
+
if (isHomeDir(path22.dirname(path22.dirname(file2)))) {
|
|
40405
|
+
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}).`;
|
|
40406
|
+
}
|
|
40407
|
+
if (findProjectRoot(process.cwd()) === null) {
|
|
40408
|
+
return `WARNING: no project markers (.argent, .git, package.json) found above ${process.cwd()} \u2014 treating it as the project root and creating ${file2}.`;
|
|
40409
|
+
}
|
|
40410
|
+
return null;
|
|
40411
|
+
}
|
|
40412
|
+
|
|
40089
40413
|
// ../argent-cli/src/flags.ts
|
|
40090
40414
|
function colorState(enabled) {
|
|
40091
40415
|
const label = (enabled ? "enabled" : "disabled").padEnd(8);
|
|
@@ -40154,18 +40478,21 @@ function runToggle(argv, command, registry2) {
|
|
|
40154
40478
|
process.exit(2);
|
|
40155
40479
|
}
|
|
40156
40480
|
const filePath = getFlagsPath(parsed.scope);
|
|
40481
|
+
const warning = degenerateProjectScopeWarning(parsed.scope, filePath);
|
|
40482
|
+
let wrote = true;
|
|
40157
40483
|
try {
|
|
40158
40484
|
if (command === "enable") {
|
|
40159
40485
|
setFlag(parsed.name, true, parsed.scope);
|
|
40160
40486
|
} else if (getFlagDefinition(parsed.name, registry2)?.defaultEnabled) {
|
|
40161
40487
|
setFlag(parsed.name, false, parsed.scope);
|
|
40162
40488
|
} else {
|
|
40163
|
-
unsetFlag(parsed.name, parsed.scope);
|
|
40489
|
+
wrote = unsetFlag(parsed.name, parsed.scope);
|
|
40164
40490
|
}
|
|
40165
40491
|
} catch (err) {
|
|
40166
40492
|
console.error(`Failed to ${command} flag: ${err instanceof Error ? err.message : String(err)}`);
|
|
40167
40493
|
process.exit(1);
|
|
40168
40494
|
}
|
|
40495
|
+
if (wrote && warning) console.error(import_picocolors2.default.yellow(warning));
|
|
40169
40496
|
if (command === "enable") {
|
|
40170
40497
|
console.log(`Enabled flag "${parsed.name}" (${parsed.scope}). Stored at ${filePath}.`);
|
|
40171
40498
|
} else {
|
|
@@ -40191,6 +40518,7 @@ function enable(argv, registry2 = FLAG_REGISTRY) {
|
|
|
40191
40518
|
function disable(argv, registry2 = FLAG_REGISTRY) {
|
|
40192
40519
|
runToggle(argv, "disable", registry2);
|
|
40193
40520
|
}
|
|
40521
|
+
var FLAGS_OPTIONS = { json: { kind: "boolean" } };
|
|
40194
40522
|
function flags(argv, registry2 = FLAG_REGISTRY) {
|
|
40195
40523
|
if (argv.includes("--help") || argv.includes("-h")) {
|
|
40196
40524
|
console.log(`Usage: argent flags [--json]
|
|
@@ -40205,8 +40533,20 @@ Options:
|
|
|
40205
40533
|
`);
|
|
40206
40534
|
return;
|
|
40207
40535
|
}
|
|
40208
|
-
|
|
40209
|
-
|
|
40536
|
+
let json2;
|
|
40537
|
+
try {
|
|
40538
|
+
const { positionals, options } = parseCommandArgs(argv, FLAGS_OPTIONS);
|
|
40539
|
+
if (positionals.length > 0) {
|
|
40540
|
+
throw new UsageError(`Unexpected extra argument: "${positionals[0]}"`);
|
|
40541
|
+
}
|
|
40542
|
+
json2 = options.json === true;
|
|
40543
|
+
} catch (err) {
|
|
40544
|
+
if (!(err instanceof UsageError)) throw err;
|
|
40545
|
+
console.error(`Error: ${err.message}`);
|
|
40546
|
+
process.exit(2);
|
|
40547
|
+
}
|
|
40548
|
+
const projectIsHome = isHomeDir(path23.dirname(path23.dirname(getFlagsPath("project"))));
|
|
40549
|
+
const projectFlags = projectIsHome ? {} : readFlags("project");
|
|
40210
40550
|
const globalFlags = readFlags("global");
|
|
40211
40551
|
const effective = {};
|
|
40212
40552
|
for (const [k, v] of Object.entries(globalFlags)) effective[k] = { value: v, scope: "global" };
|
|
@@ -40263,12 +40603,12 @@ Options:
|
|
|
40263
40603
|
}
|
|
40264
40604
|
console.log(`
|
|
40265
40605
|
Global: ${getFlagsPath("global")}`);
|
|
40266
|
-
console.log(` Project: ${getFlagsPath("project")}`);
|
|
40606
|
+
if (!projectIsHome) console.log(` Project: ${getFlagsPath("project")}`);
|
|
40267
40607
|
}
|
|
40268
40608
|
|
|
40269
40609
|
// ../argent-cli/src/config.ts
|
|
40270
40610
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
40271
|
-
import * as
|
|
40611
|
+
import * as path24 from "node:path";
|
|
40272
40612
|
function config2(argv) {
|
|
40273
40613
|
if (argv.length === 0 || argv[0] === "--help" || argv[0] === "-h") {
|
|
40274
40614
|
printUsage2();
|
|
@@ -40297,7 +40637,11 @@ Show every recognized configuration value, its effective (merged) value, and
|
|
|
40297
40637
|
the raw value stored at each scope.`);
|
|
40298
40638
|
return;
|
|
40299
40639
|
}
|
|
40300
|
-
const json2 = argv
|
|
40640
|
+
const { positionals, json: json2 } = parseArgs2(argv, LIST_OPTIONS3);
|
|
40641
|
+
if (positionals.length > 0) {
|
|
40642
|
+
console.error(`Error: unexpected extra argument "${positionals[0]}".`);
|
|
40643
|
+
process.exit(2);
|
|
40644
|
+
}
|
|
40301
40645
|
const entries = listConfig();
|
|
40302
40646
|
if (json2) {
|
|
40303
40647
|
console.log(JSON.stringify({ config: entries }, null, 2));
|
|
@@ -40331,7 +40675,7 @@ Print a configuration value. Without --scope, prints the effective value after
|
|
|
40331
40675
|
merging project and global. With --scope, prints only that scope's stored value.`);
|
|
40332
40676
|
return;
|
|
40333
40677
|
}
|
|
40334
|
-
const { positionals, scope, json: json2 } = parseArgs2(argv);
|
|
40678
|
+
const { positionals, scope, json: json2 } = parseArgs2(argv, GET_OPTIONS);
|
|
40335
40679
|
const key = positionals[0];
|
|
40336
40680
|
if (!key) {
|
|
40337
40681
|
console.error("Error: `argent config get` requires a <key>.");
|
|
@@ -40365,7 +40709,7 @@ write <project-root>/.argent/config.json. Booleans, numbers, and JSON arrays are
|
|
|
40365
40709
|
parsed (e.g. \`true\`, \`42\`, \`["a","b"]\`); anything else is stored as a string.`);
|
|
40366
40710
|
return;
|
|
40367
40711
|
}
|
|
40368
|
-
const { positionals, scope } = parseArgs2(argv);
|
|
40712
|
+
const { positionals, scope } = parseArgs2(argv, WRITE_OPTIONS);
|
|
40369
40713
|
const key = positionals[0];
|
|
40370
40714
|
const rawValue = positionals[1];
|
|
40371
40715
|
if (!key || rawValue === void 0) {
|
|
@@ -40377,7 +40721,7 @@ parsed (e.g. \`true\`, \`42\`, \`["a","b"]\`); anything else is stored as a stri
|
|
|
40377
40721
|
process.exit(2);
|
|
40378
40722
|
}
|
|
40379
40723
|
const targetScope = scope ?? "global";
|
|
40380
|
-
const warning =
|
|
40724
|
+
const warning = projectConfigWarning(targetScope);
|
|
40381
40725
|
try {
|
|
40382
40726
|
const stored = setConfigValue(key, coerceCliValue(rawValue), targetScope);
|
|
40383
40727
|
if (warning) console.error(import_picocolors3.default.yellow(warning));
|
|
@@ -40396,7 +40740,7 @@ Remove a configuration value at a scope (default global). Falls back to the
|
|
|
40396
40740
|
other scope / the default on the next read.`);
|
|
40397
40741
|
return;
|
|
40398
40742
|
}
|
|
40399
|
-
const { positionals, scope } = parseArgs2(argv);
|
|
40743
|
+
const { positionals, scope } = parseArgs2(argv, WRITE_OPTIONS);
|
|
40400
40744
|
const key = positionals[0];
|
|
40401
40745
|
if (!key) {
|
|
40402
40746
|
console.error("Error: `argent config unset` requires a <key>.");
|
|
@@ -40407,7 +40751,7 @@ other scope / the default on the next read.`);
|
|
|
40407
40751
|
process.exit(2);
|
|
40408
40752
|
}
|
|
40409
40753
|
const targetScope = scope ?? "global";
|
|
40410
|
-
const warning =
|
|
40754
|
+
const warning = projectConfigWarning(targetScope);
|
|
40411
40755
|
try {
|
|
40412
40756
|
const removed = unsetConfigValue(key, targetScope);
|
|
40413
40757
|
if (removed && warning) console.error(import_picocolors3.default.yellow(warning));
|
|
@@ -40420,13 +40764,14 @@ other scope / the default on the next read.`);
|
|
|
40420
40764
|
reportError(err);
|
|
40421
40765
|
}
|
|
40422
40766
|
}
|
|
40423
|
-
var
|
|
40424
|
-
|
|
40425
|
-
|
|
40426
|
-
};
|
|
40427
|
-
|
|
40767
|
+
var SCOPE_OPTION = { kind: "value", choices: ["global", "project"] };
|
|
40768
|
+
var JSON_OPTION = { kind: "boolean" };
|
|
40769
|
+
var LIST_OPTIONS3 = { json: JSON_OPTION };
|
|
40770
|
+
var GET_OPTIONS = { scope: SCOPE_OPTION, json: JSON_OPTION };
|
|
40771
|
+
var WRITE_OPTIONS = { scope: SCOPE_OPTION };
|
|
40772
|
+
function parseArgs2(argv, specs) {
|
|
40428
40773
|
try {
|
|
40429
|
-
const { positionals, options } = parseCommandArgs(argv,
|
|
40774
|
+
const { positionals, options } = parseCommandArgs(argv, specs);
|
|
40430
40775
|
return {
|
|
40431
40776
|
positionals,
|
|
40432
40777
|
scope: options.scope ?? null,
|
|
@@ -40443,18 +40788,10 @@ function wantsHelp(argv) {
|
|
|
40443
40788
|
}
|
|
40444
40789
|
function scopeLabel(scope) {
|
|
40445
40790
|
if (scope === "global") return "global";
|
|
40446
|
-
return `project: ${
|
|
40791
|
+
return `project: ${path24.dirname(configDir("project"))}`;
|
|
40447
40792
|
}
|
|
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;
|
|
40793
|
+
function projectConfigWarning(scope) {
|
|
40794
|
+
return degenerateProjectScopeWarning(scope, path24.join(configDir("project"), "config.json"));
|
|
40458
40795
|
}
|
|
40459
40796
|
function restartHint(key) {
|
|
40460
40797
|
if (key !== "android.adbServerPort") return null;
|
|
@@ -41280,7 +41617,7 @@ import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
|
41280
41617
|
import process$1 from "node:process";
|
|
41281
41618
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
41282
41619
|
import { existsSync as existsSync7, lstatSync as lstatSync3, readdirSync as readdirSync3 } from "node:fs";
|
|
41283
|
-
import { dirname as
|
|
41620
|
+
import { dirname as dirname17, join as join22 } from "node:path";
|
|
41284
41621
|
function isUnicodeSupported() {
|
|
41285
41622
|
if (process$1.platform !== "win32") {
|
|
41286
41623
|
return process$1.env.TERM !== "linux";
|
|
@@ -42168,7 +42505,9 @@ async function unlink3(argv) {
|
|
|
42168
42505
|
|
|
42169
42506
|
// ../argent-cli/src/telemetry.ts
|
|
42170
42507
|
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
42508
|
+
import * as path25 from "node:path";
|
|
42171
42509
|
var SCOPES = ["global", "project"];
|
|
42510
|
+
var SUBCOMMANDS = ["status", "enable", "disable"];
|
|
42172
42511
|
var TELEMETRY_OPTIONS = {
|
|
42173
42512
|
scope: { kind: "value", choices: SCOPES }
|
|
42174
42513
|
};
|
|
@@ -42177,8 +42516,14 @@ async function telemetry(args) {
|
|
|
42177
42516
|
let scope = "global";
|
|
42178
42517
|
const wantsHelp2 = args.includes("--help") || args.includes("-h");
|
|
42179
42518
|
if (!wantsHelp2) {
|
|
42519
|
+
if (sub !== void 0 && !SUBCOMMANDS.includes(sub)) {
|
|
42520
|
+
console.error(`Error: Unknown subcommand: telemetry ${sub}`);
|
|
42521
|
+
printUsage3();
|
|
42522
|
+
process.exit(2);
|
|
42523
|
+
}
|
|
42180
42524
|
try {
|
|
42181
|
-
const
|
|
42525
|
+
const specs = sub === "status" ? {} : TELEMETRY_OPTIONS;
|
|
42526
|
+
const { positionals, options } = parseCommandArgs(args.slice(1), specs);
|
|
42182
42527
|
if (positionals.length > 0) {
|
|
42183
42528
|
throw new UsageError(`Unexpected argument "${positionals[0]}".`);
|
|
42184
42529
|
}
|
|
@@ -42211,10 +42556,6 @@ async function telemetry(args) {
|
|
|
42211
42556
|
case "disable":
|
|
42212
42557
|
await cmdDisable(scope);
|
|
42213
42558
|
return;
|
|
42214
|
-
default:
|
|
42215
|
-
console.error(`Unknown subcommand: telemetry ${sub}`);
|
|
42216
|
-
await shutdown();
|
|
42217
|
-
process.exit(1);
|
|
42218
42559
|
}
|
|
42219
42560
|
}
|
|
42220
42561
|
function printUsage3() {
|
|
@@ -42252,9 +42593,14 @@ function describeSource(source) {
|
|
|
42252
42593
|
return "default (no opt-out set)";
|
|
42253
42594
|
}
|
|
42254
42595
|
}
|
|
42596
|
+
function projectConfigWarning2(scope) {
|
|
42597
|
+
return degenerateProjectScopeWarning(scope, path25.join(configDir("project"), "config.json"));
|
|
42598
|
+
}
|
|
42255
42599
|
async function cmdEnable(scope) {
|
|
42600
|
+
const warning = projectConfigWarning2(scope);
|
|
42256
42601
|
const wasEnabled = isEnabled();
|
|
42257
42602
|
markEnabled(scope);
|
|
42603
|
+
if (warning) console.error(import_picocolors5.default.yellow(warning));
|
|
42258
42604
|
const nowEnabled = isEnabled();
|
|
42259
42605
|
if (!nowEnabled) {
|
|
42260
42606
|
console.log(
|
|
@@ -42270,8 +42616,10 @@ async function cmdEnable(scope) {
|
|
|
42270
42616
|
await shutdown();
|
|
42271
42617
|
}
|
|
42272
42618
|
async function cmdDisable(scope) {
|
|
42619
|
+
const warning = projectConfigWarning2(scope);
|
|
42273
42620
|
const wasEnabled = isEnabled();
|
|
42274
42621
|
await markDisabled(scope);
|
|
42622
|
+
if (warning) console.error(import_picocolors5.default.yellow(warning));
|
|
42275
42623
|
if (!wasEnabled) {
|
|
42276
42624
|
console.log(import_picocolors5.default.dim(`Telemetry was already disabled (written at ${scopeLabel2(scope)}).`));
|
|
42277
42625
|
} else {
|
|
@@ -42282,8 +42630,8 @@ async function cmdDisable(scope) {
|
|
|
42282
42630
|
|
|
42283
42631
|
// ../argent-cli/src/providers.ts
|
|
42284
42632
|
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
42285
|
-
import * as
|
|
42286
|
-
import * as
|
|
42633
|
+
import * as fs19 from "node:fs";
|
|
42634
|
+
import * as path28 from "node:path";
|
|
42287
42635
|
|
|
42288
42636
|
// ../device-providers/src/contract.ts
|
|
42289
42637
|
var PROVIDER_SCHEMA_VERSION = 1;
|
|
@@ -42428,9 +42776,9 @@ var providerEnvelopeSchema = providerRecordSchema.extend({
|
|
|
42428
42776
|
});
|
|
42429
42777
|
|
|
42430
42778
|
// ../device-providers/src/read.ts
|
|
42431
|
-
import * as
|
|
42779
|
+
import * as fs16 from "node:fs";
|
|
42432
42780
|
import * as os3 from "node:os";
|
|
42433
|
-
import * as
|
|
42781
|
+
import * as path26 from "node:path";
|
|
42434
42782
|
var DISABLE_ENV = "ARGENT_DISABLE_DEVICE_PROVIDERS";
|
|
42435
42783
|
var OVERRIDE_ENV = "ARGENT_DEVICE_PROVIDERS";
|
|
42436
42784
|
function resolveHomeDir2() {
|
|
@@ -42439,7 +42787,7 @@ function resolveHomeDir2() {
|
|
|
42439
42787
|
return trimmed ? raw : os3.homedir();
|
|
42440
42788
|
}
|
|
42441
42789
|
function providersDirectory() {
|
|
42442
|
-
return
|
|
42790
|
+
return path26.join(resolveHomeDir2(), ".argent", "providers");
|
|
42443
42791
|
}
|
|
42444
42792
|
function discoveryDisabled() {
|
|
42445
42793
|
const raw = process.env[DISABLE_ENV];
|
|
@@ -42455,7 +42803,7 @@ function warnOnce(key, message) {
|
|
|
42455
42803
|
function readProviderFile(file2) {
|
|
42456
42804
|
let raw;
|
|
42457
42805
|
try {
|
|
42458
|
-
raw =
|
|
42806
|
+
raw = fs16.readFileSync(file2, "utf8");
|
|
42459
42807
|
} catch {
|
|
42460
42808
|
return void 0;
|
|
42461
42809
|
}
|
|
@@ -42505,15 +42853,15 @@ function discoverProviders() {
|
|
|
42505
42853
|
function descriptorFiles() {
|
|
42506
42854
|
const directory = providersDirectory();
|
|
42507
42855
|
try {
|
|
42508
|
-
return
|
|
42856
|
+
return fs16.readdirSync(directory).filter((name) => name.endsWith(".json")).sort().map((name) => path26.join(directory, name));
|
|
42509
42857
|
} catch {
|
|
42510
42858
|
return [];
|
|
42511
42859
|
}
|
|
42512
42860
|
}
|
|
42513
42861
|
|
|
42514
42862
|
// ../device-providers/src/write.ts
|
|
42515
|
-
import * as
|
|
42516
|
-
import * as
|
|
42863
|
+
import * as fs17 from "node:fs";
|
|
42864
|
+
import * as path27 from "node:path";
|
|
42517
42865
|
var ProviderValidationError = class extends Error {
|
|
42518
42866
|
/** One line per problem, `path: message`, in the order zod reported them. */
|
|
42519
42867
|
issues;
|
|
@@ -42565,20 +42913,20 @@ function publishProvider(record2, options = {}) {
|
|
|
42565
42913
|
);
|
|
42566
42914
|
}
|
|
42567
42915
|
const directory = providersDirectory();
|
|
42568
|
-
const file2 =
|
|
42916
|
+
const file2 = path27.join(directory, `${validated.id}.json`);
|
|
42569
42917
|
const body = JSON.stringify(canonicalize(candidate), null, 2) + "\n";
|
|
42570
42918
|
try {
|
|
42571
|
-
if (
|
|
42919
|
+
if (fs17.readFileSync(file2, "utf8") === body) return { changed: false, path: file2 };
|
|
42572
42920
|
} catch {
|
|
42573
42921
|
}
|
|
42574
|
-
|
|
42922
|
+
fs17.mkdirSync(directory, { recursive: true });
|
|
42575
42923
|
const temporary = `${file2}.${process.pid}.tmp`;
|
|
42576
42924
|
try {
|
|
42577
|
-
|
|
42578
|
-
|
|
42925
|
+
fs17.writeFileSync(temporary, body);
|
|
42926
|
+
fs17.renameSync(temporary, file2);
|
|
42579
42927
|
} catch (error63) {
|
|
42580
42928
|
try {
|
|
42581
|
-
|
|
42929
|
+
fs17.rmSync(temporary, { force: true });
|
|
42582
42930
|
} catch {
|
|
42583
42931
|
}
|
|
42584
42932
|
throw error63;
|
|
@@ -42589,9 +42937,9 @@ function withdrawProvider(id) {
|
|
|
42589
42937
|
if (!PROVIDER_ID_SHAPE.test(id)) {
|
|
42590
42938
|
throw new Error(`'${id}' is not a valid provider id (${String(PROVIDER_ID_SHAPE)}).`);
|
|
42591
42939
|
}
|
|
42592
|
-
const file2 =
|
|
42940
|
+
const file2 = path27.join(providersDirectory(), `${id}.json`);
|
|
42593
42941
|
try {
|
|
42594
|
-
|
|
42942
|
+
fs17.unlinkSync(file2);
|
|
42595
42943
|
return true;
|
|
42596
42944
|
} catch (e) {
|
|
42597
42945
|
if (e.code === "ENOENT") return false;
|
|
@@ -42621,7 +42969,7 @@ function pruneOrphanedProviders(options = {}) {
|
|
|
42621
42969
|
continue;
|
|
42622
42970
|
}
|
|
42623
42971
|
try {
|
|
42624
|
-
|
|
42972
|
+
fs17.unlinkSync(file2);
|
|
42625
42973
|
removed.push(entry);
|
|
42626
42974
|
} catch {
|
|
42627
42975
|
}
|
|
@@ -42631,7 +42979,7 @@ function pruneOrphanedProviders(options = {}) {
|
|
|
42631
42979
|
|
|
42632
42980
|
// ../argent-cli/src/providers-check.ts
|
|
42633
42981
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
42634
|
-
import * as
|
|
42982
|
+
import * as fs18 from "node:fs";
|
|
42635
42983
|
var KNOWN_CAPABILITIES = new Set(EXTERNAL_CAPABILITIES);
|
|
42636
42984
|
var PROBE_TIMEOUT_MS = 5e3;
|
|
42637
42985
|
function error62(message) {
|
|
@@ -42697,7 +43045,7 @@ async function checkDevices(devices, findings) {
|
|
|
42697
43045
|
);
|
|
42698
43046
|
} else {
|
|
42699
43047
|
try {
|
|
42700
|
-
|
|
43048
|
+
fs18.accessSync(device.deviceSet, fs18.constants.R_OK);
|
|
42701
43049
|
} catch {
|
|
42702
43050
|
findings.push(
|
|
42703
43051
|
error62(`${label}: deviceSet '${device.deviceSet}' is not readable by this user`)
|
|
@@ -42754,7 +43102,7 @@ async function checkDevices(devices, findings) {
|
|
|
42754
43102
|
);
|
|
42755
43103
|
} else {
|
|
42756
43104
|
try {
|
|
42757
|
-
|
|
43105
|
+
fs18.accessSync(device.nativeDevtools.socketPath, fs18.constants.R_OK | fs18.constants.W_OK);
|
|
42758
43106
|
} catch {
|
|
42759
43107
|
findings.push(
|
|
42760
43108
|
error62(
|
|
@@ -42825,7 +43173,7 @@ async function checkDescriptorFile(file2, expectedVersion) {
|
|
|
42825
43173
|
const report = { deviceCount: 0, findings, source: file2 };
|
|
42826
43174
|
let raw;
|
|
42827
43175
|
try {
|
|
42828
|
-
raw =
|
|
43176
|
+
raw = fs18.readFileSync(file2, "utf8");
|
|
42829
43177
|
} catch (e) {
|
|
42830
43178
|
findings.push(error62(`unreadable: ${e instanceof Error ? e.message : String(e)}`));
|
|
42831
43179
|
return report;
|
|
@@ -42886,12 +43234,20 @@ ${title}`);
|
|
|
42886
43234
|
}
|
|
42887
43235
|
|
|
42888
43236
|
// ../argent-cli/src/providers.ts
|
|
42889
|
-
var
|
|
43237
|
+
var SUBCOMMANDS2 = ["check", "list", "prune", "publish", "withdraw"];
|
|
43238
|
+
var SUBCOMMAND_FLAGS = {
|
|
43239
|
+
check: ["--file", "--json", "--schema-version"],
|
|
43240
|
+
list: ["--json"],
|
|
43241
|
+
prune: ["--dry-run", "--json"],
|
|
43242
|
+
publish: ["--file", "--json", "--pid", "--schema-version", "--stdin"],
|
|
43243
|
+
withdraw: ["--json"]
|
|
43244
|
+
};
|
|
42890
43245
|
var UsageError2 = class extends Error {
|
|
42891
43246
|
};
|
|
42892
43247
|
function parseArgs3(argv) {
|
|
42893
43248
|
const parsed = {
|
|
42894
43249
|
dryRun: false,
|
|
43250
|
+
flags: [],
|
|
42895
43251
|
json: false,
|
|
42896
43252
|
operands: [],
|
|
42897
43253
|
schemaVersion: PROVIDER_SCHEMA_VERSION,
|
|
@@ -42910,6 +43266,7 @@ function parseArgs3(argv) {
|
|
|
42910
43266
|
};
|
|
42911
43267
|
for (let i2 = 0; i2 < argv.length; i2++) {
|
|
42912
43268
|
const token = argv[i2];
|
|
43269
|
+
if (token.startsWith("--")) parsed.flags.push(token.split("=")[0]);
|
|
42913
43270
|
if (token === "--json") {
|
|
42914
43271
|
parsed.json = true;
|
|
42915
43272
|
} else if (token === "--dry-run") {
|
|
@@ -42961,7 +43318,7 @@ async function readDocument(args) {
|
|
|
42961
43318
|
}
|
|
42962
43319
|
if (args.file) {
|
|
42963
43320
|
try {
|
|
42964
|
-
return { raw:
|
|
43321
|
+
return { raw: fs19.readFileSync(args.file, "utf8"), source: args.file };
|
|
42965
43322
|
} catch (e) {
|
|
42966
43323
|
throw new UsageError2(
|
|
42967
43324
|
`cannot read ${args.file}: ${e instanceof Error ? e.message : String(e)}`
|
|
@@ -43094,7 +43451,7 @@ function runWithdraw(args) {
|
|
|
43094
43451
|
throw new UsageError2(`'${id}' is not a valid provider id (${String(PROVIDER_ID_SHAPE)})`);
|
|
43095
43452
|
}
|
|
43096
43453
|
const removed = withdrawProvider(id);
|
|
43097
|
-
const file2 =
|
|
43454
|
+
const file2 = path28.join(providersDirectory(), `${id}.json`);
|
|
43098
43455
|
if (args.json) {
|
|
43099
43456
|
console.log(JSON.stringify({ ok: true, path: file2, removed }, null, 2));
|
|
43100
43457
|
return;
|
|
@@ -43222,7 +43579,8 @@ Options:
|
|
|
43222
43579
|
later prune can remove this descriptor if that
|
|
43223
43580
|
process dies. Overrides any pid in the document.
|
|
43224
43581
|
--dry-run prune: report what would be removed, remove nothing.
|
|
43225
|
-
--schema-version <n>
|
|
43582
|
+
--schema-version <n> check, publish: the contract version to validate
|
|
43583
|
+
against (default ${PROVIDER_SCHEMA_VERSION}).
|
|
43226
43584
|
--json Emit a machine-readable report on stdout.
|
|
43227
43585
|
--help, -h Show this message.
|
|
43228
43586
|
|
|
@@ -43255,7 +43613,7 @@ async function providers(argv) {
|
|
|
43255
43613
|
if (subcommand === void 0) process.exit(2);
|
|
43256
43614
|
return;
|
|
43257
43615
|
}
|
|
43258
|
-
if (!
|
|
43616
|
+
if (!SUBCOMMANDS2.includes(subcommand)) {
|
|
43259
43617
|
console.error(`Unknown subcommand: "${subcommand}"`);
|
|
43260
43618
|
printHelp3();
|
|
43261
43619
|
process.exit(2);
|
|
@@ -43276,6 +43634,13 @@ async function providers(argv) {
|
|
|
43276
43634
|
console.error(`Unknown argument: "${args.operands[0]}"`);
|
|
43277
43635
|
process.exit(2);
|
|
43278
43636
|
}
|
|
43637
|
+
const stray = args.flags.find(
|
|
43638
|
+
(flag) => !SUBCOMMAND_FLAGS[subcommand].includes(flag)
|
|
43639
|
+
);
|
|
43640
|
+
if (stray !== void 0) {
|
|
43641
|
+
console.error(`${stray} does not apply to \`argent providers ${subcommand}\``);
|
|
43642
|
+
process.exit(2);
|
|
43643
|
+
}
|
|
43279
43644
|
try {
|
|
43280
43645
|
switch (subcommand) {
|
|
43281
43646
|
case "check":
|