@proagentstore/cli 0.4.73 → 0.4.74
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.
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { LOCAL_BROWSER_SOURCE_FAILURE_REASONS, redactDetail } from "./contract.js";
|
|
2
2
|
/** The browser tools a research run may use. Everything else from the browser is not even listed. */
|
|
3
3
|
const READ_TOOLS = new Set(["browser_navigate", "browser_navigate_back", "browser_snapshot", "browser_wait_for", "browser_click"]);
|
|
4
|
+
/** The research tools the bridge adds; the CLI records its results through these. */
|
|
5
|
+
const RESEARCH_TOOL_NAMES = ["record_finding", "report_source_failure", "finish_research"];
|
|
4
6
|
/** Refused BY NAME with the reason, so a CLI that guesses one is told why rather than "unknown tool". */
|
|
5
7
|
const WRITE_TOOLS = new Set([
|
|
6
8
|
"browser_type",
|
|
@@ -18,6 +20,11 @@ const WRITE_TOOLS = new Set([
|
|
|
18
20
|
/** Roles a click may target in research mode: moving between pages, never acting on one. */
|
|
19
21
|
const CLICKABLE_ROLES = new Set(["link", "tab", "menuitem", "treeitem", "option"]);
|
|
20
22
|
const PAGINATION_NAME = /^(next|previous|prev|more|load more|show more|see more|view more|older|newer|page \d+|\d+|›|»|‹|«)( page| results| jobs)?$/i;
|
|
23
|
+
/**
|
|
24
|
+
* Every tool name the bridge can ever list (#952) — the exact set a CLI may be told to trust
|
|
25
|
+
* without asking. Write tools are not in it, so trusting this set cannot trust a write.
|
|
26
|
+
*/
|
|
27
|
+
export const BRIDGE_TOOL_NAMES = [...READ_TOOLS, ...RESEARCH_TOOL_NAMES];
|
|
21
28
|
const RESEARCH_TOOLS = [
|
|
22
29
|
{
|
|
23
30
|
name: "record_finding",
|
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
* - Codex: `--sandbox read-only` (its shell cannot write, and per Codex's sandbox design has no
|
|
13
13
|
* network), `--ignore-user-config` (no MCP servers or providers from the user's own config — auth
|
|
14
14
|
* still comes from the login), web search switched off, and the bridge as its only MCP server.
|
|
15
|
+
* `codex exec` runs with approval policy `never`, so an MCP tool that needs approval is simply
|
|
16
|
+
* refused — a live run on 2026-10-07 opened no page for exactly that reason (#952). The bridge is
|
|
17
|
+
* therefore pre-approved, and ONLY it: `default_tools_approval_mode="approve"` on the
|
|
18
|
+
* `pags_browser` server, and `enabled_tools` pinned to the bridge's own tool names
|
|
19
|
+
* (`BRIDGE_TOOL_NAMES`). Nothing else is approved — the shell stays read-only with no network,
|
|
20
|
+
* there is no other server — and the bridge still enforces sites, consent, limits and the
|
|
21
|
+
* research-only tool set in the runner, whatever the CLI is allowed to call.
|
|
15
22
|
* NOT VERIFIED END TO END on a live machine: that read-only shell commands get no network, and
|
|
16
23
|
* which of the two web-search keys a given Codex version honours. #947 holds that test.
|
|
17
24
|
*
|
|
@@ -21,6 +28,7 @@
|
|
|
21
28
|
* turns a subscription run into per-token billing.
|
|
22
29
|
*/
|
|
23
30
|
import { mergeEnv } from "../coding/engine-env.js";
|
|
31
|
+
import { BRIDGE_TOOL_NAMES } from "./bridge.js";
|
|
24
32
|
import { resolveEngineAuth } from "../coding/engine-auth.js";
|
|
25
33
|
/** The bridge's MCP server name — and so the prefix of its tools inside the CLI. */
|
|
26
34
|
export const BRIDGE_SERVER_NAME = "pags_browser";
|
|
@@ -89,6 +97,11 @@ export function buildEngineSpec(input) {
|
|
|
89
97
|
`${key}.env=${envTable}`,
|
|
90
98
|
"-c",
|
|
91
99
|
`${key}.tool_timeout_sec=${Math.ceil(input.toolTimeoutMs / 1000)}`,
|
|
100
|
+
// Pre-approve the bridge, and only its own tools (#952); see the note atop this file.
|
|
101
|
+
"-c",
|
|
102
|
+
`${key}.default_tools_approval_mode="approve"`,
|
|
103
|
+
"-c",
|
|
104
|
+
`${key}.enabled_tools=[${BRIDGE_TOOL_NAMES.map(toml).join(", ")}]`,
|
|
92
105
|
// Two spellings across Codex versions; an unknown key is ignored, so both are set.
|
|
93
106
|
"-c",
|
|
94
107
|
'web_search="disabled"',
|