viewable-one 0.12.7 → 0.12.8
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 +34 -0
- package/SPAWN.md +1 -0
- package/glytch.mjs +6 -2
- package/lib/acp.mjs +8 -1
- package/lib/agent-selection.mjs +84 -0
- package/lib/agents.mjs +26 -1
- package/lib/codex.mjs +39 -1
- package/lib/codexApps.mjs +17 -2
- package/lib/conversationRules.mjs +18 -0
- package/lib/multiwatch.mjs +25 -2
- package/lib/otherLogins.mjs +282 -0
- package/lib/permissionAsk.mjs +39 -2
- package/lib/runnerExecute.mjs +10 -7
- package/lib/runnerLaunch.mjs +3 -3
- package/lib/writePolicy.mjs +324 -0
- package/package.json +1 -1
- package/spawn-runner.mjs +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,40 @@ package.
|
|
|
13
13
|
|
|
14
14
|
## [Unreleased]
|
|
15
15
|
|
|
16
|
+
## [0.12.8] - 2026-11-19
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- A run on the computer whose read or write is refused now stops and asks on
|
|
21
|
+
the board with the reason, and never gets round it with another login on the
|
|
22
|
+
computer: the Supabase CLI, a saved password or a git or GitHub token are
|
|
23
|
+
refused for every engine, whatever the person allowed for the run (#6995).
|
|
24
|
+
- A card automation or a process step set to run on your computer now starts
|
|
25
|
+
the program you chose for that folder in setup, not whichever installed
|
|
26
|
+
program was found first (#6704). The computer now tells the board which
|
|
27
|
+
programs each watched folder chose (`viewable init --agents`), and it reads
|
|
28
|
+
that choice again when a folder is set up or set up again while the
|
|
29
|
+
watcher runs. If none of the chosen programs is installed, the run starts
|
|
30
|
+
nothing and says which one is missing, naming it, with what to do next. A
|
|
31
|
+
choice the computer cannot read is refused in words and never taken for no
|
|
32
|
+
choice. A folder set up before the choice existed keeps the old pick:
|
|
33
|
+
Claude Code, else the first one found.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- An automation's reads of a connected app run on your computer without
|
|
38
|
+
asking (#6896, as on the board in #6628), when the engine reports the
|
|
39
|
+
tool's own read-only label: Codex. Setting the automation counts as the
|
|
40
|
+
yes; a write still asks. A run you start yourself keeps asking. The runner
|
|
41
|
+
marks a run that came from an automation, and the ask lets a Codex call
|
|
42
|
+
through when Codex labels the tool read-only and its words and arguments
|
|
43
|
+
name a read. A call Codex flags as sensitive, or a tool labelled as
|
|
44
|
+
changing things or not labelled at all, asks. Claude Code and ACP agents
|
|
45
|
+
send no tool labels, so the computer cannot tell a read from a write and
|
|
46
|
+
every app call from them asks, in an automation too (#6955). A read the
|
|
47
|
+
automation allowed leaves a line in the run's steps saying so, and Codex's
|
|
48
|
+
tool is read from the approval's own field, never its words (#6955).
|
|
49
|
+
|
|
16
50
|
## [0.12.7] - 2026-11-15
|
|
17
51
|
|
|
18
52
|
### Fixed
|
package/SPAWN.md
CHANGED
|
@@ -1722,6 +1722,7 @@ unscoped, so the session may write any path the process can reach.
|
|
|
1722
1722
|
| tools | anything not on `CLAUDE_TOOLS` | everything on it |
|
|
1723
1723
|
| interactive prompts | `EnterPlanMode`, `AskUserQuestion` | - |
|
|
1724
1724
|
| 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 |
|
|
1725
1726
|
| arbitrary code | - | `node -e`, `npx <anything>` |
|
|
1726
1727
|
| writes | the checkout you are looking at (the **worktree** does this, not the list) | any other path the process can reach |
|
|
1727
1728
|
| money | wall clock, no retry | - |
|
package/glytch.mjs
CHANGED
|
@@ -247,8 +247,12 @@ async function init() {
|
|
|
247
247
|
// watcher must not see the folder while the server still wants it removed.
|
|
248
248
|
// The attempt id rides this register too, so the card knows this computer
|
|
249
249
|
// answered before the last check ends (#4206).
|
|
250
|
+
// The programs chosen in step 1 ride the setup's own register: it replaces
|
|
251
|
+
// the folder's mark, so without them a run filed before the daemon's next
|
|
252
|
+
// beat would take a program the person did not choose (#6704).
|
|
253
|
+
const chosenMark = selected.length ? { chosenAgents: { [root]: selected } } : {};
|
|
250
254
|
const registerSetup = (extra = {}) => registerAndFindProject(root, {
|
|
251
|
-
...settingsFromEnv(), runnerId: newRunnerId(), markExtra: () => ({ version: packageVersion(), setupId, ...extra }),
|
|
255
|
+
...settingsFromEnv(), runnerId: newRunnerId(), markExtra: () => ({ version: packageVersion(), setupId, ...chosenMark, ...extra }),
|
|
252
256
|
}, { readd: true });
|
|
253
257
|
let setupRegistered = false;
|
|
254
258
|
let setupRunnerId = null;
|
|
@@ -355,7 +359,7 @@ async function init() {
|
|
|
355
359
|
!(allOk && hasFreshBeat({ version: packageVersion(), root, after: checkStartedAt }))) {
|
|
356
360
|
await registerAndFindProject(root, {
|
|
357
361
|
...settingsFromEnv(), runnerId: setupRunnerId ?? newRunnerId(),
|
|
358
|
-
markExtra: () => ({ version: packageVersion(), setupId, setupFailed: true }),
|
|
362
|
+
markExtra: () => ({ version: packageVersion(), setupId, ...chosenMark, setupFailed: true }),
|
|
359
363
|
}, { onlyRoot: true }).catch(() => {});
|
|
360
364
|
}
|
|
361
365
|
// FIX 1B, THE FALLBACK SENTENCE: an agent step 4 could not connect over
|
package/lib/acp.mjs
CHANGED
|
@@ -857,10 +857,17 @@ export function runAcpChild(opts) {
|
|
|
857
857
|
// The allowlist rides to the adapter's Claude Code as `allowedTools`
|
|
858
858
|
// (the permission door above); without one nothing is auto-allowed.
|
|
859
859
|
const allowedTools = Array.isArray(acp.allowTools) ? acp.allowTools : [];
|
|
860
|
+
// Another login, token or saved key is barred (#6995, otherLogins.mjs);
|
|
861
|
+
// the adapter merges its own AskUserQuestion rule into this list.
|
|
862
|
+
const disallowedTools = Array.isArray(acp.disallowTools) ? acp.disallowTools : [];
|
|
863
|
+
const options = {
|
|
864
|
+
...(allowedTools.length > 0 ? { allowedTools } : {}),
|
|
865
|
+
...(disallowedTools.length > 0 ? { disallowedTools } : {}),
|
|
866
|
+
};
|
|
860
867
|
const params = {
|
|
861
868
|
cwd,
|
|
862
869
|
mcpServers: Array.isArray(acp.mcpServers) ? acp.mcpServers : [],
|
|
863
|
-
...(
|
|
870
|
+
...(Object.keys(options).length > 0 ? { _meta: { claudeCode: { options } } } : {}),
|
|
864
871
|
};
|
|
865
872
|
let created;
|
|
866
873
|
// Explicit crash recovery requires the saved conversation. Ordinary
|
package/lib/agent-selection.mjs
CHANGED
|
@@ -36,6 +36,90 @@ export async function readAgentSelection(root) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/** How often the mark re-reads the folders' saved choices on its own. */
|
|
40
|
+
const CHOICE_REFRESH_MS = 30_000;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* WHICH PROGRAMS THE PERSON CHOSE, in the mark the computer sends (#6704).
|
|
44
|
+
*
|
|
45
|
+
* A run the board files for this computer with no coding agent of its own (a
|
|
46
|
+
* card's automation, a process step) must start the program chosen for its
|
|
47
|
+
* folder at setup, never another one that happens to be installed. One mark
|
|
48
|
+
* goes out for every folder on the computer, and each folder keeps its own
|
|
49
|
+
* choice, so the mark carries `chosenAgents: {<folder path>: [names]}`;
|
|
50
|
+
* supabase/functions/_shared/habitRuns.mjs `runnerAgentOnComputer` reads it.
|
|
51
|
+
*
|
|
52
|
+
* `mark()` is SYNCHRONOUS, like the probe's (detect.mjs): it answers from
|
|
53
|
+
* memory and starts a re-read in the background when one is due. `refresh()`
|
|
54
|
+
* is how a caller waits for a fresh answer: the daemon awaits it before the
|
|
55
|
+
* first beat, before a folder that joins is watched, and when the folder list
|
|
56
|
+
* is written again (setup choosing a program rewrites it), so a new choice
|
|
57
|
+
* reaches the next beat. A folder with no saved choice is left out: no choice
|
|
58
|
+
* is recorded for it, and the board keeps its old pick.
|
|
59
|
+
*
|
|
60
|
+
* A CHOICE THAT CANNOT BE READ IS NEVER "NO CHOICE" (#6704 review). A file
|
|
61
|
+
* caught mid-edit or briefly unreadable keeps the last choice read from it;
|
|
62
|
+
* one never read well is named in `chosenUnreadable`, and the board refuses
|
|
63
|
+
* the run in words rather than picking a program the person may not have
|
|
64
|
+
* chosen, the way init and doctor refuse an invalid file.
|
|
65
|
+
*/
|
|
66
|
+
export function makeChoiceMark({
|
|
67
|
+
folders,
|
|
68
|
+
read = readAgentSelection,
|
|
69
|
+
intervalMs = CHOICE_REFRESH_MS,
|
|
70
|
+
now = () => Date.now(),
|
|
71
|
+
log = () => {},
|
|
72
|
+
} = {}) {
|
|
73
|
+
let known = {};
|
|
74
|
+
let unreadable = [];
|
|
75
|
+
let checkedAt = null;
|
|
76
|
+
let pending = 0;
|
|
77
|
+
let chain = Promise.resolve();
|
|
78
|
+
const complained = new Set();
|
|
79
|
+
const run = async () => {
|
|
80
|
+
checkedAt = now();
|
|
81
|
+
const next = {};
|
|
82
|
+
const broken = [];
|
|
83
|
+
let paths = [];
|
|
84
|
+
try { paths = [...new Set(folders())]; }
|
|
85
|
+
catch (error) { log(`could not list the folders for the chosen programs: ${error instanceof Error ? error.message : String(error)}`); return; }
|
|
86
|
+
for (const path of paths) {
|
|
87
|
+
try {
|
|
88
|
+
const chosen = await read(path);
|
|
89
|
+
if (Array.isArray(chosen) && chosen.length > 0) next[path] = chosen;
|
|
90
|
+
complained.delete(path);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
if (known[path]) next[path] = known[path];
|
|
93
|
+
else broken.push(path);
|
|
94
|
+
if (!complained.has(path)) {
|
|
95
|
+
complained.add(path);
|
|
96
|
+
log(`[${path}] could not read the chosen programs: ${error instanceof Error ? error.message : String(error)}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
known = next;
|
|
101
|
+
unreadable = broken;
|
|
102
|
+
};
|
|
103
|
+
// A refresh asked while one runs reads again after it, so a choice saved
|
|
104
|
+
// mid-read is never answered with the read that started before it.
|
|
105
|
+
const refresh = () => {
|
|
106
|
+
pending += 1;
|
|
107
|
+
const done = chain.then(run).finally(() => { pending -= 1; });
|
|
108
|
+
chain = done.catch(() => {});
|
|
109
|
+
return done;
|
|
110
|
+
};
|
|
111
|
+
return {
|
|
112
|
+
mark() {
|
|
113
|
+
if (pending === 0 && (checkedAt === null || now() - checkedAt >= intervalMs)) void refresh();
|
|
114
|
+
return {
|
|
115
|
+
...(Object.keys(known).length > 0 ? { chosenAgents: { ...known } } : {}),
|
|
116
|
+
...(unreadable.length > 0 ? { chosenUnreadable: [...unreadable] } : {}),
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
refresh,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
39
123
|
export async function saveAgentSelection(root, agents) {
|
|
40
124
|
const selected = parseAgentSelection(agents);
|
|
41
125
|
await mkdir(join(root, ".viewable"), { recursive: true });
|
package/lib/agents.mjs
CHANGED
|
@@ -78,7 +78,8 @@
|
|
|
78
78
|
// `acpServersFor` below is where the server is described.
|
|
79
79
|
|
|
80
80
|
import { adapterEntry } from "./acp.mjs";
|
|
81
|
-
import { computerAppsOffRule, conversationRules } from "./conversationRules.mjs";
|
|
81
|
+
import { computerAppsOffRule, conversationRules, otherAppsRule, refusalRule } from "./conversationRules.mjs";
|
|
82
|
+
import { CLAUDE_OTHER_LOGIN_TOOLS, OPENCODE_OTHER_LOGIN_RULES } from "./otherLogins.mjs";
|
|
82
83
|
import { runEngineFor } from "./run-engine.mjs";
|
|
83
84
|
// ONE LIST, not two: spawn.mjs's checkRequest is the validator a request
|
|
84
85
|
// meets first, and this file's draft branch is what actually builds the
|
|
@@ -197,6 +198,9 @@ export const CLAUDE_CLICK_AND_SCREEN_TOOLS = [
|
|
|
197
198
|
export const CLAUDE_DISALLOWED_TOOLS = [
|
|
198
199
|
"EnterPlanMode", "AskUserQuestion",
|
|
199
200
|
...CLAUDE_CLICK_AND_SCREEN_TOOLS,
|
|
201
|
+
// Another login, token or saved key (#6995): `Bash(npx:*)` would run
|
|
202
|
+
// `npx supabase` without a question, and a deny rule is checked first.
|
|
203
|
+
...CLAUDE_OTHER_LOGIN_TOOLS,
|
|
200
204
|
];
|
|
201
205
|
|
|
202
206
|
/** The two tools that reach the web. Allowed up front only when the person
|
|
@@ -779,6 +783,9 @@ export function commandFor(agent, env = process.env, wants = {}) {
|
|
|
779
783
|
label: spec.label,
|
|
780
784
|
adapter: spec.adapter,
|
|
781
785
|
allowTools: CLAUDE_TOOLS,
|
|
786
|
+
// The same Claude Code, so the same bar on other logins (#6995);
|
|
787
|
+
// the adapter adds its own AskUserQuestion rule beside it.
|
|
788
|
+
disallowTools: CLAUDE_OTHER_LOGIN_TOOLS,
|
|
782
789
|
mode: "acceptEdits",
|
|
783
790
|
model: typeof wants.model === "string" ? wants.model.trim() : "",
|
|
784
791
|
mcpServers: acpServersFor(agent, {
|
|
@@ -847,6 +854,9 @@ export async function prepareWorkspace(agent, { mcpUrl, token, sessionKey, board
|
|
|
847
854
|
|
|
848
855
|
const config = {
|
|
849
856
|
$schema: "https://opencode.ai/config.json",
|
|
857
|
+
// --auto approves every command it does not deny, so another login is
|
|
858
|
+
// denied here by pattern (#6995, otherLogins.mjs).
|
|
859
|
+
permission: { bash: OPENCODE_OTHER_LOGIN_RULES },
|
|
850
860
|
mcp: {
|
|
851
861
|
[SERVER_KEY]: {
|
|
852
862
|
type: "remote",
|
|
@@ -896,6 +906,8 @@ export function preambleFor(agent, { workplace, computerApps } = {}) {
|
|
|
896
906
|
`call ${report} before you finish, including when you did nothing: the ` +
|
|
897
907
|
"card on the person's idea just reads finished, and they cannot " +
|
|
898
908
|
"tell that apart from success.\n\n" +
|
|
909
|
+
// A refusal stops the run and asks; it never sends it to another login (#6995).
|
|
910
|
+
refusalRule(ask) +
|
|
899
911
|
`Your board tools are named ${spec.boardTool("get_board")}, ` +
|
|
900
912
|
`${spec.boardTool("get_node")}, ${spec.boardTool("propose")}, ${ask} and ${report}.\n\n` +
|
|
901
913
|
// brief 23 ruling 4a (2026-09-07): the app derives the run's structure
|
|
@@ -928,6 +940,19 @@ export function preambleFor(agent, { workplace, computerApps } = {}) {
|
|
|
928
940
|
);
|
|
929
941
|
}
|
|
930
942
|
|
|
943
|
+
/** What a chat turn is told ahead of the app's own words (runnerExecute.mjs).
|
|
944
|
+
* A chat turn gets no idea preamble, so the rules that hold for every run
|
|
945
|
+
* travel here: a refusal stops and asks, for every engine (#6995), and, for
|
|
946
|
+
* Claude Code and Codex, the other-apps rule and the apps-off rule that the
|
|
947
|
+
* reply's Manage agent offer reads (#4204, #481). */
|
|
948
|
+
export function chatRulesFor(agent, { computerApps } = {}) {
|
|
949
|
+
const engine = agentFor(agent);
|
|
950
|
+
const local = ["claude", "codex"].includes(engine)
|
|
951
|
+
? `${otherAppsRule()}${computerApps === true ? "" : computerAppsOffRule()}`
|
|
952
|
+
: "";
|
|
953
|
+
return `${local}${refusalRule(AGENTS[engine].boardTool("ask_user"))}`;
|
|
954
|
+
}
|
|
955
|
+
|
|
931
956
|
/** The plan-tool sentence of preambleFor, split out because `todoTool` now
|
|
932
957
|
* comes in two shapes: a plain tool name (codex's `update_plan`, opencode's
|
|
933
958
|
* `todowrite`) or, since 2026-09-21, `{write, update, fallback}` for the
|
package/lib/codex.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { writeRisk, riskReason } from "./writePolicy.mjs";
|
|
2
|
+
import { automationReadWords } from "./permissionAsk.mjs";
|
|
2
3
|
// Codex's native app-server protocol, translated to the board's session log.
|
|
3
4
|
// No SDK or API key is needed: this uses the user's installed, signed-in CLI.
|
|
4
5
|
import { PassThrough } from "node:stream";
|
|
@@ -335,6 +336,8 @@ function runCodexAttempt(opts, apps) {
|
|
|
335
336
|
let finishTimer;
|
|
336
337
|
let lastAssistantText = "";
|
|
337
338
|
const opened = new Map();
|
|
339
|
+
let verifiedApps = null; // the apps as the running thread reports them; null until checked
|
|
340
|
+
const mcpCalls = new Map(); // item id -> Codex's own mcpToolCall item, for an approval that names only the item
|
|
338
341
|
const closed = new Set();
|
|
339
342
|
const messages = agentMessageAssembler();
|
|
340
343
|
const emit = (event) => { if (!handle.settled()) translated.write(`${JSON.stringify({ ...event, session_id: threadId })}\n`); };
|
|
@@ -392,7 +395,7 @@ function runCodexAttempt(opts, apps) {
|
|
|
392
395
|
const toolStart = (item) => {
|
|
393
396
|
if (closed.has(item.id)) return;
|
|
394
397
|
let name; let input;
|
|
395
|
-
if (item.type === "mcpToolCall") { name = `mcp__${item.server}__${item.tool}`; input = item.arguments; }
|
|
398
|
+
if (item.type === "mcpToolCall") { name = `mcp__${item.server}__${item.tool}`; input = item.arguments; mcpCalls.set(item.id, item); }
|
|
396
399
|
else if (item.type === "commandExecution") { name = "Bash"; input = { command: item.command }; }
|
|
397
400
|
else if (item.type === "fileChange") { name = "Edit"; input = { changes: item.changes }; }
|
|
398
401
|
else return;
|
|
@@ -410,6 +413,29 @@ function runCodexAttempt(opts, apps) {
|
|
|
410
413
|
opened.set(item.id, snapshot);
|
|
411
414
|
assistant([{ type: "tool_use", id: item.id, name, input }]);
|
|
412
415
|
};
|
|
416
|
+
// The app, tool and arguments an app approval is for, or null when they cannot
|
|
417
|
+
// be read reliably. Elicitation: the tool is `_meta.tool_name` (the field
|
|
418
|
+
// Codex's own reviewer reads), the arguments `_meta.tool_params`. Legacy input
|
|
419
|
+
// request: Codex's own started item (same item id) holds the server, tool and
|
|
420
|
+
// arguments. Never from the approval's words, which can quote an argument (#6955).
|
|
421
|
+
const calledApp = (method, params, question) => {
|
|
422
|
+
if (method === ELICITATION) {
|
|
423
|
+
const named = params._meta?.tool_name;
|
|
424
|
+
const tool = question.id === undefined && typeof named === "string" && named !== "" ? named : undefined;
|
|
425
|
+
const input = params._meta?.tool_params;
|
|
426
|
+
// Only a real tool approval (its marker, and its arguments as an object) can skip the ask.
|
|
427
|
+
// Codex marks a call it calls sensitive: that one asks.
|
|
428
|
+
if (!tool || params._meta?.codex_approval_kind !== "mcp_tool_call" || !object(input) || params._meta?.codex_sensitive_action === true) return null;
|
|
429
|
+
return { app: params.serverName, tool, input };
|
|
430
|
+
}
|
|
431
|
+
const item = mcpCalls.get(params.itemId);
|
|
432
|
+
return item && object(item.arguments ?? {}) ? { app: item.server, tool: item.tool, input: item.arguments ?? {} } : null;
|
|
433
|
+
};
|
|
434
|
+
const automationRead = ({ app, tool, input }) => {
|
|
435
|
+
// The labels of the thread that is running, read when it started (verifyCodexApps), never the earlier ones.
|
|
436
|
+
const source = verifiedApps?.find((entry) => entry.enabled && entry.name === app);
|
|
437
|
+
return source?.tools?.includes(tool) === true && opts.askPermission.appRead?.(app, tool, input, source.annotations?.[tool]) === true;
|
|
438
|
+
};
|
|
413
439
|
rpc = codexRpc(child, {
|
|
414
440
|
timeoutMs: opts.rpcTimeoutMs ?? 15_000,
|
|
415
441
|
async onRequest(method, params, requestId) {
|
|
@@ -443,6 +469,17 @@ function runCodexAttempt(opts, apps) {
|
|
|
443
469
|
if (controller.signal.aborted || approvalsClosed() || resolvedRequests.has(requestId) || !identityMatches()) return cancelled;
|
|
444
470
|
const appApproval = question.id?.startsWith("mcp_tool_call_approval") ||
|
|
445
471
|
(method === ELICITATION && question.id === undefined && question.options.includes("Allow"));
|
|
472
|
+
// An automation's read of an app is allowed by the automation itself (#5495, #6896):
|
|
473
|
+
// the same rule the server runs, with the app's own labels from the inventory.
|
|
474
|
+
// An approval that names no tool, or one with no arguments to read, keeps asking.
|
|
475
|
+
const called = appApproval ? calledApp(method, params, question) : null;
|
|
476
|
+
if (called && automationRead(called)) {
|
|
477
|
+
opts.log?.(`permission: ${called.tool} is a read in an automation, no question filed (#5495)`);
|
|
478
|
+
// The run's card says the automation was the yes, as a refusal says its no (#6955).
|
|
479
|
+
emit({ type: "system", subtype: "permission", decision: "allowed", automation: true, message: automationReadWords(called.app, called.tool) });
|
|
480
|
+
answers.push("Allow");
|
|
481
|
+
continue;
|
|
482
|
+
}
|
|
446
483
|
const hostedQuestion = { ...question, options: [...question.options, CANCEL],
|
|
447
484
|
recommendation: appApproval
|
|
448
485
|
? { answer: "Allow", why: "It lets this run carry on with what you asked." }
|
|
@@ -723,6 +760,7 @@ function runCodexAttempt(opts, apps) {
|
|
|
723
760
|
finish("Checking apps again with the unverified apps turned off.");
|
|
724
761
|
return;
|
|
725
762
|
}
|
|
763
|
+
verifiedApps = checkedApps.sources;
|
|
726
764
|
for (const message of apps.notices) emit({ type: "system", subtype: "info", message });
|
|
727
765
|
emit({ type: "system", subtype: "init", model: thread.model ?? config.model, effort: thread.reasoningEffort ?? config.effort, engine: "codex" });
|
|
728
766
|
emit({ type: "system", subtype: "info", message: planWindowInfoMessage(planWindow) });
|
package/lib/codexApps.mjs
CHANGED
|
@@ -114,6 +114,19 @@ function pathPart(value) {
|
|
|
114
114
|
return value;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
// The app's own labels per tool (readOnlyHint, destructiveHint), read from the
|
|
118
|
+
// inventory so an automation's read rule sees what the server says (#6896).
|
|
119
|
+
// Keyed by the tool's key, its name and its resource name; a tool with no
|
|
120
|
+
// labels has no entry.
|
|
121
|
+
function labelsOf(status) {
|
|
122
|
+
const labels = {};
|
|
123
|
+
for (const [key, tool] of Object.entries(status?.tools ?? {})) {
|
|
124
|
+
if (!object(tool?.annotations)) continue;
|
|
125
|
+
for (const name of [key, tool.name, tool._meta?.resource_name]) if (typeof name === "string" && name) labels[name] = tool.annotations;
|
|
126
|
+
}
|
|
127
|
+
return labels;
|
|
128
|
+
}
|
|
129
|
+
|
|
117
130
|
// Built-in app provenance comes from the app-server's own tool metadata,
|
|
118
131
|
// never a server-name exception. Store only IDs/names, not link credentials.
|
|
119
132
|
function appTools(status) {
|
|
@@ -187,12 +200,12 @@ export async function prepareCodexApps(opts, { on, isDraft }) {
|
|
|
187
200
|
const apps = new Map(Object.entries(config.apps ?? {}).filter(([id]) => id !== "_default").map(([id, app]) => [pathPart(id), new Set(Object.keys(app?.tools ?? {}))]));
|
|
188
201
|
for (const [name, server] of Object.entries(servers)) {
|
|
189
202
|
const status = inventory.find((entry) => entry.name === name && !entry.pluginId);
|
|
190
|
-
plan.sources.push({ name, kind: "configured", identity: "configured", enabled: server.enabled !== false, tools: Object.keys(status?.tools ?? {}) });
|
|
203
|
+
plan.sources.push({ name, kind: "configured", identity: "configured", enabled: server.enabled !== false, tools: Object.keys(status?.tools ?? {}), annotations: labelsOf(status) });
|
|
191
204
|
}
|
|
192
205
|
for (const status of inventory) {
|
|
193
206
|
const names = Object.keys(status.tools);
|
|
194
207
|
if (Object.hasOwn(servers, status.name) && !status.pluginId) continue;
|
|
195
|
-
const source = { name: status.name, kind: status.pluginId ? "plugin" : "apps", identity: status.pluginId ?? "apps", enabled: true, tools: names };
|
|
208
|
+
const source = { name: status.name, kind: status.pluginId ? "plugin" : "apps", identity: status.pluginId ?? "apps", enabled: true, tools: names, annotations: labelsOf(status) };
|
|
196
209
|
plan.sources.push(source);
|
|
197
210
|
if (status.pluginId) {
|
|
198
211
|
const plugin = pathPart(status.pluginId);
|
|
@@ -292,6 +305,8 @@ export async function verifyCodexApps(rpc, { cwd, threadId, on, isDraft, sources
|
|
|
292
305
|
if (source.tools.some((name) => !Object.hasOwn(status.tools, name))) {
|
|
293
306
|
disableSource(plan, source, "Codex could not find all of its tools in this run");
|
|
294
307
|
}
|
|
308
|
+
// The labels this thread reports, not the ones read before it started (#6896).
|
|
309
|
+
source.annotations = labelsOf(status);
|
|
295
310
|
} catch { disableSource(plan, source, "Codex could not check approval for the app"); }
|
|
296
311
|
}
|
|
297
312
|
for (const source of plan.sources) {
|
|
@@ -71,6 +71,24 @@ export function otherAppsRule() {
|
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
// A REFUSAL STOPS THE RUN AND ASKS (#6995). A read-only key that was refused
|
|
75
|
+
// sent a run to the Supabase CLI's full-rights login instead. Every engine is
|
|
76
|
+
// told this, in an idea's preamble and in a chat turn's prefix; the tools it
|
|
77
|
+
// names are also barred outright where the engine allows it (otherLogins.mjs).
|
|
78
|
+
// `ask` is the engine's own name for the board's ask_user.
|
|
79
|
+
export function refusalRule(ask) {
|
|
80
|
+
return (
|
|
81
|
+
"When a read or a write is refused (a key that only reads, a permission " +
|
|
82
|
+
"error, a 401 or 403, a tool or app that says no), stop that part of the " +
|
|
83
|
+
`task and ask the person with ${ask}: say what was refused and why, in ` +
|
|
84
|
+
"the words of the error, and what they could change. Never get round a " +
|
|
85
|
+
"refusal with another login, CLI session, token or key on this computer: " +
|
|
86
|
+
"no Supabase CLI, no gh token, no keychain or password manager, no key " +
|
|
87
|
+
"from a file or a setting, and no other account. If you cannot ask, say " +
|
|
88
|
+
"what was refused in your reply and stop there.\n\n"
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
74
92
|
// USE MY COMPUTER'S APPS IS OFF (#481). A run without the switch has no way
|
|
75
93
|
// to the person's own apps, so rather than hunt for one it says so in its
|
|
76
94
|
// closing message, in these words: the app finds the sentence and offers
|
package/lib/multiwatch.mjs
CHANGED
|
@@ -41,6 +41,7 @@ import { makeRunnerHealth } from "./runner-health.mjs";
|
|
|
41
41
|
import { unwatchFile, watchFile } from "node:fs";
|
|
42
42
|
import { stat } from "node:fs/promises";
|
|
43
43
|
import { makeAgentProbe } from "./detect.mjs";
|
|
44
|
+
import { makeChoiceMark } from "./agent-selection.mjs";
|
|
44
45
|
import { platformMark } from "./platform.mjs";
|
|
45
46
|
import { ensureViewableFolder } from "./viewableFolder.mjs";
|
|
46
47
|
import { readRegistryChecked, registryPath } from "./registry.mjs";
|
|
@@ -117,6 +118,10 @@ export async function watchRegistered({
|
|
|
117
118
|
makeRealtime = makeRunnerRealtime,
|
|
118
119
|
// THE BOARD'S UPDATE BUTTON (#4949). Injected for the tests.
|
|
119
120
|
makeSelfUpdater = makeSelfUpdate,
|
|
121
|
+
// THE PROGRAMS CHOSEN FOR EACH FOLDER (#6704), read from each folder's
|
|
122
|
+
// `.viewable/agents.json`. Injected for the tests; the default reads the
|
|
123
|
+
// folders this daemon watches.
|
|
124
|
+
choices,
|
|
120
125
|
goodbye,
|
|
121
126
|
} = {}) {
|
|
122
127
|
// An installed update stops every watcher the same way Ctrl-C does: each
|
|
@@ -194,6 +199,14 @@ export async function watchRegistered({
|
|
|
194
199
|
// first mark a person sees already carries the `agents` block rather than
|
|
195
200
|
// arriving bare and filling in a beat later.
|
|
196
201
|
await probe.once();
|
|
202
|
+
// And the programs chosen for each folder, for the same reason: a board
|
|
203
|
+
// that files a run before this arrives would pick one the person did not
|
|
204
|
+
// choose (#6704).
|
|
205
|
+
// `joining` holds the folders a registry re-read is about to start, so their
|
|
206
|
+
// choice is read before their watcher's first register.
|
|
207
|
+
let joining = [];
|
|
208
|
+
const chosen = choices ?? makeChoiceMark({ folders: () => [...first, ...watched, ...joining], log });
|
|
209
|
+
await chosen.refresh();
|
|
197
210
|
|
|
198
211
|
// The mark file gains `version`, `updateAvailable`, `agents` and (brief 21
|
|
199
212
|
// session 5, ruling 3A) `platform` here, and only here: `watch()`
|
|
@@ -240,7 +253,7 @@ export async function watchRegistered({
|
|
|
240
253
|
holdsRuns: () => selfUpdater.holdsRuns(),
|
|
241
254
|
claimStarted: () => selfUpdater.claimStarted(),
|
|
242
255
|
};
|
|
243
|
-
const markExtra = () => ({ ...platform, ...updater.mark(), ...probe.mark(), ...health.mark(), ...selfUpdater.mark() });
|
|
256
|
+
const markExtra = () => ({ ...platform, ...updater.mark(), ...probe.mark(), ...chosen.mark(), ...health.mark(), ...selfUpdater.mark() });
|
|
244
257
|
|
|
245
258
|
// ONE REGISTER AND ONE HEARTBEAT FOR THE WHOLE PROCESS (ticket e8,
|
|
246
259
|
// 2026-10-03; #616, 2026-10-16). Every folder's beat registers the whole
|
|
@@ -411,6 +424,7 @@ export async function watchRegistered({
|
|
|
411
424
|
log(`${folder} left the registry - stopping its watcher`);
|
|
412
425
|
entry.controller.abort();
|
|
413
426
|
}
|
|
427
|
+
const joined = [];
|
|
414
428
|
for (const folder of now) {
|
|
415
429
|
if (running.has(folder)) continue;
|
|
416
430
|
if (!(await isDir(folder))) {
|
|
@@ -424,8 +438,17 @@ export async function watchRegistered({
|
|
|
424
438
|
announcedMissing.delete(folder);
|
|
425
439
|
log(`${folder} joined the registry - syncing and watching it`);
|
|
426
440
|
await syncOne(folder);
|
|
427
|
-
|
|
441
|
+
joined.push(folder);
|
|
428
442
|
}
|
|
443
|
+
// The choices are read before a joining folder is watched (its first
|
|
444
|
+
// register would otherwise say none, and a run filed then would take
|
|
445
|
+
// another program), and before the beat a rewritten list asks for:
|
|
446
|
+
// setup choosing a program writes the list again (#6704).
|
|
447
|
+
if (joined.length > 0 || rewritten) {
|
|
448
|
+
joining = joined;
|
|
449
|
+
try { await chosen.refresh(); } finally { joining = []; }
|
|
450
|
+
}
|
|
451
|
+
for (const folder of joined) startFolder(folder);
|
|
429
452
|
if (rewritten) askBeat();
|
|
430
453
|
} while (refreshAgain);
|
|
431
454
|
} catch (error) {
|