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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +34 -0
- package/bin/app.mjs +61 -4
- package/bin/canary.mjs +108 -0
- package/bin/capacity.mjs +107 -0
- package/bin/cli.mjs +7 -2
- package/bin/crew/open.mjs +17 -0
- package/bin/crew-runner.mjs +25 -4
- package/bin/disk.mjs +1 -1
- package/bin/doctor.mjs +119 -2
- package/bin/duty.mjs +5 -2
- package/bin/fitness.mjs +15 -0
- package/bin/herdr-agent.mjs +21 -3
- package/bin/models.mjs +54 -23
- package/bin/wake-nudge.mjs +6 -3
- package/deploy/com.trantor.hub.plist +15 -3
- package/deploy/node-path.sh +11 -4
- package/deploy/setup.sh +6 -13
- package/docs/BUILD-DOCTRINE.md +5 -0
- package/docs/FEATURES.md +32 -0
- package/hooks/sessionstart.mjs +1 -1
- package/hub/auth.mjs +3 -1
- package/hub/review-store.mjs +48 -0
- package/hub/routes/capacity.mjs +77 -0
- package/hub/routes/insights.mjs +40 -6
- package/hub/routes/messages.mjs +16 -60
- package/hub/routes/reviews.mjs +86 -0
- package/hub/send-message.mjs +51 -0
- package/hub.mjs +5 -1
- package/kimi.plugin.json +1 -1
- package/lib/app-screenshot.mjs +199 -0
- package/lib/canary/canary.mjs +166 -0
- package/lib/canary/probes.mjs +197 -0
- package/lib/canary/registry.mjs +30 -0
- package/lib/capacity-machines.mjs +79 -0
- package/lib/capacity.mjs +172 -0
- package/lib/discovery/SOURCES.md +30 -0
- package/lib/discovery/claude.mjs +27 -0
- package/lib/discovery/codex.mjs +74 -0
- package/lib/discovery/common.mjs +56 -0
- package/lib/discovery/gemini.mjs +27 -0
- package/lib/discovery/index.mjs +104 -0
- package/lib/discovery/kimi.mjs +10 -0
- package/lib/discovery/opencode.mjs +19 -0
- package/lib/discovery/qwen.mjs +16 -0
- package/lib/disk.mjs +14 -4
- package/lib/fitness.mjs +97 -0
- package/lib/herdr-signing.mjs +108 -0
- package/lib/launch-node.mjs +96 -0
- package/lib/machine-health.mjs +80 -1
- package/lib/review-hunks.mjs +41 -0
- package/lib/turn-usage.mjs +66 -10
- package/mcp.mjs +17 -0
- package/package.json +3 -2
package/bin/doctor.mjs
CHANGED
|
@@ -8,14 +8,18 @@ import { join, dirname, basename } from "node:path";
|
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
import { execSync } from "node:child_process";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
|
-
import { resolveProject, resolveProjectInfo, resolveHub, DEFAULT_HUB_URL, gitRoot, readProjectId, checkoutFor, localCheckoutFor, orchSessionsPath, PROJECT_MARKER } from "../lib/project.mjs";
|
|
11
|
+
import { resolveProject, resolveProjectInfo, resolveHub, DEFAULT_HUB_URL, gitRoot, readProjectId, checkoutFor, localCheckoutFor, orchSessionsPath, PROJECT_MARKER, busDir as resolveBusDir } from "../lib/project.mjs";
|
|
12
12
|
import { loadOrCreate } from "../lib/identity.mjs";
|
|
13
13
|
import { sfetchJson } from "../lib/signed-fetch.mjs";
|
|
14
14
|
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 { ensureHerdrSigned, HERDR_SIGN_IDENTIFIER, probeHerdrSigning } from "../lib/herdr-signing.mjs";
|
|
19
|
+
import { herdrBin } from "./herdr-agent.mjs";
|
|
18
20
|
import { axeDoctorStatus } from "../lib/sim/axe-status.mjs";
|
|
21
|
+
import { plistPinnedPaths, scriptPinnedPaths, launcherPathFindings } from "../lib/launch-node.mjs";
|
|
22
|
+
import { canaryDoctorRows, readLastRun, CANARY_LABEL } from "../lib/canary/canary.mjs";
|
|
19
23
|
|
|
20
24
|
const H = homedir();
|
|
21
25
|
const ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
@@ -32,6 +36,9 @@ const read = (p) => { try { return JSON.parse(readFileSync(p, "utf8")); } catch
|
|
|
32
36
|
// detection (or parse this text), and the two would drift — the CLI would say a seat is wired while
|
|
33
37
|
// the app said otherwise, with no way to tell which was right.
|
|
34
38
|
const JSON_MODE = process.argv.includes("--json");
|
|
39
|
+
// --fix lets the doctor ACT on the one issue it can fix itself: re-signing herdr (#14579). Every
|
|
40
|
+
// other row stays read-only with its copy-paste fix, so the flag changes exactly one behaviour.
|
|
41
|
+
const FIX_MODE = process.argv.includes("--fix");
|
|
35
42
|
const REPORT = { ok: [], issues: [], notes: [], sections: [] };
|
|
36
43
|
let SECTION = "";
|
|
37
44
|
const say = (line) => { if (!JSON_MODE) console.log(line); };
|
|
@@ -133,6 +140,39 @@ section("duty seat (the fleet watcher)");
|
|
|
133
140
|
const FIX_UP = "trantor duty up (installs the launchd keepalive com.trantor.duty, which relaunches the seat after a crash or reboot)";
|
|
134
141
|
let pid = 0;
|
|
135
142
|
try { pid = Number(readFileSync(join(BUSD, "duty.pid"), "utf8")) || 0; if (pid) process.kill(pid, 0); else pid = 0; } catch { pid = 0; }
|
|
143
|
+
// #14646: ALIVE is not AWAKE. The duty process once sat up for three days on a node binary a
|
|
144
|
+
// Homebrew upgrade had deleted mid-flight — it lost the hub, parked, and took no turn while
|
|
145
|
+
// looking healthy. The runner's turn log is on disk and survives the process: the one witness
|
|
146
|
+
// that does not go down with the hub. A seat that is up must have turned within 24h.
|
|
147
|
+
if (pid) {
|
|
148
|
+
let lastTurn = 0, lastBoot = 0;
|
|
149
|
+
try {
|
|
150
|
+
for (const f of readdirSync(join(BUSD, "logs")).filter(n => n.endsWith("-trantor-duty.jsonl"))) {
|
|
151
|
+
for (const line of readFileSync(join(BUSD, "logs", f), "utf8").split("\n")) {
|
|
152
|
+
if (!line) continue;
|
|
153
|
+
try {
|
|
154
|
+
const row = JSON.parse(line);
|
|
155
|
+
if (!Number.isFinite(row.ts)) continue;
|
|
156
|
+
if (row.boot) lastBoot = Math.max(lastBoot, row.ts);
|
|
157
|
+
if (Number.isInteger(row.turn) && row.turn > 0) lastTurn = Math.max(lastTurn, row.ts);
|
|
158
|
+
} catch {}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
} catch {}
|
|
162
|
+
const ago = (ms) => ms < 60e3 ? `${Math.max(1, Math.round(ms / 60e3))}m` : ms < 3600e3 ? `${Math.round(ms / 60e3)}m` : ms < 86400e3 ? `${Math.round(ms / 3600e3)}h` : `${Math.round(ms / 86400e3)}d`;
|
|
163
|
+
const when = (ts) => `${new Date(ts).toISOString().slice(0, 16).replace("T", " ")} UTC`;
|
|
164
|
+
if (lastTurn && Date.now() - lastTurn <= 24 * 3600e3) {
|
|
165
|
+
ok(`duty seat: turned ${ago(Date.now() - lastTurn)} ago (${when(lastTurn)})`);
|
|
166
|
+
} else if (!lastTurn && lastBoot && Date.now() - lastBoot < 10 * 60e3) {
|
|
167
|
+
note(`duty seat: restarted ${ago(Date.now() - lastBoot)} ago — no turn yet (the kickoff lands within minutes)`);
|
|
168
|
+
} else if (lastTurn) {
|
|
169
|
+
warn(`duty seat: ALIVE but turnless — the process is up (pid ${pid}) yet its last turn was ${ago(Date.now() - lastTurn)} ago (${when(lastTurn)}); nothing has triaged the fleet since`,
|
|
170
|
+
"trantor duty up (a seat that is up but not turning is parked or hub-lost; a restart revives it)");
|
|
171
|
+
} else {
|
|
172
|
+
warn(`duty seat: process up (pid ${pid}) but NO turn on record — it has never woken`,
|
|
173
|
+
"trantor duty up (restart it; the kickoff turn should land within minutes)");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
136
176
|
const keepalive = existsSync(DUTY_PLIST);
|
|
137
177
|
// The seat watches the FLEET hub — the most common project hub in config, the exact pick
|
|
138
178
|
// bin/duty.mjs makes — not necessarily THIS project's hub.
|
|
@@ -174,6 +214,63 @@ section("duty seat (the fleet watcher)");
|
|
|
174
214
|
}
|
|
175
215
|
}
|
|
176
216
|
|
|
217
|
+
// ── launch agents: every com.trantor.* job must still have a program to run ───────────────────
|
|
218
|
+
// #14646: a Homebrew node upgrade deletes the versioned Cellar path older launchers pinned, and
|
|
219
|
+
// launchd restarts the job into exit 126 — the seat dies silently while everything else looks
|
|
220
|
+
// installed. Pinned paths must exist now, and a /Cellar/ path is wrong even while it survives.
|
|
221
|
+
section("launch agents (com.trantor.*)");
|
|
222
|
+
{
|
|
223
|
+
const AGENTS_DIR = join(H, "Library", "LaunchAgents");
|
|
224
|
+
const AGENT_FIX = {
|
|
225
|
+
"com.trantor.duty": "trantor duty up (rewrites the duty launcher to resolve node at exec time)",
|
|
226
|
+
"com.trantor.wake-nudge": "trantor duty up (reinstalls the wake-nudge keepalive)",
|
|
227
|
+
"com.trantor.disk": "trantor disk install (rewrites the daily disk janitor job)",
|
|
228
|
+
"com.trantor.herdr": "trantor herdr install (rewrites herdr's login agent and restore script)",
|
|
229
|
+
"com.trantor.seats": "trantor seats login install (rewrites the seat-restore login job)",
|
|
230
|
+
"com.trantor.hub": "bash deploy/setup.sh (reinstalls the hub service, which resolves node at exec time)",
|
|
231
|
+
};
|
|
232
|
+
const REPORT_FAULT = (name, finding, fix) => {
|
|
233
|
+
const message = finding.kind === "cellar"
|
|
234
|
+
? `pins a versioned Homebrew Cellar path — ${finding.path} (the next brew upgrade deletes it; launchd restarts the job into exit 126)`
|
|
235
|
+
: `program path does not exist — ${finding.path} (a Homebrew node upgrade deletes versioned paths)`;
|
|
236
|
+
warn(`${name}: ${message}`, fix);
|
|
237
|
+
};
|
|
238
|
+
let agents = 0, faults = 0;
|
|
239
|
+
if (!existsSync(AGENTS_DIR)) {
|
|
240
|
+
note("launch agents: no ~/Library/LaunchAgents on this machine (launchd is macOS-only) — nothing to check");
|
|
241
|
+
} else {
|
|
242
|
+
for (const f of readdirSync(AGENTS_DIR).filter(n => /^com\.trantor\..+\.plist$/.test(n)).sort()) {
|
|
243
|
+
const label = f.replace(/\.plist$/, "");
|
|
244
|
+
const fix = AGENT_FIX[label] || `re-run the command that installed ${label}`;
|
|
245
|
+
let text = "";
|
|
246
|
+
try { text = readFileSync(join(AGENTS_DIR, f), "utf8"); } catch { continue; }
|
|
247
|
+
agents++;
|
|
248
|
+
for (const finding of launcherPathFindings(plistPinnedPaths(text))) { REPORT_FAULT(label, finding, fix); faults++; }
|
|
249
|
+
}
|
|
250
|
+
if (!agents) note("launch agents: no com.trantor.* jobs installed in ~/Library/LaunchAgents (the duty keepalive, disk janitor and hub service each add one)");
|
|
251
|
+
}
|
|
252
|
+
// The two launcher scripts a plist execs carry their node INSIDE, not in ProgramArguments —
|
|
253
|
+
// the plist only proves the script exists; the script must prove its own programs do. They are
|
|
254
|
+
// checked even without LaunchAgents: a --window duty seat has a launcher but no plist.
|
|
255
|
+
const scripts = [
|
|
256
|
+
["duty launcher (duty-launch.sh)", join(H, ".agent-bus", "duty-launch.sh"), AGENT_FIX["com.trantor.duty"]],
|
|
257
|
+
["herdr restore script (trantor-herdr-restore.sh)", join(AGENTS_DIR, "trantor-herdr-restore.sh"), AGENT_FIX["com.trantor.herdr"]],
|
|
258
|
+
];
|
|
259
|
+
for (const [name, path, fix] of scripts) {
|
|
260
|
+
if (!existsSync(path)) continue;
|
|
261
|
+
let text = "";
|
|
262
|
+
try { text = readFileSync(path, "utf8"); } catch { continue; }
|
|
263
|
+
for (const finding of launcherPathFindings(scriptPinnedPaths(text))) { REPORT_FAULT(name, finding, fix); faults++; }
|
|
264
|
+
}
|
|
265
|
+
if (agents && !faults) ok(`every com.trantor.* launch agent's program path exists (${agents} agent${agents === 1 ? "" : "s"})`);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// #14655: the feature canary's last run, so a feature that went dark shows up here too.
|
|
269
|
+
section("feature canary");
|
|
270
|
+
for (const row of canaryDoctorRows({ lastRun: readLastRun(resolveBusDir()), installed: existsSync(join(H, "Library", "LaunchAgents", `${CANARY_LABEL}.plist`)) })) {
|
|
271
|
+
row.level === "ok" ? ok(row.message) : row.level === "note" ? note(row.message) : warn(row.message, row.fix);
|
|
272
|
+
}
|
|
273
|
+
|
|
177
274
|
// claude plugin
|
|
178
275
|
section("claude (the orchestrator)");
|
|
179
276
|
if (!has("claude")) warn("claude CLI not found", "install Claude Code: https://claude.com/claude-code");
|
|
@@ -197,13 +294,33 @@ else {
|
|
|
197
294
|
|
|
198
295
|
// herdr's own claude integration reports the session id at SessionStart; without it the desktop app
|
|
199
296
|
// cannot tell which session a pane is running. Read-only probe, and an odd answer is "unknown".
|
|
200
|
-
|
|
297
|
+
// The signing row below answers the OTHER herdr question: is the binary's code identity stable.
|
|
298
|
+
section("herdr");
|
|
201
299
|
{
|
|
202
300
|
const h = probeClaudeIntegration();
|
|
203
301
|
if (h.state === "absent") note("herdr: skipped (not installed)");
|
|
204
302
|
else if (h.state === "installed") ok(`herdr claude integration installed (${h.detail})`);
|
|
205
303
|
else if (h.state === "unknown") note(`herdr claude integration: unknown (${h.detail})`);
|
|
206
304
|
else warn(h.state === "outdated" ? `herdr claude integration is outdated (${h.detail})` : "herdr claude integration is not installed", HERDR_CLAUDE_INSTALL);
|
|
305
|
+
// #14579: Screen Recording follows the binary's code identity, and herdr's stock ad-hoc
|
|
306
|
+
// signature changes on every update — silently orphaning the TCC grant. Report-only unless
|
|
307
|
+
// --fix: the re-sign is the same idempotent ensureHerdrSigned the install path runs.
|
|
308
|
+
const s = probeHerdrSigning(herdrBin());
|
|
309
|
+
if (s.state === "developer-id") ok(`herdr is Developer-ID signed (${s.detail})`);
|
|
310
|
+
else if (s.state === "skipped") note("herdr signing: skipped (not macOS)");
|
|
311
|
+
else if (s.state === "unknown") note(`herdr signing: unknown (${s.detail})`);
|
|
312
|
+
else if (s.state === "absent") { /* the integration rows above already said herdr is absent */ }
|
|
313
|
+
else if (FIX_MODE) {
|
|
314
|
+
const fixed = ensureHerdrSigned(herdrBin());
|
|
315
|
+
if (fixed.outcome === "resigned") ok(`herdr re-signed as ${HERDR_SIGN_IDENTIFIER} with ${fixed.identity} — Screen Recording survives herdr updates`);
|
|
316
|
+
else if (fixed.outcome === "already") ok(`herdr is already signed as ${HERDR_SIGN_IDENTIFIER}`);
|
|
317
|
+
else if (fixed.outcome === "failed") warn(`herdr re-sign failed — ${fixed.reason}`, "trantor herdr install (re-runs the same re-sign)");
|
|
318
|
+
else warn(`herdr is ${s.state === "adhoc" ? `ad-hoc signed (${s.detail})` : "not Developer-ID signed"} — Screen Recording breaks on every herdr update while the toggle still shows ON`, "trantor herdr install (re-signs herdr with your Developer ID under com.trantor.herdr)");
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
warn(`herdr is ${s.state === "adhoc" ? `ad-hoc signed (${s.detail})` : "not Developer-ID signed"} — Screen Recording breaks on every herdr update while the toggle still shows ON`,
|
|
322
|
+
"trantor doctor --fix (re-signs herdr with your Developer ID under com.trantor.herdr; or: trantor herdr install)");
|
|
323
|
+
}
|
|
207
324
|
}
|
|
208
325
|
|
|
209
326
|
// crew CLIs: installed / wired / authenticated
|
package/bin/duty.mjs
CHANGED
|
@@ -20,6 +20,7 @@ import { homedir } from "node:os";
|
|
|
20
20
|
import { fileURLToPath } from "node:url";
|
|
21
21
|
import { loadOrCreate } from "../lib/identity.mjs";
|
|
22
22
|
import { sfetchJson } from "../lib/signed-fetch.mjs";
|
|
23
|
+
import { nodeResolverSnippet } from "../lib/launch-node.mjs";
|
|
23
24
|
|
|
24
25
|
const ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
25
26
|
const BUS = process.env.AGENT_BUS_DIR || join(homedir(), ".agent-bus");
|
|
@@ -166,11 +167,13 @@ function keepalivePlistBody() {
|
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
// A launcher carries the rules because their quotes, backticks and dollar signs cannot safely ride
|
|
169
|
-
// a command line. Single-quote every value so bash 3.2 treats them literally.
|
|
170
|
+
// a command line. Single-quote every value so bash 3.2 treats them literally. #14646: the node is
|
|
171
|
+
// resolved at EXEC time (command -v node against the PATH exported above) — a pinned execPath is
|
|
172
|
+
// a versioned Homebrew Cellar path that `brew upgrade node` deletes out from under launchd.
|
|
170
173
|
function writeLauncher(env) {
|
|
171
174
|
const shquote = (v) => `'${String(v).replace(/'/g, `'\\''`)}'`;
|
|
172
175
|
const exports = Object.entries(env).map(([k, v]) => `export ${k}=${shquote(v)}`).join("\n");
|
|
173
|
-
writeFileSync(LAUNCHER, `#!/bin/bash\n# written by \`trantor duty up\` — safe to delete when the seat is down\n${exports}\
|
|
176
|
+
writeFileSync(LAUNCHER, `#!/bin/bash\n# written by \`trantor duty up\` — safe to delete when the seat is down\n${exports}\n${nodeResolverSnippet()}\nexec "$NODE_BIN" ${shquote(join(ROOT, "bin", "crew-runner.mjs"))} ${shquote(AGENT)} ${shquote(DIR)}\n`, { mode: 0o700 });
|
|
174
177
|
}
|
|
175
178
|
|
|
176
179
|
// The old headless start: a detached child of whoever ran `up`. No keepalive — it dies with a
|
package/bin/fitness.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { signedGet } from "../hooks/lib/api.mjs";
|
|
3
|
+
import { aggregateFitness, formatFitness } from "../lib/fitness.mjs";
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
const at = args.indexOf("--project");
|
|
7
|
+
const project = at >= 0 ? String(args[at + 1] || "") : "";
|
|
8
|
+
const query = `?limit=1000${project ? `&project=${encodeURIComponent(project)}` : ""}`;
|
|
9
|
+
const response = await signedGet(`/telemetry/attempts${query}`, { project: project || undefined, timeoutMs: 5000 });
|
|
10
|
+
if (!response.ok || !Array.isArray(response.json?.attempts)) {
|
|
11
|
+
console.error(`fitness unavailable: ${response.json?.error || response.reason || `hub ${response.status}`}`);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
const report = aggregateFitness(response.json.attempts);
|
|
15
|
+
console.log(args.includes("--json") ? JSON.stringify(report, null, 2) : formatFitness(report));
|
package/bin/herdr-agent.mjs
CHANGED
|
@@ -6,6 +6,8 @@ import { execFileSync } from "node:child_process";
|
|
|
6
6
|
import { homedir } from "node:os";
|
|
7
7
|
import { join, dirname } from "node:path";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { HERDR_SIGN_IDENTIFIER, ensureHerdrSigned } from "../lib/herdr-signing.mjs";
|
|
10
|
+
import { nodeResolverSnippet } from "../lib/launch-node.mjs";
|
|
9
11
|
|
|
10
12
|
const LABEL = "com.trantor.herdr";
|
|
11
13
|
const PLIST = join(homedir(), "Library", "LaunchAgents", `${LABEL}.plist`);
|
|
@@ -17,7 +19,7 @@ const D = "\x1b[2m", R = "\x1b[0m";
|
|
|
17
19
|
const shellQuote = value => `'${String(value).replaceAll("'", `'\\''`)}'`;
|
|
18
20
|
const xmlEscape = value => String(value).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
19
21
|
|
|
20
|
-
function herdrBin() {
|
|
22
|
+
export function herdrBin() {
|
|
21
23
|
// launchd runs with a minimal PATH, so the absolute path has to be baked in at install time.
|
|
22
24
|
for (const p of [join(homedir(), ".local/bin/herdr"), "/opt/homebrew/bin/herdr", "/usr/local/bin/herdr"]) {
|
|
23
25
|
if (existsSync(p)) return p;
|
|
@@ -29,12 +31,17 @@ function herdrBin() {
|
|
|
29
31
|
return "";
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
// #14646: node is resolved at EXEC time — `command -v node` against the PATH exported below,
|
|
35
|
+
// then the stable Homebrew/Intel symlinks. The old default pinned `process.execPath`, which under
|
|
36
|
+
// Homebrew is a versioned Cellar path that `brew upgrade node` deletes.
|
|
37
|
+
export function restoreScriptBody({ herdr = "herdr", cli = join(dirname(fileURLToPath(import.meta.url)), "cli.mjs"), log = RESTORE_LOG } = {}) {
|
|
33
38
|
return `#!/bin/bash
|
|
39
|
+
PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin\${PATH:+:\$PATH}"
|
|
40
|
+
export PATH
|
|
34
41
|
HERDR_BIN=\${TRANTOR_HERDR_BIN:-${shellQuote(herdr)}}
|
|
35
|
-
NODE_BIN=\${TRANTOR_NODE_BIN:-${shellQuote(node)}}
|
|
36
42
|
TRANTOR_CLI=\${TRANTOR_CLI_PATH:-${shellQuote(cli)}}
|
|
37
43
|
RESTORE_LOG=\${TRANTOR_RESTORE_LOG:-${shellQuote(log)}}
|
|
44
|
+
${nodeResolverSnippet({ override: "TRANTOR_NODE_BIN" })}
|
|
38
45
|
MARKER_DIR=\${TRANTOR_RESTORE_MARKER_DIR:-/tmp}
|
|
39
46
|
BOOT_KEY=\${TRANTOR_RESTORE_BOOT_KEY:-$(/usr/sbin/sysctl -n kern.boottime 2>/dev/null | sed -E 's/.*sec = ([0-9]+).*/\\1/')}
|
|
40
47
|
WAIT_SECONDS=\${TRANTOR_RESTORE_WAIT_SECONDS:-60}
|
|
@@ -109,6 +116,17 @@ if (cmd === "install") {
|
|
|
109
116
|
console.error("herdr is not installed — get it first: curl -fsSL https://herdr.dev/install.sh | sh");
|
|
110
117
|
process.exit(1);
|
|
111
118
|
}
|
|
119
|
+
// #14579: re-sign under a FIXED identifier so macOS TCC keeps matching the Screen Recording
|
|
120
|
+
// grant across herdr updates (ad-hoc identifiers change on every release; herdr self-updates
|
|
121
|
+
// outside Trantor, so the check is idempotent — already-signed is a no-op). Failure is non-fatal.
|
|
122
|
+
const resign = ensureHerdrSigned(bin);
|
|
123
|
+
if (resign.outcome === "resigned") {
|
|
124
|
+
console.log(`herdr re-signed as ${HERDR_SIGN_IDENTIFIER} with ${resign.identity} — Screen Recording survives herdr updates`);
|
|
125
|
+
} else if (resign.outcome === "already") {
|
|
126
|
+
console.log(`herdr is already signed as ${HERDR_SIGN_IDENTIFIER} — Screen Recording survives herdr updates`);
|
|
127
|
+
} else if (resign.outcome === "failed") {
|
|
128
|
+
console.error(`warning: herdr was NOT re-signed — ${resign.reason}`);
|
|
129
|
+
}
|
|
112
130
|
mkdirSync(dirname(PLIST), { recursive: true });
|
|
113
131
|
writeFileSync(RESTORE_SCRIPT, restoreScriptBody({ herdr: bin }));
|
|
114
132
|
chmodSync(RESTORE_SCRIPT, 0o755);
|
package/bin/models.mjs
CHANGED
|
@@ -5,7 +5,8 @@ import { dirname, join } from "node:path";
|
|
|
5
5
|
import { homedir } from "node:os";
|
|
6
6
|
import { existsSync, statSync } from "node:fs";
|
|
7
7
|
import { pathToFileURL, fileURLToPath } from "node:url";
|
|
8
|
-
import {
|
|
8
|
+
import { loadWorld } from "./advise.mjs";
|
|
9
|
+
import { discoverModels } from "../lib/discovery/index.mjs";
|
|
9
10
|
|
|
10
11
|
const H = homedir();
|
|
11
12
|
const C = { dim: "\x1b[2m", grn: "\x1b[32m", gold: "\x1b[38;5;208m", off: "\x1b[0m" };
|
|
@@ -16,11 +17,6 @@ const SCROOGE = (() => {
|
|
|
16
17
|
try { return execSync("command -v scrooge", { encoding: "utf8" }).trim(); } catch { return "scrooge"; }
|
|
17
18
|
})();
|
|
18
19
|
|
|
19
|
-
const liveModels = (providerOc) => {
|
|
20
|
-
try { return execSync(`opencode models ${providerOc} 2>/dev/null`, { encoding: "utf8" }).split("\n").filter(Boolean); }
|
|
21
|
-
catch { return []; }
|
|
22
|
-
};
|
|
23
|
-
|
|
24
20
|
function routePick(candList, diff) {
|
|
25
21
|
const result = spawnSync("python3", [SCROOGE, "route", "--candidates", candList.join(" "),
|
|
26
22
|
"-t", "code", "-d", diff, "--json"], { encoding: "utf8" });
|
|
@@ -28,41 +24,76 @@ function routePick(candList, diff) {
|
|
|
28
24
|
catch { return { error: "router unavailable", unpriced: [] }; }
|
|
29
25
|
}
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
const liveModels = (providerOc) => {
|
|
28
|
+
const result = spawnSync("opencode", ["models", providerOc], { encoding: "utf8" });
|
|
29
|
+
return result.status === 0 ? result.stdout.split("\n").filter(Boolean) : [];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function listAll({ roster, agents }, output) {
|
|
33
|
+
if (!has("opencode")) { output("opencode not on PATH — it's the adapter that serves crew models. Install it, then re-run."); return; }
|
|
34
|
+
output("CREW MODELS — opencode-driven seats (● available now)\n");
|
|
35
35
|
for (const [label, s] of Object.entries(roster)) {
|
|
36
36
|
if (s.cli !== "opencode") continue;
|
|
37
37
|
const n = liveModels(s.providerOc).length;
|
|
38
38
|
const dot = agents.includes(label) ? `${C.grn}●${C.off}` : `${C.dim}○${C.off}`;
|
|
39
|
-
|
|
39
|
+
output(` ${dot} ${label.padEnd(14)} ${C.dim}${s.providerOc}${C.off} ${n} live models ${C.dim}trantor models ${label}${C.off}`);
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
output(`\n${C.dim}detail + routing preview:${C.off} trantor models <provider>`);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function detail(name) {
|
|
45
|
-
const { roster } = loadWorld();
|
|
44
|
+
function detail(name, { roster }, output) {
|
|
46
45
|
const seat = roster[name] || Object.values(roster).find(s => s.providerOc === name);
|
|
47
46
|
const providerOc = seat?.providerOc || name;
|
|
48
47
|
const models = liveModels(providerOc);
|
|
49
|
-
if (!models.length) {
|
|
50
|
-
|
|
48
|
+
if (!models.length) { output(`No live models for '${providerOc}' (opencode offline / no key / unknown provider).`); return; }
|
|
49
|
+
output(`${C.gold}${providerOc}${C.off} — ${models.length} live models\n`);
|
|
51
50
|
const picks = Object.fromEntries(["easy", "medium", "hard"].map(d => [d, routePick(models, d)]));
|
|
52
51
|
const unpriced = new Set(Object.values(picks).flatMap(p => p.unpriced || []));
|
|
53
|
-
for (const m of models.slice(0, 60))
|
|
54
|
-
if (models.length > 60)
|
|
52
|
+
for (const m of models.slice(0, 60)) output(` ${m}${unpriced.has(m.split("/").at(-1)) ? " (unpriced)" : ""}`);
|
|
53
|
+
if (models.length > 60) output(` ${C.dim}… +${models.length - 60} more${C.off}`);
|
|
55
54
|
if (existsSync(SCROOGE) || has("scrooge")) {
|
|
56
|
-
|
|
57
|
-
for (const d of ["easy", "medium", "hard"])
|
|
55
|
+
output(`\n${C.gold}router picks (code task):${C.off}`);
|
|
56
|
+
for (const d of ["easy", "medium", "hard"]) output(` ${d.padEnd(7)} → ${picks[d].qualified || picks[d].error}`);
|
|
58
57
|
const caps = join(process.env.SCROOGE_HOME || join(H, ".token-scrooge"), "capabilities.json");
|
|
59
58
|
// only nag when the scores are missing or older than the weekly refresh allows for
|
|
60
59
|
const ageDays = existsSync(caps) ? (Date.now() - statSync(caps).mtimeMs) / 86400e3 : Infinity;
|
|
61
|
-
if (ageDays > 9)
|
|
60
|
+
if (ageDays > 9) output(`${C.dim}(scores ${ageDays === Infinity ? "missing" : `${Math.floor(ageDays)}d old`} — run scrooge-capabilities to (re)score the catalog for accurate difficulty routing)${C.off}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function formatModels(rows) {
|
|
65
|
+
return rows.map(row => {
|
|
66
|
+
const lines = row.models.map(model =>
|
|
67
|
+
` ${model.id ?? "?"} [${model.state}]\n source: ${model.source}\n checkedAt: ${model.checkedAt}\n ${model.reason}`);
|
|
68
|
+
return `${row.provider}\n${lines.join("\n")}`;
|
|
69
|
+
}).join("\n\n");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export async function runModels(args, options = {}) {
|
|
73
|
+
const flags = new Set(["--all", "--json", "--refresh", "--no-cache"]);
|
|
74
|
+
if (args.some(arg => arg.startsWith("-") && !flags.has(arg))) throw new Error("Usage: trantor models [provider | --all] [--json] [--refresh] [--no-cache]");
|
|
75
|
+
const names = args.filter(arg => !flags.has(arg));
|
|
76
|
+
if (names.length > 1 || (names.length && args.includes("--all"))) throw new Error("Choose one provider or --all");
|
|
77
|
+
const world = options.world ?? loadWorld();
|
|
78
|
+
const name = names[0]?.toLowerCase();
|
|
79
|
+
const output = options.output ?? console.log;
|
|
80
|
+
if (!args.includes("--all") && !args.includes("--json")) {
|
|
81
|
+
if (name) detail(name, world, output);
|
|
82
|
+
else listAll(world, output);
|
|
83
|
+
return;
|
|
62
84
|
}
|
|
85
|
+
const seat = name && (world.roster[name] || Object.values(world.roster).find(item => item.provider === name || item.providerOc === name));
|
|
86
|
+
const provider = seat?.providerOc || seat?.provider || name;
|
|
87
|
+
const roster = provider && !Object.values(world.roster).some(item => item.providerOc === provider || item.provider === provider)
|
|
88
|
+
? { ...world.roster, [provider]: { providerOc: provider } } : world.roster;
|
|
89
|
+
const rows = await discoverModels(roster, { ...options, refresh: args.includes("--refresh"),
|
|
90
|
+
cachePath: args.includes("--no-cache") ? false : options.cachePath });
|
|
91
|
+
const selected = provider ? rows.filter(row => row.provider === provider) : rows;
|
|
92
|
+
if (args.includes("--json")) { output(JSON.stringify(selected, null, 2)); return selected; }
|
|
93
|
+
output(formatModels(selected));
|
|
94
|
+
return selected;
|
|
63
95
|
}
|
|
64
96
|
|
|
65
97
|
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
66
|
-
|
|
67
|
-
if (!arg) listAll(); else detail(arg.toLowerCase());
|
|
98
|
+
runModels(process.argv.slice(2)).catch(error => { console.error(error.message); process.exitCode = 1; });
|
|
68
99
|
}
|
package/bin/wake-nudge.mjs
CHANGED
|
@@ -22,6 +22,7 @@ import { createConnection } from "node:net";
|
|
|
22
22
|
import { load } from "../lib/identity.mjs";
|
|
23
23
|
import { sfetchJson } from "../lib/signed-fetch.mjs";
|
|
24
24
|
import { busDir, hostId, readConfig } from "../lib/project.mjs";
|
|
25
|
+
import { stableNodeExec } from "../lib/launch-node.mjs";
|
|
25
26
|
import { ledgerPaths } from "../hooks/lib/inbox-ledger.mjs";
|
|
26
27
|
import { dutyEscalations, claimDutyNudges, auditDutyNudges, releaseDutyNudgeClaims } from "../lib/duty-nudges.mjs";
|
|
27
28
|
import { reserveNudgeIds, releaseNudgeIds } from "../lib/nudge-ledger.mjs";
|
|
@@ -255,12 +256,14 @@ export async function runDuty(args) {
|
|
|
255
256
|
}
|
|
256
257
|
|
|
257
258
|
const xml = value => String(value).replace(/[&<>"']/g, c => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]);
|
|
258
|
-
|
|
259
|
-
|
|
259
|
+
// #14646: node is resolved at EXEC time inside the bash -c body — the EnvironmentVariables PATH
|
|
260
|
+
// written below is what `command -v node` searches — never a pinned versioned Cellar path.
|
|
261
|
+
export function keepalivePlist({ bus, hub, home = homedir(), script = SELF, path = process.env.PATH }) {
|
|
262
|
+
const body = stableNodeExec(script, ["run", "--hub", hub]);
|
|
260
263
|
const env = { AGENT_BUS_DIR: bus, HOME: home, PATH: path };
|
|
261
264
|
return `<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0"><dict>
|
|
262
265
|
<key>Label</key><string>${LABEL}</string>
|
|
263
|
-
<key>ProgramArguments</key><array
|
|
266
|
+
<key>ProgramArguments</key><array><string>/bin/bash</string><string>-c</string><string>${xml(body)}</string></array>
|
|
264
267
|
<key>EnvironmentVariables</key><dict>${Object.entries(env).map(([key, value]) => `<key>${key}</key><string>${xml(value)}</string>`).join("")}</dict>
|
|
265
268
|
<key>RunAtLoad</key><true/><key>KeepAlive</key><true/>
|
|
266
269
|
<key>ThrottleInterval</key><integer>30</integer>
|
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<!-- trantor hub as an always-on launchd service. setup.sh fills the
|
|
3
|
+
<!-- trantor hub as an always-on launchd service. setup.sh fills __REPO__; the node binary is
|
|
4
|
+
resolved at exec time (command -v node with the PATH below, then the stable Homebrew/Intel
|
|
5
|
+
symlinks) so a `brew upgrade node` can never delete it out from under launchd. -->
|
|
4
6
|
<plist version="1.0">
|
|
5
7
|
<dict>
|
|
6
8
|
<key>Label</key><string>com.trantor.hub</string>
|
|
7
9
|
<key>ProgramArguments</key>
|
|
8
|
-
<array><string
|
|
10
|
+
<array><string>/bin/bash</string><string>-c</string><string>NODE_BIN="$(command -v node 2>/dev/null)"
|
|
11
|
+
case "$NODE_BIN" in
|
|
12
|
+
*/Cellar/*) NODE_BIN="" ;; # versioned Homebrew path: the next upgrade deletes it
|
|
13
|
+
esac
|
|
14
|
+
if [ -z "$NODE_BIN" ] || [ ! -x "$NODE_BIN" ]; then
|
|
15
|
+
NODE_BIN=""
|
|
16
|
+
for trantor_node in /opt/homebrew/bin/node /usr/local/bin/node; do
|
|
17
|
+
if [ -x "$trantor_node" ]; then NODE_BIN="$trantor_node"; break; fi
|
|
18
|
+
done
|
|
19
|
+
fi
|
|
20
|
+
exec "$NODE_BIN" '__REPO__/hub.mjs'</string></array>
|
|
9
21
|
<key>WorkingDirectory</key><string>__REPO__</string>
|
|
10
22
|
<key>EnvironmentVariables</key>
|
|
11
|
-
<dict><key>RELAY_HOST</key><string>127.0.0.1</string><key>RELAY_PORT</key><string>4477</string></dict>
|
|
23
|
+
<dict><key>RELAY_HOST</key><string>127.0.0.1</string><key>RELAY_PORT</key><string>4477</string><key>PATH</key><string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string></dict>
|
|
12
24
|
<key>RunAtLoad</key><true/>
|
|
13
25
|
<key>KeepAlive</key><true/>
|
|
14
26
|
<key>StandardOutPath</key><string>/tmp/trantor-hub.log</string>
|
package/deploy/node-path.sh
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# Sourced by setup.sh. Prints
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
2
|
+
# Sourced by setup.sh. Prints a node binary setup can rely on RIGHT NOW — the launchd plist
|
|
3
|
+
# resolves node at exec time, so nothing is baked into it. A Node manager path (nvm, fnm, volta)
|
|
4
|
+
# changes when the user switches versions and a Homebrew Cellar path dies on the next brew
|
|
5
|
+
# upgrade, so a system install wins. TRANTOR_NODE_CANDIDATES overrides the system locations.
|
|
6
6
|
pick_node() {
|
|
7
7
|
local cur c
|
|
8
8
|
cur="$(command -v node)"
|
|
9
9
|
for c in ${TRANTOR_NODE_CANDIDATES:-/opt/homebrew/bin/node /usr/local/bin/node}; do
|
|
10
10
|
if [ -x "$c" ]; then echo "$c"; return 0; fi
|
|
11
11
|
done
|
|
12
|
+
# #14646: a Homebrew Cellar path is versioned — `brew upgrade node` deletes it. Never bake one
|
|
13
|
+
# into anything; treat it as no node at all so the caller fails loudly instead of silently later.
|
|
14
|
+
case "$cur" in
|
|
15
|
+
*"/Cellar/"*)
|
|
16
|
+
echo "warning: node is at $cur, a versioned Homebrew Cellar path that the next brew upgrade deletes; install Node system-wide (brew install node)" >&2
|
|
17
|
+
return 0;;
|
|
18
|
+
esac
|
|
12
19
|
[ -n "$cur" ] && echo "$cur"
|
|
13
20
|
case "$cur" in
|
|
14
21
|
*"/.nvm/"*|*"/.fnm/"*|*"/fnm_multishells/"*|*"/.volta/"*|*"/.asdf/"*|*"/.local/share/mise/"*)
|
package/deploy/setup.sh
CHANGED
|
@@ -10,7 +10,9 @@ mkdir -p "$HOME/.agent-bus"
|
|
|
10
10
|
touch "$HOME/.agent-bus/.env" # one place for provider API keys (e.g. DEEPSEEK_API_KEY=…)
|
|
11
11
|
if [ "$(uname)" = "Darwin" ]; then
|
|
12
12
|
PL="$HOME/Library/LaunchAgents/com.trantor.hub.plist"
|
|
13
|
-
|
|
13
|
+
# #14646: no node path is baked in — the plist's bash -c resolves node at exec time, so a
|
|
14
|
+
# `brew upgrade node` cannot delete the binary out from under launchd.
|
|
15
|
+
sed -e "s|__REPO__|$REPO|" "$REPO/deploy/com.trantor.hub.plist" > "$PL"
|
|
14
16
|
launchctl bootout "gui/$(id -u)/com.trantor.hub" 2>/dev/null || true
|
|
15
17
|
# bootstrap can fail when the label is still loading or already loaded; retry once, then carry on
|
|
16
18
|
# (the rest of setup must not abort under set -e).
|
|
@@ -33,18 +35,9 @@ if [ -f "$REPO/engine/install.sh" ]; then
|
|
|
33
35
|
case ":$PATH:" in *":$HOME/.local/bin:"*) ;; *) echo " note: add ~/.local/bin to your PATH";; esac
|
|
34
36
|
fi
|
|
35
37
|
# Graft — local code-graph MCP tools every seat can call (token-saving retrieval; NanoNets, MIT).
|
|
36
|
-
# Installed here so connect (next) wires it into each CLI; the graph self-refreshes per query and
|
|
37
|
-
# a no-op where a project has no index
|
|
38
|
-
#
|
|
39
|
-
# We probe by BUILDING, not by `command -v graft`. A bin link proves nothing about whether graft can
|
|
40
|
-
# parse: it depends on ten tree-sitter native bindings, all wired as `"install": "node-gyp-build"`.
|
|
41
|
-
# npm v12 turns lifecycle scripts and implicit node-gyp builds OFF by default, and the prebuilds that
|
|
42
|
-
# save us do not cover every platform — tree-sitter core and tree-sitter-python ship no linux-arm64.
|
|
43
|
-
# There, the gyp fallback that used to compile them no longer runs, `graft` is still on PATH, and a
|
|
44
|
-
# presence check prints a green tick over a tool that throws on first use. So the probe indexes a
|
|
45
|
-
# one-file fixture (~0.2s) and requires the symbol back: exit 0 alone can mean "parsed nothing".
|
|
46
|
-
# Every failure path is explicitly `|| rc=1` rather than leaning on set -e being suspended inside an
|
|
47
|
-
# `if` condition: this must return a verdict, never abort setup.
|
|
38
|
+
# Installed here so connect (next) wires it into each CLI; the graph self-refreshes per query and
|
|
39
|
+
# is a no-op where a project has no index. Probed by BUILDING, not `command -v graft`: a bin link
|
|
40
|
+
# proves nothing about whether graft can parse (native bindings npm v12 no longer builds).
|
|
48
41
|
graft_works() {
|
|
49
42
|
rc=0
|
|
50
43
|
command -v graft >/dev/null 2>&1 || return 1
|
package/docs/BUILD-DOCTRINE.md
CHANGED
|
@@ -13,6 +13,11 @@ the real path four times.
|
|
|
13
13
|
app, the live hub, the real CLI on this machine) and written the result on the card.
|
|
14
14
|
- Unit tests are necessary and never sufficient. "All tests green" is not evidence that the
|
|
15
15
|
operator will see the feature work.
|
|
16
|
+
- A UI drill is a screenshot of the installed app, looked at by the orchestrator before the
|
|
17
|
+
operator is asked. DOM tests (happy-dom, jsdom) do no layout and cannot prove anything is
|
|
18
|
+
visible: 2.1.37 and 2.1.38 shipped an off-screen Start button with green tests (#14576). An
|
|
19
|
+
orchestrator that cannot take a screenshot fixes that first; it never hands the drill to the
|
|
20
|
+
operator instead.
|
|
16
21
|
- The seat that wrote the code never closes its own card to done. Testing is the seat's last
|
|
17
22
|
move; done is the orchestrator's, after the drill.
|
|
18
23
|
|
package/docs/FEATURES.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Feature registry
|
|
2
|
+
|
|
3
|
+
Long-standing features that must not go dark without anyone noticing. Each row names one read-only
|
|
4
|
+
probe. `trantor canary` runs every probe in this table and prints pass, fail or skip per feature;
|
|
5
|
+
the daily launchd job (`trantor canary install`) runs the same probes, records the run for
|
|
6
|
+
`trantor doctor`, and posts a failure to the trantor lane and the app once per episode: when a
|
|
7
|
+
feature first fails, not again while it stays failed, and again only after it has passed in between.
|
|
8
|
+
|
|
9
|
+
Rules for this file:
|
|
10
|
+
|
|
11
|
+
- One row per feature. The `id` column is the probe's name in `lib/canary/probes.mjs`; a row whose
|
|
12
|
+
id has no probe fails the canary, so the table and the code cannot drift apart.
|
|
13
|
+
- A probe only reads: files, `git log`, `herdr agent list` / `herdr pane read`, the hub's public
|
|
14
|
+
`/health`, the npm registry, GitHub releases and the app's read socket. It never writes, sends,
|
|
15
|
+
clicks, navigates, stages or commits.
|
|
16
|
+
- A probe says `skip` when the thing it reads is not on this machine (no app running, no idle
|
|
17
|
+
Claude pane, not macOS). A skip is never posted, and it neither opens nor closes an episode.
|
|
18
|
+
- When a card's files touch a feature below, that feature's probe joins the card's drill.
|
|
19
|
+
|
|
20
|
+
## Registry
|
|
21
|
+
|
|
22
|
+
| id | feature | what the probe reads | origin |
|
|
23
|
+
|---|---|---|---|
|
|
24
|
+
| `duty-turns` | The duty seat is alive and takes a turn at least once a day | `~/.agent-bus/duty.pid` names a live process, the runner's `*-trantor-duty.jsonl` turn log has a turn in the last 24h, and the hub's `/health` reports duty online | #14646 |
|
|
25
|
+
| `wake-nudge` | The wake-nudge daemon is installed and polling | `com.trantor.wake-nudge.plist` exists and `wake-nudge-cursor.json` was rewritten in the last 10 minutes (the daemon rewrites it every poll) | #7429 |
|
|
26
|
+
| `bus-delivery` | The bus delivers messages | the hub's `/health`: answers ok, persistence healthy, duty consuming with nothing stuck and no escalations queued | #5686 |
|
|
27
|
+
| `chat-working-state` | The chat working state follows herdr and the transcript | `herdr agent list` answers with a status on every agent, and the Claude agents' session ids resolve to transcripts under `~/.claude/projects` | #14644 |
|
|
28
|
+
| `cc-suggestion-pills` | The predicted-prompt pills can read Claude Code's suggestion | `herdr pane read --source visible --format ansi` on idle Claude panes still shows the `❯` + NBSP prompt line the pill parser anchors on | #11649 |
|
|
29
|
+
| `release-install` | The release install path works | the npm registry's `trantor@latest` has a version and a tarball, and the newest GitHub app release carries a `Trantor_*.dmg` | #14571 |
|
|
30
|
+
| `workspace-layouts` | The Workspace layouts render | the running app's read socket returns the main window's text, non-empty and without an error screen | #14618 |
|
|
31
|
+
| `file-actions-no-commit` | File actions in the operator's own checkout don't commit | each known project's main checkout HEAD reflog for the last 7 days has no `create … in the app` / `delete … in the app` / `rename … in the app` commit | #14639 |
|
|
32
|
+
| `launchers` | Every com.trantor.* launcher's program path exists | each `~/Library/LaunchAgents/com.trantor.*.plist`'s pinned paths exist and none is a versioned Homebrew Cellar path | #14646 |
|
package/hooks/sessionstart.mjs
CHANGED
|
@@ -29,7 +29,7 @@ function buildDoctrineShortForm() {
|
|
|
29
29
|
const doc = join(dirname(dirname(fileURLToPath(import.meta.url))), "docs", "BUILD-DOCTRINE.md");
|
|
30
30
|
return `<trantor-build-doctrine>\n` +
|
|
31
31
|
`📐 **Build doctrine** (rules with a gate each, not advice). Full text: ${doc}\n` +
|
|
32
|
-
`1. The real path is the gate — every card names its DRILL (what a person does on the built artifact and must see); nothing merges until you ran it and wrote the result on the card; unit tests are never sufficient; the seat that wrote the code never closes its own card to done (testing is the seat's last move, done is yours after the drill).\n` +
|
|
32
|
+
`1. The real path is the gate — every card names its DRILL (what a person does on the built artifact and must see); nothing merges until you ran it and wrote the result on the card; unit tests are never sufficient; a UI drill is a screenshot of the installed app you looked at yourself (DOM tests do no layout), and if you cannot take one you fix that, never hand the drill to the operator; the seat that wrote the code never closes its own card to done (testing is the seat's last move, done is yours after the drill).\n` +
|
|
33
33
|
`2. Red blocks merge — a red suite blocks merge; red for a day is an incident with a card; a flaky test is fixed or deleted within a week; no test inherits the runner's identity.\n` +
|
|
34
34
|
`3. One owner per subsystem — one named owner per wave who reviews every change; cross-seat edits go through the owner over the bus; you own the gates and merges, no seat merges to main.\n` +
|
|
35
35
|
`4. Causes, not symptoms — a fix names its cause in the commit and adds the drill that fails without it; a second fix in one seam within a week stops the line for a docs/CONTRACT-*.md; trace first, a bug becomes a card only with the mechanism in hand.\n` +
|
package/hub/auth.mjs
CHANGED
|
@@ -94,6 +94,7 @@ function cmpSemver(a, b) {
|
|
|
94
94
|
const AUTH_HEADERS = ["x-trantor-pubkey", "x-trantor-sig", "x-trantor-ts", "x-trantor-nonce"];
|
|
95
95
|
const PUBLIC_ENDPOINTS = new Set(["/", "/ui", "/health", "/enroll"]);
|
|
96
96
|
const OWNER_ENDPOINTS = new Set(["/project/delete", "/sweep", "/reconcile", "/invite", "/policy", "/session/prompts", "/session/prompt/claim", "/session/prompt/ack", "/session/attachment"]);
|
|
97
|
+
const APPROVER_ENDPOINTS = new Set(["/review/decision"]);
|
|
97
98
|
const DEVICE_ENDPOINTS = new Set(["/device/register", "/device/unregister", "/devices"]);
|
|
98
99
|
const READ_ENDPOINTS = new Set(["/peers", "/tasks", "/events", "/inbox", "/peer", "/card", "/stream", "/history", "/projects", "/catchup", "/phases", "/recent", "/handoffs", "/verify-gates", "/claims", "/proposals", "/grants", "/overseer/context", "/overseer/status", "/session/chat", "/session/prompt", "/crew/roster", "/machines/health"]);
|
|
99
100
|
const roleRank = { read: 1, write: 2, approver: 3, owner: 4 };
|
|
@@ -300,7 +301,8 @@ function authorize(auth, method, P, project) {
|
|
|
300
301
|
if (!auth?.identity) return { ok: false, code: 401, error: "signature required" };
|
|
301
302
|
// Device management is self-keyed, not project-scoped; the route enforces the signer boundary.
|
|
302
303
|
if (DEVICE_ENDPOINTS.has(P)) return { ok: true };
|
|
303
|
-
const need = OWNER_ENDPOINTS.has(P) ? "owner" :
|
|
304
|
+
const need = OWNER_ENDPOINTS.has(P) ? "owner" : APPROVER_ENDPOINTS.has(P) ? "approver"
|
|
305
|
+
: (method === "POST" ? "write" : (READ_ENDPOINTS.has(P) ? "read" : "read"));
|
|
304
306
|
if (isDutyIdentity(auth) && (need === "read" || P === "/send" || P === "/duty/failure")) return { ok: true };
|
|
305
307
|
return scopeAllows(auth.identity, project, need) ? { ok: true } : { ok: false, code: 403, error: "forbidden" };
|
|
306
308
|
}
|