@sema-agent/server 7.150.0 → 7.152.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 +451 -0
- package/README.md +15 -3
- package/README.zh-CN.md +10 -2
- package/USAGE.md +144 -87
- package/deploy/sema-up/README.md +11 -4
- package/deploy/sema-up/chart/Chart.yaml +1 -1
- package/deploy/sema-up/chart/templates/NOTES.txt +5 -0
- package/deploy/sema-up/chart/templates/_helpers.tpl +15 -16
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -3
- package/deploy/sema-up/chart/templates/server.yaml +5 -3
- package/deploy/sema-up/chart/values-full-single.yaml +3 -1
- package/deploy/sema-up/chart/values.yaml +8 -1
- package/deploy/sema-up/cluster-up.sh +7 -6
- package/deploy/sema-up/kube-up.sh +6 -6
- package/deploy/sema-up/lib/flagshape.sh +36 -8
- package/deploy/sema-up/lib/helm-values-cluster.py +2 -0
- package/deploy/sema-up/lib/helm-values-kube.py +2 -0
- package/deploy/sema-up/machines.example.yaml +3 -1
- package/deploy/sema-up/sema-up.sh +22 -16
- package/dist/adoption/import.js +3 -3
- package/dist/approval-ask-audit-store.d.ts +1 -1
- package/dist/approval-ask-machine.d.ts +4 -10
- package/dist/approval-ask-retention.d.ts +1 -1
- package/dist/approval-card.d.ts +12 -14
- package/dist/approval-gate-currency.d.ts +9 -9
- package/dist/approval-gate-currency.js +3 -4
- package/dist/approval-hmac.d.ts +17 -1
- package/dist/approval-hmac.js +7 -1
- package/dist/approval-queue-kind.d.ts +1 -1
- package/dist/approval.d.ts +2 -2
- package/dist/approval.js +2 -2
- package/dist/auth-bridge.d.ts +20 -0
- package/dist/auth-bridge.js +9 -0
- package/dist/background-session-reap.d.ts +1 -1
- package/dist/bake-runner/main.d.ts +4 -2
- package/dist/bind-host.d.ts +3 -6
- package/dist/bind-host.js +4 -7
- package/dist/boot/budget-tracing.js +1 -1
- package/dist/boot/coordinators.d.ts +1 -1
- package/dist/boot/coordinators.js +9 -10
- package/dist/boot/device-lane.js +2 -0
- package/dist/boot/engine-lease.d.ts +5 -0
- package/dist/boot/engine-lease.js +1 -0
- package/dist/boot/execution-env.d.ts +9 -14
- package/dist/boot/execution-env.js +85 -22
- package/dist/boot/execution-lane.js +32 -5
- package/dist/boot/late-binds.d.ts +8 -4
- package/dist/boot/late-binds.js +7 -1
- package/dist/boot/leader.d.ts +31 -30
- package/dist/boot/leader.js +38 -28
- package/dist/boot/leg-path-adjudication.d.ts +40 -0
- package/dist/boot/leg-path-adjudication.js +18 -0
- package/dist/boot/memory-consolidation.d.ts +3 -2
- package/dist/boot/memory-consolidation.js +6 -6
- package/dist/boot/parked-revive-gate.js +3 -15
- package/dist/boot/reapers.d.ts +6 -1
- package/dist/boot/reapers.js +13 -2
- package/dist/boot/resolve-spec.d.ts +3 -3
- package/dist/boot/resolve-spec.js +43 -48
- package/dist/boot/runner-deps.d.ts +46 -35
- package/dist/boot/runner-deps.js +94 -91
- package/dist/boot/session-age-out.d.ts +36 -0
- package/dist/boot/session-age-out.js +101 -0
- package/dist/boot/session-faces.d.ts +5 -14
- package/dist/boot/session-faces.js +9 -5
- package/dist/boot/shutdown.d.ts +6 -0
- package/dist/boot/shutdown.js +10 -4
- package/dist/boot/stage-01-config.js +2 -0
- package/dist/boot/stage-02-web-admin-pull.js +4 -5
- package/dist/boot/stage-05-execution-env.d.ts +5 -3
- package/dist/boot/stage-05-execution-env.js +3 -2
- package/dist/boot/stage-06-runners.d.ts +9 -4
- package/dist/boot/stage-06-runners.js +24 -9
- package/dist/boot/stage-07-capability-layer.d.ts +8 -4
- package/dist/boot/stage-07-capability-layer.js +3 -2
- package/dist/boot/stage-08-reapers.d.ts +8 -4
- package/dist/boot/stage-08-reapers.js +4 -2
- package/dist/boot/stage-09-leader.d.ts +12 -5
- package/dist/boot/stage-09-leader.js +14 -5
- package/dist/boot/stage-10-http-server.d.ts +19 -5
- package/dist/boot/stage-10-http-server.js +14 -21
- package/dist/boot/stores.js +7 -4
- package/dist/boot/web-admin.js +5 -8
- package/dist/boot/workflow-orchestration.d.ts +7 -2
- package/dist/boot/workflow-orchestration.js +24 -7
- package/dist/bounded-rotation.d.ts +29 -0
- package/dist/bounded-rotation.js +24 -0
- package/dist/capabilities/approvals-push.d.ts +3 -3
- package/dist/capabilities/scenarios.d.ts +28 -13
- package/dist/capabilities/scenarios.js +2 -2
- package/dist/capability-facts.d.ts +43 -32
- package/dist/capability-facts.js +45 -51
- package/dist/card-rule-offers.d.ts +32 -0
- package/dist/card-rule-offers.js +130 -0
- package/dist/center-credential.d.ts +25 -6
- package/dist/center-credential.js +25 -5
- package/dist/config-catalog.d.ts +26 -7
- package/dist/config-catalog.js +26 -22
- package/dist/config-dir-trust.js +4 -2
- package/dist/config-invariants.d.ts +20 -8
- package/dist/config-invariants.js +55 -12
- package/dist/config-lkg.d.ts +5 -19
- package/dist/config-lkg.js +8 -62
- package/dist/config-provider.d.ts +1 -1
- package/dist/config-root-migration.d.ts +2 -2
- package/dist/config-types.d.ts +38 -42
- package/dist/config.d.ts +58 -7
- package/dist/config.js +90 -40
- package/dist/control-socket.d.ts +51 -0
- package/dist/control-socket.js +115 -0
- package/dist/deployment-governance.d.ts +2 -1
- package/dist/deployment-shape.d.ts +9 -1
- package/dist/deployment-shape.js +2 -1
- package/dist/device-protocol.d.ts +5 -4
- package/dist/device-protocol.js +1 -1
- package/dist/device-ws-hub.d.ts +7 -0
- package/dist/device-ws-hub.js +10 -3
- package/dist/device-ws-protocol.d.ts +63 -10
- package/dist/device-ws-protocol.js +56 -25
- package/dist/elicitation.js +2 -2
- package/dist/engine-identity.d.ts +19 -7
- package/dist/engine-identity.js +10 -2
- package/dist/entry-mode-clamp-notice.d.ts +2 -1
- package/dist/entry-problems.d.ts +40 -3
- package/dist/entry-problems.js +3 -1
- package/dist/execution-env-refusal.d.ts +29 -0
- package/dist/execution-env-refusal.js +8 -0
- package/dist/execution-lane-caps.d.ts +3 -1
- package/dist/field-conflict.d.ts +1 -1
- package/dist/file-history-capture.d.ts +11 -4
- package/dist/file-history-capture.js +9 -6
- package/dist/file-history-disclosure.d.ts +7 -5
- package/dist/file-history-disclosure.js +7 -5
- package/dist/fleet/drain-entry.d.ts +4 -0
- package/dist/fleet/engine-signal.d.ts +12 -29
- package/dist/fleet/engine-signal.js +1 -7
- package/dist/fleet-client.js +2 -5
- package/dist/gate-settlement.d.ts +1 -8
- package/dist/gate-settlement.js +0 -4
- package/dist/history-anchor.js +1 -1
- package/dist/hitl-delivery.d.ts +2 -3
- package/dist/hitl-delivery.js +0 -2
- package/dist/hooks/hook-llm.js +4 -2
- package/dist/hooks/hook-runner.d.ts +3 -2
- package/dist/hooks/hook-runner.js +18 -3
- package/dist/host-decision.d.ts +11 -11
- package/dist/host-lsp-manager.d.ts +2 -2
- package/dist/http/active-run-conflict.d.ts +35 -2
- package/dist/http/active-run-conflict.js +48 -19
- package/dist/http/admission.js +17 -2
- package/dist/http/approval-sweeps.d.ts +1 -1
- package/dist/http/approval-sweeps.js +10 -7
- package/dist/http/checkpoint-ctx.d.ts +4 -0
- package/dist/http/checkpoint-ctx.js +2 -0
- package/dist/http/dispatch.d.ts +8 -3
- package/dist/http/dispatch.js +59 -32
- package/dist/http/durable-run-leg.js +16 -17
- package/dist/http/health-reader.d.ts +16 -9
- package/dist/http/health-reader.js +2 -1
- package/dist/http/health-self-report.d.ts +9 -1
- package/dist/http/health-self-report.js +3 -1
- package/dist/http/owner-access.d.ts +33 -14
- package/dist/http/owner-access.js +40 -10
- package/dist/http/principal-gate.d.ts +49 -21
- package/dist/http/principal-gate.js +61 -11
- package/dist/http/request-channel.d.ts +23 -0
- package/dist/http/request-channel.js +9 -0
- package/dist/http/request-guards.js +17 -2
- package/dist/http/resume-ctx-read.js +42 -3
- package/dist/http/resume-legs.d.ts +4 -3
- package/dist/http/resume-legs.js +367 -117
- package/dist/http/route-ctx.d.ts +91 -15
- package/dist/http/route-ctx.js +17 -0
- package/dist/http/route-table.d.ts +5 -1
- package/dist/http/route-table.js +4 -0
- package/dist/http/routes/admin-config-refresh.js +3 -3
- package/dist/http/routes/admin-drain.d.ts +3 -0
- package/dist/http/routes/admin-drain.js +7 -7
- package/dist/http/routes/admin-memory-optout.d.ts +1 -1
- package/dist/http/routes/admin-memory-optout.js +3 -3
- package/dist/http/routes/adoption.js +3 -5
- package/dist/http/routes/agents-roster.js +2 -3
- package/dist/http/routes/approvals-assistant.d.ts +2 -1
- package/dist/http/routes/approvals-assistant.js +99 -51
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/capabilities.d.ts +4 -0
- package/dist/http/routes/capabilities.js +38 -10
- package/dist/http/routes/config-catalog.js +2 -2
- package/dist/http/routes/devices.js +1 -1
- package/dist/http/routes/diagnostics.d.ts +3 -3
- package/dist/http/routes/diagnostics.js +19 -7
- package/dist/http/routes/fleet.js +10 -8
- package/dist/http/routes/images.js +10 -10
- package/dist/http/routes/memory-bundle.js +3 -3
- package/dist/http/routes/memory-compliance.js +3 -3
- package/dist/http/routes/memory-consolidation.js +2 -2
- package/dist/http/routes/memory-origin.js +3 -3
- package/dist/http/routes/memory-policy.js +2 -2
- package/dist/http/routes/observability.js +3 -3
- package/dist/http/routes/projects.d.ts +3 -2
- package/dist/http/routes/projects.js +4 -5
- package/dist/http/routes/retention-ops.js +3 -3
- package/dist/http/routes/rules.js +5 -5
- package/dist/http/routes/run-permission-mode.d.ts +2 -1
- package/dist/http/routes/run-permission-mode.js +2 -2
- package/dist/http/routes/runs.d.ts +4 -9
- package/dist/http/routes/runs.js +171 -65
- package/dist/http/routes/session-sync.d.ts +22 -9
- package/dist/http/routes/session-sync.js +204 -107
- package/dist/http/routes/sessions-list.js +13 -7
- package/dist/http/routes/sessions.js +30 -15
- package/dist/http/routes/tasks.js +46 -41
- package/dist/http/routes/trace-usage.js +2 -2
- package/dist/http/routes/workflows.js +1 -1
- package/dist/http/server.d.ts +30 -30
- package/dist/http/server.js +16 -4
- package/dist/http/submit-ctx.d.ts +1 -1
- package/dist/http/submit-ctx.js +7 -4
- package/dist/http/wire-types.d.ts +14 -4
- package/dist/human-facing-args.d.ts +33 -0
- package/dist/human-facing-args.js +33 -0
- package/dist/identity-source.d.ts +20 -3
- package/dist/identity-source.js +14 -0
- package/dist/index.d.ts +5 -1
- package/dist/k8s-api-credentials.d.ts +29 -0
- package/dist/k8s-api-credentials.js +25 -0
- package/dist/lane-home-probe.d.ts +3 -7
- package/dist/lane-home-probe.js +2 -2
- package/dist/leader/diffup.d.ts +19 -0
- package/dist/leader/diffup.js +7 -0
- package/dist/leader/leader.d.ts +116 -11
- package/dist/leader/leader.js +69 -5
- package/dist/leader/repair-wire.js +2 -2
- package/dist/leader/run-entry.d.ts +2 -1
- package/dist/leader/run-entry.js +1 -1
- package/dist/leader/wire.d.ts +42 -132
- package/dist/leader/wire.js +81 -67
- package/dist/leg-facts.d.ts +13 -5
- package/dist/leg-facts.js +2 -1
- package/dist/memory-scope.d.ts +23 -11
- package/dist/memory-scope.js +18 -6
- package/dist/memory-sync-client.d.ts +30 -2
- package/dist/memory-sync-client.js +16 -9
- package/dist/model-entry-headers.d.ts +9 -10
- package/dist/model-entry-headers.js +0 -4
- package/dist/model-entry-refusal.d.ts +7 -4
- package/dist/model-entry-refusal.js +11 -5
- package/dist/model-plane-face.d.ts +1 -1
- package/dist/model-plane-face.js +3 -1
- package/dist/model-route-endpoint.d.ts +13 -7
- package/dist/model-route-endpoint.js +14 -11
- package/dist/model-select.d.ts +22 -0
- package/dist/model-select.js +9 -0
- package/dist/model-unreachable-notice.d.ts +11 -0
- package/dist/model-unreachable-notice.js +4 -4
- package/dist/object-store-buckets.d.ts +640 -6
- package/dist/object-store-buckets.js +166 -0
- package/dist/observability/err-text.d.ts +7 -0
- package/dist/observability/err-text.js +5 -0
- package/dist/observability/fail-open.d.ts +25 -17
- package/dist/observability/fail-open.js +25 -17
- package/dist/observability/logger.js +3 -1
- package/dist/observability/metrics.js +1 -0
- package/dist/operator-roster.d.ts +68 -0
- package/dist/operator-roster.js +32 -0
- package/dist/orchestration/workflow-notify-journal.d.ts +18 -1
- package/dist/orchestration/workflow-notify-journal.js +12 -1
- package/dist/orchestration/workflow-park-decision.d.ts +70 -18
- package/dist/orchestration/workflow-park-decision.js +49 -10
- package/dist/orchestration/workflow-park-holder.d.ts +65 -0
- package/dist/orchestration/workflow-park-holder.js +98 -0
- package/dist/orchestration/workflow-record-fence.d.ts +36 -0
- package/dist/orchestration/workflow-record-fence.js +42 -0
- package/dist/outbound-dispatcher.d.ts +71 -8
- package/dist/outbound-dispatcher.js +48 -7
- package/dist/owner-faces.d.ts +2 -2
- package/dist/parked-decide.d.ts +106 -55
- package/dist/parked-decide.js +153 -117
- package/dist/peer-directory.d.ts +2 -2
- package/dist/peer-inbound-face.d.ts +2 -6
- package/dist/peer-inbound-face.js +0 -3
- package/dist/permission-mode-admission.d.ts +74 -5
- package/dist/permission-mode-admission.js +56 -3
- package/dist/plugins/adoption-log-sql.d.ts +3 -1
- package/dist/plugins/adoption-log-sql.js +7 -1
- package/dist/plugins/approval-ask-store-file.d.ts +14 -2
- package/dist/plugins/approval-ask-store-file.js +11 -0
- package/dist/plugins/approval-ask-store-memory.d.ts +10 -1
- package/dist/plugins/approval-ask-store-memory.js +35 -10
- package/dist/plugins/approval-ask-store-sql.d.ts +69 -4
- package/dist/plugins/approval-ask-store-sql.js +45 -5
- package/dist/plugins/approval-exemption-store.js +3 -0
- package/dist/plugins/approval-nonce-store.js +2 -0
- package/dist/plugins/blob-backend.d.ts +83 -7
- package/dist/plugins/blob-backend.js +57 -6
- package/dist/plugins/breaker-state-sql.js +2 -0
- package/dist/plugins/caching-session-store.d.ts +9 -15
- package/dist/plugins/caching-session-store.js +6 -0
- package/dist/plugins/checkpoint-index-columns.d.ts +20 -16
- package/dist/plugins/checkpoint-index-columns.js +3 -6
- package/dist/plugins/checkpoint-store-face.d.ts +119 -61
- package/dist/plugins/checkpoint-store-face.js +134 -55
- package/dist/plugins/device-store-sql.js +6 -0
- package/dist/plugins/error-origin.d.ts +18 -0
- package/dist/plugins/error-origin.js +10 -0
- package/dist/plugins/execution-placement-sql.js +6 -6
- package/dist/plugins/image-bake-store-sql.js +6 -0
- package/dist/plugins/image-index-sql.js +4 -0
- package/dist/plugins/landed-attendants.d.ts +212 -0
- package/dist/plugins/landed-attendants.js +161 -0
- package/dist/plugins/leader-run-store-sql.js +4 -0
- package/dist/plugins/local-checkpoint-store.d.ts +13 -3
- package/dist/plugins/local-checkpoint-store.js +38 -49
- package/dist/plugins/local-session-live-reference.d.ts +40 -0
- package/dist/plugins/local-session-live-reference.js +39 -0
- package/dist/plugins/local-session-store.d.ts +71 -33
- package/dist/plugins/local-session-store.js +129 -27
- package/dist/plugins/memory-engine-pg.js +4 -0
- package/dist/plugins/memory-engine-sql-apply.js +5 -2
- package/dist/plugins/memory-engine-tidb.js +4 -0
- package/dist/plugins/memory-optout-grant-store-sql.js +4 -0
- package/dist/plugins/memory-sync-store-pg.js +5 -0
- package/dist/plugins/memory-sync-store-tidb.js +5 -0
- package/dist/plugins/one-time-migrations.d.ts +104 -80
- package/dist/plugins/one-time-migrations.js +226 -132
- package/dist/plugins/org-delivery-quota-store.js +4 -1
- package/dist/plugins/outcome-ledger-sql.js +2 -0
- package/dist/plugins/permission-rule-store-sql.js +11 -4
- package/dist/plugins/pg-cost-quota.js +4 -0
- package/dist/plugins/pg-pool.js +35 -10
- package/dist/plugins/pg-rate-limiter.js +2 -0
- package/dist/plugins/posix-shell-fs.d.ts +6 -1
- package/dist/plugins/posix-shell-fs.js +4 -1
- package/dist/plugins/remote-env-adb.d.ts +19 -15
- package/dist/plugins/remote-env-adb.js +41 -15
- package/dist/plugins/remote-env-connect-seat.d.ts +105 -0
- package/dist/plugins/remote-env-connect-seat.js +72 -0
- package/dist/plugins/remote-env-device.d.ts +22 -5
- package/dist/plugins/remote-env-device.js +106 -8
- package/dist/plugins/remote-env-e2b.d.ts +15 -6
- package/dist/plugins/remote-env-e2b.js +42 -32
- package/dist/plugins/remote-env-file-error.js +6 -2
- package/dist/plugins/remote-env-host.d.ts +46 -10
- package/dist/plugins/remote-env-host.js +124 -52
- package/dist/plugins/remote-env-k8s.d.ts +109 -41
- package/dist/plugins/remote-env-k8s.js +160 -54
- package/dist/plugins/remote-env-local-docker.d.ts +13 -8
- package/dist/plugins/remote-env-local-docker.js +34 -41
- package/dist/plugins/remote-env-ssh.d.ts +18 -12
- package/dist/plugins/remote-env-ssh.js +60 -59
- package/dist/plugins/remote-shell.d.ts +98 -1
- package/dist/plugins/remote-shell.js +218 -0
- package/dist/plugins/replica-registration.d.ts +1 -1
- package/dist/plugins/replica-registration.js +1 -1
- package/dist/plugins/resume-anchor-store-sql.d.ts +11 -2
- package/dist/plugins/resume-anchor-store-sql.js +12 -5
- package/dist/plugins/retention-lane-store-sql.js +4 -0
- package/dist/plugins/retention-sql.d.ts +20 -2
- package/dist/plugins/retention-sql.js +11 -0
- package/dist/plugins/run-store-sql.d.ts +21 -2
- package/dist/plugins/run-store-sql.js +31 -7
- package/dist/plugins/s3-presign.d.ts +23 -0
- package/dist/plugins/s3-presign.js +37 -3
- package/dist/plugins/scenario-prefix-switch-m42.d.ts +1 -1
- package/dist/plugins/scenario-prefix-switch-m42.js +2 -2
- package/dist/plugins/scheduler-support.d.ts +2 -2
- package/dist/plugins/scheduler-support.js +0 -3
- package/dist/plugins/schema-consistency.d.ts +4 -2
- package/dist/plugins/schema-consistency.js +19 -2
- package/dist/plugins/schema-indexes.js +2 -0
- package/dist/plugins/send-file-ledger.d.ts +2 -2
- package/dist/plugins/send-file-ledger.js +5 -2
- package/dist/plugins/send-user-file.d.ts +3 -4
- package/dist/plugins/send-user-file.js +56 -52
- package/dist/plugins/serving-requirement.d.ts +26 -7
- package/dist/plugins/serving-requirement.js +11 -4
- package/dist/plugins/session-birth.d.ts +6 -2
- package/dist/plugins/session-blob-claim-token.d.ts +15 -0
- package/dist/plugins/session-blob-claim-token.js +20 -0
- package/dist/plugins/session-blob-namespace.d.ts +46 -0
- package/dist/plugins/session-blob-namespace.js +116 -0
- package/dist/plugins/session-capture-record-store-sql.js +2 -0
- package/dist/plugins/session-ext-table.d.ts +14 -1
- package/dist/plugins/session-ext-table.js +5 -1
- package/dist/plugins/session-row-sql.d.ts +49 -2
- package/dist/plugins/session-row-sql.js +56 -13
- package/dist/plugins/session-store-sql.d.ts +34 -18
- package/dist/plugins/session-store-sql.js +98 -17
- package/dist/plugins/shared-memory-store-sql.d.ts +1 -0
- package/dist/plugins/shared-memory-store-sql.js +6 -2
- package/dist/plugins/snapshot-bucket-presence.d.ts +25 -2
- package/dist/plugins/snapshot-bucket-presence.js +8 -2
- package/dist/plugins/sql-driver.d.ts +2 -1
- package/dist/plugins/sql-driver.js +18 -3
- package/dist/plugins/sql-errors.d.ts +11 -6
- package/dist/plugins/sql-errors.js +5 -6
- package/dist/plugins/sql-json-column.d.ts +1 -1
- package/dist/plugins/stop-then-start-sentence.d.ts +10 -4
- package/dist/plugins/stop-then-start-sentence.js +14 -10
- package/dist/plugins/stop-then-start.d.ts +109 -0
- package/dist/plugins/stop-then-start.js +104 -0
- package/dist/plugins/store-backend.d.ts +84 -15
- package/dist/plugins/store-backend.js +236 -72
- package/dist/plugins/store-boundary.d.ts +57 -0
- package/dist/plugins/store-boundary.js +139 -0
- package/dist/plugins/store-contracts.d.ts +17 -0
- package/dist/plugins/store-fault-sentence-m53.d.ts +7 -0
- package/dist/plugins/store-fault-sentence-m53.js +25 -0
- package/dist/plugins/store-fault.d.ts +26 -7
- package/dist/plugins/store-fault.js +18 -2
- package/dist/plugins/task-attachment-store.d.ts +2 -1
- package/dist/plugins/task-attachment-store.js +14 -1
- package/dist/plugins/task-list-store-sql.d.ts +2 -2
- package/dist/plugins/task-list-store-sql.js +10 -8
- package/dist/plugins/tidb-cost-quota.js +4 -0
- package/dist/plugins/tidb-pool.js +21 -25
- package/dist/plugins/tidb-rate-limiter.js +4 -0
- package/dist/plugins/user-input-ledger-sql.js +4 -0
- package/dist/plugins/workflow-run-store-sql.d.ts +28 -10
- package/dist/plugins/workflow-run-store-sql.js +64 -4
- package/dist/plugins/workspace-custody.d.ts +4 -3
- package/dist/plugins/workspace-fill.d.ts +4 -7
- package/dist/plugins/workspace-fill.js +2 -1
- package/dist/plugins/write-behind-counter.js +5 -0
- package/dist/project-context.d.ts +0 -2
- package/dist/project-context.js +4 -8
- package/dist/project-registry.d.ts +46 -0
- package/dist/project-registry.js +44 -0
- package/dist/question.d.ts +2 -1
- package/dist/question.js +5 -13
- package/dist/request-form.d.ts +6 -1
- package/dist/request-form.js +4 -1
- package/dist/request-key-closure.js +1 -1
- package/dist/request-value-closure.d.ts +4 -0
- package/dist/request-value-closure.js +10 -0
- package/dist/rule-issue-reading.d.ts +1 -1
- package/dist/rules-consent.d.ts +1 -1
- package/dist/run-acceptance.d.ts +3 -2
- package/dist/run-acceptance.js +4 -6
- package/dist/run-local.js +9 -9
- package/dist/runs.d.ts +54 -16
- package/dist/runs.js +67 -13
- package/dist/runtime-governance.d.ts +5 -4
- package/dist/security.d.ts +30 -32
- package/dist/security.js +41 -7
- package/dist/sema-config-dir.d.ts +2 -1
- package/dist/server-secret-env.d.ts +12 -10
- package/dist/server-secret-env.js +24 -15
- package/dist/session-bindings.d.ts +82 -0
- package/dist/session-bindings.js +18 -0
- package/dist/session-children-retire.d.ts +2 -2
- package/dist/session-children-retire.js +2 -6
- package/dist/session-deletion.d.ts +16 -1
- package/dist/session-error-wire.d.ts +3 -3
- package/dist/session-error-wire.js +3 -3
- package/dist/session-incarnation.d.ts +10 -0
- package/dist/session-incarnation.js +10 -1
- package/dist/session-kind.d.ts +57 -0
- package/dist/session-kind.js +22 -0
- package/dist/session-row.d.ts +21 -1
- package/dist/session-row.js +7 -1
- package/dist/session-sync-kernel.d.ts +24 -14
- package/dist/session-sync-kernel.js +3 -6
- package/dist/session-sync.d.ts +25 -103
- package/dist/session-sync.js +14 -76
- package/dist/session-titler.d.ts +10 -3
- package/dist/session-titler.js +19 -6
- package/dist/ssh-host-key.d.ts +5 -0
- package/dist/ssh-host-key.js +3 -0
- package/dist/stores-sql/blob-index-sql.d.ts +30 -9
- package/dist/stores-sql/blob-index-sql.js +40 -21
- package/dist/stores-sql/checkpoint-store-sql.d.ts +54 -27
- package/dist/stores-sql/checkpoint-store-sql.js +70 -146
- package/dist/stores-sql/file-history-store-sql.d.ts +113 -15
- package/dist/stores-sql/file-history-store-sql.js +205 -95
- package/dist/stores-sql/pg-session-storage.d.ts +34 -7
- package/dist/stores-sql/pg-session-storage.js +37 -13
- package/dist/stores-sql/retention-store-sql.d.ts +1 -9
- package/dist/stores-sql/retention-store-sql.js +5 -19
- package/dist/stores-sql/session-policy-store-sql.d.ts +30 -7
- package/dist/stores-sql/session-policy-store-sql.js +61 -44
- package/dist/stores-sql/session-write-hooks.d.ts +11 -0
- package/dist/stores-sql/tidb-session-store.d.ts +58 -7
- package/dist/stores-sql/tidb-session-store.js +37 -13
- package/dist/submission-exit.d.ts +3 -2
- package/dist/submission-exit.js +9 -1
- package/dist/task-cwd.d.ts +2 -2
- package/dist/task-settings.d.ts +7 -5
- package/dist/task-settings.js +3 -3
- package/dist/terminal.d.ts +33 -2
- package/dist/terminal.js +139 -9
- package/dist/tool-approval.d.ts +465 -507
- package/dist/tool-approval.js +606 -1222
- package/dist/trace/core-keyset-guard.d.ts +1 -1
- package/dist/trace/ledger-events.d.ts +3 -3
- package/dist/trace/project.d.ts +2 -3
- package/dist/trace/redact.js +3 -2
- package/dist/trace/self-minted-wire.d.ts +571 -178
- package/dist/trace/self-minted-wire.js +189 -56
- package/dist/web-admin-client/apply-effective.js +2 -2
- package/dist/web-admin-client/read-warnings.d.ts +2 -2
- package/dist/web-admin-client/read-warnings.js +1 -1
- package/dist/web-admin-client/types.d.ts +1 -1
- package/dist/workspace-space.d.ts +10 -4
- package/dist/workspace-space.js +4 -1
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +79 -28
- package/package.json +7 -3
- package/scripts/embed-minimal.mjs +3 -3
- package/wire-changes/server@7.151.0.json +762 -0
- package/wire-changes/server@7.152.0.json +900 -0
- package/dist/config-d-migration.d.ts +0 -37
- package/dist/config-d-migration.js +0 -60
- package/dist/http/session-inherit-env.d.ts +0 -36
- package/dist/http/session-inherit-env.js +0 -6
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* unreachable and harmless); a port read is checked against its hash here ({@link readAtAddress}) — a mismatch reads as absent.
|
|
14
14
|
*
|
|
15
15
|
* Deletion stays ASYNCHRONOUS (clay 2026-06-26): a purge deletes only the referencing rows, so a blob becomes an orphan; the periodic
|
|
16
|
-
* {@link SqlBlobIndex.sweep}
|
|
17
|
-
*
|
|
16
|
+
* {@link SqlBlobIndex.sweep} first asks the port whether it may delete at all (refused ⇒ nothing written, the rows wait for the next
|
|
17
|
+
* sweep), then removes the grace-passed index rows and asks the port to delete exactly those keys. A port delete that still fails
|
|
18
|
+
* surfaces (the sweep rejects — the reaper's throttled guard is the loud channel) and leaves an object with no row.
|
|
18
19
|
*
|
|
19
20
|
* The SQL statements below are the ones the retired `SqlBlobBackend` / indexed `MinioBlobBackend` sent, verbatim — this module only
|
|
20
21
|
* gathers them under their owner.
|
|
@@ -24,6 +25,18 @@ import type { Pool as PgPool } from "pg";
|
|
|
24
25
|
import { type BlobBackend } from "../plugins/blob-backend.js";
|
|
25
26
|
import { type SqlEngineFacts, type SqlEngineReading, type SqlWallSource, type SqlWallsReading, type SqlDialect } from "../plugins/sql-driver.js";
|
|
26
27
|
import { type Logger } from "../observability/logger.js";
|
|
28
|
+
/** Orphan-blob GC grace — the ONE source (the file-history store's sweep reads it for its blob rows AND its per-landing grant rows):
|
|
29
|
+
* a blob is GC-eligible only if unreferenced AND untouched for this long; {@link SqlBlobIndex.put} refreshes created_at on every touch
|
|
30
|
+
* (incl a dedup hit, monotonically — a delayed older write never moves it back) so an in-flight snapshot's blobs are protected from
|
|
31
|
+
* delete-in-use. 1h ≫ any bounded snapshot. */
|
|
32
|
+
export declare const BLOB_GC_GRACE_MS = 3600000;
|
|
33
|
+
/** One sweep's cutoff (`now − grace`): a sweep reads the clock ONCE and hands the same instant to every leg (grant expiry, index rows). */
|
|
34
|
+
export declare function blobGcCutoffAt(nowMs: number): Date;
|
|
35
|
+
/** Hash-set statements are batched at this many values per statement, both dialects (an unbatched `IN` grows with the input — PG's
|
|
36
|
+
* bind protocol caps a statement at 65 535 parameters; MySQL's packet wall caps the statement text). */
|
|
37
|
+
export declare const BLOB_HASH_BATCH = 500;
|
|
38
|
+
/** `hashes` (deduplicated) in batches of {@link BLOB_HASH_BATCH}. */
|
|
39
|
+
export declare function hashBatches(hashes: readonly string[]): string[][];
|
|
27
40
|
/**
|
|
28
41
|
* 文本协议的 blob 膨胀律 —— mysql2 `query()` 把 Buffer 参数写成 `X'<hex>'`,一字节两个字符,所以承载一个 blob 的语句至少是它的 2 倍。
|
|
29
42
|
* 包墙折成「能装下多大的 blob」只用这一只常量,推导里不手写 `/ 2`。
|
|
@@ -133,14 +146,22 @@ export declare class SqlBlobIndex {
|
|
|
133
146
|
* is loud, not a silent "missing blob"). Port-kept: the port's bytes, checked against `hash` ({@link readAtAddress}: a mismatch —
|
|
134
147
|
* corruption or a poisoned object — reads as absent, never as wrong bytes; a transient port fault throws). */
|
|
135
148
|
get(hash: string): Promise<Uint8Array | undefined>;
|
|
136
|
-
/** The subset of `hashes` with an index row —
|
|
137
|
-
* row counts as present). No bytes are read. */
|
|
149
|
+
/** The subset of `hashes` with an index row — `blob_hash IN (...)` SELECTs batched at {@link BLOB_HASH_BATCH}, the same reading for both
|
|
150
|
+
* byte homes (a bytes-NULL row counts as present). No bytes are read. */
|
|
138
151
|
has(hashes: readonly string[]): Promise<Set<string>>;
|
|
139
|
-
/**
|
|
140
|
-
* index rows
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
|
|
152
|
+
/** One orphan sweep of the domain, in the one order — whether the byte port may delete is judged ONCE, before the sweep writes anything,
|
|
153
|
+
* because the index rows are a later sweep's only way back to bytes the port still holds:
|
|
154
|
+
* ① with a byte port, the port's deletion precondition alone: its own `delete` with no keys (the port contract, `BlobBackend.delete`).
|
|
155
|
+
* Refused — the session blob namespace not proven this database's — ⇒ the sweep rejects with the port's refusal having written
|
|
156
|
+
* nothing (no row, no byte); the next sweep starts over from the same rows;
|
|
157
|
+
* ② `collect`: the caller (the store) computes the orphan SET from its own domain's references — together with its own writes of this
|
|
158
|
+
* sweep (the file-history store drops its expired grant rows there) — under the sweep's ONE cutoff ({@link blobGcCutoffAt});
|
|
159
|
+
* ③ the index rows past the grace window (`created_at < cutoff` — a just-written blob an in-flight write still needs is never deleted:
|
|
160
|
+
* delete-in-use is data loss, under-delete is harmless);
|
|
161
|
+
* ④ exactly those keys' bytes (the port's `delete` checks its precondition again: the port's own floor).
|
|
162
|
+
* Returns the number of blobs removed (the grace-passed subset). A port delete that fails at ④ surfaces as a rejection after the rows are
|
|
163
|
+
* gone. */
|
|
164
|
+
sweep(collect: () => Promise<readonly string[]>, cutoff: Date): Promise<number>;
|
|
144
165
|
/** DELETE the index rows for `hashes` that have passed the grace window; returns the hashes ACTUALLY deleted. Best-effort: a DB
|
|
145
166
|
* error is swallowed (under-delete is harmless; the next sweep retries). */
|
|
146
167
|
private deleteRowsPastGrace;
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { readAtAddress } from "../plugins/blob-backend.js";
|
|
2
2
|
import { connectJudged, mysqlDriver, packetWallStatementBytes, pgDriver, rowWallPayloadBytes, sqlWallsOf } from "../plugins/sql-driver.js";
|
|
3
3
|
import { createLogger } from "../observability/logger.js";
|
|
4
|
-
const BLOB_GC_GRACE_MS = 3_600_000;
|
|
4
|
+
export const BLOB_GC_GRACE_MS = 3_600_000;
|
|
5
|
+
export function blobGcCutoffAt(nowMs) {
|
|
6
|
+
return new Date(nowMs - BLOB_GC_GRACE_MS);
|
|
7
|
+
}
|
|
8
|
+
export const BLOB_HASH_BATCH = 500;
|
|
9
|
+
export function hashBatches(hashes) {
|
|
10
|
+
const distinct = [...new Set(hashes)];
|
|
11
|
+
const out = [];
|
|
12
|
+
for (let i = 0; i < distinct.length; i += BLOB_HASH_BATCH)
|
|
13
|
+
out.push(distinct.slice(i, i + BLOB_HASH_BATCH));
|
|
14
|
+
return out;
|
|
15
|
+
}
|
|
5
16
|
export const SQL_TEXT_PROTOCOL_BLOB_INFLATION = 2;
|
|
6
17
|
export function packetWallBlobCap(maxPacketBytes) {
|
|
7
18
|
return Math.floor(packetWallStatementBytes(maxPacketBytes) / SQL_TEXT_PROTOCOL_BLOB_INFLATION);
|
|
@@ -69,10 +80,10 @@ export class SqlBlobIndex {
|
|
|
69
80
|
if (port !== undefined) {
|
|
70
81
|
await port.put(hash, bytes);
|
|
71
82
|
if (this.dialect === "mysql") {
|
|
72
|
-
await this.pool.query(`INSERT INTO ${this.opts.table} (blob_hash, byte_len, bytes, created_at) VALUES (?,?,NULL,?) ON DUPLICATE KEY UPDATE created_at = VALUES(created_at)`, [hash, bytes.byteLength, new Date()]);
|
|
83
|
+
await this.pool.query(`INSERT INTO ${this.opts.table} (blob_hash, byte_len, bytes, created_at) VALUES (?,?,NULL,?) ON DUPLICATE KEY UPDATE created_at = GREATEST(created_at, VALUES(created_at))`, [hash, bytes.byteLength, new Date()]);
|
|
73
84
|
}
|
|
74
85
|
else {
|
|
75
|
-
await this.pool.query(`INSERT INTO ${this.opts.table} (blob_hash, byte_len, bytes, created_at) VALUES ($1,$2,NULL,$3) ON CONFLICT (blob_hash) DO UPDATE SET created_at = EXCLUDED.created_at`, [hash, bytes.byteLength, new Date()]);
|
|
86
|
+
await this.pool.query(`INSERT INTO ${this.opts.table} (blob_hash, byte_len, bytes, created_at) VALUES ($1,$2,NULL,$3) ON CONFLICT (blob_hash) DO UPDATE SET created_at = GREATEST(${this.opts.table}.created_at, EXCLUDED.created_at)`, [hash, bytes.byteLength, new Date()]);
|
|
76
87
|
}
|
|
77
88
|
return;
|
|
78
89
|
}
|
|
@@ -87,8 +98,8 @@ export class SqlBlobIndex {
|
|
|
87
98
|
throw new BlobTooLargeError(bytes.byteLength, judged.refusal.cap);
|
|
88
99
|
try {
|
|
89
100
|
await judged.conn.query(this.dialect === "mysql"
|
|
90
|
-
? `INSERT INTO ${this.opts.table} (blob_hash, byte_len, bytes, created_at) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE created_at = VALUES(created_at)`
|
|
91
|
-
: `INSERT INTO ${this.opts.table} (blob_hash, byte_len, bytes, created_at) VALUES ($1,$2,$3,$4) ON CONFLICT (blob_hash) DO UPDATE SET created_at = EXCLUDED.created_at`, [hash, bytes.byteLength, Buffer.from(bytes), new Date()]);
|
|
101
|
+
? `INSERT INTO ${this.opts.table} (blob_hash, byte_len, bytes, created_at) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE created_at = GREATEST(created_at, VALUES(created_at))`
|
|
102
|
+
: `INSERT INTO ${this.opts.table} (blob_hash, byte_len, bytes, created_at) VALUES ($1,$2,$3,$4) ON CONFLICT (blob_hash) DO UPDATE SET created_at = GREATEST(${this.opts.table}.created_at, EXCLUDED.created_at)`, [hash, bytes.byteLength, Buffer.from(bytes), new Date()]);
|
|
92
103
|
}
|
|
93
104
|
finally {
|
|
94
105
|
judged.conn.release();
|
|
@@ -106,30 +117,38 @@ export class SqlBlobIndex {
|
|
|
106
117
|
return b.rows[0]?.bytes != null ? new Uint8Array(b.rows[0].bytes) : undefined;
|
|
107
118
|
}
|
|
108
119
|
async has(hashes) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
const present = new Set();
|
|
121
|
+
for (const batch of hashBatches(hashes)) {
|
|
122
|
+
if (this.dialect === "mysql") {
|
|
123
|
+
const ph = batch.map(() => "?").join(",");
|
|
124
|
+
const [rows] = await this.pool.query(`SELECT blob_hash FROM ${this.opts.table} WHERE blob_hash IN (${ph})`, batch);
|
|
125
|
+
for (const r of rows)
|
|
126
|
+
present.add(String(r.blob_hash));
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
const ph = batch.map((_, i) => `$${i + 1}`).join(",");
|
|
130
|
+
const r = await this.pool.query(`SELECT blob_hash FROM ${this.opts.table} WHERE blob_hash IN (${ph})`, batch);
|
|
131
|
+
for (const row of r.rows)
|
|
132
|
+
present.add(row.blob_hash);
|
|
133
|
+
}
|
|
116
134
|
}
|
|
117
|
-
|
|
118
|
-
const r = await this.pool.query(`SELECT blob_hash FROM ${this.opts.table} WHERE blob_hash IN (${ph})`, distinct);
|
|
119
|
-
return new Set(r.rows.map((row) => row.blob_hash));
|
|
135
|
+
return present;
|
|
120
136
|
}
|
|
121
|
-
async sweep(
|
|
122
|
-
const removed = await this.deleteRowsPastGrace(orphans);
|
|
137
|
+
async sweep(collect, cutoff) {
|
|
123
138
|
const port = this.opts.bytes;
|
|
139
|
+
if (port !== undefined)
|
|
140
|
+
await port.delete([]);
|
|
141
|
+
const orphans = await collect();
|
|
142
|
+
const removed = [];
|
|
143
|
+
for (const batch of hashBatches(orphans))
|
|
144
|
+
removed.push(...(await this.deleteRowsPastGrace(batch, cutoff)));
|
|
124
145
|
if (port !== undefined && removed.length > 0)
|
|
125
146
|
await port.delete(removed);
|
|
126
147
|
return removed.length;
|
|
127
148
|
}
|
|
128
|
-
async deleteRowsPastGrace(
|
|
129
|
-
if (
|
|
149
|
+
async deleteRowsPastGrace(distinct, cutoff) {
|
|
150
|
+
if (distinct.length === 0)
|
|
130
151
|
return [];
|
|
131
|
-
const distinct = [...new Set(hashes)];
|
|
132
|
-
const cutoff = new Date(Date.now() - BLOB_GC_GRACE_MS);
|
|
133
152
|
if (this.dialect === "mysql") {
|
|
134
153
|
const ph = distinct.map(() => "?").join(",");
|
|
135
154
|
const grace = await this.pool
|
|
@@ -4,7 +4,7 @@ import { type CheckpointPage, type CheckpointRowRead, type CheckpointSessionCurs
|
|
|
4
4
|
import { type SqlDialect, type SqlDriver } from "../plugins/sql-driver.js";
|
|
5
5
|
import type { CtxWriteClaim } from "../plugins/store-contracts.js";
|
|
6
6
|
import type { RetentionDeclaration } from "@sema-agent/core";
|
|
7
|
-
import { type CheckpointAskCandidate, type CtxClaimPut, type CtxClaimRewrite, type CtxRowRewrite, type CtxRowsRewrite, type DecidedApprovalRecord, type ExpiredApprovalGate, type ExpiredGatePosition, type PendingCheckpoint, type PendingRowBinding } from "../plugins/checkpoint-store-face.js";
|
|
7
|
+
import { type CardScopeRootSeat, type CheckpointAskCandidate, type CtxClaimPut, type CtxClaimRewrite, type CtxRowRewrite, type CtxRowsRewrite, type DecidedApprovalRecord, type ExpiredApprovalGate, type ExpiredGatePosition, type PendingCheckpoint, type PendingRowBinding, type QueueActionFacts } from "../plugins/checkpoint-store-face.js";
|
|
8
8
|
import type { SealedCheckpointCtx } from "../http/checkpoint-ctx.js";
|
|
9
9
|
/**
|
|
10
10
|
* The capability token IS the resume credential (token-as-auth) — anyone who reads it can impersonate a
|
|
@@ -12,6 +12,33 @@ import type { SealedCheckpointCtx } from "../http/checkpoint-ctx.js";
|
|
|
12
12
|
* resume-read-path log we emit a stable, non-reversible fingerprint instead, enough to correlate get↔resolve.
|
|
13
13
|
*/
|
|
14
14
|
export declare function tokenFingerprint(token: string): string;
|
|
15
|
+
/** {@link StoredRowProjectionMemo} 的字节上界:按每份投影的 JSON UTF-8 字节数累计(常量,不是旋钮 —— 挤出只换代价、不换答案)。 */
|
|
16
|
+
export declare const STORED_ROW_MEMO_MAX_BYTES: number;
|
|
17
|
+
/** {@link StoredRowProjectionMemo} 的条数上界(与字节上界同时生效,先到者挤)。 */
|
|
18
|
+
export declare const STORED_ROW_MEMO_MAX_ENTRIES = 8192;
|
|
19
|
+
/**
|
|
20
|
+
* [ref] K5 / ④:一份停驻行字节的**动作事实**({@link QueueActionFacts},两孪生同一只投影 `buildQueueActionFacts` 的产物)按 **(停驻行字节, 引擎构建)** 记忆 ——
|
|
21
|
+
* 字节 = 库内对 `checkpoint` 列投影文本算的 sha256({@link jsonColumnTextSha256},主读只出这 64 字节,整只文档不出库),引擎构建 = core 包版本
|
|
22
|
+
* `CONTRACT_KIT_ENGINE_VERSION`(不是格式版本上限 `MAX_SUPPORTED_CHECKPOINT_VERSION`:同一格式版本下不同构建的要求表不同,core 7.60.0 / 7.61.0 实证)。
|
|
23
|
+
* 字节变(带外改行、同 token 重写)⇒ 键变 ⇒ 重读重投;换构建 ⇒ 键变。续跑**不读**本记忆(core 准入恒现算)。
|
|
24
|
+
*
|
|
25
|
+
* 有界(LRU):条数 ≤ `maxEntries`,且各条投影的 JSON UTF-8 字节数之和 ≤ `maxBytes`(店用 {@link STORED_ROW_MEMO_MAX_BYTES} / {@link STORED_ROW_MEMO_MAX_ENTRIES});
|
|
26
|
+
* 超出 ⇒ 挤最久未用的,被挤的行下一次列表按未命中整行重读 —— 代价退回整行读,答案不变。单只投影就超出字节上界 ⇒ 不记(也不为它冲掉别的)。
|
|
27
|
+
* 只记**完整**的投影:整行解不出、或摘要读不动的行不进记忆(它们的响亮计数按「每次列表」计,不被记忆吃掉)。
|
|
28
|
+
*/
|
|
29
|
+
export declare class StoredRowProjectionMemo {
|
|
30
|
+
private readonly maxBytes;
|
|
31
|
+
private readonly maxEntries;
|
|
32
|
+
private readonly rows;
|
|
33
|
+
private total;
|
|
34
|
+
constructor(maxBytes?: number, maxEntries?: number);
|
|
35
|
+
/** 记着的投影字节数之和(读数;钉读它)。 */
|
|
36
|
+
get bytes(): number;
|
|
37
|
+
private keyOf;
|
|
38
|
+
get(sha256: string): QueueActionFacts | undefined;
|
|
39
|
+
set(sha256: string, actionFacts: QueueActionFacts): void;
|
|
40
|
+
private evict;
|
|
41
|
+
}
|
|
15
42
|
/**
|
|
16
43
|
* `checkpoint` 表上**本仓后加、且被无条件引用**的列册 —— 升级前置探针({@link assertCheckpointColumnSchema})
|
|
17
44
|
* 的唯一数据源。一行一列:列名 + 这一列不在时**运行期**先坏在哪(拒启文案逐字用它,所以运维读到的是
|
|
@@ -74,6 +101,8 @@ interface SteerColumnRead {
|
|
|
74
101
|
export declare function readPendingSteerQueueColumn(queueRaw: unknown): SteerColumnRead;
|
|
75
102
|
export interface SqlCheckpointStoreOptions {
|
|
76
103
|
readonly retention?: RetentionDeclaration;
|
|
104
|
+
/** 「不再询问」规则 project root 的铸卡快照席(后端一只、本店写口读;缺席 = 一只永不绑的席 ⇒ 列 NULL)。 */
|
|
105
|
+
readonly cardScopeRoot?: CardScopeRootSeat;
|
|
77
106
|
}
|
|
78
107
|
/** Dual-dialect durable CheckpointStore. See the file header for the dialect-delta ledger. */
|
|
79
108
|
export declare class SqlCheckpointStore implements CheckpointStore {
|
|
@@ -134,6 +163,13 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
134
163
|
constructor(db: SqlDriver, logger?: {
|
|
135
164
|
info?(msg: string, meta?: unknown): void;
|
|
136
165
|
} | undefined, opts?: SqlCheckpointStoreOptions);
|
|
166
|
+
/** 「不再询问」规则 project root 的铸卡快照席(写口 `put` 读一次)。 */
|
|
167
|
+
private readonly cardScopeRoot;
|
|
168
|
+
/**
|
|
169
|
+
* 这张卡上「不再询问」规则的 project root **铸卡快照**(列 `card_scope_root`;续跑腿的停驻行规则记录读者读它)。`null` = 不可知(没铸 / 加这一列之前落下的行)
|
|
170
|
+
* 或这一行不在 —— 两者对兑付同答(不铸 scope ⇒ `scope-unresolved`)。
|
|
171
|
+
*/
|
|
172
|
+
cardScopeRootOf(token: CheckpointToken): Promise<string | null>;
|
|
137
173
|
/** Pick the dialect's SQL text. Both statements stay written out at the call site ON PURPOSE. */
|
|
138
174
|
private q;
|
|
139
175
|
/** JSON column binding. TiDB: plain `JSON.stringify`, stored verbatim. PG: `pgProtocolJsonStringify` —
|
|
@@ -312,7 +348,7 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
312
348
|
listExpiredApprovalGates(cutoff: number, limit?: number, after?: ExpiredGatePosition): Promise<ExpiredApprovalGate[]>;
|
|
313
349
|
/** Pending checkpoints for the operator queue — NON-secret fields only (never the token). `taskId` = the task the
|
|
314
350
|
* parked leg runs as ([ref], written by `parkedLegTaskId`): the registry row the engine recorded on the row
|
|
315
|
-
* (
|
|
351
|
+
* (`state.rowTaskId` of the same whole-row decode, a background child's `a…` handle), else the task_active join (a suspended run KEEPS its
|
|
316
352
|
* session claim); null when neither (a synchronous / workflow child, a terminal-only park). */
|
|
317
353
|
/**
|
|
318
354
|
* [ref] 显式记账 —— **本口与 {@link SqlCheckpointStore.listByScope} 都不投执行判词,这是结构性的不是遗漏**:
|
|
@@ -323,39 +359,30 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
323
359
|
*/
|
|
324
360
|
listPending(scope?: string): Promise<PendingCheckpoint[]>;
|
|
325
361
|
/**
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
* 为什么要整行:判官 `judgeCheckpointRow` 读要求表要整只用(词集 + 摘要重算读整个 `state` 的表键路径,core [ref] ③);技能卡**清单**
|
|
329
|
-
* `boundGrants` 在寄存行上是未经哈希校验的原值,core 只在摘要里「哈希等于摘要」才发布它,校验读口不在 core 的公开导出面上 —— 两者都只能对整只
|
|
330
|
-
* {@link Checkpoint} 跑 core 的函数(摘要 `summarizeCheckpoint` 一次给两样)。
|
|
362
|
+
* 运维队列行的**动作事实**({@link QueueActionFacts}:两孪生同一只投影 `buildQueueActionFacts` 对一份停驻行字节答的整份),按令牌交回。
|
|
331
363
|
*
|
|
332
364
|
* 读放大(如实):记忆命中零整行读;未命中的行按令牌**批**读(`IN (…)`,每批 ≤ {@link STORED_ROW_READ_BATCH}),每份字节每个进程一次 ——
|
|
333
|
-
* 起服后第一次列表把全部待决行读一遍,此后只有字节变了 /
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
* 判决照给、清单与成因词缺席,计 `server.approvals.park-row-blob-unreadable`,不进记忆(下一次列表重读、再计)。行已离开待决(两次读之间被决 / 过期)⇒ 不在返回里。
|
|
340
|
-
* `not-text`(读腿漏了投影)与摘要格形不对原样抛(码坏)。授予绑定那一臂(摘要 / 缺席词)不在这里:由 {@link parkRowFacts} 读子树投出。
|
|
365
|
+
* 起服后第一次列表把全部待决行读一遍,此后只有字节变了 / 被挤出记忆({@link StoredRowProjectionMemo} 的字节 / 条数上界)的行再读。主读每拍只出行址 + 64 字节摘要。
|
|
366
|
+
* 两次读之间字节变了(批读的摘要 ≠ 主读交来的那一份)⇒ 交回**批读那一版**的整份动作事实(= 此刻续跑会执行的那一版):行的动作事实全部出自这一次解码,
|
|
367
|
+
* 行址格与字节版本无关(改写不动会话 / scope / 建行时刻 / 截止),不存在一行拼两版。行已离开待决(两次读之间被决 / 过期)⇒ 不在返回里。
|
|
368
|
+
*
|
|
369
|
+
* 失败方向 = 本店停驻行读者的那一条律({@link SqlCheckpointStore.readStoredRow}):整行解不出 / 摘要读不动的行交回只带判决的那一份(计
|
|
370
|
+
* `server.approvals.park-row-blob-unreadable`,不进记忆,下一次列表重读、再计)。`not-text`(读腿漏了投影)与摘要格形不对原样抛(码坏)。
|
|
341
371
|
*/
|
|
342
372
|
private storedRowProjections;
|
|
343
|
-
/** 一行整行读回 → 它的 {@link StoredRowProjection}(摘要读得动的入记忆;失败方向见 {@link SqlCheckpointStore.readStoredRow})。 */
|
|
344
|
-
private projectStoredRow;
|
|
345
373
|
/**
|
|
346
374
|
* 🔴 **本店停驻行读者的那一条律:一行的字节只坏它自己那一行**(运维队列 / 订阅流的整行读与收件箱 / 任务视图的 `listByScope` 同经这里)。
|
|
347
375
|
*
|
|
348
|
-
* 一行停驻行的整行读 = `checkpoint` 列那一份字节 → core 判官 `judgeCheckpointRow` 的判决 + (读得动时)core 的摘要 `summarizeCheckpoint
|
|
349
|
-
*
|
|
350
|
-
* (不是本店编的一行),它答 `damaged`;体是对象而摘要读不动(`{}`、缺 `state` / `pendingAction` / `gate` 的手改行,成员形不对的行)⇒ core 的摘要答它的
|
|
351
|
-
* 「读不动」那一形({@link isUnreadableSummaryForm}),判决取那一形上的(core:判官的判决,判官答 `ok` 时是「读不动」的固定判决,恒非 `ok`)
|
|
352
|
-
*
|
|
376
|
+
* 一行停驻行的整行读 = `checkpoint` 列那一份字节 → core 判官 `judgeCheckpointRow` 的判决 + (读得动时)core 的摘要 `summarizeCheckpoint` → 两孪生同一只投影
|
|
377
|
+
* `buildQueueActionFacts` 答的动作事实。判决**恒在**:判官对任何值都答(core:pure and total),字节读不成一只检查点(JSON 字面 `null` / 标量 / 数组 / 非 JSON)⇒ 交给它的是这一格
|
|
378
|
+
* **原样的文本**(不是本店编的一行),它答 `damaged`;体是对象而摘要读不动(`{}`、缺 `state` / `pendingAction` / `gate` 的手改行,成员形不对的行)⇒ core 的摘要答它的
|
|
379
|
+
* 「读不动」那一形({@link isUnreadableSummaryForm}),判决取那一形上的(core:判官的判决,判官答 `ok` 时是「读不动」的固定判决,恒非 `ok`);
|
|
380
|
+
* core 的投影自己抛(它的已知限制:摘要读到成员形表之外的一位)⇒ 判官对这只对象答。三形的动作事实都只剩判决(`buildQueueActionFacts` 的「解不出」那一形)。
|
|
353
381
|
* 摘要读不动的几种都计 `server.approvals.park-row-blob-unreadable`(每次列表都计)、不进记忆,core 交给披露座的那一句随之不进风险轴的计数;
|
|
354
|
-
* **不抛** —— 修前收件箱 / 任务视图对这种行整张拒
|
|
355
|
-
* (`{}` / 缺 `state` 落 503「请重试」,坏行不修同路径恒失败),运维队列对字节解不出的行不带判决:同一张坏行两个读者两个方向。
|
|
382
|
+
* **不抛** —— 修前收件箱 / 任务视图对这种行整张拒(`{}` / 缺 `state` 落 503「请重试」,坏行不修同路径恒失败)。
|
|
356
383
|
* 读腿漂(`not-text`:SELECT 没投影这一列)与摘要格形不对照旧原样抛 —— 那是码坏,不是一行数据坏。
|
|
357
384
|
*
|
|
358
|
-
*
|
|
385
|
+
* 读得动的行按 (这份字节, 引擎构建) 记忆整份动作事实({@link StoredRowProjectionMemo}):命中交给摘要不重判、不重投。
|
|
359
386
|
*/
|
|
360
387
|
private readStoredRow;
|
|
361
388
|
/**
|
|
@@ -367,8 +394,8 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
367
394
|
* created_at_ms ASC; callers (the inbox/scheduler) sort by severity.
|
|
368
395
|
*
|
|
369
396
|
* 一行读不出摘要(字节解不出 / 体是对象而摘要读不动)⇒ 这一行**照列**,判决非 `ok`(见 {@link SqlCheckpointStore.readStoredRow}),其余几位取本店在字节**之外**握着的事实:
|
|
370
|
-
* 令牌 / 会话 / scope / 建行时刻 / 截止 / 门型(`gate_kind` 列,与运维队列同一只判官 {@link queueRowGateKind}:读不出 ⇒ 不列、计数)
|
|
371
|
-
*
|
|
397
|
+
* 令牌 / 会话 / scope / 建行时刻 / 截止 / 门型(`gate_kind` 列,与运维队列同一只判官 {@link queueRowGateKind}:读不出 ⇒ 不列、计数)。`checkpointId` 只读引擎摘要
|
|
398
|
+
* (与运维队列行、LOCAL 孪生同一读法)⇒ 这一形缺席。失败方向与运维队列同一条律({@link SqlCheckpointStore.readStoredRow})。
|
|
372
399
|
*
|
|
373
400
|
* LIMIT bounds the fan-out (review w16yqkkxv): a triage view never needs more than a few — 500 is a generous
|
|
374
401
|
* ceiling that still protects memory/latency if a scope ever accumulates pathologically many pending gates.
|