@sema-agent/server 7.147.0 → 7.149.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 +1468 -24
- package/README.md +35 -7
- package/README.zh-CN.md +18 -8
- package/USAGE.md +444 -193
- package/deploy/sema-up/README.md +16 -5
- package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
- package/deploy/sema-up/chart/templates/_helpers.tpl +20 -4
- package/deploy/sema-up/chart/values.yaml +3 -2
- package/deploy/sema-up/cluster-up.sh +74 -176
- package/deploy/sema-up/kube-up.sh +29 -49
- package/deploy/sema-up/lib/chart-run.sh +23 -0
- package/deploy/sema-up/lib/dataroot.sh +3 -3
- package/deploy/sema-up/lib/health.sh +62 -13
- package/deploy/sema-up/lib/helm-values-cluster.py +18 -0
- package/deploy/sema-up/lib/helm-values-kube.py +35 -0
- package/deploy/sema-up/lib/regcred.py +8 -0
- package/deploy/sema-up/lib/remote/helm-install.sh +3 -0
- package/deploy/sema-up/lib/remote/image-import.sh +6 -0
- package/deploy/sema-up/lib/remote/machine-precheck.sh +11 -0
- package/deploy/sema-up/lib/remote/region-probe.sh +3 -0
- package/deploy/sema-up/lib/remote/stack-ready.sh +26 -0
- package/deploy/sema-up/lib/remote/vxlan-guard.sh +8 -0
- package/deploy/sema-up/lib/render-stack.py +17 -0
- package/deploy/sema-up/lib/shell-text.sh +87 -0
- package/deploy/sema-up/lib/usage-flags.txt +10 -0
- package/deploy/sema-up/lib/usage-head.txt +1 -0
- package/deploy/sema-up/lib/usage-tail.txt +13 -0
- package/deploy/sema-up/preflight.sh +10 -8
- package/deploy/sema-up/sema-up.sh +14 -39
- package/deploy/sema-up/smoke.sh +7 -6
- package/deploy/sema-up/stack/compose.dataroot.yaml +3 -0
- package/deploy/sema-up/stack/compose.yaml +13 -1
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +21 -0
- package/dist/adoption/plan.d.ts +24 -0
- package/dist/adoption/plan.js +53 -1
- package/dist/adoption/runner.d.ts +10 -1
- package/dist/adoption/runner.js +36 -16
- package/dist/approval-card.d.ts +36 -38
- package/dist/approval-gate-currency.js +3 -2
- package/dist/approval-leg-origin.d.ts +33 -0
- package/dist/approval-leg-origin.js +4 -0
- package/dist/approval-reconciler.d.ts +4 -13
- package/dist/approval-reconciler.js +2 -2
- package/dist/approval.d.ts +13 -11
- package/dist/approval.js +3 -3
- package/dist/audit.d.ts +10 -3
- package/dist/audit.js +15 -7
- package/dist/auth-bridge.d.ts +9 -15
- package/dist/auth-bridge.js +4 -11
- package/dist/auth-keys.d.ts +10 -1
- package/dist/auth-keys.js +8 -0
- package/dist/auto-mode-face.d.ts +10 -7
- package/dist/auto-mode-face.js +7 -4
- package/dist/background-agent-name.d.ts +19 -1
- package/dist/background-agent-name.js +12 -2
- package/dist/background-session-reap.d.ts +1 -1
- package/dist/bake-runner/main.js +9 -6
- package/dist/bench/s1/arms.js +6 -5
- package/dist/bench/s1/live-deps.js +5 -2
- package/dist/bench/s1/run-firm.js +6 -5
- package/dist/bind-host.d.ts +25 -0
- package/dist/bind-host.js +25 -0
- package/dist/boot/adoption.d.ts +3 -0
- package/dist/boot/adoption.js +1 -0
- package/dist/boot/deployment-mods.d.ts +1 -1
- package/dist/boot/execution-env.d.ts +17 -7
- package/dist/boot/execution-env.js +47 -42
- package/dist/boot/execution-lane.d.ts +6 -4
- package/dist/boot/execution-lane.js +3 -1
- package/dist/boot/exit-boundary.d.ts +2 -2
- package/dist/boot/exit-boundary.js +6 -5
- package/dist/boot/fatal-exit.d.ts +3 -5
- package/dist/boot/fatal-exit.js +2 -2
- package/dist/boot/leader.d.ts +15 -0
- package/dist/boot/leader.js +17 -15
- package/dist/boot/memory-consolidation.d.ts +37 -29
- package/dist/boot/memory-consolidation.js +11 -5
- package/dist/boot/org-delivery.d.ts +3 -2
- package/dist/boot/org-memory.js +1 -1
- package/dist/boot/parked-revive-gate.js +2 -2
- package/dist/boot/reapers.d.ts +4 -3
- package/dist/boot/reapers.js +19 -16
- package/dist/boot/resolve-spec.d.ts +5 -3
- package/dist/boot/resolve-spec.js +60 -70
- package/dist/boot/retention-lane.d.ts +4 -4
- package/dist/boot/retention-lane.js +2 -2
- package/dist/boot/runner-deps.d.ts +28 -7
- package/dist/boot/runner-deps.js +14 -5
- package/dist/boot/runtime-caps.d.ts +2 -2
- package/dist/boot/runtime-caps.js +16 -2
- package/dist/boot/session-faces.d.ts +16 -7
- package/dist/boot/session-faces.js +114 -94
- package/dist/boot/shutdown.d.ts +5 -4
- package/dist/boot/shutdown.js +6 -4
- package/dist/boot/stage-01-config.d.ts +1 -0
- package/dist/boot/stage-01-config.js +13 -4
- package/dist/boot/stage-02-web-admin-pull.d.ts +2 -0
- package/dist/boot/stage-02-web-admin-pull.js +16 -3
- package/dist/boot/stage-03-store-backend.d.ts +4 -0
- package/dist/boot/stage-03-store-backend.js +4 -3
- package/dist/boot/stage-04-stores.d.ts +3 -0
- package/dist/boot/stage-04-stores.js +2 -2
- package/dist/boot/stage-05-execution-env.d.ts +8 -3
- package/dist/boot/stage-05-execution-env.js +2 -2
- package/dist/boot/stage-06-runners.d.ts +12 -13
- package/dist/boot/stage-06-runners.js +23 -15
- package/dist/boot/stage-07-capability-layer.d.ts +13 -9
- package/dist/boot/stage-07-capability-layer.js +5 -3
- package/dist/boot/stage-08-reapers.d.ts +13 -9
- package/dist/boot/stage-08-reapers.js +3 -3
- package/dist/boot/stage-09-leader.d.ts +14 -16
- package/dist/boot/stage-09-leader.js +12 -4
- package/dist/boot/stage-10-http-server.d.ts +14 -16
- package/dist/boot/stage-10-http-server.js +7 -4
- package/dist/boot/store-evidence.d.ts +20 -0
- package/dist/boot/store-evidence.js +13 -0
- package/dist/boot/stores.d.ts +6 -0
- package/dist/boot/stores.js +41 -27
- package/dist/boot/task-list-lane.d.ts +4 -4
- package/dist/boot/web-admin.d.ts +4 -2
- package/dist/boot/web-admin.js +55 -35
- package/dist/boot/webfetch-summarize-lane.d.ts +1 -1
- package/dist/boot-reclaim.d.ts +3 -1
- package/dist/boot-reclaim.js +1 -1
- package/dist/brain.d.ts +7 -18
- package/dist/brain.js +5 -17
- package/dist/budget.js +6 -6
- package/dist/capabilities/center-plugins.d.ts +7 -1
- package/dist/capabilities/center-plugins.js +32 -10
- package/dist/capabilities/center-wiring.js +1 -1
- package/dist/capabilities/composite-members.d.ts +2 -2
- package/dist/capabilities/composite-members.js +2 -2
- package/dist/capabilities/repo-tools.d.ts +2 -0
- package/dist/capabilities/repo-tools.js +14 -12
- package/dist/capabilities/scenarios.d.ts +6 -15
- package/dist/capabilities/scenarios.js +11 -16
- package/dist/capabilities/skills.d.ts +1 -1
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +39 -11
- package/dist/capability-facts.js +35 -7
- package/dist/card-settle-stored-scope.d.ts +56 -0
- package/dist/card-settle-stored-scope.js +27 -0
- package/dist/card-void.d.ts +8 -13
- package/dist/card-void.js +2 -7
- package/dist/center-credential-renewer.d.ts +6 -2
- package/dist/center-credential-renewer.js +7 -3
- package/dist/config-catalog.d.ts +28 -1
- package/dist/config-catalog.js +95 -85
- package/dist/config-dir-trust.d.ts +37 -4
- package/dist/config-dir-trust.js +88 -44
- package/dist/config-invariants.d.ts +43 -3
- package/dist/config-invariants.js +69 -5
- package/dist/config-lkg.d.ts +23 -1
- package/dist/config-lkg.js +17 -3
- package/dist/config-provider.d.ts +9 -9
- package/dist/config-provider.js +25 -110
- package/dist/config-pull-failure.d.ts +50 -0
- package/dist/config-pull-failure.js +48 -0
- package/dist/config-types.d.ts +62 -21
- package/dist/config.d.ts +14 -21
- package/dist/config.js +141 -64
- package/dist/context-window-notice.d.ts +31 -0
- package/dist/context-window-notice.js +28 -0
- package/dist/delegated-session-owner.d.ts +1 -1
- package/dist/deleted-session-ids.d.ts +3 -2
- package/dist/deployment-governance.d.ts +3 -3
- package/dist/deployment-shape.d.ts +46 -11
- package/dist/deployment-shape.js +8 -0
- package/dist/egress-redirect.d.ts +25 -7
- package/dist/egress-redirect.js +20 -2
- package/dist/elicitation.d.ts +6 -5
- package/dist/elicitation.js +23 -22
- package/dist/engine-identity.d.ts +28 -0
- package/dist/engine-identity.js +10 -0
- package/dist/entry-problems.d.ts +5 -7
- package/dist/entry-problems.js +1 -1
- package/dist/env-facts.js +2 -1
- package/dist/env-name-allowlist-knobs.d.ts +6 -5
- package/dist/env-name-allowlist-knobs.js +5 -0
- package/dist/env-witness.d.ts +7 -0
- package/dist/env-witness.js +16 -0
- package/dist/execution-lane-caps.d.ts +25 -23
- package/dist/execution-lane-caps.js +18 -26
- package/dist/execution-placement.d.ts +58 -18
- package/dist/execution-placement.js +41 -2
- package/dist/field-conflict.d.ts +7 -11
- package/dist/field-conflict.js +3 -3
- package/dist/file-history-capture.d.ts +3 -3
- package/dist/file-history-disclosure.js +1 -0
- package/dist/fleet/fleet-bus.d.ts +21 -3
- package/dist/fleet/fleet-bus.js +35 -25
- package/dist/fleet/fleet-reconciler.js +2 -2
- package/dist/fleet/serving-lease.js +3 -3
- package/dist/fleet-client.js +3 -3
- package/dist/fleet-lease.d.ts +0 -1
- package/dist/fleet-lease.js +4 -5
- package/dist/history-anchor.d.ts +23 -3
- package/dist/history-anchor.js +24 -4
- package/dist/hitl-delivery.d.ts +90 -0
- package/dist/hitl-delivery.js +98 -0
- package/dist/hooks/classic-stations.d.ts +8 -11
- package/dist/hooks/classic-stations.js +0 -7
- package/dist/hooks/command-spawn.d.ts +7 -2
- package/dist/hooks/command-spawn.js +13 -6
- package/dist/hooks/hook-llm.d.ts +5 -1
- package/dist/hooks/hook-llm.js +24 -15
- package/dist/hooks/hook-runner.d.ts +72 -57
- package/dist/hooks/hook-runner.js +271 -193
- package/dist/host-lsp-manager.d.ts +22 -8
- package/dist/host-lsp-manager.js +4 -1
- package/dist/http/active-run-conflict.d.ts +2 -43
- package/dist/http/active-run-conflict.js +3 -7
- package/dist/http/admission.d.ts +4 -18
- package/dist/http/admission.js +76 -79
- package/dist/http/approval-sweeps.d.ts +3 -3
- package/dist/http/approval-sweeps.js +56 -31
- package/dist/http/caller-trust.d.ts +8 -10
- package/dist/http/caller-trust.js +1 -2
- package/dist/http/claim-heartbeat.d.ts +49 -0
- package/dist/http/claim-heartbeat.js +46 -0
- package/dist/http/claimed-run.d.ts +16 -8
- package/dist/http/claimed-run.js +8 -0
- package/dist/http/dispatch.d.ts +8 -1
- package/dist/http/dispatch.js +78 -30
- package/dist/http/durable-run-leg.d.ts +11 -4
- package/dist/http/durable-run-leg.js +45 -21
- package/dist/http/execution-context.d.ts +122 -47
- package/dist/http/execution-context.js +135 -43
- package/dist/http/health-reader.d.ts +36 -0
- package/dist/http/health-reader.js +21 -0
- package/dist/http/health-self-report.d.ts +9 -9
- package/dist/http/health-self-report.js +4 -4
- package/dist/http/idempotency.d.ts +9 -5
- package/dist/http/idempotency.js +4 -4
- package/dist/http/memory-compliance-failure-reply.d.ts +15 -16
- package/dist/http/memory-compliance-failure-reply.js +4 -2
- package/dist/http/memory-face-fault-reply.d.ts +67 -0
- package/dist/http/memory-face-fault-reply.js +71 -0
- package/dist/http/memory-store-refusal-reply.d.ts +1 -1
- package/dist/http/memory-store-refusal-reply.js +3 -0
- package/dist/http/owner-access.d.ts +392 -67
- package/dist/http/owner-access.js +370 -35
- package/dist/http/principal-gate.d.ts +39 -89
- package/dist/http/principal-gate.js +26 -68
- package/dist/http/refusal-body.d.ts +35 -2
- package/dist/http/refusal-body.js +34 -0
- package/dist/http/request-guards.d.ts +9 -13
- package/dist/http/request-guards.js +34 -68
- package/dist/http/resume-composition.d.ts +37 -0
- package/dist/http/resume-composition.js +18 -0
- package/dist/http/resume-ctx-read.d.ts +46 -12
- package/dist/http/resume-ctx-read.js +31 -6
- package/dist/http/resume-legs.d.ts +54 -19
- package/dist/http/resume-legs.js +408 -196
- package/dist/http/retired-skill-manifest.d.ts +1 -1
- package/dist/http/route-ctx.d.ts +31 -32
- package/dist/http/routes/a2a-serve.d.ts +43 -5
- package/dist/http/routes/a2a-serve.js +60 -37
- package/dist/http/routes/admin-config-refresh.js +2 -2
- package/dist/http/routes/admin-drain.js +2 -2
- package/dist/http/routes/admin-memory-optout.js +4 -3
- package/dist/http/routes/adoption.d.ts +3 -0
- package/dist/http/routes/adoption.js +17 -10
- package/dist/http/routes/agents-roster.js +13 -7
- package/dist/http/routes/approvals-assistant.js +73 -67
- package/dist/http/routes/attachments.js +2 -2
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +9 -17
- package/dist/http/routes/capabilities.js +16 -19
- package/dist/http/routes/config-catalog.js +2 -2
- package/dist/http/routes/devices.d.ts +3 -3
- package/dist/http/routes/devices.js +4 -4
- package/dist/http/routes/diagnostics.d.ts +29 -3
- package/dist/http/routes/diagnostics.js +49 -18
- package/dist/http/routes/engine.js +2 -2
- package/dist/http/routes/fleet.js +5 -3
- package/dist/http/routes/images.js +10 -6
- package/dist/http/routes/leader.d.ts +7 -2
- package/dist/http/routes/leader.js +12 -3
- package/dist/http/routes/mcp-reconnect.d.ts +1 -1
- package/dist/http/routes/mcp-reconnect.js +7 -15
- package/dist/http/routes/memory-bundle.js +4 -7
- package/dist/http/routes/memory-compliance.js +4 -4
- package/dist/http/routes/memory-consolidation.js +6 -9
- package/dist/http/routes/memory-origin.d.ts +2 -0
- package/dist/http/routes/memory-origin.js +7 -8
- package/dist/http/routes/memory-policy.js +17 -12
- package/dist/http/routes/notify-wake.js +10 -19
- package/dist/http/routes/observability.js +3 -3
- package/dist/http/routes/principal-inbox.d.ts +4 -2
- package/dist/http/routes/principal-inbox.js +5 -4
- package/dist/http/routes/projects.d.ts +1 -1
- package/dist/http/routes/projects.js +3 -2
- package/dist/http/routes/retention-ops.js +6 -9
- package/dist/http/routes/rules.js +20 -5
- package/dist/http/routes/run-memory-capture.d.ts +2 -2
- package/dist/http/routes/run-memory-capture.js +6 -12
- package/dist/http/routes/run-permission-mode.d.ts +2 -2
- package/dist/http/routes/run-permission-mode.js +10 -17
- package/dist/http/routes/runs.js +155 -237
- package/dist/http/routes/session-memory-sync.d.ts +2 -2
- package/dist/http/routes/session-memory-sync.js +7 -13
- package/dist/http/routes/session-sync.d.ts +28 -7
- package/dist/http/routes/session-sync.js +63 -50
- package/dist/http/routes/sessions-list.d.ts +3 -3
- package/dist/http/routes/sessions-list.js +9 -9
- package/dist/http/routes/sessions.js +87 -124
- package/dist/http/routes/shared-memory.js +6 -6
- package/dist/http/routes/side-query.js +2 -2
- package/dist/http/routes/tasks.js +237 -187
- package/dist/http/routes/trace-usage.d.ts +0 -12
- package/dist/http/routes/trace-usage.js +40 -46
- package/dist/http/routes/workflows.d.ts +39 -4
- package/dist/http/routes/workflows.js +42 -14
- package/dist/http/run-concurrency-cap.d.ts +20 -12
- package/dist/http/run-concurrency-cap.js +39 -26
- package/dist/http/run-read-face.d.ts +3 -5
- package/dist/http/run-read-face.js +8 -13
- package/dist/http/send.d.ts +12 -3
- package/dist/http/send.js +42 -6
- package/dist/http/server.d.ts +43 -45
- package/dist/http/server.js +61 -11
- package/dist/http/sse-log.d.ts +17 -10
- package/dist/http/sse-log.js +7 -7
- package/dist/http/stored-body-replay.d.ts +12 -0
- package/dist/http/stored-body-replay.js +2 -2
- package/dist/http/submit-ctx.d.ts +17 -8
- package/dist/http/submit-ctx.js +8 -5
- package/dist/http/submit-replay.d.ts +19 -6
- package/dist/http/submit-replay.js +18 -6
- package/dist/http/sync-submit-body.d.ts +3 -4
- package/dist/http/sync-submit-body.js +4 -5
- package/dist/http/wire-types.d.ts +4 -3
- package/dist/identity-source.d.ts +36 -5
- package/dist/identity-source.js +27 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +2 -0
- package/dist/key-resolver.d.ts +32 -0
- package/dist/key-resolver.js +23 -9
- package/dist/leader/diffup.js +2 -1
- package/dist/leader/endpoint.d.ts +26 -5
- package/dist/leader/endpoint.js +154 -14
- package/dist/leader/fanout.d.ts +3 -0
- package/dist/leader/fanout.js +78 -63
- package/dist/leader/leader.d.ts +16 -0
- package/dist/leader/leader.js +43 -3
- package/dist/leader/merge.d.ts +9 -1
- package/dist/leader/merge.js +16 -1
- package/dist/leader/repair-wire.js +1 -1
- package/dist/leader/wire.d.ts +36 -3
- package/dist/leader/wire.js +59 -18
- package/dist/leg-facts.d.ts +7 -2
- package/dist/leg-facts.js +1 -0
- package/dist/local-store-declaration.d.ts +54 -0
- package/dist/local-store-declaration.js +59 -0
- package/dist/lsp-evict.d.ts +6 -4
- package/dist/lsp-evict.js +2 -3
- package/dist/mcp-assertion-header.d.ts +1 -1
- package/dist/mcp-assertion-header.js +1 -1
- package/dist/memory-operator-faces.d.ts +5 -4
- package/dist/memory-operator-faces.js +1 -1
- package/dist/memory-project-layer.js +1 -1
- package/dist/memory-scope.d.ts +33 -6
- package/dist/memory-scope.js +68 -19
- package/dist/memory-store-refusal.d.ts +5 -2
- package/dist/memory-sync-client.d.ts +3 -2
- package/dist/memory-sync-client.js +8 -5
- package/dist/model-compat.d.ts +17 -8
- package/dist/model-compat.js +6 -2
- package/dist/model-context-window.d.ts +57 -0
- package/dist/model-context-window.js +21 -0
- package/dist/model-entry-headers.d.ts +46 -4
- package/dist/model-entry-headers.js +2 -2
- package/dist/model-entry-refusal.d.ts +40 -20
- package/dist/model-entry-refusal.js +57 -30
- package/dist/model-plane-face.d.ts +19 -11
- package/dist/model-plane-face.js +9 -1
- package/dist/model-plane-probe.d.ts +2 -0
- package/dist/model-plane-probe.js +17 -0
- package/dist/model-provider.d.ts +3 -3
- package/dist/model-reach-scope.d.ts +2 -1
- package/dist/model-route-endpoint.d.ts +9 -5
- package/dist/model-route-endpoint.js +29 -7
- package/dist/model-select.d.ts +16 -0
- package/dist/model-select.js +4 -0
- package/dist/mountinfo.d.ts +37 -0
- package/dist/mountinfo.js +47 -0
- package/dist/namespaced-rule-name.d.ts +23 -14
- package/dist/namespaced-rule-name.js +8 -11
- package/dist/net-address.d.ts +1 -1
- package/dist/observability/corrupt-read-seat.d.ts +4 -4
- package/dist/observability/corrupt-read-seat.js +5 -3
- package/dist/observability/fail-open.d.ts +72 -40
- package/dist/observability/fail-open.js +74 -40
- package/dist/observability/logger.d.ts +22 -1
- package/dist/observability/logger.js +89 -12
- package/dist/observability/metrics.js +4 -5
- package/dist/observability/otel-exporter.js +2 -1
- package/dist/observability/principal-context.d.ts +14 -7
- package/dist/observability/principal-context.js +8 -3
- package/dist/observability/run-terminal.d.ts +7 -1
- package/dist/observability/run-terminal.js +6 -2
- package/dist/observability/secret-env-scrub.d.ts +1 -1
- package/dist/observability/secret-env-scrub.js +1 -1
- package/dist/orchestration/hardened-vm-runner.d.ts +1 -0
- package/dist/orchestration/hardened-vm-runner.js +11 -5
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +0 -14
- package/dist/orchestration/hardened-vm-worker-runner.js +5 -0
- package/dist/orchestration/hardened-vm-worker.js +2 -1
- package/dist/orchestration/workflow-completion-inbox.d.ts +3 -3
- package/dist/orchestration/workflow-completion-inbox.js +3 -2
- package/dist/org-delivery-gate.d.ts +36 -10
- package/dist/org-delivery-gate.js +12 -8
- package/dist/outbound-dispatcher.d.ts +1 -1
- package/dist/outbound-dispatcher.js +6 -12
- package/dist/owner-brands.d.ts +81 -0
- package/dist/owner-brands.js +42 -0
- package/dist/owner-faces.d.ts +532 -0
- package/dist/owner-faces.js +126 -0
- package/dist/park-row-commit.d.ts +67 -0
- package/dist/park-row-commit.js +76 -0
- package/dist/parked-decide.d.ts +76 -12
- package/dist/parked-decide.js +152 -11
- package/dist/parked-revive-surface.d.ts +14 -4
- package/dist/parked-revive-surface.js +5 -4
- package/dist/peer-directory.d.ts +7 -9
- package/dist/peer-directory.js +3 -2
- package/dist/permission-rule-vocab.d.ts +53 -8
- package/dist/permission-rule-vocab.js +30 -2
- package/dist/plugins/adoption-log-sql.d.ts +3 -25
- package/dist/plugins/adoption-log-sql.js +23 -21
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.d.ts +7 -0
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.js +17 -0
- package/dist/plugins/approval-ask-store-file.d.ts +18 -7
- package/dist/plugins/approval-ask-store-file.js +37 -14
- package/dist/plugins/approval-ask-store-memory.d.ts +12 -4
- package/dist/plugins/approval-ask-store-memory.js +24 -10
- package/dist/plugins/approval-ask-store-sql.d.ts +40 -21
- package/dist/plugins/approval-ask-store-sql.js +44 -15
- package/dist/plugins/approval-exemption-skill-cutoff.d.ts +64 -0
- package/dist/plugins/approval-exemption-skill-cutoff.js +122 -0
- package/dist/plugins/approval-exemption-skill-m46.d.ts +14 -0
- package/dist/plugins/approval-exemption-skill-m46.js +21 -0
- package/dist/plugins/approval-exemption-store.d.ts +32 -2
- package/dist/plugins/approval-exemption-store.js +42 -19
- package/dist/plugins/approval-nonce-store.d.ts +39 -12
- package/dist/plugins/approval-nonce-store.js +72 -23
- package/dist/plugins/blob-backend.d.ts +2 -0
- package/dist/plugins/blob-backend.js +9 -6
- package/dist/plugins/caching-session-store.d.ts +13 -1
- package/dist/plugins/caching-session-store.js +43 -4
- package/dist/plugins/checkpoint-index-columns.d.ts +32 -5
- package/dist/plugins/checkpoint-index-columns.js +36 -1
- package/dist/plugins/checkpoint-store-face.d.ts +83 -10
- package/dist/plugins/checkpoint-store-face.js +18 -1
- package/dist/plugins/device-store-sql.js +1 -0
- package/dist/plugins/ensure-index.d.ts +13 -1
- package/dist/plugins/ensure-index.js +154 -21
- package/dist/plugins/ensure-schema-lock-policy.d.ts +36 -18
- package/dist/plugins/ensure-schema-lock-policy.js +76 -9
- package/dist/plugins/file-run-store.d.ts +85 -32
- package/dist/plugins/file-run-store.js +177 -94
- package/dist/plugins/host-platform.d.ts +24 -3
- package/dist/plugins/host-platform.js +15 -1
- package/dist/plugins/image-bake-store-sql.js +2 -0
- package/dist/plugins/imported-layer-root-retirement.d.ts +2 -2
- package/dist/plugins/k8s-pod-reaper.d.ts +1 -3
- package/dist/plugins/k8s-pod-reaper.js +0 -1
- package/dist/plugins/leader-run-store-sql.d.ts +22 -0
- package/dist/plugins/leader-run-store-sql.js +34 -4
- package/dist/plugins/local-checkpoint-store.d.ts +62 -23
- package/dist/plugins/local-checkpoint-store.js +197 -77
- package/dist/plugins/local-data-dir-modes-m39.js +2 -1
- package/dist/plugins/local-data-root-admission.d.ts +52 -0
- package/dist/plugins/local-data-root-admission.js +100 -0
- package/dist/plugins/local-docker-capacity.d.ts +93 -0
- package/dist/plugins/local-docker-capacity.js +194 -0
- package/dist/plugins/local-docker-reaper.d.ts +92 -0
- package/dist/plugins/local-docker-reaper.js +102 -0
- package/dist/plugins/local-engine-high-water.d.ts +29 -6
- package/dist/plugins/local-engine-high-water.js +27 -19
- package/dist/plugins/local-session-store.d.ts +458 -140
- package/dist/plugins/local-session-store.js +906 -292
- package/dist/plugins/local-session-window.d.ts +3 -2
- package/dist/plugins/local-session-window.js +3 -2
- package/dist/plugins/local-sidecar-quarantine.js +3 -2
- package/dist/plugins/local-task-attachment-store.d.ts +18 -1
- package/dist/plugins/local-task-attachment-store.js +22 -1
- package/dist/plugins/memory-embedder.js +9 -7
- package/dist/plugins/memory-engine-pg.d.ts +3 -2
- package/dist/plugins/memory-engine-pg.js +14 -5
- package/dist/plugins/memory-engine-sql-apply.d.ts +8 -4
- package/dist/plugins/memory-engine-sql-apply.js +6 -8
- package/dist/plugins/memory-engine-tidb.d.ts +4 -2
- package/dist/plugins/memory-engine-tidb.js +11 -2
- package/dist/plugins/memory-optout-grant-store-sql.d.ts +1 -1
- package/dist/plugins/memory-optout-grant-store-sql.js +3 -3
- package/dist/plugins/memory-run-store.d.ts +53 -36
- package/dist/plugins/memory-run-store.js +116 -88
- package/dist/plugins/one-time-migration-marker.d.ts +26 -0
- package/dist/plugins/one-time-migration-marker.js +13 -0
- package/dist/plugins/one-time-migrations.d.ts +214 -47
- package/dist/plugins/one-time-migrations.js +481 -135
- package/dist/plugins/org-delivery-quota-store.d.ts +34 -11
- package/dist/plugins/org-delivery-quota-store.js +31 -15
- package/dist/plugins/permission-rule-store-file.d.ts +3 -3
- package/dist/plugins/permission-rule-store-sql.d.ts +5 -64
- package/dist/plugins/permission-rule-store-sql.js +11 -95
- package/dist/plugins/pg-pool.d.ts +2 -32
- package/dist/plugins/pg-pool.js +24 -17
- package/dist/plugins/remote-env-device.d.ts +3 -2
- package/dist/plugins/remote-env-e2b.d.ts +8 -32
- package/dist/plugins/remote-env-e2b.js +44 -32
- package/dist/plugins/remote-env-host.d.ts +51 -17
- package/dist/plugins/remote-env-host.js +111 -42
- package/dist/plugins/remote-env-k8s.d.ts +40 -45
- package/dist/plugins/remote-env-k8s.js +111 -60
- package/dist/plugins/remote-env-local-docker.d.ts +152 -15
- package/dist/plugins/remote-env-local-docker.js +352 -72
- package/dist/plugins/remote-scratchpad.js +4 -0
- package/dist/plugins/retention-deployment.d.ts +49 -17
- package/dist/plugins/retention-deployment.js +39 -8
- package/dist/plugins/run-preview-m45.d.ts +11 -0
- package/dist/plugins/run-preview-m45.js +19 -0
- package/dist/plugins/run-store-sql.d.ts +82 -75
- package/dist/plugins/run-store-sql.js +164 -125
- package/dist/plugins/s3-answer.d.ts +2 -1
- package/dist/plugins/sandbox-reaper.d.ts +26 -0
- package/dist/plugins/sandbox-reaper.js +2 -0
- package/dist/plugins/scenario-prefix-switch-m42.d.ts +56 -0
- package/dist/plugins/scenario-prefix-switch-m42.js +56 -0
- package/dist/plugins/scheduler-support.d.ts +16 -1
- package/dist/plugins/scheduler-support.js +22 -2
- package/dist/plugins/schema-consistency.d.ts +131 -14
- package/dist/plugins/schema-consistency.js +388 -18
- package/dist/plugins/schema-drift-sentence.d.ts +10 -6
- package/dist/plugins/schema-drift-sentence.js +15 -7
- package/dist/plugins/schema-ensure-legs.d.ts +9 -0
- package/dist/plugins/schema-ensure-legs.js +1 -1
- package/dist/plugins/schema-indexes.js +3 -0
- package/dist/plugins/schema-live-columns.d.ts +14 -5
- package/dist/plugins/schema-live-columns.js +10 -10
- package/dist/plugins/send-user-file.js +2 -1
- package/dist/plugins/session-birth.d.ts +37 -0
- package/dist/plugins/session-birth.js +38 -0
- package/dist/plugins/session-epoch-anchor.d.ts +40 -12
- package/dist/plugins/session-epoch-anchor.js +33 -11
- package/dist/plugins/session-ext-table.d.ts +27 -3
- package/dist/plugins/session-ext-table.js +19 -6
- package/dist/plugins/session-fork.d.ts +15 -1
- package/dist/plugins/session-fork.js +3 -0
- package/dist/plugins/session-ownership.d.ts +1 -1
- package/dist/plugins/session-placement.d.ts +27 -20
- package/dist/plugins/session-placement.js +15 -12
- package/dist/plugins/session-row-sql.d.ts +12 -0
- package/dist/plugins/session-row-sql.js +3 -3
- package/dist/plugins/session-run-rollup.d.ts +29 -0
- package/dist/plugins/session-run-rollup.js +40 -0
- package/dist/plugins/session-store-sql.d.ts +38 -12
- package/dist/plugins/session-store-sql.js +130 -30
- package/dist/plugins/session-withdraw-sql.d.ts +36 -0
- package/dist/plugins/session-withdraw-sql.js +42 -0
- package/dist/plugins/shared-memory-store-sql.d.ts +0 -69
- package/dist/plugins/shared-memory-store-sql.js +2 -1
- package/dist/plugins/shell-sentinel-owner-m48.d.ts +42 -0
- package/dist/plugins/shell-sentinel-owner-m48.js +9 -0
- package/dist/plugins/snapshot-bucket-presence.d.ts +2 -1
- package/dist/plugins/sql-driver.d.ts +1 -1
- package/dist/plugins/sql-driver.js +2 -1
- package/dist/plugins/sql-errors.d.ts +32 -5
- package/dist/plugins/sql-errors.js +55 -7
- package/dist/plugins/sql-json-column.d.ts +8 -7
- package/dist/plugins/sql-json-column.js +10 -6
- package/dist/plugins/stop-then-start-sentence.d.ts +16 -0
- package/dist/plugins/stop-then-start-sentence.js +7 -0
- package/dist/plugins/store-backend.d.ts +99 -16
- package/dist/plugins/store-backend.js +230 -65
- package/dist/plugins/store-contracts.d.ts +123 -33
- package/dist/plugins/store-contracts.js +38 -1
- package/dist/plugins/store-fault.d.ts +28 -2
- package/dist/plugins/store-fault.js +20 -2
- package/dist/plugins/task-attachment-store.d.ts +15 -3
- package/dist/plugins/task-attachment-store.js +22 -9
- package/dist/plugins/tidb-pool.d.ts +11 -6
- package/dist/plugins/tidb-pool.js +39 -18
- package/dist/plugins/web-search.js +5 -3
- package/dist/plugins/workflow-run-store-sql.d.ts +6 -1
- package/dist/plugins/workflow-run-store-sql.js +11 -5
- package/dist/plugins/workspace-custody.d.ts +44 -0
- package/dist/plugins/workspace-custody.js +47 -0
- package/dist/principal-jwt.d.ts +4 -4
- package/dist/principal-jwt.js +20 -5
- package/dist/principal-shape.d.ts +41 -0
- package/dist/principal-shape.js +19 -0
- package/dist/project-identity.d.ts +8 -7
- package/dist/project-identity.js +40 -17
- package/dist/project-layer-key.d.ts +13 -2
- package/dist/project-layer-key.js +9 -1
- package/dist/question.d.ts +13 -23
- package/dist/question.js +21 -39
- package/dist/read-deny-floor-notice.d.ts +36 -0
- package/dist/read-deny-floor-notice.js +40 -0
- package/dist/{plain-string-record.d.ts → request-declaration-disposition.d.ts} +9 -23
- package/dist/request-declaration-disposition.js +39 -0
- package/dist/request-declaration-refusal.d.ts +35 -12
- package/dist/request-declaration-refusal.js +21 -9
- package/dist/request-form.d.ts +58 -0
- package/dist/request-form.js +72 -0
- package/dist/request-image-urls.d.ts +8 -2
- package/dist/request-image-urls.js +2 -1
- package/dist/request-images.d.ts +20 -0
- package/dist/request-images.js +59 -0
- package/dist/request-key-closure.d.ts +6 -7
- package/dist/request-key-closure.js +15 -2
- package/dist/resource-suspend.d.ts +7 -16
- package/dist/resource-suspend.js +1 -1
- package/dist/retired-name-host-notice.d.ts +21 -0
- package/dist/retired-name-host-notice.js +12 -0
- package/dist/rule-entry-list.d.ts +2 -2
- package/dist/rule-entry-list.js +3 -4
- package/dist/rule-issue-reading.d.ts +58 -0
- package/dist/rule-issue-reading.js +14 -0
- package/dist/rules-consent.d.ts +5 -3
- package/dist/rules-consent.js +1 -0
- package/dist/run-acceptance.d.ts +3 -1
- package/dist/run-acceptance.js +3 -0
- package/dist/run-cancel-card.d.ts +28 -0
- package/dist/run-cancel-card.js +19 -0
- package/dist/run-cancel-context.d.ts +10 -0
- package/dist/run-cancel-context.js +1 -0
- package/dist/run-local.d.ts +14 -6
- package/dist/run-local.js +117 -90
- package/dist/run-stale-default.d.ts +7 -0
- package/dist/run-stale-default.js +2 -0
- package/dist/runs.d.ts +56 -21
- package/dist/runs.js +73 -43
- package/dist/runtime-caps-resolver.d.ts +21 -6
- package/dist/runtime-caps-resolver.js +17 -4
- package/dist/runtime-governance.d.ts +2 -2
- package/dist/runtime-governance.js +5 -3
- package/dist/sealed-key-layout.d.ts +12 -5
- package/dist/sealed-key-layout.js +5 -0
- package/dist/sealed-key.d.ts +12 -2
- package/dist/sealed-key.js +115 -27
- package/dist/security.d.ts +128 -158
- package/dist/security.js +163 -59
- package/dist/sema-config-dir.d.ts +20 -0
- package/dist/sema-config-dir.js +25 -0
- package/dist/server-secret-env.d.ts +55 -25
- package/dist/server-secret-env.js +75 -22
- package/dist/session-agent.d.ts +3 -2
- package/dist/session-children-retire.d.ts +13 -8
- package/dist/session-children-retire.js +9 -7
- package/dist/session-deletion.d.ts +88 -0
- package/dist/session-deletion.js +8 -0
- package/dist/session-erase.d.ts +145 -0
- package/dist/session-erase.js +115 -0
- package/dist/session-error-wire.d.ts +5 -5
- package/dist/session-error-wire.js +1 -1
- package/dist/session-incarnation.d.ts +52 -5
- package/dist/session-incarnation.js +19 -2
- package/dist/session-policy-wire.d.ts +6 -3
- package/dist/session-policy-wire.js +11 -1
- package/dist/session-resident-background.d.ts +0 -71
- package/dist/session-resident-background.js +4 -3
- package/dist/session-row.d.ts +2 -1
- package/dist/session-rules-seat.d.ts +12 -0
- package/dist/session-rules-seat.js +19 -0
- package/dist/session-titler.d.ts +7 -15
- package/dist/session-titler.js +1 -1
- package/dist/session-workspace.d.ts +3 -3
- package/dist/spec-fields.d.ts +57 -3
- package/dist/spec-fields.js +72 -51
- package/dist/store-admission.d.ts +33 -0
- package/dist/store-admission.js +49 -0
- package/dist/store-posture.d.ts +141 -20
- package/dist/store-posture.js +205 -3
- package/dist/stored-request-hooks-m20.js +2 -2
- package/dist/stores-sql/background-agent-store-sql.d.ts +11 -2
- package/dist/stores-sql/background-agent-store-sql.js +73 -20
- package/dist/stores-sql/checkpoint-store-sql.d.ts +34 -29
- package/dist/stores-sql/checkpoint-store-sql.js +78 -49
- package/dist/stores-sql/file-history-store-sql.d.ts +1 -1
- package/dist/stores-sql/file-history-store-sql.js +3 -5
- package/dist/stores-sql/mailbox-store-sql.d.ts +7 -4
- package/dist/stores-sql/mailbox-store-sql.js +31 -32
- package/dist/stores-sql/pg-session-storage.d.ts +7 -5
- package/dist/stores-sql/pg-session-storage.js +54 -46
- package/dist/stores-sql/retention-store-sql.d.ts +87 -19
- package/dist/stores-sql/retention-store-sql.js +92 -27
- package/dist/stores-sql/session-policy-store-sql.d.ts +32 -10
- package/dist/stores-sql/session-policy-store-sql.js +44 -36
- package/dist/stores-sql/session-write-hooks.d.ts +12 -6
- package/dist/stores-sql/tidb-session-storage.d.ts +4 -4
- package/dist/stores-sql/tidb-session-storage.js +13 -8
- package/dist/stores-sql/tidb-session-store.d.ts +36 -17
- package/dist/stores-sql/tidb-session-store.js +69 -39
- package/dist/stores-sql/tool-result-store-sql.d.ts +1 -1
- package/dist/stores-sql/tool-result-store-sql.js +4 -6
- package/dist/stores-sql/windowed-session-storage.d.ts +5 -0
- package/dist/stores-sql/windowed-session-storage.js +9 -0
- package/dist/submission-exit.d.ts +50 -0
- package/dist/submission-exit.js +108 -0
- package/dist/task-a2a.d.ts +3 -8
- package/dist/task-a2a.js +28 -30
- package/dist/task-cwd.d.ts +43 -7
- package/dist/task-cwd.js +11 -0
- package/dist/task-mcp.d.ts +3 -3
- package/dist/task-mcp.js +4 -4
- package/dist/task-settings.d.ts +14 -10
- package/dist/task-settings.js +19 -7
- package/dist/terminal.d.ts +27 -43
- package/dist/terminal.js +49 -14
- package/dist/tool-approval.d.ts +173 -163
- package/dist/tool-approval.js +247 -232
- package/dist/trace/core-keyset-guard.d.ts +13 -6
- package/dist/trace/core-vocab-wire.d.ts +95 -0
- package/dist/trace/core-vocab-wire.js +15 -0
- package/dist/trace/engine-notice-wire.d.ts +24 -21
- package/dist/trace/engine-notice-wire.js +7 -3
- package/dist/trace/exit-seat.d.ts +30 -4
- package/dist/trace/exit-seat.js +40 -36
- package/dist/trace/extension-call-face.d.ts +3 -2
- package/dist/trace/extension-call-face.js +3 -1
- package/dist/trace/ledger-events.d.ts +4 -7
- package/dist/trace/ledger-sink.d.ts +4 -31
- package/dist/trace/ledger-sink.js +0 -11
- package/dist/trace/model-segment.d.ts +5 -5
- package/dist/trace/model-segment.js +5 -5
- package/dist/trace/project.d.ts +59 -44
- package/dist/trace/project.js +60 -26
- package/dist/trace/redact.d.ts +135 -27
- package/dist/trace/redact.js +884 -260
- package/dist/trace/self-minted-wire.d.ts +567 -20
- package/dist/trace/self-minted-wire.js +205 -24
- package/dist/trace/wire-projection-faces.d.ts +5 -6
- package/dist/trace/wire-projection-faces.js +2 -2
- package/dist/upstream-body.d.ts +23 -0
- package/dist/upstream-body.js +16 -0
- package/dist/url-refusal.d.ts +3 -3
- package/dist/url-refusal.js +11 -4
- package/dist/user-authored-text.d.ts +1 -1
- package/dist/user-input-ledger.d.ts +7 -8
- package/dist/user-input-ledger.js +1 -1
- package/dist/web-admin-client/apply-effective.d.ts +6 -3
- package/dist/web-admin-client/apply-effective.js +33 -23
- package/dist/web-admin-client/apply-ledger.d.ts +16 -7
- package/dist/web-admin-client/apply-ledger.js +5 -2
- package/dist/web-admin-client/center-request.d.ts +2 -2
- package/dist/web-admin-client/center-request.js +15 -15
- package/dist/web-admin-client/effective-keys.d.ts +1 -1
- package/dist/web-admin-client/effective-keys.js +1 -1
- package/dist/web-admin-client/entry-metadata.d.ts +8 -0
- package/dist/web-admin-client/entry-metadata.js +13 -0
- package/dist/web-admin-client/http-client.d.ts +1 -1
- package/dist/web-admin-client/http-client.js +23 -4
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/mcp-revocation.js +2 -1
- package/dist/web-admin-client/read-warnings.d.ts +1 -0
- package/dist/web-admin-client/read-warnings.js +1 -0
- package/dist/web-admin-client/restart-signal.js +8 -4
- package/dist/web-admin-client/skills-mcp.d.ts +2 -2
- package/dist/web-admin-client/types.d.ts +1 -2
- package/dist/workspace-space.d.ts +3 -2
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +4 -4
- package/docs/error-text-lexicon.json +317 -0
- package/package.json +8 -3
- package/scripts/drain-check-local.mjs +118 -147
- package/scripts/drain-check.mysql.sql +22 -2
- package/scripts/drain-check.pg.sql +22 -2
- package/scripts/embed-minimal.mjs +183 -0
- package/wire-changes/server@7.148.0.json +1517 -0
- package/wire-changes/server@7.149.0.json +372 -0
- package/dist/http/memory-control-plane-corrupt-reply.d.ts +0 -25
- package/dist/http/memory-control-plane-corrupt-reply.js +0 -19
- package/dist/http/memory-layer-reply.d.ts +0 -30
- package/dist/http/memory-layer-reply.js +0 -24
- package/dist/lsp/e2b-bridge.d.ts +0 -57
- package/dist/lsp/e2b-bridge.js +0 -139
- package/dist/lsp/e2b-manager.d.ts +0 -93
- package/dist/lsp/e2b-manager.js +0 -178
- package/dist/lsp/lsp-frames.d.ts +0 -14
- package/dist/lsp/lsp-frames.js +0 -25
- package/dist/lsp/manager.d.ts +0 -129
- package/dist/lsp/manager.js +0 -127
- package/dist/lsp/types.d.ts +0 -12
- package/dist/lsp/types.js +0 -2
- package/dist/lsp/ws-transport.d.ts +0 -40
- package/dist/lsp/ws-transport.js +0 -210
- package/dist/plain-string-record.js +0 -70
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { SqlDialect } from "./sql-driver.js";
|
|
2
|
+
/**
|
|
3
|
+
* 一次性迁移 **M48** 的唯一属主(窗、删法与删后谁接住:窗口见 `plugins/one-time-migrations.ts` 登记表;随 M48 删整个文件)。
|
|
4
|
+
*
|
|
5
|
+
* cli ≤ 1.0.70 在本地单用户形下对每次请求自发主体头 `anon:shell-live`,于是那段时间写下的会话行 / run 行 / leader run 行的属主列是这一个字面量
|
|
6
|
+
* (不是真租户键:它与「不带主体的同一位本地用户」是同一个人的两种写法)。此前属主面表为它留了一格按字面量互认的资格;
|
|
7
|
+
* 本版起这一格退役 —— 存量行由本迁移改写成无主(`null`),之后它们与任何无主行同读(普通无主行一格),属主读法里不再有字面量。
|
|
8
|
+
*
|
|
9
|
+
* **改写的部署形**:「哨兵 ≡ 不带主体的本地单用户」只在没有身份边界的部署(dev-open)上成立 ⇒ 改写只在那里执行。判据 = 部署形表行 `identityBoundary`(只读配置:
|
|
10
|
+
* `REQUIRE_PRINCIPAL`、service 凭据、鉴权桥 issuer —— 含中心回退、直连门、只读 trace 凭据,任一在 ⇒ 有边界),dev-open 判据 `devOpenDeployment` 读同一行。
|
|
11
|
+
* 有身份边界的部署上哨兵是一位普通的具名属主,行只对字面相等的主体可见;改成无主 = 过了凭据门的任何主体都够得着 ⇒ 那里零改写、读数 0,行原样(本条照样记完成)。
|
|
12
|
+
* 读数由调用方读部署形表交进迁移段(`one-time-migrations.ts` 的 `ShellSentinelOwnerInput`),两条腿同读。
|
|
13
|
+
*
|
|
14
|
+
* 改写面 = 曾放那一格的读面读属主的那几处:SQL `session_meta` / `task_run` / `leader_run` 的 `owner` 列;local 会话元数据边档那一格的 `owner`、
|
|
15
|
+
* `FileRunStore` 的 run 行 `owner`(local 没有 leader run 店)。不改的(如实):规则行(存在哨兵键下的规则此前也不对无主体任务生效,改键 = 放宽,不做)、
|
|
16
|
+
* 收件箱条目 / 问账行 / 检查点 scope(这些读面从没放过那一格)。
|
|
17
|
+
*
|
|
18
|
+
* **有身份边界的部署不改写,但不零信号**:部署形读数取自**起服的那一个进程**的配置,而改写落在整只库 / 数据根上、不可逆 ⇒ 同一只库 / 根被身份配置不同的进程打开
|
|
19
|
+
* (`run-local` 不带服务凭据 / 桥、嵌入方先于验签器装配的起服序列、连着共享库的临时进程)时,一样身份键都不带的那个进程先起,会替有边界的服务进程把行改成无主(边界是任一身份来源在的并 —— 改写只在一样都没有时发生)。
|
|
20
|
+
* 有边界的进程自己只看见「零改写」,不数一数就不知道库里还留着多少行 ⇒ 那一臂对**同一批改写面**用**同一个比较**数一遍(不写,不改),读数 {@link ShellSentinelOwnerRowsRetained}
|
|
21
|
+
* 逐面列非零的计数,起服日志一行 warn(`shell_sentinel_rows_retained`)。比较只有一份:SQL 的 {@link shellSentinelOwnerWhereM48}(改写的 `UPDATE` 与计数的 `SELECT COUNT(*)` 共用),
|
|
22
|
+
* local 的 {@link isShellSentinelOwnerM48}(会话元数据格与 run 行的改写和计数共用)。
|
|
23
|
+
*/
|
|
24
|
+
export declare const SHELL_SENTINEL_OWNER_M48 = "anon:shell-live";
|
|
25
|
+
/** SQL 腿改写 `owner` 列的表(曾放那一格的读面读属主的表;local 腿的对应面见文件头)。 */
|
|
26
|
+
export declare const SHELL_SENTINEL_OWNER_TABLES_M48: readonly ["session_meta", "task_run", "leader_run"];
|
|
27
|
+
/** 改写面的词(留存读数与日志的逐面计数键):SQL = 表名;local 腿借同一组词 —— `session_meta` = 会话元数据格、`task_run` = run 行(local 没有 leader run 店 ⇒ 不出 `leader_run`)。 */
|
|
28
|
+
export type ShellSentinelOwnerSurfaceM48 = (typeof SHELL_SENTINEL_OWNER_TABLES_M48)[number];
|
|
29
|
+
/** 留存读数的一只:有身份边界的部署上,这一面还留着多少行哨兵属主(只列非零的面)。 */
|
|
30
|
+
export interface ShellSentinelOwnerRowsRetained {
|
|
31
|
+
readonly surface: ShellSentinelOwnerSurfaceM48;
|
|
32
|
+
readonly rows: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* SQL 腿「这一行是哨兵属主」的比较(**唯一一份**;改写的 `UPDATE … SET owner = NULL WHERE <此>` 与留存计数的 `SELECT COUNT(*) … WHERE <此>` 共用,绑定参数同为 {@link SHELL_SENTINEL_OWNER_M48})。
|
|
36
|
+
* 值**逐字节**比:MySQL 协议的 `utf8mb4_bin` 是 PAD SPACE(`'a' = 'a '`),普通等值会把只差尾空格的另一位属主(合法主体名)也当哨兵 ——
|
|
37
|
+
* 与 M17 / M18 的 CAS 同一写法 `CAST(… AS BINARY)`;PG `text` 等值本就逐字节。
|
|
38
|
+
*/
|
|
39
|
+
export declare function shellSentinelOwnerWhereM48(dialect: SqlDialect): string;
|
|
40
|
+
/** local 腿「这一行 / 格的属主是哨兵」的比较(**唯一一份**;会话元数据格与 run 行的改写、留存计数共用 —— 严格相等,与 SQL 腿的逐字节比同义)。 */
|
|
41
|
+
export declare function isShellSentinelOwnerM48(owner: string | null | undefined): boolean;
|
|
42
|
+
//# sourceMappingURL=shell-sentinel-owner-m48.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const SHELL_SENTINEL_OWNER_M48 = "anon:shell-live";
|
|
2
|
+
export const SHELL_SENTINEL_OWNER_TABLES_M48 = ["session_meta", "task_run", "leader_run"];
|
|
3
|
+
export function shellSentinelOwnerWhereM48(dialect) {
|
|
4
|
+
return dialect === "mysql" ? "CAST(owner AS BINARY) = CAST(? AS BINARY)" : "owner = $1";
|
|
5
|
+
}
|
|
6
|
+
export function isShellSentinelOwnerM48(owner) {
|
|
7
|
+
return owner === SHELL_SENTINEL_OWNER_M48;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=shell-sentinel-owner-m48.js.map
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
* `workspace` = k8s 车道的 `config.remoteExec.s3Snapshot.bucket`(`WORKSPACE_SNAPSHOT_BUCKET`,缺省 `workspaces`)—— 车道没开 / 没配对象存储 ⇒ 没有这只桶,不核。
|
|
21
21
|
* 拒句的旋钮名跟着桶走(缺的是哪只桶就只点哪只的旋钮)。公桶 `sema-public` 是运维另配的匿名桶,不在本核之内。
|
|
22
22
|
* · 运行期的对应臂:工作区 `latest` 指针读答 404 `NoSuchBucket`(同一条「桶不在」判据 `isNoSuchBucketAnswer`)⇒ 那条 run 响亮拒绝,不再读成「空间头一回」
|
|
23
|
-
* (`remote-env-k8s.ts` `readPointer`)
|
|
23
|
+
* (`remote-env-k8s.ts` `readPointer`);恢复时归档 GET 答同一只 404 `NoSuchBucket`(pod 原样交回存储的答复,同一只判据读)⇒ 两条车道同拒、同一行
|
|
24
|
+
* (`restoreSnapshot`)—— 起服核之后桶被删 / 起服核证明不了的部署,在运行期也有一道。
|
|
24
25
|
*/
|
|
25
26
|
import type { ServiceConfig } from "../config-types.js";
|
|
26
27
|
import { type StoreOpenWaitClock } from "./store-open-wait.js";
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
*/
|
|
116
116
|
import type { Pool as MySqlPool } from "mysql2/promise";
|
|
117
117
|
import type { Pool as PgPool } from "pg";
|
|
118
|
-
import type
|
|
118
|
+
import { type Logger } from "../observability/logger.js";
|
|
119
119
|
/**
|
|
120
120
|
* SQL **文本**的语法族(调用方说,不探):`mysql` = MySQL 协议(TiDB / MySQL InnoDB / MariaDB 同一套语句),`pg` = PostgreSQL。
|
|
121
121
|
* 与 `@sema-agent/core-stores-sql` 公面的 `SqlDialect` 同词同集 —— 部署词 / 引擎词都不是它的别名:谁在答是另一轴 {@link SqlEngine}(驱动探)。
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { pgSafeJsonStringify, pgProtocolJsonStringify } from "./pg-safe-json.js";
|
|
2
2
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
3
3
|
import { errorKindOf } from "../observability/err-text.js";
|
|
4
|
+
import { writeLogText } from "../observability/logger.js";
|
|
4
5
|
import { isConnectionUnusableError } from "./sql-errors.js";
|
|
5
6
|
export class SqlStatementDeadlineExceeded extends Error {
|
|
6
7
|
deadlineMs;
|
|
@@ -229,7 +230,7 @@ async function establishSession(session, pooled, c, init) {
|
|
|
229
230
|
session.facts = null;
|
|
230
231
|
session.connections = new WeakMap();
|
|
231
232
|
if (stale !== null)
|
|
232
|
-
|
|
233
|
+
writeLogText("stderr", `[sql-driver] connection initialization REFUSED — SQL engine facts invalidated (was: ${stale ? `${stale.engine} ${stale.version} ${stale.isolation} txnMode=${stale.txnMode ?? "-"}` : "<absent>"}). GET /v1/diagnostics/wiring -> sqlEngine and GET /v1/capabilities -> sql now report ABSENT, which is the honest ` +
|
|
233
234
|
`reading: this pool cannot currently establish the read semantics every "SELECT … FOR UPDATE" in this repo assumes. Cause: ${err.message}`);
|
|
234
235
|
c.release();
|
|
235
236
|
throw err;
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
* 件事的两种写法**,任一在场即可判定 —— 认并集不会造出假阳性,而认单键会漏掉任何只保留另一个键的
|
|
16
16
|
* 形(驱动版本差异、代理/包装层、序列化往返)。这正是收编前两个真漏判的成因,门钉在
|
|
17
17
|
* `test/sql-dup-key-single-source.test.ts`。
|
|
18
|
+
* 同一条道理的最后一种形:错误对象**不是驱动原错**(调用方递进来的 query 包装把键丢了、只剩 `message`)⇒ 另有一只**宽读法** {@link isDupKeyErrorOfWrappedQuery},
|
|
19
|
+
* 只给吃这种 query 函数的站点(`ensureIndex`)用;持驱动原错的店走严格读法,不按散文改判。两只读法都住在这里(站点不自带文案正则),钉同一个文件。
|
|
18
20
|
*
|
|
19
21
|
* ## 为什么是 `Reflect.get` 而不是属性访问/展开
|
|
20
22
|
* 驱动错误类在某些版本把这两个键挂在**原型链**上:`{...err}` 只拷自有可枚举键,会**静默**丢掉它们,
|
|
@@ -36,12 +38,19 @@ export declare const MYSQL_ER_DUP_ENTRY_ERRNO = 1062;
|
|
|
36
38
|
export declare const MYSQL_ER_DUP_ENTRY_CODE = "ER_DUP_ENTRY";
|
|
37
39
|
/** PostgreSQL `unique_violation` 的 SQLSTATE。 */
|
|
38
40
|
export declare const PG_UNIQUE_VIOLATION_SQLSTATE = "23505";
|
|
39
|
-
/** MySQL/TiDB 的唯一键冲突:`code === "ER_DUP_ENTRY"` **或** `errno === 1062`(同一件事的两种写法)
|
|
41
|
+
/** MySQL/TiDB 的唯一键冲突:`code === "ER_DUP_ENTRY"` **或** `errno === 1062`(同一件事的两种写法)。只读结构化归因键,不读 `message` 散文。 */
|
|
40
42
|
export declare function isMysqlDupKeyError(err: unknown): boolean;
|
|
41
43
|
/** PostgreSQL 的唯一键冲突:SQLSTATE `23505`(node-pg 挂在 `code` 上)。 */
|
|
42
44
|
export declare function isPgUniqueViolation(err: unknown): boolean;
|
|
43
45
|
/** 方言分派口——双方言店的调用形(`isDupKeyError(this.db.dialect, e)`)。 */
|
|
44
46
|
export declare function isDupKeyError(dialect: SqlDialect, err: unknown): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* **宽读法**:{@link isDupKeyError} 之外,MySQL 协议另认 `message` 里的 `Duplicate entry` 句子 —— 给**错误对象不是驱动原错**的站点用:`ensureIndex` 吃调用方递进来的 `query`
|
|
49
|
+
* 函数(`IndexQueryFn`),那层包装可能把结构化键丢了(或写成 `null`)、给句子加前缀,只剩 `message`。持驱动原错的店(十余处,走 {@link isDupKeyError})**不**用它:
|
|
50
|
+
* 它们拿得到带 `code` / `errno` 的原错,按散文改判会把一句碰巧带这两个词的非唯一键错读成「已存在」(例:`mark` 的 `existed` 回执)。
|
|
51
|
+
* 宽读法 ⊇ 严格读法;PG 臂没有散文臂(只认 SQLSTATE `23505`)。散文臂只住在这里 —— 站点不自带文案正则。
|
|
52
|
+
*/
|
|
53
|
+
export declare function isDupKeyErrorOfWrappedQuery(dialect: SqlDialect, err: unknown): boolean;
|
|
45
54
|
/** PostgreSQL `undefined_column` 的 SQLSTATE。⚠️ 与 `42P01`(`undefined_table`)刻意分开。 */
|
|
46
55
|
export declare const PG_UNDEFINED_COLUMN_SQLSTATE = "42703";
|
|
47
56
|
/** MySQL/TiDB `ER_BAD_FIELD_ERROR`(未知列)的数字 errno。 */
|
|
@@ -194,25 +203,43 @@ export declare function isConnectionFaultError(err: unknown): boolean;
|
|
|
194
203
|
* (与连接类互为反面:那一类是「什么都不改稍后再试可能成」)。读者:整仓一只判官 `plugins/store-fault.ts` 的 `storeFaultClassOf` 的 `deployment` 一词 ——
|
|
195
204
|
* 文件历史店的折点与会话同步拉取口(`503 state.file_history_unreadable`)据它判 `permanence: "terminal"`;审批队列读口并入「此刻读不出」的 503;各读者各自表态,**不在自己那里写码**。
|
|
196
205
|
* 起服建表(`session-ext-table.ts` 的 `ensureSessionExtTableMysql`)问的也是这一只:「库确定拒了这条 DDL」= 本表认得 ⇒ 当场拒启;认不出 ⇒ 原样上抛、开库等待窗重试 —— 不自带第二份分类。
|
|
197
|
-
*
|
|
206
|
+
* 建外键被库确定拒的十码(1005 / 1215 / 1821 / 1822 / 1824 / 1825 / 1826 / 3734 / 3780 / 6125)只可能出在建表 / 改表上,读写路径上的读者见不到它们 —— 加进本表对那几处零变化。
|
|
207
|
+
* **为什么按码逐个登记、不按语义区段判**:MySQL 错误参考里这一族的 SQLSTATE 一律是 `HY000`(与一切未分类的服务端错误同一格,SQLSTATE 不分类);errno 也不成连续区段 ——
|
|
208
|
+
* 1821–1826 / 3734 / 3780 / 6125 之间夹着同族而**不属于**建表形不符的码(运行期的 1451 / 1452 / 3008、删列改列的 1828–1834、删父表的 3730),按区段或 `ER_FK_` 前缀判会把它们一并收进来;
|
|
209
|
+
* 而 mysql2 的码表是旧的(6125 没有符号,`code` 缺席),所以数字 `errno` 是必认的键。出处按码写在各行的 `why` 里:判据是码,不是散文。
|
|
210
|
+
* **唯一一行按内层号分:1005(建表被存储引擎拒)是包装码** —— 库答的消息模板 `Can't create table '%s' (errno: %d - %s)` 的**内层**号才是成因:150(外键形不成)/ 121(约束名已占)是确定拒,
|
|
211
|
+
* 28(盘满)等资源类清了盘重试即成。外层 SQLSTATE 恒 `HY000`、驱动不把内层号挂成字段 ⇒ 没有语义 / 结构化的键可判,只能读库自己的消息模板:这一行带 `innerErrnos`,
|
|
212
|
+
* 判据 = 外层码(`code` / `errno` 任一)是 1005 ∧ 消息是以 `Can't create table ` 开头、以 `(errno: <数字>…)` 收尾的整句 ∧ 内层号在 `innerErrnos` 里;读不出 / 不在册 /
|
|
213
|
+
* 外层不是这一码 ⇒ 不是(认不出一律不是;失败方向 = 进开库等待窗重试,不当场拒)。其余各行整码判、不读消息。
|
|
198
214
|
*
|
|
199
215
|
* 识别集 = 本表一张,按归因键登记:`code`(字符串)与 MySQL 协议的数字 `errno`(两键是同一件事的两种写法,代理 / 序列化往返可能只留一个;同本文件其余谓词的姿势)。
|
|
200
216
|
* **与连接类互斥**:本表的任何一码都不在 {@link CONNECTION_FAULT_ERRORS} / {@link MYSQL_CONNECTION_UNUSABLE_ERRORS} 的识别集里,反之亦然(`test/store-fault-judge.test.ts` 钉两个方向)—— 同一只错只落一个词。
|
|
201
217
|
*
|
|
202
218
|
* **不在表里**(认不出一律不是;今天收缺表、权限拒与外键建不成三形,其余是登记在案的未收项,不是「已裁定不判」):缺列(1054 / `42703`:升级前置断言 `assert*Schema` 族有自己的判据与出路)、
|
|
203
219
|
* 认证类拒连(MySQL 1045、PG `28xxx`:凭据 / 白名单)、库级与列级的权限拒(MySQL 1044 / 1143)、语法错(1064:多半是我方的语句,不是库的形)、
|
|
204
|
-
* TiDB 自己的忙 / 区域不可用 / 结构变更冲突一族(9001 / 9005 / 8028,同连接类表的登记)、锁等待超时(1205)
|
|
220
|
+
* TiDB 自己的忙 / 区域不可用 / 结构变更冲突一族(9001 / 9005 / 8028,同连接类表的登记)、锁等待超时(1205)、
|
|
221
|
+
* 外键的运行期拒(1451 / 1452 / 3008:行违反外键 / 级联深度,出在读写路径上、不是库的形)、`ER_FK_FAIL_ADD_SYSTEM`(1823:写系统表失败,成因混着字典写入失败而非逐因都是形不符 —— 推断,未读实现,故不登记)。
|
|
205
222
|
*/
|
|
206
223
|
export declare const DEPLOYMENT_FAULT_ERRORS: ReadonlyArray<{
|
|
207
224
|
readonly code: string;
|
|
208
225
|
readonly errno?: number;
|
|
226
|
+
readonly innerErrnos?: readonly number[];
|
|
209
227
|
readonly why: string;
|
|
210
228
|
}>;
|
|
211
229
|
/**
|
|
212
|
-
* 「这个错误**是**部署错配类故障吗」—— {@link DEPLOYMENT_FAULT_ERRORS} 的唯一判据(识别集与排除项见该表头注)
|
|
213
|
-
*
|
|
230
|
+
* 「这个错误**是**部署错配类故障吗」—— {@link DEPLOYMENT_FAULT_ERRORS} 的唯一判据(识别集与排除项见该表头注)。纯谓词;认不出的一律不是。
|
|
231
|
+
* 整码行只读被抛出的**这一只**对象身上的结构化字段(`code` 字符串 / `errno` 数字),不沿 `cause` 链找、不读散文里的在册词;唯一例外是包装码 1005:外层码在册之后还要读库自己的
|
|
232
|
+
* 消息模板里的内层号(头注),内层号不在册 / 读不出 ⇒ 不是。
|
|
214
233
|
*/
|
|
215
234
|
export declare function isDeploymentFaultError(err: unknown): boolean;
|
|
235
|
+
/**
|
|
236
|
+
* 库对一条语句的**答**里的原码,读成一小段(起服拒句读库答的唯一读法 —— `session-ext-table.ts` 的建表拒与 `store-backend.ts` 的开库拒同读这一只,不各写各的):
|
|
237
|
+
* · MySQL 协议:`errno <数字> <符号>, SQLSTATE <五位>`(`errno` / `code` / `sqlState` 三格,哪一格不在就缺哪一格;mysql2 的码表没有新号时 `code` 缺席,只剩 errno;只有符号没有 errno ⇒ `code <符号>`);
|
|
238
|
+
* · PostgreSQL:SQLSTATE 就挂在 `code` 上(node-pg),没有 errno / sqlState 键 ⇒ `SQLSTATE <五位>`。
|
|
239
|
+
* 只读被抛出的这一只对象身上的结构化字段、不读散文;每一格过闭字符形(数字 / `[A-Za-z0-9_]{1,64}` / 五位 SQLSTATE),形不对的格不进句子 —— 句子里不会出现驱动交来的任意串。
|
|
240
|
+
* 一格都读不到 ⇒ `undefined`(拒句不加这一段)。读字段经本文件同一只 `keyOf`(与本文件其余谓词同一读法:驱动错对象是普通对象,没有读取时才抛的访问器 / 代理那种形;真遇上就原样上抛,不在这里吞)。
|
|
241
|
+
*/
|
|
242
|
+
export declare function databaseAnswerCodesOf(dialect: SqlDialect, err: unknown): string | undefined;
|
|
216
243
|
/**
|
|
217
244
|
* 检查点店的两笔写(续跑输入 `putCtx` / 停驻行 `put`)被引擎以「一行装不下」拒 ⇒ **这一只**带码错误(码 `store.row_too_large`),不以裸驱动错上抛
|
|
218
245
|
* (其余店写今天仍是各自的驱动错 —— 未收,登记在案)。
|
|
@@ -15,6 +15,15 @@ export function isPgUniqueViolation(err) {
|
|
|
15
15
|
export function isDupKeyError(dialect, err) {
|
|
16
16
|
return dialect === "mysql" ? isMysqlDupKeyError(err) : isPgUniqueViolation(err);
|
|
17
17
|
}
|
|
18
|
+
const MYSQL_ER_DUP_ENTRY_SENTENCE = /duplicate entry/i;
|
|
19
|
+
export function isDupKeyErrorOfWrappedQuery(dialect, err) {
|
|
20
|
+
if (isDupKeyError(dialect, err))
|
|
21
|
+
return true;
|
|
22
|
+
if (dialect !== "mysql")
|
|
23
|
+
return false;
|
|
24
|
+
const message = keyOf(err, "message");
|
|
25
|
+
return typeof message === "string" && MYSQL_ER_DUP_ENTRY_SENTENCE.test(message);
|
|
26
|
+
}
|
|
18
27
|
export const PG_UNDEFINED_COLUMN_SQLSTATE = "42703";
|
|
19
28
|
export const MYSQL_ER_BAD_FIELD_ERRNO = 1054;
|
|
20
29
|
export const MYSQL_ER_BAD_FIELD_CODE = "ER_BAD_FIELD_ERROR";
|
|
@@ -148,19 +157,58 @@ export const DEPLOYMENT_FAULT_ERRORS = [
|
|
|
148
157
|
{ code: "42501", why: "PG insufficient_privilege(权限拒:库账号缺这张表 / 这类语句的授权 —— 授权之前重试注定失败)" },
|
|
149
158
|
{ code: "ER_NO_SUCH_TABLE", errno: 1146, why: "MySQL 协议(MySQL / MariaDB / TiDB)缺表:同 PG `42P01`" },
|
|
150
159
|
{ code: "ER_TABLEACCESS_DENIED_ERROR", errno: 1142, why: "MySQL 协议表级权限拒:库账号对这张表缺这类语句的授权,同 PG `42501`" },
|
|
151
|
-
{ code: "ER_FK_INCOMPATIBLE_COLUMNS", errno: 3780, why: "MySQL 协议外键两侧列不相容(类型 / 字符集 / 排序规则对不上)
|
|
152
|
-
{ code: "ER_CANNOT_ADD_FOREIGN", errno: 1215, why: "MySQL 协议加不上外键(
|
|
153
|
-
{ code: "
|
|
154
|
-
{ code: "
|
|
160
|
+
{ code: "ER_FK_INCOMPATIBLE_COLUMNS", errno: 3780, why: "MySQL 协议外键两侧列不相容(类型 / 字符集 / 排序规则对不上):被引表的形与外键要求不符,重试同一句仍不相容。出处:MySQL 9.0 错误参考 3780;TiDB `ErrFKIncompatibleColumns`" },
|
|
161
|
+
{ code: "ER_CANNOT_ADD_FOREIGN", errno: 1215, why: "MySQL 协议加不上外键(统称码,如被引表不是 InnoDB):库的形不收这条约束,改表之前重试注定失败。出处:MySQL 9.0 错误参考 1215;TiDB `ErrCannotAddForeign`" },
|
|
162
|
+
{ code: "ER_FK_NO_INDEX_CHILD", errno: 1821, why: "MySQL 协议外键的子表侧(建表句里的这张)缺索引:建表句的形不符,重试同一句仍被拒。出处:MySQL 9.0 错误参考 1821;TiDB `ErrFkNoIndexChild`;MariaDB 1800–1899 页同号" },
|
|
163
|
+
{ code: "ER_FK_NO_INDEX_PARENT", errno: 1822, why: "MySQL 协议外键的被引列上缺索引:被引表的形不符,建索引之前重试注定失败。出处:MySQL 9.0 错误参考 1822;TiDB `ErrForeignKeyNoIndexInParent`;MariaDB 1800–1899 页同号" },
|
|
164
|
+
{ code: "ER_FK_CANNOT_OPEN_PARENT", errno: 1824, why: "MySQL 协议外键的被引表打不开(库答「Failed to open the referenced table」;被引表不是 InnoDB 时 9.x 以此码拒,真库读数见 db 组钉):改引擎之前重试注定失败。出处:MySQL 9.0 错误参考 1824;TiDB `ErrForeignKeyCannotOpenParent`;MariaDB 1800–1899 页同号" },
|
|
165
|
+
{ code: "ER_FK_INCORRECT_OPTION", errno: 1825, why: "MySQL 协议外键的选项在这张表上不成立(库答「Incorrect options in FOREIGN KEY constraint」):建表句的形不符,重试同一句仍被拒。出处:MySQL 9.0 错误参考 1825;TiDB `ErrFkIncorrectOption`;MariaDB 1800–1899 页同号" },
|
|
166
|
+
{ code: "ER_FK_DUP_NAME", errno: 1826, why: "MySQL 协议外键约束名重复(库答「Duplicate foreign key constraint name」):改掉占用同名的那一只之前重试注定失败。出处:MySQL 9.0 错误参考 1826;TiDB `ErrFkDupName`;MariaDB 1800–1899 页同号" },
|
|
167
|
+
{ code: "ER_FK_NO_COLUMN_PARENT", errno: 3734, why: "MySQL 协议外键的被引表上没有被引的那一列:被引表的形不符,补列之前重试注定失败。出处:MySQL 9.0 错误参考 3734;TiDB `ErrForeignKeyNoColumnInParent`" },
|
|
168
|
+
{ code: "ER_FK_NO_UNIQUE_INDEX_PARENT", errno: 6125, why: "MySQL 协议外键的被引列上没有唯一键(库答「Missing unique key」;被引表无主键时 9.x 以此码拒,真库读数见 db 组钉):加主键 / 唯一键之前重试注定失败。出处:MySQL 9.0 错误参考 6125(mysql2 的码表没有这一号,驱动错的 `code` 缺席,按 errno 认;TiDB 无此号)" },
|
|
169
|
+
{ code: "ER_CANT_CREATE_TABLE", errno: 1005, innerErrnos: [150, 121], why: "MySQL 协议建表被存储引擎拒(包装码,只认内层错误号 150 外键形不成 / 121 约束名已占:修库之前重试同一句仍被拒;28 盘满等资源类清盘后重试即成,不是确定拒,见头注)。出处:MySQL 9.0 错误参考 1005(消息模板 `Can't create table '%s' (errno: %d - %s)`,参考页注明消息里的 errno 150 = 外键形不成);TiDB `ErrCantCreateTable`" },
|
|
155
170
|
];
|
|
156
|
-
const
|
|
157
|
-
const
|
|
171
|
+
const WHOLE_CODE_ROWS = DEPLOYMENT_FAULT_ERRORS.filter((r) => r.innerErrnos === undefined);
|
|
172
|
+
const DEPLOYMENT_FAULT_CODES = new Set(WHOLE_CODE_ROWS.map((r) => r.code));
|
|
173
|
+
const DEPLOYMENT_FAULT_ERRNOS = new Set(WHOLE_CODE_ROWS.flatMap((r) => (r.errno === undefined ? [] : [r.errno])));
|
|
174
|
+
const INNER_DISCRIMINATED_ROWS = DEPLOYMENT_FAULT_ERRORS.flatMap((r) => (r.innerErrnos === undefined ? [] : [{ ...r, innerErrnos: r.innerErrnos }]));
|
|
175
|
+
const CREATE_TABLE_REFUSAL_SENTENCE = /^Can't create table (?:`[^`]*`(?:\.`[^`]*`)?|'[^']*') \(errno: (\d{1,5})(?: [^()]*)?\)\s*$/;
|
|
176
|
+
function engineInnerErrnoOf(err) {
|
|
177
|
+
const said = keyOf(err, "sqlMessage");
|
|
178
|
+
const text = typeof said === "string" ? said : keyOf(err, "message");
|
|
179
|
+
if (typeof text !== "string" || text.length > 2000)
|
|
180
|
+
return undefined;
|
|
181
|
+
const m = CREATE_TABLE_REFUSAL_SENTENCE.exec(text);
|
|
182
|
+
return m === null ? undefined : Number(m[1]);
|
|
183
|
+
}
|
|
158
184
|
export function isDeploymentFaultError(err) {
|
|
159
185
|
if (err === null || typeof err !== "object")
|
|
160
186
|
return false;
|
|
161
187
|
const code = keyOf(err, "code");
|
|
162
188
|
const errno = keyOf(err, "errno");
|
|
163
|
-
|
|
189
|
+
if ((typeof code === "string" && DEPLOYMENT_FAULT_CODES.has(code)) || (typeof errno === "number" && DEPLOYMENT_FAULT_ERRNOS.has(errno)))
|
|
190
|
+
return true;
|
|
191
|
+
const wrapper = INNER_DISCRIMINATED_ROWS.find((r) => (typeof code === "string" && code === r.code) || (typeof errno === "number" && errno === r.errno));
|
|
192
|
+
if (wrapper === undefined)
|
|
193
|
+
return false;
|
|
194
|
+
const inner = engineInnerErrnoOf(err);
|
|
195
|
+
return inner !== undefined && wrapper.innerErrnos.includes(inner);
|
|
196
|
+
}
|
|
197
|
+
export function databaseAnswerCodesOf(dialect, err) {
|
|
198
|
+
const code = keyOf(err, "code");
|
|
199
|
+
const symbol = typeof code === "string" && /^[A-Za-z0-9_]{1,64}$/.test(code) ? code : undefined;
|
|
200
|
+
if (dialect === "pg")
|
|
201
|
+
return symbol !== undefined && /^[0-9A-Z]{5}$/.test(symbol) ? `SQLSTATE ${symbol}` : undefined;
|
|
202
|
+
const errno = keyOf(err, "errno");
|
|
203
|
+
const sqlState = keyOf(err, "sqlState");
|
|
204
|
+
const parts = [];
|
|
205
|
+
if (typeof errno === "number" && Number.isInteger(errno))
|
|
206
|
+
parts.push(symbol !== undefined ? `errno ${errno} ${symbol}` : `errno ${errno}`);
|
|
207
|
+
else if (symbol !== undefined)
|
|
208
|
+
parts.push(`code ${symbol}`);
|
|
209
|
+
if (typeof sqlState === "string" && /^[0-9A-Za-z]{5}$/.test(sqlState))
|
|
210
|
+
parts.push(`SQLSTATE ${sqlState}`);
|
|
211
|
+
return parts.length === 0 ? undefined : parts.join(", ");
|
|
164
212
|
}
|
|
165
213
|
export class StoreRowTooLargeError extends Error {
|
|
166
214
|
row;
|
|
@@ -53,15 +53,16 @@ import type { SqlDialect } from "./sql-driver.js";
|
|
|
53
53
|
*/
|
|
54
54
|
export declare function jsonColumnText(dialect: SqlDialect, column: string, member?: JsonColumnMember): string;
|
|
55
55
|
/**
|
|
56
|
-
* 一列 JSON
|
|
57
|
-
* · `
|
|
56
|
+
* 一列 JSON 的**一个成员**(NP-3,7.100.0)—— 读腿只要文档里的一棵子树 / 一格时用它,整只文档不出引擎。
|
|
57
|
+
* · `path` = 自顶层往下的成员名(一段或多段,每段裸标识符;进 MySQL 路径 `'$.<a>.<b>'` 与 PG 链 `-> '<a>' -> '<b>'`,所以只认裸标识符,不转义不猜)。
|
|
58
|
+
* 一段 = 顶层成员(`["pendingAction"]`),多段 = 成员里的成员(`["state", "rowTaskId"]`);一段的产物与多段形之前的写法逐字节同;
|
|
58
59
|
* · `as` = 行上的键(**小写**裸标识符:PG 把不带引号的别名折成小写,别的拼法会让两方言的行键不同)。
|
|
59
|
-
* 产物仍是**文本**(同一条「按文本投影、恰好解一次」)
|
|
60
|
-
* 所以读腿用 {@link decodeNullableJsonColumn}:NULL =
|
|
61
|
-
*
|
|
60
|
+
* 产物仍是**文本**(同一条「按文本投影、恰好解一次」),路径上任一段缺席 / 不是对象 ⇒ SQL NULL(两引擎同答),
|
|
61
|
+
* 所以读腿用 {@link decodeNullableJsonColumn}:NULL = 「这份文档没有这一格」,JSON `null` 字面 = 一个值(交形读者判)。
|
|
62
|
+
* 读者:`checkpoint-store-sql.ts` 的 `listPending`(运维队列 / `/v1/approvals/stream` 热读)与 `one-time-migrations.ts` 的 M21。
|
|
62
63
|
*/
|
|
63
64
|
export interface JsonColumnMember {
|
|
64
|
-
readonly
|
|
65
|
+
readonly path: readonly [string, ...string[]];
|
|
65
66
|
readonly as: string;
|
|
66
67
|
}
|
|
67
68
|
/**
|
|
@@ -82,7 +83,7 @@ export interface JsonColumnMember {
|
|
|
82
83
|
* 子树,本函数的插值对它是一个不透明表达式。所以「误用进 SELECT 投影且没给别名」这一形没有机器门 ——
|
|
83
84
|
* 误用的落点是真库上当场的 `SqlJsonColumnError("not-text")` 响亮抛(行上没有那个键 ⇒ `undefined`),不是静默。
|
|
84
85
|
*/
|
|
85
|
-
export declare function jsonColumnTextExpr(dialect: SqlDialect, column: string,
|
|
86
|
+
export declare function jsonColumnTextExpr(dialect: SqlDialect, column: string, memberPath?: JsonColumnMember["path"]): string;
|
|
86
87
|
/**
|
|
87
88
|
* 一列 JSON 的**投影文本的 sha256**(十六进制小写,引擎内算 —— 整只文档不出库),带别名。输入恰是 {@link jsonColumnTextExpr} 那一只投影:
|
|
88
89
|
* 同一行、同一次读里,本表达式的摘要就是 {@link jsonColumnText} 交给读腿的那串字节的摘要,于是「字节没变 ⇒ 摘要没变」只有一种读法。
|
|
@@ -6,19 +6,23 @@ export function jsonColumnText(dialect, column, member) {
|
|
|
6
6
|
if (!MEMBER_ALIAS_RE.test(member.as)) {
|
|
7
7
|
throw new Error(`jsonColumnText: member alias ${JSON.stringify(member.as)} must be a lower-case bare identifier — PostgreSQL folds unquoted aliases to lower case, so any other spelling would give the two dialects different row keys`);
|
|
8
8
|
}
|
|
9
|
-
return `${jsonColumnTextExpr(dialect, column, member.
|
|
9
|
+
return `${jsonColumnTextExpr(dialect, column, member.path)} AS ${member.as}`;
|
|
10
10
|
}
|
|
11
11
|
const MEMBER_ALIAS_RE = /^[a-z_][a-z0-9_]*$/;
|
|
12
|
-
export function jsonColumnTextExpr(dialect, column,
|
|
12
|
+
export function jsonColumnTextExpr(dialect, column, memberPath) {
|
|
13
13
|
if (!COLUMN_NAME_RE.test(column)) {
|
|
14
14
|
throw new Error(`jsonColumnTextExpr: ${JSON.stringify(column)} is not a bare column identifier — refusing to splice it into SQL text`);
|
|
15
15
|
}
|
|
16
|
-
if (
|
|
16
|
+
if (memberPath === undefined)
|
|
17
17
|
return dialect === "pg" ? `${column}::text` : `CAST(${column} AS CHAR)`;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
for (const segment of memberPath) {
|
|
19
|
+
if (!COLUMN_NAME_RE.test(segment)) {
|
|
20
|
+
throw new Error(`jsonColumnTextExpr: member ${JSON.stringify(segment)} is not a bare identifier — refusing to splice it into a JSON path`);
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
|
-
return dialect === "pg"
|
|
23
|
+
return dialect === "pg"
|
|
24
|
+
? `(${column}::jsonb ${memberPath.map((segment) => `-> '${segment}'`).join(" ")})::text`
|
|
25
|
+
: `CAST(JSON_EXTRACT(${column}, '$.${memberPath.join(".")}') AS CHAR)`;
|
|
22
26
|
}
|
|
23
27
|
export function jsonColumnTextSha256(dialect, column, as) {
|
|
24
28
|
if (!MEMBER_ALIAS_RE.test(as)) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 「停-迁-起」那一段的**唯一属主**。
|
|
3
|
+
*
|
|
4
|
+
* 一次性迁移里有几条(登记表 `stopThenStart` 一格点名的)改的是更早版本的副本还会继续写的形:改完之后它再写一笔,这一笔读不出 / 丢掉。它们没有运行期开关,
|
|
5
|
+
* 起服时由守卫判 —— 判活窗内(`REAP_RUN_STALE_SEC`,收割器判 run 持有者还活着的同一个窗)库里还有 `running` run 在心跳 ⇒ 拒启、一字节不写。
|
|
6
|
+
* 四只守卫(M40 · M41 · M42 · M51)的拒句和起服列册对账的升级清单**说同一件事**:先停光更早版本的副本、等满判活窗、再起本版。
|
|
7
|
+
* 这件事的句子只在这里写一遍;各守卫只讲「为什么这一条要停」,不各抄一份动作段。
|
|
8
|
+
*
|
|
9
|
+
* 叶子模块:零 import(守卫所在的一次性迁移文件、M42 的拒句文件与列册对账都静态 import 它,不成环)。
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* 动作段:停光 → 等窗 → 再起。`after` = 全停之后可以再起的最早时刻(守卫读到的最新心跳 + 判活窗,人读形);
|
|
13
|
+
* 缺席 ⇒ 读不到具体心跳(列册对账的清单:此刻没有守卫在判),只说「等满判活窗」。
|
|
14
|
+
*/
|
|
15
|
+
export declare function stopThenStartAction(after?: string): string;
|
|
16
|
+
//# sourceMappingURL=stop-then-start-sentence.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function stopThenStartAction(after) {
|
|
2
|
+
return ("Stop every replica of the earlier version, then start this version (stop, migrate, start — this release cannot be rolled across replicas of both versions). " +
|
|
3
|
+
(after === undefined
|
|
4
|
+
? "Wait out the heartbeat window (REAP_RUN_STALE_SEC) after the last replica stops, then start this version."
|
|
5
|
+
: `If every replica is already stopped, those are the runs they left behind: start this version again after ${after}`));
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=stop-then-start-sentence.js.map
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { Pool as MysqlPool } from "mysql2/promise";
|
|
2
2
|
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
|
+
import { FileStorageBackend } from "@sema-agent/core";
|
|
4
5
|
import { type OutcomeSink } from "./file-outcome-sink.js";
|
|
5
6
|
import { type InboxWarn } from "./workflow-run-store-sql.js";
|
|
6
7
|
import { FileRunStore } from "./file-run-store.js";
|
|
7
|
-
import { type
|
|
8
|
+
import { type RunStallWiring } from "./store-contracts.js";
|
|
9
|
+
import { type StoreOpenLane } from "./store-open-refusal.js";
|
|
10
|
+
import { type OneTimeMigrationReport, type SqlOneTimeMigrationInput } from "./one-time-migrations.js";
|
|
11
|
+
import { LocalSessionStore } from "./local-session-store.js";
|
|
12
|
+
import { type LocalStoreDeclaration } from "../local-store-declaration.js";
|
|
8
13
|
import type { LocalSessionRows } from "./local-session-window.js";
|
|
9
14
|
import type { SessionHeadReader } from "./caching-session-store.js";
|
|
10
15
|
import { LocalCheckpointStore } from "./local-checkpoint-store.js";
|
|
@@ -34,21 +39,37 @@ import { PgRateLimiter } from "./pg-rate-limiter.js";
|
|
|
34
39
|
import { type SqlSharedMemoryStore, type SharedMemoryScopeAuthorizer } from "./shared-memory-store-sql.js";
|
|
35
40
|
import { type AdoptionLogStore } from "./adoption-log-sql.js";
|
|
36
41
|
import { type SqlTransactionHooks } from "../stores-sql/retention-store-sql.js";
|
|
37
|
-
import type {
|
|
42
|
+
import type { SessionEraser } from "../session-erase.js";
|
|
38
43
|
import { type RetentionDestructiveInput, type RetentionExecutor, type RetentionExecutorOptions } from "./retention-deployment.js";
|
|
39
44
|
import { type RetentionLaneStore } from "./retention-lane-store-sql.js";
|
|
45
|
+
import { type LocalDataRootAdmission } from "./local-data-root-admission.js";
|
|
40
46
|
import type { PermissionRuleStoreBundle } from "../rules-consent.js";
|
|
41
47
|
import { type SqlDriver } from "./sql-driver.js";
|
|
42
|
-
import { type StoreDegradedReason } from "../store-posture.js";
|
|
48
|
+
import { type StoreDegradedReason, type StoreDurability as MediumDurability } from "../store-posture.js";
|
|
43
49
|
/** boot 期的一条日志座(级别由**座位**决定,不由参数携带):`createStoreBackend` 的 `onWarn` / `onError`
|
|
44
50
|
* 两参与 `LocalBackend` 的同名字段共用此形。装配层把它们分别接到 `logger.warn` / `logger.error` 上。 */
|
|
45
51
|
export type BootLogSink = (msg: string, meta?: Record<string, unknown>) => void;
|
|
52
|
+
/**
|
|
53
|
+
* 后端交给店的**观测座**(加项、可缺席:嵌入方 / 测试不给 ⇒ 不计数)。今天一格:run 店每落下 n 条死亡判决(收割器 / 观察口 / 认领冲突同一只)
|
|
54
|
+
* ⇒ `runStallVerdicts(n)`(生产装配 = `runs_reaped_total{kind:"stale"}`,`boot/stores.ts`)。
|
|
55
|
+
*/
|
|
56
|
+
export interface StoreBackendObservers {
|
|
57
|
+
readonly runStallVerdicts?: (landed: number) => void;
|
|
58
|
+
}
|
|
59
|
+
/** 开店时递进来的起服事实(只 local 腿读):数据根介质的判定(起服第 2 段的取证;缺席 = 这条入口没有起服证据 ⇒ 按 `unknown` 读 —— 判不出的介质不放宽 local 店的声明)。 */
|
|
60
|
+
export interface StoreOpenFacts {
|
|
61
|
+
readonly dataRootMedium?: MediumDurability;
|
|
62
|
+
}
|
|
63
|
+
/** run 店落死亡判决的两样:窗 = 后端持有的配置对象的 `runStaleSec`(热发布原地改写 ⇒ getter 读到热值;判活窗只有这一个来源)+ 计数座。 */
|
|
64
|
+
export declare function createRunStallWiring(config: Pick<ServiceConfig, "runStaleSec">, observers: StoreBackendObservers | undefined): RunStallWiring;
|
|
46
65
|
export type RunStore = TiDBRunStore | PgRunStore | FileRunStore;
|
|
47
66
|
/** E18 resume-at eventId→entryId anchor map — tidb/pg/local 3-backend (works LOCAL; needs only the session tree +
|
|
48
67
|
* this map, no cloud-only checkpoint). Union = the three nominal twins; consumers use put/resolve/deleteBySession.
|
|
49
68
|
* FileResumeAnchorStore is the FILE-backed local twin (P0.5 variant-1; survives restart). */
|
|
50
69
|
export type ResumeAnchorStore = TiDBResumeAnchorStore | PgResumeAnchorStore | FileResumeAnchorStore;
|
|
51
70
|
export type { ApprovalExemptionStore } from "./approval-exemption-store.js";
|
|
71
|
+
/** 会话树根的写(事务内钩的写闭集,`stores-sql/session-write-hooks.ts`):本组合座转口给目录外的判官(`execution-placement.ts` 的 `judgeSessionWrite`;local 店的写锁内同一组词)。 */
|
|
72
|
+
export type { SessionWrite } from "../stores-sql/session-write-hooks.js";
|
|
52
73
|
export type { ApprovalNonceStore } from "./approval-nonce-store.js";
|
|
53
74
|
/** [ref]([ref] v3.1 §3.0-§3.2 流内审批协议持久层):`ApprovalAskStore` 接口 + 行/补丁类型。
|
|
54
75
|
* 车3 刀 3a 起 `StoreBackend.approvalAsk()` 已在(见接口体的那条注)。 */
|
|
@@ -160,7 +181,7 @@ export type SessionCaptureRecordSource = (plane?: {
|
|
|
160
181
|
}) => SessionCaptureRecordStore;
|
|
161
182
|
export interface StoreBackend {
|
|
162
183
|
/** Protocol-truth kind (clay 2026-07-06 wording): "mysql" = any MySQL-protocol server (MySQL / TiDB /
|
|
163
|
-
* MariaDB) behind the one mysql2 pool — the startup summary prints
|
|
184
|
+
* MariaDB) behind the one mysql2 pool — the startup summary prints `mysql` for all of them. */
|
|
164
185
|
readonly kind: "mysql" | "pg" | "local";
|
|
165
186
|
/** Connect + create schema (also the reachability probe). On the SQL backends it first checks the database for the
|
|
166
187
|
* schema that the one-time migrations of server 7.74.0–7.125.x retired and **refuses** with `RetiredSchemaPresentError`
|
|
@@ -229,7 +250,7 @@ export interface StoreBackend {
|
|
|
229
250
|
userInputLedger(): UserInputLedgerStore;
|
|
230
251
|
/** E6 durable SessionPolicyStore (operator-tightened per-session tool rules). REQUIRED on all backends — works local
|
|
231
252
|
* (local = core's FileSessionPolicyStore), like resumeAnchor. Backs core's RunnerDeps.sessionPolicyStore.
|
|
232
|
-
* `logger`:SQL 孪生抹除封键那一臂([ref])的点名口(
|
|
253
|
+
* `logger`:SQL 孪生抹除封键那一臂([ref])的点名口(装配点缺省交日志出口接缝的 logger);local(core 的 File 店)不收。 */
|
|
233
254
|
sessionPolicy(logger?: SessionPolicyStoreLogger): ServiceSessionPolicyStore;
|
|
234
255
|
/** [ref] per-edited-file rewind FileHistoryStore (trackEdit/annulTrack/snapshot/restore over the tracked set;
|
|
235
256
|
* also the 2c history-transfer store). REQUIRED on all backends (local = core's file-backed
|
|
@@ -371,6 +392,11 @@ export interface StoreBackend {
|
|
|
371
392
|
* `retention-deployment.ts` 的 `RetentionExecutorOptions`)。组合形见 {@link createSqlRetentionExecutor}。
|
|
372
393
|
*/
|
|
373
394
|
retention?(opts: RetentionExecutorOptions): RetentionExecutor;
|
|
395
|
+
/**
|
|
396
|
+
* 删净一只会话的**执行体**(`session-erase.ts` 的 `SessionEraser`;在线删除协调器调它)—— 与 {@link retention} 的会话树清扫同一段事务体(组合 `createSqlSessionEraser`)。
|
|
397
|
+
* **SQL 后端专有**:local 的执行体是会话店写锁一节(`session-erase.ts` 的 `createLocalSessionEraser`),各店在 boot 里才齐,由删除协调器自己组。
|
|
398
|
+
*/
|
|
399
|
+
sessionEraser?(opts: RetentionExecutorOptions): SessionEraser;
|
|
374
400
|
/**
|
|
375
401
|
* [ref] 车2 —— 留存执行面的**非破坏性**半场:sweep 租约、legal-hold 的放置/解除、审计表的读与
|
|
376
402
|
* 非破坏行的写。同样 SQL 专有(它写的三张表只在 SQL schema 里)。
|
|
@@ -406,31 +432,43 @@ export interface StoreBackend {
|
|
|
406
432
|
* 拒绝句不带盘上位置)的同时,路径进本 backend 的 `file_store_corrupt_read` 披露座(逐命中 warn)。修前 `boot/stores.ts` 在同一数据根上自己
|
|
407
433
|
* `new FileUsageWindowStore(root)` 第二只实例、不接座 ⇒ 坏值只拒不披露,运维找不到是哪只文件。SQL 后端省略(它们有自己的 usage-window 双方言店)。 */
|
|
408
434
|
fileUsageWindowStore?(): UsageWindowStore;
|
|
435
|
+
/** **local 后端专有**:构造时交给两半店(会话店顶层、检查点店)的那一份声明(唯一读者 `localStoreDeclarationOf`)—— 装配值从这里读回,不重算。SQL 后端省略。 */
|
|
436
|
+
localStoreDeclaration?(): LocalStoreDeclaration;
|
|
409
437
|
}
|
|
410
438
|
/**
|
|
411
|
-
* 托管留存执行器的**组合**:引擎座表那一半(`SqlRetentionStore`,事务属主)+ 部署那一半(hold / 审计 / 认领判 /
|
|
439
|
+
* 托管留存执行器的**组合**:引擎座表那一半(`SqlRetentionStore`,事务属主)+ 部署那一半(hold / 审计 / 认领判 / 十三张部署表,
|
|
412
440
|
* `plugins/retention-deployment.ts`,经 K4 事务内钩参与同一事务)。
|
|
413
441
|
*
|
|
414
442
|
* 破坏性三方法**每次调用**铸一只执行器、钩表绑这一次调用(`createRetentionDeploymentHooks` 的头注:审计行的判定时点三格与
|
|
415
|
-
* `checkpoint_ctx` 属主门的域是这一次调用的事实)。会话树删除的 `
|
|
443
|
+
* `checkpoint_ctx` 属主门的域是这一次调用的事实)。会话树删除的 `erased`(交收尾的那一份)由执行器的行面回执 + 部署收集的附件哈希拼成,
|
|
416
444
|
* 只在执行器**提交成功返回之后**挂上回执(回滚 ⇒ 执行器抛,不挂)。非破坏两口(域枚举 / 预览)不经钩。
|
|
417
445
|
*/
|
|
418
446
|
/**
|
|
419
447
|
* 一次破坏性调用的整张事务内钩表:部署的 `retention` 组(按这一次调用铸,`createRetentionDeploymentHooks`)+ 会话座的钩
|
|
420
|
-
* (`createSqlSessionWriteHooks`,会话店用的同一只工厂;留存删除走它的 `retention-delete` 臂)。`
|
|
448
|
+
* (`createSqlSessionWriteHooks`,会话店用的同一只工厂;留存删除走它的 `retention-delete` 臂)。`attachmentShas` 读部署那一半收到的行。
|
|
421
449
|
*/
|
|
422
450
|
export declare function createSqlRetentionCallHooks(db: SqlDriver, opts: RetentionExecutorOptions, input: RetentionDestructiveInput): {
|
|
423
451
|
readonly hooks: SqlTransactionHooks;
|
|
424
|
-
|
|
452
|
+
attachmentShas(): readonly string[];
|
|
425
453
|
};
|
|
426
454
|
export declare function createSqlRetentionExecutor(db: SqlDriver, opts: RetentionExecutorOptions): RetentionExecutor;
|
|
455
|
+
/**
|
|
456
|
+
* **删净一只在删会话的 SQL 执行体**(`session-erase.ts` 的 `SessionEraser`):执行器的 `eraseSession` —— 与留存清扫同一段会话树事务体,前面是锁行 + 属主 +
|
|
457
|
+
* 会话座事务内钩的 `erase` 判(这一行处于这只令牌的在删态)。行不在 / 属主不是那一位 / 令牌不是它(`SessionDeletionSupersededError`)⇒ `superseded`,别的拒原样抛。
|
|
458
|
+
* 部署行那一半用与留存同一只钩(`createSessionRowsHook`,域 = 围栏判过的属主),附件哈希随回执交收尾。
|
|
459
|
+
* `opts` 与留存执行器同一份(附件 / 任务清单两张表在不在是 boot 的事实)。
|
|
460
|
+
*/
|
|
461
|
+
export declare function createSqlSessionEraser(db: SqlDriver, opts: RetentionExecutorOptions): SessionEraser;
|
|
427
462
|
/** (c)(clay 拍 a+c,2026-07-27;[ref] 换店后域=file_history_blob,门与旋钮名不变)云形 blob 姿势门——
|
|
428
|
-
* boot 时调用(boot/stores.ts),纯函数可单测。SQL 后端(mysql|pg)把 blob
|
|
463
|
+
* boot 时调用(boot/stores.ts),纯函数可单测。SQL 后端(mysql|pg)把 blob 字节落单行的形,mysql 腿已被两役
|
|
429
464
|
* 实证撞 mysql-协议包墙(D-1 附件 → 对象存储裁定):大字节归对象存储。per-file 历史的 blob=单文件
|
|
430
465
|
* 字节,同一堵墙(>6MiB 的被 track 文件在 TiDB 上落不进 SQL 行 ⇒ trackEdit 拒 ⇒ 默认 DV-14 下该次
|
|
431
|
-
* 编辑被拒)
|
|
432
|
-
*
|
|
466
|
+
* 编辑被拒);pg 腿本服务不建模这两堵墙(只有一个 bytea 值的 1 GB 硬上限、没有推出来的缺省帽),同一条裁定、拒句只说各自方言的事实
|
|
467
|
+
* ({@link SQL_BLOB_POSTURE_FACTS})。云形缺 MinIO ⇒ fail-loud(启动了才是假安全);`SNAPSHOT_BLOB_ALLOW_SQL_BYTES=true` =
|
|
468
|
+
* 显式接受 SQL 店 + per-blob 帽(单机/测试台形;pg 上帽只来自 `SNAPSHOT_BLOB_SQL_MAX_BYTES`)。local 后端不经此门(file 店,无 SQL 包墙)。 */
|
|
433
469
|
export declare function assertCloudSnapshotBlobPosture(kind: "mysql" | "pg" | "local", config: Pick<ServiceConfig, "snapshotBlobStore" | "snapshotBlobAllowSql">): void;
|
|
470
|
+
/** SQL 一次性迁移段的输入(两只 SQL 后端同一份;各条目那一半的来源见 `SqlOneTimeMigrationInput`):M32 的车道表 · M40 的判活窗 = 收割器的同一个窗 · M48 的部署形读数(表里那一行)。 */
|
|
471
|
+
export declare function buildSqlOneTimeMigrationInput(config: ServiceConfig): SqlOneTimeMigrationInput;
|
|
434
472
|
/**
|
|
435
473
|
* LOCAL backend (clay 2026-06-25 seamless local↔cloud; P0.5 variant-2 + variant-1 file-backed 2026-06-26): a DB-less StoreBackend
|
|
436
474
|
* so a locally-run HTTP service serves the SAME contract a cloud worker does (runs + trace + sessions + resume;
|
|
@@ -461,6 +499,8 @@ export declare function assertCloudSnapshotBlobPosture(kind: "mysql" | "pg" | "l
|
|
|
461
499
|
* projection and its log export — and `undefined` on any other backend. The one place that answers "is there a local store to read rows from".
|
|
462
500
|
*/
|
|
463
501
|
export declare function localSessionRowsOf(backend: StoreBackend | undefined): LocalSessionRows | undefined;
|
|
502
|
+
/** local 车道的客户端写计数口(附件店绑定时计数,`session-birth.ts`):本地后端那一只会话店;别的后端 ⇒ `undefined`(SQL 附件店在自己的认领事务里计数)。 */
|
|
503
|
+
export declare function localClientWritesOf(backend: StoreBackend | undefined): Pick<LocalSessionStore, "withClientWrite"> | undefined;
|
|
464
504
|
/**
|
|
465
505
|
* 启动日志里「跨副本 or 进程内」那一格的标签。
|
|
466
506
|
*
|
|
@@ -474,6 +514,44 @@ export declare function localSessionRowsOf(backend: StoreBackend | undefined): L
|
|
|
474
514
|
* 而兄弟行都写 `shared(${kind})`。)
|
|
475
515
|
*/
|
|
476
516
|
export declare function counterStoreLabel(store: unknown, kind: string | undefined): string;
|
|
517
|
+
/**
|
|
518
|
+
* 打开 local 数据根的那一只后端(打开成功的 {@link LocalBackend} 或打开那一刻被拒的 {@link RefusedLocalBackend}):`StoreBackend` 之外多一只口 ——
|
|
519
|
+
* 引擎 File 后端上**会话店之外**本仓没有自己一份的那几只店({@link LocalEngineFileStores};run-local 的 Runner 接它们)。会话行店不在其中:行只经本仓的会话店读(`session()`)。
|
|
520
|
+
*/
|
|
521
|
+
export interface LocalStoreBackend extends StoreBackend {
|
|
522
|
+
readonly kind: "local";
|
|
523
|
+
engineFileStores(): LocalEngineFileStores;
|
|
524
|
+
/** local 后端恒有(引擎 File 后端的工具结果店;接口上可选的那一口在这里必在)。 */
|
|
525
|
+
toolResult(): ToolResultStoreFull;
|
|
526
|
+
/** local 后端恒有(引擎 File 后端的用量窗账本;接口上可选的那一口在这里必在)。 */
|
|
527
|
+
fileUsageWindowStore(): UsageWindowStore;
|
|
528
|
+
/** local 后端恒有(构造时交给两半店的声明;接口上可选的那一口在这里必在)。 */
|
|
529
|
+
localStoreDeclaration(): LocalStoreDeclaration;
|
|
530
|
+
}
|
|
531
|
+
/** 引擎 File 后端上会话店之外、本仓没有自己一份口的店(run-local 的 Runner 接它们;工具结果 / 用量窗 / 会话规则走既有的 `toolResult()` / `fileUsageWindowStore()` / `sessionPolicy()` 口)。 */
|
|
532
|
+
export type LocalEngineFileStores = Pick<FileStorageBackend, "checkpointStore" | "backgroundAgentStore" | "mailboxStore" | "rosterStore">;
|
|
533
|
+
/** 打开 local 数据根的入口参数:哪条路在开(只决定拒句的措辞 —— 表头与「换根」半句)与三只 boot 期日志座(见 {@link createStoreBackend})。 */
|
|
534
|
+
export interface LocalBackendOpenOptions {
|
|
535
|
+
readonly lane: StoreOpenLane;
|
|
536
|
+
/** 这只根的数据根准入读数(必填;{@link admitLocalDataRoot} 铸,调用方在它对这只根的第一笔写之前取 —— 打开就是第一笔写的调用方当场取,见 {@link createStoreBackend})。 */
|
|
537
|
+
readonly admission: LocalDataRootAdmission;
|
|
538
|
+
readonly onWarn?: BootLogSink;
|
|
539
|
+
readonly onError?: BootLogSink;
|
|
540
|
+
readonly observers?: StoreBackendObservers;
|
|
541
|
+
/** 起服事实(数据根介质的判定;HTTP 服务递第 2 段的取证,缺席 ⇒ `unknown`)。 */
|
|
542
|
+
readonly facts?: StoreOpenFacts;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* **local 后端打开数据根**(唯一的路 —— 本仓每一条打开 local 数据根的入口都经它:`createStoreBackend` 的 local 腿(HTTP 服务)与 run-local;一个数据根一只会话行店、一份装配):
|
|
546
|
+
* 数据根准入(调用方交来的读数 `opts.admission`,判已在本进程第一笔写之前做完)→ 取锁(引擎 File 后端:建根、锁文件、引擎自己的店目录与空账本)→
|
|
547
|
+
* **锁内一步**({@link holdLocalDataRootAdmission}:核物理数据根与准入那一次观察都没动 → 跳版臂记 / 销账 → 抬引擎版本高水位)→ 本仓的店。
|
|
548
|
+
* 打开之后的公开序列两条入口相同:`ensureSchema()`(起服对账)→ `runOneTimeMigrations()` → 才读会话。
|
|
549
|
+
* 抬住在这里而不是 `ensureSchema()` 里,因为围栏以**第一笔落盘**界定:本仓的店在构造里就会写(撕裂的问账日志留证 + 压实、撕裂的 run 认领挪开、会话收尾的活跃边档落盘),
|
|
550
|
+
* 抬必须先于它们(写到一半崩了,水位已是本构建)。所以这一段之后才有店,没有任何一只店先于它。
|
|
551
|
+
* 锁内一步拒(准入判过的输入在准入之后被另一只引擎动过 / 记账或抬写不进)或本仓的店构造时抛 ⇒ 交回一只 {@link RefusedLocalBackend}:只握着锁,`ensureSchema()` 交出那一只拒
|
|
552
|
+
* (公开序列在它该在的那一步拒,降级臂按拒的族判),`close()` 只放锁 —— 没有店、没有收尾写。
|
|
553
|
+
*/
|
|
554
|
+
export declare function openLocalBackend(config: ServiceConfig, opts: LocalBackendOpenOptions): LocalStoreBackend;
|
|
477
555
|
/** Build the durable-store backend for `config.dbBackend`. Does NOT connect (the pool connects lazily); the next
|
|
478
556
|
* step is `ensureSchema()` (retired-schema check, then the CREATEs; it is also the reachability probe), then
|
|
479
557
|
* `runOneTimeMigrations()`. Returns undefined when no DB is configured.
|
|
@@ -484,7 +562,9 @@ export declare function counterStoreLabel(store: unknown, kind: string | undefin
|
|
|
484
562
|
* `onError` (additive, optional; F-D) is the **error-level** twin of that seat — 件6 的
|
|
485
563
|
* `file_run_store_hydrate_unreadable` 按成文承诺是 error 级,warn 座满足不了那句话。两座都是**加项**:
|
|
486
564
|
* 既有一/二参调用方逐字不变(缺席 ⇒ 该披露退回 warn 座 / 只剩 fail-open 遥测那一半)。 */
|
|
487
|
-
export declare function createStoreBackend(config: ServiceConfig, onWarn?: BootLogSink, onError?: BootLogSink): StoreBackend | undefined;
|
|
565
|
+
export declare function createStoreBackend(config: ServiceConfig, onWarn?: BootLogSink, onError?: BootLogSink, observers?: StoreBackendObservers): StoreBackend | undefined;
|
|
566
|
+
/** local 后端的数据根(`createStoreBackend` 交给 `LocalBackend` 的那一只,与 {@link openStoreBackendWithFallback} 的降级判据、起服第 2 段的持久性取证读同一只)。 */
|
|
567
|
+
export declare function localBackendRootOf(config: Pick<ServiceConfig, "localDataRoot">): string;
|
|
488
568
|
/** boot 期打开 store 后端的**统一入口**:构造 + ensureSchema 同罩一层降级臂。
|
|
489
569
|
*
|
|
490
570
|
* 为什么必须把 `createStoreBackend()` 也罩进来(2026-07-28 修):clay 1.292 拍的口径是「裸 boot
|
|
@@ -507,7 +587,7 @@ export declare function createStoreBackend(config: ServiceConfig, onWarn?: BootL
|
|
|
507
587
|
export declare function openStoreBackendWithFallback(config: ServiceConfig, logger: {
|
|
508
588
|
warn: (msg: string, meta?: Record<string, unknown>) => void;
|
|
509
589
|
error?: (msg: string, meta?: Record<string, unknown>) => void;
|
|
510
|
-
}): Promise<{
|
|
590
|
+
}, observers?: StoreBackendObservers, localAdmission?: LocalDataRootAdmission, facts?: StoreOpenFacts): Promise<{
|
|
511
591
|
backend: StoreBackend | undefined;
|
|
512
592
|
degradedReason: StoreDegradedReason | undefined;
|
|
513
593
|
}>;
|
|
@@ -521,8 +601,11 @@ export declare function openStoreBackendWithFallback(config: ServiceConfig, logg
|
|
|
521
601
|
export declare function sqlStoreCoordinatesAsUrl(config: Pick<ServiceConfig, "dbBackend" | "tidb" | "pg">): string;
|
|
522
602
|
/**
|
|
523
603
|
* SQL 族「配了 DSN 而店打不开(窗内重试过了)」的拒启句(唯一铸点)。点名 `DB_BACKEND=<引擎>`、库的显示安全形(`postgres://host:port` / `mysql://host:port`,经 {@link sqlStoreCoordinatesAsUrl} 拼出、再过 {@link buildDisplaySafeUrl},
|
|
524
|
-
* 不带口令)
|
|
525
|
-
*
|
|
604
|
+
* 不带口令)、等了多久,出路按**失败类**走(判官 = 整仓一只的 {@link isDeploymentFaultError}),都含**显式**内存部署(`DB_BACKEND=memory`):
|
|
605
|
+
* · 库**确定拒**了一条语句(部署错配类:缺表 / 权限拒 / 建外键被拒 …)⇒ 等与改坐标都改变不了答案,出路是库里被点名的那一件(表引擎 / 主键 / 外键相容 / 授权);拒句带库答的 errno / SQLSTATE 原码
|
|
606
|
+
* ({@link databaseAnswerCodesOf});
|
|
607
|
+
* · 其余(连不上 / 超时 / 认不出)⇒ 修坐标 / 连通性(窗是 `STORE_LOCK_WAIT_MS`)。
|
|
608
|
+
* 🔴 没有第三条「`SESSION_BACKEND=auto` 内存起服」—— 那一条就是被删掉的静默降级。驱动原文只取 message(与修前 `fatalExit` 打出的同一句),凭据不在其中(驱动不回显口令);原码段只经闭字符形读取。
|
|
526
609
|
*/
|
|
527
610
|
export declare function buildSqlStoreOpenRefusal(engine: "mysql" | "pg", endpoint: string, waitedMs: number, err: unknown): string;
|
|
528
611
|
//# sourceMappingURL=store-backend.d.ts.map
|