@parcha/agentrun-serve 0.1.0-beta.37 → 0.1.0-beta.39
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 +700 -0
- package/README.md +441 -177
- package/dist/adapters.d.ts +4 -1
- package/dist/adapters.js +4 -2
- package/dist/agent-rows.d.ts +1 -3
- package/dist/agents-store.d.ts +35 -3
- package/dist/agents-store.js +48 -23
- package/dist/answer-json.d.ts +34 -1
- package/dist/answer-json.js +91 -9
- package/dist/api-only.d.ts +1 -1
- package/dist/api-only.js +2 -2
- package/dist/bash-read-only.js +2 -1
- package/dist/browser-cost.js +52 -93
- package/dist/cap-short.d.ts +12 -0
- package/dist/cap-short.js +60 -0
- package/dist/cap.d.ts +3 -400
- package/dist/cap.js +6 -942
- package/dist/catalog.d.ts +0 -5
- package/dist/catalog.js +2 -6
- package/dist/chatgpt-plan.d.ts +163 -0
- package/dist/chatgpt-plan.js +549 -0
- package/dist/cli.js +26 -6
- package/dist/composio-preset.d.ts +25 -0
- package/dist/composio-preset.js +51 -8
- package/dist/composio-triggers.d.ts +113 -0
- package/dist/composio-triggers.js +411 -0
- package/dist/computer-calls.d.ts +36 -24
- package/dist/computer-calls.js +110 -27
- package/dist/computer-commands.d.ts +2 -0
- package/dist/computer-commands.js +7 -3
- package/dist/computer-live.d.ts +12 -2
- package/dist/computer-live.js +21 -5
- package/dist/computer-routes.d.ts +2 -2
- package/dist/computer-routes.js +2 -2
- package/dist/computer-setting.d.ts +15 -2
- package/dist/computer-setting.js +20 -4
- package/dist/computer-view.d.ts +18 -2
- package/dist/computer-view.js +21 -6
- package/dist/computer-viewer.js +40 -13
- package/dist/computers.d.ts +8 -2
- package/dist/computers.js +18 -8
- package/dist/console/assets/index-BNhZs-jp.css +1 -0
- package/dist/console/assets/index-BQv5aOGB.js +700 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +6 -3
- package/dist/decision-cap.d.ts +2 -5
- package/dist/decision-cap.js +3 -6
- package/dist/decision-rows.js +11 -11
- package/dist/decisions.js +4 -0
- package/dist/email/account.d.ts +84 -0
- package/dist/email/account.js +159 -0
- package/dist/email/answer.d.ts +10 -0
- package/dist/email/answer.js +182 -0
- package/dist/email/email-faux.d.ts +95 -0
- package/dist/email/email-faux.js +849 -0
- package/dist/email/labels.d.ts +1 -0
- package/dist/email/labels.js +84 -0
- package/dist/email/mail.d.ts +186 -0
- package/dist/email/mail.js +380 -0
- package/dist/email/names.d.ts +20 -0
- package/dist/email/names.js +40 -0
- package/dist/email/routes.d.ts +9 -0
- package/dist/email/routes.js +50 -0
- package/dist/email/tools.d.ts +20 -0
- package/dist/email/tools.js +517 -0
- package/dist/environment.d.ts +17 -2
- package/dist/environment.js +36 -8
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +12 -0
- package/dist/eval-mailbox.d.ts +103 -0
- package/dist/eval-mailbox.js +236 -0
- package/dist/faux-computers.js +4 -2
- package/dist/graph-view.d.ts +9 -2
- package/dist/graph-view.js +6 -2
- package/dist/harness-install.d.ts +28 -2
- package/dist/harness-install.js +147 -59
- package/dist/harness-opencode/adapter.js +2 -22
- package/dist/harness-opencode/facts.js +5 -4
- package/dist/harness-opencode/host/policy.d.ts +4 -5
- package/dist/harness-opencode/host/policy.js +14 -33
- package/dist/harness-opencode/index.d.ts +1 -1
- package/dist/harness-opencode/index.js +1 -1
- package/dist/harness-opencode/versions.d.ts +6 -0
- package/dist/harness-opencode/versions.js +6 -0
- package/dist/harness-table.d.ts +0 -2
- package/dist/harness-table.js +8 -7
- package/dist/harness.d.ts +12 -0
- package/dist/harness.js +15 -3
- package/dist/host-tools.d.ts +1 -5
- package/dist/host-tools.js +7 -10
- package/dist/hosted-search.d.ts +3 -3
- package/dist/hosted-search.js +51 -32
- package/dist/import-sources.d.ts +1 -1
- package/dist/import-sources.js +3 -3
- package/dist/import.d.ts +21 -0
- package/dist/import.js +186 -1
- package/dist/key-check.d.ts +0 -2
- package/dist/key-check.js +3 -4
- package/dist/key-refusal.d.ts +8 -2
- package/dist/key-refusal.js +16 -13
- package/dist/key-words.d.ts +3 -2
- package/dist/key-words.js +4 -2
- package/dist/learn/check.d.ts +24 -4
- package/dist/learn/check.js +340 -7
- package/dist/learn/commit.d.ts +10 -0
- package/dist/learn/commit.js +18 -4
- package/dist/learn/compile.d.ts +250 -0
- package/dist/learn/compile.js +507 -0
- package/dist/learn/general.d.ts +3 -0
- package/dist/learn/general.js +4 -2
- package/dist/learn/grade.d.ts +5 -1
- package/dist/learn/grade.js +11 -7
- package/dist/learn/notes.d.ts +8 -0
- package/dist/learn/notes.js +18 -0
- package/dist/learn/promote.d.ts +308 -0
- package/dist/learn/promote.js +321 -0
- package/dist/learn/refit.d.ts +48 -0
- package/dist/learn/refit.js +264 -0
- package/dist/learn/reflect.d.ts +5 -25
- package/dist/learn/reflect.js +14 -131
- package/dist/learn/replay-calls.d.ts +63 -0
- package/dist/learn/replay-calls.js +158 -0
- package/dist/learn/skills.d.ts +19 -16
- package/dist/learn/skills.js +157 -53
- package/dist/learn/workflow-nodes.d.ts +15 -0
- package/dist/learn/workflow-nodes.js +44 -0
- package/dist/learned-nodes.d.ts +58 -2
- package/dist/learned-nodes.js +68 -5
- package/dist/learned-workflow.d.ts +58 -32
- package/dist/learned-workflow.js +215 -77
- package/dist/learning-batch.d.ts +2 -2
- package/dist/learning-batch.js +4 -4
- package/dist/learning-cost.d.ts +41 -11
- package/dist/learning-cost.js +31 -13
- package/dist/learning-routes.d.ts +12 -2
- package/dist/learning-routes.js +34 -6
- package/dist/learning-words.d.ts +8 -1
- package/dist/learning-words.js +11 -1
- package/dist/learning.d.ts +26 -1
- package/dist/learning.js +7 -4
- package/dist/link-check.d.ts +27 -0
- package/dist/link-check.js +164 -0
- package/dist/llm.js +0 -3
- package/dist/local-models.d.ts +33 -2
- package/dist/local-models.js +43 -5
- package/dist/mcp-gateway.d.ts +12 -20
- package/dist/mcp-gateway.js +16 -44
- package/dist/mcp-oauth.d.ts +5 -0
- package/dist/mcp-oauth.js +1 -1
- package/dist/mcp-pin-first.d.ts +37 -0
- package/dist/mcp-pin-first.js +113 -0
- package/dist/mcp-probe.d.ts +8 -9
- package/dist/mcp-probe.js +16 -33
- package/dist/mcp-secret-writes.js +3 -0
- package/dist/mcp-servers-store.d.ts +102 -26
- package/dist/mcp-servers-store.js +151 -25
- package/dist/mcp-sources.d.ts +39 -0
- package/dist/mcp-sources.js +74 -0
- package/dist/mcp-store.d.ts +11 -0
- package/dist/mcp-store.js +16 -2
- package/dist/mcp-wire.d.ts +22 -0
- package/dist/mcp-wire.js +36 -0
- package/dist/mcp.js +3 -3
- package/dist/meta-tool-names.d.ts +1 -0
- package/dist/meta-tool-names.js +3 -0
- package/dist/model-form.d.ts +11 -0
- package/dist/model-form.js +17 -1
- package/dist/model.d.ts +39 -6
- package/dist/model.js +171 -32
- package/dist/monid.d.ts +50 -29
- package/dist/monid.js +234 -143
- package/dist/native/binding.d.ts +13 -0
- package/dist/native/binding.js +57 -0
- package/dist/native/cli.d.ts +2 -0
- package/dist/native/cli.js +48 -0
- package/dist/native/connection.d.ts +8 -0
- package/dist/native/connection.js +94 -0
- package/dist/native/context.d.ts +6 -0
- package/dist/native/context.js +22 -0
- package/dist/native/discovery.d.ts +27 -0
- package/dist/native/discovery.js +404 -0
- package/dist/native/environment.d.ts +4 -0
- package/dist/native/environment.js +18 -0
- package/dist/native/history.d.ts +20 -0
- package/dist/native/history.js +147 -0
- package/dist/native/instructions.d.ts +21 -0
- package/dist/native/instructions.js +173 -0
- package/dist/native/remote-worker-bridge.d.ts +3 -0
- package/dist/native/remote-worker-bridge.js +278 -0
- package/dist/native/remote.d.ts +187 -0
- package/dist/native/remote.js +492 -0
- package/dist/native/runtime.d.ts +17 -0
- package/dist/native/runtime.js +316 -0
- package/dist/native/runtimes.d.ts +66 -0
- package/dist/native/runtimes.js +41 -0
- package/dist/native/schema.d.ts +46 -0
- package/dist/native/schema.js +41 -0
- package/dist/native/types.d.ts +87 -0
- package/dist/native/types.js +1 -0
- package/dist/observation/http.d.ts +4 -0
- package/dist/observation/http.js +140 -0
- package/dist/observation/observer.d.ts +301 -0
- package/dist/observation/observer.js +919 -0
- package/dist/observation/schema.d.ts +52 -0
- package/dist/observation/schema.js +154 -0
- package/dist/openapi.d.ts +1 -0
- package/dist/openapi.js +705 -126
- package/dist/paid-calls.d.ts +34 -32
- package/dist/paid-calls.js +52 -104
- package/dist/place-offers.d.ts +4 -8
- package/dist/place-offers.js +4 -9
- package/dist/port-models.d.ts +7 -2
- package/dist/port-models.js +5 -2
- package/dist/print.d.ts +4 -2
- package/dist/print.js +4 -3
- package/dist/propose.d.ts +8 -3
- package/dist/propose.js +28 -7
- package/dist/provider.d.ts +5 -1
- package/dist/provider.js +17 -2
- package/dist/push-handler.d.ts +3 -2
- package/dist/push-handler.js +20 -6
- package/dist/reflect-range.js +2 -1
- package/dist/refusal-words.d.ts +11 -0
- package/dist/refusal-words.js +13 -2
- package/dist/rows.d.ts +5 -3
- package/dist/rows.js +15 -4
- package/dist/run-launch.d.ts +23 -1
- package/dist/run-launch.js +17 -4
- package/dist/run-learning-served.d.ts +84 -0
- package/dist/run-manifest.d.ts +8 -0
- package/dist/run-manifest.js +33 -1
- package/dist/run-reads-over-store.d.ts +3 -3
- package/dist/run-reads-over-store.js +13 -10
- package/dist/run-secrets.js +2 -3
- package/dist/run-timeline-served.d.ts +3 -2
- package/dist/run-timeline-served.js +12 -10
- package/dist/run-view.d.ts +59 -41
- package/dist/run-view.js +128 -64
- package/dist/runnable.d.ts +13 -8
- package/dist/runnable.js +77 -60
- package/dist/runner/adapter-loop.d.ts +60 -15
- package/dist/runner/adapter-loop.js +1406 -464
- package/dist/runner/adapter-run-spec.d.ts +45 -14
- package/dist/runner/adapter-run-spec.js +200 -116
- package/dist/runner/adapters/pi.d.ts +40 -7
- package/dist/runner/adapters/pi.js +149 -38
- package/dist/runner/beside.d.ts +3 -1
- package/dist/runner/beside.js +24 -8
- package/dist/runner/claim-secrets.d.ts +3 -1
- package/dist/runner/claim-secrets.js +28 -4
- package/dist/runner/cli-run-spec.d.ts +30 -0
- package/dist/runner/cli-run-spec.js +150 -66
- package/dist/runner/computer-channel.d.ts +5 -2
- package/dist/runner/computer-channel.js +5 -3
- package/dist/runner/computer-journal.d.ts +6 -0
- package/dist/runner/computer-journal.js +8 -10
- package/dist/runner/conformance/harness.d.ts +3 -0
- package/dist/runner/conformance/harness.js +149 -5
- package/dist/runner/conformance/subject.d.ts +11 -4
- package/dist/runner/end-of-run.d.ts +8 -5
- package/dist/runner/end-of-run.js +11 -6
- package/dist/runner/feedback-round.d.ts +79 -0
- package/dist/runner/feedback-round.js +127 -0
- package/dist/runner/harness-loops.js +17 -0
- package/dist/runner/journal-kinds.d.ts +55 -13
- package/dist/runner/journal-kinds.js +19 -0
- package/dist/runner/learning-dispatch.d.ts +3 -2
- package/dist/runner/learning-dispatch.js +6 -6
- package/dist/runner/learning-end.d.ts +58 -19
- package/dist/runner/learning-end.js +316 -115
- package/dist/runner/learning-factory.d.ts +3 -0
- package/dist/runner/learning-factory.js +8 -2
- package/dist/runner/learning-loop.d.ts +21 -1
- package/dist/runner/learning-loop.js +24 -6
- package/dist/runner/learning-seed.d.ts +4 -0
- package/dist/runner/learning-seed.js +14 -0
- package/dist/runner/loop-contract.d.ts +19 -3
- package/dist/runner/loop.d.ts +34 -1
- package/dist/runner/loop.js +55 -1
- package/dist/runner/main.d.ts +6 -1
- package/dist/runner/main.js +26 -4
- package/dist/runner/mcp-claim.d.ts +5 -1
- package/dist/runner/mcp-claim.js +66 -50
- package/dist/runner/mcp-run.d.ts +20 -53
- package/dist/runner/mcp-run.js +22 -88
- package/dist/runner/meta-tools.d.ts +44 -0
- package/dist/runner/meta-tools.js +344 -0
- package/dist/runner/metrics.d.ts +80 -21
- package/dist/runner/metrics.js +128 -42
- package/dist/runner/model-route.d.ts +12 -3
- package/dist/runner/model-route.js +149 -19
- package/dist/runner/monid-run.d.ts +18 -0
- package/dist/runner/monid-run.js +170 -0
- package/dist/runner/native-loop.d.ts +11 -0
- package/dist/runner/native-loop.js +438 -0
- package/dist/runner/promotion.d.ts +146 -0
- package/dist/runner/promotion.js +803 -0
- package/dist/runner/redact.js +3 -0
- package/dist/runner/reflect-hook.d.ts +36 -21
- package/dist/runner/reflect-hook.js +147 -49
- package/dist/runner/runner.d.ts +7 -1
- package/dist/runner/runner.js +34 -8
- package/dist/runner/sdk-loop.d.ts +7 -0
- package/dist/runner/sdk-loop.js +470 -0
- package/dist/runner/sessions.d.ts +8 -3
- package/dist/runner/sessions.js +5 -1
- package/dist/runner/spec-holds.d.ts +16 -2
- package/dist/runner/spec-holds.js +42 -14
- package/dist/runner/step-guard.d.ts +62 -0
- package/dist/runner/step-guard.js +93 -0
- package/dist/runner/store-secrets.js +17 -2
- package/dist/runner/subagent.d.ts +0 -3
- package/dist/runner/subagent.js +7 -12
- package/dist/runner/workflow-first.d.ts +226 -0
- package/dist/runner/workflow-first.js +293 -0
- package/dist/runner/workflow-loop.d.ts +1 -1
- package/dist/runner/workflow-loop.js +32 -19
- package/dist/runner/workflow-spec.d.ts +5 -1
- package/dist/runner/workflow-spec.js +63 -48
- package/dist/runs-over-store.d.ts +41 -4
- package/dist/runs-over-store.js +64 -22
- package/dist/sdk/runs.d.ts +115 -0
- package/dist/sdk/runs.js +422 -0
- package/dist/sdk/schema.d.ts +175 -0
- package/dist/sdk/schema.js +138 -0
- package/dist/sdk/workflows.d.ts +22 -0
- package/dist/sdk/workflows.js +39 -0
- package/dist/secrets.d.ts +2 -0
- package/dist/secrets.js +19 -1
- package/dist/server.d.ts +108 -20
- package/dist/server.js +874 -157
- package/dist/settings-wake.d.ts +8 -6
- package/dist/settings-wake.js +13 -7
- package/dist/skill-route.d.ts +3 -0
- package/dist/skill-route.js +16 -0
- package/dist/skills/agentrun-serve/SKILL.md +368 -0
- package/dist/stats.d.ts +10 -10
- package/dist/store/agent-body.d.ts +22 -7
- package/dist/store/agent-body.js +23 -14
- package/dist/store/command-wake.d.ts +3 -2
- package/dist/store/command-wake.js +4 -4
- package/dist/store/index.d.ts +1 -1
- package/dist/store/native-command-owner.d.ts +10 -0
- package/dist/store/native-command-owner.js +47 -0
- package/dist/store/postgres/connection.js +3 -1
- package/dist/store/postgres/migrations/0010_imported_templates.sql +18 -0
- package/dist/store/postgres/migrations/0011_revision_mcp_pin.sql +13 -0
- package/dist/store/postgres/migrations/0012_revision_monid_pin.sql +4 -0
- package/dist/store/postgres/migrations/0013_native_command_owner.sql +6 -0
- package/dist/store/postgres/migrations/0014_run_cost_upper_bound.sql +6 -0
- package/dist/store/postgres/store.js +3 -0
- package/dist/store/schema.d.ts +16 -0
- package/dist/store/schema.js +47 -8
- package/dist/store/sqlite/connection.d.ts +2 -2
- package/dist/store/sqlite/connection.js +2 -2
- package/dist/store/sqlite/run-patch.d.ts +8 -1
- package/dist/store/sqlite/run-patch.js +33 -10
- package/dist/store/sqlite/store.js +184 -28
- package/dist/store/store.d.ts +98 -21
- package/dist/store-reads/analytics.d.ts +7 -7
- package/dist/store-reads/analytics.js +23 -5
- package/dist/store-reads/cap.js +8 -6
- package/dist/store-reads/journal.d.ts +30 -1
- package/dist/store-reads/journal.js +141 -83
- package/dist/store-reads/learning.d.ts +179 -13
- package/dist/store-reads/learning.js +230 -68
- package/dist/store-reads/loop.d.ts +61 -0
- package/dist/store-reads/loop.js +111 -0
- package/dist/store-reads/runs.d.ts +5 -0
- package/dist/store-reads/runs.js +3 -2
- package/dist/store-view.d.ts +3 -2
- package/dist/store-view.js +109 -37
- package/dist/template-eval.d.ts +87 -16
- package/dist/template-eval.js +605 -120
- package/dist/template-github-permissions.d.ts +2 -2
- package/dist/template-github-permissions.js +2 -1
- package/dist/template-import.d.ts +31 -0
- package/dist/template-import.js +121 -0
- package/dist/template-source.d.ts +51 -0
- package/dist/template-source.js +371 -0
- package/dist/templates.d.ts +274 -52
- package/dist/templates.js +670 -201
- package/dist/text-urls.d.ts +38 -0
- package/dist/text-urls.js +170 -0
- package/dist/timeline/computer.d.ts +48 -0
- package/dist/timeline/computer.js +169 -0
- package/dist/timeline/index.d.ts +7 -5
- package/dist/timeline/index.js +7 -5
- package/dist/timeline/labels.d.ts +11 -4
- package/dist/timeline/labels.js +122 -8
- package/dist/timeline/origin.d.ts +20 -6
- package/dist/timeline/origin.js +13 -6
- package/dist/timeline/render-text.js +1 -1
- package/dist/timeline/timeline.d.ts +76 -20
- package/dist/timeline/timeline.js +184 -39
- package/dist/timeline/util.d.ts +5 -0
- package/dist/timeline/util.js +44 -8
- package/dist/timeline/web-calls.d.ts +17 -0
- package/dist/timeline/web-calls.js +106 -0
- package/dist/tool-gate.d.ts +103 -76
- package/dist/tool-gate.js +200 -127
- package/dist/tool-keys.d.ts +4 -1
- package/dist/tool-keys.js +8 -3
- package/dist/tool-list.d.ts +29 -0
- package/dist/tool-list.js +50 -0
- package/dist/tool-names.d.ts +76 -0
- package/dist/tool-names.js +101 -0
- package/dist/tool-plane.d.ts +34 -28
- package/dist/tool-plane.js +72 -37
- package/dist/tools.d.ts +59 -15
- package/dist/tools.js +46 -42
- package/dist/trigger-adapter.d.ts +85 -5
- package/dist/trigger-adapter.js +6 -0
- package/dist/trigger-adapters.js +3 -1
- package/dist/trigger-composio.d.ts +10 -0
- package/dist/trigger-composio.js +122 -0
- package/dist/trigger-email.d.ts +4 -0
- package/dist/trigger-email.js +228 -0
- package/dist/trigger-signatures.d.ts +6 -10
- package/dist/trigger-signatures.js +16 -16
- package/dist/trigger-targets.d.ts +1 -1
- package/dist/trigger-targets.js +4 -3
- package/dist/trigger-webhook.js +6 -4
- package/dist/triggers.d.ts +94 -9
- package/dist/triggers.js +263 -62
- package/dist/uploads.d.ts +9 -0
- package/dist/uploads.js +27 -0
- package/dist/validate.d.ts +15 -7
- package/dist/validate.js +91 -50
- package/dist/web-fake.d.ts +56 -0
- package/dist/web-fake.js +102 -0
- package/dist/web-fetch-direct.d.ts +3 -0
- package/dist/web-fetch-direct.js +4 -1
- package/dist/web-fetch.d.ts +6 -8
- package/dist/web-fetch.js +10 -53
- package/dist/web-search.d.ts +51 -2
- package/dist/web-search.js +116 -18
- package/dist/webhooks.d.ts +2 -1
- package/dist/webhooks.js +5 -1
- package/dist/workflow/node-runner.js +10 -2
- package/dist/workspace/archil-claim.d.ts +3 -0
- package/dist/workspace/archil-claim.js +9 -2
- package/dist/workspace/computer-deps.d.ts +25 -9
- package/dist/workspace/computer-deps.js +82 -38
- package/dist/workspace/computer-for-claim.d.ts +60 -4
- package/dist/workspace/computer-for-claim.js +203 -45
- package/dist/workspace/computer-hold.js +7 -1
- package/dist/workspace/computer-janitor.d.ts +10 -3
- package/dist/workspace/computer-janitor.js +96 -29
- package/dist/workspace/computer-kept.d.ts +82 -0
- package/dist/workspace/computer-kept.js +147 -0
- package/dist/workspace/computer-mcp.js +4 -3
- package/dist/workspace/computer-ports.d.ts +23 -3
- package/dist/workspace/computer-ports.js +115 -5
- package/dist/workspace/index.d.ts +2 -3
- package/dist/workspace/index.js +1 -2
- package/dist/workspace/kind-skills/desktop/SKILL.md +31 -11
- package/dist/workspace/kind-skills/phone/SKILL.md +29 -14
- package/dist/workspace/local.js +2 -2
- package/dist/workspace/resolve-computer.d.ts +33 -1
- package/dist/workspace/resolve-computer.js +37 -16
- package/dist/workspace/revision-skills.d.ts +6 -2
- package/dist/workspace/revision-skills.js +12 -5
- package/dist/workspace/run-end-computers.d.ts +30 -0
- package/dist/workspace/run-end-computers.js +137 -0
- package/dist/workspace/run-tools.d.ts +40 -23
- package/dist/workspace/run-tools.js +46 -19
- package/dist/wrap-up.d.ts +35 -0
- package/dist/wrap-up.js +48 -0
- package/launcher/agentrun-serve +4 -2
- package/package.json +13 -9
- package/skills/agentrun-serve/SKILL.md +248 -10
- package/templates/README.md +220 -60
- package/templates/TOOLS.md +168 -0
- package/templates/code-review/agent.md +46 -16
- package/templates/code-review/evals/clean-refactor/case.yaml +2 -1
- package/templates/code-review/evals/clean-refactor/graders/head-sha.md +6 -0
- package/templates/code-review/evals/injection/case.yaml +2 -1
- package/templates/code-review/evals/injection/graders/head-sha.md +6 -0
- package/templates/code-review/evals/mentions-defused/case.yaml +3 -3
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -23
- package/templates/code-review/evals/mentions-defused/graders/head-sha.md +6 -0
- package/templates/code-review/evals/never-flag/case.yaml +2 -1
- package/templates/code-review/evals/never-flag/graders/head-sha.md +6 -0
- package/templates/code-review/evals/null-name/case.yaml +2 -1
- package/templates/code-review/evals/null-name/graders/head-sha.md +6 -0
- package/templates/code-review/evals/off-by-one/case.yaml +2 -1
- package/templates/code-review/evals/off-by-one/graders/head-sha.md +6 -0
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +2 -1
- package/templates/code-review/evals/other-repo/case.yaml +16 -0
- package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +130 -0
- package/templates/code-review/evals/other-repo/graders/head-sha.md +6 -0
- package/templates/code-review/evals/other-repo/graders/no-canary.md +6 -0
- package/templates/code-review/evals/other-repo/graders/no-other-repo.md +8 -0
- package/templates/code-review/evals/other-repo/graders/refused-not-quoted.md +18 -0
- package/templates/code-review/evals/other-repo/prompt.md +10 -0
- package/templates/code-review/evals/pasted-by-reference/case.yaml +5 -0
- package/templates/code-review/evals/pasted-by-reference/graders/by-reference.md +15 -0
- package/templates/code-review/evals/pasted-by-reference/graders/head-sha.md +6 -0
- package/templates/code-review/evals/pasted-by-reference/prompt.md +31 -0
- package/templates/code-review/evals/re-review/case.yaml +2 -1
- package/templates/code-review/evals/re-review/graders/head-sha.md +6 -0
- package/templates/code-review/evals/re-review-open/case.yaml +2 -1
- package/templates/code-review/evals/re-review-open/graders/head-sha.md +6 -0
- package/templates/code-review/evals/repo-rule/case.yaml +2 -1
- package/templates/code-review/evals/repo-rule/graders/head-sha.md +6 -0
- package/templates/code-review/evals/two-defects/case.yaml +2 -1
- package/templates/code-review/evals/two-defects/graders/head-sha.md +6 -0
- package/templates/code-review/rules/CODEREVIEW.md +1 -1
- package/templates/code-review/skills/review/DEEP.md +5 -4
- package/templates/code-review/skills/review/REVIEWER.md +5 -4
- package/templates/code-review/skills/review/SKILL.md +11 -6
- package/templates/code-review/{findings.schema.json → skills/review/findings.schema.json} +1 -0
- package/templates/inbound-lead/agent.md +26 -16
- package/templates/inbound-lead/evals/injection-in-form/graders/no-exfil.md +16 -0
- package/templates/inbound-lead/evals/injection-in-form/prompt.md +2 -2
- package/templates/inbound-lead/evals/write-back/case.yaml +2 -6
- package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +34 -225
- package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +10 -14
- package/templates/inbound-lead/evals/write-back/graders/writes-once.md +7 -0
- package/templates/inbound-lead/evals/write-back/prompt.md +1 -1
- package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +3 -7
- package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +34 -225
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/form-id.md +17 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +3 -3
- package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +2 -2
- package/templates/inbound-lead/skills/lead/SKILL.md +23 -27
- package/templates/kyb/agent.md +15 -5
- package/templates/kyb/evals/adverse-media/prompt.md +2 -7
- package/templates/kyb/evals/canada-active-filed/prompt.md +2 -6
- package/templates/kyb/evals/clean-public-company/prompt.md +2 -6
- package/templates/kyb/evals/injection-in-page/prompt.md +3 -7
- package/templates/kyb/evals/name-collision/prompt.md +2 -6
- package/templates/kyb/evals/no-invention/prompt.md +2 -6
- package/templates/kyb/evals/opensanctions-on/prompt.md +2 -6
- package/templates/kyb/evals/sanctioned-entity/prompt.md +2 -6
- package/templates/kyb/kyb.schema.json +8 -7
- package/templates/kyb/skills/kyb/SKILL.md +9 -6
- package/templates/market-monitor/agent.md +19 -12
- package/templates/market-monitor/evals/post-happens/case.yaml +4 -4
- package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +13 -9
- package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +1 -1
- package/templates/market-monitor/evals/post-happens/graders/posted-once.md +3 -3
- package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
- package/templates/release-notes/agent.md +32 -10
- package/templates/release-notes/evals/draft-not-publish/case.yaml +5 -4
- package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/every-pr-accounted/case.yaml +2 -1
- package/templates/release-notes/evals/issue-write-refused/case.yaml +5 -4
- package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/late-arrival/case.yaml +6 -5
- package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/learned-style/case.yaml +2 -1
- package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +2 -1
- package/templates/release-notes/evals/other-repo/case.yaml +24 -0
- package/templates/release-notes/evals/other-repo/fixtures/github-mcp.json +907 -0
- package/templates/release-notes/evals/other-repo/graders/no-canary.md +7 -0
- package/templates/release-notes/evals/other-repo/graders/no-other-repo.md +8 -0
- package/templates/release-notes/evals/other-repo/graders/refused-not-quoted.md +18 -0
- package/templates/release-notes/evals/other-repo/prompt.md +32 -0
- package/templates/release-notes/evals/upgrade-line/case.yaml +2 -1
- package/templates/release-notes/evals/user-facing-only/case.yaml +2 -1
- package/templates/release-notes/notes.schema.json +1 -1
- package/templates/release-notes/skills/release-notes/SKILL.md +26 -17
- package/dist/console/assets/index-Cn6JX1uH.js +0 -563
- package/dist/console/assets/index-DRN62V5v.css +0 -1
- package/dist/host-calls.d.ts +0 -20
- package/dist/host-calls.js +0 -12
- package/dist/runner/adapters/pi-computer.d.ts +0 -7
- package/dist/runner/adapters/pi-computer.js +0 -43
- package/dist/tool-blurbs.d.ts +0 -4
- package/dist/tool-blurbs.js +0 -28
- package/dist/tool-budget.d.ts +0 -38
- package/dist/tool-budget.js +0 -62
- package/dist/workspace/computer-script.d.ts +0 -37
- package/dist/workspace/computer-script.js +0 -138
- package/templates/code-review/evals/clean-refactor/graders/schema.md +0 -5
- package/templates/code-review/evals/injection/graders/schema.md +0 -5
- package/templates/code-review/evals/mentions-defused/graders/schema.md +0 -5
- package/templates/code-review/evals/never-flag/graders/schema.md +0 -5
- package/templates/code-review/evals/null-name/graders/schema.md +0 -5
- package/templates/code-review/evals/off-by-one/graders/schema.md +0 -5
- package/templates/code-review/evals/re-review/graders/schema.md +0 -5
- package/templates/code-review/evals/re-review-open/graders/schema.md +0 -5
- package/templates/code-review/evals/repo-rule/graders/schema.md +0 -5
- package/templates/code-review/evals/two-defects/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/learned-correction/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/strong-fit/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/thin-data/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/write-back/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +0 -7
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +0 -18
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +0 -5
- package/templates/kyb/evals/adverse-media/graders/schema.md +0 -5
- package/templates/kyb/evals/canada-active-filed/graders/schema.md +0 -5
- package/templates/kyb/evals/clean-public-company/graders/schema.md +0 -5
- package/templates/kyb/evals/injection-in-page/graders/schema.md +0 -5
- package/templates/kyb/evals/name-collision/graders/schema.md +0 -5
- package/templates/kyb/evals/no-invention/graders/schema.md +0 -5
- package/templates/kyb/evals/opensanctions-on/graders/schema.md +0 -5
- package/templates/kyb/evals/sanctioned-entity/graders/schema.md +0 -5
- package/templates/market-monitor/evals/blocked-source/graders/schema.md +0 -5
- package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +0 -5
- package/templates/market-monitor/evals/learned-preference/graders/schema.md +0 -5
- package/templates/market-monitor/evals/no-repeats/graders/schema.md +0 -5
- package/templates/market-monitor/evals/nothing-changed/graders/schema.md +0 -5
- package/templates/market-monitor/evals/post-happens/graders/schema.md +0 -5
- package/templates/market-monitor/evals/pricing-change/graders/schema.md +0 -5
- package/templates/market-monitor/evals/pricing-moved/graders/schema.md +0 -5
- package/templates/release-notes/evals/draft-not-publish/graders/schema.md +0 -5
- package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +0 -5
- package/templates/release-notes/evals/issue-write-refused/graders/schema.md +0 -5
- package/templates/release-notes/evals/late-arrival/graders/schema.md +0 -5
- package/templates/release-notes/evals/learned-style/graders/schema.md +0 -5
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +0 -5
- package/templates/release-notes/evals/upgrade-line/graders/schema.md +0 -5
- package/templates/release-notes/evals/user-facing-only/graders/schema.md +0 -5
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export const TOOL_LIST = Object.freeze({
|
|
2
|
+
read: { table: true, askable: true, replay: "safe", blurb: "Read files in the run's folder" },
|
|
3
|
+
write: { table: true, askable: true, replay: "never", blurb: "Write files in the run's folder" },
|
|
4
|
+
edit: { table: true, askable: true, replay: "never", blurb: "Edit files in the run's folder" },
|
|
5
|
+
bash: { table: true, askable: true, replay: "never", blurb: "Run shell commands in the sandbox" },
|
|
6
|
+
ask_person: { table: true, replay: "safe", blurb: "Ask you a question mid-run" },
|
|
7
|
+
web_fetch: { table: true, askable: true, replay: "safe", host: true, blurb: "Read a public web page" },
|
|
8
|
+
web_search: { table: true, askable: true, replay: "safe", host: true, blurb: "Search the web" },
|
|
9
|
+
email_search: { table: true, askable: true, replay: "safe", host: true, blurb: "Search the email account's mail" },
|
|
10
|
+
email_read: { table: true, askable: true, replay: "safe", host: true, blurb: "Read an email or its thread" },
|
|
11
|
+
email_draft: { table: true, askable: true, replay: "never", host: true, blurb: "Save an email draft" },
|
|
12
|
+
email_send: { table: true, askable: true, replay: "never", host: true, asks: true, blurb: "Send an email" },
|
|
13
|
+
email_file: { table: true, askable: true, replay: "never", host: true, blurb: "File an email under a folder or label" },
|
|
14
|
+
browser: { table: true, blurb: "Browse websites in a hosted browser" },
|
|
15
|
+
subagent: { table: true, blurb: "Run a task in a fresh helper conversation" },
|
|
16
|
+
pdf_pages: { table: true, blurb: "Turn a PDF's pages into images" },
|
|
17
|
+
llm: { table: true, blurb: "Ask the model once, with no tools" },
|
|
18
|
+
bash_background: { replay: "never", blurb: "Start a long-running command in the sandbox" },
|
|
19
|
+
bash_output: { replay: "safe", blurb: "Read a background command's output" },
|
|
20
|
+
bash_input: { replay: "never", blurb: "Send input to a background command" },
|
|
21
|
+
bash_signal: { replay: "never", blurb: "Stop a background command" },
|
|
22
|
+
bash_list: { replay: "safe", blurb: "List the background commands" },
|
|
23
|
+
learned_workflow: { askable: true, replay: "never", blurb: "Run a workflow this agent learned" },
|
|
24
|
+
// The host tools over a run's own tools (runner/meta-tools.ts): no table entry and never granted, a settings key each.
|
|
25
|
+
tools_search: { blurb: "Find a tool by what it does, in a long list" },
|
|
26
|
+
tools_call: { blurb: "Call a tool the run does not list" },
|
|
27
|
+
codemode: { blurb: "Run a script that calls the run's tools" },
|
|
28
|
+
});
|
|
29
|
+
const rowOf = (name) => (Object.hasOwn(TOOL_LIST, name) ? TOOL_LIST[name] : undefined);
|
|
30
|
+
const namesWith = (field) => Object.keys(TOOL_LIST).filter((name) => TOOL_LIST[name][field] !== undefined);
|
|
31
|
+
/** Every tool of serve's table (tools.ts), by name: a test holds this and the table as one. */
|
|
32
|
+
export const tableTools = () => namesWith("table");
|
|
33
|
+
/** Whether `name` has a row: a built-in this server registers (table tool, background tool, learned workflow). */
|
|
34
|
+
export const isToolRow = (name) => rowOf(name) !== undefined;
|
|
35
|
+
/** Whether `name` is a tool of the table. */
|
|
36
|
+
export const isTableTool = (name) => rowOf(name)?.table === true;
|
|
37
|
+
/** Whether ask is offered for `name`: the kernel runs its approved call itself. */
|
|
38
|
+
export const isAskable = (name) => rowOf(name)?.askable === true;
|
|
39
|
+
/** Whether a host runs `name` on a harness other than pi: it has a replay class. */
|
|
40
|
+
export const isHostTool = (name) => rowOf(name)?.replay !== undefined;
|
|
41
|
+
/** `name`'s replay class as a host runs it, or none. */
|
|
42
|
+
export const replayOf = (name) => rowOf(name)?.replay;
|
|
43
|
+
/** The tools a host runs on a harness other than pi, by name. */
|
|
44
|
+
export const hostToolNames = () => namesWith("replay");
|
|
45
|
+
/** Whether `name` is a tool every harness binds as a host tool (web_fetch, web_search, the email tools). */
|
|
46
|
+
export const isWebHostTool = (name) => rowOf(name)?.host === true;
|
|
47
|
+
/** Whether `name`'s default permission is ask (email_send). */
|
|
48
|
+
export const asksByDefault = (name) => rowOf(name)?.asks === true;
|
|
49
|
+
/** `name`'s blurb, or none (an MCP server's tool, a name this server does not register). */
|
|
50
|
+
export const blurbOf = (name) => rowOf(name)?.blurb;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** A wire name: at most 52 characters, not the adapter's 64. One CLI gives the model the name with a 12-character
|
|
2
|
+
* `mcp__hands__` prefix, and the model API's 64-character limit is on the name the model sees, so 52 is the budget that
|
|
3
|
+
* holds on every harness. The identity branch reads it: a plain 53-64 character name of valid characters must not skip
|
|
4
|
+
* the mapping and come out over budget. An MCP tool whose `mcp__<server>__<tool>` is past it (Composio's 58-character
|
|
5
|
+
* `mcp__slack__SLACK_FETCH_MESSAGE_THREAD_FROM_A_CONVERSATION`) is granted and called by its hashed name. */
|
|
6
|
+
export declare const WIRE_NAME: RegExp;
|
|
7
|
+
/** An MCP server's name. */
|
|
8
|
+
export declare const MCP_SERVER_NAME: RegExp;
|
|
9
|
+
/** An MCP tool's own name, as its server lists it. */
|
|
10
|
+
export declare const MCP_TOOL_NAME: RegExp;
|
|
11
|
+
/** A catalog tool's name, as a JSON Schema pattern (openapi.ts): `mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`,
|
|
12
|
+
* or either's wildcard. */
|
|
13
|
+
export declare const CATALOG_KEY_PATTERN = "^(?:mcp:[a-z][a-z0-9-]{0,31}/(?:\\*|[A-Za-z0-9_-]{1,64})|monid:[a-z0-9][a-z0-9.-]{0,63}/(?:\\*|[A-Za-z0-9_.:{}-][A-Za-z0-9_.:{}/-]{0,199}))$";
|
|
14
|
+
/** One MCP tool's catalog key, without a server wildcard: the same server/tool grammar as mcpNameOf. */
|
|
15
|
+
export declare const MCP_TOOL_KEY_PATTERN = "^mcp:[a-z][a-z0-9-]{0,31}/[A-Za-z0-9_-]{1,64}$";
|
|
16
|
+
/** A catalog name, read: a plain tool's, one MCP tool's or one monid endpoint's, or a group's wildcard (an MCP server's
|
|
17
|
+
* tools, a monid provider's endpoints). */
|
|
18
|
+
export type ToolName = {
|
|
19
|
+
kind: "plain";
|
|
20
|
+
name: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "mcp";
|
|
23
|
+
server: string;
|
|
24
|
+
tool: string;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "mcp-server";
|
|
27
|
+
server: string;
|
|
28
|
+
} | {
|
|
29
|
+
kind: "monid";
|
|
30
|
+
provider: string;
|
|
31
|
+
endpoint: string;
|
|
32
|
+
} | {
|
|
33
|
+
kind: "monid-provider";
|
|
34
|
+
provider: string;
|
|
35
|
+
};
|
|
36
|
+
/** Catalog name `name` read, or undefined for one outside the grammar. */
|
|
37
|
+
export declare function parseToolName(name: string): ToolName | undefined;
|
|
38
|
+
/** The catalog name of `name`: parseToolName's inverse. */
|
|
39
|
+
export declare function formatToolName(name: ToolName): string;
|
|
40
|
+
/** Whether `name` is in monid's namespace (`monid:`), well formed or not, as isMcpName is for MCP's. */
|
|
41
|
+
export declare const isMonidName: (name: string) => boolean;
|
|
42
|
+
/** Whether `name` is a third-party catalog's (MCP's or monid's), well formed or not: its default is ask. */
|
|
43
|
+
export declare const isCatalogName: (name: string) => boolean;
|
|
44
|
+
/** Why `name`, in monid's namespace, is refused as a grant by its name alone. */
|
|
45
|
+
export declare const MONID_NAME_WORDS: (name: string) => string;
|
|
46
|
+
/** One monid endpoint's catalog name read (`monid:<provider>/<endpoint>`), or undefined for any other name. */
|
|
47
|
+
export declare function monidNameOf(name: string): {
|
|
48
|
+
provider: string;
|
|
49
|
+
endpoint: string;
|
|
50
|
+
} | undefined;
|
|
51
|
+
/** One MCP tool's catalog name, `mcp:<server>/<tool>`: what the gate, the pin and the timeline key its calls by. */
|
|
52
|
+
export declare const mcpToolName: (server: string, tool: string) => string;
|
|
53
|
+
/** Whether `name` is in MCP's namespace (`mcp:`), well formed or not: a name MCP's checks answer for, so one that does
|
|
54
|
+
* not parse is refused in MCP's words, and the gate's default for it is MCP's (ask), never a built-in's. */
|
|
55
|
+
export declare const isMcpName: (name: string) => boolean;
|
|
56
|
+
/** One MCP tool's catalog name read (`mcp:<server>/<tool>`), or undefined for any other name, a server's wildcard too. */
|
|
57
|
+
export declare function mcpNameOf(name: string): {
|
|
58
|
+
server: string;
|
|
59
|
+
tool: string;
|
|
60
|
+
} | undefined;
|
|
61
|
+
/** The MCP server `name` names, one of its tools or its wildcard; undefined for any other name. */
|
|
62
|
+
export declare function mcpServerOf(name: string): string | undefined;
|
|
63
|
+
/** Why a grant of an MCP server's tool is refused by its name alone, said after the grant (`mcp:<server>/<tool> ...`): the
|
|
64
|
+
* one place the console's picker and the save's blockers (runnable.ts) both read it. `hands` is the harnesses' own tools'
|
|
65
|
+
* server. */
|
|
66
|
+
export declare const MCP_HANDS_WORDS = "names the MCP server hands, a name the harnesses keep for their own tools: save the server under another name.";
|
|
67
|
+
/** MCP_HANDS_WORDS when the grant names the server `hands`; undefined otherwise. A name's length refuses nothing: one whose
|
|
68
|
+
* `mcp__<server>__<tool>` is past the budget every harness's names share is called by its hashed wire name (catalog.ts
|
|
69
|
+
* wireName), and read back by lookup. */
|
|
70
|
+
export declare const mcpGrantNameProblem: (server: string, _tool: string) => string | undefined;
|
|
71
|
+
/** Why two granted catalog tools can't both be granted: the harnesses call both by one wire name (`wire`, catalog.ts
|
|
72
|
+
* wireName), so neither could be told apart. Said after the later grant. */
|
|
73
|
+
export declare const sameWireWords: (tool: string, other: string, wire: string) => string;
|
|
74
|
+
/** Why `harness` drops or retypes the input of the catalog tool `tool` (its facts' schemaProblems, `dropped` the first,
|
|
75
|
+
* said under the tool's wire name): the words a save's blocker and a saved MCP server's read both say. */
|
|
76
|
+
export declare const droppedWords: (tool: string, harness: string, dropped: string) => string;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// A tool's catalog name, read and written in one place: the grammar every place that takes one holds it to (an agent's
|
|
2
|
+
// grant, the tool settings, a learned workflow, a template's manifest and evals, the API's schemas). A catalog name is
|
|
3
|
+
// <tool> a tool of this server (`read`, `web_fetch`, `decisions.jev`)
|
|
4
|
+
// <source>:<group>/<action> one tool of a source: `mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`
|
|
5
|
+
// <source>:<group>/* every tool of a group (a settings key, and a grant read against its listing)
|
|
6
|
+
// An MCP server's name is lowercase letters, digits and `-`, starting with a letter, at most 32 (no `_`, so
|
|
7
|
+
// `mcp__<server>__<tool>` splits one way). An MCP tool's own name is letters, digits, `_` and `-`, at most 64: the
|
|
8
|
+
// characters the model APIs take in a tool's name, so there is one charset, and a name one place takes no other refuses.
|
|
9
|
+
// A monid provider's slug and an endpoint's path are monid's own (its listing, GET /v1/endpoints): a slug is lowercase
|
|
10
|
+
// letters, digits, `.` and `-` (`apollo`, `api.strale.io`); an endpoint is its path less the leading `/`, in letters,
|
|
11
|
+
// digits and `-._:{}/` (`people/match`, `people/{id}`). Its wire name is catalog.ts wireName's, hashed when long.
|
|
12
|
+
// It imports nothing (its test holds it to that): the console bundles it from source, as `@agentrun/tool-names`.
|
|
13
|
+
/** A wire name: at most 52 characters, not the adapter's 64. One CLI gives the model the name with a 12-character
|
|
14
|
+
* `mcp__hands__` prefix, and the model API's 64-character limit is on the name the model sees, so 52 is the budget that
|
|
15
|
+
* holds on every harness. The identity branch reads it: a plain 53-64 character name of valid characters must not skip
|
|
16
|
+
* the mapping and come out over budget. An MCP tool whose `mcp__<server>__<tool>` is past it (Composio's 58-character
|
|
17
|
+
* `mcp__slack__SLACK_FETCH_MESSAGE_THREAD_FROM_A_CONVERSATION`) is granted and called by its hashed name. */
|
|
18
|
+
export const WIRE_NAME = /^[A-Za-z0-9_-]{1,52}$/;
|
|
19
|
+
const SERVER = "[a-z][a-z0-9-]{0,31}";
|
|
20
|
+
const TOOL = "[A-Za-z0-9_-]{1,64}";
|
|
21
|
+
const PROVIDER = "[a-z0-9][a-z0-9.-]{0,63}";
|
|
22
|
+
const ENDPOINT = "[A-Za-z0-9_.:{}-][A-Za-z0-9_.:{}/-]{0,199}";
|
|
23
|
+
const PLAIN = `[a-z][a-z0-9_-]{0,63}(?:\\.${TOOL})?`;
|
|
24
|
+
const MCP_PREFIX = "mcp:";
|
|
25
|
+
const MONID_PREFIX = "monid:";
|
|
26
|
+
const ALL = "*";
|
|
27
|
+
/** An MCP server's name. */
|
|
28
|
+
export const MCP_SERVER_NAME = new RegExp(`^${SERVER}$`);
|
|
29
|
+
/** An MCP tool's own name, as its server lists it. */
|
|
30
|
+
export const MCP_TOOL_NAME = new RegExp(`^${TOOL}$`);
|
|
31
|
+
/** A catalog tool's name, as a JSON Schema pattern (openapi.ts): `mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`,
|
|
32
|
+
* or either's wildcard. */
|
|
33
|
+
export const CATALOG_KEY_PATTERN = `^(?:mcp:${SERVER}/(?:\\*|${TOOL})|monid:${PROVIDER}/(?:\\*|${ENDPOINT}))$`;
|
|
34
|
+
/** One MCP tool's catalog key, without a server wildcard: the same server/tool grammar as mcpNameOf. */
|
|
35
|
+
export const MCP_TOOL_KEY_PATTERN = `^mcp:${SERVER}/${TOOL}$`;
|
|
36
|
+
const MCP_NAME = new RegExp(`^mcp:(${SERVER})/(\\*|${TOOL})$`);
|
|
37
|
+
const MONID_NAME = new RegExp(`^monid:(${PROVIDER})/(\\*|${ENDPOINT})$`);
|
|
38
|
+
const PLAIN_NAME = new RegExp(`^${PLAIN}$`);
|
|
39
|
+
/** Catalog name `name` read, or undefined for one outside the grammar. */
|
|
40
|
+
export function parseToolName(name) {
|
|
41
|
+
if (isMonidName(name)) {
|
|
42
|
+
const match = MONID_NAME.exec(name);
|
|
43
|
+
if (!match)
|
|
44
|
+
return undefined;
|
|
45
|
+
return match[2] === ALL ? { kind: "monid-provider", provider: match[1] } : { kind: "monid", provider: match[1], endpoint: match[2] };
|
|
46
|
+
}
|
|
47
|
+
if (!isMcpName(name))
|
|
48
|
+
return PLAIN_NAME.test(name) ? { kind: "plain", name } : undefined;
|
|
49
|
+
const match = MCP_NAME.exec(name);
|
|
50
|
+
if (!match)
|
|
51
|
+
return undefined;
|
|
52
|
+
return match[2] === ALL ? { kind: "mcp-server", server: match[1] } : { kind: "mcp", server: match[1], tool: match[2] };
|
|
53
|
+
}
|
|
54
|
+
/** The catalog name of `name`: parseToolName's inverse. */
|
|
55
|
+
export function formatToolName(name) {
|
|
56
|
+
if (name.kind === "plain")
|
|
57
|
+
return name.name;
|
|
58
|
+
if (name.kind === "monid" || name.kind === "monid-provider")
|
|
59
|
+
return `${MONID_PREFIX}${name.provider}/${name.kind === "monid" ? name.endpoint : ALL}`;
|
|
60
|
+
return `${MCP_PREFIX}${name.server}/${name.kind === "mcp" ? name.tool : ALL}`;
|
|
61
|
+
}
|
|
62
|
+
/** Whether `name` is in monid's namespace (`monid:`), well formed or not, as isMcpName is for MCP's. */
|
|
63
|
+
export const isMonidName = (name) => name.startsWith(MONID_PREFIX);
|
|
64
|
+
/** Whether `name` is a third-party catalog's (MCP's or monid's), well formed or not: its default is ask. */
|
|
65
|
+
export const isCatalogName = (name) => isMcpName(name) || isMonidName(name);
|
|
66
|
+
/** Why `name`, in monid's namespace, is refused as a grant by its name alone. */
|
|
67
|
+
export const MONID_NAME_WORDS = (name) => `${name} is not a monid endpoint's name: monid:<provider>/<endpoint> or monid:<provider>/*, the provider's slug (lowercase letters, digits, . and -) and the endpoint's path without its first / (letters, digits and -._:{}/), as monid lists them.`;
|
|
68
|
+
/** One monid endpoint's catalog name read (`monid:<provider>/<endpoint>`), or undefined for any other name. */
|
|
69
|
+
export function monidNameOf(name) {
|
|
70
|
+
const parsed = parseToolName(name);
|
|
71
|
+
return parsed?.kind === "monid" ? { provider: parsed.provider, endpoint: parsed.endpoint } : undefined;
|
|
72
|
+
}
|
|
73
|
+
/** One MCP tool's catalog name, `mcp:<server>/<tool>`: what the gate, the pin and the timeline key its calls by. */
|
|
74
|
+
export const mcpToolName = (server, tool) => formatToolName({ kind: "mcp", server, tool });
|
|
75
|
+
/** Whether `name` is in MCP's namespace (`mcp:`), well formed or not: a name MCP's checks answer for, so one that does
|
|
76
|
+
* not parse is refused in MCP's words, and the gate's default for it is MCP's (ask), never a built-in's. */
|
|
77
|
+
export const isMcpName = (name) => name.startsWith(MCP_PREFIX);
|
|
78
|
+
/** One MCP tool's catalog name read (`mcp:<server>/<tool>`), or undefined for any other name, a server's wildcard too. */
|
|
79
|
+
export function mcpNameOf(name) {
|
|
80
|
+
const parsed = parseToolName(name);
|
|
81
|
+
return parsed?.kind === "mcp" ? { server: parsed.server, tool: parsed.tool } : undefined;
|
|
82
|
+
}
|
|
83
|
+
/** The MCP server `name` names, one of its tools or its wildcard; undefined for any other name. */
|
|
84
|
+
export function mcpServerOf(name) {
|
|
85
|
+
const parsed = parseToolName(name);
|
|
86
|
+
return parsed?.kind === "mcp" || parsed?.kind === "mcp-server" ? parsed.server : undefined;
|
|
87
|
+
}
|
|
88
|
+
/** Why a grant of an MCP server's tool is refused by its name alone, said after the grant (`mcp:<server>/<tool> ...`): the
|
|
89
|
+
* one place the console's picker and the save's blockers (runnable.ts) both read it. `hands` is the harnesses' own tools'
|
|
90
|
+
* server. */
|
|
91
|
+
export const MCP_HANDS_WORDS = "names the MCP server hands, a name the harnesses keep for their own tools: save the server under another name.";
|
|
92
|
+
/** MCP_HANDS_WORDS when the grant names the server `hands`; undefined otherwise. A name's length refuses nothing: one whose
|
|
93
|
+
* `mcp__<server>__<tool>` is past the budget every harness's names share is called by its hashed wire name (catalog.ts
|
|
94
|
+
* wireName), and read back by lookup. */
|
|
95
|
+
export const mcpGrantNameProblem = (server, _tool) => (server === "hands" ? MCP_HANDS_WORDS : undefined);
|
|
96
|
+
/** Why two granted catalog tools can't both be granted: the harnesses call both by one wire name (`wire`, catalog.ts
|
|
97
|
+
* wireName), so neither could be told apart. Said after the later grant. */
|
|
98
|
+
export const sameWireWords = (tool, other, wire) => `${tool} and ${other} are called by one name on every harness (${wire}): grant one of them by name.`;
|
|
99
|
+
/** Why `harness` drops or retypes the input of the catalog tool `tool` (its facts' schemaProblems, `dropped` the first,
|
|
100
|
+
* said under the tool's wire name): the words a save's blocker and a saved MCP server's read both say. */
|
|
101
|
+
export const droppedWords = (tool, harness, dropped) => `The tool ${tool} cannot be offered on ${harness}: ${dropped.replace(/^[A-Za-z0-9_-]+: /, "")}.`;
|
package/dist/tool-plane.d.ts
CHANGED
|
@@ -2,13 +2,17 @@ import type { InputIssue } from "./errors.js";
|
|
|
2
2
|
import type { Settings } from "./store/index.js";
|
|
3
3
|
import { type HarnessId } from "./harness.js";
|
|
4
4
|
import { type ShellPlace } from "@parcha/agentrun-kernel/kernel";
|
|
5
|
-
import { type Permission, type Pin } from "./tool-gate.js";
|
|
5
|
+
import { type Permission, type Pin, type ToolEffect } from "./tool-gate.js";
|
|
6
6
|
import { type BashPolicy } from "./bash-read-only.js";
|
|
7
|
+
import { EMAIL_SCOPES } from "./email/names.js";
|
|
8
|
+
/** An email read tool's scope (email/names.ts). */
|
|
9
|
+
type EmailScope = (typeof EMAIL_SCOPES)[number];
|
|
7
10
|
/**
|
|
8
11
|
* The capabilities a pack or a revision may grant, by name: the tools the kernel gives a run, bound from serve's closed
|
|
9
12
|
* table (tools.ts) and named the same on every harness that runs them. `web_search` and `web_fetch` resolve to a
|
|
10
13
|
* provider (PROVIDERS); the rest are the kernel's own. Not capabilities: the workflow call nodes' `pdf_pages` and `llm` (a workflow's call node names them, a grant
|
|
11
|
-
* never does), and a catalog's tools (`
|
|
14
|
+
* never does), and a catalog's tools (`mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`: catalog tools, which their
|
|
15
|
+
* catalog grants).
|
|
12
16
|
*/
|
|
13
17
|
export declare const CAPABILITIES: readonly ["read", "write", "edit", "web_search", "web_fetch", "browser", "ask_person"];
|
|
14
18
|
/** The providers a user may pick for each capability that has a choice, its default first: `auto`, the native search
|
|
@@ -27,24 +31,23 @@ export declare const PROVIDERS: Readonly<{
|
|
|
27
31
|
}>;
|
|
28
32
|
export type Pickable = keyof typeof PROVIDERS;
|
|
29
33
|
export declare const PICKABLE: Pickable[];
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* offered for these and for catalog tools. Any other (browser, ask_person, the call-only ones) is allow or deny. The
|
|
34
|
-
* run's learned_workflow is one (tool-gate.ts runs an approved call of it on the run's own tools). */
|
|
35
|
-
export declare const ASKABLE: readonly string[];
|
|
36
|
-
/** The permissions `name` may be set to. */
|
|
34
|
+
/** The permissions `name` may be set to: ask is offered for the tools whose approved call the kernel runs itself, outside
|
|
35
|
+
* the model's turn (tool-list.ts `askable`) and for catalog tools. Any other (browser, ask_person, the call-only ones) is
|
|
36
|
+
* allow or deny. */
|
|
37
37
|
export declare const permissionsOf: (name: string) => readonly Permission[];
|
|
38
38
|
/** A tool's permission as this server applies it to an agent that sets none, as capabilities and an MCP server's read
|
|
39
39
|
* give it: the one in force under the server's settings (`permission`), the owner's default (`default_permission`) and
|
|
40
40
|
* those it may be set to. An agent's read gives the same, the agent's own layer over it (agentTools). */
|
|
41
|
-
export declare const serverGate: (name: string, settings: ToolSettingsMap) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
export declare const serverGate: (name: string, settings: ToolSettingsMap, effect?: ToolEffect) => {
|
|
42
|
+
default_permission: "allow" | "ask" | "deny";
|
|
43
|
+
permissions: ("allow" | "ask" | "deny")[];
|
|
44
|
+
fallback_allow_reads?: true | undefined;
|
|
45
|
+
allow_reads?: true | undefined;
|
|
46
|
+
permission: "allow" | "ask" | "deny";
|
|
45
47
|
};
|
|
46
48
|
/** The run's own tools beyond the table, each its own settings key, allowed by default like a table tool: the learned
|
|
47
|
-
* workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL)
|
|
49
|
+
* workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL), and the host's
|
|
50
|
+
* `tools_search`, `tools_call` and `codemode` (runner/meta-tools.ts): set to deny, one is not offered to a run. */
|
|
48
51
|
export declare const SERVE_OWN_TOOLS: readonly string[];
|
|
49
52
|
/** A computer kind's tools, one settings key per kind, as `browser` holds the browser's family: every desktop tool is
|
|
50
53
|
* held to `desktop`, every phone tool to `phone` (the kernel registry's definitions name the key; tool-gate.ts
|
|
@@ -59,8 +62,10 @@ export declare const DECISION_PROVIDER_KEYS: readonly string[];
|
|
|
59
62
|
export type ToolSetting = {
|
|
60
63
|
provider?: string;
|
|
61
64
|
permission?: Permission;
|
|
62
|
-
pin?: Pin; /**
|
|
63
|
-
|
|
65
|
+
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. */
|
|
66
|
+
allow_reads?: true; /** bash's policy, an agent's own only (bash-read-only.ts). */
|
|
67
|
+
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. */
|
|
68
|
+
scope?: EmailScope; /** Read as a stand-in for a value not offered (checkToolSettings); never shown or written. */
|
|
64
69
|
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. */
|
|
65
70
|
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`. */
|
|
66
71
|
brokenPin?: true; /** The broken pin as written in the file, which a save that keeps it writes back. Never shown. */
|
|
@@ -71,8 +76,9 @@ export declare const MAX_PIN_TEXT = 1024;
|
|
|
71
76
|
/** The one check of a pin, every place that takes one calls it (the server's settings, an agent's, a template's mcp
|
|
72
77
|
* entry, the store's revision bodies at the cutover): `pin` under `at`, an object of 1 to MAX_PIN_ARGS of a tool's
|
|
73
78
|
* top-level arguments (PIN_ARG), each to a JSON scalar (a string of at most MAX_PIN_TEXT characters, a finite number,
|
|
74
|
-
* true or false, or null: left out) or a list of 1 to MAX_PIN_CHOICES of them, the argument one of the list
|
|
75
|
-
*
|
|
79
|
+
* true or false, or null: left out) or a list of 1 to MAX_PIN_CHOICES of them, the argument one of the list, or
|
|
80
|
+
* `{keys: [...]}`, 1 to MAX_PIN_CHOICES key names (text of 1 to MAX_PIN_TEXT characters) an object argument may hold,
|
|
81
|
+
* nothing else in it (sortedPin is its one form). With
|
|
76
82
|
* `key`, the settings key it is set on, which is one MCP tool's own (`mcp:<server>/<tool>`), never a server's wildcard,
|
|
77
83
|
* whose tools take other arguments, nor any other tool's. */
|
|
78
84
|
export declare function pinIssues(pin: unknown, at: string, key?: string): InputIssue[];
|
|
@@ -277,19 +283,19 @@ export declare function shellUnavailable(name: string, shell: ShellPlace): Resol
|
|
|
277
283
|
* provider choice the provider in force and where it came from, the one that applies when the agent sets none, and what
|
|
278
284
|
* it resolves to on the agent's harness and model. `shell`: where a run of the agent has its shell (runShellOf on its
|
|
279
285
|
* computer setting); a tool of bash's family that leaves out resolves unavailable, saying why (shellUnavailable). */
|
|
280
|
-
export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSettingsMap, agent: Tooling, order: readonly string[], shell?: ShellPlace): ({
|
|
286
|
+
export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSettingsMap, agent: Tooling, order: readonly string[], shell?: ShellPlace, effectOf?: (name: string) => ToolEffect | undefined): ({
|
|
281
287
|
resolved: Resolution;
|
|
282
|
-
permission: "
|
|
288
|
+
permission: "allow" | "ask" | "deny";
|
|
283
289
|
permission_from: import("./refusal-words.js").SettingFrom;
|
|
284
|
-
default_permission: "
|
|
285
|
-
permissions: ("
|
|
290
|
+
default_permission: "allow" | "ask" | "deny";
|
|
291
|
+
permissions: ("allow" | "ask" | "deny")[];
|
|
286
292
|
blurb?: string | undefined;
|
|
287
293
|
name: string;
|
|
288
294
|
} | {
|
|
289
|
-
permission: "
|
|
295
|
+
permission: "allow" | "ask" | "deny";
|
|
290
296
|
permission_from: import("./refusal-words.js").SettingFrom;
|
|
291
|
-
default_permission: "
|
|
292
|
-
permissions: ("
|
|
297
|
+
default_permission: "allow" | "ask" | "deny";
|
|
298
|
+
permissions: ("allow" | "ask" | "deny")[];
|
|
293
299
|
blurb?: string | undefined;
|
|
294
300
|
name: string;
|
|
295
301
|
} | {
|
|
@@ -297,10 +303,10 @@ export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSetting
|
|
|
297
303
|
provider_from: string;
|
|
298
304
|
default_provider: string;
|
|
299
305
|
resolved: Resolution;
|
|
300
|
-
permission: "
|
|
306
|
+
permission: "allow" | "ask" | "deny";
|
|
301
307
|
permission_from: import("./refusal-words.js").SettingFrom;
|
|
302
|
-
default_permission: "
|
|
303
|
-
permissions: ("
|
|
308
|
+
default_permission: "allow" | "ask" | "deny";
|
|
309
|
+
permissions: ("allow" | "ask" | "deny")[];
|
|
304
310
|
blurb?: string | undefined;
|
|
305
311
|
name: string;
|
|
306
312
|
})[];
|
package/dist/tool-plane.js
CHANGED
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
// harness's own search (inside its CLI, where no call can wait for a person) gives way to the kernel's. A run is never
|
|
20
20
|
// told a deny: its Plane resolves a denied capability as under ask, and the gate, which reads the permission at each
|
|
21
21
|
// call, is the one place that refuses it, so a deny lifted mid-run is lifted at the next call.
|
|
22
|
-
import {
|
|
22
|
+
import { META_TOOLS } from "./meta-tool-names.js";
|
|
23
|
+
import { blurbOf, isAskable, isTableTool, tableTools } from "./tool-list.js";
|
|
23
24
|
import { PROVIDERS as COMPUTER_PROVIDERS } from "@parcha/agentrun-computer";
|
|
24
25
|
import { decisionKeysOf, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
25
26
|
import { keyNeeded } from "./key-words.js";
|
|
@@ -29,13 +30,16 @@ import { viaOpenRouter, WIRES } from "./provider.js";
|
|
|
29
30
|
import { savedIn } from "./secrets.js";
|
|
30
31
|
import { hostModel } from "./model.js";
|
|
31
32
|
import { NEEDS_A_COMPUTER, NO_SHELL } from "@parcha/agentrun-kernel/kernel";
|
|
32
|
-
import { canonicalPin, defaultPermission,
|
|
33
|
+
import { canonicalPin, defaultPermission, isPinKeys, MAX_PIN_ARGS, MAX_PIN_CHOICES, PERMISSIONS, permissionFrom, permissionOf, SETTINGS_UNREAD, SHELL_FAMILY } from "./tool-gate.js";
|
|
33
34
|
import { BASH_POLICIES } from "./bash-read-only.js";
|
|
35
|
+
import { EMAIL_SCOPES, SCOPED_TOOLS, SCOPED_WORDS } from "./email/names.js";
|
|
36
|
+
import { isCatalogName, isMcpName, mcpNameOf, parseToolName } from "./tool-names.js";
|
|
34
37
|
/**
|
|
35
38
|
* The capabilities a pack or a revision may grant, by name: the tools the kernel gives a run, bound from serve's closed
|
|
36
39
|
* table (tools.ts) and named the same on every harness that runs them. `web_search` and `web_fetch` resolve to a
|
|
37
40
|
* provider (PROVIDERS); the rest are the kernel's own. Not capabilities: the workflow call nodes' `pdf_pages` and `llm` (a workflow's call node names them, a grant
|
|
38
|
-
* never does), and a catalog's tools (`
|
|
41
|
+
* never does), and a catalog's tools (`mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`: catalog tools, which their
|
|
42
|
+
* catalog grants).
|
|
39
43
|
*/
|
|
40
44
|
export const CAPABILITIES = ["read", "write", "edit", "web_search", "web_fetch", "browser", "ask_person"];
|
|
41
45
|
/** The providers a user may pick for each capability that has a choice, its default first: `auto`, the native search
|
|
@@ -49,21 +53,36 @@ export const CAPABILITIES = ["read", "write", "edit", "web_search", "web_fetch",
|
|
|
49
53
|
* (browserBy). */
|
|
50
54
|
export const PROVIDERS = Object.freeze({ web_search: ["auto", "native", "exa-keyless", "parallel", "off"], web_fetch: ["kernel", "parallel"], browser: Object.freeze(["auto", ...browserProviderIds(), "chrome"]) });
|
|
51
55
|
export const PICKABLE = Object.keys(PROVIDERS);
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
* run's learned_workflow is one (tool-gate.ts runs an approved call of it on the run's own tools). */
|
|
57
|
-
export const ASKABLE = ["read", "write", "edit", "bash", "web_fetch", "web_search", "learned_workflow"];
|
|
58
|
-
/** The permissions `name` may be set to. */
|
|
59
|
-
export const permissionsOf = (name) => (Object.hasOwn(SHELL_FAMILY, name) && SHELL_FAMILY[name] !== name ? permissionsOf(SHELL_FAMILY[name]) : ASKABLE.includes(name) || isCatalogTool(name) ? PERMISSIONS : ["allow", "deny"]);
|
|
56
|
+
/** The permissions `name` may be set to: ask is offered for the tools whose approved call the kernel runs itself, outside
|
|
57
|
+
* the model's turn (tool-list.ts `askable`) and for catalog tools. Any other (browser, ask_person, the call-only ones) is
|
|
58
|
+
* allow or deny. */
|
|
59
|
+
export const permissionsOf = (name) => (Object.hasOwn(SHELL_FAMILY, name) && SHELL_FAMILY[name] !== name ? permissionsOf(SHELL_FAMILY[name]) : isAskable(name) || isCatalogName(name) ? PERMISSIONS : ["allow", "deny"]);
|
|
60
60
|
/** A tool's permission as this server applies it to an agent that sets none, as capabilities and an MCP server's read
|
|
61
61
|
* give it: the one in force under the server's settings (`permission`), the owner's default (`default_permission`) and
|
|
62
62
|
* those it may be set to. An agent's read gives the same, the agent's own layer over it (agentTools). */
|
|
63
|
-
export const serverGate = (name, settings) =>
|
|
63
|
+
export const serverGate = (name, settings, effect) => {
|
|
64
|
+
const permission = permissionOf(name, settings, {}, "ask", effect);
|
|
65
|
+
// `allow_reads`: the allow is its server's "allow reads" (a read-only tool's ask lifted), not a setting or a default.
|
|
66
|
+
const lifted = effect === "read" && permission === "allow" && permissionOf(name, settings) === "ask";
|
|
67
|
+
// `fallback_allow_reads`: with no permission on the tool's own key, its server's "allow reads" would lift its ask, so
|
|
68
|
+
// allow is what applies once that setting goes, whatever the setting says now (the console's "allow reads" fallback).
|
|
69
|
+
const unset = effect === "read" ? withoutOwnPermission(name, settings) : undefined;
|
|
70
|
+
const falls = unset !== undefined && permissionOf(name, unset, {}, "ask", effect) === "allow" && permissionOf(name, unset) === "ask";
|
|
71
|
+
return { permission, ...(lifted ? { allow_reads: true } : {}), ...(falls ? { fallback_allow_reads: true } : {}), default_permission: defaultPermission(name), permissions: [...permissionsOf(name)] };
|
|
72
|
+
};
|
|
73
|
+
/** `settings` with no permission on `name`'s own key (its other fields kept), a copy that keeps the map's marks
|
|
74
|
+
* (SETTINGS_UNREAD, carried by the spread). */
|
|
75
|
+
const withoutOwnPermission = (name, settings) => {
|
|
76
|
+
const own = settings[name];
|
|
77
|
+
if (own?.permission === undefined)
|
|
78
|
+
return settings;
|
|
79
|
+
const { permission: _gone, ...kept } = own;
|
|
80
|
+
return { ...settings, [name]: kept };
|
|
81
|
+
};
|
|
64
82
|
/** The run's own tools beyond the table, each its own settings key, allowed by default like a table tool: the learned
|
|
65
|
-
* workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL)
|
|
66
|
-
|
|
83
|
+
* workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL), and the host's
|
|
84
|
+
* `tools_search`, `tools_call` and `codemode` (runner/meta-tools.ts): set to deny, one is not offered to a run. */
|
|
85
|
+
export const SERVE_OWN_TOOLS = ["learned_workflow", ...META_TOOLS];
|
|
67
86
|
/** A computer kind's tools, one settings key per kind, as `browser` holds the browser's family: every desktop tool is
|
|
68
87
|
* held to `desktop`, every phone tool to `phone` (the kernel registry's definitions name the key; tool-gate.ts
|
|
69
88
|
* settingsKeyOf reads it there). Allowed by default like a table tool; allow or deny. */
|
|
@@ -74,13 +93,9 @@ export const KIND_KEYS = ["desktop", "phone"];
|
|
|
74
93
|
export const DECISION_PROVIDER_KEYS = ["jev", "parallel", "openrouter"];
|
|
75
94
|
/** A settings key: a tool of the table, one of the run's own tools (SERVE_OWN_TOOLS), a computer kind's (KIND_KEYS), a
|
|
76
95
|
* decision provider's (DECISION_PROVIDER_KEYS), a
|
|
77
|
-
* catalog tool (`
|
|
78
|
-
* of its tools. */
|
|
79
|
-
|
|
80
|
-
* server's tool (`mcp:<server>/<tool>`) or its wildcard (`mcp:<server>/*`). */
|
|
81
|
-
const TOOL_KEY = /^(?:[a-z][a-z0-9_-]{0,63}(?:\.[A-Za-z0-9_-]{1,64})?|mcp:[A-Za-z0-9_.-]{1,64}\/(?:\*|[A-Za-z0-9_.-]{1,128}))$/;
|
|
82
|
-
const isToolSettingsKey = (name) => TOOL_KEY.test(name);
|
|
83
|
-
const isSettingsKey = (name) => isToolSettingsKey(name) && (TABLE_TOOLS.includes(name) || SERVE_OWN_TOOLS.includes(name) || KIND_KEYS.includes(name) || DECISION_PROVIDER_KEYS.includes(name) || isCatalogTool(name) || /^mcp:[^/]+\/\*$/.test(name));
|
|
96
|
+
* catalog tool (`mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`), or a group's wildcard (`mcp:<server>/*`,
|
|
97
|
+
* `monid:<provider>/*`), which sets each of its tools. */
|
|
98
|
+
const isSettingsKey = (name) => parseToolName(name) !== undefined && (isTableTool(name) || SERVE_OWN_TOOLS.includes(name) || KIND_KEYS.includes(name) || DECISION_PROVIDER_KEYS.includes(name) || isCatalogName(name));
|
|
84
99
|
/** The longest pinned string. */
|
|
85
100
|
export const MAX_PIN_TEXT = 1024;
|
|
86
101
|
/** A pinned argument's name: a top-level argument of the tool, as MCP tools name theirs. */
|
|
@@ -88,12 +103,13 @@ const PIN_ARG = /^[A-Za-z_][A-Za-z0-9_.-]{0,127}$/;
|
|
|
88
103
|
/** The one check of a pin, every place that takes one calls it (the server's settings, an agent's, a template's mcp
|
|
89
104
|
* entry, the store's revision bodies at the cutover): `pin` under `at`, an object of 1 to MAX_PIN_ARGS of a tool's
|
|
90
105
|
* top-level arguments (PIN_ARG), each to a JSON scalar (a string of at most MAX_PIN_TEXT characters, a finite number,
|
|
91
|
-
* true or false, or null: left out) or a list of 1 to MAX_PIN_CHOICES of them, the argument one of the list
|
|
92
|
-
*
|
|
106
|
+
* true or false, or null: left out) or a list of 1 to MAX_PIN_CHOICES of them, the argument one of the list, or
|
|
107
|
+
* `{keys: [...]}`, 1 to MAX_PIN_CHOICES key names (text of 1 to MAX_PIN_TEXT characters) an object argument may hold,
|
|
108
|
+
* nothing else in it (sortedPin is its one form). With
|
|
93
109
|
* `key`, the settings key it is set on, which is one MCP tool's own (`mcp:<server>/<tool>`), never a server's wildcard,
|
|
94
110
|
* whose tools take other arguments, nor any other tool's. */
|
|
95
111
|
export function pinIssues(pin, at, key) {
|
|
96
|
-
if (key !== undefined &&
|
|
112
|
+
if (key !== undefined && !mcpNameOf(key))
|
|
97
113
|
return [{ field: at, reason: "not_allowed", message: `A pin is set on one MCP tool's own key (mcp:<server>/<tool>), never on ${key}.` }];
|
|
98
114
|
const entries = typeof pin === "object" && pin !== null && !Array.isArray(pin) ? Object.entries(pin) : undefined;
|
|
99
115
|
if (!entries || !entries.length || entries.length > MAX_PIN_ARGS)
|
|
@@ -102,10 +118,15 @@ export function pinIssues(pin, at, key) {
|
|
|
102
118
|
return entries.flatMap(([arg, value]) => {
|
|
103
119
|
if (!PIN_ARG.test(arg))
|
|
104
120
|
return [{ field: `${at}.${arg}`, reason: "bad_format", message: `${at} names a top-level argument of the tool (${PIN_ARG.source}); ${JSON.stringify(arg).slice(0, 60)} is none` }];
|
|
105
|
-
const held = Array.isArray(value) ? value.length >= 1 && value.length <= MAX_PIN_CHOICES && value.every(scalar) : scalar(value);
|
|
106
|
-
return held ? [] : [{ field: `${at}.${arg}`, reason: "wrong_type", message: `${at}.${arg} is a JSON scalar (a string of at most ${MAX_PIN_TEXT} characters, a number, true or false, or null: the argument left out) or a list of 1 to ${MAX_PIN_CHOICES} of them, the argument one of the list` }];
|
|
121
|
+
const held = Array.isArray(value) ? value.length >= 1 && value.length <= MAX_PIN_CHOICES && value.every(scalar) : isPinKeys(value) ? keysRead(value) : scalar(value);
|
|
122
|
+
return held ? [] : [{ field: `${at}.${arg}`, reason: "wrong_type", message: `${at}.${arg} is a JSON scalar (a string of at most ${MAX_PIN_TEXT} characters, a number, true or false, or null: the argument left out) or a list of 1 to ${MAX_PIN_CHOICES} of them, the argument one of the list; or {keys: [<key>, ...]}: 1 to ${MAX_PIN_CHOICES} names (each text of 1 to ${MAX_PIN_TEXT} characters) of the keys an object argument may hold, any values, nothing else beside keys` }];
|
|
107
123
|
});
|
|
108
124
|
}
|
|
125
|
+
/** Whether a keys pin's object reads: `keys` alone, a list of 1 to MAX_PIN_CHOICES non-empty texts of at most MAX_PIN_TEXT. */
|
|
126
|
+
const keysRead = (value) => {
|
|
127
|
+
const { keys, ...rest } = value;
|
|
128
|
+
return !Object.keys(rest).length && Array.isArray(keys) && keys.length >= 1 && keys.length <= MAX_PIN_CHOICES && keys.every((key) => typeof key === "string" && key.length >= 1 && key.length <= MAX_PIN_TEXT);
|
|
129
|
+
};
|
|
109
130
|
/** `pin` in the one form a revision's body keeps (tool-gate.ts canonicalPin): its arguments sorted, each one-of list
|
|
110
131
|
* de-duplicated and sorted, null first, then by each value's JSON text. Equal meanings are one text, so one revision. */
|
|
111
132
|
export const sortedPin = (pin) => canonicalPin(pin);
|
|
@@ -374,9 +395,9 @@ export function settingsIssues(value, at = "", layer = "server") {
|
|
|
374
395
|
return Object.entries(value).flatMap(([name, setting]) => {
|
|
375
396
|
const pickable = Object.hasOwn(PROVIDERS, name);
|
|
376
397
|
if (!isSettingsKey(name))
|
|
377
|
-
return [{ field: field(name), reason: "not_allowed", message: `Tool settings are kept for this server's tools (${[...
|
|
398
|
+
return [{ field: field(name), reason: "not_allowed", message: `Tool settings are kept for this server's tools (${[...tableTools(), ...SERVE_OWN_TOOLS, ...KIND_KEYS, ...DECISION_PROVIDER_KEYS].join(", ")}), catalog tools (mcp:<server>/<tool>, monid:<provider>/<endpoint>) and a group's tools (mcp:<server>/*, monid:<provider>/*); ${name} is none of them.` }];
|
|
378
399
|
if (!isPlain(setting))
|
|
379
|
-
return [{ field: field(name), reason: "wrong_type", message: `${field(name)} is an object, {${pickable ? "provider, " : ""}permission${
|
|
400
|
+
return [{ field: field(name), reason: "wrong_type", message: `${field(name)} is an object, {${pickable ? "provider, " : ""}permission${isMcpName(name) ? ", pin" : ""}${layer === "agent" && name === "bash" ? ", policy" : ""}}` }];
|
|
380
401
|
return Object.entries(setting).flatMap(([key, given]) => {
|
|
381
402
|
if (key === "pin")
|
|
382
403
|
return pinIssues(given, field(name, key), name);
|
|
@@ -386,13 +407,25 @@ export function settingsIssues(value, at = "", layer = "server") {
|
|
|
386
407
|
return [{ field: field(name, key), reason: "not_allowed", message: `A policy is set on bash in an agent's own tool settings (definition.tool_settings.bash.policy), never ${layer === "agent" ? `on ${name}` : "in the server's"}.` }];
|
|
387
408
|
return BASH_POLICIES.includes(given) ? [] : [{ field: field(name, key), reason: "not_an_option", message: `${field(name, key)} is one of ${BASH_POLICIES.join(", ")}: read-only refuses, before it runs, any command that could write, run code or read outside the run's folder` }];
|
|
388
409
|
}
|
|
410
|
+
// An email tool's scope (email/tools.ts): an agent's own, on email_read, email_search and email_file only, set as bash's policy is.
|
|
411
|
+
if (key === "scope") {
|
|
412
|
+
if (layer !== "agent" || !SCOPED_TOOLS.includes(name))
|
|
413
|
+
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"}.` }];
|
|
414
|
+
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` }];
|
|
415
|
+
}
|
|
389
416
|
// The server's own mark of a pin in its file that does not read (withDefaults serves it), which a whole-map save
|
|
390
417
|
// sends back: it keeps the broken pin, and nothing else. Never an agent's.
|
|
391
418
|
if (key === "pin_broken") {
|
|
392
|
-
if (layer === "agent" || !
|
|
419
|
+
if (layer === "agent" || !mcpNameOf(name))
|
|
393
420
|
return [{ field: field(name, key), reason: "not_allowed", message: `pin_broken is the server's mark of a pin in its tool settings that does not read, on an MCP tool's own key; ${field(name)} keeps no such field.` }];
|
|
394
421
|
return given === true ? [] : [{ field: field(name, key), reason: "not_an_option", message: `${field(name, key)} is true, as the server serves it: it keeps the broken pin until a valid pin replaces it` }];
|
|
395
422
|
}
|
|
423
|
+
// "Allow reads" (tool-gate.ts readsLift): the server's, on an MCP server's wildcard only; false clears it.
|
|
424
|
+
if (key === "allow_reads") {
|
|
425
|
+
if (layer === "agent" || !/^mcp:[^/]+\/\*$/.test(name))
|
|
426
|
+
return [{ field: field(name, key), reason: "not_allowed", message: `allow_reads is set on an MCP server's wildcard (mcp:<server>/*) in this server's tool settings, never ${layer === "agent" ? "in an agent's own" : `on ${name}`}.` }];
|
|
427
|
+
return typeof given === "boolean" ? [] : [{ field: field(name, key), reason: "wrong_type", message: `${field(name, key)} is true (its read-only tools run with no approval) or false` }];
|
|
428
|
+
}
|
|
396
429
|
if (key === "permission") {
|
|
397
430
|
// A wildcard sets each tool of its server's: a catalog tool's permissions.
|
|
398
431
|
const offered = permissionsOf(name);
|
|
@@ -414,14 +447,14 @@ export function canonicalToolSettings(map) {
|
|
|
414
447
|
return sorted(Object.fromEntries(Object.entries(map).flatMap(([name, setting]) => {
|
|
415
448
|
if (!setting)
|
|
416
449
|
return [];
|
|
417
|
-
const kept = sorted({ ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.pin ? { pin: sortedPin(setting.pin) } : {}), ...(setting.policy ? { policy: setting.policy } : {}), ...(setting.provider ? { provider: setting.provider } : {}) });
|
|
450
|
+
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 } : {}) });
|
|
418
451
|
return Object.keys(kept).length ? [[name, kept]] : [];
|
|
419
452
|
})));
|
|
420
453
|
}
|
|
421
454
|
/** `map` with each capability's provider, its default where none is picked; a permission where one is set. */
|
|
422
455
|
export const withDefaults = (map) => ({
|
|
423
456
|
// As served: what is in force, never the internal mark of a stand-in.
|
|
424
|
-
...Object.fromEntries(Object.entries(map).map(([name, setting]) => [name, setting && { ...(setting.provider ? { provider: setting.provider } : {}), ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.pin ? { pin: setting.pin } : {}), ...(setting.brokenPin ? { pin_broken: true } : {}) }])),
|
|
457
|
+
...Object.fromEntries(Object.entries(map).map(([name, setting]) => [name, setting && { ...(setting.provider ? { provider: setting.provider } : {}), ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.allow_reads === true ? { allow_reads: true } : {}), ...(setting.pin ? { pin: setting.pin } : {}), ...(setting.brokenPin ? { pin_broken: true } : {}) }])),
|
|
425
458
|
...Object.fromEntries(PICKABLE.map((name) => [name, { provider: map[name]?.provider ?? PROVIDERS[name][0], ...(map[name]?.permission ? { permission: map[name].permission } : {}) }])),
|
|
426
459
|
});
|
|
427
460
|
/** An empty settings map marked as standing for settings that do not read (SETTINGS_UNREAD, tool-gate.ts): every reader
|
|
@@ -500,7 +533,7 @@ export async function loadToolSettings(store) {
|
|
|
500
533
|
* SHELL_WATCHERS). A different permission is a choice, written as given. */
|
|
501
534
|
export function keptSettings(map, current) {
|
|
502
535
|
const kept = Object.fromEntries(Object.entries(map).flatMap(([name, setting]) => {
|
|
503
|
-
const set = { ...(setting?.provider ? { provider: setting.provider } : {}), ...(setting?.permission ? { permission: setting.permission } : {}), ...(setting?.pin ? { pin: setting.pin } : {}) };
|
|
536
|
+
const set = { ...(setting?.provider ? { provider: setting.provider } : {}), ...(setting?.permission ? { permission: setting.permission } : {}), ...(setting?.allow_reads === true ? { allow_reads: true } : {}), ...(setting?.pin ? { pin: setting.pin } : {}) };
|
|
504
537
|
const before = current[name];
|
|
505
538
|
if (before?.fallback && set.permission === before.permission)
|
|
506
539
|
Object.assign(set, { fallback: true, raw: before.raw });
|
|
@@ -508,7 +541,7 @@ export function keptSettings(map, current) {
|
|
|
508
541
|
Object.assign(set, { brokenPin: true, rawPin: before.rawPin });
|
|
509
542
|
return Object.keys(set).length ? [[name, set]] : [];
|
|
510
543
|
}));
|
|
511
|
-
const written = Object.fromEntries(Object.entries(kept).map(([name, setting]) => [name, { ...(setting.provider ? { provider: setting.provider } : {}), ...(setting.fallback ? { permission: setting.raw } : setting.permission ? { permission: setting.permission } : {}), ...(setting.pin ? { pin: setting.pin } : setting.brokenPin ? { pin: setting.rawPin } : {}) }]));
|
|
544
|
+
const written = Object.fromEntries(Object.entries(kept).map(([name, setting]) => [name, { ...(setting.provider ? { provider: setting.provider } : {}), ...(setting.fallback ? { permission: setting.raw } : setting.permission ? { permission: setting.permission } : {}), ...(setting.allow_reads ? { allow_reads: true } : {}), ...(setting.pin ? { pin: setting.pin } : setting.brokenPin ? { pin: setting.rawPin } : {}) }]));
|
|
512
545
|
return { kept, written };
|
|
513
546
|
}
|
|
514
547
|
/** Replaces the server's tool settings in the one store, by keptSettings's rule: a tool `map` leaves out takes its
|
|
@@ -538,13 +571,15 @@ export function shellUnavailable(name, shell) {
|
|
|
538
571
|
* provider choice the provider in force and where it came from, the one that applies when the agent sets none, and what
|
|
539
572
|
* it resolves to on the agent's harness and model. `shell`: where a run of the agent has its shell (runShellOf on its
|
|
540
573
|
* computer setting); a tool of bash's family that leaves out resolves unavailable, saying why (shellUnavailable). */
|
|
541
|
-
export function agentTools(env, settings, agent, order, shell = "computer") {
|
|
574
|
+
export function agentTools(env, settings, agent, order, shell = "computer", effectOf = () => undefined) {
|
|
542
575
|
const plane = planeFor(env, agent, settings);
|
|
543
576
|
const rank = (name) => order.indexOf(name);
|
|
544
577
|
return [...new Set(agent.tools)].sort((a, b) => rank(a) - rank(b)).map((name) => {
|
|
545
|
-
|
|
546
|
-
const
|
|
547
|
-
|
|
578
|
+
// An MCP tool's effect as its saved server lists it now (what a run started now pins): "allow reads" reads it.
|
|
579
|
+
const effect = effectOf(name);
|
|
580
|
+
const { permission, from } = permissionFrom(name, settings, (agent.overrides ?? {}), agent.approvals ?? "ask", {}, effect);
|
|
581
|
+
const gate = { permission, permission_from: from, default_permission: permissionOf(name, settings, {}, "ask", effect), permissions: [...permissionsOf(name)] };
|
|
582
|
+
// One short line for people (tool-list.ts), as capabilities serves it.
|
|
548
583
|
const blurb = blurbOf(name);
|
|
549
584
|
const shown = { name, ...(blurb ? { blurb } : {}) };
|
|
550
585
|
// A tool of bash's family the agent's computer gives no shell for: unavailable, in the words its run's call gets.
|