@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/box-egress-vm.d.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/** What `docker info` is asked on a Mac: the daemon's OS type, its kernel, the name it gives its OS, and its host name. */
|
|
2
|
-
export declare const VM_INFO_FORMAT = "{{.OSType}}|{{.KernelVersion}}|{{.OperatingSystem}}|{{.Name}}";
|
|
3
|
-
/** The VM runtimes a box's network goes on for, on a Mac. */
|
|
4
|
-
export declare const VM_RUNTIMES: readonly ["Docker Desktop", "OrbStack", "colima"];
|
|
5
|
-
export type VmRuntime = (typeof VM_RUNTIMES)[number];
|
|
6
|
-
/** Where this Docker runs, by `docker info`'s answer to VM_INFO_FORMAT (`answer`), on a server with `platform` and
|
|
7
|
-
* `kernel` (os.release()): a VM runtime this server knows, or why not. Pure. A runtime counts only when docker info
|
|
8
|
-
* names it (OperatingSystem `Docker Desktop` or `OrbStack`, or a colima host Name) AND its kernel is not this
|
|
9
|
-
* machine's: a VM in between. Anything else is a reason, never a guess. */
|
|
10
|
-
export declare function vmDockerOf(answer: string, here: {
|
|
11
|
-
platform: string;
|
|
12
|
-
kernel: string;
|
|
13
|
-
}): {
|
|
14
|
-
runtime: VmRuntime;
|
|
15
|
-
} | {
|
|
16
|
-
reason: string;
|
|
17
|
-
};
|
|
18
|
-
/** `docker`, with `args`, in the server's environment through the cut a run's takes, nothing on its stdin, within
|
|
19
|
-
* `timeoutMs`: its exit code (or `timeout`, or the spawn's error code) and its output. */
|
|
20
|
-
export type DockerCall = (args: readonly string[], timeoutMs: number, signal?: AbortSignal) => Promise<{
|
|
21
|
-
code: number | string;
|
|
22
|
-
stdout: string;
|
|
23
|
-
stderr: string;
|
|
24
|
-
}>;
|
|
25
|
-
export declare const dockerCall: (env: NodeJS.ProcessEnv) => DockerCall;
|
|
26
|
-
/** Where this Mac's Docker runs (vmDockerOf), asked of `docker info` within its bound; a daemon the docker CLI does not
|
|
27
|
-
* reach by a local unix socket (DOCKER_HOST, or a context, elsewhere) is not this Mac's VM, and gets no network. */
|
|
28
|
-
export declare function vmDocker(env: NodeJS.ProcessEnv, options?: {
|
|
29
|
-
platform?: string;
|
|
30
|
-
kernel?: string;
|
|
31
|
-
timeoutMs?: number;
|
|
32
|
-
docker?: DockerCall;
|
|
33
|
-
}): Promise<{
|
|
34
|
-
runtime: VmRuntime;
|
|
35
|
-
} | {
|
|
36
|
-
reason: string;
|
|
37
|
-
}>;
|
|
38
|
-
/** The proxy container's image: `node:22-bookworm-slim` (the kernel needs Node 22.19 or later), pinned to the multi-arch
|
|
39
|
-
* index digest Docker Hub served for that tag on 2026-11-05 (Node 22.23.4), as BOX_BASE is pinned (box-image.ts), so every Mac runs the
|
|
40
|
-
* same Node. To move it, read the tag's index digest again the way BOX_BASE says, and put it here. */
|
|
41
|
-
export declare const EGRESS_IMAGE = "node:22-bookworm-slim@sha256:4b150b48b4116e2a22f2c39cc27025fbf4f153e2078fd3b14d159fdb5c7279da";
|
|
42
|
-
/** The label the proxy container and its volume carry: the server's key (egressKeyOf). */
|
|
43
|
-
export declare const EGRESS_LABEL = "agentrun.egress";
|
|
44
|
-
/** Where the volume is in the proxy container, and its code. */
|
|
45
|
-
export declare const EGRESS_VOLUME_MOUNT = "/egress";
|
|
46
|
-
export declare const EGRESS_CODE_MOUNT = "/code";
|
|
47
|
-
/** What the entry logs once its socket listens. */
|
|
48
|
-
export declare const EGRESS_READY = "egress ready";
|
|
49
|
-
/** How long the start waits for EGRESS_READY once the container runs. */
|
|
50
|
-
export declare const EGRESS_READY_MS = 10000;
|
|
51
|
-
/** How often the server looks for its proxy container, to start it again when it is gone. */
|
|
52
|
-
export declare const EGRESS_WATCH_MS = 5000;
|
|
53
|
-
/** How long the start's pull of EGRESS_IMAGE may take. */
|
|
54
|
-
export declare const EGRESS_PULL_MS: number;
|
|
55
|
-
/** Connections open at once through the server's one proxy, every run's together. */
|
|
56
|
-
export declare const VM_MAX_TUNNELS = 256;
|
|
57
|
-
/** This server's key: its data root's hash, so two servers on one daemon get two proxies and two volumes. */
|
|
58
|
-
export declare const egressKeyOf: (data: string) => string;
|
|
59
|
-
/** The proxy container's name, and its volume's, for a key. */
|
|
60
|
-
export declare const egressNameOf: (key: string) => string;
|
|
61
|
-
/** The entry the proxy container runs (`node /code/main.js <socket>`): it refuses to start with no list, for a proxy with
|
|
62
|
-
* none would reach every public host, and logs EGRESS_READY once its socket listens. Its decisions go to its log. */
|
|
63
|
-
export declare const MAIN: string;
|
|
64
|
-
/** The kernel's two proxy files, as built: they import only `node:` modules and each other. */
|
|
65
|
-
export declare const PROXY_FILES: readonly ["egress-proxy.js", "egress-table.js"];
|
|
66
|
-
/** The code the proxy container binds read-only: PROXY_FILES of this server's own build, and MAIN, written into
|
|
67
|
-
* `<data>/egress/<12 hex of their hash>/` once (a directory per version, so a running container's code never changes
|
|
68
|
-
* under it). Its path, real (Docker binds it by that). */
|
|
69
|
-
export declare function egressCode(data: string): Promise<string>;
|
|
70
|
-
/** `docker volume create` of the server's volume: tmpfs, so no stale socket outlives the VM, and owned by the server's
|
|
71
|
-
* uid:gid with mode 0700, as the proxy's socket (0600) and the box (both run as that uid) need. */
|
|
72
|
-
export declare const egressVolumeArgs: (key: string, uid: number, gid: number) => string[];
|
|
73
|
-
/** `docker run` of the proxy container. Docker's default network, the only container with one; no published port, no
|
|
74
|
-
* Docker socket, no variable but the list; a read-only root, no capability, no privilege to gain, the server's uid:gid;
|
|
75
|
-
* bounded memory, processes and log. Pinned by a golden test. */
|
|
76
|
-
export declare const egressRunArgs: (options: {
|
|
77
|
-
key: string;
|
|
78
|
-
uid: number;
|
|
79
|
-
gid: number;
|
|
80
|
-
code: string;
|
|
81
|
-
allow: readonly string[];
|
|
82
|
-
}) => string[];
|
|
83
|
-
/** The proxy container's state: `ready` once it listens; `preparing` while it is pulled, started or started again;
|
|
84
|
-
* `unavailable` when it could not start, with why. */
|
|
85
|
-
export type EgressState = {
|
|
86
|
-
state: "ready";
|
|
87
|
-
} | {
|
|
88
|
-
state: "preparing" | "unavailable";
|
|
89
|
-
reason: string;
|
|
90
|
-
};
|
|
91
|
-
/** `volume`: the volume a run's box mounts, once it is made; absent when it could not be. */
|
|
92
|
-
export type EgressContainer = {
|
|
93
|
-
readonly volume?: string;
|
|
94
|
-
state(): EgressState;
|
|
95
|
-
close(): Promise<void>;
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* The server's proxy container (see the head of this file): made ready now when Docker has its image (within
|
|
99
|
-
* EGRESS_READY_MS), else pulled and started in the background; then watched every `watchMs`, and started again when it
|
|
100
|
-
* is gone or stopped. `onChange` is told each new state. `close` stops the watch and removes the container; its volume
|
|
101
|
-
* stays, for boxes still mounting it and the next start.
|
|
102
|
-
*/
|
|
103
|
-
export declare function startEgressContainer(options: {
|
|
104
|
-
env: NodeJS.ProcessEnv;
|
|
105
|
-
data: string;
|
|
106
|
-
allow: readonly string[];
|
|
107
|
-
uid: number;
|
|
108
|
-
gid: number;
|
|
109
|
-
onChange?: (state: EgressState) => void;
|
|
110
|
-
warn?: (message: string) => void;
|
|
111
|
-
docker?: DockerCall;
|
|
112
|
-
watchMs?: number;
|
|
113
|
-
readyMs?: number;
|
|
114
|
-
pullMs?: number;
|
|
115
|
-
}): Promise<EgressContainer>;
|
|
116
|
-
/** What the server hands a run's process on a Mac with the proxy container: its volume's name, which the run's Docker
|
|
117
|
-
* boxes mount read-only at EGRESS_MOUNT. Unset on Linux, where the run's process starts its own proxy (box-egress.ts). */
|
|
118
|
-
export declare const RUN_BOX_VOLUME_ENV = "AGENTRUN_RUN_BOX_VOLUME";
|
package/dist/box-egress-vm.js
DELETED
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
// A Docker box's way out on a Mac, where Docker runs in a VM: the Linux path (box-egress.ts) binds a socket of this
|
|
2
|
-
// machine into the box, and a Mac's file-sharing layer carries files, not sockets, so the box sees it and is refused. Here
|
|
3
|
-
// serve's egress proxy runs instead in ONE container per server, inside the VM: the pinned EGRESS_IMAGE, the proxy's
|
|
4
|
-
// two dependency-free files and an entry (MAIN) bound read-only from the data root, the host list as its one variable, and
|
|
5
|
-
// a Unix socket in a tmpfs named volume owned by the server's uid. The box mounts that volume read-only at EGRESS_MOUNT
|
|
6
|
-
// and keeps `--network none`, its socat and its proxy variables, as on Linux. The proxy container is the only container
|
|
7
|
-
// with a network (Docker's default), and it publishes no port.
|
|
8
|
-
//
|
|
9
|
-
// This path is for a Mac alone, and only for a Docker that `docker info` names as a VM runtime this server knows
|
|
10
|
-
// (vmDockerOf): Docker Desktop, OrbStack or colima, on a kernel other than this machine's. Anything else stays offline, and
|
|
11
|
-
// the reason says what was seen. Linux keeps its own path, unchanged.
|
|
12
|
-
//
|
|
13
|
-
// Lifecycle (startEgressContainer): at the server's start, the volume is made if missing, every container of this
|
|
14
|
-
// server's label is removed (a crashed server's), the image is pulled if Docker lacks it, and the container is started
|
|
15
|
-
// and waited on until it logs EGRESS_READY (EGRESS_READY_MS). Docker restarts it if it dies (`--restart unless-stopped`);
|
|
16
|
-
// if it is gone (removed by hand), the server's watch starts it again. The server's stop removes it. Until it is ready,
|
|
17
|
-
// and when it cannot start, the box's network is none, and capabilities say why.
|
|
18
|
-
import { execFile } from "node:child_process";
|
|
19
|
-
import { createHash, randomBytes } from "node:crypto";
|
|
20
|
-
import { chmod, mkdir, readFile, realpath, rename, rm, writeFile } from "node:fs/promises";
|
|
21
|
-
import { release } from "node:os";
|
|
22
|
-
import { dirname, join } from "node:path";
|
|
23
|
-
import { fileURLToPath } from "node:url";
|
|
24
|
-
import { ALLOW_HINT, EGRESS_SOCKET, INFO_TIMEOUT_MS } from "./box-egress.js";
|
|
25
|
-
import { withoutSecrets } from "./secrets.js";
|
|
26
|
-
/** What `docker info` is asked on a Mac: the daemon's OS type, its kernel, the name it gives its OS, and its host name. */
|
|
27
|
-
export const VM_INFO_FORMAT = "{{.OSType}}|{{.KernelVersion}}|{{.OperatingSystem}}|{{.Name}}";
|
|
28
|
-
/** The VM runtimes a box's network goes on for, on a Mac. */
|
|
29
|
-
export const VM_RUNTIMES = ["Docker Desktop", "OrbStack", "colima"];
|
|
30
|
-
/** A colima VM's host name, which `docker info` gives as its Name: `colima` for the default profile, `colima-<profile>`
|
|
31
|
-
* for another (colima's config.ProfileName / CurrentProfile; its VM's hostname is the profile's ID). */
|
|
32
|
-
const COLIMA_NAME = /^colima(-[A-Za-z0-9][A-Za-z0-9._-]*)?$/;
|
|
33
|
-
/** Where this Docker runs, by `docker info`'s answer to VM_INFO_FORMAT (`answer`), on a server with `platform` and
|
|
34
|
-
* `kernel` (os.release()): a VM runtime this server knows, or why not. Pure. A runtime counts only when docker info
|
|
35
|
-
* names it (OperatingSystem `Docker Desktop` or `OrbStack`, or a colima host Name) AND its kernel is not this
|
|
36
|
-
* machine's: a VM in between. Anything else is a reason, never a guess. */
|
|
37
|
-
export function vmDockerOf(answer, here) {
|
|
38
|
-
if (here.platform !== "darwin")
|
|
39
|
-
return { reason: `this server runs on ${here.platform}, not a Mac, so a Docker in a VM gets no box network here` };
|
|
40
|
-
const fields = answer.trim().split("|");
|
|
41
|
-
const [osType, kernel, os, name] = fields.map((field) => field.trim());
|
|
42
|
-
const shown = (text) => JSON.stringify(text.slice(0, 80));
|
|
43
|
-
if (fields.length !== 4 || !osType || !kernel)
|
|
44
|
-
return { reason: `docker info's answer could not be read (${shown(answer.trim())}), so this server can't tell which VM this Docker runs in` };
|
|
45
|
-
const runtime = os ? `this Docker (${os.slice(0, 80)})` : "this Docker";
|
|
46
|
-
if (osType !== "linux")
|
|
47
|
-
return { reason: `${runtime} runs ${shown(osType)} containers, not Linux ones, so its boxes get no network` };
|
|
48
|
-
if (kernel === here.kernel)
|
|
49
|
-
return { reason: `${runtime} runs on this machine's own kernel, not in a VM this server knows, so its boxes get no network` };
|
|
50
|
-
const known = os === "Docker Desktop" ? "Docker Desktop" : os === "OrbStack" ? "OrbStack" : COLIMA_NAME.test(name ?? "") ? "colima" : undefined;
|
|
51
|
-
if (!known)
|
|
52
|
-
return { reason: `${runtime} runs in a VM this server does not know (its kernel is ${shown(kernel)}, its name ${shown(name ?? "")}), so its boxes get no network: on a Mac, a box's network goes on only for Docker Desktop, OrbStack or colima` };
|
|
53
|
-
return { runtime: known };
|
|
54
|
-
}
|
|
55
|
-
export const dockerCall = (env) => (args, timeoutMs, signal) => new Promise((resolve) => {
|
|
56
|
-
const child = execFile("docker", args, { env: withoutSecrets(env), timeout: timeoutMs, killSignal: "SIGKILL", maxBuffer: 8 * 1024 * 1024, ...(signal ? { signal } : {}) }, (error, stdout, stderr) => {
|
|
57
|
-
const failed = error;
|
|
58
|
-
resolve({ code: !failed ? 0 : failed.killed ? "timeout" : typeof failed.code === "number" ? failed.code : (failed.code ?? failed.name), stdout: String(stdout), stderr: String(stderr) });
|
|
59
|
-
});
|
|
60
|
-
child.stdin?.on("error", () => undefined);
|
|
61
|
-
child.stdin?.end();
|
|
62
|
-
});
|
|
63
|
-
/** Where this Mac's Docker runs (vmDockerOf), asked of `docker info` within its bound; a daemon the docker CLI does not
|
|
64
|
-
* reach by a local unix socket (DOCKER_HOST, or a context, elsewhere) is not this Mac's VM, and gets no network. */
|
|
65
|
-
export async function vmDocker(env, options = {}) {
|
|
66
|
-
const platform = options.platform ?? process.platform;
|
|
67
|
-
if (platform !== "darwin")
|
|
68
|
-
return vmDockerOf("", { platform, kernel: "" });
|
|
69
|
-
const { dockerDaemon } = await import("@parcha/pi-transport/box/docker");
|
|
70
|
-
const daemon = dockerDaemon(env);
|
|
71
|
-
if (!daemon.local)
|
|
72
|
-
return { reason: `this Docker (${daemon.named}) is not on this machine, so its boxes get no network` };
|
|
73
|
-
const timeoutMs = options.timeoutMs ?? INFO_TIMEOUT_MS;
|
|
74
|
-
const answer = await (options.docker ?? dockerCall(env))(["info", "--format", VM_INFO_FORMAT], timeoutMs);
|
|
75
|
-
if (answer.code !== 0)
|
|
76
|
-
return { reason: `docker info did not say where this Docker runs (${answer.code === "timeout" ? `it did not answer within ${Math.round(timeoutMs / 1000)} s` : `it failed (${typeof answer.code === "number" ? `exit ${answer.code}` : answer.code})`}), so its boxes get no network` };
|
|
77
|
-
return vmDockerOf(answer.stdout, { platform, kernel: options.kernel ?? release() });
|
|
78
|
-
}
|
|
79
|
-
/** The proxy container's image: `node:22-bookworm-slim` (the kernel needs Node 22.19 or later), pinned to the multi-arch
|
|
80
|
-
* index digest Docker Hub served for that tag on 2026-11-05 (Node 22.23.4), as BOX_BASE is pinned (box-image.ts), so every Mac runs the
|
|
81
|
-
* same Node. To move it, read the tag's index digest again the way BOX_BASE says, and put it here. */
|
|
82
|
-
export const EGRESS_IMAGE = "node:22-bookworm-slim@sha256:4b150b48b4116e2a22f2c39cc27025fbf4f153e2078fd3b14d159fdb5c7279da";
|
|
83
|
-
/** The label the proxy container and its volume carry: the server's key (egressKeyOf). */
|
|
84
|
-
export const EGRESS_LABEL = "agentrun.egress";
|
|
85
|
-
/** Where the volume is in the proxy container, and its code. */
|
|
86
|
-
export const EGRESS_VOLUME_MOUNT = "/egress";
|
|
87
|
-
export const EGRESS_CODE_MOUNT = "/code";
|
|
88
|
-
/** What the entry logs once its socket listens. */
|
|
89
|
-
export const EGRESS_READY = "egress ready";
|
|
90
|
-
/** How long the start waits for EGRESS_READY once the container runs. */
|
|
91
|
-
export const EGRESS_READY_MS = 10_000;
|
|
92
|
-
/** How often the server looks for its proxy container, to start it again when it is gone. */
|
|
93
|
-
export const EGRESS_WATCH_MS = 5_000;
|
|
94
|
-
/** How long the start's pull of EGRESS_IMAGE may take. */
|
|
95
|
-
export const EGRESS_PULL_MS = 10 * 60_000;
|
|
96
|
-
/** Connections open at once through the server's one proxy, every run's together. */
|
|
97
|
-
export const VM_MAX_TUNNELS = 256;
|
|
98
|
-
/** The setting the proxy container gets, and nothing else: the host list. */
|
|
99
|
-
const ALLOW_VAR = "AGENTRUN_BOX_ALLOW";
|
|
100
|
-
/** This server's key: its data root's hash, so two servers on one daemon get two proxies and two volumes. */
|
|
101
|
-
export const egressKeyOf = (data) => createHash("sha256").update(data).digest("hex").slice(0, 12);
|
|
102
|
-
/** The proxy container's name, and its volume's, for a key. */
|
|
103
|
-
export const egressNameOf = (key) => `agentrun-egress-${key}`;
|
|
104
|
-
/** The entry the proxy container runs (`node /code/main.js <socket>`): it refuses to start with no list, for a proxy with
|
|
105
|
-
* none would reach every public host, and logs EGRESS_READY once its socket listens. Its decisions go to its log. */
|
|
106
|
-
export const MAIN = `// The box network proxy's entry, written by the server that runs it (agentrun serve), in its container.
|
|
107
|
-
import { parseAllow, startEgressProxy } from "./egress-proxy.js";
|
|
108
|
-
const say = (line) => process.stdout.write(line + "\\n");
|
|
109
|
-
let allow = [];
|
|
110
|
-
try {
|
|
111
|
-
allow = parseAllow(process.env.${ALLOW_VAR} ?? "");
|
|
112
|
-
} catch (error) {
|
|
113
|
-
say("egress: ${ALLOW_VAR} is not a host list (" + error.message + "), so the proxy does not start");
|
|
114
|
-
process.exit(2);
|
|
115
|
-
}
|
|
116
|
-
if (allow.length === 0) {
|
|
117
|
-
say("egress: no host list, so the proxy does not start: one with none would reach every public host");
|
|
118
|
-
process.exit(2);
|
|
119
|
-
}
|
|
120
|
-
const socketPath = process.argv[2];
|
|
121
|
-
if (!socketPath) {
|
|
122
|
-
say("egress: no socket path, so the proxy does not start");
|
|
123
|
-
process.exit(2);
|
|
124
|
-
}
|
|
125
|
-
const proxy = await startEgressProxy({ socketPath, maxTunnels: ${VM_MAX_TUNNELS}, maxConnections: Number.MAX_SAFE_INTEGER, log: say, allow, allowHint: ${JSON.stringify(ALLOW_HINT)} });
|
|
126
|
-
say("${EGRESS_READY} allow=" + allow.join(","));
|
|
127
|
-
for (const signal of ["SIGTERM", "SIGINT"]) process.once(signal, () => void proxy.close().finally(() => process.exit(0)));
|
|
128
|
-
`;
|
|
129
|
-
/** The kernel's two proxy files, as built: they import only `node:` modules and each other. */
|
|
130
|
-
export const PROXY_FILES = ["egress-proxy.js", "egress-table.js"];
|
|
131
|
-
/** The code the proxy container binds read-only: PROXY_FILES of this server's own build, and MAIN, written into
|
|
132
|
-
* `<data>/egress/<12 hex of their hash>/` once (a directory per version, so a running container's code never changes
|
|
133
|
-
* under it). Its path, real (Docker binds it by that). */
|
|
134
|
-
export async function egressCode(data) {
|
|
135
|
-
const host = dirname(fileURLToPath(import.meta.url));
|
|
136
|
-
const files = [...(await Promise.all(PROXY_FILES.map(async (name) => [name, await readFile(join(host, name), "utf8")]))), ["main.js", MAIN]];
|
|
137
|
-
const hash = createHash("sha256");
|
|
138
|
-
for (const [name, text] of files)
|
|
139
|
-
hash.update(`${name}\0${text}\0`);
|
|
140
|
-
const parent = join(await realpath(data), "egress");
|
|
141
|
-
const dir = join(parent, hash.digest("hex").slice(0, 12));
|
|
142
|
-
if (await readFile(join(dir, "main.js"), "utf8").then((text) => text === MAIN, () => false))
|
|
143
|
-
return dir;
|
|
144
|
-
await mkdir(parent, { recursive: true, mode: 0o755 });
|
|
145
|
-
const making = `${dir}.${randomBytes(4).toString("hex")}.partial`;
|
|
146
|
-
await mkdir(making, { mode: 0o755 });
|
|
147
|
-
try {
|
|
148
|
-
for (const [name, text] of files)
|
|
149
|
-
await writeFile(join(making, name), text, { mode: 0o644 });
|
|
150
|
-
await chmod(making, 0o755);
|
|
151
|
-
await rename(making, dir).catch(async (error) => {
|
|
152
|
-
// Another start made it first: the same bytes.
|
|
153
|
-
if (error.code !== "ENOTEMPTY" && error.code !== "EEXIST")
|
|
154
|
-
throw error;
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
finally {
|
|
158
|
-
await rm(making, { recursive: true, force: true }).catch(() => undefined);
|
|
159
|
-
}
|
|
160
|
-
return dir;
|
|
161
|
-
}
|
|
162
|
-
/** `docker volume create` of the server's volume: tmpfs, so no stale socket outlives the VM, and owned by the server's
|
|
163
|
-
* uid:gid with mode 0700, as the proxy's socket (0600) and the box (both run as that uid) need. */
|
|
164
|
-
export const egressVolumeArgs = (key, uid, gid) => ["volume", "create", "--driver", "local", "--opt", "type=tmpfs", "--opt", "device=tmpfs", "--opt", `o=size=1m,uid=${uid},gid=${gid},mode=0700`, "--label", `${EGRESS_LABEL}=${key}`, egressNameOf(key)];
|
|
165
|
-
/** `docker run` of the proxy container. Docker's default network, the only container with one; no published port, no
|
|
166
|
-
* Docker socket, no variable but the list; a read-only root, no capability, no privilege to gain, the server's uid:gid;
|
|
167
|
-
* bounded memory, processes and log. Pinned by a golden test. */
|
|
168
|
-
export const egressRunArgs = (options) => [
|
|
169
|
-
"run", "--detach", "--name", egressNameOf(options.key), "--restart", "unless-stopped",
|
|
170
|
-
"--read-only", "--cap-drop", "ALL", "--security-opt", "no-new-privileges", "--user", `${options.uid}:${options.gid}`,
|
|
171
|
-
"--memory", "256m", "--pids-limit", "256", "--log-driver", "json-file", "--log-opt", "max-size=1m", "--log-opt", "max-file=2",
|
|
172
|
-
"--label", `${EGRESS_LABEL}=${options.key}`,
|
|
173
|
-
"--mount", `type=volume,source=${egressNameOf(options.key)},target=${EGRESS_VOLUME_MOUNT}`,
|
|
174
|
-
"--mount", `type=bind,source=${options.code},target=${EGRESS_CODE_MOUNT},readonly`,
|
|
175
|
-
"--env", `${ALLOW_VAR}=${options.allow.join(",")}`,
|
|
176
|
-
"--entrypoint", "node", EGRESS_IMAGE, `${EGRESS_CODE_MOUNT}/main.js`, `${EGRESS_VOLUME_MOUNT}/${EGRESS_SOCKET}`,
|
|
177
|
-
];
|
|
178
|
-
const OWN_WORDS = /^egress: [\x20-\x7e]{1,200}$/;
|
|
179
|
-
/** A container's full id, as `docker run --detach` prints it. */
|
|
180
|
-
const CONTAINER_ID = /^[0-9a-f]{64}$/;
|
|
181
|
-
/**
|
|
182
|
-
* The server's proxy container (see the head of this file): made ready now when Docker has its image (within
|
|
183
|
-
* EGRESS_READY_MS), else pulled and started in the background; then watched every `watchMs`, and started again when it
|
|
184
|
-
* is gone or stopped. `onChange` is told each new state. `close` stops the watch and removes the container; its volume
|
|
185
|
-
* stays, for boxes still mounting it and the next start.
|
|
186
|
-
*/
|
|
187
|
-
export async function startEgressContainer(options) {
|
|
188
|
-
if (!options.allow.length)
|
|
189
|
-
throw new Error("the box network proxy needs a host list: one with none would reach every public host");
|
|
190
|
-
const docker = options.docker ?? dockerCall(options.env);
|
|
191
|
-
const key = egressKeyOf(await realpath(options.data));
|
|
192
|
-
const name = egressNameOf(key);
|
|
193
|
-
const readyMs = options.readyMs ?? EGRESS_READY_MS;
|
|
194
|
-
let state = { state: "preparing", reason: "the box network proxy is starting" };
|
|
195
|
-
let closed = false;
|
|
196
|
-
// Aborted at close: a pull or a wait in progress ends with the server.
|
|
197
|
-
const stopping = new AbortController();
|
|
198
|
-
const set = (next) => {
|
|
199
|
-
if (closed || (next.state === state.state && ("reason" in next ? next.reason : "") === ("reason" in state ? state.reason : "")))
|
|
200
|
-
return;
|
|
201
|
-
state = next;
|
|
202
|
-
options.onChange?.(state);
|
|
203
|
-
};
|
|
204
|
-
const failed = (why) => ({ state: "unavailable", reason: `the box network proxy did not start (${why}), so boxes have no network: restart the server to try again` });
|
|
205
|
-
/** Removes every container of this server's label: a crashed server's, or one being replaced. */
|
|
206
|
-
const sweep = async () => {
|
|
207
|
-
const listed = await docker(["ps", "--all", "--quiet", "--filter", `label=${EGRESS_LABEL}=${key}`], 10_000);
|
|
208
|
-
if (listed.code !== 0)
|
|
209
|
-
throw new Error(`docker ps failed (${listed.code})`);
|
|
210
|
-
for (const id of listed.stdout.split("\n").map((line) => line.trim()).filter(Boolean)) {
|
|
211
|
-
const removed = await docker(["rm", "--force", id], 10_000);
|
|
212
|
-
if (removed.code !== 0 && !/no such container/i.test(removed.stderr))
|
|
213
|
-
throw new Error(`docker rm of an old proxy failed (${removed.code})`);
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
/** Makes the server's volume, unless it is there with this server's label: why not, or undefined. One of its name
|
|
217
|
-
* without the label (Docker makes a volume a box names with its own defaults: root's, not tmpfs) is replaced when
|
|
218
|
-
* nothing holds it, and is a failure, saying how to remove it, when something does. */
|
|
219
|
-
const ensureVolume = async () => {
|
|
220
|
-
const seen = await docker(["volume", "inspect", "--format", `{{index .Labels "${EGRESS_LABEL}"}}`, name], 10_000);
|
|
221
|
-
if (seen.code === 0 && seen.stdout.trim() === key)
|
|
222
|
-
return undefined;
|
|
223
|
-
if (seen.code === 0 && (await docker(["volume", "rm", name], 10_000)).code !== 0)
|
|
224
|
-
return `a volume ${name} that this server did not make is in use: stop what uses it and run docker volume rm ${name}`;
|
|
225
|
-
const made = await docker(egressVolumeArgs(key, options.uid, options.gid), 10_000);
|
|
226
|
-
return made.code === 0 ? undefined : `docker volume create failed (${made.code})`;
|
|
227
|
-
};
|
|
228
|
-
// The proxy container this server started, by the id `docker run` printed: what the watch looks at and the close
|
|
229
|
-
// removes. Never its name, which a container that is not this server's may hold.
|
|
230
|
-
let ours;
|
|
231
|
-
/** Removes the container this server started, by its id. */
|
|
232
|
-
const removeOurs = async () => {
|
|
233
|
-
if (ours)
|
|
234
|
-
await docker(["rm", "--force", ours], 10_000);
|
|
235
|
-
ours = undefined;
|
|
236
|
-
};
|
|
237
|
-
/** Starts the container, the image already in, and waits for its ready line. */
|
|
238
|
-
const run = async () => {
|
|
239
|
-
const volume = await ensureVolume();
|
|
240
|
-
if (volume)
|
|
241
|
-
return failed(volume);
|
|
242
|
-
// A close since: nothing is removed or started, so a server that took this data root after it keeps its own proxy.
|
|
243
|
-
if (closed)
|
|
244
|
-
return state;
|
|
245
|
-
await sweep();
|
|
246
|
-
const code = await egressCode(options.data);
|
|
247
|
-
if (closed)
|
|
248
|
-
return state;
|
|
249
|
-
const started = await docker(egressRunArgs({ key, uid: options.uid, gid: options.gid, code, allow: options.allow }), 30_000);
|
|
250
|
-
// A name another container holds fails here (Docker's conflict), and that container is left as it is.
|
|
251
|
-
if (started.code !== 0)
|
|
252
|
-
return failed(`docker run failed (${started.code})`);
|
|
253
|
-
// Only an id is taken as one: anything else Docker printed is never handed to rm, inspect or logs.
|
|
254
|
-
const id = started.stdout.trim().split("\n").at(-1)?.trim() ?? "";
|
|
255
|
-
if (!CONTAINER_ID.test(id))
|
|
256
|
-
return failed("docker run printed no container id");
|
|
257
|
-
ours = id;
|
|
258
|
-
// A close while it started: what it started goes too.
|
|
259
|
-
if (closed)
|
|
260
|
-
return (await removeOurs(), state);
|
|
261
|
-
const until = Date.now() + readyMs;
|
|
262
|
-
for (;;) {
|
|
263
|
-
const logs = await docker(["logs", "--tail", "20", ours], 5_000);
|
|
264
|
-
const lines = `${logs.stdout}\n${logs.stderr}`.split("\n").map((line) => line.trim());
|
|
265
|
-
if (lines.some((line) => line.startsWith(EGRESS_READY)))
|
|
266
|
-
return { state: "ready" };
|
|
267
|
-
if (closed)
|
|
268
|
-
return state;
|
|
269
|
-
if (Date.now() > until) {
|
|
270
|
-
const own = lines.filter((line) => OWN_WORDS.test(line)).at(-1);
|
|
271
|
-
return failed(own ?? `it did not say it was ready within ${Math.round(readyMs / 1000)} s`);
|
|
272
|
-
}
|
|
273
|
-
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
const start = async () => {
|
|
277
|
-
try {
|
|
278
|
-
return await run();
|
|
279
|
-
}
|
|
280
|
-
catch (error) {
|
|
281
|
-
return failed(error.message);
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
let busy;
|
|
285
|
-
const once = (step) => (busy ??= step().finally(() => (busy = undefined)));
|
|
286
|
-
// The volume first, before any run is handed its name: a box that mounted a missing one would have Docker make it
|
|
287
|
-
// with its own defaults.
|
|
288
|
-
const noVolume = await ensureVolume().catch((error) => error.message);
|
|
289
|
-
if (noVolume) {
|
|
290
|
-
state = failed(noVolume);
|
|
291
|
-
return { state: () => state, close: async () => void (closed = true) };
|
|
292
|
-
}
|
|
293
|
-
const inspected = await docker(["image", "inspect", "--format", "{{.Id}}", EGRESS_IMAGE], 10_000);
|
|
294
|
-
if (inspected.code === 0)
|
|
295
|
-
set(await start());
|
|
296
|
-
else {
|
|
297
|
-
set({ state: "preparing", reason: `the box network proxy is pulling its image, ${EGRESS_IMAGE.split("@")[0]}` });
|
|
298
|
-
void once(async () => {
|
|
299
|
-
const pulled = await docker(["pull", "--quiet", EGRESS_IMAGE], options.pullMs ?? EGRESS_PULL_MS, stopping.signal);
|
|
300
|
-
if (closed)
|
|
301
|
-
return;
|
|
302
|
-
set(pulled.code === 0 ? await start() : failed(`docker pull ${EGRESS_IMAGE.split("@")[0]} failed (${pulled.code}): run it on this machine to see why`));
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
// Docker restarts a proxy that dies; one that is gone, or stopped, makes the network none at the first look, and the
|
|
306
|
-
// watch starts it again at the second in a row.
|
|
307
|
-
let misses = 0;
|
|
308
|
-
const watch = setInterval(() => {
|
|
309
|
-
if (closed || busy || state.state === "unavailable")
|
|
310
|
-
return;
|
|
311
|
-
void once(async () => {
|
|
312
|
-
const running = ours ? await docker(["inspect", "--format", "{{.State.Running}}", ours], 5_000) : undefined;
|
|
313
|
-
if (running?.code === 0 && running.stdout.trim() === "true") {
|
|
314
|
-
misses = 0;
|
|
315
|
-
if (state.state !== "ready")
|
|
316
|
-
set({ state: "ready" });
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
set({ state: "preparing", reason: "the box network proxy is not running" });
|
|
320
|
-
if (++misses < 2)
|
|
321
|
-
return;
|
|
322
|
-
misses = 0;
|
|
323
|
-
set({ state: "preparing", reason: "the box network proxy was gone, and is starting again" });
|
|
324
|
-
set(await start());
|
|
325
|
-
});
|
|
326
|
-
}, options.watchMs ?? EGRESS_WATCH_MS);
|
|
327
|
-
watch.unref();
|
|
328
|
-
return {
|
|
329
|
-
volume: name,
|
|
330
|
-
state: () => state,
|
|
331
|
-
async close() {
|
|
332
|
-
closed = true;
|
|
333
|
-
clearInterval(watch);
|
|
334
|
-
stopping.abort();
|
|
335
|
-
// What was under way ends first (a pull or a wait is aborted; a start checks `closed`), so nothing of this server's
|
|
336
|
-
// touches Docker after its close.
|
|
337
|
-
await busy?.catch(() => undefined);
|
|
338
|
-
// Best effort, but never silent: a failure says the proxy may still run, and how to remove it.
|
|
339
|
-
const left = (why) => options.warn?.(`the box network proxy may still be running (${why}): remove the containers labelled ${EGRESS_LABEL}=${key} with docker rm -f`);
|
|
340
|
-
if (ours) {
|
|
341
|
-
const removed = await docker(["rm", "--force", ours], 10_000);
|
|
342
|
-
if (removed.code !== 0 && !/no such container/i.test(removed.stderr))
|
|
343
|
-
left(`docker rm failed (${removed.code})`);
|
|
344
|
-
ours = undefined;
|
|
345
|
-
}
|
|
346
|
-
// And any other container of this server's own label, by its id: one a start made though its docker run gave no
|
|
347
|
-
// answer (a client cut off). Never by name: a container that is not this server's carries no such label.
|
|
348
|
-
await sweep().catch((error) => left(error.message));
|
|
349
|
-
},
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
/** What the server hands a run's process on a Mac with the proxy container: its volume's name, which the run's Docker
|
|
353
|
-
* boxes mount read-only at EGRESS_MOUNT. Unset on Linux, where the run's process starts its own proxy (box-egress.ts). */
|
|
354
|
-
export const RUN_BOX_VOLUME_ENV = "AGENTRUN_RUN_BOX_VOLUME";
|
package/dist/box-egress.d.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/** Where the proxy's directory is in the box, read-only. */
|
|
2
|
-
export declare const EGRESS_MOUNT = "/run/agentrun/egress";
|
|
3
|
-
/** The proxy's socket, in its directory. */
|
|
4
|
-
export declare const EGRESS_SOCKET = "egress.sock";
|
|
5
|
-
/** The box's loopback port socat relays to the socket. */
|
|
6
|
-
export declare const EGRESS_PORT = 3128;
|
|
7
|
-
/** What a box with a list adds to its fixed environment (run-box.ts BOX_ENV): constants, no user, no password. */
|
|
8
|
-
export declare const PROXY_ENV: Readonly<Record<string, string>>;
|
|
9
|
-
/** The box's relay to the proxy's socket `socket` (in EGRESS_MOUNT), started once each time the run's box opens (made
|
|
10
|
-
* or found): a second one finds the port taken and exits. Each connection opens the socket by its path, so a proxy
|
|
11
|
-
* started again is reached with no new relay. */
|
|
12
|
-
export declare const forwarder: (socket?: string) => string[];
|
|
13
|
-
/** The relay's start, in the box, answered once it listens: exit 127 when the image has no socat, 126 when it has no
|
|
14
|
-
* setsid, and 124 when the relay is not listening within 3 s (its own error, if it gave one, on stderr). A relay a
|
|
15
|
-
* process before this one started still listens, so a second start finds the port taken and answers at once. */
|
|
16
|
-
export declare const forwarderStart: (socket?: string) => string[];
|
|
17
|
-
/** The timeline row of a box whose relay could not start, by the start's exit (forwarderStart): the box keeps no network. */
|
|
18
|
-
export declare function relayFailed(code: number, said: string): string;
|
|
19
|
-
/** The row for an image with no socat (relayFailed 127). */
|
|
20
|
-
export declare const NO_SOCAT: string;
|
|
21
|
-
/** What a refusal of a host off the list says to do, after its words. */
|
|
22
|
-
export declare const ALLOW_HINT = "use web_fetch for web pages, or ask the operator to add it to AGENTRUN_BOX_ALLOW";
|
|
23
|
-
/** Each run's proxy: connections open at once, and in all. */
|
|
24
|
-
export declare const MAX_TUNNELS = 64;
|
|
25
|
-
export declare const MAX_CONNECTIONS = 20000;
|
|
26
|
-
/** Under `--faux` only: a module whose default export gives the proxy's `lookup` and `dial` (the tests' fake network), so
|
|
27
|
-
* a test's box reaches no host but its fake. */
|
|
28
|
-
export declare const FAUX_EGRESS_ENV = "AGENTRUN_SERVE_FAUX_EGRESS";
|
|
29
|
-
/** The proxy's directory for run `runId`: short, so its socket's path stays within a Unix socket's limit (107 bytes)
|
|
30
|
-
* wherever the data root is, and the same each time the run's process starts, since the box keeps its bind. `parent`,
|
|
31
|
-
* for a server in a container: a directory on the data directory's mount (box-paths.ts egressParentOf), which the box can
|
|
32
|
-
* get from Docker; a host's is in /tmp. */
|
|
33
|
-
export declare function egressDir(runId: string, uid?: number, parent?: string): string;
|
|
34
|
-
/** The longest a parent of the proxy directories may be, in bytes: its longest socket path then fits a Unix socket's 107
|
|
35
|
-
* bytes. That is the temporary one the proxy listens on first (run-adapters egress-proxy.ts, `.egress-<12 hex>.sock`)
|
|
36
|
-
* before it links it to egress.sock; Node cuts a longer path without a word, so the link would miss it. */
|
|
37
|
-
export declare const MAX_EGRESS_PARENT: number;
|
|
38
|
-
/** Whether `parent` is too long, in bytes, for a run's proxy directories (MAX_EGRESS_PARENT). */
|
|
39
|
-
export declare const egressParentTooLong: (parent: string) => boolean;
|
|
40
|
-
/** Where a run's box finds its proxy: what is mounted read-only at EGRESS_MOUNT, and the socket's name there. The one
|
|
41
|
-
* seam between the box's side, which is the same wherever the proxy runs (the mount, the relay, the proxy variables),
|
|
42
|
-
* and where the proxy runs. Today that is hostEgress: the run's own process, its socket's directory on this machine
|
|
43
|
-
* bound into the box. */
|
|
44
|
-
export type BoxEgress = (runId: string) => Promise<{
|
|
45
|
-
mount?: {
|
|
46
|
-
source: string;
|
|
47
|
-
target: typeof EGRESS_MOUNT;
|
|
48
|
-
readOnly: true;
|
|
49
|
-
};
|
|
50
|
-
socket: string;
|
|
51
|
-
fresh: boolean;
|
|
52
|
-
}>;
|
|
53
|
-
/** The proxy in the run's process (hostEgress): for a Docker daemon on this Linux machine, which can reach a socket in a
|
|
54
|
-
* directory of this machine bound into a container. */
|
|
55
|
-
export declare const hostEgress: (allow: readonly string[], env: NodeJS.ProcessEnv, log: (line: string) => void, parent?: string) => BoxEgress;
|
|
56
|
-
/** How long `docker info` may take to say where this Docker runs. */
|
|
57
|
-
export declare const INFO_TIMEOUT_MS = 5000;
|
|
58
|
-
/** What `docker info` is asked: the daemon's OS type, its kernel, where it keeps its data, and the name it gives its OS. */
|
|
59
|
-
export declare const INFO_FORMAT = "{{.OSType}}|{{.KernelVersion}}|{{.DockerRootDir}}|{{.OperatingSystem}}";
|
|
60
|
-
/** `docker info`'s answer to INFO_FORMAT, its stdout, or a throw that says why there is none. */
|
|
61
|
-
export type DockerInfo = (env: NodeJS.ProcessEnv, timeoutMs: number) => Promise<string>;
|
|
62
|
-
/** `docker info` in the server's environment through the cut a run's takes, nothing on its stdin, within `timeoutMs`. */
|
|
63
|
-
export declare const dockerInfo: DockerInfo;
|
|
64
|
-
/**
|
|
65
|
-
* Why a Docker box on this server cannot reach its proxy, or undefined when it can. The proxy's socket is a file of this
|
|
66
|
-
* machine bound into the box, which only a Docker daemon on this same Linux machine can connect to: a daemon in a VM
|
|
67
|
-
* (Docker Desktop, OrbStack and their kin) sees the socket and is refused. So the network goes on only with positive
|
|
68
|
-
* evidence that the daemon is this machine's: this machine is Linux; the docker CLI's endpoint is a local unix socket
|
|
69
|
-
* (no DOCKER_HOST or a unix:// one, and the default context or a unix one: pi-transport's dockerDaemon); and `docker
|
|
70
|
-
* info` answers within its bound with OS type linux and this machine's own kernel (os.release()): the same kernel, so no
|
|
71
|
-
* VM in between; and the directory it keeps its data in (DockerRootDir) is one this server sees. A server in a container
|
|
72
|
-
* given the host's docker socket shares the host's kernel, but not its files: it would bind a directory the daemon does
|
|
73
|
-
* not have, so every box would fail to start. Anything else is no network, and the reason says what was seen, naming the
|
|
74
|
-
* runtime docker info gives; unless the server found its own container's mount of its data directory (`mapped`,
|
|
75
|
-
* box-paths.ts), on which the proxy's directory is then put. A kernel is the evidence, not a runtime's name: Docker Desktop on WSL2 runs the kernel this
|
|
76
|
-
* server does, but keeps its data outside the distro, so it passes only where the distro has that directory too.
|
|
77
|
-
*/
|
|
78
|
-
export declare function egressBlockedBy(env: NodeJS.ProcessEnv, options?: {
|
|
79
|
-
info?: DockerInfo;
|
|
80
|
-
platform?: string;
|
|
81
|
-
kernel?: string;
|
|
82
|
-
timeoutMs?: number;
|
|
83
|
-
sees?: (dir: string) => boolean;
|
|
84
|
-
mapped?: boolean;
|
|
85
|
-
}): Promise<string | undefined>;
|
|
86
|
-
/** How old a run's proxy directory with no live socket must be before the start's sweep takes it: one just made, whose
|
|
87
|
-
* proxy is still starting, is not yet listening. */
|
|
88
|
-
export declare const STALE_EGRESS_MS = 60000;
|
|
89
|
-
/**
|
|
90
|
-
* The start's sweep of this user's proxy directories (egressDir's parent): each whose socket refuses a connect (or has
|
|
91
|
-
* none) and that is older than STALE_EGRESS_MS is a run's process that is gone, and is removed, by its exact path. One
|
|
92
|
-
* whose socket answers is a live run's, this server's or another's under this uid, and stays. Returns how many went.
|
|
93
|
-
*/
|
|
94
|
-
export declare function sweepEgressDirs(uid?: number, now?: number, parent?: string): Promise<number>;
|
|
95
|
-
/** What a server's Docker boxes reach, resolved once at its start (run-box.ts boxNetworkOf): the list, or none and why. */
|
|
96
|
-
export type DockerNetwork = {
|
|
97
|
-
allow: readonly string[]; /** On a Mac, the VM runtime whose proxy container serves the list (box-egress-vm.ts). */
|
|
98
|
-
vm?: string;
|
|
99
|
-
} | {
|
|
100
|
-
allow: "none";
|
|
101
|
-
reason: string;
|
|
102
|
-
};
|
|
103
|
-
/** What the server hands a run's process: the list its box reaches, resolved (boxNetworkOf), or `none`. The run's
|
|
104
|
-
* process reads this, never AGENTRUN_BOX_ALLOW: unset, it is none. */
|
|
105
|
-
export declare const RUN_BOX_ALLOW_ENV = "AGENTRUN_RUN_BOX_ALLOW";
|