trantor 0.18.141 → 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.141"
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.141",
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.141",
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,6 +441,16 @@ 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
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
@@ -278,7 +278,7 @@ switch (cmd) {
278
278
  console.log(`trantor — the hub-world for AI agent crews
279
279
 
280
280
  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
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)
282
282
  trantor sim drive the owned iOS Simulator through AXe: boot|install|launch|screen|tap|swipe|type|shutdown
283
283
  trantor connect (re)wire every installed AI CLI to the bus
284
284
  trantor profile declare your plans: trantor profile set claude=max codex=plus deepseek=api
@@ -301,7 +301,7 @@ switch (cmd) {
301
301
  trantor restore after a reboot, reopen only the orchestrators you opted in: restore [--dry-run] · restore enable|disable <project>
302
302
  trantor ui open the live dashboard (board + flow views)
303
303
  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
304
+ trantor app the DESKTOP app: status | install | update | screenshot — install releases or capture the app window
305
305
  trantor catchup "where are we?" — the continuous board + git, with a synthesized brief
306
306
  trantor agents what this session's sub-agents did (task · returned? · files written · survived on disk) — [<sessionId>] [--json]
307
307
  trantor gate go|nogo <id> decide a conflicting file edit
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) {
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);
@@ -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.141",
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.141",
3
+ "version": "0.18.143",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "trantor": "bin/cli.mjs"