@parcha/agentrun-serve 0.1.0-beta.57 → 0.1.0-beta.59
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 +376 -0
- package/README.md +393 -118
- package/dist/acp-package.d.ts +5 -1
- package/dist/acp-package.js +19 -2
- package/dist/adapters.d.ts +23 -2
- package/dist/adapters.js +106 -33
- package/dist/agents-store.js +1 -1
- package/dist/answer-text.d.ts +3 -0
- package/dist/answer-text.js +22 -0
- package/dist/api-only.d.ts +2 -4
- package/dist/api-only.js +2 -4
- package/dist/attach-conformance.js +5 -4
- package/dist/box-paths.d.ts +7 -5
- package/dist/box-paths.js +12 -8
- package/dist/browser-computer.d.ts +3 -8
- package/dist/browser-computer.js +12 -35
- package/dist/browser-cost.js +94 -20
- package/dist/capacity.d.ts +1 -1
- package/dist/capacity.js +3 -3
- package/dist/chatgpt-plan.d.ts +5 -0
- package/dist/chatgpt-plan.js +25 -11
- package/dist/claude-login-token.d.ts +121 -0
- package/dist/claude-login-token.js +797 -0
- package/dist/claude-login.d.ts +119 -34
- package/dist/claude-login.js +551 -79
- package/dist/claude-sign-in.d.ts +3 -0
- package/dist/claude-sign-in.js +10 -1
- package/dist/cli.js +325 -328
- package/dist/composio-made.d.ts +1 -6
- package/dist/composio-made.js +1 -6
- package/dist/composio-owners.d.ts +26 -0
- package/dist/composio-owners.js +36 -0
- package/dist/composio-preset.d.ts +56 -23
- package/dist/composio-preset.js +173 -77
- package/dist/composio-triggers.d.ts +4 -4
- package/dist/composio-triggers.js +6 -7
- package/dist/compute-cost.js +11 -2
- package/dist/computer-attach.d.ts +40 -19
- package/dist/computer-attach.js +326 -62
- package/dist/computer-held-routes.d.ts +1 -1
- package/dist/computer-held-routes.js +9 -4
- package/dist/computer-keys.d.ts +11 -1
- package/dist/computer-keys.js +26 -1
- package/dist/computer-record.js +3 -1
- package/dist/computer-view.d.ts +5 -3
- package/dist/computer-view.js +10 -6
- package/dist/computer-viewer.js +36 -7
- package/dist/computers.d.ts +12 -11
- package/dist/computers.js +11 -8
- package/dist/console/THIRD-PARTY-NOTICES.txt +50 -0
- package/dist/console/assets/backend-BztxEAvb.js +166 -0
- package/dist/console/assets/index-LwNL4L9q.js +619 -0
- package/dist/console/assets/share-L84tlUDW.js +6 -0
- package/dist/console/assets/styles-CaRKlHke.js +291 -0
- package/dist/console/assets/styles-DQo8rzY-.css +1 -0
- package/dist/console/index.html +4 -3
- package/dist/console/share.html +17 -0
- package/dist/decisions.d.ts +17 -7
- package/dist/decisions.js +41 -15
- package/dist/dial-relay.d.ts +25 -4
- package/dist/dial-relay.js +139 -5
- package/dist/docker-daemon.js +4 -5
- package/dist/docker-host-addresses.js +29 -11
- package/dist/email/account.d.ts +6 -0
- package/dist/email/account.js +6 -0
- package/dist/email/authentication.d.ts +21 -0
- package/dist/email/authentication.js +106 -0
- package/dist/email/email-faux.d.ts +11 -2
- package/dist/email/email-faux.js +21 -5
- package/dist/email/mail.d.ts +25 -0
- package/dist/email/mail.js +58 -2
- package/dist/email/names.js +2 -2
- package/dist/email/tools.d.ts +9 -4
- package/dist/email/tools.js +95 -13
- package/dist/env-switch.d.ts +13 -5
- package/dist/env-switch.js +24 -6
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +2 -0
- package/dist/fal-price.d.ts +12 -4
- package/dist/fal-price.js +110 -26
- package/dist/faux-computers.js +1 -1
- package/dist/filed-answer.d.ts +2 -2
- package/dist/filed-answer.js +2 -2
- package/dist/graph-served.d.ts +10 -5
- package/dist/graph-served.js +40 -10
- package/dist/handed-values.js +1 -2
- package/dist/harness-check.d.ts +2 -1
- package/dist/harness-check.js +45 -12
- package/dist/harness-keys.js +9 -6
- package/dist/harness-opencode/facts.js +2 -0
- package/dist/harness-recipe-entry.d.ts +9 -3
- package/dist/harness-recipe-entry.js +18 -9
- package/dist/harness-recipe.d.ts +21 -0
- package/dist/harness-recipe.js +25 -3
- package/dist/harness-table.d.ts +8 -0
- package/dist/harness-table.js +17 -6
- package/dist/helper-env.d.ts +4 -1
- package/dist/helper-env.js +4 -1
- package/dist/host-check.d.ts +2 -3
- package/dist/host-check.js +13 -7
- package/dist/hosted-search.js +1 -1
- package/dist/import.d.ts +11 -8
- package/dist/import.js +437 -186
- package/dist/key-refusal.d.ts +9 -2
- package/dist/key-refusal.js +86 -32
- package/dist/learn/audit.d.ts +8 -5
- package/dist/learn/audit.js +15 -7
- package/dist/learn/compile.d.ts +5 -2
- package/dist/learn/compile.js +45 -21
- package/dist/learn/field-check.d.ts +111 -0
- package/dist/learn/field-check.js +174 -0
- package/dist/learn/ledger.d.ts +173 -0
- package/dist/learn/ledger.js +225 -0
- package/dist/learn/promote.d.ts +82 -39
- package/dist/learn/promote.js +61 -66
- package/dist/learn/secrets.d.ts +4 -0
- package/dist/learn/secrets.js +12 -0
- package/dist/learned-nodes.d.ts +8 -5
- package/dist/learned-nodes.js +8 -5
- package/dist/learned-workflow.d.ts +2 -1
- package/dist/learned-workflow.js +13 -10
- package/dist/learning-cost.d.ts +40 -21
- package/dist/learning-cost.js +30 -21
- package/dist/learning-setting.d.ts +6 -0
- package/dist/learning-setting.js +11 -1
- package/dist/listen-first.d.ts +5 -4
- package/dist/listen-first.js +4 -5
- package/dist/live-reach.d.ts +9 -0
- package/dist/live-reach.js +9 -0
- package/dist/mcp-api-only-origins.d.ts +23 -3
- package/dist/mcp-api-only-origins.js +57 -17
- package/dist/mcp-gateway.d.ts +16 -2
- package/dist/mcp-gateway.js +41 -3
- package/dist/mcp-oauth.d.ts +1 -1
- package/dist/mcp-oauth.js +3 -2
- package/dist/mcp-probe.d.ts +3 -0
- package/dist/mcp-probe.js +3 -0
- package/dist/mcp-secret-writes.d.ts +24 -2
- package/dist/mcp-secret-writes.js +30 -2
- package/dist/mcp-servers-store.d.ts +52 -14
- package/dist/mcp-servers-store.js +165 -61
- package/dist/mcp-sources.d.ts +1 -2
- package/dist/mcp-sources.js +1 -2
- package/dist/mcp-store.d.ts +5 -5
- package/dist/mcp-store.js +3 -3
- package/dist/mcp.js +1 -1
- package/dist/micro.d.ts +2 -0
- package/dist/micro.js +2 -0
- package/dist/model-gateway.d.ts +1 -1
- package/dist/model-gateway.js +20 -36
- package/dist/model.d.ts +5 -4
- package/dist/model.js +7 -6
- package/dist/monid.d.ts +14 -1
- package/dist/monid.js +103 -26
- package/dist/ollama-provider.d.ts +23 -9
- package/dist/ollama-provider.js +49 -20
- package/dist/openapi.js +234 -61
- package/dist/otel/genai.d.ts +83 -7
- package/dist/otel/genai.js +69 -9
- package/dist/otel/tracer.d.ts +42 -13
- package/dist/otel/tracer.js +241 -56
- package/dist/page.d.ts +7 -1
- package/dist/page.js +76 -22
- package/dist/paid-calls.d.ts +6 -4
- package/dist/paid-calls.js +15 -7
- package/dist/place-offers.d.ts +59 -34
- package/dist/place-offers.js +100 -58
- package/dist/place.d.ts +13 -14
- package/dist/place.js +56 -41
- package/dist/print.js +1 -1
- package/dist/provider.d.ts +5 -4
- package/dist/provider.js +26 -13
- package/dist/redact/match.d.ts +27 -9
- package/dist/redact/match.js +266 -57
- package/dist/run-census.d.ts +1 -1
- package/dist/run-census.js +4 -5
- package/dist/run-cut.js +4 -5
- package/dist/run-export-store.d.ts +15 -0
- package/dist/run-export-store.js +30 -0
- package/dist/run-export.d.ts +139 -0
- package/dist/run-export.js +379 -0
- package/dist/run-file-cut.d.ts +5 -0
- package/dist/run-file-cut.js +13 -0
- package/dist/run-launch.js +16 -3
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-model-key.d.ts +15 -6
- package/dist/run-model-key.js +30 -31
- package/dist/run-reads-over-store.js +4 -4
- package/dist/run-secrets.js +3 -5
- package/dist/run-timeline-served.js +3 -1
- package/dist/run-view.d.ts +1 -2
- package/dist/run-view.js +2 -1
- package/dist/runnable.js +2 -2
- package/dist/runner/adapter-loop.d.ts +35 -18
- package/dist/runner/adapter-loop.js +97 -63
- package/dist/runner/adapter-run-spec.d.ts +34 -14
- package/dist/runner/adapter-run-spec.js +120 -75
- package/dist/runner/adapters/pi.js +4 -2
- package/dist/runner/audit.d.ts +8 -5
- package/dist/runner/audit.js +37 -17
- package/dist/runner/beside.d.ts +9 -2
- package/dist/runner/beside.js +29 -13
- package/dist/runner/claim-secrets.d.ts +27 -18
- package/dist/runner/claim-secrets.js +61 -47
- package/dist/runner/cli-run-spec.d.ts +18 -0
- package/dist/runner/cli-run-spec.js +93 -46
- package/dist/runner/compare-end.d.ts +2 -1
- package/dist/runner/compare-end.js +25 -10
- package/dist/runner/conformance/harness.js +2 -3
- package/dist/runner/conformance/subject.d.ts +4 -1
- package/dist/runner/harness-loops.js +3 -3
- package/dist/runner/held.d.ts +19 -4
- package/dist/runner/journal-kinds.d.ts +4 -1
- package/dist/runner/journal-kinds.js +22 -4
- package/dist/runner/learned-first.js +20 -4
- package/dist/runner/learning-end.d.ts +2 -8
- package/dist/runner/learning-end.js +11 -19
- package/dist/runner/live-ticker.js +7 -5
- package/dist/runner/loop-contract.d.ts +0 -2
- package/dist/runner/loop.d.ts +7 -0
- package/dist/runner/loop.js +1 -0
- package/dist/runner/main.d.ts +11 -6
- package/dist/runner/main.js +24 -18
- package/dist/runner/mcp-claim.js +24 -7
- package/dist/runner/mcp-run.d.ts +3 -6
- package/dist/runner/mcp-run.js +3 -4
- package/dist/runner/meta-tools.js +3 -2
- package/dist/runner/metrics.d.ts +7 -0
- package/dist/runner/metrics.js +19 -0
- package/dist/runner/model-route.d.ts +10 -7
- package/dist/runner/model-route.js +79 -15
- package/dist/runner/native-loop.js +10 -8
- package/dist/runner/presence.d.ts +11 -4
- package/dist/runner/presence.js +11 -6
- package/dist/runner/promotion.d.ts +25 -13
- package/dist/runner/promotion.js +125 -50
- package/dist/runner/redact.d.ts +3 -1
- package/dist/runner/redact.js +5 -3
- package/dist/runner/reflect-hook.js +1 -1
- package/dist/runner/responses-fetch.d.ts +36 -0
- package/dist/runner/responses-fetch.js +511 -0
- package/dist/runner/run-child-host.d.ts +38 -12
- package/dist/runner/run-child-host.js +231 -83
- package/dist/runner/run-child.js +11 -4
- package/dist/runner/runner-check.js +5 -1
- package/dist/runner/runner.d.ts +5 -3
- package/dist/runner/runner.js +14 -10
- package/dist/runner/save-slots.js +2 -1
- package/dist/runner/sdk-loop.js +8 -8
- package/dist/runner/spec-holds.d.ts +8 -1
- package/dist/runner/spec-holds.js +9 -4
- package/dist/runner/subagent.d.ts +11 -0
- package/dist/runner/subagent.js +17 -3
- package/dist/runner/workflow-calls.d.ts +9 -0
- package/dist/runner/workflow-calls.js +150 -0
- package/dist/runner/workflow-first.d.ts +138 -37
- package/dist/runner/workflow-first.js +230 -99
- package/dist/runner/workflow-spec.js +2 -2
- package/dist/runs-over-store.js +8 -7
- package/dist/save-once.d.ts +14 -0
- package/dist/save-once.js +31 -0
- package/dist/scrub-command.d.ts +34 -31
- package/dist/scrub-command.js +116 -147
- package/dist/sdk/runs.d.ts +6 -0
- package/dist/sdk/runs.js +89 -10
- package/dist/seal-key.js +4 -4
- package/dist/secret-cut.d.ts +3 -0
- package/dist/secret-cut.js +7 -1
- package/dist/secret-rules.d.ts +8 -1
- package/dist/secret-rules.js +482 -53
- package/dist/secrets.d.ts +51 -9
- package/dist/secrets.js +311 -21
- package/dist/server-keys.d.ts +4 -3
- package/dist/server-keys.js +4 -3
- package/dist/server-secrets-store.js +2 -4
- package/dist/server.d.ts +33 -10
- package/dist/server.js +454 -136
- package/dist/share-context.d.ts +22 -0
- package/dist/share-context.js +76 -0
- package/dist/shell-lex.d.ts +105 -0
- package/dist/shell-lex.js +646 -0
- package/dist/sign-ins-store.d.ts +5 -7
- package/dist/sign-ins-store.js +12 -16
- package/dist/sign-ins.d.ts +7 -11
- package/dist/sign-ins.js +40 -41
- package/dist/skills/agentrun-serve/SKILL.md +5 -2
- package/dist/slots.d.ts +9 -0
- package/dist/slots.js +45 -0
- package/dist/start-switches.d.ts +6 -5
- package/dist/start-switches.js +8 -4
- package/dist/stats.d.ts +5 -1
- package/dist/stats.js +1 -1
- package/dist/store/agent-body.js +2 -2
- package/dist/store/dialect.d.ts +4 -0
- package/dist/store/dialect.js +1 -0
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/mcp-record-keys.d.ts +10 -0
- package/dist/store/mcp-record-keys.js +13 -0
- package/dist/store/postgres/dialect.js +2 -0
- package/dist/store/postgres/migrations/0028_learning_ledger.sql +44 -0
- package/dist/store/postgres/migrations/0029_run_launch_census_settle.sql +28 -0
- package/dist/store/postgres/migrations/0030_learning_ledger_epoch.sql +40 -0
- package/dist/store/postgres/migrations/0031_learning_ledger_calls.sql +12 -0
- package/dist/store/postgres/store.js +4 -0
- package/dist/store/schema.d.ts +44 -4
- package/dist/store/schema.js +111 -11
- package/dist/store/seal.d.ts +4 -1
- package/dist/store/sqlite/run-launch.d.ts +3 -10
- package/dist/store/sqlite/run-launch.js +12 -23
- package/dist/store/sqlite/run-patch.d.ts +19 -2
- package/dist/store/sqlite/run-patch.js +67 -2
- package/dist/store/sqlite/store.d.ts +3 -0
- package/dist/store/sqlite/store.js +177 -32
- package/dist/store/store-schema.js +3 -4
- package/dist/store/store.d.ts +74 -25
- package/dist/store/store.js +14 -11
- package/dist/store-reads/analytics.d.ts +2 -1
- package/dist/store-reads/analytics.js +7 -5
- package/dist/store-reads/learning.d.ts +102 -136
- package/dist/store-reads/learning.js +251 -302
- package/dist/store-reads/stats.d.ts +2 -2
- package/dist/store-reads/stats.js +13 -7
- package/dist/store-view.js +10 -7
- package/dist/suggestions.d.ts +1 -1
- package/dist/suggestions.js +29 -13
- package/dist/template-eval.d.ts +91 -9
- package/dist/template-eval.js +448 -105
- package/dist/template-import.d.ts +0 -10
- package/dist/template-import.js +5 -10
- package/dist/timeline/labels.d.ts +1 -1
- package/dist/timeline/labels.js +4 -3
- package/dist/timeline/timeline.d.ts +23 -11
- package/dist/timeline/timeline.js +115 -31
- package/dist/timeline/web-calls.d.ts +14 -14
- package/dist/timeline/web-calls.js +18 -30
- package/dist/tool-gate.d.ts +13 -1
- package/dist/tool-gate.js +43 -3
- package/dist/tool-keys-store.js +2 -4
- package/dist/tool-keys.d.ts +11 -0
- package/dist/tool-keys.js +16 -0
- package/dist/tool-plane.d.ts +50 -11
- package/dist/tool-plane.js +94 -30
- package/dist/tools.d.ts +5 -1
- package/dist/tools.js +7 -7
- package/dist/trigger-email.js +12 -6
- package/dist/triggers.d.ts +15 -34
- package/dist/triggers.js +119 -126
- package/dist/validate.d.ts +8 -1
- package/dist/validate.js +163 -23
- package/dist/web-fake.d.ts +2 -1
- package/dist/web-fake.js +8 -6
- package/dist/web-fetch.d.ts +8 -6
- package/dist/web-fetch.js +13 -11
- package/dist/web-holds.d.ts +32 -0
- package/dist/web-holds.js +86 -0
- package/dist/web-run.d.ts +32 -5
- package/dist/web-run.js +75 -28
- package/dist/web-save.d.ts +4 -9
- package/dist/web-save.js +27 -55
- package/dist/web-search.js +14 -25
- package/dist/wires.d.ts +4 -3
- package/dist/wires.js +5 -4
- package/dist/workspace/archil-claim.d.ts +12 -5
- package/dist/workspace/archil-claim.js +45 -5
- package/dist/workspace/attach.js +52 -19
- package/dist/workspace/attached-computers.d.ts +38 -11
- package/dist/workspace/attached-computers.js +81 -16
- package/dist/workspace/computer-deps.d.ts +29 -7
- package/dist/workspace/computer-deps.js +36 -18
- package/dist/workspace/computer-for-claim.d.ts +21 -4
- package/dist/workspace/computer-for-claim.js +166 -57
- package/dist/workspace/computer-intervals.d.ts +2 -0
- package/dist/workspace/computer-intervals.js +1 -1
- package/dist/workspace/computer-janitor.d.ts +48 -14
- package/dist/workspace/computer-janitor.js +153 -44
- package/dist/workspace/computer-kept.d.ts +158 -32
- package/dist/workspace/computer-kept.js +288 -63
- package/dist/workspace/computer-providers.d.ts +8 -3
- package/dist/workspace/computer-providers.js +12 -5
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/local.js +41 -1
- package/dist/workspace/mount-revoke-left.d.ts +31 -0
- package/dist/workspace/mount-revoke-left.js +72 -0
- package/dist/workspace/paired-route.d.ts +91 -0
- package/dist/workspace/paired-route.js +152 -0
- package/dist/workspace/resolve-computer.d.ts +5 -2
- package/dist/workspace/resolve-computer.js +9 -3
- package/dist/workspace/run-end-computers.d.ts +11 -5
- package/dist/workspace/run-end-computers.js +153 -28
- package/dist/workspace/run-tools.d.ts +22 -3
- package/dist/workspace/run-tools.js +17 -5
- package/dist/workspace/run-workspace.d.ts +14 -1
- package/dist/workspace/run-workspace.js +34 -1
- package/dist/workspace/workspace.d.ts +6 -0
- package/dist/wrapped.d.ts +8 -2
- package/dist/wrapped.js +21 -6
- package/package.json +12 -13
- package/skills/agentrun-serve/SKILL.md +5 -2
- package/templates/README.md +25 -9
- package/dist/console/assets/backend-DVhHzJX2.js +0 -166
- package/dist/console/assets/index-Bwn1oTem.css +0 -1
- package/dist/console/assets/index-okP-y8PK.js +0 -747
package/dist/tool-gate.js
CHANGED
|
@@ -77,7 +77,8 @@ const KIND_TOOLS = (() => {
|
|
|
77
77
|
})();
|
|
78
78
|
/** A script's computer op (computer_op's `op`) that runs on the computer what one of the run's own tools runs, held to
|
|
79
79
|
* that tool's setting: the shell is bash's, a program started to run on (processes.start) bash_background's (bash's
|
|
80
|
-
* setting, and a read-only bash policy refuses it), a file's write is write's
|
|
80
|
+
* setting, and a read-only bash policy refuses it), a file's write is write's (and needs write among the agent's tools,
|
|
81
|
+
* writeBar), a file's read, listing or stat is
|
|
81
82
|
* read's. The other ops (apps, raw input) are the computer kind's, computer_op's own key (KIND_TOOLS). */
|
|
82
83
|
const OP_HELD_AS = Object.freeze({ "shell.run": "bash", "processes.start": "bash_background", "files.write": "write", "files.read": "read", "files.list": "read", "files.stat": "read" });
|
|
83
84
|
/** The ops whose command runs in the computer's shell. */
|
|
@@ -95,6 +96,22 @@ export function heldAs(name, args) {
|
|
|
95
96
|
const fields = (given !== null && typeof given === "object" ? given : {});
|
|
96
97
|
return { tool, args: SHELL_OPS.has(op) ? { command: fields.command, ...(fields.cwd !== undefined ? { cwd: fields.cwd } : {}) } : { path: fields.path } };
|
|
97
98
|
}
|
|
99
|
+
/** The path a computer_screenshot call saves the screen to in the run's folder (its `save_as`), held to write's setting
|
|
100
|
+
* as a file the write tool writes is; undefined for any other call, a screenshot with no save_as included. */
|
|
101
|
+
function savedAs(name, args) {
|
|
102
|
+
if (name !== "computer_screenshot" || args === null || typeof args !== "object")
|
|
103
|
+
return undefined;
|
|
104
|
+
const path = args.save_as;
|
|
105
|
+
return path === undefined ? undefined : { path };
|
|
106
|
+
}
|
|
107
|
+
/** What a screenshot's refusal for write's setting adds to write's own words: why write's setting holds it. */
|
|
108
|
+
const SAVED_AS_WORDS = "computer_screenshot with save_as writes a file into the run's files, so write's setting holds it; a screenshot without save_as is not held to it.";
|
|
109
|
+
export const writeBar = (tools, permission, approvers) => !tools?.includes("write") ? "not given" : permission === "deny" ? "denied" : permission === "ask" && !approvers ? "no approver" : undefined;
|
|
110
|
+
/** The refusal of a call that writes a file (`writes`: what it does, in words; `instead`: what to do, or "") for an agent
|
|
111
|
+
* whose tools leave write out (writeBar's "not given"). */
|
|
112
|
+
const notGivenWriteText = (writes, instead, ran) => `${DENIED_OPENING}${writes}, and this agent is not given write, so it can't write one.${instead ? ` ${instead}` : ""} ${ran === "no" ? NOT_RUN : RAN_UNKNOWN}`;
|
|
113
|
+
/** What a screenshot's save_as does, and what to do instead, in a not-given refusal. */
|
|
114
|
+
const SAVED_AS_WRITES = ["computer_screenshot with save_as writes a file into the run's files", "Take the screenshot without save_as."];
|
|
98
115
|
const STRICTNESS = { allow: 0, ask: 1, deny: 2 };
|
|
99
116
|
/** Every name a session on `harness` gives its tools, to the settings key each is held to: the shell family (bash's),
|
|
100
117
|
* table, own and decision tools, read_skill_file (`read`), the kinds' tools (a shared one by its first kind), nativeTools,
|
|
@@ -351,7 +368,7 @@ export function previewOf(text) {
|
|
|
351
368
|
export function runGate(where, runId, revision, serverSettings, approvers) {
|
|
352
369
|
// The run's computer kind, from its revision's setting (as the claim starts it): a computer tool's words name it.
|
|
353
370
|
const kind = settingOfDefinition(revision.body)?.computer.kind;
|
|
354
|
-
return new RunGate({ root: where.root, work: where.work, runId, harness: revision.body.harness ?? DEFAULT_HARNESS, ...(where.computer === undefined ? {} : { computer: where.computer }), ...(kind !== undefined ? { kind } : {}), ...(where.effectOf ? { effectOf: where.effectOf } : {}), ...(where.argumentsOf ? { argumentsOf: where.argumentsOf } : {}), facts: where.facts }, serverSettings, (revision.body.toolSettings ?? {}), approvers, approvalsOf(revision.body.approvals));
|
|
371
|
+
return new RunGate({ root: where.root, work: where.work, runId, harness: revision.body.harness ?? DEFAULT_HARNESS, tools: revision.body.tools ?? [], ...(where.computer === undefined ? {} : { computer: where.computer }), ...(kind !== undefined ? { kind } : {}), ...(where.effectOf ? { effectOf: where.effectOf } : {}), ...(where.argumentsOf ? { argumentsOf: where.argumentsOf } : {}), facts: where.facts }, serverSettings, (revision.body.toolSettings ?? {}), approvers, approvalsOf(revision.body.approvals));
|
|
355
372
|
}
|
|
356
373
|
/** The host tools that run on a computer that holds the run's shell (the kernel registry's, for shell "computer"). */
|
|
357
374
|
const ON_COMPUTER = new Set(hostToolDefs({ maxExecS: 600, shell: "computer" }).map((def) => def.name));
|
|
@@ -397,6 +414,10 @@ export class RunGate {
|
|
|
397
414
|
/** A tool's permission now (permissionOf): the revision's own over the server's setting, read at each call, so a change
|
|
398
415
|
* reaches a live run at its next call; under approvals "never", an ask is an allow. */
|
|
399
416
|
policy = (tool) => this.setting(tool).permission;
|
|
417
|
+
/** Why this run can't write a file now (writeBar over its agent's tools, write's permission and whether anyone can
|
|
418
|
+
* approve), or undefined where it can: what decide refuses a save_as or a script's write by, and what the run's files
|
|
419
|
+
* note and computer_screenshot's save_as are offered by. */
|
|
420
|
+
writeBar = () => writeBar(this.where.tools, this.policy("write"), this.approvers);
|
|
400
421
|
/** The gate's answer for one call before its intent, for a loop that parks and answers asks itself (the runner's adapter
|
|
401
422
|
* loops, pi's and the CLI harnesses'): run it, ask a person, or refuse it with the words the model reads. The order:
|
|
402
423
|
* the deny (with where it was set, and that nothing was sent or charged), a pin, bash's policy (policyRefusal), then
|
|
@@ -426,8 +447,13 @@ export class RunGate {
|
|
|
426
447
|
return off;
|
|
427
448
|
const own = this.computerOwns(name);
|
|
428
449
|
const held = heldAs(name, args);
|
|
429
|
-
if (held && this.policy(name) !== "deny")
|
|
450
|
+
if (held && this.policy(name) !== "deny") {
|
|
451
|
+
// An op held as write (files.write) writes a file, into the run's files on a desktop that mounts them, as save_as
|
|
452
|
+
// does: an agent not given write is refused it first, whatever write's setting says (writeBar).
|
|
453
|
+
if (held.tool === "write" && this.writeBar() === "not given")
|
|
454
|
+
return { deny: notGivenWriteText(`computer_op ${args.op} writes a file`, "", ran) };
|
|
430
455
|
return this.onComputer().decide(held.tool, held.args, options);
|
|
456
|
+
}
|
|
431
457
|
const key = this.keyOf(name) ?? name;
|
|
432
458
|
const tool = this.askedAs(name);
|
|
433
459
|
const verdict = this.policy(name);
|
|
@@ -445,6 +471,20 @@ export class RunGate {
|
|
|
445
471
|
const policed = this.policyRefusal(key, name, args);
|
|
446
472
|
if (policed)
|
|
447
473
|
return { deny: policed };
|
|
474
|
+
// A screenshot saved into the run's files (save_as) is a file written as write writes one: write's setting holds it
|
|
475
|
+
// too, after the kind's deny, and the stricter decides (write's deny refuses it before the computer is asked, write's
|
|
476
|
+
// ask puts it to a person, as the kind's does). An agent whose tools leave write out is refused it first: no setting
|
|
477
|
+
// offers a tool the agent was not given (write's default is allow).
|
|
478
|
+
const saved = savedAs(name, args);
|
|
479
|
+
if (saved) {
|
|
480
|
+
if (this.writeBar() === "not given")
|
|
481
|
+
return { deny: notGivenWriteText(...SAVED_AS_WRITES, ran) };
|
|
482
|
+
const write = await this.decide("write", saved, options);
|
|
483
|
+
if (typeof write === "object")
|
|
484
|
+
return { deny: `${write.deny} ${SAVED_AS_WORDS}` };
|
|
485
|
+
if (write === "ask")
|
|
486
|
+
return "ask";
|
|
487
|
+
}
|
|
448
488
|
if (verdict === "allow")
|
|
449
489
|
return "allow";
|
|
450
490
|
return this.approvers ? "ask" : { deny: noApproverText(tool, ran) };
|
package/dist/tool-keys-store.js
CHANGED
|
@@ -11,7 +11,7 @@ import { decisionsOf } from "./decisions.js";
|
|
|
11
11
|
import { ApiError, invalid } from "./errors.js";
|
|
12
12
|
import { checkKey } from "./key-check.js";
|
|
13
13
|
import { openSealed, putSealedKey, removeSealedKey, sealFingerprint, UNREADABLE } from "./server-keys.js";
|
|
14
|
-
import { rowSecrets, rowUnlocks, SEAL_KEY_ENV,
|
|
14
|
+
import { rowSecrets, rowUnlocks, SEAL_KEY_ENV, sealKeyIn, TOOL_KEYS } from "./tool-keys.js";
|
|
15
15
|
import { toolsView } from "./tools.js";
|
|
16
16
|
import { sealColumn, sealedAt } from "./store/index.js";
|
|
17
17
|
import { isObject, unknownFields } from "./validate.js";
|
|
@@ -50,9 +50,7 @@ class ToolKeysOverStore {
|
|
|
50
50
|
this.env = env;
|
|
51
51
|
this.say = say;
|
|
52
52
|
// There is always a seal key (seal-key.ts bootSealKey): no tool key is ever kept, or read, without one.
|
|
53
|
-
const key =
|
|
54
|
-
if (!key)
|
|
55
|
-
throw new Error(`tool keys are kept under the server's seal key (${SEAL_KEY_ENV}), and none was handed over: the server does not start without one`);
|
|
53
|
+
const key = sealKeyIn(env[SEAL_KEY_ENV], "tool keys");
|
|
56
54
|
this.key = key;
|
|
57
55
|
this.sealCheck = sealFingerprint(key);
|
|
58
56
|
}
|
package/dist/tool-keys.d.ts
CHANGED
|
@@ -109,3 +109,14 @@ export declare function rowSecrets(row: {
|
|
|
109
109
|
}[], changedAt: (name: string) => string | null): SecretMeta[];
|
|
110
110
|
/** The seal key `text` gives: 32 bytes in base64 (or base64url), else none. */
|
|
111
111
|
export declare function sealKeyOf(text: string | undefined): Buffer | undefined;
|
|
112
|
+
/** Why `text`, handed as a seal key, is none (sealKeyOf), by its length alone: never its value, a secret. A host whose
|
|
113
|
+
* generator counts bytes where characters were meant hands 60 characters, and the refusal that stops a start says so. */
|
|
114
|
+
export declare function notASealKey(text: string): string;
|
|
115
|
+
/** The seal key `handed` (SEAL_KEY_ENV's value) gives, for a reader of `what` kept under it; else one refusal, every
|
|
116
|
+
* reader's: the one handed by its length (notASealKey), never its value, or that none was. In production the start boots
|
|
117
|
+
* the key first (seal-key.ts bootSealKey), which refuses a malformed one itself; this is each reader's own guard.
|
|
118
|
+
* `Refused`: the error a caller's own refusals are (a runner's RunnerRefused); `none`: what to do when none was handed. */
|
|
119
|
+
export declare function sealKeyIn(handed: string | undefined, what: string, { Refused, none }?: {
|
|
120
|
+
Refused?: new (message: string) => Error;
|
|
121
|
+
none?: string;
|
|
122
|
+
}): Buffer;
|
package/dist/tool-keys.js
CHANGED
|
@@ -83,3 +83,19 @@ export function sealKeyOf(text) {
|
|
|
83
83
|
const trimmed = text?.trim() ?? "";
|
|
84
84
|
return /^[A-Za-z0-9+/_-]{43}=?$/.test(trimmed) ? Buffer.from(trimmed, "base64") : undefined;
|
|
85
85
|
}
|
|
86
|
+
/** Why `text`, handed as a seal key, is none (sealKeyOf), by its length alone: never its value, a secret. A host whose
|
|
87
|
+
* generator counts bytes where characters were meant hands 60 characters, and the refusal that stops a start says so. */
|
|
88
|
+
export function notASealKey(text) {
|
|
89
|
+
const length = text.trim().length;
|
|
90
|
+
return `is not 32 bytes in base64 (43 characters, or 44 ending in =; it has ${length}${length === 43 || length === 44 ? ", but not in that form" : ""})`;
|
|
91
|
+
}
|
|
92
|
+
/** The seal key `handed` (SEAL_KEY_ENV's value) gives, for a reader of `what` kept under it; else one refusal, every
|
|
93
|
+
* reader's: the one handed by its length (notASealKey), never its value, or that none was. In production the start boots
|
|
94
|
+
* the key first (seal-key.ts bootSealKey), which refuses a malformed one itself; this is each reader's own guard.
|
|
95
|
+
* `Refused`: the error a caller's own refusals are (a runner's RunnerRefused); `none`: what to do when none was handed. */
|
|
96
|
+
export function sealKeyIn(handed, what, { Refused = Error, none = "start the server, which makes or opens it" } = {}) {
|
|
97
|
+
const key = sealKeyOf(handed);
|
|
98
|
+
if (key)
|
|
99
|
+
return key;
|
|
100
|
+
throw new Refused(`${what} are kept under the server's seal key (${SEAL_KEY_ENV}), and ${handed?.trim() ? `the one handed ${notASealKey(handed)}` : `none was handed: ${none}`}`);
|
|
101
|
+
}
|
package/dist/tool-plane.d.ts
CHANGED
|
@@ -21,9 +21,9 @@ export declare const CAPABILITIES: readonly ["read", "write", "edit", "web_searc
|
|
|
21
21
|
declare const DIRECT_FETCH: "kernel";
|
|
22
22
|
/** The providers a user may pick for each capability that has a choice, its default first: `auto`, for web_search the
|
|
23
23
|
* Parallel where the server holds its key, else keyless Firecrawl, on every harness (a native search is never `auto`,
|
|
24
|
-
* only `native`); for web_fetch the guarded direct fetch
|
|
25
|
-
*
|
|
26
|
-
* one, and nothing else; `firecrawl-keyless`, Firecrawl's public MCP endpoint, no key, with keyless Exa behind it for
|
|
24
|
+
* only `native`); for web_fetch Parallel's extract where the server holds a Parallel key (the guarded direct fetch
|
|
25
|
+
* behind it), else keyless Firecrawl (both in DEFAULT_WEB_ORDER); `native`, the harness's own tool or its model
|
|
26
|
+
* provider's hosted one, and nothing else; `firecrawl-keyless`, Firecrawl's public MCP endpoint, no key, with keyless Exa behind it for
|
|
27
27
|
* web_search and the guarded direct fetch behind it for web_fetch; `exa-keyless`, Exa's public MCP endpoint alone, no
|
|
28
28
|
* key; `kernel`, the guarded direct fetch; `parallel`, Parallel's Search and Extract APIs on PARALLEL_API_KEY; `off`,
|
|
29
29
|
* web_search turned off: nothing is searched, and an
|
|
@@ -132,17 +132,42 @@ export type ResolveInput = {
|
|
|
132
132
|
/** The facts of the adapter the harness runs on (its own search, its wire), its owner's table entry's (harness-table.ts
|
|
133
133
|
* factsOf: a module's harness's too); undefined for one with none (pi). Always given: a caller names them. */
|
|
134
134
|
facts: AdapterFacts | undefined;
|
|
135
|
+
/** What the server's Jev means for web_search (decisions.ts jevWebWhy): said after the why of a search the run's own
|
|
136
|
+
* web_search runs. None: no Jev key, nothing to say. */
|
|
137
|
+
jevWhy?: string;
|
|
138
|
+
/** The same for web_fetch (jevWebWhy's "web_fetch"): what a fetch the run's own Web serves sends TypeSafe, said after
|
|
139
|
+
* its why. None: no Jev key, nothing to say. */
|
|
140
|
+
jevFetchWhy?: string;
|
|
135
141
|
};
|
|
136
142
|
/** Whether a run on `harness` sends through OpenRouter, where a harness's own search does not run: false for one with
|
|
137
143
|
* none (and for pi, whose hosted search is asked of the model's provider). */
|
|
138
144
|
export declare const ownSearchViaOpenRouter: (env: NodeJS.ProcessEnv, harness: string, model?: string) => boolean;
|
|
139
|
-
export declare const FIRECRAWL_FETCH = "Firecrawl's free keyless fetch, no key, the guarded direct fetch behind it. web_fetch sends each URL to Firecrawl's keyless service (never a private or local one);
|
|
145
|
+
export declare const FIRECRAWL_FETCH = "Firecrawl's free keyless fetch, no key, the guarded direct fetch behind it. web_fetch sends each URL to Firecrawl's keyless service (never a private or local one); choose kernel to fetch directly";
|
|
140
146
|
/** What `capability` resolves to on a run of `input`, and why in a plain sentence (capabilities' `why`): one rule, so
|
|
141
|
-
* the two never disagree.
|
|
147
|
+
* the two never disagree. A web_search the run's own tool runs, and a web_fetch its own Web serves (any resolution but
|
|
148
|
+
* a deny), say what Jev does with it and what it sends TypeSafe, where the server has a Jev key, or that Jev is off
|
|
149
|
+
* (`jevWhy`, `jevFetchWhy`). */
|
|
142
150
|
export declare function explainCapability(capability: Pickable, input: ResolveInput): {
|
|
143
151
|
resolves: Resolution;
|
|
144
152
|
why: string;
|
|
145
153
|
};
|
|
154
|
+
/** The order `auto` asks for each web tool: the first provider here the server can run is what auto resolves to
|
|
155
|
+
* (Parallel only where the server holds its key; keyless Firecrawl, keyless Exa and the guarded direct fetch always),
|
|
156
|
+
* keyless Firecrawl where none can. Capabilities' `why` and every run's plane read it (autoWeb). Parallel is first for
|
|
157
|
+
* both. To put Firecrawl first, swap the two ids in a list: that one line is the whole change. */
|
|
158
|
+
export declare const DEFAULT_WEB_ORDER: Readonly<{
|
|
159
|
+
web_search: readonly AutoSearch[];
|
|
160
|
+
web_fetch: readonly AutoFetch[];
|
|
161
|
+
}>;
|
|
162
|
+
type AutoSearch = "parallel" | "firecrawl-keyless" | "exa-keyless";
|
|
163
|
+
type AutoFetch = "parallel" | "firecrawl-keyless" | typeof DIRECT_FETCH;
|
|
164
|
+
/** What `auto` resolves `capability` to on a run of `input`, and why, by `order` (DEFAULT_WEB_ORDER). `auto` never
|
|
165
|
+
* resolves native, on any harness: where a native search would run, web_search's why names it as the pick it is;
|
|
166
|
+
* where none runs (noNative), it says why not. */
|
|
167
|
+
export declare function autoWeb(capability: "web_search" | "web_fetch", input: ResolveInput, order?: typeof DEFAULT_WEB_ORDER): {
|
|
168
|
+
resolves: Resolution;
|
|
169
|
+
why: string;
|
|
170
|
+
};
|
|
146
171
|
/** What `capability` resolves to on a run of `input`. */
|
|
147
172
|
export declare const resolveCapability: (capability: Pickable, input: ResolveInput) => Resolution;
|
|
148
173
|
export declare const isUnavailable: (resolution: Resolution | undefined) => resolution is `unavailable: ${string}`;
|
|
@@ -152,6 +177,9 @@ export declare const isUnavailable: (resolution: Resolution | undefined) => reso
|
|
|
152
177
|
export declare const whyUnavailable: (resolution: string) => string;
|
|
153
178
|
export declare const BROWSER_VENDOR_IDS: readonly string[];
|
|
154
179
|
export declare const BROWSER_KEYS: Readonly<Record<string, readonly string[]>>;
|
|
180
|
+
/** The browser vendor where nothing names one (a run kept before its plane was, a page's key row, the capabilities'
|
|
181
|
+
* browser): the registry's first hosted browser, the one `auto` tries first (Browserbase). */
|
|
182
|
+
export declare const DEFAULT_BROWSER_VENDOR: Resolution;
|
|
155
183
|
type BrowserVendor = string;
|
|
156
184
|
/** The keys a browser that resolves to `resolution` runs on: its vendor's (BROWSER_KEYS), none for no vendor. */
|
|
157
185
|
export declare const browserNeeds: (resolution: string | undefined) => readonly string[];
|
|
@@ -167,9 +195,12 @@ export declare function explainsView(env: NodeJS.ProcessEnv, settings: ToolSetti
|
|
|
167
195
|
why: Record<HarnessId, string>;
|
|
168
196
|
}>;
|
|
169
197
|
/** What a run is told: each pickable capability its revision names, resolved; with web_search native on pi, the model
|
|
170
|
-
* its search asks (the one the resolution read)
|
|
198
|
+
* its search asks (the one the resolution read); and `jev: "off"` where the server had Jev turned off for the web tools
|
|
199
|
+
* (AGENTRUN_WEB_JEV_OFF) when it created the run, on a plane with a web tool, so the switch reaches a runner on another
|
|
200
|
+
* host; a runner's re-check (recheckPlane) keeps it. */
|
|
171
201
|
export type Plane = Partial<Record<Pickable, Resolution>> & {
|
|
172
202
|
model?: string;
|
|
203
|
+
jev?: "off";
|
|
173
204
|
};
|
|
174
205
|
/** The facts of a pinned revision its run's tools resolve from. */
|
|
175
206
|
/** `approvals`: the revision's, kept only when "never" (the agent runs unattended: an ask is an allow, never over a deny). */
|
|
@@ -190,7 +221,7 @@ export declare function planeFor(env: NodeJS.ProcessEnv, tooling: Tooling, setti
|
|
|
190
221
|
capped?: boolean;
|
|
191
222
|
run?: boolean;
|
|
192
223
|
}): Plane;
|
|
193
|
-
/** A run's kept Plane at a later launch: as it was, but Parallel, or the browser's vendor, where the server no longer
|
|
224
|
+
/** A run's kept Plane at a later launch: as it was (its Jev off kept, and added where `env` has the switch), but Parallel, or the browser's vendor, where the server no longer
|
|
194
225
|
* holds its key, which is unavailable, never another provider; and, given `now` (the Plane it would get today and each
|
|
195
226
|
* capability's permission today), a capability set to ask or deny, or kept denied, as it resolves today: a harness's
|
|
196
227
|
* own search cannot wait for a person, and a deny that was lifted is lifted. The browser keeps its vendor, whose
|
|
@@ -200,9 +231,10 @@ export declare function recheckPlane(plane: Plane, env: NodeJS.ProcessEnv, now?:
|
|
|
200
231
|
permission: (name: Pickable) => Permission;
|
|
201
232
|
}): Plane;
|
|
202
233
|
/** The Plane kept for a run made before its plane was kept, resolved at a later launch (runs.ts): its browser stays
|
|
203
|
-
*
|
|
204
|
-
* keeps the vendor, never a refusal: the plane each launch hands over is checked again
|
|
205
|
-
* keys missing make it unavailable for that launch alone, and restored keys make the
|
|
234
|
+
* the default vendor (DEFAULT_BROWSER_VENDOR, the one vendor there was then), never today's pick, which could check its
|
|
235
|
+
* sessions at another vendor. It keeps the vendor, never a refusal: the plane each launch hands over is checked again
|
|
236
|
+
* (recheckPlane), so that vendor's keys missing make it unavailable for that launch alone, and restored keys make the
|
|
237
|
+
* next one run. */
|
|
206
238
|
export declare const keptFromBefore: (plane: Plane) => Plane;
|
|
207
239
|
/** A run's saved Plane as a launch reads it: a vendor's missing-key refusal an earlier server saved (noBrowserKey's exact
|
|
208
240
|
* words, Browserbase's or Kernel's) is that vendor again, which the launch checks again as usual (recheckPlane), so
|
|
@@ -210,7 +242,7 @@ export declare const keptFromBefore: (plane: Plane) => Plane;
|
|
|
210
242
|
* (NO_BROWSER_KEY) and `chrome` stay frozen. The same Plane where nothing changes. */
|
|
211
243
|
export declare function keptVendor(plane: Plane): Plane;
|
|
212
244
|
/** The key row (tool-keys.ts) of the browser's vendor on `resolution` with `picked` the provider in force: the vendor it
|
|
213
|
-
* resolved to, else the one picked, else the
|
|
245
|
+
* resolved to, else the one picked, else the default (DEFAULT_BROWSER_VENDOR), so a page links a missing key to the row
|
|
214
246
|
* it is saved on. */
|
|
215
247
|
export declare const browserKeyRow: (picked: string | undefined, resolution: string | undefined) => string;
|
|
216
248
|
/** The Plane a run's process is handed at a launch, under the server's `settings` now: its kept Plane (as keptVendor
|
|
@@ -226,6 +258,13 @@ export declare function relaunchPlane(kept: Plane | undefined, env: NodeJS.Proce
|
|
|
226
258
|
export declare function planeOf(env: NodeJS.ProcessEnv): Plane;
|
|
227
259
|
/** Whether a run is handed Parallel's key: one of its capabilities resolves to Parallel. */
|
|
228
260
|
export declare const handsParallel: (plane: Plane) => boolean;
|
|
261
|
+
/** Whether a run on `harness` is handed TypeSafe's key for its web tools (decisions.ts DecisionNeeds.jevWeb): one of
|
|
262
|
+
* them is served by its own Web (web-run.ts webOf), and Jev is turned off neither by the plane (the server's switch at
|
|
263
|
+
* launch, planeFor) nor in `env` (AGENTRUN_WEB_JEV_OFF: a runner's own switch adds "off", never removes it).
|
|
264
|
+
* web_fetch always is where it runs; web_search is where it resolves to Parallel or a keyless provider, or to native
|
|
265
|
+
* where that is the model provider's hosted search (pi's), never a harness's own search inside its CLI (codex's,
|
|
266
|
+
* claude-agent's: its facts' webSearch), where no Jev call can happen. */
|
|
267
|
+
export declare const handsJevWeb: (plane: Plane, env: NodeJS.ProcessEnv, harness: string | undefined) => boolean;
|
|
229
268
|
/** The issues of `value` as a settings map, its fields under `at` (none: a body's own): each settings key (a tool of the
|
|
230
269
|
* table, a catalog tool, an MCP server's wildcard) to `{provider?, permission?}`, a provider only for a capability that
|
|
231
270
|
* has a choice and one offered for it, a permission one offered for the tool. */
|
package/dist/tool-plane.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
// agent's own (`definition.tool_settings`) over the server's (`PUT /v2/settings/tools`), optional; (2) for web_search,
|
|
4
4
|
// Parallel where the server holds its key (env or saved, which then bills it); (3) the keyless fallback: Firecrawl's
|
|
5
5
|
// public keyless MCP endpoint (@parcha/agentrun-web providers/firecrawl-keyless.ts), with Exa's
|
|
6
|
-
// (providers/exa-keyless.ts) behind it. web_fetch's `auto` is
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// the public-host guard refuses never goes (web-fetch.ts). The native search, a harness's own
|
|
10
|
-
// Codex's live search) or on pi one request to the run's own model provider with its hosted search
|
|
11
|
-
// runs only where it is picked, `native`: `auto` never resolves to it, on any harness.
|
|
12
|
-
// web_search's default, `auto`, is that order; a pick of `native` is native only,
|
|
6
|
+
// (providers/exa-keyless.ts) behind it. web_fetch's `auto` is Parallel's extract where the server holds a Parallel key,
|
|
7
|
+
// with the guarded direct fetch behind it, else keyless Firecrawl with the guarded direct fetch behind it. Both tools'
|
|
8
|
+
// `auto` order is one table, DEFAULT_WEB_ORDER. Through Firecrawl web_fetch sends each URL to a third party, and its
|
|
9
|
+
// `why` says so; a URL the public-host guard refuses never goes (web-fetch.ts). The native search, a harness's own
|
|
10
|
+
// (Claude's WebSearch, Codex's live search) or on pi one request to the run's own model provider with its hosted search
|
|
11
|
+
// (hosted-search.ts), runs only where it is picked, `native`: `auto` never resolves to it, on any harness.
|
|
12
|
+
// `off` turns web_search off. web_search's default, `auto`, is that order; a pick of `native` is native only,
|
|
13
13
|
// unavailable where there is none, never a keyless search. A grant names a capability, never a provider. A pick of parallel without
|
|
14
14
|
// PARALLEL_API_KEY resolves unavailable, never to something else. The server resolves a run's tools at its first
|
|
15
15
|
// launch, from its pinned revision and the settings then, keeps them for the run's life (runs.ts), and hands the run's
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
import { META_TOOLS } from "./meta-tool-names.js";
|
|
26
26
|
import { blurbOf, isAskable, isTableTool, tableTools } from "./tool-list.js";
|
|
27
27
|
import { PROVIDERS as COMPUTER_PROVIDERS } from "@parcha/agentrun-computer";
|
|
28
|
-
import { decisionKeysOf, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
28
|
+
import { decisionKeysOf, jevWebWhy, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
29
|
+
import { webJevOff } from "./env-switch.js";
|
|
29
30
|
import { keyNeeded } from "./key-words.js";
|
|
30
31
|
import { DEFAULT_HARNESS, HARNESSES } from "./harness.js";
|
|
31
32
|
import { factsOf as tableFactsOf, harnessOf } from "./harness-table.js";
|
|
@@ -51,9 +52,9 @@ export const CAPABILITIES = ["read", "write", "edit", "web_search", "web_fetch",
|
|
|
51
52
|
const DIRECT_FETCH = "kernel";
|
|
52
53
|
/** The providers a user may pick for each capability that has a choice, its default first: `auto`, for web_search the
|
|
53
54
|
* Parallel where the server holds its key, else keyless Firecrawl, on every harness (a native search is never `auto`,
|
|
54
|
-
* only `native`); for web_fetch the guarded direct fetch
|
|
55
|
-
*
|
|
56
|
-
* one, and nothing else; `firecrawl-keyless`, Firecrawl's public MCP endpoint, no key, with keyless Exa behind it for
|
|
55
|
+
* only `native`); for web_fetch Parallel's extract where the server holds a Parallel key (the guarded direct fetch
|
|
56
|
+
* behind it), else keyless Firecrawl (both in DEFAULT_WEB_ORDER); `native`, the harness's own tool or its model
|
|
57
|
+
* provider's hosted one, and nothing else; `firecrawl-keyless`, Firecrawl's public MCP endpoint, no key, with keyless Exa behind it for
|
|
57
58
|
* web_search and the guarded direct fetch behind it for web_fetch; `exa-keyless`, Exa's public MCP endpoint alone, no
|
|
58
59
|
* key; `kernel`, the guarded direct fetch; `parallel`, Parallel's Search and Extract APIs on PARALLEL_API_KEY; `off`,
|
|
59
60
|
* web_search turned off: nothing is searched, and an
|
|
@@ -204,10 +205,24 @@ const nativeWhy = (input) => (input.facts?.webSearch ? ownSearch(input) : `${own
|
|
|
204
205
|
/** Keyless Firecrawl in a sentence, as web_search and web_fetch use it. web_fetch's says plainly that each URL leaves
|
|
205
206
|
* the server, and how to keep it here. */
|
|
206
207
|
const FIRECRAWL_SEARCH = "Firecrawl's free keyless search, no key, keyless Exa behind it";
|
|
207
|
-
export const FIRECRAWL_FETCH = "Firecrawl's free keyless fetch, no key, the guarded direct fetch behind it. web_fetch sends each URL to Firecrawl's keyless service (never a private or local one);
|
|
208
|
+
export const FIRECRAWL_FETCH = "Firecrawl's free keyless fetch, no key, the guarded direct fetch behind it. web_fetch sends each URL to Firecrawl's keyless service (never a private or local one); choose kernel to fetch directly";
|
|
209
|
+
/** The resolutions of web_search the run's own web_search runs (web-run.ts webOf), where Jev ranks the results: native
|
|
210
|
+
* only where it is the model provider's hosted search (pi's), never a harness's own search inside its CLI. */
|
|
211
|
+
const searchesOwn = (resolves, facts) => WEB_RUNS.web_search.includes(resolves) && (resolves !== "native" || !facts?.webSearch);
|
|
212
|
+
const ranksOwn = (resolves, input) => searchesOwn(resolves, input.facts);
|
|
208
213
|
/** What `capability` resolves to on a run of `input`, and why in a plain sentence (capabilities' `why`): one rule, so
|
|
209
|
-
* the two never disagree.
|
|
214
|
+
* the two never disagree. A web_search the run's own tool runs, and a web_fetch its own Web serves (any resolution but
|
|
215
|
+
* a deny), say what Jev does with it and what it sends TypeSafe, where the server has a Jev key, or that Jev is off
|
|
216
|
+
* (`jevWhy`, `jevFetchWhy`). */
|
|
210
217
|
export function explainCapability(capability, input) {
|
|
218
|
+
const said = explained(capability, input);
|
|
219
|
+
if (capability === "web_search" && input.jevWhy && ranksOwn(said.resolves, input))
|
|
220
|
+
return { ...said, why: `${said.why}; ${input.jevWhy}` };
|
|
221
|
+
if (capability === "web_fetch" && input.jevFetchWhy && WEB_RUNS.web_fetch.includes(said.resolves))
|
|
222
|
+
return { ...said, why: `${said.why}; ${input.jevFetchWhy}` };
|
|
223
|
+
return said;
|
|
224
|
+
}
|
|
225
|
+
function explained(capability, input) {
|
|
211
226
|
const chosen = input.override ?? input.pick ?? PROVIDERS[capability][0];
|
|
212
227
|
const picked = input.override !== undefined ? "picked for this agent" : "picked in settings";
|
|
213
228
|
const key = `your Parallel key (${input.parallelKeyFrom ?? "server"})`;
|
|
@@ -222,7 +237,7 @@ export function explainCapability(capability, input) {
|
|
|
222
237
|
return { resolves: DIRECT_FETCH, why: `the guarded direct fetch, ${picked}` };
|
|
223
238
|
if (chosen === "firecrawl-keyless")
|
|
224
239
|
return { resolves: "firecrawl-keyless", why: `keyless Firecrawl, ${picked}: ${FIRECRAWL_FETCH}` };
|
|
225
|
-
return
|
|
240
|
+
return autoWeb("web_fetch", input);
|
|
226
241
|
}
|
|
227
242
|
if (capability === "browser")
|
|
228
243
|
return browserBy(chosen, picked, input.browserKeys);
|
|
@@ -238,11 +253,30 @@ export function explainCapability(capability, input) {
|
|
|
238
253
|
return { resolves: `unavailable: no native search for ${without.id}`, why: `no native search for ${without.id}` };
|
|
239
254
|
return input.permission === "ask" && input.facts !== undefined ? { resolves: NATIVE_ASKS, why: "native search cannot wait for an approval: it runs inside the harness's CLI" } : { resolves: "native", why: nativeWhy(input) };
|
|
240
255
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
256
|
+
return autoWeb("web_search", input);
|
|
257
|
+
}
|
|
258
|
+
/** The order `auto` asks for each web tool: the first provider here the server can run is what auto resolves to
|
|
259
|
+
* (Parallel only where the server holds its key; keyless Firecrawl, keyless Exa and the guarded direct fetch always),
|
|
260
|
+
* keyless Firecrawl where none can. Capabilities' `why` and every run's plane read it (autoWeb). Parallel is first for
|
|
261
|
+
* both. To put Firecrawl first, swap the two ids in a list: that one line is the whole change. */
|
|
262
|
+
export const DEFAULT_WEB_ORDER = Object.freeze({ web_search: Object.freeze(["parallel", "firecrawl-keyless"]), web_fetch: Object.freeze(["parallel", "firecrawl-keyless"]) });
|
|
263
|
+
/** What `auto` resolves `capability` to on a run of `input`, and why, by `order` (DEFAULT_WEB_ORDER). `auto` never
|
|
264
|
+
* resolves native, on any harness: where a native search would run, web_search's why names it as the pick it is;
|
|
265
|
+
* where none runs (noNative), it says why not. */
|
|
266
|
+
export function autoWeb(capability, input, order = DEFAULT_WEB_ORDER) {
|
|
267
|
+
const runs = (id) => id !== "parallel" || input.parallelKey;
|
|
268
|
+
const id = order[capability].find(runs) ?? "firecrawl-keyless";
|
|
269
|
+
const key = `your Parallel key (${input.parallelKeyFrom ?? "server"})`;
|
|
270
|
+
if (capability === "web_fetch") {
|
|
271
|
+
if (id === "parallel")
|
|
272
|
+
return { resolves: "parallel", why: `Parallel's extract on ${key}, the guarded direct fetch behind it` };
|
|
273
|
+
return id === DIRECT_FETCH ? { resolves: DIRECT_FETCH, why: "the guarded direct fetch" } : { resolves: "firecrawl-keyless", why: FIRECRAWL_FETCH };
|
|
274
|
+
}
|
|
275
|
+
const said = id === "parallel" ? key : id === "exa-keyless" ? "Exa's free search, no key" : FIRECRAWL_SEARCH;
|
|
276
|
+
const without = noNative(input);
|
|
277
|
+
if (without !== undefined)
|
|
278
|
+
return { resolves: id, why: `${without.why}; ${said}` };
|
|
279
|
+
return { resolves: id, why: id === "parallel" ? said : `${said}; ${ownSearch(input)} is an explicit pick` };
|
|
246
280
|
}
|
|
247
281
|
/** What `capability` resolves to on a run of `input`. */
|
|
248
282
|
export const resolveCapability = (capability, input) => explainCapability(capability, input).resolves;
|
|
@@ -274,6 +308,14 @@ function browserProviderIds() {
|
|
|
274
308
|
}
|
|
275
309
|
export const BROWSER_VENDOR_IDS = Object.freeze(browserProviderIds());
|
|
276
310
|
export const BROWSER_KEYS = Object.freeze(Object.fromEntries(BROWSER_VENDORS.map((vendor) => [vendor.id, vendor.keys])));
|
|
311
|
+
/** The browser vendor where nothing names one (a run kept before its plane was, a page's key row, the capabilities'
|
|
312
|
+
* browser): the registry's first hosted browser, the one `auto` tries first (Browserbase). */
|
|
313
|
+
export const DEFAULT_BROWSER_VENDOR = (() => {
|
|
314
|
+
const first = BROWSER_VENDORS[0];
|
|
315
|
+
if (!first)
|
|
316
|
+
throw new Error("the computer registry declares no hosted browser provider");
|
|
317
|
+
return first.id;
|
|
318
|
+
})();
|
|
277
319
|
const LABELS = Object.freeze(Object.fromEntries(BROWSER_VENDORS.map((vendor) => [vendor.id, vendor.label])));
|
|
278
320
|
const isVendor = (name) => typeof name === "string" && Object.hasOwn(BROWSER_KEYS, name);
|
|
279
321
|
const browserKeysOf = (env) => Object.fromEntries(BROWSER_VENDORS.map((vendor) => [vendor.id, vendor.keys.every((name) => Boolean(env[name]))]));
|
|
@@ -304,7 +346,9 @@ function browserBy(chosen, picked, keys = {}) {
|
|
|
304
346
|
/** The server's environment's part of every resolution: its gateway and Parallel's key, and where the key is from. */
|
|
305
347
|
const served = (env) => {
|
|
306
348
|
const parallelKey = PARALLEL_KEY_ENV in decisionKeysOf(env);
|
|
307
|
-
|
|
349
|
+
const jevWhy = jevWebWhy(env, "web_search");
|
|
350
|
+
const jevFetchWhy = jevWebWhy(env, "web_fetch");
|
|
351
|
+
return { gateway: Boolean(env.AGENT_MODEL_BASE_URL), parallelKey, browserKeys: browserKeysOf(env), ...(parallelKey ? { parallelKeyFrom: savedIn(env).has(PARALLEL_KEY_ENV) ? "saved" : "server" } : {}), ...(jevWhy ? { jevWhy } : {}), ...(jevFetchWhy ? { jevFetchWhy } : {}) };
|
|
308
352
|
};
|
|
309
353
|
/** Each pickable capability on each harness under the server's `settings` and an agent's `overrides`, on `model`
|
|
310
354
|
* (default each harness's host model, the one a run that names none runs on: hostModel): what it resolves to and why, as
|
|
@@ -351,27 +395,37 @@ export function planeFor(env, tooling, settings, { capped = false, run = false }
|
|
|
351
395
|
// another harness, whose agent searches with its own tool, a learned workflow's call node (learned-workflow.ts).
|
|
352
396
|
if (plane.web_search === "native" && model)
|
|
353
397
|
plane.model = model;
|
|
354
|
-
return plane;
|
|
398
|
+
return withJevSwitch(plane, env);
|
|
355
399
|
}
|
|
356
|
-
/**
|
|
400
|
+
/** `plane` with Jev's switch: `jev: "off"` where `keptOff` (the plane was made with it off) or where `env` has the switch
|
|
401
|
+
* on (AGENTRUN_WEB_JEV_OFF) and the plane has a web tool; else no `jev` field. */
|
|
402
|
+
function withJevSwitch(plane, env, keptOff = false) {
|
|
403
|
+
const { jev: _was, ...rest } = plane;
|
|
404
|
+
return keptOff || (webJevOff(env) && (rest.web_search !== undefined || rest.web_fetch !== undefined)) ? { ...rest, jev: "off" } : rest;
|
|
405
|
+
}
|
|
406
|
+
/** A run's kept Plane at a later launch: as it was (its Jev off kept, and added where `env` has the switch), but Parallel, or the browser's vendor, where the server no longer
|
|
357
407
|
* holds its key, which is unavailable, never another provider; and, given `now` (the Plane it would get today and each
|
|
358
408
|
* capability's permission today), a capability set to ask or deny, or kept denied, as it resolves today: a harness's
|
|
359
409
|
* own search cannot wait for a person, and a deny that was lifted is lifted. The browser keeps its vendor, whose
|
|
360
410
|
* sessions it has: only a deny it was kept with is lifted. */
|
|
361
411
|
export function recheckPlane(plane, env, now) {
|
|
362
412
|
const keyed = served(env).parallelKey;
|
|
363
|
-
|
|
413
|
+
const { jev: kept, ...resolved } = plane;
|
|
414
|
+
// Jev off is read when the run is created (planeFor) and is never lifted here: `env`'s switch (a runner's own) can add
|
|
415
|
+
// "off", never remove it.
|
|
416
|
+
return withJevSwitch(Object.fromEntries(Object.entries(resolved).map(([name, value]) => {
|
|
364
417
|
const fresh = name === "model" ? undefined : now?.fresh[name];
|
|
365
418
|
if (fresh !== undefined && (value === DENIED || (name !== "browser" && now.permission(name) !== "allow")))
|
|
366
419
|
return [name, fresh];
|
|
367
420
|
return [name, name === "browser" && isVendor(value) && !browserKeysOf(env)[value] ? noBrowserKey(value) : value === "parallel" && !keyed ? NO_PARALLEL_KEY : value];
|
|
368
|
-
}));
|
|
421
|
+
})), env, kept === "off");
|
|
369
422
|
}
|
|
370
423
|
/** The Plane kept for a run made before its plane was kept, resolved at a later launch (runs.ts): its browser stays
|
|
371
|
-
*
|
|
372
|
-
* keeps the vendor, never a refusal: the plane each launch hands over is checked again
|
|
373
|
-
* keys missing make it unavailable for that launch alone, and restored keys make the
|
|
374
|
-
|
|
424
|
+
* the default vendor (DEFAULT_BROWSER_VENDOR, the one vendor there was then), never today's pick, which could check its
|
|
425
|
+
* sessions at another vendor. It keeps the vendor, never a refusal: the plane each launch hands over is checked again
|
|
426
|
+
* (recheckPlane), so that vendor's keys missing make it unavailable for that launch alone, and restored keys make the
|
|
427
|
+
* next one run. */
|
|
428
|
+
export const keptFromBefore = (plane) => (plane.browser === undefined ? plane : { ...plane, browser: DEFAULT_BROWSER_VENDOR });
|
|
375
429
|
/** A run's saved Plane as a launch reads it: a vendor's missing-key refusal an earlier server saved (noBrowserKey's exact
|
|
376
430
|
* words, Browserbase's or Kernel's) is that vendor again, which the launch checks again as usual (recheckPlane), so
|
|
377
431
|
* restored keys make it run. Every other saved value stays as it is: `auto` with no key at a run's first launch
|
|
@@ -381,9 +435,9 @@ export function keptVendor(plane) {
|
|
|
381
435
|
return vendor ? { ...plane, browser: vendor } : plane;
|
|
382
436
|
}
|
|
383
437
|
/** The key row (tool-keys.ts) of the browser's vendor on `resolution` with `picked` the provider in force: the vendor it
|
|
384
|
-
* resolved to, else the one picked, else the
|
|
438
|
+
* resolved to, else the one picked, else the default (DEFAULT_BROWSER_VENDOR), so a page links a missing key to the row
|
|
385
439
|
* it is saved on. */
|
|
386
|
-
export const browserKeyRow = (picked, resolution) => (isVendor(resolution) ? resolution : isVendor(picked) ? picked :
|
|
440
|
+
export const browserKeyRow = (picked, resolution) => (isVendor(resolution) ? resolution : isVendor(picked) ? picked : DEFAULT_BROWSER_VENDOR);
|
|
387
441
|
/** The Plane a run's process is handed at a launch, under the server's `settings` now: its kept Plane (as keptVendor
|
|
388
442
|
* reads it) checked again (recheckPlane) against the one it would get today; with none kept, today's, its browser kept
|
|
389
443
|
* (keptFromBefore). At a launch after its first (a relaunch, a follow-up's, one after a restart) a capability set
|
|
@@ -407,6 +461,16 @@ export function planeOf(env) {
|
|
|
407
461
|
}
|
|
408
462
|
/** Whether a run is handed Parallel's key: one of its capabilities resolves to Parallel. */
|
|
409
463
|
export const handsParallel = (plane) => PICKABLE.some((name) => plane[name] === "parallel");
|
|
464
|
+
/** The resolutions of each web tool its run's Web runs (web-run.ts SEARCH_CHAINS, FETCH_CHAINS), where Jev ranks a
|
|
465
|
+
* search's results. */
|
|
466
|
+
const WEB_RUNS = { web_search: ["parallel", "native", "firecrawl-keyless", "exa-keyless"], web_fetch: ["parallel", "firecrawl-keyless", DIRECT_FETCH] };
|
|
467
|
+
/** Whether a run on `harness` is handed TypeSafe's key for its web tools (decisions.ts DecisionNeeds.jevWeb): one of
|
|
468
|
+
* them is served by its own Web (web-run.ts webOf), and Jev is turned off neither by the plane (the server's switch at
|
|
469
|
+
* launch, planeFor) nor in `env` (AGENTRUN_WEB_JEV_OFF: a runner's own switch adds "off", never removes it).
|
|
470
|
+
* web_fetch always is where it runs; web_search is where it resolves to Parallel or a keyless provider, or to native
|
|
471
|
+
* where that is the model provider's hosted search (pi's), never a harness's own search inside its CLI (codex's,
|
|
472
|
+
* claude-agent's: its facts' webSearch), where no Jev call can happen. */
|
|
473
|
+
export const handsJevWeb = (plane, env, harness) => plane.jev !== "off" && !webJevOff(env) && (searchesOwn(plane.web_search ?? "", tableFactsOf(env, harness)) || WEB_RUNS.web_fetch.includes(plane.web_fetch ?? ""));
|
|
410
474
|
/** The issues of `value` as a settings map, its fields under `at` (none: a body's own): each settings key (a tool of the
|
|
411
475
|
* table, a catalog tool, an MCP server's wildcard) to `{provider?, permission?}`, a provider only for a capability that
|
|
412
476
|
* has a choice and one offered for it, a permission one offered for the tool. */
|
package/dist/tools.d.ts
CHANGED
|
@@ -171,10 +171,13 @@ export type EffectRun = {
|
|
|
171
171
|
search?: SearchOn;
|
|
172
172
|
};
|
|
173
173
|
/** What a tool's own ask (ToolEntry.asks) reads: the run's host, and how many calls of a tool the run has run to a good
|
|
174
|
-
* end, from the run's record (its journal), so a pause and a new host count them all
|
|
174
|
+
* end, from the run's record (its journal), so a pause and a new host count them all; `made`, the arguments of those
|
|
175
|
+
* calls (each one whose arguments the record names), with those of the calls the gate let through that have no result
|
|
176
|
+
* yet. */
|
|
175
177
|
export type AskContext = {
|
|
176
178
|
readonly host: ToolHost;
|
|
177
179
|
ran(tool: string): Promise<number>;
|
|
180
|
+
made(tool: string): Promise<readonly unknown[]>;
|
|
178
181
|
};
|
|
179
182
|
export type ToolEntry = {
|
|
180
183
|
/** One line, for capabilities. */
|
|
@@ -352,6 +355,7 @@ export declare const toolsView: (env: NodeJS.ProcessEnv, settings?: ToolSettings
|
|
|
352
355
|
missing?: string[] | undefined;
|
|
353
356
|
reason?: string | undefined;
|
|
354
357
|
available: boolean;
|
|
358
|
+
runner_only?: boolean | undefined;
|
|
355
359
|
sandbox_only?: boolean | undefined;
|
|
356
360
|
call_only?: boolean | undefined;
|
|
357
361
|
nodes: boolean;
|
package/dist/tools.js
CHANGED
|
@@ -36,7 +36,7 @@ import { fetchFor, WEB_FETCH_TOOL, webFetchTool } from "./web-fetch.js";
|
|
|
36
36
|
import { searchFor, WEB_SEARCH_TOOL, webSearchTool } from "./web-search.js";
|
|
37
37
|
import { fakeFetch, fakeSaveOptions, fakeSearch } from "./web-fake.js";
|
|
38
38
|
import { LENGTH_TYPES, SAVE_MAX_BYTES, WEB_SAVE_TOOL, webSaveTool } from "./web-save.js";
|
|
39
|
-
import { browserNeeds, explainsView, isUnavailable, NO_PARALLEL_KEY, PICKABLE, planeOf, PROVIDERS, serverGate, whyUnavailable, withDefaults } from "./tool-plane.js";
|
|
39
|
+
import { browserNeeds, DEFAULT_BROWSER_VENDOR, explainsView, isUnavailable, NO_PARALLEL_KEY, PICKABLE, planeOf, PROVIDERS, serverGate, whyUnavailable, withDefaults } from "./tool-plane.js";
|
|
40
40
|
import { fauxFetch, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
41
41
|
import { keyNeeded } from "./key-words.js";
|
|
42
42
|
import { unattachable } from "./attach-images.js";
|
|
@@ -105,7 +105,7 @@ const emailTool = (name) => ({
|
|
|
105
105
|
});
|
|
106
106
|
/** web_fetch, bound under `name`. */
|
|
107
107
|
const webFetchEntry = (name) => ({
|
|
108
|
-
summary: `Read one public web page from a public host through Firecrawl's keyless fetch where the server holds no Parallel key (each URL sent to Firecrawl, never a private or local one; the guarded direct fetch when Firecrawl answers no page or its free limit is spent), else through
|
|
108
|
+
summary: `Read one public web page from a public host through Firecrawl's keyless fetch where the server holds no Parallel key (each URL sent to Firecrawl, never a private or local one; the guarded direct fetch when Firecrawl answers no page or its free limit is spent), else through Parallel's extract (the default) or the guarded direct fetch where it is picked (Parallel's falling back to the direct fetch, saying why, when Parallel answers no page), a part at a time (offset, max_chars; the page fetched once a run): { ok, url, status, title, text, chars, truncated?, original_chars?, beyond_read?, offset?, next_offset?, html_chars?, converted?, links, links_omitted?, via, parallel?, refused?, error? }; html_chars, the page's whole length, when its HTML was cut at ${HTML_READ_CHARS.toLocaleString("en-US")} characters before it was read, so its text is only the start of the page; converted: "text" when the text is plain text, its conversion to markdown having run out of time; a private or local address, a port other than 80 or 443, or a scheme other than http(s) is refused, never sent to Parallel.`,
|
|
109
109
|
needs: [],
|
|
110
110
|
nodes: true,
|
|
111
111
|
bind: async (host) => {
|
|
@@ -118,7 +118,7 @@ const webFetchEntry = (name) => ({
|
|
|
118
118
|
// A call node's Page is the workflow's, not a model's context: it reads the most of a part by default, from the page
|
|
119
119
|
// the run read (its Web's pages) where it holds the URL. Its request to Parallel, when it makes one, is booked under the call
|
|
120
120
|
// (paid-calls.ts); a part from what the run read makes none and books nothing.
|
|
121
|
-
effect: async (args, run) => bookedIn(run.ledger, async () => fetchFor(run.env, args.url, { ...(await fetchOptions(run.env, FAUX_ENV)), offset: args.offset, maxChars: args.max_chars ?? TEXT_CAP, signal: run.signal })),
|
|
121
|
+
effect: async (args, run) => bookedIn(run.ledger, async () => fetchFor(run.env, args.url, { ...(await fetchOptions(run.env, FAUX_ENV)), offset: args.offset, maxChars: args.max_chars ?? TEXT_CAP, ...(typeof args.objective === "string" ? { objective: args.objective } : {}), signal: run.signal })),
|
|
122
122
|
});
|
|
123
123
|
/** A file or shell tool: listed here for its words and its rules, bound by the run's workspace registry
|
|
124
124
|
* (workspace/run-tools.ts), never by this table. */
|
|
@@ -309,7 +309,7 @@ const browserTool = {
|
|
|
309
309
|
// The agent's computer, where it is a browser, wins over the plane's pick: the run's sessions are that provider's,
|
|
310
310
|
// opened through the claim, with no saved sign-in or plane check of their own.
|
|
311
311
|
const computer = host.browserComputer;
|
|
312
|
-
const planeVendor = planeOf(host.env).browser ??
|
|
312
|
+
const planeVendor = planeOf(host.env).browser ?? DEFAULT_BROWSER_VENDOR;
|
|
313
313
|
const vendor = computer?.provider ?? planeVendor;
|
|
314
314
|
const planeRefused = !computer && isUnavailable(planeVendor) ? new BrowserFailureError(browserFailure("browser_unavailable", `The browser does not run here: ${whyUnavailable(planeVendor)}.`)) : undefined;
|
|
315
315
|
// The run's saved sign-in: on the runner (one process, many claims) read from the store under this run's own claim
|
|
@@ -348,7 +348,7 @@ const browserTool = {
|
|
|
348
348
|
})();
|
|
349
349
|
const refused = "refused" in made ? made.refused : undefined;
|
|
350
350
|
const parts = {
|
|
351
|
-
provider: "browser" in made ? claimBrowserProvider(made.browser, { headless: true, ...(
|
|
351
|
+
provider: "browser" in made ? claimBrowserProvider(made.browser, { headless: true, ...(kept ? { signIn: { name: SIGN_IN_KEY, pointer: kept.ref } } : {}) }) : undefined,
|
|
352
352
|
driver: stand ? stand.driver : cdpDriver(),
|
|
353
353
|
};
|
|
354
354
|
// The save flag every session carries is this launch's (asHanded), never the one stored with its conversation.
|
|
@@ -623,7 +623,7 @@ export const TOOLS = Object.freeze({
|
|
|
623
623
|
},
|
|
624
624
|
[WEB_FETCH_TOOL]: webFetchEntry(WEB_FETCH_TOOL),
|
|
625
625
|
[WEB_SEARCH_TOOL]: {
|
|
626
|
-
summary: "Search the web: Parallel's Search API where the server holds its key, else Firecrawl's keyless search with Exa's behind it; or the provider picked, the harness's own search (claude-agent's, codex's) or on pi the model provider's hosted search (Anthropic, OpenAI) only where native is picked: {
|
|
626
|
+
summary: "Search the web: Parallel's Search API where the server holds its key, else Firecrawl's keyless search with Exa's behind it; or the provider picked, the harness's own search (claude-agent's, codex's) or on pi the model provider's hosted search (Anthropic, OpenAI) only where native is picked: { objective, queries?, n? } (query is deprecated: a model's call gives objective, which the schema requires; a call node's { query } alone is the objective and its one query) -> { provider, objective, queries, results: [{ url, title, snippet, published? }], text? }, provider naming the one that served it, 1 to 25 results, each snippet at most 3,000 characters; { error } when the search gives no answer.",
|
|
627
627
|
needs: [],
|
|
628
628
|
nodes: true,
|
|
629
629
|
// On the runner its hosted search goes through the run's own route (host.search, run.search), labelled web_search.
|
|
@@ -779,7 +779,7 @@ export const toolsView = (env, settings = {}, noBox, refused = {}, runnerShell =
|
|
|
779
779
|
// Unavailable says why: a sandbox-only tool no box here can run, why none can (`noBox`); on a tool a user picks a
|
|
780
780
|
// provider for, the resolutions' own words (`web_search is turned off in settings`); else the variables it needs.
|
|
781
781
|
const reason = available ? undefined : refusal ?? boxless ?? (plane ? [...new Set(Object.values(plane).filter(isUnavailable).map(whyUnavailable))].join("; ") : `Needs ${keyNeeded(missing)}`);
|
|
782
|
-
return { name, summary: entry.summary, ...(blurbOf(name) ? { blurb: blurbOf(name) } : {}), nodes: entry.nodes, calls: entry.effect !== undefined, ...(entry.callOnly ? { call_only: true } : {}), ...(entry.sandboxOnly ? { sandbox_only: true } : {}), available, ...(reason ? { reason } : {}), ...(missing.length ? { missing } : {}), harnesses: isHostTool(name) ? [...everyHarness] : [...generalSpec], ...serverGate(name, settings), ...(plane ? { providers: [...PROVIDERS[name]], provider: picked[name].provider, default_provider: PROVIDERS[name][0], resolves: plane, why: view.why } : {}) };
|
|
782
|
+
return { name, summary: entry.summary, ...(blurbOf(name) ? { blurb: blurbOf(name) } : {}), nodes: entry.nodes, calls: entry.effect !== undefined, ...(entry.callOnly ? { call_only: true } : {}), ...(entry.sandboxOnly ? { sandbox_only: true } : {}), ...(entry.runnerOnly ? { runner_only: true } : {}), available, ...(reason ? { reason } : {}), ...(missing.length ? { missing } : {}), harnesses: isHostTool(name) ? [...everyHarness] : [...generalSpec], ...serverGate(name, settings), ...(plane ? { providers: [...PROVIDERS[name]], provider: picked[name].provider, default_provider: PROVIDERS[name][0], resolves: plane, why: view.why } : {}) };
|
|
783
783
|
});
|
|
784
784
|
// The host tools over a run's own tools (META_TOOLS): not in the table, never granted or named by a node (`meta`), listed
|
|
785
785
|
// so the owner sees them and their setting (allow or deny; a deny is not offered at all).
|