stim 1.17.2 → 1.18.0
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/README.md +50 -1
- package/dist/{activity-IRvJY_ru.mjs → activity-BxnkDZDi.mjs} +4 -4
- package/dist/{agent-device-usage-output-BK41vnzN.mjs → agent-device-usage-output-CZ66YA4T.mjs} +8 -8
- package/dist/android-BKA16DTf.mjs +4 -0
- package/dist/{android-B9yaNKwa.mjs → android-BvwuMUJ9.mjs} +192 -98
- package/dist/{android-DE4v59Mb.mjs → android-CBwCNicO.mjs} +2 -2
- package/dist/{android-B_YNZy61.mjs → android-DC3ZLuw0.mjs} +9 -9
- package/dist/{android-cas-ZFpjJBL_.mjs → android-cas-BBFyr9CA.mjs} +5 -5
- package/dist/android-cas-compiler.mjs +2 -2
- package/dist/api-D0VtFhqk.mjs +152 -0
- package/dist/api-run.d.mts +1 -0
- package/dist/api-run.mjs +145 -0
- package/dist/api.d.mts +212 -0
- package/dist/api.mjs +2 -0
- package/dist/{app-install-VPkI5WEg.mjs → app-install-D-PUENug.mjs} +3 -3
- package/dist/{attempt-Bk2ouQVL.mjs → attempt-DW-mQqM7.mjs} +14 -4
- package/dist/{budget-DfcgFdQB.mjs → budget-DIhL2BKx.mjs} +1578 -58
- package/dist/build-facts-DcLv2HSd.d.mts +111 -0
- package/dist/{cache-manifest-DnUHBJaU.mjs → cache-manifest-BI7ozfmH.mjs} +3 -3
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{chrome-BrcVWQyD.mjs → chrome-DJnmnS5q.mjs} +1 -1
- package/dist/cli-DNJMwADx.mjs +68 -0
- package/dist/cli.mjs +1 -1
- package/dist/{client-SvBdgObD.mjs → client-DzhapoMB.mjs} +139 -32
- package/dist/collector-run.mjs +9 -9
- package/dist/{command-output-CDAIFD-8.mjs → command-output-CBtzyIgF.mjs} +2 -2
- package/dist/{config-D0DbpZtM.mjs → config-CgYMahz7.mjs} +5 -5
- package/dist/{created-devices-CpvzBL25.mjs → created-devices-DKbeWsiK.mjs} +2 -2
- package/dist/{dependency-state-CLcBHH2M.mjs → dependency-state-xKoOypBm.mjs} +2 -2
- package/dist/{detached-entry-CiTEgMR1.mjs → detached-entry-BLfcgc4O.mjs} +1 -1
- package/dist/{dev-client-B-XC4uRH.mjs → dev-client-CLnIH02x.mjs} +2 -2
- package/dist/{device-C8IOoJPv.mjs → device-D7oCHGWi.mjs} +8 -8
- package/dist/{device-capacity-ZC4XSZ4R.mjs → device-capacity-EUOOYr8T.mjs} +13 -13
- package/dist/device-host-worker.mjs +19 -19
- package/dist/{device-ios-C2Um-XUR.mjs → device-ios-6MewKKnc.mjs} +13 -13
- package/dist/{device-lease-DpoS36_u.mjs → device-lease-Co-EwifR.mjs} +9 -9
- package/dist/{device-lease-run-B8YltIH_.mjs → device-lease-run-w1xhCqIW.mjs} +4 -4
- package/dist/{device-pool-3o7s5lo4.mjs → device-pool-F5WvRPtD.mjs} +3 -3
- package/dist/{device-remote-hFSkpfQu.mjs → device-remote-tHbd1fKy.mjs} +15 -15
- package/dist/{doctor-CFv1fCrF.mjs → doctor-B9ckYUoU.mjs} +33 -30
- package/dist/{error-diagnostics-C-NMnhrk.mjs → error-diagnostics-BRXOqDzG.mjs} +11 -11
- package/dist/{exec-CaErVv7t.mjs → exec-DWhCZDGm.mjs} +65 -2
- package/dist/{gc-DEmkg3Xh.mjs → gc-Dh6mXOKC.mjs} +23 -469
- package/dist/{gradle-dJpre3Yn.mjs → gradle-C6GKnunQ.mjs} +6 -6
- package/dist/{guide-status-Du-ZQ3FD.mjs → guide-status-Bhf9SJXc.mjs} +3 -3
- package/dist/{guide-CSmhMTf8.mjs → guide-tm6igAaa.mjs} +290 -53
- package/dist/{hosted-android-E1Heoqnv.mjs → hosted-android-Bv285t_t.mjs} +3 -3
- package/dist/{hosted-client-Bp4knSwu.mjs → hosted-client-C-rMtppF.mjs} +2 -2
- package/dist/{hosted-ios-BnbeYOUD.mjs → hosted-ios-D5mNmtj4.mjs} +1 -1
- package/dist/{hosted-logs-OcgIBvCT.mjs → hosted-logs-DN8Iz4mJ.mjs} +9 -9
- package/dist/{hosted-macos-DcxKjtfH.mjs → hosted-macos-B-wEjlwG.mjs} +5 -5
- package/dist/{hosted-native-1Ebbig4w.mjs → hosted-native-DeeOG8xZ.mjs} +6 -6
- package/dist/{idle-shutdown-IGyNV8Cr.mjs → idle-shutdown-jjtxAn5C.mjs} +7 -8
- package/dist/{ios-DSfnPfse.mjs → ios-B3SbOWdw.mjs} +19 -7
- package/dist/{ios-Cr1h5gnO.mjs → ios-Bvbf0SGY.mjs} +1 -1
- package/dist/{ios-BJ4XUSe1.mjs → ios-CPdkoKaa.mjs} +181 -95
- package/dist/ios-DNpdygiv.mjs +7 -0
- package/dist/{ios-device-Ee7sDXfp.mjs → ios-device-Bn7jWDB1.mjs} +1 -1
- package/dist/{ios-device-pAN4t54-.mjs → ios-device-vOaByMhw.mjs} +3 -3
- package/dist/{ios-state-8L3lgum6.mjs → ios-state-B2pES6Vs.mjs} +1 -1
- package/dist/{launch-verify-lTnWZikR.mjs → launch-verify-hskNcWkZ.mjs} +5 -5
- package/dist/{logs-BAaS7gS2.mjs → logs-1Ylc1Ri6.mjs} +13 -13
- package/dist/macos-Ck7OBMNY.mjs +2 -0
- package/dist/{macos-BIRQS90f.mjs → macos-DF6C7wUU.mjs} +118 -34
- package/dist/macos-run.mjs +1 -1
- package/dist/maintenance-run.mjs +349 -47
- package/dist/{metro-g8NqiJp-.mjs → metro-Dh8T4Ytd.mjs} +5 -5
- package/dist/{metro-gateway-C-ijGI2F.mjs → metro-gateway-CEUw9RMH.mjs} +4 -4
- package/dist/{metro-store-CDDZHtPl.mjs → metro-store-BAHFcJm6.mjs} +16 -2
- package/dist/{named-ports-C8m8EQs2.mjs → named-ports-BFIz1Shz.mjs} +61 -6
- package/dist/{native-run-D1Q56rAD.mjs → native-run-B06FkmZx.mjs} +4 -4
- package/dist/{native-runtime-BEK171xQ.mjs → native-runtime-D_603JiC.mjs} +6 -6
- package/dist/{ndjson-PclOIwVY.mjs → ndjson-LGZAMsqa.mjs} +8 -4
- package/dist/offload-worker.d.mts +3 -17
- package/dist/offload-worker.mjs +10 -11
- package/dist/{ownership-DyRQru0q.mjs → ownership-D6Se7gg_.mjs} +3 -3
- package/dist/{page-QF_Ke10s.mjs → page-Bv9s2KwY.mjs} +1 -1
- package/dist/placement-log-BcPhRwR4.mjs +84 -0
- package/dist/{build-plan-BDsSi09V.mjs → plan-placement-CtxkCO54.mjs} +122 -48
- package/dist/{ports-4nYqxPWC.mjs → ports-BLTtfBq-.mjs} +3 -3
- package/dist/{prebuild-D7RUMkwN.mjs → prebuild-juCyreaR.mjs} +5 -5
- package/dist/preview-D5V07Nrl.mjs +987 -0
- package/dist/{rolldown-runtime-BsOwBuO_.mjs → process-identity-Biv3arCO.mjs} +11 -1
- package/dist/{project-D47Rh0ly.mjs → project-C3ChRLZy.mjs} +4 -68
- package/dist/projects-DD7dBTCj.mjs +92 -0
- package/dist/{pull-request-pxnDCQzn.mjs → pull-request-u4vp7zmK.mjs} +1 -1
- package/dist/pull-requests.mjs +1 -1
- package/dist/{recordings-BNgsD1Tr.mjs → recordings-BAWltsVt.mjs} +1 -1
- package/dist/{reload-DcRxj3qG.mjs → reload-DvyWzVjJ.mjs} +15 -15
- package/dist/{remote-cache-Ci4DQYYj.mjs → remote-cache-BGg7aGIZ.mjs} +5 -5
- package/dist/{run-CkE9y0nc.mjs → run-vhtDgpHO.mjs} +5 -5
- package/dist/{server-bare-BkrSxSsZ.mjs → server-bare-B9E7S1aR.mjs} +4 -5
- package/dist/server-expo-Db9HBUoa.mjs +2 -0
- package/dist/{server-expo-CHTyXD0G.mjs → server-expo-DoBHhuzK.mjs} +5 -6
- package/dist/{settings-SR9OmW9h.mjs → settings-Byp2AQ_E.mjs} +6 -5
- package/dist/{settings-Cfd-0r2d.mjs → settings-CQyMElEP.mjs} +24 -763
- package/dist/{settings-BBpMcDbD.mjs → settings-Djl-mpjX.mjs} +1 -1
- package/dist/settings.schema.json +126 -3
- package/dist/{simslim-BWNrc3M3.mjs → simslim-EHBQ2R4G.mjs} +7 -7
- package/dist/{slot-launch-DmjBmpQV.mjs → slot-launch-C1nqh4mu.mjs} +6 -6
- package/dist/{spawn-claims-D0XfSe8u.mjs → spawn-claims-Kqiifsk2.mjs} +1 -1
- package/dist/{spawn-entry-jw19m8Nl.mjs → spawn-entry-Dcb7sDUz.mjs} +1 -0
- package/dist/{stage-CzaiwFsI.mjs → stage-g_WqWeaE.mjs} +14 -3
- package/dist/{start-DUz3mYdb.mjs → start-D-IeOyoK.mjs} +19 -19
- package/dist/{start-AlfCPRVU.mjs → start-NTc1Ifqs.mjs} +1 -1
- package/dist/{state-PeQiJuIu.mjs → state-BG-aAk4k.mjs} +4 -4
- package/dist/{state-B4PQFXMW.d.mts → state-lKh8shBp.d.mts} +2 -3
- package/dist/{state-DyaNTgfR.mjs → state-xnqpx3AD.mjs} +2 -2
- package/dist/{stats-Bq4fJOdB.mjs → stats-DY6ekz8F.mjs} +5 -5
- package/dist/{status-DlKvVJBE.mjs → status-BEeL6IKz.mjs} +6 -4
- package/dist/{status-BA2pehwf.mjs → status-DCjZeE-K.mjs} +33 -34
- package/dist/{status-CzS4bPO9.mjs → status-Dcr0Qexd.mjs} +5 -5
- package/dist/{stim-desktop-Cnz8CPnl.mjs → stim-desktop-Behws_fi.mjs} +1 -1
- package/dist/{stim-installations-QMEI32v1.mjs → stim-installations-aR_WsNOA.mjs} +1 -1
- package/dist/{stop-BIiM49EY.mjs → stop-BGhKMOuH.mjs} +5 -5
- package/dist/{stop-DQIasgKp.mjs → stop-BTjs3xbc.mjs} +17 -18
- package/dist/{stop-zF1y04f2.mjs → stop-DIJtD2GL.mjs} +2 -2
- package/dist/supervisor-run.d.mts +24 -22
- package/dist/supervisor-run.mjs +21 -22
- package/dist/{support-CsJNVfOc.mjs → support-BaayeYCf.mjs} +7 -7
- package/dist/{support-WvD__tSV.mjs → support-Bwvbrq5-.mjs} +5 -5
- package/dist/{toolchain-DNyR3NPq.mjs → toolchain-Bnyd_K3A.mjs} +471 -22
- package/dist/{trigger-Bemu8ytw.mjs → trigger-CJMhwXe8.mjs} +5 -5
- package/dist/trigger-DWAq9hkw.mjs +2 -0
- package/dist/{warm-progress-DF4JRvYI.mjs → warm-progress-CjB-MP6H.mjs} +7 -7
- package/dist/web-B6_bFDn7.mjs +2 -0
- package/dist/{web-Dl0KSRHf.mjs → web-DTU0uiWj.mjs} +22 -22
- package/dist/web-run.mjs +10 -10
- package/dist/{workspace-state-DqcCbpE7.mjs → workspace-state-C59dqG-Z.mjs} +3 -3
- package/dist/{ownership-BMLqyBgJ.mjs → workspaces-xXItD8Dj.mjs} +577 -23
- package/dist/{worktree-j3IcFAI5.mjs → worktree-BJfnU6r5.mjs} +1 -1
- package/dist/{worktree-Be_7NLKy.mjs → worktree-BSYlofkq.mjs} +234 -35
- package/dist/worktree-CsKYexJM.mjs +753 -0
- package/package.json +10 -5
- package/dist/build-progress-D0WkjCPd.mjs +0 -1036
- package/dist/build-slots-41v_d2x9.mjs +0 -142
- package/dist/cli-CYXb29oE.mjs +0 -51
- package/dist/deps-iKw0eD4P.mjs +0 -438
- package/dist/errors-B6W7FkxQ.mjs +0 -15
- package/dist/idle-BXG__1BA.mjs +0 -176
- package/dist/in-use-CvGOUn-x.mjs +0 -130
- package/dist/preview-B-g9d7kV.mjs +0 -318
- package/dist/process-identity-BmRm1qV0.mjs +0 -12
- package/dist/server-expo-CeakhI8P.mjs +0 -2
- package/dist/state-BKa8wNN5.mjs +0 -148
- package/dist/stop-cause-rhmGfwvt.mjs +0 -97
- package/dist/trigger-CXts6qt1.mjs +0 -2
- package/dist/watchman-APYjXSQa.mjs +0 -48
- package/dist/workspace-process-lock-2mNzOlaB.mjs +0 -58
- package/dist/workspaces-Bcib97-6.mjs +0 -306
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as getExecutor } from "./exec-
|
|
3
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { t as getExecutor } from "./exec-DWhCZDGm.mjs";
|
|
4
3
|
import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
5
4
|
import { join } from "node:path";
|
|
5
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
6
6
|
import { once } from "node:events";
|
|
7
7
|
//#region bin/android-cas-compiler.ts
|
|
8
8
|
const context = process.env.STIM_ANDROID_CAS_CONTEXT;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { t as getExecutor } from "./exec-DWhCZDGm.mjs";
|
|
2
|
+
import { t as spawnEntry } from "./spawn-entry-Dcb7sDUz.mjs";
|
|
3
|
+
import { realpathSync } from "node:fs";
|
|
4
|
+
import { isAbsolute } from "node:path";
|
|
5
|
+
//#region src/api.ts
|
|
6
|
+
var StimError = class extends Error {
|
|
7
|
+
code;
|
|
8
|
+
remedy;
|
|
9
|
+
details;
|
|
10
|
+
constructor({ code, message, remedy = null, details }) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "StimError";
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.remedy = remedy;
|
|
15
|
+
this.details = details;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Creates a client without starting processes or changing the caller's cwd, environment, or signal handlers.
|
|
20
|
+
* Each operation runs in a separate Stim worker. Resources remain workspace-owned until stop() is called.
|
|
21
|
+
*/
|
|
22
|
+
function createStim(options) {
|
|
23
|
+
let projectRoot;
|
|
24
|
+
try {
|
|
25
|
+
projectRoot = realpathSync(options.projectRoot);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
throw new StimError({
|
|
28
|
+
code: "STIM_NO_PROJECT",
|
|
29
|
+
message: `Could not resolve projectRoot ${options.projectRoot}: ${error instanceof Error ? error.message : String(error)}`,
|
|
30
|
+
remedy: "Pass the path to an existing, readable app directory."
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
for (const [name, path] of [["home", options.home], ["buildCache", options.buildCache]]) if (path !== void 0 && !isAbsolute(path)) throw new StimError({
|
|
34
|
+
code: "STIM_BAD_ARG",
|
|
35
|
+
message: `${name} must be an absolute path.`
|
|
36
|
+
});
|
|
37
|
+
const context = {
|
|
38
|
+
...options,
|
|
39
|
+
projectRoot,
|
|
40
|
+
env: {
|
|
41
|
+
...process.env,
|
|
42
|
+
...options.home === void 0 ? {} : { STIM_HOME: options.home },
|
|
43
|
+
...options.buildCache === void 0 ? {} : { STIM_BUILD_CACHE: options.buildCache },
|
|
44
|
+
FORCE_COLOR: "0"
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
projectRoot,
|
|
49
|
+
run({ signal, ...request }) {
|
|
50
|
+
return invoke(context, {
|
|
51
|
+
operation: "run",
|
|
52
|
+
options: request
|
|
53
|
+
}, signal);
|
|
54
|
+
},
|
|
55
|
+
stop({ signal, ...request } = {}) {
|
|
56
|
+
return invoke(context, {
|
|
57
|
+
operation: "stop",
|
|
58
|
+
options: request
|
|
59
|
+
}, signal);
|
|
60
|
+
},
|
|
61
|
+
diagnostics({ signal, ...request } = {}) {
|
|
62
|
+
if (request.tail !== void 0 && (!Number.isSafeInteger(request.tail) || request.tail < 0)) return Promise.reject(new StimError({
|
|
63
|
+
code: "STIM_BAD_ARG",
|
|
64
|
+
message: "tail must be a non-negative integer."
|
|
65
|
+
}));
|
|
66
|
+
return invoke(context, {
|
|
67
|
+
operation: "diagnostics",
|
|
68
|
+
options: request
|
|
69
|
+
}, signal);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function cancelled() {
|
|
74
|
+
return new StimError({
|
|
75
|
+
code: "STIM_CANCELLED",
|
|
76
|
+
message: "The Stim operation was cancelled."
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function invoke(context, request, signal) {
|
|
80
|
+
if (signal?.aborted) return Promise.reject(cancelled());
|
|
81
|
+
return new Promise((resolve, reject) => {
|
|
82
|
+
const child = getExecutor().spawn(process.execPath, [spawnEntry("api-run")], {
|
|
83
|
+
cwd: context.projectRoot,
|
|
84
|
+
env: context.env,
|
|
85
|
+
stdio: [
|
|
86
|
+
"ignore",
|
|
87
|
+
"pipe",
|
|
88
|
+
"pipe",
|
|
89
|
+
"ipc"
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
let response;
|
|
93
|
+
let transportError;
|
|
94
|
+
let callbackError;
|
|
95
|
+
let callbackFailed = false;
|
|
96
|
+
let stderr = "";
|
|
97
|
+
const abort = () => {
|
|
98
|
+
child.send?.({ operation: "cancel" }, (error) => {
|
|
99
|
+
if (error) child.kill("SIGINT");
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
103
|
+
if (signal?.aborted) abort();
|
|
104
|
+
const progress = (stream, message) => {
|
|
105
|
+
if (stream === "stderr") stderr = (stderr + message).slice(-16384);
|
|
106
|
+
if (!context.onProgress || callbackFailed) return;
|
|
107
|
+
try {
|
|
108
|
+
context.onProgress({
|
|
109
|
+
stream,
|
|
110
|
+
message
|
|
111
|
+
});
|
|
112
|
+
} catch (error) {
|
|
113
|
+
callbackError = error;
|
|
114
|
+
callbackFailed = true;
|
|
115
|
+
abort();
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
child.stdout?.setEncoding("utf8").on("data", (chunk) => progress("stdout", chunk));
|
|
119
|
+
child.stderr?.setEncoding("utf8").on("data", (chunk) => progress("stderr", chunk));
|
|
120
|
+
child.on("message", (message) => {
|
|
121
|
+
response = message;
|
|
122
|
+
});
|
|
123
|
+
child.on("error", (error) => {
|
|
124
|
+
transportError = error;
|
|
125
|
+
});
|
|
126
|
+
child.on("close", (code, exitSignal) => {
|
|
127
|
+
signal?.removeEventListener("abort", abort);
|
|
128
|
+
if (callbackFailed) return reject(callbackError);
|
|
129
|
+
if (signal?.aborted) return reject(cancelled());
|
|
130
|
+
if (transportError) return reject(new StimError({
|
|
131
|
+
code: "STIM_WORKER_FAILED",
|
|
132
|
+
message: transportError.message,
|
|
133
|
+
details: { stderr }
|
|
134
|
+
}));
|
|
135
|
+
if (response?.ok === false) return reject(new StimError(response.error));
|
|
136
|
+
if (code === 0 && response?.ok) return resolve(response.result);
|
|
137
|
+
reject(new StimError({
|
|
138
|
+
code: "STIM_WORKER_FAILED",
|
|
139
|
+
message: `Stim worker exited without a result (${exitSignal ?? code}).`,
|
|
140
|
+
details: { stderr }
|
|
141
|
+
}));
|
|
142
|
+
});
|
|
143
|
+
child.send?.({
|
|
144
|
+
...request,
|
|
145
|
+
projectRoot: context.projectRoot
|
|
146
|
+
}, (error) => {
|
|
147
|
+
if (error) transportError = error;
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
export { createStim as n, StimError as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/api-run.mjs
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { t as StimError } from "./api-D0VtFhqk.mjs";
|
|
2
|
+
import { y as refuseRelativeStimPaths } from "./config-CgYMahz7.mjs";
|
|
3
|
+
import { x as workspaceLogsDir$1 } from "./workspace-state-C59dqG-Z.mjs";
|
|
4
|
+
import { i as runAndroidOperation } from "./android-BvwuMUJ9.mjs";
|
|
5
|
+
import { r as runIosOperation } from "./ios-CPdkoKaa.mjs";
|
|
6
|
+
import { n as runMacos } from "./macos-DF6C7wUU.mjs";
|
|
7
|
+
import { c as stopWorkspaceNow } from "./stop-BTjs3xbc.mjs";
|
|
8
|
+
import { n as runWeb } from "./web-DTU0uiWj.mjs";
|
|
9
|
+
import { queryJsonLogs } from "@stim-cli/core/state";
|
|
10
|
+
//#region src/api-run.ts
|
|
11
|
+
async function dispatch({ projectRoot: root, ...request }) {
|
|
12
|
+
let directory;
|
|
13
|
+
try {
|
|
14
|
+
refuseRelativeStimPaths();
|
|
15
|
+
directory = workspaceLogsDir$1(root);
|
|
16
|
+
if (request.operation === "diagnostics") {
|
|
17
|
+
const { tail = 200, errors = false } = request.options;
|
|
18
|
+
return {
|
|
19
|
+
ok: true,
|
|
20
|
+
result: {
|
|
21
|
+
directory,
|
|
22
|
+
records: tail === 0 ? [] : queryJsonLogs({
|
|
23
|
+
dir: directory,
|
|
24
|
+
tail,
|
|
25
|
+
errorsOnly: errors
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (request.operation === "stop") {
|
|
31
|
+
const result = await stopWorkspaceNow({
|
|
32
|
+
root,
|
|
33
|
+
slot: request.options.slot
|
|
34
|
+
});
|
|
35
|
+
if ("refusal" in result) throw new StimError({
|
|
36
|
+
...result.refusal,
|
|
37
|
+
details: result.remote
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
ok: true,
|
|
41
|
+
result
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const options = request.options;
|
|
45
|
+
switch (options.platform) {
|
|
46
|
+
case "ios": {
|
|
47
|
+
let error;
|
|
48
|
+
const result = await runIosOperation(root, options, {}, (failure) => {
|
|
49
|
+
error = failure;
|
|
50
|
+
});
|
|
51
|
+
if (!result) throw new StimError({
|
|
52
|
+
code: error?.code ?? "STIM_RUN_FAILED",
|
|
53
|
+
message: error?.message ?? "The iOS run failed.",
|
|
54
|
+
remedy: error?.remedy,
|
|
55
|
+
details: error
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
ok: true,
|
|
59
|
+
result: {
|
|
60
|
+
platform: "ios",
|
|
61
|
+
facts: result.facts
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
case "android": {
|
|
66
|
+
const result = await runAndroidOperation(root, options);
|
|
67
|
+
if (!result.ok || !result.facts) throw new StimError({
|
|
68
|
+
code: result.error?.code ?? "STIM_RUN_FAILED",
|
|
69
|
+
message: result.error?.message ?? "The Android run failed.",
|
|
70
|
+
remedy: result.error?.remedy
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
ok: true,
|
|
74
|
+
result: {
|
|
75
|
+
platform: "android",
|
|
76
|
+
facts: result.facts
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
case "macos": {
|
|
81
|
+
const record = await runMacos(root, console.error, void 0, options.remoteBuild);
|
|
82
|
+
return {
|
|
83
|
+
ok: true,
|
|
84
|
+
result: {
|
|
85
|
+
platform: "macos",
|
|
86
|
+
facts: {
|
|
87
|
+
product: record.product,
|
|
88
|
+
bundle: record.bundle,
|
|
89
|
+
bundleId: record.bundleId,
|
|
90
|
+
executable: record.executable,
|
|
91
|
+
pid: record.app?.pid ?? null,
|
|
92
|
+
launched: record.app !== void 0,
|
|
93
|
+
build: record.build,
|
|
94
|
+
logs: { dir: directory }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
case "web": {
|
|
100
|
+
const result = await runWeb({
|
|
101
|
+
root,
|
|
102
|
+
headed: options.headed ?? false,
|
|
103
|
+
note: console.error
|
|
104
|
+
});
|
|
105
|
+
if (!result.ok) throw new StimError(result.error);
|
|
106
|
+
return {
|
|
107
|
+
ok: true,
|
|
108
|
+
result: {
|
|
109
|
+
platform: "web",
|
|
110
|
+
facts: result.facts
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
default: throw new StimError({
|
|
115
|
+
code: "STIM_BAD_ARG",
|
|
116
|
+
message: "Unknown Stim platform."
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
} catch (error) {
|
|
120
|
+
const failure = error;
|
|
121
|
+
return {
|
|
122
|
+
ok: false,
|
|
123
|
+
error: {
|
|
124
|
+
code: failure.code ?? "STIM_RUN_FAILED",
|
|
125
|
+
message: error instanceof Error ? error.message : String(error),
|
|
126
|
+
remedy: failure.remedy ?? null,
|
|
127
|
+
details: {
|
|
128
|
+
logs: directory,
|
|
129
|
+
cause: failure.details
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function interrupt() {
|
|
136
|
+
if (!process.emit("SIGINT")) process.exit(130);
|
|
137
|
+
}
|
|
138
|
+
process.once("disconnect", interrupt);
|
|
139
|
+
process.on("message", async (request) => {
|
|
140
|
+
if (request.operation === "cancel") return interrupt();
|
|
141
|
+
const response = await dispatch(request);
|
|
142
|
+
process.send?.(response, () => process.exit(response.ok ? 0 : 1));
|
|
143
|
+
});
|
|
144
|
+
//#endregion
|
|
145
|
+
export {};
|
package/dist/api.d.mts
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import "./state-lKh8shBp.mjs";
|
|
2
|
+
import { i as IosFacts, t as AndroidFacts } from "./build-facts-DcLv2HSd.mjs";
|
|
3
|
+
import "./ndjson-Du3j0AQ9.mjs";
|
|
4
|
+
import { MacosBuild, NdjsonRecord, WebBrowserState } from "@stim-cli/core/state";
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
import { ChildProcess } from "node:child_process";
|
|
7
|
+
//#region src/engine/device-lease.d.ts
|
|
8
|
+
type LeasePlatform = "ios" | "android";
|
|
9
|
+
interface ReleasedLease {
|
|
10
|
+
platform: LeasePlatform;
|
|
11
|
+
id: string;
|
|
12
|
+
deviceName: string | null;
|
|
13
|
+
expiresAt: string;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/commands/stop.d.ts
|
|
17
|
+
interface SupervisorOutcome {
|
|
18
|
+
status: string;
|
|
19
|
+
pid?: number;
|
|
20
|
+
reason?: string;
|
|
21
|
+
port?: number | null;
|
|
22
|
+
mode?: string | null;
|
|
23
|
+
}
|
|
24
|
+
interface CollectorEntry {
|
|
25
|
+
platform: string;
|
|
26
|
+
pid: number | null;
|
|
27
|
+
status: string;
|
|
28
|
+
reason?: string;
|
|
29
|
+
}
|
|
30
|
+
interface CollectorsOutcome {
|
|
31
|
+
status: string;
|
|
32
|
+
entries: CollectorEntry[];
|
|
33
|
+
}
|
|
34
|
+
interface MetroOutcome {
|
|
35
|
+
status: string;
|
|
36
|
+
port?: number | null;
|
|
37
|
+
pid?: number | null;
|
|
38
|
+
reason?: string;
|
|
39
|
+
}
|
|
40
|
+
interface DeviceOutcomeEntry {
|
|
41
|
+
status: string;
|
|
42
|
+
label?: string;
|
|
43
|
+
reason?: string;
|
|
44
|
+
kind?: string | null;
|
|
45
|
+
remedy?: string;
|
|
46
|
+
}
|
|
47
|
+
interface DeviceOutcome {
|
|
48
|
+
[key: string]: DeviceOutcomeEntry | null | undefined;
|
|
49
|
+
ios: DeviceOutcomeEntry | null;
|
|
50
|
+
android: DeviceOutcomeEntry | null;
|
|
51
|
+
remote?: DeviceOutcomeEntry | null;
|
|
52
|
+
web?: DeviceOutcomeEntry | null;
|
|
53
|
+
}
|
|
54
|
+
interface PortOutcome {
|
|
55
|
+
status: string;
|
|
56
|
+
port?: number | null;
|
|
57
|
+
reason?: string;
|
|
58
|
+
}
|
|
59
|
+
interface StopOutcomes {
|
|
60
|
+
supervisor: SupervisorOutcome;
|
|
61
|
+
collectors: CollectorsOutcome;
|
|
62
|
+
metro: MetroOutcome;
|
|
63
|
+
device: DeviceOutcome;
|
|
64
|
+
macos?: {
|
|
65
|
+
status: string;
|
|
66
|
+
reason?: string;
|
|
67
|
+
};
|
|
68
|
+
port: PortOutcome;
|
|
69
|
+
metroTunnel: TunnelOutcome;
|
|
70
|
+
releasedLeases: ReleasedLease[];
|
|
71
|
+
}
|
|
72
|
+
interface StopResult {
|
|
73
|
+
ok: boolean;
|
|
74
|
+
outcomes: StopOutcomes;
|
|
75
|
+
summary: string;
|
|
76
|
+
}
|
|
77
|
+
interface TunnelOutcome {
|
|
78
|
+
status: string;
|
|
79
|
+
provider?: string;
|
|
80
|
+
reason?: string;
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/web/launch.d.ts
|
|
84
|
+
type WebLaunched = true | "bundling" | "unverified";
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/commands/web.d.ts
|
|
87
|
+
interface WebFacts extends WebBrowserState {
|
|
88
|
+
platform: "web";
|
|
89
|
+
reused: boolean;
|
|
90
|
+
launched: WebLaunched;
|
|
91
|
+
metroPort: number | null;
|
|
92
|
+
logs: {
|
|
93
|
+
dir: string;
|
|
94
|
+
};
|
|
95
|
+
durationMs: number;
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/api/types.d.ts
|
|
99
|
+
type StimPlatform = "ios" | "android" | "macos" | "web";
|
|
100
|
+
interface StimProgress {
|
|
101
|
+
stream: "stdout" | "stderr";
|
|
102
|
+
message: string;
|
|
103
|
+
}
|
|
104
|
+
interface StimOptions {
|
|
105
|
+
/** Absolute or relative path to the app directory, resolved once when creating the client. */
|
|
106
|
+
projectRoot: string;
|
|
107
|
+
/** Absolute Stim state directory. Omit to use the caller's STIM_HOME or the default home. */
|
|
108
|
+
home?: string;
|
|
109
|
+
/** Absolute native artifact cache directory. Its coordinating home must be shared by all writers. */
|
|
110
|
+
buildCache?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Receives output chunks without writing to the importing process's terminal.
|
|
113
|
+
* An exception cancels the operation and rejects it with that exception.
|
|
114
|
+
*/
|
|
115
|
+
onProgress?: (event: StimProgress) => void;
|
|
116
|
+
}
|
|
117
|
+
interface NativeRunOptions {
|
|
118
|
+
slot?: string;
|
|
119
|
+
metroCheck?: boolean;
|
|
120
|
+
buildCache?: boolean;
|
|
121
|
+
remoteBuild?: string;
|
|
122
|
+
}
|
|
123
|
+
type StimRunOptions = ((NativeRunOptions & {
|
|
124
|
+
platform: "ios";
|
|
125
|
+
configuration?: string;
|
|
126
|
+
scheme?: string;
|
|
127
|
+
deviceType?: string;
|
|
128
|
+
runtime?: string;
|
|
129
|
+
}) | (NativeRunOptions & {
|
|
130
|
+
platform: "android";
|
|
131
|
+
variant?: string;
|
|
132
|
+
systemImage?: string;
|
|
133
|
+
deviceProfile?: string;
|
|
134
|
+
}) | {
|
|
135
|
+
platform: "macos";
|
|
136
|
+
remoteBuild?: string;
|
|
137
|
+
} | {
|
|
138
|
+
platform: "web";
|
|
139
|
+
headed?: boolean;
|
|
140
|
+
}) & {
|
|
141
|
+
signal?: AbortSignal;
|
|
142
|
+
};
|
|
143
|
+
type StimRunResult = {
|
|
144
|
+
platform: "ios";
|
|
145
|
+
facts: IosFacts;
|
|
146
|
+
} | {
|
|
147
|
+
platform: "android";
|
|
148
|
+
facts: AndroidFacts;
|
|
149
|
+
} | {
|
|
150
|
+
platform: "macos";
|
|
151
|
+
facts: {
|
|
152
|
+
product: string;
|
|
153
|
+
bundle: string;
|
|
154
|
+
bundleId: string;
|
|
155
|
+
executable: string;
|
|
156
|
+
pid: number | null;
|
|
157
|
+
launched: boolean;
|
|
158
|
+
build: MacosBuild;
|
|
159
|
+
logs: {
|
|
160
|
+
dir: string;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
} | {
|
|
164
|
+
platform: "web";
|
|
165
|
+
facts: WebFacts;
|
|
166
|
+
};
|
|
167
|
+
interface StimStopOptions {
|
|
168
|
+
slot?: string;
|
|
169
|
+
signal?: AbortSignal;
|
|
170
|
+
}
|
|
171
|
+
type StimStopResult = StopResult;
|
|
172
|
+
interface StimDiagnosticsOptions {
|
|
173
|
+
/** Maximum number of records, default 200. Zero returns paths without records. */
|
|
174
|
+
tail?: number;
|
|
175
|
+
errors?: boolean;
|
|
176
|
+
signal?: AbortSignal;
|
|
177
|
+
}
|
|
178
|
+
interface StimDiagnostics {
|
|
179
|
+
directory: string;
|
|
180
|
+
records: NdjsonRecord[];
|
|
181
|
+
}
|
|
182
|
+
interface StimClient {
|
|
183
|
+
readonly projectRoot: string;
|
|
184
|
+
run(options: StimRunOptions): Promise<StimRunResult>;
|
|
185
|
+
/** Stops this workspace, including resources created before a failed run. Use a fresh signal for cleanup. */
|
|
186
|
+
stop(options?: StimStopOptions): Promise<StimStopResult>;
|
|
187
|
+
/** Reads the existing local timeline; available even when run failed before creating any logs. */
|
|
188
|
+
diagnostics(options?: StimDiagnosticsOptions): Promise<StimDiagnostics>;
|
|
189
|
+
}
|
|
190
|
+
interface StimFailure {
|
|
191
|
+
code: string;
|
|
192
|
+
message: string;
|
|
193
|
+
remedy: string | null;
|
|
194
|
+
details?: unknown;
|
|
195
|
+
}
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/api.d.ts
|
|
198
|
+
declare class StimError extends Error {
|
|
199
|
+
readonly code: string;
|
|
200
|
+
readonly remedy: string | null;
|
|
201
|
+
readonly details: unknown;
|
|
202
|
+
constructor({ code, message, remedy, details }: Omit<StimFailure, "remedy"> & {
|
|
203
|
+
remedy?: string | null;
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Creates a client without starting processes or changing the caller's cwd, environment, or signal handlers.
|
|
208
|
+
* Each operation runs in a separate Stim worker. Resources remain workspace-owned until stop() is called.
|
|
209
|
+
*/
|
|
210
|
+
declare function createStim(options: StimOptions): StimClient;
|
|
211
|
+
//#endregion
|
|
212
|
+
export { type StimClient, type StimDiagnostics, type StimDiagnosticsOptions, StimError, type StimOptions, type StimPlatform, type StimProgress, type StimRunOptions, type StimRunResult, type StimStopOptions, type StimStopResult, createStim };
|
package/dist/api.mjs
ADDED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as getExecutor } from "./exec-
|
|
2
|
-
import {
|
|
3
|
-
import { t as DEV_MENU_LAUNCH_ARGS } from "./ios-device-
|
|
1
|
+
import { t as getExecutor } from "./exec-DWhCZDGm.mjs";
|
|
2
|
+
import { N as deviceHoldsApk, O as uninstallIosApp, P as deviceHoldsBundle, h as listUserApps, u as iosSimulatorFailureAdvice } from "./ios-B3SbOWdw.mjs";
|
|
3
|
+
import { t as DEV_MENU_LAUNCH_ARGS } from "./ios-device-Bn7jWDB1.mjs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
//#region src/engine/app-schemes.ts
|
|
6
6
|
function schemesFromInfoPlist(plist) {
|
|
@@ -6,10 +6,20 @@ const ATTEMPT_BACKOFF_MS = 6e4;
|
|
|
6
6
|
function due(state, settings, now, attemptedAt) {
|
|
7
7
|
const elapsed = (stamp) => stamp === void 0 || stamp > now ? Infinity : now - stamp;
|
|
8
8
|
if (elapsed(attemptedAt) < ATTEMPT_BACKOFF_MS) return [];
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const intervalMs = {
|
|
10
|
+
pressure: settings.pressureCheckMinutes * 6e4,
|
|
11
|
+
size: settings.sizeCheckMinutes * 6e4,
|
|
12
|
+
worktree: settings.removeFinishedWorktrees ? settings.worktreeCheckMinutes * 6e4 : Infinity,
|
|
13
|
+
sweep: settings.sweepHours > 0 ? settings.sweepHours * 36e5 : Infinity
|
|
14
|
+
};
|
|
15
|
+
return [
|
|
16
|
+
"pressure",
|
|
17
|
+
"size",
|
|
18
|
+
"worktree",
|
|
19
|
+
"sweep"
|
|
20
|
+
].filter((check) => {
|
|
21
|
+
if (intervalMs[check] === Infinity || elapsed(state?.deferredAt?.[check]) < DEFERRED_RETRY_MS) return false;
|
|
22
|
+
return elapsed(state?.lastAt[check]) >= intervalMs[check];
|
|
13
23
|
});
|
|
14
24
|
}
|
|
15
25
|
//#endregion
|