@swmansion/argent 0.34.1-next.1 → 0.34.1-next.3
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 +14 -3
- package/dist/client.js +13 -2
- package/dist/installer.mjs +5 -1
- package/dist/mcp-server.mjs +13 -2
- package/dist/tool-server.cjs +241 -76
- package/package.json +1 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -10552,6 +10552,10 @@ var FAILURE_CODES = {
|
|
|
10552
10552
|
AX_DAEMON_READY_TIMEOUT: "AX_DAEMON_READY_TIMEOUT",
|
|
10553
10553
|
AX_DAEMON_EXITED_BEFORE_READY: "AX_DAEMON_EXITED_BEFORE_READY",
|
|
10554
10554
|
AX_DAEMON_PROCESS_ERROR: "AX_DAEMON_PROCESS_ERROR",
|
|
10555
|
+
// The daemon died on a fault signal (SIGSEGV, SIGABRT, ...), before or after
|
|
10556
|
+
// it connected. Kept apart from the two codes above so a crash is not read
|
|
10557
|
+
// as an ordinary exit.
|
|
10558
|
+
AX_DAEMON_CRASHED: "AX_DAEMON_CRASHED",
|
|
10555
10559
|
AX_FACTORY_OPTIONS_MISSING: "AX_FACTORY_OPTIONS_MISSING",
|
|
10556
10560
|
AX_WRONG_PLATFORM: "AX_WRONG_PLATFORM",
|
|
10557
10561
|
AX_DEVICE_ID_INVALID: "AX_DEVICE_ID_INVALID",
|
|
@@ -31186,17 +31190,24 @@ function uploadFailure(url2, res, text2, bytes) {
|
|
|
31186
31190
|
}
|
|
31187
31191
|
async function uploadTar(tarPath, format, endpoint, signal) {
|
|
31188
31192
|
const { size } = await stat3(tarPath);
|
|
31193
|
+
const stream = createReadStream2(tarPath);
|
|
31189
31194
|
const init2 = {
|
|
31190
31195
|
method: "POST",
|
|
31191
31196
|
headers: {
|
|
31192
31197
|
"content-type": ARCHIVE_CONTENT_TYPES[format],
|
|
31193
31198
|
...endpoint.token ? { Authorization: `Bearer ${endpoint.token}` } : {}
|
|
31194
31199
|
},
|
|
31195
|
-
body:
|
|
31200
|
+
body: stream,
|
|
31196
31201
|
duplex: "half",
|
|
31197
31202
|
signal
|
|
31198
31203
|
};
|
|
31199
|
-
|
|
31204
|
+
let res;
|
|
31205
|
+
try {
|
|
31206
|
+
res = await fetch(`${endpoint.url}/upload`, init2);
|
|
31207
|
+
} catch (err) {
|
|
31208
|
+
stream.destroy();
|
|
31209
|
+
throw err;
|
|
31210
|
+
}
|
|
31200
31211
|
if (!res.ok) {
|
|
31201
31212
|
let text2 = "";
|
|
31202
31213
|
try {
|
|
@@ -36074,7 +36085,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
36074
36085
|
var SESSION_ID2 = randomUUID5();
|
|
36075
36086
|
function readCliVersion() {
|
|
36076
36087
|
if (true) {
|
|
36077
|
-
return "0.34.1-next.
|
|
36088
|
+
return "0.34.1-next.3";
|
|
36078
36089
|
}
|
|
36079
36090
|
return "0.0.0";
|
|
36080
36091
|
}
|
package/dist/client.js
CHANGED
|
@@ -9125,6 +9125,10 @@ var FAILURE_CODES = {
|
|
|
9125
9125
|
AX_DAEMON_READY_TIMEOUT: "AX_DAEMON_READY_TIMEOUT",
|
|
9126
9126
|
AX_DAEMON_EXITED_BEFORE_READY: "AX_DAEMON_EXITED_BEFORE_READY",
|
|
9127
9127
|
AX_DAEMON_PROCESS_ERROR: "AX_DAEMON_PROCESS_ERROR",
|
|
9128
|
+
// The daemon died on a fault signal (SIGSEGV, SIGABRT, ...), before or after
|
|
9129
|
+
// it connected. Kept apart from the two codes above so a crash is not read
|
|
9130
|
+
// as an ordinary exit.
|
|
9131
|
+
AX_DAEMON_CRASHED: "AX_DAEMON_CRASHED",
|
|
9128
9132
|
AX_FACTORY_OPTIONS_MISSING: "AX_FACTORY_OPTIONS_MISSING",
|
|
9129
9133
|
AX_WRONG_PLATFORM: "AX_WRONG_PLATFORM",
|
|
9130
9134
|
AX_DEVICE_ID_INVALID: "AX_DEVICE_ID_INVALID",
|
|
@@ -9932,17 +9936,24 @@ function uploadFailure(url, res, text, bytes) {
|
|
|
9932
9936
|
}
|
|
9933
9937
|
async function uploadTar(tarPath, format, endpoint, signal) {
|
|
9934
9938
|
const { size } = await stat3(tarPath);
|
|
9939
|
+
const stream = createReadStream2(tarPath);
|
|
9935
9940
|
const init = {
|
|
9936
9941
|
method: "POST",
|
|
9937
9942
|
headers: {
|
|
9938
9943
|
"content-type": ARCHIVE_CONTENT_TYPES[format],
|
|
9939
9944
|
...endpoint.token ? { Authorization: `Bearer ${endpoint.token}` } : {}
|
|
9940
9945
|
},
|
|
9941
|
-
body:
|
|
9946
|
+
body: stream,
|
|
9942
9947
|
duplex: "half",
|
|
9943
9948
|
signal
|
|
9944
9949
|
};
|
|
9945
|
-
|
|
9950
|
+
let res;
|
|
9951
|
+
try {
|
|
9952
|
+
res = await fetch(`${endpoint.url}/upload`, init);
|
|
9953
|
+
} catch (err) {
|
|
9954
|
+
stream.destroy();
|
|
9955
|
+
throw err;
|
|
9956
|
+
}
|
|
9946
9957
|
if (!res.ok) {
|
|
9947
9958
|
let text = "";
|
|
9948
9959
|
try {
|
package/dist/installer.mjs
CHANGED
|
@@ -15884,6 +15884,10 @@ var FAILURE_CODES = {
|
|
|
15884
15884
|
AX_DAEMON_READY_TIMEOUT: "AX_DAEMON_READY_TIMEOUT",
|
|
15885
15885
|
AX_DAEMON_EXITED_BEFORE_READY: "AX_DAEMON_EXITED_BEFORE_READY",
|
|
15886
15886
|
AX_DAEMON_PROCESS_ERROR: "AX_DAEMON_PROCESS_ERROR",
|
|
15887
|
+
// The daemon died on a fault signal (SIGSEGV, SIGABRT, ...), before or after
|
|
15888
|
+
// it connected. Kept apart from the two codes above so a crash is not read
|
|
15889
|
+
// as an ordinary exit.
|
|
15890
|
+
AX_DAEMON_CRASHED: "AX_DAEMON_CRASHED",
|
|
15887
15891
|
AX_FACTORY_OPTIONS_MISSING: "AX_FACTORY_OPTIONS_MISSING",
|
|
15888
15892
|
AX_WRONG_PLATFORM: "AX_WRONG_PLATFORM",
|
|
15889
15893
|
AX_DEVICE_ID_INVALID: "AX_DEVICE_ID_INVALID",
|
|
@@ -16989,7 +16993,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
16989
16993
|
var SESSION_ID = randomUUID4();
|
|
16990
16994
|
function readCliVersion() {
|
|
16991
16995
|
if (true) {
|
|
16992
|
-
return "0.34.1-next.
|
|
16996
|
+
return "0.34.1-next.3";
|
|
16993
16997
|
}
|
|
16994
16998
|
return "0.0.0";
|
|
16995
16999
|
}
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -25835,6 +25835,10 @@ var FAILURE_CODES = {
|
|
|
25835
25835
|
AX_DAEMON_READY_TIMEOUT: "AX_DAEMON_READY_TIMEOUT",
|
|
25836
25836
|
AX_DAEMON_EXITED_BEFORE_READY: "AX_DAEMON_EXITED_BEFORE_READY",
|
|
25837
25837
|
AX_DAEMON_PROCESS_ERROR: "AX_DAEMON_PROCESS_ERROR",
|
|
25838
|
+
// The daemon died on a fault signal (SIGSEGV, SIGABRT, ...), before or after
|
|
25839
|
+
// it connected. Kept apart from the two codes above so a crash is not read
|
|
25840
|
+
// as an ordinary exit.
|
|
25841
|
+
AX_DAEMON_CRASHED: "AX_DAEMON_CRASHED",
|
|
25838
25842
|
AX_FACTORY_OPTIONS_MISSING: "AX_FACTORY_OPTIONS_MISSING",
|
|
25839
25843
|
AX_WRONG_PLATFORM: "AX_WRONG_PLATFORM",
|
|
25840
25844
|
AX_DEVICE_ID_INVALID: "AX_DEVICE_ID_INVALID",
|
|
@@ -26686,17 +26690,24 @@ function uploadFailure(url, res, text, bytes) {
|
|
|
26686
26690
|
}
|
|
26687
26691
|
async function uploadTar(tarPath, format, endpoint, signal) {
|
|
26688
26692
|
const { size } = await stat3(tarPath);
|
|
26693
|
+
const stream = createReadStream2(tarPath);
|
|
26689
26694
|
const init = {
|
|
26690
26695
|
method: "POST",
|
|
26691
26696
|
headers: {
|
|
26692
26697
|
"content-type": ARCHIVE_CONTENT_TYPES[format],
|
|
26693
26698
|
...endpoint.token ? { Authorization: `Bearer ${endpoint.token}` } : {}
|
|
26694
26699
|
},
|
|
26695
|
-
body:
|
|
26700
|
+
body: stream,
|
|
26696
26701
|
duplex: "half",
|
|
26697
26702
|
signal
|
|
26698
26703
|
};
|
|
26699
|
-
|
|
26704
|
+
let res;
|
|
26705
|
+
try {
|
|
26706
|
+
res = await fetch(`${endpoint.url}/upload`, init);
|
|
26707
|
+
} catch (err) {
|
|
26708
|
+
stream.destroy();
|
|
26709
|
+
throw err;
|
|
26710
|
+
}
|
|
26700
26711
|
if (!res.ok) {
|
|
26701
26712
|
let text = "";
|
|
26702
26713
|
try {
|
package/dist/tool-server.cjs
CHANGED
|
@@ -1595,6 +1595,10 @@ var init_failure_codes = __esm({
|
|
|
1595
1595
|
AX_DAEMON_READY_TIMEOUT: "AX_DAEMON_READY_TIMEOUT",
|
|
1596
1596
|
AX_DAEMON_EXITED_BEFORE_READY: "AX_DAEMON_EXITED_BEFORE_READY",
|
|
1597
1597
|
AX_DAEMON_PROCESS_ERROR: "AX_DAEMON_PROCESS_ERROR",
|
|
1598
|
+
// The daemon died on a fault signal (SIGSEGV, SIGABRT, ...), before or after
|
|
1599
|
+
// it connected. Kept apart from the two codes above so a crash is not read
|
|
1600
|
+
// as an ordinary exit.
|
|
1601
|
+
AX_DAEMON_CRASHED: "AX_DAEMON_CRASHED",
|
|
1598
1602
|
AX_FACTORY_OPTIONS_MISSING: "AX_FACTORY_OPTIONS_MISSING",
|
|
1599
1603
|
AX_WRONG_PLATFORM: "AX_WRONG_PLATFORM",
|
|
1600
1604
|
AX_DEVICE_ID_INVALID: "AX_DEVICE_ID_INVALID",
|
|
@@ -101281,7 +101285,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
101281
101285
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
101282
101286
|
function readCliVersion() {
|
|
101283
101287
|
if (true) {
|
|
101284
|
-
return "0.34.1-next.
|
|
101288
|
+
return "0.34.1-next.3";
|
|
101285
101289
|
}
|
|
101286
101290
|
return "0.0.0";
|
|
101287
101291
|
}
|
|
@@ -104695,7 +104699,112 @@ function startListener(endpoint, onConnection) {
|
|
|
104695
104699
|
}
|
|
104696
104700
|
});
|
|
104697
104701
|
}
|
|
104698
|
-
|
|
104702
|
+
var DARWIN_SIGNALS = {
|
|
104703
|
+
1: "SIGHUP",
|
|
104704
|
+
2: "SIGINT",
|
|
104705
|
+
3: "SIGQUIT",
|
|
104706
|
+
4: "SIGILL",
|
|
104707
|
+
5: "SIGTRAP",
|
|
104708
|
+
6: "SIGABRT",
|
|
104709
|
+
7: "SIGEMT",
|
|
104710
|
+
8: "SIGFPE",
|
|
104711
|
+
9: "SIGKILL",
|
|
104712
|
+
10: "SIGBUS",
|
|
104713
|
+
11: "SIGSEGV",
|
|
104714
|
+
12: "SIGSYS",
|
|
104715
|
+
13: "SIGPIPE",
|
|
104716
|
+
14: "SIGALRM",
|
|
104717
|
+
15: "SIGTERM"
|
|
104718
|
+
};
|
|
104719
|
+
var FAULT_SIGNALS = /* @__PURE__ */ new Set([
|
|
104720
|
+
"SIGILL",
|
|
104721
|
+
"SIGTRAP",
|
|
104722
|
+
"SIGABRT",
|
|
104723
|
+
"SIGEMT",
|
|
104724
|
+
"SIGFPE",
|
|
104725
|
+
"SIGBUS",
|
|
104726
|
+
"SIGSEGV",
|
|
104727
|
+
"SIGSYS"
|
|
104728
|
+
]);
|
|
104729
|
+
var SIMCTL_CHILD_SIGNAL = /Child process terminated with signal (\d+)/;
|
|
104730
|
+
var STDERR_DRAIN_MS = 250;
|
|
104731
|
+
var STDERR_TAIL_CHARS = 4e3;
|
|
104732
|
+
var DAEMON_EXIT_GRACE_MS = 1e3;
|
|
104733
|
+
function readAxDaemonExit(code, signal, stderr) {
|
|
104734
|
+
if (signal) return { code, signal };
|
|
104735
|
+
const reported = SIMCTL_CHILD_SIGNAL.exec(stderr);
|
|
104736
|
+
if (!reported) return { code };
|
|
104737
|
+
const number4 = Number(reported[1]);
|
|
104738
|
+
return { code, signal: DARWIN_SIGNALS[number4] ?? `signal ${number4}` };
|
|
104739
|
+
}
|
|
104740
|
+
var AxDaemonCrashError = class extends FailureError {
|
|
104741
|
+
signalName;
|
|
104742
|
+
constructor(message, signal, signalName) {
|
|
104743
|
+
super(message, signal);
|
|
104744
|
+
this.name = "AxDaemonCrashError";
|
|
104745
|
+
this.signalName = signalName;
|
|
104746
|
+
}
|
|
104747
|
+
};
|
|
104748
|
+
function findInCauses(err, pick2) {
|
|
104749
|
+
let current = err;
|
|
104750
|
+
for (let depth = 0; current instanceof Error && depth < 8; depth++) {
|
|
104751
|
+
const found = pick2(current);
|
|
104752
|
+
if (found !== void 0) return found;
|
|
104753
|
+
current = current.cause;
|
|
104754
|
+
}
|
|
104755
|
+
return void 0;
|
|
104756
|
+
}
|
|
104757
|
+
function axDaemonCrashSignal(err) {
|
|
104758
|
+
return findInCauses(
|
|
104759
|
+
err,
|
|
104760
|
+
(error63) => error63 instanceof AxDaemonCrashError ? error63.signalName : void 0
|
|
104761
|
+
);
|
|
104762
|
+
}
|
|
104763
|
+
var startFailureDegraded = /* @__PURE__ */ new WeakMap();
|
|
104764
|
+
function axStartFailureDegraded(err) {
|
|
104765
|
+
return findInCauses(err, (error63) => startFailureDegraded.get(error63));
|
|
104766
|
+
}
|
|
104767
|
+
function axDaemonExitError(exit, phase) {
|
|
104768
|
+
const suffix = phase === "connecting" ? " before connecting" : "";
|
|
104769
|
+
const signal = {
|
|
104770
|
+
error_code: phase === "connecting" ? FAILURE_CODES.AX_DAEMON_EXITED_BEFORE_READY : FAILURE_CODES.AX_DAEMON_PROCESS_ERROR,
|
|
104771
|
+
failure_stage: phase === "connecting" ? "ax_service_spawn_ready" : "ax_service_process_exit",
|
|
104772
|
+
failure_area: "tool_server",
|
|
104773
|
+
error_kind: "subprocess",
|
|
104774
|
+
...subprocessFailureMetadata(exit, "ax_service")
|
|
104775
|
+
};
|
|
104776
|
+
if (exit.signal === void 0) {
|
|
104777
|
+
return new FailureError(`ax-service exited with code ${exit.code}${suffix}`, signal);
|
|
104778
|
+
}
|
|
104779
|
+
if (!FAULT_SIGNALS.has(exit.signal)) {
|
|
104780
|
+
return new FailureError(`ax-service was killed by ${exit.signal}${suffix}`, signal);
|
|
104781
|
+
}
|
|
104782
|
+
return new AxDaemonCrashError(
|
|
104783
|
+
`ax-service crashed with ${exit.signal}${suffix}`,
|
|
104784
|
+
{ ...signal, error_code: FAILURE_CODES.AX_DAEMON_CRASHED },
|
|
104785
|
+
exit.signal
|
|
104786
|
+
);
|
|
104787
|
+
}
|
|
104788
|
+
function watchDaemonExit(proc, onExit) {
|
|
104789
|
+
return new Promise((resolve19) => {
|
|
104790
|
+
let stderrTail = "";
|
|
104791
|
+
proc.stderr?.on("data", (chunk) => {
|
|
104792
|
+
stderrTail = (stderrTail + chunk.toString()).slice(-STDERR_TAIL_CHARS);
|
|
104793
|
+
});
|
|
104794
|
+
proc.once("exit", (code, signal) => {
|
|
104795
|
+
onExit();
|
|
104796
|
+
const settle3 = () => resolve19(readAxDaemonExit(code, signal, stderrTail));
|
|
104797
|
+
const stderr = proc.stderr;
|
|
104798
|
+
if (signal || !stderr || stderr.readableEnded) return settle3();
|
|
104799
|
+
const timer = setTimeout(settle3, STDERR_DRAIN_MS);
|
|
104800
|
+
stderr.once("end", () => {
|
|
104801
|
+
clearTimeout(timer);
|
|
104802
|
+
settle3();
|
|
104803
|
+
});
|
|
104804
|
+
});
|
|
104805
|
+
});
|
|
104806
|
+
}
|
|
104807
|
+
function waitForDaemonConnection(server, proc, exited, timeoutMs) {
|
|
104699
104808
|
return new Promise((resolve19, reject) => {
|
|
104700
104809
|
let settled = false;
|
|
104701
104810
|
const onConnection = (socket) => {
|
|
@@ -104704,19 +104813,12 @@ function waitForDaemonConnection(server, proc, timeoutMs) {
|
|
|
104704
104813
|
cleanup();
|
|
104705
104814
|
resolve19(socket);
|
|
104706
104815
|
};
|
|
104707
|
-
|
|
104816
|
+
void exited.then((exit) => {
|
|
104708
104817
|
if (settled) return;
|
|
104709
104818
|
settled = true;
|
|
104710
104819
|
cleanup();
|
|
104711
|
-
reject(
|
|
104712
|
-
|
|
104713
|
-
error_code: FAILURE_CODES.AX_DAEMON_EXITED_BEFORE_READY,
|
|
104714
|
-
failure_stage: "ax_service_spawn_ready",
|
|
104715
|
-
failure_area: "tool_server",
|
|
104716
|
-
error_kind: "subprocess"
|
|
104717
|
-
})
|
|
104718
|
-
);
|
|
104719
|
-
};
|
|
104820
|
+
reject(axDaemonExitError(exit, "connecting"));
|
|
104821
|
+
});
|
|
104720
104822
|
const onError = (err) => {
|
|
104721
104823
|
if (settled) return;
|
|
104722
104824
|
settled = true;
|
|
@@ -104750,11 +104852,9 @@ function waitForDaemonConnection(server, proc, timeoutMs) {
|
|
|
104750
104852
|
const cleanup = () => {
|
|
104751
104853
|
clearTimeout(timer);
|
|
104752
104854
|
server.off("connection", onConnection);
|
|
104753
|
-
proc.off("exit", onExit);
|
|
104754
104855
|
proc.off("error", onError);
|
|
104755
104856
|
};
|
|
104756
104857
|
server.on("connection", onConnection);
|
|
104757
|
-
proc.on("exit", onExit);
|
|
104758
104858
|
proc.on("error", onError);
|
|
104759
104859
|
});
|
|
104760
104860
|
}
|
|
@@ -104809,6 +104909,10 @@ var axServiceBlueprint = {
|
|
|
104809
104909
|
let nextRpcId = 1;
|
|
104810
104910
|
let daemonSocket = null;
|
|
104811
104911
|
let disposed = false;
|
|
104912
|
+
let exitSeen = false;
|
|
104913
|
+
let awaitingVerdict = false;
|
|
104914
|
+
let disconnectTimer;
|
|
104915
|
+
const exitGraceMs = host.kind === "local" ? DAEMON_EXIT_GRACE_MS : 0;
|
|
104812
104916
|
const failPending = (err) => {
|
|
104813
104917
|
for (const { reject, timer } of pendingRpc.values()) {
|
|
104814
104918
|
clearTimeout(timer);
|
|
@@ -104816,7 +104920,18 @@ var axServiceBlueprint = {
|
|
|
104816
104920
|
}
|
|
104817
104921
|
pendingRpc.clear();
|
|
104818
104922
|
};
|
|
104923
|
+
const terminate = (err) => {
|
|
104924
|
+
if (disposed) return;
|
|
104925
|
+
clearTimeout(disconnectTimer);
|
|
104926
|
+
awaitingVerdict = false;
|
|
104927
|
+
failPending(err);
|
|
104928
|
+
events.emit("terminated", err);
|
|
104929
|
+
};
|
|
104819
104930
|
const { entitlementBypassActive } = await host.bootstrapAx(udid);
|
|
104931
|
+
const startFailed = (err) => {
|
|
104932
|
+
if (err instanceof Error) startFailureDegraded.set(err, !entitlementBypassActive);
|
|
104933
|
+
return err;
|
|
104934
|
+
};
|
|
104820
104935
|
const server = await startListener(endpoint, (socket) => {
|
|
104821
104936
|
if (daemonSocket && !daemonSocket.destroyed) {
|
|
104822
104937
|
daemonSocket.destroy();
|
|
@@ -104849,57 +104964,29 @@ var axServiceBlueprint = {
|
|
|
104849
104964
|
}
|
|
104850
104965
|
});
|
|
104851
104966
|
socket.on("close", () => {
|
|
104852
|
-
if (daemonSocket
|
|
104853
|
-
|
|
104854
|
-
|
|
104855
|
-
|
|
104856
|
-
|
|
104857
|
-
|
|
104858
|
-
|
|
104859
|
-
|
|
104860
|
-
|
|
104861
|
-
|
|
104862
|
-
|
|
104863
|
-
}
|
|
104864
|
-
|
|
104967
|
+
if (daemonSocket !== socket) return;
|
|
104968
|
+
daemonSocket = null;
|
|
104969
|
+
if (disposed) return;
|
|
104970
|
+
awaitingVerdict = true;
|
|
104971
|
+
if (exitSeen) return;
|
|
104972
|
+
const disconnected = () => terminate(
|
|
104973
|
+
new FailureError("ax-service daemon disconnected", {
|
|
104974
|
+
error_code: FAILURE_CODES.AX_DAEMON_PROCESS_ERROR,
|
|
104975
|
+
failure_stage: "ax_service_socket_close",
|
|
104976
|
+
failure_area: "tool_server",
|
|
104977
|
+
error_kind: "subprocess"
|
|
104978
|
+
})
|
|
104979
|
+
);
|
|
104980
|
+
if (exitGraceMs === 0) disconnected();
|
|
104981
|
+
else disconnectTimer = setTimeout(disconnected, exitGraceMs);
|
|
104865
104982
|
});
|
|
104866
104983
|
socket.on("error", () => {
|
|
104867
104984
|
});
|
|
104985
|
+
}).catch((err) => {
|
|
104986
|
+
throw startFailed(err);
|
|
104868
104987
|
});
|
|
104869
|
-
|
|
104870
|
-
|
|
104871
|
-
}
|
|
104872
|
-
const proc = host.spawnAxDaemon(udid, endpoint);
|
|
104873
|
-
proc.on("exit", (code) => {
|
|
104874
|
-
if (disposed) return;
|
|
104875
|
-
const err = new FailureError(`ax-service exited with code ${code}`, {
|
|
104876
|
-
error_code: FAILURE_CODES.AX_DAEMON_PROCESS_ERROR,
|
|
104877
|
-
failure_stage: "ax_service_process_exit",
|
|
104878
|
-
failure_area: "tool_server",
|
|
104879
|
-
error_kind: "subprocess"
|
|
104880
|
-
});
|
|
104881
|
-
failPending(err);
|
|
104882
|
-
events.emit("terminated", err);
|
|
104883
|
-
});
|
|
104884
|
-
proc.on("error", (err) => {
|
|
104885
|
-
if (disposed) return;
|
|
104886
|
-
const error63 = new FailureError(
|
|
104887
|
-
err instanceof Error ? err.message : String(err),
|
|
104888
|
-
{
|
|
104889
|
-
error_code: FAILURE_CODES.AX_DAEMON_PROCESS_ERROR,
|
|
104890
|
-
failure_stage: "ax_service_spawn_process",
|
|
104891
|
-
failure_area: "tool_server",
|
|
104892
|
-
error_kind: "subprocess"
|
|
104893
|
-
},
|
|
104894
|
-
{ cause: err instanceof Error ? err : new Error(String(err)) }
|
|
104895
|
-
);
|
|
104896
|
-
failPending(error63);
|
|
104897
|
-
events.emit("terminated", error63);
|
|
104898
|
-
});
|
|
104899
|
-
try {
|
|
104900
|
-
daemonSocket = await waitForDaemonConnection(server, proc, 1e4);
|
|
104901
|
-
} catch (err) {
|
|
104902
|
-
if (!proc.killed) proc.kill("SIGTERM");
|
|
104988
|
+
let proxyStarted = false;
|
|
104989
|
+
const abandonStart = async () => {
|
|
104903
104990
|
server.close();
|
|
104904
104991
|
if (endpoint.transport === "unix") {
|
|
104905
104992
|
try {
|
|
@@ -104907,14 +104994,51 @@ var axServiceBlueprint = {
|
|
|
104907
104994
|
} catch {
|
|
104908
104995
|
}
|
|
104909
104996
|
}
|
|
104910
|
-
if (endpoint.transport === "tcp") {
|
|
104997
|
+
if (endpoint.transport === "tcp" && proxyStarted) {
|
|
104911
104998
|
await host.stopProxy(udid, endpoint.port);
|
|
104912
104999
|
}
|
|
104913
|
-
|
|
105000
|
+
};
|
|
105001
|
+
let proc;
|
|
105002
|
+
try {
|
|
105003
|
+
if (endpoint.transport === "tcp") {
|
|
105004
|
+
await host.startProxy(udid, endpoint.port);
|
|
105005
|
+
proxyStarted = true;
|
|
105006
|
+
}
|
|
105007
|
+
proc = host.spawnAxDaemon(udid, endpoint);
|
|
105008
|
+
} catch (err) {
|
|
105009
|
+
await abandonStart();
|
|
105010
|
+
throw startFailed(err);
|
|
104914
105011
|
}
|
|
105012
|
+
const exited = watchDaemonExit(proc, () => {
|
|
105013
|
+
exitSeen = true;
|
|
105014
|
+
clearTimeout(disconnectTimer);
|
|
105015
|
+
});
|
|
105016
|
+
proc.on("error", (err) => {
|
|
105017
|
+
terminate(
|
|
105018
|
+
new FailureError(
|
|
105019
|
+
err instanceof Error ? err.message : String(err),
|
|
105020
|
+
{
|
|
105021
|
+
error_code: FAILURE_CODES.AX_DAEMON_PROCESS_ERROR,
|
|
105022
|
+
failure_stage: "ax_service_spawn_process",
|
|
105023
|
+
failure_area: "tool_server",
|
|
105024
|
+
error_kind: "subprocess"
|
|
105025
|
+
},
|
|
105026
|
+
{ cause: err instanceof Error ? err : new Error(String(err)) }
|
|
105027
|
+
)
|
|
105028
|
+
);
|
|
105029
|
+
});
|
|
105030
|
+
try {
|
|
105031
|
+
daemonSocket = await waitForDaemonConnection(server, proc, exited, 1e4);
|
|
105032
|
+
} catch (err) {
|
|
105033
|
+
if (!proc.killed) proc.kill("SIGTERM");
|
|
105034
|
+
await abandonStart();
|
|
105035
|
+
throw startFailed(err);
|
|
105036
|
+
}
|
|
105037
|
+
void exited.then((exit) => terminate(axDaemonExitError(exit, "connected")));
|
|
104915
105038
|
function query(command, timeoutMs = 5e3, params) {
|
|
104916
105039
|
return new Promise((resolve19, reject) => {
|
|
104917
|
-
|
|
105040
|
+
const socket = daemonSocket && !daemonSocket.destroyed ? daemonSocket : null;
|
|
105041
|
+
if (!socket && !awaitingVerdict) {
|
|
104918
105042
|
reject(
|
|
104919
105043
|
new FailureError("ax-service not connected", {
|
|
104920
105044
|
error_code: FAILURE_CODES.AX_QUERY_FAILED,
|
|
@@ -104940,7 +105064,7 @@ var axServiceBlueprint = {
|
|
|
104940
105064
|
}
|
|
104941
105065
|
}, timeoutMs);
|
|
104942
105066
|
pendingRpc.set(id, { resolve: resolve19, reject, timer });
|
|
104943
|
-
|
|
105067
|
+
socket?.write(
|
|
104944
105068
|
JSON.stringify(params === void 0 ? { id, command } : { id, command, params }) + "\n"
|
|
104945
105069
|
);
|
|
104946
105070
|
});
|
|
@@ -105058,6 +105182,8 @@ var axServiceBlueprint = {
|
|
|
105058
105182
|
api,
|
|
105059
105183
|
dispose: async () => {
|
|
105060
105184
|
disposed = true;
|
|
105185
|
+
clearTimeout(disconnectTimer);
|
|
105186
|
+
awaitingVerdict = false;
|
|
105061
105187
|
failPending(new Error("ax-service disposed"));
|
|
105062
105188
|
if (daemonSocket && !daemonSocket.destroyed) {
|
|
105063
105189
|
daemonSocket.destroy();
|
|
@@ -124859,7 +124985,7 @@ var getPaths = () => {
|
|
|
124859
124985
|
return { BINARY_PATH, RUN_DIR };
|
|
124860
124986
|
};
|
|
124861
124987
|
var READY_TIMEOUT_MS = 3e4;
|
|
124862
|
-
var
|
|
124988
|
+
var STDERR_DRAIN_MS2 = 250;
|
|
124863
124989
|
var STDERR_TAIL_LINES = 10;
|
|
124864
124990
|
var STDERR_MAX_LINE_CHARS = 500;
|
|
124865
124991
|
var ROUTINE_LOG_LINE = /^\[\S+\s+(?:INFO|DEBUG|TRACE)\s/;
|
|
@@ -125055,7 +125181,7 @@ async function spawnSimulatorServerProcess(udid, subcommand) {
|
|
|
125055
125181
|
};
|
|
125056
125182
|
const stderr = proc.stderr;
|
|
125057
125183
|
if (settled || !stderr || stderr.readableEnded) return fail();
|
|
125058
|
-
const drainTimer = setTimeout(fail,
|
|
125184
|
+
const drainTimer = setTimeout(fail, STDERR_DRAIN_MS2);
|
|
125059
125185
|
stderr.once("end", () => {
|
|
125060
125186
|
clearTimeout(drainTimer);
|
|
125061
125187
|
fail();
|
|
@@ -129596,7 +129722,8 @@ var DEGRADED_STANDING_HINT = "This simulator was not booted through argent, so s
|
|
|
129596
129722
|
function externalCaveat(deviceId, body) {
|
|
129597
129723
|
return `${externalSupportHint(deviceId) ?? "This device is supplied by an external provider."} ${body}`;
|
|
129598
129724
|
}
|
|
129599
|
-
var
|
|
129725
|
+
var EXTERNAL_BLIND_TAIL = ", and argent cannot reboot this device to apply the pre-boot accessibility settings. Restart it from that application, or take a screenshot to see the screen.";
|
|
129726
|
+
var EXTERNAL_BLIND_BODY = `The accessibility read returned no elements${EXTERNAL_BLIND_TAIL}`;
|
|
129600
129727
|
var EXTERNAL_STANDING_BODY = "System dialogs and native modals may not appear in this tree; everything else reads normally. Argent cannot reboot this device to apply the full accessibility settings \u2014 restart it from that application if something you expect is missing.";
|
|
129601
129728
|
function isStandingCaveat(hint) {
|
|
129602
129729
|
return hint === DEGRADED_STANDING_HINT || Boolean(hint?.endsWith(EXTERNAL_STANDING_BODY));
|
|
@@ -129604,10 +129731,21 @@ function isStandingCaveat(hint) {
|
|
|
129604
129731
|
function isBlindCaveat(hint) {
|
|
129605
129732
|
return hint === DEGRADED_BLIND_HINT || Boolean(hint?.endsWith(EXTERNAL_BLIND_BODY));
|
|
129606
129733
|
}
|
|
129734
|
+
function startFailure(err) {
|
|
129735
|
+
return `The accessibility service failed to start (${errMsg(err)})`;
|
|
129736
|
+
}
|
|
129737
|
+
var DEGRADED_START_FAILED_TAIL = ", and this simulator was not booted through argent, so the pre-boot accessibility settings were never applied. Call boot-device with force=true to reboot it with those settings \u2014 this restarts the simulator. If it fails to start again after that reboot, do not reboot again: the boot was not the cause.";
|
|
129738
|
+
function axCrashHint(signal) {
|
|
129739
|
+
return `The accessibility service (ax-service) crashed with ${signal}, so the accessibility tree could not be read. Every describe starts the service again. If this hint repeats, the crash is in the service on this host: rebooting the simulator (boot-device with force=true) or restarting the tool-server will not fix it, because both start the same binary again. While it crashes, system dialogs and SpringBoard chrome cannot be read through describe. describe continues on the app's native view hierarchy where that is available, and \`screenshot\` shows the rest.`;
|
|
129740
|
+
}
|
|
129741
|
+
var NATIVE_FALLBACK_LEAD = "The native fallback has no tree for this read, for a reason of its own, unrelated to the crash:";
|
|
129607
129742
|
var bootCaveatToldDevices = /* @__PURE__ */ new Set();
|
|
129743
|
+
var readFacts = /* @__PURE__ */ new WeakMap();
|
|
129608
129744
|
function withBootCaveatOncePerDevice(deviceId, data) {
|
|
129609
129745
|
if (!isStandingCaveat(data.hint)) {
|
|
129610
|
-
|
|
129746
|
+
const facts = readFacts.get(data);
|
|
129747
|
+
const stillDegraded = facts?.daemonGone ? facts.degraded !== false : isBlindCaveat(data.hint);
|
|
129748
|
+
if (!stillDegraded) bootCaveatToldDevices.delete(deviceId);
|
|
129611
129749
|
return data;
|
|
129612
129750
|
}
|
|
129613
129751
|
if (!bootCaveatToldDevices.has(deviceId)) {
|
|
@@ -129636,6 +129774,12 @@ function lendsNativeDevtools(deviceId) {
|
|
|
129636
129774
|
}
|
|
129637
129775
|
var iosRequires = ["xcrun"];
|
|
129638
129776
|
async function describeIos(registry2, device, params, options = {}) {
|
|
129777
|
+
const facts = {};
|
|
129778
|
+
const data = await readIos(registry2, device, params, options, facts);
|
|
129779
|
+
readFacts.set(data, facts);
|
|
129780
|
+
return data;
|
|
129781
|
+
}
|
|
129782
|
+
async function readIos(registry2, device, params, options, facts) {
|
|
129639
129783
|
const isTvOs = options.isTvOs ?? await isTvOsSimulator(device.id);
|
|
129640
129784
|
if (isTvOs) {
|
|
129641
129785
|
return { tree: emptyTree(), source: "ax-service", hint: TVOS_HINT };
|
|
@@ -129644,38 +129788,59 @@ async function describeIos(registry2, device, params, options = {}) {
|
|
|
129644
129788
|
let degraded;
|
|
129645
129789
|
let resolverHint;
|
|
129646
129790
|
let readFailureHint;
|
|
129791
|
+
let startFailureHint;
|
|
129792
|
+
let crashSignal;
|
|
129647
129793
|
let axApi;
|
|
129648
129794
|
try {
|
|
129649
129795
|
const axRef = axServiceRef(device);
|
|
129650
129796
|
axApi = await registry2.resolveService(axRef.urn, axRef.options);
|
|
129651
129797
|
degraded = axApi.degraded;
|
|
129798
|
+
facts.degraded = degraded;
|
|
129652
129799
|
} catch (err) {
|
|
129653
129800
|
if (isFirstLaunchRefusal(err)) throw err;
|
|
129654
129801
|
resolverHint = tcpArtifactHint(err);
|
|
129655
|
-
|
|
129802
|
+
crashSignal = axDaemonCrashSignal(err);
|
|
129803
|
+
facts.degraded = axStartFailureDegraded(err);
|
|
129804
|
+
const explained = resolverHint !== void 0 || crashSignal !== void 0;
|
|
129805
|
+
degraded = !explained && facts.degraded !== false;
|
|
129806
|
+
if (!explained) {
|
|
129807
|
+
facts.daemonGone = true;
|
|
129808
|
+
startFailureHint = !degraded ? `${startFailure(err)}.` : isExternalId(device.id) ? externalCaveat(device.id, `${startFailure(err)}${EXTERNAL_BLIND_TAIL}`) : `${startFailure(err)}${DEGRADED_START_FAILED_TAIL}`;
|
|
129809
|
+
}
|
|
129656
129810
|
}
|
|
129657
129811
|
if (axApi) {
|
|
129658
129812
|
try {
|
|
129659
129813
|
tree = adaptAXDescribeToDescribeResult(await axApi.describe());
|
|
129660
129814
|
} catch (err) {
|
|
129661
|
-
|
|
129815
|
+
crashSignal = axDaemonCrashSignal(err);
|
|
129816
|
+
if (crashSignal === void 0) {
|
|
129817
|
+
readFailureHint = `The accessibility read failed (${errMsg(err)}).`;
|
|
129818
|
+
}
|
|
129662
129819
|
}
|
|
129663
129820
|
}
|
|
129664
|
-
const
|
|
129821
|
+
const crashHint = crashSignal === void 0 ? void 0 : axCrashHint(crashSignal);
|
|
129822
|
+
if (crashHint !== void 0) facts.daemonGone = true;
|
|
129823
|
+
const degradedHint = !degraded || crashHint !== void 0 || startFailureHint !== void 0 ? void 0 : tree.children.length === 0 ? DEGRADED_BLIND_HINT : DEGRADED_STANDING_HINT;
|
|
129665
129824
|
const deviceDegradedHint = degradedHint !== void 0 && isExternalId(device.id) ? externalCaveat(
|
|
129666
129825
|
device.id,
|
|
129667
129826
|
degradedHint === DEGRADED_BLIND_HINT ? EXTERNAL_BLIND_BODY : EXTERNAL_STANDING_BODY
|
|
129668
129827
|
) : degradedHint;
|
|
129669
|
-
const hint = resolverHint ?? (readFailureHint ? deviceDegradedHint ? `${deviceDegradedHint}. ${readFailureHint}` : readFailureHint : deviceDegradedHint);
|
|
129828
|
+
const hint = resolverHint ?? crashHint ?? startFailureHint ?? (readFailureHint ? deviceDegradedHint ? `${deviceDegradedHint}. ${readFailureHint}` : readFailureHint : deviceDegradedHint);
|
|
129670
129829
|
if (tree.children.length > 0) {
|
|
129671
129830
|
return { tree, source: "ax-service", hint };
|
|
129672
129831
|
}
|
|
129832
|
+
const daemonGoneHint = crashHint ?? (degraded ? void 0 : startFailureHint);
|
|
129673
129833
|
if (params.bundleId && !isInjectableBundleId(params.bundleId)) {
|
|
129674
|
-
return {
|
|
129834
|
+
return {
|
|
129835
|
+
tree,
|
|
129836
|
+
source: "ax-service",
|
|
129837
|
+
hint: daemonGoneHint ? `${daemonGoneHint} ${NON_INJECTABLE_HINT}` : hint ?? NON_INJECTABLE_HINT
|
|
129838
|
+
};
|
|
129675
129839
|
}
|
|
129676
129840
|
if (isExternalId(device.id) && !lendsNativeDevtools(device.id)) {
|
|
129841
|
+
const provider = externalSupportHint(device.id) ?? "This device is supplied by an external provider.";
|
|
129677
129842
|
return {
|
|
129678
|
-
hint:
|
|
129843
|
+
hint: daemonGoneHint ? `${daemonGoneHint} ${provider} The native view-hierarchy fallback is unavailable on it. Take a screenshot to see the screen.` : hint ?? `${provider} The native view-hierarchy fallback is unavailable on it, so an empty tree here means the accessibility tree itself was empty. Take a screenshot to see the screen.`,
|
|
129679
129844
|
source: "ax-service",
|
|
129680
129845
|
tree
|
|
129681
129846
|
};
|
|
@@ -129695,7 +129860,7 @@ async function describeIos(registry2, device, params, options = {}) {
|
|
|
129695
129860
|
});
|
|
129696
129861
|
if (state3 !== "connected") {
|
|
129697
129862
|
const diagnosis = buildAppStateMessage(target.bundleId, state3);
|
|
129698
|
-
const merged = hint ? `${hint} ${diagnosis}` : diagnosis;
|
|
129863
|
+
const merged = crashHint ? `${crashHint} ${NATIVE_FALLBACK_LEAD} ${diagnosis}` : hint ? `${hint} ${diagnosis}` : diagnosis;
|
|
129699
129864
|
return state3 === "unregistered" || state3 === "connecting" ? { tree, source: "ax-service", hint: merged } : { tree, source: "ax-service", should_restart: true, hint: merged };
|
|
129700
129865
|
}
|
|
129701
129866
|
const rawResult = await nativeApi.queryViewHierarchy(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swmansion/argent",
|
|
3
|
-
"version": "0.34.1-next.
|
|
3
|
+
"version": "0.34.1-next.3",
|
|
4
4
|
"mcpName": "io.github.software-mansion/argent",
|
|
5
5
|
"description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
|
|
6
6
|
"license": "Apache-2.0",
|