@sema-agent/server 7.146.0 → 7.147.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 +384 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/USAGE.md +170 -66
- package/deploy/facts/lanes.json +7 -0
- package/deploy/sema-up/README.md +2 -2
- package/deploy/sema-up/chart/templates/_helpers.tpl +22 -0
- 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 +1 -1
- package/deploy/sema-up/cluster-up.sh +2 -1
- package/deploy/sema-up/lib/flagshape.sh +4 -0
- package/deploy/sema-up/lib/lanes.json +2 -5
- package/deploy/sema-up/sema-up.sh +12 -9
- package/deploy/sema-up/stack/compose.yaml +5 -4
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +4 -3
- package/dist/approval-card.d.ts +4 -4
- package/dist/approval.d.ts +3 -3
- package/dist/audit.js +2 -2
- package/dist/bench/s1/live-deps.js +3 -1
- package/dist/boot/crash-last.js +2 -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 +2 -1
- package/dist/boot/execution-env.js +45 -33
- package/dist/boot/execution-lane.d.ts +37 -9
- package/dist/boot/execution-lane.js +74 -20
- package/dist/boot/exit-boundary.d.ts +1 -1
- package/dist/boot/exit-last.js +2 -1
- package/dist/boot/governance-seams.d.ts +2 -2
- package/dist/boot/leader.js +1 -1
- package/dist/boot/memory-boundary.d.ts +11 -11
- package/dist/boot/memory-boundary.js +3 -3
- package/dist/boot/memory-consolidation.d.ts +13 -24
- package/dist/boot/memory-consolidation.js +0 -13
- package/dist/boot/org-memory.js +3 -2
- package/dist/boot/parked-revive-gate.d.ts +1 -1
- package/dist/boot/parked-revive-gate.js +1 -1
- package/dist/boot/reapers.js +1 -1
- package/dist/boot/resolve-spec.js +91 -111
- package/dist/boot/retention-lane.d.ts +4 -42
- package/dist/boot/session-faces.d.ts +1 -0
- package/dist/boot/session-faces.js +8 -2
- package/dist/boot/stage-01-config.d.ts +1 -1
- package/dist/boot/stage-01-config.js +6 -2
- package/dist/boot/stage-02-web-admin-pull.d.ts +1 -1
- package/dist/boot/stage-02-web-admin-pull.js +10 -8
- package/dist/boot/stage-03-store-backend.d.ts +1 -1
- package/dist/boot/stage-04-stores.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.d.ts +2 -2
- package/dist/boot/stage-05-execution-env.js +3 -3
- package/dist/boot/stage-06-runners.d.ts +3 -3
- package/dist/boot/stage-06-runners.js +1 -3
- package/dist/boot/stage-07-capability-layer.d.ts +3 -3
- package/dist/boot/stage-07-capability-layer.js +4 -9
- package/dist/boot/stage-08-reapers.d.ts +3 -3
- package/dist/boot/stage-09-leader.d.ts +4 -3
- package/dist/boot/stage-10-http-server.d.ts +4 -3
- package/dist/boot/stage-10-http-server.js +2 -1
- package/dist/boot/stores.d.ts +9 -0
- package/dist/boot/stores.js +18 -7
- package/dist/boot/web-admin.js +3 -3
- package/dist/capabilities/center-plugins.d.ts +2 -0
- package/dist/capabilities/center-plugins.js +6 -2
- package/dist/capabilities/composite-members.d.ts +1 -0
- package/dist/capabilities/composite-members.js +1 -0
- 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/scenarios.d.ts +32 -18
- package/dist/capabilities/scenarios.js +13 -9
- package/dist/capabilities/settings-contract.d.ts +29 -0
- package/dist/capabilities/settings-contract.js +14 -0
- package/dist/capabilities/skills.d.ts +5 -5
- package/dist/capability-facts.d.ts +38 -0
- package/dist/capability-facts.js +34 -1
- package/dist/center-credential-renewer.js +3 -2
- package/dist/config-catalog.js +6 -5
- package/dist/config-invariants.d.ts +18 -3
- package/dist/config-invariants.js +36 -19
- package/dist/config-lkg.d.ts +1 -1
- package/dist/config-lkg.js +5 -6
- package/dist/config-provider.js +2 -0
- package/dist/config-types.d.ts +190 -186
- package/dist/config.d.ts +68 -5
- package/dist/config.js +80 -54
- package/dist/degenerate-instrument.js +1 -1
- package/dist/deploy-facts.js +3 -2
- package/dist/deployment-shape.d.ts +21 -12
- package/dist/deployment-shape.js +24 -6
- package/dist/env-facts.d.ts +7 -5
- package/dist/env-facts.js +10 -6
- 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 +49 -86
- package/dist/execution-lane-caps.js +52 -62
- package/dist/execution-placement.d.ts +18 -2
- package/dist/execution-placement.js +19 -0
- package/dist/file-history-disclosure.d.ts +2 -2
- package/dist/fleet/drain-entry.d.ts +17 -10
- package/dist/fleet/drain-entry.js +1 -1
- package/dist/fleet/serving-lease.js +3 -4
- package/dist/history-anchor.d.ts +22 -0
- package/dist/history-anchor.js +14 -0
- package/dist/hooks/command-spawn.d.ts +1 -4
- package/dist/hooks/command-spawn.js +0 -11
- package/dist/hooks/hook-runner.d.ts +52 -8
- package/dist/hooks/hook-runner.js +160 -36
- package/dist/http/approval-sweeps.d.ts +2 -5
- package/dist/http/approval-sweeps.js +3 -2
- package/dist/http/checkpoint-ctx.d.ts +17 -0
- package/dist/http/checkpoint-ctx.js +6 -0
- package/dist/http/claim-latency.d.ts +10 -0
- package/dist/http/claim-latency.js +12 -0
- package/dist/http/dispatch.js +1 -1
- package/dist/http/durable-run-leg.js +2 -1
- package/dist/http/execution-context.d.ts +3 -1
- package/dist/http/execution-context.js +4 -0
- package/dist/http/memory-compliance-failure-reply.d.ts +1 -1
- package/dist/http/memory-compliance-failure-reply.js +3 -0
- package/dist/http/memory-store-refusal-reply.d.ts +3 -3
- package/dist/http/memory-store-refusal-reply.js +3 -0
- package/dist/http/owner-access.d.ts +11 -0
- package/dist/http/owner-access.js +7 -4
- package/dist/http/principal-gate.d.ts +3 -14
- package/dist/http/principal-gate.js +0 -13
- package/dist/http/request-guards.d.ts +1 -1
- package/dist/http/resume-legs.d.ts +7 -10
- package/dist/http/resume-legs.js +79 -50
- 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 +32 -16
- package/dist/http/route-table.js +2 -0
- package/dist/http/routes/approvals-assistant.js +5 -25
- package/dist/http/routes/capabilities.js +8 -2
- package/dist/http/routes/devices.js +1 -1
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/notify-wake.js +2 -1
- package/dist/http/routes/projects.d.ts +70 -0
- package/dist/http/routes/projects.js +86 -0
- package/dist/http/routes/rules.js +30 -2
- package/dist/http/routes/runs.js +8 -8
- package/dist/http/routes/session-sync.js +27 -10
- package/dist/http/routes/sessions.d.ts +7 -1
- package/dist/http/routes/sessions.js +104 -2
- package/dist/http/routes/tasks.js +9 -3
- package/dist/http/server.d.ts +24 -10
- package/dist/http/server.js +17 -6
- package/dist/http/stored-body-replay.d.ts +5 -3
- package/dist/http/stored-body-replay.js +10 -1
- package/dist/http/wire-types.d.ts +19 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/instruction-source-notice.d.ts +1 -1
- 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-scope.d.ts +2 -2
- package/dist/memory-scope.js +1 -1
- package/dist/memory-store-refusal.d.ts +17 -4
- package/dist/memory-store-refusal.js +1 -1
- package/dist/memory-sync-client.d.ts +2 -0
- package/dist/memory-sync-client.js +13 -11
- package/dist/memory-sync.js +1 -1
- package/dist/model-compat.d.ts +35 -21
- package/dist/model-compat.js +49 -21
- package/dist/model-entry-refusal.d.ts +11 -1
- package/dist/model-entry-refusal.js +7 -0
- package/dist/namespaced-rule-name.d.ts +18 -1
- package/dist/namespaced-rule-name.js +12 -0
- package/dist/observability/fail-open.d.ts +17 -9
- package/dist/observability/fail-open.js +17 -9
- package/dist/observability/metrics.d.ts +2 -0
- package/dist/observability/metrics.js +2 -0
- package/dist/observability/secret-env-scrub.d.ts +30 -4
- package/dist/observability/secret-env-scrub.js +15 -3
- 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 +26 -6
- package/dist/orchestration/workflow-completion-inbox.js +63 -45
- package/dist/org-memory-admission.d.ts +5 -2
- package/dist/org-memory-admission.js +25 -10
- package/dist/parked-decide.d.ts +33 -26
- package/dist/parked-decide.js +36 -44
- package/dist/plugins/approval-ask-store-file.d.ts +10 -2
- package/dist/plugins/approval-ask-store-file.js +37 -4
- package/dist/plugins/approval-ask-store-memory.d.ts +5 -3
- package/dist/plugins/approval-ask-store-memory.js +11 -2
- package/dist/plugins/approval-ask-store-sql.d.ts +3 -0
- package/dist/plugins/approval-ask-store-sql.js +3 -1
- package/dist/plugins/blob-backend.d.ts +38 -195
- package/dist/plugins/blob-backend.js +33 -229
- package/dist/plugins/caching-session-store.d.ts +9 -4
- package/dist/plugins/checkpoint-index-columns.d.ts +1 -1
- package/dist/plugins/checkpoint-index-columns.js +3 -2
- package/dist/plugins/checkpoint-store-face.d.ts +1 -1
- package/dist/plugins/device-store-sql.d.ts +2 -2
- package/dist/plugins/device-store-sql.js +5 -10
- 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 +26 -12
- package/dist/plugins/file-run-store.js +63 -63
- package/dist/plugins/imported-layer-root-retirement.d.ts +17 -8
- 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/local-checkpoint-store.d.ts +5 -0
- package/dist/plugins/local-checkpoint-store.js +11 -7
- package/dist/plugins/local-data-dir-modes-m39.d.ts +48 -0
- package/dist/plugins/local-data-dir-modes-m39.js +182 -0
- package/dist/plugins/local-engine-high-water.d.ts +11 -0
- package/dist/plugins/local-engine-high-water.js +59 -0
- package/dist/plugins/local-session-store.d.ts +91 -25
- package/dist/plugins/local-session-store.js +124 -45
- package/dist/plugins/local-task-attachment-store.d.ts +2 -0
- package/dist/plugins/local-task-attachment-store.js +10 -11
- 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 +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +4 -3
- package/dist/plugins/memory-engine-pg.js +4 -4
- package/dist/plugins/memory-engine-sql-apply.d.ts +13 -4
- package/dist/plugins/memory-engine-sql-apply.js +1 -1
- package/dist/plugins/memory-engine-tidb.d.ts +8 -5
- package/dist/plugins/memory-engine-tidb.js +7 -8
- package/dist/plugins/one-time-migrations.d.ts +145 -35
- package/dist/plugins/one-time-migrations.js +272 -120
- 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 +8 -8
- package/dist/plugins/permission-rule-store-file.js +14 -2
- package/dist/plugins/pg-pool.d.ts +2 -1
- package/dist/plugins/pg-pool.js +11 -4
- 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 +12 -3
- package/dist/plugins/remote-env-e2b.js +6 -4
- package/dist/plugins/remote-env-host.d.ts +9 -1
- package/dist/plugins/remote-env-host.js +6 -5
- package/dist/plugins/remote-env-k8s.d.ts +5 -2
- package/dist/plugins/remote-env-k8s.js +15 -4
- package/dist/plugins/remote-env-local-docker.d.ts +4 -1
- package/dist/plugins/remote-env-local-docker.js +3 -3
- package/dist/plugins/remote-env-ssh.d.ts +8 -2
- package/dist/plugins/remote-env-ssh.js +26 -24
- 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 +126 -0
- package/dist/plugins/retention-deployment.js +88 -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/schema-consistency.d.ts +0 -6
- package/dist/plugins/schema-consistency.js +1 -2
- package/dist/plugins/schema-ensure-legs.d.ts +1 -1
- package/dist/plugins/schema-ensure-legs.js +11 -1
- package/dist/plugins/session-ext-table.d.ts +74 -0
- package/dist/plugins/session-ext-table.js +121 -0
- package/dist/plugins/session-fork.d.ts +1 -1
- package/dist/plugins/session-row-sql.d.ts +8 -7
- package/dist/plugins/session-row-sql.js +15 -7
- package/dist/plugins/session-store-sql.d.ts +131 -0
- package/dist/plugins/session-store-sql.js +298 -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 -0
- package/dist/plugins/shared-memory-store-sql.js +13 -13
- package/dist/plugins/snapshot-bucket-presence.js +1 -1
- package/dist/plugins/sql-driver.d.ts +23 -7
- package/dist/plugins/sql-driver.js +41 -8
- package/dist/plugins/sql-errors.d.ts +5 -2
- package/dist/plugins/sql-errors.js +4 -0
- package/dist/plugins/store-backend.d.ts +35 -8
- package/dist/plugins/store-backend.js +184 -62
- package/dist/plugins/store-contracts.d.ts +9 -2
- package/dist/plugins/store-contracts.js +1 -0
- package/dist/plugins/task-attachment-store.d.ts +6 -8
- package/dist/plugins/task-attachment-store.js +15 -10
- 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 +19 -31
- package/dist/plugins/user-input-ledger-sql.d.ts +1 -1
- package/dist/read-face-posture.d.ts +6 -6
- package/dist/read-face-posture.js +2 -2
- package/dist/request-value-closure.d.ts +5 -5
- package/dist/request-value-closure.js +1 -1
- package/dist/rules-consent.d.ts +41 -13
- package/dist/rules-consent.js +101 -53
- package/dist/run-local.js +17 -13
- package/dist/runs.d.ts +48 -30
- package/dist/runs.js +26 -16
- package/dist/runtime-caps-resolver.d.ts +15 -8
- package/dist/runtime-caps-resolver.js +14 -10
- package/dist/sealed-key-layout.d.ts +2 -3
- package/dist/sealed-key-layout.js +0 -1
- package/dist/sealed-key.js +7 -5
- package/dist/security.d.ts +5 -3
- package/dist/sema-config-dir.js +2 -2
- package/dist/server-secret-env.d.ts +2 -0
- package/dist/service-version.d.ts +2 -1
- package/dist/service-version.js +2 -2
- package/dist/session-error-wire.d.ts +1 -1
- package/dist/session-incarnation.d.ts +8 -5
- package/dist/session-resident-background.d.ts +85 -32
- package/dist/session-resident-background.js +75 -7
- package/dist/session-row.d.ts +1 -1
- package/dist/session-sync-kernel.d.ts +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/store-posture.d.ts +2 -1
- package/dist/stored-request-hooks-m20.d.ts +3 -2
- package/dist/stored-request-hooks-m20.js +19 -14
- 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 +1 -1
- package/dist/stores-sql/checkpoint-store-sql.js +11 -27
- 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/{plugins → stores-sql}/pg-session-storage.d.ts +23 -76
- package/dist/{plugins → stores-sql}/pg-session-storage.js +80 -209
- package/dist/{plugins → stores-sql}/retention-store-sql.d.ts +123 -217
- package/dist/{plugins → stores-sql}/retention-store-sql.js +66 -190
- 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 +1 -1
- package/dist/stores-sql/session-write-hooks.d.ts +59 -0
- package/dist/stores-sql/session-write-hooks.js +2 -0
- package/dist/{plugins → stores-sql}/tidb-session-storage.d.ts +10 -11
- package/dist/{plugins → stores-sql}/tidb-session-storage.js +10 -21
- package/dist/{plugins → stores-sql}/tidb-session-store.d.ts +32 -122
- package/dist/{plugins → stores-sql}/tidb-session-store.js +71 -171
- 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 +56 -0
- package/dist/stores-sql/windowed-session-storage.js +61 -0
- package/dist/task-a2a.d.ts +7 -1
- package/dist/task-a2a.js +15 -14
- package/dist/task-cwd.d.ts +11 -3
- package/dist/task-cwd.js +17 -1
- package/dist/task-mcp.d.ts +10 -2
- package/dist/task-mcp.js +13 -16
- package/dist/task-settings.d.ts +9 -4
- package/dist/task-settings.js +17 -6
- package/dist/tool-approval.d.ts +21 -8
- package/dist/tool-approval.js +10 -6
- package/dist/trace/core-keyset-guard.d.ts +9 -3
- 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 +23 -1
- package/dist/trace/exit-seat.js +3 -0
- package/dist/trace/project.d.ts +33 -16
- package/dist/trace/project.js +12 -9
- package/dist/trace/redact.d.ts +1 -1
- package/dist/trace/redact.js +61 -73
- package/dist/trace/self-minted-wire.d.ts +263 -10
- package/dist/trace/self-minted-wire.js +90 -2
- 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 +38 -2
- package/dist/trace/wire-projection-faces.js +26 -1
- package/dist/unread-request-members.d.ts +66 -0
- package/dist/unread-request-members.js +41 -0
- package/dist/user-input-ledger.d.ts +2 -2
- package/dist/web-admin-client/apply-effective.js +22 -26
- 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 +4 -1
- package/dist/web-admin-client/center-request.js +2 -1
- package/dist/web-admin-client/effective-keys.js +0 -1
- package/dist/web-admin-client/facade.d.ts +1 -1
- package/dist/web-admin-client/http-client.d.ts +1 -0
- package/dist/web-admin-client/http-client.js +17 -9
- package/dist/web-admin-client/restart-signal.js +5 -2
- package/dist/web-admin-client/skills-mcp.d.ts +20 -6
- package/dist/web-admin-client/skills-mcp.js +26 -21
- package/dist/web-admin-client/types.d.ts +34 -49
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +2 -2
- package/package.json +13 -12
- package/scripts/drain-check-local.mjs +2 -28
- package/scripts/drain-check.mysql.sql +2 -18
- package/scripts/drain-check.pg.sql +2 -18
- package/wire-changes/server@7.147.0.json +813 -0
|
@@ -26,6 +26,7 @@ import { withRemoteScratchpad } from "../plugins/remote-scratchpad.js";
|
|
|
26
26
|
import { FileSchedulerBackend, defaultSchedulerStorePath } from "../plugins/scheduler-support.js";
|
|
27
27
|
import * as facts from "../capability-facts.js";
|
|
28
28
|
import { materializeAttachmentsInto } from "../plugins/task-attachment-store.js";
|
|
29
|
+
import { createAttachmentMaterializingFactory } from "../execution-env-purpose.js";
|
|
29
30
|
import { reapOrphanWorktrees, withWorktreeIsolation } from "../plugins/worktree-isolation.js";
|
|
30
31
|
import { derivePkgSourceEnv } from "../sandbox-pkg-source.js";
|
|
31
32
|
import { effectiveHostWorkspace } from "../task-cwd.js";
|
|
@@ -37,7 +38,7 @@ import { workspaceSnapshotTimeoutOf } from "../workspace-space.js";
|
|
|
37
38
|
import { sayEgressPolicyReading } from "../sandbox-egress-policy.js";
|
|
38
39
|
import { sandboxPathEnvSlots, withSandboxPathEnvSlot } from "./deferred-sandbox-path-env.js";
|
|
39
40
|
import { createLaneHomeAbsenceReporter } from "../lane-home-probe.js";
|
|
40
|
-
import {
|
|
41
|
+
import { buildLaneHomeBootNote, buildLaneHomeClaim, capabilitiesFor, executionLaneOf, laneBindsReads, laneIsolated, laneSandboxReadFloorState } from "../execution-lane-caps.js";
|
|
41
42
|
import { warnReadDenyFloorUnkept } from "./execution-lane.js";
|
|
42
43
|
import { seatText } from "../trace/exit-seat.js";
|
|
43
44
|
import { countSessionResidentBackground } from "../session-resident-background.js";
|
|
@@ -220,14 +221,7 @@ function persistNeedsOccupant(persist) {
|
|
|
220
221
|
return false;
|
|
221
222
|
}
|
|
222
223
|
}
|
|
223
|
-
|
|
224
|
-
if (!DEPLOYMENT_SHAPE_PREDICATES.singleMachineDefaultLane.holds({ remoteExec }))
|
|
225
|
-
return "non-isolated target — actions are permanent; rely on the policy gate + HITL (design/61 §5)";
|
|
226
|
-
const sandboxLanes = REMOTE_EXEC_PROVIDER_WORDS.filter((lane) => laneIsolated(lane)).join("|");
|
|
227
|
-
return ("hands run on this machine with no OS sandbox (single-machine default: REMOTE_EXEC unset, CONFIG_PROVIDER=local) — actions are permanent, " +
|
|
228
|
-
"and the Bash read boundary is a text-level friction floor, not a safety boundary; the safety boundary is a sandbox lane: " +
|
|
229
|
-
`set REMOTE_EXEC=${sandboxLanes} (see docs/DEPLOY-PREREQS.md, section "S-281")`);
|
|
230
|
-
}
|
|
224
|
+
const REAL_SYSTEM_NOTE = "non-isolated target — actions are permanent; rely on the policy gate + HITL (design/61 §5)";
|
|
231
225
|
function hostWorktreeUnwrappedRefusal() {
|
|
232
226
|
return Object.assign(new Error('isolation "worktree" was requested but cannot be honored: this host lane has no worktree wrapper active ' +
|
|
233
227
|
"(WORKTREE_ISOLATION_ENABLED=true together with WORKTREE_REPO_ROOT=<a git repository> turns it on; a repo root that does not exist or has no `.git` leaves it off — see the boot log), " +
|
|
@@ -251,7 +245,7 @@ export function createExecutionEnv(ctx) {
|
|
|
251
245
|
let sandboxGitPlane = createSandboxGitPlaneSeat((r) => sandboxGitPlanePremisesOf(config, r), {});
|
|
252
246
|
let worktreeReap;
|
|
253
247
|
const workspaceFillOf = taskAttachmentStore === undefined ? undefined : (fctx) => createWorkspaceFill({ store: taskAttachmentStore, sessionId: fctx.sessionId, seeds: ownsItsWorkspace(fctx), logger });
|
|
254
|
-
if (config.remoteExec
|
|
248
|
+
if (config.remoteExec.provider === "e2b") {
|
|
255
249
|
executionEnvFactory = e2bExecutionEnvFactory({
|
|
256
250
|
apiKey: config.remoteExec.apiKey,
|
|
257
251
|
...homeDirSeat, ...homeAbsentNotice,
|
|
@@ -267,7 +261,7 @@ export function createExecutionEnv(ctx) {
|
|
|
267
261
|
metrics,
|
|
268
262
|
}, ctx.laneDeps?.e2b);
|
|
269
263
|
}
|
|
270
|
-
else if (config.remoteExec
|
|
264
|
+
else if (config.remoteExec.provider === "k8s") {
|
|
271
265
|
const k8sCfg = {
|
|
272
266
|
image: config.remoteExec.image,
|
|
273
267
|
...homeDirSeat, ...homeAbsentNotice,
|
|
@@ -310,7 +304,7 @@ export function createExecutionEnv(ctx) {
|
|
|
310
304
|
.then((gaps) => sayEgressPolicyReading(gaps, logger, k8sCfg.namespace))
|
|
311
305
|
.catch((e) => logger.error("sandbox_egress_policy_check_crashed", { error: seatText("operator-log-text", e instanceof Error ? e.message : String(e)), effect: "the sandbox egress self-check did not complete this boot — the lane runs; the egress policy was not read" }));
|
|
312
306
|
}
|
|
313
|
-
else if (config.remoteExec
|
|
307
|
+
else if (config.remoteExec.provider === "ssh") {
|
|
314
308
|
executionEnvFactory = sshExecutionEnvFactory({
|
|
315
309
|
host: config.remoteExec.host,
|
|
316
310
|
username: config.remoteExec.username,
|
|
@@ -319,9 +313,10 @@ export function createExecutionEnv(ctx) {
|
|
|
319
313
|
...(config.remoteExec.port != null ? { port: config.remoteExec.port } : {}),
|
|
320
314
|
...(config.remoteExec.mountPath ? { mountPath: config.remoteExec.mountPath } : {}),
|
|
321
315
|
...(config.remoteExec.hostKey !== undefined ? { hostKey: config.remoteExec.hostKey } : {}),
|
|
316
|
+
logger,
|
|
322
317
|
});
|
|
323
318
|
}
|
|
324
|
-
else if (config.remoteExec
|
|
319
|
+
else if (config.remoteExec.provider === "device") {
|
|
325
320
|
if (ctx.deviceLane) {
|
|
326
321
|
executionEnvFactory = deviceExecutionEnvFactory({
|
|
327
322
|
hub: ctx.deviceLane.hub,
|
|
@@ -336,15 +331,16 @@ export function createExecutionEnv(ctx) {
|
|
|
336
331
|
});
|
|
337
332
|
}
|
|
338
333
|
}
|
|
339
|
-
else if (config.remoteExec
|
|
334
|
+
else if (config.remoteExec.provider === "adb") {
|
|
340
335
|
executionEnvFactory = adbExecutionEnvFactory({
|
|
341
336
|
serial: config.remoteExec.serial,
|
|
342
337
|
...homeDirSeat, ...homeAbsentNotice,
|
|
343
338
|
...(config.remoteExec.adbPath ? { adbPath: config.remoteExec.adbPath } : {}),
|
|
344
339
|
...(config.remoteExec.mountPath ? { mountPath: config.remoteExec.mountPath } : {}),
|
|
340
|
+
logger,
|
|
345
341
|
});
|
|
346
342
|
}
|
|
347
|
-
else if (config.remoteExec
|
|
343
|
+
else if (config.remoteExec.provider === "host") {
|
|
348
344
|
{
|
|
349
345
|
const schedulerStorePath = config.schedulerStorePath ?? defaultSchedulerStorePath(config);
|
|
350
346
|
const hostScheduler = facts.hostScheduler(config).available
|
|
@@ -386,7 +382,7 @@ export function createExecutionEnv(ctx) {
|
|
|
386
382
|
};
|
|
387
383
|
}
|
|
388
384
|
}
|
|
389
|
-
else if (config.remoteExec
|
|
385
|
+
else if (config.remoteExec.provider === "local-docker") {
|
|
390
386
|
executionEnvFactory = localDockerExecutionEnvFactory({
|
|
391
387
|
image: config.remoteExec.image,
|
|
392
388
|
...(config.remoteExec.mountPath ? { mountPath: config.remoteExec.mountPath } : {}),
|
|
@@ -402,6 +398,7 @@ export function createExecutionEnv(ctx) {
|
|
|
402
398
|
...(config.remoteExec.env ? { env: config.remoteExec.env } : {}),
|
|
403
399
|
sandboxReadFloor: config.sandboxReadFloor,
|
|
404
400
|
...(workspaceFillOf !== undefined ? { workspaceFillOf } : {}),
|
|
401
|
+
logger,
|
|
405
402
|
}, ctx.laneDeps?.localDocker);
|
|
406
403
|
}
|
|
407
404
|
if (executionEnvFactory && DEPLOYMENT_SHAPE_PREDICATES.remoteScratchpad.holds(config)) {
|
|
@@ -410,15 +407,15 @@ export function createExecutionEnv(ctx) {
|
|
|
410
407
|
if (config.worktreeIsolation && executionEnvFactory) {
|
|
411
408
|
const wtRoot = config.worktreeIsolation.repoRoot;
|
|
412
409
|
const wtValid = existsSync(wtRoot) && existsSync(join(wtRoot, ".git"));
|
|
413
|
-
if (config.remoteExec
|
|
410
|
+
if (config.remoteExec.provider === "host" && !wtValid) {
|
|
414
411
|
logger.error("worktree_isolation_disabled_bad_repo_root", {
|
|
415
412
|
repoRoot: wtRoot,
|
|
416
413
|
reason: existsSync(wtRoot) ? "not a git repository (no .git)" : "path does not exist",
|
|
417
414
|
note: "WORKTREE_ISOLATION_ENABLED is set but WORKTREE_REPO_ROOT is not a usable git repo — isolation left OFF; isolation:'worktree' workflow agents are refused (isolation.unavailable) until it is fixed. Fix the path or unset the flag.",
|
|
418
415
|
});
|
|
419
416
|
}
|
|
420
|
-
else if (config.remoteExec
|
|
421
|
-
const gitBaseEnv = new RemoteHostExecutionEnv({ workspaceDir: config.worktreeIsolation.repoRoot, inheritEnv: "all", backgroundShell: config.requirePrincipal !== true });
|
|
417
|
+
else if (config.remoteExec.provider === "host") {
|
|
418
|
+
const gitBaseEnv = new RemoteHostExecutionEnv({ workspaceDir: config.worktreeIsolation.repoRoot, inheritEnv: "all", backgroundShell: config.requirePrincipal !== true, gitBase: true });
|
|
422
419
|
executionEnvFactory = withWorktreeIsolation(executionEnvFactory, {
|
|
423
420
|
repoRoot: config.worktreeIsolation.repoRoot,
|
|
424
421
|
...(config.worktreeIsolation.allowedRoots ? { allowedRoots: config.worktreeIsolation.allowedRoots } : {}),
|
|
@@ -444,7 +441,7 @@ export function createExecutionEnv(ctx) {
|
|
|
444
441
|
}
|
|
445
442
|
else {
|
|
446
443
|
logger.warn("worktree_isolation_unsupported_lane", {
|
|
447
|
-
provider: config.remoteExec
|
|
444
|
+
provider: config.remoteExec.provider,
|
|
448
445
|
note: "git-worktree isolation v1 covers only the 'host' lane — isolation:'worktree' is a no-op here (the base env is used). Worktree-rooted remote envs are a follow-on.",
|
|
449
446
|
});
|
|
450
447
|
}
|
|
@@ -456,37 +453,30 @@ export function createExecutionEnv(ctx) {
|
|
|
456
453
|
executionEnvFactory = registry.wrapFactory(executionEnvFactory);
|
|
457
454
|
return registry;
|
|
458
455
|
})();
|
|
459
|
-
if (taskAttachmentStore && executionEnvFactory && !laneIsolated(
|
|
460
|
-
const inner = executionEnvFactory;
|
|
456
|
+
if (taskAttachmentStore && executionEnvFactory && !laneIsolated(config.remoteExec.provider)) {
|
|
461
457
|
const attStore = taskAttachmentStore;
|
|
462
|
-
executionEnvFactory =
|
|
463
|
-
const env = await inner(ctx);
|
|
464
|
-
const n = await materializeAttachmentsInto(env, attStore, ctx.sessionId);
|
|
465
|
-
if (n > 0)
|
|
466
|
-
logger.info("attachments_materialized", { sessionId: ctx.sessionId, count: n });
|
|
467
|
-
return env;
|
|
468
|
-
};
|
|
458
|
+
executionEnvFactory = createAttachmentMaterializingFactory(executionEnvFactory, (env, ctx) => materializeAttachmentsInto(env, attStore, ctx.sessionId), (sessionId, count) => logger.info("attachments_materialized", { sessionId, count }));
|
|
469
459
|
}
|
|
470
460
|
if (executionEnvFactory && DEPLOYMENT_SHAPE_PREDICATES.sandboxPathAdjudication.holds(config)) {
|
|
471
461
|
executionEnvFactory = withSandboxPathEnvSlot(executionEnvFactory, sandboxPathEnvSlots, logger);
|
|
472
462
|
}
|
|
473
463
|
if (executionEnvFactory) {
|
|
474
|
-
const isolated = laneIsolated(
|
|
464
|
+
const isolated = laneIsolated(config.remoteExec.provider);
|
|
475
465
|
const suspendable = DEPLOYMENT_SHAPE_PREDICATES.suspendableHands.holds(config);
|
|
476
466
|
const keepsReadFloor = capabilitiesFor(config).keepsReadFloor;
|
|
477
467
|
const sandboxReadFloor = laneSandboxReadFloorState(config);
|
|
478
468
|
const sandboxEnvKeys = [...sandboxEnvNamesInForce(config)].sort();
|
|
479
469
|
logger.info("remote_exec_enabled", { provider: config.remoteExec.provider, isolated, suspendable, keepsReadFloor, ...(sandboxReadFloor !== undefined ? { sandboxReadFloor } : {}), ...(sandboxEnvKeys.length > 0 ? { sandboxEnvKeys } : {}) });
|
|
480
470
|
if (!isolated)
|
|
481
|
-
logger.warn("remote_exec_real_system", { provider: config.remoteExec.provider, note:
|
|
471
|
+
logger.warn("remote_exec_real_system", { provider: config.remoteExec.provider, note: REAL_SYSTEM_NOTE });
|
|
482
472
|
const homeLine = buildLaneHomeBootNote(config);
|
|
483
473
|
if (homeLine !== undefined)
|
|
484
474
|
logger.warn(homeLine.event, { provider: config.remoteExec.provider, note: homeLine.note });
|
|
485
|
-
if (
|
|
475
|
+
if (config.remoteExec.provider === "host")
|
|
486
476
|
logger.info("task_inherit_env_honored", { honored: taskInheritEnvRefusal(config) === undefined });
|
|
487
477
|
}
|
|
488
478
|
warnReadDenyFloorUnkept(config, logger);
|
|
489
|
-
const lspProvider = config.remoteExec
|
|
479
|
+
const lspProvider = config.remoteExec.provider;
|
|
490
480
|
const lspLane = executionLaneOf(lspProvider);
|
|
491
481
|
const lspLaneBindsReads = lspLane !== undefined && laneBindsReads(lspLane);
|
|
492
482
|
if ((lspProvider === "e2b" || lspProvider === "k8s") && config.lspEnabled && !lspLaneBindsReads) {
|
|
@@ -509,6 +499,8 @@ export function createExecutionEnv(ctx) {
|
|
|
509
499
|
if (lspManager)
|
|
510
500
|
logger.info("lsp_enabled", { provider: lspProvider });
|
|
511
501
|
const unreadableReported = new Set();
|
|
502
|
+
let stallReapFailureReported = false;
|
|
503
|
+
const stallMs = config.backgroundAgentStallMs;
|
|
512
504
|
const sessionResidentBackground = () => countSessionResidentBackground(sessionScoped.sessionOwners, {
|
|
513
505
|
onUnreadable: (sessionId, err) => {
|
|
514
506
|
if (unreadableReported.has(sessionId))
|
|
@@ -516,6 +508,26 @@ export function createExecutionEnv(ctx) {
|
|
|
516
508
|
unreadableReported.add(sessionId);
|
|
517
509
|
logger.warn("session_resident_background_unreadable", { sessionId, counted: 1, err: seatText("operator-log-text", String(err)) });
|
|
518
510
|
},
|
|
511
|
+
stall: {
|
|
512
|
+
stallMs,
|
|
513
|
+
report: (outcome) => {
|
|
514
|
+
switch (outcome.kind) {
|
|
515
|
+
case "reaped":
|
|
516
|
+
logger.warn("background_agent_stall_reaped", { reaped: outcome.count, stallMs });
|
|
517
|
+
return;
|
|
518
|
+
case "failed":
|
|
519
|
+
if (stallReapFailureReported)
|
|
520
|
+
return;
|
|
521
|
+
stallReapFailureReported = true;
|
|
522
|
+
logger.warn("background_agent_stall_reap_failed", { stallMs, err: seatText("operator-log-text", String(outcome.err)) });
|
|
523
|
+
return;
|
|
524
|
+
default: {
|
|
525
|
+
const unhandled = outcome;
|
|
526
|
+
throw new Error(`background agent stall reap: unknown outcome ${String(unhandled)}`);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
},
|
|
519
531
|
});
|
|
520
532
|
return {
|
|
521
533
|
perTaskImage, sessionEnvSelection, perSessionCwd, setSessionCwd, setSessionShellEnv, setSessionInheritEnv,
|
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
import { type CrossInvariantView } from "../config-invariants.js";
|
|
2
|
-
import type { ServiceConfig } from "../config-types.js";
|
|
3
|
-
import {
|
|
2
|
+
import type { LoadedConfig, ServiceConfig } from "../config-types.js";
|
|
3
|
+
import { type EntryDeclarableLane } from "../config.js";
|
|
4
|
+
import { buildReadDenyFloorUnkeptNote, type ExecutionLane } from "../execution-lane-caps.js";
|
|
4
5
|
import type { Logger } from "../observability/logger.js";
|
|
5
|
-
/** `config.d/remote-exec.json` 能写进来的车道(文件契约里不带密钥名、可 1:1
|
|
6
|
-
export declare const FILE_SOURCED_LANES: readonly ["host", "local-docker"];
|
|
6
|
+
/** `config.d/remote-exec.json` 能写进来的车道(文件契约里不带密钥名、可 1:1 映射的三条 —— `none` 零字段;e2b/k8s/ssh/adb 要 NAME→值解析,尚未接线)。 */
|
|
7
|
+
export declare const FILE_SOURCED_LANES: readonly ["host", "local-docker", "none"];
|
|
7
8
|
export type FileSourcedLane = (typeof FILE_SOURCED_LANES)[number];
|
|
9
|
+
/** 判点的拒句(一行;两条照旧行为的修法逐字在句中:7.146.0 非 local 未设 ⇒ `REMOTE_EXEC=none`,local 未设 ⇒ `REMOTE_EXEC=host`)。
|
|
10
|
+
* 车道词取自车道表(隔离与否读能力表的唯一布尔口 `laneIsolated`),不手抄清单。 */
|
|
11
|
+
export declare const EXECUTION_LANE_UNDECLARED_REFUSAL: string;
|
|
12
|
+
/**
|
|
13
|
+
* 一个**入口程序**(装配者)对车道说的两句话 —— 合成步对它们只有一条律:声明的先后 = 文件 > env > 入口自身,**在场的最高者终结选择**(文件在场 ⇒ 车道就是文件那一条,
|
|
14
|
+
* 解析不了即拒,不许 env / 入口顶上;文件缺席 ⇒ env;二者都缺席 ⇒ 入口自身);最终车道必须是入口跑得了的,否则拒(起任何任务之前)。
|
|
15
|
+
*/
|
|
16
|
+
export interface ExecutionLaneEntry {
|
|
17
|
+
/** 拒句点名的入口(`run-local` / `the HTTP service` …)。 */
|
|
18
|
+
readonly name: string;
|
|
19
|
+
/**
|
|
20
|
+
* 本入口跑得了的车道(闭集;HTTP 服务 = 全部八条,`run-local` = host 与 none —— 它没有容器 / 远程执行器,`none` 不要执行器)。
|
|
21
|
+
* 能从 `config.d/remote-exec.json` 取的 = 它 ∩ {@link FILE_SOURCED_LANES}(隔离车道 e2b / k8s / ssh / adb 要 NAME→值解析,文件腿尚未接线)。
|
|
22
|
+
*/
|
|
23
|
+
readonly runs: readonly ExecutionLane[];
|
|
24
|
+
/** 入口自身的声明(入口 = 部署者,如 run-local ⇒ `host`):文件与 env 都没点名时才填,排在二者之后;缺席 = 本入口不替部署声明。不写进程 env。 */
|
|
25
|
+
readonly declares?: EntryDeclarableLane;
|
|
26
|
+
}
|
|
27
|
+
/** HTTP 服务这只入口:跑得了全部车道、不替部署声明(它的部署者是运维:声明只来自 env / 文件)。 */
|
|
28
|
+
export declare const HTTP_SERVICE_LANE_ENTRY: ExecutionLaneEntry;
|
|
8
29
|
export interface ExecutionLaneComposeCtx {
|
|
9
30
|
/** 本入口的配置源形态(`configSourceKind` 的答案 —— 与它真建的 provider 同一只判据)。
|
|
10
31
|
* 只有 `local` 才读文件;`undefined` = 纯 env 部署。 */
|
|
@@ -12,12 +33,19 @@ export interface ExecutionLaneComposeCtx {
|
|
|
12
33
|
/** 配置根(与配置源同一个根,不分裂)。 */
|
|
13
34
|
readonly localRoot: string;
|
|
14
35
|
readonly logger: Logger;
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
readonly drivesFromFile: readonly FileSourcedLane[];
|
|
36
|
+
/** 装配这台部署的入口程序(跑得了哪些车道、自己声明哪一条)。 */
|
|
37
|
+
readonly entry: ExecutionLaneEntry;
|
|
18
38
|
}
|
|
19
|
-
/**
|
|
20
|
-
|
|
39
|
+
/**
|
|
40
|
+
* 合成 + 判:raw 配置 → composed 配置(**同一个对象**就地覆写并收窄型,交回给装配链往下传)。没有声明 / 坏文件 / 不变量不过 ⇒ 抛(拒启)。
|
|
41
|
+
*/
|
|
42
|
+
export declare function composeExecutionLane(loaded: LoadedConfig, ctx: ExecutionLaneComposeCtx): Promise<ServiceConfig>;
|
|
43
|
+
/**
|
|
44
|
+
* 合成步的**同步尾**(文件覆写之后的一切,恰此一份):入口声明补缺席位 → 入口跑不跑得了 → 判点 → 读面按最终车道派生 + 恰一行通告 → 车道交叉不变量 →
|
|
45
|
+
* `exec_lane_selected {lane}`。{@link composeExecutionLane} 在文件腿之后调它;没有文件腿的纯 env 形(`bench`、测试夹具)直接调它 —— 同一份合成,不是第二个判官。
|
|
46
|
+
* `entry` 缺席 = 这次装配没有入口程序替部署说话(嵌入方 / 脚本:车道只来自 env,跑得了的不设限)。
|
|
47
|
+
*/
|
|
48
|
+
export declare function composeDeclaredExecutionLane(loaded: LoadedConfig, logger: Pick<Logger, "info">, entry?: ExecutionLaneEntry): ServiceConfig;
|
|
21
49
|
/**
|
|
22
50
|
* **宿主车道的 shell 起服解析**(一次)—— 宿主车道(`provider === "host"`)的命令用本机 shell 起(win32 = Git Bash),起服时把它解析落定,
|
|
23
51
|
* 找不到就在这里响亮地说一次(`warn host_shell_unavailable { err, remedy }`),而不是等第一个用户的第一条 Bash 撞上。
|
|
@@ -1,16 +1,62 @@
|
|
|
1
1
|
import { loadRemoteExec } from "@sema-agent/settings-schema/node";
|
|
2
2
|
import { assertLocalConfigDirTrusted } from "../config-dir-trust.js";
|
|
3
3
|
import { crossInvariant } from "../config-invariants.js";
|
|
4
|
-
import {
|
|
4
|
+
import { entryDeclarableRemoteExec } from "../config.js";
|
|
5
|
+
import { ALL_EXECUTION_LANES, buildReadDenyFloorUnkeptNote, laneIsolated, laneWiresExecutionEnv } from "../execution-lane-caps.js";
|
|
5
6
|
import { buildReadFacePostureNotice, settleDerivedReadFace } from "../read-face-posture.js";
|
|
6
7
|
import { settleHostShellAtBoot } from "../plugins/host-platform.js";
|
|
7
8
|
import { seatText } from "../trace/exit-seat.js";
|
|
8
|
-
export const FILE_SOURCED_LANES = ["host", "local-docker"];
|
|
9
|
-
export
|
|
9
|
+
export const FILE_SOURCED_LANES = ["host", "local-docker", "none"];
|
|
10
|
+
export const EXECUTION_LANE_UNDECLARED_REFUSAL = (() => {
|
|
11
|
+
const sandboxLanes = ALL_EXECUTION_LANES.filter((lane) => laneIsolated(lane));
|
|
12
|
+
const otherHandLanes = ALL_EXECUTION_LANES.filter((lane) => lane !== "host" && laneWiresExecutionEnv(lane) && !laneIsolated(lane));
|
|
13
|
+
return ("No execution lane is declared — every deployment names its execution lane: set REMOTE_EXEC (with CONFIG_PROVIDER=local, config.d/remote-exec.json also declares it). " +
|
|
14
|
+
"To keep what this deployment did before 7.147.0: REMOTE_EXEC=none when CONFIG_PROVIDER is not \"local\" (no execution environment — the agent's tool hands never mount), " +
|
|
15
|
+
"REMOTE_EXEC=host when CONFIG_PROVIDER=local (tools run directly on this machine with no OS sandbox). " +
|
|
16
|
+
`Or name a sandbox lane (${sandboxLanes.join(" | ")}) or ${otherHandLanes.join(" | ")} with that lane's required env. ` +
|
|
17
|
+
"CONFIG_PROVIDER only selects where configuration is read from; it does not select an execution lane.");
|
|
18
|
+
})();
|
|
19
|
+
export const HTTP_SERVICE_LANE_ENTRY = { name: "the HTTP service", runs: ALL_EXECUTION_LANES };
|
|
20
|
+
function entryCannotRunLaneRefusal(entry, lane, source) {
|
|
21
|
+
return (`${source} declares the execution lane "${lane}", but ${entry.name} runs only ${entry.runs.join(" / ")} — it has no executor for "${lane}". ` +
|
|
22
|
+
`Refusing before any task starts rather than run on another lane: declare a lane ${entry.name} runs, or serve "${lane}" from an entry that runs it (the HTTP service runs every lane).`);
|
|
23
|
+
}
|
|
24
|
+
function fileLaneUnresolvableRefusal(entry, lane, envReading, root) {
|
|
25
|
+
return (`config.d/remote-exec.json under ${root} declares the execution lane "${lane}", but ${entry.name} reads "${lane}"'s coordinates only from REMOTE_EXEC env ` +
|
|
26
|
+
`(file-source name→value resolution is not wired yet), and ${envReading}. The file's declaration ends the lane selection: no other declaration may stand in for it. ` +
|
|
27
|
+
`Refusing before any task starts: set REMOTE_EXEC=${lane} with that lane's required env, or change the file to the lane you mean.`);
|
|
28
|
+
}
|
|
29
|
+
export async function composeExecutionLane(loaded, ctx) {
|
|
10
30
|
if (ctx.configSource === "local")
|
|
11
|
-
await applyRemoteExecFile(
|
|
12
|
-
|
|
31
|
+
await applyRemoteExecFile(loaded, ctx);
|
|
32
|
+
return composeDeclaredExecutionLane(loaded, ctx.logger, ctx.entry);
|
|
33
|
+
}
|
|
34
|
+
export function composeDeclaredExecutionLane(loaded, logger, entry) {
|
|
35
|
+
if (entry !== undefined)
|
|
36
|
+
settleEntryLane(loaded, entry);
|
|
37
|
+
const config = requireDeclaredExecutionLane(loaded);
|
|
38
|
+
settleReadFaceForFinalLane(config, logger);
|
|
13
39
|
assertExecutionLaneInvariants(config);
|
|
40
|
+
logger.info("exec_lane_selected", { lane: config.remoteExec.provider });
|
|
41
|
+
return config;
|
|
42
|
+
}
|
|
43
|
+
function requireDeclaredExecutionLane(loaded) {
|
|
44
|
+
if (!isComposed(loaded))
|
|
45
|
+
throw new Error(EXECUTION_LANE_UNDECLARED_REFUSAL);
|
|
46
|
+
return loaded;
|
|
47
|
+
}
|
|
48
|
+
function settleEntryLane(loaded, entry) {
|
|
49
|
+
const declaredByEntry = !isComposed(loaded) ? entry.declares : undefined;
|
|
50
|
+
if (declaredByEntry !== undefined)
|
|
51
|
+
loaded.remoteExec = entryDeclarableRemoteExec(declaredByEntry);
|
|
52
|
+
if (!isComposed(loaded))
|
|
53
|
+
return;
|
|
54
|
+
const lane = loaded.remoteExec.provider;
|
|
55
|
+
if (!entry.runs.includes(lane))
|
|
56
|
+
throw new Error(entryCannotRunLaneRefusal(entry, lane, declaredByEntry !== undefined ? `${entry.name} itself` : `REMOTE_EXEC=${lane}`));
|
|
57
|
+
}
|
|
58
|
+
function isComposed(config) {
|
|
59
|
+
return config.remoteExec !== undefined;
|
|
14
60
|
}
|
|
15
61
|
function settleReadFaceForFinalLane(config, logger) {
|
|
16
62
|
if (!settleDerivedReadFace(config, config.requirePrincipal !== true))
|
|
@@ -20,14 +66,14 @@ function settleReadFaceForFinalLane(config, logger) {
|
|
|
20
66
|
logger.info(notice.event, notice.fields);
|
|
21
67
|
}
|
|
22
68
|
export async function settleHostLaneShell(config, logger) {
|
|
23
|
-
if (config.remoteExec
|
|
69
|
+
if (config.remoteExec.provider !== "host")
|
|
24
70
|
return;
|
|
25
71
|
await settleHostShellAtBoot(logger);
|
|
26
72
|
}
|
|
27
73
|
export function warnReadDenyFloorUnkept(config, logger) {
|
|
28
74
|
const note = buildReadDenyFloorUnkeptNote(config);
|
|
29
75
|
if (note !== undefined)
|
|
30
|
-
logger.warn("read_deny_floor_required_unkept", { provider: config.remoteExec
|
|
76
|
+
logger.warn("read_deny_floor_required_unkept", { provider: config.remoteExec.provider, note });
|
|
31
77
|
}
|
|
32
78
|
export function assertExecutionLaneInvariants(config) {
|
|
33
79
|
const judge = (id) => crossInvariant(id).check({ live: config, next: config });
|
|
@@ -61,11 +107,12 @@ async function applyRemoteExecFile(config, ctx) {
|
|
|
61
107
|
}
|
|
62
108
|
if (!fileRx)
|
|
63
109
|
return;
|
|
64
|
-
const
|
|
65
|
-
const disclosePreemption = (winner) => {
|
|
110
|
+
const envDeclared = config.remoteExec?.provider;
|
|
111
|
+
const disclosePreemption = envDeclared === undefined ? (_winner) => { } : (winner) => {
|
|
112
|
+
const preemptedLane = envDeclared;
|
|
66
113
|
if (winner === preemptedLane)
|
|
67
114
|
return;
|
|
68
|
-
const downgrade = laneIsolated(preemptedLane) && !laneIsolated(winner);
|
|
115
|
+
const downgrade = laneIsolated(preemptedLane) && laneWiresExecutionEnv(winner) && !laneIsolated(winner);
|
|
69
116
|
logger.warn("remote_exec_lane_preempted_by_file", {
|
|
70
117
|
preemptedLane,
|
|
71
118
|
effectiveLane: winner,
|
|
@@ -76,7 +123,7 @@ async function applyRemoteExecFile(config, ctx) {
|
|
|
76
123
|
(downgrade ? `. This is an ISOLATION DOWNGRADE: tasks run on a non-isolated target. Delete/fix the file, or unset the lane env if the file is the intended source.` : `. Delete/fix the file, or unset the lane env if the file is the intended source.`),
|
|
77
124
|
});
|
|
78
125
|
};
|
|
79
|
-
const drives = (lane) => ctx.
|
|
126
|
+
const drives = (lane) => ctx.entry.runs.includes(lane);
|
|
80
127
|
if (fileRx.provider === "host" && drives("host")) {
|
|
81
128
|
config.remoteExec = {
|
|
82
129
|
provider: "host",
|
|
@@ -100,18 +147,25 @@ async function applyRemoteExecFile(config, ctx) {
|
|
|
100
147
|
logger.info("remote_exec_from_file", { provider: "local-docker", root: localRoot, image: fileRx.image });
|
|
101
148
|
return;
|
|
102
149
|
}
|
|
150
|
+
if (fileRx.provider === "none" && drives("none")) {
|
|
151
|
+
config.remoteExec = { provider: "none" };
|
|
152
|
+
disclosePreemption("none");
|
|
153
|
+
logger.info("remote_exec_from_file", { provider: "none", root: localRoot });
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
103
156
|
const fileLane = fileRx.provider;
|
|
104
|
-
|
|
157
|
+
if (!ctx.entry.runs.includes(fileLane))
|
|
158
|
+
throw new Error(entryCannotRunLaneRefusal(ctx.entry, fileLane, `config.d/remote-exec.json under ${localRoot}`));
|
|
159
|
+
if (envDeclared !== fileLane) {
|
|
160
|
+
const envReading = envDeclared === undefined ? "REMOTE_EXEC is not set" : `REMOTE_EXEC declares "${envDeclared}"`;
|
|
161
|
+
throw new Error(fileLaneUnresolvableRefusal(ctx.entry, fileLane, envReading, localRoot));
|
|
162
|
+
}
|
|
105
163
|
logger.warn("remote_exec_file_isolated_lane_unwired", {
|
|
106
164
|
provider: fileLane,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
`from the file; the HTTP service drives ${FILE_SOURCED_LANES.join(" / ")}) — the env-derived lane above stays in force`
|
|
112
|
-
: `this entry drives ${ctx.drivesFromFile.join(" / ")} from config.d/remote-exec.json; "${fileLane}" (like the other isolated lanes ` +
|
|
113
|
-
`e2b / k8s / ssh / adb) is sourced from REMOTE_EXEC env until file-source NAME→value resolution lands (center field map) — the ` +
|
|
114
|
-
`env-derived lane above stays in force`,
|
|
165
|
+
reason: "needs-name-resolution",
|
|
166
|
+
note: `config.d/remote-exec.json and REMOTE_EXEC both declare "${fileLane}": this entry takes ${FILE_SOURCED_LANES.filter((lane) => ctx.entry.runs.includes(lane)).join(" / ")} ` +
|
|
167
|
+
`from the file; "${fileLane}" (like the other isolated lanes e2b / k8s / ssh / adb) takes its coordinates from REMOTE_EXEC env until file-source NAME→value ` +
|
|
168
|
+
`resolution lands (center field map) — the coordinates written in the file for it are not read`,
|
|
115
169
|
});
|
|
116
170
|
}
|
|
117
171
|
//# sourceMappingURL=execution-lane.js.map
|
|
@@ -31,7 +31,7 @@ import type { Logger } from "../observability/logger.js";
|
|
|
31
31
|
*
|
|
32
32
|
* 一问一源:数与收读同一只 `includeRetained` 常量,core 的 `countRunningBackgroundShells` 与 `killAllBackgroundShellsNow` 又按同一只访问函数选行
|
|
33
33
|
* (core 注:the count and the walk cannot drift)⇒ 这只数就是硬收面会交出的 `killed` 收据数。
|
|
34
|
-
* **不是** `/health.inflightBreakdown.sessionResident`(`session-resident-background.ts`)
|
|
34
|
+
* **不是** `/health.inflightBreakdown.sessionResident`(`session-resident-background.ts`):那一项回答「引擎托管着多少会话驻留的 shell / monitor」,是总数里的一个分项 ——
|
|
35
35
|
* 只数围栏表里会话的、会话驻留的行(挂在 run 腿上的行算在 http 项里,数它是第二次;围栏外的会话它看不见);本函数整表数、不分会话,
|
|
36
36
|
* 腿上的行、围栏外会话的行都在内。两问的关系 = 读得出时本数 ≥ 驻留项(驻留项的每一行都是本数的一行)。
|
|
37
37
|
*
|
package/dist/boot/exit-last.js
CHANGED
|
@@ -2,6 +2,7 @@ import { existsSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { ENGINE_LANES } from "./engine-lease.js";
|
|
5
|
+
import { OWNER_ONLY_FILE_MODE } from "../plugins/owner-only-file-mode.js";
|
|
5
6
|
export const EXIT_LAST_FORMAT = 3;
|
|
6
7
|
const ExitLastSchema = z.object({
|
|
7
8
|
format: z.literal(EXIT_LAST_FORMAT),
|
|
@@ -22,7 +23,7 @@ export function exitLastPath(dataRoot) {
|
|
|
22
23
|
export function writeExitLast(dataRoot, info) {
|
|
23
24
|
try {
|
|
24
25
|
const body = { format: EXIT_LAST_FORMAT, at: new Date().toISOString(), pid: process.pid, ...info };
|
|
25
|
-
writeFileSync(exitLastPath(dataRoot), JSON.stringify(body) + "\n");
|
|
26
|
+
writeFileSync(exitLastPath(dataRoot), JSON.stringify(body) + "\n", { mode: OWNER_ONLY_FILE_MODE });
|
|
26
27
|
}
|
|
27
28
|
catch {
|
|
28
29
|
}
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
*
|
|
49
49
|
* ## 件D 的边界(成文,别读成「数据会被删」)
|
|
50
50
|
*
|
|
51
|
-
* 三只被托管的 SQL 店(session / checkpoint / tool-result)的 `retention` 声明读一个事实 —— 留存扫车道开不开(`plugins/retention-
|
|
51
|
+
* 三只被托管的 SQL 店(session / checkpoint / tool-result)的 `retention` 声明读一个事实 —— 留存扫车道开不开(`plugins/retention-declaration.ts` 的
|
|
52
52
|
* `retentionSweepRuns`):开 ⇒ `managed`,关(缺省)⇒ `none`;local 形的店恒声明 `none`。删除的执行面是扫车道(`boot/retention-lane.ts`)与 SQL 店上的
|
|
53
53
|
* 执行器,不在本装配点。所以本装配点对件D 只做两件事:①把策略与执行器递给 core 的启动期校验
|
|
54
54
|
* (`assertRetentionCapability` —— 配对由引擎一个判官判:店声明 `managed` 而部署不跑执行器、执行器不是执行器,锁不锁都拒;锁着 + 店不能删 ⇒ 拒启,
|
|
@@ -83,7 +83,7 @@ export interface GovernanceSeamsCtx {
|
|
|
83
83
|
/**
|
|
84
84
|
* 交给引擎启动检查的留存执行器 —— 本部署跑扫车道 ⇒ 那只执行器(`backend.retention`),不跑 ⇒ `null`(必填:漏递即编译红,
|
|
85
85
|
* 引擎对 `undefined` 也拒启)。「店说 managed」与「有执行器」的配对由引擎一个判官判(引擎 7.58.0:锁不锁都判);
|
|
86
|
-
* 店的词与这一格读同一个事实(`retention-
|
|
86
|
+
* 店的词与这一格读同一个事实(`retention-declaration.ts` 的 `retentionSweepRuns`),本仓不再另判一遍。
|
|
87
87
|
*/
|
|
88
88
|
retentionExecutor: ManagedRetentionCapability | null;
|
|
89
89
|
}
|
package/dist/boot/leader.js
CHANGED
|
@@ -34,7 +34,7 @@ export function createLeaderFace(ctx) {
|
|
|
34
34
|
},
|
|
35
35
|
}
|
|
36
36
|
: {};
|
|
37
|
-
const leaderProvider = config.remoteExec
|
|
37
|
+
const leaderProvider = config.remoteExec.provider;
|
|
38
38
|
const leaderRunStore = ctx.backend?.leaderRun?.();
|
|
39
39
|
assertLeaderDurableStore(config.leaderEnabled, leaderRunStore !== undefined);
|
|
40
40
|
const minioGap = leaderK8sMinioGap(config.leaderEnabled, leaderProvider, "s3" in leaderMinio);
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* 这条链**结构上**走不通」——那句必须说出来。围栏根算不出来时**不说话**(判不了就闭嘴,别把猜测当告警)。
|
|
15
15
|
*
|
|
16
16
|
* 🔴 **已登记的判据限度(不在本批射程,别把它读成「判据已闭合」)**:② 号 warn 今天唯一算得出围栏根的
|
|
17
|
-
*
|
|
17
|
+
* 腿是无手的 `none` 形(`boot/stores.ts` 的 `containmentRoots`),而**恰恰是这条腿
|
|
18
18
|
* 没有文件工具** —— 亲读装的这台 core:`prepare-execution-env.js` 的
|
|
19
|
-
* `handsEnabled = ownedEnv !== undefined || deps.executionEnv !== undefined
|
|
19
|
+
* `handsEnabled = ownedEnv !== undefined || deps.executionEnv !== undefined`,`REMOTE_EXEC=none` 时
|
|
20
20
|
* `executionEnvFactory` 恒 `undefined` ⇒ `handsEnabled=false` ⇒ `prepareHandsMount` 整个不跑。所以这条
|
|
21
21
|
* warn 描述的失败形(「模型照提示词去 Write,拿回 `path_not_in_root`」)在该腿上并不成立:真相是**一只
|
|
22
22
|
* 文件工具都没有**,而按它给的第一条恢复路径(把根挪进 workspace)会让 warn 闭嘴却仍然写不成。
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
* `TaskSpec.memoryPersistenceCapable` 一条路进去(`boot/resolve-spec.ts` 直通),我方显式**不铸**受限会话、
|
|
55
55
|
* 也**不投**这个读面(硬造一个消费点 = 造给自己看的 wire 键)。哪天真要在诊断面露它,先有消费方需求。
|
|
56
56
|
*/
|
|
57
|
-
import { type ExecutionLane
|
|
57
|
+
import { type ExecutionLane } from "../execution-lane-caps.js";
|
|
58
58
|
import type { MemoryEngineBackend } from "@sema-agent/settings-schema/execution-lanes";
|
|
59
59
|
/** boot 期可知的全部事实。每一位都必须由调用点从真配置/真装配结果取,禁在本模块内重算(重算=第二真源)。 */
|
|
60
60
|
export interface MemoryWriteBoundaryFacts {
|
|
@@ -66,9 +66,9 @@ export interface MemoryWriteBoundaryFacts {
|
|
|
66
66
|
* core 7.16.0([ref])之后写家还要再深一层(`<平面>/<label>`),但 label 归引擎注册簿,boot 期说不出口;
|
|
67
67
|
* 平面是**包含关系上等价**的那一只(家恒为平面的直接子目录),所以判据停在平面,不猜 label。 */
|
|
68
68
|
memoryRoot: string | undefined;
|
|
69
|
-
/** 执行车道名,只进文案(
|
|
69
|
+
/** 执行车道名,只进文案(已合成配置上的车道词,直读)。 */
|
|
70
70
|
lane: ExecutionLane;
|
|
71
|
-
/** 该车道的路径是不是本机的文件(执行环境块 `hostLocalPaths
|
|
71
|
+
/** 该车道的路径是不是本机的文件(执行环境块 `hostLocalPaths`:`none` 的桩块 / `REMOTE_EXEC=host` 为真)。false = 沙箱 / 远端 / 设备盘,
|
|
72
72
|
* 与记忆根分平面 —— 引擎在这一形上不教 `# Memory` 写指令(除非部署声明 `memoryPersistenceCapable: true`),判的是同一键。 */
|
|
73
73
|
hostSemanticsLane: boolean;
|
|
74
74
|
/** 部署声明 `MEMORY_PERSISTENCE_CAPABLE`(三态)。两极都让本模块闭嘴,但理由不同 —— 见各臂注释。 */
|
|
@@ -84,16 +84,16 @@ export interface MemoryWriteBoundaryFacts {
|
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
* 审计的**车道三位**由本函数派生(boot/stores.ts 的装配点只调它,不就地手写):
|
|
87
|
-
* · `lane` ⇐
|
|
87
|
+
* · `lane` ⇐ 已合成配置上的车道词;
|
|
88
88
|
* · `hostSemanticsLane` ⇐ 执行环境块 `hostLocalPaths`(唯一作者 `capabilitiesFor`;引擎撤不撤写指令读的是同一键);
|
|
89
|
-
* · `containmentRoots` ⇐
|
|
89
|
+
* · `containmentRoots` ⇐ 只有无手车道(`none`)给得出(见下)。
|
|
90
90
|
* `processCwd` 由调用点传(stores 传 `process.cwd()`),本函数保持纯。
|
|
91
91
|
*/
|
|
92
92
|
export declare function buildMemoryBoundaryLaneFacts(config: {
|
|
93
|
-
readonly remoteExec
|
|
94
|
-
readonly provider:
|
|
93
|
+
readonly remoteExec: {
|
|
94
|
+
readonly provider: ExecutionLane;
|
|
95
95
|
readonly s3Snapshot?: unknown;
|
|
96
|
-
}
|
|
96
|
+
};
|
|
97
97
|
}, processCwd: string): Pick<MemoryWriteBoundaryFacts, "lane" | "hostSemanticsLane" | "containmentRoots">;
|
|
98
98
|
/** 一条启动告警:`tag` 进日志事件名(可被运维按名过滤/告警),`detail` 是给人读的整句(含恢复路径)。 */
|
|
99
99
|
export interface MemoryWriteBoundaryWarning {
|
|
@@ -106,7 +106,7 @@ export interface MemoryWriteBoundaryWarning {
|
|
|
106
106
|
* ① **路径不是本机的车道**(块 `hostLocalPaths` 为假:沙箱 / 远端 / 设备;记忆引擎在这里只可能因为 `MEMORY_ENGINE_REMOTE_LANE=allow`
|
|
107
107
|
* 或 DB 记忆面才在):引擎不教 `# Memory` 写指令(手带够不着本机的记忆根),官方恢复路径是声明 `memoryPersistenceCapable: true`。
|
|
108
108
|
* 未声明 ⇒ 点名 warn,把恢复旋钮写进句子里。
|
|
109
|
-
* ② **路径是本机的车道**(
|
|
109
|
+
* ② **路径是本机的车道**(none / host):记忆根不在任何一个已知围栏根内 ⇒ 模型被教着往一个 fs 工具够不到的路径写。
|
|
110
110
|
*
|
|
111
111
|
* 两极声明都让本模块闭嘴,但理由不同,别合并:
|
|
112
112
|
* · `true` = operator 自证有推断看不见的持久通道(共享挂载 / 自定义 writer),我们的结构判断本就不该
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
|
-
import { capabilitiesFor
|
|
2
|
+
import { capabilitiesFor } from "../execution-lane-caps.js";
|
|
3
3
|
export function buildMemoryBoundaryLaneFacts(config, processCwd) {
|
|
4
|
-
const lane =
|
|
4
|
+
const lane = config.remoteExec.provider;
|
|
5
5
|
return {
|
|
6
6
|
lane,
|
|
7
7
|
hostSemanticsLane: capabilitiesFor(config).hostLocalPaths,
|
|
8
|
-
containmentRoots:
|
|
8
|
+
containmentRoots: capabilitiesFor(config).io ? [] : [processCwd],
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
function isInside(child, root) {
|
|
@@ -13,7 +13,7 @@ type ConsolidationSeatOptions = ReturnType<typeof resolveMemoryConsolidationDriv
|
|
|
13
13
|
/** D3 投影的座标签闭集。`role:<name>` 里的 name 只可能是 core 的 role 链两跳之一。 */
|
|
14
14
|
export type ConsolidationSeatLabel = "explicit" | "role:consolidate" | "role:summarize";
|
|
15
15
|
/** {@link buildConsolidationValveAudit} 的告警名闭集(事件名进日志 ⇒ 运维可按名过滤/告警)。 */
|
|
16
|
-
export type ConsolidationValveWarningTag = "
|
|
16
|
+
export type ConsolidationValveWarningTag = "memory_consolidation_run_credential_gated";
|
|
17
17
|
/** {@link resolveConsolidationValve} 的起服提示名闭集([ref] / [ref];事件名进日志 ⇒ 运维可按名过滤/告警)。 */
|
|
18
18
|
export type ConsolidationValveNoticeTag = "memory_consolidation_default_off_no_cheap_model" | "memory_consolidation_on_main_model";
|
|
19
19
|
/**
|
|
@@ -301,38 +301,27 @@ export declare function judgeConsolidationValve(input: ConsolidationValveInput):
|
|
|
301
301
|
unwirable: Parameters<typeof resolveConsolidationValve>[0]["unwirable"];
|
|
302
302
|
};
|
|
303
303
|
/**
|
|
304
|
-
*
|
|
304
|
+
* 阀门上了场之后的**可达性**告警(自查 + codex 交叉复审;姿态=warn 不拒启)。
|
|
305
305
|
*
|
|
306
|
-
* ##
|
|
306
|
+
* ## 「没有运维」那一条为什么不在这里了
|
|
307
307
|
*
|
|
308
|
-
*
|
|
309
|
-
* (
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
* ## 为什么是 warn 而不是拒启(与 D1 的三条拒启臂**刻意不同档**)
|
|
315
|
-
*
|
|
316
|
-
* `OPERATOR_PRINCIPALS` 是**跨面共用**的部署级旋钮(adoption / retention-ops / memory-bundle /
|
|
317
|
-
* memory-compliance / admin-drain 全在同一张名单上)。为一条阀门拒掉整台机器,比这条阀门本身的价值重;
|
|
318
|
-
* 而那三条拒启臂拒的是「这台机器**结构上**跑不了这件事」(没有库 / 账会丢 / 折叠法铸不出标记),
|
|
319
|
-
* 本条拒的是「配齐了但没人够得着」——后者是一次**配置遗漏**,补一行 env 即可,不该要一次重启失败来教。
|
|
320
|
-
* 同族先例逐字:`permission_rules_lane_unavailable`(旋钮开着却上不了场 ⇒ 打一行,不拒启)。
|
|
321
|
-
* 反过来说,**沉默**同样不行:那正是「设了但没生效」病族,而这一形连能力位都是诚实的假,唯一缺的
|
|
322
|
-
* 就是一句把因果说清楚的话。
|
|
308
|
+
* 曾经还有一条「阀门够不着」告警(事件名已删,不再出现在日志里):阀门开着、两口挂着,而这台部署没有运维名册 ⇒ 两口对谁都 501。
|
|
309
|
+
* 它的在场条件今天在服务腿上不可达,前提链三环:① 显式开得起来的阀门要 file 记忆后端(SQL 两只孪生不发布控制面 ⇒ 第 4 段的
|
|
310
|
+
* {@link assertConsolidationDriverWirable} 拒启),而 file 记忆引擎只在单用户形上装配(`fileMemoryPlaneFor`);② 单用户形过了起服第 1 段就一定有运维
|
|
311
|
+
* (不变量 `operator-declaration-required`:`OPERATOR_SINGLE_USER=true` 或具名名单,都没有 ⇒ 第 1 段早拒;装运维面的兜底座 `createHttpServer` 同判);
|
|
312
|
+
* ③ 本函数的唯一调用点在服务腿第 6 段。读一个不可能状态的告警是死臂,随那条不变量一起退役(钉:`test/operator-declaration-required.test.ts` ⑥,
|
|
313
|
+
* 前提链每环一格,任何一环将来不成立 ⇒ 那一格红)。
|
|
323
314
|
*
|
|
324
315
|
* ## 只审**显式**开的阀门([ref] / [ref] 起)
|
|
325
316
|
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
317
|
+
* 告警的前提是「运维**显式**拧了 on」——它是一次**表态**够不着的诊断。出厂缺省**派生**开的那台(配了便宜模型的单用户部署)
|
|
318
|
+
* 没有表态可审:引擎面的自动整理照跑(不走手动口),手动口是一件它没要过的东西。照审的后果是每一台这样的部署升级后每次起服
|
|
319
|
+
* 多一行 warn,点名一根它从没设过的 `MEMORY_CONSOLIDATION_DRIVER=on`,教它去配一个它不需要的操作面。判据读阀门判决的 `source`,
|
|
320
|
+
* 不读表态原词(判决是阀门开关的唯一属主)。
|
|
330
321
|
*/
|
|
331
322
|
export declare function buildConsolidationValveAudit(input: {
|
|
332
323
|
/** 阀门判决({@link resolveConsolidationValve} 的 `enabled` + `source`)。 */
|
|
333
324
|
valve: Pick<ConsolidationValve, "enabled" | "source">;
|
|
334
|
-
/** 这台部署有没有运维名册(`operatorRosterPresent`:名单非空 ∨ 单用户声明)—— 判据不在本函数里另写一份。 */
|
|
335
|
-
operatorRosterPresent: boolean;
|
|
336
325
|
/** 这台部署配了任何一把 service 凭证吗(`config.authToken` 或 `config.authTokens` 非空)。 */
|
|
337
326
|
hasServiceAuth: boolean;
|
|
338
327
|
/** 本地开发的显式逃生口(`ALLOW_UNAUTHED_WRITES=true`)。 */
|