@sema-agent/server 7.133.0 → 7.135.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 +221 -0
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/USAGE.md +222 -36
- package/deploy/sema-up/README.md +16 -0
- package/deploy/sema-up/chart/Chart.yaml +1 -1
- package/deploy/sema-up/chart/templates/NOTES.txt +15 -0
- package/deploy/sema-up/chart/templates/_helpers.tpl +129 -0
- package/deploy/sema-up/chart/templates/sealed-key.yaml +24 -0
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +14 -0
- package/deploy/sema-up/chart/templates/server.yaml +14 -0
- package/deploy/sema-up/chart/values-full-single.yaml +5 -1
- package/deploy/sema-up/chart/values.yaml +34 -0
- package/dist/adoption/plan.d.ts +1 -1
- package/dist/approval-ask-audit-store.d.ts +25 -25
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +66 -154
- package/dist/approval-card.js +33 -52
- package/dist/approval-content-kind.d.ts +26 -6
- package/dist/approval-content-kind.js +23 -3
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval-gate-currency.d.ts +91 -0
- package/dist/approval-gate-currency.js +120 -0
- package/dist/approval-hmac.d.ts +7 -7
- package/dist/approval-policy-settlement.d.ts +2 -2
- package/dist/approval-reconciler.d.ts +3 -3
- package/dist/approval.d.ts +14 -8
- package/dist/approval.js +35 -16
- package/dist/auth-bridge.d.ts +1 -1
- package/dist/auto-mode-face.d.ts +4 -4
- package/dist/background-session-reap.d.ts +2 -2
- package/dist/bake-runner/main.d.ts +2 -2
- package/dist/bake-runner/runner.d.ts +4 -4
- package/dist/bench/s1/live-deps.d.ts +1 -1
- package/dist/bench/s1/run-firm.d.ts +1 -1
- package/dist/boot/coordinators.d.ts +7 -2
- package/dist/boot/coordinators.js +8 -5
- package/dist/boot/deferred-sandbox-path-env.d.ts +0 -6
- package/dist/boot/deferred-sandbox-path-env.js +0 -5
- package/dist/boot/engine-lease.d.ts +5 -5
- package/dist/boot/execution-env.d.ts +16 -15
- package/dist/boot/execution-env.js +19 -21
- package/dist/boot/fatal-exit.d.ts +2 -2
- package/dist/boot/late-binds.d.ts +1 -1
- package/dist/boot/leader.d.ts +2 -0
- package/dist/boot/leader.js +2 -1
- package/dist/boot/memory-boundary.d.ts +2 -2
- package/dist/boot/memory-consolidation.d.ts +15 -15
- package/dist/boot/parked-revive-gate.d.ts +3 -3
- package/dist/boot/parked-revive-gate.js +3 -2
- package/dist/boot/read-deny-anchor-audit.js +2 -2
- package/dist/boot/reapers.d.ts +4 -4
- package/dist/boot/resolve-spec.d.ts +1 -1
- package/dist/boot/resolve-spec.js +28 -24
- package/dist/boot/runner-deps.d.ts +29 -16
- package/dist/boot/runner-deps.js +12 -2
- package/dist/boot/session-faces.d.ts +3 -3
- package/dist/boot/session-faces.js +11 -30
- package/dist/boot/shutdown.d.ts +5 -5
- package/dist/boot/side-query-lane.d.ts +2 -2
- package/dist/boot/stage-05-execution-env.js +4 -4
- package/dist/boot/stage-06-runners.d.ts +4 -3
- package/dist/boot/stage-06-runners.js +15 -4
- package/dist/boot/stage-07-capability-layer.d.ts +2 -1
- package/dist/boot/stage-08-reapers.d.ts +2 -1
- package/dist/boot/stage-09-leader.d.ts +2 -1
- package/dist/boot/stage-09-leader.js +2 -2
- package/dist/boot/stage-10-http-server.d.ts +2 -1
- package/dist/boot/stage-10-http-server.js +2 -1
- package/dist/boot/stores.d.ts +8 -0
- package/dist/boot/stores.js +10 -13
- package/dist/boot/web-admin.d.ts +21 -15
- package/dist/boot/web-admin.js +16 -12
- package/dist/boot/workflow-orchestration.js +2 -9
- package/dist/brain.d.ts +11 -11
- package/dist/budget.d.ts +4 -4
- package/dist/budget.js +5 -1
- package/dist/caller-text-echo.d.ts +2 -0
- package/dist/caller-text-echo.js +2 -1
- package/dist/canonical-json.d.ts +2 -41
- package/dist/canonical-json.js +2 -13
- package/dist/capabilities/approvals-push.d.ts +4 -4
- package/dist/capabilities/builtin-tools.d.ts +5 -5
- package/dist/capabilities/center-plugins.d.ts +5 -5
- package/dist/capabilities/center-plugins.js +1 -1
- package/dist/capabilities/center-prompts.d.ts +1 -1
- package/dist/capabilities/center-wiring.d.ts +1 -1
- package/dist/capabilities/composite-members.d.ts +2 -2
- package/dist/capabilities/composite-members.js +1 -1
- package/dist/capabilities/execution-lane.d.ts +5 -5
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +5 -5
- package/dist/capabilities/mcp-probe.d.ts +10 -7
- package/dist/capabilities/mcp-probe.js +2 -2
- package/dist/capabilities/sandbox-file-send.d.ts +1 -18
- package/dist/capabilities/sandbox-file-send.js +0 -7
- package/dist/capabilities/scenarios.d.ts +28 -10
- package/dist/capabilities/scenarios.js +15 -5
- package/dist/capabilities/send-user-file-tool.d.ts +1 -1
- package/dist/capabilities/skills.d.ts +31 -12
- package/dist/capabilities/skills.js +23 -17
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +27 -24
- package/dist/capability-facts.js +18 -20
- package/dist/center-config-tier.d.ts +1 -1
- package/dist/center-credential.d.ts +4 -4
- package/dist/checkpoint-ctx-seal-m28.d.ts +42 -0
- package/dist/checkpoint-ctx-seal-m28.js +19 -0
- package/dist/checkpoint-identity.d.ts +5 -0
- package/dist/checkpoint-identity.js +14 -0
- package/dist/config-catalog.d.ts +12 -12
- package/dist/config-invariants.d.ts +4 -4
- package/dist/config-invariants.js +3 -2
- package/dist/config-lkg.d.ts +1 -1
- package/dist/config-provider.d.ts +13 -13
- package/dist/config-provider.js +2 -1
- package/dist/config-types.d.ts +83 -83
- package/dist/config.d.ts +26 -24
- package/dist/config.js +12 -10
- package/dist/cross-session-settings.d.ts +1 -1
- package/dist/delegated-session-owner.d.ts +16 -13
- package/dist/delegated-session-owner.js +9 -10
- package/dist/deployment-governance.d.ts +16 -16
- package/dist/deployment-shape.d.ts +127 -0
- package/dist/deployment-shape.js +72 -0
- package/dist/device-store.d.ts +1 -1
- package/dist/device-ws-hub.d.ts +1 -1
- package/dist/egress-redirect.d.ts +1 -1
- package/dist/entry-mode-clamp-notice.d.ts +2 -2
- package/dist/env-facts.d.ts +10 -9
- package/dist/env-facts.js +1 -1
- package/dist/env-name-allowlist-knobs.d.ts +5 -5
- package/dist/exec-bounds.d.ts +2 -2
- package/dist/execution-lane-caps.d.ts +31 -43
- package/dist/execution-lane-caps.js +0 -13
- package/dist/field-conflict.d.ts +2 -1
- package/dist/field-conflict.js +1 -0
- package/dist/file-history-capture.d.ts +9 -9
- package/dist/file-history-disclosure.d.ts +50 -9
- package/dist/file-history-disclosure.js +8 -13
- package/dist/fleet/drain-entry.d.ts +2 -2
- package/dist/fleet/fleet-bus.d.ts +26 -14
- package/dist/fleet/fleet-bus.js +6 -5
- package/dist/fleet/fleet-reconciler.d.ts +9 -9
- package/dist/fleet/subagent-tail-bus.d.ts +4 -4
- package/dist/fleet-client.d.ts +13 -13
- package/dist/fleet-lease.d.ts +16 -16
- package/dist/governance-http-status.d.ts +2 -2
- package/dist/hooks/hook-llm.d.ts +7 -7
- package/dist/hooks/hook-runner.d.ts +57 -30
- package/dist/hooks/hook-runner.js +38 -20
- package/dist/host-decision.d.ts +5 -5
- package/dist/host-lsp-manager.d.ts +5 -5
- package/dist/hosted-posture.d.ts +23 -13
- package/dist/hosted-posture.js +4 -9
- package/dist/http/admission.d.ts +2 -2
- package/dist/http/admission.js +28 -5
- package/dist/http/approval-sweeps.d.ts +1 -1
- package/dist/http/approval-sweeps.js +5 -2
- package/dist/http/checkpoint-ctx.d.ts +183 -2
- package/dist/http/checkpoint-ctx.js +197 -2
- package/dist/http/dispatch.d.ts +3 -3
- package/dist/http/dispatch.js +3 -3
- package/dist/http/durable-run-leg.js +7 -5
- package/dist/http/idempotency.d.ts +4 -4
- package/dist/http/idempotency.js +2 -2
- package/dist/http/mcp-dial-deadline.d.ts +7 -5
- package/dist/http/memory-compliance-failure-reply.d.ts +4 -4
- package/dist/http/owner-access.d.ts +4 -6
- package/dist/http/owner-access.js +1 -1
- package/dist/http/principal-gate.d.ts +39 -13
- package/dist/http/principal-gate.js +30 -6
- package/dist/http/readiness.d.ts +1 -1
- package/dist/http/refusal-body.d.ts +12 -0
- package/dist/http/refusal-body.js +11 -0
- package/dist/http/request-guards.d.ts +4 -13
- package/dist/http/request-guards.js +4 -17
- package/dist/http/resume-ctx-read.d.ts +53 -6
- package/dist/http/resume-ctx-read.js +26 -3
- package/dist/http/resume-legs.d.ts +5 -4
- package/dist/http/resume-legs.js +47 -29
- package/dist/http/route-ctx.d.ts +29 -38
- package/dist/http/route-table.d.ts +9 -9
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/agents-roster.js +2 -3
- package/dist/http/routes/approvals-assistant.d.ts +5 -5
- package/dist/http/routes/approvals-assistant.js +91 -17
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +2 -2
- package/dist/http/routes/capabilities.d.ts +1 -1
- package/dist/http/routes/capabilities.js +16 -8
- package/dist/http/routes/config-catalog.d.ts +1 -1
- package/dist/http/routes/devices.d.ts +1 -1
- package/dist/http/routes/diagnostics.d.ts +6 -6
- package/dist/http/routes/diagnostics.js +1 -1
- package/dist/http/routes/fleet.d.ts +1 -1
- package/dist/http/routes/fleet.js +5 -4
- package/dist/http/routes/mcp-reconnect.d.ts +4 -4
- package/dist/http/routes/mcp-reconnect.js +3 -3
- package/dist/http/routes/memory-consolidation.d.ts +1 -1
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/notify-wake.d.ts +1 -1
- package/dist/http/routes/notify-wake.js +2 -2
- package/dist/http/routes/rules.d.ts +1 -1
- package/dist/http/routes/rules.js +4 -4
- package/dist/http/routes/runs.js +44 -11
- package/dist/http/routes/session-sync.d.ts +3 -2
- package/dist/http/routes/session-sync.js +109 -62
- package/dist/http/routes/sessions-list.d.ts +1 -1
- package/dist/http/routes/sessions-list.js +4 -5
- package/dist/http/routes/sessions.js +34 -48
- package/dist/http/routes/tasks.d.ts +1 -1
- package/dist/http/routes/tasks.js +21 -16
- package/dist/http/routes/trace-usage.d.ts +1 -1
- package/dist/http/routes/trace-usage.js +7 -9
- package/dist/http/routes/workflows.d.ts +3 -0
- package/dist/http/routes/workflows.js +31 -28
- package/dist/http/send.d.ts +5 -5
- package/dist/http/server.d.ts +39 -33
- package/dist/http/server.js +5 -2
- package/dist/http/session-inherit-env.d.ts +3 -3
- package/dist/http/sse-lifecycle.d.ts +1 -1
- package/dist/http/sse-log.d.ts +2 -2
- package/dist/http/submit-ctx.d.ts +4 -3
- package/dist/http/submit-ctx.js +19 -3
- package/dist/http/sync-submit-body.d.ts +1 -1
- package/dist/http/verify-rounds.d.ts +1 -1
- package/dist/http/wire-types.d.ts +35 -24
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/instruction-source-notice.d.ts +2 -2
- package/dist/key-resolver.d.ts +3 -3
- package/dist/lane-home-probe.d.ts +1 -1
- package/dist/leader/diffout.d.ts +1 -1
- package/dist/leader/diffup.d.ts +2 -2
- package/dist/leader/endpoint.d.ts +1 -1
- package/dist/leader/fanout.d.ts +1 -1
- package/dist/leader/leader.d.ts +4 -4
- package/dist/leader/merge.d.ts +3 -3
- package/dist/leader/repair-wire.d.ts +1 -1
- package/dist/leader/wire.d.ts +9 -5
- package/dist/leader/wire.js +8 -7
- package/dist/list-entry-display.d.ts +1 -1
- package/dist/lsp-evict.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/mcp-assertion-header.d.ts +1 -1
- package/dist/memory-layer-legacy-lock.d.ts +1 -1
- package/dist/memory-operator-faces.d.ts +1 -1
- package/dist/memory-origin-fence.js +2 -2
- package/dist/memory-posture.js +4 -2
- package/dist/memory-project-layer.d.ts +1 -1
- package/dist/memory-scope.d.ts +19 -19
- package/dist/memory-store-refusal.d.ts +4 -4
- package/dist/model-compat.d.ts +1 -1
- package/dist/model-entry-headers.d.ts +2 -2
- package/dist/model-entry-refusal.d.ts +17 -17
- package/dist/model-provider.d.ts +10 -10
- package/dist/model-reach-scope.d.ts +1 -1
- package/dist/model-route-endpoint.d.ts +6 -6
- package/dist/model-route-url.d.ts +5 -5
- package/dist/model-select.d.ts +15 -6
- package/dist/model-select.js +5 -0
- package/dist/model-unreachable-notice.d.ts +3 -3
- package/dist/namespaced-rule-name.d.ts +15 -5
- package/dist/namespaced-rule-name.js +3 -2
- package/dist/observability/corrupt-read-seat.d.ts +9 -9
- package/dist/observability/cost-taxonomy.d.ts +1 -1
- package/dist/observability/err-text.d.ts +1 -1
- package/dist/observability/fail-open.d.ts +12 -8
- package/dist/observability/fail-open.js +12 -8
- package/dist/observability/metrics.d.ts +3 -3
- package/dist/observability/prompt-manifest.d.ts +19 -8
- package/dist/observability/prompt-manifest.js +9 -8
- package/dist/observability/run-terminal.d.ts +36 -36
- package/dist/observability/secret-env-scrub.d.ts +3 -3
- package/dist/observability/tool-trace.d.ts +1 -1
- package/dist/observability/tool-trace.js +8 -9
- package/dist/operator-ask.d.ts +4 -4
- package/dist/orchestration/workflow-agent-session-index.d.ts +3 -3
- package/dist/orchestration/workflow-completion-inbox.d.ts +20 -5
- package/dist/orchestration/workflow-completion-inbox.js +29 -7
- package/dist/orchestration/workflow-notify-journal.d.ts +43 -19
- package/dist/orchestration/workflow-notify-journal.js +17 -0
- package/dist/orchestration/workflow-park-decision.d.ts +1 -1
- package/dist/orchestration/workflow-park-decision.js +1 -0
- package/dist/outbound-dispatcher.d.ts +4 -4
- package/dist/parent-watch.d.ts +4 -4
- package/dist/parked-decide.d.ts +20 -20
- package/dist/parked-decide.js +8 -5
- package/dist/parked-revive-surface.d.ts +7 -7
- package/dist/parked-revive-surface.js +2 -3
- package/dist/peer-directory.d.ts +3 -3
- package/dist/peer-directory.js +1 -1
- package/dist/permission-rule-list.d.ts +10 -1
- package/dist/permission-rule-list.js +7 -5
- package/dist/permission-rule-vocab.d.ts +3 -25
- package/dist/permission-rule-vocab.js +0 -13
- package/dist/plugins/adoption-log-sql.d.ts +1 -1
- package/dist/plugins/approval-ask-store-file.d.ts +8 -1
- package/dist/plugins/approval-ask-store-file.js +6 -3
- package/dist/plugins/approval-ask-store-memory.d.ts +11 -7
- package/dist/plugins/approval-ask-store-memory.js +11 -7
- package/dist/plugins/approval-ask-store-sql.d.ts +34 -15
- package/dist/plugins/approval-ask-store-sql.js +18 -5
- package/dist/plugins/approval-exemption-store.d.ts +3 -3
- package/dist/plugins/approval-nonce-store.d.ts +3 -3
- package/dist/plugins/approval-payload-fingerprint.d.ts +14 -6
- package/dist/plugins/approval-payload-fingerprint.js +1 -1
- package/dist/plugins/background-agent-store-sql.d.ts +1 -1
- package/dist/plugins/background-shell-support.d.ts +2 -2
- package/dist/plugins/blob-backend.d.ts +1 -1
- package/dist/plugins/caching-session-store.d.ts +24 -33
- package/dist/plugins/caching-session-store.js +8 -19
- package/dist/plugins/checkpoint-index-columns.d.ts +81 -0
- package/dist/plugins/checkpoint-index-columns.js +62 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +66 -67
- package/dist/plugins/checkpoint-store-sql.js +100 -103
- package/dist/plugins/device-store-sql.d.ts +7 -6
- package/dist/plugins/e2b-orphan-reclaim.d.ts +1 -1
- package/dist/plugins/ensure-schema-lock-policy.d.ts +1 -1
- package/dist/plugins/file-history-store-sql.d.ts +9 -7
- package/dist/plugins/file-history-store-sql.js +27 -15
- package/dist/plugins/file-run-store.d.ts +8 -8
- package/dist/plugins/fork-routing-session-store.d.ts +2 -2
- package/dist/plugins/fork-routing-session-store.js +1 -1
- package/dist/plugins/host-platform.d.ts +10 -10
- package/dist/plugins/image-bake-store-sql.d.ts +1 -1
- package/dist/plugins/image-index-sql.d.ts +1 -1
- package/dist/plugins/leader-run-store-sql.d.ts +1 -1
- package/dist/plugins/local-checkpoint-store.d.ts +23 -12
- package/dist/plugins/local-checkpoint-store.js +29 -4
- package/dist/plugins/local-session-store.d.ts +44 -45
- package/dist/plugins/local-session-store.js +42 -52
- package/dist/plugins/local-session-window.d.ts +12 -6
- package/dist/plugins/local-session-window.js +1 -17
- package/dist/plugins/mailbox-store-sql.d.ts +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +1 -1
- package/dist/plugins/memory-run-store.d.ts +4 -4
- package/dist/plugins/memory-sync-store-pg.d.ts +3 -3
- package/dist/plugins/one-time-migrations.d.ts +76 -39
- package/dist/plugins/one-time-migrations.js +127 -34
- package/dist/plugins/outcome-ledger-sql.d.ts +1 -1
- package/dist/plugins/park-commit-watch.d.ts +3 -3
- package/dist/plugins/permission-rule-store-file.d.ts +5 -5
- package/dist/plugins/permission-rule-store-file.js +16 -19
- package/dist/plugins/permission-rule-store-sql.d.ts +38 -4
- package/dist/plugins/permission-rule-store-sql.js +74 -31
- package/dist/plugins/pg-cost-quota.d.ts +1 -1
- package/dist/plugins/pg-pool.d.ts +2 -2
- package/dist/plugins/pg-pool.js +5 -2
- package/dist/plugins/pg-rate-limiter.d.ts +1 -1
- package/dist/plugins/pg-session-storage.d.ts +9 -21
- package/dist/plugins/pg-session-storage.js +51 -42
- package/dist/plugins/remote-env-adb.d.ts +10 -10
- package/dist/plugins/remote-env-device.d.ts +22 -14
- package/dist/plugins/remote-env-device.js +28 -16
- package/dist/plugins/remote-env-e2b.d.ts +3 -3
- package/dist/plugins/remote-env-host.d.ts +16 -16
- package/dist/plugins/remote-env-k8s.d.ts +8 -8
- package/dist/plugins/remote-env-local-docker.d.ts +2 -2
- package/dist/plugins/remote-env-ssh.d.ts +4 -4
- package/dist/plugins/remote-scratchpad.d.ts +2 -3
- package/dist/plugins/remote-scratchpad.js +0 -4
- package/dist/plugins/remote-shell.d.ts +6 -6
- package/dist/plugins/retention-lane-store-sql.d.ts +4 -4
- package/dist/plugins/retention-store-sql.d.ts +4 -4
- package/dist/plugins/roster-store-sql.d.ts +1 -1
- package/dist/plugins/run-store-sql.d.ts +8 -8
- package/dist/plugins/schema-consistency.d.ts +2 -2
- package/dist/plugins/schema-ensure-legs.d.ts +3 -3
- package/dist/plugins/schema-indexes.d.ts +1 -1
- package/dist/plugins/schema-live-columns.d.ts +1 -1
- package/dist/plugins/session-event-payload.d.ts +4 -4
- package/dist/plugins/session-fork.d.ts +34 -0
- package/dist/plugins/session-fork.js +29 -0
- package/dist/plugins/session-ownership.d.ts +11 -0
- package/dist/plugins/session-ownership.js +11 -0
- package/dist/plugins/session-placement.d.ts +12 -14
- package/dist/plugins/session-placement.js +2 -15
- package/dist/plugins/session-policy-store-sql.d.ts +12 -12
- package/dist/plugins/session-store.d.ts +2 -2
- package/dist/plugins/session-store.js +2 -2
- package/dist/plugins/shared-memory-store-sql.d.ts +2 -2
- package/dist/plugins/sql-driver.d.ts +8 -8
- package/dist/plugins/sql-errors.d.ts +1 -1
- package/dist/plugins/sql-json-column.d.ts +21 -21
- package/dist/plugins/sql-row-helpers.d.ts +2 -2
- package/dist/plugins/store-backend.d.ts +17 -16
- package/dist/plugins/store-backend.js +3 -3
- package/dist/plugins/store-contracts.d.ts +21 -21
- package/dist/plugins/task-attachment-store.d.ts +2 -2
- package/dist/plugins/task-list-store-sql.d.ts +1 -1
- package/dist/plugins/tidb-pool.d.ts +2 -2
- package/dist/plugins/tidb-pool.js +9 -2
- package/dist/plugins/tidb-session-store.d.ts +17 -27
- package/dist/plugins/tidb-session-store.js +52 -42
- package/dist/plugins/tool-result-store-sql.d.ts +1 -1
- package/dist/plugins/usage-window-store-sql.d.ts +3 -3
- package/dist/plugins/user-input-ledger-file.d.ts +1 -1
- package/dist/plugins/user-input-ledger-sql.d.ts +3 -3
- package/dist/plugins/web-search.d.ts +19 -5
- package/dist/plugins/web-search.js +19 -4
- package/dist/{orchestration/workflow-journal-entry.d.ts → plugins/workflow-journal-payload.d.ts} +23 -32
- package/dist/plugins/workflow-journal-payload.js +32 -0
- package/dist/plugins/workflow-journal-store-sql.d.ts +28 -14
- package/dist/plugins/workflow-journal-store-sql.js +34 -15
- package/dist/plugins/workflow-run-store-sql.d.ts +4 -4
- package/dist/posture-source.d.ts +11 -11
- package/dist/principal-jwt.d.ts +6 -6
- package/dist/project-identity.d.ts +3 -3
- package/dist/project-memory.d.ts +4 -4
- package/dist/read-face-posture.d.ts +7 -7
- package/dist/request-key-closure.d.ts +1 -1
- package/dist/request-key-closure.js +1 -1
- package/dist/request-tool-axes.d.ts +12 -0
- package/dist/request-tool-axes.js +20 -0
- package/dist/request-value-closure.d.ts +15 -8
- package/dist/request-value-closure.js +2 -0
- package/dist/router/route-orchestration.d.ts +11 -16
- package/dist/router/route-orchestration.js +2 -12
- package/dist/rule-entry-list.d.ts +8 -7
- package/dist/rule-entry-list.js +2 -9
- package/dist/rules-consent.d.ts +6 -6
- package/dist/rules-consent.js +2 -0
- package/dist/run-cancel-context.d.ts +5 -5
- package/dist/run-local.d.ts +10 -10
- package/dist/run-local.js +1 -0
- package/dist/runs.d.ts +15 -12
- package/dist/runs.js +19 -4
- package/dist/runtime-caps-resolver.d.ts +6 -6
- package/dist/runtime-governance.d.ts +9 -9
- package/dist/sandbox-pkg-source.d.ts +9 -31
- package/dist/sandbox-pkg-source.js +14 -8
- package/dist/sealed-key.d.ts +34 -2
- package/dist/sealed-key.js +55 -1
- package/dist/security.d.ts +31 -32
- package/dist/security.js +12 -9
- package/dist/server-secret-env.d.ts +10 -10
- package/dist/session-children-retire.d.ts +1 -1
- package/dist/session-error-wire.d.ts +19 -12
- package/dist/session-error-wire.js +4 -1
- package/dist/session-incarnation.d.ts +52 -35
- package/dist/session-incarnation.js +23 -8
- package/dist/session-policy-wire.d.ts +27 -5
- package/dist/session-policy-wire.js +15 -1
- package/dist/session-records-skipped-notice.d.ts +1 -1
- package/dist/session-sync-kernel.d.ts +38 -11
- package/dist/session-sync-kernel.js +10 -0
- package/dist/session-sync.d.ts +49 -6
- package/dist/session-sync.js +52 -10
- package/dist/session-titler.d.ts +7 -6
- package/dist/session-titler.js +8 -13
- package/dist/session-watch.d.ts +3 -3
- package/dist/session-watch.js +4 -4
- package/dist/sighup-idle.d.ts +2 -2
- package/dist/spec-fields.d.ts +4 -4
- package/dist/sql-engine-posture.d.ts +3 -3
- package/dist/store-posture.d.ts +2 -2
- package/dist/stored-request-tool-axes-m19.d.ts +1 -1
- package/dist/task-a2a.d.ts +3 -1
- package/dist/task-a2a.js +38 -5
- package/dist/task-cwd.d.ts +7 -88
- package/dist/task-cwd.js +2 -15
- package/dist/task-mcp.d.ts +14 -10
- package/dist/task-mcp.js +39 -12
- package/dist/task-settings.d.ts +34 -18
- package/dist/task-settings.js +34 -4
- package/dist/task-workflow.d.ts +0 -24
- package/dist/task-workflow.js +2 -1
- package/dist/terminal.d.ts +5 -5
- package/dist/tighten-only-seats.d.ts +7 -6
- package/dist/tighten-only-seats.js +1 -1
- package/dist/tool-approval.d.ts +273 -228
- package/dist/tool-approval.js +125 -47
- package/dist/tool-rule-names.d.ts +7 -1
- package/dist/trace/core-keyset-guard.d.ts +15 -9
- package/dist/trace/engine-notice-wire.d.ts +5 -5
- package/dist/trace/engine-notice-wire.js +1 -0
- package/dist/trace/exit-seat.d.ts +40 -1
- package/dist/trace/exit-seat.js +46 -14
- package/dist/trace/ledger-events.d.ts +6 -4
- package/dist/trace/ledger-sink.d.ts +1 -1
- package/dist/trace/model-segment.d.ts +3 -3
- package/dist/trace/project.d.ts +65 -46
- package/dist/trace/project.js +49 -5
- package/dist/trace/redact.d.ts +44 -27
- package/dist/trace/redact.js +343 -73
- package/dist/trace/self-minted-wire.d.ts +39 -14
- package/dist/trace/self-minted-wire.js +9 -0
- package/dist/trace/sema-provenance.d.ts +1 -1
- package/dist/trace/task-notification-facets.d.ts +4 -4
- package/dist/trace/wire-projection-faces.d.ts +9 -3
- package/dist/trace/wire-projection-faces.js +7 -1
- package/dist/unattended-permission-mode.d.ts +5 -5
- package/dist/url-credential.d.ts +52 -0
- package/dist/url-credential.js +49 -0
- package/dist/url-refusal.d.ts +6 -2
- package/dist/url-refusal.js +8 -1
- package/dist/usage-analytics.d.ts +2 -2
- package/dist/user-input-ledger.d.ts +23 -23
- package/dist/web-admin-client/apply-effective.d.ts +5 -5
- package/dist/web-admin-client/apply-effective.js +2 -1
- package/dist/web-admin-client/apply-ledger.d.ts +2 -2
- package/dist/web-admin-client/center-request.d.ts +2 -2
- package/dist/web-admin-client/facade.d.ts +5 -5
- package/dist/web-admin-client/facade.js +1 -1
- package/dist/web-admin-client/hot-keys-registry.d.ts +2 -2
- package/dist/web-admin-client/http-client.d.ts +4 -4
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/pull-state.d.ts +1 -1
- package/dist/web-admin-client/read-face.d.ts +2 -2
- package/dist/web-admin-client/read-warnings.d.ts +5 -5
- package/dist/web-admin-client/restart-signal.d.ts +6 -6
- package/dist/web-admin-client/skills-mcp.d.ts +29 -4
- package/dist/web-admin-client/skills-mcp.js +31 -4
- package/dist/web-admin-client/types.d.ts +17 -10
- package/dist/workspace-space.d.ts +5 -3
- package/dist/write-protection.d.ts +2 -2
- package/package.json +4 -3
- package/scripts/drain-check-local.mjs +35 -2
- package/scripts/drain-check.mysql.sql +22 -2
- package/scripts/drain-check.pg.sql +22 -2
- package/skills/loop.md +1 -1
- package/dist/mcp-tool-faces.d.ts +0 -69
- package/dist/mcp-tool-faces.js +0 -104
- package/dist/orchestration/workflow-journal-entry.js +0 -27
package/dist/auto-mode-face.d.ts
CHANGED
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
* capabilities 查询串不带 settings ⇒ 本面不产);
|
|
28
28
|
* · `resolver_fault` —— resolver 抛错(core 同形全拒:autoMode:false + onError phase config)。
|
|
29
29
|
*
|
|
30
|
-
* 🔴
|
|
30
|
+
* 🔴 [ref](core 7.34.0 提货):「这台机器上装的 core 用哪套武装极性」的**安装包探针**(按文本扫
|
|
31
31
|
* `dist/core/runner/prepare-task.js` 找 `autoModeRequested`)整只退役 —— 7.34.0 起那个键被引擎按名拒,探针的主判
|
|
32
|
-
* 恒假、佐证恒真 ⇒ 矛盾臂 fatal,整台 server 起服即拒(
|
|
32
|
+
* 恒假、佐证恒真 ⇒ 矛盾臂 fatal,整台 server 起服即拒([ref] 探针 7.34.0 读数的 13 只红文件同一根因)。
|
|
33
33
|
* 极性不再是运行期要猜的事实:本仓把 core **精确钉版**(`package.json`,`test/core-dependency-floor.test.ts` 承重),
|
|
34
34
|
* 钉住的那一版的武装谓词就是上面那一行,由类型面(`TaskSpec.permissionMode` / `RunnerDeps.autoMode` /
|
|
35
35
|
* `RuntimeCaps.autoMode`)与 core CHANGELOG 同时陈述。⇒ 旧式臂(「org 授予」极性)与 `engineArmsOnIntent` 座一并删,
|
|
@@ -51,7 +51,7 @@ import { type PermissionMode, type RunnerDeps, type RuntimeCaps } from "@sema-ag
|
|
|
51
51
|
* 本仓 [ref] 的跨仓诉求兑现;契约句 `classifier.seat.one_resolver` 逐字:引擎的武装点与**显示这个席**
|
|
52
52
|
* 的宿主读面调同一只导出函数,而不是各自从目录/角色/档位表再推一遍 —— 第二份推导就是第二个答案)。
|
|
53
53
|
*
|
|
54
|
-
* 🔴 **
|
|
54
|
+
* 🔴 **[ref]:本仓的自算分支已删**。修前这里调的是 `resolveTaskModel({modelRole:"classifier"})`,那只
|
|
55
55
|
* 回答的是「classifier **角色**解到谁」;引擎真正挑席时在角色没点名模型的情况下还要走 **tierBelowMain**
|
|
56
56
|
* (主模型档位**严格之下**、路由不同的最近一档)。两者在「档位表在场 + 没有 classifier 角色」这一形上
|
|
57
57
|
* 给出**不同的模型**(车FL U-3 坐实),读面于是对着 `sema doctor permissions` 报另一只模型。规则变少的
|
|
@@ -92,7 +92,7 @@ export declare const AUTO_MODE_UNARMED_REASON_SEMANTICS: {
|
|
|
92
92
|
readonly resolver_fault: "per-principal caps resolver 抛错/答非记录(core 同形全拒:autoMode:false + onError phase config)";
|
|
93
93
|
};
|
|
94
94
|
/** 装配面交给读面的三件事实(`main.ts` 从 runnerDeps / 合成后的 caps resolver 取,读面不自算)。
|
|
95
|
-
*
|
|
95
|
+
* [ref]:第四件「引擎半场到货位」(`engineArmsOnIntent`,安装包探针)随极性探针一起退役。 */
|
|
96
96
|
export interface AutoModeFaceDeps {
|
|
97
97
|
/** `RunnerDeps.autoMode !== undefined`——**读**装配点那一位,不写字面 true(与 parked-revive 的
|
|
98
98
|
* `autoModeSeatMounted` 同一纪律:席位哪天改成有条件挂载,这里不能静默错供)。 */
|
|
@@ -39,7 +39,7 @@ export interface SessionHardReap {
|
|
|
39
39
|
* + run 的 task id 就是会话 id 的 run 行;同一个 id 在别的 scope 是别的会话;别的会话的行永远不碰)—— 宽限里跑完处理器的进程答
|
|
40
40
|
* `already_gone`,屏蔽 / 没跑完的在这一枪组 SIGKILL(与 host 梯子自己到点的那一枪同拍,两枪都是组 SIGKILL,幂等)。同拍是设计内的:
|
|
41
41
|
* 两枪谁先是同一毫秒的定时器次序。硬面先打 ⇒ `killed`;梯子先打、引擎还没收割组长 ⇒ 硬面那一枪落在只剩僵尸的组上:darwin EPERM ⇒
|
|
42
|
-
* `no_pgid`(未确认)、linux ⇒ `killed`;已收割 ⇒ `already_gone`。受据按观察答(
|
|
42
|
+
* `no_pgid`(未确认)、linux ⇒ `killed`;已收割 ⇒ `already_gone`。受据按观察答([ref] 车PA 删了「已硬收过」闩:组信号任一成员收到即
|
|
43
43
|
* 成功,闩在部分送达时把活着读成没了),本函数也不为「让硬面先打」挪任何一拍。
|
|
44
44
|
*
|
|
45
45
|
* `scope` = 会话行属主 `owner ?? "default"`(与 core 注册铸值 `spec.principal ?? "default"` 同源 —— 缺席 scope 在 core 的
|
|
@@ -48,7 +48,7 @@ export interface SessionHardReap {
|
|
|
48
48
|
* 两处调用(见文件头 ①),都 `await`:E21 删除级联 `includeRetained:false`(显式活服务照留);停止口照传请求体。应答在硬面之后发,
|
|
49
49
|
* 代价 = 有 shell 行刚被软停的会话,DELETE / 停止口的应答慢到最后一行的「软停 + 宽限」(通常一次宽限;操作员旋钮 `HOST_BG_KILL_GRACE_MS`,缺省 1000;要几乎不等写 `1` ——
|
|
50
50
|
* `numEnvOr` 把 `0` 读作缺席、回落缺省,与它供的其余执行车道旋钮同一条语义)。
|
|
51
|
-
* 受委托帮手的 shell 挂在帮手自己的会话上,本函数碰不到(core KL-1107a /
|
|
51
|
+
* 受委托帮手的 shell 挂在帮手自己的会话上,本函数碰不到(core KL-1107a / [ref],候 core)。
|
|
52
52
|
* 注册表是**进程内**的:只收本副本上的行(多副本部署里别的副本上的行由那个副本自己的出口收)。
|
|
53
53
|
*/
|
|
54
54
|
export declare function reapSessionBackgroundHard(sessionId: string, scope: string, opts: {
|
|
@@ -21,7 +21,7 @@ interface RunnerEnv {
|
|
|
21
21
|
* `BUILD_SH_PATH`(缺省 `e2b-template/dev-sandbox/build.sh`)、`BAKE_DATA_DIR`(缺省 `/data`)、`LOG_LEVEL`(缺省 info)。
|
|
22
22
|
* · 数值四键(`parseNumOrFailNonNegative`,非数 / 负数拒启):`BAKE_HEARTBEAT_MS`(30000)、`BAKE_IDLE_POLL_MS`(5000)、
|
|
23
23
|
* `IMAGE_BAKE_MIN_FREE_GB`(20)、`BAKE_SHUTDOWN_GRACE_MS`(5000)。
|
|
24
|
-
* · `BAKE_ENV_ALLOW=NAME,NAME`(7.103.0,
|
|
24
|
+
* · `BAKE_ENV_ALLOW=NAME,NAME`(7.103.0,[ref] 残余):本进程 spawn 的每一只子进程组(build.sh 与 git fetch / docker push /
|
|
25
25
|
* docker image inspect / df)的 env 缺省 = 本进程 env 剥密(runner 自己的 `BAKE_RUNNER_TOKEN` 在内);名单点到的键从本进程 env **原样**
|
|
26
26
|
* 放回(部署方显式承担 —— 例如配方脚本真要一枚 `*_PASSWORD` 做 registry 登录)。与服务侧 `LSP_ENV_ALLOW` **同一只**解析器
|
|
27
27
|
* (`config.ts` `parseEnvNameAllowlist`)与同一只放行谓词:形错(空段 / 尾逗号 / 非变量名形 / 点名任一只名单型旋钮)⇒ **拒启**,拒句点名
|
|
@@ -34,7 +34,7 @@ declare function loadEnv(): RunnerEnv;
|
|
|
34
34
|
* carries the per-bake ingest secret header (so image-api can reject a stale/rogue runner — §P2.4e). */
|
|
35
35
|
declare function makeApiClient(env: RunnerEnv, log: BakeRunnerLogger): ImageApiClient;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* [ref] —— **bake-runner 自己的在飞进程组簿**。
|
|
38
38
|
*
|
|
39
39
|
* 为什么不复用 host 前台簿(`src/plugins/host-platform.ts` 的 `adoptHostForegroundChild`)—— **属主语义不同**
|
|
40
40
|
* (车LD §3(a) 判定):那本簿的契约逐字是「被一个**在飞 turn** 拥有的 host lane 前台 exec」,收割姿势是
|
|
@@ -33,7 +33,7 @@ export interface ChildHandle {
|
|
|
33
33
|
}>;
|
|
34
34
|
/** Send a signal to the process GROUP (SIGTERM then SIGKILL on the cancel/deadline path). */
|
|
35
35
|
killGroup(signal: NodeJS.Signals): void;
|
|
36
|
-
/** Does the process GROUP still have ANY member? (`kill(-pgid, 0)`.) 🔴
|
|
36
|
+
/** Does the process GROUP still have ANY member? (`kill(-pgid, 0)`.) 🔴 [ref] codex ①: this — not {@link exited} — is
|
|
37
37
|
* the group's lifetime. `exited` resolves when the LEADER exits; a leader that dies on SIGTERM can leave a
|
|
38
38
|
* TERM-immune descendant in the same group, and treating leader-exit as "the group is gone" lets it escape. */
|
|
39
39
|
groupAlive(): boolean;
|
|
@@ -103,7 +103,7 @@ export interface BakeRunnerOpts {
|
|
|
103
103
|
/** Minimum free GiB on /data at claim; below this the bake fails fast (507-class) rather than dying mid-build and
|
|
104
104
|
* leaving a half-layer (k3s + docker containerd both on /data — a fill triggers kubelet GC eviction — §P2.7). */
|
|
105
105
|
minFreeGb?: number;
|
|
106
|
-
/**
|
|
106
|
+
/** [ref] —— **一只注定要死的 build 进程组的「体面赴死窗」**(ms,`BAKE_SHUTDOWN_GRACE_MS`,默认 5000)。
|
|
107
107
|
*
|
|
108
108
|
* 两条路读同一个数,因为它们问的是**同一个问题**:
|
|
109
109
|
* · cancel / deadline 击杀({@link BakeRunner.runOne} 的 supervisor):SIGTERM → 本窗 → SIGKILL;
|
|
@@ -139,7 +139,7 @@ export declare class BakeRunner {
|
|
|
139
139
|
private readonly liveKills;
|
|
140
140
|
constructor(opts: BakeRunnerOpts);
|
|
141
141
|
/**
|
|
142
|
-
*
|
|
142
|
+
* [ref] —— **关机梯子**:幂等、可 await、四步,一处承重。
|
|
143
143
|
*
|
|
144
144
|
* ── 病(车LD §2.3,28 次真进程×两套运行时、零反例)───────────────────────────────
|
|
145
145
|
* 旧 `stop()` 只置一个 flag,而 `loop()` 此刻正 `await this.runOne(...)`、`runOne` 正 `await child.exited`
|
|
@@ -198,7 +198,7 @@ export declare class BakeRunner {
|
|
|
198
198
|
* 不受本进程信号支配(既有射程,非本批新开)。一次 SIGKILL 死在 docker build 中间会留悬挂层;
|
|
199
199
|
* dup-check + lockhash 保证重烤不被毒化,悬挂层本身由 docker 自己的 prune / 运维回收。
|
|
200
200
|
* (旧注声称“一条启动期的工作目录清扫会把它们收回去”—— **假补偿**:全 `src/` 无此实现,build.sh 侧也只有
|
|
201
|
-
* per-job workdir + `mktemp -d` 回退,没有任何启动期清扫 —— 车LD §3(3) 亲核,
|
|
201
|
+
* per-job workdir + `mktemp -d` 回退,没有任何启动期清扫 —— 车LD §3(3) 亲核,[ref] 删句:过期的“已被兜住”
|
|
202
202
|
* 声明比欠账更危险。真要做清扫,那是带自己设计的另一台车。)
|
|
203
203
|
*/
|
|
204
204
|
private killGroupLadder;
|
|
@@ -89,7 +89,7 @@ export declare function benchBaseSpec(rt: LiveRuntimeConfig, cellId: string): (o
|
|
|
89
89
|
/**
|
|
90
90
|
* Project a `SoloImplSpec` (budget already stamped by the harness, all keys in `limits`) onto the bench base TaskSpec.
|
|
91
91
|
* 🔴 7.106.0 合并复审 X3:SOLO 是**无人值守腿**(verify→fix 跑在一只不接 `onAsk` 的 Runner 上,没有审批席)⇒ 经 `withUnattendedLeg` 接
|
|
92
|
-
* 无人值守腿的合并口(
|
|
92
|
+
* 无人值守腿的合并口([ref] ①:`default` + 按类作答的 onAsk,无席)。修前裸 spec ⇒ core 7.34.0「缺席 =
|
|
93
93
|
* default」且无席 ⇒ 写与非只读命令 headless 拒、终态照旧 completed。SUP 不走这里:它有耐久审批席
|
|
94
94
|
* (checkpoint suspend),它的问要人答。
|
|
95
95
|
*/
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* 🔴 ENV GATING: the live path requires E2B_API_KEY + DEEPSEEK_API_KEY; absent → the driver refuses the live path
|
|
17
17
|
* with a clear message (never a silent fake run). The deterministic --dry-run never needs keys.
|
|
18
18
|
*
|
|
19
|
-
* 🔴 LEDGER I/O (
|
|
19
|
+
* 🔴 LEDGER I/O ([ref]): the WRITE side is the repo's shared append port — core `AppendLog` (lazy open, one `writeSync` loop per
|
|
20
20
|
* row, a failed write rolled back, a torn tail repaired on open AND before every append) — so a crash that tore the last
|
|
21
21
|
* row no longer glues the resume's first row onto the broken suffix (which lost that cell's row ⇒ one cell re-run at real
|
|
22
22
|
* E2B / DeepSeek cost). No fsync (a crash loses at most the tail row ⇒ that cell stays re-runnable — the same posture as before).
|
|
@@ -14,6 +14,7 @@ import { QuestionCoordinator } from "../question.js";
|
|
|
14
14
|
import { ToolApprovalCoordinator, type ParkedAskRedeem } from "../tool-approval.js";
|
|
15
15
|
import { FileApprovalAskAuditStore } from "../approval-ask-audit-store.js";
|
|
16
16
|
import type { ParkCommitWatch } from "../plugins/park-commit-watch.js";
|
|
17
|
+
import { type GateCurrencyStore } from "../approval-gate-currency.js";
|
|
17
18
|
import { SendUserFileEmitter } from "../capabilities/send-user-file-tool.js";
|
|
18
19
|
import { TaskEnvRegistry } from "../capabilities/sandbox-file-send.js";
|
|
19
20
|
import type { StoreBackend } from "../plugins/store-backend.js";
|
|
@@ -33,16 +34,20 @@ export interface LiveCoordinatorsCtx {
|
|
|
33
34
|
* 必须排在它之前;同款 holder 先例 = reaper 的 `getRunDenySweep`)。取到 undefined ⇒ 那条臂逐字回落
|
|
34
35
|
* 修前 404(partial 部署安全)。缺席(不传本键)⇒ 协调器整条迟到腿的 PARKED 臂恒 404。 */
|
|
35
36
|
getParkedRedeem?: () => ParkedAskRedeem | undefined;
|
|
36
|
-
/**
|
|
37
|
+
/** [ref] F1:checkpoint 店的 park 提交观察层(stage-06 与店同一处铸;在场 ⇔ 有 checkpoint 店)。协调器据它判「有序关停下的 park 路由
|
|
37
38
|
* 提交了没有」—— 审计 settle 行等 park 提交落定才写。缺席 = 没有 park 设施(core 在 ask 回调处就收场,没有提交这一步)。 */
|
|
38
39
|
parkCommits?: ParkCommitWatch;
|
|
40
|
+
/** [ref]:checkpoint 店(stage-06 的**同一只**,与 `parkCommits` 同源;在场 ⇔ 有 park 设施)。协调器的按问读口据它判一张 `PARKED` 卡的门此刻还是不是该会话当前待决的审批门
|
|
41
|
+
* (判官 = `approval-gate-currency.ts`,应答口判 `approval_stale` 读的同一只)。缺席 ⇒ 读口只能说行说的话(`parked`)。
|
|
42
|
+
* 也是流内审批协议上场门的 park 设施位:在场性与实例是一个事实 —— 门的 `active` 臂交出去的就是这一只,缺席 ⇒ 协议不上场(`no_park_facility`)。 */
|
|
43
|
+
checkpointStore?: GateCurrencyStore;
|
|
39
44
|
}
|
|
40
45
|
export declare function createLiveCoordinators(ctx: LiveCoordinatorsCtx): {
|
|
41
46
|
elicitation: ElicitationCoordinator | undefined;
|
|
42
47
|
question: QuestionCoordinator | undefined;
|
|
43
48
|
toolApproval: ToolApprovalCoordinator | undefined;
|
|
44
49
|
durableEnabled: boolean;
|
|
45
|
-
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate
|
|
50
|
+
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<GateCurrencyStore>;
|
|
46
51
|
approvalAskAudit: FileApprovalAskAuditStore | undefined;
|
|
47
52
|
approvalExemptionStore: import("../plugins/approval-exemption-store.js").ApprovalExemptionStore | undefined;
|
|
48
53
|
sendUserFileEmitter: SendUserFileEmitter | undefined;
|
|
@@ -3,23 +3,25 @@ import { QuestionCoordinator } from "../question.js";
|
|
|
3
3
|
import { ToolApprovalCoordinator, resolveStreamApprovalGate } from "../tool-approval.js";
|
|
4
4
|
import { deploymentListAsks } from "../approval.js";
|
|
5
5
|
import { FileApprovalAskAuditStore } from "../approval-ask-audit-store.js";
|
|
6
|
+
import { createParkedGateRead } from "../approval-gate-currency.js";
|
|
6
7
|
import { SendUserFileEmitter, SEND_USER_FILE_MAX_BYTES, sendUserFileTool } from "../capabilities/send-user-file-tool.js";
|
|
7
8
|
import { createSandboxFileSend, TaskEnvRegistry } from "../capabilities/sandbox-file-send.js";
|
|
8
9
|
import { createSendUserFileIssuer } from "../plugins/send-user-file.js";
|
|
9
10
|
import { withLedgerRecording } from "../plugins/send-file-ledger.js";
|
|
10
11
|
import { basename, resolve } from "node:path";
|
|
11
|
-
import {
|
|
12
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
|
|
12
13
|
import { stat as fsStat, readFile as fsReadFile } from "node:fs/promises";
|
|
13
14
|
export function createLiveCoordinators(ctx) {
|
|
14
|
-
const { config, logger, backend, sendUserFileTaskEnvs, ruleConsent, ruleScopeRootFor, getParkedRedeem, parkCommits } = ctx;
|
|
15
|
+
const { config, logger, backend, sendUserFileTaskEnvs, ruleConsent, ruleScopeRootFor, getParkedRedeem, parkCommits, checkpointStore } = ctx;
|
|
15
16
|
const elicitation = config.mcpElicitation.enabled ? new ElicitationCoordinator(config.mcpElicitation.throttle) : undefined;
|
|
16
17
|
const question = config.askQuestionEnabled ? new QuestionCoordinator(config.questionThrottle) : undefined;
|
|
17
|
-
const
|
|
18
|
+
const parkStore = checkpointStore;
|
|
19
|
+
const durableEnabled = parkStore !== undefined;
|
|
18
20
|
const streamApprovalGate = resolveStreamApprovalGate({
|
|
19
21
|
toolApprovalEnabled: config.toolApprovalEnabled === true,
|
|
20
22
|
streamApprovalEnabled: config.streamApproval.enabled,
|
|
21
23
|
backend,
|
|
22
|
-
|
|
24
|
+
checkpointStore: parkStore,
|
|
23
25
|
});
|
|
24
26
|
if (config.streamApproval.enabled && !streamApprovalGate.active) {
|
|
25
27
|
logger.info("stream_approval_disabled", {
|
|
@@ -58,6 +60,7 @@ export function createLiveCoordinators(ctx) {
|
|
|
58
60
|
...(ruleScopeRootFor !== undefined ? { ruleScopeRootFor } : {}),
|
|
59
61
|
unattendedPolicy: config.unattendedApprovalPolicy,
|
|
60
62
|
...(getParkedRedeem !== undefined ? { parkedRedeem: getParkedRedeem } : {}),
|
|
63
|
+
...(checkpointStore !== undefined ? { parkedGate: createParkedGateRead(checkpointStore) } : {}),
|
|
61
64
|
...(approvalAskAudit !== undefined ? { askAudit: approvalAskAudit } : {}),
|
|
62
65
|
...(approvalExemptionStore !== undefined
|
|
63
66
|
? { sessionGrants: approvalExemptionStore, deploymentListAsks: (call) => deploymentListAsks(config, call) }
|
|
@@ -70,7 +73,7 @@ export function createLiveCoordinators(ctx) {
|
|
|
70
73
|
return undefined;
|
|
71
74
|
if (sendUserFileTaskEnvs)
|
|
72
75
|
return new SendUserFileEmitter();
|
|
73
|
-
if (
|
|
76
|
+
if (DEPLOYMENT_SHAPE_PREDICATES.callerOwnsWorkerDisk.holds(config))
|
|
74
77
|
return new SendUserFileEmitter();
|
|
75
78
|
return undefined;
|
|
76
79
|
})();
|
|
@@ -46,12 +46,6 @@
|
|
|
46
46
|
* 该面由 test/task-settings.test.ts 的「真身胜过名字」特征化钉机器可见。
|
|
47
47
|
*/
|
|
48
48
|
import { FileError, StubExecutionEnv, type ExecutionEnv, type ExecutionEnvFactory, type FileInfo, type Result } from "@sema-agent/core";
|
|
49
|
-
/** 哪些 lane 用本模块的代理裁决写门 —— 文件平面**不在** worker 本机的全部(= 能力表 `hostFilePlane` 答否)。
|
|
50
|
-
* 与 resolve-spec 的 `hostSemanticsLane` 是同一判别式的两面,取值处**只此一个**(两处各写一份正是漂移的成因)。
|
|
51
|
-
* 🔴 S-602:改前写的是 `provider !== undefined && provider !== "host"` —— 把缺席并进 host 的同义折(门 D R3),
|
|
52
|
-
* 今天改读表那一位(`in-process` / `host` 答 YES,其余答 NO;读数逐格不变)。认不出的词 ⇒ 走代理裁决:
|
|
53
|
-
* 代理 slot 空 ⇒ 写门 fail-closed(本模块头注裁定 2),与改前同向。 */
|
|
54
|
-
export declare function isSandboxPathAdjudicationLane(provider: string | undefined): boolean;
|
|
55
49
|
/** slot 取值的三态。`ok:false` 的两支都是 fail-closed,分开只为让留痕说得出**哪一种**缺席。 */
|
|
56
50
|
export type SandboxPathEnvLookup = {
|
|
57
51
|
readonly ok: true;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { FileError, StubExecutionEnv, err, ok } from "@sema-agent/core";
|
|
2
2
|
import { normalizeAbsolutePathLexically } from "../task-cwd.js";
|
|
3
|
-
import { executionLaneCaps, executionLaneOf } from "../execution-lane-caps.js";
|
|
4
|
-
export function isSandboxPathAdjudicationLane(provider) {
|
|
5
|
-
const lane = executionLaneOf(provider);
|
|
6
|
-
return lane === undefined || executionLaneCaps(lane).hostFilePlane !== "supported";
|
|
7
|
-
}
|
|
8
3
|
const MAX_BOUND_SESSIONS = 4096;
|
|
9
4
|
export class SandboxPathEnvSlots {
|
|
10
5
|
bySession = new Map();
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
* **多壳共享一只引擎**时它结构性地问错了问题 —— 首壳退了 peer 还在用,监视父 pid 要么误杀要么永不触发。
|
|
9
9
|
* 本件问的是那个真正的问题:**还有没有人附着**。
|
|
10
10
|
*
|
|
11
|
-
* ##
|
|
11
|
+
* ## [ref]:自退律只剩这一条(硬 breaking)
|
|
12
12
|
*
|
|
13
13
|
* `SEMA_PARENT_PID` 看门狗的 drain 臂**整条删**了:父死只是把引擎标成**孤儿**(`parent_watch_orphaned`),
|
|
14
14
|
* 孤儿走的是**本腿这一条**判据,只有一处不同 —— 窗长从 {@link EngineLeaseDeps.lingerMs} 换成
|
|
15
15
|
* {@link EngineLeaseOrphanLane.lingerMs}(`ENGINE_ORPHAN_LINGER_MS`,默认 2s)。于是:
|
|
16
16
|
* · 规则集 **−1**(「父死即退」那条判据没了),参数 +1(孤儿窗);
|
|
17
|
-
* · 「有人附着 / 有 run 在飞就不退」这条结构性保护**对孤儿同样成立** —— cli 拒绝
|
|
17
|
+
* · 「有人附着 / 有 run 在飞就不退」这条结构性保护**对孤儿同样成立** —— cli 拒绝 [ref] 的那一形
|
|
18
18
|
* (A 起引擎、B 按 engine.port 复用、A 正常退)不会再在 B 的 turn 中间把引擎拆掉;
|
|
19
19
|
* · 装配判据随之变成 `parentPid 在场 ∨ engineAutoExit`;`ENGINE_AUTO_EXIT` 关着的 owned 引擎窗长
|
|
20
|
-
* 是 **`Infinity`** —— 父还活着就**永不自退**(与
|
|
20
|
+
* 是 **`Infinity`** —— 父还活着就**永不自退**(与 [ref] 前逐字同),父一死才由孤儿窗接手。
|
|
21
21
|
*
|
|
22
22
|
* ## 机制(逐条都是契约)
|
|
23
23
|
*
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
* 6. **interval 必须 unref**:自退检查腿不得成为「进程本该退出却退不掉」的理由(与 drain tick 刻意
|
|
48
48
|
* 不 unref 的取向相反 —— 那一只 tick 就是停机驱动,这一只只是观察者)。**恒一只 interval**:
|
|
49
49
|
* 孤儿态不另起第二只定时器(两只定时器 = 两条自退律,正是本件要消灭的那件事)。
|
|
50
|
-
* 9. **拍频由窗推导,不是第二个旋钮**(
|
|
50
|
+
* 9. **拍频由窗推导,不是第二个旋钮**([ref]):`tickMs = min(`{@link ENGINE_LEASE_TICK_MS}`, 本腿可能
|
|
51
51
|
* 执行的每一个窗)`。理由是顶注 8 那句话的逆命题 —— 实际窗 `[linger, linger+tickMs)` 里,采样滞后
|
|
52
52
|
* 不得压过窗本身:15s 一拍去执行一个 2s 的孤儿窗,「2s」这句承诺就只是个装饰。所以装了孤儿车道
|
|
53
53
|
* (= 壳 spawn 形)的引擎按 2s 采样,没装的(纯服务器形)仍是 15s —— 存量部署一拍都没多跳。
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
* 已由 `inflight()` 结构性守住;parked 行是 durable 的,引擎退掉不丢:下次起来仍可赎回(spawn 形里
|
|
68
68
|
* 「下次」就是壳的下一次 spawn)。伤害面 = 一条 parked run 的赎回被推迟到下次启动,不是丢失。
|
|
69
69
|
* 这是**允许的收窄,不是静默**:有了廉价 parked 计数口(或本腿改成事件驱动)之后应当补上。
|
|
70
|
-
* · **活过父 run 的后台子代理不入判据**(codex R1 [high] 验真后**如实登记**,不是本件引入:
|
|
70
|
+
* · **活过父 run 的后台子代理不入判据**(codex R1 [high] 验真后**如实登记**,不是本件引入:[ref] 之前
|
|
71
71
|
* 父死走的是**当场** drain,而 `drainThenShutdown` 读的是同一只 `inflight()` ⇒ 同一个缺口,只是那时
|
|
72
72
|
* 连这 2s 都没有)。`inflight()` 的口径是**本副本的 HTTP 腿 ∪ leader 腿**(`http/server.ts` 的
|
|
73
73
|
* `inflightRuns`/`steerableRuns`/两只计数器),而 core 侧 `backgroundScope:"session"` 的子代理可以
|
|
@@ -12,14 +12,14 @@ import { type SpaceCommitRows } from "../workspace-space-commit.js";
|
|
|
12
12
|
import * as facts from "../capability-facts.js";
|
|
13
13
|
import { type TaskAttachmentStore } from "../plugins/task-attachment-store.js";
|
|
14
14
|
import type { TaskInheritEnv } from "../request-value-closure.js";
|
|
15
|
-
import type
|
|
15
|
+
import { type HeadRead } from "../session-incarnation.js";
|
|
16
16
|
import type { SpaceReclaimer } from "../workspace-space.js";
|
|
17
17
|
/**
|
|
18
18
|
* per-session 的 **cwd / shellEnv 登记簿**(TOC cwd seam + R-survey shellEnv seam)+ 它们的**租户围栏**。
|
|
19
19
|
*
|
|
20
20
|
* ── 为什么围栏不是可选的(codex R1-F1,判真)────────────────────────────────────────────────────
|
|
21
|
-
* 这两张表只按 `sessionId` 键控。在 host lane
|
|
22
|
-
*
|
|
21
|
+
* 这两张表只按 `sessionId` 键控。在 host lane 上那是安全的:那条车道的闸(部署形表行 `callerCwd` 的 host 臂)
|
|
22
|
+
* 要求单主,整台机器就一个用户。**device lane 把这个前提撤掉了** —— 同一行的 device 臂刻意不要求单用户
|
|
23
23
|
* (员工各连各的设备)。于是一条真实的超范围路径出现了:
|
|
24
24
|
* ① sessionId 由**调用方自选**,而且 `DELETE /v1/sessions/:id` 之后可以被**别人** `register` 重新登记
|
|
25
25
|
* (`boot/session-faces.ts` 的化身围栏注逐字写着这件事);
|
|
@@ -38,12 +38,12 @@ import type { SpaceReclaimer } from "../workspace-space.js";
|
|
|
38
38
|
export interface SessionScopedRegistries {
|
|
39
39
|
readonly perSessionCwd: Map<string, string>;
|
|
40
40
|
readonly perSessionShellEnv: Map<string, Record<string, string>>;
|
|
41
|
-
/**
|
|
41
|
+
/** [ref]:host shell 的继承策略(`inheritEnv` 请求键)。只读面给 host 工厂包装;写只经 {@link setSessionInheritEnv}。 */
|
|
42
42
|
readonly perSessionInheritEnv: ReadonlyMap<string, TaskInheritEnv>;
|
|
43
43
|
setSessionCwd(sid: string, cwd: string): void;
|
|
44
44
|
setSessionShellEnv(sid: string, env: Record<string, string>): void;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* [ref] —— 第三只 per-session 绑定(与 cwd / shellEnv 同一只 LRU 权威、同一条围栏、同一条删除)。
|
|
47
47
|
* `undefined` = **清掉**这一格(不是「不动」):`inheritEnv` 是「本条请求要什么」,缺席的请求要的是缺省清洗 ——
|
|
48
48
|
* 与 cwd / shellEnv 的「缺席 = 留着上一条的值」刻意不同(那两位由壳每条请求重发,粘住无害;这一位粘住 = 替一个没说话的
|
|
49
49
|
* 请求放宽凭据面)。
|
|
@@ -59,10 +59,10 @@ export declare function createSessionScopedRegistries(maxEntries?: number): Sess
|
|
|
59
59
|
/**
|
|
60
60
|
* k8s 车道的**每 run 绑定**:部署级适配器配置 × 三只 run 作用域的座(都按本 run 的 `ctx.sessionId` 取)——
|
|
61
61
|
* · 镜像:§7 P0.5 per-task 镜像(resolveSpec 按调用方 principal 解出、按会话登记;缺席 ⇒ 部署缺省镜像);
|
|
62
|
-
* · **工作区空间的分区 = 会话化身**(`spaceOccupant.incarnation`):建这只 env 时按 id
|
|
63
|
-
* `session-incarnation.ts`;本工厂不取会话,正是 core 给「没取会话的读者」的那只读)
|
|
62
|
+
* · **工作区空间的分区 = 会话化身**(`spaceOccupant.incarnation`):建这只 env 时按 id 读一次会话店的头(`headOf`,会话行上的那一格,
|
|
63
|
+
* `session-incarnation.ts`;本工厂不取会话,正是 core 给「没取会话的读者」的那只读),经 `sessionFaceOfHead` 投成一位活住客。读数是闭集三臂(`SpaceOccupant`,适配器那边逐臂处置):
|
|
64
64
|
* 答令牌 ⇒ 已知;答 `undefined`(没有这只会话)⇒ `{ unread: "incarnation_unknown" }` —— 没有空间:空间车道不开、缓存卷不挂,各一行;
|
|
65
|
-
* 读抛 / 超时(`rpcTimeoutMs`,同一次 connect 里读围栏行与 `latest` 的那一只墙)/ 答出的不是非空串 ⇒ `{ fault: <code> }` —— 读不到空间 ≠ 没有空间:开着的空间车道 / 缓存卷让这只 env 一只 pod 都不建,
|
|
65
|
+
* 读抛 / 超时(`rpcTimeoutMs`,同一次 connect 里读围栏行与 `latest` 的那一只墙)/ 行在而没有令牌(`session.incarnation_missing`)/ 答出的不是非空串 ⇒ `{ fault: <code> }` —— 读不到空间 ≠ 没有空间:开着的空间车道 / 缓存卷让这只 env 一只 pod 都不建,
|
|
66
66
|
* connect 与 resumeVM 都答 `connect_failed`(与 `latest` 读失败同一铸点),一行 `workspace_space_unreadable_occupant`;`code` 是店的错误码,
|
|
67
67
|
* 从不带正文、从不带令牌。**绝不**以会话 id 代替;
|
|
68
68
|
* 同时开这只 env 在空间提交围栏上的座(`spaceOccupant.fence`,run 店的 `workspace_space_commit` 行;法见 `workspace-space-commit.ts`);
|
|
@@ -76,9 +76,10 @@ export declare function createSessionScopedRegistries(maxEntries?: number): Sess
|
|
|
76
76
|
*/
|
|
77
77
|
export declare function createK8sRunEnvFactory(k8sCfg: K8sEnvConfig, seats: {
|
|
78
78
|
imageOf(sessionId: string): string | undefined;
|
|
79
|
-
/** The session store's by-id
|
|
80
|
-
* has none, which `assertWorkspaceSpaceReadable` refuses together with `space` (embeddings that
|
|
81
|
-
|
|
79
|
+
/** The session store's by-id head read (`SessionStore.headOf`, picked once by `headReadOf`); the occupant is its live-occupant projection
|
|
80
|
+
* (`sessionFaceOfHead`). Absent ⇔ the store has none, which `assertWorkspaceSpaceReadable` refuses together with `space` (embeddings that
|
|
81
|
+
* wire another lane pass none). */
|
|
82
|
+
headOf: HeadRead | undefined;
|
|
82
83
|
/** The run store's commit-fence rows (`workspace_space_commit`); answers `undefined` only before stage 7 binds the run store
|
|
83
84
|
* or without a store backend — the latter `assertWorkspaceSpaceReadable` refuses together with `space`. */
|
|
84
85
|
spaceCommits(): SpaceCommitRows | undefined;
|
|
@@ -87,7 +88,7 @@ export declare function createK8sRunEnvFactory(k8sCfg: K8sEnvConfig, seats: {
|
|
|
87
88
|
* k8s 工作区空间的**起服前提**(装配后的真门;同段先例 = `assertDeviceLaneWired`)。法只有一条:
|
|
88
89
|
* **生效策略 `space`(事实 `workspaceSpace`)∧ {@link createK8sRunEnvFactory} 的两只座缺一 ⇒ 拒启。**
|
|
89
90
|
*
|
|
90
|
-
* 空间车道每条 run 开不开,只看工厂的两只座:住客的按 id 读(会话店的 `
|
|
91
|
+
* 空间车道每条 run 开不开,只看工厂的两只座:住客的按 id 读(会话店的 `headOf`,`headReadOf` 在第 5 段判一次,本门与工厂
|
|
91
92
|
* 读同一只返回值)与提交围栏的行(run 店 —— 住在存储后端里;没有存储后端 ⇒ 没有这只座)。缺一 ⇒ 每条 run 都不存,而能力位
|
|
92
93
|
* `workspaceSync.persist` 只读配置、照报 `"space"`。事实**保持只读配置**;让它恒真的办法是拒掉这一组合,不是给事实加运行期依赖。
|
|
93
94
|
* 生效策略缺席(非 k8s 车道 / 没配快照存储:能力位本就不在场,后者有起服一行 `workspace_persist_unavailable`)或 `off` ⇒ 不判。
|
|
@@ -96,7 +97,7 @@ export declare function createK8sRunEnvFactory(k8sCfg: K8sEnvConfig, seats: {
|
|
|
96
97
|
* 拒句一行,点名:旋钮词、缺的是哪一只座、会话店种类(`sessionStoreLabelOf` —— `/health.sessionBackend` 同一读法)、出路。
|
|
97
98
|
*/
|
|
98
99
|
export declare function assertWorkspaceSpaceReadable(space: ReturnType<typeof facts.workspaceSpace>, seats: {
|
|
99
|
-
readonly
|
|
100
|
+
readonly headOf: HeadRead | undefined;
|
|
100
101
|
readonly spaceCommits: (() => SpaceCommitRows | undefined) | undefined;
|
|
101
102
|
}, cache: ReturnType<typeof facts.workspaceCache>, sessionStoreLabel: string): void;
|
|
102
103
|
/** device lane 的三件活对象(店 / 汇聚端 / 准入链)。缺席 = 本部署没有 device 车道。 */
|
|
@@ -116,8 +117,8 @@ export interface ExecutionEnvCtx {
|
|
|
116
117
|
* (`late-binds.ts`),工厂在 run 期才求值。装配(第 5 段)在有存储后端时传、没有时不传(起服门据此判);不传(含只装别的车道的嵌入 /
|
|
117
118
|
* 测试)⇒ 读不到行 ⇒ k8s 空间车道按「住客读不到」不开,每 env 一行 `workspace_space_unavailable`(响亮,不静默)。 */
|
|
118
119
|
spaceCommits?: () => SpaceCommitRows | undefined;
|
|
119
|
-
/** k8s 工作区空间的住客读:会话店的按 id 读(`
|
|
120
|
-
|
|
120
|
+
/** k8s 工作区空间的住客读:会话店的按 id 读(`headReadOf(sessionStore)`,第 5 段判一次、与起服门同一只)。不传 ⇒ 同上,不开、响亮。 */
|
|
121
|
+
headOf?: HeadRead;
|
|
121
122
|
}
|
|
122
123
|
export declare function createExecutionEnv(ctx: ExecutionEnvCtx): {
|
|
123
124
|
perTaskImage: PerTaskImageRegistry;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { createHostLspManager } from "../host-lsp-manager.js";
|
|
4
|
-
import {
|
|
4
|
+
import { TaskEnvRegistry } from "../capabilities/sandbox-file-send.js";
|
|
5
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
|
|
5
6
|
import { SessionEnvironmentSelection } from "../capabilities/select-environment-tool.js";
|
|
6
7
|
import { createE2bLspManager } from "../lsp/e2b-manager.js";
|
|
7
8
|
import { evictLspOnDestroy } from "../lsp-evict.js";
|
|
@@ -15,7 +16,7 @@ import { createRunWorkspaceSnapshotSeat } from "../fleet/workspace-snapshot-resi
|
|
|
15
16
|
import { createSpaceCommitFence } from "../workspace-space-commit.js";
|
|
16
17
|
import { localDockerExecutionEnvFactory } from "../plugins/remote-env-local-docker.js";
|
|
17
18
|
import { sshExecutionEnvFactory } from "../plugins/remote-env-ssh.js";
|
|
18
|
-
import {
|
|
19
|
+
import { withRemoteScratchpad } from "../plugins/remote-scratchpad.js";
|
|
19
20
|
import { FileSchedulerBackend, defaultSchedulerStorePath } from "../plugins/scheduler-support.js";
|
|
20
21
|
import * as facts from "../capability-facts.js";
|
|
21
22
|
import { materializeAttachmentsInto } from "../plugins/task-attachment-store.js";
|
|
@@ -23,12 +24,13 @@ import { reapOrphanWorktrees, withWorktreeIsolation } from "../plugins/worktree-
|
|
|
23
24
|
import { derivePkgSourceEnv } from "../sandbox-pkg-source.js";
|
|
24
25
|
import { effectiveHostWorkspace } from "../task-cwd.js";
|
|
25
26
|
import { taskInheritEnvRefusal } from "../hosted-posture.js";
|
|
27
|
+
import { sessionFaceOfHead } from "../session-incarnation.js";
|
|
26
28
|
import { createCacheMissMemory } from "../workspace-cache.js";
|
|
27
29
|
import { workspaceSnapshotTimeoutOf } from "../workspace-space.js";
|
|
28
30
|
import { sayEgressPolicyReading } from "../sandbox-egress-policy.js";
|
|
29
|
-
import {
|
|
31
|
+
import { sandboxPathEnvSlots, withSandboxPathEnvSlot } from "./deferred-sandbox-path-env.js";
|
|
30
32
|
import { LANE_HOME_UNDECLARED_EVENT, createLaneHomeAbsenceReporter } from "../lane-home-probe.js";
|
|
31
|
-
import { REMOTE_EXEC_PROVIDER_WORDS, buildUndeclaredHomeNote, executionLaneHomeDir, executionLaneOf,
|
|
33
|
+
import { REMOTE_EXEC_PROVIDER_WORDS, buildUndeclaredHomeNote, executionLaneHomeDir, executionLaneOf, laneBindsReads, laneIsolated } from "../execution-lane-caps.js";
|
|
32
34
|
function boundedSessionSetter(map, maxEntries) {
|
|
33
35
|
return (sid, value) => {
|
|
34
36
|
map.delete(sid);
|
|
@@ -132,14 +134,14 @@ const INCARNATION_READ_TIMEOUT = "incarnation_read_timeout";
|
|
|
132
134
|
async function occupantOf(seats, sessionId, taskId, boundMs) {
|
|
133
135
|
let answer;
|
|
134
136
|
try {
|
|
135
|
-
const read = seats.
|
|
137
|
+
const read = seats.headOf;
|
|
136
138
|
answer =
|
|
137
139
|
read === undefined
|
|
138
140
|
? undefined
|
|
139
|
-
: await boundedStoreCall(() => read(sessionId), {
|
|
141
|
+
: sessionFaceOfHead(sessionId, await boundedStoreCall(() => read(sessionId), {
|
|
140
142
|
ms: boundMs,
|
|
141
143
|
onTimeout: () => Object.assign(new Error(`session occupant read did not answer within ${boundMs}ms`), { code: INCARNATION_READ_TIMEOUT }),
|
|
142
|
-
});
|
|
144
|
+
}))?.incarnation;
|
|
143
145
|
}
|
|
144
146
|
catch (e) {
|
|
145
147
|
const code = e?.code;
|
|
@@ -147,8 +149,6 @@ async function occupantOf(seats, sessionId, taskId, boundMs) {
|
|
|
147
149
|
}
|
|
148
150
|
if (answer === undefined)
|
|
149
151
|
return { unread: "incarnation_unknown" };
|
|
150
|
-
if (typeof answer !== "string" || answer === "")
|
|
151
|
-
return { fault: "incarnation_read_failed" };
|
|
152
152
|
const rows = seats.spaceCommits();
|
|
153
153
|
return rows !== undefined ? { incarnation: answer, fence: createSpaceCommitFence(rows, answer, taskId) } : { unread: "incarnation_unknown" };
|
|
154
154
|
}
|
|
@@ -158,7 +158,7 @@ function spaceOff(store) {
|
|
|
158
158
|
}
|
|
159
159
|
export function assertWorkspaceSpaceReadable(space, seats, cache, sessionStoreLabel) {
|
|
160
160
|
if (space.available && persistNeedsOccupant(space.policy.persist)) {
|
|
161
|
-
const missing = seats.
|
|
161
|
+
const missing = seats.headOf === undefined ? `the session store (${sessionStoreLabel}) has no by-id occupant read (headOf)`
|
|
162
162
|
: seats.spaceCommits === undefined ? `this deployment has no store backend to hold the space's commit rows (the session store is ${sessionStoreLabel})`
|
|
163
163
|
: undefined;
|
|
164
164
|
if (missing === undefined)
|
|
@@ -169,9 +169,9 @@ export function assertWorkspaceSpaceReadable(space, seats, cache, sessionStoreLa
|
|
|
169
169
|
"DB_BACKEND=memory has none), or set WORKSPACE_PERSIST=off (the default is space), and restart");
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
|
-
if (cache.available && (seats.
|
|
173
|
-
const missing = seats.
|
|
174
|
-
? `the session store (${sessionStoreLabel}) has no by-id occupant read (
|
|
172
|
+
if (cache.available && (seats.headOf === undefined || seats.spaceCommits === undefined)) {
|
|
173
|
+
const missing = seats.headOf === undefined
|
|
174
|
+
? `the session store (${sessionStoreLabel}) has no by-id occupant read (headOf)`
|
|
175
175
|
: `this deployment has no store backend to hold the space durably (the session store is ${sessionStoreLabel})`;
|
|
176
176
|
throw new Error(`WORKSPACE_CACHE=volume but ${missing} [workspace-space-unreadable]: ` +
|
|
177
177
|
"the k8s build-cache volume belongs to the workspace space, which is keyed by the session occupant, so here no run would get its volume while " +
|
|
@@ -187,7 +187,7 @@ function persistNeedsOccupant(persist) {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
function buildRealSystemNote(remoteExec) {
|
|
190
|
-
if (!
|
|
190
|
+
if (!DEPLOYMENT_SHAPE_PREDICATES.singleMachineDefaultLane.holds({ remoteExec }))
|
|
191
191
|
return "non-isolated target — actions are permanent; rely on the policy gate + HITL (design/61 §5)";
|
|
192
192
|
const sandboxLanes = REMOTE_EXEC_PROVIDER_WORDS.filter((lane) => laneIsolated(lane)).join("|");
|
|
193
193
|
return ("hands run on this machine with no OS sandbox (single-machine default: REMOTE_EXEC unset, CONFIG_PROVIDER=local) — actions are permanent, " +
|
|
@@ -245,7 +245,7 @@ export function createExecutionEnv(ctx) {
|
|
|
245
245
|
logger,
|
|
246
246
|
...((env) => (env !== undefined ? { podEnv: env } : {}))(buildSandboxLaneEnv(config, config.remoteExec.sandboxEnv)),
|
|
247
247
|
};
|
|
248
|
-
executionEnvFactory = createK8sRunEnvFactory(k8sCfg, { imageOf: (sid) => perTaskImage.get(sid),
|
|
248
|
+
executionEnvFactory = createK8sRunEnvFactory(k8sCfg, { imageOf: (sid) => perTaskImage.get(sid), headOf: ctx.headOf, spaceCommits: ctx.spaceCommits ?? (() => undefined) });
|
|
249
249
|
if (k8sCfg.cache !== undefined || k8sCfg.s3Snapshot !== undefined)
|
|
250
250
|
spaceReclaimer = createSpaceReclaimer(k8sCfg);
|
|
251
251
|
void checkSandboxEgressPolicy(k8sCfg)
|
|
@@ -341,7 +341,7 @@ export function createExecutionEnv(ctx) {
|
|
|
341
341
|
...(config.remoteExec.env ? { env: config.remoteExec.env } : {}),
|
|
342
342
|
});
|
|
343
343
|
}
|
|
344
|
-
if (executionEnvFactory &&
|
|
344
|
+
if (executionEnvFactory && DEPLOYMENT_SHAPE_PREDICATES.remoteScratchpad.holds(config)) {
|
|
345
345
|
executionEnvFactory = withRemoteScratchpad(executionEnvFactory, logger);
|
|
346
346
|
}
|
|
347
347
|
if (config.worktreeIsolation && executionEnvFactory) {
|
|
@@ -387,8 +387,7 @@ export function createExecutionEnv(ctx) {
|
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
const sendUserFileTaskEnvs = (() => {
|
|
390
|
-
|
|
391
|
-
if (!config.sendUserFile || !executionEnvFactory || !sandboxSendLaneEnabled(provider, config.requirePrincipal))
|
|
390
|
+
if (!config.sendUserFile || !executionEnvFactory || !DEPLOYMENT_SHAPE_PREDICATES.sandboxSendUserFile.holds(config))
|
|
392
391
|
return undefined;
|
|
393
392
|
const registry = new TaskEnvRegistry();
|
|
394
393
|
executionEnvFactory = registry.wrapFactory(executionEnvFactory);
|
|
@@ -405,13 +404,12 @@ export function createExecutionEnv(ctx) {
|
|
|
405
404
|
return env;
|
|
406
405
|
};
|
|
407
406
|
}
|
|
408
|
-
if (executionEnvFactory &&
|
|
407
|
+
if (executionEnvFactory && DEPLOYMENT_SHAPE_PREDICATES.sandboxPathAdjudication.holds(config)) {
|
|
409
408
|
executionEnvFactory = withSandboxPathEnvSlot(executionEnvFactory, sandboxPathEnvSlots, logger);
|
|
410
409
|
}
|
|
411
410
|
if (executionEnvFactory) {
|
|
412
411
|
const isolated = laneIsolated(executionLaneOf(config.remoteExec.provider));
|
|
413
|
-
const suspendable =
|
|
414
|
-
(config.remoteExec.provider === "k8s" && !!config.remoteExec.s3Snapshot);
|
|
412
|
+
const suspendable = DEPLOYMENT_SHAPE_PREDICATES.suspendableHands.holds(config);
|
|
415
413
|
const sandboxEnvKeys = forwardedSandboxEnvKeys(config.remoteExec);
|
|
416
414
|
logger.info("remote_exec_enabled", { provider: config.remoteExec.provider, isolated, suspendable, ...(sandboxEnvKeys.length > 0 ? { sandboxEnvKeys } : {}) });
|
|
417
415
|
if (!isolated)
|
|
@@ -9,8 +9,8 @@ export declare function buildFatalErrorText(err: unknown): string;
|
|
|
9
9
|
/**
|
|
10
10
|
* 进程级 fatal 出口的**唯一一只腿**:同一只 {@link buildFatalErrorText} 产物写两个面,然后按崩溃码退。
|
|
11
11
|
*
|
|
12
|
-
* ── 病(
|
|
13
|
-
* 出口过去只有那条 JSON 行。而拒启文案是**多行**的 ——
|
|
12
|
+
* ── 病([ref],test [ref] P2)────────────────────────────────────────────────────────────────────
|
|
13
|
+
* 出口过去只有那条 JSON 行。而拒启文案是**多行**的 —— [ref] 的列集对账会生成
|
|
14
14
|
* `ALTER TABLE <表> ADD COLUMN <列定义>;`,它存在的全部理由就是「运维直接粘进 psql」;塞进 JSON 字符串后
|
|
15
15
|
* 整段变成一串 `\n` 转义,**粘不走**。dist 里也没有 pretty / `isTTY` 分支去把它摊开(有也不该有:出口的
|
|
16
16
|
* 可读性不该取决于终端是谁)。
|
package/dist/boot/leader.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export interface LeaderCtx {
|
|
|
23
23
|
toolResultStore: ToolResultStoreFull | undefined;
|
|
24
24
|
sessionStore: ReturnType<typeof createSessionStore>;
|
|
25
25
|
checkpointStore: CheckpointStoreFull | undefined;
|
|
26
|
+
/** [ref]:停驻行凭据的封签器(与 HTTP 面 `ServiceDeps.checkpointCtxSealing` 同一只;起服第 6 段已对「店在、它不在」拒启)。必填键,值可为 undefined。 */
|
|
27
|
+
checkpointCtxSealing: import("../http/checkpoint-ctx.js").CheckpointCtxSealing | undefined;
|
|
26
28
|
/** [ref] 件B/C/D([ref],codex R2-F1):部署治理三座席 —— leader 车道的每一只 Runner 都要带上它,
|
|
27
29
|
* 否则开了 leader 端点的部署就有一条在部署治理**之外**的执行面(合规否决/锁都够不着)。 */
|
|
28
30
|
governanceSeams: import("./governance-seams.js").GovernanceSeams;
|
package/dist/boot/leader.js
CHANGED
|
@@ -22,7 +22,7 @@ export function assertLeaderDurableStore(leaderEnabled, hasLeaderRunStore) {
|
|
|
22
22
|
"(#193 车4 件2 capability gate; the DB_BACKEND literal check in config.ts is the intent half of the same rule)");
|
|
23
23
|
}
|
|
24
24
|
export function createLeaderFace(ctx) {
|
|
25
|
-
const { config, logger, brain, pricing, executionEnvFactory, toolResultStore, sessionStore, checkpointStore, governanceSeams } = ctx;
|
|
25
|
+
const { config, logger, brain, pricing, executionEnvFactory, toolResultStore, sessionStore, checkpointStore, checkpointCtxSealing, governanceSeams } = ctx;
|
|
26
26
|
const leaderMinio = process.env.MINIO_ENDPOINT && process.env.MINIO_ACCESS_KEY && process.env.MINIO_SECRET_KEY
|
|
27
27
|
? {
|
|
28
28
|
s3: {
|
|
@@ -74,6 +74,7 @@ export function createLeaderFace(ctx) {
|
|
|
74
74
|
durable: () => hasApprovalListIntent(config)
|
|
75
75
|
? {
|
|
76
76
|
checkpointStore,
|
|
77
|
+
ctxSealer: checkpointCtxSealing,
|
|
77
78
|
requireApproval: config.approvalRequire,
|
|
78
79
|
deny: config.approvalDeny,
|
|
79
80
|
autoBudget: config.approvalAutoBudget,
|
|
@@ -95,7 +95,7 @@ export interface MemoryWriteBoundaryFacts {
|
|
|
95
95
|
* core 7.16.0([ref])之后写家还要再深一层(`<平面>/<label>`),但 label 归引擎注册簿,boot 期说不出口;
|
|
96
96
|
* 平面是**包含关系上等价**的那一只(家恒为平面的直接子目录),所以判据停在平面,不猜 label。 */
|
|
97
97
|
memoryRoot: string | undefined;
|
|
98
|
-
/** 执行车道名,只进文案(归一读口 `executionLaneOf` 的答案;
|
|
98
|
+
/** 执行车道名,只进文案(归一读口 `executionLaneOf` 的答案;[ref] 起不在调用点手写 `?? "in-process"`)。 */
|
|
99
99
|
lane: ExecutionLane;
|
|
100
100
|
/** 该车道的文件工具是否跑在**本机** fs 上(in-process / `REMOTE_EXEC=host`)。false = 沙箱盘,与记忆根分平面。
|
|
101
101
|
* ⚠️ 这一位管的是**文件平面**,与下面的 `coreRemoteExecutionEnv` 是**两根轴**,别合并(codex round2
|
|
@@ -119,7 +119,7 @@ export interface MemoryWriteBoundaryFacts {
|
|
|
119
119
|
containmentRoots: readonly string[];
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
|
-
*
|
|
122
|
+
* [ref] —— 审计的**车道那四位**由本函数从能力表派生(boot/stores.ts 的装配点只调它,不再就地手写):
|
|
123
123
|
* 改前 stores 里是 `lane === undefined || lane === "host"`(同义折,门 D R3)+ `config.remoteExec !== undefined`
|
|
124
124
|
* (座位上的裸缺席判,R4)+ `lane ?? "in-process"` ×3(R2)。两根轴各读表里各自那一位,不合并:
|
|
125
125
|
* · `hostSemanticsLane` ⇐ `hostFilePlane`(文件平面在不在本机);
|