stim 1.3.1 → 1.4.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.
Files changed (63) hide show
  1. package/README.md +13 -0
  2. package/dist/{android-CT-PkXUh.mjs → android-BTR1KTMP.mjs} +197 -114
  3. package/dist/{android-hMj83VpN.mjs → android-BkM4qTaN.mjs} +65 -72
  4. package/dist/{android-cas-DXorPCi_.mjs → android-cas-BjLRZyks.mjs} +15 -12
  5. package/dist/{app-install-DIp9riNx.mjs → app-install--PAocWvq.mjs} +2 -2
  6. package/dist/{build-slots-C4AouyNz.mjs → build-slots-D6sDzOe-.mjs} +7 -8
  7. package/dist/{cache-manifest-CXR-Y8pH.mjs → cache-manifest-D02TpYjA.mjs} +1 -1
  8. package/dist/cache-manifest.mjs +1 -1
  9. package/dist/cli.mjs +14 -13
  10. package/dist/collector-run.mjs +4 -4
  11. package/dist/{command-output-8wHMEde0.mjs → command-output-BuIb_ZOI.mjs} +1 -4
  12. package/dist/{config-CcefMY2Q.mjs → config-6vdGngKa.mjs} +51 -51
  13. package/dist/dependency-state-BMirHEPD.mjs +76 -0
  14. package/dist/{deps-0Yt0Inly.mjs → deps-Ck4wuTwa.mjs} +1 -1
  15. package/dist/{dev-client-VfSZNLT4.mjs → dev-client-Cd0v7iZk.mjs} +12 -12
  16. package/dist/{device-Bbv45Z9Z.mjs → device-CKXLnRRb.mjs} +7 -7
  17. package/dist/{xcode-xnxyvJkD.mjs → device-CMDFzx7C.mjs} +208 -967
  18. package/dist/{device-lease-CJwK7OZr.mjs → device-lease-DDJr85OK.mjs} +3 -3
  19. package/dist/{device-pool-CcBNTvM7.mjs → device-pool-DJvbIBGW.mjs} +4 -4
  20. package/dist/{device-remote-DAA0Zm6Z.mjs → device-remote-CMfHhoc8.mjs} +7 -6
  21. package/dist/{doctor-B4EITgQB.mjs → doctor-B_mfURdt.mjs} +536 -114
  22. package/dist/{error-diagnostics-DwhNBFDU.mjs → error-diagnostics-_VmkqRZo.mjs} +7 -6
  23. package/dist/{gc-BRu62v4o.mjs → gc-0AyxmECv.mjs} +61 -27
  24. package/dist/{guide-D95E0u3i.mjs → guide-CGxdmQ0K.mjs} +126 -7
  25. package/dist/{ios-DAju3TVy.mjs → ios-CtmGLx3X.mjs} +2667 -2607
  26. package/dist/{ios-device-CWOM_S44.mjs → ios-device-DJOi9FR5.mjs} +1 -1
  27. package/dist/{logs-CAdwW6c2.mjs → logs-BF3qPA7w.mjs} +5 -5
  28. package/dist/metro-DFLmaVz8.mjs +99 -0
  29. package/dist/named-ports-BO7Zpjp0.mjs +137 -0
  30. package/dist/{ownership-8O073GIC.mjs → ownership-BvSpZVBk.mjs} +5 -5
  31. package/dist/{ownership-DXcol4oU.mjs → ownership-C08Yzrp7.mjs} +6 -6
  32. package/dist/ports-BiKqP92J.mjs +39 -0
  33. package/dist/ports-ClqG8GPt.mjs +90 -0
  34. package/dist/{project-fKmuIaMI.mjs → project-CBFCwnN5.mjs} +2 -2
  35. package/dist/{reclaim-CUmwucWG.mjs → reclaim-DpDVo-AP.mjs} +20 -13
  36. package/dist/{reload-CWpXoOgN.mjs → reload-ByTqg6ZI.mjs} +8 -8
  37. package/dist/rolldown-runtime-BsOwBuO_.mjs +30 -0
  38. package/dist/{server-bare-DEzPZLvf.mjs → server-bare-Buk-k8tI.mjs} +3 -6
  39. package/dist/{server-expo-DizT4OMk.mjs → server-expo-D4P7iTvf.mjs} +3 -3
  40. package/dist/server-expo-Dho5Raiw.mjs +2 -0
  41. package/dist/{settings-DEJf6_kJ.mjs → settings-DwfltIXQ.mjs} +2 -2
  42. package/dist/{slot-launch-CZklomj6.mjs → slot-launch-DeKen9e5.mjs} +4 -4
  43. package/dist/{start-B5G4NjiA.mjs → start-BpKUHcU_.mjs} +15 -13
  44. package/dist/state-CDbvmZdt.mjs +131 -0
  45. package/dist/{stats-BR-kwj0B.mjs → stats-C59QLKm2.mjs} +1 -1
  46. package/dist/{stats-CaaQr4yN.mjs → stats-k5qMjyxo.mjs} +4 -4
  47. package/dist/{status-CI9clRSb.mjs → status-Y2ij3dm6.mjs} +12 -11
  48. package/dist/{stop-CjlgDk0a.mjs → stop-_P2OQwmZ.mjs} +15 -14
  49. package/dist/{stop-CQhffpmX.mjs → stop-vKmmxhea.mjs} +2 -2
  50. package/dist/supervisor-run.d.mts +3 -27
  51. package/dist/supervisor-run.mjs +7 -6
  52. package/dist/{teardown--gESs9ck.mjs → teardown-KsPpvldq.mjs} +148 -109
  53. package/dist/{workspace-process-lock-IBj1Towr.mjs → workspace-process-lock-UEIrvZMJ.mjs} +4 -4
  54. package/dist/workspace-state-Do1e2mOH.mjs +146 -0
  55. package/dist/{worktree-DtQGO9-s.mjs → worktree-BvcAIMdJ.mjs} +24 -25
  56. package/dist/{worktree-Eq6TLH8N.mjs → worktree-DWNx4tUg.mjs} +32 -2
  57. package/dist/xcode-D9tVItl-.mjs +860 -0
  58. package/package.json +7 -7
  59. package/dist/doctor-BueDfLYG.mjs +0 -530
  60. package/dist/metro-CORqXyTL.mjs +0 -184
  61. package/dist/ownership-claim-BtPtJVmq.mjs +0 -584
  62. package/dist/server-expo-44em5Pmg.mjs +0 -2
  63. package/dist/state-B3XA2wp2.mjs +0 -268
@@ -1,7 +1,7 @@
1
- import { f as getProject } from "./config-CcefMY2Q.mjs";
2
- import { p as readWorkspaceState } from "./state-B3XA2wp2.mjs";
3
- import { h as deviceShellArg } from "./app-install-DIp9riNx.mjs";
4
- import { n as fileLeaseIo } from "./device-lease-CJwK7OZr.mjs";
1
+ import { f as getProject } from "./config-6vdGngKa.mjs";
2
+ import { r as readWorkspaceState } from "./workspace-state-Do1e2mOH.mjs";
3
+ import { h as deviceShellArg } from "./app-install--PAocWvq.mjs";
4
+ import { n as fileLeaseIo } from "./device-lease-DDJr85OK.mjs";
5
5
  //#region src/engine/slot-launch.ts
6
6
  function launchSlotScope(root, slot = "default") {
7
7
  if (slot !== "default") return slot;
@@ -1,18 +1,20 @@
1
1
  import { t as getExecutor } from "./exec-CyylIdq9.mjs";
2
- import { E as inspectProcessIdentity, O as waitForProcessExit, S as upsertProject, T as captureProcessToken, a as clearSupervisor, f as getProject } from "./config-CcefMY2Q.mjs";
3
- import { C as supervisorLogFile, D as workspaceLogsDir, _ as writeWorkspaceState, c as readMetroTunnel, i as clearManagedMetroTunnel, p as readWorkspaceState, s as clearWorkspaceSupervisor, y as ensureWorkspaceStorage } from "./state-B3XA2wp2.mjs";
4
- import { g as repoRoot, s as gitCommonDir } from "./worktree-Eq6TLH8N.mjs";
5
- import { a as findProjectRoot, i as detectIsExpo, n as detectAndroidPackage, r as detectBundleId, t as appProjectProblem } from "./project-fKmuIaMI.mjs";
2
+ import { S as upsertProject, a as clearSupervisor, f as getProject, w as process_identity_exports } from "./config-6vdGngKa.mjs";
3
+ import { _ as workspaceLogsDir, c as ensureWorkspaceStorage, f as supervisorLogFile, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-Do1e2mOH.mjs";
4
+ import { _ as repoRoot, s as gitCommonDir } from "./worktree-DWNx4tUg.mjs";
5
+ import { a as findProjectRoot, i as detectIsExpo, n as detectAndroidPackage, r as detectBundleId, t as appProjectProblem } from "./project-CBFCwnN5.mjs";
6
6
  import { n as supervisorError } from "./errors-B6W7FkxQ.mjs";
7
- import { i as resolveProjectMetro, n as killMetroTree, o as reserveMetroPort, r as pidExists } from "./metro-CORqXyTL.mjs";
8
- import { g as stepTimer, l as phaseLine } from "./command-output-8wHMEde0.mjs";
9
- import { A as resolveSettings, D as remoteDeviceSettingError, E as remoteAndroidSetting, F as tunnelModeSetting, I as unknownSettingKeys, L as PUBLIC_METRO_ENV, N as settingShapeErrors, O as remoteIosSetting, R as detectProviders, S as ngrokUrlSetting, T as publicUrlSetting, a as SETTING_SHAPE_REMEDY, b as metroTunnelSettingError, d as cacheProviderSettingError, k as resolveCacheProviderConfig, z as planMetroReach } from "./settings-DEJf6_kJ.mjs";
7
+ import { i as clearManagedMetroTunnel, o as clearWorkspaceSupervisor, s as readMetroTunnel } from "./state-CDbvmZdt.mjs";
8
+ import { r as reserveMetroPort } from "./ports-ClqG8GPt.mjs";
9
+ import { i as resolveProjectMetro, n as killMetroTree, r as pidExists } from "./metro-DFLmaVz8.mjs";
10
+ import { g as stepTimer, l as phaseLine } from "./command-output-BuIb_ZOI.mjs";
11
+ import { A as resolveSettings, D as remoteDeviceSettingError, E as remoteAndroidSetting, F as tunnelModeSetting, I as unknownSettingKeys, L as PUBLIC_METRO_ENV, N as settingShapeErrors, O as remoteIosSetting, R as detectProviders, S as ngrokUrlSetting, T as publicUrlSetting, a as SETTING_SHAPE_REMEDY, b as metroTunnelSettingError, d as cacheProviderSettingError, k as resolveCacheProviderConfig, z as planMetroReach } from "./settings-DwfltIXQ.mjs";
10
12
  import { n as expoMetroConfigPath } from "./metro-store-CDDZHtPl.mjs";
11
- import { o as expoSdkMajor } from "./server-expo-DizT4OMk.mjs";
12
- import { n as workspaceProcessLockError, t as withWorkspaceProcessLock } from "./workspace-process-lock-IBj1Towr.mjs";
13
+ import { o as expoSdkMajor } from "./server-expo-D4P7iTvf.mjs";
14
+ import { n as workspaceProcessLockError, t as withWorkspaceProcessLock } from "./workspace-process-lock-UEIrvZMJ.mjs";
13
15
  import { t as spawnEntry } from "./spawn-entry-nCE6m770.mjs";
14
16
  import { c as queryLogs } from "./logs-query-Cdp5aaCH.mjs";
15
- import { a as withManagedRemoteWorktreeLock, i as terminateChild, n as startTunnelSequence, r as stopTunnel, s as withManagedTunnelLock, t as resolveSupervisorTarget } from "./ownership-DXcol4oU.mjs";
17
+ import { a as withManagedRemoteWorktreeLock, i as terminateChild, n as startTunnelSequence, r as stopTunnel, s as withManagedTunnelLock, t as resolveSupervisorTarget } from "./ownership-C08Yzrp7.mjs";
16
18
  import { mkdirSync, openSync, readFileSync } from "node:fs";
17
19
  import { randomUUID } from "node:crypto";
18
20
  import { dirname } from "node:path";
@@ -35,7 +37,7 @@ async function resetMetroCache(root) {
35
37
  pid: target.pid,
36
38
  processToken: target.processToken
37
39
  };
38
- if (!killMetroTree(target.pid, target.processToken) || !await waitForProcessExit(expected, 1e4)) throw supervisorError("STIM_SUPERVISOR_EXITED", "The owned Metro supervisor could not be stopped for a cache reset.", "Inspect `stim status` and `stim logs`, then retry. No cache reset was recorded.");
40
+ if (!killMetroTree(target.pid, target.processToken) || !await (0, process_identity_exports.waitForProcessExit)(expected, 1e4)) throw supervisorError("STIM_SUPERVISOR_EXITED", "The owned Metro supervisor could not be stopped for a cache reset.", "Inspect `stim status` and `stim logs`, then retry. No cache reset was recorded.");
39
41
  if (port && !(await resolveProjectMetro(port, root)).missing) throw supervisorError("STIM_SUPERVISOR_EXITED", `Port ${port} is still occupied after stopping Metro.`, "Inspect the listener before retrying. Stim does not terminate unrecorded processes.");
40
42
  clearWorkspaceSupervisor(root, expected);
41
43
  clearSupervisor(root, expected);
@@ -62,7 +64,7 @@ function parseWait(value) {
62
64
  if (!Number.isFinite(seconds) || seconds <= 0) return { error: `Invalid --wait value ${JSON.stringify(value)}. Pass a number of seconds, e.g. --wait 90.` };
63
65
  return { seconds };
64
66
  }
65
- function liveSupervisor({ state, project, port, isAlive = pidExists, inspectIdentity = inspectProcessIdentity } = {}) {
67
+ function liveSupervisor({ state, project, port, isAlive = pidExists, inspectIdentity = process_identity_exports.inspectProcessIdentity } = {}) {
66
68
  const target = resolveSupervisorTarget({
67
69
  state: state?.supervisor,
68
70
  record: project?.supervisor,
@@ -488,7 +490,7 @@ function registerStart(program, overrides = {}) {
488
490
  }
489
491
  const handoffRecord = {
490
492
  pid: child.pid,
491
- processToken: child.pid ? captureProcessToken(child.pid) : null,
493
+ processToken: child.pid ? (0, process_identity_exports.captureProcessToken)(child.pid) : null,
492
494
  port,
493
495
  mode: isExpo ? "expo-child" : "bare-inproc",
494
496
  startedAt: new Date(spawnedTs ?? Date.now()).toISOString()
@@ -0,0 +1,131 @@
1
+ import { I as parseDeviceSlotKey, P as deviceSlotKey, w as process_identity_exports } from "./config-6vdGngKa.mjs";
2
+ import { a as withWorkspaceStateLock, i as updateWorkspaceState, p as supervisorPidFile, r as readWorkspaceState, t as clearWorkspaceStateKey, y as workspaceStateFile } from "./workspace-state-Do1e2mOH.mjs";
3
+ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4
+ import { dirname } from "node:path";
5
+ //#region src/supervisor/state.ts
6
+ const MODE_BARE = "bare-inproc";
7
+ const MODE_EXPO = "expo-child";
8
+ function readMetroTunnel(root) {
9
+ const record = readWorkspaceState(root)?.metroTunnel;
10
+ if (!record || typeof record !== "object") return null;
11
+ const kind = record.kind;
12
+ const url = record.url;
13
+ if (typeof url !== "string" || url.length === 0) return null;
14
+ if (kind === "expo") return {
15
+ kind: "expo",
16
+ url
17
+ };
18
+ if (kind === "managed") {
19
+ const provider = record.provider;
20
+ const pid = record.pid;
21
+ const port = record.port;
22
+ const startedAt = record.startedAt;
23
+ const processToken = record.processToken;
24
+ const logFile = record.logFile;
25
+ if (provider !== "ngrok" && provider !== "cloudflared" || typeof pid !== "number" || typeof port !== "number") return null;
26
+ return {
27
+ kind: "managed",
28
+ provider,
29
+ pid,
30
+ url,
31
+ port,
32
+ startedAt: typeof startedAt === "string" ? startedAt : "",
33
+ processToken: typeof processToken === "string" && processToken.length > 0 ? processToken : null,
34
+ ...typeof logFile === "string" && logFile.length > 0 ? { logFile } : {}
35
+ };
36
+ }
37
+ return null;
38
+ }
39
+ function parseWorkspaceLaunchRecord(value) {
40
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
41
+ const record = value;
42
+ if (typeof record.appId !== "string" || record.appId.length === 0) return null;
43
+ if (typeof record.deviceId !== "string" || record.deviceId.length === 0) return null;
44
+ if (record.metroPort !== null && typeof record.metroPort !== "number") return null;
45
+ if (typeof record.release !== "boolean") return null;
46
+ if (typeof record.launchedAt !== "string") return null;
47
+ return record;
48
+ }
49
+ function readWorkspaceLaunches(root) {
50
+ const launches = readWorkspaceState(root)?.launches;
51
+ if (!launches || typeof launches !== "object" || Array.isArray(launches)) return {};
52
+ const records = {};
53
+ for (const [key, value] of Object.entries(launches)) {
54
+ const record = parseWorkspaceLaunchRecord(value);
55
+ if (parseDeviceSlotKey(key) && record) records[key] = record;
56
+ }
57
+ return records;
58
+ }
59
+ function writeWorkspaceLaunch(root, platform, record, slot = "default") {
60
+ updateWorkspaceState(root, (state) => {
61
+ const launches = state.launches && typeof state.launches === "object" ? state.launches : {};
62
+ return {
63
+ ...state,
64
+ launches: {
65
+ ...launches,
66
+ [deviceSlotKey(platform, slot)]: record
67
+ }
68
+ };
69
+ });
70
+ }
71
+ function readRemoteSession(root) {
72
+ const record = readWorkspaceState(root)?.remoteDevice;
73
+ if (!record || typeof record !== "object") return null;
74
+ const id = record.sessionId;
75
+ if (typeof id !== "string" || id.length === 0) return null;
76
+ const platform = record.platform;
77
+ const startedAt = record.startedAt;
78
+ return {
79
+ platform: platform === "ios" || platform === "android" ? platform : null,
80
+ sessionId: id,
81
+ startedAt: typeof startedAt === "string" ? startedAt : null
82
+ };
83
+ }
84
+ function readRemoteSessionId(root) {
85
+ return readRemoteSession(root)?.sessionId ?? null;
86
+ }
87
+ function clearRemoteSession(root, expectedSessionId) {
88
+ clearWorkspaceStateKey(root, "remoteDevice", (value) => {
89
+ if (typeof value !== "object" || value === null) return false;
90
+ return value.sessionId === expectedSessionId;
91
+ });
92
+ }
93
+ function clearWorkspaceSupervisor(root, expected) {
94
+ return withWorkspaceStateLock(root, () => {
95
+ const current = readWorkspaceState(root)?.supervisor;
96
+ if (current && expected !== void 0 && !(0, process_identity_exports.sameProcessRecord)(current, expected)) return false;
97
+ clearWorkspaceStateKey(root, "supervisor", () => true);
98
+ clearExpoMetroTunnel(root);
99
+ if (expected === void 0 || readPidFile(root) === expected?.pid) rmSync(supervisorPidFile(root), { force: true });
100
+ return true;
101
+ });
102
+ }
103
+ function clearExpoMetroTunnel(root) {
104
+ clearWorkspaceStateKey(root, "metroTunnel", (value) => {
105
+ return typeof value === "object" && value !== null && value.kind === "expo";
106
+ });
107
+ }
108
+ function clearManagedMetroTunnel(root, expected) {
109
+ if (!existsSync(workspaceStateFile(root))) return true;
110
+ return clearWorkspaceStateKey(root, "metroTunnel", (value) => {
111
+ if (typeof value !== "object" || value === null) return false;
112
+ const record = value;
113
+ return record.kind === "managed" && record.provider === expected.provider && record.pid === expected.pid && record.url === expected.url && record.port === expected.port && record.startedAt === expected.startedAt && (record.processToken ?? null) === (expected.processToken ?? null) && (record.logFile ?? null) === (expected.logFile ?? null);
114
+ });
115
+ }
116
+ function writePidFile(root, pid) {
117
+ const file = supervisorPidFile(root);
118
+ mkdirSync(dirname(file), { recursive: true });
119
+ writeFileSync(file, `${pid}\n`);
120
+ return file;
121
+ }
122
+ function readPidFile(root) {
123
+ try {
124
+ const pid = parseInt(readFileSync(supervisorPidFile(root), "utf-8").trim(), 10);
125
+ return Number.isFinite(pid) ? pid : null;
126
+ } catch {
127
+ return null;
128
+ }
129
+ }
130
+ //#endregion
131
+ export { clearRemoteSession as a, readPidFile as c, readWorkspaceLaunches as d, writePidFile as f, clearManagedMetroTunnel as i, readRemoteSession as l, MODE_EXPO as n, clearWorkspaceSupervisor as o, writeWorkspaceLaunch as p, clearExpoMetroTunnel as r, readMetroTunnel as s, MODE_BARE as t, readRemoteSessionId as u };
@@ -1,4 +1,4 @@
1
- import { C as withConfigLock, u as getConfigDir } from "./config-CcefMY2Q.mjs";
1
+ import { C as withConfigLock, u as getConfigDir } from "./config-6vdGngKa.mjs";
2
2
  import { readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
3
3
  import { basename, dirname, join, relative, resolve } from "node:path";
4
4
  const PLATFORMS = ["ios", "android"];
@@ -1,7 +1,7 @@
1
- import { g as repoRoot, s as gitCommonDir } from "./worktree-Eq6TLH8N.mjs";
2
- import { a as findProjectRoot } from "./project-fKmuIaMI.mjs";
3
- import { o as formatLongDuration } from "./command-output-8wHMEde0.mjs";
4
- import { a as statsProjectKey, r as readStats } from "./stats-BR-kwj0B.mjs";
1
+ import { _ as repoRoot, s as gitCommonDir } from "./worktree-DWNx4tUg.mjs";
2
+ import { a as findProjectRoot } from "./project-CBFCwnN5.mjs";
3
+ import { o as formatLongDuration } from "./command-output-BuIb_ZOI.mjs";
4
+ import { a as statsProjectKey, r as readStats } from "./stats-C59QLKm2.mjs";
5
5
  import chalk from "chalk";
6
6
  //#region src/commands/stats.ts
7
7
  const PLATFORMS = ["ios", "android"];
@@ -1,17 +1,18 @@
1
1
  import { t as getExecutor } from "./exec-CyylIdq9.mjs";
2
- import { P as volumeRootFor, g as loadConfig, u as getConfigDir, z as projectDeviceSlots } from "./config-CcefMY2Q.mjs";
3
- import { D as workspaceLogsDir } from "./state-B3XA2wp2.mjs";
4
- import { f as listWorktrees } from "./worktree-Eq6TLH8N.mjs";
5
- import { a as findProjectRoot, c as projectShortcut } from "./project-fKmuIaMI.mjs";
6
- import { a as isMetroRunning, i as resolveProjectMetro } from "./metro-CORqXyTL.mjs";
7
- import { a as formatElapsed, r as clockTime, u as plural } from "./command-output-8wHMEde0.mjs";
8
- import { N as resolveOwnedAvdSerial } from "./android-hMj83VpN.mjs";
9
- import { a as POOL_SETTING_REMEDY, c as parkedMaxSetting, l as readParked } from "./teardown--gESs9ck.mjs";
2
+ import { L as projectDeviceSlots, M as volumeRootFor, g as loadConfig, u as getConfigDir } from "./config-6vdGngKa.mjs";
3
+ import { _ as workspaceLogsDir } from "./workspace-state-Do1e2mOH.mjs";
4
+ import { f as listWorktrees } from "./worktree-DWNx4tUg.mjs";
5
+ import { a as findProjectRoot, c as projectShortcut } from "./project-CBFCwnN5.mjs";
6
+ import { t as isMetroRunning } from "./ports-ClqG8GPt.mjs";
7
+ import { i as resolveProjectMetro } from "./metro-DFLmaVz8.mjs";
8
+ import { a as formatElapsed, r as clockTime, u as plural } from "./command-output-BuIb_ZOI.mjs";
9
+ import { N as resolveOwnedAvdSerial } from "./android-BkM4qTaN.mjs";
10
+ import { a as POOL_SETTING_REMEDY, l as parkedMaxSetting, u as readParked } from "./teardown-KsPpvldq.mjs";
10
11
  import { u as listAllIosSims } from "./ios-Deh5js5V.mjs";
11
- import { i as listLeaseFiles } from "./device-lease-CJwK7OZr.mjs";
12
+ import { i as listLeaseFiles } from "./device-lease-DDJr85OK.mjs";
12
13
  import { c as queryLogs } from "./logs-query-Cdp5aaCH.mjs";
13
- import { t as resolveSupervisorTarget } from "./ownership-DXcol4oU.mjs";
14
- import { i as readSupervisorState } from "./stop-CjlgDk0a.mjs";
14
+ import { t as resolveSupervisorTarget } from "./ownership-C08Yzrp7.mjs";
15
+ import { i as readSupervisorState } from "./stop-_P2OQwmZ.mjs";
15
16
  import { existsSync } from "fs";
16
17
  import { totalmem } from "os";
17
18
  import chalk from "chalk";
@@ -1,14 +1,15 @@
1
- import { C as withConfigLock, D as sameProcessRecord, E as inspectProcessIdentity, L as deviceSlotPlatforms, O as waitForProcessExit, R as parseDeviceSlotKey, S as upsertProject, V as validateDeviceSlot, a as clearSupervisor, f as getProject, z as projectDeviceSlots } from "./config-CcefMY2Q.mjs";
2
- import { T as workspaceDir, _ as writeWorkspaceState, a as clearRemoteSession, c as readMetroTunnel, i as clearManagedMetroTunnel, m as withWorkspaceStateLock, o as clearWorkspaceStateKeys, p as readWorkspaceState, s as clearWorkspaceSupervisor, u as readRemoteSession } from "./state-B3XA2wp2.mjs";
3
- import { a as findProjectRoot } from "./project-fKmuIaMI.mjs";
4
- import { i as resolveProjectMetro, n as killMetroTree, r as pidExists } from "./metro-CORqXyTL.mjs";
5
- import { n as verifyCollectorOwnership } from "./ownership-8O073GIC.mjs";
6
- import { f as releasedLeaseFact, l as phaseLine, u as plural } from "./command-output-8wHMEde0.mjs";
7
- import { n as teardownOwnedIosSim, t as teardownOwnedAvd, x as resolveEasCliBin } from "./teardown--gESs9ck.mjs";
8
- import { t as withWorkspaceProcessLock } from "./workspace-process-lock-IBj1Towr.mjs";
9
- import { l as releaseWorkspaceLeases } from "./device-lease-CJwK7OZr.mjs";
10
- import { i as endRecordedSession } from "./device-remote-DAA0Zm6Z.mjs";
11
- import { r as stopTunnel, t as resolveSupervisorTarget } from "./ownership-DXcol4oU.mjs";
1
+ import { C as withConfigLock, F as deviceSlotPlatforms, I as parseDeviceSlotKey, L as projectDeviceSlots, S as upsertProject, a as clearSupervisor, f as getProject, w as process_identity_exports, z as validateDeviceSlot } from "./config-6vdGngKa.mjs";
2
+ import { a as withWorkspaceStateLock, h as workspaceDir, n as clearWorkspaceStateKeys, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-Do1e2mOH.mjs";
3
+ import { a as findProjectRoot } from "./project-CBFCwnN5.mjs";
4
+ import { a as clearRemoteSession, i as clearManagedMetroTunnel, l as readRemoteSession, o as clearWorkspaceSupervisor, s as readMetroTunnel } from "./state-CDbvmZdt.mjs";
5
+ import { i as resolveProjectMetro, n as killMetroTree, r as pidExists } from "./metro-DFLmaVz8.mjs";
6
+ import { n as verifyCollectorOwnership } from "./ownership-BvSpZVBk.mjs";
7
+ import { f as releasedLeaseFact, l as phaseLine, u as plural } from "./command-output-BuIb_ZOI.mjs";
8
+ import { S as resolveEasCliBin, n as teardownOwnedIosSim, t as teardownOwnedAvd } from "./teardown-KsPpvldq.mjs";
9
+ import { t as withWorkspaceProcessLock } from "./workspace-process-lock-UEIrvZMJ.mjs";
10
+ import { l as releaseWorkspaceLeases } from "./device-lease-DDJr85OK.mjs";
11
+ import { i as endRecordedSession } from "./device-remote-CMfHhoc8.mjs";
12
+ import { r as stopTunnel, t as resolveSupervisorTarget } from "./ownership-C08Yzrp7.mjs";
12
13
  import chalk from "chalk";
13
14
  //#region src/commands/stop.ts
14
15
  const DEFAULT_WAIT_MS = 1e4;
@@ -34,7 +35,7 @@ function clearCollectorState(root, expected) {
34
35
  clearWorkspaceStateKeys(root, ["collectors"]);
35
36
  return true;
36
37
  }
37
- for (const [platform, record] of Object.entries(expected ?? {})) if (sameProcessRecord(current[platform], record)) delete current[platform];
38
+ for (const [platform, record] of Object.entries(expected ?? {})) if ((0, process_identity_exports.sameProcessRecord)(current[platform], record)) delete current[platform];
38
39
  if (Object.keys(current).length) writeWorkspaceState(root, { collectors: current });
39
40
  else clearWorkspaceStateKeys(root, ["collectors"]);
40
41
  return Object.keys(current).length === 0;
@@ -142,12 +143,12 @@ async function runStop(options) {
142
143
  result.summary = summarize(root, result.outcomes, result.ok);
143
144
  return result;
144
145
  }
145
- async function stopWorkspace({ root, project = void 0, state = void 0, collectors = void 0, signalCollector = (pid) => process.kill(pid, "SIGTERM"), verifyCollector = verifyCollectorOwnership, clearCollectors = clearCollectorState, isAlive = pidExists, killGroup = killMetroTree, inspectIdentity = inspectProcessIdentity, waitForDeath = void 0, waitMs = DEFAULT_WAIT_MS, resolveMetro = resolveProjectMetro, teardownIos = teardownOwnedIosSim, teardownAvd = teardownOwnedAvd, remoteDevice = void 0, teardownRemoteSession = defaultTeardownRemoteSession, metroTunnel = void 0, stopMetroTunnel = stopTunnel, releaseLeases = releaseWorkspaceLeases, freePort = defaultFreePort, clearRegistration = defaultClearRegistration, clearState = clearSupervisorState, report = (line) => console.error(line) }) {
146
+ async function stopWorkspace({ root, project = void 0, state = void 0, collectors = void 0, signalCollector = (pid) => process.kill(pid, "SIGTERM"), verifyCollector = verifyCollectorOwnership, clearCollectors = clearCollectorState, isAlive = pidExists, killGroup = killMetroTree, inspectIdentity = process_identity_exports.inspectProcessIdentity, waitForDeath = void 0, waitMs = DEFAULT_WAIT_MS, resolveMetro = resolveProjectMetro, teardownIos = teardownOwnedIosSim, teardownAvd = teardownOwnedAvd, remoteDevice = void 0, teardownRemoteSession = defaultTeardownRemoteSession, metroTunnel = void 0, stopMetroTunnel = stopTunnel, releaseLeases = releaseWorkspaceLeases, freePort = defaultFreePort, clearRegistration = defaultClearRegistration, clearState = clearSupervisorState, report = (line) => console.error(line) }) {
146
147
  const proj = project === void 0 ? getProject(root) : project;
147
148
  const sup = state === void 0 ? readSupervisorState(root) : state;
148
149
  const collectorRecords = collectors === void 0 ? readCollectorState(root) : collectors;
149
150
  const reservedPort = typeof proj?.metroPort === "number" ? proj.metroPort : null;
150
- const waiter = waitForDeath ?? ((pid, processToken) => waitForProcessExit({
151
+ const waiter = waitForDeath ?? ((pid, processToken) => (0, process_identity_exports.waitForProcessExit)({
151
152
  pid,
152
153
  processToken
153
154
  }, waitMs));
@@ -1,3 +1,3 @@
1
- import { t as resolveSupervisorTarget } from "./ownership-DXcol4oU.mjs";
2
- import { a as resolveCollectorTargets, i as readSupervisorState, n as clearSupervisorState, o as runStop, r as readCollectorState, s as stopCommand, t as clearCollectorState } from "./stop-CjlgDk0a.mjs";
1
+ import { t as resolveSupervisorTarget } from "./ownership-C08Yzrp7.mjs";
2
+ import { a as resolveCollectorTargets, i as readSupervisorState, n as clearSupervisorState, o as runStop, r as readCollectorState, s as stopCommand, t as clearCollectorState } from "./stop-_P2OQwmZ.mjs";
3
3
  export { clearCollectorState, clearSupervisorState, stopCommand as default, readCollectorState, readSupervisorState, resolveCollectorTargets, resolveSupervisorTarget, runStop };
@@ -1,34 +1,10 @@
1
1
  import { t as NdjsonWriter } from "./ndjson-DvHSsNU9.mjs";
2
- //#region src/process-identity.d.ts
3
- interface ProcessRecord {
4
- pid?: unknown;
5
- processToken?: unknown;
6
- }
2
+ import * as import__stim_cli_core_process_identity from "@stim-cli/core/process-identity";
7
3
  //#endregion
8
4
  //#region src/supervisor/state.d.ts
9
5
  declare const MODE_BARE = "bare-inproc";
10
6
  declare const MODE_EXPO = "expo-child";
11
- interface WorkspaceState {
12
- metroCacheGeneration?: string;
13
- supervisor?: Record<string, unknown>;
14
- collectors?: Record<string, unknown>;
15
- lastBuild?: Record<string, unknown>;
16
- launches?: Record<string, WorkspaceLaunchRecord>;
17
- remoteDevice?: Record<string, unknown>;
18
- metroTunnel?: Record<string, unknown>;
19
- [key: string]: unknown;
20
- }
21
- interface WorkspaceLaunchRecord {
22
- appId: string;
23
- deviceId: string;
24
- metroPort: number | null;
25
- release: boolean;
26
- launchedAt: string;
27
- }
28
- declare function readWorkspaceState(root: string): WorkspaceState | null;
29
- declare function withWorkspaceStateLock<T>(root: string, fn: () => T): T;
30
- declare function writeWorkspaceState(root: string, patch: WorkspaceState): WorkspaceState;
31
- declare function clearWorkspaceSupervisor(root: string, expected?: ProcessRecord | null): boolean;
7
+ declare function clearWorkspaceSupervisor(root: string, expected?: process_identity_d_exports.ProcessRecord | null): boolean;
32
8
  declare function clearExpoMetroTunnel(root: string): void;
33
9
  declare function writePidFile(root: string, pid: number): string;
34
10
  declare function readPidFile(root: string): number | null;
@@ -80,4 +56,4 @@ declare function runSupervisor({ root, port, tunnel, isExpo, startBare, startExp
80
56
  } | null>;
81
57
  declare function main(argv?: string[]): Promise<void>;
82
58
  //#endregion
83
- export { MODE_BARE, MODE_EXPO, RunSupervisorOptions, ServerExitInfo, ServerHandle, type WorkspaceState, clearExpoMetroTunnel, clearWorkspaceSupervisor, main, parseArgs, readPidFile, readWorkspaceState, runSupervisor, withWorkspaceStateLock, writePidFile, writeWorkspaceState };
59
+ export { MODE_BARE, MODE_EXPO, RunSupervisorOptions, ServerExitInfo, ServerHandle, clearExpoMetroTunnel, clearWorkspaceSupervisor, main, parseArgs, readPidFile, runSupervisor, writePidFile };
@@ -1,8 +1,9 @@
1
- import { T as captureProcessToken, a as clearSupervisor, x as setSupervisor } from "./config-CcefMY2Q.mjs";
1
+ import { a as clearSupervisor, w as process_identity_exports, x as setSupervisor } from "./config-6vdGngKa.mjs";
2
2
  import { r as createNdjsonWriter } from "./ndjson-BZwI1NBv.mjs";
3
- import { D as workspaceLogsDir, _ as writeWorkspaceState, h as writePidFile, l as readPidFile, m as withWorkspaceStateLock, n as MODE_EXPO, p as readWorkspaceState, r as clearExpoMetroTunnel, s as clearWorkspaceSupervisor, t as MODE_BARE } from "./state-B3XA2wp2.mjs";
4
- import { i as detectIsExpo } from "./project-fKmuIaMI.mjs";
3
+ import { _ as workspaceLogsDir, a as withWorkspaceStateLock, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-Do1e2mOH.mjs";
4
+ import { i as detectIsExpo } from "./project-CBFCwnN5.mjs";
5
5
  import { t as describeError } from "./errors-B6W7FkxQ.mjs";
6
+ import { c as readPidFile, f as writePidFile, n as MODE_EXPO, o as clearWorkspaceSupervisor, r as clearExpoMetroTunnel, t as MODE_BARE } from "./state-CDbvmZdt.mjs";
6
7
  import { existsSync, realpathSync } from "node:fs";
7
8
  import { isAbsolute, join, resolve } from "node:path";
8
9
  import { fileURLToPath } from "node:url";
@@ -43,7 +44,7 @@ async function runSupervisor({ root, port, tunnel = false, isExpo = detectIsExpo
43
44
  const writer = createNdjsonWriter(join(logsDir, "metro.ndjson"));
44
45
  const mode = isExpo(root) ? MODE_EXPO : MODE_BARE;
45
46
  const startedAt = new Date(now()).toISOString();
46
- const processToken = captureProcessToken(process.pid);
47
+ const processToken = (0, process_identity_exports.captureProcessToken)(process.pid);
47
48
  if (!processToken) {
48
49
  stderr("Stim supervisor: could not capture process identity; refusing to start an unmanaged server.");
49
50
  writer.close();
@@ -97,7 +98,7 @@ async function runSupervisor({ root, port, tunnel = false, isExpo = detectIsExpo
97
98
  };
98
99
  let server;
99
100
  try {
100
- server = await (mode === "expo-child" ? startExpo || (await import("./server-expo-44em5Pmg.mjs")).startExpoServer : startBare || (await import("./server-bare-DEzPZLvf.mjs")).startBareServer)({
101
+ server = await (mode === "expo-child" ? startExpo || (await import("./server-expo-Dho5Raiw.mjs")).startExpoServer : startBare || (await import("./server-bare-Buk-k8tI.mjs")).startBareServer)({
101
102
  root,
102
103
  port,
103
104
  logsDir,
@@ -207,4 +208,4 @@ if (invokedDirectly()) main().catch((err) => {
207
208
  process.exit(1);
208
209
  });
209
210
  //#endregion
210
- export { MODE_BARE, MODE_EXPO, clearExpoMetroTunnel, clearWorkspaceSupervisor, main, parseArgs, readPidFile, readWorkspaceState, runSupervisor, withWorkspaceStateLock, writePidFile, writeWorkspaceState };
211
+ export { MODE_BARE, MODE_EXPO, clearExpoMetroTunnel, clearWorkspaceSupervisor, main, parseArgs, readPidFile, runSupervisor, writePidFile };