@parcha/agentrun-serve 0.1.0-beta.35 → 0.1.0-beta.37
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 +298 -0
- package/README.md +417 -219
- package/dist/adapters.d.ts +12 -2
- package/dist/adapters.js +27 -2
- package/dist/agent-rows.d.ts +2 -1
- package/dist/agents-store.d.ts +2 -0
- package/dist/agents-store.js +9 -4
- package/dist/api-only.d.ts +2 -1
- package/dist/api-only.js +3 -1
- package/dist/archil-routes.d.ts +40 -7
- package/dist/archil-routes.js +167 -54
- package/dist/archil-settings.d.ts +79 -7
- package/dist/archil-settings.js +140 -14
- 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/attach-images.d.ts +15 -0
- package/dist/attach-images.js +59 -0
- package/dist/background.d.ts +0 -6
- package/dist/background.js +0 -28
- package/dist/box-image.d.ts +1 -97
- package/dist/box-image.js +4 -284
- package/dist/box-paths.d.ts +2 -7
- package/dist/box-paths.js +7 -13
- package/dist/box-settings.d.ts +0 -11
- package/dist/box-settings.js +4 -29
- package/dist/browser-commands.js +1 -1
- package/dist/browser-computer.d.ts +47 -3
- package/dist/browser-computer.js +286 -18
- package/dist/browser-cost.d.ts +1 -1
- package/dist/browser-live.d.ts +20 -8
- package/dist/browser-live.js +50 -27
- package/dist/browser-person.d.ts +19 -2
- package/dist/browser-person.js +55 -6
- package/dist/browser-wait-ended.d.ts +23 -0
- package/dist/browser-wait-ended.js +42 -0
- package/dist/cap.d.ts +12 -57
- package/dist/cap.js +20 -160
- package/dist/catalog.d.ts +1 -12
- package/dist/catalog.js +3 -33
- package/dist/cli.js +17 -26
- package/dist/composio-preset.d.ts +36 -0
- package/dist/composio-preset.js +179 -0
- package/dist/computer-attach.d.ts +125 -0
- package/dist/computer-attach.js +330 -0
- package/dist/computer-calls.d.ts +48 -0
- package/dist/computer-calls.js +126 -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 +160 -0
- package/dist/computer-live.js +643 -0
- package/dist/computer-routes.d.ts +1 -4
- package/dist/computer-routes.js +3 -5
- package/dist/computer-setting.d.ts +2 -0
- package/dist/computer-setting.js +38 -1
- package/dist/computer-view.d.ts +24 -2
- package/dist/computer-view.js +51 -3
- package/dist/computer-viewer.d.ts +6 -0
- package/dist/computer-viewer.js +297 -0
- package/dist/computers.d.ts +79 -12
- package/dist/computers.js +147 -28
- package/dist/console/assets/index-Cn6JX1uH.js +563 -0
- package/dist/console/assets/index-DRN62V5v.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/docker-daemon.d.ts +2 -2
- package/dist/docker-daemon.js +2 -2
- package/dist/errors.js +5 -5
- package/dist/faux-computers.d.ts +9 -20
- package/dist/faux-computers.js +56 -24
- package/dist/files.d.ts +1 -9
- package/dist/files.js +1 -9
- package/dist/github-connection.d.ts +10 -2
- package/dist/github-connection.js +65 -2
- package/dist/github-faux.js +1 -1
- package/dist/github.d.ts +22 -2
- package/dist/github.js +42 -8
- package/dist/gpu-words.d.ts +14 -0
- package/dist/gpu-words.js +21 -0
- package/dist/graph-view.d.ts +3 -1
- package/dist/graph-view.js +25 -1
- package/dist/handed-values.d.ts +1 -1
- package/dist/handed-values.js +1 -1
- package/dist/harness-install.d.ts +60 -3
- package/dist/harness-install.js +322 -34
- package/dist/harness.d.ts +1 -0
- package/dist/harness.js +36 -2
- package/dist/host-tools.d.ts +9 -10
- package/dist/host-tools.js +7 -7
- package/dist/hosted-search.d.ts +5 -4
- package/dist/hosted-search.js +2 -7
- 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/index.d.ts +1 -3
- package/dist/index.js +1 -2
- package/dist/key-refusal.d.ts +1 -1
- package/dist/key-refusal.js +2 -2
- package/dist/learn/check.d.ts +11 -2
- package/dist/learn/check.js +124 -6
- package/dist/learn/commit.d.ts +43 -7
- package/dist/learn/commit.js +166 -22
- package/dist/learn/folder.d.ts +11 -0
- package/dist/learn/folder.js +37 -1
- package/dist/learn/general.d.ts +66 -0
- package/dist/learn/general.js +73 -0
- package/dist/learn/grade.d.ts +22 -1
- package/dist/learn/grade.js +107 -16
- package/dist/learn/index.d.ts +1 -1
- package/dist/learn/index.js +1 -1
- package/dist/learn/learning.sh +12 -1
- package/dist/learn/notes.d.ts +3 -0
- package/dist/learn/notes.js +3 -0
- package/dist/learn/reflect.d.ts +14 -2
- package/dist/learn/reflect.js +54 -30
- package/dist/learn/skills.d.ts +37 -5
- package/dist/learn/skills.js +60 -7
- package/dist/learned-nodes.d.ts +6 -2
- package/dist/learned-workflow.d.ts +43 -9
- package/dist/learned-workflow.js +128 -37
- package/dist/learning-batch.d.ts +283 -0
- package/dist/learning-batch.js +574 -0
- package/dist/learning-cost.d.ts +79 -0
- package/dist/learning-cost.js +69 -0
- package/dist/learning-evals.d.ts +33 -0
- package/dist/learning-evals.js +98 -0
- package/dist/learning-routes.d.ts +32 -4
- package/dist/learning-routes.js +48 -12
- package/dist/learning-words.d.ts +9 -0
- package/dist/learning-words.js +12 -2
- package/dist/learning.d.ts +39 -19
- package/dist/learning.js +88 -46
- 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/mcp-gateway.d.ts +9 -0
- package/dist/mcp-gateway.js +60 -11
- package/dist/mcp-oauth.d.ts +57 -7
- package/dist/mcp-oauth.js +133 -18
- package/dist/mcp-private-hosts.d.ts +4 -4
- package/dist/mcp-private-hosts.js +20 -12
- package/dist/mcp-probe.d.ts +27 -3
- package/dist/mcp-probe.js +106 -29
- package/dist/mcp-secret-writes.js +8 -0
- package/dist/mcp-servers-store.d.ts +38 -15
- package/dist/mcp-servers-store.js +120 -23
- package/dist/mcp-store.d.ts +10 -4
- package/dist/mcp-store.js +17 -6
- package/dist/model-form.d.ts +26 -0
- package/dist/model-form.js +80 -0
- package/dist/model.d.ts +5 -5
- package/dist/model.js +29 -16
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +586 -64
- package/dist/owner.d.ts +0 -1
- package/dist/owner.js +0 -2
- package/dist/page.d.ts +18 -0
- package/dist/page.js +48 -20
- package/dist/paid-calls.d.ts +1 -1
- package/dist/paid-calls.js +1 -1
- package/dist/place-offers.d.ts +96 -0
- package/dist/place-offers.js +202 -0
- package/dist/place.d.ts +9 -13
- package/dist/place.js +21 -32
- package/dist/port-models.d.ts +2 -1
- package/dist/port-models.js +5 -3
- package/dist/print.d.ts +16 -9
- package/dist/print.js +15 -17
- package/dist/propose.d.ts +4 -0
- package/dist/propose.js +34 -11
- package/dist/provider.js +3 -2
- package/dist/reflect-range.d.ts +8 -1
- package/dist/reflect-range.js +1 -1
- package/dist/run-cut.d.ts +5 -0
- package/dist/run-cut.js +19 -0
- package/dist/run-launch.d.ts +28 -3
- package/dist/run-launch.js +14 -4
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-manifest.d.ts +2 -2
- package/dist/run-manifest.js +2 -2
- 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 +3 -3
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-timeline-served.js +56 -44
- package/dist/run-view.d.ts +8 -5
- package/dist/run-view.js +18 -10
- package/dist/runnable.d.ts +2 -2
- package/dist/runnable.js +6 -2
- package/dist/runner/adapter-loop.d.ts +39 -8
- package/dist/runner/adapter-loop.js +770 -83
- package/dist/runner/adapter-run-spec.d.ts +36 -7
- package/dist/runner/adapter-run-spec.js +171 -37
- package/dist/runner/adapters/pi-computer.d.ts +7 -0
- package/dist/runner/adapters/pi-computer.js +43 -0
- package/dist/runner/adapters/pi.d.ts +20 -7
- package/dist/runner/adapters/pi.js +111 -26
- package/dist/runner/beside.d.ts +7 -3
- package/dist/runner/beside.js +26 -12
- 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 +27 -3
- package/dist/runner/cli-run-spec.js +198 -74
- package/dist/runner/commands.d.ts +8 -2
- package/dist/runner/commands.js +31 -6
- package/dist/runner/computer-channel.d.ts +34 -0
- package/dist/runner/computer-channel.js +61 -0
- package/dist/runner/conformance/harness.d.ts +0 -1
- package/dist/runner/conformance/harness.js +87 -18
- package/dist/runner/conformance/subject.d.ts +1 -1
- package/dist/runner/dispatch.js +3 -0
- package/dist/runner/end-of-run.d.ts +22 -12
- package/dist/runner/end-of-run.js +38 -16
- package/dist/runner/github-app.d.ts +2 -1
- package/dist/runner/github-app.js +6 -4
- package/dist/runner/harness-loops.js +16 -2
- package/dist/runner/held-run.d.ts +65 -0
- package/dist/runner/held-run.js +158 -0
- package/dist/runner/journal-kinds.d.ts +35 -6
- package/dist/runner/journal-kinds.js +20 -1
- 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 +37 -1
- package/dist/runner/learning-end.js +115 -14
- package/dist/runner/learning-factory.d.ts +1 -1
- package/dist/runner/learning-factory.js +15 -5
- package/dist/runner/learning-loop.d.ts +139 -7
- package/dist/runner/learning-loop.js +369 -32
- package/dist/runner/learning-seed.d.ts +9 -0
- package/dist/runner/learning-seed.js +14 -1
- package/dist/runner/live-ticker.js +1 -0
- package/dist/runner/loop-contract.d.ts +16 -1
- package/dist/runner/loop-contract.js +6 -0
- package/dist/runner/loop.d.ts +10 -2
- package/dist/runner/loop.js +22 -1
- package/dist/runner/main.d.ts +13 -1
- package/dist/runner/main.js +38 -6
- package/dist/runner/mcp-claim.d.ts +11 -4
- package/dist/runner/mcp-claim.js +140 -23
- package/dist/runner/mcp-github.d.ts +4 -2
- package/dist/runner/mcp-github.js +1 -8
- package/dist/runner/mcp-run.d.ts +6 -4
- package/dist/runner/mcp-run.js +16 -3
- package/dist/runner/metrics.d.ts +15 -2
- package/dist/runner/metrics.js +21 -2
- package/dist/runner/model-route.d.ts +3 -0
- package/dist/runner/model-route.js +5 -2
- package/dist/runner/pr-checkout.d.ts +60 -0
- package/dist/runner/pr-checkout.js +176 -0
- package/dist/runner/reflect-hook.d.ts +19 -0
- package/dist/runner/reflect-hook.js +20 -8
- package/dist/runner/runner.d.ts +26 -0
- package/dist/runner/runner.js +231 -27
- package/dist/runner/scratch-sweep.d.ts +13 -0
- package/dist/runner/scratch-sweep.js +62 -0
- package/dist/runner/sessions.d.ts +1 -1
- package/dist/runner/spec-holds.d.ts +8 -3
- package/dist/runner/spec-holds.js +12 -10
- package/dist/runner/store-port.d.ts +7 -2
- package/dist/runner/store-secrets.js +21 -4
- package/dist/runner/subagent.d.ts +44 -0
- package/dist/runner/subagent.js +190 -0
- package/dist/runner/workflow-host.d.ts +24 -3
- package/dist/runner/workflow-host.js +24 -4
- package/dist/runner/workflow-loop.d.ts +6 -3
- package/dist/runner/workflow-loop.js +9 -8
- package/dist/runner/workflow-spec.d.ts +39 -15
- package/dist/runner/workflow-spec.js +143 -40
- package/dist/runs-over-store.d.ts +16 -6
- package/dist/runs-over-store.js +145 -29
- 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/sealing.js +1 -2
- package/dist/secret-cut.d.ts +1 -1
- package/dist/secret-cut.js +1 -1
- 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 +75 -63
- package/dist/server.js +712 -316
- package/dist/settings-wake.d.ts +21 -0
- package/dist/settings-wake.js +59 -0
- package/dist/standard-webhooks.d.ts +4 -1
- package/dist/standard-webhooks.js +8 -4
- package/dist/store/agent-body.d.ts +9 -2
- package/dist/store/agent-body.js +16 -8
- package/dist/store/command-wake.d.ts +12 -0
- package/dist/store/command-wake.js +37 -0
- package/dist/store/deadline.js +9 -5
- package/dist/store/dialect.d.ts +6 -0
- package/dist/store/dialect.js +5 -0
- package/dist/store/index.d.ts +4 -4
- package/dist/store/index.js +2 -2
- package/dist/store/journal/storage.d.ts +3 -2
- package/dist/store/journal/storage.js +15 -6
- package/dist/store/postgres/connection.js +9 -4
- package/dist/store/postgres/dialect.js +4 -0
- package/dist/store/postgres/migrations/0004_runs_outcome_stop_or_cancel.sql +11 -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/schema.d.ts +2 -1
- package/dist/store/schema.js +85 -13
- package/dist/store/seal.d.ts +13 -0
- package/dist/store/seal.js +19 -0
- package/dist/store/sqlite/connection.d.ts +5 -0
- package/dist/store/sqlite/connection.js +88 -47
- package/dist/store/sqlite/run-patch.d.ts +25 -7
- package/dist/store/sqlite/run-patch.js +58 -14
- package/dist/store/sqlite/store.js +331 -59
- package/dist/store/store.d.ts +330 -21
- package/dist/store/store.js +34 -2
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +2 -4
- package/dist/store-reads/cap.js +16 -7
- package/dist/store-reads/decisions.d.ts +3 -3
- package/dist/store-reads/decisions.js +3 -6
- package/dist/store-reads/import-summary.d.ts +1 -1
- package/dist/store-reads/journal.d.ts +5 -4
- package/dist/store-reads/journal.js +118 -27
- package/dist/store-reads/learning.d.ts +34 -4
- package/dist/store-reads/learning.js +137 -23
- package/dist/store-reads/runs.d.ts +7 -5
- package/dist/store-reads/runs.js +17 -10
- package/dist/store-reads/stats.js +5 -1
- package/dist/store-reads/workflow.d.ts +1 -1
- package/dist/store-view.d.ts +5 -0
- package/dist/store-view.js +70 -29
- package/dist/template-eval.js +8 -5
- package/dist/template-github-permissions.d.ts +22 -8
- package/dist/template-github-permissions.js +35 -15
- package/dist/templates.d.ts +64 -0
- package/dist/templates.js +101 -16
- package/dist/timeline/timeline.d.ts +30 -1
- package/dist/timeline/timeline.js +29 -13
- package/dist/timeline/util.d.ts +4 -0
- package/dist/timeline/util.js +14 -0
- package/dist/tool-blurbs.js +1 -0
- package/dist/tool-budget.d.ts +27 -7
- package/dist/tool-budget.js +21 -9
- package/dist/tool-gate.d.ts +23 -10
- package/dist/tool-gate.js +60 -44
- package/dist/tool-plane.d.ts +46 -28
- package/dist/tool-plane.js +73 -31
- package/dist/tools.d.ts +31 -38
- package/dist/tools.js +117 -74
- 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 +26 -6
- package/dist/trigger-signatures.js +44 -8
- 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 +10 -6
- package/dist/triggers.js +37 -7
- package/dist/turn-end.d.ts +0 -3
- package/dist/turn-end.js +0 -3
- package/dist/turns.js +16 -1
- package/dist/usage-lines.d.ts +1 -1
- package/dist/validate.d.ts +6 -0
- package/dist/validate.js +41 -4
- package/dist/web-fetch.d.ts +1 -1
- package/dist/web-search.d.ts +10 -5
- package/dist/web-search.js +7 -6
- package/dist/webhooks.d.ts +147 -103
- package/dist/webhooks.js +564 -324
- package/dist/workflow/decision-recovery.d.ts +23 -0
- package/dist/workflow/decision-recovery.js +80 -0
- package/dist/workflow/decisions.d.ts +134 -0
- package/dist/workflow/decisions.js +46 -0
- package/dist/workflow/host-session.d.ts +5 -0
- package/dist/workflow/host-session.js +85 -0
- package/dist/workflow/host-tools.d.ts +3 -0
- package/dist/workflow/host-tools.js +3 -0
- package/dist/workflow/node-runner.d.ts +113 -0
- package/dist/workflow/node-runner.js +270 -0
- package/dist/workflow/node.d.ts +89 -0
- package/dist/workflow/node.js +101 -0
- package/dist/workflow/operator-error.d.ts +4 -0
- package/dist/workflow/operator-error.js +4 -0
- package/dist/workflow/pi-versions.d.ts +32 -0
- package/dist/workflow/pi-versions.js +65 -0
- package/dist/workflow/record-file.d.ts +10 -0
- package/dist/workflow/record-file.js +56 -0
- package/dist/workflow/record-tool.d.ts +77 -0
- package/dist/workflow/record-tool.js +126 -0
- package/dist/workflow/record.d.ts +151 -0
- package/dist/workflow/record.js +401 -0
- package/dist/workflow/run-error.d.ts +16 -0
- package/dist/workflow/run-error.js +26 -0
- package/dist/workflow/runner.d.ts +6 -0
- package/dist/workflow/runner.js +240 -0
- package/dist/workflow/store.d.ts +23 -0
- package/dist/workflow/store.js +242 -0
- package/dist/workflow/task.d.ts +133 -0
- package/dist/workflow/task.js +412 -0
- package/dist/workflow/thinking.d.ts +3 -0
- package/dist/workflow/thinking.js +7 -0
- package/dist/workflow/tool-context.d.ts +21 -0
- package/dist/workflow/tool-context.js +13 -0
- package/dist/workflow/types.d.ts +126 -0
- package/dist/workflow/types.js +1 -0
- package/dist/workflow-run.d.ts +2 -2
- package/dist/workspace/agent-computer.d.ts +137 -0
- package/dist/workspace/agent-computer.js +292 -0
- package/dist/workspace/archil-claim.d.ts +11 -0
- package/dist/workspace/archil-claim.js +18 -10
- package/dist/workspace/archil-disks.d.ts +49 -0
- package/dist/workspace/archil-disks.js +185 -0
- package/dist/workspace/archil-exec.js +2 -3
- package/dist/workspace/archil-mount-credential.d.ts +20 -4
- package/dist/workspace/archil-mount-credential.js +13 -4
- package/dist/workspace/attached-computers.d.ts +41 -0
- package/dist/workspace/attached-computers.js +114 -0
- package/dist/workspace/computer-deps.d.ts +32 -17
- package/dist/workspace/computer-deps.js +37 -14
- package/dist/workspace/computer-for-claim.d.ts +58 -13
- package/dist/workspace/computer-for-claim.js +267 -26
- package/dist/workspace/computer-hold.d.ts +11 -27
- package/dist/workspace/computer-hold.js +36 -56
- package/dist/workspace/computer-janitor.d.ts +3 -2
- package/dist/workspace/computer-janitor.js +43 -9
- package/dist/workspace/computer-ledger.d.ts +5 -1
- package/dist/workspace/computer-ledger.js +11 -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 +37 -0
- package/dist/workspace/computer-script.js +138 -0
- package/dist/workspace/executors.d.ts +1 -1
- package/dist/workspace/index.d.ts +7 -4
- package/dist/workspace/index.js +4 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +119 -84
- package/dist/workspace/kind-skills/phone/SKILL.md +100 -85
- package/dist/workspace/resolve-computer.d.ts +45 -11
- package/dist/workspace/resolve-computer.js +72 -14
- package/dist/workspace/run-disk.d.ts +34 -0
- package/dist/workspace/run-disk.js +91 -0
- package/dist/workspace/run-tools.d.ts +35 -18
- package/dist/workspace/run-tools.js +24 -29
- package/dist/workspace/server-run-workspace.d.ts +3 -2
- package/dist/workspace/server-run-workspace.js +17 -4
- package/dist/workspace.js +1 -1
- package/package.json +19 -21
- package/templates/README.md +9 -6
- package/templates/code-review/agent.md +27 -11
- package/templates/code-review/evals/clean-refactor/graders/coverage.md +4 -0
- package/templates/code-review/evals/clean-refactor/graders/risk.md +5 -0
- package/templates/code-review/evals/injection/graders/ignores.md +1 -1
- package/templates/code-review/evals/never-flag/case.yaml +3 -0
- package/templates/code-review/evals/never-flag/graders/only-p0.md +4 -0
- package/templates/code-review/evals/never-flag/graders/schema.md +5 -0
- package/templates/code-review/evals/never-flag/prompt.md +30 -0
- package/templates/code-review/evals/null-name/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +6 -5
- package/templates/code-review/evals/re-review/graders/resolves.md +1 -1
- package/templates/code-review/evals/re-review/prompt.md +1 -1
- package/templates/code-review/evals/re-review-open/case.yaml +3 -0
- package/templates/code-review/evals/re-review-open/graders/schema.md +5 -0
- package/templates/code-review/evals/re-review-open/graders/stays-open.md +4 -0
- package/templates/code-review/evals/re-review-open/prompt.md +27 -0
- package/templates/code-review/evals/repo-rule/graders/cites.md +1 -1
- package/templates/code-review/evals/two-defects/case.yaml +3 -0
- package/templates/code-review/evals/two-defects/graders/both.md +4 -0
- package/templates/code-review/evals/two-defects/graders/schema.md +5 -0
- package/templates/code-review/evals/two-defects/prompt.md +25 -0
- package/templates/code-review/findings.schema.json +131 -27
- package/templates/code-review/rules/CODEREVIEW.md +76 -0
- package/templates/code-review/skills/review/DEEP.md +130 -0
- package/templates/code-review/skills/review/REVIEWER.md +116 -0
- package/templates/code-review/skills/review/SKILL.md +104 -154
- package/templates/market-monitor/agent.md +1 -1
- package/dist/box/record.d.ts +0 -6
- package/dist/box/record.js +0 -41
- package/dist/box/sweep.d.ts +0 -53
- package/dist/box/sweep.js +0 -193
- package/dist/box-egress-vm.d.ts +0 -118
- package/dist/box-egress-vm.js +0 -354
- package/dist/box-egress.d.ts +0 -105
- package/dist/box-egress.js +0 -256
- package/dist/box-relay-vm.d.ts +0 -84
- package/dist/box-relay-vm.js +0 -437
- package/dist/box-relay.d.ts +0 -36
- package/dist/box-relay.js +0 -207
- package/dist/boxes.d.ts +0 -109
- package/dist/boxes.js +0 -249
- package/dist/budget.d.ts +0 -71
- package/dist/budget.js +0 -199
- package/dist/console/assets/index-B7NKTU8E.css +0 -1
- package/dist/console/assets/index-CXZMgJE7.js +0 -550
- package/dist/daytona-api.d.ts +0 -10
- package/dist/daytona-api.js +0 -20
- package/dist/egress-proxy.d.ts +0 -45
- package/dist/egress-proxy.js +0 -416
- package/dist/egress-table.d.ts +0 -24
- package/dist/egress-table.js +0 -165
- package/dist/run-db.d.ts +0 -53
- package/dist/run-db.js +0 -116
- package/templates/code-review/rules/REVIEW.md +0 -41
package/dist/mcp-probe.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ApiError, type InputIssue } from "./errors.js";
|
|
2
2
|
export declare const MCP_SERVER_NAME: RegExp;
|
|
3
|
-
|
|
3
|
+
/** `per_run`: the server keeps no credential; each run's caller hands one with the run (mcp_auth), held for that run alone. */
|
|
4
|
+
export declare const MCP_AUTH_TYPES: readonly ["none", "bearer", "headers", "oauth", "github_app", "per_run"];
|
|
4
5
|
/** Why a saved credential can't be used for a run's calls, each with its own remedy and no other, as the model reads it
|
|
5
6
|
* after "The MCP server <name>'s credential can't be used right now: " (mcp-gateway.ts). The one place they are said. */
|
|
6
7
|
export declare const UNUSABLE: {
|
|
@@ -12,6 +13,8 @@ export declare const UNUSABLE: {
|
|
|
12
13
|
readonly silent: "the sign-in server didn't answer; try again";
|
|
13
14
|
/** An access token past its expiry whose refresh the address check refused unsent (mcp-oauth.ts), followed by its words. */
|
|
14
15
|
readonly blocked: "its sign-in server's address is refused here";
|
|
16
|
+
/** A per_run server's run that was handed no credential for it (mcp_auth), or whose credential was erased at its end. */
|
|
17
|
+
readonly perRunMissing: "this server takes its credential from each run, and this run was handed none: its caller sends one as mcp_auth when it starts the run or sends it a message";
|
|
15
18
|
};
|
|
16
19
|
export declare const REFRESH_MARGIN_MS: number;
|
|
17
20
|
/** How long an access token given with no expiry is taken to last: it is refreshed within the margin of then. */
|
|
@@ -79,9 +82,29 @@ export declare const canonical: (value: unknown) => string;
|
|
|
79
82
|
/** The body's prices: each tool's USD a call, a finite number, 0 or more. Which tools the server lists is checked once
|
|
80
83
|
* it has listed them. */
|
|
81
84
|
export declare function pricesOf(value: unknown, issues: InputIssue[]): McpPrices | undefined;
|
|
85
|
+
/** Query parameter names that look like a credential, compared lowercase with every "-" and "_" gone: an MCP server's url
|
|
86
|
+
* is kept and shown in plain text (its row's url, every read, the console), so a credential belongs in a header. Only
|
|
87
|
+
* names that say they hold one: a bare `key`, `session` or `sessionid` names a server's own lookup or routing value as
|
|
88
|
+
* often (?key=docs, ?session=eu-1), so those stay the server's. */
|
|
89
|
+
export declare const CREDENTIAL_QUERY_NAMES: readonly string[];
|
|
90
|
+
/** The first query parameter of `url` whose name looks like a credential, if any: a saved row's URL is held to it at each
|
|
91
|
+
* use (the server's preview, refresh and sign-in, the runner's claim) as a new one is at its save. */
|
|
92
|
+
export declare function credentialInQuery(url: string | URL): string | undefined;
|
|
93
|
+
/** An MCP server's URL as every read shows it: its origin, and "/…" for a path or query, which is held as a secret (a
|
|
94
|
+
* provider may put a key in either: Zapier's /mcp/<key>/sse, a ?token= no list names). The whole URL is used only to call
|
|
95
|
+
* the server. A body that sends this back unchanged for a saved server means its saved URL (savedOrGiven). */
|
|
96
|
+
export declare function shownUrl(url: string): string;
|
|
97
|
+
/** A body's URL for saved server `saved`: its saved URL when the body sent back the shown one (shownUrl), else as given. */
|
|
98
|
+
export declare function savedOrGiven(given: unknown, saved: string | undefined): unknown;
|
|
99
|
+
/** What a URL with a credential in its query says, wherever it is refused. */
|
|
100
|
+
export declare const credentialInQueryWords: (name: string) => string;
|
|
82
101
|
export declare function urlOf(value: unknown, issues: InputIssue[]): URL | undefined;
|
|
83
102
|
/** The body's auth: its type and, when it sends one, its credential as the headers it becomes. */
|
|
84
103
|
export declare function authOf(value: unknown, issues: InputIssue[]): Auth | undefined;
|
|
104
|
+
/** A run's `mcp_auth` (POST /runs, POST /agents/{id}/runs, POST /runs/{id}/messages): the headers each named per_run
|
|
105
|
+
* server is called with for this run, `{"<server>": {"headers": {...}}}`. Checked for shape here; that each name is a
|
|
106
|
+
* saved per_run server is the caller's check. Undefined when absent or wrong (with its issues). */
|
|
107
|
+
export declare function mcpAuthOf(value: unknown, issues: InputIssue[]): Record<string, HeaderMap> | undefined;
|
|
85
108
|
/** The OAuth scope list a sign-in body may send: 1 to 32 OAuth scopes. */
|
|
86
109
|
export declare const scopesValid: (scopes: unknown) => boolean;
|
|
87
110
|
/** The longest an OAuth client id or secret a sign-in body may send. */
|
|
@@ -90,5 +113,6 @@ export declare const MAX_OAUTH_VALUE_BYTES = 8192;
|
|
|
90
113
|
export declare const oauthValueValid: (text: unknown) => boolean;
|
|
91
114
|
/** Connect to `url`, agree a protocol revision, and list every tool (all pages), each request held to REQUEST_MS and
|
|
92
115
|
* MAX_RESPONSE_BYTES and the whole to PREVIEW_MS. A failure is an ApiError: 422 auth_required (with the auth the
|
|
93
|
-
* server asks for), 422 not_mcp, 422 input_invalid for a redirect, else 424 upstream_failed.
|
|
94
|
-
|
|
116
|
+
* server asks for), 422 not_mcp, 422 input_invalid for a redirect, else 424 upstream_failed. `send`: how each request
|
|
117
|
+
* goes, the store-backed registry's dialled at the address its check let through (mcp-oauth.ts mcpServerAt, dialAt). */
|
|
118
|
+
export declare function listServer(url: URL, headers: HeaderMap, version: string, stop?: AbortSignal, send?: typeof fetch): Promise<Listed>;
|
package/dist/mcp-probe.js
CHANGED
|
@@ -13,7 +13,8 @@ export const MCP_SERVER_NAME = /^[a-z][a-z0-9-]{0,31}$/;
|
|
|
13
13
|
/** The names AgentRun's own tools are called by, which no MCP server takes: claude-agent calls the kernel's host tools
|
|
14
14
|
* as `mcp__hands__<tool>`, and monid's are `monid_<tool>` (tool-gate.ts settingsKeyOf reads both as AgentRun's). */
|
|
15
15
|
const RESERVED_MCP_NAMES = ["hands", "monid"];
|
|
16
|
-
|
|
16
|
+
/** `per_run`: the server keeps no credential; each run's caller hands one with the run (mcp_auth), held for that run alone. */
|
|
17
|
+
export const MCP_AUTH_TYPES = ["none", "bearer", "headers", "oauth", "github_app", "per_run"];
|
|
17
18
|
/** Where an owner updates a saved MCP server, as people read it. */
|
|
18
19
|
const MCP_SETTINGS = "Settings → MCP servers";
|
|
19
20
|
/** Why a saved credential can't be used for a run's calls, each with its own remedy and no other, as the model reads it
|
|
@@ -27,6 +28,8 @@ export const UNUSABLE = {
|
|
|
27
28
|
silent: "the sign-in server didn't answer; try again",
|
|
28
29
|
/** An access token past its expiry whose refresh the address check refused unsent (mcp-oauth.ts), followed by its words. */
|
|
29
30
|
blocked: "its sign-in server's address is refused here",
|
|
31
|
+
/** A per_run server's run that was handed no credential for it (mcp_auth), or whose credential was erased at its end. */
|
|
32
|
+
perRunMissing: "this server takes its credential from each run, and this run was handed none: its caller sends one as mcp_auth when it starts the run or sends it a message",
|
|
30
33
|
};
|
|
31
34
|
export const REFRESH_MARGIN_MS = 5 * 60_000;
|
|
32
35
|
/** How long an access token given with no expiry is taken to last: it is refreshed within the margin of then. */
|
|
@@ -104,6 +107,38 @@ export function pricesOf(value, issues) {
|
|
|
104
107
|
// Keyed by tool names, which may be an object's own properties (`__proto__`): no prototype to fall into.
|
|
105
108
|
return bad.length ? undefined : Object.assign(Object.create(null), value);
|
|
106
109
|
}
|
|
110
|
+
/** Query parameter names that look like a credential, compared lowercase with every "-" and "_" gone: an MCP server's url
|
|
111
|
+
* is kept and shown in plain text (its row's url, every read, the console), so a credential belongs in a header. Only
|
|
112
|
+
* names that say they hold one: a bare `key`, `session` or `sessionid` names a server's own lookup or routing value as
|
|
113
|
+
* often (?key=docs, ?session=eu-1), so those stay the server's. */
|
|
114
|
+
export const CREDENTIAL_QUERY_NAMES = [
|
|
115
|
+
"token", "accesstoken", "authtoken", "idtoken", "refreshtoken", "sessiontoken", "bearer", "jwt",
|
|
116
|
+
"apikey", "xapikey", "accesskey", "secretkey", "privatekey",
|
|
117
|
+
"secret", "clientsecret", "auth", "authorization", "credential", "credentials",
|
|
118
|
+
"password", "passwd", "pass", "pwd", "sig", "signature",
|
|
119
|
+
];
|
|
120
|
+
const credentialQueryName = (name) => CREDENTIAL_QUERY_NAMES.includes(name.toLowerCase().replace(/[-_]/g, ""));
|
|
121
|
+
/** The first query parameter of `url` whose name looks like a credential, if any: a saved row's URL is held to it at each
|
|
122
|
+
* use (the server's preview, refresh and sign-in, the runner's claim) as a new one is at its save. */
|
|
123
|
+
export function credentialInQuery(url) {
|
|
124
|
+
const parsed = typeof url === "string" ? URL.parse(url) : url;
|
|
125
|
+
return parsed ? [...parsed.searchParams.keys()].find(credentialQueryName) : undefined;
|
|
126
|
+
}
|
|
127
|
+
/** An MCP server's URL as every read shows it: its origin, and "/…" for a path or query, which is held as a secret (a
|
|
128
|
+
* provider may put a key in either: Zapier's /mcp/<key>/sse, a ?token= no list names). The whole URL is used only to call
|
|
129
|
+
* the server. A body that sends this back unchanged for a saved server means its saved URL (savedOrGiven). */
|
|
130
|
+
export function shownUrl(url) {
|
|
131
|
+
const parsed = URL.parse(url);
|
|
132
|
+
if (!parsed)
|
|
133
|
+
return "(not a URL)";
|
|
134
|
+
return `${parsed.origin}/${parsed.pathname !== "/" || parsed.search ? "…" : ""}`;
|
|
135
|
+
}
|
|
136
|
+
/** A body's URL for saved server `saved`: its saved URL when the body sent back the shown one (shownUrl), else as given. */
|
|
137
|
+
export function savedOrGiven(given, saved) {
|
|
138
|
+
return saved !== undefined && typeof given === "string" && given === shownUrl(saved) ? saved : given;
|
|
139
|
+
}
|
|
140
|
+
/** What a URL with a credential in its query says, wherever it is refused. */
|
|
141
|
+
export const credentialInQueryWords = (name) => `${name} in the URL's query looks like a credential; send it as a header instead (Headers).`;
|
|
107
142
|
export function urlOf(value, issues) {
|
|
108
143
|
if (typeof value !== "string" || value === "")
|
|
109
144
|
return void issues.push({ field: "url", reason: value === undefined ? "missing" : "wrong_type", message: "url is the MCP server's Streamable HTTP endpoint, as text." });
|
|
@@ -118,6 +153,8 @@ export function urlOf(value, issues) {
|
|
|
118
153
|
issues.push({ field: "url", reason: "too_long", message: `url is at most ${MAX_URL} characters.` });
|
|
119
154
|
else if (url.username || url.password)
|
|
120
155
|
issues.push({ field: "url", reason: "invalid", message: "url holds a user or password: send a credential as auth instead." });
|
|
156
|
+
else if (credentialInQuery(url))
|
|
157
|
+
issues.push({ field: "url", reason: "invalid", message: credentialInQueryWords(credentialInQuery(url)) });
|
|
121
158
|
else if (url.protocol === "http:" && !LOOPBACK(url.hostname))
|
|
122
159
|
issues.push({ field: "url", reason: "not_https", message: `url is http://${url.host}, which is not this machine's loopback: use https, or http only on loopback.` });
|
|
123
160
|
else if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
@@ -130,7 +167,7 @@ export function authOf(value, issues) {
|
|
|
130
167
|
if (value === undefined)
|
|
131
168
|
return { type: "none" };
|
|
132
169
|
if (!isObject(value))
|
|
133
|
-
return void issues.push({ field: "auth", reason: "wrong_type", message: "auth is {type: none|bearer|headers|oauth|github_app, token?, headers?}." });
|
|
170
|
+
return void issues.push({ field: "auth", reason: "wrong_type", message: "auth is {type: none|bearer|headers|oauth|github_app|per_run, token?, headers?}." });
|
|
134
171
|
const before = issues.length;
|
|
135
172
|
issues.push(...unknownFields(value, ["type", "token", "headers"]).map((issue) => ({ ...issue, field: `auth.${issue.field}` })));
|
|
136
173
|
const type = value.type;
|
|
@@ -147,6 +184,8 @@ export function authOf(value, issues) {
|
|
|
147
184
|
let headers;
|
|
148
185
|
if (type === "github_app" && value.token !== undefined)
|
|
149
186
|
issues.push({ field: "auth.token", reason: "not_allowed", message: "auth.type github_app takes no token: the connected GitHub App's installation token is minted for each run." });
|
|
187
|
+
if (type === "per_run" && value.token !== undefined)
|
|
188
|
+
issues.push({ field: "auth.token", reason: "not_allowed", message: "auth.type per_run takes headers to list the server's tools with, never kept: a run's own credential is its mcp_auth." });
|
|
150
189
|
if ((type === "none" || type === "oauth") && (value.token !== undefined || value.headers !== undefined))
|
|
151
190
|
issues.push({ field: "auth", reason: "not_allowed", message: type === "none" ? "auth.type none sends no credential." : "auth.type oauth takes its credential from a sign-in, never from a body." });
|
|
152
191
|
if (type === "bearer") {
|
|
@@ -157,29 +196,66 @@ export function authOf(value, issues) {
|
|
|
157
196
|
headers = { authorization: `Bearer ${String(value.token)}` };
|
|
158
197
|
}
|
|
159
198
|
}
|
|
160
|
-
if (type === "headers" || type === "github_app") {
|
|
199
|
+
if (type === "headers" || type === "github_app" || type === "per_run") {
|
|
161
200
|
if (type === "headers" && value.token !== undefined)
|
|
162
201
|
issues.push({ field: "auth.token", reason: "not_allowed", message: "Named headers are auth.headers." });
|
|
163
|
-
if (value.headers !== undefined)
|
|
164
|
-
|
|
165
|
-
if (!entries.length || entries.length > MAX_HEADERS)
|
|
166
|
-
issues.push({ field: "auth.headers", reason: "invalid", message: `auth.headers names 1 to ${MAX_HEADERS} headers and their values.` });
|
|
167
|
-
headers = Object.create(null);
|
|
168
|
-
for (const [name, text] of entries) {
|
|
169
|
-
const lower = name.toLowerCase();
|
|
170
|
-
if (!HEADER_NAME.test(name) || RESERVED.has(lower))
|
|
171
|
-
issues.push({ field: `auth.headers.${name}`, reason: "invalid", message: `${name} is not a header a credential may be sent in.` });
|
|
172
|
-
else if (type === "github_app" && lower === "authorization")
|
|
173
|
-
issues.push({ field: `auth.headers.${name}`, reason: "not_allowed", message: "A github_app server's Authorization is the installation token minted for each run, never a saved one." });
|
|
174
|
-
else if (lower in headers)
|
|
175
|
-
issues.push({ field: `auth.headers.${name}`, reason: "duplicate", message: `${name} is named twice.` });
|
|
176
|
-
check(`auth.headers.${name}`, text);
|
|
177
|
-
headers[lower] = String(text);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
202
|
+
if (value.headers !== undefined)
|
|
203
|
+
headers = headersOf("auth.headers", value.headers, issues, type === "github_app" ? "A github_app server's Authorization is the installation token minted for each run, never a saved one." : undefined);
|
|
180
204
|
}
|
|
181
205
|
return issues.length > before ? undefined : { type: type, ...(headers ? { headers } : {}) };
|
|
182
206
|
}
|
|
207
|
+
/** A credential's named headers at `field`: 1 to MAX_HEADERS, each a header a credential may be sent in, its value text
|
|
208
|
+
* with no control character, within MAX_VALUE_BYTES. `noAuthorization`: why Authorization is refused, when it is. */
|
|
209
|
+
function headersOf(field, value, issues, noAuthorization) {
|
|
210
|
+
const entries = isObject(value) ? Object.entries(value) : [];
|
|
211
|
+
if (!entries.length || entries.length > MAX_HEADERS)
|
|
212
|
+
issues.push({ field, reason: "invalid", message: `${field} names 1 to ${MAX_HEADERS} headers and their values.` });
|
|
213
|
+
const headers = Object.create(null);
|
|
214
|
+
for (const [name, text] of entries) {
|
|
215
|
+
const lower = name.toLowerCase();
|
|
216
|
+
const at = `${field}.${name}`;
|
|
217
|
+
if (!HEADER_NAME.test(name) || RESERVED.has(lower))
|
|
218
|
+
issues.push({ field: at, reason: "invalid", message: `${name} is not a header a credential may be sent in.` });
|
|
219
|
+
else if (noAuthorization && lower === "authorization")
|
|
220
|
+
issues.push({ field: at, reason: "not_allowed", message: noAuthorization });
|
|
221
|
+
else if (lower in headers)
|
|
222
|
+
issues.push({ field: at, reason: "duplicate", message: `${name} is named twice.` });
|
|
223
|
+
if (typeof text !== "string" || text === "")
|
|
224
|
+
issues.push({ field: at, reason: "wrong_type", message: `${at} is text, not empty.` });
|
|
225
|
+
else if (CONTROL.test(text))
|
|
226
|
+
issues.push({ field: at, reason: "invalid", message: `${at} holds a control character.` });
|
|
227
|
+
else if (Buffer.byteLength(text) > MAX_VALUE_BYTES)
|
|
228
|
+
issues.push({ field: at, reason: "too_long", message: `${at} is at most ${MAX_VALUE_BYTES} bytes.` });
|
|
229
|
+
headers[lower] = String(text);
|
|
230
|
+
}
|
|
231
|
+
return headers;
|
|
232
|
+
}
|
|
233
|
+
/** The most servers one mcp_auth names. */
|
|
234
|
+
const MAX_MCP_AUTH_SERVERS = 8;
|
|
235
|
+
/** A run's `mcp_auth` (POST /runs, POST /agents/{id}/runs, POST /runs/{id}/messages): the headers each named per_run
|
|
236
|
+
* server is called with for this run, `{"<server>": {"headers": {...}}}`. Checked for shape here; that each name is a
|
|
237
|
+
* saved per_run server is the caller's check. Undefined when absent or wrong (with its issues). */
|
|
238
|
+
export function mcpAuthOf(value, issues) {
|
|
239
|
+
if (value === undefined)
|
|
240
|
+
return undefined;
|
|
241
|
+
const shape = 'mcp_auth is {"<server>": {"headers": {"<name>": "<value>"}}}, one entry for each per_run MCP server the run calls.';
|
|
242
|
+
if (!isObject(value) || !Object.keys(value).length || Object.keys(value).length > MAX_MCP_AUTH_SERVERS)
|
|
243
|
+
return void issues.push({ field: "mcp_auth", reason: isObject(value) ? "invalid" : "wrong_type", message: `${shape} It names 1 to ${MAX_MCP_AUTH_SERVERS} servers.` });
|
|
244
|
+
const before = issues.length;
|
|
245
|
+
const out = Object.create(null);
|
|
246
|
+
for (const [server, entry] of Object.entries(value)) {
|
|
247
|
+
const field = `mcp_auth.${server}`;
|
|
248
|
+
if (!MCP_SERVER_NAME.test(server))
|
|
249
|
+
issues.push({ field, reason: "invalid", message: `${server} is not an MCP server's name.` });
|
|
250
|
+
if (!isObject(entry)) {
|
|
251
|
+
issues.push({ field, reason: "wrong_type", message: shape });
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
issues.push(...unknownFields(entry, ["headers"]).map((issue) => ({ ...issue, field: `${field}.${issue.field}` })));
|
|
255
|
+
out[server] = headersOf(`${field}.headers`, entry.headers, issues);
|
|
256
|
+
}
|
|
257
|
+
return issues.length > before ? undefined : out;
|
|
258
|
+
}
|
|
183
259
|
/** The OAuth scope list a sign-in body may send: 1 to 32 OAuth scopes. */
|
|
184
260
|
export const scopesValid = (scopes) => Array.isArray(scopes) && scopes.length > 0 && scopes.length <= 32 && scopes.every((scope) => typeof scope === "string" && SCOPE.test(scope));
|
|
185
261
|
/** The longest an OAuth client id or secret a sign-in body may send. */
|
|
@@ -188,15 +264,16 @@ export const MAX_OAUTH_VALUE_BYTES = MAX_VALUE_BYTES;
|
|
|
188
264
|
export const oauthValueValid = (text) => typeof text === "string" && text !== "" && !CONTROL.test(text) && Buffer.byteLength(text) <= MAX_VALUE_BYTES;
|
|
189
265
|
/** Connect to `url`, agree a protocol revision, and list every tool (all pages), each request held to REQUEST_MS and
|
|
190
266
|
* MAX_RESPONSE_BYTES and the whole to PREVIEW_MS. A failure is an ApiError: 422 auth_required (with the auth the
|
|
191
|
-
* server asks for), 422 not_mcp, 422 input_invalid for a redirect, else 424 upstream_failed.
|
|
192
|
-
|
|
267
|
+
* server asks for), 422 not_mcp, 422 input_invalid for a redirect, else 424 upstream_failed. `send`: how each request
|
|
268
|
+
* goes, the store-backed registry's dialled at the address its check let through (mcp-oauth.ts mcpServerAt, dialAt). */
|
|
269
|
+
export async function listServer(url, headers, version, stop, send = fetch) {
|
|
193
270
|
const sdk = await import("@modelcontextprotocol/client");
|
|
194
271
|
const deadline = AbortSignal.any([AbortSignal.timeout(PREVIEW_MS), ...(stop ? [stop] : [])]);
|
|
195
272
|
const seen = [];
|
|
196
273
|
let overflow = false;
|
|
197
274
|
const watched = async (input, init) => {
|
|
198
275
|
const signal = AbortSignal.any([deadline, AbortSignal.timeout(REQUEST_MS), ...(init?.signal ? [init.signal] : [])]);
|
|
199
|
-
const res = await
|
|
276
|
+
const res = await send(input, { ...init, redirect: "manual", signal });
|
|
200
277
|
const type = res.headers.get("content-type") ?? "";
|
|
201
278
|
seen.push({ status: res.status, headers: res.headers, rpc: type.startsWith("text/event-stream") ? Promise.resolve(true) : type.includes("json") ? speaksJsonRpc(res.clone()) : Promise.resolve(false) });
|
|
202
279
|
return capped(res, () => (overflow = true));
|
|
@@ -246,13 +323,13 @@ export async function listServer(url, headers, version, stop) {
|
|
|
246
323
|
catch (error) {
|
|
247
324
|
if (error instanceof ApiError)
|
|
248
325
|
throw error;
|
|
249
|
-
throw await refusal(error, seen, overflow, url, headers, deadline, sdk);
|
|
326
|
+
throw await refusal(error, seen, overflow, url, headers, deadline, sdk, send);
|
|
250
327
|
}
|
|
251
328
|
finally {
|
|
252
329
|
await client.close().catch(() => { });
|
|
253
330
|
}
|
|
254
331
|
}
|
|
255
|
-
async function refusal(error, seen, overflow, url, headers, deadline, sdk) {
|
|
332
|
+
async function refusal(error, seen, overflow, url, headers, deadline, sdk, send) {
|
|
256
333
|
const upstream = (message, status) => new ApiError("upstream_failed", message, status ? { details: { status } } : {});
|
|
257
334
|
if (overflow)
|
|
258
335
|
return upstream(`The MCP server answered more than ${MAX_RESPONSE_BYTES / 2 ** 20} MiB in one response.`);
|
|
@@ -269,7 +346,7 @@ async function refusal(error, seen, overflow, url, headers, deadline, sdk) {
|
|
|
269
346
|
}
|
|
270
347
|
const denied = seen.find((one) => one.status === 401 || one.status === 403);
|
|
271
348
|
if (denied) {
|
|
272
|
-
const auth = await authAsked(url, denied.headers, deadline, sdk);
|
|
349
|
+
const auth = await authAsked(url, denied.headers, deadline, sdk, send);
|
|
273
350
|
const sent = Object.keys(headers).length > 0;
|
|
274
351
|
const asks = auth === "oauth" ? `It signs in with OAuth: ${sent ? `${SIGN_IN_AGAIN}, or ` : ""}sign in with POST /v2/settings/mcp-servers/{name}/oauth/start and its url.` : "Send a bearer token or the headers it takes.";
|
|
275
352
|
return new ApiError("auth_required", `The MCP server ${sent ? "refused the credential sent" : "asks for a credential"} (HTTP ${denied.status}). ${asks}`, { details: { auth, status: denied.status } });
|
|
@@ -283,7 +360,7 @@ async function refusal(error, seen, overflow, url, headers, deadline, sdk) {
|
|
|
283
360
|
return upstream(`Could not reach the MCP server at ${url.origin}${causeCode(error) ? ` (${causeCode(error)})` : ""}.`);
|
|
284
361
|
}
|
|
285
362
|
if (!(await Promise.all(seen.map((one) => one.rpc))).some(Boolean))
|
|
286
|
-
return new ApiError("not_mcp", `${url.href} does not speak MCP over Streamable HTTP: it answered HTTP ${seen.at(-1).status} with no JSON-RPC reply.`);
|
|
363
|
+
return new ApiError("not_mcp", `${shownUrl(url.href)} does not speak MCP over Streamable HTTP: it answered HTTP ${seen.at(-1).status} with no JSON-RPC reply.`);
|
|
287
364
|
// The listing's own limit when it was the one that ran out, else one request's.
|
|
288
365
|
if (deadline.aborted || timedOut(error))
|
|
289
366
|
return upstream(deadline.aborted ? `The MCP server did not finish listing its tools within ${PREVIEW_MS / 1000} s.` : `The MCP server did not answer a request within ${REQUEST_MS / 1000} s.`);
|
|
@@ -293,11 +370,11 @@ async function refusal(error, seen, overflow, url, headers, deadline, sdk) {
|
|
|
293
370
|
}
|
|
294
371
|
/** What a 401 or 403 asks for: `oauth` when the server names protected-resource metadata (its WWW-Authenticate, or a
|
|
295
372
|
* well-known document naming an authorization server), else `bearer`. The probe sends no credential. */
|
|
296
|
-
async function authAsked(url, headers, deadline, sdk) {
|
|
373
|
+
async function authAsked(url, headers, deadline, sdk, send) {
|
|
297
374
|
if (sdk.extractWWWAuthenticateParams(new Response(null, { headers })).resourceMetadataUrl)
|
|
298
375
|
return "oauth";
|
|
299
376
|
try {
|
|
300
|
-
const probe = async (input, init) => capped(await
|
|
377
|
+
const probe = async (input, init) => capped(await send(input, { ...init, redirect: "manual", signal: AbortSignal.any([deadline, AbortSignal.timeout(5_000)]) }), () => { });
|
|
301
378
|
const metadata = await sdk.discoverOAuthProtectedResourceMetadata(url, undefined, probe);
|
|
302
379
|
return metadata.authorization_servers?.length ? "oauth" : "bearer";
|
|
303
380
|
}
|
|
@@ -17,6 +17,10 @@ export function mcpWritesSecret(operation, body) {
|
|
|
17
17
|
return true;
|
|
18
18
|
if (operation !== "saveMcpServer" || !isObject(body) || !isObject(body.auth))
|
|
19
19
|
return false;
|
|
20
|
+
// A per_run server keeps no credential: headers sent with its save only list its tools, as a preview's do. The
|
|
21
|
+
// credentials it later receives are the ones each run's own caller hands it (mcp_auth).
|
|
22
|
+
if (body.auth.type === "per_run")
|
|
23
|
+
return false;
|
|
20
24
|
const { token, headers } = body.auth;
|
|
21
25
|
return token !== undefined || (isObject(headers) && Object.keys(headers).length > 0);
|
|
22
26
|
}
|
|
@@ -57,4 +61,8 @@ for (const operation of MCP_SECRET_OPERATIONS)
|
|
|
57
61
|
// A preview keeps nothing, so it is never a secret write; its body's fields are marked secret in the document, so it is
|
|
58
62
|
// registered all the same.
|
|
59
63
|
registerSecretWrite("previewMcpServer", () => false);
|
|
64
|
+
// The Composio preset takes the owner's API key and seals it as an MCP header: both routes are the owner's session alone,
|
|
65
|
+
// whatever the body (the listing sends the key too, and only the session may type one).
|
|
66
|
+
registerSecretWrite("listComposioTools", () => true);
|
|
67
|
+
registerSecretWrite("saveComposioServer", () => true);
|
|
60
68
|
registerNotSecretWrite("refreshMcpServer", "A refresh lists the saved server's tools again with its sealed credential, and writes no credential.");
|
|
@@ -13,6 +13,7 @@ type McpServersStore = {
|
|
|
13
13
|
export declare class McpServersOverStore {
|
|
14
14
|
private readonly store;
|
|
15
15
|
private readonly version;
|
|
16
|
+
private readonly network;
|
|
16
17
|
/** The connected GitHub App's installation token for listing a `github_app` server's tools as it is previewed, saved
|
|
17
18
|
* or refreshed (github-connection.ts tokenForListing); a run's own is minted at its claim (runner/mcp-claim.ts). Set by
|
|
18
19
|
* the server; absent, such a server's tools can't be listed (github_not_connected). */
|
|
@@ -31,9 +32,14 @@ export declare class McpServersOverStore {
|
|
|
31
32
|
/** The callbacks under way, which close() waits out before the server lets its data go. */
|
|
32
33
|
private readonly inflight;
|
|
33
34
|
private readonly stopped;
|
|
35
|
+
/** Whether this server is a local install (attach): only then may an MCP server's URL be on loopback. */
|
|
36
|
+
private loopback;
|
|
34
37
|
constructor(store: McpServersStore, env: NodeJS.ProcessEnv, version: string, network?: OAuthNetwork);
|
|
35
|
-
/** This server's address as a browser reaches it and where it listens.
|
|
36
|
-
|
|
38
|
+
/** This server's address as a browser reaches it and where it listens (McpServers.attach). `local`: whether its
|
|
39
|
+
* operator said this is a local install (ServeOptions.mcpLoopback, the CLI's AGENTRUN_MCP_ALLOW_LOOPBACK=1), the one kind
|
|
40
|
+
* of server an MCP server's URL may be on loopback for. Never inferred from where it listens: a hosted container
|
|
41
|
+
* listens on loopback behind its proxy too. Omitted, or never attached, it is not one. */
|
|
42
|
+
attach(base: string, listening: string, local?: boolean): void;
|
|
37
43
|
clientDocument(): {
|
|
38
44
|
redirect_uris: string[];
|
|
39
45
|
token_endpoint_auth_method?: string | undefined;
|
|
@@ -86,9 +92,9 @@ export declare class McpServersOverStore {
|
|
|
86
92
|
credential: "unreadable" | "sealed" | "expired" | null;
|
|
87
93
|
not_metered?: string[] | undefined;
|
|
88
94
|
tools: {
|
|
89
|
-
permission: "deny" | "
|
|
90
|
-
default_permission: "deny" | "
|
|
91
|
-
permissions: ("deny" | "
|
|
95
|
+
permission: "deny" | "ask" | "allow";
|
|
96
|
+
default_permission: "deny" | "ask" | "allow";
|
|
97
|
+
permissions: ("deny" | "ask" | "allow")[];
|
|
92
98
|
name: string;
|
|
93
99
|
title?: string;
|
|
94
100
|
description?: string;
|
|
@@ -121,9 +127,9 @@ export declare class McpServersOverStore {
|
|
|
121
127
|
credential: "unreadable" | "sealed" | "expired" | null;
|
|
122
128
|
not_metered?: string[] | undefined;
|
|
123
129
|
tools: {
|
|
124
|
-
permission: "deny" | "
|
|
125
|
-
default_permission: "deny" | "
|
|
126
|
-
permissions: ("deny" | "
|
|
130
|
+
permission: "deny" | "ask" | "allow";
|
|
131
|
+
default_permission: "deny" | "ask" | "allow";
|
|
132
|
+
permissions: ("deny" | "ask" | "allow")[];
|
|
127
133
|
name: string;
|
|
128
134
|
title?: string;
|
|
129
135
|
description?: string;
|
|
@@ -140,6 +146,10 @@ export declare class McpServersOverStore {
|
|
|
140
146
|
}>;
|
|
141
147
|
/** POST preview: `{url, auth}`, or `{name}` for a saved server with its sealed credential. Stores nothing. */
|
|
142
148
|
preview(body: Record<string, unknown>, stop?: AbortSignal): Promise<Listed>;
|
|
149
|
+
/** `listing`, and when it is refused as a server that signs in with OAuth (auth_required, `auth: oauth`), whether that
|
|
150
|
+
* sign-in can start with no Client ID entered (`details.oauth.registration`, McpSignIns.registration), so the console
|
|
151
|
+
* asks for one up front. `stop`: the preview's, which cuts that discovery too. */
|
|
152
|
+
private signInNoted;
|
|
143
153
|
/** PUT: preview, then keep the server with the tools listed. A body with no credential keeps the sealed one, while the
|
|
144
154
|
* auth type and the URL's origin stay the same. */
|
|
145
155
|
save(name: string, body: Record<string, unknown>, stop?: AbortSignal, checkedAgainst?: McpCredentialMark): Promise<{
|
|
@@ -159,9 +169,9 @@ export declare class McpServersOverStore {
|
|
|
159
169
|
credential: "unreadable" | "sealed" | "expired" | null;
|
|
160
170
|
not_metered?: string[] | undefined;
|
|
161
171
|
tools: {
|
|
162
|
-
permission: "deny" | "
|
|
163
|
-
default_permission: "deny" | "
|
|
164
|
-
permissions: ("deny" | "
|
|
172
|
+
permission: "deny" | "ask" | "allow";
|
|
173
|
+
default_permission: "deny" | "ask" | "allow";
|
|
174
|
+
permissions: ("deny" | "ask" | "allow")[];
|
|
165
175
|
name: string;
|
|
166
176
|
title?: string;
|
|
167
177
|
description?: string;
|
|
@@ -198,9 +208,9 @@ export declare class McpServersOverStore {
|
|
|
198
208
|
credential: "unreadable" | "sealed" | "expired" | null;
|
|
199
209
|
not_metered?: string[] | undefined;
|
|
200
210
|
tools: {
|
|
201
|
-
permission: "deny" | "
|
|
202
|
-
default_permission: "deny" | "
|
|
203
|
-
permissions: ("deny" | "
|
|
211
|
+
permission: "deny" | "ask" | "allow";
|
|
212
|
+
default_permission: "deny" | "ask" | "allow";
|
|
213
|
+
permissions: ("deny" | "ask" | "allow")[];
|
|
204
214
|
name: string;
|
|
205
215
|
title?: string;
|
|
206
216
|
description?: string;
|
|
@@ -222,7 +232,9 @@ export declare class McpServersOverStore {
|
|
|
222
232
|
private rewriteKeeping;
|
|
223
233
|
/** DELETE. `checkedAgainst`: the credential the secret-write gate let a token's removal through against (one with
|
|
224
234
|
* none: removing it drops no secret); the row goes only while it is still that, in the store's one statement, so a
|
|
225
|
-
* credential saved meanwhile is never dropped by it.
|
|
235
|
+
* credential saved meanwhile is never dropped by it. An OAuth one's sign-in is then let go at its authorization server
|
|
236
|
+
* (its refresh token revoked, RFC 7009, where its metadata names a revocation_endpoint), behind the answer: best effort,
|
|
237
|
+
* never holding or failing the removal. A claimed run sees the removal at its next call (runner/mcp-claim.ts check). */
|
|
226
238
|
remove(name: string, checkedAgainst?: McpCredentialMark): Promise<void>;
|
|
227
239
|
/** POST .../{name}/oauth/start: `{url, scopes?, client_id?, client_secret?}`; answers the URL the owner opens. */
|
|
228
240
|
oauthStart(name: string, body: Record<string, unknown>): Promise<{
|
|
@@ -233,6 +245,13 @@ export declare class McpServersOverStore {
|
|
|
233
245
|
oauthCallback(query: URLSearchParams, stop?: AbortSignal): Promise<string>;
|
|
234
246
|
private callback;
|
|
235
247
|
private listServer;
|
|
248
|
+
/** How a request to the MCP server at `url` goes, or a 422 on url before anything is sent to it (or a token minted for
|
|
249
|
+
* it): a github_app server anywhere but GitHub's hosted MCP (GITHUB_MCP_ONLY, as withAppToken says), and at it, as it
|
|
250
|
+
* is, since that one origin is this server's to name, never the owner's; any other server held to the address rule
|
|
251
|
+
* (mcp-oauth.ts mcpServerAt, the one an authorization server's endpoint is held to), with the private-network hosts the
|
|
252
|
+
* owner allows read now, loopback only for a local install. The fetch it answers dials the address checked. A name
|
|
253
|
+
* that does not resolve is the unreachable server it always was (424). */
|
|
254
|
+
private reached;
|
|
236
255
|
private need;
|
|
237
256
|
/** The saved credential opened, or the refusal that asks for it again. */
|
|
238
257
|
private opened;
|
|
@@ -245,6 +264,10 @@ export declare class McpServersOverStore {
|
|
|
245
264
|
* is checked first (githubMcpUrl), so a row saved at another address never gets a token minted or sent. */
|
|
246
265
|
private withAppToken;
|
|
247
266
|
}
|
|
267
|
+
/** The env that says this server is a local install (cli.ts), the one kind an MCP server may be on loopback for. */
|
|
268
|
+
export declare const MCP_ALLOW_LOOPBACK_ENV = "AGENTRUN_MCP_ALLOW_LOOPBACK";
|
|
269
|
+
/** What a URL on loopback says on a server that is not one, with how to make it one. */
|
|
270
|
+
export declare const loopbackWords: (host: string) => string;
|
|
248
271
|
/** The owner's MCP registry over the one store. No load() is needed: every read goes to the store (the runner also writes
|
|
249
272
|
* the OAuth state), so a read is always current. */
|
|
250
273
|
export declare function mcpServersOverStore(store: McpServersStore, env: NodeJS.ProcessEnv, version: string, network?: OAuthNetwork): McpServersOverStore;
|