trantor 0.18.129 → 0.18.131

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trantor",
3
- "version": "0.18.129",
3
+ "version": "0.18.131",
4
4
  "description": "Trantor — the hub-world for AI agent crews: live message bus, presence, project Kanban/flow board + crew orchestration for independent AI coding agents (Claude, Codex, Gemini, Kimi, DeepSeek)",
5
5
  "mcpServers": {
6
6
  "relay": {
package/README.md CHANGED
@@ -417,7 +417,7 @@ rate, not work rate.
417
417
  ```
418
418
  trantor setup | doctor | connect | profile | provider | models
419
419
  | new <name> | up <agents…> | swap <old> <new> | down | seat-why <agent> | ui | advise | hub | watch
420
- | adopt <project> | reconcile | duty | orchestrate | patrol | app | backfill | init-hooks | pair
420
+ | adopt <project> | reconcile | duty | orchestrate | patrol | app | backfill | init-hooks | pair | sim
421
421
  ```
422
422
 
423
423
  - **`trantor pair`** pairs the iPhone and iPad companion app (`ios/`, an operator console for
@@ -427,6 +427,15 @@ trantor setup | doctor | connect | profile | provider | models
427
427
  scripts, and `--role owner` widens the scope. The desktop app's Settings shows the same invite
428
428
  as a QR code. It signs as the operator's owner identity (`TRANTOR_IDENTITY`, default `owner@laptop`).
429
429
 
430
+ - **`trantor sim`** drives the iOS Simulator on a Mac for agents, through
431
+ [AXe](https://github.com/cameroncooke/AXe) (pinned v2.1.1, installed with
432
+ `bash bin/install-axe.sh`, which checks its SHA-256): `boot <device>`, `install <app>`,
433
+ `launch <bundle>`, `screen` (screenshot plus the accessibility tree in point coordinates),
434
+ `tap --label | --id | --xy`, `swipe`, `type`, `shutdown`. Every verb prints JSON. It refuses to
435
+ boot over another session's simulator and shuts down only its own. The `sim` skill gives agents
436
+ the drill loop; the XCTest drills in `ios/` stay the regression gate. `trantor doctor` reports
437
+ the AXe pin.
438
+
430
439
  - **`trantor new <name>`** — project genesis in one command: makes the dir under your dev root
431
440
  (`TRANTOR_DEV_ROOT` or `~/development`), git on main (or `--from <git-url>`, or `--adopt` an
432
441
  existing folder), installs the auto-card hook, posts the brief to the hub, and opens the first
@@ -526,6 +535,15 @@ The default is `max(1, floor(cores / 4))` slots; set `"heavyGateSlots": 4` in
526
535
  `~/.agent-bus/config.json` to override it. Crew runners wire Cargo and package-runner shims into
527
536
  each seat. For a heavy command outside a runner, use `node bin/heavy-gate.mjs -- <command> …`.
528
537
 
538
+ Seats share one build cache per project under `~/.agent-bus/cache/<project>/`: Cargo builds go to
539
+ `cargo-target` there (an explicit `CARGO_TARGET_DIR` still wins) and the iOS drills put Xcode's
540
+ DerivedData beside it. The disk janitor prunes it under the same thresholds as other build output.
541
+
542
+ A machine that hosts seats can report its load: set `"healthHeartbeat": true` (plus a
543
+ `"machineLabel"`) in its `~/.agent-bus/config.json`, and its crew runners post CPU and memory to
544
+ the hub every 30 seconds. The desktop bottom bar shows each reporting machine, greyed once its last
545
+ report is older than 90 seconds.
546
+
529
547
  ## License
530
548
 
531
549
  [MIT](./LICENSE) © 2026 Sasha Bogojevic · Built with [Claude Code](https://claude.com/claude-code) ·
package/bin/cli.mjs CHANGED
@@ -20,6 +20,7 @@ const runCrew = () => {
20
20
  switch (cmd) {
21
21
  case "setup": run("deploy/setup.sh", "/bin/bash"); break;
22
22
  case "doctor": run("bin/doctor.mjs"); break;
23
+ case "sim": run("bin/sim.mjs"); break;
23
24
  case "connect": run("bin/connect.mjs"); break;
24
25
  case "profile": run("bin/profile.mjs"); break;
25
26
  case "provider": case "providers": run("bin/provider.mjs"); break;
@@ -44,6 +45,7 @@ switch (cmd) {
44
45
  case "prune": runCrew(); break;
45
46
  case "hub": {
46
47
  const sub = args[0];
48
+ if (sub === "timeouts") { args.splice(0, 1); run("bin/hub-timeouts.mjs", process.execPath); break; }
47
49
  // Per-project hub routing (TDD §12.1): a project lives on exactly ONE hub; codependent
48
50
  // projects MUST share one. The mapping lives in ~/.agent-bus/config.json `hubs`.
49
51
  if (sub === "list" || sub === "set" || sub === "unset") {
@@ -239,6 +241,7 @@ switch (cmd) {
239
241
 
240
242
  trantor setup one-shot install: hub as an always-on service + config + CLI wiring + doctor
241
243
  trantor doctor where do I stand? hub/plugin/CLIs/auth/keys/profile, with copy-paste fixes
244
+ trantor sim drive the owned iOS Simulator through AXe: boot|install|launch|screen|tap|swipe|type|shutdown
242
245
  trantor connect (re)wire every installed AI CLI to the bus
243
246
  trantor profile declare your plans: trantor profile set claude=max codex=plus deepseek=api
244
247
  trantor provider bring ANY model (BYOM): list · status [--json] · verify <name> --key … · add <name> --key … · remove <name>
@@ -59,14 +59,36 @@ export function workspacePane(ctx, workspace, preferredCwd) {
59
59
  return "";
60
60
  }
61
61
 
62
+ // #13922: the herdr home(s) of the process RUNNING the crew CLI, when it itself sits in a pane —
63
+ // HERDR_WORKSPACE_ID names it, and a pane id embeds it (w2:p4Y lives in w2, #7247 forensics).
64
+ // Closing such a workspace kills this very shell and every sibling pane in it (the 11-20 netcup
65
+ // incident: one workspace.close from inside a seat's test run took the whole crew down).
66
+ function callerHerdrHomes(ctx) {
67
+ const env = ctx.env || {};
68
+ const pane = String(env.HERDR_PANE_ID || "").trim();
69
+ return new Set([String(env.HERDR_WORKSPACE_ID || "").trim(), pane ? pane.split(":")[0] : ""].filter(Boolean));
70
+ }
71
+
72
+ function refusal(what) {
73
+ console.error(` ✗ refusing to close herdr ${what}: it hosts this very process (own HERDR pane/workspace env). Close it from outside the crew, or set TRANTOR_CLOSE_OWN_WORKSPACE=1 to override.`);
74
+ }
75
+
62
76
  export function closeWorkspace(ctx, id) {
63
- if (ctx.dry) { console.log(`[dry] herdr workspace close ${id}`); return; }
64
- herdrCall(ctx, ["workspace", "close", id]);
77
+ if (callerHerdrHomes(ctx).has(id) && String(ctx.env?.TRANTOR_CLOSE_OWN_WORKSPACE || "") !== "1") {
78
+ refusal(`workspace ${id}`);
79
+ return false;
80
+ }
81
+ if (ctx.dry) { console.log(`[dry] herdr workspace close ${id}`); return true; }
82
+ return herdrCall(ctx, ["workspace", "close", id]).ok;
65
83
  }
66
84
 
67
85
  export function closePane(ctx, id) {
68
- if (ctx.dry) { console.log(`[dry] herdr pane close ${id}`); return; }
69
- herdrCall(ctx, ["pane", "close", id]);
86
+ if (id && String(ctx.env?.HERDR_PANE_ID || "").trim() === id && String(ctx.env?.TRANTOR_CLOSE_OWN_WORKSPACE || "") !== "1") {
87
+ refusal(`pane ${id}`);
88
+ return false;
89
+ }
90
+ if (ctx.dry) { console.log(`[dry] herdr pane close ${id}`); return true; }
91
+ return herdrCall(ctx, ["pane", "close", id]).ok;
70
92
  }
71
93
 
72
94
  export function reportAgent(ctx, pane, agent) {
@@ -128,8 +150,8 @@ function prepareWorkspace(ctx, prune) {
128
150
  // killed its own orchestrator that way. The row stays: the workspace is still live.
129
151
  if (id === tracked.reuse || orchSpaces.has(id)) continue;
130
152
  console.log(` → closing stale stacked crew workspace for ${ctx.project} (${id})`);
131
- closeWorkspace(ctx, id);
132
- dropState(ctx, ctx.project, "herdrws", "", id);
153
+ // #13922: a refused close (the caller's own home) leaves the workspace live, so its row stays.
154
+ if (closeWorkspace(ctx, id)) dropState(ctx, ctx.project, "herdrws", "", id);
133
155
  }
134
156
  if (tracked.stale.length) prune();
135
157
  if (ctx.dry) return tracked.reuse;
@@ -169,8 +191,8 @@ function replacementPane(ctx, workspace, spec, hostPane, resolve) {
169
191
  runSeat(ctx, pane, (seat.persona || seat.agent), runnerCommand(ctx, seat.agent, seat.model, seat.effort, seat.persona));
170
192
  }
171
193
  if (old) {
172
- closePane(ctx, old);
173
- dropState(ctx, ctx.project, "herdr", (seat.persona || seat.agent));
194
+ // #13922: a refused/failed close leaves the old pane live, so its row stays with it.
195
+ if (closePane(ctx, old)) dropState(ctx, ctx.project, "herdr", (seat.persona || seat.agent));
174
196
  }
175
197
  return { ...seat, pane };
176
198
  }
@@ -7,7 +7,9 @@ import { join, basename } from "node:path";
7
7
  import { homedir } from "node:os";
8
8
  import { resolveProject, resolveHub, withEnvFiles, hostId } from "../lib/project.mjs";
9
9
  import { machineLabel } from "../lib/machine-label.mjs";
10
+ import { healthPayload, defaultOs, HEALTH_BEAT_MS } from "../lib/machine-health.mjs";
10
11
  import { resolveSecrets, shadowEnv, withSecretExports } from "../lib/secrets.mjs";
12
+ import { seatBuildCacheEnv } from "../lib/seat-cache.mjs";
11
13
  import { runnerPersona } from "../lib/persona.mjs";
12
14
  import { loadOrCreate } from "../lib/identity.mjs";
13
15
  import { signedHeaders } from "../lib/signed-fetch.mjs";
@@ -26,6 +28,7 @@ import { capWake, capBcast, pickLessons, composePrompt, contractBase, baseLine }
26
28
  import {
27
29
  cardRefs, servedContractCard, carriesWork, parseTurnTokens, parseResetAt, reasonWithBalances, quotaResetAt, queuedWording, turnDelivered, budgetPause, PARKING_REASONS,
28
30
  senderProjectOf, isLinkedProject, stateSkipReason, isMessageCardTitle, OPEN_CARD_STATUSES,
31
+ ownCardForInstance, contractedCardIds,
29
32
  CUT_CHAIN_PARK_MIN, cutChainEvidence, isBoundedPark, askDuringTurn, askedVerdict,
30
33
  } from "../lib/turn-policy.mjs";
31
34
  import { snapshotBeforeCut } from "./cut-snapshot.mjs";
@@ -174,6 +177,11 @@ const log = (s) => console.log(`\x1b[38;5;43m[runner]\x1b[0m ${redactKeys(String
174
177
  const LOGDIR = join(homedir(), ".agent-bus", "logs");
175
178
  try { mkdirSync(LOGDIR, { recursive: true }); } catch {}
176
179
  let TURN = releaseState?.turn || 0;
180
+ // #13923: when THIS seat instance started. A seat name is reused across instances and the board's
181
+ // assignee only knows the name, so the my-cards surfaces (relay_board mine, the own-card reroute)
182
+ // fence assignments against this stamp — cards assigned before it are a predecessor's (#12138).
183
+ // Carried across the in-place release restart; a swap or a fresh `trantor up` stamps anew.
184
+ const BOOT_TS = releaseState?.bootTs || Date.now();
177
185
  const telemetry = (rec) => { try { appendFileSync(join(LOGDIR, `${PERSONA}-${PROJ}.jsonl`), JSON.stringify(rec) + "\n"); } catch {} };
178
186
  // The boot line records the HUB this runner bound to, so a split-brain is diagnosable from disk.
179
187
  telemetry({ ts: Date.now(), persona: PERSONA, agent: AGENT, project: PROJ, boot: true, hub: HUB, pid: process.pid, version: bootVersion });
@@ -312,7 +320,7 @@ const EFFORT_FLAG = EFFORT ? cliEffortFlag(DRIVER, EFFORT) : { flag: "", text: "
312
320
 
313
321
  // RUNNER_RULES / RUNNER_KICKOFF env overrides: the runner is also the substrate for non-crew
314
322
  // always-on seats (the fleet DUTY agent, bin/duty.mjs) whose doctrine is not "work your card".
315
- const RULES = process.env.RUNNER_RULES || `Rules: you are ${SESSION} on the trantor crew. Before starting a card, read YOUR card: relay_board with card:<id> (the card, its deps, its notes, and the last five done cards whose title shares a word); never the whole board. If your wake names no card id (or cites only a message-card), make relay_board with mine:true your FIRST call — it lists the cards assigned to you (doing/testing/todo, newest first, full card shape); work your newest one (#7763). After long read-only recon, commit a WIP note with findings so the turn leaves evidence. Work your assigned file(s), report on the bus (relay_send, <280 chars), move your Kanban card as you go with a NOTE saying what you did (doing -> testing, then STOP: you never close your own card to done — the orchestrator runs the card's drill on the built artifact and closes it, and the hub refuses a move to done on a card with no drill line anyway; in 'testing' run YOUR OWN test file — never the full npm test, suites collide across seats — plus \`node bin/slop-gate.mjs\` when the repo has one: it lints ONLY your changed files against the anti-slop rules, and a card must not reach testing with slop-gate failing; use 'failed' + a report if anything breaks). If your work starts containers or a dev server (\`supabase start\`, \`docker run\`, a watch process), stop them before moving your card to testing and name them in the note — the runner also stops containers it saw your turn create when the card closes, but the first responsibility is yours (#9778). If a contract omits a fact you cannot proceed without, ASK — never invent the value: relay_ask(<card>, <question>) blocks the card with your question, keeps the turn owed (no park, no failure), and resumes you when the assigner's answer lands; an invented value that reads as reasoned is the worst outcome this crew ships (#7756). If you need something from another session, message THAT SESSION (relay_peers to find its id, relay_send to reach it) — never ask the human to pass it along; carrying messages between agents is the job this bus exists to remove. When your work for THIS message is finished, END YOUR TURN — do NOT park, do NOT loop relay_wait; the runner waits for you and will wake you with the next message. Path discipline: build/test from your worktree root ${TURN_DIR} with absolute paths or --manifest-path/--prefix instead of cd-ing into subdirs, and put anything that must land outside the repo under ${TURN_DIR}/.agent-bus-out/ (gitignored) — never ~/.agent-bus. Realigning your seat branch after the orchestrator harvested your commits is \`trantor sync\` run from your worktree: it reads the harvest receipts and refuses when an unharvested commit would be lost, so never reset or rebase onto main by hand. A contract's \`base: <sha>\` line is the integration head: start your seat branch at that sha (\`git reset --hard <sha>\` on the fresh branch), never at origin/main, which trails the orchestrator's unpushed integration commits; the object is already here as the ref \`main\`. If \`git cat-file -e <sha>\` fails, say \`cannot resolve base <sha>\` on the bus and move the card to blocked instead of reasoning from origin/main. Every testing/done note names the sha you verified against as \`verified at <sha>\`; a note without it is flagged HOLLOW. Cross-project action is a breach: never \`trantor up\` a crew, register a seat, or send a card/contract into a project other than ${PROJ} unless the operator ran \`trantor policy link ${PROJ} <other> --reason "<why>"\` first — the hub, the CLI and this runner all refuse it mechanically, so ask the operator to link the projects instead of routing around the refusal.`;
323
+ const RULES = process.env.RUNNER_RULES || `Rules: you are ${SESSION} on the trantor crew. Before starting a card, read YOUR card: relay_board with card:<id> (the card, its deps, its notes, and the last five done cards whose title shares a word); never the whole board. If your wake names no card id (or cites only a message-card), make relay_board with mine:true your FIRST call — it lists the cards assigned to you (doing/testing/todo, newest first, full card shape); work your newest one (#7763). After long read-only recon, commit a WIP note with findings so the turn leaves evidence. Work your assigned file(s), report on the bus (relay_send, <280 chars), move your Kanban card as you go with a NOTE saying what you did (doing -> testing, then STOP: you never close your own card to done — the orchestrator runs the card's drill on the built artifact and closes it, and the hub refuses a move to done on a card with no drill line anyway; in 'testing' run YOUR OWN test file — never the full npm test, suites collide across seats — plus \`node bin/slop-gate.mjs\` when the repo has one: it lints ONLY your changed files against the anti-slop rules, and a card must not reach testing with slop-gate failing; use 'failed' + a report if anything breaks). If your work starts containers or a dev server (\`supabase start\`, \`docker run\`, a watch process), stop them before moving your card to testing and name them in the note — the runner also stops containers it saw your turn create when the card closes, but the first responsibility is yours (#9778). If a contract omits a fact you cannot proceed without, ASK — never invent the value: relay_ask(<card>, <question>) blocks the card with your question, keeps the turn owed (no park, no failure), and resumes you when the assigner's answer lands; an invented value that reads as reasoned is the worst outcome this crew ships (#7756). If you need something from another session, message THAT SESSION (relay_peers to find its id, relay_send to reach it) — never ask the human to pass it along; carrying messages between agents is the job this bus exists to remove. When your work for THIS message is finished, END YOUR TURN — do NOT park, do NOT loop relay_wait; the runner waits for you and will wake you with the next message. Path discipline: build/test from your worktree root ${TURN_DIR} with absolute paths or --manifest-path/--prefix instead of cd-ing into subdirs, and put anything that must land outside the repo under ${TURN_DIR}/.agent-bus-out/ (gitignored) — never ~/.agent-bus. Realigning your seat branch after the orchestrator harvested your commits is \`trantor sync\` run from your worktree: it reads the harvest receipts and refuses when an unharvested commit would be lost, so never reset or rebase onto main by hand. A contract's \`base: <sha>\` line is the integration head, and the runner has already aligned your seat branch to it before your turn starts, saving any unharvested commit to harvest/<card> first (#13961). Never \`git reset\`, \`rebase\` or \`checkout\` your seat branch yourself: a hand reset skips that save and silently drops finished work. If HEAD doesn't contain the base (\`git merge-base --is-ancestor <sha> HEAD\` fails), say \`cannot resolve base <sha>\` on the bus and move the card to blocked instead of working from somewhere else. Every testing/done note names the sha you verified against as \`verified at <sha>\`; a note without it is flagged HOLLOW. Cross-project action is a breach: never \`trantor up\` a crew, register a seat, or send a card/contract into a project other than ${PROJ} unless the operator ran \`trantor policy link ${PROJ} <other> --reason "<why>"\` first — the hub, the CLI and this runner all refuse it mechanically, so ask the operator to link the projects instead of routing around the refusal.`;
316
324
 
317
325
  // ---- the pulse --------------------------------------------------------------
318
326
  // RUNNER_PULSE_MS re-runs an orchestrator seat's mission note on a cadence when the bus is silent;
@@ -933,7 +941,10 @@ async function runTurn(prompt, isFirst, trigger = "kickoff", opts = {}) {
933
941
  // #6393: the store's keys ride the spawn env under shadow names and the shell re-exports them
934
942
  // AFTER the sources ran, so the keychain wins over a stale .env line and no file is ever copied.
935
943
  const secrets = resolveSecrets(process.env);
936
- cmd = withEnvFiles(withSecretExports(seatSignalPrefix(TURN_DIR) + cmd, Object.keys(secrets)), envs);
944
+ // #13923: the instance stamp rides the turn shell so the CLI's own MCP server (relay_board mine)
945
+ // fences inherited assignments with the SAME clock the runner's own-card resolution uses.
946
+ const bootStamp = `export TRANTOR_SEAT_BOOT_TS=${BOOT_TS}\n`;
947
+ cmd = withEnvFiles(withSecretExports(seatSignalPrefix(TURN_DIR) + bootStamp + cmd, Object.keys(secrets)), envs);
937
948
  log(`turn starting (${isFirst ? "fresh session" : "resume"})${MODEL ? ` · model=${MODEL}` : ""}`);
938
949
  // #7777: the one effort line — which effort parameters were set, or that the model is uncatalogued.
939
950
  if (turnEffort.changed) log(`effort: ${turnEffort.effort.difficulty} for #${sessionCard} (launch ${EFFORT?.difficulty || "none"}) — ${turnEffort.text}`);
@@ -1057,7 +1068,7 @@ exit $turn_exit`;
1057
1068
  detached: true,
1058
1069
  cwd: TURN_DIR, encoding: "utf8", stdio: cli.sid ? ["ignore", "pipe", "inherit"] : ["ignore", "inherit", "inherit"],
1059
1070
  };
1060
- const spawnEnv = { ...process.env, ...shadowEnv(secrets), RELAY_URL: HUB, RELAY_AGENT: AGENT, RELAY_SESSION: SESSION, RELAY_PROJECT: PROJ,
1071
+ const spawnEnv = { ...seatBuildCacheEnv(process.env, PROJ), ...shadowEnv(secrets), RELAY_URL: HUB, RELAY_AGENT: AGENT, RELAY_SESSION: SESSION, RELAY_PROJECT: PROJ,
1061
1072
  // #6228: marks this env as belonging to PROJ, unlike a one-off RELAY_PROJECT override; crew.mjs's
1062
1073
  // `up` guard refuses to bring up another project's crew from a shell carrying this badge.
1063
1074
  TRANTOR_SEAT: PROJ,
@@ -1508,15 +1519,29 @@ function askedExcerpt(message) {
1508
1519
  // bus message parked on the board is never work, and chasing one (or a phantom id) is how a turn
1509
1520
  // burns on bookkeeping. Only a CONFIRMED message-card title reroutes, to the seat's OWN newest
1510
1521
  // open card (same statuses/ordering as relay_board's mine view); a phantom binds nothing.
1511
- async function newestOwnCard(session, why) {
1522
+
1523
+ // #13923: the reroute lands only on a card THIS instance may work (newer than its start, or
1524
+ // contracted to it after) — never an assignment the reused name inherited from a predecessor.
1525
+ async function newestOwnCard(session, why, messages = []) {
1512
1526
  try {
1513
1527
  const { tasks } = await api(`/tasks?project=${encodeURIComponent(PROJ)}`);
1514
1528
  const own = (Array.isArray(tasks) ? tasks : [])
1515
- .filter((t) => t.assignee === session && OPEN_CARD_STATUSES.includes(t.status) && !isMessageCardTitle(t.title))
1516
- .sort((a, b) => (b.updated || b.ts || 0) - (a.updated || a.ts || 0));
1517
- if (own.length) log(`${why} — resolved to the seat's own #${own[0].id} (${own[0].status})`);
1529
+ .filter((t) => t.assignee === session && OPEN_CARD_STATUSES.includes(t.status) && !isMessageCardTitle(t.title));
1530
+ let eligible = own;
1531
+ if (own.some((t) => (Number(t.ts) || 0) < BOOT_TS)) {
1532
+ // Contracts in hand (this wake batch) plus everything the hub still shows as delivered to
1533
+ // this session — a contract consumed turns ago still counts, so long as it is post-boot.
1534
+ const contracted = contractedCardIds(messages, { session, bootTs: BOOT_TS });
1535
+ try {
1536
+ const r = await api(`/inbox?session=${encodeURIComponent(session)}&since=0&peek=1`);
1537
+ for (const id of contractedCardIds(r?.messages, { session, bootTs: BOOT_TS })) contracted.add(id);
1538
+ } catch { /* inbox unreadable: the in-hand batch still decides; the fence holds */ }
1539
+ eligible = own.filter((t) => ownCardForInstance(t, { bootTs: BOOT_TS, contractedIds: contracted }));
1540
+ }
1541
+ const list = eligible.sort((a, b) => (b.updated || b.ts || 0) - (a.updated || a.ts || 0));
1542
+ if (list.length) log(`${why} — resolved to the seat's own #${list[0].id} (${list[0].status})`);
1518
1543
  else log(`${why} — and the seat has no open card, so this turn carries no card binding`);
1519
- return own.length ? own[0].id : 0;
1544
+ return list.length ? list[0].id : 0;
1520
1545
  } catch { return 0; } // board unreadable: no binding beats a guessed one
1521
1546
  }
1522
1547
  async function resolveWakeCard(messages, { session }) {
@@ -1527,7 +1552,7 @@ async function resolveWakeCard(messages, { session }) {
1527
1552
  try {
1528
1553
  const { task } = await api(`/card?project=${encodeURIComponent(PROJ)}&id=${cited}`);
1529
1554
  if (!task) { log(`#${cited}: the wake cites a card this board does not have — no card binding; the mine view is the first call`); return 0; }
1530
- if (isMessageCardTitle(task.title)) return newestOwnCard(session, `#${cited} is a message-card ("${String(task.title).slice(0, 60)}")`);
1555
+ if (isMessageCardTitle(task.title)) return newestOwnCard(session, `#${cited} is a message-card ("${String(task.title).slice(0, 60)}")`, messages);
1531
1556
  return cited;
1532
1557
  } catch { return cited; } // hub unreachable: keep the pre-#7763 reading rather than drop a contract
1533
1558
  }
@@ -1626,7 +1651,7 @@ async function resolveWakeCard(messages, { session }) {
1626
1651
  writeFileSync(PENDF, JSON.stringify({ persona: PERSONA, agent: AGENT, project: PROJ, ts: Date.now(),
1627
1652
  wake: pendingWake, bcast: pendingBcast, seen: seenLedger, ask: awaitingAsk?.id || 0, askTo: awaitingAsk?.to || "" }));
1628
1653
  const state = { cursor, turn: TURN, sid, sessionCard, retryAt, deliveryFails,
1629
- noDeliveryRetry, askReleased, lastTurnAt, attempted: [...attemptedVersions],
1654
+ noDeliveryRetry, askReleased, lastTurnAt, attempted: [...attemptedVersions], bootTs: BOOT_TS,
1630
1655
  cardTokens, cardCommits, cardStartedAt, budgetStop, budgetRetryAt,
1631
1656
  capHandoffs, capLogged, capArmed, capFreshTurn };
1632
1657
  process.execve(process.execPath, [process.execPath, ...process.execArgv, ...process.argv.slice(1)],
@@ -1636,6 +1661,17 @@ async function resolveWakeCard(messages, { session }) {
1636
1661
  if (PULSE_MS) log(`pulse armed — mission re-read every ${Math.round(PULSE_MS / 1000)}s (${MISSION_FILE})`);
1637
1662
  log(`parked — long-polling the bus as ${SESSION} (free; this poll is also the heartbeat)`);
1638
1663
 
1664
+ // #13920: machine health heartbeat — opt-in via config.json healthHeartbeat:true (plus a valid
1665
+ // machineLabel, read at boot). One small signed POST every HEALTH_BEAT_MS; failures stay silent
1666
+ // by the monitoring doctrine (state not event — a machine that stops beating reads stale on the
1667
+ // hub, which IS the honest "unreachable" signal, not an error to alert on).
1668
+ if (machineConfig.healthHeartbeat === true && MACHINE_LABEL) {
1669
+ const beat = () => api("/machines/health", { ...healthPayload(defaultOs, MACHINE_LABEL), project: PROJ }).catch(() => {});
1670
+ beat();
1671
+ setInterval(beat, HEALTH_BEAT_MS).unref?.();
1672
+ log(`machine health heartbeat armed as ${MACHINE_LABEL} every ${Math.round(HEALTH_BEAT_MS / 1000)}s`);
1673
+ }
1674
+
1639
1675
  while (true) {
1640
1676
  restartForRelease();
1641
1677
  // pulse first: a due mission beat runs even on a silent bus. Measured from the END of the
@@ -1943,7 +1979,13 @@ async function resolveWakeCard(messages, { session }) {
1943
1979
  savePending([], pendingBcast);
1944
1980
  return;
1945
1981
  }
1946
- if (aligned.parked) log(`preserved unharvested work at ${aligned.parked} before aligning to ${base}`);
1982
+ if (aligned.parked) {
1983
+ const notice = `saved unharvested seat commits at ${aligned.parked} before aligning #${card} to ${base}`;
1984
+ log(notice);
1985
+ const owed = assigners.map(a => a.from).filter(f => f && f !== SESSION);
1986
+ for (const to of (owed.length ? owed : ["all"]))
1987
+ await api("/send", { from: SESSION, to, text: notice, project: PROJ, kind: "alert" }).catch(() => {});
1988
+ }
1947
1989
  }
1948
1990
  const baseText = base ? `\n${baseLine(base)}\n` : "";
1949
1991
  // #6289: the session SHAPE (fresh vs resume) reads the served contract's raw citation — a wake
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from "node:child_process";
3
+ import { join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { checkTauriVersionParity } from "../lib/tauri-version-parity.mjs";
6
+
7
+ const ROOT = fileURLToPath(new URL("../", import.meta.url));
8
+ let parity;
9
+ try {
10
+ parity = checkTauriVersionParity(join(ROOT, "desktop"));
11
+ } catch (error) {
12
+ console.error(`desktop-build-gate: ${error.message}`);
13
+ process.exit(1);
14
+ }
15
+ const mismatches = parity.filter(pair => !pair.matches);
16
+ for (const pair of mismatches) {
17
+ console.error(`desktop-build-gate: ${pair.crateName} ${pair.cargoVersion} != ${pair.npmPackage} ${pair.npmVersion}; major.minor must match`);
18
+ }
19
+ if (mismatches.length) process.exit(1);
20
+ console.log(`Tauri version parity: ${parity.length} pair${parity.length === 1 ? "" : "s"} matched`);
21
+
22
+ const result = spawnSync(process.execPath, [
23
+ join(ROOT, "bin", "cargo-gate.mjs"),
24
+ "check",
25
+ "--release",
26
+ "--locked",
27
+ "--manifest-path",
28
+ "desktop/src-tauri/Cargo.toml",
29
+ ], { cwd: ROOT, stdio: "inherit" });
30
+
31
+ if (result.error) {
32
+ console.error(`desktop-build-gate: ${result.error.message}`);
33
+ process.exit(1);
34
+ }
35
+ process.exit(result.status ?? 1);
package/bin/doctor.mjs CHANGED
@@ -15,6 +15,7 @@ import { scan } from "../lib/splitbrain.mjs";
15
15
  import { resolveSecrets, envFileSecrets, backendFor } from "../lib/secrets.mjs";
16
16
  import { resolveStateFlags } from "../lib/state/flags.mjs";
17
17
  import { probeClaudeIntegration, HERDR_CLAUDE_INSTALL } from "../lib/herdr-integration.mjs";
18
+ import { axeDoctorStatus } from "../lib/sim/axe-status.mjs";
18
19
 
19
20
  const H = homedir();
20
21
  const ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
@@ -362,6 +363,20 @@ prof?.providers && Object.keys(prof.providers).length
362
363
  // billing issues while the duty seat had held 48 undelivered messages for 22 hours and finished
363
364
  // crew work went unread overnight: credentials EXIST is not the fleet is MOVING. Both signals are
364
365
  // already on disk, written by the runner itself.
366
+ section("iOS simulator driver");
367
+ {
368
+ const present = has("axe");
369
+ let version = "";
370
+ if (present) {
371
+ try { version = execSync("axe --version", { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim(); }
372
+ catch { version = ""; }
373
+ }
374
+ const status = axeDoctorStatus(process.platform, present, version);
375
+ if (status.kind === "ok") ok(status.message);
376
+ else if (status.kind === "warn") warn(status.message, `bash ${join(ROOT, "bin", "install-axe.sh")}`);
377
+ else note(status.message);
378
+ }
379
+
365
380
  section("the fleet (is it actually running?)");
366
381
  {
367
382
  const busDir = join(H, ".agent-bus");
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ import { readFileSync, existsSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { homedir } from "node:os";
5
+ import { execFileSync } from "node:child_process";
6
+
7
+ const args = process.argv.slice(2);
8
+ let since = "1h";
9
+ for (let i = 0; i < args.length; i++) {
10
+ if (args[i] === "--since" && args[i + 1]) since = args[++i];
11
+ else { console.error("usage: trantor hub timeouts [--since 1h]"); process.exit(2); }
12
+ }
13
+ const match = since.match(/^(\d+)(m|h|d)$/);
14
+ if (!match) { console.error("--since must be a duration such as 30m, 1h, or 2d"); process.exit(2); }
15
+ const amount = Number(match[1]);
16
+ const ageMs = amount * ({ m: 60_000, h: 3_600_000, d: 86_400_000 })[match[2]];
17
+ const cutoff = Date.now() - ageMs;
18
+ const sinceArg = `${amount} ${match[2] === "m" ? "minute" : match[2] === "h" ? "hour" : "day"}${amount === 1 ? "" : "s"} ago`;
19
+ const busDir = process.env.AGENT_BUS_DIR || join(homedir(), ".agent-bus");
20
+ const receiptFile = process.env.TRANTOR_HUB_TIMEOUTS_FILE || join(busDir, "hub-timeouts.jsonl");
21
+ let receipts = [];
22
+ if (existsSync(receiptFile)) {
23
+ receipts = readFileSync(receiptFile, "utf8").split("\n").filter(Boolean).flatMap(line => {
24
+ try {
25
+ const row = JSON.parse(line);
26
+ return Date.parse(row.ts) >= cutoff ? [{ time: Date.parse(row.ts), kind: "client timeout", text: `${row.route} op=${row.op} elapsed=${row.elapsedMs}ms hub=${row.hubUrl}` }] : [];
27
+ } catch { return []; }
28
+ });
29
+ }
30
+
31
+ let journal = "";
32
+ const remote = process.env.TRANTOR_HUB_SSH;
33
+ if (process.env.TRANTOR_HUB_JOURNAL_FILE) {
34
+ journal = readFileSync(process.env.TRANTOR_HUB_JOURNAL_FILE, "utf8");
35
+ } else {
36
+ const command = ["journalctl", "-u", "trantor-hub", "--since", sinceArg, "--output=short-iso", "--no-pager"];
37
+ try {
38
+ journal = remote
39
+ ? execFileSync("ssh", [remote, "journalctl", "-u", "trantor-hub", "--since", sinceArg, "--output=short-iso", "--no-pager"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] })
40
+ : execFileSync(command[0], command.slice(1), { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] });
41
+ } catch { journal = ""; }
42
+ }
43
+ const journalRows = journal.split("\n").filter(line => /\[trantor\] (event-loop stall|slow request)/.test(line)).flatMap(line => {
44
+ const iso = line.match(/^(\d{4}-\d\d-\d\d[T ][0-9:.+-]+Z?)/)?.[1];
45
+ const time = Date.parse(iso || "");
46
+ return Number.isFinite(time) && time >= cutoff ? [{ time, kind: "hub", text: line }] : [];
47
+ });
48
+ const rows = [...receipts, ...journalRows].sort((a, b) => a.time - b.time);
49
+ console.log(`Hub diagnostics for the last ${since}${remote ? ` (journal via ssh ${remote})` : " (local journal only; set TRANTOR_HUB_SSH to include the remote hub journal)"}`);
50
+ if (!rows.length) console.log("No matching hub timeouts, event-loop stalls, or slow requests in this window.");
51
+ for (const row of rows) console.log(`${new Date(row.time).toISOString()} [${row.kind}] ${row.text}`);
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ if [[ "$(uname -s)" != Darwin ]]; then
5
+ echo "AXe v2.1.1 requires macOS; install it on the Mac that hosts the iOS Simulator." >&2
6
+ exit 1
7
+ fi
8
+
9
+ VERSION="2.1.1"
10
+ SHA256="8788838b1b32059d143cf06541b72fcaead85c16274457cdbff086510a5b17fa"
11
+ ARCHIVE="AXe-macOS-v${VERSION}-universal.tar.gz"
12
+ URL="https://github.com/cameroncooke/AXe/releases/download/v${VERSION}/${ARCHIVE}"
13
+ DEST="${HOME}/.local/share/trantor/axe/v${VERSION}"
14
+ BIN="${HOME}/.local/bin"
15
+ TMP="$(mktemp -d)"
16
+ trap 'rm -rf "$TMP"' EXIT
17
+
18
+ mkdir -p "$DEST" "$BIN"
19
+ curl --fail --location --silent --show-error "$URL" -o "$TMP/$ARCHIVE"
20
+ echo "$SHA256 $TMP/$ARCHIVE" | shasum -a 256 -c -
21
+ tar -xzf "$TMP/$ARCHIVE" -C "$DEST"
22
+ ln -sfn "$DEST/axe" "$BIN/axe"
23
+ echo "Installed AXe v${VERSION} at $DEST/axe"
24
+ echo "Ensure $BIN is on PATH, then verify with: axe --version"