@parcha/agentrun-serve 0.1.0-beta.29 → 0.1.0-beta.30
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 +188 -0
- package/README.md +564 -97
- package/dist/adapters.d.ts +35 -6
- package/dist/adapters.js +152 -26
- package/dist/agents.d.ts +11 -5
- package/dist/agents.js +16 -10
- package/dist/app.js +80 -20
- package/dist/background.d.ts +28 -0
- package/dist/background.js +376 -0
- package/dist/box-egress.d.ts +98 -0
- package/dist/box-egress.js +259 -0
- package/dist/box-image.d.ts +1 -1
- package/dist/box-image.js +9 -7
- package/dist/box-relay-vm.d.ts +80 -0
- package/dist/box-relay-vm.js +389 -0
- package/dist/box-relay.d.ts +8 -5
- package/dist/box-relay.js +14 -9
- package/dist/boxes.d.ts +21 -3
- package/dist/boxes.js +14 -7
- package/dist/browser-cost.d.ts +41 -0
- package/dist/browser-cost.js +158 -0
- package/dist/cap.d.ts +129 -21
- package/dist/cap.js +338 -67
- package/dist/coding-tools.d.ts +7 -3
- package/dist/coding-tools.js +16 -10
- package/dist/console/THIRD-PARTY-NOTICES.txt +580 -0
- package/dist/console/assets/index-34jfpIbQ.js +481 -0
- package/dist/console/assets/index-DUHbWcIP.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/content-filter.d.ts +7 -0
- package/dist/content-filter.js +23 -0
- package/dist/decision-rows.d.ts +11 -3
- package/dist/decision-rows.js +18 -11
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +5 -2
- package/dist/files.d.ts +6 -1
- package/dist/files.js +7 -2
- package/dist/grade.d.ts +7 -10
- package/dist/grade.js +31 -51
- package/dist/graph-served.d.ts +23 -0
- package/dist/graph-served.js +75 -0
- package/dist/graph-view.d.ts +7 -5
- package/dist/graph-view.js +10 -3
- package/dist/harness-app.d.ts +4 -2
- package/dist/harness-app.js +101 -19
- package/dist/harness-opencode/adapter.d.ts +45 -0
- package/dist/harness-opencode/adapter.js +272 -0
- package/dist/harness-opencode/binary.d.ts +18 -0
- package/dist/harness-opencode/binary.js +87 -0
- package/dist/harness-opencode/config.d.ts +24 -0
- package/dist/harness-opencode/config.js +61 -0
- package/dist/harness-opencode/harness.d.ts +77 -0
- package/dist/harness-opencode/harness.js +620 -0
- package/dist/harness-opencode/host/mcp.d.ts +40 -0
- package/dist/harness-opencode/host/mcp.js +208 -0
- package/dist/harness-opencode/host/policy.d.ts +71 -0
- package/dist/harness-opencode/host/policy.js +419 -0
- package/dist/harness-opencode/host/server.d.ts +55 -0
- package/dist/harness-opencode/host/server.js +165 -0
- package/dist/harness-opencode/index.d.ts +9 -0
- package/dist/harness-opencode/index.js +6 -0
- package/dist/harness-opencode/verify.d.ts +32 -0
- package/dist/harness-opencode/verify.js +75 -0
- package/dist/harness-opencode/versions.d.ts +33 -0
- package/dist/harness-opencode/versions.js +64 -0
- package/dist/harness.d.ts +4 -1
- package/dist/harness.js +5 -2
- package/dist/host-tools.d.ts +12 -2
- package/dist/host-tools.js +26 -12
- package/dist/host.js +6 -2
- package/dist/hosted-search.js +5 -1
- package/dist/import.d.ts +2 -2
- package/dist/import.js +4 -3
- package/dist/key-check.d.ts +3 -2
- package/dist/key-check.js +7 -3
- package/dist/key-refusal.js +8 -4
- package/dist/learn/check.d.ts +10 -1
- package/dist/learn/check.js +19 -1
- package/dist/learn/grade.d.ts +3 -2
- package/dist/learn/grade.js +25 -13
- package/dist/learn/index.d.ts +2 -2
- package/dist/learn/index.js +2 -2
- package/dist/learn/notes.js +2 -1
- package/dist/learn/reflect.d.ts +2 -2
- package/dist/learn/reflect.js +51 -5
- package/dist/learn/secrets.js +28 -8
- package/dist/learn/skills.d.ts +17 -4
- package/dist/learn/skills.js +79 -6
- package/dist/learned-workflow.d.ts +59 -0
- package/dist/learned-workflow.js +191 -0
- package/dist/learning-run.d.ts +7 -5
- package/dist/learning-run.js +45 -23
- package/dist/learning-words.d.ts +6 -3
- package/dist/learning-words.js +8 -5
- package/dist/learning.d.ts +44 -3
- package/dist/learning.js +148 -3
- package/dist/mcp-servers.d.ts +7 -4
- package/dist/mcp-servers.js +5 -0
- package/dist/mcp.js +5 -5
- package/dist/model.d.ts +13 -11
- package/dist/model.js +11 -10
- package/dist/openapi/agentrun-v2.openapi.json +1 -0
- package/dist/openapi.js +358 -48
- package/dist/paid-calls.d.ts +5 -1
- package/dist/paid-calls.js +1 -1
- package/dist/pause.d.ts +2 -0
- package/dist/place.d.ts +27 -4
- package/dist/place.js +42 -10
- package/dist/propose.d.ts +2 -0
- package/dist/propose.js +38 -8
- package/dist/request-start.d.ts +12 -4
- package/dist/request-start.js +139 -15
- package/dist/run-box.d.ts +56 -4
- package/dist/run-box.js +173 -23
- package/dist/runnable.d.ts +5 -2
- package/dist/runnable.js +12 -4
- package/dist/runs.d.ts +258 -36
- package/dist/runs.js +830 -89
- package/dist/secrets.d.ts +12 -0
- package/dist/secrets.js +18 -0
- package/dist/server.d.ts +131 -35
- package/dist/server.js +467 -105
- package/dist/sign-ins.d.ts +99 -0
- package/dist/sign-ins.js +288 -0
- package/dist/skills.d.ts +16 -4
- package/dist/skills.js +35 -7
- package/dist/stats.d.ts +7 -2
- package/dist/stats.js +28 -7
- package/dist/tool-gate.d.ts +266 -0
- package/dist/tool-gate.js +554 -0
- package/dist/tool-keys.d.ts +46 -10
- package/dist/tool-keys.js +44 -2
- package/dist/tool-plane.d.ts +112 -27
- package/dist/tool-plane.js +205 -47
- package/dist/tools.d.ts +69 -14
- package/dist/tools.js +143 -24
- package/dist/trigger-secrets.d.ts +32 -0
- package/dist/trigger-secrets.js +143 -0
- package/dist/triggers.d.ts +439 -0
- package/dist/triggers.js +863 -0
- package/dist/turn-end.d.ts +3 -2
- package/dist/turn-end.js +3 -2
- package/dist/usage-lines.d.ts +26 -0
- package/dist/usage-lines.js +28 -0
- package/dist/validate.d.ts +2 -0
- package/dist/validate.js +11 -2
- package/dist/webhooks.d.ts +11 -4
- package/dist/webhooks.js +17 -1
- package/launcher/agentrun-serve +1 -1
- package/package.json +19 -13
- package/dist/console/assets/index-BN7oVcO4.js +0 -445
- package/dist/console/assets/index-By-jkqki.css +0 -1
package/dist/tool-plane.js
CHANGED
|
@@ -12,13 +12,22 @@
|
|
|
12
12
|
// launch, from its pinned revision and the settings then, keeps them for the run's life (runs.ts), and hands the run's
|
|
13
13
|
// process the outcome as a non-secret description (TOOL_PLANE_ENV): the run reads its tools' providers there, never from
|
|
14
14
|
// a request.
|
|
15
|
+
//
|
|
16
|
+
// Each tool also has a permission, the tool gate's (tool-gate.ts): allow, ask or deny, the agent's over the server's over
|
|
17
|
+
// the owner's default (a built-in kernel tool allow, a third-party catalog tool ask, told apart by its name), read by
|
|
18
|
+
// the gate's one rule, permissionOf. A capability set to deny resolves to no provider where it is shown; under ask, a
|
|
19
|
+
// harness's own search (inside its CLI, where no call can wait for a person) gives way to the kernel's. A run is never
|
|
20
|
+
// told a deny: its Plane resolves a denied capability as under ask, and the gate, which reads the permission at each
|
|
21
|
+
// call, is the one place that refuses it, so a deny lifted mid-run is lifted at the next call.
|
|
15
22
|
import { readFileSync } from "node:fs";
|
|
23
|
+
import { isToolSettingsKey } from "@parcha/pi-durable-agent";
|
|
16
24
|
import { join } from "node:path";
|
|
17
25
|
import { decisionKeysOf, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
18
26
|
import { writeDurableSync } from "./files.js";
|
|
19
27
|
import { DEFAULT_HARNESS, HARNESSES } from "./harness.js";
|
|
20
28
|
import { savedIn } from "./secrets.js";
|
|
21
29
|
import { hostModel, viaOpenRouter } from "./model.js";
|
|
30
|
+
import { isCatalogTool, isMcpTool, PERMISSIONS, permissionFrom, permissionOf, SHELL_FAMILY } from "./tool-gate.js";
|
|
22
31
|
/**
|
|
23
32
|
* The capabilities a pack or a revision may grant, by name: the tools the kernel gives a run, bound from serve's closed
|
|
24
33
|
* table (tools.ts) and named the same on every harness that runs them. `web_search` and `web_fetch` resolve to a
|
|
@@ -32,17 +41,38 @@ export const CAPABILITIES = ["read", "write", "edit", "web_search", "web_fetch",
|
|
|
32
41
|
* server holds its key, else keyless Exa; `native`, the harness's own tool or its model provider's hosted one, and
|
|
33
42
|
* nothing else; `exa-keyless`, Exa's public MCP endpoint, no key; `kernel`, the guarded direct fetch; `parallel`,
|
|
34
43
|
* Parallel's Search and Extract APIs on PARALLEL_API_KEY; `off`, web_search turned off: nothing is searched, and an
|
|
35
|
-
* agent naming it is refused until it is turned on again.
|
|
36
|
-
|
|
44
|
+
* agent naming it is refused until it is turned on again. The browser's: `auto`, Browserbase where the server holds its
|
|
45
|
+
* keys, else Kernel where it holds Kernel's; `browserbase` or `kernel`, that one alone; `chrome`, a Chrome on the
|
|
46
|
+
* server's own host, which no server sets up yet (browserBy). */
|
|
47
|
+
export const PROVIDERS = Object.freeze({ web_search: ["auto", "native", "exa-keyless", "parallel", "off"], web_fetch: ["kernel", "parallel"], browser: ["auto", "browserbase", "kernel", "chrome"] });
|
|
37
48
|
export const PICKABLE = Object.keys(PROVIDERS);
|
|
38
49
|
/** Older names a revision may still grant, and the capability each one is: `fetch_page` runs web_fetch, under its own
|
|
39
50
|
* name, and resolves as web_fetch does. */
|
|
40
51
|
export const LEGACY_NAMES = Object.freeze({ fetch_page: "web_fetch" });
|
|
41
52
|
/** The capability a granted name runs: its legacy target, else itself. */
|
|
42
53
|
export const capabilityOf = (name) => LEGACY_NAMES[name] ?? name;
|
|
54
|
+
/** Every tool of serve's table (tools.ts) and its legacy names, by name, so this module needs no import of it: a test
|
|
55
|
+
* holds the two as one. */
|
|
56
|
+
export const TABLE_TOOLS = ["read", "write", "edit", "bash", "ask_person", "fetch_page", "web_fetch", "web_search", "browser", "pdf_pages", "llm"];
|
|
57
|
+
/** The tools whose approved call the kernel runs itself, outside the model's turn (host-tools.ts's REPLAY): ask is
|
|
58
|
+
* offered for these and for catalog tools. Any other (browser, ask_person, the call-only ones) is allow or deny. The
|
|
59
|
+
* run's learned_workflow is one (tool-gate.ts runs an approved call of it on the run's own tools). */
|
|
60
|
+
export const ASKABLE = ["read", "write", "edit", "bash", "fetch_page", "web_fetch", "web_search", "learned_workflow"];
|
|
61
|
+
/** The permissions `name` may be set to. */
|
|
62
|
+
export const permissionsOf = (name) => (Object.hasOwn(SHELL_FAMILY, name) && SHELL_FAMILY[name] !== name ? permissionsOf(SHELL_FAMILY[name]) : ASKABLE.includes(name) || isCatalogTool(name) ? PERMISSIONS : ["allow", "deny"]);
|
|
63
|
+
/** The run's own tools beyond the table, each its own settings key, allowed by default like a table tool: the learned
|
|
64
|
+
* workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL). */
|
|
65
|
+
export const SERVE_OWN_TOOLS = ["learned_workflow"];
|
|
66
|
+
/** A settings key: a tool of the table, one of the run's own tools (SERVE_OWN_TOOLS), a catalog tool (`monid.<tool>`,
|
|
67
|
+
* `mcp:<server>/<tool>`), or an MCP server's wildcard (`mcp:<server>/*`), which sets each of its tools. */
|
|
68
|
+
const isSettingsKey = (name) => isToolSettingsKey(name) && ((TABLE_TOOLS.includes(name) && !Object.hasOwn(LEGACY_NAMES, name)) || SERVE_OWN_TOOLS.includes(name) || isCatalogTool(name) || /^mcp:[^/]+\/\*$/.test(name));
|
|
43
69
|
export const NO_PARALLEL_KEY = "unavailable: parallel picked, no PARALLEL_API_KEY";
|
|
44
70
|
/** web_search with `off` picked: no search leaves the server. */
|
|
45
71
|
export const SEARCH_OFF = "unavailable: web_search is turned off in settings";
|
|
72
|
+
/** A capability set to deny: no provider is asked, and the gate refuses each call, so its run still starts. */
|
|
73
|
+
export const DENIED = "unavailable: denied";
|
|
74
|
+
/** `native` picked for a capability set to ask on a harness whose own search runs inside its CLI. */
|
|
75
|
+
export const NATIVE_ASKS = "unavailable: native search cannot wait for an approval";
|
|
46
76
|
/** The model providers whose hosted web search pi's web_search asks (hosted-search.ts), by pi-ai's provider id. */
|
|
47
77
|
export const HOSTED_SEARCH_PROVIDERS = ["anthropic", "openai"];
|
|
48
78
|
/** Why claude-agent has no native search under a spend cap, and what works there instead. */
|
|
@@ -65,6 +95,9 @@ function noNative(input) {
|
|
|
65
95
|
return input.capped ? { id: CLAUDE_CAPPED, why: "under a spend cap Claude's own search is not offered, since a cap cannot reserve its per-use fees yet" } : undefined;
|
|
66
96
|
if (input.harness === "codex")
|
|
67
97
|
return input.gateway ? { id: "codex behind a gateway", why: "behind a gateway Codex has no own search" } : input.capped ? { id: "codex under a spend cap", why: "under a spend cap Codex's own search is not offered, since its request has no input bound" } : undefined;
|
|
98
|
+
// OpenCode has none: its model requests carry no provider-hosted tool (its proxy policy refuses one).
|
|
99
|
+
if (input.harness === "opencode")
|
|
100
|
+
return { id: "opencode, whose model requests carry no provider-hosted tool", why: "OpenCode's model requests carry no provider-hosted tool" };
|
|
68
101
|
if (input.gateway)
|
|
69
102
|
return { id: `${input.harness} behind a gateway`, why: `behind a gateway ${input.harness} has no hosted search` };
|
|
70
103
|
if (vendor && HOSTED_SEARCH_PROVIDERS.includes(vendor))
|
|
@@ -79,15 +112,25 @@ export function explainCapability(capability, input) {
|
|
|
79
112
|
const chosen = input.override ?? input.pick ?? PROVIDERS[capability][0];
|
|
80
113
|
const picked = input.override !== undefined ? "picked for this agent" : "picked in settings";
|
|
81
114
|
const key = `your Parallel key (${input.parallelKeyFrom ?? "server"})`;
|
|
115
|
+
if (input.permission === "deny")
|
|
116
|
+
return { resolves: DENIED, why: "set to deny: the gate refuses each call" };
|
|
82
117
|
if (chosen === "off")
|
|
83
118
|
return { resolves: SEARCH_OFF, why: "turned off in settings" };
|
|
84
119
|
if (chosen === "parallel")
|
|
85
120
|
return input.parallelKey ? { resolves: "parallel", why: `Parallel, ${picked}: ${key}` } : { resolves: NO_PARALLEL_KEY, why: "Parallel is picked, and no PARALLEL_API_KEY is set or saved" };
|
|
86
121
|
if (capability === "web_fetch")
|
|
87
122
|
return { resolves: "kernel", why: "the guarded direct fetch" };
|
|
123
|
+
if (capability === "browser")
|
|
124
|
+
return browserBy(chosen, picked, input.browserKeys);
|
|
88
125
|
if (chosen === "exa-keyless")
|
|
89
126
|
return { resolves: "exa-keyless", why: `keyless Exa, ${picked}: Exa's free search, no key` };
|
|
90
|
-
|
|
127
|
+
// Under ask, a harness's own search runs inside its CLI, where no call can wait for a person: none on claude-agent or
|
|
128
|
+
// codex then, and the kernel's search, which the gate holds, in its place. pi's is a tool of the run's, which it holds.
|
|
129
|
+
const asks = input.permission === "ask" && input.harness !== DEFAULT_HARNESS;
|
|
130
|
+
const without = noNative(input);
|
|
131
|
+
if (chosen === "native" && asks && without === undefined)
|
|
132
|
+
return { resolves: NATIVE_ASKS, why: "native search cannot wait for an approval: it runs inside the harness's CLI" };
|
|
133
|
+
const none = without ?? (asks ? { id: input.harness, why: "under ask the harness's own search cannot wait for a person's approval" } : undefined);
|
|
91
134
|
if (chosen === "native")
|
|
92
135
|
return none === undefined ? { resolves: "native", why: nativeWhy(input) } : { resolves: `unavailable: no native search for ${none.id}`, why: `no native search for ${none.id}` };
|
|
93
136
|
// On claude-agent `auto` skips Claude's own search, an explicit pick (`native`): Parallel on the server's key, else
|
|
@@ -103,10 +146,38 @@ export const resolveCapability = (capability, input) => explainCapability(capabi
|
|
|
103
146
|
export const isUnavailable = (resolution) => resolution?.startsWith("unavailable: ") === true;
|
|
104
147
|
/** Why a resolution is unavailable: its words after "unavailable: " (any other resolution as it is). */
|
|
105
148
|
export const whyUnavailable = (resolution) => resolution.replace(/^unavailable: /, "");
|
|
149
|
+
/** The keys each of the browser's vendors needs, by name: a tool key's fields (tool-keys.ts), set or saved. Its plane
|
|
150
|
+
* value is the vendor's id: `kernel` on browser is Kernel's hosted browser, never the guarded fetch web_fetch calls so. */
|
|
151
|
+
export const BROWSER_KEYS = Object.freeze({ browserbase: ["BROWSERBASE_API_KEY", "BROWSERBASE_PROJECT_ID"], kernel: ["KERNEL_API_KEY"] });
|
|
152
|
+
const LABELS = { browserbase: "Browserbase", kernel: "Kernel" };
|
|
153
|
+
const isVendor = (name) => name === "browserbase" || name === "kernel";
|
|
154
|
+
const browserKeysOf = (env) => ({ browserbase: BROWSER_KEYS.browserbase.every((name) => Boolean(env[name])), kernel: BROWSER_KEYS.kernel.every((name) => Boolean(env[name])) });
|
|
155
|
+
/** A vendor picked whose keys the server does not hold: unavailable, never the other vendor. */
|
|
156
|
+
const noBrowserKey = (vendor) => `unavailable: ${vendor} picked, no ${BROWSER_KEYS[vendor].join(" and ")}`;
|
|
157
|
+
/** The keys a browser that resolves to `resolution` runs on: its vendor's (BROWSER_KEYS), none for no vendor. */
|
|
158
|
+
export const browserNeeds = (resolution) => (isVendor(resolution) ? BROWSER_KEYS[resolution] : []);
|
|
159
|
+
/** `auto` where the server holds neither vendor's keys. */
|
|
160
|
+
export const NO_BROWSER_KEY = "unavailable: no browser key: set or save Browserbase's (BROWSERBASE_API_KEY and BROWSERBASE_PROJECT_ID) or Kernel's (KERNEL_API_KEY)";
|
|
161
|
+
/** `chrome` picked: a Chrome on the server's own host, refused by name until a server can set one up. */
|
|
162
|
+
export const NO_CHROME = "unavailable: a local Chrome is not set up on this server";
|
|
163
|
+
/** The browser `chosen` (picked as `picked` says) resolves to with the vendors' `keys`: `auto` is Browserbase where its
|
|
164
|
+
* keys are held, else Kernel where its key is, else unavailable; a vendor picked is that vendor or unavailable; `chrome`
|
|
165
|
+
* is unavailable by name. */
|
|
166
|
+
function browserBy(chosen, picked, keys = { browserbase: false, kernel: false }) {
|
|
167
|
+
if (chosen === "chrome")
|
|
168
|
+
return { resolves: NO_CHROME, why: whyUnavailable(NO_CHROME) };
|
|
169
|
+
if (isVendor(chosen))
|
|
170
|
+
return keys[chosen] ? { resolves: chosen, why: `${LABELS[chosen]}, ${picked}` } : { resolves: noBrowserKey(chosen), why: `${LABELS[chosen]} is picked, and no ${BROWSER_KEYS[chosen].join(" and ")} is set or saved` };
|
|
171
|
+
if (keys.browserbase)
|
|
172
|
+
return { resolves: "browserbase", why: "Browserbase: its key is set or saved" };
|
|
173
|
+
if (keys.kernel)
|
|
174
|
+
return { resolves: "kernel", why: "Kernel: its key is set or saved, and Browserbase's is not" };
|
|
175
|
+
return { resolves: NO_BROWSER_KEY, why: whyUnavailable(NO_BROWSER_KEY) };
|
|
176
|
+
}
|
|
106
177
|
/** The server's environment's part of every resolution: its gateway and Parallel's key, and where the key is from. */
|
|
107
178
|
const served = (env) => {
|
|
108
179
|
const parallelKey = PARALLEL_KEY_ENV in decisionKeysOf(env);
|
|
109
|
-
return { gateway: Boolean(env.AGENT_MODEL_BASE_URL), parallelKey, ...(parallelKey ? { parallelKeyFrom: savedIn(env).has(PARALLEL_KEY_ENV) ? "saved" : "server" } : {}) };
|
|
180
|
+
return { gateway: Boolean(env.AGENT_MODEL_BASE_URL), parallelKey, browserKeys: browserKeysOf(env), ...(parallelKey ? { parallelKeyFrom: savedIn(env).has(PARALLEL_KEY_ENV) ? "saved" : "server" } : {}) };
|
|
110
181
|
};
|
|
111
182
|
/** Each pickable capability on each harness under the server's `settings` and an agent's `overrides`, on `model`
|
|
112
183
|
* (default each harness's host model, the one a run that names none runs on: hostModel): what it resolves to and why, as
|
|
@@ -124,11 +195,14 @@ export function explainsView(env, settings, overrides = {}, model) {
|
|
|
124
195
|
const picked = (name, settings, overrides = {}) => ({
|
|
125
196
|
...(overrides[name]?.provider ? { override: overrides[name].provider } : {}),
|
|
126
197
|
...(settings[name]?.provider ? { pick: settings[name].provider } : {}),
|
|
198
|
+
permission: permissionOf(name, settings, overrides),
|
|
127
199
|
});
|
|
128
200
|
/** The run's process's description of its tools' providers: JSON of its Plane. */
|
|
129
201
|
export const TOOL_PLANE_ENV = "AGENTRUN_SERVE_TOOL_PLANE";
|
|
130
|
-
/** The Plane of a run of `tooling`, in the server's `env` (with its secrets) under its `settings`.
|
|
131
|
-
|
|
202
|
+
/** The Plane of a run of `tooling`, in the server's `env` (with its secrets) under its `settings`. `run`: the Plane a
|
|
203
|
+
* run's process is handed, where a capability set to deny resolves as under ask (the provider a held call would use),
|
|
204
|
+
* since the gate refuses its calls while it is denied; else the one shown and checked, where it resolves denied. */
|
|
205
|
+
export function planeFor(env, tooling, settings, { capped = false, run = false } = {}) {
|
|
132
206
|
const harness = tooling.harness ?? DEFAULT_HARNESS;
|
|
133
207
|
// A workflow's model nodes may each run on another tier's model, and a native search asks one model's provider: a
|
|
134
208
|
// workflow's search resolves with no model (keyless Exa, or Parallel where picked), never on a model a node may not use.
|
|
@@ -138,18 +212,57 @@ export function planeFor(env, tooling, settings, { capped = false } = {}) {
|
|
|
138
212
|
const plane = {};
|
|
139
213
|
const granted = tooling.tools.map(capabilityOf);
|
|
140
214
|
for (const name of PICKABLE) {
|
|
141
|
-
if (granted.includes(name))
|
|
142
|
-
|
|
215
|
+
if (!granted.includes(name))
|
|
216
|
+
continue;
|
|
217
|
+
const chosen = picked(name, settings, tooling.overrides);
|
|
218
|
+
plane[name] = resolveCapability(name, { ...served(env), harness, capped, openRouter: viaOpenRouter(env, harness, model), ...(model ? { model } : {}), ...chosen, ...(run && chosen.permission === "deny" ? { permission: "ask" } : {}) });
|
|
143
219
|
}
|
|
144
|
-
|
|
220
|
+
// The model a search through its provider's hosted search asks (hosted-search.ts): pi's own web_search, and on
|
|
221
|
+
// another harness, whose agent searches with its own tool, a learned workflow's call node (learned-workflow.ts).
|
|
222
|
+
if (plane.web_search === "native" && model)
|
|
145
223
|
plane.model = model;
|
|
146
224
|
return plane;
|
|
147
225
|
}
|
|
148
|
-
/** A run's kept Plane at a later launch: as it was, but Parallel where the server no longer
|
|
149
|
-
* unavailable, never another provider
|
|
150
|
-
|
|
226
|
+
/** A run's kept Plane at a later launch: as it was, but Parallel, or the browser's vendor, where the server no longer
|
|
227
|
+
* holds its key, which is unavailable, never another provider; and, given `now` (the Plane it would get today and each
|
|
228
|
+
* capability's permission today), a capability set to ask or deny, or kept denied, as it resolves today: a harness's
|
|
229
|
+
* own search cannot wait for a person, and a deny that was lifted is lifted. The browser keeps its vendor, whose
|
|
230
|
+
* sessions it has: only a deny it was kept with is lifted. */
|
|
231
|
+
export function recheckPlane(plane, env, now) {
|
|
151
232
|
const keyed = served(env).parallelKey;
|
|
152
|
-
return Object.fromEntries(Object.entries(plane).map(([name, value]) =>
|
|
233
|
+
return Object.fromEntries(Object.entries(plane).map(([name, value]) => {
|
|
234
|
+
const fresh = name === "model" ? undefined : now?.fresh[name];
|
|
235
|
+
if (fresh !== undefined && (value === DENIED || (name !== "browser" && now.permission(name) !== "allow")))
|
|
236
|
+
return [name, fresh];
|
|
237
|
+
return [name, name === "browser" && isVendor(value) && !browserKeysOf(env)[value] ? noBrowserKey(value) : value === "parallel" && !keyed ? NO_PARALLEL_KEY : value];
|
|
238
|
+
}));
|
|
239
|
+
}
|
|
240
|
+
/** The Plane kept for a run made before its plane was kept, resolved at a later launch (runs.ts): its browser stays
|
|
241
|
+
* Browserbase, the one vendor there was then, never today's pick, which could check its sessions at another vendor. It
|
|
242
|
+
* keeps the vendor, never a refusal: the plane each launch hands over is checked again (recheckPlane), so Browserbase's
|
|
243
|
+
* keys missing make it unavailable for that launch alone, and restored keys make the next one run. */
|
|
244
|
+
export const keptFromBefore = (plane) => (plane.browser === undefined ? plane : { ...plane, browser: "browserbase" });
|
|
245
|
+
/** A run's saved Plane as a launch reads it: a vendor's missing-key refusal an earlier server saved (noBrowserKey's exact
|
|
246
|
+
* words, Browserbase's or Kernel's) is that vendor again, which the launch checks again as usual (recheckPlane), so
|
|
247
|
+
* restored keys make it run. Every other saved value stays as it is: `auto` with no key at a run's first launch
|
|
248
|
+
* (NO_BROWSER_KEY) and `chrome` stay frozen. The same Plane where nothing changes. */
|
|
249
|
+
export function keptVendor(plane) {
|
|
250
|
+
const vendor = Object.keys(BROWSER_KEYS).find((name) => plane.browser === noBrowserKey(name));
|
|
251
|
+
return vendor ? { ...plane, browser: vendor } : plane;
|
|
252
|
+
}
|
|
253
|
+
/** The key row (tool-keys.ts) of the browser's vendor on `resolution` with `picked` the provider in force: Kernel's where
|
|
254
|
+
* Kernel is picked or resolved, else Browserbase's, so a page links a missing key to the row it is saved on. */
|
|
255
|
+
export const browserKeyRow = (picked, resolution) => (picked === "kernel" || resolution === "kernel" ? "kernel" : "browserbase");
|
|
256
|
+
/** The Plane a run's process is handed at a launch, under the server's `settings` now: its kept Plane (as keptVendor
|
|
257
|
+
* reads it) checked again (recheckPlane) against the one it would get today; with none kept, today's, its browser kept
|
|
258
|
+
* (keptFromBefore). At a launch after its first (a relaunch, a follow-up's, one after a restart) a capability set
|
|
259
|
+
* to deny is handed denied (planeFor without `run`), the tool's own refusal backing the gate's; at its `first`, as
|
|
260
|
+
* under ask, so a deny lifted while that process lives is lifted at the next call. */
|
|
261
|
+
export function relaunchPlane(kept, env, tooling, settings, { capped = false, first = false } = {}) {
|
|
262
|
+
const fresh = tooling ? planeFor(env, tooling, settings, { capped, run: first }) : {};
|
|
263
|
+
if (kept)
|
|
264
|
+
return recheckPlane(kept, env, { fresh, permission: (name) => permissionOf(name, settings, tooling?.overrides ?? {}) });
|
|
265
|
+
return tooling ? recheckPlane(keptFromBefore(fresh), env) : {};
|
|
153
266
|
}
|
|
154
267
|
/** The Plane the server handed this run's process; empty when it handed none. */
|
|
155
268
|
export function planeOf(env) {
|
|
@@ -163,80 +276,125 @@ export function planeOf(env) {
|
|
|
163
276
|
}
|
|
164
277
|
/** Whether a run is handed Parallel's key: one of its capabilities resolves to Parallel. */
|
|
165
278
|
export const handsParallel = (plane) => PICKABLE.some((name) => plane[name] === "parallel");
|
|
166
|
-
/**
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
* choice to `{provider?}`, the provider one offered for it. */
|
|
279
|
+
/** The issues of `value` as a settings map, its fields under `at` (none: a body's own): each settings key (a tool of the
|
|
280
|
+
* table, a catalog tool, an MCP server's wildcard) to `{provider?, permission?}`, a provider only for a capability that
|
|
281
|
+
* has a choice and one offered for it, a permission one offered for the tool. */
|
|
170
282
|
export function settingsIssues(value, at = "") {
|
|
171
283
|
const field = (...names) => [at, ...names].filter(Boolean).join(".");
|
|
172
284
|
const isPlain = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
173
285
|
if (!isPlain(value))
|
|
174
|
-
return [{ field: at || "body", reason: "wrong_type", message: `${at || "the body"} is an object of
|
|
286
|
+
return [{ field: at || "body", reason: "wrong_type", message: `${at || "the body"} is an object of tools to their settings` }];
|
|
175
287
|
return Object.entries(value).flatMap(([name, setting]) => {
|
|
176
|
-
|
|
177
|
-
|
|
288
|
+
const pickable = Object.hasOwn(PROVIDERS, name);
|
|
289
|
+
if (!isSettingsKey(name))
|
|
290
|
+
return [{ field: field(name), reason: "not_allowed", message: `Tool settings are kept for this server's tools (${[...TABLE_TOOLS, ...SERVE_OWN_TOOLS].join(", ")}), catalog tools (monid.<tool>, mcp:<server>/<tool>) and an MCP server's tools (mcp:<server>/*); ${name} is none of them.` }];
|
|
178
291
|
if (!isPlain(setting))
|
|
179
|
-
return [{ field: field(name), reason: "wrong_type", message: `${field(name)} is an object, {provider}` }];
|
|
292
|
+
return [{ field: field(name), reason: "wrong_type", message: `${field(name)} is an object, {${pickable ? "provider, " : ""}permission}` }];
|
|
180
293
|
return Object.entries(setting).flatMap(([key, given]) => {
|
|
181
|
-
if (key === "permission")
|
|
182
|
-
|
|
183
|
-
|
|
294
|
+
if (key === "permission") {
|
|
295
|
+
// A wildcard sets each tool of its server's: a catalog tool's permissions.
|
|
296
|
+
const offered = permissionsOf(isMcpTool(name) ? name : name.replace(/\/\*$/, "/_"));
|
|
297
|
+
return offered.includes(given) ? [] : [{ field: field(name, key), reason: "not_an_option", message: `${field(name, key)} is one of ${offered.join(", ")}` }];
|
|
298
|
+
}
|
|
299
|
+
if (key !== "provider" || !pickable)
|
|
184
300
|
return [{ field: field(name, key), reason: "not_allowed", message: `${field(name)} keeps no field ${key}.` }];
|
|
185
301
|
const offered = PROVIDERS[name];
|
|
186
302
|
return offered.includes(given) ? [] : [{ field: field(name, key), reason: "not_an_option", message: `${field(name, key)} is one of ${offered.join(", ")}` }];
|
|
187
303
|
});
|
|
188
304
|
});
|
|
189
305
|
}
|
|
190
|
-
/** `map` with each capability's provider, its default where none is picked. */
|
|
191
|
-
export const withDefaults = (map) =>
|
|
306
|
+
/** `map` with each capability's provider, its default where none is picked; a permission where one is set. */
|
|
307
|
+
export const withDefaults = (map) => ({
|
|
308
|
+
...map,
|
|
309
|
+
...Object.fromEntries(PICKABLE.map((name) => [name, { provider: map[name]?.provider ?? PROVIDERS[name][0], ...(map[name]?.permission ? { permission: map[name].permission } : {}) }])),
|
|
310
|
+
});
|
|
192
311
|
/** The server's tool settings, beside the agent store in its data directory: not a secret, and not in store.sqlite,
|
|
193
312
|
* which runs hold open. Read once at the start, written whole and durably (0600) at each PUT; a missing file is every
|
|
194
313
|
* default, and so is one it cannot read, which it says in one line. */
|
|
314
|
+
/** The tool settings in `dir` as the server and the tool gate read them, failing closed: each entry that reads is kept;
|
|
315
|
+
* one that does not is dropped, but a known tool keeps what of it reads, and its permission, when not one offered,
|
|
316
|
+
* reads ask (deny where ask is not offered), never its allow default. `problems`: one line for each entry dropped or
|
|
317
|
+
* changed, naming the file and the field, never a value. `unreadable`: the file as a whole does not read (none, a
|
|
318
|
+
* missing file is every default). */
|
|
319
|
+
export function readToolSettings(dir) {
|
|
320
|
+
const file = join(dir, ToolSettings.FILE);
|
|
321
|
+
let read;
|
|
322
|
+
try {
|
|
323
|
+
read = JSON.parse(readFileSync(file, "utf8"));
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
if (error.code === "ENOENT")
|
|
327
|
+
return { settings: {}, problems: [] };
|
|
328
|
+
return { settings: {}, problems: [`${file} does not read as JSON`], unreadable: true };
|
|
329
|
+
}
|
|
330
|
+
const isPlain = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
331
|
+
if (!isPlain(read))
|
|
332
|
+
return { settings: {}, problems: [`${file} is not an object of tools to their settings`], unreadable: true };
|
|
333
|
+
const settings = {};
|
|
334
|
+
const problems = [];
|
|
335
|
+
for (const [name, setting] of Object.entries(read)) {
|
|
336
|
+
const issues = settingsIssues({ [name]: setting });
|
|
337
|
+
if (!issues.length) {
|
|
338
|
+
settings[name] = setting;
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
problems.push(`${file}: ${issues.map((issue) => `${issue.field} ${issue.reason}`).join(", ")}`);
|
|
342
|
+
if (!isSettingsKey(name) || !isPlain(setting))
|
|
343
|
+
continue;
|
|
344
|
+
const kept = {};
|
|
345
|
+
if (typeof setting.provider === "string" && !settingsIssues({ [name]: { provider: setting.provider } }).length)
|
|
346
|
+
kept.provider = setting.provider;
|
|
347
|
+
if (setting.permission !== undefined) {
|
|
348
|
+
const offered = permissionsOf(isMcpTool(name) ? name : name.replace(/\/\*$/, "/_"));
|
|
349
|
+
kept.permission = offered.includes(setting.permission) ? setting.permission : offered.includes("ask") ? "ask" : "deny";
|
|
350
|
+
}
|
|
351
|
+
if (Object.keys(kept).length)
|
|
352
|
+
settings[name] = kept;
|
|
353
|
+
}
|
|
354
|
+
return { settings, problems };
|
|
355
|
+
}
|
|
195
356
|
export class ToolSettings {
|
|
196
357
|
dir;
|
|
197
358
|
static FILE = "tool-settings.json";
|
|
198
359
|
current;
|
|
199
360
|
constructor(dir, warn = (line) => void process.stderr.write(`${line}\n`)) {
|
|
200
361
|
this.dir = dir;
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
catch (error) {
|
|
207
|
-
if (error.code !== "ENOENT")
|
|
208
|
-
read = undefined;
|
|
209
|
-
}
|
|
210
|
-
const bad = read === undefined || settingsIssues(read).length > 0;
|
|
211
|
-
if (bad)
|
|
212
|
-
warn(`agentrun-serve: ${file} is not tool settings this server reads; every tool takes its default provider until a PUT /v2/settings/tools`);
|
|
213
|
-
this.current = bad ? {} : read;
|
|
362
|
+
const { settings, problems, unreadable } = readToolSettings(dir);
|
|
363
|
+
for (const line of problems)
|
|
364
|
+
warn(`agentrun-serve: ${line}; ${unreadable ? "every tool takes its defaults" : "that entry is dropped (a permission that is not offered reads ask)"} until a PUT /v2/settings/tools`);
|
|
365
|
+
this.current = settings;
|
|
214
366
|
}
|
|
215
367
|
get() {
|
|
216
368
|
return structuredClone(this.current);
|
|
217
369
|
}
|
|
218
|
-
/** Replaces the settings: a
|
|
370
|
+
/** Replaces the settings: a tool `map` leaves out takes its defaults. Durable before it returns. */
|
|
219
371
|
put(map) {
|
|
220
|
-
const kept = Object.fromEntries(
|
|
372
|
+
const kept = Object.fromEntries(Object.entries(map).flatMap(([name, setting]) => {
|
|
373
|
+
const set = { ...(setting?.provider ? { provider: setting.provider } : {}), ...(setting?.permission ? { permission: setting.permission } : {}) };
|
|
374
|
+
return Object.keys(set).length ? [[name, set]] : [];
|
|
375
|
+
}));
|
|
221
376
|
writeDurableSync(join(this.dir, ToolSettings.FILE), `${JSON.stringify(kept)}\n`);
|
|
222
377
|
this.current = kept;
|
|
223
378
|
return this.get();
|
|
224
379
|
}
|
|
225
380
|
}
|
|
226
|
-
/** GET /v2/agents/{id}'s `tools`: each tool its current revision grants, in `order` (capabilities.tools'),
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
381
|
+
/** GET /v2/agents/{id}'s `tools`: each tool its current revision grants, in `order` (capabilities.tools'), with its
|
|
382
|
+
* permission in force and where it came from (the agent's own settings, the server's, or the default), the one that
|
|
383
|
+
* applies when the agent sets none (the server's, else the default) and those it may be set to; and for one with a
|
|
384
|
+
* provider choice the provider in force and where it came from, the one that applies when the agent sets none, and what
|
|
385
|
+
* it resolves to on the agent's harness and model. */
|
|
230
386
|
export function agentTools(env, settings, agent, order) {
|
|
231
387
|
const plane = planeFor(env, agent, settings);
|
|
232
388
|
const rank = (name) => order.indexOf(capabilityOf(name)) + (name in LEGACY_NAMES ? 0.5 : 0);
|
|
233
389
|
return [...new Set(agent.tools)].sort((a, b) => rank(a) - rank(b)).map((name) => {
|
|
234
390
|
const capability = capabilityOf(name);
|
|
391
|
+
const { permission, from } = permissionFrom(name, settings, (agent.overrides ?? {}));
|
|
392
|
+
const gate = { permission, permission_from: from, default_permission: permissionOf(name, settings), permissions: [...permissionsOf(name)] };
|
|
235
393
|
if (!Object.hasOwn(PROVIDERS, capability))
|
|
236
|
-
return { name };
|
|
394
|
+
return { name, ...gate };
|
|
237
395
|
const pick = capability;
|
|
238
396
|
const own = agent.overrides?.[pick]?.provider;
|
|
239
397
|
const server = settings[pick]?.provider;
|
|
240
|
-
return { name, provider: own ?? server ?? PROVIDERS[pick][0], provider_from: own ? "agent" : server ? "server" : "default", default_provider: server ?? PROVIDERS[pick][0], resolved: plane[pick] };
|
|
398
|
+
return { name, ...gate, provider: own ?? server ?? PROVIDERS[pick][0], provider_from: own ? "agent" : server ? "server" : "default", default_provider: server ?? PROVIDERS[pick][0], resolved: plane[pick] };
|
|
241
399
|
});
|
|
242
400
|
}
|
package/dist/tools.d.ts
CHANGED
|
@@ -5,10 +5,11 @@ import type { Revision } from "@parcha/pi-durable-agent";
|
|
|
5
5
|
import type { CodingSource } from "./coding-tools.js";
|
|
6
6
|
import { type Complete } from "./llm.js";
|
|
7
7
|
import { type Ledger } from "./paid-calls.js";
|
|
8
|
-
import { type Tooling, type ToolSettingsMap } from "./tool-plane.js";
|
|
8
|
+
import { type Plane, type Tooling, type ToolSettingsMap } from "./tool-plane.js";
|
|
9
9
|
export declare const ASK_TOOL = "ask_person";
|
|
10
|
-
/** Under `--faux` only: a module whose default export gives the browser's `{ provider, driver }
|
|
11
|
-
*
|
|
10
|
+
/** Under `--faux` only: a module whose default export gives the browser's `{ provider, driver }` for the run's
|
|
11
|
+
* environment, the vendor its plane names (`browserbase`, `kernel`) and the saved sign-in it was handed for that
|
|
12
|
+
* vendor (`{ provider, ref, save }`, or undefined), in place of that vendor's (the tests' fake backend). */
|
|
12
13
|
export declare const FAUX_BROWSER_ENV = "AGENTRUN_SERVE_FAUX_BROWSER";
|
|
13
14
|
/** What the result of `ask_person` says; the person's page shows the question as a waiting row. */
|
|
14
15
|
export declare const asked: (question: string) => string;
|
|
@@ -83,6 +84,44 @@ export declare const evidenceIn: (work: string) => {
|
|
|
83
84
|
bodyLine?: undefined;
|
|
84
85
|
}>;
|
|
85
86
|
};
|
|
87
|
+
/** The Browserbase contexts a run's browser may open: its agent's saved sign-in's alone, by its profile name, never one
|
|
88
|
+
* made here (nothing a run makes is kept for its agent). */
|
|
89
|
+
export declare const keptContexts: (ref: string | undefined) => {
|
|
90
|
+
clear: boolean;
|
|
91
|
+
resolve: (key: string) => Promise<string>;
|
|
92
|
+
};
|
|
93
|
+
/** Kernel's provider, opening the agent's saved profile (`ref`, its name at Kernel) where a session asks for the
|
|
94
|
+
* profile `default`: the policy, the session's record and the model see only that name. */
|
|
95
|
+
export declare const keptProfile: <P extends {
|
|
96
|
+
create(spec: {
|
|
97
|
+
profile?: {
|
|
98
|
+
name: string;
|
|
99
|
+
save: boolean;
|
|
100
|
+
};
|
|
101
|
+
}, signal: AbortSignal): unknown;
|
|
102
|
+
}>(provider: P, ref: string) => P;
|
|
103
|
+
/** `provider`, its sessions' profile as this launch was handed it, whatever the policy a conversation was made with (a
|
|
104
|
+
* follow-up's was made under an earlier launch, which may have had no sign-in, or another lease): with a sign-in, every
|
|
105
|
+
* session opens on the profile `default`, saving only as `kept.save` says; without one, none asks for a profile. */
|
|
106
|
+
export declare const asHanded: <P extends {
|
|
107
|
+
create(spec: {
|
|
108
|
+
profile?: {
|
|
109
|
+
name: string;
|
|
110
|
+
save: boolean;
|
|
111
|
+
};
|
|
112
|
+
}, signal: AbortSignal): unknown;
|
|
113
|
+
}>(provider: P, kept: {
|
|
114
|
+
save: boolean;
|
|
115
|
+
} | undefined) => P;
|
|
116
|
+
/** Whether a session's change is one that saved to the run's sign-in, in a run that saves (every session of it runs on
|
|
117
|
+
* the profile, asHanded, whatever its record names): let go by the run (its tool, its idle time, a relaunch, its close,
|
|
118
|
+
* its end), never one the vendor had already lost or never made. */
|
|
119
|
+
export declare const savedOnRelease: (row: {
|
|
120
|
+
session: {
|
|
121
|
+
resourceId: string | null;
|
|
122
|
+
releaseReason: string | null;
|
|
123
|
+
};
|
|
124
|
+
}, change: string) => boolean;
|
|
86
125
|
export declare const TOOLS: Readonly<Record<string, ToolEntry>>;
|
|
87
126
|
/** Every name a revision may name, those a workflow's model node may, and those a workflow's call node may run. */
|
|
88
127
|
export declare const BOUND_TOOLS: readonly string[];
|
|
@@ -91,10 +130,20 @@ export declare const CALL_TOOLS: readonly string[];
|
|
|
91
130
|
/** Whether `name` is one of `allowed`, or a legacy name for one (fetch_page, web_fetch's): a revision that names it
|
|
92
131
|
* still saves and runs, though the table lists it no more. */
|
|
93
132
|
export declare const allows: (allowed: readonly string[], name: string) => boolean;
|
|
94
|
-
/** The tools a run's learned workflow
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
|
|
133
|
+
/** The tools a run's learned workflow may name (learn/check.ts at learn time, learned-workflow.ts at a call): those of the
|
|
134
|
+
* agent's `granted` tools a workflow's call node runs here (CALL_TOOLS), each as granted and by its capability's name,
|
|
135
|
+
* and with the run's `plane`, none it resolves unavailable (its agent's own tool of the name does not run either). A
|
|
136
|
+
* learned model node runs without tools (learn/skills.ts MODEL_NODE_TOOLS), and a harness's own tool (Bash,
|
|
137
|
+
* exec_command, apply_patch) is never one, so the DSL refuses a draft that names it. */
|
|
138
|
+
export declare const learnedWorkflowTools: (granted: readonly string[], plane?: Plane) => string[];
|
|
139
|
+
/** The tools a learned draft may name (learnedWorkflowTools) that the gate allows: `permission` is what the gate holds a
|
|
140
|
+
* tool to now (tool-gate.ts permissionOf, or the run's gate's policy), by its capability's settings key, as the gate
|
|
141
|
+
* holds a legacy name. One set to ask or deny is left out of `tools`, so the end-of-run prompt never offers it, and named
|
|
142
|
+
* in `gated` with its setting, which the checker and a learned workflow's check before it runs refuse a draft for. */
|
|
143
|
+
export declare const learnedDraftTools: (granted: readonly string[], permission: (name: string) => string, plane?: Plane) => {
|
|
144
|
+
tools: string[];
|
|
145
|
+
gated: Record<string, string>;
|
|
146
|
+
};
|
|
98
147
|
/** The tools a workflow names (`nodes` from workflowNodes): on its model nodes (`tools`), and on its `call` nodes
|
|
99
148
|
* `via: "tool"` (`tool`). */
|
|
100
149
|
export declare function workflowTools(nodes: readonly Record<string, unknown>[]): {
|
|
@@ -127,14 +176,20 @@ export declare function toolRefusal(names: readonly string[], env: NodeJS.Proces
|
|
|
127
176
|
* sets none), the default, and what it resolves to on each harness under the server's `settings`: available where any
|
|
128
177
|
* is not unavailable, and missing PARALLEL_API_KEY where Parallel is picked without it. An unavailable tool says why
|
|
129
178
|
* (`reason`). `noBox`: why no box can run a sandbox-only tool here (place.ts noBoxReason), which leaves it
|
|
130
|
-
* unavailable with that reason; undefined, a box can.
|
|
131
|
-
|
|
132
|
-
|
|
179
|
+
* unavailable with that reason; undefined, a box can. `refused`: the variables of the keys this server was started with
|
|
180
|
+
* that their provider refused at the start (ToolKeys.refused), each with why: a tool that needs one is unavailable,
|
|
181
|
+
* saying that. Each tool also gives its permission under the server's settings (tool-gate.ts), the owner's default
|
|
182
|
+
* and the permissions it may be set to. */
|
|
183
|
+
export declare const toolsView: (env: NodeJS.ProcessEnv, settings?: ToolSettingsMap, noBox?: string, refused?: Readonly<Record<string, string>>) => {
|
|
184
|
+
providers?: ("browserbase" | "kernel" | "chrome" | "auto" | "off" | "parallel" | "native" | "exa-keyless")[] | undefined;
|
|
133
185
|
provider?: string | undefined;
|
|
134
|
-
default_provider?: "
|
|
135
|
-
resolves?: Record<"pi" | "claude-agent" | "codex", import("./tool-plane.js").Resolution> | undefined;
|
|
136
|
-
why?: Record<"pi" | "claude-agent" | "codex", string> | undefined;
|
|
137
|
-
harnesses: ("pi" | "claude-agent" | "codex")[];
|
|
186
|
+
default_provider?: "kernel" | "auto" | undefined;
|
|
187
|
+
resolves?: Record<"pi" | "claude-agent" | "codex" | "opencode", import("./tool-plane.js").Resolution> | undefined;
|
|
188
|
+
why?: Record<"pi" | "claude-agent" | "codex" | "opencode", string> | undefined;
|
|
189
|
+
harnesses: ("pi" | "claude-agent" | "codex" | "opencode")[];
|
|
190
|
+
permission: "ask" | "deny" | "allow";
|
|
191
|
+
default_permission: "ask" | "deny" | "allow";
|
|
192
|
+
permissions: ("ask" | "deny" | "allow")[];
|
|
138
193
|
missing?: string[] | undefined;
|
|
139
194
|
reason?: string | undefined;
|
|
140
195
|
available: boolean;
|