@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
|
@@ -1,7 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
// The run's computer at its claim, the one call both runner specs make (the adapter loop's and the CLI's): the agent's
|
|
2
|
+
// computer setting, resolved in the server's mode against the computer module's kind registry (resolveComputer), started
|
|
3
|
+
// for this run under this claim (labels agentrun.run and agentrun.epoch, the run's folder mounted only where the provider
|
|
4
|
+
// mounts it), with a hold and its live view when it is a desktop or a phone, and released once at the run's end. The hold
|
|
5
|
+
// goes back to the spec (`held`), whose adapter loop journals it and applies the owner's take-over and hand-back rows to it
|
|
6
|
+
// (runner/computer-journal.ts); the live view (computer-live.ts openClaimView) drives the same hold. A computer that cannot
|
|
7
|
+
// be had is refused in words with code computer_unavailable; kind none, or no setting where the server's default is none,
|
|
8
|
+
// is no computer.
|
|
9
|
+
//
|
|
10
|
+
// A provider is made with its keys (the server's environment's, else the store's sealed keys, through the composer's
|
|
11
|
+
// keyOf: computer-deps.ts), by the names the registry declares, through serve's own
|
|
12
|
+
// map of key names to options (computer-keys.ts providerOptions); a provider that keeps sessions with no labels of their
|
|
13
|
+
// own (the phone's) is given the store's computer ledger. Nothing here knows a vendor: the registry, the providers' create
|
|
14
|
+
// and a test's stand-ins are passed in.
|
|
15
|
+
//
|
|
16
|
+
// A paired computer (a person's own, attached-computers.ts) is one more provider of the registry for the claim, by its
|
|
17
|
+
// id: claimed through the hub of the server's process (the computer package's attachedProvider), released by ending the
|
|
18
|
+
// run's hold, never made or deleted.
|
|
19
|
+
//
|
|
20
|
+
// A persistent setting (the agent's own computer, agent-computer.ts) is made once under the agent's owner (this server's
|
|
21
|
+
// id and the agent's), found again by its owner at each later claim and attached under the new claim, and detached, not
|
|
22
|
+
// deleted, at the run's end. A run that finds it held by another run still going is refused, naming that run.
|
|
23
|
+
import { randomUUID } from "node:crypto";
|
|
24
|
+
import { isBrowserProvider, ownerFilter, releaseOlder, RUN_LABEL, runLabels } from "@parcha/agentrun-computer";
|
|
2
25
|
import { computerOfPlace } from "../computer-setting.js";
|
|
3
26
|
import { KEY_TABLE, providerOptions } from "../computer-keys.js";
|
|
4
27
|
import { getSealedKey } from "../server-keys.js";
|
|
28
|
+
import { agentComputerOf, forgetAgentComputer, holdAgentComputer, keepAgentComputer, liveHolderOf, reconcileAgentComputer, serverIdOf } from "./agent-computer.js";
|
|
29
|
+
import { pairedProvider, withPaired } from "./attached-computers.js";
|
|
5
30
|
import { computerHold, heldHands } from "./computer-hold.js";
|
|
6
31
|
import { storeLedger } from "./computer-ledger.js";
|
|
7
32
|
import { providerKeys, resolveComputer } from "./resolve-computer.js";
|
|
@@ -11,6 +36,8 @@ const unavailable = (words) => Object.assign(new Error(words), { code: "computer
|
|
|
11
36
|
const claimLost = (words) => Object.assign(new Error(words), { code: "claim_lost" });
|
|
12
37
|
const noop = async () => { };
|
|
13
38
|
/** The agent's computer setting: the launch's, else its revision's (computer, else place), else the launch's place. */
|
|
39
|
+
/** A claim's create request: the run and its claim epoch, so a retry of the claim's create finds the computer it made. */
|
|
40
|
+
const claimRequestId = (claim) => `${claim.runId}#${claim.epoch}`;
|
|
14
41
|
async function settingOf(launch, store) {
|
|
15
42
|
if (launch.computer)
|
|
16
43
|
return launch.computer;
|
|
@@ -42,7 +69,8 @@ async function readyImage(entry, provider, signal, onWait) {
|
|
|
42
69
|
throw new Error(ready.error.message);
|
|
43
70
|
return ready.value;
|
|
44
71
|
}
|
|
45
|
-
|
|
72
|
+
/** The provider's watch of a computer's screen on `ref` (ComputerProvider.watch), where it has one. */
|
|
73
|
+
const watchOf = (provider, ref) => typeof provider.watch === "function" ? (handlers, options) => provider.watch(ref, handlers, options) : undefined;
|
|
46
74
|
/** The browser computer `ref`'s CDP URL now: the provider's connect (its signed URL), its words and code when the session
|
|
47
75
|
* has ended. The connection itself is let go once read. */
|
|
48
76
|
async function cdpUrlOf(provider, ref) {
|
|
@@ -62,13 +90,19 @@ const labelValue = (value) => value.replace(/[^A-Za-z0-9_.:-]+/g, "_").slice(0,
|
|
|
62
90
|
/** A provider failure as an error with the provider's words and code. */
|
|
63
91
|
const failed = (error) => Object.assign(new Error(error.message), { code: error.code });
|
|
64
92
|
/** A browser computer's provider as the run's browser tool opens its sessions through it (ClaimBrowser): nothing is made
|
|
65
|
-
* at the claim. A session's computer is made at the tool's call, under the run's labels (`spec`'s) and the tool's tag
|
|
66
|
-
*
|
|
67
|
-
|
|
93
|
+
* at the claim. A session's computer is made at the tool's call, under the run's labels (`spec`'s) and the tool's tag,
|
|
94
|
+
* with the session's own options (spec.browser) where the provider declares them (capabilities().browser); its release
|
|
95
|
+
* lets go of every one the tool left open. The claim's browser (the agent's computer) and the tool plane's vendor's
|
|
96
|
+
* (browser-computer.ts planeBrowser) are each one of these. */
|
|
97
|
+
export function claimBrowser(provider, spec) {
|
|
68
98
|
// A run's browser: the claim's spec always carries its lifetime (computerSpecOf); an agent's computer (owner) has none.
|
|
69
99
|
const lifetime = spec.lifetimeMs;
|
|
70
100
|
if (lifetime === undefined)
|
|
71
101
|
throw new TypeError("a run's browser needs lifetimeMs: the claim's spec carries none");
|
|
102
|
+
// A provider of kind browser that declares no session features is opened as one that ends its sessions on a wall clock
|
|
103
|
+
// and takes no option but a viewport.
|
|
104
|
+
const features = provider.capabilities().browser ?? { timeout: "wall-clock" };
|
|
105
|
+
const kept = isBrowserProvider(provider) ? provider.downloads : undefined;
|
|
72
106
|
const open = new Set();
|
|
73
107
|
const release = async (id) => {
|
|
74
108
|
const released = await provider.release({ id, name: id }, "delete");
|
|
@@ -76,13 +110,21 @@ function claimBrowser(provider, spec) {
|
|
|
76
110
|
throw failed(released.error);
|
|
77
111
|
open.delete(id);
|
|
78
112
|
};
|
|
113
|
+
const valueOf = async (result) => {
|
|
114
|
+
const answered = await result;
|
|
115
|
+
if (!answered.ok)
|
|
116
|
+
throw failed(answered.error);
|
|
117
|
+
return answered.value;
|
|
118
|
+
};
|
|
79
119
|
return {
|
|
80
120
|
browser: {
|
|
81
121
|
provider: provider.id,
|
|
82
122
|
maxLifetimeS: Math.floor(lifetime / 1000),
|
|
83
|
-
|
|
123
|
+
features: structuredClone(features),
|
|
124
|
+
async open(tag, lifetimeS, browser, signal) {
|
|
84
125
|
const lifetimeMs = Math.min(lifetime, Math.max(1, Math.round(lifetimeS)) * 1000);
|
|
85
|
-
|
|
126
|
+
// Each open is its own request: a session closed and opened again under one tag is a new one.
|
|
127
|
+
const created = await provider.create({ ...spec, lifetimeMs, labels: { ...spec.labels, [SESSION_TAG]: labelValue(tag) }, ...(browser ? { browser } : {}) }, { requestId: randomUUID(), ...(signal ? { signal } : {}) });
|
|
86
128
|
if (!created.ok)
|
|
87
129
|
throw failed(created.error);
|
|
88
130
|
open.add(created.value.id);
|
|
@@ -94,8 +136,24 @@ function claimBrowser(provider, spec) {
|
|
|
94
136
|
throw failed(listed.error);
|
|
95
137
|
return listed.value.map((one) => one.ref.id);
|
|
96
138
|
},
|
|
139
|
+
async running(id, signal) {
|
|
140
|
+
const found = await provider.attach({ id }, signal ? { signal } : {});
|
|
141
|
+
if (found.ok)
|
|
142
|
+
return true;
|
|
143
|
+
if (found.error.code === "not_found" || found.error.code === "gone")
|
|
144
|
+
return false;
|
|
145
|
+
throw failed(found.error);
|
|
146
|
+
},
|
|
97
147
|
url: (id) => cdpUrlOf(provider, { id, name: id }),
|
|
98
148
|
close: release,
|
|
149
|
+
...(kept && features.downloads
|
|
150
|
+
? {
|
|
151
|
+
downloads: {
|
|
152
|
+
list: (id) => valueOf(kept.list({ id, name: id })),
|
|
153
|
+
read: (id, name, maxBytes) => valueOf(kept.read({ id, name: id }, name, maxBytes)),
|
|
154
|
+
},
|
|
155
|
+
}
|
|
156
|
+
: {}),
|
|
99
157
|
},
|
|
100
158
|
async release() {
|
|
101
159
|
for (const id of [...open])
|
|
@@ -110,7 +168,8 @@ async function providerLaunch(provider, claim, spec, signal) {
|
|
|
110
168
|
const older = await releaseOlder(provider, claim.runId, claim.epoch, signal ? { signal } : {});
|
|
111
169
|
if (!older.ok)
|
|
112
170
|
throw new Error(older.error.message);
|
|
113
|
-
|
|
171
|
+
// The claim is the request: a retry of this launch under the same epoch gets the computer it made, never a second.
|
|
172
|
+
const created = await provider.create(spec, { requestId: claimRequestId(claim), ...(signal ? { signal } : {}) });
|
|
114
173
|
if (!created.ok)
|
|
115
174
|
throw new Error(created.error.message);
|
|
116
175
|
const ref = { id: created.value.id, name: created.value.name };
|
|
@@ -125,11 +184,13 @@ async function providerLaunch(provider, claim, spec, signal) {
|
|
|
125
184
|
throw new Error(connected.error.message);
|
|
126
185
|
}
|
|
127
186
|
const { client, hello } = connected.value;
|
|
187
|
+
const watch = watchOf(provider, ref);
|
|
128
188
|
return {
|
|
129
189
|
id: ref.id,
|
|
130
190
|
groups: hello.groups,
|
|
131
191
|
// What the machine says it is (a phone's android or ios): its live view's input platform.
|
|
132
192
|
machine: hello.kind,
|
|
193
|
+
hello,
|
|
133
194
|
client,
|
|
134
195
|
async readBack() {
|
|
135
196
|
const attached = await provider.attach({ id: ref.id });
|
|
@@ -138,42 +199,197 @@ async function providerLaunch(provider, claim, spec, signal) {
|
|
|
138
199
|
return attached.value.spec.mount ? { ok: true, value: attached.value.spec.mount } : { ok: false, error: { code: "not_found", message: "nothing is mounted in this computer" } };
|
|
139
200
|
},
|
|
140
201
|
// The provider's watch of the screen (provider.watch), which feeds the run's proxied live view.
|
|
141
|
-
...(
|
|
202
|
+
...(watch ? { watch } : {}),
|
|
142
203
|
async release() {
|
|
143
204
|
await connected.value.close().catch(() => undefined);
|
|
144
205
|
await release();
|
|
145
206
|
},
|
|
146
207
|
};
|
|
147
208
|
}
|
|
209
|
+
/** A run state in which the run still holds what it claimed. */
|
|
210
|
+
const LIVE_RUN = new Set(["queued", "running", "parked"]);
|
|
211
|
+
/**
|
|
212
|
+
* The agent's own computer for this claim (a persistent setting): the one its owner's listing finds, attached under this
|
|
213
|
+
* claim, else one made with `spec` (its owner, no lifetime). The record this server keeps names it, held by this run. A
|
|
214
|
+
* computer whose listing names another run that is still going is refused in words naming that run; one a run that ended
|
|
215
|
+
* left running is taken over. Its release detaches it (Orgo's suspend, say), keeping its state for the agent's next run;
|
|
216
|
+
* then the agent's record is reconciled, so an agent that was archived or turned persistent off while the run went has
|
|
217
|
+
* its computer deleted.
|
|
218
|
+
*/
|
|
219
|
+
async function ownedLaunch(provider, claim, spec, context, signal) {
|
|
220
|
+
const { store, agentId } = context;
|
|
221
|
+
// One run at a time, taken in the store before anything is listed or made (agent-computer.ts holdAgentComputer): two
|
|
222
|
+
// runs of the agent that claim at once never both make a computer. With no run rows to read, a holder is still going.
|
|
223
|
+
// The hold is this claim's (its epoch): a later claim of the run takes it over, and this one's end then does nothing.
|
|
224
|
+
const hold = await holdAgentComputer(store, agentId, claim.runId, liveHolderOf(store), { epoch: claim.epoch });
|
|
225
|
+
let launched;
|
|
226
|
+
try {
|
|
227
|
+
launched = await ownedStart(provider, claim, spec, context, hold, signal);
|
|
228
|
+
}
|
|
229
|
+
catch (error) {
|
|
230
|
+
await hold.letGo().catch(() => undefined);
|
|
231
|
+
throw error;
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
...launched,
|
|
235
|
+
async release() {
|
|
236
|
+
try {
|
|
237
|
+
await launched.release();
|
|
238
|
+
}
|
|
239
|
+
finally {
|
|
240
|
+
await hold.letGo();
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
/** The owned launch once the run holds the agent's computer (ownedLaunch): found and attached, or made; connected. */
|
|
246
|
+
async function ownedStart(provider, claim, spec, context, hold, signal) {
|
|
247
|
+
const call = signal ? { signal } : {};
|
|
248
|
+
const { store, agentId, note } = context;
|
|
249
|
+
const older = await releaseOlder(provider, claim.runId, claim.epoch, call);
|
|
250
|
+
if (!older.ok)
|
|
251
|
+
throw new Error(older.error.message);
|
|
252
|
+
const listed = await provider.list(ownerFilter(context.owner), call);
|
|
253
|
+
if (!listed.ok)
|
|
254
|
+
throw new Error(listed.error.message);
|
|
255
|
+
const record = await agentComputerOf(store, agentId);
|
|
256
|
+
const found = listed.value.find((info) => info.ref.id === record?.id) ?? listed.value[0];
|
|
257
|
+
let ref;
|
|
258
|
+
/** Whether this claim made the computer, or attached the one the agent had. */
|
|
259
|
+
let made;
|
|
260
|
+
if (found) {
|
|
261
|
+
const holder = found.labels[RUN_LABEL];
|
|
262
|
+
if (found.state === "running" && holder !== undefined && holder !== claim.runId) {
|
|
263
|
+
const row = store.runs ? await store.runs.get(holder) : undefined;
|
|
264
|
+
// With no run rows to read, a holder is taken as still going: never two runs on one agent's computer.
|
|
265
|
+
if (!store.runs || (row !== undefined && LIVE_RUN.has(row.state))) {
|
|
266
|
+
throw new Error(`this agent's computer ${found.ref.name} is held by run ${holder}, which is still ${row?.state ?? "going"}: an agent's own computer serves one run at a time. Start this run again once that one ends`);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const attached = await provider.attach({ id: found.ref.id }, { claim: { run: claim.runId, epoch: claim.epoch }, ...call });
|
|
270
|
+
if (!attached.ok)
|
|
271
|
+
throw new Error(attached.error.message);
|
|
272
|
+
ref = { id: found.ref.id, name: found.ref.name };
|
|
273
|
+
made = false;
|
|
274
|
+
note(`Attached this agent's computer ${ref.name}, kept from its last run.`);
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
const created = await provider.create(spec, { ...call, requestId: claimRequestId(claim) });
|
|
278
|
+
if (!created.ok)
|
|
279
|
+
throw new Error(created.error.message);
|
|
280
|
+
ref = { id: created.value.id, name: created.value.name };
|
|
281
|
+
made = true;
|
|
282
|
+
note(record
|
|
283
|
+
? `This agent's computer ${record.name} is gone (deleted outside this server): made a new one, ${ref.name}, which later runs get back.`
|
|
284
|
+
: `Made this agent's own computer ${ref.name}: later runs get it back.`);
|
|
285
|
+
}
|
|
286
|
+
// The computer is acquired: its cleanup is in place before anything else is awaited, and whatever fails from here (the
|
|
287
|
+
// hold lost to a later claim included) lets go of exactly what this claim acquired.
|
|
288
|
+
const computer = { provider: context.provider, image: context.image, ...ref };
|
|
289
|
+
// The hold is marked letting go first, so no claim takes it over while the computer is detached. A claim that took it
|
|
290
|
+
// over since (a later claim of this run, resumed, or another run once this one's row ended) has the computer now: it
|
|
291
|
+
// is left as it is.
|
|
292
|
+
const detach = async () => {
|
|
293
|
+
if (!(await hold.releasing()))
|
|
294
|
+
return;
|
|
295
|
+
const released = await provider.release(ref, "detach");
|
|
296
|
+
if (!released.ok)
|
|
297
|
+
throw new Error(released.error.message);
|
|
298
|
+
await keepAgentComputer(store, agentId, computer, "detached");
|
|
299
|
+
await reconcileAgentComputer(store, agentId, async () => provider, hold);
|
|
300
|
+
};
|
|
301
|
+
// A launch that fails: a computer this claim made is deleted under its claim, so one a later claim has taken since (a
|
|
302
|
+
// resume whose owner's listing found it) is left to that claim, and the record goes where it names it; one it attached
|
|
303
|
+
// is detached as at the run's end, where the hold is still this claim's. Throws `error`, with what was let go.
|
|
304
|
+
const abandon = async (error) => {
|
|
305
|
+
const words = error instanceof Error ? error.message : String(error);
|
|
306
|
+
if (!made) {
|
|
307
|
+
const undone = await detach().then(() => undefined, (failed) => (failed instanceof Error ? failed.message : String(failed)));
|
|
308
|
+
throw new Error(undone === undefined ? words : `${words}; and ${ref.name} could not be detached: ${undone}`);
|
|
309
|
+
}
|
|
310
|
+
const deleted = await provider.release(ref, "delete", { claim: { run: claim.runId, epoch: claim.epoch } });
|
|
311
|
+
if (deleted.ok)
|
|
312
|
+
await forgetAgentComputer(store, agentId, ref.id).catch(() => undefined);
|
|
313
|
+
throw new Error(`${words}; ${ref.name}, which this claim made, ${deleted.ok ? "was deleted" : `was not deleted (${deleted.error.message})`}`);
|
|
314
|
+
};
|
|
315
|
+
let connected;
|
|
316
|
+
try {
|
|
317
|
+
// A later claim of this run (or another run, this one's row ended) that took the hold over while this one attached
|
|
318
|
+
// or made the computer has it now: its record is that claim's to write.
|
|
319
|
+
if (!(await hold.holds()))
|
|
320
|
+
throw new Error(`fenced: this agent's computer ${ref.name} was taken over by a later claim while run ${claim.runId}'s claim at epoch ${claim.epoch} ${made ? "made" : "attached"} it; it is left to that claim`);
|
|
321
|
+
await keepAgentComputer(store, agentId, computer, "held", { run: claim.runId });
|
|
322
|
+
const opened = await provider.connect(ref);
|
|
323
|
+
if (!opened.ok)
|
|
324
|
+
throw new Error(opened.error.message);
|
|
325
|
+
connected = opened.value;
|
|
326
|
+
}
|
|
327
|
+
catch (error) {
|
|
328
|
+
return abandon(error);
|
|
329
|
+
}
|
|
330
|
+
const { client, hello } = connected;
|
|
331
|
+
return {
|
|
332
|
+
id: ref.id,
|
|
333
|
+
groups: hello.groups,
|
|
334
|
+
machine: hello.kind,
|
|
335
|
+
hello,
|
|
336
|
+
client,
|
|
337
|
+
// An agent's own computer mounts no run's folder (resolve-computer.ts refuses one that would).
|
|
338
|
+
async readBack() {
|
|
339
|
+
return { ok: false, error: { code: "not_found", message: "an agent's own computer mounts no run's folder" } };
|
|
340
|
+
},
|
|
341
|
+
// The provider's watch of the screen, which feeds the run's proxied live view, as a made computer's.
|
|
342
|
+
...(watchOf(provider, ref) ? { watch: watchOf(provider, ref) } : {}),
|
|
343
|
+
async release() {
|
|
344
|
+
await connected.close().catch(() => undefined);
|
|
345
|
+
await detach();
|
|
346
|
+
},
|
|
347
|
+
};
|
|
348
|
+
}
|
|
148
349
|
/** The run's computer for this claim, started and registered; `{ computer: undefined }` for none. Throws with code
|
|
149
350
|
* computer_unavailable and the server's words when the agent's computer cannot be had here. */
|
|
150
|
-
export async function computerForClaim(launch,
|
|
351
|
+
export async function computerForClaim(launch,
|
|
352
|
+
// `settings` and `runs`: the agent's own computer's record and its holder's run row, for a persistent setting alone.
|
|
353
|
+
store, deps) {
|
|
151
354
|
const table = deps.keyTable ?? KEY_TABLE;
|
|
355
|
+
// The paired computers, each one more provider of the registry (attached-computers.ts): a setting names one by its id.
|
|
356
|
+
const paired = deps.attached ? await deps.attached.rows() : [];
|
|
357
|
+
const kinds = withPaired(deps.kinds, paired);
|
|
152
358
|
/** The computer this claim started (one per claim): its ref id tags its live view, and its watch feeds it. */
|
|
153
359
|
let made;
|
|
154
360
|
/** The provider entry it was started from: a phone's platform where the computer did not say it. */
|
|
155
361
|
let madeBy;
|
|
362
|
+
/** A vendor's provider (or a local one's), made with the keys and the configuration the setting selected: that
|
|
363
|
+
* configuration is built by its own create() options (Orgo's Windows: { os: "windows" }), beside the keys'. */
|
|
364
|
+
const vendorProvider = async (entry, keys, configuration) => {
|
|
365
|
+
const make = Object.hasOwn(deps.providers, entry.id) ? deps.providers[entry.id] : undefined;
|
|
366
|
+
if (!make)
|
|
367
|
+
throw new Error(`this server has no ${entry.label} provider to start one with`);
|
|
368
|
+
const options = providerOptions(entry.id, keys, deps.settings ?? {}, table);
|
|
369
|
+
if (!options.ok)
|
|
370
|
+
throw new Error(options.error.message);
|
|
371
|
+
return make({ ...options.options, ...configuration.options }, { ledger: storeLedger(store.computerLedger, entry.id), ...(launch.boxAllow === undefined ? {} : { boxAllow: launch.boxAllow }) });
|
|
372
|
+
};
|
|
156
373
|
const side = {
|
|
157
|
-
keysOf: providerKeys(
|
|
374
|
+
keysOf: providerKeys(kinds, deps.keyOf ?? (async (name) => (deps.sealKey ? await getSealedKey(store, deps.sealKey, name) : undefined))),
|
|
158
375
|
answers: deps.answers ?? (async () => false),
|
|
159
376
|
...(deps.daemon ? { daemon: deps.daemon } : {}),
|
|
160
|
-
async launch(entry, { kind, keys, configuration, mount, gpu, signal }) {
|
|
161
|
-
|
|
162
|
-
|
|
377
|
+
async launch(entry, { kind, keys, configuration, mount, gpu, persistent, signal }) {
|
|
378
|
+
const ownLaunch = deps.launch && (deps.launches?.(entry.id) ?? true) ? deps.launch : undefined;
|
|
379
|
+
// An agent's own computer needs its agent and the store's record of it; the server's launch (--faux) keeps none.
|
|
380
|
+
if (persistent && (ownLaunch || launch.agentId === undefined || store.settings === undefined))
|
|
381
|
+
throw new Error("this run can't keep its agent's own computer here: start it again with persistent off");
|
|
382
|
+
// A paired computer is claimed through the hub of this process (attachedProvider), never made: --faux's launch,
|
|
383
|
+
// which stands in for the vendors', is not its.
|
|
384
|
+
const pairedRow = paired.find((row) => row.id === entry.id);
|
|
385
|
+
if (ownLaunch && !pairedRow) {
|
|
386
|
+
const own = await ownLaunch(entry, { kind, keys, configuration, ...(mount ? { mount } : {}), ...(gpu ? { gpu } : {}), ...(signal ? { signal } : {}) });
|
|
163
387
|
const ownWatch = own.watch;
|
|
164
388
|
made = { id: own.id, ...(ownWatch ? { watch: ownWatch } : {}) };
|
|
165
389
|
madeBy = entry;
|
|
166
390
|
return own;
|
|
167
391
|
}
|
|
168
|
-
const
|
|
169
|
-
if (!make)
|
|
170
|
-
throw new Error(`this server has no ${entry.label} provider to start one with`);
|
|
171
|
-
const options = providerOptions(entry.id, keys, deps.settings ?? {}, table);
|
|
172
|
-
if (!options.ok)
|
|
173
|
-
throw new Error(options.error.message);
|
|
174
|
-
// The configuration the setting selected is built by its own create() options (Orgo's Windows: { os: "windows" }),
|
|
175
|
-
// beside the keys'.
|
|
176
|
-
const provider = await make({ ...options.options, ...configuration.options }, { ledger: storeLedger(store.computerLedger, entry.id), ...(launch.boxAllow === undefined ? {} : { boxAllow: launch.boxAllow }) });
|
|
392
|
+
const provider = pairedRow ? pairedProvider(pairedRow, deps.attached?.hub) : await vendorProvider(entry, keys, configuration);
|
|
177
393
|
// What this provider makes, as it declares it: the spec asks for one of its networks, within its lifetime
|
|
178
394
|
// (computer-deps.ts computerSpecOf).
|
|
179
395
|
const { network: networks, maxLifetimeMs } = provider.capabilities();
|
|
@@ -201,13 +417,31 @@ export async function computerForClaim(launch, store, deps) {
|
|
|
201
417
|
madeBy = entry;
|
|
202
418
|
return { id: entry.id, groups: ["cdp"], browser: opened.browser, release: opened.release };
|
|
203
419
|
}
|
|
204
|
-
|
|
420
|
+
let launched;
|
|
421
|
+
if (persistent) {
|
|
422
|
+
// The agent's own: its owner (this server and the agent), and no run deadline (it outlives the run).
|
|
423
|
+
const owner = { agent: launch.agentId, server: await serverIdOf({ settings: store.settings }) };
|
|
424
|
+
const { lifetimeMs: _, ...owned } = spec;
|
|
425
|
+
launched = await ownedLaunch(provider, launch, { ...owned, owner }, {
|
|
426
|
+
store: { settings: store.settings, agents: store.agents, ...(store.runs ? { runs: store.runs } : {}) },
|
|
427
|
+
agentId: launch.agentId,
|
|
428
|
+
owner,
|
|
429
|
+
provider: entry.id,
|
|
430
|
+
image: configuration.image,
|
|
431
|
+
note: deps.onComputerNote ?? (() => { }),
|
|
432
|
+
}, signal);
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
launched = await providerLaunch(provider, launch, spec, signal);
|
|
436
|
+
}
|
|
205
437
|
made = { id: launched.id, machine: launched.machine, ...(launched.watch ? { watch: launched.watch } : {}) };
|
|
206
438
|
madeBy = entry;
|
|
439
|
+
const { os, osVersion, arch } = launched.hello;
|
|
440
|
+
deps.onConnected?.({ provider: entry.label, kind: kind, hello: { os, ...(osVersion ? { osVersion } : {}), arch } });
|
|
207
441
|
return launched;
|
|
208
442
|
},
|
|
209
443
|
};
|
|
210
|
-
const resolved = await resolveComputer(await settingOf(launch, store), deps.mode,
|
|
444
|
+
const resolved = await resolveComputer(await settingOf(launch, store), deps.mode, kinds, side);
|
|
211
445
|
if ("refused" in resolved)
|
|
212
446
|
throw unavailable(resolved.refused);
|
|
213
447
|
if (resolved.kind === "none")
|
|
@@ -215,6 +449,10 @@ export async function computerForClaim(launch, store, deps) {
|
|
|
215
449
|
const refusedKind = deps.refuseKind?.(resolved.kind);
|
|
216
450
|
if (refusedKind)
|
|
217
451
|
throw unavailable(refusedKind);
|
|
452
|
+
// The program its provider runs on this machine (the phone's adb) is checked before anything is rented.
|
|
453
|
+
const hostRefusal = resolved.provider ? deps.hostWhy?.(resolved.provider) : undefined;
|
|
454
|
+
if (hostRefusal)
|
|
455
|
+
throw unavailable(`This agent's computer is a ${resolved.kind} on ${resolved.provider}, and this runner cannot run it: ${hostRefusal.replace(/[.!?]+$/, "")}.`);
|
|
218
456
|
// The run's mount credential (Mode 2), minted when the mount was made: removed with the computer, or at once when the
|
|
219
457
|
// start fails after it was minted.
|
|
220
458
|
const revoke = async () => { await deps.revokeMount?.(); };
|
|
@@ -232,13 +470,14 @@ export async function computerForClaim(launch, store, deps) {
|
|
|
232
470
|
// vendor's URL reaches a person), opened under this claim. A fenced open is a lost claim. The release ends the hold.
|
|
233
471
|
let endHold = () => { };
|
|
234
472
|
let hold;
|
|
473
|
+
let held;
|
|
235
474
|
let view;
|
|
236
475
|
if (computer && (computer.kind === "desktop" || computer.kind === "phone")) {
|
|
237
476
|
const theHold = computerHold();
|
|
238
477
|
if (deps.openComputerView && made?.watch) {
|
|
239
478
|
const watch = made.watch;
|
|
240
479
|
const input = computer.kind === "desktop" ? "desktop" : phonePlatform(made.machine, madeBy);
|
|
241
|
-
const opened = await deps.openComputerView({ store, sealKey: deps.sealKey, claim: launch.claim ?? { runId: launch.runId, epoch: launch.epoch }, kind: computer.kind, input, tag: made.id, watch
|
|
480
|
+
const opened = await deps.openComputerView({ store, sealKey: deps.sealKey, claim: launch.claim ?? { runId: launch.runId, epoch: launch.epoch }, kind: computer.kind, input, tag: made.id, watch, hold: theHold });
|
|
242
481
|
if (!opened.ok) {
|
|
243
482
|
await started.release().catch(() => undefined);
|
|
244
483
|
await revoke().catch(() => undefined);
|
|
@@ -252,11 +491,13 @@ export async function computerForClaim(launch, store, deps) {
|
|
|
252
491
|
// goes; the composer's `ended` ViewEnd maps onto it), the agent's open ask is let go at once, and nothing is taken after.
|
|
253
492
|
endHold = () => theHold.close();
|
|
254
493
|
hold = (ports) => heldHands(ports, theHold);
|
|
494
|
+
held = { kind: computer.kind, hold: theHold };
|
|
255
495
|
}
|
|
256
496
|
let released;
|
|
257
497
|
return {
|
|
258
498
|
...(computer ? { computer } : {}),
|
|
259
499
|
...(hold ? { hold } : {}),
|
|
500
|
+
...(held ? { held } : {}),
|
|
260
501
|
release: (why = "released") => (released ??= (async () => {
|
|
261
502
|
await Promise.resolve(view?.close(why)).catch(() => undefined);
|
|
262
503
|
endHold();
|
|
@@ -115,36 +115,20 @@ export declare function computerHold(options?: {
|
|
|
115
115
|
readonly now?: () => number;
|
|
116
116
|
}): ComputerHold;
|
|
117
117
|
/** What the model is told of an act it asked for while the person had the computer: not done, look again. */
|
|
118
|
-
export declare const personHadWords: (
|
|
119
|
-
/** The
|
|
118
|
+
export declare const personHadWords: (act: string) => string;
|
|
119
|
+
/** The kind a parked act throws, as the computer's port throws a refusal: the registry's executors answer it in its words. */
|
|
120
120
|
export declare const TAKEN_OVER = "taken_over";
|
|
121
|
-
/** The
|
|
122
|
-
type
|
|
123
|
-
|
|
121
|
+
/** The computer's one port, as heldHands needs it (run-adapters kernel/registry Hands.computer). */
|
|
122
|
+
type Port = {
|
|
123
|
+
readonly groups: readonly string[];
|
|
124
|
+
call(op: string, args: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
124
125
|
};
|
|
125
|
-
type
|
|
126
|
-
|
|
126
|
+
type WithPort = Partial<Hands> & {
|
|
127
|
+
readonly computer?: Port;
|
|
127
128
|
};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
tap(...args: never[]): Promise<unknown>;
|
|
132
|
-
swipe(...args: never[]): Promise<unknown>;
|
|
133
|
-
type(...args: never[]): Promise<unknown>;
|
|
134
|
-
key?(...args: never[]): Promise<unknown>;
|
|
135
|
-
apps: {
|
|
136
|
-
list(...args: never[]): Promise<unknown>;
|
|
137
|
-
open(...args: never[]): Promise<unknown>;
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
type WithPorts = Partial<Hands> & {
|
|
141
|
-
readonly screen?: ScreenPort;
|
|
142
|
-
readonly input?: InputPort;
|
|
143
|
-
readonly phone?: PhonePort;
|
|
144
|
-
};
|
|
145
|
-
/** `hands` with its screen, input and phone ports parked while the person has the computer, and the agent's ask
|
|
146
|
-
* (`handoff`) through the hold; everything else as it is. */
|
|
147
|
-
export declare function heldHands<H extends WithPorts>(hands: H, hold: ComputerHold): H & {
|
|
129
|
+
/** `hands` with its computer port held while the person has the computer, and the agent's ask (`handoff`) through the
|
|
130
|
+
* hold; everything else as it is. */
|
|
131
|
+
export declare function heldHands<H extends WithPort>(hands: H, hold: ComputerHold): H & {
|
|
148
132
|
readonly handoff: Handoff;
|
|
149
133
|
};
|
|
150
134
|
export {};
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
// waited out, so the gate never cuts an action in half, and new agent calls are parked); `person` (the owner drives,
|
|
7
7
|
// and the agent's calls are parked). A take ends in one of five ways: `given` (handed back), `answered` (the agent's ask
|
|
8
8
|
// was answered while the owner held it), `idle` (no input from the owner for HOLD_IDLE_MS), `away` (the viewer closed or
|
|
9
|
-
// lost its socket: back at once) or `released` (the computer's session ended). At the hand-back a parked look (
|
|
10
|
-
// screenshot, the app list) runs on the screen as the person left it; a parked act (
|
|
11
|
-
// opening an app) is not done: the model is told the person had the computer, and to look again first. exec, files and
|
|
9
|
+
// lost its socket: back at once) or `released` (the computer's session ended). At the hand-back a parked look (an
|
|
10
|
+
// observe, a screenshot, the app list) runs on the screen as the person left it; a parked act (an act's steps, raw
|
|
11
|
+
// input, opening an app) is not done: the model is told the person had the computer, and to look again first. exec, files and
|
|
12
12
|
// processes are not the person's: they pass through.
|
|
13
13
|
//
|
|
14
14
|
// The agent's ask (`ask`): one at a time; it waits until the owner answers (done or cancelled), until it expires
|
|
@@ -200,64 +200,44 @@ export function computerHold(options = {}) {
|
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
202
|
/** What the model is told of an act it asked for while the person had the computer: not done, look again. */
|
|
203
|
-
export const personHadWords = (
|
|
204
|
-
/** The
|
|
203
|
+
export const personHadWords = (act) => `The person had this computer: they took it over from the run's view and have handed it back, so this ${act} was not done. The screen may have changed: observe again before you act.`;
|
|
204
|
+
/** The kind a parked act throws, as the computer's port throws a refusal: the registry's executors answer it in its words. */
|
|
205
205
|
export const TAKEN_OVER = "taken_over";
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
finally {
|
|
236
|
-
leave();
|
|
237
|
-
}
|
|
238
|
-
});
|
|
206
|
+
/** The surface's ops that look: parked while the person has the computer, then run on the screen as they left it. */
|
|
207
|
+
const LOOKS = new Set(["observe", "screenshot", "apps.list"]);
|
|
208
|
+
/** The ops that act, each by what the model is told was not done: parked, then refused. */
|
|
209
|
+
const ACTS = new Map([["act", "act"], ["input.act", "input"], ["apps.open", "app opening"]]);
|
|
210
|
+
/** `port` held: a look waits while the person has the computer, then runs as the agent's call in flight (which a take
|
|
211
|
+
* waits out); an act made with the agent driving runs (in flight), one made while the person has it waits for the
|
|
212
|
+
* hand-back and is not done; the shell's and the files' ops are not the person's and pass through. */
|
|
213
|
+
function heldPort(port, hold) {
|
|
214
|
+
return {
|
|
215
|
+
...port,
|
|
216
|
+
async call(op, args, signal) {
|
|
217
|
+
const what = ACTS.get(op);
|
|
218
|
+
if (what === undefined && !LOOKS.has(op))
|
|
219
|
+
return port.call(op, args, signal);
|
|
220
|
+
const parked = hold.state() !== "agent";
|
|
221
|
+
const leave = await hold.enter(signal);
|
|
222
|
+
if (parked && what !== undefined) {
|
|
223
|
+
leave();
|
|
224
|
+
throw Object.assign(new Error(personHadWords(what)), { kind: TAKEN_OVER });
|
|
225
|
+
}
|
|
226
|
+
try {
|
|
227
|
+
return await port.call(op, args, signal);
|
|
228
|
+
}
|
|
229
|
+
finally {
|
|
230
|
+
leave();
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
};
|
|
239
234
|
}
|
|
240
|
-
/** `hands` with its
|
|
241
|
-
*
|
|
235
|
+
/** `hands` with its computer port held while the person has the computer, and the agent's ask (`handoff`) through the
|
|
236
|
+
* hold; everything else as it is. */
|
|
242
237
|
export function heldHands(hands, hold) {
|
|
243
|
-
const computer = hands.phone ? "phone" : "desktop";
|
|
244
238
|
return {
|
|
245
239
|
...hands,
|
|
246
|
-
...(hands.
|
|
247
|
-
...(hands.input ? { input: { ...hands.input, actions: act(hands.input, "actions", hold, computer, "input") } } : {}),
|
|
248
|
-
...(hands.phone ? {
|
|
249
|
-
phone: {
|
|
250
|
-
...hands.phone,
|
|
251
|
-
shot: look(hands.phone, "shot", hold),
|
|
252
|
-
// A phone that does not offer its tree or its keys keeps none: the tool says so in words.
|
|
253
|
-
...(hands.phone.tree ? { tree: look(hands.phone, "tree", hold) } : {}),
|
|
254
|
-
tap: act(hands.phone, "tap", hold, "phone", "tap"),
|
|
255
|
-
swipe: act(hands.phone, "swipe", hold, "phone", "swipe"),
|
|
256
|
-
type: act(hands.phone, "type", hold, "phone", "typing"),
|
|
257
|
-
...(hands.phone.key ? { key: act(hands.phone, "key", hold, "phone", "key press") } : {}),
|
|
258
|
-
apps: { ...hands.phone.apps, list: look(hands.phone.apps, "list", hold), open: act(hands.phone.apps, "open", hold, "phone", "app opening") },
|
|
259
|
-
},
|
|
260
|
-
} : {}),
|
|
240
|
+
...(hands.computer ? { computer: heldPort(hands.computer, hold) } : {}),
|
|
261
241
|
handoff: { ask: (request, signal) => hold.ask(request, signal) },
|
|
262
242
|
};
|
|
263
243
|
}
|
|
@@ -10,8 +10,9 @@ export declare const JANITOR_CLOSE_MS = 5000;
|
|
|
10
10
|
* is swept, so a stuck vendor (a Docker command has no timeout of its own) never stops the others or later sweeps. */
|
|
11
11
|
export declare const JANITOR_PROVIDER_MS: number;
|
|
12
12
|
export interface JanitorDeps {
|
|
13
|
-
/** The store: whose runs a computer's run label names, and the phone provider's ledger
|
|
14
|
-
|
|
13
|
+
/** The store: whose runs a computer's run label names, and the phone provider's ledger; with `settings` and `agents`,
|
|
14
|
+
* this server's id and its agents, whose own computers it then sweeps by their owner. */
|
|
15
|
+
readonly store: Pick<Store, "runs" | "computerLedger"> & Partial<Pick<Store, "settings" | "agents">>;
|
|
15
16
|
/** The run's computers as the runner composed them (computer-deps.ts computerDepsFrom): the registry, the provider
|
|
16
17
|
* makers and the key reader. */
|
|
17
18
|
readonly computers: Pick<ComputerDeps, "kinds" | "providers" | "keyOf"> & {
|