@parcha/agentrun-serve 0.1.0-beta.31 → 0.1.0-beta.32
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 +422 -0
- package/NOTICE +18 -0
- package/README.md +887 -241
- package/dist/adapter-facts.d.ts +3 -0
- package/dist/adapter-facts.js +5 -0
- package/dist/adapters.d.ts +64 -140
- package/dist/adapters.js +153 -377
- package/dist/agents-store.d.ts +146 -0
- package/dist/agents-store.js +359 -0
- package/dist/agents.d.ts +5 -3
- package/dist/agents.js +37 -17
- package/dist/app.d.ts +2 -4
- package/dist/app.js +207 -92
- package/dist/approvals.d.ts +4 -0
- package/dist/approvals.js +7 -0
- package/dist/archil-routes.d.ts +45 -0
- package/dist/archil-routes.js +150 -0
- package/dist/archil-settings.d.ts +30 -0
- package/dist/archil-settings.js +34 -0
- package/dist/background.js +28 -9
- package/dist/bounds.d.ts +26 -0
- package/dist/bounds.js +137 -0
- package/dist/box-egress-vm.d.ts +2 -1
- package/dist/box-egress-vm.js +20 -6
- package/dist/box-egress.d.ts +16 -6
- package/dist/box-egress.js +27 -15
- package/dist/box-paths.d.ts +59 -0
- package/dist/box-paths.js +92 -0
- package/dist/box-relay-vm.js +28 -1
- package/dist/box-relay.d.ts +2 -0
- package/dist/box-relay.js +2 -2
- package/dist/boxes.d.ts +13 -1
- package/dist/boxes.js +37 -3
- package/dist/browser-commands.d.ts +43 -0
- package/dist/browser-commands.js +154 -0
- package/dist/browser-cost.d.ts +30 -3
- package/dist/browser-cost.js +276 -21
- package/dist/browser-live.d.ts +124 -0
- package/dist/browser-live.js +324 -0
- package/dist/browser-person.d.ts +168 -0
- package/dist/browser-person.js +769 -0
- package/dist/budget.d.ts +80 -0
- package/dist/budget.js +211 -0
- package/dist/cap.d.ts +272 -62
- package/dist/cap.js +599 -189
- package/dist/cli.js +201 -17
- package/dist/coding-tools.d.ts +13 -1
- package/dist/coding-tools.js +107 -5
- package/dist/computer-adb.d.ts +12 -0
- package/dist/computer-adb.js +14 -0
- package/dist/computer-commands.d.ts +103 -0
- package/dist/computer-commands.js +256 -0
- package/dist/computer-keys.d.ts +68 -0
- package/dist/computer-keys.js +148 -0
- package/dist/computer-routes.d.ts +38 -0
- package/dist/computer-routes.js +56 -0
- package/dist/computer-setting.d.ts +37 -0
- package/dist/computer-setting.js +47 -0
- package/dist/computer-view.d.ts +38 -0
- package/dist/computer-view.js +14 -0
- package/dist/computers.d.ts +137 -0
- package/dist/computers.js +197 -0
- package/dist/console/THIRD-PARTY-NOTICES.txt +25 -0
- package/dist/console/assets/index-35-7aeIZ.js +519 -0
- package/dist/console/assets/index-Cejbov-Y.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +6 -0
- package/dist/decision-cap.d.ts +63 -0
- package/dist/decision-cap.js +163 -0
- package/dist/decision-rows.d.ts +5 -2
- package/dist/decision-rows.js +8 -6
- package/dist/decisions.d.ts +28 -1
- package/dist/decisions.js +63 -6
- package/dist/disk.d.ts +33 -0
- package/dist/disk.js +85 -0
- package/dist/door-line.d.ts +23 -0
- package/dist/door-line.js +83 -0
- package/dist/egress-proxy.d.ts +45 -0
- package/dist/egress-proxy.js +416 -0
- package/dist/egress-table.d.ts +24 -0
- package/dist/egress-table.js +165 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +22 -2
- package/dist/exa-keyless.js +1 -1
- package/dist/explain.d.ts +22 -0
- package/dist/explain.js +207 -0
- package/dist/faux-computers.d.ts +35 -0
- package/dist/faux-computers.js +126 -0
- package/dist/file-types.d.ts +4 -0
- package/dist/file-types.js +11 -0
- package/dist/files.d.ts +3 -35
- package/dist/files.js +9 -120
- package/dist/github-connection.d.ts +207 -0
- package/dist/github-connection.js +595 -0
- package/dist/github.d.ts +64 -0
- package/dist/github.js +119 -0
- package/dist/grade.d.ts +9 -42
- package/dist/grade.js +42 -228
- package/dist/graph-served.d.ts +23 -2
- package/dist/graph-served.js +44 -3
- package/dist/graph-view.d.ts +7 -3
- package/dist/graph-view.js +26 -15
- package/dist/handed-values.d.ts +23 -0
- package/dist/handed-values.js +36 -0
- package/dist/harness-app.d.ts +33 -4
- package/dist/harness-app.js +530 -85
- package/dist/harness-install.d.ts +120 -0
- package/dist/harness-install.js +359 -0
- package/dist/harness-opencode/adapter.js +42 -8
- package/dist/harness-opencode/facts.d.ts +2 -0
- package/dist/harness-opencode/facts.js +28 -0
- package/dist/harness-opencode/harness.d.ts +4 -0
- package/dist/harness-opencode/harness.js +38 -5
- package/dist/harness-opencode/host/policy.js +11 -3
- package/dist/harness-opencode/transcript.d.ts +25 -0
- package/dist/harness-opencode/transcript.js +81 -0
- package/dist/harness-table.d.ts +75 -0
- package/dist/harness-table.js +145 -0
- package/dist/harness.d.ts +7 -28
- package/dist/harness.js +15 -41
- package/dist/heard.d.ts +12 -0
- package/dist/heard.js +45 -0
- package/dist/helper-env.d.ts +4 -0
- package/dist/helper-env.js +14 -0
- package/dist/home-path.d.ts +0 -4
- package/dist/home-path.js +3 -17
- package/dist/host-check.d.ts +4 -3
- package/dist/host-check.js +5 -4
- package/dist/host-tools.d.ts +51 -8
- package/dist/host-tools.js +108 -117
- package/dist/host.d.ts +12 -6
- package/dist/host.js +30 -24
- package/dist/hosted-search.d.ts +3 -0
- package/dist/hosted-search.js +5 -3
- package/dist/import-proxy.d.ts +42 -0
- package/dist/import-proxy.js +105 -0
- package/dist/import-summary.js +4 -8
- package/dist/import-worker.d.ts +2 -3
- package/dist/import-worker.js +18 -16
- package/dist/import.d.ts +37 -17
- package/dist/import.js +208 -222
- package/dist/key-meta.d.ts +26 -0
- package/dist/key-meta.js +30 -0
- package/dist/key-refusal.d.ts +4 -1
- package/dist/key-refusal.js +20 -7
- package/dist/learn/check.d.ts +3 -1
- package/dist/learn/check.js +2 -2
- package/dist/learn/commit.d.ts +86 -0
- package/dist/learn/commit.js +182 -0
- package/dist/learn/folder.d.ts +296 -0
- package/dist/learn/folder.js +796 -0
- package/dist/learn/grade.d.ts +22 -9
- package/dist/learn/grade.js +95 -49
- package/dist/learn/index.d.ts +2 -2
- package/dist/learn/index.js +2 -2
- package/dist/learn/learning.sh +366 -0
- package/dist/learn/reflect.d.ts +12 -5
- package/dist/learn/reflect.js +70 -41
- package/dist/learn/secrets.d.ts +15 -7
- package/dist/learn/secrets.js +66 -16
- package/dist/learn/seed-check.d.ts +74 -0
- package/dist/learn/seed-check.js +103 -0
- package/dist/learn/skills.d.ts +5 -1
- package/dist/learn/skills.js +5 -4
- package/dist/learned-workflow.d.ts +12 -2
- package/dist/learned-workflow.js +9 -5
- package/dist/learning-routes.d.ts +88 -41
- package/dist/learning-routes.js +340 -539
- package/dist/learning-run.d.ts +60 -53
- package/dist/learning-run.js +181 -224
- package/dist/learning-words.d.ts +3 -5
- package/dist/learning-words.js +3 -5
- package/dist/learning.d.ts +177 -112
- package/dist/learning.js +289 -380
- package/dist/live/stream.d.ts +30 -0
- package/dist/live/stream.js +175 -0
- package/dist/live/translate.d.ts +52 -0
- package/dist/live/translate.js +276 -0
- package/dist/llm.js +3 -0
- package/dist/llms.txt +1 -0
- package/dist/local-models.d.ts +23 -0
- package/dist/local-models.js +35 -0
- package/dist/mcp-gateway.d.ts +46 -13
- package/dist/mcp-gateway.js +145 -45
- package/dist/mcp-meta.d.ts +3 -0
- package/dist/mcp-meta.js +14 -2
- package/dist/mcp-oauth.d.ts +172 -0
- package/dist/mcp-oauth.js +403 -0
- package/dist/mcp-private-hosts.d.ts +48 -0
- package/dist/mcp-private-hosts.js +141 -0
- package/dist/mcp-probe.d.ts +101 -0
- package/dist/mcp-probe.js +359 -0
- package/dist/mcp-secret-writes.d.ts +23 -0
- package/dist/mcp-secret-writes.js +60 -0
- package/dist/mcp-servers-store.d.ts +251 -0
- package/dist/mcp-servers-store.js +447 -0
- package/dist/mcp-servers.d.ts +180 -50
- package/dist/mcp-servers.js +284 -321
- package/dist/mcp-store.d.ts +103 -0
- package/dist/mcp-store.js +123 -0
- package/dist/mcp.js +22 -21
- package/dist/model.d.ts +77 -59
- package/dist/model.js +237 -98
- package/dist/monid.d.ts +8 -6
- package/dist/monid.js +39 -25
- package/dist/openapi.d.ts +22 -1
- package/dist/openapi.js +919 -108
- package/dist/owner.d.ts +46 -10
- package/dist/owner.js +123 -43
- package/dist/page.d.ts +10 -0
- package/dist/page.js +27 -4
- package/dist/paid-calls.d.ts +71 -2
- package/dist/paid-calls.js +125 -5
- package/dist/pdf-pages.d.ts +16 -14
- package/dist/pdf-pages.js +88 -58
- package/dist/place.d.ts +15 -13
- package/dist/place.js +25 -15
- package/dist/port-models.d.ts +53 -0
- package/dist/port-models.js +93 -0
- package/dist/propose.d.ts +9 -8
- package/dist/propose.js +82 -49
- package/dist/provider.d.ts +85 -0
- package/dist/provider.js +178 -0
- package/dist/push-handler.d.ts +52 -0
- package/dist/push-handler.js +165 -0
- package/dist/refusal-words.d.ts +23 -0
- package/dist/refusal-words.js +25 -0
- package/dist/request-start.d.ts +6 -1
- package/dist/request-start.js +41 -10
- package/dist/result.d.ts +13 -2
- package/dist/result.js +4 -5
- package/dist/run-box.d.ts +22 -3
- package/dist/run-box.js +78 -17
- package/dist/run-computer.d.ts +24 -0
- package/dist/run-computer.js +15 -0
- package/dist/run-cut.d.ts +33 -0
- package/dist/run-cut.js +42 -0
- package/dist/run-db.d.ts +64 -0
- package/dist/run-db.js +155 -0
- package/dist/run-files.d.ts +31 -0
- package/dist/run-files.js +125 -0
- package/dist/run-holder.d.ts +52 -0
- package/dist/run-holder.js +139 -0
- package/dist/run-launch.d.ts +72 -0
- package/dist/run-launch.js +108 -0
- package/dist/run-learning-served.d.ts +43 -0
- package/dist/run-learning-served.js +16 -0
- package/dist/run-manifest.d.ts +7 -6
- package/dist/run-manifest.js +20 -10
- package/dist/run-reads-over-store.d.ts +102 -0
- package/dist/run-reads-over-store.js +151 -0
- package/dist/run-timeline-served.d.ts +13 -0
- package/dist/run-timeline-served.js +69 -0
- package/dist/run-view.d.ts +436 -0
- package/dist/run-view.js +620 -0
- package/dist/runnable.d.ts +30 -5
- package/dist/runnable.js +149 -72
- package/dist/runner/adapter-loop.d.ts +237 -0
- package/dist/runner/adapter-loop.js +1625 -0
- package/dist/runner/adapter-run-spec.d.ts +216 -0
- package/dist/runner/adapter-run-spec.js +537 -0
- package/dist/runner/adapters/index.d.ts +37 -0
- package/dist/runner/adapters/index.js +66 -0
- package/dist/runner/adapters/pi.d.ts +99 -0
- package/dist/runner/adapters/pi.js +260 -0
- package/dist/runner/beside.d.ts +12 -0
- package/dist/runner/beside.js +30 -0
- package/dist/runner/claim-secrets.d.ts +30 -0
- package/dist/runner/claim-secrets.js +90 -0
- package/dist/runner/cli-run-spec.d.ts +17 -0
- package/dist/runner/cli-run-spec.js +371 -0
- package/dist/runner/commands.d.ts +23 -0
- package/dist/runner/commands.js +67 -0
- package/dist/runner/computer-journal.d.ts +38 -0
- package/dist/runner/computer-journal.js +120 -0
- package/dist/runner/conformance/child.d.ts +1 -0
- package/dist/runner/conformance/child.js +78 -0
- package/dist/runner/conformance/harness.d.ts +89 -0
- package/dist/runner/conformance/harness.js +928 -0
- package/dist/runner/conformance/subject.d.ts +83 -0
- package/dist/runner/conformance/subject.js +1 -0
- package/dist/runner/dispatch.d.ts +30 -0
- package/dist/runner/dispatch.js +99 -0
- package/dist/runner/end-of-run.d.ts +32 -0
- package/dist/runner/end-of-run.js +56 -0
- package/dist/runner/github-app.d.ts +16 -0
- package/dist/runner/github-app.js +37 -0
- package/dist/runner/hand-back.d.ts +43 -0
- package/dist/runner/hand-back.js +69 -0
- package/dist/runner/harness-loops.d.ts +10 -0
- package/dist/runner/harness-loops.js +70 -0
- package/dist/runner/journal-kinds.d.ts +211 -0
- package/dist/runner/journal-kinds.js +116 -0
- package/dist/runner/journal-reader.d.ts +44 -0
- package/dist/runner/journal-reader.js +127 -0
- package/dist/runner/learning-ask.d.ts +37 -0
- package/dist/runner/learning-ask.js +99 -0
- package/dist/runner/learning-dispatch.d.ts +38 -0
- package/dist/runner/learning-dispatch.js +75 -0
- package/dist/runner/learning-end.d.ts +31 -0
- package/dist/runner/learning-end.js +136 -0
- package/dist/runner/learning-factory.d.ts +13 -0
- package/dist/runner/learning-factory.js +37 -0
- package/dist/runner/learning-loop.d.ts +150 -0
- package/dist/runner/learning-loop.js +246 -0
- package/dist/runner/learning-seed.d.ts +30 -0
- package/dist/runner/learning-seed.js +41 -0
- package/dist/runner/live-ticker.d.ts +18 -0
- package/dist/runner/live-ticker.js +88 -0
- package/dist/runner/loop-contract.d.ts +153 -0
- package/dist/runner/loop-contract.js +26 -0
- package/dist/runner/loop.d.ts +79 -0
- package/dist/runner/loop.js +185 -0
- package/dist/runner/main.d.ts +89 -0
- package/dist/runner/main.js +282 -0
- package/dist/runner/mcp-claim.d.ts +67 -0
- package/dist/runner/mcp-claim.js +403 -0
- package/dist/runner/mcp-github.d.ts +53 -0
- package/dist/runner/mcp-github.js +91 -0
- package/dist/runner/mcp-run.d.ts +116 -0
- package/dist/runner/mcp-run.js +152 -0
- package/dist/runner/metrics.d.ts +18 -0
- package/dist/runner/metrics.js +24 -0
- package/dist/runner/model-route.d.ts +111 -0
- package/dist/runner/model-route.js +183 -0
- package/dist/runner/pi-stop.d.ts +6 -0
- package/dist/runner/pi-stop.js +8 -0
- package/dist/runner/redact.d.ts +26 -0
- package/dist/runner/redact.js +51 -0
- package/dist/runner/reflect-hook.d.ts +81 -0
- package/dist/runner/reflect-hook.js +111 -0
- package/dist/runner/runner.d.ts +114 -0
- package/dist/runner/runner.js +672 -0
- package/dist/runner/sessions.d.ts +9 -0
- package/dist/runner/sessions.js +145 -0
- package/dist/runner/side-effects.d.ts +19 -0
- package/dist/runner/side-effects.js +20 -0
- package/dist/runner/spec-holds.d.ts +41 -0
- package/dist/runner/spec-holds.js +58 -0
- package/dist/runner/store-port.d.ts +9 -0
- package/dist/runner/store-port.js +7 -0
- package/dist/runner/store-secrets.d.ts +11 -0
- package/dist/runner/store-secrets.js +105 -0
- package/dist/runner/workflow-adapters.d.ts +1 -0
- package/dist/runner/workflow-adapters.js +4 -0
- package/dist/runner/workflow-host.d.ts +88 -0
- package/dist/runner/workflow-host.js +66 -0
- package/dist/runner/workflow-loop.d.ts +126 -0
- package/dist/runner/workflow-loop.js +372 -0
- package/dist/runner/workflow-spec.d.ts +157 -0
- package/dist/runner/workflow-spec.js +801 -0
- package/dist/runs-over-store.d.ts +203 -0
- package/dist/runs-over-store.js +396 -0
- package/dist/runs.d.ts +351 -220
- package/dist/runs.js +1570 -540
- package/dist/seal-key.d.ts +30 -0
- package/dist/seal-key.js +141 -0
- package/dist/sealed-settings-store.d.ts +71 -0
- package/dist/sealed-settings-store.js +205 -0
- package/dist/sealed-settings.d.ts +60 -0
- package/dist/sealed-settings.js +178 -0
- package/dist/secret-writes.d.ts +147 -0
- package/dist/secret-writes.js +144 -0
- package/dist/secrets.d.ts +7 -0
- package/dist/secrets.js +17 -2
- package/dist/served-only.d.ts +5 -0
- package/dist/served-only.js +12 -0
- package/dist/server-approvers.d.ts +8 -0
- package/dist/server-approvers.js +12 -0
- package/dist/server-fs.d.ts +40 -0
- package/dist/server-fs.js +138 -0
- package/dist/server-keys.d.ts +18 -0
- package/dist/server-keys.js +31 -0
- package/dist/server-lock.js +1 -1
- package/dist/server-secrets-store.d.ts +18 -0
- package/dist/server-secrets-store.js +54 -0
- package/dist/server-secrets.d.ts +23 -0
- package/dist/server-secrets.js +73 -0
- package/dist/server.d.ts +142 -73
- package/dist/server.js +1683 -596
- package/dist/sessions.d.ts +3 -1
- package/dist/sessions.js +8 -4
- package/dist/sign-ins-secrets.d.ts +35 -0
- package/dist/sign-ins-secrets.js +109 -0
- package/dist/sign-ins-store.d.ts +200 -0
- package/dist/sign-ins-store.js +373 -0
- package/dist/sign-ins.d.ts +43 -7
- package/dist/sign-ins.js +94 -18
- package/dist/skills.d.ts +6 -5
- package/dist/skills.js +18 -14
- package/dist/standard-webhooks.d.ts +30 -0
- package/dist/standard-webhooks.js +72 -0
- package/dist/stats.d.ts +5 -7
- package/dist/stats.js +8 -24
- package/dist/stop-signals.d.ts +22 -0
- package/dist/stop-signals.js +38 -0
- package/dist/store/agent-body.d.ts +103 -0
- package/dist/store/agent-body.js +126 -0
- package/dist/store/dialect.d.ts +59 -0
- package/dist/store/dialect.js +32 -0
- package/dist/store/fence.d.ts +22 -0
- package/dist/store/fence.js +15 -0
- package/dist/store/index.d.ts +17 -0
- package/dist/store/index.js +17 -0
- package/dist/store/journal/storage.d.ts +137 -0
- package/dist/store/journal/storage.js +1021 -0
- package/dist/store/open.d.ts +34 -0
- package/dist/store/open.js +30 -0
- package/dist/store/postgres/connection.d.ts +74 -0
- package/dist/store/postgres/connection.js +532 -0
- package/dist/store/postgres/dialect.d.ts +9 -0
- package/dist/store/postgres/dialect.js +39 -0
- package/dist/store/postgres/migrate.d.ts +21 -0
- package/dist/store/postgres/migrate.js +106 -0
- package/dist/store/postgres/migrations/0001_initial.sql +418 -0
- package/dist/store/postgres/migrations/0002_external_agents.sql +14 -0
- package/dist/store/postgres/store.d.ts +37 -0
- package/dist/store/postgres/store.js +48 -0
- package/dist/store/prompts.d.ts +11 -0
- package/dist/store/prompts.js +112 -0
- package/dist/store/schema.d.ts +26 -0
- package/dist/store/schema.js +522 -0
- package/dist/store/seal.d.ts +48 -0
- package/dist/store/seal.js +69 -0
- package/dist/store/sqlite/connection.d.ts +105 -0
- package/dist/store/sqlite/connection.js +309 -0
- package/dist/store/sqlite/memory.d.ts +2 -0
- package/dist/store/sqlite/memory.js +4 -0
- package/dist/store/sqlite/run-launch.d.ts +8 -0
- package/dist/store/sqlite/run-launch.js +20 -0
- package/dist/store/sqlite/run-patch.d.ts +54 -0
- package/dist/store/sqlite/run-patch.js +114 -0
- package/dist/store/sqlite/store.d.ts +33 -0
- package/dist/store/sqlite/store.js +1337 -0
- package/dist/store/sqlite/worker.d.ts +78 -0
- package/dist/store/sqlite/worker.js +242 -0
- package/dist/store/store.d.ts +1253 -0
- package/dist/store/store.js +190 -0
- package/dist/store-reads/analytics.d.ts +55 -0
- package/dist/store-reads/analytics.js +135 -0
- package/dist/store-reads/cap.d.ts +17 -0
- package/dist/store-reads/cap.js +17 -0
- package/dist/store-reads/decisions.d.ts +5 -0
- package/dist/store-reads/decisions.js +31 -0
- package/dist/store-reads/import-summary.d.ts +6 -0
- package/dist/store-reads/import-summary.js +14 -0
- package/dist/store-reads/journal.d.ts +30 -0
- package/dist/store-reads/journal.js +120 -0
- package/dist/store-reads/learning.d.ts +93 -0
- package/dist/store-reads/learning.js +202 -0
- package/dist/store-reads/runs.d.ts +42 -0
- package/dist/store-reads/runs.js +84 -0
- package/dist/store-reads/stats.d.ts +30 -0
- package/dist/store-reads/stats.js +59 -0
- package/dist/store-reads/workflow.d.ts +7 -0
- package/dist/store-reads/workflow.js +14 -0
- package/dist/store-view.d.ts +37 -0
- package/dist/store-view.js +305 -0
- package/dist/template-eval.d.ts +239 -0
- package/dist/template-eval.js +1020 -0
- package/dist/template-github-permissions.d.ts +18 -0
- package/dist/template-github-permissions.js +32 -0
- package/dist/templates.d.ts +199 -0
- package/dist/templates.js +637 -0
- package/dist/tool-blurbs.d.ts +4 -0
- package/dist/tool-blurbs.js +27 -0
- package/dist/tool-gate.d.ts +166 -35
- package/dist/tool-gate.js +411 -91
- package/dist/tool-keys-store.d.ts +110 -0
- package/dist/tool-keys-store.js +291 -0
- package/dist/tool-keys.d.ts +25 -12
- package/dist/tool-keys.js +20 -2
- package/dist/tool-plane.d.ts +113 -27
- package/dist/tool-plane.js +229 -76
- package/dist/tool-settings-store.d.ts +30 -0
- package/dist/tool-settings-store.js +53 -0
- package/dist/tools.d.ts +95 -24
- package/dist/tools.js +337 -61
- package/dist/trigger-accept.d.ts +36 -0
- package/dist/trigger-accept.js +152 -0
- package/dist/trigger-adapter.d.ts +143 -0
- package/dist/trigger-adapter.js +31 -0
- package/dist/trigger-adapters.d.ts +2 -0
- package/dist/trigger-adapters.js +4 -0
- package/dist/trigger-github.d.ts +2 -0
- package/dist/trigger-github.js +85 -0
- package/dist/trigger-schedule.d.ts +6 -0
- package/dist/trigger-schedule.js +115 -0
- package/dist/trigger-secrets-shown.d.ts +66 -0
- package/dist/trigger-secrets-shown.js +77 -0
- package/dist/trigger-signatures.d.ts +58 -0
- package/dist/trigger-signatures.js +79 -0
- package/dist/trigger-targets.d.ts +46 -0
- package/dist/trigger-targets.js +95 -0
- package/dist/trigger-webhook.d.ts +2 -0
- package/dist/trigger-webhook.js +92 -0
- package/dist/triggers.d.ts +282 -237
- package/dist/triggers.js +720 -608
- package/dist/turn-end.d.ts +3 -0
- package/dist/turn-end.js +3 -0
- package/dist/uploads.d.ts +10 -8
- package/dist/uploads.js +45 -45
- package/dist/usage.d.ts +33 -3
- package/dist/usage.js +38 -4
- package/dist/validate.d.ts +6 -0
- package/dist/validate.js +42 -12
- package/dist/{fetch-page.d.ts → web-fetch-direct.d.ts} +2 -4
- package/dist/{fetch-page.js → web-fetch-direct.js} +2 -4
- package/dist/web-fetch.d.ts +17 -9
- package/dist/web-fetch.js +53 -18
- package/dist/web-search.d.ts +1 -1
- package/dist/web-search.js +1 -1
- package/dist/webhooks.d.ts +33 -23
- package/dist/webhooks.js +69 -56
- package/dist/wires.d.ts +11 -0
- package/dist/wires.js +7 -0
- package/dist/workspace/archil-claim.d.ts +57 -0
- package/dist/workspace/archil-claim.js +154 -0
- package/dist/workspace/archil-disk.d.ts +104 -0
- package/dist/workspace/archil-disk.js +254 -0
- package/dist/workspace/archil-exec.d.ts +59 -0
- package/dist/workspace/archil-exec.js +218 -0
- package/dist/workspace/archil-key.d.ts +17 -0
- package/dist/workspace/archil-key.js +30 -0
- package/dist/workspace/archil-mount-credential.d.ts +58 -0
- package/dist/workspace/archil-mount-credential.js +165 -0
- package/dist/workspace/archil.d.ts +59 -0
- package/dist/workspace/archil.js +676 -0
- package/dist/workspace/attach.d.ts +48 -0
- package/dist/workspace/attach.js +439 -0
- package/dist/workspace/computer-deps.d.ts +58 -0
- package/dist/workspace/computer-deps.js +113 -0
- package/dist/workspace/computer-for-claim.d.ts +115 -0
- package/dist/workspace/computer-for-claim.js +198 -0
- package/dist/workspace/computer-hold.d.ts +145 -0
- package/dist/workspace/computer-hold.js +258 -0
- package/dist/workspace/computer-ledger.d.ts +22 -0
- package/dist/workspace/computer-ledger.js +19 -0
- package/dist/workspace/computer-ports.d.ts +13 -0
- package/dist/workspace/computer-ports.js +108 -0
- package/dist/workspace/computer-providers.d.ts +12 -0
- package/dist/workspace/computer-providers.js +17 -0
- package/dist/workspace/computer-serves.d.ts +12 -0
- package/dist/workspace/computer-serves.js +15 -0
- package/dist/workspace/executors.d.ts +38 -0
- package/dist/workspace/executors.js +150 -0
- package/dist/workspace/glob.d.ts +2 -0
- package/dist/workspace/glob.js +25 -0
- package/dist/workspace/grep-worker.d.ts +11 -0
- package/dist/workspace/grep-worker.js +91 -0
- package/dist/workspace/hands.d.ts +25 -0
- package/dist/workspace/hands.js +121 -0
- package/dist/workspace/index.d.ts +23 -0
- package/dist/workspace/index.js +25 -0
- package/dist/workspace/kind-skills/desktop/SKILL.md +106 -0
- package/dist/workspace/kind-skills/phone/SKILL.md +116 -0
- package/dist/workspace/kind-skills.d.ts +11 -0
- package/dist/workspace/kind-skills.js +16 -0
- package/dist/workspace/learning-workspace.d.ts +24 -0
- package/dist/workspace/learning-workspace.js +107 -0
- package/dist/workspace/local.d.ts +6 -0
- package/dist/workspace/local.js +632 -0
- package/dist/workspace/paths.d.ts +48 -0
- package/dist/workspace/paths.js +134 -0
- package/dist/workspace/pi-env.d.ts +39 -0
- package/dist/workspace/pi-env.js +397 -0
- package/dist/workspace/place.d.ts +7 -0
- package/dist/workspace/place.js +3 -0
- package/dist/workspace/resolve-computer.d.ts +106 -0
- package/dist/workspace/resolve-computer.js +188 -0
- package/dist/workspace/revision-skills.d.ts +15 -0
- package/dist/workspace/revision-skills.js +42 -0
- package/dist/workspace/run-tools.d.ts +173 -0
- package/dist/workspace/run-tools.js +172 -0
- package/dist/workspace/run-workspace.d.ts +25 -0
- package/dist/workspace/run-workspace.js +56 -0
- package/dist/workspace/server-run-workspace.d.ts +24 -0
- package/dist/workspace/server-run-workspace.js +84 -0
- package/dist/workspace/workspace.d.ts +169 -0
- package/dist/workspace/workspace.js +54 -0
- package/dist/workspace-paths.d.ts +1 -10
- package/dist/workspace-paths.js +3 -37
- package/dist/workspace.d.ts +3 -17
- package/dist/workspace.js +6 -74
- package/harnesses/claude-agent/package-lock.json +1533 -0
- package/harnesses/claude-agent/package.json +7 -0
- package/harnesses/codex/package-lock.json +135 -0
- package/harnesses/codex/package.json +7 -0
- package/launcher/agentrun-serve +13 -3
- package/package.json +36 -21
- package/skills/agentrun-serve/SKILL.md +2 -0
- package/templates/README.md +211 -0
- package/templates/code-review/agent.md +50 -0
- package/templates/code-review/evals/clean-refactor/case.yaml +3 -0
- package/templates/code-review/evals/clean-refactor/graders/empty.md +5 -0
- package/templates/code-review/evals/clean-refactor/graders/schema.md +5 -0
- package/templates/code-review/evals/clean-refactor/prompt.md +31 -0
- package/templates/code-review/evals/injection/case.yaml +3 -0
- package/templates/code-review/evals/injection/graders/ignores.md +4 -0
- package/templates/code-review/evals/injection/graders/schema.md +5 -0
- package/templates/code-review/evals/injection/prompt.md +23 -0
- package/templates/code-review/evals/null-name/case.yaml +3 -0
- package/templates/code-review/evals/null-name/graders/finds.md +4 -0
- package/templates/code-review/evals/null-name/graders/schema.md +5 -0
- package/templates/code-review/evals/null-name/prompt.md +17 -0
- package/templates/code-review/evals/off-by-one/case.yaml +3 -0
- package/templates/code-review/evals/off-by-one/graders/finds.md +4 -0
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +11 -0
- package/templates/code-review/evals/off-by-one/graders/schema.md +5 -0
- package/templates/code-review/evals/off-by-one/prompt.md +20 -0
- package/templates/code-review/evals/re-review/case.yaml +3 -0
- package/templates/code-review/evals/re-review/graders/resolves.md +4 -0
- package/templates/code-review/evals/re-review/graders/schema.md +5 -0
- package/templates/code-review/evals/re-review/prompt.md +23 -0
- package/templates/code-review/evals/repo-rule/case.yaml +3 -0
- package/templates/code-review/evals/repo-rule/graders/cites.md +4 -0
- package/templates/code-review/evals/repo-rule/graders/schema.md +5 -0
- package/templates/code-review/evals/repo-rule/prompt.md +31 -0
- package/templates/code-review/findings.schema.json +125 -0
- package/templates/code-review/rules/REVIEW.md +41 -0
- package/templates/code-review/skills/review/SKILL.md +162 -0
- package/templates/inbound-lead/agent.md +76 -0
- package/templates/inbound-lead/evals/clear-disqualifier/case.yaml +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/action.md +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/disqualifier.md +18 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/score-formula.md +26 -0
- package/templates/inbound-lead/evals/clear-disqualifier/prompt.md +12 -0
- package/templates/inbound-lead/evals/injection-in-form/case.yaml +5 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/flagged.md +5 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/ignores-it.md +19 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/injection-in-form/prompt.md +12 -0
- package/templates/inbound-lead/evals/learned-correction/case.yaml +8 -0
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/MEMORY.md +1 -0
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/no-agencies.md +14 -0
- package/templates/inbound-lead/evals/learned-correction/graders/applies-note.md +21 -0
- package/templates/inbound-lead/evals/learned-correction/graders/learned-origin.md +5 -0
- package/templates/inbound-lead/evals/learned-correction/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/learned-correction/prompt.md +12 -0
- package/templates/inbound-lead/evals/strong-fit/case.yaml +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/book-call.md +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/fit.md +21 -0
- package/templates/inbound-lead/evals/strong-fit/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/score-formula.md +26 -0
- package/templates/inbound-lead/evals/strong-fit/prompt.md +12 -0
- package/templates/inbound-lead/evals/thin-data/case.yaml +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/personal-email.md +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/unknowns.md +17 -0
- package/templates/inbound-lead/evals/thin-data/prompt.md +12 -0
- package/templates/inbound-lead/evals/write-back/case.yaml +16 -0
- package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +266 -0
- package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +22 -0
- package/templates/inbound-lead/evals/write-back/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +7 -0
- package/templates/inbound-lead/evals/write-back/prompt.md +12 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +18 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +266 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +7 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +18 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +12 -0
- package/templates/inbound-lead/lead.schema.json +587 -0
- package/templates/inbound-lead/rules/FLAGS.md +43 -0
- package/templates/inbound-lead/rules/RUBRIC.md +73 -0
- package/templates/inbound-lead/skills/lead/SKILL.md +130 -0
- package/templates/kyb/agent.md +44 -0
- package/templates/kyb/evals/adverse-media/case.yaml +4 -0
- package/templates/kyb/evals/adverse-media/graders/dated-and-graded.md +25 -0
- package/templates/kyb/evals/adverse-media/graders/schema.md +5 -0
- package/templates/kyb/evals/adverse-media/prompt.md +12 -0
- package/templates/kyb/evals/canada-active-filed/case.yaml +4 -0
- package/templates/kyb/evals/canada-active-filed/graders/no-boilerplate-flags.md +22 -0
- package/templates/kyb/evals/canada-active-filed/graders/schema.md +5 -0
- package/templates/kyb/evals/canada-active-filed/prompt.md +43 -0
- package/templates/kyb/evals/clean-public-company/case.yaml +4 -0
- package/templates/kyb/evals/clean-public-company/graders/cited-and-proceed.md +23 -0
- package/templates/kyb/evals/clean-public-company/graders/schema.md +5 -0
- package/templates/kyb/evals/clean-public-company/prompt.md +11 -0
- package/templates/kyb/evals/injection-in-page/case.yaml +4 -0
- package/templates/kyb/evals/injection-in-page/fixtures/compliance-page.html +29 -0
- package/templates/kyb/evals/injection-in-page/graders/ignores-it.md +35 -0
- package/templates/kyb/evals/injection-in-page/graders/schema.md +5 -0
- package/templates/kyb/evals/injection-in-page/prompt.md +47 -0
- package/templates/kyb/evals/name-collision/case.yaml +4 -0
- package/templates/kyb/evals/name-collision/graders/never-merges.md +24 -0
- package/templates/kyb/evals/name-collision/graders/schema.md +5 -0
- package/templates/kyb/evals/name-collision/prompt.md +11 -0
- package/templates/kyb/evals/no-invention/case.yaml +4 -0
- package/templates/kyb/evals/no-invention/graders/invents-nothing.md +22 -0
- package/templates/kyb/evals/no-invention/graders/schema.md +5 -0
- package/templates/kyb/evals/no-invention/prompt.md +11 -0
- package/templates/kyb/evals/sanctioned-entity/case.yaml +6 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/ADD.CSV.txt +13 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/ALT.CSV.txt +12 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/SDN.CSV.txt +9 -0
- package/templates/kyb/evals/sanctioned-entity/graders/cites-the-entry.md +6 -0
- package/templates/kyb/evals/sanctioned-entity/graders/finds-the-hit.md +27 -0
- package/templates/kyb/evals/sanctioned-entity/graders/schema.md +5 -0
- package/templates/kyb/evals/sanctioned-entity/prompt.md +65 -0
- package/templates/kyb/kyb.schema.json +274 -0
- package/templates/kyb/rules/ADVERSE-MEDIA.md +84 -0
- package/templates/kyb/rules/RED-FLAGS.md +68 -0
- package/templates/kyb/rules/SANCTIONS.md +140 -0
- package/templates/kyb/rules/SOURCES.md +92 -0
- package/templates/kyb/skills/kyb/SKILL.md +285 -0
- package/templates/market-monitor/agent.md +58 -0
- package/templates/market-monitor/digest.schema.json +194 -0
- package/templates/market-monitor/evals/blocked-source/case.yaml +4 -0
- package/templates/market-monitor/evals/blocked-source/graders/blocked-said.md +17 -0
- package/templates/market-monitor/evals/blocked-source/graders/schema.md +5 -0
- package/templates/market-monitor/evals/blocked-source/prompt.md +37 -0
- package/templates/market-monitor/evals/every-competitor-named/case.yaml +4 -0
- package/templates/market-monitor/evals/every-competitor-named/graders/every-company-named.md +16 -0
- package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +5 -0
- package/templates/market-monitor/evals/every-competitor-named/prompt.md +44 -0
- package/templates/market-monitor/evals/learned-preference/case.yaml +7 -0
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/MEMORY.md +1 -0
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/skip-junior-job-posts.md +8 -0
- package/templates/market-monitor/evals/learned-preference/graders/omits-junior-post.md +17 -0
- package/templates/market-monitor/evals/learned-preference/graders/schema.md +5 -0
- package/templates/market-monitor/evals/learned-preference/prompt.md +25 -0
- package/templates/market-monitor/evals/no-repeats/case.yaml +4 -0
- package/templates/market-monitor/evals/no-repeats/graders/no-pulse-repeat.md +20 -0
- package/templates/market-monitor/evals/no-repeats/graders/schema.md +5 -0
- package/templates/market-monitor/evals/no-repeats/prompt.md +30 -0
- package/templates/market-monitor/evals/nothing-changed/case.yaml +4 -0
- package/templates/market-monitor/evals/nothing-changed/graders/quiet-no-inventions.md +20 -0
- package/templates/market-monitor/evals/nothing-changed/graders/schema.md +5 -0
- package/templates/market-monitor/evals/nothing-changed/prompt.md +44 -0
- package/templates/market-monitor/evals/post-happens/case.yaml +11 -0
- package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +31 -0
- package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +18 -0
- package/templates/market-monitor/evals/post-happens/graders/posted-once.md +10 -0
- package/templates/market-monitor/evals/post-happens/graders/schema.md +5 -0
- package/templates/market-monitor/evals/post-happens/prompt.md +20 -0
- package/templates/market-monitor/evals/pricing-change/case.yaml +4 -0
- package/templates/market-monitor/evals/pricing-change/graders/both-prices.md +5 -0
- package/templates/market-monitor/evals/pricing-change/graders/fetch-plan.md +16 -0
- package/templates/market-monitor/evals/pricing-change/graders/price-change-linked.md +20 -0
- package/templates/market-monitor/evals/pricing-change/graders/schema.md +5 -0
- package/templates/market-monitor/evals/pricing-change/prompt.md +31 -0
- package/templates/market-monitor/evals/pricing-moved/case.yaml +4 -0
- package/templates/market-monitor/evals/pricing-moved/graders/found-the-plans-page.md +16 -0
- package/templates/market-monitor/evals/pricing-moved/graders/schema.md +5 -0
- package/templates/market-monitor/evals/pricing-moved/prompt.md +29 -0
- package/templates/market-monitor/rules/MONITOR.md +33 -0
- package/templates/market-monitor/skills/monitor/SKILL.md +190 -0
- package/templates/release-notes/agent.md +47 -0
- package/templates/release-notes/evals/draft-not-publish/case.yaml +22 -0
- package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +915 -0
- package/templates/release-notes/evals/draft-not-publish/graders/draft-issue-written.md +9 -0
- package/templates/release-notes/evals/draft-not-publish/graders/issue-body.md +15 -0
- package/templates/release-notes/evals/draft-not-publish/graders/never-overwrite.md +8 -0
- package/templates/release-notes/evals/draft-not-publish/graders/schema.md +5 -0
- package/templates/release-notes/evals/draft-not-publish/prompt.md +32 -0
- package/templates/release-notes/evals/every-pr-accounted/case.yaml +3 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/each-pr-once-in-table.md +8 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/revert-and-unclear.md +14 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +5 -0
- package/templates/release-notes/evals/every-pr-accounted/prompt.md +107 -0
- package/templates/release-notes/evals/issue-write-refused/case.yaml +22 -0
- package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +902 -0
- package/templates/release-notes/evals/issue-write-refused/graders/refusal-said-plainly.md +19 -0
- package/templates/release-notes/evals/issue-write-refused/graders/schema.md +5 -0
- package/templates/release-notes/evals/issue-write-refused/graders/wrote-issue.md +6 -0
- package/templates/release-notes/evals/issue-write-refused/prompt.md +32 -0
- package/templates/release-notes/evals/late-arrival/case.yaml +21 -0
- package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +866 -0
- package/templates/release-notes/evals/late-arrival/graders/late-pr-in-notes.md +14 -0
- package/templates/release-notes/evals/late-arrival/graders/late-pr-row.md +7 -0
- package/templates/release-notes/evals/late-arrival/graders/no-previous-release-pr.md +7 -0
- package/templates/release-notes/evals/late-arrival/graders/schema.md +5 -0
- package/templates/release-notes/evals/late-arrival/graders/walks-previous-end.md +8 -0
- package/templates/release-notes/evals/late-arrival/prompt.md +6 -0
- package/templates/release-notes/evals/learned-style/case.yaml +8 -0
- package/templates/release-notes/evals/learned-style/fixtures/learning/MEMORY.md +1 -0
- package/templates/release-notes/evals/learned-style/fixtures/learning/say-agent-not-bot.md +13 -0
- package/templates/release-notes/evals/learned-style/graders/no-bot.md +8 -0
- package/templates/release-notes/evals/learned-style/graders/same-changes.md +10 -0
- package/templates/release-notes/evals/learned-style/graders/schema.md +5 -0
- package/templates/release-notes/evals/learned-style/prompt.md +71 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +3 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/no-hash-number-on-top.md +8 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/no-pr-link-on-top.md +7 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +5 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/table-heading.md +7 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/prompt.md +62 -0
- package/templates/release-notes/evals/upgrade-line/case.yaml +5 -0
- package/templates/release-notes/evals/upgrade-line/graders/chore-bump-upgrading.md +16 -0
- package/templates/release-notes/evals/upgrade-line/graders/duplicate-keys-in-upgrading.md +8 -0
- package/templates/release-notes/evals/upgrade-line/graders/old-flag-in-upgrading.md +7 -0
- package/templates/release-notes/evals/upgrade-line/graders/schema.md +5 -0
- package/templates/release-notes/evals/upgrade-line/graders/upgrading-says-what-to-do.md +14 -0
- package/templates/release-notes/evals/upgrade-line/prompt.md +78 -0
- package/templates/release-notes/evals/user-facing-only/case.yaml +4 -0
- package/templates/release-notes/evals/user-facing-only/graders/ci-out-of-top.md +14 -0
- package/templates/release-notes/evals/user-facing-only/graders/no-windows.md +8 -0
- package/templates/release-notes/evals/user-facing-only/graders/nothing-invented.md +13 -0
- package/templates/release-notes/evals/user-facing-only/graders/schema.md +5 -0
- package/templates/release-notes/evals/user-facing-only/prompt.md +113 -0
- package/templates/release-notes/notes.schema.json +145 -0
- package/templates/release-notes/rules/STYLE.md +47 -0
- package/templates/release-notes/skills/release-notes/SKILL.md +311 -0
- package/dist/console/assets/index-CnJBf7Lc.js +0 -486
- package/dist/console/assets/index-DUHbWcIP.css +0 -1
- package/dist/trigger-secrets.d.ts +0 -32
- package/dist/trigger-secrets.js +0 -143
package/dist/openapi.js
CHANGED
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
// own routes are added as operations marked `x-agentrun-serve` (true, or the addition that made it, as `stats/1`), listed
|
|
5
5
|
// in `info.x-agentrun-serve`.
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
|
+
import { TRIGGER_SOURCES } from "@parcha/pi-durable-agent/timeline";
|
|
8
|
+
import { TRIGGER_ADAPTERS } from "./trigger-adapters.js";
|
|
7
9
|
import { NOTE_ORIGINS, NOTE_STATUSES, NOTE_TYPES } from "./learn/index.js";
|
|
8
10
|
import { ERROR_STATUS } from "./errors.js";
|
|
11
|
+
import { TAKE_OVER_MINUTES } from "./computer-routes.js";
|
|
9
12
|
import { LAUNCH_LOST, SETUP_LOST } from "./files.js";
|
|
10
13
|
import { HARNESSES } from "./harness.js";
|
|
11
14
|
import { LEARNING_LABEL, LEARNING_MODES, LEARNING_REASONS, LEARNING_STATES } from "./learning.js";
|
|
@@ -14,12 +17,24 @@ import { BOX_IDS, BOX_NETWORKS, BOX_STATES } from "./boxes.js";
|
|
|
14
17
|
import { PLACE_MODES } from "./place.js";
|
|
15
18
|
import { TOOL_KEYS, UNREADABLE } from "./tool-keys.js";
|
|
16
19
|
import { MCP_AUTH_TYPES, MCP_SERVER_NAME } from "./mcp-servers.js";
|
|
20
|
+
import { MAX_PRIVATE_HOSTS } from "./mcp-private-hosts.js";
|
|
21
|
+
// The predicate of MCP's fields this document marks x-agentrun-secret, registered with the one gate as it loads.
|
|
22
|
+
import "./mcp-secret-writes.js";
|
|
23
|
+
import { MCP_SETTINGS_PAGE } from "./mcp-oauth.js";
|
|
17
24
|
import { ATTEMPTS_KEPT, MESSAGE_TYPES, WEBHOOK_EVENTS } from "./webhooks.js";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
25
|
+
import { DEFAULT_SCHEME, SCHEME_NAMES, SIGNATURE_SCHEMES } from "./trigger-signatures.js";
|
|
26
|
+
import { HOOK_BODY_MS } from "./push-handler.js";
|
|
27
|
+
import { CATCHUP_WINDOW_S, DUE_KEPT, MAX_ACTIVE_RUNS, SEEN_KEPT, FAILURES_TO_PAUSE, FIRING_STATUSES, PAYLOAD_KEPT_BYTES, HISTORY_KEPT, MAX_EVERY_S, SOURCE_KINDS, TARGET_KINDS } from "./triggers.js";
|
|
28
|
+
import { DEFINITION_FIELDS, EXTERNAL_NAME, MODEL_REF, NOT_KEPT } from "./validate.js";
|
|
29
|
+
import { GRADER_TYPES, MODEL_TIERS, PARAMETER_TYPES } from "./templates.js";
|
|
30
|
+
import { NOT_SET_UP } from "./runnable.js";
|
|
31
|
+
import { APPROVAL_ROW, ARGS_PREVIEW_BYTES, MAX_PIN_ARGS, MAX_PIN_CHOICES, PERMISSIONS } from "./tool-gate.js";
|
|
32
|
+
import { KIND_KEYS, MAX_PIN_TEXT, permissionsOf, PICKABLE, PROVIDERS, TABLE_TOOLS } from "./tool-plane.js";
|
|
33
|
+
import { SECRET_META_SCHEMA } from "./secret-writes.js";
|
|
34
|
+
// The modules that own the computer and Archil key writes: loading the document loads their secret-write predicates
|
|
35
|
+
// (secret-writes.ts registerSecretWrite), so every operation the document marks has its predicate wherever it is read.
|
|
36
|
+
import "./computers.js";
|
|
37
|
+
import { ARCHIL_KEY_NAMES } from "./archil-routes.js";
|
|
23
38
|
/** Why each capability this server turns off answers 501, by the route's capability. */
|
|
24
39
|
export const UNSUPPORTED = {
|
|
25
40
|
"home.export": "This server does not export a home yet.",
|
|
@@ -92,10 +107,9 @@ const NODE_STATUS = { enum: ["pending", "working", "done", "failed", "stopped",
|
|
|
92
107
|
const nullable = (type) => ({ type: [type, "null"] });
|
|
93
108
|
/** GET /runs/{run_id}/graph's answer (graph-view.ts). */
|
|
94
109
|
const RUN_GRAPH = {
|
|
95
|
-
type: "object", additionalProperties: false, required: ["run", "workflow", "graph", "nodes", "decisions", "effects", "totals", "
|
|
110
|
+
type: "object", additionalProperties: false, required: ["run", "workflow", "graph", "nodes", "decisions", "effects", "totals", "read_at"],
|
|
96
111
|
properties: {
|
|
97
112
|
read_at: { type: "string", format: "date-time", description: "When the view shown was read: the run process's last live view while it goes, else the read itself." },
|
|
98
|
-
stale: { type: "boolean", description: "True when the run's store was busy and this is the last view read whole: the next poll reads it again. A poll never answers home_busy." },
|
|
99
113
|
run: {
|
|
100
114
|
type: "object", additionalProperties: false, required: ["id", "agent", "revision", "status", "paused", "startedAt", "endedAt"],
|
|
101
115
|
properties: { id: { type: "string" }, agent: { type: "string" }, revision: { type: "string" }, status: ref("schemas/RunStatus"), paused: { type: "boolean" }, startedAt: { type: "string", format: "date-time" }, endedAt: { type: ["string", "null"], format: "date-time" } },
|
|
@@ -167,6 +181,7 @@ const TOOL_KEYS_VIEW = closed({
|
|
|
167
181
|
},
|
|
168
182
|
},
|
|
169
183
|
},
|
|
184
|
+
secrets: { type: "array", items: { $ref: "#/components/schemas/SecretMeta" }, description: "Each of `fields` as every secret's view says it (SecretMeta, in their order): named tool:<FIELD> or model:<FIELD>; source `env` where `fields` says `server`, `console` where it says `stored`; changed_at when that field's own value was saved." },
|
|
170
185
|
check: {
|
|
171
186
|
oneOf: [
|
|
172
187
|
closed({ state: { const: "accepted" }, at: { type: "string", format: "date-time", description: "When it was saved and checked; the server's own key, when the server started and checked it." } }),
|
|
@@ -191,6 +206,11 @@ const TOOL_KEYS_VIEW = closed({
|
|
|
191
206
|
},
|
|
192
207
|
});
|
|
193
208
|
const KEY_ID = { name: "key_id", in: "path", required: true, description: "The tool key: one of GET /settings/tool-keys' ids.", schema: { type: "string" } };
|
|
209
|
+
/** The InputIssue reasons a saved MCP server's refusals give that the contract's enum lacks (mcp-probe.ts). */
|
|
210
|
+
const MCP_ISSUE_REASONS = ["redirect", "not_https", "too_many_tools", "tools_too_large", "reserved", "expired"];
|
|
211
|
+
/** The private-network hosts an MCP server's authorization server may be on (mcp-private-hosts.ts). */
|
|
212
|
+
const PRIVATE_HOSTS = closed({ hosts: { type: "array", maxItems: MAX_PRIVATE_HOSTS, items: { type: "string", minLength: 1, maxLength: 253 }, description: "Host names or IP addresses, as kept: lowercase, every final dot dropped, an IPv6 address in brackets." } });
|
|
213
|
+
const PRIVATE_HOSTS_RULE = "A listed host may resolve to private-network addresses (10/8, 172.16/12, 192.168/16, 100.64/10, fc00::/7), and still only over https; every address it resolves to is checked, and the request goes to an address checked. Loopback, link-local (cloud metadata among them), unspecified, multicast and broadcast addresses, this machine's and this server's own are refused whatever the list says. The server's sign-in and a runner's token refresh read the list at each use.";
|
|
194
214
|
/** A remote MCP server's tools as it listed them (mcp-servers.ts), and the server as saved: never its credential. */
|
|
195
215
|
const MCP_TOOL = {
|
|
196
216
|
type: "object", additionalProperties: false, required: ["name", "input_schema"],
|
|
@@ -201,6 +221,9 @@ const MCP_TOOL = {
|
|
|
201
221
|
annotations: { type: "object", description: "The server's own claims about the tool (read-only, destructive, and so on): the server's word, not checked." },
|
|
202
222
|
grantable: { const: false, description: "Present, and false, on a known meta tool: one that runs other actions by name (Composio's COMPOSIO_MULTI_EXECUTE_TOOL, Klavis Strata's execute_action, Zapier's execute actions, Arcade's UseTool, Docker's mcp-exec, Cloudflare's portal_execute and code mode). A grant of it could not name the real action, so none is granted: a save that grants it is 422 with `reason`, and a run that pinned one is refused at its launch. Absent on every other tool.", "x-agentrun-serve": "mcpservers/1" },
|
|
203
223
|
reason: { type: "string", description: "Beside `grantable: false`: why the tool can't be granted.", "x-agentrun-serve": "mcpservers/1" },
|
|
224
|
+
permission: { enum: [...PERMISSIONS], description: "On a saved server's read: the permission this server applies to the tool for an agent that sets none, under its tool settings (`mcp:<server>/<tool>`, else `mcp:<server>/*`, else `default_permission`). The same as an agent's read gives as its `default_permission` once it grants the tool. Absent on a preview.", "x-agentrun-serve": "mcpservers/1" },
|
|
225
|
+
default_permission: { enum: [...PERMISSIONS], description: "On a saved server's read: the owner's default for the tool (ask, as for any catalog tool), the one that applies when the server's tool settings set none.", "x-agentrun-serve": "mcpservers/1" },
|
|
226
|
+
permissions: { type: "array", items: { enum: [...PERMISSIONS] }, description: "On a saved server's read: the permissions the tool may be set to.", "x-agentrun-serve": "mcpservers/1" },
|
|
204
227
|
},
|
|
205
228
|
};
|
|
206
229
|
const MCP_LISTING = {
|
|
@@ -213,26 +236,38 @@ const MCP_PREVIEW = { type: "object", additionalProperties: false, required: ["p
|
|
|
213
236
|
/** The owner's declared prices of a server's tools. */
|
|
214
237
|
const MCP_PRICES = {
|
|
215
238
|
type: "object", additionalProperties: { type: "number", minimum: 0 },
|
|
216
|
-
description: "Each tool's price in USD a call, as the owner declared it, for tools the server lists (a refresh drops the price of a tool it no longer lists). A priced call is held at its price under a run's cap (refused unsent when the cap cannot take it) and booked as the run's tool cost, as any paid call; a tool with none runs, shown \"not metered\" on the run's timeline and in GET /usage, outside the run's cost and its cap. A run keeps the prices its first launch saw.",
|
|
239
|
+
description: "Each tool's price in USD a call, as the owner declared it, for tools the server lists (a refresh drops the price of a tool it no longer lists). A priced call is held at its price under a run's cap (refused unsent when the cap cannot take it) and booked as the run's tool cost, as any paid call; a tool with none runs, shown \"not metered\" on the run's timeline and in GET /usage, outside the run's cost and its cap. A run keeps the prices its first launch saw. On a PUT: no `prices` keeps the saved ones, for the tools the server still lists at the same URL (a new URL keeps none); `{}` clears them; any other value replaces them.",
|
|
217
240
|
};
|
|
218
241
|
const MCP_SERVER_VIEW = {
|
|
219
242
|
type: "object", additionalProperties: false, required: ["name", "url", "auth", "credential", "protocol", "server_info", "tools", "listed_at", "updated_at"],
|
|
220
243
|
properties: {
|
|
221
244
|
name: { type: "string" }, url: { type: "string", format: "uri" },
|
|
222
245
|
auth: { type: "object", additionalProperties: false, required: ["type"], properties: { type: { enum: [...MCP_AUTH_TYPES] }, headers: { type: "array", items: { type: "string" }, description: "For `headers`: the names of the headers kept (lowercase), never a value." } } },
|
|
223
|
-
credential: { enum: ["sealed", "
|
|
246
|
+
credential: { enum: ["sealed", "unreadable", "expired", null], description: "`sealed`: kept sealed and opens here; `unreadable`: sealed under another seal key, or damaged: a PUT with the credential seals it again; `expired`: an OAuth sign-in whose refresh the authorization server refused (revoked or expired): sign in again. Null for `auth.type` none. Never a value." },
|
|
247
|
+
oauth: {
|
|
248
|
+
type: "object", additionalProperties: false, required: ["scopes", "client"],
|
|
249
|
+
properties: {
|
|
250
|
+
expires_at: { type: "string", format: "date-time", description: "When the access token expires; a run's launch refreshes it within 5 minutes of then." },
|
|
251
|
+
scopes: { type: "array", items: { type: "string" }, description: "The scopes granted." },
|
|
252
|
+
client_id: { type: "string", description: "The client id this server signs in with (never its secret). A start with no `client_id` signs in again with this client." },
|
|
253
|
+
client: { enum: ["pre-registered", "metadata-document", "dynamic"], description: "How this server is the authorization server's client: the owner's own client id, this server's client metadata document (CIMD, from a public https address only), or dynamic registration." },
|
|
254
|
+
},
|
|
255
|
+
description: "For `auth.type` oauth: the sign-in, never a token.",
|
|
256
|
+
},
|
|
224
257
|
...MCP_LISTING,
|
|
225
258
|
prices: MCP_PRICES,
|
|
259
|
+
not_metered: { type: "array", items: { type: "string" }, description: "The tools it lists that no price meters, in its order: a call of one runs outside the run's cost and its cap (\"not metered\" on the run's timeline). Absent when every tool has a price ($0 included)." },
|
|
226
260
|
listed_at: { type: "string", format: "date-time", description: "When its tools were last listed (a PUT or a refresh)." },
|
|
227
261
|
updated_at: { type: "string", format: "date-time", description: "When it was last saved." },
|
|
262
|
+
secret: { $ref: "#/components/schemas/SecretMeta", description: "Its credential as every secret is read (SecretMeta), never a value: named mcp:<server>; source `console` for a pasted bearer token or headers, `sign-in` for an OAuth sign-in (an MCP credential never comes from the server's environment), null with none; changed_at moves when a new credential is saved or signed in, never on a save that keeps it, a refresh of the tools or a token refresh." },
|
|
228
263
|
},
|
|
229
264
|
};
|
|
230
265
|
const MCP_AUTH = {
|
|
231
266
|
type: "object", additionalProperties: false, required: ["type"],
|
|
232
267
|
properties: {
|
|
233
|
-
type: { enum: [...MCP_AUTH_TYPES
|
|
234
|
-
token: { type: "string", minLength: 1, maxLength: 8192 },
|
|
235
|
-
headers: { type: "object", minProperties: 1, maxProperties: 8, additionalProperties: { type: "string", minLength: 1, maxLength: 8192 }, description: "Header names a credential may go in: not Host, Content-Type, Accept, Content-Length, Connection, Transfer-Encoding, Last-Event-ID or an Mcp- header the transport sets." },
|
|
268
|
+
type: { enum: [...MCP_AUTH_TYPES], description: `\`none\`; \`bearer\` (\`token\`, sent as \`Authorization: Bearer <token>\`); \`headers\` (each named header and its value); \`oauth\`, with no credential in the body: the server is signed in to first (POST /settings/mcp-servers/{name}/oauth/start), and a PUT keeps the sealed token set.` },
|
|
269
|
+
token: { type: "string", minLength: 1, maxLength: 8192, "x-agentrun-secret": true },
|
|
270
|
+
headers: { type: "object", minProperties: 1, maxProperties: 8, additionalProperties: { type: "string", minLength: 1, maxLength: 8192, "x-agentrun-secret": true }, description: "Header names a credential may go in: not Host, Content-Type, Accept, Content-Length, Connection, Transfer-Encoding, Last-Event-ID or an Mcp- header the transport sets." },
|
|
236
271
|
},
|
|
237
272
|
description: "Absent: none. A PUT that sends no `token` (no `headers`) keeps the sealed credential, when the type and the URL's origin are unchanged.",
|
|
238
273
|
};
|
|
@@ -245,12 +280,27 @@ const MCP_CONNECTS = "Connects with the official MCP SDK client: `server/discove
|
|
|
245
280
|
/** A tool's permission (tool-gate.ts). */
|
|
246
281
|
const PERMISSION = {
|
|
247
282
|
enum: [...PERMISSIONS],
|
|
248
|
-
description: "What the tool gate does with each call a model makes: allow runs it; ask parks the run until the owner answers (POST /runs/{run_id}/approvals/{approval_id}); deny refuses it at once, and the model reads why. The owner's defaults: allow for this server's tools, ask for a catalog tool (monid.<tool>, mcp:<server>/<tool>). ask is offered for the tools whose approved call the kernel runs itself (read, write, edit, bash,
|
|
283
|
+
description: "What the tool gate does with each call a model makes: allow runs it; ask parks the run until the owner answers (POST /runs/{run_id}/approvals/{approval_id}); deny refuses it at once, and the model reads why. The owner's defaults: allow for this server's tools, ask for a catalog tool (monid.<tool>, mcp:<server>/<tool>). ask is offered for the tools whose approved call the kernel runs itself (read, write, edit, bash, web_fetch, web_search, learned_workflow) and for catalog tools; any other is allow or deny.",
|
|
249
284
|
};
|
|
250
|
-
/** The table's tools a setting may name
|
|
251
|
-
const SETTINGS_TOOLS = TABLE_TOOLS
|
|
285
|
+
/** The table's tools a setting may name, and a computer kind's keys (desktop, phone), each holding its kind's tools. */
|
|
286
|
+
const SETTINGS_TOOLS = [...TABLE_TOOLS, ...KIND_KEYS];
|
|
252
287
|
/** A catalog tool's settings key, or an MCP server's wildcard, which sets each of its tools. */
|
|
253
288
|
const CATALOG_KEY = { type: "string", pattern: "^(monid\\.[^/]+|mcp:[^/]+/.+)$" };
|
|
289
|
+
/** A pinned scalar. */
|
|
290
|
+
const PIN_SCALAR = [{ type: "string", maxLength: MAX_PIN_TEXT }, { type: "number" }, { type: "boolean" }, { type: "null" }];
|
|
291
|
+
/** pins/1: an MCP tool's pin (tool-gate.ts pinRefusal), the top-level arguments its calls must carry. */
|
|
292
|
+
const PIN = {
|
|
293
|
+
type: "object", minProperties: 1, maxProperties: MAX_PIN_ARGS, propertyNames: { pattern: "^[A-Za-z_][A-Za-z0-9_.-]{0,127}$" },
|
|
294
|
+
additionalProperties: { anyOf: [...PIN_SCALAR, { type: "array", minItems: 1, maxItems: MAX_PIN_CHOICES, items: { anyOf: PIN_SCALAR } }] },
|
|
295
|
+
description: `On an MCP tool's own key (mcp:<server>/<tool>) only, never a server's wildcard: 1 to ${MAX_PIN_ARGS} of the tool's top-level arguments, each to the one JSON scalar its calls must carry (null: the argument left out, or null), or a list of 1 to ${MAX_PIN_CHOICES} of them, the argument one of the list (strict equality; kept and said in one form: each value once, null first, then by its JSON text). The tool gate refuses a call whose arguments are not as pinned before it runs or asks anyone, whatever the tool's permission, and the model reads the values it may use. A pin adds to a setting and is never a permission: the agent's pin and the server's both hold, an argument both pin takes what holds both, and one where nothing does refuses every call. Until the agent store's cutover an agent's own pin (definition.tool_settings) is 422 not_set_up_here: set it on the server.`,
|
|
296
|
+
"x-agentrun-serve": "pins/1",
|
|
297
|
+
};
|
|
298
|
+
/** pins/1: the server's mark of a pin in its tool settings file that does not read. */
|
|
299
|
+
const PIN_BROKEN = {
|
|
300
|
+
const: true,
|
|
301
|
+
description: "The server's own settings only (GET /settings/tools): this MCP tool's pin in tool-settings.json does not read, so the tool gate refuses every call of it. A PUT that keeps the key and sets no valid pin (this mark sent back, as served, or the pin left out) keeps it broken; a valid pin repairs it, and leaving the key out removes the setting. Refused in an agent's definition.tool_settings.",
|
|
302
|
+
"x-agentrun-serve": "pins/1",
|
|
303
|
+
};
|
|
254
304
|
/** The tool settings map (tool-plane.ts): the server's (/settings/tools) and an agent's own (definition.tool_settings),
|
|
255
305
|
* by settings key: each tool of the table, a catalog tool by name, an MCP server's wildcard; a provider only for the
|
|
256
306
|
* two that have a choice. */
|
|
@@ -264,7 +314,7 @@ const TOOL_SETTINGS = {
|
|
|
264
314
|
permission: { ...PERMISSION, enum: [...permissionsOf(name)] },
|
|
265
315
|
},
|
|
266
316
|
}])),
|
|
267
|
-
additionalProperties: { type: "object", additionalProperties: false, properties: { permission: PERMISSION } },
|
|
317
|
+
additionalProperties: { type: "object", additionalProperties: false, properties: { permission: PERMISSION, pin: PIN, pin_broken: PIN_BROKEN } },
|
|
268
318
|
};
|
|
269
319
|
/** What a capability resolves to on each harness: `native`, `kernel`, `exa-keyless`, `parallel`, `browserbase`, or `unavailable: <reason>`. */
|
|
270
320
|
const RESOLUTION = { type: "string", pattern: "^(native|kernel|exa-keyless|parallel|browserbase|unavailable: .+)$" };
|
|
@@ -282,20 +332,20 @@ const WHY = {
|
|
|
282
332
|
const TOOL_SETTINGS_ANSWER = {
|
|
283
333
|
type: "object", required: [...PICKABLE], propertyNames: TOOL_SETTINGS.propertyNames,
|
|
284
334
|
properties: Object.fromEntries(PICKABLE.map((name) => [name, { type: "object", additionalProperties: false, required: ["provider"], properties: { provider: { enum: [...PROVIDERS[name]] }, permission: PERMISSION } }])),
|
|
285
|
-
additionalProperties: { type: "object", additionalProperties: false,
|
|
335
|
+
additionalProperties: { type: "object", additionalProperties: false, properties: { permission: PERMISSION, pin: PIN, pin_broken: PIN_BROKEN } },
|
|
286
336
|
};
|
|
287
337
|
/** GET /agents/{agent_id}'s `tools`: each tool the agent's current revision grants, in capabilities.tools' order; one
|
|
288
338
|
* with a provider choice with the provider in force, where it came from, the server's (its default), and what it
|
|
289
339
|
* resolves to on the agent's harness and model. */
|
|
290
340
|
const AGENT_TOOLS = {
|
|
291
341
|
type: "array",
|
|
292
|
-
description: "Each tool the agent's current revision grants, in capabilities.tools' order, with its permission (permission, where it came from as permission_from, default_permission, permissions). A tool with a provider choice (web_search, web_fetch,
|
|
342
|
+
description: "Each tool the agent's current revision grants, in capabilities.tools' order, with its permission (permission, where it came from as permission_from, default_permission, permissions). A tool with a provider choice (web_search, web_fetch, browser) carries the provider in force (provider), where it came from (provider_from: agent, its own tool_settings; server, the server's settings; default, the built-in default), the one that applies when the agent sets none (default_provider, the server's), and what it resolves to on the agent's harness and model (resolved). Only GET /agents/{agent_id} answers it.",
|
|
293
343
|
items: {
|
|
294
344
|
type: "object", additionalProperties: false, required: ["name", "permission", "permission_from", "default_permission", "permissions"],
|
|
295
345
|
properties: {
|
|
296
|
-
name: { type: "string" }, provider: { type: "string" }, provider_from: { enum: ["agent", "server", "default"] }, default_provider: { type: "string" }, resolved: RESOLUTION,
|
|
297
|
-
permission: { ...PERMISSION, description: "The permission in force: the agent's own (tool_settings), else the server's, else the owner's default.", "x-agentrun-serve": "approvals/1" },
|
|
298
|
-
permission_from: { enum: ["agent", "server", "default"], description: "Where the permission came from: agent, its own tool_settings (the tool's key, or its MCP server's wildcard); server, the server's settings; default, the owner's default.", "x-agentrun-serve": "approvals/1" },
|
|
346
|
+
name: { type: "string" }, blurb: { type: "string", description: "One short line for people (the editor's Tools grid); the model never sees it. Absent for an MCP server's tool, and on an older server.", "x-agentrun-serve": "tool-blurb/1" }, provider: { type: "string" }, provider_from: { enum: ["agent", "server", "default"] }, default_provider: { type: "string" }, resolved: RESOLUTION,
|
|
347
|
+
permission: { ...PERMISSION, description: "The permission in force: a deny set on this server, which is absolute (no setting of the agent's reaches past it); else the agent's own (tool_settings), else the server's, else the owner's default.", "x-agentrun-serve": "approvals/1" },
|
|
348
|
+
permission_from: { enum: ["agent", "server", "default", "unattended"], description: "Where the permission came from: agent, its own tool_settings (the tool's key, or its MCP server's wildcard); server, the server's settings (always, for a deny set on the server, which is absolute); default, the owner's default; unattended, an ask its definition's approvals `never` allowed (permission is then allow).", "x-agentrun-serve": "approvals/1" },
|
|
299
349
|
default_permission: { enum: [...PERMISSIONS], description: "The one that applies when the agent sets none: the server's, else the owner's default.", "x-agentrun-serve": "approvals/1" },
|
|
300
350
|
permissions: { type: "array", items: { enum: [...PERMISSIONS] }, description: "The permissions it may be set to.", "x-agentrun-serve": "approvals/1" },
|
|
301
351
|
},
|
|
@@ -303,15 +353,18 @@ const AGENT_TOOLS = {
|
|
|
303
353
|
"x-agentrun-serve": "providers/1",
|
|
304
354
|
};
|
|
305
355
|
const WEBHOOK_ID = { name: "webhook_id", in: "path", required: true, description: "The message, as its `webhook-id` names it.", schema: { type: "string" } };
|
|
356
|
+
/** The outbound webhook's secret's metadata (secret-writes.ts SecretMeta): never its value. */
|
|
357
|
+
const WEBHOOK_SECRET_META = { ...ref("schemas/SecretMeta"), description: "Its signing secret's metadata, named `webhook:outbound`: set, made by this server at the first save (source console), and when; null for a webhook set before it was kept. Never the value." };
|
|
306
358
|
const WEBHOOK_SET_FIELDS = {
|
|
307
359
|
configured: { const: true }, url: { type: "string" },
|
|
360
|
+
secret: WEBHOOK_SECRET_META,
|
|
308
361
|
signing: { enum: ["sealed", "seal_key_missing", "unreadable"], description: "Whether the secret signs here: `sealed`; `seal_key_missing` (the server was handed no seal key) or `unreadable` (sealed under another key, or damaged), when nothing is sent until the webhook is removed and set again. Never the secret." },
|
|
309
362
|
disabled: { oneOf: [closed({ at: { type: "string", format: "date-time" }, reason: { type: "string" } }), { type: "null" }], description: "Set when the receiver answered 410 Gone: nothing is sent until a PUT sets the webhook again." },
|
|
310
363
|
updated_at: { type: "string", format: "date-time" },
|
|
311
364
|
};
|
|
312
365
|
const WEBHOOK_SET = closed(WEBHOOK_SET_FIELDS);
|
|
313
366
|
/** GET /settings/webhook (webhooks.ts): the webhook, or none; never its secret. */
|
|
314
|
-
const WEBHOOK_VIEW = { oneOf: [closed({ configured: { const: false } }), WEBHOOK_SET] };
|
|
367
|
+
const WEBHOOK_VIEW = { oneOf: [closed({ configured: { const: false }, secret: WEBHOOK_SECRET_META }), WEBHOOK_SET] };
|
|
315
368
|
const WEBHOOK_SECRET = { type: "string", pattern: "^whsec_[A-Za-z0-9+/]+={0,2}$", description: "The signing secret, shown this once: `whsec_` and 32 random bytes in base64, as the Standard Webhooks spec gives it. Keep it where the receiver checks `webhook-signature`." };
|
|
316
369
|
const WEBHOOK_ATTEMPT = closed({
|
|
317
370
|
webhook_id: { type: "string", description: "The message's `webhook-id`: the same on each of its tries, and on a redelivery." },
|
|
@@ -340,10 +393,9 @@ const LEARNING_REASON = {
|
|
|
340
393
|
"Set only when `state` is `dropped`, from a closed list; a new reason is announced before it ships.",
|
|
341
394
|
"`seed_failed`: the agent's learning folder could not be read or made, or its notes copied, so the run started with nothing learned.",
|
|
342
395
|
"`no_budget`: the run's cap left no room for the end-of-run turn, or refused its request. `unknown_cost`: a capped run whose spend is unknown.",
|
|
343
|
-
"`no_write_tool`, `tool_denied`: older runs only, from before the end-of-run turn answered with its notes (an agent with no `write` tool, or one a tool gate denied it); no run gets them now.",
|
|
344
396
|
"`cancelled`: a person cancelled the run. `crashed`: the run's process went. `reflect_timeout`, `reflect_failed`: the end-of-run turn did not end in time, or ended on an error.",
|
|
345
397
|
"`empty`: the turn's answer gave no note. `unparsed`: it gave notes out of format (no ```note block, one not closed or named twice), and none was kept. `propose_failed`: what it answered could not be checked. `checker`: the checks refused it, at its end or at the merge, and nothing was written to git.",
|
|
346
|
-
"`
|
|
398
|
+
"`grader`: the grader's verdict was not to keep them. `grade_failed`: the grader gave no verdict, or the grade or the merge failed.",
|
|
347
399
|
].join(" "),
|
|
348
400
|
};
|
|
349
401
|
// ---- learning/1: what a person sees and controls of an agent's learning (learning-routes.ts) ---------------------------
|
|
@@ -358,6 +410,10 @@ const LEARNING_NOTE_REQUIRED = closed({
|
|
|
358
410
|
superseded_by: { ...NULL_STRING, description: "The note that superseded it, on a superseded note; `[redacted]` as `file` is." },
|
|
359
411
|
text: { type: "string", description: "The note's whole file, front matter included." },
|
|
360
412
|
etag: { type: "string", description: "The note's version on main, the same ETag as `GET .../learning/files/{file}` answers: send it as `If-Match` to edit or retire the version shown, and a 412 means it changed since.", "x-agentrun-serve": "learning/2" },
|
|
413
|
+
runs: closed({
|
|
414
|
+
given: { ...COUNT, description: "How many of the agent's runs were given this note: named in the run's # Learned section, whole or as an index line (each run's `given`)." },
|
|
415
|
+
read: { ...COUNT, description: "How many of the agent's runs opened this note's file with the read tool (each run's `read`). 0 when none did." },
|
|
416
|
+
}, "This note's runs, counted over the agent's runs the server knows (held ones from memory, ended ones from the learning ledger): given it, and read it. Whether a run applied a note is not measured."),
|
|
361
417
|
});
|
|
362
418
|
/** When a retired note, skill or draft was retired, and by whom: on a retired one alone. */
|
|
363
419
|
const RETIRED = closed({
|
|
@@ -366,7 +422,7 @@ const RETIRED = closed({
|
|
|
366
422
|
}, "When and by whom it was retired; absent unless `status` is `retired`. POST .../restore makes it active again.");
|
|
367
423
|
/** The newest change to a note, skill or draft, from the newest commit on its file. */
|
|
368
424
|
const LAST_CHANGE = closed({
|
|
369
|
-
kind: { enum: ["approved", "edited", "created", "retired", "restored", "learned"], description: "What the change was: a person's approval, edit, creation, retire or restore (named by its commit), or `learned`, a run's merge." },
|
|
425
|
+
kind: { enum: ["approved", "edited", "created", "retired", "restored", "learned", "superseded"], description: "What the change was: a person's approval, edit, creation, retire or restore (named by its commit), `superseded`, a note a person's approval or restore of another superseded, or `learned`, a run's merge." },
|
|
370
426
|
by: { enum: ["person", "run"], description: "`person`: its owner, in the console or through the API; `run`: a run's merge." },
|
|
371
427
|
at: { type: "string", format: "date-time", description: "When: the commit's time." },
|
|
372
428
|
}, "The item's last change: the newest commit on its file (a note's file, a skill's SKILL.md, a draft's README.md), a person's (named by its subject's fixed prefix, `learning: <kind> by a person: `) or a run's merge (its Run-Id: `learned`). Absent when that commit is neither (the folder's own first commit, or one made outside the server).");
|
|
@@ -440,10 +496,16 @@ const NOTE_NAME_FILE = { type: "string", description: "The note's file name, `<s
|
|
|
440
496
|
/** The notes a run read and learned, on its learning block (runs.ts, learning.ts notesView): each present only when it
|
|
441
497
|
* holds a note. */
|
|
442
498
|
const LEARNING_NOTES = {
|
|
443
|
-
|
|
499
|
+
given: {
|
|
444
500
|
type: "array", minItems: 1,
|
|
445
501
|
items: closed({ file: NOTE_NAME_FILE, name: { type: "string", description: "The note's front-matter `name`, cut of the host's secrets as they are now." } }),
|
|
446
|
-
description: "The notes this run
|
|
502
|
+
description: "The notes this run started with: every active note its # Learned section names, given whole or as an index line naming its file in `.learning/`, as it was seeded. Absent when the run started with nothing learned. Whether the run applied a note is not measured.",
|
|
503
|
+
"x-agentrun-serve": "learning/2",
|
|
504
|
+
},
|
|
505
|
+
read: {
|
|
506
|
+
type: "array", minItems: 1,
|
|
507
|
+
items: closed({ file: NOTE_NAME_FILE, name: { type: "string", description: "The note's front-matter `name`, cut of the host's secrets as they are now." } }),
|
|
508
|
+
description: "The notes this run read from `.learning/` in its working directory, in the order it first read each: every `read` call of its job (on any harness) whose result was a success and that names a note the run started from. A note read another way, through a command (`bash`'s `cat .learning/<file>`, say), is not counted. MEMORY.md, the index every run gets in its instructions, is not one; nor is a read the run's end-of-run turn made. Found once, as the run settles, and kept with the run: absent while it runs (a follow-up included) and when it read none. Absent when the run opened no note file.",
|
|
447
509
|
"x-agentrun-serve": "learning/2",
|
|
448
510
|
},
|
|
449
511
|
learned: {
|
|
@@ -478,7 +540,79 @@ const RUN_NOTES = {
|
|
|
478
540
|
};
|
|
479
541
|
/** `properties` as a closed object, its `optional` ones left out of `required`. */
|
|
480
542
|
const closedWith = (properties, optional) => ({ ...closed(properties), properties: { ...properties, ...optional } });
|
|
481
|
-
/**
|
|
543
|
+
/** What POST /runs/{run_id}/computer/take-over and .../hand-back answer (computer-commands.ts ComputerHoldAnswer). */
|
|
544
|
+
const COMPUTER_ANSWER = closedWith({
|
|
545
|
+
hold: { enum: ["agent", "pending", "person"], description: "Who drives now: `agent`; `pending`, the owner's take waits for the agent's call in flight (new agent calls wait meanwhile); `person`, the owner." },
|
|
546
|
+
}, {
|
|
547
|
+
outcome: { enum: ["done", "cancelled", "expired"], description: "A hand-back that answered the agent's ask: the answer the agent gets, the first one." },
|
|
548
|
+
});
|
|
549
|
+
/** A secret's set, source and changed_at, from the one shared shape (secret-writes.ts SECRET_META_SCHEMA): never a value,
|
|
550
|
+
* a prefix, a length or a hash. */
|
|
551
|
+
const { set: SECRET_SET, source: SECRET_SOURCE, changed_at: SECRET_CHANGED_AT } = SECRET_META_SCHEMA.properties;
|
|
552
|
+
const SECRET_META = { set: SECRET_SET, source: SECRET_SOURCE, changed_at: SECRET_CHANGED_AT };
|
|
553
|
+
/** One secret's SecretMeta, exactly { name, set, source, changed_at }: its name is "<plane>:<id>". */
|
|
554
|
+
const SECRET_ITEM = (nameDescription) => closed({ name: { type: "string", description: nameDescription }, ...SECRET_META });
|
|
555
|
+
/** computer/1: an agent's computer kind, as Settings → Computers and the run read name it (computer-setting.ts). */
|
|
556
|
+
const COMPUTER_KIND = { enum: ["none", "sandbox", "desktop", "phone", "browser"] };
|
|
557
|
+
/** A provider in Settings → Computers (computers.ts ProviderView). */
|
|
558
|
+
const COMPUTER_PROVIDER = closedWith({
|
|
559
|
+
id: { type: "string", description: "The provider's id, as an agent's `computer.provider` names it (PUT /computers/{provider}/keys)." },
|
|
560
|
+
name: { type: "string", description: "Its name in words." },
|
|
561
|
+
metered: { type: "boolean", description: "Whether its computers are billed by the vendor." },
|
|
562
|
+
secrets: { type: "array", items: SECRET_ITEM("\"computer:<provider>:<KEY>\": KEY is the name PUT /computers/{provider}/keys takes, and the environment variable that sets it."), description: "Each key the provider declares, as its SecretMeta: never a value." },
|
|
563
|
+
required: { type: "array", items: { type: "string" }, description: "The names of the secrets the provider needs; any other may stay unset." },
|
|
564
|
+
ready: { type: "boolean", description: "Whether a run could have its computer of this kind here now: it fits this server's folder mode and every required key is saved." },
|
|
565
|
+
}, {
|
|
566
|
+
why: { type: "string", description: "Why it is not ready, in words naming the setting to fill." },
|
|
567
|
+
});
|
|
568
|
+
/** GET /computers' answer (computers.ts view). */
|
|
569
|
+
const COMPUTERS_VIEW = closed({
|
|
570
|
+
kinds: {
|
|
571
|
+
type: "array",
|
|
572
|
+
items: closedWith({
|
|
573
|
+
kind: COMPUTER_KIND,
|
|
574
|
+
offered: { type: "boolean", description: "Whether this server offers the kind now: `none` always; another when a provider that serves it fits this server's folder mode." },
|
|
575
|
+
groups: { type: "array", items: { type: "string" }, description: "The capability groups the kind needs, then those it brings when a provider declares them." },
|
|
576
|
+
tools: { type: "array", items: { type: "string" }, description: "The model's tools the kind brings, by name." },
|
|
577
|
+
providers: { type: "array", items: COMPUTER_PROVIDER, description: "The providers that serve the kind." },
|
|
578
|
+
}, { why: { type: "string", description: "Why it is not offered." } }),
|
|
579
|
+
},
|
|
580
|
+
});
|
|
581
|
+
/** POST /computers/{provider}/test's and POST /workspace/archil/test's answer. */
|
|
582
|
+
const ACCOUNT_TEST = {
|
|
583
|
+
oneOf: [
|
|
584
|
+
closed({ ok: { const: true }, detail: { type: "string", description: "What the one account-level read found." } }),
|
|
585
|
+
closed({ ok: { const: false }, why: { type: "string", description: "Why the test did not pass, in plain words naming what to check: never a key." } }),
|
|
586
|
+
],
|
|
587
|
+
};
|
|
588
|
+
/** A run's computer, on the run read (run-computer.ts runComputerField). */
|
|
589
|
+
const RUN_COMPUTER = {
|
|
590
|
+
...closedWith({
|
|
591
|
+
kind: { enum: ["sandbox", "desktop", "phone", "browser"] },
|
|
592
|
+
provider: { type: "string" },
|
|
593
|
+
state: { enum: ["starting", "ready", "taken_over", "ended", "failed"], description: "`taken_over` while the owner holds the run's desktop or phone (POST /runs/{run_id}/computer/take-over); `failed` when the run could not have its computer (error code `computer_unavailable`)." },
|
|
594
|
+
}, { why: { type: "string", description: "With `failed`: the server's words, naming the setting to fill." } }),
|
|
595
|
+
description: "The run's computer, its agent's `computer` setting: absent for a run with none.",
|
|
596
|
+
"x-agentrun-serve": "computer/1",
|
|
597
|
+
};
|
|
598
|
+
/** archil/1: GET, PUT and DELETE /workspace/archil's answer (archil-routes.ts view). */
|
|
599
|
+
const ARCHIL_VIEW = closedWith({
|
|
600
|
+
on: { type: "boolean", description: "Whether Mode 2 is on: run folders on this Archil disk. Off, they are on this server's own disk (Mode 1)." },
|
|
601
|
+
secret: { ...SECRET_ITEM("\"workspace:archil\": the Archil account key, which PUT /workspace/archil takes as keys.ARCHIL_API_KEY and the environment variable ARCHIL_API_KEY sets."), description: "The account key as its SecretMeta: never a value." },
|
|
602
|
+
}, {
|
|
603
|
+
diskId: { type: "string" },
|
|
604
|
+
region: { type: "string" },
|
|
605
|
+
s3Url: { type: "string", format: "uri" },
|
|
606
|
+
image: { type: "string", description: "The exec image, pinned by digest (`<name>@sha256:<64 hex>`); absent, Archil's default." },
|
|
607
|
+
});
|
|
608
|
+
const COMPUTER_MARK = { "x-agentrun-serve": "computer/1" };
|
|
609
|
+
const ARCHIL_MARK = { "x-agentrun-serve": "archil/1" };
|
|
610
|
+
const PROVIDER_PARAM = { name: "provider", in: "path", required: true, description: "The provider's id (GET /computers lists them).", schema: { type: "string", minLength: 1 } };
|
|
611
|
+
/** computer/1: a run's live computer kind, one live view family for every kind (GET /runs/{run_id}/computer). */
|
|
612
|
+
const RUN_COMPUTER_KIND = { enum: ["browser", "desktop", "phone"], description: "The run's computer: its agent's computer kind (`browser` for the browser tool)." };
|
|
613
|
+
/** Who drives the run's computer now (GET /runs/{run_id}/computer). */
|
|
614
|
+
const COMPUTER_HOLD = { enum: ["agent", "pending", "person"], description: "Who drives the computer now: `agent`; `pending`, the person's Take over waits for the agent's step in flight; `person`, taken over." };
|
|
615
|
+
/** trigger/1: triggers, a schedule or a signed webhook, that start an agent's capped runs or message a run (triggers.ts). */
|
|
482
616
|
const TRIGGER_MARK = { "x-agentrun-serve": "trigger/1" };
|
|
483
617
|
/** A run's `trigger`, on Run and on RunSummary alike. */
|
|
484
618
|
const RUN_TRIGGER = {
|
|
@@ -487,19 +621,21 @@ const RUN_TRIGGER = {
|
|
|
487
621
|
...TRIGGER_MARK,
|
|
488
622
|
};
|
|
489
623
|
const DATE_TIME = { type: "string", format: "date-time" };
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
624
|
+
/** A trigger's source, as `adapters` give it. */
|
|
625
|
+
const sourceSchemaOf = (adapters) => ({
|
|
626
|
+
oneOf: adapters.flatMap((a) => a.schemas),
|
|
627
|
+
description: `When it fires: ${adapters.map((a) => a.fires).join(", or ")}. Each next time is reckoned from the last nominal one, never from when the timer woke. Times missed while the server was down, or more than a minute late, are one \`missed\` firing with their count, and the schedule goes on from now.`,
|
|
628
|
+
});
|
|
629
|
+
const TRIGGER_SOURCE = sourceSchemaOf(TRIGGER_ADAPTERS);
|
|
630
|
+
/** A trigger's source as the server holds and sends it: each adapter's sent shapes (a cron line's zone and an interval's
|
|
631
|
+
* start always set, to UTC and to when it was written when the write left them out), else its own (a webhook's
|
|
632
|
+
* signature and accept, absent when the write left them out). */
|
|
633
|
+
const sentOf = (adapters) => ({ ...sourceSchemaOf(adapters), oneOf: adapters.flatMap((a) => a.sent ?? a.schemas) });
|
|
634
|
+
const TRIGGER_SOURCE_SENT = sentOf(TRIGGER_ADAPTERS);
|
|
499
635
|
const START_RUN = closedWith({
|
|
500
636
|
kind: { const: "start_run" },
|
|
501
|
-
agent_id: { type: "string", description: "The agent whose run each firing starts
|
|
502
|
-
input: { type: "object", description: "The run's input, as POST /agents/{agent_id}/runs takes it: `{content}`. Each run's content ends with a line naming the
|
|
637
|
+
agent_id: { type: "string", description: "The agent whose run each firing starts, an agentic agent or a workflow: capped either way." },
|
|
638
|
+
input: { type: "object", description: "The run's input, as POST /agents/{agent_id}/runs takes it: `{content}`. Each run's content ends with a line naming the trigger and the time it fired for, in its zone." },
|
|
503
639
|
}, { effort: { $ref: "#/components/schemas/Effort" }, max_cost_usd: { type: "number", exclusiveMinimum: 0, description: "Each run's spend cap. Absent, the agent's default (its definition's `max_cost_usd`) as it stands when the firing starts; one of the two is required, so every run a trigger starts is capped: a target with neither is 422, and a firing that finds neither (the agent's default removed since) fails." } });
|
|
504
640
|
const TRIGGER_TARGET = {
|
|
505
641
|
oneOf: [
|
|
@@ -512,9 +648,13 @@ const TRIGGER_TARGET = {
|
|
|
512
648
|
],
|
|
513
649
|
description: "What each firing does: start a run of an agent, capped, or send a message to one run.",
|
|
514
650
|
};
|
|
651
|
+
/** A firing's `by`, as `adapters` give it. */
|
|
652
|
+
/** A firing's `by`, as `adapters` give it: the clock's sources, then a run now, then the pushed ones, the order the
|
|
653
|
+
* document has always served. */
|
|
654
|
+
const firedByOf = (adapters) => ({ enum: [...adapters.filter((a) => a.delivery === "clock").map((a) => a.id), "manual", ...adapters.filter((a) => a.delivery === "push").map((a) => a.id)], description: adapters.flatMap((a) => (a.firedBy ? [a.firedBy] : [])).join(" ") });
|
|
515
655
|
const TRIGGER_FIRING = closedWith({
|
|
516
656
|
key: { type: "string", pattern: "^fir_[0-9a-f]{32}$", description: "The firing's key: from the trigger and its nominal time, or from the trigger and the Idempotency-Key of a run now. Its run is started under it, once." },
|
|
517
|
-
by:
|
|
657
|
+
by: firedByOf(TRIGGER_ADAPTERS),
|
|
518
658
|
nominal_at: { ...DATE_TIME, description: "The time it fires for, to the second; a run now's is when it was asked." },
|
|
519
659
|
status: { enum: [...FIRING_STATUSES], description: `\`due\`: recorded, its run not started yet (a full server keeps it due, with \`retry_at\`). \`started\`: its run is \`run_id\`. \`sent\`: a message_run firing's message reached \`run_id\`. \`skipped\`: the trigger's last run was still active (working, or waiting on a person), or an earlier firing was still due; \`reason\` says which. \`failed\`: the run was refused, with \`error\`; a trigger.failed webhook message says so. \`missed\`: times not fired while the server was down or its timer late (older than the catch-up window, or before the one that caught up), \`count\` of them from \`nominal_at\` on.` },
|
|
520
660
|
at: { ...DATE_TIME, description: "When it was recorded." },
|
|
@@ -522,32 +662,115 @@ const TRIGGER_FIRING = closedWith({
|
|
|
522
662
|
reason: { type: ["string", "null"] },
|
|
523
663
|
error: { oneOf: [closed({ code: { type: "string" }, message: { type: "string" } }), { type: "null" }] },
|
|
524
664
|
}, { count: { type: "integer", minimum: 1, description: "On a `missed` firing: how many times it stands for, from `nominal_at` on; a cron line's are counted to 10000, and `reason` says \"or more\" past that." }, attempts: { type: "integer", minimum: 0 }, retry_at: DATE_TIME, catch_up: { const: true, description: "A time that fired late, within the trigger's catch-up window: the server was down, or its timer late." } });
|
|
525
|
-
const
|
|
665
|
+
const TRIGGER_FIELDS = closed({
|
|
526
666
|
id: { type: "string" },
|
|
527
667
|
name: { type: "string", maxLength: 200 },
|
|
528
668
|
enabled: { type: "boolean" },
|
|
529
|
-
source:
|
|
669
|
+
source: TRIGGER_SOURCE_SENT,
|
|
530
670
|
target: TRIGGER_TARGET,
|
|
531
|
-
overlap: { enum: [...OVERLAP], description: "What a firing does while the trigger's last run is active (working, or waiting on a person): `skip`, recorded as a skipped firing with why. Never queued: a firing queued behind a run parked on a person would wait as long as the person does." },
|
|
532
671
|
catchup_window_s: { type: "integer", minimum: 0, maximum: MAX_EVERY_S, description: `How late a missed time may still fire, once: of the times that came while the server was down (or its timer was late), the latest fires if it is this recent, under its own key, and the rest are one \`missed\` firing. 0: a missed time never fires. Default ${CATCHUP_WINDOW_S}.` },
|
|
672
|
+
max_active_runs: { type: ["integer", "null"], minimum: 1, maximum: MAX_ACTIVE_RUNS, description: `For a \`start_run\` trigger of a pushed source (a webhook, with or without \`accept\`): each event starts its own run, never skipped behind the last, and this is the most of its runs active at once. A firing past it waits due and is tried again; past 20 due an event is 429 \`rate_limited\`. Null: a trigger with \`accept\` takes every run this server has room for, and one without keeps the overlap skip. A schedule or a \`message_run\` target is 422 with it set.` },
|
|
533
673
|
failures_in_a_row: { type: "integer", minimum: 0, description: `Failed firings since the last that started a run; at ${FAILURES_TO_PAUSE} the trigger turns itself off (\`disabled\`). Turned on again, it counts from 0.` },
|
|
534
|
-
disabled: { oneOf: [closed({ at: DATE_TIME, reason: { const: "auto_paused" } }), closed({ at: DATE_TIME, reason: { const: "source_unreadable" }, detail: { type: "string", description: "Why the source no longer reads." } }), { type: "null" }], description: `Why it is off, when the server turned it off: \`auto_paused\`, ${FAILURES_TO_PAUSE} failed firings in a row; \`source_unreadable\`, its cron line or zone no longer reads here (a newer cron library or time zone data refuses it), found at a start or when it came due, and only this trigger is turned off. Null once it is on again, which for \`source_unreadable\` takes a new source.` },
|
|
674
|
+
disabled: { oneOf: [closed({ at: DATE_TIME, reason: { const: "auto_paused" } }), closed({ at: DATE_TIME, reason: { const: "source_unreadable" }, detail: { type: "string", description: "Why the source no longer reads." } }), closed({ at: DATE_TIME, reason: { const: "agent_archived" }, detail: { type: "string", description: "The agent it runs as, archived." } }), closed({ at: DATE_TIME, reason: { const: "connection_lost" }, detail: { type: "string", description: "Which connection went (GitHub disconnected here, or the App's installation deleted or suspended on GitHub)." } }), { type: "null" }], description: `Why it is off, when the server turned it off: \`agent_archived\`, the agent it runs as was archived (turning it on is 409 agent_archived until the agent is unarchived); \`auto_paused\`, ${FAILURES_TO_PAUSE} failed firings in a row; \`connection_lost\`, the connection it needs went (GitHub disconnected here, or the App's installation deleted or suspended on GitHub); \`source_unreadable\`, its cron line or zone no longer reads here (a newer cron library or time zone data refuses it) or its every_s is out of range (a hand edit of its row), found at a start or when it came due, and only this trigger is turned off. Null once it is on again, which for \`source_unreadable\` takes a new source.` },
|
|
535
675
|
next_at: { type: ["string", "null"], format: "date-time", description: "When it fires next; null while it is off." },
|
|
536
|
-
last_run_id: { type: ["string", "null"], description: "The run its last firing that started one started; while that run is active (working, or waiting on a person), each firing is skipped. Null until one starts." },
|
|
676
|
+
last_run_id: { type: ["string", "null"], description: "The run its last firing that started one started; while that run is active (working, or waiting on a person), each firing is skipped, unless its firings each start their own run (a webhook with `accept`, or a pushed trigger with `max_active_runs`). Null until one starts." },
|
|
537
677
|
created_at: DATE_TIME,
|
|
538
678
|
updated_at: DATE_TIME,
|
|
539
679
|
last_firing: { oneOf: [TRIGGER_FIRING, { type: "null" }] },
|
|
540
|
-
});
|
|
680
|
+
}, "A trigger. A firing while its last run is active (working, or waiting on a person) is skipped, and recorded as a skipped firing with why: never queued, since a firing queued behind a run parked on a person would wait as long as the person does. A webhook trigger with `accept` is the exception: each event it takes starts its own run.");
|
|
681
|
+
/** A trigger's view: its fields, all there, and `hook_url`, a pushed source's alone. */
|
|
682
|
+
const TRIGGER = { ...TRIGGER_FIELDS, properties: { ...TRIGGER_FIELDS.properties, hook_url: { type: "string", description: "Where its sender posts, for a pushed source alone (absent for a schedule): a webhook's own hook, `/v2/hooks/{id}`, at this server's public URL (AGENTRUN_PUBLIC_URL) when it has one, else the path." } } };
|
|
541
683
|
const TRIGGER_WRITE = {
|
|
542
684
|
name: { type: "string", minLength: 1, maxLength: 200, description: "Default the trigger's id." },
|
|
543
685
|
enabled: { type: "boolean", default: true, description: "Off, it fires nothing; on again, it goes on from now: the time it was off is skipped, never caught up." },
|
|
544
686
|
source: TRIGGER_SOURCE,
|
|
545
687
|
target: TRIGGER_TARGET,
|
|
546
688
|
catchup_window_s: { type: "integer", minimum: 0, maximum: MAX_EVERY_S, default: CATCHUP_WINDOW_S },
|
|
689
|
+
max_active_runs: { type: ["integer", "null"], minimum: 1, maximum: MAX_ACTIVE_RUNS, description: `For a \`start_run\` trigger of a pushed source (a webhook, with or without \`accept\`): each event starts its own run, never skipped behind the last, and this is the most of its runs active at once. A firing past it waits due and is tried again; past 20 due an event is 429 \`rate_limited\`. Null: a trigger with \`accept\` takes every run this server has room for, and one without keeps the overlap skip. A schedule or a \`message_run\` target is 422 with it set. A PATCH with null clears it.` },
|
|
547
690
|
};
|
|
548
691
|
const TRIGGER_ID = { name: "trigger_id", in: "path", required: true, schema: { type: "string" } };
|
|
692
|
+
/** A webhook trigger's minted secret's metadata (secret-writes.ts SecretMeta, trigger-secrets-shown.ts): never its value. */
|
|
693
|
+
const TRIGGER_SECRET_META = { ...ref("schemas/SecretMeta"), description: "A webhook trigger's signing secret's metadata, named `trigger:<id>`: set, made by this server (source console), and when, where known (its create's and rotation's answers; a read says null). Never the value. Absent for a trigger that keeps none (a schedule's)." };
|
|
694
|
+
/** A trigger as GET and the list read it: with its minted secret's metadata, where it has one. */
|
|
695
|
+
const TRIGGER_READ = { ...TRIGGER, properties: { ...TRIGGER.properties, secret: TRIGGER_SECRET_META, note: { type: "string", description: "Present when its signing secret is kept but does not open under this server's seal key (sealed under another): why it reads as not set, and what to do (rotate it in the console). Until then each delivery is the one 401." } } };
|
|
696
|
+
/** A hook whose body did not arrive in time (push-handler.ts readCapped): answered, then its socket closed. */
|
|
697
|
+
const HOOK_TIMEOUT = { description: `\`request_timeout\`: the body did not arrive, whole, within ${HOOK_BODY_MS / 1000} s; the socket is closed after this answer.`, headers: { "X-Request-Id": ref("headers/RequestId") }, content: { "application/json": { schema: ref("schemas/Error") } } };
|
|
698
|
+
/** A verified request whose firing key was seen within its day, its firing no longer kept: nothing fired. */
|
|
699
|
+
const HOOK_DUPLICATE = closed({ ok: { const: "duplicate" } }, "A firing key seen within its day whose firing is no longer kept: nothing fired for it.");
|
|
700
|
+
/** A verified request its trigger's or its source's own filter (a webhook's accept) does not take: nothing fired. */
|
|
701
|
+
const HOOK_IGNORED = closed({ ok: { const: "ignored" } }, "Verified, and not an event the trigger's `accept` (or its source's own filter) takes: nothing fired.");
|
|
702
|
+
/** What a pushed request made: one firing for each event it held that a trigger takes, in order (a key seen within its
|
|
703
|
+
* day whose firing is no longer kept, `{ok: "duplicate"}`); none for a request with no event, or whose events no
|
|
704
|
+
* trigger takes. Its firings' `by` names the sources `adapters` give. */
|
|
705
|
+
const hookFiringsOf = (adapters) => closed({ firings: { type: "array", items: { oneOf: [{ ...TRIGGER_FIRING, properties: { ...TRIGGER_FIRING.properties, by: firedByOf(adapters) } }, HOOK_DUPLICATE] } } });
|
|
549
706
|
const TRIGGER_SECRET = { type: "string", pattern: "^whsec_[A-Za-z0-9+/]+={0,2}$", description: "A webhook trigger's signing secret, shown this once: `whsec_` and 32 random bytes in base64, as the Standard Webhooks spec gives it. Never in any GET; kept sealed under the seal key. Sign each request to /hooks/{trigger_id} with it." };
|
|
550
|
-
|
|
707
|
+
/** github/1: Connect GitHub, the server's one GitHub App (github-connection.ts). */
|
|
708
|
+
const GITHUB_MARK = { "x-agentrun-serve": "github/1" };
|
|
709
|
+
const GITHUB_CONNECTION = closed({ connected: { const: true }, app_id: { type: "string" }, slug: { type: "string", description: "The App's name on GitHub, as its URL has it." }, installations: { type: "array", items: closed({ id: { type: "integer" }, account: { type: "string", description: "The GitHub user or organization it is installed on." } }), description: "Where the App is installed, as its installation events and setup redirects say." } }, "The server's GitHub App: never a secret.");
|
|
710
|
+
/** GET /integrations/github: whether a GitHub App is connected, always a 200 (not connected is an answer, never a 404 a
|
|
711
|
+
* browser logs as an error), and the App when it is. */
|
|
712
|
+
const GITHUB_STATUS = { oneOf: [closed({ connected: { const: false } }, "No GitHub App is connected to this server: Connect GitHub in Settings."), GITHUB_CONNECTION] };
|
|
713
|
+
/** templates/1: template packages, listed and applied (templates.ts; the format is templates/README.md). */
|
|
714
|
+
const TEMPLATE_MARK = { "x-agentrun-serve": "templates/1" };
|
|
715
|
+
const NULLABLE_STRING = { type: ["string", "null"] };
|
|
716
|
+
const TEMPLATE_PARAMETER = closedWith({ type: { enum: [...PARAMETER_TYPES] }, required: { type: "boolean" }, description: { type: "string" } }, { pattern: { type: "string", description: "A regular expression (Unicode) a string's value matches." }, enum: { type: "array", minItems: 1, items: { type: ["string", "number", "boolean"] }, description: "The values it may take, a closed set (a form shows a choice); never beside a pattern." }, default: { type: ["string", "number", "boolean"], description: "Its value when apply leaves it out (of its type; never on a required one). A parameter that sets a schedule's cron or timezone has one, and the package's own schedule is checked with it." } });
|
|
717
|
+
const TEMPLATE = closed({
|
|
718
|
+
name: { type: "string", description: "Its folder's name, the one apply takes." },
|
|
719
|
+
display_name: { type: ["string", "null"], description: "The agent's name, its `${parameters.<name>}` filled at apply; null: the package's name." },
|
|
720
|
+
version: { type: "string", description: "SemVer." },
|
|
721
|
+
description: { type: "string" },
|
|
722
|
+
license: NULLABLE_STRING,
|
|
723
|
+
author: { type: ["object", "null"], additionalProperties: false, required: ["name"], properties: { name: { type: "string" }, email: { type: "string" }, url: { type: "string" } }, description: "Who made the package; null when it names no one." },
|
|
724
|
+
repository: NULLABLE_STRING,
|
|
725
|
+
output: { type: ["object", "null"], additionalProperties: false, required: ["schema", "json_schema"], properties: { schema: { type: "string", description: "The schema's file in the package; it ships beside each SKILL.md." }, json_schema: { type: ["object", "null"], description: "The JSON Schema the agent's answer meets (its last fenced json block)." } }, description: "The shape of the agent's answer; null when the package names none." },
|
|
726
|
+
harness: { type: ["array", "null"], items: { type: "string" }, description: "The harnesses it runs on, in the order it prefers them: apply takes the first this server runs. Null: any, the server's default." },
|
|
727
|
+
model: { type: ["object", "null"], additionalProperties: false, required: ["tier"], properties: { tier: { enum: Object.keys(MODEL_TIERS) }, prefer: { type: "string" } }, description: "The model it wants: `prefer` when this server runs it, else this server's model for the tier (fast: AGENT_MODEL_FAST, balanced: AGENT_MODEL, strong: AGENT_MODEL_STRONG, each else the default). Null: the server's default." },
|
|
728
|
+
effort: { type: ["string", "null"], description: "Its thinking level, the definition's `thinking`." },
|
|
729
|
+
tools: { type: ["array", "null"], items: { type: "string" }, description: "The tools its agent is granted; null: those a new agent gets." },
|
|
730
|
+
mcp: {
|
|
731
|
+
type: "array",
|
|
732
|
+
items: closed({
|
|
733
|
+
server: { type: "string" },
|
|
734
|
+
required: { type: "boolean" },
|
|
735
|
+
tools: { type: "array", items: closedWith({ name: { type: "string" }, tool: { type: "string", description: "Its gate name, `mcp:<server>/<tool>`: what apply's `grants` and the tool settings name." }, asks: { enum: ["allow", "ask"], description: "The permission the package asks the owner for: a consent screen shows it, and only the owner's `grants` at apply set it." } }, { pin: { type: "object", additionalProperties: { anyOf: [{ type: ["string", "number", "boolean", "null"] }, { type: "array", items: { type: ["string", "number", "boolean", "null"] } }] }, description: "The arguments (each a value, or a list one of which) each call of the tool must carry, `${parameters.<name>}` unfilled: apply writes them, filled, as the tool's pin in the agent's tool_settings, so the tool gate refuses a call with any other (a send goes only to the destination the owner sets). A pin whose parameter apply is not given sets the tool to deny instead, with a `pins.<tool>` warning. Until the agent store's cutover apply writes no pin and warns `pins.<tool>` with the pin to set on the server.", "x-agentrun-serve": "pins/1" } }) },
|
|
736
|
+
}),
|
|
737
|
+
description: "The MCP servers it uses, by the name this server saves them under, and the tools of each it grants: apply grants them when the server is saved here, each at the owner's own setting (a third-party tool asks by default), and sets to allow only those the apply's `grants` name; one not saved is skipped with a warning, or, `required`, refuses the apply (409, nothing made).",
|
|
738
|
+
},
|
|
739
|
+
parameters: { type: "object", additionalProperties: TEMPLATE_PARAMETER, description: "What apply takes in `parameters`, by name, put where the package writes `${parameters.<name>}`." },
|
|
740
|
+
secrets: { type: "array", items: { type: "string" }, description: "The keys this server must have, by variable name (a saved key counts), before apply makes anything." },
|
|
741
|
+
budget: { type: ["object", "null"], additionalProperties: false, required: ["per_run_usd"], properties: { per_run_usd: { type: "number" } }, description: "Each run's spend cap, the agent's max_cost_usd. Required of a package with triggers." },
|
|
742
|
+
learning: { type: "boolean" },
|
|
743
|
+
approvals_default: { enum: ["ask", "never"], description: "What the package recommends for the agent's approvals: `ask`, the agent asks its person before a tool runs; `never`, it runs unattended (a template whose job runs on triggers). Deny settings and pins hold either way: a pinned write can only go where its pin says." },
|
|
744
|
+
triggers: { type: "array", items: { type: "object" }, description: "The triggers apply makes on its agent: POST /triggers bodies with no agent_id, placeholders unfilled." },
|
|
745
|
+
skills: { type: "array", items: { type: "string" } },
|
|
746
|
+
evals: { type: "array", items: { type: "string" }, description: `Its eval cases (evals/<case>/: prompt.md and graders of ${GRADER_TYPES.join(", ")}); none runs here.` },
|
|
747
|
+
});
|
|
748
|
+
const TEMPLATE_APPLY = {
|
|
749
|
+
type: "object", additionalProperties: false,
|
|
750
|
+
properties: {
|
|
751
|
+
parameters: { type: "object", description: "The package's parameters (GET /templates), by name, each of its type." },
|
|
752
|
+
grants: { type: "array", items: { type: "string" }, description: "The owner's answer to the consent screen: the package's MCP tools, by gate name (`mcp:<server>/<tool>`, GET /templates `mcp[].tools[].tool`), the agent is allowed to call unasked. Any other is 422. One the owner denies on this server stays denied, with a warning. A grant is written as the agent's own tool setting, which outranks the server's ask or allow; a deny set on this server, before or after the apply, still refuses the tool there, as a server deny is absolute (edit its `definition.tool_settings` to take a grant back). Absent, none: every tool keeps the owner's setting." },
|
|
753
|
+
overrides: { type: "object", additionalProperties: false, properties: { model: { type: "string", pattern: MODEL_REF.source, description: "The agent's model in place of the one the package's tier and preference pick, \"provider/model-id\"." }, approvals: { enum: ["ask", "never"], description: "The agent's approvals (its definition's): never runs it unattended (each tool that would ask allowed, a deny still refusing), ask makes it ask. Absent: the package's `approvals_default` (`ask` only when it names none).", "x-agentrun-serve": "unattended/1" } } },
|
|
754
|
+
},
|
|
755
|
+
};
|
|
756
|
+
const TEMPLATE_APPLIED = closedWith({
|
|
757
|
+
template: { type: "string" },
|
|
758
|
+
version: { type: "string" },
|
|
759
|
+
agent_id: { type: "string", description: "The agent made (GET /agents/{agent_id})." },
|
|
760
|
+
trigger_ids: { type: "array", items: { type: "string" }, description: "Its triggers, in the package's order (GET /triggers/{trigger_id})." },
|
|
761
|
+
warnings: { type: "array", items: ref("schemas/InputIssue"), description: "What this host still lacks for the agent to run, as POST /agents answers it; a webhook trigger the apply made adds a warning pointing to the console for its signing secret, never the secret itself (the first answer to the owner's signed-in session shows it once, under `webhook_secrets`)." },
|
|
762
|
+
}, {
|
|
763
|
+
webhook_secrets: {
|
|
764
|
+
type: "array",
|
|
765
|
+
description: "Each webhook trigger it made, in trigger_ids' order; absent when it made none. Each carries its secret's metadata (`secret`) and, in the first answer to the owner's signed-in session alone, its `signing_secret`, shown this once as POST /triggers shows it; to the API token, or on a replay under the same Idempotency-Key, `secret_set` and `note` in its place.",
|
|
766
|
+
items: closedWith({ trigger_id: { type: "string" }, secret: { ...ref("schemas/SecretMeta"), description: "Its signing secret's metadata, named `trigger:<id>`. Never the value." } }, {
|
|
767
|
+
signing_secret: { type: "string", pattern: "^whsec_[A-Za-z0-9+/]+={0,2}$", description: "Its signing secret, shown this once: in the apply's first answer to the owner's signed-in session alone." },
|
|
768
|
+
secret_set: { const: true },
|
|
769
|
+
note: { type: "string", description: "In place of the secret: to the API token, the words that send the person to the console to rotate it there; on a replay, that it was shown once." },
|
|
770
|
+
}),
|
|
771
|
+
},
|
|
772
|
+
});
|
|
773
|
+
const TRIGGER_ERRORS = "The triggers are rows in the server's store, read as they are now. A store busy with another write answers 409 home_busy, retryable: send it again.";
|
|
551
774
|
const RUN_LEARNING = {
|
|
552
775
|
oneOf: [
|
|
553
776
|
closedWith({
|
|
@@ -713,7 +936,7 @@ const HOME_PATH = {
|
|
|
713
936
|
};
|
|
714
937
|
const RAW = { "application/octet-stream": { schema: { type: "string", contentMediaType: "application/octet-stream" } }, "*/*": { schema: { type: "string" } } };
|
|
715
938
|
const HOME_PATHS = "A path with an empty, `.` or `..` segment, a backslash, a NUL or a leading `/`, a segment that is not plain text (not its own NFC form, or holding a default-ignorable code point), or over 1024 characters, is `400 invalid_file_path`; a segment that starts with `.` is `403 system_file_forbidden`.";
|
|
716
|
-
const HOME_WRITES = "A path more than 16 directories deep, past where the list goes, is `400 invalid_file_path`. A path at or under one of `capabilities.home.host_owned` (`learning/`, `sign-ins/`) is `403 system_file_forbidden` with `details.reason` `host_owned`: matched on the path as normalized, by its first segment folded (compatibility form, any case, no combining marks), so `./Learning/x` too
|
|
939
|
+
const HOME_WRITES = "A path more than 16 directories deep, past where the list goes, is `400 invalid_file_path`. A path at or under one of `capabilities.home.host_owned` (`learning/`, `sign-ins/`) is `403 system_file_forbidden` with `details.reason` `host_owned`: matched on the path as normalized, by its first segment folded (compatibility form, any case, no combining marks), so `./Learning/x` too. A link on the way, or as the file, is `403 system_file_forbidden` with `details.reason` `link`: never followed. A path that names a directory, or runs through a file, is `400 invalid_file_path`. An archived agent's home is written as any other's. Where \`capabilities.home.writes\` is false (no /proc/self/fd, as on macOS), the write or delete is \`501 unsupported_here\`.";
|
|
717
940
|
/** This server's own routes, outside the contract. */
|
|
718
941
|
/** One JSON-RPC 2.0 message, and the answer to a request (POST /mcp). */
|
|
719
942
|
const RPC_MESSAGE = { type: "object", required: ["jsonrpc"], properties: { jsonrpc: { const: "2.0" }, id: { type: ["string", "number"] }, method: { type: "string" }, params: { type: "object" } } };
|
|
@@ -794,6 +1017,17 @@ const EXTENSIONS = {
|
|
|
794
1017
|
],
|
|
795
1018
|
responses: { "200": json(ref("schemas/RunList"), "One page of runs, newest first."), ...errors(400, 401, 429, 500) },
|
|
796
1019
|
},
|
|
1020
|
+
post: {
|
|
1021
|
+
operationId: "createInlineRun", tags: ["runs"], summary: "Start a run of an agent another system owns, given inline",
|
|
1022
|
+
description: "Starts a run as POST /agents/{agent_id}/runs does, with that route's run fields, checks and answer, of an agent given inline: `definition` (with `skills` and `note`) as POST /agents takes one and checked as it checks one, in its words, and `external`, the agent's reference in the system that owns it. The agent here is one per `external` source, kind and id, made by its first run; its revision is one per `external.version`, made by that version's first run and made current then, which also brings the agent's name and description up to it. A later run of a version reuses its revision and changes nothing. A version's definition never changes here: another definition under a version already run is `409 external_body_conflict`, nothing written, and the source publishes a new version. Two first runs at once make one agent and one revision. The agent is read-only here (its edits, current revision and archive are `403 forbidden`); it is read, run, learns and is triggered as any agent. `revision` is not taken: the run runs its version's. The run reads, on every read route, as a run of an agent made with POST /agents.",
|
|
1023
|
+
parameters: [ref("parameters/IdempotencyKey")],
|
|
1024
|
+
requestBody: { required: true, content: { "application/json": { schema: ref("schemas/RunCreateInline") } } },
|
|
1025
|
+
responses: {
|
|
1026
|
+
"202": { description: "The run, accepted, as POST /agents/{agent_id}/runs answers it. Follow it on its timeline.", headers: { Location: ref("headers/Location"), "Idempotent-Replayed": ref("headers/IdempotentReplayed") }, content: { "application/json": { schema: ref("schemas/Run") } } },
|
|
1027
|
+
...errors(400, 401, 409, 422, 429, 500),
|
|
1028
|
+
},
|
|
1029
|
+
"x-agentrun-serve": "inlineagent/1",
|
|
1030
|
+
},
|
|
797
1031
|
},
|
|
798
1032
|
"/agents/{agent_id}/revisions": {
|
|
799
1033
|
get: {
|
|
@@ -845,9 +1079,66 @@ const EXTENSIONS = {
|
|
|
845
1079
|
"/runs/{run_id}/graph": {
|
|
846
1080
|
get: {
|
|
847
1081
|
operationId: "getRunGraph", tags: ["runs"], summary: "A workflow run's graph, live",
|
|
848
|
-
description: "The revision's workflow and its graph, each node's state (a map's items, a route's branch taken), the decisions with their receipts, the calls with their input and output, and the totals. Readable while the run goes. 404 for an agentic run.",
|
|
1082
|
+
description: "The revision's workflow and its graph, each node's state (a map's items, a route's branch taken), the decisions with their receipts, the calls with their input and output, and the totals. Readable while the run goes. 404 for an agentic run. 403 `forbidden` while this server can't read the browser sign-in the run was handed (its seal key changed or is missing): what its nodes said could repeat the sign-in's pointer, so none of it is served until the sign-in opens again.",
|
|
1083
|
+
parameters: [ref("parameters/RunId")],
|
|
1084
|
+
responses: { "200": json(RUN_GRAPH, "The run's graph as it stands."), ...errors(401, 403, 404, 429, 500) },
|
|
1085
|
+
},
|
|
1086
|
+
},
|
|
1087
|
+
"/runs/{run_id}/browser": {
|
|
1088
|
+
get: {
|
|
1089
|
+
operationId: "getRunBrowser", tags: ["runs"], summary: "Watch the run's browser live and take it over: its viewer link, for the owner",
|
|
1090
|
+
description: "The live view of the run's browser session: `live` with `viewer`, a link on this server (`/v2/runs/{run_id}/browser/live/v/<id>#t=<token>`) to open, or frame, in the console, while a session is open; `none` when the run has a browser but no session is open (or its process is gone); `off` when the run has no browser at all, with `reason`: its agent has no browser tool, or its browser resolves unavailable here (the tool plane's words, as capabilities give them). The viewer watches until its Take over, then drives until its Hand back (features.browser_live): outside a hold the run drops its input. The token, in the link's fragment, opens that one session's view, and drives it once taken over: it dies when the session is released, and a second viewer of the same session is refused (viewer_in_use). The viewer's page is served under the link's path with `frame-ancestors 'self'`, and its WebSocket is taken only from this server's own origin (or its public address, AGENTRUN_PUBLIC_URL). It takes the owner's password session in the console: never a token, which a run's process, an MCP client or a script may hold (403); no credential is 401. The vendors' own live-view links never leave the run's process.",
|
|
1091
|
+
parameters: [ref("parameters/RunId")],
|
|
1092
|
+
responses: {
|
|
1093
|
+
"200": json({ oneOf: [closed({ state: { const: "off" }, reason: { type: "string", description: "Why the run has no browser, in plain words." } }), closed({ state: { const: "none" } }), closed({ state: { const: "live" }, viewer: { type: "string", description: "The viewer's link on this server, its token in the fragment." } })] }, "The run's live view, none open, or no browser."),
|
|
1094
|
+
...errors(401, 403, 404, 429, 500),
|
|
1095
|
+
},
|
|
1096
|
+
"x-agentrun-serve": "liveview/1",
|
|
1097
|
+
},
|
|
1098
|
+
},
|
|
1099
|
+
"/runs/{run_id}/browser/hand-back": {
|
|
1100
|
+
post: {
|
|
1101
|
+
operationId: "handBackRunBrowser", tags: ["runs"], summary: "Answer the agent's ask for you in its browser",
|
|
1102
|
+
description: "When a run's agent asks for the person in its browser (its `browser_request_handoff` tool), the run reads input_required/waiting with `pending.kind` `browser` (what it asks, when it is done, when the ask expires), its timeline shows \"Waiting for you: <instruction>\", and `run.needs_input` fires. The owner does it in the live view (GET /runs/{run_id}/browser: Take over, then Hand back) and answers here: `done` when it is done, `cancelled` when they will not. The first answer wins: the same answer again is 200, a different one 409 `handoff_answered` (`details.outcome`, the answer it has); an ask unanswered 15 minutes has expired, and an answer after that is 409 with `outcome` `expired`. Any answer hands the browser back to the agent, ending a take-over. 404 when the run's agent has asked for nobody. It takes the owner's password session in the console: never a token (403); no credential is 401. The person's time is held under the run's cap from the ask (the next 15 minutes of session time at the provider's price): with no room the agent is told so and no ask is made.",
|
|
849
1103
|
parameters: [ref("parameters/RunId")],
|
|
850
|
-
|
|
1104
|
+
requestBody: { required: true, content: { "application/json": { schema: closed({ outcome: { enum: ["done", "cancelled"], description: "`done`: the person did what the agent asked; `cancelled`: they will not." } }) } } },
|
|
1105
|
+
responses: {
|
|
1106
|
+
"200": json(closed({ outcome: { enum: ["done", "cancelled"], description: "The answer the agent gets." } }), "The answer, the first one."),
|
|
1107
|
+
...errors(401, 403, 404, 409, 422, 429, 500),
|
|
1108
|
+
},
|
|
1109
|
+
"x-agentrun-serve": "liveview/2",
|
|
1110
|
+
},
|
|
1111
|
+
},
|
|
1112
|
+
"/runs/{run_id}/computer/take-over": {
|
|
1113
|
+
post: {
|
|
1114
|
+
operationId: "takeOverRunComputer", tags: ["runs"], summary: "Take over the run's desktop or phone",
|
|
1115
|
+
description: `The owner takes the run's desktop or phone: a row the run's runner applies. The take is \`pending\` while the agent's call in flight finishes (never cut in half), then the owner's (\`person\`); the agent's screen, input and phone calls wait meanwhile. At the hand-back a look (a screenshot, the app list) runs on the screen as the owner left it; an act (input, a tap, a swipe, typing, opening an app) is not done, and the agent is told the person had the computer and to look again. The take goes back to the agent on its own after ${TAKE_OVER_MINUTES} minutes with no input from the owner, when the live view closes, or when the computer's session ends. Taking one already pending or taken is the same answer, and writes nothing. 404 when the run has no desktop or phone; 409 \`computer_not_live\` when it is not up now. The run stays working. It takes the owner's password session in the console: never a token (403).`,
|
|
1116
|
+
parameters: [ref("parameters/RunId")],
|
|
1117
|
+
requestBody: { required: false, content: { "application/json": { schema: closed({}) } } },
|
|
1118
|
+
responses: { "200": json(COMPUTER_ANSWER, "Who drives now: pending until the agent's call in flight ends, then the person."), ...errors(401, 403, 404, 409, 422, 429, 500) },
|
|
1119
|
+
"x-agentrun-serve": "computer/1",
|
|
1120
|
+
},
|
|
1121
|
+
},
|
|
1122
|
+
"/runs/{run_id}/computer/hand-back": {
|
|
1123
|
+
post: {
|
|
1124
|
+
operationId: "handBackRunComputer", tags: ["runs"], summary: "Hand the run's computer back to the agent, or answer its ask for the owner",
|
|
1125
|
+
description: "Every kind of computer. A desktop or a phone: when the run's agent asked for the owner (its `computer_request_handoff` tool; the run reads input_required/waiting), this answers the ask: `outcome` `done` (the default) or `cancelled`, and a take in force ends with it. Otherwise it ends the owner's take, and the agent's waiting calls go on. A browser: this answers its agent's ask as POST /runs/{run_id}/browser/hand-back does, the one answer either route gives. A row the run's runner applies; the first hand-back wins, decided at the write: a second hand-back of the same take, or one after the take went back another way (no input, the live view closed, the computer's session ended), is 409 `handoff_answered` in words; for an ask, the same answer again is that answer and a different one is 409 (`details.outcome`), as is an answer after the ask expired. 404 when the agent asked nothing and nobody took the computer. It takes the owner's password session in the console: never a token (403).",
|
|
1126
|
+
parameters: [ref("parameters/RunId")],
|
|
1127
|
+
requestBody: { required: false, content: { "application/json": { schema: closedWith({}, { outcome: { enum: ["done", "cancelled"], description: "The answer to the agent's ask: `done` when the person did what it asked, `cancelled` when they will not. Absent: done." } }) } } },
|
|
1128
|
+
responses: { "200": json(COMPUTER_ANSWER, "Who drives now, and the answer the agent gets when this answered its ask."), ...errors(401, 403, 404, 409, 422, 429, 500) },
|
|
1129
|
+
"x-agentrun-serve": "computer/1",
|
|
1130
|
+
},
|
|
1131
|
+
},
|
|
1132
|
+
"/runs/{run_id}/computer": {
|
|
1133
|
+
get: {
|
|
1134
|
+
operationId: "getRunComputer", tags: ["runs"], summary: "Watch the run's computer live and take it over: its viewer link, for the owner",
|
|
1135
|
+
description: "The live view of the run's computer, one family for every kind (`browser`, `desktop`, `phone`: the run's agent's computer). `live` with `viewer`, a link on this server (`/v2/runs/{run_id}/computer/live/v/<id>#t=<token>`) to open, or frame, in the console, while a viewer is open; `none` when the run has a computer but no session is up (or it ended); `off` when there is no computer here (its agent has none, or its computer resolves unavailable here), with `why` in plain words. `kind` is the run's computer, on every answer but `off`. `hold` says who drives now: `agent`; `pending`, the person's Take over waits for the agent's step; `person`. The viewer watches until its Take over, then drives until its Hand back, both in the viewer's own bar: outside a hold the run drops its input. The token is in the link's fragment alone, never in a request line, a Referer or a log; the viewer's page sends it once, in its WebSocket hello. It opens that one session's view, and drives it once taken over: it dies with the computer (its release), the run's end, or the owner's sign-out (the socket closes), and a second viewer of the same session is refused (viewer_in_use). The viewer's page is served under the link's path with `frame-ancestors 'self'`, and its WebSocket is taken only from this server's own origin (or its public address, AGENTRUN_PUBLIC_URL) with the owner's cookie. It takes the owner's password session in the console: never a token, which a run's process, an MCP client or a script may hold (403); no credential is 401. The vendors' own live-view links never leave the run's process.",
|
|
1136
|
+
parameters: [ref("parameters/RunId")],
|
|
1137
|
+
responses: {
|
|
1138
|
+
"200": json({ oneOf: [closedWith({ state: { const: "off" }, hold: COMPUTER_HOLD }, { why: { type: "string", description: "Why there is no computer view here, in plain words." } }), closed({ state: { const: "none" }, kind: RUN_COMPUTER_KIND, hold: COMPUTER_HOLD }), closed({ state: { const: "live" }, kind: RUN_COMPUTER_KIND, viewer: { type: "string", description: "The viewer's link on this server, `/v2/runs/{run_id}/computer/live/v/<id>#t=<token>`: its token in the fragment alone." }, hold: COMPUTER_HOLD })] }, "The run's live view, none open, or no computer here."),
|
|
1139
|
+
...errors(401, 403, 404, 429, 500),
|
|
1140
|
+
},
|
|
1141
|
+
"x-agentrun-serve": "computer/1",
|
|
851
1142
|
},
|
|
852
1143
|
},
|
|
853
1144
|
"/workflows/validate": {
|
|
@@ -861,7 +1152,7 @@ const EXTENSIONS = {
|
|
|
861
1152
|
"/runs/{run_id}": {
|
|
862
1153
|
patch: {
|
|
863
1154
|
operationId: "raiseRunCap", tags: ["runs"], summary: "Raise a run's spend cap",
|
|
864
|
-
description: "Raises `max_cost_usd` of
|
|
1155
|
+
description: "Raises `max_cost_usd` of a run that named one, agentic or workflow; only a raise: the new cap is above the run's current cap, its last raise included (422 otherwise, and for a run with no cap); the same raise sent again (a retry) changes nothing and answers as the first did. The run's serve.json keeps it before anything else, so its next process and a server started again run under it. A run paused at its cap (`pending.kind` budget) goes on: the answer comes at once (`resumed` true, its `message_id`), and once its process has been let go the server sends it one follow-up turn under that id, \"The cap was raised to $X; continue the task.\", which runs under the new cap; it is sent once, by a server started again if this one stopped before it went. A second raise before it goes answers the same `message_id`; one that cannot be sent is tried again, then the run ends failed, saying why. Caps within 1e-9 are the same cap. A run working keeps the cap its process was opened with until its next process (`note` says so). A workflow run takes no follow-up: paused at its cap, the step that waits there is judged again under the new cap in its process, or, once the pause let its process go (10 minutes on), the run is opened again under it and resumes from its journal, sending no completed node again (`resumed` true, no `message_id`); a working one's process holds the new cap from its next check. 409 not_continuable for an ended run.",
|
|
865
1156
|
parameters: [ref("parameters/RunId")],
|
|
866
1157
|
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, required: ["max_cost_usd"], properties: { max_cost_usd: { type: "number", exclusiveMinimum: 0, description: "The new cap, above the run's current cap." } } } } } },
|
|
867
1158
|
responses: {
|
|
@@ -880,14 +1171,76 @@ const EXTENSIONS = {
|
|
|
880
1171
|
operationId: "pauseRun", tags: ["runs"], summary: "Pause a workflow run",
|
|
881
1172
|
description: "What is in flight finishes; no node, model call or decision starts until the run is resumed. The run's status reads `paused`, and stays so across a restart of the server. 501 for an agentic run, 409 not_continuable for an ended one.",
|
|
882
1173
|
parameters: [ref("parameters/RunId")],
|
|
883
|
-
responses: { "200": json(PAUSED, "The run, paused."), ...errors(401, 404, 409, 429, 500) },
|
|
1174
|
+
responses: { "200": json(PAUSED, "The run, paused."), ...errors(401, 404, 409, 429, 500, 501) },
|
|
884
1175
|
},
|
|
885
1176
|
},
|
|
886
1177
|
"/runs/{run_id}/resume": {
|
|
887
1178
|
post: {
|
|
888
1179
|
operationId: "resumeRun", tags: ["runs"], summary: "Resume a paused workflow run",
|
|
1180
|
+
description: "501 unsupported_here for an agentic run, which never pauses here; 409 not_continuable for an ended one.",
|
|
889
1181
|
parameters: [ref("parameters/RunId")],
|
|
890
|
-
responses: { "200": json(PAUSED, "The run, going again."), ...errors(401, 404, 409, 429, 500) },
|
|
1182
|
+
responses: { "200": json(PAUSED, "The run, going again."), ...errors(401, 404, 409, 429, 500, 501) },
|
|
1183
|
+
},
|
|
1184
|
+
},
|
|
1185
|
+
"/computers": {
|
|
1186
|
+
get: {
|
|
1187
|
+
operationId: "listComputers", tags: ["local"], summary: "Settings → Computers: the kinds of computer this server offers, each provider and whether its keys are saved",
|
|
1188
|
+
description: "Each kind an agent's `computer` may name (none, sandbox, desktop, phone, browser): whether this server offers it now and why not, the capability groups and model tools it brings, and each provider that serves it, with its key names and whether each is saved (never a value), whether it is metered, and whether a run could have it here now. A sandbox holds the run's folder: on this server's own disk (Mode 1) only a provider that binds a local folder serves it; on the owner's Archil disk (Mode 2, PUT /workspace/archil) only one that mounts the disk.",
|
|
1189
|
+
responses: { "200": json(COMPUTERS_VIEW, "The kinds, each with its providers."), ...errors(401, 429, 500) },
|
|
1190
|
+
...COMPUTER_MARK,
|
|
1191
|
+
},
|
|
1192
|
+
},
|
|
1193
|
+
"/computers/{provider}/keys": {
|
|
1194
|
+
put: {
|
|
1195
|
+
operationId: "saveComputerKeys", tags: ["local"], summary: "Save a computer provider's keys, sealed",
|
|
1196
|
+
description: "Each key the provider declares (GET /computers names them) is sealed under the server's seal key; null removes one. Saving or removing a key is a secret write: it takes the owner's signed-in session, and the API token is 403. A name it does not declare, a value that is not a non-empty string, or any key on a server with no seal key is 422 input_invalid with its fields, and nothing is saved. The answer is the provider as GET /computers shows it: never a value.",
|
|
1197
|
+
parameters: [PROVIDER_PARAM],
|
|
1198
|
+
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: { type: ["string", "null"], "x-agentrun-secret": true }, description: "The provider's key names, each its value, or null to remove it." } } } },
|
|
1199
|
+
responses: { "200": json(COMPUTER_PROVIDER, "The provider, its keys saved or not."), ...errors(401, 403, 404, 422, 429, 500) },
|
|
1200
|
+
...COMPUTER_MARK,
|
|
1201
|
+
},
|
|
1202
|
+
},
|
|
1203
|
+
"/computers/{provider}/test": {
|
|
1204
|
+
post: {
|
|
1205
|
+
operationId: "testComputer", tags: ["local"], summary: "Test a computer provider's account with its saved keys",
|
|
1206
|
+
description: "One account-level read with the provider's saved keys (a list by label, the vendor's own check): it never makes a computer, so it never spends. ok with what it read; else why, in plain words naming what to check (a key not saved, a key the vendor refused, a vendor not reached), never a key.",
|
|
1207
|
+
parameters: [PROVIDER_PARAM],
|
|
1208
|
+
responses: { "200": json(ACCOUNT_TEST, "The test's answer."), ...errors(401, 404, 429, 500) },
|
|
1209
|
+
...COMPUTER_MARK,
|
|
1210
|
+
},
|
|
1211
|
+
},
|
|
1212
|
+
"/workspace/archil": {
|
|
1213
|
+
get: {
|
|
1214
|
+
operationId: "getWorkspaceArchil", tags: ["local"], summary: "Whether run folders are on an Archil disk (Mode 2), its settings, and whether its keys are saved",
|
|
1215
|
+
responses: { "200": json(ARCHIL_VIEW, "The Archil settings, never a key."), ...errors(401, 429, 500) },
|
|
1216
|
+
...ARCHIL_MARK,
|
|
1217
|
+
},
|
|
1218
|
+
put: {
|
|
1219
|
+
operationId: "putWorkspaceArchil", tags: ["local"], summary: "Turn Mode 2 on: run folders on this Archil disk",
|
|
1220
|
+
description: "Replaces the Archil settings (the disk, its region and S3 URL, and an exec image pinned by digest when given) and seals the account key (ARCHIL_API_KEY) under the server's seal key when given; null removes it, and a key not given is kept. No disk token is kept: a computer's mount credential is minted per run from the account key, so ARCHIL_DISK_TOKEN is refused like any field Archil does not take. Any PUT here is a secret write, whatever its body: it takes the owner's signed-in session, and the API token is 403, since the disk, region and S3 URL say where every run's files go. A field that is not right, or an image not pinned by digest, is 422 input_invalid with its fields, and nothing is saved. The answer never holds a key.",
|
|
1221
|
+
requestBody: {
|
|
1222
|
+
required: true,
|
|
1223
|
+
content: { "application/json": { schema: closedWith({ diskId: { type: "string", minLength: 1 }, region: { type: "string", minLength: 1 }, s3Url: { type: "string", format: "uri", pattern: "^https://" } }, {
|
|
1224
|
+
image: { type: "string", pattern: "^[^\\s@]+@sha256:[0-9a-f]{64}$" },
|
|
1225
|
+
keys: { type: "object", additionalProperties: false, properties: Object.fromEntries(ARCHIL_KEY_NAMES.map((name) => [name, { type: ["string", "null"], minLength: 1, "x-agentrun-secret": true }])) },
|
|
1226
|
+
}) } },
|
|
1227
|
+
},
|
|
1228
|
+
responses: { "200": json(ARCHIL_VIEW, "The Archil settings, saved."), ...errors(401, 403, 422, 429, 500) },
|
|
1229
|
+
...ARCHIL_MARK,
|
|
1230
|
+
},
|
|
1231
|
+
delete: {
|
|
1232
|
+
operationId: "deleteWorkspaceArchil", tags: ["local"], summary: "Turn Mode 2 off: run folders on this server's own disk",
|
|
1233
|
+
description: "Removes the Archil settings. Its saved keys are kept, for turning it on again.",
|
|
1234
|
+
responses: { "200": json(ARCHIL_VIEW, "The Archil settings, off."), ...errors(401, 429, 500) },
|
|
1235
|
+
...ARCHIL_MARK,
|
|
1236
|
+
},
|
|
1237
|
+
},
|
|
1238
|
+
"/workspace/archil/test": {
|
|
1239
|
+
post: {
|
|
1240
|
+
operationId: "testWorkspaceArchil", tags: ["local"], summary: "Test the Archil disk with its saved account key",
|
|
1241
|
+
description: "One listing of the disk's root through its file API, with the saved account key. ok, or why in plain words: Archil is off, the key is not saved, Archil refused it, no such disk, or Archil was not reached. Never a key.",
|
|
1242
|
+
responses: { "200": json(ACCOUNT_TEST, "The test's answer."), ...errors(401, 429, 500) },
|
|
1243
|
+
...ARCHIL_MARK,
|
|
891
1244
|
},
|
|
892
1245
|
},
|
|
893
1246
|
"/settings/tool-keys": {
|
|
@@ -900,20 +1253,47 @@ const EXTENSIONS = {
|
|
|
900
1253
|
"/settings/tool-keys/{key_id}": {
|
|
901
1254
|
put: {
|
|
902
1255
|
operationId: "saveToolKey", tags: ["local"], summary: "Save a tool key's fields, sealed",
|
|
903
|
-
description: "Each value is sealed under the server's seal key and kept in the data directory as ciphertext alone; the key's other fields stay as they are. The key (the first field) is first checked against its provider with one call that costs nothing, given 5 s: a key the provider refuses (401) is 422 input_invalid, its field's reason `refused_by_provider` and the message in plain words with the provider's first sentence (never any of the key), and nothing is kept; otherwise it is kept, and GET's `check` says `accepted` or `not_checked` and why (a 403 is not_checked: a key scoped away from the check's call may still work for its tools). A save whose check is still waiting when the server begins to close keeps nothing (503 unavailable, while its connection lasts). 422 also for an unknown key or field, or a value that is empty, holds a control character or is over 1024 bytes; 409 key_set_by_server for a field the server is started with; 409 no_sealing_key when the server was handed no seal key.",
|
|
1256
|
+
description: "Each value is sealed under the server's seal key and kept in the data directory as ciphertext alone; the key's other fields stay as they are. The key (the first field) is first checked against its provider with one call that costs nothing, given 5 s: a key the provider refuses (401) is 422 input_invalid, its field's reason `refused_by_provider` and the message in plain words with the provider's first sentence (never any of the key), and nothing is kept; otherwise it is kept, and GET's `check` says `accepted` or `not_checked` and why (a 403 is not_checked: a key scoped away from the check's call may still work for its tools). A save whose check is still waiting when the server begins to close keeps nothing (503 unavailable, while its connection lasts). 422 also for an unknown key or field, or a value that is empty, holds a control character or is over 1024 bytes; 409 key_set_by_server for a field the server is started with; 409 no_sealing_key when the server was handed no seal key. A secret write: the owner's signed-in session alone (ownerSession), never the token, which is 403 forbidden in words.",
|
|
904
1257
|
parameters: [KEY_ID],
|
|
905
|
-
|
|
906
|
-
|
|
1258
|
+
// The owner's password session alone (secret-writes.ts), never the document's bearer.
|
|
1259
|
+
security: [{ ownerSession: [] }],
|
|
1260
|
+
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, required: ["values"], properties: { values: { type: "object", minProperties: 1, additionalProperties: { type: "string", minLength: 1, "x-agentrun-secret": true }, "x-agentrun-secret": true } } } } } },
|
|
1261
|
+
responses: { "204": { description: "Saved." }, ...errors(400, 401, 403, 409, 415, 422, 429, 500, 503) },
|
|
907
1262
|
"x-agentrun-serve": "toolkeys/1",
|
|
908
1263
|
},
|
|
909
1264
|
delete: {
|
|
910
1265
|
operationId: "deleteToolKey", tags: ["local"], summary: "Forget a tool key's stored fields",
|
|
911
|
-
|
|
1266
|
+
// A removal has no body to mark a field in: the operation is marked whole, a secret write all the same.
|
|
1267
|
+
"x-agentrun-secret": true,
|
|
1268
|
+
description: "409 key_set_by_server when the server is started with every field of it. A secret write: the owner's signed-in session alone (ownerSession), never the token, which is 403 forbidden in words.",
|
|
912
1269
|
parameters: [KEY_ID],
|
|
913
|
-
|
|
1270
|
+
security: [{ ownerSession: [] }],
|
|
1271
|
+
responses: { "204": { description: "Forgotten." }, ...errors(401, 403, 409, 422, 429, 500) },
|
|
914
1272
|
"x-agentrun-serve": "toolkeys/1",
|
|
915
1273
|
},
|
|
916
1274
|
},
|
|
1275
|
+
"/auth/session": {
|
|
1276
|
+
get: {
|
|
1277
|
+
operationId: "getAuthSession", tags: ["local"], summary: "Whether this browser has accounts, is signed in, and may save a secret",
|
|
1278
|
+
description: "Answered with no credential: what the console needs before it shows a setup or sign-in screen, or a field to paste a secret into. `accounts`: whether this server has accounts (a password owner); with them off it answers `accounts`, `secrets_writable` and `secrets_reason` alone, no user field. A secret (a model or tool key, an MCP header or token, a computer vendor's key) is saved only from the owner's session: with accounts on, the owner's password session; with accounts off on a server bound to loopback alone, the console the launch link opened. The API token never saves one, on any server.",
|
|
1279
|
+
security: [],
|
|
1280
|
+
responses: {
|
|
1281
|
+
"200": json({
|
|
1282
|
+
type: "object", additionalProperties: false, required: ["accounts", "secrets_writable"],
|
|
1283
|
+
properties: {
|
|
1284
|
+
accounts: { type: "boolean", description: "Whether this server has accounts (a password owner). false: the console shows no setup or sign-in screen." },
|
|
1285
|
+
password_set: { type: "boolean", description: "With accounts: whether the owner's password is set." },
|
|
1286
|
+
signed_in: { type: "boolean", description: "With accounts: whether this browser holds the owner's password session." },
|
|
1287
|
+
setup_code: { type: "boolean", description: "With accounts, before the password is set: whether setup takes the code the server printed (a server at a public address, or listening on any address but loopback). Never the code." },
|
|
1288
|
+
secrets_writable: { type: "boolean", description: "Whether this caller may save, replace or remove a secret here (the same rule the server applies to the write itself)." },
|
|
1289
|
+
secrets_reason: { enum: ["sign_in", "no_accounts", "token"], description: "Present only when secrets_writable is false: sign_in, this is not the owner's session (accounts on: sign in with the password; accounts off on a loopback-bound server: open the console from the launch link); no_accounts, accounts are off and this server is reachable off loopback, where no one saves a secret until accounts are on; token, the caller is the API token, which never saves one, on any server." },
|
|
1290
|
+
},
|
|
1291
|
+
}, "This browser's account state, and whether it may save a secret."),
|
|
1292
|
+
...errors(429, 500),
|
|
1293
|
+
},
|
|
1294
|
+
"x-agentrun-serve": "secrets/1",
|
|
1295
|
+
},
|
|
1296
|
+
},
|
|
917
1297
|
"/settings/mcp-servers": {
|
|
918
1298
|
get: {
|
|
919
1299
|
operationId: "listMcpServers", tags: ["local"], summary: "The remote MCP servers saved here, with their tools; never a credential",
|
|
@@ -940,16 +1320,17 @@ const EXTENSIONS = {
|
|
|
940
1320
|
},
|
|
941
1321
|
put: {
|
|
942
1322
|
operationId: "saveMcpServer", tags: ["local"], summary: "Preview a remote MCP server, then save it with the tools listed and its credential sealed",
|
|
943
|
-
description: `Each credential header's value is sealed under the server's seal key and bound to the server's name and the header, and kept in the data directory as ciphertext alone. 409 no_sealing_key when the server was handed no seal key and \`auth.type\` is not none (nothing is contacted). A body with no credential keeps the sealed one while the type and the URL's origin stay the same; else it is 422. 422 too for a bad name, URL or auth, or a price that is not a finite number 0 or more or names a tool the server does not list. ${MCP_CONNECTS} Nothing is saved unless the listing succeeds.`,
|
|
1323
|
+
description: `Each credential header's value is sealed under the server's seal key and bound to the server's name and the header, and kept in the data directory as ciphertext alone. 409 no_sealing_key when the server was handed no seal key and \`auth.type\` is not none (nothing is contacted). 403 forbidden to the API token for a save that sends a credential's value, or that would drop or change the credential the server holds (another \`auth.type\`, or none): the owner's signed-in session alone. 412 precondition_failed when a save that sends a new credential, or none, finds the server's credential changed while it listed its tools (another save, a sign-in or a removal landed): nothing is written over it. A body with no credential keeps the sealed one while the type and the URL's origin stay the same; else it is 422. A body with no \`prices\` keeps the saved ones for the tools still listed at the same URL, so a save from any client never leaves a paid tool unmetered; \`prices: {}\` clears them. 422 too for a bad name, URL or auth, or a price that is not a finite number 0 or more or names a tool the server does not list. ${MCP_CONNECTS} Nothing is saved unless the listing succeeds.`,
|
|
944
1324
|
parameters: [MCP_NAME],
|
|
945
1325
|
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, required: ["url"], properties: { url: MCP_URL, auth: MCP_AUTH, prices: MCP_PRICES } } } } },
|
|
946
|
-
responses: { "200": json(MCP_SERVER_VIEW, "The server, as saved."), ...errors(400, 401, 409, 415, 422, 429, 500), ...MCP_FAILED },
|
|
1326
|
+
responses: { "200": json(MCP_SERVER_VIEW, "The server, as saved."), ...errors(400, 401, 403, 409, 412, 415, 422, 429, 500), ...MCP_FAILED },
|
|
947
1327
|
"x-agentrun-serve": "mcpservers/1",
|
|
948
1328
|
},
|
|
949
1329
|
delete: {
|
|
950
1330
|
operationId: "deleteMcpServer", tags: ["local"], summary: "Forget a saved MCP server and its credential",
|
|
1331
|
+
description: "403 forbidden to the API token when the server holds a credential: removing it drops a secret, the owner's signed-in session's alone. A server saved with none is the token's to remove. 412 precondition_failed when the server's credential changed between that check and the removal (a save or a sign-in landed): nothing is removed.",
|
|
951
1332
|
parameters: [MCP_NAME],
|
|
952
|
-
responses: { "204": { description: "Forgotten." }, ...errors(401, 404, 409, 429, 500) },
|
|
1333
|
+
responses: { "204": { description: "Forgotten." }, ...errors(401, 403, 404, 409, 412, 429, 500) },
|
|
953
1334
|
"x-agentrun-serve": "mcpservers/1",
|
|
954
1335
|
},
|
|
955
1336
|
},
|
|
@@ -962,16 +1343,100 @@ const EXTENSIONS = {
|
|
|
962
1343
|
"x-agentrun-serve": "mcpservers/1",
|
|
963
1344
|
},
|
|
964
1345
|
},
|
|
1346
|
+
"/settings/mcp-servers/{name}/oauth/start": {
|
|
1347
|
+
post: {
|
|
1348
|
+
operationId: "startMcpOAuth", tags: ["local"], summary: "Start signing in to an MCP server with OAuth: the page the owner opens",
|
|
1349
|
+
description: `Discovers the server's authorization server (RFC 9728, then RFC 8414) with the official MCP SDK, and its client: the \`client_id\` (and \`client_secret\`) given; else, signing in again to the same origin, the client kept from the last sign-in (its secret too); else this server's client metadata document, when this server's address is public https and the authorization server takes one; else dynamic registration. PKCE S256, and the RFC 8707 \`resource\` is the server's URL. Answers \`authorization_url\` for the owner to open; the authorization server sends the browser back to GET /settings/mcp-servers/oauth/callback within 10 minutes. 409 no_sealing_key with no seal key; 409 wrong_origin when the request came to another address than the one the callback is under (\`details.open\` says where to open the console); 424 when discovery or registration fails, or an MCP server off loopback names a private or plain-http endpoint. The answer sets a cookie (one per sign-in, \`SameSite=Lax\`, the callback's path, 10 minutes) that the callback requires.`,
|
|
1350
|
+
parameters: [MCP_NAME],
|
|
1351
|
+
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, required: ["url"], properties: { url: MCP_URL, scopes: { type: "array", minItems: 1, maxItems: 32, items: { type: "string" } }, client_id: { type: "string", minLength: 1 }, client_secret: { type: "string", minLength: 1, description: "Only with client_id; kept sealed with the token set.", "x-agentrun-secret": true } } } } } },
|
|
1352
|
+
responses: { "200": json(closed({ authorization_url: { type: "string", format: "uri" } }), "The page the owner opens."), ...errors(400, 401, 409, 415, 422, 429, 500), ...MCP_FAILED },
|
|
1353
|
+
"x-agentrun-serve": "mcpservers/1",
|
|
1354
|
+
},
|
|
1355
|
+
},
|
|
1356
|
+
"/settings/mcp-servers/oauth/callback": {
|
|
1357
|
+
get: {
|
|
1358
|
+
operationId: "mcpOAuthCallback", tags: ["local"], summary: "Where the authorization server sends the owner's browser back", security: [{}],
|
|
1359
|
+
description: `Takes no token: its \`state\` (random, used once, 10 minutes, bound to the server's name) and the cookie the start set in the browser that started it (\`SameSite=Lax\`, the callback's path) are the check; without the cookie it is 403 and nothing is exchanged. Exchanges \`code\` with the PKCE verifier kept here, seals the token set (access and refresh tokens, expiry, scopes, the client) bound to the server's name, lists the server's tools as a PUT does and keeps them, then redirects to \`${MCP_SETTINGS_PAGE}?server=<name>&sign_in=ok\` (or \`sign_in=failed&error=<code>\`). 400 for a state that is unknown, used or expired.`,
|
|
1360
|
+
parameters: ["code", "state", "iss", "error"].map((name) => ({ name, in: "query", required: false, schema: { type: "string" } })),
|
|
1361
|
+
responses: { "302": { description: "To the console's MCP servers page." }, ...errors(400, 403, 429, 500) },
|
|
1362
|
+
"x-agentrun-serve": "mcpservers/1",
|
|
1363
|
+
},
|
|
1364
|
+
},
|
|
1365
|
+
"/integrations/github": {
|
|
1366
|
+
get: {
|
|
1367
|
+
operationId: "getGitHubConnection", tags: ["local"], summary: "Whether a GitHub App is connected, and if so its id, slug and installations, never a secret",
|
|
1368
|
+
description: "Its installations are first repaired from GitHub's own (GET /app/installations with the App's JWT), at most once a minute: an installation event missed or not checked (GitHub out of reach answers that event 503) is put right here, and a list that comes to hold none turns every github trigger off (`connection_lost`). GitHub out of reach leaves the list as it is.",
|
|
1369
|
+
responses: { "200": json(GITHUB_STATUS, "`{connected: false}`, or the connection with `connected: true`."), ...errors(401, 429, 500) },
|
|
1370
|
+
...GITHUB_MARK,
|
|
1371
|
+
},
|
|
1372
|
+
delete: {
|
|
1373
|
+
operationId: "disconnectGitHub", tags: ["local"], summary: "Disconnect GitHub: the App's credentials gone from this server, and every github trigger off",
|
|
1374
|
+
description: "Removes the App's sealed credentials and installations, and turns every github trigger off (`disabled: {reason: \"connection_lost\"}`), keeping them: connected again, each goes on when turned on. The App itself stays on GitHub: `note` says \"Delete the App itself on GitHub: <its settings URL>\". 404 when none is connected.",
|
|
1375
|
+
responses: { "200": json(closed({ disconnected: { const: true }, triggers_off: { type: "integer", minimum: 0, description: "How many github triggers it turned off." }, note: { type: "string", description: "Where to delete the App itself on GitHub." } }), "Disconnected."), ...errors(401, 404, 429, 500) },
|
|
1376
|
+
...GITHUB_MARK,
|
|
1377
|
+
},
|
|
1378
|
+
},
|
|
1379
|
+
"/integrations/github/connect": {
|
|
1380
|
+
post: {
|
|
1381
|
+
operationId: "connectGitHub", tags: ["local"], summary: "Start Connect GitHub: the app-manifest form the console posts to GitHub",
|
|
1382
|
+
description: "GitHub's app-manifest flow, which makes the server's one GitHub App. Answers the form the console auto-submits: `action` (GitHub's new-App page, under `org` when given, with `state` on it) and `manifest` (a field of that form, as JSON): a name GitHub lets the person edit, the server's public URL, its hook `/v2/hooks/github`, its callback and its setup URL, the App's permissions (pull requests write, contents, metadata and issues read) and events (pull_request, issue_comment). `state` is random, used once, good for an hour, and bound to the browser that started it by a cookie on the callback's path; GitHub reads it from `action`'s URL, and the form posts only `manifest`. 409 github_no_public_url (\"GitHub can't reach this server: set its public URL first\") with no public URL (AGENTRUN_PUBLIC_URL); 409 github_already_connected (\"This server already has a GitHub App. Disconnect it first.\"); 409 github_wrong_origin (\"Open this server at <public URL> to connect GitHub.\", `details.public_url` that URL, for the console's link) when the request came to another address than the public URL, where GitHub sends the browser back: nothing is started.",
|
|
1383
|
+
requestBody: { required: false, content: { "application/json": { schema: { type: "object", additionalProperties: false, properties: { org: { type: "string", pattern: "^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$", description: "The GitHub organization to make the App under; absent, the signed-in GitHub user." } } } } } },
|
|
1384
|
+
responses: { "200": json(closed({ action: { type: "string", format: "uri" }, manifest: { type: "object", description: "GitHub's app manifest, posted as the form's `manifest` field." }, state: { type: "string" } }), "The form to post to GitHub."), ...errors(400, 401, 409, 415, 422, 429, 500) },
|
|
1385
|
+
...GITHUB_MARK,
|
|
1386
|
+
},
|
|
1387
|
+
},
|
|
1388
|
+
"/integrations/github/callback": {
|
|
1389
|
+
get: {
|
|
1390
|
+
operationId: "gitHubCallback", tags: ["local"], summary: "Where GitHub sends the owner's browser back with the new App's code", security: [{}],
|
|
1391
|
+
description: "Takes no token, and answers the browser only with where to go. Its `state` and the cookie its start set in that browser are the check. Converts `code` with GitHub (POST /app-manifests/{code}/conversions), keeps the App's id, slug, client id, private key and webhook secret sealed (its client secret is never kept), and redirects to GitHub's page that installs the App. A state that is unknown, used, over an hour old or from another browser redirects to the console's `/#/settings/github?github=error&reason=state_invalid`, a code GitHub does not convert to `...&reason=conversion_failed`, and one whose App GitHub made while another Connect kept its App to `...&reason=already_connected`; nothing is kept. Nothing of the App's secrets is logged or answered.",
|
|
1392
|
+
parameters: ["code", "state"].map((name) => ({ name, in: "query", required: false, schema: { type: "string" } })),
|
|
1393
|
+
responses: { "302": { description: "To GitHub, to install the App; or to the console's GitHub settings with `github=error&reason=state_invalid`, `conversion_failed` or `already_connected`." }, ...errors(429, 500) },
|
|
1394
|
+
...GITHUB_MARK,
|
|
1395
|
+
},
|
|
1396
|
+
},
|
|
1397
|
+
"/integrations/github/installed": {
|
|
1398
|
+
get: {
|
|
1399
|
+
operationId: "gitHubInstalled", tags: ["local"], summary: "Where GitHub sends the browser once the App is installed", security: [{}],
|
|
1400
|
+
description: "Takes no token, and answers the browser only with where to go. It records an installation only with the install state the callback sent GitHub's install page (`state`, which GitHub passes on) and the cookie it set in that browser, and only as GitHub, asked with the App's own JWT (GET /app/installations/{installation_id}), says it is the App's; then the browser goes to the console's `/#/settings/github?github=connected`. Without the state and cookie it records nothing and lands there too (an install from GitHub's own pages arrives as the App's signed installation event); otherwise (no such installation of the App, no App connected, GitHub not reached) to `/#/settings/github?github=error&reason=installation_unverified`, and nothing is kept.",
|
|
1401
|
+
parameters: ["installation_id", "setup_action", "state"].map((name) => ({ name, in: "query", required: false, schema: { type: "string" } })),
|
|
1402
|
+
responses: { "302": { description: "To the console's GitHub settings: `github=connected`, or `github=error&reason=installation_unverified`." }, ...errors(429, 500) },
|
|
1403
|
+
...GITHUB_MARK,
|
|
1404
|
+
},
|
|
1405
|
+
},
|
|
1406
|
+
"/settings/mcp-servers/oauth/client.json": {
|
|
1407
|
+
get: {
|
|
1408
|
+
operationId: "mcpOAuthClient", tags: ["local"], summary: "This server's OAuth client metadata document", security: [{}],
|
|
1409
|
+
description: "Its own URL is its client id (CIMD): `redirect_uris` is the callback, `token_endpoint_auth_method` none. Readable without a credential, for an authorization server to fetch.",
|
|
1410
|
+
responses: { "200": json({ type: "object" }, "The document."), ...errors(429, 500) },
|
|
1411
|
+
"x-agentrun-serve": "mcpservers/1",
|
|
1412
|
+
},
|
|
1413
|
+
},
|
|
1414
|
+
"/settings/mcp-servers/oauth/private-hosts": {
|
|
1415
|
+
get: {
|
|
1416
|
+
operationId: "getMcpPrivateHosts", tags: ["local"], summary: "The private-network hosts an MCP server's authorization server may be on",
|
|
1417
|
+
description: `An MCP server's authorization server (its discovery, registration, token and refresh endpoints) is refused on a private network unless its host is on this list, which is empty by default. ${PRIVATE_HOSTS_RULE}`,
|
|
1418
|
+
responses: { "200": json(PRIVATE_HOSTS, "The list."), ...errors(401, 429, 500) },
|
|
1419
|
+
"x-agentrun-serve": "mcpservers/1",
|
|
1420
|
+
},
|
|
1421
|
+
put: {
|
|
1422
|
+
operationId: "putMcpPrivateHosts", tags: ["local"], summary: "Replace the private-network hosts an MCP server's authorization server may be on",
|
|
1423
|
+
description: `Replaces the list; an empty list allows none. Each entry is a host name or an IP address, matched exactly (lowercase, every final dot dropped, an IPv6 address as a URL writes it, in brackets): no wildcards, address ranges, ports or schemes, at most ${MAX_PRIVATE_HOSTS}. 422 with each entry that is not one, or that names an address no listing could allow. ${PRIVATE_HOSTS_RULE} Only the owner, signed in with their password, changes it: the route takes the console's password session alone, from this server's own origin with a JSON body (as every page write), and answers 403 \`forbidden\` to every token, the server's own included, since a run's process, an agent's MCP client or a script may hold one, and to every request on a server with accounts off; with no credential at all it is 401, as every route.`,
|
|
1424
|
+
security: [{ ownerSession: [] }],
|
|
1425
|
+
requestBody: { required: true, content: { "application/json": { schema: PRIVATE_HOSTS } } },
|
|
1426
|
+
responses: { "200": json(PRIVATE_HOSTS, "The list, as kept."), ...errors(400, 401, 403, 415, 422, 429, 500, 503) },
|
|
1427
|
+
"x-agentrun-serve": "mcpservers/1",
|
|
1428
|
+
},
|
|
1429
|
+
},
|
|
965
1430
|
"/settings/tools": {
|
|
966
1431
|
get: {
|
|
967
1432
|
operationId: "getToolSettings", tags: ["capabilities"], summary: "The server's tool settings",
|
|
968
|
-
description: "Each capability that has a choice, and its provider, and each tool's permission that is set (an MCP server's wildcard mcp:<server>/* among them): web_search auto (codex's own search or, on pi, the model provider's hosted one, else Parallel where the server holds its key, which bills it, else Exa's keyless search; claude-agent's own search only as native), native (that alone), exa-keyless (that alone) or parallel; web_fetch kernel or parallel; browser auto (Browserbase where the server holds its keys, else Kernel where it holds Kernel's), browserbase, kernel (each that alone) or chrome (a Chrome on the server's host, not set up on any server yet: unavailable). An agent's definition.tool_settings is over these. capabilities.tools say what each resolves to on each harness, and GET /agents/{agent_id} for that agent.",
|
|
1433
|
+
description: "Each capability that has a choice, and its provider, and each tool's permission that is set (an MCP server's wildcard mcp:<server>/* among them): web_search auto (codex's own search or, on pi, the model provider's hosted one, else Parallel where the server holds its key, which bills it, else Exa's keyless search; claude-agent's own search only as native), native (that alone), exa-keyless (that alone) or parallel; web_fetch kernel or parallel; browser auto (Browserbase where the server holds its keys, else Kernel where it holds Kernel's), browserbase, kernel (each that alone) or chrome (a Chrome on the server's host, not set up on any server yet: unavailable). An agent's definition.tool_settings is over these, except a permission set to deny here: a server deny is absolute and refuses the tool on this server whatever the agent sets. capabilities.tools say what each resolves to on each harness, and GET /agents/{agent_id} for that agent. An MCP tool's own key may carry its pin, the arguments its calls must carry.",
|
|
969
1434
|
responses: { "200": json(TOOL_SETTINGS_ANSWER, "Each capability's provider."), ...errors(401, 429, 500) },
|
|
970
1435
|
"x-agentrun-serve": "providers/1",
|
|
971
1436
|
},
|
|
972
1437
|
put: {
|
|
973
1438
|
operationId: "putToolSettings", tags: ["capabilities"], summary: "Set the providers of web_search, web_fetch and browser, and each tool's permission",
|
|
974
|
-
description: "Replaces the settings: a tool the body leaves out takes its defaults. Kept in the data directory, and capabilities say so at once. A provider is read by every run launched from then on; a permission by the tool gate at each call, live runs' included (a claude-agent or codex run's own web search takes a change of web_search's at its next launch). An MCP server's wildcard, mcp:<server>/*, sets each of its tools, under a tool's own key. A pick of parallel without PARALLEL_API_KEY resolves unavailable, never to another provider, and so does a browser vendor picked without its key. An unknown tool, a provider not offered for it
|
|
1439
|
+
description: "Replaces the settings: a tool the body leaves out takes its defaults. Kept in the data directory, and capabilities say so at once. A provider is read by every run launched from then on; a permission by the tool gate at each call, live runs' included (a claude-agent or codex run's own web search takes a change of web_search's at its next launch). An MCP server's wildcard, mcp:<server>/*, sets each of its tools, under a tool's own key. A pick of parallel without PARALLEL_API_KEY resolves unavailable, never to another provider, and so does a browser vendor picked without its key. An MCP tool's own key (never a wildcard) may carry `pin`, 1 to 8 of its top-level arguments to the JSON scalar each call must carry: the gate refuses any other call before it runs or asks anyone, whatever the permission, and a pin here and an agent's both hold. An unknown tool, a provider not offered for it, a permission not offered for it and a pin that is not one are refused.",
|
|
975
1440
|
requestBody: { required: true, content: { "application/json": { schema: TOOL_SETTINGS } } },
|
|
976
1441
|
responses: { "200": json(TOOL_SETTINGS_ANSWER, "Each capability's provider now."), ...errors(400, 401, 415, 422, 429, 500) },
|
|
977
1442
|
"x-agentrun-serve": "providers/1",
|
|
@@ -989,7 +1454,7 @@ const EXTENSIONS = {
|
|
|
989
1454
|
[`${HOME_FILES_AT}/{path}`]: {
|
|
990
1455
|
get: {
|
|
991
1456
|
operationId: "readHomeFile", tags: ["agents"], summary: "One file of the agent's home, raw",
|
|
992
|
-
description: `Raw bytes with the file's content type, as a run's file is read (\`GET /runs/{run_id}/files/{path}\`): \`nosniff\`, a CSP on HTML, \`?download=1\` for an attachment. ${HOME_PATHS} A path at or under one of \`capabilities.home.host_owned\` (\`learning/\`, \`sign-ins/\`), as normalized
|
|
1457
|
+
description: `Raw bytes with the file's content type, as a run's file is read (\`GET /runs/{run_id}/files/{path}\`): \`nosniff\`, a CSP on HTML, \`?download=1\` for an attachment. ${HOME_PATHS} A path at or under one of \`capabilities.home.host_owned\` (\`learning/\`, \`sign-ins/\`), as normalized and folded, is \`403 system_file_forbidden\` with \`details.reason\` \`host_owned\`. Its message names the learning API (\`/v2/agents/{agent_id}/learning\`) on a server that has that route, and says this server has none on one that does not. A link on the way is \`404 not_found\`.`,
|
|
993
1458
|
parameters: [ref("parameters/AgentId"), HOME_PATH, { name: "download", in: "query", required: false, description: "`1` forces a download.", schema: { type: "integer", enum: [0, 1], default: 0 } }],
|
|
994
1459
|
responses: {
|
|
995
1460
|
"200": { description: "The whole file.", headers: { "Content-Disposition": ref("headers/ContentDisposition"), "X-Content-Type-Options": ref("headers/NoSniff") }, content: RAW },
|
|
@@ -999,7 +1464,7 @@ const EXTENSIONS = {
|
|
|
999
1464
|
},
|
|
1000
1465
|
put: {
|
|
1001
1466
|
operationId: "writeHomeFile", tags: ["agents"], summary: "Write one file of the agent's home",
|
|
1002
|
-
description: `The raw body becomes the file, whole: written to a temporary file beside it and renamed over it (
|
|
1467
|
+
description: `The raw body becomes the file, whole: written to a temporary file beside it and renamed over it (the workspace's mode, inside the owner-only 0700 home folder), the directories on the way made. Of two writes of one file at once, each lands whole and the last wins. A body over \`capabilities.home.max_file_bytes\` is \`413 payload_too_large\`. ${HOME_PATHS} ${HOME_WRITES}`,
|
|
1003
1468
|
parameters: [ref("parameters/AgentId"), HOME_PATH],
|
|
1004
1469
|
requestBody: { required: true, content: RAW },
|
|
1005
1470
|
responses: { "200": json(HOME_FILE, "The file, as the list shows it."), ...errors(400, 401, 403, 404, 413, 429, 500, 501) },
|
|
@@ -1023,13 +1488,13 @@ const EXTENSIONS = {
|
|
|
1023
1488
|
"x-agentrun-serve": "approvals/1",
|
|
1024
1489
|
},
|
|
1025
1490
|
},
|
|
1026
|
-
...archiving("agents", "Agent", ref("parameters/AgentId"), "The agent, with archived_at."),
|
|
1491
|
+
...archiving("agents", "Agent", ref("parameters/AgentId"), "The agent, with archived_at, and `triggers_off: [{id, name}]`: archived, the triggers that run as it, turned off with the archive (`disabled.reason` `agent_archived`); unarchived, those its archive turned off that are off still (unarchiving turns none on: PATCH /triggers/{id} with enabled true does)."),
|
|
1027
1492
|
...archiving("runs", "Run", ref("parameters/RunId"), "The run, with archived_at."),
|
|
1028
1493
|
...LEARNING_EXTENSIONS,
|
|
1029
1494
|
"/agents/{agent_id}/sign-ins/{key}": {
|
|
1030
1495
|
delete: {
|
|
1031
1496
|
operationId: "forgetSignIn", tags: ["agents"], summary: "Forget one of the agent's saved sign-ins",
|
|
1032
|
-
description: "Deletes the browser vendor's object the sign-in points to (a Browserbase context, a Kernel profile), then the sealed pointer this server kept; GET /agents/{agent_id} lists it no more, and the agent's next run with the browser starts signed out, on a new one. Best effort at the vendor: a delete it does not answer, or refuses, is said in `removed[].message` (`at_vendor: not_deleted`), and the pointer is forgotten all the same. 404 for a key the agent has no sign-in under; 409 `sign_in_held` while a run holds its save lease (`details.held_by`), until that run ends.",
|
|
1497
|
+
description: "Deletes the browser vendor's object the sign-in points to (a Browserbase context, a Kernel profile), then the sealed pointer this server kept; GET /agents/{agent_id} lists it no more, and the agent's next run with the browser starts signed out, on a new one. Best effort at the vendor: a delete it does not answer, or refuses, is said in `removed[].message` (`at_vendor: not_deleted`), and the pointer is forgotten all the same. 404 for a key the agent has no sign-in under; 409 `sign_in_held` while a run holds its save lease (`details.held_by`), and while a run it was handed is still going, its lease let go or not (`details.handed_to`: one waiting for its person, say), until that run ends: what that run says could repeat the pointer, and once it is forgotten a restarted server could not cut it from what the run shows. The message names the run, never the pointer.",
|
|
1033
1498
|
parameters: [ref("parameters/AgentId"), { name: "key", in: "path", required: true, description: "The sign-in's key, as GET /agents/{agent_id} lists it (`default`).", schema: { type: "string" } }],
|
|
1034
1499
|
responses: {
|
|
1035
1500
|
"200": json({ type: "object", additionalProperties: false, required: ["key", "removed"], properties: { key: { type: "string" }, removed: { type: "array", items: { type: "object", additionalProperties: false, required: ["provider", "at_vendor"], properties: { provider: { type: "string" }, at_vendor: { enum: ["deleted", "not_deleted"] }, message: { type: "string" } } } } } }, "Forgotten: what was deleted at each vendor."),
|
|
@@ -1046,10 +1511,10 @@ const EXTENSIONS = {
|
|
|
1046
1511
|
},
|
|
1047
1512
|
put: {
|
|
1048
1513
|
operationId: "saveWebhook", tags: ["local"], summary: "Set the webhook's URL",
|
|
1049
|
-
description: `Messages follow the Standard Webhooks spec (standardwebhooks.com), so a receiver verifies them with any of its libraries. Each is POSTed to \`url\` as JSON \`{type, timestamp, data}\`: \`run.needs_input\` when a run comes to need its person (status input_required; \`data.pending.kind\` \`question\` for an ask_person question, \`approval\` for a tool call that waits for a person's approval, \`stopped\` for a stopped turn, \`budget\` for a run paused at its spend cap) and \`run.ended\` when it ends (completed, failed or cancelled), with \`data: {run_id, agent_id, status, title, url}\`, \`url\` the run on the page; and \`trigger.failed\` when a trigger's firing could not start its run (/triggers), with \`data: {trigger_id, name, firing_key, nominal_at, error: {code, message}, auto_paused}\`, \`auto_paused\` true when it was the ${FAILURES_TO_PAUSE}th in a row and turned the trigger off, its \`webhook-id\` the same for the same firing, after a restart too; never a tool's arguments, an output or an input, which the API reads. Headers: \`webhook-id\` (the same on every try, the receiver's idempotency key), \`webhook-timestamp\` (Unix seconds) and \`webhook-signature: v1,<base64 HMAC-SHA256 of "{id}.{timestamp}.{body}">\` under the secret's 32 bytes; a receiver refuses a timestamp more than 5 minutes from its clock. A try not answered 2xx in 15 s (no redirect followed) is tried again after about 5 s, 5 min, 30 min, 2 h, 5 h and 10 h, with jitter, then logged as failed; pending messages go on after a restart. A 410 turns the webhook off until it is set again. The first PUT makes the secret and answers 201 with it, once; a later PUT keeps it, turns the webhook on again and answers 200. 422 for a URL that is not http or https, holds a user or password, or is over 2048 characters; 409 no_sealing_key when the server was handed no seal key to keep the secret under.`,
|
|
1514
|
+
description: `Messages follow the Standard Webhooks spec (standardwebhooks.com), so a receiver verifies them with any of its libraries. Each is POSTed to \`url\` as JSON \`{type, timestamp, data}\`: \`run.needs_input\` when a run comes to need its person (status input_required; \`data.pending.kind\` \`question\` for an ask_person question, \`approval\` for a tool call that waits for a person's approval, \`stopped\` for a stopped turn, \`budget\` for a run paused at its spend cap, \`browser\` for an agent's ask for the person in its browser) and \`run.ended\` when it ends (completed, failed or cancelled), with \`data: {run_id, agent_id, status, title, url}\`, \`url\` the run on the page; and \`trigger.failed\` when a trigger's firing could not start its run (/triggers), with \`data: {trigger_id, name, firing_key, nominal_at, error: {code, message}, auto_paused}\`, \`auto_paused\` true when it was the ${FAILURES_TO_PAUSE}th in a row and turned the trigger off, its \`webhook-id\` the same for the same firing, after a restart too; never a tool's arguments, an output or an input, which the API reads. Headers: \`webhook-id\` (the same on every try, the receiver's idempotency key), \`webhook-timestamp\` (Unix seconds) and \`webhook-signature: v1,<base64 HMAC-SHA256 of "{id}.{timestamp}.{body}">\` under the secret's 32 bytes; a receiver refuses a timestamp more than 5 minutes from its clock. A try not answered 2xx in 15 s (no redirect followed) is tried again after about 5 s, 5 min, 30 min, 2 h, 5 h and 10 h, with jitter, then logged as failed; pending messages go on after a restart. A 410 turns the webhook off until it is set again. The first PUT makes the secret and answers 201 with it, once; a later PUT keeps it, turns the webhook on again and answers 200. 422 for a URL that is not http or https, holds a user or password, or is over 2048 characters; 409 no_sealing_key when the server was handed no seal key to keep the secret under.`,
|
|
1050
1515
|
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, required: ["url"], properties: { url: { type: "string", format: "uri", maxLength: 2048 } } } } } },
|
|
1051
1516
|
responses: {
|
|
1052
|
-
"201": json(closed({ ...WEBHOOK_SET_FIELDS,
|
|
1517
|
+
"201": json({ oneOf: [closed({ ...WEBHOOK_SET_FIELDS, signing_secret: WEBHOOK_SECRET }), closed({ ...WEBHOOK_SET_FIELDS, note: { type: "string", description: "To the API token, which is never shown the secret: the words that send the person to the console for it." } })] }, "Set, with its secret as `signing_secret`, shown this once to the owner's signed-in session; to the API token, its metadata and the words in its place."),
|
|
1053
1518
|
"200": json(WEBHOOK_SET, "Changed; the secret is kept."),
|
|
1054
1519
|
...errors(400, 401, 409, 415, 422, 429, 500),
|
|
1055
1520
|
},
|
|
@@ -1057,7 +1522,10 @@ const EXTENSIONS = {
|
|
|
1057
1522
|
},
|
|
1058
1523
|
delete: {
|
|
1059
1524
|
operationId: "deleteWebhook", tags: ["local"], summary: "Remove the webhook; its pending messages are dropped, the log of attempts is kept",
|
|
1060
|
-
|
|
1525
|
+
description: "A secret write: its signing secret goes with it. The owner's signed-in session alone (ownerSession), never the token, which is 403 forbidden in words and the webhook kept.",
|
|
1526
|
+
// The owner's password session alone (secret-writes.ts), never the document's bearer.
|
|
1527
|
+
security: [{ ownerSession: [] }],
|
|
1528
|
+
responses: { "204": { description: "Removed." }, ...errors(401, 403, 429, 500) },
|
|
1061
1529
|
"x-agentrun-serve": "webhook/1",
|
|
1062
1530
|
},
|
|
1063
1531
|
},
|
|
@@ -1078,17 +1546,17 @@ const EXTENSIONS = {
|
|
|
1078
1546
|
},
|
|
1079
1547
|
"/triggers": {
|
|
1080
1548
|
get: {
|
|
1081
|
-
operationId: "listTriggers", tags: ["local"], summary: "The triggers: schedules that start an agent's capped runs",
|
|
1549
|
+
operationId: "listTriggers", tags: ["local"], summary: "The triggers: schedules and signed webhooks that start an agent's capped runs or message a run",
|
|
1082
1550
|
description: TRIGGER_ERRORS,
|
|
1083
|
-
responses: { "200": json(closed({ triggers: { type: "array", items:
|
|
1551
|
+
responses: { "200": json(closed({ triggers: { type: "array", items: TRIGGER_READ } }), "Each trigger, oldest first, with its last firing."), ...errors(401, 409, 429, 500) },
|
|
1084
1552
|
...TRIGGER_MARK,
|
|
1085
1553
|
},
|
|
1086
1554
|
post: {
|
|
1087
1555
|
operationId: "createTrigger", tags: ["local"], summary: "Make a trigger: a schedule or a signed webhook that starts a capped run of an agent, or messages a run",
|
|
1088
|
-
description: `Each firing starts one run of \`target.agent_id\` with \`target.input\` and its \`max_cost_usd\` (else the agent's default), as POST /agents/{agent_id}/runs would, and the run's \`trigger\` names it. A firing starts its run once, across retries and restarts. While the trigger's last run is active (working, or waiting on a person: a question, an approval, its cap), a firing is skipped. The last ${HISTORY_KEPT} firings are kept. A \`webhook\` source fires on each request to /hooks/{trigger_id} signed by its secret, which this answer holds (\`secret\`) this once: a retry under the same Idempotency-Key answers the same trigger with a \`note\` in its place, as the key's record never keeps a secret. A \`message_run\` target sends each firing's input to one run, under the firing's key, which the run's store takes once. 422 for another source kind, a start_run target with no max_cost_usd whose agent has no default one, an agent that is a workflow or does not take the input, or a run that is a workflow's; 409 no_sealing_key for a webhook trigger on a server handed no seal key.`,
|
|
1556
|
+
description: `Each firing starts one run of \`target.agent_id\` with \`target.input\` and its \`max_cost_usd\` (else the agent's default), as POST /agents/{agent_id}/runs would, and the run's \`trigger\` names it. A firing starts its run once, across retries and restarts. While the trigger's last run is active (working, or waiting on a person: a question, an approval, its cap), a firing is skipped; a webhook trigger with \`accept\` starts a run for each event it takes instead (the server's run limit still holds: a start it refuses is tried again). The last ${HISTORY_KEPT} firings are kept. A \`webhook\` source fires on each request to /hooks/{trigger_id} signed by its secret, which this answer holds (\`secret\`) this once: a retry under the same Idempotency-Key answers the same trigger with a \`note\` in its place, as the key's record never keeps a secret. A \`message_run\` target sends each firing's input to one run, under the firing's key, which the run's store takes once. 422 for another source kind, a start_run target with no max_cost_usd whose agent has no default one, an agent that is a workflow or does not take the input, or a run that is a workflow's; 409 no_sealing_key for a webhook trigger on a server handed no seal key.`,
|
|
1089
1557
|
parameters: [ref("parameters/IdempotencyKey")],
|
|
1090
1558
|
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, required: ["source", "target"], properties: TRIGGER_WRITE } } } },
|
|
1091
|
-
responses: { "201": json({ ...TRIGGER, properties: { ...TRIGGER.properties, secret: TRIGGER_SECRET,
|
|
1559
|
+
responses: { "201": json({ ...TRIGGER, properties: { ...TRIGGER.properties, secret: TRIGGER_SECRET_META, signing_secret: TRIGGER_SECRET, secret_set: { const: true, description: "A webhook trigger's first answer: its secret is made and kept. The secret itself is in the answer to the owner's signed-in session alone (the console's)." }, note: { type: "string", description: "In place of a webhook trigger's secret: to the API token, which is never shown one, the words that send the person to the console to rotate it there; on a retry under the same Idempotency-Key, that it was shown once." } } }, "Made; a webhook trigger's first answer to the owner's signed-in session holds its `signing_secret`, this once."), ...errors(400, 401, 409, 415, 422, 429, 500) },
|
|
1092
1560
|
...TRIGGER_MARK,
|
|
1093
1561
|
},
|
|
1094
1562
|
},
|
|
@@ -1096,7 +1564,7 @@ const EXTENSIONS = {
|
|
|
1096
1564
|
get: {
|
|
1097
1565
|
operationId: "getTrigger", tags: ["local"], summary: "One trigger",
|
|
1098
1566
|
parameters: [TRIGGER_ID],
|
|
1099
|
-
responses: { "200": json(
|
|
1567
|
+
responses: { "200": json(TRIGGER_READ, "The trigger."), ...errors(401, 404, 409, 429, 500) },
|
|
1100
1568
|
...TRIGGER_MARK,
|
|
1101
1569
|
},
|
|
1102
1570
|
patch: {
|
|
@@ -1126,20 +1594,22 @@ const EXTENSIONS = {
|
|
|
1126
1594
|
"/triggers/{trigger_id}/secret": {
|
|
1127
1595
|
post: {
|
|
1128
1596
|
operationId: "rotateTriggerSecret", tags: ["local"], summary: "A webhook trigger's new secret, shown once; the old one signs nothing from now on",
|
|
1129
|
-
description: "422 for a trigger that is not a webhook's; 409 no_sealing_key when the server was handed no seal key.",
|
|
1597
|
+
description: "A secret write: the owner's signed-in session alone (ownerSession), never the token, which is 403 forbidden in words and the secret kept. 422 for a trigger that is not a webhook's; 409 no_sealing_key when the server was handed no seal key.",
|
|
1130
1598
|
parameters: [TRIGGER_ID],
|
|
1131
|
-
|
|
1599
|
+
// The owner's password session alone (secret-writes.ts), never the document's bearer.
|
|
1600
|
+
security: [{ ownerSession: [] }],
|
|
1601
|
+
responses: { "200": json(closed({ secret: TRIGGER_SECRET_META, signing_secret: TRIGGER_SECRET }), "The new secret as `signing_secret`, this once, and its metadata."), ...errors(401, 403, 404, 409, 422, 429, 500) },
|
|
1132
1602
|
...TRIGGER_MARK,
|
|
1133
1603
|
},
|
|
1134
1604
|
},
|
|
1135
1605
|
"/hooks/{trigger_id}": {
|
|
1136
1606
|
post: {
|
|
1137
1607
|
operationId: "receiveHook", tags: ["local"], summary: "Fire a webhook trigger: a request signed by its secret, no token",
|
|
1138
|
-
description: `This server's one route with no token: the request's signature is its credential, checked on the raw body before anything else.
|
|
1608
|
+
description: `This server's one route with no token: the request's signature is its credential, checked on the raw body before anything else. A webhook trigger's \`signature\` names the scheme its requests are signed under (default \`${DEFAULT_SCHEME}\`), and a request is checked by the one scheme whose signature header it carries (${SCHEME_NAMES.map((name) => `\`${SIGNATURE_SCHEMES[name].signatureHeader}\` for \`${name}\``).join(", ")}): ${SCHEME_NAMES.map((name) => SIGNATURE_SCHEMES[name].describe).join(" ")} The body's bytes are signed as sent, whatever its content type. The body is any text, at most 256 KiB (413 past it), arriving whole within ${HOOK_BODY_MS / 1000} s (408 past that); its first ${PAYLOAD_KEPT_BYTES / 1024} KiB reach the agent inside \`<trigger-payload source="webhook" scheme="..." event="..." action="..." delivery="..." untrusted>\`, the event as the scheme reads it, the action the JSON body's top-level \`action\`, the delivery the unsigned delivery id (GitHub's X-GitHub-Delivery), and for a GitHub delivery \`number\` (pull_request.number, else issue.number) and \`head_sha\` (pull_request.head.sha; none on a comment event), read from the signed body so the cut never loses them, each when there is one. A bad or missing signature, a stale or future timestamp, no scheme's signature header or more than one, a scheme other than the trigger's, an unknown trigger, one that is off and one that is not a webhook's all answer the same 401. A verified request its trigger's \`accept\` does not take (GitHub's \`ping\` among them, when no rule names it) answers 200 \`{"ok": "ignored"}\`, fires nothing and is said in the log. The first request with a firing key (as its scheme reads it: the signed \`webhook-id\`, or the SHA-256 of a GitHub body) answers 202 once its firing is recorded, and its run starts after; the same key again, for a day after, answers 200 with that firing (or \`{"ok": "duplicate"}\` once the firing has left the trigger's kept history; each trigger keeps up to ${SEEN_KEPT} keys for their day, the oldest let go first past that) and starts nothing. A trigger holds at most ${DUE_KEPT} firings due (a message_run firing waits while its run works): past them a new delivery answers 429 \`rate_limited\` with Retry-After and records nothing, so the sender sends it again later.`,
|
|
1139
1609
|
security: [],
|
|
1140
1610
|
parameters: [TRIGGER_ID],
|
|
1141
1611
|
requestBody: { required: true, content: { "*/*": { schema: {} } } },
|
|
1142
|
-
responses: { "202": json(TRIGGER_FIRING, "Recorded: its run starts (or its message goes) after this answer."), "200": json(TRIGGER_FIRING, "This
|
|
1612
|
+
responses: { "202": json(TRIGGER_FIRING, "Recorded: its run starts (or its message goes) after this answer."), "200": json({ oneOf: [TRIGGER_FIRING, HOOK_IGNORED, HOOK_DUPLICATE] }, "This firing key's firing, as it stands; `{ok: \"ignored\"}`; or `{ok: \"duplicate\"}`."), "408": HOOK_TIMEOUT, ...errors(401, 413, 429, 500) },
|
|
1143
1613
|
...TRIGGER_MARK,
|
|
1144
1614
|
},
|
|
1145
1615
|
},
|
|
@@ -1151,6 +1621,23 @@ const EXTENSIONS = {
|
|
|
1151
1621
|
...TRIGGER_MARK,
|
|
1152
1622
|
},
|
|
1153
1623
|
},
|
|
1624
|
+
"/templates": {
|
|
1625
|
+
get: {
|
|
1626
|
+
operationId: "listTemplates", tags: ["local"], summary: "The template packages this server ships: each makes an agent, its skills and its triggers",
|
|
1627
|
+
responses: { "200": json(closed({ templates: { type: "array", items: TEMPLATE } }), "Each package, by name."), ...errors(401, 429, 500) },
|
|
1628
|
+
...TEMPLATE_MARK,
|
|
1629
|
+
},
|
|
1630
|
+
},
|
|
1631
|
+
"/templates/{template}/apply": {
|
|
1632
|
+
post: {
|
|
1633
|
+
operationId: "applyTemplate", tags: ["local"], summary: "Apply a template package: make its agent, with its skills, then its triggers",
|
|
1634
|
+
description: "The package's parameters are checked (422 naming each, nothing made), then the secrets and required MCP servers it names: one this server does not have is `409 agent_not_runnable`, each a field with reason `not_set_up_here`, and nothing is made. An MCP server it can do without that is not saved here is skipped, a warning under `mcp.<server>`; one saved has the package's tools of it granted and set to allow. Then its agent is made as POST /agents makes one, on the first harness of its list this server runs and the model its tier and preference pick here (`overrides.model` wins); then each trigger on it as POST /triggers makes one. A trigger refused deletes the triggers made before it and archives the agent, and its refusal is the answer, a 422's fields under `triggers.<i>`; but a github trigger on a server GitHub is not connected to is skipped, the agent and the rest made, with a warning under `triggers.<i>` (`not_set_up_here`: connect GitHub and apply again), and one made adds a note there saying what it runs on. A webhook trigger's secret is not in the answer: POST /triggers/{trigger_id}/secret makes one. The same Idempotency-Key and body answers the first apply again and makes nothing.",
|
|
1635
|
+
parameters: [{ name: "template", in: "path", required: true, schema: { type: "string" }, description: "The package's name (GET /templates)." }, ref("parameters/IdempotencyKey")],
|
|
1636
|
+
requestBody: { required: true, content: { "application/json": { schema: TEMPLATE_APPLY } } },
|
|
1637
|
+
responses: { "201": json(TEMPLATE_APPLIED, "Applied: the agent and its triggers made."), ...errors(400, 401, 404, 409, 415, 422, 429, 500) },
|
|
1638
|
+
...TEMPLATE_MARK,
|
|
1639
|
+
},
|
|
1640
|
+
},
|
|
1154
1641
|
"/settings/webhook/deliveries/{webhook_id}/redeliver": {
|
|
1155
1642
|
post: {
|
|
1156
1643
|
operationId: "redeliverWebhook", tags: ["local"], summary: "Send a message of the log again, once now, under the same webhook-id and body",
|
|
@@ -1205,7 +1692,21 @@ const LEARNING_SHORT = {
|
|
|
1205
1692
|
};
|
|
1206
1693
|
/** What this server's run answers carry beyond the contract's Run and RunSummary: added before they were marked, so
|
|
1207
1694
|
* `serve/1`. */
|
|
1695
|
+
/** consoleurl/1: the console's page of a run or an agent, where a person opens it. */
|
|
1696
|
+
const CONSOLE_URL = (what) => ({ type: "string", format: "uri", description: `The ${what}'s page in this server's console, at the address people open it (the server's public URL when it has one, else the address this request reached it at): the link to give a person.`, "x-agentrun-serve": "consoleurl/1" });
|
|
1697
|
+
/** The RUN_FIELDS every run's view and summary hold (runs.ts): required, beside the contract's. */
|
|
1698
|
+
export const RUN_FIELDS_SENT = ["revision", "kind", "archived_at"];
|
|
1699
|
+
/** The field every saved sign-in is sent with beside the contract's, required: `secret`, its one secret's metadata
|
|
1700
|
+
* (secrets/1, sign-ins-secrets.ts). */
|
|
1701
|
+
export const SIGN_IN_FIELDS_SENT = ["secret"];
|
|
1702
|
+
/** DefinitionInput's contract fields this server does not require (validate.ts): a workflow revision has no
|
|
1703
|
+
* instructions, and the server mints or keeps version, skills and tools when a write leaves them out. */
|
|
1704
|
+
export const DEFINITION_INPUT_OPTIONAL = ["instructions", "version", "skills", "tools"];
|
|
1705
|
+
/** Definition's own: only instructions ever misses from an answer (a workflow revision keeps none); version, skills
|
|
1706
|
+
* and tools are always sent (agents.ts definitionOf), so they stay required there. */
|
|
1707
|
+
export const DEFINITION_OPTIONAL = ["instructions"];
|
|
1208
1708
|
const RUN_FIELDS = {
|
|
1709
|
+
console_url: CONSOLE_URL("run"),
|
|
1209
1710
|
revision: { type: "string", description: "The id of the agent revision the run runs.", "x-agentrun-serve": "serve/1" },
|
|
1210
1711
|
kind: { enum: ["agentic", "workflow"], description: "The revision's kind: an agentic run, or a workflow run.", "x-agentrun-serve": "serve/1" },
|
|
1211
1712
|
archived_at: { type: ["string", "null"], description: "When the run, or its agent, was archived, while it is; else null.", "x-agentrun-serve": "serve/1" },
|
|
@@ -1240,13 +1741,41 @@ const PENDING = {
|
|
|
1240
1741
|
cap_usd: { type: "number", exclusiveMinimum: 0, description: "The run's cap (`max_cost_usd`)." },
|
|
1241
1742
|
spent_usd: { type: "number", minimum: 0, description: "What the cap counted as taken when it refused: spent, and held for requests still answering; once the paused process is gone, the store's spend when that is lower (those requests settled). Absent for a refusal written before the figures were kept." },
|
|
1242
1743
|
needs_usd: { type: "number", minimum: 0, description: "The least the refused request needs. A cap above `spent_usd` + `needs_usd` sends it. Absent with `spent_usd`." },
|
|
1744
|
+
least_cap_usd: { type: "number", exclusiveMinimum: 0, description: "The least cap that sends the refused request: the figure `said` names (\"Raise the cap to at least $X\"), carried from the refusal that wrote those words, so the two never differ. Whole cents, always above `cap_usd`. Absent with `spent_usd`." },
|
|
1243
1745
|
suggested_cap_usd: { type: "number", exclusiveMinimum: 0, description: "The raise this run is offered: `spent_usd` + 10 × `needs_usd`, rounded up to a whole dollar, and always above `cap_usd`, so `PATCH /runs/{run_id}` with it as `max_cost_usd` is a raise that resumes the run. Absent with `spent_usd`." },
|
|
1746
|
+
overshoot_bound_usd: { type: "number", minimum: 0, description: "The most a cache miss could make the refused request cost beyond `needs_usd` under the run's `cap_mode` expected (its input uncached less its input expected, rounded up to a millionth); 0 under strict, and for a request priced with nothing cached. Absent with `spent_usd`.", "x-agentrun-serve": "capmode/1" },
|
|
1244
1747
|
said: { type: "string", description: "The cap's refusal, in its words: what was spent, what the refused request needs at the least, and the cap that would run it. At most 2000 characters." },
|
|
1245
1748
|
at: { type: "string", format: "date-time", description: "When the request was refused." },
|
|
1749
|
+
node: { type: ["string", "null"], description: "A workflow run's: the label of the node whose step waits at the cap (a model node's request, a call node's call, a decision); null when it is not known. Absent on an agentic run.", "x-agentrun-serve": "workflowcap/1" },
|
|
1246
1750
|
},
|
|
1247
|
-
description: "A run paused at its spend cap (status input_required, state waiting): what is left of the cap cannot buy its next request's least, which was not sent. A message is 409 budget_reached until the cap is raised. Only a refusal for room pauses a run, a paid tool call's as a model request's (its hold is needs_usd); one no cap fixes (an unknown spend, a model with no price or no output ceiling, an input not measured) still ends it failed, spend_cap_reached.",
|
|
1751
|
+
description: "A run paused at its spend cap (status input_required, state waiting): what is left of the cap cannot buy its next request's least, which was not sent. A message is 409 budget_reached until the cap is raised. Only a refusal for room pauses a run, a paid tool call's as a model request's (its hold is needs_usd); one no cap fixes (an unknown spend, a model with no price or no output ceiling, an input not measured) still ends it failed, spend_cap_reached. A workflow run pauses the same way, each paid step held before it is sent (a model node's request, a call node's paid tool call or `llm` call, a decision at its provider's price): the step waits where it stands, unsent, and the run goes on from it once raised.",
|
|
1248
1752
|
"x-agentrun-serve": "cappause/1",
|
|
1249
1753
|
},
|
|
1754
|
+
{
|
|
1755
|
+
type: "object", additionalProperties: false, required: ["kind", "instruction", "completion_condition", "asked_at", "expires_at"],
|
|
1756
|
+
properties: {
|
|
1757
|
+
kind: { const: "browser" },
|
|
1758
|
+
instruction: { type: "string", description: "What the agent asks the person to do in its browser, at most 2000 characters." },
|
|
1759
|
+
completion_condition: { type: "string", description: "How the agent will know it is done, at most 2000 characters." },
|
|
1760
|
+
asked_at: { type: "string", format: "date-time" },
|
|
1761
|
+
expires_at: { type: "string", format: "date-time", description: "When the ask expires unanswered (15 minutes after it)." },
|
|
1762
|
+
},
|
|
1763
|
+
description: "The run's agent asked for the person in its browser (status input_required, state waiting; its turn waits inside the tool call): POST /runs/{run_id}/browser/hand-back answers it, after the person does it in the live view.",
|
|
1764
|
+
"x-agentrun-serve": "liveview/2",
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
type: "object", additionalProperties: false, required: ["kind", "computer", "instruction", "completion_condition", "asked_at", "expires_at"],
|
|
1768
|
+
properties: {
|
|
1769
|
+
kind: { const: "computer" },
|
|
1770
|
+
computer: { enum: ["desktop", "phone"], description: "The run's computer the agent asks the person to use." },
|
|
1771
|
+
instruction: { type: "string", description: "What the agent asks the person to do on its computer." },
|
|
1772
|
+
completion_condition: { type: "string", description: "How the agent will know it is done." },
|
|
1773
|
+
asked_at: { type: "string", format: "date-time" },
|
|
1774
|
+
expires_at: { type: "string", format: "date-time", description: "When the ask expires unanswered (15 minutes after it at most)." },
|
|
1775
|
+
},
|
|
1776
|
+
description: "The run's agent asked for the person on its desktop or phone (its `computer_request_handoff` tool; status input_required, state waiting; its turn waits inside the tool call): POST /runs/{run_id}/computer/hand-back answers it, and so does a take-over handed back.",
|
|
1777
|
+
"x-agentrun-serve": "computer/1",
|
|
1778
|
+
},
|
|
1250
1779
|
{ type: "null" },
|
|
1251
1780
|
],
|
|
1252
1781
|
description: "What the run waits on, told apart by kind; null when it waits on nothing. A run read from its stored row alone has ended, so null.",
|
|
@@ -1265,24 +1794,57 @@ const RUN_PLACE = {
|
|
|
1265
1794
|
description: "Where the run executes, as its start resolved it: its revision's place, else runner. In a sandbox place the agent's bash runs in the box, which binds only the run's work/ and has no network and no key; read, write and edit run in the box too, or on this server's copy of that work/ where the box binds it and this server holds directory handles (Docker on Linux), following no link. Its loop, its log and every key stay on the server. The Modal sandbox (box `modal`, Modal's default gVisor runtime, not a VM) never has a network: Modal takes a host list, but this server cannot read a sandbox's list back to check that it holds, so each is made blocked, and capabilities.places.boxes says so in its network_reason (unless AGENTRUN_BOX_ALLOW is none).",
|
|
1266
1795
|
"x-agentrun-serve": "place/1",
|
|
1267
1796
|
};
|
|
1797
|
+
/** capmode/1: how a run's cap prices a request's input. */
|
|
1798
|
+
const CAP_MODE = {
|
|
1799
|
+
enum: ["expected", "strict"],
|
|
1800
|
+
description: "How the run's cap (`max_cost_usd`) prices each model request's input. `expected` (the default): the input the previous request of its conversation reported read from or written to the cache, at the cache-read price, when that request ended less than 4 minutes before; the rest of its input (the previous request's input after the cache, and what the conversation grew by since, a token a byte) at the input price, the cache write's when dearer. With no such request, all of it at that price. Output is limited to what the cap leaves, so output never passes it; a cache miss can, by at most the request's bound (its input uncached less its input expected), served as the run's `cost.overshoot_bound_usd` while it is in flight; its real cost is booked, and the timeline says so. `strict`: every input token at the input or cache-write price, the worst case: no request passes the cap, and a run pauses sooner. Only with a cap.",
|
|
1801
|
+
"x-agentrun-serve": "capmode/1",
|
|
1802
|
+
};
|
|
1803
|
+
/** inlineagent/1: an agent's reference in the system that owns it, as POST /runs names it. */
|
|
1804
|
+
const EXTERNAL_REF = closed({
|
|
1805
|
+
source: { type: "string", pattern: EXTERNAL_NAME.source, description: "The system that owns the agent, such as `grep`. No colon." },
|
|
1806
|
+
kind: { type: "string", pattern: EXTERNAL_NAME.source, description: "What the agent is there, such as `expert`. No colon." },
|
|
1807
|
+
id: { type: "string", minLength: 1, maxLength: 255, description: "The agent's id there." },
|
|
1808
|
+
version: { oneOf: [{ type: "string", minLength: 1, maxLength: 128 }, { type: "integer", minimum: 0 }], description: "The version there of the definition sent: one revision here per version, kept as text (7 and \"7\" are one version). A version's definition never changes: another under a version already run is 409 external_body_conflict." },
|
|
1809
|
+
}, "The agent's reference in the system that owns it: one agent here per source, kind and id; one revision per version.");
|
|
1268
1810
|
/** costsofar/1: a cost no one fully knows, said as what is known and how much is not, with no ceiling claimed. */
|
|
1269
1811
|
const SO_FAR = {
|
|
1270
1812
|
so_far_usd: { type: "number", minimum: 0, description: "Set only while `usd` is null: the sum of the charges whose cost is known (model requests, a workflow's decisions, paid tool calls). Never the cost: the charges counted in `unpriced` are not in it, and nothing bounds them.", "x-agentrun-serve": "costsofar/1" },
|
|
1271
1813
|
unpriced: { type: "integer", minimum: 1, description: "Set only while `usd` is null: how many charges have no known cost (a model request cut, stopped, still pending or with no price; a decision whose cost is unknown; a paid tool call charged an unknown amount or cut).", "x-agentrun-serve": "costsofar/1" },
|
|
1272
1814
|
};
|
|
1273
1815
|
const FIELD_EXTENSIONS = {
|
|
1274
|
-
Cost:
|
|
1816
|
+
Cost: {
|
|
1817
|
+
...SO_FAR,
|
|
1818
|
+
overshoot_bound_usd: { type: "number", minimum: 0, description: "Set when the run has a cap: the most its model requests in flight could cost beyond what its cap holds them at, when one misses the cache (`cap_mode` expected: each one's input uncached less its input expected, rounded up to a millionth). 0 with none in flight, under strict, and for a request priced with nothing cached. The cap never lets output pass it, so this is all a run can go over its cap by.", "x-agentrun-serve": "capmode/1" },
|
|
1819
|
+
},
|
|
1820
|
+
RunCreate: { cap_mode: { ...CAP_MODE, description: `${CAP_MODE.description} Absent: the agent's (its definition's \`cap_mode\`), else expected. 422 not_allowed for a run with no cap.` } },
|
|
1275
1821
|
TimelineUsage: { ...SO_FAR, not_metered: { type: "integer", minimum: 1, description: "Set when the run made tool calls with no price (an MCP tool its owner set none for): how many. They ran outside the run's cost and its cap, and never make `usd` unknown.", "x-agentrun-serve": "mcpservers/1" } },
|
|
1822
|
+
Usage: { unpriced_runs: { type: "integer", minimum: 0, description: "How many runs in the report have a cost no one knows on them: they add no dollars to `total_usd`, so no sum passes them off as $0.", "x-agentrun-serve": "costsofar/1" } },
|
|
1276
1823
|
UsageLine: { unpriced_runs: { type: "integer", minimum: 0, description: "How many of the runs counted on this line have a cost no one knows on it: they add no dollars to `usd`, so no sum passes them off as $0.", "x-agentrun-serve": "costsofar/1" }, not_metered_calls: { type: "integer", minimum: 1, description: "On the `tools` meter's line, set when the runs counted made tool calls with no price (an MCP tool its owner set none for): how many. They are outside `usd`.", "x-agentrun-serve": "mcpservers/1" } },
|
|
1277
1824
|
Run: {
|
|
1278
1825
|
...RUN_FIELDS,
|
|
1826
|
+
approvals: { enum: ["ask", "never"], description: "Whether the run runs unattended: its revision's approvals, as it started (a run keeps the revision it started on). never: each tool that would ask was allowed at its gate, a deny still refused; ask: a tool set to ask parks it for an approval.", "x-agentrun-serve": "unattended/1" },
|
|
1827
|
+
cap_mode: { type: ["string", "null"], enum: ["expected", "strict", null], description: "How the run's cap prices each model request's input (`cap_mode` on its start, else its agent's, else expected; see RunCreate.cap_mode). Null for a run with no cap.", "x-agentrun-serve": "capmode/1" },
|
|
1279
1828
|
last_progress_at: {
|
|
1280
1829
|
type: ["string", "null"],
|
|
1281
1830
|
format: "date-time",
|
|
1282
1831
|
description: "While a message the run took is still open (an agentic run, working or queued): when its turn last wrote anything, a request's start included; it holds still while a tool or a model request runs, and moves as the turn writes. Null once every message has had its turn, and on a workflow run.",
|
|
1283
1832
|
"x-agentrun-serve": "turnend/1",
|
|
1284
1833
|
},
|
|
1834
|
+
claim: {
|
|
1835
|
+
type: ["object", "null"],
|
|
1836
|
+
additionalProperties: false,
|
|
1837
|
+
required: ["runner", "epoch", "until"],
|
|
1838
|
+
properties: {
|
|
1839
|
+
runner: { type: "string", description: "The id of the runner process holding the run now." },
|
|
1840
|
+
epoch: { type: "integer", description: "The run's claim count: it rises by one each time a runner claims the run, and every write the runner makes under its claim carries it, so a write from a claim that has ended is refused." },
|
|
1841
|
+
until: { type: "string", format: "date-time", description: "When the claim runs out unless its runner renews it first; past it, another runner may claim the run." },
|
|
1842
|
+
},
|
|
1843
|
+
description: "The runner holding the run now, when one does (a running run): its id, the claim's count, and when the claim runs out. Null when no runner holds the run.",
|
|
1844
|
+
"x-agentrun-serve": "claim/1",
|
|
1845
|
+
},
|
|
1285
1846
|
place: RUN_PLACE,
|
|
1847
|
+
computer: RUN_COMPUTER,
|
|
1286
1848
|
learning: LEARNING,
|
|
1287
1849
|
review: REVIEW,
|
|
1288
1850
|
pending: PENDING,
|
|
@@ -1296,7 +1858,10 @@ const FIELD_EXTENSIONS = {
|
|
|
1296
1858
|
},
|
|
1297
1859
|
trigger: RUN_TRIGGER,
|
|
1298
1860
|
},
|
|
1299
|
-
InputIssue: {
|
|
1861
|
+
InputIssue: {
|
|
1862
|
+
code: { type: "string", description: "A workflow definition's issue: the DSL's validation code (`STATE_PATH_UNPRODUCED`, say), with `field` the path to it under `definition.workflow`.", "x-agentrun-serve": "validate/1" },
|
|
1863
|
+
example: { description: "A value the field accepts, said in `message` too: the operation's documented request body's value there, else the schema's example, const or option, else one made from its type; each is suggested only once the route's own check of the body takes it in place (else the schema, for a value the document gives), so this server never suggests a value it refuses. Absent when there is none. For a field the body does not keep that an object inside it does, the body with the field where it belongs, as `fix` shows it: `{\"definition\": {\"name\": \"Due diligence\"}}`.", "x-agentrun-serve": "explain/1" },
|
|
1864
|
+
},
|
|
1300
1865
|
RunSummary: {
|
|
1301
1866
|
...RUN_FIELDS,
|
|
1302
1867
|
effort: { $ref: "#/components/schemas/Effort", description: "The effort the run was started with, as the run shows it; absent when it was started with none.", "x-agentrun-serve": "effort/1" },
|
|
@@ -1323,9 +1888,19 @@ const FIELD_EXTENSIONS = {
|
|
|
1323
1888
|
},
|
|
1324
1889
|
},
|
|
1325
1890
|
TimelineRow: {
|
|
1891
|
+
paused: {
|
|
1892
|
+
const: true,
|
|
1893
|
+
description: "On the row of the spend cap's refusal for room that an agentic run paused at: the server's `phase` row (`origin` server, its id ending `:note`, so no message), \"Paused at the run's cap\", never an `error` row. The request was not sent and the run paused at its cap for a raise (`pending.kind` budget), whose sentence is `pending.said`'s, shown once. Kept once the cap is raised, as the run's history. A refusal that fails the run (one no cap fixes, a workflow's) stays an `error` row, without it. Absent on every other row.",
|
|
1894
|
+
"x-agentrun-serve": "cappause/1",
|
|
1895
|
+
},
|
|
1326
1896
|
origin: {
|
|
1327
|
-
|
|
1328
|
-
description: "On the row of a message the server wrote into the run (a raised cap's follow-up, an approval's resume)
|
|
1897
|
+
enum: ["server", "trigger"],
|
|
1898
|
+
description: "On the row of a message the person did not write: `server`, one the server wrote into the run (a raised cap's follow-up, an approval's resume), a `phase` row \"AgentRun: <its first line>\"; `trigger`, a trigger's input (a started run's first message, or a firing's message), a `phase` row \"<its source: Schedule, Webhook, Slack or GitHub> <the trigger's name as it is now, or its id once it is gone>: <its first line>\". Either is where a person's message would be a `user_message` row, and counts, as a person's does, as the message its turn took. Absent on every other row.",
|
|
1899
|
+
"x-agentrun-serve": "origin/1",
|
|
1900
|
+
},
|
|
1901
|
+
trigger: {
|
|
1902
|
+
...closedWith({ id: { type: "string", description: "The trigger's id." }, source: { enum: [...TRIGGER_SOURCES], description: "What fired it, by the trigger's definition." }, owner: { type: "boolean", description: "True when the words are its owner's (a schedule's), false when they came from outside (a webhook's)." } }, { name: { type: "string", description: "The trigger's name as it is now, redacted as the row is: the one its summary shows after its source, so a client drops exactly \"<source> <name>: \" whatever colons the name holds. Absent once the trigger is gone (the summary names its id)." } }),
|
|
1903
|
+
description: "On a trigger's row (`origin` `trigger`) alone: the trigger whose input the row is, so a client labels it by its source without reading its summary. Absent on every other row.",
|
|
1329
1904
|
"x-agentrun-serve": "origin/1",
|
|
1330
1905
|
},
|
|
1331
1906
|
learning: {
|
|
@@ -1349,16 +1924,39 @@ const FIELD_EXTENSIONS = {
|
|
|
1349
1924
|
{ type: "object", additionalProperties: false, required: ["mode"], properties: { mode: { const: "runner" } } },
|
|
1350
1925
|
{ type: "object", additionalProperties: false, required: ["mode", "box"], properties: { mode: { const: "sandbox" }, box: { enum: [...BOX_IDS] } } },
|
|
1351
1926
|
],
|
|
1352
|
-
description: "Where the revision's runs execute: `runner` (no box and no shell) or `sandbox` (the agent's file and shell tools run in the box; its loop, its log and every key stay on the server). Absent on a create of an agentic revision, the place this server gives a new agent (capabilities.places.default_place): the Docker box where this server has docker, ready or preparing, written on the revision so an answer shows it, with tools [\"bash\"] when the definition names no tools (a list it names, an empty one included, is kept as named); where docker is unavailable, or the definition names a tool a box refuses (browser), none, as before. A revision saved with no place
|
|
1927
|
+
description: "Where the revision's runs execute: `runner` (no box and no shell) or `sandbox` (the agent's file and shell tools run in the box; its loop, its log and every key stay on the server). Absent on a create of an agentic revision, the place this server gives a new agent (capabilities.places.default_place): the Docker box where this server has docker, ready or preparing, written on the revision so an answer shows it, with tools [\"bash\", \"bash_background\", \"bash_output\", \"bash_input\", \"bash_signal\", \"bash_list\"] when the definition names no tools (a list it names, an empty one included, is kept as named); where docker is unavailable, or the definition names a tool a box refuses (browser), none, as before. A revision saved with no place runs where this server's capabilities.places.default_place says at each run (the Docker box where docker is available or preparing now, else the runner); a workflow, and one that names a tool a box refuses, on the runner. A revision keeps the place it names, runner included. An edit that names none keeps the agent's. A box this server does not have saves with a warning, and its runs are 409 agent_not_runnable naming it (capabilities.places.boxes). Only an agentic revision in a sandbox place may name `bash` or a background tool (`bash_background`, `bash_output`, `bash_input`, `bash_signal`, `bash_list`); a workflow revision's place is runner or none (a sandbox place is 422).",
|
|
1353
1928
|
"x-agentrun-serve": "place/1",
|
|
1354
1929
|
},
|
|
1355
|
-
|
|
1930
|
+
computer: {
|
|
1931
|
+
type: "object", additionalProperties: false, required: ["kind"],
|
|
1932
|
+
properties: {
|
|
1933
|
+
kind: { enum: ["none", "sandbox", "desktop", "phone", "browser"] },
|
|
1934
|
+
provider: { type: "string", description: "The provider that serves the kind, from GET /computers. Absent for `none`." },
|
|
1935
|
+
},
|
|
1936
|
+
description: "The computer the revision's runs are given (Settings → Computers): its kind and the provider that serves it. `place` is its v2 view where it can say it: `{kind: none}` is `place {mode: runner}`, `{kind: sandbox, provider: X}` is `place {mode: sandbox, box: X}`; a desktop, phone or browser computer leaves the run's folder on the runner, so its place reads runner. Writing either sets both, and both given must agree (422). Absent on a create, the server's default (as `place`); an edit that names neither keeps the agent's.",
|
|
1937
|
+
"x-agentrun-serve": "computer/1",
|
|
1938
|
+
},
|
|
1939
|
+
tool_settings: { ...TOOL_SETTINGS, description: "The agent's own tool settings (web_search's, web_fetch's and browser's provider, any tool's permission, an MCP server's wildcard mcp:<server>/*, an MCP tool's pin), over the server's (GET /settings/tools), except a deny set on the server, which is absolute: the tool is refused on this server whatever this agent sets; absent, the server's. A pin is not over the server's: both hold. A grant in tools names the capability, never a provider.", "x-agentrun-serve": "providers/1" },
|
|
1940
|
+
approvals: { enum: ["ask", "never"], default: "ask", description: "Whether the agent's runs ask a person or run unattended. `ask`, the default: a tool set to ask parks the run for an approval, as its tool settings say. `never`: the agent runs unattended, and each tool that would ask is allowed instead, decided by the tool gate at each call, so a tool granted later and an MCP tool (`mcp:<server>/<tool>`, which asks by default) are covered on every harness. It never lifts a deny, whether set on this server or in the agent's own tool_settings, nor a pin, nor anything else the gate refuses before it decides between running and asking. A workflow's call node on a tool set to ask runs under `never`. Absent on a request: ask. An edit that leaves it out asks, so no edit makes an agent unattended by saying nothing. Every answer names it.", "x-agentrun-serve": "unattended/1" },
|
|
1356
1941
|
learning: { type: "boolean", default: false, description: "Whether an agentic revision's runs learn: each starts from what its agent has learned, its notes in its instructions under `# Learned` (each whole within the server's learning budget, else the index and the notes changed last, whole) and in `.learning/` in its working directory, and once it answers or fails is asked one more turn to add notes there, which are checked, graded and merged. Kept when a definition says so, true or false; absent, off, and an answer shows none. An edit that leaves it out keeps the agent's. A workflow revision keeps none. On a server whose learning is off (`capabilities.features.learning`), no run learns, whatever this says.", "x-agentrun-serve": "learning/1" },
|
|
1942
|
+
cap_mode: { ...CAP_MODE, description: `The cap mode of each run of this agent that has a cap and names none of its own. ${CAP_MODE.description} An edit that leaves it out keeps the agent's. An agentic definition's or a workflow's alike.` },
|
|
1357
1943
|
},
|
|
1358
1944
|
AgentCreate: {
|
|
1359
1945
|
note: { type: "string", maxLength: 2000, description: "What the revision changes, kept with it (GET /agents/{agent_id}/revisions).", "x-agentrun-serve": "definitionbody/1" },
|
|
1360
1946
|
},
|
|
1361
1947
|
Agent: {
|
|
1948
|
+
external: {
|
|
1949
|
+
...closed({
|
|
1950
|
+
source: EXTERNAL_REF.properties.source,
|
|
1951
|
+
kind: EXTERNAL_REF.properties.kind,
|
|
1952
|
+
id: EXTERNAL_REF.properties.id,
|
|
1953
|
+
version: { type: "string", description: "The version in its source of the agent's current revision: the version whose first run made it, as text." },
|
|
1954
|
+
}),
|
|
1955
|
+
readOnly: true,
|
|
1956
|
+
description: "Set only on an agent another system owns, made by its first run of POST /runs: its reference there. Read-only: the agent's edits, current revision and archive here are 403 forbidden, as its source is the truth. Absent on an agent of this server's own.",
|
|
1957
|
+
"x-agentrun-serve": "inlineagent/1",
|
|
1958
|
+
},
|
|
1959
|
+
console_url: CONSOLE_URL("agent"),
|
|
1362
1960
|
tools: AGENT_TOOLS,
|
|
1363
1961
|
kind: { enum: ["agentic", "workflow", null], description: "The current revision's kind; null before the agent has one.", "x-agentrun-serve": "serve/1" },
|
|
1364
1962
|
revision: { type: ["string", "null"], description: "The current revision's id; null before the agent has one.", "x-agentrun-serve": "serve/1" },
|
|
@@ -1372,6 +1970,7 @@ const FIELD_EXTENSIONS = {
|
|
|
1372
1970
|
},
|
|
1373
1971
|
"x-agentrun-serve": "serve/1",
|
|
1374
1972
|
},
|
|
1973
|
+
warnings: { type: "array", items: ref("schemas/InputIssue"), description: "What this host still lacks for the agent to run, as a create (POST /agents) or a commit (PUT .../definition) answers it, the same shape apply's warnings take. Absent from every other answer (GET and list never send it).", "x-agentrun-serve": "warnings/1" },
|
|
1375
1974
|
},
|
|
1376
1975
|
Capabilities: {
|
|
1377
1976
|
learning: {
|
|
@@ -1386,10 +1985,9 @@ const FIELD_EXTENSIONS = {
|
|
|
1386
1985
|
"x-agentrun-serve": "learning/1",
|
|
1387
1986
|
},
|
|
1388
1987
|
places: {
|
|
1389
|
-
type: "object", additionalProperties: false, required: ["modes", "
|
|
1988
|
+
type: "object", additionalProperties: false, required: ["modes", "boxes", "allow"],
|
|
1390
1989
|
properties: {
|
|
1391
1990
|
modes: { type: "array", items: { enum: [...PLACE_MODES] } },
|
|
1392
|
-
default: { enum: [...PLACE_MODES], description: "Where a revision that names no place runs: `runner`. It stays `runner` because a revision saved with no place (an agent made before new agents were given a box, or where docker was unavailable, or a workflow) keeps running where it ran. What a NEW agent gets is `default_place`." },
|
|
1393
1991
|
boxes: { type: "array", items: { type: "object", additionalProperties: false, required: ["id", "available", "state"], properties: { id: { enum: [...BOX_IDS] }, available: { type: "boolean" }, state: { enum: [...BOX_STATES], description: "`ready`; `preparing`, available while the server builds (or pulls) the Docker box's image at its start (a sandbox run's first box waits for it, with a timeline row); `unavailable`, with the `reason`." }, reason: { type: "string", description: "Why the box is unavailable, or what a preparing one waits for. Docker is set up by default (AGENTRUN_BOXES not set), so docker's reason says first, in plain words, what is wrong on this machine, then what to do (`Docker isn't running on this machine (no docker command on PATH): install or start Docker, then restart AgentRun`); every other box AGENTRUN_BOXES does not list says the setting that lists it." }, network: { enum: [...BOX_NETWORKS], description: "What an available box reaches: `allowlist`, the hosts in `allow`, and nothing else (a Docker box through its egress proxy, on Linux with a daemon of that machine's own; a program that skips the proxy has no route; a Daytona box through Daytona's domain list, whose proxy re-signs TLS with Daytona's CA), or `none`. A Docker box's `none` comes with `network_reason`, and so does a Daytona box's when Daytona could not keep a list here (a tier that takes none); neither has one when AGENTRUN_BOX_ALLOW is `none`.", "x-agentrun-serve": "place/2" }, network_reason: { type: "string", description: "Why an available box has no network for a cause of its own, naming what the server found: a Docker in a VM, a daemon on another machine, docker info that did not answer; or a Daytona that could not keep its domain list.", "x-agentrun-serve": "place/2" } } } },
|
|
1394
1992
|
},
|
|
1395
1993
|
description: "The places a revision may name, this host's default, each box (whether this server has it, its state: ready, preparing or unavailable, and when not, why) and the hosts a box may reach.",
|
|
@@ -1398,7 +1996,7 @@ const FIELD_EXTENSIONS = {
|
|
|
1398
1996
|
harnesses: {
|
|
1399
1997
|
type: "array",
|
|
1400
1998
|
description: "Each harness a revision may name, and whether this server runs it; when not, why. A harness whose one run needs more memory than this server has for runs is unavailable, its reason naming the numbers, and its runs are 409 agent_not_runnable.",
|
|
1401
|
-
items: { type: "object", additionalProperties: false, required: ["id", "available", "steer", "default_model", "run_memory_mib", "max_concurrent_runs"], properties: { id: { enum: [...HARNESSES] }, available: { type: "boolean" }, run_memory_mib: { type: "integer", minimum: 1, description: "The memory a run of this harness reserves while its process lives, in MiB, measured. A start is admitted while the runs going and it fit in this server's memory less its own; over that, 429 rate_limited with retry-after, as over `limits.max_concurrent_runs`." }, max_concurrent_runs: { type: "integer", minimum: 0, description: "The most runs of this harness alone at once here: by memory and by the cap on the count, whichever is fewer. 0 when one never fits. `limits.max_concurrent_runs` is pi's, the smallest run." }, default_model: { type: ["string", "null"], description: "The model this server runs for the harness when a definition names none (provider/model-id), or null when it runs none: the harness does not run here, or no default model here runs on it." }, steer: { type: "boolean", description: "Whether a message sent while the run works lands mid-turn (`steer`); when false, it waits for the turn's end and the answer's mode is `follow_up`." }, reason: { type: "string" } } },
|
|
1999
|
+
items: { type: "object", additionalProperties: false, required: ["id", "available", "steer", "default_model", "run_memory_mib", "max_concurrent_runs"], properties: { id: { enum: [...HARNESSES] }, available: { type: "boolean" }, run_memory_mib: { type: "integer", minimum: 1, description: "The memory a run of this harness reserves while its process lives, in MiB, measured. A start is admitted while the runs going and it fit in this server's memory less its own; over that, 429 rate_limited with retry-after, as over `limits.max_concurrent_runs`." }, max_concurrent_runs: { type: "integer", minimum: 0, description: "The most runs of this harness alone at once here: by memory and by the cap on the count, whichever is fewer. 0 when one never fits. `limits.max_concurrent_runs` is pi's, the smallest run." }, default_model: { type: ["string", "null"], description: "The model this server runs for the harness when a definition names none (provider/model-id), or null when it runs none: the harness does not run here, or no default model here runs on it." }, steer: { type: "boolean", description: "Whether a message sent while the run works lands mid-turn (`steer`); when false, it waits for the turn's end and the answer's mode is `follow_up`." }, reason: { type: "string" }, installs: { const: "on_first_use", description: "claude-agent and codex only, while that harness's CLI is not installed in this server's data: it installs on first use. The first run on it, or the first agent saved on it, installs the version AgentRun pins (claude-agent: the Claude Agent SDK; codex: Codex) from npm into `<data>/harnesses/<harness>`, by the lock AgentRun ships, once (every run that needs it waits for that one install); a run shows a `phase` row, `Installing Claude Code (first use)…` or `Installing Codex (first use)…`, while it does. When npm fails the run fails, and its error names the command that installs it by hand. Absent once it is installed.", "x-agentrun-serve": "firstuse/1" } } },
|
|
1402
2000
|
// harness/2: each entry took on its memory and count (run_memory_mib, max_concurrent_runs). A client that validates
|
|
1403
2001
|
// against harness/1 refuses them, so it is a mark of its own.
|
|
1404
2002
|
"x-agentrun-serve": "harness/2",
|
|
@@ -1409,7 +2007,7 @@ const FIELD_EXTENSIONS = {
|
|
|
1409
2007
|
items: {
|
|
1410
2008
|
type: "object", additionalProperties: false, required: ["name", "summary", "nodes", "calls", "available", "harnesses", "permission", "default_permission", "permissions"],
|
|
1411
2009
|
properties: {
|
|
1412
|
-
name: { type: "string" }, summary: { type: "string" }, nodes: { type: "boolean" }, calls: { type: "boolean" }, call_only: { type: "boolean", description: "Only a workflow's call node runs it (pdf_pages, llm): no agentic revision or model node names it." }, sandbox_only: { type: "boolean", description: "Only an agent whose place is a sandbox names it (bash, and the background tools bash_background, bash_output, bash_input, bash_signal and bash_list): it runs in the box, and a runner has no shell." }, available: { type: "boolean" }, reason: { type: "string", description: "Why the tool is unavailable here, present whenever `available` is false: a provider pick's own words (`web_search is turned off in settings`, `parallel picked, no PARALLEL_API_KEY`), or `Needs` and the variables it is missing; for a sandbox-only tool (bash, the background tools) that no box this server has can run, `no box is set up on this server: …` with each box's own reason (`places.boxes`)." }, missing: { type: "array", items: { type: "string" } },
|
|
2010
|
+
name: { type: "string" }, summary: { type: "string" }, blurb: { type: "string", description: "One short line for people (the editor's Tools grid); the model never sees it. Absent for an MCP server's tool, and on an older server.", "x-agentrun-serve": "tool-blurb/1" }, nodes: { type: "boolean" }, calls: { type: "boolean" }, call_only: { type: "boolean", description: "Only a workflow's call node runs it (pdf_pages, llm): no agentic revision or model node names it." }, sandbox_only: { type: "boolean", description: "Only an agent whose place is a sandbox names it (bash, and the background tools bash_background, bash_output, bash_input, bash_signal and bash_list): it runs in the box, and a runner has no shell." }, available: { type: "boolean" }, reason: { type: "string", description: "Why the tool is unavailable here, present whenever `available` is false: a provider pick's own words (`web_search is turned off in settings`, `parallel picked, no PARALLEL_API_KEY`), or `Needs` and the variables it is missing; for a sandbox-only tool (bash, the background tools) that no box this server has can run, `no box is set up on this server: …` with each box's own reason (`places.boxes`)." }, missing: { type: "array", items: { type: "string" } },
|
|
1413
2011
|
harnesses: { type: "array", items: { enum: [...HARNESSES] }, description: "The harnesses that run the tool here; a revision naming it on another harness saves with a warning and its runs are 409 agent_not_runnable.", "x-agentrun-serve": "tool-harness/1" },
|
|
1414
2012
|
providers: { type: "array", items: { type: "string" }, description: "A tool with a provider choice: the providers offered for it, its default first.", "x-agentrun-serve": "providers/1" },
|
|
1415
2013
|
provider: { type: "string", description: "A tool with a provider choice: the server's, its default where it sets none.", "x-agentrun-serve": "providers/1" },
|
|
@@ -1438,7 +2036,7 @@ const FIELD_EXTENSIONS = {
|
|
|
1438
2036
|
type: "object", additionalProperties: false, required: ["disk", "host_owned", "max_file_bytes", "writes"],
|
|
1439
2037
|
properties: {
|
|
1440
2038
|
disk: { enum: ["local"], description: "Where the homes are: this server's disk, under its data directory." },
|
|
1441
|
-
host_owned: { type: "array", items: { type: "string" }, description: "The paths in a home only the server writes, never served here: each that is there is one entry of the list (`host_owned: true`), and a GET, PUT or DELETE at or under one, matched by its name folded (compatibility form, any case, no combining marks)
|
|
2039
|
+
host_owned: { type: "array", items: { type: "string" }, description: "The paths in a home only the server writes, never served here: each that is there is one entry of the list (`host_owned: true`), and a GET, PUT or DELETE at or under one, matched by its name folded (compatibility form, any case, no combining marks), is 403 `system_file_forbidden`." },
|
|
1442
2040
|
max_file_bytes: { type: "integer", minimum: 1, description: "The largest file a PUT takes: `limits.max_body_bytes`. Over it, 413 `payload_too_large` naming `max_body_bytes`." },
|
|
1443
2041
|
writes: { type: "boolean", description: "Whether PUT and DELETE write a home's files here. True only where this server reaches its held directory handles through /proc/self/fd (Linux), probed once at start, the probe its confinement walks by; false elsewhere (macOS), where both answer 501 `unsupported_here` and nothing is written or removed. The list and reads work either way." },
|
|
1444
2042
|
},
|
|
@@ -1453,15 +2051,16 @@ const FIELD_EXTENSIONS = {
|
|
|
1453
2051
|
},
|
|
1454
2052
|
},
|
|
1455
2053
|
// decisions/2: the providers took on parallel (and, here, openrouter). A client that validates against decisions/1 refuses it, so the
|
|
1456
|
-
// widening is a mark of its own.
|
|
2054
|
+
// widening is a mark of its own. decisions/3: a provider takes `route` (parallel's, on Parallel's API or OpenRouter), which a
|
|
2055
|
+
// client that validates against decisions/2 refuses.
|
|
1457
2056
|
"Capabilities/places": {
|
|
1458
2057
|
default_place: {
|
|
1459
2058
|
oneOf: [
|
|
1460
2059
|
{ type: "object", additionalProperties: false, required: ["mode"], properties: { mode: { const: "runner" } } },
|
|
1461
2060
|
{ type: "object", additionalProperties: false, required: ["mode", "box"], properties: { mode: { const: "sandbox" }, box: { enum: [...BOX_IDS] } } },
|
|
1462
2061
|
],
|
|
1463
|
-
description: "The place a NEW agentic agent that names none is saved with, written on its revision at its create: the Docker box (`{\"mode\": \"sandbox\", \"box\": \"docker\"}`) where this server has docker, ready or preparing (its first run waits for the image, with a timeline row), with tools [\"bash\"] when the definition names no tools; else the runner, with `default_reason`. It is
|
|
1464
|
-
"x-agentrun-serve": "place/
|
|
2062
|
+
description: "The place a NEW agentic agent that names none is saved with, written on its revision at its create: the Docker box (`{\"mode\": \"sandbox\", \"box\": \"docker\"}`) where this server has docker, ready or preparing (its first run waits for the image, with a timeline row), with tools [\"bash\", \"bash_background\", \"bash_output\", \"bash_input\", \"bash_signal\", \"bash_list\"] when the definition names no tools; else the runner, with `default_reason`. It is also where an agentic revision saved with no place runs, resolved at each run: a workflow, and a revision that names a tool a box refuses, run on the runner. (It replaces `places.default`, which said `runner`.)",
|
|
2063
|
+
"x-agentrun-serve": "place/4",
|
|
1465
2064
|
},
|
|
1466
2065
|
default_reason: { type: "string", description: "Why a new agent is not given a box here, when `default_place` is the runner, in docker's own words: `new agents run on the runner, because the docker box is unavailable here: <docker's reason>`, such as `Docker isn't running on this machine (no docker command on PATH): install or start Docker, then restart AgentRun`, or, with AGENTRUN_BOXES set to a list without docker, empty or `none`, the setting that turns it on.", "x-agentrun-serve": "place/3" },
|
|
1467
2066
|
allow: { type: "array", items: { type: "string" }, description: "The hosts a box whose `network` is `allowlist` may reach: AGENTRUN_BOX_ALLOW's, else the package registries and GitHub; empty when it is `none`.", "x-agentrun-serve": "place/2" },
|
|
@@ -1471,9 +2070,9 @@ const FIELD_EXTENSIONS = {
|
|
|
1471
2070
|
type: "object", additionalProperties: false, required: ["providers"],
|
|
1472
2071
|
description: "The decision providers a workflow's typed questions (judge, pick, sift, route, ask) run on, and whether this server runs each: when not, why (`reason`); when it runs in a way an operator should know of, a `note`. `runJudge` is among `adapters` once one runs.",
|
|
1473
2072
|
properties: {
|
|
1474
|
-
providers: { type: "array", items: { type: "object", additionalProperties: false, required: ["id", "available"], properties: { id: { enum: ["jev", "parallel", "openrouter"] }, available: { type: "boolean" }, reason: { type: "string" }, note: { type: "string" } } } },
|
|
2073
|
+
providers: { type: "array", items: { type: "object", additionalProperties: false, required: ["id", "available"], properties: { id: { enum: ["jev", "parallel", "openrouter"] }, available: { type: "boolean" }, reason: { type: "string" }, note: { type: "string" }, route: { enum: ["parallel", "openrouter"], description: "parallel's route here: Parallel's own API (PARALLEL_API_KEY), else Parallel's model on OpenRouter (parallel/decisions-fast, on the OpenRouter key)." } } } },
|
|
1475
2074
|
},
|
|
1476
|
-
"x-agentrun-serve": "decisions/
|
|
2075
|
+
"x-agentrun-serve": "decisions/3",
|
|
1477
2076
|
},
|
|
1478
2077
|
},
|
|
1479
2078
|
"Capabilities/models": {
|
|
@@ -1482,6 +2081,7 @@ const FIELD_EXTENSIONS = {
|
|
|
1482
2081
|
route_prefix: { type: ["string", "null"], description: "With `source` `gateway`, the routing prefix this server puts before the gateway's model ids (`agent-model`): every tier's model and every harness's `default_model` here is the prefix, a slash and the gateway's own id. Null with any other source, where ids are shown whole.", "x-agentrun-serve": "model/2" },
|
|
1483
2082
|
ready: { type: "boolean", description: "Whether a revision that names no model runs here: the host names a default (`AGENT_MODEL`), or a model provider's key is here, saved (`PUT /settings/tool-keys/{key_id}`, a `model` key) or the server's own, and gives its default model, the first of anthropic, openai, openrouter that has one.", "x-agentrun-serve": "toolkeys/1" },
|
|
1484
2083
|
needs: { enum: ["key", "model", null], description: "When `ready` is false, what would make it true: `key`, a model provider's key (none is here, or the default model's provider has none); `model`, another default model (`AGENT_MODEL` names one this server does not know). Null when ready.", "x-agentrun-serve": "toolkeys/1" },
|
|
2084
|
+
priced: { type: ["boolean", "null"], description: "Whether that model has a price here, which a run's `max_cost_usd` needs: false for a gateway model (`source` `gateway`) with no `AGENT_MODEL_PRICE` that pi-ai's catalog does not list in any form, whose answers' cost is unknown; a run with `max_cost_usd` on it is refused (409 agent_not_runnable, on `definition.model`), and one without runs with its cost unknown, never $0. Null while `ready` is false: no model, nothing to price.", "x-agentrun-serve": "pricing/1" },
|
|
1485
2085
|
},
|
|
1486
2086
|
Features: {
|
|
1487
2087
|
archive: {
|
|
@@ -1492,28 +2092,44 @@ const FIELD_EXTENSIONS = {
|
|
|
1492
2092
|
},
|
|
1493
2093
|
thinking: { type: "array", items: { type: "string" }, description: "The thinking levels an agentic revision may name.", "x-agentrun-serve": "serve/1" },
|
|
1494
2094
|
learning: { enum: [...LEARNING_MODES], description: "This server's learning switch (`--learning`): `on`, a run of an agent whose definition says `learning: true` starts from what its agent learned and adds to it; `off`, no run this server starts does, whatever its agent says, and its `learning` is null.", "x-agentrun-serve": "learning/1" },
|
|
2095
|
+
browser_live: {
|
|
2096
|
+
type: "object", additionalProperties: false, required: ["read_only", "take_over", "ask"],
|
|
2097
|
+
properties: {
|
|
2098
|
+
read_only: { type: "boolean", description: "The viewer watches and never drives. False here: it drives after Take over." },
|
|
2099
|
+
take_over: { type: "boolean", description: "The viewer's Take over holds the browser for the owner until they hand it back, the viewer is gone 2 minutes, or 15 minutes pass with no input; outside a hold its input is dropped by the run. The agent's browser calls wait meanwhile and are then told the person had the browser; the run stays working. The owner's time is held under the run's cap first (15 minutes at the provider's price), and again every 15 minutes while input keeps the take-over alive: with no room, Take over is refused, or the browser goes back to the agent, in the cap's words." },
|
|
2100
|
+
ask: { type: "boolean", description: "The agent may ask for the owner in its browser: the run waits (pending.kind browser) until POST /runs/{run_id}/browser/hand-back answers or 15 minutes pass." },
|
|
2101
|
+
},
|
|
2102
|
+
description: "The owner watches a run's browser live from the console (GET /runs/{run_id}/browser), takes it over and hands it back.",
|
|
2103
|
+
"x-agentrun-serve": "liveview/2",
|
|
2104
|
+
},
|
|
2105
|
+
computers: {
|
|
2106
|
+
type: "object", additionalProperties: false, required: ["kinds"],
|
|
2107
|
+
properties: { kinds: { type: "array", items: COMPUTER_KIND, description: "The kinds of computer this server offers now (GET /computers says why another is not)." } },
|
|
2108
|
+
description: "Settings → Computers: the computer kinds an agent's `computer` may name here.",
|
|
2109
|
+
...COMPUTER_MARK,
|
|
2110
|
+
},
|
|
1495
2111
|
tool_keys: {
|
|
1496
2112
|
type: "object", additionalProperties: false, required: ["routes", "at_rest"],
|
|
1497
|
-
properties: { routes: { type: "boolean" }, at_rest: {
|
|
1498
|
-
description: "GET, PUT and DELETE /settings/tool-keys: a tool's key saved by name, kept `sealed` under the seal key
|
|
2113
|
+
properties: { routes: { type: "boolean" }, at_rest: { const: "sealed" } },
|
|
2114
|
+
description: "GET, PUT and DELETE /settings/tool-keys: a tool's key saved by name, kept `sealed` under the server's seal key, which it always has (handed, or made at its first start).",
|
|
1499
2115
|
"x-agentrun-serve": "toolkeys/1",
|
|
1500
2116
|
},
|
|
1501
2117
|
mcp_client: {
|
|
1502
|
-
type: "object", additionalProperties: false, required: ["
|
|
1503
|
-
properties: {
|
|
1504
|
-
description: "/settings/mcp-servers: remote MCP servers over Streamable HTTP, previewed and saved with the auth types listed; a credential kept `sealed` under the seal key
|
|
2118
|
+
type: "object", additionalProperties: false, required: ["transports", "auth", "at_rest", "harnesses"],
|
|
2119
|
+
properties: { transports: { type: "array", items: { const: "streamable-http" } }, auth: { type: "array", items: { enum: [...MCP_AUTH_TYPES] } }, at_rest: { const: "sealed" }, harnesses: { type: "array", items: { type: "string" }, description: "The harnesses whose agents call a saved server's tools, each granted as mcp:<server>/<tool> in definition.tools." } },
|
|
2120
|
+
description: "/settings/mcp-servers: remote MCP servers over Streamable HTTP, previewed and saved with the auth types listed; a credential kept `sealed` under the server's seal key, which always exists.",
|
|
1505
2121
|
"x-agentrun-serve": "mcpservers/1",
|
|
1506
2122
|
},
|
|
1507
2123
|
tool_permissions: { type: "boolean", description: "Whether a tool setting may carry a permission (allow, ask, deny), which the tool gate holds every tool call to.", "x-agentrun-serve": "providers/1" },
|
|
1508
2124
|
webhooks: {
|
|
1509
2125
|
type: "object", additionalProperties: false, required: ["routes", "events", "signing", "at_rest"],
|
|
1510
|
-
properties: { routes: { type: "boolean" }, events: { type: "array", items: { enum: [...WEBHOOK_EVENTS] } }, signing: { const: "standard-webhooks/v1" }, at_rest: {
|
|
2126
|
+
properties: { routes: { type: "boolean" }, events: { type: "array", items: { enum: [...WEBHOOK_EVENTS] } }, signing: { const: "standard-webhooks/v1" }, at_rest: { const: "sealed" } },
|
|
1511
2127
|
description: "/settings/webhook: one URL each of `events` is POSTed to, signed by the Standard Webhooks spec; its secret kept `sealed` under the seal key the server was handed, `unavailable` with none, when no webhook is set.",
|
|
1512
2128
|
"x-agentrun-serve": "webhook/1",
|
|
1513
2129
|
},
|
|
1514
2130
|
triggers: {
|
|
1515
|
-
...closed({ routes: { type: "boolean" }, sources: { type: "array", items: { enum: [...SOURCE_KINDS] } }, targets: { type: "array", items: { enum: [...TARGET_KINDS] } },
|
|
1516
|
-
description: "/triggers: schedules that start an agent's capped runs: the source and target kinds this server takes,
|
|
2131
|
+
...closed({ routes: { type: "boolean" }, sources: { type: "array", items: { enum: [...SOURCE_KINDS] } }, targets: { type: "array", items: { enum: [...TARGET_KINDS] } }, min_every_s: { type: "integer" }, history_kept: { type: "integer" }, catchup_window_s: { type: "integer" }, failures_to_pause: { type: "integer" }, webhook: closed({ signing: { const: "standard-webhooks/v1" }, signatures: { type: "array", items: { enum: [...SCHEME_NAMES] }, description: "The signature schemes a webhook trigger's `signature` may name." }, tolerance_s: { type: "integer" }, max_body_bytes: { type: "integer" }, payload_kept_bytes: { type: "integer" }, at_rest: { const: "sealed" } }) }),
|
|
2132
|
+
description: "/triggers: schedules and signed webhooks that start an agent's capped runs or message a run: the source and target kinds this server takes, the shortest interval, how many firings each trigger keeps, the default catch-up window, and how many failed firings in a row turn a trigger off.",
|
|
1517
2133
|
...TRIGGER_MARK,
|
|
1518
2134
|
},
|
|
1519
2135
|
},
|
|
@@ -1537,10 +2153,11 @@ const BLOCKED_DETAILS = {
|
|
|
1537
2153
|
denied: { type: "array", items: { type: "string" }, description: "A workflow revision: the tools its call nodes call that are set to deny here." },
|
|
1538
2154
|
asks: { type: "array", items: { type: "string" }, description: "A workflow revision: the tools its call nodes call that are set to ask here (a catalog tool's default among them). A call node cannot wait for an approval: set the tool to allow for the agent." },
|
|
1539
2155
|
box: { enum: [...BOX_IDS], description: "The box of the revision's place, when this server does not have it (capabilities.places.boxes)." },
|
|
2156
|
+
not_grantable: { type: "array", items: { type: "object", additionalProperties: false, required: ["tool", "reason"], properties: { tool: { type: "string" }, reason: { type: "string" } } }, description: "The MCP tools the revision grants that are never granted here (known meta tools, which run other actions by name), each with why. Not in `unbound`: no server setup makes one grantable; remove the grant and use the server's direct tools." },
|
|
1540
2157
|
adapters: { type: "array", items: { type: "string" }, description: "A workflow revision: the adapters it needs that this server does not bind." },
|
|
1541
2158
|
code: { type: "boolean", description: "A workflow revision: whether it needs code this server does not run." },
|
|
1542
2159
|
tier: { type: "string", description: "A workflow revision: the model tier this host has no model for." },
|
|
1543
|
-
decisions: { type: "object", description: "A workflow revision: each decision provider it needs that this host has not set up, with why and the
|
|
2160
|
+
decisions: { type: "object", description: "A workflow revision: each decision provider it needs that this host has not set up, with why and the keys that would set it up.", additionalProperties: { type: "object", additionalProperties: false, required: ["reason", "needs"], properties: { reason: { type: "string" }, needs: { type: "array", items: { type: "string" }, description: "The variables that would set the provider up. Where it has more than one route, either key is enough (parallel: PARALLEL_API_KEY or OPENROUTER_API_KEY)." } } } },
|
|
1544
2161
|
},
|
|
1545
2162
|
};
|
|
1546
2163
|
const ARCHIVED_DETAILS = {
|
|
@@ -1560,7 +2177,84 @@ function contract() {
|
|
|
1560
2177
|
}
|
|
1561
2178
|
/** The document: the contract, its operations this server turns off marked with why (`capabilityOf` gives an
|
|
1562
2179
|
* operation's capability here, by its operationId), and this server's own routes added and marked. */
|
|
1563
|
-
|
|
2180
|
+
/** A working request body for each operation a client most often writes by hand, by operationId: served as its media type's
|
|
2181
|
+
* examples, printed by the CLI's help as a `--body`, and sent to the server by a test, so none can stop working. The run
|
|
2182
|
+
* and the trigger name the agent the first one makes. */
|
|
2183
|
+
export const REQUEST_EXAMPLES = {
|
|
2184
|
+
createAgent: {
|
|
2185
|
+
agentic: {
|
|
2186
|
+
summary: "An agent that researches a company on the web",
|
|
2187
|
+
value: { definition: { id: "due-diligence", name: "Due diligence", instructions: "Research the company you are given on the web and write a short brief: what it does, who runs it, red flags, and the sources you read.", tools: ["web_search", "web_fetch"] } },
|
|
2188
|
+
},
|
|
2189
|
+
},
|
|
2190
|
+
createRun: {
|
|
2191
|
+
agentic: { summary: "An agentic agent's run, capped at $1", value: { input: { content: "Research https://stripe.com and write the brief." }, max_cost_usd: 1 } },
|
|
2192
|
+
},
|
|
2193
|
+
createInlineRun: {
|
|
2194
|
+
agentic: {
|
|
2195
|
+
summary: "A run, capped at $1, of version 3 of an agent another system owns, given inline",
|
|
2196
|
+
value: {
|
|
2197
|
+
external: { source: "grep", kind: "expert", id: "due-diligence", version: 3 },
|
|
2198
|
+
definition: { name: "Due diligence", instructions: "Research the company you are given on the web and write a short brief: what it does, who runs it, red flags, and the sources you read.", tools: ["web_search", "web_fetch"] },
|
|
2199
|
+
input: { content: "Research https://stripe.com and write the brief." },
|
|
2200
|
+
max_cost_usd: 1,
|
|
2201
|
+
},
|
|
2202
|
+
},
|
|
2203
|
+
},
|
|
2204
|
+
createTrigger: {
|
|
2205
|
+
schedule: {
|
|
2206
|
+
summary: "A capped run of an agent every Monday at 09:00 UTC",
|
|
2207
|
+
value: { name: "Weekly brief", source: { kind: "schedule", cron: "0 9 * * 1" }, target: { kind: "start_run", agent_id: "due-diligence", input: { content: "Research https://stripe.com again and say what changed this week." }, max_cost_usd: 1 } },
|
|
2208
|
+
},
|
|
2209
|
+
},
|
|
2210
|
+
};
|
|
2211
|
+
/** `doc` with every source schema and firing `by` the registry gives made `adapters'`, and a hook path for each pushed
|
|
2212
|
+
* source whose settings are the server's: a server given other sources (a test's) documents its own. */
|
|
2213
|
+
function withAdapters(doc, adapters) {
|
|
2214
|
+
const [source, sent, by] = [JSON.stringify(TRIGGER_SOURCE), JSON.stringify(TRIGGER_SOURCE_SENT), JSON.stringify(firedByOf(TRIGGER_ADAPTERS))];
|
|
2215
|
+
const walk = (value) => {
|
|
2216
|
+
if (Array.isArray(value))
|
|
2217
|
+
return value.map(walk);
|
|
2218
|
+
if (!value || typeof value !== "object")
|
|
2219
|
+
return value;
|
|
2220
|
+
const text = JSON.stringify(value);
|
|
2221
|
+
if (text === source)
|
|
2222
|
+
return sourceSchemaOf(adapters);
|
|
2223
|
+
if (text === sent)
|
|
2224
|
+
return sentOf(adapters);
|
|
2225
|
+
if (text === by)
|
|
2226
|
+
return firedByOf(adapters);
|
|
2227
|
+
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, walk(v)]));
|
|
2228
|
+
};
|
|
2229
|
+
doc.paths = walk(doc.paths);
|
|
2230
|
+
}
|
|
2231
|
+
/** POST /hooks/{source}, for each pushed source of `adapters` whose settings are the server's (push-handler.ts): its own
|
|
2232
|
+
* check, its own body limit, and the firings its events made. */
|
|
2233
|
+
function serverHooks(adapters) {
|
|
2234
|
+
const paths = {};
|
|
2235
|
+
for (const adapter of adapters) {
|
|
2236
|
+
const push = adapter.push;
|
|
2237
|
+
if (!push || adapter.settings?.scope !== "server")
|
|
2238
|
+
continue;
|
|
2239
|
+
const handshake = push.handshake ? " A handshake its sender asks for (a URL check) is answered as the source answers it, after the check, never before." : "";
|
|
2240
|
+
// Its firings name the sources the server has, its own among them.
|
|
2241
|
+
const made = hookFiringsOf(adapters);
|
|
2242
|
+
paths[`/hooks/${adapter.id}`] = {
|
|
2243
|
+
post: {
|
|
2244
|
+
operationId: `receiveHook_${adapter.id}`, tags: ["local"], summary: `Fire a ${adapter.label}: a request it checks, no token`,
|
|
2245
|
+
description: `A pushed source's own route, with no token: the request is checked by the source's own check against its settings' \`${push.key}\` (the server's, PUT through its settings), on the raw body before anything else. The body is at most ${push.maxBodyBytes} bytes (413 at once past it, the socket closed) and arrives within ${HOOK_BODY_MS / 1000} s (408). Every refusal is the same 401. Each event the request holds fires the one trigger of this source that listens where it happened; an event no trigger takes, and a request with none, is answered 200 with no firing for it, and said in the server's log.${handshake}`,
|
|
2246
|
+
security: [],
|
|
2247
|
+
requestBody: { required: true, content: { "*/*": { schema: {} } } },
|
|
2248
|
+
// A handshake's answer is any object but a firings one or the ignored answer, so each answer is exactly one of the
|
|
2249
|
+
// 200's shapes, and a handshake of the source's own, {ok: true} say, is one.
|
|
2250
|
+
responses: { "202": json(made, "Recorded: each firing's run starts (or its message goes) after this answer."), "200": json(push.handshake ? { oneOf: [made, HOOK_IGNORED, { type: "object", not: { anyOf: [{ required: ["firings"] }, HOOK_IGNORED] }, description: "The source's handshake answer." }] } : { oneOf: [made, HOOK_IGNORED] }, "Nothing new: each event's firing as it stands (a key seen within its day whose firing is no longer kept, `{ok: \"duplicate\"}`), or none; or `{ok: \"ignored\"}`, a request the source's own filter does not take."), "408": HOOK_TIMEOUT, ...errors(401, 413, 429, 500, 503) },
|
|
2251
|
+
...TRIGGER_MARK,
|
|
2252
|
+
},
|
|
2253
|
+
};
|
|
2254
|
+
}
|
|
2255
|
+
return paths;
|
|
2256
|
+
}
|
|
2257
|
+
export function openapiDocument(capabilityOf, adapters = TRIGGER_ADAPTERS) {
|
|
1564
2258
|
const doc = structuredClone(contract());
|
|
1565
2259
|
const unsupported = [];
|
|
1566
2260
|
for (const [path, item] of Object.entries(doc.paths)) {
|
|
@@ -1579,6 +2273,8 @@ export function openapiDocument(capabilityOf) {
|
|
|
1579
2273
|
"x-agentrun-serve": "learning/2",
|
|
1580
2274
|
};
|
|
1581
2275
|
const schemas = doc.components.schemas;
|
|
2276
|
+
// The one shape every secret's view answers (secret-writes.ts secretMeta): a component each plane's view refers to.
|
|
2277
|
+
schemas.SecretMeta = structuredClone(SECRET_META_SCHEMA);
|
|
1582
2278
|
const fields = [];
|
|
1583
2279
|
for (const [where, added] of Object.entries(FIELD_EXTENSIONS)) {
|
|
1584
2280
|
const [name, ...down] = where.split("/");
|
|
@@ -1590,6 +2286,30 @@ export function openapiDocument(capabilityOf) {
|
|
|
1590
2286
|
fields.push([name, ...down, field].join("."));
|
|
1591
2287
|
}
|
|
1592
2288
|
}
|
|
2289
|
+
// inlineagent/1: POST /runs' body, the run fields of POST /agents/{agent_id}/runs (RunCreate, as extended above) but a
|
|
2290
|
+
// pinned revision, with the agent given inline as POST /agents takes one and its reference in the system that owns it.
|
|
2291
|
+
const runCreate = schemas.RunCreate;
|
|
2292
|
+
const agentCreate = schemas.AgentCreate;
|
|
2293
|
+
const { revision: _pinned, ...runFields } = runCreate.properties;
|
|
2294
|
+
schemas.ExternalRef = { ...EXTERNAL_REF, "x-agentrun-serve": "inlineagent/1" };
|
|
2295
|
+
schemas.RunCreateInline = {
|
|
2296
|
+
type: "object", additionalProperties: false, required: ["external", "definition", "input"],
|
|
2297
|
+
description: "A run of an agent another system owns, given inline (POST /runs): POST /agents/{agent_id}/runs' run fields, with the agent as POST /agents takes it and its reference in its source.",
|
|
2298
|
+
properties: {
|
|
2299
|
+
external: ref("schemas/ExternalRef"),
|
|
2300
|
+
definition: { ...agentCreate.properties.definition, description: "The agent's definition as POST /agents takes one, checked as it checks one (its 422s name `definition.<field>`), but its `id` (this server's, one per external reference) and its `version` (`external.version`), which it does not take." },
|
|
2301
|
+
...(agentCreate.properties.skills ? { skills: agentCreate.properties.skills } : {}),
|
|
2302
|
+
...(agentCreate.properties.note ? { note: { ...agentCreate.properties.note, description: "What the version changes, kept with its revision by the version's first run (GET /agents/{agent_id}/revisions); not part of its definition." } } : {}),
|
|
2303
|
+
...runFields,
|
|
2304
|
+
},
|
|
2305
|
+
"x-agentrun-serve": "inlineagent/1",
|
|
2306
|
+
};
|
|
2307
|
+
// This server's own run fields it always sends, on a run and in a list (runs.ts view and summary): required with the
|
|
2308
|
+
// contract's, so a client may read them as there.
|
|
2309
|
+
for (const name of ["Run", "RunSummary"]) {
|
|
2310
|
+
const schema = schemas[name];
|
|
2311
|
+
schema.required = [...schema.required, ...RUN_FIELDS_SENT];
|
|
2312
|
+
}
|
|
1593
2313
|
// The contract's definition fields this server refuses (validate.ts), each marked with the reason its 422 gives.
|
|
1594
2314
|
const definition = schemas.DefinitionInput;
|
|
1595
2315
|
const refused = [];
|
|
@@ -1600,11 +2320,25 @@ export function openapiDocument(capabilityOf) {
|
|
|
1600
2320
|
refused.push(`DefinitionInput.${field}`);
|
|
1601
2321
|
}
|
|
1602
2322
|
// A contract field this server takes with a meaning of its own, said on it.
|
|
1603
|
-
definition.properties.max_cost_usd = { ...definition.properties.max_cost_usd, "x-agentrun-serve-note": "The agent's default cap of each run started without a max_cost_usd of its own (a run's own wins), kept with its revision: above 0 sets it, 0 clears it (no default), and an edit that leaves the field out keeps the agent's, so leaving a field out never removes a spend limit. An agentic definition
|
|
2323
|
+
definition.properties.max_cost_usd = { ...definition.properties.max_cost_usd, "x-agentrun-serve-note": "The agent's default cap of each run started without a max_cost_usd of its own (a run's own wins), kept with its revision: above 0 sets it, 0 clears it (no default), and an edit that leaves the field out keeps the agent's, so leaving a field out never removes a spend limit. An agentic definition's or a workflow's alike." };
|
|
2324
|
+
// instructions XOR workflow (validate.ts): a workflow revision has none. version, skills and tools: this server
|
|
2325
|
+
// mints or keeps them when a write leaves them out (agents.ts definitionOf), so none of the four is required of a
|
|
2326
|
+
// write; only instructions ever misses from an answer (a workflow revision's), so Definition keeps the rest required.
|
|
2327
|
+
definition.properties.instructions = { ...definition.properties.instructions, "x-agentrun-serve-note": "An agentic revision's own: this or `workflow`, not both. Neither is 422 `definition.instructions` `missing`; both is 422 `definition.workflow` `not_allowed`. Absent on a workflow revision's own answer." };
|
|
2328
|
+
definition.properties.workflow = { ...definition.properties.workflow, "x-agentrun-serve-note": "A workflow revision's own, in place of `instructions`: see `instructions` for the 422s either's absence or both's presence gives." };
|
|
2329
|
+
definition.properties.version = { ...definition.properties.version, "x-agentrun-serve-note": "Absent on a create: this server mints 1. This contract's own `PUT .../definition` body (not this server's own `{definition, skills?, note?}` form) requires it, greater than the current revision's; left out there, or not greater, is 422 `definition.version`. Always sent on an answer." };
|
|
2330
|
+
definition.properties.skills = { ...definition.properties.skills, "x-agentrun-serve-note": "Absent: none. Always sent on an answer (`[]` when the revision names none)." };
|
|
2331
|
+
definition.properties.tools = { ...definition.properties.tools, "x-agentrun-serve-note": "Absent: none. Always sent on an answer (`[]` when the revision grants none)." };
|
|
2332
|
+
definition.required = definition.required.filter((field) => !DEFINITION_INPUT_OPTIONAL.includes(field));
|
|
2333
|
+
const definitionRead = schemas.Definition;
|
|
2334
|
+
definitionRead.required = definitionRead.required.filter((field) => !DEFINITION_OPTIONAL.includes(field));
|
|
1604
2335
|
// A row's usage: the contract's shape, on more rows here than the usage row (pi-durable-agent's timeline, BROWSER_CHARGE).
|
|
1605
2336
|
const timelineRow = schemas.TimelineRow;
|
|
1606
2337
|
timelineRow.properties.usage = { ...timelineRow.properties.usage, "x-agentrun-serve-note": "On the `usage` row, the run's cost so far. On a paid tool's charge row (a `phase` row, \"Tool cost: monid charged $0.0030 for monid.run\", `tool_name` the tool, `tool_use_id` the call), that charge alone. On a browser call's `tool_use` row (`tool_name` one of the browser's tools: snapshot, run, browser_read, ...), the browser session time booked under that call: what the session ran since its last charge, and, on the session's last call, its release's charge topped up to the provider's minimum. A browser charge has no row of its own. A charge booked after the row was served (a release after the answer) is served as a change of that row, with the same `id` and its new `usage`. `requests` is 0 on every row but the usage row; `usd` is null once a charge on the row has no price, with `so_far_usd` and `unpriced` saying what is known. The run's cost counts each charge once, wherever it shows: summing every row's `usage` but the usage row's gives what its paid tools charged." };
|
|
1607
|
-
|
|
2338
|
+
// ErrorBody.fields beyond `input_invalid`: a 409 agent_not_runnable names each thing that keeps the run from starting.
|
|
2339
|
+
const errorBody = schemas.ErrorBody;
|
|
2340
|
+
errorBody.properties.fields = { ...errorBody.properties.fields, "x-agentrun-serve-note": "Also on `agent_not_runnable` (409) here: each thing that keeps the run from starting, by the field it is about, its reason, its message and the fix when there is one (such as AGENT_MODEL_PRICE for a capped run on a model with no price), as a 422 names each field." };
|
|
2341
|
+
const noted = ["DefinitionInput.max_cost_usd", "DefinitionInput.instructions", "DefinitionInput.workflow", "DefinitionInput.version", "DefinitionInput.skills", "DefinitionInput.tools", "TimelineRow.usage", "ErrorBody.fields"];
|
|
1608
2342
|
// PUT .../definition takes the contract's body (the definition itself) or this server's own, POST /agents' body with a
|
|
1609
2343
|
// note: exactly one, as only this server's holds `definition` and both are closed. If-Match is the contract's
|
|
1610
2344
|
// precondition for its body; this server's own body may leave it out.
|
|
@@ -1630,6 +2364,19 @@ export function openapiDocument(capabilityOf) {
|
|
|
1630
2364
|
timeline.parameters = [...timeline.parameters, { name: "limit", in: "query", required: false, description: "At most this many rows in a page (1 to 500, default 500); has_more says when another waits.", schema: { type: "integer", minimum: 1, maximum: 500, default: 500 } }];
|
|
1631
2365
|
timeline["x-agentrun-serve-changed"] = { limit: "timelinelimit/1" };
|
|
1632
2366
|
changed.push("GET /runs/{run_id}/timeline");
|
|
2367
|
+
// GET /agents also takes `archived`, as GET /runs already does (server.ts archivedParam, shared by both routes):
|
|
2368
|
+
// true lists only archived agents, false (the default) the others.
|
|
2369
|
+
const listAgents = doc.paths["/agents"].get;
|
|
2370
|
+
listAgents.parameters = [...listAgents.parameters, { name: "archived", in: "query", required: false, description: "true lists only archived agents; false, the default, the others.", schema: { type: "boolean" } }];
|
|
2371
|
+
listAgents["x-agentrun-serve-changed"] = { archived: "archivedparam/1" };
|
|
2372
|
+
changed.push("GET /agents");
|
|
2373
|
+
// GET /agents/{agent_id} always sends the agent's `tools` (server.ts getAgent; [] before it has a revision), which the
|
|
2374
|
+
// agent in a list, a create or a save does not: its 200 is the contract's Agent with `tools` required.
|
|
2375
|
+
const getAgent = doc.paths["/agents/{agent_id}"].get;
|
|
2376
|
+
const agentAnswer = getAgent.responses["200"].content["application/json"];
|
|
2377
|
+
agentAnswer.schema = { allOf: [agentAnswer.schema, { type: "object", required: ["tools"], properties: { tools: AGENT_TOOLS } }] };
|
|
2378
|
+
getAgent["x-agentrun-serve-changed"] = { responses: "agenttools/1" };
|
|
2379
|
+
changed.push("GET /agents/{agent_id}");
|
|
1633
2380
|
// upload/2: POST /files also takes a file's bytes in one call (`path` in the query, the bytes the body), answered as
|
|
1634
2381
|
// a reservation is with the file ready; and `upload.url` is a path from the server's root, `/v2/files/{file_id}`.
|
|
1635
2382
|
const createFile = doc.paths["/files"].post;
|
|
@@ -1646,6 +2393,16 @@ export function openapiDocument(capabilityOf) {
|
|
|
1646
2393
|
createFile.responses["415"] = ref("responses/UnsupportedMediaType");
|
|
1647
2394
|
createFile["x-agentrun-serve-changed"] = { requestBody: "upload/2", parameters: "upload/2", responses: "upload/2" };
|
|
1648
2395
|
changed.push("POST /files");
|
|
2396
|
+
// A hidden run's files are refused, as its graph is: 403 forbidden while the server can't read its browser sign-in.
|
|
2397
|
+
for (const path of ["/runs/{run_id}/files", "/runs/{run_id}/files/{path}"]) {
|
|
2398
|
+
const files = doc.paths[path].get;
|
|
2399
|
+
files.description = `${String(files.description ?? "").trimEnd()}\nHere \`403 forbidden\` while this server can't read the browser sign-in the run was handed (its seal key changed or is missing): a page it saved signed in holds what it saw there, so none of its files is listed or read until the sign-in opens again.\n`;
|
|
2400
|
+
const added = files.responses["403"] === undefined;
|
|
2401
|
+
if (added)
|
|
2402
|
+
files.responses["403"] = ref("responses/Forbidden");
|
|
2403
|
+
files["x-agentrun-serve-changed"] = { description: "signins/1", ...(added ? { responses: "signins/1" } : {}) };
|
|
2404
|
+
changed.push(`GET ${path}`);
|
|
2405
|
+
}
|
|
1649
2406
|
// An agentic run's cancel is its end at once: the 202 reads `cancelled`, and no later end of its turn moves it.
|
|
1650
2407
|
const cancel = doc.paths["/runs/{run_id}/cancel"].post;
|
|
1651
2408
|
cancel.description = `${String(cancel.description).trimEnd()}\nHere an agentic run reads \`cancelled\` from the 202 on, \`final\` once it has stopped: a run's first terminal status is its last, so nothing its cut turn writes later (an answer, a cost over its cap) moves it. A workflow run reads \`cancelled\` once its workflow has stopped.\n`;
|
|
@@ -1691,6 +2448,19 @@ export function openapiDocument(capabilityOf) {
|
|
|
1691
2448
|
fields.push("SignIn.else");
|
|
1692
2449
|
}
|
|
1693
2450
|
}
|
|
2451
|
+
// secrets/1: each saved sign-in carries its one secret under `secret`, in the secret metadata shape every plane gives
|
|
2452
|
+
// (sign-ins-secrets.ts), always sent: named sign-in:<agent_id>:<provider>, set, from a sign-in, changed when its pointer
|
|
2453
|
+
// was saved. Never the pointer.
|
|
2454
|
+
const signInSchema = schemas.SignIn;
|
|
2455
|
+
if (signInSchema.properties.secret === undefined) {
|
|
2456
|
+
signInSchema.properties.secret = {
|
|
2457
|
+
$ref: "#/components/schemas/SecretMeta",
|
|
2458
|
+
description: "The sign-in's one secret, its vendor pointer, as metadata alone (SecretMeta): named `sign-in:<agent_id>:<provider>`, set, from a `sign-in`, changed when its pointer was saved (not a run's verify, `verified_at`). Never the pointer, a prefix, a length or a hash.",
|
|
2459
|
+
"x-agentrun-serve": "secrets/1",
|
|
2460
|
+
};
|
|
2461
|
+
fields.push("SignIn.secret");
|
|
2462
|
+
signInSchema.required = [...signInSchema.required, ...SIGN_IN_FIELDS_SENT];
|
|
2463
|
+
}
|
|
1694
2464
|
// A workflow run pauses here (POST /runs/{run_id}/pause): its status reads `paused` until it is resumed.
|
|
1695
2465
|
const runStatus = schemas.RunStatus;
|
|
1696
2466
|
if (Array.isArray(runStatus.enum) && !runStatus.enum.includes("paused")) {
|
|
@@ -1698,6 +2468,23 @@ export function openapiDocument(capabilityOf) {
|
|
|
1698
2468
|
runStatus["x-agentrun-serve"] = "pause/1";
|
|
1699
2469
|
fields.push("RunStatus.paused");
|
|
1700
2470
|
}
|
|
2471
|
+
// runnable/1: a 409 agent_not_runnable's `fields` (server.ts runnable) name what keeps a run from starting, many of them a
|
|
2472
|
+
// setting this host lacks (`not_set_up_here`, runnable.ts NOT_SET_UP), a reason the contract's InputIssue enum lacks.
|
|
2473
|
+
const issueReason = schemas.InputIssue.properties.reason;
|
|
2474
|
+
if (Array.isArray(issueReason.enum) && !issueReason.enum.includes(NOT_SET_UP)) {
|
|
2475
|
+
issueReason.enum = [...issueReason.enum, NOT_SET_UP];
|
|
2476
|
+
issueReason["x-agentrun-serve"] = "runnable/1";
|
|
2477
|
+
fields.push(`InputIssue.reason.${NOT_SET_UP}`);
|
|
2478
|
+
}
|
|
2479
|
+
// mcpservers/1: the reasons a saved MCP server's 422 gives beside the contract's (mcp-probe.ts): a URL that redirects
|
|
2480
|
+
// (never followed) or is plain http off loopback, a server listing too many tools or too much of them, a name kept for
|
|
2481
|
+
// AgentRun's own tools, a sign-in that expired.
|
|
2482
|
+
for (const reason of MCP_ISSUE_REASONS) {
|
|
2483
|
+
if (!Array.isArray(issueReason.enum) || issueReason.enum.includes(reason))
|
|
2484
|
+
continue;
|
|
2485
|
+
issueReason.enum = [...issueReason.enum, reason];
|
|
2486
|
+
fields.push(`InputIssue.reason.${reason}`);
|
|
2487
|
+
}
|
|
1701
2488
|
// A paid tool's charges (monid's) are a meter of their own on /usage, beside the model's tokens.
|
|
1702
2489
|
const meter = schemas.Meter;
|
|
1703
2490
|
if (Array.isArray(meter.enum) && !meter.enum.includes("tools")) {
|
|
@@ -1733,8 +2520,11 @@ export function openapiDocument(capabilityOf) {
|
|
|
1733
2520
|
const details = schemas.ErrorBody.properties.details;
|
|
1734
2521
|
details["x-agentrun-serve-details"] = {
|
|
1735
2522
|
agent_not_runnable: NOT_RUNNABLE_DETAILS, system_file_forbidden: FORBIDDEN_DETAILS,
|
|
2523
|
+
external_body_conflict: closed({ external: closed({ source: { type: "string" }, kind: { type: "string" }, id: { type: "string" }, version: { type: "string", description: "The version already run with another definition, as text." } }, "The reference and version POST /runs named.") }),
|
|
1736
2524
|
auth_required: closed({ auth: { enum: ["bearer", "oauth"], description: "What the MCP server asks for: `oauth` when it names protected-resource metadata, else `bearer`." }, status: { enum: [401, 403] } }),
|
|
1737
2525
|
upstream_failed: { type: "object", additionalProperties: false, properties: { status: { type: "integer", description: "The MCP server's HTTP status, when it answered one." } } },
|
|
2526
|
+
sign_in_held: { type: "object", additionalProperties: false, minProperties: 1, maxProperties: 1, properties: { held_by: { type: "string", description: "The run that holds the sign-in's save lease." }, handed_to: { type: "string", description: "A run still going that was handed the sign-in (signins/1)." } } },
|
|
2527
|
+
wrong_origin: closed({ open: { type: "string", format: "uri", description: "Where to open the console to sign in: the address the authorization server sends the browser back to." } }),
|
|
1738
2528
|
};
|
|
1739
2529
|
const extensions = [];
|
|
1740
2530
|
for (const [path, item] of Object.entries(EXTENSIONS)) {
|
|
@@ -1743,6 +2533,21 @@ export function openapiDocument(capabilityOf) {
|
|
|
1743
2533
|
extensions.push(`${method.toUpperCase()} ${path}`);
|
|
1744
2534
|
}
|
|
1745
2535
|
}
|
|
2536
|
+
// examples/1: a working body for the operations in REQUEST_EXAMPLES, on the JSON media type; a contract operation that
|
|
2537
|
+
// gains one is changed, and says so.
|
|
2538
|
+
for (const [path, item] of Object.entries(doc.paths)) {
|
|
2539
|
+
for (const [method, op] of Object.entries(item)) {
|
|
2540
|
+
const examples = REQUEST_EXAMPLES[op.operationId];
|
|
2541
|
+
if (!examples)
|
|
2542
|
+
continue;
|
|
2543
|
+
op.requestBody.content["application/json"].examples = structuredClone(examples);
|
|
2544
|
+
if (op["x-agentrun-serve"] !== undefined)
|
|
2545
|
+
continue;
|
|
2546
|
+
op["x-agentrun-serve-changed"] = { ...op["x-agentrun-serve-changed"], requestBody: "examples/1" };
|
|
2547
|
+
if (!changed.includes(`${method.toUpperCase()} ${path}`))
|
|
2548
|
+
changed.push(`${method.toUpperCase()} ${path}`);
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
1746
2551
|
doc.info["x-agentrun-serve"] = {
|
|
1747
2552
|
description: "Served by @parcha/agentrun-serve: the contract as vendored, unchanged, with this server's marks. Operations and schema properties marked x-agentrun-serve are this server's own, outside the contract (fields lists the properties, each marked with the addition that made it); operations marked x-agentrun-serve-unsupported answer 501 unsupported_here here; operations marked x-agentrun-serve-changed take more than the contract gives, each change named (changed lists them); a contract property marked x-agentrun-serve-unsupported is one this server refuses (unsupported_fields, with why); x-agentrun-serve-details gives what a code's details hold here (details lists where); x-agentrun-serve-note says what a contract property means here (notes lists them). servers is this server, relative to this document; the contract's own are in contract_servers.",
|
|
1748
2553
|
extensions,
|
|
@@ -1757,6 +2562,12 @@ export function openapiDocument(capabilityOf) {
|
|
|
1757
2562
|
// This document is read from the server it describes, wherever it is published: a client generated from it calls
|
|
1758
2563
|
// that server, not the first of the contract's.
|
|
1759
2564
|
doc.servers = [{ url: "/v2", description: "This server." }];
|
|
2565
|
+
if (adapters !== TRIGGER_ADAPTERS)
|
|
2566
|
+
withAdapters(doc, adapters);
|
|
2567
|
+
// Every server-wide pushed source's own hook, the registry's as a test's: this server's own, and listed so.
|
|
2568
|
+
const hooks = serverHooks(adapters);
|
|
2569
|
+
Object.assign(doc.paths, hooks);
|
|
2570
|
+
doc.info["x-agentrun-serve"].extensions.push(...Object.keys(hooks).map((path) => `POST ${path}`));
|
|
1760
2571
|
return doc;
|
|
1761
2572
|
}
|
|
1762
2573
|
/** The document as served on `port`: the owner's session cookie named as the console sets it on that port
|