toolroll 0.9.116 → 0.9.118

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +43 -26
  3. package/dist/acp-agents.js +14 -1
  4. package/dist/acp-client.js +19 -1
  5. package/dist/agent-change-check.js +60 -0
  6. package/dist/agent-change-schema.js +19 -0
  7. package/dist/agent-detect.js +11 -1
  8. package/dist/agent-fence.js +93 -16
  9. package/dist/agent-network-request.js +108 -0
  10. package/dist/agent-requests.js +105 -0
  11. package/dist/approval-summary.js +3 -3
  12. package/dist/backup.js +17 -1
  13. package/dist/batch-checks.js +81 -18
  14. package/dist/browser/terminal.js +41 -41
  15. package/dist/browser/workspace.css +2 -2
  16. package/dist/browser/workspace.js +36 -36
  17. package/dist/builder.js +12 -2
  18. package/dist/candidate-materialize.js +119 -0
  19. package/dist/central-enrollment-contract.js +156 -0
  20. package/dist/central-recovery-stage.js +329 -0
  21. package/dist/chat-actions.js +101 -2
  22. package/dist/chat-channel.js +40 -0
  23. package/dist/check-only-standing.js +13 -0
  24. package/dist/check-only.js +25 -13
  25. package/dist/check-recovery-hold.js +199 -0
  26. package/dist/check-recovery-index-schema.js +3 -0
  27. package/dist/check-screenshots.js +83 -0
  28. package/dist/cli.js +125 -6
  29. package/dist/codex-limits.js +4 -0
  30. package/dist/coding-context.js +16 -2
  31. package/dist/coding-provider.js +7 -3
  32. package/dist/coding-workspace.js +5 -5
  33. package/dist/connect-cli.js +257 -11
  34. package/dist/contracts/chat-actions.js +4 -0
  35. package/dist/contracts/console-api.js +14 -3
  36. package/dist/contracts/engine-api.js +331 -2
  37. package/dist/contracts/lead-tools.js +56 -2
  38. package/dist/contracts/provider.js +1 -1
  39. package/dist/contracts/route.js +1 -1
  40. package/dist/contracts/terminal-connection.js +50 -0
  41. package/dist/converse.js +80 -4
  42. package/dist/device-pair.js +280 -0
  43. package/dist/direct-chat-artifacts.js +347 -0
  44. package/dist/direct-chat-catalog.js +311 -0
  45. package/dist/direct-chat-fence.js +96 -0
  46. package/dist/direct-chat-git.js +343 -0
  47. package/dist/direct-chat-laptop.js +19 -0
  48. package/dist/direct-chat-schema.js +181 -0
  49. package/dist/direct-chat-ship.js +861 -0
  50. package/dist/direct-chat-workspace.js +389 -0
  51. package/dist/direct-chat.js +2107 -0
  52. package/dist/doctor.js +1 -1
  53. package/dist/easy-start.js +18 -0
  54. package/dist/egress.js +25 -4
  55. package/dist/engine-chat.js +454 -0
  56. package/dist/engine-reads.js +141 -13
  57. package/dist/exec.js +4 -3
  58. package/dist/flexible-agents.js +8 -16
  59. package/dist/flexible-session.js +91 -47
  60. package/dist/flexible-ship.js +87 -7
  61. package/dist/flexible-start.js +4 -1
  62. package/dist/flexible-thread.js +2 -3
  63. package/dist/flexible-turns.js +26 -5
  64. package/dist/flow-triggers.js +13 -4
  65. package/dist/flows-ui.js +54 -20
  66. package/dist/handoff-cli.js +630 -0
  67. package/dist/invoke.js +71 -17
  68. package/dist/lead-contract.js +5 -4
  69. package/dist/lead-doors.js +80 -1
  70. package/dist/lead-progress.js +9 -0
  71. package/dist/lead-tools.js +681 -10
  72. package/dist/lead.js +37 -9
  73. package/dist/live-bus.js +11 -0
  74. package/dist/live-terminal.js +132 -12
  75. package/dist/local-handoff.js +363 -0
  76. package/dist/local-owner-acts.js +264 -2
  77. package/dist/local-owner.js +16 -1
  78. package/dist/multiplayer-handoff.js +528 -0
  79. package/dist/multiplayer-presence.js +471 -0
  80. package/dist/names.js +17 -4
  81. package/dist/needs-you.js +10 -0
  82. package/dist/operate.js +280 -19
  83. package/dist/planner.js +6 -1
  84. package/dist/policy.js +2 -2
  85. package/dist/project-delete-ui.js +18 -11
  86. package/dist/project-delete.js +65 -4
  87. package/dist/project-skills.js +28 -13
  88. package/dist/project-tools.js +1 -1
  89. package/dist/prompt.js +1 -1
  90. package/dist/provider-connection.js +2 -0
  91. package/dist/provider-home.js +251 -8
  92. package/dist/provider.js +3 -2
  93. package/dist/publish.js +119 -64
  94. package/dist/pull-request-flow.js +35 -14
  95. package/dist/read-executor-worker.js +1 -1
  96. package/dist/read-executor.js +95 -1
  97. package/dist/restore-retirement.js +152 -0
  98. package/dist/result-follow-ups.js +116 -37
  99. package/dist/route-change.js +44 -4
  100. package/dist/scope.js +62 -5
  101. package/dist/scout.js +6 -2
  102. package/dist/serve.js +49 -5
  103. package/dist/server/chat.js +94 -13
  104. package/dist/server/direct-chat.js +583 -0
  105. package/dist/server/engine-api.js +219 -21
  106. package/dist/server/flows.js +43 -10
  107. package/dist/server/found-repos.js +25 -0
  108. package/dist/server/guards.js +20 -6
  109. package/dist/server/live.js +81 -23
  110. package/dist/server/pages.js +67 -13
  111. package/dist/server/people-tokens.js +47 -6
  112. package/dist/server/remote.js +29 -0
  113. package/dist/server/render-results.js +6 -2
  114. package/dist/server/render-settings.js +4 -2
  115. package/dist/server/render-tasks.js +18 -17
  116. package/dist/server/route-table.js +69 -2
  117. package/dist/server/settings.js +22 -7
  118. package/dist/server/task-views.js +15 -3
  119. package/dist/server/tasks.js +39 -2
  120. package/dist/server/terminals.js +185 -11
  121. package/dist/settings-proofs.js +1 -1
  122. package/dist/skills-manifest.js +57 -0
  123. package/dist/store.js +499 -56
  124. package/dist/subscription-chat.js +33 -6
  125. package/dist/subscription-usage.js +233 -0
  126. package/dist/task-live.js +2 -1
  127. package/dist/teardown-git.js +34 -4
  128. package/dist/terminal-connection.js +159 -0
  129. package/dist/tui/darwin-arm64/toolroll-tui +0 -0
  130. package/dist/tui/darwin-x64/toolroll-tui +0 -0
  131. package/dist/tui/linux-arm64/toolroll-tui +0 -0
  132. package/dist/tui/linux-x64/toolroll-tui +0 -0
  133. package/dist/tui-contract.js +1 -1
  134. package/dist/tui-launch.js +32 -1
  135. package/dist/workspace-identity-schema.js +21 -0
  136. package/package.json +4 -2
package/CHANGELOG.md CHANGED
@@ -4,6 +4,52 @@ Each release opens with one line on its theme, then **New**, **Changed**, **Fixe
4
4
  the ones it has). Each item is at most two lines and says where to find it. Notes for maintainers (CI, the release
5
5
  tooling) go on the GitHub release, not here. Entries before 0.9.104 use the older format.
6
6
 
7
+ ## 0.9.118 — 2026-11-25
8
+
9
+ Agents can read the project skills they are told about.
10
+
11
+ ### Fixed
12
+
13
+ - **Project skills reach the agent.** Planner, builder, scout and coding-terminal agents were told about a project's
14
+ skills but couldn't open them inside their sandbox. Each now gets exactly its own skill files, read-only, checked
15
+ against what Toolroll prepared; a file changed in between stops the launch instead of opening anything else.
16
+
17
+ ## 0.9.117 — 2026-11-25
18
+
19
+ Interactive agent threads keep working reply after reply, Direct Chat arrives, and agents get tighter fences.
20
+
21
+ ### New
22
+
23
+ - **Direct Chat:** chat with Claude, Codex or Gemini in an isolated copy of your project, see each turn's diff, and
24
+ Ship what you reviewed. It runs inside the same sandbox and network rules as a build.
25
+ - **The Toolroll Mac app (preview), built from source:** `cd mac && ./build-app.sh`. It finds or starts your local
26
+ Toolroll, and approvals use Touch ID or your password.
27
+
28
+ ### Changed
29
+
30
+ - **Ship says what it needs before you press anything,** and commits exactly the files you previewed: a file
31
+ changed after the preview, even made executable, stops the Ship.
32
+ - **Changing a task's model keeps your approval only when the project's tools are unchanged;** otherwise it asks again.
33
+ - **An agent's network request shows exactly what it would change** and applies only that, to your settings as they
34
+ are when you approve.
35
+ - **Esc leaves the Diff tab,** and accepting or sending back a result takes you out of it.
36
+
37
+ ### Fixed
38
+
39
+ - **Replying to a thread works every time.** A reply after a finished turn no longer stops its own new agent.
40
+ - **Typed text no longer runs as workbench keys,** a reply sent twice runs once, and turning threads off stops only
41
+ the agents that were running.
42
+ - **Codex builds keep their own conversation history,** never another task's or yours.
43
+ - **Codex and OpenRouter builds follow your project's network settings on a Mac,** including **Allow this Mac's
44
+ local services**.
45
+ - **Restoring a backup retires its chat-app connections and pairing codes;** pair your chat apps again after.
46
+
47
+ ### Action needed
48
+
49
+ - **Codex:** if a build says its sign-in expired, run `codex login` once.
50
+ - **Direct Chat** uses each agent's own sign-in (`claude`, `codex`), not API keys set on the Toolroll server.
51
+
52
+
7
53
  ## 0.9.116 — 2026-11-19
8
54
 
9
55
  Clearer recovery for threads and AI teammates, with consistent light and dark colours.
package/README.md CHANGED
@@ -7,15 +7,15 @@
7
7
 
8
8
  ### Your agents build. You decide.
9
9
 
10
- **Delegate a change. Review the diff here.**
10
+ **Delegate changes. Review verified diffs. Ship in one keystroke — in the native macOS app or your terminal.**
11
11
 
12
12
  <picture>
13
13
  <source media="(prefers-color-scheme: light)" srcset="docs/media/terminal-workbench-light.png">
14
- <img src="docs/media/terminal-workbench.png" alt="The Toolroll terminal workbench: the work list with two tasks that need you, and the Live tab following a running build" width="900">
14
+ <img src="docs/media/terminal-workbench.png" alt="Toolroll: native macOS app and terminal workbench with tasks that need you and live streaming output" width="900">
15
15
  </picture>
16
- <sub>The terminal workbench, shown with sample tasks and output.</sub>
16
+ <sub>Native SwiftUI macOS app and keyboard-driven terminal workbench, zero Electron, zero telemetry.</sub>
17
17
 
18
- For Claude Code, Codex and Gemini, on your own machine.
18
+ For Claude Code, Codex, and Gemini — using the subscriptions already on your machine.
19
19
 
20
20
  [![npm](https://img.shields.io/npm/v/toolroll?color=171717)](https://www.npmjs.com/package/toolroll)
21
21
  [![CI](https://github.com/ap9000/toolroll/actions/workflows/ci.yml/badge.svg)](https://github.com/ap9000/toolroll/actions/workflows/ci.yml)
@@ -29,37 +29,54 @@ For Claude Code, Codex and Gemini, on your own machine.
29
29
 
30
30
  ## Quick start
31
31
 
32
- macOS or Linux, Node.js 22.20+, git 2.41+, and Claude Code (`claude`) or
33
- Codex (`codex`) signed in on this computer. On Linux, also the sandbox tools:
34
- `sudo apt update && sudo apt install bubblewrap socat ripgrep`.
32
+ ### Native macOS app (recommended on Mac)
33
+
34
+ Install the native SwiftUI macOS app and local CLI together via Homebrew Cask (macOS 14 Sonoma+, Apple Silicon & Intel):
35
+
36
+ ```sh
37
+ brew install --cask ap9000/toolroll/toolroll
38
+ ```
39
+
40
+ Or download the signed, notarized `Toolroll-<version>-macos.dmg` directly from [GitHub Releases](https://github.com/ap9000/toolroll/releases/latest) and drag **Toolroll.app** to Applications. On launch, Toolroll automatically discovers or starts your local engine — no manual terminal setup required.
41
+
42
+ <details>
43
+ <summary>Building the native Mac app from source</summary>
44
+
45
+ ```sh
46
+ cd mac && bash build-app.sh && open build/Toolroll.app
47
+ # Or package a local .dmg:
48
+ cd mac && bash build-dmg.sh
49
+ ```
50
+
51
+ See [macOS release & signing guide](docs/guide/mac-release.md) for Developer ID signing, notarization, and Homebrew Cask automation.
52
+
53
+ </details>
54
+
55
+ ### CLI & Terminal Workbench (macOS or Linux)
56
+
57
+ Requires Node.js 22.20+, git 2.41+, and Claude Code (`claude`), Codex (`codex`), or Gemini signed in on this computer. On Linux, also install the sandbox tools: `sudo apt update && sudo apt install bubblewrap socat ripgrep`.
35
58
 
36
59
  ```sh
37
60
  curl -fsSL https://raw.githubusercontent.com/ap9000/toolroll/main/install.sh | sh
38
61
  ```
39
62
 
40
- or
63
+ Or with Homebrew / npm:
41
64
 
42
65
  ```sh
43
- npm uninstall -g standing-orders 2>/dev/null; npm install -g toolroll # or: brew install ap9000/toolroll/toolroll
66
+ brew install ap9000/toolroll/toolroll # or: npm install -g toolroll
44
67
  toolroll
45
68
  ```
46
69
 
47
- The first command removes Toolroll's older package, `standing-orders`, if you
48
- have it: npm can't install over it (it stops with `EEXIST: file already
49
- exists … bin/standing-orders`). Without it, the command does nothing.
50
-
51
- Toolroll opens in your terminal. On quit, choose whether agents keep running. No
52
- password and no login file: on your own computer you're already in. Started
53
- in a git repository, that repository is your project; press `n` for a first
54
- task and describe the change. Enter chooses **Just code**; Tab switches to
55
- **Plan first**, then Enter submits. Review any proposed build terms before
56
- starting. The result comes back **Ready**: review the diff with Enter, then
57
- press `a` to accept (confirm after reading), or `r` to request a revision. Elsewhere, press
58
- `s` to try a small sample project, add your own with
59
- `toolroll repos add <folder>`, or open the browser (press `w`, or run
60
- `toolroll --web`). To look around
61
- first, `toolroll demo` opens a seeded sandbox with no model calls and no spend.
62
- More: [Getting started](docs/guide/getting-started.md).
70
+ <details>
71
+ <summary>Upgrading from the older <code>standing-orders</code> npm package</summary>
72
+
73
+ ```sh
74
+ npm uninstall -g standing-orders && npm install -g toolroll
75
+ ```
76
+
77
+ </details>
78
+
79
+ Toolroll opens locally with no password and no login file — on your own computer you're already in. Start a **Direct Chat** for fast interactive iteration in an isolated clone, or delegate a **Task** to build while you walk away. Every result returns **Ready** with its diff and real check status; press `⌘⏎` (Mac app) or `a` (terminal) to accept and ship, or send it back with notes. To explore without model calls or spend, run `toolroll demo`. More: [Getting started](docs/guide/getting-started.md).
63
80
 
64
81
  ## The terminal loop
65
82
 
@@ -122,7 +139,7 @@ the CLI or MCP. Every act lands in one ledger.
122
139
  | **Approvals** | Digest-bound scopes, password step-up, typed decisions with reversibility, expiring operating modes |
123
140
  | **Agents** | Claude Code, Codex, Gemini, OpenRouter; an exact model per phase; subscription or API key |
124
141
  | **Models** | One editor (Settings → Models): "Sized by job" by default (Haiku for small tasks, Sonnet for routine, Opus for large or risky, Opus plans and reviews), or "Opus for everything"; every change shown before → after and logged |
125
- | **Surfaces** | Web console (desktop and phone), CLI, Telegram, Slack, Discord, Teams, MCP |
142
+ | **Surfaces** | Native macOS app (SwiftUI), terminal workbench, web console (desktop & phone), CLI, Telegram, Slack, Discord, Teams, MCP |
126
143
  | **Flows** | Zones on a canvas; triggers from schedules, GitHub, Linear, webhooks, email and chat; scripts, drafts, AI triage |
127
144
  | **Team** | Team server, OpenID Connect sign-in, per-person API tokens, project grants, subagents |
128
145
  | **Audit** | Hash-chained action ledger (`toolroll ledger verify`), evidence packs, full export |
@@ -1,4 +1,4 @@
1
- export const ACP_PROVIDER_IDS = ["opencode", "cursor", "cline", "qwen", "goose"];
1
+ export const ACP_PROVIDER_IDS = ["opencode", "cursor", "cline", "qwen", "goose", "antigravity"];
2
2
  export const ACP_AGENTS = {
3
3
  opencode: {
4
4
  name: "OpenCode",
@@ -40,6 +40,19 @@ export const ACP_AGENTS = {
40
40
  home: [".config/goose"],
41
41
  configSurface: ["~/.config/goose (providers, extensions)", "repository .goosehints", "its own sign-in"],
42
42
  },
43
+ antigravity: {
44
+ name: "Antigravity",
45
+ binary: "agy",
46
+ argv: ["acp"],
47
+ authMethod: "oauth-personal",
48
+ signIn: "agy acp --login",
49
+ home: [".gemini"],
50
+ configSurface: [
51
+ "~/.gemini (Antigravity login, rules, skills, MCP servers)",
52
+ "repository GEMINI.md and AGENTS.md",
53
+ "its own Google account sign-in (agy acp --login)",
54
+ ],
55
+ },
43
56
  };
44
57
  const ACP = new Set(ACP_PROVIDER_IDS);
45
58
  export function isAcpProvider(provider) {
@@ -327,10 +327,17 @@ export function createAcpConversation(options) {
327
327
  return { send: [], live: [] };
328
328
  }
329
329
  if (error !== null) {
330
- if (errorCode === AUTH_REQUIRED)
330
+ if (errorCode === AUTH_REQUIRED || purpose === "authenticate")
331
331
  return fail("auth-required", errorText);
332
332
  return fail(purpose === "model" ? "model-unavailable" : "protocol", `${purpose}: ${errorText}`);
333
333
  }
334
+ if (purpose === "authenticate") {
335
+ if (result !== null && (!isRecord(result) || !meta(result)))
336
+ return fail("protocol", "authenticate: the answer was not an object");
337
+ keep({ type: "acp.auth", methodId: options.authMethod ?? "" });
338
+ phase = "session";
339
+ return { send: [request("session/new", { cwd: options.cwd, mcpServers: options.mcpServers ?? [] }, "session/new")], live: [] };
340
+ }
334
341
  if (!isRecord(result))
335
342
  return fail("protocol", `${purpose}: the answer was not an object`);
336
343
  if (purpose === "initialize") {
@@ -349,6 +356,17 @@ export function createAcpConversation(options) {
349
356
  const sessions = isRecord(capabilities) ? capabilities["sessionCapabilities"] : undefined;
350
357
  canClose = isRecord(sessions) && isRecord(sessions["close"]);
351
358
  keep({ type: "acp.agent", name: agent.name, version: agent.version });
359
+ const authMethod = typeof options.authMethod === "string" && options.authMethod !== "" ? options.authMethod : null;
360
+ if (authMethod !== null) {
361
+ const methods = result["authMethods"];
362
+ if (Array.isArray(methods) && methods.length > 0) {
363
+ if (!methods.some(one => isRecord(one) && one["id"] === authMethod)) {
364
+ return fail("auth-required", `the agent does not advertise ${authMethod} authentication`);
365
+ }
366
+ phase = "authenticate";
367
+ return { send: [request("authenticate", { methodId: authMethod }, "authenticate")], live: [] };
368
+ }
369
+ }
352
370
  phase = "session";
353
371
  return { send: [request("session/new", { cwd: options.cwd, mcpServers: options.mcpServers ?? [] }, "session/new")], live: [] };
354
372
  }
@@ -0,0 +1,60 @@
1
+ import { canonicalJson } from "./canonical-json.js";
2
+ import { legOf, routeFromJson, sameSpec } from "./phase-routing.js";
3
+ import { levelOfProfile } from "./policy.js";
4
+ const KEPT_PROFILE_KEYS = ["network", "writes", "checkAccess", "fencePolicy", "readDeny", "machLookup"];
5
+ const same = (a, b) => canonicalJson(a ?? null) === canonicalJson(b ?? null);
6
+ const pairOf = (leg) => ({ provider: leg.provider, model: leg.model });
7
+ export function agentOnlyChange(sealed, next, billingOf) {
8
+ const was = routeFromJson(sealed.routeJson ?? null), now = routeFromJson(next.routeJson ?? null);
9
+ if (was === null || now === null)
10
+ return { ok: false, why: "a route can't be read" };
11
+ const terms = routeTermsProblem(was, now);
12
+ if (terms !== null)
13
+ return { ok: false, why: terms };
14
+ const changed = ["plan", "build", "repair", "review"].filter(phase => !sameSpec(legOf(was, phase), legOf(now, phase)));
15
+ const phase = changed.length === 1 && changed[0] === "plan" ? "plan"
16
+ : changed.includes("build") && changed.every(one => one === "build" || one === "repair") ? "build" : null;
17
+ if (phase === null)
18
+ return { ok: false, why: changed.length === 0 ? "no agent changed" : `${changed.join(", ")} changed` };
19
+ if (changed.includes("repair") && legOf(now, "repair").provider !== legOf(now, "build").provider)
20
+ return { ok: false, why: "the repair agent changed on its own" };
21
+ const others = (route) => route.overrides.filter(one => one.phase !== phase && !(phase === "build" && one.phase === "repair"));
22
+ if (!same(others(was), others(now)))
23
+ return { ok: false, why: "another role's choice changed" };
24
+ const profile = profileProblem(sealed.profile, next.profile, phase, legOf(now, "build"));
25
+ if (profile !== null)
26
+ return { ok: false, why: profile };
27
+ if ((sealed.chainJson ?? null) !== (next.chainJson ?? null))
28
+ return { ok: false, why: "the fallback chain changed" };
29
+ const from = pairOf(legOf(was, phase)), to = pairOf(legOf(now, phase));
30
+ if (billingOf(from.provider) !== billingOf(to.provider))
31
+ return { ok: false, why: "how the agent bills changed" };
32
+ return { ok: true, phase, from, to };
33
+ }
34
+ function routeTermsProblem(was, now) {
35
+ if (was.version !== now.version)
36
+ return "the route's version changed";
37
+ if (was.risk !== now.risk || was.qualityMode !== now.qualityMode || was.publication !== now.publication)
38
+ return "the route's terms changed";
39
+ if (!same([...was.evidence].sort(), [...now.evidence].sort()) || !same(was.demands, now.demands) || !same(was.size, now.size))
40
+ return "the route's terms changed";
41
+ return null;
42
+ }
43
+ function profileProblem(was, now, phase, build) {
44
+ if (was == null || now == null)
45
+ return "a profile can't be read";
46
+ if (phase === "plan")
47
+ return same(was, now) ? null : "the build settings changed";
48
+ if (now.provider !== build.provider || now.model !== build.model)
49
+ return "the build settings don't name the new builder";
50
+ if (was.provider === now.provider) {
51
+ const rest = (one) => ({ ...one, model: undefined, repairModel: undefined });
52
+ return same(rest(was), rest(now)) ? null : "the build settings changed";
53
+ }
54
+ if (levelOfProfile(was) !== levelOfProfile(now))
55
+ return "what the builder may do changed";
56
+ for (const key of KEPT_PROFILE_KEYS)
57
+ if (!same(was[key], now[key]))
58
+ return "what builds may reach changed";
59
+ return null;
60
+ }
@@ -0,0 +1,19 @@
1
+ export const V180_SCHEMA = `
2
+ CREATE TABLE IF NOT EXISTS pending_agent_change (
3
+ task_ref INTEGER PRIMARY KEY REFERENCES task_ref(id),
4
+ phase TEXT NOT NULL CHECK (phase IN ('plan', 'build')),
5
+ provider TEXT NOT NULL,
6
+ model TEXT NOT NULL,
7
+ apply_when TEXT NOT NULL CHECK (apply_when IN ('next-run', 'restart')),
8
+ saw_digest TEXT NOT NULL,
9
+ run INTEGER REFERENCES run(id),
10
+ by TEXT NOT NULL,
11
+ local_generation INTEGER NOT NULL,
12
+ account_generation INTEGER NOT NULL,
13
+ transport TEXT NOT NULL CHECK (transport IN ('browser', 'terminal')),
14
+ at TEXT NOT NULL,
15
+ problem TEXT
16
+ );
17
+ `;
18
+ export const V180_TABLES = Object.freeze(["pending_agent_change"]);
19
+ export const V180_STEPS = Object.freeze(["pending-agent-change"]);
@@ -18,6 +18,7 @@ const ACP_LOGIN = {
18
18
  goose: { kind: "file", path: (home, env) => join(xdg(env, "XDG_CONFIG_HOME", home, ".config"), "goose", "config.yaml"), how: "set up" },
19
19
  cursor: { kind: "none" },
20
20
  cline: { kind: "none" },
21
+ antigravity: { kind: "file", path: home => join(home, ".gemini", "oauth_creds.json"), how: "Google account" },
21
22
  };
22
23
  export const DETECTED_AGENTS = [
23
24
  { id: "claude", name: "Claude Code", binary: "claude", signIn: "claude auth login", install: "npm install -g @anthropic-ai/claude-code", login: { kind: "checker" } },
@@ -89,6 +90,8 @@ export async function detectAgents(options = {}) {
89
90
  return out(resolved === null ? "not-installed" : "unknown");
90
91
  if (answer.state === "not-installed" || (KEY_ANSWERS.has(answer.state) && resolved === null))
91
92
  return out("not-installed");
93
+ if (answer.launchIssue === "command-not-found")
94
+ return { ...out("unknown"), next: "The status command exited with code 127. Check that the agent and its helpers are on Toolroll's trusted PATH." };
92
95
  if (SIGNED_IN.has(answer.state))
93
96
  return out("signed-in", KEY_ANSWERS.has(answer.state) ? "API key" : answer.method ?? "signed in");
94
97
  return out(SIGNED_OUT.has(answer.state) ? "signed-out" : "unknown");
@@ -102,7 +105,7 @@ export function withNext(agent, routed, acpChecked) {
102
105
  return agent;
103
106
  if (FIRST_TASK_ORDER.includes(agent.id)) {
104
107
  const ready = agent.state === "signed-in" && (routed === null || routed === agent.id);
105
- return { ...agent, ready, next: agent.state === "signed-in" && !ready ? CHOOSE_AGENT : null };
108
+ return { ...agent, ready, next: agent.state === "signed-in" && !ready ? CHOOSE_AGENT : agent.next };
106
109
  }
107
110
  if (isAcpProvider(agent.id)) {
108
111
  const checked = acpChecked?.(agent.id) ?? false;
@@ -143,6 +146,10 @@ export function firstRunAgentLines(rows, firstTask, checking = false, routed = n
143
146
  lines.push(`${one.name} is signed in. ${one.next}`);
144
147
  continue;
145
148
  }
149
+ if (one.state === "unknown" && one.next !== null && FIRST_TASK_ORDER.includes(one.id)) {
150
+ lines.push(`${one.name}: ${one.next}`);
151
+ continue;
152
+ }
146
153
  if (one.signIn !== null)
147
154
  lines.push(`Sign in to ${one.name}: run \`${one.signIn}\`${one.state === "unknown" ? " (its sign-in couldn't be checked)" : ""}`);
148
155
  }
@@ -180,6 +187,9 @@ export const AGENT_SETUP = Object.freeze({
180
187
  note: "Its sign-in starts Qwen Code: type /auth and finish in the browser, then /quit." },
181
188
  goose: { install: "curl -fsSL https://github.com/block/goose/releases/download/stable/download_cli.sh | bash", installRun: null, signIn: ACP_AGENTS.goose.signIn,
182
189
  signInRun: { binary: "goose", args: ["configure"] }, key: null, check: ACP_CHECK("goose"), note: null },
190
+ antigravity: { install: null, installRun: null, signIn: ACP_AGENTS.antigravity.signIn,
191
+ signInRun: { binary: "agy", args: ["acp", "--login"] }, key: null, check: ACP_CHECK("antigravity"),
192
+ note: "Uses your Google account through Antigravity ACP (`agy acp`). Run `agy install` if `agy` is not on PATH." },
183
193
  });
184
194
  export function agentSetupOf(id) {
185
195
  return Object.prototype.hasOwnProperty.call(AGENT_SETUP, id) ? AGENT_SETUP[id] : null;
@@ -17,6 +17,7 @@ import { seccompHelperPath } from "./sandbox-tools.js";
17
17
  import { protectedStorageDenies, protectedStorageNames } from "./protected-storage.js";
18
18
  import { ensureSecretsDir, legacyLoginFileOf, SECRETS_DIR, secretsDirOf } from "./login-secrets.js";
19
19
  import { getDefaultWritePaths } from "@anthropic-ai/sandbox-runtime";
20
+ export const RESERVED_STATE_FOLDERS = ["coding-context", "code-map-delivery"];
20
21
  export const FLEXIBLE_THREADS_DIR = "threads";
21
22
  const SENSITIVE_NAME = /(^up-login\.txt$|token|secret|login|password|credential|vapid|keys?\b|\.pem$|\.key$|^backups$|^evidence$|^remote$|^sign-in\.json$|^monitoring\.json$)/i;
22
23
  function real(path) {
@@ -136,6 +137,27 @@ export function agentFence(options) {
136
137
  catch { }
137
138
  fence.add(backups);
138
139
  fence.add(real(backups));
140
+ const codexSessions = join(state, CODEX_SESSIONS_DIR);
141
+ try {
142
+ mkdirSync(codexSessions, { mode: 0o700 });
143
+ }
144
+ catch { }
145
+ fence.add(codexSessions);
146
+ fence.add(real(codexSessions));
147
+ for (const name of RESERVED_STATE_FOLDERS) {
148
+ const path = join(state, name);
149
+ try {
150
+ mkdirSync(path, { mode: 0o700 });
151
+ }
152
+ catch { }
153
+ fence.add(path);
154
+ fence.add(real(path));
155
+ }
156
+ const evidence = join(state, "evidence");
157
+ if (process.platform === "darwin" || existsSync(evidence)) {
158
+ fence.add(evidence);
159
+ fence.add(real(evidence));
160
+ }
139
161
  const threads = join(state, FLEXIBLE_THREADS_DIR);
140
162
  try {
141
163
  mkdirSync(threads, { mode: 0o700 });
@@ -197,6 +219,8 @@ export function agentFence(options) {
197
219
  fence.add(gitViewsRoot(home));
198
220
  for (const secrets of existingFolders(home, { dot: true }))
199
221
  fence.add(secrets);
222
+ for (const path of operatorCodexHomes(home, worktree))
223
+ fence.add(path);
200
224
  if (options.databaseFile !== null && options.databaseFile !== "" && options.databaseFile !== ":memory:") {
201
225
  const stream = readMonitoring(dirname(real(options.databaseFile))).folder?.path;
202
226
  if (stream !== undefined)
@@ -367,7 +391,7 @@ function otherRunFolders(folders) {
367
391
  }
368
392
  const uid = process.getuid?.();
369
393
  return entries.filter(entry => RUN_FOLDER_PREFIXES.some(prefix => entry.startsWith(prefix))).map(entry => join(folders.root, entry)).filter(path => {
370
- if (path === folders.own)
394
+ if (path === folders.own || (folders.alsoOwn ?? []).includes(path))
371
395
  return false;
372
396
  try {
373
397
  const held = lstatSync(path);
@@ -411,6 +435,7 @@ export function grantFolder(path, create = true) {
411
435
  const ACP_DATA = {
412
436
  goose: [".local/share/goose", ".local/state/goose"],
413
437
  qwen: [".qwen/tmp", ".qwen/history"],
438
+ antigravity: [".gemini/antigravity-cli", ".gemini/tmp", ".gemini/logs"],
414
439
  };
415
440
  const CLAUDE_SHORTENED = "-[a-z0-9]+(/|$)";
416
441
  const ATOMIC_NAMES = "([.~][^/]*)?$";
@@ -489,6 +514,10 @@ export function buildCacheFolder(repo, home = homedir(), platform = process.plat
489
514
  const root = platform === "darwin" ? join(home, "Library", "Caches") : env["XDG_CACHE_HOME"] !== undefined && isAbsolute(env["XDG_CACHE_HOME"]) ? env["XDG_CACHE_HOME"] : join(home, ".cache");
490
515
  return join(root, "toolroll-builds", createHash("sha256").update(real(repo)).digest("hex").slice(0, 16));
491
516
  }
517
+ export const PLAIN_AGENT_ENV = ["PATH", "LANG", "LC_ALL", "LC_CTYPE", "LC_MESSAGES", "TERM", "TZ", "USER", "LOGNAME", "SHELL", "COLORTERM"];
518
+ export function plainAgentEnv(base) {
519
+ return Object.fromEntries(PLAIN_AGENT_ENV.flatMap(name => base[name] === undefined ? [] : [[name, base[name]]]));
520
+ }
492
521
  export function buildCacheEnv(folder) {
493
522
  const at = (name) => join(folder, name);
494
523
  return {
@@ -583,6 +612,21 @@ function worktreeGitDir(worktree) {
583
612
  return null;
584
613
  }
585
614
  }
615
+ export function operatorCodexHomes(home, worktree = null, env = process.env) {
616
+ const named = env["CODEX_HOME"];
617
+ const candidates = [join(home, ".codex"), ...(named !== undefined && isAbsolute(named) ? [named] : [])].flatMap(path => [path, resolvedPath(path)]);
618
+ return [...new Set(candidates)].filter(path => path !== sep && path !== home && !inside(home, path) && !(worktree !== null && (worktree === path || inside(worktree, path)))
619
+ && (process.platform !== "linux" || existsSync(path)));
620
+ }
621
+ export const CODEX_SESSIONS_DIR = "codex-sessions";
622
+ export function codexSessionsName(workspaceId, recoveryGeneration, taskRef) {
623
+ return createHash("sha256").update(`codex-sessions:${workspaceId}:${recoveryGeneration}:${taskRef}`, "utf8").digest("hex").slice(0, 32);
624
+ }
625
+ export function codexSessionsFolder(databaseFile, identity, taskRef) {
626
+ if (databaseFile === null || databaseFile === "" || databaseFile === ":memory:" || identity.id === "" || identity.recoveryGeneration === "")
627
+ return null;
628
+ return join(dirname(real(databaseFile)), CODEX_SESSIONS_DIR, codexSessionsName(identity.id, identity.recoveryGeneration, taskRef));
629
+ }
586
630
  const toml = (value) => `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
587
631
  export function codexFenceArgv(fence, fullAccess, grants = NO_GRANTS) {
588
632
  const access = codexFilesystem(fence, fullAccess, grants);
@@ -653,6 +697,10 @@ function codexFilesystem(fence, fullAccess, grants) {
653
697
  if (basename(path) === INSTANCE_DIR)
654
698
  access.set(path, "deny");
655
699
  }
700
+ for (const path of exactFileReads(grants)) {
701
+ access.set(path, "read");
702
+ access.set(join(path, "**"), "deny");
703
+ }
656
704
  const storage = grants.protectedStorage ?? [];
657
705
  if (storage.length > 0) {
658
706
  for (const [path, mode] of [...access])
@@ -701,8 +749,9 @@ export const SPLIT_SECRET_PATTERNS = ["orders.db*", "*token*", "up-login*", "*.t
701
749
  export function flattened(fence, grants = NO_GRANTS, list = path => readdirSync(path)) {
702
750
  const deny = [];
703
751
  const readOnly = new Set(grants.readOnly);
752
+ const exact = new Set([...exactFileReads(grants), ...grants.exactRegular ?? []]);
704
753
  const split = (path) => {
705
- const within = grants.readable.filter(one => inside(one, path));
754
+ const within = grants.readable.filter(one => inside(one, path) && !exact.has(one));
706
755
  if (within.length === 0) {
707
756
  deny.push(path);
708
757
  return;
@@ -721,8 +770,10 @@ export function flattened(fence, grants = NO_GRANTS, list = path => readdirSync(
721
770
  deny.push(join(path, pattern));
722
771
  for (const entry of entries) {
723
772
  const child = join(path, entry);
724
- if (grants.readable.includes(child))
725
- readOnly.add(child);
773
+ if (grants.readable.includes(child)) {
774
+ if (!exact.has(child))
775
+ readOnly.add(child);
776
+ }
726
777
  else
727
778
  split(child);
728
779
  }
@@ -732,6 +783,20 @@ export function flattened(fence, grants = NO_GRANTS, list = path => readdirSync(
732
783
  const denied = deny.filter(path => !path.includes("*"));
733
784
  return { deny, readOnly: [...readOnly].filter(path => !denied.some(one => path === one || inside(path, one))) };
734
785
  }
786
+ export function exactFileReads(grants) {
787
+ return (grants.exactFiles ?? []).filter(path => grants.readable.includes(path) && regularAt(path));
788
+ }
789
+ function regularAt(path) {
790
+ try {
791
+ const held = lstatSync(path);
792
+ return held.isFile() && !held.isSymbolicLink() && realpathSync(path) === path;
793
+ }
794
+ catch {
795
+ return false;
796
+ }
797
+ }
798
+ export class ExactFileChanged extends Error {
799
+ }
735
800
  export function claudeFenceSettings(fence, readOnly = []) {
736
801
  const rules = [...fence.flatMap(path => [`Read(/${path})`, `Read(/${path}/**)`, `Edit(/${path})`, `Edit(/${path}/**)`]), ...readOnly.flatMap(path => [`Edit(/${path})`, `Edit(/${path}/**)`])];
737
802
  return JSON.stringify({ permissions: { deny: rules } });
@@ -777,7 +842,9 @@ export class LinuxFenceUnavailable extends Error {
777
842
  }
778
843
  export function srtTermsOf(fence, grants = NO_GRANTS) {
779
844
  const denyRead = new Set(fence.map(real));
780
- const allowRead = new Set(grants.readable.flatMap(path => grants.exactFiles?.includes(path) === true ? [real(path)] : [real(path), real(dirname(path))]));
845
+ const regular = new Set(grants.exactRegular ?? []);
846
+ const allowRead = new Set(grants.readable.flatMap(path => regular.has(path) ? (regularAt(path) ? [path] : [])
847
+ : grants.exactFiles?.includes(path) === true ? [real(path)] : [real(path), real(dirname(path))]));
781
848
  const denyWrite = new Set([...fence, ...grants.readOnly].map(real));
782
849
  for (const path of grants.writeDenies ?? [])
783
850
  denyWrite.add(path);
@@ -794,7 +861,7 @@ export function srtTermsOf(fence, grants = NO_GRANTS) {
794
861
  for (const root of runRoots(folders)) {
795
862
  for (const prefix of RUN_FOLDER_PREFIXES)
796
863
  denyRead.add(join(root, `${prefix}*`));
797
- for (const path of otherRunFolders({ root, own: folders.own })) {
864
+ for (const path of otherRunFolders({ root, own: folders.own, ...(folders.alsoOwn === undefined ? {} : { alsoOwn: folders.alsoOwn }) })) {
798
865
  denyRead.add(path);
799
866
  if (grants.writes === undefined)
800
867
  denyWrite.add(path);
@@ -802,6 +869,8 @@ export function srtTermsOf(fence, grants = NO_GRANTS) {
802
869
  }
803
870
  if (folders.own !== null)
804
871
  allowRead.add(folders.own);
872
+ for (const path of folders.alsoOwn ?? [])
873
+ allowRead.add(path);
805
874
  }
806
875
  const pool = grants.pool;
807
876
  if (pool !== undefined) {
@@ -831,8 +900,8 @@ export function srtTermsOf(fence, grants = NO_GRANTS) {
831
900
  const readConfig = { denyOnly: [...denyRead].sort(), allowWithinDeny: [...allowRead].sort() };
832
901
  const writes = grants.writes;
833
902
  const signInWrites = [...grants.signIns?.writes ?? [], ...(grants.signIns?.transcripts ?? []).map(folder => join(folder, "*.jsonl"))];
834
- const allowOnly = writes === undefined ? ["/", ...(pool?.own == null ? [] : [real(pool.own)]), ...(folders?.own == null ? [] : [folders.own])]
835
- : [...writes.subpaths, ...writes.prefixes.map(one => `${one.path}*`), ...signInWrites, ...getDefaultWritePaths({ denyRead: readConfig.denyOnly, allowRead: readConfig.allowWithinDeny })
903
+ const allowOnly = writes === undefined ? ["/", ...(pool?.own == null ? [] : [real(pool.own)]), ...(folders?.own == null ? [] : [folders.own]), ...(folders?.alsoOwn ?? [])]
904
+ : [...writes.subpaths, ...(folders?.alsoOwn ?? []), ...writes.prefixes.map(one => `${one.path}*`), ...signInWrites, ...getDefaultWritePaths({ denyRead: readConfig.denyOnly, allowRead: readConfig.allowWithinDeny })
836
905
  .filter(path => grants.noSharedTemp !== true || !SHARED_TEMP.includes(path))];
837
906
  const network = grants.network;
838
907
  return {
@@ -853,12 +922,12 @@ export function sandboxedSpawn(file, args, fence, grants = NO_GRANTS, cwd, temp)
853
922
  }
854
923
  export const FENCE_SUMMARY = [
855
924
  {
856
- agent: "**Claude, Gemini, ACP agents**",
925
+ agent: "**Claude, Gemini, ACP agents; Codex and OpenRouter on a Mac**",
857
926
  auto: "Anthropic's sandbox-runtime (Seatbelt on macOS; bubblewrap and its seccomp filter on Linux, which also needs socat and ripgrep): reads your home folder except the folders the project lists, never Toolroll's folders; other tasks' work read, never written; writes only the checkout, its Git data, the project's caches, the run's temp folder and the agent's own session files (anywhere outside the fence, under a project set to write anywhere), never the runtime's protected names in the checkout (Git hooks and config, shell profiles, `.mcp.json`, editor settings); no Apple Events. Neither (Windows, or a Linux missing one of those): the build doesn't start, unless an instance operator allows unconfined agents",
858
927
  full: "same",
859
928
  },
860
929
  {
861
- agent: "**Codex / OpenRouter** (any OS)",
930
+ agent: "**Codex / OpenRouter** (Linux)",
862
931
  auto: "Codex's own sandbox, given the same fence: reads your home folder except the folders the project lists, never Toolroll's folders; other tasks' work read, never written; writes only the checkout, its Git data and the project's caches (anywhere outside the fence, under a project set to write anywhere); no network",
863
932
  full: "the same reads and writes, with the fence; its commands reach the network only when the project's network is open",
864
933
  },
@@ -875,9 +944,7 @@ export function signInGrants(home, checkout, platform = process.platform) {
875
944
  const read = SIGN_IN_FILES(platform).map(name => join(base, name)).filter(path => signInIsItself(base, path));
876
945
  const transcript = claudeProjectFolder(base, real(checkout));
877
946
  const folder = transcript.byPrefix || !existsSync(join(base, ".claude")) ? null : grantFolder(transcript.path);
878
- const codex = join(base, ".codex");
879
- const writes = grantFolder(codex, false) === null ? [] : ["sessions", "log"].map(name => grantFolder(join(codex, name))).filter((path) => path !== null);
880
- return { read, transcripts: folder === null || platform !== "darwin" ? [] : [folder], writes, mach: platform === "darwin" ? ["com.apple.trustd.agent"] : [] };
947
+ return { read, transcripts: folder === null || platform !== "darwin" ? [] : [folder], writes: [], mach: platform === "darwin" ? ["com.apple.trustd.agent"] : [] };
881
948
  }
882
949
  export function signInIsItself(base, path) {
883
950
  let at = base;
@@ -909,11 +976,21 @@ export function fenceFor(kind, ctx) {
909
976
  const found = fenceGrants({ databaseFile: ctx.databaseFile, worktree: ctx.worktree, boundary: ctx.boundary, runFolders: ctx.runFolders, linked: ctx.linked ?? null, binding: ctx.binding, ...home, poolRoots: ctx.poolRoots });
910
977
  const made = installDenied(found, ctx.worktree, ctx.home ?? homedir(), ctx.binding?.main ?? null);
911
978
  const written = ctx.writes ?? null;
912
- const exact = ctx.exactFile ?? null;
979
+ const exact = [...new Set([...(ctx.exactFile == null ? [] : [ctx.exactFile]), ...ctx.exactFiles ?? []])].filter(path => {
980
+ if (regularAt(path))
981
+ return true;
982
+ try {
983
+ lstatSync(path);
984
+ }
985
+ catch {
986
+ return false;
987
+ }
988
+ throw new ExactFileChanged("A file this launch was to read changed before it started, so nothing was started.");
989
+ });
913
990
  const grants = {
914
991
  ...made,
915
992
  ...(written === null ? {} : { writes: written.writes, readOnly: [...new Set([...made.readOnly, ...written.readOnly])].sort() }),
916
- ...(exact === null ? {} : { readable: [...made.readable, exact], exactFiles: [exact], readOnly: [...new Set([...made.readOnly, ...(written?.readOnly ?? []), exact])].sort() }),
993
+ ...(exact.length === 0 ? {} : { readable: [...made.readable, ...exact], exactFiles: exact, exactRegular: exact, readOnly: [...new Set([...made.readOnly, ...(written?.readOnly ?? []), ...exact])].sort() }),
917
994
  ...(ctx.network === undefined ? {} : { network: ctx.network }),
918
995
  ...(ctx.machLookup === undefined || ctx.machLookup.length === 0 ? {} : { machLookup: [...ctx.machLookup] }),
919
996
  ...(kind === "check" || (kind === "flow" && ctx.browser === true) ? { browser: true } : {}),
@@ -1026,6 +1103,6 @@ export function serverGrantsOf(grants) {
1026
1103
  return {
1027
1104
  ...rest,
1028
1105
  ...(rest.pool === undefined ? {} : { pool: { ...rest.pool, own: null } }),
1029
- ...(rest.runFolders === undefined ? {} : { runFolders: { ...rest.runFolders, own: null } }),
1106
+ ...(rest.runFolders === undefined ? {} : { runFolders: { root: rest.runFolders.root, own: null, ...(rest.runFolders.also === undefined ? {} : { also: rest.runFolders.also }) } }),
1030
1107
  };
1031
1108
  }