stim 1.12.0 → 1.13.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 (71) hide show
  1. package/README.md +3 -1
  2. package/dist/{activity-CCZJs__P.mjs → activity-DfVKZTEB.mjs} +42 -25
  3. package/dist/{android-BQiKJYK0.mjs → android-BHfAu2mf.mjs} +1 -1
  4. package/dist/{android-B7X-8H7h.mjs → android-CD8pr8Q2.mjs} +62 -47
  5. package/dist/{android-cas-DzLPXiEn.mjs → android-cas-B9Kv9aIy.mjs} +9 -7
  6. package/dist/{android-75Sk2rIR.mjs → android-qx_31wJo.mjs} +395 -116
  7. package/dist/{app-install-CsZi0SAT.mjs → app-install-CDFY2nUL.mjs} +1 -1
  8. package/dist/{budget-DbzW5VTD.mjs → budget-E5o91NR1.mjs} +154 -37
  9. package/dist/{build-plan-CqntbR7b.mjs → build-plan-BTa93o_r.mjs} +21 -88
  10. package/dist/{build-progress-h60GPV27.mjs → build-progress-l7d-X-ZP.mjs} +75 -7
  11. package/dist/cdp-Dq_ypAlJ.mjs +115 -0
  12. package/dist/chrome-B5hWgQJS.mjs +61 -0
  13. package/dist/cli.mjs +16 -15
  14. package/dist/collector-run.mjs +14 -8
  15. package/dist/{command-output-BWCj5Vh-.mjs → command-output-BIL7rlX7.mjs} +1 -1
  16. package/dist/created-devices-Cd558h31.mjs +37 -0
  17. package/dist/{deps-CO-_7UOm.mjs → deps-2Wo81np9.mjs} +1 -1
  18. package/dist/{device-9r9xRYDa.mjs → device-Cf7vl-so.mjs} +6 -6
  19. package/dist/{device-lease-B9LAXIUH.mjs → device-lease-CL9dZf73.mjs} +52 -3
  20. package/dist/{device-pool-BoezJd-c.mjs → device-pool-MuoiyRcu.mjs} +3 -3
  21. package/dist/{device-remote-C0_o-tJH.mjs → device-remote-DT9ngZiD.mjs} +10 -10
  22. package/dist/{doctor-LfDlbR-N.mjs → doctor-D2iysNNH.mjs} +47 -18
  23. package/dist/{error-diagnostics-CCxjn31V.mjs → error-diagnostics-BoiOhck8.mjs} +6 -6
  24. package/dist/{gc-C4nQFcTX.mjs → gc-eA-PRBX8.mjs} +853 -126
  25. package/dist/{guide-BPBlh9ML.mjs → guide-BfZ0OmiP.mjs} +736 -110
  26. package/dist/{guide-status-i9ogHt4v.mjs → guide-status-BaMYu55M.mjs} +1 -1
  27. package/dist/{idle-S3tFZ53_.mjs → idle-DxLi5OkN.mjs} +42 -9
  28. package/dist/{in-use-D9XYEgFD.mjs → in-use-wYEaKQM9.mjs} +9 -5
  29. package/dist/{ios-CDzWL1mj.mjs → ios-CcfCeZ19.mjs} +98 -54
  30. package/dist/{ios-CZWOHTTc.mjs → ios-CmEzZiOj.mjs} +10 -5
  31. package/dist/{ios-device-D9cLxVr5.mjs → ios-device-BW-t_Lkv.mjs} +1 -1
  32. package/dist/{launch-verify-B2oR_kFN.mjs → launch-verify-CuJaBpEa.mjs} +33 -20
  33. package/dist/{logs-SzuYudOj.mjs → logs-DcSRbC2t.mjs} +11 -10
  34. package/dist/{metro-Dzo30hvJ.mjs → metro-BPeY1YMh.mjs} +4 -4
  35. package/dist/{named-ports-Dn1o61D9.mjs → named-ports-n7tnJsI8.mjs} +78 -6
  36. package/dist/native-runtime-CiiFHt0e.mjs +74 -0
  37. package/dist/{ownership-Dqnrjrio.mjs → ownership-Bz2kETAS.mjs} +1 -1
  38. package/dist/{ownership-B8d4kXBx.mjs → ownership-PUP4Dwai.mjs} +134 -209
  39. package/dist/page-BTu7I60K.mjs +29 -0
  40. package/dist/{ports-Dp_QTwTC.mjs → ports-C5UutqpJ.mjs} +4 -4
  41. package/dist/{project-B8rbutVC.mjs → project-DGeclhvO.mjs} +53 -17
  42. package/dist/{reload-nocmx8KB.mjs → reload-C-cV5yy_.mjs} +79 -20
  43. package/dist/{remote-cache-BRsRZru5.mjs → remote-cache--aehr4Pr.mjs} +3 -3
  44. package/dist/{server-bare-Gn3ssSdK.mjs → server-bare-Bq8BpSIo.mjs} +1 -1
  45. package/dist/server-expo-BeYwP_Xy.mjs +2 -0
  46. package/dist/{server-expo-CeT1nIIk.mjs → server-expo-DUCg52-K.mjs} +2 -2
  47. package/dist/{settings-bE-Gu3Ti.mjs → settings-ssVBToDR.mjs} +10 -10
  48. package/dist/{settings-BlyDn2Oz.mjs → settings-xB0Frkg6.mjs} +11 -2
  49. package/dist/settings.schema.json +53 -1
  50. package/dist/{simslim-COtEEP7x.mjs → simslim-Bbg9UWrt.mjs} +12 -6
  51. package/dist/{slot-launch-DIACGEfH.mjs → slot-launch-BIWEW-wI.mjs} +3 -3
  52. package/dist/{start-BboE1HIS.mjs → start-BZhItkiL.mjs} +11 -10
  53. package/dist/{start-BFstVBlx.mjs → start-Rw2GD3nV.mjs} +1 -1
  54. package/dist/{state-DcDgzfu3.mjs → state-DwAU2_-D.mjs} +1 -1
  55. package/dist/state-l1pYwOre.mjs +148 -0
  56. package/dist/{stats-DiCtmluY.mjs → stats-CaSwmsSZ.mjs} +2 -2
  57. package/dist/{status-DI9Tjo7T.mjs → status-TJlL0HWo.mjs} +624 -103
  58. package/dist/{status-BUASYyy_.mjs → status-sszP4XKU.mjs} +59 -2
  59. package/dist/{stim-desktop-D0xhpZt8.mjs → stim-desktop-CXt8-Z3J.mjs} +13 -2
  60. package/dist/{stop-Bn6v-GvS.mjs → stop-BZ2qMiBP.mjs} +37 -12
  61. package/dist/{stop-BI7QY76M.mjs → stop-DskDKNTU.mjs} +2 -2
  62. package/dist/supervisor-run.mjs +10 -10
  63. package/dist/web-run.d.mts +22 -0
  64. package/dist/web-run.mjs +481 -0
  65. package/dist/web-sWXd5iek.mjs +394 -0
  66. package/dist/{worktree-B5sTRskL.mjs → worktree-3cBa-bQt.mjs} +1 -1
  67. package/dist/{worktree-ChDL5fO1.mjs → worktree-D4Do_XiQ.mjs} +226 -19
  68. package/dist/{xcode-BzplpQzc.mjs → xcode-LM6A8cNZ.mjs} +5 -5
  69. package/package.json +5 -5
  70. package/dist/server-expo-eWi9Coof.mjs +0 -2
  71. package/dist/workspace-process-lock-BvvJTfo_.mjs +0 -57
@@ -1,5 +1,5 @@
1
1
  import { T as upsertProject, d as getConfigDir, p as getProject } from "./config-0jCcMM0E.mjs";
2
- import { n as appProjectProblem } from "./project-B8rbutVC.mjs";
2
+ import { n as appProjectProblem } from "./project-DGeclhvO.mjs";
3
3
  import { t as compareStimVersions } from "./stim-installations-CINXy_su.mjs";
4
4
  import { mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
5
5
  import { join } from "node:path";
@@ -1,11 +1,27 @@
1
1
  import { U as projectDeviceSlots } from "./config-0jCcMM0E.mjs";
2
- import { m as readWorkspaceState } from "./metro-Dzo30hvJ.mjs";
3
- import { o as formatLongDuration } from "./command-output-BWCj5Vh-.mjs";
4
- import { n as createActivityReader, r as idleForMs } from "./activity-CCZJs__P.mjs";
5
- import { L as ownedAvdSerialResolver } from "./android-75Sk2rIR.mjs";
6
- import { d as teardownOwnedAvd, f as teardownOwnedIosSim } from "./ownership-B8d4kXBx.mjs";
7
- import { r as activeBuildState, s as parseActiveBuild, t as ACTIVE_BUILD_KEY } from "./build-progress-h60GPV27.mjs";
2
+ import { h as readWorkspaceState } from "./metro-BPeY1YMh.mjs";
3
+ import { o as formatLongDuration } from "./command-output-BIL7rlX7.mjs";
4
+ import { i as idleForMs, n as createActivityReader } from "./activity-DfVKZTEB.mjs";
5
+ import { R as ownedAvdSerialResolver } from "./android-qx_31wJo.mjs";
6
+ import { f as teardownOwnedAvd, m as teardownOwnedIosSim } from "./ownership-PUP4Dwai.mjs";
7
+ import { r as activeBuildState, s as parseActiveBuild, t as ACTIVE_BUILD_KEY } from "./build-progress-l7d-X-ZP.mjs";
8
8
  import chalk from "chalk";
9
+ //#region src/commands/gc/results.ts
10
+ const results = [];
11
+ function recordGcResult(kind, status, label, { id = null, bytes = null, detail = null } = {}) {
12
+ results.push({
13
+ kind,
14
+ status,
15
+ label,
16
+ id,
17
+ bytes,
18
+ detail
19
+ });
20
+ }
21
+ function takeGcResults() {
22
+ return results.splice(0);
23
+ }
24
+ //#endregion
9
25
  //#region src/commands/gc/idle.ts
10
26
  function findOwnedDeviceActivity({ config, sims, androidSerial, readActivity, deadProjects = [] }) {
11
27
  const booted = new Map(sims.filter((sim) => sim.state === "Booted").map((sim) => [sim.udid, sim.name]));
@@ -133,6 +149,10 @@ function shutDownIdleDevices(devices, idleMs, recollect) {
133
149
  const current = fresh.find((d) => d.kind === device.kind && d.id === device.id && d.project === device.project && d.slot === device.slot);
134
150
  if (!current) {
135
151
  console.log(chalk.dim(`Kept ${what}: it is no longer idle for ${formatLongDuration(idleMs)}.`));
152
+ recordGcResult("idleDevice", "kept", device.name, {
153
+ id: device.id,
154
+ detail: `it is no longer idle for ${formatLongDuration(idleMs)}`
155
+ });
136
156
  continue;
137
157
  }
138
158
  const outcome = device.kind === "ios" ? teardownOwnedIosSim(device.id, { label: device.name }) : teardownOwnedAvd(device.id, { owner: {
@@ -142,11 +162,24 @@ function shutDownIdleDevices(devices, idleMs, recollect) {
142
162
  if (outcome.status === "torn-down") {
143
163
  shutDown.push(device);
144
164
  console.log(chalk.green(`Shut down ${what}, idle ${formatLongDuration(current.idleForMs)}`));
165
+ recordGcResult("idleDevice", "done", device.name, {
166
+ id: device.id,
167
+ detail: `idle ${formatLongDuration(current.idleForMs)}`
168
+ });
145
169
  } else if (outcome.status === "missing") console.log(chalk.dim(`${what} is already gone; nothing to shut down.`));
146
- else if (outcome.status === "skipped") console.log(chalk.yellow(`Skipped ${what}: ${outcome.reason}`));
147
- else {
170
+ else if (outcome.status === "skipped") {
171
+ console.log(chalk.yellow(`Skipped ${what}: ${outcome.reason}`));
172
+ recordGcResult("idleDevice", "kept", device.name, {
173
+ id: device.id,
174
+ detail: outcome.reason
175
+ });
176
+ } else {
148
177
  failures++;
149
178
  console.log(chalk.red(`Failed to shut down ${what}: ${outcome.reason}`));
179
+ recordGcResult("idleDevice", "failed", device.name, {
180
+ id: device.id,
181
+ detail: outcome.reason
182
+ });
150
183
  }
151
184
  }
152
185
  return {
@@ -155,4 +188,4 @@ function shutDownIdleDevices(devices, idleMs, recollect) {
155
188
  };
156
189
  }
157
190
  //#endregion
158
- export { parseIdleDuration as a, idleShutdownCandidates as i, collectOwnedDeviceActivity as n, shutDownIdleDevices as o, idleDeviceLines as r, workspaceBuildInProgress as s, collectIdleDevices as t };
191
+ export { parseIdleDuration as a, recordGcResult as c, idleShutdownCandidates as i, takeGcResults as l, collectOwnedDeviceActivity as n, shutDownIdleDevices as o, idleDeviceLines as r, workspaceBuildInProgress as s, collectIdleDevices as t };
@@ -1,10 +1,11 @@
1
1
  import { A as ownership_claim_exports, d as getConfigDir, p as getProject } from "./config-0jCcMM0E.mjs";
2
- import { O as workspaceDir, m as readWorkspaceState } from "./metro-Dzo30hvJ.mjs";
2
+ import { h as readWorkspaceState, k as workspaceDir } from "./metro-BPeY1YMh.mjs";
3
3
  import { n as declareSpawnsOn, o as stopDeclaringSpawnsOn } from "./spawn-claims-PT8aQpCa.mjs";
4
- import { n as workspaceProcessLockError, r as workspaceProcessLockPath, t as withWorkspaceProcessLock } from "./workspace-process-lock-BvvJTfo_.mjs";
5
- import { a as formatElapsed } from "./command-output-BWCj5Vh-.mjs";
6
- import { h as listBuildLocks } from "./device-lease-B9LAXIUH.mjs";
7
- import { n as managedLockHolders, t as resolveSupervisorTarget } from "./ownership-B8d4kXBx.mjs";
4
+ import { a as withWorkspaceProcessLock, o as workspaceProcessLockError, s as workspaceProcessLockPath } from "./named-ports-n7tnJsI8.mjs";
5
+ import { a as formatElapsed } from "./command-output-BIL7rlX7.mjs";
6
+ import { h as listBuildLocks } from "./device-lease-CL9dZf73.mjs";
7
+ import { n as managedLockHolders, t as resolveSupervisorTarget } from "./ownership-PUP4Dwai.mjs";
8
+ import { a as readWebRecord, l as webFacts } from "./state-l1pYwOre.mjs";
8
9
  import { lstatSync, readdirSync, rmSync, rmdirSync, statSync, unlinkSync } from "node:fs";
9
10
  import { realpathSync as realpathSync$1 } from "fs";
10
11
  import { resolve } from "path";
@@ -180,6 +181,9 @@ function workspaceInUse(root, { supervisor = true, managedLocks = true, nativeRu
180
181
  });
181
182
  if (target.status === "ours") reasons.push(`its dev server supervisor (pid ${target.pid}) is running`);
182
183
  else if (target.status === "unverified") reasons.push(`its dev server supervisor cannot be verified: ${target.reason ?? "unknown identity"}`);
184
+ const browser = webFacts(readWebRecord(root));
185
+ if (browser?.status === "running" || browser?.status === "orphaned") reasons.push(`its owned Chrome (pid ${browser.record.chromeProcess?.pid}) is running`);
186
+ else if (browser?.status === "unverified") reasons.push("its owned Chrome cannot be verified");
183
187
  }
184
188
  if (nativeRun) {
185
189
  const claims = (0, ownership_claim_exports.readClaimSet)(workspaceProcessLockPath(workspaceDir(root), NATIVE_RUN, true));
@@ -1,36 +1,37 @@
1
1
  import { A as ownership_claim_exports, G as validateDeviceSlot, H as parseDeviceSlotOption, R as deviceSlotFileKey, T as upsertProject, p as getProject, u as getConcurrencyLimits, z as deviceSlotKey } from "./config-0jCcMM0E.mjs";
2
2
  import { t as getExecutor } from "./exec-DK8KaVHK.mjs";
3
3
  import { r as createNdjsonWriter } from "./ndjson-CDY9IkVC.mjs";
4
- import { O as workspaceDir, c as signalProcessTree, h as recordWorkspaceUse, i as pidExists, j as workspaceLogsDir, m as readWorkspaceState$1, s as resolveProjectMetro, y as writeWorkspaceState } from "./metro-Dzo30hvJ.mjs";
4
+ import { M as workspaceLogsDir, a as pidExists, b as writeWorkspaceState, c as resolveProjectMetro, g as recordWorkspaceUse, h as readWorkspaceState$1, k as workspaceDir, l as signalProcessTree } from "./metro-BPeY1YMh.mjs";
5
5
  import { D as makeTemporaryDirectory, O as removeTemporaryEntry, s as gitCommonDir, y as repoRoot } from "./worktree-DeBQSVtR.mjs";
6
- import { i as findProjectRoot, n as appProjectProblem, r as detectIsExpo, t as NO_PROJECT_REFUSAL } from "./project-B8rbutVC.mjs";
7
- import { m as writeWorkspaceLaunch, n as MODE_EXPO, t as MODE_BARE } from "./state-DcDgzfu3.mjs";
8
- import { _ as stepTimer, c as launchErrorReport, g as stepClock, h as shortUdid, i as formatDuration, l as phaseLine, m as shortHash, n as appReadinessMessage, v as launchErrorPreview } from "./command-output-BWCj5Vh-.mjs";
9
- import { A as resolveBuild, C as filesystemBuildCapability, D as providerDownloadPath, E as prepareProviderDownloadDir, F as untrackedNativeFiles, O as providerUploadOutcome, P as untrackedMissLine, T as fingerprintProject, _ as waitForBuild, b as buildCacheKey, g as releaseBuildLock, j as storeBuild, k as refingerprintAfterMutation, m as acquireBuildLock, v as waitForSharedBuild, w as fingerprintDiffRecord } from "./device-lease-B9LAXIUH.mjs";
10
- import { A as resolveCacheProviderConfig, E as publicUrlSetting, I as tunnelModeSetting, L as unknownSettingKeys, P as settingShapeErrors, S as metroWarmupUrlSetting, U as optimizationBuildProfile, V as artifactCachePolicy, W as resolveOptimizations, _ as iosSigningIdentitySha1SettingError, a as SETTING_SHAPE_REMEDY, d as cacheProviderSettingError, f as iosLanHostSetting, g as iosSigningIdentitySha1Setting, h as iosSigningIdentitySettingError, j as resolveSettings, k as remoteIosSetting, m as iosSigningIdentitySetting, p as iosLanHostSettingError, r as REMOTE_DEVICE_BACKENDS, z as detectProviders } from "./settings-BlyDn2Oz.mjs";
11
- import { h as POOL_SETTING_REMEDY, y as parkedMaxSetting } from "./ownership-B8d4kXBx.mjs";
12
- import { D as parseIosSimulatorApp, f as listIosRuntimes } from "./ios-CZWOHTTc.mjs";
13
- import { c as startBuildProgress, n as NO_BUILD_PROGRESS } from "./build-progress-h60GPV27.mjs";
14
- import { a as acquireBuildSlot, s as releaseBuildSlot } from "./in-use-D9XYEgFD.mjs";
15
- import { n as verifyCollectorOwnership } from "./ownership-Dqnrjrio.mjs";
16
- import { a as easAuthNote, c as loadProjectProvider, f as resolveEasCliBin, i as checkEasAuth, m as uploadRemote, n as UPLOAD_TIMEOUT_MS, o as exitAfterFlush, p as resolveRemote, r as cacheLevel, s as isEasAuthFailureText, t as RESOLVE_TIMEOUT_MS } from "./remote-cache-BRsRZru5.mjs";
17
- import { F as ownedSessionName, S as withNativeBuildRun, a as ensureMetroReachable, l as remoteIosDeps, m as cancelledFailure, n as binOnPath, o as ensureRemoteBootOwned, r as bundleEntryPoint, u as resolveRemoteContext, x as runCancellation, z as gateMetroOrigin } from "./device-remote-C0_o-tJH.mjs";
18
- import { c as clearOtherUserApps, h as iosAppProcess, m as installIosApp, r as DEFAULT_METRO_PORT, u as devClientUrl, v as launchIosApp } from "./app-install-CsZi0SAT.mjs";
19
- import { c as readMetroRecords, d as verifyLaunch, f as verifyReleaseLaunch, i as RELEASE_VERIFY_WAIT_MS, l as unverifiedLaunchLines, n as LAUNCH_FATAL, o as isBundleProof, r as LAUNCH_UNVERIFIED, s as readCollectorRecords, t as LAUNCH_BUNDLING } from "./launch-verify-B2oR_kFN.mjs";
20
- import { c as unknownIosDeviceTypeRefusal, d as easDeviceBuildRemedy, f as isEasBuildFailure, l as unknownIosRuntimeRefusal, m as resolveEasDevelopmentBuild, p as planEasDevelopmentBuild, r as checkDeviceCapacity } from "./simslim-COtEEP7x.mjs";
21
- import { f as spawnEntry, h as detectBundleId, s as startDevServer } from "./start-BboE1HIS.mjs";
22
- import { a as lostLine, c as releaseLeaseOnSignal, i as leaseExpiryText, l as runLease, n as DEBUG_VERIFY_STEP_MS, o as lostRefusal, r as acquireRunLease, s as parseDeviceWait, t as selectFromPool, u as waitFlagConflict } from "./device-pool-BoezJd-c.mjs";
23
- import { C as ensureDevServer, D as sleep, E as launchOutcomeRecord, O as warmMetro, S as clearIosAdoptionPending, T as isPhysicalDeviceRequest, _ as staleNativeDirRefusal, a as refusePlan, c as skippedMissReason, d as schemesFromInfoPlist, g as runPrebuild, h as recordPrebuild, i as printPlan, l as devClientScheme, m as planPrebuild, n as planFlagRefusal, o as explainBuildMiss, p as swapJsBundle, r as planPayload, s as fingerprintErrorMissReason, t as planCachedBuild, u as pickDevClientScheme, v as ensureBooted, w as ensureWorkspaceStorageSafely, y as ensureOwnedDevice } from "./build-plan-CqntbR7b.mjs";
24
- import { t as budgetGate } from "./budget-DbzW5VTD.mjs";
6
+ import { a as findProjectRoot, n as appProjectProblem, r as detectIsExpo, t as NO_PROJECT_REFUSAL } from "./project-DGeclhvO.mjs";
7
+ import { m as writeWorkspaceLaunch, n as MODE_EXPO, t as MODE_BARE } from "./state-DwAU2_-D.mjs";
8
+ import { _ as stepTimer, c as launchErrorReport, g as stepClock, h as shortUdid, i as formatDuration, l as phaseLine, m as shortHash, n as appReadinessMessage, v as launchErrorPreview } from "./command-output-BIL7rlX7.mjs";
9
+ import { A as providerDownloadPath, D as fingerprintProject, E as fingerprintDiffRecord, L as untrackedMissLine, M as refingerprintAfterMutation, N as resolveBuild, O as inputsChangedDuringBuild, P as storeBuild, R as untrackedNativeFiles, S as configInputsChanged, T as filesystemBuildCapability, _ as waitForBuild, b as buildCacheKey, g as releaseBuildLock, j as providerUploadOutcome, k as prepareProviderDownloadDir, m as acquireBuildLock, v as waitForSharedBuild, x as changedDuringBuildLine } from "./device-lease-CL9dZf73.mjs";
10
+ import { ct as parkedMaxSetting, rt as POOL_SETTING_REMEDY } from "./android-qx_31wJo.mjs";
11
+ import { A as resolveCacheProviderConfig, B as detectProviders, E as publicUrlSetting, G as resolveOptimizations, H as artifactCachePolicy, I as tunnelModeSetting, L as unknownSettingKeys, P as settingShapeErrors, S as metroWarmupUrlSetting, W as optimizationBuildProfile, _ as iosSigningIdentitySha1SettingError, a as SETTING_SHAPE_REMEDY, d as cacheProviderSettingError, f as iosLanHostSetting, g as iosSigningIdentitySha1Setting, h as iosSigningIdentitySettingError, j as resolveSettings, k as remoteIosSetting, m as iosSigningIdentitySetting, p as iosLanHostSettingError, r as REMOTE_DEVICE_BACKENDS } from "./settings-xB0Frkg6.mjs";
12
+ import { D as parseIosSimulatorApp, f as listIosRuntimes } from "./ios-CmEzZiOj.mjs";
13
+ import { c as recordFinishedBuild, l as startBuildProgress, n as NO_BUILD_PROGRESS } from "./build-progress-l7d-X-ZP.mjs";
14
+ import { a as acquireBuildSlot, s as releaseBuildSlot } from "./in-use-wYEaKQM9.mjs";
15
+ import { n as verifyCollectorOwnership } from "./ownership-Bz2kETAS.mjs";
16
+ import { a as easAuthNote, c as loadProjectProvider, f as resolveEasCliBin, i as checkEasAuth, m as uploadRemote, n as UPLOAD_TIMEOUT_MS, o as exitAfterFlush, p as resolveRemote, r as cacheLevel, s as isEasAuthFailureText, t as RESOLVE_TIMEOUT_MS } from "./remote-cache--aehr4Pr.mjs";
17
+ import { F as ownedSessionName, S as withNativeBuildRun, a as ensureMetroReachable, l as remoteIosDeps, m as cancelledFailure, n as binOnPath, o as ensureRemoteBootOwned, r as bundleEntryPoint, u as resolveRemoteContext, x as runCancellation, z as gateMetroOrigin } from "./device-remote-DT9ngZiD.mjs";
18
+ import { c as clearOtherUserApps, h as iosAppProcess, m as installIosApp, r as DEFAULT_METRO_PORT, u as devClientUrl, v as launchIosApp } from "./app-install-CDFY2nUL.mjs";
19
+ import { c as readMetroRecords, d as verifyLaunch, f as verifyReleaseLaunch, i as RELEASE_VERIFY_WAIT_MS, l as unverifiedLaunchLines, n as LAUNCH_FATAL, o as isBundleProof, r as LAUNCH_UNVERIFIED, s as readCollectorRecords, t as LAUNCH_BUNDLING } from "./launch-verify-CuJaBpEa.mjs";
20
+ import { f as easDeviceBuildRemedy, h as resolveEasDevelopmentBuild, l as unknownIosDeviceTypeRefusal, m as planEasDevelopmentBuild, p as isEasBuildFailure, r as checkDeviceCapacity, u as unknownIosRuntimeRefusal } from "./simslim-Bbg9UWrt.mjs";
21
+ import { f as spawnEntry, h as detectBundleId, s as startDevServer } from "./start-BZhItkiL.mjs";
22
+ import { a as lostLine, c as releaseLeaseOnSignal, i as leaseExpiryText, l as runLease, n as DEBUG_VERIFY_STEP_MS, o as lostRefusal, r as acquireRunLease, s as parseDeviceWait, t as selectFromPool, u as waitFlagConflict } from "./device-pool-MuoiyRcu.mjs";
23
+ import { C as warmMetro, S as clearIosAdoptionPending, _ as staleNativeDirRefusal, a as refusePlan, c as skippedMissReason, d as schemesFromInfoPlist, g as runPrebuild, h as recordPrebuild, i as printPlan, l as devClientScheme, m as planPrebuild, n as planFlagRefusal, o as explainBuildMiss, p as swapJsBundle, r as planPayload, s as fingerprintErrorMissReason, t as planCachedBuild, u as pickDevClientScheme, v as ensureBooted, y as ensureOwnedDevice } from "./build-plan-BTa93o_r.mjs";
24
+ import { t as budgetGate } from "./budget-E5o91NR1.mjs";
25
+ import { a as sleep, i as launchOutcomeRecord, n as ensureWorkspaceStorageSafely, r as isPhysicalDeviceRequest, t as ensureDevServer } from "./native-runtime-CiiFHt0e.mjs";
25
26
  import { a as statsProjectKey, i as recordRunStats, n as readRunEstimates, t as createRunRecorder } from "./stats-D8rUTPHd.mjs";
26
- import { a as compilationCacheActivityLine, c as readBundleExecutable, l as readBundleId, p as describeDiagnostic, r as buildIos, s as discoverXcodeProject, t as COMPILATION_CACHE_NOT_RUN, u as resolveScheme } from "./xcode-BzplpQzc.mjs";
27
- import { n as nativeRunCommand, t as launchSlotScope } from "./slot-launch-DIACGEfH.mjs";
28
- import { a as printNativeCrashReport, n as IOS_CRASH_REPORT_RETRY, o as simulatorConsolePaths, r as captureNativeCrashes, t as errorDiagnostics } from "./error-diagnostics-CCxjn31V.mjs";
29
- import { a as iosPoolCandidates, c as listIosDevices, d as verifyIosDeviceReleaseLaunch, i as iosDeviceProcess, l as localNetworkPending, n as installIosDeviceApp, o as iosPoolNoCandidatesRefusal, r as iosDeviceBounds, s as isWirelessIosDevice, t as awaitIosDeviceLaunch, u as resolveIosPhysicalDevice } from "./ios-device-D9cLxVr5.mjs";
30
- import { a as runPodInstall, n as podsAreStale, r as readPodState } from "./deps-CO-_7UOm.mjs";
27
+ import { a as compilationCacheActivityLine, c as readBundleExecutable, l as readBundleId, p as describeDiagnostic, r as buildIos, s as discoverXcodeProject, t as COMPILATION_CACHE_NOT_RUN, u as resolveScheme } from "./xcode-LM6A8cNZ.mjs";
28
+ import { n as nativeRunCommand, t as launchSlotScope } from "./slot-launch-BIWEW-wI.mjs";
29
+ import { a as printNativeCrashReport, n as IOS_CRASH_REPORT_RETRY, o as simulatorConsolePaths, r as captureNativeCrashes, t as errorDiagnostics } from "./error-diagnostics-BoiOhck8.mjs";
30
+ import { a as iosPoolCandidates, c as listIosDevices, d as verifyIosDeviceReleaseLaunch, i as iosDeviceProcess, l as localNetworkPending, n as installIosDeviceApp, o as iosPoolNoCandidatesRefusal, r as iosDeviceBounds, s as isWirelessIosDevice, t as awaitIosDeviceLaunch, u as resolveIosPhysicalDevice } from "./ios-device-BW-t_Lkv.mjs";
31
+ import { a as runPodInstall, n as podsAreStale, r as readPodState } from "./deps-2Wo81np9.mjs";
31
32
  import { existsSync, mkdirSync, mkdtempSync, openSync, rmSync, writeFileSync } from "node:fs";
32
33
  import { InvalidArgumentError } from "commander";
33
- import { LAST_BUILD_KEYS } from "@stim-cli/core/state";
34
+ import { buildDiagnostics } from "@stim-cli/core/state";
34
35
  import { basename, join } from "node:path";
35
36
  import { X509Certificate } from "node:crypto";
36
37
  import { networkInterfaces, tmpdir } from "node:os";
@@ -236,7 +237,7 @@ function printDiagnostics(note, result) {
236
237
  }
237
238
  //#endregion
238
239
  //#region src/commands/ios/result.ts
239
- function lastBuildRecord({ fingerprint = null, cacheKey = null, cacheHit = false, cacheSkipped = false, durationMs = 0, appPath = null, bundleId = null, startedAt, status, errorCode = null, missReason = null }) {
240
+ function lastBuildRecord({ fingerprint = null, cacheKey = null, cacheHit = false, cacheSkipped = false, durationMs = 0, appPath = null, bundleId = null, startedAt, status, errorCode = null, missReason = null, diagnostics = null, configuration = null }) {
240
241
  const record = {
241
242
  platform: "ios",
242
243
  fingerprint,
@@ -247,10 +248,13 @@ function lastBuildRecord({ fingerprint = null, cacheKey = null, cacheHit = false
247
248
  appPath,
248
249
  bundleId,
249
250
  startedAt,
250
- status
251
+ status,
252
+ configuration
251
253
  };
252
254
  if (errorCode) record.errorCode = errorCode;
253
255
  if (missReason && !cacheLevel(cacheHit)) record.missReason = missReason;
256
+ const recorded = status === "failed" ? buildDiagnostics(diagnostics) : [];
257
+ if (recorded.length) record.diagnostics = recorded;
254
258
  return record;
255
259
  }
256
260
  function iosFacts({ slot, udid, deviceName, deviceType = null, runtime = null, fingerprint, configuration = null, scheme = null, cacheKey, cacheHit, cacheSkipped = false, compilationCache = COMPILATION_CACHE_NOT_RUN, waitedForBuild = null, appPath, bundleId, installSkipped = false, metroPort, logsDir, durationMs, launched = true, webPreviewUrl = null, lease, devServer = null }) {
@@ -284,12 +288,9 @@ function iosFacts({ slot, udid, deviceName, deviceType = null, runtime = null, f
284
288
  ...devServer ? { devServer } : {}
285
289
  };
286
290
  }
287
- function writeLastBuild(root, record, { write = writeWorkspaceState } = {}) {
291
+ function writeLastBuild(root, record, { record: recordBuild = recordFinishedBuild } = {}) {
288
292
  try {
289
- write(root, {
290
- lastBuild: record,
291
- [LAST_BUILD_KEYS["ios"]]: record
292
- });
293
+ recordBuild(root, record);
293
294
  } catch {}
294
295
  return record;
295
296
  }
@@ -310,7 +311,7 @@ async function finishIosUpload(uploadPending, remote, phase, note) {
310
311
  }
311
312
  return false;
312
313
  }
313
- function reportIosResult({ slot, d, root, json, release, configuration, buildScheme = null, metroCheck, metroPort, logsDir, device, udid, appPath, bundleId, installSkipped, elapsed, startedAt, storeHash, storeKey, cacheHit, missReason, compilationCache, useBuildCache, waitedForBuild, launchState, launchWarning, providerName, closeWriter, webPreviewUrl, lease, recordRun, reclaimed = [], devServer = null }) {
314
+ function reportIosResult({ slot, root, json, release, configuration, buildScheme = null, metroCheck, metroPort, logsDir, device, udid, appPath, bundleId, installSkipped, elapsed, startedAt, storeHash, storeKey, cacheHit, missReason, compilationCache, useBuildCache, waitedForBuild, launchState, launchWarning, providerName, closeWriter, webPreviewUrl, lease, recordRun, reclaimed = [], devServer = null }) {
314
315
  const durationMs = elapsed();
315
316
  recordRun({
316
317
  failed: false,
@@ -328,8 +329,9 @@ function reportIosResult({ slot, d, root, json, release, configuration, buildSch
328
329
  appPath,
329
330
  bundleId,
330
331
  startedAt,
331
- status: "ok"
332
- }), { write: d.writeWorkspaceState });
332
+ status: "ok",
333
+ configuration: configuration ?? "Debug"
334
+ }));
333
335
  closeWriter();
334
336
  const facts = iosFacts({
335
337
  slot,
@@ -399,6 +401,12 @@ var ArtifactRefusal = class extends Error {
399
401
  async function acquireIosArtifact({ root, logFile, udid, remoteDestination, device, configuration, buildScheme, buildProfile, isExpo, optimizations, cache, easBuild, easProfile, maxBuilds, progress }, d) {
400
402
  const { phase, note, logWriter, estimates, stats, step } = progress;
401
403
  const physical = device !== null;
404
+ const keyOptions = {
405
+ scheme: buildScheme,
406
+ ...configuration ? { configuration } : {},
407
+ isSimulator: !physical,
408
+ ...buildProfile ? { buildProfile } : {}
409
+ };
402
410
  const lanAddress = device?.lanAddress ?? null;
403
411
  const metroPort = device?.metroPort ?? null;
404
412
  const release = isReleaseConfiguration(configuration);
@@ -519,12 +527,7 @@ async function acquireIosArtifact({ root, logFile, udid, remoteDestination, devi
519
527
  }
520
528
  });
521
529
  fingerprint = computedFingerprint;
522
- cacheKey = buildCacheKey("ios", fingerprint, {
523
- scheme: buildScheme,
524
- ...configuration ? { configuration } : {},
525
- isSimulator: !physical,
526
- ...buildProfile ? { buildProfile } : {}
527
- });
530
+ cacheKey = buildCacheKey("ios", fingerprint, keyOptions);
528
531
  stats.setCacheKey(cacheKey);
529
532
  storeHash = fingerprint;
530
533
  storeKey = cacheKey;
@@ -765,6 +768,43 @@ async function acquireIosArtifact({ root, logFile, udid, remoteDestination, devi
765
768
  if (untracked) note(chalk.dim(phaseLine("fingerprint", untracked)));
766
769
  }
767
770
  }
771
+ async function settleStoreKeyAfterCompile(prebuildRan) {
772
+ if (!storeHash || !storeKey) return;
773
+ const afterBuild = await refingerprintAfterMutation({
774
+ projectRoot: root,
775
+ platform: "ios",
776
+ previousHash: storeHash,
777
+ fingerprint: d.fingerprintProject
778
+ });
779
+ const changedDuringBuild = afterBuild ? inputsChangedDuringBuild({
780
+ platform: "ios",
781
+ lookup: fingerprintSources,
782
+ prebuildRan,
783
+ compiled: storeSources,
784
+ current: afterBuild.sources
785
+ }) : [];
786
+ if (!afterBuild || changedDuringBuild.length) {
787
+ storeHash = null;
788
+ storeKey = null;
789
+ buildFailure = {
790
+ ...buildFailure,
791
+ fingerprint: null,
792
+ cacheKey: null
793
+ };
794
+ note(chalk.yellow(phaseLine("fingerprint", afterBuild ? changedDuringBuildLine(changedDuringBuild) : "unavailable after xcodebuild; the build will be installed but not cached")));
795
+ } else if (afterBuild.moved) {
796
+ const beforeBuildHash = storeHash;
797
+ storeHash = afterBuild.hash;
798
+ storeSources = afterBuild.sources;
799
+ storeKey = buildCacheKey("ios", afterBuild.hash, keyOptions);
800
+ buildFailure = {
801
+ ...buildFailure,
802
+ fingerprint: storeHash,
803
+ cacheKey: storeKey
804
+ };
805
+ note(chalk.dim(phaseLine("fingerprint", `${shortHash(beforeBuildHash)} -> ${shortHash(storeHash)} (after xcodebuild)`)));
806
+ }
807
+ }
768
808
  async function buildArtifact() {
769
809
  buildFailure = {
770
810
  fingerprint,
@@ -858,8 +898,10 @@ async function acquireIosArtifact({ root, logFile, udid, remoteDestination, devi
858
898
  previousHash: fingerprint,
859
899
  fingerprint: d.fingerprintProject
860
900
  });
861
- if (after && mutatingSteps.includes("prebuild")) recordPrebuild(root, "ios", after.hash);
862
- if (!after) {
901
+ const prebuildRan = mutatingSteps.includes("prebuild");
902
+ const editedConfig = after ? configInputsChanged(fingerprintSources, after.sources, { prebuildRan }) : [];
903
+ if (after && !editedConfig.length && prebuildRan) recordPrebuild(root, "ios", after.hash);
904
+ if (!after || editedConfig.length) {
863
905
  storeHash = null;
864
906
  storeKey = null;
865
907
  buildFailure = {
@@ -867,17 +909,12 @@ async function acquireIosArtifact({ root, logFile, udid, remoteDestination, devi
867
909
  fingerprint: null,
868
910
  cacheKey: null
869
911
  };
870
- note(chalk.yellow(phaseLine("fingerprint", `unavailable after ${mutatingSteps.join(", ")}; the build will be installed but not cached`)));
912
+ note(chalk.yellow(phaseLine("fingerprint", after ? changedDuringBuildLine(editedConfig) : `unavailable after ${mutatingSteps.join(", ")}; the build will be installed but not cached`)));
871
913
  } else if (after.moved) {
872
914
  rekeyedBy.push(...mutatingSteps.map((mutation) => mutation === "prebuild" ? mutation : "pod install"));
873
915
  storeHash = after.hash;
874
916
  storeSources = after.sources;
875
- storeKey = buildCacheKey("ios", after.hash, {
876
- scheme: buildScheme,
877
- ...configuration ? { configuration } : {},
878
- isSimulator: !physical,
879
- ...buildProfile ? { buildProfile } : {}
880
- });
917
+ storeKey = buildCacheKey("ios", after.hash, keyOptions);
881
918
  buildFailure = {
882
919
  ...buildFailure,
883
920
  fingerprint: storeHash,
@@ -925,13 +962,17 @@ async function acquireIosArtifact({ root, logFile, udid, remoteDestination, devi
925
962
  message: report.message,
926
963
  remedy: report.remedy,
927
964
  logPath: logFile,
928
- build: buildFailure
965
+ build: {
966
+ ...buildFailure,
967
+ diagnostics: result.diagnostics
968
+ }
929
969
  });
930
970
  }
931
971
  stats.setBuildMs(result.durationMs);
932
972
  phase("build", `ok (${formatDuration(result.durationMs)})`);
933
973
  appPath = result.appPath;
934
974
  bundleId = result.bundleId;
975
+ await settleStoreKeyAfterCompile(mutatingSteps.includes("prebuild"));
935
976
  if (storeKey && cachePolicy.write) try {
936
977
  const stored = await storeTieredBuild({
937
978
  local: filesystemBuildCapability({
@@ -2237,7 +2278,6 @@ async function finishIosRun({ artifact, d, root, slot, json, release, configurat
2237
2278
  const uploadsAbandoned = await artifact.completeUploads();
2238
2279
  return {
2239
2280
  facts: reportIosResult({
2240
- d,
2241
2281
  root,
2242
2282
  slot,
2243
2283
  json,
@@ -2607,6 +2647,7 @@ async function runIos(opts = {}, overrides = {}, progress = NO_BUILD_PROGRESS) {
2607
2647
  const recordRun = stats.record;
2608
2648
  let compilationCache = COMPILATION_CACHE_NOT_RUN;
2609
2649
  let reclaimed = [];
2650
+ let builtConfiguration = null;
2610
2651
  const fail = ({ code, message, remedy = null, lines = [], logPath = null, build = null, lease }) => {
2611
2652
  ({code, message, remedy, lines} = cancelledFailure("ios", {
2612
2653
  code,
@@ -2624,11 +2665,12 @@ async function runIos(opts = {}, overrides = {}, progress = NO_BUILD_PROGRESS) {
2624
2665
  if (logPath) note(chalk.dim(phaseLine("log", logPath)));
2625
2666
  if (build) writeLastBuild(root, lastBuildRecord({
2626
2667
  ...build,
2668
+ configuration: builtConfiguration,
2627
2669
  startedAt,
2628
2670
  status: "failed",
2629
2671
  errorCode: code,
2630
2672
  durationMs: elapsed()
2631
- }), { write: d.writeWorkspaceState });
2673
+ }));
2632
2674
  note(chalk.red(phaseLine("failed", code)));
2633
2675
  recordRun({
2634
2676
  failed: true,
@@ -2702,6 +2744,7 @@ async function runIos(opts = {}, overrides = {}, progress = NO_BUILD_PROGRESS) {
2702
2744
  remedy: SETTING_SHAPE_REMEDY
2703
2745
  });
2704
2746
  const configuration = opts.easProfile !== void 0 ? null : resolveConfiguration(opts.configuration, settings);
2747
+ builtConfiguration = configuration ?? "Debug";
2705
2748
  const buildScheme = opts.scheme;
2706
2749
  const release = isReleaseConfiguration(configuration);
2707
2750
  const cachePolicy = artifactCachePolicy(optimizations, useBuildCache, release);
@@ -2882,6 +2925,7 @@ async function runIos(opts = {}, overrides = {}, progress = NO_BUILD_PROGRESS) {
2882
2925
  flags: {
2883
2926
  deviceType,
2884
2927
  runtime,
2928
+ runtimeFlag: resolveRuntime(opts.runtime, null),
2885
2929
  simulatorApp
2886
2930
  },
2887
2931
  note,
@@ -1,8 +1,9 @@
1
1
  import { _ as loadConfig$1 } from "./config-0jCcMM0E.mjs";
2
2
  import { t as getExecutor } from "./exec-DK8KaVHK.mjs";
3
3
  import { n as stripAnsi, r as waitForChild, t as createLineReader } from "./process-output-Fpl8PYi8.mjs";
4
- import { t as settingDefault } from "./stim-desktop-D0xhpZt8.mjs";
5
- import { $ as forgetCreatedDevice, Q as isStimOwnedSim, et as recordCreatedDevice } from "./android-75Sk2rIR.mjs";
4
+ import { n as settingDefault, t as STIM_DESKTOP_OPEN_OPTIONS } from "./stim-desktop-CXt8-Z3J.mjs";
5
+ import { nt as isStimOwnedSim } from "./android-qx_31wJo.mjs";
6
+ import { r as recordCreatedDevice, t as forgetCreatedDevice } from "./created-devices-Cd558h31.mjs";
6
7
  import { existsSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
7
8
  import { IOS_SIMULATOR_APPS, settingDefinition } from "@stim-cli/core/state";
8
9
  import { dirname, join, resolve } from "node:path";
@@ -50,7 +51,7 @@ function openSimulator(app, udid) {
50
51
  "-a",
51
52
  "Stim",
52
53
  `stim-desktop://open?udid=${udid}`
53
- ], OPEN_OPTIONS);
54
+ ], STIM_DESKTOP_OPEN_OPTIONS);
54
55
  return;
55
56
  }
56
57
  if (app === "siniulator") {
@@ -104,7 +105,8 @@ function parseSimctlList(jsonOutput, { includeUnavailable = false } = {}) {
104
105
  deviceTypeIdentifier: typed.deviceTypeIdentifier,
105
106
  available,
106
107
  ...typed.dataPath !== void 0 ? { dataPath: typed.dataPath } : {},
107
- ...typed.dataPathSize !== void 0 ? { dataPathSize: typed.dataPathSize } : {}
108
+ ...typed.dataPathSize !== void 0 ? { dataPathSize: typed.dataPathSize } : {},
109
+ ...typeof typed.lastUsedAt === "string" ? { lastUsedAt: typed.lastUsedAt } : {}
108
110
  });
109
111
  }
110
112
  }
@@ -225,9 +227,12 @@ async function bootIosSim(udid, { timeoutMs = IOS_BOOT_TIMEOUT_MS, attemptMs = B
225
227
  };
226
228
  const recovery = "Stop unused slots in workspaces you own with `stim stop --slot <name>`, reduce concurrent builds, and retry after pressure falls. Ask before closing other agents' devices or apps. Repeated reboots under unchanged pressure may stall again.";
227
229
  const coverage = () => longestGapMs > 3e4 ? ` Observations were delayed: longest gap ${Math.round(longestGapMs / 1e3)}s. Pressure during gaps is unobserved; blocking CLI work can also delay progress and timeout handling.` : "";
230
+ let warnedPressure = null;
228
231
  const report = () => {
229
232
  const pressure = sample();
230
- out(`Simulator ${label} is still booting after ${Math.round((Date.now() - started) / 1e3)}s. Last boot output: ${phase}. Memory pressure: ${pressure ?? "unknown"}; highest observed: ${worst ?? "unknown"}. Boot deadline: ${Math.round(timeoutMs / 1e3)}s.${coverage()}${pressure === "warning" || pressure === "critical" ? ` Boot may be delayed or stalled. ${recovery}` : ""}`);
233
+ const warn = (pressure === "warning" || pressure === "critical") && pressure !== warnedPressure;
234
+ if (pressure !== null) warnedPressure = pressure;
235
+ out(`Simulator ${label} is still booting after ${Math.round((Date.now() - started) / 1e3)}s. Last boot output: ${phase}. Memory pressure: ${pressure ?? "unknown"}; highest observed: ${worst ?? "unknown"}. Boot deadline: ${Math.round(timeoutMs / 1e3)}s.${coverage()}${warn ? ` Boot may be delayed or stalled. ${recovery}` : ""}`);
231
236
  };
232
237
  const onLine = (line) => {
233
238
  phase = line.slice(0, 240);
@@ -1,6 +1,6 @@
1
1
  import { t as getExecutor } from "./exec-DK8KaVHK.mjs";
2
2
  import { n as TOOL_ERROR_PREFIX } from "./ios-device-BiOsSVzd.mjs";
3
- import { i as INSTALL_ERROR } from "./app-install-CsZi0SAT.mjs";
3
+ import { i as INSTALL_ERROR } from "./app-install-CDFY2nUL.mjs";
4
4
  import { mkdtempSync, readFileSync, rmSync } from "node:fs";
5
5
  import { join } from "node:path";
6
6
  import { tmpdir } from "node:os";
@@ -1,8 +1,8 @@
1
1
  import { t as getExecutor } from "./exec-DK8KaVHK.mjs";
2
2
  import { o as readNdjsonGenerations } from "./ndjson-CDY9IkVC.mjs";
3
- import { s as isAppLaunchError } from "./command-output-BWCj5Vh-.mjs";
3
+ import { s as isAppLaunchError } from "./command-output-BIL7rlX7.mjs";
4
4
  import { t as DEV_MENU_LAUNCH_ARGS } from "./ios-device-BiOsSVzd.mjs";
5
- import { d as deviceShellArg, n as ANDROID_DISABLE_AUTO_LAUNCH_EXTRA, o as androidAppProcess } from "./app-install-CsZi0SAT.mjs";
5
+ import { d as deviceShellArg, n as ANDROID_DISABLE_AUTO_LAUNCH_EXTRA, o as androidAppProcess } from "./app-install-CDFY2nUL.mjs";
6
6
  import { join } from "node:path";
7
7
  //#region src/engine/app-readiness.ts
8
8
  const APP_READINESS_TIMEOUT_MS = 3e4;
@@ -236,27 +236,40 @@ async function verifyLaunch({ slot, logsDir, since, metroPort = null, platform =
236
236
  ...pendingAt !== null ? { readiness: appErrors ? "error" : ready ? "ready" : "timed-out" } : {}
237
237
  };
238
238
  }
239
- if ((!proof || runtimeWaiting) && now() >= bundleDeadline) {
240
- const requested = findBundleRequest(deviceRecords, since, metroPort, platform) ?? activity;
241
- const waitedMs = now() - startedAt;
242
- if (requested) return {
243
- verified: false,
244
- timedOut: true,
245
- requested: true,
246
- record: requested,
247
- mode,
248
- waitedMs
249
- };
250
- return {
251
- verified: false,
252
- timedOut: true,
253
- mode,
254
- waitedMs
255
- };
256
- }
239
+ if ((!proof || runtimeWaiting) && now() >= bundleDeadline) return bundleTimeoutOutcome({
240
+ requested: findBundleRequest(deviceRecords, since, metroPort, platform) ?? activity,
241
+ processAlive,
242
+ deviceRecords,
243
+ platform,
244
+ mode,
245
+ waitedMs: now() - startedAt
246
+ });
257
247
  await sleep(Math.min(pollMs, Math.max(0, (runtimeWaiting ? bundleDeadline : proof && pendingAt !== null ? readinessDeadline : stabilityDeadline ?? bundleDeadline) - now())));
258
248
  }
259
249
  }
250
+ function bundleTimeoutOutcome({ requested, processAlive, deviceRecords, platform, mode, waitedMs }) {
251
+ if (processAlive?.() === false) return {
252
+ verified: false,
253
+ fatal: true,
254
+ errors: deviceRecords.filter((record) => recordCouldBelongToPlatform(record, platform) && isLaunchError(record, platform) && !isIosConnectionRefusal(record, platform)),
255
+ processAlive: false,
256
+ mode,
257
+ waitedMs
258
+ };
259
+ return requested ? {
260
+ verified: false,
261
+ timedOut: true,
262
+ requested: true,
263
+ record: requested,
264
+ mode,
265
+ waitedMs
266
+ } : {
267
+ verified: false,
268
+ timedOut: true,
269
+ mode,
270
+ waitedMs
271
+ };
272
+ }
260
273
  function after(record, since) {
261
274
  const ts = Number(record.ts);
262
275
  return Number.isFinite(ts) && ts >= Number(since ?? 0);
@@ -1,12 +1,12 @@
1
1
  import { H as parseDeviceSlotOption, O as process_identity_exports, U as projectDeviceSlots, _ as loadConfig$1, g as isPathPrefix } from "./config-0jCcMM0E.mjs";
2
2
  import { n as SOURCES, t as LEVELS } from "./ndjson-CDY9IkVC.mjs";
3
- import { j as workspaceLogsDir, m as readWorkspaceState$1 } from "./metro-Dzo30hvJ.mjs";
4
- import { i as findProjectRoot } from "./project-B8rbutVC.mjs";
5
- import { f as refuseNoProject, v as launchErrorPreview } from "./command-output-BWCj5Vh-.mjs";
6
- import { i as readAgentDeviceRecords, t as agentDeviceLiveness } from "./activity-CCZJs__P.mjs";
7
- import { i as captureWorkspaceCrashes, t as errorDiagnostics } from "./error-diagnostics-CCxjn31V.mjs";
3
+ import { M as workspaceLogsDir, h as readWorkspaceState$1 } from "./metro-BPeY1YMh.mjs";
4
+ import { i as findCommandWorkspace } from "./project-DGeclhvO.mjs";
5
+ import { f as refuseNoProject, v as launchErrorPreview } from "./command-output-BIL7rlX7.mjs";
6
+ import { a as readAgentDeviceRecords, t as agentDeviceLiveness } from "./activity-DfVKZTEB.mjs";
7
+ import { i as captureWorkspaceCrashes, t as errorDiagnostics } from "./error-diagnostics-BoiOhck8.mjs";
8
8
  import { closeSync, fstatSync, openSync, readFileSync, readSync, readdirSync, realpathSync, statSync } from "node:fs";
9
- import { buildCriteria, compileGrep, fileSizes, followLogs, logFiles, parseSince, queryLogs, readLogRecords, recordMatches, sortByTs } from "@stim-cli/core/state";
9
+ import { attachExpoErrorContext, buildCriteria, compileGrep, fileSizes, followLogs, logFiles, parseSince, queryLogs, readLogRecords, recordMatches, sortByTs } from "@stim-cli/core/state";
10
10
  import { join, relative, resolve, sep } from "node:path";
11
11
  import { homedir } from "node:os";
12
12
  import chalk from "chalk";
@@ -359,8 +359,8 @@ const LEVEL_COLOURS = {
359
359
  fatal: chalk.bgRed
360
360
  };
361
361
  function logsCommand(program) {
362
- program.command("logs").description("Query this workspace's merged NDJSON log timeline (bundler, client, device, build, agent-device actions). Prints and exits; an existing timeline with nothing matching is a successful, empty result. Use --follow to stream.").option("--slot <name>", "Only records attributed to this device slot", parseDeviceSlotOption).option("--source <s...>", "Only these sources: metro, client, device, build, agent, or all").option("--level <l>", `Minimum level: ${LEVELS.join(", ")}`).option("--since <d>", "Only records newer than this, e.g. 30s, 5m, 2h").option("--grep <re>", "Only records whose message matches this regular expression").option("--tail <n>", "Only the last n matching records").option("--errors", "Errors and fatals since the last marker, from metro, client and build, plus confirmed native app-crash reports. Add --source device or --source all for general device errors.").option("--follow", "Keep streaming new records until interrupted").option("--json", "Emit the raw records, one per line (valid NDJSON; zero matches is zero bytes, exit 0)").action(async (opts) => {
363
- const root = findProjectRoot(process.cwd());
362
+ program.command("logs").description("Query this workspace's merged NDJSON log timeline (bundler, client, device, build, agent-device actions). Prints and exits; an existing timeline with nothing matching is a successful, empty result. Use --follow to stream.").option("--slot <name>", "Only records attributed to this device slot", parseDeviceSlotOption).option("--source <s...>", "Only these sources: metro, client, device, build, agent, or all").option("--level <l>", `Minimum level: ${LEVELS.join(", ")}`).option("--since <d>", "Only records newer than this, e.g. 30s, 5m, 2h").option("--grep <re>", "Only records whose message matches this regular expression").option("--tail <n>", "Only the last n matching records").option("--errors", "Errors and fatals since the last marker, from metro, client and build, plus confirmed native app-crash reports and stim web browser errors. Add --source device or --source all for general device errors.").option("--follow", "Keep streaming new records until interrupted").option("--json", "Emit the raw records, one per line (valid NDJSON; zero matches is zero bytes, exit 0)").action(async (opts) => {
363
+ const root = findCommandWorkspace(process.cwd());
364
364
  if (!root) {
365
365
  refuseNoProject({ json: false });
366
366
  return;
@@ -430,7 +430,7 @@ function logsCommand(program) {
430
430
  records: timeline
431
431
  });
432
432
  const supervisorPort = readWorkspaceState$1(root)?.supervisor?.port;
433
- const records = opts.json ? rawRecords : await errorDiagnostics(rawRecords, {
433
+ const records = opts.json ? opts.errors ? attachExpoErrorContext(timeline, rawRecords, "field") : rawRecords : await errorDiagnostics(rawRecords, {
434
434
  root,
435
435
  logsDir: dir,
436
436
  port: typeof supervisorPort === "number" ? supervisorPort : null,
@@ -463,7 +463,8 @@ function logsCommand(program) {
463
463
  dir,
464
464
  offsets,
465
465
  criteria,
466
- onRecord: emit
466
+ onRecord: emit,
467
+ errorContext: opts.errors ? opts.json ? "field" : "msg" : void 0
467
468
  });
468
469
  const agentTimer = readAgent ? setInterval(() => {
469
470
  for (const record of readAgent()) if (recordMatches(record, criteria)) emit(record);
@@ -1,7 +1,7 @@
1
1
  import { N as isOnMountedVolume, O as process_identity_exports, P as listMountedVolumes, _ as loadConfig$1, b as releaseMetroPort, n as allMetroPorts, r as claimMetroPort } from "./config-0jCcMM0E.mjs";
2
2
  import { t as getExecutor } from "./exec-DK8KaVHK.mjs";
3
3
  import { existsSync, mkdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
4
- import { existsSync as existsSync$1, readlinkSync, realpathSync as realpathSync$1 } from "fs";
4
+ import { existsSync as existsSync$1, readlinkSync as readlinkSync$1, realpathSync as realpathSync$1 } from "fs";
5
5
  import { join, resolve, sep } from "path";
6
6
  import { buildCacheRoot as sharedBuildCache, withDirLock, workspaceId, workspaceName as workspaceName$1, workspaceStateDir as workspaceDir } from "@stim-cli/core";
7
7
  import { emulatorLogFile, readJsonObject, readWorkspaceState, readWorkspaceState as readWorkspaceState$1, sharedCcache, sharedCompilationCache, supervisorLogFile, supervisorPidFile, workspaceDerivedData, workspaceLastUsed, workspaceLogErrorIndex, workspaceLogsDir, workspaceMetadataFile, workspaceStateFile, workspaceStateLock } from "@stim-cli/core/state";
@@ -296,7 +296,7 @@ async function processCwds(pids) {
296
296
  for (const pid of new Set(pids)) {
297
297
  let cwd = null;
298
298
  if (process.platform === "linux") try {
299
- cwd = readlinkSync(`/proc/${pid}/cwd`);
299
+ cwd = readlinkSync$1(`/proc/${pid}/cwd`);
300
300
  } catch {}
301
301
  if (cwd) cwds.set(pid, cwd);
302
302
  else viaLsof.push(pid);
@@ -317,7 +317,7 @@ async function processCwds(pids) {
317
317
  }
318
318
  function processCwd(pid) {
319
319
  if (process.platform === "linux") try {
320
- return readlinkSync(`/proc/${pid}/cwd`);
320
+ return readlinkSync$1(`/proc/${pid}/cwd`);
321
321
  } catch {}
322
322
  return parseLsofCwd(getExecutor().runQuiet(`lsof -a -p ${pid} -d cwd -Fn`));
323
323
  }
@@ -406,4 +406,4 @@ function killMetroTree(leader, processToken) {
406
406
  }
407
407
  }
408
408
  //#endregion
409
- export { workspaceLogErrorIndex as A, sharedCcache as C, workspaceDerivedData as D, supervisorPidFile as E, workspaceName$1 as M, workspaceStateFile as N, workspaceDir as O, withDirLock as P, sharedBuildCache as S, supervisorLogFile as T, withWorkspaceStateLock as _, processCwd as a, emulatorLogFile as b, signalProcessTree as c, reserveMetroPort as d, clearWorkspaceStateKey as f, updateWorkspaceState as g, recordWorkspaceUse as h, pidExists as i, workspaceLogsDir as j, workspaceId as k, isMetroRunning as l, readWorkspaceState$1 as m, listeningPids as n, processCwds as o, clearWorkspaceStateKeys as p, listeningPidsByPort as r, resolveProjectMetro as s, killMetroTree as t, isPortFree as u, workspaceLastUsed as v, sharedCompilationCache as w, ensureWorkspaceStorage as x, writeWorkspaceState as y };
409
+ export { workspaceId as A, sharedBuildCache as C, supervisorPidFile as D, supervisorLogFile as E, withDirLock as F, workspaceLogsDir as M, workspaceName$1 as N, workspaceDerivedData as O, workspaceStateFile as P, ensureWorkspaceStorage as S, sharedCompilationCache as T, updateWorkspaceState as _, pidExists as a, writeWorkspaceState as b, resolveProjectMetro as c, isPortFree as d, reserveMetroPort as f, recordWorkspaceUse as g, readWorkspaceState$1 as h, listeningPidsByPort as i, workspaceLogErrorIndex as j, workspaceDir as k, signalProcessTree as l, clearWorkspaceStateKeys as m, killMetroTree as n, processCwd as o, clearWorkspaceStateKey as p, listeningPids as r, processCwds as s, NOT_OURS_FOREIGN_CWD as t, isMetroRunning as u, withWorkspaceStateLock as v, sharedCcache as w, emulatorLogFile as x, workspaceLastUsed as y };