@parcha/agentrun-serve 0.1.0-beta.36 → 0.1.0-beta.38
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 +452 -0
- package/README.md +311 -142
- package/dist/agent-rows.d.ts +1 -1
- package/dist/agents-store.d.ts +35 -3
- package/dist/agents-store.js +39 -14
- 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/attach-conformance-cli.d.ts +1 -0
- package/dist/attach-conformance-cli.js +18 -0
- package/dist/attach-conformance.d.ts +25 -0
- package/dist/attach-conformance.js +343 -0
- package/dist/browser-cost.d.ts +1 -1
- package/dist/browser-cost.js +52 -93
- package/dist/browser-live.d.ts +20 -8
- package/dist/browser-live.js +50 -27
- package/dist/cap.d.ts +0 -407
- package/dist/cap.js +4 -1028
- package/dist/catalog.d.ts +1 -12
- package/dist/catalog.js +4 -34
- package/dist/cli.js +13 -4
- package/dist/composio-preset.d.ts +53 -0
- package/dist/composio-preset.js +221 -0
- package/dist/computer-attach.d.ts +125 -0
- package/dist/computer-attach.js +330 -0
- package/dist/computer-calls.d.ts +60 -0
- package/dist/computer-calls.js +209 -0
- package/dist/computer-channel.d.ts +57 -0
- package/dist/computer-channel.js +115 -0
- package/dist/computer-commands.d.ts +1 -1
- package/dist/computer-held-routes.d.ts +35 -0
- package/dist/computer-held-routes.js +106 -0
- package/dist/computer-held.d.ts +48 -0
- package/dist/computer-held.js +87 -0
- package/dist/computer-keys.d.ts +21 -1
- package/dist/computer-keys.js +53 -11
- package/dist/computer-live.d.ts +165 -0
- package/dist/computer-live.js +655 -0
- package/dist/computer-setting.d.ts +15 -2
- package/dist/computer-setting.js +20 -4
- package/dist/computer-view.d.ts +14 -0
- package/dist/computer-view.js +51 -3
- package/dist/computer-viewer.d.ts +6 -0
- package/dist/computer-viewer.js +311 -0
- package/dist/computers.d.ts +37 -8
- package/dist/computers.js +62 -14
- package/dist/console/assets/index-CjqQirbo.css +1 -0
- package/dist/console/assets/index-b6-XY5A9.js +576 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +3 -0
- package/dist/decisions.js +4 -0
- package/dist/faux-computers.d.ts +9 -20
- package/dist/faux-computers.js +56 -26
- package/dist/github-connection.d.ts +10 -2
- package/dist/github-connection.js +65 -2
- package/dist/github-faux.js +1 -1
- package/dist/graph-view.d.ts +1 -1
- package/dist/harness-opencode/adapter.js +7 -3
- package/dist/harness-opencode/facts.js +0 -2
- package/dist/harness-opencode/host/policy.d.ts +2 -5
- package/dist/harness-opencode/host/policy.js +8 -32
- package/dist/harness-table.d.ts +0 -2
- package/dist/harness-table.js +0 -2
- package/dist/harness.d.ts +1 -0
- package/dist/harness.js +35 -1
- package/dist/host-tools.d.ts +2 -6
- package/dist/host-tools.js +7 -10
- package/dist/hosted-search.d.ts +5 -6
- package/dist/hosted-search.js +2 -28
- package/dist/import-sources.d.ts +10 -0
- package/dist/import-sources.js +44 -2
- package/dist/import.d.ts +3 -3
- package/dist/import.js +37 -6
- package/dist/key-words.d.ts +3 -2
- package/dist/key-words.js +4 -2
- package/dist/learn/check.d.ts +10 -2
- package/dist/learn/check.js +13 -5
- package/dist/learn/commit.d.ts +14 -2
- package/dist/learn/commit.js +23 -9
- package/dist/learn/compile.d.ts +243 -0
- package/dist/learn/compile.js +471 -0
- package/dist/learn/folder.d.ts +6 -0
- package/dist/learn/folder.js +4 -1
- package/dist/learn/general.d.ts +69 -0
- package/dist/learn/general.js +75 -0
- package/dist/learn/grade.d.ts +5 -1
- package/dist/learn/grade.js +29 -7
- package/dist/learn/notes.d.ts +8 -0
- package/dist/learn/notes.js +18 -0
- package/dist/learn/promote.d.ts +253 -0
- package/dist/learn/promote.js +428 -0
- package/dist/learn/refit.d.ts +39 -0
- package/dist/learn/refit.js +236 -0
- package/dist/learn/reflect.d.ts +9 -20
- package/dist/learn/reflect.js +18 -125
- package/dist/learn/replay-calls.d.ts +63 -0
- package/dist/learn/replay-calls.js +158 -0
- package/dist/learn/skills.d.ts +50 -14
- package/dist/learn/skills.js +183 -47
- package/dist/learn/workflow-nodes.d.ts +15 -0
- package/dist/learn/workflow-nodes.js +44 -0
- package/dist/learned-nodes.d.ts +50 -2
- package/dist/learned-nodes.js +41 -2
- package/dist/learned-workflow.d.ts +43 -3
- package/dist/learned-workflow.js +170 -28
- package/dist/learning-batch.d.ts +283 -0
- package/dist/learning-batch.js +574 -0
- package/dist/learning-cost.d.ts +18 -6
- package/dist/learning-cost.js +15 -7
- package/dist/learning-evals.d.ts +33 -0
- package/dist/learning-evals.js +98 -0
- package/dist/learning-routes.d.ts +37 -2
- package/dist/learning-routes.js +52 -8
- package/dist/learning-words.d.ts +13 -0
- package/dist/learning-words.js +13 -0
- package/dist/learning.d.ts +55 -17
- package/dist/learning.js +91 -48
- package/dist/live/stream.js +6 -3
- package/dist/live/translate.d.ts +4 -3
- package/dist/live/translate.js +8 -4
- package/dist/live-reach.d.ts +37 -0
- package/dist/live-reach.js +62 -0
- package/dist/llm.js +0 -3
- package/dist/mcp-gateway.d.ts +21 -20
- package/dist/mcp-gateway.js +76 -55
- package/dist/mcp-oauth.d.ts +62 -7
- package/dist/mcp-oauth.js +134 -19
- package/dist/mcp-pin-first.d.ts +37 -0
- package/dist/mcp-pin-first.js +107 -0
- package/dist/mcp-private-hosts.d.ts +4 -4
- package/dist/mcp-private-hosts.js +20 -12
- package/dist/mcp-probe.d.ts +27 -11
- package/dist/mcp-probe.js +60 -42
- package/dist/mcp-secret-writes.js +4 -0
- package/dist/mcp-servers-store.d.ts +115 -25
- package/dist/mcp-servers-store.js +241 -43
- package/dist/mcp-sources.d.ts +39 -0
- package/dist/mcp-sources.js +74 -0
- package/dist/mcp-store.d.ts +21 -4
- package/dist/mcp-store.js +33 -8
- 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 +26 -0
- package/dist/model-form.js +80 -0
- package/dist/model.d.ts +13 -0
- package/dist/model.js +69 -25
- package/dist/monid.d.ts +51 -25
- package/dist/monid.js +226 -140
- package/dist/openapi.js +694 -59
- package/dist/page.d.ts +18 -0
- package/dist/page.js +48 -20
- package/dist/paid-calls.d.ts +26 -29
- package/dist/paid-calls.js +46 -102
- package/dist/place-offers.d.ts +2 -3
- package/dist/place-offers.js +3 -7
- package/dist/place.js +1 -2
- package/dist/print.d.ts +15 -1
- package/dist/print.js +14 -3
- package/dist/propose.d.ts +10 -1
- package/dist/propose.js +30 -10
- package/dist/provider.js +12 -4
- package/dist/reflect-range.d.ts +8 -1
- package/dist/reflect-range.js +3 -2
- package/dist/rows.d.ts +5 -3
- package/dist/rows.js +15 -4
- package/dist/run-launch.d.ts +27 -2
- package/dist/run-launch.js +15 -4
- package/dist/run-learning-served.d.ts +13 -2
- package/dist/run-manifest.d.ts +5 -0
- package/dist/run-manifest.js +20 -0
- package/dist/run-reads-over-store.d.ts +1 -1
- package/dist/run-repo.d.ts +20 -0
- package/dist/run-repo.js +63 -0
- package/dist/run-secrets.js +2 -3
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-timeline-served.js +5 -2
- package/dist/run-view.d.ts +19 -8
- package/dist/run-view.js +62 -26
- package/dist/runnable.d.ts +0 -3
- package/dist/runnable.js +37 -29
- package/dist/runner/adapter-loop.d.ts +47 -17
- package/dist/runner/adapter-loop.js +1427 -303
- package/dist/runner/adapter-run-spec.d.ts +23 -9
- package/dist/runner/adapter-run-spec.js +162 -56
- package/dist/runner/adapters/pi-computer.d.ts +9 -0
- package/dist/runner/adapters/pi-computer.js +51 -0
- package/dist/runner/adapters/pi.d.ts +25 -11
- package/dist/runner/adapters/pi.js +168 -45
- package/dist/runner/beside.d.ts +7 -3
- package/dist/runner/beside.js +21 -11
- package/dist/runner/claim-secrets.d.ts +4 -0
- package/dist/runner/claim-secrets.js +6 -1
- package/dist/runner/cli-run-spec.d.ts +20 -3
- package/dist/runner/cli-run-spec.js +174 -64
- package/dist/runner/commands.d.ts +3 -1
- package/dist/runner/commands.js +28 -3
- package/dist/runner/computer-channel.d.ts +34 -0
- package/dist/runner/computer-channel.js +62 -0
- package/dist/runner/conformance/harness.d.ts +3 -0
- package/dist/runner/conformance/harness.js +224 -17
- package/dist/runner/conformance/subject.d.ts +12 -5
- package/dist/runner/dispatch.js +3 -0
- package/dist/runner/end-of-run.d.ts +23 -12
- package/dist/runner/end-of-run.js +41 -16
- package/dist/runner/feedback-round.d.ts +52 -0
- package/dist/runner/feedback-round.js +79 -0
- package/dist/runner/github-app.d.ts +2 -1
- package/dist/runner/github-app.js +4 -2
- package/dist/runner/harness-loops.js +15 -1
- package/dist/runner/held-run.d.ts +65 -0
- package/dist/runner/held-run.js +158 -0
- package/dist/runner/journal-kinds.d.ts +44 -7
- package/dist/runner/journal-kinds.js +29 -0
- package/dist/runner/journal-reader.d.ts +5 -4
- package/dist/runner/journal-reader.js +12 -10
- package/dist/runner/learning-ask.d.ts +7 -1
- package/dist/runner/learning-ask.js +21 -6
- package/dist/runner/learning-dispatch.d.ts +22 -0
- package/dist/runner/learning-dispatch.js +77 -10
- package/dist/runner/learning-end.d.ts +69 -13
- package/dist/runner/learning-end.js +340 -87
- package/dist/runner/learning-factory.d.ts +1 -1
- package/dist/runner/learning-factory.js +11 -5
- package/dist/runner/learning-loop.d.ts +86 -8
- package/dist/runner/learning-loop.js +178 -23
- package/dist/runner/learning-seed.d.ts +11 -0
- package/dist/runner/learning-seed.js +27 -0
- package/dist/runner/live-ticker.js +1 -0
- package/dist/runner/loop-contract.d.ts +26 -3
- package/dist/runner/loop.d.ts +21 -2
- package/dist/runner/loop.js +23 -2
- package/dist/runner/main.d.ts +13 -1
- package/dist/runner/main.js +27 -5
- package/dist/runner/mcp-claim.d.ts +15 -8
- package/dist/runner/mcp-claim.js +176 -71
- package/dist/runner/mcp-github.js +1 -1
- package/dist/runner/mcp-run.d.ts +21 -57
- package/dist/runner/mcp-run.js +25 -85
- package/dist/runner/meta-tools.d.ts +37 -0
- package/dist/runner/meta-tools.js +268 -0
- package/dist/runner/metrics.d.ts +11 -2
- package/dist/runner/metrics.js +26 -5
- package/dist/runner/model-route.js +12 -3
- package/dist/runner/monid-run.d.ts +16 -0
- package/dist/runner/monid-run.js +96 -0
- package/dist/runner/pr-checkout.d.ts +1 -0
- package/dist/runner/pr-checkout.js +1 -1
- package/dist/runner/promotion.d.ts +80 -0
- package/dist/runner/promotion.js +562 -0
- package/dist/runner/reflect-hook.d.ts +46 -13
- package/dist/runner/reflect-hook.js +149 -48
- package/dist/runner/runner.d.ts +26 -0
- package/dist/runner/runner.js +208 -17
- package/dist/runner/scratch-sweep.d.ts +13 -0
- package/dist/runner/scratch-sweep.js +62 -0
- package/dist/runner/sessions.d.ts +9 -4
- package/dist/runner/sessions.js +5 -1
- package/dist/runner/step-guard.d.ts +62 -0
- package/dist/runner/step-guard.js +93 -0
- package/dist/runner/store-port.d.ts +4 -2
- package/dist/runner/store-secrets.js +4 -3
- package/dist/runner/subagent.d.ts +0 -3
- package/dist/runner/subagent.js +10 -13
- package/dist/runner/workflow-first.d.ts +216 -0
- package/dist/runner/workflow-first.js +303 -0
- package/dist/runner/workflow-host.d.ts +6 -1
- package/dist/runner/workflow-host.js +1 -1
- package/dist/runner/workflow-loop.d.ts +1 -1
- package/dist/runner/workflow-loop.js +17 -10
- package/dist/runner/workflow-spec.d.ts +15 -2
- package/dist/runner/workflow-spec.js +63 -23
- package/dist/runs-over-store.d.ts +17 -3
- package/dist/runs-over-store.js +59 -20
- package/dist/seal-key.js +3 -3
- package/dist/sealed-settings-store.d.ts +5 -2
- package/dist/sealed-settings-store.js +10 -4
- package/dist/secret-writes.d.ts +5 -4
- package/dist/secret-writes.js +5 -4
- package/dist/server-secrets-store.d.ts +4 -3
- package/dist/server-secrets-store.js +15 -9
- package/dist/server-secrets.js +3 -2
- package/dist/server.d.ts +119 -18
- package/dist/server.js +841 -202
- package/dist/settings-wake.d.ts +23 -0
- package/dist/settings-wake.js +65 -0
- package/dist/standard-webhooks.d.ts +4 -1
- package/dist/standard-webhooks.js +8 -4
- package/dist/store/agent-body.d.ts +14 -3
- package/dist/store/agent-body.js +14 -10
- package/dist/store/command-wake.d.ts +13 -0
- package/dist/store/command-wake.js +37 -0
- package/dist/store/dialect.d.ts +6 -0
- package/dist/store/dialect.js +5 -0
- package/dist/store/index.d.ts +1 -1
- package/dist/store/journal/storage.d.ts +3 -2
- package/dist/store/journal/storage.js +13 -5
- package/dist/store/postgres/connection.js +3 -1
- package/dist/store/postgres/dialect.js +4 -0
- package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
- package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
- package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
- package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
- package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
- 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/schema.d.ts +10 -1
- package/dist/store/schema.js +104 -15
- 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 +7 -5
- package/dist/store/sqlite/run-patch.js +45 -18
- package/dist/store/sqlite/store.js +331 -72
- package/dist/store/store.d.ts +312 -21
- package/dist/store/store.js +12 -1
- package/dist/store-reads/cap.d.ts +1 -1
- package/dist/store-reads/cap.js +8 -1
- package/dist/store-reads/decisions.d.ts +2 -2
- package/dist/store-reads/decisions.js +1 -1
- package/dist/store-reads/import-summary.d.ts +1 -1
- package/dist/store-reads/journal.d.ts +30 -5
- package/dist/store-reads/journal.js +128 -56
- package/dist/store-reads/learning.d.ts +114 -12
- package/dist/store-reads/learning.js +238 -48
- package/dist/store-reads/loop.d.ts +61 -0
- package/dist/store-reads/loop.js +111 -0
- package/dist/store-reads/runs.d.ts +1 -1
- package/dist/store-reads/workflow.d.ts +1 -1
- package/dist/store-view.d.ts +6 -0
- package/dist/store-view.js +59 -26
- package/dist/template-eval.d.ts +18 -9
- package/dist/template-eval.js +95 -68
- package/dist/template-github-permissions.d.ts +24 -10
- package/dist/template-github-permissions.js +36 -15
- 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 +218 -46
- package/dist/templates.js +493 -181
- package/dist/timeline/computer.d.ts +48 -0
- package/dist/timeline/computer.js +169 -0
- package/dist/timeline/index.d.ts +4 -3
- package/dist/timeline/index.js +4 -3
- package/dist/timeline/labels.d.ts +6 -2
- package/dist/timeline/labels.js +93 -2
- package/dist/timeline/origin.d.ts +19 -5
- package/dist/timeline/origin.js +11 -4
- package/dist/timeline/timeline.d.ts +22 -1
- package/dist/timeline/timeline.js +34 -18
- package/dist/timeline/util.d.ts +4 -0
- package/dist/timeline/util.js +14 -0
- package/dist/tool-gate.d.ts +84 -50
- package/dist/tool-gate.js +179 -101
- package/dist/tool-keys.d.ts +4 -1
- package/dist/tool-keys.js +8 -3
- package/dist/tool-list.d.ts +26 -0
- package/dist/tool-list.js +43 -0
- package/dist/tool-names.d.ts +71 -0
- package/dist/tool-names.js +99 -0
- package/dist/tool-plane.d.ts +33 -27
- package/dist/tool-plane.js +72 -39
- package/dist/tools.d.ts +32 -7
- package/dist/tools.js +37 -24
- package/dist/trigger-adapter.d.ts +4 -0
- package/dist/trigger-secrets-shown.d.ts +2 -2
- package/dist/trigger-secrets-shown.js +1 -1
- package/dist/trigger-signatures.d.ts +25 -6
- package/dist/trigger-signatures.js +41 -7
- package/dist/trigger-targets.d.ts +2 -0
- package/dist/trigger-targets.js +1 -0
- package/dist/trigger-webhook.js +5 -2
- package/dist/triggers.d.ts +7 -3
- package/dist/triggers.js +35 -5
- package/dist/turns.js +16 -1
- package/dist/validate.d.ts +15 -7
- package/dist/validate.js +102 -45
- package/dist/web-fetch.d.ts +2 -8
- package/dist/web-fetch.js +2 -22
- package/dist/web-search.d.ts +10 -5
- package/dist/web-search.js +7 -6
- package/dist/webhooks.d.ts +145 -102
- package/dist/webhooks.js +559 -322
- package/dist/workflow/decisions.d.ts +1 -1
- package/dist/workflow/node-runner.d.ts +2 -1
- package/dist/workflow/node.d.ts +2 -1
- package/dist/workflow/node.js +3 -1
- package/dist/workflow/pi-versions.d.ts +23 -0
- package/dist/workflow/pi-versions.js +57 -0
- package/dist/workflow/record-tool.d.ts +2 -1
- package/dist/workflow/store.d.ts +1 -1
- package/dist/workflow/task.js +3 -2
- package/dist/workflow-run.d.ts +1 -1
- package/dist/workspace/attached-computers.d.ts +41 -0
- package/dist/workspace/attached-computers.js +114 -0
- package/dist/workspace/computer-deps.d.ts +19 -9
- package/dist/workspace/computer-deps.js +24 -9
- package/dist/workspace/computer-for-claim.d.ts +23 -8
- package/dist/workspace/computer-for-claim.js +92 -33
- package/dist/workspace/computer-hold.d.ts +11 -27
- package/dist/workspace/computer-hold.js +41 -55
- package/dist/workspace/computer-ledger.d.ts +3 -1
- package/dist/workspace/computer-ledger.js +4 -0
- package/dist/workspace/computer-mcp.d.ts +25 -0
- package/dist/workspace/computer-mcp.js +41 -0
- package/dist/workspace/computer-ports.d.ts +4 -13
- package/dist/workspace/computer-ports.js +4 -107
- package/dist/workspace/computer-script.d.ts +53 -0
- package/dist/workspace/computer-script.js +172 -0
- package/dist/workspace/executors.d.ts +1 -1
- package/dist/workspace/index.d.ts +4 -2
- package/dist/workspace/index.js +3 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +132 -84
- package/dist/workspace/kind-skills/phone/SKILL.md +104 -85
- package/dist/workspace/local.js +2 -2
- package/dist/workspace/resolve-computer.d.ts +24 -1
- package/dist/workspace/resolve-computer.js +40 -16
- package/dist/workspace/run-tools.d.ts +56 -21
- package/dist/workspace/run-tools.js +55 -34
- package/dist/wrap-up.d.ts +21 -0
- package/dist/wrap-up.js +21 -0
- package/launcher/agentrun-serve +4 -2
- package/package.json +19 -16
- package/templates/README.md +111 -45
- package/templates/code-review/agent.md +30 -14
- 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 +2 -2
- 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/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/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 +3 -2
- package/templates/code-review/skills/review/REVIEWER.md +3 -2
- package/templates/code-review/skills/review/SKILL.md +4 -3
- 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 +4 -3
- 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 +4 -3
- 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-BI4Byidu.js +0 -550
- package/dist/console/assets/index-C19gUF2n.css +0 -1
- package/dist/run-db.d.ts +0 -53
- package/dist/run-db.js +0 -116
- package/dist/tool-blurbs.d.ts +0 -4
- package/dist/tool-blurbs.js +0 -28
- package/dist/tool-budget.d.ts +0 -26
- package/dist/tool-budget.js +0 -56
- package/dist/workflow/readers.d.ts +0 -36
- package/dist/workflow/readers.js +0 -145
- package/dist/workflow/wal.d.ts +0 -11
- package/dist/workflow/wal.js +0 -106
- 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,71 @@
|
|
|
1
|
+
/** An MCP server's name. */
|
|
2
|
+
export declare const MCP_SERVER_NAME: RegExp;
|
|
3
|
+
/** An MCP tool's own name, as its server lists it. */
|
|
4
|
+
export declare const MCP_TOOL_NAME: RegExp;
|
|
5
|
+
/** A catalog tool's name, as a JSON Schema pattern (openapi.ts): `mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`,
|
|
6
|
+
* or either's wildcard. */
|
|
7
|
+
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}))$";
|
|
8
|
+
/** 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
|
|
9
|
+
* tools, a monid provider's endpoints). */
|
|
10
|
+
export type ToolName = {
|
|
11
|
+
kind: "plain";
|
|
12
|
+
name: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: "mcp";
|
|
15
|
+
server: string;
|
|
16
|
+
tool: string;
|
|
17
|
+
} | {
|
|
18
|
+
kind: "mcp-server";
|
|
19
|
+
server: string;
|
|
20
|
+
} | {
|
|
21
|
+
kind: "monid";
|
|
22
|
+
provider: string;
|
|
23
|
+
endpoint: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: "monid-provider";
|
|
26
|
+
provider: string;
|
|
27
|
+
};
|
|
28
|
+
/** Catalog name `name` read, or undefined for one outside the grammar. */
|
|
29
|
+
export declare function parseToolName(name: string): ToolName | undefined;
|
|
30
|
+
/** The catalog name of `name`: parseToolName's inverse. */
|
|
31
|
+
export declare function formatToolName(name: ToolName): string;
|
|
32
|
+
/** Whether `name` is in monid's namespace (`monid:`), well formed or not, as isMcpName is for MCP's. */
|
|
33
|
+
export declare const isMonidName: (name: string) => boolean;
|
|
34
|
+
/** Whether `name` is a third-party catalog's (MCP's or monid's), well formed or not: its default is ask. */
|
|
35
|
+
export declare const isCatalogName: (name: string) => boolean;
|
|
36
|
+
/** Why `name`, in monid's namespace, is refused as a grant by its name alone. */
|
|
37
|
+
export declare const MONID_NAME_WORDS: (name: string) => string;
|
|
38
|
+
/** One monid endpoint's catalog name read (`monid:<provider>/<endpoint>`), or undefined for any other name. */
|
|
39
|
+
export declare function monidNameOf(name: string): {
|
|
40
|
+
provider: string;
|
|
41
|
+
endpoint: string;
|
|
42
|
+
} | undefined;
|
|
43
|
+
/** One MCP tool's catalog name, `mcp:<server>/<tool>`: what the gate, the pin and the timeline key its calls by. */
|
|
44
|
+
export declare const mcpToolName: (server: string, tool: string) => string;
|
|
45
|
+
/** Whether `name` is in MCP's namespace (`mcp:`), well formed or not: a name MCP's checks answer for, so one that does
|
|
46
|
+
* not parse is refused in MCP's words, and the gate's default for it is MCP's (ask), never a built-in's. */
|
|
47
|
+
export declare const isMcpName: (name: string) => boolean;
|
|
48
|
+
/** One MCP tool's catalog name read (`mcp:<server>/<tool>`), or undefined for any other name, a server's wildcard too. */
|
|
49
|
+
export declare function mcpNameOf(name: string): {
|
|
50
|
+
server: string;
|
|
51
|
+
tool: string;
|
|
52
|
+
} | undefined;
|
|
53
|
+
/** The MCP server `name` names, one of its tools or its wildcard; undefined for any other name. */
|
|
54
|
+
export declare function mcpServerOf(name: string): string | undefined;
|
|
55
|
+
/** Whether `name` is an MCP server's wildcard, `mcp:<server>/*`. */
|
|
56
|
+
export declare const isMcpWildcard: (name: string) => boolean;
|
|
57
|
+
/** Why a grant of an MCP server's tool is refused by its name alone, said after the grant (`mcp:<server>/<tool> ...`): the
|
|
58
|
+
* one place the console's picker and the save's blockers (runnable.ts) both read it. `hands` is the harnesses' own tools'
|
|
59
|
+
* server. */
|
|
60
|
+
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.";
|
|
61
|
+
/** Why `mcp__<server>__<tool>`, the name every harness calls the tool by, is not within the budget their names share
|
|
62
|
+
* (52 characters of letters, digits, `_` and `-`), or undefined when it is. */
|
|
63
|
+
export declare function mcpWireProblem(server: string, tool: string): string | undefined;
|
|
64
|
+
/** MCP_HANDS_WORDS or mcpWireProblem's, whichever refuses the name; undefined when neither does. */
|
|
65
|
+
export declare const mcpGrantNameProblem: (server: string, tool: string) => string | undefined;
|
|
66
|
+
/** Why a harness's own MCP client drops or retypes `tool` of `server` (its facts' schemaProblems, `dropped` the first):
|
|
67
|
+
* the words a save's blocker and a saved server's read both say. */
|
|
68
|
+
export declare const mcpDroppedWords: (server: string, tool: string, harness: string, dropped: string) => string;
|
|
69
|
+
/** Why the harness drops or retypes the pinned monid endpoint `tool`'s input (its facts' schemaProblems, `dropped` the
|
|
70
|
+
* first, under the endpoint's wire name): the words a save refuses its grant with. */
|
|
71
|
+
export declare const monidDroppedWords: (tool: string, harness: string, dropped: string) => string;
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
import { WIRE_NAME } from "./catalog.js";
|
|
13
|
+
const SERVER = "[a-z][a-z0-9-]{0,31}";
|
|
14
|
+
const TOOL = "[A-Za-z0-9_-]{1,64}";
|
|
15
|
+
const PROVIDER = "[a-z0-9][a-z0-9.-]{0,63}";
|
|
16
|
+
const ENDPOINT = "[A-Za-z0-9_.:{}-][A-Za-z0-9_.:{}/-]{0,199}";
|
|
17
|
+
const PLAIN = `[a-z][a-z0-9_-]{0,63}(?:\\.${TOOL})?`;
|
|
18
|
+
const MCP_PREFIX = "mcp:";
|
|
19
|
+
const MONID_PREFIX = "monid:";
|
|
20
|
+
const ALL = "*";
|
|
21
|
+
/** An MCP server's name. */
|
|
22
|
+
export const MCP_SERVER_NAME = new RegExp(`^${SERVER}$`);
|
|
23
|
+
/** An MCP tool's own name, as its server lists it. */
|
|
24
|
+
export const MCP_TOOL_NAME = new RegExp(`^${TOOL}$`);
|
|
25
|
+
/** A catalog tool's name, as a JSON Schema pattern (openapi.ts): `mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`,
|
|
26
|
+
* or either's wildcard. */
|
|
27
|
+
export const CATALOG_KEY_PATTERN = `^(?:mcp:${SERVER}/(?:\\*|${TOOL})|monid:${PROVIDER}/(?:\\*|${ENDPOINT}))$`;
|
|
28
|
+
const MCP_NAME = new RegExp(`^mcp:(${SERVER})/(\\*|${TOOL})$`);
|
|
29
|
+
const MONID_NAME = new RegExp(`^monid:(${PROVIDER})/(\\*|${ENDPOINT})$`);
|
|
30
|
+
const PLAIN_NAME = new RegExp(`^${PLAIN}$`);
|
|
31
|
+
/** Catalog name `name` read, or undefined for one outside the grammar. */
|
|
32
|
+
export function parseToolName(name) {
|
|
33
|
+
if (isMonidName(name)) {
|
|
34
|
+
const match = MONID_NAME.exec(name);
|
|
35
|
+
if (!match)
|
|
36
|
+
return undefined;
|
|
37
|
+
return match[2] === ALL ? { kind: "monid-provider", provider: match[1] } : { kind: "monid", provider: match[1], endpoint: match[2] };
|
|
38
|
+
}
|
|
39
|
+
if (!isMcpName(name))
|
|
40
|
+
return PLAIN_NAME.test(name) ? { kind: "plain", name } : undefined;
|
|
41
|
+
const match = MCP_NAME.exec(name);
|
|
42
|
+
if (!match)
|
|
43
|
+
return undefined;
|
|
44
|
+
return match[2] === ALL ? { kind: "mcp-server", server: match[1] } : { kind: "mcp", server: match[1], tool: match[2] };
|
|
45
|
+
}
|
|
46
|
+
/** The catalog name of `name`: parseToolName's inverse. */
|
|
47
|
+
export function formatToolName(name) {
|
|
48
|
+
if (name.kind === "plain")
|
|
49
|
+
return name.name;
|
|
50
|
+
if (name.kind === "monid" || name.kind === "monid-provider")
|
|
51
|
+
return `${MONID_PREFIX}${name.provider}/${name.kind === "monid" ? name.endpoint : ALL}`;
|
|
52
|
+
return `${MCP_PREFIX}${name.server}/${name.kind === "mcp" ? name.tool : ALL}`;
|
|
53
|
+
}
|
|
54
|
+
/** Whether `name` is in monid's namespace (`monid:`), well formed or not, as isMcpName is for MCP's. */
|
|
55
|
+
export const isMonidName = (name) => name.startsWith(MONID_PREFIX);
|
|
56
|
+
/** Whether `name` is a third-party catalog's (MCP's or monid's), well formed or not: its default is ask. */
|
|
57
|
+
export const isCatalogName = (name) => isMcpName(name) || isMonidName(name);
|
|
58
|
+
/** Why `name`, in monid's namespace, is refused as a grant by its name alone. */
|
|
59
|
+
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.`;
|
|
60
|
+
/** One monid endpoint's catalog name read (`monid:<provider>/<endpoint>`), or undefined for any other name. */
|
|
61
|
+
export function monidNameOf(name) {
|
|
62
|
+
const parsed = parseToolName(name);
|
|
63
|
+
return parsed?.kind === "monid" ? { provider: parsed.provider, endpoint: parsed.endpoint } : undefined;
|
|
64
|
+
}
|
|
65
|
+
/** One MCP tool's catalog name, `mcp:<server>/<tool>`: what the gate, the pin and the timeline key its calls by. */
|
|
66
|
+
export const mcpToolName = (server, tool) => formatToolName({ kind: "mcp", server, tool });
|
|
67
|
+
/** Whether `name` is in MCP's namespace (`mcp:`), well formed or not: a name MCP's checks answer for, so one that does
|
|
68
|
+
* not parse is refused in MCP's words, and the gate's default for it is MCP's (ask), never a built-in's. */
|
|
69
|
+
export const isMcpName = (name) => name.startsWith(MCP_PREFIX);
|
|
70
|
+
/** One MCP tool's catalog name read (`mcp:<server>/<tool>`), or undefined for any other name, a server's wildcard too. */
|
|
71
|
+
export function mcpNameOf(name) {
|
|
72
|
+
const parsed = parseToolName(name);
|
|
73
|
+
return parsed?.kind === "mcp" ? { server: parsed.server, tool: parsed.tool } : undefined;
|
|
74
|
+
}
|
|
75
|
+
/** The MCP server `name` names, one of its tools or its wildcard; undefined for any other name. */
|
|
76
|
+
export function mcpServerOf(name) {
|
|
77
|
+
const parsed = parseToolName(name);
|
|
78
|
+
return parsed?.kind === "mcp" || parsed?.kind === "mcp-server" ? parsed.server : undefined;
|
|
79
|
+
}
|
|
80
|
+
/** Whether `name` is an MCP server's wildcard, `mcp:<server>/*`. */
|
|
81
|
+
export const isMcpWildcard = (name) => parseToolName(name)?.kind === "mcp-server";
|
|
82
|
+
/** Why a grant of an MCP server's tool is refused by its name alone, said after the grant (`mcp:<server>/<tool> ...`): the
|
|
83
|
+
* one place the console's picker and the save's blockers (runnable.ts) both read it. `hands` is the harnesses' own tools'
|
|
84
|
+
* server. */
|
|
85
|
+
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.";
|
|
86
|
+
/** Why `mcp__<server>__<tool>`, the name every harness calls the tool by, is not within the budget their names share
|
|
87
|
+
* (52 characters of letters, digits, `_` and `-`), or undefined when it is. */
|
|
88
|
+
export function mcpWireProblem(server, tool) {
|
|
89
|
+
const wire = `mcp__${server}__${tool}`;
|
|
90
|
+
return WIRE_NAME.test(wire) ? undefined : `is too long: ${wire} must be at most 52 characters, the budget every harness's tool names share.`;
|
|
91
|
+
}
|
|
92
|
+
/** MCP_HANDS_WORDS or mcpWireProblem's, whichever refuses the name; undefined when neither does. */
|
|
93
|
+
export const mcpGrantNameProblem = (server, tool) => (server === "hands" ? MCP_HANDS_WORDS : mcpWireProblem(server, tool));
|
|
94
|
+
/** Why a harness's own MCP client drops or retypes `tool` of `server` (its facts' schemaProblems, `dropped` the first):
|
|
95
|
+
* the words a save's blocker and a saved server's read both say. */
|
|
96
|
+
export const mcpDroppedWords = (server, tool, harness, dropped) => `The MCP server ${server}'s tool ${tool} cannot be offered on ${harness}: ${dropped.replace(/^mcp__\S+: /, "")}.`;
|
|
97
|
+
/** Why the harness drops or retypes the pinned monid endpoint `tool`'s input (its facts' schemaProblems, `dropped` the
|
|
98
|
+
* first, under the endpoint's wire name): the words a save refuses its grant with. */
|
|
99
|
+
export const monidDroppedWords = (tool, harness, dropped) => `The monid endpoint ${tool} cannot be offered on ${harness}: ${dropped.replace(/^monid__\S+: /, "")}. Grant its provider's other endpoints by name, or pick another harness.`;
|
package/dist/tool-plane.d.ts
CHANGED
|
@@ -2,13 +2,14 @@ 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
7
|
/**
|
|
8
8
|
* The capabilities a pack or a revision may grant, by name: the tools the kernel gives a run, bound from serve's closed
|
|
9
9
|
* table (tools.ts) and named the same on every harness that runs them. `web_search` and `web_fetch` resolve to a
|
|
10
10
|
* 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 (`
|
|
11
|
+
* never does), and a catalog's tools (`mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`: catalog tools, which their
|
|
12
|
+
* catalog grants).
|
|
12
13
|
*/
|
|
13
14
|
export declare const CAPABILITIES: readonly ["read", "write", "edit", "web_search", "web_fetch", "browser", "ask_person"];
|
|
14
15
|
/** The providers a user may pick for each capability that has a choice, its default first: `auto`, the native search
|
|
@@ -27,35 +28,39 @@ export declare const PROVIDERS: Readonly<{
|
|
|
27
28
|
}>;
|
|
28
29
|
export type Pickable = keyof typeof PROVIDERS;
|
|
29
30
|
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. */
|
|
31
|
+
/** The permissions `name` may be set to: ask is offered for the tools whose approved call the kernel runs itself, outside
|
|
32
|
+
* the model's turn (tool-list.ts `askable`) and for catalog tools. Any other (browser, ask_person, the call-only ones) is
|
|
33
|
+
* allow or deny. */
|
|
37
34
|
export declare const permissionsOf: (name: string) => readonly Permission[];
|
|
38
35
|
/** A tool's permission as this server applies it to an agent that sets none, as capabilities and an MCP server's read
|
|
39
36
|
* give it: the one in force under the server's settings (`permission`), the owner's default (`default_permission`) and
|
|
40
37
|
* 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
|
-
|
|
38
|
+
export declare const serverGate: (name: string, settings: ToolSettingsMap, effect?: ToolEffect) => {
|
|
39
|
+
default_permission: "ask" | "deny" | "allow";
|
|
40
|
+
permissions: ("ask" | "deny" | "allow")[];
|
|
41
|
+
fallback_allow_reads?: true | undefined;
|
|
42
|
+
allow_reads?: true | undefined;
|
|
43
|
+
permission: "ask" | "deny" | "allow";
|
|
45
44
|
};
|
|
46
45
|
/** 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)
|
|
46
|
+
* workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL), and the host's
|
|
47
|
+
* `tools_search`, `tools_call` and `codemode` (runner/meta-tools.ts): set to deny, one is not offered to a run. */
|
|
48
48
|
export declare const SERVE_OWN_TOOLS: readonly string[];
|
|
49
49
|
/** A computer kind's tools, one settings key per kind, as `browser` holds the browser's family: every desktop tool is
|
|
50
50
|
* held to `desktop`, every phone tool to `phone` (the kernel registry's definitions name the key; tool-gate.ts
|
|
51
51
|
* settingsKeyOf reads it there). Allowed by default like a table tool; allow or deny. */
|
|
52
52
|
export declare const KIND_KEYS: readonly string[];
|
|
53
|
+
/** A decision provider's settings key, its bare id (decisions.ts' providers: Jev, Parallel, OpenRouter's Decisions
|
|
54
|
+
* models): what an agent's learned workflow's decision nodes may ask (learned-workflow.ts, LS-07), and whose keys the
|
|
55
|
+
* runner hands its claim. Allowed by default; allow or deny. A workflow agent's own decisions read no setting of it. */
|
|
56
|
+
export declare const DECISION_PROVIDER_KEYS: readonly string[];
|
|
53
57
|
/** One tool's settings: its provider (a capability that has a choice), its permission, and an MCP tool's pin (the
|
|
54
58
|
* arguments its calls must carry, tool-gate.ts pinRefusal). */
|
|
55
59
|
export type ToolSetting = {
|
|
56
60
|
provider?: string;
|
|
57
61
|
permission?: Permission;
|
|
58
|
-
pin?: Pin; /**
|
|
62
|
+
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. */
|
|
63
|
+
allow_reads?: true; /** bash's policy, an agent's own only (bash-read-only.ts). */
|
|
59
64
|
policy?: BashPolicy; /** Read as a stand-in for a value not offered (checkToolSettings); never shown or written. */
|
|
60
65
|
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. */
|
|
61
66
|
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`. */
|
|
@@ -67,8 +72,9 @@ export declare const MAX_PIN_TEXT = 1024;
|
|
|
67
72
|
/** The one check of a pin, every place that takes one calls it (the server's settings, an agent's, a template's mcp
|
|
68
73
|
* entry, the store's revision bodies at the cutover): `pin` under `at`, an object of 1 to MAX_PIN_ARGS of a tool's
|
|
69
74
|
* top-level arguments (PIN_ARG), each to a JSON scalar (a string of at most MAX_PIN_TEXT characters, a finite number,
|
|
70
|
-
* true or false, or null: left out) or a list of 1 to MAX_PIN_CHOICES of them, the argument one of the list
|
|
71
|
-
*
|
|
75
|
+
* 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
|
|
76
|
+
* `{keys: [...]}`, 1 to MAX_PIN_CHOICES key names (text of 1 to MAX_PIN_TEXT characters) an object argument may hold,
|
|
77
|
+
* nothing else in it (sortedPin is its one form). With
|
|
72
78
|
* `key`, the settings key it is set on, which is one MCP tool's own (`mcp:<server>/<tool>`), never a server's wildcard,
|
|
73
79
|
* whose tools take other arguments, nor any other tool's. */
|
|
74
80
|
export declare function pinIssues(pin: unknown, at: string, key?: string): InputIssue[];
|
|
@@ -273,19 +279,19 @@ export declare function shellUnavailable(name: string, shell: ShellPlace): Resol
|
|
|
273
279
|
* provider choice the provider in force and where it came from, the one that applies when the agent sets none, and what
|
|
274
280
|
* it resolves to on the agent's harness and model. `shell`: where a run of the agent has its shell (runShellOf on its
|
|
275
281
|
* computer setting); a tool of bash's family that leaves out resolves unavailable, saying why (shellUnavailable). */
|
|
276
|
-
export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSettingsMap, agent: Tooling, order: readonly string[], shell?: ShellPlace): ({
|
|
282
|
+
export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSettingsMap, agent: Tooling, order: readonly string[], shell?: ShellPlace, effectOf?: (name: string) => ToolEffect | undefined): ({
|
|
277
283
|
resolved: Resolution;
|
|
278
|
-
permission: "
|
|
284
|
+
permission: "ask" | "deny" | "allow";
|
|
279
285
|
permission_from: import("./refusal-words.js").SettingFrom;
|
|
280
|
-
default_permission: "
|
|
281
|
-
permissions: ("
|
|
286
|
+
default_permission: "ask" | "deny" | "allow";
|
|
287
|
+
permissions: ("ask" | "deny" | "allow")[];
|
|
282
288
|
blurb?: string | undefined;
|
|
283
289
|
name: string;
|
|
284
290
|
} | {
|
|
285
|
-
permission: "
|
|
291
|
+
permission: "ask" | "deny" | "allow";
|
|
286
292
|
permission_from: import("./refusal-words.js").SettingFrom;
|
|
287
|
-
default_permission: "
|
|
288
|
-
permissions: ("
|
|
293
|
+
default_permission: "ask" | "deny" | "allow";
|
|
294
|
+
permissions: ("ask" | "deny" | "allow")[];
|
|
289
295
|
blurb?: string | undefined;
|
|
290
296
|
name: string;
|
|
291
297
|
} | {
|
|
@@ -293,10 +299,10 @@ export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSetting
|
|
|
293
299
|
provider_from: string;
|
|
294
300
|
default_provider: string;
|
|
295
301
|
resolved: Resolution;
|
|
296
|
-
permission: "
|
|
302
|
+
permission: "ask" | "deny" | "allow";
|
|
297
303
|
permission_from: import("./refusal-words.js").SettingFrom;
|
|
298
|
-
default_permission: "
|
|
299
|
-
permissions: ("
|
|
304
|
+
default_permission: "ask" | "deny" | "allow";
|
|
305
|
+
permissions: ("ask" | "deny" | "allow")[];
|
|
300
306
|
blurb?: string | undefined;
|
|
301
307
|
name: string;
|
|
302
308
|
})[];
|
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,15 @@ 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, isCatalogTool,
|
|
33
|
+
import { canonicalPin, defaultPermission, isCatalogTool, 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 { isMcpName, mcpNameOf, parseToolName } from "./tool-names.js";
|
|
34
36
|
/**
|
|
35
37
|
* The capabilities a pack or a revision may grant, by name: the tools the kernel gives a run, bound from serve's closed
|
|
36
38
|
* table (tools.ts) and named the same on every harness that runs them. `web_search` and `web_fetch` resolve to a
|
|
37
39
|
* 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 (`
|
|
40
|
+
* never does), and a catalog's tools (`mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`: catalog tools, which their
|
|
41
|
+
* catalog grants).
|
|
39
42
|
*/
|
|
40
43
|
export const CAPABILITIES = ["read", "write", "edit", "web_search", "web_fetch", "browser", "ask_person"];
|
|
41
44
|
/** The providers a user may pick for each capability that has a choice, its default first: `auto`, the native search
|
|
@@ -49,33 +52,49 @@ export const CAPABILITIES = ["read", "write", "edit", "web_search", "web_fetch",
|
|
|
49
52
|
* (browserBy). */
|
|
50
53
|
export const PROVIDERS = Object.freeze({ web_search: ["auto", "native", "exa-keyless", "parallel", "off"], web_fetch: ["kernel", "parallel"], browser: Object.freeze(["auto", ...browserProviderIds(), "chrome"]) });
|
|
51
54
|
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"]);
|
|
55
|
+
/** The permissions `name` may be set to: ask is offered for the tools whose approved call the kernel runs itself, outside
|
|
56
|
+
* the model's turn (tool-list.ts `askable`) and for catalog tools. Any other (browser, ask_person, the call-only ones) is
|
|
57
|
+
* allow or deny. */
|
|
58
|
+
export const permissionsOf = (name) => (Object.hasOwn(SHELL_FAMILY, name) && SHELL_FAMILY[name] !== name ? permissionsOf(SHELL_FAMILY[name]) : isAskable(name) || isCatalogTool(name) ? PERMISSIONS : ["allow", "deny"]);
|
|
60
59
|
/** A tool's permission as this server applies it to an agent that sets none, as capabilities and an MCP server's read
|
|
61
60
|
* give it: the one in force under the server's settings (`permission`), the owner's default (`default_permission`) and
|
|
62
61
|
* 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) =>
|
|
62
|
+
export const serverGate = (name, settings, effect) => {
|
|
63
|
+
const permission = permissionOf(name, settings, {}, "ask", effect);
|
|
64
|
+
// `allow_reads`: the allow is its server's "allow reads" (a read-only tool's ask lifted), not a setting or a default.
|
|
65
|
+
const lifted = effect === "read" && permission === "allow" && permissionOf(name, settings) === "ask";
|
|
66
|
+
// `fallback_allow_reads`: with no permission on the tool's own key, its server's "allow reads" would lift its ask, so
|
|
67
|
+
// allow is what applies once that setting goes, whatever the setting says now (the console's "allow reads" fallback).
|
|
68
|
+
const unset = effect === "read" ? withoutOwnPermission(name, settings) : undefined;
|
|
69
|
+
const falls = unset !== undefined && permissionOf(name, unset, {}, "ask", effect) === "allow" && permissionOf(name, unset) === "ask";
|
|
70
|
+
return { permission, ...(lifted ? { allow_reads: true } : {}), ...(falls ? { fallback_allow_reads: true } : {}), default_permission: defaultPermission(name), permissions: [...permissionsOf(name)] };
|
|
71
|
+
};
|
|
72
|
+
/** `settings` with no permission on `name`'s own key (its other fields kept), a copy that keeps the map's marks
|
|
73
|
+
* (SETTINGS_UNREAD, carried by the spread). */
|
|
74
|
+
const withoutOwnPermission = (name, settings) => {
|
|
75
|
+
const own = settings[name];
|
|
76
|
+
if (own?.permission === undefined)
|
|
77
|
+
return settings;
|
|
78
|
+
const { permission: _gone, ...kept } = own;
|
|
79
|
+
return { ...settings, [name]: kept };
|
|
80
|
+
};
|
|
64
81
|
/** 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
|
-
|
|
82
|
+
* workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL), and the host's
|
|
83
|
+
* `tools_search`, `tools_call` and `codemode` (runner/meta-tools.ts): set to deny, one is not offered to a run. */
|
|
84
|
+
export const SERVE_OWN_TOOLS = ["learned_workflow", ...META_TOOLS];
|
|
67
85
|
/** A computer kind's tools, one settings key per kind, as `browser` holds the browser's family: every desktop tool is
|
|
68
86
|
* held to `desktop`, every phone tool to `phone` (the kernel registry's definitions name the key; tool-gate.ts
|
|
69
87
|
* settingsKeyOf reads it there). Allowed by default like a table tool; allow or deny. */
|
|
70
88
|
export const KIND_KEYS = ["desktop", "phone"];
|
|
89
|
+
/** A decision provider's settings key, its bare id (decisions.ts' providers: Jev, Parallel, OpenRouter's Decisions
|
|
90
|
+
* models): what an agent's learned workflow's decision nodes may ask (learned-workflow.ts, LS-07), and whose keys the
|
|
91
|
+
* runner hands its claim. Allowed by default; allow or deny. A workflow agent's own decisions read no setting of it. */
|
|
92
|
+
export const DECISION_PROVIDER_KEYS = ["jev", "parallel", "openrouter"];
|
|
71
93
|
/** 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
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
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}))$/;
|
|
77
|
-
const isToolSettingsKey = (name) => TOOL_KEY.test(name);
|
|
78
|
-
const isSettingsKey = (name) => isToolSettingsKey(name) && (TABLE_TOOLS.includes(name) || SERVE_OWN_TOOLS.includes(name) || KIND_KEYS.includes(name) || isCatalogTool(name) || /^mcp:[^/]+\/\*$/.test(name));
|
|
94
|
+
* decision provider's (DECISION_PROVIDER_KEYS), a
|
|
95
|
+
* catalog tool (`mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`), or a group's wildcard (`mcp:<server>/*`,
|
|
96
|
+
* `monid:<provider>/*`), which sets each of its tools. */
|
|
97
|
+
const isSettingsKey = (name) => parseToolName(name) !== undefined && (isTableTool(name) || SERVE_OWN_TOOLS.includes(name) || KIND_KEYS.includes(name) || DECISION_PROVIDER_KEYS.includes(name) || isCatalogTool(name));
|
|
79
98
|
/** The longest pinned string. */
|
|
80
99
|
export const MAX_PIN_TEXT = 1024;
|
|
81
100
|
/** A pinned argument's name: a top-level argument of the tool, as MCP tools name theirs. */
|
|
@@ -83,12 +102,13 @@ const PIN_ARG = /^[A-Za-z_][A-Za-z0-9_.-]{0,127}$/;
|
|
|
83
102
|
/** The one check of a pin, every place that takes one calls it (the server's settings, an agent's, a template's mcp
|
|
84
103
|
* entry, the store's revision bodies at the cutover): `pin` under `at`, an object of 1 to MAX_PIN_ARGS of a tool's
|
|
85
104
|
* top-level arguments (PIN_ARG), each to a JSON scalar (a string of at most MAX_PIN_TEXT characters, a finite number,
|
|
86
|
-
* true or false, or null: left out) or a list of 1 to MAX_PIN_CHOICES of them, the argument one of the list
|
|
87
|
-
*
|
|
105
|
+
* 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
|
|
106
|
+
* `{keys: [...]}`, 1 to MAX_PIN_CHOICES key names (text of 1 to MAX_PIN_TEXT characters) an object argument may hold,
|
|
107
|
+
* nothing else in it (sortedPin is its one form). With
|
|
88
108
|
* `key`, the settings key it is set on, which is one MCP tool's own (`mcp:<server>/<tool>`), never a server's wildcard,
|
|
89
109
|
* whose tools take other arguments, nor any other tool's. */
|
|
90
110
|
export function pinIssues(pin, at, key) {
|
|
91
|
-
if (key !== undefined &&
|
|
111
|
+
if (key !== undefined && !mcpNameOf(key))
|
|
92
112
|
return [{ field: at, reason: "not_allowed", message: `A pin is set on one MCP tool's own key (mcp:<server>/<tool>), never on ${key}.` }];
|
|
93
113
|
const entries = typeof pin === "object" && pin !== null && !Array.isArray(pin) ? Object.entries(pin) : undefined;
|
|
94
114
|
if (!entries || !entries.length || entries.length > MAX_PIN_ARGS)
|
|
@@ -97,10 +117,15 @@ export function pinIssues(pin, at, key) {
|
|
|
97
117
|
return entries.flatMap(([arg, value]) => {
|
|
98
118
|
if (!PIN_ARG.test(arg))
|
|
99
119
|
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` }];
|
|
100
|
-
const held = Array.isArray(value) ? value.length >= 1 && value.length <= MAX_PIN_CHOICES && value.every(scalar) : scalar(value);
|
|
101
|
-
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` }];
|
|
120
|
+
const held = Array.isArray(value) ? value.length >= 1 && value.length <= MAX_PIN_CHOICES && value.every(scalar) : isPinKeys(value) ? keysRead(value) : scalar(value);
|
|
121
|
+
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` }];
|
|
102
122
|
});
|
|
103
123
|
}
|
|
124
|
+
/** 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. */
|
|
125
|
+
const keysRead = (value) => {
|
|
126
|
+
const { keys, ...rest } = value;
|
|
127
|
+
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);
|
|
128
|
+
};
|
|
104
129
|
/** `pin` in the one form a revision's body keeps (tool-gate.ts canonicalPin): its arguments sorted, each one-of list
|
|
105
130
|
* de-duplicated and sorted, null first, then by each value's JSON text. Equal meanings are one text, so one revision. */
|
|
106
131
|
export const sortedPin = (pin) => canonicalPin(pin);
|
|
@@ -369,9 +394,9 @@ export function settingsIssues(value, at = "", layer = "server") {
|
|
|
369
394
|
return Object.entries(value).flatMap(([name, setting]) => {
|
|
370
395
|
const pickable = Object.hasOwn(PROVIDERS, name);
|
|
371
396
|
if (!isSettingsKey(name))
|
|
372
|
-
return [{ field: field(name), reason: "not_allowed", message: `Tool settings are kept for this server's tools (${[...
|
|
397
|
+
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.` }];
|
|
373
398
|
if (!isPlain(setting))
|
|
374
|
-
return [{ field: field(name), reason: "wrong_type", message: `${field(name)} is an object, {${pickable ? "provider, " : ""}permission${
|
|
399
|
+
return [{ field: field(name), reason: "wrong_type", message: `${field(name)} is an object, {${pickable ? "provider, " : ""}permission${isMcpName(name) ? ", pin" : ""}${layer === "agent" && name === "bash" ? ", policy" : ""}}` }];
|
|
375
400
|
return Object.entries(setting).flatMap(([key, given]) => {
|
|
376
401
|
if (key === "pin")
|
|
377
402
|
return pinIssues(given, field(name, key), name);
|
|
@@ -384,13 +409,19 @@ export function settingsIssues(value, at = "", layer = "server") {
|
|
|
384
409
|
// The server's own mark of a pin in its file that does not read (withDefaults serves it), which a whole-map save
|
|
385
410
|
// sends back: it keeps the broken pin, and nothing else. Never an agent's.
|
|
386
411
|
if (key === "pin_broken") {
|
|
387
|
-
if (layer === "agent" || !
|
|
412
|
+
if (layer === "agent" || !mcpNameOf(name))
|
|
388
413
|
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.` }];
|
|
389
414
|
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` }];
|
|
390
415
|
}
|
|
416
|
+
// "Allow reads" (tool-gate.ts readsLift): the server's, on an MCP server's wildcard only; false clears it.
|
|
417
|
+
if (key === "allow_reads") {
|
|
418
|
+
if (layer === "agent" || !/^mcp:[^/]+\/\*$/.test(name))
|
|
419
|
+
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}`}.` }];
|
|
420
|
+
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` }];
|
|
421
|
+
}
|
|
391
422
|
if (key === "permission") {
|
|
392
423
|
// A wildcard sets each tool of its server's: a catalog tool's permissions.
|
|
393
|
-
const offered = permissionsOf(
|
|
424
|
+
const offered = permissionsOf(name);
|
|
394
425
|
return offered.includes(given) ? [] : [{ field: field(name, key), reason: "not_an_option", message: `${field(name, key)} is one of ${offered.join(", ")}` }];
|
|
395
426
|
}
|
|
396
427
|
if (key !== "provider" || !pickable)
|
|
@@ -409,14 +440,14 @@ export function canonicalToolSettings(map) {
|
|
|
409
440
|
return sorted(Object.fromEntries(Object.entries(map).flatMap(([name, setting]) => {
|
|
410
441
|
if (!setting)
|
|
411
442
|
return [];
|
|
412
|
-
const kept = sorted({ ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.pin ? { pin: sortedPin(setting.pin) } : {}), ...(setting.policy ? { policy: setting.policy } : {}), ...(setting.provider ? { provider: setting.provider } : {}) });
|
|
443
|
+
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.provider ? { provider: setting.provider } : {}) });
|
|
413
444
|
return Object.keys(kept).length ? [[name, kept]] : [];
|
|
414
445
|
})));
|
|
415
446
|
}
|
|
416
447
|
/** `map` with each capability's provider, its default where none is picked; a permission where one is set. */
|
|
417
448
|
export const withDefaults = (map) => ({
|
|
418
449
|
// As served: what is in force, never the internal mark of a stand-in.
|
|
419
|
-
...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 } : {}) }])),
|
|
450
|
+
...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 } : {}) }])),
|
|
420
451
|
...Object.fromEntries(PICKABLE.map((name) => [name, { provider: map[name]?.provider ?? PROVIDERS[name][0], ...(map[name]?.permission ? { permission: map[name].permission } : {}) }])),
|
|
421
452
|
});
|
|
422
453
|
/** An empty settings map marked as standing for settings that do not read (SETTINGS_UNREAD, tool-gate.ts): every reader
|
|
@@ -453,7 +484,7 @@ export function checkToolSettings(read, where) {
|
|
|
453
484
|
kept.pin = setting.pin;
|
|
454
485
|
}
|
|
455
486
|
if (setting.permission !== undefined) {
|
|
456
|
-
const offered = permissionsOf(
|
|
487
|
+
const offered = permissionsOf(name);
|
|
457
488
|
if (offered.includes(setting.permission))
|
|
458
489
|
kept.permission = setting.permission;
|
|
459
490
|
else {
|
|
@@ -495,7 +526,7 @@ export async function loadToolSettings(store) {
|
|
|
495
526
|
* SHELL_WATCHERS). A different permission is a choice, written as given. */
|
|
496
527
|
export function keptSettings(map, current) {
|
|
497
528
|
const kept = Object.fromEntries(Object.entries(map).flatMap(([name, setting]) => {
|
|
498
|
-
const set = { ...(setting?.provider ? { provider: setting.provider } : {}), ...(setting?.permission ? { permission: setting.permission } : {}), ...(setting?.pin ? { pin: setting.pin } : {}) };
|
|
529
|
+
const set = { ...(setting?.provider ? { provider: setting.provider } : {}), ...(setting?.permission ? { permission: setting.permission } : {}), ...(setting?.allow_reads === true ? { allow_reads: true } : {}), ...(setting?.pin ? { pin: setting.pin } : {}) };
|
|
499
530
|
const before = current[name];
|
|
500
531
|
if (before?.fallback && set.permission === before.permission)
|
|
501
532
|
Object.assign(set, { fallback: true, raw: before.raw });
|
|
@@ -503,7 +534,7 @@ export function keptSettings(map, current) {
|
|
|
503
534
|
Object.assign(set, { brokenPin: true, rawPin: before.rawPin });
|
|
504
535
|
return Object.keys(set).length ? [[name, set]] : [];
|
|
505
536
|
}));
|
|
506
|
-
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 } : {}) }]));
|
|
537
|
+
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 } : {}) }]));
|
|
507
538
|
return { kept, written };
|
|
508
539
|
}
|
|
509
540
|
/** Replaces the server's tool settings in the one store, by keptSettings's rule: a tool `map` leaves out takes its
|
|
@@ -533,13 +564,15 @@ export function shellUnavailable(name, shell) {
|
|
|
533
564
|
* provider choice the provider in force and where it came from, the one that applies when the agent sets none, and what
|
|
534
565
|
* it resolves to on the agent's harness and model. `shell`: where a run of the agent has its shell (runShellOf on its
|
|
535
566
|
* computer setting); a tool of bash's family that leaves out resolves unavailable, saying why (shellUnavailable). */
|
|
536
|
-
export function agentTools(env, settings, agent, order, shell = "computer") {
|
|
567
|
+
export function agentTools(env, settings, agent, order, shell = "computer", effectOf = () => undefined) {
|
|
537
568
|
const plane = planeFor(env, agent, settings);
|
|
538
569
|
const rank = (name) => order.indexOf(name);
|
|
539
570
|
return [...new Set(agent.tools)].sort((a, b) => rank(a) - rank(b)).map((name) => {
|
|
540
|
-
|
|
541
|
-
const
|
|
542
|
-
|
|
571
|
+
// An MCP tool's effect as its saved server lists it now (what a run started now pins): "allow reads" reads it.
|
|
572
|
+
const effect = effectOf(name);
|
|
573
|
+
const { permission, from } = permissionFrom(name, settings, (agent.overrides ?? {}), agent.approvals ?? "ask", {}, effect);
|
|
574
|
+
const gate = { permission, permission_from: from, default_permission: permissionOf(name, settings, {}, "ask", effect), permissions: [...permissionsOf(name)] };
|
|
575
|
+
// One short line for people (tool-list.ts), as capabilities serves it.
|
|
543
576
|
const blurb = blurbOf(name);
|
|
544
577
|
const shown = { name, ...(blurb ? { blurb } : {}) };
|
|
545
578
|
// A tool of bash's family the agent's computer gives no shell for: unavailable, in the words its run's call gets.
|