toolroll 0.9.108 → 0.9.110

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 (187) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/advanced-view.js +0 -1
  3. package/dist/agent-detect.js +244 -0
  4. package/dist/agent-fence.js +47 -5
  5. package/dist/agent-state.js +5 -2
  6. package/dist/agentconfig.js +2 -2
  7. package/dist/approval-summary.js +344 -0
  8. package/dist/assignment-ui.js +5 -5
  9. package/dist/assignment.js +5 -2
  10. package/dist/attest.js +2 -2
  11. package/dist/browser/terminal.js +1 -1
  12. package/dist/browser/workspace.css +2 -2
  13. package/dist/browser/workspace.js +37 -34
  14. package/dist/browser-crew.js +4 -4
  15. package/dist/browser-workspace.js +4 -11
  16. package/dist/builder.js +45 -3
  17. package/dist/chat-actions.js +24 -17
  18. package/dist/chat-controls.js +6 -5
  19. package/dist/chat-core.js +3 -1
  20. package/dist/chat-decide.js +102 -47
  21. package/dist/chat-delivery-state.js +2 -0
  22. package/dist/chat-delivery.js +3 -2
  23. package/dist/chat-live.js +2 -1
  24. package/dist/chat-quiet.js +3 -3
  25. package/dist/chat-task-actions.js +6 -0
  26. package/dist/chat-voice.js +2 -2
  27. package/dist/check-report.js +1 -1
  28. package/dist/cli-help.js +12 -13
  29. package/dist/cli.js +6 -3
  30. package/dist/console-chrome.js +10 -3
  31. package/dist/console-instance.js +10 -1
  32. package/dist/contracts/console-api.js +14 -8
  33. package/dist/contracts/engine-api.js +271 -0
  34. package/dist/contracts/handoff.js +4 -0
  35. package/dist/coordinator.js +2 -2
  36. package/dist/decision.js +17 -0
  37. package/dist/demo-chat.js +1 -1
  38. package/dist/demo.js +6 -0
  39. package/dist/design/kit.js +4 -3
  40. package/dist/discord-api.js +4 -3
  41. package/dist/discord-chat.js +3 -1
  42. package/dist/dispatch.js +3 -8
  43. package/dist/easy-start-args.js +7 -3
  44. package/dist/easy-start.js +25 -0
  45. package/dist/egress.js +72 -10
  46. package/dist/engine-handoff.js +34 -0
  47. package/dist/engine-reads.js +261 -0
  48. package/dist/eval-world.js +3 -2
  49. package/dist/evidence.js +2 -0
  50. package/dist/fast-start.js +55 -14
  51. package/dist/fast-terms.js +2 -2
  52. package/dist/first-run.js +10 -2
  53. package/dist/flexible-agents.js +234 -0
  54. package/dist/flexible-answers-schema.js +61 -0
  55. package/dist/flexible-answers.js +889 -0
  56. package/dist/flexible-available.js +1 -0
  57. package/dist/flexible-custody.js +494 -0
  58. package/dist/flexible-import.js +782 -0
  59. package/dist/flexible-launch-schema.js +72 -0
  60. package/dist/flexible-launch.js +331 -0
  61. package/dist/flexible-launcher.js +88 -0
  62. package/dist/flexible-levels.js +34 -0
  63. package/dist/flexible-merge-guard.js +47 -0
  64. package/dist/flexible-refs.js +47 -0
  65. package/dist/flexible-relay-cancel.js +19 -0
  66. package/dist/flexible-relay-schema.js +55 -0
  67. package/dist/flexible-relay-upstreams.js +36 -0
  68. package/dist/flexible-relay.js +1032 -0
  69. package/dist/flexible-schema.js +32 -0
  70. package/dist/flexible-session.js +732 -0
  71. package/dist/flexible-ship-schema.js +81 -0
  72. package/dist/flexible-ship.js +694 -0
  73. package/dist/flexible-start.js +80 -0
  74. package/dist/flexible-thread-schema.js +30 -0
  75. package/dist/flexible-thread.js +676 -0
  76. package/dist/flexible-turns-schema.js +69 -0
  77. package/dist/flexible-turns.js +490 -0
  78. package/dist/flexible-ui.js +44 -0
  79. package/dist/flexible.js +368 -0
  80. package/dist/flow-actions.js +6 -4
  81. package/dist/flow-steps.js +1 -1
  82. package/dist/flows-cli.js +2 -1
  83. package/dist/git-views.js +44 -41
  84. package/dist/guides.js +11 -10
  85. package/dist/install-mode.js +225 -0
  86. package/dist/keymap.js +1 -1
  87. package/dist/lead-context.js +1 -1
  88. package/dist/lead-doors.js +7 -1
  89. package/dist/limits-ui.js +8 -1
  90. package/dist/live-bus.js +70 -13
  91. package/dist/live-reply.js +6 -0
  92. package/dist/live-terminal.js +425 -29
  93. package/dist/local-owner.js +6 -0
  94. package/dist/model-choices.js +12 -6
  95. package/dist/needs-you.js +3 -3
  96. package/dist/nightly-github.js +2 -2
  97. package/dist/notification-delivery.js +11 -0
  98. package/dist/operate.js +185 -33
  99. package/dist/outbound-privacy.js +204 -0
  100. package/dist/passwordless.js +2 -1
  101. package/dist/project-delete-ui.js +2 -1
  102. package/dist/project-delete.js +15 -0
  103. package/dist/provider-auth.js +1 -1
  104. package/dist/provider-connection.js +5 -3
  105. package/dist/publish.js +5 -0
  106. package/dist/pull-request-flow.js +26 -7
  107. package/dist/push.js +5 -1
  108. package/dist/release-card.js +11 -3
  109. package/dist/release.js +11 -1
  110. package/dist/result-actions.js +3 -0
  111. package/dist/result-evidence-readers.js +8 -2
  112. package/dist/result-review.js +20 -9
  113. package/dist/route-store.js +2 -2
  114. package/dist/sandbox-launch.js +32 -8
  115. package/dist/sandbox-runtime.js +16 -7
  116. package/dist/sandbox-tools.js +176 -0
  117. package/dist/scope.js +12 -36
  118. package/dist/scout-net.js +7 -2
  119. package/dist/serve.js +90 -40
  120. package/dist/server/chat.js +9 -9
  121. package/dist/server/chrome.js +19 -17
  122. package/dist/server/console.css +33 -6
  123. package/dist/server/engine-api.js +378 -0
  124. package/dist/server/flows.js +2 -2
  125. package/dist/server/guards.js +10 -4
  126. package/dist/server/home.js +37 -5
  127. package/dist/server/http.js +11 -2
  128. package/dist/server/in-place.js +5 -4
  129. package/dist/server/kit.js +2 -2
  130. package/dist/server/link-redemption.js +52 -0
  131. package/dist/server/live.js +100 -10
  132. package/dist/server/mutation-key.js +21 -7
  133. package/dist/server/pages.js +129 -74
  134. package/dist/server/people-tokens.js +17 -41
  135. package/dist/server/render-chat.js +2 -1
  136. package/dist/server/render-history.js +18 -4
  137. package/dist/server/render-new-task.js +4 -4
  138. package/dist/server/render-pages.js +21 -39
  139. package/dist/server/render-people.js +2 -2
  140. package/dist/server/render-projects.js +5 -5
  141. package/dist/server/render-results.js +30 -14
  142. package/dist/server/render-tasks.js +155 -155
  143. package/dist/server/retired-routes.js +37 -4
  144. package/dist/server/route-policy.js +8 -0
  145. package/dist/server/route-table.js +43 -5
  146. package/dist/server/settings-computers.js +140 -0
  147. package/dist/server/settings-scripts.js +15 -0
  148. package/dist/server/settings-section-table.js +59 -0
  149. package/dist/server/settings-sections.js +291 -0
  150. package/dist/server/settings.js +247 -28
  151. package/dist/server/task-views.js +55 -15
  152. package/dist/server/tasks.js +168 -98
  153. package/dist/server/terminals.js +181 -28
  154. package/dist/server/welcome.js +40 -14
  155. package/dist/settings-groups-ui.js +26 -107
  156. package/dist/settings-proofs.js +18 -11
  157. package/dist/slack-api.js +4 -3
  158. package/dist/slack-chat.js +5 -3
  159. package/dist/spend.js +46 -12
  160. package/dist/sqlite-telemetry.js +70 -21
  161. package/dist/status-probe.js +343 -0
  162. package/dist/store.js +206 -10
  163. package/dist/task-link.js +64 -0
  164. package/dist/teams-api.js +4 -3
  165. package/dist/teams-chat.js +4 -2
  166. package/dist/telegram-lead.js +2 -1
  167. package/dist/telegram-live.js +2 -1
  168. package/dist/telegram-team.js +2 -1
  169. package/dist/telegram.js +17 -5
  170. package/dist/trusted-path.js +162 -0
  171. package/dist/tui/darwin-arm64/toolroll-tui +0 -0
  172. package/dist/tui/darwin-x64/toolroll-tui +0 -0
  173. package/dist/tui/linux-arm64/toolroll-tui +0 -0
  174. package/dist/tui/linux-x64/toolroll-tui +0 -0
  175. package/dist/tui-launch.js +282 -0
  176. package/dist/tui-source.js +5 -3
  177. package/dist/tui.js +2 -2
  178. package/dist/typed-words-schema.js +18 -0
  179. package/dist/webhooks.js +8 -4
  180. package/dist/welcome-facts.js +25 -17
  181. package/dist/work-index.js +126 -29
  182. package/dist/work-reads.js +279 -0
  183. package/dist/workspace-ui.js +5 -0
  184. package/package.json +4 -2
  185. package/scripts/crash-canary.mjs +1 -1
  186. package/scripts/pilot.mjs +1 -1
  187. package/scripts/provider-canary.mjs +5 -3
package/CHANGELOG.md CHANGED
@@ -4,6 +4,75 @@ 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.110 — 2026-11-15
8
+
9
+ A real terminal screen: run `toolroll` in a terminal and watch, steer, review and accept your agents' work there, in a
10
+ calmer look. Solo installs ask for less, and first runs go straight to the agent you already have.
11
+
12
+ ### New
13
+
14
+ - **The terminal workbench.** Bare `toolroll` opens a native screen (Mac and Linux): your work list, the agent's
15
+ work live, Steer / Pause / Stop, and the diff with notes, Accept and Send back.
16
+ - **Take over a build.** On a task's Terminal tab press t for a real shell in a separate copy of its latest build;
17
+ Ctrl-] comes back and the shell keeps running.
18
+ - **Agents screen (A).** Every supported agent and what it needs: sign in through the agent's own login in a pane,
19
+ install with npm after a confirm, and pick the agent and model for planning, building and review.
20
+ - **Command palette and layouts.** `:` lists every action; key presets, split and grid layouts, resume where you left
21
+ off, and today's cost in the top bar.
22
+ - **Themes and `~/.config/toolroll/tui.toml`:** light, dark, high contrast or your terminal's own colours; density,
23
+ glyphs and notifications. Works down to 16 colours and NO_COLOR.
24
+ - **Instant start.** First run finds the coding agents you have and whether each is signed in, then sends your first
25
+ task to one you can use, or names the one sign-in command to run. It never makes a model call to check.
26
+ - **Solo and team.** A one-person install is solo: your signed-in session stands in for the password at ordinary
27
+ steps. Settings → General shows which you are; "It's just me" switches a single-person install to solo.
28
+
29
+ ### Changed
30
+
31
+ - **Approvals are shorter and exact.** One summary (goal, done when, agents, what it may touch and cost), risks under
32
+ "Before you approve", and Approve after what it approves. Revisions lead with what changed.
33
+ - **Saving a credential always asks for your password** (provider keys, the Telegram bot token, mail and Google
34
+ accounts), solo or team.
35
+ - **Messages that leave Toolroll never name a local folder or a key.** Chat apps, webhooks, push and email get a
36
+ plain "An update is ready" instead and the detail stays in Toolroll.
37
+
38
+ ### Fixed
39
+
40
+ - **A slow sign-in check no longer sends your first task to a plan** instead of the agent you have.
41
+
42
+ ## 0.9.109 — 2026-11-14
43
+
44
+ One Work screen, pages several times faster on a busy install, a clearer first run, and what the agent decided
45
+ before you accept.
46
+
47
+ ### New
48
+
49
+ - **Work is the first screen.** What needs you comes first (Decide, Review, Unblock), then Running, Queued and Done;
50
+ pick a row and the task opens beside the list. Approve, Accept and Send back work there without a page load.
51
+ - **The agent says what it decided.** Before you accept, a result shows what the agent decided, assumed, didn't finish
52
+ and thinks is risky, and quotes the notes you and your teammates wrote for it.
53
+ - **Settings → Computers** holds the computers that build: connect a builder, see each one, and add or retire one on
54
+ its own password page.
55
+ - **A first task with no coding agent signed in says so.** Filing from the terminal, the shell or the browser names
56
+ the one command to run; the welcome says the task is "Filed" until an agent picks it up.
57
+ - **The shell says what comes next** after `toolroll task add`: open `toolroll` and press p to ask for the plan.
58
+
59
+ ### Changed
60
+
61
+ - **Home and Tasks are one screen.** Old Home and Tasks links open Work with the same filters; the sidebar is Work,
62
+ Chat and Settings, with your projects and Manage projects.
63
+ - **Faster on a busy install.** Chat, Work and task pages read many times less from the database: on 10,000 tasks
64
+ Chat opens in about 2 s instead of 14 s.
65
+ - **One page per result.** Every "Open result" (Work, Chat, chat apps, notifications) opens the task page at that
66
+ exact result, status and action first; an earlier attempt opens on its own page with nothing that acts on the
67
+ current one.
68
+ - **Live pages recover in about half a second** after your phone wakes or the network changes, without a gap.
69
+ - **Show advanced features** moved to Settings → General.
70
+
71
+ ### Fixed
72
+
73
+ - **Send back never sends notes you haven't seen,** and a lost answer is never shown as done.
74
+ - **A result page sends its result panel once,** about half the size it was.
75
+
7
76
  ## 0.9.108 — 2026-11-14
8
77
 
9
78
  Add projects from the browser, get back in when you forget your password, and pages that reconnect on their own.
@@ -21,6 +21,5 @@ export const ADVANCED_PAGES = Object.freeze([
21
21
  { title: "Sign-in with a provider", href: "/settings/sign-in", words: "Let people sign in with your identity provider", operator: true },
22
22
  { title: "Passwordless", href: "/settings/passwordless", words: "Sign in once; most approvals then need no password", operator: true },
23
23
  { title: "Monitoring", href: "/settings/monitoring", words: "Send the audit stream and traces to your own systems", operator: true },
24
- { title: "Builders", href: "/fleet", words: "Every computer that builds" },
25
24
  { title: "For each project", href: "/settings/projects", words: "Fallback agents, live view commands, code map and flaky tests, on each project’s page" },
26
25
  ]);
@@ -0,0 +1,244 @@
1
+ import { readFileSync, statSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { delimiter, isAbsolute, join } from "node:path";
4
+ import { ACP_AGENTS, ACP_PROVIDER_IDS, isAcpProvider } from "./acp-agents.js";
5
+ import { inspectAcpAgent } from "./acp-inspect.js";
6
+ import { resolveExecutable } from "./attest.js";
7
+ import { statusProbe, STATUS_TIMEOUT_MS } from "./status-probe.js";
8
+ import { keyStatus, OWN_KEY_ENV, readAuthMode } from "./keys.js";
9
+ import { createConnectionChecker } from "./provider-connection.js";
10
+ export const DETECT_TIMEOUT_MS = STATUS_TIMEOUT_MS;
11
+ const xdg = (env, name, home, fallback) => {
12
+ const value = env[name];
13
+ return value !== undefined && isAbsolute(value) ? value : join(home, fallback);
14
+ };
15
+ const ACP_LOGIN = {
16
+ opencode: { kind: "file", path: (home, env) => join(xdg(env, "XDG_DATA_HOME", home, join(".local", "share")), "opencode", "auth.json"), how: "login file" },
17
+ qwen: { kind: "file", path: home => join(home, ".qwen", "oauth_creds.json"), how: "login file" },
18
+ goose: { kind: "file", path: (home, env) => join(xdg(env, "XDG_CONFIG_HOME", home, ".config"), "goose", "config.yaml"), how: "set up" },
19
+ cursor: { kind: "none" },
20
+ cline: { kind: "none" },
21
+ };
22
+ export const DETECTED_AGENTS = [
23
+ { id: "claude", name: "Claude Code", binary: "claude", signIn: "claude auth login", install: "npm install -g @anthropic-ai/claude-code", login: { kind: "checker" } },
24
+ { id: "codex", name: "Codex", binary: "codex", signIn: "codex login", install: "npm install -g @openai/codex", login: { kind: "checker" } },
25
+ { id: "gemini", name: "Gemini CLI", binary: "gemini", signIn: "gemini", install: null, login: { kind: "gemini" } },
26
+ { id: "openrouter", name: "OpenRouter", binary: "codex", signIn: "toolroll keys set openrouter --key-file <file>", install: null, login: { kind: "key" } },
27
+ ...ACP_PROVIDER_IDS.map((id) => ({ id, name: ACP_AGENTS[id].name, binary: ACP_AGENTS[id].binary, signIn: ACP_AGENTS[id].signIn, install: null, login: ACP_LOGIN[id] })),
28
+ ];
29
+ export const FIRST_TASK_ORDER = ["claude", "codex"];
30
+ const GEMINI_KEY_SIGN_IN = "toolroll keys set gemini --key-file <file>";
31
+ const CHOOSE_MODELS = "To give it tasks, choose its models in Settings → Models.";
32
+ const CHOOSE_AGENT = "To give it tasks, choose it in Settings → Models.";
33
+ function present(file) {
34
+ try {
35
+ const seen = statSync(file);
36
+ return seen.isFile() && seen.size > 0;
37
+ }
38
+ catch {
39
+ return false;
40
+ }
41
+ }
42
+ function keySet(provider, home, env) {
43
+ return keyStatus(provider, home).set || OWN_KEY_ENV[provider].some(name => (env[name] ?? "") !== "");
44
+ }
45
+ const SIGNED_IN = new Set(["connected", "key-present", "key-works"]);
46
+ const SIGNED_OUT = new Set(["signed-out", "missing-key", "key-refused"]);
47
+ const KEY_ANSWERS = new Set(["key-present", "key-works", "key-refused", "missing-key"]);
48
+ function within(work, ms, fallback) {
49
+ return new Promise(resolve => {
50
+ const timer = setTimeout(() => resolve(fallback), ms);
51
+ timer.unref?.();
52
+ work.then(value => { clearTimeout(timer); resolve(value); }, () => { clearTimeout(timer); resolve(fallback); });
53
+ });
54
+ }
55
+ export async function detectAgents(options = {}) {
56
+ const started = Date.now();
57
+ const env = options.env ?? process.env;
58
+ const home = options.home ?? env["HOME"] ?? homedir();
59
+ const timeoutMs = options.timeoutMs ?? DETECT_TIMEOUT_MS;
60
+ const clock = options.clock ?? (() => new Date());
61
+ const path = (env["PATH"] ?? "").split(delimiter).filter(one => one !== "" && isAbsolute(one)).join(delimiter);
62
+ const check = options.check ?? createConnectionChecker({
63
+ home, env: env, clock,
64
+ probe: statusProbe({ env, timeoutMs, ...(options.untrusted === undefined ? {} : { untrusted: options.untrusted }),
65
+ ...(options.store === undefined ? {} : { store: options.store }), ...(options.databaseFile === undefined ? {} : { databaseFile: options.databaseFile }) }),
66
+ });
67
+ const routed = options.routed ?? null;
68
+ const one = async (row) => {
69
+ const base = { id: row.id, name: row.name };
70
+ const out = (state, how = null) => ({ ...base, state, how, signIn: state === "signed-out" || state === "unknown" ? row.signIn : null, ready: false, next: null });
71
+ if (isAcpProvider(row.id)) {
72
+ if (!inspectAcpAgent(row.id, { PATH: path }).found)
73
+ return out("not-installed");
74
+ const login = row.login;
75
+ return login.kind === "file" ? present(login.path(home, env)) ? out("signed-in", login.how) : out("signed-out") : out("unknown");
76
+ }
77
+ const resolved = resolveExecutable(row.binary, path);
78
+ if (row.login.kind === "key")
79
+ return resolved !== null && keySet("openrouter", home, env) ? out("signed-in", "API key") : out("not-installed");
80
+ if (row.login.kind === "gemini") {
81
+ if (resolved === null)
82
+ return out("not-installed");
83
+ if (readAuthMode("gemini", home) === "api-key")
84
+ return keySet("gemini", home, env) ? out("signed-in", "API key") : { ...out("signed-out"), signIn: GEMINI_KEY_SIGN_IN };
85
+ return present(join(home, ".gemini", "oauth_creds.json")) ? out("signed-in", "Google account") : out("signed-out");
86
+ }
87
+ const answer = await within(check(row.id).then(value => value), timeoutMs, null);
88
+ if (answer === null)
89
+ return out(resolved === null ? "not-installed" : "unknown");
90
+ if (answer.state === "not-installed" || (KEY_ANSWERS.has(answer.state) && resolved === null))
91
+ return out("not-installed");
92
+ if (SIGNED_IN.has(answer.state))
93
+ return out("signed-in", KEY_ANSWERS.has(answer.state) ? "API key" : answer.method ?? "signed in");
94
+ return out(SIGNED_OUT.has(answer.state) ? "signed-out" : "unknown");
95
+ };
96
+ const seen = await Promise.all(DETECTED_AGENTS.map(row => one(row).catch(() => ({ id: row.id, name: row.name, state: "unknown", how: null, signIn: row.signIn, ready: false, next: null }))));
97
+ const agents = seen.map(agent => withNext(agent, routed, options.acpChecked));
98
+ return { agents, firstTask: firstTaskOf(agents, routed), routed, checkedAt: clock().toISOString(), tookMs: Date.now() - started };
99
+ }
100
+ export function withNext(agent, routed, acpChecked) {
101
+ if (agent.state === "not-installed")
102
+ return agent;
103
+ if (FIRST_TASK_ORDER.includes(agent.id)) {
104
+ const ready = agent.state === "signed-in" && (routed === null || routed === agent.id);
105
+ return { ...agent, ready, next: agent.state === "signed-in" && !ready ? CHOOSE_AGENT : null };
106
+ }
107
+ if (isAcpProvider(agent.id)) {
108
+ const checked = acpChecked?.(agent.id) ?? false;
109
+ const ready = checked && routed === agent.id && agent.state !== "signed-out";
110
+ const next = ready ? null : !checked ? `To give it tasks, check it once: run \`toolroll agents check ${agent.id} --model <model>\`.` : routed !== agent.id ? CHOOSE_MODELS : null;
111
+ return { ...agent, ready, next };
112
+ }
113
+ const ready = agent.state === "signed-in" && routed === agent.id;
114
+ return { ...agent, ready, next: ready ? null : CHOOSE_MODELS };
115
+ }
116
+ export function firstTaskOf(agents, routed) {
117
+ if (routed !== null)
118
+ return agents.find(one => one.id === routed && one.ready)?.id ?? null;
119
+ for (const id of FIRST_TASK_ORDER)
120
+ if (agents.some(one => one.id === id && one.ready))
121
+ return id;
122
+ return null;
123
+ }
124
+ export const NO_AGENT_YET = "No coding agent can take tasks on this computer yet.";
125
+ const nameOf = (id) => DETECTED_AGENTS.find(one => one.id === id)?.name ?? id;
126
+ export function firstRunAgentLines(rows, firstTask, checking = false, routed = null) {
127
+ if (firstTask !== null)
128
+ return [`Your first task goes to ${nameOf(firstTask)}.`];
129
+ if (checking)
130
+ return ["Looking for agents on this computer…"];
131
+ const installed = rows.filter(one => one.state !== "not-installed");
132
+ const install = ["Install one:", ...DETECTED_AGENTS.filter(one => one.install !== null).map(one => ` ${one.name}: run \`${one.install} && ${one.signIn}\``)];
133
+ if (installed.length === 0)
134
+ return install;
135
+ const lines = [];
136
+ const target = routed === null ? null : DETECTED_AGENTS.find(one => one.id === routed) ?? null;
137
+ if (target !== null && !installed.some(one => one.id === target.id)) {
138
+ lines.push(`Your tasks go to ${target.name}, which isn't installed here.${target.install === null ? "" : ` Install it: run \`${target.install} && ${target.signIn}\``}`);
139
+ }
140
+ for (const one of installed) {
141
+ if (one.state === "signed-in") {
142
+ if (one.next !== null)
143
+ lines.push(`${one.name} is signed in. ${one.next}`);
144
+ continue;
145
+ }
146
+ if (one.signIn !== null)
147
+ lines.push(`Sign in to ${one.name}: run \`${one.signIn}\`${one.state === "unknown" ? " (its sign-in couldn't be checked)" : ""}`);
148
+ }
149
+ return lines.length > 0 ? lines : install;
150
+ }
151
+ export function detectionLines(detection) {
152
+ return detection === null ? firstRunAgentLines([], null, true) : firstRunAgentLines(detection.agents, detection.firstTask, false, detection.routed);
153
+ }
154
+ const STATE_WORDS = { "signed-in": "signed in", "signed-out": "not signed in", unknown: "installed, sign-in unknown", "not-installed": "not installed" };
155
+ export function detectionReport(detection) {
156
+ const width = Math.max(...detection.agents.map(one => one.name.length));
157
+ return [
158
+ "Agents on this computer",
159
+ ...detection.agents.map(one => ` ${one.name.padEnd(width)} ${STATE_WORDS[one.state]}${one.state === "signed-in" && one.how !== null ? ` (${one.how})` : ""}`),
160
+ "",
161
+ ...detectionLines(detection),
162
+ ];
163
+ }
164
+ const npm = (pkg) => ({ install: `npm install -g ${pkg}`, installRun: { binary: "npm", args: ["install", "-g", pkg] } });
165
+ const ACP_CHECK = (id) => `toolroll agents check ${id} --model <model>`;
166
+ export const AGENT_SETUP = Object.freeze({
167
+ claude: { ...npm("@anthropic-ai/claude-code"), signIn: "claude auth login", signInRun: { binary: "claude", args: ["auth", "login"] }, key: null, check: null,
168
+ note: "Flexible threads bill your Claude plan through Toolroll's relay, which needs a long-lived token: run `claude setup-token` in your own terminal (it prints the token, so Toolroll never runs it for you)." },
169
+ codex: { ...npm("@openai/codex"), signIn: "codex login", signInRun: { binary: "codex", args: ["login"] }, key: null, check: null, note: null },
170
+ gemini: { ...npm("@google/gemini-cli"), signIn: "gemini", signInRun: { binary: "gemini", args: [] },
171
+ key: "Or run it on an API key: switch it with `toolroll keys auth gemini api-key`, then pipe the key in with `toolroll keys set gemini < key.txt` (or paste it in Settings → Agents in the browser).", check: null,
172
+ note: "Its sign-in starts Gemini CLI: choose Login with Google, finish in the browser, then type /quit." },
173
+ openrouter: { install: null, installRun: null, signIn: null, signInRun: null,
174
+ key: "It runs on an OpenRouter key through Codex: pipe the key in with `toolroll keys set openrouter < key.txt` (or paste it in Settings → Agents in the browser), then choose its models.", check: null,
175
+ note: "Install Codex first: OpenRouter runs through it." },
176
+ opencode: { ...npm("opencode-ai"), signIn: ACP_AGENTS.opencode.signIn, signInRun: { binary: "opencode", args: ["auth", "login"] }, key: null, check: ACP_CHECK("opencode"), note: null },
177
+ cursor: { install: "curl https://cursor.com/install -fsS | bash", installRun: null, signIn: ACP_AGENTS.cursor.signIn, signInRun: { binary: "cursor-agent", args: ["login"] }, key: null, check: ACP_CHECK("cursor"), note: null },
178
+ cline: { ...npm("cline"), signIn: ACP_AGENTS.cline.signIn, signInRun: { binary: "cline", args: ["auth"] }, key: null, check: ACP_CHECK("cline"), note: null },
179
+ qwen: { ...npm("@qwen-code/qwen-code"), signIn: ACP_AGENTS.qwen.signIn, signInRun: { binary: "qwen", args: [] }, key: null, check: ACP_CHECK("qwen"),
180
+ note: "Its sign-in starts Qwen Code: type /auth and finish in the browser, then /quit." },
181
+ goose: { install: "curl -fsSL https://github.com/block/goose/releases/download/stable/download_cli.sh | bash", installRun: null, signIn: ACP_AGENTS.goose.signIn,
182
+ signInRun: { binary: "goose", args: ["configure"] }, key: null, check: ACP_CHECK("goose"), note: null },
183
+ });
184
+ export function agentSetupOf(id) {
185
+ return Object.prototype.hasOwnProperty.call(AGENT_SETUP, id) ? AGENT_SETUP[id] : null;
186
+ }
187
+ export function npmRegistryOf(home, pkg) {
188
+ const file = join(home, ".npmrc");
189
+ try {
190
+ const seen = statSync(file);
191
+ if (!seen.isFile() || seen.size > 64 * 1024)
192
+ return { url: null, unsure: seen.isFile() };
193
+ }
194
+ catch {
195
+ return { url: null, unsure: false };
196
+ }
197
+ let text;
198
+ try {
199
+ text = readFileSync(file, "utf8");
200
+ }
201
+ catch {
202
+ return { url: null, unsure: true };
203
+ }
204
+ const scope = pkg.startsWith("@") ? pkg.split("/")[0] : null;
205
+ let scoped = null, plain = null, unsure = false;
206
+ for (const raw of text.split(/\r?\n/)) {
207
+ const line = raw.trim();
208
+ if (line === "" || line.startsWith("#") || line.startsWith(";") || line.startsWith("["))
209
+ continue;
210
+ const eq = line.indexOf("=");
211
+ if (eq < 0)
212
+ continue;
213
+ const key = line.slice(0, eq).trim(), value = line.slice(eq + 1).trim().replace(/^"(.*)"$/, "$1");
214
+ const isRegistry = key === "registry" || /^@[^:]+:registry$/.test(key);
215
+ if (!isRegistry) {
216
+ if (/registry/i.test(key) && !key.startsWith("//"))
217
+ unsure = true;
218
+ continue;
219
+ }
220
+ if (value.includes("${")) {
221
+ unsure = true;
222
+ continue;
223
+ }
224
+ if (key === "registry")
225
+ plain = value;
226
+ else if (scope !== null && key === `${scope}:registry`)
227
+ scoped = value;
228
+ }
229
+ const chosen = scoped ?? plain;
230
+ if (chosen === null)
231
+ return { url: null, unsure };
232
+ let url;
233
+ try {
234
+ url = new URL(chosen);
235
+ }
236
+ catch {
237
+ return { url: null, unsure: true };
238
+ }
239
+ if (url.protocol !== "https:" && url.protocol !== "http:")
240
+ return { url: null, unsure: true };
241
+ if (url.hostname === "registry.npmjs.org")
242
+ return { url: null, unsure };
243
+ return { url: `${url.protocol}//${url.host}${url.pathname}`.replace(/[\u0000-\u001f\u007f]/g, ""), unsure };
244
+ }
@@ -13,9 +13,11 @@ import { ensureGitViewsRoot, gitViewsRoot } from "./git-views.js";
13
13
  import { ensureRunnerProcessFolder, RUNNER_PROCESS_DIR } from "./runner-process.js";
14
14
  import { DEPS_FOLDER, linkedKey, readyCopy, sharedCopies } from "./shared-deps.js";
15
15
  import { SEATBELT_PROBE, sandboxRuntimeProblem, srtSpawn } from "./sandbox-runtime.js";
16
+ import { seccompHelperPath } from "./sandbox-tools.js";
16
17
  import { protectedStorageDenies, protectedStorageNames } from "./protected-storage.js";
17
18
  import { ensureSecretsDir, legacyLoginFileOf, SECRETS_DIR, secretsDirOf } from "./login-secrets.js";
18
19
  import { getDefaultWritePaths } from "@anthropic-ai/sandbox-runtime";
20
+ export const FLEXIBLE_THREADS_DIR = "threads";
19
21
  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;
20
22
  function real(path) {
21
23
  try {
@@ -97,6 +99,7 @@ export function trustedWorktreeBinding(repository, worktree, poolRoots = []) {
97
99
  export function agentFence(options) {
98
100
  const fence = new Set();
99
101
  let runFolder = null;
102
+ const literal = new Set();
100
103
  const home = real(options.home ?? homedir());
101
104
  const worktree = options.worktree === null ? null : real(options.worktree);
102
105
  if (options.databaseFile !== null && options.databaseFile !== "" && options.databaseFile !== ":memory:") {
@@ -133,6 +136,30 @@ export function agentFence(options) {
133
136
  catch { }
134
137
  fence.add(backups);
135
138
  fence.add(real(backups));
139
+ const threads = join(state, FLEXIBLE_THREADS_DIR);
140
+ try {
141
+ mkdirSync(threads, { mode: 0o700 });
142
+ }
143
+ catch (error) {
144
+ if (error.code !== "EEXIST")
145
+ process.stderr.write(`toolroll: fence: couldn't make ${threads} (${error.message}); it is denied by name, and no Flexible thread starts\n`);
146
+ }
147
+ let threadsFolder = false, threadsThere = false;
148
+ try {
149
+ const held = lstatSync(threads);
150
+ threadsThere = true;
151
+ threadsFolder = held.isDirectory() && !held.isSymbolicLink();
152
+ }
153
+ catch {
154
+ threadsThere = false;
155
+ }
156
+ if (threadsThere && !threadsFolder)
157
+ process.stderr.write(`toolroll: fence: ${threads} isn't a folder (a link?); it is denied by name and never followed\n`);
158
+ const ownThread = threadsFolder && worktree !== null && (worktree === threads || inside(worktree, threads));
159
+ if (!ownThread) {
160
+ fence.add(threads);
161
+ literal.add(threads);
162
+ }
136
163
  const secrets = secretsDirOf(state);
137
164
  try {
138
165
  ensureSecretsDir(state);
@@ -179,7 +206,7 @@ export function agentFence(options) {
179
206
  fence.add(real(path));
180
207
  for (const path of options.boundary?.protectedShell ?? [])
181
208
  fence.add(real(path));
182
- const protectedPaths = new Set([...fence].flatMap(path => path === runFolder || [RUNNER_PROCESS_DIR, "backups", SECRETS_DIR].includes(basename(path)) ? [path, real(path)] : [real(path)]));
209
+ const protectedPaths = new Set([...fence].flatMap(path => literal.has(path) ? [path] : path === runFolder || [RUNNER_PROCESS_DIR, "backups", SECRETS_DIR].includes(basename(path)) ? [path, real(path)] : [real(path)]));
183
210
  const storage = options.protectedStorage ?? protectedStorageDenies(home);
184
211
  for (const path of storage) {
185
212
  protectedPaths.add(path);
@@ -189,7 +216,7 @@ export function agentFence(options) {
189
216
  fence.add(path);
190
217
  const binding = options.binding;
191
218
  const needed = binding === undefined || binding === null ? [] : [binding.gitdir, real(join(binding.main, ".git"))];
192
- return [...new Set([...[...fence].flatMap(path => path === runFolder || [RUNNER_PROCESS_DIR, "backups", SECRETS_DIR].includes(basename(path)) ? [path, real(path)] : [real(path)]), ...storage.flatMap(path => [path, real(path)])])].filter(path => {
219
+ return [...new Set([...[...fence].flatMap(path => literal.has(path) ? [path] : path === runFolder || [RUNNER_PROCESS_DIR, "backups", SECRETS_DIR].includes(basename(path)) ? [path, real(path)] : [real(path)]), ...storage.flatMap(path => [path, real(path)])])].filter(path => {
193
220
  if (protectedPaths.has(path) || !needed.some(target => target === path || inside(target, path)))
194
221
  return true;
195
222
  console.warn(`Dropped build fence entry covering this checkout's own Git data: ${path}`);
@@ -758,6 +785,8 @@ export function srtTermsOf(fence, grants = NO_GRANTS) {
758
785
  denyRead.add(name);
759
786
  denyWrite.add(name);
760
787
  }
788
+ for (const path of grants.readDenyOnly ?? [])
789
+ denyRead.add(real(path));
761
790
  for (const file of grants.signIns?.read ?? [])
762
791
  allowRead.add(file);
763
792
  const folders = grants.runFolders;
@@ -780,7 +809,8 @@ export function srtTermsOf(fence, grants = NO_GRANTS) {
780
809
  for (const root of pool.deny)
781
810
  denyRead.add(root);
782
811
  if (pool.own !== null)
783
- allowRead.add(pool.own);
812
+ for (const path of grants.ownReadBack ?? [pool.own])
813
+ allowRead.add(real(path));
784
814
  for (const path of codexPool(pool).deny)
785
815
  denyWrite.add(path);
786
816
  for (const sealed of pool.sealed ?? []) {
@@ -802,7 +832,8 @@ export function srtTermsOf(fence, grants = NO_GRANTS) {
802
832
  const writes = grants.writes;
803
833
  const signInWrites = [...grants.signIns?.writes ?? [], ...(grants.signIns?.transcripts ?? []).map(folder => join(folder, "*.jsonl"))];
804
834
  const allowOnly = writes === undefined ? ["/", ...(pool?.own == null ? [] : [real(pool.own)]), ...(folders?.own == null ? [] : [folders.own])]
805
- : [...writes.subpaths, ...writes.prefixes.map(one => `${one.path}*`), ...signInWrites, ...getDefaultWritePaths({ denyRead: readConfig.denyOnly, allowRead: readConfig.allowWithinDeny })];
835
+ : [...writes.subpaths, ...writes.prefixes.map(one => `${one.path}*`), ...signInWrites, ...getDefaultWritePaths({ denyRead: readConfig.denyOnly, allowRead: readConfig.allowWithinDeny })
836
+ .filter(path => grants.noSharedTemp !== true || !SHARED_TEMP.includes(path))];
806
837
  const network = grants.network;
807
838
  return {
808
839
  readConfig,
@@ -816,6 +847,7 @@ export function srtTermsOf(fence, grants = NO_GRANTS) {
816
847
  },
817
848
  };
818
849
  }
850
+ const SHARED_TEMP = ["/tmp/claude", "/private/tmp/claude"];
819
851
  export function sandboxedSpawn(file, args, fence, grants = NO_GRANTS, cwd, temp) {
820
852
  return srtSpawn(file, args, srtTermsOf(fence, grants), cwd ?? process.cwd(), temp);
821
853
  }
@@ -875,7 +907,7 @@ export function fenceFor(kind, ctx) {
875
907
  const storage = ctx.storage?.denies ?? protectedStorageDenies(ctx.home ?? homedir());
876
908
  const fence = agentFence({ databaseFile: ctx.databaseFile, worktree: ctx.worktree, ...home, boundary: ctx.boundary, binding: ctx.binding, runFolders: ctx.runFolders, extra: [...ctx.extra ?? [], ...ctx.readDeny ?? []], protectedStorage: storage });
877
909
  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 });
878
- const made = { ...found, readOnly: [...new Set([...found.readOnly, ...toolrollInstall(ctx.worktree, ctx.home ?? homedir(), ctx.binding?.main ?? null)])].sort() };
910
+ const made = installDenied(found, ctx.worktree, ctx.home ?? homedir(), ctx.binding?.main ?? null);
879
911
  const written = ctx.writes ?? null;
880
912
  const exact = ctx.exactFile ?? null;
881
913
  const grants = {
@@ -905,6 +937,9 @@ export function sealedScratch(poolRoots, named) {
905
937
  }
906
938
  return [...out].sort();
907
939
  }
940
+ export function installDenied(grants, worktree, home, repository = null) {
941
+ return { ...grants, readOnly: [...new Set([...grants.readOnly, ...toolrollInstall(worktree, home, repository)])].sort() };
942
+ }
908
943
  export function toolrollInstall(worktree, home, repository = null) {
909
944
  const own = worktree === null ? null : real(worktree);
910
945
  const repo = repository === null ? null : real(repository);
@@ -922,6 +957,13 @@ export function toolrollInstall(worktree, home, repository = null) {
922
957
  catch {
923
958
  runtime = [];
924
959
  }
960
+ const helper = seccompHelperPath();
961
+ if (helper !== null) {
962
+ try {
963
+ runtime.push(dirname(realpathSync(helper)));
964
+ }
965
+ catch { }
966
+ }
925
967
  const candidates = [resolve(dirname(fileURLToPath(import.meta.url)), ".."), ...runtime, dirname(dirname(real(process.execPath))), real(process.execPath)].map(real);
926
968
  const homeReal = real(home);
927
969
  return [...new Set(candidates)].filter(path => path !== dirname(path) && path !== homeReal && !inside(homeReal, path)
@@ -3,8 +3,9 @@ import { stuckSince } from "./agent-board.js";
3
3
  import { wasInterrupted } from "./run-ending.js";
4
4
  import { flowDefinitionOf } from "./flow-engine.js";
5
5
  import { runActivityOf } from "./task-activity.js";
6
- import { workStateRows } from "./work-index.js";
6
+ import { prefetchResultRuns, workStateRows } from "./work-index.js";
7
7
  import { assignmentChecksForRun } from "./assignment.js";
8
+ import { workReadsOf } from "./work-reads.js";
8
9
  import { DISPLAY_STATES, NO_COUNTS, rollUp } from "./agent-state-words.js";
9
10
  export { DISPLAY_STATES, NEEDS_SOMEONE, NO_COUNTS, rollUp, STATE_TONE, STATE_WORDS } from "./agent-state-words.js";
10
11
  export function displayStateOf(facts) {
@@ -74,8 +75,10 @@ export function projectStates(store, access, account, now, root, flowRepos) {
74
75
  AND NOT EXISTS (SELECT 1 FROM agent_seen s WHERE s.account = ? AND s.run = r.id)`).all(completed, account).map(row => Number(row["id"])));
75
76
  const resultFacts = new Map(store.handle.prepare(`SELECT r.id, r.outcome, (SELECT c.status FROM run_check c WHERE c.run = r.id) AS recorded FROM run r
76
77
  WHERE r.id IN (SELECT value FROM json_each(?))`).all(JSON.stringify(families.flatMap(row => row.resultRun ?? []))).map(row => [Number(row["id"]), row]));
78
+ const reads = workReadsOf(store), reader = reads?.store ?? store;
79
+ prefetchResultRuns(store, families.flatMap(row => (row.code === "ready-to-check" || row.code === "result-needs-attention") && row.resultRun !== null ? [row.resultRun] : []), reads);
77
80
  const checksFailed = (run) => {
78
- const status = assignmentChecksForRun(store, root, run, now).status;
81
+ const status = assignmentChecksForRun(reader, root, run, now).status;
79
82
  if (status === "failed" || status === "passed")
80
83
  return status === "failed";
81
84
  return resultFacts.get(run)?.["recorded"] === "failed";
@@ -62,7 +62,7 @@ export function resolvePhaseAgent(store, phase, repo, flags, ref) {
62
62
  const valid = validateSpec(spec);
63
63
  return valid.ok ? { ok: true, spec, source: flags.model !== undefined ? "flag" : source } : { ok: false, problem: valid.problem };
64
64
  }
65
- export function resolveScopeProfile(store, repo, ref, flags, platform = process.platform) {
65
+ export function resolveScopeProfile(store, repo, ref, flags, platform = process.platform, options = {}) {
66
66
  const build = resolvePhaseAgent(store, "build", repo, flags, ref);
67
67
  if (!build.ok)
68
68
  return { ok: false, reason: "unknown-provider", problem: build.problem };
@@ -147,7 +147,7 @@ export function resolveScopeProfile(store, repo, ref, flags, platform = process.
147
147
  repairTimeoutSeconds: CODEX_SHAPED_LIMITS.repairTimeoutSeconds,
148
148
  repairModel,
149
149
  };
150
- const network = resolveNetwork(provider, repo === null ? PROJECT_NETWORK_DEFAULT : store.projectNetwork(repo), repo === null ? [] : repositoryEcosystems(repo));
150
+ const network = resolveNetwork(provider, repo === null ? PROJECT_NETWORK_DEFAULT : store.projectNetwork(repo), repo === null || options.walk === false ? [] : repositoryEcosystems(repo));
151
151
  const writes = repo === null ? WRITES_DEFAULT : store.projectWrites(repo);
152
152
  const checkAccess = repo === null ? "sandboxed" : checkAccessHere(store.projectCheckAccess(repo), platform);
153
153
  const sandbox = repo === null ? PROJECT_SANDBOX_DEFAULT : store.projectSandbox(repo);