stim 1.8.0 → 1.10.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 +23 -155
- package/dist/{android-DWssqHQ8.mjs → android-787HhP5w.mjs} +168 -39
- package/dist/{android-BRgBYzU0.mjs → android-DBkeHwpm.mjs} +250 -200
- package/dist/{android-DeYdjjBP.mjs → android-DPov-fv2.mjs} +2 -2
- package/dist/{android-cas-SWIjzeuL.mjs → android-cas-CITmIeWY.mjs} +22 -14
- package/dist/android-cas-compiler.mjs +2 -2
- package/dist/app-install-CrJ6t_bv.mjs +819 -0
- package/dist/budget-BP4jZZL4.mjs +620 -0
- package/dist/build-progress-BXx-ZBe4.mjs +512 -0
- package/dist/{cache-manifest-CYJi8-Hx.mjs → cache-manifest-Pubfp8wV.mjs} +4 -4
- package/dist/cache-manifest.mjs +1 -1
- package/dist/cli.mjs +22 -19
- package/dist/collector-run.d.mts +7 -1
- package/dist/collector-run.mjs +10 -9
- package/dist/{command-output-B3ycpsYv.mjs → command-output-D5z2_bcF.mjs} +11 -2
- package/dist/{config-B7iyKWkL.mjs → config-BEq0Qw_a.mjs} +134 -121
- package/dist/{dependency-state-D0M7oKA7.mjs → dependency-state-r9UesA9a.mjs} +2 -2
- package/dist/{deps-oCXVNEqQ.mjs → deps-DP4eWqea.mjs} +8 -5
- package/dist/{detached-entry-Bpo6ZY_I.mjs → detached-entry-DJHoca49.mjs} +1 -1
- package/dist/{device-BUoZyMoR.mjs → dev-client-92U593KT.mjs} +1090 -660
- package/dist/{device-RdujjHLB.mjs → device-DhTZe7L4.mjs} +13 -20
- package/dist/{build-lock-CgtsB6TV.mjs → device-lease-CbEaIk7b.mjs} +481 -27
- package/dist/{device-pool-BxRwdufO.mjs → device-pool-Di8Q-9Ro.mjs} +7 -7
- package/dist/{device-remote-ByN8P6CB.mjs → device-remote-Dy1jGj3U.mjs} +645 -119
- package/dist/{doctor-BMt156qe.mjs → doctor-B-inAJmt.mjs} +137 -113
- package/dist/{error-diagnostics-D1Kaf-eT.mjs → error-diagnostics-xxWKNO3-.mjs} +22 -17
- package/dist/exec-DK8KaVHK.mjs +133 -0
- package/dist/{gc-v2YcoJvm.mjs → gc-ChPFZMRC.mjs} +836 -813
- package/dist/{guide-BTAlD1_y.mjs → guide-DwmaD_Wa.mjs} +953 -209
- package/dist/guide-status-CWvti2Lg.mjs +125 -0
- package/dist/idle-DpRLp5lj.mjs +157 -0
- package/dist/{build-slots-C-oAHRT1.mjs → in-use-CjUluqIX.mjs} +102 -8
- package/dist/{ios-BcCiI4TS.mjs → ios-B2Fpqvlb.mjs} +60 -71
- package/dist/{ios-BP04pY5f.mjs → ios-Dd-hYJBh.mjs} +241 -234
- package/dist/{ios-device-CFXA46ez.mjs → ios-device-BiOsSVzd.mjs} +3 -2
- package/dist/{ios-device-CauFJiYx.mjs → ios-device-CtRdEVjx.mjs} +149 -52
- package/dist/launch-verify-CQS_Kg-C.mjs +365 -0
- package/dist/{logs-CakdBTtm.mjs → logs-MARIy6m9.mjs} +20 -15
- package/dist/metro-BWLOJ_Wr.mjs +409 -0
- package/dist/{named-ports-DzMOlmaX.mjs → named-ports-DiTfSz6p.mjs} +4 -4
- package/dist/{ndjson-BZwI1NBv.mjs → ndjson-CDY9IkVC.mjs} +23 -43
- package/dist/{ndjson-DvHSsNU9.d.mts → ndjson-Du3j0AQ9.d.mts} +1 -0
- package/dist/{ownership-Cp52QAK1.mjs → ownership-D2xbLVoz.mjs} +2 -3
- package/dist/{teardown-BJqEzPo_.mjs → ownership-DZjdx8Gq.mjs} +664 -612
- package/dist/{ports-BIbJaKNW.mjs → ports-CLSSFOuz.mjs} +3 -3
- package/dist/{process-output-Dl5uKE03.mjs → process-output-Fpl8PYi8.mjs} +1 -1
- package/dist/{project-DDZWf_16.mjs → project-BXZzOABt.mjs} +8 -3
- package/dist/{reload-BdypPbjM.mjs → reload-DoETJ3rl.mjs} +11 -13
- package/dist/{server-bare-BQkyxa_b.mjs → server-bare-DVbb7kXH.mjs} +2 -2
- package/dist/{server-expo-BVAA1OqJ.mjs → server-expo-BvOCeakp.mjs} +8 -7
- package/dist/server-expo-DBVTdult.mjs +2 -0
- package/dist/{settings-BXXorVM2.mjs → settings-DOugPlPz.mjs} +59 -159
- package/dist/settings-EWYNwe72.mjs +378 -0
- package/dist/settings.schema.json +1064 -0
- package/dist/simslim-Ca3487H6.mjs +436 -0
- package/dist/{slot-launch-ZUUe0TQP.mjs → slot-launch-C5cg0fmk.mjs} +4 -4
- package/dist/spawn-claims-CUleC2cM.mjs +49 -0
- package/dist/{start-CmxtOKjU.mjs → start-F9gv5dcC.mjs} +159 -114
- package/dist/start-VoFsPSes.mjs +2 -0
- package/dist/{state-DZobzxLW.mjs → state-WGdIbi_d.mjs} +5 -3
- package/dist/{stats-BYcZ6n1h.mjs → stats-BAgJaLA4.mjs} +66 -5
- package/dist/{stats-CLg5RuDS.mjs → stats-DBYJ5bxL.mjs} +4 -4
- package/dist/status-DLCD-o3s.mjs +764 -0
- package/dist/status-Dr4fRkym.mjs +216 -0
- package/dist/{guide-status-Craq9z0t.mjs → stim-installations-CINXy_su.mjs} +3 -122
- package/dist/{stop-C8JW6kKp.mjs → stop-Dj4pfmyv.mjs} +111 -31
- package/dist/{stop-B1kOpYei.mjs → stop-ZvOeTmKb.mjs} +2 -2
- package/dist/supervisor-run.d.mts +11 -2
- package/dist/supervisor-run.mjs +228 -42
- package/dist/{workspace-process-lock-BYfZz_S-.mjs → workspace-process-lock-BXA96myD.mjs} +14 -9
- package/dist/workspaces-BTUyFfkv.mjs +1003 -0
- package/dist/worktree-4aZg2NnI.mjs +2 -0
- package/dist/{worktree-CFLA-6MX.mjs → worktree-BMS7GeqB.mjs} +523 -61
- package/dist/{worktree-FG_ZKKdb.mjs → worktree-BlizKDpZ.mjs} +200 -54
- package/dist/{xcode-B6YaWeg0.mjs → xcode-B2tBkf0m.mjs} +66 -57
- package/package.json +6 -6
- package/skill/SKILL.md +2 -0
- package/dist/app-install-BDbsSgCl.mjs +0 -1175
- package/dist/dev-client-BmT-ioFI.mjs +0 -797
- package/dist/device-lease-Ffz_M5t0.mjs +0 -359
- package/dist/exec-B29XNuhP.mjs +0 -77
- package/dist/logs-query-BGL-Pl12.mjs +0 -290
- package/dist/metro-C7bcJ0uo.mjs +0 -233
- package/dist/ownership-wolE-0Do.mjs +0 -470
- package/dist/public-http-probe-CyMDrQ3c.mjs +0 -61
- package/dist/reclaim-KJ-0uWEF.mjs +0 -361
- package/dist/server-expo-YDDG3eP7.mjs +0 -2
- package/dist/spawn-entry-nCE6m770.mjs +0 -14
- package/dist/status-DdkLki47.mjs +0 -426
- package/dist/workspace-state-BT5E3SA2.mjs +0 -146
- package/dist/{metro-store-CDDZHtPl.mjs → metro-store-DzeWkfqW.mjs} +1 -1
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
import { E as ownership_claim_exports, R as projectDeviceSlots, T as acquireAvdClaim, f as getProject, v as removeProject, w as process_identity_exports } from "./config-B7iyKWkL.mjs";
|
|
2
|
-
import { h as workspaceDir, r as readWorkspaceState } from "./workspace-state-BT5E3SA2.mjs";
|
|
3
|
-
import { a as clearRemoteSession, i as clearManagedMetroTunnel, s as readMetroTunnel, u as readRemoteSessionId } from "./state-DZobzxLW.mjs";
|
|
4
|
-
import { a as resolveProjectMetro, i as pidExists, n as killMetroTree } from "./metro-C7bcJ0uo.mjs";
|
|
5
|
-
import { n as verifyCollectorOwnership } from "./ownership-Cp52QAK1.mjs";
|
|
6
|
-
import { S as resolveEasCliBin, l as parkedMaxSetting, n as teardownOwnedIosSim, t as teardownOwnedAvd } from "./teardown-BJqEzPo_.mjs";
|
|
7
|
-
import { l as releaseWorkspaceLeases } from "./device-lease-Ffz_M5t0.mjs";
|
|
8
|
-
import { i as endRecordedSession } from "./device-remote-ByN8P6CB.mjs";
|
|
9
|
-
import { t as clearNamedPorts } from "./named-ports-DzMOlmaX.mjs";
|
|
10
|
-
import { r as stopTunnel, t as resolveSupervisorTarget } from "./ownership-wolE-0Do.mjs";
|
|
11
|
-
import { existsSync, rmSync } from "node:fs";
|
|
12
|
-
//#region src/devices/reclaim.ts
|
|
13
|
-
async function reapCollectors(root, { verify = verifyCollectorOwnership, collectors }) {
|
|
14
|
-
const skippedDevices = [];
|
|
15
|
-
const failedDevices = [];
|
|
16
|
-
for (const [platform, record] of Object.entries(collectors)) {
|
|
17
|
-
const rec = record;
|
|
18
|
-
const pid = rec?.pid;
|
|
19
|
-
if (typeof pid !== "number" || pid <= 0 || pid === process.pid || !pidExists(pid)) continue;
|
|
20
|
-
const ownership = verify({
|
|
21
|
-
pid,
|
|
22
|
-
platform,
|
|
23
|
-
root,
|
|
24
|
-
expected: rec
|
|
25
|
-
});
|
|
26
|
-
if (ownership.status === "gone") continue;
|
|
27
|
-
if (ownership.status === "unverified") {
|
|
28
|
-
const name = `${platform} log collector (pid ${pid})`;
|
|
29
|
-
const entry = {
|
|
30
|
-
platform: platform.split(":")[0] === "android" ? "android" : "ios",
|
|
31
|
-
name,
|
|
32
|
-
reason: `${ownership.reason}; keeping the record without signalling the process`
|
|
33
|
-
};
|
|
34
|
-
skippedDevices.push(entry);
|
|
35
|
-
failedDevices.push(entry);
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
try {
|
|
39
|
-
process.kill(pid, "SIGTERM");
|
|
40
|
-
if (await (0, process_identity_exports.waitForProcessExit)(rec, 5e3)) continue;
|
|
41
|
-
} catch (error) {
|
|
42
|
-
if (error.code === "ESRCH") continue;
|
|
43
|
-
}
|
|
44
|
-
const entry = {
|
|
45
|
-
platform: platform.split(":")[0] === "android" ? "android" : "ios",
|
|
46
|
-
name: `${platform} log collector (pid ${pid})`,
|
|
47
|
-
reason: "Collector exit could not be confirmed; keeping its ownership record."
|
|
48
|
-
};
|
|
49
|
-
skippedDevices.push(entry);
|
|
50
|
-
failedDevices.push(entry);
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
skippedDevices,
|
|
54
|
-
failedDevices
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function reclaimRemoteSession(root, { stopSession = defaultStopSession } = {}) {
|
|
58
|
-
const sessionId = readRemoteSessionId(root);
|
|
59
|
-
if (!sessionId) return {
|
|
60
|
-
stopped: null,
|
|
61
|
-
failed: null
|
|
62
|
-
};
|
|
63
|
-
let result;
|
|
64
|
-
try {
|
|
65
|
-
result = stopSession(root, sessionId);
|
|
66
|
-
} catch (err) {
|
|
67
|
-
result = {
|
|
68
|
-
status: "failed",
|
|
69
|
-
reason: String(err?.message ?? err)
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
if (result.status === "torn-down") {
|
|
73
|
-
if (result.reason) return {
|
|
74
|
-
stopped: sessionId,
|
|
75
|
-
failed: {
|
|
76
|
-
platform: "ios",
|
|
77
|
-
name: `remote session ${sessionId}`,
|
|
78
|
-
reason: `${result.reason} The session is stopped. Re-run cleanup to reconcile its retained ownership claim.`
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
clearRemoteSession(root, sessionId);
|
|
82
|
-
return {
|
|
83
|
-
stopped: sessionId,
|
|
84
|
-
failed: null
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
stopped: null,
|
|
89
|
-
failed: {
|
|
90
|
-
platform: "ios",
|
|
91
|
-
name: `remote session ${sessionId}`,
|
|
92
|
-
reason: `${result.reason ?? "stop failed"} -- it keeps billing until its max duration. Stop it by hand from any directory of this project: eas simulator:stop --id ${sessionId}`
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function defaultStopSession(root, sessionId) {
|
|
97
|
-
return endRecordedSession({
|
|
98
|
-
root,
|
|
99
|
-
sessionId,
|
|
100
|
-
easBin: resolveEasCliBin(root)?.file ?? null
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
function defaultStopMetroTunnel(record) {
|
|
104
|
-
return stopTunnel(record);
|
|
105
|
-
}
|
|
106
|
-
async function reclaimMetroTunnel(root, { stopMetroTunnel = defaultStopMetroTunnel } = {}) {
|
|
107
|
-
const record = readMetroTunnel(root);
|
|
108
|
-
if (record?.kind !== "managed") return {
|
|
109
|
-
stopped: null,
|
|
110
|
-
failed: null
|
|
111
|
-
};
|
|
112
|
-
let result;
|
|
113
|
-
try {
|
|
114
|
-
result = await stopMetroTunnel(record);
|
|
115
|
-
} catch (err) {
|
|
116
|
-
result = {
|
|
117
|
-
status: "failed",
|
|
118
|
-
reason: String(err?.message ?? err)
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
if (result.status === "failed") return {
|
|
122
|
-
stopped: null,
|
|
123
|
-
failed: {
|
|
124
|
-
platform: "ios",
|
|
125
|
-
name: `${record.provider} tunnel (pid ${record.pid})`,
|
|
126
|
-
reason: `${result.reason ?? "stop failed"} The process identity could not be verified or the stop could not be confirmed. The ownership record is kept. Inspect the process and retry \`stim worktree remove\`.`
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
if (!clearManagedMetroTunnel(root, record)) return {
|
|
130
|
-
stopped: null,
|
|
131
|
-
failed: {
|
|
132
|
-
platform: "ios",
|
|
133
|
-
name: "replacement managed tunnel",
|
|
134
|
-
reason: "A replacement managed tunnel record appeared during cleanup and is retained for a later stop."
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
return {
|
|
138
|
-
stopped: record.provider,
|
|
139
|
-
failed: null
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function describeDereferenced(project) {
|
|
143
|
-
const devices = Object.entries(project?.ports ?? {}).map(([label, port]) => `port ${label} (${port})`);
|
|
144
|
-
for (const { platforms } of projectDeviceSlots(project)) {
|
|
145
|
-
const ios = platforms.ios;
|
|
146
|
-
if (ios?.deviceUdid) devices.push(`ios sim ${ios.deviceUdid}`);
|
|
147
|
-
const android = platforms.android;
|
|
148
|
-
if (android?.avdName) devices.push(`android avd ${android.avdName}`);
|
|
149
|
-
else if (android?.serial) devices.push(`android device ${android.serial}`);
|
|
150
|
-
}
|
|
151
|
-
return devices;
|
|
152
|
-
}
|
|
153
|
-
function parkedIosCacheKey(lastBuild) {
|
|
154
|
-
if (lastBuild === null || typeof lastBuild !== "object" || Array.isArray(lastBuild)) return null;
|
|
155
|
-
const build = lastBuild;
|
|
156
|
-
return build.platform === "ios" && typeof build.cacheKey === "string" ? build.cacheKey : null;
|
|
157
|
-
}
|
|
158
|
-
function parkRequest(project, projectPath, slot, simslimManaged) {
|
|
159
|
-
const { max, error } = parkedMaxSetting("ios");
|
|
160
|
-
if (error || max <= 0) return void 0;
|
|
161
|
-
const cacheKey = parkedIosCacheKey(readWorkspaceState(projectPath)?.lastBuild);
|
|
162
|
-
return {
|
|
163
|
-
projectPath,
|
|
164
|
-
max,
|
|
165
|
-
bundleId: typeof project?.bundleId === "string" ? project.bundleId : null,
|
|
166
|
-
cacheKey,
|
|
167
|
-
simslimManaged,
|
|
168
|
-
slot
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
function reclaimOwnedDevices(project, projectPath, { park = false } = {}) {
|
|
172
|
-
const deletedDevices = [];
|
|
173
|
-
const parkedDevices = [];
|
|
174
|
-
const evictedDevices = [];
|
|
175
|
-
const poolNotes = [];
|
|
176
|
-
const skippedDevices = [];
|
|
177
|
-
const failedDevices = [];
|
|
178
|
-
for (const { slot, platforms } of projectDeviceSlots(project)) {
|
|
179
|
-
const ios = platforms.ios;
|
|
180
|
-
if (ios?.owned && ios.deviceUdid) {
|
|
181
|
-
const udid = ios.deviceUdid;
|
|
182
|
-
const label = ios.deviceName || udid;
|
|
183
|
-
const r = teardownOwnedIosSim(udid, {
|
|
184
|
-
del: true,
|
|
185
|
-
label,
|
|
186
|
-
...park ? { park: parkRequest(project, projectPath, slot, Boolean(ios.simslimManaged)) } : {}
|
|
187
|
-
});
|
|
188
|
-
if (r.parkFallback) poolNotes.push(`could not park ${label}: ${r.parkFallback} -- deleted it instead`);
|
|
189
|
-
for (const failure of r.evictionFailures ?? []) poolNotes.push(failure);
|
|
190
|
-
if (r.parked) {
|
|
191
|
-
parkedDevices.push(r.parked);
|
|
192
|
-
evictedDevices.push(...r.evicted ?? []);
|
|
193
|
-
} else if (r.status === "torn-down") deletedDevices.push(r.label);
|
|
194
|
-
if (r.status === "skipped") skippedDevices.push({
|
|
195
|
-
platform: "ios",
|
|
196
|
-
name: label,
|
|
197
|
-
udid,
|
|
198
|
-
reason: `${r.reason} -- not touched`
|
|
199
|
-
});
|
|
200
|
-
else if (r.status === "failed") {
|
|
201
|
-
const entry = {
|
|
202
|
-
platform: "ios",
|
|
203
|
-
name: label,
|
|
204
|
-
udid,
|
|
205
|
-
reason: `teardown failed: ${r.reason}`
|
|
206
|
-
};
|
|
207
|
-
skippedDevices.push(entry);
|
|
208
|
-
failedDevices.push(entry);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
const android = platforms.android;
|
|
212
|
-
if (android?.owned && android.avdName) {
|
|
213
|
-
const bound = parkedMaxSetting("android");
|
|
214
|
-
const r = teardownOwnedAvd(android.avdName, {
|
|
215
|
-
del: true,
|
|
216
|
-
owner: {
|
|
217
|
-
projectPath,
|
|
218
|
-
slot
|
|
219
|
-
},
|
|
220
|
-
...park && !bound.error && bound.max > 0 ? { park: {
|
|
221
|
-
projectPath,
|
|
222
|
-
slot,
|
|
223
|
-
max: bound.max,
|
|
224
|
-
configuration: typeof android.poolConfiguration === "string" ? android.poolConfiguration : void 0
|
|
225
|
-
} } : {}
|
|
226
|
-
});
|
|
227
|
-
if (r.parkFallback) poolNotes.push(`could not park ${android.avdName}: ${r.parkFallback} -- deleted it instead`);
|
|
228
|
-
for (const failure of r.evictionFailures ?? []) poolNotes.push(failure);
|
|
229
|
-
if (r.parked) {
|
|
230
|
-
parkedDevices.push(r.parked);
|
|
231
|
-
evictedDevices.push(...r.evicted ?? []);
|
|
232
|
-
} else if (r.status === "torn-down") deletedDevices.push(android.avdName);
|
|
233
|
-
else if (r.status === "skipped") skippedDevices.push({
|
|
234
|
-
platform: "android",
|
|
235
|
-
name: android.avdName,
|
|
236
|
-
reason: `${r.reason} -- not touched`
|
|
237
|
-
});
|
|
238
|
-
else if (r.status === "failed") {
|
|
239
|
-
const entry = {
|
|
240
|
-
platform: "android",
|
|
241
|
-
name: android.avdName,
|
|
242
|
-
reason: `teardown failed: ${r.reason}`
|
|
243
|
-
};
|
|
244
|
-
skippedDevices.push(entry);
|
|
245
|
-
failedDevices.push(entry);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
return {
|
|
250
|
-
deletedDevices,
|
|
251
|
-
parkedDevices,
|
|
252
|
-
evictedDevices,
|
|
253
|
-
poolNotes,
|
|
254
|
-
skippedDevices,
|
|
255
|
-
failedDevices
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
async function reclaimProject(path, { deleteOwnedDevices = false, parkOwnedDevices = false, preserveProjectRecord = false, stopSession = defaultStopSession, stopMetroTunnel = defaultStopMetroTunnel, releaseLeases = releaseWorkspaceLeases, verifyCollector = verifyCollectorOwnership } = {}) {
|
|
259
|
-
await clearNamedPorts(path, { stop: true });
|
|
260
|
-
const project = getProject(path);
|
|
261
|
-
for (const { platforms } of projectDeviceSlots(project)) if (platforms.android?.owned && platforms.android.avdName) (0, ownership_claim_exports.releaseClaim)(acquireAvdClaim(platforms.android.avdName));
|
|
262
|
-
const dereferenced = describeDereferenced(project);
|
|
263
|
-
const initialState = readWorkspaceState(path);
|
|
264
|
-
let killedPid = null;
|
|
265
|
-
let skippedMetro = null;
|
|
266
|
-
let supervisorHeld = false;
|
|
267
|
-
const supervisor = resolveSupervisorTarget({
|
|
268
|
-
state: initialState?.supervisor,
|
|
269
|
-
record: project?.supervisor,
|
|
270
|
-
reservedPort: project?.metroPort
|
|
271
|
-
});
|
|
272
|
-
if (supervisor.status === "ours") {
|
|
273
|
-
if (killMetroTree(supervisor.pid, supervisor.processToken) && await (0, process_identity_exports.waitForProcessExit)(supervisor, 1e4)) killedPid = supervisor.pid;
|
|
274
|
-
else {
|
|
275
|
-
skippedMetro = `could not confirm supervisor pid ${supervisor.pid} exited`;
|
|
276
|
-
supervisorHeld = true;
|
|
277
|
-
}
|
|
278
|
-
} else if (supervisor.status === "unverified") {
|
|
279
|
-
skippedMetro = supervisor.reason ?? "supervisor identity could not be verified";
|
|
280
|
-
supervisorHeld = true;
|
|
281
|
-
} else if (typeof project?.metroPort === "number") {
|
|
282
|
-
if (!(await resolveProjectMetro(project.metroPort, path)).missing) skippedMetro = "Externally started server left alone; no verified Stim supervisor owns it";
|
|
283
|
-
}
|
|
284
|
-
const { skippedDevices: skippedCollectors, failedDevices: failedCollectors } = await reapCollectors(path, {
|
|
285
|
-
verify: verifyCollector,
|
|
286
|
-
collectors: initialState?.collectors ?? {}
|
|
287
|
-
});
|
|
288
|
-
function retainReplacementProcesses() {
|
|
289
|
-
const currentState = readWorkspaceState(path);
|
|
290
|
-
const currentProject = getProject(path);
|
|
291
|
-
if (Boolean(currentState?.supervisor && !(0, process_identity_exports.sameProcessRecord)(currentState.supervisor, initialState?.supervisor) || currentProject?.supervisor && !(0, process_identity_exports.sameProcessRecord)(currentProject.supervisor, project?.supervisor) || Object.entries(currentState?.collectors ?? {}).some(([platform, record]) => !(0, process_identity_exports.sameProcessRecord)(record, initialState?.collectors?.[platform])))) {
|
|
292
|
-
supervisorHeld = true;
|
|
293
|
-
skippedMetro = "A replacement process appeared during cleanup; its ownership records are retained";
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
retainReplacementProcesses();
|
|
297
|
-
const { deletedDevices, parkedDevices, evictedDevices, poolNotes, skippedDevices, failedDevices } = deleteOwnedDevices && !supervisorHeld && failedCollectors.length === 0 ? reclaimOwnedDevices(project, path, { park: parkOwnedDevices }) : {
|
|
298
|
-
deletedDevices: [],
|
|
299
|
-
parkedDevices: [],
|
|
300
|
-
evictedDevices: [],
|
|
301
|
-
poolNotes: [],
|
|
302
|
-
skippedDevices: [],
|
|
303
|
-
failedDevices: []
|
|
304
|
-
};
|
|
305
|
-
skippedDevices.push(...skippedCollectors);
|
|
306
|
-
failedDevices.push(...failedCollectors);
|
|
307
|
-
const remote = reclaimRemoteSession(path, { stopSession });
|
|
308
|
-
if (remote.failed) {
|
|
309
|
-
skippedDevices.push(remote.failed);
|
|
310
|
-
failedDevices.push(remote.failed);
|
|
311
|
-
}
|
|
312
|
-
const tunnel = await reclaimMetroTunnel(path, { stopMetroTunnel });
|
|
313
|
-
if (tunnel.failed) {
|
|
314
|
-
skippedDevices.push(tunnel.failed);
|
|
315
|
-
failedDevices.push(tunnel.failed);
|
|
316
|
-
}
|
|
317
|
-
let releasedLeases = [];
|
|
318
|
-
try {
|
|
319
|
-
releasedLeases = releaseLeases(path);
|
|
320
|
-
} catch {
|
|
321
|
-
releasedLeases = [];
|
|
322
|
-
}
|
|
323
|
-
retainReplacementProcesses();
|
|
324
|
-
const removedWorkspaceDirs = [];
|
|
325
|
-
const failedWorkspaceDirs = [];
|
|
326
|
-
if (failedDevices.length === 0 && !supervisorHeld) {
|
|
327
|
-
const dir = workspaceDir(path);
|
|
328
|
-
if (existsSync(dir)) try {
|
|
329
|
-
rmSync(dir, {
|
|
330
|
-
recursive: true,
|
|
331
|
-
force: true
|
|
332
|
-
});
|
|
333
|
-
removedWorkspaceDirs.push(dir);
|
|
334
|
-
} catch {
|
|
335
|
-
failedWorkspaceDirs.push(dir);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
const keptEntry = supervisorHeld || failedDevices.length > 0 || failedWorkspaceDirs.length > 0;
|
|
339
|
-
if (project && !keptEntry && !preserveProjectRecord) removeProject(path);
|
|
340
|
-
return {
|
|
341
|
-
path,
|
|
342
|
-
dereferenced,
|
|
343
|
-
killedPid,
|
|
344
|
-
skippedMetro,
|
|
345
|
-
metroPort: project?.metroPort ?? null,
|
|
346
|
-
deletedDevices,
|
|
347
|
-
parkedDevices,
|
|
348
|
-
evictedDevices,
|
|
349
|
-
poolNotes,
|
|
350
|
-
skippedDevices,
|
|
351
|
-
failedDevices,
|
|
352
|
-
keptEntry,
|
|
353
|
-
stoppedSession: remote.stopped,
|
|
354
|
-
stoppedTunnel: tunnel.stopped,
|
|
355
|
-
releasedLeases,
|
|
356
|
-
removedWorkspaceDirs,
|
|
357
|
-
failedWorkspaceDirs
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
//#endregion
|
|
361
|
-
export { reclaimProject as n, describeDereferenced as t };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { basename, dirname, join } from "node:path";
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
-
//#region src/spawn-entry.ts
|
|
4
|
-
const DEV_ENTRIES = {
|
|
5
|
-
"supervisor-run": "./supervisor/run.ts",
|
|
6
|
-
"collector-run": "./collector/run.ts"
|
|
7
|
-
};
|
|
8
|
-
function spawnEntry(name) {
|
|
9
|
-
const here = fileURLToPath(import.meta.url);
|
|
10
|
-
if (basename(dirname(here)) === "src") return fileURLToPath(new URL(DEV_ENTRIES[name], import.meta.url));
|
|
11
|
-
return join(dirname(here), `${name}.mjs`);
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { spawnEntry as t };
|