@sema-agent/server 7.146.0 → 7.148.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/MIGRATION.md +1423 -24
- package/README.md +21 -8
- package/README.zh-CN.md +15 -9
- package/USAGE.md +537 -216
- package/deploy/facts/lanes.json +7 -0
- package/deploy/sema-up/README.md +18 -7
- package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
- package/deploy/sema-up/chart/templates/_helpers.tpl +42 -4
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -4
- package/deploy/sema-up/chart/templates/server.yaml +5 -4
- package/deploy/sema-up/chart/values.yaml +4 -3
- package/deploy/sema-up/cluster-up.sh +75 -176
- package/deploy/sema-up/kube-up.sh +29 -49
- package/deploy/sema-up/lib/chart-run.sh +23 -0
- package/deploy/sema-up/lib/dataroot.sh +3 -3
- package/deploy/sema-up/lib/flagshape.sh +4 -0
- package/deploy/sema-up/lib/health.sh +62 -13
- package/deploy/sema-up/lib/helm-values-cluster.py +18 -0
- package/deploy/sema-up/lib/helm-values-kube.py +35 -0
- package/deploy/sema-up/lib/lanes.json +2 -5
- package/deploy/sema-up/lib/regcred.py +8 -0
- package/deploy/sema-up/lib/remote/helm-install.sh +3 -0
- package/deploy/sema-up/lib/remote/image-import.sh +6 -0
- package/deploy/sema-up/lib/remote/machine-precheck.sh +11 -0
- package/deploy/sema-up/lib/remote/region-probe.sh +3 -0
- package/deploy/sema-up/lib/remote/stack-ready.sh +26 -0
- package/deploy/sema-up/lib/remote/vxlan-guard.sh +8 -0
- package/deploy/sema-up/lib/render-stack.py +17 -0
- package/deploy/sema-up/lib/shell-text.sh +87 -0
- package/deploy/sema-up/lib/usage-flags.txt +10 -0
- package/deploy/sema-up/lib/usage-head.txt +1 -0
- package/deploy/sema-up/lib/usage-tail.txt +13 -0
- package/deploy/sema-up/preflight.sh +10 -8
- package/deploy/sema-up/sema-up.sh +26 -48
- package/deploy/sema-up/smoke.sh +7 -6
- package/deploy/sema-up/stack/compose.dataroot.yaml +3 -0
- package/deploy/sema-up/stack/compose.yaml +18 -5
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +25 -3
- package/dist/adoption/plan.d.ts +24 -0
- package/dist/adoption/plan.js +53 -1
- package/dist/adoption/runner.d.ts +10 -1
- package/dist/adoption/runner.js +36 -16
- package/dist/adoption/wire.d.ts +3 -3
- package/dist/approval-card.d.ts +32 -34
- package/dist/approval-gate-currency.js +3 -2
- package/dist/approval-reconciler.d.ts +4 -13
- package/dist/approval-reconciler.js +2 -2
- package/dist/approval.d.ts +16 -14
- package/dist/approval.js +3 -3
- package/dist/audit.d.ts +10 -3
- package/dist/audit.js +17 -9
- package/dist/auth-bridge.d.ts +0 -14
- package/dist/auth-bridge.js +0 -7
- package/dist/auto-mode-face.d.ts +10 -7
- package/dist/auto-mode-face.js +7 -4
- package/dist/background-agent-name.d.ts +19 -1
- package/dist/background-agent-name.js +12 -2
- package/dist/background-session-reap.d.ts +1 -1
- package/dist/bake-runner/main.js +9 -6
- package/dist/bench/s1/arms.js +6 -5
- package/dist/bench/s1/live-deps.js +8 -3
- package/dist/bench/s1/run-firm.js +6 -5
- package/dist/bind-host.d.ts +25 -0
- package/dist/bind-host.js +25 -0
- package/dist/boot/adoption.d.ts +3 -0
- package/dist/boot/adoption.js +1 -0
- package/dist/boot/crash-last.js +2 -1
- package/dist/boot/deployment-mods.d.ts +1 -1
- package/dist/boot/device-lane.js +5 -5
- package/dist/boot/engine-lease.d.ts +12 -11
- package/dist/boot/execution-env.d.ts +19 -8
- package/dist/boot/execution-env.js +80 -62
- package/dist/boot/execution-lane.d.ts +37 -9
- package/dist/boot/execution-lane.js +74 -20
- package/dist/boot/exit-boundary.d.ts +3 -3
- package/dist/boot/exit-boundary.js +6 -5
- package/dist/boot/exit-last.js +2 -1
- package/dist/boot/fatal-exit.d.ts +3 -5
- package/dist/boot/fatal-exit.js +2 -2
- package/dist/boot/governance-seams.d.ts +2 -2
- package/dist/boot/leader.d.ts +15 -0
- package/dist/boot/leader.js +18 -16
- package/dist/boot/memory-boundary.d.ts +11 -11
- package/dist/boot/memory-boundary.js +3 -3
- package/dist/boot/memory-consolidation.d.ts +50 -53
- package/dist/boot/memory-consolidation.js +11 -18
- package/dist/boot/org-memory.js +4 -3
- package/dist/boot/parked-revive-gate.d.ts +1 -1
- package/dist/boot/parked-revive-gate.js +3 -3
- package/dist/boot/reapers.d.ts +4 -3
- package/dist/boot/reapers.js +20 -17
- package/dist/boot/resolve-spec.d.ts +5 -3
- package/dist/boot/resolve-spec.js +133 -165
- package/dist/boot/retention-lane.d.ts +7 -45
- package/dist/boot/retention-lane.js +2 -2
- package/dist/boot/runner-deps.d.ts +28 -7
- package/dist/boot/runner-deps.js +11 -4
- package/dist/boot/runtime-caps.d.ts +2 -2
- package/dist/boot/runtime-caps.js +16 -2
- package/dist/boot/session-faces.d.ts +17 -7
- package/dist/boot/session-faces.js +122 -96
- package/dist/boot/shutdown.d.ts +5 -4
- package/dist/boot/shutdown.js +6 -4
- package/dist/boot/stage-01-config.d.ts +1 -1
- package/dist/boot/stage-01-config.js +14 -2
- package/dist/boot/stage-02-web-admin-pull.d.ts +2 -1
- package/dist/boot/stage-02-web-admin-pull.js +15 -8
- package/dist/boot/stage-03-store-backend.d.ts +4 -1
- package/dist/boot/stage-03-store-backend.js +4 -3
- package/dist/boot/stage-04-stores.d.ts +3 -1
- package/dist/boot/stage-04-stores.js +2 -2
- package/dist/boot/stage-05-execution-env.d.ts +9 -5
- package/dist/boot/stage-05-execution-env.js +5 -5
- package/dist/boot/stage-06-runners.d.ts +13 -15
- package/dist/boot/stage-06-runners.js +24 -18
- package/dist/boot/stage-07-capability-layer.d.ts +14 -11
- package/dist/boot/stage-07-capability-layer.js +9 -12
- package/dist/boot/stage-08-reapers.d.ts +14 -11
- package/dist/boot/stage-08-reapers.js +3 -3
- package/dist/boot/stage-09-leader.d.ts +16 -18
- package/dist/boot/stage-09-leader.js +12 -4
- package/dist/boot/stage-10-http-server.d.ts +16 -18
- package/dist/boot/stage-10-http-server.js +9 -5
- package/dist/boot/store-evidence.d.ts +20 -0
- package/dist/boot/store-evidence.js +13 -0
- package/dist/boot/stores.d.ts +12 -0
- package/dist/boot/stores.js +39 -17
- package/dist/boot/task-list-lane.d.ts +4 -4
- package/dist/boot/web-admin.d.ts +4 -2
- package/dist/boot/web-admin.js +58 -38
- package/dist/boot/webfetch-summarize-lane.d.ts +1 -1
- package/dist/boot-reclaim.d.ts +3 -1
- package/dist/boot-reclaim.js +1 -1
- package/dist/brain.d.ts +7 -18
- package/dist/brain.js +5 -17
- package/dist/budget.js +6 -6
- package/dist/capabilities/center-plugins.d.ts +9 -1
- package/dist/capabilities/center-plugins.js +37 -11
- package/dist/capabilities/center-wiring.js +1 -1
- package/dist/capabilities/composite-members.d.ts +3 -2
- package/dist/capabilities/composite-members.js +3 -2
- package/dist/capabilities/execution-lane.d.ts +7 -7
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +1 -1
- package/dist/capabilities/repo-tools.d.ts +2 -0
- package/dist/capabilities/repo-tools.js +14 -12
- package/dist/capabilities/scenarios.d.ts +38 -33
- package/dist/capabilities/scenarios.js +24 -25
- package/dist/capabilities/settings-contract.d.ts +29 -0
- package/dist/capabilities/settings-contract.js +14 -0
- package/dist/capabilities/skills.d.ts +6 -6
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +69 -4
- package/dist/capability-facts.js +77 -5
- package/dist/card-void.d.ts +4 -4
- package/dist/card-void.js +1 -1
- package/dist/center-credential-renewer.d.ts +6 -2
- package/dist/center-credential-renewer.js +10 -5
- package/dist/config-catalog.d.ts +16 -1
- package/dist/config-catalog.js +68 -61
- package/dist/config-dir-trust.d.ts +37 -4
- package/dist/config-dir-trust.js +88 -44
- package/dist/config-invariants.d.ts +58 -4
- package/dist/config-invariants.js +104 -23
- package/dist/config-lkg.d.ts +24 -2
- package/dist/config-lkg.js +22 -9
- package/dist/config-provider.d.ts +9 -9
- package/dist/config-provider.js +25 -108
- package/dist/config-pull-failure.d.ts +50 -0
- package/dist/config-pull-failure.js +48 -0
- package/dist/config-types.d.ts +215 -202
- package/dist/config.d.ts +69 -14
- package/dist/config.js +188 -96
- package/dist/degenerate-instrument.js +1 -1
- package/dist/delegated-session-owner.d.ts +1 -1
- package/dist/deleted-session-ids.d.ts +3 -2
- package/dist/deploy-facts.js +3 -2
- package/dist/deployment-governance.d.ts +3 -3
- package/dist/deployment-shape.d.ts +51 -16
- package/dist/deployment-shape.js +31 -6
- package/dist/egress-redirect.d.ts +25 -7
- package/dist/egress-redirect.js +20 -2
- package/dist/elicitation.d.ts +6 -5
- package/dist/elicitation.js +23 -22
- package/dist/engine-identity.d.ts +28 -0
- package/dist/engine-identity.js +10 -0
- package/dist/entry-problems.d.ts +5 -7
- package/dist/entry-problems.js +1 -1
- package/dist/env-facts.d.ts +7 -5
- package/dist/env-facts.js +12 -7
- package/dist/env-witness.d.ts +7 -0
- package/dist/env-witness.js +16 -0
- package/dist/execution-config-root.d.ts +5 -5
- package/dist/execution-config-root.js +5 -5
- package/dist/execution-env-purpose.d.ts +14 -0
- package/dist/execution-env-purpose.js +29 -0
- package/dist/execution-lane-caps.d.ts +53 -103
- package/dist/execution-lane-caps.js +51 -83
- package/dist/execution-placement.d.ts +65 -9
- package/dist/execution-placement.js +58 -0
- package/dist/field-conflict.d.ts +7 -11
- package/dist/field-conflict.js +3 -3
- package/dist/file-history-capture.d.ts +3 -3
- package/dist/file-history-disclosure.d.ts +2 -2
- package/dist/file-history-disclosure.js +1 -0
- package/dist/fleet/drain-entry.d.ts +17 -10
- package/dist/fleet/drain-entry.js +1 -1
- package/dist/fleet/fleet-bus.d.ts +21 -3
- package/dist/fleet/fleet-bus.js +35 -25
- package/dist/fleet/fleet-reconciler.js +2 -2
- package/dist/fleet/serving-lease.js +6 -7
- package/dist/fleet-client.js +3 -3
- package/dist/fleet-lease.d.ts +0 -1
- package/dist/fleet-lease.js +4 -5
- package/dist/history-anchor.d.ts +42 -0
- package/dist/history-anchor.js +34 -0
- package/dist/hitl-delivery.d.ts +90 -0
- package/dist/hitl-delivery.js +98 -0
- package/dist/hooks/classic-stations.d.ts +8 -11
- package/dist/hooks/classic-stations.js +0 -7
- package/dist/hooks/command-spawn.d.ts +1 -4
- package/dist/hooks/command-spawn.js +0 -11
- package/dist/hooks/hook-llm.d.ts +5 -1
- package/dist/hooks/hook-llm.js +24 -15
- package/dist/hooks/hook-runner.d.ts +119 -65
- package/dist/hooks/hook-runner.js +415 -217
- package/dist/host-lsp-manager.d.ts +22 -8
- package/dist/host-lsp-manager.js +4 -1
- package/dist/http/active-run-conflict.d.ts +2 -43
- package/dist/http/active-run-conflict.js +3 -7
- package/dist/http/admission.d.ts +4 -18
- package/dist/http/admission.js +75 -78
- package/dist/http/approval-sweeps.d.ts +5 -8
- package/dist/http/approval-sweeps.js +55 -30
- package/dist/http/caller-trust.d.ts +8 -10
- package/dist/http/caller-trust.js +1 -2
- package/dist/http/checkpoint-ctx.d.ts +17 -0
- package/dist/http/checkpoint-ctx.js +6 -0
- package/dist/http/claim-heartbeat.d.ts +49 -0
- package/dist/http/claim-heartbeat.js +46 -0
- package/dist/http/claim-latency.d.ts +10 -0
- package/dist/http/claim-latency.js +12 -0
- package/dist/http/claimed-run.d.ts +4 -3
- package/dist/http/dispatch.d.ts +8 -1
- package/dist/http/dispatch.js +77 -31
- package/dist/http/durable-run-leg.d.ts +3 -3
- package/dist/http/durable-run-leg.js +18 -12
- package/dist/http/execution-context.d.ts +18 -42
- package/dist/http/execution-context.js +11 -5
- package/dist/http/health-reader.d.ts +36 -0
- package/dist/http/health-reader.js +21 -0
- package/dist/http/health-self-report.d.ts +9 -9
- package/dist/http/health-self-report.js +4 -4
- package/dist/http/idempotency.d.ts +9 -5
- package/dist/http/idempotency.js +4 -4
- package/dist/http/memory-compliance-failure-reply.d.ts +15 -16
- package/dist/http/memory-compliance-failure-reply.js +7 -2
- package/dist/http/memory-face-fault-reply.d.ts +67 -0
- package/dist/http/memory-face-fault-reply.js +71 -0
- package/dist/http/memory-store-refusal-reply.d.ts +3 -3
- package/dist/http/memory-store-refusal-reply.js +6 -0
- package/dist/http/owner-access.d.ts +391 -56
- package/dist/http/owner-access.js +372 -33
- package/dist/http/principal-gate.d.ts +26 -94
- package/dist/http/principal-gate.js +24 -81
- package/dist/http/refusal-body.d.ts +35 -2
- package/dist/http/refusal-body.js +34 -0
- package/dist/http/request-guards.d.ts +10 -14
- package/dist/http/request-guards.js +34 -68
- package/dist/http/resume-composition.d.ts +37 -0
- package/dist/http/resume-composition.js +18 -0
- package/dist/http/resume-ctx-read.d.ts +35 -12
- package/dist/http/resume-ctx-read.js +25 -6
- package/dist/http/resume-legs.d.ts +24 -24
- package/dist/http/resume-legs.js +260 -171
- package/dist/http/retired-skill-manifest.d.ts +1 -1
- package/dist/http/rewind-files-reply.d.ts +34 -0
- package/dist/http/rewind-files-reply.js +36 -0
- package/dist/http/route-ctx.d.ts +56 -47
- package/dist/http/route-table.js +2 -0
- package/dist/http/routes/a2a-serve.d.ts +43 -5
- package/dist/http/routes/a2a-serve.js +58 -37
- package/dist/http/routes/admin-config-refresh.js +2 -2
- package/dist/http/routes/admin-drain.js +2 -2
- package/dist/http/routes/admin-memory-optout.js +4 -3
- package/dist/http/routes/adoption.d.ts +3 -0
- package/dist/http/routes/adoption.js +17 -10
- package/dist/http/routes/agents-roster.js +13 -7
- package/dist/http/routes/approvals-assistant.js +73 -88
- package/dist/http/routes/attachments.js +2 -2
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +9 -17
- package/dist/http/routes/capabilities.js +23 -20
- package/dist/http/routes/config-catalog.js +2 -2
- package/dist/http/routes/devices.d.ts +3 -3
- package/dist/http/routes/devices.js +5 -5
- package/dist/http/routes/diagnostics.d.ts +27 -3
- package/dist/http/routes/diagnostics.js +27 -21
- package/dist/http/routes/engine.js +2 -2
- package/dist/http/routes/fleet.js +5 -3
- package/dist/http/routes/images.js +10 -6
- package/dist/http/routes/leader.d.ts +7 -2
- package/dist/http/routes/leader.js +12 -3
- package/dist/http/routes/mcp-reconnect.d.ts +1 -1
- package/dist/http/routes/mcp-reconnect.js +7 -15
- package/dist/http/routes/memory-bundle.js +4 -7
- package/dist/http/routes/memory-compliance.js +4 -4
- package/dist/http/routes/memory-consolidation.js +6 -9
- package/dist/http/routes/memory-origin.d.ts +3 -1
- package/dist/http/routes/memory-origin.js +7 -8
- package/dist/http/routes/memory-policy.js +17 -12
- package/dist/http/routes/notify-wake.js +12 -20
- package/dist/http/routes/observability.js +3 -3
- package/dist/http/routes/principal-inbox.d.ts +1 -1
- package/dist/http/routes/principal-inbox.js +2 -2
- package/dist/http/routes/projects.d.ts +70 -0
- package/dist/http/routes/projects.js +87 -0
- package/dist/http/routes/retention-ops.js +6 -9
- package/dist/http/routes/rules.js +50 -7
- package/dist/http/routes/run-memory-capture.d.ts +2 -2
- package/dist/http/routes/run-memory-capture.js +6 -12
- package/dist/http/routes/run-permission-mode.d.ts +2 -2
- package/dist/http/routes/run-permission-mode.js +10 -17
- package/dist/http/routes/runs.js +148 -233
- package/dist/http/routes/session-memory-sync.d.ts +2 -2
- package/dist/http/routes/session-memory-sync.js +7 -13
- package/dist/http/routes/session-sync.d.ts +4 -2
- package/dist/http/routes/session-sync.js +48 -30
- package/dist/http/routes/sessions-list.d.ts +3 -3
- package/dist/http/routes/sessions-list.js +9 -9
- package/dist/http/routes/sessions.d.ts +7 -1
- package/dist/http/routes/sessions.js +177 -112
- package/dist/http/routes/shared-memory.js +6 -6
- package/dist/http/routes/side-query.js +2 -2
- package/dist/http/routes/tasks.js +144 -122
- package/dist/http/routes/trace-usage.d.ts +0 -12
- package/dist/http/routes/trace-usage.js +40 -46
- package/dist/http/routes/workflows.d.ts +39 -4
- package/dist/http/routes/workflows.js +42 -14
- package/dist/http/run-concurrency-cap.d.ts +20 -12
- package/dist/http/run-concurrency-cap.js +39 -26
- package/dist/http/run-read-face.d.ts +3 -5
- package/dist/http/run-read-face.js +8 -13
- package/dist/http/send.d.ts +12 -3
- package/dist/http/send.js +42 -6
- package/dist/http/server.d.ts +63 -50
- package/dist/http/server.js +52 -16
- package/dist/http/sse-log.d.ts +17 -10
- package/dist/http/sse-log.js +7 -7
- package/dist/http/stored-body-replay.d.ts +17 -3
- package/dist/http/stored-body-replay.js +11 -2
- package/dist/http/submit-ctx.d.ts +16 -8
- package/dist/http/submit-ctx.js +6 -2
- package/dist/http/submit-replay.d.ts +19 -6
- package/dist/http/submit-replay.js +18 -6
- package/dist/http/sync-submit-body.d.ts +3 -4
- package/dist/http/sync-submit-body.js +4 -5
- package/dist/http/wire-types.d.ts +23 -13
- package/dist/identity-source.d.ts +36 -5
- package/dist/identity-source.js +27 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/instruction-source-notice.d.ts +1 -1
- package/dist/key-resolver.d.ts +32 -0
- package/dist/key-resolver.js +23 -9
- package/dist/leader/diffup.js +2 -1
- package/dist/leader/endpoint.d.ts +26 -5
- package/dist/leader/endpoint.js +154 -14
- package/dist/leader/fanout.d.ts +3 -0
- package/dist/leader/fanout.js +78 -63
- package/dist/leader/leader.d.ts +16 -0
- package/dist/leader/leader.js +43 -3
- package/dist/leader/merge.d.ts +9 -1
- package/dist/leader/merge.js +16 -1
- package/dist/leader/repair-wire.js +1 -1
- package/dist/leader/wire.d.ts +36 -3
- package/dist/leader/wire.js +59 -18
- package/dist/lsp-evict.d.ts +6 -4
- package/dist/lsp-evict.js +2 -3
- package/dist/memory-embedder-reembed.d.ts +38 -0
- package/dist/memory-embedder-reembed.js +20 -0
- package/dist/memory-incident-sink.d.ts +0 -28
- package/dist/memory-incident-sink.js +5 -0
- package/dist/memory-operator-faces.d.ts +5 -4
- package/dist/memory-operator-faces.js +1 -1
- package/dist/memory-scope.d.ts +31 -4
- package/dist/memory-scope.js +65 -16
- package/dist/memory-store-refusal.d.ts +20 -4
- package/dist/memory-store-refusal.js +1 -1
- package/dist/memory-sync-client.d.ts +5 -2
- package/dist/memory-sync-client.js +19 -14
- package/dist/memory-sync.js +1 -1
- package/dist/model-compat.d.ts +51 -28
- package/dist/model-compat.js +55 -23
- package/dist/model-context-window.d.ts +18 -0
- package/dist/model-context-window.js +2 -0
- package/dist/model-entry-headers.d.ts +46 -4
- package/dist/model-entry-headers.js +2 -2
- package/dist/model-entry-refusal.d.ts +46 -17
- package/dist/model-entry-refusal.js +47 -27
- package/dist/model-plane-face.d.ts +19 -11
- package/dist/model-plane-face.js +9 -1
- package/dist/model-plane-probe.d.ts +2 -0
- package/dist/model-plane-probe.js +17 -0
- package/dist/model-provider.d.ts +3 -3
- package/dist/model-route-endpoint.d.ts +9 -5
- package/dist/model-route-endpoint.js +29 -7
- package/dist/model-select.d.ts +16 -0
- package/dist/model-select.js +4 -0
- package/dist/mountinfo.d.ts +37 -0
- package/dist/mountinfo.js +47 -0
- package/dist/namespaced-rule-name.d.ts +28 -2
- package/dist/namespaced-rule-name.js +10 -1
- package/dist/net-address.d.ts +1 -1
- package/dist/observability/corrupt-read-seat.d.ts +4 -4
- package/dist/observability/corrupt-read-seat.js +5 -3
- package/dist/observability/fail-open.d.ts +75 -47
- package/dist/observability/fail-open.js +77 -47
- package/dist/observability/logger.d.ts +22 -1
- package/dist/observability/logger.js +89 -12
- package/dist/observability/metrics.d.ts +2 -0
- package/dist/observability/metrics.js +5 -4
- package/dist/observability/otel-exporter.js +2 -1
- package/dist/observability/principal-context.d.ts +14 -7
- package/dist/observability/principal-context.js +8 -3
- package/dist/observability/run-terminal.d.ts +7 -1
- package/dist/observability/run-terminal.js +5 -2
- package/dist/observability/secret-env-scrub.d.ts +30 -4
- package/dist/observability/secret-env-scrub.js +15 -3
- package/dist/orchestration/hardened-vm-runner.d.ts +1 -0
- package/dist/orchestration/hardened-vm-runner.js +11 -5
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +0 -14
- package/dist/orchestration/hardened-vm-worker-runner.js +5 -0
- package/dist/orchestration/hardened-vm-worker.js +2 -1
- package/dist/orchestration/workflow-agent-session-index.d.ts +7 -12
- package/dist/orchestration/workflow-agent-session-index.js +1 -6
- package/dist/orchestration/workflow-completion-inbox.d.ts +29 -9
- package/dist/orchestration/workflow-completion-inbox.js +65 -46
- package/dist/org-delivery-gate.d.ts +5 -4
- package/dist/org-delivery-gate.js +7 -6
- package/dist/org-memory-admission.d.ts +5 -2
- package/dist/org-memory-admission.js +25 -10
- package/dist/outbound-dispatcher.d.ts +1 -1
- package/dist/outbound-dispatcher.js +6 -12
- package/dist/owner-brands.d.ts +81 -0
- package/dist/owner-brands.js +42 -0
- package/dist/owner-faces.d.ts +531 -0
- package/dist/owner-faces.js +126 -0
- package/dist/parked-decide.d.ts +100 -31
- package/dist/parked-decide.js +162 -48
- package/dist/parked-revive-surface.d.ts +14 -4
- package/dist/parked-revive-surface.js +5 -4
- package/dist/peer-directory.d.ts +6 -8
- package/dist/peer-directory.js +3 -2
- package/dist/permission-rule-vocab.d.ts +53 -8
- package/dist/permission-rule-vocab.js +30 -2
- package/dist/plugins/adoption-log-sql.d.ts +0 -22
- package/dist/plugins/adoption-log-sql.js +5 -3
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.d.ts +7 -0
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.js +17 -0
- package/dist/plugins/approval-ask-store-file.d.ts +28 -9
- package/dist/plugins/approval-ask-store-file.js +74 -18
- package/dist/plugins/approval-ask-store-memory.d.ts +17 -7
- package/dist/plugins/approval-ask-store-memory.js +35 -12
- package/dist/plugins/approval-ask-store-sql.d.ts +42 -20
- package/dist/plugins/approval-ask-store-sql.js +44 -11
- package/dist/plugins/approval-exemption-skill-m46.d.ts +20 -0
- package/dist/plugins/approval-exemption-skill-m46.js +25 -0
- package/dist/plugins/approval-exemption-store.d.ts +6 -1
- package/dist/plugins/approval-exemption-store.js +14 -0
- package/dist/plugins/approval-nonce-store.d.ts +39 -12
- package/dist/plugins/approval-nonce-store.js +72 -23
- package/dist/plugins/blob-backend.d.ts +40 -195
- package/dist/plugins/blob-backend.js +41 -234
- package/dist/plugins/caching-session-store.d.ts +22 -5
- package/dist/plugins/caching-session-store.js +43 -4
- package/dist/plugins/checkpoint-index-columns.d.ts +33 -6
- package/dist/plugins/checkpoint-index-columns.js +39 -3
- package/dist/plugins/checkpoint-store-face.d.ts +84 -11
- package/dist/plugins/checkpoint-store-face.js +18 -1
- package/dist/plugins/device-store-sql.d.ts +2 -2
- package/dist/plugins/device-store-sql.js +6 -10
- package/dist/plugins/ensure-index.d.ts +13 -1
- package/dist/plugins/ensure-index.js +154 -21
- package/dist/plugins/ensure-schema-lock-policy.d.ts +0 -15
- package/dist/plugins/ensure-schema-lock-policy.js +3 -2
- package/dist/plugins/execution-lane-rename-m40.d.ts +20 -0
- package/dist/plugins/execution-lane-rename-m40.js +10 -0
- package/dist/plugins/execution-placement-sql.d.ts +63 -88
- package/dist/plugins/execution-placement-sql.js +94 -54
- package/dist/plugins/file-run-store.d.ts +89 -35
- package/dist/plugins/file-run-store.js +197 -142
- package/dist/plugins/host-platform.d.ts +24 -3
- package/dist/plugins/host-platform.js +15 -1
- package/dist/plugins/image-bake-store-sql.js +2 -0
- package/dist/plugins/imported-layer-root-retirement.d.ts +19 -10
- package/dist/plugins/imported-layer-root-retirement.js +4 -8
- package/dist/plugins/inbox-payload-column.d.ts +14 -0
- package/dist/plugins/inbox-payload-column.js +13 -0
- package/dist/plugins/k8s-pod-reaper.d.ts +1 -3
- package/dist/plugins/k8s-pod-reaper.js +0 -1
- package/dist/plugins/leader-run-store-sql.d.ts +22 -0
- package/dist/plugins/leader-run-store-sql.js +34 -4
- package/dist/plugins/local-checkpoint-store.d.ts +63 -23
- package/dist/plugins/local-checkpoint-store.js +204 -81
- package/dist/plugins/local-data-dir-modes-m39.d.ts +48 -0
- package/dist/plugins/local-data-dir-modes-m39.js +183 -0
- package/dist/plugins/local-docker-capacity.d.ts +93 -0
- package/dist/plugins/local-docker-capacity.js +194 -0
- package/dist/plugins/local-docker-reaper.d.ts +92 -0
- package/dist/plugins/local-docker-reaper.js +102 -0
- package/dist/plugins/local-engine-high-water.d.ts +13 -0
- package/dist/plugins/local-engine-high-water.js +62 -0
- package/dist/plugins/local-session-store.d.ts +442 -143
- package/dist/plugins/local-session-store.js +941 -289
- package/dist/plugins/local-session-window.d.ts +3 -2
- package/dist/plugins/local-session-window.js +3 -2
- package/dist/plugins/local-sidecar-quarantine.js +3 -2
- package/dist/plugins/local-task-attachment-store.d.ts +20 -1
- package/dist/plugins/local-task-attachment-store.js +32 -12
- package/dist/plugins/memory-embedder-fingerprint.d.ts +33 -10
- package/dist/plugins/memory-embedder-fingerprint.js +52 -12
- package/dist/plugins/memory-embedder.d.ts +1 -1
- package/dist/plugins/memory-embedder.js +11 -9
- package/dist/plugins/memory-engine-pg.d.ts +7 -5
- package/dist/plugins/memory-engine-pg.js +18 -9
- package/dist/plugins/memory-engine-sql-apply.d.ts +21 -8
- package/dist/plugins/memory-engine-sql-apply.js +7 -9
- package/dist/plugins/memory-engine-tidb.d.ts +12 -7
- package/dist/plugins/memory-engine-tidb.js +18 -10
- package/dist/plugins/memory-optout-grant-store-sql.d.ts +1 -1
- package/dist/plugins/memory-optout-grant-store-sql.js +3 -3
- package/dist/plugins/memory-run-store.d.ts +39 -27
- package/dist/plugins/memory-run-store.js +72 -70
- package/dist/plugins/one-time-migration-marker.d.ts +10 -0
- package/dist/plugins/one-time-migration-marker.js +7 -0
- package/dist/plugins/one-time-migrations.d.ts +325 -74
- package/dist/plugins/one-time-migrations.js +705 -230
- package/dist/plugins/org-delivery-quota-store.js +2 -1
- package/dist/plugins/owner-only-file-mode.d.ts +29 -0
- package/dist/plugins/owner-only-file-mode.js +141 -0
- package/dist/plugins/permission-rule-store-file.d.ts +11 -11
- package/dist/plugins/permission-rule-store-file.js +14 -2
- package/dist/plugins/permission-rule-store-sql.d.ts +4 -63
- package/dist/plugins/permission-rule-store-sql.js +6 -86
- package/dist/plugins/pg-pool.d.ts +3 -32
- package/dist/plugins/pg-pool.js +27 -11
- package/dist/plugins/release-version.d.ts +20 -0
- package/dist/plugins/release-version.js +28 -0
- package/dist/plugins/remote-env-adb.d.ts +20 -4
- package/dist/plugins/remote-env-adb.js +39 -11
- package/dist/plugins/remote-env-e2b.d.ts +19 -28
- package/dist/plugins/remote-env-e2b.js +40 -29
- package/dist/plugins/remote-env-host.d.ts +11 -10
- package/dist/plugins/remote-env-host.js +40 -27
- package/dist/plugins/remote-env-k8s.d.ts +45 -47
- package/dist/plugins/remote-env-k8s.js +122 -62
- package/dist/plugins/remote-env-local-docker.d.ts +152 -15
- package/dist/plugins/remote-env-local-docker.js +370 -75
- package/dist/plugins/remote-env-ssh.d.ts +8 -2
- package/dist/plugins/remote-env-ssh.js +26 -24
- package/dist/plugins/remote-scratchpad.js +4 -0
- package/dist/plugins/remote-shell.d.ts +59 -30
- package/dist/plugins/remote-shell.js +175 -62
- package/dist/plugins/retention-declaration.d.ts +37 -0
- package/dist/plugins/retention-declaration.js +9 -0
- package/dist/plugins/retention-deployment.d.ts +158 -0
- package/dist/plugins/retention-deployment.js +119 -0
- package/dist/plugins/retention-lane-store-sql.d.ts +74 -4
- package/dist/plugins/retention-lane-store-sql.js +103 -1
- package/dist/plugins/retention-sql.d.ts +29 -0
- package/dist/plugins/retention-sql.js +8 -0
- package/dist/plugins/run-preview-m45.d.ts +11 -0
- package/dist/plugins/run-preview-m45.js +19 -0
- package/dist/plugins/run-store-sql.d.ts +56 -68
- package/dist/plugins/run-store-sql.js +127 -116
- package/dist/plugins/s3-answer.d.ts +2 -1
- package/dist/plugins/sandbox-reaper.d.ts +26 -0
- package/dist/plugins/sandbox-reaper.js +2 -0
- package/dist/plugins/scenario-prefix-switch-m42.d.ts +54 -0
- package/dist/plugins/scenario-prefix-switch-m42.js +55 -0
- package/dist/plugins/scheduler-support.d.ts +16 -1
- package/dist/plugins/scheduler-support.js +22 -2
- package/dist/plugins/schema-consistency.d.ts +42 -15
- package/dist/plugins/schema-consistency.js +213 -13
- package/dist/plugins/schema-drift-sentence.d.ts +4 -1
- package/dist/plugins/schema-drift-sentence.js +4 -4
- package/dist/plugins/schema-ensure-legs.d.ts +10 -1
- package/dist/plugins/schema-ensure-legs.js +12 -2
- package/dist/plugins/schema-indexes.js +3 -0
- package/dist/plugins/schema-live-columns.d.ts +14 -5
- package/dist/plugins/schema-live-columns.js +10 -10
- package/dist/plugins/send-user-file.js +2 -1
- package/dist/plugins/session-birth.d.ts +37 -0
- package/dist/plugins/session-birth.js +38 -0
- package/dist/plugins/session-epoch-anchor.d.ts +40 -12
- package/dist/plugins/session-epoch-anchor.js +33 -11
- package/dist/plugins/session-ext-table.d.ts +98 -0
- package/dist/plugins/session-ext-table.js +134 -0
- package/dist/plugins/session-fork.d.ts +16 -2
- package/dist/plugins/session-fork.js +3 -0
- package/dist/plugins/session-ownership.d.ts +1 -1
- package/dist/plugins/session-placement.d.ts +22 -16
- package/dist/plugins/session-placement.js +15 -12
- package/dist/plugins/session-row-sql.d.ts +20 -7
- package/dist/plugins/session-row-sql.js +16 -8
- package/dist/plugins/session-run-rollup.d.ts +29 -0
- package/dist/plugins/session-run-rollup.js +40 -0
- package/dist/plugins/session-store-sql.d.ts +157 -0
- package/dist/plugins/session-store-sql.js +398 -0
- package/dist/plugins/session-withdraw-sql.d.ts +36 -0
- package/dist/plugins/session-withdraw-sql.js +42 -0
- package/dist/plugins/session-workspace-cell.d.ts +2 -2
- package/dist/plugins/session-workspace-cell.js +2 -2
- package/dist/plugins/shared-memory-store-sql.d.ts +10 -69
- package/dist/plugins/shared-memory-store-sql.js +15 -14
- package/dist/plugins/shell-sentinel-owner-m48.d.ts +20 -0
- package/dist/plugins/shell-sentinel-owner-m48.js +3 -0
- package/dist/plugins/snapshot-bucket-presence.d.ts +2 -1
- package/dist/plugins/snapshot-bucket-presence.js +1 -1
- package/dist/plugins/sql-driver.d.ts +24 -8
- package/dist/plugins/sql-driver.js +43 -9
- package/dist/plugins/sql-errors.d.ts +35 -5
- package/dist/plugins/sql-errors.js +55 -3
- package/dist/plugins/sql-json-column.d.ts +8 -7
- package/dist/plugins/sql-json-column.js +10 -6
- package/dist/plugins/store-backend.d.ts +114 -18
- package/dist/plugins/store-backend.js +340 -87
- package/dist/plugins/store-contracts.d.ts +97 -30
- package/dist/plugins/store-contracts.js +23 -1
- package/dist/plugins/store-fault.d.ts +28 -2
- package/dist/plugins/store-fault.js +20 -2
- package/dist/plugins/task-attachment-store.d.ts +21 -11
- package/dist/plugins/task-attachment-store.js +37 -19
- package/dist/plugins/task-list-store-sql.d.ts +1 -1
- package/dist/plugins/text-column-capacity.d.ts +21 -0
- package/dist/plugins/text-column-capacity.js +5 -0
- package/dist/plugins/tidb-pool.d.ts +3 -2
- package/dist/plugins/tidb-pool.js +42 -39
- package/dist/plugins/user-input-ledger-sql.d.ts +1 -1
- package/dist/plugins/web-search.js +5 -3
- package/dist/plugins/workflow-run-store-sql.d.ts +6 -1
- package/dist/plugins/workflow-run-store-sql.js +11 -5
- package/dist/principal-jwt.d.ts +4 -4
- package/dist/principal-jwt.js +20 -5
- package/dist/principal-shape.d.ts +41 -0
- package/dist/principal-shape.js +19 -0
- package/dist/question.d.ts +13 -23
- package/dist/question.js +21 -39
- package/dist/read-face-posture.d.ts +6 -6
- package/dist/read-face-posture.js +2 -2
- package/dist/request-declaration-refusal.d.ts +35 -12
- package/dist/request-declaration-refusal.js +21 -9
- package/dist/request-form.d.ts +58 -0
- package/dist/request-form.js +72 -0
- package/dist/request-image-urls.d.ts +8 -2
- package/dist/request-image-urls.js +2 -1
- package/dist/request-images.d.ts +20 -0
- package/dist/request-images.js +59 -0
- package/dist/request-key-closure.d.ts +6 -7
- package/dist/request-key-closure.js +15 -2
- package/dist/request-value-closure.d.ts +5 -5
- package/dist/request-value-closure.js +1 -1
- package/dist/resource-suspend.d.ts +7 -16
- package/dist/resource-suspend.js +1 -1
- package/dist/retired-name-host-notice.d.ts +21 -0
- package/dist/retired-name-host-notice.js +12 -0
- package/dist/rule-entry-list.d.ts +2 -2
- package/dist/rule-entry-list.js +3 -4
- package/dist/rule-issue-reading.d.ts +58 -0
- package/dist/rule-issue-reading.js +14 -0
- package/dist/rules-consent.d.ts +46 -16
- package/dist/rules-consent.js +102 -53
- package/dist/run-acceptance.d.ts +3 -1
- package/dist/run-acceptance.js +3 -0
- package/dist/run-local.d.ts +14 -6
- package/dist/run-local.js +109 -93
- package/dist/run-stale-default.d.ts +7 -0
- package/dist/run-stale-default.js +2 -0
- package/dist/runs.d.ts +73 -44
- package/dist/runs.js +65 -43
- package/dist/runtime-caps-resolver.d.ts +36 -14
- package/dist/runtime-caps-resolver.js +31 -14
- package/dist/runtime-governance.d.ts +2 -2
- package/dist/runtime-governance.js +5 -3
- package/dist/sealed-key-layout.d.ts +12 -6
- package/dist/sealed-key-layout.js +5 -1
- package/dist/sealed-key.d.ts +12 -2
- package/dist/sealed-key.js +116 -26
- package/dist/security.d.ts +133 -161
- package/dist/security.js +163 -59
- package/dist/sema-config-dir.d.ts +20 -0
- package/dist/sema-config-dir.js +27 -2
- package/dist/server-secret-env.d.ts +23 -5
- package/dist/server-secret-env.js +14 -4
- package/dist/service-version.d.ts +2 -1
- package/dist/service-version.js +2 -2
- package/dist/session-children-retire.d.ts +7 -5
- package/dist/session-children-retire.js +7 -2
- package/dist/session-deletion.d.ts +88 -0
- package/dist/session-deletion.js +8 -0
- package/dist/session-erase.d.ts +145 -0
- package/dist/session-erase.js +115 -0
- package/dist/session-error-wire.d.ts +6 -6
- package/dist/session-error-wire.js +1 -1
- package/dist/session-incarnation.d.ts +60 -10
- package/dist/session-incarnation.js +19 -2
- package/dist/session-policy-wire.d.ts +6 -3
- package/dist/session-policy-wire.js +11 -1
- package/dist/session-resident-background.d.ts +29 -47
- package/dist/session-resident-background.js +77 -8
- package/dist/session-row.d.ts +3 -2
- package/dist/session-rules-seat.d.ts +12 -0
- package/dist/session-rules-seat.js +19 -0
- package/dist/session-sync-kernel.d.ts +1 -1
- package/dist/session-titler.d.ts +7 -15
- package/dist/session-titler.js +1 -1
- package/dist/session-workspace.d.ts +11 -2
- package/dist/session-workspace.js +5 -0
- package/dist/sighup-idle.d.ts +1 -1
- package/dist/spec-fields.d.ts +57 -3
- package/dist/spec-fields.js +72 -51
- package/dist/store-posture.d.ts +138 -21
- package/dist/store-posture.js +188 -3
- package/dist/stored-request-hooks-m20.d.ts +3 -2
- package/dist/stored-request-hooks-m20.js +21 -16
- package/dist/stores-sql/background-agent-store-sql.d.ts +11 -2
- package/dist/stores-sql/background-agent-store-sql.js +73 -20
- package/dist/stores-sql/blob-index-sql.d.ts +148 -0
- package/dist/stores-sql/blob-index-sql.js +154 -0
- package/dist/stores-sql/checkpoint-store-sql.d.ts +34 -29
- package/dist/stores-sql/checkpoint-store-sql.js +86 -71
- package/dist/{plugins → stores-sql}/file-history-store-sql.d.ts +23 -11
- package/dist/{plugins → stores-sql}/file-history-store-sql.js +23 -18
- package/dist/stores-sql/mailbox-store-sql.d.ts +7 -4
- package/dist/stores-sql/mailbox-store-sql.js +31 -32
- package/dist/{plugins → stores-sql}/pg-session-storage.d.ts +30 -81
- package/dist/{plugins → stores-sql}/pg-session-storage.js +123 -244
- package/dist/{plugins → stores-sql}/retention-store-sql.d.ts +197 -223
- package/dist/{plugins → stores-sql}/retention-store-sql.js +148 -207
- package/dist/{plugins → stores-sql}/session-event-payload.d.ts +1 -1
- package/dist/{plugins → stores-sql}/session-event-payload.js +1 -1
- package/dist/stores-sql/session-policy-store-sql.d.ts +33 -11
- package/dist/stores-sql/session-policy-store-sql.js +44 -36
- package/dist/stores-sql/session-write-hooks.d.ts +65 -0
- package/dist/stores-sql/session-write-hooks.js +2 -0
- package/dist/{plugins → stores-sql}/tidb-session-storage.d.ts +14 -15
- package/dist/{plugins → stores-sql}/tidb-session-storage.js +22 -28
- package/dist/{plugins → stores-sql}/tidb-session-store.d.ts +67 -138
- package/dist/{plugins → stores-sql}/tidb-session-store.js +130 -200
- package/dist/stores-sql/tool-result-store-sql.d.ts +1 -1
- package/dist/stores-sql/tool-result-store-sql.js +1 -1
- package/dist/stores-sql/windowed-session-storage.d.ts +61 -0
- package/dist/stores-sql/windowed-session-storage.js +70 -0
- package/dist/submission-exit.d.ts +50 -0
- package/dist/submission-exit.js +108 -0
- package/dist/task-a2a.d.ts +7 -1
- package/dist/task-a2a.js +18 -17
- package/dist/task-cwd.d.ts +31 -3
- package/dist/task-cwd.js +25 -1
- package/dist/task-mcp.d.ts +11 -3
- package/dist/task-mcp.js +16 -19
- package/dist/task-settings.d.ts +23 -14
- package/dist/task-settings.js +35 -13
- package/dist/terminal.d.ts +25 -43
- package/dist/terminal.js +31 -11
- package/dist/tool-approval.d.ts +152 -137
- package/dist/tool-approval.js +199 -199
- package/dist/trace/core-keyset-guard.d.ts +22 -9
- package/dist/trace/core-vocab-wire.d.ts +95 -0
- package/dist/trace/core-vocab-wire.js +15 -0
- package/dist/trace/engine-notice-wire.d.ts +1 -1
- package/dist/trace/engine-notice-wire.js +2 -0
- package/dist/trace/exit-seat.d.ts +52 -4
- package/dist/trace/exit-seat.js +43 -36
- package/dist/trace/extension-call-face.d.ts +3 -2
- package/dist/trace/extension-call-face.js +3 -1
- package/dist/trace/ledger-events.d.ts +4 -7
- package/dist/trace/ledger-sink.d.ts +1 -30
- package/dist/trace/ledger-sink.js +0 -11
- package/dist/trace/model-segment.d.ts +5 -5
- package/dist/trace/model-segment.js +5 -5
- package/dist/trace/project.d.ts +88 -58
- package/dist/trace/project.js +64 -28
- package/dist/trace/redact.d.ts +124 -28
- package/dist/trace/redact.js +936 -328
- package/dist/trace/self-minted-wire.d.ts +750 -29
- package/dist/trace/self-minted-wire.js +262 -25
- package/dist/trace/sema-provenance.d.ts +45 -41
- package/dist/trace/sema-provenance.js +81 -10
- package/dist/trace/task-notification-facets.d.ts +70 -2
- package/dist/trace/task-notification-facets.js +71 -1
- package/dist/trace/wire-projection-faces.d.ts +43 -8
- package/dist/trace/wire-projection-faces.js +28 -3
- package/dist/unread-request-members.d.ts +66 -0
- package/dist/unread-request-members.js +41 -0
- package/dist/upstream-body.d.ts +23 -0
- package/dist/upstream-body.js +16 -0
- package/dist/url-refusal.d.ts +3 -3
- package/dist/url-refusal.js +11 -4
- package/dist/user-authored-text.d.ts +1 -1
- package/dist/user-input-ledger.d.ts +7 -8
- package/dist/user-input-ledger.js +1 -1
- package/dist/web-admin-client/apply-effective.d.ts +6 -3
- package/dist/web-admin-client/apply-effective.js +33 -40
- package/dist/web-admin-client/apply-ledger.d.ts +16 -7
- package/dist/web-admin-client/apply-ledger.js +5 -2
- package/dist/web-admin-client/candidate-gate.d.ts +35 -3
- package/dist/web-admin-client/candidate-gate.js +53 -5
- package/dist/web-admin-client/center-request.d.ts +6 -3
- package/dist/web-admin-client/center-request.js +17 -16
- package/dist/web-admin-client/effective-keys.d.ts +1 -1
- package/dist/web-admin-client/effective-keys.js +1 -2
- package/dist/web-admin-client/entry-metadata.d.ts +8 -0
- package/dist/web-admin-client/entry-metadata.js +13 -0
- package/dist/web-admin-client/facade.d.ts +1 -1
- package/dist/web-admin-client/http-client.d.ts +2 -1
- package/dist/web-admin-client/http-client.js +40 -13
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/mcp-revocation.js +2 -1
- package/dist/web-admin-client/read-warnings.d.ts +1 -0
- package/dist/web-admin-client/read-warnings.js +1 -0
- package/dist/web-admin-client/restart-signal.js +13 -6
- package/dist/web-admin-client/skills-mcp.d.ts +22 -8
- package/dist/web-admin-client/skills-mcp.js +26 -21
- package/dist/web-admin-client/types.d.ts +35 -51
- package/dist/workspace-space.d.ts +3 -2
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +4 -4
- package/package.json +16 -12
- package/scripts/drain-check-local.mjs +118 -173
- package/scripts/drain-check.mysql.sql +20 -16
- package/scripts/drain-check.pg.sql +20 -16
- package/wire-changes/server@7.147.0.json +813 -0
- package/wire-changes/server@7.148.0.json +1517 -0
- package/dist/http/memory-control-plane-corrupt-reply.d.ts +0 -25
- package/dist/http/memory-control-plane-corrupt-reply.js +0 -19
- package/dist/http/memory-layer-reply.d.ts +0 -30
- package/dist/http/memory-layer-reply.js +0 -24
- package/dist/lsp/e2b-bridge.d.ts +0 -57
- package/dist/lsp/e2b-bridge.js +0 -139
- package/dist/lsp/e2b-manager.d.ts +0 -93
- package/dist/lsp/e2b-manager.js +0 -178
- package/dist/lsp/lsp-frames.d.ts +0 -14
- package/dist/lsp/lsp-frames.js +0 -25
- package/dist/lsp/manager.d.ts +0 -129
- package/dist/lsp/manager.js +0 -127
- package/dist/lsp/types.d.ts +0 -12
- package/dist/lsp/types.js +0 -2
- package/dist/lsp/ws-transport.d.ts +0 -40
- package/dist/lsp/ws-transport.js +0 -210
package/dist/plugins/pg-pool.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { createLogger, writeLogText } from "../observability/logger.js";
|
|
1
2
|
import pg from "pg";
|
|
2
3
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
3
4
|
import { pollUntilLocked } from "./ensure-schema-lock-policy.js";
|
|
4
5
|
import { RUN_IDENTITY_COLUMNS } from "../identity-source.js";
|
|
5
|
-
import { ensureSchema as ensureSessionSchema } from "
|
|
6
|
+
import { ensureSchema as ensureSessionSchema } from "../stores-sql/pg-session-storage.js";
|
|
7
|
+
import { sessionExtDdl } from "./session-ext-table.js";
|
|
8
|
+
import { CHECKPOINT_HOST_SESSION_COLUMN } from "./checkpoint-index-columns.js";
|
|
6
9
|
import { ensureSchema as ensureToolResultSchema } from "../stores-sql/tool-result-store-sql.js";
|
|
7
10
|
import { ensureSchema as ensureCostQuotaSchema } from "./pg-cost-quota.js";
|
|
8
11
|
import { ensureSchema as ensureRateLimitSchema } from "./pg-rate-limiter.js";
|
|
@@ -16,11 +19,13 @@ import { ensurePgSessionCaptureOptOutSchema } from "./session-capture-record-sto
|
|
|
16
19
|
import { ensurePgAdoptionLogSchema } from "./adoption-log-sql.js";
|
|
17
20
|
import { ensurePgPermissionRuleSchema } from "./permission-rule-store-sql.js";
|
|
18
21
|
import { ensurePgLeaderRunSchema } from "./leader-run-store-sql.js";
|
|
19
|
-
import {
|
|
22
|
+
import { PG_RETENTION_TOMBSTONE_SCHEMA, RETENTION_TOMBSTONE_INDEXES } from "../stores-sql/retention-store-sql.js";
|
|
23
|
+
import { PG_RETENTION_LANE_SCHEMA, RETENTION_LANE_INDEXES } from "./retention-lane-store-sql.js";
|
|
20
24
|
import { ensureIndexes } from "./ensure-index.js";
|
|
21
25
|
import { SESSION_RULES_COLUMN } from "./session-rules-column.js";
|
|
26
|
+
import { INBOX_PAYLOAD_COLUMN } from "./inbox-payload-column.js";
|
|
22
27
|
import { CENTRAL_SCHEMA_INDEXES } from "./schema-indexes.js";
|
|
23
|
-
import {
|
|
28
|
+
import { PRINCIPAL_MAX_BYTES } from "../principal-shape.js";
|
|
24
29
|
export const PG_SCHEMA_STATEMENTS = [
|
|
25
30
|
`CREATE TABLE IF NOT EXISTS task_run (
|
|
26
31
|
task_id VARCHAR(64) COLLATE "C" NOT NULL,
|
|
@@ -118,6 +123,8 @@ export const PG_SCHEMA_STATEMENTS = [
|
|
|
118
123
|
-- JSON ⇒ 与同表 outcome 列同取 JSONB(协议信封无损,IS NULL 谓词两方言同义)。
|
|
119
124
|
execution_outcome JSONB,
|
|
120
125
|
execution_at_ms BIGINT,
|
|
126
|
+
-- host_session_id:这张卡归在哪只会话上(MySQL 孪生同名同义;语义、写口与 M49 回填见 tidb-pool.ts 同名列的行内注)。
|
|
127
|
+
${CHECKPOINT_HOST_SESSION_COLUMN.pg},
|
|
121
128
|
PRIMARY KEY (token)
|
|
122
129
|
)`,
|
|
123
130
|
`CREATE TABLE IF NOT EXISTS checkpoint_ctx (
|
|
@@ -147,22 +154,27 @@ export const PG_SCHEMA_STATEMENTS = [
|
|
|
147
154
|
consumed_at_ms BIGINT NOT NULL,
|
|
148
155
|
expires_at_ms BIGINT NOT NULL,
|
|
149
156
|
PRIMARY KEY (session_id, nonce)
|
|
157
|
+
)`,
|
|
158
|
+
`CREATE TABLE IF NOT EXISTS approval_nonce_floor (
|
|
159
|
+
singleton CHAR(1) COLLATE "C" NOT NULL DEFAULT 'x',
|
|
160
|
+
floor_ms BIGINT NOT NULL,
|
|
161
|
+
PRIMARY KEY (singleton)
|
|
150
162
|
)`,
|
|
151
163
|
`CREATE TABLE IF NOT EXISTS org_delivery_sender_quota (
|
|
152
|
-
from_scope VARCHAR(${
|
|
164
|
+
from_scope VARCHAR(${PRINCIPAL_MAX_BYTES}) COLLATE "C" NOT NULL,
|
|
153
165
|
window_start_ms BIGINT NOT NULL,
|
|
154
166
|
attempts INT NOT NULL,
|
|
155
167
|
PRIMARY KEY (from_scope)
|
|
156
168
|
)`,
|
|
157
169
|
`CREATE TABLE IF NOT EXISTS org_delivery_recipient_quota (
|
|
158
|
-
to_scope VARCHAR(${
|
|
170
|
+
to_scope VARCHAR(${PRINCIPAL_MAX_BYTES}) COLLATE "C" NOT NULL,
|
|
159
171
|
window_start_ms BIGINT NOT NULL,
|
|
160
172
|
delivered INT NOT NULL,
|
|
161
173
|
PRIMARY KEY (to_scope)
|
|
162
174
|
)`,
|
|
163
175
|
`CREATE TABLE IF NOT EXISTS org_delivery_pair_quota (
|
|
164
|
-
to_scope VARCHAR(${
|
|
165
|
-
from_scope VARCHAR(${
|
|
176
|
+
to_scope VARCHAR(${PRINCIPAL_MAX_BYTES}) COLLATE "C" NOT NULL,
|
|
177
|
+
from_scope VARCHAR(${PRINCIPAL_MAX_BYTES}) COLLATE "C" NOT NULL,
|
|
166
178
|
window_start_ms BIGINT NOT NULL,
|
|
167
179
|
delivered INT NOT NULL,
|
|
168
180
|
PRIMARY KEY (to_scope, from_scope)
|
|
@@ -351,7 +363,8 @@ export const PG_SCHEMA_STATEMENTS = [
|
|
|
351
363
|
-- (the engine's own correlation id, verbatim; the engine's diagnostic teaching text, redacted + bounded at enqueue;
|
|
352
364
|
-- each key absent when the engine minted none, NULL when neither).
|
|
353
365
|
kind VARCHAR(24) COLLATE "C",
|
|
354
|
-
payload
|
|
366
|
+
-- Column definition owner = inbox-payload-column.ts (INBOX_PAYLOAD_COLUMN; TiDB twin same note).
|
|
367
|
+
${INBOX_PAYLOAD_COLUMN.pg},
|
|
355
368
|
PRIMARY KEY (session_id, run_id),
|
|
356
369
|
-- Twin-alignment with TiDB's \`UNIQUE KEY uq_wfinbox_seq (seq)\` (same constraint name on purpose, so the two
|
|
357
370
|
-- schemas can be diffed by name). This is NOT a correctness fix: seq is BIGSERIAL, so it is already unique in
|
|
@@ -426,7 +439,7 @@ export function pgPoolClientErrorMeta(err) {
|
|
|
426
439
|
}
|
|
427
440
|
export function createPgPool(opts, onIdleClientError) {
|
|
428
441
|
const pool = typeof opts === "string" ? new pg.Pool({ connectionString: opts }) : new pg.Pool(opts);
|
|
429
|
-
const warn = onIdleClientError ?? (
|
|
442
|
+
const warn = onIdleClientError ?? createLogger().warn;
|
|
430
443
|
const report = (msgName, state, err, count) => {
|
|
431
444
|
const meta = pgPoolClientErrorMeta(err);
|
|
432
445
|
try {
|
|
@@ -473,7 +486,7 @@ export async function releasePgEnsureSchemaLock(client, tag) {
|
|
|
473
486
|
await client.query("SELECT pg_advisory_unlock($1)", [ENSURE_SCHEMA_LOCK_KEY]);
|
|
474
487
|
}
|
|
475
488
|
catch (err) {
|
|
476
|
-
|
|
489
|
+
writeLogText("stderr", `[${tag}] pg_advisory_unlock(${ENSURE_SCHEMA_LOCK_KEY}) failed (lock auto-frees on connection close):`, err);
|
|
477
490
|
}
|
|
478
491
|
}
|
|
479
492
|
export async function ensurePgSchema(pool) {
|
|
@@ -485,6 +498,7 @@ export async function ensurePgSchema(pool) {
|
|
|
485
498
|
for (const stmt of PG_SCHEMA_STATEMENTS)
|
|
486
499
|
await client.query(stmt);
|
|
487
500
|
await ensureSessionSchema(client);
|
|
501
|
+
await client.query(sessionExtDdl("pg"));
|
|
488
502
|
await ensureToolResultSchema(client);
|
|
489
503
|
await ensureCostQuotaSchema(client);
|
|
490
504
|
await ensureRateLimitSchema(client);
|
|
@@ -498,7 +512,9 @@ export async function ensurePgSchema(pool) {
|
|
|
498
512
|
await ensurePgAdoptionLogSchema((text, params) => client.query(text, params));
|
|
499
513
|
await ensurePgPermissionRuleSchema((text, params) => client.query(text, params));
|
|
500
514
|
await ensurePgLeaderRunSchema((text, params) => client.query(text, params));
|
|
501
|
-
|
|
515
|
+
for (const stmt of [...PG_RETENTION_LANE_SCHEMA, ...PG_RETENTION_TOMBSTONE_SCHEMA])
|
|
516
|
+
await client.query(stmt);
|
|
517
|
+
await ensureIndexes((text, params) => client.query(text, params), "pg", [...RETENTION_LANE_INDEXES, ...RETENTION_TOMBSTONE_INDEXES]);
|
|
502
518
|
await ensureIndexes((text, params) => client.query(text, params), "pg", CENTRAL_SCHEMA_INDEXES);
|
|
503
519
|
}
|
|
504
520
|
finally {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **版本串的两种读法**(唯一一处;两问不同,两个读者各管一问,三段的文法只有一只正则):
|
|
3
|
+
* · {@link releaseTriple} 读 **marker 里的串**(公开契约):纯 `x.y.z` —— 整串三段十进制、无前导零、无 `v` 前缀、无预发布 / 构建后缀、无空白,每段是安全整数;
|
|
4
|
+
* 别的一律读不出(`undefined`),不剥前后缀、不猜;入参先验型(不是字符串 ⇒ 读不出)。与壳侧判官(client-core `compareReleaseVersions` 的 `releaseTriple`)同一读法:
|
|
5
|
+
* 同一对 marker 串两边答案不分叉。
|
|
6
|
+
* · {@link buildReleaseTriple} 读 **本构建 `package.json` 的版本** —— 它属于哪一条发布线:semver 文法的 `x.y.z`,可带 `-<预发布>` 与 / 或 `+<构建>` 后缀;
|
|
7
|
+
* 后缀**只剥不比**(`7.147.0-rc.1` 属于 `7.147.0` 那条线),三段交给 {@link releaseTriple} 同一只正则;不是字符串 / 不合文法 ⇒ 读不出。
|
|
8
|
+
* (钉 `test/local-engine-high-water.test.ts` 的两张读法表逐格对它们。)读者:引擎版本高水位的判与抬(`local-engine-high-water.ts`)。
|
|
9
|
+
*/
|
|
10
|
+
/** 一只发布版本的三段(大 · 次 · 补丁)。 */
|
|
11
|
+
export type ReleaseTriple = readonly [number, number, number];
|
|
12
|
+
/** 纯 `x.y.z` → 三段;不是(含不是字符串 —— 先验型、再匹配,正则不强转)⇒ `undefined`。 */
|
|
13
|
+
export declare function releaseTriple(v: unknown): ReleaseTriple | undefined;
|
|
14
|
+
/** 本构建版本 → 它所属发布线的三段(后缀只剥不比);不是字符串 / 不合 semver 文法 / 三段不是纯 `x.y.z` ⇒ `undefined`。 */
|
|
15
|
+
export declare function buildReleaseTriple(v: unknown): ReleaseTriple | undefined;
|
|
16
|
+
/** 三段的纯 `x.y.z` 串(marker 里写的形;{@link releaseTriple} 读回的就是它)。 */
|
|
17
|
+
export declare function releaseText(t: ReleaseTriple): string;
|
|
18
|
+
/** 两只三段按数比(先大版本,再次版本,再补丁):`-1` / `0` / `1`。 */
|
|
19
|
+
export declare function compareReleaseTriples(a: ReleaseTriple, b: ReleaseTriple): -1 | 0 | 1;
|
|
20
|
+
//# sourceMappingURL=release-version.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function releaseTriple(v) {
|
|
2
|
+
if (typeof v !== "string")
|
|
3
|
+
return undefined;
|
|
4
|
+
const m = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(v);
|
|
5
|
+
if (m === null)
|
|
6
|
+
return undefined;
|
|
7
|
+
const t = [Number(m[1]), Number(m[2]), Number(m[3])];
|
|
8
|
+
return t.every((n) => Number.isSafeInteger(n)) ? t : undefined;
|
|
9
|
+
}
|
|
10
|
+
const PRERELEASE_IDENTIFIER = String.raw `(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)`;
|
|
11
|
+
const BUILD_IDENTIFIER = String.raw `[0-9A-Za-z-]+`;
|
|
12
|
+
const BUILD_VERSION = new RegExp(String.raw `^([^-+]*)(?:-${PRERELEASE_IDENTIFIER}(?:\.${PRERELEASE_IDENTIFIER})*)?(?:\+${BUILD_IDENTIFIER}(?:\.${BUILD_IDENTIFIER})*)?$`);
|
|
13
|
+
export function buildReleaseTriple(v) {
|
|
14
|
+
if (typeof v !== "string")
|
|
15
|
+
return undefined;
|
|
16
|
+
const m = BUILD_VERSION.exec(v);
|
|
17
|
+
return m === null ? undefined : releaseTriple(m[1]);
|
|
18
|
+
}
|
|
19
|
+
export function releaseText(t) {
|
|
20
|
+
return `${t[0]}.${t[1]}.${t[2]}`;
|
|
21
|
+
}
|
|
22
|
+
export function compareReleaseTriples(a, b) {
|
|
23
|
+
for (let i = 0; i < 3; i++)
|
|
24
|
+
if (a[i] !== b[i])
|
|
25
|
+
return a[i] < b[i] ? -1 : 1;
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=release-version.js.map
|
|
@@ -15,6 +15,12 @@ export interface AdbEnvConfig extends LaneHomeConfig {
|
|
|
15
15
|
maxAttempts?: number;
|
|
16
16
|
backoffMs?: number;
|
|
17
17
|
};
|
|
18
|
+
/** 运维日志座(起服装配递本服务的 logger;缺席 ⇒ 本模块自建一只 JSON 行 logger —— 设模式失败那一行不因没人递座而消失)。 */
|
|
19
|
+
logger?: AdbEnvLogger;
|
|
20
|
+
}
|
|
21
|
+
/** 本适配器说话用的那一面(与 k8s / device 车道的 logger 座同形)。 */
|
|
22
|
+
export interface AdbEnvLogger {
|
|
23
|
+
warn(event: string, fields?: Record<string, unknown>): void;
|
|
18
24
|
}
|
|
19
25
|
type ConnectResult = {
|
|
20
26
|
ok: true;
|
|
@@ -79,6 +85,7 @@ export declare class RemoteAdbExecutionEnv implements RemoteExecutionEnv {
|
|
|
79
85
|
* 这条显式授予),没有一条是从本进程继承的 ⇒ `[]`(core 契约:「`[]` when its shell environment is built rather than inherited」)。 */
|
|
80
86
|
readonly withheldEnv: readonly [];
|
|
81
87
|
private readonly cfg;
|
|
88
|
+
private readonly logger;
|
|
82
89
|
private readonly spawnFn;
|
|
83
90
|
private readonly injectedConnectOnce?;
|
|
84
91
|
constructor(config: AdbEnvConfig, deps?: AdbEnvDeps);
|
|
@@ -164,17 +171,26 @@ export declare class RemoteAdbExecutionEnv implements RemoteExecutionEnv {
|
|
|
164
171
|
abortSignal?: AbortSignal;
|
|
165
172
|
}): Promise<Result<string[], FileError>>;
|
|
166
173
|
/** 暂存写的两只面(规则与提交脚本的唯一属主 = `remote-shell.ts` `writeFileStaged` / `appendFileStaged`;父目录与私有暂存目录由编排的准备那一步建):
|
|
167
|
-
* 上传 = `adb push`
|
|
174
|
+
* 上传 = `adb push` 到私有目录里的暂存件(阶段一 = 本机落临时件,见 {@link prepareUpload};阶段二 = push);提交 = 文件面探针 exec。两者同一身份(push 与 `adb shell` 都由设备上的 adbd 以它的身份落盘 / 起进程)。 */
|
|
168
175
|
private stagedLane;
|
|
169
176
|
/** 整旧或整新(暂存 → 一次 `mv -f`)。修前 push 直落目标:传输中途断 / 取消时目标剩什么取决于设备侧 adbd 的落地实现,本适配器不依赖它。 */
|
|
170
177
|
writeFile(p: string, content: string | Uint8Array, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;
|
|
171
178
|
/** 追加(暂存要加的字节 → 一次 `cat >>`;inode 不换、已有字节不重写)。修前 = 读旧 + 拼 + 整份 push(O(文件);中途断 ⇒ 目标没了或半份)。
|
|
172
179
|
* 目录不收新名字 / 私有目录收不成私有时的退路 = 修前那一形(push 没有追加写,只能把整份文件落到一个路径上):读旧(不在 ⇒ 按空;别的读错照实答、不 push)
|
|
173
|
-
* + 拼 + 整份 push 直落目标(与 e2b 共用 `rewriteAppend`)—— 非原子,push 中途断 / 取消 ⇒
|
|
180
|
+
* + 拼 + 本机落临时件 + 整份 push 直落目标(与 e2b 共用 `rewriteAppend`)—— 非原子,push 中途断 / 取消 ⇒ 目标可能没了或只剩半份;读旧与落临时件是备件阶段:
|
|
181
|
+
* 取消落在这里 ⇒ `aborted`、目标未碰、一次 push 都没发,只有 push 那一步被取消打断才答 `unknown`。
|
|
174
182
|
* Android 共享存储(权限位由挂载派生)上收紧那一步按 sdcardfs / MediaProvider FUSE 的权限语义**推断**不过(未上真机,真机读数候 test),追加每次走这里。 */
|
|
175
183
|
appendFile(p: string, content: string | Uint8Array, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;
|
|
176
|
-
/**
|
|
177
|
-
*
|
|
184
|
+
/** 阶段一(备件):把整份内容在本机落一只临时件(二进制安全,不经 shell 转义载荷)—— 临时件同样只在私有目录里出现(`mkdtemp` 建的目录生来 0700,本机别的用户读不到);
|
|
185
|
+
* 文件自己带 {@link OWNER_ONLY_FILE_MODE}(0600,不靠上层私有目录兜:内容是要上设备的文件,可能含凭据)。设备侧的模式**不随它走**:`adb push` 会把本机文件的模式位带到设备上
|
|
186
|
+
* 〔推断,未上真机;adbd 还会先把属主位扩到组 / 他人位、再交文件系统策略〕,所以阶段二在 push 之后把目的地显式设回 {@link DEVICE_PUSHED_FILE_MODE}(尽力而为)。这一段只碰本机,没有一个字节发往设备:编排在它之后复核取消、再起阶段二;`release` 删临时件。
|
|
187
|
+
* 阶段二({@link push})把临时件 `adb push` 到设备上的 `dest`。 */
|
|
188
|
+
private prepareUpload;
|
|
189
|
+
/** 阶段二:把本机临时件 `adb push` 到设备上的 `dest`(建或覆盖),**同一步内**紧跟一次 `chmod -- 0644 <dest>`:设备目标的模式是显式的 {@link DEVICE_PUSHED_FILE_MODE},
|
|
190
|
+
* 不依赖临时件的模式传播(升级前它来自本机 umask 的缺省 0644)。push 的结局就是这一步的结局:push 失败 ⇒ 既有错误形;取消落在 push 里 ⇒ `aborted`(编排按阶段二读)。
|
|
191
|
+
* 设模式是**尽力而为**(「传完之后设模式」全树一种失败策略,与 `remote-shell.ts` 的 `carryMode` 同):字节已经落地,设不上(文件系统不认改模式 / 设备掉线 / 取消落在 chmod 上)
|
|
192
|
+
* ⇒ 这一步照样成功,只多一行运维 warn `remote_env_file_mode_failed`(目的地经出口座、设备回话只取首行;不记 fail-open:模式是显式加固,目标文件系统不支持时无从加固,
|
|
193
|
+
* 不是放宽 —— 升级前同一只文件落成的位也由文件系统定)。答失败会让调用方以为没写成,而目标已是新字节。 */
|
|
178
194
|
private push;
|
|
179
195
|
private posixFsInst?;
|
|
180
196
|
private get posixFs();
|
|
@@ -5,6 +5,7 @@ import { spawn } from "node:child_process";
|
|
|
5
5
|
import { hostSubprocessEnv } from "../server-secret-env.js";
|
|
6
6
|
import { LANE_HOME_PROBE_COMMAND, LaneHomeSeat } from "../lane-home-probe.js";
|
|
7
7
|
import { appendFileStaged, rewriteAppend, buildCwdEnvCommand, createCwdGuardedCall, shellQuote, armPipeDestroyGrace, writeFileStaged } from "./remote-shell.js";
|
|
8
|
+
import { OWNER_ONLY_FILE_MODE } from "./owner-only-file-mode.js";
|
|
8
9
|
import { signalNumber } from "./host-platform.js";
|
|
9
10
|
import { buildLivenessCut, commandBoundsOf } from "../exec-bounds.js";
|
|
10
11
|
import { buildCapturedOutput, createCutError } from "../exec-cut.js";
|
|
@@ -12,7 +13,10 @@ import { FileError, ExecutionError, RemoteExecutionError, withRetry, RollingTail
|
|
|
12
13
|
import { capabilitiesFor } from "../execution-lane-caps.js";
|
|
13
14
|
import { classifyFsStderr, fileErrorFromExec } from "./remote-env-file-error.js";
|
|
14
15
|
import { createPosixShellFs } from "./posix-shell-fs.js";
|
|
16
|
+
import { createLogger } from "../observability/logger.js";
|
|
17
|
+
import { seatText } from "../trace/exit-seat.js";
|
|
15
18
|
const PROVIDER = "adb";
|
|
19
|
+
const DEVICE_PUSHED_FILE_MODE = "0644";
|
|
16
20
|
const ok = (value) => ({ ok: true, value });
|
|
17
21
|
const unsupported = (op) => ({
|
|
18
22
|
ok: false,
|
|
@@ -42,6 +46,7 @@ export class RemoteAdbExecutionEnv {
|
|
|
42
46
|
cdPath = "unknown";
|
|
43
47
|
withheldEnv = [];
|
|
44
48
|
cfg;
|
|
49
|
+
logger;
|
|
45
50
|
spawnFn;
|
|
46
51
|
injectedConnectOnce;
|
|
47
52
|
constructor(config, deps) {
|
|
@@ -54,6 +59,7 @@ export class RemoteAdbExecutionEnv {
|
|
|
54
59
|
retry: { maxAttempts: config.retry?.maxAttempts ?? 3, backoffMs: config.retry?.backoffMs ?? 800 },
|
|
55
60
|
};
|
|
56
61
|
this.cwd = this.cfg.mountPath;
|
|
62
|
+
this.logger = config.logger ?? createLogger();
|
|
57
63
|
this.homeSeat = new LaneHomeSeat(PROVIDER, config);
|
|
58
64
|
this.spawnFn = deps?.spawn ?? spawn;
|
|
59
65
|
this.injectedConnectOnce = deps?.connectOnce;
|
|
@@ -360,7 +366,7 @@ export class RemoteAdbExecutionEnv {
|
|
|
360
366
|
return ok(lines);
|
|
361
367
|
}
|
|
362
368
|
stagedLane(content) {
|
|
363
|
-
return {
|
|
369
|
+
return { prepare: this.prepareUpload(content), run: (cmd, signal) => this.fsExec(cmd, signal), provider: PROVIDER, logger: this.logger };
|
|
364
370
|
}
|
|
365
371
|
async writeFile(p, content, abortSignal) {
|
|
366
372
|
const gated = await this.fsGate(p);
|
|
@@ -373,14 +379,29 @@ export class RemoteAdbExecutionEnv {
|
|
|
373
379
|
if (gated)
|
|
374
380
|
return gated;
|
|
375
381
|
const abs = this.resolve(p);
|
|
376
|
-
return appendFileStaged(this.stagedLane(content), abs, abortSignal,
|
|
382
|
+
return appendFileStaged(this.stagedLane(content), abs, abortSignal, rewriteAppend((signal) => this.readBinaryFile(abs, signal), (merged) => this.prepareUpload(merged), content));
|
|
383
|
+
}
|
|
384
|
+
prepareUpload(content) {
|
|
385
|
+
return async () => {
|
|
386
|
+
let localDir;
|
|
387
|
+
const release = async () => {
|
|
388
|
+
if (localDir)
|
|
389
|
+
await fs.rm(localDir, { recursive: true, force: true }).catch(() => { });
|
|
390
|
+
};
|
|
391
|
+
try {
|
|
392
|
+
localDir = await fs.mkdtemp(path.join(os.tmpdir(), "sema-adb-push-"));
|
|
393
|
+
const local = path.join(localDir, "data");
|
|
394
|
+
await fs.writeFile(local, typeof content === "string" ? Buffer.from(content, "utf8") : Buffer.from(content), { mode: OWNER_ONLY_FILE_MODE });
|
|
395
|
+
return ok({ upload: (dest, signal) => this.push(local, dest, signal), release });
|
|
396
|
+
}
|
|
397
|
+
catch (e) {
|
|
398
|
+
await release();
|
|
399
|
+
return { ok: false, error: new FileError("unknown", e instanceof Error ? e.message : String(e)) };
|
|
400
|
+
}
|
|
401
|
+
};
|
|
377
402
|
}
|
|
378
|
-
async push(
|
|
379
|
-
let localDir;
|
|
403
|
+
async push(local, dest, abortSignal) {
|
|
380
404
|
try {
|
|
381
|
-
localDir = await fs.mkdtemp(path.join(os.tmpdir(), "sema-adb-push-"));
|
|
382
|
-
const local = path.join(localDir, "data");
|
|
383
|
-
await fs.writeFile(local, typeof content === "string" ? Buffer.from(content, "utf8") : Buffer.from(content));
|
|
384
405
|
const r = await this.adb(["-s", this.cfg.serial, "push", local, dest], { signal: abortSignal, timeoutMs: this.cfg.dataTimeoutMs });
|
|
385
406
|
if (!r.ok)
|
|
386
407
|
return { ok: false, error: fileErrorFromExec(r.error, dest) };
|
|
@@ -389,15 +410,22 @@ export class RemoteAdbExecutionEnv {
|
|
|
389
410
|
return { ok: false, error: new FileError("permission_denied", out.trim(), dest) };
|
|
390
411
|
if (r.value.exitCode !== 0)
|
|
391
412
|
return { ok: false, error: new FileError("unknown", r.value.stderr.trim() || `adb push failed for ${dest}`, dest) };
|
|
413
|
+
const m = await this.fsExec(`chmod -- ${DEVICE_PUSHED_FILE_MODE} ${shellQuote(dest)}`, abortSignal);
|
|
414
|
+
const unset = !m.ok ? m.error.message : m.value.exitCode !== 0 ? m.value.stderr.trim() || `chmod exited ${m.value.exitCode}` : undefined;
|
|
415
|
+
if (unset !== undefined) {
|
|
416
|
+
this.logger.warn("remote_env_file_mode_failed", {
|
|
417
|
+
provider: PROVIDER,
|
|
418
|
+
path: seatText("operator-log-arg", dest),
|
|
419
|
+
mode: DEVICE_PUSHED_FILE_MODE,
|
|
420
|
+
error: seatText("operator-log-text", unset.split(/\r?\n/, 1)[0] ?? ""),
|
|
421
|
+
effect: "the bytes landed; the file keeps the mode the device filesystem gave it (setting the mode is best effort, as adbd itself treats it)",
|
|
422
|
+
});
|
|
423
|
+
}
|
|
392
424
|
return ok(undefined);
|
|
393
425
|
}
|
|
394
426
|
catch (e) {
|
|
395
427
|
return { ok: false, error: new FileError("unknown", e instanceof Error ? e.message : String(e), dest) };
|
|
396
428
|
}
|
|
397
|
-
finally {
|
|
398
|
-
if (localDir)
|
|
399
|
-
await fs.rm(localDir, { recursive: true, force: true }).catch(() => { });
|
|
400
|
-
}
|
|
401
429
|
}
|
|
402
430
|
posixFsInst;
|
|
403
431
|
get posixFs() {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* iterator MAY throw `RemoteExecutionError` mid-stream before an `exit` chunk (seam contract, OutputChunk).
|
|
21
21
|
*/
|
|
22
22
|
import { Sandbox, type SandboxOpts, type SandboxConnectOpts } from "e2b";
|
|
23
|
-
import { FileError, ExecutionError, RemoteExecutionError, type ExecutionEnv, type RemoteExecutionEnv, type WorkspaceHandle, type FileInfo, type Result, type SymlinkChain, type OutputChunk, type ExecStreamOptions, type RemoteConnectConfig, type SnapshotId, type SessionToken, type ExecutionEnvFactory, type VmLifecycleOptions, type BackgroundShellCapability, type BackgroundShellId, type BackgroundShellError, type BackgroundSpawnOptions, type BackgroundPoll, type ExecutionEnvCapabilities } from "@sema-agent/core";
|
|
23
|
+
import { FileError, ExecutionError, RemoteExecutionError, type ExecutionEnv, type ExecResult, type RemoteExecutionEnv, type WorkspaceHandle, type FileInfo, type Result, type SymlinkChain, type OutputChunk, type ExecStreamOptions, type RemoteConnectConfig, type SnapshotId, type SessionToken, type ExecutionEnvFactory, type VmLifecycleOptions, type BackgroundShellCapability, type BackgroundShellId, type BackgroundShellError, type BackgroundSpawnOptions, type BackgroundPoll, type ExecutionEnvCapabilities } from "@sema-agent/core";
|
|
24
24
|
import { type SandboxReadFloorKnob } from "../execution-lane-caps.js";
|
|
25
25
|
import { type SandboxReadFloor } from "./sandbox-read-floor.js";
|
|
26
26
|
import { type LaneHomeConfig } from "../lane-home-probe.js";
|
|
@@ -159,18 +159,6 @@ export declare class RemoteContainerExecutionEnv implements RemoteExecutionEnv,
|
|
|
159
159
|
/** 收据句柄。还没连上(懒环境:续跑腿的引擎在 `resumeVM` **之前**先取它比车道)⇒ 未连接形 `{ sandboxId: "(unconnected)", provider, mountPath }`(与 k8s 车道同形),
|
|
160
160
|
* 不抛 —— 抛了,续跑腿在恢复之前就失败。 */
|
|
161
161
|
workspaceHandle(): WorkspaceHandle;
|
|
162
|
-
/**
|
|
163
|
-
* Public host for a port inside the sandbox (E2B reverse proxy → `<port>-<id>.e2b.app`). The LSP sidecar
|
|
164
|
-
* ([ref] §13.1) uses this to reach the in-sandbox language-server WS bridge over `wss://`. Lazily
|
|
165
|
-
* provisions the VM (like exec/fs); `undefined` if it can't connect → the LSP manager degrades.
|
|
166
|
-
*/
|
|
167
|
-
getHost(port: number): Promise<string | undefined>;
|
|
168
|
-
/**
|
|
169
|
-
* Launch a long-running process as a TRUE E2B background command (resolves once launched, E2B keeps it alive)
|
|
170
|
-
* — for the LSP bridge ([ref] §13.1). NOT the same as `exec` with a shell `&`: E2B reaps a foreground
|
|
171
|
-
* command's process group on completion, which would kill an in-shell `&`/nohup child. Fire-and-forget.
|
|
172
|
-
*/
|
|
173
|
-
startBackground(command: string): Promise<void>;
|
|
174
162
|
connect(config?: RemoteConnectConfig): Promise<{
|
|
175
163
|
ok: true;
|
|
176
164
|
value: WorkspaceHandle;
|
|
@@ -251,14 +239,7 @@ export declare class RemoteContainerExecutionEnv implements RemoteExecutionEnv,
|
|
|
251
239
|
private stopKeepAlive;
|
|
252
240
|
destroy(): Promise<void>;
|
|
253
241
|
cleanup(): Promise<void>;
|
|
254
|
-
exec(command: string, options?: ExecOpts): Promise<Result<
|
|
255
|
-
stdout: string;
|
|
256
|
-
stderr: string;
|
|
257
|
-
exitCode: number;
|
|
258
|
-
detached?: {
|
|
259
|
-
shellId: string;
|
|
260
|
-
};
|
|
261
|
-
}, ExecutionError>>;
|
|
242
|
+
exec(command: string, options?: ExecOpts): Promise<Result<ExecResult, ExecutionError>>;
|
|
262
243
|
/** 适配器自己的固定命令(文件面助手:readlink / realpath / rm / mktemp / 暂存写的提交)—— 与 {@link exec} 同一条路,起动形 `adapter`。 */
|
|
263
244
|
private execInternal;
|
|
264
245
|
private execAs;
|
|
@@ -291,12 +272,21 @@ export declare class RemoteContainerExecutionEnv implements RemoteExecutionEnv,
|
|
|
291
272
|
readBinaryFile(p: string, abortSignal?: AbortSignal): Promise<Result<Uint8Array, FileError>>;
|
|
292
273
|
/** 暂存写的两只面(规则与提交脚本的唯一属主 = `remote-shell.ts` `writeFileStaged` / `appendFileStaged`;本腿是原生 SDK 腿,与四条
|
|
293
274
|
* shell 腿共用的是这只编排,不是 `posix-shell-fs` 基座;父目录与私有暂存目录由编排的准备那一步建):上传 = `files.write` 整份写到私有目录里的
|
|
294
|
-
* 暂存件;提交 = 一次 `exec
|
|
275
|
+
* 暂存件;提交 = 一次 `exec`。
|
|
276
|
+
*
|
|
277
|
+
* **身份怎么读(出处:e2b 2.36.0 的 `dist/index.d.ts`,按符号名 + 文档原句引,不引行号 —— 上游 dist 的行号随提货漂)**:上传的 `files.write` 不带 `user`(下面 `upload`);
|
|
278
|
+
* `FilesystemRequestOpts.user` 的文档说它影响「解析相对路径与 `ownership of the created filesystem objects`」(所建文件系统对象的**属主**),
|
|
279
|
+
* 文件接口 REST 参数 `username` 的文档句是 `Defaults to the sandbox's default user`(缺省 = 沙箱的缺省用户)⇒ 上传落下的东西**属主**是沙箱缺省用户。
|
|
280
|
+
* 提交 / 清理的 `commands.run`:`CommandStartOpts.user` 的缺省是 `default Sandbox user (as specified in the template)`(模板的缺省用户);本腿的起动经 {@link startIn} 的起动编码,身份只由那一处给
|
|
281
|
+
* (读地板守着时外层以 root 起、监督者再降到工作区属主,见 `sandbox-read-floor.ts` 的 `laneLaunchPlan`)。
|
|
282
|
+
* 所以编排要的「提交方拿得走、清得掉上传落下的东西」靠的是**属主**(缺省用户 = 命令的缺省执行用户);SDK 类型**没有**说上传是以该用户的**权限**去写 ——
|
|
283
|
+
* [I:读 SDK 类型,推断由沙箱守护进程代写再改属主;未上真沙箱]。这一差别的后果:准备脚本建的 0700 私有目录属提交方,上传能写进去是守护进程代写的结果、
|
|
284
|
+
* 不是「同一个用户自己写」;目录收不成私有而退到直接写目标时,`files.write` 整份写目标,落地后的属主 / 权限位由沙箱侧定(与 7.138.x 同权,无用户可见回归)。 */
|
|
295
285
|
private stagedLane;
|
|
296
286
|
/** 整旧或整新(暂存 → 一次 `mv -f`)。修前 `files.write` 直落目标:上传中途断 / 取消时目标剩什么取决于沙箱侧的落地实现,本适配器不依赖它。 */
|
|
297
287
|
writeFile(p: string, content: string | Uint8Array, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;
|
|
298
288
|
/** 追加(暂存要加的字节 → 一次 `cat >>`;inode 不换、已有字节不重写)。修前 = 读旧 + 拼 + 整份 `files.write`(O(文件);中途断 ⇒
|
|
299
|
-
* 半份)。目录不收新名字 / 私有目录收不成私有时的退路 = 旧形(`rewriteAppend`:读旧 +
|
|
289
|
+
* 半份)。目录不收新名字 / 私有目录收不成私有时的退路 = 旧形(`rewriteAppend`:读旧 + 拼是备件阶段,取消落在那里 ⇒ `aborted`、目标未碰;整份 `files.write` 到目标是传输那一步,被取消打断 ⇒ `unknown`)。 */
|
|
300
290
|
appendFile(p: string, content: string | Uint8Array, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;
|
|
301
291
|
fileInfo(p: string, abortSignal?: AbortSignal): Promise<Result<FileInfo, FileError>>;
|
|
302
292
|
listDir(p: string, abortSignal?: AbortSignal): Promise<Result<FileInfo[], FileError>>;
|
|
@@ -346,10 +336,11 @@ export declare class RemoteContainerExecutionEnv implements RemoteExecutionEnv,
|
|
|
346
336
|
* confirmations: a refused `kill()` (logged; the exit is still awaited), a `wait()` that ends without an exit (the
|
|
347
337
|
* connection deadline, a lost stream — the process may still run). With neither the count stays held and `suspendVM`
|
|
348
338
|
* keeps refusing `command_in_flight` — the same arm as a start that never settles. No start promise (the op never ran)
|
|
349
|
-
* ⇒ released now. A
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
* not
|
|
339
|
+
* ⇒ released now. A start that FAILED is read by the same rule ({@link providerRefusedStart}): the provider answered a
|
|
340
|
+
* refusal of the request itself ⇒ no process was ever spawned — a confirmation, released; any other failure (the SDK's
|
|
341
|
+
* own handshake deadline, a dropped stream, an unreachable sandbox, anything else) has no answer in it — the provider may
|
|
342
|
+
* have spawned the process and the reply was lost ⇒ not a confirmation, held, and said once
|
|
343
|
+
* (`e2b_start_outcome_unknown`: the sandbox and the error's class, never the command).
|
|
353
344
|
*/
|
|
354
345
|
private settleAbandonedStart;
|
|
355
346
|
/**
|
|
@@ -390,7 +381,7 @@ export declare class RemoteContainerExecutionEnv implements RemoteExecutionEnv,
|
|
|
390
381
|
/**
|
|
391
382
|
* Build the deployment-level `RunnerDeps.executionEnvFactory` ([ref] v1b). Wiring this onto a
|
|
392
383
|
* deployment makes it a "code-agent worker": every task's hand runs in a per-task E2B VM. Deployments that do
|
|
393
|
-
*
|
|
384
|
+
* declare another lane run that lane's factory (or none, for `REMOTE_EXEC=none`) — routing is **deployment-level** (the factory
|
|
394
385
|
* ctx carries only sessionId/taskId, never a service scenario; that stays out of the generic core seam).
|
|
395
386
|
*
|
|
396
387
|
* The factory returns the env **unconnected** (lazy): the VM is provisioned on first FS/Shell/execStream use,
|
|
@@ -5,7 +5,7 @@ import { capabilitiesFor } from "../execution-lane-caps.js";
|
|
|
5
5
|
import { ADAPTER_START, BOOTSTRAP_START, createSandboxReadFloor, e2bFloorCommand, engineStart, } from "./sandbox-read-floor.js";
|
|
6
6
|
import { LANE_HOME_PROBE_COMMAND, LaneHomeSeat } from "../lane-home-probe.js";
|
|
7
7
|
import { fileErrorFromExec } from "./remote-env-file-error.js";
|
|
8
|
-
import { appendFileStaged, rewriteAppend, numEnvOr, runSymlinkChain, shellQuote, writeFileStaged } from "./remote-shell.js";
|
|
8
|
+
import { appendFileStaged, readyUpload, rewriteAppend, numEnvOr, runSymlinkChain, shellQuote, writeFileStaged } from "./remote-shell.js";
|
|
9
9
|
import { buildLivenessCut, commandBoundsOf, firstBoundOf, laneLivenessOf, LIVENESS_MS_DEFAULT } from "../exec-bounds.js";
|
|
10
10
|
import { createCutError } from "../exec-cut.js";
|
|
11
11
|
import { BackgroundShellManager } from "./background-shell-support.js";
|
|
@@ -140,19 +140,6 @@ export class RemoteContainerExecutionEnv {
|
|
|
140
140
|
workspaceHandle() {
|
|
141
141
|
return this.handle ?? { sandboxId: "(unconnected)", provider: PROVIDER, mountPath: this.cwd };
|
|
142
142
|
}
|
|
143
|
-
async getHost(port) {
|
|
144
|
-
const conn = await this.ensureConnected();
|
|
145
|
-
return conn.ok ? conn.value.getHost(port) : undefined;
|
|
146
|
-
}
|
|
147
|
-
async startBackground(command) {
|
|
148
|
-
const conn = await this.ensureConnected();
|
|
149
|
-
if (!conn.ok)
|
|
150
|
-
return;
|
|
151
|
-
const s = this.startIn(engineStart(undefined), command, undefined);
|
|
152
|
-
if (!s.ok)
|
|
153
|
-
return void this.cfg.logger?.warn?.("remote_env_background_refused", { error: s.error.message });
|
|
154
|
-
await this.runIn(conn.value, s.value, { background: true });
|
|
155
|
-
}
|
|
156
143
|
async connect(config) {
|
|
157
144
|
if (config?.snapshotId) {
|
|
158
145
|
return this.resumeVM(config.snapshotId, config.abortSignal ? { abortSignal: config.abortSignal } : undefined);
|
|
@@ -507,7 +494,7 @@ export class RemoteContainerExecutionEnv {
|
|
|
507
494
|
background: true,
|
|
508
495
|
cwd: this.resolve(options?.cwd ?? this.cwd),
|
|
509
496
|
timeoutMs: tee
|
|
510
|
-
?
|
|
497
|
+
? this.commandTimeoutMs(options?.timeout) + (E2B_BG_MAX_TIMEOUT_SEC + E2B_BG_PROVIDER_BACKSTOP_PAD_SEC) * 1000
|
|
511
498
|
: this.commandTimeoutMs(options?.timeout),
|
|
512
499
|
onStdout: (d) => {
|
|
513
500
|
if (startCut)
|
|
@@ -554,12 +541,14 @@ export class RemoteContainerExecutionEnv {
|
|
|
554
541
|
waitP.then(markResolved, markResolved);
|
|
555
542
|
let fgSettled = false;
|
|
556
543
|
let adoptedShellId;
|
|
544
|
+
let adoptedCause;
|
|
557
545
|
let onDetach;
|
|
546
|
+
let onDetachSignal;
|
|
558
547
|
const detachedP = detachSignal && tee
|
|
559
548
|
? new Promise((res) => {
|
|
560
|
-
|
|
549
|
+
const adoptRunning = (cause) => {
|
|
561
550
|
if (detached || fgSettled || fgResolved || options?.abortSignal?.aborted)
|
|
562
|
-
return;
|
|
551
|
+
return false;
|
|
563
552
|
const adopted = this.bgManager.adoptSync((ctx) => {
|
|
564
553
|
waitP
|
|
565
554
|
.then((r) => ctx.onTerminal(false, r.exitCode))
|
|
@@ -572,22 +561,28 @@ export class RemoteContainerExecutionEnv {
|
|
|
572
561
|
return { handle, stdout: tee.stdout, stderr: tee.stderr };
|
|
573
562
|
});
|
|
574
563
|
if (!adopted)
|
|
575
|
-
return;
|
|
564
|
+
return false;
|
|
576
565
|
adoptedShellId = adopted.shellId;
|
|
566
|
+
adoptedCause = cause;
|
|
577
567
|
detached = true;
|
|
578
568
|
res("detached");
|
|
569
|
+
return true;
|
|
579
570
|
};
|
|
571
|
+
onDetach = adoptRunning;
|
|
572
|
+
const signalled = () => void adoptRunning();
|
|
573
|
+
onDetachSignal = signalled;
|
|
580
574
|
if (detachSignal.aborted)
|
|
581
|
-
|
|
575
|
+
signalled();
|
|
582
576
|
else
|
|
583
|
-
detachSignal.addEventListener("abort",
|
|
577
|
+
detachSignal.addEventListener("abort", signalled, { once: true });
|
|
584
578
|
})
|
|
585
579
|
: undefined;
|
|
580
|
+
const onWall = options?.autoBackgroundOnTimeout === true && detachedP !== undefined ? () => onDetach?.("timeout") === true : undefined;
|
|
586
581
|
try {
|
|
587
582
|
const fg = this.waitWithLiveness(handle, () => lastProgress, {
|
|
588
583
|
waitP,
|
|
589
584
|
disarmed: () => detached,
|
|
590
|
-
...(tee ? { wall: { totalMs: this.commandTimeoutMs(options?.timeout), leftMs: Math.max(0, this.commandTimeoutMs(options?.timeout) - (Date.now() - startedAt)) } } : {}),
|
|
585
|
+
...(tee ? { wall: { totalMs: this.commandTimeoutMs(options?.timeout), leftMs: Math.max(0, this.commandTimeoutMs(options?.timeout) - (Date.now() - startedAt)), ...(onWall !== undefined ? { onWall } : {}) } } : {}),
|
|
591
586
|
liveness: bounds.liveness,
|
|
592
587
|
captured,
|
|
593
588
|
});
|
|
@@ -599,7 +594,7 @@ export class RemoteContainerExecutionEnv {
|
|
|
599
594
|
stdout: markTruncated(o.text, o.droppedBytes),
|
|
600
595
|
stderr: markTruncated(e.text, e.droppedBytes),
|
|
601
596
|
exitCode: 0,
|
|
602
|
-
detached: { shellId: adoptedShellId },
|
|
597
|
+
detached: { shellId: adoptedShellId, ...(adoptedCause !== undefined ? { cause: adoptedCause } : {}) },
|
|
603
598
|
});
|
|
604
599
|
}
|
|
605
600
|
if (options?.abortSignal?.aborted && !detached) {
|
|
@@ -618,8 +613,8 @@ export class RemoteContainerExecutionEnv {
|
|
|
618
613
|
}
|
|
619
614
|
finally {
|
|
620
615
|
fgSettled = true;
|
|
621
|
-
if (
|
|
622
|
-
detachSignal.removeEventListener("abort",
|
|
616
|
+
if (onDetachSignal && detachSignal)
|
|
617
|
+
detachSignal.removeEventListener("abort", onDetachSignal);
|
|
623
618
|
this.activeCommands--;
|
|
624
619
|
options?.abortSignal?.removeEventListener("abort", onAbort);
|
|
625
620
|
}
|
|
@@ -673,7 +668,7 @@ export class RemoteContainerExecutionEnv {
|
|
|
673
668
|
const bc = boundCut(first);
|
|
674
669
|
throw new RemoteExecutionError(bc.code, bc.message, e);
|
|
675
670
|
}
|
|
676
|
-
throw this.remoteError(e, "connect_failed");
|
|
671
|
+
throw this.remoteError(e, providerTimedOut(e) ? "timeout" : "connect_failed");
|
|
677
672
|
}
|
|
678
673
|
handle
|
|
679
674
|
.wait()
|
|
@@ -904,7 +899,7 @@ export class RemoteContainerExecutionEnv {
|
|
|
904
899
|
stagedLane(sbx, content) {
|
|
905
900
|
const data = typeof content === "string" ? content : toArrayBuffer(content);
|
|
906
901
|
return {
|
|
907
|
-
|
|
902
|
+
prepare: readyUpload(async (dest, signal) => {
|
|
908
903
|
try {
|
|
909
904
|
await this.rpc("files.write", (s) => sbx.files.write(dest, data, { signal: s }), signal, this.cfg.dataTimeoutMs);
|
|
910
905
|
return ok(undefined);
|
|
@@ -912,8 +907,10 @@ export class RemoteContainerExecutionEnv {
|
|
|
912
907
|
catch (e) {
|
|
913
908
|
return { ok: false, error: this.fileError(e, dest, signal) };
|
|
914
909
|
}
|
|
915
|
-
},
|
|
910
|
+
}),
|
|
916
911
|
run: (cmd, signal) => this.execInternal(cmd, { cwd: "/", ...(signal !== undefined ? { abortSignal: signal } : {}) }),
|
|
912
|
+
provider: PROVIDER,
|
|
913
|
+
logger: this.cfg.logger,
|
|
917
914
|
};
|
|
918
915
|
}
|
|
919
916
|
async writeFile(p, content, abortSignal) {
|
|
@@ -927,7 +924,7 @@ export class RemoteContainerExecutionEnv {
|
|
|
927
924
|
if (!sbx.ok)
|
|
928
925
|
return sbx;
|
|
929
926
|
const abs = this.resolve(p);
|
|
930
|
-
return appendFileStaged(this.stagedLane(sbx.value, content), abs, abortSignal,
|
|
927
|
+
return appendFileStaged(this.stagedLane(sbx.value, content), abs, abortSignal, rewriteAppend((signal) => this.readBinaryFile(abs, signal), (merged) => this.stagedLane(sbx.value, merged).prepare, content));
|
|
931
928
|
}
|
|
932
929
|
async fileInfo(p, abortSignal) {
|
|
933
930
|
const sbx = await this.fsReady(p);
|
|
@@ -1081,7 +1078,15 @@ export class RemoteContainerExecutionEnv {
|
|
|
1081
1078
|
late.kill().then(release, (e) => {
|
|
1082
1079
|
this.cfg.logger?.warn?.("e2b_abandoned_start_kill_failed", { sandboxId: this.sbx?.sandboxId, pid: late.pid, error: e instanceof Error ? e.name : typeof e });
|
|
1083
1080
|
});
|
|
1084
|
-
},
|
|
1081
|
+
}, (e) => {
|
|
1082
|
+
if (providerRefusedStart(e))
|
|
1083
|
+
return release();
|
|
1084
|
+
this.cfg.logger?.warn?.("e2b_start_outcome_unknown", {
|
|
1085
|
+
sandboxId: this.sbx?.sandboxId,
|
|
1086
|
+
error: e instanceof Error ? e.name : typeof e,
|
|
1087
|
+
effect: "the command start failed without the provider refusing it — the command may be running, so this sandbox is not suspended (command_in_flight) for the rest of its life",
|
|
1088
|
+
});
|
|
1089
|
+
});
|
|
1085
1090
|
}
|
|
1086
1091
|
commandTimeoutMs(timeoutSec) {
|
|
1087
1092
|
return timeoutSec != null ? timeoutSec * 1000 : this.cfg.timeoutMs;
|
|
@@ -1113,6 +1118,8 @@ export class RemoteContainerExecutionEnv {
|
|
|
1113
1118
|
wallTimer = setTimeout(() => {
|
|
1114
1119
|
if (opts.disarmed?.())
|
|
1115
1120
|
return;
|
|
1121
|
+
if (wall.onWall?.() === true)
|
|
1122
|
+
return;
|
|
1116
1123
|
reject(createCutError({ code: "timeout", message: wallCutMessage(wall.totalMs) }, opts.captured()));
|
|
1117
1124
|
void handle.kill().catch(() => { });
|
|
1118
1125
|
}, wall.leftMs);
|
|
@@ -1230,6 +1237,10 @@ function boundCut(first) {
|
|
|
1230
1237
|
function providerTimedOut(e) {
|
|
1231
1238
|
return e?.name === "TimeoutError" || /timeout|timed out/i.test(errMsg(e));
|
|
1232
1239
|
}
|
|
1240
|
+
const E2B_START_REFUSALS = new Set(["InvalidArgumentError", "AuthenticationError", "NotFoundError", "RateLimitError"]);
|
|
1241
|
+
function providerRefusedStart(e) {
|
|
1242
|
+
return e instanceof Error && E2B_START_REFUSALS.has(e.name);
|
|
1243
|
+
}
|
|
1233
1244
|
function anySignal(signals) {
|
|
1234
1245
|
const ctor = AbortSignal;
|
|
1235
1246
|
if (typeof ctor.any === "function")
|