@parcha/agentrun-serve 0.1.0-beta.35 → 0.1.0-beta.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +298 -0
- package/README.md +417 -219
- package/dist/adapters.d.ts +12 -2
- package/dist/adapters.js +27 -2
- package/dist/agent-rows.d.ts +2 -1
- package/dist/agents-store.d.ts +2 -0
- package/dist/agents-store.js +9 -4
- package/dist/api-only.d.ts +2 -1
- package/dist/api-only.js +3 -1
- package/dist/archil-routes.d.ts +40 -7
- package/dist/archil-routes.js +167 -54
- package/dist/archil-settings.d.ts +79 -7
- package/dist/archil-settings.js +140 -14
- package/dist/attach-conformance-cli.d.ts +1 -0
- package/dist/attach-conformance-cli.js +18 -0
- package/dist/attach-conformance.d.ts +25 -0
- package/dist/attach-conformance.js +343 -0
- package/dist/attach-images.d.ts +15 -0
- package/dist/attach-images.js +59 -0
- package/dist/background.d.ts +0 -6
- package/dist/background.js +0 -28
- package/dist/box-image.d.ts +1 -97
- package/dist/box-image.js +4 -284
- package/dist/box-paths.d.ts +2 -7
- package/dist/box-paths.js +7 -13
- package/dist/box-settings.d.ts +0 -11
- package/dist/box-settings.js +4 -29
- package/dist/browser-commands.js +1 -1
- package/dist/browser-computer.d.ts +47 -3
- package/dist/browser-computer.js +286 -18
- package/dist/browser-cost.d.ts +1 -1
- package/dist/browser-live.d.ts +20 -8
- package/dist/browser-live.js +50 -27
- package/dist/browser-person.d.ts +19 -2
- package/dist/browser-person.js +55 -6
- package/dist/browser-wait-ended.d.ts +23 -0
- package/dist/browser-wait-ended.js +42 -0
- package/dist/cap.d.ts +12 -57
- package/dist/cap.js +20 -160
- package/dist/catalog.d.ts +1 -12
- package/dist/catalog.js +3 -33
- package/dist/cli.js +17 -26
- package/dist/composio-preset.d.ts +36 -0
- package/dist/composio-preset.js +179 -0
- package/dist/computer-attach.d.ts +125 -0
- package/dist/computer-attach.js +330 -0
- package/dist/computer-calls.d.ts +48 -0
- package/dist/computer-calls.js +126 -0
- package/dist/computer-channel.d.ts +57 -0
- package/dist/computer-channel.js +115 -0
- package/dist/computer-commands.d.ts +1 -1
- package/dist/computer-held-routes.d.ts +35 -0
- package/dist/computer-held-routes.js +106 -0
- package/dist/computer-held.d.ts +48 -0
- package/dist/computer-held.js +87 -0
- package/dist/computer-keys.d.ts +21 -1
- package/dist/computer-keys.js +53 -11
- package/dist/computer-live.d.ts +160 -0
- package/dist/computer-live.js +643 -0
- package/dist/computer-routes.d.ts +1 -4
- package/dist/computer-routes.js +3 -5
- package/dist/computer-setting.d.ts +2 -0
- package/dist/computer-setting.js +38 -1
- package/dist/computer-view.d.ts +24 -2
- package/dist/computer-view.js +51 -3
- package/dist/computer-viewer.d.ts +6 -0
- package/dist/computer-viewer.js +297 -0
- package/dist/computers.d.ts +79 -12
- package/dist/computers.js +147 -28
- package/dist/console/assets/index-Cn6JX1uH.js +563 -0
- package/dist/console/assets/index-DRN62V5v.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/docker-daemon.d.ts +2 -2
- package/dist/docker-daemon.js +2 -2
- package/dist/errors.js +5 -5
- package/dist/faux-computers.d.ts +9 -20
- package/dist/faux-computers.js +56 -24
- package/dist/files.d.ts +1 -9
- package/dist/files.js +1 -9
- package/dist/github-connection.d.ts +10 -2
- package/dist/github-connection.js +65 -2
- package/dist/github-faux.js +1 -1
- package/dist/github.d.ts +22 -2
- package/dist/github.js +42 -8
- package/dist/gpu-words.d.ts +14 -0
- package/dist/gpu-words.js +21 -0
- package/dist/graph-view.d.ts +3 -1
- package/dist/graph-view.js +25 -1
- package/dist/handed-values.d.ts +1 -1
- package/dist/handed-values.js +1 -1
- package/dist/harness-install.d.ts +60 -3
- package/dist/harness-install.js +322 -34
- package/dist/harness.d.ts +1 -0
- package/dist/harness.js +36 -2
- package/dist/host-tools.d.ts +9 -10
- package/dist/host-tools.js +7 -7
- package/dist/hosted-search.d.ts +5 -4
- package/dist/hosted-search.js +2 -7
- package/dist/import-sources.d.ts +10 -0
- package/dist/import-sources.js +44 -2
- package/dist/import.d.ts +3 -3
- package/dist/import.js +37 -6
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -2
- package/dist/key-refusal.d.ts +1 -1
- package/dist/key-refusal.js +2 -2
- package/dist/learn/check.d.ts +11 -2
- package/dist/learn/check.js +124 -6
- package/dist/learn/commit.d.ts +43 -7
- package/dist/learn/commit.js +166 -22
- package/dist/learn/folder.d.ts +11 -0
- package/dist/learn/folder.js +37 -1
- package/dist/learn/general.d.ts +66 -0
- package/dist/learn/general.js +73 -0
- package/dist/learn/grade.d.ts +22 -1
- package/dist/learn/grade.js +107 -16
- package/dist/learn/index.d.ts +1 -1
- package/dist/learn/index.js +1 -1
- package/dist/learn/learning.sh +12 -1
- package/dist/learn/notes.d.ts +3 -0
- package/dist/learn/notes.js +3 -0
- package/dist/learn/reflect.d.ts +14 -2
- package/dist/learn/reflect.js +54 -30
- package/dist/learn/skills.d.ts +37 -5
- package/dist/learn/skills.js +60 -7
- package/dist/learned-nodes.d.ts +6 -2
- package/dist/learned-workflow.d.ts +43 -9
- package/dist/learned-workflow.js +128 -37
- package/dist/learning-batch.d.ts +283 -0
- package/dist/learning-batch.js +574 -0
- package/dist/learning-cost.d.ts +79 -0
- package/dist/learning-cost.js +69 -0
- package/dist/learning-evals.d.ts +33 -0
- package/dist/learning-evals.js +98 -0
- package/dist/learning-routes.d.ts +32 -4
- package/dist/learning-routes.js +48 -12
- package/dist/learning-words.d.ts +9 -0
- package/dist/learning-words.js +12 -2
- package/dist/learning.d.ts +39 -19
- package/dist/learning.js +88 -46
- package/dist/live/stream.js +6 -3
- package/dist/live/translate.d.ts +4 -3
- package/dist/live/translate.js +8 -4
- package/dist/live-reach.d.ts +37 -0
- package/dist/live-reach.js +62 -0
- package/dist/mcp-gateway.d.ts +9 -0
- package/dist/mcp-gateway.js +60 -11
- package/dist/mcp-oauth.d.ts +57 -7
- package/dist/mcp-oauth.js +133 -18
- package/dist/mcp-private-hosts.d.ts +4 -4
- package/dist/mcp-private-hosts.js +20 -12
- package/dist/mcp-probe.d.ts +27 -3
- package/dist/mcp-probe.js +106 -29
- package/dist/mcp-secret-writes.js +8 -0
- package/dist/mcp-servers-store.d.ts +38 -15
- package/dist/mcp-servers-store.js +120 -23
- package/dist/mcp-store.d.ts +10 -4
- package/dist/mcp-store.js +17 -6
- package/dist/model-form.d.ts +26 -0
- package/dist/model-form.js +80 -0
- package/dist/model.d.ts +5 -5
- package/dist/model.js +29 -16
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +586 -64
- package/dist/owner.d.ts +0 -1
- package/dist/owner.js +0 -2
- package/dist/page.d.ts +18 -0
- package/dist/page.js +48 -20
- package/dist/paid-calls.d.ts +1 -1
- package/dist/paid-calls.js +1 -1
- package/dist/place-offers.d.ts +96 -0
- package/dist/place-offers.js +202 -0
- package/dist/place.d.ts +9 -13
- package/dist/place.js +21 -32
- package/dist/port-models.d.ts +2 -1
- package/dist/port-models.js +5 -3
- package/dist/print.d.ts +16 -9
- package/dist/print.js +15 -17
- package/dist/propose.d.ts +4 -0
- package/dist/propose.js +34 -11
- package/dist/provider.js +3 -2
- package/dist/reflect-range.d.ts +8 -1
- package/dist/reflect-range.js +1 -1
- package/dist/run-cut.d.ts +5 -0
- package/dist/run-cut.js +19 -0
- package/dist/run-launch.d.ts +28 -3
- package/dist/run-launch.js +14 -4
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-manifest.d.ts +2 -2
- package/dist/run-manifest.js +2 -2
- package/dist/run-reads-over-store.d.ts +1 -1
- package/dist/run-repo.d.ts +20 -0
- package/dist/run-repo.js +63 -0
- package/dist/run-secrets.js +3 -3
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-timeline-served.js +56 -44
- package/dist/run-view.d.ts +8 -5
- package/dist/run-view.js +18 -10
- package/dist/runnable.d.ts +2 -2
- package/dist/runnable.js +6 -2
- package/dist/runner/adapter-loop.d.ts +39 -8
- package/dist/runner/adapter-loop.js +770 -83
- package/dist/runner/adapter-run-spec.d.ts +36 -7
- package/dist/runner/adapter-run-spec.js +171 -37
- package/dist/runner/adapters/pi-computer.d.ts +7 -0
- package/dist/runner/adapters/pi-computer.js +43 -0
- package/dist/runner/adapters/pi.d.ts +20 -7
- package/dist/runner/adapters/pi.js +111 -26
- package/dist/runner/beside.d.ts +7 -3
- package/dist/runner/beside.js +26 -12
- package/dist/runner/claim-secrets.d.ts +4 -0
- package/dist/runner/claim-secrets.js +6 -1
- package/dist/runner/cli-run-spec.d.ts +27 -3
- package/dist/runner/cli-run-spec.js +198 -74
- package/dist/runner/commands.d.ts +8 -2
- package/dist/runner/commands.js +31 -6
- package/dist/runner/computer-channel.d.ts +34 -0
- package/dist/runner/computer-channel.js +61 -0
- package/dist/runner/conformance/harness.d.ts +0 -1
- package/dist/runner/conformance/harness.js +87 -18
- package/dist/runner/conformance/subject.d.ts +1 -1
- package/dist/runner/dispatch.js +3 -0
- package/dist/runner/end-of-run.d.ts +22 -12
- package/dist/runner/end-of-run.js +38 -16
- package/dist/runner/github-app.d.ts +2 -1
- package/dist/runner/github-app.js +6 -4
- package/dist/runner/harness-loops.js +16 -2
- package/dist/runner/held-run.d.ts +65 -0
- package/dist/runner/held-run.js +158 -0
- package/dist/runner/journal-kinds.d.ts +35 -6
- package/dist/runner/journal-kinds.js +20 -1
- package/dist/runner/journal-reader.d.ts +5 -4
- package/dist/runner/journal-reader.js +12 -10
- package/dist/runner/learning-ask.d.ts +7 -1
- package/dist/runner/learning-ask.js +21 -6
- package/dist/runner/learning-dispatch.d.ts +22 -0
- package/dist/runner/learning-dispatch.js +77 -10
- package/dist/runner/learning-end.d.ts +37 -1
- package/dist/runner/learning-end.js +115 -14
- package/dist/runner/learning-factory.d.ts +1 -1
- package/dist/runner/learning-factory.js +15 -5
- package/dist/runner/learning-loop.d.ts +139 -7
- package/dist/runner/learning-loop.js +369 -32
- package/dist/runner/learning-seed.d.ts +9 -0
- package/dist/runner/learning-seed.js +14 -1
- package/dist/runner/live-ticker.js +1 -0
- package/dist/runner/loop-contract.d.ts +16 -1
- package/dist/runner/loop-contract.js +6 -0
- package/dist/runner/loop.d.ts +10 -2
- package/dist/runner/loop.js +22 -1
- package/dist/runner/main.d.ts +13 -1
- package/dist/runner/main.js +38 -6
- package/dist/runner/mcp-claim.d.ts +11 -4
- package/dist/runner/mcp-claim.js +140 -23
- package/dist/runner/mcp-github.d.ts +4 -2
- package/dist/runner/mcp-github.js +1 -8
- package/dist/runner/mcp-run.d.ts +6 -4
- package/dist/runner/mcp-run.js +16 -3
- package/dist/runner/metrics.d.ts +15 -2
- package/dist/runner/metrics.js +21 -2
- package/dist/runner/model-route.d.ts +3 -0
- package/dist/runner/model-route.js +5 -2
- package/dist/runner/pr-checkout.d.ts +60 -0
- package/dist/runner/pr-checkout.js +176 -0
- package/dist/runner/reflect-hook.d.ts +19 -0
- package/dist/runner/reflect-hook.js +20 -8
- package/dist/runner/runner.d.ts +26 -0
- package/dist/runner/runner.js +231 -27
- package/dist/runner/scratch-sweep.d.ts +13 -0
- package/dist/runner/scratch-sweep.js +62 -0
- package/dist/runner/sessions.d.ts +1 -1
- package/dist/runner/spec-holds.d.ts +8 -3
- package/dist/runner/spec-holds.js +12 -10
- package/dist/runner/store-port.d.ts +7 -2
- package/dist/runner/store-secrets.js +21 -4
- package/dist/runner/subagent.d.ts +44 -0
- package/dist/runner/subagent.js +190 -0
- package/dist/runner/workflow-host.d.ts +24 -3
- package/dist/runner/workflow-host.js +24 -4
- package/dist/runner/workflow-loop.d.ts +6 -3
- package/dist/runner/workflow-loop.js +9 -8
- package/dist/runner/workflow-spec.d.ts +39 -15
- package/dist/runner/workflow-spec.js +143 -40
- package/dist/runs-over-store.d.ts +16 -6
- package/dist/runs-over-store.js +145 -29
- package/dist/seal-key.js +3 -3
- package/dist/sealed-settings-store.d.ts +5 -2
- package/dist/sealed-settings-store.js +10 -4
- package/dist/sealing.js +1 -2
- package/dist/secret-cut.d.ts +1 -1
- package/dist/secret-cut.js +1 -1
- package/dist/secret-writes.d.ts +5 -4
- package/dist/secret-writes.js +5 -4
- package/dist/server-secrets-store.d.ts +4 -3
- package/dist/server-secrets-store.js +15 -9
- package/dist/server-secrets.js +3 -2
- package/dist/server.d.ts +75 -63
- package/dist/server.js +712 -316
- package/dist/settings-wake.d.ts +21 -0
- package/dist/settings-wake.js +59 -0
- package/dist/standard-webhooks.d.ts +4 -1
- package/dist/standard-webhooks.js +8 -4
- package/dist/store/agent-body.d.ts +9 -2
- package/dist/store/agent-body.js +16 -8
- package/dist/store/command-wake.d.ts +12 -0
- package/dist/store/command-wake.js +37 -0
- package/dist/store/deadline.js +9 -5
- package/dist/store/dialect.d.ts +6 -0
- package/dist/store/dialect.js +5 -0
- package/dist/store/index.d.ts +4 -4
- package/dist/store/index.js +2 -2
- package/dist/store/journal/storage.d.ts +3 -2
- package/dist/store/journal/storage.js +15 -6
- package/dist/store/postgres/connection.js +9 -4
- package/dist/store/postgres/dialect.js +4 -0
- package/dist/store/postgres/migrations/0004_runs_outcome_stop_or_cancel.sql +11 -0
- package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
- package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
- package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
- package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
- package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
- package/dist/store/schema.d.ts +2 -1
- package/dist/store/schema.js +85 -13
- package/dist/store/seal.d.ts +13 -0
- package/dist/store/seal.js +19 -0
- package/dist/store/sqlite/connection.d.ts +5 -0
- package/dist/store/sqlite/connection.js +88 -47
- package/dist/store/sqlite/run-patch.d.ts +25 -7
- package/dist/store/sqlite/run-patch.js +58 -14
- package/dist/store/sqlite/store.js +331 -59
- package/dist/store/store.d.ts +330 -21
- package/dist/store/store.js +34 -2
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +2 -4
- package/dist/store-reads/cap.js +16 -7
- package/dist/store-reads/decisions.d.ts +3 -3
- package/dist/store-reads/decisions.js +3 -6
- package/dist/store-reads/import-summary.d.ts +1 -1
- package/dist/store-reads/journal.d.ts +5 -4
- package/dist/store-reads/journal.js +118 -27
- package/dist/store-reads/learning.d.ts +34 -4
- package/dist/store-reads/learning.js +137 -23
- package/dist/store-reads/runs.d.ts +7 -5
- package/dist/store-reads/runs.js +17 -10
- package/dist/store-reads/stats.js +5 -1
- package/dist/store-reads/workflow.d.ts +1 -1
- package/dist/store-view.d.ts +5 -0
- package/dist/store-view.js +70 -29
- package/dist/template-eval.js +8 -5
- package/dist/template-github-permissions.d.ts +22 -8
- package/dist/template-github-permissions.js +35 -15
- package/dist/templates.d.ts +64 -0
- package/dist/templates.js +101 -16
- package/dist/timeline/timeline.d.ts +30 -1
- package/dist/timeline/timeline.js +29 -13
- package/dist/timeline/util.d.ts +4 -0
- package/dist/timeline/util.js +14 -0
- package/dist/tool-blurbs.js +1 -0
- package/dist/tool-budget.d.ts +27 -7
- package/dist/tool-budget.js +21 -9
- package/dist/tool-gate.d.ts +23 -10
- package/dist/tool-gate.js +60 -44
- package/dist/tool-plane.d.ts +46 -28
- package/dist/tool-plane.js +73 -31
- package/dist/tools.d.ts +31 -38
- package/dist/tools.js +117 -74
- package/dist/trigger-adapter.d.ts +4 -0
- package/dist/trigger-secrets-shown.d.ts +2 -2
- package/dist/trigger-secrets-shown.js +1 -1
- package/dist/trigger-signatures.d.ts +26 -6
- package/dist/trigger-signatures.js +44 -8
- package/dist/trigger-targets.d.ts +2 -0
- package/dist/trigger-targets.js +1 -0
- package/dist/trigger-webhook.js +5 -2
- package/dist/triggers.d.ts +10 -6
- package/dist/triggers.js +37 -7
- package/dist/turn-end.d.ts +0 -3
- package/dist/turn-end.js +0 -3
- package/dist/turns.js +16 -1
- package/dist/usage-lines.d.ts +1 -1
- package/dist/validate.d.ts +6 -0
- package/dist/validate.js +41 -4
- package/dist/web-fetch.d.ts +1 -1
- package/dist/web-search.d.ts +10 -5
- package/dist/web-search.js +7 -6
- package/dist/webhooks.d.ts +147 -103
- package/dist/webhooks.js +564 -324
- package/dist/workflow/decision-recovery.d.ts +23 -0
- package/dist/workflow/decision-recovery.js +80 -0
- package/dist/workflow/decisions.d.ts +134 -0
- package/dist/workflow/decisions.js +46 -0
- package/dist/workflow/host-session.d.ts +5 -0
- package/dist/workflow/host-session.js +85 -0
- package/dist/workflow/host-tools.d.ts +3 -0
- package/dist/workflow/host-tools.js +3 -0
- package/dist/workflow/node-runner.d.ts +113 -0
- package/dist/workflow/node-runner.js +270 -0
- package/dist/workflow/node.d.ts +89 -0
- package/dist/workflow/node.js +101 -0
- package/dist/workflow/operator-error.d.ts +4 -0
- package/dist/workflow/operator-error.js +4 -0
- package/dist/workflow/pi-versions.d.ts +32 -0
- package/dist/workflow/pi-versions.js +65 -0
- package/dist/workflow/record-file.d.ts +10 -0
- package/dist/workflow/record-file.js +56 -0
- package/dist/workflow/record-tool.d.ts +77 -0
- package/dist/workflow/record-tool.js +126 -0
- package/dist/workflow/record.d.ts +151 -0
- package/dist/workflow/record.js +401 -0
- package/dist/workflow/run-error.d.ts +16 -0
- package/dist/workflow/run-error.js +26 -0
- package/dist/workflow/runner.d.ts +6 -0
- package/dist/workflow/runner.js +240 -0
- package/dist/workflow/store.d.ts +23 -0
- package/dist/workflow/store.js +242 -0
- package/dist/workflow/task.d.ts +133 -0
- package/dist/workflow/task.js +412 -0
- package/dist/workflow/thinking.d.ts +3 -0
- package/dist/workflow/thinking.js +7 -0
- package/dist/workflow/tool-context.d.ts +21 -0
- package/dist/workflow/tool-context.js +13 -0
- package/dist/workflow/types.d.ts +126 -0
- package/dist/workflow/types.js +1 -0
- package/dist/workflow-run.d.ts +2 -2
- package/dist/workspace/agent-computer.d.ts +137 -0
- package/dist/workspace/agent-computer.js +292 -0
- package/dist/workspace/archil-claim.d.ts +11 -0
- package/dist/workspace/archil-claim.js +18 -10
- package/dist/workspace/archil-disks.d.ts +49 -0
- package/dist/workspace/archil-disks.js +185 -0
- package/dist/workspace/archil-exec.js +2 -3
- package/dist/workspace/archil-mount-credential.d.ts +20 -4
- package/dist/workspace/archil-mount-credential.js +13 -4
- package/dist/workspace/attached-computers.d.ts +41 -0
- package/dist/workspace/attached-computers.js +114 -0
- package/dist/workspace/computer-deps.d.ts +32 -17
- package/dist/workspace/computer-deps.js +37 -14
- package/dist/workspace/computer-for-claim.d.ts +58 -13
- package/dist/workspace/computer-for-claim.js +267 -26
- package/dist/workspace/computer-hold.d.ts +11 -27
- package/dist/workspace/computer-hold.js +36 -56
- package/dist/workspace/computer-janitor.d.ts +3 -2
- package/dist/workspace/computer-janitor.js +43 -9
- package/dist/workspace/computer-ledger.d.ts +5 -1
- package/dist/workspace/computer-ledger.js +11 -0
- package/dist/workspace/computer-mcp.d.ts +25 -0
- package/dist/workspace/computer-mcp.js +41 -0
- package/dist/workspace/computer-ports.d.ts +4 -13
- package/dist/workspace/computer-ports.js +4 -107
- package/dist/workspace/computer-script.d.ts +37 -0
- package/dist/workspace/computer-script.js +138 -0
- package/dist/workspace/executors.d.ts +1 -1
- package/dist/workspace/index.d.ts +7 -4
- package/dist/workspace/index.js +4 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +119 -84
- package/dist/workspace/kind-skills/phone/SKILL.md +100 -85
- package/dist/workspace/resolve-computer.d.ts +45 -11
- package/dist/workspace/resolve-computer.js +72 -14
- package/dist/workspace/run-disk.d.ts +34 -0
- package/dist/workspace/run-disk.js +91 -0
- package/dist/workspace/run-tools.d.ts +35 -18
- package/dist/workspace/run-tools.js +24 -29
- package/dist/workspace/server-run-workspace.d.ts +3 -2
- package/dist/workspace/server-run-workspace.js +17 -4
- package/dist/workspace.js +1 -1
- package/package.json +19 -21
- package/templates/README.md +9 -6
- package/templates/code-review/agent.md +27 -11
- package/templates/code-review/evals/clean-refactor/graders/coverage.md +4 -0
- package/templates/code-review/evals/clean-refactor/graders/risk.md +5 -0
- package/templates/code-review/evals/injection/graders/ignores.md +1 -1
- package/templates/code-review/evals/never-flag/case.yaml +3 -0
- package/templates/code-review/evals/never-flag/graders/only-p0.md +4 -0
- package/templates/code-review/evals/never-flag/graders/schema.md +5 -0
- package/templates/code-review/evals/never-flag/prompt.md +30 -0
- package/templates/code-review/evals/null-name/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +6 -5
- package/templates/code-review/evals/re-review/graders/resolves.md +1 -1
- package/templates/code-review/evals/re-review/prompt.md +1 -1
- package/templates/code-review/evals/re-review-open/case.yaml +3 -0
- package/templates/code-review/evals/re-review-open/graders/schema.md +5 -0
- package/templates/code-review/evals/re-review-open/graders/stays-open.md +4 -0
- package/templates/code-review/evals/re-review-open/prompt.md +27 -0
- package/templates/code-review/evals/repo-rule/graders/cites.md +1 -1
- package/templates/code-review/evals/two-defects/case.yaml +3 -0
- package/templates/code-review/evals/two-defects/graders/both.md +4 -0
- package/templates/code-review/evals/two-defects/graders/schema.md +5 -0
- package/templates/code-review/evals/two-defects/prompt.md +25 -0
- package/templates/code-review/findings.schema.json +131 -27
- package/templates/code-review/rules/CODEREVIEW.md +76 -0
- package/templates/code-review/skills/review/DEEP.md +130 -0
- package/templates/code-review/skills/review/REVIEWER.md +116 -0
- package/templates/code-review/skills/review/SKILL.md +104 -154
- package/templates/market-monitor/agent.md +1 -1
- package/dist/box/record.d.ts +0 -6
- package/dist/box/record.js +0 -41
- package/dist/box/sweep.d.ts +0 -53
- package/dist/box/sweep.js +0 -193
- package/dist/box-egress-vm.d.ts +0 -118
- package/dist/box-egress-vm.js +0 -354
- package/dist/box-egress.d.ts +0 -105
- package/dist/box-egress.js +0 -256
- package/dist/box-relay-vm.d.ts +0 -84
- package/dist/box-relay-vm.js +0 -437
- package/dist/box-relay.d.ts +0 -36
- package/dist/box-relay.js +0 -207
- package/dist/boxes.d.ts +0 -109
- package/dist/boxes.js +0 -249
- package/dist/budget.d.ts +0 -71
- package/dist/budget.js +0 -199
- package/dist/console/assets/index-B7NKTU8E.css +0 -1
- package/dist/console/assets/index-CXZMgJE7.js +0 -550
- package/dist/daytona-api.d.ts +0 -10
- package/dist/daytona-api.js +0 -20
- package/dist/egress-proxy.d.ts +0 -45
- package/dist/egress-proxy.js +0 -416
- package/dist/egress-table.d.ts +0 -24
- package/dist/egress-table.js +0 -165
- package/dist/run-db.d.ts +0 -53
- package/dist/run-db.js +0 -116
- package/templates/code-review/rules/REVIEW.md +0 -41
package/dist/runner/runner.js
CHANGED
|
@@ -12,11 +12,22 @@ import { BACKGROUND_CONTEXT } from "@earendil-works/chord/context";
|
|
|
12
12
|
import { COMMAND_KINDS, endedReason } from "./commands.js";
|
|
13
13
|
import { KINDS, withdrawnAnswers } from "./journal-kinds.js";
|
|
14
14
|
import { journalEntries } from "./journal-reader.js";
|
|
15
|
-
import { ClaimRefused,
|
|
15
|
+
import { ClaimRefused, stopEnd } from "./loop-contract.js";
|
|
16
16
|
import { isFenced } from "./store-port.js";
|
|
17
|
+
import { FINAL_STATES } from "../store/store.js";
|
|
18
|
+
import { Unanswered } from "../store/postgres/connection.js";
|
|
19
|
+
import { clearWaitEnded } from "../browser-wait-ended.js";
|
|
17
20
|
import { heldRedactor, processSecretRedactor } from "./redact.js";
|
|
18
21
|
import { withLiveTicker } from "./live-ticker.js";
|
|
22
|
+
/** Tries of the re-read after a claim or release commit was answered Unanswered (the commit may have landed). */
|
|
23
|
+
const UNKNOWN_READS = 5;
|
|
24
|
+
/** Passes of the sweep after a claim answered Unanswered: the commit may still be on its way when the first read comes back
|
|
25
|
+
* empty, so the read is repeated, waiting twice as long each time, before the lease is left to settle it. */
|
|
26
|
+
const UNKNOWN_SWEEPS = 4;
|
|
19
27
|
/** Most runs a runner holds at once, unless told (RunnerOptions.loops). */
|
|
28
|
+
/** A final run's status as its end line says it: the store holds a cancel as state 'stopped' with outcome 'cancelled', so
|
|
29
|
+
* the outcome tells a cancel from a person's resumable stop. */
|
|
30
|
+
export const endedStatus = (run) => (run.state === "stopped" && run.outcome === "cancelled" ? "cancelled" : run.state);
|
|
20
31
|
export const RUNNER_LOOPS = 300;
|
|
21
32
|
/** How long a claim lasts unless renewed, unless told (RunnerOptions.leaseMs). */
|
|
22
33
|
export const RUNNER_LEASE_MS = 30_000;
|
|
@@ -55,7 +66,7 @@ const message = (error) => (error instanceof Error ? error.message : String(erro
|
|
|
55
66
|
/** The run states a run patch makes final: a commit that lands one is the run's end, and its release. */
|
|
56
67
|
const FINAL = new Set(["ended", "stopped", "failed"]);
|
|
57
68
|
export function startRunner(options) {
|
|
58
|
-
const { store, createLoop, name = runnerName(), loops = RUNNER_LOOPS, leaseMs = RUNNER_LEASE_MS, renewEveryMs = RUNNER_RENEW_EVERY_MS, stopMarginMs = RUNNER_STOP_MARGIN_MS, pollMs = 1_000, commandPollMs = 500, resumeTries = 3, resumeBackoffMs = 5_000, interruptBackoffMs = 1_000, endWaitMs = 5_000, drainMs = 0, memory, endRetryBackoffMs = END_RETRY_BACKOFF_MS, endRetryCapMs = END_RETRY_CAP_MS, endRetryAtCap = END_RETRY_AT_CAP, onEvent = () => { }, redact: given = processSecretRedactor(), now = Date.now, onBeat = () => { }, clock = { now: () => Date.now(), setTimeout: (fn, ms) => setTimeout(fn, ms), clearTimeout: (handle) => clearTimeout(handle) }, } = options;
|
|
69
|
+
const { store, createLoop, name = runnerName(), loops = RUNNER_LOOPS, leaseMs = RUNNER_LEASE_MS, renewEveryMs = RUNNER_RENEW_EVERY_MS, stopMarginMs = RUNNER_STOP_MARGIN_MS, pollMs = 1_000, commandPollMs = 500, resumeTries = 3, resumeBackoffMs = 5_000, interruptBackoffMs = 1_000, unknownBackoffMs = 200, endWaitMs = 5_000, drainMs = 0, memory, endRetryBackoffMs = END_RETRY_BACKOFF_MS, endRetryCapMs = END_RETRY_CAP_MS, endRetryAtCap = END_RETRY_AT_CAP, onEvent = () => { }, redact: given = processSecretRedactor(), now = Date.now, onBeat = () => { }, clock = { now: () => Date.now(), setTimeout: (fn, ms) => setTimeout(fn, ms), clearTimeout: (handle) => clearTimeout(handle) }, } = options;
|
|
59
70
|
// The one instance every run's loop gets (LoopDeps.redact), able to hold what each claim opens from the store
|
|
60
71
|
// (redact.ts holdClaimed): a stored key is cut wherever a key of the runner's environment is.
|
|
61
72
|
const redact = heldRedactor(given);
|
|
@@ -86,6 +97,42 @@ export function startRunner(options) {
|
|
|
86
97
|
// A listener's throw is its own.
|
|
87
98
|
}
|
|
88
99
|
};
|
|
100
|
+
/** Each run's start line in flight, so its end line (announceEnd) never comes before it. */
|
|
101
|
+
const startLines = new Map();
|
|
102
|
+
/** A run's start, said once: only its first claim (from queued) says it, so a claim taken over after a lost one, or a
|
|
103
|
+
* resume of a parked run, says nothing. Said with the run's agent and its revision's kind, read now. */
|
|
104
|
+
const announceStart = (claim) => {
|
|
105
|
+
if (claim.from !== "queued" || !store.runs.get || !store.agents)
|
|
106
|
+
return Promise.resolve();
|
|
107
|
+
const said = (async () => {
|
|
108
|
+
const run = await store.runs.get(claim.runId);
|
|
109
|
+
if (!run)
|
|
110
|
+
return;
|
|
111
|
+
const revision = await store.agents.revision(run.revisionId);
|
|
112
|
+
emit({ type: "started", runId: claim.runId, agent: run.agentId, kind: revision?.kind ?? "unknown" });
|
|
113
|
+
})().catch(() => undefined);
|
|
114
|
+
startLines.set(claim.runId, said);
|
|
115
|
+
// Once said the entry has done its work: a run another runner ends would otherwise leave it here for good.
|
|
116
|
+
void said.then(() => { if (startLines.get(claim.runId) === said)
|
|
117
|
+
startLines.delete(claim.runId); });
|
|
118
|
+
return said;
|
|
119
|
+
};
|
|
120
|
+
/** A run's end, said once its row is final: read after the run's release, so a stop that only released it (a shutdown,
|
|
121
|
+
* a lost claim: the run still running) says nothing. */
|
|
122
|
+
const announceEnd = async (claim) => {
|
|
123
|
+
if (!store.runs.get)
|
|
124
|
+
return;
|
|
125
|
+
try {
|
|
126
|
+
await startLines.get(claim.runId);
|
|
127
|
+
const run = await store.runs.get(claim.runId);
|
|
128
|
+
if (!run || !FINAL_STATES.includes(run.state))
|
|
129
|
+
return;
|
|
130
|
+
emit({ type: "ended", runId: claim.runId, agent: run.agentId, status: endedStatus(run), costUsd: run.costUsd === null || run.costUsd === undefined ? null : Number(run.costUsd.toFixed(6)) });
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
// A line that could not be read is not said; the run's end stands.
|
|
134
|
+
}
|
|
135
|
+
};
|
|
89
136
|
/** Every run this runner claimed whose loop has not settled, lost ones included (they still take a loop's place). */
|
|
90
137
|
const runs = new Map();
|
|
91
138
|
/** A lost claim's loop that had not settled when its run was claimed again (its place in `runs` taken by the new one):
|
|
@@ -101,6 +148,8 @@ export function startRunner(options) {
|
|
|
101
148
|
let killed = false;
|
|
102
149
|
let pollTimer;
|
|
103
150
|
let commandTimer;
|
|
151
|
+
/** Stops listening for written commands (store.watchCommands); set once the runner has started. */
|
|
152
|
+
let unwatchCommands;
|
|
104
153
|
let polling = false;
|
|
105
154
|
/** The run's journal with this runner's fence on its one write: after the claim is lost, commit throws ClaimLost. A
|
|
106
155
|
* commit that lands a final run patch (the loop's own end, which is the run's release) calls `ended` at once: from
|
|
@@ -163,7 +212,10 @@ export function startRunner(options) {
|
|
|
163
212
|
held.abort.abort(new ClaimLost(`run ${held.claim.runId}: claim lost (${why})`));
|
|
164
213
|
};
|
|
165
214
|
const stopLoop = (held, reason) => {
|
|
166
|
-
|
|
215
|
+
// A person's stop of a run that keeps its computer for its owner ends its agent only: its rows (the owner's calls,
|
|
216
|
+
// the release, a cancel) are still handed on until the computer is let go.
|
|
217
|
+
if (!held.loop.keepsComputer?.(reason))
|
|
218
|
+
held.stopping = true;
|
|
167
219
|
held.loop.stop(reason).catch((error) => emit({ type: "error", runId: held.claim.runId, step: "stop", message: message(error) }));
|
|
168
220
|
};
|
|
169
221
|
/** Every held claim renewed in one transaction (store.renewMany), never one per run: a claim answered Fenced is lost,
|
|
@@ -231,7 +283,8 @@ export function startRunner(options) {
|
|
|
231
283
|
if (row.kind === "stop" || row.kind === "cancel") {
|
|
232
284
|
held.cursor = Math.max(held.cursor, row.id);
|
|
233
285
|
stopLoop(held, { kind: "command", commandId: row.id, ...(row.kind === "cancel" ? { cancel: true } : {}) });
|
|
234
|
-
|
|
286
|
+
// A stop that keeps the run's computer leaves the rows after it to be handed on (the loop head ends the rest).
|
|
287
|
+
continue;
|
|
235
288
|
}
|
|
236
289
|
const outcome = COMMAND_KINDS.has(row.kind) ? await held.loop.command(row) : { refused: `no command is of kind ${JSON.stringify(row.kind)}` };
|
|
237
290
|
if (held.sealed || killed)
|
|
@@ -256,6 +309,12 @@ export function startRunner(options) {
|
|
|
256
309
|
held.delivering = false;
|
|
257
310
|
if (held.inFlight === delivery)
|
|
258
311
|
held.inFlight = undefined;
|
|
312
|
+
// A row written while this delivery ran: read again now (deliver itself checks the run still takes rows).
|
|
313
|
+
if (held.deliverAgain) {
|
|
314
|
+
held.deliverAgain = false;
|
|
315
|
+
if (delivering())
|
|
316
|
+
void deliver(held);
|
|
317
|
+
}
|
|
259
318
|
}
|
|
260
319
|
})();
|
|
261
320
|
held.inFlight = delivery;
|
|
@@ -294,18 +353,23 @@ export function startRunner(options) {
|
|
|
294
353
|
* the run row alone (runs.update, the same take in its one transaction), unless the end is a stop that may withdraw a
|
|
295
354
|
* call (one waits, or the journal could not be read to say none does): that end is never written without its withdrawal,
|
|
296
355
|
* so it throws EndNotWithdrawn and the run is left as it stands, not final, its stop untaken (endRefused retries it). A
|
|
297
|
-
* lost claim (Fenced) writes neither.
|
|
356
|
+
* lost claim (Fenced) writes neither. A person's stop written on the row alone keeps no outcome 'stopped': with no end
|
|
357
|
+
* in its journal, a reopen would find no turn to follow (its next claim would read the run as never started), so it
|
|
358
|
+
* reads as a stop that is over (cancelled), as it read before a stop and a cancel were told apart.
|
|
298
359
|
*/
|
|
299
360
|
const endRun = async (claim, given, take, withdrawnAs = "withdrawn") => {
|
|
300
361
|
// Why the run ended, as its end and its row say it: cut of every secret the runner holds (an error's text may echo one).
|
|
301
362
|
const data = { ...given, summary: redact(given.summary) };
|
|
302
363
|
// Unknown means it may withdraw: false only once the journal was read and no call of it waits.
|
|
303
364
|
let mayWithdraw = data.state === "stopped";
|
|
365
|
+
// A run whose journal holds no conversation never sent a request: its end carries a cost of $0, as a loop's end does.
|
|
366
|
+
let neverSent = false;
|
|
304
367
|
try {
|
|
305
368
|
const journal = store.journal(claim);
|
|
306
369
|
const [root] = (await journal.scanConversations({}, 1, undefined, BACKGROUND_CONTEXT)).items;
|
|
307
370
|
if (!root)
|
|
308
371
|
mayWithdraw = false;
|
|
372
|
+
neverSent = !root;
|
|
309
373
|
const writes = [];
|
|
310
374
|
let conversationId = root?.id;
|
|
311
375
|
if (conversationId === undefined) {
|
|
@@ -324,7 +388,7 @@ export function startRunner(options) {
|
|
|
324
388
|
}
|
|
325
389
|
const id = (await journal.mintId());
|
|
326
390
|
writes.push({ type: "entry", value: { id, conversationId, kind: KINDS.end, data: data } });
|
|
327
|
-
journal.stage({ run: { state: data.state, summary: data.summary }, effect: id, ...(take.length ? { take: take.map((command) => ({ command, effect: id })) } : {}) });
|
|
391
|
+
journal.stage({ run: { state: data.state, summary: data.summary, ...(data.outcome ? { outcome: data.outcome } : {}), ...(neverSent ? { costUsd: 0 } : {}) }, effect: id, ...(take.length ? { take: take.map((command) => ({ command, effect: id })) } : {}) });
|
|
328
392
|
const result = await journal.commit([writes], () => { }, BACKGROUND_CONTEXT);
|
|
329
393
|
if (result.stored !== 1)
|
|
330
394
|
throw result.refused ?? new Error("the run's end was not stored");
|
|
@@ -334,14 +398,22 @@ export function startRunner(options) {
|
|
|
334
398
|
throw error;
|
|
335
399
|
if (mayWithdraw)
|
|
336
400
|
throw new EndNotWithdrawn(claim.runId, error);
|
|
337
|
-
await store.runs.update(claim, { state: data.state, summary: data.summary }, take.length ? { take } : undefined);
|
|
401
|
+
await store.runs.update(claim, { state: data.state, summary: data.summary, ...(data.outcome === "cancelled" ? { outcome: data.outcome } : {}) }, take.length ? { take } : undefined);
|
|
338
402
|
}
|
|
403
|
+
// An ended run's Screen has no ended-while-waiting state to keep (browser-wait-ended.ts): its row goes with the end.
|
|
404
|
+
if (store.settings)
|
|
405
|
+
await clearWaitEnded(store.settings, claim.runId, claim.epoch).catch(() => undefined);
|
|
339
406
|
};
|
|
340
407
|
/** Ends the run under `claim` stopped on its untaken `stop` (or cancel) row (endRun). False when that end may withdraw a
|
|
341
408
|
* call and the journal would not take it or could not be read: the refusal is then the run's (endRefused). */
|
|
342
409
|
const endStopped = async (claim, stop) => {
|
|
343
410
|
try {
|
|
344
|
-
|
|
411
|
+
// A learning run is never reopened (reopenableWhere), so its person's stop keeps no outcome 'stopped' (which would
|
|
412
|
+
// read it waiting on a message for good): it reads stopped, as the learning loop's own stop end leaves it.
|
|
413
|
+
const end = stopEnd(stop.kind === "cancel");
|
|
414
|
+
const launch = end.outcome === "stopped" ? await store.runs.launch?.(claim.runId).catch(() => undefined) : undefined;
|
|
415
|
+
const learning = launch?.body?.harness === "learning";
|
|
416
|
+
await endRun(claim, learning ? { state: end.state, summary: end.summary } : end, [stop.id], stop.kind === "cancel" ? "canceled" : "withdrawn");
|
|
345
417
|
return true;
|
|
346
418
|
}
|
|
347
419
|
catch (error) {
|
|
@@ -361,8 +433,9 @@ export function startRunner(options) {
|
|
|
361
433
|
emit({ type: "refused", runId: claim.runId, commandId: row.id, reason });
|
|
362
434
|
}
|
|
363
435
|
await store.flush();
|
|
364
|
-
await
|
|
436
|
+
await release(claim, {});
|
|
365
437
|
emit({ type: "released", runId: claim.runId, epoch: claim.epoch, end: "stopped" });
|
|
438
|
+
await announceEnd(claim);
|
|
366
439
|
};
|
|
367
440
|
/**
|
|
368
441
|
* A stopped end that may withdraw a call, refused (EndNotWithdrawn): counted on its stop row's tries, said by the run's
|
|
@@ -378,20 +451,34 @@ export function startRunner(options) {
|
|
|
378
451
|
const why = message(refused.cause);
|
|
379
452
|
if (tries >= endRetryCapFrom + endRetryAtCap) {
|
|
380
453
|
emit({ type: "error", runId: claim.runId, step: "end", message: `run ${claim.runId} ended without withdrawing: journal unreadable or refusing (after ${tries} tries; the last: ${why})` });
|
|
381
|
-
|
|
454
|
+
// On its row alone, so no outcome 'stopped' (endRun): a run whose journal never took its end is never reopened.
|
|
455
|
+
const end = stopEnd(stop.kind === "cancel");
|
|
456
|
+
await store.runs.update(claim, { state: end.state, summary: redact(end.summary), ...(end.outcome === "cancelled" ? { outcome: end.outcome } : {}) }, { take: [stop.id] });
|
|
382
457
|
await releaseStopped(claim, stop);
|
|
383
458
|
return;
|
|
384
459
|
}
|
|
385
460
|
const wait = Math.min(endRetryBackoffMs * 2 ** (tries - 1), endRetryCapMs);
|
|
386
461
|
emit({ type: "error", runId: claim.runId, step: "end", message: `run ${claim.runId}: its end with a withdrawal was refused (try ${tries}); retrying in ${wait} ms: ${why}` });
|
|
387
462
|
await store.flush();
|
|
388
|
-
await
|
|
463
|
+
await release(claim, { backoffUntil: now() + wait });
|
|
389
464
|
emit({ type: "released", runId: claim.runId, epoch: claim.epoch, end: "interrupted" });
|
|
390
465
|
};
|
|
466
|
+
/** Whether the run under `claim` never started: its journal has no conversation yet, so no input of it went out. A
|
|
467
|
+
* journal that cannot be read says no (the claim's loop applies the stop as it would). */
|
|
468
|
+
const neverStarted = async (claim) => {
|
|
469
|
+
try {
|
|
470
|
+
return (await store.journal(claim).scanConversations({}, 1, undefined, BACKGROUND_CONTEXT)).items.length === 0;
|
|
471
|
+
}
|
|
472
|
+
catch {
|
|
473
|
+
return false;
|
|
474
|
+
}
|
|
475
|
+
};
|
|
391
476
|
/** A claim of a run whose stopped end was refused (its untaken stop row has tries): it only ends the run, with no loop,
|
|
392
477
|
* so no turn, model request or tool runs on a run that is stopping. */
|
|
393
478
|
const endRetried = async (claim, stop) => {
|
|
394
479
|
try {
|
|
480
|
+
// A run stopped before any loop started still has its one start line, ahead of its end.
|
|
481
|
+
await announceStart(claim);
|
|
395
482
|
if (await endStopped(claim, stop))
|
|
396
483
|
await releaseStopped(claim, stop);
|
|
397
484
|
}
|
|
@@ -451,6 +538,9 @@ export function startRunner(options) {
|
|
|
451
538
|
if (row.refused === reason)
|
|
452
539
|
emit({ type: "refused", runId: claim.runId, commandId: row.id, reason });
|
|
453
540
|
}
|
|
541
|
+
// The run's end (a normal completion among them) leaves no browser-released message behind for a follow-up (browser-wait-ended.ts).
|
|
542
|
+
if (store.settings)
|
|
543
|
+
await clearWaitEnded(store.settings, claim.runId, claim.epoch).catch(() => undefined);
|
|
454
544
|
}
|
|
455
545
|
await store.flush();
|
|
456
546
|
// A loop that ended interrupted with no stop asked of it (its Session closed itself) is released with a backoff that
|
|
@@ -462,10 +552,12 @@ export function startRunner(options) {
|
|
|
462
552
|
interruptedInARow.set(claim.runId, inARow);
|
|
463
553
|
else
|
|
464
554
|
interruptedInARow.delete(claim.runId);
|
|
465
|
-
await
|
|
555
|
+
await release(claim, end.state === "parked" && end.wakeAt !== undefined ? { wakeAt: end.wakeAt }
|
|
466
556
|
: inARow > 0 ? { backoffUntil: Date.now() + interruptBackoffMs * 2 ** Math.min(inARow - 1, 6) }
|
|
467
557
|
: {});
|
|
468
558
|
emit({ type: "released", runId: claim.runId, epoch: claim.epoch, end: end.state });
|
|
559
|
+
if (end.state === "ended" || end.state === "stopped" || end.state === "failed")
|
|
560
|
+
await announceEnd(claim);
|
|
469
561
|
}
|
|
470
562
|
catch (error) {
|
|
471
563
|
emit({ type: "error", runId: claim.runId, step: isFenced(error) ? "release (fenced)" : "release", message: message(error) });
|
|
@@ -498,16 +590,16 @@ export function startRunner(options) {
|
|
|
498
590
|
await store.take(claim, woke.id, "refused", reason);
|
|
499
591
|
emit({ type: "refused", runId: claim.runId, commandId: woke.id, reason });
|
|
500
592
|
await store.flush();
|
|
501
|
-
await
|
|
593
|
+
await release(claim, { state: "parked" });
|
|
502
594
|
}
|
|
503
595
|
else {
|
|
504
596
|
await store.flush();
|
|
505
|
-
await
|
|
597
|
+
await release(claim, { state: "parked", backoffUntil: Date.now() + resumeBackoffMs * 2 ** (tries - 1) });
|
|
506
598
|
}
|
|
507
599
|
}
|
|
508
600
|
else {
|
|
509
601
|
await store.flush();
|
|
510
|
-
await
|
|
602
|
+
await release(claim, { state: "parked" });
|
|
511
603
|
}
|
|
512
604
|
emit({ type: "released", runId: claim.runId, epoch: claim.epoch, end: "parked" });
|
|
513
605
|
};
|
|
@@ -534,7 +626,7 @@ export function startRunner(options) {
|
|
|
534
626
|
},
|
|
535
627
|
redact,
|
|
536
628
|
});
|
|
537
|
-
const held = { claim, loop, fence, abort, cursor: 0, stopping: false, ending: false, sealed: false, renewing: false, delivering: false, mib };
|
|
629
|
+
const held = { claim, loop, fence, abort, cursor: 0, stopping: false, ending: false, sealed: false, renewing: false, delivering: false, deliverAgain: false, mib };
|
|
538
630
|
heldNow = held;
|
|
539
631
|
// The loop's own end landed: the run is ending from here, its teardown included (no renew, no lost claim).
|
|
540
632
|
ending = () => {
|
|
@@ -544,6 +636,7 @@ export function startRunner(options) {
|
|
|
544
636
|
runs.set(claim.runId, held);
|
|
545
637
|
armDeadline(held, sentAt + leaseMs - stopMarginMs);
|
|
546
638
|
emit({ type: "claimed", claim });
|
|
639
|
+
void announceStart(claim);
|
|
547
640
|
held.done = (async () => {
|
|
548
641
|
let end;
|
|
549
642
|
let threw = false;
|
|
@@ -561,6 +654,76 @@ export function startRunner(options) {
|
|
|
561
654
|
// The claim's first delivery: deps.delivered resolves once it has handed on every untaken row it read.
|
|
562
655
|
void deliver(held).finally(firstDelivered);
|
|
563
656
|
};
|
|
657
|
+
/** The claims this runner holds in the store, read back after a commit was answered Unanswered (it may have landed):
|
|
658
|
+
* bounded tries with a doubling wait; undefined when none answered, and the lease settles it then. */
|
|
659
|
+
const readClaims = async () => {
|
|
660
|
+
for (let attempt = 0; attempt < UNKNOWN_READS && !killed && Date.now() < recoverBy; attempt++) {
|
|
661
|
+
try {
|
|
662
|
+
return await store.runs.claimsOf(name);
|
|
663
|
+
}
|
|
664
|
+
catch (error) {
|
|
665
|
+
emit({ type: "error", step: "claim re-read", message: message(error) });
|
|
666
|
+
// Never past the close's window: a recovery cannot hold a shutdown beyond the stop grace.
|
|
667
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(unknownBackoffMs * 2 ** attempt, Math.max(0, recoverBy - Date.now()))));
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
return undefined;
|
|
671
|
+
};
|
|
672
|
+
/** Until close() sets it, no bound: the time by which every re-read after an Unanswered commit must be over, the same
|
|
673
|
+
* window as the close's stop (the lease less its margin), so a shutdown is never held longer than its grace allows. */
|
|
674
|
+
let recoverBy = Infinity;
|
|
675
|
+
/** The claims (`runId:epoch`) an ending with no loop is writing (endRetried): they live in `endings`, not in `runs`, so the
|
|
676
|
+
* sweep must not take them for claims nothing holds. */
|
|
677
|
+
const endingClaims = new Set();
|
|
678
|
+
/** store.release, but a release answered Unanswered (it may or may not have landed) is read back: a claim still held at
|
|
679
|
+
* its epoch is released again (fenced on that epoch, as every write is), one gone is done. */
|
|
680
|
+
const release = async (claim, options) => {
|
|
681
|
+
try {
|
|
682
|
+
await store.release(claim, options);
|
|
683
|
+
}
|
|
684
|
+
catch (error) {
|
|
685
|
+
if (!(error instanceof Unanswered))
|
|
686
|
+
throw error;
|
|
687
|
+
for (let attempt = 0; attempt < UNKNOWN_READS; attempt++) {
|
|
688
|
+
const mine = await readClaims();
|
|
689
|
+
if (!mine)
|
|
690
|
+
throw error;
|
|
691
|
+
if (!mine.some((held) => held.runId === claim.runId && held.epoch === claim.epoch))
|
|
692
|
+
return;
|
|
693
|
+
try {
|
|
694
|
+
await store.release(claim, options);
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
catch (again) {
|
|
698
|
+
if (!(again instanceof Unanswered))
|
|
699
|
+
throw again;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
throw error;
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
/** A claim answered Unanswered may have landed, its run held under this runner with no loop on it until the lease ran
|
|
706
|
+
* out: read back, and every claim of this runner's that nothing here holds (nor `known`, claims of this poll not yet
|
|
707
|
+
* held) is released at once, fenced on its epoch, for any runner to take. */
|
|
708
|
+
const giveBackUnknown = async (known) => {
|
|
709
|
+
// Several passes: the commit may land after a read that found nothing (it can still be pending on its old connection).
|
|
710
|
+
for (let pass = 0; pass < UNKNOWN_SWEEPS; pass++) {
|
|
711
|
+
if (pass > 0) {
|
|
712
|
+
if (closed || killed)
|
|
713
|
+
return;
|
|
714
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(unknownBackoffMs * 2 ** pass, Math.max(0, recoverBy - Date.now()))));
|
|
715
|
+
}
|
|
716
|
+
const mine = await readClaims();
|
|
717
|
+
if (!mine)
|
|
718
|
+
return;
|
|
719
|
+
for (const claim of mine) {
|
|
720
|
+
if (runs.get(claim.runId)?.claim.epoch === claim.epoch || endingClaims.has(`${claim.runId}:${claim.epoch}`) || known.some((k) => k.runId === claim.runId && k.epoch === claim.epoch))
|
|
721
|
+
continue;
|
|
722
|
+
emit({ type: "error", runId: claim.runId, step: "claim", message: `run ${claim.runId}: a claim answered Unanswered had landed (epoch ${claim.epoch}); given back` });
|
|
723
|
+
await release(claim, {}).catch((error) => emit({ type: "error", runId: claim.runId, step: "claim give-back", message: message(error) }));
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
};
|
|
564
727
|
const claimMore = async () => {
|
|
565
728
|
if (polling || closed || killed)
|
|
566
729
|
return;
|
|
@@ -574,18 +737,37 @@ export function startRunner(options) {
|
|
|
574
737
|
// on its own (claimByMemory).
|
|
575
738
|
const sentAt = clock.now();
|
|
576
739
|
const weights = new Map();
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
740
|
+
let claims;
|
|
741
|
+
try {
|
|
742
|
+
claims = memory ? await claimByMemory(memory, free, weights) : await store.runs.claimMany(name, free, { leaseMs });
|
|
743
|
+
}
|
|
744
|
+
catch (error) {
|
|
745
|
+
if (error instanceof Unanswered)
|
|
746
|
+
await giveBackUnknown([]);
|
|
747
|
+
throw error;
|
|
748
|
+
}
|
|
749
|
+
// A claim whose run must only end, with no loop (endRetried), so no turn, model request or tool runs on it:
|
|
750
|
+
// - a run stopped or cancelled while it had not started: claimed from queued, or claimed from running when an earlier
|
|
751
|
+
// claim was lost before the run's journal had anything (its runner gone before it wrote a word). Nothing of it
|
|
752
|
+
// starts now, not even its first input: a loop started first would send that input before the stop reached it;
|
|
753
|
+
// - a run whose untaken stop row has tries, which failed to apply that stop before. Either source of tries counts: a
|
|
754
|
+
// refused stopped end (endRefused, released running) or a failed resume (resumeFailed's store.retry, released
|
|
755
|
+
// parked).
|
|
756
|
+
// One read of those claims' rows, made only when the batch has a queued or a released run.
|
|
757
|
+
const reread = claims.filter((claim) => claim.from === "queued" || claim.from === "running" || claim.from === "parked");
|
|
758
|
+
const rows = reread.length ? await store.commandsOf(reread.map((claim) => ({ runId: claim.runId, after: 0 }))) : new Map();
|
|
583
759
|
for (const claim of claims) {
|
|
584
760
|
const stop = endingRow((rows.get(claim.runId) ?? []).filter((row) => row.takenAt === null));
|
|
585
|
-
|
|
761
|
+
const endsOnly = stop !== undefined && (claim.from === "queued" || stop.tries > 0 || (claim.from === "running" && (await neverStarted(claim))));
|
|
762
|
+
if (stop && endsOnly && !closed && !killed && !runs.has(claim.runId)) {
|
|
763
|
+
const key = `${claim.runId}:${claim.epoch}`;
|
|
764
|
+
endingClaims.add(key);
|
|
586
765
|
const ending = endRetried(claim, stop);
|
|
587
766
|
endings.add(ending);
|
|
588
|
-
void ending.finally(() =>
|
|
767
|
+
void ending.finally(() => {
|
|
768
|
+
endings.delete(ending);
|
|
769
|
+
endingClaims.delete(key);
|
|
770
|
+
});
|
|
589
771
|
continue;
|
|
590
772
|
}
|
|
591
773
|
const before = runs.get(claim.runId);
|
|
@@ -593,7 +775,7 @@ export function startRunner(options) {
|
|
|
593
775
|
// Closed while the batch was claimed (or a run this runner still holds, which a claim cannot be): given back.
|
|
594
776
|
if (before && !before.fence.lost)
|
|
595
777
|
emit({ type: "error", runId: claim.runId, step: "claim", message: "claimed a run this runner still holds" });
|
|
596
|
-
await
|
|
778
|
+
await release(claim, {}).catch(() => { });
|
|
597
779
|
continue;
|
|
598
780
|
}
|
|
599
781
|
try {
|
|
@@ -609,7 +791,7 @@ export function startRunner(options) {
|
|
|
609
791
|
emit({ type: "error", runId: claim.runId, step: "create loop", message: message(error) });
|
|
610
792
|
await store.runs.update(claim, { state: "failed", summary: redact(message(error)) }).catch(() => { });
|
|
611
793
|
await store.flush().catch(() => { });
|
|
612
|
-
await
|
|
794
|
+
await release(claim, {}).catch(() => { });
|
|
613
795
|
}
|
|
614
796
|
}
|
|
615
797
|
}
|
|
@@ -645,6 +827,8 @@ export function startRunner(options) {
|
|
|
645
827
|
}
|
|
646
828
|
catch (error) {
|
|
647
829
|
emit({ type: "error", runId, step: "claim", message: message(error) });
|
|
830
|
+
if (error instanceof Unanswered)
|
|
831
|
+
await giveBackUnknown(claims);
|
|
648
832
|
break;
|
|
649
833
|
}
|
|
650
834
|
if (!claim)
|
|
@@ -673,6 +857,19 @@ export function startRunner(options) {
|
|
|
673
857
|
};
|
|
674
858
|
poll();
|
|
675
859
|
commandTimer = setTimeout(deliverAll, commandPollMs);
|
|
860
|
+
// A command written for a run this runner holds is handed on now, not at the next poll. A delivery already in flight
|
|
861
|
+
// marks the run, and one more delivery follows its end, so a row written mid-delivery is never left to the next poll.
|
|
862
|
+
unwatchCommands = store.watchCommands(({ runId, what }) => {
|
|
863
|
+
if (what !== "written" || !delivering())
|
|
864
|
+
return;
|
|
865
|
+
const held = runs.get(runId);
|
|
866
|
+
if (held === undefined)
|
|
867
|
+
return;
|
|
868
|
+
if (held.delivering)
|
|
869
|
+
held.deliverAgain = true;
|
|
870
|
+
else
|
|
871
|
+
void deliver(held);
|
|
872
|
+
});
|
|
676
873
|
/** The untaken stop or cancel row each of `going` ends on (endingRow: a cancel before a stop), past its cursor, by run id:
|
|
677
874
|
* the close's one read of their rows (store.commandsOf), after the deliveries in flight. The whole of it is bounded by
|
|
678
875
|
* the stop margin, so a store that stalls never holds the shutdown: a read that fails or runs past it is said, and those
|
|
@@ -722,6 +919,7 @@ export function startRunner(options) {
|
|
|
722
919
|
const stopTimers = () => {
|
|
723
920
|
clearTimeout(pollTimer);
|
|
724
921
|
clearTimeout(commandTimer);
|
|
922
|
+
unwatchCommands?.();
|
|
725
923
|
clearInterval(renewTimer);
|
|
726
924
|
for (const held of runs.values())
|
|
727
925
|
clock.clearTimeout(held.deadline);
|
|
@@ -737,7 +935,12 @@ export function startRunner(options) {
|
|
|
737
935
|
// A claim the poll already has in flight lands first: one it makes now is given back at once (claimMore, closed),
|
|
738
936
|
// all before close resolves, so nothing is claimed by this runner after it (a raise sent then wakes no claim here).
|
|
739
937
|
draining = drainMs > 0;
|
|
740
|
-
|
|
938
|
+
// A claim recovery under way (re-reads after an Unanswered commit) is bound by the close's own window: past it the
|
|
939
|
+
// close goes on to stop the loops, and the lease settles what the recovery had not.
|
|
940
|
+
recoverBy = Date.now() + leaseMs - stopMarginMs;
|
|
941
|
+
let recoverTimer;
|
|
942
|
+
await Promise.race([claiming, new Promise((resolve) => (recoverTimer = setTimeout(resolve, Math.max(0, recoverBy - Date.now()))))]);
|
|
943
|
+
clearTimeout(recoverTimer);
|
|
741
944
|
// The drain: each held run goes on to its own end (an answer, a park, a person's stop: their commands still reach
|
|
742
945
|
// them), its claims renewed, for up to drainMs; a turn in flight then finishes, never cut and paid again on the
|
|
743
946
|
// resume. Whatever is still going at the bound is stopped below, for a shutdown, where it can resume.
|
|
@@ -753,6 +956,7 @@ export function startRunner(options) {
|
|
|
753
956
|
// One window for the stop after the drain, the one runnerCloseBoundMs counts (the lease less its margin): the read
|
|
754
957
|
// below and the loops' stop share it, so the close is never longer than a deployment's stop grace allows for.
|
|
755
958
|
const stopBy = Date.now() + leaseMs - stopMarginMs;
|
|
959
|
+
recoverBy = stopBy;
|
|
756
960
|
// A stop or cancel a person sent before the close is the run's end, never a resume: one no delivery has handed on
|
|
757
961
|
// yet (the command poll's tick had not come) is read here, once, for every run still going, and stops its loop as
|
|
758
962
|
// its delivery would. Its end is in the store when the close is done, and the next start never resumes the turn.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Store } from "../store/index.js";
|
|
2
|
+
/** Most run folders one start sweeps (kept folders do not count): what is left past it is swept at the next start. */
|
|
3
|
+
export declare const SCRATCH_SWEEP_LIMIT = 500;
|
|
4
|
+
export type ScratchSwept = {
|
|
5
|
+
readonly examined: number;
|
|
6
|
+
readonly swept: number;
|
|
7
|
+
readonly kept: number;
|
|
8
|
+
readonly failed: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function sweepEndedScratch(store: Pick<Store, "runs">, dataDir: string, options?: {
|
|
11
|
+
log?: (line: string) => void;
|
|
12
|
+
limit?: number;
|
|
13
|
+
}): Promise<ScratchSwept>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// A runner's start sweep of the scratch folders of runs that have ended (`<data>/scratch/<agent>/<run>`). A CLI run's
|
|
2
|
+
// files on a runner (its harness's home and session state) go at its claims' ends (cli-run-spec.ts sweepScratch), and a
|
|
3
|
+
// next claim sweeps what a killed claim left; a run that ends after its runner died has no next claim, so its folders stay
|
|
4
|
+
// until this sweep, at the next start of a runner on the data directory, takes them. It reads each run's row: a folder is
|
|
5
|
+
// swept only for a run the store says is final, and only the claims at or below the row's epoch (a follow-up that reopened
|
|
6
|
+
// the run claims above it, and its folder is never touched). A run that is not final, one the store has no row for, and a
|
|
7
|
+
// folder whose name is no run id stay. Bounded by `limit` run folders swept (or failed): a folder that stays costs one
|
|
8
|
+
// row read and never counts, so retained folders in front of an ended run cannot hide it. Logged.
|
|
9
|
+
import { readdir } from "node:fs/promises";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import { FINAL_STATES } from "../store/index.js";
|
|
12
|
+
import { sweepScratch } from "./cli-run-spec.js";
|
|
13
|
+
/** Most run folders one start sweeps (kept folders do not count): what is left past it is swept at the next start. */
|
|
14
|
+
export const SCRATCH_SWEEP_LIMIT = 500;
|
|
15
|
+
const words = (error) => error?.message ?? String(error);
|
|
16
|
+
const names = (folder) => readdir(folder).catch((error) => {
|
|
17
|
+
if (error.code === "ENOENT")
|
|
18
|
+
return [];
|
|
19
|
+
throw error;
|
|
20
|
+
});
|
|
21
|
+
export async function sweepEndedScratch(store, dataDir, options = {}) {
|
|
22
|
+
const log = options.log ?? (() => { });
|
|
23
|
+
const limit = options.limit ?? SCRATCH_SWEEP_LIMIT;
|
|
24
|
+
const root = join(dataDir, "scratch");
|
|
25
|
+
let examined = 0;
|
|
26
|
+
let swept = 0;
|
|
27
|
+
let kept = 0;
|
|
28
|
+
let failed = 0;
|
|
29
|
+
try {
|
|
30
|
+
outer: for (const agent of await names(root)) {
|
|
31
|
+
const agentFolder = join(root, agent);
|
|
32
|
+
for (const run of await names(agentFolder)) {
|
|
33
|
+
if (swept + failed >= limit) {
|
|
34
|
+
log(`scratch sweep: stopped after ${limit} run folders swept; the rest is swept at the next start`);
|
|
35
|
+
break outer;
|
|
36
|
+
}
|
|
37
|
+
examined += 1;
|
|
38
|
+
try {
|
|
39
|
+
const row = await store.runs.get(run);
|
|
40
|
+
if (!row || !FINAL_STATES.includes(row.state)) {
|
|
41
|
+
kept += 1;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const harnesses = join(agentFolder, run, "harness");
|
|
45
|
+
await sweepScratch(harnesses, row.epoch, [harnesses, join(agentFolder, run), agentFolder]);
|
|
46
|
+
swept += 1;
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
failed += 1;
|
|
50
|
+
log(`scratch sweep: run folder ${run} of ${agent} could not be swept: ${words(error)}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
failed += 1;
|
|
57
|
+
log(`scratch sweep: the scratch folder could not be read: ${words(error)}`);
|
|
58
|
+
}
|
|
59
|
+
if (swept > 0 || failed > 0)
|
|
60
|
+
log(`scratch sweep: ${swept} ended run${swept === 1 ? "" : "s"}' folders swept, ${kept} kept, ${failed} failed`);
|
|
61
|
+
return { examined, swept, kept, failed };
|
|
62
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Context } from "@earendil-works/chord";
|
|
1
|
+
import type { Context } from "@earendil-works/chord/context";
|
|
2
2
|
import { type Harness } from "@earendil-works/pi-durable";
|
|
3
3
|
import { type SessionStore } from "@parcha/agentrun-kernel";
|
|
4
4
|
import { type Store } from "../store/store.js";
|
|
@@ -3,6 +3,10 @@ type Held = {
|
|
|
3
3
|
readonly tools?: {
|
|
4
4
|
end(): Promise<void>;
|
|
5
5
|
};
|
|
6
|
+
/** The run's checkout of its pull request (pr-checkout.ts), removed from its folder while the Workspace still answers. */
|
|
7
|
+
readonly checkout?: {
|
|
8
|
+
end(): Promise<void>;
|
|
9
|
+
} | undefined;
|
|
6
10
|
readonly computer?: {
|
|
7
11
|
release(): Promise<void>;
|
|
8
12
|
};
|
|
@@ -33,9 +37,10 @@ export declare class SpecHolds {
|
|
|
33
37
|
logTo(log: (line: string) => void): void;
|
|
34
38
|
/** `parts`, held from now until the release. */
|
|
35
39
|
hold(parts: Held): void;
|
|
36
|
-
/** Everything held let go, once: the tools' end (background processes ended, scratch swept), the
|
|
37
|
-
* mount credential (idempotent: the computer's release revokes it too), the
|
|
38
|
-
* the claim's keys where they are held. A second call waits for the first and
|
|
40
|
+
/** Everything held let go, once: the tools' end (background processes ended, scratch swept), the pull request's
|
|
41
|
+
* checkout removed, the computer, the Archil mount credential (idempotent: the computer's release revokes it too), the
|
|
42
|
+
* Workspace's end, the CLI's scratch, then the claim's keys where they are held. A second call waits for the first and
|
|
43
|
+
* does nothing more. */
|
|
39
44
|
release(): Promise<void>;
|
|
40
45
|
/** What the spec would have handed the loop, let go: only a build that throws calls it. */
|
|
41
46
|
releasePassed(): void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// What a run's spec holds from its claim until its release: the run's tools, its
|
|
2
|
-
// and its Workspace, each kept here as the spec builder makes it (adapter-run-spec.ts and
|
|
3
|
-
// release lets them go, in that order, each step's failure logged and the next still taken.
|
|
4
|
-
// part-way never hands the loop a spec to release, so specBuilt lets go what was made by then, the
|
|
5
|
-
// the builder's own error unchanged: a credential minted for the run is revoked and a computer made
|
|
6
|
-
// left to the credential's 24 h ttl or the computer's lifetime. Each is let go at most once.
|
|
1
|
+
// What a run's spec holds from its claim until its release: the run's tools, its pull request's checkout, its computer,
|
|
2
|
+
// its Archil mount credential and its Workspace, each kept here as the spec builder makes it (adapter-run-spec.ts and
|
|
3
|
+
// cli-run-spec.ts). The spec's release lets them go, in that order, each step's failure logged and the next still taken.
|
|
4
|
+
// A builder that throws part-way never hands the loop a spec to release, so specBuilt lets go what was made by then, the
|
|
5
|
+
// same way, and throws the builder's own error unchanged: a credential minted for the run is revoked and a computer made
|
|
6
|
+
// for it let go, never left to the credential's 24 h ttl or the computer's lifetime. Each is let go at most once.
|
|
7
7
|
const words = (error) => error?.message ?? String(error);
|
|
8
8
|
/** The parts a run's spec holds, and their one release. */
|
|
9
9
|
export class SpecHolds {
|
|
@@ -18,16 +18,18 @@ export class SpecHolds {
|
|
|
18
18
|
hold(parts) {
|
|
19
19
|
this.#held = { ...this.#held, ...parts };
|
|
20
20
|
}
|
|
21
|
-
/** Everything held let go, once: the tools' end (background processes ended, scratch swept), the
|
|
22
|
-
* mount credential (idempotent: the computer's release revokes it too), the
|
|
23
|
-
* the claim's keys where they are held. A second call waits for the first and
|
|
21
|
+
/** Everything held let go, once: the tools' end (background processes ended, scratch swept), the pull request's
|
|
22
|
+
* checkout removed, the computer, the Archil mount credential (idempotent: the computer's release revokes it too), the
|
|
23
|
+
* Workspace's end, the CLI's scratch, then the claim's keys where they are held. A second call waits for the first and
|
|
24
|
+
* does nothing more. */
|
|
24
25
|
release() {
|
|
25
26
|
return (this.#released ??= this.#releaseAll());
|
|
26
27
|
}
|
|
27
28
|
async #releaseAll() {
|
|
28
|
-
const { tools, computer, archil, ws, scratch, keys } = this.#held;
|
|
29
|
+
const { tools, checkout, computer, archil, ws, scratch, keys } = this.#held;
|
|
29
30
|
const log = this.#log;
|
|
30
31
|
await tools?.end().catch((error) => log(`the run's tools' end failed: ${words(error)}`));
|
|
32
|
+
await checkout?.end().catch((error) => log(words(error)));
|
|
31
33
|
await computer?.release().catch((error) => log(`the run's computer could not be let go: ${words(error)}`));
|
|
32
34
|
await archil?.revoke().catch((error) => log(`the run's Archil mount credential could not be revoked: ${words(error)}`));
|
|
33
35
|
await ws?.end().catch((error) => log(`the run's workspace end failed: ${words(error)}`));
|