@parcha/agentrun-serve 0.1.0-beta.58 → 0.1.0-beta.60
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 +402 -1
- package/README.md +516 -190
- 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/agent-delete.d.ts +6 -9
- package/dist/agent-delete.js +5 -3
- package/dist/agent-package.js +11 -1
- 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 -2
- package/dist/api-only.js +3 -3
- package/dist/archil-routes.d.ts +4 -1
- package/dist/archil-routes.js +15 -12
- package/dist/archil-settings.d.ts +18 -8
- package/dist/archil-settings.js +35 -17
- package/dist/attach-conformance.js +5 -4
- package/dist/box-paths.d.ts +3 -2
- package/dist/box-paths.js +5 -4
- 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 +7 -0
- package/dist/chatgpt-plan.js +35 -11
- package/dist/claude-login-token.d.ts +20 -11
- package/dist/claude-login-token.js +175 -107
- package/dist/claude-login.d.ts +124 -33
- package/dist/claude-login.js +562 -85
- package/dist/claude-sign-in.d.ts +3 -0
- package/dist/claude-sign-in.js +10 -1
- package/dist/cli-learning/connections.js +1 -1
- package/dist/cli.js +323 -292
- 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 +6 -3
- package/dist/computer-attach.js +41 -29
- 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 +2 -1
- package/dist/computers.js +6 -3
- package/dist/console/THIRD-PARTY-NOTICES.txt +50 -0
- package/dist/console/assets/backend-QnwGVBeU.js +166 -0
- package/dist/console/assets/index-DZi-muIj.js +629 -0
- package/dist/console/assets/share-pz61zIn9.js +6 -0
- package/dist/console/assets/styles-CcceGcu2.js +291 -0
- package/dist/console/assets/styles-fjQBFfMv.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.js +10 -4
- 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 +12 -2
- package/dist/env-switch.js +23 -3
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +2 -0
- package/dist/factory-activity.d.ts +68 -0
- package/dist/factory-activity.js +153 -0
- package/dist/factory-runs.d.ts +11 -0
- package/dist/factory-runs.js +52 -0
- package/dist/fal-price.d.ts +11 -1
- package/dist/fal-price.js +33 -0
- package/dist/faux-computers.js +1 -1
- package/dist/filed-answer.d.ts +2 -2
- package/dist/filed-answer.js +2 -2
- package/dist/filed-tool.d.ts +32 -0
- package/dist/filed-tool.js +122 -0
- 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.d.ts +1 -2
- package/dist/harness-keys.js +10 -8
- 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 +12 -0
- package/dist/harness-table.js +21 -6
- package/dist/harness.js +6 -2
- 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-worker.js +2 -2
- package/dist/import.d.ts +20 -8
- package/dist/import.js +448 -187
- package/dist/key-refusal.d.ts +14 -2
- package/dist/key-refusal.js +97 -33
- package/dist/learn/audit.d.ts +28 -27
- package/dist/learn/audit.js +87 -62
- package/dist/learn/check.js +1 -1
- package/dist/learn/commit.d.ts +35 -43
- package/dist/learn/commit.js +62 -270
- package/dist/learn/compile.d.ts +9 -6
- package/dist/learn/compile.js +51 -28
- package/dist/learn/corrections.js +1 -1
- package/dist/learn/delete.d.ts +5 -12
- package/dist/learn/delete.js +17 -30
- package/dist/learn/field-check.d.ts +111 -0
- package/dist/learn/field-check.js +174 -0
- package/dist/learn/forget-run.d.ts +16 -0
- package/dist/learn/forget-run.js +53 -0
- package/dist/learn/index.js +1 -1
- package/dist/learn/learning-of.d.ts +0 -4
- package/dist/learn/learning-of.js +0 -5
- package/dist/learn/ledger.d.ts +32 -29
- package/dist/learn/ledger.js +26 -19
- package/dist/learn/{folder.d.ts → legacy/folder.d.ts} +2 -1
- package/dist/learn/{folder.js → legacy/folder.js} +4 -7
- package/dist/learn/legacy/place.d.ts +16 -0
- package/dist/{workspace/learning-workspace.js → learn/legacy/place.js} +12 -42
- package/dist/learn/legacy/scrub.d.ts +28 -0
- package/dist/learn/legacy/scrub.js +258 -0
- package/dist/learn/promote.d.ts +119 -102
- package/dist/learn/promote.js +119 -262
- package/dist/learn/reset-ledger.d.ts +18 -0
- package/dist/learn/reset-ledger.js +14 -0
- package/dist/learn/rows.d.ts +186 -0
- package/dist/learn/rows.js +376 -0
- package/dist/learn/secrets.d.ts +4 -0
- package/dist/learn/secrets.js +12 -0
- package/dist/learn/workflow-draft.d.ts +4 -1
- package/dist/learn/workflow-draft.js +12 -2
- 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 +25 -8
- package/dist/learning-cost.js +23 -8
- package/dist/learning-reset.d.ts +1 -1
- package/dist/learning-reset.js +9 -11
- package/dist/learning-routes.d.ts +60 -81
- package/dist/learning-routes.js +187 -360
- package/dist/learning-setting.d.ts +6 -0
- package/dist/learning-setting.js +11 -1
- package/dist/learning-words.d.ts +2 -0
- package/dist/learning-words.js +2 -0
- package/dist/learning.d.ts +18 -24
- package/dist/learning.js +35 -66
- package/dist/listen-first.d.ts +5 -4
- package/dist/listen-first.js +4 -5
- package/dist/live-reach.d.ts +7 -0
- package/dist/live-reach.js +7 -0
- package/dist/mcp-api-only-origins.d.ts +15 -0
- package/dist/mcp-api-only-origins.js +40 -0
- package/dist/mcp-gateway.d.ts +22 -2
- package/dist/mcp-gateway.js +85 -11
- 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-resources.d.ts +1 -1
- 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/model-gateway.d.ts +1 -1
- package/dist/model-gateway.js +20 -36
- package/dist/native/discovery.d.ts +6 -0
- package/dist/native/discovery.js +14 -1
- package/dist/native/remote.d.ts +5 -0
- package/dist/native/remote.js +16 -0
- package/dist/native/runtime.js +3 -2
- package/dist/observation/observer.d.ts +6 -6
- package/dist/ollama-provider.d.ts +23 -9
- package/dist/ollama-provider.js +49 -20
- package/dist/openapi.js +290 -79
- 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 +58 -34
- package/dist/place-offers.js +96 -54
- package/dist/place.d.ts +41 -20
- package/dist/place.js +97 -47
- package/dist/print.js +1 -1
- package/dist/provider.d.ts +3 -2
- package/dist/provider.js +17 -8
- package/dist/purged-workflow.d.ts +0 -33
- package/dist/purged-workflow.js +3 -71
- package/dist/redact/match.d.ts +42 -9
- package/dist/redact/match.js +356 -54
- 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.d.ts +3 -3
- package/dist/run-launch.js +16 -3
- package/dist/run-learning-served.d.ts +3 -3
- package/dist/run-learning-served.js +1 -1
- package/dist/run-listing.d.ts +1 -1
- 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.d.ts +1 -1
- package/dist/run-timeline-served.js +8 -5
- package/dist/runnable.js +26 -9
- package/dist/runner/adapter-loop.d.ts +35 -18
- package/dist/runner/adapter-loop.js +94 -47
- package/dist/runner/adapter-run-spec.d.ts +14 -1
- package/dist/runner/adapter-run-spec.js +73 -46
- package/dist/runner/adapters/pi.js +4 -2
- package/dist/runner/audit.d.ts +10 -9
- package/dist/runner/audit.js +64 -67
- package/dist/runner/beside.js +5 -6
- package/dist/runner/claim-secrets.d.ts +10 -3
- package/dist/runner/claim-secrets.js +29 -13
- package/dist/runner/cli-run-spec.d.ts +18 -0
- package/dist/runner/cli-run-spec.js +87 -58
- package/dist/runner/compare-end.d.ts +2 -3
- package/dist/runner/compare-end.js +30 -11
- package/dist/runner/conformance/harness.js +2 -3
- package/dist/runner/conformance/subject.d.ts +4 -1
- package/dist/runner/disk-free.d.ts +15 -4
- package/dist/runner/disk-free.js +25 -7
- package/dist/runner/feedback-round.d.ts +1 -1
- package/dist/runner/feedback-round.js +2 -2
- package/dist/runner/harness-loops.js +3 -4
- package/dist/runner/held.d.ts +5 -12
- package/dist/runner/held.js +0 -25
- package/dist/runner/journal-kinds.d.ts +8 -2
- package/dist/runner/journal-kinds.js +23 -5
- package/dist/runner/learned-first.d.ts +0 -2
- package/dist/runner/learned-first.js +23 -7
- package/dist/runner/learning-end.d.ts +14 -24
- package/dist/runner/learning-end.js +52 -94
- package/dist/runner/learning-seed.d.ts +13 -16
- package/dist/runner/learning-seed.js +13 -23
- 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.js +13 -12
- package/dist/runner/mcp-claim.js +21 -5
- package/dist/runner/mcp-run.d.ts +4 -0
- package/dist/runner/mcp-run.js +2 -0
- 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 +12 -11
- package/dist/runner/presence.d.ts +1 -4
- package/dist/runner/presence.js +6 -8
- package/dist/runner/promotion.d.ts +39 -36
- package/dist/runner/promotion.js +168 -112
- package/dist/runner/redact.d.ts +3 -1
- package/dist/runner/redact.js +5 -3
- package/dist/runner/reflect-hook.d.ts +2 -2
- package/dist/runner/reflect-hook.js +4 -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 +21 -14
- package/dist/runner/run-child-host.js +187 -141
- package/dist/runner/run-child.js +11 -4
- package/dist/runner/runner-check.js +5 -1
- package/dist/runner/runner.d.ts +3 -4
- package/dist/runner/runner.js +13 -9
- package/dist/runner/sdk-loop.js +10 -12
- package/dist/runner/spec-holds.d.ts +8 -1
- package/dist/runner/spec-holds.js +9 -4
- package/dist/runner/workflow-calls.d.ts +9 -0
- package/dist/runner/workflow-calls.js +150 -0
- package/dist/runner/workflow-first.d.ts +120 -32
- package/dist/runner/workflow-first.js +218 -94
- package/dist/runner/workflow-spec.js +1 -1
- 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/check.d.ts +1 -4
- package/dist/sdk/check.js +2 -3
- package/dist/sdk/runs.d.ts +26 -7
- package/dist/sdk/runs.js +194 -78
- 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 +55 -9
- package/dist/secrets.js +345 -21
- package/dist/server-fs.d.ts +1 -1
- package/dist/server-fs.js +1 -1
- package/dist/server-keys.d.ts +10 -3
- package/dist/server-keys.js +16 -3
- package/dist/server-secrets-store.js +2 -4
- package/dist/server.d.ts +30 -18
- package/dist/server.js +520 -238
- 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/source-sync/auxiliary.js +2 -2
- 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/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/migrations/0032_learning_rows.sql +65 -0
- package/dist/store/postgres/store.js +4 -0
- package/dist/store/schema.d.ts +60 -11
- package/dist/store/schema.js +147 -17
- package/dist/store/seal.d.ts +4 -1
- package/dist/store/sqlite/learning-rows.d.ts +23 -0
- package/dist/store/sqlite/learning-rows.js +559 -0
- 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 +17 -10
- package/dist/store/sqlite/run-patch.js +50 -13
- package/dist/store/sqlite/store.d.ts +9 -0
- package/dist/store/sqlite/store.js +194 -46
- package/dist/store/store-schema.js +3 -4
- package/dist/store/store.d.ts +286 -38
- package/dist/store/store.js +27 -11
- package/dist/store-reads/analytics.d.ts +2 -1
- package/dist/store-reads/analytics.js +7 -5
- package/dist/store-reads/journal.d.ts +33 -3
- package/dist/store-reads/journal.js +99 -4
- package/dist/store-reads/learning.d.ts +50 -45
- package/dist/store-reads/learning.js +153 -116
- package/dist/store-reads/loop.js +1 -1
- package/dist/store-reads/stats.d.ts +2 -2
- package/dist/store-reads/stats.js +13 -7
- package/dist/store-view.d.ts +24 -2
- package/dist/store-view.js +49 -17
- package/dist/suggestions.d.ts +1 -1
- package/dist/suggestions.js +29 -13
- package/dist/template-eval.d.ts +72 -9
- package/dist/template-eval.js +358 -64
- package/dist/templates.d.ts +10 -2
- package/dist/templates.js +31 -4
- 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 +8 -6
- package/dist/timeline/web-calls.js +10 -6
- 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 +54 -13
- package/dist/tool-plane.js +103 -32
- 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 +34 -0
- package/dist/web-holds.js +89 -0
- package/dist/web-run.d.ts +32 -5
- package/dist/web-run.js +76 -28
- package/dist/web-save.js +23 -12
- 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/archil-exec.js +1 -1
- package/dist/workspace/archil.d.ts +1 -1
- package/dist/workspace/archil.js +1 -1
- package/dist/workspace/attach.js +52 -19
- package/dist/workspace/attached-computers.d.ts +6 -2
- package/dist/workspace/attached-computers.js +5 -4
- package/dist/workspace/computer-deps.d.ts +23 -6
- package/dist/workspace/computer-deps.js +38 -18
- package/dist/workspace/computer-for-claim.d.ts +21 -4
- package/dist/workspace/computer-for-claim.js +160 -54
- 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 +19 -4
- package/dist/workspace/computer-providers.js +40 -6
- package/dist/workspace/index.d.ts +2 -3
- package/dist/workspace/index.js +2 -3
- 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.js +4 -5
- package/dist/workspace/paths.d.ts +0 -4
- package/dist/workspace/paths.js +0 -6
- 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 +7 -1
- package/dist/workspace/workspace.js +1 -1
- package/package.json +13 -14
- package/skills/agentrun-serve/SKILL.md +5 -2
- package/templates/README.md +22 -6
- package/templates/TOOLS.md +46 -0
- package/dist/console/assets/backend-CSAWUqtZ.js +0 -166
- package/dist/console/assets/index-Bwn1oTem.css +0 -1
- package/dist/console/assets/index-DPh29cyz.js +0 -747
- package/dist/workspace/learning-workspace.d.ts +0 -24
- /package/dist/learn/{learning.sh → legacy/learning.sh} +0 -0
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
|
@@ -6,6 +6,7 @@ import { type ShellPlace } from "@parcha/agentrun-kernel/kernel";
|
|
|
6
6
|
import { type Permission, type Pin, type ToolEffect } from "./tool-gate.js";
|
|
7
7
|
import { type BashPolicy } from "./bash-read-only.js";
|
|
8
8
|
import { EMAIL_SCOPES } from "./email/names.js";
|
|
9
|
+
import { type FileSetting } from "./filed-tool.js";
|
|
9
10
|
/** An email read tool's scope (email/names.ts). */
|
|
10
11
|
type EmailScope = (typeof EMAIL_SCOPES)[number];
|
|
11
12
|
/**
|
|
@@ -21,9 +22,9 @@ export declare const CAPABILITIES: readonly ["read", "write", "edit", "web_searc
|
|
|
21
22
|
declare const DIRECT_FETCH: "kernel";
|
|
22
23
|
/** The providers a user may pick for each capability that has a choice, its default first: `auto`, for web_search the
|
|
23
24
|
* 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
|
|
25
|
+
* only `native`); for web_fetch Parallel's extract where the server holds a Parallel key (the guarded direct fetch
|
|
26
|
+
* behind it), else keyless Firecrawl (both in DEFAULT_WEB_ORDER); `native`, the harness's own tool or its model
|
|
27
|
+
* provider's hosted one, and nothing else; `firecrawl-keyless`, Firecrawl's public MCP endpoint, no key, with keyless Exa behind it for
|
|
27
28
|
* web_search and the guarded direct fetch behind it for web_fetch; `exa-keyless`, Exa's public MCP endpoint alone, no
|
|
28
29
|
* key; `kernel`, the guarded direct fetch; `parallel`, Parallel's Search and Extract APIs on PARALLEL_API_KEY; `off`,
|
|
29
30
|
* web_search turned off: nothing is searched, and an
|
|
@@ -72,7 +73,8 @@ export type ToolSetting = {
|
|
|
72
73
|
pin?: Pin; /** On an MCP server's wildcard (`mcp:<server>/*`) in the server's settings only: the tools its server marks read-only run with no approval (tool-gate.ts readsLift). Kept only when true. */
|
|
73
74
|
allow_reads?: true; /** bash's policy, an agent's own only (bash-read-only.ts). */
|
|
74
75
|
policy?: BashPolicy; /** An email read tool's scope, an agent's own only (email/tools.ts): its email run's thread (the default), or the whole account. */
|
|
75
|
-
scope?: EmailScope; /**
|
|
76
|
+
scope?: EmailScope; /** An MCP tool's file setting, an agent's own only, on the tool's own key (filed-tool.ts): its answers filed whole in the run's files, the model reading a summary. */
|
|
77
|
+
file?: FileSetting; /** Read as a stand-in for a value not offered (checkToolSettings); never shown or written. */
|
|
76
78
|
fallback?: true; /** The stand-in's value as written in the file, which a save that keeps the stand-in writes back (ToolSettings.put). Never shown. */
|
|
77
79
|
raw?: unknown; /** A pin in the file that does not read (readToolSettings): the gate refuses every call of the tool, and a save keeps it (ToolSettings.put) until the owner sets a valid pin or removes the tool's setting. Served as `pin_broken: true`. */
|
|
78
80
|
brokenPin?: true; /** The broken pin as written in the file, which a save that keeps it writes back. Never shown. */
|
|
@@ -132,17 +134,42 @@ export type ResolveInput = {
|
|
|
132
134
|
/** The facts of the adapter the harness runs on (its own search, its wire), its owner's table entry's (harness-table.ts
|
|
133
135
|
* factsOf: a module's harness's too); undefined for one with none (pi). Always given: a caller names them. */
|
|
134
136
|
facts: AdapterFacts | undefined;
|
|
137
|
+
/** What the server's Jev means for web_search (decisions.ts jevWebWhy): said after the why of a search the run's own
|
|
138
|
+
* web_search runs. None: no Jev key, nothing to say. */
|
|
139
|
+
jevWhy?: string;
|
|
140
|
+
/** The same for web_fetch (jevWebWhy's "web_fetch"): what a fetch the run's own Web serves sends TypeSafe, said after
|
|
141
|
+
* its why. None: no Jev key, nothing to say. */
|
|
142
|
+
jevFetchWhy?: string;
|
|
135
143
|
};
|
|
136
144
|
/** Whether a run on `harness` sends through OpenRouter, where a harness's own search does not run: false for one with
|
|
137
145
|
* none (and for pi, whose hosted search is asked of the model's provider). */
|
|
138
146
|
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);
|
|
147
|
+
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
148
|
/** 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.
|
|
149
|
+
* the two never disagree. A web_search the run's own tool runs, and a web_fetch its own Web serves (any resolution but
|
|
150
|
+
* 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
|
|
151
|
+
* (`jevWhy`, `jevFetchWhy`). */
|
|
142
152
|
export declare function explainCapability(capability: Pickable, input: ResolveInput): {
|
|
143
153
|
resolves: Resolution;
|
|
144
154
|
why: string;
|
|
145
155
|
};
|
|
156
|
+
/** The order `auto` asks for each web tool: the first provider here the server can run is what auto resolves to
|
|
157
|
+
* (Parallel only where the server holds its key; keyless Firecrawl, keyless Exa and the guarded direct fetch always),
|
|
158
|
+
* keyless Firecrawl where none can. Capabilities' `why` and every run's plane read it (autoWeb). Parallel is first for
|
|
159
|
+
* both. To put Firecrawl first, swap the two ids in a list: that one line is the whole change. */
|
|
160
|
+
export declare const DEFAULT_WEB_ORDER: Readonly<{
|
|
161
|
+
web_search: readonly AutoSearch[];
|
|
162
|
+
web_fetch: readonly AutoFetch[];
|
|
163
|
+
}>;
|
|
164
|
+
type AutoSearch = "parallel" | "firecrawl-keyless" | "exa-keyless";
|
|
165
|
+
type AutoFetch = "parallel" | "firecrawl-keyless" | typeof DIRECT_FETCH;
|
|
166
|
+
/** What `auto` resolves `capability` to on a run of `input`, and why, by `order` (DEFAULT_WEB_ORDER). `auto` never
|
|
167
|
+
* resolves native, on any harness: where a native search would run, web_search's why names it as the pick it is;
|
|
168
|
+
* where none runs (noNative), it says why not. */
|
|
169
|
+
export declare function autoWeb(capability: "web_search" | "web_fetch", input: ResolveInput, order?: typeof DEFAULT_WEB_ORDER): {
|
|
170
|
+
resolves: Resolution;
|
|
171
|
+
why: string;
|
|
172
|
+
};
|
|
146
173
|
/** What `capability` resolves to on a run of `input`. */
|
|
147
174
|
export declare const resolveCapability: (capability: Pickable, input: ResolveInput) => Resolution;
|
|
148
175
|
export declare const isUnavailable: (resolution: Resolution | undefined) => resolution is `unavailable: ${string}`;
|
|
@@ -152,6 +179,9 @@ export declare const isUnavailable: (resolution: Resolution | undefined) => reso
|
|
|
152
179
|
export declare const whyUnavailable: (resolution: string) => string;
|
|
153
180
|
export declare const BROWSER_VENDOR_IDS: readonly string[];
|
|
154
181
|
export declare const BROWSER_KEYS: Readonly<Record<string, readonly string[]>>;
|
|
182
|
+
/** The browser vendor where nothing names one (a run kept before its plane was, a page's key row, the capabilities'
|
|
183
|
+
* browser): the registry's first hosted browser, the one `auto` tries first (Browserbase). */
|
|
184
|
+
export declare const DEFAULT_BROWSER_VENDOR: Resolution;
|
|
155
185
|
type BrowserVendor = string;
|
|
156
186
|
/** The keys a browser that resolves to `resolution` runs on: its vendor's (BROWSER_KEYS), none for no vendor. */
|
|
157
187
|
export declare const browserNeeds: (resolution: string | undefined) => readonly string[];
|
|
@@ -167,9 +197,12 @@ export declare function explainsView(env: NodeJS.ProcessEnv, settings: ToolSetti
|
|
|
167
197
|
why: Record<HarnessId, string>;
|
|
168
198
|
}>;
|
|
169
199
|
/** 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)
|
|
200
|
+
* its search asks (the one the resolution read); and `jev: "off"` where the server had Jev turned off for the web tools
|
|
201
|
+
* (AGENTRUN_WEB_JEV_OFF) when it created the run, on a plane with a web tool, so the switch reaches a runner on another
|
|
202
|
+
* host; a runner's re-check (recheckPlane) keeps it. */
|
|
171
203
|
export type Plane = Partial<Record<Pickable, Resolution>> & {
|
|
172
204
|
model?: string;
|
|
205
|
+
jev?: "off";
|
|
173
206
|
};
|
|
174
207
|
/** The facts of a pinned revision its run's tools resolve from. */
|
|
175
208
|
/** `approvals`: the revision's, kept only when "never" (the agent runs unattended: an ask is an allow, never over a deny). */
|
|
@@ -190,7 +223,7 @@ export declare function planeFor(env: NodeJS.ProcessEnv, tooling: Tooling, setti
|
|
|
190
223
|
capped?: boolean;
|
|
191
224
|
run?: boolean;
|
|
192
225
|
}): 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
|
|
226
|
+
/** 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
227
|
* holds its key, which is unavailable, never another provider; and, given `now` (the Plane it would get today and each
|
|
195
228
|
* capability's permission today), a capability set to ask or deny, or kept denied, as it resolves today: a harness's
|
|
196
229
|
* own search cannot wait for a person, and a deny that was lifted is lifted. The browser keeps its vendor, whose
|
|
@@ -200,9 +233,10 @@ export declare function recheckPlane(plane: Plane, env: NodeJS.ProcessEnv, now?:
|
|
|
200
233
|
permission: (name: Pickable) => Permission;
|
|
201
234
|
}): Plane;
|
|
202
235
|
/** 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
|
|
236
|
+
* the default vendor (DEFAULT_BROWSER_VENDOR, the one vendor there was then), never today's pick, which could check its
|
|
237
|
+
* sessions at another vendor. It keeps the vendor, never a refusal: the plane each launch hands over is checked again
|
|
238
|
+
* (recheckPlane), so that vendor's keys missing make it unavailable for that launch alone, and restored keys make the
|
|
239
|
+
* next one run. */
|
|
206
240
|
export declare const keptFromBefore: (plane: Plane) => Plane;
|
|
207
241
|
/** A run's saved Plane as a launch reads it: a vendor's missing-key refusal an earlier server saved (noBrowserKey's exact
|
|
208
242
|
* words, Browserbase's or Kernel's) is that vendor again, which the launch checks again as usual (recheckPlane), so
|
|
@@ -210,7 +244,7 @@ export declare const keptFromBefore: (plane: Plane) => Plane;
|
|
|
210
244
|
* (NO_BROWSER_KEY) and `chrome` stay frozen. The same Plane where nothing changes. */
|
|
211
245
|
export declare function keptVendor(plane: Plane): Plane;
|
|
212
246
|
/** 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
|
|
247
|
+
* resolved to, else the one picked, else the default (DEFAULT_BROWSER_VENDOR), so a page links a missing key to the row
|
|
214
248
|
* it is saved on. */
|
|
215
249
|
export declare const browserKeyRow: (picked: string | undefined, resolution: string | undefined) => string;
|
|
216
250
|
/** The Plane a run's process is handed at a launch, under the server's `settings` now: its kept Plane (as keptVendor
|
|
@@ -226,11 +260,18 @@ export declare function relaunchPlane(kept: Plane | undefined, env: NodeJS.Proce
|
|
|
226
260
|
export declare function planeOf(env: NodeJS.ProcessEnv): Plane;
|
|
227
261
|
/** Whether a run is handed Parallel's key: one of its capabilities resolves to Parallel. */
|
|
228
262
|
export declare const handsParallel: (plane: Plane) => boolean;
|
|
263
|
+
/** Whether a run on `harness` is handed TypeSafe's key for its web tools (decisions.ts DecisionNeeds.jevWeb): one of
|
|
264
|
+
* 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
|
|
265
|
+
* launch, planeFor) nor in `env` (AGENTRUN_WEB_JEV_OFF: a runner's own switch adds "off", never removes it).
|
|
266
|
+
* web_fetch always is where it runs; web_search is where it resolves to Parallel or a keyless provider, or to native
|
|
267
|
+
* where that is the model provider's hosted search (pi's), never a harness's own search inside its CLI (codex's,
|
|
268
|
+
* claude-agent's: its facts' webSearch), where no Jev call can happen. */
|
|
269
|
+
export declare const handsJevWeb: (plane: Plane, env: NodeJS.ProcessEnv, harness: string | undefined) => boolean;
|
|
229
270
|
/** 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
271
|
* table, a catalog tool, an MCP server's wildcard) to `{provider?, permission?}`, a provider only for a capability that
|
|
231
272
|
* has a choice and one offered for it, a permission one offered for the tool. */
|
|
232
273
|
export declare function settingsIssues(value: unknown, at?: string, layer?: "server" | "agent"): InputIssue[];
|
|
233
|
-
/** `map` as a revision body keeps it: each tool's provider, permission, pin and
|
|
274
|
+
/** `map` as a revision body keeps it: each tool's provider, permission, pin, policy, scope and file setting as written (never a stand-in's internal
|
|
234
275
|
* marks), tools, fields and a pin's arguments sorted, and a tool with none of them gone. The one form, so two
|
|
235
276
|
* revisions whose settings say the same (a pin's arguments in another order) are the same text, and so one revision
|
|
236
277
|
* where its id is the body's digest (the store keeps the body as given: store/sqlite/store.ts). */
|
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";
|
|
@@ -38,6 +39,7 @@ import { canonicalPin, defaultPermission, isPinKeys, MAX_PIN_ARGS, MAX_PIN_CHOIC
|
|
|
38
39
|
import { BASH_POLICIES } from "./bash-read-only.js";
|
|
39
40
|
import { EMAIL_SCOPES, SCOPED_TOOLS, SCOPED_WORDS } from "./email/names.js";
|
|
40
41
|
import { isCatalogName, isMcpName, mcpNameOf, parseToolName } from "./tool-names.js";
|
|
42
|
+
import { fileIssues } from "./filed-tool.js";
|
|
41
43
|
/**
|
|
42
44
|
* The capabilities a pack or a revision may grant, by name: the tools the kernel gives a run, bound from serve's closed
|
|
43
45
|
* table (tools.ts) and named the same on every harness that runs them. `web_search` and `web_fetch` resolve to a
|
|
@@ -51,9 +53,9 @@ export const CAPABILITIES = ["read", "write", "edit", "web_search", "web_fetch",
|
|
|
51
53
|
const DIRECT_FETCH = "kernel";
|
|
52
54
|
/** The providers a user may pick for each capability that has a choice, its default first: `auto`, for web_search the
|
|
53
55
|
* 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
|
|
56
|
+
* only `native`); for web_fetch Parallel's extract where the server holds a Parallel key (the guarded direct fetch
|
|
57
|
+
* behind it), else keyless Firecrawl (both in DEFAULT_WEB_ORDER); `native`, the harness's own tool or its model
|
|
58
|
+
* provider's hosted one, and nothing else; `firecrawl-keyless`, Firecrawl's public MCP endpoint, no key, with keyless Exa behind it for
|
|
57
59
|
* web_search and the guarded direct fetch behind it for web_fetch; `exa-keyless`, Exa's public MCP endpoint alone, no
|
|
58
60
|
* key; `kernel`, the guarded direct fetch; `parallel`, Parallel's Search and Extract APIs on PARALLEL_API_KEY; `off`,
|
|
59
61
|
* web_search turned off: nothing is searched, and an
|
|
@@ -204,10 +206,24 @@ const nativeWhy = (input) => (input.facts?.webSearch ? ownSearch(input) : `${own
|
|
|
204
206
|
/** Keyless Firecrawl in a sentence, as web_search and web_fetch use it. web_fetch's says plainly that each URL leaves
|
|
205
207
|
* the server, and how to keep it here. */
|
|
206
208
|
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);
|
|
209
|
+
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";
|
|
210
|
+
/** The resolutions of web_search the run's own web_search runs (web-run.ts webOf), where Jev ranks the results: native
|
|
211
|
+
* only where it is the model provider's hosted search (pi's), never a harness's own search inside its CLI. */
|
|
212
|
+
const searchesOwn = (resolves, facts) => WEB_RUNS.web_search.includes(resolves) && (resolves !== "native" || !facts?.webSearch);
|
|
213
|
+
const ranksOwn = (resolves, input) => searchesOwn(resolves, input.facts);
|
|
208
214
|
/** 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.
|
|
215
|
+
* the two never disagree. A web_search the run's own tool runs, and a web_fetch its own Web serves (any resolution but
|
|
216
|
+
* 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
|
|
217
|
+
* (`jevWhy`, `jevFetchWhy`). */
|
|
210
218
|
export function explainCapability(capability, input) {
|
|
219
|
+
const said = explained(capability, input);
|
|
220
|
+
if (capability === "web_search" && input.jevWhy && ranksOwn(said.resolves, input))
|
|
221
|
+
return { ...said, why: `${said.why}; ${input.jevWhy}` };
|
|
222
|
+
if (capability === "web_fetch" && input.jevFetchWhy && WEB_RUNS.web_fetch.includes(said.resolves))
|
|
223
|
+
return { ...said, why: `${said.why}; ${input.jevFetchWhy}` };
|
|
224
|
+
return said;
|
|
225
|
+
}
|
|
226
|
+
function explained(capability, input) {
|
|
211
227
|
const chosen = input.override ?? input.pick ?? PROVIDERS[capability][0];
|
|
212
228
|
const picked = input.override !== undefined ? "picked for this agent" : "picked in settings";
|
|
213
229
|
const key = `your Parallel key (${input.parallelKeyFrom ?? "server"})`;
|
|
@@ -222,7 +238,7 @@ export function explainCapability(capability, input) {
|
|
|
222
238
|
return { resolves: DIRECT_FETCH, why: `the guarded direct fetch, ${picked}` };
|
|
223
239
|
if (chosen === "firecrawl-keyless")
|
|
224
240
|
return { resolves: "firecrawl-keyless", why: `keyless Firecrawl, ${picked}: ${FIRECRAWL_FETCH}` };
|
|
225
|
-
return
|
|
241
|
+
return autoWeb("web_fetch", input);
|
|
226
242
|
}
|
|
227
243
|
if (capability === "browser")
|
|
228
244
|
return browserBy(chosen, picked, input.browserKeys);
|
|
@@ -238,11 +254,30 @@ export function explainCapability(capability, input) {
|
|
|
238
254
|
return { resolves: `unavailable: no native search for ${without.id}`, why: `no native search for ${without.id}` };
|
|
239
255
|
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
256
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
257
|
+
return autoWeb("web_search", input);
|
|
258
|
+
}
|
|
259
|
+
/** The order `auto` asks for each web tool: the first provider here the server can run is what auto resolves to
|
|
260
|
+
* (Parallel only where the server holds its key; keyless Firecrawl, keyless Exa and the guarded direct fetch always),
|
|
261
|
+
* keyless Firecrawl where none can. Capabilities' `why` and every run's plane read it (autoWeb). Parallel is first for
|
|
262
|
+
* both. To put Firecrawl first, swap the two ids in a list: that one line is the whole change. */
|
|
263
|
+
export const DEFAULT_WEB_ORDER = Object.freeze({ web_search: Object.freeze(["parallel", "firecrawl-keyless"]), web_fetch: Object.freeze(["parallel", "firecrawl-keyless"]) });
|
|
264
|
+
/** What `auto` resolves `capability` to on a run of `input`, and why, by `order` (DEFAULT_WEB_ORDER). `auto` never
|
|
265
|
+
* resolves native, on any harness: where a native search would run, web_search's why names it as the pick it is;
|
|
266
|
+
* where none runs (noNative), it says why not. */
|
|
267
|
+
export function autoWeb(capability, input, order = DEFAULT_WEB_ORDER) {
|
|
268
|
+
const runs = (id) => id !== "parallel" || input.parallelKey;
|
|
269
|
+
const id = order[capability].find(runs) ?? "firecrawl-keyless";
|
|
270
|
+
const key = `your Parallel key (${input.parallelKeyFrom ?? "server"})`;
|
|
271
|
+
if (capability === "web_fetch") {
|
|
272
|
+
if (id === "parallel")
|
|
273
|
+
return { resolves: "parallel", why: `Parallel's extract on ${key}, the guarded direct fetch behind it` };
|
|
274
|
+
return id === DIRECT_FETCH ? { resolves: DIRECT_FETCH, why: "the guarded direct fetch" } : { resolves: "firecrawl-keyless", why: FIRECRAWL_FETCH };
|
|
275
|
+
}
|
|
276
|
+
const said = id === "parallel" ? key : id === "exa-keyless" ? "Exa's free search, no key" : FIRECRAWL_SEARCH;
|
|
277
|
+
const without = noNative(input);
|
|
278
|
+
if (without !== undefined)
|
|
279
|
+
return { resolves: id, why: `${without.why}; ${said}` };
|
|
280
|
+
return { resolves: id, why: id === "parallel" ? said : `${said}; ${ownSearch(input)} is an explicit pick` };
|
|
246
281
|
}
|
|
247
282
|
/** What `capability` resolves to on a run of `input`. */
|
|
248
283
|
export const resolveCapability = (capability, input) => explainCapability(capability, input).resolves;
|
|
@@ -274,6 +309,14 @@ function browserProviderIds() {
|
|
|
274
309
|
}
|
|
275
310
|
export const BROWSER_VENDOR_IDS = Object.freeze(browserProviderIds());
|
|
276
311
|
export const BROWSER_KEYS = Object.freeze(Object.fromEntries(BROWSER_VENDORS.map((vendor) => [vendor.id, vendor.keys])));
|
|
312
|
+
/** The browser vendor where nothing names one (a run kept before its plane was, a page's key row, the capabilities'
|
|
313
|
+
* browser): the registry's first hosted browser, the one `auto` tries first (Browserbase). */
|
|
314
|
+
export const DEFAULT_BROWSER_VENDOR = (() => {
|
|
315
|
+
const first = BROWSER_VENDORS[0];
|
|
316
|
+
if (!first)
|
|
317
|
+
throw new Error("the computer registry declares no hosted browser provider");
|
|
318
|
+
return first.id;
|
|
319
|
+
})();
|
|
277
320
|
const LABELS = Object.freeze(Object.fromEntries(BROWSER_VENDORS.map((vendor) => [vendor.id, vendor.label])));
|
|
278
321
|
const isVendor = (name) => typeof name === "string" && Object.hasOwn(BROWSER_KEYS, name);
|
|
279
322
|
const browserKeysOf = (env) => Object.fromEntries(BROWSER_VENDORS.map((vendor) => [vendor.id, vendor.keys.every((name) => Boolean(env[name]))]));
|
|
@@ -304,7 +347,9 @@ function browserBy(chosen, picked, keys = {}) {
|
|
|
304
347
|
/** The server's environment's part of every resolution: its gateway and Parallel's key, and where the key is from. */
|
|
305
348
|
const served = (env) => {
|
|
306
349
|
const parallelKey = PARALLEL_KEY_ENV in decisionKeysOf(env);
|
|
307
|
-
|
|
350
|
+
const jevWhy = jevWebWhy(env, "web_search");
|
|
351
|
+
const jevFetchWhy = jevWebWhy(env, "web_fetch");
|
|
352
|
+
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
353
|
};
|
|
309
354
|
/** Each pickable capability on each harness under the server's `settings` and an agent's `overrides`, on `model`
|
|
310
355
|
* (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 +396,37 @@ export function planeFor(env, tooling, settings, { capped = false, run = false }
|
|
|
351
396
|
// another harness, whose agent searches with its own tool, a learned workflow's call node (learned-workflow.ts).
|
|
352
397
|
if (plane.web_search === "native" && model)
|
|
353
398
|
plane.model = model;
|
|
354
|
-
return plane;
|
|
399
|
+
return withJevSwitch(plane, env);
|
|
400
|
+
}
|
|
401
|
+
/** `plane` with Jev's switch: `jev: "off"` where `keptOff` (the plane was made with it off) or where `env` has the switch
|
|
402
|
+
* on (AGENTRUN_WEB_JEV_OFF) and the plane has a web tool; else no `jev` field. */
|
|
403
|
+
function withJevSwitch(plane, env, keptOff = false) {
|
|
404
|
+
const { jev: _was, ...rest } = plane;
|
|
405
|
+
return keptOff || (webJevOff(env) && (rest.web_search !== undefined || rest.web_fetch !== undefined)) ? { ...rest, jev: "off" } : rest;
|
|
355
406
|
}
|
|
356
|
-
/** A run's kept Plane at a later launch: as it was, but Parallel, or the browser's vendor, where the server no longer
|
|
407
|
+
/** 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
408
|
* holds its key, which is unavailable, never another provider; and, given `now` (the Plane it would get today and each
|
|
358
409
|
* capability's permission today), a capability set to ask or deny, or kept denied, as it resolves today: a harness's
|
|
359
410
|
* own search cannot wait for a person, and a deny that was lifted is lifted. The browser keeps its vendor, whose
|
|
360
411
|
* sessions it has: only a deny it was kept with is lifted. */
|
|
361
412
|
export function recheckPlane(plane, env, now) {
|
|
362
413
|
const keyed = served(env).parallelKey;
|
|
363
|
-
|
|
414
|
+
const { jev: kept, ...resolved } = plane;
|
|
415
|
+
// Jev off is read when the run is created (planeFor) and is never lifted here: `env`'s switch (a runner's own) can add
|
|
416
|
+
// "off", never remove it.
|
|
417
|
+
return withJevSwitch(Object.fromEntries(Object.entries(resolved).map(([name, value]) => {
|
|
364
418
|
const fresh = name === "model" ? undefined : now?.fresh[name];
|
|
365
419
|
if (fresh !== undefined && (value === DENIED || (name !== "browser" && now.permission(name) !== "allow")))
|
|
366
420
|
return [name, fresh];
|
|
367
421
|
return [name, name === "browser" && isVendor(value) && !browserKeysOf(env)[value] ? noBrowserKey(value) : value === "parallel" && !keyed ? NO_PARALLEL_KEY : value];
|
|
368
|
-
}));
|
|
422
|
+
})), env, kept === "off");
|
|
369
423
|
}
|
|
370
424
|
/** 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
|
-
|
|
425
|
+
* the default vendor (DEFAULT_BROWSER_VENDOR, the one vendor there was then), never today's pick, which could check its
|
|
426
|
+
* sessions at another vendor. It keeps the vendor, never a refusal: the plane each launch hands over is checked again
|
|
427
|
+
* (recheckPlane), so that vendor's keys missing make it unavailable for that launch alone, and restored keys make the
|
|
428
|
+
* next one run. */
|
|
429
|
+
export const keptFromBefore = (plane) => (plane.browser === undefined ? plane : { ...plane, browser: DEFAULT_BROWSER_VENDOR });
|
|
375
430
|
/** A run's saved Plane as a launch reads it: a vendor's missing-key refusal an earlier server saved (noBrowserKey's exact
|
|
376
431
|
* words, Browserbase's or Kernel's) is that vendor again, which the launch checks again as usual (recheckPlane), so
|
|
377
432
|
* 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 +436,9 @@ export function keptVendor(plane) {
|
|
|
381
436
|
return vendor ? { ...plane, browser: vendor } : plane;
|
|
382
437
|
}
|
|
383
438
|
/** 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
|
|
439
|
+
* resolved to, else the one picked, else the default (DEFAULT_BROWSER_VENDOR), so a page links a missing key to the row
|
|
385
440
|
* it is saved on. */
|
|
386
|
-
export const browserKeyRow = (picked, resolution) => (isVendor(resolution) ? resolution : isVendor(picked) ? picked :
|
|
441
|
+
export const browserKeyRow = (picked, resolution) => (isVendor(resolution) ? resolution : isVendor(picked) ? picked : DEFAULT_BROWSER_VENDOR);
|
|
387
442
|
/** The Plane a run's process is handed at a launch, under the server's `settings` now: its kept Plane (as keptVendor
|
|
388
443
|
* reads it) checked again (recheckPlane) against the one it would get today; with none kept, today's, its browser kept
|
|
389
444
|
* (keptFromBefore). At a launch after its first (a relaunch, a follow-up's, one after a restart) a capability set
|
|
@@ -407,6 +462,16 @@ export function planeOf(env) {
|
|
|
407
462
|
}
|
|
408
463
|
/** Whether a run is handed Parallel's key: one of its capabilities resolves to Parallel. */
|
|
409
464
|
export const handsParallel = (plane) => PICKABLE.some((name) => plane[name] === "parallel");
|
|
465
|
+
/** The resolutions of each web tool its run's Web runs (web-run.ts SEARCH_CHAINS, FETCH_CHAINS), where Jev ranks a
|
|
466
|
+
* search's results. */
|
|
467
|
+
const WEB_RUNS = { web_search: ["parallel", "native", "firecrawl-keyless", "exa-keyless"], web_fetch: ["parallel", "firecrawl-keyless", DIRECT_FETCH] };
|
|
468
|
+
/** Whether a run on `harness` is handed TypeSafe's key for its web tools (decisions.ts DecisionNeeds.jevWeb): one of
|
|
469
|
+
* 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
|
|
470
|
+
* launch, planeFor) nor in `env` (AGENTRUN_WEB_JEV_OFF: a runner's own switch adds "off", never removes it).
|
|
471
|
+
* web_fetch always is where it runs; web_search is where it resolves to Parallel or a keyless provider, or to native
|
|
472
|
+
* where that is the model provider's hosted search (pi's), never a harness's own search inside its CLI (codex's,
|
|
473
|
+
* claude-agent's: its facts' webSearch), where no Jev call can happen. */
|
|
474
|
+
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
475
|
/** 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
476
|
* table, a catalog tool, an MCP server's wildcard) to `{provider?, permission?}`, a provider only for a capability that
|
|
412
477
|
* has a choice and one offered for it, a permission one offered for the tool. */
|
|
@@ -436,6 +501,12 @@ export function settingsIssues(value, at = "", layer = "server") {
|
|
|
436
501
|
return [{ field: field(name, key), reason: "not_allowed", message: `A scope is set on ${SCOPED_WORDS} in an agent's own tool settings (definition.tool_settings.email_read.scope), never ${layer === "agent" ? `on ${name}` : "in the server's"}.` }];
|
|
437
502
|
return EMAIL_SCOPES.includes(given) ? [] : [{ field: field(name, key), reason: "not_an_option", message: `${field(name, key)} is one of ${EMAIL_SCOPES.join(", ")}: thread, an email's run reads its thread alone; mailbox, the whole account` }];
|
|
438
503
|
}
|
|
504
|
+
// An MCP tool's file setting (filed-tool.ts): an agent's own, on the tool's own key only, set as bash's policy is.
|
|
505
|
+
if (key === "file") {
|
|
506
|
+
if (layer !== "agent" || !mcpNameOf(name))
|
|
507
|
+
return [{ field: field(name, key), reason: "not_allowed", message: `A file setting is set on an MCP tool's own key (mcp:<server>/<tool>) in an agent's own tool settings (definition.tool_settings), never ${layer === "agent" ? `on ${name}` : "in the server's"}.` }];
|
|
508
|
+
return fileIssues(given, field(name, key));
|
|
509
|
+
}
|
|
439
510
|
// The server's own mark of a pin in its file that does not read (withDefaults serves it), which a whole-map save
|
|
440
511
|
// sends back: it keeps the broken pin, and nothing else. Never an agent's.
|
|
441
512
|
if (key === "pin_broken") {
|
|
@@ -461,7 +532,7 @@ export function settingsIssues(value, at = "", layer = "server") {
|
|
|
461
532
|
});
|
|
462
533
|
});
|
|
463
534
|
}
|
|
464
|
-
/** `map` as a revision body keeps it: each tool's provider, permission, pin and
|
|
535
|
+
/** `map` as a revision body keeps it: each tool's provider, permission, pin, policy, scope and file setting as written (never a stand-in's internal
|
|
465
536
|
* marks), tools, fields and a pin's arguments sorted, and a tool with none of them gone. The one form, so two
|
|
466
537
|
* revisions whose settings say the same (a pin's arguments in another order) are the same text, and so one revision
|
|
467
538
|
* where its id is the body's digest (the store keeps the body as given: store/sqlite/store.ts). */
|
|
@@ -470,7 +541,7 @@ export function canonicalToolSettings(map) {
|
|
|
470
541
|
return sorted(Object.fromEntries(Object.entries(map).flatMap(([name, setting]) => {
|
|
471
542
|
if (!setting)
|
|
472
543
|
return [];
|
|
473
|
-
const kept = sorted({ ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.allow_reads === true ? { allow_reads: true } : {}), ...(setting.pin ? { pin: sortedPin(setting.pin) } : {}), ...(setting.policy ? { policy: setting.policy } : {}), ...(setting.scope ? { scope: setting.scope } : {}), ...(setting.provider ? { provider: setting.provider } : {}) });
|
|
544
|
+
const kept = sorted({ ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.allow_reads === true ? { allow_reads: true } : {}), ...(setting.pin ? { pin: sortedPin(setting.pin) } : {}), ...(setting.policy ? { policy: setting.policy } : {}), ...(setting.scope ? { scope: setting.scope } : {}), ...(setting.file ? { file: { folder: setting.file.folder, show: [...setting.file.show] } } : {}), ...(setting.provider ? { provider: setting.provider } : {}) });
|
|
474
545
|
return Object.keys(kept).length ? [[name, kept]] : [];
|
|
475
546
|
})));
|
|
476
547
|
}
|
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;
|