stim 1.10.1 → 1.11.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/dist/{build-progress-BXx-ZBe4.mjs → activity-BtG4Va9l.mjs} +8 -182
- package/dist/{android-DPov-fv2.mjs → android-BA2i_KAV.mjs} +1 -1
- package/dist/{android-Bu4mbDzc.mjs → android-C1q4l523.mjs} +376 -99
- package/dist/{android-787HhP5w.mjs → android-C4zG2Tuc.mjs} +63 -18
- package/dist/{android-cas-CITmIeWY.mjs → android-cas-DfJkwCXW.mjs} +3 -3
- package/dist/{app-install-Cfmqr3TQ.mjs → app-install-DHut6JnV.mjs} +1 -1
- package/dist/{budget-nDCEwtJv.mjs → budget-De3P2rq_.mjs} +9 -9
- package/dist/{dev-client-DExzPiOa.mjs → build-plan-CeAYgKAx.mjs} +415 -24
- package/dist/build-progress-CDwogz6R.mjs +179 -0
- package/dist/cli.mjs +14 -14
- package/dist/collector-run.mjs +1 -1
- package/dist/{deps-DP4eWqea.mjs → deps-OF7CD5Dx.mjs} +2 -2
- package/dist/{device-Czh5kO8A.mjs → device-BwH2iI3O.mjs} +47 -9
- package/dist/{device-lease-CbEaIk7b.mjs → device-lease-D83nqeMX.mjs} +51 -51
- package/dist/{device-pool-BBWLAr55.mjs → device-pool-DHj7cdPy.mjs} +2 -2
- package/dist/{device-remote-powUHdbK.mjs → device-remote-BQZSnnmE.mjs} +7 -7
- package/dist/{doctor-CmqK1LcQ.mjs → doctor-D8QdMRMf.mjs} +12 -12
- package/dist/{error-diagnostics-xxWKNO3-.mjs → error-diagnostics-UYFSQwRy.mjs} +3 -3
- package/dist/{gc-zCDpmdHU.mjs → gc-COZteyiq.mjs} +27 -253
- package/dist/{guide-DwmaD_Wa.mjs → guide-NDvTmMi-.mjs} +336 -48
- package/dist/{idle--jn7pBNe.mjs → idle-NETbeNiQ.mjs} +4 -3
- package/dist/{in-use-CNIWU-r-.mjs → in-use-DVhlSoyn.mjs} +4 -4
- package/dist/{ios-CbdqTqOc.mjs → ios-CQLKpNfr.mjs} +294 -81
- package/dist/{ios-COGcGEcN.mjs → ios-DArbmwer.mjs} +2 -1
- package/dist/{ios-device-DNjPXBnb.mjs → ios-device-CwDZo0X4.mjs} +1 -1
- package/dist/{launch-verify-BhgkYAws.mjs → launch-verify-CuPDGXdr.mjs} +1 -1
- package/dist/logs-B44a1UeU.mjs +485 -0
- package/dist/merge-state-DDxS-XIZ.mjs +232 -0
- package/dist/{named-ports-DiTfSz6p.mjs → named-ports-Dc7neAlc.mjs} +1 -1
- package/dist/native-run-D7yB_AsB.mjs +143 -0
- package/dist/{ownership-BfPNRf3-.mjs → ownership-BiojdtAp.mjs} +3 -3
- package/dist/{ports-CLSSFOuz.mjs → ports-DwBaRFJs.mjs} +1 -1
- package/dist/{reload-CymyF6Kk.mjs → reload-By9Dwsrt.mjs} +4 -4
- package/dist/{server-bare-DVbb7kXH.mjs → server-bare-D_RK1RCj.mjs} +1 -1
- package/dist/server-expo-B-CCUJZj.mjs +2 -0
- package/dist/{server-expo-BvOCeakp.mjs → server-expo-o6H5gcBc.mjs} +1 -1
- package/dist/{settings-DOugPlPz.mjs → settings-B5oFZEri.mjs} +12 -3
- package/dist/{settings-EWYNwe72.mjs → settings-C0ugALSC.mjs} +1 -1
- package/dist/settings.schema.json +52 -0
- package/dist/{simslim-DZUxzsjq.mjs → simslim-CIR3IYJO.mjs} +150 -95
- package/dist/{slot-launch-Dk4oTREM.mjs → slot-launch-rggO1Esw.mjs} +2 -2
- package/dist/{spawn-claims-CUleC2cM.mjs → spawn-claims-BJwXTMPt.mjs} +24 -1
- package/dist/{start-RbmFPeZ7.mjs → start-BSsf2tUs.mjs} +4 -4
- package/dist/{start-qWapeB4W.mjs → start-i8zc9VmS.mjs} +1 -1
- package/dist/{status-Zp8kvexe.mjs → status-CitcBRsC.mjs} +227 -22
- package/dist/{status-Dr4fRkym.mjs → status-Q-WDEGCB.mjs} +20 -6
- package/dist/{stop-DcEv5sk-.mjs → stop-DIhrvu0B.mjs} +188 -27
- package/dist/stop-rst5mL14.mjs +3 -0
- package/dist/supervisor-run.mjs +7 -7
- package/dist/{workspace-process-lock-BXA96myD.mjs → workspace-process-lock-Cx74RSDZ.mjs} +9 -4
- package/dist/{workspaces-wrH6dXfu.mjs → workspaces-COD2xCz-.mjs} +15 -5
- package/dist/{worktree-DEG2o9F8.mjs → worktree-DhxDTK44.mjs} +1 -1
- package/dist/{worktree-Bd4dRvx7.mjs → worktree-KOjMX3zA.mjs} +8 -8
- package/dist/{xcode-B2tBkf0m.mjs → xcode-B5SPD--o.mjs} +3 -3
- package/package.json +5 -5
- package/dist/logs-MARIy6m9.mjs +0 -209
- package/dist/server-expo-DBVTdult.mjs +0 -2
- package/dist/stop-DI4BG4Os.mjs +0 -3
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { D as process_identity_exports
|
|
1
|
+
import { D as process_identity_exports } from "./config-BEq0Qw_a.mjs";
|
|
2
2
|
import { t as getExecutor } from "./exec-DK8KaVHK.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { i as listLeaseFiles, r as leaseIsExpired } from "./device-lease-CbEaIk7b.mjs";
|
|
3
|
+
import { j as workspaceLogsDir, m as readWorkspaceState } from "./metro-BWLOJ_Wr.mjs";
|
|
4
|
+
import { i as listLeaseFiles, r as leaseIsExpired } from "./device-lease-D83nqeMX.mjs";
|
|
6
5
|
import { closeSync, fstatSync, openSync, readFileSync, readSync, readdirSync } from "node:fs";
|
|
7
|
-
import { BUILD_PHASES } from "@stim-cli/core/state";
|
|
8
6
|
import { basename, join, resolve } from "node:path";
|
|
9
7
|
import { homedir } from "node:os";
|
|
10
8
|
//#region src/devices/activity.ts
|
|
@@ -68,6 +66,8 @@ function parseAgentDeviceRecord(kind, path, raw) {
|
|
|
68
66
|
path,
|
|
69
67
|
kind,
|
|
70
68
|
deviceId,
|
|
69
|
+
session: kind === "claim" && typeof entry?.session === "string" && entry.session ? entry.session : null,
|
|
70
|
+
deviceName: kind === "claim" && typeof device?.name === "string" ? device.name : null,
|
|
71
71
|
readable: Boolean(entry && deviceId),
|
|
72
72
|
owner: entry ? field(entry, "ownerPid", "ownerStartTime") : null,
|
|
73
73
|
runner: entry && kind === "runner-lease" ? field(entry, "runnerPid", "runnerStartTime") : null,
|
|
@@ -298,7 +298,7 @@ function createActivityReader({ now = Date.now(), home = homedir(), startOf = pr
|
|
|
298
298
|
basis: "metro-bundle",
|
|
299
299
|
at: bundleAt
|
|
300
300
|
});
|
|
301
|
-
const usedAt = Date.parse(String(readWorkspaceState
|
|
301
|
+
const usedAt = Date.parse(String(readWorkspaceState(target.workspace)?.lastUsedAt ?? ""));
|
|
302
302
|
if (Number.isFinite(usedAt)) evidence.recency.push({
|
|
303
303
|
basis: "workspace-use",
|
|
304
304
|
at: usedAt
|
|
@@ -309,7 +309,7 @@ function createActivityReader({ now = Date.now(), home = homedir(), startOf = pr
|
|
|
309
309
|
}
|
|
310
310
|
function workspaceActivity(workspace, now = Date.now()) {
|
|
311
311
|
const dir = workspaceLogsDir(workspace);
|
|
312
|
-
const state = readWorkspaceState
|
|
312
|
+
const state = readWorkspaceState(workspace);
|
|
313
313
|
const recency = [];
|
|
314
314
|
const deviceAt = latestRecordAt(tailLines(join(dir, "device.ndjson")) ?? [], (record) => record.src === "device" && isDeviceRecord(record));
|
|
315
315
|
if (deviceAt !== null) recency.push({
|
|
@@ -335,178 +335,4 @@ function workspaceActivity(workspace, now = Date.now()) {
|
|
|
335
335
|
}, now);
|
|
336
336
|
}
|
|
337
337
|
//#endregion
|
|
338
|
-
|
|
339
|
-
const ACTIVE_BUILD_KEY = "activeBuild";
|
|
340
|
-
const NO_BUILD_PROGRESS = {
|
|
341
|
-
step: () => {},
|
|
342
|
-
durations: () => ({}),
|
|
343
|
-
clear: () => {}
|
|
344
|
-
};
|
|
345
|
-
const COLD_PHASES = [
|
|
346
|
-
"prebuild",
|
|
347
|
-
"pods",
|
|
348
|
-
"compile"
|
|
349
|
-
];
|
|
350
|
-
const DEVICE_PHASES = ["install", "launch"];
|
|
351
|
-
function startBuildProgress({ root, platform, slot, claim, now = Date.now, note = () => {} }) {
|
|
352
|
-
const startedAt = new Date(now()).toISOString();
|
|
353
|
-
const record = {
|
|
354
|
-
platform,
|
|
355
|
-
slot,
|
|
356
|
-
startedAt,
|
|
357
|
-
phase: "prepare",
|
|
358
|
-
phaseStartedAt: startedAt,
|
|
359
|
-
phases: [{
|
|
360
|
-
phase: "prepare",
|
|
361
|
-
startedAt
|
|
362
|
-
}],
|
|
363
|
-
claim: {
|
|
364
|
-
root: claim.root,
|
|
365
|
-
path: claim.path,
|
|
366
|
-
claimId: claim.claimId,
|
|
367
|
-
pid: claim.owner.pid
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
let warned = false;
|
|
371
|
-
const guard = (fn) => {
|
|
372
|
-
try {
|
|
373
|
-
fn();
|
|
374
|
-
} catch (error) {
|
|
375
|
-
if (warned) return;
|
|
376
|
-
warned = true;
|
|
377
|
-
note(`Build progress could not be recorded in the workspace state: ${error?.message || error}`);
|
|
378
|
-
}
|
|
379
|
-
};
|
|
380
|
-
const write = () => guard(() => updateWorkspaceState(root, (state) => ({
|
|
381
|
-
...state,
|
|
382
|
-
[ACTIVE_BUILD_KEY]: record
|
|
383
|
-
})));
|
|
384
|
-
write();
|
|
385
|
-
return {
|
|
386
|
-
step(phase) {
|
|
387
|
-
if (phase === record.phase) return;
|
|
388
|
-
const at = new Date(now()).toISOString();
|
|
389
|
-
record.phase = phase;
|
|
390
|
-
record.phaseStartedAt = at;
|
|
391
|
-
record.phases.push({
|
|
392
|
-
phase,
|
|
393
|
-
startedAt: at
|
|
394
|
-
});
|
|
395
|
-
write();
|
|
396
|
-
},
|
|
397
|
-
durations() {
|
|
398
|
-
return phaseDurations(record.phases, now());
|
|
399
|
-
},
|
|
400
|
-
clear() {
|
|
401
|
-
guard(() => {
|
|
402
|
-
clearWorkspaceStateKey(root, ACTIVE_BUILD_KEY, (value) => parseActiveBuild(value)?.claim.claimId === record.claim.claimId);
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
function phaseDurations(phases, now) {
|
|
408
|
-
const out = {};
|
|
409
|
-
phases.forEach(({ phase, startedAt }, index) => {
|
|
410
|
-
const start = Date.parse(startedAt);
|
|
411
|
-
const next = phases[index + 1];
|
|
412
|
-
const end = next ? Date.parse(next.startedAt) : now;
|
|
413
|
-
if (!Number.isFinite(start) || !Number.isFinite(end)) return;
|
|
414
|
-
out[phase] = (out[phase] ?? 0) + Math.max(0, end - start);
|
|
415
|
-
});
|
|
416
|
-
return out;
|
|
417
|
-
}
|
|
418
|
-
function parseActiveBuild(value) {
|
|
419
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
420
|
-
const record = value;
|
|
421
|
-
const claim = record.claim;
|
|
422
|
-
if (record.platform !== "ios" && record.platform !== "android") return null;
|
|
423
|
-
if (!isPhase(record.phase)) return null;
|
|
424
|
-
if (typeof record.startedAt !== "string" || typeof record.phaseStartedAt !== "string") return null;
|
|
425
|
-
if (!claim || typeof claim.root !== "string" || typeof claim.claimId !== "string") return null;
|
|
426
|
-
const phases = Array.isArray(record.phases) ? record.phases.filter((entry) => isPhase(entry?.phase) && typeof entry?.startedAt === "string") : [];
|
|
427
|
-
return {
|
|
428
|
-
platform: record.platform,
|
|
429
|
-
slot: typeof record.slot === "string" ? record.slot : "default",
|
|
430
|
-
startedAt: record.startedAt,
|
|
431
|
-
phase: record.phase,
|
|
432
|
-
phaseStartedAt: record.phaseStartedAt,
|
|
433
|
-
phases,
|
|
434
|
-
claim: {
|
|
435
|
-
root: claim.root,
|
|
436
|
-
path: typeof claim.path === "string" ? claim.path : "",
|
|
437
|
-
claimId: claim.claimId,
|
|
438
|
-
pid: typeof claim.pid === "number" ? claim.pid : 0
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
function isPhase(value) {
|
|
443
|
-
return BUILD_PHASES.includes(value);
|
|
444
|
-
}
|
|
445
|
-
function activeBuildState(claim, survey = (0, ownership_claim_exports.readClaimSet)(claim.root)) {
|
|
446
|
-
if (survey.live.some((holder) => holder.claimId === claim.claimId)) return "running";
|
|
447
|
-
if (survey.dead.some((holder) => holder.claimId === claim.claimId)) return "stale";
|
|
448
|
-
return survey.unresolved.length ? "unknown" : "stale";
|
|
449
|
-
}
|
|
450
|
-
function liveOutcome(record) {
|
|
451
|
-
const seen = new Set(record.phases.map((entry) => entry.phase));
|
|
452
|
-
if (COLD_PHASES.some((phase) => seen.has(phase))) return "cold";
|
|
453
|
-
if (DEVICE_PHASES.some((phase) => seen.has(phase))) return "hit";
|
|
454
|
-
return null;
|
|
455
|
-
}
|
|
456
|
-
function median(values) {
|
|
457
|
-
if (!values.length) return null;
|
|
458
|
-
const sorted = values.toSorted((a, b) => a - b);
|
|
459
|
-
const mid = Math.floor(sorted.length / 2);
|
|
460
|
-
return sorted.length % 2 ? sorted[mid] : Math.round((sorted[mid - 1] + sorted[mid]) / 2);
|
|
461
|
-
}
|
|
462
|
-
function estimateBuild(history, platform, known, phase) {
|
|
463
|
-
const lists = history?.[platform];
|
|
464
|
-
const outcome = known ?? latestOutcome(lists);
|
|
465
|
-
const samples = outcome && lists?.[outcome] || [];
|
|
466
|
-
const phaseSamples = samples.flatMap((sample) => phase in sample.phases ? [sample.phases[phase]] : []);
|
|
467
|
-
return {
|
|
468
|
-
outcome,
|
|
469
|
-
expectedMs: median(samples.map((sample) => sample.durationMs)),
|
|
470
|
-
expectedPhaseMs: median(phaseSamples),
|
|
471
|
-
basis: samples.length
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
function latestOutcome(lists) {
|
|
475
|
-
let latest = null;
|
|
476
|
-
for (const outcome of ["hit", "cold"]) {
|
|
477
|
-
const last = lists?.[outcome]?.at(-1);
|
|
478
|
-
const at = last ? Date.parse(last.at) : NaN;
|
|
479
|
-
if (Number.isFinite(at) && (!latest || at > latest.at)) latest = {
|
|
480
|
-
outcome,
|
|
481
|
-
at
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
return latest?.outcome ?? null;
|
|
485
|
-
}
|
|
486
|
-
function buildReport(record, { state, history }) {
|
|
487
|
-
return {
|
|
488
|
-
platform: record.platform,
|
|
489
|
-
slot: record.slot,
|
|
490
|
-
state,
|
|
491
|
-
phase: record.phase,
|
|
492
|
-
startedAt: record.startedAt,
|
|
493
|
-
phaseStartedAt: record.phaseStartedAt,
|
|
494
|
-
...estimateBuild(history, record.platform, liveOutcome(record), record.phase)
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
function remainingText(remainingMs) {
|
|
498
|
-
return remainingMs < 6e4 ? "under a minute left" : `about ${Math.ceil(remainingMs / 6e4)} min left`;
|
|
499
|
-
}
|
|
500
|
-
function buildStatusLine(report, now) {
|
|
501
|
-
const slot = report.slot === "default" ? "" : ` [${report.slot}]`;
|
|
502
|
-
if (report.state === "stale") return `build: stale ${report.platform}${slot} record from ${report.startedAt} (its run is gone; the next run replaces it)`;
|
|
503
|
-
const elapsedMs = Math.max(0, now - Date.parse(report.startedAt));
|
|
504
|
-
const head = `build: ${report.platform}${slot} ${report.phase}, ${formatElapsed(elapsedMs)} elapsed`;
|
|
505
|
-
if (report.state === "unknown") return `${head} (its native-run claim cannot be resolved, so it may not be running)`;
|
|
506
|
-
if (report.expectedMs === null) return head;
|
|
507
|
-
const basis = `median of ${plural(report.basis, `${report.outcome} run`)}`;
|
|
508
|
-
const remainingMs = report.expectedMs - elapsedMs;
|
|
509
|
-
return remainingMs > 0 ? `${head} -- ${remainingText(remainingMs)} (${basis})` : `${head} (usually ~${formatElapsed(report.expectedMs)}, ${basis})`;
|
|
510
|
-
}
|
|
511
|
-
//#endregion
|
|
512
|
-
export { buildStatusLine as a, createActivityReader as c, buildReport as i, idleForMs as l, NO_BUILD_PROGRESS as n, parseActiveBuild as o, activeBuildState as r, startBuildProgress as s, ACTIVE_BUILD_KEY as t, workspaceActivity as u };
|
|
338
|
+
export { workspaceActivity as a, readAgentDeviceRecords as i, createActivityReader as n, idleForMs as r, agentDeviceLiveness as t };
|