@swmansion/argent 0.13.1-next.1 → 0.13.1-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-cmds.mjs +1165 -209
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/installer.mjs +441 -433
- package/dist/mcp-server.mjs +90 -89
- package/dist/preview-ui/index.html +746 -47
- package/dist/preview-ui/theme.css +1 -0
- package/dist/preview-window/main.cjs +4 -2
- package/dist/tool-server.cjs +1087 -753
- package/package.json +3 -2
- package/scripts/postinstall.cjs +22 -0
package/dist/tool-server.cjs
CHANGED
|
@@ -781,10 +781,10 @@ function mergeDefs(...defs) {
|
|
|
781
781
|
function cloneDef(schema) {
|
|
782
782
|
return mergeDefs(schema._zod.def);
|
|
783
783
|
}
|
|
784
|
-
function getElementAtPath(obj,
|
|
785
|
-
if (!
|
|
784
|
+
function getElementAtPath(obj, path31) {
|
|
785
|
+
if (!path31)
|
|
786
786
|
return obj;
|
|
787
|
-
return
|
|
787
|
+
return path31.reduce((acc, key) => acc?.[key], obj);
|
|
788
788
|
}
|
|
789
789
|
function promiseAllObject(promisesObj) {
|
|
790
790
|
const keys = Object.keys(promisesObj);
|
|
@@ -1112,11 +1112,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
1112
1112
|
}
|
|
1113
1113
|
return false;
|
|
1114
1114
|
}
|
|
1115
|
-
function prefixIssues(
|
|
1115
|
+
function prefixIssues(path31, issues) {
|
|
1116
1116
|
return issues.map((iss) => {
|
|
1117
1117
|
var _a3;
|
|
1118
1118
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
1119
|
-
iss.path.unshift(
|
|
1119
|
+
iss.path.unshift(path31);
|
|
1120
1120
|
return iss;
|
|
1121
1121
|
});
|
|
1122
1122
|
}
|
|
@@ -1333,16 +1333,16 @@ function flattenError(error52, mapper = (issue2) => issue2.message) {
|
|
|
1333
1333
|
}
|
|
1334
1334
|
function formatError(error52, mapper = (issue2) => issue2.message) {
|
|
1335
1335
|
const fieldErrors = { _errors: [] };
|
|
1336
|
-
const processError = (error53,
|
|
1336
|
+
const processError = (error53, path31 = []) => {
|
|
1337
1337
|
for (const issue2 of error53.issues) {
|
|
1338
1338
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1339
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1339
|
+
issue2.errors.map((issues) => processError({ issues }, [...path31, ...issue2.path]));
|
|
1340
1340
|
} else if (issue2.code === "invalid_key") {
|
|
1341
|
-
processError({ issues: issue2.issues }, [...
|
|
1341
|
+
processError({ issues: issue2.issues }, [...path31, ...issue2.path]);
|
|
1342
1342
|
} else if (issue2.code === "invalid_element") {
|
|
1343
|
-
processError({ issues: issue2.issues }, [...
|
|
1343
|
+
processError({ issues: issue2.issues }, [...path31, ...issue2.path]);
|
|
1344
1344
|
} else {
|
|
1345
|
-
const fullpath = [...
|
|
1345
|
+
const fullpath = [...path31, ...issue2.path];
|
|
1346
1346
|
if (fullpath.length === 0) {
|
|
1347
1347
|
fieldErrors._errors.push(mapper(issue2));
|
|
1348
1348
|
} else {
|
|
@@ -1369,17 +1369,17 @@ function formatError(error52, mapper = (issue2) => issue2.message) {
|
|
|
1369
1369
|
}
|
|
1370
1370
|
function treeifyError(error52, mapper = (issue2) => issue2.message) {
|
|
1371
1371
|
const result = { errors: [] };
|
|
1372
|
-
const processError = (error53,
|
|
1372
|
+
const processError = (error53, path31 = []) => {
|
|
1373
1373
|
var _a3, _b;
|
|
1374
1374
|
for (const issue2 of error53.issues) {
|
|
1375
1375
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1376
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1376
|
+
issue2.errors.map((issues) => processError({ issues }, [...path31, ...issue2.path]));
|
|
1377
1377
|
} else if (issue2.code === "invalid_key") {
|
|
1378
|
-
processError({ issues: issue2.issues }, [...
|
|
1378
|
+
processError({ issues: issue2.issues }, [...path31, ...issue2.path]);
|
|
1379
1379
|
} else if (issue2.code === "invalid_element") {
|
|
1380
|
-
processError({ issues: issue2.issues }, [...
|
|
1380
|
+
processError({ issues: issue2.issues }, [...path31, ...issue2.path]);
|
|
1381
1381
|
} else {
|
|
1382
|
-
const fullpath = [...
|
|
1382
|
+
const fullpath = [...path31, ...issue2.path];
|
|
1383
1383
|
if (fullpath.length === 0) {
|
|
1384
1384
|
result.errors.push(mapper(issue2));
|
|
1385
1385
|
continue;
|
|
@@ -1411,8 +1411,8 @@ function treeifyError(error52, mapper = (issue2) => issue2.message) {
|
|
|
1411
1411
|
}
|
|
1412
1412
|
function toDotPath(_path) {
|
|
1413
1413
|
const segs = [];
|
|
1414
|
-
const
|
|
1415
|
-
for (const seg of
|
|
1414
|
+
const path31 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1415
|
+
for (const seg of path31) {
|
|
1416
1416
|
if (typeof seg === "number")
|
|
1417
1417
|
segs.push(`[${seg}]`);
|
|
1418
1418
|
else if (typeof seg === "symbol")
|
|
@@ -14842,13 +14842,13 @@ function resolveRef(ref, ctx) {
|
|
|
14842
14842
|
if (!ref.startsWith("#")) {
|
|
14843
14843
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14844
14844
|
}
|
|
14845
|
-
const
|
|
14846
|
-
if (
|
|
14845
|
+
const path31 = ref.slice(1).split("/").filter(Boolean);
|
|
14846
|
+
if (path31.length === 0) {
|
|
14847
14847
|
return ctx.rootSchema;
|
|
14848
14848
|
}
|
|
14849
14849
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14850
|
-
if (
|
|
14851
|
-
const key =
|
|
14850
|
+
if (path31[0] === defsKey) {
|
|
14851
|
+
const key = path31[1];
|
|
14852
14852
|
if (!key || !ctx.defs[key]) {
|
|
14853
14853
|
throw new Error(`Reference not found: ${ref}`);
|
|
14854
14854
|
}
|
|
@@ -31160,11 +31160,11 @@ var require_mime_types = __commonJS({
|
|
|
31160
31160
|
}
|
|
31161
31161
|
return exts[0];
|
|
31162
31162
|
}
|
|
31163
|
-
function lookup(
|
|
31164
|
-
if (!
|
|
31163
|
+
function lookup(path31) {
|
|
31164
|
+
if (!path31 || typeof path31 !== "string") {
|
|
31165
31165
|
return false;
|
|
31166
31166
|
}
|
|
31167
|
-
var extension3 = extname4("x." +
|
|
31167
|
+
var extension3 = extname4("x." + path31).toLowerCase().slice(1);
|
|
31168
31168
|
if (!extension3) {
|
|
31169
31169
|
return false;
|
|
31170
31170
|
}
|
|
@@ -34788,13 +34788,13 @@ var require_view = __commonJS({
|
|
|
34788
34788
|
"../../node_modules/express/lib/view.js"(exports2, module2) {
|
|
34789
34789
|
"use strict";
|
|
34790
34790
|
var debug = require_src()("express:view");
|
|
34791
|
-
var
|
|
34791
|
+
var path31 = require("node:path");
|
|
34792
34792
|
var fs43 = require("node:fs");
|
|
34793
|
-
var dirname10 =
|
|
34794
|
-
var basename9 =
|
|
34795
|
-
var extname4 =
|
|
34796
|
-
var
|
|
34797
|
-
var resolve5 =
|
|
34793
|
+
var dirname10 = path31.dirname;
|
|
34794
|
+
var basename9 = path31.basename;
|
|
34795
|
+
var extname4 = path31.extname;
|
|
34796
|
+
var join37 = path31.join;
|
|
34797
|
+
var resolve5 = path31.resolve;
|
|
34798
34798
|
module2.exports = View;
|
|
34799
34799
|
function View(name, options) {
|
|
34800
34800
|
var opts = options || {};
|
|
@@ -34823,17 +34823,17 @@ var require_view = __commonJS({
|
|
|
34823
34823
|
this.path = this.lookup(fileName);
|
|
34824
34824
|
}
|
|
34825
34825
|
View.prototype.lookup = function lookup(name) {
|
|
34826
|
-
var
|
|
34826
|
+
var path32;
|
|
34827
34827
|
var roots = [].concat(this.root);
|
|
34828
34828
|
debug('lookup "%s"', name);
|
|
34829
|
-
for (var i = 0; i < roots.length && !
|
|
34829
|
+
for (var i = 0; i < roots.length && !path32; i++) {
|
|
34830
34830
|
var root2 = roots[i];
|
|
34831
34831
|
var loc = resolve5(root2, name);
|
|
34832
34832
|
var dir = dirname10(loc);
|
|
34833
34833
|
var file2 = basename9(loc);
|
|
34834
|
-
|
|
34834
|
+
path32 = this.resolve(dir, file2);
|
|
34835
34835
|
}
|
|
34836
|
-
return
|
|
34836
|
+
return path32;
|
|
34837
34837
|
};
|
|
34838
34838
|
View.prototype.render = function render(options, callback) {
|
|
34839
34839
|
var sync = true;
|
|
@@ -34855,21 +34855,21 @@ var require_view = __commonJS({
|
|
|
34855
34855
|
};
|
|
34856
34856
|
View.prototype.resolve = function resolve6(dir, file2) {
|
|
34857
34857
|
var ext = this.ext;
|
|
34858
|
-
var
|
|
34859
|
-
var stat4 = tryStat(
|
|
34858
|
+
var path32 = join37(dir, file2);
|
|
34859
|
+
var stat4 = tryStat(path32);
|
|
34860
34860
|
if (stat4 && stat4.isFile()) {
|
|
34861
|
-
return
|
|
34861
|
+
return path32;
|
|
34862
34862
|
}
|
|
34863
|
-
|
|
34864
|
-
stat4 = tryStat(
|
|
34863
|
+
path32 = join37(dir, basename9(file2, ext), "index" + ext);
|
|
34864
|
+
stat4 = tryStat(path32);
|
|
34865
34865
|
if (stat4 && stat4.isFile()) {
|
|
34866
|
-
return
|
|
34866
|
+
return path32;
|
|
34867
34867
|
}
|
|
34868
34868
|
};
|
|
34869
|
-
function tryStat(
|
|
34870
|
-
debug('stat "%s"',
|
|
34869
|
+
function tryStat(path32) {
|
|
34870
|
+
debug('stat "%s"', path32);
|
|
34871
34871
|
try {
|
|
34872
|
-
return fs43.statSync(
|
|
34872
|
+
return fs43.statSync(path32);
|
|
34873
34873
|
} catch (e) {
|
|
34874
34874
|
return void 0;
|
|
34875
34875
|
}
|
|
@@ -44479,11 +44479,11 @@ var require_mime_types2 = __commonJS({
|
|
|
44479
44479
|
}
|
|
44480
44480
|
return exts[0];
|
|
44481
44481
|
}
|
|
44482
|
-
function lookup(
|
|
44483
|
-
if (!
|
|
44482
|
+
function lookup(path31) {
|
|
44483
|
+
if (!path31 || typeof path31 !== "string") {
|
|
44484
44484
|
return false;
|
|
44485
44485
|
}
|
|
44486
|
-
var extension3 = extname4("x." +
|
|
44486
|
+
var extension3 = extname4("x." + path31).toLowerCase().slice(1);
|
|
44487
44487
|
if (!extension3) {
|
|
44488
44488
|
return false;
|
|
44489
44489
|
}
|
|
@@ -45614,15 +45614,15 @@ var require_dist3 = __commonJS({
|
|
|
45614
45614
|
let index = 0;
|
|
45615
45615
|
function consumeUntil(end) {
|
|
45616
45616
|
const output = [];
|
|
45617
|
-
let
|
|
45617
|
+
let path31 = "";
|
|
45618
45618
|
function writePath() {
|
|
45619
|
-
if (!
|
|
45619
|
+
if (!path31)
|
|
45620
45620
|
return;
|
|
45621
45621
|
output.push({
|
|
45622
45622
|
type: "text",
|
|
45623
|
-
value: encodePath(
|
|
45623
|
+
value: encodePath(path31)
|
|
45624
45624
|
});
|
|
45625
|
-
|
|
45625
|
+
path31 = "";
|
|
45626
45626
|
}
|
|
45627
45627
|
while (index < chars.length) {
|
|
45628
45628
|
const value = chars[index++];
|
|
@@ -45634,7 +45634,7 @@ var require_dist3 = __commonJS({
|
|
|
45634
45634
|
if (index === chars.length) {
|
|
45635
45635
|
throw new PathError(`Unexpected end after \\ at index ${index}`, str);
|
|
45636
45636
|
}
|
|
45637
|
-
|
|
45637
|
+
path31 += chars[index++];
|
|
45638
45638
|
continue;
|
|
45639
45639
|
}
|
|
45640
45640
|
if (value === ":" || value === "*") {
|
|
@@ -45678,7 +45678,7 @@ var require_dist3 = __commonJS({
|
|
|
45678
45678
|
if (value === "}" || value === "(" || value === ")" || value === "[" || value === "]" || value === "+" || value === "?" || value === "!") {
|
|
45679
45679
|
throw new PathError(`Unexpected ${value} at index ${index - 1}`, str);
|
|
45680
45680
|
}
|
|
45681
|
-
|
|
45681
|
+
path31 += value;
|
|
45682
45682
|
}
|
|
45683
45683
|
if (end) {
|
|
45684
45684
|
throw new PathError(`Unexpected end at index ${index}, expected ${end}`, str);
|
|
@@ -45688,17 +45688,17 @@ var require_dist3 = __commonJS({
|
|
|
45688
45688
|
}
|
|
45689
45689
|
return new TokenData(consumeUntil(""), str);
|
|
45690
45690
|
}
|
|
45691
|
-
function compile(
|
|
45691
|
+
function compile(path31, options = {}) {
|
|
45692
45692
|
const { encode: encode9 = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
45693
|
-
const data = typeof
|
|
45693
|
+
const data = typeof path31 === "object" ? path31 : parse4(path31, options);
|
|
45694
45694
|
const fn = tokensToFunction(data.tokens, delimiter, encode9);
|
|
45695
|
-
return function
|
|
45695
|
+
return function path32(params = {}) {
|
|
45696
45696
|
const missing = [];
|
|
45697
|
-
const
|
|
45697
|
+
const path33 = fn(params, missing);
|
|
45698
45698
|
if (missing.length) {
|
|
45699
45699
|
throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
|
|
45700
45700
|
}
|
|
45701
|
-
return
|
|
45701
|
+
return path33;
|
|
45702
45702
|
};
|
|
45703
45703
|
}
|
|
45704
45704
|
function tokensToFunction(tokens, delimiter, encode9) {
|
|
@@ -45760,9 +45760,9 @@ var require_dist3 = __commonJS({
|
|
|
45760
45760
|
return encodeValue(value);
|
|
45761
45761
|
};
|
|
45762
45762
|
}
|
|
45763
|
-
function match(
|
|
45763
|
+
function match(path31, options = {}) {
|
|
45764
45764
|
const { decode: decode8 = decodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
45765
|
-
const { regexp, keys } = pathToRegexp(
|
|
45765
|
+
const { regexp, keys } = pathToRegexp(path31, options);
|
|
45766
45766
|
const decoders = keys.map((key) => {
|
|
45767
45767
|
if (decode8 === false)
|
|
45768
45768
|
return NOOP_VALUE;
|
|
@@ -45774,7 +45774,7 @@ var require_dist3 = __commonJS({
|
|
|
45774
45774
|
const m = regexp.exec(input);
|
|
45775
45775
|
if (!m)
|
|
45776
45776
|
return false;
|
|
45777
|
-
const
|
|
45777
|
+
const path32 = m[0];
|
|
45778
45778
|
const params = /* @__PURE__ */ Object.create(null);
|
|
45779
45779
|
for (let i = 1; i < m.length; i++) {
|
|
45780
45780
|
if (m[i] === void 0)
|
|
@@ -45783,21 +45783,21 @@ var require_dist3 = __commonJS({
|
|
|
45783
45783
|
const decoder = decoders[i - 1];
|
|
45784
45784
|
params[key.name] = decoder(m[i]);
|
|
45785
45785
|
}
|
|
45786
|
-
return { path:
|
|
45786
|
+
return { path: path32, params };
|
|
45787
45787
|
};
|
|
45788
45788
|
}
|
|
45789
|
-
function pathToRegexp(
|
|
45789
|
+
function pathToRegexp(path31, options = {}) {
|
|
45790
45790
|
const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
|
|
45791
45791
|
const keys = [];
|
|
45792
45792
|
let source = "";
|
|
45793
45793
|
let combinations = 0;
|
|
45794
|
-
function process3(
|
|
45795
|
-
if (Array.isArray(
|
|
45796
|
-
for (const p of
|
|
45794
|
+
function process3(path32) {
|
|
45795
|
+
if (Array.isArray(path32)) {
|
|
45796
|
+
for (const p of path32)
|
|
45797
45797
|
process3(p);
|
|
45798
45798
|
return;
|
|
45799
45799
|
}
|
|
45800
|
-
const data = typeof
|
|
45800
|
+
const data = typeof path32 === "object" ? path32 : parse4(path32, options);
|
|
45801
45801
|
flatten(data.tokens, 0, [], (tokens) => {
|
|
45802
45802
|
if (combinations >= 256) {
|
|
45803
45803
|
throw new PathError("Too many path combinations", data.originalPath);
|
|
@@ -45808,7 +45808,7 @@ var require_dist3 = __commonJS({
|
|
|
45808
45808
|
combinations++;
|
|
45809
45809
|
});
|
|
45810
45810
|
}
|
|
45811
|
-
process3(
|
|
45811
|
+
process3(path31);
|
|
45812
45812
|
let pattern = `^(?:${source})`;
|
|
45813
45813
|
if (trailing)
|
|
45814
45814
|
pattern += "(?:" + escape2(delimiter) + "$)?";
|
|
@@ -45948,18 +45948,18 @@ var require_layer = __commonJS({
|
|
|
45948
45948
|
var TRAILING_SLASH_REGEXP = /\/+$/;
|
|
45949
45949
|
var MATCHING_GROUP_REGEXP = /\((?:\?<(.*?)>)?(?!\?)/g;
|
|
45950
45950
|
module2.exports = Layer;
|
|
45951
|
-
function Layer(
|
|
45951
|
+
function Layer(path31, options, fn) {
|
|
45952
45952
|
if (!(this instanceof Layer)) {
|
|
45953
|
-
return new Layer(
|
|
45953
|
+
return new Layer(path31, options, fn);
|
|
45954
45954
|
}
|
|
45955
|
-
debug("new %o",
|
|
45955
|
+
debug("new %o", path31);
|
|
45956
45956
|
const opts = options || {};
|
|
45957
45957
|
this.handle = fn;
|
|
45958
45958
|
this.keys = [];
|
|
45959
45959
|
this.name = fn.name || "<anonymous>";
|
|
45960
45960
|
this.params = void 0;
|
|
45961
45961
|
this.path = void 0;
|
|
45962
|
-
this.slash =
|
|
45962
|
+
this.slash = path31 === "/" && opts.end === false;
|
|
45963
45963
|
function matcher(_path) {
|
|
45964
45964
|
if (_path instanceof RegExp) {
|
|
45965
45965
|
const keys = [];
|
|
@@ -45998,7 +45998,7 @@ var require_layer = __commonJS({
|
|
|
45998
45998
|
decode: decodeParam
|
|
45999
45999
|
});
|
|
46000
46000
|
}
|
|
46001
|
-
this.matchers = Array.isArray(
|
|
46001
|
+
this.matchers = Array.isArray(path31) ? path31.map(matcher) : [matcher(path31)];
|
|
46002
46002
|
}
|
|
46003
46003
|
Layer.prototype.handleError = function handleError(error52, req, res, next) {
|
|
46004
46004
|
const fn = this.handle;
|
|
@@ -46038,9 +46038,9 @@ var require_layer = __commonJS({
|
|
|
46038
46038
|
next(err);
|
|
46039
46039
|
}
|
|
46040
46040
|
};
|
|
46041
|
-
Layer.prototype.match = function match(
|
|
46041
|
+
Layer.prototype.match = function match(path31) {
|
|
46042
46042
|
let match2;
|
|
46043
|
-
if (
|
|
46043
|
+
if (path31 != null) {
|
|
46044
46044
|
if (this.slash) {
|
|
46045
46045
|
this.params = {};
|
|
46046
46046
|
this.path = "";
|
|
@@ -46048,7 +46048,7 @@ var require_layer = __commonJS({
|
|
|
46048
46048
|
}
|
|
46049
46049
|
let i = 0;
|
|
46050
46050
|
while (!match2 && i < this.matchers.length) {
|
|
46051
|
-
match2 = this.matchers[i](
|
|
46051
|
+
match2 = this.matchers[i](path31);
|
|
46052
46052
|
i++;
|
|
46053
46053
|
}
|
|
46054
46054
|
}
|
|
@@ -46076,13 +46076,13 @@ var require_layer = __commonJS({
|
|
|
46076
46076
|
throw err;
|
|
46077
46077
|
}
|
|
46078
46078
|
}
|
|
46079
|
-
function loosen(
|
|
46080
|
-
if (
|
|
46081
|
-
return
|
|
46079
|
+
function loosen(path31) {
|
|
46080
|
+
if (path31 instanceof RegExp || path31 === "/") {
|
|
46081
|
+
return path31;
|
|
46082
46082
|
}
|
|
46083
|
-
return Array.isArray(
|
|
46083
|
+
return Array.isArray(path31) ? path31.map(function(p) {
|
|
46084
46084
|
return loosen(p);
|
|
46085
|
-
}) : String(
|
|
46085
|
+
}) : String(path31).replace(TRAILING_SLASH_REGEXP, "");
|
|
46086
46086
|
}
|
|
46087
46087
|
}
|
|
46088
46088
|
});
|
|
@@ -46098,9 +46098,9 @@ var require_route = __commonJS({
|
|
|
46098
46098
|
var flatten = Array.prototype.flat;
|
|
46099
46099
|
var methods = METHODS.map((method) => method.toLowerCase());
|
|
46100
46100
|
module2.exports = Route2;
|
|
46101
|
-
function Route2(
|
|
46102
|
-
debug("new %o",
|
|
46103
|
-
this.path =
|
|
46101
|
+
function Route2(path31) {
|
|
46102
|
+
debug("new %o", path31);
|
|
46103
|
+
this.path = path31;
|
|
46104
46104
|
this.stack = [];
|
|
46105
46105
|
this.methods = /* @__PURE__ */ Object.create(null);
|
|
46106
46106
|
}
|
|
@@ -46308,8 +46308,8 @@ var require_router = __commonJS({
|
|
|
46308
46308
|
if (++sync > 100) {
|
|
46309
46309
|
return setImmediate(next, err);
|
|
46310
46310
|
}
|
|
46311
|
-
const
|
|
46312
|
-
if (
|
|
46311
|
+
const path31 = getPathname(req);
|
|
46312
|
+
if (path31 == null) {
|
|
46313
46313
|
return done(layerError);
|
|
46314
46314
|
}
|
|
46315
46315
|
let layer;
|
|
@@ -46317,7 +46317,7 @@ var require_router = __commonJS({
|
|
|
46317
46317
|
let route;
|
|
46318
46318
|
while (match !== true && idx < stack.length) {
|
|
46319
46319
|
layer = stack[idx++];
|
|
46320
|
-
match = matchLayer(layer,
|
|
46320
|
+
match = matchLayer(layer, path31);
|
|
46321
46321
|
route = layer.route;
|
|
46322
46322
|
if (typeof match !== "boolean") {
|
|
46323
46323
|
layerError = layerError || match;
|
|
@@ -46355,18 +46355,18 @@ var require_router = __commonJS({
|
|
|
46355
46355
|
} else if (route) {
|
|
46356
46356
|
layer.handleRequest(req, res, next);
|
|
46357
46357
|
} else {
|
|
46358
|
-
trimPrefix(layer, layerError, layerPath,
|
|
46358
|
+
trimPrefix(layer, layerError, layerPath, path31);
|
|
46359
46359
|
}
|
|
46360
46360
|
sync = 0;
|
|
46361
46361
|
});
|
|
46362
46362
|
}
|
|
46363
|
-
function trimPrefix(layer, layerError, layerPath,
|
|
46363
|
+
function trimPrefix(layer, layerError, layerPath, path31) {
|
|
46364
46364
|
if (layerPath.length !== 0) {
|
|
46365
|
-
if (layerPath !==
|
|
46365
|
+
if (layerPath !== path31.substring(0, layerPath.length)) {
|
|
46366
46366
|
next(layerError);
|
|
46367
46367
|
return;
|
|
46368
46368
|
}
|
|
46369
|
-
const c =
|
|
46369
|
+
const c = path31[layerPath.length];
|
|
46370
46370
|
if (c && c !== "/") {
|
|
46371
46371
|
next(layerError);
|
|
46372
46372
|
return;
|
|
@@ -46390,7 +46390,7 @@ var require_router = __commonJS({
|
|
|
46390
46390
|
};
|
|
46391
46391
|
Router2.prototype.use = function use(handler) {
|
|
46392
46392
|
let offset = 0;
|
|
46393
|
-
let
|
|
46393
|
+
let path31 = "/";
|
|
46394
46394
|
if (typeof handler !== "function") {
|
|
46395
46395
|
let arg = handler;
|
|
46396
46396
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -46398,7 +46398,7 @@ var require_router = __commonJS({
|
|
|
46398
46398
|
}
|
|
46399
46399
|
if (typeof arg !== "function") {
|
|
46400
46400
|
offset = 1;
|
|
46401
|
-
|
|
46401
|
+
path31 = handler;
|
|
46402
46402
|
}
|
|
46403
46403
|
}
|
|
46404
46404
|
const callbacks = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -46410,8 +46410,8 @@ var require_router = __commonJS({
|
|
|
46410
46410
|
if (typeof fn !== "function") {
|
|
46411
46411
|
throw new TypeError("argument handler must be a function");
|
|
46412
46412
|
}
|
|
46413
|
-
debug("use %o %s",
|
|
46414
|
-
const layer = new Layer(
|
|
46413
|
+
debug("use %o %s", path31, fn.name || "<anonymous>");
|
|
46414
|
+
const layer = new Layer(path31, {
|
|
46415
46415
|
sensitive: this.caseSensitive,
|
|
46416
46416
|
strict: false,
|
|
46417
46417
|
end: false
|
|
@@ -46421,9 +46421,9 @@ var require_router = __commonJS({
|
|
|
46421
46421
|
}
|
|
46422
46422
|
return this;
|
|
46423
46423
|
};
|
|
46424
|
-
Router2.prototype.route = function route(
|
|
46425
|
-
const route2 = new Route2(
|
|
46426
|
-
const layer = new Layer(
|
|
46424
|
+
Router2.prototype.route = function route(path31) {
|
|
46425
|
+
const route2 = new Route2(path31);
|
|
46426
|
+
const layer = new Layer(path31, {
|
|
46427
46427
|
sensitive: this.caseSensitive,
|
|
46428
46428
|
strict: this.strict,
|
|
46429
46429
|
end: true
|
|
@@ -46436,8 +46436,8 @@ var require_router = __commonJS({
|
|
|
46436
46436
|
return route2;
|
|
46437
46437
|
};
|
|
46438
46438
|
methods.concat("all").forEach(function(method) {
|
|
46439
|
-
Router2.prototype[method] = function(
|
|
46440
|
-
const route = this.route(
|
|
46439
|
+
Router2.prototype[method] = function(path31) {
|
|
46440
|
+
const route = this.route(path31);
|
|
46441
46441
|
route[method].apply(route, slice.call(arguments, 1));
|
|
46442
46442
|
return this;
|
|
46443
46443
|
};
|
|
@@ -46466,9 +46466,9 @@ var require_router = __commonJS({
|
|
|
46466
46466
|
const fqdnIndex = url2.substring(0, pathLength).indexOf("://");
|
|
46467
46467
|
return fqdnIndex !== -1 ? url2.substring(0, url2.indexOf("/", 3 + fqdnIndex)) : void 0;
|
|
46468
46468
|
}
|
|
46469
|
-
function matchLayer(layer,
|
|
46469
|
+
function matchLayer(layer, path31) {
|
|
46470
46470
|
try {
|
|
46471
|
-
return layer.match(
|
|
46471
|
+
return layer.match(path31);
|
|
46472
46472
|
} catch (err) {
|
|
46473
46473
|
return err;
|
|
46474
46474
|
}
|
|
@@ -46696,7 +46696,7 @@ var require_application = __commonJS({
|
|
|
46696
46696
|
};
|
|
46697
46697
|
app.use = function use(fn) {
|
|
46698
46698
|
var offset = 0;
|
|
46699
|
-
var
|
|
46699
|
+
var path31 = "/";
|
|
46700
46700
|
if (typeof fn !== "function") {
|
|
46701
46701
|
var arg = fn;
|
|
46702
46702
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -46704,7 +46704,7 @@ var require_application = __commonJS({
|
|
|
46704
46704
|
}
|
|
46705
46705
|
if (typeof arg !== "function") {
|
|
46706
46706
|
offset = 1;
|
|
46707
|
-
|
|
46707
|
+
path31 = fn;
|
|
46708
46708
|
}
|
|
46709
46709
|
}
|
|
46710
46710
|
var fns = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -46714,12 +46714,12 @@ var require_application = __commonJS({
|
|
|
46714
46714
|
var router = this.router;
|
|
46715
46715
|
fns.forEach(function(fn2) {
|
|
46716
46716
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
46717
|
-
return router.use(
|
|
46717
|
+
return router.use(path31, fn2);
|
|
46718
46718
|
}
|
|
46719
|
-
debug(".use app under %s",
|
|
46720
|
-
fn2.mountpath =
|
|
46719
|
+
debug(".use app under %s", path31);
|
|
46720
|
+
fn2.mountpath = path31;
|
|
46721
46721
|
fn2.parent = this;
|
|
46722
|
-
router.use(
|
|
46722
|
+
router.use(path31, function mounted_app(req, res, next) {
|
|
46723
46723
|
var orig = req.app;
|
|
46724
46724
|
fn2.handle(req, res, function(err) {
|
|
46725
46725
|
Object.setPrototypeOf(req, orig.request);
|
|
@@ -46731,8 +46731,8 @@ var require_application = __commonJS({
|
|
|
46731
46731
|
}, this);
|
|
46732
46732
|
return this;
|
|
46733
46733
|
};
|
|
46734
|
-
app.route = function route(
|
|
46735
|
-
return this.router.route(
|
|
46734
|
+
app.route = function route(path31) {
|
|
46735
|
+
return this.router.route(path31);
|
|
46736
46736
|
};
|
|
46737
46737
|
app.engine = function engine(ext, fn) {
|
|
46738
46738
|
if (typeof fn !== "function") {
|
|
@@ -46775,7 +46775,7 @@ var require_application = __commonJS({
|
|
|
46775
46775
|
}
|
|
46776
46776
|
return this;
|
|
46777
46777
|
};
|
|
46778
|
-
app.path = function
|
|
46778
|
+
app.path = function path31() {
|
|
46779
46779
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
46780
46780
|
};
|
|
46781
46781
|
app.enabled = function enabled(setting) {
|
|
@@ -46791,17 +46791,17 @@ var require_application = __commonJS({
|
|
|
46791
46791
|
return this.set(setting, false);
|
|
46792
46792
|
};
|
|
46793
46793
|
methods.forEach(function(method) {
|
|
46794
|
-
app[method] = function(
|
|
46794
|
+
app[method] = function(path31) {
|
|
46795
46795
|
if (method === "get" && arguments.length === 1) {
|
|
46796
|
-
return this.set(
|
|
46796
|
+
return this.set(path31);
|
|
46797
46797
|
}
|
|
46798
|
-
var route = this.route(
|
|
46798
|
+
var route = this.route(path31);
|
|
46799
46799
|
route[method].apply(route, slice.call(arguments, 1));
|
|
46800
46800
|
return this;
|
|
46801
46801
|
};
|
|
46802
46802
|
});
|
|
46803
|
-
app.all = function all(
|
|
46804
|
-
var route = this.route(
|
|
46803
|
+
app.all = function all(path31) {
|
|
46804
|
+
var route = this.route(path31);
|
|
46805
46805
|
var args = slice.call(arguments, 1);
|
|
46806
46806
|
for (var i = 0; i < methods.length; i++) {
|
|
46807
46807
|
route[methods[i]].apply(route, args);
|
|
@@ -56835,11 +56835,11 @@ var require_mime_types3 = __commonJS({
|
|
|
56835
56835
|
}
|
|
56836
56836
|
return exts[0];
|
|
56837
56837
|
}
|
|
56838
|
-
function lookup(
|
|
56839
|
-
if (!
|
|
56838
|
+
function lookup(path31) {
|
|
56839
|
+
if (!path31 || typeof path31 !== "string") {
|
|
56840
56840
|
return false;
|
|
56841
56841
|
}
|
|
56842
|
-
var extension3 = extname4("x." +
|
|
56842
|
+
var extension3 = extname4("x." + path31).toLowerCase().slice(1);
|
|
56843
56843
|
if (!extension3) {
|
|
56844
56844
|
return false;
|
|
56845
56845
|
}
|
|
@@ -57216,7 +57216,7 @@ var require_request = __commonJS({
|
|
|
57216
57216
|
var subdomains2 = !isIP(hostname3) ? hostname3.split(".").reverse() : [hostname3];
|
|
57217
57217
|
return subdomains2.slice(offset);
|
|
57218
57218
|
});
|
|
57219
|
-
defineGetter(req, "path", function
|
|
57219
|
+
defineGetter(req, "path", function path31() {
|
|
57220
57220
|
return parse4(this).pathname;
|
|
57221
57221
|
});
|
|
57222
57222
|
defineGetter(req, "host", function host() {
|
|
@@ -57427,8 +57427,8 @@ var require_content_disposition = __commonJS({
|
|
|
57427
57427
|
this.type = type;
|
|
57428
57428
|
this.parameters = parameters;
|
|
57429
57429
|
}
|
|
57430
|
-
function basename9(
|
|
57431
|
-
const normalized =
|
|
57430
|
+
function basename9(path31) {
|
|
57431
|
+
const normalized = path31.replaceAll("\\", "/");
|
|
57432
57432
|
let end = normalized.length;
|
|
57433
57433
|
while (end > 0 && normalized[end - 1] === "/") {
|
|
57434
57434
|
end--;
|
|
@@ -67115,11 +67115,11 @@ var require_mime_types4 = __commonJS({
|
|
|
67115
67115
|
}
|
|
67116
67116
|
return exts[0];
|
|
67117
67117
|
}
|
|
67118
|
-
function lookup(
|
|
67119
|
-
if (!
|
|
67118
|
+
function lookup(path31) {
|
|
67119
|
+
if (!path31 || typeof path31 !== "string") {
|
|
67120
67120
|
return false;
|
|
67121
67121
|
}
|
|
67122
|
-
var extension3 = extname4("x." +
|
|
67122
|
+
var extension3 = extname4("x." + path31).toLowerCase().slice(1);
|
|
67123
67123
|
if (!extension3) {
|
|
67124
67124
|
return false;
|
|
67125
67125
|
}
|
|
@@ -67179,27 +67179,27 @@ var require_send = __commonJS({
|
|
|
67179
67179
|
var ms = require_ms();
|
|
67180
67180
|
var onFinished = require_on_finished();
|
|
67181
67181
|
var parseRange = require_range_parser();
|
|
67182
|
-
var
|
|
67182
|
+
var path31 = require("path");
|
|
67183
67183
|
var statuses = require_statuses();
|
|
67184
67184
|
var Stream2 = require("stream");
|
|
67185
67185
|
var util = require("util");
|
|
67186
|
-
var extname4 =
|
|
67187
|
-
var
|
|
67188
|
-
var normalize =
|
|
67189
|
-
var resolve5 =
|
|
67190
|
-
var sep4 =
|
|
67186
|
+
var extname4 = path31.extname;
|
|
67187
|
+
var join37 = path31.join;
|
|
67188
|
+
var normalize = path31.normalize;
|
|
67189
|
+
var resolve5 = path31.resolve;
|
|
67190
|
+
var sep4 = path31.sep;
|
|
67191
67191
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
67192
67192
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
67193
67193
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
67194
67194
|
module2.exports = send;
|
|
67195
|
-
function send(req,
|
|
67196
|
-
return new SendStream(req,
|
|
67195
|
+
function send(req, path32, options) {
|
|
67196
|
+
return new SendStream(req, path32, options);
|
|
67197
67197
|
}
|
|
67198
|
-
function SendStream(req,
|
|
67198
|
+
function SendStream(req, path32, options) {
|
|
67199
67199
|
Stream2.call(this);
|
|
67200
67200
|
var opts = options || {};
|
|
67201
67201
|
this.options = opts;
|
|
67202
|
-
this.path =
|
|
67202
|
+
this.path = path32;
|
|
67203
67203
|
this.req = req;
|
|
67204
67204
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
67205
67205
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -67313,10 +67313,10 @@ var require_send = __commonJS({
|
|
|
67313
67313
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
67314
67314
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
67315
67315
|
};
|
|
67316
|
-
SendStream.prototype.redirect = function redirect(
|
|
67316
|
+
SendStream.prototype.redirect = function redirect(path32) {
|
|
67317
67317
|
var res = this.res;
|
|
67318
67318
|
if (hasListeners(this, "directory")) {
|
|
67319
|
-
this.emit("directory", res,
|
|
67319
|
+
this.emit("directory", res, path32);
|
|
67320
67320
|
return;
|
|
67321
67321
|
}
|
|
67322
67322
|
if (this.hasTrailingSlash()) {
|
|
@@ -67336,38 +67336,38 @@ var require_send = __commonJS({
|
|
|
67336
67336
|
SendStream.prototype.pipe = function pipe2(res) {
|
|
67337
67337
|
var root2 = this._root;
|
|
67338
67338
|
this.res = res;
|
|
67339
|
-
var
|
|
67340
|
-
if (
|
|
67339
|
+
var path32 = decode8(this.path);
|
|
67340
|
+
if (path32 === -1) {
|
|
67341
67341
|
this.error(400);
|
|
67342
67342
|
return res;
|
|
67343
67343
|
}
|
|
67344
|
-
if (~
|
|
67344
|
+
if (~path32.indexOf("\0")) {
|
|
67345
67345
|
this.error(400);
|
|
67346
67346
|
return res;
|
|
67347
67347
|
}
|
|
67348
67348
|
var parts;
|
|
67349
67349
|
if (root2 !== null) {
|
|
67350
|
-
if (
|
|
67351
|
-
|
|
67350
|
+
if (path32) {
|
|
67351
|
+
path32 = normalize("." + sep4 + path32);
|
|
67352
67352
|
}
|
|
67353
|
-
if (UP_PATH_REGEXP.test(
|
|
67354
|
-
debug('malicious path "%s"',
|
|
67353
|
+
if (UP_PATH_REGEXP.test(path32)) {
|
|
67354
|
+
debug('malicious path "%s"', path32);
|
|
67355
67355
|
this.error(403);
|
|
67356
67356
|
return res;
|
|
67357
67357
|
}
|
|
67358
|
-
parts =
|
|
67359
|
-
|
|
67358
|
+
parts = path32.split(sep4);
|
|
67359
|
+
path32 = normalize(join37(root2, path32));
|
|
67360
67360
|
} else {
|
|
67361
|
-
if (UP_PATH_REGEXP.test(
|
|
67362
|
-
debug('malicious path "%s"',
|
|
67361
|
+
if (UP_PATH_REGEXP.test(path32)) {
|
|
67362
|
+
debug('malicious path "%s"', path32);
|
|
67363
67363
|
this.error(403);
|
|
67364
67364
|
return res;
|
|
67365
67365
|
}
|
|
67366
|
-
parts = normalize(
|
|
67367
|
-
|
|
67366
|
+
parts = normalize(path32).split(sep4);
|
|
67367
|
+
path32 = resolve5(path32);
|
|
67368
67368
|
}
|
|
67369
67369
|
if (containsDotFile(parts)) {
|
|
67370
|
-
debug('%s dotfile "%s"', this._dotfiles,
|
|
67370
|
+
debug('%s dotfile "%s"', this._dotfiles, path32);
|
|
67371
67371
|
switch (this._dotfiles) {
|
|
67372
67372
|
case "allow":
|
|
67373
67373
|
break;
|
|
@@ -67381,13 +67381,13 @@ var require_send = __commonJS({
|
|
|
67381
67381
|
}
|
|
67382
67382
|
}
|
|
67383
67383
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
67384
|
-
this.sendIndex(
|
|
67384
|
+
this.sendIndex(path32);
|
|
67385
67385
|
return res;
|
|
67386
67386
|
}
|
|
67387
|
-
this.sendFile(
|
|
67387
|
+
this.sendFile(path32);
|
|
67388
67388
|
return res;
|
|
67389
67389
|
};
|
|
67390
|
-
SendStream.prototype.send = function send2(
|
|
67390
|
+
SendStream.prototype.send = function send2(path32, stat4) {
|
|
67391
67391
|
var len = stat4.size;
|
|
67392
67392
|
var options = this.options;
|
|
67393
67393
|
var opts = {};
|
|
@@ -67399,9 +67399,9 @@ var require_send = __commonJS({
|
|
|
67399
67399
|
this.headersAlreadySent();
|
|
67400
67400
|
return;
|
|
67401
67401
|
}
|
|
67402
|
-
debug('pipe "%s"',
|
|
67403
|
-
this.setHeader(
|
|
67404
|
-
this.type(
|
|
67402
|
+
debug('pipe "%s"', path32);
|
|
67403
|
+
this.setHeader(path32, stat4);
|
|
67404
|
+
this.type(path32);
|
|
67405
67405
|
if (this.isConditionalGET()) {
|
|
67406
67406
|
if (this.isPreconditionFailure()) {
|
|
67407
67407
|
this.error(412);
|
|
@@ -67450,28 +67450,28 @@ var require_send = __commonJS({
|
|
|
67450
67450
|
res.end();
|
|
67451
67451
|
return;
|
|
67452
67452
|
}
|
|
67453
|
-
this.stream(
|
|
67453
|
+
this.stream(path32, opts);
|
|
67454
67454
|
};
|
|
67455
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
67455
|
+
SendStream.prototype.sendFile = function sendFile(path32) {
|
|
67456
67456
|
var i = 0;
|
|
67457
67457
|
var self2 = this;
|
|
67458
|
-
debug('stat "%s"',
|
|
67459
|
-
fs43.stat(
|
|
67460
|
-
var pathEndsWithSep =
|
|
67461
|
-
if (err && err.code === "ENOENT" && !extname4(
|
|
67458
|
+
debug('stat "%s"', path32);
|
|
67459
|
+
fs43.stat(path32, function onstat(err, stat4) {
|
|
67460
|
+
var pathEndsWithSep = path32[path32.length - 1] === sep4;
|
|
67461
|
+
if (err && err.code === "ENOENT" && !extname4(path32) && !pathEndsWithSep) {
|
|
67462
67462
|
return next(err);
|
|
67463
67463
|
}
|
|
67464
67464
|
if (err) return self2.onStatError(err);
|
|
67465
|
-
if (stat4.isDirectory()) return self2.redirect(
|
|
67465
|
+
if (stat4.isDirectory()) return self2.redirect(path32);
|
|
67466
67466
|
if (pathEndsWithSep) return self2.error(404);
|
|
67467
|
-
self2.emit("file",
|
|
67468
|
-
self2.send(
|
|
67467
|
+
self2.emit("file", path32, stat4);
|
|
67468
|
+
self2.send(path32, stat4);
|
|
67469
67469
|
});
|
|
67470
67470
|
function next(err) {
|
|
67471
67471
|
if (self2._extensions.length <= i) {
|
|
67472
67472
|
return err ? self2.onStatError(err) : self2.error(404);
|
|
67473
67473
|
}
|
|
67474
|
-
var p =
|
|
67474
|
+
var p = path32 + "." + self2._extensions[i++];
|
|
67475
67475
|
debug('stat "%s"', p);
|
|
67476
67476
|
fs43.stat(p, function(err2, stat4) {
|
|
67477
67477
|
if (err2) return next(err2);
|
|
@@ -67481,7 +67481,7 @@ var require_send = __commonJS({
|
|
|
67481
67481
|
});
|
|
67482
67482
|
}
|
|
67483
67483
|
};
|
|
67484
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
67484
|
+
SendStream.prototype.sendIndex = function sendIndex(path32) {
|
|
67485
67485
|
var i = -1;
|
|
67486
67486
|
var self2 = this;
|
|
67487
67487
|
function next(err) {
|
|
@@ -67489,7 +67489,7 @@ var require_send = __commonJS({
|
|
|
67489
67489
|
if (err) return self2.onStatError(err);
|
|
67490
67490
|
return self2.error(404);
|
|
67491
67491
|
}
|
|
67492
|
-
var p =
|
|
67492
|
+
var p = join37(path32, self2._index[i]);
|
|
67493
67493
|
debug('stat "%s"', p);
|
|
67494
67494
|
fs43.stat(p, function(err2, stat4) {
|
|
67495
67495
|
if (err2) return next(err2);
|
|
@@ -67500,10 +67500,10 @@ var require_send = __commonJS({
|
|
|
67500
67500
|
}
|
|
67501
67501
|
next();
|
|
67502
67502
|
};
|
|
67503
|
-
SendStream.prototype.stream = function stream(
|
|
67503
|
+
SendStream.prototype.stream = function stream(path32, options) {
|
|
67504
67504
|
var self2 = this;
|
|
67505
67505
|
var res = this.res;
|
|
67506
|
-
var stream2 = fs43.createReadStream(
|
|
67506
|
+
var stream2 = fs43.createReadStream(path32, options);
|
|
67507
67507
|
this.emit("stream", stream2);
|
|
67508
67508
|
stream2.pipe(res);
|
|
67509
67509
|
function cleanup() {
|
|
@@ -67518,17 +67518,17 @@ var require_send = __commonJS({
|
|
|
67518
67518
|
self2.emit("end");
|
|
67519
67519
|
});
|
|
67520
67520
|
};
|
|
67521
|
-
SendStream.prototype.type = function type(
|
|
67521
|
+
SendStream.prototype.type = function type(path32) {
|
|
67522
67522
|
var res = this.res;
|
|
67523
67523
|
if (res.getHeader("Content-Type")) return;
|
|
67524
|
-
var ext = extname4(
|
|
67524
|
+
var ext = extname4(path32);
|
|
67525
67525
|
var type2 = mime.contentType(ext) || "application/octet-stream";
|
|
67526
67526
|
debug("content-type %s", type2);
|
|
67527
67527
|
res.setHeader("Content-Type", type2);
|
|
67528
67528
|
};
|
|
67529
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
67529
|
+
SendStream.prototype.setHeader = function setHeader(path32, stat4) {
|
|
67530
67530
|
var res = this.res;
|
|
67531
|
-
this.emit("headers", res,
|
|
67531
|
+
this.emit("headers", res, path32, stat4);
|
|
67532
67532
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
67533
67533
|
debug("accept ranges");
|
|
67534
67534
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -67586,9 +67586,9 @@ var require_send = __commonJS({
|
|
|
67586
67586
|
}
|
|
67587
67587
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
67588
67588
|
}
|
|
67589
|
-
function decode8(
|
|
67589
|
+
function decode8(path32) {
|
|
67590
67590
|
try {
|
|
67591
|
-
return decodeURIComponent(
|
|
67591
|
+
return decodeURIComponent(path32);
|
|
67592
67592
|
} catch (err) {
|
|
67593
67593
|
return -1;
|
|
67594
67594
|
}
|
|
@@ -67732,7 +67732,7 @@ var require_response = __commonJS({
|
|
|
67732
67732
|
var http3 = require("node:http");
|
|
67733
67733
|
var onFinished = require_on_finished();
|
|
67734
67734
|
var mime = require_mime_types2();
|
|
67735
|
-
var
|
|
67735
|
+
var path31 = require("node:path");
|
|
67736
67736
|
var pathIsAbsolute = require("node:path").isAbsolute;
|
|
67737
67737
|
var statuses = require_statuses();
|
|
67738
67738
|
var sign = require_cookie_signature().sign;
|
|
@@ -67741,8 +67741,8 @@ var require_response = __commonJS({
|
|
|
67741
67741
|
var setCharset = require_utils3().setCharset;
|
|
67742
67742
|
var cookie = require_cookie();
|
|
67743
67743
|
var send = require_send();
|
|
67744
|
-
var extname4 =
|
|
67745
|
-
var resolve5 =
|
|
67744
|
+
var extname4 = path31.extname;
|
|
67745
|
+
var resolve5 = path31.resolve;
|
|
67746
67746
|
var vary = require_vary();
|
|
67747
67747
|
var { Buffer: Buffer2 } = require("node:buffer");
|
|
67748
67748
|
var res = Object.create(http3.ServerResponse.prototype);
|
|
@@ -67888,26 +67888,26 @@ var require_response = __commonJS({
|
|
|
67888
67888
|
this.type("txt");
|
|
67889
67889
|
return this.send(body);
|
|
67890
67890
|
};
|
|
67891
|
-
res.sendFile = function sendFile(
|
|
67891
|
+
res.sendFile = function sendFile(path32, options, callback) {
|
|
67892
67892
|
var done = callback;
|
|
67893
67893
|
var req = this.req;
|
|
67894
67894
|
var res2 = this;
|
|
67895
67895
|
var next = req.next;
|
|
67896
67896
|
var opts = options || {};
|
|
67897
|
-
if (!
|
|
67897
|
+
if (!path32) {
|
|
67898
67898
|
throw new TypeError("path argument is required to res.sendFile");
|
|
67899
67899
|
}
|
|
67900
|
-
if (typeof
|
|
67900
|
+
if (typeof path32 !== "string") {
|
|
67901
67901
|
throw new TypeError("path must be a string to res.sendFile");
|
|
67902
67902
|
}
|
|
67903
67903
|
if (typeof options === "function") {
|
|
67904
67904
|
done = options;
|
|
67905
67905
|
opts = {};
|
|
67906
67906
|
}
|
|
67907
|
-
if (!opts.root && !pathIsAbsolute(
|
|
67907
|
+
if (!opts.root && !pathIsAbsolute(path32)) {
|
|
67908
67908
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
67909
67909
|
}
|
|
67910
|
-
var pathname = encodeURI(
|
|
67910
|
+
var pathname = encodeURI(path32);
|
|
67911
67911
|
opts.etag = this.app.enabled("etag");
|
|
67912
67912
|
var file2 = send(req, pathname, opts);
|
|
67913
67913
|
sendfile(res2, file2, opts, function(err) {
|
|
@@ -67918,7 +67918,7 @@ var require_response = __commonJS({
|
|
|
67918
67918
|
}
|
|
67919
67919
|
});
|
|
67920
67920
|
};
|
|
67921
|
-
res.download = function download(
|
|
67921
|
+
res.download = function download(path32, filename, options, callback) {
|
|
67922
67922
|
var done = callback;
|
|
67923
67923
|
var name = filename;
|
|
67924
67924
|
var opts = options || null;
|
|
@@ -67935,7 +67935,7 @@ var require_response = __commonJS({
|
|
|
67935
67935
|
opts = filename;
|
|
67936
67936
|
}
|
|
67937
67937
|
var headers = {
|
|
67938
|
-
"Content-Disposition": contentDisposition(name ||
|
|
67938
|
+
"Content-Disposition": contentDisposition(name || path32)
|
|
67939
67939
|
};
|
|
67940
67940
|
if (opts && opts.headers) {
|
|
67941
67941
|
var keys = Object.keys(opts.headers);
|
|
@@ -67948,7 +67948,7 @@ var require_response = __commonJS({
|
|
|
67948
67948
|
}
|
|
67949
67949
|
opts = Object.create(opts);
|
|
67950
67950
|
opts.headers = headers;
|
|
67951
|
-
var fullPath = !opts.root ? resolve5(
|
|
67951
|
+
var fullPath = !opts.root ? resolve5(path32) : path32;
|
|
67952
67952
|
return this.sendFile(fullPath, opts, done);
|
|
67953
67953
|
};
|
|
67954
67954
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -68231,11 +68231,11 @@ var require_serve_static = __commonJS({
|
|
|
68231
68231
|
}
|
|
68232
68232
|
var forwardError = !fallthrough;
|
|
68233
68233
|
var originalUrl = parseUrl.original(req);
|
|
68234
|
-
var
|
|
68235
|
-
if (
|
|
68236
|
-
|
|
68234
|
+
var path31 = parseUrl(req).pathname;
|
|
68235
|
+
if (path31 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
68236
|
+
path31 = "";
|
|
68237
68237
|
}
|
|
68238
|
-
var stream = send(req,
|
|
68238
|
+
var stream = send(req, path31, opts);
|
|
68239
68239
|
stream.on("directory", onDirectory);
|
|
68240
68240
|
if (setHeaders) {
|
|
68241
68241
|
stream.on("headers", setHeaders);
|
|
@@ -70723,44 +70723,44 @@ __export(path_exports, {
|
|
|
70723
70723
|
empty: () => empty,
|
|
70724
70724
|
from: () => from,
|
|
70725
70725
|
hasPrefix: () => hasPrefix,
|
|
70726
|
-
join: () =>
|
|
70726
|
+
join: () => join9,
|
|
70727
70727
|
stripPrefix: () => stripPrefix
|
|
70728
70728
|
});
|
|
70729
70729
|
function from(...paths) {
|
|
70730
70730
|
const joined = paths.join("/");
|
|
70731
70731
|
return joined.replace(/\/+/g, "/").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
70732
70732
|
}
|
|
70733
|
-
function hasPrefix(prefix,
|
|
70733
|
+
function hasPrefix(prefix, path31) {
|
|
70734
70734
|
if (prefix === "") {
|
|
70735
70735
|
return true;
|
|
70736
70736
|
}
|
|
70737
|
-
if (!
|
|
70737
|
+
if (!path31.startsWith(prefix)) {
|
|
70738
70738
|
return false;
|
|
70739
70739
|
}
|
|
70740
|
-
if (
|
|
70740
|
+
if (path31.length === prefix.length) {
|
|
70741
70741
|
return true;
|
|
70742
70742
|
}
|
|
70743
|
-
return
|
|
70743
|
+
return path31[prefix.length] === "/";
|
|
70744
70744
|
}
|
|
70745
|
-
function stripPrefix(prefix,
|
|
70746
|
-
if (!hasPrefix(prefix,
|
|
70745
|
+
function stripPrefix(prefix, path31) {
|
|
70746
|
+
if (!hasPrefix(prefix, path31)) {
|
|
70747
70747
|
return null;
|
|
70748
70748
|
}
|
|
70749
70749
|
if (prefix === "") {
|
|
70750
|
-
return
|
|
70750
|
+
return path31;
|
|
70751
70751
|
}
|
|
70752
|
-
if (
|
|
70752
|
+
if (path31.length === prefix.length) {
|
|
70753
70753
|
return "";
|
|
70754
70754
|
}
|
|
70755
|
-
return
|
|
70755
|
+
return path31.slice(prefix.length + 1);
|
|
70756
70756
|
}
|
|
70757
|
-
function
|
|
70758
|
-
if (
|
|
70757
|
+
function join9(path31, other) {
|
|
70758
|
+
if (path31 === "") {
|
|
70759
70759
|
return other;
|
|
70760
70760
|
} else if (other === "") {
|
|
70761
|
-
return
|
|
70761
|
+
return path31;
|
|
70762
70762
|
} else {
|
|
70763
|
-
return `${
|
|
70763
|
+
return `${path31}/${other}`;
|
|
70764
70764
|
}
|
|
70765
70765
|
}
|
|
70766
70766
|
function empty() {
|
|
@@ -74716,15 +74716,15 @@ var require_fetch = __commonJS({
|
|
|
74716
74716
|
var require_path = __commonJS({
|
|
74717
74717
|
"../../node_modules/@protobufjs/path/index.js"(exports2) {
|
|
74718
74718
|
"use strict";
|
|
74719
|
-
var
|
|
74719
|
+
var path31 = exports2;
|
|
74720
74720
|
var isAbsolute4 = (
|
|
74721
74721
|
/**
|
|
74722
74722
|
* Tests if the specified path is absolute.
|
|
74723
74723
|
* @param {string} path Path to test
|
|
74724
74724
|
* @returns {boolean} `true` if path is absolute
|
|
74725
74725
|
*/
|
|
74726
|
-
|
|
74727
|
-
return /^(?:\/|\w+:)/.test(
|
|
74726
|
+
path31.isAbsolute = function isAbsolute5(path32) {
|
|
74727
|
+
return /^(?:\/|\w+:)/.test(path32);
|
|
74728
74728
|
}
|
|
74729
74729
|
);
|
|
74730
74730
|
var normalize = (
|
|
@@ -74733,9 +74733,9 @@ var require_path = __commonJS({
|
|
|
74733
74733
|
* @param {string} path Path to normalize
|
|
74734
74734
|
* @returns {string} Normalized path
|
|
74735
74735
|
*/
|
|
74736
|
-
|
|
74737
|
-
|
|
74738
|
-
var parts =
|
|
74736
|
+
path31.normalize = function normalize2(path32) {
|
|
74737
|
+
path32 = path32.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
|
|
74738
|
+
var parts = path32.split("/"), absolute = isAbsolute4(path32), prefix = "";
|
|
74739
74739
|
if (absolute)
|
|
74740
74740
|
prefix = parts.shift() + "/";
|
|
74741
74741
|
for (var i = 0; i < parts.length; ) {
|
|
@@ -74754,7 +74754,7 @@ var require_path = __commonJS({
|
|
|
74754
74754
|
return prefix + parts.join("/");
|
|
74755
74755
|
}
|
|
74756
74756
|
);
|
|
74757
|
-
|
|
74757
|
+
path31.resolve = function resolve5(originPath, includePath, alreadyNormalized) {
|
|
74758
74758
|
if (!alreadyNormalized)
|
|
74759
74759
|
includePath = normalize(includePath);
|
|
74760
74760
|
if (isAbsolute4(includePath))
|
|
@@ -74938,18 +74938,18 @@ var require_namespace = __commonJS({
|
|
|
74938
74938
|
object2.onRemove(this);
|
|
74939
74939
|
return clearCache(this);
|
|
74940
74940
|
};
|
|
74941
|
-
Namespace.prototype.define = function define2(
|
|
74942
|
-
if (util.isString(
|
|
74943
|
-
|
|
74944
|
-
else if (!Array.isArray(
|
|
74941
|
+
Namespace.prototype.define = function define2(path31, json2) {
|
|
74942
|
+
if (util.isString(path31))
|
|
74943
|
+
path31 = path31.split(".");
|
|
74944
|
+
else if (!Array.isArray(path31))
|
|
74945
74945
|
throw TypeError("illegal path");
|
|
74946
|
-
if (
|
|
74946
|
+
if (path31 && path31.length && path31[0] === "")
|
|
74947
74947
|
throw Error("path must be relative");
|
|
74948
|
-
if (
|
|
74948
|
+
if (path31.length > util.recursionLimit)
|
|
74949
74949
|
throw Error("max depth exceeded");
|
|
74950
74950
|
var ptr = this;
|
|
74951
|
-
while (
|
|
74952
|
-
var part =
|
|
74951
|
+
while (path31.length > 0) {
|
|
74952
|
+
var part = path31.shift();
|
|
74953
74953
|
if (ptr.nested && ptr.nested[part]) {
|
|
74954
74954
|
ptr = ptr.nested[part];
|
|
74955
74955
|
if (!(ptr instanceof Namespace))
|
|
@@ -74984,26 +74984,26 @@ var require_namespace = __commonJS({
|
|
|
74984
74984
|
});
|
|
74985
74985
|
return this;
|
|
74986
74986
|
};
|
|
74987
|
-
Namespace.prototype.lookup = function lookup(
|
|
74987
|
+
Namespace.prototype.lookup = function lookup(path31, filterTypes, parentAlreadyChecked) {
|
|
74988
74988
|
if (typeof filterTypes === "boolean") {
|
|
74989
74989
|
parentAlreadyChecked = filterTypes;
|
|
74990
74990
|
filterTypes = void 0;
|
|
74991
74991
|
} else if (filterTypes && !Array.isArray(filterTypes))
|
|
74992
74992
|
filterTypes = [filterTypes];
|
|
74993
|
-
if (util.isString(
|
|
74994
|
-
if (
|
|
74993
|
+
if (util.isString(path31) && path31.length) {
|
|
74994
|
+
if (path31 === ".")
|
|
74995
74995
|
return this.root;
|
|
74996
|
-
|
|
74997
|
-
} else if (!
|
|
74996
|
+
path31 = path31.split(".");
|
|
74997
|
+
} else if (!path31.length)
|
|
74998
74998
|
return this;
|
|
74999
|
-
var flatPath =
|
|
75000
|
-
if (
|
|
75001
|
-
return this.root.lookup(
|
|
74999
|
+
var flatPath = path31.join(".");
|
|
75000
|
+
if (path31[0] === "")
|
|
75001
|
+
return this.root.lookup(path31.slice(1), filterTypes);
|
|
75002
75002
|
var found = this.root._fullyQualifiedObjects && this.root._fullyQualifiedObjects["." + flatPath];
|
|
75003
75003
|
if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
|
|
75004
75004
|
return found;
|
|
75005
75005
|
}
|
|
75006
|
-
found = this._lookupImpl(
|
|
75006
|
+
found = this._lookupImpl(path31, flatPath);
|
|
75007
75007
|
if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
|
|
75008
75008
|
return found;
|
|
75009
75009
|
}
|
|
@@ -75011,7 +75011,7 @@ var require_namespace = __commonJS({
|
|
|
75011
75011
|
return null;
|
|
75012
75012
|
var current = this;
|
|
75013
75013
|
while (current.parent) {
|
|
75014
|
-
found = current.parent._lookupImpl(
|
|
75014
|
+
found = current.parent._lookupImpl(path31, flatPath);
|
|
75015
75015
|
if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
|
|
75016
75016
|
return found;
|
|
75017
75017
|
}
|
|
@@ -75019,22 +75019,22 @@ var require_namespace = __commonJS({
|
|
|
75019
75019
|
}
|
|
75020
75020
|
return null;
|
|
75021
75021
|
};
|
|
75022
|
-
Namespace.prototype._lookupImpl = function lookup(
|
|
75022
|
+
Namespace.prototype._lookupImpl = function lookup(path31, flatPath) {
|
|
75023
75023
|
if (Object.prototype.hasOwnProperty.call(this._lookupCache, flatPath)) {
|
|
75024
75024
|
return this._lookupCache[flatPath];
|
|
75025
75025
|
}
|
|
75026
|
-
var found = this.get(
|
|
75026
|
+
var found = this.get(path31[0]);
|
|
75027
75027
|
var exact = null;
|
|
75028
75028
|
if (found) {
|
|
75029
|
-
if (
|
|
75029
|
+
if (path31.length === 1) {
|
|
75030
75030
|
exact = found;
|
|
75031
75031
|
} else if (found instanceof Namespace) {
|
|
75032
|
-
|
|
75033
|
-
exact = found._lookupImpl(
|
|
75032
|
+
path31 = path31.slice(1);
|
|
75033
|
+
exact = found._lookupImpl(path31, path31.join("."));
|
|
75034
75034
|
}
|
|
75035
75035
|
} else {
|
|
75036
75036
|
for (var i = 0; i < this.nestedArray.length; ++i)
|
|
75037
|
-
if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(
|
|
75037
|
+
if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(path31, flatPath))) {
|
|
75038
75038
|
exact = found;
|
|
75039
75039
|
break;
|
|
75040
75040
|
}
|
|
@@ -75042,28 +75042,28 @@ var require_namespace = __commonJS({
|
|
|
75042
75042
|
this._lookupCache[flatPath] = exact;
|
|
75043
75043
|
return exact;
|
|
75044
75044
|
};
|
|
75045
|
-
Namespace.prototype.lookupType = function lookupType(
|
|
75046
|
-
var found = this.lookup(
|
|
75045
|
+
Namespace.prototype.lookupType = function lookupType(path31) {
|
|
75046
|
+
var found = this.lookup(path31, [Type]);
|
|
75047
75047
|
if (!found)
|
|
75048
|
-
throw Error("no such type: " +
|
|
75048
|
+
throw Error("no such type: " + path31);
|
|
75049
75049
|
return found;
|
|
75050
75050
|
};
|
|
75051
|
-
Namespace.prototype.lookupEnum = function lookupEnum(
|
|
75052
|
-
var found = this.lookup(
|
|
75051
|
+
Namespace.prototype.lookupEnum = function lookupEnum(path31) {
|
|
75052
|
+
var found = this.lookup(path31, [Enum]);
|
|
75053
75053
|
if (!found)
|
|
75054
|
-
throw Error("no such Enum '" +
|
|
75054
|
+
throw Error("no such Enum '" + path31 + "' in " + this);
|
|
75055
75055
|
return found;
|
|
75056
75056
|
};
|
|
75057
|
-
Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(
|
|
75058
|
-
var found = this.lookup(
|
|
75057
|
+
Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path31) {
|
|
75058
|
+
var found = this.lookup(path31, [Type, Enum]);
|
|
75059
75059
|
if (!found)
|
|
75060
|
-
throw Error("no such Type or Enum '" +
|
|
75060
|
+
throw Error("no such Type or Enum '" + path31 + "' in " + this);
|
|
75061
75061
|
return found;
|
|
75062
75062
|
};
|
|
75063
|
-
Namespace.prototype.lookupService = function lookupService(
|
|
75064
|
-
var found = this.lookup(
|
|
75063
|
+
Namespace.prototype.lookupService = function lookupService(path31) {
|
|
75064
|
+
var found = this.lookup(path31, [Service]);
|
|
75065
75065
|
if (!found)
|
|
75066
|
-
throw Error("no such Service '" +
|
|
75066
|
+
throw Error("no such Service '" + path31 + "' in " + this);
|
|
75067
75067
|
return found;
|
|
75068
75068
|
};
|
|
75069
75069
|
Namespace._configure = function(Type_, Service_, Enum_) {
|
|
@@ -76475,13 +76475,13 @@ var require_util = __commonJS({
|
|
|
76475
76475
|
Object.defineProperty(object2, "$type", { value: enm, enumerable: false });
|
|
76476
76476
|
return enm;
|
|
76477
76477
|
};
|
|
76478
|
-
util.setProperty = function setProperty(dst,
|
|
76479
|
-
function setProp(dst2,
|
|
76480
|
-
var part =
|
|
76478
|
+
util.setProperty = function setProperty(dst, path31, value, ifNotSet) {
|
|
76479
|
+
function setProp(dst2, path32, value2) {
|
|
76480
|
+
var part = path32.shift();
|
|
76481
76481
|
if (util.isUnsafeProperty(part))
|
|
76482
76482
|
return dst2;
|
|
76483
|
-
if (
|
|
76484
|
-
dst2[part] = setProp(dst2[part] || {},
|
|
76483
|
+
if (path32.length > 0) {
|
|
76484
|
+
dst2[part] = setProp(dst2[part] || {}, path32, value2);
|
|
76485
76485
|
} else {
|
|
76486
76486
|
var prevValue = dst2[part];
|
|
76487
76487
|
if (prevValue && ifNotSet)
|
|
@@ -76494,12 +76494,12 @@ var require_util = __commonJS({
|
|
|
76494
76494
|
}
|
|
76495
76495
|
if (typeof dst !== "object")
|
|
76496
76496
|
throw TypeError("dst must be an object");
|
|
76497
|
-
if (!
|
|
76497
|
+
if (!path31)
|
|
76498
76498
|
throw TypeError("path must be specified");
|
|
76499
|
-
|
|
76500
|
-
if (
|
|
76499
|
+
path31 = path31.split(".");
|
|
76500
|
+
if (path31.length > util.recursionLimit)
|
|
76501
76501
|
throw Error("max depth exceeded");
|
|
76502
|
-
return setProp(dst,
|
|
76502
|
+
return setProp(dst, path31, value);
|
|
76503
76503
|
};
|
|
76504
76504
|
Object.defineProperty(util, "decorateRoot", {
|
|
76505
76505
|
get: function() {
|
|
@@ -77045,12 +77045,12 @@ var require_object = __commonJS({
|
|
|
77045
77045
|
*/
|
|
77046
77046
|
fullName: {
|
|
77047
77047
|
get: function() {
|
|
77048
|
-
var
|
|
77048
|
+
var path31 = [this.name], ptr = this.parent;
|
|
77049
77049
|
while (ptr) {
|
|
77050
|
-
|
|
77050
|
+
path31.unshift(ptr.name);
|
|
77051
77051
|
ptr = ptr.parent;
|
|
77052
77052
|
}
|
|
77053
|
-
return
|
|
77053
|
+
return path31.join(".");
|
|
77054
77054
|
}
|
|
77055
77055
|
}
|
|
77056
77056
|
});
|
|
@@ -82684,8 +82684,8 @@ __export(adb_exports, {
|
|
|
82684
82684
|
waitForBootCompleted: () => waitForBootCompleted
|
|
82685
82685
|
});
|
|
82686
82686
|
async function resolveAdbOrThrow() {
|
|
82687
|
-
const
|
|
82688
|
-
if (!
|
|
82687
|
+
const path31 = await resolveAndroidBinary("adb");
|
|
82688
|
+
if (!path31) {
|
|
82689
82689
|
throw new FailureError(
|
|
82690
82690
|
"`adb` not found on PATH or under `$ANDROID_HOME/platform-tools`. Install Android SDK Platform Tools or set `$ANDROID_HOME` to your SDK root.",
|
|
82691
82691
|
{
|
|
@@ -82696,11 +82696,11 @@ async function resolveAdbOrThrow() {
|
|
|
82696
82696
|
}
|
|
82697
82697
|
);
|
|
82698
82698
|
}
|
|
82699
|
-
return
|
|
82699
|
+
return path31;
|
|
82700
82700
|
}
|
|
82701
82701
|
async function resolveEmulatorOrThrow() {
|
|
82702
|
-
const
|
|
82703
|
-
if (!
|
|
82702
|
+
const path31 = await resolveAndroidBinary("emulator");
|
|
82703
|
+
if (!path31) {
|
|
82704
82704
|
throw new FailureError(
|
|
82705
82705
|
"`emulator` not found on PATH or under `$ANDROID_HOME/emulator`. Install the Android Emulator package or set `$ANDROID_HOME` to your SDK root.",
|
|
82706
82706
|
{
|
|
@@ -82711,7 +82711,7 @@ async function resolveEmulatorOrThrow() {
|
|
|
82711
82711
|
}
|
|
82712
82712
|
);
|
|
82713
82713
|
}
|
|
82714
|
-
return
|
|
82714
|
+
return path31;
|
|
82715
82715
|
}
|
|
82716
82716
|
async function emulatorSupportsFlag(flag, options = {}) {
|
|
82717
82717
|
let emulatorPath;
|
|
@@ -82725,7 +82725,7 @@ async function emulatorSupportsFlag(flag, options = {}) {
|
|
|
82725
82725
|
if (cached3 !== void 0) return cached3;
|
|
82726
82726
|
let output;
|
|
82727
82727
|
try {
|
|
82728
|
-
const { stdout, stderr } = await
|
|
82728
|
+
const { stdout, stderr } = await execFileAsync10(emulatorPath, ["-help"], {
|
|
82729
82729
|
timeout: options.timeoutMs ?? 1e4,
|
|
82730
82730
|
maxBuffer: 8 * 1024 * 1024
|
|
82731
82731
|
});
|
|
@@ -82752,7 +82752,7 @@ function describeAdbFailure(args, err) {
|
|
|
82752
82752
|
async function runAdb(args, options = {}) {
|
|
82753
82753
|
const adbPath = await resolveAdbOrThrow();
|
|
82754
82754
|
try {
|
|
82755
|
-
const { stdout, stderr } = await
|
|
82755
|
+
const { stdout, stderr } = await execFileAsync10(adbPath, args, {
|
|
82756
82756
|
timeout: options.timeoutMs ?? 3e4,
|
|
82757
82757
|
killSignal: ADB_KILL_SIGNAL,
|
|
82758
82758
|
maxBuffer: 64 * 1024 * 1024,
|
|
@@ -82766,7 +82766,7 @@ async function runAdb(args, options = {}) {
|
|
|
82766
82766
|
async function runAdbBinary(args, options = {}) {
|
|
82767
82767
|
const adbPath = await resolveAdbOrThrow();
|
|
82768
82768
|
try {
|
|
82769
|
-
const { stdout } = await
|
|
82769
|
+
const { stdout } = await execFileAsync10(adbPath, args, {
|
|
82770
82770
|
timeout: options.timeoutMs ?? 3e4,
|
|
82771
82771
|
killSignal: ADB_KILL_SIGNAL,
|
|
82772
82772
|
maxBuffer: 64 * 1024 * 1024,
|
|
@@ -82939,7 +82939,7 @@ async function listAvds() {
|
|
|
82939
82939
|
const emulatorPath = await resolveAndroidBinary("emulator");
|
|
82940
82940
|
if (!emulatorPath) return [];
|
|
82941
82941
|
try {
|
|
82942
|
-
const { stdout } = await
|
|
82942
|
+
const { stdout } = await execFileAsync10(emulatorPath, ["-list-avds"], { timeout: 5e3 });
|
|
82943
82943
|
return stdout.split("\n").map((l) => l.trim()).filter((l) => l && AVD_NAME_PATTERN.test(l)).map((name) => ({ name }));
|
|
82944
82944
|
} catch {
|
|
82945
82945
|
return [];
|
|
@@ -82955,7 +82955,7 @@ async function checkSnapshotLoadable(avdName, snapshotName = "default_boot", opt
|
|
|
82955
82955
|
"-check-snapshot-loadable",
|
|
82956
82956
|
snapshotName
|
|
82957
82957
|
];
|
|
82958
|
-
const { stdout } = await
|
|
82958
|
+
const { stdout } = await execFileAsync10(emulatorPath, args, {
|
|
82959
82959
|
timeout: options.timeoutMs ?? 1e4,
|
|
82960
82960
|
maxBuffer: 4 * 1024 * 1024
|
|
82961
82961
|
});
|
|
@@ -83013,17 +83013,17 @@ async function hasDefaultBootSnapshot(avdName) {
|
|
|
83013
83013
|
return false;
|
|
83014
83014
|
}
|
|
83015
83015
|
}
|
|
83016
|
-
var
|
|
83016
|
+
var import_node_child_process11, import_node_util10, import_ini, execFileAsync10, emulatorFlagSupportCache, ADB_KILL_SIGNAL, ADB_DEVICE_STATES, ADB_DEVICES_TIMEOUT_MS, ENRICH_TIMEOUT_MS, androidRuntimeKindCache, TERMINAL_ADB_ERROR_PATTERNS, AVD_NAME_PATTERN;
|
|
83017
83017
|
var init_adb = __esm({
|
|
83018
83018
|
"../tool-server/src/utils/adb.ts"() {
|
|
83019
83019
|
"use strict";
|
|
83020
|
-
|
|
83021
|
-
|
|
83020
|
+
import_node_child_process11 = require("node:child_process");
|
|
83021
|
+
import_node_util10 = require("node:util");
|
|
83022
83022
|
import_ini = __toESM(require_ini());
|
|
83023
83023
|
init_src();
|
|
83024
83024
|
init_android_binary();
|
|
83025
83025
|
init_subprocess_error();
|
|
83026
|
-
|
|
83026
|
+
execFileAsync10 = (0, import_node_util10.promisify)(import_node_child_process11.execFile);
|
|
83027
83027
|
emulatorFlagSupportCache = /* @__PURE__ */ new Map();
|
|
83028
83028
|
ADB_KILL_SIGNAL = "SIGKILL";
|
|
83029
83029
|
ADB_DEVICE_STATES = /* @__PURE__ */ new Set([
|
|
@@ -83221,27 +83221,27 @@ var require_util2 = __commonJS({
|
|
|
83221
83221
|
};
|
|
83222
83222
|
}
|
|
83223
83223
|
var normalize = lruMemoize(function normalize2(aPath) {
|
|
83224
|
-
var
|
|
83224
|
+
var path31 = aPath;
|
|
83225
83225
|
var url2 = urlParse(aPath);
|
|
83226
83226
|
if (url2) {
|
|
83227
83227
|
if (!url2.path) {
|
|
83228
83228
|
return aPath;
|
|
83229
83229
|
}
|
|
83230
|
-
|
|
83230
|
+
path31 = url2.path;
|
|
83231
83231
|
}
|
|
83232
|
-
var isAbsolute4 = exports2.isAbsolute(
|
|
83232
|
+
var isAbsolute4 = exports2.isAbsolute(path31);
|
|
83233
83233
|
var parts = [];
|
|
83234
83234
|
var start2 = 0;
|
|
83235
83235
|
var i = 0;
|
|
83236
83236
|
while (true) {
|
|
83237
83237
|
start2 = i;
|
|
83238
|
-
i =
|
|
83238
|
+
i = path31.indexOf("/", start2);
|
|
83239
83239
|
if (i === -1) {
|
|
83240
|
-
parts.push(
|
|
83240
|
+
parts.push(path31.slice(start2));
|
|
83241
83241
|
break;
|
|
83242
83242
|
} else {
|
|
83243
|
-
parts.push(
|
|
83244
|
-
while (i <
|
|
83243
|
+
parts.push(path31.slice(start2, i));
|
|
83244
|
+
while (i < path31.length && path31[i] === "/") {
|
|
83245
83245
|
i++;
|
|
83246
83246
|
}
|
|
83247
83247
|
}
|
|
@@ -83262,18 +83262,18 @@ var require_util2 = __commonJS({
|
|
|
83262
83262
|
}
|
|
83263
83263
|
}
|
|
83264
83264
|
}
|
|
83265
|
-
|
|
83266
|
-
if (
|
|
83267
|
-
|
|
83265
|
+
path31 = parts.join("/");
|
|
83266
|
+
if (path31 === "") {
|
|
83267
|
+
path31 = isAbsolute4 ? "/" : ".";
|
|
83268
83268
|
}
|
|
83269
83269
|
if (url2) {
|
|
83270
|
-
url2.path =
|
|
83270
|
+
url2.path = path31;
|
|
83271
83271
|
return urlGenerate(url2);
|
|
83272
83272
|
}
|
|
83273
|
-
return
|
|
83273
|
+
return path31;
|
|
83274
83274
|
});
|
|
83275
83275
|
exports2.normalize = normalize;
|
|
83276
|
-
function
|
|
83276
|
+
function join37(aRoot, aPath) {
|
|
83277
83277
|
if (aRoot === "") {
|
|
83278
83278
|
aRoot = ".";
|
|
83279
83279
|
}
|
|
@@ -83305,7 +83305,7 @@ var require_util2 = __commonJS({
|
|
|
83305
83305
|
}
|
|
83306
83306
|
return joined;
|
|
83307
83307
|
}
|
|
83308
|
-
exports2.join =
|
|
83308
|
+
exports2.join = join37;
|
|
83309
83309
|
exports2.isAbsolute = function(aPath) {
|
|
83310
83310
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
83311
83311
|
};
|
|
@@ -83519,7 +83519,7 @@ var require_util2 = __commonJS({
|
|
|
83519
83519
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
83520
83520
|
}
|
|
83521
83521
|
}
|
|
83522
|
-
sourceURL =
|
|
83522
|
+
sourceURL = join37(urlGenerate(parsed), sourceURL);
|
|
83523
83523
|
}
|
|
83524
83524
|
return normalize(sourceURL);
|
|
83525
83525
|
}
|
|
@@ -87120,17 +87120,17 @@ var require_visit = __commonJS({
|
|
|
87120
87120
|
visit.BREAK = BREAK;
|
|
87121
87121
|
visit.SKIP = SKIP;
|
|
87122
87122
|
visit.REMOVE = REMOVE;
|
|
87123
|
-
function visit_(key, node, visitor,
|
|
87124
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
87123
|
+
function visit_(key, node, visitor, path31) {
|
|
87124
|
+
const ctrl = callVisitor(key, node, visitor, path31);
|
|
87125
87125
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
87126
|
-
replaceNode(key,
|
|
87127
|
-
return visit_(key, ctrl, visitor,
|
|
87126
|
+
replaceNode(key, path31, ctrl);
|
|
87127
|
+
return visit_(key, ctrl, visitor, path31);
|
|
87128
87128
|
}
|
|
87129
87129
|
if (typeof ctrl !== "symbol") {
|
|
87130
87130
|
if (identity.isCollection(node)) {
|
|
87131
|
-
|
|
87131
|
+
path31 = Object.freeze(path31.concat(node));
|
|
87132
87132
|
for (let i = 0; i < node.items.length; ++i) {
|
|
87133
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
87133
|
+
const ci = visit_(i, node.items[i], visitor, path31);
|
|
87134
87134
|
if (typeof ci === "number")
|
|
87135
87135
|
i = ci - 1;
|
|
87136
87136
|
else if (ci === BREAK)
|
|
@@ -87141,13 +87141,13 @@ var require_visit = __commonJS({
|
|
|
87141
87141
|
}
|
|
87142
87142
|
}
|
|
87143
87143
|
} else if (identity.isPair(node)) {
|
|
87144
|
-
|
|
87145
|
-
const ck = visit_("key", node.key, visitor,
|
|
87144
|
+
path31 = Object.freeze(path31.concat(node));
|
|
87145
|
+
const ck = visit_("key", node.key, visitor, path31);
|
|
87146
87146
|
if (ck === BREAK)
|
|
87147
87147
|
return BREAK;
|
|
87148
87148
|
else if (ck === REMOVE)
|
|
87149
87149
|
node.key = null;
|
|
87150
|
-
const cv = visit_("value", node.value, visitor,
|
|
87150
|
+
const cv = visit_("value", node.value, visitor, path31);
|
|
87151
87151
|
if (cv === BREAK)
|
|
87152
87152
|
return BREAK;
|
|
87153
87153
|
else if (cv === REMOVE)
|
|
@@ -87168,17 +87168,17 @@ var require_visit = __commonJS({
|
|
|
87168
87168
|
visitAsync.BREAK = BREAK;
|
|
87169
87169
|
visitAsync.SKIP = SKIP;
|
|
87170
87170
|
visitAsync.REMOVE = REMOVE;
|
|
87171
|
-
async function visitAsync_(key, node, visitor,
|
|
87172
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
87171
|
+
async function visitAsync_(key, node, visitor, path31) {
|
|
87172
|
+
const ctrl = await callVisitor(key, node, visitor, path31);
|
|
87173
87173
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
87174
|
-
replaceNode(key,
|
|
87175
|
-
return visitAsync_(key, ctrl, visitor,
|
|
87174
|
+
replaceNode(key, path31, ctrl);
|
|
87175
|
+
return visitAsync_(key, ctrl, visitor, path31);
|
|
87176
87176
|
}
|
|
87177
87177
|
if (typeof ctrl !== "symbol") {
|
|
87178
87178
|
if (identity.isCollection(node)) {
|
|
87179
|
-
|
|
87179
|
+
path31 = Object.freeze(path31.concat(node));
|
|
87180
87180
|
for (let i = 0; i < node.items.length; ++i) {
|
|
87181
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
87181
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path31);
|
|
87182
87182
|
if (typeof ci === "number")
|
|
87183
87183
|
i = ci - 1;
|
|
87184
87184
|
else if (ci === BREAK)
|
|
@@ -87189,13 +87189,13 @@ var require_visit = __commonJS({
|
|
|
87189
87189
|
}
|
|
87190
87190
|
}
|
|
87191
87191
|
} else if (identity.isPair(node)) {
|
|
87192
|
-
|
|
87193
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
87192
|
+
path31 = Object.freeze(path31.concat(node));
|
|
87193
|
+
const ck = await visitAsync_("key", node.key, visitor, path31);
|
|
87194
87194
|
if (ck === BREAK)
|
|
87195
87195
|
return BREAK;
|
|
87196
87196
|
else if (ck === REMOVE)
|
|
87197
87197
|
node.key = null;
|
|
87198
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
87198
|
+
const cv = await visitAsync_("value", node.value, visitor, path31);
|
|
87199
87199
|
if (cv === BREAK)
|
|
87200
87200
|
return BREAK;
|
|
87201
87201
|
else if (cv === REMOVE)
|
|
@@ -87222,23 +87222,23 @@ var require_visit = __commonJS({
|
|
|
87222
87222
|
}
|
|
87223
87223
|
return visitor;
|
|
87224
87224
|
}
|
|
87225
|
-
function callVisitor(key, node, visitor,
|
|
87225
|
+
function callVisitor(key, node, visitor, path31) {
|
|
87226
87226
|
if (typeof visitor === "function")
|
|
87227
|
-
return visitor(key, node,
|
|
87227
|
+
return visitor(key, node, path31);
|
|
87228
87228
|
if (identity.isMap(node))
|
|
87229
|
-
return visitor.Map?.(key, node,
|
|
87229
|
+
return visitor.Map?.(key, node, path31);
|
|
87230
87230
|
if (identity.isSeq(node))
|
|
87231
|
-
return visitor.Seq?.(key, node,
|
|
87231
|
+
return visitor.Seq?.(key, node, path31);
|
|
87232
87232
|
if (identity.isPair(node))
|
|
87233
|
-
return visitor.Pair?.(key, node,
|
|
87233
|
+
return visitor.Pair?.(key, node, path31);
|
|
87234
87234
|
if (identity.isScalar(node))
|
|
87235
|
-
return visitor.Scalar?.(key, node,
|
|
87235
|
+
return visitor.Scalar?.(key, node, path31);
|
|
87236
87236
|
if (identity.isAlias(node))
|
|
87237
|
-
return visitor.Alias?.(key, node,
|
|
87237
|
+
return visitor.Alias?.(key, node, path31);
|
|
87238
87238
|
return void 0;
|
|
87239
87239
|
}
|
|
87240
|
-
function replaceNode(key,
|
|
87241
|
-
const parent =
|
|
87240
|
+
function replaceNode(key, path31, node) {
|
|
87241
|
+
const parent = path31[path31.length - 1];
|
|
87242
87242
|
if (identity.isCollection(parent)) {
|
|
87243
87243
|
parent.items[key] = node;
|
|
87244
87244
|
} else if (identity.isPair(parent)) {
|
|
@@ -87848,10 +87848,10 @@ var require_Collection = __commonJS({
|
|
|
87848
87848
|
var createNode = require_createNode();
|
|
87849
87849
|
var identity = require_identity();
|
|
87850
87850
|
var Node = require_Node();
|
|
87851
|
-
function collectionFromPath(schema,
|
|
87851
|
+
function collectionFromPath(schema, path31, value) {
|
|
87852
87852
|
let v = value;
|
|
87853
|
-
for (let i =
|
|
87854
|
-
const k =
|
|
87853
|
+
for (let i = path31.length - 1; i >= 0; --i) {
|
|
87854
|
+
const k = path31[i];
|
|
87855
87855
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
87856
87856
|
const a = [];
|
|
87857
87857
|
a[k] = v;
|
|
@@ -87870,7 +87870,7 @@ var require_Collection = __commonJS({
|
|
|
87870
87870
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
87871
87871
|
});
|
|
87872
87872
|
}
|
|
87873
|
-
var isEmptyPath = (
|
|
87873
|
+
var isEmptyPath = (path31) => path31 == null || typeof path31 === "object" && !!path31[Symbol.iterator]().next().done;
|
|
87874
87874
|
var Collection = class extends Node.NodeBase {
|
|
87875
87875
|
constructor(type, schema) {
|
|
87876
87876
|
super(type);
|
|
@@ -87900,11 +87900,11 @@ var require_Collection = __commonJS({
|
|
|
87900
87900
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
87901
87901
|
* that already exists in the map.
|
|
87902
87902
|
*/
|
|
87903
|
-
addIn(
|
|
87904
|
-
if (isEmptyPath(
|
|
87903
|
+
addIn(path31, value) {
|
|
87904
|
+
if (isEmptyPath(path31))
|
|
87905
87905
|
this.add(value);
|
|
87906
87906
|
else {
|
|
87907
|
-
const [key, ...rest] =
|
|
87907
|
+
const [key, ...rest] = path31;
|
|
87908
87908
|
const node = this.get(key, true);
|
|
87909
87909
|
if (identity.isCollection(node))
|
|
87910
87910
|
node.addIn(rest, value);
|
|
@@ -87918,8 +87918,8 @@ var require_Collection = __commonJS({
|
|
|
87918
87918
|
* Removes a value from the collection.
|
|
87919
87919
|
* @returns `true` if the item was found and removed.
|
|
87920
87920
|
*/
|
|
87921
|
-
deleteIn(
|
|
87922
|
-
const [key, ...rest] =
|
|
87921
|
+
deleteIn(path31) {
|
|
87922
|
+
const [key, ...rest] = path31;
|
|
87923
87923
|
if (rest.length === 0)
|
|
87924
87924
|
return this.delete(key);
|
|
87925
87925
|
const node = this.get(key, true);
|
|
@@ -87933,8 +87933,8 @@ var require_Collection = __commonJS({
|
|
|
87933
87933
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
87934
87934
|
* `true` (collections are always returned intact).
|
|
87935
87935
|
*/
|
|
87936
|
-
getIn(
|
|
87937
|
-
const [key, ...rest] =
|
|
87936
|
+
getIn(path31, keepScalar) {
|
|
87937
|
+
const [key, ...rest] = path31;
|
|
87938
87938
|
const node = this.get(key, true);
|
|
87939
87939
|
if (rest.length === 0)
|
|
87940
87940
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -87952,8 +87952,8 @@ var require_Collection = __commonJS({
|
|
|
87952
87952
|
/**
|
|
87953
87953
|
* Checks if the collection includes a value with the key `key`.
|
|
87954
87954
|
*/
|
|
87955
|
-
hasIn(
|
|
87956
|
-
const [key, ...rest] =
|
|
87955
|
+
hasIn(path31) {
|
|
87956
|
+
const [key, ...rest] = path31;
|
|
87957
87957
|
if (rest.length === 0)
|
|
87958
87958
|
return this.has(key);
|
|
87959
87959
|
const node = this.get(key, true);
|
|
@@ -87963,8 +87963,8 @@ var require_Collection = __commonJS({
|
|
|
87963
87963
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
87964
87964
|
* boolean to add/remove the item from the set.
|
|
87965
87965
|
*/
|
|
87966
|
-
setIn(
|
|
87967
|
-
const [key, ...rest] =
|
|
87966
|
+
setIn(path31, value) {
|
|
87967
|
+
const [key, ...rest] = path31;
|
|
87968
87968
|
if (rest.length === 0) {
|
|
87969
87969
|
this.set(key, value);
|
|
87970
87970
|
} else {
|
|
@@ -90479,9 +90479,9 @@ var require_Document = __commonJS({
|
|
|
90479
90479
|
this.contents.add(value);
|
|
90480
90480
|
}
|
|
90481
90481
|
/** Adds a value to the document. */
|
|
90482
|
-
addIn(
|
|
90482
|
+
addIn(path31, value) {
|
|
90483
90483
|
if (assertCollection(this.contents))
|
|
90484
|
-
this.contents.addIn(
|
|
90484
|
+
this.contents.addIn(path31, value);
|
|
90485
90485
|
}
|
|
90486
90486
|
/**
|
|
90487
90487
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -90556,14 +90556,14 @@ var require_Document = __commonJS({
|
|
|
90556
90556
|
* Removes a value from the document.
|
|
90557
90557
|
* @returns `true` if the item was found and removed.
|
|
90558
90558
|
*/
|
|
90559
|
-
deleteIn(
|
|
90560
|
-
if (Collection.isEmptyPath(
|
|
90559
|
+
deleteIn(path31) {
|
|
90560
|
+
if (Collection.isEmptyPath(path31)) {
|
|
90561
90561
|
if (this.contents == null)
|
|
90562
90562
|
return false;
|
|
90563
90563
|
this.contents = null;
|
|
90564
90564
|
return true;
|
|
90565
90565
|
}
|
|
90566
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
90566
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path31) : false;
|
|
90567
90567
|
}
|
|
90568
90568
|
/**
|
|
90569
90569
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -90578,10 +90578,10 @@ var require_Document = __commonJS({
|
|
|
90578
90578
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
90579
90579
|
* `true` (collections are always returned intact).
|
|
90580
90580
|
*/
|
|
90581
|
-
getIn(
|
|
90582
|
-
if (Collection.isEmptyPath(
|
|
90581
|
+
getIn(path31, keepScalar) {
|
|
90582
|
+
if (Collection.isEmptyPath(path31))
|
|
90583
90583
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
90584
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
90584
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path31, keepScalar) : void 0;
|
|
90585
90585
|
}
|
|
90586
90586
|
/**
|
|
90587
90587
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -90592,10 +90592,10 @@ var require_Document = __commonJS({
|
|
|
90592
90592
|
/**
|
|
90593
90593
|
* Checks if the document includes a value at `path`.
|
|
90594
90594
|
*/
|
|
90595
|
-
hasIn(
|
|
90596
|
-
if (Collection.isEmptyPath(
|
|
90595
|
+
hasIn(path31) {
|
|
90596
|
+
if (Collection.isEmptyPath(path31))
|
|
90597
90597
|
return this.contents !== void 0;
|
|
90598
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
90598
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path31) : false;
|
|
90599
90599
|
}
|
|
90600
90600
|
/**
|
|
90601
90601
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -90612,13 +90612,13 @@ var require_Document = __commonJS({
|
|
|
90612
90612
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
90613
90613
|
* boolean to add/remove the item from the set.
|
|
90614
90614
|
*/
|
|
90615
|
-
setIn(
|
|
90616
|
-
if (Collection.isEmptyPath(
|
|
90615
|
+
setIn(path31, value) {
|
|
90616
|
+
if (Collection.isEmptyPath(path31)) {
|
|
90617
90617
|
this.contents = value;
|
|
90618
90618
|
} else if (this.contents == null) {
|
|
90619
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
90619
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path31), value);
|
|
90620
90620
|
} else if (assertCollection(this.contents)) {
|
|
90621
|
-
this.contents.setIn(
|
|
90621
|
+
this.contents.setIn(path31, value);
|
|
90622
90622
|
}
|
|
90623
90623
|
}
|
|
90624
90624
|
/**
|
|
@@ -92578,9 +92578,9 @@ var require_cst_visit = __commonJS({
|
|
|
92578
92578
|
visit.BREAK = BREAK;
|
|
92579
92579
|
visit.SKIP = SKIP;
|
|
92580
92580
|
visit.REMOVE = REMOVE;
|
|
92581
|
-
visit.itemAtPath = (cst,
|
|
92581
|
+
visit.itemAtPath = (cst, path31) => {
|
|
92582
92582
|
let item = cst;
|
|
92583
|
-
for (const [field, index] of
|
|
92583
|
+
for (const [field, index] of path31) {
|
|
92584
92584
|
const tok = item?.[field];
|
|
92585
92585
|
if (tok && "items" in tok) {
|
|
92586
92586
|
item = tok.items[index];
|
|
@@ -92589,23 +92589,23 @@ var require_cst_visit = __commonJS({
|
|
|
92589
92589
|
}
|
|
92590
92590
|
return item;
|
|
92591
92591
|
};
|
|
92592
|
-
visit.parentCollection = (cst,
|
|
92593
|
-
const parent = visit.itemAtPath(cst,
|
|
92594
|
-
const field =
|
|
92592
|
+
visit.parentCollection = (cst, path31) => {
|
|
92593
|
+
const parent = visit.itemAtPath(cst, path31.slice(0, -1));
|
|
92594
|
+
const field = path31[path31.length - 1][0];
|
|
92595
92595
|
const coll = parent?.[field];
|
|
92596
92596
|
if (coll && "items" in coll)
|
|
92597
92597
|
return coll;
|
|
92598
92598
|
throw new Error("Parent collection not found");
|
|
92599
92599
|
};
|
|
92600
|
-
function _visit(
|
|
92601
|
-
let ctrl = visitor(item,
|
|
92600
|
+
function _visit(path31, item, visitor) {
|
|
92601
|
+
let ctrl = visitor(item, path31);
|
|
92602
92602
|
if (typeof ctrl === "symbol")
|
|
92603
92603
|
return ctrl;
|
|
92604
92604
|
for (const field of ["key", "value"]) {
|
|
92605
92605
|
const token = item[field];
|
|
92606
92606
|
if (token && "items" in token) {
|
|
92607
92607
|
for (let i = 0; i < token.items.length; ++i) {
|
|
92608
|
-
const ci = _visit(Object.freeze(
|
|
92608
|
+
const ci = _visit(Object.freeze(path31.concat([[field, i]])), token.items[i], visitor);
|
|
92609
92609
|
if (typeof ci === "number")
|
|
92610
92610
|
i = ci - 1;
|
|
92611
92611
|
else if (ci === BREAK)
|
|
@@ -92616,10 +92616,10 @@ var require_cst_visit = __commonJS({
|
|
|
92616
92616
|
}
|
|
92617
92617
|
}
|
|
92618
92618
|
if (typeof ctrl === "function" && field === "key")
|
|
92619
|
-
ctrl = ctrl(item,
|
|
92619
|
+
ctrl = ctrl(item, path31);
|
|
92620
92620
|
}
|
|
92621
92621
|
}
|
|
92622
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
92622
|
+
return typeof ctrl === "function" ? ctrl(item, path31) : ctrl;
|
|
92623
92623
|
}
|
|
92624
92624
|
exports2.visit = visit;
|
|
92625
92625
|
}
|
|
@@ -94374,7 +94374,7 @@ var require_dist5 = __commonJS({
|
|
|
94374
94374
|
var require_main = __commonJS({
|
|
94375
94375
|
"../../node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
94376
94376
|
var fs43 = require("fs");
|
|
94377
|
-
var
|
|
94377
|
+
var path31 = require("path");
|
|
94378
94378
|
var os12 = require("os");
|
|
94379
94379
|
var crypto8 = require("crypto");
|
|
94380
94380
|
var TIPS = [
|
|
@@ -94513,7 +94513,7 @@ var require_main = __commonJS({
|
|
|
94513
94513
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
94514
94514
|
}
|
|
94515
94515
|
} else {
|
|
94516
|
-
possibleVaultPath =
|
|
94516
|
+
possibleVaultPath = path31.resolve(process.cwd(), ".env.vault");
|
|
94517
94517
|
}
|
|
94518
94518
|
if (fs43.existsSync(possibleVaultPath)) {
|
|
94519
94519
|
return possibleVaultPath;
|
|
@@ -94521,7 +94521,7 @@ var require_main = __commonJS({
|
|
|
94521
94521
|
return null;
|
|
94522
94522
|
}
|
|
94523
94523
|
function _resolveHome(envPath) {
|
|
94524
|
-
return envPath[0] === "~" ?
|
|
94524
|
+
return envPath[0] === "~" ? path31.join(os12.homedir(), envPath.slice(1)) : envPath;
|
|
94525
94525
|
}
|
|
94526
94526
|
function _configVault(options) {
|
|
94527
94527
|
const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
@@ -94538,7 +94538,7 @@ var require_main = __commonJS({
|
|
|
94538
94538
|
return { parsed };
|
|
94539
94539
|
}
|
|
94540
94540
|
function configDotenv(options) {
|
|
94541
|
-
const dotenvPath =
|
|
94541
|
+
const dotenvPath = path31.resolve(process.cwd(), ".env");
|
|
94542
94542
|
let encoding = "utf8";
|
|
94543
94543
|
let processEnv = process.env;
|
|
94544
94544
|
if (options && options.processEnv != null) {
|
|
@@ -94566,13 +94566,13 @@ var require_main = __commonJS({
|
|
|
94566
94566
|
}
|
|
94567
94567
|
let lastError;
|
|
94568
94568
|
const parsedAll = {};
|
|
94569
|
-
for (const
|
|
94569
|
+
for (const path32 of optionPaths) {
|
|
94570
94570
|
try {
|
|
94571
|
-
const parsed = DotenvModule.parse(fs43.readFileSync(
|
|
94571
|
+
const parsed = DotenvModule.parse(fs43.readFileSync(path32, { encoding }));
|
|
94572
94572
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
94573
94573
|
} catch (e) {
|
|
94574
94574
|
if (debug) {
|
|
94575
|
-
_debug(`failed to load ${
|
|
94575
|
+
_debug(`failed to load ${path32} ${e.message}`);
|
|
94576
94576
|
}
|
|
94577
94577
|
lastError = e;
|
|
94578
94578
|
}
|
|
@@ -94585,7 +94585,7 @@ var require_main = __commonJS({
|
|
|
94585
94585
|
const shortPaths = [];
|
|
94586
94586
|
for (const filePath of optionPaths) {
|
|
94587
94587
|
try {
|
|
94588
|
-
const relative4 =
|
|
94588
|
+
const relative4 = path31.relative(process.cwd(), filePath);
|
|
94589
94589
|
shortPaths.push(relative4);
|
|
94590
94590
|
} catch (e) {
|
|
94591
94591
|
if (debug) {
|
|
@@ -94725,8 +94725,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? (0, import_pat
|
|
|
94725
94725
|
return decodedFile;
|
|
94726
94726
|
};
|
|
94727
94727
|
}
|
|
94728
|
-
function normalizeWindowsPath(
|
|
94729
|
-
return
|
|
94728
|
+
function normalizeWindowsPath(path31) {
|
|
94729
|
+
return path31.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
94730
94730
|
}
|
|
94731
94731
|
|
|
94732
94732
|
// ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
@@ -97278,9 +97278,9 @@ async function addSourceContext(frames) {
|
|
|
97278
97278
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
97279
97279
|
return frames;
|
|
97280
97280
|
}
|
|
97281
|
-
function getContextLinesFromFile(
|
|
97281
|
+
function getContextLinesFromFile(path31, ranges, output) {
|
|
97282
97282
|
return new Promise((resolve5) => {
|
|
97283
|
-
const stream = (0, import_node_fs.createReadStream)(
|
|
97283
|
+
const stream = (0, import_node_fs.createReadStream)(path31);
|
|
97284
97284
|
const lineReaded = (0, import_node_readline.createInterface)({
|
|
97285
97285
|
input: stream
|
|
97286
97286
|
});
|
|
@@ -97295,7 +97295,7 @@ function getContextLinesFromFile(path30, ranges, output) {
|
|
|
97295
97295
|
let rangeStart = range[0];
|
|
97296
97296
|
let rangeEnd = range[1];
|
|
97297
97297
|
function onStreamError() {
|
|
97298
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
97298
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path31, 1);
|
|
97299
97299
|
lineReaded.close();
|
|
97300
97300
|
lineReaded.removeAllListeners();
|
|
97301
97301
|
destroyStreamAndResolve();
|
|
@@ -97356,8 +97356,8 @@ function clearLineContext(frame) {
|
|
|
97356
97356
|
delete frame.context_line;
|
|
97357
97357
|
delete frame.post_context;
|
|
97358
97358
|
}
|
|
97359
|
-
function shouldSkipContextLinesForFile(
|
|
97360
|
-
return
|
|
97359
|
+
function shouldSkipContextLinesForFile(path31) {
|
|
97360
|
+
return path31.startsWith("node:") || path31.endsWith(".min.js") || path31.endsWith(".min.cjs") || path31.endsWith(".min.mjs") || path31.startsWith("data:");
|
|
97361
97361
|
}
|
|
97362
97362
|
function shouldSkipContextLinesForFrame(frame) {
|
|
97363
97363
|
if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
|
|
@@ -99826,9 +99826,9 @@ function isReplitAgent(env) {
|
|
|
99826
99826
|
}
|
|
99827
99827
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
99828
99828
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
99829
|
-
function safeExists(fileExists,
|
|
99829
|
+
function safeExists(fileExists, path31) {
|
|
99830
99830
|
try {
|
|
99831
|
-
return fileExists(
|
|
99831
|
+
return fileExists(path31);
|
|
99832
99832
|
} catch {
|
|
99833
99833
|
return false;
|
|
99834
99834
|
}
|
|
@@ -100283,12 +100283,73 @@ function getBaseProps(runtime) {
|
|
|
100283
100283
|
|
|
100284
100284
|
// ../telemetry/src/identity.ts
|
|
100285
100285
|
var crypto2 = __toESM(require("node:crypto"));
|
|
100286
|
-
var
|
|
100287
|
-
var
|
|
100286
|
+
var fs2 = __toESM(require("node:fs"));
|
|
100287
|
+
var path4 = __toESM(require("node:path"));
|
|
100288
100288
|
|
|
100289
100289
|
// ../telemetry/src/paths.ts
|
|
100290
|
-
var
|
|
100291
|
-
|
|
100290
|
+
var path3 = __toESM(require("node:path"));
|
|
100291
|
+
|
|
100292
|
+
// ../configuration-core/src/flags.ts
|
|
100293
|
+
var fs = __toESM(require("node:fs"), 1);
|
|
100294
|
+
var path = __toESM(require("node:path"), 1);
|
|
100295
|
+
var import_node_os = require("node:os");
|
|
100296
|
+
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
100297
|
+
function resolveProjectRoot(startDir) {
|
|
100298
|
+
const initial = path.resolve(startDir);
|
|
100299
|
+
let current = initial;
|
|
100300
|
+
while (true) {
|
|
100301
|
+
for (const marker of PROJECT_MARKERS) {
|
|
100302
|
+
if (fs.existsSync(path.join(current, marker))) return current;
|
|
100303
|
+
}
|
|
100304
|
+
const parent = path.dirname(current);
|
|
100305
|
+
if (parent === current) return initial;
|
|
100306
|
+
current = parent;
|
|
100307
|
+
}
|
|
100308
|
+
}
|
|
100309
|
+
function getFlagsPath(scope, options = {}) {
|
|
100310
|
+
const home = options.homeDir ?? (0, import_node_os.homedir)();
|
|
100311
|
+
if (scope === "global") {
|
|
100312
|
+
return path.join(home, ".argent", "flags.json");
|
|
100313
|
+
}
|
|
100314
|
+
const cwd = options.cwd ?? process.cwd();
|
|
100315
|
+
return path.join(resolveProjectRoot(cwd), ".argent", "flags.json");
|
|
100316
|
+
}
|
|
100317
|
+
function readFlagsFile(filePath) {
|
|
100318
|
+
let raw;
|
|
100319
|
+
try {
|
|
100320
|
+
raw = fs.readFileSync(filePath, "utf8");
|
|
100321
|
+
} catch {
|
|
100322
|
+
return {};
|
|
100323
|
+
}
|
|
100324
|
+
let parsed;
|
|
100325
|
+
try {
|
|
100326
|
+
parsed = JSON.parse(raw);
|
|
100327
|
+
} catch {
|
|
100328
|
+
return {};
|
|
100329
|
+
}
|
|
100330
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
100331
|
+
const flags = parsed.flags;
|
|
100332
|
+
if (!flags || typeof flags !== "object" || Array.isArray(flags)) return {};
|
|
100333
|
+
const out = {};
|
|
100334
|
+
for (const [k, v] of Object.entries(flags)) {
|
|
100335
|
+
if (typeof v === "boolean") out[k] = v;
|
|
100336
|
+
}
|
|
100337
|
+
return out;
|
|
100338
|
+
}
|
|
100339
|
+
function readFlags(scope, options = {}) {
|
|
100340
|
+
return readFlagsFile(getFlagsPath(scope, options));
|
|
100341
|
+
}
|
|
100342
|
+
function isFlagEnabled(name, options = {}) {
|
|
100343
|
+
const projectFlags = readFlags("project", options);
|
|
100344
|
+
if (Object.hasOwn(projectFlags, name)) return projectFlags[name];
|
|
100345
|
+
const globalFlags = readFlags("global", options);
|
|
100346
|
+
if (Object.hasOwn(globalFlags, name)) return globalFlags[name];
|
|
100347
|
+
return false;
|
|
100348
|
+
}
|
|
100349
|
+
|
|
100350
|
+
// ../configuration-core/src/paths.ts
|
|
100351
|
+
var os = __toESM(require("node:os"), 1);
|
|
100352
|
+
var path2 = __toESM(require("node:path"), 1);
|
|
100292
100353
|
function nonEmpty(value) {
|
|
100293
100354
|
if (value == void 0) return null;
|
|
100294
100355
|
const trimmed = value.trim();
|
|
@@ -100296,16 +100357,18 @@ function nonEmpty(value) {
|
|
|
100296
100357
|
}
|
|
100297
100358
|
function argentHomeDir() {
|
|
100298
100359
|
const home = process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
100299
|
-
return
|
|
100300
|
-
}
|
|
100301
|
-
function identityFilePath() {
|
|
100302
|
-
return path.join(argentHomeDir(), "telemetry-id");
|
|
100360
|
+
return path2.join(home, ".argent");
|
|
100303
100361
|
}
|
|
100304
100362
|
function configFilePath() {
|
|
100305
|
-
return
|
|
100363
|
+
return path2.join(argentHomeDir(), "config.json");
|
|
100364
|
+
}
|
|
100365
|
+
|
|
100366
|
+
// ../telemetry/src/paths.ts
|
|
100367
|
+
function identityFilePath() {
|
|
100368
|
+
return path3.join(argentHomeDir(), "telemetry-id");
|
|
100306
100369
|
}
|
|
100307
100370
|
function debugLogPath() {
|
|
100308
|
-
return
|
|
100371
|
+
return path3.join(argentHomeDir(), "telemetry-debug.log");
|
|
100309
100372
|
}
|
|
100310
100373
|
|
|
100311
100374
|
// ../telemetry/src/identity.ts
|
|
@@ -100318,28 +100381,28 @@ function readOrCreateAnonId() {
|
|
|
100318
100381
|
cached2 = { path: finalPath, id: existing };
|
|
100319
100382
|
return existing;
|
|
100320
100383
|
}
|
|
100321
|
-
|
|
100384
|
+
fs2.mkdirSync(argentHomeDir(), { recursive: true });
|
|
100322
100385
|
const uuid3 = crypto2.randomUUID();
|
|
100323
100386
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
100324
|
-
const tmpPath =
|
|
100387
|
+
const tmpPath = path4.join(
|
|
100325
100388
|
argentHomeDir(),
|
|
100326
100389
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
100327
100390
|
);
|
|
100328
100391
|
let fd;
|
|
100329
100392
|
try {
|
|
100330
|
-
fd =
|
|
100393
|
+
fd = fs2.openSync(tmpPath, "wx", 384);
|
|
100331
100394
|
} catch (err) {
|
|
100332
100395
|
if (err.code === "EEXIST") continue;
|
|
100333
100396
|
throw err;
|
|
100334
100397
|
}
|
|
100335
100398
|
try {
|
|
100336
100399
|
try {
|
|
100337
|
-
|
|
100338
|
-
|
|
100400
|
+
fs2.writeSync(fd, uuid3);
|
|
100401
|
+
fs2.fsyncSync(fd);
|
|
100339
100402
|
} finally {
|
|
100340
|
-
|
|
100403
|
+
fs2.closeSync(fd);
|
|
100341
100404
|
}
|
|
100342
|
-
|
|
100405
|
+
fs2.linkSync(tmpPath, finalPath);
|
|
100343
100406
|
cached2 = { path: finalPath, id: uuid3 };
|
|
100344
100407
|
return uuid3;
|
|
100345
100408
|
} catch (err) {
|
|
@@ -100354,7 +100417,7 @@ function readOrCreateAnonId() {
|
|
|
100354
100417
|
throw err;
|
|
100355
100418
|
} finally {
|
|
100356
100419
|
try {
|
|
100357
|
-
|
|
100420
|
+
fs2.unlinkSync(tmpPath);
|
|
100358
100421
|
} catch {
|
|
100359
100422
|
}
|
|
100360
100423
|
}
|
|
@@ -100364,9 +100427,9 @@ function readOrCreateAnonId() {
|
|
|
100364
100427
|
function tryReadId(filePath) {
|
|
100365
100428
|
let raw;
|
|
100366
100429
|
try {
|
|
100367
|
-
const stats =
|
|
100430
|
+
const stats = fs2.lstatSync(filePath);
|
|
100368
100431
|
if (!stats.isFile()) return null;
|
|
100369
|
-
raw =
|
|
100432
|
+
raw = fs2.readFileSync(filePath, "utf8");
|
|
100370
100433
|
} catch (err) {
|
|
100371
100434
|
if (err.code === "ENOENT") return null;
|
|
100372
100435
|
return null;
|
|
@@ -100377,13 +100440,13 @@ function tryReadId(filePath) {
|
|
|
100377
100440
|
}
|
|
100378
100441
|
|
|
100379
100442
|
// ../telemetry/src/consent.ts
|
|
100380
|
-
var
|
|
100443
|
+
var fs3 = __toESM(require("node:fs"));
|
|
100381
100444
|
var cache = { current: null };
|
|
100382
100445
|
var sessionOverride = null;
|
|
100383
100446
|
function readConfigOverride() {
|
|
100384
100447
|
let stats;
|
|
100385
100448
|
try {
|
|
100386
|
-
stats =
|
|
100449
|
+
stats = fs3.lstatSync(configFilePath());
|
|
100387
100450
|
} catch (err) {
|
|
100388
100451
|
if (err.code === "ENOENT") {
|
|
100389
100452
|
cache.current = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
@@ -100403,7 +100466,7 @@ function readConfigOverride() {
|
|
|
100403
100466
|
}
|
|
100404
100467
|
let parsedEnabled = null;
|
|
100405
100468
|
try {
|
|
100406
|
-
const raw =
|
|
100469
|
+
const raw = fs3.readFileSync(configFilePath(), "utf8");
|
|
100407
100470
|
const json2 = JSON.parse(raw);
|
|
100408
100471
|
if (json2 && typeof json2 === "object") {
|
|
100409
100472
|
const t = json2.telemetry;
|
|
@@ -100457,7 +100520,7 @@ function isEnabled(env = process.env) {
|
|
|
100457
100520
|
}
|
|
100458
100521
|
|
|
100459
100522
|
// ../telemetry/src/debug.ts
|
|
100460
|
-
var
|
|
100523
|
+
var fs4 = __toESM(require("node:fs"));
|
|
100461
100524
|
function isDebugEnabled(env = process.env) {
|
|
100462
100525
|
const v = env.ARGENT_TELEMETRY_DEBUG;
|
|
100463
100526
|
if (!v) return false;
|
|
@@ -100484,8 +100547,8 @@ function emitDebugPayload(payload) {
|
|
|
100484
100547
|
} catch {
|
|
100485
100548
|
}
|
|
100486
100549
|
try {
|
|
100487
|
-
|
|
100488
|
-
|
|
100550
|
+
fs4.mkdirSync(argentHomeDir(), { recursive: true });
|
|
100551
|
+
fs4.appendFileSync(debugLogPath(), line + "\n");
|
|
100489
100552
|
} catch {
|
|
100490
100553
|
}
|
|
100491
100554
|
}
|
|
@@ -100657,66 +100720,6 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
100657
100720
|
|
|
100658
100721
|
// ../tool-server/src/http.ts
|
|
100659
100722
|
var import_express3 = __toESM(require_express2());
|
|
100660
|
-
|
|
100661
|
-
// ../configuration-core/src/flags.ts
|
|
100662
|
-
var fs4 = __toESM(require("node:fs"), 1);
|
|
100663
|
-
var path3 = __toESM(require("node:path"), 1);
|
|
100664
|
-
var import_node_os = require("node:os");
|
|
100665
|
-
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
100666
|
-
function resolveProjectRoot(startDir) {
|
|
100667
|
-
const initial = path3.resolve(startDir);
|
|
100668
|
-
let current = initial;
|
|
100669
|
-
while (true) {
|
|
100670
|
-
for (const marker of PROJECT_MARKERS) {
|
|
100671
|
-
if (fs4.existsSync(path3.join(current, marker))) return current;
|
|
100672
|
-
}
|
|
100673
|
-
const parent = path3.dirname(current);
|
|
100674
|
-
if (parent === current) return initial;
|
|
100675
|
-
current = parent;
|
|
100676
|
-
}
|
|
100677
|
-
}
|
|
100678
|
-
function getFlagsPath(scope, options = {}) {
|
|
100679
|
-
const home = options.homeDir ?? (0, import_node_os.homedir)();
|
|
100680
|
-
if (scope === "global") {
|
|
100681
|
-
return path3.join(home, ".argent", "flags.json");
|
|
100682
|
-
}
|
|
100683
|
-
const cwd = options.cwd ?? process.cwd();
|
|
100684
|
-
return path3.join(resolveProjectRoot(cwd), ".argent", "flags.json");
|
|
100685
|
-
}
|
|
100686
|
-
function readFlagsFile(filePath) {
|
|
100687
|
-
let raw;
|
|
100688
|
-
try {
|
|
100689
|
-
raw = fs4.readFileSync(filePath, "utf8");
|
|
100690
|
-
} catch {
|
|
100691
|
-
return {};
|
|
100692
|
-
}
|
|
100693
|
-
let parsed;
|
|
100694
|
-
try {
|
|
100695
|
-
parsed = JSON.parse(raw);
|
|
100696
|
-
} catch {
|
|
100697
|
-
return {};
|
|
100698
|
-
}
|
|
100699
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
100700
|
-
const flags = parsed.flags;
|
|
100701
|
-
if (!flags || typeof flags !== "object" || Array.isArray(flags)) return {};
|
|
100702
|
-
const out = {};
|
|
100703
|
-
for (const [k, v] of Object.entries(flags)) {
|
|
100704
|
-
if (typeof v === "boolean") out[k] = v;
|
|
100705
|
-
}
|
|
100706
|
-
return out;
|
|
100707
|
-
}
|
|
100708
|
-
function readFlags(scope, options = {}) {
|
|
100709
|
-
return readFlagsFile(getFlagsPath(scope, options));
|
|
100710
|
-
}
|
|
100711
|
-
function isFlagEnabled(name, options = {}) {
|
|
100712
|
-
const projectFlags = readFlags("project", options);
|
|
100713
|
-
if (Object.hasOwn(projectFlags, name)) return projectFlags[name];
|
|
100714
|
-
const globalFlags = readFlags("global", options);
|
|
100715
|
-
if (Object.hasOwn(globalFlags, name)) return globalFlags[name];
|
|
100716
|
-
return false;
|
|
100717
|
-
}
|
|
100718
|
-
|
|
100719
|
-
// ../tool-server/src/http.ts
|
|
100720
100723
|
var import_node_crypto5 = require("node:crypto");
|
|
100721
100724
|
init_src();
|
|
100722
100725
|
init_src();
|
|
@@ -100854,8 +100857,8 @@ async function commandOnPath(name) {
|
|
|
100854
100857
|
const { stdout } = await execFileAsync3("/bin/sh", ["-c", `command -v ${name}`], {
|
|
100855
100858
|
timeout: 2e3
|
|
100856
100859
|
});
|
|
100857
|
-
const
|
|
100858
|
-
return
|
|
100860
|
+
const path31 = stdout.trim();
|
|
100861
|
+
return path31 || null;
|
|
100859
100862
|
} catch {
|
|
100860
100863
|
return null;
|
|
100861
100864
|
}
|
|
@@ -100867,18 +100870,18 @@ async function resolveVegaBinary() {
|
|
|
100867
100870
|
}
|
|
100868
100871
|
const onPath = await commandOnPath("vega") ?? await commandOnPath("kepler");
|
|
100869
100872
|
const fallback = (0, import_node_path3.join)((0, import_node_os3.homedir)(), "vega", "bin", "vega");
|
|
100870
|
-
const
|
|
100871
|
-
cachedVegaBinary = { path:
|
|
100872
|
-
return
|
|
100873
|
+
const path31 = onPath ?? (await isExecutable(fallback) ? fallback : null);
|
|
100874
|
+
cachedVegaBinary = { path: path31, checkedAt: now };
|
|
100875
|
+
return path31;
|
|
100873
100876
|
}
|
|
100874
100877
|
async function resolveVegaOrThrow() {
|
|
100875
|
-
const
|
|
100876
|
-
if (!
|
|
100878
|
+
const path31 = await resolveVegaBinary();
|
|
100879
|
+
if (!path31) {
|
|
100877
100880
|
throw new Error(
|
|
100878
100881
|
"`vega` (or `kepler`) not found on PATH or under `~/vega/bin`. Install the Vega SDK and run `source ~/vega/env`, then retry."
|
|
100879
100882
|
);
|
|
100880
100883
|
}
|
|
100881
|
-
return
|
|
100884
|
+
return path31;
|
|
100882
100885
|
}
|
|
100883
100886
|
var VEGA_KILL_SIGNAL = "SIGKILL";
|
|
100884
100887
|
async function reapVegaGroup(child) {
|
|
@@ -101386,12 +101389,12 @@ var readline2 = __toESM(require("node:readline"));
|
|
|
101386
101389
|
init_src();
|
|
101387
101390
|
|
|
101388
101391
|
// ../native-devtools-ios/src/index.ts
|
|
101389
|
-
var
|
|
101392
|
+
var path6 = __toESM(require("node:path"));
|
|
101390
101393
|
var fs6 = __toESM(require("node:fs"));
|
|
101391
|
-
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ??
|
|
101392
|
-
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ??
|
|
101393
|
-
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ??
|
|
101394
|
-
var DYLIB_TVOS_DIR =
|
|
101394
|
+
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path6.join(__dirname, "..", "dylibs");
|
|
101395
|
+
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path6.join(__dirname, "..", "bin");
|
|
101396
|
+
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path6.join(DYLIB_DIR, "tcp");
|
|
101397
|
+
var DYLIB_TVOS_DIR = path6.join(DYLIB_DIR, "tvos");
|
|
101395
101398
|
function requireDarwin(what) {
|
|
101396
101399
|
if (process.platform !== "darwin") {
|
|
101397
101400
|
throw new Error(
|
|
@@ -101400,7 +101403,7 @@ function requireDarwin(what) {
|
|
|
101400
101403
|
}
|
|
101401
101404
|
}
|
|
101402
101405
|
function requireDylibIn(dir, name) {
|
|
101403
|
-
const p =
|
|
101406
|
+
const p = path6.join(dir, name);
|
|
101404
101407
|
if (!fs6.existsSync(p)) {
|
|
101405
101408
|
throw new Error(`Native devtools dylib not found: ${p}`);
|
|
101406
101409
|
}
|
|
@@ -101440,15 +101443,15 @@ function hostPlatformKey() {
|
|
|
101440
101443
|
return process.platform;
|
|
101441
101444
|
}
|
|
101442
101445
|
function platformBinDir() {
|
|
101443
|
-
return
|
|
101446
|
+
return path6.join(BIN_DIR, hostPlatformKey());
|
|
101444
101447
|
}
|
|
101445
101448
|
function platformTcpBinDir() {
|
|
101446
|
-
return process.env.ARGENT_SIMULATOR_SERVER_TCP_DIR ??
|
|
101449
|
+
return process.env.ARGENT_SIMULATOR_SERVER_TCP_DIR ?? path6.join(platformBinDir(), "tcp");
|
|
101447
101450
|
}
|
|
101448
101451
|
function simulatorServerBinaryPath() {
|
|
101449
|
-
const p =
|
|
101452
|
+
const p = path6.join(platformBinDir(), "simulator-server");
|
|
101450
101453
|
if (!fs6.existsSync(p)) {
|
|
101451
|
-
const flat =
|
|
101454
|
+
const flat = path6.join(BIN_DIR, "simulator-server");
|
|
101452
101455
|
const migrationHint = fs6.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
|
|
101453
101456
|
throw new Error(
|
|
101454
101457
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64).${migrationHint}`
|
|
@@ -101460,7 +101463,7 @@ function simulatorServerBinaryDir() {
|
|
|
101460
101463
|
return platformBinDir();
|
|
101461
101464
|
}
|
|
101462
101465
|
function requireBinIn(dir, name) {
|
|
101463
|
-
const p =
|
|
101466
|
+
const p = path6.join(dir, name);
|
|
101464
101467
|
if (!fs6.existsSync(p)) {
|
|
101465
101468
|
throw new Error(`${name} binary not found: ${p}`);
|
|
101466
101469
|
}
|
|
@@ -101493,7 +101496,7 @@ init_src();
|
|
|
101493
101496
|
var import_node_child_process8 = require("node:child_process");
|
|
101494
101497
|
var import_node_events = require("node:events");
|
|
101495
101498
|
var fs7 = __toESM(require("node:fs"));
|
|
101496
|
-
var
|
|
101499
|
+
var path8 = __toESM(require("node:path"));
|
|
101497
101500
|
var import_node_util8 = require("node:util");
|
|
101498
101501
|
|
|
101499
101502
|
// ../tool-server/src/utils/simctl-config.ts
|
|
@@ -101544,7 +101547,7 @@ async function isTvOsSimulator(udid) {
|
|
|
101544
101547
|
// ../tool-server/src/utils/ax-prefs.ts
|
|
101545
101548
|
var fsAsync = __toESM(require("node:fs/promises"));
|
|
101546
101549
|
var os3 = __toESM(require("node:os"));
|
|
101547
|
-
var
|
|
101550
|
+
var path7 = __toESM(require("node:path"));
|
|
101548
101551
|
var import_node_child_process6 = require("node:child_process");
|
|
101549
101552
|
var import_node_util6 = require("node:util");
|
|
101550
101553
|
var execFileAsync6 = (0, import_node_util6.promisify)(import_node_child_process6.execFile);
|
|
@@ -101581,7 +101584,7 @@ async function isEntitlementBypassActive(udid) {
|
|
|
101581
101584
|
).then(({ stdout }) => stdout.trim() === "1").catch(() => false);
|
|
101582
101585
|
}
|
|
101583
101586
|
function accessibilityPlistPath(udid) {
|
|
101584
|
-
return
|
|
101587
|
+
return path7.join(
|
|
101585
101588
|
os3.homedir(),
|
|
101586
101589
|
"Library/Developer/CoreSimulator/Devices",
|
|
101587
101590
|
udid,
|
|
@@ -101590,7 +101593,7 @@ function accessibilityPlistPath(udid) {
|
|
|
101590
101593
|
}
|
|
101591
101594
|
async function setAccessibilityPrefsPreBoot(udid) {
|
|
101592
101595
|
const plistPath = accessibilityPlistPath(udid);
|
|
101593
|
-
await fsAsync.mkdir(
|
|
101596
|
+
await fsAsync.mkdir(path7.dirname(plistPath), { recursive: true });
|
|
101594
101597
|
const exists2 = await fsAsync.access(plistPath).then(() => true).catch(() => false);
|
|
101595
101598
|
if (!exists2) {
|
|
101596
101599
|
await execFileAsync6("plutil", ["-create", "binary1", plistPath]);
|
|
@@ -101778,7 +101781,7 @@ function shouldPreserveDyldInsertLibrariesEntry(entry, bootstrapPath) {
|
|
|
101778
101781
|
if (entry === bootstrapPath) {
|
|
101779
101782
|
return false;
|
|
101780
101783
|
}
|
|
101781
|
-
if (ARGENT_BOOTSTRAP_DYLIB_BASENAMES.has(
|
|
101784
|
+
if (ARGENT_BOOTSTRAP_DYLIB_BASENAMES.has(path8.basename(entry))) {
|
|
101782
101785
|
return false;
|
|
101783
101786
|
}
|
|
101784
101787
|
if (entry.startsWith("@")) {
|
|
@@ -104902,12 +104905,12 @@ var Publisher = class {
|
|
|
104902
104905
|
* Publishes a broadcast with any associated tracks.
|
|
104903
104906
|
* Opens a bidi stream to send PublishNamespace and waits for response.
|
|
104904
104907
|
*/
|
|
104905
|
-
publish(
|
|
104906
|
-
this.#broadcasts.set(
|
|
104907
|
-
this.#notifyConsumers(
|
|
104908
|
-
void this.#runPublish(
|
|
104908
|
+
publish(path31, broadcast) {
|
|
104909
|
+
this.#broadcasts.set(path31, broadcast);
|
|
104910
|
+
this.#notifyConsumers(path31, true);
|
|
104911
|
+
void this.#runPublish(path31, broadcast);
|
|
104909
104912
|
}
|
|
104910
|
-
async #runPublish(
|
|
104913
|
+
async #runPublish(path31, broadcast) {
|
|
104911
104914
|
try {
|
|
104912
104915
|
const requestId = await this.#session.nextRequestId();
|
|
104913
104916
|
if (requestId === void 0)
|
|
@@ -104915,7 +104918,7 @@ var Publisher = class {
|
|
|
104915
104918
|
const stream = await this.#session.openBi();
|
|
104916
104919
|
try {
|
|
104917
104920
|
await stream.writer.u53(PublishNamespace.id);
|
|
104918
|
-
const msg = new PublishNamespace({ requestId, trackNamespace:
|
|
104921
|
+
const msg = new PublishNamespace({ requestId, trackNamespace: path31 });
|
|
104919
104922
|
await msg.encode(stream.writer, this.#session.version);
|
|
104920
104923
|
const respTypeId = await stream.reader.u53();
|
|
104921
104924
|
if (respTypeId === RequestOk.id) {
|
|
@@ -104931,7 +104934,7 @@ var Publisher = class {
|
|
|
104931
104934
|
if (this.#session.version === Version.DRAFT_14 || this.#session.version === Version.DRAFT_15 || this.#session.version === Version.DRAFT_16) {
|
|
104932
104935
|
try {
|
|
104933
104936
|
await stream.writer.u53(PublishNamespaceDone.id);
|
|
104934
|
-
const done = new PublishNamespaceDone({ trackNamespace:
|
|
104937
|
+
const done = new PublishNamespaceDone({ trackNamespace: path31, requestId });
|
|
104935
104938
|
await done.encode(stream.writer, this.#session.version);
|
|
104936
104939
|
} catch {
|
|
104937
104940
|
}
|
|
@@ -104943,11 +104946,11 @@ var Publisher = class {
|
|
|
104943
104946
|
}
|
|
104944
104947
|
} catch (err) {
|
|
104945
104948
|
const e = error51(err);
|
|
104946
|
-
console.warn(`announce failed: broadcast=${
|
|
104949
|
+
console.warn(`announce failed: broadcast=${path31} error=${e.message}`);
|
|
104947
104950
|
} finally {
|
|
104948
104951
|
broadcast.close();
|
|
104949
|
-
this.#broadcasts.delete(
|
|
104950
|
-
this.#notifyConsumers(
|
|
104952
|
+
this.#broadcasts.delete(path31);
|
|
104953
|
+
this.#notifyConsumers(path31, false);
|
|
104951
104954
|
}
|
|
104952
104955
|
}
|
|
104953
104956
|
/**
|
|
@@ -105139,9 +105142,9 @@ var Publisher = class {
|
|
|
105139
105142
|
}
|
|
105140
105143
|
stream.close();
|
|
105141
105144
|
}
|
|
105142
|
-
#notifyConsumers(
|
|
105145
|
+
#notifyConsumers(path31, active) {
|
|
105143
105146
|
for (const consumer of this.#announcedConsumers) {
|
|
105144
|
-
const suffix = stripPrefix(consumer.prefix,
|
|
105147
|
+
const suffix = stripPrefix(consumer.prefix, path31);
|
|
105145
105148
|
if (suffix === null)
|
|
105146
105149
|
continue;
|
|
105147
105150
|
try {
|
|
@@ -105226,23 +105229,23 @@ var Subscriber = class {
|
|
|
105226
105229
|
const msgType = await stream.reader.u53();
|
|
105227
105230
|
if (msgType === SubscribeNamespaceEntry.id) {
|
|
105228
105231
|
const entry = await SubscribeNamespaceEntry.decode(stream.reader, version4);
|
|
105229
|
-
const
|
|
105230
|
-
console.debug(`announced: broadcast=${
|
|
105231
|
-
this.#announced.add(
|
|
105232
|
+
const path31 = join9(prefix, entry.suffix);
|
|
105233
|
+
console.debug(`announced: broadcast=${path31} active=true`);
|
|
105234
|
+
this.#announced.add(path31);
|
|
105232
105235
|
for (const consumer of this.#announcedConsumers) {
|
|
105233
|
-
if (!hasPrefix(consumer.prefix,
|
|
105236
|
+
if (!hasPrefix(consumer.prefix, path31))
|
|
105234
105237
|
continue;
|
|
105235
|
-
consumer.append({ path:
|
|
105238
|
+
consumer.append({ path: path31, active: true });
|
|
105236
105239
|
}
|
|
105237
105240
|
} else if (msgType === SubscribeNamespaceEntryDone.id) {
|
|
105238
105241
|
const entry = await SubscribeNamespaceEntryDone.decode(stream.reader, version4);
|
|
105239
|
-
const
|
|
105240
|
-
console.debug(`announced: broadcast=${
|
|
105241
|
-
this.#announced.delete(
|
|
105242
|
+
const path31 = join9(prefix, entry.suffix);
|
|
105243
|
+
console.debug(`announced: broadcast=${path31} active=false`);
|
|
105244
|
+
this.#announced.delete(path31);
|
|
105242
105245
|
for (const consumer of this.#announcedConsumers) {
|
|
105243
|
-
if (!hasPrefix(consumer.prefix,
|
|
105246
|
+
if (!hasPrefix(consumer.prefix, path31))
|
|
105244
105247
|
continue;
|
|
105245
|
-
consumer.append({ path:
|
|
105248
|
+
consumer.append({ path: path31, active: false });
|
|
105246
105249
|
}
|
|
105247
105250
|
} else if (msgType === PublishBlocked.id && version4 === Version.DRAFT_17) {
|
|
105248
105251
|
const blocked = await PublishBlocked.decode(stream.reader, version4);
|
|
@@ -105274,14 +105277,14 @@ var Subscriber = class {
|
|
|
105274
105277
|
/**
|
|
105275
105278
|
* Consumes a broadcast from the connection.
|
|
105276
105279
|
*/
|
|
105277
|
-
consume(
|
|
105280
|
+
consume(path31) {
|
|
105278
105281
|
const broadcast = new Broadcast();
|
|
105279
105282
|
void (async () => {
|
|
105280
105283
|
for (; ; ) {
|
|
105281
105284
|
const request2 = await broadcast.requested();
|
|
105282
105285
|
if (!request2)
|
|
105283
105286
|
break;
|
|
105284
|
-
void this.#runSubscribe(
|
|
105287
|
+
void this.#runSubscribe(path31, request2);
|
|
105285
105288
|
}
|
|
105286
105289
|
})();
|
|
105287
105290
|
return broadcast;
|
|
@@ -105362,8 +105365,8 @@ var Subscriber = class {
|
|
|
105362
105365
|
*/
|
|
105363
105366
|
async runPublishNamespace(msg, stream) {
|
|
105364
105367
|
const version4 = this.#session.version;
|
|
105365
|
-
const
|
|
105366
|
-
if (this.#announced.has(
|
|
105368
|
+
const path31 = msg.trackNamespace;
|
|
105369
|
+
if (this.#announced.has(path31)) {
|
|
105367
105370
|
console.warn("duplicate PublishNamespace");
|
|
105368
105371
|
if (version4 === Version.DRAFT_14) {
|
|
105369
105372
|
const { PublishNamespaceError: PublishNamespaceError2 } = await Promise.resolve().then(() => (init_publish_namespace(), publish_namespace_exports));
|
|
@@ -105386,7 +105389,7 @@ var Subscriber = class {
|
|
|
105386
105389
|
stream.close();
|
|
105387
105390
|
return;
|
|
105388
105391
|
}
|
|
105389
|
-
this.#announced.add(
|
|
105392
|
+
this.#announced.add(path31);
|
|
105390
105393
|
try {
|
|
105391
105394
|
if (version4 === Version.DRAFT_14) {
|
|
105392
105395
|
const { PublishNamespaceOk: PublishNamespaceOk2 } = await Promise.resolve().then(() => (init_publish_namespace(), publish_namespace_exports));
|
|
@@ -105400,25 +105403,25 @@ var Subscriber = class {
|
|
|
105400
105403
|
});
|
|
105401
105404
|
await ok.encode(stream.writer, version4);
|
|
105402
105405
|
}
|
|
105403
|
-
console.debug(`announced: broadcast=${
|
|
105406
|
+
console.debug(`announced: broadcast=${path31} active=true`);
|
|
105404
105407
|
for (const consumer of this.#announcedConsumers) {
|
|
105405
|
-
const suffix = stripPrefix(consumer.prefix,
|
|
105408
|
+
const suffix = stripPrefix(consumer.prefix, path31);
|
|
105406
105409
|
if (suffix === null)
|
|
105407
105410
|
continue;
|
|
105408
|
-
consumer.append({ path:
|
|
105411
|
+
consumer.append({ path: path31, active: true });
|
|
105409
105412
|
}
|
|
105410
|
-
console.debug(`runPublishNamespace: awaiting stream.reader.closed for ${
|
|
105413
|
+
console.debug(`runPublishNamespace: awaiting stream.reader.closed for ${path31}`);
|
|
105411
105414
|
await stream.reader.closed;
|
|
105412
|
-
console.debug(`runPublishNamespace: stream.reader.closed resolved for ${
|
|
105415
|
+
console.debug(`runPublishNamespace: stream.reader.closed resolved for ${path31}`);
|
|
105413
105416
|
} finally {
|
|
105414
|
-
this.#announced.delete(
|
|
105415
|
-
console.debug(`announced: broadcast=${
|
|
105417
|
+
this.#announced.delete(path31);
|
|
105418
|
+
console.debug(`announced: broadcast=${path31} active=false`);
|
|
105416
105419
|
for (const consumer of this.#announcedConsumers) {
|
|
105417
|
-
const suffix = stripPrefix(consumer.prefix,
|
|
105420
|
+
const suffix = stripPrefix(consumer.prefix, path31);
|
|
105418
105421
|
if (suffix === null)
|
|
105419
105422
|
continue;
|
|
105420
105423
|
try {
|
|
105421
|
-
consumer.append({ path:
|
|
105424
|
+
consumer.append({ path: path31, active: false });
|
|
105422
105425
|
} catch {
|
|
105423
105426
|
}
|
|
105424
105427
|
}
|
|
@@ -105561,8 +105564,8 @@ var Connection = class {
|
|
|
105561
105564
|
* @param name - The broadcast path to publish
|
|
105562
105565
|
* @param broadcast - The broadcast to publish
|
|
105563
105566
|
*/
|
|
105564
|
-
publish(
|
|
105565
|
-
this.#publisher.publish(
|
|
105567
|
+
publish(path31, broadcast) {
|
|
105568
|
+
this.#publisher.publish(path31, broadcast);
|
|
105566
105569
|
}
|
|
105567
105570
|
/**
|
|
105568
105571
|
* Gets an announced reader for the specified prefix.
|
|
@@ -106074,8 +106077,8 @@ var AnnounceInit = class _AnnounceInit {
|
|
|
106074
106077
|
}
|
|
106075
106078
|
async #encode(w) {
|
|
106076
106079
|
await w.u53(this.suffixes.length);
|
|
106077
|
-
for (const
|
|
106078
|
-
await w.string(
|
|
106080
|
+
for (const path31 of this.suffixes) {
|
|
106081
|
+
await w.string(path31);
|
|
106079
106082
|
}
|
|
106080
106083
|
}
|
|
106081
106084
|
static async #decode(r) {
|
|
@@ -106511,15 +106514,15 @@ var Publisher2 = class {
|
|
|
106511
106514
|
* Publishes a broadcast with any associated tracks.
|
|
106512
106515
|
* @param name - The broadcast to publish
|
|
106513
106516
|
*/
|
|
106514
|
-
publish(
|
|
106517
|
+
publish(path31, broadcast) {
|
|
106515
106518
|
this.#broadcasts.mutate((broadcasts) => {
|
|
106516
106519
|
if (!broadcasts)
|
|
106517
106520
|
throw new Error("closed");
|
|
106518
|
-
broadcasts.set(
|
|
106521
|
+
broadcasts.set(path31, broadcast);
|
|
106519
106522
|
});
|
|
106520
106523
|
void broadcast.closed.finally(() => {
|
|
106521
106524
|
this.#broadcasts.mutate((broadcasts) => {
|
|
106522
|
-
broadcasts?.delete(
|
|
106525
|
+
broadcasts?.delete(path31);
|
|
106523
106526
|
});
|
|
106524
106527
|
});
|
|
106525
106528
|
}
|
|
@@ -106853,9 +106856,9 @@ var Subscriber2 = class {
|
|
|
106853
106856
|
case Version2.DRAFT_02: {
|
|
106854
106857
|
const init2 = await AnnounceInit.decode(stream.reader, this.version);
|
|
106855
106858
|
for (const suffix of init2.suffixes) {
|
|
106856
|
-
const
|
|
106857
|
-
console.debug(`announced: broadcast=${
|
|
106858
|
-
announced.append({ path:
|
|
106859
|
+
const path31 = join9(prefix, suffix);
|
|
106860
|
+
console.debug(`announced: broadcast=${path31} active=true`);
|
|
106861
|
+
announced.append({ path: path31, active: true });
|
|
106859
106862
|
}
|
|
106860
106863
|
break;
|
|
106861
106864
|
}
|
|
@@ -106874,9 +106877,9 @@ var Subscriber2 = class {
|
|
|
106874
106877
|
if (options.ignoreSelf && announce.hops.includes(this.origin)) {
|
|
106875
106878
|
continue;
|
|
106876
106879
|
}
|
|
106877
|
-
const
|
|
106878
|
-
console.debug(`announced: broadcast=${
|
|
106879
|
-
announced.append({ path:
|
|
106880
|
+
const path31 = join9(prefix, announce.suffix);
|
|
106881
|
+
console.debug(`announced: broadcast=${path31} active=${announce.active}`);
|
|
106882
|
+
announced.append({ path: path31, active: announce.active });
|
|
106880
106883
|
}
|
|
106881
106884
|
announced.close();
|
|
106882
106885
|
} catch (err) {
|
|
@@ -106889,14 +106892,14 @@ var Subscriber2 = class {
|
|
|
106889
106892
|
* @param name - The name of the broadcast to consume
|
|
106890
106893
|
* @returns A Broadcast instance
|
|
106891
106894
|
*/
|
|
106892
|
-
consume(
|
|
106895
|
+
consume(path31) {
|
|
106893
106896
|
const broadcast = new Broadcast();
|
|
106894
106897
|
void (async () => {
|
|
106895
106898
|
for (; ; ) {
|
|
106896
106899
|
const request2 = await broadcast.requested();
|
|
106897
106900
|
if (!request2)
|
|
106898
106901
|
break;
|
|
106899
|
-
void this.#runSubscribe(
|
|
106902
|
+
void this.#runSubscribe(path31, request2);
|
|
106900
106903
|
}
|
|
106901
106904
|
})();
|
|
106902
106905
|
return broadcast;
|
|
@@ -107130,8 +107133,8 @@ var Connection2 = class {
|
|
|
107130
107133
|
this.close();
|
|
107131
107134
|
}
|
|
107132
107135
|
}
|
|
107133
|
-
publish(
|
|
107134
|
-
this.#publisher.publish(
|
|
107136
|
+
publish(path31, broadcast) {
|
|
107137
|
+
this.#publisher.publish(path31, broadcast);
|
|
107135
107138
|
}
|
|
107136
107139
|
announced(prefix = empty()) {
|
|
107137
107140
|
return this.#subscriber.announced(prefix);
|
|
@@ -109382,7 +109385,7 @@ function sleepOrAbort(ms, signal) {
|
|
|
109382
109385
|
|
|
109383
109386
|
// ../tool-server/src/utils/simulator-client.ts
|
|
109384
109387
|
var fs9 = __toESM(require("node:fs/promises"));
|
|
109385
|
-
var
|
|
109388
|
+
var path9 = __toESM(require("node:path"));
|
|
109386
109389
|
var os4 = __toESM(require("node:os"));
|
|
109387
109390
|
var import_node_crypto4 = require("node:crypto");
|
|
109388
109391
|
var import_node_url = require("node:url");
|
|
@@ -109537,10 +109540,10 @@ function routeViaTransport(transport, cmd) {
|
|
|
109537
109540
|
}
|
|
109538
109541
|
}
|
|
109539
109542
|
function createMoqTransport(moq, options) {
|
|
109540
|
-
const screenshotDir =
|
|
109543
|
+
const screenshotDir = path9.join(os4.tmpdir(), "argent-remote-screenshots");
|
|
109541
109544
|
const writeScreenshotToDisk = async (bytes) => {
|
|
109542
109545
|
await fs9.mkdir(screenshotDir, { recursive: true });
|
|
109543
|
-
const file2 =
|
|
109546
|
+
const file2 = path9.join(screenshotDir, `${(0, import_node_crypto4.randomUUID)()}.png`);
|
|
109544
109547
|
await fs9.writeFile(file2, bytes);
|
|
109545
109548
|
return { url: (0, import_node_url.pathToFileURL)(file2).toString(), path: file2 };
|
|
109546
109549
|
};
|
|
@@ -109816,6 +109819,53 @@ var simulatorServerBlueprint = {
|
|
|
109816
109819
|
}
|
|
109817
109820
|
};
|
|
109818
109821
|
|
|
109822
|
+
// ../tool-server/src/utils/device-shutdown.ts
|
|
109823
|
+
var import_node_child_process10 = require("node:child_process");
|
|
109824
|
+
var import_node_util9 = require("node:util");
|
|
109825
|
+
var execFileAsync9 = (0, import_node_util9.promisify)(import_node_child_process10.execFile);
|
|
109826
|
+
async function shutdownOwnedDevice(id) {
|
|
109827
|
+
let platform;
|
|
109828
|
+
try {
|
|
109829
|
+
platform = resolveDevice(id).platform;
|
|
109830
|
+
} catch {
|
|
109831
|
+
return;
|
|
109832
|
+
}
|
|
109833
|
+
if (platform === "ios") {
|
|
109834
|
+
await execFileAsync9("xcrun", ["simctl", "shutdown", id]).catch(() => {
|
|
109835
|
+
});
|
|
109836
|
+
} else if (platform === "android") {
|
|
109837
|
+
await execFileAsync9("adb", ["-s", id, "emu", "kill"]).catch(() => {
|
|
109838
|
+
});
|
|
109839
|
+
}
|
|
109840
|
+
}
|
|
109841
|
+
async function shutdownOwnedDevices(ids) {
|
|
109842
|
+
await Promise.all(ids.map((id) => shutdownOwnedDevice(id)));
|
|
109843
|
+
}
|
|
109844
|
+
async function shutdownDevice(id) {
|
|
109845
|
+
let device;
|
|
109846
|
+
try {
|
|
109847
|
+
device = resolveDevice(id);
|
|
109848
|
+
} catch {
|
|
109849
|
+
return { ok: false, error: `Unknown device "${id}".` };
|
|
109850
|
+
}
|
|
109851
|
+
try {
|
|
109852
|
+
if (device.platform === "ios") {
|
|
109853
|
+
await execFileAsync9("xcrun", ["simctl", "shutdown", id]);
|
|
109854
|
+
return { ok: true };
|
|
109855
|
+
}
|
|
109856
|
+
if (device.platform === "android" && device.kind === "emulator") {
|
|
109857
|
+
await execFileAsync9("adb", ["-s", id, "emu", "kill"]);
|
|
109858
|
+
return { ok: true };
|
|
109859
|
+
}
|
|
109860
|
+
return {
|
|
109861
|
+
ok: false,
|
|
109862
|
+
error: device.platform === "android" ? "A physical Android device can't be shut down remotely." : `Shutting down ${device.platform} devices isn't supported.`
|
|
109863
|
+
};
|
|
109864
|
+
} catch (err) {
|
|
109865
|
+
return { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
109866
|
+
}
|
|
109867
|
+
}
|
|
109868
|
+
|
|
109819
109869
|
// ../tool-server/src/tools/devices/list-devices.ts
|
|
109820
109870
|
init_zod();
|
|
109821
109871
|
init_adb();
|
|
@@ -109823,7 +109873,7 @@ init_adb();
|
|
|
109823
109873
|
// ../tool-server/src/utils/chromium-discovery.ts
|
|
109824
109874
|
var fs12 = __toESM(require("node:fs"));
|
|
109825
109875
|
var os6 = __toESM(require("node:os"));
|
|
109826
|
-
var
|
|
109876
|
+
var path12 = __toESM(require("node:path"));
|
|
109827
109877
|
|
|
109828
109878
|
// ../tool-server/src/blueprints/chromium-cdp.ts
|
|
109829
109879
|
init_src();
|
|
@@ -109834,7 +109884,7 @@ init_src();
|
|
|
109834
109884
|
// ../tool-server/src/chromium-server/cdp-session.ts
|
|
109835
109885
|
var fs10 = __toESM(require("node:fs"));
|
|
109836
109886
|
var os5 = __toESM(require("node:os"));
|
|
109837
|
-
var
|
|
109887
|
+
var path10 = __toESM(require("node:path"));
|
|
109838
109888
|
|
|
109839
109889
|
// ../tool-server/src/utils/debugger/cdp-client.ts
|
|
109840
109890
|
init_wrapper();
|
|
@@ -110188,7 +110238,7 @@ async function enableCoreDomains(cdp) {
|
|
|
110188
110238
|
}
|
|
110189
110239
|
}
|
|
110190
110240
|
function mediaDir() {
|
|
110191
|
-
const dir =
|
|
110241
|
+
const dir = path10.join(os5.tmpdir(), "argent-chromium-media");
|
|
110192
110242
|
fs10.mkdirSync(dir, { recursive: true });
|
|
110193
110243
|
return dir;
|
|
110194
110244
|
}
|
|
@@ -110531,7 +110581,7 @@ var ScreencastManager = class {
|
|
|
110531
110581
|
|
|
110532
110582
|
// ../tool-server/src/chromium-server/screenshot.ts
|
|
110533
110583
|
var fs11 = __toESM(require("node:fs"));
|
|
110534
|
-
var
|
|
110584
|
+
var path11 = __toESM(require("node:path"));
|
|
110535
110585
|
var sharpCache;
|
|
110536
110586
|
var sharpLoadWarningEmitted = false;
|
|
110537
110587
|
function tryLoadSharp() {
|
|
@@ -110601,7 +110651,7 @@ async function captureScreenshot(ctx, opts = {}) {
|
|
|
110601
110651
|
}
|
|
110602
110652
|
const stem = opts.id ?? `${Date.now()}-${process.pid}`;
|
|
110603
110653
|
const safeDeviceId = ctx.deviceId.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
110604
|
-
const filePath =
|
|
110654
|
+
const filePath = path11.join(mediaDir(), `argent-screenshot-${safeDeviceId}-${stem}.png`);
|
|
110605
110655
|
fs11.writeFileSync(filePath, bytes);
|
|
110606
110656
|
return { url: `file://${filePath}`, path: filePath };
|
|
110607
110657
|
}
|
|
@@ -111124,7 +111174,7 @@ function parsePortList(raw) {
|
|
|
111124
111174
|
}
|
|
111125
111175
|
var TRACKED_PORTS = /* @__PURE__ */ new Set();
|
|
111126
111176
|
function portsFilePath() {
|
|
111127
|
-
return process.env.ARGENT_CHROMIUM_PORTS_FILE ??
|
|
111177
|
+
return process.env.ARGENT_CHROMIUM_PORTS_FILE ?? path12.join(os6.homedir(), ".argent", "chromium-cdp-ports.json");
|
|
111128
111178
|
}
|
|
111129
111179
|
function loadPersistedPorts() {
|
|
111130
111180
|
try {
|
|
@@ -111140,7 +111190,7 @@ function persistPorts(mutate) {
|
|
|
111140
111190
|
const file2 = portsFilePath();
|
|
111141
111191
|
const merged = new Set(loadPersistedPorts());
|
|
111142
111192
|
mutate(merged);
|
|
111143
|
-
fs12.mkdirSync(
|
|
111193
|
+
fs12.mkdirSync(path12.dirname(file2), { recursive: true });
|
|
111144
111194
|
fs12.writeFileSync(file2, JSON.stringify(Array.from(merged)));
|
|
111145
111195
|
} catch {
|
|
111146
111196
|
}
|
|
@@ -111518,6 +111568,36 @@ var VariantProposalStore = class {
|
|
|
111518
111568
|
* — so it is intentionally NOT cleared by `reset()`.
|
|
111519
111569
|
*/
|
|
111520
111570
|
device = null;
|
|
111571
|
+
/**
|
|
111572
|
+
* True while an `argent lens` CLI session owns the window. Set via
|
|
111573
|
+
* `setCliSession`; deliberately NOT cleared by `reset()` — a CLI session spans
|
|
111574
|
+
* many propose→submit rounds, like `device`.
|
|
111575
|
+
*/
|
|
111576
|
+
cliSession = false;
|
|
111577
|
+
/**
|
|
111578
|
+
* The agent choices a CLI Lens session offers (when more than one is
|
|
111579
|
+
* installed) and the one the human picked in the window. The `argent lens`
|
|
111580
|
+
* bridge passes the choices in on begin and polls `lensAgentChoice` to learn
|
|
111581
|
+
* which agent to spawn. Empty / null outside an unresolved pick. Like
|
|
111582
|
+
* `cliSession`, deliberately NOT cleared by `reset()`.
|
|
111583
|
+
*/
|
|
111584
|
+
lensAgents = [];
|
|
111585
|
+
lensAgentChoice = null;
|
|
111586
|
+
/**
|
|
111587
|
+
* Whether the human asked to REMEMBER the agent pick (the picker's "Remember
|
|
111588
|
+
* this choice" checkbox). The `argent lens` process reads this alongside the
|
|
111589
|
+
* choice and persists it to `~/.argent/config.json` so later runs skip the
|
|
111590
|
+
* picker. Tied to `lensAgentChoice`; reset with it.
|
|
111591
|
+
*/
|
|
111592
|
+
lensAgentRemember = false;
|
|
111593
|
+
/**
|
|
111594
|
+
* Devices (iOS udid / Android serial) that Lens BOOTED itself — i.e. the
|
|
111595
|
+
* `POST /preview/boot` route started them because they were not already
|
|
111596
|
+
* running. Tracked so the tool-server can shut them down when the CLI Lens
|
|
111597
|
+
* session ends (`takeOwnedDevices`), without ever touching a device the user
|
|
111598
|
+
* had already booted. Like `cliSession`, NOT cleared by `reset()`.
|
|
111599
|
+
*/
|
|
111600
|
+
ownedDevices = /* @__PURE__ */ new Set();
|
|
111521
111601
|
submitted = [];
|
|
111522
111602
|
submittedAnnotations = [];
|
|
111523
111603
|
variantSeq = 0;
|
|
@@ -111632,9 +111712,84 @@ var VariantProposalStore = class {
|
|
|
111632
111712
|
variants: p.variants.map((v) => ({ ...v }))
|
|
111633
111713
|
})),
|
|
111634
111714
|
device: this.device,
|
|
111635
|
-
agentWaiting: this.waitersList.some((w) => !w.settled)
|
|
111715
|
+
agentWaiting: this.waitersList.some((w) => !w.settled),
|
|
111716
|
+
cliSession: this.cliSession,
|
|
111717
|
+
lensAgents: this.lensAgents.map((a) => ({ ...a })),
|
|
111718
|
+
lensAgentChoice: this.lensAgentChoice
|
|
111636
111719
|
};
|
|
111637
111720
|
}
|
|
111721
|
+
/**
|
|
111722
|
+
* Begin or end a CLI-driven Lens session (`argent lens`), optionally offering
|
|
111723
|
+
* a set of agent choices for the window's picker. `cliSessionChanged` fires
|
|
111724
|
+
* only on an actual begin/end transition (so the window opens/closes once),
|
|
111725
|
+
* but the agent choices are always refreshed on a begin call — a re-begin from
|
|
111726
|
+
* a fresh `argent lens` must replace any stale choices.
|
|
111727
|
+
*/
|
|
111728
|
+
setCliSession(active, agents = []) {
|
|
111729
|
+
const transitioned = this.cliSession !== active;
|
|
111730
|
+
if (transitioned && active && (this.completed || this.proposals.length > 0)) this.reset();
|
|
111731
|
+
this.cliSession = active;
|
|
111732
|
+
this.lensAgents = active ? agents.map((a) => ({ ...a })) : [];
|
|
111733
|
+
this.lensAgentChoice = null;
|
|
111734
|
+
this.lensAgentRemember = false;
|
|
111735
|
+
if (transitioned) this.events.emit("cliSessionChanged", active);
|
|
111736
|
+
this.events.emit("changed");
|
|
111737
|
+
}
|
|
111738
|
+
/** Record the agent the human picked in the window's picker, and whether they
|
|
111739
|
+
* asked to remember it. */
|
|
111740
|
+
setLensAgentChoice(id, remember = false) {
|
|
111741
|
+
this.lensAgentChoice = id;
|
|
111742
|
+
this.lensAgentRemember = remember;
|
|
111743
|
+
this.events.emit("changed");
|
|
111744
|
+
}
|
|
111745
|
+
/** The agent id picked in the window, or null until the human chooses. */
|
|
111746
|
+
getLensAgentChoice() {
|
|
111747
|
+
return this.lensAgentChoice;
|
|
111748
|
+
}
|
|
111749
|
+
/** Whether the human asked to remember the current agent pick. */
|
|
111750
|
+
getLensAgentRemember() {
|
|
111751
|
+
return this.lensAgentRemember;
|
|
111752
|
+
}
|
|
111753
|
+
/** Whether a CLI-driven Lens session currently owns the window. */
|
|
111754
|
+
isCliSession() {
|
|
111755
|
+
return this.cliSession;
|
|
111756
|
+
}
|
|
111757
|
+
/** Record a device Lens booted itself, so it can be shut down on session end. */
|
|
111758
|
+
markDeviceOwned(id) {
|
|
111759
|
+
if (id.trim()) this.ownedDevices.add(id.trim());
|
|
111760
|
+
}
|
|
111761
|
+
/**
|
|
111762
|
+
* Whether Lens booted this device itself (and is therefore responsible for
|
|
111763
|
+
* it). Test-only accessor: production code manages ownership through
|
|
111764
|
+
* `markDeviceOwned` / `releaseDevice` / `takeOwnedDevices` and never needs to
|
|
111765
|
+
* read a single device's ownership. Kept as a non-mutating way for tests to
|
|
111766
|
+
* assert ownership without draining it via `takeOwnedDevices`.
|
|
111767
|
+
*/
|
|
111768
|
+
isDeviceOwned(id) {
|
|
111769
|
+
return this.ownedDevices.has(id.trim());
|
|
111770
|
+
}
|
|
111771
|
+
/**
|
|
111772
|
+
* Drop a single owned device — e.g. the user shut it down manually via the
|
|
111773
|
+
* preview window, so session-end teardown must not try to kill it again.
|
|
111774
|
+
*/
|
|
111775
|
+
releaseDevice(id) {
|
|
111776
|
+
this.ownedDevices.delete(id.trim());
|
|
111777
|
+
}
|
|
111778
|
+
/** Drain and return the devices Lens booted — the caller shuts them down. */
|
|
111779
|
+
takeOwnedDevices() {
|
|
111780
|
+
const ids = [...this.ownedDevices];
|
|
111781
|
+
this.ownedDevices.clear();
|
|
111782
|
+
return ids;
|
|
111783
|
+
}
|
|
111784
|
+
/**
|
|
111785
|
+
* The frozen outcome of the last submitted round, or null if nothing has been
|
|
111786
|
+
* submitted since the last reset. Read by `GET /preview/outcome` so the
|
|
111787
|
+
* `argent lens` watcher can format the user's feedback and type it into the
|
|
111788
|
+
* spawned `claude` terminal. Cleared (to null) when a new round begins.
|
|
111789
|
+
*/
|
|
111790
|
+
getLastOutcome() {
|
|
111791
|
+
return this.lastOutcome;
|
|
111792
|
+
}
|
|
111638
111793
|
/** Called by the preview UI when the human presses "Complete selection". */
|
|
111639
111794
|
submitSelection(input) {
|
|
111640
111795
|
const cleanAnnotations = (input.annotations ?? []).filter((a) => a && typeof a.comment === "string" && a.comment.trim()).map((a) => ({
|
|
@@ -111657,6 +111812,7 @@ var VariantProposalStore = class {
|
|
|
111657
111812
|
const toSettle = this.waitersList.filter((w) => !w.settled && w.round === round2);
|
|
111658
111813
|
this.waitersList = this.waitersList.filter((w) => w.round !== round2 || w.settled);
|
|
111659
111814
|
if (toSettle.length > 0) this.consumed = true;
|
|
111815
|
+
if (this.cliSession) this.consumed = true;
|
|
111660
111816
|
for (const w of toSettle) {
|
|
111661
111817
|
w.settled = true;
|
|
111662
111818
|
w.settle(this.lastOutcome);
|
|
@@ -112876,12 +113032,12 @@ function parseUiAutomatorDump(rawOutput, screenW, screenH, options = {}) {
|
|
|
112876
113032
|
}
|
|
112877
113033
|
|
|
112878
113034
|
// ../tool-server/src/blueprints/android-devtools.ts
|
|
112879
|
-
var
|
|
113035
|
+
var import_node_child_process12 = require("node:child_process");
|
|
112880
113036
|
var readline5 = __toESM(require("node:readline"));
|
|
112881
113037
|
init_src();
|
|
112882
113038
|
|
|
112883
113039
|
// ../native-devtools-android/src/index.ts
|
|
112884
|
-
var
|
|
113040
|
+
var path14 = __toESM(require("node:path"));
|
|
112885
113041
|
var fs14 = __toESM(require("node:fs"));
|
|
112886
113042
|
|
|
112887
113043
|
// ../native-devtools-android/src/errors.ts
|
|
@@ -112915,7 +113071,7 @@ var TraceProcessorUnavailableError = class _TraceProcessorUnavailableError exten
|
|
|
112915
113071
|
// ../native-devtools-android/src/wasm-trace-processor.ts
|
|
112916
113072
|
var import_node_fs7 = require("node:fs");
|
|
112917
113073
|
var import_promises5 = require("node:fs/promises");
|
|
112918
|
-
var
|
|
113074
|
+
var path13 = __toESM(require("node:path"));
|
|
112919
113075
|
var import_node_url2 = require("node:url");
|
|
112920
113076
|
var import_node_vm = __toESM(require("node:vm"));
|
|
112921
113077
|
var DEFAULT_INIT_MS = 1500;
|
|
@@ -112926,15 +113082,15 @@ function engineGlobals() {
|
|
|
112926
113082
|
return globalThis;
|
|
112927
113083
|
}
|
|
112928
113084
|
function resolveTraceProcessorAssets() {
|
|
112929
|
-
const dir =
|
|
113085
|
+
const dir = path13.join(__dirname, "..", "assets", "trace-processor");
|
|
112930
113086
|
const wasmOverride = process.env.ARGENT_TRACE_PROCESSOR_WASM;
|
|
112931
113087
|
if (wasmOverride && !(0, import_node_fs7.existsSync)(wasmOverride)) {
|
|
112932
113088
|
throw new TraceProcessorUnavailableError("wasm_path_invalid", { path: wasmOverride });
|
|
112933
113089
|
}
|
|
112934
113090
|
return {
|
|
112935
|
-
wasmPath: wasmOverride ??
|
|
112936
|
-
gluePath:
|
|
112937
|
-
enginePath:
|
|
113091
|
+
wasmPath: wasmOverride ?? path13.join(dir, "trace_processor.wasm"),
|
|
113092
|
+
gluePath: path13.join(dir, "engine_bundle.node.js"),
|
|
113093
|
+
enginePath: path13.join(dir, "engine.mjs")
|
|
112938
113094
|
};
|
|
112939
113095
|
}
|
|
112940
113096
|
function patchGlueForNode(src) {
|
|
@@ -113050,7 +113206,7 @@ async function createEngine() {
|
|
|
113050
113206
|
});
|
|
113051
113207
|
try {
|
|
113052
113208
|
const { wasmPath, gluePath, enginePath } = resolveTraceProcessorAssets();
|
|
113053
|
-
const dir =
|
|
113209
|
+
const dir = path13.dirname(wasmPath);
|
|
113054
113210
|
const initMs = Number(process.env.ARGENT_TRACE_PROCESSOR_INIT_MS) || DEFAULT_INIT_MS;
|
|
113055
113211
|
const { EngineBase } = await loadEngineModule(enginePath);
|
|
113056
113212
|
setupWorkerScope(dir);
|
|
@@ -113187,24 +113343,24 @@ async function ensureTraceProcessorReady(tracePath) {
|
|
|
113187
113343
|
|
|
113188
113344
|
// ../native-devtools-android/src/index.ts
|
|
113189
113345
|
function binDir() {
|
|
113190
|
-
return process.env.ARGENT_NATIVE_DEVTOOLS_ANDROID_BIN_DIR ??
|
|
113346
|
+
return process.env.ARGENT_NATIVE_DEVTOOLS_ANDROID_BIN_DIR ?? path14.join(__dirname, "..", "bin");
|
|
113191
113347
|
}
|
|
113192
113348
|
function traceProcessorQueriesDir() {
|
|
113193
|
-
return process.env.ARGENT_NATIVE_DEVTOOLS_ANDROID_QUERIES_DIR ??
|
|
113349
|
+
return process.env.ARGENT_NATIVE_DEVTOOLS_ANDROID_QUERIES_DIR ?? path14.join(__dirname, "..", "assets", "queries");
|
|
113194
113350
|
}
|
|
113195
113351
|
function traceConfigPath() {
|
|
113196
|
-
return process.env.ARGENT_NATIVE_DEVTOOLS_ANDROID_TRACECFG ??
|
|
113352
|
+
return process.env.ARGENT_NATIVE_DEVTOOLS_ANDROID_TRACECFG ?? path14.join(__dirname, "..", "assets", "argent.tracecfg.pbtxt");
|
|
113197
113353
|
}
|
|
113198
113354
|
var cachedManifest = null;
|
|
113199
113355
|
function helperManifest() {
|
|
113200
113356
|
if (cachedManifest) return cachedManifest;
|
|
113201
|
-
const manifestPath =
|
|
113357
|
+
const manifestPath = path14.join(__dirname, "..", "assets", "manifest.json");
|
|
113202
113358
|
cachedManifest = JSON.parse(fs14.readFileSync(manifestPath, "utf-8"));
|
|
113203
113359
|
return cachedManifest;
|
|
113204
113360
|
}
|
|
113205
113361
|
function bundledHelperApkPath() {
|
|
113206
113362
|
const manifest = helperManifest();
|
|
113207
|
-
const apk =
|
|
113363
|
+
const apk = path14.join(binDir(), `argent-android-devtools-${manifest.versionName}.apk`);
|
|
113208
113364
|
if (!fs14.existsSync(apk)) {
|
|
113209
113365
|
throw new Error(
|
|
113210
113366
|
`Bundled Android devtools helper APK not found at ${apk}. Run \`bash packages/native-devtools-android/scripts/build.sh\` to build it.`
|
|
@@ -113435,7 +113591,7 @@ async function spawnHelper(serial) {
|
|
|
113435
113591
|
}
|
|
113436
113592
|
);
|
|
113437
113593
|
}
|
|
113438
|
-
const proc = (0,
|
|
113594
|
+
const proc = (0, import_node_child_process12.spawn)(
|
|
113439
113595
|
adbPath,
|
|
113440
113596
|
["-s", serial, "shell", "am", "instrument", "-w", manifest.instrumentationRunner],
|
|
113441
113597
|
{ stdio: ["ignore", "pipe", "pipe"] }
|
|
@@ -113746,6 +113902,11 @@ function wsUrlFromHttp(httpUrl2) {
|
|
|
113746
113902
|
}
|
|
113747
113903
|
function createPreviewRouter(registry2) {
|
|
113748
113904
|
const router = import_express.default.Router();
|
|
113905
|
+
const requireLensFlag = (res) => {
|
|
113906
|
+
if (isFlagEnabled("argent-lens")) return true;
|
|
113907
|
+
res.status(404).end();
|
|
113908
|
+
return false;
|
|
113909
|
+
};
|
|
113749
113910
|
const KNOWN_DEVICES_TTL_MS = 5e3;
|
|
113750
113911
|
let knownDevices = null;
|
|
113751
113912
|
let knownDevicesInFlight = null;
|
|
@@ -113812,9 +113973,9 @@ function createPreviewRouter(registry2) {
|
|
|
113812
113973
|
router.get("/simulator-server/:udid", async (req, res) => {
|
|
113813
113974
|
const udid = req.params.udid;
|
|
113814
113975
|
const device = resolveDevice(udid);
|
|
113815
|
-
if (device.platform
|
|
113976
|
+
if (device.platform !== "ios" && device.platform !== "android") {
|
|
113816
113977
|
res.status(400).json({
|
|
113817
|
-
error: `Preview is not available for
|
|
113978
|
+
error: `Preview is not available for ${device.platform} devices (id "${udid}"). Use the MCP tools (screenshot, describe, gesture-*) directly.`
|
|
113818
113979
|
});
|
|
113819
113980
|
return;
|
|
113820
113981
|
}
|
|
@@ -113840,6 +114001,138 @@ function createPreviewRouter(registry2) {
|
|
|
113840
114001
|
res.set("Cache-Control", "no-store");
|
|
113841
114002
|
res.json(variantProposalStore.snapshot());
|
|
113842
114003
|
});
|
|
114004
|
+
router.post("/cli-session", (req, res) => {
|
|
114005
|
+
if (!requireLensFlag(res)) return;
|
|
114006
|
+
const active = Boolean(req.body?.active);
|
|
114007
|
+
const agents = Array.isArray(req.body?.agents) ? req.body.agents.map((a) => a).filter((a) => typeof a.id === "string" && typeof a.name === "string").map((a) => ({ id: String(a.id).slice(0, 64), name: String(a.name).slice(0, 64) })) : [];
|
|
114008
|
+
variantProposalStore.setCliSession(active, agents);
|
|
114009
|
+
res.json({ ok: true, cliSession: active });
|
|
114010
|
+
});
|
|
114011
|
+
router.post("/cli-agent", (req, res) => {
|
|
114012
|
+
if (!requireLensFlag(res)) return;
|
|
114013
|
+
const id = typeof req.body?.id === "string" ? req.body.id.slice(0, 64) : "";
|
|
114014
|
+
const remember = Boolean(req.body?.remember);
|
|
114015
|
+
variantProposalStore.setLensAgentChoice(id, remember);
|
|
114016
|
+
res.json({ ok: true, choice: id, remember });
|
|
114017
|
+
});
|
|
114018
|
+
router.post("/boot", async (req, res) => {
|
|
114019
|
+
if (!requireLensFlag(res)) return;
|
|
114020
|
+
const udid = typeof req.body?.udid === "string" ? req.body.udid : "";
|
|
114021
|
+
if (!udid) {
|
|
114022
|
+
res.status(400).json({ error: "Missing `udid`." });
|
|
114023
|
+
return;
|
|
114024
|
+
}
|
|
114025
|
+
const device = resolveDevice(udid);
|
|
114026
|
+
if (device.platform !== "ios") {
|
|
114027
|
+
res.status(400).json({
|
|
114028
|
+
error: `Booting from the preview is only supported for iOS simulators (got "${device.platform}"). Start other devices via the boot-device MCP tool.`
|
|
114029
|
+
});
|
|
114030
|
+
return;
|
|
114031
|
+
}
|
|
114032
|
+
try {
|
|
114033
|
+
if (!(await knownDeviceIds()).has(udid)) {
|
|
114034
|
+
res.status(400).json({ error: `Unknown device "${udid}". Use a udid/serial from /preview/simulators.` });
|
|
114035
|
+
return;
|
|
114036
|
+
}
|
|
114037
|
+
const data = await registry2.invokeTool(listDevicesTool.id);
|
|
114038
|
+
rememberDevices(data.devices);
|
|
114039
|
+
const entry = data.devices.find((d) => (d.platform === "ios" ? d.udid : d.serial) === udid);
|
|
114040
|
+
if (!entry) {
|
|
114041
|
+
res.status(400).json({ error: `Unknown device "${udid}". Use a udid/serial from /preview/simulators.` });
|
|
114042
|
+
return;
|
|
114043
|
+
}
|
|
114044
|
+
if (entry.state !== "Shutdown") {
|
|
114045
|
+
res.json({ ok: true, booted: true, alreadyRunning: true, owned: false });
|
|
114046
|
+
return;
|
|
114047
|
+
}
|
|
114048
|
+
await registry2.invokeTool("boot-device", { udid, headless: true });
|
|
114049
|
+
variantProposalStore.markDeviceOwned(udid);
|
|
114050
|
+
res.json({ ok: true, booted: true, alreadyRunning: false, owned: true });
|
|
114051
|
+
} catch (err) {
|
|
114052
|
+
res.status(500).json({ error: err instanceof Error ? err.message : String(err) });
|
|
114053
|
+
}
|
|
114054
|
+
});
|
|
114055
|
+
router.post("/shutdown/:udid", async (req, res) => {
|
|
114056
|
+
if (!requireLensFlag(res)) return;
|
|
114057
|
+
const udid = req.params.udid;
|
|
114058
|
+
try {
|
|
114059
|
+
const known = (await knownDeviceIds()).has(udid);
|
|
114060
|
+
if (!known) {
|
|
114061
|
+
res.status(400).json({ error: `Unknown device "${udid}". Use a udid/serial from /preview/simulators.` });
|
|
114062
|
+
return;
|
|
114063
|
+
}
|
|
114064
|
+
const result = await shutdownDevice(udid);
|
|
114065
|
+
if (!result.ok) {
|
|
114066
|
+
res.status(400).json({ error: result.error ?? "Shutdown failed." });
|
|
114067
|
+
return;
|
|
114068
|
+
}
|
|
114069
|
+
variantProposalStore.releaseDevice(udid);
|
|
114070
|
+
knownDevices = null;
|
|
114071
|
+
res.json({ ok: true });
|
|
114072
|
+
} catch (err) {
|
|
114073
|
+
res.status(500).json({ error: err instanceof Error ? err.message : String(err) });
|
|
114074
|
+
}
|
|
114075
|
+
});
|
|
114076
|
+
router.get("/outcome", (_req, res) => {
|
|
114077
|
+
res.set("Cache-Control", "no-store");
|
|
114078
|
+
res.json({ outcome: variantProposalStore.getLastOutcome() });
|
|
114079
|
+
});
|
|
114080
|
+
router.get("/lens-stream", (req, res) => {
|
|
114081
|
+
res.set({
|
|
114082
|
+
"Content-Type": "text/event-stream",
|
|
114083
|
+
"Cache-Control": "no-store",
|
|
114084
|
+
"Connection": "keep-alive"
|
|
114085
|
+
});
|
|
114086
|
+
res.flushHeaders?.();
|
|
114087
|
+
const send = (event, data) => {
|
|
114088
|
+
try {
|
|
114089
|
+
res.write(`event: ${event}
|
|
114090
|
+
data: ${JSON.stringify(data)}
|
|
114091
|
+
|
|
114092
|
+
`);
|
|
114093
|
+
} catch {
|
|
114094
|
+
}
|
|
114095
|
+
};
|
|
114096
|
+
let lastChoiceSent = variantProposalStore.getLensAgentChoice();
|
|
114097
|
+
if (lastChoiceSent) {
|
|
114098
|
+
send("agent-choice", {
|
|
114099
|
+
id: lastChoiceSent,
|
|
114100
|
+
remember: variantProposalStore.getLensAgentRemember()
|
|
114101
|
+
});
|
|
114102
|
+
}
|
|
114103
|
+
const lastOutcome = variantProposalStore.getLastOutcome();
|
|
114104
|
+
if (lastOutcome) send("outcome", lastOutcome);
|
|
114105
|
+
const onChanged = () => {
|
|
114106
|
+
const choice = variantProposalStore.getLensAgentChoice();
|
|
114107
|
+
if (choice && choice !== lastChoiceSent) {
|
|
114108
|
+
lastChoiceSent = choice;
|
|
114109
|
+
send("agent-choice", { id: choice, remember: variantProposalStore.getLensAgentRemember() });
|
|
114110
|
+
}
|
|
114111
|
+
};
|
|
114112
|
+
const onSubmitted = () => {
|
|
114113
|
+
const outcome = variantProposalStore.getLastOutcome();
|
|
114114
|
+
if (outcome) send("outcome", outcome);
|
|
114115
|
+
};
|
|
114116
|
+
const onCliSessionChanged = (active) => {
|
|
114117
|
+
if (!active) send("session-end", {});
|
|
114118
|
+
};
|
|
114119
|
+
variantProposalStore.events.on("changed", onChanged);
|
|
114120
|
+
variantProposalStore.events.on("selectionSubmitted", onSubmitted);
|
|
114121
|
+
variantProposalStore.events.on("cliSessionChanged", onCliSessionChanged);
|
|
114122
|
+
const heartbeat = setInterval(() => {
|
|
114123
|
+
try {
|
|
114124
|
+
res.write(": ping\n\n");
|
|
114125
|
+
} catch {
|
|
114126
|
+
}
|
|
114127
|
+
}, 15e3);
|
|
114128
|
+
heartbeat.unref?.();
|
|
114129
|
+
req.on("close", () => {
|
|
114130
|
+
clearInterval(heartbeat);
|
|
114131
|
+
variantProposalStore.events.off("changed", onChanged);
|
|
114132
|
+
variantProposalStore.events.off("selectionSubmitted", onSubmitted);
|
|
114133
|
+
variantProposalStore.events.off("cliSessionChanged", onCliSessionChanged);
|
|
114134
|
+
});
|
|
114135
|
+
});
|
|
113843
114136
|
router.post("/variants/selection", (req, res) => {
|
|
113844
114137
|
const body = req.body ?? {};
|
|
113845
114138
|
const rawSelections = Array.isArray(body.selections) ? body.selections : [];
|
|
@@ -113932,9 +114225,9 @@ function createPreviewRouter(registry2) {
|
|
|
113932
114225
|
router.get("/describe/:udid", async (req, res) => {
|
|
113933
114226
|
const udid = req.params.udid;
|
|
113934
114227
|
const device = resolveDevice(udid);
|
|
113935
|
-
if (device.platform
|
|
114228
|
+
if (device.platform !== "ios" && device.platform !== "android") {
|
|
113936
114229
|
res.status(400).json({
|
|
113937
|
-
error: `describe is not available for
|
|
114230
|
+
error: `describe is not available for ${device.platform} devices (id "${udid}"). Use the MCP tools (screenshot, describe, gesture-*) directly.`
|
|
113938
114231
|
});
|
|
113939
114232
|
return;
|
|
113940
114233
|
}
|
|
@@ -113980,7 +114273,7 @@ function createPreviewRouter(registry2) {
|
|
|
113980
114273
|
var import_node_fs9 = require("node:fs");
|
|
113981
114274
|
var import_promises6 = require("node:fs/promises");
|
|
113982
114275
|
var import_node_path7 = require("node:path");
|
|
113983
|
-
var
|
|
114276
|
+
var import_node_child_process13 = require("node:child_process");
|
|
113984
114277
|
init_src();
|
|
113985
114278
|
function requireArtifacts(ctx) {
|
|
113986
114279
|
if (!ctx?.artifacts) {
|
|
@@ -114028,7 +114321,7 @@ function makeArtifactListRoute(registry2) {
|
|
|
114028
114321
|
function streamDirectoryAsTarGz(id, entry, res) {
|
|
114029
114322
|
res.setHeader("Content-Type", "application/gzip");
|
|
114030
114323
|
res.setHeader("Content-Disposition", `attachment; filename="${entry.filename}.tar.gz"`);
|
|
114031
|
-
const child = (0,
|
|
114324
|
+
const child = (0, import_node_child_process13.spawn)("tar", ["-czf", "-", "-C", (0, import_node_path7.dirname)(entry.path), (0, import_node_path7.basename)(entry.path)], {
|
|
114032
114325
|
stdio: ["ignore", "pipe", "ignore"]
|
|
114033
114326
|
});
|
|
114034
114327
|
child.on("error", (err) => {
|
|
@@ -114139,8 +114432,8 @@ async function resolveFileInputs(def, body) {
|
|
|
114139
114432
|
for (const spec of specs) {
|
|
114140
114433
|
const value = args[spec.target];
|
|
114141
114434
|
if (!isFileInputWire(value)) continue;
|
|
114142
|
-
const { value:
|
|
114143
|
-
args[spec.target] =
|
|
114435
|
+
const { value: path31, meta: meta3 } = await resolveOne(spec, value, tempDirs);
|
|
114436
|
+
args[spec.target] = path31;
|
|
114144
114437
|
resolved = { ...resolved ?? {}, [spec.target]: meta3 };
|
|
114145
114438
|
}
|
|
114146
114439
|
} catch (err) {
|
|
@@ -114391,7 +114684,10 @@ function extractBearerToken(authHeader) {
|
|
|
114391
114684
|
return authHeader.slice(BEARER_PREFIX.length).trim() || null;
|
|
114392
114685
|
}
|
|
114393
114686
|
function isToolExposed(def) {
|
|
114394
|
-
|
|
114687
|
+
if (!def) return false;
|
|
114688
|
+
if (def.featureFlag && !isFlagEnabled(def.featureFlag)) return false;
|
|
114689
|
+
if (def.hideWhen?.()) return false;
|
|
114690
|
+
return true;
|
|
114395
114691
|
}
|
|
114396
114692
|
function findDependencyMissing(err) {
|
|
114397
114693
|
return findErrorInCauseChain(err, DependencyMissingError);
|
|
@@ -114984,7 +115280,7 @@ var SourceMapsRegistry = class {
|
|
|
114984
115280
|
|
|
114985
115281
|
// ../tool-server/src/utils/debugger/log-file-writer.ts
|
|
114986
115282
|
var fs16 = __toESM(require("node:fs"));
|
|
114987
|
-
var
|
|
115283
|
+
var path16 = __toESM(require("node:path"));
|
|
114988
115284
|
var os8 = __toESM(require("node:os"));
|
|
114989
115285
|
var MAX_ENTRIES = 5e4;
|
|
114990
115286
|
var CLUSTER_KEY_LENGTH = 80;
|
|
@@ -115009,9 +115305,9 @@ var LogFileWriter = class {
|
|
|
115009
115305
|
closed = false;
|
|
115010
115306
|
constructor(port) {
|
|
115011
115307
|
const timestamp = Date.now();
|
|
115012
|
-
const dir =
|
|
115308
|
+
const dir = path16.join(os8.homedir(), ".argent", "tmp");
|
|
115013
115309
|
fs16.mkdirSync(dir, { recursive: true });
|
|
115014
|
-
this.filePath =
|
|
115310
|
+
this.filePath = path16.join(dir, `argent-logs-${port}-${timestamp}.log`);
|
|
115015
115311
|
this.open();
|
|
115016
115312
|
}
|
|
115017
115313
|
open() {
|
|
@@ -115330,7 +115626,7 @@ var chromiumJsRuntimeDebuggerBlueprint = {
|
|
|
115330
115626
|
// ../tool-server/src/blueprints/tv-control.ts
|
|
115331
115627
|
var net4 = __toESM(require("node:net"));
|
|
115332
115628
|
var fs17 = __toESM(require("node:fs"));
|
|
115333
|
-
var
|
|
115629
|
+
var import_node_child_process14 = require("node:child_process");
|
|
115334
115630
|
init_src();
|
|
115335
115631
|
var TV_CONTROL_NAMESPACE = "TvControl";
|
|
115336
115632
|
function tvControlRef(device) {
|
|
@@ -115386,7 +115682,7 @@ async function sendJson(socketPath, command, timeoutMs) {
|
|
|
115386
115682
|
}
|
|
115387
115683
|
}
|
|
115388
115684
|
function spawnAxDaemon(udid, socketPath) {
|
|
115389
|
-
const proc = (0,
|
|
115685
|
+
const proc = (0, import_node_child_process14.execFile)(
|
|
115390
115686
|
"xcrun",
|
|
115391
115687
|
[
|
|
115392
115688
|
"simctl",
|
|
@@ -115405,7 +115701,7 @@ function spawnAxDaemon(udid, socketPath) {
|
|
|
115405
115701
|
return proc;
|
|
115406
115702
|
}
|
|
115407
115703
|
function spawnHidDaemon(udid, socketPath) {
|
|
115408
|
-
const proc = (0,
|
|
115704
|
+
const proc = (0, import_node_child_process14.execFile)(
|
|
115409
115705
|
tvosHidDaemonBinaryPath(),
|
|
115410
115706
|
["--udid", udid, "--socket", socketPath, "--timeout", "3600"],
|
|
115411
115707
|
{ encoding: "utf8" }
|
|
@@ -116354,7 +116650,7 @@ function normalizeWsUrl(wsUrl, port) {
|
|
|
116354
116650
|
|
|
116355
116651
|
// ../tool-server/src/utils/debugger/source-resolver.ts
|
|
116356
116652
|
var fs18 = __toESM(require("node:fs/promises"));
|
|
116357
|
-
var
|
|
116653
|
+
var path17 = __toESM(require("node:path"));
|
|
116358
116654
|
|
|
116359
116655
|
// ../../node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js
|
|
116360
116656
|
var UNKNOWN_FUNCTION2 = "<unknown>";
|
|
@@ -116459,13 +116755,13 @@ function parseNode(line) {
|
|
|
116459
116755
|
// ../tool-server/src/utils/debugger/source-resolver.ts
|
|
116460
116756
|
var ALLOWED_SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"]);
|
|
116461
116757
|
function isInsideProject(absFile, projectRoot) {
|
|
116462
|
-
const resolvedRoot =
|
|
116463
|
-
const resolvedFile =
|
|
116464
|
-
const rel =
|
|
116465
|
-
return !!rel && !rel.startsWith("..") && !
|
|
116758
|
+
const resolvedRoot = path17.resolve(projectRoot);
|
|
116759
|
+
const resolvedFile = path17.resolve(absFile);
|
|
116760
|
+
const rel = path17.relative(resolvedRoot, resolvedFile);
|
|
116761
|
+
return !!rel && !rel.startsWith("..") && !path17.isAbsolute(rel);
|
|
116466
116762
|
}
|
|
116467
116763
|
function hasAllowedExtension(filePath) {
|
|
116468
|
-
return ALLOWED_SOURCE_EXTENSIONS.has(
|
|
116764
|
+
return ALLOWED_SOURCE_EXTENSIONS.has(path17.extname(filePath).toLowerCase());
|
|
116469
116765
|
}
|
|
116470
116766
|
function parseDebugStack(stack) {
|
|
116471
116767
|
return parse3(stack).map((frame) => ({
|
|
@@ -116521,7 +116817,7 @@ function createSourceResolver(port, projectRoot) {
|
|
|
116521
116817
|
symbolicate: symbolicateFrame,
|
|
116522
116818
|
async readSourceFragment(location, contextLines = 3) {
|
|
116523
116819
|
try {
|
|
116524
|
-
const absPath =
|
|
116820
|
+
const absPath = path17.isAbsolute(location.file) ? path17.resolve(location.file) : path17.resolve(projectRoot, location.file);
|
|
116525
116821
|
const realRoot = await fs18.realpath(projectRoot);
|
|
116526
116822
|
const realPath = await fs18.realpath(absPath);
|
|
116527
116823
|
if (!isInsideProject(realPath, realRoot)) return null;
|
|
@@ -117695,8 +117991,8 @@ function clearCachedProfilerPaths(port, deviceId) {
|
|
|
117695
117991
|
}
|
|
117696
117992
|
|
|
117697
117993
|
// ../tool-server/src/tools/devices/boot-device.ts
|
|
117698
|
-
var
|
|
117699
|
-
var
|
|
117994
|
+
var import_node_child_process16 = require("node:child_process");
|
|
117995
|
+
var import_node_util11 = require("node:util");
|
|
117700
117996
|
init_zod();
|
|
117701
117997
|
init_src();
|
|
117702
117998
|
init_adb();
|
|
@@ -117868,10 +118164,10 @@ async function waitForVvdRunning(timeoutMs) {
|
|
|
117868
118164
|
}
|
|
117869
118165
|
|
|
117870
118166
|
// ../tool-server/src/tools/devices/boot-electron.ts
|
|
117871
|
-
var
|
|
118167
|
+
var import_node_child_process15 = require("node:child_process");
|
|
117872
118168
|
var fs20 = __toESM(require("node:fs"));
|
|
117873
118169
|
var net5 = __toESM(require("node:net"));
|
|
117874
|
-
var
|
|
118170
|
+
var path18 = __toESM(require("node:path"));
|
|
117875
118171
|
var DEFAULT_READY_TIMEOUT_MS = 3e4;
|
|
117876
118172
|
async function pickFreePort() {
|
|
117877
118173
|
return new Promise((resolve5, reject) => {
|
|
@@ -117890,14 +118186,14 @@ async function pickFreePort() {
|
|
|
117890
118186
|
});
|
|
117891
118187
|
}
|
|
117892
118188
|
function resolveLauncher(appPath) {
|
|
117893
|
-
const abs =
|
|
118189
|
+
const abs = path18.resolve(appPath);
|
|
117894
118190
|
if (!fs20.existsSync(abs)) {
|
|
117895
118191
|
throw new Error(`Electron boot: path does not exist: ${abs}`);
|
|
117896
118192
|
}
|
|
117897
118193
|
const stat4 = fs20.statSync(abs);
|
|
117898
118194
|
if (stat4.isDirectory()) {
|
|
117899
118195
|
if (abs.endsWith(".app")) {
|
|
117900
|
-
const macOsDir =
|
|
118196
|
+
const macOsDir = path18.join(abs, "Contents", "MacOS");
|
|
117901
118197
|
if (!fs20.existsSync(macOsDir)) {
|
|
117902
118198
|
throw new Error(
|
|
117903
118199
|
`Electron boot: ${abs} is a .app bundle but has no Contents/MacOS. Pass the inner binary directly, or use the project directory of an unpackaged app.`
|
|
@@ -117907,11 +118203,11 @@ function resolveLauncher(appPath) {
|
|
|
117907
118203
|
if (entries.length === 0) {
|
|
117908
118204
|
throw new Error(`Electron boot: ${macOsDir} is empty.`);
|
|
117909
118205
|
}
|
|
117910
|
-
const bundleName =
|
|
118206
|
+
const bundleName = path18.basename(abs, ".app");
|
|
117911
118207
|
const exec = entries.find((n) => n === bundleName) ?? entries[0];
|
|
117912
|
-
return { command:
|
|
118208
|
+
return { command: path18.join(macOsDir, exec), args: [] };
|
|
117913
118209
|
}
|
|
117914
|
-
const localBin =
|
|
118210
|
+
const localBin = path18.join(abs, "node_modules", ".bin", "electron");
|
|
117915
118211
|
if (fs20.existsSync(localBin)) {
|
|
117916
118212
|
return { command: localBin, args: [abs] };
|
|
117917
118213
|
}
|
|
@@ -117969,7 +118265,7 @@ async function bootElectronApp(options) {
|
|
|
117969
118265
|
const args = [...launcher.args, `--remote-debugging-port=${port}`, ...extra];
|
|
117970
118266
|
let child;
|
|
117971
118267
|
try {
|
|
117972
|
-
child = (0,
|
|
118268
|
+
child = (0, import_node_child_process15.spawn)(launcher.command, args, {
|
|
117973
118269
|
detached: true,
|
|
117974
118270
|
stdio: ["ignore", "pipe", "pipe"],
|
|
117975
118271
|
env: { ...process.env, ELECTRON_ENABLE_LOGGING: "1" }
|
|
@@ -118043,13 +118339,13 @@ async function bootElectronApp(options) {
|
|
|
118043
118339
|
id: chromiumIdFromPort(port),
|
|
118044
118340
|
port,
|
|
118045
118341
|
pid: child.pid,
|
|
118046
|
-
appPath:
|
|
118342
|
+
appPath: path18.resolve(options.appPath),
|
|
118047
118343
|
booted: true
|
|
118048
118344
|
};
|
|
118049
118345
|
}
|
|
118050
118346
|
|
|
118051
118347
|
// ../tool-server/src/tools/devices/boot-device.ts
|
|
118052
|
-
var
|
|
118348
|
+
var execFileAsync11 = (0, import_node_util11.promisify)(import_node_child_process16.execFile);
|
|
118053
118349
|
var zodSchema9 = external_exports.object({
|
|
118054
118350
|
udid: external_exports.string().optional().describe(
|
|
118055
118351
|
"iOS: simulator UDID to boot (from `list-devices`). Provide exactly one of `udid`, `avdName`, `vvdImage`, or `electronAppPath`."
|
|
@@ -118064,6 +118360,9 @@ var zodSchema9 = external_exports.object({
|
|
|
118064
118360
|
"Android/Vega: overall budget for the boot sequence. Default 480000 (8 min) on Android, 120000 (2 min) on Vega. Clamped to [30s, 15min]. Ignored on iOS."
|
|
118065
118361
|
),
|
|
118066
118362
|
force: external_exports.boolean().optional().describe("Shut down and re-boot the device even if already running."),
|
|
118363
|
+
headless: external_exports.boolean().optional().describe(
|
|
118364
|
+
"iOS only: boot the simulator core WITHOUT opening the Simulator.app GUI window. The device still streams via simulator-server; used by Argent Lens. Ignored on Android/Vega/Electron, which have no equivalent GUI step."
|
|
118365
|
+
),
|
|
118067
118366
|
electronAppPath: external_exports.string().optional().describe(
|
|
118068
118367
|
"Electron: path to the Electron app to launch. Either a packaged .app bundle / executable, or a project directory whose package.json points the Electron binary at the entry script. Mutually exclusive with udid/avdName."
|
|
118069
118368
|
),
|
|
@@ -118235,7 +118534,7 @@ async function listNewEmulatorSerials(before) {
|
|
|
118235
118534
|
}
|
|
118236
118535
|
return now.filter((s) => !before.has(s));
|
|
118237
118536
|
}
|
|
118238
|
-
async function bootIos(udid, registry2, force) {
|
|
118537
|
+
async function bootIos(udid, registry2, force, headless) {
|
|
118239
118538
|
if (process.platform !== "darwin") {
|
|
118240
118539
|
throw new FailureError(
|
|
118241
118540
|
`iOS Simulator is unavailable on ${process.platform}: it requires a macOS host. Pass \`avdName\` (Android) instead of \`udid\` (iOS) to boot a device from this host.`,
|
|
@@ -118252,7 +118551,7 @@ async function bootIos(udid, registry2, force) {
|
|
|
118252
118551
|
const simState = simMatch?.state;
|
|
118253
118552
|
const isTvOs = simMatch?.runtimeKind === "tv";
|
|
118254
118553
|
if (force && simState === "Booted") {
|
|
118255
|
-
await
|
|
118554
|
+
await execFileAsync11("xcrun", ["simctl", "shutdown", udid]);
|
|
118256
118555
|
}
|
|
118257
118556
|
const needsPreBoot = simState === "Shutdown" || force && simState === "Booted";
|
|
118258
118557
|
if (needsPreBoot) {
|
|
@@ -118263,13 +118562,13 @@ async function bootIos(udid, registry2, force) {
|
|
|
118263
118562
|
);
|
|
118264
118563
|
});
|
|
118265
118564
|
}
|
|
118266
|
-
await
|
|
118565
|
+
await execFileAsync11("xcrun", ["simctl", "boot", udid]).catch((err) => {
|
|
118267
118566
|
const message = err instanceof Error ? err.message : String(err);
|
|
118268
118567
|
if (!message.includes("Unable to boot device in current state: Booted")) {
|
|
118269
118568
|
throw err;
|
|
118270
118569
|
}
|
|
118271
118570
|
});
|
|
118272
|
-
await
|
|
118571
|
+
await execFileAsync11("xcrun", ["simctl", "bootstatus", udid, "-b"]);
|
|
118273
118572
|
if (isTvOs && needsPreBoot) {
|
|
118274
118573
|
await registry2.disposeService(`${TV_CONTROL_NAMESPACE}:${udid}`).catch((err) => {
|
|
118275
118574
|
if (err instanceof ServiceNotFoundError) return;
|
|
@@ -118296,13 +118595,15 @@ async function bootIos(udid, registry2, force) {
|
|
|
118296
118595
|
if (initFailure?.givenUp) {
|
|
118297
118596
|
return buildInitFailedResult(udid, initFailure);
|
|
118298
118597
|
}
|
|
118299
|
-
await
|
|
118598
|
+
await execFileAsync11("defaults", [
|
|
118300
118599
|
"write",
|
|
118301
118600
|
"com.apple.iphonesimulator",
|
|
118302
118601
|
"CurrentDeviceUDID",
|
|
118303
118602
|
udid
|
|
118304
118603
|
]);
|
|
118305
|
-
|
|
118604
|
+
if (!headless) {
|
|
118605
|
+
await execFileAsync11("open", ["-a", "Simulator.app"]);
|
|
118606
|
+
}
|
|
118306
118607
|
return { platform: "ios", udid, booted: true };
|
|
118307
118608
|
}
|
|
118308
118609
|
async function bootIosRemote(id, registry2, force) {
|
|
@@ -118339,7 +118640,7 @@ async function bootIosRemote(id, registry2, force) {
|
|
|
118339
118640
|
}
|
|
118340
118641
|
var HOT_BOOT_BUDGET_MS = 9e4;
|
|
118341
118642
|
async function attemptBoot(params) {
|
|
118342
|
-
const child = (0,
|
|
118643
|
+
const child = (0, import_node_child_process16.spawn)(params.emulatorBinary, params.emulatorArgs, {
|
|
118343
118644
|
detached: true,
|
|
118344
118645
|
stdio: "ignore"
|
|
118345
118646
|
});
|
|
@@ -118805,7 +119106,7 @@ Android boots take 2\u201310 minutes depending on machine and cold/warm state; t
|
|
|
118805
119106
|
if (classifyDevice(params.udid) === "ios-remote") {
|
|
118806
119107
|
return bootIosRemote(params.udid, registry2, params.force);
|
|
118807
119108
|
}
|
|
118808
|
-
return bootIos(params.udid, registry2, params.force);
|
|
119109
|
+
return bootIos(params.udid, registry2, params.force, params.headless);
|
|
118809
119110
|
}
|
|
118810
119111
|
if (hasAvd) {
|
|
118811
119112
|
return bootAndroid({
|
|
@@ -118899,10 +119200,10 @@ function dispatchByPlatform(opts) {
|
|
|
118899
119200
|
}
|
|
118900
119201
|
|
|
118901
119202
|
// ../tool-server/src/tools/launch-app/platforms/ios.ts
|
|
118902
|
-
var
|
|
118903
|
-
var
|
|
119203
|
+
var import_node_child_process17 = require("node:child_process");
|
|
119204
|
+
var import_node_util12 = require("node:util");
|
|
118904
119205
|
init_src();
|
|
118905
|
-
var
|
|
119206
|
+
var execFileAsync12 = (0, import_node_util12.promisify)(import_node_child_process17.execFile);
|
|
118906
119207
|
function makeIosImpl(registry2) {
|
|
118907
119208
|
return {
|
|
118908
119209
|
requires: ["xcrun"],
|
|
@@ -118915,7 +119216,7 @@ function makeIosImpl(registry2) {
|
|
|
118915
119216
|
const blocked = await precheckNativeDevtools(nativeDevtools, params.udid);
|
|
118916
119217
|
if (blocked) return blocked;
|
|
118917
119218
|
try {
|
|
118918
|
-
await
|
|
119219
|
+
await execFileAsync12("xcrun", ["simctl", "launch", params.udid, params.bundleId]);
|
|
118919
119220
|
} catch (err) {
|
|
118920
119221
|
throw new FailureError(
|
|
118921
119222
|
`Failed to launch iOS app ${params.bundleId} on ${params.udid}.`,
|
|
@@ -118935,9 +119236,9 @@ function makeIosImpl(registry2) {
|
|
|
118935
119236
|
}
|
|
118936
119237
|
|
|
118937
119238
|
// ../tool-server/src/utils/simctl-backend.ts
|
|
118938
|
-
var
|
|
118939
|
-
var
|
|
118940
|
-
var
|
|
119239
|
+
var import_node_child_process18 = require("node:child_process");
|
|
119240
|
+
var import_node_util13 = require("node:util");
|
|
119241
|
+
var execFileAsync13 = (0, import_node_util13.promisify)(import_node_child_process18.execFile);
|
|
118941
119242
|
var remoteSimctl = {
|
|
118942
119243
|
launch: simctlLaunch,
|
|
118943
119244
|
terminate: simctlTerminate
|
|
@@ -119137,10 +119438,10 @@ Common Android packages: com.android.settings, com.android.chrome, com.google.an
|
|
|
119137
119438
|
init_zod();
|
|
119138
119439
|
|
|
119139
119440
|
// ../tool-server/src/tools/restart-app/platforms/ios.ts
|
|
119140
|
-
var
|
|
119141
|
-
var
|
|
119441
|
+
var import_node_child_process19 = require("node:child_process");
|
|
119442
|
+
var import_node_util14 = require("node:util");
|
|
119142
119443
|
init_src();
|
|
119143
|
-
var
|
|
119444
|
+
var execFileAsync14 = (0, import_node_util14.promisify)(import_node_child_process19.execFile);
|
|
119144
119445
|
function makeIosImpl2(registry2) {
|
|
119145
119446
|
return {
|
|
119146
119447
|
requires: ["xcrun"],
|
|
@@ -119154,11 +119455,11 @@ function makeIosImpl2(registry2) {
|
|
|
119154
119455
|
const blocked = await precheckNativeDevtools(nativeDevtools, udid);
|
|
119155
119456
|
if (blocked) return blocked;
|
|
119156
119457
|
try {
|
|
119157
|
-
await
|
|
119458
|
+
await execFileAsync14("xcrun", ["simctl", "terminate", udid, bundleId]);
|
|
119158
119459
|
} catch {
|
|
119159
119460
|
}
|
|
119160
119461
|
try {
|
|
119161
|
-
await
|
|
119462
|
+
await execFileAsync14("xcrun", ["simctl", "launch", udid, bundleId]);
|
|
119162
119463
|
} catch (err) {
|
|
119163
119464
|
throw new FailureError(
|
|
119164
119465
|
`Failed to restart iOS app ${bundleId} on ${udid}.`,
|
|
@@ -119315,22 +119616,22 @@ Returns { restarted, bundleId }. Fails if the app is not installed.`,
|
|
|
119315
119616
|
init_zod();
|
|
119316
119617
|
|
|
119317
119618
|
// ../tool-server/src/tools/reinstall-app/platforms/ios.ts
|
|
119318
|
-
var
|
|
119319
|
-
var
|
|
119619
|
+
var import_node_child_process20 = require("node:child_process");
|
|
119620
|
+
var import_node_util15 = require("node:util");
|
|
119320
119621
|
var import_node_path10 = require("node:path");
|
|
119321
119622
|
init_src();
|
|
119322
|
-
var
|
|
119623
|
+
var execFileAsync15 = (0, import_node_util15.promisify)(import_node_child_process20.execFile);
|
|
119323
119624
|
var iosImpl = {
|
|
119324
119625
|
requires: ["xcrun"],
|
|
119325
119626
|
handler: async (_services, params) => {
|
|
119326
119627
|
const { udid, bundleId, appPath } = params;
|
|
119327
119628
|
const absolute = (0, import_node_path10.resolve)(appPath);
|
|
119328
119629
|
try {
|
|
119329
|
-
await
|
|
119630
|
+
await execFileAsync15("xcrun", ["simctl", "uninstall", udid, bundleId]);
|
|
119330
119631
|
} catch {
|
|
119331
119632
|
}
|
|
119332
119633
|
try {
|
|
119333
|
-
await
|
|
119634
|
+
await execFileAsync15("xcrun", ["simctl", "install", udid, absolute]);
|
|
119334
119635
|
} catch (err) {
|
|
119335
119636
|
throw new FailureError(
|
|
119336
119637
|
`Failed to install iOS app bundle on ${udid}.`,
|
|
@@ -119457,15 +119758,15 @@ Returns { reinstalled, bundleId }. Fails if the app path does not exist or the p
|
|
|
119457
119758
|
init_zod();
|
|
119458
119759
|
|
|
119459
119760
|
// ../tool-server/src/tools/open-url/platforms/ios.ts
|
|
119460
|
-
var
|
|
119461
|
-
var
|
|
119761
|
+
var import_node_child_process21 = require("node:child_process");
|
|
119762
|
+
var import_node_util16 = require("node:util");
|
|
119462
119763
|
init_src();
|
|
119463
|
-
var
|
|
119764
|
+
var execFileAsync16 = (0, import_node_util16.promisify)(import_node_child_process21.execFile);
|
|
119464
119765
|
var iosImpl2 = {
|
|
119465
119766
|
requires: ["xcrun"],
|
|
119466
119767
|
handler: async (_services, params) => {
|
|
119467
119768
|
try {
|
|
119468
|
-
await
|
|
119769
|
+
await execFileAsync16("xcrun", ["simctl", "openurl", params.udid, params.url]);
|
|
119469
119770
|
} catch (err) {
|
|
119470
119771
|
throw new FailureError(
|
|
119471
119772
|
`Failed to open URL on iOS simulator ${params.udid}.`,
|
|
@@ -119564,10 +119865,10 @@ Returns { opened, url }. Fails if no app is registered to handle the URI (iOS/An
|
|
|
119564
119865
|
};
|
|
119565
119866
|
|
|
119566
119867
|
// ../tool-server/src/tools/screenshot/index.ts
|
|
119567
|
-
var
|
|
119568
|
-
var
|
|
119868
|
+
var import_node_child_process22 = require("node:child_process");
|
|
119869
|
+
var import_node_util17 = require("node:util");
|
|
119569
119870
|
var os9 = __toESM(require("node:os"));
|
|
119570
|
-
var
|
|
119871
|
+
var path19 = __toESM(require("node:path"));
|
|
119571
119872
|
init_zod();
|
|
119572
119873
|
|
|
119573
119874
|
// ../tool-server/src/utils/vega-screen.ts
|
|
@@ -119774,7 +120075,7 @@ function scalePng(src, scale) {
|
|
|
119774
120075
|
}
|
|
119775
120076
|
|
|
119776
120077
|
// ../tool-server/src/tools/screenshot/index.ts
|
|
119777
|
-
var
|
|
120078
|
+
var execFileAsync17 = (0, import_node_util17.promisify)(import_node_child_process22.execFile);
|
|
119778
120079
|
var zodSchema14 = external_exports.object({
|
|
119779
120080
|
udid: external_exports.string().describe(
|
|
119780
120081
|
"Target device id from `list-devices` (iOS UDID, Android serial, Apple TV UDID, Vega serial, or Chromium id)."
|
|
@@ -119800,13 +120101,13 @@ var capability6 = {
|
|
|
119800
120101
|
vega: { vvd: true }
|
|
119801
120102
|
};
|
|
119802
120103
|
async function tvScreenshot(udid, scale, signal) {
|
|
119803
|
-
const file2 =
|
|
120104
|
+
const file2 = path19.join(
|
|
119804
120105
|
os9.tmpdir(),
|
|
119805
120106
|
`argent-tv-screenshot-${udid.slice(0, 8)}-${process.hrtime.bigint()}.png`
|
|
119806
120107
|
);
|
|
119807
|
-
await
|
|
120108
|
+
await execFileAsync17("xcrun", ["simctl", "io", udid, "screenshot", file2], { signal });
|
|
119808
120109
|
if (scale < 1) {
|
|
119809
|
-
await
|
|
120110
|
+
await execFileAsync17("sips", ["-Z", String(await tvTargetLongSide(file2, scale)), file2], {
|
|
119810
120111
|
signal
|
|
119811
120112
|
}).catch(() => {
|
|
119812
120113
|
});
|
|
@@ -119816,7 +120117,7 @@ async function tvScreenshot(udid, scale, signal) {
|
|
|
119816
120117
|
async function tvTargetLongSide(file2, scale) {
|
|
119817
120118
|
let longSide = 3840;
|
|
119818
120119
|
try {
|
|
119819
|
-
const { stdout } = await
|
|
120120
|
+
const { stdout } = await execFileAsync17("sips", ["-g", "pixelWidth", "-g", "pixelHeight", file2]);
|
|
119820
120121
|
const width = Number(/pixelWidth:\s*(\d+)/.exec(stdout)?.[1]);
|
|
119821
120122
|
const height = Number(/pixelHeight:\s*(\d+)/.exec(stdout)?.[1]);
|
|
119822
120123
|
if (Number.isFinite(width) && Number.isFinite(height) && width > 0 && height > 0) {
|
|
@@ -123816,13 +124117,13 @@ async function fetchVegaPageSource(timeoutMs = 15e3) {
|
|
|
123816
124117
|
});
|
|
123817
124118
|
}
|
|
123818
124119
|
}
|
|
123819
|
-
function postJson(host, port,
|
|
124120
|
+
function postJson(host, port, path31, body, timeoutMs) {
|
|
123820
124121
|
return new Promise((resolve5, reject) => {
|
|
123821
124122
|
const req = (0, import_node_http.request)(
|
|
123822
124123
|
{
|
|
123823
124124
|
host,
|
|
123824
124125
|
port,
|
|
123825
|
-
path:
|
|
124126
|
+
path: path31,
|
|
123826
124127
|
method: "POST",
|
|
123827
124128
|
headers: {
|
|
123828
124129
|
"Content-Type": "application/json",
|
|
@@ -126920,16 +127221,16 @@ var MatcherView = class {
|
|
|
126920
127221
|
* @returns {string|undefined}
|
|
126921
127222
|
*/
|
|
126922
127223
|
getCurrentTag() {
|
|
126923
|
-
const
|
|
126924
|
-
return
|
|
127224
|
+
const path31 = this._matcher.path;
|
|
127225
|
+
return path31.length > 0 ? path31[path31.length - 1].tag : void 0;
|
|
126925
127226
|
}
|
|
126926
127227
|
/**
|
|
126927
127228
|
* Get current namespace.
|
|
126928
127229
|
* @returns {string|undefined}
|
|
126929
127230
|
*/
|
|
126930
127231
|
getCurrentNamespace() {
|
|
126931
|
-
const
|
|
126932
|
-
return
|
|
127232
|
+
const path31 = this._matcher.path;
|
|
127233
|
+
return path31.length > 0 ? path31[path31.length - 1].namespace : void 0;
|
|
126933
127234
|
}
|
|
126934
127235
|
/**
|
|
126935
127236
|
* Get current node's attribute value.
|
|
@@ -126937,9 +127238,9 @@ var MatcherView = class {
|
|
|
126937
127238
|
* @returns {*}
|
|
126938
127239
|
*/
|
|
126939
127240
|
getAttrValue(attrName) {
|
|
126940
|
-
const
|
|
126941
|
-
if (
|
|
126942
|
-
return
|
|
127241
|
+
const path31 = this._matcher.path;
|
|
127242
|
+
if (path31.length === 0) return void 0;
|
|
127243
|
+
return path31[path31.length - 1].values?.[attrName];
|
|
126943
127244
|
}
|
|
126944
127245
|
/**
|
|
126945
127246
|
* Check if current node has an attribute.
|
|
@@ -126947,9 +127248,9 @@ var MatcherView = class {
|
|
|
126947
127248
|
* @returns {boolean}
|
|
126948
127249
|
*/
|
|
126949
127250
|
hasAttr(attrName) {
|
|
126950
|
-
const
|
|
126951
|
-
if (
|
|
126952
|
-
const current =
|
|
127251
|
+
const path31 = this._matcher.path;
|
|
127252
|
+
if (path31.length === 0) return false;
|
|
127253
|
+
const current = path31[path31.length - 1];
|
|
126953
127254
|
return current.values !== void 0 && attrName in current.values;
|
|
126954
127255
|
}
|
|
126955
127256
|
/**
|
|
@@ -126957,18 +127258,18 @@ var MatcherView = class {
|
|
|
126957
127258
|
* @returns {number}
|
|
126958
127259
|
*/
|
|
126959
127260
|
getPosition() {
|
|
126960
|
-
const
|
|
126961
|
-
if (
|
|
126962
|
-
return
|
|
127261
|
+
const path31 = this._matcher.path;
|
|
127262
|
+
if (path31.length === 0) return -1;
|
|
127263
|
+
return path31[path31.length - 1].position ?? 0;
|
|
126963
127264
|
}
|
|
126964
127265
|
/**
|
|
126965
127266
|
* Get current node's repeat counter (occurrence count of this tag name).
|
|
126966
127267
|
* @returns {number}
|
|
126967
127268
|
*/
|
|
126968
127269
|
getCounter() {
|
|
126969
|
-
const
|
|
126970
|
-
if (
|
|
126971
|
-
return
|
|
127270
|
+
const path31 = this._matcher.path;
|
|
127271
|
+
if (path31.length === 0) return -1;
|
|
127272
|
+
return path31[path31.length - 1].counter ?? 0;
|
|
126972
127273
|
}
|
|
126973
127274
|
/**
|
|
126974
127275
|
* Get current node's sibling index (alias for getPosition).
|
|
@@ -129423,46 +129724,46 @@ var jsonReplacer = (_key, value) => {
|
|
|
129423
129724
|
};
|
|
129424
129725
|
async function writeDump(dir, filename, data) {
|
|
129425
129726
|
try {
|
|
129426
|
-
const
|
|
129727
|
+
const path31 = (0, import_path4.join)(dir, filename);
|
|
129427
129728
|
const json2 = JSON.stringify(data, jsonReplacer, 2);
|
|
129428
|
-
await import_fs.promises.writeFile(
|
|
129429
|
-
return
|
|
129729
|
+
await import_fs.promises.writeFile(path31, json2, "utf8");
|
|
129730
|
+
return path31;
|
|
129430
129731
|
} catch {
|
|
129431
129732
|
return null;
|
|
129432
129733
|
}
|
|
129433
129734
|
}
|
|
129434
129735
|
async function writeDumpCompact(dir, filename, data) {
|
|
129435
129736
|
try {
|
|
129436
|
-
const
|
|
129737
|
+
const path31 = (0, import_path4.join)(dir, filename);
|
|
129437
129738
|
const json2 = JSON.stringify(data, jsonReplacer);
|
|
129438
|
-
await import_fs.promises.writeFile(
|
|
129439
|
-
return
|
|
129739
|
+
await import_fs.promises.writeFile(path31, json2, "utf8");
|
|
129740
|
+
return path31;
|
|
129440
129741
|
} catch {
|
|
129441
129742
|
return null;
|
|
129442
129743
|
}
|
|
129443
129744
|
}
|
|
129444
|
-
async function readCpuProfile(
|
|
129445
|
-
const json2 = await import_fs.promises.readFile(
|
|
129745
|
+
async function readCpuProfile(path31) {
|
|
129746
|
+
const json2 = await import_fs.promises.readFile(path31, "utf8");
|
|
129446
129747
|
const parsed = JSON.parse(json2);
|
|
129447
129748
|
if (!parsed || typeof parsed !== "object") {
|
|
129448
129749
|
throw new Error(
|
|
129449
|
-
`On-disk CPU profile at ${
|
|
129750
|
+
`On-disk CPU profile at ${path31} is missing or not an object. The session dump is corrupt or was written by an incompatible tool-server version; rerun react-profiler-start/stop to capture a fresh session.`
|
|
129450
129751
|
);
|
|
129451
129752
|
}
|
|
129452
129753
|
if (!Array.isArray(parsed.samples) || !Array.isArray(parsed.nodes) || !Array.isArray(parsed.timeDeltas)) {
|
|
129453
129754
|
throw new Error(
|
|
129454
|
-
`On-disk CPU profile at ${
|
|
129755
|
+
`On-disk CPU profile at ${path31} is malformed (missing samples/nodes/timeDeltas). The session was likely recorded against a release build where Hermes CPU sampling never started, or the dump was truncated. Rerun react-profiler-start on a dev build and retry.`
|
|
129455
129756
|
);
|
|
129456
129757
|
}
|
|
129457
129758
|
if (typeof parsed.startTime !== "number" || typeof parsed.endTime !== "number") {
|
|
129458
129759
|
throw new Error(
|
|
129459
|
-
`On-disk CPU profile at ${
|
|
129760
|
+
`On-disk CPU profile at ${path31} is missing startTime/endTime timestamps; the recording is incomplete and cannot be analysed.`
|
|
129460
129761
|
);
|
|
129461
129762
|
}
|
|
129462
129763
|
return parsed;
|
|
129463
129764
|
}
|
|
129464
|
-
async function readCommitTree(
|
|
129465
|
-
const json2 = await import_fs.promises.readFile(
|
|
129765
|
+
async function readCommitTree(path31) {
|
|
129766
|
+
const json2 = await import_fs.promises.readFile(path31, "utf8");
|
|
129466
129767
|
return JSON.parse(json2);
|
|
129467
129768
|
}
|
|
129468
129769
|
|
|
@@ -129889,9 +130190,9 @@ init_src();
|
|
|
129889
130190
|
var import_fs2 = require("fs");
|
|
129890
130191
|
var import_path5 = require("path");
|
|
129891
130192
|
var import_semver3 = __toESM(require_semver2());
|
|
129892
|
-
async function readFileSafe(
|
|
130193
|
+
async function readFileSafe(path31) {
|
|
129893
130194
|
try {
|
|
129894
|
-
return await import_fs2.promises.readFile(
|
|
130195
|
+
return await import_fs2.promises.readFile(path31, "utf8");
|
|
129895
130196
|
} catch {
|
|
129896
130197
|
return null;
|
|
129897
130198
|
}
|
|
@@ -131249,9 +131550,9 @@ function shortenPath(file2) {
|
|
|
131249
131550
|
const parts = file2.replace(/\\/g, "/").split("/");
|
|
131250
131551
|
return parts.slice(-2).join("/");
|
|
131251
131552
|
}
|
|
131252
|
-
async function writeReport(
|
|
131553
|
+
async function writeReport(path31, content) {
|
|
131253
131554
|
try {
|
|
131254
|
-
await import_fs4.promises.writeFile(
|
|
131555
|
+
await import_fs4.promises.writeFile(path31, content, "utf8");
|
|
131255
131556
|
return true;
|
|
131256
131557
|
} catch {
|
|
131257
131558
|
return false;
|
|
@@ -132097,7 +132398,7 @@ var import_child_process4 = require("child_process");
|
|
|
132097
132398
|
init_src();
|
|
132098
132399
|
var import_fs9 = require("fs");
|
|
132099
132400
|
var import_node_fs10 = require("node:fs");
|
|
132100
|
-
var
|
|
132401
|
+
var path22 = __toESM(require("path"));
|
|
132101
132402
|
|
|
132102
132403
|
// ../tool-server/src/utils/ios-profiler/notify.ts
|
|
132103
132404
|
var import_child_process = require("child_process");
|
|
@@ -132238,7 +132539,7 @@ function waitForXctraceReady(child, { notify, timeoutMs }) {
|
|
|
132238
132539
|
}
|
|
132239
132540
|
|
|
132240
132541
|
// ../tool-server/src/utils/ios-profiler/export.ts
|
|
132241
|
-
var
|
|
132542
|
+
var path20 = __toESM(require("path"));
|
|
132242
132543
|
|
|
132243
132544
|
// ../tool-server/src/utils/ios-profiler/run-with-timeout.ts
|
|
132244
132545
|
var import_child_process2 = require("child_process");
|
|
@@ -132330,10 +132631,10 @@ async function exportIosTraceData(traceFile) {
|
|
|
132330
132631
|
cpuSchemaUsed: null,
|
|
132331
132632
|
errors: {}
|
|
132332
132633
|
};
|
|
132333
|
-
const dir =
|
|
132334
|
-
const baseName =
|
|
132634
|
+
const dir = path20.dirname(traceFile);
|
|
132635
|
+
const baseName = path20.basename(traceFile, ".trace");
|
|
132335
132636
|
for (const [key, config2] of Object.entries(EXPORTS)) {
|
|
132336
|
-
const outPath =
|
|
132637
|
+
const outPath = path20.join(dir, `${baseName}${config2.suffix}`);
|
|
132337
132638
|
if (key === "cpu") {
|
|
132338
132639
|
const resolvedXpath = await resolveCpuXpath(traceFile, diagnostics);
|
|
132339
132640
|
if (resolvedXpath) {
|
|
@@ -132409,8 +132710,8 @@ function extractRows(xml) {
|
|
|
132409
132710
|
}
|
|
132410
132711
|
return rows;
|
|
132411
132712
|
}
|
|
132412
|
-
function isSystemLibraryPath(
|
|
132413
|
-
return SYSTEM_LIBRARY_PATH_PREFIXES.some((prefix) =>
|
|
132713
|
+
function isSystemLibraryPath(path31) {
|
|
132714
|
+
return SYSTEM_LIBRARY_PATH_PREFIXES.some((prefix) => path31.startsWith(prefix));
|
|
132414
132715
|
}
|
|
132415
132716
|
function parseCpuXml(xml, targetPid = null) {
|
|
132416
132717
|
const frameRegistry = /* @__PURE__ */ new Map();
|
|
@@ -133064,7 +133365,7 @@ function selectIosCaptureStrategy() {
|
|
|
133064
133365
|
|
|
133065
133366
|
// ../tool-server/src/utils/ios-profiler/render.ts
|
|
133066
133367
|
var import_fs8 = require("fs");
|
|
133067
|
-
var
|
|
133368
|
+
var path21 = __toESM(require("path"));
|
|
133068
133369
|
var import_bytes3 = __toESM(require_bytes());
|
|
133069
133370
|
|
|
133070
133371
|
// ../tool-server/src/utils/profiler-shared/demangle.ts
|
|
@@ -133271,7 +133572,7 @@ function reportTitle(payload) {
|
|
|
133271
133572
|
return payload.metadata.platform.toLowerCase() === "android" ? "Android Perfetto Analysis" : "iOS Instruments Analysis";
|
|
133272
133573
|
}
|
|
133273
133574
|
function renderAllClear2(payload, exportErrors, freshnessNote) {
|
|
133274
|
-
const traceName = payload.metadata.traceFile ? `\`${
|
|
133575
|
+
const traceName = payload.metadata.traceFile ? `\`${path21.basename(payload.metadata.traceFile)}\`` : "unknown";
|
|
133275
133576
|
const lines = [
|
|
133276
133577
|
`# ${reportTitle(payload)}`,
|
|
133277
133578
|
``,
|
|
@@ -133299,7 +133600,7 @@ function renderAllClear2(payload, exportErrors, freshnessNote) {
|
|
|
133299
133600
|
return lines.join("\n");
|
|
133300
133601
|
}
|
|
133301
133602
|
function renderFullReport(payload, exportErrors, cap = { hotspotLimit: Infinity, hangLimit: Infinity }, freshnessNote) {
|
|
133302
|
-
const traceName = payload.metadata.traceFile ? `\`${
|
|
133603
|
+
const traceName = payload.metadata.traceFile ? `\`${path21.basename(payload.metadata.traceFile)}\`` : "unknown";
|
|
133303
133604
|
const cpuHotspots = payload.bottlenecks.filter((b) => b.type === "cpu_hotspot");
|
|
133304
133605
|
const uiHangs = payload.bottlenecks.filter((b) => b.type === "ui_hang");
|
|
133305
133606
|
const memoryLeaks = payload.bottlenecks.filter((b) => b.type === "memory_leak");
|
|
@@ -133602,10 +133903,10 @@ function formatBytes3(sizeBytes) {
|
|
|
133602
133903
|
return (0, import_bytes3.default)(sizeBytes, { decimalPlaces: 1, unitSeparator: " " }) ?? `${sizeBytes} B`;
|
|
133603
133904
|
}
|
|
133604
133905
|
function deriveReportPath(traceFile) {
|
|
133605
|
-
const dir =
|
|
133606
|
-
const ext =
|
|
133607
|
-
const baseName =
|
|
133608
|
-
return
|
|
133906
|
+
const dir = path21.dirname(traceFile);
|
|
133907
|
+
const ext = path21.extname(traceFile);
|
|
133908
|
+
const baseName = path21.basename(traceFile, ext);
|
|
133909
|
+
return path21.join(dir, `${baseName}-report.md`);
|
|
133609
133910
|
}
|
|
133610
133911
|
async function writeReport2(filePath, content) {
|
|
133611
133912
|
try {
|
|
@@ -133641,8 +133942,8 @@ var RECORDING_CAP_MS = 10 * 60 * 1e3;
|
|
|
133641
133942
|
// ../tool-server/src/tools/profiler/native-profiler/platforms/ios.ts
|
|
133642
133943
|
function resolveDefaultTemplatePath() {
|
|
133643
133944
|
const candidates = [
|
|
133644
|
-
|
|
133645
|
-
|
|
133945
|
+
path22.resolve(__dirname, "..", "assets", "Argent.tracetemplate"),
|
|
133946
|
+
path22.resolve(
|
|
133646
133947
|
__dirname,
|
|
133647
133948
|
"..",
|
|
133648
133949
|
"..",
|
|
@@ -133861,7 +134162,7 @@ async function startNativeProfilerIos(api, params) {
|
|
|
133861
134162
|
}
|
|
133862
134163
|
const debugDir = await getDebugDir();
|
|
133863
134164
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:T]/g, (m) => m === "T" ? "-" : "").slice(0, 15);
|
|
133864
|
-
const outputFile =
|
|
134165
|
+
const outputFile = path22.join(debugDir, `native-profiler-${timestamp}.trace`);
|
|
133865
134166
|
api.recordingTimedOut = false;
|
|
133866
134167
|
api.recordingExitedUnexpectedly = false;
|
|
133867
134168
|
api.lastExitInfo = null;
|
|
@@ -134080,7 +134381,7 @@ async function analyzeNativeProfilerIos(api) {
|
|
|
134080
134381
|
}
|
|
134081
134382
|
|
|
134082
134383
|
// ../tool-server/src/tools/profiler/native-profiler/platforms/android.ts
|
|
134083
|
-
var
|
|
134384
|
+
var path25 = __toESM(require("path"));
|
|
134084
134385
|
|
|
134085
134386
|
// ../tool-server/src/utils/android-profiler/capture.ts
|
|
134086
134387
|
var import_child_process5 = require("child_process");
|
|
@@ -134358,9 +134659,9 @@ function parseUserPackages(output) {
|
|
|
134358
134659
|
|
|
134359
134660
|
// ../tool-server/src/utils/android-profiler/pipeline/run-tp.ts
|
|
134360
134661
|
var import_fs11 = require("fs");
|
|
134361
|
-
var
|
|
134662
|
+
var path23 = __toESM(require("path"));
|
|
134362
134663
|
async function runTpQuery(opts) {
|
|
134363
|
-
const queryPath =
|
|
134664
|
+
const queryPath = path23.join(traceProcessorQueriesDir(), opts.query);
|
|
134364
134665
|
const template = await import_fs11.promises.readFile(queryPath, "utf8");
|
|
134365
134666
|
const sql = renderSqlTemplate(template, opts.substitutions);
|
|
134366
134667
|
return runTpInline({ tracePath: opts.tracePath, sql });
|
|
@@ -134416,7 +134717,7 @@ function foldHangAnnotations(hang, stateRows, gcRows) {
|
|
|
134416
134717
|
|
|
134417
134718
|
// ../tool-server/src/utils/android-profiler/pipeline/hang-folds-batched.ts
|
|
134418
134719
|
var import_fs12 = require("fs");
|
|
134419
|
-
var
|
|
134720
|
+
var path24 = __toESM(require("path"));
|
|
134420
134721
|
|
|
134421
134722
|
// ../tool-server/src/utils/android-profiler/pipeline/sql-safety.ts
|
|
134422
134723
|
function sanitizeProcessName(name) {
|
|
@@ -134444,7 +134745,7 @@ async function runBatchedHangFolds(opts) {
|
|
|
134444
134745
|
assertSafeWindow(hang);
|
|
134445
134746
|
valuesTuples.push(`(${hang.hangIndex},${hang.startNs},${hang.endNs})`);
|
|
134446
134747
|
}
|
|
134447
|
-
const templatePath =
|
|
134748
|
+
const templatePath = path24.join(traceProcessorQueriesDir(), "hang-folds-batched.sql");
|
|
134448
134749
|
const template = await import_fs12.promises.readFile(templatePath, "utf8");
|
|
134449
134750
|
const sql = renderSqlTemplate(template, {
|
|
134450
134751
|
HANG_WINDOWS_VALUES: valuesTuples.join(",\n "),
|
|
@@ -134940,7 +135241,7 @@ async function startNativeProfilerAndroid(api, params) {
|
|
|
134940
135241
|
}
|
|
134941
135242
|
const debugDir = await getDebugDir();
|
|
134942
135243
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:T]/g, (m) => m === "T" ? "-" : "").slice(0, 15);
|
|
134943
|
-
const hostTracePath =
|
|
135244
|
+
const hostTracePath = path25.join(debugDir, `native-profiler-${timestamp}.pftrace`);
|
|
134944
135245
|
api.recordingTimedOut = false;
|
|
134945
135246
|
api.recordingExitedUnexpectedly = false;
|
|
134946
135247
|
api.lastExitInfo = null;
|
|
@@ -136504,7 +136805,7 @@ function renderCombinedMemoryLeaks(memoryLeaks, mountComponents) {
|
|
|
136504
136805
|
// ../tool-server/src/tools/profiler/query/profiler-load.ts
|
|
136505
136806
|
init_zod();
|
|
136506
136807
|
var import_fs15 = require("fs");
|
|
136507
|
-
var
|
|
136808
|
+
var path26 = __toESM(require("path"));
|
|
136508
136809
|
init_src();
|
|
136509
136810
|
var SESSION_ID_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
136510
136811
|
function assertSafeSessionId(sessionId) {
|
|
@@ -136582,7 +136883,7 @@ async function listSessions(debugDir) {
|
|
|
136582
136883
|
const commitsFile = files.find((f) => f.includes("_commits.json"));
|
|
136583
136884
|
if (commitsFile) {
|
|
136584
136885
|
try {
|
|
136585
|
-
const onDisk = await readCommitTree(
|
|
136886
|
+
const onDisk = await readCommitTree(path26.join(debugDir, commitsFile));
|
|
136586
136887
|
if (onDisk.meta) {
|
|
136587
136888
|
appName = onDisk.meta.appName ?? null;
|
|
136588
136889
|
deviceName = onDisk.meta.deviceName ?? null;
|
|
@@ -136591,7 +136892,7 @@ async function listSessions(debugDir) {
|
|
|
136591
136892
|
} catch {
|
|
136592
136893
|
}
|
|
136593
136894
|
}
|
|
136594
|
-
const project = projectRoot ?
|
|
136895
|
+
const project = projectRoot ? path26.basename(projectRoot) : null;
|
|
136595
136896
|
lines.push(`| \`${sid}\` | ${appName ?? "\u2014"} | ${deviceName ?? "\u2014"} | ${project ?? "\u2014"} |`);
|
|
136596
136897
|
}
|
|
136597
136898
|
lines.push("");
|
|
@@ -136633,9 +136934,9 @@ async function listSessions(debugDir) {
|
|
|
136633
136934
|
}
|
|
136634
136935
|
async function loadReactSession(debugDir, sessionId, port, deviceId) {
|
|
136635
136936
|
assertSafeSessionId(sessionId);
|
|
136636
|
-
const cpuPath =
|
|
136637
|
-
const commitsPath =
|
|
136638
|
-
const cpuIndexPath =
|
|
136937
|
+
const cpuPath = path26.join(debugDir, `react-profiler-${sessionId}_cpu.json`);
|
|
136938
|
+
const commitsPath = path26.join(debugDir, `react-profiler-${sessionId}_commits.json`);
|
|
136939
|
+
const cpuIndexPath = path26.join(debugDir, `react-profiler-${sessionId}_cpu-index.json`);
|
|
136639
136940
|
let hasCpu = false;
|
|
136640
136941
|
let hasCommits = false;
|
|
136641
136942
|
let hasCpuIndex = false;
|
|
@@ -136718,7 +137019,7 @@ async function loadReactSession(debugDir, sessionId, port, deviceId) {
|
|
|
136718
137019
|
"",
|
|
136719
137020
|
`- Runtime: ${appName ?? "unknown"}`,
|
|
136720
137021
|
`- Device: ${deviceName ?? "unknown"}`,
|
|
136721
|
-
`- Metro bundle: ${projectRoot ?
|
|
137022
|
+
`- Metro bundle: ${projectRoot ? path26.basename(projectRoot) : "unknown"}`,
|
|
136722
137023
|
`- CPU profile: ${sampleInfo}`,
|
|
136723
137024
|
`- Commits persisted (hot \xB11 margin, \u226516ms): ${commitCount}`,
|
|
136724
137025
|
`- Total React commits: ${totalReactCommits ?? "unknown"}`,
|
|
@@ -136731,7 +137032,7 @@ async function loadReactSession(debugDir, sessionId, port, deviceId) {
|
|
|
136731
137032
|
async function loadNativeSession(debugDir, sessionId, api, appProcessOverride) {
|
|
136732
137033
|
assertSafeSessionId(sessionId);
|
|
136733
137034
|
if (api.platform === "android") {
|
|
136734
|
-
const pftrace =
|
|
137035
|
+
const pftrace = path26.join(debugDir, `native-profiler-${sessionId}.pftrace`);
|
|
136735
137036
|
try {
|
|
136736
137037
|
await import_fs15.promises.access(pftrace);
|
|
136737
137038
|
} catch {
|
|
@@ -136761,9 +137062,9 @@ async function loadNativeSession(debugDir, sessionId, api, appProcessOverride) {
|
|
|
136761
137062
|
"Run `native-profiler-analyze` to produce a report from this trace."
|
|
136762
137063
|
].join("\n");
|
|
136763
137064
|
}
|
|
136764
|
-
const cpuXml =
|
|
136765
|
-
const hangsXml =
|
|
136766
|
-
const leaksXml =
|
|
137065
|
+
const cpuXml = path26.join(debugDir, `native-profiler-${sessionId}_raw_cpu.xml`);
|
|
137066
|
+
const hangsXml = path26.join(debugDir, `native-profiler-${sessionId}_raw_hangs.xml`);
|
|
137067
|
+
const leaksXml = path26.join(debugDir, `native-profiler-${sessionId}_raw_leaks.xml`);
|
|
136767
137068
|
const files = {
|
|
136768
137069
|
cpu: null,
|
|
136769
137070
|
hangs: null,
|
|
@@ -136949,7 +137250,7 @@ function createStopAllSimulatorServersTool(registry2) {
|
|
|
136949
137250
|
|
|
136950
137251
|
// ../tool-server/src/tools/simulator/stop-metro.ts
|
|
136951
137252
|
init_zod();
|
|
136952
|
-
var
|
|
137253
|
+
var import_node_child_process23 = require("node:child_process");
|
|
136953
137254
|
var zodSchema55 = external_exports.object({
|
|
136954
137255
|
port: external_exports.number().int().min(1).max(65535).default(8081).describe("TCP port Metro is listening on (default 8081)")
|
|
136955
137256
|
});
|
|
@@ -136961,7 +137262,7 @@ var stopMetroTool = {
|
|
|
136961
137262
|
async execute(_services, params) {
|
|
136962
137263
|
const port = params.port;
|
|
136963
137264
|
try {
|
|
136964
|
-
const output = (0,
|
|
137265
|
+
const output = (0, import_node_child_process23.execFileSync)("lsof", ["-ti", `tcp:${port}`, "-sTCP:LISTEN"], {
|
|
136965
137266
|
encoding: "utf-8",
|
|
136966
137267
|
timeout: 5e3
|
|
136967
137268
|
}).trim();
|
|
@@ -136990,17 +137291,17 @@ init_zod();
|
|
|
136990
137291
|
var fs36 = __toESM(require("node:fs/promises"));
|
|
136991
137292
|
|
|
136992
137293
|
// ../tool-server/src/tools/flows/flow-utils.ts
|
|
136993
|
-
var
|
|
137294
|
+
var path27 = __toESM(require("node:path"));
|
|
136994
137295
|
var fs35 = __toESM(require("node:fs/promises"));
|
|
136995
137296
|
init_src();
|
|
136996
137297
|
var import_yaml = __toESM(require_dist5());
|
|
136997
137298
|
init_src();
|
|
136998
|
-
var FLOWS_DIR_NAME =
|
|
137299
|
+
var FLOWS_DIR_NAME = path27.join(".argent", "flows");
|
|
136999
137300
|
var activeFlowName = null;
|
|
137000
137301
|
var activeProjectRoot = null;
|
|
137001
137302
|
var recordingSession = null;
|
|
137002
137303
|
function setActiveProjectRoot(root2) {
|
|
137003
|
-
if (!
|
|
137304
|
+
if (!path27.isAbsolute(root2)) {
|
|
137004
137305
|
throw new FailureError(
|
|
137005
137306
|
`project_root must be an absolute path (got "${root2}"). Pass the absolute path to the project root directory \u2014 the same cwd the calling agent is working in.`,
|
|
137006
137307
|
{
|
|
@@ -137031,7 +137332,7 @@ function requireActiveProjectRoot() {
|
|
|
137031
137332
|
return activeProjectRoot;
|
|
137032
137333
|
}
|
|
137033
137334
|
function getFlowsDir() {
|
|
137034
|
-
return
|
|
137335
|
+
return path27.join(requireActiveProjectRoot(), FLOWS_DIR_NAME);
|
|
137035
137336
|
}
|
|
137036
137337
|
var FLOW_NAME_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
137037
137338
|
function assertSafeFlowName(name) {
|
|
@@ -137043,9 +137344,9 @@ function assertSafeFlowName(name) {
|
|
|
137043
137344
|
}
|
|
137044
137345
|
function getFlowPath(name) {
|
|
137045
137346
|
assertSafeFlowName(name);
|
|
137046
|
-
const filePath =
|
|
137047
|
-
const rel =
|
|
137048
|
-
if (rel.startsWith("..") ||
|
|
137347
|
+
const filePath = path27.join(getFlowsDir(), `${name}.yaml`);
|
|
137348
|
+
const rel = path27.relative(getFlowsDir(), filePath);
|
|
137349
|
+
if (rel.startsWith("..") || path27.isAbsolute(rel)) {
|
|
137049
137350
|
throw new Error(`Invalid flow name "${name}": resolves outside the flows directory.`);
|
|
137050
137351
|
}
|
|
137051
137352
|
return filePath;
|
|
@@ -137467,42 +137768,42 @@ init_zod();
|
|
|
137467
137768
|
// ../tool-server/src/utils/workspace-reader.ts
|
|
137468
137769
|
var import_promises9 = require("node:fs/promises");
|
|
137469
137770
|
var import_node_path15 = require("node:path");
|
|
137470
|
-
var
|
|
137771
|
+
var import_node_child_process24 = require("node:child_process");
|
|
137471
137772
|
var import_dotenv = __toESM(require_main());
|
|
137472
|
-
async function exists(
|
|
137773
|
+
async function exists(path31) {
|
|
137473
137774
|
try {
|
|
137474
|
-
await (0, import_promises9.access)(
|
|
137775
|
+
await (0, import_promises9.access)(path31);
|
|
137475
137776
|
return true;
|
|
137476
137777
|
} catch {
|
|
137477
137778
|
return false;
|
|
137478
137779
|
}
|
|
137479
137780
|
}
|
|
137480
|
-
async function isDirectory(
|
|
137781
|
+
async function isDirectory(path31) {
|
|
137481
137782
|
try {
|
|
137482
|
-
const s = await (0, import_promises9.stat)(
|
|
137783
|
+
const s = await (0, import_promises9.stat)(path31);
|
|
137483
137784
|
return s.isDirectory();
|
|
137484
137785
|
} catch {
|
|
137485
137786
|
return false;
|
|
137486
137787
|
}
|
|
137487
137788
|
}
|
|
137488
|
-
async function readJsonFile(
|
|
137789
|
+
async function readJsonFile(path31) {
|
|
137489
137790
|
try {
|
|
137490
|
-
const raw = await (0, import_promises9.readFile)(
|
|
137791
|
+
const raw = await (0, import_promises9.readFile)(path31, "utf-8");
|
|
137491
137792
|
return JSON.parse(raw);
|
|
137492
137793
|
} catch {
|
|
137493
137794
|
return null;
|
|
137494
137795
|
}
|
|
137495
137796
|
}
|
|
137496
|
-
async function readTextFile(
|
|
137797
|
+
async function readTextFile(path31) {
|
|
137497
137798
|
try {
|
|
137498
|
-
return await (0, import_promises9.readFile)(
|
|
137799
|
+
return await (0, import_promises9.readFile)(path31, "utf-8");
|
|
137499
137800
|
} catch {
|
|
137500
137801
|
return null;
|
|
137501
137802
|
}
|
|
137502
137803
|
}
|
|
137503
|
-
async function listDir(
|
|
137804
|
+
async function listDir(path31) {
|
|
137504
137805
|
try {
|
|
137505
|
-
const entries = await (0, import_promises9.readdir)(
|
|
137806
|
+
const entries = await (0, import_promises9.readdir)(path31);
|
|
137506
137807
|
return entries;
|
|
137507
137808
|
} catch {
|
|
137508
137809
|
return null;
|
|
@@ -137511,7 +137812,7 @@ async function listDir(path30) {
|
|
|
137511
137812
|
var COMMAND_TIMEOUT_MS = 3e3;
|
|
137512
137813
|
function runVersionCommand(cmd, args, cwd) {
|
|
137513
137814
|
return new Promise((resolve5) => {
|
|
137514
|
-
const child = (0,
|
|
137815
|
+
const child = (0, import_node_child_process24.execFile)(cmd, args, { cwd, timeout: COMMAND_TIMEOUT_MS }, (err, stdout) => {
|
|
137515
137816
|
if (err) {
|
|
137516
137817
|
resolve5(null);
|
|
137517
137818
|
return;
|
|
@@ -137795,7 +138096,7 @@ Fails if the workspacePath is not an absolute path or the directory cannot be ac
|
|
|
137795
138096
|
};
|
|
137796
138097
|
|
|
137797
138098
|
// ../tool-server/src/tools/system/update-argent.ts
|
|
137798
|
-
var
|
|
138099
|
+
var import_node_child_process25 = require("node:child_process");
|
|
137799
138100
|
var updateScheduled = false;
|
|
137800
138101
|
var updateArgentTool = {
|
|
137801
138102
|
id: "update-argent",
|
|
@@ -137825,7 +138126,7 @@ var updateArgentTool = {
|
|
|
137825
138126
|
}
|
|
137826
138127
|
updateScheduled = true;
|
|
137827
138128
|
setTimeout(() => {
|
|
137828
|
-
const child = (0,
|
|
138129
|
+
const child = (0, import_node_child_process25.spawn)("argent", ["update", "--yes", "--version", installableVersion], {
|
|
137829
138130
|
detached: true,
|
|
137830
138131
|
stdio: "ignore",
|
|
137831
138132
|
env: { ...process.env, ARGENT_UPDATE_TRIGGER: "mcp_update" }
|
|
@@ -137872,7 +138173,7 @@ var import_pngjs2 = __toESM(require_png());
|
|
|
137872
138173
|
// ../tool-server/src/tools/screenshot-diff/screenshot-diff-ocr.ts
|
|
137873
138174
|
var import_child_process6 = require("child_process");
|
|
137874
138175
|
var import_util7 = require("util");
|
|
137875
|
-
var
|
|
138176
|
+
var execFileAsync18 = (0, import_util7.promisify)(import_child_process6.execFile);
|
|
137876
138177
|
var OCR_TIMEOUT_MS = 1e4;
|
|
137877
138178
|
var OCR_MAX_BUFFER_BYTES = 32 * 1024 * 1024;
|
|
137878
138179
|
var TESSERACT_BINARY = "tesseract";
|
|
@@ -137917,7 +138218,7 @@ async function extractOcrTextBlocks(imagePath) {
|
|
|
137917
138218
|
}
|
|
137918
138219
|
}
|
|
137919
138220
|
async function recognizeTsv(imagePath) {
|
|
137920
|
-
const { stdout } = await
|
|
138221
|
+
const { stdout } = await execFileAsync18(
|
|
137921
138222
|
TESSERACT_BINARY,
|
|
137922
138223
|
[
|
|
137923
138224
|
imagePath,
|
|
@@ -140153,8 +140454,10 @@ native window that opens automatically) as a floating card beside the streamed s
|
|
|
140153
140454
|
line connecting it to the matched on-screen element; you don't open or display anything yourself. Pass
|
|
140154
140455
|
variant.previewImage (e.g. a screenshot path) to show how each variant looks.
|
|
140155
140456
|
|
|
140156
|
-
When you have proposed every variant for every element,
|
|
140157
|
-
the
|
|
140457
|
+
When you have proposed every variant for every element, you are done staging \u2014 the human reviews them
|
|
140458
|
+
in the Argent Lens window and sends back their picks and comments. If an \`await_user_selection\` tool
|
|
140459
|
+
is available, call it once to block until they submit; otherwise just end your turn and their feedback
|
|
140460
|
+
arrives as a follow-up message (this is the case in an \`argent lens\` CLI session).
|
|
140158
140461
|
|
|
140159
140462
|
Returns { round, elementId, variantId, element, variantCount, totalElements } \u2014 confirmation only;
|
|
140160
140463
|
it does not wait for the user.`,
|
|
@@ -140172,9 +140475,10 @@ it does not wait for the user.`,
|
|
|
140172
140475
|
...params,
|
|
140173
140476
|
variant: { ...params.variant, frame }
|
|
140174
140477
|
});
|
|
140478
|
+
const finish = variantProposalStore.isCliSession() ? "end your turn \u2014 the user's feedback will arrive as a message" : "call await_user_selection once";
|
|
140175
140479
|
return {
|
|
140176
140480
|
...res,
|
|
140177
|
-
hint: res.variantCount === 1 ? `Staged the first variant for "${res.element}". Propose more variants (for this or other elements), then
|
|
140481
|
+
hint: res.variantCount === 1 ? `Staged the first variant for "${res.element}". Propose more variants (for this or other elements), then ${finish} when done.` : `"${res.element}" now has ${res.variantCount} variants. Keep proposing, then ${finish} when every element is covered.`
|
|
140178
140482
|
};
|
|
140179
140483
|
}
|
|
140180
140484
|
};
|
|
@@ -140190,6 +140494,12 @@ var zodSchema66 = external_exports.object({
|
|
|
140190
140494
|
var awaitUserSelectionTool = {
|
|
140191
140495
|
id: "await_user_selection",
|
|
140192
140496
|
featureFlag: "argent-lens",
|
|
140497
|
+
// Hidden entirely while an `argent lens` CLI session owns the preview window:
|
|
140498
|
+
// there, the user's picks are relayed into the agent's terminal as a normal
|
|
140499
|
+
// message (see `argent-cli/src/lens.ts`), so the agent never blocks on a pick.
|
|
140500
|
+
// Hiding the tool (rather than telling the agent "don't call it") keeps the
|
|
140501
|
+
// CLI-relay surface honest — propose_variant then end the turn.
|
|
140502
|
+
hideWhen: () => variantProposalStore.isCliSession(),
|
|
140193
140503
|
description: `Block until the human finishes picking among the variants you proposed (the ONE blocking call).
|
|
140194
140504
|
|
|
140195
140505
|
Call this exactly once, AFTER you have staged every variant for every element via \`propose_variant\`.
|
|
@@ -140560,18 +140870,20 @@ function createRegistry() {
|
|
|
140560
140870
|
registry2.registerTool(createRunFlowTool(registry2));
|
|
140561
140871
|
registry2.registerTool(updateArgentTool);
|
|
140562
140872
|
registry2.registerTool(dismissUpdateTool);
|
|
140563
|
-
|
|
140564
|
-
|
|
140873
|
+
if (process.platform === "darwin") {
|
|
140874
|
+
registry2.registerTool(createProposeVariantTool(registry2));
|
|
140875
|
+
registry2.registerTool(awaitUserSelectionTool);
|
|
140876
|
+
}
|
|
140565
140877
|
return registry2;
|
|
140566
140878
|
}
|
|
140567
140879
|
|
|
140568
140880
|
// ../tool-server/src/utils/simulator-watcher.ts
|
|
140569
|
-
var
|
|
140570
|
-
var
|
|
140571
|
-
var
|
|
140881
|
+
var import_node_child_process26 = require("node:child_process");
|
|
140882
|
+
var import_node_util18 = require("node:util");
|
|
140883
|
+
var execFileAsync19 = (0, import_node_util18.promisify)(import_node_child_process26.execFile);
|
|
140572
140884
|
var POLL_INTERVAL_MS = 1e4;
|
|
140573
140885
|
async function getBootedUdids() {
|
|
140574
|
-
const { stdout } = await
|
|
140886
|
+
const { stdout } = await execFileAsync19("xcrun", ["simctl", "list", "devices", "--json"]);
|
|
140575
140887
|
const data = JSON.parse(stdout);
|
|
140576
140888
|
const udids = /* @__PURE__ */ new Set();
|
|
140577
140889
|
for (const devices of Object.values(data.devices)) {
|
|
@@ -140628,42 +140940,42 @@ function startSimulatorWatcher(registry2) {
|
|
|
140628
140940
|
}
|
|
140629
140941
|
|
|
140630
140942
|
// ../tool-server/src/utils/preview-window.ts
|
|
140631
|
-
var
|
|
140943
|
+
var import_node_child_process27 = require("node:child_process");
|
|
140632
140944
|
var fs42 = __toESM(require("node:fs"));
|
|
140633
140945
|
var os11 = __toESM(require("node:os"));
|
|
140634
|
-
var
|
|
140946
|
+
var path30 = __toESM(require("node:path"));
|
|
140635
140947
|
function ensureLensAppBundle(electronBin) {
|
|
140636
140948
|
if (process.platform !== "darwin") return null;
|
|
140637
140949
|
try {
|
|
140638
140950
|
const realApp = electronBin.replace(/\/Contents\/MacOS\/[^/]+$/, "");
|
|
140639
140951
|
if (!realApp.endsWith(".app")) return null;
|
|
140640
|
-
const realContents =
|
|
140641
|
-
const wrapperContents =
|
|
140952
|
+
const realContents = path30.join(realApp, "Contents");
|
|
140953
|
+
const wrapperContents = path30.join(
|
|
140642
140954
|
os11.tmpdir(),
|
|
140643
140955
|
"argent-lens-app",
|
|
140644
140956
|
"Argent Lens.app",
|
|
140645
140957
|
"Contents"
|
|
140646
140958
|
);
|
|
140647
|
-
const wrapperExec =
|
|
140959
|
+
const wrapperExec = path30.join(wrapperContents, "MacOS", "Electron");
|
|
140648
140960
|
try {
|
|
140649
140961
|
if (fs42.realpathSync(wrapperExec) === fs42.realpathSync(electronBin)) return wrapperExec;
|
|
140650
140962
|
} catch {
|
|
140651
140963
|
}
|
|
140652
|
-
fs42.rmSync(
|
|
140653
|
-
fs42.mkdirSync(
|
|
140654
|
-
fs42.symlinkSync(
|
|
140655
|
-
fs42.symlinkSync(
|
|
140964
|
+
fs42.rmSync(path30.dirname(wrapperContents), { recursive: true, force: true });
|
|
140965
|
+
fs42.mkdirSync(path30.join(wrapperContents, "MacOS"), { recursive: true });
|
|
140966
|
+
fs42.symlinkSync(path30.join(realContents, "Frameworks"), path30.join(wrapperContents, "Frameworks"));
|
|
140967
|
+
fs42.symlinkSync(path30.join(realContents, "Resources"), path30.join(wrapperContents, "Resources"));
|
|
140656
140968
|
fs42.symlinkSync(electronBin, wrapperExec);
|
|
140657
|
-
const pkgInfo =
|
|
140658
|
-
if (fs42.existsSync(pkgInfo)) fs42.copyFileSync(pkgInfo,
|
|
140659
|
-
const plist =
|
|
140660
|
-
fs42.copyFileSync(
|
|
140969
|
+
const pkgInfo = path30.join(realContents, "PkgInfo");
|
|
140970
|
+
if (fs42.existsSync(pkgInfo)) fs42.copyFileSync(pkgInfo, path30.join(wrapperContents, "PkgInfo"));
|
|
140971
|
+
const plist = path30.join(wrapperContents, "Info.plist");
|
|
140972
|
+
fs42.copyFileSync(path30.join(realContents, "Info.plist"), plist);
|
|
140661
140973
|
const setPlist = (entry, value) => {
|
|
140662
140974
|
try {
|
|
140663
|
-
(0,
|
|
140975
|
+
(0, import_node_child_process27.execFileSync)("/usr/libexec/PlistBuddy", ["-c", `Set :${entry} ${value}`, plist]);
|
|
140664
140976
|
} catch {
|
|
140665
140977
|
try {
|
|
140666
|
-
(0,
|
|
140978
|
+
(0, import_node_child_process27.execFileSync)("/usr/libexec/PlistBuddy", ["-c", `Add :${entry} string ${value}`, plist]);
|
|
140667
140979
|
} catch {
|
|
140668
140980
|
}
|
|
140669
140981
|
}
|
|
@@ -140698,7 +141010,7 @@ function createPreviewWindowManager(opts = {}) {
|
|
|
140698
141010
|
};
|
|
140699
141011
|
const resolveMainScript = () => {
|
|
140700
141012
|
if (opts.mainScript) return opts.mainScript;
|
|
140701
|
-
const bundled =
|
|
141013
|
+
const bundled = path30.join(__dirname, "preview-window", "main.cjs");
|
|
140702
141014
|
if (fs42.existsSync(bundled)) return bundled;
|
|
140703
141015
|
return require.resolve("@argent/preview-window/dist/main.js");
|
|
140704
141016
|
};
|
|
@@ -140722,7 +141034,7 @@ function createPreviewWindowManager(opts = {}) {
|
|
|
140722
141034
|
const wrapperBin = ensureLensAppBundle(electronBin);
|
|
140723
141035
|
const launchBin = wrapperBin ?? electronBin;
|
|
140724
141036
|
const launchArgs = wrapperBin ? ["--no-sandbox", mainScript] : [mainScript];
|
|
140725
|
-
const next = (0,
|
|
141037
|
+
const next = (0, import_node_child_process27.spawn)(launchBin, launchArgs, {
|
|
140726
141038
|
env: { ...process.env, ARGENT_PREVIEW_URL: url2 },
|
|
140727
141039
|
stdio: ["pipe", "ignore", "pipe"]
|
|
140728
141040
|
});
|
|
@@ -140865,20 +141177,42 @@ function start() {
|
|
|
140865
141177
|
};
|
|
140866
141178
|
const onSelectionSubmitted = () => {
|
|
140867
141179
|
cancelPendingClose();
|
|
141180
|
+
if (variantProposalStore.isCliSession()) return;
|
|
140868
141181
|
pendingCloseTimer = setTimeout(() => {
|
|
140869
141182
|
pendingCloseTimer = null;
|
|
140870
141183
|
previewWindow.requestClose();
|
|
140871
141184
|
}, PREVIEW_CLOSE_DELAY_MS);
|
|
140872
141185
|
};
|
|
141186
|
+
const onCliSessionChanged = (active) => {
|
|
141187
|
+
cancelPendingClose();
|
|
141188
|
+
if (active) {
|
|
141189
|
+
const url2 = previewWindowBaseUrl();
|
|
141190
|
+
if (url2) previewWindow.ensureOpen(url2);
|
|
141191
|
+
} else {
|
|
141192
|
+
previewWindow.requestClose();
|
|
141193
|
+
const owned = variantProposalStore.takeOwnedDevices();
|
|
141194
|
+
if (owned.length) {
|
|
141195
|
+
void shutdownOwnedDevices(owned).catch(() => {
|
|
141196
|
+
});
|
|
141197
|
+
}
|
|
141198
|
+
}
|
|
141199
|
+
};
|
|
140873
141200
|
variantProposalStore.events.on("awaitParked", onAwaitParked);
|
|
140874
141201
|
variantProposalStore.events.on("selectionSubmitted", onSelectionSubmitted);
|
|
141202
|
+
variantProposalStore.events.on("cliSessionChanged", onCliSessionChanged);
|
|
140875
141203
|
shutdown2 = async (exitCode = 0) => {
|
|
140876
141204
|
if (exitCode > finalExitCode) finalExitCode = exitCode;
|
|
140877
141205
|
if (shuttingDown) return;
|
|
140878
141206
|
shuttingDown = true;
|
|
140879
141207
|
variantProposalStore.events.off("awaitParked", onAwaitParked);
|
|
140880
141208
|
variantProposalStore.events.off("selectionSubmitted", onSelectionSubmitted);
|
|
141209
|
+
variantProposalStore.events.off("cliSessionChanged", onCliSessionChanged);
|
|
140881
141210
|
cancelPendingClose();
|
|
141211
|
+
const ownedDevices = variantProposalStore.takeOwnedDevices();
|
|
141212
|
+
if (ownedDevices.length) {
|
|
141213
|
+
await shutdownOwnedDevices(ownedDevices).catch(() => {
|
|
141214
|
+
});
|
|
141215
|
+
}
|
|
140882
141216
|
previewWindow.dispose();
|
|
140883
141217
|
updateChecker.dispose();
|
|
140884
141218
|
stopWatcher();
|