stim 1.14.0 → 1.16.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 +2 -0
- package/dist/activity-BxwdD81S.mjs +609 -0
- package/dist/agent-device-usage-output-Dpih1Tfa.mjs +411 -0
- package/dist/{android-d6rGq1pA.mjs → android-B_NumVyQ.mjs} +169 -81
- package/dist/{android-LbPFRWVL.mjs → android-Ift4kVvt.mjs} +517 -413
- package/dist/android-cas-8U4DPqeR.mjs +167 -0
- package/dist/android-cas-compiler.mjs +2 -2
- package/dist/{android-XpvCrV7q.mjs → android-r2rBL8kV.mjs} +2 -2
- package/dist/{app-install-BpgSgkJj.mjs → app-install-CKWdbXIX.mjs} +128 -151
- package/dist/attempt-Bk2ouQVL.mjs +39 -0
- package/dist/budget-DjrURfQn.mjs +2700 -0
- package/dist/{build-plan-Dcr-3ie0.mjs → build-plan-DjeSb2Xl.mjs} +192 -653
- package/dist/build-slots-rUk77xqh.mjs +132 -0
- package/dist/{cache-manifest-C68QQ0ua.mjs → cache-manifest-DnUHBJaU.mjs} +2 -2
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{chrome-BPCiC3ZX.mjs → chrome-BrcVWQyD.mjs} +1 -1
- package/dist/cli-BkYZ_6hy.mjs +51 -0
- package/dist/cli.mjs +6 -42
- package/dist/client-BTY686R6.mjs +1368 -0
- package/dist/collector-run.mjs +9 -195
- package/dist/{command-output-DVcpw6eE.mjs → command-output-DnJMdEY-.mjs} +1 -1
- package/dist/{config-lvc7d3C2.mjs → config-D0DbpZtM.mjs} +28 -29
- package/dist/{created-devices-CllH_8eb.mjs → created-devices-D5owjN4C.mjs} +2 -2
- package/dist/{dependency-state-DsT7aKeo.mjs → dependency-state-B6cMXZab.mjs} +2 -2
- package/dist/{deps-D9IcKqXS.mjs → deps-urbmfXig.mjs} +3 -3
- package/dist/{detached-entry-DJHoca49.mjs → detached-entry-CiTEgMR1.mjs} +1 -1
- package/dist/dev-client-CroAIjjj.mjs +43 -0
- package/dist/{device-CjuuAJjQ.mjs → device-DZQjF7H5.mjs} +8 -7
- package/dist/device-capacity-BHwxNBlu.mjs +136 -0
- package/dist/device-host-worker.d.mts +1 -0
- package/dist/device-host-worker.mjs +964 -0
- package/dist/device-ios-BadmeL2V.mjs +381 -0
- package/dist/{device-lease-5c3WrVRm.mjs → device-lease-D-hLqx1b.mjs} +43 -36
- package/dist/{device-pool-BiyDyPP-.mjs → device-lease-run-CqjShqWW.mjs} +6 -126
- package/dist/device-pool-CUaEWMMm.mjs +125 -0
- package/dist/{device-remote-D87zEzaq.mjs → device-remote-D5WVWqOq.mjs} +69 -163
- package/dist/{doctor-x9pnU9fq.mjs → doctor-Cimf-gGB.mjs} +241 -103
- package/dist/{error-diagnostics-C5HzcwCW.mjs → error-diagnostics-B9L4Ae0x.mjs} +15 -18
- package/dist/{exec-DK8KaVHK.mjs → exec-CaErVv7t.mjs} +5 -1
- package/dist/{gc-ko6mUAYD.mjs → gc-Bqy4bjEu.mjs} +599 -108
- package/dist/{android-cas-iZK3DOCr.mjs → gradle-BsO1MdsH.mjs} +8 -294
- package/dist/{guide-6R0VNFqI.mjs → guide-B_uyKTxW.mjs} +2511 -239
- package/dist/{guide-status-BZrFPIA_.mjs → guide-status-CjEZMAD4.mjs} +3 -3
- package/dist/hosted-client-a-WmqE2L.mjs +197 -0
- package/dist/hosted-ios-CIWelIqf.mjs +220 -0
- package/dist/hosted-logs-D5g041Q3.mjs +187 -0
- package/dist/hosted-macos-BSZyIb3y.mjs +135 -0
- package/dist/idle-DYVymG92.mjs +1099 -0
- package/dist/idle-shutdown-CTsDnAde.mjs +122 -0
- package/dist/in-use-DvBw0Kxo.mjs +130 -0
- package/dist/{ios-BwDPrnYQ.mjs → ios-BaInn3sW.mjs} +201 -10
- package/dist/ios-Cr1h5gnO.mjs +189 -0
- package/dist/{ios-P1f5nm2n.mjs → ios-aq3QoGI3.mjs} +1159 -633
- package/dist/{ios-device-BiOsSVzd.mjs → ios-device-Ee7sDXfp.mjs} +1 -1
- package/dist/{ios-device-DGglU3E_.mjs → ios-device-FfCN_C8p.mjs} +12 -7
- package/dist/ios-state-DS5UpYTH.mjs +48 -0
- package/dist/{launch-verify-Deg4tB3Z.mjs → launch-verify-2DBRizjo.mjs} +5 -5
- package/dist/logs-CHEVK8zD.mjs +371 -0
- package/dist/machines-BIBUdhpj.mjs +265 -0
- package/dist/macos-CSYEAFmF.mjs +473 -0
- package/dist/macos-run.d.mts +5 -0
- package/dist/macos-run.mjs +2 -0
- package/dist/maintenance-run.d.mts +4 -0
- package/dist/maintenance-run.mjs +254 -0
- package/dist/{metro-CcEo8Fl8.mjs → metro-BeK1ZPz1.mjs} +20 -120
- package/dist/metro-gateway-BJ-rxQAB.mjs +84 -0
- package/dist/{named-ports-Blg8IxOh.mjs → named-ports-Bk_YXEmE.mjs} +6 -59
- package/dist/native-run-NaBrRFtQ.mjs +147 -0
- package/dist/{native-runtime-DjBHRg5m.mjs → native-runtime-DBzRnEKS.mjs} +9 -5
- package/dist/{ndjson-CDY9IkVC.mjs → ndjson-PclOIwVY.mjs} +2 -2
- package/dist/offload-worker.d.mts +122 -0
- package/dist/offload-worker.mjs +606 -0
- package/dist/{ownership-DyYDF5ww.mjs → ownership-DiA16AsN.mjs} +3 -2
- package/dist/ownership-hCkPzGmr.mjs +571 -0
- package/dist/{page-BHUzTDFt.mjs → page-QF_Ke10s.mjs} +7 -2
- package/dist/{ports-BguS83ex.mjs → ports-R2k4Knz3.mjs} +3 -3
- package/dist/prebuild-D2fsca_Z.mjs +213 -0
- package/dist/preview-DhVbvPAZ.mjs +318 -0
- package/dist/process-identity-BmRm1qV0.mjs +12 -0
- package/dist/{project-CWlvEaeN.mjs → project-Du91Ilvc.mjs} +74 -19
- package/dist/pull-request-pxnDCQzn.mjs +322 -0
- package/dist/pull-requests.d.mts +120 -0
- package/dist/pull-requests.mjs +2 -0
- package/dist/recordings-BIXOzVnr.mjs +37 -0
- package/dist/{reload-BiniwsSZ.mjs → reload-rM9jV1fz.mjs} +109 -24
- package/dist/{remote-cache-CcR6o6lI.mjs → remote-cache-C8-V13XN.mjs} +5 -5
- package/dist/run-f4vI6EnK.mjs +119 -0
- package/dist/{server-bare-DGfgyJ5J.mjs → server-bare-CpPGmnmO.mjs} +33 -15
- package/dist/server-expo-CVqO2c35.mjs +2 -0
- package/dist/{server-expo-BVuwQ65v.mjs → server-expo-MC0rHlOC.mjs} +8 -12
- package/dist/settings-BBpMcDbD.mjs +25 -0
- package/dist/{settings-B-fsC-Om.mjs → settings-ZkDzkzvB.mjs} +22 -10
- package/dist/settings-oTSkkNrM.mjs +1439 -0
- package/dist/settings.schema.json +845 -97
- package/dist/{simslim-DrDN4WuV.mjs → simslim-B8-7AoTI.mjs} +8 -132
- package/dist/{slot-launch-D5t8EiMf.mjs → slot-launch-B8VrHxn1.mjs} +11 -8
- package/dist/{spawn-claims-Drw_o-Fb.mjs → spawn-claims-D0XfSe8u.mjs} +1 -1
- package/dist/spawn-entry-jw19m8Nl.mjs +17 -0
- package/dist/stage-CzaiwFsI.mjs +143 -0
- package/dist/start-CX8Ig-U2.mjs +2 -0
- package/dist/{start-s4RXp1wy.mjs → start-ClDfwXa4.mjs} +116 -65
- package/dist/state-3DwSQIBK.mjs +41 -0
- package/dist/state-B4PQFXMW.d.mts +12 -0
- package/dist/{state-Dk9RVXI7.mjs → state-C1jB7Q8q.mjs} +70 -8
- package/dist/{state-DHqvsbqC.mjs → state-DcW6vOd_.mjs} +7 -4
- package/dist/stats-CEZ_i5je.mjs +77 -0
- package/dist/{status-BgAuxESg.mjs → status-BuvBFeII.mjs} +118 -20
- package/dist/{status-BsPAnfOI.mjs → status-Cs7VLg9D.mjs} +542 -283
- package/dist/status-DlKvVJBE.mjs +49 -0
- package/dist/stdout-reader-C8yjre1x.mjs +23 -0
- package/dist/stim-desktop-Cnz8CPnl.mjs +63 -0
- package/dist/stim-footprint.swift +32 -0
- package/dist/{stim-installations-CINXy_su.mjs → stim-installations-QMEI32v1.mjs} +1 -1
- package/dist/stop-B0Yxtmiy.mjs +48 -0
- package/dist/{stop-BzreOWJp.mjs → stop-Bffozsac.mjs} +83 -16
- package/dist/{stop-BWIF_6BK.mjs → stop-Dt_dM16A.mjs} +2 -2
- package/dist/stop-cause-CidxIqup.mjs +97 -0
- package/dist/supervisor-run.d.mts +43 -11
- package/dist/supervisor-run.mjs +363 -24
- package/dist/support-CAP8qDUF.mjs +316 -0
- package/dist/support-D4aYJniO.mjs +201 -0
- package/dist/teardown-CL6vDs2Y.mjs +727 -0
- package/dist/{xcode-Cp5KvK9x.mjs → toolchain-DkUflduf.mjs} +364 -14
- package/dist/trigger-Bemu8ytw.mjs +65 -0
- package/dist/trigger-CXts6qt1.mjs +2 -0
- package/dist/warm-progress-CpGv3Wb6.mjs +732 -0
- package/dist/{web-BsQs1WlO.mjs → web-DWUaMp8P.mjs} +37 -21
- package/dist/web-run.mjs +310 -13
- package/dist/workspace-process-lock-BL7Q0HCO.mjs +57 -0
- package/dist/workspace-state-B8-aJ1_5.mjs +371 -0
- package/dist/workspaces-BV4pdHFz.mjs +306 -0
- package/dist/{worktree-UrQWXSeb.mjs → worktree-K-xj9Db0.mjs} +625 -256
- package/dist/worktree-jnG8Iph5.mjs +2 -0
- package/package.json +10 -5
- package/shim/bundle-response.cjs +28 -12
- package/dist/activity-CYVDcrt3.mjs +0 -356
- package/dist/budget-CGDkhvv_.mjs +0 -1745
- package/dist/build-progress-DxKpwnaS.mjs +0 -247
- package/dist/idle-DXtx3RbX.mjs +0 -191
- package/dist/in-use-DlqBDKqY.mjs +0 -249
- package/dist/logs-Civ4gbBH.mjs +0 -486
- package/dist/merge-state-ytFQCeh4.mjs +0 -262
- package/dist/server-expo-DIHDhvGg.mjs +0 -2
- package/dist/settings-D61iNOsB.mjs +0 -629
- package/dist/start-Cetfvy8l.mjs +0 -2
- package/dist/stats-CFpFGlJV.mjs +0 -62
- package/dist/stats-CX1Z8Tca.mjs +0 -368
- package/dist/stim-desktop-CXt8-Z3J.mjs +0 -40
- package/dist/stop-cause-hjGBOZTG.mjs +0 -1231
- package/dist/worktree-BVrHsYZG.mjs +0 -752
- package/dist/worktree-CHWWvm5v.mjs +0 -2
- package/dist/{metro-store-DzeWkfqW.mjs → metro-store-CDDZHtPl.mjs} +1 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { l as phaseLine } from "./command-output-DnJMdEY-.mjs";
|
|
2
|
+
import { t as macosDir } from "./state-3DwSQIBK.mjs";
|
|
3
|
+
import { a as call, c as hostedSession, d as sha256, f as sleep, i as bundleManifest, m as upload, n as SESSION_TIMEOUT_MS, o as connectHost, p as unknownSession, r as attach, s as heldNoLonger, t as INSTALL_TIMEOUT_MS, u as settle } from "./hosted-client-a-WmqE2L.mjs";
|
|
4
|
+
import { i as agentAccess, n as pullHostedMacosLogs, r as closeAgentConnection } from "./hosted-logs-D5g041Q3.mjs";
|
|
5
|
+
import { randomUUID } from "node:crypto";
|
|
6
|
+
import { rmSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { hostedMacosBundleId, parseHostedMacosDevice, validHostedAppArguments } from "@stim-cli/core/state";
|
|
9
|
+
//#region src/device-host/hosted-macos.ts
|
|
10
|
+
const HANDOFF_TIMEOUT_MS = 3e5;
|
|
11
|
+
const agentRemoteConfig = (root) => join(macosDir(root), "agent-device-remote.json");
|
|
12
|
+
/**
|
|
13
|
+
* Places a staged `.app` on `host`: reuses the recorded session when the host still holds it ready, else reserves one,
|
|
14
|
+
* then delivers the bundle as a new app attempt, launches it and waits for the host to report it installed. `reserved`
|
|
15
|
+
* records the placement as soon as a session exists, so `stim stop` can find it even if delivery fails.
|
|
16
|
+
*/
|
|
17
|
+
async function placeHostedMacos(host, { root, bundle, bundleId, handoff, arguments: requestedArguments, recorded, reserved, note }) {
|
|
18
|
+
let session = null;
|
|
19
|
+
if (recorded) {
|
|
20
|
+
try {
|
|
21
|
+
session = await settle(host, await attach(host, recorded.session), ["preparing", "stopping"], SESSION_TIMEOUT_MS);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (!heldNoLonger(error)) throw error;
|
|
24
|
+
}
|
|
25
|
+
if (session?.state === "unknown") throw unknownSession(host, session);
|
|
26
|
+
if (session?.state === "stopped") session = null;
|
|
27
|
+
}
|
|
28
|
+
if (!session) {
|
|
29
|
+
note(`Reserving a macOS session on ${host.machine}`);
|
|
30
|
+
session = hostedSession(host, await call(host, "device-host.reserve", {
|
|
31
|
+
workspace: root,
|
|
32
|
+
slot: "default",
|
|
33
|
+
attempt: randomUUID(),
|
|
34
|
+
platform: "macos"
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
const appSlot = session.appSlot;
|
|
38
|
+
if (appSlot === void 0) throw new Error(`${host.machine} reserved a session without a macOS app slot.`);
|
|
39
|
+
const appAttempt = randomUUID();
|
|
40
|
+
const placement = {
|
|
41
|
+
machine: host.machine,
|
|
42
|
+
session: session.id,
|
|
43
|
+
appSlot,
|
|
44
|
+
appAttempt,
|
|
45
|
+
bundleId: hostedMacosBundleId(bundleId, appSlot),
|
|
46
|
+
agent: {
|
|
47
|
+
driver: "none",
|
|
48
|
+
setting: "hosting.agentDriver"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
reserved(placement);
|
|
52
|
+
session = await settle(host, session, ["preparing"], SESSION_TIMEOUT_MS);
|
|
53
|
+
if (session.state === "unknown") throw unknownSession(host, session);
|
|
54
|
+
if (session.state !== "ready") throw new Error(`The hosted session ${session.id} on ${host.machine} is ${session.state}.`);
|
|
55
|
+
const device = parseHostedMacosDevice(session.device);
|
|
56
|
+
if (!device || device.appSlot !== appSlot) throw new Error(`${host.machine} reported a ready session without its reserved macOS app slot.`);
|
|
57
|
+
const { files, content } = bundleManifest(bundle);
|
|
58
|
+
const manifest = Buffer.from(JSON.stringify(files));
|
|
59
|
+
content.set(sha256(manifest), () => manifest);
|
|
60
|
+
const ids = {
|
|
61
|
+
session: session.id,
|
|
62
|
+
attempt: appAttempt
|
|
63
|
+
};
|
|
64
|
+
const offer = {
|
|
65
|
+
...ids,
|
|
66
|
+
bundleId,
|
|
67
|
+
mode: "release",
|
|
68
|
+
...requestedArguments.length ? { arguments: requestedArguments } : {},
|
|
69
|
+
manifest: {
|
|
70
|
+
sha256: sha256(manifest),
|
|
71
|
+
size: manifest.length
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
note(`Delivering ${files.length} files to ${host.machine} (macOS ${device.macosVersion}, ${device.architecture})`);
|
|
75
|
+
await upload(host, ids, (await call(host, "device-host.app.offer", offer)).missing, content);
|
|
76
|
+
let missing = (await call(host, "device-host.app.offer", offer)).missing;
|
|
77
|
+
if (handoff && handoff.nodeId === host.credential.nodeId && Array.isArray(missing) && missing.length) {
|
|
78
|
+
try {
|
|
79
|
+
const taken = await call(host, "device-host.app.handoff", {
|
|
80
|
+
...ids,
|
|
81
|
+
build: {
|
|
82
|
+
handoff: handoff.token,
|
|
83
|
+
sha256: handoff.sha256
|
|
84
|
+
}
|
|
85
|
+
}, HANDOFF_TIMEOUT_MS);
|
|
86
|
+
if (taken.files) note(`${host.machine} took ${String(taken.files)} files from the build it ran`);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
note(`${error instanceof Error ? error.message : String(error)}; uploading the app instead`);
|
|
89
|
+
}
|
|
90
|
+
missing = (await call(host, "device-host.app.offer", offer)).missing;
|
|
91
|
+
}
|
|
92
|
+
await upload(host, ids, missing, content);
|
|
93
|
+
note(`Launching on ${host.machine}`);
|
|
94
|
+
let delivery = await call(host, "device-host.app.launch", ids);
|
|
95
|
+
const deadline = Date.now() + INSTALL_TIMEOUT_MS;
|
|
96
|
+
while (delivery.state !== "installed") {
|
|
97
|
+
if (delivery.state === "unknown") throw new Error(`${host.machine} could not install or launch the app${typeof delivery.notice === "string" ? `: ${delivery.notice}` : ""}.`);
|
|
98
|
+
if (Date.now() > deadline) throw new Error(`${host.machine} did not finish installing the app.`);
|
|
99
|
+
await sleep(500);
|
|
100
|
+
delivery = await call(host, "device-host.app.attach", ids);
|
|
101
|
+
}
|
|
102
|
+
const appliedArguments = validHostedAppArguments(delivery.arguments) ? delivery.arguments : [];
|
|
103
|
+
if (JSON.stringify(appliedArguments) !== JSON.stringify(requestedArguments)) note(`${host.machine} did not apply macos.arguments. Update stim-server on that host.`);
|
|
104
|
+
if (typeof delivery.notice === "string") note(delivery.notice);
|
|
105
|
+
return {
|
|
106
|
+
placement: {
|
|
107
|
+
...placement,
|
|
108
|
+
agent: agentAccess(agentRemoteConfig(root), host.credential, delivery.agent, note)
|
|
109
|
+
},
|
|
110
|
+
launched: delivery.launched === true ? true : "unverified",
|
|
111
|
+
arguments: appliedArguments
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** Stops a recorded hosted session and waits until the host confirms it stopped; anything else is a failure. */
|
|
115
|
+
async function stopHostedMacos(root, placement) {
|
|
116
|
+
if (placement.agent.driver === "agent-device") closeAgentConnection(placement.agent.remoteConfig);
|
|
117
|
+
const host = await connectHost(placement.machine);
|
|
118
|
+
try {
|
|
119
|
+
try {
|
|
120
|
+
let session = hostedSession(host, await call(host, "device-host.stop", { session: placement.session }));
|
|
121
|
+
session = await settle(host, session, ["stopping"], SESSION_TIMEOUT_MS);
|
|
122
|
+
if (session.state !== "stopped") throw unknownSession(host, session);
|
|
123
|
+
await pullHostedMacosLogs(root, placement, host).catch((error) => {
|
|
124
|
+
process.stderr.write(`${phaseLine("device", `Could not copy the final logs from ${host.machine}: ${error.message}`)}\n`);
|
|
125
|
+
});
|
|
126
|
+
} catch (error) {
|
|
127
|
+
if (!heldNoLonger(error)) throw error;
|
|
128
|
+
}
|
|
129
|
+
} finally {
|
|
130
|
+
host.connection.close();
|
|
131
|
+
}
|
|
132
|
+
rmSync(agentRemoteConfig(root), { force: true });
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
export { stopHostedMacos as n, placeHostedMacos as t };
|