@sema-agent/server 7.134.0 → 7.135.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION.md +134 -0
- package/USAGE.md +98 -30
- 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 +62 -150
- package/dist/approval-card.js +33 -51
- package/dist/approval-content-kind.d.ts +22 -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 +1 -1
- package/dist/auto-mode-face.d.ts +4 -4
- package/dist/background-session-reap.d.ts +2 -2
- package/dist/bake-runner/main.d.ts +2 -2
- package/dist/bake-runner/runner.d.ts +4 -4
- package/dist/bench/s1/live-deps.d.ts +1 -1
- package/dist/bench/s1/run-firm.d.ts +1 -1
- package/dist/boot/coordinators.d.ts +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/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 +28 -24
- package/dist/boot/runner-deps.d.ts +11 -11
- package/dist/boot/runner-deps.js +3 -2
- package/dist/boot/session-faces.d.ts +3 -3
- package/dist/boot/session-faces.js +11 -30
- package/dist/boot/shutdown.d.ts +5 -5
- package/dist/boot/side-query-lane.d.ts +2 -2
- package/dist/boot/stage-05-execution-env.js +4 -4
- package/dist/boot/stage-06-runners.js +0 -2
- package/dist/boot/stores.js +2 -1
- package/dist/boot/web-admin.d.ts +17 -17
- package/dist/boot/web-admin.js +5 -10
- package/dist/boot/workflow-orchestration.js +2 -9
- package/dist/brain.d.ts +11 -11
- package/dist/budget.d.ts +4 -4
- 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 +10 -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 +26 -25
- package/dist/capability-facts.js +14 -16
- package/dist/center-config-tier.d.ts +1 -1
- package/dist/center-credential.d.ts +4 -4
- package/dist/checkpoint-identity.d.ts +5 -0
- package/dist/checkpoint-identity.js +14 -0
- package/dist/config-catalog.d.ts +12 -12
- package/dist/config-invariants.d.ts +4 -4
- package/dist/config-invariants.js +3 -2
- package/dist/config-lkg.d.ts +1 -1
- package/dist/config-provider.d.ts +13 -13
- package/dist/config-provider.js +2 -1
- package/dist/config-types.d.ts +83 -83
- package/dist/config.d.ts +26 -24
- package/dist/config.js +12 -10
- package/dist/cross-session-settings.d.ts +1 -1
- package/dist/delegated-session-owner.d.ts +16 -13
- package/dist/delegated-session-owner.js +9 -10
- package/dist/deployment-governance.d.ts +16 -16
- package/dist/deployment-shape.d.ts +127 -0
- package/dist/deployment-shape.js +72 -0
- package/dist/device-store.d.ts +1 -1
- package/dist/device-ws-hub.d.ts +1 -1
- package/dist/egress-redirect.d.ts +1 -1
- package/dist/entry-mode-clamp-notice.d.ts +2 -2
- package/dist/env-facts.d.ts +10 -9
- package/dist/env-facts.js +1 -1
- package/dist/env-name-allowlist-knobs.d.ts +5 -5
- package/dist/exec-bounds.d.ts +2 -2
- package/dist/execution-lane-caps.d.ts +31 -43
- package/dist/execution-lane-caps.js +0 -13
- package/dist/file-history-capture.d.ts +9 -9
- package/dist/file-history-disclosure.d.ts +23 -11
- package/dist/file-history-disclosure.js +7 -12
- 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 +13 -13
- package/dist/fleet-lease.d.ts +16 -16
- package/dist/governance-http-status.d.ts +2 -2
- package/dist/hooks/hook-llm.d.ts +7 -7
- package/dist/hooks/hook-runner.d.ts +57 -30
- package/dist/hooks/hook-runner.js +36 -18
- 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 +39 -13
- package/dist/http/checkpoint-ctx.js +74 -35
- package/dist/http/dispatch.d.ts +3 -3
- 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 +7 -7
- package/dist/http/resume-ctx-read.js +1 -1
- 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 -5
- package/dist/http/routes/approvals-assistant.js +55 -15
- 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 +22 -10
- package/dist/http/routes/session-sync.d.ts +1 -1
- package/dist/http/routes/session-sync.js +73 -44
- package/dist/http/routes/sessions-list.js +1 -1
- package/dist/http/routes/sessions.js +30 -44
- 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 +28 -21
- 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-url.d.ts +5 -5
- package/dist/model-select.d.ts +15 -6
- package/dist/model-select.js +5 -0
- package/dist/model-unreachable-notice.d.ts +3 -3
- package/dist/namespaced-rule-name.d.ts +15 -5
- package/dist/namespaced-rule-name.js +3 -2
- package/dist/observability/corrupt-read-seat.d.ts +9 -9
- package/dist/observability/cost-taxonomy.d.ts +1 -1
- package/dist/observability/err-text.d.ts +1 -1
- package/dist/observability/fail-open.d.ts +12 -8
- package/dist/observability/fail-open.js +12 -8
- package/dist/observability/metrics.d.ts +3 -3
- package/dist/observability/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 +16 -15
- package/dist/parked-decide.js +5 -4
- package/dist/parked-revive-surface.d.ts +7 -7
- package/dist/parked-revive-surface.js +2 -3
- package/dist/peer-directory.d.ts +3 -3
- package/dist/peer-directory.js +1 -1
- package/dist/permission-rule-list.d.ts +10 -1
- package/dist/permission-rule-list.js +7 -5
- package/dist/permission-rule-vocab.d.ts +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 +34 -15
- package/dist/plugins/approval-ask-store-sql.js +18 -5
- package/dist/plugins/approval-exemption-store.d.ts +3 -3
- package/dist/plugins/approval-nonce-store.d.ts +3 -3
- package/dist/plugins/background-agent-store-sql.d.ts +1 -1
- package/dist/plugins/background-shell-support.d.ts +2 -2
- package/dist/plugins/blob-backend.d.ts +1 -1
- package/dist/plugins/caching-session-store.d.ts +23 -32
- package/dist/plugins/caching-session-store.js +5 -17
- package/dist/plugins/checkpoint-index-columns.d.ts +81 -0
- package/dist/plugins/checkpoint-index-columns.js +62 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +44 -66
- package/dist/plugins/checkpoint-store-sql.js +55 -102
- package/dist/plugins/device-store-sql.d.ts +7 -6
- package/dist/plugins/e2b-orphan-reclaim.d.ts +1 -1
- package/dist/plugins/ensure-schema-lock-policy.d.ts +1 -1
- package/dist/plugins/file-history-store-sql.d.ts +9 -7
- package/dist/plugins/file-history-store-sql.js +27 -15
- package/dist/plugins/file-run-store.d.ts +8 -8
- package/dist/plugins/fork-routing-session-store.d.ts +2 -2
- package/dist/plugins/fork-routing-session-store.js +1 -1
- package/dist/plugins/host-platform.d.ts +10 -10
- package/dist/plugins/image-bake-store-sql.d.ts +1 -1
- package/dist/plugins/image-index-sql.d.ts +1 -1
- package/dist/plugins/leader-run-store-sql.d.ts +1 -1
- package/dist/plugins/local-checkpoint-store.d.ts +10 -10
- package/dist/plugins/local-checkpoint-store.js +3 -4
- 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 +66 -40
- package/dist/plugins/one-time-migrations.js +115 -34
- package/dist/plugins/outcome-ledger-sql.d.ts +1 -1
- package/dist/plugins/park-commit-watch.d.ts +3 -3
- package/dist/plugins/permission-rule-store-file.d.ts +5 -5
- package/dist/plugins/permission-rule-store-file.js +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 +8 -8
- package/dist/plugins/remote-env-local-docker.d.ts +2 -2
- package/dist/plugins/remote-env-ssh.d.ts +4 -4
- package/dist/plugins/remote-scratchpad.d.ts +2 -3
- package/dist/plugins/remote-scratchpad.js +0 -4
- package/dist/plugins/remote-shell.d.ts +6 -6
- package/dist/plugins/retention-lane-store-sql.d.ts +4 -4
- package/dist/plugins/retention-store-sql.d.ts +4 -4
- package/dist/plugins/roster-store-sql.d.ts +1 -1
- package/dist/plugins/run-store-sql.d.ts +8 -8
- package/dist/plugins/schema-consistency.d.ts +2 -2
- package/dist/plugins/schema-ensure-legs.d.ts +3 -3
- package/dist/plugins/schema-indexes.d.ts +1 -1
- package/dist/plugins/schema-live-columns.d.ts +1 -1
- package/dist/plugins/session-event-payload.d.ts +4 -4
- package/dist/plugins/session-fork.d.ts +34 -0
- package/dist/plugins/session-fork.js +29 -0
- package/dist/plugins/session-ownership.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/sql-driver.d.ts +8 -8
- package/dist/plugins/sql-errors.d.ts +1 -1
- package/dist/plugins/sql-json-column.d.ts +21 -21
- package/dist/plugins/sql-row-helpers.d.ts +2 -2
- package/dist/plugins/store-backend.d.ts +17 -16
- package/dist/plugins/store-backend.js +3 -3
- package/dist/plugins/store-contracts.d.ts +21 -21
- package/dist/plugins/task-attachment-store.d.ts +2 -2
- package/dist/plugins/task-list-store-sql.d.ts +1 -1
- package/dist/plugins/tidb-pool.d.ts +2 -2
- package/dist/plugins/tidb-pool.js +9 -2
- package/dist/plugins/tidb-session-store.d.ts +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 +19 -4
- package/dist/{orchestration/workflow-journal-entry.d.ts → plugins/workflow-journal-payload.d.ts} +23 -32
- package/dist/plugins/workflow-journal-payload.js +32 -0
- package/dist/plugins/workflow-journal-store-sql.d.ts +28 -14
- package/dist/plugins/workflow-journal-store-sql.js +34 -15
- package/dist/plugins/workflow-run-store-sql.d.ts +4 -4
- package/dist/posture-source.d.ts +11 -11
- package/dist/principal-jwt.d.ts +6 -6
- package/dist/project-identity.d.ts +3 -3
- package/dist/project-memory.d.ts +4 -4
- package/dist/read-face-posture.d.ts +7 -7
- package/dist/request-key-closure.d.ts +1 -1
- package/dist/request-key-closure.js +1 -1
- package/dist/request-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-governance.d.ts +9 -9
- package/dist/sandbox-pkg-source.d.ts +9 -31
- package/dist/sandbox-pkg-source.js +14 -8
- package/dist/sealed-key.d.ts +3 -3
- 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 +52 -35
- package/dist/session-incarnation.js +23 -8
- package/dist/session-policy-wire.d.ts +27 -5
- package/dist/session-policy-wire.js +15 -1
- package/dist/session-records-skipped-notice.d.ts +1 -1
- package/dist/session-sync-kernel.d.ts +4 -4
- package/dist/session-sync.d.ts +49 -6
- package/dist/session-sync.js +52 -10
- package/dist/session-titler.d.ts +7 -6
- package/dist/session-titler.js +8 -13
- package/dist/session-watch.d.ts +3 -3
- package/dist/session-watch.js +4 -4
- package/dist/sighup-idle.d.ts +2 -2
- package/dist/spec-fields.d.ts +4 -4
- package/dist/sql-engine-posture.d.ts +3 -3
- package/dist/store-posture.d.ts +2 -2
- package/dist/stored-request-tool-axes-m19.d.ts +1 -1
- package/dist/task-a2a.d.ts +3 -1
- package/dist/task-a2a.js +34 -2
- package/dist/task-cwd.d.ts +7 -88
- package/dist/task-cwd.js +2 -15
- package/dist/task-mcp.d.ts +12 -8
- package/dist/task-mcp.js +19 -4
- 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 +143 -197
- package/dist/tool-approval.js +13 -28
- package/dist/tool-rule-names.d.ts +2 -2
- package/dist/trace/core-keyset-guard.d.ts +12 -7
- 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 +41 -63
- 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 +44 -30
- package/dist/trace/redact.js +191 -89
- package/dist/trace/self-minted-wire.d.ts +35 -14
- package/dist/trace/self-minted-wire.js +8 -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.d.ts +52 -0
- package/dist/url-credential.js +49 -0
- package/dist/url-refusal.d.ts +6 -2
- package/dist/url-refusal.js +8 -1
- package/dist/usage-analytics.d.ts +2 -2
- package/dist/user-input-ledger.d.ts +23 -23
- package/dist/web-admin-client/apply-effective.d.ts +5 -5
- package/dist/web-admin-client/apply-effective.js +2 -1
- package/dist/web-admin-client/apply-ledger.d.ts +2 -2
- package/dist/web-admin-client/center-request.d.ts +2 -2
- package/dist/web-admin-client/facade.d.ts +5 -5
- package/dist/web-admin-client/facade.js +1 -1
- package/dist/web-admin-client/hot-keys-registry.d.ts +2 -2
- package/dist/web-admin-client/http-client.d.ts +4 -4
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/pull-state.d.ts +1 -1
- package/dist/web-admin-client/read-face.d.ts +2 -2
- package/dist/web-admin-client/read-warnings.d.ts +5 -5
- package/dist/web-admin-client/restart-signal.d.ts +6 -6
- package/dist/web-admin-client/skills-mcp.d.ts +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 +5 -3
- package/dist/write-protection.d.ts +2 -2
- package/package.json +4 -3
- package/scripts/drain-check-local.mjs +2 -1
- package/scripts/drain-check.mysql.sql +4 -2
- package/scripts/drain-check.pg.sql +4 -2
- package/skills/loop.md +1 -1
- 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
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ASK_USER_QUESTION_TOOL_NAME } from "../approval-content-kind.js";
|
|
1
|
+
import { SESSION_RULES_GRAMMAR, compileSessionRuleBucket, isGateKind, readSessionRulesShape, unreadableDenyEntries } from "@sema-agent/core";
|
|
2
|
+
import { APPROVAL_GATE_KINDS, ASK_USER_QUESTION_TOOL_NAME, isApprovalGateKind } from "../approval-content-kind.js";
|
|
3
|
+
import { APPROVAL_CARD_COLUMN_MAX_BYTES, buildCheckpointIndexCells } from "./checkpoint-index-columns.js";
|
|
3
4
|
import { dialectProtocolJsonEncoder } from "./sql-driver.js";
|
|
4
5
|
import { SCHEMA_STATEMENTS, acquireEnsureSchemaLock, releaseEnsureSchemaLock } from "./tidb-pool.js";
|
|
5
6
|
import { PG_SCHEMA_STATEMENTS, acquirePgEnsureSchemaLock, releasePgEnsureSchemaLock } from "./pg-pool.js";
|
|
@@ -18,7 +19,6 @@ import { MAILBOX_KEYED_TABLES, mailboxKeyDeleteSql, storedMailboxKeyless } from
|
|
|
18
19
|
const RETIRED_SESSION_RULE_BUCKETS = ["commandAllow", "commandDeny"];
|
|
19
20
|
export function buildMigrationReceipts() {
|
|
20
21
|
return {
|
|
21
|
-
auditDetailJsonNullRows: 0,
|
|
22
22
|
sessionIncarnationsBackfilled: 0,
|
|
23
23
|
holderDeathCodeRowsBackfilled: 0,
|
|
24
24
|
allowRuleShadowRowsMigrated: 0,
|
|
@@ -43,6 +43,9 @@ export function buildMigrationReceipts() {
|
|
|
43
43
|
workflowJournalForeignScopeRowsRemoved: 0,
|
|
44
44
|
retiredBreakerTablesDropped: 0,
|
|
45
45
|
mailboxRejectedKeyRowsRemoved: 0,
|
|
46
|
+
parkedApprovalCardsBackfilled: 0,
|
|
47
|
+
parkedApprovalCardRowsUnreadable: [],
|
|
48
|
+
parkedApprovalCardRowsTooLong: [],
|
|
46
49
|
};
|
|
47
50
|
}
|
|
48
51
|
function completedReport(r) {
|
|
@@ -53,8 +56,7 @@ function completedReport(r) {
|
|
|
53
56
|
return { ...r, sessionIncarnationColumn, workflowParkIndexKey, sessionRuleColumn, workflowJournalScopeColumn };
|
|
54
57
|
}
|
|
55
58
|
function changedAnything(r) {
|
|
56
|
-
return (r.
|
|
57
|
-
r.sessionIncarnationColumn === "added" ||
|
|
59
|
+
return (r.sessionIncarnationColumn === "added" ||
|
|
58
60
|
r.sessionIncarnationsBackfilled > 0 ||
|
|
59
61
|
r.holderDeathCodeRowsBackfilled > 0 ||
|
|
60
62
|
r.allowRuleShadowRowsMigrated > 0 ||
|
|
@@ -81,7 +83,10 @@ function changedAnything(r) {
|
|
|
81
83
|
r.workflowJournalOwnersBackfilled > 0 ||
|
|
82
84
|
r.workflowJournalForeignScopeRowsRemoved > 0 ||
|
|
83
85
|
r.retiredBreakerTablesDropped > 0 ||
|
|
84
|
-
r.mailboxRejectedKeyRowsRemoved > 0
|
|
86
|
+
r.mailboxRejectedKeyRowsRemoved > 0 ||
|
|
87
|
+
r.parkedApprovalCardsBackfilled > 0 ||
|
|
88
|
+
r.parkedApprovalCardRowsUnreadable.length > 0 ||
|
|
89
|
+
r.parkedApprovalCardRowsTooLong.length > 0);
|
|
85
90
|
}
|
|
86
91
|
function readingsSnapshot(r) {
|
|
87
92
|
return {
|
|
@@ -91,6 +96,8 @@ function readingsSnapshot(r) {
|
|
|
91
96
|
sessionRuleRowsWithRetiredBuckets: [...r.sessionRuleRowsWithRetiredBuckets],
|
|
92
97
|
sessionRuleRowsWithOldGrammarEntries: [...r.sessionRuleRowsWithOldGrammarEntries],
|
|
93
98
|
sessionRuleRowsWithUnreadableDeny: [...r.sessionRuleRowsWithUnreadableDeny],
|
|
99
|
+
parkedApprovalCardRowsUnreadable: [...r.parkedApprovalCardRowsUnreadable],
|
|
100
|
+
parkedApprovalCardRowsTooLong: [...r.parkedApprovalCardRowsTooLong],
|
|
94
101
|
};
|
|
95
102
|
}
|
|
96
103
|
function receiptSentence(r) {
|
|
@@ -115,17 +122,6 @@ export class OneTimeMigrationInterruptedError extends Error {
|
|
|
115
122
|
}
|
|
116
123
|
}
|
|
117
124
|
export const ONE_TIME_MIGRATIONS = [
|
|
118
|
-
{
|
|
119
|
-
id: "M4",
|
|
120
|
-
introducedIn: "7.93.5",
|
|
121
|
-
releasedOn: "2026-09-21",
|
|
122
|
-
removableAfter: "2026-10-21",
|
|
123
|
-
removal: "删 migrateOn 的 M4 步(`device_audit` 在场探针 + `UPDATE … SET detail = NULL`)与 `AUDIT_TABLE` / `AUDIT_DETAIL_COLUMN`;" +
|
|
124
|
-
"报告、日志行与 `NO_SQL_MIGRATIONS` 的 `auditDetailJsonNullRows`;它若是表里最后一条,按头注「窗」一节整个文件一起删",
|
|
125
|
-
afterRemoval: "`device-store-sql.ts` `listAudit` 的读形拒(S-550:一行读不出形 ⇒ 整页拒,刻意不逐行隔离):含一行 JSON 文本 `null` 的那一页" +
|
|
126
|
-
"读不出来,拒句点名行 id —— 响亮,但那一页会一直读不出来,直到运维手工把那些行的 `detail` 置成 SQL NULL",
|
|
127
|
-
reportKeys: ["auditDetailJsonNullRows"],
|
|
128
|
-
},
|
|
129
125
|
{
|
|
130
126
|
id: "M5",
|
|
131
127
|
introducedIn: "7.104.0",
|
|
@@ -134,7 +130,7 @@ export const ONE_TIME_MIGRATIONS = [
|
|
|
134
130
|
removal: "删 migrateOn 的 M5 步(`session_meta` 在场探针、`incarnation` 列在场探针 + `ADD COLUMN`、空化身回填循环)与 `backfillSessionIncarnations`;" +
|
|
135
131
|
"报告、日志行与 `NO_SQL_MIGRATIONS` 的 `sessionIncarnationColumn` / `sessionIncarnationsBackfilled`;**列本身留在中央 DDL 里**(它不是迁移的一部分)",
|
|
136
132
|
afterRemoval: "① 列不在的存量库:起服列册探针 `schema-consistency.ts`(S-547)的缺列臂拒启 `config.schema_mismatch`,拒句里的 `ALTER TABLE … ADD COLUMN` " +
|
|
137
|
-
"由同一份 DDL 生成(响亮);② 列在但行上仍是空化身(跳过了带 M5 的版本直接升)
|
|
133
|
+
"由同一份 DDL 生成(响亮);② 列在但行上仍是空化身(跳过了带 M5 的版本直接升):会话店头读投成活住客(`sessionFaceOfHead`)时对那一行响亮拒 " +
|
|
138
134
|
"`session.incarnation_missing`(parked 决定腿因此拒、记忆座退回按 id 绑定并 warn)—— 运维手工给那些行填一只随机令牌即可",
|
|
139
135
|
reportKeys: ["sessionIncarnationColumn", "sessionIncarnationsBackfilled"],
|
|
140
136
|
},
|
|
@@ -202,7 +198,7 @@ export const ONE_TIME_MIGRATIONS = [
|
|
|
202
198
|
"`http/routes/sessions.ts` 409 `conflict.session_ownerless` 句里「Ways out: on the local backend, during the upgrade window …」那半句(连同冻结表 " +
|
|
203
199
|
"`test/api-error-text-freeze.test.ts` 那一行、契约码目录 `docs/ASSISTANT-WIRE-CONTRACT.md` 那一行);本文件的 `migrationWindowOpen`(若再无别的读者)",
|
|
204
200
|
afterRemoval: "没有响亮臂(删码本身零行为变化:窗关那一刻起认领臂已经不生效):属主从没被记下的存量会话(边档那一格只有化身 —— 跳过了带本条的版本直接升," +
|
|
205
|
-
"或窗内从没被带 principal 提交过)照旧答无主(`
|
|
201
|
+
"或窗内从没被带 principal 提交过)照旧答无主(`headOf(id)?.owner` = null):它的会话规则这条路由读不了也改不了(409 `conflict.session_ownerless`)," +
|
|
206
202
|
"已存的规则对写下它们的 principal 的 run 照旧生效;出路 = 删会话(`DELETE /v1/sessions/:id`,规则随之删)",
|
|
207
203
|
reportKeys: [],
|
|
208
204
|
},
|
|
@@ -360,7 +356,7 @@ export const ONE_TIME_MIGRATIONS = [
|
|
|
360
356
|
releasedOn: "2026-10-18",
|
|
361
357
|
removableAfter: "2026-11-17",
|
|
362
358
|
removal: "删 migrateOn 的 M21 步(`repairParkedRows`:pending 候选分页扫描、门型回填、续不了的置 expired、问答卡词的整只文档读 + CAS 回写)与 `parkedRowRepairOf` / `ParkedRowRepair` / " +
|
|
363
|
-
"`M21_GATE` / `M21_PENDING_ACTION` / `PARKED_ROW_REPAIR_PAGE` / `QUESTION_CARD` / `
|
|
359
|
+
"`M21_GATE` / `M21_PENDING_ACTION` / `PARKED_ROW_REPAIR_PAGE` / `QUESTION_CARD` / `readM21Subtree` / `readM21Document` / `m21Subtree`;" +
|
|
364
360
|
"报告、日志行与 `NO_SQL_MIGRATIONS` 的 `parkedQuestionCardsWritten` / `parkedQuestionRowsLeftAsWritten` / `parkedRowGateKindsBackfilled` / `parkedRowsUnresumableExpired`;" +
|
|
365
361
|
"`test/one-time-migrations.test.ts` 的 M21 组与 `test/one-time-migrations-db-integration.test.ts` 的 M21 格",
|
|
366
362
|
afterRemoval: "① 门上没有卡词的存量问答行(跳过了带本条的版本直接升的库、把 `APPROVAL_TERMINAL_BACKSTOP_MS` 调长的部署、local 车道 —— 那一车道本条从来够不着):没有新的臂,回到本条之前的读法 —— " +
|
|
@@ -462,12 +458,23 @@ export const ONE_TIME_MIGRATIONS = [
|
|
|
462
458
|
"行字节不动 —— 出路 = 作为新任务重提(仍停驻的先取消),或升级时先过一次带本条的版本",
|
|
463
459
|
reportKeys: [],
|
|
464
460
|
},
|
|
461
|
+
{
|
|
462
|
+
id: "M29",
|
|
463
|
+
introducedIn: "7.135.0",
|
|
464
|
+
releasedOn: "2026-10-22",
|
|
465
|
+
removableAfter: "2026-11-21",
|
|
466
|
+
removal: "删 migrateOn 的 M29 步(`backfillParkedApprovalCards`:列在场探针、pending 候选分页扫描、整只文档读 + 同一只派生 + CAS 写列)与 `PARKED_CARD_BACKFILL_PAGE` / `readM29Document` / `m29CardOf`;" +
|
|
467
|
+
"报告、日志行(含逐行的 `parked_approval_card_row_unreadable` / `parked_approval_card_row_too_long`)与 `NO_SQL_MIGRATIONS` 的 `parkedApprovalCardsBackfilled` / `parkedApprovalCardRowsUnreadable` / `parkedApprovalCardRowsTooLong`;`test/one-time-migrations.test.ts` 的 M29 组与 " +
|
|
468
|
+
"`test/checkpoint-index-columns-db-integration.test.ts` 的 M29 格。**不随本条删**:`approval_card` 列、写口的派生、到期 facet 的生成谓词(常设)",
|
|
469
|
+
afterRemoval: "没有新的臂(如实):跳过了带本条的版本直接升的库,升级前停驻、升级后仍挂着的行卡列是 NULL —— 生成谓词读门型的 facet(审批门 ⇒ SLA 拒扫腿),问答行到期被拒扫" +
|
|
470
|
+
"(引擎对问答拒收 `sla_timeout`,拒扫腿每拍一条失败,由 `terminal_at_ms` 兜底收割);运维队列行不带卡词。出路 = 升级前答完 / 拒掉停驻的问答,或升级时先过一次带本条的版本",
|
|
471
|
+
reportKeys: ["parkedApprovalCardsBackfilled", "parkedApprovalCardRowsUnreadable", "parkedApprovalCardRowsTooLong"],
|
|
472
|
+
},
|
|
465
473
|
];
|
|
466
474
|
export function migrationWindowOpen(window, today) {
|
|
467
475
|
return window.removableAfter === null || today <= window.removableAfter;
|
|
468
476
|
}
|
|
469
477
|
export const NO_SQL_MIGRATIONS = {
|
|
470
|
-
auditDetailJsonNullRows: 0,
|
|
471
478
|
sessionIncarnationColumn: "lazy-on-read",
|
|
472
479
|
sessionIncarnationsBackfilled: 0,
|
|
473
480
|
allowRuleShadowRowsMigrated: 0,
|
|
@@ -495,9 +502,10 @@ export const NO_SQL_MIGRATIONS = {
|
|
|
495
502
|
workflowJournalForeignScopeRowsRemoved: 0,
|
|
496
503
|
retiredBreakerTablesDropped: 0,
|
|
497
504
|
mailboxRejectedKeyRowsRemoved: 0,
|
|
505
|
+
parkedApprovalCardsBackfilled: 0,
|
|
506
|
+
parkedApprovalCardRowsUnreadable: [],
|
|
507
|
+
parkedApprovalCardRowsTooLong: [],
|
|
498
508
|
};
|
|
499
|
-
const AUDIT_TABLE = "device_audit";
|
|
500
|
-
const AUDIT_DETAIL_COLUMN = "detail";
|
|
501
509
|
function mysqlDb(conn) {
|
|
502
510
|
return {
|
|
503
511
|
async rows(sql, params) {
|
|
@@ -584,9 +592,6 @@ async function migrateOn(db, dialect) {
|
|
|
584
592
|
return completedReport(receipts);
|
|
585
593
|
}
|
|
586
594
|
async function migrateStepsOn(db, dialect, receipts) {
|
|
587
|
-
if (await tableExists(db, dialect, AUDIT_TABLE)) {
|
|
588
|
-
receipts.auditDetailJsonNullRows += await db.exec(`UPDATE ${AUDIT_TABLE} SET ${AUDIT_DETAIL_COLUMN} = NULL ` + `WHERE ${AUDIT_DETAIL_COLUMN} IS NOT NULL AND ${jsonColumnTextExpr(dialect, AUDIT_DETAIL_COLUMN)} = 'null'`);
|
|
589
|
-
}
|
|
590
595
|
await migrateSessionIncarnations(db, dialect, receipts);
|
|
591
596
|
receipts.holderDeathCodeRowsBackfilled += await db.exec(dialect === "tidb"
|
|
592
597
|
? "UPDATE task_run SET error_code = ? WHERE status = 'failed' AND error_code IS NULL AND error = ?"
|
|
@@ -599,9 +604,10 @@ async function migrateStepsOn(db, dialect, receipts) {
|
|
|
599
604
|
await reshapeWorkflowParkIndex(db, dialect, receipts);
|
|
600
605
|
await migrateSessionRuleGrammar(db, dialect, receipts);
|
|
601
606
|
await repairParkedRows(db, dialect, receipts);
|
|
607
|
+
await backfillParkedApprovalCards(db, dialect, receipts);
|
|
602
608
|
if (await tableExists(db, dialect, "session_meta"))
|
|
603
609
|
await inheritPlacedSessionOwners(db, dialect, receipts);
|
|
604
|
-
if (await tableExists(db, dialect, PERMISSION_RULE_TABLE))
|
|
610
|
+
if ((await tableExists(db, dialect, PERMISSION_RULE_TABLE)) && (await columnExists(db, dialect, PERMISSION_RULE_TABLE, "grammar")))
|
|
605
611
|
await purgeUndurableScopeRows(db, dialect, receipts);
|
|
606
612
|
await moveWorkflowJournalScope(db, dialect, receipts);
|
|
607
613
|
if (await tableExists(db, dialect, RETIRED_BREAKER_TABLE))
|
|
@@ -1010,7 +1016,6 @@ const M21_GATE = { key: "gate", as: "m21_gate" };
|
|
|
1010
1016
|
const M21_PENDING_ACTION = { key: "pendingAction", as: "m21_pending_action" };
|
|
1011
1017
|
const PARKED_ROW_REPAIR_PAGE = 200;
|
|
1012
1018
|
const QUESTION_CARD = "question";
|
|
1013
|
-
const PARKED_APPROVAL_GATE_KINDS = Object.keys(PAUSE_REGISTRY).filter((k) => PAUSE_REGISTRY[k].pending === "tool_approval");
|
|
1014
1019
|
const readM21Subtree = createObjectColumnReader();
|
|
1015
1020
|
const readM21Document = createObjectColumnReader();
|
|
1016
1021
|
export function parkedRowRepairOf(gateKindCell, gate, pendingAction) {
|
|
@@ -1020,7 +1025,7 @@ export function parkedRowRepairOf(gateKindCell, gate, pendingAction) {
|
|
|
1020
1025
|
const kind = columnKind ?? documentKind;
|
|
1021
1026
|
const pa = pendingAction !== null && typeof pendingAction === "object" && !Array.isArray(pendingAction) ? pendingAction : undefined;
|
|
1022
1027
|
const questionCard = kind !== undefined &&
|
|
1023
|
-
|
|
1028
|
+
isApprovalGateKind(kind) &&
|
|
1024
1029
|
gateObj !== undefined &&
|
|
1025
1030
|
!Object.hasOwn(gateObj, "approvalCard") &&
|
|
1026
1031
|
pa?.kind === "tool_approval" &&
|
|
@@ -1040,7 +1045,7 @@ function m21Subtree(cell, where) {
|
|
|
1040
1045
|
}
|
|
1041
1046
|
export async function repairParkedRows(db, dialect, receipts) {
|
|
1042
1047
|
const ph = (n) => (dialect === "tidb" ? "?" : `$${n}`);
|
|
1043
|
-
const kinds =
|
|
1048
|
+
const kinds = APPROVAL_GATE_KINDS;
|
|
1044
1049
|
const kindSlots = kinds.map((_, i) => ph(i + 1)).join(", ");
|
|
1045
1050
|
const scan = `SELECT token, session_id, gate_kind, ${jsonColumnText(dialect, "checkpoint", M21_GATE)}, ${jsonColumnText(dialect, "checkpoint", M21_PENDING_ACTION)} FROM checkpoint ` +
|
|
1046
1051
|
`WHERE status = 'pending' AND (gate_kind IS NULL OR (gate_kind IN (${kindSlots}) AND tool_name = ${ph(kinds.length + 1)})) AND token > ${ph(kinds.length + 2)} ` +
|
|
@@ -1090,6 +1095,58 @@ export async function repairParkedRows(db, dialect, receipts) {
|
|
|
1090
1095
|
return;
|
|
1091
1096
|
}
|
|
1092
1097
|
}
|
|
1098
|
+
const PARKED_CARD_BACKFILL_PAGE = 200;
|
|
1099
|
+
const readM29Document = createObjectColumnReader();
|
|
1100
|
+
export async function backfillParkedApprovalCards(db, dialect, receipts) {
|
|
1101
|
+
if (!(await columnExists(db, dialect, "checkpoint", "approval_card")))
|
|
1102
|
+
return;
|
|
1103
|
+
const ph = (n) => (dialect === "tidb" ? "?" : `$${n}`);
|
|
1104
|
+
const kinds = APPROVAL_GATE_KINDS;
|
|
1105
|
+
const scan = `SELECT token FROM checkpoint WHERE status = 'pending' AND approval_card IS NULL AND gate_kind IN (${kinds.map((_, i) => ph(i + 1)).join(", ")}) ` +
|
|
1106
|
+
`AND token > ${ph(kinds.length + 1)} ORDER BY token LIMIT ${PARKED_CARD_BACKFILL_PAGE}`;
|
|
1107
|
+
let after = "";
|
|
1108
|
+
for (;;) {
|
|
1109
|
+
const page = await db.rows(scan, [...kinds, after]);
|
|
1110
|
+
for (const r of page) {
|
|
1111
|
+
const token = String(r.token);
|
|
1112
|
+
after = token;
|
|
1113
|
+
const [full] = await db.rows(`SELECT session_id, ${jsonColumnText(dialect, "checkpoint")} FROM checkpoint WHERE token = ${ph(1)} AND status = 'pending'`, [token]);
|
|
1114
|
+
if (full === undefined)
|
|
1115
|
+
continue;
|
|
1116
|
+
const reading = m29CardOf(full.checkpoint);
|
|
1117
|
+
if (reading.kind === "unreadable") {
|
|
1118
|
+
receipts.parkedApprovalCardRowsUnreadable.push({ sessionId: String(full.session_id) });
|
|
1119
|
+
continue;
|
|
1120
|
+
}
|
|
1121
|
+
if (reading.card === null)
|
|
1122
|
+
continue;
|
|
1123
|
+
const bytes = Buffer.byteLength(reading.card, "utf8");
|
|
1124
|
+
if (bytes > APPROVAL_CARD_COLUMN_MAX_BYTES[dialect]) {
|
|
1125
|
+
receipts.parkedApprovalCardRowsTooLong.push({ sessionId: String(full.session_id), bytes });
|
|
1126
|
+
continue;
|
|
1127
|
+
}
|
|
1128
|
+
receipts.parkedApprovalCardsBackfilled += await db.exec(`UPDATE checkpoint SET approval_card = ${ph(1)} WHERE token = ${ph(2)} AND status = 'pending' AND approval_card IS NULL`, [reading.card, token]);
|
|
1129
|
+
}
|
|
1130
|
+
if (page.length < PARKED_CARD_BACKFILL_PAGE)
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
function m29CardOf(cell) {
|
|
1135
|
+
let doc;
|
|
1136
|
+
try {
|
|
1137
|
+
doc = decodeJsonColumn(cell, readM29Document, "checkpoint.checkpoint (M29 approval-card backfill)");
|
|
1138
|
+
}
|
|
1139
|
+
catch (e) {
|
|
1140
|
+
if (!isJsonColumnBodyProblem(e))
|
|
1141
|
+
throw e;
|
|
1142
|
+
return { kind: "unreadable" };
|
|
1143
|
+
}
|
|
1144
|
+
const gate = doc.gate;
|
|
1145
|
+
const pendingAction = doc.pendingAction;
|
|
1146
|
+
if (typeof gate !== "object" || gate === null || typeof pendingAction !== "object" || pendingAction === null)
|
|
1147
|
+
return { kind: "unreadable" };
|
|
1148
|
+
return { kind: "card", card: buildCheckpointIndexCells(doc).approval_card };
|
|
1149
|
+
}
|
|
1093
1150
|
const PLACED_OWNER_SCAN_PAGE = 500;
|
|
1094
1151
|
function placedOwnerScanSql(dialect) {
|
|
1095
1152
|
return ("SELECT c.session_id, c.incarnation, r.session_id AS root_row, r.owner AS root_owner, r.incarnation AS root_incarnation, r.placement_kind AS root_kind, " +
|
|
@@ -1210,7 +1267,6 @@ async function backfillSessionIncarnations(db, dialect, receipts) {
|
|
|
1210
1267
|
}
|
|
1211
1268
|
function readingFields(r) {
|
|
1212
1269
|
return {
|
|
1213
|
-
auditDetailJsonNullRows: r.auditDetailJsonNullRows,
|
|
1214
1270
|
...(r.sessionIncarnationColumn !== undefined ? { sessionIncarnationColumn: r.sessionIncarnationColumn } : {}),
|
|
1215
1271
|
sessionIncarnationsBackfilled: r.sessionIncarnationsBackfilled,
|
|
1216
1272
|
holderDeathCodeRowsBackfilled: r.holderDeathCodeRowsBackfilled,
|
|
@@ -1239,6 +1295,9 @@ function readingFields(r) {
|
|
|
1239
1295
|
workflowJournalForeignScopeRowsRemoved: r.workflowJournalForeignScopeRowsRemoved,
|
|
1240
1296
|
retiredBreakerTablesDropped: r.retiredBreakerTablesDropped,
|
|
1241
1297
|
mailboxRejectedKeyRowsRemoved: r.mailboxRejectedKeyRowsRemoved,
|
|
1298
|
+
parkedApprovalCardsBackfilled: r.parkedApprovalCardsBackfilled,
|
|
1299
|
+
parkedApprovalCardRowsUnreadable: r.parkedApprovalCardRowsUnreadable.length,
|
|
1300
|
+
parkedApprovalCardRowsTooLong: r.parkedApprovalCardRowsTooLong.length,
|
|
1242
1301
|
};
|
|
1243
1302
|
}
|
|
1244
1303
|
export function logOneTimeMigrations(log, backend, report) {
|
|
@@ -1246,8 +1305,7 @@ export function logOneTimeMigrations(log, backend, report) {
|
|
|
1246
1305
|
backend,
|
|
1247
1306
|
...readingFields(report),
|
|
1248
1307
|
removableAfter: Object.fromEntries(ONE_TIME_MIGRATIONS.map((w) => [w.id, w.removableAfter])),
|
|
1249
|
-
note: "one-time persisted-data migrations (
|
|
1250
|
-
"text `null` by an earlier version folded to a SQL NULL, so \"no detail\" has exactly one on-disk spelling; M5: the " +
|
|
1308
|
+
note: "one-time persisted-data migrations (M5: the " +
|
|
1251
1309
|
"session incarnation column added and every session row without one minted its own token; M6: run rows failed by a " +
|
|
1252
1310
|
"holder-death verdict written by an earlier version with only the sentence got the machine-readable code run.stalled / " +
|
|
1253
1311
|
"run.orphaned; M7 writes nothing — it is the window of the refusal that keeps a suspended task whose stored allow list was written " +
|
|
@@ -1282,7 +1340,10 @@ export function logOneTimeMigrations(log, backend, report) {
|
|
|
1282
1340
|
"the breakers live in the new table breaker_state, which this step never touches; only the count is logged, never a key; M27: rows of the three " +
|
|
1283
1341
|
"mailbox tables (mailbox / mailbox_message / mailbox_tombstone) whose key — scope or handle — the mailbox key judge refuses (control characters, " +
|
|
1284
1342
|
"malformed Unicode, wider than 190 UTF-8 bytes, empty scope) removed, a whole box at a time: no entry point reaches such a key any more, so neither " +
|
|
1285
|
-
"delivery, reading nor session deletion would ever have touched them again; only the count is logged, never a key
|
|
1343
|
+
"delivery, reading nor session deletion would ever have touched them again; only the count is logged, never a key; M29: suspended rows " +
|
|
1344
|
+
"parked before the checkpoint column approval_card existed and still pending get that column — the approval card word on their gate, " +
|
|
1345
|
+
"derived by the same function the write path uses (the engine's checkpointIndexFacts); a row whose document cannot be read as a checkpoint " +
|
|
1346
|
+
"is left NULL and counted, named by a parked_approval_card_row_unreadable line, and so is a row whose card word is longer than the column can hold, named by a parked_approval_card_row_too_long line). Each step " +
|
|
1286
1347
|
"runs on every boot until its window closes (the release that introduced it + 30 days; the per-step date is in " +
|
|
1287
1348
|
"removableAfter, null while that release is not published yet) and is deleted in the first minor after that — start a " +
|
|
1288
1349
|
"version that still carries a step at least once before upgrading past its deletion.",
|
|
@@ -1290,6 +1351,26 @@ export function logOneTimeMigrations(log, backend, report) {
|
|
|
1290
1351
|
logReceiptRows(log, backend, report);
|
|
1291
1352
|
}
|
|
1292
1353
|
function logReceiptRows(log, backend, r) {
|
|
1354
|
+
for (const row of r.parkedApprovalCardRowsUnreadable) {
|
|
1355
|
+
log.warn("parked_approval_card_row_unreadable", {
|
|
1356
|
+
backend,
|
|
1357
|
+
sessionId: row.sessionId,
|
|
1358
|
+
note: "a suspended approval row's checkpoint document cannot be read as a checkpoint the engine can resume (the body is not a JSON object, or the gate / pending-action member is missing), so its approval card " +
|
|
1359
|
+
"could not be derived. The row was not backfilled and not touched: the checkpoint.approval_card column stays NULL and the document is exactly as it was. Such a row cannot be resumed either; " +
|
|
1360
|
+
"find it by its session id and repair or remove the checkpoint document, or delete the session. The row is named on every boot until then",
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
for (const row of r.parkedApprovalCardRowsTooLong) {
|
|
1364
|
+
log.warn("parked_approval_card_row_too_long", {
|
|
1365
|
+
backend,
|
|
1366
|
+
sessionId: row.sessionId,
|
|
1367
|
+
bytes: row.bytes,
|
|
1368
|
+
note: "a suspended approval row's gate carries an approval card word longer than the checkpoint.approval_card column can hold (the MySQL-protocol column is TEXT: 65,535 UTF-8 bytes). " +
|
|
1369
|
+
"The engine mints short card words only, so this row was edited by hand or written by something other than the engine. It was not backfilled and not truncated: the " +
|
|
1370
|
+
"column stays NULL and the read paths read the row as carrying no card (its document is untouched). Find the row by its session id and shorten " +
|
|
1371
|
+
"or remove the approvalCard member of its gate in the checkpoint document (the next boot then backfills it), or delete the session. The row is named on every boot until then",
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1293
1374
|
if (r.workflowJournalForeignScopeRowsRemoved > 0) {
|
|
1294
1375
|
log.warn("workflow_journal_foreign_scope_rows_removed", {
|
|
1295
1376
|
backend,
|
|
@@ -89,7 +89,7 @@ export declare function coreOutcomeToLedgerRow(o: CoreTaskOutcome): TaskOutcome;
|
|
|
89
89
|
* drop-and-recreate, and NO new `ALTER TABLE` seams are added here; fold into the CREATE instead.
|
|
90
90
|
*/
|
|
91
91
|
export declare const PG_OUTCOME_LEDGER_SCHEMA: string[];
|
|
92
|
-
/**
|
|
92
|
+
/** [ref]:本 store 的索引**声明**(两方言共用一份)。PG 侧由下面的 `ensurePgOutcomeLedgerSchema` 应用,MySQL 侧由 `tidb-pool.ts` 的中央 `ensureSchema` 应用(那里内联 `KEY` 已在 `CREATE TABLE` 里 ⇒ 新建库探到即零 DDL,存量库缺谁补谁)。加索引以外的 schema 变更仍归运维,见 `plugins/ensure-index.ts` 头注。 */
|
|
93
93
|
export declare const OUTCOME_LEDGER_INDEXES: readonly IndexSpec[];
|
|
94
94
|
/** Idempotent self-contained PG schema apply (for the integration test; central aggregation via pg-pool.ts). */
|
|
95
95
|
export declare function ensurePgOutcomeLedgerSchema(pool: PgPool | PoolClient): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 🔴 **
|
|
2
|
+
* 🔴 **[ref] F1(7.108.0 [ref] 合并复审 codex 腿 A ①,[high] 回归修)—— park 提交的唯一观察点。**
|
|
3
3
|
*
|
|
4
4
|
* core 的 durable park 就是对本仓 checkpoint 店的一次 `put`(SQL 孪生 / 本地文件店都是本仓的 `CheckpointStore` 实现,
|
|
5
5
|
* 一只实例、四个消费点 —— 见 `boot/stage-06-runners.ts` 的构造注)。审批协调器交出 park 路由(ask 回调返回 `"unavailable"`)
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* **已提交**的 park 报成失败;一只不收尾的订阅者会把 core 的停驻挂住(订阅者自己给自己的工作上墙钟上限)。
|
|
20
20
|
* 两个订阅者,各管一件「这只停车行提交了」之后的事:
|
|
21
21
|
* · 审批协调器 —— 有序关停下写候着的审计 settle 行(sink 自吞失败并按 [ref] 留痕,同 tag 扩射程,见协调器);
|
|
22
|
-
* · 对账收敛器 ——
|
|
22
|
+
* · 对账收敛器 —— [ref]:这次调用的 `PARKING` 行在这一拍收口成 `PARKED`(判据 1 那一只判官的即时调用,`approval-reconciler.ts`
|
|
23
23
|
* `bindCommittedPark`;它自带墙钟预算、失败只留痕,周期扫兜底)。`put` 等它(至多到它的预算)⇒ 健康时 core 的停驻返回之时行已收口;
|
|
24
24
|
* 预算到点它就交还 `put`、不再发新的店调用,已发出的那一次经 {@link ParkCommitWatch.track} 留在在飞里 ⇒ 收尾链的 `quiesce`
|
|
25
25
|
* 在 `backend.close()` 之前等到它落定。
|
|
@@ -46,7 +46,7 @@ export interface ParkCommitWatch {
|
|
|
46
46
|
onParkCommitted(listener: ParkCommittedListener): void;
|
|
47
47
|
/**
|
|
48
48
|
* 把订阅者在 `put` 交还之后**仍可能在跑**的那段工作记进在飞:`quiesce` 等它落定(成功或失败都算落定),返回同一个 promise。
|
|
49
|
-
* 用途(
|
|
49
|
+
* 用途([ref]):订阅者给自己的工作上了墙钟预算,到点就把 `put` 交还 core —— 而此刻已经发出的那次店调用还没回来;不记进来,
|
|
50
50
|
* 收尾链会读到「静默」并在它底下关池。
|
|
51
51
|
*/
|
|
52
52
|
track<T>(work: Promise<T>): Promise<T>;
|
|
@@ -12,9 +12,9 @@ import { type RuleCandidate } from "@sema-agent/core";
|
|
|
12
12
|
export declare class FileRuleApprovalRecordStore implements RuleApprovalRecordStore {
|
|
13
13
|
private readonly rows;
|
|
14
14
|
private readonly log;
|
|
15
|
-
/** 本面的损坏闸(
|
|
15
|
+
/** 本面的损坏闸([ref] 起由重放属主交回;置位后每个方法第一行响亮拒)。 */
|
|
16
16
|
private readonly gate;
|
|
17
|
-
/** @param warn 腐读披露座(
|
|
17
|
+
/** @param warn 腐读披露座([ref];缺席 ⇒ 属主退回 `console.warn`)。 */
|
|
18
18
|
constructor(dir: string, warn?: Logger["warn"]);
|
|
19
19
|
/** 取证/自证用:本面是否因内部损坏而 fail-closed。 */
|
|
20
20
|
get corrupt(): boolean;
|
|
@@ -42,11 +42,11 @@ export declare class FileRuleApprovalRecordStore implements RuleApprovalRecordSt
|
|
|
42
42
|
export declare class FileRuleImportTicketStore {
|
|
43
43
|
private readonly rows;
|
|
44
44
|
private readonly log;
|
|
45
|
-
/** 本面的损坏闸(
|
|
45
|
+
/** 本面的损坏闸([ref] 起由重放属主交回)。 */
|
|
46
46
|
private readonly gate;
|
|
47
47
|
/** 单调钟(判定用)。与 {@link now}(墙钟,记账用)是两只不同的钟,别混。 */
|
|
48
48
|
private readonly monotonic;
|
|
49
|
-
/** @param warn 腐读披露座(
|
|
49
|
+
/** @param warn 腐读披露座([ref];缺席 ⇒ 属主退回 `console.warn`)。 */
|
|
50
50
|
constructor(dir: string, now?: () => number, warn?: Logger["warn"], monotonic?: () => number);
|
|
51
51
|
private readonly now;
|
|
52
52
|
/** 取证/自证用:本面是否因内部损坏而 fail-closed。 */
|
|
@@ -105,7 +105,7 @@ export interface FilePermissionRuleStores extends PermissionRuleStoreBundle {
|
|
|
105
105
|
* `onError` 接的是 core 规则文件的**披露面**(读不出来 / 校验和不符 / 撞上符号链接时它答零规则并
|
|
106
106
|
* 说出来)。接住它打一条 warn 是**必须**的:那条路径上「零规则」与「真的没有规则」在读面上同形,
|
|
107
107
|
* 不留痕就变成一次静默的 fail-closed(用户会突然被反复询问,却没有任何线索)。
|
|
108
|
-
* `warn`(
|
|
108
|
+
* `warn`([ref])接的是本仓审批记录 / 导入票两份日志的**腐读座**(逐行披露 + 计数;缺席 ⇒ `console.warn`)。
|
|
109
109
|
*/
|
|
110
110
|
export declare function createFilePermissionRuleStores(root: string, opts?: {
|
|
111
111
|
onError?: (message: string) => void;
|
|
@@ -4,28 +4,19 @@ import { readdirSync } from "node:fs";
|
|
|
4
4
|
import { performance } from "node:perf_hooks";
|
|
5
5
|
import { FileDurableRulePartitionProvider, AppendLog, ensureDir, } from "@sema-agent/core";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
import { DurableRuleScopeSchema, buildRulePayloadHash } from "./permission-rule-store-sql.js";
|
|
7
|
+
import { DurableRuleScopeSchema, RuleOffer2Schema, buildRulePayloadHash, recordOwnerOf, refusedOwnerSentence } from "./permission-rule-store-sql.js";
|
|
8
8
|
import { replayJsonlGuarded } from "../observability/corrupt-read-seat.js";
|
|
9
|
-
import { EDITED_RULE_BREADTH_WARNING_CODES, RULE_APPROVAL_KINDS, RULE_APPROVAL_RECORD_SCHEMA, RULE_APPROVAL_STATES, RULE_BEHAVIORS,
|
|
9
|
+
import { EDITED_RULE_BREADTH_WARNING_CODES, RULE_APPROVAL_KINDS, RULE_APPROVAL_RECORD_SCHEMA, RULE_APPROVAL_STATES, RULE_BEHAVIORS, readRuleOwner } from "@sema-agent/core";
|
|
10
10
|
const RuleDotSchema = z.object({ actor: z.string().min(1), counter: z.number().int().nonnegative().safe() }).strict();
|
|
11
11
|
const RuleCandidateSchema = z.object({ behavior: z.enum(RULE_BEHAVIORS), rule: z.string(), scope: DurableRuleScopeSchema }).strict();
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
uncoveredDetail: z.array(z.object({ segment: z.string(), reason: z.enum(UNCOVERED_SEGMENT_REASONS) }).strict()).optional(),
|
|
21
|
-
})
|
|
22
|
-
.strict(),
|
|
23
|
-
]);
|
|
24
|
-
const OWNER_SHAPE_BY_KIND = {
|
|
25
|
-
principal: z.object({ kind: z.literal("principal"), principal: z.string() }).strict(),
|
|
26
|
-
"local-owner": z.object({ kind: z.literal("local-owner") }).strict(),
|
|
27
|
-
};
|
|
28
|
-
const RuleOwnerSchema = z.union([OWNER_SHAPE_BY_KIND.principal, OWNER_SHAPE_BY_KIND["local-owner"]]);
|
|
12
|
+
const RuleOwnerSchema = z.unknown().transform((raw, ctx) => {
|
|
13
|
+
const owner = readRuleOwner(raw);
|
|
14
|
+
if (owner === undefined) {
|
|
15
|
+
ctx.addIssue({ code: "custom", message: "not a rule owner (the engine's readRuleOwner reads none: a plain record whose kind is a member and, for a principal, whose name is not empty or whitespace-only)" });
|
|
16
|
+
return z.NEVER;
|
|
17
|
+
}
|
|
18
|
+
return owner;
|
|
19
|
+
});
|
|
29
20
|
const ApprovalRecordSchema = z
|
|
30
21
|
.object({
|
|
31
22
|
id: z.string().min(1),
|
|
@@ -163,6 +154,8 @@ export class FileRuleApprovalRecordStore {
|
|
|
163
154
|
}
|
|
164
155
|
async create(record) {
|
|
165
156
|
this.gate.assertUsable();
|
|
157
|
+
if (recordOwnerOf(record) === undefined)
|
|
158
|
+
throw new Error(refusedOwnerSentence(record.id));
|
|
166
159
|
if (this.rows.has(record.id))
|
|
167
160
|
throw new Error(`rule approval record ${record.id} already exists`);
|
|
168
161
|
this.log.append({ op: "put", record }, true);
|
|
@@ -31,6 +31,23 @@ export declare function writerOfSqlRuleStore(store: DurableRulePartition): Permi
|
|
|
31
31
|
* (下方 `RuleCandidateSchema`;File 店的审批记录读同一只)。
|
|
32
32
|
*/
|
|
33
33
|
export declare const DurableRuleScopeSchema: z.ZodType<RuleScope>;
|
|
34
|
+
export declare const RuleOffer2Schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
35
|
+
kind: z.ZodLiteral<"single">;
|
|
36
|
+
candidate: z.ZodNumber;
|
|
37
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
38
|
+
kind: z.ZodLiteral<"batch">;
|
|
39
|
+
candidates: z.ZodArray<z.ZodNumber>;
|
|
40
|
+
segments: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
41
|
+
uncoveredSegments: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
uncoveredDetail: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
43
|
+
segment: z.ZodString;
|
|
44
|
+
reason: z.ZodEnum<{
|
|
45
|
+
redirection: "redirection";
|
|
46
|
+
no_rule_form: "no_rule_form";
|
|
47
|
+
cap_overflow: "cap_overflow";
|
|
48
|
+
}>;
|
|
49
|
+
}, z.core.$strict>>>;
|
|
50
|
+
}, z.core.$strict>]>;
|
|
34
51
|
export declare const PERMISSION_RULE_TABLE = "permission_rule";
|
|
35
52
|
export declare const PERMISSION_RULE_APPROVAL_TABLE = "permission_rule_approval";
|
|
36
53
|
export declare const PERMISSION_RULE_TICKET_TABLE = "permission_rule_ticket";
|
|
@@ -112,7 +129,7 @@ export declare function assertPermissionRuleApprovalSchema(query: (sql: string)
|
|
|
112
129
|
export declare function assertPermissionRuleTicketSchema(query: (sql: string) => Promise<{
|
|
113
130
|
rows: Record<string, unknown>[];
|
|
114
131
|
}>, dialect: "tidb" | "pg"): Promise<void>;
|
|
115
|
-
/**
|
|
132
|
+
/** [ref]:本 store 的索引**声明**(两方言共用一份)。PG 侧由下面的 `ensurePgPermissionRuleSchema` 应用,MySQL 侧由 `tidb-pool.ts` 的中央 `ensureSchema` 应用(那里内联 `KEY` 已在 `CREATE TABLE` 里 ⇒ 新建库探到即零 DDL,存量库缺谁补谁)。加索引以外的 schema 变更仍归运维,见 `plugins/ensure-index.ts` 头注。 */
|
|
116
133
|
export declare const PERMISSION_RULE_INDEXES: readonly IndexSpec[];
|
|
117
134
|
export declare function ensurePgPermissionRuleSchema(q: PgQueryFn): Promise<void>;
|
|
118
135
|
/**
|
|
@@ -124,9 +141,14 @@ export declare function ensurePgPermissionRuleSchema(q: PgQueryFn): Promise<void
|
|
|
124
141
|
* 种别前缀让两族键不可能相撞(`principal:` vs `local-owner`)。
|
|
125
142
|
*/
|
|
126
143
|
export declare function buildRuleOwnerKey(owner: RuleOwner): string;
|
|
127
|
-
/** 内容三列 +
|
|
144
|
+
/** 内容三列 + 观测向量 + **文法戳**(非 NULL 时)的完整性指纹(core `ruleStoreChecksum` 同精神;**不含** rev/counter —— 那两样
|
|
128
145
|
* 是元数据轴,`nextDot` 只动 counter 就不该迫使重算内容指纹)。
|
|
129
146
|
*
|
|
147
|
+
* 🔴 戳在指纹里(`grammar` 在场 ⇒ 进规范体;缺席 ⇒ 键不在,字节与 7.134.0 的算法逐字节相同 —— 存量无戳行的指纹一个字节不变,
|
|
148
|
+
* 升级不重写任何存量桶)。为什么要进:7.134.x / 引擎 7.54.x 的副本不读戳,若戳在指纹外,它们会把本版新文法写下的 deny 读成「无形」、
|
|
149
|
+
* 什么也不拒就放行;戳进指纹后,它们对带戳桶按旧算法重算比不上、**整桶拒(响亮)**。代价与推论:戳列与指纹必须**同一条语句**写
|
|
150
|
+
* (建行的 INSERT、整桶回写的 UPDATE),所以取 dot 的计数 UPDATE 不碰戳 —— 它不读桶体、没法重算指纹。
|
|
151
|
+
*
|
|
130
152
|
* 导出(纯数据 ⇒ `build*`)是为了让**取证测试**能造一条「指纹自洽但语义矛盾」的行 —— 那正是
|
|
131
153
|
* codex round1 [high] 二的形:一条只靠指纹是拦不住的坏行,必须由语义筛拦。 */
|
|
132
154
|
export declare function buildRuleBucketChecksum(body: {
|
|
@@ -134,6 +156,8 @@ export declare function buildRuleBucketChecksum(body: {
|
|
|
134
156
|
tombstones: readonly unknown[];
|
|
135
157
|
quarantined: readonly unknown[];
|
|
136
158
|
observedVector?: RuleSyncFrontier;
|
|
159
|
+
/** 这只桶的行写在哪一版规则文法里(`SESSION_RULES_GRAMMAR` 的数);缺席 = 存量无戳行(列 NULL)。 */
|
|
160
|
+
grammar?: number;
|
|
137
161
|
}): string;
|
|
138
162
|
/**
|
|
139
163
|
* SQL 双方言的 {@link DurableRulePartitionProvider} —— [ref] 里的 **durable 分区后端**
|
|
@@ -151,6 +175,16 @@ export declare class SqlDurableRulePartitionProvider implements DurableRuleParti
|
|
|
151
175
|
forPrincipal(principal: string | undefined): DurableRulePartition;
|
|
152
176
|
forLocalOwner(): DurableRulePartition;
|
|
153
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* 一条审批记录的属主 —— 记录自带的 `owner`,缺席时是 v1 记录的 `principal`;读法只有引擎的 `readRuleOwner`(两只店的写口与 SQL 店读口同用):
|
|
180
|
+
* 读不出 ⇒ `undefined`(闭集外的种类、缺 / 纯空白的主体名)。写口据此「只写读得回来的属主」—— 否则落下的行会在读口 / 重放时才被拒(SQL 一行读不出,File 日志重放整面 fail-closed)。
|
|
181
|
+
*/
|
|
182
|
+
export declare function recordOwnerOf(record: {
|
|
183
|
+
readonly owner?: unknown;
|
|
184
|
+
readonly principal?: unknown;
|
|
185
|
+
}): RuleOwner | undefined;
|
|
186
|
+
/** 写口拒句(两只店同一句):属主引擎读不出,记录不落。 */
|
|
187
|
+
export declare function refusedOwnerSentence(recordId: string): string;
|
|
154
188
|
/**
|
|
155
189
|
* durable 审批记录。CAS **按 rev**,不按 state —— core 的原话:批记录的第二个候选会 redeemed→redeemed,
|
|
156
190
|
* 只比 state 的两次并发重试会**都**认为自己看到了预期状态,各铸一个 dot、各写一次,后者静默覆盖前者的
|
|
@@ -439,7 +473,7 @@ export interface UnreadableRuleBucket {
|
|
|
439
473
|
}
|
|
440
474
|
/**
|
|
441
475
|
* M11 写进的读数账 —— 三格与一次性迁移段那一只收据账(`one-time-migrations.ts` 的 `MigrationReceipts`)上的同名三格**同名同形**,迁移段把它的账直接递进来
|
|
442
|
-
* (
|
|
476
|
+
* ([ref]:一次起服一只收据账,M11 不另起第二套):删掉的行在那只桶的回写**提交的那一刻**追加,之后任何一步失败,拒因随账带走它们。
|
|
443
477
|
*/
|
|
444
478
|
export interface UndurableScopePurgeReadings {
|
|
445
479
|
/** 删掉的行(一行一条读数;每只桶的回写提交之后才追加)。 */
|
|
@@ -468,7 +502,7 @@ export interface UndurableScopePurgeDb {
|
|
|
468
502
|
* 本店也不实现同步(见 `apply` 的 sync-join 臂)。
|
|
469
503
|
* 幂等:第二跑零命中零写(读不出的桶每一跑照报,直到有人处置)。
|
|
470
504
|
* 读数写进调用方递进来的账(`into`,{@link UndurableScopePurgeReadings}):删掉的行在那只桶的回写提交之后追加 ⇒ 本函数半途抛出时,已删的行已经在账上;
|
|
471
|
-
* 错误**原样**上抛(不加工、不自铸拒因句 —— 收据由迁移段那一只收据账随拒因带走,
|
|
505
|
+
* 错误**原样**上抛(不加工、不自铸拒因句 —— 收据由迁移段那一只收据账随拒因带走,[ref])。
|
|
472
506
|
*/
|
|
473
507
|
export declare function purgeUndurableScopeRows(db: UndurableScopePurgeDb, dialect: "tidb" | "pg", into: UndurableScopePurgeReadings, now?: () => number): Promise<void>;
|
|
474
508
|
/** 三个 SQL 面的一次性装配束(one driver, three faces)。`durable` = [ref] 的 durable 分区后端;
|