@nodii/dev 0.6.62 → 0.6.64

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/doctor.js CHANGED
@@ -7,6 +7,7 @@ import { inferGitContext, repoName } from "./lanes.js";
7
7
  import { figmaFileKey, figmaLockCheck, holdsSet, notRegisteredHint, scopeText } from "./figma.js";
8
8
  import { EMBED_MODEL, EMBED_MODEL_DIGEST, EMBED_PIN, PICKER_CONTEXT, PICKER_MODEL, PICKER_MODEL_DIGEST, STALE_PIN_HINT, inspectOllama } from "./gather.js";
9
9
  import { hookDiagnostics } from "./hook-doctor.js";
10
+ import { hostBootedAt } from "./host.js";
10
11
  import { listAccounts } from "./accounts.js";
11
12
  import { LANE_ENV_FIX, agentProcesses, laneConfigName, laneEnvProblem, laneEnvReport } from "./lane-env.js";
12
13
 
@@ -367,6 +368,26 @@ export async function doctorCommand(deps = {}) {
367
368
  }
368
369
  }
369
370
 
371
+ // After a reboot (AGENT-HARNESS-67): the coordinator clears this check. A
372
+ // lane reads ok here, because its own work is not what is stuck.
373
+ if (!agent?.machineId) checks.push(cannot("host_restart", "needs a machine"));
374
+ else if (agent.role !== "coordinator") checks.push(ok("host_restart", "the machine's coordinator clears a restart"));
375
+ else {
376
+ try {
377
+ const bootedAt = (deps.bootedAt ?? hostBootedAt)();
378
+ const machine = (await request("GET", `/api/v1/machines/${encode(agent.machineId)}`)).data;
379
+ const page = await request("GET", `/api/v1/lanes${query({ machine: agent.machineId, "host-lost": "true", limit: 200 })}`);
380
+ const lost = (page.data ?? []).map((x) => x.key);
381
+ // The boot time is read to the second from uptime, so allow it to drift.
382
+ const recorded = machine.bootedAt && Date.parse(bootedAt) - Date.parse(machine.bootedAt) < 60_000;
383
+ if (!recorded) checks.push(missing("host_restart", `this machine booted at ${bootedAt}, but Dev last recorded ${machine.bootedAt ?? "no boot"}: its liveness records may be stale`, `nodii-dev coordinator start --machine ${machine.name}`, { bootedAt }));
384
+ else if (lost.length) checks.push(missing("host_restart", `host_lost lanes: ${lost.join(", ")}`, "nodii-dev lane resume --host-lost", { bootedAt, lanes: lost }));
385
+ else checks.push(ok("host_restart", `boot of ${bootedAt} is recorded; no host_lost lanes`, { bootedAt }));
386
+ } catch (error) {
387
+ checks.push(cannot("host_restart", error?.code ? devReason(error) : (error?.message ?? String(error))));
388
+ }
389
+ }
390
+
370
391
  const ready = checks.every((x) => x.status === "ok");
371
392
  const width = Math.max(...checks.map((x) => x.key.length));
372
393
  const human = (p) => [
package/dist/figma.js CHANGED
@@ -691,3 +691,80 @@ export function figmaPublishPlanText(plan) {
691
691
  : []),
692
692
  ].join("\n");
693
693
  }
694
+
695
+ export const WITHDRAW_ITEMS_USAGE = "figma withdraw CHANGE_SET --items ID[,ID] --reason TEXT";
696
+
697
+ /** `--items A,B --items C` → ["A", "B", "C"], each an item id or a Figma node id. */
698
+ export function withdrawItemsFrom(flags) {
699
+ const given = [flags.items].flat().filter((x) => x !== undefined);
700
+ if (given.some((x) => x === true)) throw new CliError("USAGE", `--items needs item ids: ${WITHDRAW_ITEMS_USAGE}`, 2);
701
+ const items = [...new Set(given.flatMap((x) => String(x).split(",")).map((x) => x.trim()).filter(Boolean))];
702
+ if (!items.length) throw new CliError("USAGE", `--items needs item ids: ${WITHDRAW_ITEMS_USAGE}`, 2);
703
+ return items;
704
+ }
705
+
706
+ const indented = (ids) => ids.map((x) => ` ${x}`);
707
+
708
+ // Dev's refusals of withdrawDesignChangeItems, said in terms of what to do next.
709
+ const WITHDRAW_ITEMS_REFUSALS = {
710
+ CHANGE_SET_NOT_FOUND: (id) => `No change set ${id} in Dev.`,
711
+ WITHDRAW_NOT_ALLOWED: (id) => `Only ${id}'s holder, a machine's coordinator or the operator can withdraw its items.`,
712
+ INVALID_CHANGE_SET_STATE: (id, message) => `${message}\nItems are withdrawn only while ${id} is applying (decided, with rejected items). Check it with: nodii-dev figma changeset show ${id}`,
713
+ CHANGE_SET_HAS_NO_BASE_VERSION: (id, message) => `${message}\nDev can't tell whether the items' nodes are back at base, so it can't withdraw them.`,
714
+ CHANGE_SET_CHANGED: (id, message) => `${message}\n${id} changed while withdrawing; read it with nodii-dev figma changeset show ${id} and run this again.`,
715
+ CHANGE_ITEM_NOT_AT_BASE: (id, message, d) => {
716
+ const nodes = d?.nodeIds ?? [];
717
+ if (!nodes.length) return message;
718
+ return [
719
+ `${nodes.length} node(s) of ${d?.changeSetId ?? id} still differ from its base version${d?.baseVersion ? ` (${d.baseVersion})` : ""}:`,
720
+ ...indented(nodes),
721
+ "Put each back as it was at base (remove it if the set added it), then run this again. Nothing was withdrawn.",
722
+ ].join("\n");
723
+ },
724
+ CHANGE_ITEM_NOT_REJECTED: (id, message, d) => {
725
+ if (!d?.unmatched?.length) return message;
726
+ return [
727
+ `Only rejected items can be withdrawn. Not a rejected item in ${id}:`,
728
+ ...indented(d.unmatched),
729
+ ...(d.rejected?.length
730
+ ? [`${id}'s rejected items (item id figma node):`, ...indented(d.rejected.map((i) => `${i.id} ${i.figmaNodeId ?? "-"}`))]
731
+ : [`${id} has no rejected items.`]),
732
+ "Nothing was withdrawn.",
733
+ ].join("\n");
734
+ },
735
+ CHANGE_ITEM_AMBIGUOUS: (id, message, d) =>
736
+ d?.ambiguous?.length
737
+ ? [`More than one rejected item of ${id} sits on Figma node:`, ...indented(d.ambiguous), "Name those items by item id instead (nodii-dev figma changeset show " + id + "). Nothing was withdrawn."].join("\n")
738
+ : message,
739
+ };
740
+
741
+ /**
742
+ * Withdraw a set's rejected items (withdrawDesignChangeItems): the holder, a
743
+ * coordinator or the operator, while the set is applying. Each item's nodes
744
+ * must already be back at the set's base version; apply then takes the
745
+ * approved items alone, and the scopes only those items sat in are released.
746
+ */
747
+ export async function figmaWithdrawItems(id, items, reason, { request = devRequest } = {}) {
748
+ if (!id || !items?.length) throw new CliError("USAGE", WITHDRAW_ITEMS_USAGE, 2);
749
+ if (typeof reason !== "string" || !reason.trim()) throw new CliError("USAGE", `--reason needs a reason: ${WITHDRAW_ITEMS_USAGE}`, 2);
750
+ try {
751
+ return await request("POST", `/api/v1/design/change-sets/${encode(id)}/withdraw-items`, { items, reason: reason.trim() });
752
+ } catch (error) {
753
+ const say = WITHDRAW_ITEMS_REFUSALS[error?.code];
754
+ if (say) throw new CliError(error.code, say(id, error.message, error.details), error.exitCode ?? 1, error.details);
755
+ throw scopeRefusal(error, id) ?? error;
756
+ }
757
+ }
758
+
759
+ export const figmaWithdrawItemsText = (id, d = {}) => {
760
+ const withdrawn = d.withdrawn ?? [];
761
+ const released = d.released ?? [];
762
+ const held = d.scopes ?? [];
763
+ return [
764
+ `Withdrew ${withdrawn.length} item(s) from ${d.changeSetId ?? id}; they will never publish:`,
765
+ ...indented(withdrawn),
766
+ released.length ? `Released ${released.length} scope(s): ${released.map(scopeText).join(", ")}` : "Released no scope (another item still sits in each).",
767
+ `Still holds ${held.length} scope(s)${held.length ? `: ${held.map(scopeText).join(", ")}` : ""}.`,
768
+ `Next: apply the approved items with nodii-dev figma apply ${d.changeSetId ?? id} --figma-version V`,
769
+ ].join("\n");
770
+ };
package/dist/flags.js CHANGED
@@ -13,6 +13,7 @@ const SUBMIT_MODE = ["sync", "async"];
13
13
  const WAIT = ["wait", "wait-minutes"];
14
14
 
15
15
  export const COMMAND_FLAGS = {
16
+ "figma transfer": ["to", "reason"],
16
17
  "coordinator start": ["machine", "account", "heartbeat-seconds"],
17
18
  "coordinator heartbeat": ["machine", "run", "pid", "pid-started-at", "interval"],
18
19
  "issues create": ["service", ...ISSUE_FIELDS],
@@ -32,7 +33,8 @@ export const COMMAND_FLAGS = {
32
33
  "lane evidence": ["pr", "commit", "figma", "deploy", "dev-check"],
33
34
  "lane done-check": ["evidence"],
34
35
  "lane heartbeat": ["note"],
35
- "lane resume": ["override", "reason"],
36
+ "lane resume": ["override", "reason", "host-lost", "min-free-gb", "stagger-seconds"],
37
+ "lane transfer": ["reason", "to-agent"],
36
38
  "lane stop": ["reason"],
37
39
  "lane land": [],
38
40
  "lane review": ["file", "not-required", "decision", "question", "quote", "at"],
@@ -46,7 +48,7 @@ export const COMMAND_FLAGS = {
46
48
  "docs ratify": ["domain", "decision", ...WAIT],
47
49
  "figma submit": ["file", "figma-version", ...SUBMIT_MODE, "dry-run"],
48
50
  "figma resubmit": [...SUBMIT_MODE, "dry-run"],
49
- "figma withdraw": [],
51
+ "figma withdraw": ["items", "reason"],
50
52
  "figma abandon": ["file"],
51
53
  "figma apply": ["file", "figma-version"],
52
54
  "figma lock": ["title", "scope"],
package/dist/host.js ADDED
@@ -0,0 +1,27 @@
1
+ // What this machine says about itself: its boot time and its free memory
2
+ // (AGENT-HARNESS-67).
3
+ import { execFile as execFileCallback } from "node:child_process";
4
+ import { freemem, platform, uptime } from "node:os";
5
+ import { promisify } from "node:util";
6
+
7
+ const execFile = promisify(execFileCallback);
8
+
9
+ /** The machine's boot time, to the second, as an ISO timestamp. */
10
+ export const hostBootedAt = ({ now = Date.now, up = uptime } = {}) =>
11
+ new Date(Math.floor((now() - up() * 1000) / 1000) * 1000).toISOString();
12
+
13
+ /**
14
+ * Memory a new process can have, in bytes. macOS counts reclaimable pages as
15
+ * used, so `os.freemem` understates it; vm_stat's free, inactive and
16
+ * speculative pages are what the kernel can hand out. Purgeable pages are
17
+ * already inside those counts.
18
+ */
19
+ export async function availableMemoryBytes({ os = platform(), free = freemem, execute = execFile } = {}) {
20
+ if (os !== "darwin") return free();
21
+ const { stdout } = await execute("vm_stat", [], { encoding: "utf8" });
22
+ const pageSize = Number(/page size of (\d+) bytes/.exec(stdout)?.[1]);
23
+ const pages = ["free", "inactive", "speculative"]
24
+ .map((name) => Number(new RegExp(`Pages ${name}:\\s+(\\d+)`).exec(stdout)?.[1] ?? 0));
25
+ if (!pageSize) return free();
26
+ return pages.reduce((sum, count) => sum + count, 0) * pageSize;
27
+ }
package/dist/lanes.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { execFile } from "node:child_process";
2
- import { readFile, realpath } from "node:fs/promises";
2
+ import { readFile, realpath, writeFile } from "node:fs/promises";
3
3
  import { promisify } from "node:util";
4
4
  import { CliError, encode, devRequest, query, readConfig, requireFlag } from "./core.js";
5
5
  import { launchRecovery } from "./runtime-launcher.js";
@@ -7,6 +7,7 @@ import { recordReviewReceipt, reviewCommitContext } from "./safety.js";
7
7
  import { GATHER_TIMEOUT_MS, PICKER_FIRST_PICK_TIMEOUT_MS, PICKER_MODEL, agentFallbackReason, gatherDeadline, gatherText, pickDocuments, pickTimingLine, pickTimingStats, readPickTimings, recordPickTiming, warmPicker, withPickLock } from "./gather.js";
8
8
  import { storeGatherFreeze } from "./freeze.js";
9
9
  import { doneCheckRecorded } from "./lane-supervisor.js";
10
+ import { availableMemoryBytes } from "./host.js";
10
11
  import { SWAP_BOUNDARIES, componentsForScope, guidelineLookup, laneFigmaScope, loadDsCatalog } from "./figma-scope.js";
11
12
  import { designCheck } from "./design.js";
12
13
  import { LANE_ENV_FIX, laneEnvProblem, laneEnvReport } from "./lane-env.js";
@@ -292,8 +293,82 @@ async function localPick(lane, warming, pick, { budgetMs, timings }) {
292
293
  return { ...picked, timing, stats };
293
294
  }
294
295
 
296
+ /** Point the lane's config at the agent Dev moved the lane to. */
297
+ async function rebindLaneConfig(path, agentId) {
298
+ const config = JSON.parse(await readFile(path, "utf8"));
299
+ await writeFile(path, `${JSON.stringify({ ...config, agentId }, null, 2)}\n`, { mode: 0o600 });
300
+ }
301
+
302
+ const GIB = 1024 ** 3;
303
+ const HOST_LOST_MIN_FREE_GB = 4;
304
+ const HOST_LOST_STAGGER_SECONDS = 15;
305
+
306
+ const positiveNumber = (value, flag, fallback) => {
307
+ if (value === undefined) return fallback;
308
+ const number = Number(value);
309
+ if (!Number.isFinite(number) || number < 0) throw new CliError("USAGE", `${flag} needs a number, 0 or more.`, 2);
310
+ return number;
311
+ };
312
+
313
+ /**
314
+ * Bring back every host_lost lane on this machine, highest priority first
315
+ * (AGENT-HARNESS-67). Each start waits out the stagger so the last lane's
316
+ * memory shows, and the run stops at the memory floor: the lanes it holds stay
317
+ * host_lost, so running it again carries on.
318
+ */
319
+ async function resumeHostLost(flags, deps, { request, config }) {
320
+ if (flags.override || flags.reason !== undefined)
321
+ throw new CliError("USAGE", "lane resume --host-lost needs no --override: a restart is not a death.", 2);
322
+ const floor = positiveNumber(flags["min-free-gb"], "--min-free-gb", HOST_LOST_MIN_FREE_GB) * GIB;
323
+ const stagger = positiveNumber(flags["stagger-seconds"], "--stagger-seconds", HOST_LOST_STAGGER_SECONDS) * 1000;
324
+ const { memory = availableMemoryBytes, sleep = (ms) => new Promise((done) => setTimeout(done, ms)) } = deps;
325
+ const agent = (await request("GET", `/api/v1/agents/${encode((await config()).agentId)}`)).data;
326
+ if (!agent.machineId) throw new CliError("MACHINE_REQUIRED", "The current agent is not assigned to a machine.", 1);
327
+ const lanes = [];
328
+ let cursor;
329
+ do {
330
+ const page = await request("GET", `/api/v1/lanes${query({ machine: agent.machineId, "host-lost": "true", cursor, limit: 200 })}`);
331
+ lanes.push(...(page.data ?? []));
332
+ cursor = page.nextCursor ?? undefined;
333
+ } while (cursor);
334
+ const resumed = [];
335
+ const failed = [];
336
+ const held = [];
337
+ let memoryError = null;
338
+ for (const [index, lane] of lanes.entries()) {
339
+ if (index) await sleep(stagger);
340
+ let free;
341
+ try { free = await memory(); }
342
+ catch (error) { memoryError = error?.message ?? String(error); }
343
+ if (memoryError || free < floor) {
344
+ held.push(...lanes.slice(index).map(({ key }) => key));
345
+ break;
346
+ }
347
+ try {
348
+ const result = await laneCommand("resume", [lane.key], {}, deps);
349
+ resumed.push({ key: lane.key, runId: result.payload.data.run.id });
350
+ } catch (error) {
351
+ failed.push({ key: lane.key, code: error?.code ?? "RESUME_FAILED", message: error?.message ?? String(error) });
352
+ }
353
+ }
354
+ return {
355
+ payload: { data: { resumed, failed, held, minFreeGb: floor / GIB, ...(memoryError ? { memoryError } : {}) } },
356
+ exitCode: failed.length || held.length ? 1 : 0,
357
+ human: () => [
358
+ lanes.length ? `host_lost lanes: ${lanes.length}` : "No host_lost lanes on this machine.",
359
+ ...resumed.map(({ key, runId }) => `resumed ${key} as run ${runId}`),
360
+ ...failed.map(({ key, code, message }) => `refused ${key}: ${code} ${message}`),
361
+ ...(held.length ? [`${memoryError ? `held, free memory unreadable (${memoryError})` : `held at the ${floor / GIB} GiB memory floor`}: ${held.join(", ")}; run lane resume --host-lost again${memoryError ? "" : " once memory frees"}`] : []),
362
+ ].join("\n"),
363
+ };
364
+ }
365
+
295
366
  export async function laneCommand(action, args, flags, deps = {}) {
296
- const { request = devRequest, config = readConfig, gitContext = inferGitContext, commitsOf = branchCommits, read = (path) => readFile(path, "utf8"), reviewContext = reviewCommitContext, reviewReceipt = recordReviewReceipt, picker = pickDocuments, warm = warmPicker, firstPickTimeoutMs = PICKER_FIRST_PICK_TIMEOUT_MS, timings = { record: recordPickTiming, read: readPickTimings }, changedPaths = laneChangedPaths, gatherTimeoutMs = GATHER_TIMEOUT_MS, deadline: outerDeadline, storeFreeze = storeGatherFreeze, launch = launchRecovery, catalog = loadDsCatalog, pickLock = withPickLock, check: checkDeps = {} } = deps;
367
+ const { request = devRequest, config = readConfig, gitContext = inferGitContext, commitsOf = branchCommits, read = (path) => readFile(path, "utf8"), reviewContext = reviewCommitContext, reviewReceipt = recordReviewReceipt, picker = pickDocuments, warm = warmPicker, firstPickTimeoutMs = PICKER_FIRST_PICK_TIMEOUT_MS, timings = { record: recordPickTiming, read: readPickTimings }, changedPaths = laneChangedPaths, gatherTimeoutMs = GATHER_TIMEOUT_MS, deadline: outerDeadline, storeFreeze = storeGatherFreeze, launch = launchRecovery, rebind = rebindLaneConfig, catalog = loadDsCatalog, pickLock = withPickLock, check: checkDeps = {} } = deps;
368
+ if (action === "resume" && flags["host-lost"]) {
369
+ if (args[0]) throw new CliError("USAGE", "lane resume --host-lost takes no <key>: it resumes every host_lost lane on this machine.", 2);
370
+ return resumeHostLost(flags, deps, { request, config });
371
+ }
297
372
  if (action === "list") {
298
373
  const c = flags.mine ? await config() : null;
299
374
  const payload = await request("GET", `/api/v1/lanes${query({ kind: flags.kind, status: flags.status, machine: flags.machine, agent: flags.mine ? c.agentId : flags.agent, "waiting-on": flags["waiting-on"], stuck: flags.stuck, cursor: flags.cursor, limit: flags.limit })}`);
@@ -725,6 +800,49 @@ export async function laneCommand(action, args, flags, deps = {}) {
725
800
  );
726
801
  return { payload, human: `${ref}: subagent quota set to ${quota}.` };
727
802
  }
803
+ const launchReserved = async (payload, before = async () => {}) => {
804
+ try {
805
+ await before();
806
+ return await launch(payload);
807
+ } catch (error) {
808
+ const reason = `local recovery launch failed: ${error instanceof Error ? error.message : String(error)}`.slice(0, 2_000);
809
+ const runId = payload?.data?.run?.id;
810
+ if (runId) {
811
+ await request(
812
+ "POST",
813
+ `/api/v1/lanes/${encode(id)}/resume/${encode(runId)}/launch-failed`,
814
+ { reason, ...via },
815
+ ).catch(() => {});
816
+ }
817
+ throw new CliError("RECOVERY_LAUNCH_FAILED", reason, 1);
818
+ }
819
+ };
820
+ if (action === "transfer") {
821
+ const reason = requireFlag(flags, "reason");
822
+ const toAgentId = flags["to-agent"] ?? (await config()).agentId;
823
+ if (!toAgentId) throw new CliError("USAGE", "lane transfer needs a registered agent, or --to-agent ID.", 2);
824
+ const payload = await request("POST", `/api/v1/lanes/${encode(id)}/transfer`, { toAgentId, reason, ...via }).catch((error) => {
825
+ if (error?.code !== "LANE_ALREADY_TERMINAL") throw error;
826
+ throw new CliError(error.code, `Lane ${id} has ended, so it cannot move. Its open change sets can: nodii-dev figma transfer CS --to LIVE_LANE --reason TEXT (coordinator or staff).`, 1);
827
+ });
828
+ // The fresh run acts as the recovering agent, so the lane's config names it.
829
+ const launched = await launchReserved(payload, async () => {
830
+ const owner = payload.data.run.ownerAgentId;
831
+ if (owner && owner !== toAgentId) throw new Error(`Dev gave the fresh run to ${owner}, not ${toAgentId}`);
832
+ await rebind(payload.data.launch.devConfigPath, toAgentId);
833
+ });
834
+ return {
835
+ payload,
836
+ human: (response) => {
837
+ const { fromAgentId, changeSetIds, changeSetsLeft } = response.data.transfer;
838
+ return [
839
+ `${ref}: moved from agent ${fromAgentId} to ${toAgentId}; fresh run ${response.data.run.id} as PID ${launched.pid}.`,
840
+ ...(changeSetIds.length ? [`change sets moved: ${changeSetIds.join(", ")}`] : []),
841
+ ...(changeSetsLeft.length ? [`change sets left with ${fromAgentId}, which has another active lane: ${changeSetsLeft.join(", ")}; move one with nodii-dev figma transfer`] : []),
842
+ ].join("\n");
843
+ },
844
+ };
845
+ }
728
846
  if (action === "resume") {
729
847
  // AGENT-HARNESS-46: --override resumes a lane the two-deaths rule stopped;
730
848
  // Dev allows it only after a `lane amend`, and keeps the reason on the run.
@@ -741,21 +859,7 @@ export async function laneCommand(action, args, flags, deps = {}) {
741
859
  `/api/v1/lanes/${encode(id)}/resume`,
742
860
  flags.override ? { override: true, reason: overrideReason, ...via } : via,
743
861
  );
744
- let launched;
745
- try {
746
- launched = await launch(payload);
747
- } catch (error) {
748
- const reason = `local recovery launch failed: ${error instanceof Error ? error.message : String(error)}`.slice(0, 2_000);
749
- const runId = payload?.data?.run?.id;
750
- if (runId) {
751
- await request(
752
- "POST",
753
- `/api/v1/lanes/${encode(id)}/resume/${encode(runId)}/launch-failed`,
754
- { reason, ...via },
755
- ).catch(() => {});
756
- }
757
- throw new CliError("RECOVERY_LAUNCH_FAILED", reason, 1);
758
- }
862
+ const launched = await launchReserved(payload);
759
863
  return {
760
864
  payload,
761
865
  human: (response) => {
package/dist/starting.js CHANGED
@@ -8,6 +8,7 @@ import { assertKnownSets, checkComponentSetKey, checkFileKey, loadDsCatalog, mer
8
8
  import { GATHER_TIMEOUT_MS, gatherDeadline } from "./gather.js";
9
9
  import { laneCommand, nextCommand } from "./lanes.js";
10
10
  import { laneConfigName } from "./lane-env.js";
11
+ import { hostBootedAt } from "./host.js";
11
12
  import { accountFlags, listAccounts, profilePath, registerAccount, reportUsage, usageLine } from "./accounts.js";
12
13
 
13
14
  const execFile = promisify(execFileCallback);
@@ -320,7 +321,7 @@ async function coordinatorCapacity(machineId, flags, { request, readers }) {
320
321
 
321
322
  export async function coordinatorCommand(action, flags, {
322
323
  request = devRequest, config = readConfig, save = saveJson, watch = watchCoordinator, readers, heartbeater = spawnHeartbeater,
323
- heartbeatLoop = coordinatorHeartbeatLoop, findRun = findCoordinatorRun, now = Date.now,
324
+ heartbeatLoop = coordinatorHeartbeatLoop, findRun = findCoordinatorRun, now = Date.now, bootedAt = hostBootedAt,
324
325
  isAlive = async (pid, startedAt) => (await import("./watchdog.js")).isProcessAlive(pid, startedAt),
325
326
  sessionPid = coordinatorRuntimePid,
326
327
  existingHeartbeater = runningHeartbeater,
@@ -341,6 +342,9 @@ export async function coordinatorCommand(action, flags, {
341
342
  const startBody = {
342
343
  machine,
343
344
  expectedHeartbeatSeconds: flags["heartbeat-seconds"] ? Number(flags["heartbeat-seconds"]) : 60,
345
+ // AGENT-HARNESS-67: Dev marks what a restart killed before it looks for a
346
+ // live coordinator, so the first start after a reboot takes over.
347
+ bootedAt: bootedAt(),
344
348
  ...via,
345
349
  };
346
350
  const c = await config();
@@ -422,6 +426,9 @@ export async function coordinatorCommand(action, flags, {
422
426
  `orphans: ${p.data.orphanedRuns.length}`,
423
427
  `unclaimed results: ${p.data.unclaimedResults.length}`,
424
428
  ...(p.data.takeoverOfRunId ? [`takeover recorded from ${p.data.takeoverOfRunId}`] : []),
429
+ ...((p.data.hostLostLanes ?? []).length
430
+ ? [`host_lost lanes: ${p.data.hostLostLanes.map((lane) => lane.key).join(", ")}; bring them back with nodii-dev lane resume --host-lost`]
431
+ : []),
425
432
  heartbeaterPid
426
433
  ? `heartbeater ${heartbeaterPid} keeps the run alive while session ${watched.pid} lives`
427
434
  : `heartbeater not started${heartbeaterError ? ` (${heartbeaterError})` : ""}: the run goes quiet without heartbeats`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.62",
3
+ "version": "0.6.64",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {