@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,185 @@
|
|
|
1
|
+
// The account's disks at Archil's control plane: what makes each agent's own disk, reads a disk a launch names, and
|
|
2
|
+
// removes an agent's own disk. With the account API key as `Authorization: Bearer <key>`, on the region's control plane
|
|
3
|
+
// (archil-mount-credential.ts controlOf), as Archil's API (`@archildata/api-types` 0.0.81) has them:
|
|
4
|
+
// - create: POST {control}/api/disks {"name"}: Archil-managed storage (no mounts), in the control plane's region. 201
|
|
5
|
+
// made it; 200 when a disk of that name is there already with this configuration (idempotent); 409 when one
|
|
6
|
+
// of that name is there with another, which is found by listing that name; 403 `disk_limit_reached` when the
|
|
7
|
+
// plan's per-region disk limit is reached (`organization_plan_required`: a free organization makes none). A
|
|
8
|
+
// made disk comes with a default token user, which is removed at once: no standing token is kept anywhere. A
|
|
9
|
+
// disk found there already (200, 409) loses every token user that is not a run's, so a default token whose
|
|
10
|
+
// removal failed on an earlier try is removed on the next.
|
|
11
|
+
// - read: GET {control}/api/disks/{id}: its name, region and status; 404 when the account has none of that id.
|
|
12
|
+
// - list: GET {control}/api/disks?name=<name>: the disks of that exact name.
|
|
13
|
+
// - remove: DELETE {control}/api/disks/{id}: the disk and everything on it. Idempotent: a 404 is already gone.
|
|
14
|
+
// Neither the key nor a token is ever in an error: an error carries the status and Archil's own words, scrubbed.
|
|
15
|
+
import { controlOf, errorOf, isRunNickname, listTokenUsers, scrub } from "./archil-mount-credential.js";
|
|
16
|
+
/** A call to Archil's disks refused or not answered, in words with no secret in them. */
|
|
17
|
+
export class ArchilDiskError extends Error {
|
|
18
|
+
name = "ArchilDiskError";
|
|
19
|
+
status;
|
|
20
|
+
code;
|
|
21
|
+
constructor(message, status, code) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.status = status;
|
|
24
|
+
this.code = code;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** The plan's disk limit reached: `limit` when Archil's words say how many disks it allows. */
|
|
28
|
+
export class ArchilDiskLimit extends ArchilDiskError {
|
|
29
|
+
name = "ArchilDiskLimit";
|
|
30
|
+
limit;
|
|
31
|
+
constructor(message, limit) {
|
|
32
|
+
super(message, 403, "disk_limit_reached");
|
|
33
|
+
this.limit = limit;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** One call to the control plane: its answer, or an ArchilDiskError naming `what` when it could not be reached. */
|
|
37
|
+
async function call(options, method, path, what, context, body) {
|
|
38
|
+
const key = await options.key();
|
|
39
|
+
try {
|
|
40
|
+
const response = await (options.fetch ?? fetch)(`${controlOf(options)}${path}`, {
|
|
41
|
+
method,
|
|
42
|
+
headers: { Authorization: `Bearer ${key}`, ...(body !== undefined ? { "Content-Type": "application/json" } : {}) },
|
|
43
|
+
...(body !== undefined ? { body: JSON.stringify(body) } : {}),
|
|
44
|
+
redirect: "error",
|
|
45
|
+
...(context.signal ? { signal: context.signal } : {}),
|
|
46
|
+
});
|
|
47
|
+
return { response, key };
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
throw new ArchilDiskError(`Archil's control plane could not be reached to ${what}: ${scrub(error instanceof Error ? error.message : String(error), [key])}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** A refusal as an ArchilDiskError, Archil's words and code in it. */
|
|
54
|
+
async function refused(response, key, what) {
|
|
55
|
+
const { words, code } = await errorOf(response, [key]);
|
|
56
|
+
return new ArchilDiskError(`Archil refused to ${what} (${response.status}): ${words}`, response.status, code);
|
|
57
|
+
}
|
|
58
|
+
const infoOf = (value) => {
|
|
59
|
+
const disk = value;
|
|
60
|
+
return typeof disk?.id === "string" ? { id: disk.id, name: typeof disk.name === "string" ? disk.name : "", region: typeof disk.region === "string" ? disk.region : "", status: typeof disk.status === "string" ? disk.status : "" } : undefined;
|
|
61
|
+
};
|
|
62
|
+
/** Disk `id` as Archil reads it, or undefined when the account has none of that id (404). */
|
|
63
|
+
export async function getDisk(options, id, context = {}) {
|
|
64
|
+
const { response, key } = await call(options, "GET", `/api/disks/${encodeURIComponent(id)}`, `read the disk ${id}`, context);
|
|
65
|
+
if (response.status === 404) {
|
|
66
|
+
await response.body?.cancel().catch(() => undefined);
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
if (!response.ok)
|
|
70
|
+
throw await refused(response, key, `read the disk ${id}`);
|
|
71
|
+
const disk = infoOf((await response.json().catch(() => undefined))?.data);
|
|
72
|
+
if (disk === undefined)
|
|
73
|
+
throw new ArchilDiskError(`Archil answered the read of the disk ${id} with no disk`);
|
|
74
|
+
return disk;
|
|
75
|
+
}
|
|
76
|
+
/** The account's disk named `name`, or undefined when there is none. */
|
|
77
|
+
export async function diskNamed(options, name, context = {}) {
|
|
78
|
+
const { response, key } = await call(options, "GET", `/api/disks?name=${encodeURIComponent(name)}`, `find the disk ${name}`, context);
|
|
79
|
+
if (!response.ok)
|
|
80
|
+
throw await refused(response, key, `find the disk ${name}`);
|
|
81
|
+
const data = (await response.json().catch(() => undefined))?.data;
|
|
82
|
+
return (Array.isArray(data) ? data : []).map(infoOf).find((disk) => disk?.name === name);
|
|
83
|
+
}
|
|
84
|
+
/** How many disks a plan allows, when Archil's words for its refusal say. */
|
|
85
|
+
export function limitOf(words) {
|
|
86
|
+
const match = /\b(?:limit(?:\s+of)?|allows?|maximum(?:\s+of)?|max(?:imum)?)\s+(\d+)\b/i.exec(words) ?? /\b(\d+)\s+disks?\b/i.exec(words);
|
|
87
|
+
return match ? Number(match[1]) : undefined;
|
|
88
|
+
}
|
|
89
|
+
/** Removes token user `identifier` of disk `diskId`. Idempotent: one already gone (404) is removed. */
|
|
90
|
+
async function removeToken(options, diskId, identifier, what, context) {
|
|
91
|
+
const removed = await call(options, "DELETE", `/api/disks/${encodeURIComponent(diskId)}/users/token?identifier=${encodeURIComponent(identifier)}`, what, context);
|
|
92
|
+
if (!removed.response.ok && removed.response.status !== 404)
|
|
93
|
+
throw await refused(removed.response, removed.key, what);
|
|
94
|
+
await removed.response.body?.cancel().catch(() => undefined);
|
|
95
|
+
}
|
|
96
|
+
/** Removes every token user of disk `diskId` that is not a run's (isRunNickname): the default one Archil made with it,
|
|
97
|
+
* left standing when an earlier call's removal failed or its answer was lost. A run's token is the run's to revoke. */
|
|
98
|
+
async function removeStrayTokens(options, diskId, name, context) {
|
|
99
|
+
const what = `remove the disk ${name}'s default token`;
|
|
100
|
+
let users;
|
|
101
|
+
try {
|
|
102
|
+
users = await listTokenUsers({ ...options, disk: diskId }, context);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
throw new ArchilDiskError(`Archil's token users of the disk ${name} could not be read to ${what}: ${error.message}`, error.status);
|
|
106
|
+
}
|
|
107
|
+
for (const user of users)
|
|
108
|
+
if (!isRunNickname(user.nickname))
|
|
109
|
+
await removeToken(options, diskId, user.identifier, what, context);
|
|
110
|
+
}
|
|
111
|
+
/** Makes the disk `name` (Archil-managed storage, the control plane's region), or finds it when it is there already: its
|
|
112
|
+
* id, and whether this call made it. A disk this call made has its default token user removed before it is answered; a
|
|
113
|
+
* disk found there already has every token user that is not a run's removed (an earlier call's default token, when its
|
|
114
|
+
* removal failed). The plan's limit is an ArchilDiskLimit. */
|
|
115
|
+
export async function ensureDisk(options, name, context = {}) {
|
|
116
|
+
const { response, key } = await call(options, "POST", "/api/disks", `make the disk ${name}`, context, { name });
|
|
117
|
+
if (response.status === 409) {
|
|
118
|
+
await response.body?.cancel().catch(() => undefined);
|
|
119
|
+
const there = await diskNamed(options, name, context);
|
|
120
|
+
if (there === undefined)
|
|
121
|
+
throw new ArchilDiskError(`Archil said a disk named ${name} is there with another configuration, and no disk of that name is listed`, 409);
|
|
122
|
+
await removeStrayTokens(options, there.id, name, context);
|
|
123
|
+
return { id: there.id, made: false };
|
|
124
|
+
}
|
|
125
|
+
if (response.status === 403) {
|
|
126
|
+
const { words, code } = await errorOf(response, [key]);
|
|
127
|
+
if (code === "disk_limit_reached")
|
|
128
|
+
throw new ArchilDiskLimit(`Archil refused to make the disk ${name}: ${words}`, limitOf(words));
|
|
129
|
+
throw new ArchilDiskError(`Archil refused to make the disk ${name} (403): ${words}`, 403, code);
|
|
130
|
+
}
|
|
131
|
+
if (!response.ok)
|
|
132
|
+
throw await refused(response, key, `make the disk ${name}`);
|
|
133
|
+
const data = (await response.json().catch(() => undefined))?.data;
|
|
134
|
+
if (typeof data?.diskId !== "string" || data.diskId === "")
|
|
135
|
+
throw new ArchilDiskError(`Archil answered the making of the disk ${name} with no disk id`);
|
|
136
|
+
const made = response.status === 201;
|
|
137
|
+
if (made) {
|
|
138
|
+
// The default token user Archil makes with a disk: no one holds it, and none is kept standing.
|
|
139
|
+
const users = Array.isArray(data.authorizedUsers) ? data.authorizedUsers : [];
|
|
140
|
+
for (const user of users) {
|
|
141
|
+
if (user?.type !== "token" || typeof user.identifier !== "string")
|
|
142
|
+
continue;
|
|
143
|
+
await removeToken(options, data.diskId, user.identifier, `remove the new disk ${name}'s default token`, context);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
await removeStrayTokens(options, data.diskId, name, context);
|
|
148
|
+
}
|
|
149
|
+
return { id: data.diskId, made };
|
|
150
|
+
}
|
|
151
|
+
/** Waits until disk `id` reads `available` (a disk just made reads `creating` for a while), up to `timeoutMs`. */
|
|
152
|
+
export async function availableDisk(options, id, { timeoutMs = 120_000, everyMs = 1_000, signal } = {}) {
|
|
153
|
+
const until = Date.now() + timeoutMs;
|
|
154
|
+
for (;;) {
|
|
155
|
+
// Each read is bounded by the time left, so a stalled response cannot outwait the deadline.
|
|
156
|
+
const left = AbortSignal.timeout(Math.max(1, until - Date.now()));
|
|
157
|
+
const disk = await getDisk(options, id, { signal: signal ? AbortSignal.any([signal, left]) : left });
|
|
158
|
+
if (disk === undefined)
|
|
159
|
+
throw new ArchilDiskError(`Archil has no disk ${id} in ${options.region}`, 404);
|
|
160
|
+
if (disk.status === "available")
|
|
161
|
+
return disk;
|
|
162
|
+
if (disk.status === "failed" || disk.status === "deleting" || disk.status === "deleted")
|
|
163
|
+
throw new ArchilDiskError(`the disk ${id} is ${disk.status} at Archil`);
|
|
164
|
+
if (Date.now() >= until)
|
|
165
|
+
throw new ArchilDiskError(`the disk ${id} was still ${disk.status || "not ready"} at Archil after ${Math.round(timeoutMs / 1000)} s`);
|
|
166
|
+
await new Promise((done) => setTimeout(done, everyMs));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/** Removes disk `id` and everything on it. Idempotent: one already gone (404) is removed. */
|
|
170
|
+
export async function deleteDisk(options, id, context = {}) {
|
|
171
|
+
const { response, key } = await call(options, "DELETE", `/api/disks/${encodeURIComponent(id)}`, `remove the disk ${id}`, context);
|
|
172
|
+
if (response.ok || response.status === 404) {
|
|
173
|
+
await response.body?.cancel().catch(() => undefined);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
throw await refused(response, key, `remove the disk ${id}`);
|
|
177
|
+
}
|
|
178
|
+
/** One page of the account's disks, at most one: what the Archil settings' test reads to know the key works. */
|
|
179
|
+
export async function listOneDisk(options, context = {}) {
|
|
180
|
+
const { response, key } = await call(options, "GET", "/api/disks?short=true&limit=1", "list the account's disks", context);
|
|
181
|
+
if (!response.ok)
|
|
182
|
+
throw await refused(response, key, "list the account's disks");
|
|
183
|
+
const body = (await response.json().catch(() => undefined));
|
|
184
|
+
return typeof body?.total === "number" ? body.total : Array.isArray(body?.data) ? body.data.length : 0;
|
|
185
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Workspace exec on an Archil disk: one serverless exec call (archil-disk.ts) that mounts the workspace's folder and
|
|
2
|
-
// its exec spill folder, and nothing else of the disk
|
|
3
|
-
//
|
|
4
|
-
// The rest (boxes, records, sweeps) is not.
|
|
2
|
+
// its exec spill folder, and nothing else of the disk: the call, its 300 s cut, the hold on the folder with a queue, and
|
|
3
|
+
// the mapping of the exit and of the deadline.
|
|
5
4
|
//
|
|
6
5
|
// Archil runs one shell line in a fresh container with two folders of the disk, each a mount's `subdirectory`, held for
|
|
7
6
|
// the line (no other client writes in them meanwhile; a second one waits up to queueMs):
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/** The control plane of each Archil region, as Archil's SDK (`disk` 1.12.0, src/regions.ts) names them. */
|
|
2
2
|
export declare const ARCHIL_CONTROL_URLS: Readonly<Record<string, string>>;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/** Its region: it names the control plane. */
|
|
3
|
+
/** Archil's control plane, for the account's calls (archil-disks.ts) as for a disk's. */
|
|
4
|
+
export interface ArchilControlOptions {
|
|
5
|
+
/** The region: it names the control plane. */
|
|
7
6
|
readonly region: string;
|
|
8
7
|
/** The account API key, asked for on each call. */
|
|
9
8
|
readonly key: () => string | Promise<string>;
|
|
@@ -12,6 +11,10 @@ export interface ArchilMountCredentialOptions {
|
|
|
12
11
|
/** The fetch to call it with (default the global one). */
|
|
13
12
|
readonly fetch?: typeof fetch;
|
|
14
13
|
}
|
|
14
|
+
export interface ArchilMountCredentialOptions extends ArchilControlOptions {
|
|
15
|
+
/** The disk's id, dsk-<16 hex digits>. */
|
|
16
|
+
readonly disk: string;
|
|
17
|
+
}
|
|
15
18
|
/** A minted mount credential: the token a computer's mount takes, and the identifier it is removed by. */
|
|
16
19
|
export interface MountCredential {
|
|
17
20
|
readonly token: string;
|
|
@@ -23,11 +26,24 @@ export declare class ArchilMountCredentialError extends Error {
|
|
|
23
26
|
readonly status: number | undefined;
|
|
24
27
|
constructor(message: string, status?: number);
|
|
25
28
|
}
|
|
29
|
+
/** The control plane's base URL: the region's, or the loopback one given. */
|
|
30
|
+
export declare function controlOf(options: ArchilControlOptions): string;
|
|
26
31
|
/** A ttl as Archil reads it (a Go duration): whole seconds, at least one, at most Archil's 365 days. */
|
|
27
32
|
export declare const ttlOf: (ms: number) => string;
|
|
28
33
|
/** The nickname of run `run`'s token user under claim epoch `epoch`: the run and the epoch, so a later claim finds an
|
|
29
34
|
* earlier one's (its runner died before removing it). */
|
|
30
35
|
export declare const nicknameOf: (run: string, epoch: number) => string;
|
|
36
|
+
/** Whether a token user's nickname is a run's (nicknameOf): every token this server mints is one. */
|
|
37
|
+
export declare const isRunNickname: (nickname: unknown) => boolean;
|
|
38
|
+
/** `text` with each secret replaced. */
|
|
39
|
+
export declare const scrub: (text: string, secrets: readonly string[]) => string;
|
|
40
|
+
/** Archil's words for a failed call, from its error envelope ({error, code}), cut short and scrubbed. */
|
|
41
|
+
export declare function wordsOf(response: Response, secrets: readonly string[]): Promise<string>;
|
|
42
|
+
/** Archil's error envelope ({error, code}): its words, cut short and scrubbed, and its code when it gives one. */
|
|
43
|
+
export declare function errorOf(response: Response, secrets: readonly string[]): Promise<{
|
|
44
|
+
words: string;
|
|
45
|
+
code?: string;
|
|
46
|
+
}>;
|
|
31
47
|
/** Mints the run's mount credential on the disk: a token user named `nickname`, which Archil ends after `ttlMs`. */
|
|
32
48
|
export declare function mintMountToken(options: ArchilMountCredentialOptions, run: {
|
|
33
49
|
readonly nickname: string;
|
|
@@ -28,7 +28,7 @@ export class ArchilMountCredentialError extends Error {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
/** The control plane's base URL: the region's, or the loopback one given. */
|
|
31
|
-
function controlOf(options) {
|
|
31
|
+
export function controlOf(options) {
|
|
32
32
|
if (options.baseUrl !== undefined) {
|
|
33
33
|
const url = new URL(options.baseUrl);
|
|
34
34
|
if (url.protocol !== "https:" && !(url.protocol === "http:" && LOOPBACK.test(url.hostname)))
|
|
@@ -54,20 +54,29 @@ function claimOfNickname(nickname) {
|
|
|
54
54
|
const match = /^agentrun:(.+):(0|[1-9][0-9]*)$/.exec(nickname);
|
|
55
55
|
return match ? { run: match[1], epoch: Number(match[2]) } : undefined;
|
|
56
56
|
}
|
|
57
|
+
/** Whether a token user's nickname is a run's (nicknameOf): every token this server mints is one. */
|
|
58
|
+
export const isRunNickname = (nickname) => claimOfNickname(nickname) !== undefined;
|
|
57
59
|
/** `text` with each secret replaced. */
|
|
58
|
-
const scrub = (text, secrets) => secrets.filter((one) => one.length >= 4).reduce((out, one) => out.split(one).join("[redacted]"), text);
|
|
60
|
+
export const scrub = (text, secrets) => secrets.filter((one) => one.length >= 4).reduce((out, one) => out.split(one).join("[redacted]"), text);
|
|
59
61
|
/** Archil's words for a failed call, from its error envelope ({error, code}), cut short and scrubbed. */
|
|
60
|
-
async function wordsOf(response, secrets) {
|
|
62
|
+
export async function wordsOf(response, secrets) {
|
|
63
|
+
return (await errorOf(response, secrets)).words;
|
|
64
|
+
}
|
|
65
|
+
/** Archil's error envelope ({error, code}): its words, cut short and scrubbed, and its code when it gives one. */
|
|
66
|
+
export async function errorOf(response, secrets) {
|
|
61
67
|
const text = await response.text().catch(() => "");
|
|
62
68
|
let said = text;
|
|
69
|
+
let code;
|
|
63
70
|
try {
|
|
64
71
|
const body = JSON.parse(text);
|
|
65
72
|
said = typeof body.error === "string" ? body.error : typeof body.message === "string" ? body.message : text;
|
|
73
|
+
if (typeof body.code === "string")
|
|
74
|
+
code = body.code;
|
|
66
75
|
}
|
|
67
76
|
catch {
|
|
68
77
|
// not JSON: its text
|
|
69
78
|
}
|
|
70
|
-
return scrub(said.trim().slice(0, 300), secrets);
|
|
79
|
+
return { words: scrub(said.trim().slice(0, 300), secrets), ...(code !== undefined ? { code } : {}) };
|
|
71
80
|
}
|
|
72
81
|
/** Mints the run's mount credential on the disk: a token user named `nickname`, which Archil ends after `ttlMs`. */
|
|
73
82
|
export async function mintMountToken(options, run) {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type AttachHub, type ComputerProvider, type HelloResult, type PairedComputer } from "@parcha/agentrun-computer";
|
|
2
|
+
import type { PairedComputerRow } from "../store/index.js";
|
|
3
|
+
import type { ComputerSettingKind, KindRegistry, ProviderEntry } from "./resolve-computer.js";
|
|
4
|
+
/** A paired computer's id starts with this; the rest is lowercase letters and digits, so the whole is an id an agent's
|
|
5
|
+
* computer setting takes as its provider (lowercase letters, digits and dashes). */
|
|
6
|
+
export declare const PAIRED_ID_PREFIX = "cmp-";
|
|
7
|
+
/** The image a paired computer's spec names: none is made, so this only says what it is. */
|
|
8
|
+
export declare const ATTACHED_IMAGE = "attached";
|
|
9
|
+
/** The words a run gets when its agent's computer is a paired computer and its runner is not in the server's process. */
|
|
10
|
+
export declare const ONE_PROCESS_WORDS = "a paired computer's socket is held by the serve process it dialed, and this runner runs in a process of its own: start AgentRun as one process (agentrun serve, with its runner beside it, not --no-runner) to use a paired computer";
|
|
11
|
+
/** What the claim reads of the paired computers: the store's rows (removed ones left out), and the server's hub where
|
|
12
|
+
* the runner shares its process (absent: a runner of its own process). */
|
|
13
|
+
export interface AttachedComputers {
|
|
14
|
+
rows(): Promise<readonly PairedComputerRow[]>;
|
|
15
|
+
readonly hub?: AttachHub;
|
|
16
|
+
}
|
|
17
|
+
/** The store's row as the hub and attachedProvider take it. */
|
|
18
|
+
export declare const pairedOf: (row: PairedComputerRow) => PairedComputer;
|
|
19
|
+
/** What a driver's hello lacks to serve `kind`, by the kind registry's rule (the computer package's SETTING_KINDS, which
|
|
20
|
+
* servingRefusals reads): "it says desktop but declares no input.pointer, input.keys", "it says android, which no
|
|
21
|
+
* desktop computer is"; undefined when the hello serves the kind. The one source of a paired computer's words for a
|
|
22
|
+
* kind it cannot serve: at pairing (servesNoKind) and at a run's start (withPaired's unservedWhy). */
|
|
23
|
+
export declare function helloLacks(hello: Partial<HelloResult>, kind: ComputerSettingKind): string | undefined;
|
|
24
|
+
/** Why `name`'s driver may not pair: its hello serves no kind an agent's computer can be, so no agent could pick it; in
|
|
25
|
+
* words that say what it lacks and to update the driver. Undefined when it serves one. */
|
|
26
|
+
export declare function servesNoKind(name: string, hello: Partial<HelloResult>): string | undefined;
|
|
27
|
+
/** A paired computer as a provider of `registry`: named by its name and its os, as an agent's computer picker lists it;
|
|
28
|
+
* the setting kinds its paired hello serves, no keys, no mount, the machine's own network ("open": a run never narrows
|
|
29
|
+
* a person's own machine), never metered. */
|
|
30
|
+
export declare function pairedEntry(row: PairedComputerRow, registry: Pick<KindRegistry, "SETTING_KINDS" | "servingRefusals">): ProviderEntry;
|
|
31
|
+
/** `registry` with each paired computer of `rows` as one more provider (pairedEntry), and the words for one that cannot
|
|
32
|
+
* serve a kind an agent asks of it: it is a computer of the person's own, and either the attach path carries no such
|
|
33
|
+
* kind (ATTACH_CANNOT: a sandbox, which would run the agent's shell there, or a browser), so the agent takes it as the
|
|
34
|
+
* kind it serves, or its driver lacks what the kind needs (helloLacks), so the driver is what to update. */
|
|
35
|
+
export declare function withPaired<R extends KindRegistry>(registry: R, rows: readonly PairedComputerRow[]): R;
|
|
36
|
+
/** The provider of the paired computer `row`: attachedProvider over the hub, or a refusal in ONE_PROCESS_WORDS where this
|
|
37
|
+
* process holds no hub. */
|
|
38
|
+
export declare function pairedProvider(row: PairedComputerRow, hub: AttachHub | undefined): ComputerProvider;
|
|
39
|
+
/** Why the paired computer `row` cannot be had now, in words that say what to do, or undefined: it must be attached (its
|
|
40
|
+
* driver dialed this server). Asked at a run's start, as a vendor's readiness is; another run's hold is the claim's. */
|
|
41
|
+
export declare function pairedRefusal(row: PairedComputerRow, hub: Pick<AttachHub, "online"> | undefined): string | undefined;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// A paired computer (a person's own, attached over the attach binding: computer-attach.ts) as the claim and Settings see
|
|
2
|
+
// it: one provider of the kind registry, whose id is the computer's own (cmp-...), whose label is its name, and whose one
|
|
3
|
+
// configuration is the kind and groups it paired as. An agent's computer setting names it as its provider, {kind:
|
|
4
|
+
// "desktop", provider: "cmp-..."}, so a run resolves, checks and claims it on the one path every computer takes
|
|
5
|
+
// (resolve-computer.ts, computer-for-claim.ts), and the computer package's attachedProvider stands in for a vendor's.
|
|
6
|
+
//
|
|
7
|
+
// Its socket is held by the AttachHub of the server's process: a runner in that process (the CLI's start, its runner
|
|
8
|
+
// beside the server) takes it; a runner of its own process cannot reach it and refuses it in ONE_PROCESS_WORDS.
|
|
9
|
+
import { attachedProvider, SETTING_KIND_NAMES, SETTING_KINDS } from "@parcha/agentrun-computer";
|
|
10
|
+
/** A paired computer's id starts with this; the rest is lowercase letters and digits, so the whole is an id an agent's
|
|
11
|
+
* computer setting takes as its provider (lowercase letters, digits and dashes). */
|
|
12
|
+
export const PAIRED_ID_PREFIX = "cmp-";
|
|
13
|
+
/** The image a paired computer's spec names: none is made, so this only says what it is. */
|
|
14
|
+
export const ATTACHED_IMAGE = "attached";
|
|
15
|
+
/** The words a run gets when its agent's computer is a paired computer and its runner is not in the server's process. */
|
|
16
|
+
export const ONE_PROCESS_WORDS = "a paired computer's socket is held by the serve process it dialed, and this runner runs in a process of its own: start AgentRun as one process (agentrun serve, with its runner beside it, not --no-runner) to use a paired computer";
|
|
17
|
+
/** The store's row as the hub and attachedProvider take it. */
|
|
18
|
+
export const pairedOf = (row) => ({
|
|
19
|
+
id: row.id,
|
|
20
|
+
name: row.name,
|
|
21
|
+
hello: row.hello,
|
|
22
|
+
labels: { ...row.labels },
|
|
23
|
+
});
|
|
24
|
+
/** The setting kinds the attach path cannot serve, with why and what to pair instead: a browser session needs a CDP
|
|
25
|
+
* connection, which the attach socket does not carry, and a sandbox needs the run's folder mounted, which a paired
|
|
26
|
+
* computer has no mount for (resolve-computer.ts refuses a sandbox without one). Kind-based, never by OS: a driver whose hello serves one of
|
|
27
|
+
* these and no other kind is refused at pairing, and a paired row of one serves nothing. */
|
|
28
|
+
const ATTACH_CANNOT = {
|
|
29
|
+
browser: "a paired computer can't serve browser sessions yet, so pair a desktop or phone driver",
|
|
30
|
+
sandbox: "a paired computer can't mount a run's folder yet, so no agent could run a sandbox on it: pair a desktop or phone driver",
|
|
31
|
+
};
|
|
32
|
+
/** What a driver's hello lacks to serve `kind`, by the kind registry's rule (the computer package's SETTING_KINDS, which
|
|
33
|
+
* servingRefusals reads): "it says desktop but declares no input.pointer, input.keys", "it says android, which no
|
|
34
|
+
* desktop computer is"; undefined when the hello serves the kind. The one source of a paired computer's words for a
|
|
35
|
+
* kind it cannot serve: at pairing (servesNoKind) and at a run's start (withPaired's unservedWhy). */
|
|
36
|
+
export function helloLacks(hello, kind) {
|
|
37
|
+
const spec = SETTING_KINDS[kind];
|
|
38
|
+
const said = String(hello.kind ?? "nothing");
|
|
39
|
+
if (!spec.machineKinds.some((one) => one === hello.kind))
|
|
40
|
+
return `it says ${said}, which no ${kind} computer is`;
|
|
41
|
+
const groups = Array.isArray(hello.groups) ? hello.groups : [];
|
|
42
|
+
const missing = spec.required.filter((group) => !groups.includes(group));
|
|
43
|
+
return missing.length === 0 ? undefined : `it says ${said} but declares no ${missing.join(", ")}`;
|
|
44
|
+
}
|
|
45
|
+
/** Why `name`'s driver may not pair: its hello serves no kind an agent's computer can be, so no agent could pick it; in
|
|
46
|
+
* words that say what it lacks and to update the driver. Undefined when it serves one. */
|
|
47
|
+
export function servesNoKind(name, hello) {
|
|
48
|
+
const kinds = SETTING_KIND_NAMES.filter((kind) => kind !== "none" && !(kind in ATTACH_CANNOT));
|
|
49
|
+
if (kinds.some((kind) => helloLacks(hello, kind) === undefined))
|
|
50
|
+
return undefined;
|
|
51
|
+
// A hello that is whole for a kind the attach path cannot carry says so, in that kind's words.
|
|
52
|
+
const carried = Object.entries(ATTACH_CANNOT).find(([kind]) => helloLacks(hello, kind) === undefined);
|
|
53
|
+
if (carried !== undefined)
|
|
54
|
+
return `${name}'s driver is a ${carried[0]}: ${carried[1]}`;
|
|
55
|
+
// The kind its machine kind is (a desktop's, a phone's) says what is missing; a machine kind no kind takes says that.
|
|
56
|
+
const near = kinds.find((kind) => SETTING_KINDS[kind].machineKinds.some((one) => one === hello.kind));
|
|
57
|
+
const lack = near === undefined ? `it says ${String(hello.kind ?? "nothing")}, which no kind of computer is` : helloLacks(hello, near);
|
|
58
|
+
return `${name}'s driver serves no kind: ${lack}: update the driver on ${name}`;
|
|
59
|
+
}
|
|
60
|
+
/** A paired computer as a provider of `registry`: named by its name and its os, as an agent's computer picker lists it;
|
|
61
|
+
* the setting kinds its paired hello serves, no keys, no mount, the machine's own network ("open": a run never narrows
|
|
62
|
+
* a person's own machine), never metered. */
|
|
63
|
+
export function pairedEntry(row, registry) {
|
|
64
|
+
const hello = row.hello;
|
|
65
|
+
const configuration = { kind: String(hello.kind ?? ""), groups: Array.isArray(hello.groups) ? [...hello.groups] : [] };
|
|
66
|
+
const kinds = Object.keys(registry.SETTING_KINDS).filter((kind) => kind !== "none" && !(kind in ATTACH_CANNOT) && registry.servingRefusals(configuration, kind).length === 0);
|
|
67
|
+
return {
|
|
68
|
+
id: row.id,
|
|
69
|
+
label: typeof hello.os === "string" ? `${row.name} (${hello.os})` : row.name,
|
|
70
|
+
kinds,
|
|
71
|
+
keys: [],
|
|
72
|
+
mounts: [],
|
|
73
|
+
network: ["open"],
|
|
74
|
+
metered: false,
|
|
75
|
+
capabilities: [configuration],
|
|
76
|
+
defaultImage: Object.fromEntries(kinds.map((kind) => [kind, ATTACHED_IMAGE])),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/** `registry` with each paired computer of `rows` as one more provider (pairedEntry), and the words for one that cannot
|
|
80
|
+
* serve a kind an agent asks of it: it is a computer of the person's own, and either the attach path carries no such
|
|
81
|
+
* kind (ATTACH_CANNOT: a sandbox, which would run the agent's shell there, or a browser), so the agent takes it as the
|
|
82
|
+
* kind it serves, or its driver lacks what the kind needs (helloLacks), so the driver is what to update. */
|
|
83
|
+
export function withPaired(registry, rows) {
|
|
84
|
+
if (rows.length === 0)
|
|
85
|
+
return registry;
|
|
86
|
+
const byId = new Map(rows.map((row) => [row.id, row]));
|
|
87
|
+
const unservedWhy = (entry, kind) => {
|
|
88
|
+
const row = byId.get(entry.id);
|
|
89
|
+
if (row !== undefined && kind in ATTACH_CANNOT && entry.kinds.length > 0) {
|
|
90
|
+
return `${row.name} is a computer of your own, and a paired computer can't be a ${kind} computer yet: give this agent ${row.name} as a ${entry.kinds.join(" or ")} computer`;
|
|
91
|
+
}
|
|
92
|
+
const lack = row === undefined ? undefined : helloLacks(row.hello, kind);
|
|
93
|
+
if (row === undefined || lack === undefined)
|
|
94
|
+
return registry.unservedWhy?.(entry, kind);
|
|
95
|
+
return `${row.name} is a computer of your own, and its driver gives no ${kind} computer: ${lack}. Update the driver on ${row.name}`;
|
|
96
|
+
};
|
|
97
|
+
return { ...registry, PROVIDERS: [...registry.PROVIDERS, ...rows.map((row) => pairedEntry(row, registry))], unservedWhy };
|
|
98
|
+
}
|
|
99
|
+
/** The provider of the paired computer `row`: attachedProvider over the hub, or a refusal in ONE_PROCESS_WORDS where this
|
|
100
|
+
* process holds no hub. */
|
|
101
|
+
export function pairedProvider(row, hub) {
|
|
102
|
+
if (hub === undefined)
|
|
103
|
+
throw Object.assign(new Error(ONE_PROCESS_WORDS), { code: "computer_unavailable" });
|
|
104
|
+
return attachedProvider(pairedOf(row), hub);
|
|
105
|
+
}
|
|
106
|
+
/** Why the paired computer `row` cannot be had now, in words that say what to do, or undefined: it must be attached (its
|
|
107
|
+
* driver dialed this server). Asked at a run's start, as a vendor's readiness is; another run's hold is the claim's. */
|
|
108
|
+
export function pairedRefusal(row, hub) {
|
|
109
|
+
if (hub === undefined)
|
|
110
|
+
return ONE_PROCESS_WORDS;
|
|
111
|
+
if (!hub.online(row.id))
|
|
112
|
+
return `This agent's computer is ${row.name}, which is not attached now: open its driver on that computer, which dials this server, then start the run again.`;
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type ComputerSpec, type DockerVolume } from "@parcha/agentrun-computer";
|
|
1
|
+
import { type AttachHub, type ComputerSpec, type DockerVolume } from "@parcha/agentrun-computer";
|
|
2
2
|
import type { DockerPaths } from "../box-paths.js";
|
|
3
3
|
import { type HostRead } from "../docker-host-addresses.js";
|
|
4
|
-
import type
|
|
4
|
+
import { type ProviderFactories } from "../computer-keys.js";
|
|
5
5
|
import type { FauxComputers } from "../faux-computers.js";
|
|
6
6
|
import { type KeyEnv } from "../key-meta.js";
|
|
7
7
|
import type { Store } from "../store/index.js";
|
|
8
|
-
import { type ClaimComputer, type ClaimLaunch, computerForClaim, type ComputerForClaimDeps, type OpenComputerView } from "./computer-for-claim.js";
|
|
8
|
+
import { type ClaimComputer, type ClaimLaunch, computerForClaim, type ComputerForClaimDeps, type ComputerSaid, type OpenComputerView } from "./computer-for-claim.js";
|
|
9
9
|
import { type ProviderLoad } from "./computer-providers.js";
|
|
10
10
|
import { type KindRegistry } from "./resolve-computer.js";
|
|
11
11
|
/** How long a run's computer lives whatever happens to the server: a bound on a leaked one, never its clean end (the old
|
|
@@ -48,8 +48,14 @@ export interface ComputerDepsOptions {
|
|
|
48
48
|
/** The server's environment: a provider key named here wins over its saved one; AGENTRUN_DOCKER_IMAGE names Docker's
|
|
49
49
|
* image. Passed in, never read here. */
|
|
50
50
|
readonly env: KeyEnv;
|
|
51
|
-
/** The store: its sealed keys (a provider's saved keys)
|
|
52
|
-
|
|
51
|
+
/** The store: its sealed keys (a provider's saved keys), its computer ledger (the phone provider's) and its paired
|
|
52
|
+
* computers (a test's stand-in may have none). */
|
|
53
|
+
readonly store: Pick<Store, "sealedKeys" | "computerLedger"> & {
|
|
54
|
+
readonly pairedComputers?: Pick<Store["pairedComputers"], "list">;
|
|
55
|
+
};
|
|
56
|
+
/** The server's AttachHub, where this runner shares the server's process (runner/beside.ts): a paired computer's
|
|
57
|
+
* socket is there. Absent: a runner of its own process, which refuses a paired computer in words. */
|
|
58
|
+
readonly hub?: AttachHub;
|
|
53
59
|
/** The server's seal key: absent, no saved key is opened (a key from the environment still is). */
|
|
54
60
|
readonly sealKey: Buffer | undefined;
|
|
55
61
|
/** The kind registry: the computer package's unless given (a test's fixture). */
|
|
@@ -66,34 +72,43 @@ export interface ComputerDepsOptions {
|
|
|
66
72
|
/** Whether a provider that binds a folder of this machine answers here now (Docker), for the Mode 1 default. */
|
|
67
73
|
readonly answers?: ComputerForClaimDeps["answers"];
|
|
68
74
|
/** This machine's Docker daemon, asked when a Docker launch fails (docker-daemon.ts dockerDaemonCheck over `env`
|
|
69
|
-
* unless given
|
|
75
|
+
* unless given). */
|
|
70
76
|
readonly daemon?: ComputerForClaimDeps["daemon"];
|
|
77
|
+
/** Why this machine cannot run a provider's computers, by its id (computers.ts hostCommandRefusals over this process's
|
|
78
|
+
* PATH): the claim refuses such a computer before it rents anything. Absent: not asked. */
|
|
79
|
+
readonly hostWhy?: Readonly<Record<string, string>>;
|
|
71
80
|
/** The live view's registration for a desktop or a phone (proxy-only): absent, no view is opened. */
|
|
72
81
|
readonly openComputerView?: OpenComputerView;
|
|
73
|
-
/** --faux's computers (faux-computers.ts),
|
|
74
|
-
* and factories. */
|
|
82
|
+
/** --faux's computers (faux-computers.ts), beside the computer package's: their providers in the kind registry, their
|
|
83
|
+
* keys and factories with the package's, and their launch for their own providers. */
|
|
75
84
|
readonly faux?: FauxComputers;
|
|
76
85
|
}
|
|
77
86
|
/** The spec a computer of `kind` on `entry` is made with, besides its labels and its mount: its image (a provider that
|
|
78
87
|
* prepares its own image, its descriptor's prepareImage: the owner's AGENTRUN_DOCKER_IMAGE when set, else for a sandbox
|
|
79
|
-
* the package's recipe, which its prepareImage() builds;
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
88
|
+
* the package's recipe, which its prepareImage() builds; a provider whose descriptor declares imageEnv (Daytona's
|
|
89
|
+
* AGENTRUN_DAYTONA_SNAPSHOT): that variable's value in `env` when set; any other provider's, and such a one's while it
|
|
90
|
+
* is unset: its descriptor's defaultImage for the kind, the computer package's
|
|
91
|
+
* PROVIDERS[].defaultImage; a kind with none refused in words, a prepared desktop's saying it needs an image with an X
|
|
92
|
+
* server, which the recipe lacks), the leak bound for its lifetime (its clean end is the run's release), and its
|
|
93
|
+
* network (networkOf): the run's box_allow, or this server's own (AGENTRUN_BOX_ALLOW, read from `env`) for a launch
|
|
94
|
+
* that names none; and the size of a computer on this machine's container engine (its descriptor's `local`),
|
|
95
|
+
* AGENTRUN_BOX_CPUS, _MEMORY and _PIDS (dockerLimitsOf, read once here): a vendor's computer sizes itself. No key and
|
|
96
|
+
* no environment. */
|
|
86
97
|
export declare function computerSpecOf(env: KeyEnv): ComputerForClaimDeps["spec"];
|
|
87
98
|
/** The run's timeline phase while its claim waits on its computer's image (computerForClaim's onImageWait): main's box
|
|
88
99
|
* image row, the computer's noun for the box's. */
|
|
89
100
|
export declare const imageWaitWords: (making: "build" | "pull", image: string) => string;
|
|
101
|
+
/** The run's timeline phase once its claim's computer is connected (computerForClaim's onConnected): what it says it
|
|
102
|
+
* is, in its hello's own facts, such as "The phone is ready: Android 15 (arm64), from Phone harness." */
|
|
103
|
+
export declare const computerReadyWords: ({ provider, kind, hello }: ComputerSaid) => string;
|
|
90
104
|
/** The claim's computer as the runner's specs call it: what the run's launch lets the computer reach (its box_allow),
|
|
91
105
|
* read from the launch row when the store has one and the claim does not say, then computerForClaim. */
|
|
92
106
|
export declare const claimComputer: (launch: ClaimLaunch, store: Parameters<typeof computerForClaim>[1] & {
|
|
93
107
|
readonly runs?: Pick<Store["runs"], "launch">;
|
|
94
108
|
}, deps: ComputerForClaimDeps) => Promise<ClaimComputer>;
|
|
95
|
-
/** The kind registry a claim composed with `options` resolves a setting against:
|
|
96
|
-
*
|
|
109
|
+
/** The kind registry a claim composed with `options` resolves a setting against: a test's own, else the computer
|
|
110
|
+
* package's; given faux, with --faux's providers beside them (so a --faux run takes the faux desktop, and a run on a
|
|
111
|
+
* provider a test loads still gets it). The one choice: computerDepsFrom makes it, and the server's start check
|
|
97
112
|
* (server.ts computerReady) asks it with what the runner composes with, so a run's start and its claim answer alike. */
|
|
98
113
|
export declare function claimKinds(options: Pick<ComputerDepsOptions, "faux" | "kinds">): KindRegistry;
|
|
99
114
|
/** computerForClaim and its process-wide deps, composed once; and Settings → Computers' factories from the same makers. */
|