@sema-agent/server 7.134.0 → 7.136.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 +197 -1
- package/USAGE.md +147 -42
- package/deploy/sema-up/README.md +1 -1
- package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
- package/deploy/sema-up/chart/values.yaml +1 -1
- package/dist/adoption/plan.d.ts +1 -1
- package/dist/approval-ask-audit-store.d.ts +24 -24
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +122 -154
- package/dist/approval-card.js +50 -51
- package/dist/approval-content-kind.d.ts +23 -5
- package/dist/approval-content-kind.js +8 -1
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval-gate-currency.d.ts +22 -3
- package/dist/approval-gate-currency.js +44 -18
- package/dist/approval-hmac.d.ts +7 -7
- package/dist/approval-policy-settlement.d.ts +2 -2
- package/dist/approval-reconciler.d.ts +3 -3
- package/dist/approval.d.ts +8 -8
- package/dist/approval.js +4 -2
- package/dist/auth-bridge.d.ts +35 -6
- package/dist/auth-bridge.js +20 -3
- package/dist/auto-mode-face.d.ts +4 -4
- package/dist/background-session-reap.d.ts +2 -2
- package/dist/bake-runner/main.d.ts +2 -2
- package/dist/bake-runner/runner.d.ts +4 -4
- package/dist/bench/s1/live-deps.d.ts +1 -1
- package/dist/bench/s1/run-firm.d.ts +1 -1
- package/dist/boot/budget-tracing.d.ts +1 -2
- package/dist/boot/budget-tracing.js +2 -2
- package/dist/boot/coordinators.d.ts +2 -2
- package/dist/boot/coordinators.js +2 -2
- package/dist/boot/deferred-sandbox-path-env.d.ts +0 -6
- package/dist/boot/deferred-sandbox-path-env.js +0 -5
- package/dist/boot/engine-lease.d.ts +5 -5
- package/dist/boot/execution-env.d.ts +16 -15
- package/dist/boot/execution-env.js +19 -21
- package/dist/boot/fatal-exit.d.ts +2 -2
- package/dist/boot/late-binds.d.ts +1 -1
- package/dist/boot/leader.d.ts +1 -1
- package/dist/boot/memory-boundary.d.ts +2 -2
- package/dist/boot/memory-consolidation.d.ts +15 -15
- package/dist/boot/org-memory.js +1 -1
- package/dist/boot/parked-revive-gate.d.ts +3 -3
- package/dist/boot/parked-revive-gate.js +3 -2
- package/dist/boot/reapers.d.ts +4 -4
- package/dist/boot/resolve-spec.d.ts +1 -1
- package/dist/boot/resolve-spec.js +36 -29
- package/dist/boot/runner-deps.d.ts +11 -11
- package/dist/boot/runner-deps.js +7 -4
- package/dist/boot/session-faces.d.ts +3 -3
- package/dist/boot/session-faces.js +11 -30
- package/dist/boot/shutdown.d.ts +5 -5
- package/dist/boot/side-query-lane.d.ts +2 -2
- package/dist/boot/stage-04-stores.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.js +4 -4
- package/dist/boot/stage-06-runners.d.ts +1 -1
- package/dist/boot/stage-06-runners.js +0 -2
- package/dist/boot/stage-07-capability-layer.d.ts +1 -1
- package/dist/boot/stage-08-reapers.d.ts +1 -1
- package/dist/boot/stage-09-leader.d.ts +1 -1
- package/dist/boot/stage-10-http-server.d.ts +1 -1
- package/dist/boot/stores.js +4 -4
- package/dist/boot/web-admin.d.ts +17 -17
- package/dist/boot/web-admin.js +15 -27
- package/dist/boot/workflow-orchestration.js +2 -9
- package/dist/brain.d.ts +11 -11
- package/dist/brain.js +12 -3
- package/dist/budget.d.ts +7 -7
- package/dist/budget.js +4 -0
- package/dist/capabilities/approvals-push.d.ts +4 -4
- package/dist/capabilities/builtin-tools.d.ts +5 -5
- package/dist/capabilities/center-plugins.d.ts +5 -5
- package/dist/capabilities/center-plugins.js +1 -1
- package/dist/capabilities/center-prompts.d.ts +1 -1
- package/dist/capabilities/center-wiring.d.ts +1 -1
- package/dist/capabilities/composite-members.d.ts +1 -1
- package/dist/capabilities/execution-lane.d.ts +5 -5
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +5 -5
- package/dist/capabilities/mcp-probe.d.ts +11 -7
- package/dist/capabilities/sandbox-file-send.d.ts +1 -18
- package/dist/capabilities/sandbox-file-send.js +0 -7
- package/dist/capabilities/scenarios.d.ts +28 -10
- package/dist/capabilities/scenarios.js +15 -5
- package/dist/capabilities/send-user-file-tool.d.ts +1 -1
- package/dist/capabilities/skills.d.ts +31 -12
- package/dist/capabilities/skills.js +23 -17
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +29 -32
- package/dist/capability-facts.js +17 -21
- package/dist/center-config-tier.d.ts +1 -1
- package/dist/center-credential.d.ts +22 -8
- package/dist/center-credential.js +18 -3
- package/dist/checkpoint-identity.d.ts +5 -0
- package/dist/checkpoint-identity.js +14 -0
- package/dist/config-catalog.d.ts +12 -12
- package/dist/config-catalog.js +12 -10
- package/dist/config-d-migration.js +1 -1
- package/dist/config-invariants.d.ts +5 -5
- package/dist/config-invariants.js +11 -2
- package/dist/config-lkg.d.ts +1 -39
- package/dist/config-lkg.js +1 -83
- package/dist/config-provider.d.ts +13 -13
- package/dist/config-provider.js +2 -1
- package/dist/config-types.d.ts +95 -87
- package/dist/config.d.ts +26 -24
- package/dist/config.js +38 -18
- package/dist/cross-session-settings.d.ts +1 -1
- package/dist/delegated-session-owner.d.ts +16 -13
- package/dist/delegated-session-owner.js +9 -10
- package/dist/deployment-governance.d.ts +16 -16
- package/dist/deployment-shape.d.ts +127 -0
- package/dist/deployment-shape.js +72 -0
- package/dist/device-store.d.ts +1 -1
- package/dist/device-ws-hub.d.ts +1 -1
- package/dist/egress-redirect.d.ts +1 -1
- package/dist/elicitation.d.ts +8 -7
- package/dist/elicitation.js +9 -8
- package/dist/entry-mode-clamp-notice.d.ts +2 -2
- package/dist/env-facts.d.ts +10 -9
- package/dist/env-facts.js +1 -1
- package/dist/env-name-allowlist-knobs.d.ts +5 -5
- package/dist/exec-bounds.d.ts +2 -2
- package/dist/execution-lane-caps.d.ts +31 -43
- package/dist/execution-lane-caps.js +0 -13
- package/dist/file-history-capture.d.ts +9 -9
- package/dist/file-history-disclosure.d.ts +25 -11
- package/dist/file-history-disclosure.js +25 -14
- package/dist/fleet/drain-entry.d.ts +2 -2
- package/dist/fleet/fleet-bus.d.ts +22 -14
- package/dist/fleet/fleet-bus.js +5 -5
- package/dist/fleet/fleet-reconciler.d.ts +9 -9
- package/dist/fleet/subagent-tail-bus.d.ts +4 -4
- package/dist/fleet-client.d.ts +45 -14
- package/dist/fleet-client.js +24 -4
- package/dist/fleet-lease.d.ts +23 -19
- package/dist/fleet-lease.js +31 -23
- package/dist/governance-http-status.d.ts +2 -2
- package/dist/hooks/hook-llm.d.ts +7 -7
- package/dist/hooks/hook-llm.js +14 -8
- package/dist/hooks/hook-runner.d.ts +58 -31
- package/dist/hooks/hook-runner.js +37 -19
- package/dist/host-decision.d.ts +5 -5
- package/dist/host-lsp-manager.d.ts +5 -5
- package/dist/hosted-posture.d.ts +23 -13
- package/dist/hosted-posture.js +4 -9
- package/dist/http/admission.d.ts +2 -2
- package/dist/http/admission.js +20 -5
- package/dist/http/approval-sweeps.d.ts +1 -1
- package/dist/http/approval-sweeps.js +2 -1
- package/dist/http/checkpoint-ctx.d.ts +62 -17
- package/dist/http/checkpoint-ctx.js +78 -35
- package/dist/http/dispatch.d.ts +3 -3
- package/dist/http/dispatch.js +9 -9
- package/dist/http/durable-run-leg.js +4 -3
- package/dist/http/idempotency.d.ts +2 -2
- package/dist/http/mcp-dial-deadline.d.ts +7 -5
- package/dist/http/memory-compliance-failure-reply.d.ts +4 -4
- package/dist/http/owner-access.d.ts +4 -6
- package/dist/http/owner-access.js +1 -1
- package/dist/http/principal-gate.d.ts +7 -7
- package/dist/http/principal-gate.js +3 -2
- package/dist/http/readiness.d.ts +1 -1
- package/dist/http/request-guards.d.ts +4 -4
- package/dist/http/request-guards.js +2 -1
- package/dist/http/resume-ctx-read.d.ts +9 -23
- package/dist/http/resume-ctx-read.js +2 -3
- package/dist/http/resume-legs.d.ts +3 -3
- package/dist/http/resume-legs.js +11 -8
- package/dist/http/route-ctx.d.ts +29 -29
- package/dist/http/route-table.d.ts +9 -9
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/approvals-assistant.d.ts +5 -7
- package/dist/http/routes/approvals-assistant.js +101 -26
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +2 -2
- package/dist/http/routes/capabilities.d.ts +1 -1
- package/dist/http/routes/capabilities.js +16 -8
- package/dist/http/routes/config-catalog.d.ts +1 -1
- package/dist/http/routes/devices.d.ts +1 -1
- package/dist/http/routes/diagnostics.d.ts +3 -3
- package/dist/http/routes/fleet.d.ts +1 -1
- package/dist/http/routes/fleet.js +2 -1
- package/dist/http/routes/mcp-reconnect.d.ts +4 -4
- package/dist/http/routes/mcp-reconnect.js +3 -3
- package/dist/http/routes/memory-consolidation.d.ts +1 -1
- package/dist/http/routes/notify-wake.d.ts +1 -1
- package/dist/http/routes/notify-wake.js +2 -2
- package/dist/http/routes/rules.d.ts +1 -1
- package/dist/http/routes/runs.js +23 -11
- package/dist/http/routes/session-sync.d.ts +1 -1
- package/dist/http/routes/session-sync.js +97 -46
- package/dist/http/routes/sessions-list.js +1 -1
- package/dist/http/routes/sessions.js +43 -53
- package/dist/http/routes/tasks.d.ts +1 -1
- package/dist/http/routes/trace-usage.d.ts +1 -1
- package/dist/http/routes/workflows.d.ts +3 -0
- package/dist/http/routes/workflows.js +31 -28
- package/dist/http/send.d.ts +5 -5
- package/dist/http/server.d.ts +34 -34
- package/dist/http/session-inherit-env.d.ts +3 -3
- package/dist/http/sse-lifecycle.d.ts +1 -1
- package/dist/http/sse-log.d.ts +2 -2
- package/dist/http/submit-ctx.js +1 -1
- package/dist/http/sync-submit-body.d.ts +1 -1
- package/dist/http/verify-rounds.d.ts +1 -1
- package/dist/http/wire-types.d.ts +33 -24
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/instruction-source-notice.d.ts +2 -2
- package/dist/key-resolver.d.ts +3 -3
- package/dist/lane-home-probe.d.ts +1 -1
- package/dist/leader/diffout.d.ts +1 -1
- package/dist/leader/diffup.d.ts +2 -2
- package/dist/leader/endpoint.d.ts +1 -1
- package/dist/leader/fanout.d.ts +1 -1
- package/dist/leader/leader.d.ts +4 -4
- package/dist/leader/merge.d.ts +3 -3
- package/dist/leader/repair-wire.d.ts +1 -1
- package/dist/leader/wire.d.ts +6 -6
- package/dist/list-entry-display.d.ts +1 -1
- package/dist/lsp-evict.d.ts +1 -1
- package/dist/mcp-assertion-header.d.ts +1 -1
- package/dist/memory-layer-legacy-lock.d.ts +1 -1
- package/dist/memory-operator-faces.d.ts +1 -1
- package/dist/memory-posture.js +4 -2
- package/dist/memory-project-layer.d.ts +1 -1
- package/dist/memory-scope.d.ts +19 -19
- package/dist/memory-store-refusal.d.ts +4 -4
- package/dist/model-entry-headers.d.ts +2 -2
- package/dist/model-entry-refusal.d.ts +17 -17
- package/dist/model-provider.d.ts +10 -10
- package/dist/model-reach-scope.d.ts +1 -1
- package/dist/model-route-endpoint.d.ts +6 -6
- package/dist/model-route-gap.d.ts +49 -4
- package/dist/model-route-gap.js +34 -1
- package/dist/model-route-url.d.ts +5 -5
- package/dist/model-select.d.ts +15 -6
- package/dist/model-select.js +5 -0
- package/dist/model-unreachable-notice.d.ts +3 -3
- package/dist/namespaced-rule-name.d.ts +15 -5
- package/dist/namespaced-rule-name.js +3 -2
- package/dist/object-store-buckets.d.ts +13 -0
- package/dist/object-store-buckets.js +3 -0
- package/dist/observability/corrupt-read-seat.d.ts +9 -9
- package/dist/observability/cost-taxonomy.d.ts +1 -1
- package/dist/observability/err-text.d.ts +1 -1
- package/dist/observability/fail-open.d.ts +17 -13
- package/dist/observability/fail-open.js +17 -13
- package/dist/observability/metrics.d.ts +3 -3
- package/dist/observability/metrics.js +1 -1
- package/dist/observability/principal-context.d.ts +4 -1
- package/dist/observability/principal-context.js +6 -1
- package/dist/observability/run-terminal.d.ts +36 -36
- package/dist/observability/secret-env-scrub.d.ts +3 -3
- package/dist/observability/tool-trace.d.ts +1 -1
- package/dist/operator-ask.d.ts +4 -4
- package/dist/orchestration/workflow-agent-session-index.d.ts +3 -3
- package/dist/orchestration/workflow-completion-inbox.d.ts +20 -5
- package/dist/orchestration/workflow-completion-inbox.js +29 -7
- package/dist/orchestration/workflow-notify-journal.d.ts +43 -19
- package/dist/orchestration/workflow-notify-journal.js +17 -0
- package/dist/outbound-dispatcher.d.ts +4 -4
- package/dist/parent-watch.d.ts +4 -4
- package/dist/parked-decide.d.ts +20 -18
- package/dist/parked-decide.js +31 -11
- package/dist/parked-revive-surface.d.ts +7 -7
- package/dist/parked-revive-surface.js +2 -3
- package/dist/peer-directory.d.ts +5 -4
- package/dist/peer-directory.js +6 -6
- package/dist/permission-rule-list.d.ts +10 -1
- package/dist/permission-rule-list.js +7 -5
- package/dist/permission-rule-vocab.d.ts +2 -2
- package/dist/plugins/adoption-log-sql.d.ts +1 -1
- package/dist/plugins/approval-ask-store-file.d.ts +8 -1
- package/dist/plugins/approval-ask-store-file.js +6 -3
- package/dist/plugins/approval-ask-store-memory.d.ts +11 -7
- package/dist/plugins/approval-ask-store-memory.js +11 -7
- package/dist/plugins/approval-ask-store-sql.d.ts +42 -15
- package/dist/plugins/approval-ask-store-sql.js +21 -5
- package/dist/plugins/approval-exemption-store.d.ts +3 -3
- package/dist/plugins/approval-nonce-store.d.ts +3 -3
- package/dist/plugins/background-agent-store-sql.d.ts +1 -1
- package/dist/plugins/background-shell-support.d.ts +2 -2
- package/dist/plugins/blob-backend.d.ts +1 -1
- package/dist/plugins/blob-backend.js +2 -1
- package/dist/plugins/caching-session-store.d.ts +23 -32
- package/dist/plugins/caching-session-store.js +5 -17
- package/dist/plugins/checkpoint-index-columns.d.ts +130 -0
- package/dist/plugins/checkpoint-index-columns.js +90 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +71 -69
- package/dist/plugins/checkpoint-store-sql.js +109 -127
- package/dist/plugins/device-store-sql.d.ts +7 -6
- package/dist/plugins/e2b-orphan-reclaim.d.ts +1 -1
- package/dist/plugins/ensure-schema-lock-policy.d.ts +1 -1
- package/dist/plugins/file-history-store-sql.d.ts +15 -7
- package/dist/plugins/file-history-store-sql.js +55 -36
- package/dist/plugins/file-run-store.d.ts +8 -8
- package/dist/plugins/fork-routing-session-store.d.ts +2 -2
- package/dist/plugins/fork-routing-session-store.js +1 -1
- package/dist/plugins/host-platform.d.ts +10 -10
- package/dist/plugins/image-bake-store-sql.d.ts +1 -1
- package/dist/plugins/image-index-sql.d.ts +1 -1
- package/dist/plugins/leader-run-store-sql.d.ts +1 -1
- package/dist/plugins/local-checkpoint-store.d.ts +10 -10
- package/dist/plugins/local-checkpoint-store.js +7 -7
- package/dist/plugins/local-session-store.d.ts +34 -38
- package/dist/plugins/local-session-store.js +20 -39
- package/dist/plugins/local-session-window.d.ts +1 -1
- package/dist/plugins/mailbox-store-sql.d.ts +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +1 -1
- package/dist/plugins/memory-run-store.d.ts +4 -4
- package/dist/plugins/memory-sync-store-pg.d.ts +3 -3
- package/dist/plugins/one-time-migrations.d.ts +73 -54
- package/dist/plugins/one-time-migrations.js +131 -134
- package/dist/plugins/outcome-ledger-sql.d.ts +1 -1
- package/dist/plugins/park-commit-watch.d.ts +3 -3
- package/dist/plugins/permission-rule-store-file.d.ts +5 -5
- package/dist/plugins/permission-rule-store-file.js +12 -19
- package/dist/plugins/permission-rule-store-sql.d.ts +38 -4
- package/dist/plugins/permission-rule-store-sql.js +67 -24
- package/dist/plugins/pg-cost-quota.d.ts +1 -1
- package/dist/plugins/pg-pool.d.ts +2 -2
- package/dist/plugins/pg-pool.js +5 -2
- package/dist/plugins/pg-rate-limiter.d.ts +1 -1
- package/dist/plugins/pg-session-storage.d.ts +8 -20
- package/dist/plugins/pg-session-storage.js +14 -27
- package/dist/plugins/remote-env-adb.d.ts +10 -10
- package/dist/plugins/remote-env-device.d.ts +10 -9
- package/dist/plugins/remote-env-device.js +6 -2
- package/dist/plugins/remote-env-e2b.d.ts +3 -3
- package/dist/plugins/remote-env-host.d.ts +16 -16
- package/dist/plugins/remote-env-k8s.d.ts +26 -13
- package/dist/plugins/remote-env-k8s.js +24 -7
- package/dist/plugins/remote-env-local-docker.d.ts +2 -2
- package/dist/plugins/remote-env-ssh.d.ts +4 -4
- package/dist/plugins/remote-scratchpad.d.ts +2 -3
- package/dist/plugins/remote-scratchpad.js +0 -4
- package/dist/plugins/remote-shell.d.ts +6 -6
- package/dist/plugins/retention-lane-store-sql.d.ts +4 -4
- package/dist/plugins/retention-store-sql.d.ts +4 -4
- package/dist/plugins/roster-store-sql.d.ts +1 -1
- package/dist/plugins/run-store-sql.d.ts +8 -8
- package/dist/plugins/s3-answer.d.ts +15 -0
- package/dist/plugins/s3-answer.js +5 -0
- package/dist/plugins/schema-consistency.d.ts +2 -2
- package/dist/plugins/schema-ensure-legs.d.ts +3 -3
- package/dist/plugins/schema-indexes.d.ts +1 -1
- package/dist/plugins/schema-live-columns.d.ts +1 -1
- package/dist/plugins/session-event-payload.d.ts +4 -4
- package/dist/plugins/session-fork.d.ts +34 -0
- package/dist/plugins/session-fork.js +29 -0
- package/dist/plugins/session-ownership.js +1 -1
- package/dist/plugins/session-placement.d.ts +1 -1
- package/dist/plugins/session-policy-store-sql.d.ts +12 -12
- package/dist/plugins/session-store.d.ts +2 -2
- package/dist/plugins/session-store.js +2 -2
- package/dist/plugins/shared-memory-store-sql.d.ts +2 -2
- package/dist/plugins/snapshot-bucket-presence.d.ts +39 -4
- package/dist/plugins/snapshot-bucket-presence.js +35 -7
- package/dist/plugins/sql-driver.d.ts +8 -8
- package/dist/plugins/sql-errors.d.ts +40 -1
- package/dist/plugins/sql-errors.js +49 -1
- package/dist/plugins/sql-json-column.d.ts +21 -21
- package/dist/plugins/sql-row-helpers.d.ts +2 -2
- package/dist/plugins/store-backend.d.ts +17 -16
- package/dist/plugins/store-backend.js +3 -3
- package/dist/plugins/store-contracts.d.ts +21 -21
- package/dist/plugins/store-fault.d.ts +4 -0
- package/dist/plugins/store-fault.js +8 -0
- package/dist/plugins/task-attachment-store.d.ts +2 -2
- package/dist/plugins/task-list-store-sql.d.ts +1 -1
- package/dist/plugins/tidb-pool.d.ts +2 -2
- package/dist/plugins/tidb-pool.js +10 -3
- package/dist/plugins/tidb-session-store.d.ts +16 -26
- package/dist/plugins/tidb-session-store.js +15 -27
- package/dist/plugins/tool-result-store-sql.d.ts +1 -1
- package/dist/plugins/usage-window-store-sql.d.ts +3 -3
- package/dist/plugins/user-input-ledger-file.d.ts +1 -1
- package/dist/plugins/user-input-ledger-sql.d.ts +3 -3
- package/dist/plugins/web-search.d.ts +19 -5
- package/dist/plugins/web-search.js +20 -5
- package/dist/{orchestration/workflow-journal-entry.d.ts → plugins/workflow-journal-payload.d.ts} +23 -32
- package/dist/plugins/workflow-journal-payload.js +32 -0
- package/dist/plugins/workflow-journal-store-sql.d.ts +28 -14
- package/dist/plugins/workflow-journal-store-sql.js +34 -15
- package/dist/plugins/workflow-run-store-sql.d.ts +4 -4
- package/dist/posture-source.d.ts +11 -11
- package/dist/principal-jwt.d.ts +6 -6
- package/dist/project-identity.d.ts +3 -3
- package/dist/project-memory.d.ts +4 -4
- package/dist/read-face-posture.d.ts +7 -7
- package/dist/request-declaration-refusal.d.ts +94 -0
- package/dist/request-declaration-refusal.js +78 -0
- package/dist/request-image-urls.d.ts +6 -0
- package/dist/request-image-urls.js +27 -0
- package/dist/request-key-closure.d.ts +6 -1
- package/dist/request-key-closure.js +5 -2
- package/dist/request-value-closure.d.ts +15 -8
- package/dist/request-value-closure.js +2 -0
- package/dist/router/route-orchestration.d.ts +11 -16
- package/dist/router/route-orchestration.js +2 -12
- package/dist/rule-entry-list.d.ts +8 -7
- package/dist/rule-entry-list.js +2 -9
- package/dist/rules-consent.d.ts +6 -6
- package/dist/rules-consent.js +2 -0
- package/dist/run-cancel-context.d.ts +5 -5
- package/dist/run-local.d.ts +10 -10
- package/dist/runs.d.ts +13 -11
- package/dist/runs.js +15 -1
- package/dist/runtime-caps-resolver.d.ts +6 -6
- package/dist/runtime-caps-resolver.js +1 -1
- package/dist/runtime-governance.d.ts +9 -9
- package/dist/sandbox-pkg-source.d.ts +17 -12
- package/dist/sandbox-pkg-source.js +14 -9
- package/dist/sealed-key.d.ts +22 -3
- package/dist/sealed-key.js +47 -4
- package/dist/security.d.ts +23 -26
- package/dist/security.js +12 -9
- package/dist/server-secret-env.d.ts +10 -10
- package/dist/session-children-retire.d.ts +1 -1
- package/dist/session-error-wire.d.ts +7 -7
- package/dist/session-incarnation.d.ts +65 -37
- package/dist/session-incarnation.js +30 -12
- package/dist/session-policy-wire.d.ts +27 -5
- package/dist/session-policy-wire.js +15 -1
- package/dist/session-records-skipped-notice.d.ts +1 -1
- package/dist/session-row.d.ts +3 -17
- package/dist/session-row.js +4 -0
- package/dist/session-sync-kernel.d.ts +4 -4
- package/dist/session-sync.d.ts +61 -6
- package/dist/session-sync.js +55 -10
- package/dist/session-titler.d.ts +7 -6
- package/dist/session-titler.js +8 -13
- package/dist/session-watch.d.ts +3 -3
- package/dist/session-watch.js +4 -4
- package/dist/sighup-idle.d.ts +2 -2
- package/dist/spec-fields.d.ts +4 -4
- package/dist/sql-engine-posture.d.ts +3 -3
- package/dist/store-posture.d.ts +2 -2
- package/dist/stored-request-tool-axes-m19.d.ts +1 -1
- package/dist/task-a2a.d.ts +52 -79
- package/dist/task-a2a.js +224 -62
- package/dist/task-cwd.d.ts +7 -88
- package/dist/task-cwd.js +2 -15
- package/dist/task-mcp.d.ts +13 -17
- package/dist/task-mcp.js +29 -49
- package/dist/task-settings.d.ts +30 -18
- package/dist/task-settings.js +33 -3
- package/dist/task-workflow.d.ts +0 -24
- package/dist/task-workflow.js +2 -1
- package/dist/terminal.d.ts +5 -5
- package/dist/tighten-only-seats.d.ts +7 -6
- package/dist/tighten-only-seats.js +1 -1
- package/dist/tool-approval.d.ts +166 -207
- package/dist/tool-approval.js +61 -61
- package/dist/tool-rule-names.d.ts +2 -2
- package/dist/trace/core-keyset-guard.d.ts +13 -8
- package/dist/trace/engine-notice-wire.d.ts +5 -5
- package/dist/trace/engine-notice-wire.js +1 -0
- package/dist/trace/exit-seat.d.ts +31 -4
- package/dist/trace/exit-seat.js +69 -67
- package/dist/trace/ledger-events.d.ts +3 -3
- package/dist/trace/ledger-sink.d.ts +1 -1
- package/dist/trace/model-segment.d.ts +3 -3
- package/dist/trace/project.d.ts +47 -45
- package/dist/trace/project.js +33 -1
- package/dist/trace/redact.d.ts +61 -31
- package/dist/trace/redact.js +394 -153
- package/dist/trace/self-minted-wire.d.ts +302 -14
- package/dist/trace/self-minted-wire.js +87 -0
- package/dist/trace/sema-provenance.d.ts +1 -1
- package/dist/trace/task-notification-facets.d.ts +4 -4
- package/dist/trace/wire-projection-faces.d.ts +3 -3
- package/dist/trace/wire-projection-faces.js +1 -1
- package/dist/unattended-permission-mode.d.ts +5 -5
- package/dist/url-credential-refusal.d.ts +52 -0
- package/dist/url-credential-refusal.js +14 -0
- package/dist/url-refusal.d.ts +16 -3
- package/dist/url-refusal.js +15 -2
- package/dist/usage-analytics.d.ts +2 -2
- package/dist/user-input-ledger.d.ts +23 -23
- package/dist/web-admin-client/apply-effective.d.ts +5 -5
- package/dist/web-admin-client/apply-effective.js +2 -1
- package/dist/web-admin-client/apply-ledger.d.ts +2 -2
- package/dist/web-admin-client/center-request.d.ts +2 -2
- package/dist/web-admin-client/facade.d.ts +5 -5
- package/dist/web-admin-client/facade.js +1 -1
- package/dist/web-admin-client/hot-keys-registry.d.ts +2 -2
- package/dist/web-admin-client/http-client.d.ts +4 -4
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/pull-state.d.ts +1 -1
- package/dist/web-admin-client/read-face.d.ts +2 -2
- package/dist/web-admin-client/read-warnings.d.ts +5 -5
- package/dist/web-admin-client/restart-signal.d.ts +6 -6
- package/dist/web-admin-client/skills-mcp.d.ts +28 -3
- package/dist/web-admin-client/skills-mcp.js +29 -1
- package/dist/web-admin-client/types.d.ts +16 -9
- package/dist/workspace-space.d.ts +32 -3
- package/dist/workspace-space.js +26 -0
- package/dist/write-protection.d.ts +2 -2
- package/package.json +5 -3
- package/scripts/drain-check-local.mjs +4 -2
- package/scripts/drain-check.mysql.sql +6 -2
- package/scripts/drain-check.pg.sql +6 -2
- package/skills/loop.md +1 -1
- package/skills/schedule.md +1 -1
- package/wire-changes/server@7.104.0.json +134 -0
- package/wire-changes/server@7.105.0.json +53 -0
- package/wire-changes/server@7.106.0.json +475 -0
- package/wire-changes/server@7.107.0.json +64 -0
- package/wire-changes/server@7.108.0.json +153 -0
- package/wire-changes/server@7.109.0.json +46 -0
- package/wire-changes/server@7.110.0.json +90 -0
- package/wire-changes/server@7.111.0.json +86 -0
- package/wire-changes/server@7.112.0.json +60 -0
- package/wire-changes/server@7.113.0.json +26 -0
- package/wire-changes/server@7.114.0.json +26 -0
- package/wire-changes/server@7.115.0.json +97 -0
- package/wire-changes/server@7.116.0.json +218 -0
- package/wire-changes/server@7.116.1.json +26 -0
- package/wire-changes/server@7.117.0.json +65 -0
- package/wire-changes/server@7.118.0.json +129 -0
- package/wire-changes/server@7.119.0.json +65 -0
- package/wire-changes/server@7.120.0.json +89 -0
- package/wire-changes/server@7.121.0.json +219 -0
- package/wire-changes/server@7.122.0.json +54 -0
- package/wire-changes/server@7.123.0.json +26 -0
- package/wire-changes/server@7.124.0.json +336 -0
- package/wire-changes/server@7.124.1.json +26 -0
- package/wire-changes/server@7.125.0.json +111 -0
- package/wire-changes/server@7.126.0.json +285 -0
- package/wire-changes/server@7.127.0.json +77 -0
- package/wire-changes/server@7.127.1.json +26 -0
- package/wire-changes/server@7.127.2.json +53 -0
- package/wire-changes/server@7.128.0.json +26 -0
- package/wire-changes/server@7.129.0.json +106 -0
- package/wire-changes/server@7.129.1.json +26 -0
- package/wire-changes/server@7.130.0.json +26 -0
- package/wire-changes/server@7.131.0.json +118 -0
- package/wire-changes/server@7.132.0.json +226 -0
- package/wire-changes/server@7.133.0.json +1155 -0
- package/wire-changes/server@7.134.0.json +107 -0
- package/wire-changes/server@7.135.0.json +174 -0
- package/wire-changes/server@7.136.0.json +448 -0
- package/dist/http/run-declared-families.d.ts +0 -16
- package/dist/http/run-declared-families.js +0 -12
- package/dist/orchestration/workflow-journal-entry.js +0 -27
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* `SESSION_SNAPSHOT_BUCKET`(缺省 `session-snapshots`)是 snapshot-BLOB offload 与 SendUserFile 私有 presigned 轨 / 沙箱 staging 的桶。server 不建桶
|
|
6
6
|
* (`docs/DEPLOY-PREREQS.md`「对象存储桶」),sema-up 的建桶清单又漏过它 ⇒ 起服绿,之后每一次对象写、每一拍孤儿 sweep 的列举(每分钟)都是
|
|
7
7
|
* 404 NoSuchBucket —— 运维读到的是一串「失败的请求」,不是「桶没建」。
|
|
8
|
+
* `WORKSPACE_SNAPSHOT_BUCKET`(缺省 `workspaces`,k8s 工作区快照桶)同病且更隐:起服不核它 ⇒ 缺桶 / 无权限时每条 run 读 `latest` 得 404,
|
|
9
|
+
* 被读成「这个空间头一回」,从空目录起;run 末的保存虽失败,报的却是一条不点名桶的 curl 404,没有一行说「桶没建」。
|
|
8
10
|
*
|
|
9
11
|
* ## 形(一条规则,不加特例)
|
|
10
12
|
* · 核的是 {@link MinioBlobBackend.probeBucket}(presigned 列举 `max-keys=1`);**只有** 404 + `NoSuchBucket` 是「缺」,其余证明不了的形(连不上 / 403 / 5xx / 没有
|
|
@@ -13,24 +15,57 @@
|
|
|
13
15
|
* · 缺 = 配置好的店资源还没就绪,与「库连不上」同一类处境:在 `STORE_LOCK_WAIT_MS` 窗内重试({@link openWithinWait},同一只窗、同一只节拍、同一条窗尾规则 —— 编排里
|
|
14
16
|
* 建桶晚于 server 起是常态),到窗时手上有缺桶的证据 ⇒ 拒启,拒句点名桶名、`MINIO_ENDPOINT` 的显示安全形(`buildDisplaySafeUrl` 的产物:userinfo 落地、
|
|
15
17
|
* query 值成记号,不带密钥)与出路;探针从头到尾没答过(每一次都挂到窗尾)⇒ 同样是「证明不了」,走上面那只兜底口、照常起服。
|
|
16
|
-
* ·
|
|
18
|
+
* · 核的桶是一张角色表({@link SNAPSHOT_BUCKET_ROLES},闭集两行)里的两只,**同一只探针、同一条规则、同一只兜底口**:
|
|
19
|
+
* `session` = `config.snapshotBlobStore.bucket`(`SESSION_SNAPSHOT_BUCKET`;SendUserFile 的私桶缺省同一只);
|
|
20
|
+
* `workspace` = k8s 车道的 `config.remoteExec.s3Snapshot.bucket`(`WORKSPACE_SNAPSHOT_BUCKET`,缺省 `workspaces`)—— 车道没开 / 没配对象存储 ⇒ 没有这只桶,不核。
|
|
21
|
+
* 拒句的旋钮名跟着桶走(缺的是哪只桶就只点哪只的旋钮)。公桶 `sema-public` 是运维另配的匿名桶,不在本核之内。
|
|
22
|
+
* · 运行期的对应臂:工作区 `latest` 指针读答 404 `NoSuchBucket`(同一条「桶不在」判据 `isNoSuchBucketAnswer`)⇒ 那条 run 响亮拒绝,不再读成「空间头一回」
|
|
23
|
+
* (`remote-env-k8s.ts` `readPointer`)—— 起服核之后桶被删 / 起服核证明不了的部署,在运行期也有一道。
|
|
17
24
|
*/
|
|
18
25
|
import type { ServiceConfig } from "../config-types.js";
|
|
19
26
|
import { type StoreOpenWaitClock } from "./store-open-wait.js";
|
|
20
27
|
type SnapshotBlobStoreConfig = NonNullable<ServiceConfig["snapshotBlobStore"]>;
|
|
28
|
+
/** 被核的桶的角色(闭集):`session` = 快照 blob / SendUserFile 私桶;`workspace` = k8s 工作区快照桶。 */
|
|
29
|
+
export type SnapshotBucketRole = "session" | "workspace";
|
|
30
|
+
/** 两只被核的桶的角色表 —— 拒句、`snapshot_bucket_wait` 披露与 {@link ensureSnapshotBuckets} 都读这一张(缺一行 = 编译错)。 */
|
|
31
|
+
export declare const SNAPSHOT_BUCKET_ROLES: {
|
|
32
|
+
readonly session: {
|
|
33
|
+
readonly noun: "snapshot bucket";
|
|
34
|
+
readonly knob: "SESSION_SNAPSHOT_BUCKET";
|
|
35
|
+
readonly defaultName: "session-snapshots";
|
|
36
|
+
readonly consequence: "every snapshot-offload write and SendUserFile private-track request would answer 404 NoSuchBucket (and the orphan sweep would log one every minute, forever)";
|
|
37
|
+
readonly createHint: "; this version's sema-up scripts create it — re-run them on an existing sema-up deployment";
|
|
38
|
+
};
|
|
39
|
+
readonly workspace: {
|
|
40
|
+
readonly noun: "workspace snapshot bucket";
|
|
41
|
+
readonly knob: "WORKSPACE_SNAPSHOT_BUCKET";
|
|
42
|
+
readonly defaultName: "workspaces";
|
|
43
|
+
readonly consequence: "no workspace snapshot could be saved or restored (every run would start from an empty /workspace and every run-end save would fail on a bare 404), and no line would say the bucket is missing";
|
|
44
|
+
readonly createHint: "";
|
|
45
|
+
};
|
|
46
|
+
};
|
|
21
47
|
/** boot 期单次探针的上界(ms):黑洞端点(丢包不拒连)不许把起服拖到对象存储 IO 的 120s;到点 ⇒ `unknown`(证明不了缺桶 ⇒ 不拒、报一次)。 */
|
|
22
48
|
export declare const SNAPSHOT_BUCKET_PROBE_TIMEOUT_MS = 10000;
|
|
23
49
|
/** 缺桶的拒启句(唯一铸点)。 */
|
|
24
50
|
/** @param endpoint `MINIO_ENDPOINT` 的**显示安全形**(调用方过 {@link buildDisplaySafeUrl};本函数不碰原串)。 */
|
|
25
|
-
export declare function buildSnapshotBucketRefusal(bucket: string, endpoint: string, waitedMs: number): string;
|
|
51
|
+
export declare function buildSnapshotBucketRefusal(bucket: string, endpoint: string, waitedMs: number, role?: SnapshotBucketRole): string;
|
|
26
52
|
/** 探针到窗尾一次都没答过时,兜底口 detail 里的成因(证明不了缺桶的一形)。 */
|
|
27
53
|
export declare const SNAPSHOT_BUCKET_PROBE_PENDING = "probe still pending when the window ended";
|
|
28
54
|
/**
|
|
29
|
-
* boot
|
|
55
|
+
* boot 期核一次**一只**快照桶。缺桶 ⇒ 窗内重试、到窗拒启;证明不了 ⇒ 兜底口留痕、照常起服。
|
|
30
56
|
* @param waitMs `config.storeLockWaitMs`。`0` ⇒ 只核一次(缺就当场拒)。
|
|
57
|
+
* @param role 这只桶的角色({@link SNAPSHOT_BUCKET_ROLES}):决定拒句点名哪根旋钮;缺省 `session`。
|
|
31
58
|
*/
|
|
32
59
|
export declare function ensureSnapshotBucket(store: SnapshotBlobStoreConfig, waitMs: number, logger: {
|
|
33
60
|
warn(msg: string, meta?: Record<string, unknown>): void;
|
|
34
|
-
}, clock?: StoreOpenWaitClock): Promise<void>;
|
|
61
|
+
}, clock?: StoreOpenWaitClock, role?: SnapshotBucketRole): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* boot 期核**这份配置要用的全部**快照桶(`boot/stores.ts`,排在打开任何店之前):角色表的每一行,配置里有这只桶才核 —— 会话快照桶 ⇐ 配了对象存储
|
|
64
|
+
* (`snapshotBlobStore`);工作区快照桶 ⇐ k8s 车道配了对象存储(`remoteExec.s3Snapshot`)。依角色表顺序逐只核,每只各有自己的 `STORE_LOCK_WAIT_MS` 窗
|
|
65
|
+
* (缺的桶才占窗;在场的桶一次探针就过),第一只缺的桶即拒启。
|
|
66
|
+
*/
|
|
67
|
+
export declare function ensureSnapshotBuckets(config: Pick<ServiceConfig, "snapshotBlobStore" | "remoteExec" | "storeLockWaitMs">, logger: {
|
|
68
|
+
warn(msg: string, meta?: Record<string, unknown>): void;
|
|
69
|
+
}): Promise<void>;
|
|
35
70
|
export {};
|
|
36
71
|
//# sourceMappingURL=snapshot-bucket-presence.d.ts.map
|
|
@@ -1,21 +1,39 @@
|
|
|
1
1
|
import { buildDisplaySafeUrl } from "../trace/redact.js";
|
|
2
2
|
import { MinioBlobBackend } from "./blob-backend.js";
|
|
3
3
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
4
|
+
import { SESSION_SNAPSHOT_BUCKET_DEFAULT, WORKSPACE_SNAPSHOT_BUCKET_DEFAULT } from "../object-store-buckets.js";
|
|
4
5
|
import { isStoreOpenWindowExpired, openWithinWait } from "./store-open-wait.js";
|
|
6
|
+
export const SNAPSHOT_BUCKET_ROLES = {
|
|
7
|
+
session: {
|
|
8
|
+
noun: "snapshot bucket",
|
|
9
|
+
knob: "SESSION_SNAPSHOT_BUCKET",
|
|
10
|
+
defaultName: SESSION_SNAPSHOT_BUCKET_DEFAULT,
|
|
11
|
+
consequence: "every snapshot-offload write and SendUserFile private-track request would answer 404 NoSuchBucket (and the orphan sweep would log one every minute, forever)",
|
|
12
|
+
createHint: "; this version's sema-up scripts create it — re-run them on an existing sema-up deployment",
|
|
13
|
+
},
|
|
14
|
+
workspace: {
|
|
15
|
+
noun: "workspace snapshot bucket",
|
|
16
|
+
knob: "WORKSPACE_SNAPSHOT_BUCKET",
|
|
17
|
+
defaultName: WORKSPACE_SNAPSHOT_BUCKET_DEFAULT,
|
|
18
|
+
consequence: "no workspace snapshot could be saved or restored (every run would start from an empty /workspace and every run-end save would fail on a bare 404), and no line would say the bucket is missing",
|
|
19
|
+
createHint: "",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
5
22
|
export const SNAPSHOT_BUCKET_PROBE_TIMEOUT_MS = 10_000;
|
|
6
23
|
class SnapshotBucketMissing extends Error {
|
|
7
24
|
constructor() {
|
|
8
25
|
super("snapshot bucket missing");
|
|
9
26
|
}
|
|
10
27
|
}
|
|
11
|
-
export function buildSnapshotBucketRefusal(bucket, endpoint, waitedMs) {
|
|
28
|
+
export function buildSnapshotBucketRefusal(bucket, endpoint, waitedMs, role = "session") {
|
|
29
|
+
const r = SNAPSHOT_BUCKET_ROLES[role];
|
|
12
30
|
const waited = waitedMs > 0 ? `after retrying for ${waitedMs}ms (STORE_LOCK_WAIT_MS)` : "on the first check (STORE_LOCK_WAIT_MS=0: no wait)";
|
|
13
|
-
return (`Object storage is configured (MINIO_ENDPOINT → ${endpoint}) but the
|
|
14
|
-
`the server never creates buckets, so
|
|
15
|
-
`Next: create the bucket (mc mb <alias>/${bucket}
|
|
31
|
+
return (`Object storage is configured (MINIO_ENDPOINT → ${endpoint}) but the ${r.noun} "${bucket}" (${r.knob}; default ${r.defaultName}) does not exist there ${waited} — refusing to boot: ` +
|
|
32
|
+
`the server never creates buckets, so ${r.consequence}. ` +
|
|
33
|
+
`Next: create the bucket (mc mb <alias>/${bucket}${r.createHint}), or set ${r.knob} to a bucket that exists.`);
|
|
16
34
|
}
|
|
17
35
|
export const SNAPSHOT_BUCKET_PROBE_PENDING = "probe still pending when the window ended";
|
|
18
|
-
export async function ensureSnapshotBucket(store, waitMs, logger, clock) {
|
|
36
|
+
export async function ensureSnapshotBucket(store, waitMs, logger, clock, role = "session") {
|
|
19
37
|
const probe = new MinioBlobBackend({ endpoint: store.endpoint, bucket: store.bucket, accessKey: store.accessKey, secretKey: store.secretKey, ...(store.region ? { region: store.region } : {}), ...(store.keyPrefix ? { keyPrefix: store.keyPrefix } : {}) });
|
|
20
38
|
let verdict;
|
|
21
39
|
try {
|
|
@@ -24,11 +42,11 @@ export async function ensureSnapshotBucket(store, waitMs, logger, clock) {
|
|
|
24
42
|
if (r.state === "missing")
|
|
25
43
|
throw new SnapshotBucketMissing();
|
|
26
44
|
return r;
|
|
27
|
-
}, waitMs, (w) => logger.warn("snapshot_bucket_wait", { bucket: store.bucket, endpoint: buildDisplaySafeUrl(store.endpoint), waitMs: w.waitMs, error: w.error }), clock);
|
|
45
|
+
}, waitMs, (w) => logger.warn("snapshot_bucket_wait", { role, bucket: store.bucket, endpoint: buildDisplaySafeUrl(store.endpoint), waitMs: w.waitMs, error: w.error }), clock);
|
|
28
46
|
}
|
|
29
47
|
catch (err) {
|
|
30
48
|
if (err instanceof SnapshotBucketMissing)
|
|
31
|
-
throw new Error(buildSnapshotBucketRefusal(store.bucket, buildDisplaySafeUrl(store.endpoint), waitMs), { cause: err });
|
|
49
|
+
throw new Error(buildSnapshotBucketRefusal(store.bucket, buildDisplaySafeUrl(store.endpoint), waitMs, role), { cause: err });
|
|
32
50
|
if (!isStoreOpenWindowExpired(err))
|
|
33
51
|
throw err;
|
|
34
52
|
verdict = { state: "unknown", detail: SNAPSHOT_BUCKET_PROBE_PENDING };
|
|
@@ -37,4 +55,14 @@ export async function ensureSnapshotBucket(store, waitMs, logger, clock) {
|
|
|
37
55
|
recordFailOpen("server.snapshot-bucket.presence-unproven", `bucket=${store.bucket} endpoint=${buildDisplaySafeUrl(store.endpoint)} ${verdict.detail}`);
|
|
38
56
|
}
|
|
39
57
|
}
|
|
58
|
+
export async function ensureSnapshotBuckets(config, logger) {
|
|
59
|
+
const wanted = [
|
|
60
|
+
["session", config.snapshotBlobStore],
|
|
61
|
+
["workspace", config.remoteExec?.provider === "k8s" ? config.remoteExec.s3Snapshot : undefined],
|
|
62
|
+
];
|
|
63
|
+
for (const [role, store] of wanted) {
|
|
64
|
+
if (store)
|
|
65
|
+
await ensureSnapshotBucket(store, config.storeLockWaitMs, logger, undefined, role);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
40
68
|
//# sourceMappingURL=snapshot-bucket-presence.js.map
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
* exec; this seam stays on the plain (sql, params) form.
|
|
27
27
|
*
|
|
28
28
|
* ─────────────────────────────────────────────────────────────────────────────────────────────────
|
|
29
|
-
* @contract txn.read-semantics — 本仓「事务里的读看到什么」的**唯一**成文处(
|
|
29
|
+
* @contract txn.read-semantics — 本仓「事务里的读看到什么」的**唯一**成文处([ref] / [ref] / [ref])
|
|
30
30
|
* ─────────────────────────────────────────────────────────────────────────────────────────────────
|
|
31
31
|
* 五只店的头注此前各写一套「为什么用这个事务动词」的理由(截断的、漏数的、讲历史沿革的都有)。
|
|
32
32
|
* 判据从今天起只有这一处,店里只留一行 `{@link SqlTxConn.begin}` 指回来。
|
|
33
33
|
*
|
|
34
34
|
* **① 事务动词只有一个** —— `begin()`。曾经那个「悲观」专用动词(MySQL 腿发 TiDB 专有的
|
|
35
35
|
* `BEGIN PESSIMISTIC`)已删除:那条语句在真 MySQL / MariaDB 上是 `ER_PARSE_ERROR`,四店 18 个事务
|
|
36
|
-
* 一个都开不了(**
|
|
36
|
+
* 一个都开不了(**[ref]**),而它真正保证的东西现在由 ② 结构性地给出。同理,那个「可重复读」专用
|
|
37
37
|
* 动词也一并并入:隔离级不再由动词决定。
|
|
38
38
|
*
|
|
39
39
|
* **② 隔离级与事务模式是「连接的事实」,不是「动词的参数」** —— 见 {@link SqlDriver.facts}。
|
|
@@ -54,12 +54,12 @@
|
|
|
54
54
|
* 的行**、读**值/时钟表达式**(不触任何存量行)、以及 PG 语法明禁加锁的形(**只有**聚合 / GROUP BY /
|
|
55
55
|
* DISTINCT / 窗口 / 集合运算;`ORDER BY … LIMIT 1` 尾行读在 PG 上**合法**加锁,不属此类——7.60.0 重扫纠)。
|
|
56
56
|
* 理由:TiDB 悲观事务的普通 SELECT 仍钉 `start_ts`,`lockScope` 的锁等待窗内别副本的提交看不见
|
|
57
|
-
* (**
|
|
57
|
+
* (**[ref]**);InnoDB REPEATABLE READ 下则由本事务的第一条一致性读建 read view —— 两条都是
|
|
58
58
|
* **版本相关的副作用**,不是保证。机器门:`test/sql-txn-semantics-gate.test.ts`(G-B,例外闭集
|
|
59
59
|
* `INTRA_TXN_PLAIN_READS` 每条带理由);真值神谕:`test/sql-txn-semantics-integration.test.ts`(三引擎)。
|
|
60
60
|
*
|
|
61
61
|
* **④ 引擎事实不进店** —— `SqlDriver.facts` 是**运维读面**(`GET /v1/diagnostics/wiring` 的 `sqlEngine`
|
|
62
|
-
* 段与 `GET /v1/capabilities` 的 `store.sql` 位(7.106.0 起;此前顶层 `sql`,
|
|
62
|
+
* 段与 `GET /v1/capabilities` 的 `store.sql` 位(7.106.0 起;此前顶层 `sql`,[ref] ①))的料。店里不许出现 `if (engine === …)`:引擎判别在全仓
|
|
63
63
|
* 只有连接初始化这一处,机器门 G-A 守着。`SqlDialect`(SQL **文本**方言,两值)与 `engine`(运行期
|
|
64
64
|
* 引擎事实,三值)是两条轴,刻意不合成一个三值。
|
|
65
65
|
*
|
|
@@ -125,7 +125,7 @@ export interface SqlExec {
|
|
|
125
125
|
/** A pooled connection with transaction control (released by the caller in a `finally`). */
|
|
126
126
|
export interface SqlTxConn extends SqlExec {
|
|
127
127
|
/**
|
|
128
|
-
* The ONE transaction verb (
|
|
128
|
+
* The ONE transaction verb ([ref]). What its reads see is NOT decided here — it is decided once per
|
|
129
129
|
* pooled connection at initialization and reported by {@link SqlDriver.facts}. Read the
|
|
130
130
|
* `@contract txn.read-semantics` block at the top of this file before adding a transaction: the
|
|
131
131
|
* short version is **intra-transaction collection reads are LOCKING reads**, and a plain `SELECT`
|
|
@@ -145,7 +145,7 @@ export interface SqlTxConn extends SqlExec {
|
|
|
145
145
|
*/
|
|
146
146
|
export type SqlEngine = "tidb" | "innodb" | "pg";
|
|
147
147
|
/**
|
|
148
|
-
* What connection initialization ESTABLISHED and then READ BACK on this driver's pool (
|
|
148
|
+
* What connection initialization ESTABLISHED and then READ BACK on this driver's pool ([ref] §1
|
|
149
149
|
* 补偿面). Operator read faces: `GET /v1/diagnostics/wiring` → `sqlEngine`, `GET /v1/capabilities`
|
|
150
150
|
* → `sql`. Store code must never read this (machine gate G-A) — engine discrimination exists in
|
|
151
151
|
* exactly one place in this repo, and it is `connect()`.
|
|
@@ -322,7 +322,7 @@ export declare const SQL_FACTS_ABSENT_WALLS: SqlWallsReading;
|
|
|
322
322
|
export declare function sqlWallsOf(engine: SqlEngineReading | undefined): SqlWallsReading;
|
|
323
323
|
/**
|
|
324
324
|
* **数据库自己的钟**(毫秒),两方言各一句 —— 本仓这口钟在 SQL 面的**唯一**铸点([ref] A7 / [ref] /
|
|
325
|
-
* 合并复审 R2 把
|
|
325
|
+
* 合并复审 R2 把 [ref] 的 nonce 店并进来)。
|
|
326
326
|
*
|
|
327
327
|
* 用处永远是同一条:**一个时刻量的铸造点与它的判定点必须在同一个钟域**。副本各拿各的墙钟时,两台机器
|
|
328
328
|
* 之间的偏差没有任何一条腿强制过上界(本仓 [ref]③ 记过一次真实的 11 分钟 NTP 纠正),于是
|
|
@@ -359,7 +359,7 @@ export interface SqlDriver extends SqlExec {
|
|
|
359
359
|
* · `null`(还没借出过连接)—— 没有可报的东西,**不猜**;
|
|
360
360
|
* · 事实 —— 最近一次初始化**回读复核**过的值。每条池连接首次借出都重跑一次初始化(记忆化按连接身份),
|
|
361
361
|
* 所以池在致命错误后重连时,保证是在新连接上**重新建立**的,不是继承来的;
|
|
362
|
-
* · `null`(借出过、但最近一次初始化被**拒**)——
|
|
362
|
+
* · `null`(借出过、但最近一次初始化被**拒**)—— [ref] ④:保证此刻建立不起来,读面就报缺席。
|
|
363
363
|
* 此前这里是「一次成功即长期有效」的快照:连接被驱逐、新连接初始化被拒之后,诊断面仍在陈述一条
|
|
364
364
|
* 已经不成立的结构保证。降级由 `establishSession()` 一处完成,并留 loud warn。
|
|
365
365
|
*/
|
|
@@ -90,7 +90,7 @@ export declare const PG_DEADLOCK_DETECTED_SQLSTATE = "40P01";
|
|
|
90
90
|
* 它**不是**「锁序可以随便写」的许可证 —— 锁序的属主仍是店(真值神谕 =
|
|
91
91
|
* `test/sql-lock-shape-innodb-integration.test.ts` 三引擎并发套)。
|
|
92
92
|
*
|
|
93
|
-
* 引擎事实(2026-09-20 真 InnoDB 实测,
|
|
93
|
+
* 引擎事实(2026-09-20 真 InnoDB 实测,[ref] 取证):同一把缺行主键上 N=8 路并发「`FOR UPDATE` 缺行读
|
|
94
94
|
* → `INSERT`」,InnoDB(REPEATABLE READ,gap lock + insert-intention)恒定 1 成 7 死锁;TiDB(悲观、无
|
|
95
95
|
* gap lock)与 PG(READ COMMITTED,缺行 `FOR UPDATE` 不取锁)各自零死锁。⇒ 这条谓词实际的受众是
|
|
96
96
|
* **MySQL 协议腿**,两方言都认只是为了让店不必自己判引擎。
|
|
@@ -129,11 +129,13 @@ export declare function rowTooLargeWallOf(dialect: SqlDialect, err: unknown): Ro
|
|
|
129
129
|
* (`ErrEntryTooLarge`,事务层的语句错;真库读数:同池上 8025 写之后的读照常 —— `checkpoint-row-size-db-integration` ②③④)。
|
|
130
130
|
* 断连形(`ECONNRESET` / `EPIPE` / `PROTOCOL_CONNECTION_LOST`)也不在表里:那是 mysql2 的**致命错误**,连接对象自己已经 `_removeFromPool`。
|
|
131
131
|
* PostgreSQL 没有对应面:node-pg 的 `pool.query` 对任何错误都丢弃那条 client。
|
|
132
|
+
* `statementRefusal`:这一行的错说的是**这一条语句**被拒(连接坏只是后果)—— 同一句话换一条连接重试仍被拒。{@link isConnectionFaultError} 读同一张表,认其余各行为连接类故障,唯独不认带这个标记的行。
|
|
132
133
|
* 新增一行 = 改表 + 在 `test/db-closed-connection-never-pooled.test.ts` 的码表里加一格。
|
|
133
134
|
*/
|
|
134
135
|
export declare const MYSQL_CONNECTION_UNUSABLE_ERRORS: ReadonlyArray<{
|
|
135
136
|
readonly errno: number;
|
|
136
137
|
readonly code: string;
|
|
138
|
+
readonly statementRefusal?: true;
|
|
137
139
|
}>;
|
|
138
140
|
/**
|
|
139
141
|
* 「抛出这个错误的那条连接还能不能回池」的单一判据:{@link MYSQL_CONNECTION_UNUSABLE_ERRORS} 里的错 ⇒ **不能** —— 持连接的一方(`sql-driver.ts` 的 `leaseOf`)
|
|
@@ -141,6 +143,43 @@ export declare const MYSQL_CONNECTION_UNUSABLE_ERRORS: ReadonlyArray<{
|
|
|
141
143
|
* 认不出的一律不是(连接照常归还;断连形由 mysql2 自己清出池)。只管 MySQL 协议的错误形:PG 的错误没有这两个键,恒 false。
|
|
142
144
|
*/
|
|
143
145
|
export declare function isConnectionUnusableError(err: unknown): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* **连接类故障**的识别表(闭集;逐行登记「为什么」)—— 「到库的那条连接坏了 / 库此刻不接」:与这一条语句的内容无关、什么都不改稍后再试可能成。
|
|
148
|
+
* 读者(整仓一只判官 `plugins/store-fault.ts` 的 `storeFaultClassOf`,三处同读):审批队列读口、文件历史店的折点(`permanence: "transient"`)、会话同步拉取口(`503`)。
|
|
149
|
+
*
|
|
150
|
+
* 识别集 = 三张表的并集,**没有第四处**:
|
|
151
|
+
* · 本表(下):套接字层与协议层的断连 / 拒连 / 连接数满 / 库的关停与只读切换,按 `code` 登记(MySQL 协议的数字 errno 在场的并登 —— 同本文件其余谓词的姿势:`errno` 与 `code` 是同一件事的两种写法);
|
|
152
|
+
* · {@link MYSQL_CONNECTION_UNUSABLE_ERRORS}(「这条连接不许再回池」的 MySQL 协议错):整表读入,**唯独不认带 `statementRefusal` 的行**(1153:拒的是这一条语句,不是连接);
|
|
153
|
+
* · {@link CONNECTION_FAULT_DRIVER_SENTENCES}:驱动自己抛的**无 `code` 的裸 `Error`**(node-pg 的断连在这一形),按整句相等认。
|
|
154
|
+
*
|
|
155
|
+
* **不在识别集里**(认不出一律不是 —— 错判成连接类的代价是调用方被劝「再试」去撞一个注定失败的语句):
|
|
156
|
+
* · 语句级的错:唯一键冲突、CHECK 被拒、缺表缺列、语法错、权限错、行 / 包超墙(1153 / 8025 / `54000`);
|
|
157
|
+
* · 死锁(引擎的仲裁产物,重试的前提在调用方的整事务重来,见 {@link isDeadlockError})与锁等待 / 语句超时(延迟信号,重试只把长等待乘上次数);
|
|
158
|
+
* · 认证类拒连(MySQL 1045、PG `28xxx`、`08004`:凭据 / 白名单要人去改)与协议违例(PG `08P01`、mysql2 `PROTOCOL_ERROR`:我方的码病);
|
|
159
|
+
* · TiDB 自己的忙 / 区域不可用(9001 / 9005 一族)—— 候真库逐码读数再登,今天不在表里(登记在案的未收项);
|
|
160
|
+
* · 池已被我方关闭(`Pool is closed.` / `Cannot use a pool after calling end on the pool`):那是本进程在收摊,不是库的事。
|
|
161
|
+
* 只看被抛出的**这一只**对象(不沿 `cause` 链往下找):店层把驱动错包进自己的类时,包它的那一层要不要继承连接类,归那一层的契约说,不在这里猜。
|
|
162
|
+
*/
|
|
163
|
+
export declare const CONNECTION_FAULT_ERRORS: ReadonlyArray<{
|
|
164
|
+
readonly code: string;
|
|
165
|
+
readonly errno?: number;
|
|
166
|
+
readonly why: string;
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* 驱动**自己抛的、不带 `code` 的裸 `Error`** 的整句 —— 连接类故障的第三种归因键。node-pg 的断连 / 池连接超时就是这一形(`new Error('Connection terminated unexpectedly')`,
|
|
170
|
+
* 没有任何结构化字段可读),mysql2 的「连接已关闭」同形。**整句相等**才认(不是 `includes`):一句夹着用户路径 / 数据的散文伪造不出驱动句;且只认 `code` 缺席的 `Error`。
|
|
171
|
+
* 每一行的 `source` 是它在驱动源码里的出处文件,`test/store-fault-judge.test.ts` 读已装驱动的源码核句子仍在(驱动升级改了句子 ⇒ 红,而不是判官悄悄静音)。
|
|
172
|
+
*/
|
|
173
|
+
export declare const CONNECTION_FAULT_DRIVER_SENTENCES: ReadonlyArray<{
|
|
174
|
+
readonly sentence: string;
|
|
175
|
+
readonly source: string;
|
|
176
|
+
readonly why: string;
|
|
177
|
+
}>;
|
|
178
|
+
/**
|
|
179
|
+
* 「这个错误**是**连接类故障吗」—— {@link CONNECTION_FAULT_ERRORS} 的唯一判据(识别集与排除项见该表头注)。纯谓词、不抛;认不出的一律不是。
|
|
180
|
+
* 归因键三种:`code`(字符串)、`errno`(数字)、无 `code` 的驱动裸 `Error` 的整句 —— 只读被抛出的这一只对象身上的结构化字段 / 整句,**不读散文里的在册词**。
|
|
181
|
+
*/
|
|
182
|
+
export declare function isConnectionFaultError(err: unknown): boolean;
|
|
144
183
|
/**
|
|
145
184
|
* 检查点店的两笔写(续跑输入 `putCtx` / 停驻行 `put`)被引擎以「一行装不下」拒 ⇒ **这一只**带码错误(码 `store.row_too_large`),不以裸驱动错上抛
|
|
146
185
|
* (其余店写今天仍是各自的驱动错 —— 未收,登记在案)。
|
|
@@ -64,7 +64,7 @@ export function rowTooLargeWallOf(dialect, err) {
|
|
|
64
64
|
export const MYSQL_CONNECTION_UNUSABLE_ERRORS = [
|
|
65
65
|
{ errno: 1053, code: "ER_SERVER_SHUTDOWN" },
|
|
66
66
|
{ errno: 1152, code: "ER_ABORTING_CONNECTION" },
|
|
67
|
-
{ errno: 1153, code: "ER_NET_PACKET_TOO_LARGE" },
|
|
67
|
+
{ errno: 1153, code: "ER_NET_PACKET_TOO_LARGE", statementRefusal: true },
|
|
68
68
|
{ errno: 1158, code: "ER_NET_READ_ERROR" },
|
|
69
69
|
{ errno: 1159, code: "ER_NET_READ_INTERRUPTED" },
|
|
70
70
|
{ errno: 1160, code: "ER_NET_ERROR_ON_WRITE" },
|
|
@@ -82,6 +82,54 @@ export function isConnectionUnusableError(err) {
|
|
|
82
82
|
const code = keyOf(err, "code");
|
|
83
83
|
return (typeof errno === "number" && UNUSABLE_ERRNOS.has(errno)) || (typeof code === "string" && UNUSABLE_CODES.has(code));
|
|
84
84
|
}
|
|
85
|
+
export const CONNECTION_FAULT_ERRORS = [
|
|
86
|
+
{ code: "ECONNRESET", why: "对端重置了连接(库重启 / 代理断流 / 空闲连接被回收)" },
|
|
87
|
+
{ code: "ECONNREFUSED", why: "库此刻不接连接(进程没起 / 端口没开 / 滚动重启中)" },
|
|
88
|
+
{ code: "ECONNABORTED", why: "连接在建立或使用中被本机协议栈中止" },
|
|
89
|
+
{ code: "EPIPE", why: "写一条对端已经关掉的连接" },
|
|
90
|
+
{ code: "ETIMEDOUT", why: "连接 / 套接字超时(mysql2 的 `connectTimeout` 同答此码)" },
|
|
91
|
+
{ code: "EHOSTUNREACH", why: "到库的主机不可达(路由 / 节点切换)" },
|
|
92
|
+
{ code: "ENETUNREACH", why: "到库的网络不可达" },
|
|
93
|
+
{ code: "EAI_AGAIN", why: "DNS 临时失败(「稍后再试」是它自己的定义)" },
|
|
94
|
+
{ code: "PROTOCOL_CONNECTION_LOST", why: "mysql2:服务端关了连接(`Connection lost: The server closed the connection.`,带 `fatal: true`)" },
|
|
95
|
+
{ code: "ER_CON_COUNT_ERROR", errno: 1040, why: "连接数满(`Too many connections`)—— 别人放连接之后就好" },
|
|
96
|
+
{ code: "08000", why: "PG connection_exception" },
|
|
97
|
+
{ code: "08001", why: "PG sqlclient_unable_to_establish_sqlconnection" },
|
|
98
|
+
{ code: "08003", why: "PG connection_does_not_exist" },
|
|
99
|
+
{ code: "08006", why: "PG connection_failure" },
|
|
100
|
+
{ code: "57P01", why: "PG admin_shutdown(库被管理员关停 / 重启)" },
|
|
101
|
+
{ code: "57P02", why: "PG crash_shutdown" },
|
|
102
|
+
{ code: "57P03", why: "PG cannot_connect_now(启动 / 恢复中)" },
|
|
103
|
+
{ code: "53300", why: "PG too_many_connections" },
|
|
104
|
+
{ code: "25006", why: "PG read_only_sql_transaction(故障切换后落在只读节点)" },
|
|
105
|
+
];
|
|
106
|
+
export const CONNECTION_FAULT_DRIVER_SENTENCES = [
|
|
107
|
+
{ sentence: "Connection terminated unexpectedly", source: "pg/lib/client.js", why: "node-pg:连接在使用中被对端关掉" },
|
|
108
|
+
{ sentence: "Client has encountered a connection error and is not queryable", source: "pg/lib/client.js", why: "node-pg:这条 client 的连接已出错,后续语句直接拒" },
|
|
109
|
+
{ sentence: "Connection terminated due to connection timeout", source: "pg-pool/index.js", why: "node-pg 池:建连超过 `connectionTimeoutMillis`" },
|
|
110
|
+
{ sentence: "timeout exceeded when trying to connect", source: "pg-pool/index.js", why: "node-pg 池:排队等连接超过 `connectionTimeoutMillis`" },
|
|
111
|
+
{ sentence: "Can't add new command when connection is in closed state", source: "mysql2/lib/base/connection.js", why: "mysql2:往一条已被对端关掉的连接上发语句(带 `fatal: true`、无 `code`)" },
|
|
112
|
+
];
|
|
113
|
+
const CONNECTION_FAULT_CODES = new Set([
|
|
114
|
+
...CONNECTION_FAULT_ERRORS.map((r) => r.code),
|
|
115
|
+
...MYSQL_CONNECTION_UNUSABLE_ERRORS.filter((r) => r.statementRefusal !== true).map((r) => r.code),
|
|
116
|
+
]);
|
|
117
|
+
const CONNECTION_FAULT_ERRNOS = new Set([
|
|
118
|
+
...CONNECTION_FAULT_ERRORS.flatMap((r) => (r.errno === undefined ? [] : [r.errno])),
|
|
119
|
+
...MYSQL_CONNECTION_UNUSABLE_ERRORS.filter((r) => r.statementRefusal !== true).map((r) => r.errno),
|
|
120
|
+
]);
|
|
121
|
+
const CONNECTION_FAULT_SENTENCES = new Set(CONNECTION_FAULT_DRIVER_SENTENCES.map((r) => r.sentence));
|
|
122
|
+
export function isConnectionFaultError(err) {
|
|
123
|
+
if (err === null || typeof err !== "object")
|
|
124
|
+
return false;
|
|
125
|
+
const code = keyOf(err, "code");
|
|
126
|
+
const errno = keyOf(err, "errno");
|
|
127
|
+
if (typeof code === "string" && CONNECTION_FAULT_CODES.has(code))
|
|
128
|
+
return true;
|
|
129
|
+
if (typeof errno === "number" && CONNECTION_FAULT_ERRNOS.has(errno))
|
|
130
|
+
return true;
|
|
131
|
+
return err instanceof Error && code === undefined && CONNECTION_FAULT_SENTENCES.has(err.message);
|
|
132
|
+
}
|
|
85
133
|
export class StoreRowTooLargeError extends Error {
|
|
86
134
|
row;
|
|
87
135
|
wall;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* **SQL JSON 列读腿的唯一属主**(
|
|
2
|
+
* **SQL JSON 列读腿的唯一属主**([ref] 设计稿 §2)—— 一列 JSON 怎么**投影**、怎么**恰好解一次码**、
|
|
3
3
|
* 读不出形怎么**拒**,整仓只有这一份定义。
|
|
4
4
|
*
|
|
5
5
|
* ── 病(KM / 7.92.2 C1 的真案,三库实测两次换形之后的终形)────────────────────────────────────
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
* `test/sql-json-column-single-owner.test.ts` 四道:①`JSON.parse(` 在 `src/plugins/**` 只许出现在本文件
|
|
24
24
|
* (未改调的店走显式 `PENDING_STORES` 登记 + 反向门);②JSON 承载列(清单由 `schema-ensure-legs` 的录制
|
|
25
25
|
* 驱动**机器派生**,不手抄)在 SELECT 投影里必须经 {@link jsonColumnText};③{@link decodeJsonColumn} 的
|
|
26
|
-
* `read` 实参必须是具名读者,禁内联 `(b) => b as T`;④(
|
|
26
|
+
* `read` 实参必须是具名读者,禁内联 `(b) => b as T`;④([ref])**读者 × 列可空性**求交,**双向**:每一只
|
|
27
27
|
* 形读者对承载列的可空性要求写在门的那张闭集表里,与 DDL 机器派生的读数不符即红(两个方向各一格)。
|
|
28
28
|
* 那条要求此前是注释里的一句散文,而整仓第二个用它的地方把它违了一整版。
|
|
29
29
|
*
|
|
30
|
-
* ── 「任意 JSON 值」那一族的三只铸点(
|
|
30
|
+
* ── 「任意 JSON 值」那一族的三只铸点([ref];区别在**名字**里,不在散文里)─────────────────────
|
|
31
31
|
* 一列的载荷没有声明形时,`null` 字面算不算合法值,**只由这一列有没有「缺席」这个状态**决定 —— 而那是
|
|
32
32
|
* 列可空性的另一种说法。所以这一族按可空性拆成三只,各自的前置条件由门双向咬:
|
|
33
33
|
* | 铸点 | 承载列必须 | JSON 字面 `null` |
|
|
@@ -69,9 +69,9 @@ export interface JsonColumnMember {
|
|
|
69
69
|
*
|
|
70
70
|
* 🔴 存在的唯一理由是「别名位在那里不合法」,**不是**给读腿留第二条路:读腿一律用 {@link jsonColumnText}
|
|
71
71
|
* (别名是它的产物的一部分,理由见那只函数)。今天整仓**两处**消费方,各自的「别名位不合法」都是真的:
|
|
72
|
-
* · `one-time-migrations.ts`
|
|
73
|
-
*
|
|
74
|
-
* · `workflow-journal-store-sql.ts` 的 `loadPage`(
|
|
72
|
+
* · `one-time-migrations.ts` 的几条改写(M8 / M17 / M18 / M21 的候选扫描与按原文 CAS 回写)——
|
|
73
|
+
* 它们要在 `WHERE` 里判这一列的**文本**,而 `WHERE` 没有别名位;
|
|
74
|
+
* · `workflow-journal-store-sql.ts` 的 `loadPage`([ref] 车③a)—— 那一列的投影裹在一条
|
|
75
75
|
* `CASE WHEN LENGTH(result) > ? THEN NULL ELSE <expr> END AS result_json` 里:**别名属于整条 CASE**
|
|
76
76
|
* (`result_json`,因为超字节门的那一支要给 `NULL`),CASE 里面的表达式位上写别名是语法错。
|
|
77
77
|
* 而「怎么把一列 JSON 取成文本」这件事整仓只能有一种写法:两种承载(真 JSON 列 / LONGTEXT 别名)在这条
|
|
@@ -106,9 +106,9 @@ export type SqlJsonColumnBodyProblem = Exclude<SqlJsonColumnProblem, "not-text">
|
|
|
106
106
|
* 店层码,**不上 wire**:店层折码口 {@link foldJsonColumn} 把它折成 {@link StoreCorruptError}
|
|
107
107
|
* (有自己闭集契约词的店折成自己的码)。终局对外码经 7.92.2 的词法门,永不裸穿。
|
|
108
108
|
*
|
|
109
|
-
* 🔴 **它只许在 `not-text` 那一形上穿过店的边界**(
|
|
109
|
+
* 🔴 **它只许在 `not-text` 那一形上穿过店的边界**([ref]):`not-text` 是读腿自己的缺陷(投影漂),
|
|
110
110
|
* 按 {@link foldJsonColumn} 的规则不折、原样上抛;而体的两形一旦穿出去,上层就得**按列错误类**分类,
|
|
111
|
-
* 那正是
|
|
111
|
+
* 那正是 [ref] 的病 —— 读口按列错误分类、店按店拒绝形折码,两层各说各话,坏体于是落进「店抖动」臂。
|
|
112
112
|
*/
|
|
113
113
|
export declare class SqlJsonColumnError extends Error {
|
|
114
114
|
readonly problem: SqlJsonColumnProblem;
|
|
@@ -157,9 +157,9 @@ export declare function decodeNullableJsonColumn<T>(cell: unknown, read: JsonCol
|
|
|
157
157
|
/**
|
|
158
158
|
* **「这一格耐久载荷读不出来」的店层拒绝**(整仓唯一一只)—— {@link foldJsonColumn} 的**恒定产物**。
|
|
159
159
|
*
|
|
160
|
-
* 🔴 为什么它必须是一只**具名类**而不是 `new Error(…)`(
|
|
160
|
+
* 🔴 为什么它必须是一只**具名类**而不是 `new Error(…)`([ref] 真案,7.95.1):折码的产物是**店交给
|
|
161
161
|
* 上层的契约**。折成裸 `Error` 之后,「这一行确定性地读不出来」与「店抖了一下」在上层**没有任何判别位**,
|
|
162
|
-
* 而两者的处置完全相反(前者要人去修那一行,后者重试 / 保守当缺席)。
|
|
162
|
+
* 而两者的处置完全相反(前者要人去修那一行,后者重试 / 保守当缺席)。[ref] 给续跑上下文修的正是这条
|
|
163
163
|
* 分家,可它在 SQL 车道上**结构不可达**整整一版:读口按**列错误类**分类,而店早把列错误折成了裸
|
|
164
164
|
* `Error` ⇒ 坏体一路掉进「店抖动 ⇒ 当缺席」臂,用户拿到的还是那个 409(local 车道答对,只是因为它
|
|
165
165
|
* 根本没折码、把列错误漏了出来 —— 巧合式正确,不是同一份契约)。
|
|
@@ -187,9 +187,9 @@ export declare class StoreCorruptError extends Error {
|
|
|
187
187
|
/**
|
|
188
188
|
* 店层折码的**唯一规则**(`catch (e) { throw foldJsonColumn(e, (m) => \`XStore: ${m} — refusing …\`); }`)。
|
|
189
189
|
*
|
|
190
|
-
* 🔴 回调交出来的是**一句话**,不是一只错误(
|
|
190
|
+
* 🔴 回调交出来的是**一句话**,不是一只错误([ref] 按类改):产物恒是 {@link StoreCorruptError},于是
|
|
191
191
|
* 「折成一只没有判别位的错」在**构造上**写不出来。此前这一格的签名是 `(message) => Error`,21 个调用点
|
|
192
|
-
* 里 19 个折成了裸 `Error` —— 每一个都是一枚等着下一个消费方来踩的
|
|
192
|
+
* 里 19 个折成了裸 `Error` —— 每一个都是一枚等着下一个消费方来踩的 [ref]。
|
|
193
193
|
*
|
|
194
194
|
* 🔴 `not-text` **不折**:它是读腿自己的缺陷(投影漏了),折成「这一行坏了」会把一次代码漂伪装成一次
|
|
195
195
|
* 数据事故 —— 这条判别只写在这里一处(与它的容忍侧孪生 {@link isJsonColumnBodyProblem} 共用),
|
|
@@ -233,7 +233,7 @@ export declare function createZodColumnReader<T>(schema: z.ZodType<T>): JsonColu
|
|
|
233
233
|
* 该店的域型交出去。整仓**只有这一处**做这一跳断言。
|
|
234
234
|
*
|
|
235
235
|
* 🔴 什么时候用它(硬条件,别扩大):这一列的键表属主**不在本层**,而那一层**没有导出验证器**。
|
|
236
|
-
* 两族,判据同一条(
|
|
236
|
+
* 两族,判据同一条([ref] 把这段与本函数第一句对齐 —— 它此前只写了 core 那一族,于是第二族要么被迫
|
|
237
237
|
* 违注、要么被迫另造一只读者,而「加一只特例读者」在本仓是红旗):
|
|
238
238
|
* · 属主在 **core**:`Checkpoint` / `ResumeOutcome` / `GateOutcome` / `WorkflowRun` /
|
|
239
239
|
* `BackgroundAgentRecord` …;
|
|
@@ -246,7 +246,7 @@ export declare function createZodColumnReader<T>(schema: z.ZodType<T>): JsonColu
|
|
|
246
246
|
* 一列只要有**本层自己的** schema 属主,就必须用 {@link createZodColumnReader} —— 用本函数等于把形判据关小。
|
|
247
247
|
*
|
|
248
248
|
* 🔴 为什么是一只工厂而不是让每个店各写一遍 `typeof body !== "object"`:那是同一条判据的 N 份拷贝
|
|
249
|
-
* (
|
|
249
|
+
* ([ref] 车② 初版真的写了六份),而且每一份都要自己那一跳 `as`。收成一处之后,判据只有一个写者,
|
|
250
250
|
* 断言也只发生在这一行 —— 类型卫生门因此在每个店里都读到零。
|
|
251
251
|
*/
|
|
252
252
|
export declare function createObjectColumnReader<T extends object>(): JsonColumnReader<T>;
|
|
@@ -265,17 +265,17 @@ export declare function isJsonObject(v: unknown): v is Record<string, unknown>;
|
|
|
265
265
|
*
|
|
266
266
|
* 🔴 前置条件(**门④ 机器执法,不是散文**):承载列**可空**,而「缺席」在它上面由**列的 NULL** 单独表达
|
|
267
267
|
* (三态列);于是 JSON 字面 `null` 是一个与缺席**不同形**的合法值。用在 `NOT NULL` 列上当场红 —— 那种列
|
|
268
|
-
* 根本没有缺席态,`null` 字面与「没有这一行」在点读的消费点上逐字同答,而那正是
|
|
268
|
+
* 根本没有缺席态,`null` 字面与「没有这一行」在点读的消费点上逐字同答,而那正是 [ref] 的病灶
|
|
269
269
|
* (`checkpoint_ctx.ctx`:`JSON NOT NULL` + 有结构的载荷,一整版都读回一个没人分得出来的 `null`)。
|
|
270
270
|
* NOT NULL 且契约不透明的列用 {@link readOpaqueJsonValueColumn};缺席落 SQL NULL 的用
|
|
271
271
|
* {@link readNonNullJsonValueColumn}(那一族把 `null` 字面判坏)。
|
|
272
272
|
*
|
|
273
273
|
* 之所以叫得出「三态」:范本是 `approval_ask.updated_input`([ref] / [ref])—— 列 NULL = 没带编辑,
|
|
274
274
|
* JSON 文本 `"null"` = **编辑成 null**,对象 = 编辑成那只对象;把 `"null"` 判成坏体会把一条合法的人类
|
|
275
|
-
* 编辑抹掉。这一句是**理由**,不是名单:哪几处在用它由门数,别在这里写计数(
|
|
275
|
+
* 编辑抹掉。这一句是**理由**,不是名单:哪几处在用它由门数,别在这里写计数([ref] 之前这里写着
|
|
276
276
|
* 「今天整仓只有一处符合」—— 那句话当时就是假的,而没有门看着的计数,下一个人加第二处时不会来改它)。
|
|
277
277
|
*
|
|
278
|
-
* 一列只要有结构,就**不许**用它 —— 那是把形判据静默关掉(这条是
|
|
278
|
+
* 一列只要有结构,就**不许**用它 —— 那是把形判据静默关掉(这条是 [ref] 的病灶判据,三只铸点同守)。
|
|
279
279
|
*/
|
|
280
280
|
export declare const readTriStateJsonValueColumn: JsonColumnReader<unknown>;
|
|
281
281
|
/**
|
|
@@ -294,14 +294,14 @@ export declare const readTriStateJsonValueColumn: JsonColumnReader<unknown>;
|
|
|
294
294
|
* 🔴 **它与 {@link readTriStateJsonValueColumn} 的实现逐字相同,而且必须各自独立写出来** —— 不许收成
|
|
295
295
|
* `export const readOpaqueJsonValueColumn = readTriStateJsonValueColumn`(门④c2 会红)。两只的区别整个
|
|
296
296
|
* 落在**前置条件**上(一只要可空列、一只要 NOT NULL 列),而前置条件的载体就是**名字**:合成一个名字就等于
|
|
297
|
-
* 把两条互斥的前置条件重新揉回一起 —— 那正是
|
|
297
|
+
* 把两条互斥的前置条件重新揉回一起 —— 那正是 [ref] 立案时那条散文析取的形。「去重」在这里去掉的不是重复,
|
|
298
298
|
* 是判据。
|
|
299
299
|
*/
|
|
300
300
|
export declare const readOpaqueJsonValueColumn: JsonColumnReader<unknown>;
|
|
301
301
|
/**
|
|
302
302
|
* **任意 JSON 值,但缺席由「列 NULL」表达**的列的形读者 —— `null` 字面判坏,其余一律是值。
|
|
303
303
|
*
|
|
304
|
-
* 🔴 这是**写腿吃 `unknown` 的那一族列**的正解(codex 对抗复审 [high] 验真后定形,
|
|
304
|
+
* 🔴 这是**写腿吃 `unknown` 的那一族列**的正解(codex 对抗复审 [high] 验真后定形,[ref] 车②):
|
|
305
305
|
* 写腿接的是 `unknown`(`PendingAction.args` / 账本行载荷 / leader 结果……),于是**数组 / 串 / 数 /
|
|
306
306
|
* 布尔实参都写得进去** —— 拿 {@link readJsonObjectColumn} 判它们就是「写腿收得下、读腿读不出」,而且
|
|
307
307
|
* 后果往往不是一行坏:`rows.map` 里一条这样的合法行会让整只读面抛。
|
|
@@ -312,14 +312,14 @@ export declare const readOpaqueJsonValueColumn: JsonColumnReader<unknown>;
|
|
|
312
312
|
* (根本没有缺席态),用 {@link readOpaqueJsonValueColumn}。
|
|
313
313
|
*
|
|
314
314
|
* 🔴 与 {@link readTriStateJsonValueColumn} 同属「承载列必须**可空**」这一族,所以同受门④ 约束
|
|
315
|
-
* (
|
|
315
|
+
* ([ref]):这族读者用在 `NOT NULL` 列上一律红 —— 列上没有 NULL 这个状态,「缺席」就无处安放,而写腿把
|
|
316
316
|
* 缺席落成 SQL NULL 这句话在那种列上根本执行不了。
|
|
317
317
|
*/
|
|
318
318
|
export declare const readNonNullJsonValueColumn: JsonColumnReader<unknown>;
|
|
319
319
|
/**
|
|
320
320
|
* **一只 JSON 数组**的承载形读者(内容判据归各列自己的既有属主,这里只判承载形)。
|
|
321
321
|
*
|
|
322
|
-
* 🔴 为什么在属主里而不是各店各写一遍(
|
|
322
|
+
* 🔴 为什么在属主里而不是各店各写一遍([ref] 车③a 把车② 的店内私有形上收):今天有三个消费方
|
|
323
323
|
* (checkpoint 的 `rule_suggestions` / `pending_steer_queue`、memory-engine 的 `embedding`),判据逐字
|
|
324
324
|
* 相同,而「这一格是不是一只数组」恰好是坏体四形的落点 —— 三份拷贝迟早有一份忘了判 `null` 字面。
|
|
325
325
|
*/
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* These were duplicated verbatim across the pg-/tidb- store twin pairs; each store imports the flavor
|
|
5
5
|
* it was written against so call sites and semantics are byte-identical to before.
|
|
6
6
|
*
|
|
7
|
-
* 🔴 **JSON 列的解析不在这里,也永远不会回来**(
|
|
8
|
-
* (lenient → `null` / strict → 抛 / fallback → 兜底),三种失败方向由**调用点自选** —— 那正是
|
|
7
|
+
* 🔴 **JSON 列的解析不在这里,也永远不会回来**([ref]):本文件曾住着三只 `parseJson*`
|
|
8
|
+
* (lenient → `null` / strict → 抛 / fallback → 兜底),三种失败方向由**调用点自选** —— 那正是 [ref]
|
|
9
9
|
* 要消灭的现状:同一格读不出的 JSON,在一个店里是「空体」、在另一个店里是「这一行不存在」、在第三个
|
|
10
10
|
* 店里是异常。三只在车③b **删除**(零别名、零转出),整仓唯一属主 = `sql-json-column.ts`
|
|
11
11
|
* (按文本投影 · 恰好解一次码 · 坏体一律拒),容忍写在店的调用点上(显式 `try/catch` + `recordFailOpen`)。
|