viewable-one 0.12.8 → 0.12.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -13,6 +13,91 @@ package.
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
+ ## [0.12.9] - 2026-11-25
17
+
18
+ ### Added
19
+
20
+ - An ask on Your computer reads the apps you connected in Viewable through
21
+ Viewable (#8261). When its plan reads apps, Claude Code and Codex are told
22
+ to read them with the board's `app_read` instead of a command line such as
23
+ `gh`, to land a table or chart from that read, and to stop and say so when
24
+ a read is refused. An ask that only reads runs in the folder with no copy
25
+ and with tools that only read: no `Write`, `Edit` or commands on Claude
26
+ Code, the read-only sandbox on Codex, and none of the computer's own apps.
27
+
28
+ ### Fixed
29
+
30
+ - An ask on Your computer that changed no file no longer leaves its own copy
31
+ of the folder (a `.claude/worktrees/glytch-*` folder and its branch) behind.
32
+ Every ended ask removes its copy when nothing in it changed, whether it was
33
+ a one-off or a session; a copy with changes stays until Keep or Throw away,
34
+ as before. A reply to an ask whose empty copy was removed gets the copy back at the
35
+ same place, so the conversation carries on instead of stopping at "its
36
+ separate copy is gone"; an ask you stopped keeps its conversation the same
37
+ way. A copy a preview is running from is kept. When the runner starts
38
+ it also clears the empty copies earlier asks left behind, and finishes
39
+ marking any it removed but could not yet tell the board about (#8266).
40
+ - Signing the computer in again as another account now replaces the old
41
+ sign-in instead of keeping it beside the new one. Before, a browser sign-in
42
+ over a saved personal token kept sending the old token, and a personal token
43
+ over a browser sign-in fell back to the old account once the token was
44
+ refused, so requests could run as the other account. A computer still
45
+ holding both kinds of sign-in asks for `viewable login` once (#8324).
46
+ - Words typed on a permission or an app's approval are always a no plus the
47
+ words, never a grant, even when they spell a button's label ("Allow",
48
+ "Allow for this run" or an Always label). Before, typing exactly "Allow"
49
+ allowed it. The runner reads whether the answer was typed, and also refuses
50
+ the app's "Not this: <words>" answer from a board that does not say so yet.
51
+ Claude and Codex alike (#8224).
52
+ - A computer whose sign-in renewal got no answer (the network dropped while it
53
+ renewed) no longer stays offline for ever without a word. The runner tries
54
+ the renewal again after a short wait (2 minutes, then 4, up to 30), never
55
+ twice inside the window where the board would read it as the same request,
56
+ and stops at the first real refusal. If the board did get the first one, the
57
+ second cancels that sign-in and the app shows "Not connected" with "Connect
58
+ again", not "Offline". The log and `viewable doctor` say "The last renewal
59
+ got no answer. Trying again." instead of "expired and cannot be renewed"
60
+ (#8221).
61
+ - An ask in a folder that is a git repo with no commit yet (a fresh `git init`)
62
+ no longer fails with "chat worktree could not be created". The chat runs in
63
+ the folder itself, as a coding session already did, and nothing is written to
64
+ the repo. The two refusal lines no longer say "worktree".
65
+ - A person's app that is left out of a Claude Code run because it is a Viewable
66
+ board server (one named `board` or `viewable`, say) now shows a line on the
67
+ run's card, as it does for Codex. Codex checks the board address from the
68
+ run's own environment, and refuses a question for another board server's
69
+ tools, as Claude Code does, instead of asking. A launch that fails early no
70
+ longer leaves its `viewable-mcp-*` folder in the temp directory.
71
+ - With "Use my computer's apps" on, a run no longer loads another Viewable
72
+ board server beside its own: the person's own board server, maybe signed in
73
+ to another account, is left out for Claude Code, Codex and opencode,
74
+ whatever its name or where it came from. Before, the agent could pick its
75
+ tools, so a question never reached the run's board, and one Allow on "Use
76
+ report in glytch?" wrote to the other account's boards. Claude Code keeps
77
+ its strict server list with the apps on and gets the person's own servers
78
+ in a private file; its plugins and claude.ai connectors stay off for now. A
79
+ call to another board server's tools is refused without a question (#7550).
80
+
81
+ - On Codex, the first run in a newly set up folder no longer stops with
82
+ "failed to load workspace requirements: invalid data" (apps on) or "Couldn't
83
+ read the apps" (apps off), so there is no need to press Try again. Codex
84
+ trusts a new folder only when the run starts and then loads the folder's own
85
+ apps; the runner now reads the apps again once and starts Codex again with
86
+ them. An app the check turns off keeps its address, which Codex needs to
87
+ accept the change (#7529).
88
+
89
+ - On Codex, a command that uses another login, a token or a saved key (for
90
+ example listing or reading the Supabase CLI's token file, reading the GitHub
91
+ CLI's token file, `gh auth token` or the Supabase CLI) is now refused before
92
+ it runs, and the agent is told to ask on the board. Before, a plain command
93
+ inside Codex's sandbox never reached the computer's check (#7466). If the
94
+ installed Codex cannot take this block, the Codex run does not start and
95
+ says to update Codex. Reading the GitHub CLI's token file is now refused for
96
+ every engine.
97
+ - With Claude Code's config folder moved (`CLAUDE_CONFIG_DIR`), the apps list
98
+ for "Use my computer's apps" now shows that folder's apps, not the ones in
99
+ your real home folder (#7516).
100
+
16
101
  ## [0.12.8] - 2026-11-19
17
102
 
18
103
  ### Fixed
package/README.md CHANGED
@@ -276,9 +276,14 @@ open](#reading-the-board-with-no-app-open).
276
276
  `list_sessions` and `send_message` are a PULL, not a push. Nothing holds a
277
277
  session's stdin open over the network, so a session is OPEN TO MESSAGES only
278
278
  while it keeps calling tools, STALE once it has gone quiet without closing,
279
- and FINISHED once it has. `send_message` refuses a STALE or FINISHED target,
280
- and a message to an OPEN one is delivered the next time that session calls
281
- `collect_session`.
279
+ and FINISHED once it has. A message to an OPEN or STALE session waits for it
280
+ and is delivered the next time that session calls `collect_session`; the
281
+ answer says when it was last heard. `list_sessions` shows how many messages
282
+ wait for each session, so a script on your side can tell an idle agent to
283
+ collect them. `send_message` refuses a FINISHED target unless that session
284
+ said something on its side wakes it (`introduce` with `door`). The receiver
285
+ sees the message as from your session's own name; the `from` you pass is not
286
+ used.
282
287
 
283
288
  There is deliberately no way to answer a question or run an idea from these
284
289
  tools. Questions are yours to answer. A run uses your own Claude Code or Codex plan.
package/SPAWN.md CHANGED
@@ -606,6 +606,19 @@ the same `newOpId` shape the ops channel uses).
606
606
  Codex thread is started with web search disabled, whatever the computer's
607
607
  own Codex config says. It is the agent's Web search setting in Manage
608
608
  agent. A value that is not a boolean is refused.
609
+ - `readApps` (optional list of app ids, #8261) names the apps connected in
610
+ Viewable that this ask's plan reads. The session is told to read them with
611
+ the board's `app_read` and nothing else, and to land a table or chart from
612
+ the read it holds with `set_live_card` `{ shape, read_ref, columns }`
613
+ (Claude Code and Codex, the same words, #7581); board-mcp reads only these
614
+ apps for the running ask (#8254). Absent, the run is not told `app_read`
615
+ exists. A value that is not a list of non-empty ids is refused.
616
+ - `readOnly` (optional boolean, #8261) is an ask that only reads: it runs in
617
+ the linked folder with no worktree, Claude Code with only `Read`, `Glob`,
618
+ `Grep`, the Task tools and the board (`--tools` takes the rest away, so no
619
+ `Write`, `Edit`, `Bash` or web tools), Codex in its read-only sandbox with
620
+ its board server kept and no web search. Neither loads the computer's own
621
+ apps (`computerApps` is ignored). A value that is not a boolean is refused.
609
622
 
610
623
  ### `<id>.claim` - who owns it
611
624
 
@@ -1299,7 +1312,7 @@ new field.**
1299
1312
  to do on the path a person waits on for every message they type.
1300
1313
  3. **No repo primer and no attempts log**, and no runner preamble. All three
1301
1314
  exist to save a FRESH session from rediscovery, and every sentence of the
1302
- preamble is about a frame ("call `report` before you finish...") that a
1315
+ preamble is about a card ("end with your closing message...") that a
1303
1316
  chat turn does not have. What a chat turn is told is the app's to compose:
1304
1317
  persona, the room's context blocks, his message.
1305
1318
  4. **A per-ROOM lock instead of the per-prompt one.** OVER ROWS (brief 30
@@ -1575,7 +1588,11 @@ teammate. The contract tells the session to answer through `propose` with an
1575
1588
  `addComment` op and no `id` (it lands as its reply on its own idea), to attach
1576
1589
  pictures with `images` (up to 6, data URLs) and to ask about what it saw, or
1577
1590
  choose between looks, with `ask_user` and `images` as `{image, caption}` (#5534). It also tells the session not to file a closing reply
1578
- of its own, because the runner files one.
1591
+ of its own, because the runner files one. An ask for a table, chart, list,
1592
+ timeline or kanban goes on the board as a drawn card (`drawnCardRule`,
1593
+ #8102); the hosted board refuses a report line or reply that says one was
1594
+ made when the session made none, and takes the sentence out of the runner's
1595
+ closing reply instead.
1579
1596
 
1580
1597
  The hosted board enforces it (#4153): a run's second reply in its idea's
1581
1598
  conversation, with no person's note after its first, is refused and names
@@ -1653,7 +1670,9 @@ present: `41 turns, 38m, context 212k`.
1653
1670
  **Where it lands:**
1654
1671
 
1655
1672
  - `reportOutcomeOnBoard` writes the one closing reply on the run's idea, and
1656
- only for a session that finished (see "The conversation on an idea"). Its
1673
+ only for a session that finished (see "The conversation on an idea"). It
1674
+ goes through the run's hosted transport (`runnerExecute.mjs`), which names
1675
+ the run's board as `X-Glytch-Board` (#7489); a refusal is logged. Its
1657
1676
  figures line reads "Finished;" then turns and time, without context or
1658
1677
  cost. The words above stay exactly as they are in the row's
1659
1678
  `result`: the app parses them (`verdictOf`, `resultTail`).
@@ -1722,10 +1741,11 @@ unscoped, so the session may write any path the process can reach.
1722
1741
  | tools | anything not on `CLAUDE_TOOLS` | everything on it |
1723
1742
  | interactive prompts | `EnterPlanMode`, `AskUserQuestion` | - |
1724
1743
  | clicking or typing in other apps (#4204) | Claude Code: `osascript`, `screencapture`, `cliclick` as a command's first word (`CLAUDE_CLICK_AND_SCREEN_TOOLS`); then on every Claude ask and Codex escalation, any command with one of them as a word, whatever "Allow for this run" or a saved rule says (`drivesAnotherApp`, permissionAsk.mjs); both agents are told in words | the same program started from `node -e` or a script, and a Codex command that runs without asking inside its sandbox |
1725
- | another login, token or saved key (#6995) | Claude Code (both paths and ACP): the Supabase CLI, also as `npx supabase` and `npm exec supabase`, `git credential` (also after git's own options), and reading `~/.supabase/`, also by a shell command that names its token file (`CLAUDE_OTHER_LOGIN_TOOLS`, otherLogins.mjs); on every Claude or ACP ask and Codex escalation, the Supabase CLI, the keychain, password managers, `gh auth token` and git's credential helpers at any command in the line, also inside `sh -c`, `eval`, `$( )` or a package runner, whatever "Allow for this run" or a saved rule says (`usesAnotherLogin`); opencode by its own `permission.bash` deny patterns; every engine is told in words to ask with the reason instead | the same program started from `node -e`, `npm run <script>` or a script, a token file read some other way, and a command that runs inside Codex's sandbox after the person granted it the network |
1744
+ | another login, token or saved key (#6995) | Claude Code (both paths and ACP): the Supabase CLI, also as `npx supabase` and `npm exec supabase`, `git credential` (also after git's own options), and reading `~/.supabase/`, also by a shell command that names its token file (`CLAUDE_OTHER_LOGIN_TOOLS`, otherLogins.mjs); on every Claude or ACP ask and Codex escalation, the Supabase CLI, the keychain, password managers, `gh auth token` and git's credential helpers at any command in the line, also inside `sh -c`, `eval`, `$( )` or a package runner, whatever "Allow for this run" or a saved rule says (`usesAnotherLogin`); opencode by its own `permission.bash` deny patterns; Codex by its PreToolUse hook (`codexOtherLoginArgs`, otherLoginHook.mjs), which runs `usesAnotherLogin` on every command before it runs, also inside its sandbox, trusted by its hash on the command line; a Codex whose `hooks/list` does not show that hook trusted is not given the run (#7466); every engine is told in words to ask with the reason instead. The token files are `~/.supabase/access-token` and `~/.config/gh/hosts.yml` | the same program started from `node -e`, `npm run <script>` or a script, a token file read some other way, and on Codex text typed into a shell the run already opened (`write_stdin` runs no hook) |
1726
1745
  | arbitrary code | - | `node -e`, `npx <anything>` |
1727
1746
  | writes | the checkout you are looking at (the **worktree** does this, not the list) | any other path the process can reach |
1728
1747
  | money | wall clock, no retry | - |
1748
+ | a run that only reads (`readOnly`, #8261) | Claude Code: every built-in tool but `Read`, `Glob`, `Grep` and the Task tools (`--tools`), so no `Write`, `Edit` or `Bash`; Codex: writes and network, by its read-only sandbox | Codex commands that only read, and what its board tools write on the board |
1729
1749
 
1730
1750
  **The specific hole this opens.** A child gets `PM_BOARD_ROOT` (`childEnv`)
1731
1751
  and has `Write`, so it can file its own `.glytch/inbox/spawn/<id>.json`
package/glytch.mjs CHANGED
@@ -46,7 +46,7 @@ import { allGreen, doctorRows } from "./lib/doctor.mjs";
46
46
  import { loginDaemon, noDaemonInstall } from "./lib/logindaemon.mjs";
47
47
  import { makeFileLogger } from "./lib/logs.mjs";
48
48
  import { watchRegistered } from "./lib/multiwatch.mjs";
49
- import { readRegistry, registryPath, removeFolder, touchRegistry, withRegistryLock } from "./lib/registry.mjs";
49
+ import { readRegistry, registryPath, removeFolder, touchRegistry } from "./lib/registry.mjs";
50
50
  import { settingsFromEnv, newRunnerId, registerAndFindProject } from "./lib/runner.mjs";
51
51
  import { syncFolder, syncRegistry } from "./lib/sync.mjs";
52
52
  import { SETUP_HEALTH_SLOW_MS, SETUP_HEALTH_WAIT_MS, hasFreshBeat, waitForRunnerHealth, writeRunnerHealth } from "./lib/runner-health.mjs";
@@ -404,9 +404,10 @@ async function forget() {
404
404
  const color = colorEnabled();
405
405
  const root = resolve(process.cwd());
406
406
  say(heading("Viewable · Forget project", { color }));
407
- // Under the registry lock the daemon's start takes before it registers the
408
- // default folder, so a forget cannot land in the middle of that (#5290).
409
- const { removed } = await withRegistryLock(() => removeFolder(root));
407
+ // removeFolder takes the registry lock the daemon's start takes before it
408
+ // registers the default folder, so a forget cannot land in the middle of
409
+ // that (#5290).
410
+ const { removed } = await removeFolder(root);
410
411
  say(
411
412
  removed
412
413
  ? ok(`Forgot ${root}. Your computer keeps watching the ${(await readRegistry()).length} folder(s) left in ${registryPath()}.`, { color })
package/lib/agents.mjs CHANGED
@@ -78,7 +78,7 @@
78
78
  // `acpServersFor` below is where the server is described.
79
79
 
80
80
  import { adapterEntry } from "./acp.mjs";
81
- import { computerAppsOffRule, conversationRules, otherAppsRule, refusalRule } from "./conversationRules.mjs";
81
+ import { computerAppsOffRule, conversationRules, drawnCardRule, otherAppsRule, refusalRule } from "./conversationRules.mjs";
82
82
  import { CLAUDE_OTHER_LOGIN_TOOLS, OPENCODE_OTHER_LOGIN_RULES } from "./otherLogins.mjs";
83
83
  import { runEngineFor } from "./run-engine.mjs";
84
84
  // ONE LIST, not two: spawn.mjs's checkRequest is the validator a request
@@ -95,6 +95,11 @@ import { PLAN_MODE_AGENTS } from "./spawn.mjs";
95
95
  // SERVER_KEY, so this imports that one spelling rather than adding a fourth
96
96
  // copy of the literal.
97
97
  import { SERVER_KEY } from "./init-connect.mjs";
98
+ import { isBoardServer } from "./mcpjson.mjs";
99
+ import { readFile } from "node:fs/promises";
100
+ import { homedir } from "node:os";
101
+ import { dirname, join, resolve } from "node:path";
102
+ import { parse as parseJsonc } from "jsonc-parser";
98
103
  import { randomBytes } from "node:crypto";
99
104
 
100
105
  /** What a spawned session may do under Claude Code.
@@ -209,16 +214,28 @@ export const CLAUDE_DISALLOWED_TOOLS = [
209
214
  * one is a question in the idea ("Can I search the web?"). */
210
215
  export const CLAUDE_WEB_TOOLS = ["WebSearch", "WebFetch"];
211
216
 
217
+ /** THE READ-ONLY TOOL SET (#8261, Plan round 2 point 3 on #8251): an ask
218
+ * whose plan only reads apps gets the draft's read tools and the plan tools,
219
+ * with no Write, no Edit, no Bash and no web tools, so it can run in the
220
+ * linked folder with no copy and cannot send what it read anywhere but the
221
+ * board. `--tools` takes the rest away outright; the board server stays,
222
+ * because `--tools` names built-in tools only (Claude Code 2.1.332 help). */
223
+ export const CLAUDE_READ_ONLY_TOOLS = ["Read", "Glob", "Grep", "TaskCreate", "TaskUpdate", "TaskList", "TaskGet"];
224
+
212
225
  /** The allowlist for one run: the standing list, plus the web tools when the
213
- * request switched web search on. A plain function of the request, so the
214
- * one-shot and streaming command lines cannot disagree. */
226
+ * request switched web search on, or the read-only set with the board when
227
+ * the request only reads (`readOnly`). A plain function of the request, so
228
+ * the one-shot and streaming command lines cannot disagree. */
215
229
  export const claudeToolsFor = (wants = {}) => {
216
- const tools = wants.boardServerKey
217
- ? CLAUDE_TOOLS.map(tool => tool === `mcp__${SERVER_KEY}` ? `mcp__${wants.boardServerKey}` : tool)
218
- : CLAUDE_TOOLS;
230
+ const board = `mcp__${wants.boardServerKey || SERVER_KEY}`;
231
+ if (wants.readOnly === true) return [...CLAUDE_READ_ONLY_TOOLS, board];
232
+ const tools = CLAUDE_TOOLS.map(tool => tool === `mcp__${SERVER_KEY}` ? board : tool);
219
233
  return wants.webSearch === true ? [...tools, ...CLAUDE_WEB_TOOLS] : tools;
220
234
  };
221
235
 
236
+ /** `--tools` for a read-only run: the built-in tools it may have at all. */
237
+ const readOnlyToolsArgs = (wants) => (wants.readOnly === true ? ["--tools", CLAUDE_READ_ONLY_TOOLS.join(",")] : []);
238
+
222
239
  export const AGENTS = {
223
240
  codex: {
224
241
  label: "Codex", bin: "codex", binEnv: "PM_CODEX_BIN", argsEnv: "PM_CODEX_ARGS",
@@ -276,6 +293,7 @@ export const AGENTS = {
276
293
  "--verbose",
277
294
  "--permission-mode",
278
295
  "acceptEdits",
296
+ ...readOnlyToolsArgs(wants),
279
297
  "--allowedTools",
280
298
  claudeToolsFor(wants).join(" "),
281
299
  // Variadic like --allowedTools, and for the same reason it sits after
@@ -309,6 +327,7 @@ export const AGENTS = {
309
327
  "--replay-user-messages",
310
328
  "--permission-mode", "acceptEdits",
311
329
  ...(wants.askPermissions === true ? ["--permission-prompt-tool", "stdio"] : []),
330
+ ...readOnlyToolsArgs(wants),
312
331
  "--allowedTools", claudeToolsFor(wants).join(" "),
313
332
  // The streaming path is the one long sessions take, and it is exactly
314
333
  // where spawn-mtf3xbm7 parked - so the same tools are barred here.
@@ -652,8 +671,11 @@ export function commandFor(agent, env = process.env, wants = {}) {
652
671
  // character, and a longer name would push the computer-apps --settings
653
672
  // past Windows' command-line limit. src/components/run/runWords.ts
654
673
  // matches this `v` + five hex shape to read the calls as board work.
674
+ // The caller may make the key first, so the prompt can name the run's own
675
+ // board tools by it (#7550, runnerExecute.mjs).
655
676
  const asked = { ...wants, env, ...(agentFor(agent) === "claude"
656
- ? { boardServerKey: boardRunKey() } : {}) };
677
+ ? { boardServerKey: typeof wants.boardServerKey === "string" && /^v[0-9a-f]{5}$/.test(wants.boardServerKey) ? wants.boardServerKey : boardRunKey() } : {}) };
678
+ let mcpConfigFile = null;
657
679
  let args = asked.streaming && spec.streamingArgs ? spec.streamingArgs(asked) : spec.args(asked);
658
680
  let overridden = false;
659
681
  if (typeof raw === "string" && raw.trim() !== "") {
@@ -753,17 +775,39 @@ export function commandFor(agent, env = process.env, wants = {}) {
753
775
  },
754
776
  }
755
777
  : {};
756
- // USE MY COMPUTER'S APPS (#481). Off, the default: strict, glytch
757
- // only, as above. On, for this one agent and this one person: the
758
- // strict flag goes, so the person's own Claude Code MCP servers load
759
- // beside glytch. Their tools are NOT added to --allowedTools, and an
760
- // ask rule covers every one of them, so a tool the person allowed in
761
- // their own settings before still asks each time; in -p mode that
762
- // ask is refused until the permission ask (#478) reaches the person.
763
- const apps = wants.computerApps === true
764
- ? ["--settings", JSON.stringify({ permissions: { ask: appAskRules(`mcp__${asked.boardServerKey}__`) } })]
765
- : ["--strict-mcp-config"];
766
- args = [...args, ...apps, "--mcp-config", JSON.stringify({ mcpServers })];
778
+ // USE MY COMPUTER'S APPS (#481). Off, the default: strict, the run's
779
+ // board only, as above. On, for this one agent and this one person:
780
+ // still strict (#7550), and the person's own Claude Code servers that
781
+ // the runner read (`appServers`, computerApps.mjs claudeAppServers)
782
+ // load beside the board. Dropping strict loaded every server Claude
783
+ // knows, a second Viewable board server among them, signed in to
784
+ // another account, whose same-named tools the model picked. Another
785
+ // board server is never passed, whoever handed it in; plugins and
786
+ // claude.ai connectors stay off (strict hides both, Claude Code
787
+ // 2.1.328; ENABLE_CLAUDEAI_MCP_SERVERS below says so again for
788
+ // connectors, without growing this command line).
789
+ //
790
+ // The app tools are NOT added to --allowedTools, and an ask rule
791
+ // covers every one of them, so a tool the person allowed in their own
792
+ // settings before still asks each time; in -p mode that ask is refused
793
+ // until the permission ask (#478) reaches the person.
794
+ //
795
+ // The servers' headers and env can hold the person's secrets, so with
796
+ // `mcpConfigPath` they go in a file the caller writes (0600) instead
797
+ // of the command line, where `ps` shows them and Windows caps the length.
798
+ // A run that only reads (#8261) never loads them: their tools could
799
+ // send what it read elsewhere. The board server alone.
800
+ if (wants.computerApps === true && wants.readOnly !== true) {
801
+ const apps = Object.fromEntries(Object.entries(wants.appServers && typeof wants.appServers === "object" ? wants.appServers : {})
802
+ .filter(([name, entry]) => name !== asked.boardServerKey && !isBoardServer(name, entry, { env })));
803
+ const config = JSON.stringify({ mcpServers: { ...mcpServers, ...apps } });
804
+ const settings = JSON.stringify({ permissions: { ask: appAskRules(`mcp__${asked.boardServerKey}__`) } });
805
+ const path = typeof wants.mcpConfigPath === "string" && wants.mcpConfigPath ? wants.mcpConfigPath : "";
806
+ if (path) mcpConfigFile = { path, text: config };
807
+ args = [...args, "--settings", settings, "--strict-mcp-config", "--mcp-config", path || config];
808
+ } else {
809
+ args = [...args, "--strict-mcp-config", "--mcp-config", JSON.stringify({ mcpServers })];
810
+ }
767
811
  }
768
812
  }
769
813
  // WHAT AN ACP ENGINE NEEDS THAT AN ARGUMENT LIST CANNOT CARRY. Model,
@@ -808,11 +852,21 @@ export function commandFor(agent, env = process.env, wants = {}) {
808
852
  // refused. Only when the runner can actually ask (it passes
809
853
  // `askPermissions` only with a board to ask on).
810
854
  askPermissions: wants.askPermissions === true,
811
- // The person turned web search on for this run.
812
- webSearch: wants.webSearch === true,
813
- computerApps: wants.computerApps === true,
855
+ // The person turned web search on for this run; never on a run that only reads (#8261).
856
+ webSearch: wants.webSearch === true && wants.readOnly !== true,
857
+ computerApps: wants.computerApps === true && wants.readOnly !== true,
858
+ // An ask that only reads apps (#8261): the read-only sandbox, with the
859
+ // board server kept, since codex answers MCP calls in its own process.
860
+ readOnly: wants.readOnly === true,
814
861
  } : null;
815
- return { bin, args, spec, ignored, acp, codex };
862
+ // Claude: the run's own board server key, which child.mjs's permission step
863
+ // exempts from the other-board refusal (#7550); the MCP config file the
864
+ // caller writes before the spawn; and claude.ai connectors off in every run
865
+ // (Claude Code reads this variable, checked on 2.1.328).
866
+ const claudeExtras = agentFor(agent) === "claude"
867
+ ? { boardServerKey: asked.boardServerKey, mcpConfigFile, env: { ENABLE_CLAUDEAI_MCP_SERVERS: "false" } }
868
+ : {};
869
+ return { bin, args, spec, ignored, acp, codex, ...claudeExtras };
816
870
  }
817
871
 
818
872
  /** Give an engine what it needs to reach the board, in the tree it will run in.
@@ -847,10 +901,24 @@ export function commandFor(agent, env = process.env, wants = {}) {
847
901
  * (SERVER_KEY), not `board` - the verification above predates the rename
848
902
  * and is kept dated rather than rerun, since it was checking the shape
849
903
  * `opencode mcp add` produces, not the key name. */
850
- export async function prepareWorkspace(agent, { mcpUrl, token, sessionKey, boardId }) {
904
+ export async function prepareWorkspace(agent, { mcpUrl, token, sessionKey, boardId, cwd, env = process.env, home, read }) {
851
905
  const spec = AGENTS[agentFor(agent)];
852
906
  if (!spec.needsBoardSetup) return { wrote: null };
853
- if (!mcpUrl || !token) return { wrote: null };
907
+ // ANOTHER BOARD SERVER, SWITCHED OFF (#7550). opencode merges its global
908
+ // config, every opencode.json from the folder up and this content, a later
909
+ // `{"enabled": false}` winning (checked on opencode 1.18.23 with a scratch
910
+ // HOME: a folder `viewable` entry and a global one at app.viewable.one both
911
+ // read "disabled"). It runs --auto, so a second board server's calls would
912
+ // need no Allow at all. Every board entry but the run's own is switched off,
913
+ // with the apps switch on or off (it does not reach opencode), and a config
914
+ // that cannot be read stops the run: refused, never guessed.
915
+ const others = cwd ? await opencodeBoardEntries({ cwd, env, home, read }) : [];
916
+ const off = Object.fromEntries(others.filter((name) => name !== SERVER_KEY).map((name) => [name, { enabled: false }]));
917
+ if (!mcpUrl || !token) {
918
+ return Object.keys(off).length
919
+ ? { wrote: null, env: { OPENCODE_CONFIG_CONTENT: JSON.stringify({ $schema: "https://opencode.ai/config.json", permission: { bash: OPENCODE_OTHER_LOGIN_RULES }, mcp: off }) } }
920
+ : { wrote: null };
921
+ }
854
922
 
855
923
  const config = {
856
924
  $schema: "https://opencode.ai/config.json",
@@ -858,6 +926,7 @@ export async function prepareWorkspace(agent, { mcpUrl, token, sessionKey, board
858
926
  // denied here by pattern (#6995, otherLogins.mjs).
859
927
  permission: { bash: OPENCODE_OTHER_LOGIN_RULES },
860
928
  mcp: {
929
+ ...off,
861
930
  [SERVER_KEY]: {
862
931
  type: "remote",
863
932
  url: mcpUrl,
@@ -875,6 +944,45 @@ export async function prepareWorkspace(agent, { mcpUrl, token, sessionKey, board
875
944
  return { wrote: null, env: { OPENCODE_CONFIG_CONTENT: JSON.stringify(config) } };
876
945
  }
877
946
 
947
+ /** The names of the Viewable board servers in the opencode configs this run
948
+ * merges (#7550): the global folder, OPENCODE_CONFIG and OPENCODE_CONFIG_DIR,
949
+ * and an opencode.json(c) or .opencode/opencode.json(c) in the run's folder
950
+ * or any folder above it. Throws `{ refused: true }`, naming the file, when
951
+ * one is there and cannot be read. */
952
+ export async function opencodeBoardEntries({ cwd, env = process.env, home = env.HOME?.trim() || homedir(), read = readFile }) {
953
+ const global = env.XDG_CONFIG_HOME?.trim() ? join(env.XDG_CONFIG_HOME.trim(), "opencode") : join(home, ".config", "opencode");
954
+ const paths = [
955
+ ...["config.json", "opencode.json", "opencode.jsonc"].map((file) => join(global, file)),
956
+ ...(env.OPENCODE_CONFIG?.trim() ? [env.OPENCODE_CONFIG.trim()] : []),
957
+ ...(env.OPENCODE_CONFIG_DIR?.trim() ? ["opencode.json", "opencode.jsonc"].map((file) => join(env.OPENCODE_CONFIG_DIR.trim(), file)) : []),
958
+ ];
959
+ for (let dir = resolve(cwd), depth = 0; depth < 64; depth += 1) {
960
+ for (const file of ["opencode.json", "opencode.jsonc", join(".opencode", "opencode.json"), join(".opencode", "opencode.jsonc")]) paths.push(join(dir, file));
961
+ const up = dirname(dir);
962
+ if (up === dir) break;
963
+ dir = up;
964
+ }
965
+ const names = new Set();
966
+ for (const path of new Set(paths)) {
967
+ let raw;
968
+ try { raw = await read(path, "utf8"); } catch (error) {
969
+ if (error?.code === "ENOENT" || error?.code === "ENOTDIR" || error?.code === "EISDIR") continue;
970
+ throw opencodeRefusal(path);
971
+ }
972
+ const errors = [];
973
+ const data = parseJsonc(raw, errors, { allowTrailingComma: true });
974
+ const mcp = data?.mcp;
975
+ if (errors.length || data === null || typeof data !== "object" || Array.isArray(data) ||
976
+ (mcp !== undefined && (mcp === null || typeof mcp !== "object" || Array.isArray(mcp)))) throw opencodeRefusal(path);
977
+ for (const [name, entry] of Object.entries(mcp ?? {})) if (isBoardServer(name, entry, { env })) names.add(name);
978
+ }
979
+ return [...names];
980
+ }
981
+
982
+ const opencodeRefusal = (path) => Object.assign(new Error(
983
+ `Couldn't read ${path} to check it for another Viewable board, so this run did not start. Fix that file, or use Claude Code or Codex for this folder.`,
984
+ ), { refused: true });
985
+
878
986
  /** What every brief is prefixed with, in the tool names THAT engine uses.
879
987
  *
880
988
  * It was one fixed string naming `ask_user` and `report`. Claude Code answers
@@ -885,13 +993,17 @@ export async function prepareWorkspace(agent, { mcpUrl, token, sessionKey, board
885
993
  *
886
994
  * A session cannot be MADE to ask or report. It can only be told, accurately,
887
995
  * in the one place it always reads. */
888
- export function preambleFor(agent, { workplace, computerApps } = {}) {
889
- const spec = AGENTS[agentFor(agent)];
996
+ export function preambleFor(agent, { workplace, computerApps, boardServerKey, readApps, readOnly } = {}) {
997
+ const spec = specNamingBoard(agent, boardServerKey);
890
998
  const ask = spec.boardTool("ask_user");
891
999
  const report = spec.boardTool("report");
1000
+ // THE APPS THIS ASK'S PLAN READS THROUGH VIEWABLE (#8261, part 3 of #8251).
1001
+ // Only Claude Code and Codex, with the same words (#7581).
1002
+ const apps = ["claude", "codex"].includes(agentFor(agent)) ? plannedReadApps(readApps) : [];
1003
+ const appRead = spec.boardTool("app_read");
892
1004
  return (
893
1005
  "You were spawned from a canvas by a person who is not watching a terminal. " +
894
- (workplace ?? "You are in your own git worktree: commit your work on this branch, never " +
1006
+ (readOnly === true ? READ_ONLY_WORKPLACE : workplace ?? "You are in your own git worktree: commit your work on this branch, never " +
895
1007
  "merge to main, and never touch the checkout above you.\n\n") +
896
1008
  `If a permission or anything else blocks you, ask on the board with ${ask} ` +
897
1009
  `rather than stopping quietly - it lands as a question on your idea that the person answers ` +
@@ -903,13 +1015,20 @@ export function preambleFor(agent, { workplace, computerApps } = {}) {
903
1015
  // reads it - so the sentence named a surface the person cannot see any
904
1016
  // more. What has not changed is the consequence, which is the reason the
905
1017
  // sentence exists at all: silence looks exactly like success.
906
- `call ${report} before you finish, including when you did nothing: the ` +
907
- "card on the person's idea just reads finished, and they cannot " +
908
- "tell that apart from success.\n\n" +
1018
+ // #8013/#8014: the closing message is the answer on the card; `report` for the answer made a
1019
+ // second copy in a group. `report` stays for forks and evidence.
1020
+ `end with your closing message: it is your answer on the person's card, so say what you ` +
1021
+ "did there, including when you did nothing, or the card just reads finished and they " +
1022
+ "cannot tell that apart from success. Never repeat it in a report.\n\n" +
1023
+ `Call ${report} only for a fork only the person can rule on (decide) or for evidence from ` +
1024
+ "the code about one of their circles (flags), never for what you did.\n\n" +
909
1025
  // A refusal stops the run and asks; it never sends it to another login (#6995).
910
1026
  refusalRule(ask) +
1027
+ // A table ask lands as a drawn card, never as words saying it was made (#8102).
1028
+ (apps.length > 0 ? appReadRule(appRead, spec.boardTool("set_live_card"), apps) : "") +
1029
+ drawnCardRule(spec.boardTool("propose")) +
911
1030
  `Your board tools are named ${spec.boardTool("get_board")}, ` +
912
- `${spec.boardTool("get_node")}, ${spec.boardTool("propose")}, ${ask} and ${report}.\n\n` +
1031
+ `${spec.boardTool("get_node")}, ${spec.boardTool("propose")}, ${ask}${apps.length > 0 ? `, ${appRead}` : ""} and ${report}.\n\n` +
913
1032
  // brief 23 ruling 4a (2026-09-07): the app derives the run's structure
914
1033
  // - its steps, decisions and waiting state - from this session's own
915
1034
  // log, and this preamble is the one place every session reads. So the
@@ -940,17 +1059,60 @@ export function preambleFor(agent, { workplace, computerApps } = {}) {
940
1059
  );
941
1060
  }
942
1061
 
1062
+ /** Where a run that only reads works (#8261): the folder itself, with no copy. */
1063
+ export const READ_ONLY_WORKPLACE =
1064
+ "You are in the person's linked folder with tools that only read: you can read its files and the " +
1065
+ "board, and you cannot change a file or run a command here. Nothing in this ask needs you to.\n\n";
1066
+
1067
+ /** The request's `readApps`: app ids, once each (board-mcp's plannedApps reads the same field). */
1068
+ function plannedReadApps(readApps) {
1069
+ return Array.isArray(readApps) ? [...new Set(readApps.filter((app) => typeof app === "string" && app.trim() !== "").map((app) => app.trim()))] : [];
1070
+ }
1071
+
1072
+ /** HOW A COMPUTER SESSION READS A CONNECTED APP (#8261; Plan round 2 on
1073
+ * #8251). The app's plan step named the apps (`readApps`); board-mcp's
1074
+ * `app_read` reads only those, for this running ask (#8254). The session is
1075
+ * told to use it instead of a command line (the walk on #7791 read with `gh`),
1076
+ * to land a table or chart from the read it holds (`set_live_card` with
1077
+ * `{ shape, read_ref, columns }`, #8259), and to stop and say so when the read
1078
+ * is refused, never to read the app another way. Generic: nothing here names
1079
+ * an app (#4419); the ids are the request's own. */
1080
+ function appReadRule(appRead, setLiveCard, apps) {
1081
+ return (
1082
+ `This ask's plan reads these apps the person connected in Viewable: ${apps.join(", ")}. ` +
1083
+ `Read them only with ${appRead} { provider, tool, args }, provider being one of those ids: never with a ` +
1084
+ "command-line tool, a script, a web request or a login on this computer (no gh, no curl, no app's own CLI), " +
1085
+ "and the rule about the person's own apps on this computer does not apply to these. " +
1086
+ "Each read answers the app's rows and a read_ref that names the read for ten minutes. " +
1087
+ `To put a table or chart of what you read on the board, land it with ${setLiveCard} ` +
1088
+ "{ shape: \"table\" or \"chart\", read_ref, columns }, columns being the fields to show, in order: the board " +
1089
+ "builds the card from that read, so never type the rows in yourself; if the board refuses that, draw it as below. " +
1090
+ `If ${appRead} is refused (the run was stopped or ran out of time, the app is not in the plan, the account is ` +
1091
+ "not on Pro), stop that part and say so in your answer, in the refusal's own words. Never read the app another way.\n\n"
1092
+ );
1093
+ }
1094
+
943
1095
  /** What a chat turn is told ahead of the app's own words (runnerExecute.mjs).
944
1096
  * A chat turn gets no idea preamble, so the rules that hold for every run
945
1097
  * travel here: a refusal stops and asks, for every engine (#6995), and, for
946
1098
  * Claude Code and Codex, the other-apps rule and the apps-off rule that the
947
1099
  * reply's Manage agent offer reads (#4204, #481). */
948
- export function chatRulesFor(agent, { computerApps } = {}) {
1100
+ export function chatRulesFor(agent, { computerApps, boardServerKey } = {}) {
949
1101
  const engine = agentFor(agent);
950
1102
  const local = ["claude", "codex"].includes(engine)
951
1103
  ? `${otherAppsRule()}${computerApps === true ? "" : computerAppsOffRule()}`
952
1104
  : "";
953
- return `${local}${refusalRule(AGENTS[engine].boardTool("ask_user"))}`;
1105
+ return `${local}${refusalRule(specNamingBoard(engine, boardServerKey).boardTool("ask_user"))}`;
1106
+ }
1107
+
1108
+ /** The engine's spec, with Claude's board tools named by the run's own server
1109
+ * key when the caller made one (#7550): `mcp__v1a2b3__ask_user`, not a bare
1110
+ * `ask_user` that a second board server would also answer to. */
1111
+ function specNamingBoard(agent, boardServerKey) {
1112
+ const spec = AGENTS[agentFor(agent)];
1113
+ return agentFor(agent) === "claude" && typeof boardServerKey === "string" && /^v[0-9a-f]{5}$/.test(boardServerKey)
1114
+ ? { ...spec, boardTool: (name) => `mcp__${boardServerKey}__${name}` }
1115
+ : spec;
954
1116
  }
955
1117
 
956
1118
  /** The plan-tool sentence of preambleFor, split out because `todoTool` now