@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/computers.d.ts
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
import { type GpuCapability } from "@parcha/agentrun-computer";
|
|
2
|
-
import { type KeyTable, type OptionsAnswer, type ProviderFactories, type ProviderSettings } from "./computer-keys.js";
|
|
1
|
+
import { type ComputerProvider, type GpuCapability } from "@parcha/agentrun-computer";
|
|
2
|
+
import { type KeyChoice, type KeyTable, type OptionsAnswer, type ProviderFactories, type ProviderSettings } from "./computer-keys.js";
|
|
3
3
|
import { type ComputerKind, type ComputerSetting } from "./computer-setting.js";
|
|
4
4
|
import { type DockerDaemon } from "./docker-daemon.js";
|
|
5
5
|
import { type KeyEnv, type KeyMeta } from "./key-meta.js";
|
|
6
|
-
import type { Store } from "./store/index.js";
|
|
6
|
+
import type { PairedComputerRow, Store } from "./store/index.js";
|
|
7
|
+
import type { PairedView } from "./computer-attach.js";
|
|
8
|
+
import { type ComputerSettingKind, type ShellPlace } from "./workspace/resolve-computer.js";
|
|
7
9
|
/** A setting kind as the kind registry's SETTING_KINDS gives it. */
|
|
8
10
|
export interface SettingKindSpec {
|
|
9
11
|
readonly machineKinds: readonly string[];
|
|
10
12
|
readonly required: readonly string[];
|
|
11
13
|
readonly optional: readonly string[];
|
|
12
14
|
}
|
|
13
|
-
/** A provider configuration's machine kind and groups, the GPUs it gives where it declares them,
|
|
14
|
-
* selects it by, where it names one, as the
|
|
15
|
+
/** A provider configuration's machine kind and groups, the GPUs it gives where it declares them, whether it keeps an
|
|
16
|
+
* agent's own computer between runs (persistence), and the image a setting selects it by, where it names one, as the
|
|
17
|
+
* kind registry gives them. */
|
|
15
18
|
export type KindCapabilities = {
|
|
16
19
|
readonly kind: string;
|
|
17
20
|
readonly groups: readonly string[];
|
|
18
21
|
readonly gpu?: GpuCapability;
|
|
22
|
+
readonly persistence?: unknown;
|
|
19
23
|
readonly image?: string;
|
|
24
|
+
readonly options?: Readonly<Record<string, unknown>>;
|
|
20
25
|
};
|
|
21
26
|
/** A provider as the kind registry's PROVIDERS gives it. */
|
|
22
27
|
export interface ProviderEntry {
|
|
@@ -26,6 +31,7 @@ export interface ProviderEntry {
|
|
|
26
31
|
readonly keys: readonly {
|
|
27
32
|
readonly name: string;
|
|
28
33
|
readonly required: boolean;
|
|
34
|
+
readonly picked?: boolean;
|
|
29
35
|
}[];
|
|
30
36
|
/** The mounts its computers take; none means it cannot mount the run's folder. */
|
|
31
37
|
readonly mounts: readonly string[];
|
|
@@ -36,7 +42,24 @@ export interface ProviderEntry {
|
|
|
36
42
|
readonly capabilities: readonly KindCapabilities[];
|
|
37
43
|
/** The image a computer of each kind starts from when its setting names none. */
|
|
38
44
|
readonly defaultImage?: Partial<Record<ComputerKind, string>>;
|
|
45
|
+
/** A program its computers need on this machine's PATH, what installs it, and the machines it is built for
|
|
46
|
+
* (`${platform}-${arch}`; absent, every one), as its descriptor declares it: the phone's adb. Absent: none. */
|
|
47
|
+
readonly hostCommand?: HostCommand;
|
|
39
48
|
}
|
|
49
|
+
/** A provider's host command, as the kind registry's entry names it. */
|
|
50
|
+
export type HostCommand = {
|
|
51
|
+
readonly command: string;
|
|
52
|
+
readonly from: string;
|
|
53
|
+
readonly builds?: readonly string[];
|
|
54
|
+
};
|
|
55
|
+
/** Why a provider whose host command is not on this machine's PATH cannot run here, in words that say how to fix it,
|
|
56
|
+
* as the server says Docker's (docker-daemon.ts). On a machine the command has no build for (adb on arm64 Linux: AgentRun's
|
|
57
|
+
* arm64 image has none either), they say which machine it needs, not how to install it. */
|
|
58
|
+
export declare function hostCommandWhy(label: string, { command, from, builds }: HostCommand, platform?: string, arch?: string): string;
|
|
59
|
+
/** Each provider whose host command is not on `path` (the server's PATH at its start), by its id, with hostCommandWhy's
|
|
60
|
+
* words: what Settings → Computers, a run's start and the claim say for it. A command is there when a folder of `path`
|
|
61
|
+
* holds an executable file of its name. */
|
|
62
|
+
export declare function hostCommandRefusals(providers: readonly Pick<ProviderEntry, "id" | "label" | "hostCommand">[], path: string | undefined, platform?: string, arch?: string): Readonly<Record<string, string>>;
|
|
40
63
|
/** The kind registry, by its own names: the computer package's module (SETTING_KINDS, PROVIDERS, servingRefusals). */
|
|
41
64
|
export interface KindRegistry {
|
|
42
65
|
readonly SETTING_KINDS: Readonly<Record<ComputerKind, SettingKindSpec>>;
|
|
@@ -57,32 +80,56 @@ export interface ComputerRoutesOptions {
|
|
|
57
80
|
readonly settings?: ProviderSettings;
|
|
58
81
|
/** The map from a provider's key names to its options: serve's own unless given (--faux gives its own). */
|
|
59
82
|
readonly keyTable?: KeyTable;
|
|
60
|
-
/** The model-visible tools a kind brings
|
|
83
|
+
/** The model-visible tools a kind brings, by name (server.ts kindTools). */
|
|
61
84
|
readonly tools: (kind: ComputerKind) => readonly string[];
|
|
62
|
-
/** This server's folder mode, or how to read it at each call (folderModeOf: the Archil settings row), so turning
|
|
85
|
+
/** This server's folder mode, or how to read it at each call (folderModeOf: the Archil settings, the environment's or the saved row), so turning
|
|
63
86
|
* Archil on or off takes effect without building the routes again. */
|
|
64
87
|
readonly mode: FolderMode | (() => FolderMode | Promise<FolderMode>);
|
|
88
|
+
/** Why this machine cannot run a provider's computers, by its id (hostCommandRefusals at the server's start): the
|
|
89
|
+
* provider is not ready, and a claim of it is refused, in these words. Absent: every provider can run here. */
|
|
90
|
+
readonly hostWhy?: Readonly<Record<string, string>>;
|
|
65
91
|
/** The server's environment: a variable named as a provider's key overrides the saved one (source "env"). */
|
|
66
92
|
readonly env?: KeyEnv;
|
|
67
93
|
/** Whether a provider that binds a folder of this machine (Docker) answers here now, or why not (the server's daemon
|
|
68
94
|
* check, docker-daemon.ts, which keeps its answer a while). Absent: taken as answering. */
|
|
69
95
|
readonly answers?: (provider: string) => Promise<DockerDaemon>;
|
|
96
|
+
/** The person's own computers paired with this server (computer-attach.ts): the store's rows and each one's view.
|
|
97
|
+
* Each is one more provider of its kind (attached-computers.ts pairedEntry), ready while it is attached. Absent:
|
|
98
|
+
* none. */
|
|
99
|
+
readonly paired?: {
|
|
100
|
+
rows(): Promise<readonly PairedComputerRow[]>;
|
|
101
|
+
viewOf(row: PairedComputerRow, serves: readonly ComputerSettingKind[]): PairedView;
|
|
102
|
+
};
|
|
70
103
|
}
|
|
71
104
|
/** A provider as Settings shows it: `metered` straight from the kind registry (its computers are billed by the vendor);
|
|
72
105
|
* its keys as SecretMeta under `secrets`, each named "computer:<provider>:<KEY>", and `required`, the names of the ones
|
|
73
106
|
* it needs. `network`: what this server's allow-list means for a vendor-hosted computer, in words (networkWords).
|
|
74
|
-
* `images`: the images it offers for the kind, by name, where it offers any to choose.
|
|
107
|
+
* `images`: the images it offers for the kind, by name, where it offers any to choose. `persistent`: present where an
|
|
108
|
+
* agent's computer of this kind can be kept between its runs (computer.persistent: true), with the images that keep one
|
|
109
|
+
* where it offers images to choose. `picked`: the names of the secrets a person picks from the vendor's own list
|
|
110
|
+
* (GET /v2/computers/{provider}/choices) rather than pastes, where it has any. */
|
|
75
111
|
export type ProviderView = {
|
|
76
112
|
id: string;
|
|
77
113
|
name: string;
|
|
78
114
|
metered: boolean;
|
|
79
115
|
secrets: KeyMeta[];
|
|
80
116
|
required: string[];
|
|
117
|
+
picked?: string[];
|
|
81
118
|
ready: boolean;
|
|
82
119
|
why?: string;
|
|
83
120
|
network?: string;
|
|
84
121
|
images?: string[];
|
|
122
|
+
persistent?: {
|
|
123
|
+
images?: string[];
|
|
124
|
+
};
|
|
85
125
|
gpu?: GpuView;
|
|
126
|
+
} & ShellChoice;
|
|
127
|
+
/** A choice's shell (workspace runShellOf, in this server's mode), the host tools it gives (the kernel registry's
|
|
128
|
+
* hostToolDefs for that shell) and what it leaves out in words (absent on a computer that mounts the folder). */
|
|
129
|
+
export type ShellChoice = {
|
|
130
|
+
shell: ShellPlace;
|
|
131
|
+
host_tools: string[];
|
|
132
|
+
shell_note?: string;
|
|
86
133
|
};
|
|
87
134
|
/** A sandbox provider's GPUs as Settings shows them: what its configuration declares (the types an agent's
|
|
88
135
|
* `computer.gpu.type` names, the most one computer gets, and the limits it states), and why a run here cannot have
|
|
@@ -96,10 +143,14 @@ export declare const NO_NETWORK_WORDS = "no network, so this server's allow-list
|
|
|
96
143
|
export declare const VENDOR_NETWORK_WORDS = "the vendor's own network; this server's allow-list doesn't apply";
|
|
97
144
|
/** A browser behind its own egress proxy (Local Chrome): every public host, unless the operator set a list. */
|
|
98
145
|
export declare const OPERATOR_LIST_WORDS = "open unless this server sets AGENTRUN_BOX_ALLOW; then only those hosts";
|
|
146
|
+
/** A computer that needs a network where this server's AGENTRUN_BOX_ALLOW is none: a run of it is refused at its start
|
|
147
|
+
* and at its claim (resolve-computer.ts noNetworkRefusal), so Settings says so and never offers it. */
|
|
148
|
+
export declare const NETWORK_REFUSED_WORDS = "needs a network, which this server refuses: its AGENTRUN_BOX_ALLOW is none";
|
|
99
149
|
/** What this server's allow-list means for a provider's computers, by the network forms it declares: words for one that
|
|
100
150
|
* makes "none" alone, "open" alone, or "open" and "allow" but no "none" (a browser behind its own proxy); none where
|
|
101
151
|
* the allow-list applies as it is (Docker), or nothing is declared. */
|
|
102
152
|
export declare function networkWords(network: readonly string[] | undefined): string | undefined;
|
|
153
|
+
/** A kind; kind none, the one "no computer" choice, carries its ShellChoice itself (it has no providers). */
|
|
103
154
|
export type KindView = {
|
|
104
155
|
kind: ComputerKind;
|
|
105
156
|
offered: boolean;
|
|
@@ -107,7 +158,7 @@ export type KindView = {
|
|
|
107
158
|
groups: string[];
|
|
108
159
|
tools: string[];
|
|
109
160
|
providers: ProviderView[];
|
|
110
|
-
}
|
|
161
|
+
} & Partial<ShellChoice>;
|
|
111
162
|
export type TestView = {
|
|
112
163
|
ok: true;
|
|
113
164
|
detail: string;
|
|
@@ -115,6 +166,17 @@ export type TestView = {
|
|
|
115
166
|
ok: false;
|
|
116
167
|
why: string;
|
|
117
168
|
};
|
|
169
|
+
/** A picked key's choices (GET /v2/computers/{provider}/choices): its KEY, as PUT …/keys takes it, then the values the
|
|
170
|
+
* vendor's list offers, each saved as it is and shown by its label, and `saved`, the one whose value is saved now, where
|
|
171
|
+
* one is (it is among the options already, so it says nothing new); or why there are none to pick, in words. */
|
|
172
|
+
export type KeyChoicesView = {
|
|
173
|
+
key: string;
|
|
174
|
+
options: KeyChoice[];
|
|
175
|
+
saved?: string;
|
|
176
|
+
} | {
|
|
177
|
+
key: string;
|
|
178
|
+
why: string;
|
|
179
|
+
};
|
|
118
180
|
/** Why a key save is refused, before anything is saved: a name the provider does not declare, or a value that is not text. */
|
|
119
181
|
export declare class KeysRefused extends Error {
|
|
120
182
|
readonly fields: {
|
|
@@ -141,20 +203,25 @@ export declare function modeRefusal(kind: ComputerKind, provider: ProviderEntry,
|
|
|
141
203
|
export declare function createComputerRoutes(options: ComputerRoutesOptions): {
|
|
142
204
|
view: () => Promise<{
|
|
143
205
|
kinds: KindView[];
|
|
206
|
+
paired: PairedView[];
|
|
144
207
|
}>;
|
|
145
208
|
saveKeys: (providerId: string, body: Readonly<Record<string, unknown>>) => Promise<ProviderView | undefined>;
|
|
146
209
|
test: (providerId: string, signal?: AbortSignal) => Promise<TestView | undefined>;
|
|
210
|
+
choices: (providerId: string, signal?: AbortSignal) => Promise<{
|
|
211
|
+
choices: KeyChoicesView[];
|
|
212
|
+
} | undefined>;
|
|
147
213
|
claimRefusal: (computer: ComputerSetting) => Promise<string | undefined>;
|
|
148
214
|
claimOptions: (computer: ComputerSetting) => Promise<OptionsAnswer | undefined>;
|
|
215
|
+
providerFor: (providerId: string, image: string | undefined) => Promise<Pick<ComputerProvider, "release">>;
|
|
149
216
|
};
|
|
150
217
|
export type ComputerRoutes = ReturnType<typeof createComputerRoutes>;
|
|
151
218
|
/** This server's folder mode, read from the store at each call: "disk" (Mode 2) while the Archil settings row is saved
|
|
152
219
|
* (PUT /v2/workspace/archil), else "local" (Mode 1). createComputerRoutes' `mode`. */
|
|
153
220
|
export declare const folderModeOf: (store: {
|
|
154
221
|
settings: Pick<Store["settings"], "get">;
|
|
155
|
-
}) => () => Promise<FolderMode>;
|
|
156
|
-
/** Settings → Computers' routes, by their operation names: GET /v2/computers, PUT /v2/computers/{provider}/keys
|
|
157
|
-
* /v2/computers/{provider}/test. */
|
|
222
|
+
}, env?: KeyEnv) => () => Promise<FolderMode>;
|
|
223
|
+
/** Settings → Computers' routes, by their operation names: GET /v2/computers, PUT /v2/computers/{provider}/keys, POST
|
|
224
|
+
* /v2/computers/{provider}/test and GET /v2/computers/{provider}/choices. */
|
|
158
225
|
export declare const COMPUTER_SETTINGS_ROUTES: ReadonlySet<string>;
|
|
159
226
|
/** One of Settings → Computers' routes at its handler, as serve's dispatch calls it: its answer (sent 200), or its refusal
|
|
160
227
|
* as an ApiError (sent with its status): an unknown provider is not_found; a key save's body that is not an object of
|
package/dist/computers.js
CHANGED
|
@@ -2,31 +2,73 @@
|
|
|
2
2
|
// value), saving a provider's keys sealed in the store, testing a provider's account, and the refusal a run meets at its
|
|
3
3
|
// claim when its agent's computer cannot be had here, with the options its provider is made with. createComputerRoutes
|
|
4
4
|
// takes the server's Store and the computer package's kind registry by its own names (SETTING_KINDS, PROVIDERS,
|
|
5
|
-
// servingRefusals); the tools each kind brings
|
|
5
|
+
// servingRefusals); the tools each kind brings are the server's to say (server.ts kindTools: a sandbox's shell tools from
|
|
6
|
+
// the kernel's hostToolDefs, a browser's from pi-browser, a desktop's or a phone's the kernel's COMPUTER_TOOLS). Keys go by
|
|
6
7
|
// their names only: a provider declares them, Settings takes only those, and the store keeps each sealed under the
|
|
7
8
|
// server's seal key (server-keys.ts); a provider is handed its keys only at the claim, or for its test, both through
|
|
8
9
|
// computer-keys.ts (providerOptions, testConnection), which maps a key's name onto the option it fills.
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
10
|
+
import { accessSync, constants, statSync } from "node:fs";
|
|
11
|
+
import { delimiter, join } from "node:path";
|
|
12
|
+
import { imagesOf } from "@parcha/agentrun-computer";
|
|
13
|
+
import { BOX_ALLOW_ENV, boxAllowOf } from "./box-settings.js";
|
|
14
|
+
import { KEY_TABLE, keyChoices, providerOptions, testConnection } from "./computer-keys.js";
|
|
11
15
|
import { COMPUTER_KINDS, gpuOf } from "./computer-setting.js";
|
|
12
16
|
import { inArchilMode } from "./archil-settings.js";
|
|
13
17
|
import { daemonUp, noDockerWords } from "./docker-daemon.js";
|
|
14
18
|
import { ApiError, invalid } from "./errors.js";
|
|
19
|
+
import { gpuRefused } from "./gpu-words.js";
|
|
15
20
|
import { redacted } from "./key-refusal.js";
|
|
16
21
|
import { keyMetaOf, envValue } from "./key-meta.js";
|
|
17
22
|
import { registerNotSecretWrite, registerSecretWrite, secretName } from "./secret-writes.js";
|
|
18
23
|
import { getSealedKey, putSealedKey, removeSealedKey, sealedKeyNames } from "./server-keys.js";
|
|
24
|
+
import { withPaired } from "./workspace/attached-computers.js";
|
|
25
|
+
import { needsNetwork, shellChoiceOf } from "./workspace/resolve-computer.js";
|
|
19
26
|
// Every request to a computer's keys is a secret write (secret-writes.ts), whatever its body (a value, a null, an empty
|
|
20
27
|
// body or none), as saveToolKey's is: the server's one dispatch check keeps it to the owner's session before any provider
|
|
21
28
|
// is looked up, so a token learns nothing of which providers exist. The view and the connection test write none.
|
|
22
29
|
registerSecretWrite("saveComputerKeys", () => true);
|
|
23
30
|
registerNotSecretWrite("testComputer", "A connection test reads the saved keys and writes none.");
|
|
31
|
+
const ARCH_NAMES = { x64: "x86-64", arm64: "arm64" };
|
|
32
|
+
const PLATFORM_NAMES = { linux: "Linux", darwin: "macOS", win32: "Windows" };
|
|
33
|
+
/** Why a provider whose host command is not on this machine's PATH cannot run here, in words that say how to fix it,
|
|
34
|
+
* as the server says Docker's (docker-daemon.ts). On a machine the command has no build for (adb on arm64 Linux: AgentRun's
|
|
35
|
+
* arm64 image has none either), they say which machine it needs, not how to install it. */
|
|
36
|
+
export function hostCommandWhy(label, { command, from, builds }, platform = process.platform, arch = process.arch) {
|
|
37
|
+
if (!builds || builds.includes(`${platform}-${arch}`))
|
|
38
|
+
return `${command} isn't installed on this server (no ${command} command on PATH): install ${from}, then restart AgentRun`;
|
|
39
|
+
const name = (one) => ARCH_NAMES[one] ?? one;
|
|
40
|
+
const others = builds.filter((one) => one.startsWith(`${platform}-`)).map((one) => name(one.slice(platform.length + 1)));
|
|
41
|
+
const needs = others.length ? `an ${others.join(" or ")} server` : `a server where ${from} runs (${builds.join(", ")})`;
|
|
42
|
+
return `this server's image has no ${command} for ${name(arch)} (${from} has no ${PLATFORM_NAMES[platform] ?? platform} build for ${name(arch)}): ${label} needs ${needs}`;
|
|
43
|
+
}
|
|
44
|
+
/** Each provider whose host command is not on `path` (the server's PATH at its start), by its id, with hostCommandWhy's
|
|
45
|
+
* words: what Settings → Computers, a run's start and the claim say for it. A command is there when a folder of `path`
|
|
46
|
+
* holds an executable file of its name. */
|
|
47
|
+
export function hostCommandRefusals(providers, path, platform = process.platform, arch = process.arch) {
|
|
48
|
+
// On Windows a program is its name with an executable extension (platform-tools installs adb.exe).
|
|
49
|
+
const named = (command) => (platform === "win32" ? [command, ...[".exe", ".cmd", ".bat"].map((extension) => `${command}${extension}`)] : [command]);
|
|
50
|
+
const found = (command) => (path ?? "").split(delimiter).some((folder) => folder !== "" && named(command).some((file) => {
|
|
51
|
+
try {
|
|
52
|
+
accessSync(join(folder, file), constants.X_OK);
|
|
53
|
+
return statSync(join(folder, file)).isFile();
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
return Object.fromEntries(providers.flatMap((provider) => (provider.hostCommand && !found(provider.hostCommand.command) ? [[provider.id, hostCommandWhy(provider.label, provider.hostCommand, platform, arch)]] : [])));
|
|
60
|
+
}
|
|
24
61
|
/** A computer with no network: its programs run in a network of their own, so a run's allow-list is never offered it. */
|
|
25
62
|
export const NO_NETWORK_WORDS = "no network, so this server's allow-list isn't offered";
|
|
26
63
|
/** A computer on the vendor's own network: open, which this server's allow-list doesn't reach. */
|
|
27
64
|
export const VENDOR_NETWORK_WORDS = "the vendor's own network; this server's allow-list doesn't apply";
|
|
28
65
|
/** A browser behind its own egress proxy (Local Chrome): every public host, unless the operator set a list. */
|
|
29
66
|
export const OPERATOR_LIST_WORDS = "open unless this server sets AGENTRUN_BOX_ALLOW; then only those hosts";
|
|
67
|
+
/** A computer that needs a network where this server's AGENTRUN_BOX_ALLOW is none: a run of it is refused at its start
|
|
68
|
+
* and at its claim (resolve-computer.ts noNetworkRefusal), so Settings says so and never offers it. */
|
|
69
|
+
export const NETWORK_REFUSED_WORDS = `needs a network, which this server refuses: its ${BOX_ALLOW_ENV} is none`;
|
|
70
|
+
/** Why a provider whose computers can't run with no network is not ready where this server has none. */
|
|
71
|
+
const noNetworkWhy = (provider) => `${provider.label} needs a network, and this server's ${BOX_ALLOW_ENV} is none (no network): pick a computer that runs with no network, or set ${BOX_ALLOW_ENV} to a host list`;
|
|
30
72
|
/** What this server's allow-list means for a provider's computers, by the network forms it declares: words for one that
|
|
31
73
|
* makes "none" alone, "open" alone, or "open" and "allow" but no "none" (a browser behind its own proxy); none where
|
|
32
74
|
* the allow-list applies as it is (Docker), or nothing is declared. */
|
|
@@ -68,21 +110,25 @@ export function modeRefusal(kind, provider, mode) {
|
|
|
68
110
|
const sandboxGpu = (kinds, provider) => provider.capabilities.find((one) => one.gpu !== undefined && kinds.servingRefusals(one, "sandbox").length === 0)?.gpu;
|
|
69
111
|
/** The mount a sandbox takes in `mode`: the run's folder, a bind of this machine or the owner's Archil disk. */
|
|
70
112
|
const folderMount = (mode) => ({ kind: mode === "local" ? "bind" : "archil" });
|
|
71
|
-
/** A sandbox provider's GPUs as Settings shows them, with why a run here cannot have them (
|
|
72
|
-
* smallest ask, one of its first type, with this mode's mount).
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
113
|
+
/** A sandbox provider's GPUs as Settings shows them, with why a run here cannot have them (gpuRefused's words for its
|
|
114
|
+
* smallest ask, one of its first type, with this mode's mount). Its reason for taking no mount is in `why`, not a
|
|
115
|
+
* field of its own. */
|
|
116
|
+
function gpuView(gpu, label, mode) {
|
|
117
|
+
const refused = gpu.types.length ? gpuRefused({ type: gpu.types[0], count: 1 }, gpu, folderMount(mode), label) : undefined;
|
|
118
|
+
const shown = structuredClone(gpu);
|
|
119
|
+
delete shown.unmounted;
|
|
120
|
+
return { ...shown, ...(refused ? { why: refused.words } : {}) };
|
|
76
121
|
}
|
|
77
|
-
/** Why `computer`'s GPUs cannot be had on `provider` in `mode`, in
|
|
78
|
-
* for none (only a sandbox does). */
|
|
122
|
+
/** Why `computer`'s GPUs cannot be had on `provider` in `mode`, in gpuRefused's words; undefined when they can, or it
|
|
123
|
+
* asks for none (only a sandbox does). */
|
|
79
124
|
function gpuRefusal(kinds, computer, provider, mode) {
|
|
80
125
|
const asked = gpuOf(computer);
|
|
81
126
|
if (!asked)
|
|
82
127
|
return undefined;
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
128
|
+
const refused = gpuRefused(asked, sandboxGpu(kinds, provider), folderMount(mode), provider.label);
|
|
129
|
+
if (!refused)
|
|
130
|
+
return undefined;
|
|
131
|
+
return refused.folder ? `${refused.words} (Settings → Computers)` : `${provider.label} can't give this agent's computer its GPUs: ${refused.words} (Settings → Computers)`;
|
|
86
132
|
}
|
|
87
133
|
/** The required keys `provider` has no saved value for, by name. */
|
|
88
134
|
const missingKeys = (provider, saved) => provider.keys.filter((key) => key.required && !saved.has(key.name)).map((key) => key.name);
|
|
@@ -94,8 +140,9 @@ const local = (provider) => provider.mounts.includes("bind");
|
|
|
94
140
|
/** The routes' work over the server's store: GET /v2/computers (view), PUT /v2/computers/{provider}/keys (saveKeys), POST
|
|
95
141
|
* /v2/computers/{provider}/test (test), and the claim's refusal (claimRefusal). */
|
|
96
142
|
export function createComputerRoutes(options) {
|
|
97
|
-
const { store, sealKey, kinds, factories, settings = {}, keyTable = KEY_TABLE, tools, env = {}, answers = daemonUp } = options;
|
|
143
|
+
const { store, sealKey, kinds, factories, settings = {}, keyTable = KEY_TABLE, tools, env = {}, answers = daemonUp, hostWhy = {} } = options;
|
|
98
144
|
const providerOf = (id) => kinds.PROVIDERS.find((one) => one.id === id);
|
|
145
|
+
const hostOf = (provider) => (Object.hasOwn(hostWhy, provider.id) ? hostWhy[provider.id] : undefined);
|
|
99
146
|
const modeNow = async () => (typeof options.mode === "function" ? options.mode() : options.mode);
|
|
100
147
|
/** Why a computer of `kind` on `provider` can't be had for its daemon (a provider that binds a folder of this machine,
|
|
101
148
|
* `said` its answer, in folder `mode`): none answering is the one wording (docker-daemon.ts noDockerWords); else its
|
|
@@ -105,11 +152,21 @@ export function createComputerRoutes(options) {
|
|
|
105
152
|
* that serves it, with its keys (saved or not, never a value) and whether a run could have it now. */
|
|
106
153
|
async function view() {
|
|
107
154
|
const mode = await modeNow();
|
|
155
|
+
// The paired computers, each one more provider of its kind; one not attached now is not ready, saying so.
|
|
156
|
+
const rows = options.paired ? await options.paired.rows() : [];
|
|
157
|
+
const kinds = withPaired(options.kinds, rows);
|
|
158
|
+
const paired = rows.map((row) => options.paired.viewOf(row, kinds.PROVIDERS.find((provider) => provider.id === row.id)?.kinds ?? []));
|
|
159
|
+
const offline = new Map(rows.flatMap((row, at) => (paired[at].online ? [] : [[row.id, `${row.name} is not attached now: open its driver on that computer, which dials this server`]])));
|
|
160
|
+
const choice = (setting) => shellChoiceOf(setting, mode === "disk" ? 2 : 1, kinds);
|
|
108
161
|
// Every provider's keys in one read: each a SecretMeta named for its provider, set by the environment or the store row
|
|
109
162
|
// of its key's name.
|
|
110
163
|
const slots = kinds.PROVIDERS.flatMap((provider) => provider.keys.map((key) => ({ secret: secretName("computer", provider.id, key.name), env: key.name, row: key.name })));
|
|
111
164
|
const metas = new Map((await keyMetaOf(store, slots, env)).map((meta) => [meta.name, meta]));
|
|
112
165
|
const saved = new Set(slots.filter((slot) => metas.get(slot.secret).set).map((slot) => slot.env));
|
|
166
|
+
// Under this server's AGENTRUN_BOX_ALLOW none, a computer that needs a network is refused at a
|
|
167
|
+
// run's start and its claim (resolve-computer.ts noNetworkRefusal), so it is never ready here, whatever its keys.
|
|
168
|
+
const refusedOpen = (provider) => boxAllowOf(env) === "none" && needsNetwork(provider.network);
|
|
169
|
+
const unusable = (kind, provider) => modeRefusal(kind, provider, mode) ?? (refusedOpen(provider) ? noNetworkWhy(provider) : undefined);
|
|
113
170
|
// Each provider that binds a folder of this machine asked once for the view: its daemon answers, or why not.
|
|
114
171
|
const daemons = new Map(await Promise.all(kinds.PROVIDERS.filter(local).map(async (provider) => [provider.id, await answers(provider.id)])));
|
|
115
172
|
return {
|
|
@@ -119,18 +176,27 @@ export function createComputerRoutes(options) {
|
|
|
119
176
|
const providers = serving.map((provider) => {
|
|
120
177
|
const missing = missingKeys(provider, saved);
|
|
121
178
|
const daemon = daemons.get(provider.id);
|
|
122
|
-
const why =
|
|
179
|
+
const why = offline.get(provider.id) ?? unusable(kind, provider) ?? (daemon ? daemonWhy(kind, daemon, mode) : undefined) ?? hostOf(provider) ?? (missing.length ? keysWhy(provider, missing) : undefined);
|
|
123
180
|
// The images an agent's computer.image may name for this kind: those of its configurations that serve it.
|
|
124
|
-
const
|
|
125
|
-
const
|
|
181
|
+
const serving = provider.capabilities.filter((one) => kinds.servingRefusals(one, kind).length === 0);
|
|
182
|
+
const images = imagesOf(serving, provider.defaultImage?.[kind]);
|
|
183
|
+
const network = refusedOpen(provider) ? NETWORK_REFUSED_WORDS : networkWords(provider.network);
|
|
126
184
|
// A sandbox's GPUs: only a sandbox takes them (computer-setting.ts computerIssues).
|
|
127
185
|
const gpu = kind === "sandbox" ? sandboxGpu(kinds, provider) : undefined;
|
|
128
|
-
|
|
186
|
+
// The configurations of this kind that keep an agent's own computer (computer-setting.ts persistenceIssues).
|
|
187
|
+
const keeping = serving.filter((one) => one.persistence !== undefined);
|
|
188
|
+
const keptImages = images.filter((image) => keeping.some((one) => (one.image ?? provider.defaultImage?.[kind]) === image));
|
|
189
|
+
const persistent = keeping.length === 0 ? undefined : images.length > 0 ? { images: keptImages } : {};
|
|
190
|
+
const picked = provider.keys.filter((key) => key.picked).map((key) => secretName("computer", provider.id, key.name));
|
|
191
|
+
return { id: provider.id, name: provider.label, metered: provider.metered, secrets: provider.keys.map((key) => metas.get(secretName("computer", provider.id, key.name))), required: provider.keys.filter((key) => key.required).map((key) => secretName("computer", provider.id, key.name)), ...(picked.length > 0 ? { picked } : {}), ready: why === undefined, ...(why ? { why } : {}), ...(network ? { network } : {}), ...(images.length > 0 ? { images } : {}), ...(persistent ? { persistent } : {}), ...(gpu ? { gpu: gpuView(gpu, provider.label, mode) } : {}), ...choice({ kind, provider: provider.id }) };
|
|
129
192
|
});
|
|
130
|
-
const offered = kind === "none" || serving.some((provider) =>
|
|
131
|
-
const why = offered ? undefined
|
|
132
|
-
|
|
193
|
+
const offered = kind === "none" || serving.some((provider) => unusable(kind, provider) === undefined);
|
|
194
|
+
const why = offered ? undefined
|
|
195
|
+
: serving.length && serving.every(refusedOpen) ? `every provider of a ${kind} computer needs a network, and this server's ${BOX_ALLOW_ENV} is none (no network)`
|
|
196
|
+
: serving.length ? `no provider of a ${kind} computer can reach this server's run folders` : `no provider serves a ${kind} computer`;
|
|
197
|
+
return { kind, offered, ...(why ? { why } : {}), groups: [...spec.required, ...spec.optional], tools: [...tools(kind)], providers, ...(kind === "none" ? choice({ kind: "none" }) : {}) };
|
|
133
198
|
}),
|
|
199
|
+
paired,
|
|
134
200
|
};
|
|
135
201
|
}
|
|
136
202
|
/** Saves `body`'s keys for a provider, each sealed in the store under its declared name; null removes one. Only names
|
|
@@ -180,10 +246,38 @@ export function createComputerRoutes(options) {
|
|
|
180
246
|
const cut = (text) => redacted(text, Object.values(keys));
|
|
181
247
|
return answer.ok ? { ok: true, detail: cut(answer.value.detail) } : { ok: false, why: cut(answer.error.message) };
|
|
182
248
|
}
|
|
249
|
+
/** Each picked key of a provider (Orgo's workspace) with the values the vendor's list offers for it, read with its
|
|
250
|
+
* saved keys (computer-keys.ts keyChoices), never making a computer; or why there are none, in words (a required key
|
|
251
|
+
* not saved, an account with none). Its words pass the redactor as the test's do. Undefined for a provider this server
|
|
252
|
+
* does not have. */
|
|
253
|
+
async function choices(providerId, signal) {
|
|
254
|
+
const provider = providerOf(providerId);
|
|
255
|
+
if (!provider)
|
|
256
|
+
return undefined;
|
|
257
|
+
const keys = await keysOf(provider);
|
|
258
|
+
const missing = missingKeys(provider, new Set(Object.keys(keys)));
|
|
259
|
+
const cut = (text) => redacted(text, Object.values(keys));
|
|
260
|
+
const views = [];
|
|
261
|
+
for (const key of provider.keys.filter((one) => one.picked)) {
|
|
262
|
+
if (missing.length) {
|
|
263
|
+
views.push({ key: key.name, why: keysWhy(provider, missing) });
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
const answer = await keyChoices(providerId, key.name, { keys, ...(signal ? { signal } : {}) }, factories, settings, keyTable);
|
|
267
|
+
if (!answer.ok) {
|
|
268
|
+
views.push({ key: key.name, why: cut(answer.error.message) });
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
const saved = answer.value.find((one) => one.value === keys[key.name])?.value;
|
|
272
|
+
views.push({ key: key.name, options: answer.value.map((one) => ({ value: one.value, label: cut(one.label) })), ...(saved === undefined ? {} : { saved }) });
|
|
273
|
+
}
|
|
274
|
+
return { choices: views };
|
|
275
|
+
}
|
|
183
276
|
/** Why a run of an agent whose computer is `computer` cannot have it here, in words naming the setting to fill;
|
|
184
277
|
* undefined when it can. Checked at the claim: the provider must serve the kind (servingRefusals' words), fit this
|
|
185
278
|
* server's folder mode, give a sandbox the GPUs it asks for (checkGpu's words), have its daemon answer where it binds
|
|
186
|
-
* a folder of this machine (Docker),
|
|
279
|
+
* a folder of this machine (Docker), find what it runs on this machine (hostWhy's words), and have every required key
|
|
280
|
+
* saved; a key refusal names the route that saves them. */
|
|
187
281
|
async function claimRefusal(computer) {
|
|
188
282
|
if (computer.kind === "none")
|
|
189
283
|
return undefined;
|
|
@@ -195,7 +289,7 @@ export function createComputerRoutes(options) {
|
|
|
195
289
|
return `${provider.label} does not serve a ${computer.kind} computer${words.length ? ` (${words.join("; ")})` : ""}: set this agent's computer to one it serves (Settings → Computers)`;
|
|
196
290
|
}
|
|
197
291
|
const mode = await modeNow();
|
|
198
|
-
const refused = modeRefusal(computer.kind, provider, mode) ?? gpuRefusal(kinds, computer, provider, mode) ?? (local(provider) ? daemonWhy(computer.kind, await answers(provider.id), mode) : undefined);
|
|
292
|
+
const refused = modeRefusal(computer.kind, provider, mode) ?? gpuRefusal(kinds, computer, provider, mode) ?? (local(provider) ? daemonWhy(computer.kind, await answers(provider.id), mode) : undefined) ?? hostOf(provider);
|
|
199
293
|
if (refused)
|
|
200
294
|
return refused;
|
|
201
295
|
const missing = missingKeys(provider, new Set([...(await sealedKeyNames(store)), ...provider.keys.filter((key) => envValue(env, key.name) !== undefined).map((key) => key.name)]));
|
|
@@ -212,14 +306,33 @@ export function createComputerRoutes(options) {
|
|
|
212
306
|
return { ok: false, error: { code: COMPUTER_UNAVAILABLE, message: why } };
|
|
213
307
|
return providerOptions(computer.provider, await keysOf(providerOf(computer.provider)), settings, keyTable);
|
|
214
308
|
}
|
|
215
|
-
|
|
309
|
+
/** The provider an agent's own computer lives on (workspace/agent-computer.ts reconcileAgentComputer deletes it
|
|
310
|
+
* through it): made from its saved keys and the server's settings, with the create() options of the configuration
|
|
311
|
+
* `image` selects, and the store's ledger (the factories'). Throws, in words, when it cannot be made here. */
|
|
312
|
+
async function providerFor(providerId, image) {
|
|
313
|
+
const entry = providerOf(providerId);
|
|
314
|
+
if (!entry)
|
|
315
|
+
throw new Error(`this server has no computer provider ${JSON.stringify(providerId)}`);
|
|
316
|
+
const options = providerOptions(providerId, await keysOf(entry), settings, keyTable);
|
|
317
|
+
if (!options.ok)
|
|
318
|
+
throw new Error(options.error.message);
|
|
319
|
+
const make = Object.hasOwn(factories, providerId) ? factories[providerId] : undefined;
|
|
320
|
+
if (typeof make !== "function")
|
|
321
|
+
throw new Error(`this server cannot make a ${entry.label} provider`);
|
|
322
|
+
const configuration = image === undefined ? undefined : entry.capabilities.find((one) => one.image === image);
|
|
323
|
+
const made = (await make({ ...options.options, ...(configuration?.options ?? {}) }));
|
|
324
|
+
if (typeof made.release !== "function")
|
|
325
|
+
throw new Error(`this server's ${entry.label} provider cannot release a computer`);
|
|
326
|
+
return made;
|
|
327
|
+
}
|
|
328
|
+
return { view, saveKeys, test, choices, claimRefusal, claimOptions, providerFor };
|
|
216
329
|
}
|
|
217
330
|
/** This server's folder mode, read from the store at each call: "disk" (Mode 2) while the Archil settings row is saved
|
|
218
331
|
* (PUT /v2/workspace/archil), else "local" (Mode 1). createComputerRoutes' `mode`. */
|
|
219
|
-
export const folderModeOf = (store) => async () => ((await inArchilMode(store)) ? "disk" : "local");
|
|
220
|
-
/** Settings → Computers' routes, by their operation names: GET /v2/computers, PUT /v2/computers/{provider}/keys
|
|
221
|
-
* /v2/computers/{provider}/test. */
|
|
222
|
-
export const COMPUTER_SETTINGS_ROUTES = new Set(["listComputers", "saveComputerKeys", "testComputer"]);
|
|
332
|
+
export const folderModeOf = (store, env = {}) => async () => ((await inArchilMode(store, env)) ? "disk" : "local");
|
|
333
|
+
/** Settings → Computers' routes, by their operation names: GET /v2/computers, PUT /v2/computers/{provider}/keys, POST
|
|
334
|
+
* /v2/computers/{provider}/test and GET /v2/computers/{provider}/choices. */
|
|
335
|
+
export const COMPUTER_SETTINGS_ROUTES = new Set(["listComputers", "saveComputerKeys", "testComputer", "listComputerChoices"]);
|
|
223
336
|
const noProvider = (id) => new ApiError("not_found", `this server has no computer provider ${JSON.stringify(id ?? "")}: GET /v2/computers lists them`);
|
|
224
337
|
/** One of Settings → Computers' routes at its handler, as serve's dispatch calls it: its answer (sent 200), or its refusal
|
|
225
338
|
* as an ApiError (sent with its status): an unknown provider is not_found; a key save's body that is not an object of
|
|
@@ -250,6 +363,12 @@ export async function settingsComputerRoute(routes, name, request) {
|
|
|
250
363
|
throw noProvider(request.provider);
|
|
251
364
|
return answer;
|
|
252
365
|
}
|
|
366
|
+
if (name === "listComputerChoices") {
|
|
367
|
+
const answer = await routes.choices(request.provider ?? "", request.signal);
|
|
368
|
+
if (answer === undefined)
|
|
369
|
+
throw noProvider(request.provider);
|
|
370
|
+
return answer;
|
|
371
|
+
}
|
|
253
372
|
throw new ApiError("not_found", `no computer route ${name}`);
|
|
254
373
|
}
|
|
255
374
|
/** capabilities.computers: the kinds this server offers now, in the registry's order. */
|