trantor 0.18.140 → 0.18.143

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.
@@ -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.140"
9
+ "version": "0.18.143"
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.140",
16
+ "version": "0.18.143",
17
17
  "author": {
18
18
  "name": "Sasha Bogojevic"
19
19
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trantor",
3
- "version": "0.18.140",
3
+ "version": "0.18.143",
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,11 +441,21 @@ 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
+ - **herdr signing** — herdr ships ad-hoc signed, so each herdr update used to orphan its Screen
450
+ Recording toggle while it still showed on. `trantor herdr install` and `trantor open` re-sign an
451
+ ad-hoc herdr with your Developer ID under the fixed identifier `com.trantor.herdr`, so the grant
452
+ survives updates; `trantor doctor` reports the state and `--fix` re-signs.
453
+
444
454
  - **`trantor new <name>`** — project genesis in one command: makes the dir under your dev root
445
455
  (`TRANTOR_DEV_ROOT`, else the Projects folder chosen in the app's Settings, stored as
446
456
  `projectsRoot` in `~/.agent-bus/config.json`, else `~/development`), git on main (or `--from <git-url>`, or `--adopt` an
447
457
  existing folder), installs the auto-card hook, posts the brief to the hub, and opens the first
448
- card "genesis: <name>". `--json` for machines. It never spawns a session — firing the crew
458
+ card "genesis: <name>". It asks once whether the project's agents ask before acting (the default) or act without asking (bypass); without a terminal it refuses unless `--permissions ask|bypass` is given. Change it later with `trantor project permissions <name> ask|bypass`. `--json` for machines. It never spawns a session — firing the crew
449
459
  stays your call. Two paths in: **blank** (no brief) wakes the orchestrator plainly and you work
450
460
  with it iteratively; **from a brief** (`--brief <file>`, or a PRD dropped on the app's Genesis
451
461
  sheet) stores it in `docs/PRD.md` with a small CLAUDE.md pointer, and the wake runs
package/bin/app.mjs CHANGED
@@ -14,19 +14,27 @@ 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 { appScreenshot, parseScreenshotArgs } from "../lib/app-screenshot.mjs";
17
18
 
18
19
  const REPO = "sashabogi/trantor";
19
20
  const APP = "/Applications/Trantor.app";
20
21
  const ARCH_TAG = process.arch === "arm64" ? "aarch64" : "x64";
21
22
  const cmd = process.argv[2] || "status";
22
23
 
24
+ if (cmd === "screenshot") {
25
+ try { console.log((await appScreenshot(parseScreenshotArgs(process.argv.slice(3)))).path); }
26
+ catch (error) { console.error(`trantor app: ${error.message}`); process.exit(1); }
27
+ process.exit(0);
28
+ }
29
+
23
30
  if (process.platform !== "darwin") { console.error("trantor app: the desktop app is macOS-only for now"); process.exit(1); }
24
31
  if (!["status", "install", "update"].includes(cmd)) {
25
32
  console.error([
26
- "usage: trantor app [status|install|update]",
33
+ "usage: trantor app [status|install|update|screenshot]",
27
34
  " status installed version vs latest release (default)",
28
35
  " install download the latest release DMG and install to /Applications",
29
36
  " update same as install, then relaunch the app from a clean env",
37
+ " screenshot [--window main|popout] [--project name] [--out file.png]",
30
38
  ].join("\n"));
31
39
  process.exit(1);
32
40
  }
package/bin/cli.mjs CHANGED
@@ -83,6 +83,24 @@ switch (cmd) {
83
83
  run("hub.mjs"); break;
84
84
  }
85
85
  case "project": {
86
+ // #14563: the per-project permission mode — the same harness dial `trantor new` asks about
87
+ // and `trantor open` launches with. Words are the user's (ask|bypass), storage is the
88
+ // autonomy dial (prompt|bypass).
89
+ if (args[0] === "permissions") {
90
+ const { resolveAutonomy, setAutonomy } = await import(join(ROOT, "lib/autonomy.mjs"));
91
+ const project = args[1];
92
+ const value = args[2];
93
+ const describe = (harness) => (harness === "bypass" ? "act without asking" : "ask before acting");
94
+ if (!project) { console.error("usage: trantor project permissions <name> [ask|bypass]"); process.exit(1); }
95
+ if (value === undefined) {
96
+ console.log(`${project}: agents ${describe(resolveAutonomy(project).harness)}`);
97
+ break;
98
+ }
99
+ if (value !== "ask" && value !== "bypass") { console.error(`value must be ask or bypass (got "${value}")`); process.exit(1); }
100
+ setAutonomy(project, { harness: value === "bypass" ? "bypass" : "prompt" });
101
+ console.log(`${project}: agents ${describe(value)}`);
102
+ break;
103
+ }
86
104
  // The checkout's identity (#6724): show where this project's name comes from, or record an id
87
105
  // in .trantor/project.json so a directory rename cannot orphan the pin, board and sessions.
88
106
  const { resolveProjectInfo, resolveHubInfo, gitRoot, readProjectId, writeProjectId, isProjectId, PROJECT_MARKER } = await import(join(ROOT, "lib/project.mjs"));
@@ -260,7 +278,7 @@ switch (cmd) {
260
278
  console.log(`trantor — the hub-world for AI agent crews
261
279
 
262
280
  trantor setup one-shot install: hub as an always-on service + config + CLI wiring + doctor
263
- trantor doctor where do I stand? hub/plugin/CLIs/auth/keys/profile, with copy-paste fixes
281
+ 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)
264
282
  trantor sim drive the owned iOS Simulator through AXe: boot|install|launch|screen|tap|swipe|type|shutdown
265
283
  trantor connect (re)wire every installed AI CLI to the bus
266
284
  trantor profile declare your plans: trantor profile set claude=max codex=plus deepseek=api
@@ -283,7 +301,7 @@ switch (cmd) {
283
301
  trantor restore after a reboot, reopen only the orchestrators you opted in: restore [--dry-run] · restore enable|disable <project>
284
302
  trantor ui open the live dashboard (board + flow views)
285
303
  trantor pair pair a phone: mint a trantor://enroll link for the companion app — [--role owner] [--sim] [--json]
286
- trantor app the DESKTOP app: status | install | update — pulls the latest DMG from GitHub Releases
304
+ trantor app the DESKTOP app: status | install | update | screenshot — install releases or capture the app window
287
305
  trantor catchup "where are we?" — the continuous board + git, with a synthesized brief
288
306
  trantor agents what this session's sub-agents did (task · returned? · files written · survived on disk) — [<sessionId>] [--json]
289
307
  trantor gate go|nogo <id> decide a conflicting file edit
@@ -297,6 +315,7 @@ switch (cmd) {
297
315
  trantor handoff finish this session NOW: write a handoff, open a fresh session that takes over, and close this one (manual baton)
298
316
  trantor advise ask the Advisor directly (JSON on stdin; --demo to see it)
299
317
  trantor project this checkout's identity: project [<id>] — records .trantor/project.json so a directory rename cannot orphan the board, pin and sessions
318
+ project permissions <name> [ask|bypass] — whether <name>'s agents ask before acting or act without asking; no value prints it
300
319
  trantor hub run the hub in the foreground (setup installs it as a service instead)
301
320
  …or manage per-project hub pins: hub list · hub set <project> <url> · hub unset <project>
302
321
  seats: which project lives in which directory — seats · seats add · seats up · seats login install
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",
@@ -102,9 +104,11 @@ export function takeoverSessionId(ctx, id) {
102
104
  return hasPendingHandoff(ctx, id) ? randomUUID() : id;
103
105
  }
104
106
 
107
+ // #14563: bare `claude` inherits permissions.defaultMode from ~/.claude/settings.json, so a
108
+ // prompt project still ran bypass there — the dial must say its side out loud, both sides.
105
109
  function harnessFlag(ctx) {
106
110
  const result = call(process.execPath, [join(ctx.root, "bin/autonomy.mjs"), "get", "harness", "--project", ctx.project], { env: ctx.env });
107
- return result.stdout === "bypass" ? " --dangerously-skip-permissions" : "";
111
+ return result.stdout === "bypass" ? " --dangerously-skip-permissions" : " --permission-mode default";
108
112
  }
109
113
 
110
114
  function transcript(ctx, id) {
@@ -120,7 +124,8 @@ function orchestratorCommand(ctx, id) {
120
124
 
121
125
  function reportOrchestrator(ctx, pane, id) {
122
126
  const resumeArgv = ["env", ...STRIP.flatMap(name => ["-u", name]), `TRANTOR_ORCH=${ctx.project}`, "claude"];
123
- if (harnessFlag(ctx).trim()) resumeArgv.push("--dangerously-skip-permissions");
127
+ // #14563: the reported resume argv must be the SAME command the pane runs, dial included.
128
+ resumeArgv.push(...harnessFlag(ctx).trim().split(" "));
124
129
  resumeArgv.push("--resume", id);
125
130
  reportAgent(ctx, pane, "claude", { sessionId: id, resumeArgv });
126
131
  }
@@ -215,9 +220,8 @@ function hostPane(ctx, chosen, id) {
215
220
  }
216
221
 
217
222
  // #6888: index the project once for the desktop's direct graft CLI reads. Non-blocking — the pane
218
- // opens now, the ~7s build lands in the background; a no-op
219
- // if graft isn't installed or the index already exists (the graph self-refreshes per query after the
220
- // first build). Keeps the 20MB index out of the project's git.
223
+ // opens now, the ~7s build lands in the background; a no-op if graft isn't installed or the index
224
+ // already exists. Keeps the 20MB index out of the project's git.
221
225
  // Hide graft/ through .git/info/exclude, never the user's tracked .gitignore (#14322). Returns the file written, "" when not a git checkout.
222
226
  export function excludeGraftLocally(dir) {
223
227
  try {
@@ -255,6 +259,20 @@ export function maybeBuildGraft(dir) {
255
259
  } catch {}
256
260
  }
257
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
+
258
276
  export function openOrchestrator(ctx, args) {
259
277
  let parsed;
260
278
  try { parsed = parseArgs(args); }
@@ -264,6 +282,7 @@ export function openOrchestrator(ctx, args) {
264
282
  Object.assign(ctx, resolveOrchestratorDir(ctx, parsed.project));
265
283
  if (!ctx.dry) maybeBuildGraft(ctx.dir);
266
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 });
267
286
  let id = sessionId(ctx);
268
287
  const stale = supersededHandoff(ctx, id);
269
288
  if (stale) {
package/bin/doctor.mjs CHANGED
@@ -15,6 +15,8 @@ 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";
19
21
 
20
22
  const H = homedir();
@@ -32,6 +34,9 @@ const read = (p) => { try { return JSON.parse(readFileSync(p, "utf8")); } catch
32
34
  // detection (or parse this text), and the two would drift — the CLI would say a seat is wired while
33
35
  // the app said otherwise, with no way to tell which was right.
34
36
  const JSON_MODE = process.argv.includes("--json");
37
+ // --fix lets the doctor ACT on the one issue it can fix itself: re-signing herdr (#14579). Every
38
+ // other row stays read-only with its copy-paste fix, so the flag changes exactly one behaviour.
39
+ const FIX_MODE = process.argv.includes("--fix");
35
40
  const REPORT = { ok: [], issues: [], notes: [], sections: [] };
36
41
  let SECTION = "";
37
42
  const say = (line) => { if (!JSON_MODE) console.log(line); };
@@ -197,13 +202,33 @@ else {
197
202
 
198
203
  // herdr's own claude integration reports the session id at SessionStart; without it the desktop app
199
204
  // cannot tell which session a pane is running. Read-only probe, and an odd answer is "unknown".
200
- section("herdr (session identity)");
205
+ // The signing row below answers the OTHER herdr question: is the binary's code identity stable.
206
+ section("herdr");
201
207
  {
202
208
  const h = probeClaudeIntegration();
203
209
  if (h.state === "absent") note("herdr: skipped (not installed)");
204
210
  else if (h.state === "installed") ok(`herdr claude integration installed (${h.detail})`);
205
211
  else if (h.state === "unknown") note(`herdr claude integration: unknown (${h.detail})`);
206
212
  else warn(h.state === "outdated" ? `herdr claude integration is outdated (${h.detail})` : "herdr claude integration is not installed", HERDR_CLAUDE_INSTALL);
213
+ // #14579: Screen Recording follows the binary's code identity, and herdr's stock ad-hoc
214
+ // signature changes on every update — silently orphaning the TCC grant. Report-only unless
215
+ // --fix: the re-sign is the same idempotent ensureHerdrSigned the install path runs.
216
+ const s = probeHerdrSigning(herdrBin());
217
+ if (s.state === "developer-id") ok(`herdr is Developer-ID signed (${s.detail})`);
218
+ else if (s.state === "skipped") note("herdr signing: skipped (not macOS)");
219
+ else if (s.state === "unknown") note(`herdr signing: unknown (${s.detail})`);
220
+ else if (s.state === "absent") { /* the integration rows above already said herdr is absent */ }
221
+ else if (FIX_MODE) {
222
+ const fixed = ensureHerdrSigned(herdrBin());
223
+ if (fixed.outcome === "resigned") ok(`herdr re-signed as ${HERDR_SIGN_IDENTIFIER} with ${fixed.identity} — Screen Recording survives herdr updates`);
224
+ else if (fixed.outcome === "already") ok(`herdr is already signed as ${HERDR_SIGN_IDENTIFIER}`);
225
+ else if (fixed.outcome === "failed") warn(`herdr re-sign failed — ${fixed.reason}`, "trantor herdr install (re-runs the same re-sign)");
226
+ 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)");
227
+ }
228
+ else {
229
+ 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`,
230
+ "trantor doctor --fix (re-signs herdr with your Developer ID under com.trantor.herdr; or: trantor herdr install)");
231
+ }
207
232
  }
208
233
 
209
234
  // crew CLIs: installed / wired / authenticated
@@ -6,6 +6,7 @@ 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";
9
10
 
10
11
  const LABEL = "com.trantor.herdr";
11
12
  const PLIST = join(homedir(), "Library", "LaunchAgents", `${LABEL}.plist`);
@@ -17,7 +18,7 @@ const D = "\x1b[2m", R = "\x1b[0m";
17
18
  const shellQuote = value => `'${String(value).replaceAll("'", `'\\''`)}'`;
18
19
  const xmlEscape = value => String(value).replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
19
20
 
20
- function herdrBin() {
21
+ export function herdrBin() {
21
22
  // launchd runs with a minimal PATH, so the absolute path has to be baked in at install time.
22
23
  for (const p of [join(homedir(), ".local/bin/herdr"), "/opt/homebrew/bin/herdr", "/usr/local/bin/herdr"]) {
23
24
  if (existsSync(p)) return p;
@@ -109,6 +110,17 @@ if (cmd === "install") {
109
110
  console.error("herdr is not installed — get it first: curl -fsSL https://herdr.dev/install.sh | sh");
110
111
  process.exit(1);
111
112
  }
113
+ // #14579: re-sign under a FIXED identifier so macOS TCC keeps matching the Screen Recording
114
+ // grant across herdr updates (ad-hoc identifiers change on every release; herdr self-updates
115
+ // outside Trantor, so the check is idempotent — already-signed is a no-op). Failure is non-fatal.
116
+ const resign = ensureHerdrSigned(bin);
117
+ if (resign.outcome === "resigned") {
118
+ console.log(`herdr re-signed as ${HERDR_SIGN_IDENTIFIER} with ${resign.identity} — Screen Recording survives herdr updates`);
119
+ } else if (resign.outcome === "already") {
120
+ console.log(`herdr is already signed as ${HERDR_SIGN_IDENTIFIER} — Screen Recording survives herdr updates`);
121
+ } else if (resign.outcome === "failed") {
122
+ console.error(`warning: herdr was NOT re-signed — ${resign.reason}`);
123
+ }
112
124
  mkdirSync(dirname(PLIST), { recursive: true });
113
125
  writeFileSync(RESTORE_SCRIPT, restoreScriptBody({ herdr: bin }));
114
126
  chmodSync(RESTORE_SCRIPT, 0o755);
package/bin/new.mjs CHANGED
@@ -1,24 +1,14 @@
1
1
  #!/usr/bin/env node
2
- // trantor new — project genesis, the CLI half (#5862). One command stands a project up:
3
- //
4
- // trantor new <name> [--from <git-url>] [--brief <file>] [--dir <parent>] [--adopt] [--json]
5
- //
6
- // It makes the project directory at <parent>/<name> — --dir names the PARENT, never the project
7
- // directory itself (default parent: TRANTOR_DEV_ROOT or ~/development). The name is always
8
- // appended under it, so `--dir P` with name N creates P/N. Starts git on main (or clones --from,
9
- // or adopts an existing folder with --adopt), stores the brief in docs/PRD.md and seeds a small
10
- // CLAUDE.md pointer plus the trantor conventions block, installs the same auto-card hook as
11
- // `trantor init-hooks`, posts the brief as the hub project brief (POST /project — the same call
12
- // relay_project_brief makes), and opens the first card "genesis: <name>" on the new board.
13
- //
14
- // It NEVER spawns a session: the wake is genesis-2, the app half. A hub that is down downgrades
15
- // the genesis to a warning (card: null) — the directory is real either way, and a dead hub must
16
- // not make a made project look unmade.
2
+ // trantor new — project genesis, the CLI half (#5862): one command stands a project up:
3
+ // trantor new <name> [--from <git-url>] [--brief <file>] [--dir <parent>] [--adopt] [--permissions ask|bypass] [--json]
4
+ // It makes <parent>/<name>, starts git, seeds docs/PRD.md + CLAUDE.md + the auto-card hook, posts
5
+ // the brief + first card to the hub, and asks once whether the agents ask before acting (#14563).
17
6
  import { spawnSync } from "node:child_process";
18
7
  import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync, appendFileSync } from "node:fs";
19
8
  import { homedir } from "node:os";
20
9
  import { basename, dirname, isAbsolute, join, resolve } from "node:path";
21
10
  import { fileURLToPath } from "node:url";
11
+ import { createInterface } from "node:readline";
22
12
  import { ensureEnrolled as enrollTofu, loadIdentity, signedPost } from "../hooks/lib/api.mjs";
23
13
  import { ensureEnrolled as enrollViaOwnerInvite } from "../lib/enroll.mjs";
24
14
  import { setAutonomy } from "../lib/autonomy.mjs";
@@ -55,7 +45,7 @@ const flag = (n) => { const i = args.indexOf("--" + n); return i >= 0 ? args[i +
55
45
  const has = (n) => args.includes("--" + n);
56
46
  const json = has("json");
57
47
  const name = args.find(a => !a.startsWith("--"));
58
- if (!name) die("usage: trantor new <name> [--from <git-url>] [--brief <file>] [--dir <parent>] [--adopt] [--json] — project lands at <parent>/<name>");
48
+ if (!name) die("usage: trantor new <name> [--from <git-url>] [--brief <file>] [--dir <parent>] [--adopt] [--permissions ask|bypass] [--json] — project lands at <parent>/<name>");
59
49
  if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(name)) die(`invalid project name "${name}" — letters, digits, dot, dash, underscore`);
60
50
  const from = flag("from");
61
51
  const briefFile = flag("brief");
@@ -79,6 +69,35 @@ const existed = existsSync(dir);
79
69
  const occupied = existed && readdirSync(dir).length > 0;
80
70
  if (occupied && !adopt) die(`"${dir}" already exists and is not empty — pass --adopt to adopt it`);
81
71
  if (adopt && !existed) die(`--adopt: "${dir}" does not exist — nothing to adopt`);
72
+
73
+ // ── the permission mode (#14563): one plain question, answered before anything is created ────────
74
+ // User words are ask|bypass; the stored dial is the harness prompt|bypass. A non-TTY run must say
75
+ // the flag rather than guess — a refused genesis leaves no directory behind.
76
+ const permissionsArg = flag("permissions");
77
+ if (permissionsArg != null && permissionsArg !== "ask" && permissionsArg !== "bypass") {
78
+ die(`--permissions takes ask or bypass (got "${permissionsArg}")`);
79
+ }
80
+ let permissions;
81
+ if (permissionsArg != null) {
82
+ permissions = permissionsArg;
83
+ } else if (process.stdin.isTTY) {
84
+ const say = json ? console.error : console.log;
85
+ const rl = createInterface({ input: process.stdin, output: json ? process.stderr : process.stdout });
86
+ const choose = () => new Promise(res => rl.question("Choose [1]: ", res));
87
+ say(`How should ${name}'s agents work?`);
88
+ say(" 1) Ask before acting (recommended): they ask before commands, edits and installs");
89
+ say(" 2) Act without asking (bypass): they act on their own, as you");
90
+ let answer = (await choose()).trim();
91
+ while (answer !== "" && answer !== "1" && answer !== "2") {
92
+ say("1 = ask before acting · 2 = act without asking (bypass)");
93
+ answer = (await choose()).trim();
94
+ }
95
+ rl.close();
96
+ permissions = answer === "2" ? "bypass" : "ask";
97
+ } else {
98
+ die("no terminal to ask in; pass --permissions ask or --permissions bypass");
99
+ }
100
+
82
101
  if (!existed) mkdirSync(dir, { recursive: true });
83
102
 
84
103
  // ── git ─────────────────────────────────────────────────────────────────────────────────────────
@@ -119,9 +138,9 @@ if (existsSync(claude)) {
119
138
  const hook = spawnSync(process.execPath, [join(ROOT, "bin", "init-hooks.mjs")], { cwd: dir, encoding: "utf8" });
120
139
  if (hook.status !== 0) die(`hook install failed: ${(hook.stderr || "").trim()}`);
121
140
 
122
- // A new project is a new trust boundary. Pin its harness dial even when the machine-wide default
123
- // is bypass, so opening it can never inherit another project's permission choice.
124
- setAutonomy(name, { harness: "prompt" });
141
+ // A new project is a new trust boundary: its harness dial is the operator's explicit #14563
142
+ // answer, so opening it can never inherit another project's — or the machine default's — mode.
143
+ setAutonomy(name, { harness: permissions === "bypass" ? "bypass" : "prompt" });
125
144
 
126
145
  // ── the hub: pin + brief + first card, signed like every other client ──────────────────────────
127
146
  const hub = resolveHub(name);
@@ -134,12 +153,10 @@ const identity = loadIdentity(session);
134
153
  let card = null;
135
154
  let hubError = null;
136
155
  try {
137
- // The genesis identity is BRAND NEW — it cannot write to a project on an enforce hub until the
138
- // hub knows it. TOFU /enroll only works on a local loopback hub; a remote enforce hub refuses it
139
- // (403 "tofu enrollment refused") and the genesis silently records nothing (#6049). So enroll the
140
- // way crew seats do: the operator's owner key mints a project-scoped write invite and the genesis
141
- // identity spends it. Only when NO owner key is configured (a loopback hub with no owner identity)
142
- // do we fall back to the plain TOFU enroll.
156
+ // The genesis identity is BRAND NEW — TOFU /enroll only works on a loopback hub; a remote
157
+ // enforce hub refuses it (403) and the genesis silently records nothing (#6049). Enroll like
158
+ // crew seats: the owner key mints a project-scoped write invite, the genesis spends it; plain
159
+ // TOFU only when no owner key is configured (a loopback hub with no owner identity).
143
160
  const viaOwner = await enrollViaOwnerInvite(hub, identity, name, { timeoutMs: 8000, kind: "tool" });
144
161
  if (!viaOwner.ok && viaOwner.reason === "no-owner-key") await enrollTofu(session, identity, name, { kind: "tool" });
145
162
  else if (!viaOwner.ok) console.error(`genesis: enrollment via owner invite failed: ${viaOwner.reason}`);
@@ -169,8 +186,11 @@ try {
169
186
  // dir is the created project directory <parent>/<name>; parent is the --dir (or default) root the
170
187
  // name was appended under — the two together state the parent contract explicitly.
171
188
  if (json) {
172
- console.log(JSON.stringify({ name, parent: devRoot, dir, branch, hub, card }));
189
+ console.log(JSON.stringify({ name, parent: devRoot, dir, branch, hub, card, permissions }));
173
190
  } else {
191
+ // #14563: the artboard's confirmation — states the choice and the way to change it.
192
+ console.log(`✓ ${name} created · agents ${permissions === "bypass" ? "act without asking" : "ask before acting"} · change it with:`);
193
+ console.log(` trantor project permissions ${name} ask|bypass`);
174
194
  console.log(`✓ ${dir} (${branch}${from ? ", cloned" : adopt ? ", adopted" : ""})`);
175
195
  console.log(brief
176
196
  ? "✓ docs/PRD.md seeded from the brief; CLAUDE.md kept small"
@@ -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
 
@@ -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/kimi.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trantor",
3
- "version": "0.18.140",
3
+ "version": "0.18.143",
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). This manifest makes Kimi Code CLI a first-class ORCHESTRATOR, mirroring .claude-plugin/plugin.json. Hooks are the CANONICAL hooks/** executed through the kimi dialect bridge (kimi/bridge.mjs) — docs/KIMI-BRIDGE-CONTRACT.md.",
5
5
  "interface": {
6
6
  "displayName": "Trantor",
@@ -0,0 +1,44 @@
1
+ import { copyFile, readFile } from "node:fs/promises";
2
+ import { resolve } from "node:path";
3
+ import { createBrowserClient } from "./browser-client.mjs";
4
+
5
+ export function parseScreenshotArgs(argv) {
6
+ const options = {};
7
+ const flags = new Set(["--window", "--project", "--out"]);
8
+ for (let i = 0; i < argv.length; i += 2) {
9
+ const flag = argv[i], value = argv[i + 1];
10
+ if (!flags.has(flag) || !value || value.startsWith("--")) {
11
+ throw new Error("usage: trantor app screenshot [--window main|popout] [--project name] [--out file.png]");
12
+ }
13
+ const key = flag.slice(2);
14
+ if (options[key] !== undefined) throw new Error(`duplicate option: ${flag}`);
15
+ options[key] = value;
16
+ }
17
+ return options;
18
+ }
19
+
20
+ export async function appScreenshot({ window = "main", project = process.env.RELAY_PROJECT, out, ...clientOptions } = {}) {
21
+ if (!["main", "popout"].includes(window)) throw new Error("window must be main or popout");
22
+ if (window === "popout" && !project?.trim()) throw new Error("popout requires --project or RELAY_PROJECT");
23
+ const client = createBrowserClient({ ...clientOptions, project: window === "popout" ? project : "" });
24
+ const result = await client("app_screenshot", { window });
25
+ if (out) {
26
+ const destination = resolve(out);
27
+ if (destination !== resolve(result.path)) await copyFile(result.path, destination);
28
+ return { ...result, path: destination };
29
+ }
30
+ return result;
31
+ }
32
+
33
+ export async function appScreenshotTool(args) {
34
+ try {
35
+ const result = await appScreenshot(args);
36
+ const png = await readFile(result.path);
37
+ return { content: [
38
+ { type: "text", text: JSON.stringify(result) },
39
+ { type: "image", mimeType: "image/png", data: png.toString("base64") },
40
+ ] };
41
+ } catch (error) {
42
+ return { isError: true, content: [{ type: "text", text: error.message }] };
43
+ }
44
+ }
@@ -0,0 +1,108 @@
1
+ // herdr re-signing on macOS (#14579). herdr ships ad-hoc signed with a hash-derived identifier,
2
+ // so every update mints a new code identity and TCC stops matching the Screen Recording grant
3
+ // ("Failed to match existing code requirement ... returning denied") while the toggle still shows
4
+ // ON. A Developer-ID signature under the FIXED identifier com.trantor.herdr pins it.
5
+ import { copyFileSync, existsSync, renameSync, unlinkSync } from "node:fs";
6
+ import { spawnSync } from "node:child_process";
7
+ import { dirname, join } from "node:path";
8
+
9
+ export const HERDR_SIGN_IDENTIFIER = "com.trantor.herdr";
10
+
11
+ // Codesigning tools resolve from PATH, never absolute paths, so tests drive them with stubs.
12
+ const run = (command, args) => {
13
+ const result = spawnSync(command, args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
14
+ return {
15
+ ok: !result.error && result.status === 0,
16
+ status: result.status ?? 1,
17
+ stdout: String(result.stdout || ""),
18
+ stderr: String(result.stderr || ""),
19
+ error: result.error ? String(result.error.message || result.error) : "",
20
+ };
21
+ };
22
+
23
+ const firstLine = (text) => String(text || "").split("\n").map((l) => l.trim()).find(Boolean) || "";
24
+
25
+ /** First "Developer ID Application" identity from `security find-identity -v -p codesigning`.
26
+ * Installer identities are refused — they sign pkgs, not runnable apps. null = none listed. */
27
+ export function developerIdIdentity({ security = "security", execute = run } = {}) {
28
+ const listed = execute(security, ["find-identity", "-v", "-p", "codesigning"]);
29
+ if (listed.error || listed.status !== 0) {
30
+ return { error: `security find-identity -p codesigning failed: ${firstLine(listed.stderr) || firstLine(listed.stdout) || listed.error || `exit ${listed.status}`}` };
31
+ }
32
+ const line = listed.stdout.split("\n").map((l) => l.trim()).find((l) => l.includes("\"Developer ID Application:"));
33
+ const sha1 = line ? (/[0-9A-Fa-f]{40}/.exec(line)?.[0] || "") : "";
34
+ const label = line ? (/\"Developer ID Application:[^\"]+\"/.exec(line)?.[0] || "").slice(1, -1) : "";
35
+ return sha1 ? { sha1, label: label || "Developer ID Application" } : null;
36
+ }
37
+
38
+ /** Re-sign herdr so TCC grants (Screen Recording) survive herdr updates: sign a COPY in the same
39
+ * directory, verify it, smoke-test --version, then atomically rename it over the live binary —
40
+ * never codesign the live file in place. No hardened runtime. macOS only (skipped elsewhere);
41
+ * any failure leaves the original untouched and names the cause in `reason`. */
42
+ export function resignHerdrBinary(bin, { platform = process.platform, security = "security", codesign = "codesign", execute = run, tempFile = "" } = {}) {
43
+ if (platform !== "darwin") return { outcome: "skipped", reason: "not macOS" };
44
+ const identity = developerIdIdentity({ security, execute });
45
+ if (identity?.error) return { outcome: "failed", reason: identity.error };
46
+ if (!identity) return { outcome: "failed", reason: "no Developer ID Application identity in the keychain — herdr stays ad-hoc signed, so Screen Recording breaks on the next herdr update" };
47
+ const tmp = tempFile || join(dirname(bin), `.herdr-resign-${process.pid}`);
48
+ try {
49
+ copyFileSync(bin, tmp);
50
+ const signed = execute(codesign, ["--force", "--sign", identity.sha1, "--identifier", HERDR_SIGN_IDENTIFIER, "--timestamp", tmp]);
51
+ if (!signed.ok) throw new Error(`codesign failed: ${firstLine(signed.stderr) || signed.error || `exit ${signed.status}`}`);
52
+ const verified = execute(codesign, ["--verify", "--strict", tmp]);
53
+ if (!verified.ok) throw new Error(`codesign --verify --strict failed: ${firstLine(verified.stderr) || verified.error || `exit ${verified.status}`}`);
54
+ const smoke = execute(tmp, ["--version"]);
55
+ if (!smoke.ok) throw new Error(`signed copy failed its --version smoke test: ${firstLine(smoke.stderr) || firstLine(smoke.stdout) || smoke.error || `exit ${smoke.status}`}`);
56
+ renameSync(tmp, bin);
57
+ } catch (failure) {
58
+ try { if (existsSync(tmp)) unlinkSync(tmp); } catch { /* best-effort removal of the copy */ }
59
+ return { outcome: "failed", reason: `${failure?.message || failure} — the original binary is untouched` };
60
+ }
61
+ return { outcome: "resigned", identity: identity.label, sha1: identity.sha1 };
62
+ }
63
+
64
+ /** Decide from `codesign -dvv <herdr>` output (pure): a Developer-ID signature carries
65
+ * Authority=Developer ID Application:...; herdr's stock one is ad-hoc (Signature=adhoc,
66
+ * hash-derived Identifier); an unsigned object makes codesign exit non-zero outright. */
67
+ export function herdrSigningState({ ran, status = 1, out = "", error = "" } = {}) {
68
+ if (!ran) return { state: "unknown", detail: error || "codesign did not run" };
69
+ const lines = String(out).split("\n").map((l) => l.trim());
70
+ const authority = lines.find((l) => l.startsWith("Authority=Developer ID Application:"));
71
+ if (authority) return { state: "developer-id", detail: authority.slice("Authority=".length) };
72
+ if (status !== 0) return { state: "unsigned", detail: lines.find(Boolean) || `codesign -dvv exited ${status}` };
73
+ const identifier = (lines.find((l) => l.startsWith("Identifier=")) || "").slice("Identifier=".length) || "unknown identifier";
74
+ if (lines.some((l) => l.startsWith("Signature=adhoc"))) return { state: "adhoc", detail: identifier };
75
+ return { state: "unknown", detail: `no Developer ID authority and no ad-hoc mark (${identifier})` };
76
+ }
77
+
78
+ /** Read-only probe for `trantor doctor`: is the herdr binary Developer-ID signed? */
79
+ export function probeHerdrSigning(bin, { platform = process.platform, codesign = "codesign", execute = run } = {}) {
80
+ if (platform !== "darwin") return { state: "skipped", detail: "not macOS" };
81
+ if (!bin) return { state: "absent", detail: "herdr is not installed" };
82
+ const inspected = execute(codesign, ["-dvv", bin]);
83
+ return herdrSigningState({ ran: !inspected.error, status: inspected.status, out: `${inspected.stdout}\n${inspected.stderr}`, error: inspected.error });
84
+ }
85
+
86
+ // Value of the first `Key=` line in codesign -dvv output, "" when absent.
87
+ const lineValue = (out, key) => {
88
+ const line = String(out).split("\n").map((l) => l.trim()).find((l) => l.startsWith(key));
89
+ return line ? line.slice(key.length) : "";
90
+ };
91
+
92
+ /** Idempotent entry point for every Trantor touchpoint (#14579): herdr self-updates outside
93
+ * Trantor, so each one re-checks before it re-signs — one cheap `codesign -dvv` read of the
94
+ * LIVE binary, nothing to do when the fixed identifier is there with a TeamIdentifier.
95
+ * `onlyAdhoc` (the open mode) re-signs ONLY ad-hoc binaries and leaves other states alone. */
96
+ export function ensureHerdrSigned(bin, { platform = process.platform, security = "security", codesign = "codesign", execute = run, tempFile = "", onlyAdhoc = false } = {}) {
97
+ if (platform !== "darwin") return { outcome: "skipped", reason: "not macOS" };
98
+ if (!bin) return { outcome: "absent", reason: "herdr is not installed" };
99
+ const inspected = execute(codesign, ["-dvv", bin]);
100
+ const out = `${inspected.stdout}\n${inspected.stderr}`;
101
+ const state = herdrSigningState({ ran: !inspected.error, status: inspected.status, out, error: inspected.error });
102
+ if (lineValue(out, "Identifier=") === HERDR_SIGN_IDENTIFIER && lineValue(out, "TeamIdentifier=")) {
103
+ return { outcome: "already", state: state.state, detail: `Identifier=${HERDR_SIGN_IDENTIFIER}, TeamIdentifier=${lineValue(out, "TeamIdentifier=")}` };
104
+ }
105
+ if (onlyAdhoc && state.state !== "adhoc") return { outcome: "untouched", state: state.state, detail: state.detail };
106
+ const resigned = resignHerdrBinary(bin, { platform, security, codesign, execute, tempFile });
107
+ return { ...resigned, was: state.state };
108
+ }
package/mcp.mjs CHANGED
@@ -18,6 +18,7 @@ import { assertNoSecrets } from "./lib/scrub.mjs";
18
18
  import { isMessageCardTitle, OPEN_CARD_STATUSES, ownCardForInstance, contractedCardIds, hasContractText } from "./lib/turn-policy.mjs";
19
19
  import { markDoing, hollowVerdict, blastRadius, blastLine } from "./hooks/lib/hollow-move.mjs";
20
20
  import { createBrowserClient, BrowserError } from "./lib/browser-client.mjs";
21
+ import { appScreenshotTool } from "./lib/app-screenshot.mjs";
21
22
  import { readFile } from "node:fs/promises";
22
23
 
23
24
  import { dep } from "./lib/dep.mjs";
@@ -154,6 +155,9 @@ server.tool("browser_scroll", "Scroll the page vertically by dy pixels.",
154
155
  server.tool("browser_screenshot", "Capture a PNG of the page or element ref; returns the image and its saved path.",
155
156
  { ...browserPage, ref: z.string().min(1).optional() },
156
157
  ({ ref, ...args }, extra) => browserCall("screenshot", { ...args, element: ref }, extra));
158
+ server.tool("app_screenshot", "Capture the desktop app's main window or a project's pop-out as a PNG. No Screen Recording permission needed.",
159
+ { window: z.enum(["main", "popout"]).optional(), project: z.string().min(1).optional() },
160
+ args => appScreenshotTool(args));
157
161
  server.tool("browser_resize", "Emulate a device or set width and height in pixels. Omit both to reset.",
158
162
  { ...browserPage, device: z.enum(["iPhone 15", "iPhone SE", "Pixel 8", "iPad", "Laptop", "Desktop"]).optional(),
159
163
  w: z.number().positive().optional(), h: z.number().positive().optional() },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trantor",
3
- "version": "0.18.140",
3
+ "version": "0.18.143",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "trantor": "bin/cli.mjs"
@@ -32,7 +32,7 @@ PRD.md + TDD.md. The TDD MUST define one file-set per agent (no merge conflicts)
32
32
  explicit EVENT/INTERFACE CONTRACT — cross-agent bugs come from contract drift.
33
33
 
34
34
  ## Phase 1 — board setup
35
- 0. No project yet? `trantor new <name> --brief <file>` stands one up (dir, git main, CLAUDE.md
35
+ 0. No project yet? `trantor new <name> --brief <file> --permissions ask` stands one up (`--permissions` is required without a terminal: `ask` unless the operator said bypass) (dir, git main, CLAUDE.md
36
36
  from the brief, hooks, hub brief + first card) — it never spawns a session; firing the crew
37
37
  is this phase's job.
38
38
  1. `relay_project_brief("<what + why + goal>")`