@parcha/agentrun-serve 0.1.0-beta.35 → 0.1.0-beta.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +298 -0
- package/README.md +417 -219
- package/dist/adapters.d.ts +12 -2
- package/dist/adapters.js +27 -2
- package/dist/agent-rows.d.ts +2 -1
- package/dist/agents-store.d.ts +2 -0
- package/dist/agents-store.js +9 -4
- package/dist/api-only.d.ts +2 -1
- package/dist/api-only.js +3 -1
- package/dist/archil-routes.d.ts +40 -7
- package/dist/archil-routes.js +167 -54
- package/dist/archil-settings.d.ts +79 -7
- package/dist/archil-settings.js +140 -14
- package/dist/attach-conformance-cli.d.ts +1 -0
- package/dist/attach-conformance-cli.js +18 -0
- package/dist/attach-conformance.d.ts +25 -0
- package/dist/attach-conformance.js +343 -0
- package/dist/attach-images.d.ts +15 -0
- package/dist/attach-images.js +59 -0
- package/dist/background.d.ts +0 -6
- package/dist/background.js +0 -28
- package/dist/box-image.d.ts +1 -97
- package/dist/box-image.js +4 -284
- package/dist/box-paths.d.ts +2 -7
- package/dist/box-paths.js +7 -13
- package/dist/box-settings.d.ts +0 -11
- package/dist/box-settings.js +4 -29
- package/dist/browser-commands.js +1 -1
- package/dist/browser-computer.d.ts +47 -3
- package/dist/browser-computer.js +286 -18
- package/dist/browser-cost.d.ts +1 -1
- package/dist/browser-live.d.ts +20 -8
- package/dist/browser-live.js +50 -27
- package/dist/browser-person.d.ts +19 -2
- package/dist/browser-person.js +55 -6
- package/dist/browser-wait-ended.d.ts +23 -0
- package/dist/browser-wait-ended.js +42 -0
- package/dist/cap.d.ts +12 -57
- package/dist/cap.js +20 -160
- package/dist/catalog.d.ts +1 -12
- package/dist/catalog.js +3 -33
- package/dist/cli.js +17 -26
- package/dist/composio-preset.d.ts +36 -0
- package/dist/composio-preset.js +179 -0
- package/dist/computer-attach.d.ts +125 -0
- package/dist/computer-attach.js +330 -0
- package/dist/computer-calls.d.ts +48 -0
- package/dist/computer-calls.js +126 -0
- package/dist/computer-channel.d.ts +57 -0
- package/dist/computer-channel.js +115 -0
- package/dist/computer-commands.d.ts +1 -1
- package/dist/computer-held-routes.d.ts +35 -0
- package/dist/computer-held-routes.js +106 -0
- package/dist/computer-held.d.ts +48 -0
- package/dist/computer-held.js +87 -0
- package/dist/computer-keys.d.ts +21 -1
- package/dist/computer-keys.js +53 -11
- package/dist/computer-live.d.ts +160 -0
- package/dist/computer-live.js +643 -0
- package/dist/computer-routes.d.ts +1 -4
- package/dist/computer-routes.js +3 -5
- package/dist/computer-setting.d.ts +2 -0
- package/dist/computer-setting.js +38 -1
- package/dist/computer-view.d.ts +24 -2
- package/dist/computer-view.js +51 -3
- package/dist/computer-viewer.d.ts +6 -0
- package/dist/computer-viewer.js +297 -0
- package/dist/computers.d.ts +79 -12
- package/dist/computers.js +147 -28
- package/dist/console/assets/index-Cn6JX1uH.js +563 -0
- package/dist/console/assets/index-DRN62V5v.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/docker-daemon.d.ts +2 -2
- package/dist/docker-daemon.js +2 -2
- package/dist/errors.js +5 -5
- package/dist/faux-computers.d.ts +9 -20
- package/dist/faux-computers.js +56 -24
- package/dist/files.d.ts +1 -9
- package/dist/files.js +1 -9
- package/dist/github-connection.d.ts +10 -2
- package/dist/github-connection.js +65 -2
- package/dist/github-faux.js +1 -1
- package/dist/github.d.ts +22 -2
- package/dist/github.js +42 -8
- package/dist/gpu-words.d.ts +14 -0
- package/dist/gpu-words.js +21 -0
- package/dist/graph-view.d.ts +3 -1
- package/dist/graph-view.js +25 -1
- package/dist/handed-values.d.ts +1 -1
- package/dist/handed-values.js +1 -1
- package/dist/harness-install.d.ts +60 -3
- package/dist/harness-install.js +322 -34
- package/dist/harness.d.ts +1 -0
- package/dist/harness.js +36 -2
- package/dist/host-tools.d.ts +9 -10
- package/dist/host-tools.js +7 -7
- package/dist/hosted-search.d.ts +5 -4
- package/dist/hosted-search.js +2 -7
- package/dist/import-sources.d.ts +10 -0
- package/dist/import-sources.js +44 -2
- package/dist/import.d.ts +3 -3
- package/dist/import.js +37 -6
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -2
- package/dist/key-refusal.d.ts +1 -1
- package/dist/key-refusal.js +2 -2
- package/dist/learn/check.d.ts +11 -2
- package/dist/learn/check.js +124 -6
- package/dist/learn/commit.d.ts +43 -7
- package/dist/learn/commit.js +166 -22
- package/dist/learn/folder.d.ts +11 -0
- package/dist/learn/folder.js +37 -1
- package/dist/learn/general.d.ts +66 -0
- package/dist/learn/general.js +73 -0
- package/dist/learn/grade.d.ts +22 -1
- package/dist/learn/grade.js +107 -16
- package/dist/learn/index.d.ts +1 -1
- package/dist/learn/index.js +1 -1
- package/dist/learn/learning.sh +12 -1
- package/dist/learn/notes.d.ts +3 -0
- package/dist/learn/notes.js +3 -0
- package/dist/learn/reflect.d.ts +14 -2
- package/dist/learn/reflect.js +54 -30
- package/dist/learn/skills.d.ts +37 -5
- package/dist/learn/skills.js +60 -7
- package/dist/learned-nodes.d.ts +6 -2
- package/dist/learned-workflow.d.ts +43 -9
- package/dist/learned-workflow.js +128 -37
- package/dist/learning-batch.d.ts +283 -0
- package/dist/learning-batch.js +574 -0
- package/dist/learning-cost.d.ts +79 -0
- package/dist/learning-cost.js +69 -0
- package/dist/learning-evals.d.ts +33 -0
- package/dist/learning-evals.js +98 -0
- package/dist/learning-routes.d.ts +32 -4
- package/dist/learning-routes.js +48 -12
- package/dist/learning-words.d.ts +9 -0
- package/dist/learning-words.js +12 -2
- package/dist/learning.d.ts +39 -19
- package/dist/learning.js +88 -46
- package/dist/live/stream.js +6 -3
- package/dist/live/translate.d.ts +4 -3
- package/dist/live/translate.js +8 -4
- package/dist/live-reach.d.ts +37 -0
- package/dist/live-reach.js +62 -0
- package/dist/mcp-gateway.d.ts +9 -0
- package/dist/mcp-gateway.js +60 -11
- package/dist/mcp-oauth.d.ts +57 -7
- package/dist/mcp-oauth.js +133 -18
- package/dist/mcp-private-hosts.d.ts +4 -4
- package/dist/mcp-private-hosts.js +20 -12
- package/dist/mcp-probe.d.ts +27 -3
- package/dist/mcp-probe.js +106 -29
- package/dist/mcp-secret-writes.js +8 -0
- package/dist/mcp-servers-store.d.ts +38 -15
- package/dist/mcp-servers-store.js +120 -23
- package/dist/mcp-store.d.ts +10 -4
- package/dist/mcp-store.js +17 -6
- package/dist/model-form.d.ts +26 -0
- package/dist/model-form.js +80 -0
- package/dist/model.d.ts +5 -5
- package/dist/model.js +29 -16
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +586 -64
- package/dist/owner.d.ts +0 -1
- package/dist/owner.js +0 -2
- package/dist/page.d.ts +18 -0
- package/dist/page.js +48 -20
- package/dist/paid-calls.d.ts +1 -1
- package/dist/paid-calls.js +1 -1
- package/dist/place-offers.d.ts +96 -0
- package/dist/place-offers.js +202 -0
- package/dist/place.d.ts +9 -13
- package/dist/place.js +21 -32
- package/dist/port-models.d.ts +2 -1
- package/dist/port-models.js +5 -3
- package/dist/print.d.ts +16 -9
- package/dist/print.js +15 -17
- package/dist/propose.d.ts +4 -0
- package/dist/propose.js +34 -11
- package/dist/provider.js +3 -2
- package/dist/reflect-range.d.ts +8 -1
- package/dist/reflect-range.js +1 -1
- package/dist/run-cut.d.ts +5 -0
- package/dist/run-cut.js +19 -0
- package/dist/run-launch.d.ts +28 -3
- package/dist/run-launch.js +14 -4
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-manifest.d.ts +2 -2
- package/dist/run-manifest.js +2 -2
- package/dist/run-reads-over-store.d.ts +1 -1
- package/dist/run-repo.d.ts +20 -0
- package/dist/run-repo.js +63 -0
- package/dist/run-secrets.js +3 -3
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-timeline-served.js +56 -44
- package/dist/run-view.d.ts +8 -5
- package/dist/run-view.js +18 -10
- package/dist/runnable.d.ts +2 -2
- package/dist/runnable.js +6 -2
- package/dist/runner/adapter-loop.d.ts +39 -8
- package/dist/runner/adapter-loop.js +770 -83
- package/dist/runner/adapter-run-spec.d.ts +36 -7
- package/dist/runner/adapter-run-spec.js +171 -37
- package/dist/runner/adapters/pi-computer.d.ts +7 -0
- package/dist/runner/adapters/pi-computer.js +43 -0
- package/dist/runner/adapters/pi.d.ts +20 -7
- package/dist/runner/adapters/pi.js +111 -26
- package/dist/runner/beside.d.ts +7 -3
- package/dist/runner/beside.js +26 -12
- package/dist/runner/claim-secrets.d.ts +4 -0
- package/dist/runner/claim-secrets.js +6 -1
- package/dist/runner/cli-run-spec.d.ts +27 -3
- package/dist/runner/cli-run-spec.js +198 -74
- package/dist/runner/commands.d.ts +8 -2
- package/dist/runner/commands.js +31 -6
- package/dist/runner/computer-channel.d.ts +34 -0
- package/dist/runner/computer-channel.js +61 -0
- package/dist/runner/conformance/harness.d.ts +0 -1
- package/dist/runner/conformance/harness.js +87 -18
- package/dist/runner/conformance/subject.d.ts +1 -1
- package/dist/runner/dispatch.js +3 -0
- package/dist/runner/end-of-run.d.ts +22 -12
- package/dist/runner/end-of-run.js +38 -16
- package/dist/runner/github-app.d.ts +2 -1
- package/dist/runner/github-app.js +6 -4
- package/dist/runner/harness-loops.js +16 -2
- package/dist/runner/held-run.d.ts +65 -0
- package/dist/runner/held-run.js +158 -0
- package/dist/runner/journal-kinds.d.ts +35 -6
- package/dist/runner/journal-kinds.js +20 -1
- package/dist/runner/journal-reader.d.ts +5 -4
- package/dist/runner/journal-reader.js +12 -10
- package/dist/runner/learning-ask.d.ts +7 -1
- package/dist/runner/learning-ask.js +21 -6
- package/dist/runner/learning-dispatch.d.ts +22 -0
- package/dist/runner/learning-dispatch.js +77 -10
- package/dist/runner/learning-end.d.ts +37 -1
- package/dist/runner/learning-end.js +115 -14
- package/dist/runner/learning-factory.d.ts +1 -1
- package/dist/runner/learning-factory.js +15 -5
- package/dist/runner/learning-loop.d.ts +139 -7
- package/dist/runner/learning-loop.js +369 -32
- package/dist/runner/learning-seed.d.ts +9 -0
- package/dist/runner/learning-seed.js +14 -1
- package/dist/runner/live-ticker.js +1 -0
- package/dist/runner/loop-contract.d.ts +16 -1
- package/dist/runner/loop-contract.js +6 -0
- package/dist/runner/loop.d.ts +10 -2
- package/dist/runner/loop.js +22 -1
- package/dist/runner/main.d.ts +13 -1
- package/dist/runner/main.js +38 -6
- package/dist/runner/mcp-claim.d.ts +11 -4
- package/dist/runner/mcp-claim.js +140 -23
- package/dist/runner/mcp-github.d.ts +4 -2
- package/dist/runner/mcp-github.js +1 -8
- package/dist/runner/mcp-run.d.ts +6 -4
- package/dist/runner/mcp-run.js +16 -3
- package/dist/runner/metrics.d.ts +15 -2
- package/dist/runner/metrics.js +21 -2
- package/dist/runner/model-route.d.ts +3 -0
- package/dist/runner/model-route.js +5 -2
- package/dist/runner/pr-checkout.d.ts +60 -0
- package/dist/runner/pr-checkout.js +176 -0
- package/dist/runner/reflect-hook.d.ts +19 -0
- package/dist/runner/reflect-hook.js +20 -8
- package/dist/runner/runner.d.ts +26 -0
- package/dist/runner/runner.js +231 -27
- package/dist/runner/scratch-sweep.d.ts +13 -0
- package/dist/runner/scratch-sweep.js +62 -0
- package/dist/runner/sessions.d.ts +1 -1
- package/dist/runner/spec-holds.d.ts +8 -3
- package/dist/runner/spec-holds.js +12 -10
- package/dist/runner/store-port.d.ts +7 -2
- package/dist/runner/store-secrets.js +21 -4
- package/dist/runner/subagent.d.ts +44 -0
- package/dist/runner/subagent.js +190 -0
- package/dist/runner/workflow-host.d.ts +24 -3
- package/dist/runner/workflow-host.js +24 -4
- package/dist/runner/workflow-loop.d.ts +6 -3
- package/dist/runner/workflow-loop.js +9 -8
- package/dist/runner/workflow-spec.d.ts +39 -15
- package/dist/runner/workflow-spec.js +143 -40
- package/dist/runs-over-store.d.ts +16 -6
- package/dist/runs-over-store.js +145 -29
- package/dist/seal-key.js +3 -3
- package/dist/sealed-settings-store.d.ts +5 -2
- package/dist/sealed-settings-store.js +10 -4
- package/dist/sealing.js +1 -2
- package/dist/secret-cut.d.ts +1 -1
- package/dist/secret-cut.js +1 -1
- package/dist/secret-writes.d.ts +5 -4
- package/dist/secret-writes.js +5 -4
- package/dist/server-secrets-store.d.ts +4 -3
- package/dist/server-secrets-store.js +15 -9
- package/dist/server-secrets.js +3 -2
- package/dist/server.d.ts +75 -63
- package/dist/server.js +712 -316
- package/dist/settings-wake.d.ts +21 -0
- package/dist/settings-wake.js +59 -0
- package/dist/standard-webhooks.d.ts +4 -1
- package/dist/standard-webhooks.js +8 -4
- package/dist/store/agent-body.d.ts +9 -2
- package/dist/store/agent-body.js +16 -8
- package/dist/store/command-wake.d.ts +12 -0
- package/dist/store/command-wake.js +37 -0
- package/dist/store/deadline.js +9 -5
- package/dist/store/dialect.d.ts +6 -0
- package/dist/store/dialect.js +5 -0
- package/dist/store/index.d.ts +4 -4
- package/dist/store/index.js +2 -2
- package/dist/store/journal/storage.d.ts +3 -2
- package/dist/store/journal/storage.js +15 -6
- package/dist/store/postgres/connection.js +9 -4
- package/dist/store/postgres/dialect.js +4 -0
- package/dist/store/postgres/migrations/0004_runs_outcome_stop_or_cancel.sql +11 -0
- package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
- package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
- package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
- package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
- package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
- package/dist/store/schema.d.ts +2 -1
- package/dist/store/schema.js +85 -13
- package/dist/store/seal.d.ts +13 -0
- package/dist/store/seal.js +19 -0
- package/dist/store/sqlite/connection.d.ts +5 -0
- package/dist/store/sqlite/connection.js +88 -47
- package/dist/store/sqlite/run-patch.d.ts +25 -7
- package/dist/store/sqlite/run-patch.js +58 -14
- package/dist/store/sqlite/store.js +331 -59
- package/dist/store/store.d.ts +330 -21
- package/dist/store/store.js +34 -2
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +2 -4
- package/dist/store-reads/cap.js +16 -7
- package/dist/store-reads/decisions.d.ts +3 -3
- package/dist/store-reads/decisions.js +3 -6
- package/dist/store-reads/import-summary.d.ts +1 -1
- package/dist/store-reads/journal.d.ts +5 -4
- package/dist/store-reads/journal.js +118 -27
- package/dist/store-reads/learning.d.ts +34 -4
- package/dist/store-reads/learning.js +137 -23
- package/dist/store-reads/runs.d.ts +7 -5
- package/dist/store-reads/runs.js +17 -10
- package/dist/store-reads/stats.js +5 -1
- package/dist/store-reads/workflow.d.ts +1 -1
- package/dist/store-view.d.ts +5 -0
- package/dist/store-view.js +70 -29
- package/dist/template-eval.js +8 -5
- package/dist/template-github-permissions.d.ts +22 -8
- package/dist/template-github-permissions.js +35 -15
- package/dist/templates.d.ts +64 -0
- package/dist/templates.js +101 -16
- package/dist/timeline/timeline.d.ts +30 -1
- package/dist/timeline/timeline.js +29 -13
- package/dist/timeline/util.d.ts +4 -0
- package/dist/timeline/util.js +14 -0
- package/dist/tool-blurbs.js +1 -0
- package/dist/tool-budget.d.ts +27 -7
- package/dist/tool-budget.js +21 -9
- package/dist/tool-gate.d.ts +23 -10
- package/dist/tool-gate.js +60 -44
- package/dist/tool-plane.d.ts +46 -28
- package/dist/tool-plane.js +73 -31
- package/dist/tools.d.ts +31 -38
- package/dist/tools.js +117 -74
- package/dist/trigger-adapter.d.ts +4 -0
- package/dist/trigger-secrets-shown.d.ts +2 -2
- package/dist/trigger-secrets-shown.js +1 -1
- package/dist/trigger-signatures.d.ts +26 -6
- package/dist/trigger-signatures.js +44 -8
- package/dist/trigger-targets.d.ts +2 -0
- package/dist/trigger-targets.js +1 -0
- package/dist/trigger-webhook.js +5 -2
- package/dist/triggers.d.ts +10 -6
- package/dist/triggers.js +37 -7
- package/dist/turn-end.d.ts +0 -3
- package/dist/turn-end.js +0 -3
- package/dist/turns.js +16 -1
- package/dist/usage-lines.d.ts +1 -1
- package/dist/validate.d.ts +6 -0
- package/dist/validate.js +41 -4
- package/dist/web-fetch.d.ts +1 -1
- package/dist/web-search.d.ts +10 -5
- package/dist/web-search.js +7 -6
- package/dist/webhooks.d.ts +147 -103
- package/dist/webhooks.js +564 -324
- package/dist/workflow/decision-recovery.d.ts +23 -0
- package/dist/workflow/decision-recovery.js +80 -0
- package/dist/workflow/decisions.d.ts +134 -0
- package/dist/workflow/decisions.js +46 -0
- package/dist/workflow/host-session.d.ts +5 -0
- package/dist/workflow/host-session.js +85 -0
- package/dist/workflow/host-tools.d.ts +3 -0
- package/dist/workflow/host-tools.js +3 -0
- package/dist/workflow/node-runner.d.ts +113 -0
- package/dist/workflow/node-runner.js +270 -0
- package/dist/workflow/node.d.ts +89 -0
- package/dist/workflow/node.js +101 -0
- package/dist/workflow/operator-error.d.ts +4 -0
- package/dist/workflow/operator-error.js +4 -0
- package/dist/workflow/pi-versions.d.ts +32 -0
- package/dist/workflow/pi-versions.js +65 -0
- package/dist/workflow/record-file.d.ts +10 -0
- package/dist/workflow/record-file.js +56 -0
- package/dist/workflow/record-tool.d.ts +77 -0
- package/dist/workflow/record-tool.js +126 -0
- package/dist/workflow/record.d.ts +151 -0
- package/dist/workflow/record.js +401 -0
- package/dist/workflow/run-error.d.ts +16 -0
- package/dist/workflow/run-error.js +26 -0
- package/dist/workflow/runner.d.ts +6 -0
- package/dist/workflow/runner.js +240 -0
- package/dist/workflow/store.d.ts +23 -0
- package/dist/workflow/store.js +242 -0
- package/dist/workflow/task.d.ts +133 -0
- package/dist/workflow/task.js +412 -0
- package/dist/workflow/thinking.d.ts +3 -0
- package/dist/workflow/thinking.js +7 -0
- package/dist/workflow/tool-context.d.ts +21 -0
- package/dist/workflow/tool-context.js +13 -0
- package/dist/workflow/types.d.ts +126 -0
- package/dist/workflow/types.js +1 -0
- package/dist/workflow-run.d.ts +2 -2
- package/dist/workspace/agent-computer.d.ts +137 -0
- package/dist/workspace/agent-computer.js +292 -0
- package/dist/workspace/archil-claim.d.ts +11 -0
- package/dist/workspace/archil-claim.js +18 -10
- package/dist/workspace/archil-disks.d.ts +49 -0
- package/dist/workspace/archil-disks.js +185 -0
- package/dist/workspace/archil-exec.js +2 -3
- package/dist/workspace/archil-mount-credential.d.ts +20 -4
- package/dist/workspace/archil-mount-credential.js +13 -4
- package/dist/workspace/attached-computers.d.ts +41 -0
- package/dist/workspace/attached-computers.js +114 -0
- package/dist/workspace/computer-deps.d.ts +32 -17
- package/dist/workspace/computer-deps.js +37 -14
- package/dist/workspace/computer-for-claim.d.ts +58 -13
- package/dist/workspace/computer-for-claim.js +267 -26
- package/dist/workspace/computer-hold.d.ts +11 -27
- package/dist/workspace/computer-hold.js +36 -56
- package/dist/workspace/computer-janitor.d.ts +3 -2
- package/dist/workspace/computer-janitor.js +43 -9
- package/dist/workspace/computer-ledger.d.ts +5 -1
- package/dist/workspace/computer-ledger.js +11 -0
- package/dist/workspace/computer-mcp.d.ts +25 -0
- package/dist/workspace/computer-mcp.js +41 -0
- package/dist/workspace/computer-ports.d.ts +4 -13
- package/dist/workspace/computer-ports.js +4 -107
- package/dist/workspace/computer-script.d.ts +37 -0
- package/dist/workspace/computer-script.js +138 -0
- package/dist/workspace/executors.d.ts +1 -1
- package/dist/workspace/index.d.ts +7 -4
- package/dist/workspace/index.js +4 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +119 -84
- package/dist/workspace/kind-skills/phone/SKILL.md +100 -85
- package/dist/workspace/resolve-computer.d.ts +45 -11
- package/dist/workspace/resolve-computer.js +72 -14
- package/dist/workspace/run-disk.d.ts +34 -0
- package/dist/workspace/run-disk.js +91 -0
- package/dist/workspace/run-tools.d.ts +35 -18
- package/dist/workspace/run-tools.js +24 -29
- package/dist/workspace/server-run-workspace.d.ts +3 -2
- package/dist/workspace/server-run-workspace.js +17 -4
- package/dist/workspace.js +1 -1
- package/package.json +19 -21
- package/templates/README.md +9 -6
- package/templates/code-review/agent.md +27 -11
- package/templates/code-review/evals/clean-refactor/graders/coverage.md +4 -0
- package/templates/code-review/evals/clean-refactor/graders/risk.md +5 -0
- package/templates/code-review/evals/injection/graders/ignores.md +1 -1
- package/templates/code-review/evals/never-flag/case.yaml +3 -0
- package/templates/code-review/evals/never-flag/graders/only-p0.md +4 -0
- package/templates/code-review/evals/never-flag/graders/schema.md +5 -0
- package/templates/code-review/evals/never-flag/prompt.md +30 -0
- package/templates/code-review/evals/null-name/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +6 -5
- package/templates/code-review/evals/re-review/graders/resolves.md +1 -1
- package/templates/code-review/evals/re-review/prompt.md +1 -1
- package/templates/code-review/evals/re-review-open/case.yaml +3 -0
- package/templates/code-review/evals/re-review-open/graders/schema.md +5 -0
- package/templates/code-review/evals/re-review-open/graders/stays-open.md +4 -0
- package/templates/code-review/evals/re-review-open/prompt.md +27 -0
- package/templates/code-review/evals/repo-rule/graders/cites.md +1 -1
- package/templates/code-review/evals/two-defects/case.yaml +3 -0
- package/templates/code-review/evals/two-defects/graders/both.md +4 -0
- package/templates/code-review/evals/two-defects/graders/schema.md +5 -0
- package/templates/code-review/evals/two-defects/prompt.md +25 -0
- package/templates/code-review/findings.schema.json +131 -27
- package/templates/code-review/rules/CODEREVIEW.md +76 -0
- package/templates/code-review/skills/review/DEEP.md +130 -0
- package/templates/code-review/skills/review/REVIEWER.md +116 -0
- package/templates/code-review/skills/review/SKILL.md +104 -154
- package/templates/market-monitor/agent.md +1 -1
- package/dist/box/record.d.ts +0 -6
- package/dist/box/record.js +0 -41
- package/dist/box/sweep.d.ts +0 -53
- package/dist/box/sweep.js +0 -193
- package/dist/box-egress-vm.d.ts +0 -118
- package/dist/box-egress-vm.js +0 -354
- package/dist/box-egress.d.ts +0 -105
- package/dist/box-egress.js +0 -256
- package/dist/box-relay-vm.d.ts +0 -84
- package/dist/box-relay-vm.js +0 -437
- package/dist/box-relay.d.ts +0 -36
- package/dist/box-relay.js +0 -207
- package/dist/boxes.d.ts +0 -109
- package/dist/boxes.js +0 -249
- package/dist/budget.d.ts +0 -71
- package/dist/budget.js +0 -199
- package/dist/console/assets/index-B7NKTU8E.css +0 -1
- package/dist/console/assets/index-CXZMgJE7.js +0 -550
- package/dist/daytona-api.d.ts +0 -10
- package/dist/daytona-api.js +0 -20
- package/dist/egress-proxy.d.ts +0 -45
- package/dist/egress-proxy.js +0 -416
- package/dist/egress-table.d.ts +0 -24
- package/dist/egress-table.js +0 -165
- package/dist/run-db.d.ts +0 -53
- package/dist/run-db.js +0 -116
- package/templates/code-review/rules/REVIEW.md +0 -41
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
-- The store's schema on Postgres, version 6: the run-change feed (Runs.changedSince), each channel post's tries (the
|
|
2
|
+
-- outbound webhook's deliveries log) and the claim a post's try settles under, as SQLite's schema version 8 has them.
|
|
3
|
+
--
|
|
4
|
+
-- A change is a run reaching a final state, or let go by its runner (parked, or running with none), written by the
|
|
5
|
+
-- trigger below in the transaction of the write that made it. Postgres has many writers, so a sequence alone does not
|
|
6
|
+
-- number changes in commit order: the trigger takes one transaction-scoped advisory lock before it inserts, so two
|
|
7
|
+
-- transactions that each write a change commit them in seq order, and a reader that has read seq n has every change at
|
|
8
|
+
-- or below it. The trigger is deferred to the commit, so the lock is held only while the change is numbered and the
|
|
9
|
+
-- transaction commits: a run's end write and the statements after it never wait on another run's, which would make a
|
|
10
|
+
-- runner of many loops end its runs one at a time.
|
|
11
|
+
CREATE TABLE IF NOT EXISTS run_changes (
|
|
12
|
+
seq BIGSERIAL PRIMARY KEY,
|
|
13
|
+
run_id TEXT COLLATE "C" NOT NULL,
|
|
14
|
+
state TEXT COLLATE "C" NOT NULL,
|
|
15
|
+
ended_at BIGINT,
|
|
16
|
+
epoch BIGINT NOT NULL,
|
|
17
|
+
runner TEXT COLLATE "C"
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
CREATE OR REPLACE FUNCTION run_changed() RETURNS trigger LANGUAGE plpgsql AS $$
|
|
21
|
+
BEGIN
|
|
22
|
+
PERFORM pg_advisory_xact_lock(hashtext(TG_TABLE_SCHEMA || '.run_changes'));
|
|
23
|
+
EXECUTE format('INSERT INTO %I.run_changes (run_id, state, ended_at, epoch, runner) VALUES ($1, $2, $3, $4, $5)', TG_TABLE_SCHEMA)
|
|
24
|
+
USING NEW.id, NEW.state, NEW.ended_at, NEW.epoch, NEW.runner;
|
|
25
|
+
RETURN NULL;
|
|
26
|
+
END
|
|
27
|
+
$$;
|
|
28
|
+
|
|
29
|
+
DROP TRIGGER IF EXISTS runs_changed ON runs;
|
|
30
|
+
CREATE CONSTRAINT TRIGGER runs_changed AFTER UPDATE OF state, runner ON runs
|
|
31
|
+
DEFERRABLE INITIALLY DEFERRED
|
|
32
|
+
FOR EACH ROW
|
|
33
|
+
WHEN ((OLD.state IS DISTINCT FROM NEW.state OR OLD.runner IS DISTINCT FROM NEW.runner)
|
|
34
|
+
AND (NEW.state IN ('ended', 'stopped', 'failed', 'parked') OR (NEW.state = 'running' AND NEW.runner IS NULL)))
|
|
35
|
+
EXECUTE FUNCTION run_changed();
|
|
36
|
+
|
|
37
|
+
-- A post's try settles under the claim that made it (Channels.settle's fence): the claim's token, kept on the post until
|
|
38
|
+
-- a newer claim or a write outside every claim takes it.
|
|
39
|
+
ALTER TABLE channel_posts ADD COLUMN IF NOT EXISTS claim TEXT COLLATE "C";
|
|
40
|
+
|
|
41
|
+
-- Each try once, by its id: a settle written again (its outcome unknown) logs it once.
|
|
42
|
+
CREATE TABLE IF NOT EXISTS channel_attempts (
|
|
43
|
+
seq BIGSERIAL PRIMARY KEY,
|
|
44
|
+
try_id TEXT COLLATE "C" NOT NULL UNIQUE,
|
|
45
|
+
channel TEXT COLLATE "C" NOT NULL,
|
|
46
|
+
post_id TEXT COLLATE "C" NOT NULL,
|
|
47
|
+
moment TEXT COLLATE "C" NOT NULL,
|
|
48
|
+
at BIGINT NOT NULL,
|
|
49
|
+
status_code BIGINT,
|
|
50
|
+
latency_ms BIGINT NOT NULL,
|
|
51
|
+
error TEXT COLLATE "C",
|
|
52
|
+
retry_at BIGINT,
|
|
53
|
+
redelivery BIGINT NOT NULL CHECK (redelivery IN (0, 1))
|
|
54
|
+
);
|
|
55
|
+
CREATE INDEX IF NOT EXISTS channel_attempts_by_channel ON channel_attempts (channel, seq);
|
|
56
|
+
|
|
57
|
+
UPDATE store_meta SET schema_version = 6 WHERE singleton = 1;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- The store's schema on Postgres, version 7: where a live viewer answers when its runner is on another host than the
|
|
2
|
+
-- server (live-reach.ts), as store/schema.ts keeps it on SQLite (version 9). Applied once, after 0006, inside the transaction
|
|
3
|
+
-- migrate.ts opens. Never edit this file once applied: a change is a new file.
|
|
4
|
+
--
|
|
5
|
+
-- computer_viewers.host: the runner's live host (AGENTRUN_RUNNER_LIVE_HOST); null, the server's own machine (loopback).
|
|
6
|
+
-- IF NOT EXISTS: applied again over a store that has it (the migration-0003 repair re-runs every migration after 0002),
|
|
7
|
+
-- it changes nothing.
|
|
8
|
+
|
|
9
|
+
ALTER TABLE computer_viewers ADD COLUMN IF NOT EXISTS host TEXT COLLATE "C";
|
|
10
|
+
|
|
11
|
+
UPDATE store_meta SET schema_version = 7 WHERE singleton = 1;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
-- The store's schema on Postgres, version 8: a person's own computer paired with this server (spec/computer/attach.md),
|
|
2
|
+
-- and the codes that pair one, as store/schema.ts keeps them on SQLite (version 10). Applied once, after 0007, inside the transaction
|
|
3
|
+
-- migrate.ts opens. Never edit this file once applied: a change is a new file.
|
|
4
|
+
--
|
|
5
|
+
-- paired_computers: the token's SHA-256 alone is kept (hex); revoked_at marks a removed computer, whose token dials no more.
|
|
6
|
+
-- pairing_codes: a code's SHA-256 alone (hex), good once until expires_at; a used one is deleted as it pairs. Its id names
|
|
7
|
+
-- the pairing and is kept on the computer it made (paired_computers.pairing_id), so the console that made the code can
|
|
8
|
+
-- tell its own code was used, and by which computer.
|
|
9
|
+
-- Each table is made only where it is missing, so a store whose record of this file was lost applies it again unharmed.
|
|
10
|
+
|
|
11
|
+
CREATE TABLE IF NOT EXISTS paired_computers (
|
|
12
|
+
id TEXT COLLATE "C" PRIMARY KEY,
|
|
13
|
+
name TEXT COLLATE "C" NOT NULL,
|
|
14
|
+
hello TEXT COLLATE "C" NOT NULL CHECK (hello::json IS NOT NULL),
|
|
15
|
+
driver TEXT COLLATE "C" NOT NULL,
|
|
16
|
+
labels TEXT COLLATE "C" NOT NULL CHECK (labels::json IS NOT NULL),
|
|
17
|
+
token_sha256 TEXT COLLATE "C" NOT NULL UNIQUE,
|
|
18
|
+
pairing_id TEXT COLLATE "C" NOT NULL UNIQUE,
|
|
19
|
+
created_at BIGINT NOT NULL,
|
|
20
|
+
seen_at BIGINT,
|
|
21
|
+
revoked_at BIGINT
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
CREATE TABLE IF NOT EXISTS pairing_codes (
|
|
25
|
+
id TEXT COLLATE "C" NOT NULL UNIQUE,
|
|
26
|
+
code_sha256 TEXT COLLATE "C" PRIMARY KEY,
|
|
27
|
+
expires_at BIGINT NOT NULL
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
UPDATE store_meta SET schema_version = 8 WHERE singleton = 1;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
-- The store's schema on Postgres, version 9: a command keeps its answer, as store/schema.ts keeps it on SQLite
|
|
2
|
+
-- (version 11, commands.answer). The runner writes it with the commit that takes the row; the server reads it once and clears it
|
|
3
|
+
-- (Store.answerOf). Applied once, after 0008, inside the transaction migrate.ts opens. Never edit this file once applied: a
|
|
4
|
+
-- change is a new file.
|
|
5
|
+
--
|
|
6
|
+
-- answer: JSON text, NULL until a take writes one and again once it is read.
|
|
7
|
+
|
|
8
|
+
ALTER TABLE commands ADD COLUMN answer TEXT COLLATE "C" CHECK (answer IS NULL OR answer::json IS NOT NULL);
|
|
9
|
+
|
|
10
|
+
UPDATE store_meta SET schema_version = 9 WHERE singleton = 1;
|
package/dist/store/schema.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export declare const SCHEMA_VERSION =
|
|
1
|
+
export declare const SCHEMA_VERSION = 11;
|
|
2
2
|
/** One answer per approval of a run: a second approve or deny command naming the same approval is refused
|
|
3
3
|
* (StoreConstraint), so the first answer a person gives wins from the moment it is written, before the runner takes it
|
|
4
4
|
* (runs-over-store.ts approve). In STORE_DDL, and added at a server open to a store an earlier build of this version made. */
|
|
5
5
|
/** One unrefused answer per approval of a run: an answer the runner refused (its run could not resume) holds no place, so
|
|
6
6
|
* the person can answer again. */
|
|
7
|
+
export declare const ONE_ANSWER_INDEX = "commands_one_answer";
|
|
7
8
|
export declare const COMMANDS_ONE_ANSWER = "CREATE UNIQUE INDEX IF NOT EXISTS commands_one_answer ON commands (run_id, json_extract(body, '$.approval')) WHERE kind IN ('approve', 'deny') AND refused IS NULL";
|
|
8
9
|
export declare const STORE_DDL: readonly string[];
|
|
9
10
|
/** pi-durable's journal tables (its SqliteStorage schema, version 2, the `sleeping` task status included; MIT, see NOTICE),
|
package/dist/store/schema.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
// The store's one schema, version
|
|
1
|
+
// The store's one schema, version 11 (design 2.1). Nothing migrates into it: the rewrite replaces the old stores, and a store
|
|
2
2
|
// an older build made is refused as a version this build does not know. The server sets it up once at its start (a
|
|
3
3
|
// store_meta row holds the version); a runner refuses a version it does not know. Version 2 adds the computer ledger;
|
|
4
4
|
// version 3 numbers each save of a sign-in (sign_ins.save); version 4 stamps an MCP token's end (mcp_servers.token_until);
|
|
5
|
-
// version 5 maps an externally owned agent (agents.external_ref, revisions.external_version)
|
|
5
|
+
// version 5 maps an externally owned agent (agents.external_ref, revisions.external_version); version 6 tells a person's
|
|
6
|
+
// stop from a cancel (runs.outcome 'stopped' or 'cancelled'); version 7 keeps a run's learning by round
|
|
7
|
+
// (learning_proposals.round: a follow-up to a run that ended looks back again, a round of its own); version 8 adds the
|
|
8
|
+
// run-change feed (run_changes), each channel post's tries (channel_attempts) and the claim a post's try settles under
|
|
9
|
+
// (channel_posts.claim); version 9 adds where a live viewer answers (computer_viewers.host, a runner's live host,
|
|
10
|
+
// live-reach.ts); version 10 pairs a person's own computer (paired_computers, pairing_codes); version 11 keeps a command's answer
|
|
11
|
+
// (commands.answer).
|
|
6
12
|
// Conventions: every time is INTEGER epoch milliseconds; JSON is TEXT checked by json_valid; money is REAL US dollars;
|
|
7
13
|
// sealed columns hold ciphertext only (sealed with the server's key outside the store), so the store never sees a secret
|
|
8
14
|
// in the clear. Foreign keys are on (the connection's pragma).
|
|
@@ -13,13 +19,14 @@
|
|
|
13
19
|
// learning state, the MCP registry, pending MCP sign-ins, each run's MCP pin, and the computer ledger. PI_DDL is pi-durable's
|
|
14
20
|
// journal tables, keyed by run_id (store/journal): one schema for every run's journal, so a query joins runs and their
|
|
15
21
|
// journals.
|
|
16
|
-
export const SCHEMA_VERSION =
|
|
22
|
+
export const SCHEMA_VERSION = 11;
|
|
17
23
|
/** One answer per approval of a run: a second approve or deny command naming the same approval is refused
|
|
18
24
|
* (StoreConstraint), so the first answer a person gives wins from the moment it is written, before the runner takes it
|
|
19
25
|
* (runs-over-store.ts approve). In STORE_DDL, and added at a server open to a store an earlier build of this version made. */
|
|
20
26
|
/** One unrefused answer per approval of a run: an answer the runner refused (its run could not resume) holds no place, so
|
|
21
27
|
* the person can answer again. */
|
|
22
|
-
export const
|
|
28
|
+
export const ONE_ANSWER_INDEX = "commands_one_answer";
|
|
29
|
+
export const COMMANDS_ONE_ANSWER = `CREATE UNIQUE INDEX IF NOT EXISTS ${ONE_ANSWER_INDEX} ON commands (run_id, json_extract(body, '$.approval')) WHERE kind IN ('approve', 'deny') AND refused IS NULL`;
|
|
23
30
|
const json = (column, nullable = false) => `${column} TEXT${nullable ? "" : " NOT NULL"} CHECK (${column} IS NULL OR json_valid(${column}))`;
|
|
24
31
|
export const STORE_DDL = [
|
|
25
32
|
`CREATE TABLE IF NOT EXISTS store_meta (
|
|
@@ -80,10 +87,11 @@ export const STORE_DDL = [
|
|
|
80
87
|
cost_usd REAL,
|
|
81
88
|
${json("metrics", true)},
|
|
82
89
|
summary TEXT,
|
|
83
|
-
-- How
|
|
84
|
-
-- person, which v2 reads as completed with a review) or 'completed'; null is a plain completion. A
|
|
85
|
-
--
|
|
86
|
-
|
|
90
|
+
-- How the run ended beside its state (RunOutcome). An ended run: 'escalated' (it finished its work and waits for a
|
|
91
|
+
-- person, which v2 reads as completed with a review) or 'completed'; null is a plain completion. A stopped run:
|
|
92
|
+
-- 'stopped' when a person stopped it (its turn is over, not the run: a message reopens it) or 'cancelled' (over for
|
|
93
|
+
-- good). A failed run says so in its state and needs none. Written in the run's end commit (RunPatch.outcome).
|
|
94
|
+
outcome TEXT CHECK (outcome IS NULL OR outcome IN ('completed', 'escalated', 'stopped', 'cancelled')),
|
|
87
95
|
-- When the run itself was archived (its agent's archive is the agent row's): hidden from the default lists, kept.
|
|
88
96
|
archived_at INTEGER,
|
|
89
97
|
-- The session an imported run came from ({source, session}), written by Store.importRun; null for a run started here.
|
|
@@ -104,6 +112,25 @@ export const STORE_DDL = [
|
|
|
104
112
|
`CREATE INDEX IF NOT EXISTS runs_by_agent ON runs (agent_id, started_at)`,
|
|
105
113
|
`CREATE INDEX IF NOT EXISTS runs_by_revision ON runs (revision_id, started_at)`,
|
|
106
114
|
`CREATE INDEX IF NOT EXISTS runs_claimable ON runs (state, started_at)`,
|
|
115
|
+
// The run-change feed (Runs.changedSince): a row for each run reaching a final state or let go by its runner (parked, or
|
|
116
|
+
// running with no runner), written by the trigger below in the transaction of the write that made it, so no writer of a
|
|
117
|
+
// run's state or runner can miss it and none lands without its write. `seq` numbers them in commit order (one writer).
|
|
118
|
+
`CREATE TABLE IF NOT EXISTS run_changes (
|
|
119
|
+
seq INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
120
|
+
run_id TEXT NOT NULL,
|
|
121
|
+
state TEXT NOT NULL,
|
|
122
|
+
ended_at INTEGER,
|
|
123
|
+
epoch INTEGER NOT NULL,
|
|
124
|
+
runner TEXT
|
|
125
|
+
) STRICT`,
|
|
126
|
+
// A change is a move of the state or the runner into a final state, parked, or running with none: a fence's touch of
|
|
127
|
+
// the row (epoch = epoch), a claim, a renew and a cost or summary write are none.
|
|
128
|
+
`CREATE TRIGGER IF NOT EXISTS runs_changed AFTER UPDATE OF state, runner ON runs
|
|
129
|
+
WHEN (OLD.state IS NOT NEW.state OR OLD.runner IS NOT NEW.runner)
|
|
130
|
+
AND (NEW.state IN ('ended', 'stopped', 'failed', 'parked') OR (NEW.state = 'running' AND NEW.runner IS NULL))
|
|
131
|
+
BEGIN
|
|
132
|
+
INSERT INTO run_changes (run_id, state, ended_at, epoch, runner) VALUES (NEW.id, NEW.state, NEW.ended_at, NEW.epoch, NEW.runner);
|
|
133
|
+
END`,
|
|
107
134
|
// One run per imported session: Store.importRun is refused a session it already imported (as the old store's
|
|
108
135
|
// UNIQUE (source, session) did).
|
|
109
136
|
`CREATE UNIQUE INDEX IF NOT EXISTS runs_import ON runs (json_extract(imported_from, '$.source'), json_extract(imported_from, '$.session')) WHERE imported_from IS NOT NULL`,
|
|
@@ -116,7 +143,8 @@ export const STORE_DDL = [
|
|
|
116
143
|
created_at INTEGER NOT NULL,
|
|
117
144
|
taken_at INTEGER,
|
|
118
145
|
refused TEXT,
|
|
119
|
-
tries INTEGER NOT NULL DEFAULT 0
|
|
146
|
+
tries INTEGER NOT NULL DEFAULT 0,
|
|
147
|
+
${json("answer", true)}
|
|
120
148
|
) STRICT`,
|
|
121
149
|
`CREATE INDEX IF NOT EXISTS commands_by_run ON commands (run_id, id)`,
|
|
122
150
|
`CREATE INDEX IF NOT EXISTS commands_untaken ON commands (run_id) WHERE taken_at IS NULL`,
|
|
@@ -220,6 +248,7 @@ export const STORE_DDL = [
|
|
|
220
248
|
attempts INTEGER NOT NULL DEFAULT 0,
|
|
221
249
|
next_at INTEGER NOT NULL,
|
|
222
250
|
claimed_until INTEGER,
|
|
251
|
+
claim TEXT,
|
|
223
252
|
state TEXT NOT NULL CHECK (state IN ('queued', 'sending', 'sent', 'dropped')),
|
|
224
253
|
reason TEXT,
|
|
225
254
|
created_at INTEGER NOT NULL
|
|
@@ -233,6 +262,22 @@ export const STORE_DDL = [
|
|
|
233
262
|
at INTEGER NOT NULL,
|
|
234
263
|
PRIMARY KEY (channel, run_id, marker)
|
|
235
264
|
) STRICT`,
|
|
265
|
+
// Each try of a channel's post (the outbound webhook's deliveries log): kept to the newest few per channel, each once by
|
|
266
|
+
// its try's id.
|
|
267
|
+
`CREATE TABLE IF NOT EXISTS channel_attempts (
|
|
268
|
+
seq INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
269
|
+
try_id TEXT NOT NULL UNIQUE,
|
|
270
|
+
channel TEXT NOT NULL,
|
|
271
|
+
post_id TEXT NOT NULL,
|
|
272
|
+
moment TEXT NOT NULL,
|
|
273
|
+
at INTEGER NOT NULL,
|
|
274
|
+
status_code INTEGER,
|
|
275
|
+
latency_ms INTEGER NOT NULL,
|
|
276
|
+
error TEXT,
|
|
277
|
+
retry_at INTEGER,
|
|
278
|
+
redelivery INTEGER NOT NULL CHECK (redelivery IN (0, 1))
|
|
279
|
+
) STRICT`,
|
|
280
|
+
`CREATE INDEX IF NOT EXISTS channel_attempts_by_channel ON channel_attempts (channel, seq)`,
|
|
236
281
|
// A code review's ledger, per head and firing.
|
|
237
282
|
`CREATE TABLE IF NOT EXISTS review_ledger (
|
|
238
283
|
repo TEXT NOT NULL,
|
|
@@ -265,6 +310,29 @@ export const STORE_DDL = [
|
|
|
265
310
|
${json("detail")},
|
|
266
311
|
updated_at INTEGER NOT NULL,
|
|
267
312
|
PRIMARY KEY (provider, session_id)
|
|
313
|
+
) STRICT`,
|
|
314
|
+
// A person's own machine paired with this server (spec/computer/attach.md): its driver dials the attach socket with the
|
|
315
|
+
// token pairing gave it, of which only the SHA-256 is kept (hex). `hello`: the driver's hello at pairing, what it paired
|
|
316
|
+
// as; `driver`: the build its last hello named. `seen_at`: its last socket's hello; `revoked_at`: when it was removed,
|
|
317
|
+
// after which its token dials no more (the row stays, so a run that names it is told it was removed).
|
|
318
|
+
`CREATE TABLE IF NOT EXISTS paired_computers (
|
|
319
|
+
id TEXT PRIMARY KEY,
|
|
320
|
+
name TEXT NOT NULL,
|
|
321
|
+
${json("hello")},
|
|
322
|
+
driver TEXT NOT NULL,
|
|
323
|
+
${json("labels")},
|
|
324
|
+
token_sha256 TEXT NOT NULL UNIQUE,
|
|
325
|
+
pairing_id TEXT NOT NULL UNIQUE,
|
|
326
|
+
created_at INTEGER NOT NULL,
|
|
327
|
+
seen_at INTEGER,
|
|
328
|
+
revoked_at INTEGER
|
|
329
|
+
) STRICT`,
|
|
330
|
+
// A pairing code, by its SHA-256 alone (hex): good once, until expires_at. A used one is deleted as it pairs. `id` names
|
|
331
|
+
// the pairing (not the code): the console that made it reads it back on the computer the code made (paired_computers.pairing_id).
|
|
332
|
+
`CREATE TABLE IF NOT EXISTS pairing_codes (
|
|
333
|
+
id TEXT NOT NULL UNIQUE,
|
|
334
|
+
code_sha256 TEXT PRIMARY KEY,
|
|
335
|
+
expires_at INTEGER NOT NULL
|
|
268
336
|
) STRICT`,
|
|
269
337
|
`CREATE TABLE IF NOT EXISTS learning (
|
|
270
338
|
agent_id TEXT NOT NULL REFERENCES agents (id),
|
|
@@ -379,19 +447,23 @@ export const STORE_DDL = [
|
|
|
379
447
|
at INTEGER NOT NULL,
|
|
380
448
|
runner TEXT NOT NULL,
|
|
381
449
|
epoch INTEGER NOT NULL,
|
|
450
|
+
host TEXT,
|
|
382
451
|
PRIMARY KEY (run_id, kind, tag)
|
|
383
452
|
) STRICT`,
|
|
384
453
|
// Learning on the runner: what a run's end-of-run turn kept (the turn it asked and answered, and the proposal checked from
|
|
385
454
|
// it), written in the same commit as the run's end, beside the learning run that grades and merges it (learning_run_id,
|
|
386
|
-
// none for a learning dropped before it was proposed).
|
|
387
|
-
//
|
|
455
|
+
// none for a learning dropped before it was proposed). One row a round: a run's first end is round 1, and each end
|
|
456
|
+
// after a follow-up opened it again is the next. Read by the learning routes (the pre-merge view), by the learning run,
|
|
457
|
+
// and by the reader of a run's learning end (store-reads/learning.ts), which reads the newest round.
|
|
388
458
|
`CREATE TABLE IF NOT EXISTS learning_proposals (
|
|
389
|
-
run_id TEXT
|
|
459
|
+
run_id TEXT NOT NULL REFERENCES runs (id),
|
|
460
|
+
round INTEGER NOT NULL CHECK (round >= 1),
|
|
390
461
|
agent_id TEXT NOT NULL REFERENCES agents (id),
|
|
391
462
|
${json("turn")},
|
|
392
463
|
${json("proposal")},
|
|
393
464
|
learning_run_id TEXT,
|
|
394
|
-
created_at INTEGER NOT NULL
|
|
465
|
+
created_at INTEGER NOT NULL,
|
|
466
|
+
PRIMARY KEY (run_id, round)
|
|
395
467
|
) STRICT`,
|
|
396
468
|
`CREATE INDEX IF NOT EXISTS learning_proposals_by_agent ON learning_proposals (agent_id, created_at DESC)`,
|
|
397
469
|
];
|
package/dist/store/seal.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export declare const sealedAt: {
|
|
|
13
13
|
signIn: (agentId: string, provider: string) => SealedAt;
|
|
14
14
|
/** A run's computer session's live viewer token (browser-live.ts): one row per run, computer kind and session tag. */
|
|
15
15
|
liveViewer: (runId: string, kind: string, tag: string) => SealedAt;
|
|
16
|
+
/** A run's launch secrets: the MCP credentials its caller handed it for its `per_run` servers (mcp_auth). */
|
|
17
|
+
runLaunch: (runId: string) => SealedAt;
|
|
16
18
|
};
|
|
17
19
|
/** The AAD a value at `at` is sealed under. A part with the separator in it is refused: no two places share an AAD. */
|
|
18
20
|
export declare function aadOf(at: SealedAt): string;
|
|
@@ -46,3 +48,14 @@ export declare function openMcpCredential(key: Buffer, row: {
|
|
|
46
48
|
readonly url: string;
|
|
47
49
|
readonly sealed: Uint8Array | null;
|
|
48
50
|
}): OpenedMcpCredential;
|
|
51
|
+
/** The MCP credentials a run's caller handed it (`mcp_auth` at its start or with a message), by server name: each one's
|
|
52
|
+
* headers and the origin of the server's url when it was handed, so a server moved since never receives them. */
|
|
53
|
+
export type RunMcpAuth = Readonly<Record<string, {
|
|
54
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
55
|
+
readonly origin: string;
|
|
56
|
+
}>>;
|
|
57
|
+
/** Seals a run's handed MCP credentials as its launch's sealed column (AAD run_launch|<run_id>|sealed). */
|
|
58
|
+
export declare function sealRunMcpAuth(key: Buffer, runId: string, auth: RunMcpAuth): Uint8Array;
|
|
59
|
+
/** A run's handed MCP credentials, opened: none when its launch holds none; undefined when the bytes do not open under
|
|
60
|
+
* `key` for this run (sealed for another run, or under another key). */
|
|
61
|
+
export declare function openRunMcpAuth(key: Buffer, runId: string, sealed: Uint8Array | null): RunMcpAuth | undefined;
|
package/dist/store/seal.js
CHANGED
|
@@ -25,6 +25,8 @@ export const sealedAt = {
|
|
|
25
25
|
},
|
|
26
26
|
/** A run's computer session's live viewer token (browser-live.ts): one row per run, computer kind and session tag. */
|
|
27
27
|
liveViewer: (runId, kind, tag) => ({ table: "computer_viewers", row: `${runId}/${kind}:${tag}`, column: "sealed" }),
|
|
28
|
+
/** A run's launch secrets: the MCP credentials its caller handed it for its `per_run` servers (mcp_auth). */
|
|
29
|
+
runLaunch: (runId) => ({ table: "run_launch", row: runId, column: "sealed" }),
|
|
28
30
|
};
|
|
29
31
|
/** The AAD a value at `at` is sealed under. A part with the separator in it is refused: no two places share an AAD. */
|
|
30
32
|
export function aadOf(at) {
|
|
@@ -67,3 +69,20 @@ export function openMcpCredential(key, row) {
|
|
|
67
69
|
}
|
|
68
70
|
return { credential: credential };
|
|
69
71
|
}
|
|
72
|
+
/** Seals a run's handed MCP credentials as its launch's sealed column (AAD run_launch|<run_id>|sealed). */
|
|
73
|
+
export function sealRunMcpAuth(key, runId, auth) {
|
|
74
|
+
return sealColumn(key, sealedAt.runLaunch(runId), JSON.stringify({ mcp: auth }));
|
|
75
|
+
}
|
|
76
|
+
/** A run's handed MCP credentials, opened: none when its launch holds none; undefined when the bytes do not open under
|
|
77
|
+
* `key` for this run (sealed for another run, or under another key). */
|
|
78
|
+
export function openRunMcpAuth(key, runId, sealed) {
|
|
79
|
+
if (sealed === null)
|
|
80
|
+
return {};
|
|
81
|
+
try {
|
|
82
|
+
const opened = JSON.parse(unsealColumn(key, sealedAt.runLaunch(runId), sealed).toString("utf8"));
|
|
83
|
+
return opened.mcp ?? {};
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -4,6 +4,11 @@ import type { Statement, StatementResult } from "./worker.js";
|
|
|
4
4
|
export type { Params, Statement, StatementResult } from "./worker.js";
|
|
5
5
|
/** How long a transaction may stay open (it holds every other call of the process) before it is rolled back. */
|
|
6
6
|
export declare const DEFAULT_TRANSACTION_DEADLINE_MS = 10000;
|
|
7
|
+
/** `error` with its stack naming who held the store: `opened` (its own transaction's opener, when it has one), and every
|
|
8
|
+
* other transaction open in this process with its age. */
|
|
9
|
+
export declare function holderNamed<E extends Error>(error: E, { opened }?: {
|
|
10
|
+
opened?: Error;
|
|
11
|
+
}): E;
|
|
7
12
|
/** A value SQLite takes or gives back (Chord's SqliteValue). */
|
|
8
13
|
export type SqliteValue = null | number | bigint | string | Uint8Array;
|
|
9
14
|
/** Chord's SqliteExecutor: what a database and a transaction handle both do. */
|
|
@@ -8,20 +8,46 @@ import { Worker } from "node:worker_threads";
|
|
|
8
8
|
import { runnableDeadline } from "../deadline.js";
|
|
9
9
|
import { cleanText, SQLITE } from "../dialect.js";
|
|
10
10
|
import { inMemory } from "./memory.js";
|
|
11
|
-
import {
|
|
11
|
+
import { ONE_ANSWER_INDEX } from "../schema.js";
|
|
12
|
+
import { AnswerTaken, Fenced, RunFinal, StoreBusy, StoreClosed, StoreConstraint, StoreDeadline, StoreOwned, StoreWorkerLost } from "../store.js";
|
|
12
13
|
/** How long a transaction may stay open (it holds every other call of the process) before it is rolled back. */
|
|
13
14
|
export const DEFAULT_TRANSACTION_DEADLINE_MS = 10_000;
|
|
15
|
+
/** The interactive transactions open in this process, on any of its connections: each with where it was opened and when
|
|
16
|
+
* it began. A transaction's StoreDeadline, and a begin's StoreBusy, name them in their stack (never their message, which
|
|
17
|
+
* an answer may carry), so a log says who held the store: the deadline's own transaction, or another of this process's
|
|
18
|
+
* (an in-process runner's) holding the lock a begin waited on. */
|
|
19
|
+
const OPEN = new Set();
|
|
20
|
+
/** `opened`'s frames: where a transaction was asked for, without the Error line itself. */
|
|
21
|
+
const framesOf = (opened) => (opened.stack ?? "").split("\n").slice(1).join("\n");
|
|
22
|
+
/** `error` with its stack naming who held the store: `opened` (its own transaction's opener, when it has one), and every
|
|
23
|
+
* other transaction open in this process with its age. */
|
|
24
|
+
export function holderNamed(error, { opened } = {}) {
|
|
25
|
+
const lines = [];
|
|
26
|
+
if (opened)
|
|
27
|
+
lines.push(` the transaction was opened at:\n${framesOf(opened)}`);
|
|
28
|
+
const now = Date.now();
|
|
29
|
+
const others = [...OPEN].filter((open) => open.opened !== opened);
|
|
30
|
+
if (others.length)
|
|
31
|
+
lines.push(` other transactions open in this process:\n${others.map((open) => ` open ${now - open.began} ms, opened at:\n${framesOf(open.opened)}`).join("\n")}`);
|
|
32
|
+
if (lines.length)
|
|
33
|
+
error.stack = `${error.stack ?? `${error.name}: ${error.message}`}\n${lines.join("\n")}`;
|
|
34
|
+
return error;
|
|
35
|
+
}
|
|
14
36
|
/** A statement's text parameters as the store writes text (dialect.ts cleanText: no NUL), on both stores alike. */
|
|
15
37
|
const cleaned = (params) => (params ?? []).map((value) => (typeof value === "string" ? cleanText(value) : value));
|
|
16
38
|
const cleanStatement = (statement) => ({ ...statement, params: cleaned(statement.params) });
|
|
17
39
|
/** SQLite's extended constraint codes, by the rule they name. */
|
|
18
40
|
const RULES = { 275: "check", 2067: "unique", 1555: "unique", 787: "foreign_key", 1299: "not_null" };
|
|
19
41
|
/** Which rule refused a row, from SQLite's extended code; for a duplicate, its table and columns, which SQLite reports
|
|
20
|
-
* only in its message ("UNIQUE constraint failed: t.a, t.b")
|
|
42
|
+
* only in its message ("UNIQUE constraint failed: t.a, t.b"), or the index's name for an index on an expression
|
|
43
|
+
* ("UNIQUE constraint failed: index 'commands_one_answer'"): read here, in the SQLite adapter alone. */
|
|
21
44
|
function constraintOf(errcode, message) {
|
|
22
45
|
const rule = RULES[errcode];
|
|
23
46
|
if (rule !== "unique")
|
|
24
47
|
return rule ? { rule } : {};
|
|
48
|
+
const index = /UNIQUE constraint failed: index '([^']+)'$/.exec(message)?.[1];
|
|
49
|
+
if (index)
|
|
50
|
+
return { rule, index };
|
|
25
51
|
const named = /UNIQUE constraint failed: (.+)$/.exec(message)?.[1]?.split(", ").map((part) => part.split("."));
|
|
26
52
|
if (!named?.length || named.some((part) => part.length !== 2) || new Set(named.map(([table]) => table)).size !== 1)
|
|
27
53
|
return { rule };
|
|
@@ -33,8 +59,13 @@ function typed(error) {
|
|
|
33
59
|
return error.miss.kind === "fenced" ? new Fenced(error.miss.runId, error.miss.epoch) : new RunFinal(error.miss.runId);
|
|
34
60
|
case "busy":
|
|
35
61
|
return new StoreBusy(`the store stayed locked past its busy wait: ${error.message}`);
|
|
36
|
-
case "constraint":
|
|
37
|
-
|
|
62
|
+
case "constraint": {
|
|
63
|
+
const refused = constraintOf(error.errcode, error.message);
|
|
64
|
+
// A second answer to one approval (the one-answer index): the answer written first stands.
|
|
65
|
+
if (refused.rule === "unique" && refused.index === ONE_ANSWER_INDEX)
|
|
66
|
+
return new AnswerTaken(error.message, refused.index);
|
|
67
|
+
return new StoreConstraint(error.message, refused);
|
|
68
|
+
}
|
|
38
69
|
case "closed":
|
|
39
70
|
return new StoreClosed();
|
|
40
71
|
case "owned":
|
|
@@ -215,6 +246,8 @@ export class Connection {
|
|
|
215
246
|
transaction(callback, { full = false, read = false, deadlineMs = DEFAULT_TRANSACTION_DEADLINE_MS, fromCall = false } = {}) {
|
|
216
247
|
// `fromCall`: the deadline's end, counted from now (the queue's wait inside it); else counted from the begin.
|
|
217
248
|
const until = fromCall ? Date.now() + deadlineMs : undefined;
|
|
249
|
+
// Where it was asked for: a deadline or a busy begin names it (holderNamed).
|
|
250
|
+
const opened = new Error("a store transaction");
|
|
218
251
|
// Set when its deadline ran out while it still waited in the queue: its turn then begins nothing.
|
|
219
252
|
let gaveUp = false;
|
|
220
253
|
let started = false;
|
|
@@ -222,7 +255,7 @@ export class Connection {
|
|
|
222
255
|
const run = this.#queued(async () => {
|
|
223
256
|
started = true;
|
|
224
257
|
if (gaveUp || (until !== undefined && Date.now() >= until))
|
|
225
|
-
throw new StoreDeadline(deadlineMs);
|
|
258
|
+
throw holderNamed(new StoreDeadline(deadlineMs), { opened });
|
|
226
259
|
// Its wait for the database's lock (another process's write) bounded by what the deadline leaves: a lock still held
|
|
227
260
|
// when that runs out is the deadline's end, not the connection's own busy wait.
|
|
228
261
|
const busyMs = until !== undefined ? Math.max(0, until - Date.now()) : undefined;
|
|
@@ -231,55 +264,63 @@ export class Connection {
|
|
|
231
264
|
}
|
|
232
265
|
catch (error) {
|
|
233
266
|
if (error instanceof StoreBusy && busyMs !== undefined && busyMs < this.#busyTimeoutMs)
|
|
234
|
-
throw new StoreDeadline(deadlineMs);
|
|
235
|
-
throw error;
|
|
267
|
+
throw holderNamed(new StoreDeadline(deadlineMs), { opened });
|
|
268
|
+
throw error instanceof StoreBusy ? holderNamed(error, { opened }) : error;
|
|
236
269
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
const deadline = new Promise((_, reject) => {
|
|
240
|
-
const expire = () => reject(new StoreDeadline(deadlineMs));
|
|
241
|
-
// Counted from its call (a lease's), the deadline stays the wall clock's: MCP_REFRESH_LEASE_MS is reckoned from
|
|
242
|
-
// it. Counted from its begin, it is the time this process could run (store/deadline.ts runnableDeadline): while other work held
|
|
243
|
-
// the event loop, a statement answered meanwhile waited behind it, and that time was no statement's.
|
|
244
|
-
if (until !== undefined) {
|
|
245
|
-
const timer = setTimeout(expire, Math.max(0, until - Date.now()));
|
|
246
|
-
clear = () => clearTimeout(timer);
|
|
247
|
-
}
|
|
248
|
-
else
|
|
249
|
-
clear = runnableDeadline(deadlineMs, expire).clear;
|
|
250
|
-
});
|
|
251
|
-
let value;
|
|
270
|
+
const open = { opened, began: Date.now() };
|
|
271
|
+
OPEN.add(open);
|
|
252
272
|
try {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
273
|
+
let live = true;
|
|
274
|
+
let clear = () => { };
|
|
275
|
+
const deadline = new Promise((_, reject) => {
|
|
276
|
+
const expire = () => reject(holderNamed(new StoreDeadline(deadlineMs), { opened }));
|
|
277
|
+
// Counted from its call (a lease's), the deadline stays the wall clock's: MCP_REFRESH_LEASE_MS is reckoned from
|
|
278
|
+
// it. Counted from its begin, it is the time this process could run (store/deadline.ts runnableDeadline): while other work held
|
|
279
|
+
// the event loop, a statement answered meanwhile waited behind it, and that time was no statement's.
|
|
280
|
+
if (until !== undefined) {
|
|
281
|
+
const timer = setTimeout(expire, Math.max(0, until - Date.now()));
|
|
282
|
+
clear = () => clearTimeout(timer);
|
|
283
|
+
}
|
|
284
|
+
else
|
|
285
|
+
clear = runnableDeadline(deadlineMs, expire).clear;
|
|
286
|
+
});
|
|
287
|
+
let value;
|
|
288
|
+
try {
|
|
289
|
+
// The worker answers in order: a statement already sent finishes before the rollback a deadline sends after it.
|
|
290
|
+
const running = callback(this.#executor(() => live));
|
|
291
|
+
// Past the deadline the callback's own end is nobody's: its refused next statement must not surface as an
|
|
292
|
+
// unhandled rejection.
|
|
293
|
+
running.catch(() => undefined);
|
|
294
|
+
value = await Promise.race([running, deadline]);
|
|
295
|
+
}
|
|
296
|
+
catch (error) {
|
|
297
|
+
live = false;
|
|
298
|
+
clear();
|
|
299
|
+
try {
|
|
300
|
+
await this.#send({ op: "rollback" });
|
|
301
|
+
}
|
|
302
|
+
catch (rollback) {
|
|
303
|
+
// A worker lost mid-transaction failed both: its loss is the one error, as every later call's.
|
|
304
|
+
if (this.#lost)
|
|
305
|
+
throw this.#lost;
|
|
306
|
+
throw new AggregateError([error, rollback], "the store's transaction failed, and so did its rollback");
|
|
307
|
+
}
|
|
308
|
+
throw error;
|
|
309
|
+
}
|
|
261
310
|
live = false;
|
|
262
311
|
clear();
|
|
263
|
-
|
|
312
|
+
// Counted from its call, a deadline reached by now is never committed past: rolled back, nothing written.
|
|
313
|
+
if (until !== undefined && Date.now() >= until) {
|
|
264
314
|
await this.#send({ op: "rollback" });
|
|
315
|
+
throw holderNamed(new StoreDeadline(deadlineMs), { opened });
|
|
265
316
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
if (this.#lost)
|
|
269
|
-
throw this.#lost;
|
|
270
|
-
throw new AggregateError([error, rollback], "the store's transaction failed, and so did its rollback");
|
|
271
|
-
}
|
|
272
|
-
throw error;
|
|
317
|
+
await this.#send({ op: "commit" });
|
|
318
|
+
return value;
|
|
273
319
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
if (until !== undefined && Date.now() >= until) {
|
|
278
|
-
await this.#send({ op: "rollback" });
|
|
279
|
-
throw new StoreDeadline(deadlineMs);
|
|
320
|
+
finally {
|
|
321
|
+
// Kept until the worker has answered the commit or rollback: until then this transaction still holds the lock.
|
|
322
|
+
OPEN.delete(open);
|
|
280
323
|
}
|
|
281
|
-
await this.#send({ op: "commit" });
|
|
282
|
-
return value;
|
|
283
324
|
});
|
|
284
325
|
if (until === undefined)
|
|
285
326
|
return run;
|
|
@@ -291,7 +332,7 @@ export class Connection {
|
|
|
291
332
|
if (started)
|
|
292
333
|
return;
|
|
293
334
|
gaveUp = true;
|
|
294
|
-
reject(new StoreDeadline(deadlineMs));
|
|
335
|
+
reject(holderNamed(new StoreDeadline(deadlineMs), { opened }));
|
|
295
336
|
}, deadlineMs);
|
|
296
337
|
});
|
|
297
338
|
return Promise.race([run, queuedPast]).finally(() => clearTimeout(waitTimer));
|
|
@@ -2,17 +2,19 @@ import { type AlsoRow, type Claim, type RunPatch, type RunRow, type RunState } f
|
|
|
2
2
|
import { type Dialect } from "../dialect.js";
|
|
3
3
|
import type { SqliteExecutor } from "./connection.js";
|
|
4
4
|
import { type StoreNow } from "../fence.js";
|
|
5
|
-
/** A learning run's launch body: the learning harness, the run that learned as its input, and where it runs (on the
|
|
6
|
-
* runner, no box: its only writes are the learning folder's one script). */
|
|
7
|
-
/** A learning run's launch: harness "learning", its input the run that learned, and `model`, the grade model when one is
|
|
8
|
-
* named (gradeModelOf; none: the agent's own grades it, as main's). No cap: main caps no grade. */
|
|
9
5
|
/** A WHERE condition on `runs`: the run is no built-in learning run (one a kept learning names, queued with it), which no
|
|
10
6
|
* list of runs names. */
|
|
11
7
|
export declare const NOT_A_LEARNING_RUN = "id NOT IN (SELECT learning_run_id FROM learning_proposals WHERE learning_run_id IS NOT NULL)";
|
|
12
|
-
|
|
8
|
+
/** A learning run's launch: harness "learning", its input the run that learned (and the round it grades, past the first),
|
|
9
|
+
* where it runs (on the runner, no box: its only writes are the learning folder's one script), `model`, the grade model
|
|
10
|
+
* when one is named (gradeModelOf; none: the agent's own grades it, as main's), and `max_cost_usd`, what the run's cap
|
|
11
|
+
* left for its grade (`capUsd`: a figure that is not one is no room, $0, never no cap; none for an uncapped run). */
|
|
12
|
+
export declare const learningLaunchOf: (runId: string, model?: string, round?: number, capUsd?: number) => {
|
|
13
|
+
max_cost_usd?: number | undefined;
|
|
13
14
|
model?: string | undefined;
|
|
14
15
|
harness: string;
|
|
15
16
|
input: {
|
|
17
|
+
round?: number | undefined;
|
|
16
18
|
runId: string;
|
|
17
19
|
};
|
|
18
20
|
title: string;
|
|
@@ -51,7 +53,23 @@ export declare const runOf: (r: RunRecord) => RunRow;
|
|
|
51
53
|
* run in the same statement. `dialect`: the connection's (store/dialect.ts), SQLite's by default. `clock`: the deadlines'
|
|
52
54
|
* clock (fence.ts storeNow) the fence and left_running_at read; `now` bound by default. */
|
|
53
55
|
export declare function applyRunPatch(tx: Pick<SqliteExecutor, "run" | "get">, claim: Pick<Claim, "runId" | "epoch">, patch: RunPatch, also: readonly AlsoRow[], now: number, dialect?: Dialect, clock?: StoreNow): Promise<RunRow>;
|
|
56
|
+
/** The one reopen a run that ended may take (runs.reopen, and a run's end with a person's message waiting): back to running
|
|
57
|
+
* with no runner (released: a runner claims it at once), its end's own fields cleared, its epoch, journal, cost and
|
|
58
|
+
* metrics kept. `where` holds only for an agentic run that ended completed or that a person stopped (state 'stopped',
|
|
59
|
+
* outcome 'stopped': its turn ended, never the run, as main's stop leaves one), not imported and not a learning run. A
|
|
60
|
+
* cancelled run, a failed one and a workflow run are over for good. */
|
|
61
|
+
export declare const REOPEN_SET = "state = 'running', runner = NULL, claimed_until = NULL, wake_at = NULL, backoff_until = NULL, ended_at = NULL, summary = NULL, outcome = NULL";
|
|
62
|
+
export declare const reopenableWhere: (d: Dialect) => string;
|
|
54
63
|
/** After a write that made the run final has taken its own rows: every command row of the run still untaken is refused
|
|
55
64
|
* with the end's reason, in that same transaction. The store takes no new row on a final run (RunFinal), so a row the
|
|
56
|
-
* end left untaken would stay so for good, as it would if the runner died right after the end.
|
|
57
|
-
|
|
65
|
+
* end left untaken would stay so for good, as it would if the runner died right after the end.
|
|
66
|
+
* But a person's message (a steer row) that came while the run was ending, after its turn's answer (its end-of-run turn,
|
|
67
|
+
* or before its end: the adapter loop leaves it untaken), opens a run that ended completed again, in this same
|
|
68
|
+
* transaction, as main answers such a message once the end is in (runs.ts message: a completed run opens again, its
|
|
69
|
+
* message the next turn): the run is back to running and released (REOPEN_SET), the message waits untaken for the next
|
|
70
|
+
* claim, which runs it as a new turn, and only the run's other rows are refused. Every message so lands on one path: in
|
|
71
|
+
* before the end, it opens the run here; after it, the store refuses a new row (RunFinal) and runs.reopen takes it.
|
|
72
|
+
* A person's stop is the same (reopenableWhere): a message waiting at it is the run's next turn, as main's stop leaves a
|
|
73
|
+
* message submitted before it to run; a cancel's refuses it. A run left final here has its launch secrets erased (its
|
|
74
|
+
* launch row's `sealed`); a run opened again keeps the ones its waiting message wrote. */
|
|
75
|
+
export declare function refuseLeftovers(tx: Pick<SqliteExecutor, "run" | "get">, runId: string, state: RunState | undefined, now: number, dialect?: Dialect): Promise<void>;
|