@sema-agent/server 1.185.0
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/LICENSE +102 -0
- package/README.md +207 -0
- package/deploy/sema-up/README.md +145 -0
- package/deploy/sema-up/chart/Chart.yaml +11 -0
- package/deploy/sema-up/chart/templates/gitea.yaml +63 -0
- package/deploy/sema-up/chart/templates/minio.yaml +62 -0
- package/deploy/sema-up/chart/templates/namespace-sandbox.yaml +9 -0
- package/deploy/sema-up/chart/templates/pg-cluster.yaml +57 -0
- package/deploy/sema-up/chart/templates/registry.yaml +88 -0
- package/deploy/sema-up/chart/templates/sandbox-rbac.yaml +45 -0
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +76 -0
- package/deploy/sema-up/chart/templates/server.yaml +88 -0
- package/deploy/sema-up/chart/values-full-single.yaml +9 -0
- package/deploy/sema-up/chart/values.yaml +100 -0
- package/deploy/sema-up/cluster-up.sh +432 -0
- package/deploy/sema-up/kube-up.sh +377 -0
- package/deploy/sema-up/lib/parse-machines.py +117 -0
- package/deploy/sema-up/machines.example.yaml +53 -0
- package/deploy/sema-up/preflight.sh +168 -0
- package/deploy/sema-up/sema-up.sh +758 -0
- package/deploy/sema-up/smoke.sh +100 -0
- package/deploy/sema-up/stack/compose.dataroot.yaml +16 -0
- package/deploy/sema-up/stack/compose.yaml +155 -0
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +189 -0
- package/dist/approval.d.ts +27 -0
- package/dist/approval.d.ts.map +1 -0
- package/dist/approval.js +127 -0
- package/dist/approval.js.map +1 -0
- package/dist/audit.d.ts +29 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +95 -0
- package/dist/audit.js.map +1 -0
- package/dist/auth-bridge.d.ts +29 -0
- package/dist/auth-bridge.d.ts.map +1 -0
- package/dist/auth-bridge.js +145 -0
- package/dist/auth-bridge.js.map +1 -0
- package/dist/bake-runner/main.d.ts +20 -0
- package/dist/bake-runner/main.d.ts.map +1 -0
- package/dist/bake-runner/main.js +216 -0
- package/dist/bake-runner/main.js.map +1 -0
- package/dist/bake-runner/protocol.d.ts +49 -0
- package/dist/bake-runner/protocol.d.ts.map +1 -0
- package/dist/bake-runner/protocol.js +86 -0
- package/dist/bake-runner/protocol.js.map +1 -0
- package/dist/bake-runner/runner.d.ts +86 -0
- package/dist/bake-runner/runner.d.ts.map +1 -0
- package/dist/bake-runner/runner.js +228 -0
- package/dist/bake-runner/runner.js.map +1 -0
- package/dist/bench/l8/artifact.d.ts +62 -0
- package/dist/bench/l8/artifact.d.ts.map +1 -0
- package/dist/bench/l8/artifact.js +129 -0
- package/dist/bench/l8/artifact.js.map +1 -0
- package/dist/bench/l8/escape.d.ts +18 -0
- package/dist/bench/l8/escape.d.ts.map +1 -0
- package/dist/bench/l8/escape.js +9 -0
- package/dist/bench/l8/escape.js.map +1 -0
- package/dist/bench/l8/index.d.ts +5 -0
- package/dist/bench/l8/index.d.ts.map +1 -0
- package/dist/bench/l8/index.js +5 -0
- package/dist/bench/l8/index.js.map +1 -0
- package/dist/bench/l8/probes.d.ts +75 -0
- package/dist/bench/l8/probes.d.ts.map +1 -0
- package/dist/bench/l8/probes.js +178 -0
- package/dist/bench/l8/probes.js.map +1 -0
- package/dist/bench/l8/run-probes.d.ts +21 -0
- package/dist/bench/l8/run-probes.d.ts.map +1 -0
- package/dist/bench/l8/run-probes.js +130 -0
- package/dist/bench/l8/run-probes.js.map +1 -0
- package/dist/bench/s1/arms.d.ts +84 -0
- package/dist/bench/s1/arms.d.ts.map +1 -0
- package/dist/bench/s1/arms.js +329 -0
- package/dist/bench/s1/arms.js.map +1 -0
- package/dist/bench/s1/live-deps.d.ts +25 -0
- package/dist/bench/s1/live-deps.d.ts.map +1 -0
- package/dist/bench/s1/live-deps.js +449 -0
- package/dist/bench/s1/live-deps.js.map +1 -0
- package/dist/bench/s1/oracle.d.ts +34 -0
- package/dist/bench/s1/oracle.d.ts.map +1 -0
- package/dist/bench/s1/oracle.js +29 -0
- package/dist/bench/s1/oracle.js.map +1 -0
- package/dist/bench/s1/repair-oracle-adapter.d.ts +9 -0
- package/dist/bench/s1/repair-oracle-adapter.d.ts.map +1 -0
- package/dist/bench/s1/repair-oracle-adapter.js +27 -0
- package/dist/bench/s1/repair-oracle-adapter.js.map +1 -0
- package/dist/bench/s1/reviewer.d.ts +31 -0
- package/dist/bench/s1/reviewer.d.ts.map +1 -0
- package/dist/bench/s1/reviewer.js +26 -0
- package/dist/bench/s1/reviewer.js.map +1 -0
- package/dist/bench/s1/row.d.ts +29 -0
- package/dist/bench/s1/row.d.ts.map +1 -0
- package/dist/bench/s1/row.js +55 -0
- package/dist/bench/s1/row.js.map +1 -0
- package/dist/bench/s1/run-firm.d.ts +49 -0
- package/dist/bench/s1/run-firm.d.ts.map +1 -0
- package/dist/bench/s1/run-firm.js +291 -0
- package/dist/bench/s1/run-firm.js.map +1 -0
- package/dist/bench/s1/runner-ctx.d.ts +44 -0
- package/dist/bench/s1/runner-ctx.d.ts.map +1 -0
- package/dist/bench/s1/runner-ctx.js +59 -0
- package/dist/bench/s1/runner-ctx.js.map +1 -0
- package/dist/bench/s1/tasks.d.ts +48 -0
- package/dist/bench/s1/tasks.d.ts.map +1 -0
- package/dist/bench/s1/tasks.js +194 -0
- package/dist/bench/s1/tasks.js.map +1 -0
- package/dist/boot-reclaim.d.ts +10 -0
- package/dist/boot-reclaim.d.ts.map +1 -0
- package/dist/boot-reclaim.js +13 -0
- package/dist/boot-reclaim.js.map +1 -0
- package/dist/brain.d.ts +8 -0
- package/dist/brain.d.ts.map +1 -0
- package/dist/brain.js +83 -0
- package/dist/brain.js.map +1 -0
- package/dist/budget.d.ts +25 -0
- package/dist/budget.d.ts.map +1 -0
- package/dist/budget.js +107 -0
- package/dist/budget.js.map +1 -0
- package/dist/capabilities/builtin-tools.d.ts +3 -0
- package/dist/capabilities/builtin-tools.d.ts.map +1 -0
- package/dist/capabilities/builtin-tools.js +11 -0
- package/dist/capabilities/builtin-tools.js.map +1 -0
- package/dist/capabilities/code-review-council.d.ts +21 -0
- package/dist/capabilities/code-review-council.d.ts.map +1 -0
- package/dist/capabilities/code-review-council.js +113 -0
- package/dist/capabilities/code-review-council.js.map +1 -0
- package/dist/capabilities/collab-wire.d.ts +34 -0
- package/dist/capabilities/collab-wire.d.ts.map +1 -0
- package/dist/capabilities/collab-wire.js +2 -0
- package/dist/capabilities/collab-wire.js.map +1 -0
- package/dist/capabilities/collab-workflows.d.ts +40 -0
- package/dist/capabilities/collab-workflows.d.ts.map +1 -0
- package/dist/capabilities/collab-workflows.js +90 -0
- package/dist/capabilities/collab-workflows.js.map +1 -0
- package/dist/capabilities/oa-tools.d.ts +9 -0
- package/dist/capabilities/oa-tools.d.ts.map +1 -0
- package/dist/capabilities/oa-tools.js +44 -0
- package/dist/capabilities/oa-tools.js.map +1 -0
- package/dist/capabilities/prompt.d.ts +3 -0
- package/dist/capabilities/prompt.d.ts.map +1 -0
- package/dist/capabilities/prompt.js +6 -0
- package/dist/capabilities/prompt.js.map +1 -0
- package/dist/capabilities/prompts/code-review.d.ts +11 -0
- package/dist/capabilities/prompts/code-review.d.ts.map +1 -0
- package/dist/capabilities/prompts/code-review.js +39 -0
- package/dist/capabilities/prompts/code-review.js.map +1 -0
- package/dist/capabilities/prompts/identity.d.ts +2 -0
- package/dist/capabilities/prompts/identity.d.ts.map +1 -0
- package/dist/capabilities/prompts/identity.js +6 -0
- package/dist/capabilities/prompts/identity.js.map +1 -0
- package/dist/capabilities/prompts/team.d.ts +6 -0
- package/dist/capabilities/prompts/team.d.ts.map +1 -0
- package/dist/capabilities/prompts/team.js +6 -0
- package/dist/capabilities/prompts/team.js.map +1 -0
- package/dist/capabilities/repo-tools.d.ts +19 -0
- package/dist/capabilities/repo-tools.d.ts.map +1 -0
- package/dist/capabilities/repo-tools.js +98 -0
- package/dist/capabilities/repo-tools.js.map +1 -0
- package/dist/capabilities/scenarios.d.ts +72 -0
- package/dist/capabilities/scenarios.d.ts.map +1 -0
- package/dist/capabilities/scenarios.js +241 -0
- package/dist/capabilities/scenarios.js.map +1 -0
- package/dist/capabilities/select-environment-tool.d.ts +22 -0
- package/dist/capabilities/select-environment-tool.d.ts.map +1 -0
- package/dist/capabilities/select-environment-tool.js +86 -0
- package/dist/capabilities/select-environment-tool.js.map +1 -0
- package/dist/capabilities/skills.d.ts +12 -0
- package/dist/capabilities/skills.d.ts.map +1 -0
- package/dist/capabilities/skills.js +50 -0
- package/dist/capabilities/skills.js.map +1 -0
- package/dist/capabilities/team.d.ts +31 -0
- package/dist/capabilities/team.d.ts.map +1 -0
- package/dist/capabilities/team.js +66 -0
- package/dist/capabilities/team.js.map +1 -0
- package/dist/config-provider.d.ts +47 -0
- package/dist/config-provider.d.ts.map +1 -0
- package/dist/config-provider.js +156 -0
- package/dist/config-provider.js.map +1 -0
- package/dist/config.d.ts +272 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +605 -0
- package/dist/config.js.map +1 -0
- package/dist/degenerate-instrument.d.ts +17 -0
- package/dist/degenerate-instrument.d.ts.map +1 -0
- package/dist/degenerate-instrument.js +113 -0
- package/dist/degenerate-instrument.js.map +1 -0
- package/dist/elicitation.d.ts +47 -0
- package/dist/elicitation.d.ts.map +1 -0
- package/dist/elicitation.js +151 -0
- package/dist/elicitation.js.map +1 -0
- package/dist/env-facts.d.ts +18 -0
- package/dist/env-facts.d.ts.map +1 -0
- package/dist/env-facts.js +26 -0
- package/dist/env-facts.js.map +1 -0
- package/dist/finance/cost-taxonomy.d.ts +34 -0
- package/dist/finance/cost-taxonomy.d.ts.map +1 -0
- package/dist/finance/cost-taxonomy.js +26 -0
- package/dist/finance/cost-taxonomy.js.map +1 -0
- package/dist/fleet/fleet-bus.d.ts +137 -0
- package/dist/fleet/fleet-bus.d.ts.map +1 -0
- package/dist/fleet/fleet-bus.js +249 -0
- package/dist/fleet/fleet-bus.js.map +1 -0
- package/dist/fleet-client.d.ts +50 -0
- package/dist/fleet-client.d.ts.map +1 -0
- package/dist/fleet-client.js +150 -0
- package/dist/fleet-client.js.map +1 -0
- package/dist/fleet-lease.d.ts +76 -0
- package/dist/fleet-lease.d.ts.map +1 -0
- package/dist/fleet-lease.js +124 -0
- package/dist/fleet-lease.js.map +1 -0
- package/dist/hooks/hook-runner.d.ts +41 -0
- package/dist/hooks/hook-runner.d.ts.map +1 -0
- package/dist/hooks/hook-runner.js +975 -0
- package/dist/hooks/hook-runner.js.map +1 -0
- package/dist/http/idempotency.d.ts +12 -0
- package/dist/http/idempotency.d.ts.map +1 -0
- package/dist/http/idempotency.js +49 -0
- package/dist/http/idempotency.js.map +1 -0
- package/dist/http/server.d.ts +185 -0
- package/dist/http/server.d.ts.map +1 -0
- package/dist/http/server.js +4845 -0
- package/dist/http/server.js.map +1 -0
- package/dist/http/wire-gate.d.ts +3 -0
- package/dist/http/wire-gate.d.ts.map +1 -0
- package/dist/http/wire-gate.js +6 -0
- package/dist/http/wire-gate.js.map +1 -0
- package/dist/images/bake-validate.d.ts +41 -0
- package/dist/images/bake-validate.d.ts.map +1 -0
- package/dist/images/bake-validate.js +183 -0
- package/dist/images/bake-validate.js.map +1 -0
- package/dist/images/manifest.d.ts +36 -0
- package/dist/images/manifest.d.ts.map +1 -0
- package/dist/images/manifest.js +69 -0
- package/dist/images/manifest.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/key-resolver.d.ts +5 -0
- package/dist/key-resolver.d.ts.map +1 -0
- package/dist/key-resolver.js +15 -0
- package/dist/key-resolver.js.map +1 -0
- package/dist/leader/diffout.d.ts +24 -0
- package/dist/leader/diffout.d.ts.map +1 -0
- package/dist/leader/diffout.js +54 -0
- package/dist/leader/diffout.js.map +1 -0
- package/dist/leader/diffup.d.ts +14 -0
- package/dist/leader/diffup.d.ts.map +1 -0
- package/dist/leader/diffup.js +81 -0
- package/dist/leader/diffup.js.map +1 -0
- package/dist/leader/endpoint.d.ts +30 -0
- package/dist/leader/endpoint.d.ts.map +1 -0
- package/dist/leader/endpoint.js +76 -0
- package/dist/leader/endpoint.js.map +1 -0
- package/dist/leader/fanout.d.ts +46 -0
- package/dist/leader/fanout.d.ts.map +1 -0
- package/dist/leader/fanout.js +109 -0
- package/dist/leader/fanout.js.map +1 -0
- package/dist/leader/grader-env-factory.d.ts +36 -0
- package/dist/leader/grader-env-factory.d.ts.map +1 -0
- package/dist/leader/grader-env-factory.js +73 -0
- package/dist/leader/grader-env-factory.js.map +1 -0
- package/dist/leader/leader.d.ts +102 -0
- package/dist/leader/leader.d.ts.map +1 -0
- package/dist/leader/leader.js +354 -0
- package/dist/leader/leader.js.map +1 -0
- package/dist/leader/merge.d.ts +109 -0
- package/dist/leader/merge.d.ts.map +1 -0
- package/dist/leader/merge.js +184 -0
- package/dist/leader/merge.js.map +1 -0
- package/dist/leader/planner.d.ts +26 -0
- package/dist/leader/planner.d.ts.map +1 -0
- package/dist/leader/planner.js +137 -0
- package/dist/leader/planner.js.map +1 -0
- package/dist/leader/repair-oracle.d.ts +34 -0
- package/dist/leader/repair-oracle.d.ts.map +1 -0
- package/dist/leader/repair-oracle.js +83 -0
- package/dist/leader/repair-oracle.js.map +1 -0
- package/dist/leader/repair-wire.d.ts +49 -0
- package/dist/leader/repair-wire.d.ts.map +1 -0
- package/dist/leader/repair-wire.js +90 -0
- package/dist/leader/repair-wire.js.map +1 -0
- package/dist/leader/wire.d.ts +66 -0
- package/dist/leader/wire.d.ts.map +1 -0
- package/dist/leader/wire.js +452 -0
- package/dist/leader/wire.js.map +1 -0
- package/dist/lsp/e2b-bridge.d.ts +8 -0
- package/dist/lsp/e2b-bridge.d.ts.map +1 -0
- package/dist/lsp/e2b-bridge.js +71 -0
- package/dist/lsp/e2b-bridge.js.map +1 -0
- package/dist/lsp/e2b-manager.d.ts +16 -0
- package/dist/lsp/e2b-manager.d.ts.map +1 -0
- package/dist/lsp/e2b-manager.js +49 -0
- package/dist/lsp/e2b-manager.js.map +1 -0
- package/dist/lsp/lsp-frames.d.ts +2 -0
- package/dist/lsp/lsp-frames.d.ts.map +1 -0
- package/dist/lsp/lsp-frames.js +25 -0
- package/dist/lsp/lsp-frames.js.map +1 -0
- package/dist/lsp/manager.d.ts +41 -0
- package/dist/lsp/manager.d.ts.map +1 -0
- package/dist/lsp/manager.js +84 -0
- package/dist/lsp/manager.js.map +1 -0
- package/dist/lsp/types.d.ts +2 -0
- package/dist/lsp/types.d.ts.map +1 -0
- package/dist/lsp/types.js +2 -0
- package/dist/lsp/types.js.map +1 -0
- package/dist/lsp/ws-transport.d.ts +28 -0
- package/dist/lsp/ws-transport.d.ts.map +1 -0
- package/dist/lsp/ws-transport.js +209 -0
- package/dist/lsp/ws-transport.js.map +1 -0
- package/dist/lsp-evict.d.ts +2 -0
- package/dist/lsp-evict.d.ts.map +1 -0
- package/dist/lsp-evict.js +14 -0
- package/dist/lsp-evict.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +1526 -0
- package/dist/main.js.map +1 -0
- package/dist/memory-export.d.ts +3 -0
- package/dist/memory-export.d.ts.map +1 -0
- package/dist/memory-export.js +8 -0
- package/dist/memory-export.js.map +1 -0
- package/dist/memory-sync-client.d.ts +29 -0
- package/dist/memory-sync-client.d.ts.map +1 -0
- package/dist/memory-sync-client.js +133 -0
- package/dist/memory-sync-client.js.map +1 -0
- package/dist/memory-sync.d.ts +41 -0
- package/dist/memory-sync.d.ts.map +1 -0
- package/dist/memory-sync.js +183 -0
- package/dist/memory-sync.js.map +1 -0
- package/dist/model-select.d.ts +8 -0
- package/dist/model-select.d.ts.map +1 -0
- package/dist/model-select.js +12 -0
- package/dist/model-select.js.map +1 -0
- package/dist/observability/cost-quota.d.ts +21 -0
- package/dist/observability/cost-quota.d.ts.map +1 -0
- package/dist/observability/cost-quota.js +42 -0
- package/dist/observability/cost-quota.js.map +1 -0
- package/dist/observability/logger.d.ts +9 -0
- package/dist/observability/logger.d.ts.map +1 -0
- package/dist/observability/logger.js +35 -0
- package/dist/observability/logger.js.map +1 -0
- package/dist/observability/metrics.d.ts +76 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +263 -0
- package/dist/observability/metrics.js.map +1 -0
- package/dist/observability/otel-exporter.d.ts +37 -0
- package/dist/observability/otel-exporter.d.ts.map +1 -0
- package/dist/observability/otel-exporter.js +95 -0
- package/dist/observability/otel-exporter.js.map +1 -0
- package/dist/observability/principal-context.d.ts +5 -0
- package/dist/observability/principal-context.d.ts.map +1 -0
- package/dist/observability/principal-context.js +9 -0
- package/dist/observability/principal-context.js.map +1 -0
- package/dist/observability/rate-limit.d.ts +18 -0
- package/dist/observability/rate-limit.d.ts.map +1 -0
- package/dist/observability/rate-limit.js +30 -0
- package/dist/observability/rate-limit.js.map +1 -0
- package/dist/observability/tool-trace.d.ts +6 -0
- package/dist/observability/tool-trace.d.ts.map +1 -0
- package/dist/observability/tool-trace.js +73 -0
- package/dist/observability/tool-trace.js.map +1 -0
- package/dist/orchestration/hardened-vm-runner.d.ts +26 -0
- package/dist/orchestration/hardened-vm-runner.d.ts.map +1 -0
- package/dist/orchestration/hardened-vm-runner.js +217 -0
- package/dist/orchestration/hardened-vm-runner.js.map +1 -0
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +4 -0
- package/dist/orchestration/hardened-vm-worker-runner.d.ts.map +1 -0
- package/dist/orchestration/hardened-vm-worker-runner.js +79 -0
- package/dist/orchestration/hardened-vm-worker-runner.js.map +1 -0
- package/dist/orchestration/hardened-vm-worker.d.ts +2 -0
- package/dist/orchestration/hardened-vm-worker.d.ts.map +1 -0
- package/dist/orchestration/hardened-vm-worker.js +80 -0
- package/dist/orchestration/hardened-vm-worker.js.map +1 -0
- package/dist/orchestration/subagent-steer.d.ts +12 -0
- package/dist/orchestration/subagent-steer.d.ts.map +1 -0
- package/dist/orchestration/subagent-steer.js +45 -0
- package/dist/orchestration/subagent-steer.js.map +1 -0
- package/dist/orchestration/workflow-agent-steer.d.ts +14 -0
- package/dist/orchestration/workflow-agent-steer.d.ts.map +1 -0
- package/dist/orchestration/workflow-agent-steer.js +41 -0
- package/dist/orchestration/workflow-agent-steer.js.map +1 -0
- package/dist/orchestration/workflow-completion-inbox.d.ts +101 -0
- package/dist/orchestration/workflow-completion-inbox.d.ts.map +1 -0
- package/dist/orchestration/workflow-completion-inbox.js +327 -0
- package/dist/orchestration/workflow-completion-inbox.js.map +1 -0
- package/dist/orchestration/workflow-notify-journal.d.ts +120 -0
- package/dist/orchestration/workflow-notify-journal.d.ts.map +1 -0
- package/dist/orchestration/workflow-notify-journal.js +297 -0
- package/dist/orchestration/workflow-notify-journal.js.map +1 -0
- package/dist/per-task-image.d.ts +27 -0
- package/dist/per-task-image.d.ts.map +1 -0
- package/dist/per-task-image.js +37 -0
- package/dist/per-task-image.js.map +1 -0
- package/dist/plan-cache-probe.d.ts +21 -0
- package/dist/plan-cache-probe.d.ts.map +1 -0
- package/dist/plan-cache-probe.js +79 -0
- package/dist/plan-cache-probe.js.map +1 -0
- package/dist/plugins/approval-exemption-store.d.ts +56 -0
- package/dist/plugins/approval-exemption-store.d.ts.map +1 -0
- package/dist/plugins/approval-exemption-store.js +216 -0
- package/dist/plugins/approval-exemption-store.js.map +1 -0
- package/dist/plugins/background-shell-support.d.ts +64 -0
- package/dist/plugins/background-shell-support.d.ts.map +1 -0
- package/dist/plugins/background-shell-support.js +235 -0
- package/dist/plugins/background-shell-support.js.map +1 -0
- package/dist/plugins/blob-backend.d.ts +44 -0
- package/dist/plugins/blob-backend.d.ts.map +1 -0
- package/dist/plugins/blob-backend.js +188 -0
- package/dist/plugins/blob-backend.js.map +1 -0
- package/dist/plugins/caching-session-store.d.ts +51 -0
- package/dist/plugins/caching-session-store.d.ts.map +1 -0
- package/dist/plugins/caching-session-store.js +142 -0
- package/dist/plugins/caching-session-store.js.map +1 -0
- package/dist/plugins/file-outcome-sink.d.ts +20 -0
- package/dist/plugins/file-outcome-sink.d.ts.map +1 -0
- package/dist/plugins/file-outcome-sink.js +14 -0
- package/dist/plugins/file-outcome-sink.js.map +1 -0
- package/dist/plugins/file-resume-anchor-store.d.ts +19 -0
- package/dist/plugins/file-resume-anchor-store.d.ts.map +1 -0
- package/dist/plugins/file-resume-anchor-store.js +103 -0
- package/dist/plugins/file-resume-anchor-store.js.map +1 -0
- package/dist/plugins/file-run-store.d.ts +95 -0
- package/dist/plugins/file-run-store.d.ts.map +1 -0
- package/dist/plugins/file-run-store.js +446 -0
- package/dist/plugins/file-run-store.js.map +1 -0
- package/dist/plugins/file-workflow-journal-store.d.ts +2 -0
- package/dist/plugins/file-workflow-journal-store.d.ts.map +1 -0
- package/dist/plugins/file-workflow-journal-store.js +2 -0
- package/dist/plugins/file-workflow-journal-store.js.map +1 -0
- package/dist/plugins/host-platform.d.ts +19 -0
- package/dist/plugins/host-platform.d.ts.map +1 -0
- package/dist/plugins/host-platform.js +71 -0
- package/dist/plugins/host-platform.js.map +1 -0
- package/dist/plugins/local-checkpoint-store.d.ts +41 -0
- package/dist/plugins/local-checkpoint-store.d.ts.map +1 -0
- package/dist/plugins/local-checkpoint-store.js +217 -0
- package/dist/plugins/local-checkpoint-store.js.map +1 -0
- package/dist/plugins/local-session-store.d.ts +69 -0
- package/dist/plugins/local-session-store.d.ts.map +1 -0
- package/dist/plugins/local-session-store.js +431 -0
- package/dist/plugins/local-session-store.js.map +1 -0
- package/dist/plugins/memory-engine-pg.d.ts +47 -0
- package/dist/plugins/memory-engine-pg.d.ts.map +1 -0
- package/dist/plugins/memory-engine-pg.js +306 -0
- package/dist/plugins/memory-engine-pg.js.map +1 -0
- package/dist/plugins/memory-engine-tidb.d.ts +40 -0
- package/dist/plugins/memory-engine-tidb.d.ts.map +1 -0
- package/dist/plugins/memory-engine-tidb.js +296 -0
- package/dist/plugins/memory-engine-tidb.js.map +1 -0
- package/dist/plugins/memory-engine-vector-util.d.ts +2 -0
- package/dist/plugins/memory-engine-vector-util.d.ts.map +1 -0
- package/dist/plugins/memory-engine-vector-util.js +2 -0
- package/dist/plugins/memory-engine-vector-util.js.map +1 -0
- package/dist/plugins/memory-resume-anchor-store.d.ts +12 -0
- package/dist/plugins/memory-resume-anchor-store.d.ts.map +1 -0
- package/dist/plugins/memory-resume-anchor-store.js +31 -0
- package/dist/plugins/memory-resume-anchor-store.js.map +1 -0
- package/dist/plugins/memory-run-store.d.ts +75 -0
- package/dist/plugins/memory-run-store.d.ts.map +1 -0
- package/dist/plugins/memory-run-store.js +267 -0
- package/dist/plugins/memory-run-store.js.map +1 -0
- package/dist/plugins/memory-sync-store-pg.d.ts +78 -0
- package/dist/plugins/memory-sync-store-pg.d.ts.map +1 -0
- package/dist/plugins/memory-sync-store-pg.js +152 -0
- package/dist/plugins/memory-sync-store-pg.js.map +1 -0
- package/dist/plugins/memory-sync-store-tidb.d.ts +32 -0
- package/dist/plugins/memory-sync-store-tidb.d.ts.map +1 -0
- package/dist/plugins/memory-sync-store-tidb.js +146 -0
- package/dist/plugins/memory-sync-store-tidb.js.map +1 -0
- package/dist/plugins/pg-approval-store.d.ts +28 -0
- package/dist/plugins/pg-approval-store.d.ts.map +1 -0
- package/dist/plugins/pg-approval-store.js +107 -0
- package/dist/plugins/pg-approval-store.js.map +1 -0
- package/dist/plugins/pg-breaker-state.d.ts +20 -0
- package/dist/plugins/pg-breaker-state.d.ts.map +1 -0
- package/dist/plugins/pg-breaker-state.js +89 -0
- package/dist/plugins/pg-breaker-state.js.map +1 -0
- package/dist/plugins/pg-checkpoint-store.d.ts +34 -0
- package/dist/plugins/pg-checkpoint-store.d.ts.map +1 -0
- package/dist/plugins/pg-checkpoint-store.js +193 -0
- package/dist/plugins/pg-checkpoint-store.js.map +1 -0
- package/dist/plugins/pg-cost-quota.d.ts +18 -0
- package/dist/plugins/pg-cost-quota.d.ts.map +1 -0
- package/dist/plugins/pg-cost-quota.js +189 -0
- package/dist/plugins/pg-cost-quota.js.map +1 -0
- package/dist/plugins/pg-file-snapshot-store.d.ts +26 -0
- package/dist/plugins/pg-file-snapshot-store.d.ts.map +1 -0
- package/dist/plugins/pg-file-snapshot-store.js +181 -0
- package/dist/plugins/pg-file-snapshot-store.js.map +1 -0
- package/dist/plugins/pg-image-bake.d.ts +42 -0
- package/dist/plugins/pg-image-bake.d.ts.map +1 -0
- package/dist/plugins/pg-image-bake.js +471 -0
- package/dist/plugins/pg-image-bake.js.map +1 -0
- package/dist/plugins/pg-image-index.d.ts +23 -0
- package/dist/plugins/pg-image-index.d.ts.map +1 -0
- package/dist/plugins/pg-image-index.js +252 -0
- package/dist/plugins/pg-image-index.js.map +1 -0
- package/dist/plugins/pg-outcome-ledger.d.ts +23 -0
- package/dist/plugins/pg-outcome-ledger.d.ts.map +1 -0
- package/dist/plugins/pg-outcome-ledger.js +102 -0
- package/dist/plugins/pg-outcome-ledger.js.map +1 -0
- package/dist/plugins/pg-pool.d.ts +7 -0
- package/dist/plugins/pg-pool.d.ts.map +1 -0
- package/dist/plugins/pg-pool.js +233 -0
- package/dist/plugins/pg-pool.js.map +1 -0
- package/dist/plugins/pg-rate-limiter.d.ts +49 -0
- package/dist/plugins/pg-rate-limiter.d.ts.map +1 -0
- package/dist/plugins/pg-rate-limiter.js +193 -0
- package/dist/plugins/pg-rate-limiter.js.map +1 -0
- package/dist/plugins/pg-resume-anchor-store.d.ts +14 -0
- package/dist/plugins/pg-resume-anchor-store.d.ts.map +1 -0
- package/dist/plugins/pg-resume-anchor-store.js +23 -0
- package/dist/plugins/pg-resume-anchor-store.js.map +1 -0
- package/dist/plugins/pg-run-store.d.ts +76 -0
- package/dist/plugins/pg-run-store.d.ts.map +1 -0
- package/dist/plugins/pg-run-store.js +301 -0
- package/dist/plugins/pg-run-store.js.map +1 -0
- package/dist/plugins/pg-session-policy-store.d.ts +12 -0
- package/dist/plugins/pg-session-policy-store.d.ts.map +1 -0
- package/dist/plugins/pg-session-policy-store.js +88 -0
- package/dist/plugins/pg-session-policy-store.js.map +1 -0
- package/dist/plugins/pg-session-storage.d.ts +59 -0
- package/dist/plugins/pg-session-storage.d.ts.map +1 -0
- package/dist/plugins/pg-session-storage.js +484 -0
- package/dist/plugins/pg-session-storage.js.map +1 -0
- package/dist/plugins/pg-session-store.d.ts +2 -0
- package/dist/plugins/pg-session-store.d.ts.map +1 -0
- package/dist/plugins/pg-session-store.js +2 -0
- package/dist/plugins/pg-session-store.js.map +1 -0
- package/dist/plugins/pg-tool-result-store.d.ts +16 -0
- package/dist/plugins/pg-tool-result-store.d.ts.map +1 -0
- package/dist/plugins/pg-tool-result-store.js +52 -0
- package/dist/plugins/pg-tool-result-store.js.map +1 -0
- package/dist/plugins/pg-workflow-journal-store.d.ts +11 -0
- package/dist/plugins/pg-workflow-journal-store.d.ts.map +1 -0
- package/dist/plugins/pg-workflow-journal-store.js +28 -0
- package/dist/plugins/pg-workflow-journal-store.js.map +1 -0
- package/dist/plugins/pg-workflow-run-store.d.ts +55 -0
- package/dist/plugins/pg-workflow-run-store.d.ts.map +1 -0
- package/dist/plugins/pg-workflow-run-store.js +216 -0
- package/dist/plugins/pg-workflow-run-store.js.map +1 -0
- package/dist/plugins/remote-env-adb.d.ts +119 -0
- package/dist/plugins/remote-env-adb.d.ts.map +1 -0
- package/dist/plugins/remote-env-adb.js +502 -0
- package/dist/plugins/remote-env-adb.js.map +1 -0
- package/dist/plugins/remote-env-e2b.d.ts +162 -0
- package/dist/plugins/remote-env-e2b.d.ts.map +1 -0
- package/dist/plugins/remote-env-e2b.js +931 -0
- package/dist/plugins/remote-env-e2b.js.map +1 -0
- package/dist/plugins/remote-env-host.d.ts +141 -0
- package/dist/plugins/remote-env-host.d.ts.map +1 -0
- package/dist/plugins/remote-env-host.js +868 -0
- package/dist/plugins/remote-env-host.js.map +1 -0
- package/dist/plugins/remote-env-k8s.d.ts +209 -0
- package/dist/plugins/remote-env-k8s.d.ts.map +1 -0
- package/dist/plugins/remote-env-k8s.js +1206 -0
- package/dist/plugins/remote-env-k8s.js.map +1 -0
- package/dist/plugins/remote-env-local-docker.d.ts +124 -0
- package/dist/plugins/remote-env-local-docker.d.ts.map +1 -0
- package/dist/plugins/remote-env-local-docker.js +597 -0
- package/dist/plugins/remote-env-local-docker.js.map +1 -0
- package/dist/plugins/remote-env-ssh.d.ts +122 -0
- package/dist/plugins/remote-env-ssh.d.ts.map +1 -0
- package/dist/plugins/remote-env-ssh.js +511 -0
- package/dist/plugins/remote-env-ssh.js.map +1 -0
- package/dist/plugins/remote-shell.d.ts +7 -0
- package/dist/plugins/remote-shell.d.ts.map +1 -0
- package/dist/plugins/remote-shell.js +25 -0
- package/dist/plugins/remote-shell.js.map +1 -0
- package/dist/plugins/s3-presign.d.ts +13 -0
- package/dist/plugins/s3-presign.d.ts.map +1 -0
- package/dist/plugins/s3-presign.js +55 -0
- package/dist/plugins/s3-presign.js.map +1 -0
- package/dist/plugins/scheduler-support.d.ts +39 -0
- package/dist/plugins/scheduler-support.d.ts.map +1 -0
- package/dist/plugins/scheduler-support.js +141 -0
- package/dist/plugins/scheduler-support.js.map +1 -0
- package/dist/plugins/session-store.d.ts +7 -0
- package/dist/plugins/session-store.d.ts.map +1 -0
- package/dist/plugins/session-store.js +14 -0
- package/dist/plugins/session-store.js.map +1 -0
- package/dist/plugins/store-backend.d.ts +88 -0
- package/dist/plugins/store-backend.d.ts.map +1 -0
- package/dist/plugins/store-backend.js +197 -0
- package/dist/plugins/store-backend.js.map +1 -0
- package/dist/plugins/tidb-approval-store.d.ts +39 -0
- package/dist/plugins/tidb-approval-store.d.ts.map +1 -0
- package/dist/plugins/tidb-approval-store.js +81 -0
- package/dist/plugins/tidb-approval-store.js.map +1 -0
- package/dist/plugins/tidb-breaker-state.d.ts +18 -0
- package/dist/plugins/tidb-breaker-state.d.ts.map +1 -0
- package/dist/plugins/tidb-breaker-state.js +75 -0
- package/dist/plugins/tidb-breaker-state.js.map +1 -0
- package/dist/plugins/tidb-checkpoint-store.d.ts +50 -0
- package/dist/plugins/tidb-checkpoint-store.d.ts.map +1 -0
- package/dist/plugins/tidb-checkpoint-store.js +196 -0
- package/dist/plugins/tidb-checkpoint-store.js.map +1 -0
- package/dist/plugins/tidb-cost-quota.d.ts +16 -0
- package/dist/plugins/tidb-cost-quota.d.ts.map +1 -0
- package/dist/plugins/tidb-cost-quota.js +34 -0
- package/dist/plugins/tidb-cost-quota.js.map +1 -0
- package/dist/plugins/tidb-file-snapshot-store.d.ts +26 -0
- package/dist/plugins/tidb-file-snapshot-store.d.ts.map +1 -0
- package/dist/plugins/tidb-file-snapshot-store.js +183 -0
- package/dist/plugins/tidb-file-snapshot-store.js.map +1 -0
- package/dist/plugins/tidb-image-bake.d.ts +102 -0
- package/dist/plugins/tidb-image-bake.d.ts.map +1 -0
- package/dist/plugins/tidb-image-bake.js +400 -0
- package/dist/plugins/tidb-image-bake.js.map +1 -0
- package/dist/plugins/tidb-image-index.d.ts +71 -0
- package/dist/plugins/tidb-image-index.d.ts.map +1 -0
- package/dist/plugins/tidb-image-index.js +192 -0
- package/dist/plugins/tidb-image-index.js.map +1 -0
- package/dist/plugins/tidb-outcome-ledger.d.ts +58 -0
- package/dist/plugins/tidb-outcome-ledger.d.ts.map +1 -0
- package/dist/plugins/tidb-outcome-ledger.js +98 -0
- package/dist/plugins/tidb-outcome-ledger.js.map +1 -0
- package/dist/plugins/tidb-pool.d.ts +11 -0
- package/dist/plugins/tidb-pool.d.ts.map +1 -0
- package/dist/plugins/tidb-pool.js +485 -0
- package/dist/plugins/tidb-pool.js.map +1 -0
- package/dist/plugins/tidb-rate-limiter.d.ts +15 -0
- package/dist/plugins/tidb-rate-limiter.d.ts.map +1 -0
- package/dist/plugins/tidb-rate-limiter.js +34 -0
- package/dist/plugins/tidb-rate-limiter.js.map +1 -0
- package/dist/plugins/tidb-resume-anchor-store.d.ts +14 -0
- package/dist/plugins/tidb-resume-anchor-store.d.ts.map +1 -0
- package/dist/plugins/tidb-resume-anchor-store.js +23 -0
- package/dist/plugins/tidb-resume-anchor-store.js.map +1 -0
- package/dist/plugins/tidb-run-store.d.ts +107 -0
- package/dist/plugins/tidb-run-store.d.ts.map +1 -0
- package/dist/plugins/tidb-run-store.js +321 -0
- package/dist/plugins/tidb-run-store.js.map +1 -0
- package/dist/plugins/tidb-session-policy-store.d.ts +12 -0
- package/dist/plugins/tidb-session-policy-store.d.ts.map +1 -0
- package/dist/plugins/tidb-session-policy-store.js +88 -0
- package/dist/plugins/tidb-session-policy-store.js.map +1 -0
- package/dist/plugins/tidb-session-storage.d.ts +15 -0
- package/dist/plugins/tidb-session-storage.d.ts.map +1 -0
- package/dist/plugins/tidb-session-storage.js +101 -0
- package/dist/plugins/tidb-session-storage.js.map +1 -0
- package/dist/plugins/tidb-session-store.d.ts +46 -0
- package/dist/plugins/tidb-session-store.d.ts.map +1 -0
- package/dist/plugins/tidb-session-store.js +360 -0
- package/dist/plugins/tidb-session-store.js.map +1 -0
- package/dist/plugins/tidb-tool-result-store.d.ts +15 -0
- package/dist/plugins/tidb-tool-result-store.d.ts.map +1 -0
- package/dist/plugins/tidb-tool-result-store.js +41 -0
- package/dist/plugins/tidb-tool-result-store.js.map +1 -0
- package/dist/plugins/tidb-workflow-journal-store.d.ts +11 -0
- package/dist/plugins/tidb-workflow-journal-store.d.ts.map +1 -0
- package/dist/plugins/tidb-workflow-journal-store.js +28 -0
- package/dist/plugins/tidb-workflow-journal-store.js.map +1 -0
- package/dist/plugins/tidb-workflow-run-store.d.ts +61 -0
- package/dist/plugins/tidb-workflow-run-store.d.ts.map +1 -0
- package/dist/plugins/tidb-workflow-run-store.js +227 -0
- package/dist/plugins/tidb-workflow-run-store.js.map +1 -0
- package/dist/plugins/web-search.d.ts +27 -0
- package/dist/plugins/web-search.d.ts.map +1 -0
- package/dist/plugins/web-search.js +143 -0
- package/dist/plugins/web-search.js.map +1 -0
- package/dist/plugins/workflow-journal-limits.d.ts +2 -0
- package/dist/plugins/workflow-journal-limits.d.ts.map +1 -0
- package/dist/plugins/workflow-journal-limits.js +2 -0
- package/dist/plugins/workflow-journal-limits.js.map +1 -0
- package/dist/plugins/worktree-isolation.d.ts +16 -0
- package/dist/plugins/worktree-isolation.d.ts.map +1 -0
- package/dist/plugins/worktree-isolation.js +55 -0
- package/dist/plugins/worktree-isolation.js.map +1 -0
- package/dist/plugins/write-behind-counter.d.ts +43 -0
- package/dist/plugins/write-behind-counter.d.ts.map +1 -0
- package/dist/plugins/write-behind-counter.js +144 -0
- package/dist/plugins/write-behind-counter.js.map +1 -0
- package/dist/project-memory.d.ts +14 -0
- package/dist/project-memory.d.ts.map +1 -0
- package/dist/project-memory.js +96 -0
- package/dist/project-memory.js.map +1 -0
- package/dist/question.d.ts +42 -0
- package/dist/question.d.ts.map +1 -0
- package/dist/question.js +140 -0
- package/dist/question.js.map +1 -0
- package/dist/resource-suspend.d.ts +11 -0
- package/dist/resource-suspend.d.ts.map +1 -0
- package/dist/resource-suspend.js +6 -0
- package/dist/resource-suspend.js.map +1 -0
- package/dist/router/route-orchestration.d.ts +31 -0
- package/dist/router/route-orchestration.d.ts.map +1 -0
- package/dist/router/route-orchestration.js +49 -0
- package/dist/router/route-orchestration.js.map +1 -0
- package/dist/run-local.d.ts +26 -0
- package/dist/run-local.d.ts.map +1 -0
- package/dist/run-local.js +337 -0
- package/dist/run-local.js.map +1 -0
- package/dist/runs.d.ts +39 -0
- package/dist/runs.d.ts.map +1 -0
- package/dist/runs.js +392 -0
- package/dist/runs.js.map +1 -0
- package/dist/runtime-caps-resolver.d.ts +32 -0
- package/dist/runtime-caps-resolver.d.ts.map +1 -0
- package/dist/runtime-caps-resolver.js +134 -0
- package/dist/runtime-caps-resolver.js.map +1 -0
- package/dist/runtime-governance.d.ts +18 -0
- package/dist/runtime-governance.d.ts.map +1 -0
- package/dist/runtime-governance.js +103 -0
- package/dist/runtime-governance.js.map +1 -0
- package/dist/sandbox-pkg-source.d.ts +11 -0
- package/dist/sandbox-pkg-source.d.ts.map +1 -0
- package/dist/sandbox-pkg-source.js +56 -0
- package/dist/sandbox-pkg-source.js.map +1 -0
- package/dist/sealed-key.d.ts +29 -0
- package/dist/sealed-key.d.ts.map +1 -0
- package/dist/sealed-key.js +122 -0
- package/dist/sealed-key.js.map +1 -0
- package/dist/security.d.ts +153 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +292 -0
- package/dist/security.js.map +1 -0
- package/dist/sema-registry.d.ts +187 -0
- package/dist/sema-registry.d.ts.map +1 -0
- package/dist/sema-registry.js +456 -0
- package/dist/sema-registry.js.map +1 -0
- package/dist/session-sync.d.ts +96 -0
- package/dist/session-sync.d.ts.map +1 -0
- package/dist/session-sync.js +181 -0
- package/dist/session-sync.js.map +1 -0
- package/dist/session-titler.d.ts +30 -0
- package/dist/session-titler.d.ts.map +1 -0
- package/dist/session-titler.js +77 -0
- package/dist/session-titler.js.map +1 -0
- package/dist/spec-fields.d.ts +5 -0
- package/dist/spec-fields.d.ts.map +1 -0
- package/dist/spec-fields.js +43 -0
- package/dist/spec-fields.js.map +1 -0
- package/dist/task-cwd.d.ts +15 -0
- package/dist/task-cwd.d.ts.map +1 -0
- package/dist/task-cwd.js +33 -0
- package/dist/task-cwd.js.map +1 -0
- package/dist/task-mcp.d.ts +20 -0
- package/dist/task-mcp.d.ts.map +1 -0
- package/dist/task-mcp.js +93 -0
- package/dist/task-mcp.js.map +1 -0
- package/dist/task-settings.d.ts +36 -0
- package/dist/task-settings.d.ts.map +1 -0
- package/dist/task-settings.js +141 -0
- package/dist/task-settings.js.map +1 -0
- package/dist/task-workflow.d.ts +25 -0
- package/dist/task-workflow.d.ts.map +1 -0
- package/dist/task-workflow.js +43 -0
- package/dist/task-workflow.js.map +1 -0
- package/dist/trace/artifacts.d.ts +17 -0
- package/dist/trace/artifacts.d.ts.map +1 -0
- package/dist/trace/artifacts.js +65 -0
- package/dist/trace/artifacts.js.map +1 -0
- package/dist/trace/project.d.ts +170 -0
- package/dist/trace/project.d.ts.map +1 -0
- package/dist/trace/project.js +239 -0
- package/dist/trace/project.js.map +1 -0
- package/dist/trace/redact.d.ts +5 -0
- package/dist/trace/redact.d.ts.map +1 -0
- package/dist/trace/redact.js +83 -0
- package/dist/trace/redact.js.map +1 -0
- package/dist/usage-analytics.d.ts +36 -0
- package/dist/usage-analytics.d.ts.map +1 -0
- package/dist/usage-analytics.js +89 -0
- package/dist/usage-analytics.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { FileError, ExecutionError, RemoteExecutionError, type ExecutionEnv, type RemoteExecutionEnv, type WorkspaceHandle, type FileInfo, type Result, type OutputChunk, type ExecStreamOptions, type RemoteConnectConfig, type SnapshotId, type SessionToken, type VmLifecycleOptions, type ExecutionEnvFactory } from "@sema-agent/core";
|
|
2
|
+
type ExecOpts = Parameters<ExecutionEnv["exec"]>[1];
|
|
3
|
+
export interface SshEnvConfig {
|
|
4
|
+
host: string;
|
|
5
|
+
port?: number;
|
|
6
|
+
username: string;
|
|
7
|
+
privateKey: string;
|
|
8
|
+
passphrase?: string;
|
|
9
|
+
mountPath?: string;
|
|
10
|
+
readyTimeoutMs?: number;
|
|
11
|
+
commandTimeoutMs?: number;
|
|
12
|
+
dataTimeoutMs?: number;
|
|
13
|
+
retry?: {
|
|
14
|
+
maxAttempts?: number;
|
|
15
|
+
backoffMs?: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
type ConnectResult = {
|
|
19
|
+
ok: true;
|
|
20
|
+
value: WorkspaceHandle;
|
|
21
|
+
} | {
|
|
22
|
+
ok: false;
|
|
23
|
+
error: RemoteExecutionError;
|
|
24
|
+
};
|
|
25
|
+
export interface SshEnvDeps {
|
|
26
|
+
connectOnce?: (signal?: AbortSignal) => Promise<ConnectResult>;
|
|
27
|
+
}
|
|
28
|
+
export declare class RemoteSshExecutionEnv implements RemoteExecutionEnv {
|
|
29
|
+
readonly capabilities: {
|
|
30
|
+
isolation: boolean;
|
|
31
|
+
suspendable: boolean;
|
|
32
|
+
};
|
|
33
|
+
cwd: string;
|
|
34
|
+
private conn?;
|
|
35
|
+
private sftpPromise?;
|
|
36
|
+
private readonly cfg;
|
|
37
|
+
private readonly injectedConnectOnce?;
|
|
38
|
+
constructor(config: SshEnvConfig, deps?: SshEnvDeps);
|
|
39
|
+
private resolve;
|
|
40
|
+
workspaceHandle(): WorkspaceHandle;
|
|
41
|
+
connect(config?: RemoteConnectConfig): Promise<{
|
|
42
|
+
ok: true;
|
|
43
|
+
value: WorkspaceHandle;
|
|
44
|
+
} | {
|
|
45
|
+
ok: false;
|
|
46
|
+
error: RemoteExecutionError;
|
|
47
|
+
}>;
|
|
48
|
+
private connectOnce;
|
|
49
|
+
suspendVM(_options?: VmLifecycleOptions): Promise<{
|
|
50
|
+
ok: true;
|
|
51
|
+
value: SnapshotId;
|
|
52
|
+
} | {
|
|
53
|
+
ok: false;
|
|
54
|
+
error: RemoteExecutionError;
|
|
55
|
+
}>;
|
|
56
|
+
resumeVM(_snapshotId: SnapshotId, _options?: VmLifecycleOptions): Promise<{
|
|
57
|
+
ok: true;
|
|
58
|
+
value: WorkspaceHandle;
|
|
59
|
+
} | {
|
|
60
|
+
ok: false;
|
|
61
|
+
error: RemoteExecutionError;
|
|
62
|
+
}>;
|
|
63
|
+
postResumeInit(): Promise<{
|
|
64
|
+
ok: true;
|
|
65
|
+
value: void;
|
|
66
|
+
} | {
|
|
67
|
+
ok: false;
|
|
68
|
+
error: RemoteExecutionError;
|
|
69
|
+
}>;
|
|
70
|
+
reconnect(_sessionToken: SessionToken): Promise<{
|
|
71
|
+
ok: true;
|
|
72
|
+
value: WorkspaceHandle;
|
|
73
|
+
} | {
|
|
74
|
+
ok: false;
|
|
75
|
+
error: RemoteExecutionError;
|
|
76
|
+
}>;
|
|
77
|
+
destroy(): Promise<void>;
|
|
78
|
+
cleanup(): Promise<void>;
|
|
79
|
+
exec(command: string, options?: ExecOpts): Promise<Result<{
|
|
80
|
+
stdout: string;
|
|
81
|
+
stderr: string;
|
|
82
|
+
exitCode: number;
|
|
83
|
+
}, ExecutionError>>;
|
|
84
|
+
execStream(command: string, options?: ExecStreamOptions): AsyncIterable<OutputChunk>;
|
|
85
|
+
private sftp;
|
|
86
|
+
absolutePath(p: string): Promise<Result<string, FileError>>;
|
|
87
|
+
joinPath(parts: string[]): Promise<Result<string, FileError>>;
|
|
88
|
+
readTextFile(p: string, abortSignal?: AbortSignal): Promise<Result<string, FileError>>;
|
|
89
|
+
readTextLines(p: string, options?: {
|
|
90
|
+
maxLines?: number;
|
|
91
|
+
abortSignal?: AbortSignal;
|
|
92
|
+
}): Promise<Result<string[], FileError>>;
|
|
93
|
+
readBinaryFile(p: string, abortSignal?: AbortSignal): Promise<Result<Uint8Array, FileError>>;
|
|
94
|
+
writeFile(p: string, content: string | Uint8Array, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;
|
|
95
|
+
appendFile(p: string, content: string | Uint8Array, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;
|
|
96
|
+
fileInfo(p: string, abortSignal?: AbortSignal): Promise<Result<FileInfo, FileError>>;
|
|
97
|
+
listDir(p: string, abortSignal?: AbortSignal): Promise<Result<FileInfo[], FileError>>;
|
|
98
|
+
canonicalPath(p: string, abortSignal?: AbortSignal): Promise<Result<string, FileError>>;
|
|
99
|
+
exists(p: string, abortSignal?: AbortSignal): Promise<Result<boolean, FileError>>;
|
|
100
|
+
createDir(p: string, options?: {
|
|
101
|
+
recursive?: boolean;
|
|
102
|
+
abortSignal?: AbortSignal;
|
|
103
|
+
}): Promise<Result<void, FileError>>;
|
|
104
|
+
remove(p: string, options?: {
|
|
105
|
+
recursive?: boolean;
|
|
106
|
+
force?: boolean;
|
|
107
|
+
abortSignal?: AbortSignal;
|
|
108
|
+
}): Promise<Result<void, FileError>>;
|
|
109
|
+
createTempDir(prefix?: string, abortSignal?: AbortSignal): Promise<Result<string, FileError>>;
|
|
110
|
+
createTempFile(options?: {
|
|
111
|
+
prefix?: string;
|
|
112
|
+
suffix?: string;
|
|
113
|
+
abortSignal?: AbortSignal;
|
|
114
|
+
}): Promise<Result<string, FileError>>;
|
|
115
|
+
private withCwdEnv;
|
|
116
|
+
private tempResult;
|
|
117
|
+
private connErr;
|
|
118
|
+
private fileError;
|
|
119
|
+
}
|
|
120
|
+
export declare function sshExecutionEnvFactory(config: SshEnvConfig): ExecutionEnvFactory;
|
|
121
|
+
export {};
|
|
122
|
+
//# sourceMappingURL=remote-env-ssh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-env-ssh.d.ts","sourceRoot":"","sources":["../../src/plugins/remote-env-ssh.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,SAAS,EACT,cAAc,EACd,oBAAoB,EAIpB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,YAAY,EAEjB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAEzB,MAAM,kBAAkB,CAAC;AAE1B,KAAK,QAAQ,GAAG,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAQpD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IAEjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,KAAK,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACtD;AAED,KAAK,aAAa,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAOvG,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;CAChE;AAED,qBAAa,qBAAsB,YAAW,kBAAkB;IAC9D,QAAQ,CAAC,YAAY;;;MAA4C;IAEjE,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,IAAI,CAAC,CAAS;IACtB,OAAO,CAAC,WAAW,CAAC,CAAuB;IAC3C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAkJ;IACtK,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAmD;gBAE5E,MAAM,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,UAAU;IAiBnD,OAAO,CAAC,OAAO;IAIf,eAAe,IAAI,eAAe;IAM5B,OAAO,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,eAAe,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,oBAAoB,CAAA;KAAE,CAAC;IAUvI,OAAO,CAAC,WAAW;IAwCb,SAAS,CAAC,QAAQ,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,oBAAoB,CAAA;KAAE,CAAC;IAG/H,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,eAAe,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,oBAAoB,CAAA;KAAE,CAAC;IAG5J,cAAc,IAAI,OAAO,CAAC;QAAE,EAAE,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,IAAI,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,oBAAoB,CAAA;KAAE,CAAC;IAKjG,SAAS,CAAC,aAAa,EAAE,YAAY,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,eAAe,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,oBAAoB,CAAA;KAAE,CAAC;IAQlI,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IASxB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAMxB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,cAAc,CAAC,CAAC;IA0E/H,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,aAAa,CAAC,WAAW,CAAC;IAsH3F,OAAO,CAAC,IAAI;IAUN,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAG3D,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAI7D,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAKtF,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,SAAS,CAAC,CAAC;IAS1H,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAW5F,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAkB/G,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAchH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAWpF,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC;IAgBrF,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAavF,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAOjF,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAapH,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAelI,aAAa,CAAC,MAAM,SAAS,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAI7F,cAAc,CAAC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAUnI,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,OAAO;IASf,OAAO,CAAC,SAAS;CAUlB;AAOD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,YAAY,GAAG,mBAAmB,CAEhF"}
|
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { Client } from "ssh2";
|
|
3
|
+
import { shellQuote, kindFromMode } from "./remote-shell.js";
|
|
4
|
+
import { FileError, ExecutionError, RemoteExecutionError, withRetry, RollingTailBuffer, markTruncated, } from "@sema-agent/core";
|
|
5
|
+
const PROVIDER = "ssh";
|
|
6
|
+
const ok = (value) => ({ ok: true, value });
|
|
7
|
+
const unsupported = (op) => ({
|
|
8
|
+
ok: false,
|
|
9
|
+
error: new RemoteExecutionError("unsupported", `${op} is not supported on an SSH target (real machine — not snapshotable; capabilities.suspendable=false)`),
|
|
10
|
+
});
|
|
11
|
+
export class RemoteSshExecutionEnv {
|
|
12
|
+
capabilities = { isolation: false, suspendable: false };
|
|
13
|
+
cwd;
|
|
14
|
+
conn;
|
|
15
|
+
sftpPromise;
|
|
16
|
+
cfg;
|
|
17
|
+
injectedConnectOnce;
|
|
18
|
+
constructor(config, deps) {
|
|
19
|
+
this.injectedConnectOnce = deps?.connectOnce;
|
|
20
|
+
this.cfg = {
|
|
21
|
+
host: config.host,
|
|
22
|
+
port: config.port ?? 22,
|
|
23
|
+
username: config.username,
|
|
24
|
+
privateKey: config.privateKey,
|
|
25
|
+
passphrase: config.passphrase,
|
|
26
|
+
mountPath: config.mountPath ?? ".",
|
|
27
|
+
readyTimeoutMs: config.readyTimeoutMs ?? 15_000,
|
|
28
|
+
commandTimeoutMs: config.commandTimeoutMs ?? 5 * 60_000,
|
|
29
|
+
dataTimeoutMs: config.dataTimeoutMs ?? 5 * 60_000,
|
|
30
|
+
retry: { maxAttempts: config.retry?.maxAttempts ?? 3, backoffMs: config.retry?.backoffMs ?? 500 },
|
|
31
|
+
};
|
|
32
|
+
this.cwd = this.cfg.mountPath;
|
|
33
|
+
}
|
|
34
|
+
resolve(p) {
|
|
35
|
+
return path.posix.isAbsolute(p) ? path.posix.normalize(p) : path.posix.normalize(path.posix.join(this.cwd, p));
|
|
36
|
+
}
|
|
37
|
+
workspaceHandle() {
|
|
38
|
+
return { sandboxId: `${this.cfg.host}:${this.cfg.port}`, provider: PROVIDER, mountPath: this.cwd };
|
|
39
|
+
}
|
|
40
|
+
async connect(config) {
|
|
41
|
+
const policy = {
|
|
42
|
+
retryableCodes: ["connect_failed", "timeout"],
|
|
43
|
+
maxAttempts: this.cfg.retry.maxAttempts,
|
|
44
|
+
backoffMs: (failed) => this.cfg.retry.backoffMs * failed,
|
|
45
|
+
};
|
|
46
|
+
const once = this.injectedConnectOnce ?? ((s) => this.connectOnce(s));
|
|
47
|
+
return withRetry((_attempt) => once(config?.abortSignal), policy, { signal: config?.abortSignal });
|
|
48
|
+
}
|
|
49
|
+
connectOnce(signal) {
|
|
50
|
+
return new Promise((resolve) => {
|
|
51
|
+
if (signal?.aborted)
|
|
52
|
+
return resolve({ ok: false, error: new RemoteExecutionError("aborted", "connect aborted") });
|
|
53
|
+
const c = new Client();
|
|
54
|
+
const opts = {
|
|
55
|
+
host: this.cfg.host,
|
|
56
|
+
port: this.cfg.port,
|
|
57
|
+
username: this.cfg.username,
|
|
58
|
+
privateKey: this.cfg.privateKey,
|
|
59
|
+
...(this.cfg.passphrase ? { passphrase: this.cfg.passphrase } : {}),
|
|
60
|
+
readyTimeout: this.cfg.readyTimeoutMs,
|
|
61
|
+
};
|
|
62
|
+
c.on("ready", () => {
|
|
63
|
+
this.conn = c;
|
|
64
|
+
this.sftpPromise = undefined;
|
|
65
|
+
c.on("close", () => {
|
|
66
|
+
if (this.conn === c) {
|
|
67
|
+
this.conn = undefined;
|
|
68
|
+
this.sftpPromise = undefined;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
resolve({ ok: true, value: this.workspaceHandle() });
|
|
72
|
+
}).on("error", (e) => {
|
|
73
|
+
try {
|
|
74
|
+
c.end();
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
}
|
|
78
|
+
resolve({ ok: false, error: this.connErr(e) });
|
|
79
|
+
});
|
|
80
|
+
try {
|
|
81
|
+
c.connect(opts);
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
resolve({ ok: false, error: this.connErr(e) });
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
async suspendVM(_options) {
|
|
89
|
+
return unsupported("suspendVM");
|
|
90
|
+
}
|
|
91
|
+
async resumeVM(_snapshotId, _options) {
|
|
92
|
+
return unsupported("resumeVM");
|
|
93
|
+
}
|
|
94
|
+
async postResumeInit() {
|
|
95
|
+
return unsupported("postResumeInit");
|
|
96
|
+
}
|
|
97
|
+
async reconnect(_sessionToken) {
|
|
98
|
+
this.conn?.end();
|
|
99
|
+
this.conn = undefined;
|
|
100
|
+
this.sftpPromise = undefined;
|
|
101
|
+
return this.connect();
|
|
102
|
+
}
|
|
103
|
+
async destroy() {
|
|
104
|
+
try {
|
|
105
|
+
this.conn?.end();
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
}
|
|
109
|
+
this.conn = undefined;
|
|
110
|
+
this.sftpPromise = undefined;
|
|
111
|
+
}
|
|
112
|
+
async cleanup() {
|
|
113
|
+
return this.destroy();
|
|
114
|
+
}
|
|
115
|
+
async exec(command, options) {
|
|
116
|
+
const conn = this.conn;
|
|
117
|
+
if (!conn)
|
|
118
|
+
return { ok: false, error: new ExecutionError("shell_unavailable", "SSH not connected — call connect() first") };
|
|
119
|
+
const timeoutMs = options?.timeout != null ? options.timeout * 1000 : this.cfg.commandTimeoutMs;
|
|
120
|
+
return new Promise((resolve) => {
|
|
121
|
+
const outBuf = new RollingTailBuffer();
|
|
122
|
+
const errBuf = new RollingTailBuffer();
|
|
123
|
+
let settled = false;
|
|
124
|
+
let streamRef;
|
|
125
|
+
const finish = (r) => {
|
|
126
|
+
if (settled)
|
|
127
|
+
return;
|
|
128
|
+
settled = true;
|
|
129
|
+
clearTimeout(timer);
|
|
130
|
+
options?.abortSignal?.removeEventListener("abort", onAbort);
|
|
131
|
+
conn.removeListener("close", onConnClose);
|
|
132
|
+
try {
|
|
133
|
+
streamRef?.close();
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
}
|
|
137
|
+
resolve(r);
|
|
138
|
+
};
|
|
139
|
+
const timer = setTimeout(() => finish({ ok: false, error: new ExecutionError("timeout", `ssh exec exceeded ${timeoutMs}ms (provider/command hang)`) }), timeoutMs);
|
|
140
|
+
const onAbort = () => finish({ ok: false, error: new ExecutionError("aborted", "ssh exec aborted") });
|
|
141
|
+
const onConnClose = () => finish({ ok: false, error: new ExecutionError("transport_lost", "ssh transport lost mid-command (connection closed before exit status) — reconnect + retry per idempotency") });
|
|
142
|
+
conn.once("close", onConnClose);
|
|
143
|
+
if (options?.abortSignal) {
|
|
144
|
+
if (options.abortSignal.aborted)
|
|
145
|
+
return onAbort();
|
|
146
|
+
options.abortSignal.addEventListener("abort", onAbort, { once: true });
|
|
147
|
+
}
|
|
148
|
+
const full = this.withCwdEnv(command, options?.cwd, options?.env);
|
|
149
|
+
conn.exec(full, (err, stream) => {
|
|
150
|
+
if (err)
|
|
151
|
+
return finish({ ok: false, error: new ExecutionError("spawn_error", `ssh exec failed: ${err.message}`, err) });
|
|
152
|
+
streamRef = stream;
|
|
153
|
+
if (settled) {
|
|
154
|
+
try {
|
|
155
|
+
stream.close();
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
}
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
stream
|
|
162
|
+
.on("data", (d) => {
|
|
163
|
+
outBuf.push(d);
|
|
164
|
+
options?.onStdout?.(d.toString());
|
|
165
|
+
})
|
|
166
|
+
.on("close", (code, signal) => {
|
|
167
|
+
if (code == null && !signal) {
|
|
168
|
+
return finish({ ok: false, error: new ExecutionError("transport_lost", "ssh channel closed without exit status (transport lost / connection dropped)") });
|
|
169
|
+
}
|
|
170
|
+
const out = outBuf.result();
|
|
171
|
+
const err = errBuf.result();
|
|
172
|
+
finish(ok({ stdout: markTruncated(out.text, out.droppedBytes), stderr: markTruncated(err.text, err.droppedBytes), exitCode: code ?? 0 }));
|
|
173
|
+
})
|
|
174
|
+
.stderr.on("data", (d) => {
|
|
175
|
+
errBuf.push(d);
|
|
176
|
+
options?.onStderr?.(d.toString());
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
async *execStream(command, options) {
|
|
182
|
+
const conn = this.conn;
|
|
183
|
+
if (!conn)
|
|
184
|
+
throw new RemoteExecutionError("connect_failed", "SSH not connected — call connect() first");
|
|
185
|
+
const queue = [];
|
|
186
|
+
let finished = false;
|
|
187
|
+
let failure;
|
|
188
|
+
let exitCode = 0;
|
|
189
|
+
let wake;
|
|
190
|
+
const signalReady = () => {
|
|
191
|
+
const w = wake;
|
|
192
|
+
wake = undefined;
|
|
193
|
+
w?.();
|
|
194
|
+
};
|
|
195
|
+
let lastChunk = Date.now();
|
|
196
|
+
const idleMs = options?.readTimeoutMs;
|
|
197
|
+
let streamRef;
|
|
198
|
+
let onAbort;
|
|
199
|
+
let paused = false;
|
|
200
|
+
let done = false;
|
|
201
|
+
const onConnClose = () => {
|
|
202
|
+
if (!finished) {
|
|
203
|
+
failure = failure ?? new RemoteExecutionError("transport_lost", "ssh transport lost mid-stream (connection closed) — reconnect + retry per idempotency");
|
|
204
|
+
finished = true;
|
|
205
|
+
signalReady();
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
conn.once("close", onConnClose);
|
|
209
|
+
const teardown = () => {
|
|
210
|
+
done = true;
|
|
211
|
+
conn.removeListener("close", onConnClose);
|
|
212
|
+
if (onAbort) {
|
|
213
|
+
options?.signal?.removeEventListener("abort", onAbort);
|
|
214
|
+
onAbort = undefined;
|
|
215
|
+
}
|
|
216
|
+
try {
|
|
217
|
+
streamRef?.close();
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
const full = this.withCwdEnv(command, options?.cwd, options?.env);
|
|
223
|
+
conn.exec(full, (err, stream) => {
|
|
224
|
+
if (err) {
|
|
225
|
+
failure = new RemoteExecutionError("unknown", `ssh exec failed: ${err.message}`, err);
|
|
226
|
+
finished = true;
|
|
227
|
+
signalReady();
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
streamRef = stream;
|
|
231
|
+
if (done) {
|
|
232
|
+
try {
|
|
233
|
+
stream.close();
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
}
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (options?.signal) {
|
|
240
|
+
onAbort = () => {
|
|
241
|
+
failure = new RemoteExecutionError("aborted", "execStream aborted");
|
|
242
|
+
finished = true;
|
|
243
|
+
signalReady();
|
|
244
|
+
};
|
|
245
|
+
if (options.signal.aborted)
|
|
246
|
+
onAbort();
|
|
247
|
+
else
|
|
248
|
+
options.signal.addEventListener("abort", onAbort, { once: true });
|
|
249
|
+
}
|
|
250
|
+
const enqueue = (chunk) => {
|
|
251
|
+
lastChunk = Date.now();
|
|
252
|
+
queue.push(chunk);
|
|
253
|
+
if (queue.length >= 512 && !paused) {
|
|
254
|
+
paused = true;
|
|
255
|
+
stream.pause();
|
|
256
|
+
}
|
|
257
|
+
signalReady();
|
|
258
|
+
};
|
|
259
|
+
stream
|
|
260
|
+
.on("data", (d) => enqueue({ type: "stdout", data: d.toString() }))
|
|
261
|
+
.on("close", (code, signal) => {
|
|
262
|
+
if (code == null && !signal && !failure) {
|
|
263
|
+
failure = new RemoteExecutionError("transport_lost", "ssh channel closed without exit status (transport lost)");
|
|
264
|
+
}
|
|
265
|
+
exitCode = code ?? 0;
|
|
266
|
+
finished = true;
|
|
267
|
+
signalReady();
|
|
268
|
+
})
|
|
269
|
+
.stderr.on("data", (d) => enqueue({ type: "stderr", data: d.toString() }));
|
|
270
|
+
});
|
|
271
|
+
try {
|
|
272
|
+
for (;;) {
|
|
273
|
+
while (queue.length)
|
|
274
|
+
yield queue.shift();
|
|
275
|
+
if (paused) {
|
|
276
|
+
paused = false;
|
|
277
|
+
streamRef?.resume();
|
|
278
|
+
}
|
|
279
|
+
if (failure)
|
|
280
|
+
throw failure;
|
|
281
|
+
if (finished)
|
|
282
|
+
break;
|
|
283
|
+
const waitMs = idleMs ? Math.max(1, idleMs - (Date.now() - lastChunk)) : 30_000;
|
|
284
|
+
await new Promise((r) => {
|
|
285
|
+
wake = r;
|
|
286
|
+
setTimeout(r, waitMs);
|
|
287
|
+
});
|
|
288
|
+
if (idleMs && !finished && Date.now() - lastChunk >= idleMs)
|
|
289
|
+
throw new RemoteExecutionError("timeout", `execStream idle > ${idleMs}ms (provider hang / unreachable host)`);
|
|
290
|
+
}
|
|
291
|
+
while (queue.length)
|
|
292
|
+
yield queue.shift();
|
|
293
|
+
yield { type: "exit", exitCode };
|
|
294
|
+
}
|
|
295
|
+
finally {
|
|
296
|
+
teardown();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
sftp() {
|
|
300
|
+
if (!this.conn)
|
|
301
|
+
return Promise.reject(new Error("SSH not connected"));
|
|
302
|
+
if (!this.sftpPromise) {
|
|
303
|
+
this.sftpPromise = new Promise((resolve, reject) => {
|
|
304
|
+
this.conn.sftp((err, sftp) => (err ? reject(err) : resolve(sftp)));
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
return this.sftpPromise;
|
|
308
|
+
}
|
|
309
|
+
async absolutePath(p) {
|
|
310
|
+
return ok(this.resolve(p));
|
|
311
|
+
}
|
|
312
|
+
async joinPath(parts) {
|
|
313
|
+
return ok(path.posix.join(...parts));
|
|
314
|
+
}
|
|
315
|
+
async readTextFile(p, abortSignal) {
|
|
316
|
+
const r = await this.readBinaryFile(p, abortSignal);
|
|
317
|
+
return r.ok ? ok(Buffer.from(r.value).toString("utf8")) : r;
|
|
318
|
+
}
|
|
319
|
+
async readTextLines(p, options) {
|
|
320
|
+
const r = await this.readTextFile(p, options?.abortSignal);
|
|
321
|
+
if (!r.ok)
|
|
322
|
+
return r;
|
|
323
|
+
let lines = r.value.split(/\r?\n/);
|
|
324
|
+
if (lines.length > 0 && lines[lines.length - 1] === "")
|
|
325
|
+
lines.pop();
|
|
326
|
+
if (options?.maxLines != null)
|
|
327
|
+
lines = lines.slice(0, options.maxLines);
|
|
328
|
+
return ok(lines);
|
|
329
|
+
}
|
|
330
|
+
async readBinaryFile(p, abortSignal) {
|
|
331
|
+
const abs = this.resolve(p);
|
|
332
|
+
try {
|
|
333
|
+
const sftp = await this.sftp();
|
|
334
|
+
const buf = await new Promise((resolve, reject) => sftp.readFile(abs, (err, b) => (err ? reject(err) : resolve(b))));
|
|
335
|
+
return ok(new Uint8Array(buf));
|
|
336
|
+
}
|
|
337
|
+
catch (e) {
|
|
338
|
+
return { ok: false, error: this.fileError(e, abs) };
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
async writeFile(p, content, abortSignal) {
|
|
342
|
+
const abs = this.resolve(p);
|
|
343
|
+
const dir = path.posix.dirname(abs);
|
|
344
|
+
if (dir && dir !== "." && dir !== "/") {
|
|
345
|
+
const mk = await this.exec(`mkdir -p -- ${shellQuote(dir)}`, { abortSignal });
|
|
346
|
+
if (mk.ok && mk.value.exitCode !== 0)
|
|
347
|
+
return { ok: false, error: new FileError("unknown", mk.value.stderr.trim() || `mkdir -p failed for ${dir}`, dir) };
|
|
348
|
+
}
|
|
349
|
+
try {
|
|
350
|
+
const sftp = await this.sftp();
|
|
351
|
+
const data = typeof content === "string" ? Buffer.from(content, "utf8") : Buffer.from(content);
|
|
352
|
+
await new Promise((resolve, reject) => sftp.writeFile(abs, data, (err) => (err ? reject(err) : resolve())));
|
|
353
|
+
return ok(undefined);
|
|
354
|
+
}
|
|
355
|
+
catch (e) {
|
|
356
|
+
return { ok: false, error: this.fileError(e, abs) };
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
async appendFile(p, content, abortSignal) {
|
|
360
|
+
const abs = this.resolve(p);
|
|
361
|
+
const existing = await this.readBinaryFile(abs, abortSignal);
|
|
362
|
+
let base;
|
|
363
|
+
if (existing.ok)
|
|
364
|
+
base = existing.value;
|
|
365
|
+
else if (existing.error.code === "not_found")
|
|
366
|
+
base = new Uint8Array(0);
|
|
367
|
+
else
|
|
368
|
+
return existing;
|
|
369
|
+
const add = typeof content === "string" ? new TextEncoder().encode(content) : content;
|
|
370
|
+
const merged = new Uint8Array(base.length + add.length);
|
|
371
|
+
merged.set(base, 0);
|
|
372
|
+
merged.set(add, base.length);
|
|
373
|
+
return this.writeFile(abs, merged, abortSignal);
|
|
374
|
+
}
|
|
375
|
+
async fileInfo(p, abortSignal) {
|
|
376
|
+
const abs = this.resolve(p);
|
|
377
|
+
try {
|
|
378
|
+
const sftp = await this.sftp();
|
|
379
|
+
const st = await new Promise((resolve, reject) => sftp.lstat(abs, (err, s) => (err ? reject(err) : resolve(s))));
|
|
380
|
+
return ok({ name: path.posix.basename(abs), path: abs, kind: st.isDirectory() ? "directory" : st.isSymbolicLink() ? "symlink" : "file", size: st.size ?? 0, mtimeMs: (st.mtime ?? 0) * 1000 });
|
|
381
|
+
}
|
|
382
|
+
catch (e) {
|
|
383
|
+
return { ok: false, error: this.fileError(e, abs) };
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
async listDir(p, abortSignal) {
|
|
387
|
+
const abs = this.resolve(p);
|
|
388
|
+
try {
|
|
389
|
+
const sftp = await this.sftp();
|
|
390
|
+
const entries = await new Promise((resolve, reject) => sftp.readdir(abs, (err, list) => (err ? reject(err) : resolve(list))));
|
|
391
|
+
return ok(entries.map((e) => {
|
|
392
|
+
const a = e.attrs;
|
|
393
|
+
return { name: e.filename, path: path.posix.join(abs, e.filename), kind: kindFromMode(a.mode), size: a.size ?? 0, mtimeMs: (a.mtime ?? 0) * 1000 };
|
|
394
|
+
}));
|
|
395
|
+
}
|
|
396
|
+
catch (e) {
|
|
397
|
+
return { ok: false, error: this.fileError(e, abs) };
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
async canonicalPath(p, abortSignal) {
|
|
401
|
+
const abs = this.resolve(p);
|
|
402
|
+
const r = await this.exec(`realpath -- ${shellQuote(abs)}`, { abortSignal });
|
|
403
|
+
if (!r.ok)
|
|
404
|
+
return { ok: false, error: new FileError("unknown", r.error.message, abs, r.error) };
|
|
405
|
+
if (r.value.exitCode !== 0) {
|
|
406
|
+
const msg = r.value.stderr.trim();
|
|
407
|
+
if (/permission denied|access denied/i.test(msg))
|
|
408
|
+
return { ok: false, error: new FileError("permission_denied", msg, abs) };
|
|
409
|
+
if (/not a directory/i.test(msg))
|
|
410
|
+
return { ok: false, error: new FileError("not_directory", msg, abs) };
|
|
411
|
+
return { ok: false, error: new FileError("not_found", msg || `realpath failed for ${abs}`, abs) };
|
|
412
|
+
}
|
|
413
|
+
return ok(r.value.stdout.trim());
|
|
414
|
+
}
|
|
415
|
+
async exists(p, abortSignal) {
|
|
416
|
+
const info = await this.fileInfo(p, abortSignal);
|
|
417
|
+
if (info.ok)
|
|
418
|
+
return ok(true);
|
|
419
|
+
if (info.error.code === "not_found")
|
|
420
|
+
return ok(false);
|
|
421
|
+
return { ok: false, error: info.error };
|
|
422
|
+
}
|
|
423
|
+
async createDir(p, options) {
|
|
424
|
+
const abs = this.resolve(p);
|
|
425
|
+
const r = await this.exec(`mkdir -p -- ${shellQuote(abs)}`, { abortSignal: options?.abortSignal });
|
|
426
|
+
if (!r.ok)
|
|
427
|
+
return { ok: false, error: new FileError("unknown", r.error.message, abs, r.error) };
|
|
428
|
+
if (r.value.exitCode !== 0) {
|
|
429
|
+
const msg = r.value.stderr.trim();
|
|
430
|
+
if (/permission denied/i.test(msg))
|
|
431
|
+
return { ok: false, error: new FileError("permission_denied", msg, abs) };
|
|
432
|
+
return { ok: false, error: new FileError("unknown", msg || `mkdir failed for ${abs}`, abs) };
|
|
433
|
+
}
|
|
434
|
+
return ok(undefined);
|
|
435
|
+
}
|
|
436
|
+
async remove(p, options) {
|
|
437
|
+
const abs = this.resolve(p);
|
|
438
|
+
const flags = `${options?.recursive ? "r" : ""}${options?.force ? "f" : ""}`;
|
|
439
|
+
const r = await this.exec(`rm ${flags ? `-${flags}` : ""} -- ${shellQuote(abs)}`, { abortSignal: options?.abortSignal });
|
|
440
|
+
if (!r.ok)
|
|
441
|
+
return { ok: false, error: new FileError("unknown", r.error.message, abs, r.error) };
|
|
442
|
+
if (r.value.exitCode !== 0) {
|
|
443
|
+
const msg = r.value.stderr.trim();
|
|
444
|
+
if (options?.force && /no such file/i.test(msg))
|
|
445
|
+
return ok(undefined);
|
|
446
|
+
if (/no such file/i.test(msg))
|
|
447
|
+
return { ok: false, error: new FileError("not_found", msg, abs) };
|
|
448
|
+
if (/permission denied/i.test(msg))
|
|
449
|
+
return { ok: false, error: new FileError("permission_denied", msg, abs) };
|
|
450
|
+
return { ok: false, error: new FileError("unknown", msg || `rm failed for ${abs}`, abs) };
|
|
451
|
+
}
|
|
452
|
+
return ok(undefined);
|
|
453
|
+
}
|
|
454
|
+
async createTempDir(prefix = "tmp-", abortSignal) {
|
|
455
|
+
const r = await this.exec(`mktemp -d -t ${shellQuote(`${prefix}XXXXXX`)}`, { abortSignal });
|
|
456
|
+
return this.tempResult(r, "mktemp -d");
|
|
457
|
+
}
|
|
458
|
+
async createTempFile(options) {
|
|
459
|
+
const prefix = options?.prefix ?? "";
|
|
460
|
+
const suffix = options?.suffix ?? "";
|
|
461
|
+
const suffixArg = suffix ? `--suffix=${shellQuote(suffix)} -t` : "-t";
|
|
462
|
+
const r = await this.exec(`mktemp ${suffixArg} ${shellQuote(`${prefix}XXXXXX`)}`, { abortSignal: options?.abortSignal });
|
|
463
|
+
return this.tempResult(r, "mktemp");
|
|
464
|
+
}
|
|
465
|
+
withCwdEnv(command, cwd, env) {
|
|
466
|
+
const parts = [];
|
|
467
|
+
const dir = cwd ?? (this.cwd !== "." ? this.cwd : undefined);
|
|
468
|
+
if (dir)
|
|
469
|
+
parts.push(`cd ${shellQuote(this.resolve(dir))} &&`);
|
|
470
|
+
if (env)
|
|
471
|
+
for (const [k, v] of Object.entries(env))
|
|
472
|
+
parts.push(`export ${k}=${shellQuote(v)};`);
|
|
473
|
+
parts.push(command);
|
|
474
|
+
return parts.join(" ");
|
|
475
|
+
}
|
|
476
|
+
tempResult(r, label) {
|
|
477
|
+
if (!r.ok)
|
|
478
|
+
return { ok: false, error: new FileError("unknown", r.error.message, undefined, r.error) };
|
|
479
|
+
if (r.value.exitCode !== 0)
|
|
480
|
+
return { ok: false, error: new FileError("unknown", r.value.stderr.trim() || `${label} failed`) };
|
|
481
|
+
return ok(r.value.stdout.trim());
|
|
482
|
+
}
|
|
483
|
+
connErr(e) {
|
|
484
|
+
const msg = e.message || String(e);
|
|
485
|
+
if (e.level === "client-authentication" || /authentication|all configured authentication methods failed/i.test(msg)) {
|
|
486
|
+
return new RemoteExecutionError("auth_failed", `ssh auth failed: ${msg}`, e);
|
|
487
|
+
}
|
|
488
|
+
if (e.level === "client-timeout" || /timed out|timeout/i.test(msg))
|
|
489
|
+
return new RemoteExecutionError("timeout", `ssh connect timed out: ${msg}`, e);
|
|
490
|
+
return new RemoteExecutionError("connect_failed", `ssh connect failed: ${msg}`, e);
|
|
491
|
+
}
|
|
492
|
+
fileError(e, p) {
|
|
493
|
+
if (e instanceof FileError)
|
|
494
|
+
return e;
|
|
495
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
496
|
+
const code = e?.code;
|
|
497
|
+
if (code === "ENOENT" || code === 2 || /no such file/i.test(msg))
|
|
498
|
+
return new FileError("not_found", msg, p);
|
|
499
|
+
if (code === "EACCES" || code === 3 || /permission denied/i.test(msg))
|
|
500
|
+
return new FileError("permission_denied", msg, p);
|
|
501
|
+
if (code === "EISDIR" || /is a directory/i.test(msg))
|
|
502
|
+
return new FileError("is_directory", msg, p);
|
|
503
|
+
if (code === "ENOTDIR" || /not a directory/i.test(msg))
|
|
504
|
+
return new FileError("not_directory", msg, p);
|
|
505
|
+
return new FileError("unknown", msg, p);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
export function sshExecutionEnvFactory(config) {
|
|
509
|
+
return (_ctx) => new RemoteSshExecutionEnv(config);
|
|
510
|
+
}
|
|
511
|
+
//# sourceMappingURL=remote-env-ssh.js.map
|