@sema-agent/server 7.149.0 → 7.151.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 +307 -9
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/USAGE.md +92 -40
- package/deploy/sema-up/README.md +7 -1
- package/deploy/sema-up/chart/Chart.yaml +1 -1
- package/deploy/sema-up/chart/templates/NOTES.txt +5 -0
- package/deploy/sema-up/chart/templates/_helpers.tpl +15 -16
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -3
- package/deploy/sema-up/chart/templates/server.yaml +5 -3
- package/deploy/sema-up/chart/values-full-single.yaml +3 -1
- package/deploy/sema-up/chart/values.yaml +8 -1
- package/deploy/sema-up/cluster-up.sh +1 -0
- package/deploy/sema-up/kube-up.sh +1 -1
- package/deploy/sema-up/lib/flagshape.sh +1 -1
- package/deploy/sema-up/lib/helm-values-cluster.py +2 -0
- package/deploy/sema-up/lib/helm-values-kube.py +2 -0
- package/dist/adoption/import.js +3 -3
- package/dist/approval-ask-machine.d.ts +1 -1
- package/dist/approval-card.d.ts +3 -3
- package/dist/approval-gate-currency.d.ts +2 -2
- package/dist/audit.d.ts +1 -1
- package/dist/audit.js +2 -2
- package/dist/auth-bridge.d.ts +20 -0
- package/dist/auth-bridge.js +9 -0
- package/dist/background-session-reap.d.ts +2 -2
- package/dist/bake-runner/main.d.ts +4 -2
- package/dist/bind-host.d.ts +2 -3
- package/dist/bind-host.js +2 -4
- package/dist/boot/budget-tracing.js +1 -1
- package/dist/boot/deferred-sandbox-path-env.d.ts +5 -3
- package/dist/boot/deferred-sandbox-path-env.js +1 -2
- package/dist/boot/engine-lease.d.ts +5 -0
- package/dist/boot/engine-lease.js +1 -0
- package/dist/boot/execution-env.d.ts +8 -14
- package/dist/boot/execution-env.js +54 -17
- package/dist/boot/execution-lane.js +32 -5
- package/dist/boot/late-binds.d.ts +8 -4
- package/dist/boot/late-binds.js +7 -1
- package/dist/boot/memory-consolidation.d.ts +3 -2
- package/dist/boot/memory-consolidation.js +6 -6
- package/dist/boot/parked-revive-gate.d.ts +5 -5
- package/dist/boot/parked-revive-gate.js +2 -3
- package/dist/boot/reapers.d.ts +5 -0
- package/dist/boot/reapers.js +12 -1
- package/dist/boot/resolve-spec.d.ts +7 -8
- package/dist/boot/resolve-spec.js +80 -35
- package/dist/boot/retention-lane.d.ts +1 -1
- package/dist/boot/runner-deps.d.ts +9 -2
- package/dist/boot/runner-deps.js +3 -3
- package/dist/boot/session-age-out.d.ts +36 -0
- package/dist/boot/session-age-out.js +101 -0
- package/dist/boot/session-faces.d.ts +5 -14
- package/dist/boot/session-faces.js +28 -24
- package/dist/boot/stage-01-config.js +2 -0
- package/dist/boot/stage-03-store-backend.js +2 -2
- package/dist/boot/stage-05-execution-env.d.ts +5 -3
- package/dist/boot/stage-05-execution-env.js +2 -2
- package/dist/boot/stage-06-runners.d.ts +7 -4
- package/dist/boot/stage-06-runners.js +16 -8
- package/dist/boot/stage-07-capability-layer.d.ts +7 -4
- package/dist/boot/stage-07-capability-layer.js +3 -2
- package/dist/boot/stage-08-reapers.d.ts +7 -4
- package/dist/boot/stage-08-reapers.js +4 -2
- package/dist/boot/stage-09-leader.d.ts +11 -5
- package/dist/boot/stage-09-leader.js +12 -3
- package/dist/boot/stage-10-http-server.d.ts +44 -6
- package/dist/boot/stage-10-http-server.js +12 -10
- package/dist/boot/web-admin.d.ts +1 -1
- package/dist/boot/web-admin.js +3 -1
- package/dist/boot/workflow-orchestration.d.ts +7 -2
- package/dist/boot/workflow-orchestration.js +24 -7
- package/dist/bounded-rotation.d.ts +29 -0
- package/dist/bounded-rotation.js +24 -0
- package/dist/capability-facts.d.ts +84 -66
- package/dist/capability-facts.js +58 -41
- package/dist/center-credential.d.ts +25 -6
- package/dist/center-credential.js +25 -5
- package/dist/config-catalog.d.ts +26 -7
- package/dist/config-catalog.js +15 -12
- package/dist/config-invariants.d.ts +2 -1
- package/dist/config-invariants.js +4 -4
- package/dist/config-types.d.ts +22 -15
- package/dist/config.d.ts +51 -2
- package/dist/config.js +35 -24
- package/dist/deployment-governance.d.ts +7 -28
- package/dist/deployment-governance.js +1 -14
- package/dist/deployment-shape.d.ts +9 -1
- package/dist/deployment-shape.js +2 -1
- package/dist/device-protocol.d.ts +5 -4
- package/dist/device-protocol.js +1 -1
- package/dist/device-ws-hub.d.ts +1 -0
- package/dist/device-ws-hub.js +66 -29
- package/dist/device-ws-protocol.d.ts +79 -12
- package/dist/device-ws-protocol.js +64 -26
- package/dist/engine-identity.d.ts +23 -5
- package/dist/engine-identity.js +13 -0
- package/dist/entry-mode-clamp-notice.d.ts +2 -1
- package/dist/execution-env-refusal.d.ts +23 -0
- package/dist/execution-env-refusal.js +5 -0
- package/dist/execution-lane-caps.d.ts +3 -1
- package/dist/field-conflict.d.ts +3 -3
- package/dist/file-history-capture.d.ts +11 -4
- package/dist/file-history-capture.js +9 -6
- package/dist/file-history-disclosure.d.ts +7 -5
- package/dist/file-history-disclosure.js +7 -5
- package/dist/fleet/drain-entry.d.ts +4 -0
- package/dist/fleet/engine-signal.d.ts +14 -1
- package/dist/fleet/engine-signal.js +5 -1
- package/dist/fleet/fleet-reconciler.d.ts +1 -1
- package/dist/fleet/serving-lease.d.ts +18 -3
- package/dist/fleet/serving-lease.js +81 -35
- package/dist/fleet-client.d.ts +13 -11
- package/dist/fleet-client.js +53 -33
- package/dist/history-anchor.js +1 -1
- package/dist/hitl-delivery.d.ts +1 -3
- package/dist/hitl-delivery.js +1 -1
- package/dist/hooks/hook-runner.js +2 -2
- package/dist/host-lsp-manager.d.ts +2 -2
- package/dist/http/active-run-conflict.d.ts +3 -7
- package/dist/http/active-run-conflict.js +2 -2
- package/dist/http/admission.js +19 -4
- package/dist/http/approval-sweeps.js +7 -6
- package/dist/http/caller-trust.d.ts +2 -2
- package/dist/http/caller-trust.js +3 -3
- package/dist/http/checkpoint-ctx.d.ts +20 -63
- package/dist/http/checkpoint-ctx.js +2 -24
- package/dist/http/claim-heartbeat.d.ts +4 -4
- package/dist/http/claim-heartbeat.js +3 -3
- package/dist/http/dispatch.d.ts +2 -1
- package/dist/http/dispatch.js +36 -29
- package/dist/http/durable-run-leg.js +17 -17
- package/dist/http/health-self-report.d.ts +9 -1
- package/dist/http/health-self-report.js +2 -0
- package/dist/http/owner-access.d.ts +264 -20
- package/dist/http/owner-access.js +215 -5
- package/dist/http/readiness.d.ts +4 -2
- package/dist/http/resume-ctx-read.js +38 -1
- package/dist/http/resume-legs.d.ts +2 -1
- package/dist/http/resume-legs.js +273 -89
- package/dist/http/route-ctx.d.ts +41 -19
- package/dist/http/route-table.d.ts +1 -1
- package/dist/http/routes/a2a-serve.js +15 -14
- package/dist/http/routes/admin-memory-optout.d.ts +1 -1
- package/dist/http/routes/agents-roster.js +2 -3
- package/dist/http/routes/approvals-assistant.d.ts +3 -2
- package/dist/http/routes/approvals-assistant.js +12 -12
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/capabilities.js +10 -6
- package/dist/http/routes/config-catalog.d.ts +1 -1
- package/dist/http/routes/fleet.js +10 -8
- package/dist/http/routes/mcp-reconnect.js +2 -2
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/notify-wake.js +2 -3
- package/dist/http/routes/projects.d.ts +4 -2
- package/dist/http/routes/projects.js +7 -6
- package/dist/http/routes/retention-ops.d.ts +1 -1
- package/dist/http/routes/run-permission-mode.d.ts +1 -1
- package/dist/http/routes/run-permission-mode.js +2 -2
- package/dist/http/routes/runs.d.ts +1 -1
- package/dist/http/routes/runs.js +125 -66
- package/dist/http/routes/session-memory-sync.js +4 -5
- package/dist/http/routes/session-sync.d.ts +4 -3
- package/dist/http/routes/session-sync.js +174 -83
- package/dist/http/routes/sessions-list.js +13 -7
- package/dist/http/routes/sessions.d.ts +1 -1
- package/dist/http/routes/sessions.js +26 -48
- package/dist/http/routes/tasks.js +38 -23
- package/dist/http/routes/trace-usage.js +14 -14
- package/dist/http/routes/workflows.d.ts +1 -0
- package/dist/http/routes/workflows.js +20 -38
- package/dist/http/server.d.ts +28 -30
- package/dist/http/server.js +7 -3
- package/dist/http/stored-body-replay.d.ts +3 -24
- package/dist/http/stored-body-replay.js +2 -12
- package/dist/http/submit-ctx.d.ts +1 -2
- package/dist/http/submit-ctx.js +8 -6
- package/dist/http/submit-replay.d.ts +15 -2
- package/dist/http/submit-replay.js +10 -4
- package/dist/http/wire-types.d.ts +19 -6
- package/dist/identity-source.d.ts +20 -3
- package/dist/identity-source.js +14 -0
- package/dist/index.d.ts +4 -0
- package/dist/lane-home-probe.d.ts +3 -7
- package/dist/lane-home-probe.js +0 -1
- package/dist/leader/endpoint.js +9 -8
- package/dist/leader/leader.d.ts +2 -1
- package/dist/leg-facts.d.ts +19 -5
- package/dist/leg-facts.js +3 -1
- package/dist/mcp-authorization-face.d.ts +18 -14
- package/dist/mcp-authorization-face.js +3 -2
- package/dist/memory-scope.d.ts +5 -4
- package/dist/memory-scope.js +4 -4
- package/dist/memory-store-refusal.d.ts +1 -1
- package/dist/memory-sync-client.d.ts +30 -2
- package/dist/memory-sync-client.js +16 -9
- package/dist/observability/corrupt-read-seat.d.ts +1 -1
- package/dist/observability/err-text.d.ts +7 -0
- package/dist/observability/err-text.js +5 -0
- package/dist/observability/fail-open.d.ts +12 -8
- package/dist/observability/fail-open.js +12 -8
- package/dist/observability/logger.d.ts +7 -0
- package/dist/observability/logger.js +3 -1
- package/dist/observability/metrics.js +1 -0
- package/dist/observability/run-terminal.d.ts +1 -1
- package/dist/orchestration/workflow-notify-journal.d.ts +18 -1
- package/dist/orchestration/workflow-notify-journal.js +12 -1
- package/dist/orchestration/workflow-park-decision.d.ts +70 -18
- package/dist/orchestration/workflow-park-decision.js +49 -10
- package/dist/orchestration/workflow-park-holder.d.ts +65 -0
- package/dist/orchestration/workflow-park-holder.js +98 -0
- package/dist/orchestration/workflow-record-fence.d.ts +36 -0
- package/dist/orchestration/workflow-record-fence.js +42 -0
- package/dist/owner-faces.d.ts +28 -4
- package/dist/owner-faces.js +2 -0
- package/dist/parked-decide.d.ts +104 -53
- package/dist/parked-decide.js +153 -117
- package/dist/peer-directory.d.ts +2 -2
- package/dist/peer-inbound-face.d.ts +2 -6
- package/dist/peer-inbound-face.js +0 -3
- package/dist/peer-seat.d.ts +1 -1
- package/dist/peer-seat.js +52 -59
- package/dist/permission-mode-admission.d.ts +41 -5
- package/dist/permission-mode-admission.js +29 -3
- package/dist/plugins/adoption-log-sql.d.ts +3 -1
- package/dist/plugins/adoption-log-sql.js +7 -1
- package/dist/plugins/approval-ask-store-file.d.ts +10 -2
- package/dist/plugins/approval-ask-store-file.js +8 -0
- package/dist/plugins/approval-ask-store-memory.d.ts +6 -1
- package/dist/plugins/approval-ask-store-memory.js +28 -9
- package/dist/plugins/approval-ask-store-sql.d.ts +43 -2
- package/dist/plugins/approval-ask-store-sql.js +34 -5
- package/dist/plugins/approval-exemption-store.js +3 -0
- package/dist/plugins/approval-nonce-store.js +2 -0
- package/dist/plugins/breaker-state-sql.js +2 -0
- package/dist/plugins/caching-session-store.d.ts +9 -15
- package/dist/plugins/caching-session-store.js +6 -0
- package/dist/plugins/device-store-sql.js +6 -0
- package/dist/plugins/error-origin.d.ts +18 -0
- package/dist/plugins/error-origin.js +10 -0
- package/dist/plugins/exec-path-law.d.ts +34 -0
- package/dist/plugins/exec-path-law.js +13 -0
- package/dist/plugins/execution-placement-sql.js +6 -6
- package/dist/plugins/file-run-store.js +1 -1
- package/dist/plugins/image-bake-store-sql.js +6 -0
- package/dist/plugins/image-index-sql.js +4 -0
- package/dist/plugins/landed-attendants.d.ts +212 -0
- package/dist/plugins/landed-attendants.js +161 -0
- package/dist/plugins/leader-run-store-sql.js +4 -0
- package/dist/plugins/local-checkpoint-store.d.ts +4 -1
- package/dist/plugins/local-checkpoint-store.js +3 -0
- package/dist/plugins/local-session-live-reference.d.ts +40 -0
- package/dist/plugins/local-session-live-reference.js +39 -0
- package/dist/plugins/local-session-store.d.ts +71 -33
- package/dist/plugins/local-session-store.js +129 -27
- package/dist/plugins/memory-engine-pg.js +4 -0
- package/dist/plugins/memory-engine-sql-apply.js +5 -2
- package/dist/plugins/memory-engine-tidb.js +4 -0
- package/dist/plugins/memory-optout-grant-store-sql.js +4 -0
- package/dist/plugins/memory-run-store.js +1 -1
- package/dist/plugins/memory-sync-store-pg.js +5 -0
- package/dist/plugins/memory-sync-store-tidb.js +5 -0
- package/dist/plugins/one-time-migrations.d.ts +80 -61
- package/dist/plugins/one-time-migrations.js +241 -104
- package/dist/plugins/org-delivery-quota-store.js +4 -1
- package/dist/plugins/outcome-ledger-sql.js +2 -0
- package/dist/plugins/permission-rule-store-sql.js +11 -4
- package/dist/plugins/pg-cost-quota.js +4 -0
- package/dist/plugins/pg-pool.js +28 -1
- package/dist/plugins/pg-rate-limiter.js +2 -0
- package/dist/plugins/posix-shell-fs.d.ts +6 -1
- package/dist/plugins/posix-shell-fs.js +8 -3
- package/dist/plugins/remote-env-adb.d.ts +19 -15
- package/dist/plugins/remote-env-adb.js +44 -17
- package/dist/plugins/remote-env-connect-seat.d.ts +105 -0
- package/dist/plugins/remote-env-connect-seat.js +72 -0
- package/dist/plugins/remote-env-device.d.ts +22 -5
- package/dist/plugins/remote-env-device.js +114 -14
- package/dist/plugins/remote-env-e2b.d.ts +18 -7
- package/dist/plugins/remote-env-e2b.js +53 -40
- package/dist/plugins/remote-env-file-error.js +6 -2
- package/dist/plugins/remote-env-host.d.ts +18 -1
- package/dist/plugins/remote-env-host.js +48 -47
- package/dist/plugins/remote-env-k8s.d.ts +41 -39
- package/dist/plugins/remote-env-k8s.js +56 -32
- package/dist/plugins/remote-env-local-docker.d.ts +13 -8
- package/dist/plugins/remote-env-local-docker.js +37 -43
- package/dist/plugins/remote-env-ssh.d.ts +18 -12
- package/dist/plugins/remote-env-ssh.js +64 -62
- package/dist/plugins/remote-shell.d.ts +101 -2
- package/dist/plugins/remote-shell.js +221 -3
- package/dist/plugins/replica-registration.d.ts +35 -0
- package/dist/plugins/replica-registration.js +48 -0
- package/dist/plugins/resume-anchor-store-sql.d.ts +11 -2
- package/dist/plugins/resume-anchor-store-sql.js +12 -5
- package/dist/plugins/retention-lane-store-sql.d.ts +1 -1
- package/dist/plugins/retention-lane-store-sql.js +4 -0
- package/dist/plugins/retention-sql.d.ts +20 -2
- package/dist/plugins/retention-sql.js +11 -0
- package/dist/plugins/run-store-sql.d.ts +22 -3
- package/dist/plugins/run-store-sql.js +33 -9
- package/dist/plugins/scenario-prefix-switch-m42.d.ts +6 -12
- package/dist/plugins/scenario-prefix-switch-m42.js +7 -5
- package/dist/plugins/schema-consistency.d.ts +9 -5
- package/dist/plugins/schema-consistency.js +48 -18
- package/dist/plugins/schema-drift-sentence.js +1 -1
- package/dist/plugins/send-file-ledger.js +3 -0
- package/dist/plugins/serving-requirement.d.ts +68 -0
- package/dist/plugins/serving-requirement.js +60 -0
- package/dist/plugins/session-birth.d.ts +6 -2
- package/dist/plugins/session-capture-record-store-sql.js +2 -0
- package/dist/plugins/session-ext-table.d.ts +14 -1
- package/dist/plugins/session-ext-table.js +5 -1
- package/dist/plugins/session-row-sql.d.ts +49 -2
- package/dist/plugins/session-row-sql.js +56 -13
- package/dist/plugins/session-store-sql.d.ts +34 -18
- package/dist/plugins/session-store-sql.js +98 -17
- package/dist/plugins/shared-memory-store-sql.d.ts +1 -0
- package/dist/plugins/shared-memory-store-sql.js +6 -2
- package/dist/plugins/sql-driver.d.ts +2 -1
- package/dist/plugins/sql-driver.js +18 -3
- package/dist/plugins/sql-errors.d.ts +11 -6
- package/dist/plugins/sql-errors.js +5 -6
- package/dist/plugins/stop-then-start-sentence.d.ts +48 -3
- package/dist/plugins/stop-then-start-sentence.js +48 -0
- package/dist/plugins/stop-then-start.d.ts +109 -0
- package/dist/plugins/stop-then-start.js +104 -0
- package/dist/plugins/store-backend.d.ts +40 -13
- package/dist/plugins/store-backend.js +169 -27
- package/dist/plugins/store-boundary.d.ts +57 -0
- package/dist/plugins/store-boundary.js +139 -0
- package/dist/plugins/store-contracts.d.ts +29 -2
- package/dist/plugins/store-contracts.js +3 -0
- package/dist/plugins/store-fault-sentence-m53.d.ts +7 -0
- package/dist/plugins/store-fault-sentence-m53.js +25 -0
- package/dist/plugins/store-fault.d.ts +26 -7
- package/dist/plugins/store-fault.js +18 -2
- package/dist/plugins/task-attachment-store.js +9 -0
- package/dist/plugins/task-list-store-sql.d.ts +2 -2
- package/dist/plugins/task-list-store-sql.js +10 -8
- package/dist/plugins/tidb-cost-quota.js +4 -0
- package/dist/plugins/tidb-pool.js +6 -1
- package/dist/plugins/tidb-rate-limiter.js +4 -0
- package/dist/plugins/user-input-ledger-sql.js +4 -0
- package/dist/plugins/workflow-run-store-sql.d.ts +28 -10
- package/dist/plugins/workflow-run-store-sql.js +64 -4
- package/dist/plugins/workspace-fill.d.ts +4 -7
- package/dist/plugins/workspace-fill.js +2 -1
- package/dist/plugins/write-behind-counter.js +5 -0
- package/dist/process-instance.d.ts +3 -0
- package/dist/process-instance.js +7 -0
- package/dist/project-context.d.ts +64 -0
- package/dist/project-context.js +66 -0
- package/dist/project-registry.d.ts +46 -0
- package/dist/project-registry.js +44 -0
- package/dist/question.d.ts +9 -21
- package/dist/question.js +28 -19
- package/dist/request-key-closure.js +1 -1
- package/dist/request-value-closure.d.ts +4 -0
- package/dist/request-value-closure.js +10 -0
- package/dist/run-acceptance.d.ts +3 -2
- package/dist/run-acceptance.js +4 -6
- package/dist/run-cancel-card.d.ts +1 -1
- package/dist/run-cancel-card.js +2 -1
- package/dist/run-local.js +1 -0
- package/dist/runs.d.ts +37 -8
- package/dist/runs.js +53 -12
- package/dist/runtime-governance.d.ts +5 -4
- package/dist/security.d.ts +31 -33
- package/dist/security.js +41 -7
- package/dist/server-secret-env.d.ts +12 -10
- package/dist/server-secret-env.js +24 -15
- package/dist/session-agent.d.ts +1 -10
- package/dist/session-agent.js +0 -6
- package/dist/session-bindings.d.ts +82 -0
- package/dist/session-bindings.js +18 -0
- package/dist/session-children-retire.d.ts +2 -2
- package/dist/session-children-retire.js +2 -6
- package/dist/session-deletion.d.ts +16 -1
- package/dist/session-error-wire.d.ts +3 -3
- package/dist/session-error-wire.js +3 -3
- package/dist/session-incarnation.d.ts +28 -4
- package/dist/session-incarnation.js +14 -2
- package/dist/session-kind.d.ts +57 -0
- package/dist/session-kind.js +22 -0
- package/dist/session-notify-door.d.ts +4 -4
- package/dist/session-notify-door.js +5 -6
- package/dist/session-row.d.ts +21 -1
- package/dist/session-row.js +7 -1
- package/dist/session-rules-seat.d.ts +4 -3
- package/dist/session-rules-seat.js +3 -11
- package/dist/session-sync-kernel.d.ts +24 -14
- package/dist/session-sync-kernel.js +3 -6
- package/dist/session-sync.d.ts +4 -98
- package/dist/session-sync.js +4 -74
- package/dist/session-titler.d.ts +10 -3
- package/dist/session-titler.js +19 -6
- package/dist/ssh-host-key.d.ts +5 -0
- package/dist/ssh-host-key.js +3 -0
- package/dist/stores-sql/checkpoint-store-sql.d.ts +21 -2
- package/dist/stores-sql/checkpoint-store-sql.js +106 -18
- package/dist/stores-sql/file-history-store-sql.d.ts +52 -2
- package/dist/stores-sql/file-history-store-sql.js +108 -70
- package/dist/stores-sql/pg-session-storage.d.ts +34 -7
- package/dist/stores-sql/pg-session-storage.js +37 -13
- package/dist/stores-sql/retention-store-sql.d.ts +2 -10
- package/dist/stores-sql/retention-store-sql.js +2 -10
- package/dist/stores-sql/session-policy-store-sql.d.ts +30 -7
- package/dist/stores-sql/session-policy-store-sql.js +61 -44
- package/dist/stores-sql/session-write-hooks.d.ts +11 -0
- package/dist/stores-sql/tidb-session-store.d.ts +58 -7
- package/dist/stores-sql/tidb-session-store.js +37 -13
- package/dist/submission-exit.d.ts +3 -2
- package/dist/submission-exit.js +9 -1
- package/dist/task-cwd.d.ts +6 -5
- package/dist/task-settings.d.ts +19 -5
- package/dist/task-settings.js +13 -7
- package/dist/terminal.d.ts +33 -2
- package/dist/terminal.js +139 -9
- package/dist/tool-approval.d.ts +147 -12
- package/dist/tool-approval.js +206 -109
- package/dist/trace/engine-notice-wire.d.ts +14 -0
- package/dist/trace/engine-notice-wire.js +18 -1
- package/dist/trace/project.d.ts +4 -3
- package/dist/trace/project.js +3 -2
- package/dist/trace/projection-table.d.ts +33 -2
- package/dist/trace/self-minted-wire.d.ts +422 -26
- package/dist/trace/self-minted-wire.js +149 -23
- package/dist/trace/tool-card.d.ts +3 -0
- package/dist/trace/tool-card.js +24 -0
- package/dist/trace/tool-output-media.d.ts +2 -1
- package/dist/unattended-permission-mode.d.ts +1 -1
- package/dist/web-admin-client/apply-effective.d.ts +1 -1
- package/dist/web-admin-client/effective-keys.d.ts +1 -1
- package/dist/web-admin-client/skills-mcp.d.ts +1 -1
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +120 -41
- package/package.json +3 -3
- package/wire-changes/server@7.150.0.json +335 -0
- package/wire-changes/server@7.151.0.json +762 -0
- package/dist/http/session-inherit-env.d.ts +0 -36
- package/dist/http/session-inherit-env.js +0 -6
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **停-迁-起**(SQL 两方言;常设,不带窗)—— 一次性迁移登记表里每一条停-迁-起行的声明型、它唯一的判官、守卫段与证据读法。
|
|
3
|
+
*
|
|
4
|
+
* ## 它回答哪一问(只这一问)
|
|
5
|
+
* 「一只**已在服务**、不认迁移 M 的副本,在 M 之后写下的那一笔不兼容写,由谁挡?」—— 答案是一格闭集 {@link StopThenStartFence}(围栏类):
|
|
6
|
+
* · `structural` —— 库挡:M 的第一笔改动是 DDL(就地改名 / 删退役列 / 按建表语句重建),更早副本点名旧对象的每一句不兼容写当场失败(先围后搬);
|
|
7
|
+
* · `per-write` —— 写句挡:从 `fencedSince` 起的构建,点名的那几句写在同一句 / 同一事务里读起服要求行;`fencedSince` 严格早于 M 的引入版
|
|
8
|
+
* (逐写围栏只对带这段代码的构建生效,所以必须早至少一版装入);
|
|
9
|
+
* · `accepted` —— 没有人挡:`residual` 一句写明残余(MIGRATION 原样引),停光旧副本是唯一的补偿。
|
|
10
|
+
* 类取「从第一笔不兼容写起就成立」的那一种:晚于任何一笔搬运的 DDL 围栏不使本条成 `structural`;`per-write` 与 `structural` 同时成立 ⇒ 取 `structural`。
|
|
11
|
+
* **围栏类没有起服期的分臂**:三类在起服时同一只序 —— 守卫段读证据(有 ⇒ 拒)、各条在自己的第一笔不兼容写之前记一行起服要求(`serving-requirement.ts`)。
|
|
12
|
+
* 类只决定放行判据({@link judgeStopThenStart})、残余的披露与作者该选哪一形。
|
|
13
|
+
*
|
|
14
|
+
* ## 一份声明、一只判官
|
|
15
|
+
* 登记表(`one-time-migrations.ts` 的 `ONE_TIME_MIGRATIONS`)每一行**显式**写 `stopThenStart: StopThenStartRow | null`(缺键 = tsc 红,形门再红一次);
|
|
16
|
+
* `null` 只说「本条不声明停-迁-起」(不拒启、不进升级清单的停-迁-起一步),**不是**混跑安全的证明。判官只答「这份声明合不合本类的放行判据」;
|
|
17
|
+
* 读者两处:形门(全表,非空 ⇒ 红)与起服({@link assertStopThenStartDeclarations}:SQL 一次性迁移段**取连接之前**判本构建的每一条停-迁-起行,非空 ⇒ 抛构建缺陷,一句库语句都没发)。
|
|
18
|
+
*
|
|
19
|
+
* ## 守卫段在一切写之前
|
|
20
|
+
* {@link guardOwedStopThenStart} 在 SQL 一次性迁移段的锁内、准入复核之后、第一步迁移之前跑(`runSqlOneTimeMigrations`):按登记序逐条问「这只库还欠不欠」,
|
|
21
|
+
* 欠的读证据,任一有证据 ⇒ 抛那一条自己的拒(码与句是那一条的)—— 迁移段一字节没写,各拒句里的「Nothing was changed」由构造成立。迁移步里不再读证据。
|
|
22
|
+
*
|
|
23
|
+
* ## 证据读法(常设)
|
|
24
|
+
* {@link readOlderReplicaEvidence}:判活窗内心跳过的 `running` run(谓词 = run 店的 `runningHeartbeatPredicate` 的 `live` 一侧,与死亡判决同一只构造、同一个窗),
|
|
25
|
+
* 按持有者分组,减去登记为知道 M 的持有者(`replica-registration.ts`)。早于副本登记的副本不登记,只经它们持有的 run 心跳可见;没登记的持有者照算(保守)——
|
|
26
|
+
* 回滚到早于副本登记的构建、跳过公开序列的嵌入方、登记行过了留存视界的长寿进程会一直可能存在,所以这一读法不是过渡、没有删除日期。
|
|
27
|
+
* 它是观察谓词,不是存活证明:空闲的(零 `running` run)副本看不见;刚停的副本留下的 run 在窗内仍算(拒句给「全停之后何时再起」)。
|
|
28
|
+
* 「库上的副本够不够新」(服务下限)就是这一读法读空,不另立读口、不加版本常量。
|
|
29
|
+
*
|
|
30
|
+
* local 车道:数据根独占(起服锁只许一个进程)⇒ 没有混跑窗,守卫段与证据读法只在 SQL 腿。
|
|
31
|
+
*/
|
|
32
|
+
import type { StoreBootRefusalError } from "./store-contracts.js";
|
|
33
|
+
import type { SchemaProbeRead } from "./schema-live-columns.js";
|
|
34
|
+
import type { SqlDialect } from "./sql-driver.js";
|
|
35
|
+
import type { PendingShapeChange } from "./schema-consistency.js";
|
|
36
|
+
import type { OlderReplicaEvidence } from "./stop-then-start-sentence.js";
|
|
37
|
+
import { type ReplicaCapability } from "./replica-registration.js";
|
|
38
|
+
/** 已在服务、不认本条的副本在本条之后那一笔不兼容写由谁挡(闭集;停-迁-起行必填)。 */
|
|
39
|
+
export type StopThenStartFence =
|
|
40
|
+
/** 库挡:`fencedBy` 是本行 `shapeChanges` 里的一项(`rename` / `drop` / `rebuild`,不许 `add`),且是本条的第一笔改动。 */
|
|
41
|
+
{
|
|
42
|
+
readonly kind: "structural";
|
|
43
|
+
readonly fencedBy: PendingShapeChange;
|
|
44
|
+
}
|
|
45
|
+
/** 写句挡:从 `fencedSince`(x.y.z,严格早于本行 `introducedIn`)起的构建,`statements` 点名的那几句写读起服要求行,`(本条, in_force)` 在 ⇒ 不写、响亮。 */
|
|
46
|
+
| {
|
|
47
|
+
readonly kind: "per-write";
|
|
48
|
+
readonly fencedSince: string;
|
|
49
|
+
readonly statements: string;
|
|
50
|
+
}
|
|
51
|
+
/** 没人挡:`residual` 一句写明残余(MIGRATION 原样引);停光旧副本是唯一的补偿。 */
|
|
52
|
+
| {
|
|
53
|
+
readonly kind: "accepted";
|
|
54
|
+
readonly residual: string;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* 一条停-迁-起迁移的登记格(登记表里只写引用,判据与拒句的码在本条的迁移步旁边):
|
|
58
|
+
* · `reason` —— 一句英文:更早版本的副本在迁移之后还会写什么、写了会怎样(= 为什么不能两版滚动;升级清单原样列给运维);
|
|
59
|
+
* · `owedOn` —— **这只库还欠不欠本条**的唯一读法(只读、无参语句):守卫段先问它(不欠 ⇒ 不读证据),升级清单的停-迁-起一步只列它答「欠」的行;
|
|
60
|
+
* · `refuse` —— 有证据时本条的拒(本条自己的码与句;`read` = 锁连接上的无参读口,拒句尾的库况 / 本条的计数从它读);守卫段调它,迁移步里不再读证据;
|
|
61
|
+
* · `fence` —— 围栏类({@link StopThenStartFence})。
|
|
62
|
+
*/
|
|
63
|
+
export interface StopThenStartRow {
|
|
64
|
+
readonly reason: string;
|
|
65
|
+
readonly owedOn: (read: SchemaProbeRead, dialect: SqlDialect) => Promise<boolean>;
|
|
66
|
+
readonly refuse: (evidence: OlderReplicaEvidence, read: SchemaProbeRead, dialect: SqlDialect) => Promise<StoreBootRefusalError>;
|
|
67
|
+
readonly fence: StopThenStartFence;
|
|
68
|
+
}
|
|
69
|
+
/** 一条停-迁-起行连同判官要读的两格(登记表行的 `id` / `introducedIn` / `shapeChanges`;一次性迁移文件的 `stopThenStartMigrations()` 交出这一形)。 */
|
|
70
|
+
export interface StopThenStartEntry extends StopThenStartRow {
|
|
71
|
+
readonly id: string;
|
|
72
|
+
readonly introducedIn: string;
|
|
73
|
+
readonly shapeChanges?: readonly PendingShapeChange[];
|
|
74
|
+
}
|
|
75
|
+
/** 停-迁-起证据读法的判活窗输入:= 本部署的 `REAP_RUN_STALE_SEC`(收割器判「这条 run 的持有者还活着」用的同一个窗)。 */
|
|
76
|
+
export interface LiveRunWindowInput {
|
|
77
|
+
readonly liveRunWindowMs: number;
|
|
78
|
+
}
|
|
79
|
+
/** 证据读法要的读口(一次性迁移段的锁连接;只读)。 */
|
|
80
|
+
export interface EvidenceDb {
|
|
81
|
+
rows(sql: string, params?: readonly unknown[]): Promise<Record<string, unknown>[]>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* **唯一判官**:这份停-迁-起声明自相矛盾的清单(空 = 放行)。三类各自的放行判据(穷尽 `switch`,加第四类不处理 = tsc 红),外加三类共同的两条
|
|
85
|
+
* (名在能力名单里 —— 守卫读证据 ⇔ 名在名单里;缘由句不空)。纯函数。
|
|
86
|
+
*/
|
|
87
|
+
export declare function judgeStopThenStart(entry: StopThenStartEntry): readonly string[];
|
|
88
|
+
/**
|
|
89
|
+
* **停-迁-起证据的唯一读法**(守卫段与 M43 的启用判同读;拒句与读数的句子属主 = `stop-then-start-sentence.ts`):判活窗内心跳过的 `running` run
|
|
90
|
+
* (run 店的 {@link runningHeartbeatPredicate} `live` 一侧 —— 收割器判活的同一只构造、同一个窗),按持有者(`task_run.instance_id`,建行铸、认领接管)分组,
|
|
91
|
+
* **减去登记为知道 `migrationId` 的持有者**(`knowsCapability`,与起服准入同一只判据)—— 剩下的 run 就是证据:持有者没有登记行(早于副本登记的副本、`NULL` 身份、
|
|
92
|
+
* 自传身份的嵌入方)或登记了而能力名单里没有这条迁移,照算(保守)。登记一半只作归因(点名持有者),**不判活**。
|
|
93
|
+
* 本进程此刻还在迁移段里、一条 run 都没起过 ⇒ 证据里只有别的进程。`task_run` 不在 ⇒ `undefined`。
|
|
94
|
+
* `migrationId` 在型上就要在能力名单里(`ReplicaCapability`):一条迁移读证据 ⇔ 它的名在名单里。
|
|
95
|
+
*/
|
|
96
|
+
export declare function readOlderReplicaEvidence(db: EvidenceDb, dialect: SqlDialect, input: LiveRunWindowInput, migrationId: ReplicaCapability): Promise<OlderReplicaEvidence | undefined>;
|
|
97
|
+
/**
|
|
98
|
+
* 起服时的判官读者:本构建的每一条停-迁-起声明过 {@link judgeStopThenStart},任一条自相矛盾 ⇒ 抛(构建缺陷)。纯函数;唯一调用点 = SQL 一次性迁移段的入口
|
|
99
|
+
* (`runSqlOneTimeMigrations`),**在取连接之前** —— 抛出时这一次起服对库一句语句都没发(段头的登记、准入、取锁都还没开始)。
|
|
100
|
+
*/
|
|
101
|
+
export declare function assertStopThenStartDeclarations(entries: readonly StopThenStartEntry[]): void;
|
|
102
|
+
/**
|
|
103
|
+
* **守卫段**(一次性迁移段的锁内、准入复核之后、第一步迁移之前;锁连接上;`entries` 已由调用方在取连接之前过了 {@link assertStopThenStartDeclarations}):
|
|
104
|
+
* 按登记序逐条 —— 不欠 ⇒ 跳过(不读证据);欠 ⇒ 读证据,有 ⇒ 抛那一条自己的拒({@link StopThenStartRow.refuse})。拒 ⇒ 迁移段一字节没写。
|
|
105
|
+
* 放行之后,各条在它**自己的**第一笔不兼容写之前记一行起服要求(`serving-requirement.ts` 的 `recordServingRequirement`;三类同记)—— 不在这里记:
|
|
106
|
+
* 本条若在本次起服里不欠,就没有那一笔写,也就不记。
|
|
107
|
+
*/
|
|
108
|
+
export declare function guardOwedStopThenStart(db: EvidenceDb, dialect: SqlDialect, input: LiveRunWindowInput, entries: readonly StopThenStartEntry[]): Promise<void>;
|
|
109
|
+
//# sourceMappingURL=stop-then-start.d.ts.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { REPLICA_CAPABILITIES, knowsCapability, readReplicaRegistrations } from "./replica-registration.js";
|
|
2
|
+
import { compareReleaseTriples, releaseTriple } from "./release-version.js";
|
|
3
|
+
import { runningHeartbeatPredicate } from "./run-store-sql.js";
|
|
4
|
+
const isCapability = (id) => REPLICA_CAPABILITIES.includes(id);
|
|
5
|
+
const sameChange = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
6
|
+
export function judgeStopThenStart(entry) {
|
|
7
|
+
const faults = [];
|
|
8
|
+
if (!isCapability(entry.id))
|
|
9
|
+
faults.push(`${entry.id} is not in REPLICA_CAPABILITIES (a stop-then-start migration reads evidence only under a capability name)`);
|
|
10
|
+
if (entry.reason.trim() === "")
|
|
11
|
+
faults.push(`${entry.id}: reason is empty`);
|
|
12
|
+
const fence = entry.fence;
|
|
13
|
+
switch (fence.kind) {
|
|
14
|
+
case "structural":
|
|
15
|
+
if (!(entry.shapeChanges ?? []).some((c) => sameChange(c, fence.fencedBy)))
|
|
16
|
+
faults.push(`${entry.id}: structural fencedBy is not one of the row's shapeChanges`);
|
|
17
|
+
if (fence.fencedBy.kind === "add")
|
|
18
|
+
faults.push(`${entry.id}: structural fencedBy is an "add" (adding a column fences no earlier writer)`);
|
|
19
|
+
break;
|
|
20
|
+
case "per-write": {
|
|
21
|
+
const since = releaseTriple(fence.fencedSince);
|
|
22
|
+
const introduced = releaseTriple(entry.introducedIn);
|
|
23
|
+
if (since === undefined)
|
|
24
|
+
faults.push(`${entry.id}: per-write fencedSince "${fence.fencedSince}" is not x.y.z`);
|
|
25
|
+
if (introduced === undefined)
|
|
26
|
+
faults.push(`${entry.id}: introducedIn "${entry.introducedIn}" is not x.y.z`);
|
|
27
|
+
if (since !== undefined && introduced !== undefined && compareReleaseTriples(since, introduced) >= 0) {
|
|
28
|
+
faults.push(`${entry.id}: per-write fencedSince ${fence.fencedSince} is not earlier than introducedIn ${entry.introducedIn} (the fencing writes must ship at least one release before the migration)`);
|
|
29
|
+
}
|
|
30
|
+
if (fence.statements.trim() === "")
|
|
31
|
+
faults.push(`${entry.id}: per-write statements is empty`);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case "accepted":
|
|
35
|
+
if (fence.residual.trim() === "")
|
|
36
|
+
faults.push(`${entry.id}: accepted residual is empty`);
|
|
37
|
+
break;
|
|
38
|
+
default: {
|
|
39
|
+
const unhandled = fence;
|
|
40
|
+
faults.push(`${entry.id}: unknown fence kind ${String(unhandled.kind)}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return faults;
|
|
44
|
+
}
|
|
45
|
+
export async function readOlderReplicaEvidence(db, dialect, input, migrationId) {
|
|
46
|
+
const scope = dialect === "mysql" ? "DATABASE()" : "current_schema()";
|
|
47
|
+
if ((await db.rows(`SELECT 1 AS present FROM information_schema.tables WHERE table_schema = ${scope} AND table_name = 'task_run'`)).length === 0)
|
|
48
|
+
return undefined;
|
|
49
|
+
const live = runningHeartbeatPredicate(dialect, "live", { nowMs: Date.now(), windowMs: input.liveRunWindowMs }, 1);
|
|
50
|
+
const groups = (await db.rows(`SELECT instance_id, COUNT(*) AS n, MAX(updated_at) AS newest FROM task_run WHERE ${live.sql} GROUP BY instance_id`, [live.param]))
|
|
51
|
+
.map((r) => ({ holder: typeof r["instance_id"] === "string" ? r["instance_id"] : undefined, runs: Number(r["n"] ?? 0), newest: r["newest"] }))
|
|
52
|
+
.filter((g) => g.runs > 0);
|
|
53
|
+
if (groups.length === 0)
|
|
54
|
+
return undefined;
|
|
55
|
+
const registered = await readReplicaRegistrations({ query: async (sql, params) => ({ rows: await db.rows(sql, params), affected: 0 }) }, dialect, groups.flatMap((g) => (g.holder === undefined ? [] : [g.holder])));
|
|
56
|
+
let unregisteredRuns = 0;
|
|
57
|
+
let newestMs = Number.NaN;
|
|
58
|
+
const registeredWithout = [];
|
|
59
|
+
for (const g of groups) {
|
|
60
|
+
const r = g.holder === undefined ? undefined : registered.get(g.holder);
|
|
61
|
+
if (r !== undefined && knowsCapability(r.capabilities, migrationId))
|
|
62
|
+
continue;
|
|
63
|
+
if (r === undefined)
|
|
64
|
+
unregisteredRuns += g.runs;
|
|
65
|
+
else
|
|
66
|
+
registeredWithout.push({ instanceId: r.instanceId, releaseLine: r.releaseLine, hostName: r.hostName, pid: r.pid, runs: g.runs });
|
|
67
|
+
const cell = g.newest instanceof Date ? g.newest : new Date(String(g.newest));
|
|
68
|
+
if (!Number.isNaN(cell.getTime()) && !(cell.getTime() <= newestMs))
|
|
69
|
+
newestMs = cell.getTime();
|
|
70
|
+
}
|
|
71
|
+
const liveRuns = unregisteredRuns + registeredWithout.reduce((n, h) => n + h.runs, 0);
|
|
72
|
+
if (liveRuns === 0)
|
|
73
|
+
return undefined;
|
|
74
|
+
const now = Date.now();
|
|
75
|
+
const restartAtMs = (Number.isNaN(newestMs) ? now : newestMs) + input.liveRunWindowMs;
|
|
76
|
+
return {
|
|
77
|
+
migration: migrationId,
|
|
78
|
+
liveRuns,
|
|
79
|
+
windowSec: Math.round(input.liveRunWindowMs / 1000),
|
|
80
|
+
restartAfter: new Date(restartAtMs).toISOString(),
|
|
81
|
+
after: `${new Date(restartAtMs).toISOString()} (${Math.max(0, Math.ceil((restartAtMs - now) / 1000))}s from now)`,
|
|
82
|
+
unregisteredRuns,
|
|
83
|
+
registeredWithout: registeredWithout.sort((a, b) => a.instanceId.localeCompare(b.instanceId)),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export function assertStopThenStartDeclarations(entries) {
|
|
87
|
+
const faults = entries.flatMap((e) => judgeStopThenStart(e));
|
|
88
|
+
if (faults.length > 0) {
|
|
89
|
+
throw new Error(`stop-then-start: this build declares a stop-then-start migration that contradicts its fence class (a build defect; refused before any statement reached the database): ${faults.join("; ")}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
export async function guardOwedStopThenStart(db, dialect, input, entries) {
|
|
93
|
+
const read = (sql) => db.rows(sql);
|
|
94
|
+
for (const entry of entries) {
|
|
95
|
+
if (!(await entry.owedOn(read, dialect)))
|
|
96
|
+
continue;
|
|
97
|
+
if (!isCapability(entry.id))
|
|
98
|
+
throw new Error(`stop-then-start: ${entry.id} is not in REPLICA_CAPABILITIES`);
|
|
99
|
+
const evidence = await readOlderReplicaEvidence(db, dialect, input, entry.id);
|
|
100
|
+
if (evidence !== undefined)
|
|
101
|
+
throw await entry.refuse(evidence, read, dialect);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=stop-then-start.js.map
|
|
@@ -3,12 +3,14 @@ import type { Pool as PgPool } from "pg";
|
|
|
3
3
|
import type { SessionStore, SessionPolicyStore, FileHistoryStore, FileHistoryBlobExchange, FileHistoryError, WorkflowJournalStore, ToolResultStore, SessionCaptureRecordStore, UsageWindowStore } from "@sema-agent/core";
|
|
4
4
|
import { FileStorageBackend } from "@sema-agent/core";
|
|
5
5
|
import { type OutcomeSink } from "./file-outcome-sink.js";
|
|
6
|
-
import { type InboxWarn } from "./workflow-run-store-sql.js";
|
|
6
|
+
import { SqlWorkflowRunStore, type InboxWarn } from "./workflow-run-store-sql.js";
|
|
7
7
|
import { FileRunStore } from "./file-run-store.js";
|
|
8
|
+
import { type WorkflowParkDecisionStore, type WorkflowRecordFenceStore } from "../orchestration/workflow-park-decision.js";
|
|
8
9
|
import { type RunStallWiring } from "./store-contracts.js";
|
|
9
10
|
import { type StoreOpenLane } from "./store-open-refusal.js";
|
|
10
11
|
import { type OneTimeMigrationReport, type SqlOneTimeMigrationInput } from "./one-time-migrations.js";
|
|
11
12
|
import { LocalSessionStore } from "./local-session-store.js";
|
|
13
|
+
import { type LocalWorkflowRunsReader } from "./local-session-live-reference.js";
|
|
12
14
|
import { type LocalStoreDeclaration } from "../local-store-declaration.js";
|
|
13
15
|
import type { LocalSessionRows } from "./local-session-window.js";
|
|
14
16
|
import type { SessionHeadReader } from "./caching-session-store.js";
|
|
@@ -22,7 +24,9 @@ import { type MemoryOptOutGrantStore } from "./memory-optout-grant-store-sql.js"
|
|
|
22
24
|
import { type SendFileLedger } from "./send-file-ledger.js";
|
|
23
25
|
import type { UserInputLedgerStore } from "../user-input-ledger.js";
|
|
24
26
|
import { TiDBResumeAnchorStore, PgResumeAnchorStore } from "./resume-anchor-store-sql.js";
|
|
25
|
-
import {
|
|
27
|
+
import { SqlSessionPolicyStore } from "../stores-sql/session-policy-store-sql.js";
|
|
28
|
+
import { SqlFileHistoryStore } from "../stores-sql/file-history-store-sql.js";
|
|
29
|
+
import { type LandedAttendantSeat } from "./landed-attendants.js";
|
|
26
30
|
import type { ServiceConfig } from "../config-types.js";
|
|
27
31
|
import { TiDBRunStore, PgRunStore } from "./run-store-sql.js";
|
|
28
32
|
import { TiDBCheckpointStore, PgCheckpointStore } from "../stores-sql/checkpoint-store-sql.js";
|
|
@@ -66,7 +70,9 @@ export type RunStore = TiDBRunStore | PgRunStore | FileRunStore;
|
|
|
66
70
|
/** E18 resume-at eventId→entryId anchor map — tidb/pg/local 3-backend (works LOCAL; needs only the session tree +
|
|
67
71
|
* this map, no cloud-only checkpoint). Union = the three nominal twins; consumers use put/resolve/deleteBySession.
|
|
68
72
|
* FileResumeAnchorStore is the FILE-backed local twin (P0.5 variant-1; survives restart). */
|
|
69
|
-
|
|
73
|
+
/** 回退锚店的部署面:读(`resolve` / `listBySession`)与按会话删 —— **没有写**。锚的生产写口只有落定席位的 `putAnchors`
|
|
74
|
+
* ({@link StoreBackend.landedAttendants}:段首锁会话根行判住客,迟到的写落不进别一代住客或空闲 id);店类上的 `put` 是夹具与契约面的同一句语句。 */
|
|
75
|
+
export type ResumeAnchorStore = Pick<TiDBResumeAnchorStore | PgResumeAnchorStore | FileResumeAnchorStore, "resolve" | "listBySession" | "deleteBySession">;
|
|
70
76
|
export type { ApprovalExemptionStore } from "./approval-exemption-store.js";
|
|
71
77
|
/** 会话树根的写(事务内钩的写闭集,`stores-sql/session-write-hooks.ts`):本组合座转口给目录外的判官(`execution-placement.ts` 的 `judgeSessionWrite`;local 店的写锁内同一组词)。 */
|
|
72
78
|
export type { SessionWrite } from "../stores-sql/session-write-hooks.js";
|
|
@@ -193,7 +199,7 @@ export interface StoreBackend {
|
|
|
193
199
|
close(): Promise<void>;
|
|
194
200
|
run(): RunStore;
|
|
195
201
|
/** E18 resume-at eventId→entryId map. REQUIRED on all backends (works local — needs only the session tree + this
|
|
196
|
-
* map, no cloud-only checkpoint), unlike the optional cloud-only stores below. */
|
|
202
|
+
* map, no cloud-only checkpoint), unlike the optional cloud-only stores below. **恒同一只**(附随店的律见 {@link landedAttendants})。 */
|
|
197
203
|
resumeAnchor(): ResumeAnchorStore;
|
|
198
204
|
/** Per-session per-toolName approval exemption ("本会话不再询问") — an approval MEMORY the F4
|
|
199
205
|
* ask-gate consults after deny/neverAuto. REQUIRED on all backends (works local, like resumeAnchor). */
|
|
@@ -250,12 +256,20 @@ export interface StoreBackend {
|
|
|
250
256
|
userInputLedger(): UserInputLedgerStore;
|
|
251
257
|
/** E6 durable SessionPolicyStore (operator-tightened per-session tool rules). REQUIRED on all backends — works local
|
|
252
258
|
* (local = core's FileSessionPolicyStore), like resumeAnchor. Backs core's RunnerDeps.sessionPolicyStore.
|
|
253
|
-
*
|
|
254
|
-
|
|
259
|
+
* **恒同一只**(附随店的律见 {@link landedAttendants}):服务面的规则读口、引擎的规则席、E21 抹除与落定席位的规则写都是这一只。
|
|
260
|
+
* SQL 孪生抹除封键那一臂([ref])的 warn 经开后端时交的 warn 座(`createStoreBackend` 第二参;缺席 ⇒ 日志出口接缝的缺省 logger)。 */
|
|
261
|
+
sessionPolicy(): ServiceSessionPolicyStore;
|
|
255
262
|
/** [ref] per-edited-file rewind FileHistoryStore (trackEdit/annulTrack/snapshot/restore over the tracked set;
|
|
256
263
|
* also the 2c history-transfer store). REQUIRED on all backends (local = core's file-backed
|
|
257
|
-
* `FileFileHistoryStore` under the data root). Backs core's RunnerDeps.fileHistoryStore. */
|
|
264
|
+
* `FileFileHistoryStore` under the data root). Backs core's RunnerDeps.fileHistoryStore. **恒同一只**(附随店的律见 {@link landedAttendants})。 */
|
|
258
265
|
fileHistory(): ServiceFileHistoryStore;
|
|
266
|
+
/** 会话附随物(文件历史图 · 会话规则行 · 回退锚)的**唯一写口** —— 落定席位(`plugins/landed-attendants.ts`):每一笔写在一只先锁会话根行、判过住客的段里,
|
|
267
|
+
* 住客不是那一位 ⇒ 零写。会话同步的落定腿、`PUT /v1/sessions/:id/policy`、运行腿的每轮回退锚都经它。**必选**:SQL 两只后端交一只事务形(与会话店同一只池),
|
|
268
|
+
* local 后端交会话写锁一节形;自建后端的嵌入方实现它(没有它,会话同步族答 501)。
|
|
269
|
+
* 🔴 **附随店的律**:一只后端对 {@link sessionPolicy} / {@link fileHistory} / {@link resumeAnchor} 与本席位各恒交同一只实例,席位写的就是那三只读口交出的店
|
|
270
|
+
* (服务面 `ServiceDeps` 上附随店只有这一条读法 —— `deps.backend` —— 没有第二个注入位)。随包三只后端都如此;自建后端的嵌入方同守(写经一只、读经另一只 ⇒
|
|
271
|
+
* `PUT …/policy` 答 200 而 `GET` 与引擎读不到这条收紧)。 */
|
|
272
|
+
landedAttendants(): LandedAttendantSeat;
|
|
259
273
|
/** [ref] §3.1 / [ref] §一([ref] S-2):per-principal **memory-capture opt-out 授权表**
|
|
260
274
|
* (`memory_optout_grant`)—— `RuntimeCaps.allowMemoryOptOut` 的本地 verdict 源(三层折叠:per-principal
|
|
261
275
|
* 行 → 部署缺省哨兵行 → 代码缺省 allow)+ `/v1/admin/memory-optout` 四端点的持久层。
|
|
@@ -319,7 +333,7 @@ export interface StoreBackend {
|
|
|
319
333
|
/** P1 (fleet failover): durable cross-replica WorkflowRunStore + completion-inbox twins. OPTIONAL —
|
|
320
334
|
* SQL backends only (local keeps the File pair: single box, no cross-replica surface). main.ts prefers
|
|
321
335
|
* these under WORKFLOW_RUN_STORE=auto (the default). */
|
|
322
|
-
workflowRun?(onWarn?: InboxWarn):
|
|
336
|
+
workflowRun?(onWarn?: InboxWarn): SqlWorkflowRunStore;
|
|
323
337
|
completionInbox?(onWarn?: InboxWarn): import("../orchestration/workflow-completion-inbox.js").WorkflowCompletionInbox;
|
|
324
338
|
/** 1.108 review fix (lens③ HIGH): the notify-JOURNAL twin — third leg of the same axis (a SQL run store +
|
|
325
339
|
* inbox with a replica-LOCAL File journal stranded a dead replica's un-acked notify forever). */
|
|
@@ -329,11 +343,12 @@ export interface StoreBackend {
|
|
|
329
343
|
* 缺席**是一个真答案**:那里的索引家在 run 店同一间屋子里(`LocalWorkflowAgentSessionIndex`,文件账本
|
|
330
344
|
* 或纯内存),不需要经过 backend。契约与单写者纪律的属主 = orchestration/workflow-agent-session-index.ts。 */
|
|
331
345
|
workflowAgentSessionIndex?(): import("../orchestration/workflow-agent-session-index.js").WorkflowAgentSessionIndex;
|
|
332
|
-
/** workflow 子代停驻卡的耐久决定行(一张卡一行,键 = 子代 checkpoint 的 token)
|
|
333
|
-
*
|
|
334
|
-
*
|
|
346
|
+
/** workflow 子代停驻卡的耐久决定行(一张卡一行,键 = 子代 checkpoint 的 token),**绑两只栅栏**:本后端的 {@link run} 那只 run 店(认领栅栏)与 `records` ——
|
|
347
|
+
* 本服务全部 workflow 记录写者经它写的那只记录店(记录栅栏:SQL 后端 = 本后端 `workflowRun()` 交出的 SQL 记录店,同一只池;local 后端 = 基店外那只按 runId 互斥的装饰器)。
|
|
348
|
+
* 恒交同一只(三孪生同):记录栅栏在第一次交出时绑定,以另一只记录店再取 ⇒ 响亮抛(两只栅栏各管各的就不是同一个仲裁点)。SQL 后端 = 跨副本表,读写走 run 店的池;
|
|
349
|
+
* `local` 后端 = 进程内,账本位置由后端按自己的数据根与 `WORKFLOW_RUN_STORE` 定(`<数据根>/workflows/workflow-park-decisions/decisions.jsonl`;`memory` ⇒ 纯内存)。
|
|
335
350
|
* 契约与律的属主 = orchestration/workflow-park-decision.ts。 */
|
|
336
|
-
workflowParkDecisions?():
|
|
351
|
+
workflowParkDecisions?(records: WorkflowRecordFenceStore): WorkflowParkDecisionStore;
|
|
337
352
|
/** Cloud-only stores below are OPTIONAL: the `local` (in-memory/file) backend omits them (it has no core
|
|
338
353
|
* in-memory twin carrying the service extras, and these are fleet/multi-replica concepts), so a local HTTP
|
|
339
354
|
* service degrades EXACTLY like today's no-DB env (the consumers gate on `backend?.X?.()`). TiDB/PG provide all. */
|
|
@@ -434,6 +449,11 @@ export interface StoreBackend {
|
|
|
434
449
|
fileUsageWindowStore?(): UsageWindowStore;
|
|
435
450
|
/** **local 后端专有**:构造时交给两半店(会话店顶层、检查点店)的那一份声明(唯一读者 `localStoreDeclarationOf`)—— 装配值从这里读回,不重算。SQL 后端省略。 */
|
|
436
451
|
localStoreDeclaration?(): LocalStoreDeclaration;
|
|
452
|
+
/**
|
|
453
|
+
* 会话店活引用判的 workflow 那一腿(会话种类的老化;`local-session-live-reference.ts`):本后端的会话店读不到 workflow run 店时(local:那只店在 boot 第 6 段才铸),
|
|
454
|
+
* 第 6 段把这台部署的 workflow run 店交过来(不起 workflow ⇒ `"none"`);绑一次。SQL 两孪生不实现(它们的判是一句 SQL,读 `workflow_run` 表)。
|
|
455
|
+
*/
|
|
456
|
+
bindWorkflowRunReader?(reader: LocalWorkflowRunsReader | "none"): void;
|
|
437
457
|
}
|
|
438
458
|
/**
|
|
439
459
|
* 托管留存执行器的**组合**:引擎座表那一半(`SqlRetentionStore`,事务属主)+ 部署那一半(hold / 审计 / 认领判 / 十三张部署表,
|
|
@@ -467,8 +487,13 @@ export declare function createSqlSessionEraser(db: SqlDriver, opts: RetentionExe
|
|
|
467
487
|
* ({@link SQL_BLOB_POSTURE_FACTS})。云形缺 MinIO ⇒ fail-loud(启动了才是假安全);`SNAPSHOT_BLOB_ALLOW_SQL_BYTES=true` =
|
|
468
488
|
* 显式接受 SQL 店 + per-blob 帽(单机/测试台形;pg 上帽只来自 `SNAPSHOT_BLOB_SQL_MAX_BYTES`)。local 后端不经此门(file 店,无 SQL 包墙)。 */
|
|
469
489
|
export declare function assertCloudSnapshotBlobPosture(kind: "mysql" | "pg" | "local", config: Pick<ServiceConfig, "snapshotBlobStore" | "snapshotBlobAllowSql">): void;
|
|
470
|
-
/** SQL 一次性迁移段的输入(两只 SQL 后端同一份;各条目那一半的来源见 `SqlOneTimeMigrationInput`):M32 的车道表 ·
|
|
490
|
+
/** SQL 一次性迁移段的输入(两只 SQL 后端同一份;各条目那一半的来源见 `SqlOneTimeMigrationInput`):M32 的车道表 · 停-迁-起证据读法的判活窗(守卫段与 M43 读,`stop-then-start.ts`)= 收割器的同一个窗 · M48 的部署形读数(表里那一行)。 */
|
|
471
491
|
export declare function buildSqlOneTimeMigrationInput(config: ServiceConfig): SqlOneTimeMigrationInput;
|
|
492
|
+
/**
|
|
493
|
+
* SQL 落定席位的组装(两只 SQL 后端同一只;进程内夹具也经它):席位跑在 `db`(这台后端的池)上,写经的就是交进来的这两只店 —— 后端交的是它自己的那一只
|
|
494
|
+
* (`fileHistory()` / `sessionPolicy()`,读者读的同一只实例);席位只调它们的**语句片**(出口表的 `in-store`)与两只不拨库的判官 / 披露口,锚的语句片住 `resume-anchor-store-sql.ts`。
|
|
495
|
+
*/
|
|
496
|
+
export declare function sqlLandedAttendantsOf(db: SqlDriver, history: SqlFileHistoryStore, policy: SqlSessionPolicyStore): LandedAttendantSeat;
|
|
472
497
|
/**
|
|
473
498
|
* LOCAL backend (clay 2026-06-25 seamless local↔cloud; P0.5 variant-2 + variant-1 file-backed 2026-06-26): a DB-less StoreBackend
|
|
474
499
|
* so a locally-run HTTP service serves the SAME contract a cloud worker does (runs + trace + sessions + resume;
|
|
@@ -527,6 +552,8 @@ export interface LocalStoreBackend extends StoreBackend {
|
|
|
527
552
|
fileUsageWindowStore(): UsageWindowStore;
|
|
528
553
|
/** local 后端恒有(构造时交给两半店的声明;接口上可选的那一口在这里必在)。 */
|
|
529
554
|
localStoreDeclaration(): LocalStoreDeclaration;
|
|
555
|
+
/** local 后端恒有(会话店活引用判的 workflow 晚绑座;接口上可选的那一口在这里必在)。 */
|
|
556
|
+
bindWorkflowRunReader(reader: LocalWorkflowRunsReader | "none"): void;
|
|
530
557
|
}
|
|
531
558
|
/** 引擎 File 后端上会话店之外、本仓没有自己一份口的店(run-local 的 Runner 接它们;工具结果 / 用量窗 / 会话规则走既有的 `toolResult()` / `fileUsageWindowStore()` / `sessionPolicy()` 口)。 */
|
|
532
559
|
export type LocalEngineFileStores = Pick<FileStorageBackend, "checkpointStore" | "backgroundAgentStore" | "mailboxStore" | "rosterStore">;
|