trantor 0.18.141 → 0.18.144

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 (55) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +34 -0
  4. package/bin/app.mjs +61 -4
  5. package/bin/canary.mjs +108 -0
  6. package/bin/capacity.mjs +107 -0
  7. package/bin/cli.mjs +7 -2
  8. package/bin/crew/open.mjs +17 -0
  9. package/bin/crew-runner.mjs +25 -4
  10. package/bin/disk.mjs +1 -1
  11. package/bin/doctor.mjs +119 -2
  12. package/bin/duty.mjs +5 -2
  13. package/bin/fitness.mjs +15 -0
  14. package/bin/herdr-agent.mjs +21 -3
  15. package/bin/models.mjs +54 -23
  16. package/bin/wake-nudge.mjs +6 -3
  17. package/deploy/com.trantor.hub.plist +15 -3
  18. package/deploy/node-path.sh +11 -4
  19. package/deploy/setup.sh +6 -13
  20. package/docs/BUILD-DOCTRINE.md +5 -0
  21. package/docs/FEATURES.md +32 -0
  22. package/hooks/sessionstart.mjs +1 -1
  23. package/hub/auth.mjs +3 -1
  24. package/hub/review-store.mjs +48 -0
  25. package/hub/routes/capacity.mjs +77 -0
  26. package/hub/routes/insights.mjs +40 -6
  27. package/hub/routes/messages.mjs +16 -60
  28. package/hub/routes/reviews.mjs +86 -0
  29. package/hub/send-message.mjs +51 -0
  30. package/hub.mjs +5 -1
  31. package/kimi.plugin.json +1 -1
  32. package/lib/app-screenshot.mjs +199 -0
  33. package/lib/canary/canary.mjs +166 -0
  34. package/lib/canary/probes.mjs +197 -0
  35. package/lib/canary/registry.mjs +30 -0
  36. package/lib/capacity-machines.mjs +79 -0
  37. package/lib/capacity.mjs +172 -0
  38. package/lib/discovery/SOURCES.md +30 -0
  39. package/lib/discovery/claude.mjs +27 -0
  40. package/lib/discovery/codex.mjs +74 -0
  41. package/lib/discovery/common.mjs +56 -0
  42. package/lib/discovery/gemini.mjs +27 -0
  43. package/lib/discovery/index.mjs +104 -0
  44. package/lib/discovery/kimi.mjs +10 -0
  45. package/lib/discovery/opencode.mjs +19 -0
  46. package/lib/discovery/qwen.mjs +16 -0
  47. package/lib/disk.mjs +14 -4
  48. package/lib/fitness.mjs +97 -0
  49. package/lib/herdr-signing.mjs +108 -0
  50. package/lib/launch-node.mjs +96 -0
  51. package/lib/machine-health.mjs +80 -1
  52. package/lib/review-hunks.mjs +41 -0
  53. package/lib/turn-usage.mjs +66 -10
  54. package/mcp.mjs +17 -0
  55. package/package.json +3 -2
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Trantor — the hub-world for AI agent crews: live message bus, presence, project Kanban/flow board + context-handoff for independent AI coding agents (Claude, Codex, Gemini, …)",
9
- "version": "0.18.141"
9
+ "version": "0.18.144"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "trantor",
14
14
  "source": "./",
15
15
  "description": "The hub-world for AI agent crews. Say \"fire up the crew\" and Claude becomes the architect: a plan-aware Advisor routes the work (solo / cheap inline calls / live crew of Codex, GLM, Kimi & DeepSeek in their own terminal windows), a Kanban/flow command center with a testing gate tracks it, and an economics brain (Scrooge) keeps the receipts. Includes the relay MCP, a SessionStart auto-discovery hook, and a PreCompact context-handoff so a fresh session can take over a full window instead of compacting.",
16
- "version": "0.18.141",
16
+ "version": "0.18.144",
17
17
  "author": {
18
18
  "name": "Sasha Bogojevic"
19
19
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trantor",
3
- "version": "0.18.141",
3
+ "version": "0.18.144",
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
@@ -441,6 +441,27 @@ trantor setup | doctor | connect | profile | provider | models
441
441
  the drill loop; the XCTest drills in `ios/` stay the regression gate. `trantor doctor` reports
442
442
  the AXe pin.
443
443
 
444
+ - **`trantor app screenshot [--window main|popout] [--project <name>] [--out file.png]`** — the
445
+ desktop app snapshots its own window and writes a PNG, so an agent can look at the UI it just
446
+ built without macOS Screen Recording permission. Agents get the same as the `app_screenshot`
447
+ tool. The pop-out window is picked by project (default: the caller's).
448
+
449
+ - **`trantor app click <name> [--selector css]`** — click the app's own UI by name, or
450
+ use `click --selector css` for an exact target. `app read [--selector css]` reads its text.
451
+ `app type <text> [--selector css]` replaces the focused input or textarea's value (including
452
+ empty text), firing input and change events so React state updates. A missing selector errors
453
+ without touching another element. `app key <chord>` dispatches keydown and keyup to the focused
454
+ element; for example `app key "Mod+N"`, `app type "src/hello.ts"`, then `app key Enter`.
455
+ `Esc` aliases Escape; Mod is Command on macOS and Control elsewhere. Ctrl, Meta, Alt and Shift
456
+ modifiers are also supported. These commands accept `--window main|popout` and `--project name`.
457
+ They use the app socket and DOM events; they do not synthesize OS keyboard events or browser
458
+ default actions such as Tab focus traversal.
459
+
460
+ - **herdr signing** — herdr ships ad-hoc signed, so each herdr update used to orphan its Screen
461
+ Recording toggle while it still showed on. `trantor herdr install` and `trantor open` re-sign an
462
+ ad-hoc herdr with your Developer ID under the fixed identifier `com.trantor.herdr`, so the grant
463
+ survives updates; `trantor doctor` reports the state and `--fix` re-signs.
464
+
444
465
  - **`trantor new <name>`** — project genesis in one command: makes the dir under your dev root
445
466
  (`TRANTOR_DEV_ROOT`, else the Projects folder chosen in the app's Settings, stored as
446
467
  `projectsRoot` in `~/.agent-bus/config.json`, else `~/development`), git on main (or `--from <git-url>`, or `--adopt` an
@@ -459,6 +480,19 @@ trantor setup | doctor | connect | profile | provider | models
459
480
  endpoints are wired into OpenCode for you) · `remove <name>`.
460
481
  - **`trantor models [<provider>]`** — browse the live models behind each seat + the router's pick
461
482
  per difficulty. A model with no known price is listed as unpriced and never picked.
483
+ `--all [--json] [--refresh]` discovers models for every provider, including Codex, Kimi, Claude,
484
+ Gemini and Qwen, each marked `listed`, `entitled`, `callable` or `unknown` with its source and a
485
+ reason when unknown (sources: `lib/discovery/SOURCES.md`).
486
+ - **`trantor capacity [--json]`** — the live ledger across every project: each provider's usage
487
+ windows and resets, prepaid balances, burn rate per seat, each machine's load, memory, swap and
488
+ disk, and every seat's last turn and model. Unknown values print as unknown; with the hub down
489
+ it falls back to local balances.
490
+ - **`trantor fitness [--json]`** — read-only model fitness from attempt records, grouped by
491
+ provider, model, effort, harness, task kind, difficulty and machine, with sample counts.
492
+ Infrastructure failures are excluded from quality.
493
+ - **`trantor canary [--json]`** — runs the live probe for every long-standing feature in
494
+ `docs/FEATURES.md` and prints pass or fail per feature; `trantor canary install` adds the daily
495
+ job, which posts a failing probe once per episode.
462
496
  - **`trantor memory`** — pins a project's Claude memory notes to the code they describe
463
497
  (graft symbols and files) and flags a note **stale** when a pinned symbol's body changes, or
464
498
  **broken** when it disappears. `check [--strict]` reports; `pin <note> | --all [--dry-run]`
package/bin/app.mjs CHANGED
@@ -14,19 +14,76 @@ import { join } from "node:path";
14
14
  import { tmpdir } from "node:os";
15
15
  import { cleanLaunchEnv } from "../lib/launch-env.mjs";
16
16
  import { newestDmgRelease } from "../lib/app-release.mjs";
17
+ import {
18
+ appType, appKey, appClick, appNavigate, appRead, appScreenshot, appWindow,
19
+ parseTypeArgs, parseKeyArgs, parseClickArgs, parseNavigateArgs, parseReadArgs, parseScreenshotArgs, parseWindowArgs,
20
+ } from "../lib/app-screenshot.mjs";
17
21
 
18
22
  const REPO = "sashabogi/trantor";
19
23
  const APP = "/Applications/Trantor.app";
20
24
  const ARCH_TAG = process.arch === "arm64" ? "aarch64" : "x64";
21
25
  const cmd = process.argv[2] || "status";
22
26
 
27
+ if (cmd === "screenshot") {
28
+ try { console.log((await appScreenshot(parseScreenshotArgs(process.argv.slice(3)))).path); }
29
+ catch (error) { console.error(`trantor app: ${error.message}`); process.exit(1); }
30
+ process.exit(0);
31
+ }
32
+
33
+ // #14584: agents drive the app's own UI over the same socket as app_screenshot — no macOS
34
+ // permissions, and an explicit error when the app is not running.
35
+ if (["window", "navigate", "click", "read", "type", "key"].includes(cmd)) {
36
+ try { console.log(await appControl(cmd, process.argv.slice(3))); }
37
+ catch (error) { console.error(`trantor app: ${error.message}`); process.exit(1); }
38
+ process.exit(0);
39
+ }
40
+
41
+ async function appControl(verb, argv) {
42
+ if (verb === "window") {
43
+ const options = parseWindowArgs(argv);
44
+ const { action, window } = options;
45
+ const result = await appWindow(options);
46
+ if (action === "size") return `the ${result.window ?? window ?? "main"} window size is ${result.width}x${result.height}`;
47
+ if (action === "focus") return `focused the ${result.window ?? window ?? "main"} window`;
48
+ return `the ${result.window ?? window ?? "main"} window is ${result.fullscreen ? "" : "not "}fullscreen`;
49
+ }
50
+ if (verb === "navigate") {
51
+ const { screen, project } = parseNavigateArgs(argv);
52
+ await appNavigate({ screen, project });
53
+ return `navigated to ${screen}${project ? ` in ${project}` : ""}`;
54
+ }
55
+ if (verb === "click") {
56
+ const { name, selector, window, project } = parseClickArgs(argv);
57
+ const result = await appClick({ name, selector, window, project });
58
+ return `clicked ${JSON.stringify(result.name ?? name ?? selector)}`;
59
+ }
60
+ if (verb === "type") {
61
+ await appType(parseTypeArgs(argv));
62
+ return "typed into the app";
63
+ }
64
+ if (verb === "key") {
65
+ await appKey(parseKeyArgs(argv));
66
+ return "sent key to the app";
67
+ }
68
+ const options = parseReadArgs(argv);
69
+ const result = await appRead(options);
70
+ return (result.text ?? "").replace(/\n+$/, "");
71
+ }
72
+
23
73
  if (process.platform !== "darwin") { console.error("trantor app: the desktop app is macOS-only for now"); process.exit(1); }
24
74
  if (!["status", "install", "update"].includes(cmd)) {
25
75
  console.error([
26
- "usage: trantor app [status|install|update]",
27
- " status installed version vs latest release (default)",
28
- " install download the latest release DMG and install to /Applications",
29
- " update same as install, then relaunch the app from a clean env",
76
+ "usage: trantor app [status|install|update|screenshot|window|navigate|click|read|type|key]",
77
+ " status installed version vs latest release (default)",
78
+ " install download the latest release DMG and install to /Applications",
79
+ " update same as install, then relaunch the app from a clean env",
80
+ " screenshot [--window main|popout] [--project name] [--out file.png]",
81
+ " window <fullscreen|unfullscreen|focus|size WxH|size restore> [--window main|popout] [--project name]",
82
+ " navigate <screen> [--project name]",
83
+ " click <name> [--selector css] [--window main|popout] [--project name]",
84
+ " type <text> [--selector css] [--window main|popout] [--project name]",
85
+ " key <chord> [--window main|popout] [--project name]",
86
+ " read [--selector css] [--window main|popout] [--project name]",
30
87
  ].join("\n"));
31
88
  process.exit(1);
32
89
  }
package/bin/canary.mjs ADDED
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env node
2
+ // trantor canary — run every docs/FEATURES.md probe (#14655).
3
+ // trantor canary [--json] run the probes; read-only, writes nothing, posts nothing
4
+ // trantor canary --daily what launchd runs: also records the run and posts new failures once per episode
5
+ // trantor canary install | uninstall | plist
6
+ import { mkdirSync, writeFileSync, rmSync, existsSync } from "node:fs";
7
+ import { join } from "node:path";
8
+ import { homedir } from "node:os";
9
+ import { execFileSync } from "node:child_process";
10
+ import { fileURLToPath } from "node:url";
11
+ import { busDir, resolveHub, knownProjects, checkoutFor, readConfig } from "../lib/project.mjs";
12
+ import { loadRegistry } from "../lib/canary/registry.mjs";
13
+ import {
14
+ runCanary, tally, advanceEpisodes, episodeMessage, readEpisodes, recordRun,
15
+ defaultContext, canaryPlist, CANARY_LABEL,
16
+ } from "../lib/canary/canary.mjs";
17
+
18
+ const SELF = fileURLToPath(import.meta.url);
19
+ const PROJECT = "trantor";
20
+ const args = process.argv.slice(2);
21
+ const cmd = args.find((a) => !a.startsWith("--")) || "run";
22
+ const JSON_MODE = args.includes("--json");
23
+ const DAILY = args.includes("--daily");
24
+ const PLIST_PATH = join(homedir(), "Library", "LaunchAgents", `${CANARY_LABEL}.plist`);
25
+
26
+ const launchctl = (argv) => execFileSync("launchctl", argv, { stdio: ["ignore", "pipe", "pipe"], encoding: "utf8" });
27
+
28
+ if (cmd === "plist") {
29
+ process.stdout.write(canaryPlist({ script: SELF, busDir: busDir() }));
30
+ process.exit(0);
31
+ }
32
+
33
+ if (cmd === "install") {
34
+ if (process.platform !== "darwin") { console.error("trantor canary install: launchd is macOS-only; run `trantor canary --daily` from cron elsewhere"); process.exit(1); }
35
+ mkdirSync(join(busDir(), "logs"), { recursive: true });
36
+ mkdirSync(join(homedir(), "Library", "LaunchAgents"), { recursive: true });
37
+ writeFileSync(PLIST_PATH, canaryPlist({ script: SELF, busDir: busDir() }), { mode: 0o644 });
38
+ try { launchctl(["bootout", `gui/${process.getuid()}/${CANARY_LABEL}`]); } catch { /* first install has no prior job */ }
39
+ launchctl(["bootstrap", `gui/${process.getuid()}`, PLIST_PATH]);
40
+ console.log(`installed: ${PLIST_PATH}\nruns every day at 09:30; failures post to the ${PROJECT} lane and the app once per episode`);
41
+ process.exit(0);
42
+ }
43
+
44
+ if (cmd === "uninstall") {
45
+ try { launchctl(["bootout", `gui/${process.getuid()}/${CANARY_LABEL}`]); } catch { /* already stopped */ }
46
+ rmSync(PLIST_PATH, { force: true });
47
+ console.log(`${CANARY_LABEL} removed`);
48
+ process.exit(0);
49
+ }
50
+
51
+ if (cmd !== "run") {
52
+ console.error("usage: trantor canary [--json] [--daily] | install | uninstall | plist");
53
+ process.exit(2);
54
+ }
55
+
56
+ async function appRead() {
57
+ const { appRead: read } = await import("../lib/app-screenshot.mjs");
58
+ return read({ window: "main", project: "" });
59
+ }
60
+
61
+ // Owner identity, not a fresh agent key: the hub enforces enrollment, and a message to the owner is
62
+ // what raises the app's notification (shared/notify.ts), while the broadcast lands in the lane.
63
+ async function post(text) {
64
+ const cfg = readConfig();
65
+ const owner = String(cfg.ownerIdentity || "");
66
+ if (!owner) throw new Error("no ownerIdentity in ~/.agent-bus/config.json to sign with");
67
+ const { loadOrCreate } = await import("../lib/identity.mjs");
68
+ const { sfetchJson } = await import("../lib/signed-fetch.mjs");
69
+ const identity = loadOrCreate(owner, "human");
70
+ if (!identity) throw new Error(`owner identity ${owner} has no usable key on this machine`);
71
+ const hub = resolveHub(PROJECT);
72
+ for (const to of ["all", owner]) {
73
+ const r = await sfetchJson(`${hub}/send`, { payload: { from: owner, to, project: PROJECT, kind: "canary", text, wake: false }, identity, signal: AbortSignal.timeout(10000) });
74
+ if (!r?.ok) throw new Error(`hub refused the canary message to ${to} (HTTP ${r?.status ?? "?"})`);
75
+ }
76
+ }
77
+
78
+ const bus = busDir();
79
+ const rows = loadRegistry(process.env.TRANTOR_FEATURES_PATH || undefined);
80
+ const ctx = defaultContext({ busDir: bus, hub: resolveHub(PROJECT), knownProjects, checkoutFor, appRead });
81
+ const run = await runCanary({ rows, ctx });
82
+ const t = tally(run.results);
83
+
84
+ if (DAILY) {
85
+ const step = advanceEpisodes(readEpisodes(bus), run);
86
+ const text = episodeMessage(step, run);
87
+ const record = { ...run, posted: [] };
88
+ if (text) {
89
+ try { await post(text); record.posted = step.announce.map((r) => r.id); }
90
+ catch (error) {
91
+ // Unannounced episodes stay closed, so tomorrow's run tries again instead of going quiet.
92
+ for (const r of step.announce) delete step.episodes[r.id];
93
+ record.postError = error.message;
94
+ console.error(`canary: could not post: ${error.message}`);
95
+ }
96
+ }
97
+ recordRun(bus, record, step.episodes);
98
+ }
99
+
100
+ if (JSON_MODE) {
101
+ console.log(JSON.stringify({ ...run, ...t }, null, 2));
102
+ } else {
103
+ const mark = { pass: "✓", fail: "✗", skip: "–" };
104
+ console.log(`TRANTOR CANARY ${new Date(run.ts).toISOString().slice(0, 16).replace("T", " ")} UTC\n`);
105
+ for (const r of run.results) console.log(` ${mark[r.status]} ${r.status.padEnd(4)} ${r.id.padEnd(24)} ${r.detail}`);
106
+ console.log(`\n${t.pass} pass, ${t.fail} fail, ${t.skip} skip${existsSync(PLIST_PATH) ? "" : " (no daily job: trantor canary install)"}`);
107
+ }
108
+ process.exit(DAILY ? 0 : t.fail ? 1 : 0);
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env node
2
+ // #14653: trantor capacity — the live ledger on your terminal: provider budgets with every window
3
+ // and reset, prepaid balances, the burn rate, machine load/memory/swap/disk/seats, and each seat's
4
+ // last turn and real model. Read-only, straight from GET /capacity.
5
+
6
+ // Degraded by design: when the hub is unreachable the CLI falls back to the LOCAL provider
7
+ // balances (same sources `trantor balances` reads) and says it is local-only — machines, seats and
8
+ // burn rate print unknown, never a guess.
9
+ // Usage: trantor capacity [--json]
10
+ import { signedGet, sessionContext, relayUrl } from "../hooks/lib/api.mjs";
11
+ import { fetchBalances, fmtBalance } from "../lib/balances.mjs";
12
+ import { loadProfile } from "./profile.mjs";
13
+ import { resolveKeys } from "../lib/provider-keys.mjs";
14
+ import { detectedCliBalanceRows } from "../lib/providers.mjs";
15
+ import { fmtBytes, fmtAge, fmtCount, fmtReset } from "../lib/capacity.mjs";
16
+
17
+ const args = process.argv.slice(2);
18
+ const asJson = args.includes("--json");
19
+ const { project } = sessionContext();
20
+ const hub = relayUrl(project);
21
+
22
+ const response = await signedGet(`/capacity?project=${encodeURIComponent(project)}`, { timeoutMs: 5000, project });
23
+
24
+ if (!response.ok && response.status !== 0) {
25
+ console.error(`hub refused: ${response.json?.error || response.reason || `HTTP ${response.status}`}`);
26
+ process.exit(1);
27
+ }
28
+
29
+ if (!response.ok) {
30
+ // Hub down: local balances only (profile-scoped, exactly what `trantor balances` would fetch).
31
+ const profileProviders = loadProfile().providers || {};
32
+ const configured = Object.keys(profileProviders);
33
+ const env = resolveKeys(process.env);
34
+ const detected = await detectedCliBalanceRows({ env });
35
+ const profileScoped = await fetchBalances(env, { only: configured.filter((p) => p !== "claude" && p !== "codex") });
36
+ const balances = [...detected, ...profileScoped];
37
+ const reason = response.reason || "unreachable";
38
+ if (asJson) {
39
+ console.log(JSON.stringify({ degraded: "local-only", reason, hub, balances, budgets: null, burn: null, machines: null, seats: null }, null, 2));
40
+ } else {
41
+ console.log(`hub unreachable (${reason}) — LOCAL BALANCES ONLY; machines, seats and burn rate unknown.`);
42
+ console.log(`hub: ${hub}\n`);
43
+ if (!balances.length) console.log("no local balance rows (no keys in env / no quota profile on this machine)");
44
+ for (const b of balances) console.log(" " + fmtBalance(b));
45
+ }
46
+ process.exit(0);
47
+ }
48
+
49
+ const ledger = response.json || {};
50
+ if (asJson) { console.log(JSON.stringify(ledger, null, 2)); process.exit(0); }
51
+
52
+ const budgets = ledger.budgets || {};
53
+ console.log(`TRANTOR CAPACITY — hub ${hub}${budgets.snapshotAgeMs != null ? ` · budgets ${fmtAge(budgets.snapshotAgeMs)} old` : ""}\n`);
54
+
55
+ console.log("PROVIDER BUDGETS");
56
+ const providers = budgets.providers || [];
57
+ if (!providers.length) console.log(" unknown — no balance snapshot on the hub yet (run: trantor balances)");
58
+ for (const p of providers) {
59
+ const machine = p.machine ? ` · ${p.machine}` : "";
60
+ const age = p.ageMs != null ? ` · ${fmtAge(p.ageMs)} old` : "";
61
+ const low = p.low ? " 🔴 REFILL SOON" : "";
62
+ if (!p.ok) { console.log(` ${p.label}${machine}${age}: ⚠ ${p.error || "unread"}${low}`); continue; }
63
+ if (p.kind === "windows") {
64
+ const wins = (p.windows || []).map((w) => ` ${w.name} ${w.usedPct != null ? w.usedPct + "% used" : "unknown"}${w.resetsAt ? " · resets " + fmtReset(w.resetsAt) : ""}${w.locked ? " · LOCKED" : ""}`);
65
+ console.log(` ${p.label}${machine}${age}:${wins.join(" ·") || " windows unknown"}${low}`);
66
+ } else if (p.kind === "quota") {
67
+ const reset = p.resetTime ? ` · resets ${fmtReset(p.resetTime)}` : "";
68
+ console.log(` ${p.label}${p.plan ? " (" + p.plan + ")" : ""}${machine}${age}: ${p.remainingPct != null ? p.remainingPct + "% left" : p.detail || "quota unknown"}${reset}${low}`);
69
+ } else if (p.kind === "subscription") {
70
+ console.log(` ${p.label}${machine}${age}: ${p.plan || "subscription"}${low}`);
71
+ } else {
72
+ const sym = p.currency === "CNY" ? "¥" : p.currency === "EUR" ? "€" : "$";
73
+ const left = p.remaining != null ? `${sym}${p.remaining.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${p.currency} left` : "no limit / unknown";
74
+ console.log(` ${p.label}${machine}${age}: ${left}${low}`);
75
+ }
76
+ }
77
+ const lows = providers.filter((p) => p.low);
78
+ if (lows.length) console.log(`\n⚠ ${lows.length} provider(s) low: ${lows.map((p) => p.label).join(", ")}`);
79
+
80
+ const burn = (ledger.burn?.windows) || {};
81
+ console.log("\nBURN RATE");
82
+ for (const [name, w] of Object.entries(burn)) {
83
+ console.log(` ${name}: ${w.turns} turns · ${fmtCount(w.tokens)} tokens (${w.turnsPerHour} turns/h · ${fmtCount(w.tokensPerHour)} tokens/h)`);
84
+ for (const s of w.bySeat || []) {
85
+ console.log(` ${s.persona}${s.project ? ":" + s.project : ""}: ${s.turns} turns · ${fmtCount(s.tokens)} tokens${s.failures ? ` · ${s.failures} failed` : ""}`);
86
+ }
87
+ }
88
+
89
+ console.log("\nMACHINES");
90
+ const machines = ledger.machines || [];
91
+ if (!machines.length) console.log(" unknown — no machine beats and no seat machines on the hub");
92
+ for (const m of machines) {
93
+ const beat = m.heartbeat ? `beat ${fmtAge(m.ageMs)}${m.stale ? " (STALE)" : ""}` : "no beat";
94
+ console.log(` ${m.machine} · ${beat}`);
95
+ console.log(` load ${m.cpuPct != null ? m.cpuPct + "%" : "unknown"}${m.cores ? ` on ${m.cores} cores` : ""} · mem ${m.memUsed != null ? `${fmtBytes(m.memUsed)}/${fmtBytes(m.memTotal)} (${Math.round((m.memUsed / m.memTotal) * 100)}%)` : "unknown"} · pressure ${m.memPressurePct != null ? m.memPressurePct + "%" : "unknown"}`);
96
+ console.log(` swap ${m.swapUsed != null ? `${fmtBytes(m.swapUsed)}/${fmtBytes(m.swapTotal)}` : "unknown"} · disk free ${m.diskFree != null ? `${fmtBytes(m.diskFree)}/${fmtBytes(m.diskTotal)}` : "unknown"} · seats ${m.seatsOnline != null ? `${m.seatsOnline}/${m.seats} online` : "unknown"}`);
97
+ }
98
+
99
+ console.log("\nSEATS");
100
+ const seats = ledger.seats || [];
101
+ if (!seats.length) console.log(" none visible");
102
+ for (const s of seats) {
103
+ const live = s.online ? "online" : `last seen ${fmtAge(s.ageMs)}`;
104
+ const last = s.lastTurn ? `last turn ${fmtAge(s.lastTurn.ageMs)} · ${s.lastTurn.outcome || "unknown"}` : "no turn in 7d";
105
+ const model = s.model || "cli-default";
106
+ console.log(` ${s.session} ${live} · ${model} · ${last}${s.machine ? ` · ${s.machine}` : ""}`);
107
+ }
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 "canary": run("bin/canary.mjs"); break;
23
24
  case "sim": run("bin/sim.mjs"); break;
24
25
  case "connect": run("bin/connect.mjs"); break;
25
26
  case "profile": run("bin/profile.mjs"); break;
@@ -139,6 +140,7 @@ switch (cmd) {
139
140
  case "new": run("bin/new.mjs"); break;
140
141
  case "genesis-kickoff": run("bin/genesis-kickoff.mjs"); break;
141
142
  case "balances": case "balance": case "credits": run("bin/balances.mjs"); break;
143
+ case "capacity": run("bin/capacity.mjs"); break;
142
144
  case "recost": run("bin/recost.mjs"); break;
143
145
  case "handoff": run("bin/baton.mjs"); break;
144
146
  case "takeover": run("bin/takeover.mjs"); break;
@@ -157,6 +159,7 @@ switch (cmd) {
157
159
  case "seats": case "seat": run("bin/seats.mjs"); break;
158
160
  case "seat-why": case "why": run("bin/seat-why.mjs"); break;
159
161
  case "seat-record": run("bin/seat-record.mjs"); break;
162
+ case "fitness": run("bin/fitness.mjs"); break;
160
163
  case "telemetry": {
161
164
  // #14067: `trantor telemetry ship` is how existing history reaches the hub — this seat's log,
162
165
  // or every *.jsonl in the logs folder with --all. Always from the start of the file: a re-run
@@ -278,7 +281,7 @@ switch (cmd) {
278
281
  console.log(`trantor — the hub-world for AI agent crews
279
282
 
280
283
  trantor setup one-shot install: hub as an always-on service + config + CLI wiring + doctor
281
- trantor doctor where do I stand? hub/plugin/CLIs/auth/keys/profile, with copy-paste fixes
284
+ trantor doctor where do I stand? hub/plugin/CLIs/auth/keys/profile, with copy-paste fixes (--fix: also re-signs herdr so Screen Recording survives its updates)
282
285
  trantor sim drive the owned iOS Simulator through AXe: boot|install|launch|screen|tap|swipe|type|shutdown
283
286
  trantor connect (re)wire every installed AI CLI to the bus
284
287
  trantor profile declare your plans: trantor profile set claude=max codex=plus deepseek=api
@@ -301,7 +304,7 @@ switch (cmd) {
301
304
  trantor restore after a reboot, reopen only the orchestrators you opted in: restore [--dry-run] · restore enable|disable <project>
302
305
  trantor ui open the live dashboard (board + flow views)
303
306
  trantor pair pair a phone: mint a trantor://enroll link for the companion app — [--role owner] [--sim] [--json]
304
- trantor app the DESKTOP app: status | install | update — pulls the latest DMG from GitHub Releases
307
+ trantor app the DESKTOP app: status | install | update | screenshot — install releases or capture the app window
305
308
  trantor catchup "where are we?" — the continuous board + git, with a synthesized brief
306
309
  trantor agents what this session's sub-agents did (task · returned? · files written · survived on disk) — [<sessionId>] [--json]
307
310
  trantor gate go|nogo <id> decide a conflicting file edit
@@ -311,6 +314,7 @@ switch (cmd) {
311
314
  trantor new project genesis: new <name> [--from <git-url>] [--brief <file>] [--dir <parent>] [--adopt] [--json] — creates <parent>/<name>, git main, docs/PRD.md + small CLAUDE.md, hooks, hub brief + first card (never spawns a session)
312
315
  trantor genesis-kickoff internal wake prompt selector from the checkout + signed project board
313
316
  trantor balances how much credit is left on each CONFIGURED provider (from your profile) — refill before you stall — [--json]
317
+ trantor capacity the live ledger: budgets and resets, burn rate, machines, seats — [--json]
314
318
  trantor recost recompute sub-agent notional cost from on-disk transcripts + reseed the board (repair after upgrade) — [--dry-run]
315
319
  trantor handoff finish this session NOW: write a handoff, open a fresh session that takes over, and close this one (manual baton)
316
320
  trantor advise ask the Advisor directly (JSON on stdin; --demo to see it)
@@ -324,6 +328,7 @@ switch (cmd) {
324
328
  trantor state a seat's working memory: show <seat> <card> [--json] · validate · reset --force · gc [--apply]
325
329
  trantor seat-why WHY a seat is down (err file, logs, pids): seat-why <agent> [--json] — quota, auth, crash, or just no pane
326
330
  trantor seat-record the per-project seat record the advisor benches from (✓/∅/↩ per difficulty) — [--project p] [--reset <seat>] [--json]
331
+ trantor fitness read-only model fitness by provider/model/effort/harness/task/difficulty/machine — [--project p] [--json]
327
332
  trantor telemetry ship send turn history to the hub — this seat's log, or every log with --all; prints stored/duplicates/dropped per file
328
333
  trantor inbox THIS session's unread bus messages, signed (works under enforce) — [--all] [--consume] [--json]
329
334
  trantor policy the autonomy ladder: show | set <project> <1-4> | link <a> <b> --reason "<why>"
package/bin/crew/open.mjs CHANGED
@@ -7,6 +7,8 @@ import { call, parseJsonOutput } from "./core.mjs";
7
7
  import { createWorkspace, herdrCall, paneAlive, reportAgent, splitPane, workspaceList, workspacePane } from "./herdr.mjs";
8
8
  import { dropState, readRows, recordState } from "./state.mjs";
9
9
  import { resolveOrchestratorDir } from "./worktrees.mjs";
10
+ import { herdrBin } from "../herdr-agent.mjs";
11
+ import { ensureHerdrSigned, HERDR_SIGN_IDENTIFIER } from "../../lib/herdr-signing.mjs";
10
12
 
11
13
  const STRIP = [
12
14
  "CLAUDECODE", "CLAUDE_CODE_ENTRYPOINT", "CLAUDE_CODE_SESSION_ID", "CLAUDE_CODE_CHILD_SESSION",
@@ -257,6 +259,20 @@ export function maybeBuildGraft(dir) {
257
259
  } catch {}
258
260
  }
259
261
 
262
+ // #14579: herdr updates itself outside Trantor (herdr.dev), so every open re-checks the binary's
263
+ // code identity before it hosts a pane — the orchestrator session will need Screen Recording under
264
+ // it. One cheap codesign read, a re-sign ONLY when the binary is ad-hoc, and a failure NEVER blocks
265
+ // the open: it costs one warning line. Dry runs and non-mac hosts touch nothing.
266
+ export function ensureHerdrSignedForOpen({ dry = false, platform = process.platform, bin = herdrBin(), ensure = ensureHerdrSigned, log = console.error } = {}) {
267
+ if (dry || platform !== "darwin") return { outcome: "skipped" };
268
+ let result;
269
+ try { result = ensure(bin, { onlyAdhoc: true, platform }); }
270
+ catch (error) { result = { outcome: "failed", reason: error?.message || String(error) }; }
271
+ if (result.outcome === "resigned") log(`— herdr re-signed as ${HERDR_SIGN_IDENTIFIER} with ${result.identity} — Screen Recording survives herdr updates —`);
272
+ else if (result.outcome === "failed") log(`warning: herdr is ad-hoc signed and was not re-signed — Screen Recording breaks on the next herdr update — ${result.reason}`);
273
+ return result;
274
+ }
275
+
260
276
  export function openOrchestrator(ctx, args) {
261
277
  let parsed;
262
278
  try { parsed = parseArgs(args); }
@@ -266,6 +282,7 @@ export function openOrchestrator(ctx, args) {
266
282
  Object.assign(ctx, resolveOrchestratorDir(ctx, parsed.project));
267
283
  if (!ctx.dry) maybeBuildGraft(ctx.dir);
268
284
  if (!ctx.have.herdr) throw new Error("trantor open needs herdr (the pane host) — install: curl -fsSL https://herdr.dev/install.sh | sh");
285
+ ensureHerdrSignedForOpen({ dry: ctx.dry });
269
286
  let id = sessionId(ctx);
270
287
  const stale = supersededHandoff(ctx, id);
271
288
  if (stale) {
@@ -35,7 +35,8 @@ import {
35
35
  CUT_CHAIN_PARK_MIN, cutChainEvidence, isBoundedPark, askDuringTurn, askedVerdict,
36
36
  } from "../lib/turn-policy.mjs";
37
37
  import { snapshotBeforeCut } from "./cut-snapshot.mjs";
38
- import { ocTurnUsage, dshTurnUsage, usageTotal, processedInput, codexStepInput, kimiStepInput, claudeStepInput } from "../lib/turn-usage.mjs";
38
+ import { ocTurnUsage, dshTurnUsage, usageTotal, processedInput, codexStepInput, kimiStepInput, claudeStepInput, codexTurnModel, kimiTurnModel, claudeTurnModel } from "../lib/turn-usage.mjs";
39
+ import { effortName, isInfraFailure, providerForModel } from "../lib/fitness.mjs";
39
40
  import { capConfig, capDecision, capHandoffPrompt, capPointerLine, capExhaustedNote } from "../lib/context-cap.mjs";
40
41
  import { ocCompactionContent, ocCompactionLogLine, readOpencodeUserConfig, seatMcpOverlay, seatPermissionOverlay, seatConfigContent } from "../lib/seat-compaction.mjs";
41
42
  import { seatSignalPrefix } from "../lib/seat-signal-guard.mjs";
@@ -941,13 +942,14 @@ async function runTurn(prompt, isFirst, trigger = "kickoff", opts = {}) {
941
942
  // #10197: the card status snapshot the turn is judged against at its end — a move to
942
943
  // testing/done under the turn is delivery even without a commit. null = the hub read failed:
943
944
  // the delivery check stands down rather than claim no-delivery on a transport error.
944
- let cardStatusBefore = null, cardLogBefore = [], cardDifficulty = "";
945
+ let cardStatusBefore = null, cardLogBefore = [], cardDifficulty = "", cardKind = "";
945
946
  if (!opts.state && sessionCard > 0) {
946
947
  try {
947
948
  const { task } = await api(`/card?project=${encodeURIComponent(PROJ)}&id=${sessionCard}`);
948
949
  cardStatusBefore = task ? String(task.status || "") : null;
949
950
  cardLogBefore = task?.log || [];
950
951
  cardDifficulty = task?.difficulty || "";
952
+ cardKind = task?.kind || task?.taskKind || task?.task_kind || "";
951
953
  } catch { cardStatusBefore = null; }
952
954
  }
953
955
  // #9778: the docker snapshot the turn is judged against — containers the CLI spawns are recorded
@@ -1203,7 +1205,8 @@ exit $turn_exit`;
1203
1205
  // #5868: a NEW commit since turn start is real work, and an exit-0 turn with real output is
1204
1206
  // never re-labelled auth — the qwen specimen exited 0 with a shipped commit (aa3c340) while a
1205
1207
  // short capture of echoed contract text tripped the regex.
1206
- const newCommit = !!headBefore && gitOut(["rev-parse", "HEAD"], TURN_DIR) !== headBefore;
1208
+ const headAfter = gitOut(["rev-parse", "HEAD"], TURN_DIR);
1209
+ const newCommit = !!headBefore && headAfter !== headBefore;
1207
1210
  if (realExit === 0 && looksLikeAuthDeath(ownOut, newCommit)) {
1208
1211
  effExit = 1;
1209
1212
  authHit = AUTH_MARKER_RE.exec(ownOut)[0];
@@ -1332,7 +1335,25 @@ exit $turn_exit`;
1332
1335
  // empty/stalled turns to the card that produced nothing. `cut` stays too: the drills read it.
1333
1336
  const outcome = cut ? (stallCut ? "stalled" : "cut") : (effExit !== 0 ? (lastPermissionReject ? "rejected" : "api-error") : noDelivery ? "no-delivery" : lastEmptyTurn ? "empty" : "completed");
1334
1337
  const finalOutcome = askVerdict ? "asked" : blockedVerdict ? "blocked" : outcome;
1335
- const telemetryRow = { ts: Date.now(), persona: PERSONA, agent: AGENT, project: PROJ, turn: TURN, trigger, card: sessionCard || 0, model: MODEL || "cli-default", duration_ms: Date.now() - t0, exit: realExit, effExit, authFailed: effExit !== realExit, emptyOutput: lastEmptyOutput, emptyTurn: lastEmptyTurn, verdict, outcome: finalOutcome, tokens };
1338
+ const endedAt = Date.now();
1339
+ const transcriptModel = DRIVER === "codex" ? codexTurnModel(join(homedir(), ".codex", "sessions"), t0, TURN_DIR)
1340
+ : DRIVER === "kimi" ? kimiTurnModel(join(homedir(), ".kimi-code", "sessions"), sid, t0)
1341
+ : DRIVER === "claude" ? claudeTurnModel(TRANSCRIPT_DIR, t0) : null;
1342
+ // #14654: structured transcript metadata, else the pinned model; free-text model: lines are never read.
1343
+ const actualModel = transcriptModel || MODEL || "unknown";
1344
+ const telemetryRow = { ts: endedAt, persona: PERSONA, agent: AGENT, project: PROJ, turn: TURN, trigger, card: sessionCard || 0, model: actualModel, duration_ms: endedAt - t0, exit: realExit, effExit, authFailed: effExit !== realExit, emptyOutput: lastEmptyOutput, emptyTurn: lastEmptyTurn, verdict, outcome: finalOutcome, tokens };
1345
+ if (sessionCard > 0) {
1346
+ const failure = classifyFailure(effExit, ownOut, lastEmptyOutput, lastEmptyTurn, cut).reason;
1347
+ telemetryRow.attempt = {
1348
+ id: `${SESSION}:${t0}:${TURN}`, card: sessionCard, seat: SESSION, project: PROJ,
1349
+ provider: providerForModel(DRIVER, actualModel), model: actualModel,
1350
+ effort: effortName(turnEffort.effort), harness: DRIVER,
1351
+ taskKind: cardKind || "unknown", difficulty: cardDifficulty || "unknown",
1352
+ machine: MACHINE_LABEL || "unknown", start: new Date(t0).toISOString(), end: new Date(endedAt).toISOString(),
1353
+ commit: newCommit ? headAfter : "", outcome: finalOutcome,
1354
+ infraFailure: isInfraFailure(finalOutcome, failure), tokens: Number.isFinite(tokens) ? tokens : null,
1355
+ };
1356
+ }
1336
1357
  if (usage) telemetryRow.usage = usage;
1337
1358
  if (dockerNew.length) telemetryRow.containers = dockerNew.map(c => c.name || c.id);
1338
1359
  if (cut) telemetryRow.cut = true;
package/bin/disk.mjs CHANGED
@@ -38,7 +38,7 @@ async function install() {
38
38
  const logPath = join(homedir(), ".agent-bus", "disk-launchd.log");
39
39
  mkdirSync(agentDir, { recursive: true });
40
40
  mkdirSync(dirname(logPath), { recursive: true });
41
- writeFileSync(plistPath, launchdPlist({ nodePath: process.execPath, scriptPath: join(ROOT, "bin", "disk.mjs"), logPath }));
41
+ writeFileSync(plistPath, launchdPlist({ scriptPath: join(ROOT, "bin", "disk.mjs"), logPath }));
42
42
  const uid = userInfo().uid;
43
43
  exec("launchctl", ["bootout", `gui/${uid}/com.trantor.disk`]);
44
44
  const r = exec("launchctl", ["bootstrap", `gui/${uid}`, plistPath]);