@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/runs.d.ts
CHANGED
|
@@ -1,30 +1,41 @@
|
|
|
1
1
|
import { type ChildProcess } from "node:child_process";
|
|
2
2
|
import { type Revision, type RevisionKind, type RunOrigin, type RunRow } from "@parcha/pi-durable-agent";
|
|
3
|
-
import { type MessageOrigin, type RunMetrics, type TimelineEvent } from "@parcha/pi-durable-agent/timeline";
|
|
3
|
+
import { type MessageOrigin, type RunMetrics, type TimelineEvent, timelineReducer } from "@parcha/pi-durable-agent/timeline";
|
|
4
4
|
import type { RUN_EVENTS, RunNotice } from "./webhooks.js";
|
|
5
5
|
import type { RunTrigger } from "./triggers.js";
|
|
6
6
|
import { type AgentEntry, type Agents } from "./agents.js";
|
|
7
7
|
import { type McpServerSource } from "./mcp-gateway.js";
|
|
8
8
|
import { type DaytonaApi } from "./daytona-api.js";
|
|
9
9
|
import { type Learning, type LearningMode, type LearningReason, type LearningState } from "./learning.js";
|
|
10
|
+
import { Hearing } from "./heard.js";
|
|
10
11
|
import { LearningRuns, type Reflect } from "./learning-run.js";
|
|
11
12
|
import { type BoxHost, type Quarantine } from "./box/sweep.js";
|
|
12
|
-
import { type RefusalFigures } from "./cap.js";
|
|
13
|
+
import { type CapMode, type RefusalFigures } from "./cap.js";
|
|
13
14
|
import { type Tier } from "./model.js";
|
|
14
15
|
import { type Plane, type Tooling, type ToolSettingsMap } from "./tool-plane.js";
|
|
15
|
-
import { type PendingApproval } from "./tool-gate.js";
|
|
16
16
|
import { type Page, RowLog } from "./rows.js";
|
|
17
17
|
import { type Json } from "./validate.js";
|
|
18
|
+
import { RequestBounds } from "./bounds.js";
|
|
18
19
|
import { Turns } from "./turns.js";
|
|
19
20
|
import { type StoredKeys } from "./secrets.js";
|
|
20
|
-
import type
|
|
21
|
+
import { type HandedSignIn, type SignIns } from "./sign-ins.js";
|
|
21
22
|
import { type Place } from "./place.js";
|
|
23
|
+
import { RUN_EPOCH_ENV, type RunHolder } from "./run-holder.js";
|
|
24
|
+
import { type Approval, type ApprovalAnswer, costOf, costView, type Handed, knownToolCostOf, type Pending, type SoFar, soFarOf, type State, type Status, stoppedAt, SUGGESTED_RAISE_FACTOR, suggestedCap, toolCostOf, WITHHELD_SIGN_IN, withOverCap, withPaused } from "./run-view.js";
|
|
25
|
+
export { costOf, costView, knownToolCostOf, soFarOf, type SoFar, toolCostOf, withOverCap, withPaused, stoppedAt, suggestedCap, SUGGESTED_RAISE_FACTOR, type State, type Status, WITHHELD_SIGN_IN };
|
|
26
|
+
import { type BoxPaths } from "./box-paths.js";
|
|
22
27
|
import type { BoxProvider } from "@parcha/pi-transport";
|
|
23
28
|
import type { RemoteLimits } from "./run-box.js";
|
|
24
29
|
import type { Emitted } from "./webhooks.js";
|
|
25
|
-
export type Status = "queued" | "working" | "paused" | "input_required" | "completed" | "failed" | "cancelled";
|
|
26
|
-
export type State = "working" | "waiting" | "idle";
|
|
27
30
|
export declare const STATUSES: readonly Status[];
|
|
31
|
+
/** Why a run going when its server started was stopped: the browser sign-in it was handed can't be read here (the seal
|
|
32
|
+
* key changed or is missing, or the sign-ins file is damaged or can't be read). */
|
|
33
|
+
export declare const UNREADABLE_SIGN_IN = "This server can't read the run's browser sign-in (its seal key changed or is missing, or the sign-in is damaged): the run was stopped, so nothing it says can show it.";
|
|
34
|
+
/** Why a run going when its server started was stopped: its serve.json is there but can't be read or parsed, and with it
|
|
35
|
+
* went which browser it ran on and whether it was handed its agent's sign-in, so its text can't be cut of the pointer. */
|
|
36
|
+
export declare const UNREADABLE_RUN_META = "This server can't read the run's record (its serve.json is damaged or can't be read), so it can't tell whether the run was handed its agent's browser sign-in: the run was stopped, so nothing it says can show it.";
|
|
37
|
+
/** The epoch of the claim a run's process holds, which the server gave it at its launch (run-holder.ts). */
|
|
38
|
+
export { RUN_EPOCH_ENV };
|
|
28
39
|
type RunMeta = {
|
|
29
40
|
title: string;
|
|
30
41
|
created_at: string;
|
|
@@ -32,6 +43,8 @@ type RunMeta = {
|
|
|
32
43
|
input?: Json;
|
|
33
44
|
effort?: string;
|
|
34
45
|
max_cost_usd?: number;
|
|
46
|
+
/** How its cap prices a request (cap.ts CapMode); absent, expected. */
|
|
47
|
+
cap_mode?: CapMode;
|
|
35
48
|
/** Each raise of its cap (PATCH /runs/{id}): from what, to what, when, and the pause it answers (pauseOf), if any. */
|
|
36
49
|
cap_raised?: {
|
|
37
50
|
from: number;
|
|
@@ -74,6 +87,14 @@ type RunMeta = {
|
|
|
74
87
|
};
|
|
75
88
|
/** Its tools' providers, resolved at its first launch and kept for its life (tool-plane.ts). */
|
|
76
89
|
tool_plane?: Plane;
|
|
90
|
+
/** Set when a server found the run going with a browser sign-in it could not read (its seal key changed): the run was
|
|
91
|
+
* stopped, and its store is never read for rows, which could repeat the pointer uncut. */
|
|
92
|
+
unshown?: true;
|
|
93
|
+
/** Set once a launch handed the run its agent's browser sign-in: the SHA-256 of each pointer it was handed (never a
|
|
94
|
+
* pointer), one per pointer, in the order handed. Only such a run's text could repeat one, so only such a run is
|
|
95
|
+
* stopped and hidden, or withheld, while any of them can't be read back; and a hidden one is shown again once every one
|
|
96
|
+
* of them can, live or forgotten. MALFORMED for a value this server did not write (handedMark). */
|
|
97
|
+
sign_in_handed?: Handed;
|
|
77
98
|
/** Where it runs, as its start resolved it (place.ts): its process reads it. Absent for a run an older server started,
|
|
78
99
|
* which ran on the runner. */
|
|
79
100
|
place?: Place;
|
|
@@ -92,33 +113,9 @@ type RunMeta = {
|
|
|
92
113
|
cancel_waits_for?: string[];
|
|
93
114
|
/** The trigger that started it, and its firing's key (triggers.ts); absent for a run a caller started. */
|
|
94
115
|
trigger?: RunTrigger;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
type Approval = {
|
|
99
|
-
id: string;
|
|
100
|
-
tool: string;
|
|
101
|
-
call_id: string;
|
|
102
|
-
args_json: string;
|
|
103
|
-
requested_at: string;
|
|
104
|
-
price?: number | "not metered";
|
|
105
|
-
resolved?: true;
|
|
106
|
-
};
|
|
107
|
-
/** `args_shown`: the call's arguments as the server shows them (shownArgs), which the gate's resume message names. */
|
|
108
|
-
/** `by`: "message", a deny a person's message gave while the call waited (Runs.message). */
|
|
109
|
-
/** `superseded`: the answer a stop or a cancel overrode before the run's process acted on it, kept as it was given. */
|
|
110
|
-
type ApprovalAnswer = {
|
|
111
|
-
decision: "allow" | "deny" | "canceled" | "withdrawn";
|
|
112
|
-
note?: string;
|
|
113
|
-
answered_at: string;
|
|
114
|
-
args_shown?: string;
|
|
115
|
-
by?: "message";
|
|
116
|
-
superseded?: {
|
|
117
|
-
decision: string;
|
|
118
|
-
answered_at: string;
|
|
119
|
-
note?: string;
|
|
120
|
-
by?: "message";
|
|
121
|
-
};
|
|
116
|
+
/** Who its first message is from when its person did not write it (a trigger's firing, pi-durable-agent's
|
|
117
|
+
* MessageOrigin): sent with that message, and with it again by a relaunch. Absent: the person's. */
|
|
118
|
+
input_origin?: MessageOrigin;
|
|
122
119
|
};
|
|
123
120
|
type RunError = {
|
|
124
121
|
code: string;
|
|
@@ -146,6 +143,9 @@ type Served = {
|
|
|
146
143
|
out: unknown;
|
|
147
144
|
};
|
|
148
145
|
export type Run = {
|
|
146
|
+
/** Set at load when its serve.json was there but could not be read or parsed (readMeta): what it was handed is not
|
|
147
|
+
* known, as forget reads of it from disk. */
|
|
148
|
+
damaged?: true;
|
|
149
149
|
id: string;
|
|
150
150
|
/** The values of the secrets each launch handed its process: what its errors never show, a key rotated since included. */
|
|
151
151
|
handed?: Set<string>;
|
|
@@ -163,6 +163,8 @@ export type Run = {
|
|
|
163
163
|
lastEntry?: number;
|
|
164
164
|
/** What the live path's rows keep served (keepCommitted), for a learning row shown between its snapshots. */
|
|
165
165
|
keep?: (id: string) => boolean;
|
|
166
|
+
/** The ids of the rows only the served view made for it (servedOnly), which the live path's keep never holds. */
|
|
167
|
+
madeHere?: Set<string>;
|
|
166
168
|
/** What its pinned revision's tools resolve from (tool-plane.ts), resolved again at each launch. */
|
|
167
169
|
tooling?: Tooling;
|
|
168
170
|
/** Imported history (`agentrun-serve import`): the source it was run in, and its id there. It takes no message, and a
|
|
@@ -178,16 +180,33 @@ export type Run = {
|
|
|
178
180
|
log: RowLog;
|
|
179
181
|
/** The run's rows as they come in (before the log names them), with each `ask_person` answer's waiting row. */
|
|
180
182
|
rows: TimelineEvent[];
|
|
183
|
+
/** The reducer of its door's events that makes those rows (follow): the newest connection's once its snapshot is in,
|
|
184
|
+
* the one before it until then. */
|
|
185
|
+
timeline?: ReturnType<typeof timelineReducer>;
|
|
181
186
|
/** The person's messages the run took, and how each one's turn ended (turns.ts): its end is read from them. */
|
|
182
187
|
turns: Turns;
|
|
183
188
|
/** Its tool calls that waited for a person's approval, read from its store's entries, by id. */
|
|
184
189
|
approvals?: Map<string, Approval>;
|
|
190
|
+
/** Each resume row's approval, by the row's id (stable: rows upsert by id), noted the first time the row comes in with
|
|
191
|
+
* the gate's head (withApprovals). A row already rewritten no longer starts with that head, so an answer's restate
|
|
192
|
+
* reads the link from here, never from the row's text. Rebuilt from the store's rows, which keep the head, when a
|
|
193
|
+
* run is opened. */
|
|
194
|
+
resumeRows?: Map<string, string>;
|
|
185
195
|
/** The whole text of each assistant message of its end-of-run turn, by store entry: what the turn answered, whose
|
|
186
196
|
* notes learning reads (learning-run.ts). */
|
|
187
197
|
turnText?: Map<number, string>;
|
|
198
|
+
/** What was said to it, whole, by store entry, as its learning's grader reads it (heard.ts): the person's words, and a
|
|
199
|
+
* trigger's input apart by its source. */
|
|
200
|
+
hearing?: Hearing;
|
|
188
201
|
child?: ChildProcess;
|
|
189
|
-
/** The pid of a run process an earlier server started that still serves the run: supervised by its
|
|
202
|
+
/** The pid of a run process an earlier server started that still serves the run: supervised by the holder its row names. */
|
|
190
203
|
orphan?: number;
|
|
204
|
+
/** That process as its row names it (its pid, its start, this boot): what a signal to it is checked against. */
|
|
205
|
+
orphanHolder?: RunHolder;
|
|
206
|
+
/** A stop of that process kept pending while its identity cannot be checked (terminate): tried again every second. */
|
|
207
|
+
stopPending?: NodeJS.Timeout;
|
|
208
|
+
/** That pending stop has been said in the log: once for as long as it waits. */
|
|
209
|
+
stopWaits?: boolean;
|
|
191
210
|
/** Adopted with a saved stop: its first snapshot is checked once, and a turn still working is aborted. */
|
|
192
211
|
finishStop?: boolean;
|
|
193
212
|
/** A completed run opening again for a follow-up: every follow-up meanwhile waits for this one, never a second. */
|
|
@@ -247,6 +266,39 @@ export type Run = {
|
|
|
247
266
|
/** Its files being copied into its work/ before its first launch, until they are: nothing launches it meanwhile (a
|
|
248
267
|
* request that would waits for it), and nothing but a cancel settles it. */
|
|
249
268
|
preparing?: Promise<void>;
|
|
269
|
+
/** Its harness being installed before its first launch (claude-agent's Claude Code or codex's Codex, on first use:
|
|
270
|
+
* harness-install.ts): true
|
|
271
|
+
* once it is, false when the install failed and the run ended so. Nothing launches it meanwhile, and a request that
|
|
272
|
+
* would waits for it. */
|
|
273
|
+
installing?: Promise<boolean>;
|
|
274
|
+
/** It shows the install's row (its words, since `at`) while it waits for an install that runs. */
|
|
275
|
+
installRow?: {
|
|
276
|
+
at: string;
|
|
277
|
+
words: string;
|
|
278
|
+
};
|
|
279
|
+
/** A raised workflow run whose process the pause let go, waiting for a place under the server's limits before it opens
|
|
280
|
+
* again (finishRaise): its words, since `at`, shown as a row; queued meanwhile. Its pause's mark stays until it opens,
|
|
281
|
+
* so a restart finishes the raise the same way. */
|
|
282
|
+
placeWait?: {
|
|
283
|
+
at: string;
|
|
284
|
+
words: string;
|
|
285
|
+
};
|
|
286
|
+
/** The tries in a row whose launch failed after its place was taken (finishRaise): back of the queue after each, and
|
|
287
|
+
* off it after RAISE_TRIES, its mark kept, so a run whose launch keeps failing never holds a place reserved. */
|
|
288
|
+
raiseTries?: number;
|
|
289
|
+
/** A raise whose launch failed RAISE_TRIES times: why, since `at`, shown as a row while the run stays paused at its
|
|
290
|
+
* cap, so the owner reads that the raise was taken and the run could not start, not a call for another raise. */
|
|
291
|
+
raiseFailedRow?: {
|
|
292
|
+
at: string;
|
|
293
|
+
words: string;
|
|
294
|
+
};
|
|
295
|
+
/** The pause at its cap the watch last read (connect: its notice key), so a new one, or one written again, is told. */
|
|
296
|
+
pauseSeen?: string;
|
|
297
|
+
/** budget.json's time and size at the watch's last read, so an unchanged file is not read again. */
|
|
298
|
+
pauseStamp?: string;
|
|
299
|
+
/** It waits for its harness's install before a launch (harnessReady): takePlace counts it as holding a place until
|
|
300
|
+
* that launch, so nothing takes its place meanwhile. A cancel or an end lets the place go. */
|
|
301
|
+
waitsInstall?: boolean;
|
|
250
302
|
settled: boolean;
|
|
251
303
|
settling?: Promise<void>;
|
|
252
304
|
/** The newest write of its serve.json: one at a time, in order. */
|
|
@@ -261,9 +313,30 @@ export type Run = {
|
|
|
261
313
|
boxing?: Promise<{
|
|
262
314
|
id: string;
|
|
263
315
|
made: boolean;
|
|
316
|
+
replaced?: boolean;
|
|
264
317
|
}>;
|
|
265
318
|
/** Its remote box's newest pull: a read of its files waits for it. */
|
|
266
319
|
pulling?: Promise<void>;
|
|
320
|
+
/** Its launch waits on its claim, tried again later (launch): it keeps its place in the server's limits (takePlace). */
|
|
321
|
+
claimWait?: boolean;
|
|
322
|
+
/** Why that claim waits, in words, for a request's 503 (notUp). */
|
|
323
|
+
claimWaitWhy?: string;
|
|
324
|
+
/** Why its newest process was stopped unopened (the ready time passed, its door's last answer): the reason its run
|
|
325
|
+
* fails with when that was its last launch, since the process's own log does not say it. */
|
|
326
|
+
notOpened?: string;
|
|
327
|
+
/** The door the process this server started said it serves (its stdout line): this server's own record of it, so a
|
|
328
|
+
* row the agent store cannot take yet never keeps the door from it. */
|
|
329
|
+
door?: string;
|
|
330
|
+
/** The holder its row is still to name (nameHolder), while a store another writer holds keeps the write waiting. */
|
|
331
|
+
naming?: {
|
|
332
|
+
epoch: number;
|
|
333
|
+
holder: RunHolder;
|
|
334
|
+
tries: number;
|
|
335
|
+
};
|
|
336
|
+
/** How many launches in a row its claim was refused: the next try comes sooner while it is few. */
|
|
337
|
+
claimTries?: number;
|
|
338
|
+
/** The last of its database's reads and take-back checkpoint (runs.ts runDb): the next waits for it. */
|
|
339
|
+
dbQueue?: Promise<void>;
|
|
267
340
|
/** It stood waiting for the person when last marked: a turn's end is the change into that. */
|
|
268
341
|
waited?: boolean;
|
|
269
342
|
/** The pause at its cap (its mark) whose process was let go: once per pause. */
|
|
@@ -272,7 +345,8 @@ export type Run = {
|
|
|
272
345
|
raising?: Promise<unknown>;
|
|
273
346
|
/** Its raise's follow-up is being sent (resumeRaised), or waits to be tried again (its time): never two at once. */
|
|
274
347
|
resuming?: "sending" | number;
|
|
275
|
-
/** Its newest refusal for room's figures, from that refusal's own start mark (cap.ts RefusalFigures)
|
|
348
|
+
/** Its newest refusal for room's figures, from that refusal's own start mark (cap.ts RefusalFigures): all three, or
|
|
349
|
+
* none. */
|
|
276
350
|
capRefusal?: RefusalFigures;
|
|
277
351
|
/** That refusal's own start mark (its entry): the pause a raise answers is keyed to it (pauseOf). */
|
|
278
352
|
capMark?: number;
|
|
@@ -282,75 +356,40 @@ export type Run = {
|
|
|
282
356
|
usd: number | null;
|
|
283
357
|
at?: number;
|
|
284
358
|
};
|
|
359
|
+
/** Its model requests' bounds (cap.ts BOUND_FIELD: the most a cache miss can make one cost beyond its hold), as its
|
|
360
|
+
* entries say them (bounds.ts). */
|
|
361
|
+
bounds?: RequestBounds;
|
|
285
362
|
};
|
|
286
|
-
/** The
|
|
287
|
-
|
|
288
|
-
export declare
|
|
289
|
-
/** The row that says a run's booked spend passed its cap, and by how much, after its usage row: a request's cost is
|
|
290
|
-
* booked once it answers, and one carrying a native web search is held at an allowance, not a bound (cap.ts), so a run
|
|
291
|
-
* can pass its cap by its last request. The next request is then refused, and the run ends spend_cap_reached. */
|
|
292
|
-
export declare function withOverCap(rows: TimelineEvent[], cap: number | undefined): TimelineEvent[];
|
|
293
|
-
/** What a run waits on, as `pending` says it (one field for every kind; a tool call waiting on approval is another):
|
|
294
|
-
* the question a waiting run asked, read from its last meaningful row (withAsks' waiting row), the same row its
|
|
295
|
-
* status reads, never from a scan of its timeline. */
|
|
296
|
-
type Pending = {
|
|
297
|
-
kind: "question";
|
|
298
|
-
question: string;
|
|
299
|
-
asked_at: string;
|
|
300
|
-
} | PendingApproval | {
|
|
301
|
-
kind: "budget";
|
|
302
|
-
cap_usd: number;
|
|
303
|
-
spent_usd?: number;
|
|
304
|
-
needs_usd?: number;
|
|
305
|
-
suggested_cap_usd?: number;
|
|
306
|
-
said: string;
|
|
363
|
+
/** The row a run shows while its harness installs for it (harness-install.ts), since `at`. */
|
|
364
|
+
/** The row a raised workflow run shows once its launch failed RAISE_TRIES times (finishRaise), since `at`. */
|
|
365
|
+
export declare const raiseFailedRow: ({ at, words }: {
|
|
307
366
|
at: string;
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
* came to; null when one is unknown. A call still marked, in flight or cut, is no charge here. */
|
|
320
|
-
export declare const toolCostOf: (rows: readonly TimelineEvent[], tool?: string, others?: boolean) => number | null;
|
|
321
|
-
/** What a run's paid tools are known to have charged (`tool`'s alone, when given; every other tool's with `others`): each
|
|
322
|
-
* charge's line that names its cost, a charge of unknown cost adding nothing (a browser call's row, what is known of it). */
|
|
323
|
-
export declare const knownToolCostOf: (rows: readonly TimelineEvent[], tool?: string, others?: boolean) => number;
|
|
324
|
-
/** A run's cost for its views: its usage row's, else what the store kept when it carried the run back (0 before any
|
|
325
|
-
* request). A usage row that says unknown, or says nothing, stays unknown: what the store kept dates from before a
|
|
326
|
-
* follow-up. */
|
|
327
|
-
export declare function costView(rows: readonly TimelineEvent[], stored: number | null | undefined, decisions?: number | null): number | null;
|
|
328
|
-
/** What a run whose cost is unknown has cost so far (costsofar/1): the sum of its charges whose cost is known, and how many
|
|
329
|
-
* have none, from its usage row, plus a workflow's decisions (`decisions`: their known sum and how many are not known;
|
|
330
|
-
* null when they could not be read, which says nothing). Undefined while the cost is known, when the row says neither
|
|
331
|
-
* (an older run's), or when a workflow's decisions are unreadable. No ceiling is claimed. */
|
|
332
|
-
export type SoFar = {
|
|
333
|
-
so_far_usd: number;
|
|
334
|
-
unpriced: number;
|
|
335
|
-
};
|
|
336
|
-
export declare function soFarOf(rows: readonly TimelineEvent[], decisions?: {
|
|
337
|
-
known: number;
|
|
338
|
-
unpriced: number;
|
|
339
|
-
} | null): SoFar | undefined;
|
|
340
|
-
/** Whether the turn a stop ended is still where the run stands: no message shown is newer than the stop's. By order,
|
|
341
|
-
* never by a count or by the stopped message itself, which a compaction can take off the rows. */
|
|
342
|
-
export declare const stoppedAt: (meta: {
|
|
343
|
-
stopped_at?: string;
|
|
344
|
-
stopped_after?: number;
|
|
345
|
-
}, rows: readonly TimelineEvent[]) => boolean;
|
|
367
|
+
words: string;
|
|
368
|
+
}) => TimelineEvent;
|
|
369
|
+
/** The row a raised workflow run shows while it waits for a place to open again in (finishRaise), since `at`. */
|
|
370
|
+
export declare const placeRow: ({ at, words }: {
|
|
371
|
+
at: string;
|
|
372
|
+
words: string;
|
|
373
|
+
}) => TimelineEvent;
|
|
374
|
+
export declare const installRow: ({ at, words }: {
|
|
375
|
+
at: string;
|
|
376
|
+
words: string;
|
|
377
|
+
}) => TimelineEvent;
|
|
346
378
|
/** What a stop keeps of where the run stands: the person's last message, by its id, or the place before any. */
|
|
347
379
|
export declare const stopMark: (rows: readonly TimelineEvent[]) => {
|
|
348
380
|
stopped_at: string;
|
|
349
381
|
};
|
|
350
382
|
/** The rows a snapshot that no longer holds them leaves served: those committed entries made. A row any connection
|
|
351
383
|
* showed live is not one (`live` holds them for the run), so a live row that ended while the door was away goes. */
|
|
352
|
-
|
|
353
|
-
|
|
384
|
+
/** The live path's keep: a row a committed entry made stays served though a later snapshot no longer holds it (the
|
|
385
|
+
* timeline only grows); a row the reducer showed live does not, nor one only the served view makes (`madeHere`, the ids
|
|
386
|
+
* show() tagged servedOnly, read as it grows), which goes once show() stops making it. */
|
|
387
|
+
export declare function keepCommitted(live: Set<string>, rows: readonly TimelineEvent[], isLive: (id: string) => boolean, madeHere?: ReadonlySet<string>): (id: string) => boolean;
|
|
388
|
+
/** A run's status and state, by the contract's table (run-view.ts statusOf). The table is read over the run's rows, its
|
|
389
|
+
* turns and its store entries; the file-backed facts (a workflow paused at its cap or in its process, the browser ask)
|
|
390
|
+
* this server reads from the run's directory and passes in. The store-backed view builds the same facts from the run's
|
|
391
|
+
* row and journal, so the status a person or a model sees is the same. The facts are thunks, read only where the table
|
|
392
|
+
* reaches them, so the hot path (an ended or stopped run) touches no file, as it did when the reads lived here. */
|
|
354
393
|
export declare function statusOf(run: Run): {
|
|
355
394
|
status: Status;
|
|
356
395
|
state: State;
|
|
@@ -369,17 +408,27 @@ export type StartOptions = {
|
|
|
369
408
|
place: Place;
|
|
370
409
|
effort?: string;
|
|
371
410
|
maxCostUsd?: number;
|
|
411
|
+
capMode?: CapMode;
|
|
372
412
|
trigger?: RunTrigger;
|
|
373
413
|
inputs?: (work: string) => Promise<unknown>;
|
|
374
|
-
origin?: RunOrigin;
|
|
414
|
+
origin?: RunOrigin; /** Who the first message is from, when not the person (RunMeta.input_origin). */
|
|
415
|
+
from?: MessageOrigin;
|
|
375
416
|
};
|
|
376
417
|
/** `token` is the server's own: no run's process sees it. */
|
|
377
418
|
/** `maxRuns`: the most runs with a live process at once; `settleRetryMs`: how often a carry back the store refused is
|
|
378
419
|
* tried again; `readyTimeoutMs`: how long a request to a run waits for its door (a run's first message, sent by its
|
|
379
|
-
* start, always waits READY_TIMEOUT_MS); `
|
|
420
|
+
* start, always waits READY_TIMEOUT_MS); `openTimeoutMs`: how long a launched process has to open its run (READY_TIMEOUT_MS,
|
|
421
|
+
* the first message's wait, by default; never the request's wait); `log` takes a run's start and end (print.ts). */
|
|
380
422
|
export type RunsOptions = {
|
|
423
|
+
installs?: Readonly<Record<string, {
|
|
424
|
+
readonly installed: boolean;
|
|
425
|
+
readonly installingWords: string;
|
|
426
|
+
needed(): Promise<boolean>;
|
|
427
|
+
ensure(): Promise<void>;
|
|
428
|
+
}>>; /** What a run's Docker box reaches, as the server resolved it (run-box.ts boxNetworkOf): the list, or none. Absent, none. */
|
|
381
429
|
dockerAllow?: readonly string[] | "none"; /** On a Mac, the server's proxy container's volume a run's Docker box mounts (box-egress-vm.ts). */
|
|
382
|
-
dockerVolume?: string;
|
|
430
|
+
dockerVolume?: string; /** A server in a container: where its Docker has the data directory (box-paths.ts), which a run's Docker box mounts from. Absent on a host. */
|
|
431
|
+
dockerPaths?: BoxPaths;
|
|
383
432
|
agents: Agents;
|
|
384
433
|
token: string; /** The server's saved tool keys, read by name for its runs alone (secrets.ts). */
|
|
385
434
|
storedKeys?: StoredKeys; /** The server's saved MCP servers (mcp-servers.ts): a run's pin and its credentials come from them at each launch. */
|
|
@@ -409,15 +458,16 @@ export type RunsOptions = {
|
|
|
409
458
|
};
|
|
410
459
|
settleRetryMs?: number;
|
|
411
460
|
readyTimeoutMs?: number;
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
461
|
+
openTimeoutMs?: number; /** Under --faux only (server.ts): the nonce handed to each run's process in place of its launch's. */
|
|
462
|
+
fauxHandedNonce?: string;
|
|
463
|
+
reflectTimeoutMs?: number; /** How much of what a run learned its instructions hold, in bytes (`--learning-budget`, learning.ts learnedOf). */
|
|
415
464
|
learningBudget?: number;
|
|
416
465
|
log?: (event: string, fields: Record<string, string | number>) => void;
|
|
417
466
|
notify?: RunNotify;
|
|
418
467
|
learning?: LearningMode; /** Each agent's saved sign-ins (sign-ins.ts): absent, no run gets one. */
|
|
419
|
-
signIns?: SignIns; /**
|
|
420
|
-
|
|
468
|
+
signIns?: SignIns; /** Every secret this server never shows (server.ts serverSecrets), read at each call, so one made or rotated is cut at once: the host's and the keys saved on it, read through `stored` when given (learning's view keeps the saved keys it read), its tokens, and each it holds (server-secrets.ts). What a run shows, its title among it, and what its learning keeps are cut of it. */
|
|
469
|
+
serverSecrets: (stored?: StoredKeys) => string[]; /** The current name of a trigger by its id, from the store (server.ts triggerNameOf): resolved once when a run is loaded (a run restored after a restart still names its trigger), and a firing's start and a rename push it in (triggerChanged), so servedTriggerRow reads it with no store read. */
|
|
470
|
+
triggerName?: (id: string) => Promise<string | undefined>;
|
|
421
471
|
};
|
|
422
472
|
/** Told of a run's moment each time it is seen (webhooks.ts' emit, which queues each one once): a wait it reached, and an
|
|
423
473
|
* end once the agent store has it. `marker` names the moment (the person's turn it waits at, the end's time), the same
|
|
@@ -453,8 +503,8 @@ export declare function needsOf(revision: Revision): Promise<RunNeeds>;
|
|
|
453
503
|
/** The secrets a run of `needs` is handed over its pipe, by the keys `env` holds now: RUN_SECRETS but each field of a
|
|
454
504
|
* `tool` row of `rows` (TOOL_KEYS) that unlocks none of the tools the run binds; and but each model key its model does
|
|
455
505
|
* not need, from the host's model settings and the keys in `env`: a pi run's, its models' providers' keys or the
|
|
456
|
-
* gateway's (model.ts' modelKeys: its own model, or the host's of each tier it runs);
|
|
457
|
-
* one key
|
|
506
|
+
* gateway's (model.ts' modelKeys: its own model, or the host's of each tier it runs); a run on an adapter's, the
|
|
507
|
+
* one key its wire's route sends for the revision's model (adapters.ts' harnessModelKeys). Read at each launch, so a key
|
|
458
508
|
* saved with no restart counts at the next. */
|
|
459
509
|
export declare function keysFor(needs: RunNeeds, env: NodeJS.ProcessEnv, rows?: readonly KeyRow[]): string[];
|
|
460
510
|
/** The secrets a run of `revision` is handed with the keys `env` holds (needsOf, then keysFor). */
|
|
@@ -471,28 +521,42 @@ export declare const childEnv: (env: NodeJS.ProcessEnv, token: string) => NodeJS
|
|
|
471
521
|
export declare function failureLine(log: string): string;
|
|
472
522
|
/** The last line of the run process's log, in words, for a failure's message. */
|
|
473
523
|
export declare function lastLogLine(run: Pick<Run, "dir">): Promise<string>;
|
|
474
|
-
/** Seams for tests, each unset in a server: `personsTurn` holds a person's turn just after its origin went
|
|
524
|
+
/** Seams for tests, each unset in a server: `personsTurn` holds a person's turn just after its origin went;
|
|
525
|
+
* `beforeRestartCheck` holds a settle that found the run's process gone just before it decides whether to open it again. */
|
|
475
526
|
export declare const runsTestHooks: {
|
|
476
527
|
personsTurn?: (runDir: string) => Promise<void> | void;
|
|
528
|
+
beforeRestartCheck?: (runDir: string) => Promise<void> | void;
|
|
477
529
|
};
|
|
478
530
|
export declare class Runs {
|
|
531
|
+
#private;
|
|
479
532
|
private readonly options;
|
|
480
533
|
private readonly runs;
|
|
481
|
-
/**
|
|
482
|
-
|
|
534
|
+
/** The current name of each trigger a held run names, by its id (servedTriggerRow): pushed in at a firing's start (the
|
|
535
|
+
* run's trigger), on a rename or delete (server.ts triggerChanged), and resolved once when a run is loaded, so a
|
|
536
|
+
* served row names its trigger with no store read. `undefined` for a trigger that is gone. */
|
|
537
|
+
private readonly triggerNames;
|
|
538
|
+
/** The last entry each run's database reads have seen (run-db.ts): a read behind it is never shown. */
|
|
539
|
+
private readonly reads;
|
|
540
|
+
/** The disk the runs' folders are on (disk.ts): on this machine, the data directory's own. */
|
|
541
|
+
private get disk();
|
|
483
542
|
/** What decides the secrets each revision's runs are handed (needsOf), by revision id: read once, from the revision the
|
|
484
543
|
* run is pinned to, never from a request. The keys themselves are read at each launch (keysFor). */
|
|
485
544
|
private readonly needs;
|
|
486
|
-
/** Every run's graph as served, part by part (servedGraph), and each workflow run's last graph read whole, which a
|
|
487
|
-
* poll that met a busy store answers, marked stale: one LRU by bytes across runs (graph-served.ts PartCache). */
|
|
488
|
-
private readonly graphCache;
|
|
489
545
|
private readonly adopting;
|
|
546
|
+
/** The runs this process is starting, from the store's row until the run is held (start): its serve.json and its seed
|
|
547
|
+
* copy are written in between. A read of one waits for its start and never loads it from disk, where it would look
|
|
548
|
+
* like a run a stopped server left mid-copy. Null once a start failed. */
|
|
549
|
+
private readonly startingRuns;
|
|
490
550
|
/** The hosts this server's next remote box asks for: the setting's, until the provider cannot keep a list here, then none. */
|
|
491
551
|
private remoteAllow;
|
|
492
552
|
private readonly clock;
|
|
493
553
|
private readonly cli;
|
|
494
554
|
private readonly app;
|
|
495
555
|
private closing;
|
|
556
|
+
/** Raised workflow runs waiting for a place to open again in (finishRaise), tried again every PLACE_RETRY_MS. */
|
|
557
|
+
private placeWaiters;
|
|
558
|
+
private placeRetry;
|
|
559
|
+
private placeRetrying;
|
|
496
560
|
/** Set once `close` is done: the store is closed, so nothing settles after it. */
|
|
497
561
|
private closed;
|
|
498
562
|
/** Runs past the cap's check whose process is not started yet. */
|
|
@@ -500,7 +564,8 @@ export declare class Runs {
|
|
|
500
564
|
/** The memory the starts counted in `starting` reserve, in MiB. */
|
|
501
565
|
private startingMib;
|
|
502
566
|
/** This host's memory, out of which each live run reserves what its harness takes (host.ts), beside `maxRuns`. */
|
|
503
|
-
|
|
567
|
+
/** This host's memory for runs (host.ts); a test's seam sets it (startServe's `hostMemory`). */
|
|
568
|
+
memory: number;
|
|
504
569
|
/** The start sweep of the boxes runs left: once, before any run opens a box (sweepOnce). */
|
|
505
570
|
private swept?;
|
|
506
571
|
/** The runs' learning (learning-run.ts): a step this file calls as a run starts, ends, settles, opens again and is
|
|
@@ -515,6 +580,11 @@ export declare class Runs {
|
|
|
515
580
|
/** A test's seam (startServe's `beforeReopenLaunch`): awaited by a reopen after the run reads open again and before its
|
|
516
581
|
* launch, so a test can hold a reopen there. */
|
|
517
582
|
beforeReopenLaunch?: (runId: string) => Promise<void> | void;
|
|
583
|
+
/** A test's seam (startServe's `beforeRaiseLaunch`): awaited where a raise that opens a let-go workflow pins what its
|
|
584
|
+
* launch needs (finishRaise), after its place is taken; one that throws stands for a pin that fails there. */
|
|
585
|
+
beforeRaiseLaunch?: (runId: string) => Promise<void> | void;
|
|
586
|
+
/** A test's seam (startServe's `onPauseCheck`): told each stat and each read of a workflow run's pause by its watch. */
|
|
587
|
+
onPauseCheck?: (runId: string, what: "stat" | "read") => void;
|
|
518
588
|
/** A test's seam (startServe's `onRunLoad`): told each run read in from its store, its timeline with it. */
|
|
519
589
|
onRunLoad?: (runId: string) => void;
|
|
520
590
|
/** A test's seam (startServe's `beforeSubmit`): awaited by a message before it goes to the run's door. */
|
|
@@ -538,14 +608,30 @@ export declare class Runs {
|
|
|
538
608
|
/** Writes the run's serve.json, after any write already under way: `meta`, a copy its caller publishes to run.meta
|
|
539
609
|
* only once this resolves (a raise, takeRaise), else run.meta, each as it stands when the write starts. */
|
|
540
610
|
private saveMeta;
|
|
541
|
-
|
|
542
|
-
|
|
611
|
+
/** The process that holds the run, as its row's claim names it (run-holder.ts); undefined for none, or the server. */
|
|
612
|
+
private holder;
|
|
613
|
+
/** Who holds the run, as its row says and the processes show: `unknown` when the row or the process listing cannot be
|
|
614
|
+
* read, which a caller never takes for a holder that is gone. */
|
|
615
|
+
private holderView;
|
|
616
|
+
/** The door a live run serves, from its row's holder: a process that lives (its pid, of the same start, on this boot)
|
|
617
|
+
* and a loopback address it named. */
|
|
543
618
|
private doorOf;
|
|
619
|
+
/** The record the run's process keeps in its own store (pi-durable-disk RUN_STATUS_TABLE: its status, `detail` and
|
|
620
|
+
* `wakeAt`), read lock-free; null when it has none or it cannot be read. */
|
|
621
|
+
private runRecord;
|
|
544
622
|
private storeFile;
|
|
545
623
|
/** The run's rows from its store, opened read-only; only once its claim is released. An agentic run's rows are its
|
|
546
624
|
* root conversation's; a workflow run's are its model nodes'. `atEnd`: a settle's read, which reads every
|
|
547
625
|
* conversation (a workflow's nodes, a harness's session) once and counts the run's metrics from all of them. */
|
|
548
626
|
private readStore;
|
|
627
|
+
/** `act` on run `run`'s database, after every earlier one on it: its reads and its take-back's checkpoint never meet. */
|
|
628
|
+
private runDb;
|
|
629
|
+
/** The server takes run `run` back once no process holds it: its claim's epoch is bumped, with the server as its
|
|
630
|
+
* holder (the disk's revoke, disk.ts), and only then its database checkpointed (run-db.ts), its WAL emptied into the
|
|
631
|
+
* database file. A run whose process still lives is not taken. A take-back that fails (the agent store held by another
|
|
632
|
+
* writer, or not writable) only warns: the run settles all the same, its database read with its WAL, and the next
|
|
633
|
+
* settle or start takes it back. */
|
|
634
|
+
private takeBack;
|
|
549
635
|
/** New rows in: into the log, then the run's status, then whatever the status asks for. */
|
|
550
636
|
/** `keep`: rows that stay served though `rows` no longer holds them (the live path's committed rows). */
|
|
551
637
|
private take;
|
|
@@ -555,8 +641,22 @@ export declare class Runs {
|
|
|
555
641
|
/** The run's rows into its log, as served: a workflow run's decisions and the run's learning row are the served view's
|
|
556
642
|
* only, never the run's own rows, which its cost and its answer are read from. */
|
|
557
643
|
private show;
|
|
644
|
+
/** A trigger's row as served: "<label> <its name>: <its first line>" for a trigger that has a name now; as the timeline
|
|
645
|
+
* wrote it, "<label> <its id>: …", for one that is gone. The name is put in after the run's rows were redacted, so it
|
|
646
|
+
* is redacted here with the run's redactor: a key pasted into a trigger's name never shows on its runs' rows. */
|
|
647
|
+
private servedTriggerRow;
|
|
648
|
+
/** Trigger `id` renamed or deleted, with its name now (`name`, undefined when it is gone): the name is pushed to the
|
|
649
|
+
* one the runs read (triggerNames), and each held run whose Timeline names it is shown again, its row naming the
|
|
650
|
+
* trigger as it is now. With no `id` (the triggers just read at a start): every run so named is shown again. */
|
|
651
|
+
triggerChanged(id?: string, name?: string | undefined): void;
|
|
558
652
|
/** A live process: the child this server started, or one an earlier server started that still serves the run. */
|
|
559
653
|
private live;
|
|
654
|
+
/** Run `id`'s status read again now: the owner answered its browser ask (browser-person.ts), so it is working again
|
|
655
|
+
* before its process has read the answer. */
|
|
656
|
+
remark(id: string): void;
|
|
657
|
+
/** Whether run `id` has a process serving it now: the child this server started, or an adopted one that is alive. A
|
|
658
|
+
* run's live browser view is that process's alone (browser-live.ts). */
|
|
659
|
+
hasProcess(id: string): boolean;
|
|
560
660
|
/** How an agentic run ends: over its cap, or as the turn of the person's newest message ended (turns.ts), once every
|
|
561
661
|
* message the run took has had its turn. Undefined while one is open, or when the run stopped, waits, or its turn
|
|
562
662
|
* ended interrupted (the run then waits for the person), or while its records name no message (a live process of an
|
|
@@ -566,12 +666,29 @@ export declare class Runs {
|
|
|
566
666
|
/** A run's error as a person reads it, in its error box and on its Timeline row alike: a refused key in plain words
|
|
567
667
|
* (plainKey), else the harness's text with no loopback address (withoutLoopback: Codex names serve's own proxy). */
|
|
568
668
|
private errorWords;
|
|
569
|
-
/** An error row as served: its summary and text in errorWords' terms
|
|
570
|
-
* what the harness said. */
|
|
669
|
+
/** An error row as served: its summary and text in errorWords' terms, or the pause's phase row of a refusal for room the
|
|
670
|
+
* run paused at. The run's own rows, which its status reads, keep what the harness said. */
|
|
571
671
|
private servedError;
|
|
572
|
-
/** What serve shows of a run's error text, for every run kind: no held secret
|
|
573
|
-
* no loopback address. */
|
|
672
|
+
/** What serve shows of a run's error text, for every run kind (run-view.ts shownOf): no held secret and no loopback. */
|
|
574
673
|
private shown;
|
|
674
|
+
/** A run's error as its view and the run lists serve it (run-view.ts servedRunErrorWith): its message in shown()'s terms. */
|
|
675
|
+
private servedRunError;
|
|
676
|
+
/** A run's review as its view serves it (run-view.ts servedReviewWith): its reason in shown()'s terms, or withheld while
|
|
677
|
+
* the run is hidden (meta.unshown). */
|
|
678
|
+
private servedReview;
|
|
679
|
+
/** The pointers a run was handed, read back to cut them (sign-ins.ts peek and forgotten), by its serve.json's
|
|
680
|
+
* `sign_in_handed`: none for a run with no mark (it was never handed one); else, for each hash it names, the live or
|
|
681
|
+
* forgotten pointer whose SHA-256 it is. `unreadable` when what it was handed can't be read back here: a MALFORMED
|
|
682
|
+
* mark, no vendor browser kept beside the mark, the sign-ins file can't be read, or any of its hashes matches no
|
|
683
|
+
* pointer that opens (one under another seal key or none, one forgotten and dropped past MAX_FORGOTTEN, the sign-ins
|
|
684
|
+
* file gone). Fails closed: a marked run is cut of every pointer it was handed, or withheld, never served uncut. Read
|
|
685
|
+
* anew at each load: nothing caches this verdict, so a run withheld while its key was missing is shown once it opens. */
|
|
686
|
+
private handedPointers;
|
|
687
|
+
/** shown() for a run this server holds no Run for (an ended one a list reads from its row and serve.json alone, the
|
|
688
|
+
* summary choke point: run-view.ts rowShown): cut of every secret this server never shows (serverSecrets) and of what
|
|
689
|
+
* the run was handed of its agent's sign-in (handedPointers); `withheld` when that can't be read back here, as a load
|
|
690
|
+
* would hide the run. */
|
|
691
|
+
private rowShown;
|
|
575
692
|
/** A run's answer as serve serves it: no held secret, never cut (redactedAnswer). Loopback addresses stay: an answer is
|
|
576
693
|
* the model's own words, and a local address there can be what the person asked about. */
|
|
577
694
|
private servedAnswer;
|
|
@@ -581,13 +698,6 @@ export declare class Runs {
|
|
|
581
698
|
* view, and an answer a run was made to write can be large. The run keeps the one it served last, of each slot; a key
|
|
582
699
|
* saved or deleted changes the values' digest, and the next view redacts again. */
|
|
583
700
|
private servedOnce;
|
|
584
|
-
/** A workflow run's graph as serve serves it: its nodes, each decision and each call (its input, output and error) with
|
|
585
|
-
* no held secret, by its answer's rule (redactedOutput), and only then cut: a map item's label at 200 characters, a
|
|
586
|
-
* call's error at 2000, and a text stored cut (a decision's state past 64 KB, an error logged cut) less its last 6
|
|
587
|
-
* times the longest held value plus 16 characters, where a value the stored cut split would sit. The view a busy
|
|
588
|
-
* store's read keeps is the one graph-view.ts made, whole, so a key saved after it is still found. Each part is
|
|
589
|
-
* served once per content and held value set: a console polls the graph while the run goes. */
|
|
590
|
-
private servedGraph;
|
|
591
701
|
/** The timeline's redaction of `run`'s error rows and of what a tool's result shows (its summary and preview), applied
|
|
592
702
|
* before a row is cut (timelineOf's `redact`), so a cut never leaves the head of a key. Every such cut is within
|
|
593
703
|
* redacted()'s SHOWN, so its window holds. */
|
|
@@ -598,9 +708,8 @@ export declare class Runs {
|
|
|
598
708
|
/** The last line of the run process's log (lastLogLine) for a failure's message, with every value its errors never
|
|
599
709
|
* show cut out: its process may have written a secret or its sign-in's pointer there. */
|
|
600
710
|
private lastLine;
|
|
601
|
-
/** Every secret value `run`'s errors never show, as learning's checker holds them (learning-run.ts refused):
|
|
602
|
-
* server
|
|
603
|
-
* server's own tokens. */
|
|
711
|
+
/** Every secret value `run`'s errors never show, as learning's checker holds them (learning-run.ts refused): every one
|
|
712
|
+
* this server never shows (serverSecrets, read now, so one rotated is cut at once) and what each launch handed the run. */
|
|
604
713
|
private refusedValues;
|
|
605
714
|
/** A run's model error in a person's words when its provider refused the run's key (key-refusal.ts): the key its
|
|
606
715
|
* harness's route sends, by this server's settings and keys, and no secret's value. */
|
|
@@ -619,8 +728,10 @@ export declare class Runs {
|
|
|
619
728
|
private finish;
|
|
620
729
|
/** SIGTERM to the run's process: it drains, releases the run and exits. */
|
|
621
730
|
private terminate;
|
|
622
|
-
/** Supervise a run process an earlier server started: follow its door, and settle the run once
|
|
623
|
-
*
|
|
731
|
+
/** Supervise a run process an earlier server started, its row's holder: follow its door, and settle the run once the
|
|
732
|
+
* process is gone, or once the record it keeps in its store has said for EXIT_AFTER_RELEASE_MS that it let go while
|
|
733
|
+
* the process lives on. `follow`: its rows are followed live from its door (never for a run whose rows are not
|
|
734
|
+
* shown, meta.unshown). */
|
|
624
735
|
private adoptProcess;
|
|
625
736
|
/** At start: every run the store says is running is read, supervised when its process lives, carried back when it
|
|
626
737
|
* already ended, and opened again when its process went before it ended. */
|
|
@@ -653,6 +764,7 @@ export declare class Runs {
|
|
|
653
764
|
ensureBox(id: string): Promise<{
|
|
654
765
|
id: string;
|
|
655
766
|
made: boolean;
|
|
767
|
+
replaced?: boolean;
|
|
656
768
|
}>;
|
|
657
769
|
/** The run's box let go (archive, or its process gone after an archive): reaped by the box's own count. */
|
|
658
770
|
private teardown;
|
|
@@ -673,9 +785,21 @@ export declare class Runs {
|
|
|
673
785
|
/** Follow the door's events into an agentic run's rows, again after each drop while the process lives. A workflow
|
|
674
786
|
* run is only watched: the door's events are a root conversation's, and a workflow run has none. */
|
|
675
787
|
private connect;
|
|
788
|
+
/** One round of a live workflow run's watch of its pause at its cap: a stat of budget.json, and a read only when it
|
|
789
|
+
* changed (its time or size); a new pause, or one written again, refreshes the run (its status, its notice). */
|
|
790
|
+
private watchPause;
|
|
676
791
|
private follow;
|
|
792
|
+
/** The install `run`'s harness waits for before it launches (claude-agent's Claude Code, codex's Codex: harness-install.ts), or undefined
|
|
793
|
+
* when it waits for none. One per run at a time, every run's on the server's one install: while that runs the run
|
|
794
|
+
* shows it (installRow). A failed install ends the run failed, with the install's words, which name the command that
|
|
795
|
+
* installs it by hand. */
|
|
796
|
+
private harnessReady;
|
|
677
797
|
/** The door of a run that is not finished, starting or waking its process when it is not live. */
|
|
678
798
|
private ensureLive;
|
|
799
|
+
/** A request's 503 for a run that did not come up in time, naming why, as far as this server can tell: the process
|
|
800
|
+
* listing cannot be read (who holds it is unknown), the agent store is busy (its claim waits on it), or the run never
|
|
801
|
+
* opened (its process is up, its door not serving). */
|
|
802
|
+
private notUp;
|
|
679
803
|
/** The refusal of a message to an imported run: it was run elsewhere, and is kept as history. */
|
|
680
804
|
private importedRefusal;
|
|
681
805
|
private finished;
|
|
@@ -691,6 +815,11 @@ export declare class Runs {
|
|
|
691
815
|
/** Reads what decides the secrets runs of `run`'s revision are handed (needsOf), once per revision: from `given` (a
|
|
692
816
|
* start's, read from the store), else from the agent store, waiting out a busy one as a run's end does. */
|
|
693
817
|
private pinNeeds;
|
|
818
|
+
/** Just before a launch that spawns the run's process (after pinNeeds): its MCP servers' OAuth tokens near expiry are
|
|
819
|
+
* refreshed in serve (mcp-servers.ts headersForRun), so the synchronous launch hands it a fresh access token, never a
|
|
820
|
+
* refresh token. Never on a path that only reaches a live process, nor on a stop's: an authorization server that is
|
|
821
|
+
* slow to answer never holds an abort. */
|
|
822
|
+
private mcpFresh;
|
|
694
823
|
/** `run`'s pinned MCP tools: read from its directory, or at its first launch made from the granted `tools` and the
|
|
695
824
|
* servers saved now, and written before its process starts. Undefined when it grants none. */
|
|
696
825
|
private mcpPin;
|
|
@@ -698,10 +827,29 @@ export declare class Runs {
|
|
|
698
827
|
* its agent has none, and leased to this run to save unless another run of the agent holds the lease. One that cannot
|
|
699
828
|
* be had (the vendor not answering, a seal key changed) leaves its browser signed out, said in its log. */
|
|
700
829
|
private pinSignIn;
|
|
830
|
+
/** That `run` is handed `signIn`, kept before it is (forRun's keep, under its agent's sign-ins lock, so no forget comes
|
|
831
|
+
* between): false when that can't be saved, and the run is handed none. */
|
|
832
|
+
private keepHanded;
|
|
833
|
+
/** The run of `agentId` still going (its row running) that was handed the sign-in whose pointer hashes to `hash`, or
|
|
834
|
+
* any sign-in when `hash` is undefined (a pointer that does not open here): forget waits for it (sign-ins.ts). From the
|
|
835
|
+
* run this server holds, else its serve.json: a run still going need not be held yet (a recovery under way, or one it
|
|
836
|
+
* could not recover). One whose mark is MALFORMED, or whose serve.json is damaged (run.damaged for a held run, the same
|
|
837
|
+
* answer the disk read gives), counts: what it was handed is not known. */
|
|
838
|
+
handedTo(agentId: string, hash: string | undefined): Promise<string | undefined>;
|
|
839
|
+
/** The pointer of the sign-in a run this server loads was handed, among the values its rows, errors and answers never
|
|
840
|
+
* show: read only, with no lease taken (pinSignIn takes one at its next launch). `unreadable` when its agent keeps
|
|
841
|
+
* one that does not open under this server's seal key. */
|
|
842
|
+
private peekSignIn;
|
|
701
843
|
/** Lets go of the save lease the run holds on its agent's sign-in, if any: at once when its process let its sessions go
|
|
702
844
|
* (`clean`), else by the gone rule (sign-ins.ts). */
|
|
703
845
|
private releaseSignIn;
|
|
704
846
|
private launch;
|
|
847
|
+
/** Names `holder` on the run's row under `epoch`, the claim its launch made: a claim that moved on since (a take-back,
|
|
848
|
+
* a later launch) is left as it is, and a store that is busy is tried again shortly, a few times. */
|
|
849
|
+
private nameHolder;
|
|
850
|
+
/** Writes the run's newest holder to name (`naming`); a store another writer holds is tried again, soon at first, then
|
|
851
|
+
* every settle retry, while the process lives and the server runs. */
|
|
852
|
+
private writeHolder;
|
|
705
853
|
/** Writes the run's launch mark before its process is spawned: a spawn that takes the server down leaves it, and the
|
|
706
854
|
* next start fails the run rather than launch it again and go down with it. The file exists once the call returns,
|
|
707
855
|
* which a server's death does not undo; no fsync, which would hold the event loop on the disk at every launch. */
|
|
@@ -790,6 +938,29 @@ export declare class Runs {
|
|
|
790
938
|
note?: string;
|
|
791
939
|
}>;
|
|
792
940
|
private takeRaise;
|
|
941
|
+
/** A workflow run's raise (budget.ts): serve.json keeps it first, as an agentic run's does, then `cap.json` tells the
|
|
942
|
+
* run's process, whose step waiting at its cap is judged again under it, and a run whose process the pause let go is
|
|
943
|
+
* opened again (its pause's mark taken away first, so its settle does not hold it) under the raised cap (CAP_ENV),
|
|
944
|
+
* resuming from its journal. A raise while it works holds from its next check. The same raise again changes nothing. */
|
|
945
|
+
private raiseWorkflow;
|
|
946
|
+
/** Finishes the raise serve.json keeps (`max_cost_usd`), in its steps' order, each one done again harmlessly: `cap.json`
|
|
947
|
+
* takes it (a waiting process wakes on it), then a pause it answers (budget.json under a lower cap) is taken away and
|
|
948
|
+
* its run, with no process, opened again under it. A raise, its retry and a restart's settle all finish it here, so a
|
|
949
|
+
* crash between serve.json and the rest never leaves a raised run waiting for a raise. True when it took a pause away. */
|
|
950
|
+
private finishRaise;
|
|
951
|
+
/** A raised run that found no place: queued, saying it waits for one, and tried again every PLACE_RETRY_MS until it
|
|
952
|
+
* opens (finishRaise), ends or is cancelled. */
|
|
953
|
+
private waitForPlace;
|
|
954
|
+
/** Whether a raise that took a place has nothing to open now: the server is closing (the mark stays, for the next
|
|
955
|
+
* server), or the run ended, was cancelled, opened, or has no pause left. Off the queue then, unless closing. */
|
|
956
|
+
private raiseMoot;
|
|
957
|
+
/** `run` off the queue for a place: what it reserved is free, and it shows no wait for one. */
|
|
958
|
+
private leavePlaceQueue;
|
|
959
|
+
/** A raised run whose launch failed after its place was taken: to the back of the queue, its mark kept, and off it
|
|
960
|
+
* after RAISE_TRIES failures in a row (still paused at its cap; a raise retried, or the server's next start, finishes it
|
|
961
|
+
* then), so it never holds a place reserved for good. */
|
|
962
|
+
private raiseFailed;
|
|
963
|
+
private retryPlaces;
|
|
793
964
|
/** Sends a raised run its pause's follow-up, under its id (the door takes one id once), at the run's cap now: as a
|
|
794
965
|
* follow-up to a run whose process has gone (message()), so the process it starts resumes nothing and opens under the
|
|
795
966
|
* new cap, or to the process another launch started. Marked sent in serve.json. One that cannot be sent is tried
|
|
@@ -799,8 +970,10 @@ export declare class Runs {
|
|
|
799
970
|
private failRaised;
|
|
800
971
|
/** One message to an agentic run, its mode chosen by the run's state (the contract's table). `requestId`: the message's
|
|
801
972
|
* id in the run's store, which takes one message per id (a trigger's firing key); default a new one. */
|
|
802
|
-
message
|
|
973
|
+
/** `origin`: who the message is from when its person did not write it (a trigger's firing). */
|
|
974
|
+
message(run: Run, content: string, requestId?: string, { answers, origin }?: {
|
|
803
975
|
answers?: boolean;
|
|
976
|
+
origin?: MessageOrigin;
|
|
804
977
|
}): Promise<{
|
|
805
978
|
mode: "steer" | "answer" | "follow_up";
|
|
806
979
|
messageId: string;
|
|
@@ -850,81 +1023,6 @@ export declare class Runs {
|
|
|
850
1023
|
paused: boolean;
|
|
851
1024
|
status: Status;
|
|
852
1025
|
}>;
|
|
853
|
-
/** A workflow run's graph as it stands (graph-view.ts), live while it runs. */
|
|
854
|
-
graph(run: Run): Promise<{
|
|
855
|
-
stale: boolean;
|
|
856
|
-
read_at: string;
|
|
857
|
-
run: {
|
|
858
|
-
id: string;
|
|
859
|
-
agent: string;
|
|
860
|
-
revision: string;
|
|
861
|
-
status: string;
|
|
862
|
-
paused: boolean;
|
|
863
|
-
startedAt: string;
|
|
864
|
-
endedAt: string | null;
|
|
865
|
-
};
|
|
866
|
-
workflow: unknown;
|
|
867
|
-
graph: import("@parcha/agentrun-dsl/graph").WorkflowGraph;
|
|
868
|
-
nodes: Record<string, {
|
|
869
|
-
status: import("./graph-view.js").GraphNodeStatus;
|
|
870
|
-
startedAt?: string;
|
|
871
|
-
endedAt?: string;
|
|
872
|
-
branch?: string;
|
|
873
|
-
items?: {
|
|
874
|
-
index: number;
|
|
875
|
-
status: import("./graph-view.js").GraphNodeStatus;
|
|
876
|
-
executionPath: string;
|
|
877
|
-
label?: string;
|
|
878
|
-
branches?: Record<string, string>;
|
|
879
|
-
}[];
|
|
880
|
-
}>;
|
|
881
|
-
decisions: {
|
|
882
|
-
images: {
|
|
883
|
-
token: {} | null;
|
|
884
|
-
ref: {} | null;
|
|
885
|
-
url: string | null;
|
|
886
|
-
}[];
|
|
887
|
-
error_cut?: boolean | undefined;
|
|
888
|
-
id: {} | null;
|
|
889
|
-
node: string | null;
|
|
890
|
-
executionPath: {} | null;
|
|
891
|
-
item: {} | null;
|
|
892
|
-
kind: {} | null;
|
|
893
|
-
provider: {} | null;
|
|
894
|
-
model: {} | null;
|
|
895
|
-
status: {} | null;
|
|
896
|
-
questions: {} | null;
|
|
897
|
-
answers: {} | null;
|
|
898
|
-
evidence: {};
|
|
899
|
-
rule: {} | null;
|
|
900
|
-
action: {} | null;
|
|
901
|
-
cost_usd: number | null;
|
|
902
|
-
cost_basis: {} | null;
|
|
903
|
-
latency_ms: {} | null;
|
|
904
|
-
state: {} | null;
|
|
905
|
-
state_truncated: boolean;
|
|
906
|
-
error: string | null;
|
|
907
|
-
}[];
|
|
908
|
-
effects: {
|
|
909
|
-
node: string | null;
|
|
910
|
-
executionPath: string | null;
|
|
911
|
-
item: number | null;
|
|
912
|
-
tool: string;
|
|
913
|
-
status: string;
|
|
914
|
-
input: unknown;
|
|
915
|
-
output: unknown;
|
|
916
|
-
error: string | null;
|
|
917
|
-
error_cut?: boolean;
|
|
918
|
-
startedAt: string;
|
|
919
|
-
endedAt: string | null;
|
|
920
|
-
}[];
|
|
921
|
-
totals: {
|
|
922
|
-
cost_usd: number | null;
|
|
923
|
-
decisions: number;
|
|
924
|
-
effects: number;
|
|
925
|
-
elapsed_ms: number | null;
|
|
926
|
-
};
|
|
927
|
-
}>;
|
|
928
1026
|
/** How long a run's process gets after SIGTERM before SIGKILL: its drain and a second to exit. */
|
|
929
1027
|
private killAfterMs;
|
|
930
1028
|
/** What close() will wait on: the runs whose processes are left to finish their turn (those this server started, and
|
|
@@ -939,15 +1037,25 @@ export declare class Runs {
|
|
|
939
1037
|
cost(run: Run): {
|
|
940
1038
|
so_far_usd?: number | undefined;
|
|
941
1039
|
unpriced?: number | undefined;
|
|
1040
|
+
overshoot_bound_usd?: undefined;
|
|
1041
|
+
usd: number | null;
|
|
1042
|
+
basis: string;
|
|
1043
|
+
charge_state: null;
|
|
1044
|
+
cap_usd: number | null;
|
|
1045
|
+
} | {
|
|
1046
|
+
so_far_usd?: number | undefined;
|
|
1047
|
+
unpriced?: number | undefined;
|
|
1048
|
+
overshoot_bound_usd: number;
|
|
942
1049
|
usd: number | null;
|
|
943
1050
|
basis: string;
|
|
944
1051
|
charge_state: null;
|
|
945
1052
|
cap_usd: number | null;
|
|
946
1053
|
};
|
|
947
|
-
/** `Run`, as the contract shows it. `known`: its stored row as the
|
|
948
|
-
* just written has none worth reading (`{ stored: null }`: it is
|
|
949
|
-
* must not read the store once the run exists, since a busy store
|
|
950
|
-
|
|
1054
|
+
/** `Run`, as the contract shows it, its console page at `origin` (server.ts linkOrigin). `known`: its stored row as the
|
|
1055
|
+
* caller already has it, so nothing is read; a run just written has none worth reading (`{ stored: null }`: it is
|
|
1056
|
+
* neither archived nor ended), and its start's answer must not read the store once the run exists, since a busy store
|
|
1057
|
+
* would then refuse a run that runs. */
|
|
1058
|
+
view(run: Run, origin: string, known?: {
|
|
951
1059
|
stored: RunRow | null;
|
|
952
1060
|
}): Promise<{
|
|
953
1061
|
created_at: string;
|
|
@@ -963,11 +1071,22 @@ export declare class Runs {
|
|
|
963
1071
|
cost: {
|
|
964
1072
|
so_far_usd?: number | undefined;
|
|
965
1073
|
unpriced?: number | undefined;
|
|
1074
|
+
overshoot_bound_usd?: undefined;
|
|
1075
|
+
usd: number | null;
|
|
1076
|
+
basis: string;
|
|
1077
|
+
charge_state: null;
|
|
1078
|
+
cap_usd: number | null;
|
|
1079
|
+
} | {
|
|
1080
|
+
so_far_usd?: number | undefined;
|
|
1081
|
+
unpriced?: number | undefined;
|
|
1082
|
+
overshoot_bound_usd: number;
|
|
966
1083
|
usd: number | null;
|
|
967
1084
|
basis: string;
|
|
968
1085
|
charge_state: null;
|
|
969
1086
|
cap_usd: number | null;
|
|
970
1087
|
};
|
|
1088
|
+
cap_mode: "expected" | "strict" | null;
|
|
1089
|
+
approvals: "ask" | "never";
|
|
971
1090
|
archived_at: string | null;
|
|
972
1091
|
imported_from: {
|
|
973
1092
|
source: string;
|
|
@@ -975,13 +1094,14 @@ export declare class Runs {
|
|
|
975
1094
|
} | null;
|
|
976
1095
|
trigger: RunTrigger | null;
|
|
977
1096
|
learning: {
|
|
978
|
-
|
|
1097
|
+
given?: import("./learning.js").NoteUsed[];
|
|
1098
|
+
read?: import("./learning.js").NoteUsed[];
|
|
979
1099
|
learned?: import("./learning.js").NoteLearned[];
|
|
980
1100
|
pending?: import("./learning.js").NoteUsed[];
|
|
981
1101
|
skills?: import("./learning.js").LearnedFile[];
|
|
982
1102
|
workflows?: import("./learning.js").LearnedFile[];
|
|
983
1103
|
state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
|
|
984
|
-
reason: "
|
|
1104
|
+
reason: "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "cancelled" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
|
|
985
1105
|
detail: string | null;
|
|
986
1106
|
at: string;
|
|
987
1107
|
} | null;
|
|
@@ -991,6 +1111,7 @@ export declare class Runs {
|
|
|
991
1111
|
run_id: string;
|
|
992
1112
|
agent_id: string;
|
|
993
1113
|
agent_version: number;
|
|
1114
|
+
console_url: string;
|
|
994
1115
|
revision: string;
|
|
995
1116
|
kind: RevisionKind;
|
|
996
1117
|
sha: null;
|
|
@@ -999,7 +1120,7 @@ export declare class Runs {
|
|
|
999
1120
|
title: string;
|
|
1000
1121
|
place: Place;
|
|
1001
1122
|
}>;
|
|
1002
|
-
summary(run: Run): Promise<{
|
|
1123
|
+
summary(run: Run, origin: string): Promise<{
|
|
1003
1124
|
created_at: string;
|
|
1004
1125
|
ended_at: string | null;
|
|
1005
1126
|
error: RunError | null;
|
|
@@ -1008,6 +1129,15 @@ export declare class Runs {
|
|
|
1008
1129
|
cost: {
|
|
1009
1130
|
so_far_usd?: number | undefined;
|
|
1010
1131
|
unpriced?: number | undefined;
|
|
1132
|
+
overshoot_bound_usd?: undefined;
|
|
1133
|
+
usd: number | null;
|
|
1134
|
+
basis: string;
|
|
1135
|
+
charge_state: null;
|
|
1136
|
+
cap_usd: number | null;
|
|
1137
|
+
} | {
|
|
1138
|
+
so_far_usd?: number | undefined;
|
|
1139
|
+
unpriced?: number | undefined;
|
|
1140
|
+
overshoot_bound_usd: number;
|
|
1011
1141
|
usd: number | null;
|
|
1012
1142
|
basis: string;
|
|
1013
1143
|
charge_state: null;
|
|
@@ -1021,23 +1151,25 @@ export declare class Runs {
|
|
|
1021
1151
|
trigger: RunTrigger | null;
|
|
1022
1152
|
learning: ({
|
|
1023
1153
|
state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
|
|
1024
|
-
reason: "
|
|
1154
|
+
reason: "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "cancelled" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
|
|
1025
1155
|
detail: string | null;
|
|
1026
1156
|
} & Omit<{
|
|
1027
|
-
|
|
1157
|
+
given?: import("./learning.js").NoteUsed[];
|
|
1158
|
+
read?: import("./learning.js").NoteUsed[];
|
|
1028
1159
|
learned?: import("./learning.js").NoteLearned[];
|
|
1029
1160
|
pending?: import("./learning.js").NoteUsed[];
|
|
1030
1161
|
skills?: import("./learning.js").LearnedFile[];
|
|
1031
1162
|
workflows?: import("./learning.js").LearnedFile[];
|
|
1032
1163
|
state: "proposed" | "merged" | "seeded" | "reflecting" | "dropped";
|
|
1033
|
-
reason: "
|
|
1164
|
+
reason: "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "cancelled" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
|
|
1034
1165
|
detail: string | null;
|
|
1035
1166
|
at: string;
|
|
1036
|
-
}, "at" | "
|
|
1167
|
+
}, "at" | "reason" | "detail" | "state">) | null;
|
|
1037
1168
|
effort?: string | undefined;
|
|
1038
1169
|
run_id: string;
|
|
1039
1170
|
agent_id: string;
|
|
1040
1171
|
agent_version: number;
|
|
1172
|
+
console_url: string;
|
|
1041
1173
|
revision: string;
|
|
1042
1174
|
kind: RevisionKind;
|
|
1043
1175
|
sha: null;
|
|
@@ -1049,7 +1181,7 @@ export declare class Runs {
|
|
|
1049
1181
|
statusOfRow(row: RunRow): Promise<Status>;
|
|
1050
1182
|
/** A run's summary for a list. An ended run this server holds no Run for is read from its row and its serve.json alone,
|
|
1051
1183
|
* not its store; `versions` numbers its agent's revisions. */
|
|
1052
|
-
summaryOfRow(row: RunRow, versions: Map<string, number
|
|
1184
|
+
summaryOfRow(row: RunRow, versions: Map<string, number>, origin: string): Promise<Awaited<ReturnType<Runs["summary"]>>>;
|
|
1053
1185
|
/** A key was saved on this server or deleted from it: each held run's learning row and decision rows shown again, cut
|
|
1054
1186
|
* of the keys as they are now (learning-run.ts shown, decision-rows.ts), as its view and its lists already are from
|
|
1055
1187
|
* the next read on. */
|
|
@@ -1066,4 +1198,3 @@ export declare class Runs {
|
|
|
1066
1198
|
final: boolean;
|
|
1067
1199
|
}>;
|
|
1068
1200
|
}
|
|
1069
|
-
export {};
|