@swmansion/argent 0.34.1-next.6 → 0.34.1-next.60
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 +914 -551
- package/dist/client.js +376 -180
- 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 +1221 -923
- package/dist/ios-device-runner/ArgentRunner/ArgentRunner.xcodeproj/xcshareddata/xcschemes/ArgentRunner.xcscheme +1 -0
- 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/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession.swift +3 -0
- package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/RunnerHTTPServer.swift +21 -9
- package/dist/mcp-server.mjs +593 -715
- package/dist/preview-ui/index.html +28 -2
- package/dist/tool-args.generated.d.ts +99 -31
- package/dist/tool-server.cjs +15753 -6244
- 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-android-emulator-setup/SKILL.md +4 -4
- package/skills/argent-create-e2e/references/e2e-yaml.md +2 -2
- package/skills/argent-create-e2e/references/live-authoring.md +12 -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 +3 -3
- package/skills/argent-ios-device-setup/SKILL.md +4 -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 +26 -14
- package/skills/argent-native-profiler/SKILL.md +14 -2
- package/skills/argent-react-native-app-workflow/SKILL.md +2 -2
- package/skills/argent-react-native-optimization/SKILL.md +10 -1
- package/skills/argent-react-native-optimization/references/fix-reference.md +10 -10
- package/skills/argent-react-native-profiler/SKILL.md +4 -3
- package/skills/argent-screen-recording/SKILL.md +6 -4
- package/skills/argent-screenshot-diff/SKILL.md +1 -1
- package/skills/argent-test-ui-flow/SKILL.md +1 -1
package/dist/mcp-server.mjs
CHANGED
|
@@ -2990,7 +2990,7 @@ var require_compile = __commonJS({
|
|
|
2990
2990
|
const schOrFunc = root.refs[ref];
|
|
2991
2991
|
if (schOrFunc)
|
|
2992
2992
|
return schOrFunc;
|
|
2993
|
-
let _sch =
|
|
2993
|
+
let _sch = resolve12.call(this, root, ref);
|
|
2994
2994
|
if (_sch === void 0) {
|
|
2995
2995
|
const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
|
|
2996
2996
|
const { schemaId } = this.opts;
|
|
@@ -3017,7 +3017,7 @@ var require_compile = __commonJS({
|
|
|
3017
3017
|
function sameSchemaEnv(s1, s2) {
|
|
3018
3018
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
3019
3019
|
}
|
|
3020
|
-
function
|
|
3020
|
+
function resolve12(root, ref) {
|
|
3021
3021
|
let sch;
|
|
3022
3022
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
3023
3023
|
ref = sch;
|
|
@@ -3235,8 +3235,8 @@ var require_utils = __commonJS({
|
|
|
3235
3235
|
}
|
|
3236
3236
|
return ind;
|
|
3237
3237
|
}
|
|
3238
|
-
function removeDotSegments(
|
|
3239
|
-
let input =
|
|
3238
|
+
function removeDotSegments(path18) {
|
|
3239
|
+
let input = path18;
|
|
3240
3240
|
const output = [];
|
|
3241
3241
|
let nextSlash = -1;
|
|
3242
3242
|
let len = 0;
|
|
@@ -3488,8 +3488,8 @@ var require_schemes = __commonJS({
|
|
|
3488
3488
|
wsComponent.secure = void 0;
|
|
3489
3489
|
}
|
|
3490
3490
|
if (wsComponent.resourceName) {
|
|
3491
|
-
const [
|
|
3492
|
-
wsComponent.path =
|
|
3491
|
+
const [path18, query] = wsComponent.resourceName.split("?");
|
|
3492
|
+
wsComponent.path = path18 && path18 !== "/" ? path18 : void 0;
|
|
3493
3493
|
wsComponent.query = query;
|
|
3494
3494
|
wsComponent.resourceName = void 0;
|
|
3495
3495
|
}
|
|
@@ -3644,21 +3644,21 @@ var require_fast_uri = __commonJS({
|
|
|
3644
3644
|
normalizeString(uri, options);
|
|
3645
3645
|
} else if (typeof uri === "object") {
|
|
3646
3646
|
uri = /** @type {T} */
|
|
3647
|
-
|
|
3647
|
+
parse4(serialize(uri, options), options);
|
|
3648
3648
|
}
|
|
3649
3649
|
return uri;
|
|
3650
3650
|
}
|
|
3651
|
-
function
|
|
3651
|
+
function resolve12(baseURI, relativeURI, options) {
|
|
3652
3652
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
3653
|
-
const resolved = resolveComponent(
|
|
3653
|
+
const resolved = resolveComponent(parse4(baseURI, schemelessOptions), parse4(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
3654
3654
|
schemelessOptions.skipEscape = true;
|
|
3655
3655
|
return serialize(resolved, schemelessOptions);
|
|
3656
3656
|
}
|
|
3657
3657
|
function resolveComponent(base, relative2, options, skipNormalization) {
|
|
3658
3658
|
const target = {};
|
|
3659
3659
|
if (!skipNormalization) {
|
|
3660
|
-
base =
|
|
3661
|
-
relative2 =
|
|
3660
|
+
base = parse4(serialize(base, options), options);
|
|
3661
|
+
relative2 = parse4(serialize(relative2, options), options);
|
|
3662
3662
|
}
|
|
3663
3663
|
options = options || {};
|
|
3664
3664
|
if (!options.tolerant && relative2.scheme) {
|
|
@@ -3881,7 +3881,7 @@ var require_fast_uri = __commonJS({
|
|
|
3881
3881
|
}
|
|
3882
3882
|
return { parsed, malformedAuthorityOrPort };
|
|
3883
3883
|
}
|
|
3884
|
-
function
|
|
3884
|
+
function parse4(uri, opts) {
|
|
3885
3885
|
return parseWithStatus(uri, opts).parsed;
|
|
3886
3886
|
}
|
|
3887
3887
|
function normalizeString(uri, opts) {
|
|
@@ -3906,11 +3906,11 @@ var require_fast_uri = __commonJS({
|
|
|
3906
3906
|
var fastUri = {
|
|
3907
3907
|
SCHEMES,
|
|
3908
3908
|
normalize: normalize3,
|
|
3909
|
-
resolve:
|
|
3909
|
+
resolve: resolve12,
|
|
3910
3910
|
resolveComponent,
|
|
3911
3911
|
equal,
|
|
3912
3912
|
serialize,
|
|
3913
|
-
parse:
|
|
3913
|
+
parse: parse4
|
|
3914
3914
|
};
|
|
3915
3915
|
module.exports = fastUri;
|
|
3916
3916
|
module.exports.default = fastUri;
|
|
@@ -6882,12 +6882,12 @@ var require_dist = __commonJS({
|
|
|
6882
6882
|
throw new Error(`Unknown format "${name}"`);
|
|
6883
6883
|
return f;
|
|
6884
6884
|
};
|
|
6885
|
-
function addFormats(ajv, list,
|
|
6885
|
+
function addFormats(ajv, list, fs13, exportName) {
|
|
6886
6886
|
var _a3;
|
|
6887
6887
|
var _b;
|
|
6888
6888
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
6889
6889
|
for (const f of list)
|
|
6890
|
-
ajv.addFormat(f,
|
|
6890
|
+
ajv.addFormat(f, fs13[f]);
|
|
6891
6891
|
}
|
|
6892
6892
|
module.exports = exports = formatsPlugin;
|
|
6893
6893
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -6972,17 +6972,17 @@ var require_visit = __commonJS({
|
|
|
6972
6972
|
visit.BREAK = BREAK;
|
|
6973
6973
|
visit.SKIP = SKIP;
|
|
6974
6974
|
visit.REMOVE = REMOVE;
|
|
6975
|
-
function visit_(key, node2, visitor,
|
|
6976
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
6975
|
+
function visit_(key, node2, visitor, path18) {
|
|
6976
|
+
const ctrl = callVisitor(key, node2, visitor, path18);
|
|
6977
6977
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
6978
|
-
replaceNode(key,
|
|
6979
|
-
return visit_(key, ctrl, visitor,
|
|
6978
|
+
replaceNode(key, path18, ctrl);
|
|
6979
|
+
return visit_(key, ctrl, visitor, path18);
|
|
6980
6980
|
}
|
|
6981
6981
|
if (typeof ctrl !== "symbol") {
|
|
6982
6982
|
if (identity.isCollection(node2)) {
|
|
6983
|
-
|
|
6983
|
+
path18 = Object.freeze(path18.concat(node2));
|
|
6984
6984
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
6985
|
-
const ci = visit_(i, node2.items[i], visitor,
|
|
6985
|
+
const ci = visit_(i, node2.items[i], visitor, path18);
|
|
6986
6986
|
if (typeof ci === "number")
|
|
6987
6987
|
i = ci - 1;
|
|
6988
6988
|
else if (ci === BREAK)
|
|
@@ -6993,13 +6993,13 @@ var require_visit = __commonJS({
|
|
|
6993
6993
|
}
|
|
6994
6994
|
}
|
|
6995
6995
|
} else if (identity.isPair(node2)) {
|
|
6996
|
-
|
|
6997
|
-
const ck = visit_("key", node2.key, visitor,
|
|
6996
|
+
path18 = Object.freeze(path18.concat(node2));
|
|
6997
|
+
const ck = visit_("key", node2.key, visitor, path18);
|
|
6998
6998
|
if (ck === BREAK)
|
|
6999
6999
|
return BREAK;
|
|
7000
7000
|
else if (ck === REMOVE)
|
|
7001
7001
|
node2.key = null;
|
|
7002
|
-
const cv = visit_("value", node2.value, visitor,
|
|
7002
|
+
const cv = visit_("value", node2.value, visitor, path18);
|
|
7003
7003
|
if (cv === BREAK)
|
|
7004
7004
|
return BREAK;
|
|
7005
7005
|
else if (cv === REMOVE)
|
|
@@ -7020,17 +7020,17 @@ var require_visit = __commonJS({
|
|
|
7020
7020
|
visitAsync.BREAK = BREAK;
|
|
7021
7021
|
visitAsync.SKIP = SKIP;
|
|
7022
7022
|
visitAsync.REMOVE = REMOVE;
|
|
7023
|
-
async function visitAsync_(key, node2, visitor,
|
|
7024
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
7023
|
+
async function visitAsync_(key, node2, visitor, path18) {
|
|
7024
|
+
const ctrl = await callVisitor(key, node2, visitor, path18);
|
|
7025
7025
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
7026
|
-
replaceNode(key,
|
|
7027
|
-
return visitAsync_(key, ctrl, visitor,
|
|
7026
|
+
replaceNode(key, path18, ctrl);
|
|
7027
|
+
return visitAsync_(key, ctrl, visitor, path18);
|
|
7028
7028
|
}
|
|
7029
7029
|
if (typeof ctrl !== "symbol") {
|
|
7030
7030
|
if (identity.isCollection(node2)) {
|
|
7031
|
-
|
|
7031
|
+
path18 = Object.freeze(path18.concat(node2));
|
|
7032
7032
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
7033
|
-
const ci = await visitAsync_(i, node2.items[i], visitor,
|
|
7033
|
+
const ci = await visitAsync_(i, node2.items[i], visitor, path18);
|
|
7034
7034
|
if (typeof ci === "number")
|
|
7035
7035
|
i = ci - 1;
|
|
7036
7036
|
else if (ci === BREAK)
|
|
@@ -7041,13 +7041,13 @@ var require_visit = __commonJS({
|
|
|
7041
7041
|
}
|
|
7042
7042
|
}
|
|
7043
7043
|
} else if (identity.isPair(node2)) {
|
|
7044
|
-
|
|
7045
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
7044
|
+
path18 = Object.freeze(path18.concat(node2));
|
|
7045
|
+
const ck = await visitAsync_("key", node2.key, visitor, path18);
|
|
7046
7046
|
if (ck === BREAK)
|
|
7047
7047
|
return BREAK;
|
|
7048
7048
|
else if (ck === REMOVE)
|
|
7049
7049
|
node2.key = null;
|
|
7050
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
7050
|
+
const cv = await visitAsync_("value", node2.value, visitor, path18);
|
|
7051
7051
|
if (cv === BREAK)
|
|
7052
7052
|
return BREAK;
|
|
7053
7053
|
else if (cv === REMOVE)
|
|
@@ -7074,23 +7074,23 @@ var require_visit = __commonJS({
|
|
|
7074
7074
|
}
|
|
7075
7075
|
return visitor;
|
|
7076
7076
|
}
|
|
7077
|
-
function callVisitor(key, node2, visitor,
|
|
7077
|
+
function callVisitor(key, node2, visitor, path18) {
|
|
7078
7078
|
if (typeof visitor === "function")
|
|
7079
|
-
return visitor(key, node2,
|
|
7079
|
+
return visitor(key, node2, path18);
|
|
7080
7080
|
if (identity.isMap(node2))
|
|
7081
|
-
return visitor.Map?.(key, node2,
|
|
7081
|
+
return visitor.Map?.(key, node2, path18);
|
|
7082
7082
|
if (identity.isSeq(node2))
|
|
7083
|
-
return visitor.Seq?.(key, node2,
|
|
7083
|
+
return visitor.Seq?.(key, node2, path18);
|
|
7084
7084
|
if (identity.isPair(node2))
|
|
7085
|
-
return visitor.Pair?.(key, node2,
|
|
7085
|
+
return visitor.Pair?.(key, node2, path18);
|
|
7086
7086
|
if (identity.isScalar(node2))
|
|
7087
|
-
return visitor.Scalar?.(key, node2,
|
|
7087
|
+
return visitor.Scalar?.(key, node2, path18);
|
|
7088
7088
|
if (identity.isAlias(node2))
|
|
7089
|
-
return visitor.Alias?.(key, node2,
|
|
7089
|
+
return visitor.Alias?.(key, node2, path18);
|
|
7090
7090
|
return void 0;
|
|
7091
7091
|
}
|
|
7092
|
-
function replaceNode(key,
|
|
7093
|
-
const parent =
|
|
7092
|
+
function replaceNode(key, path18, node2) {
|
|
7093
|
+
const parent = path18[path18.length - 1];
|
|
7094
7094
|
if (identity.isCollection(parent)) {
|
|
7095
7095
|
parent.items[key] = node2;
|
|
7096
7096
|
} else if (identity.isPair(parent)) {
|
|
@@ -7702,10 +7702,10 @@ var require_Collection = __commonJS({
|
|
|
7702
7702
|
var createNode = require_createNode();
|
|
7703
7703
|
var identity = require_identity();
|
|
7704
7704
|
var Node = require_Node();
|
|
7705
|
-
function collectionFromPath(schema,
|
|
7705
|
+
function collectionFromPath(schema, path18, value) {
|
|
7706
7706
|
let v = value;
|
|
7707
|
-
for (let i =
|
|
7708
|
-
const k =
|
|
7707
|
+
for (let i = path18.length - 1; i >= 0; --i) {
|
|
7708
|
+
const k = path18[i];
|
|
7709
7709
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
7710
7710
|
const a = [];
|
|
7711
7711
|
a[k] = v;
|
|
@@ -7724,7 +7724,7 @@ var require_Collection = __commonJS({
|
|
|
7724
7724
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
7725
7725
|
});
|
|
7726
7726
|
}
|
|
7727
|
-
var isEmptyPath = (
|
|
7727
|
+
var isEmptyPath = (path18) => path18 == null || typeof path18 === "object" && !!path18[Symbol.iterator]().next().done;
|
|
7728
7728
|
var Collection = class extends Node.NodeBase {
|
|
7729
7729
|
constructor(type, schema) {
|
|
7730
7730
|
super(type);
|
|
@@ -7754,11 +7754,11 @@ var require_Collection = __commonJS({
|
|
|
7754
7754
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
7755
7755
|
* that already exists in the map.
|
|
7756
7756
|
*/
|
|
7757
|
-
addIn(
|
|
7758
|
-
if (isEmptyPath(
|
|
7757
|
+
addIn(path18, value) {
|
|
7758
|
+
if (isEmptyPath(path18))
|
|
7759
7759
|
this.add(value);
|
|
7760
7760
|
else {
|
|
7761
|
-
const [key, ...rest] =
|
|
7761
|
+
const [key, ...rest] = path18;
|
|
7762
7762
|
const node2 = this.get(key, true);
|
|
7763
7763
|
if (identity.isCollection(node2))
|
|
7764
7764
|
node2.addIn(rest, value);
|
|
@@ -7772,8 +7772,8 @@ var require_Collection = __commonJS({
|
|
|
7772
7772
|
* Removes a value from the collection.
|
|
7773
7773
|
* @returns `true` if the item was found and removed.
|
|
7774
7774
|
*/
|
|
7775
|
-
deleteIn(
|
|
7776
|
-
const [key, ...rest] =
|
|
7775
|
+
deleteIn(path18) {
|
|
7776
|
+
const [key, ...rest] = path18;
|
|
7777
7777
|
if (rest.length === 0)
|
|
7778
7778
|
return this.delete(key);
|
|
7779
7779
|
const node2 = this.get(key, true);
|
|
@@ -7787,8 +7787,8 @@ var require_Collection = __commonJS({
|
|
|
7787
7787
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
7788
7788
|
* `true` (collections are always returned intact).
|
|
7789
7789
|
*/
|
|
7790
|
-
getIn(
|
|
7791
|
-
const [key, ...rest] =
|
|
7790
|
+
getIn(path18, keepScalar) {
|
|
7791
|
+
const [key, ...rest] = path18;
|
|
7792
7792
|
const node2 = this.get(key, true);
|
|
7793
7793
|
if (rest.length === 0)
|
|
7794
7794
|
return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
|
|
@@ -7806,8 +7806,8 @@ var require_Collection = __commonJS({
|
|
|
7806
7806
|
/**
|
|
7807
7807
|
* Checks if the collection includes a value with the key `key`.
|
|
7808
7808
|
*/
|
|
7809
|
-
hasIn(
|
|
7810
|
-
const [key, ...rest] =
|
|
7809
|
+
hasIn(path18) {
|
|
7810
|
+
const [key, ...rest] = path18;
|
|
7811
7811
|
if (rest.length === 0)
|
|
7812
7812
|
return this.has(key);
|
|
7813
7813
|
const node2 = this.get(key, true);
|
|
@@ -7817,8 +7817,8 @@ var require_Collection = __commonJS({
|
|
|
7817
7817
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
7818
7818
|
* boolean to add/remove the item from the set.
|
|
7819
7819
|
*/
|
|
7820
|
-
setIn(
|
|
7821
|
-
const [key, ...rest] =
|
|
7820
|
+
setIn(path18, value) {
|
|
7821
|
+
const [key, ...rest] = path18;
|
|
7822
7822
|
if (rest.length === 0) {
|
|
7823
7823
|
this.set(key, value);
|
|
7824
7824
|
} else {
|
|
@@ -10333,9 +10333,9 @@ var require_Document = __commonJS({
|
|
|
10333
10333
|
this.contents.add(value);
|
|
10334
10334
|
}
|
|
10335
10335
|
/** Adds a value to the document. */
|
|
10336
|
-
addIn(
|
|
10336
|
+
addIn(path18, value) {
|
|
10337
10337
|
if (assertCollection(this.contents))
|
|
10338
|
-
this.contents.addIn(
|
|
10338
|
+
this.contents.addIn(path18, value);
|
|
10339
10339
|
}
|
|
10340
10340
|
/**
|
|
10341
10341
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -10410,14 +10410,14 @@ var require_Document = __commonJS({
|
|
|
10410
10410
|
* Removes a value from the document.
|
|
10411
10411
|
* @returns `true` if the item was found and removed.
|
|
10412
10412
|
*/
|
|
10413
|
-
deleteIn(
|
|
10414
|
-
if (Collection.isEmptyPath(
|
|
10413
|
+
deleteIn(path18) {
|
|
10414
|
+
if (Collection.isEmptyPath(path18)) {
|
|
10415
10415
|
if (this.contents == null)
|
|
10416
10416
|
return false;
|
|
10417
10417
|
this.contents = null;
|
|
10418
10418
|
return true;
|
|
10419
10419
|
}
|
|
10420
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
10420
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path18) : false;
|
|
10421
10421
|
}
|
|
10422
10422
|
/**
|
|
10423
10423
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -10432,10 +10432,10 @@ var require_Document = __commonJS({
|
|
|
10432
10432
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
10433
10433
|
* `true` (collections are always returned intact).
|
|
10434
10434
|
*/
|
|
10435
|
-
getIn(
|
|
10436
|
-
if (Collection.isEmptyPath(
|
|
10435
|
+
getIn(path18, keepScalar) {
|
|
10436
|
+
if (Collection.isEmptyPath(path18))
|
|
10437
10437
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
10438
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
10438
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path18, keepScalar) : void 0;
|
|
10439
10439
|
}
|
|
10440
10440
|
/**
|
|
10441
10441
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -10446,10 +10446,10 @@ var require_Document = __commonJS({
|
|
|
10446
10446
|
/**
|
|
10447
10447
|
* Checks if the document includes a value at `path`.
|
|
10448
10448
|
*/
|
|
10449
|
-
hasIn(
|
|
10450
|
-
if (Collection.isEmptyPath(
|
|
10449
|
+
hasIn(path18) {
|
|
10450
|
+
if (Collection.isEmptyPath(path18))
|
|
10451
10451
|
return this.contents !== void 0;
|
|
10452
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
10452
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path18) : false;
|
|
10453
10453
|
}
|
|
10454
10454
|
/**
|
|
10455
10455
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -10466,13 +10466,13 @@ var require_Document = __commonJS({
|
|
|
10466
10466
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
10467
10467
|
* boolean to add/remove the item from the set.
|
|
10468
10468
|
*/
|
|
10469
|
-
setIn(
|
|
10470
|
-
if (Collection.isEmptyPath(
|
|
10469
|
+
setIn(path18, value) {
|
|
10470
|
+
if (Collection.isEmptyPath(path18)) {
|
|
10471
10471
|
this.contents = value;
|
|
10472
10472
|
} else if (this.contents == null) {
|
|
10473
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
10473
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path18), value);
|
|
10474
10474
|
} else if (assertCollection(this.contents)) {
|
|
10475
|
-
this.contents.setIn(
|
|
10475
|
+
this.contents.setIn(path18, value);
|
|
10476
10476
|
}
|
|
10477
10477
|
}
|
|
10478
10478
|
/**
|
|
@@ -10858,10 +10858,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
10858
10858
|
let offset = bm.offset;
|
|
10859
10859
|
let commentEnd = null;
|
|
10860
10860
|
for (const collItem of bm.items) {
|
|
10861
|
-
const { start, key, sep:
|
|
10861
|
+
const { start, key, sep: sep6, value } = collItem;
|
|
10862
10862
|
const keyProps = resolveProps.resolveProps(start, {
|
|
10863
10863
|
indicator: "explicit-key-ind",
|
|
10864
|
-
next: key ??
|
|
10864
|
+
next: key ?? sep6?.[0],
|
|
10865
10865
|
offset,
|
|
10866
10866
|
onError,
|
|
10867
10867
|
parentIndent: bm.indent,
|
|
@@ -10875,7 +10875,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
10875
10875
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
10876
10876
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
10877
10877
|
}
|
|
10878
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
10878
|
+
if (!keyProps.anchor && !keyProps.tag && !sep6) {
|
|
10879
10879
|
commentEnd = keyProps.end;
|
|
10880
10880
|
if (keyProps.comment) {
|
|
10881
10881
|
if (map.comment)
|
|
@@ -10899,7 +10899,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
10899
10899
|
ctx.atKey = false;
|
|
10900
10900
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
10901
10901
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
10902
|
-
const valueProps = resolveProps.resolveProps(
|
|
10902
|
+
const valueProps = resolveProps.resolveProps(sep6 ?? [], {
|
|
10903
10903
|
indicator: "map-value-ind",
|
|
10904
10904
|
next: value,
|
|
10905
10905
|
offset: keyNode.range[2],
|
|
@@ -10915,7 +10915,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
10915
10915
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
10916
10916
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
10917
10917
|
}
|
|
10918
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
10918
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep6, null, valueProps, onError);
|
|
10919
10919
|
if (ctx.schema.compat)
|
|
10920
10920
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
10921
10921
|
offset = valueNode.range[2];
|
|
@@ -11006,7 +11006,7 @@ var require_resolve_end = __commonJS({
|
|
|
11006
11006
|
let comment = "";
|
|
11007
11007
|
if (end) {
|
|
11008
11008
|
let hasSpace = false;
|
|
11009
|
-
let
|
|
11009
|
+
let sep6 = "";
|
|
11010
11010
|
for (const token of end) {
|
|
11011
11011
|
const { source, type } = token;
|
|
11012
11012
|
switch (type) {
|
|
@@ -11020,13 +11020,13 @@ var require_resolve_end = __commonJS({
|
|
|
11020
11020
|
if (!comment)
|
|
11021
11021
|
comment = cb;
|
|
11022
11022
|
else
|
|
11023
|
-
comment +=
|
|
11024
|
-
|
|
11023
|
+
comment += sep6 + cb;
|
|
11024
|
+
sep6 = "";
|
|
11025
11025
|
break;
|
|
11026
11026
|
}
|
|
11027
11027
|
case "newline":
|
|
11028
11028
|
if (comment)
|
|
11029
|
-
|
|
11029
|
+
sep6 += source;
|
|
11030
11030
|
hasSpace = true;
|
|
11031
11031
|
break;
|
|
11032
11032
|
default:
|
|
@@ -11069,18 +11069,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11069
11069
|
let offset = fc.offset + fc.start.source.length;
|
|
11070
11070
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
11071
11071
|
const collItem = fc.items[i];
|
|
11072
|
-
const { start, key, sep:
|
|
11072
|
+
const { start, key, sep: sep6, value } = collItem;
|
|
11073
11073
|
const props = resolveProps.resolveProps(start, {
|
|
11074
11074
|
flow: fcName,
|
|
11075
11075
|
indicator: "explicit-key-ind",
|
|
11076
|
-
next: key ??
|
|
11076
|
+
next: key ?? sep6?.[0],
|
|
11077
11077
|
offset,
|
|
11078
11078
|
onError,
|
|
11079
11079
|
parentIndent: fc.indent,
|
|
11080
11080
|
startOnNewline: false
|
|
11081
11081
|
});
|
|
11082
11082
|
if (!props.found) {
|
|
11083
|
-
if (!props.anchor && !props.tag && !
|
|
11083
|
+
if (!props.anchor && !props.tag && !sep6 && !value) {
|
|
11084
11084
|
if (i === 0 && props.comma)
|
|
11085
11085
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
11086
11086
|
else if (i < fc.items.length - 1)
|
|
@@ -11134,8 +11134,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11134
11134
|
}
|
|
11135
11135
|
}
|
|
11136
11136
|
}
|
|
11137
|
-
if (!isMap && !
|
|
11138
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
11137
|
+
if (!isMap && !sep6 && !props.found) {
|
|
11138
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep6, null, props, onError);
|
|
11139
11139
|
coll.items.push(valueNode);
|
|
11140
11140
|
offset = valueNode.range[2];
|
|
11141
11141
|
if (isBlock(value))
|
|
@@ -11147,7 +11147,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11147
11147
|
if (isBlock(key))
|
|
11148
11148
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
11149
11149
|
ctx.atKey = false;
|
|
11150
|
-
const valueProps = resolveProps.resolveProps(
|
|
11150
|
+
const valueProps = resolveProps.resolveProps(sep6 ?? [], {
|
|
11151
11151
|
flow: fcName,
|
|
11152
11152
|
indicator: "map-value-ind",
|
|
11153
11153
|
next: value,
|
|
@@ -11158,8 +11158,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11158
11158
|
});
|
|
11159
11159
|
if (valueProps.found) {
|
|
11160
11160
|
if (!isMap && !props.found && ctx.options.strict) {
|
|
11161
|
-
if (
|
|
11162
|
-
for (const st of
|
|
11161
|
+
if (sep6)
|
|
11162
|
+
for (const st of sep6) {
|
|
11163
11163
|
if (st === valueProps.found)
|
|
11164
11164
|
break;
|
|
11165
11165
|
if (st.type === "newline") {
|
|
@@ -11176,7 +11176,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11176
11176
|
else
|
|
11177
11177
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
11178
11178
|
}
|
|
11179
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
11179
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep6, null, valueProps, onError) : null;
|
|
11180
11180
|
if (valueNode) {
|
|
11181
11181
|
if (isBlock(value))
|
|
11182
11182
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -11356,7 +11356,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
11356
11356
|
chompStart = i + 1;
|
|
11357
11357
|
}
|
|
11358
11358
|
let value = "";
|
|
11359
|
-
let
|
|
11359
|
+
let sep6 = "";
|
|
11360
11360
|
let prevMoreIndented = false;
|
|
11361
11361
|
for (let i = 0; i < contentStart; ++i)
|
|
11362
11362
|
value += lines[i][0].slice(trimIndent) + "\n";
|
|
@@ -11373,24 +11373,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
11373
11373
|
indent = "";
|
|
11374
11374
|
}
|
|
11375
11375
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
11376
|
-
value +=
|
|
11377
|
-
|
|
11376
|
+
value += sep6 + indent.slice(trimIndent) + content;
|
|
11377
|
+
sep6 = "\n";
|
|
11378
11378
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
11379
|
-
if (
|
|
11380
|
-
|
|
11381
|
-
else if (!prevMoreIndented &&
|
|
11382
|
-
|
|
11383
|
-
value +=
|
|
11384
|
-
|
|
11379
|
+
if (sep6 === " ")
|
|
11380
|
+
sep6 = "\n";
|
|
11381
|
+
else if (!prevMoreIndented && sep6 === "\n")
|
|
11382
|
+
sep6 = "\n\n";
|
|
11383
|
+
value += sep6 + indent.slice(trimIndent) + content;
|
|
11384
|
+
sep6 = "\n";
|
|
11385
11385
|
prevMoreIndented = true;
|
|
11386
11386
|
} else if (content === "") {
|
|
11387
|
-
if (
|
|
11387
|
+
if (sep6 === "\n")
|
|
11388
11388
|
value += "\n";
|
|
11389
11389
|
else
|
|
11390
|
-
|
|
11390
|
+
sep6 = "\n";
|
|
11391
11391
|
} else {
|
|
11392
|
-
value +=
|
|
11393
|
-
|
|
11392
|
+
value += sep6 + content;
|
|
11393
|
+
sep6 = " ";
|
|
11394
11394
|
prevMoreIndented = false;
|
|
11395
11395
|
}
|
|
11396
11396
|
}
|
|
@@ -11573,25 +11573,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
11573
11573
|
trimBoth = /^[ \t]+|[ \t]+$/g;
|
|
11574
11574
|
}
|
|
11575
11575
|
let res = match[1].replace(trimEnd, "");
|
|
11576
|
-
let
|
|
11576
|
+
let sep6 = " ";
|
|
11577
11577
|
let pos = line.lastIndex;
|
|
11578
11578
|
while (match = line.exec(source)) {
|
|
11579
11579
|
const lm = match[1].replace(trimBoth, "");
|
|
11580
11580
|
if (lm === "") {
|
|
11581
|
-
if (
|
|
11582
|
-
res +=
|
|
11581
|
+
if (sep6 === "\n")
|
|
11582
|
+
res += sep6;
|
|
11583
11583
|
else
|
|
11584
|
-
|
|
11584
|
+
sep6 = "\n";
|
|
11585
11585
|
} else {
|
|
11586
|
-
res +=
|
|
11587
|
-
|
|
11586
|
+
res += sep6 + lm;
|
|
11587
|
+
sep6 = " ";
|
|
11588
11588
|
}
|
|
11589
11589
|
pos = line.lastIndex;
|
|
11590
11590
|
}
|
|
11591
11591
|
const last = /[ \t]*(.*)/sy;
|
|
11592
11592
|
last.lastIndex = pos;
|
|
11593
11593
|
match = last.exec(source);
|
|
11594
|
-
return res +
|
|
11594
|
+
return res + sep6 + (match?.[1] ?? "");
|
|
11595
11595
|
}
|
|
11596
11596
|
function doubleQuotedValue(source, onError) {
|
|
11597
11597
|
let res = "";
|
|
@@ -12401,14 +12401,14 @@ var require_cst_stringify = __commonJS({
|
|
|
12401
12401
|
}
|
|
12402
12402
|
}
|
|
12403
12403
|
}
|
|
12404
|
-
function stringifyItem({ start, key, sep:
|
|
12404
|
+
function stringifyItem({ start, key, sep: sep6, value }) {
|
|
12405
12405
|
let res = "";
|
|
12406
12406
|
for (const st of start)
|
|
12407
12407
|
res += st.source;
|
|
12408
12408
|
if (key)
|
|
12409
12409
|
res += stringifyToken(key);
|
|
12410
|
-
if (
|
|
12411
|
-
for (const st of
|
|
12410
|
+
if (sep6)
|
|
12411
|
+
for (const st of sep6)
|
|
12412
12412
|
res += st.source;
|
|
12413
12413
|
if (value)
|
|
12414
12414
|
res += stringifyToken(value);
|
|
@@ -12433,9 +12433,9 @@ var require_cst_visit = __commonJS({
|
|
|
12433
12433
|
visit.BREAK = BREAK;
|
|
12434
12434
|
visit.SKIP = SKIP;
|
|
12435
12435
|
visit.REMOVE = REMOVE;
|
|
12436
|
-
visit.itemAtPath = (cst,
|
|
12436
|
+
visit.itemAtPath = (cst, path18) => {
|
|
12437
12437
|
let item = cst;
|
|
12438
|
-
for (const [field, index] of
|
|
12438
|
+
for (const [field, index] of path18) {
|
|
12439
12439
|
const tok = item?.[field];
|
|
12440
12440
|
if (tok && "items" in tok) {
|
|
12441
12441
|
item = tok.items[index];
|
|
@@ -12444,23 +12444,23 @@ var require_cst_visit = __commonJS({
|
|
|
12444
12444
|
}
|
|
12445
12445
|
return item;
|
|
12446
12446
|
};
|
|
12447
|
-
visit.parentCollection = (cst,
|
|
12448
|
-
const parent = visit.itemAtPath(cst,
|
|
12449
|
-
const field =
|
|
12447
|
+
visit.parentCollection = (cst, path18) => {
|
|
12448
|
+
const parent = visit.itemAtPath(cst, path18.slice(0, -1));
|
|
12449
|
+
const field = path18[path18.length - 1][0];
|
|
12450
12450
|
const coll = parent?.[field];
|
|
12451
12451
|
if (coll && "items" in coll)
|
|
12452
12452
|
return coll;
|
|
12453
12453
|
throw new Error("Parent collection not found");
|
|
12454
12454
|
};
|
|
12455
|
-
function _visit(
|
|
12456
|
-
let ctrl = visitor(item,
|
|
12455
|
+
function _visit(path18, item, visitor) {
|
|
12456
|
+
let ctrl = visitor(item, path18);
|
|
12457
12457
|
if (typeof ctrl === "symbol")
|
|
12458
12458
|
return ctrl;
|
|
12459
12459
|
for (const field of ["key", "value"]) {
|
|
12460
12460
|
const token = item[field];
|
|
12461
12461
|
if (token && "items" in token) {
|
|
12462
12462
|
for (let i = 0; i < token.items.length; ++i) {
|
|
12463
|
-
const ci = _visit(Object.freeze(
|
|
12463
|
+
const ci = _visit(Object.freeze(path18.concat([[field, i]])), token.items[i], visitor);
|
|
12464
12464
|
if (typeof ci === "number")
|
|
12465
12465
|
i = ci - 1;
|
|
12466
12466
|
else if (ci === BREAK)
|
|
@@ -12471,10 +12471,10 @@ var require_cst_visit = __commonJS({
|
|
|
12471
12471
|
}
|
|
12472
12472
|
}
|
|
12473
12473
|
if (typeof ctrl === "function" && field === "key")
|
|
12474
|
-
ctrl = ctrl(item,
|
|
12474
|
+
ctrl = ctrl(item, path18);
|
|
12475
12475
|
}
|
|
12476
12476
|
}
|
|
12477
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
12477
|
+
return typeof ctrl === "function" ? ctrl(item, path18) : ctrl;
|
|
12478
12478
|
}
|
|
12479
12479
|
exports.visit = visit;
|
|
12480
12480
|
}
|
|
@@ -13575,18 +13575,18 @@ var require_parser = __commonJS({
|
|
|
13575
13575
|
if (this.type === "map-value-ind") {
|
|
13576
13576
|
const prev = getPrevProps(this.peek(2));
|
|
13577
13577
|
const start = getFirstKeyStartProps(prev);
|
|
13578
|
-
let
|
|
13578
|
+
let sep6;
|
|
13579
13579
|
if (scalar.end) {
|
|
13580
|
-
|
|
13581
|
-
|
|
13580
|
+
sep6 = scalar.end;
|
|
13581
|
+
sep6.push(this.sourceToken);
|
|
13582
13582
|
delete scalar.end;
|
|
13583
13583
|
} else
|
|
13584
|
-
|
|
13584
|
+
sep6 = [this.sourceToken];
|
|
13585
13585
|
const map = {
|
|
13586
13586
|
type: "block-map",
|
|
13587
13587
|
offset: scalar.offset,
|
|
13588
13588
|
indent: scalar.indent,
|
|
13589
|
-
items: [{ start, key: scalar, sep:
|
|
13589
|
+
items: [{ start, key: scalar, sep: sep6 }]
|
|
13590
13590
|
};
|
|
13591
13591
|
this.onKeyLine = true;
|
|
13592
13592
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -13739,15 +13739,15 @@ var require_parser = __commonJS({
|
|
|
13739
13739
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
13740
13740
|
const start2 = getFirstKeyStartProps(it.start);
|
|
13741
13741
|
const key = it.key;
|
|
13742
|
-
const
|
|
13743
|
-
|
|
13742
|
+
const sep6 = it.sep;
|
|
13743
|
+
sep6.push(this.sourceToken);
|
|
13744
13744
|
delete it.key;
|
|
13745
13745
|
delete it.sep;
|
|
13746
13746
|
this.stack.push({
|
|
13747
13747
|
type: "block-map",
|
|
13748
13748
|
offset: this.offset,
|
|
13749
13749
|
indent: this.indent,
|
|
13750
|
-
items: [{ start: start2, key, sep:
|
|
13750
|
+
items: [{ start: start2, key, sep: sep6 }]
|
|
13751
13751
|
});
|
|
13752
13752
|
} else if (start.length > 0) {
|
|
13753
13753
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -13776,14 +13776,14 @@ var require_parser = __commonJS({
|
|
|
13776
13776
|
case "scalar":
|
|
13777
13777
|
case "single-quoted-scalar":
|
|
13778
13778
|
case "double-quoted-scalar": {
|
|
13779
|
-
const
|
|
13779
|
+
const fs13 = this.flowScalar(this.type);
|
|
13780
13780
|
if (atNextItem || it.value) {
|
|
13781
|
-
map.items.push({ start, key:
|
|
13781
|
+
map.items.push({ start, key: fs13, sep: [] });
|
|
13782
13782
|
this.onKeyLine = true;
|
|
13783
13783
|
} else if (it.sep) {
|
|
13784
|
-
this.stack.push(
|
|
13784
|
+
this.stack.push(fs13);
|
|
13785
13785
|
} else {
|
|
13786
|
-
Object.assign(it, { key:
|
|
13786
|
+
Object.assign(it, { key: fs13, sep: [] });
|
|
13787
13787
|
this.onKeyLine = true;
|
|
13788
13788
|
}
|
|
13789
13789
|
return;
|
|
@@ -13911,13 +13911,13 @@ var require_parser = __commonJS({
|
|
|
13911
13911
|
case "scalar":
|
|
13912
13912
|
case "single-quoted-scalar":
|
|
13913
13913
|
case "double-quoted-scalar": {
|
|
13914
|
-
const
|
|
13914
|
+
const fs13 = this.flowScalar(this.type);
|
|
13915
13915
|
if (!it || it.value)
|
|
13916
|
-
fc.items.push({ start: [], key:
|
|
13916
|
+
fc.items.push({ start: [], key: fs13, sep: [] });
|
|
13917
13917
|
else if (it.sep)
|
|
13918
|
-
this.stack.push(
|
|
13918
|
+
this.stack.push(fs13);
|
|
13919
13919
|
else
|
|
13920
|
-
Object.assign(it, { key:
|
|
13920
|
+
Object.assign(it, { key: fs13, sep: [] });
|
|
13921
13921
|
return;
|
|
13922
13922
|
}
|
|
13923
13923
|
case "flow-map-end":
|
|
@@ -13941,13 +13941,13 @@ var require_parser = __commonJS({
|
|
|
13941
13941
|
const prev = getPrevProps(parent);
|
|
13942
13942
|
const start = getFirstKeyStartProps(prev);
|
|
13943
13943
|
fixFlowSeqItems(fc);
|
|
13944
|
-
const
|
|
13945
|
-
|
|
13944
|
+
const sep6 = fc.end.splice(1, fc.end.length);
|
|
13945
|
+
sep6.push(this.sourceToken);
|
|
13946
13946
|
const map = {
|
|
13947
13947
|
type: "block-map",
|
|
13948
13948
|
offset: fc.offset,
|
|
13949
13949
|
indent: fc.indent,
|
|
13950
|
-
items: [{ start, key: fc, sep:
|
|
13950
|
+
items: [{ start, key: fc, sep: sep6 }]
|
|
13951
13951
|
};
|
|
13952
13952
|
this.onKeyLine = true;
|
|
13953
13953
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -14125,7 +14125,7 @@ var require_public_api = __commonJS({
|
|
|
14125
14125
|
}
|
|
14126
14126
|
return doc;
|
|
14127
14127
|
}
|
|
14128
|
-
function
|
|
14128
|
+
function parse4(src, reviver, options) {
|
|
14129
14129
|
let _reviver = void 0;
|
|
14130
14130
|
if (typeof reviver === "function") {
|
|
14131
14131
|
_reviver = reviver;
|
|
@@ -14166,7 +14166,7 @@ var require_public_api = __commonJS({
|
|
|
14166
14166
|
return value.toString(options);
|
|
14167
14167
|
return new Document.Document(value, _replacer, options).toString(options);
|
|
14168
14168
|
}
|
|
14169
|
-
exports.parse =
|
|
14169
|
+
exports.parse = parse4;
|
|
14170
14170
|
exports.parseAllDocuments = parseAllDocuments;
|
|
14171
14171
|
exports.parseDocument = parseDocument;
|
|
14172
14172
|
exports.stringify = stringify;
|
|
@@ -14619,8 +14619,9 @@ var require_dist3 = __commonJS({
|
|
|
14619
14619
|
|
|
14620
14620
|
// ../argent-mcp/src/mcp-server.ts
|
|
14621
14621
|
import { appendFile, mkdir as mkdir5 } from "node:fs/promises";
|
|
14622
|
-
import { dirname as
|
|
14622
|
+
import { dirname as dirname11 } from "node:path";
|
|
14623
14623
|
import { homedir as homedir5 } from "node:os";
|
|
14624
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
14624
14625
|
|
|
14625
14626
|
// ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
14626
14627
|
import process2 from "node:process";
|
|
@@ -14862,10 +14863,10 @@ function mergeDefs(...defs) {
|
|
|
14862
14863
|
function cloneDef(schema) {
|
|
14863
14864
|
return mergeDefs(schema._zod.def);
|
|
14864
14865
|
}
|
|
14865
|
-
function getElementAtPath(obj,
|
|
14866
|
-
if (!
|
|
14866
|
+
function getElementAtPath(obj, path18) {
|
|
14867
|
+
if (!path18)
|
|
14867
14868
|
return obj;
|
|
14868
|
-
return
|
|
14869
|
+
return path18.reduce((acc, key) => acc?.[key], obj);
|
|
14869
14870
|
}
|
|
14870
14871
|
function promiseAllObject(promisesObj) {
|
|
14871
14872
|
const keys = Object.keys(promisesObj);
|
|
@@ -15205,11 +15206,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
15205
15206
|
}
|
|
15206
15207
|
return false;
|
|
15207
15208
|
}
|
|
15208
|
-
function prefixIssues(
|
|
15209
|
+
function prefixIssues(path18, issues) {
|
|
15209
15210
|
return issues.map((iss) => {
|
|
15210
15211
|
var _a3;
|
|
15211
15212
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
15212
|
-
iss.path.unshift(
|
|
15213
|
+
iss.path.unshift(path18);
|
|
15213
15214
|
return iss;
|
|
15214
15215
|
});
|
|
15215
15216
|
}
|
|
@@ -15667,16 +15668,16 @@ function flattenError(error2, mapper = (issue2) => issue2.message) {
|
|
|
15667
15668
|
}
|
|
15668
15669
|
function formatError(error2, mapper = (issue2) => issue2.message) {
|
|
15669
15670
|
const fieldErrors = { _errors: [] };
|
|
15670
|
-
const processError = (error3,
|
|
15671
|
+
const processError = (error3, path18 = []) => {
|
|
15671
15672
|
for (const issue2 of error3.issues) {
|
|
15672
15673
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
15673
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
15674
|
+
issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
|
|
15674
15675
|
} else if (issue2.code === "invalid_key") {
|
|
15675
|
-
processError({ issues: issue2.issues }, [...
|
|
15676
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
15676
15677
|
} else if (issue2.code === "invalid_element") {
|
|
15677
|
-
processError({ issues: issue2.issues }, [...
|
|
15678
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
15678
15679
|
} else {
|
|
15679
|
-
const fullpath = [...
|
|
15680
|
+
const fullpath = [...path18, ...issue2.path];
|
|
15680
15681
|
if (fullpath.length === 0) {
|
|
15681
15682
|
fieldErrors._errors.push(mapper(issue2));
|
|
15682
15683
|
} else {
|
|
@@ -15819,17 +15820,17 @@ var validateAsync = async (schema, value, _ctx) => {
|
|
|
15819
15820
|
return result.issues.length === 0;
|
|
15820
15821
|
};
|
|
15821
15822
|
var _encode = (_Err) => {
|
|
15822
|
-
const
|
|
15823
|
+
const parse4 = _parse(_Err);
|
|
15823
15824
|
const fn = (schema, value, _ctx, _params) => {
|
|
15824
15825
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
15825
|
-
return
|
|
15826
|
+
return parse4(schema, value, ctx, finalizeParams(fn, _params));
|
|
15826
15827
|
};
|
|
15827
15828
|
return fn;
|
|
15828
15829
|
};
|
|
15829
15830
|
var _decode = (_Err) => {
|
|
15830
|
-
const
|
|
15831
|
+
const parse4 = _parse(_Err);
|
|
15831
15832
|
const fn = (schema, value, _ctx, _params) => {
|
|
15832
|
-
return
|
|
15833
|
+
return parse4(schema, value, _ctx, finalizeParams(fn, _params));
|
|
15833
15834
|
};
|
|
15834
15835
|
return fn;
|
|
15835
15836
|
};
|
|
@@ -16866,7 +16867,7 @@ function capSize(inst, size) {
|
|
|
16866
16867
|
if (!caps.length)
|
|
16867
16868
|
return;
|
|
16868
16869
|
const cap = Math.min(...caps.map((c) => c[0]));
|
|
16869
|
-
const
|
|
16870
|
+
const parse4 = inst._zod.parse;
|
|
16870
16871
|
inst._zod.parse = (payload, ctx) => {
|
|
16871
16872
|
const n = size(payload.value);
|
|
16872
16873
|
if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
|
|
@@ -16880,7 +16881,7 @@ function capSize(inst, size) {
|
|
|
16880
16881
|
}
|
|
16881
16882
|
}
|
|
16882
16883
|
}
|
|
16883
|
-
return
|
|
16884
|
+
return parse4(payload, ctx);
|
|
16884
16885
|
};
|
|
16885
16886
|
}
|
|
16886
16887
|
var arraySize = (input) => Array.isArray(input) ? input.length : -1;
|
|
@@ -17976,7 +17977,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
17976
17977
|
var NONE = 0;
|
|
17977
17978
|
var ASSUMED = 1;
|
|
17978
17979
|
var PROVEN = 2;
|
|
17979
|
-
function isRecursive(inst, stack,
|
|
17980
|
+
function isRecursive(inst, stack, resolve12) {
|
|
17980
17981
|
const cached2 = recursive.get(inst);
|
|
17981
17982
|
if (cached2 !== void 0)
|
|
17982
17983
|
return cached2 ? PROVEN : NONE;
|
|
@@ -17986,7 +17987,7 @@ function isRecursive(inst, stack, resolve10) {
|
|
|
17986
17987
|
let result = NONE;
|
|
17987
17988
|
const check = (child) => {
|
|
17988
17989
|
if (result !== PROVEN && child?._zod) {
|
|
17989
|
-
const answer = isRecursive(child, stack,
|
|
17990
|
+
const answer = isRecursive(child, stack, resolve12);
|
|
17990
17991
|
if (answer > result)
|
|
17991
17992
|
result = answer;
|
|
17992
17993
|
}
|
|
@@ -17997,7 +17998,7 @@ function isRecursive(inst, stack, resolve10) {
|
|
|
17997
17998
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
17998
17999
|
if (spread && !desc.enumerable)
|
|
17999
18000
|
continue;
|
|
18000
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
18001
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve12) : NONE;
|
|
18001
18002
|
if (child > answer)
|
|
18002
18003
|
answer = child;
|
|
18003
18004
|
}
|
|
@@ -18061,7 +18062,7 @@ function isRecursive(inst, stack, resolve10) {
|
|
|
18061
18062
|
break;
|
|
18062
18063
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
18063
18064
|
case "lazy": {
|
|
18064
|
-
const inner = def._cachedInner ?? (
|
|
18065
|
+
const inner = def._cachedInner ?? (resolve12 ? inst._zod.innerType : void 0);
|
|
18065
18066
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
18066
18067
|
break;
|
|
18067
18068
|
}
|
|
@@ -22639,12 +22640,12 @@ var StdioServerTransport = class {
|
|
|
22639
22640
|
this.onclose?.();
|
|
22640
22641
|
}
|
|
22641
22642
|
send(message) {
|
|
22642
|
-
return new Promise((
|
|
22643
|
+
return new Promise((resolve12) => {
|
|
22643
22644
|
const json = serializeMessage(message);
|
|
22644
22645
|
if (this._stdout.write(json)) {
|
|
22645
|
-
|
|
22646
|
+
resolve12();
|
|
22646
22647
|
} else {
|
|
22647
|
-
this._stdout.once("drain",
|
|
22648
|
+
this._stdout.once("drain", resolve12);
|
|
22648
22649
|
}
|
|
22649
22650
|
});
|
|
22650
22651
|
}
|
|
@@ -23264,7 +23265,7 @@ var Protocol = class {
|
|
|
23264
23265
|
return;
|
|
23265
23266
|
}
|
|
23266
23267
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
23267
|
-
await new Promise((
|
|
23268
|
+
await new Promise((resolve12) => setTimeout(resolve12, pollInterval));
|
|
23268
23269
|
options?.signal?.throwIfAborted();
|
|
23269
23270
|
}
|
|
23270
23271
|
} catch (error2) {
|
|
@@ -23281,7 +23282,7 @@ var Protocol = class {
|
|
|
23281
23282
|
*/
|
|
23282
23283
|
request(request, resultSchema, options) {
|
|
23283
23284
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
23284
|
-
return new Promise((
|
|
23285
|
+
return new Promise((resolve12, reject) => {
|
|
23285
23286
|
const earlyReject = (error2) => {
|
|
23286
23287
|
reject(error2);
|
|
23287
23288
|
};
|
|
@@ -23359,7 +23360,7 @@ var Protocol = class {
|
|
|
23359
23360
|
if (!parseResult.success) {
|
|
23360
23361
|
reject(parseResult.error);
|
|
23361
23362
|
} else {
|
|
23362
|
-
|
|
23363
|
+
resolve12(parseResult.data);
|
|
23363
23364
|
}
|
|
23364
23365
|
} catch (error2) {
|
|
23365
23366
|
reject(error2);
|
|
@@ -23621,12 +23622,12 @@ var Protocol = class {
|
|
|
23621
23622
|
}
|
|
23622
23623
|
} catch {
|
|
23623
23624
|
}
|
|
23624
|
-
return new Promise((
|
|
23625
|
+
return new Promise((resolve12, reject) => {
|
|
23625
23626
|
if (signal.aborted) {
|
|
23626
23627
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
23627
23628
|
return;
|
|
23628
23629
|
}
|
|
23629
|
-
const timeoutId = setTimeout(
|
|
23630
|
+
const timeoutId = setTimeout(resolve12, interval);
|
|
23630
23631
|
signal.addEventListener("abort", () => {
|
|
23631
23632
|
clearTimeout(timeoutId);
|
|
23632
23633
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -24422,6 +24423,7 @@ var LOCK_FILE = path.join(STATE_DIR, "tool-server.lock");
|
|
|
24422
24423
|
var AUTH_TOKEN_BYTES = 32;
|
|
24423
24424
|
var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
|
|
24424
24425
|
var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
|
|
24426
|
+
var AUTOSPAWN_HOST = "127.0.0.1";
|
|
24425
24427
|
function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
24426
24428
|
const env = {
|
|
24427
24429
|
...baseEnv,
|
|
@@ -24433,7 +24435,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
|
24433
24435
|
if (options.idleTimeoutMinutes !== void 0) {
|
|
24434
24436
|
env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
|
|
24435
24437
|
}
|
|
24436
|
-
|
|
24438
|
+
env[AUTH_TOKEN_ENV] = options.token ?? "";
|
|
24437
24439
|
if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
|
|
24438
24440
|
if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
|
|
24439
24441
|
return env;
|
|
@@ -24442,7 +24444,7 @@ function generateToken() {
|
|
|
24442
24444
|
return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
|
|
24443
24445
|
}
|
|
24444
24446
|
function findFreePort() {
|
|
24445
|
-
return new Promise((
|
|
24447
|
+
return new Promise((resolve12, reject) => {
|
|
24446
24448
|
const srv = net.createServer();
|
|
24447
24449
|
srv.listen(0, "127.0.0.1", () => {
|
|
24448
24450
|
const addr = srv.address();
|
|
@@ -24453,21 +24455,21 @@ function findFreePort() {
|
|
|
24453
24455
|
const port = addr.port;
|
|
24454
24456
|
srv.close((err) => {
|
|
24455
24457
|
if (err) reject(err);
|
|
24456
|
-
else
|
|
24458
|
+
else resolve12(port);
|
|
24457
24459
|
});
|
|
24458
24460
|
});
|
|
24459
24461
|
srv.on("error", reject);
|
|
24460
24462
|
});
|
|
24461
24463
|
}
|
|
24462
24464
|
function isVersionNewer(a, b) {
|
|
24463
|
-
const
|
|
24465
|
+
const parse4 = (v) => {
|
|
24464
24466
|
const [core = "", ...preParts] = v.split("+")[0].split("-");
|
|
24465
24467
|
const nums = core.split(".").map((n) => Number.parseInt(n, 10));
|
|
24466
24468
|
if (nums.length === 0 || nums.some((n) => Number.isNaN(n))) return null;
|
|
24467
24469
|
return { nums, pre: preParts.length > 0 ? preParts.join("-").split(".") : [] };
|
|
24468
24470
|
};
|
|
24469
|
-
const pa =
|
|
24470
|
-
const pb =
|
|
24471
|
+
const pa = parse4(a);
|
|
24472
|
+
const pb = parse4(b);
|
|
24471
24473
|
if (!pa || !pb) return false;
|
|
24472
24474
|
for (let i = 0; i < 3; i++) {
|
|
24473
24475
|
const x = pa.nums[i] ?? 0;
|
|
@@ -24550,8 +24552,12 @@ function killSpawnedChild(child, pid) {
|
|
|
24550
24552
|
}
|
|
24551
24553
|
}
|
|
24552
24554
|
}
|
|
24555
|
+
function resolveToolsServerNode() {
|
|
24556
|
+
const { bun, deno, electron } = process.versions;
|
|
24557
|
+
return !(bun || deno || electron) && fs.existsSync(process.execPath) ? process.execPath : "node";
|
|
24558
|
+
}
|
|
24553
24559
|
function spawnToolsServer(paths, port, options = {}) {
|
|
24554
|
-
return new Promise((
|
|
24560
|
+
return new Promise((resolve12, reject) => {
|
|
24555
24561
|
let logFd;
|
|
24556
24562
|
try {
|
|
24557
24563
|
fs.mkdirSync(STATE_DIR, { recursive: true });
|
|
@@ -24559,8 +24565,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
24559
24565
|
} catch {
|
|
24560
24566
|
logFd = fs.openSync("/dev/null", "w");
|
|
24561
24567
|
}
|
|
24562
|
-
const
|
|
24563
|
-
const nodeBin = !(bun || deno || electron) && fs.existsSync(process.execPath) ? process.execPath : "node";
|
|
24568
|
+
const nodeBin = resolveToolsServerNode();
|
|
24564
24569
|
const child = spawn(nodeBin, [paths.bundlePath, "start"], {
|
|
24565
24570
|
detached: true,
|
|
24566
24571
|
stdio: ["ignore", "pipe", logFd],
|
|
@@ -24598,7 +24603,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
24598
24603
|
rl.close();
|
|
24599
24604
|
child.stdout?.resume();
|
|
24600
24605
|
child.stdout?.unref?.();
|
|
24601
|
-
settle2(() =>
|
|
24606
|
+
settle2(() => resolve12({ port: actualPort, pid }));
|
|
24602
24607
|
}
|
|
24603
24608
|
});
|
|
24604
24609
|
child.on("error", (err) => {
|
|
@@ -24874,6 +24879,7 @@ async function ensureToolsServer(paths) {
|
|
|
24874
24879
|
const port = await findFreePort();
|
|
24875
24880
|
const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
|
|
24876
24881
|
token,
|
|
24882
|
+
host: AUTOSPAWN_HOST,
|
|
24877
24883
|
idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES
|
|
24878
24884
|
});
|
|
24879
24885
|
await writeState({
|
|
@@ -24882,11 +24888,11 @@ async function ensureToolsServer(paths) {
|
|
|
24882
24888
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
24883
24889
|
bundlePath: paths.bundlePath,
|
|
24884
24890
|
version: diskVersion,
|
|
24885
|
-
host:
|
|
24891
|
+
host: AUTOSPAWN_HOST,
|
|
24886
24892
|
token,
|
|
24887
24893
|
managed: "autospawn"
|
|
24888
24894
|
});
|
|
24889
|
-
return { url: formatUrl(
|
|
24895
|
+
return { url: formatUrl(AUTOSPAWN_HOST, actualPort), token };
|
|
24890
24896
|
} finally {
|
|
24891
24897
|
lock?.release();
|
|
24892
24898
|
}
|
|
@@ -24939,6 +24945,11 @@ var FLAG_REGISTRY = [
|
|
|
24939
24945
|
name: "forward-secrets",
|
|
24940
24946
|
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."
|
|
24941
24947
|
},
|
|
24948
|
+
{
|
|
24949
|
+
name: "ios-audio-always-inserted",
|
|
24950
|
+
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.",
|
|
24951
|
+
defaultEnabled: true
|
|
24952
|
+
},
|
|
24942
24953
|
{
|
|
24943
24954
|
name: "video-watermark",
|
|
24944
24955
|
description: "Overlay the argent corner watermark on recorded screen videos. On by default; turn it off with `argent disable video-watermark`.",
|
|
@@ -24946,7 +24957,7 @@ var FLAG_REGISTRY = [
|
|
|
24946
24957
|
},
|
|
24947
24958
|
{
|
|
24948
24959
|
name: "macos-apps",
|
|
24949
|
-
description: "
|
|
24960
|
+
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`.",
|
|
24950
24961
|
defaultEnabled: true
|
|
24951
24962
|
}
|
|
24952
24963
|
];
|
|
@@ -25016,6 +25027,7 @@ function isFeatureEnabled(name, options = {}, registry2 = FLAG_REGISTRY) {
|
|
|
25016
25027
|
}
|
|
25017
25028
|
|
|
25018
25029
|
// ../configuration-core/src/paths.ts
|
|
25030
|
+
import * as fs3 from "node:fs";
|
|
25019
25031
|
import * as os from "node:os";
|
|
25020
25032
|
import * as path3 from "node:path";
|
|
25021
25033
|
function nonEmpty(value) {
|
|
@@ -25027,6 +25039,16 @@ function resolveHomeDir(options = {}) {
|
|
|
25027
25039
|
if (options.homeDir) return options.homeDir;
|
|
25028
25040
|
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
25029
25041
|
}
|
|
25042
|
+
function isHomeDir(dir, options = {}) {
|
|
25043
|
+
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
25044
|
+
}
|
|
25045
|
+
function canonicalPath(p) {
|
|
25046
|
+
try {
|
|
25047
|
+
return fs3.realpathSync.native(p);
|
|
25048
|
+
} catch {
|
|
25049
|
+
return path3.resolve(p);
|
|
25050
|
+
}
|
|
25051
|
+
}
|
|
25030
25052
|
function argentHomeDir() {
|
|
25031
25053
|
return path3.join(resolveHomeDir(), ".argent");
|
|
25032
25054
|
}
|
|
@@ -25043,11 +25065,11 @@ function configFilePath(scope = "global", options = {}) {
|
|
|
25043
25065
|
|
|
25044
25066
|
// ../configuration-core/src/config.ts
|
|
25045
25067
|
import * as crypto from "node:crypto";
|
|
25046
|
-
import * as
|
|
25068
|
+
import * as fs4 from "node:fs";
|
|
25047
25069
|
import * as path4 from "node:path";
|
|
25048
25070
|
function readConfigObject(scope = "global", options = {}) {
|
|
25049
25071
|
try {
|
|
25050
|
-
const raw2 =
|
|
25072
|
+
const raw2 = fs4.readFileSync(configFilePath(scope, options), "utf8");
|
|
25051
25073
|
const json = JSON.parse(raw2);
|
|
25052
25074
|
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
25053
25075
|
return json;
|
|
@@ -25092,9 +25114,9 @@ function acquireConfigLock(finalPath) {
|
|
|
25092
25114
|
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
25093
25115
|
for (; ; ) {
|
|
25094
25116
|
try {
|
|
25095
|
-
const fd =
|
|
25117
|
+
const fd = fs4.openSync(lockPath, "wx", 384);
|
|
25096
25118
|
try {
|
|
25097
|
-
|
|
25119
|
+
fs4.writeSync(fd, `${process.pid}
|
|
25098
25120
|
`);
|
|
25099
25121
|
} catch {
|
|
25100
25122
|
}
|
|
@@ -25102,8 +25124,8 @@ function acquireConfigLock(finalPath) {
|
|
|
25102
25124
|
} catch (err) {
|
|
25103
25125
|
if (err.code !== "EEXIST") return null;
|
|
25104
25126
|
try {
|
|
25105
|
-
if (Date.now() -
|
|
25106
|
-
|
|
25127
|
+
if (Date.now() - fs4.statSync(lockPath).mtimeMs > LOCK_STALE_MS2) {
|
|
25128
|
+
fs4.unlinkSync(lockPath);
|
|
25107
25129
|
continue;
|
|
25108
25130
|
}
|
|
25109
25131
|
} catch {
|
|
@@ -25115,35 +25137,35 @@ function acquireConfigLock(finalPath) {
|
|
|
25115
25137
|
}
|
|
25116
25138
|
function releaseConfigLock(lock) {
|
|
25117
25139
|
try {
|
|
25118
|
-
|
|
25140
|
+
fs4.closeSync(lock.fd);
|
|
25119
25141
|
} catch {
|
|
25120
25142
|
}
|
|
25121
25143
|
try {
|
|
25122
|
-
|
|
25144
|
+
fs4.unlinkSync(lock.lockPath);
|
|
25123
25145
|
} catch {
|
|
25124
25146
|
}
|
|
25125
25147
|
}
|
|
25126
25148
|
function updateConfig(mutate, scope = "global", options = {}) {
|
|
25127
25149
|
const dir = configDir(scope, options);
|
|
25128
|
-
|
|
25150
|
+
fs4.mkdirSync(dir, { recursive: true });
|
|
25129
25151
|
const finalPath = configFilePath(scope, options);
|
|
25130
25152
|
const lock = acquireConfigLock(finalPath);
|
|
25131
25153
|
try {
|
|
25132
25154
|
const next = readConfigObject(scope, options);
|
|
25133
25155
|
mutate(next);
|
|
25134
25156
|
const tmpPath = path4.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
25135
|
-
const fd =
|
|
25157
|
+
const fd = fs4.openSync(tmpPath, "wx", 384);
|
|
25136
25158
|
try {
|
|
25137
|
-
|
|
25138
|
-
|
|
25159
|
+
fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
25160
|
+
fs4.fsyncSync(fd);
|
|
25139
25161
|
} finally {
|
|
25140
|
-
|
|
25162
|
+
fs4.closeSync(fd);
|
|
25141
25163
|
}
|
|
25142
25164
|
try {
|
|
25143
|
-
|
|
25165
|
+
fs4.renameSync(tmpPath, finalPath);
|
|
25144
25166
|
} catch (err) {
|
|
25145
25167
|
try {
|
|
25146
|
-
|
|
25168
|
+
fs4.unlinkSync(tmpPath);
|
|
25147
25169
|
} catch {
|
|
25148
25170
|
}
|
|
25149
25171
|
throw err;
|
|
@@ -25155,7 +25177,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
25155
25177
|
|
|
25156
25178
|
// ../configuration-core/src/secrets.ts
|
|
25157
25179
|
var import_dotenv = __toESM(require_dist3(), 1);
|
|
25158
|
-
import * as
|
|
25180
|
+
import * as fs5 from "node:fs";
|
|
25159
25181
|
import * as path5 from "node:path";
|
|
25160
25182
|
var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
|
|
25161
25183
|
var SECRETS_FILE_NAME = "secrets.env";
|
|
@@ -25185,10 +25207,10 @@ function fileSource(filePath, exposure) {
|
|
|
25185
25207
|
names: [],
|
|
25186
25208
|
values: /* @__PURE__ */ new Map()
|
|
25187
25209
|
};
|
|
25188
|
-
if (!
|
|
25210
|
+
if (!fs5.statSync(filePath, { throwIfNoEntry: false })) return absent;
|
|
25189
25211
|
let content;
|
|
25190
25212
|
try {
|
|
25191
|
-
content =
|
|
25213
|
+
content = fs5.readFileSync(filePath, "utf8");
|
|
25192
25214
|
} catch {
|
|
25193
25215
|
return absent;
|
|
25194
25216
|
}
|
|
@@ -25214,7 +25236,9 @@ function fileSource(filePath, exposure) {
|
|
|
25214
25236
|
}
|
|
25215
25237
|
function secretSources(options = {}) {
|
|
25216
25238
|
const sources = [envSource(options.env ?? process.env)];
|
|
25217
|
-
const
|
|
25239
|
+
const home = resolveHomeDir(options);
|
|
25240
|
+
const found = findProjectRoot(options.cwd ?? process.cwd());
|
|
25241
|
+
const projectRoot = found && isHomeDir(found, options) ? home : found;
|
|
25218
25242
|
const filePaths = [];
|
|
25219
25243
|
if (projectRoot) {
|
|
25220
25244
|
filePaths.push({
|
|
@@ -25226,7 +25250,7 @@ function secretSources(options = {}) {
|
|
|
25226
25250
|
}
|
|
25227
25251
|
}
|
|
25228
25252
|
filePaths.push({
|
|
25229
|
-
path: path5.join(
|
|
25253
|
+
path: path5.join(home, ".argent", SECRETS_FILE_NAME),
|
|
25230
25254
|
exposure: "dedicated"
|
|
25231
25255
|
});
|
|
25232
25256
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -25348,14 +25372,6 @@ var CONFIG_SCHEMA = [
|
|
|
25348
25372
|
// drained/reset, not just the file rewritten.
|
|
25349
25373
|
manageCommand: "argent telemetry"
|
|
25350
25374
|
},
|
|
25351
|
-
{
|
|
25352
|
-
key: "allowlist.enabled",
|
|
25353
|
-
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.",
|
|
25354
|
-
scopes: ["project", "global"],
|
|
25355
|
-
parse: asBoolean,
|
|
25356
|
-
merge: "prioritize-restrictive",
|
|
25357
|
-
example: "false"
|
|
25358
|
-
},
|
|
25359
25375
|
{
|
|
25360
25376
|
key: "lens.agent",
|
|
25361
25377
|
description: "Coding-agent id remembered by `argent lens` to skip the picker.",
|
|
@@ -25506,7 +25522,18 @@ function interpolateFileInputPath(template, args) {
|
|
|
25506
25522
|
});
|
|
25507
25523
|
return missing ? null : out;
|
|
25508
25524
|
}
|
|
25509
|
-
var TOOL_FILE_EXTENSIONS = [
|
|
25525
|
+
var TOOL_FILE_EXTENSIONS = [
|
|
25526
|
+
".png",
|
|
25527
|
+
".yaml",
|
|
25528
|
+
".wav",
|
|
25529
|
+
".mp3",
|
|
25530
|
+
".m4a",
|
|
25531
|
+
".aac",
|
|
25532
|
+
".caf",
|
|
25533
|
+
".aif",
|
|
25534
|
+
".aiff",
|
|
25535
|
+
".flac"
|
|
25536
|
+
];
|
|
25510
25537
|
function hasToolFileExtension(file) {
|
|
25511
25538
|
const name = file.toLowerCase();
|
|
25512
25539
|
return TOOL_FILE_EXTENSIONS.some((extension) => name.endsWith(extension));
|
|
@@ -25520,16 +25547,24 @@ function toolStepFiles(specs, args) {
|
|
|
25520
25547
|
}
|
|
25521
25548
|
return files;
|
|
25522
25549
|
}
|
|
25523
|
-
|
|
25524
|
-
|
|
25550
|
+
var UNEXPANDED_PATH = /^~|\$[A-Za-z0-9_{(]|`|%[A-Za-z_][A-Za-z0-9_]*%|^[A-Za-z][A-Za-z0-9+.-]+:/;
|
|
25551
|
+
function isUnexpandedPath(p) {
|
|
25552
|
+
return UNEXPANDED_PATH.test(p);
|
|
25525
25553
|
}
|
|
25554
|
+
function isClientFileArgument({ spec, path: path18 }) {
|
|
25555
|
+
return spec.kind === "file" && spec.path === `\${${spec.target}}` && path18.startsWith("/") && hasToolFileExtension(path18);
|
|
25556
|
+
}
|
|
25557
|
+
|
|
25558
|
+
// ../registry/src/flow-platforms.ts
|
|
25559
|
+
var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
|
|
25560
|
+
var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
|
|
25526
25561
|
|
|
25527
25562
|
// ../registry/src/flow-file-refs.ts
|
|
25528
|
-
import * as
|
|
25563
|
+
import * as fs7 from "node:fs/promises";
|
|
25529
25564
|
import * as path8 from "node:path";
|
|
25530
25565
|
|
|
25531
25566
|
// ../registry/src/e2e-dirs.ts
|
|
25532
|
-
import * as
|
|
25567
|
+
import * as fs6 from "node:fs/promises";
|
|
25533
25568
|
import * as path7 from "node:path";
|
|
25534
25569
|
var E2E_DIR = path7.join(".argent", "e2e");
|
|
25535
25570
|
var LEGACY_E2E_DIRS = Object.freeze([path7.join(".argent", "flows")]);
|
|
@@ -25544,7 +25579,7 @@ function e2eFileCandidates(projectRoot, name) {
|
|
|
25544
25579
|
return e2eDirsFor(projectRoot).map((dir) => path7.join(dir, `${name}.yaml`));
|
|
25545
25580
|
}
|
|
25546
25581
|
async function exists(file) {
|
|
25547
|
-
return
|
|
25582
|
+
return fs6.stat(file).then(
|
|
25548
25583
|
() => true,
|
|
25549
25584
|
() => false
|
|
25550
25585
|
);
|
|
@@ -25635,10 +25670,10 @@ function canonicalToolArgs(tool, args) {
|
|
|
25635
25670
|
// ../registry/src/flow-file-refs.ts
|
|
25636
25671
|
async function canonicalFlowPath(p) {
|
|
25637
25672
|
try {
|
|
25638
|
-
return await
|
|
25673
|
+
return await fs7.realpath(p);
|
|
25639
25674
|
} catch {
|
|
25640
25675
|
try {
|
|
25641
|
-
return path8.join(await
|
|
25676
|
+
return path8.join(await fs7.realpath(path8.dirname(p)), path8.basename(p));
|
|
25642
25677
|
} catch {
|
|
25643
25678
|
return p;
|
|
25644
25679
|
}
|
|
@@ -25654,6 +25689,9 @@ var MAX_BLOCK_NESTING = 64;
|
|
|
25654
25689
|
function isRecord(value) {
|
|
25655
25690
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25656
25691
|
}
|
|
25692
|
+
function flowYamlSource(content) {
|
|
25693
|
+
return content.replace(/^\s+/, (lead) => lead.replace(/[^\n]/g, "")).trimEnd();
|
|
25694
|
+
}
|
|
25657
25695
|
function collectFlowRequests(doc) {
|
|
25658
25696
|
const runTargets = /* @__PURE__ */ new Set();
|
|
25659
25697
|
const snapshots = /* @__PURE__ */ new Set();
|
|
@@ -25684,15 +25722,15 @@ function collectFlowRequests(doc) {
|
|
|
25684
25722
|
if (isRecord(doc)) visit(doc.steps, 0);
|
|
25685
25723
|
return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
|
|
25686
25724
|
}
|
|
25687
|
-
function baselineKeyFor(
|
|
25688
|
-
const stem = path8.basename(
|
|
25725
|
+
function baselineKeyFor(canonicalPath2, flowName) {
|
|
25726
|
+
const stem = path8.basename(canonicalPath2, ".yaml");
|
|
25689
25727
|
return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
|
|
25690
25728
|
}
|
|
25691
25729
|
function flowMemberKey(anchorDir, target) {
|
|
25692
25730
|
return `${anchorDir}\0${target}`;
|
|
25693
25731
|
}
|
|
25694
25732
|
async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
|
|
25695
|
-
const entries = await
|
|
25733
|
+
const entries = await fs7.readdir(dir).catch(() => null);
|
|
25696
25734
|
if (entries === null || entries.includes(base)) return { state: "listed" };
|
|
25697
25735
|
const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
|
|
25698
25736
|
if (actual === void 0) return { state: "absent" };
|
|
@@ -25802,6 +25840,10 @@ var FAILURE_CODES = {
|
|
|
25802
25840
|
ANDROID_ADB_COMMAND_FAILED: "ANDROID_ADB_COMMAND_FAILED",
|
|
25803
25841
|
ANDROID_ADB_BOOT_TERMINAL_STATE: "ANDROID_ADB_BOOT_TERMINAL_STATE",
|
|
25804
25842
|
ANDROID_ADB_BOOT_TIMEOUT: "ANDROID_ADB_BOOT_TIMEOUT",
|
|
25843
|
+
ANDROID_NETWORK_PROXY_TIMEOUT: "ANDROID_NETWORK_PROXY_TIMEOUT",
|
|
25844
|
+
ANDROID_NETWORK_RESTORE_TIMEOUT: "ANDROID_NETWORK_RESTORE_TIMEOUT",
|
|
25845
|
+
ANDROID_OFFLINE_TIMEOUT: "ANDROID_OFFLINE_TIMEOUT",
|
|
25846
|
+
ANDROID_OFFLINE_UNSUPPORTED: "ANDROID_OFFLINE_UNSUPPORTED",
|
|
25805
25847
|
SIMULATOR_NETWORK_TIMEOUT: "SIMULATOR_NETWORK_TIMEOUT",
|
|
25806
25848
|
SIMULATOR_NETWORK_CONNECTION_REFUSED: "SIMULATOR_NETWORK_CONNECTION_REFUSED",
|
|
25807
25849
|
SIMULATOR_NETWORK_CONNECTION_RESET: "SIMULATOR_NETWORK_CONNECTION_RESET",
|
|
@@ -25921,12 +25963,15 @@ var FAILURE_CODES = {
|
|
|
25921
25963
|
DEBUGGER_CDP_PROTOCOL_ERROR: "DEBUGGER_CDP_PROTOCOL_ERROR",
|
|
25922
25964
|
DEBUGGER_CDP_CONNECT_FAILED: "DEBUGGER_CDP_CONNECT_FAILED",
|
|
25923
25965
|
DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN: "DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN",
|
|
25966
|
+
DEBUGGER_CDP_ORIGIN_REJECTED: "DEBUGGER_CDP_ORIGIN_REJECTED",
|
|
25924
25967
|
DEBUGGER_CDP_NOT_CONNECTED: "DEBUGGER_CDP_NOT_CONNECTED",
|
|
25925
25968
|
DEBUGGER_CDP_REQUEST_TIMEOUT: "DEBUGGER_CDP_REQUEST_TIMEOUT",
|
|
25926
25969
|
DEBUGGER_CDP_CONNECTION_CLOSED: "DEBUGGER_CDP_CONNECTION_CLOSED",
|
|
25927
25970
|
DEBUGGER_TARGET_DEVICE_MISMATCH: "DEBUGGER_TARGET_DEVICE_MISMATCH",
|
|
25928
25971
|
DEBUGGER_EVALUATE_EXPRESSION_THREW: "DEBUGGER_EVALUATE_EXPRESSION_THREW",
|
|
25929
25972
|
DEBUGGER_RELOAD_FAILED: "DEBUGGER_RELOAD_FAILED",
|
|
25973
|
+
// e2e-add-step refused a debugger-* call that answered `not_connected`.
|
|
25974
|
+
DEBUGGER_NOT_CONNECTED: "DEBUGGER_NOT_CONNECTED",
|
|
25930
25975
|
JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED: "JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED",
|
|
25931
25976
|
JS_RUNTIME_PAYLOAD_INVALID: "JS_RUNTIME_PAYLOAD_INVALID",
|
|
25932
25977
|
JS_RUNTIME_PAYLOAD_DEVICE_MISSING: "JS_RUNTIME_PAYLOAD_DEVICE_MISSING",
|
|
@@ -25940,7 +25985,7 @@ var FAILURE_CODES = {
|
|
|
25940
25985
|
ANDROID_NETWORK_INSPECTOR_RUN_AS_FAILED: "ANDROID_NETWORK_INSPECTOR_RUN_AS_FAILED",
|
|
25941
25986
|
ANDROID_NETWORK_INSPECTOR_DEVICE_IN_USE: "ANDROID_NETWORK_INSPECTOR_DEVICE_IN_USE",
|
|
25942
25987
|
ANDROID_NETWORK_INSPECTOR_NO_DEVICE_PORT: "ANDROID_NETWORK_INSPECTOR_NO_DEVICE_PORT",
|
|
25943
|
-
|
|
25988
|
+
NETWORK_CAPTURE_UNAVAILABLE: "NETWORK_CAPTURE_UNAVAILABLE",
|
|
25944
25989
|
NDJSON_CDP_REQUEST_TIMEOUT: "NDJSON_CDP_REQUEST_TIMEOUT",
|
|
25945
25990
|
NDJSON_CDP_REQUEST_FAILED: "NDJSON_CDP_REQUEST_FAILED",
|
|
25946
25991
|
NDJSON_CDP_CONNECTION_CLOSED: "NDJSON_CDP_CONNECTION_CLOSED",
|
|
@@ -25995,6 +26040,32 @@ var FAILURE_CODES = {
|
|
|
25995
26040
|
NATIVE_PROFILER_PERFETTO_PROCESS_ERROR: "NATIVE_PROFILER_PERFETTO_PROCESS_ERROR",
|
|
25996
26041
|
NATIVE_PROFILER_PERFETTO_READY_TIMEOUT: "NATIVE_PROFILER_PERFETTO_READY_TIMEOUT",
|
|
25997
26042
|
NATIVE_PROFILER_PERFETTO_READY_EXITED: "NATIVE_PROFILER_PERFETTO_READY_EXITED",
|
|
26043
|
+
/**
|
|
26044
|
+
* native-profiler-launch-analysis. Input problems use TOOL_INPUT_INVALID and
|
|
26045
|
+
* devicectl steps IOS_DEVICECTL_COMMAND_FAILED.
|
|
26046
|
+
* @see [workflow.ts](../../tool-server/src/utils/ios-launch-time/workflow.ts)
|
|
26047
|
+
*/
|
|
26048
|
+
// Not macOS, or an Xcode that cannot record the launch on this target.
|
|
26049
|
+
LAUNCH_ANALYSIS_UNSUPPORTED_HOST: "LAUNCH_ANALYSIS_UNSUPPORTED_HOST",
|
|
26050
|
+
// No usable iPhone or simulator was selected, or Argent's runner holds it.
|
|
26051
|
+
LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE: "LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE",
|
|
26052
|
+
// The bundle_id app is not installed on the selected device.
|
|
26053
|
+
LAUNCH_ANALYSIS_APP_NOT_INSTALLED: "LAUNCH_ANALYSIS_APP_NOT_INSTALLED",
|
|
26054
|
+
// The runner's xcodebuild failed on code signing or provisioning.
|
|
26055
|
+
LAUNCH_ANALYSIS_SIGNING_FAILED: "LAUNCH_ANALYSIS_SIGNING_FAILED",
|
|
26056
|
+
// The iPhone's free developer profile has no slot for Argent's runner.
|
|
26057
|
+
LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT: "LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT",
|
|
26058
|
+
// simctl could not wait for boot, find, launch or terminate the app.
|
|
26059
|
+
LAUNCH_ANALYSIS_SIMCTL_FAILED: "LAUNCH_ANALYSIS_SIMCTL_FAILED",
|
|
26060
|
+
LAUNCH_ANALYSIS_RECORD_FAILED: "LAUNCH_ANALYSIS_RECORD_FAILED",
|
|
26061
|
+
// xctrace could not export the TOC, the CPU samples or the first-frame marker.
|
|
26062
|
+
LAUNCH_ANALYSIS_EXPORT_FAILED: "LAUNCH_ANALYSIS_EXPORT_FAILED",
|
|
26063
|
+
// The App Launch trace has no first frame of the app, so it has no launch window.
|
|
26064
|
+
LAUNCH_ANALYSIS_NO_FIRST_FRAME: "LAUNCH_ANALYSIS_NO_FIRST_FRAME",
|
|
26065
|
+
// The XCTest launch run of Argent's runner failed.
|
|
26066
|
+
LAUNCH_ANALYSIS_RUNNER_TEST_FAILED: "LAUNCH_ANALYSIS_RUNNER_TEST_FAILED",
|
|
26067
|
+
// The launch test ran, but Argent read no launch measurements from its result.
|
|
26068
|
+
LAUNCH_ANALYSIS_NO_SAMPLES: "LAUNCH_ANALYSIS_NO_SAMPLES",
|
|
25998
26069
|
// iOS and Android share one capture path (simulator-server frames into
|
|
25999
26070
|
// ffmpeg), so these name the failing stage, not the device family.
|
|
26000
26071
|
SCREEN_RECORDING_FACTORY_OPTIONS_MISSING: "SCREEN_RECORDING_FACTORY_OPTIONS_MISSING",
|
|
@@ -26009,6 +26080,19 @@ var FAILURE_CODES = {
|
|
|
26009
26080
|
SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
|
|
26010
26081
|
SCREEN_RECORDING_STREAM_UNAVAILABLE: "SCREEN_RECORDING_STREAM_UNAVAILABLE",
|
|
26011
26082
|
SCREEN_RECORDING_FFMPEG_NOT_FOUND: "SCREEN_RECORDING_FFMPEG_NOT_FOUND",
|
|
26083
|
+
// A cabled iPhone has no simulator-server: its frames come from a host-side
|
|
26084
|
+
// CoreMediaIO capture helper, which can fail in ways of its own.
|
|
26085
|
+
SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED",
|
|
26086
|
+
SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND: "SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND",
|
|
26087
|
+
SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED: "SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED",
|
|
26088
|
+
SCREEN_RECORDING_DEVICE_HELPER_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_FAILED",
|
|
26089
|
+
AUDIO_CLIP_CONVERSION_FAILED: "AUDIO_CLIP_CONVERSION_FAILED",
|
|
26090
|
+
AUDIO_HOOK_NOT_ACTIVE: "AUDIO_HOOK_NOT_ACTIVE",
|
|
26091
|
+
AUDIO_ENV_SETUP_FAILED: "AUDIO_ENV_SETUP_FAILED",
|
|
26092
|
+
AUDIO_WRONG_PLATFORM: "AUDIO_WRONG_PLATFORM",
|
|
26093
|
+
AUDIO_HOOK_UNAVAILABLE: "AUDIO_HOOK_UNAVAILABLE",
|
|
26094
|
+
AUDIO_INJECTION_NOT_OURS: "AUDIO_INJECTION_NOT_OURS",
|
|
26095
|
+
AUDIO_SIMULATOR_NOT_BOOTED: "AUDIO_SIMULATOR_NOT_BOOTED",
|
|
26012
26096
|
FLOW_PROJECT_ROOT_INVALID: "FLOW_PROJECT_ROOT_INVALID",
|
|
26013
26097
|
FLOW_NAME_INVALID: "FLOW_NAME_INVALID",
|
|
26014
26098
|
FLOW_NO_ACTIVE_RECORDING: "FLOW_NO_ACTIVE_RECORDING",
|
|
@@ -26072,6 +26156,8 @@ var FAILURE_CODES = {
|
|
|
26072
26156
|
MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
|
|
26073
26157
|
MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
|
|
26074
26158
|
MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
|
|
26159
|
+
/** The app's loaded Argent library lacks support for the requested operation. */
|
|
26160
|
+
MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
|
|
26075
26161
|
KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
|
|
26076
26162
|
KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
|
|
26077
26163
|
KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
|
|
@@ -26141,13 +26227,19 @@ var FAILURE_COMMANDS = [
|
|
|
26141
26227
|
"ax_service",
|
|
26142
26228
|
"simulator_server",
|
|
26143
26229
|
"ffmpeg",
|
|
26230
|
+
"afconvert",
|
|
26144
26231
|
"cdp",
|
|
26145
26232
|
"electron",
|
|
26146
26233
|
"npm",
|
|
26147
26234
|
"npx",
|
|
26148
26235
|
"unknown",
|
|
26149
26236
|
"devicectl",
|
|
26150
|
-
"xcodebuild"
|
|
26237
|
+
"xcodebuild",
|
|
26238
|
+
"swiftc",
|
|
26239
|
+
// The host-side helper that captures a cabled iPhone's screen.
|
|
26240
|
+
"ios_screen_stream",
|
|
26241
|
+
// `xcrun xcresulttool`, which reads an XCTest result bundle.
|
|
26242
|
+
"xcresulttool"
|
|
26151
26243
|
];
|
|
26152
26244
|
var FAILURE_SIGNAL_NAMES = [
|
|
26153
26245
|
"SIGABRT",
|
|
@@ -26178,9 +26270,9 @@ var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
|
|
|
26178
26270
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
26179
26271
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
26180
26272
|
var resolvedDuringInvocation = new AsyncLocalStorage();
|
|
26181
|
-
function valueAtPath(root,
|
|
26273
|
+
function valueAtPath(root, path18) {
|
|
26182
26274
|
let current = root;
|
|
26183
|
-
for (const key of
|
|
26275
|
+
for (const key of path18) {
|
|
26184
26276
|
if (current === null || typeof current !== "object") return void 0;
|
|
26185
26277
|
if (!Object.hasOwn(current, key)) return void 0;
|
|
26186
26278
|
current = current[key];
|
|
@@ -26302,7 +26394,7 @@ import { spawn as spawn2 } from "node:child_process";
|
|
|
26302
26394
|
import { once } from "node:events";
|
|
26303
26395
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
26304
26396
|
import { open as open2, rm, readdir as readdir3 } from "node:fs/promises";
|
|
26305
|
-
import { basename as basename4, dirname as dirname5, join as join9, resolve as
|
|
26397
|
+
import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve7, sep as sep2 } from "node:path";
|
|
26306
26398
|
import { Writable } from "node:stream";
|
|
26307
26399
|
import { pipeline } from "node:stream/promises";
|
|
26308
26400
|
import zlib from "node:zlib";
|
|
@@ -26400,7 +26492,7 @@ async function sniffFormat(archivePath) {
|
|
|
26400
26492
|
}
|
|
26401
26493
|
}
|
|
26402
26494
|
var ZSTD_FRAME_MAGIC = 4247762216;
|
|
26403
|
-
async function assertSingleCompleteZstdFrame(archivePath) {
|
|
26495
|
+
async function assertSingleCompleteZstdFrame(archivePath, signal) {
|
|
26404
26496
|
const fh = await open2(archivePath, "r");
|
|
26405
26497
|
try {
|
|
26406
26498
|
const { size } = await fh.stat();
|
|
@@ -26410,6 +26502,7 @@ async function assertSingleCompleteZstdFrame(archivePath) {
|
|
|
26410
26502
|
let pos = 0;
|
|
26411
26503
|
const read = async (n) => {
|
|
26412
26504
|
if (pos < windowStart || pos + n > windowEnd) {
|
|
26505
|
+
signal?.throwIfAborted();
|
|
26413
26506
|
const { bytesRead } = await fh.read(window, 0, window.length, pos);
|
|
26414
26507
|
windowStart = pos;
|
|
26415
26508
|
windowEnd = pos + bytesRead;
|
|
@@ -26447,14 +26540,16 @@ function tarEnv(env) {
|
|
|
26447
26540
|
const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
|
|
26448
26541
|
return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
|
|
26449
26542
|
}
|
|
26450
|
-
async function runTar(archive, args) {
|
|
26543
|
+
async function runTar(archive, args, signal) {
|
|
26451
26544
|
const child = spawn2("tar", [...args, "-f", "-"], {
|
|
26545
|
+
signal,
|
|
26452
26546
|
env: tarEnv(process.env)
|
|
26453
26547
|
});
|
|
26454
|
-
|
|
26455
|
-
|
|
26456
|
-
|
|
26548
|
+
let childError;
|
|
26549
|
+
child.on("error", (err) => {
|
|
26550
|
+
childError = err;
|
|
26457
26551
|
});
|
|
26552
|
+
const closed = new Promise((resolve12) => child.once("close", resolve12));
|
|
26458
26553
|
const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
|
|
26459
26554
|
maxLines: MAX_LISTING_LINES,
|
|
26460
26555
|
onOverflow: () => child.kill()
|
|
@@ -26481,12 +26576,15 @@ async function runTar(archive, args) {
|
|
|
26481
26576
|
if (err) child.stdin?.destroy();
|
|
26482
26577
|
done(err);
|
|
26483
26578
|
}
|
|
26484
|
-
})
|
|
26579
|
+
}),
|
|
26580
|
+
{ signal }
|
|
26485
26581
|
).then(
|
|
26486
26582
|
() => null,
|
|
26487
26583
|
(err) => err
|
|
26488
26584
|
);
|
|
26489
|
-
const [code, feedError] = await Promise.all([
|
|
26585
|
+
const [code, feedError] = await Promise.all([closed, fed]);
|
|
26586
|
+
signal?.throwIfAborted();
|
|
26587
|
+
if (childError) throw childError;
|
|
26490
26588
|
if (stdout.overflowed()) {
|
|
26491
26589
|
throw new Error(
|
|
26492
26590
|
`tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
|
|
@@ -26500,32 +26598,33 @@ async function runTar(archive, args) {
|
|
|
26500
26598
|
function normalizeTarMemberPath(memberPath) {
|
|
26501
26599
|
return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
26502
26600
|
}
|
|
26503
|
-
function isContainedPath(
|
|
26504
|
-
const slashed =
|
|
26601
|
+
function isContainedPath(path18, windows = process.platform === "win32") {
|
|
26602
|
+
const slashed = path18.replace(/\\/g, "/");
|
|
26505
26603
|
const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
|
|
26506
26604
|
return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
|
|
26507
26605
|
}
|
|
26508
26606
|
function isSafeTarMember(memberPath, destDir) {
|
|
26509
26607
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
26510
26608
|
if (!isContainedPath(normalized)) return false;
|
|
26511
|
-
const root =
|
|
26512
|
-
return
|
|
26609
|
+
const root = resolve7(destDir);
|
|
26610
|
+
return resolve7(destDir, normalized).startsWith(root + sep2);
|
|
26513
26611
|
}
|
|
26514
|
-
async function readListing(archive, args) {
|
|
26612
|
+
async function readListing(archive, args, signal) {
|
|
26515
26613
|
try {
|
|
26516
|
-
return await runTar(archive, args);
|
|
26614
|
+
return await runTar(archive, args, signal);
|
|
26517
26615
|
} catch (err) {
|
|
26616
|
+
signal?.throwIfAborted();
|
|
26518
26617
|
throw new ArchiveError(
|
|
26519
26618
|
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
26520
26619
|
);
|
|
26521
26620
|
}
|
|
26522
26621
|
}
|
|
26523
|
-
async function listTarMembers(archive) {
|
|
26524
|
-
const stdout = await readListing(archive, ["-t"]);
|
|
26622
|
+
async function listTarMembers(archive, signal) {
|
|
26623
|
+
const stdout = await readListing(archive, ["-t"], signal);
|
|
26525
26624
|
return stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
26526
26625
|
}
|
|
26527
|
-
async function assertSafeMemberTypes(archive) {
|
|
26528
|
-
const stdout = await readListing(archive, ["-tv"]);
|
|
26626
|
+
async function assertSafeMemberTypes(archive, signal) {
|
|
26627
|
+
const stdout = await readListing(archive, ["-tv"], signal);
|
|
26529
26628
|
for (const line of stdout.split("\n")) {
|
|
26530
26629
|
if (!line.trim()) continue;
|
|
26531
26630
|
const type = line[0];
|
|
@@ -26545,8 +26644,8 @@ async function assertSafeMemberTypes(archive) {
|
|
|
26545
26644
|
);
|
|
26546
26645
|
}
|
|
26547
26646
|
}
|
|
26548
|
-
async function assertSafeArchive(archive, destDir) {
|
|
26549
|
-
const members2 = await listTarMembers(archive);
|
|
26647
|
+
async function assertSafeArchive(archive, destDir, signal) {
|
|
26648
|
+
const members2 = await listTarMembers(archive, signal);
|
|
26550
26649
|
if (members2.length === 0) {
|
|
26551
26650
|
throw new ArchiveError("Archive is empty.");
|
|
26552
26651
|
}
|
|
@@ -26555,7 +26654,7 @@ async function assertSafeArchive(archive, destDir) {
|
|
|
26555
26654
|
throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
|
|
26556
26655
|
}
|
|
26557
26656
|
}
|
|
26558
|
-
await assertSafeMemberTypes(archive);
|
|
26657
|
+
await assertSafeMemberTypes(archive, signal);
|
|
26559
26658
|
}
|
|
26560
26659
|
async function resolveMember(destDir, expectedName) {
|
|
26561
26660
|
const entries = await readdir3(destDir);
|
|
@@ -26570,19 +26669,24 @@ async function resolveMember(destDir, expectedName) {
|
|
|
26570
26669
|
}
|
|
26571
26670
|
return join9(destDir, real[0]);
|
|
26572
26671
|
}
|
|
26573
|
-
async function safeExtractArchive(archivePath, destDir, expectedName) {
|
|
26672
|
+
async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
|
|
26673
|
+
signal?.throwIfAborted();
|
|
26574
26674
|
let archive;
|
|
26575
26675
|
try {
|
|
26576
26676
|
archive = { path: archivePath, format: await sniffFormat(archivePath) };
|
|
26577
|
-
if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
|
|
26677
|
+
if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath, signal);
|
|
26578
26678
|
} catch (err) {
|
|
26679
|
+
signal?.throwIfAborted();
|
|
26579
26680
|
throw new ArchiveError(
|
|
26580
26681
|
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
26581
26682
|
);
|
|
26582
26683
|
}
|
|
26583
|
-
await assertSafeArchive(archive, destDir);
|
|
26584
|
-
|
|
26585
|
-
|
|
26684
|
+
await assertSafeArchive(archive, destDir, signal);
|
|
26685
|
+
signal?.throwIfAborted();
|
|
26686
|
+
await runTar(archive, ["-x", "-C", destDir], signal);
|
|
26687
|
+
const member = await resolveMember(destDir, expectedName);
|
|
26688
|
+
signal?.throwIfAborted();
|
|
26689
|
+
return member;
|
|
26586
26690
|
}
|
|
26587
26691
|
|
|
26588
26692
|
// ../argent-tools-client/src/errors.ts
|
|
@@ -26615,6 +26719,22 @@ function interpolatePath(template, args) {
|
|
|
26615
26719
|
});
|
|
26616
26720
|
return missing ? null : out;
|
|
26617
26721
|
}
|
|
26722
|
+
function callerPath(p) {
|
|
26723
|
+
const onCurrentDrive = path10.sep === "\\" && /^[\\/](?![\\/])/.test(p);
|
|
26724
|
+
if (!onCurrentDrive && (path10.isAbsolute(p) || path10.win32.isAbsolute(p) || isUnexpandedPath(p))) {
|
|
26725
|
+
return p;
|
|
26726
|
+
}
|
|
26727
|
+
const { root } = path10.parse(p);
|
|
26728
|
+
const rest = p.slice(root.length);
|
|
26729
|
+
if (!rest.split(/[\\/]/).includes("..")) {
|
|
26730
|
+
const resolved = path10.resolve(p);
|
|
26731
|
+
const last = p.split(path10.sep === "\\" ? /[\\/]/ : "/").at(-1);
|
|
26732
|
+
const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(path10.sep);
|
|
26733
|
+
return dirOnly ? `${resolved}${path10.sep}` : resolved;
|
|
26734
|
+
}
|
|
26735
|
+
const base = path10.resolve(root);
|
|
26736
|
+
return base.endsWith(path10.sep) ? `${base}${rest}` : `${base}${path10.sep}${rest}`;
|
|
26737
|
+
}
|
|
26618
26738
|
async function specPath(spec, args) {
|
|
26619
26739
|
if (spec.kind !== "file" || !spec.paths?.length) return interpolatePath(spec.path, args);
|
|
26620
26740
|
const candidates = [];
|
|
@@ -26659,10 +26779,10 @@ function untrackArchive(archive) {
|
|
|
26659
26779
|
for (const s of ARCHIVE_SIGNALS) process.removeListener(s, removeArchivesOnSignal);
|
|
26660
26780
|
process.removeListener("exit", removePendingArchives);
|
|
26661
26781
|
}
|
|
26662
|
-
function sha256File(filePath) {
|
|
26663
|
-
return new Promise((
|
|
26782
|
+
function sha256File(filePath, signal) {
|
|
26783
|
+
return new Promise((resolve12, reject) => {
|
|
26664
26784
|
const hash = createHash2("sha256");
|
|
26665
|
-
createReadStream2(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () =>
|
|
26785
|
+
createReadStream2(filePath, { signal }).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve12(hash.digest("hex"))).on("error", reject);
|
|
26666
26786
|
});
|
|
26667
26787
|
}
|
|
26668
26788
|
function toolServerError(text) {
|
|
@@ -26725,7 +26845,7 @@ async function uploadFile(sourcePath, endpoint, signal) {
|
|
|
26725
26845
|
trackArchive(tarPath);
|
|
26726
26846
|
try {
|
|
26727
26847
|
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
26728
|
-
const contentHash = await sha256File(tarPath);
|
|
26848
|
+
const contentHash = await sha256File(tarPath, signal);
|
|
26729
26849
|
return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
|
|
26730
26850
|
} finally {
|
|
26731
26851
|
untrackArchive(tarPath);
|
|
@@ -26760,13 +26880,21 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
26760
26880
|
return args;
|
|
26761
26881
|
}
|
|
26762
26882
|
const record2 = args;
|
|
26763
|
-
|
|
26883
|
+
const planned = [];
|
|
26884
|
+
const callArgs = { ...record2 };
|
|
26764
26885
|
for (const spec of specs) {
|
|
26765
26886
|
if (spec.skipWhenSet && record2[spec.skipWhenSet] !== void 0) continue;
|
|
26766
26887
|
if (spec.target in record2 && typeof record2[spec.target] !== "string") continue;
|
|
26767
|
-
const
|
|
26768
|
-
if (
|
|
26769
|
-
if (spec.target in record2 && record2[spec.target] !==
|
|
26888
|
+
const spelled = await specPath(spec, record2);
|
|
26889
|
+
if (spelled === null) continue;
|
|
26890
|
+
if (spec.target in record2 && record2[spec.target] !== spelled) continue;
|
|
26891
|
+
const filePath = callerPath(spelled);
|
|
26892
|
+
planned.push({ spec, filePath });
|
|
26893
|
+
if (spec.target in record2) callArgs[spec.target] = filePath;
|
|
26894
|
+
}
|
|
26895
|
+
if (planned.length === 0) return args;
|
|
26896
|
+
const out = { ...record2 };
|
|
26897
|
+
for (const { spec, filePath } of planned) {
|
|
26770
26898
|
const wire = { [FILE_INPUT_MARKER2]: true, path: filePath };
|
|
26771
26899
|
if (spec.kind === "file") {
|
|
26772
26900
|
const read = await readFileInputWire(filePath, { includeContent: opts.includeContent });
|
|
@@ -26774,12 +26902,12 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
26774
26902
|
if (spec.collect === "flow" && opts.includeContent && wire.content !== void 0 && opts.collectMembers) {
|
|
26775
26903
|
Object.assign(
|
|
26776
26904
|
wire,
|
|
26777
|
-
await opts.collectMembers(filePath, Buffer.from(wire.content, "base64"),
|
|
26905
|
+
await opts.collectMembers(filePath, Buffer.from(wire.content, "base64"), callArgs, opts)
|
|
26778
26906
|
);
|
|
26779
26907
|
}
|
|
26780
26908
|
}
|
|
26781
26909
|
if (spec.kind === "probe" && spec.collect === "step" && opts.includeContent && opts.collectStepMembers) {
|
|
26782
|
-
wire.members = await opts.collectStepMembers(
|
|
26910
|
+
wire.members = await opts.collectStepMembers(callArgs, opts);
|
|
26783
26911
|
}
|
|
26784
26912
|
if (spec.kind === "tar-upload") {
|
|
26785
26913
|
const st = await stat3(filePath).catch(() => null);
|
|
@@ -26793,10 +26921,9 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
26793
26921
|
Object.assign(wire, await uploadFile(filePath, opts.uploadEndpoint, opts.signal));
|
|
26794
26922
|
}
|
|
26795
26923
|
}
|
|
26796
|
-
out = out ?? { ...record2 };
|
|
26797
26924
|
out[spec.target] = wire;
|
|
26798
26925
|
}
|
|
26799
|
-
return out
|
|
26926
|
+
return out;
|
|
26800
26927
|
}
|
|
26801
26928
|
function isAllowedClientFilePath(p) {
|
|
26802
26929
|
if (!path10.isAbsolute(p)) return false;
|
|
@@ -27160,7 +27287,7 @@ function memberCollector(roots, opts) {
|
|
|
27160
27287
|
for (let file = files.shift(); file !== void 0; file = files.shift()) {
|
|
27161
27288
|
let doc;
|
|
27162
27289
|
try {
|
|
27163
|
-
doc = (0, import_yaml.parse)(file.text
|
|
27290
|
+
doc = (0, import_yaml.parse)(flowYamlSource(file.text), { logLevel: "error" });
|
|
27164
27291
|
} catch {
|
|
27165
27292
|
continue;
|
|
27166
27293
|
}
|
|
@@ -27275,7 +27402,7 @@ function recordedStep(args) {
|
|
|
27275
27402
|
async function collectStepMembers(args, opts, recordingDirFor = e2eDirFor) {
|
|
27276
27403
|
const { name, project_root: projectRoot } = args;
|
|
27277
27404
|
const step = recordedStep(args);
|
|
27278
|
-
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) ||
|
|
27405
|
+
if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || !isResolvedAbsolute2(projectRoot) || step === void 0) {
|
|
27279
27406
|
return [];
|
|
27280
27407
|
}
|
|
27281
27408
|
const recording = path11.join(recordingDirFor(projectRoot), `${name}.yaml`);
|
|
@@ -27361,7 +27488,10 @@ async function stepForOlderServer(args, listedId) {
|
|
|
27361
27488
|
async function e2eShadowWarningFor(tool, args) {
|
|
27362
27489
|
const id = canonicalToolId(tool);
|
|
27363
27490
|
if (id !== "e2e-execute" && id !== "e2e-read-prerequisite") return void 0;
|
|
27364
|
-
const
|
|
27491
|
+
const root = args?.project_root;
|
|
27492
|
+
const target = nestedFlowTarget(
|
|
27493
|
+
typeof root === "string" ? { ...args, project_root: callerPath(root) } : args
|
|
27494
|
+
);
|
|
27365
27495
|
if (target?.kind !== "name") return void 0;
|
|
27366
27496
|
const picked = await pickE2eFile(target.paths);
|
|
27367
27497
|
return picked.shadowed === void 0 ? void 0 : e2eShadowWarning(picked.path, picked.shadowed);
|
|
@@ -27479,6 +27609,34 @@ function assertRequiredPresent(meta2, args) {
|
|
|
27479
27609
|
describeParamIssues({ issues }, record2)
|
|
27480
27610
|
);
|
|
27481
27611
|
}
|
|
27612
|
+
var MAX_NON_FINITE_ISSUES = 12;
|
|
27613
|
+
function assertFiniteNumbers(args) {
|
|
27614
|
+
const issues = [];
|
|
27615
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
27616
|
+
const pending = [{ value: args, key: "" }];
|
|
27617
|
+
for (let i = 0; i < pending.length && issues.length < MAX_NON_FINITE_ISSUES; i++) {
|
|
27618
|
+
const visit = pending[i];
|
|
27619
|
+
const { value } = visit;
|
|
27620
|
+
if (typeof value !== "object" || value === null || seen.has(value)) continue;
|
|
27621
|
+
seen.add(value);
|
|
27622
|
+
for (const [key, item] of Array.isArray(value) ? value.entries() : Object.entries(value)) {
|
|
27623
|
+
if (typeof item === "object" && item !== null) {
|
|
27624
|
+
pending.push({ value: item, key, parent: visit });
|
|
27625
|
+
} else if (typeof item === "number" && !Number.isFinite(item)) {
|
|
27626
|
+
const path18 = [key];
|
|
27627
|
+
for (let at = visit; at.parent; at = at.parent) path18.push(at.key);
|
|
27628
|
+
path18.reverse();
|
|
27629
|
+
issues.push({ code: "invalid_type", path: path18, message: `expected a number, got ${item}` });
|
|
27630
|
+
if (issues.length === MAX_NON_FINITE_ISSUES) break;
|
|
27631
|
+
}
|
|
27632
|
+
}
|
|
27633
|
+
}
|
|
27634
|
+
if (issues.length === 0) return;
|
|
27635
|
+
throw new ToolInvocationError(
|
|
27636
|
+
describeParamIssues({ issues }, args),
|
|
27637
|
+
{ errorKind: "validation", issues }
|
|
27638
|
+
);
|
|
27639
|
+
}
|
|
27482
27640
|
function fetchFailure(err) {
|
|
27483
27641
|
if (!(err instanceof Error)) return String(err);
|
|
27484
27642
|
return err.cause instanceof Error ? `${err.message}: ${err.cause.message}` : err.message;
|
|
@@ -27525,7 +27683,7 @@ async function forwardedSecrets(args) {
|
|
|
27525
27683
|
}
|
|
27526
27684
|
let parsed;
|
|
27527
27685
|
try {
|
|
27528
|
-
parsed = text === void 0 ? void 0 : (0, import_yaml2.parse)(text
|
|
27686
|
+
parsed = text === void 0 ? void 0 : (0, import_yaml2.parse)(flowYamlSource(text), { logLevel: "error" });
|
|
27529
27687
|
} catch {
|
|
27530
27688
|
continue;
|
|
27531
27689
|
}
|
|
@@ -27556,6 +27714,34 @@ function secretsTransportRefusal(url) {
|
|
|
27556
27714
|
return void 0;
|
|
27557
27715
|
}
|
|
27558
27716
|
var FETCH_HEAD_BYTES = 256;
|
|
27717
|
+
function isRecord2(value) {
|
|
27718
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27719
|
+
}
|
|
27720
|
+
var PROJECT_PATH_ADVICE = {
|
|
27721
|
+
project_root: "Pass the absolute path to the project root directory - the same cwd the calling agent is working in.",
|
|
27722
|
+
e2e_test_path: "Pass the absolute path to the e2e test file."
|
|
27723
|
+
};
|
|
27724
|
+
function assertAbsoluteProjectPaths(meta2, args) {
|
|
27725
|
+
if (!meta2 || !isRecord2(args)) return;
|
|
27726
|
+
const aliases = Object.entries(toolParamAliases(meta2.name));
|
|
27727
|
+
for (const [param, advice] of Object.entries(PROJECT_PATH_ADVICE)) {
|
|
27728
|
+
const value = args[param];
|
|
27729
|
+
if (typeof value !== "string" || callerPath(value) === value) continue;
|
|
27730
|
+
const names = [param, ...aliases.filter(([, current]) => current === param).map(([f]) => f)];
|
|
27731
|
+
if (!meta2.fileInputs?.some((spec) => names.some((n) => spec.path.includes(`\${${n}}`)))) {
|
|
27732
|
+
continue;
|
|
27733
|
+
}
|
|
27734
|
+
throw new Error(`${param} must be an absolute path (got "${value}"). ${advice}`);
|
|
27735
|
+
}
|
|
27736
|
+
}
|
|
27737
|
+
function failedRun(result) {
|
|
27738
|
+
if (!isRecord2(result)) return result;
|
|
27739
|
+
if (result.ok === true) return { ...result, ok: false };
|
|
27740
|
+
if (isRecord2(result.toolResult) && result.toolResult.ok === true) {
|
|
27741
|
+
return { ...result, toolResult: { ...result.toolResult, ok: false } };
|
|
27742
|
+
}
|
|
27743
|
+
return result;
|
|
27744
|
+
}
|
|
27559
27745
|
function createToolsClient(options = {}) {
|
|
27560
27746
|
let cached2 = null;
|
|
27561
27747
|
const doFetch = options.fetchImpl ?? ((url, init) => fetch(url, init));
|
|
@@ -27600,10 +27786,12 @@ function createToolsClient(options = {}) {
|
|
|
27600
27786
|
}
|
|
27601
27787
|
async function callTool(name, args, opts) {
|
|
27602
27788
|
opts?.signal?.throwIfAborted();
|
|
27789
|
+
assertFiniteNumbers(args);
|
|
27603
27790
|
const { url, token, remote } = await route();
|
|
27604
27791
|
let finalArgs = canonicalToolArgs(name, args);
|
|
27605
27792
|
const { tools, uploadFormats } = await fetchToolList({ signal: opts?.signal });
|
|
27606
27793
|
const meta2 = findTool(tools, name);
|
|
27794
|
+
if (options.refuseRelativeProjectPaths) assertAbsoluteProjectPaths(meta2, finalArgs);
|
|
27607
27795
|
const olderServer = meta2 !== null && !tools.some((t) => t.name === canonicalToolId(meta2.name));
|
|
27608
27796
|
if (meta2) {
|
|
27609
27797
|
finalArgs = await nameToE2ePathForOlderServer(meta2.name, meta2.fileInputs, finalArgs);
|
|
@@ -27641,7 +27829,7 @@ function createToolsClient(options = {}) {
|
|
|
27641
27829
|
}
|
|
27642
27830
|
}
|
|
27643
27831
|
}
|
|
27644
|
-
const result = applied.result;
|
|
27832
|
+
const result = applied.failed.length > 0 ? failedRun(applied.result) : applied.result;
|
|
27645
27833
|
if (shadowWarning === void 0 || typeof result !== "object" || result === null || Array.isArray(result) || typeof result.warning === "string") {
|
|
27646
27834
|
return result;
|
|
27647
27835
|
}
|
|
@@ -27768,10 +27956,19 @@ function createToolsClient(options = {}) {
|
|
|
27768
27956
|
}
|
|
27769
27957
|
|
|
27770
27958
|
// ../argent-tools-client/src/artifacts.ts
|
|
27771
|
-
import {
|
|
27959
|
+
import {
|
|
27960
|
+
copyFile,
|
|
27961
|
+
mkdir as mkdir4,
|
|
27962
|
+
mkdtemp,
|
|
27963
|
+
readFile as readFile6,
|
|
27964
|
+
realpath as realpath4,
|
|
27965
|
+
rm as rm3,
|
|
27966
|
+
stat as stat5,
|
|
27967
|
+
writeFile as writeFile4
|
|
27968
|
+
} from "node:fs/promises";
|
|
27772
27969
|
import { constants as fsConstants } from "node:fs";
|
|
27773
27970
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
27774
|
-
import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as
|
|
27971
|
+
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";
|
|
27775
27972
|
import { createHash as createHash3 } from "node:crypto";
|
|
27776
27973
|
var ARTIFACT_MARKER2 = "__argentArtifact";
|
|
27777
27974
|
function isArtifactHandle(value) {
|
|
@@ -27819,8 +28016,8 @@ function configuredRecordingsDir() {
|
|
|
27819
28016
|
const trimmed = value.trim();
|
|
27820
28017
|
if (trimmed === "") return null;
|
|
27821
28018
|
const home = dirname9(argentHomeDir());
|
|
27822
|
-
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${
|
|
27823
|
-
return
|
|
28019
|
+
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep5}`) ? join13(home, trimmed.slice(2)) : trimmed;
|
|
28020
|
+
return resolve10(durableBaseDir(), expanded);
|
|
27824
28021
|
}
|
|
27825
28022
|
var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
|
|
27826
28023
|
async function readCapped(res, cap) {
|
|
@@ -27853,10 +28050,10 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
27853
28050
|
const stem = filename.slice(0, filename.length - ext.length);
|
|
27854
28051
|
for (let i = 1; i <= 1e3; i++) {
|
|
27855
28052
|
const candidate = i === 1 ? filename : `${stem} (${i})${ext}`;
|
|
27856
|
-
const
|
|
28053
|
+
const path18 = join13(dir, candidate);
|
|
27857
28054
|
try {
|
|
27858
|
-
await write(
|
|
27859
|
-
return
|
|
28055
|
+
await write(path18);
|
|
28056
|
+
return path18;
|
|
27860
28057
|
} catch (err) {
|
|
27861
28058
|
if (err?.code === "EEXIST") continue;
|
|
27862
28059
|
throw err;
|
|
@@ -27867,7 +28064,7 @@ async function writeDurableUnique(dir, filename, write) {
|
|
|
27867
28064
|
function durableSaveTarget(handle) {
|
|
27868
28065
|
if (typeof handle.saveDir !== "string" || !handle.saveDir || handle.archive) return null;
|
|
27869
28066
|
const rel = normalize2(handle.saveDir);
|
|
27870
|
-
if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${
|
|
28067
|
+
if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${sep5}`) || rel.split(sep5).includes("..")) {
|
|
27871
28068
|
return null;
|
|
27872
28069
|
}
|
|
27873
28070
|
if (!ALLOWED_SAVE_DIRS.has(rel)) return null;
|
|
@@ -27912,16 +28109,22 @@ async function resolveLocalFile(handle) {
|
|
|
27912
28109
|
return null;
|
|
27913
28110
|
}
|
|
27914
28111
|
}
|
|
27915
|
-
async function downloadAndExtractArchive(handle, data, dir) {
|
|
27916
|
-
|
|
28112
|
+
async function downloadAndExtractArchive(handle, data, dir, signal) {
|
|
28113
|
+
signal?.throwIfAborted();
|
|
28114
|
+
const attemptDir = await mkdtemp(join13(dir, "bundle-"));
|
|
28115
|
+
const tarball = join13(attemptDir, "download.tar");
|
|
28116
|
+
const extractDir = join13(attemptDir, "files");
|
|
27917
28117
|
try {
|
|
27918
|
-
await writeFile4(tarball, data);
|
|
27919
|
-
|
|
28118
|
+
await writeFile4(tarball, data, { signal });
|
|
28119
|
+
await mkdir4(extractDir);
|
|
28120
|
+
const member = await safeExtractArchive(tarball, extractDir, handle.filename, signal);
|
|
28121
|
+
await rm3(tarball);
|
|
28122
|
+
signal?.throwIfAborted();
|
|
28123
|
+
return member;
|
|
27920
28124
|
} catch {
|
|
27921
|
-
|
|
27922
|
-
} finally {
|
|
27923
|
-
await rm3(tarball, { force: true }).catch(() => {
|
|
28125
|
+
await rm3(attemptDir, { recursive: true, force: true }).catch(() => {
|
|
27924
28126
|
});
|
|
28127
|
+
return null;
|
|
27925
28128
|
}
|
|
27926
28129
|
}
|
|
27927
28130
|
async function materializeArtifacts(result, ctx) {
|
|
@@ -28007,7 +28210,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
28007
28210
|
if (!data) return null;
|
|
28008
28211
|
await ensureDir();
|
|
28009
28212
|
if (value.archive === "tar.gz") {
|
|
28010
|
-
return await downloadAndExtractArchive(value, data, dir);
|
|
28213
|
+
return await downloadAndExtractArchive(value, data, dir, ctx.signal);
|
|
28011
28214
|
}
|
|
28012
28215
|
if (value.size > 0 && data.length !== value.size) return null;
|
|
28013
28216
|
const downloadedPath = join13(dir, sanitizeSegment(value.filename));
|
|
@@ -28044,7 +28247,7 @@ function getDeviceIdFromArgs(args) {
|
|
|
28044
28247
|
}
|
|
28045
28248
|
|
|
28046
28249
|
// ../telemetry/src/debug.ts
|
|
28047
|
-
import * as
|
|
28250
|
+
import * as fs8 from "node:fs";
|
|
28048
28251
|
|
|
28049
28252
|
// ../telemetry/src/paths.ts
|
|
28050
28253
|
import * as path13 from "node:path";
|
|
@@ -28066,7 +28269,8 @@ var DEVICE_KINDS = [
|
|
|
28066
28269
|
"emulator",
|
|
28067
28270
|
"vvd",
|
|
28068
28271
|
"device",
|
|
28069
|
-
"app"
|
|
28272
|
+
"app",
|
|
28273
|
+
"catalyst"
|
|
28070
28274
|
];
|
|
28071
28275
|
var DEBUGGER_NOT_CONNECTED_REASONS = [
|
|
28072
28276
|
"metro_not_running",
|
|
@@ -28226,7 +28430,8 @@ var ALLOWED = {
|
|
|
28226
28430
|
install_mode: INSTALL_MODE
|
|
28227
28431
|
},
|
|
28228
28432
|
"installation:allowlist_decision": {
|
|
28229
|
-
is_enabled: bool
|
|
28433
|
+
is_enabled: bool,
|
|
28434
|
+
decided_by: oneOf(["flag", "default", "prompt"])
|
|
28230
28435
|
},
|
|
28231
28436
|
"installation:stale_config_cleanup": {
|
|
28232
28437
|
removed_count: COUNT,
|
|
@@ -28372,380 +28577,12 @@ import { randomUUID as randomUUID5 } from "node:crypto";
|
|
|
28372
28577
|
// ../telemetry/src/cloud-agent-detect.ts
|
|
28373
28578
|
import { existsSync as existsSync3 } from "node:fs";
|
|
28374
28579
|
|
|
28375
|
-
// ../../node_modules/ci-info/vendors.json
|
|
28376
|
-
var vendors_default = [
|
|
28377
|
-
{
|
|
28378
|
-
name: "Agola CI",
|
|
28379
|
-
constant: "AGOLA",
|
|
28380
|
-
env: "AGOLA_GIT_REF",
|
|
28381
|
-
pr: "AGOLA_PULL_REQUEST_ID"
|
|
28382
|
-
},
|
|
28383
|
-
{
|
|
28384
|
-
name: "Alpic",
|
|
28385
|
-
constant: "ALPIC",
|
|
28386
|
-
env: "ALPIC_HOST"
|
|
28387
|
-
},
|
|
28388
|
-
{
|
|
28389
|
-
name: "Appcircle",
|
|
28390
|
-
constant: "APPCIRCLE",
|
|
28391
|
-
env: "AC_APPCIRCLE",
|
|
28392
|
-
pr: {
|
|
28393
|
-
env: "AC_GIT_PR",
|
|
28394
|
-
ne: "false"
|
|
28395
|
-
}
|
|
28396
|
-
},
|
|
28397
|
-
{
|
|
28398
|
-
name: "AppVeyor",
|
|
28399
|
-
constant: "APPVEYOR",
|
|
28400
|
-
env: "APPVEYOR",
|
|
28401
|
-
pr: "APPVEYOR_PULL_REQUEST_NUMBER"
|
|
28402
|
-
},
|
|
28403
|
-
{
|
|
28404
|
-
name: "AWS CodeBuild",
|
|
28405
|
-
constant: "CODEBUILD",
|
|
28406
|
-
env: "CODEBUILD_BUILD_ARN",
|
|
28407
|
-
pr: {
|
|
28408
|
-
env: "CODEBUILD_WEBHOOK_EVENT",
|
|
28409
|
-
any: [
|
|
28410
|
-
"PULL_REQUEST_CREATED",
|
|
28411
|
-
"PULL_REQUEST_UPDATED",
|
|
28412
|
-
"PULL_REQUEST_REOPENED"
|
|
28413
|
-
]
|
|
28414
|
-
}
|
|
28415
|
-
},
|
|
28416
|
-
{
|
|
28417
|
-
name: "Azure Pipelines",
|
|
28418
|
-
constant: "AZURE_PIPELINES",
|
|
28419
|
-
env: "TF_BUILD",
|
|
28420
|
-
pr: {
|
|
28421
|
-
BUILD_REASON: "PullRequest"
|
|
28422
|
-
}
|
|
28423
|
-
},
|
|
28424
|
-
{
|
|
28425
|
-
name: "Bamboo",
|
|
28426
|
-
constant: "BAMBOO",
|
|
28427
|
-
env: "bamboo_planKey"
|
|
28428
|
-
},
|
|
28429
|
-
{
|
|
28430
|
-
name: "Bitbucket Pipelines",
|
|
28431
|
-
constant: "BITBUCKET",
|
|
28432
|
-
env: "BITBUCKET_COMMIT",
|
|
28433
|
-
pr: "BITBUCKET_PR_ID"
|
|
28434
|
-
},
|
|
28435
|
-
{
|
|
28436
|
-
name: "Bitrise",
|
|
28437
|
-
constant: "BITRISE",
|
|
28438
|
-
env: "BITRISE_IO",
|
|
28439
|
-
pr: "BITRISE_PULL_REQUEST"
|
|
28440
|
-
},
|
|
28441
|
-
{
|
|
28442
|
-
name: "Buddy",
|
|
28443
|
-
constant: "BUDDY",
|
|
28444
|
-
env: "BUDDY_WORKSPACE_ID",
|
|
28445
|
-
pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
|
|
28446
|
-
},
|
|
28447
|
-
{
|
|
28448
|
-
name: "Buildkite",
|
|
28449
|
-
constant: "BUILDKITE",
|
|
28450
|
-
env: "BUILDKITE",
|
|
28451
|
-
pr: {
|
|
28452
|
-
env: "BUILDKITE_PULL_REQUEST",
|
|
28453
|
-
ne: "false"
|
|
28454
|
-
}
|
|
28455
|
-
},
|
|
28456
|
-
{
|
|
28457
|
-
name: "CircleCI",
|
|
28458
|
-
constant: "CIRCLE",
|
|
28459
|
-
env: "CIRCLECI",
|
|
28460
|
-
pr: "CIRCLE_PULL_REQUEST"
|
|
28461
|
-
},
|
|
28462
|
-
{
|
|
28463
|
-
name: "Cirrus CI",
|
|
28464
|
-
constant: "CIRRUS",
|
|
28465
|
-
env: "CIRRUS_CI",
|
|
28466
|
-
pr: "CIRRUS_PR"
|
|
28467
|
-
},
|
|
28468
|
-
{
|
|
28469
|
-
name: "Cloudflare Pages",
|
|
28470
|
-
constant: "CLOUDFLARE_PAGES",
|
|
28471
|
-
env: "CF_PAGES"
|
|
28472
|
-
},
|
|
28473
|
-
{
|
|
28474
|
-
name: "Cloudflare Workers",
|
|
28475
|
-
constant: "CLOUDFLARE_WORKERS",
|
|
28476
|
-
env: "WORKERS_CI"
|
|
28477
|
-
},
|
|
28478
|
-
{
|
|
28479
|
-
name: "Codefresh",
|
|
28480
|
-
constant: "CODEFRESH",
|
|
28481
|
-
env: "CF_BUILD_ID",
|
|
28482
|
-
pr: {
|
|
28483
|
-
any: [
|
|
28484
|
-
"CF_PULL_REQUEST_NUMBER",
|
|
28485
|
-
"CF_PULL_REQUEST_ID"
|
|
28486
|
-
]
|
|
28487
|
-
}
|
|
28488
|
-
},
|
|
28489
|
-
{
|
|
28490
|
-
name: "Codemagic",
|
|
28491
|
-
constant: "CODEMAGIC",
|
|
28492
|
-
env: "CM_BUILD_ID",
|
|
28493
|
-
pr: "CM_PULL_REQUEST"
|
|
28494
|
-
},
|
|
28495
|
-
{
|
|
28496
|
-
name: "Codeship",
|
|
28497
|
-
constant: "CODESHIP",
|
|
28498
|
-
env: {
|
|
28499
|
-
CI_NAME: "codeship"
|
|
28500
|
-
}
|
|
28501
|
-
},
|
|
28502
|
-
{
|
|
28503
|
-
name: "Drone",
|
|
28504
|
-
constant: "DRONE",
|
|
28505
|
-
env: "DRONE",
|
|
28506
|
-
pr: {
|
|
28507
|
-
DRONE_BUILD_EVENT: "pull_request"
|
|
28508
|
-
}
|
|
28509
|
-
},
|
|
28510
|
-
{
|
|
28511
|
-
name: "dsari",
|
|
28512
|
-
constant: "DSARI",
|
|
28513
|
-
env: "DSARI"
|
|
28514
|
-
},
|
|
28515
|
-
{
|
|
28516
|
-
name: "Earthly",
|
|
28517
|
-
constant: "EARTHLY",
|
|
28518
|
-
env: "EARTHLY_CI"
|
|
28519
|
-
},
|
|
28520
|
-
{
|
|
28521
|
-
name: "Expo Application Services",
|
|
28522
|
-
constant: "EAS",
|
|
28523
|
-
env: "EAS_BUILD"
|
|
28524
|
-
},
|
|
28525
|
-
{
|
|
28526
|
-
name: "Gerrit",
|
|
28527
|
-
constant: "GERRIT",
|
|
28528
|
-
env: "GERRIT_PROJECT"
|
|
28529
|
-
},
|
|
28530
|
-
{
|
|
28531
|
-
name: "Gitea Actions",
|
|
28532
|
-
constant: "GITEA_ACTIONS",
|
|
28533
|
-
env: "GITEA_ACTIONS"
|
|
28534
|
-
},
|
|
28535
|
-
{
|
|
28536
|
-
name: "GitHub Actions",
|
|
28537
|
-
constant: "GITHUB_ACTIONS",
|
|
28538
|
-
env: "GITHUB_ACTIONS",
|
|
28539
|
-
pr: {
|
|
28540
|
-
GITHUB_EVENT_NAME: "pull_request"
|
|
28541
|
-
}
|
|
28542
|
-
},
|
|
28543
|
-
{
|
|
28544
|
-
name: "GitLab CI",
|
|
28545
|
-
constant: "GITLAB",
|
|
28546
|
-
env: "GITLAB_CI",
|
|
28547
|
-
pr: "CI_MERGE_REQUEST_ID"
|
|
28548
|
-
},
|
|
28549
|
-
{
|
|
28550
|
-
name: "GoCD",
|
|
28551
|
-
constant: "GOCD",
|
|
28552
|
-
env: "GO_PIPELINE_LABEL"
|
|
28553
|
-
},
|
|
28554
|
-
{
|
|
28555
|
-
name: "Google Cloud Build",
|
|
28556
|
-
constant: "GOOGLE_CLOUD_BUILD",
|
|
28557
|
-
env: "BUILDER_OUTPUT"
|
|
28558
|
-
},
|
|
28559
|
-
{
|
|
28560
|
-
name: "Harness CI",
|
|
28561
|
-
constant: "HARNESS",
|
|
28562
|
-
env: "HARNESS_BUILD_ID"
|
|
28563
|
-
},
|
|
28564
|
-
{
|
|
28565
|
-
name: "Heroku",
|
|
28566
|
-
constant: "HEROKU",
|
|
28567
|
-
env: {
|
|
28568
|
-
env: "NODE",
|
|
28569
|
-
includes: "/app/.heroku/node/bin/node"
|
|
28570
|
-
}
|
|
28571
|
-
},
|
|
28572
|
-
{
|
|
28573
|
-
name: "Hudson",
|
|
28574
|
-
constant: "HUDSON",
|
|
28575
|
-
env: "HUDSON_URL"
|
|
28576
|
-
},
|
|
28577
|
-
{
|
|
28578
|
-
name: "Jenkins",
|
|
28579
|
-
constant: "JENKINS",
|
|
28580
|
-
env: [
|
|
28581
|
-
"JENKINS_URL",
|
|
28582
|
-
"BUILD_ID"
|
|
28583
|
-
],
|
|
28584
|
-
pr: {
|
|
28585
|
-
any: [
|
|
28586
|
-
"ghprbPullId",
|
|
28587
|
-
"CHANGE_ID"
|
|
28588
|
-
]
|
|
28589
|
-
}
|
|
28590
|
-
},
|
|
28591
|
-
{
|
|
28592
|
-
name: "LayerCI",
|
|
28593
|
-
constant: "LAYERCI",
|
|
28594
|
-
env: "LAYERCI",
|
|
28595
|
-
pr: "LAYERCI_PULL_REQUEST"
|
|
28596
|
-
},
|
|
28597
|
-
{
|
|
28598
|
-
name: "Magnum CI",
|
|
28599
|
-
constant: "MAGNUM",
|
|
28600
|
-
env: "MAGNUM"
|
|
28601
|
-
},
|
|
28602
|
-
{
|
|
28603
|
-
name: "Netlify CI",
|
|
28604
|
-
constant: "NETLIFY",
|
|
28605
|
-
env: "NETLIFY",
|
|
28606
|
-
pr: {
|
|
28607
|
-
env: "PULL_REQUEST",
|
|
28608
|
-
ne: "false"
|
|
28609
|
-
}
|
|
28610
|
-
},
|
|
28611
|
-
{
|
|
28612
|
-
name: "Nevercode",
|
|
28613
|
-
constant: "NEVERCODE",
|
|
28614
|
-
env: "NEVERCODE",
|
|
28615
|
-
pr: {
|
|
28616
|
-
env: "NEVERCODE_PULL_REQUEST",
|
|
28617
|
-
ne: "false"
|
|
28618
|
-
}
|
|
28619
|
-
},
|
|
28620
|
-
{
|
|
28621
|
-
name: "Prow",
|
|
28622
|
-
constant: "PROW",
|
|
28623
|
-
env: "PROW_JOB_ID"
|
|
28624
|
-
},
|
|
28625
|
-
{
|
|
28626
|
-
name: "ReleaseHub",
|
|
28627
|
-
constant: "RELEASEHUB",
|
|
28628
|
-
env: "RELEASE_BUILD_ID"
|
|
28629
|
-
},
|
|
28630
|
-
{
|
|
28631
|
-
name: "Render",
|
|
28632
|
-
constant: "RENDER",
|
|
28633
|
-
env: "RENDER",
|
|
28634
|
-
pr: {
|
|
28635
|
-
IS_PULL_REQUEST: "true"
|
|
28636
|
-
}
|
|
28637
|
-
},
|
|
28638
|
-
{
|
|
28639
|
-
name: "Sail CI",
|
|
28640
|
-
constant: "SAIL",
|
|
28641
|
-
env: "SAILCI",
|
|
28642
|
-
pr: "SAIL_PULL_REQUEST_NUMBER"
|
|
28643
|
-
},
|
|
28644
|
-
{
|
|
28645
|
-
name: "Screwdriver",
|
|
28646
|
-
constant: "SCREWDRIVER",
|
|
28647
|
-
env: "SCREWDRIVER",
|
|
28648
|
-
pr: {
|
|
28649
|
-
env: "SD_PULL_REQUEST",
|
|
28650
|
-
ne: "false"
|
|
28651
|
-
}
|
|
28652
|
-
},
|
|
28653
|
-
{
|
|
28654
|
-
name: "Semaphore",
|
|
28655
|
-
constant: "SEMAPHORE",
|
|
28656
|
-
env: "SEMAPHORE",
|
|
28657
|
-
pr: "PULL_REQUEST_NUMBER"
|
|
28658
|
-
},
|
|
28659
|
-
{
|
|
28660
|
-
name: "Sourcehut",
|
|
28661
|
-
constant: "SOURCEHUT",
|
|
28662
|
-
env: {
|
|
28663
|
-
CI_NAME: "sourcehut"
|
|
28664
|
-
}
|
|
28665
|
-
},
|
|
28666
|
-
{
|
|
28667
|
-
name: "Strider CD",
|
|
28668
|
-
constant: "STRIDER",
|
|
28669
|
-
env: "STRIDER"
|
|
28670
|
-
},
|
|
28671
|
-
{
|
|
28672
|
-
name: "TaskCluster",
|
|
28673
|
-
constant: "TASKCLUSTER",
|
|
28674
|
-
env: [
|
|
28675
|
-
"TASK_ID",
|
|
28676
|
-
"RUN_ID"
|
|
28677
|
-
]
|
|
28678
|
-
},
|
|
28679
|
-
{
|
|
28680
|
-
name: "TeamCity",
|
|
28681
|
-
constant: "TEAMCITY",
|
|
28682
|
-
env: "TEAMCITY_VERSION"
|
|
28683
|
-
},
|
|
28684
|
-
{
|
|
28685
|
-
name: "Travis CI",
|
|
28686
|
-
constant: "TRAVIS",
|
|
28687
|
-
env: "TRAVIS",
|
|
28688
|
-
pr: {
|
|
28689
|
-
env: "TRAVIS_PULL_REQUEST",
|
|
28690
|
-
ne: "false"
|
|
28691
|
-
}
|
|
28692
|
-
},
|
|
28693
|
-
{
|
|
28694
|
-
name: "Vela",
|
|
28695
|
-
constant: "VELA",
|
|
28696
|
-
env: "VELA",
|
|
28697
|
-
pr: {
|
|
28698
|
-
VELA_PULL_REQUEST: "1"
|
|
28699
|
-
}
|
|
28700
|
-
},
|
|
28701
|
-
{
|
|
28702
|
-
name: "Vercel",
|
|
28703
|
-
constant: "VERCEL",
|
|
28704
|
-
env: {
|
|
28705
|
-
any: [
|
|
28706
|
-
"NOW_BUILDER",
|
|
28707
|
-
"VERCEL"
|
|
28708
|
-
]
|
|
28709
|
-
},
|
|
28710
|
-
pr: "VERCEL_GIT_PULL_REQUEST_ID"
|
|
28711
|
-
},
|
|
28712
|
-
{
|
|
28713
|
-
name: "Visual Studio App Center",
|
|
28714
|
-
constant: "APPCENTER",
|
|
28715
|
-
env: "APPCENTER_BUILD_ID"
|
|
28716
|
-
},
|
|
28717
|
-
{
|
|
28718
|
-
name: "Woodpecker",
|
|
28719
|
-
constant: "WOODPECKER",
|
|
28720
|
-
env: {
|
|
28721
|
-
CI: "woodpecker"
|
|
28722
|
-
},
|
|
28723
|
-
pr: {
|
|
28724
|
-
CI_BUILD_EVENT: "pull_request"
|
|
28725
|
-
}
|
|
28726
|
-
},
|
|
28727
|
-
{
|
|
28728
|
-
name: "Xcode Cloud",
|
|
28729
|
-
constant: "XCODE_CLOUD",
|
|
28730
|
-
env: "CI_XCODE_PROJECT",
|
|
28731
|
-
pr: "CI_PULL_REQUEST_NUMBER"
|
|
28732
|
-
},
|
|
28733
|
-
{
|
|
28734
|
-
name: "Xcode Server",
|
|
28735
|
-
constant: "XCODE_SERVER",
|
|
28736
|
-
env: "XCS"
|
|
28737
|
-
}
|
|
28738
|
-
];
|
|
28739
|
-
|
|
28740
|
-
// ../telemetry/src/ci-detect.ts
|
|
28741
|
-
var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
28742
|
-
|
|
28743
28580
|
// ../telemetry/src/base-props.ts
|
|
28744
28581
|
var SESSION_ID2 = randomUUID5();
|
|
28745
28582
|
|
|
28746
28583
|
// ../telemetry/src/identity.ts
|
|
28747
28584
|
import * as crypto2 from "node:crypto";
|
|
28748
|
-
import * as
|
|
28585
|
+
import * as fs9 from "node:fs";
|
|
28749
28586
|
import * as path14 from "node:path";
|
|
28750
28587
|
|
|
28751
28588
|
// ../telemetry/src/fingerprint.ts
|
|
@@ -28753,21 +28590,22 @@ import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_proce
|
|
|
28753
28590
|
|
|
28754
28591
|
// ../native-devtools-ios/src/index.ts
|
|
28755
28592
|
import * as path15 from "node:path";
|
|
28756
|
-
import * as
|
|
28593
|
+
import * as fs10 from "node:fs";
|
|
28757
28594
|
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path15.join(__dirname, "..", "dylibs");
|
|
28758
28595
|
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path15.join(__dirname, "..", "bin");
|
|
28759
28596
|
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path15.join(DYLIB_DIR, "tcp");
|
|
28760
28597
|
var DYLIB_TVOS_DIR = path15.join(DYLIB_DIR, "tvos");
|
|
28761
28598
|
|
|
28762
28599
|
// ../telemetry/src/consent.ts
|
|
28763
|
-
import * as
|
|
28600
|
+
import * as fs11 from "node:fs";
|
|
28601
|
+
import * as path16 from "node:path";
|
|
28764
28602
|
var cache = /* @__PURE__ */ new Map();
|
|
28765
28603
|
var sessionOverride = null;
|
|
28766
28604
|
function readConfigOverrideAt(filePath) {
|
|
28767
28605
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
28768
28606
|
let stats;
|
|
28769
28607
|
try {
|
|
28770
|
-
stats =
|
|
28608
|
+
stats = fs11.lstatSync(filePath);
|
|
28771
28609
|
} catch {
|
|
28772
28610
|
cache.set(filePath, miss);
|
|
28773
28611
|
return null;
|
|
@@ -28784,7 +28622,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
28784
28622
|
}
|
|
28785
28623
|
let parsedEnabled = null;
|
|
28786
28624
|
try {
|
|
28787
|
-
const raw2 =
|
|
28625
|
+
const raw2 = fs11.readFileSync(filePath, "utf8");
|
|
28788
28626
|
const json = JSON.parse(raw2);
|
|
28789
28627
|
if (json && typeof json === "object") {
|
|
28790
28628
|
const t = json.telemetry;
|
|
@@ -28802,7 +28640,8 @@ function readPersistedConsent(cwd) {
|
|
|
28802
28640
|
const globalPath = configFilePath("global");
|
|
28803
28641
|
const projectPath = configFilePath("project", { cwd });
|
|
28804
28642
|
const global = readConfigOverrideAt(globalPath);
|
|
28805
|
-
const
|
|
28643
|
+
const projectRoot = path16.dirname(path16.dirname(projectPath));
|
|
28644
|
+
const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
|
|
28806
28645
|
if (project === false && global === false) {
|
|
28807
28646
|
return { enabled: false, detail: "config.json (project and global)" };
|
|
28808
28647
|
}
|
|
@@ -28893,7 +28732,7 @@ var PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
|
28893
28732
|
function imageBlock(data, mimeType) {
|
|
28894
28733
|
return { type: "image", data: data.toString("base64"), mimeType };
|
|
28895
28734
|
}
|
|
28896
|
-
async function fetchPngBytes(url) {
|
|
28735
|
+
async function fetchPngBytes(url, signal) {
|
|
28897
28736
|
try {
|
|
28898
28737
|
let buf;
|
|
28899
28738
|
if (url.startsWith("file://")) {
|
|
@@ -28901,7 +28740,7 @@ async function fetchPngBytes(url) {
|
|
|
28901
28740
|
const { fileURLToPath } = await import("node:url");
|
|
28902
28741
|
buf = await readFile8(fileURLToPath(url));
|
|
28903
28742
|
} else {
|
|
28904
|
-
const res = await fetch(url);
|
|
28743
|
+
const res = await fetch(url, { signal });
|
|
28905
28744
|
if (!res.ok) return null;
|
|
28906
28745
|
buf = Buffer.from(await res.arrayBuffer());
|
|
28907
28746
|
}
|
|
@@ -28913,7 +28752,7 @@ async function fetchPngBytes(url) {
|
|
|
28913
28752
|
}
|
|
28914
28753
|
}
|
|
28915
28754
|
async function toMcpContent(result, outputHint, ctx, args) {
|
|
28916
|
-
const suppressImage =
|
|
28755
|
+
const suppressImage = isRecord3(args) && args.includeImageInContext === false;
|
|
28917
28756
|
if (ctx) {
|
|
28918
28757
|
const { result: rewritten, images } = await materializeArtifacts(result, ctx);
|
|
28919
28758
|
if (outputHint === "image") {
|
|
@@ -28924,7 +28763,7 @@ async function toMcpContent(result, outputHint, ctx, args) {
|
|
|
28924
28763
|
blocks2.push(saved);
|
|
28925
28764
|
return blocks2;
|
|
28926
28765
|
}
|
|
28927
|
-
return legacyImageContent(rewritten, suppressImage);
|
|
28766
|
+
return legacyImageContent(rewritten, suppressImage, ctx.signal);
|
|
28928
28767
|
}
|
|
28929
28768
|
const blocks = [{ type: "text", text: stringifyForText(rewritten) }];
|
|
28930
28769
|
if (!suppressImage) for (const img of images) blocks.push(imageBlock(img.data, img.mimeType));
|
|
@@ -28938,13 +28777,13 @@ async function toMcpContent(result, outputHint, ctx, args) {
|
|
|
28938
28777
|
function stringifyForText(value) {
|
|
28939
28778
|
return JSON.stringify(value ?? null, null, 2);
|
|
28940
28779
|
}
|
|
28941
|
-
async function legacyImageContent(result, suppressImage) {
|
|
28780
|
+
async function legacyImageContent(result, suppressImage, signal) {
|
|
28942
28781
|
if (result && typeof result === "object" && "url" in result) {
|
|
28943
28782
|
const r = result;
|
|
28944
28783
|
if (suppressImage) {
|
|
28945
28784
|
return [{ type: "text", text: `Saved: ${r.path ?? ""}` }];
|
|
28946
28785
|
}
|
|
28947
|
-
const buf = await fetchPngBytes(r.url);
|
|
28786
|
+
const buf = await fetchPngBytes(r.url, signal);
|
|
28948
28787
|
if (buf) {
|
|
28949
28788
|
return [imageBlock(buf, "image/png"), { type: "text", text: `Saved: ${r.path ?? ""}` }];
|
|
28950
28789
|
}
|
|
@@ -28957,20 +28796,22 @@ async function legacyImageContent(result, suppressImage) {
|
|
|
28957
28796
|
}
|
|
28958
28797
|
return [{ type: "text", text: JSON.stringify(result, null, 2) }];
|
|
28959
28798
|
}
|
|
28960
|
-
function
|
|
28799
|
+
function isRecord3(value) {
|
|
28961
28800
|
return value !== null && typeof value === "object";
|
|
28962
28801
|
}
|
|
28963
28802
|
function isScreenshotDiffResult(value) {
|
|
28964
|
-
if (!
|
|
28803
|
+
if (!isRecord3(value)) return false;
|
|
28965
28804
|
return typeof value.summary === "string";
|
|
28966
28805
|
}
|
|
28967
28806
|
async function screenshotDiffToMcpContent(result, ctx) {
|
|
28968
28807
|
const blocks = [];
|
|
28969
28808
|
let contextDiffPath = result.contextDiffPath;
|
|
28809
|
+
let diffPath = result.diffPath;
|
|
28970
28810
|
let materializedImages = [];
|
|
28971
28811
|
if (ctx) {
|
|
28972
28812
|
const { result: rewritten, images } = await materializeArtifacts(result, ctx);
|
|
28973
28813
|
contextDiffPath = rewritten.contextDiffPath;
|
|
28814
|
+
diffPath = rewritten.diffPath;
|
|
28974
28815
|
materializedImages = images;
|
|
28975
28816
|
}
|
|
28976
28817
|
if (typeof contextDiffPath === "string") {
|
|
@@ -28994,6 +28835,15 @@ async function screenshotDiffToMcpContent(result, ctx) {
|
|
|
28994
28835
|
}
|
|
28995
28836
|
}
|
|
28996
28837
|
blocks.push({ type: "text", text: result.summary });
|
|
28838
|
+
const paths = [
|
|
28839
|
+
["diffPath", diffPath],
|
|
28840
|
+
["contextDiffPath", contextDiffPath]
|
|
28841
|
+
];
|
|
28842
|
+
for (const [key, value] of paths) {
|
|
28843
|
+
if (value === void 0) continue;
|
|
28844
|
+
const text = `${key}: ${typeof value === "string" ? value : "(unavailable)"}`;
|
|
28845
|
+
blocks.push({ type: "text", text });
|
|
28846
|
+
}
|
|
28997
28847
|
return blocks;
|
|
28998
28848
|
}
|
|
28999
28849
|
var STATUS_GLYPH = {
|
|
@@ -29056,14 +28906,14 @@ async function flowRunToMcpContent(result, ctx) {
|
|
|
29056
28906
|
if (step.result !== void 0) {
|
|
29057
28907
|
blocks.push(...await toMcpContent(step.result, step.outputHint, ctx, step.args));
|
|
29058
28908
|
}
|
|
29059
|
-
if (
|
|
28909
|
+
if (isRecord3(step.artifacts)) {
|
|
29060
28910
|
blocks.push(...await stepArtifactBlocks(step.artifacts, step.status, ctx, step.depth));
|
|
29061
28911
|
}
|
|
29062
28912
|
}
|
|
29063
28913
|
for (const write of result.baselineWrites ?? []) {
|
|
29064
|
-
const { path:
|
|
29065
|
-
if (typeof
|
|
29066
|
-
blocks.push({ type: "text", text: `\u2717 baseline not written: ${
|
|
28914
|
+
const { path: path18, error: error2 } = isRecord3(write) ? write : {};
|
|
28915
|
+
if (typeof path18 === "string" && typeof error2 === "string") {
|
|
28916
|
+
blocks.push({ type: "text", text: `\u2717 baseline not written: ${path18}: ${error2}` });
|
|
29067
28917
|
}
|
|
29068
28918
|
}
|
|
29069
28919
|
if (result.ok !== void 0) {
|
|
@@ -29227,7 +29077,7 @@ function treeIdLine(id) {
|
|
|
29227
29077
|
return `Tree id: ${id}`;
|
|
29228
29078
|
}
|
|
29229
29079
|
function unchangedTreeNote(id, tool) {
|
|
29230
|
-
return `
|
|
29080
|
+
return `Element tree matches \`${id}\` from an earlier \`${tool}\` result. Actions may have effects the tree omits. Call \`describe\` if you lack that tree.`;
|
|
29231
29081
|
}
|
|
29232
29082
|
function randomTag() {
|
|
29233
29083
|
return randomInt(36 ** 3).toString(36).padStart(3, "0");
|
|
@@ -29434,7 +29284,7 @@ function toMcpToolList(tools, options = {}) {
|
|
|
29434
29284
|
// ../argent-mcp/src/list-devices-text.ts
|
|
29435
29285
|
var RUNTIME_PREFIX = "com.apple.CoreSimulator.SimRuntime.";
|
|
29436
29286
|
var STOPPED_SIMULATORS_HEADER = "iOS simulators that are shut down, one per line (platform, udid, name, runtime, state, tags); start one with boot-device:";
|
|
29437
|
-
function
|
|
29287
|
+
function isRecord4(value) {
|
|
29438
29288
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
29439
29289
|
}
|
|
29440
29290
|
function shortRuntime(runtime) {
|
|
@@ -29455,10 +29305,12 @@ function cleanEntry(device) {
|
|
|
29455
29305
|
}
|
|
29456
29306
|
function isStoppedSimulator(device) {
|
|
29457
29307
|
if (device.platform !== "ios" && device.platform !== "ios-remote") return false;
|
|
29458
|
-
if (
|
|
29308
|
+
if (device.kind !== void 0 && device.kind !== "simulator" || "external" in device) {
|
|
29309
|
+
return false;
|
|
29310
|
+
}
|
|
29459
29311
|
return typeof device.udid === "string" && device.state === "Shutdown";
|
|
29460
29312
|
}
|
|
29461
|
-
var ONE_LINE_FIELDS = /* @__PURE__ */ new Set(["platform", "udid", "name", "runtime", "state"]);
|
|
29313
|
+
var ONE_LINE_FIELDS = /* @__PURE__ */ new Set(["platform", "kind", "udid", "name", "runtime", "state"]);
|
|
29462
29314
|
function quoteIfNeeded(value) {
|
|
29463
29315
|
return value === "" || /[\s"\\]/.test(value) ? JSON.stringify(value) : value;
|
|
29464
29316
|
}
|
|
@@ -29478,8 +29330,8 @@ function stoppedSimulatorLine(device) {
|
|
|
29478
29330
|
return parts.join(" ");
|
|
29479
29331
|
}
|
|
29480
29332
|
function listDevicesText(result) {
|
|
29481
|
-
if (!
|
|
29482
|
-
if (!result.devices.every(
|
|
29333
|
+
if (!isRecord4(result) || !Array.isArray(result.devices)) return void 0;
|
|
29334
|
+
if (!result.devices.every(isRecord4)) return void 0;
|
|
29483
29335
|
const devices = result.devices;
|
|
29484
29336
|
const listed = [];
|
|
29485
29337
|
const stopped = [];
|
|
@@ -29504,15 +29356,15 @@ ${stopped.join("\n")}`;
|
|
|
29504
29356
|
}
|
|
29505
29357
|
|
|
29506
29358
|
// ../argent-mcp/src/instructions.ts
|
|
29507
|
-
var SERVER_INSTRUCTIONS = "Argent \u2014 iOS Simulator, Android Emulator, and Chromium app control for interacting, testing, profiling and debugging mobile and Chromium applications. Interaction tools return the screen after the action: a screenshot plus the accessibility element tree with normalized tap frames. Take coordinates from that tree; call describe only when no fresh tree is available \u2014 never guess coordinates from pixels. A result names an identical earlier tree by its tree id in place of repeating it. Do not stop simulator servers when a task finishes: the next task reuses them. Call stop-all-simulator-servers when the user asks to clean up or ends the session, or when a skill tells you to recycle a device's services, always with devices: [...] naming the devices this session used. Never stop a Metro the user started unless they ask. One tool-server is shared by every agent using this argent install, so an unscoped call tears down their devices too \u2014 reserve it for a deliberate machine-wide cleanup.";
|
|
29359
|
+
var SERVER_INSTRUCTIONS = "Argent \u2014 iOS Simulator, Android Emulator, and Chromium app control for interacting, testing, profiling and debugging mobile and Chromium applications. Use the platform the user named; otherwise prefer a device list-devices shows already running, and do not default to iOS. In a single-platform project, boot that platform. Prefer these tools over raw xcrun or adb commands, which are a fallback. Prefer launch-app or open-url over tapping home-screen icons. If the task may need a saved e2e test, load the argent-create-e2e skill (argent-qa-e2e for acceptance tests) before the first launch or in-app action: recording is not retroactive. Load the matching argent-* skill before React Native build or debug work, profiling, a physical phone, a Mac app or a TV. Interaction tools return the screen after the action: a screenshot plus the accessibility element tree with normalized tap frames. Take coordinates from that tree; call describe only when no fresh tree is available \u2014 never guess coordinates from pixels. A result names an identical earlier tree by its tree id in place of repeating it. If a tap fails twice, stop retrying and call a discovery tool again. Use await-ui-element to wait for the UI instead of polling with screenshots. Do not stop simulator servers when a task finishes: the next task reuses them. Call stop-all-simulator-servers when the user asks to clean up or ends the session, or when a skill tells you to recycle a device's services, always with devices: [...] naming the devices this session used. Never stop a Metro the user started unless they ask. One tool-server is shared by every agent using this argent install, so an unscoped call tears down their devices too \u2014 reserve it for a deliberate machine-wide cleanup. The argent CLI manages the toolkit: argent --help lists its commands.";
|
|
29508
29360
|
|
|
29509
29361
|
// ../argent-mcp/src/installed-version.ts
|
|
29510
|
-
import * as
|
|
29511
|
-
import * as
|
|
29362
|
+
import * as fs12 from "node:fs";
|
|
29363
|
+
import * as path17 from "node:path";
|
|
29512
29364
|
function getInstalledVersion() {
|
|
29513
29365
|
try {
|
|
29514
|
-
const pkgPath =
|
|
29515
|
-
const pkg = JSON.parse(
|
|
29366
|
+
const pkgPath = path17.resolve(import.meta.dirname, "..", "package.json");
|
|
29367
|
+
const pkg = JSON.parse(fs12.readFileSync(pkgPath, "utf8"));
|
|
29516
29368
|
return pkg.version ?? "unknown";
|
|
29517
29369
|
} catch {
|
|
29518
29370
|
return "unknown";
|
|
@@ -29567,9 +29419,9 @@ async function untilAborted(work, signal) {
|
|
|
29567
29419
|
}
|
|
29568
29420
|
let onAbort = () => {
|
|
29569
29421
|
};
|
|
29570
|
-
const aborted2 = new Promise((
|
|
29571
|
-
onAbort =
|
|
29572
|
-
if (signal.aborted)
|
|
29422
|
+
const aborted2 = new Promise((resolve12) => {
|
|
29423
|
+
onAbort = resolve12;
|
|
29424
|
+
if (signal.aborted) resolve12();
|
|
29573
29425
|
else signal.addEventListener("abort", onAbort, { once: true });
|
|
29574
29426
|
});
|
|
29575
29427
|
try {
|
|
@@ -29608,11 +29460,12 @@ function createToolCaller(deps) {
|
|
|
29608
29460
|
const client = createToolsClient({
|
|
29609
29461
|
baseUrl: async () => ({ ...deps.getHandle(), remote: deps.remote }),
|
|
29610
29462
|
headers: deps.extraHeaders,
|
|
29463
|
+
refuseRelativeProjectPaths: true,
|
|
29611
29464
|
fetchImpl: async (url, init, meta2) => {
|
|
29612
29465
|
parseUrl(url);
|
|
29613
29466
|
return fetchWithReconnect(() => rebase(url), deps.reconnect, {
|
|
29614
29467
|
init: () => withHeaders(init),
|
|
29615
|
-
// A call that carried an upload is sent once and never
|
|
29468
|
+
// A call that carried an upload is sent once and never timed out: the
|
|
29616
29469
|
// tool-server consumes the upload when it reads the call, so a second
|
|
29617
29470
|
// attempt could only fail.
|
|
29618
29471
|
fetchTimeoutMs: meta2.longRunning || meta2.carriesUpload ? null : timeout,
|
|
@@ -29630,6 +29483,19 @@ function createToolCaller(deps) {
|
|
|
29630
29483
|
}
|
|
29631
29484
|
|
|
29632
29485
|
// ../argent-mcp/src/mcp-server.ts
|
|
29486
|
+
var SAVES_FILES_AFTER_CANCEL = /* @__PURE__ */ new Set(["screen-recording-stop", "native-profiler-stop"]);
|
|
29487
|
+
async function withDeadline(signal, ms, work) {
|
|
29488
|
+
const deadline = new AbortController();
|
|
29489
|
+
const timer = setTimeout(
|
|
29490
|
+
() => deadline.abort(new DOMException("The operation was aborted due to timeout", "TimeoutError")),
|
|
29491
|
+
ms
|
|
29492
|
+
);
|
|
29493
|
+
try {
|
|
29494
|
+
return await work(AbortSignal.any([signal, deadline.signal]));
|
|
29495
|
+
} finally {
|
|
29496
|
+
clearTimeout(timer);
|
|
29497
|
+
}
|
|
29498
|
+
}
|
|
29633
29499
|
async function startMcpServer(options) {
|
|
29634
29500
|
if (shouldShowFirstRunNotice()) {
|
|
29635
29501
|
process.stderr.write(`[argent] ${FIRST_RUN_NOTICE}
|
|
@@ -29686,7 +29552,7 @@ async function startMcpServer(options) {
|
|
|
29686
29552
|
async function spyLog(entry) {
|
|
29687
29553
|
try {
|
|
29688
29554
|
if (!logDirReady) {
|
|
29689
|
-
await mkdir5(
|
|
29555
|
+
await mkdir5(dirname11(LOG_FILE2), { recursive: true });
|
|
29690
29556
|
logDirReady = true;
|
|
29691
29557
|
}
|
|
29692
29558
|
await appendFile(LOG_FILE2, JSON.stringify(entry) + "\n");
|
|
@@ -29699,16 +29565,15 @@ async function startMcpServer(options) {
|
|
|
29699
29565
|
reconnect,
|
|
29700
29566
|
extraHeaders: aiClientHeaders
|
|
29701
29567
|
});
|
|
29702
|
-
async function awaitScreenSettled(udid, toolName) {
|
|
29568
|
+
async function awaitScreenSettled(udid, toolName, signal) {
|
|
29703
29569
|
const maxWaitMs = getAutoScreenshotDelayMs(toolName);
|
|
29704
29570
|
if (maxWaitMs === 0) return true;
|
|
29705
29571
|
const started = Date.now();
|
|
29706
29572
|
try {
|
|
29707
|
-
const idle = await
|
|
29708
|
-
|
|
29709
|
-
|
|
29710
|
-
|
|
29711
|
-
{ signal: AbortSignal.timeout(maxWaitMs + captureTimeoutMs) }
|
|
29573
|
+
const idle = await withDeadline(
|
|
29574
|
+
signal,
|
|
29575
|
+
maxWaitMs + captureTimeoutMs,
|
|
29576
|
+
(s) => callTool("await-screen-idle", { udid, timeoutMs: maxWaitMs }, { signal: s })
|
|
29712
29577
|
);
|
|
29713
29578
|
await spyLog({
|
|
29714
29579
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -29719,7 +29584,10 @@ async function startMcpServer(options) {
|
|
|
29719
29584
|
});
|
|
29720
29585
|
return idle.result?.settled === true;
|
|
29721
29586
|
} catch {
|
|
29722
|
-
await
|
|
29587
|
+
await sleep(Math.max(0, maxWaitMs - (Date.now() - started)), void 0, { signal }).catch(
|
|
29588
|
+
() => {
|
|
29589
|
+
}
|
|
29590
|
+
);
|
|
29723
29591
|
return false;
|
|
29724
29592
|
}
|
|
29725
29593
|
}
|
|
@@ -29729,7 +29597,8 @@ async function startMcpServer(options) {
|
|
|
29729
29597
|
const blocks = await toMcpContent(result, "image", {
|
|
29730
29598
|
toolsUrl: TOOLS_URL,
|
|
29731
29599
|
authToken: AUTH_TOKEN,
|
|
29732
|
-
deviceId: udid
|
|
29600
|
+
deviceId: udid,
|
|
29601
|
+
signal
|
|
29733
29602
|
});
|
|
29734
29603
|
if (!blocks.some((b) => b.type === "image")) return [];
|
|
29735
29604
|
return [{ type: "text", text: "--- Screen after action ---" }, ...blocks];
|
|
@@ -29774,10 +29643,10 @@ ${shown.text}` }];
|
|
|
29774
29643
|
instructions: SERVER_INSTRUCTIONS
|
|
29775
29644
|
}
|
|
29776
29645
|
);
|
|
29777
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
29646
|
+
server.setRequestHandler(ListToolsRequestSchema, async (_request, { signal }) => {
|
|
29778
29647
|
try {
|
|
29779
29648
|
const keywordFacts = !showsSchemaKeywords(server.getClientVersion()?.name);
|
|
29780
|
-
const tools = toMcpToolList(await fetchTools(), { keywordFacts });
|
|
29649
|
+
const tools = toMcpToolList(await fetchTools({ signal }), { keywordFacts });
|
|
29781
29650
|
await spyLog({
|
|
29782
29651
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
29783
29652
|
event: "list_tools",
|
|
@@ -29793,8 +29662,9 @@ ${shown.text}` }];
|
|
|
29793
29662
|
return { tools: [] };
|
|
29794
29663
|
}
|
|
29795
29664
|
});
|
|
29796
|
-
server.setRequestHandler(CallToolRequestSchema, async ({ params }, { signal
|
|
29665
|
+
server.setRequestHandler(CallToolRequestSchema, async ({ params }, { signal }) => {
|
|
29797
29666
|
const t0 = Date.now();
|
|
29667
|
+
const callSignal = SAVES_FILES_AFTER_CANCEL.has(canonicalToolId(params.name)) ? void 0 : signal;
|
|
29798
29668
|
let treeUdid;
|
|
29799
29669
|
await spyLog({
|
|
29800
29670
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -29803,7 +29673,11 @@ ${shown.text}` }];
|
|
|
29803
29673
|
args: params.arguments
|
|
29804
29674
|
});
|
|
29805
29675
|
try {
|
|
29806
|
-
const { result, outputHint, note, profiling } = await callTool(
|
|
29676
|
+
const { result, outputHint, note, profiling } = await callTool(
|
|
29677
|
+
params.name,
|
|
29678
|
+
params.arguments,
|
|
29679
|
+
{ signal: callSignal }
|
|
29680
|
+
);
|
|
29807
29681
|
await spyLog({
|
|
29808
29682
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
29809
29683
|
event: "tool_result",
|
|
@@ -29815,7 +29689,8 @@ ${shown.text}` }];
|
|
|
29815
29689
|
const ctx = {
|
|
29816
29690
|
toolsUrl: TOOLS_URL,
|
|
29817
29691
|
authToken: AUTH_TOKEN,
|
|
29818
|
-
deviceId: getDeviceIdFromArgs(params.arguments)
|
|
29692
|
+
deviceId: getDeviceIdFromArgs(params.arguments),
|
|
29693
|
+
signal: callSignal
|
|
29819
29694
|
};
|
|
29820
29695
|
const devicesText = canonicalToolId(params.name) === "list-devices" ? listDevicesText(result) : void 0;
|
|
29821
29696
|
let content;
|
|
@@ -29849,22 +29724,24 @@ ${shown.text}` }];
|
|
|
29849
29724
|
];
|
|
29850
29725
|
} else if (udid && (wantScreenshot || wantTree) && profiling) {
|
|
29851
29726
|
if (params.name !== "describe") {
|
|
29852
|
-
await awaitScreenSettled(udid, params.name);
|
|
29727
|
+
await awaitScreenSettled(udid, params.name, signal);
|
|
29853
29728
|
content = [...content, { type: "text", text: PROFILING_CAPTURE_SKIPPED_NOTE }];
|
|
29854
29729
|
}
|
|
29855
29730
|
} else if (udid && (wantScreenshot || wantTree)) {
|
|
29856
|
-
const screenSettled = await awaitScreenSettled(udid, params.name);
|
|
29857
|
-
const signal = AbortSignal.timeout(captureTimeoutMs);
|
|
29858
|
-
const screenshot = wantScreenshot ? captureScreenshotBlocks(udid, signal) : Promise.resolve([]);
|
|
29859
|
-
if (!screenSettled) await screenshot;
|
|
29731
|
+
const screenSettled = await awaitScreenSettled(udid, params.name, signal);
|
|
29860
29732
|
if (wantTree) treeUdid = udid;
|
|
29861
|
-
const
|
|
29862
|
-
|
|
29733
|
+
const captured = await withDeadline(signal, captureTimeoutMs, async (captureSignal) => {
|
|
29734
|
+
const screenshot = wantScreenshot ? captureScreenshotBlocks(udid, captureSignal) : Promise.resolve([]);
|
|
29735
|
+
if (!screenSettled) await screenshot;
|
|
29736
|
+
const tree = wantTree ? captureTreeBlocks(udid, params.name, captureSignal) : Promise.resolve([]);
|
|
29737
|
+
return [...await screenshot, ...await tree];
|
|
29738
|
+
});
|
|
29739
|
+
content = [...content, ...captured];
|
|
29863
29740
|
}
|
|
29864
29741
|
if (note) {
|
|
29865
29742
|
content = [{ type: "text", text: note }, ...content];
|
|
29866
29743
|
}
|
|
29867
|
-
if (treeUdid !== void 0 &&
|
|
29744
|
+
if (treeUdid !== void 0 && signal.aborted) trees.forget(treeUdid);
|
|
29868
29745
|
return { content };
|
|
29869
29746
|
} catch (err) {
|
|
29870
29747
|
if (treeUdid !== void 0) trees.forget(treeUdid);
|
|
@@ -29874,6 +29751,7 @@ ${shown.text}` }];
|
|
|
29874
29751
|
name: params.name,
|
|
29875
29752
|
durationMs: Date.now() - t0,
|
|
29876
29753
|
isError: true,
|
|
29754
|
+
...signal.aborted ? { cancelled: true } : {},
|
|
29877
29755
|
error: String(err instanceof Error ? err.message : err)
|
|
29878
29756
|
});
|
|
29879
29757
|
return {
|