@parcha/agentrun-serve 0.1.0-beta.34 → 0.1.0-beta.36
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 +263 -0
- package/README.md +339 -179
- package/dist/adapters.d.ts +15 -2
- package/dist/adapters.js +34 -2
- package/dist/agent-rows.d.ts +3 -1
- package/dist/agents-store.d.ts +2 -0
- package/dist/agents-store.js +25 -5
- 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 +90 -8
- package/dist/archil-settings.js +150 -14
- 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/bash-read-only.d.ts +13 -0
- package/dist/bash-read-only.js +77 -0
- 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 +2 -2
- package/dist/browser-cost.js +6 -4
- 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 +19 -44
- package/dist/cap.js +31 -77
- package/dist/cli.js +36 -27
- package/dist/computer-keys.d.ts +20 -10
- package/dist/computer-keys.js +36 -57
- package/dist/computer-routes.d.ts +1 -4
- package/dist/computer-routes.js +3 -5
- package/dist/computer-setting.d.ts +8 -5
- package/dist/computer-setting.js +91 -26
- package/dist/computer-view.d.ts +11 -2
- package/dist/computer-view.js +2 -1
- package/dist/computers.d.ts +54 -8
- package/dist/computers.js +101 -22
- package/dist/console/assets/index-BI4Byidu.js +550 -0
- package/dist/console/assets/index-C19gUF2n.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/content-filter.d.ts +7 -0
- package/dist/content-filter.js +23 -0
- package/dist/decision-cap.d.ts +7 -29
- package/dist/decision-cap.js +3 -94
- package/dist/docker-daemon.d.ts +2 -2
- package/dist/docker-daemon.js +2 -2
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +8 -5
- package/dist/explain.js +3 -1
- package/dist/faux-computers.js +4 -0
- package/dist/files.d.ts +1 -9
- package/dist/files.js +1 -9
- package/dist/github-connection.js +25 -7
- package/dist/github-faux.d.ts +26 -0
- package/dist/github-faux.js +76 -0
- package/dist/github.d.ts +28 -4
- package/dist/github.js +46 -10
- package/dist/gpu-words.d.ts +14 -0
- package/dist/gpu-words.js +21 -0
- package/dist/graph-served.d.ts +5 -3
- package/dist/graph-served.js +14 -6
- package/dist/graph-view.d.ts +2 -0
- package/dist/graph-view.js +29 -2
- 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-opencode/harness.js +0 -1
- package/dist/harness-opencode/host/policy.js +2 -2
- package/dist/harness.js +1 -1
- package/dist/host-tools.d.ts +8 -9
- package/dist/host-tools.js +7 -7
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -2
- package/dist/key-refusal.d.ts +1 -1
- package/dist/key-refusal.js +2 -2
- package/dist/learn/check.d.ts +10 -2
- package/dist/learn/check.js +126 -8
- package/dist/learn/commit.d.ts +40 -6
- package/dist/learn/commit.js +164 -20
- package/dist/learn/folder.d.ts +11 -3
- package/dist/learn/folder.js +40 -16
- package/dist/learn/grade.d.ts +22 -2
- package/dist/learn/grade.js +127 -19
- package/dist/learn/index.d.ts +2 -2
- package/dist/learn/index.js +2 -2
- package/dist/learn/learning.sh +11 -13
- package/dist/learn/notes.d.ts +17 -3
- package/dist/learn/notes.js +19 -6
- package/dist/learn/reflect.d.ts +5 -2
- package/dist/learn/reflect.js +48 -32
- package/dist/learn/skills.d.ts +52 -5
- package/dist/learn/skills.js +104 -21
- package/dist/learned-nodes.d.ts +18 -0
- package/dist/learned-nodes.js +8 -0
- package/dist/learned-workflow.d.ts +27 -13
- package/dist/learned-workflow.js +110 -38
- package/dist/learning-cost.d.ts +79 -0
- package/dist/learning-cost.js +69 -0
- package/dist/learning-routes.d.ts +48 -2
- package/dist/learning-routes.js +99 -28
- package/dist/learning-run.d.ts +7 -5
- package/dist/learning-run.js +9 -6
- package/dist/learning-words.d.ts +3 -0
- package/dist/learning-words.js +6 -2
- package/dist/learning.d.ts +13 -28
- package/dist/learning.js +4 -18
- package/dist/llm.d.ts +4 -1
- package/dist/llm.js +4 -2
- package/dist/mcp-gateway.d.ts +6 -0
- package/dist/mcp-gateway.js +11 -1
- package/dist/mcp-probe.d.ts +8 -1
- package/dist/mcp-probe.js +62 -20
- package/dist/mcp-secret-writes.js +4 -0
- package/dist/mcp-servers-store.d.ts +12 -12
- package/dist/mcp-servers-store.js +8 -3
- package/dist/model.d.ts +8 -5
- package/dist/model.js +14 -6
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +236 -55
- package/dist/owner.d.ts +0 -1
- package/dist/owner.js +0 -2
- package/dist/pause.d.ts +2 -19
- package/dist/pause.js +5 -74
- package/dist/place-offers.d.ts +97 -0
- package/dist/place-offers.js +206 -0
- package/dist/place.d.ts +9 -13
- package/dist/place.js +22 -32
- package/dist/port-models.d.ts +12 -4
- package/dist/port-models.js +31 -9
- package/dist/print.d.ts +1 -8
- package/dist/print.js +1 -14
- package/dist/propose.d.ts +3 -0
- package/dist/propose.js +25 -19
- package/dist/run-cut.d.ts +5 -0
- package/dist/run-cut.js +19 -0
- package/dist/run-db.js +3 -3
- package/dist/run-launch.d.ts +18 -3
- package/dist/run-launch.js +11 -5
- package/dist/run-learning-served.d.ts +12 -1
- package/dist/run-manifest.d.ts +2 -2
- package/dist/run-manifest.js +2 -2
- package/dist/run-reads-over-store.d.ts +4 -2
- package/dist/run-reads-over-store.js +10 -8
- package/dist/run-secrets.js +3 -3
- package/dist/run-timeline-served.js +60 -38
- package/dist/run-view.d.ts +35 -16
- package/dist/run-view.js +64 -35
- package/dist/runnable.d.ts +6 -3
- package/dist/runnable.js +20 -4
- package/dist/runner/adapter-loop.d.ts +46 -5
- package/dist/runner/adapter-loop.js +381 -56
- package/dist/runner/adapter-run-spec.d.ts +46 -4
- package/dist/runner/adapter-run-spec.js +200 -45
- package/dist/runner/adapters/pi.d.ts +39 -3
- package/dist/runner/adapters/pi.js +124 -29
- package/dist/runner/beside.d.ts +8 -0
- package/dist/runner/beside.js +24 -2
- package/dist/runner/claim-secrets.d.ts +6 -0
- package/dist/runner/claim-secrets.js +15 -1
- package/dist/runner/cli-run-spec.d.ts +10 -0
- package/dist/runner/cli-run-spec.js +207 -64
- package/dist/runner/commands.d.ts +5 -1
- package/dist/runner/commands.js +3 -3
- package/dist/runner/conformance/harness.d.ts +1 -1
- package/dist/runner/conformance/harness.js +13 -10
- package/dist/runner/github-app.d.ts +7 -2
- package/dist/runner/github-app.js +46 -15
- package/dist/runner/harness-loops.d.ts +6 -1
- package/dist/runner/harness-loops.js +24 -1
- package/dist/runner/journal-kinds.d.ts +53 -7
- package/dist/runner/journal-kinds.js +29 -1
- package/dist/runner/learning-end.d.ts +15 -0
- package/dist/runner/learning-end.js +113 -20
- package/dist/runner/learning-factory.js +6 -2
- package/dist/runner/learning-loop.d.ts +75 -1
- package/dist/runner/learning-loop.js +215 -22
- package/dist/runner/learning-seed.d.ts +8 -0
- package/dist/runner/learning-seed.js +7 -1
- package/dist/runner/loop-contract.d.ts +12 -0
- package/dist/runner/loop-contract.js +6 -0
- package/dist/runner/loop.d.ts +5 -1
- package/dist/runner/loop.js +20 -0
- package/dist/runner/main.d.ts +9 -4
- package/dist/runner/main.js +38 -13
- package/dist/runner/mcp-claim.d.ts +7 -0
- package/dist/runner/mcp-claim.js +35 -2
- package/dist/runner/mcp-github.d.ts +15 -4
- package/dist/runner/mcp-github.js +55 -11
- package/dist/runner/mcp-run.d.ts +2 -0
- package/dist/runner/mcp-run.js +2 -0
- package/dist/runner/metrics.d.ts +18 -1
- package/dist/runner/metrics.js +81 -1
- package/dist/runner/model-route.d.ts +6 -0
- package/dist/runner/model-route.js +5 -2
- package/dist/runner/pr-checkout.d.ts +59 -0
- package/dist/runner/pr-checkout.js +176 -0
- package/dist/runner/reflect-hook.d.ts +1 -0
- package/dist/runner/reflect-hook.js +3 -3
- package/dist/runner/runner.js +136 -19
- package/dist/runner/spec-holds.d.ts +13 -3
- package/dist/runner/spec-holds.js +13 -10
- package/dist/runner/store-port.d.ts +4 -1
- package/dist/runner/store-secrets.js +17 -1
- package/dist/runner/subagent.d.ts +44 -0
- package/dist/runner/subagent.js +188 -0
- package/dist/runner/workflow-host.d.ts +25 -4
- package/dist/runner/workflow-host.js +26 -4
- package/dist/runner/workflow-loop.d.ts +9 -3
- package/dist/runner/workflow-loop.js +17 -10
- package/dist/runner/workflow-spec.d.ts +28 -13
- package/dist/runner/workflow-spec.js +247 -102
- package/dist/runs-over-store.d.ts +18 -7
- package/dist/runs-over-store.js +149 -31
- package/dist/seal-key.d.ts +0 -2
- package/dist/seal-key.js +0 -2
- package/dist/sealing.js +1 -2
- package/dist/secret-cut.d.ts +1 -1
- package/dist/secret-cut.js +1 -1
- package/dist/server-lock.js +4 -5
- package/dist/server.d.ts +49 -63
- package/dist/server.js +429 -230
- package/dist/stop-signals.d.ts +4 -2
- package/dist/stop-signals.js +5 -3
- package/dist/store/agent-body.d.ts +14 -3
- package/dist/store/agent-body.js +22 -8
- package/dist/store/deadline.d.ts +18 -0
- package/dist/store/deadline.js +49 -0
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +2 -2
- package/dist/store/journal/storage.js +2 -1
- package/dist/store/postgres/connection.d.ts +4 -0
- package/dist/store/postgres/connection.js +64 -13
- package/dist/store/postgres/migrations/0004_runs_outcome_stop_or_cancel.sql +11 -0
- package/dist/store/schema.d.ts +2 -1
- package/dist/store/schema.js +11 -8
- 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 -82
- package/dist/store/sqlite/run-patch.d.ts +18 -2
- package/dist/store/sqlite/run-patch.js +31 -2
- package/dist/store/sqlite/store.js +65 -11
- package/dist/store/store.d.ts +62 -12
- package/dist/store/store.js +22 -1
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +1 -3
- package/dist/store-reads/cap.js +8 -6
- package/dist/store-reads/decisions.d.ts +2 -2
- package/dist/store-reads/decisions.js +3 -6
- package/dist/store-reads/journal.js +83 -15
- package/dist/store-reads/learning.d.ts +73 -3
- package/dist/store-reads/learning.js +232 -9
- package/dist/store-reads/runs.d.ts +6 -4
- package/dist/store-reads/runs.js +17 -10
- package/dist/store-reads/stats.js +5 -1
- package/dist/store-view.d.ts +15 -1
- package/dist/store-view.js +88 -29
- package/dist/template-eval.js +2 -1
- package/dist/templates.d.ts +73 -4
- package/dist/templates.js +113 -23
- package/dist/timeline/timeline.d.ts +11 -1
- package/dist/timeline/timeline.js +19 -4
- package/dist/tool-blurbs.js +1 -0
- package/dist/tool-budget.d.ts +26 -0
- package/dist/tool-budget.js +56 -0
- package/dist/tool-gate.d.ts +13 -3
- package/dist/tool-gate.js +15 -7
- package/dist/tool-plane.d.ts +42 -29
- package/dist/tool-plane.js +64 -27
- package/dist/tools.d.ts +53 -39
- package/dist/tools.js +174 -79
- package/dist/trigger-signatures.d.ts +1 -0
- package/dist/trigger-signatures.js +3 -1
- package/dist/triggers.d.ts +3 -3
- package/dist/triggers.js +2 -2
- package/dist/turn-end.d.ts +0 -3
- package/dist/turn-end.js +0 -3
- package/dist/uploads.d.ts +28 -5
- package/dist/uploads.js +82 -9
- package/dist/usage-lines.d.ts +1 -1
- package/dist/usage.d.ts +1 -47
- package/dist/usage.js +3 -82
- package/dist/validate.d.ts +8 -0
- package/dist/validate.js +40 -3
- package/dist/webhooks.d.ts +2 -1
- package/dist/webhooks.js +5 -2
- 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 +112 -0
- package/dist/workflow/node-runner.js +270 -0
- package/dist/workflow/node.d.ts +88 -0
- package/dist/workflow/node.js +99 -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 +9 -0
- package/dist/workflow/pi-versions.js +8 -0
- package/dist/workflow/readers.d.ts +36 -0
- package/dist/workflow/readers.js +145 -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 +76 -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 +411 -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/wal.d.ts +11 -0
- package/dist/workflow/wal.js +106 -0
- package/dist/workflow-run.d.ts +1 -1
- package/dist/workspace/agent-computer.d.ts +137 -0
- package/dist/workspace/agent-computer.js +292 -0
- package/dist/workspace/archil-claim.d.ts +13 -2
- package/dist/workspace/archil-claim.js +22 -13
- package/dist/workspace/archil-disk.d.ts +10 -1
- package/dist/workspace/archil-disk.js +4 -0
- package/dist/workspace/archil-disks.d.ts +49 -0
- package/dist/workspace/archil-disks.js +185 -0
- package/dist/workspace/archil-exec.d.ts +12 -2
- package/dist/workspace/archil-exec.js +18 -3
- package/dist/workspace/archil-mount-credential.d.ts +20 -4
- package/dist/workspace/archil-mount-credential.js +13 -4
- package/dist/workspace/archil.d.ts +2 -2
- package/dist/workspace/archil.js +25 -5
- package/dist/workspace/attach.js +2 -0
- package/dist/workspace/computer-deps.d.ts +18 -11
- package/dist/workspace/computer-deps.js +64 -40
- package/dist/workspace/computer-for-claim.d.ts +47 -9
- package/dist/workspace/computer-for-claim.js +236 -24
- package/dist/workspace/computer-janitor.d.ts +3 -2
- package/dist/workspace/computer-janitor.js +43 -9
- package/dist/workspace/computer-ledger.d.ts +3 -8
- package/dist/workspace/computer-ledger.js +7 -3
- package/dist/workspace/computer-providers.d.ts +5 -3
- package/dist/workspace/computer-providers.js +11 -9
- package/dist/workspace/hands.d.ts +5 -2
- package/dist/workspace/hands.js +4 -3
- package/dist/workspace/index.d.ts +5 -4
- package/dist/workspace/index.js +2 -1
- package/dist/workspace/local.d.ts +3 -0
- package/dist/workspace/local.js +9 -0
- package/dist/workspace/paths.js +3 -2
- package/dist/workspace/pi-env.d.ts +4 -0
- package/dist/workspace/pi-env.js +3 -2
- package/dist/workspace/resolve-computer.d.ts +48 -12
- package/dist/workspace/resolve-computer.js +88 -19
- package/dist/workspace/run-disk.d.ts +34 -0
- package/dist/workspace/run-disk.js +91 -0
- package/dist/workspace/run-tools.d.ts +6 -4
- package/dist/workspace/run-tools.js +17 -9
- package/dist/workspace/server-run-workspace.d.ts +3 -2
- package/dist/workspace/server-run-workspace.js +17 -4
- package/dist/workspace/workspace.d.ts +5 -0
- package/dist/workspace.d.ts +0 -3
- package/dist/workspace.js +2 -15
- package/package.json +11 -16
- package/skills/agentrun-serve/SKILL.md +1 -1
- package/templates/README.md +11 -8
- 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/mentions-defused/case.yaml +15 -0
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +254 -0
- package/templates/code-review/evals/mentions-defused/graders/no-pings.md +16 -0
- package/templates/code-review/evals/mentions-defused/graders/posted-a-review.md +5 -0
- package/templates/code-review/evals/mentions-defused/graders/schema.md +5 -0
- package/templates/code-review/evals/mentions-defused/prompt.md +10 -0
- 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/kyb/evals/clean-public-company/graders/no-opensanctions.md +5 -0
- package/templates/kyb/evals/opensanctions-on/case.yaml +5 -0
- package/templates/kyb/evals/opensanctions-on/graders/licence-and-evidence.md +18 -0
- package/templates/kyb/evals/opensanctions-on/graders/schema.md +5 -0
- package/templates/kyb/evals/opensanctions-on/prompt.md +11 -0
- package/templates/release-notes/agent.md +11 -0
- 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 -76
- package/dist/budget.js +0 -204
- package/dist/console/assets/index-RPHGlXmM.js +0 -540
- package/dist/console/assets/index-opTN5Naq.css +0 -1
- 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/templates/code-review/rules/REVIEW.md +0 -41
package/dist/box-egress.js
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
// A Docker box's way out to the network: the hosts on the server's list (AGENTRUN_BOX_ALLOW), and nothing else. The box
|
|
2
|
-
// stays `--network none`, with its own loopback alone. The run's process starts serve's egress proxy with the list
|
|
3
|
-
// (egress-proxy.ts), on a Unix socket in a directory of its own, which is bound into the box read-only at
|
|
4
|
-
// EGRESS_MOUNT; a socat in the box relays its own loopback port EGRESS_PORT to it, and the box's fixed environment
|
|
5
|
-
// names that port as its HTTP(S) proxy. The proxy refuses, before any lookup, a host off the list, an IP literal and any port but 80 and
|
|
6
|
-
// 443, and a listed name that resolves to a private or metadata address; it holds no key and adds none. A program in the
|
|
7
|
-
// box that ignores the proxy variables has no route and no resolver: its connection is unreachable. The list is the
|
|
8
|
-
// setting's one reading (run-box.ts boxAllowOf), as the server resolves it for this machine (boxNetworkOf); with `none`,
|
|
9
|
-
// a box is as it was: no proxy, no mount, no proxy variables. The proxy is never started without an explicit list: one
|
|
10
|
-
// with none would reach every public host.
|
|
11
|
-
import { execFile } from "node:child_process";
|
|
12
|
-
import { createHash } from "node:crypto";
|
|
13
|
-
import { statSync } from "node:fs";
|
|
14
|
-
import { lstat, mkdir, readdir, rm } from "node:fs/promises";
|
|
15
|
-
import { connect } from "node:net";
|
|
16
|
-
import { release } from "node:os";
|
|
17
|
-
import { join } from "node:path";
|
|
18
|
-
import { pathToFileURL } from "node:url";
|
|
19
|
-
import { startEgressProxy } from "./egress-proxy.js";
|
|
20
|
-
import { FAUX_ENV } from "./model.js";
|
|
21
|
-
import { withoutSecrets } from "./secrets.js";
|
|
22
|
-
/** Where the proxy's directory is in the box, read-only. */
|
|
23
|
-
export const EGRESS_MOUNT = "/run/agentrun/egress";
|
|
24
|
-
/** The proxy's socket, in its directory. */
|
|
25
|
-
export const EGRESS_SOCKET = "egress.sock";
|
|
26
|
-
/** The box's loopback port socat relays to the socket. */
|
|
27
|
-
export const EGRESS_PORT = 3128;
|
|
28
|
-
/** The box's own loopback, where its relay listens: never a service of this machine's. */
|
|
29
|
-
const BOX_LOOPBACK = "127.0.0.1"; // key-gate: loopback-rule the box own loopback where its relay listens
|
|
30
|
-
/** The proxy's address in the box: EGRESS_PORT on its loopback. */
|
|
31
|
-
const PROXY_URL = `http://${BOX_LOOPBACK}:${EGRESS_PORT}`;
|
|
32
|
-
const NO_PROXY = "localhost,127.0.0.1,::1"; // key-gate: loopback-rule the box own loopback names the proxy leaves out
|
|
33
|
-
/** What a box with a list adds to its fixed environment (run-box.ts BOX_ENV): constants, no user, no password. */
|
|
34
|
-
export const PROXY_ENV = Object.freeze({ HTTP_PROXY: PROXY_URL, HTTPS_PROXY: PROXY_URL, http_proxy: PROXY_URL, https_proxy: PROXY_URL, NO_PROXY, no_proxy: NO_PROXY });
|
|
35
|
-
/** The box's relay to the proxy's socket `socket` (in EGRESS_MOUNT), started once each time the run's box opens (made
|
|
36
|
-
* or found): a second one finds the port taken and exits. Each connection opens the socket by its path, so a proxy
|
|
37
|
-
* started again is reached with no new relay. */
|
|
38
|
-
export const forwarder = (socket = EGRESS_SOCKET) => ["socat", `TCP-LISTEN:${EGRESS_PORT},bind=127.0.0.1,reuseaddr,fork`, `UNIX-CONNECT:${EGRESS_MOUNT}/${socket}`]; // key-gate: loopback-rule the box own proxy port inside the box
|
|
39
|
-
/** How long the relay has to listen once started, in tenths of a second. */
|
|
40
|
-
const RELAY_WAIT_TENTHS = 30;
|
|
41
|
-
/** EGRESS_PORT on the box's loopback as /proc/net/tcp writes a listening socket: address and port in hex, state 0A. */
|
|
42
|
-
const LISTENING = ` 0100007F:${EGRESS_PORT.toString(16).toUpperCase().padStart(4, "0")} 00000000:0000 0A `;
|
|
43
|
-
/** The relay's start, in the box, answered once it listens: exit 127 when the image has no socat, 126 when it has no
|
|
44
|
-
* setsid, and 124 when the relay is not listening within 3 s (its own error, if it gave one, on stderr). A relay a
|
|
45
|
-
* process before this one started still listens, so a second start finds the port taken and answers at once. */
|
|
46
|
-
export const forwarderStart = (socket = EGRESS_SOCKET) => ["sh", "-c", [
|
|
47
|
-
"command -v socat >/dev/null 2>&1 || exit 127",
|
|
48
|
-
"command -v setsid >/dev/null 2>&1 || exit 126",
|
|
49
|
-
`listening() { grep -q '${LISTENING}' /proc/net/tcp 2>/dev/null; }`,
|
|
50
|
-
"listening && exit 0",
|
|
51
|
-
`log=$(mktemp); setsid ${forwarder(socket).join(" ")} </dev/null >/dev/null 2>"$log" &`,
|
|
52
|
-
`i=0; while [ "$i" -lt ${RELAY_WAIT_TENTHS} ]; do listening && { rm -f "$log"; exit 0; }; i=$((i + 1)); sleep 0.1; done`,
|
|
53
|
-
`head -c 300 "$log" >&2; rm -f "$log"; exit 124`,
|
|
54
|
-
].join("\n")];
|
|
55
|
-
/** The timeline row of a box whose relay could not start, by the start's exit (forwarderStart): the box keeps no network. */
|
|
56
|
-
export function relayFailed(code, said) {
|
|
57
|
-
if (code === 127)
|
|
58
|
-
return "This box's image has no socat, so it has no network. Add socat to the image, or set AGENTRUN_BOX_ALLOW=none to silence this.";
|
|
59
|
-
if (code === 126)
|
|
60
|
-
return "This box's image has no setsid, so it has no network. Add util-linux's setsid to the image, or set AGENTRUN_BOX_ALLOW=none to silence this.";
|
|
61
|
-
const why = said.trim().replace(/[\u0000-\u001f]+/g, " ").slice(0, 200);
|
|
62
|
-
return `This box's network relay did not start within 3 s (${code === 124 ? why || "it was not listening" : `exit ${code}`}), so it has no network.`;
|
|
63
|
-
}
|
|
64
|
-
/** The row for an image with no socat (relayFailed 127). */
|
|
65
|
-
export const NO_SOCAT = relayFailed(127, "");
|
|
66
|
-
/** What a refusal of a host off the list says to do, after its words. */
|
|
67
|
-
export const ALLOW_HINT = `use web_fetch for web pages, or ask the operator to add it to AGENTRUN_BOX_ALLOW`;
|
|
68
|
-
/** Each run's proxy: connections open at once, and in all. */
|
|
69
|
-
export const MAX_TUNNELS = 64;
|
|
70
|
-
export const MAX_CONNECTIONS = 20_000;
|
|
71
|
-
/** Under `--faux` only: a module whose default export gives the proxy's `lookup` and `dial` (the tests' fake network), so
|
|
72
|
-
* a test's box reaches no host but its fake. */
|
|
73
|
-
export const FAUX_EGRESS_ENV = "AGENTRUN_SERVE_FAUX_EGRESS";
|
|
74
|
-
/** The parent of this user's proxy directories on a host: in /tmp, so a socket's path stays short. */
|
|
75
|
-
const hostParent = (uid) => join("/tmp", `agentrun-egress-${uid}`);
|
|
76
|
-
/** The proxy's directory for run `runId`: short, so its socket's path stays within a Unix socket's limit (107 bytes)
|
|
77
|
-
* wherever the data root is, and the same each time the run's process starts, since the box keeps its bind. `parent`,
|
|
78
|
-
* for a server in a container: a directory on the data directory's mount (box-paths.ts egressParentOf), which the box can
|
|
79
|
-
* get from Docker; a host's is in /tmp. */
|
|
80
|
-
export function egressDir(runId, uid = process.getuid?.() ?? 0, parent = hostParent(uid)) {
|
|
81
|
-
return join(parent, createHash("sha256").update(runId).digest("hex").slice(0, 16));
|
|
82
|
-
}
|
|
83
|
-
/** The longest a parent of the proxy directories may be, in bytes: its longest socket path then fits a Unix socket's 107
|
|
84
|
-
* bytes. That is the temporary one the proxy listens on first (run-adapters egress-proxy.ts, `.egress-<12 hex>.sock`)
|
|
85
|
-
* before it links it to egress.sock; Node cuts a longer path without a word, so the link would miss it. */
|
|
86
|
-
export const MAX_EGRESS_PARENT = 107 - Buffer.byteLength("/0123456789abcdef/.egress-0123456789ab.sock");
|
|
87
|
-
/** Whether `parent` is too long, in bytes, for a run's proxy directories (MAX_EGRESS_PARENT). */
|
|
88
|
-
export const egressParentTooLong = (parent) => Buffer.byteLength(parent) > MAX_EGRESS_PARENT;
|
|
89
|
-
/** This user's parent directory in /tmp: made 0700, and refused unless it is a directory of this user's, not a link. */
|
|
90
|
-
async function ownParent(dir) {
|
|
91
|
-
await mkdir(dir, { recursive: true, mode: 0o700 });
|
|
92
|
-
const at = await lstat(dir);
|
|
93
|
-
const uid = process.getuid?.();
|
|
94
|
-
if (!at.isDirectory() || at.isSymbolicLink() || (uid !== undefined && at.uid !== uid) || (at.mode & 0o077) !== 0) {
|
|
95
|
-
throw new Error(`the box's network directory ${dir} is not a directory of this user's alone (0700, not a link): remove it, or set AGENTRUN_BOX_ALLOW=none`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/** The proxy in the run's process (hostEgress): for a Docker daemon on this Linux machine, which can reach a socket in a
|
|
99
|
-
* directory of this machine bound into a container. */
|
|
100
|
-
export const hostEgress = (allow, env, log, parent) => async (runId) => {
|
|
101
|
-
const { dir, fresh } = await runProxy(runId, allow, env, log, parent);
|
|
102
|
-
return { mount: { source: dir, target: EGRESS_MOUNT, readOnly: true }, socket: EGRESS_SOCKET, fresh };
|
|
103
|
-
};
|
|
104
|
-
const started = new Map();
|
|
105
|
-
const opened = new Set();
|
|
106
|
-
/** Run `runId`'s proxy in this process, with `allow`, started once: its directory, to bind into the box, and whether that
|
|
107
|
-
* directory was made now (`fresh`): a box bound to one an earlier process made, which the start's sweep took since, holds
|
|
108
|
-
* the old directory, not this one. Its decisions go to `log`. */
|
|
109
|
-
async function runProxy(runId, allow, env, log, parent) {
|
|
110
|
-
const dir = egressDir(runId, undefined, parent);
|
|
111
|
-
let proxy = started.get(runId);
|
|
112
|
-
if (!proxy) {
|
|
113
|
-
proxy = (async () => {
|
|
114
|
-
await ownParent(join(dir, ".."));
|
|
115
|
-
const fresh = await mkdir(dir, { mode: 0o700 }).then(() => true, (error) => {
|
|
116
|
-
if (error.code !== "EEXIST")
|
|
117
|
-
throw error;
|
|
118
|
-
return false;
|
|
119
|
-
});
|
|
120
|
-
const proxy = await startEgressProxy({ socketPath: join(dir, EGRESS_SOCKET), maxTunnels: MAX_TUNNELS, maxConnections: MAX_CONNECTIONS, log, allow: [...allow], allowHint: ALLOW_HINT, ...(await fauxSeams(env)) });
|
|
121
|
-
log(`egress start allow=${allow.join(",")}`);
|
|
122
|
-
return { proxy, fresh };
|
|
123
|
-
})();
|
|
124
|
-
started.set(runId, proxy);
|
|
125
|
-
proxy.catch(() => started.delete(runId));
|
|
126
|
-
}
|
|
127
|
-
// Fresh once: a later open in this process binds what the first one did.
|
|
128
|
-
const fresh = (await proxy).fresh && !opened.has(runId);
|
|
129
|
-
opened.add(runId);
|
|
130
|
-
return { dir, fresh };
|
|
131
|
-
}
|
|
132
|
-
/** The tests' seams, under `--faux` with FAUX_EGRESS_ENV set: its module's. */
|
|
133
|
-
async function fauxSeams(env) {
|
|
134
|
-
const module = env[FAUX_ENV] ? env[FAUX_EGRESS_ENV] : undefined;
|
|
135
|
-
if (!module)
|
|
136
|
-
return {};
|
|
137
|
-
return (await import(pathToFileURL(module).href)).default();
|
|
138
|
-
}
|
|
139
|
-
/** How long `docker info` may take to say where this Docker runs. */
|
|
140
|
-
export const INFO_TIMEOUT_MS = 5_000;
|
|
141
|
-
/** A platform by the name people use. */
|
|
142
|
-
const PLATFORM_NAMES = { darwin: "macOS", win32: "Windows" };
|
|
143
|
-
/** What `docker info` is asked: the daemon's OS type, its kernel, where it keeps its data, and the name it gives its OS. */
|
|
144
|
-
export const INFO_FORMAT = "{{.OSType}}|{{.KernelVersion}}|{{.DockerRootDir}}|{{.OperatingSystem}}";
|
|
145
|
-
/** `docker info` in the server's environment through the cut a run's takes, nothing on its stdin, within `timeoutMs`. */
|
|
146
|
-
export const dockerInfo = (env, timeoutMs) => new Promise((resolve, reject) => execFile("docker", ["info", "--format", INFO_FORMAT], { env: withoutSecrets(env), timeout: timeoutMs, killSignal: "SIGKILL", maxBuffer: 64 * 1024 }, (error, stdout) => {
|
|
147
|
-
if (!error)
|
|
148
|
-
return resolve(String(stdout));
|
|
149
|
-
const failed = error;
|
|
150
|
-
reject(new Error(failed.killed ? `it did not answer within ${Math.round(timeoutMs / 1000)} s` : typeof failed.code === "number" ? `it failed (exit ${failed.code})` : `it failed (${failed.code ?? failed.name})`));
|
|
151
|
-
}).stdin?.end());
|
|
152
|
-
/**
|
|
153
|
-
* 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
|
|
154
|
-
* machine bound into the box, which only a Docker daemon on this same Linux machine can connect to: a daemon in a VM
|
|
155
|
-
* (Docker Desktop, OrbStack and their kin) sees the socket and is refused. So the network goes on only with positive
|
|
156
|
-
* evidence that the daemon is this machine's: this machine is Linux; the docker CLI's endpoint is a local unix socket
|
|
157
|
-
* (no DOCKER_HOST or a unix:// one, and the default context or a unix one: pi-transport's dockerDaemon); and `docker
|
|
158
|
-
* info` answers within its bound with OS type linux and this machine's own kernel (os.release()): the same kernel, so no
|
|
159
|
-
* VM in between; and the directory it keeps its data in (DockerRootDir) is one this server sees. A server in a container
|
|
160
|
-
* given the host's docker socket shares the host's kernel, but not its files: it would bind a directory the daemon does
|
|
161
|
-
* not have, so every box would fail to start. Anything else is no network, and the reason says what was seen, naming the
|
|
162
|
-
* runtime docker info gives; unless the server found its own container's mount of its data directory (`mapped`,
|
|
163
|
-
* 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
|
|
164
|
-
* server does, but keeps its data outside the distro, so it passes only where the distro has that directory too.
|
|
165
|
-
*/
|
|
166
|
-
export async function egressBlockedBy(env, options = {}) {
|
|
167
|
-
const platform = options.platform ?? process.platform;
|
|
168
|
-
if (platform !== "linux")
|
|
169
|
-
return `this server runs on ${PLATFORM_NAMES[platform] ?? platform}, where Docker runs in a VM that can't reach this server's egress proxy yet`;
|
|
170
|
-
const { dockerDaemon } = await import("@parcha/pi-transport/box/docker");
|
|
171
|
-
const daemon = dockerDaemon(env);
|
|
172
|
-
if (!daemon.local)
|
|
173
|
-
return `this Docker (${daemon.named}) is not on this machine, so it can't reach this server's egress proxy`;
|
|
174
|
-
let answer;
|
|
175
|
-
try {
|
|
176
|
-
answer = await (options.info ?? dockerInfo)(env, options.timeoutMs ?? INFO_TIMEOUT_MS);
|
|
177
|
-
}
|
|
178
|
-
catch (error) {
|
|
179
|
-
return `docker info did not say where this Docker runs (${error.message}), so this server can't tell it is on this machine`;
|
|
180
|
-
}
|
|
181
|
-
const fields = answer.trim().split("|");
|
|
182
|
-
const [osType, kernel, root, name] = fields.map((field) => field.trim());
|
|
183
|
-
const shown = (text) => JSON.stringify(text.slice(0, 80));
|
|
184
|
-
if (fields.length !== 4 || !osType || !kernel || !root)
|
|
185
|
-
return `docker info's answer could not be read (${shown(answer.trim())}), so this server can't tell this Docker is on this machine`;
|
|
186
|
-
const runtime = name ? `this Docker (${name.slice(0, 80)})` : "this Docker";
|
|
187
|
-
if (osType !== "linux")
|
|
188
|
-
return `${runtime} runs ${shown(osType)} containers, not Linux ones on this machine, so it can't reach this server's egress proxy`;
|
|
189
|
-
const here = options.kernel ?? release();
|
|
190
|
-
if (kernel !== here)
|
|
191
|
-
return `${runtime} runs in a VM (its kernel is ${shown(kernel)}, this machine's ${shown(here)}) that can't reach this server's egress proxy yet`;
|
|
192
|
-
const sees = options.sees ?? ((dir) => {
|
|
193
|
-
try {
|
|
194
|
-
return statSync(dir).isDirectory();
|
|
195
|
-
}
|
|
196
|
-
catch {
|
|
197
|
-
return false;
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
// A server in a container whose Docker gives a box the data directory's mount (box-paths.ts): the proxy's socket is on
|
|
201
|
-
// that mount too, so the box reaches it, though the server sees none of Docker's own files.
|
|
202
|
-
if (!options.mapped && !sees(root))
|
|
203
|
-
return `${runtime} keeps its data in ${shown(root)}, which this server can't see: it runs on another machine's files (this server in a container, given the host's docker socket), so it can't reach this server's egress proxy`;
|
|
204
|
-
return undefined;
|
|
205
|
-
}
|
|
206
|
-
/** How old a run's proxy directory with no live socket must be before the start's sweep takes it: one just made, whose
|
|
207
|
-
* proxy is still starting, is not yet listening. */
|
|
208
|
-
export const STALE_EGRESS_MS = 60_000;
|
|
209
|
-
/**
|
|
210
|
-
* The start's sweep of this user's proxy directories (egressDir's parent): each whose socket refuses a connect (or has
|
|
211
|
-
* 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
|
|
212
|
-
* whose socket answers is a live run's, this server's or another's under this uid, and stays. Returns how many went.
|
|
213
|
-
*/
|
|
214
|
-
export async function sweepEgressDirs(uid = process.getuid?.() ?? 0, now = Date.now(), parent = hostParent(uid)) {
|
|
215
|
-
let names;
|
|
216
|
-
try {
|
|
217
|
-
const at = await lstat(parent);
|
|
218
|
-
if (!at.isDirectory() || at.isSymbolicLink() || at.uid !== uid)
|
|
219
|
-
return 0;
|
|
220
|
-
names = await readdir(parent);
|
|
221
|
-
}
|
|
222
|
-
catch {
|
|
223
|
-
return 0;
|
|
224
|
-
}
|
|
225
|
-
let removed = 0;
|
|
226
|
-
for (const name of names) {
|
|
227
|
-
if (!/^[0-9a-f]{16}$/.test(name))
|
|
228
|
-
continue;
|
|
229
|
-
const dir = join(parent, name);
|
|
230
|
-
try {
|
|
231
|
-
const at = await lstat(dir);
|
|
232
|
-
if (!at.isDirectory() || at.isSymbolicLink() || at.uid !== uid || now - at.mtimeMs < STALE_EGRESS_MS)
|
|
233
|
-
continue;
|
|
234
|
-
}
|
|
235
|
-
catch {
|
|
236
|
-
continue;
|
|
237
|
-
}
|
|
238
|
-
if (await answers(join(dir, EGRESS_SOCKET)))
|
|
239
|
-
continue;
|
|
240
|
-
await rm(dir, { recursive: true, force: true });
|
|
241
|
-
removed++;
|
|
242
|
-
}
|
|
243
|
-
return removed;
|
|
244
|
-
}
|
|
245
|
-
/** Whether a Unix socket at `path` takes a connection: no for a refusal or no such file, yes for anything else. */
|
|
246
|
-
function answers(path) {
|
|
247
|
-
return new Promise((resolve) => {
|
|
248
|
-
const socket = connect(path);
|
|
249
|
-
const timer = setTimeout(() => (socket.destroy(), resolve(true)), 2_000);
|
|
250
|
-
socket.once("connect", () => (clearTimeout(timer), socket.destroy(), resolve(true)));
|
|
251
|
-
socket.once("error", (error) => (clearTimeout(timer), resolve(error.code !== "ECONNREFUSED" && error.code !== "ENOENT")));
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
/** What the server hands a run's process: the list its box reaches, resolved (boxNetworkOf), or `none`. The run's
|
|
255
|
-
* process reads this, never AGENTRUN_BOX_ALLOW: unset, it is none. */
|
|
256
|
-
export const RUN_BOX_ALLOW_ENV = "AGENTRUN_RUN_BOX_ALLOW";
|
package/dist/box-relay-vm.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
-
/** One program started in a VM sandbox, in binary mode: the part of the SDK's process the relay carries. */
|
|
3
|
-
export type VmProcess = {
|
|
4
|
-
readonly stdin: {
|
|
5
|
-
writeBytes(bytes: Uint8Array): Promise<void>;
|
|
6
|
-
close(): Promise<void>;
|
|
7
|
-
};
|
|
8
|
-
readonly stdout: AsyncIterable<Uint8Array>;
|
|
9
|
-
readonly stderr: AsyncIterable<Uint8Array>;
|
|
10
|
-
wait(): Promise<number>;
|
|
11
|
-
};
|
|
12
|
-
/** The part of the SDK's sandbox the relay calls. */
|
|
13
|
-
export type VmSandbox = {
|
|
14
|
-
readonly sandboxId: string;
|
|
15
|
-
exec(command: string[], params: {
|
|
16
|
-
mode: "binary";
|
|
17
|
-
timeoutMs?: number;
|
|
18
|
-
workdir?: string;
|
|
19
|
-
}): Promise<VmProcess>;
|
|
20
|
-
poll(): Promise<number | null>;
|
|
21
|
-
getTags(): Promise<Record<string, string>>;
|
|
22
|
-
};
|
|
23
|
-
/** The part of the SDK's client the relay calls: a sandbox by its id. */
|
|
24
|
-
export type VmSdk = {
|
|
25
|
-
readonly sandboxes: {
|
|
26
|
-
fromId(id: string): Promise<VmSandbox>;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
/** The relay's handler of a run's VM calls, over the server's client `sdk`: `handle(runId, path, req, res)` answers the
|
|
30
|
-
* call at `path` (what follows `/runs/<id>/vm/`), the caller's token already checked. `drop(runId)` lets go of the run's
|
|
31
|
-
* programs (at its end). */
|
|
32
|
-
export declare function vmRelay(sdk: VmSdk, secrets?: () => readonly string[]): {
|
|
33
|
-
handle(runId: string, path: string, req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
34
|
-
drop(runId: string): void;
|
|
35
|
-
footprint(): {
|
|
36
|
-
programs: number;
|
|
37
|
-
starting: number;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
/** How the run's process's relay client waits on the relay: never on a clock of its own. A program's exit (`wait`) and
|
|
41
|
-
* its output streams take as long as the program runs, which its caller bounds (bash's timeout, and pi-transport's
|
|
42
|
-
* backstop over it); Node's own fetch would give up after 300 s with no answer or no bytes, failing a longer command
|
|
43
|
-
* as lost. */
|
|
44
|
-
export declare const RELAY_AGENT_OPTIONS: Readonly<{
|
|
45
|
-
headersTimeout: 0;
|
|
46
|
-
bodyTimeout: 0;
|
|
47
|
-
}>;
|
|
48
|
-
/** The SDK client a run's process hands pi-transport's VM provider: each call it makes of a box goes to the relay in data
|
|
49
|
-
* root `root`, with the run's own door token. It finds a sandbox and runs programs in it; it makes, lists and ends none. */
|
|
50
|
-
export declare function relayedVmSdk(root: string, runDir: string, runId: string, agentOptions?: {
|
|
51
|
-
headersTimeout: number;
|
|
52
|
-
bodyTimeout: number;
|
|
53
|
-
}): {
|
|
54
|
-
apps: {
|
|
55
|
-
fromName: () => never;
|
|
56
|
-
};
|
|
57
|
-
images: {
|
|
58
|
-
fromRegistry: () => never;
|
|
59
|
-
fromId: () => never;
|
|
60
|
-
};
|
|
61
|
-
sandboxes: {
|
|
62
|
-
create: () => never;
|
|
63
|
-
list: () => never;
|
|
64
|
-
fromId: (id: string) => Promise<{
|
|
65
|
-
sandboxId: string;
|
|
66
|
-
poll: () => Promise<number | null>;
|
|
67
|
-
getTags: () => Promise<Record<string, string>>;
|
|
68
|
-
terminate: () => Promise<number>;
|
|
69
|
-
exec: (command: string[], params: {
|
|
70
|
-
mode: "binary";
|
|
71
|
-
timeoutMs?: number;
|
|
72
|
-
workdir?: string;
|
|
73
|
-
}) => Promise<{
|
|
74
|
-
stdin: {
|
|
75
|
-
writeBytes: (bytes: Uint8Array) => Promise<void>;
|
|
76
|
-
close: () => Promise<undefined>;
|
|
77
|
-
};
|
|
78
|
-
stdout: AsyncIterable<Uint8Array<ArrayBufferLike>>;
|
|
79
|
-
stderr: AsyncIterable<Uint8Array<ArrayBufferLike>>;
|
|
80
|
-
wait: () => Promise<number>;
|
|
81
|
-
}>;
|
|
82
|
-
}>;
|
|
83
|
-
};
|
|
84
|
-
};
|