@parcha/agentrun-serve 0.0.0-stage → 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 +748 -0
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +2190 -2
- package/dist/adapters.d.ts +234 -0
- package/dist/adapters.js +585 -0
- package/dist/agents.d.ts +130 -0
- package/dist/agents.js +308 -0
- package/dist/app.d.ts +7 -0
- package/dist/app.js +384 -0
- package/dist/background.d.ts +28 -0
- package/dist/background.js +376 -0
- package/dist/bound-files.d.ts +4 -0
- package/dist/bound-files.js +164 -0
- package/dist/box/record.d.ts +6 -0
- package/dist/box/record.js +41 -0
- package/dist/box/sweep.d.ts +53 -0
- package/dist/box/sweep.js +193 -0
- package/dist/box-egress.d.ts +98 -0
- package/dist/box-egress.js +259 -0
- package/dist/box-image.d.ts +98 -0
- package/dist/box-image.js +285 -0
- package/dist/box-relay-vm.d.ts +80 -0
- package/dist/box-relay-vm.js +389 -0
- package/dist/box-relay.d.ts +45 -0
- package/dist/box-relay.js +227 -0
- package/dist/boxes.d.ts +72 -0
- package/dist/boxes.js +189 -0
- package/dist/browser-cost.d.ts +41 -0
- package/dist/browser-cost.js +158 -0
- package/dist/cap.d.ts +332 -0
- package/dist/cap.js +992 -0
- package/dist/catalog.d.ts +20 -0
- package/dist/catalog.js +53 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +167 -0
- package/dist/coding-tools.d.ts +35 -0
- package/dist/coding-tools.js +87 -0
- package/dist/console/THIRD-PARTY-NOTICES.txt +1721 -0
- package/dist/console/assets/index-34jfpIbQ.js +481 -0
- package/dist/console/assets/index-DUHbWcIP.css +1 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-400-normal-CIEtRijs.woff +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-600-normal-BB5xRk30.woff +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-ext-400-normal-BHyURHCj.woff +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-ext-400-normal-C_uLvvQ5.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-ext-600-normal-Dj6eZy5f.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-ext-600-normal-DpeVePZf.woff +0 -0
- package/dist/console/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-greek-400-normal-CNojz0t3.woff +0 -0
- package/dist/console/assets/jetbrains-mono-greek-600-normal-3KAm9r92.woff +0 -0
- package/dist/console/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-400-normal-B11XCQ5g.woff +0 -0
- package/dist/console/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-600-normal-DXv3JcnD.woff +0 -0
- package/dist/console/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-ext-400-normal-DHMOLxAi.woff +0 -0
- package/dist/console/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-ext-600-normal-DiQlUoE6.woff +0 -0
- package/dist/console/assets/jetbrains-mono-vietnamese-400-normal-BeU3T8wf.woff +0 -0
- package/dist/console/assets/jetbrains-mono-vietnamese-400-normal-ByoDsISC.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-vietnamese-600-normal-CSpzN4cI.woff +0 -0
- package/dist/console/assets/jetbrains-mono-vietnamese-600-normal-Dtizs43-.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-400-normal-Cph9ettZ.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-400-normal-DfGZKnlb.woff +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-600-normal-BGBUNdzT.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-600-normal-COje25QW.woff +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-ext-400-normal-4l4lq8zr.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-ext-400-normal-BGzXWJeR.woff +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-ext-600-normal-8_E36CQj.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-ext-600-normal-C27an7Zc.woff +0 -0
- package/dist/console/index.html +15 -0
- package/dist/content-filter.d.ts +7 -0
- package/dist/content-filter.js +23 -0
- package/dist/daytona-api.d.ts +21 -0
- package/dist/daytona-api.js +101 -0
- package/dist/decision-rows.d.ts +19 -0
- package/dist/decision-rows.js +123 -0
- package/dist/decisions.d.ts +94 -0
- package/dist/decisions.js +184 -0
- package/dist/effort-guidance.d.ts +5 -0
- package/dist/effort-guidance.js +14 -0
- package/dist/environment.d.ts +5 -0
- package/dist/environment.js +11 -0
- package/dist/errors.d.ts +74 -0
- package/dist/errors.js +69 -0
- package/dist/exa-keyless.d.ts +35 -0
- package/dist/exa-keyless.js +202 -0
- package/dist/fetch-page.d.ts +114 -0
- package/dist/fetch-page.js +182 -0
- package/dist/files.d.ts +65 -0
- package/dist/files.js +158 -0
- package/dist/grade.d.ts +93 -0
- package/dist/grade.js +328 -0
- package/dist/graph-served.d.ts +23 -0
- package/dist/graph-served.js +75 -0
- package/dist/graph-view.d.ts +102 -0
- package/dist/graph-view.js +219 -0
- package/dist/harness-app.d.ts +40 -0
- package/dist/harness-app.js +708 -0
- 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 +56 -0
- package/dist/harness.js +77 -0
- package/dist/home-path.d.ts +27 -0
- package/dist/home-path.js +78 -0
- package/dist/host-tools.d.ts +30 -0
- package/dist/host-tools.js +154 -0
- package/dist/host.d.ts +39 -0
- package/dist/host.js +85 -0
- package/dist/hosted-search.d.ts +27 -0
- package/dist/hosted-search.js +133 -0
- package/dist/import-sources.d.ts +104 -0
- package/dist/import-sources.js +629 -0
- package/dist/import-summary.d.ts +25 -0
- package/dist/import-summary.js +75 -0
- package/dist/import-worker.d.ts +26 -0
- package/dist/import-worker.js +41 -0
- package/dist/import.d.ts +145 -0
- package/dist/import.js +1222 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6 -0
- package/dist/key-check.d.ts +37 -0
- package/dist/key-check.js +112 -0
- package/dist/key-refusal.d.ts +51 -0
- package/dist/key-refusal.js +191 -0
- package/dist/learn/check.d.ts +108 -0
- package/dist/learn/check.js +277 -0
- package/dist/learn/grade.d.ts +80 -0
- package/dist/learn/grade.js +445 -0
- package/dist/learn/index.d.ts +7 -0
- package/dist/learn/index.js +11 -0
- package/dist/learn/invisible.d.ts +5 -0
- package/dist/learn/invisible.js +42 -0
- package/dist/learn/notes.d.ts +59 -0
- package/dist/learn/notes.js +147 -0
- package/dist/learn/reflect.d.ts +49 -0
- package/dist/learn/reflect.js +213 -0
- package/dist/learn/secrets.d.ts +18 -0
- package/dist/learn/secrets.js +131 -0
- package/dist/learn/skills.d.ts +97 -0
- package/dist/learn/skills.js +271 -0
- package/dist/learned-workflow.d.ts +59 -0
- package/dist/learned-workflow.js +191 -0
- package/dist/learning-routes.d.ts +196 -0
- package/dist/learning-routes.js +609 -0
- package/dist/learning-run.d.ts +306 -0
- package/dist/learning-run.js +819 -0
- package/dist/learning-words.d.ts +76 -0
- package/dist/learning-words.js +174 -0
- package/dist/learning.d.ts +418 -0
- package/dist/learning.js +946 -0
- package/dist/llm.d.ts +40 -0
- package/dist/llm.js +37 -0
- package/dist/llms.txt +37 -0
- package/dist/mcp-servers.d.ts +118 -0
- package/dist/mcp-servers.js +450 -0
- package/dist/mcp.d.ts +51 -0
- package/dist/mcp.js +392 -0
- package/dist/model.d.ts +186 -0
- package/dist/model.js +485 -0
- package/dist/monid.d.ts +74 -0
- package/dist/monid.js +277 -0
- package/dist/openapi/agentrun-v2.openapi.json +4806 -0
- package/dist/openapi.d.ts +10 -0
- package/dist/openapi.js +1727 -0
- package/dist/owner.d.ts +55 -0
- package/dist/owner.js +222 -0
- package/dist/packs.d.ts +71 -0
- package/dist/packs.js +180 -0
- package/dist/page.d.ts +32 -0
- package/dist/page.js +133 -0
- package/dist/paid-calls.d.ts +50 -0
- package/dist/paid-calls.js +110 -0
- package/dist/pause.d.ts +70 -0
- package/dist/pause.js +97 -0
- package/dist/pdf-pages.d.ts +44 -0
- package/dist/pdf-pages.js +147 -0
- package/dist/place.d.ts +69 -0
- package/dist/place.js +137 -0
- package/dist/print.d.ts +20 -0
- package/dist/print.js +29 -0
- package/dist/propose.d.ts +40 -0
- package/dist/propose.js +112 -0
- package/dist/quiet-sqlite-warning.d.ts +1 -0
- package/dist/quiet-sqlite-warning.js +14 -0
- package/dist/request-start.d.ts +22 -0
- package/dist/request-start.js +350 -0
- package/dist/result.d.ts +3 -0
- package/dist/result.js +5 -0
- package/dist/rows.d.ts +46 -0
- package/dist/rows.js +121 -0
- package/dist/run-box.d.ts +186 -0
- package/dist/run-box.js +590 -0
- package/dist/run-manifest.d.ts +27 -0
- package/dist/run-manifest.js +60 -0
- package/dist/runnable.d.ts +83 -0
- package/dist/runnable.js +170 -0
- package/dist/runs.d.ts +1062 -0
- package/dist/runs.js +3020 -0
- package/dist/secret-cut.d.ts +27 -0
- package/dist/secret-cut.js +109 -0
- package/dist/secrets.d.ts +62 -0
- package/dist/secrets.js +158 -0
- package/dist/server-lock.d.ts +44 -0
- package/dist/server-lock.js +140 -0
- package/dist/server.d.ts +722 -0
- package/dist/server.js +2118 -0
- package/dist/sessions.d.ts +4 -0
- package/dist/sessions.js +105 -0
- package/dist/sign-ins.d.ts +99 -0
- package/dist/sign-ins.js +288 -0
- package/dist/skills.d.ts +43 -0
- package/dist/skills.js +96 -0
- package/dist/stats.d.ts +106 -0
- package/dist/stats.js +103 -0
- package/dist/tool-gate.d.ts +266 -0
- package/dist/tool-gate.js +554 -0
- package/dist/tool-keys.d.ts +187 -0
- package/dist/tool-keys.js +315 -0
- package/dist/tool-plane.d.ts +228 -0
- package/dist/tool-plane.js +400 -0
- package/dist/tools.d.ts +202 -0
- package/dist/tools.js +372 -0
- 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 +24 -0
- package/dist/turn-end.js +15 -0
- package/dist/turns.d.ts +34 -0
- package/dist/turns.js +202 -0
- package/dist/uploads.d.ts +104 -0
- package/dist/uploads.js +474 -0
- package/dist/usage-lines.d.ts +26 -0
- package/dist/usage-lines.js +28 -0
- package/dist/usage.d.ts +29 -0
- package/dist/usage.js +58 -0
- package/dist/validate.d.ts +57 -0
- package/dist/validate.js +184 -0
- package/dist/web-fetch.d.ts +64 -0
- package/dist/web-fetch.js +262 -0
- package/dist/web-search.d.ts +54 -0
- package/dist/web-search.js +136 -0
- package/dist/webhooks.d.ts +189 -0
- package/dist/webhooks.js +503 -0
- package/dist/workspace-paths.d.ts +33 -0
- package/dist/workspace-paths.js +104 -0
- package/dist/workspace.d.ts +88 -0
- package/dist/workspace.js +369 -0
- package/launcher/agentrun-serve +109 -0
- package/package.json +100 -4
- package/skills/agentrun-serve/SKILL.md +128 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import type { InputIssue } from "./errors.js";
|
|
2
|
+
import { type HarnessId } from "./harness.js";
|
|
3
|
+
import { type Permission } from "./tool-gate.js";
|
|
4
|
+
/**
|
|
5
|
+
* The capabilities a pack or a revision may grant, by name: the tools the kernel gives a run, bound from serve's closed
|
|
6
|
+
* table (tools.ts) and named the same on every harness that runs them. `web_search` and `web_fetch` resolve to a
|
|
7
|
+
* provider (PROVIDERS); the rest are the kernel's own. Not capabilities: `fetch_page` (legacy: web_fetch's guarded fetch
|
|
8
|
+
* with no provider behind it), the workflow call nodes' `pdf_pages` and `llm` (a workflow's call node names them, a grant
|
|
9
|
+
* never does), and a catalog's tools (`monid.*`, `mcp:<server>/<tool>`: catalog tools, which their catalog grants).
|
|
10
|
+
*/
|
|
11
|
+
export declare const CAPABILITIES: readonly ["read", "write", "edit", "web_search", "web_fetch", "browser", "ask_person"];
|
|
12
|
+
export type Capability = (typeof CAPABILITIES)[number];
|
|
13
|
+
/** The providers a user may pick for each capability that has a choice, its default first: `auto`, the native search
|
|
14
|
+
* where there is one (never on claude-agent, where Claude's own search is picked as `native`), else Parallel where the
|
|
15
|
+
* server holds its key, else keyless Exa; `native`, the harness's own tool or its model provider's hosted one, and
|
|
16
|
+
* nothing else; `exa-keyless`, Exa's public MCP endpoint, no key; `kernel`, the guarded direct fetch; `parallel`,
|
|
17
|
+
* Parallel's Search and Extract APIs on PARALLEL_API_KEY; `off`, web_search turned off: nothing is searched, and an
|
|
18
|
+
* agent naming it is refused until it is turned on again. The browser's: `auto`, Browserbase where the server holds its
|
|
19
|
+
* keys, else Kernel where it holds Kernel's; `browserbase` or `kernel`, that one alone; `chrome`, a Chrome on the
|
|
20
|
+
* server's own host, which no server sets up yet (browserBy). */
|
|
21
|
+
export declare const PROVIDERS: Readonly<{
|
|
22
|
+
readonly web_search: readonly ["auto", "native", "exa-keyless", "parallel", "off"];
|
|
23
|
+
readonly web_fetch: readonly ["kernel", "parallel"];
|
|
24
|
+
readonly browser: readonly ["auto", "browserbase", "kernel", "chrome"];
|
|
25
|
+
}>;
|
|
26
|
+
export type Pickable = keyof typeof PROVIDERS;
|
|
27
|
+
export declare const PICKABLE: Pickable[];
|
|
28
|
+
/** Older names a revision may still grant, and the capability each one is: `fetch_page` runs web_fetch, under its own
|
|
29
|
+
* name, and resolves as web_fetch does. */
|
|
30
|
+
export declare const LEGACY_NAMES: Readonly<Record<string, Pickable>>;
|
|
31
|
+
/** The capability a granted name runs: its legacy target, else itself. */
|
|
32
|
+
export declare const capabilityOf: (name: string) => string;
|
|
33
|
+
/** Every tool of serve's table (tools.ts) and its legacy names, by name, so this module needs no import of it: a test
|
|
34
|
+
* holds the two as one. */
|
|
35
|
+
export declare const TABLE_TOOLS: readonly string[];
|
|
36
|
+
/** The tools whose approved call the kernel runs itself, outside the model's turn (host-tools.ts's REPLAY): ask is
|
|
37
|
+
* offered for these and for catalog tools. Any other (browser, ask_person, the call-only ones) is allow or deny. The
|
|
38
|
+
* run's learned_workflow is one (tool-gate.ts runs an approved call of it on the run's own tools). */
|
|
39
|
+
export declare const ASKABLE: readonly string[];
|
|
40
|
+
/** The permissions `name` may be set to. */
|
|
41
|
+
export declare const permissionsOf: (name: string) => readonly Permission[];
|
|
42
|
+
/** The run's own tools beyond the table, each its own settings key, allowed by default like a table tool: the learned
|
|
43
|
+
* workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL). */
|
|
44
|
+
export declare const SERVE_OWN_TOOLS: readonly string[];
|
|
45
|
+
/** One tool's settings: its provider (a capability that has a choice) and its permission. */
|
|
46
|
+
export type ToolSetting = {
|
|
47
|
+
provider?: string;
|
|
48
|
+
permission?: Permission;
|
|
49
|
+
};
|
|
50
|
+
/** The tools' settings, the server's (`/v2/settings/tools`) and an agent's own (`definition.tool_settings`), one shape:
|
|
51
|
+
* by settings key. */
|
|
52
|
+
export type ToolSettingsMap = Partial<Record<string, ToolSetting>>;
|
|
53
|
+
/** What a capability resolves to on a run: the native tool, the kernel's own, keyless Exa, Parallel, or why not. */
|
|
54
|
+
export type Resolution = "native" | "kernel" | "exa-keyless" | "parallel" | "browserbase" | `unavailable: ${string}`;
|
|
55
|
+
export declare const NO_PARALLEL_KEY: Resolution;
|
|
56
|
+
/** web_search with `off` picked: no search leaves the server. */
|
|
57
|
+
export declare const SEARCH_OFF: Resolution;
|
|
58
|
+
/** A capability set to deny: no provider is asked, and the gate refuses each call, so its run still starts. */
|
|
59
|
+
export declare const DENIED: Resolution;
|
|
60
|
+
/** `native` picked for a capability set to ask on a harness whose own search runs inside its CLI. */
|
|
61
|
+
export declare const NATIVE_ASKS: Resolution;
|
|
62
|
+
/** The model providers whose hosted web search pi's web_search asks (hosted-search.ts), by pi-ai's provider id. */
|
|
63
|
+
export declare const HOSTED_SEARCH_PROVIDERS: readonly string[];
|
|
64
|
+
/** A run's facts its capabilities resolve from. */
|
|
65
|
+
export type ResolveInput = {
|
|
66
|
+
harness: string;
|
|
67
|
+
/** The run's model as named, `provider/model-id`: the revision's, else the host's for its harness (hostModel: a tier
|
|
68
|
+
* variable or AGENT_MODEL it runs, else a model key's default). */
|
|
69
|
+
model?: string;
|
|
70
|
+
/** Its model requests go through a gateway (AGENT_MODEL_BASE_URL), not the provider's own API (pi's). */
|
|
71
|
+
gateway: boolean;
|
|
72
|
+
/** The agent's pick, then the server's; neither, the capability's default. */
|
|
73
|
+
override?: string;
|
|
74
|
+
pick?: string;
|
|
75
|
+
/** The server holds PARALLEL_API_KEY; `parallelKeyFrom`, where from: its own environment, or saved on Tool keys. */
|
|
76
|
+
parallelKey: boolean;
|
|
77
|
+
parallelKeyFrom?: "server" | "saved";
|
|
78
|
+
/** Which of the browser's providers the server holds the keys of (BROWSER_KEYS); none given, neither. */
|
|
79
|
+
browserKeys?: Record<BrowserVendor, boolean>;
|
|
80
|
+
/** The run has a spend cap: Codex's own search sends a request with no input bound, which a cap cannot admit. */
|
|
81
|
+
capped?: boolean;
|
|
82
|
+
/** The harness's model requests go through OpenRouter (model.ts' viaOpenRouter), where its own search does not run. */
|
|
83
|
+
openRouter?: boolean;
|
|
84
|
+
/** Its permission in force (tool-gate.ts); absent, allow. */
|
|
85
|
+
permission?: Permission;
|
|
86
|
+
};
|
|
87
|
+
/** What `capability` resolves to on a run of `input`, and why in a plain sentence (capabilities' `why`): one rule, so
|
|
88
|
+
* the two never disagree. */
|
|
89
|
+
export declare function explainCapability(capability: Pickable, input: ResolveInput): {
|
|
90
|
+
resolves: Resolution;
|
|
91
|
+
why: string;
|
|
92
|
+
};
|
|
93
|
+
/** What `capability` resolves to on a run of `input`. */
|
|
94
|
+
export declare const resolveCapability: (capability: Pickable, input: ResolveInput) => Resolution;
|
|
95
|
+
export declare const isUnavailable: (resolution: Resolution | undefined) => resolution is `unavailable: ${string}`;
|
|
96
|
+
/** Why a resolution is unavailable: its words after "unavailable: " (any other resolution as it is). */
|
|
97
|
+
export declare const whyUnavailable: (resolution: string) => string;
|
|
98
|
+
/** The keys each of the browser's vendors needs, by name: a tool key's fields (tool-keys.ts), set or saved. Its plane
|
|
99
|
+
* value is the vendor's id: `kernel` on browser is Kernel's hosted browser, never the guarded fetch web_fetch calls so. */
|
|
100
|
+
export declare const BROWSER_KEYS: Readonly<{
|
|
101
|
+
readonly browserbase: readonly ["BROWSERBASE_API_KEY", "BROWSERBASE_PROJECT_ID"];
|
|
102
|
+
readonly kernel: readonly ["KERNEL_API_KEY"];
|
|
103
|
+
}>;
|
|
104
|
+
type BrowserVendor = keyof typeof BROWSER_KEYS;
|
|
105
|
+
/** The keys a browser that resolves to `resolution` runs on: its vendor's (BROWSER_KEYS), none for no vendor. */
|
|
106
|
+
export declare const browserNeeds: (resolution: string | undefined) => readonly string[];
|
|
107
|
+
/** `auto` where the server holds neither vendor's keys. */
|
|
108
|
+
export declare const NO_BROWSER_KEY: Resolution;
|
|
109
|
+
/** `chrome` picked: a Chrome on the server's own host, refused by name until a server can set one up. */
|
|
110
|
+
export declare const NO_CHROME: Resolution;
|
|
111
|
+
/** Each pickable capability on each harness under the server's `settings` and an agent's `overrides`, on `model`
|
|
112
|
+
* (default each harness's host model, the one a run that names none runs on: hostModel): what it resolves to and why, as
|
|
113
|
+
* capabilities and the tool catalog show them. */
|
|
114
|
+
export declare function explainsView(env: NodeJS.ProcessEnv, settings: ToolSettingsMap, overrides?: ToolSettingsMap, model?: string): Record<Pickable, {
|
|
115
|
+
resolves: Record<HarnessId, Resolution>;
|
|
116
|
+
why: Record<HarnessId, string>;
|
|
117
|
+
}>;
|
|
118
|
+
/** What a run is told: each pickable capability its revision names, resolved; with web_search native on pi, the model
|
|
119
|
+
* its search asks (the one the resolution read). */
|
|
120
|
+
export type Plane = Partial<Record<Pickable, Resolution>> & {
|
|
121
|
+
model?: string;
|
|
122
|
+
};
|
|
123
|
+
/** The facts of a pinned revision its run's tools resolve from. */
|
|
124
|
+
export type Tooling = {
|
|
125
|
+
harness?: string;
|
|
126
|
+
tools: readonly string[];
|
|
127
|
+
model?: string;
|
|
128
|
+
overrides?: ToolSettingsMap;
|
|
129
|
+
workflow?: true;
|
|
130
|
+
};
|
|
131
|
+
/** The run's process's description of its tools' providers: JSON of its Plane. */
|
|
132
|
+
export declare const TOOL_PLANE_ENV = "AGENTRUN_SERVE_TOOL_PLANE";
|
|
133
|
+
/** The Plane of a run of `tooling`, in the server's `env` (with its secrets) under its `settings`. `run`: the Plane a
|
|
134
|
+
* run's process is handed, where a capability set to deny resolves as under ask (the provider a held call would use),
|
|
135
|
+
* since the gate refuses its calls while it is denied; else the one shown and checked, where it resolves denied. */
|
|
136
|
+
export declare function planeFor(env: NodeJS.ProcessEnv, tooling: Tooling, settings: ToolSettingsMap, { capped, run }?: {
|
|
137
|
+
capped?: boolean;
|
|
138
|
+
run?: boolean;
|
|
139
|
+
}): Plane;
|
|
140
|
+
/** A run's kept Plane at a later launch: as it was, but Parallel, or the browser's vendor, where the server no longer
|
|
141
|
+
* holds its key, which is unavailable, never another provider; and, given `now` (the Plane it would get today and each
|
|
142
|
+
* capability's permission today), a capability set to ask or deny, or kept denied, as it resolves today: a harness's
|
|
143
|
+
* own search cannot wait for a person, and a deny that was lifted is lifted. The browser keeps its vendor, whose
|
|
144
|
+
* sessions it has: only a deny it was kept with is lifted. */
|
|
145
|
+
export declare function recheckPlane(plane: Plane, env: NodeJS.ProcessEnv, now?: {
|
|
146
|
+
fresh: Plane;
|
|
147
|
+
permission: (name: Pickable) => Permission;
|
|
148
|
+
}): Plane;
|
|
149
|
+
/** The Plane kept for a run made before its plane was kept, resolved at a later launch (runs.ts): its browser stays
|
|
150
|
+
* Browserbase, the one vendor there was then, never today's pick, which could check its sessions at another vendor. It
|
|
151
|
+
* keeps the vendor, never a refusal: the plane each launch hands over is checked again (recheckPlane), so Browserbase's
|
|
152
|
+
* keys missing make it unavailable for that launch alone, and restored keys make the next one run. */
|
|
153
|
+
export declare const keptFromBefore: (plane: Plane) => Plane;
|
|
154
|
+
/** A run's saved Plane as a launch reads it: a vendor's missing-key refusal an earlier server saved (noBrowserKey's exact
|
|
155
|
+
* words, Browserbase's or Kernel's) is that vendor again, which the launch checks again as usual (recheckPlane), so
|
|
156
|
+
* restored keys make it run. Every other saved value stays as it is: `auto` with no key at a run's first launch
|
|
157
|
+
* (NO_BROWSER_KEY) and `chrome` stay frozen. The same Plane where nothing changes. */
|
|
158
|
+
export declare function keptVendor(plane: Plane): Plane;
|
|
159
|
+
/** The key row (tool-keys.ts) of the browser's vendor on `resolution` with `picked` the provider in force: Kernel's where
|
|
160
|
+
* Kernel is picked or resolved, else Browserbase's, so a page links a missing key to the row it is saved on. */
|
|
161
|
+
export declare const browserKeyRow: (picked: string | undefined, resolution: string | undefined) => "kernel" | "browserbase";
|
|
162
|
+
/** The Plane a run's process is handed at a launch, under the server's `settings` now: its kept Plane (as keptVendor
|
|
163
|
+
* reads it) checked again (recheckPlane) against the one it would get today; with none kept, today's, its browser kept
|
|
164
|
+
* (keptFromBefore). At a launch after its first (a relaunch, a follow-up's, one after a restart) a capability set
|
|
165
|
+
* to deny is handed denied (planeFor without `run`), the tool's own refusal backing the gate's; at its `first`, as
|
|
166
|
+
* under ask, so a deny lifted while that process lives is lifted at the next call. */
|
|
167
|
+
export declare function relaunchPlane(kept: Plane | undefined, env: NodeJS.ProcessEnv, tooling: Tooling | undefined, settings: ToolSettingsMap, { capped, first }?: {
|
|
168
|
+
capped?: boolean;
|
|
169
|
+
first?: boolean;
|
|
170
|
+
}): Plane;
|
|
171
|
+
/** The Plane the server handed this run's process; empty when it handed none. */
|
|
172
|
+
export declare function planeOf(env: NodeJS.ProcessEnv): Plane;
|
|
173
|
+
/** Whether a run is handed Parallel's key: one of its capabilities resolves to Parallel. */
|
|
174
|
+
export declare const handsParallel: (plane: Plane) => boolean;
|
|
175
|
+
/** The issues of `value` as a settings map, its fields under `at` (none: a body's own): each settings key (a tool of the
|
|
176
|
+
* table, a catalog tool, an MCP server's wildcard) to `{provider?, permission?}`, a provider only for a capability that
|
|
177
|
+
* has a choice and one offered for it, a permission one offered for the tool. */
|
|
178
|
+
export declare function settingsIssues(value: unknown, at?: string): InputIssue[];
|
|
179
|
+
/** `map` with each capability's provider, its default where none is picked; a permission where one is set. */
|
|
180
|
+
export declare const withDefaults: (map: ToolSettingsMap) => ToolSettingsMap & Record<Pickable, {
|
|
181
|
+
provider: string;
|
|
182
|
+
permission?: Permission;
|
|
183
|
+
}>;
|
|
184
|
+
/** The server's tool settings, beside the agent store in its data directory: not a secret, and not in store.sqlite,
|
|
185
|
+
* which runs hold open. Read once at the start, written whole and durably (0600) at each PUT; a missing file is every
|
|
186
|
+
* default, and so is one it cannot read, which it says in one line. */
|
|
187
|
+
/** The tool settings in `dir` as the server and the tool gate read them, failing closed: each entry that reads is kept;
|
|
188
|
+
* one that does not is dropped, but a known tool keeps what of it reads, and its permission, when not one offered,
|
|
189
|
+
* reads ask (deny where ask is not offered), never its allow default. `problems`: one line for each entry dropped or
|
|
190
|
+
* changed, naming the file and the field, never a value. `unreadable`: the file as a whole does not read (none, a
|
|
191
|
+
* missing file is every default). */
|
|
192
|
+
export declare function readToolSettings(dir: string): {
|
|
193
|
+
settings: ToolSettingsMap;
|
|
194
|
+
problems: string[];
|
|
195
|
+
unreadable?: true;
|
|
196
|
+
};
|
|
197
|
+
export declare class ToolSettings {
|
|
198
|
+
private readonly dir;
|
|
199
|
+
static readonly FILE = "tool-settings.json";
|
|
200
|
+
private current;
|
|
201
|
+
constructor(dir: string, warn?: (line: string) => void);
|
|
202
|
+
get(): ToolSettingsMap;
|
|
203
|
+
/** Replaces the settings: a tool `map` leaves out takes its defaults. Durable before it returns. */
|
|
204
|
+
put(map: ToolSettingsMap): ToolSettingsMap;
|
|
205
|
+
}
|
|
206
|
+
/** GET /v2/agents/{id}'s `tools`: each tool its current revision grants, in `order` (capabilities.tools'), with its
|
|
207
|
+
* permission in force and where it came from (the agent's own settings, the server's, or the default), the one that
|
|
208
|
+
* applies when the agent sets none (the server's, else the default) and those it may be set to; and for one with a
|
|
209
|
+
* provider choice the provider in force and where it came from, the one that applies when the agent sets none, and what
|
|
210
|
+
* it resolves to on the agent's harness and model. */
|
|
211
|
+
export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSettingsMap, agent: Tooling, order: readonly string[]): ({
|
|
212
|
+
permission: "ask" | "deny" | "allow";
|
|
213
|
+
permission_from: "default" | "agent" | "server";
|
|
214
|
+
default_permission: "ask" | "deny" | "allow";
|
|
215
|
+
permissions: ("ask" | "deny" | "allow")[];
|
|
216
|
+
name: string;
|
|
217
|
+
} | {
|
|
218
|
+
provider: string;
|
|
219
|
+
provider_from: string;
|
|
220
|
+
default_provider: string;
|
|
221
|
+
resolved: Resolution;
|
|
222
|
+
permission: "ask" | "deny" | "allow";
|
|
223
|
+
permission_from: "default" | "agent" | "server";
|
|
224
|
+
default_permission: "ask" | "deny" | "allow";
|
|
225
|
+
permissions: ("ask" | "deny" | "allow")[];
|
|
226
|
+
name: string;
|
|
227
|
+
})[];
|
|
228
|
+
export {};
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
// The tool plane: the capabilities a pack or a revision may grant, the providers a user may pick for the two that reach
|
|
2
|
+
// the web, and what each resolves to on a run. A capability resolves in one order: (1) the provider the user picked, the
|
|
3
|
+
// agent's own (`definition.tool_settings`) over the server's (`PUT /v2/settings/tools`), optional; (2) the native tool:
|
|
4
|
+
// the harness's own (claude-agent's WebSearch), or on pi one request to the run's own model provider with its hosted
|
|
5
|
+
// search (hosted-search.ts); (3) for web_search, Parallel where the server holds its key (env or saved, which then bills
|
|
6
|
+
// it); (4) the kernel's keyless fallback: web_fetch's guarded direct fetch, and web_search on Exa's public keyless MCP
|
|
7
|
+
// endpoint (exa-keyless.ts). On claude-agent `auto` skips (2): Claude's own search is an explicit pick, `native`. Codex's
|
|
8
|
+
// own search on codex, Parallel or keyless Exa behind a gateway, on OpenRouter or under a spend cap;
|
|
9
|
+
// `off` turns web_search off. web_search's default, `auto`, is that order; a pick of `native` is native only,
|
|
10
|
+
// unavailable where there is none, never Exa. A grant names a capability, never a provider. A pick of parallel without
|
|
11
|
+
// PARALLEL_API_KEY resolves unavailable, never to something else. The server resolves a run's tools at its first
|
|
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
|
+
// process the outcome as a non-secret description (TOOL_PLANE_ENV): the run reads its tools' providers there, never from
|
|
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.
|
|
22
|
+
import { readFileSync } from "node:fs";
|
|
23
|
+
import { isToolSettingsKey } from "@parcha/pi-durable-agent";
|
|
24
|
+
import { join } from "node:path";
|
|
25
|
+
import { decisionKeysOf, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
26
|
+
import { writeDurableSync } from "./files.js";
|
|
27
|
+
import { DEFAULT_HARNESS, HARNESSES } from "./harness.js";
|
|
28
|
+
import { savedIn } from "./secrets.js";
|
|
29
|
+
import { hostModel, viaOpenRouter } from "./model.js";
|
|
30
|
+
import { isCatalogTool, isMcpTool, PERMISSIONS, permissionFrom, permissionOf, SHELL_FAMILY } from "./tool-gate.js";
|
|
31
|
+
/**
|
|
32
|
+
* The capabilities a pack or a revision may grant, by name: the tools the kernel gives a run, bound from serve's closed
|
|
33
|
+
* table (tools.ts) and named the same on every harness that runs them. `web_search` and `web_fetch` resolve to a
|
|
34
|
+
* provider (PROVIDERS); the rest are the kernel's own. Not capabilities: `fetch_page` (legacy: web_fetch's guarded fetch
|
|
35
|
+
* with no provider behind it), the workflow call nodes' `pdf_pages` and `llm` (a workflow's call node names them, a grant
|
|
36
|
+
* never does), and a catalog's tools (`monid.*`, `mcp:<server>/<tool>`: catalog tools, which their catalog grants).
|
|
37
|
+
*/
|
|
38
|
+
export const CAPABILITIES = ["read", "write", "edit", "web_search", "web_fetch", "browser", "ask_person"];
|
|
39
|
+
/** The providers a user may pick for each capability that has a choice, its default first: `auto`, the native search
|
|
40
|
+
* where there is one (never on claude-agent, where Claude's own search is picked as `native`), else Parallel where the
|
|
41
|
+
* server holds its key, else keyless Exa; `native`, the harness's own tool or its model provider's hosted one, and
|
|
42
|
+
* nothing else; `exa-keyless`, Exa's public MCP endpoint, no key; `kernel`, the guarded direct fetch; `parallel`,
|
|
43
|
+
* Parallel's Search and Extract APIs on PARALLEL_API_KEY; `off`, web_search turned off: nothing is searched, and an
|
|
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"] });
|
|
48
|
+
export const PICKABLE = Object.keys(PROVIDERS);
|
|
49
|
+
/** Older names a revision may still grant, and the capability each one is: `fetch_page` runs web_fetch, under its own
|
|
50
|
+
* name, and resolves as web_fetch does. */
|
|
51
|
+
export const LEGACY_NAMES = Object.freeze({ fetch_page: "web_fetch" });
|
|
52
|
+
/** The capability a granted name runs: its legacy target, else itself. */
|
|
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));
|
|
69
|
+
export const NO_PARALLEL_KEY = "unavailable: parallel picked, no PARALLEL_API_KEY";
|
|
70
|
+
/** web_search with `off` picked: no search leaves the server. */
|
|
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";
|
|
76
|
+
/** The model providers whose hosted web search pi's web_search asks (hosted-search.ts), by pi-ai's provider id. */
|
|
77
|
+
export const HOSTED_SEARCH_PROVIDERS = ["anthropic", "openai"];
|
|
78
|
+
/** Why claude-agent has no native search under a spend cap, and what works there instead. */
|
|
79
|
+
const CLAUDE_CAPPED = "claude-agent under a spend cap: Claude's own search has per-use fees a spend cap cannot reserve yet, so web_search works under a cap through the default provider, auto";
|
|
80
|
+
/** Why a run of `input` has no native search, where it has none: `id`, as the unavailable text names it, and `why`, the
|
|
81
|
+
* same in a sentence (capabilities' `why`). */
|
|
82
|
+
function noNative(input) {
|
|
83
|
+
// Native, where there is one. Claude's model goes to Anthropic's Messages API (or its own ANTHROPIC_BASE_URL), never
|
|
84
|
+
// through the other harnesses' gateway; Codex's own search goes to OpenAI with its request, except behind a gateway
|
|
85
|
+
// (no known hosted search), on OpenRouter (which runs neither harness's own search, nor counts its searches) or
|
|
86
|
+
// under a spend cap (its request has no input bound, which a cap cannot admit); pi asks
|
|
87
|
+
// Anthropic's or OpenAI's. Under a spend cap Claude's own search is not offered either: each search has a per-use fee
|
|
88
|
+
// the cap cannot reserve yet (its request's bound holds the pages' input tokens, not the fees). Where there is none,
|
|
89
|
+
// `native` is unavailable, and `auto` goes to Parallel on the server's key (its fee booked and held by a cap, paid-calls.ts),
|
|
90
|
+
// else to keyless Exa.
|
|
91
|
+
const vendor = input.model?.slice(0, Math.max(0, input.model.indexOf("/")));
|
|
92
|
+
if ((input.harness === "claude-agent" || input.harness === "codex") && input.openRouter)
|
|
93
|
+
return { id: `${input.harness} on OpenRouter`, why: `through OpenRouter ${input.harness === "codex" ? "Codex" : "Claude"}'s own search is not run, and its searches are not counted to price` };
|
|
94
|
+
if (input.harness === "claude-agent")
|
|
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;
|
|
96
|
+
if (input.harness === "codex")
|
|
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" };
|
|
101
|
+
if (input.gateway)
|
|
102
|
+
return { id: `${input.harness} behind a gateway`, why: `behind a gateway ${input.harness} has no hosted search` };
|
|
103
|
+
if (vendor && HOSTED_SEARCH_PROVIDERS.includes(vendor))
|
|
104
|
+
return undefined;
|
|
105
|
+
return input.model ? { id: input.model, why: `${input.model} has no hosted search here` } : { id: "a model with none named", why: "no model is named, so there is no hosted search" };
|
|
106
|
+
}
|
|
107
|
+
/** The native search of a run that has one, in a sentence. */
|
|
108
|
+
const nativeWhy = (input) => input.harness === "claude-agent" ? "Claude's own search" : input.harness === "codex" ? "Codex's own search" : `${input.model?.startsWith("openai/") ? "OpenAI" : "Anthropic"}'s hosted search, for ${input.model}`;
|
|
109
|
+
/** What `capability` resolves to on a run of `input`, and why in a plain sentence (capabilities' `why`): one rule, so
|
|
110
|
+
* the two never disagree. */
|
|
111
|
+
export function explainCapability(capability, input) {
|
|
112
|
+
const chosen = input.override ?? input.pick ?? PROVIDERS[capability][0];
|
|
113
|
+
const picked = input.override !== undefined ? "picked for this agent" : "picked in settings";
|
|
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" };
|
|
117
|
+
if (chosen === "off")
|
|
118
|
+
return { resolves: SEARCH_OFF, why: "turned off in settings" };
|
|
119
|
+
if (chosen === "parallel")
|
|
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" };
|
|
121
|
+
if (capability === "web_fetch")
|
|
122
|
+
return { resolves: "kernel", why: "the guarded direct fetch" };
|
|
123
|
+
if (capability === "browser")
|
|
124
|
+
return browserBy(chosen, picked, input.browserKeys);
|
|
125
|
+
if (chosen === "exa-keyless")
|
|
126
|
+
return { resolves: "exa-keyless", why: `keyless Exa, ${picked}: Exa's free search, no key` };
|
|
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);
|
|
134
|
+
if (chosen === "native")
|
|
135
|
+
return none === undefined ? { resolves: "native", why: nativeWhy(input) } : { resolves: `unavailable: no native search for ${none.id}`, why: `no native search for ${none.id}` };
|
|
136
|
+
// On claude-agent `auto` skips Claude's own search, an explicit pick (`native`): Parallel on the server's key, else
|
|
137
|
+
// keyless Exa.
|
|
138
|
+
if (input.harness === "claude-agent")
|
|
139
|
+
return input.parallelKey ? { resolves: "parallel", why: key } : { resolves: "exa-keyless", why: "Exa's free keyless search, no key; Claude's own search is an explicit pick" };
|
|
140
|
+
if (none === undefined)
|
|
141
|
+
return { resolves: "native", why: nativeWhy(input) };
|
|
142
|
+
return input.parallelKey ? { resolves: "parallel", why: `${none.why}; ${key}` } : { resolves: "exa-keyless", why: `${none.why}; Exa's free keyless search, no key` };
|
|
143
|
+
}
|
|
144
|
+
/** What `capability` resolves to on a run of `input`. */
|
|
145
|
+
export const resolveCapability = (capability, input) => explainCapability(capability, input).resolves;
|
|
146
|
+
export const isUnavailable = (resolution) => resolution?.startsWith("unavailable: ") === true;
|
|
147
|
+
/** Why a resolution is unavailable: its words after "unavailable: " (any other resolution as it is). */
|
|
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
|
+
}
|
|
177
|
+
/** The server's environment's part of every resolution: its gateway and Parallel's key, and where the key is from. */
|
|
178
|
+
const served = (env) => {
|
|
179
|
+
const parallelKey = PARALLEL_KEY_ENV in decisionKeysOf(env);
|
|
180
|
+
return { gateway: Boolean(env.AGENT_MODEL_BASE_URL), parallelKey, browserKeys: browserKeysOf(env), ...(parallelKey ? { parallelKeyFrom: savedIn(env).has(PARALLEL_KEY_ENV) ? "saved" : "server" } : {}) };
|
|
181
|
+
};
|
|
182
|
+
/** Each pickable capability on each harness under the server's `settings` and an agent's `overrides`, on `model`
|
|
183
|
+
* (default each harness's host model, the one a run that names none runs on: hostModel): what it resolves to and why, as
|
|
184
|
+
* capabilities and the tool catalog show them. */
|
|
185
|
+
export function explainsView(env, settings, overrides = {}, model) {
|
|
186
|
+
return Object.fromEntries(PICKABLE.map((name) => {
|
|
187
|
+
const input = { ...served(env), ...picked(name, settings, overrides) };
|
|
188
|
+
const each = HARNESSES.map((harness) => {
|
|
189
|
+
const on = model ?? hostModel(env, "default", harness);
|
|
190
|
+
return [harness, explainCapability(name, { ...input, ...(on ? { model: on } : {}), harness, openRouter: viaOpenRouter(env, harness, on) })];
|
|
191
|
+
});
|
|
192
|
+
return [name, { resolves: Object.fromEntries(each.map(([harness, said]) => [harness, said.resolves])), why: Object.fromEntries(each.map(([harness, said]) => [harness, said.why])) }];
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
const picked = (name, settings, overrides = {}) => ({
|
|
196
|
+
...(overrides[name]?.provider ? { override: overrides[name].provider } : {}),
|
|
197
|
+
...(settings[name]?.provider ? { pick: settings[name].provider } : {}),
|
|
198
|
+
permission: permissionOf(name, settings, overrides),
|
|
199
|
+
});
|
|
200
|
+
/** The run's process's description of its tools' providers: JSON of its Plane. */
|
|
201
|
+
export const TOOL_PLANE_ENV = "AGENTRUN_SERVE_TOOL_PLANE";
|
|
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 } = {}) {
|
|
206
|
+
const harness = tooling.harness ?? DEFAULT_HARNESS;
|
|
207
|
+
// A workflow's model nodes may each run on another tier's model, and a native search asks one model's provider: a
|
|
208
|
+
// workflow's search resolves with no model (keyless Exa, or Parallel where picked), never on a model a node may not use.
|
|
209
|
+
// A run that names no model runs on the host's for its harness (hostModel: a model key's default when no AGENT_MODEL
|
|
210
|
+
// it runs is set), so its search resolves on that one.
|
|
211
|
+
const model = tooling.workflow ? undefined : (tooling.model ?? hostModel(env, "default", harness));
|
|
212
|
+
const plane = {};
|
|
213
|
+
const granted = tooling.tools.map(capabilityOf);
|
|
214
|
+
for (const name of PICKABLE) {
|
|
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" } : {}) });
|
|
219
|
+
}
|
|
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)
|
|
223
|
+
plane.model = model;
|
|
224
|
+
return plane;
|
|
225
|
+
}
|
|
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) {
|
|
232
|
+
const keyed = served(env).parallelKey;
|
|
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) : {};
|
|
266
|
+
}
|
|
267
|
+
/** The Plane the server handed this run's process; empty when it handed none. */
|
|
268
|
+
export function planeOf(env) {
|
|
269
|
+
try {
|
|
270
|
+
const plane = JSON.parse(env[TOOL_PLANE_ENV] ?? "{}");
|
|
271
|
+
return typeof plane === "object" && plane !== null && !Array.isArray(plane) ? plane : {};
|
|
272
|
+
}
|
|
273
|
+
catch {
|
|
274
|
+
return {};
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/** Whether a run is handed Parallel's key: one of its capabilities resolves to Parallel. */
|
|
278
|
+
export const handsParallel = (plane) => PICKABLE.some((name) => plane[name] === "parallel");
|
|
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. */
|
|
282
|
+
export function settingsIssues(value, at = "") {
|
|
283
|
+
const field = (...names) => [at, ...names].filter(Boolean).join(".");
|
|
284
|
+
const isPlain = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
285
|
+
if (!isPlain(value))
|
|
286
|
+
return [{ field: at || "body", reason: "wrong_type", message: `${at || "the body"} is an object of tools to their settings` }];
|
|
287
|
+
return Object.entries(value).flatMap(([name, setting]) => {
|
|
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.` }];
|
|
291
|
+
if (!isPlain(setting))
|
|
292
|
+
return [{ field: field(name), reason: "wrong_type", message: `${field(name)} is an object, {${pickable ? "provider, " : ""}permission}` }];
|
|
293
|
+
return Object.entries(setting).flatMap(([key, given]) => {
|
|
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)
|
|
300
|
+
return [{ field: field(name, key), reason: "not_allowed", message: `${field(name)} keeps no field ${key}.` }];
|
|
301
|
+
const offered = PROVIDERS[name];
|
|
302
|
+
return offered.includes(given) ? [] : [{ field: field(name, key), reason: "not_an_option", message: `${field(name, key)} is one of ${offered.join(", ")}` }];
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
}
|
|
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
|
+
});
|
|
311
|
+
/** The server's tool settings, beside the agent store in its data directory: not a secret, and not in store.sqlite,
|
|
312
|
+
* which runs hold open. Read once at the start, written whole and durably (0600) at each PUT; a missing file is every
|
|
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
|
+
}
|
|
356
|
+
export class ToolSettings {
|
|
357
|
+
dir;
|
|
358
|
+
static FILE = "tool-settings.json";
|
|
359
|
+
current;
|
|
360
|
+
constructor(dir, warn = (line) => void process.stderr.write(`${line}\n`)) {
|
|
361
|
+
this.dir = dir;
|
|
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;
|
|
366
|
+
}
|
|
367
|
+
get() {
|
|
368
|
+
return structuredClone(this.current);
|
|
369
|
+
}
|
|
370
|
+
/** Replaces the settings: a tool `map` leaves out takes its defaults. Durable before it returns. */
|
|
371
|
+
put(map) {
|
|
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
|
+
}));
|
|
376
|
+
writeDurableSync(join(this.dir, ToolSettings.FILE), `${JSON.stringify(kept)}\n`);
|
|
377
|
+
this.current = kept;
|
|
378
|
+
return this.get();
|
|
379
|
+
}
|
|
380
|
+
}
|
|
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. */
|
|
386
|
+
export function agentTools(env, settings, agent, order) {
|
|
387
|
+
const plane = planeFor(env, agent, settings);
|
|
388
|
+
const rank = (name) => order.indexOf(capabilityOf(name)) + (name in LEGACY_NAMES ? 0.5 : 0);
|
|
389
|
+
return [...new Set(agent.tools)].sort((a, b) => rank(a) - rank(b)).map((name) => {
|
|
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)] };
|
|
393
|
+
if (!Object.hasOwn(PROVIDERS, capability))
|
|
394
|
+
return { name, ...gate };
|
|
395
|
+
const pick = capability;
|
|
396
|
+
const own = agent.overrides?.[pick]?.provider;
|
|
397
|
+
const server = settings[pick]?.provider;
|
|
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] };
|
|
399
|
+
});
|
|
400
|
+
}
|