@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/run-box.d.ts
CHANGED
|
@@ -14,12 +14,18 @@ export declare const NET_LABEL = "agentrun.net";
|
|
|
14
14
|
export declare const netLabelOf: (allow: readonly string[]) => string;
|
|
15
15
|
/** And this one, the same on every run's box, which the start's sweep lists them by. */
|
|
16
16
|
export declare const KIND_LABEL = "agentrun.box";
|
|
17
|
+
/** And, on a Docker box, the epoch of the run's claim its process held when it made it (runs.ts launch, RUN_EPOCH_ENV). */
|
|
18
|
+
export declare const EPOCH_LABEL = "agentrun.epoch";
|
|
19
|
+
/** What a run's model is told, once, after its process made a new box in place of the one an earlier process left: the
|
|
20
|
+
* run's files are the same, but whatever the old box held outside them is not. */
|
|
21
|
+
export declare const BOX_REPLACED_NOTE = "this run's box was replaced after a restart: /workspace is kept; packages installed outside it and /tmp are gone; reinstall what you need";
|
|
17
22
|
/** The whole environment of a box's programs: a constant, never this process's. */
|
|
18
23
|
export declare const BOX_ENV: Readonly<Record<string, string>>;
|
|
19
24
|
/** How long a box lives whatever happens to the server: a bound on a leaked box, never its clean end. */
|
|
20
25
|
export declare const BOX_LIFETIME_MS: number;
|
|
21
|
-
/** A
|
|
22
|
-
|
|
26
|
+
/** A box command's deadline when its call names none: bash's own default (coding-tools.ts BASH_DEFAULT_TIMEOUT_S), which
|
|
27
|
+
* bash always names, so this is the backstop for any other command. */
|
|
28
|
+
export declare const BASH_TIMEOUT_MS = 120000;
|
|
23
29
|
/** The image a Docker box starts from (box-image.ts, where the server makes it ready). */
|
|
24
30
|
export { DEFAULT_DOCKER_IMAGE, DOCKER_IMAGE_ENV } from "./box-image.js";
|
|
25
31
|
/** The settings that bound a Docker box; unset, their defaults: enough for a build, and safe on a laptop, where one run's
|
|
@@ -70,6 +76,9 @@ export declare const BOX_SYNC_FILE = "box-sync.json";
|
|
|
70
76
|
* process never writes it; a pull folds these lines into the mark it compares against, for paths the mark lacks, so
|
|
71
77
|
* the box's later edit of such a file comes back instead of reading as a change the server made. */
|
|
72
78
|
export declare const BOX_MIRRORED_FILE = "box-mirrored.jsonl";
|
|
79
|
+
/** In a run's directory while the box the server destroyed for a new one has no successor yet (ensureRemoteBox): the
|
|
80
|
+
* attempt that makes one says the box was replaced, though the one that destroyed the old box failed after it. */
|
|
81
|
+
export declare const BOX_REPLACED_FILE = "box-replaced";
|
|
73
82
|
type Mount = NonNullable<BoxSpec["mounts"]>[number];
|
|
74
83
|
/** `source`, when it is below `root` through no link and is its own canonical path; else a refusal naming the link.
|
|
75
84
|
* `root`, the data root, is canonical already (startServe), so a link above it is the operator's choice. */
|
|
@@ -105,7 +114,8 @@ export type RunBox = {
|
|
|
105
114
|
hostWork: string;
|
|
106
115
|
bound(): Promise<boolean>;
|
|
107
116
|
leftEnded(context: Context): Promise<void>;
|
|
108
|
-
mirror?: (path: string, data: string | Uint8Array) => Promise<void>;
|
|
117
|
+
mirror?: (path: string, data: string | Uint8Array) => Promise<void>; /** BOX_REPLACED_NOTE once, after this process replaced an earlier process's box; else nothing. */
|
|
118
|
+
replaced(): string | undefined;
|
|
109
119
|
};
|
|
110
120
|
/** Where a run's box comes from: a provider of this process's own (Docker, or the tests' faux box), or, for a remote box,
|
|
111
121
|
* the server's relay in data root `relay`. A bare function is a provider of this process's own. */
|
|
@@ -119,6 +129,7 @@ export declare function runBox(given: BoxSource | (() => Promise<RunBoxes>), run
|
|
|
119
129
|
root: string;
|
|
120
130
|
dir: string;
|
|
121
131
|
place: Place;
|
|
132
|
+
epoch: number;
|
|
122
133
|
}): RunBox;
|
|
123
134
|
/** A remote box's limits, where its provider takes them (the VM box: CPUs and memory, from the same settings as a Docker
|
|
124
135
|
* box's, boxLimitsOf). */
|
|
@@ -155,6 +166,7 @@ export declare function ensureRemoteBox(boxes: BoxProvider, run: {
|
|
|
155
166
|
}, context: Context, options?: RemoteBoxOptions): Promise<{
|
|
156
167
|
id: string;
|
|
157
168
|
made: boolean;
|
|
169
|
+
replaced?: boolean;
|
|
158
170
|
}>;
|
|
159
171
|
/** What a pull of a remote box brought back; undefined when the run has no box (none made, or it is gone). */
|
|
160
172
|
export type RemotePull = {
|
|
@@ -178,6 +190,13 @@ export declare function pullRemoteBox(boxes: BoxProvider, run: {
|
|
|
178
190
|
id: string;
|
|
179
191
|
dir: string;
|
|
180
192
|
}, context: Context, wake?: () => Promise<number>): Promise<RemotePull | undefined>;
|
|
193
|
+
/** The fence of a run's boxes for a process under claim epoch `run.epoch`: every box of the run whose epoch is lower (or
|
|
194
|
+
* that has none: made before boxes had one) is destroyed; how many. One of a higher epoch is a later process's: this
|
|
195
|
+
* one is not the run's holder, so it throws, and makes and destroys nothing. */
|
|
196
|
+
export declare function fenceRunBoxes(boxes: BoxProvider, run: {
|
|
197
|
+
id: string;
|
|
198
|
+
epoch: number;
|
|
199
|
+
}, context: Context): Promise<number>;
|
|
181
200
|
/** Destroys every box labelled with run `runId`; how many it destroyed. */
|
|
182
201
|
export declare function destroyRunBoxes(boxes: BoxProvider, runId: string, context: Context): Promise<number>;
|
|
183
202
|
/** The start's sweep: destroys every run's box whose run `ended` says is over, once `before` (a remote box's pull) for its
|
package/dist/run-box.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// A sandbox run's box: one per run, made on the first call that runs in it and labelled with the run's id, so the label
|
|
2
|
-
// is the record (a bound box's read, write and edit run on this machine: bound-files.ts). A
|
|
3
|
-
//
|
|
2
|
+
// is the record (a bound box's read, write and edit run on this machine: bound-files.ts). A Docker box is labelled with
|
|
3
|
+
// the epoch of the claim its process holds too (EPOCH_LABEL): a run's process that starts again, under a later epoch,
|
|
4
|
+
// destroys every box of the run of an earlier one before it makes its own, and its model is told once that the box was
|
|
5
|
+
// replaced (BOX_REPLACED_NOTE). Serve destroys it at
|
|
4
6
|
// every settle (a cancel included) and at archive, and its start sweeps the boxes of runs that have ended. A box gets the
|
|
5
7
|
// run's work/ only, at BOX_WORK, a fixed environment (never this process's, so no key or token enters it), no network
|
|
6
8
|
// (or, on Docker with the server's host list set, those hosts alone, through this process's egress proxy: box-egress.ts),
|
|
@@ -15,13 +17,14 @@
|
|
|
15
17
|
// way: the server makes, seeds, pulls and ends it with its own client, and the run's process runs pi-transport's VM
|
|
16
18
|
// provider over the relay's VM half (box-relay-vm.ts), which holds the client and the token. It has no network.
|
|
17
19
|
import { createHash } from "node:crypto";
|
|
18
|
-
import { appendFile, lstat, readFile, realpath } from "node:fs/promises";
|
|
20
|
+
import { appendFile, lstat, readFile, realpath, rm, writeFile } from "node:fs/promises";
|
|
19
21
|
import { isAbsolute, join, posix, relative, sep } from "node:path";
|
|
20
22
|
import { pathToFileURL } from "node:url";
|
|
21
23
|
import { BACKGROUND_CONTEXT as BACKGROUND } from "@earendil-works/chord/context";
|
|
22
24
|
import { EGRESS_MOUNT, egressBlockedBy, forwarderStart, hostEgress, PROXY_ENV, relayFailed, runBoxAllowOf } from "./box-egress.js";
|
|
23
25
|
import { runBoxVolumeOf, vmDocker, vmEgress } from "./box-egress-vm.js";
|
|
24
26
|
import { awaitImage, boxImageOf } from "./box-image.js";
|
|
27
|
+
import { egressParentOf, runBoxPathsOf } from "./box-paths.js";
|
|
25
28
|
import { RELAYED_KEY, relayedBox, relayFetch } from "./box-relay.js";
|
|
26
29
|
import { VM_PROVIDER } from "./boxes.js";
|
|
27
30
|
import { readJson, writeDurable } from "./files.js";
|
|
@@ -37,12 +40,18 @@ export const NET_LABEL = "agentrun.net";
|
|
|
37
40
|
export const netLabelOf = (allow) => createHash("sha256").update([...new Set(allow.map((host) => host.toLowerCase()))].sort().join(",")).digest("hex").slice(0, 16);
|
|
38
41
|
/** And this one, the same on every run's box, which the start's sweep lists them by. */
|
|
39
42
|
export const KIND_LABEL = "agentrun.box";
|
|
43
|
+
/** And, on a Docker box, the epoch of the run's claim its process held when it made it (runs.ts launch, RUN_EPOCH_ENV). */
|
|
44
|
+
export const EPOCH_LABEL = "agentrun.epoch";
|
|
45
|
+
/** What a run's model is told, once, after its process made a new box in place of the one an earlier process left: the
|
|
46
|
+
* run's files are the same, but whatever the old box held outside them is not. */
|
|
47
|
+
export const BOX_REPLACED_NOTE = "this run's box was replaced after a restart: /workspace is kept; packages installed outside it and /tmp are gone; reinstall what you need";
|
|
40
48
|
/** The whole environment of a box's programs: a constant, never this process's. */
|
|
41
49
|
export const BOX_ENV = Object.freeze({ LANG: "C.UTF-8", HOME: "/tmp" });
|
|
42
50
|
/** How long a box lives whatever happens to the server: a bound on a leaked box, never its clean end. */
|
|
43
51
|
export const BOX_LIFETIME_MS = 24 * 60 * 60_000;
|
|
44
|
-
/** A
|
|
45
|
-
|
|
52
|
+
/** A box command's deadline when its call names none: bash's own default (coding-tools.ts BASH_DEFAULT_TIMEOUT_S), which
|
|
53
|
+
* bash always names, so this is the backstop for any other command. */
|
|
54
|
+
export const BASH_TIMEOUT_MS = 120_000;
|
|
46
55
|
/** The image a Docker box starts from (box-image.ts, where the server makes it ready). */
|
|
47
56
|
export { DEFAULT_DOCKER_IMAGE, DOCKER_IMAGE_ENV } from "./box-image.js";
|
|
48
57
|
/** The settings that bound a Docker box; unset, their defaults: enough for a build, and safe on a laptop, where one run's
|
|
@@ -147,6 +156,9 @@ export const BOX_SYNC_FILE = "box-sync.json";
|
|
|
147
156
|
* process never writes it; a pull folds these lines into the mark it compares against, for paths the mark lacks, so
|
|
148
157
|
* the box's later edit of such a file comes back instead of reading as a change the server made. */
|
|
149
158
|
export const BOX_MIRRORED_FILE = "box-mirrored.jsonl";
|
|
159
|
+
/** In a run's directory while the box the server destroyed for a new one has no successor yet (ensureRemoteBox): the
|
|
160
|
+
* attempt that makes one says the box was replaced, though the one that destroyed the old box failed after it. */
|
|
161
|
+
export const BOX_REPLACED_FILE = "box-replaced";
|
|
150
162
|
/** `source`, when it is below `root` through no link and is its own canonical path; else a refusal naming the link.
|
|
151
163
|
* `root`, the data root, is canonical already (startServe), so a link above it is the operator's choice. */
|
|
152
164
|
export async function mountSource(root, source) {
|
|
@@ -185,13 +197,16 @@ export async function runBoxProvider(place, env, root) {
|
|
|
185
197
|
const image = boxImageOf(env);
|
|
186
198
|
// The list the server resolved for this run's box (box-egress.ts boxNetworkOf), or none.
|
|
187
199
|
const allow = runBoxAllowOf(env);
|
|
200
|
+
// A server in a container: where its Docker has the data directory (box-paths.ts), which a box's mounts come from, the
|
|
201
|
+
// egress proxy's directory with them. On a host, none: a box binds this machine's paths.
|
|
202
|
+
const paths = runBoxPathsOf(env);
|
|
188
203
|
// On a Mac, the server's proxy container's volume (box-egress-vm.ts), which every box mounts read-only.
|
|
189
204
|
const volume = allow === "none" ? undefined : runBoxVolumeOf(env);
|
|
190
205
|
return {
|
|
191
|
-
...dockerBoxes({ image, ...(user ? { user } : {}), ...boxLimitsOf(env), dropCapabilities: true, ...(volume ? { volumes: [{ name: volume, target: EGRESS_MOUNT, readOnly: true }] } : {}) }),
|
|
206
|
+
...dockerBoxes({ image, ...(user ? { user } : {}), ...boxLimitsOf(env), dropCapabilities: true, ...(paths ? { paths } : {}), ...(volume ? { volumes: [{ name: volume, target: EGRESS_MOUNT, readOnly: true }] } : {}) }),
|
|
192
207
|
ready: (context, note) => awaitImage(root, image, context, note),
|
|
193
208
|
// Where the proxy runs: the one line that picks it (box-egress.ts BoxEgress).
|
|
194
|
-
...(allow === "none" ? {} : { egress: volume ? vmEgress : hostEgress(allow, env, egressLog), net: netLabelOf(allow) }),
|
|
209
|
+
...(allow === "none" ? {} : { egress: volume ? vmEgress : hostEgress(allow, env, egressLog, paths ? egressParentOf(root) : undefined), net: netLabelOf(allow) }),
|
|
195
210
|
};
|
|
196
211
|
}
|
|
197
212
|
/** The tests' faux box provider, from its module. */
|
|
@@ -199,12 +214,20 @@ export const fauxBoxes = async (module, root) => (await import(pathToFileURL(mod
|
|
|
199
214
|
export function runBox(given, run) {
|
|
200
215
|
const source = typeof given === "function" ? { provider: given } : given;
|
|
201
216
|
let held;
|
|
217
|
+
// Whether this process destroyed a box of an earlier one, until its model is told (replaced).
|
|
218
|
+
let replaced;
|
|
219
|
+
const fenced = (destroyed) => void (destroyed > 0 && replaced === undefined && (replaced = "untold"));
|
|
202
220
|
// What the host tools filed while no box was open in this process: a box a process before it made has no seed now, so
|
|
203
221
|
// these go in when it opens (and to a new box, whose seed carries them anyway, again: the same bytes).
|
|
204
222
|
const filed = new Map();
|
|
205
223
|
const open = async (context, note) => {
|
|
206
224
|
const { boxEnv, endLeftCommands } = await import("@parcha/pi-transport/hands");
|
|
207
|
-
const
|
|
225
|
+
const opened = "relay" in source ? await relayedRunBox(source.relay, run, context) : await localRunBox(await source.provider(), run, context, note, fenced);
|
|
226
|
+
const { box, made } = opened;
|
|
227
|
+
// A remote box the server made in place of the run's (another list, or its files at an older place): told as a
|
|
228
|
+
// Docker box an earlier process left is.
|
|
229
|
+
if ("replaced" in opened && opened.replaced)
|
|
230
|
+
fenced(1);
|
|
208
231
|
if (!made) {
|
|
209
232
|
// A process before this one left it: what it still runs is killed first, since its calls were answered interrupted.
|
|
210
233
|
const ended = await endLeftCommands(box, context);
|
|
@@ -260,7 +283,11 @@ export function runBox(given, run) {
|
|
|
260
283
|
checked ??= (async () => {
|
|
261
284
|
if (held)
|
|
262
285
|
return void (await held);
|
|
263
|
-
|
|
286
|
+
// An earlier process's box is destroyed (fenceRunBoxes), and none made for a file tool; one of this epoch's own
|
|
287
|
+
// (opened before, then lost) is taken over.
|
|
288
|
+
const boxes = await provider();
|
|
289
|
+
fenced(await fenceRunBoxes(boxes, run, context));
|
|
290
|
+
const listed = await boxes.list({ [RUN_LABEL]: run.id }, context);
|
|
264
291
|
if (!listed.ok)
|
|
265
292
|
throw listed.error;
|
|
266
293
|
if (listed.value.length)
|
|
@@ -271,6 +298,12 @@ export function runBox(given, run) {
|
|
|
271
298
|
});
|
|
272
299
|
return checked;
|
|
273
300
|
},
|
|
301
|
+
replaced() {
|
|
302
|
+
if (replaced !== "untold")
|
|
303
|
+
return undefined;
|
|
304
|
+
replaced = "told";
|
|
305
|
+
return BOX_REPLACED_NOTE;
|
|
306
|
+
},
|
|
274
307
|
...("relay" in source
|
|
275
308
|
? {
|
|
276
309
|
// An open (or opening) box is written now; with none, the file waits for the box's open.
|
|
@@ -327,7 +360,7 @@ const egressLog = (line) => void process.stderr.write(`${JSON.stringify({ at: ne
|
|
|
327
360
|
* (the provider's `ready`, `note` writing the one timeline row while it is built or pulled). A box that reaches the
|
|
328
361
|
* server's host list has the run's egress proxy started first, its directory bound read-only and the proxy variables
|
|
329
362
|
* in its environment, and, made or found, its relay started (startRelay). */
|
|
330
|
-
async function localRunBox(boxes, run, context, note) {
|
|
363
|
+
async function localRunBox(boxes, run, context, note, fenced) {
|
|
331
364
|
let egress;
|
|
332
365
|
try {
|
|
333
366
|
egress = boxes.egress ? await boxes.egress(run.id) : undefined;
|
|
@@ -335,6 +368,9 @@ async function localRunBox(boxes, run, context, note) {
|
|
|
335
368
|
catch (error) {
|
|
336
369
|
throw new Error(`the run's box could not have its network: ${error.message}`);
|
|
337
370
|
}
|
|
371
|
+
// A box an earlier process made, under an earlier epoch, goes first: its mounts are the same folder, so its writer is
|
|
372
|
+
// gone before this one starts. Never taken over.
|
|
373
|
+
fenced(await fenceRunBoxes(boxes, run, context));
|
|
338
374
|
// A box a process before this one made with another network (none, or another list: the server's setting changed
|
|
339
375
|
// since) is made again: its mounts and environment are fixed at its create. Its work/ is this machine's, bound.
|
|
340
376
|
await destroyListed(boxes, { [RUN_LABEL]: run.id }, (labels) => labels[NET_LABEL] !== boxes.net, context);
|
|
@@ -363,14 +399,19 @@ async function localRunBox(boxes, run, context, note) {
|
|
|
363
399
|
const spec = {
|
|
364
400
|
env: egress ? { ...BOX_ENV, ...PROXY_ENV } : BOX_ENV, workspace: agentWorkDir(run.dir, run.place),
|
|
365
401
|
mounts: [...(await boxMounts(run.root, run.dir, run.place)), ...(egress?.mount ? [egress.mount] : [])],
|
|
366
|
-
labels: { [RUN_LABEL]: run.id, [KIND_LABEL]: "run", ...(boxes.net ? { [NET_LABEL]: boxes.net } : {}) }, network: "none", maxLifetimeMs: BOX_LIFETIME_MS,
|
|
402
|
+
labels: { [RUN_LABEL]: run.id, [KIND_LABEL]: "run", [EPOCH_LABEL]: String(run.epoch), ...(boxes.net ? { [NET_LABEL]: boxes.net } : {}) }, network: "none", maxLifetimeMs: BOX_LIFETIME_MS,
|
|
367
403
|
};
|
|
404
|
+
// Of the run's boxes, the ones this process may destroy: its own epoch's and lower ones, never a later process's.
|
|
405
|
+
const notLater = (labels) => !(Number(labels[EPOCH_LABEL]) > run.epoch);
|
|
368
406
|
const made = await boxes.create(spec, context);
|
|
369
407
|
if (!made.ok) {
|
|
370
408
|
// A create that failed may still have left a box (a client cut off while the daemon made it): it carries the label.
|
|
371
|
-
await
|
|
409
|
+
await destroyListed(boxes, { [RUN_LABEL]: run.id }, notLater, context).catch(() => undefined);
|
|
372
410
|
throw new Error(`the run's box could not be made: ${made.error.message}`);
|
|
373
411
|
}
|
|
412
|
+
// The fence and the create are not one step: an earlier process's own create, still in flight when it was killed, may
|
|
413
|
+
// have landed since. Its box goes now, not at the end of its lifetime.
|
|
414
|
+
await destroyListed(boxes, { [RUN_LABEL]: run.id }, (labels) => !(Number(labels[EPOCH_LABEL]) >= run.epoch), context);
|
|
374
415
|
if (egress)
|
|
375
416
|
await startRelay(made.value, egress.socket, context, note);
|
|
376
417
|
return { box: made.value, made: true };
|
|
@@ -406,7 +447,7 @@ async function relayedRunBox(root, run, context) {
|
|
|
406
447
|
throw new Error(`the run's box could not be reached: ${attached.error.message}`);
|
|
407
448
|
if (!attached.value)
|
|
408
449
|
throw new Error(`the run's box ${given.id} is not running`);
|
|
409
|
-
return { box: attached.value, made: given.made };
|
|
450
|
+
return { box: attached.value, made: given.made, ...(given.replaced ? { replaced: true } : {}) };
|
|
410
451
|
}
|
|
411
452
|
/** The run's process's Daytona provider: its calls go to the relay, which adds the key. */
|
|
412
453
|
async function relayedDaytona(root, runDir, runId, apiUrl) {
|
|
@@ -454,7 +495,9 @@ export async function ensureRemoteBox(boxes, run, context, options = {}) {
|
|
|
454
495
|
let box = await runningRunBox(boxes, run.id, context, wake);
|
|
455
496
|
let made = false;
|
|
456
497
|
const facts = box?.facts();
|
|
457
|
-
|
|
498
|
+
// Kept with its network as asked, and its work/ where every box has it now (BOX_WORK): one made when boxes had it
|
|
499
|
+
// elsewhere is pulled from there, whole, and made again.
|
|
500
|
+
const keep = facts?.workspace === BOX_WORK && (facts?.network === "none" || (facts?.network === "allowlist" && allow !== "none" && sameHosts(facts.allow, allow)));
|
|
458
501
|
if (box && !keep) {
|
|
459
502
|
// Its files first, whole: a box replaced here holds nothing only it had. One whose copy back fails, or is not whole,
|
|
460
503
|
// is kept for a later copy, and the call refused, so no tool runs in it.
|
|
@@ -462,8 +505,10 @@ export async function ensureRemoteBox(boxes, run, context, options = {}) {
|
|
|
462
505
|
await pull(boxes, run, context, wake);
|
|
463
506
|
}
|
|
464
507
|
catch (error) {
|
|
465
|
-
throw new Error(`the run's box has another host list than this server's now (or a network it does not ask for), and its files could not all be copied back, so it is kept and not used: ${error.message}`);
|
|
508
|
+
throw new Error(`the run's box has another host list than this server's now (or a network it does not ask for, or its files outside /workspace), and its files could not all be copied back, so it is kept and not used: ${error.message}`);
|
|
466
509
|
}
|
|
510
|
+
// Noted before the old box goes: should what follows fail, the attempt that makes its successor still says so.
|
|
511
|
+
await writeFile(join(run.dir, BOX_REPLACED_FILE), "");
|
|
467
512
|
await destroyRunBoxes(boxes, run.id, context);
|
|
468
513
|
box = undefined;
|
|
469
514
|
}
|
|
@@ -496,7 +541,10 @@ export async function ensureRemoteBox(boxes, run, context, options = {}) {
|
|
|
496
541
|
}
|
|
497
542
|
await keepMark(run.dir, { box: box.id, mark: seeded.value.mark });
|
|
498
543
|
}
|
|
499
|
-
|
|
544
|
+
// `replaced`: a box the run had was destroyed for this one (in this attempt or a failed one before it), and what it
|
|
545
|
+
// held outside the run's files with it. Said once.
|
|
546
|
+
const replaced = await rm(join(run.dir, BOX_REPLACED_FILE)).then(() => true, (error) => (error.code === "ENOENT" ? false : Promise.reject(error)));
|
|
547
|
+
return { id: box.id, made, ...(replaced ? { replaced } : {}) };
|
|
500
548
|
}
|
|
501
549
|
/** A pull that did not bring the box's work/ back whole: what it wrote is kept, with its mark, and the box must stay.
|
|
502
550
|
* `lasting`: a stop another pull will meet again (an archive the extractor cannot read, or a limit a pull that wrote
|
|
@@ -527,7 +575,8 @@ export async function pullRemoteBox(boxes, run, context, wake) {
|
|
|
527
575
|
for (let round = 1;; round++) {
|
|
528
576
|
const kept = await markOf(run.dir);
|
|
529
577
|
const since = kept?.box === box.id ? await withMirrored(run.dir, kept.mark) : undefined;
|
|
530
|
-
|
|
578
|
+
// From where this box has the run's work/: BOX_WORK, or, for one made before every box had it there, its own.
|
|
579
|
+
const pulled = await pullDir(box, { from: box.facts().workspace ?? BOX_WORK, to: join(run.dir, "work"), ...(since ? { since } : {}), mirrorDeletes: true, overwrite: "if_unchanged" }, context);
|
|
531
580
|
if (!pulled.ok)
|
|
532
581
|
throw new Error(`the run's files could not be copied back from its box: ${pulled.error.message}`);
|
|
533
582
|
// What it wrote is whole and in the mark, a stopped pull's too: the next pull asks only for the rest.
|
|
@@ -568,6 +617,18 @@ async function attachRunBox(boxes, runId, context) {
|
|
|
568
617
|
}
|
|
569
618
|
return undefined;
|
|
570
619
|
}
|
|
620
|
+
/** The fence of a run's boxes for a process under claim epoch `run.epoch`: every box of the run whose epoch is lower (or
|
|
621
|
+
* that has none: made before boxes had one) is destroyed; how many. One of a higher epoch is a later process's: this
|
|
622
|
+
* one is not the run's holder, so it throws, and makes and destroys nothing. */
|
|
623
|
+
export async function fenceRunBoxes(boxes, run, context) {
|
|
624
|
+
const listed = await boxes.list({ [RUN_LABEL]: run.id }, context);
|
|
625
|
+
if (!listed.ok)
|
|
626
|
+
throw listed.error;
|
|
627
|
+
const later = listed.value.find((ref) => Number(ref.labels[EPOCH_LABEL]) > run.epoch);
|
|
628
|
+
if (later)
|
|
629
|
+
throw new Error(`the run's box ${later.id} is a later launch's (epoch ${later.labels[EPOCH_LABEL]}, this process's ${run.epoch}): this process no longer holds the run`);
|
|
630
|
+
return destroyListed(boxes, { [RUN_LABEL]: run.id }, (labels) => !(Number(labels[EPOCH_LABEL]) >= run.epoch), context);
|
|
631
|
+
}
|
|
571
632
|
/** Destroys every box labelled with run `runId`; how many it destroyed. */
|
|
572
633
|
export async function destroyRunBoxes(boxes, runId, context) {
|
|
573
634
|
return destroyListed(boxes, { [RUN_LABEL]: runId }, () => true, context);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ComputerKind, ComputerSetting } from "./computer-setting.js";
|
|
2
|
+
/** What a computer is doing, as a run reads it. */
|
|
3
|
+
export type ComputerState = "starting" | "ready" | "taken_over" | "ended" | "failed";
|
|
4
|
+
/** The port the run read's computer field reads: run `runId`'s computer state with the owner's hold, "taken_over" while
|
|
5
|
+
* the owner holds it, else `state` as given. */
|
|
6
|
+
export type ComputerStateOf = (runId: string, state: ComputerState) => ComputerState;
|
|
7
|
+
/** A run, as much of it as its computer's field reads. */
|
|
8
|
+
export type RunStateRead = {
|
|
9
|
+
id: string;
|
|
10
|
+
status: string;
|
|
11
|
+
error?: {
|
|
12
|
+
code: string;
|
|
13
|
+
message: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export type RunComputerField = {
|
|
17
|
+
kind: ComputerKind;
|
|
18
|
+
provider: string;
|
|
19
|
+
state: ComputerState;
|
|
20
|
+
why?: string;
|
|
21
|
+
};
|
|
22
|
+
/** The run's `computer` field: absent for a run with none; failed with why when its computer could not be had; ended
|
|
23
|
+
* once the run is over; else starting (queued) or ready (going), taken_over while the owner holds it (`stateOf`). */
|
|
24
|
+
export declare function runComputerField(setting: ComputerSetting, run: RunStateRead, stateOf?: ComputerStateOf): RunComputerField | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { COMPUTER_UNAVAILABLE } from "./computers.js";
|
|
2
|
+
const ENDED = new Set(["completed", "failed", "cancelled", "expired"]);
|
|
3
|
+
/** The run's `computer` field: absent for a run with none; failed with why when its computer could not be had; ended
|
|
4
|
+
* once the run is over; else starting (queued) or ready (going), taken_over while the owner holds it (`stateOf`). */
|
|
5
|
+
export function runComputerField(setting, run, stateOf) {
|
|
6
|
+
if (setting.kind === "none")
|
|
7
|
+
return undefined;
|
|
8
|
+
const base = { kind: setting.kind, provider: setting.provider };
|
|
9
|
+
if (run.error?.code === COMPUTER_UNAVAILABLE)
|
|
10
|
+
return { ...base, state: "failed", why: run.error.message };
|
|
11
|
+
if (ENDED.has(run.status))
|
|
12
|
+
return { ...base, state: "ended" };
|
|
13
|
+
const state = run.status === "queued" ? "starting" : "ready";
|
|
14
|
+
return { ...base, state: stateOf ? stateOf(run.id, state) : state };
|
|
15
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type RunLaunch } from "./run-launch.js";
|
|
2
|
+
import { type SignInReader } from "./run-view.js";
|
|
3
|
+
import type { RunRow, Store } from "./store/store.js";
|
|
4
|
+
/** Run `runId`'s cut set: the values everything served of it is cut of (its view's words, its title, its Timeline's
|
|
5
|
+
* rows, its error), or `unreadable` when what it was handed can't be read back here (handed-values.ts handedValuesOf),
|
|
6
|
+
* so it is withheld. `known`: its row and launch, when the caller has read them. */
|
|
7
|
+
export declare function runCutValues(deps: {
|
|
8
|
+
serverSecrets: () => string[];
|
|
9
|
+
signIns?: SignInReader;
|
|
10
|
+
}, store: Pick<Store, "runs">, runId: string, known?: {
|
|
11
|
+
readonly runRow: RunRow;
|
|
12
|
+
readonly launch: RunLaunch | undefined;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
values: string[];
|
|
15
|
+
} | "unreadable">;
|
|
16
|
+
/** Run `runId`'s cut as a function of a text: the one rule its served words are shown by (run-view.ts shownOf: no value
|
|
17
|
+
* of the cut set, in any spelling, and no loopback address), or `unreadable` when the run is withheld. */
|
|
18
|
+
export declare function runCutOf(deps: {
|
|
19
|
+
serverSecrets: () => string[];
|
|
20
|
+
signIns?: SignInReader;
|
|
21
|
+
}, store: Pick<Store, "runs">, runId: string): Promise<((text: string) => string) | "unreadable">;
|
|
22
|
+
/** Run `runId`'s error words: how its error text reads wherever it is served (its view's error, its Timeline's error
|
|
23
|
+
* rows), main's errorWords: a refused key in plain words (key-refusal.ts keyRefusal, the key its harness's route sends
|
|
24
|
+
* by this server's settings and keys), else the text by the one rule (shownOf); `unreadable` when the run is withheld.
|
|
25
|
+
* A workflow's nodes run on their own tiers' models and its error doesn't say which failed, so its words are never
|
|
26
|
+
* turned to a key's (`workflow`). `keyEnv`: the environment the run's key is read from, with the keys a person saved. */
|
|
27
|
+
export declare function runErrorWordsOf(deps: {
|
|
28
|
+
serverSecrets: () => string[];
|
|
29
|
+
signIns?: SignInReader;
|
|
30
|
+
keyEnv: () => NodeJS.ProcessEnv;
|
|
31
|
+
}, store: Pick<Store, "runs">, runId: string, { workflow }: {
|
|
32
|
+
workflow: boolean;
|
|
33
|
+
}): Promise<((text: string) => string) | "unreadable">;
|
package/dist/run-cut.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// A run's cut over the store: the ONE set of values everything served of a run is cut of (its view's words, its title,
|
|
2
|
+
// its Timeline's rows, its error), or `unreadable` when what the run was handed of its agent's browser sign-in can't be read back
|
|
3
|
+
// here, so nothing it said may be shown. The set is every secret this server never shows (serverSecrets: its own keys,
|
|
4
|
+
// the tool and model keys it keeps, trigger and source secrets) and every sign-in pointer the run was handed, live or
|
|
5
|
+
// forgotten, read back by the hashes its row keeps (handed-values.ts). Read anew at each call: a key rotated or a seal key restored is
|
|
6
|
+
// honoured at once.
|
|
7
|
+
import { handedValuesOf } from "./handed-values.js";
|
|
8
|
+
import { keyRefusal, runKeyOf } from "./key-refusal.js";
|
|
9
|
+
import { MIN_SECRET } from "./learn/secrets.js";
|
|
10
|
+
import { readLaunchBody } from "./run-launch.js";
|
|
11
|
+
import { shownOf } from "./run-view.js";
|
|
12
|
+
/** Run `runId`'s cut set: the values everything served of it is cut of (its view's words, its title, its Timeline's
|
|
13
|
+
* rows, its error), or `unreadable` when what it was handed can't be read back here (handed-values.ts handedValuesOf),
|
|
14
|
+
* so it is withheld. `known`: its row and launch, when the caller has read them. */
|
|
15
|
+
export async function runCutValues(deps, store, runId, known) {
|
|
16
|
+
const handed = await handedValuesOf(deps, store, runId, known);
|
|
17
|
+
if (handed === "unreadable")
|
|
18
|
+
return "unreadable";
|
|
19
|
+
return { values: [...deps.serverSecrets(), ...handed.refs.filter((ref) => ref.length >= MIN_SECRET)] };
|
|
20
|
+
}
|
|
21
|
+
/** Run `runId`'s cut as a function of a text: the one rule its served words are shown by (run-view.ts shownOf: no value
|
|
22
|
+
* of the cut set, in any spelling, and no loopback address), or `unreadable` when the run is withheld. */
|
|
23
|
+
export async function runCutOf(deps, store, runId) {
|
|
24
|
+
const cut = await runCutValues(deps, store, runId);
|
|
25
|
+
return cut === "unreadable" ? "unreadable" : shownOf(cut.values);
|
|
26
|
+
}
|
|
27
|
+
/** Run `runId`'s error words: how its error text reads wherever it is served (its view's error, its Timeline's error
|
|
28
|
+
* rows), main's errorWords: a refused key in plain words (key-refusal.ts keyRefusal, the key its harness's route sends
|
|
29
|
+
* by this server's settings and keys), else the text by the one rule (shownOf); `unreadable` when the run is withheld.
|
|
30
|
+
* A workflow's nodes run on their own tiers' models and its error doesn't say which failed, so its words are never
|
|
31
|
+
* turned to a key's (`workflow`). `keyEnv`: the environment the run's key is read from, with the keys a person saved. */
|
|
32
|
+
export async function runErrorWordsOf(deps, store, runId, { workflow }) {
|
|
33
|
+
const cut = await runCutValues(deps, store, runId);
|
|
34
|
+
if (cut === "unreadable")
|
|
35
|
+
return "unreadable";
|
|
36
|
+
const shown = shownOf(cut.values);
|
|
37
|
+
if (workflow)
|
|
38
|
+
return shown;
|
|
39
|
+
const launch = await store.runs.launch(runId).then((row) => readLaunchBody(row.body), () => undefined);
|
|
40
|
+
const key = runKeyOf(deps.keyEnv(), launch?.harness, launch?.model ? `${launch.model.provider}/${launch.model.modelId}` : undefined);
|
|
41
|
+
return (text) => shown(keyRefusal(text, key, cut.values) ?? text);
|
|
42
|
+
}
|
package/dist/run-db.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { DatabaseSync } from "node:sqlite";
|
|
2
|
+
/** One open of a run's database, as observeRunDbOpens reports it: `held`, whether a process held the run at the open. */
|
|
3
|
+
/** `dropped`: a read of the file alone whose file changed during it, made again (readRunDbSync). */
|
|
4
|
+
export type RunDbOpen = {
|
|
5
|
+
file: string;
|
|
6
|
+
mode: "read" | "checkpoint" | "dropped";
|
|
7
|
+
held: boolean;
|
|
8
|
+
};
|
|
9
|
+
/** Tells `observer` of every open of a run's database from here on (tests); the returned call stops it. */
|
|
10
|
+
export declare function observeRunDbOpens(observer: (open: RunDbOpen) => void): () => void;
|
|
11
|
+
/** Tests' seams: `afterPlan`, called between a read's choice of how to open the file and its open; `madeReads`, called
|
|
12
|
+
* with each MonotonicReads made; `beforeCheckpoint`, called with the take-back's connection just before its close. */
|
|
13
|
+
export declare const runDbTestHooks: {
|
|
14
|
+
afterPlan?: (file: string) => void;
|
|
15
|
+
madeReads?: (reads: MonotonicReads) => void;
|
|
16
|
+
beforeCheckpoint?: (db: DatabaseSync) => void;
|
|
17
|
+
};
|
|
18
|
+
/** A read of a run's database file alone whose file changed during it (a run's process wrote and a take-back checkpointed
|
|
19
|
+
* meanwhile), every try: none of them is shown. */
|
|
20
|
+
export declare class ChangedReadError extends Error {
|
|
21
|
+
constructor(file: string, tries: number);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* One read of run database `file`: `read(db)` on a fresh read-only, lock-free connection, closed after it. A WAL that
|
|
25
|
+
* holds a commit SQLite's recovery takes (walHasCommit): opened with no locking (`vfs=unix-none`), the WAL read too. No
|
|
26
|
+
* WAL, or one with no verified commit yet (a fresh WAL's first transaction, its frames written and no commit): the
|
|
27
|
+
* database file alone, as an immutable file, which is whole then; its read is kept only when the file did not change
|
|
28
|
+
* during it (fileMark), else it is dropped and made again. SQLite's lock-free reader of a WAL with no commit recovers no
|
|
29
|
+
* frame, and its close, a checkpoint with nothing to copy, removes the WAL (sqlite3WalClose) under the writer still
|
|
30
|
+
* writing it, whose commits are then lost; with a commit, that close's checkpoint must write the database file, which
|
|
31
|
+
* this read-only connection cannot, so it fails and removes nothing. Every read and the take-back's checkpoint run in one
|
|
32
|
+
* turn of this process's event loop, and the run's process only appends to its WAL, so the WAL a read opens holds at
|
|
33
|
+
* least the commit its check saw. A read-only close checkpoints nothing it can write. `held`: whether a process holds the
|
|
34
|
+
* run now (reported to observers).
|
|
35
|
+
*/
|
|
36
|
+
export declare function readRunDbSync<T>(file: string, held: boolean, read: (db: DatabaseSync) => T): T;
|
|
37
|
+
/** readRunDbSync, for an async caller. */
|
|
38
|
+
export declare function readRunDb<T>(file: string, held: boolean, read: (db: DatabaseSync) => T): Promise<T>;
|
|
39
|
+
/** A read of a run's database whose last entry is below one already seen for that run: an older view of the file, which a
|
|
40
|
+
* read must never show (the monotonic guard). The caller keeps what it read before. */
|
|
41
|
+
export declare class BehindReadError extends Error {
|
|
42
|
+
readonly seen: number;
|
|
43
|
+
readonly read: number;
|
|
44
|
+
constructor(seen: number, read: number);
|
|
45
|
+
}
|
|
46
|
+
/** The highest entry id each run's reads have seen: a read below it is refused (BehindReadError). */
|
|
47
|
+
export declare class MonotonicReads {
|
|
48
|
+
#private;
|
|
49
|
+
constructor();
|
|
50
|
+
/** How many runs' reads it keeps. */
|
|
51
|
+
get size(): number;
|
|
52
|
+
/** Accepts run `runId`'s read that ends at entry `last` (0 for none), or throws BehindReadError. */
|
|
53
|
+
accept(runId: string, last: number): void;
|
|
54
|
+
/** Forgets run `runId`'s reads: a run that is gone, or whose store was replaced. */
|
|
55
|
+
forget(runId: string): void;
|
|
56
|
+
}
|
|
57
|
+
/** A read-write open of a run's database while a process holds the run: refused, never made. */
|
|
58
|
+
export declare class HeldRunDbError extends Error {
|
|
59
|
+
constructor(file: string);
|
|
60
|
+
}
|
|
61
|
+
/** Checkpoints the run database at `file` into its database file and removes its WAL, once no process holds the run
|
|
62
|
+
* (`held` false; true throws HeldRunDbError before any open). A database with no WAL left is untouched but for the
|
|
63
|
+
* open. The one read-write open the server makes of a run's database. */
|
|
64
|
+
export declare function checkpointRunDb(file: string, held: boolean, platform?: NodeJS.Platform): Promise<void>;
|