@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
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { storeBoundaryFault } from "../terminal.js";
|
|
2
|
+
export const BOOT_METHOD_NAMES = new Set(["ensureSchema", "runOneTimeMigrations", "close", "mysqlPool", "pgPool"]);
|
|
3
|
+
export const SEALED_STORE_MEMBER = Symbol("sema.sealedStoreMember");
|
|
4
|
+
const SEALS = new Map();
|
|
5
|
+
export function storeSealRecords() {
|
|
6
|
+
return [...SEALS.values()];
|
|
7
|
+
}
|
|
8
|
+
const STORE_WORD = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
|
|
9
|
+
export function sealStoreClass(ctor, store, plan) {
|
|
10
|
+
assertStoreWord(store);
|
|
11
|
+
const proto = ctor.prototype;
|
|
12
|
+
if (SEALS.has(`class:${store}`))
|
|
13
|
+
throw new Error(`store-boundary: store word ${store} is already sealed — every sealed producer has its own word`);
|
|
14
|
+
for (const key of Reflect.ownKeys(plan)) {
|
|
15
|
+
const word = plan[key];
|
|
16
|
+
assertWord(store, key, word);
|
|
17
|
+
if (word !== "exit")
|
|
18
|
+
continue;
|
|
19
|
+
const own = Object.getOwnPropertyDescriptor(proto, key);
|
|
20
|
+
if (own !== undefined) {
|
|
21
|
+
if (typeof own.value !== "function")
|
|
22
|
+
throw new Error(`store-boundary: ${store}.${String(key)} is not a method on ${ctor.name}.prototype (an accessor or a field cannot be sealed in place)`);
|
|
23
|
+
assertNotGenerator(store, key, own.value);
|
|
24
|
+
Object.defineProperty(proto, key, { ...own, value: sealedMember(own.value, `${store}.${String(key)}`) });
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const inherited = proto[key];
|
|
28
|
+
if (typeof inherited !== "function")
|
|
29
|
+
throw new Error(`store-boundary: ${store}.${String(key)} is not a method reachable from ${ctor.name}.prototype`);
|
|
30
|
+
if (inherited[SEALED_STORE_MEMBER] === undefined) {
|
|
31
|
+
throw new Error(`store-boundary: ${store}.${String(key)} is inherited by ${ctor.name} from an unsealed base — seal the base class first`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
SEALS.set(`class:${store}`, { store, kind: "class", name: ctor.name, plan: Object.freeze({ ...plan }) });
|
|
35
|
+
}
|
|
36
|
+
export function sealStoreObject(obj, store, plan) {
|
|
37
|
+
assertStoreWord(store);
|
|
38
|
+
const planKeys = new Set(Reflect.ownKeys(plan));
|
|
39
|
+
if (typeof obj !== "function") {
|
|
40
|
+
for (const key of Reflect.ownKeys(obj)) {
|
|
41
|
+
const d = Object.getOwnPropertyDescriptor(obj, key);
|
|
42
|
+
if (d !== undefined && typeof d.value === "function" && !planKeys.has(key)) {
|
|
43
|
+
throw new Error(`store-boundary: ${store} has a callable member ${String(key)} that its exit plan does not list`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
for (const key of planKeys) {
|
|
48
|
+
const word = plan[key];
|
|
49
|
+
assertWord(store, key, word);
|
|
50
|
+
if (word !== "exit")
|
|
51
|
+
continue;
|
|
52
|
+
const d = Object.getOwnPropertyDescriptor(obj, key);
|
|
53
|
+
if (d === undefined)
|
|
54
|
+
continue;
|
|
55
|
+
if (typeof d.value !== "function")
|
|
56
|
+
throw new Error(`store-boundary: ${store}.${String(key)} is not a callable own property`);
|
|
57
|
+
if (d.value[SEALED_STORE_MEMBER] !== undefined)
|
|
58
|
+
continue;
|
|
59
|
+
assertNotGenerator(store, key, d.value);
|
|
60
|
+
if (d.writable !== true && d.configurable !== true)
|
|
61
|
+
throw new Error(`store-boundary: ${store}.${String(key)} is frozen and cannot be sealed`);
|
|
62
|
+
Object.defineProperty(obj, key, { ...d, value: sealedMember(d.value, `${store}.${String(key)}`) });
|
|
63
|
+
}
|
|
64
|
+
if (!SEALS.has(`object:${store}`))
|
|
65
|
+
SEALS.set(`object:${store}`, { store, kind: "object", name: store, plan: Object.freeze({ ...plan }) });
|
|
66
|
+
return obj;
|
|
67
|
+
}
|
|
68
|
+
export function sealStoreFunction(fn, site) {
|
|
69
|
+
if (!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*\.[A-Za-z][A-Za-z0-9]*$/.test(site))
|
|
70
|
+
throw new Error(`store-boundary: site ${JSON.stringify(site)} is not <store word>.<verb>`);
|
|
71
|
+
return sealedMember(fn, site);
|
|
72
|
+
}
|
|
73
|
+
export async function* sealStoreIterable(it, site) {
|
|
74
|
+
try {
|
|
75
|
+
return yield* it;
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
throw storeBoundaryFault(err, site);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function sealedMember(fn, site) {
|
|
82
|
+
const sealed = function (...args) {
|
|
83
|
+
try {
|
|
84
|
+
const out = fn.apply(this, args);
|
|
85
|
+
const then = thenOf(out);
|
|
86
|
+
if (then === undefined)
|
|
87
|
+
return sealedYield(out, site);
|
|
88
|
+
return Reflect.apply(then, out, [
|
|
89
|
+
(value) => sealedYield(value, site),
|
|
90
|
+
(err) => {
|
|
91
|
+
throw storeBoundaryFault(err, site);
|
|
92
|
+
},
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
throw storeBoundaryFault(err, site);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
Object.defineProperty(sealed, "name", { value: fn.name, configurable: true });
|
|
100
|
+
Object.defineProperty(sealed, "length", { value: fn.length, configurable: true });
|
|
101
|
+
Object.defineProperty(sealed, SEALED_STORE_MEMBER, { value: site });
|
|
102
|
+
return sealed;
|
|
103
|
+
}
|
|
104
|
+
function thenOf(v) {
|
|
105
|
+
if (v === null || (typeof v !== "object" && typeof v !== "function"))
|
|
106
|
+
return undefined;
|
|
107
|
+
const then = Reflect.get(v, "then");
|
|
108
|
+
return typeof then === "function" ? then : undefined;
|
|
109
|
+
}
|
|
110
|
+
function sealedYield(value, site) {
|
|
111
|
+
let tag;
|
|
112
|
+
try {
|
|
113
|
+
tag = Object.prototype.toString.call(value);
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
throw storeBoundaryFault(err, site);
|
|
117
|
+
}
|
|
118
|
+
return tag === "[object AsyncGenerator]" ? sealStoreIterable(value, site) : value;
|
|
119
|
+
}
|
|
120
|
+
function assertStoreWord(store) {
|
|
121
|
+
if (!STORE_WORD.test(store))
|
|
122
|
+
throw new Error(`store-boundary: store word ${JSON.stringify(store)} is not a lowercase dashed word`);
|
|
123
|
+
}
|
|
124
|
+
function assertWord(store, key, word) {
|
|
125
|
+
if (word === "exit" || word === "in-store")
|
|
126
|
+
return;
|
|
127
|
+
if (word === "boot") {
|
|
128
|
+
if (typeof key === "string" && BOOT_METHOD_NAMES.has(key))
|
|
129
|
+
return;
|
|
130
|
+
throw new Error(`store-boundary: ${store}.${String(key)} is marked boot but is not a boot lifecycle name (${[...BOOT_METHOD_NAMES].join(" / ")})`);
|
|
131
|
+
}
|
|
132
|
+
throw new Error(`store-boundary: ${store}.${String(key)} has exit word ${JSON.stringify(word)} (expected exit | boot | in-store)`);
|
|
133
|
+
}
|
|
134
|
+
function assertNotGenerator(store, key, fn) {
|
|
135
|
+
if (fn.constructor?.name === "GeneratorFunction") {
|
|
136
|
+
throw new Error(`store-boundary: ${store}.${String(key)} is a synchronous generator method — its failures happen after the call returns, where the seal cannot see them`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=store-boundary.js.map
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
import type { PeerSessionTempo, TaskResult, TaskStatus } from "@sema-agent/core";
|
|
22
22
|
import type { RunIdentity } from "../identity-source.js";
|
|
23
23
|
import type { SessionUnreadable } from "../session-error-wire.js";
|
|
24
|
+
import type { SessionKind } from "../session-kind.js";
|
|
24
25
|
import type { ReadDenyFloorSummary } from "../read-deny-floor-notice.js";
|
|
25
26
|
/**
|
|
26
27
|
* **File 店族的 boot 期拒启基类**([ref];把 `RunStoreStrictHydrateError` 的那条论证升成一条族规)。
|
|
@@ -616,6 +617,22 @@ export interface SessionSummary {
|
|
|
616
617
|
/** fork 谱系:建这一行的那次 fork 的源会话 id(core `SessionMetadata.forkedFrom` 原词)—— present-iff 这一行是 fork 建的、且建于谱系落地之后(更早的 fork 不回填:源已不可知)。
|
|
617
618
|
* 三店从行上读(谱系的唯一读法 `session-incarnation.ts` 的 `forkLineageOfRow`);来源住客(`forkedFromIncarnation`)不上列表行。wire 半场见 `security.ts SessionListItem.forkedFrom`(同名同义)。 */
|
|
618
619
|
forkedFrom?: string;
|
|
620
|
+
/** 会话种类(律 `session-kind.ts`):present-iff 这只会话由一次带 `sessionKind` 的提交建下;顶层行缺席(恒不铸 null)。三店从行上读(唯一解码 `sessionKindFromCell`)。
|
|
621
|
+
* wire 半场见 `security.ts SessionListItem.sessionKind`(同名同义)。 */
|
|
622
|
+
sessionKind?: SessionKind;
|
|
623
|
+
}
|
|
624
|
+
/** 列表面的查询形(`listSessions` / `listSessionRows` 同一形;三只会话店与路由同读)。`sessionKind` = 视图(律 `session-kind.ts`:缺席 = 缺省视图,只列无种类的会话)。 */
|
|
625
|
+
export interface SessionListQuery {
|
|
626
|
+
owner?: string;
|
|
627
|
+
/** [ref] 窄互认第二臂的第三条件(SQL 孪生里是 `owner IS NULL` 谓词;local 店是同义的 `owner === null` 放行)。 */
|
|
628
|
+
includeUnowned?: boolean;
|
|
629
|
+
cursor?: {
|
|
630
|
+
lastActivityAt: string;
|
|
631
|
+
sessionId: string;
|
|
632
|
+
};
|
|
633
|
+
limit: number;
|
|
634
|
+
q?: string;
|
|
635
|
+
sessionKind?: SessionKind;
|
|
619
636
|
}
|
|
620
637
|
/**
|
|
621
638
|
* run 账里「每会话的 run 投影」的五位([ref] 四位 + [ref] 预览位)—— 会话列表行上出自 run 行的那一半:
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type Json = Record<string, unknown>;
|
|
2
|
+
/** 后台子代记录的改写(见头注);不改 ⇒ `undefined`。 */
|
|
3
|
+
export declare function rewrittenBackgroundRecordM53(record: unknown): Json | undefined;
|
|
4
|
+
/** `tool_end` 事件数据的改写(见头注);不改 ⇒ `undefined`。 */
|
|
5
|
+
export declare function rewrittenToolEndDataM53(data: unknown): Json | undefined;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=store-fault-sentence-m53.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { outwardFailureCode, outwardStoreMessageOf } from "../terminal.js";
|
|
2
|
+
const isRecord = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
3
|
+
function outwardOrUnchanged(code, message) {
|
|
4
|
+
if (typeof code !== "string" || typeof message !== "string" || outwardFailureCode(code) === code)
|
|
5
|
+
return undefined;
|
|
6
|
+
const outward = outwardStoreMessageOf(code, message);
|
|
7
|
+
return outward === message ? undefined : outward;
|
|
8
|
+
}
|
|
9
|
+
export function rewrittenBackgroundRecordM53(record) {
|
|
10
|
+
if (!isRecord(record))
|
|
11
|
+
return undefined;
|
|
12
|
+
const outward = outwardOrUnchanged(record.errorCode, record.error);
|
|
13
|
+
if (outward === undefined)
|
|
14
|
+
return undefined;
|
|
15
|
+
const old = record.error;
|
|
16
|
+
const summary = typeof record.summary === "string" && old !== "" && record.summary.includes(old) ? { summary: record.summary.split(old).join(outward) } : {};
|
|
17
|
+
return { ...record, error: outward, ...summary };
|
|
18
|
+
}
|
|
19
|
+
export function rewrittenToolEndDataM53(data) {
|
|
20
|
+
if (!isRecord(data) || !isRecord(data.structured))
|
|
21
|
+
return undefined;
|
|
22
|
+
const outward = outwardOrUnchanged(data.structured.errorCode, data.structured.errorMessage);
|
|
23
|
+
return outward === undefined ? undefined : { ...data, structured: { ...data.structured, errorMessage: outward } };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=store-fault-sentence-m53.js.map
|
|
@@ -6,12 +6,13 @@ export type StoreFaultClass = "corrupt" | "connection" | "deployment" | "defect"
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function isCodeDefect(err: unknown): boolean;
|
|
8
8
|
/** 判官本体。纯函数、不抛;只看被抛出的这一只对象(不沿 `cause` 链找)。连接类与部署错配两张识别表互斥,两者之间判序不影响结果(`test/store-fault-judge.test.ts` 钉互斥);
|
|
9
|
-
* 程序错排在它们之后(带那两类归因键的对象按那两类认)。
|
|
9
|
+
* 程序错排在它们之后(带那两类归因键的对象按那两类认)。
|
|
10
|
+
* 首臂 = 店边界形({@link StoreBoundaryFault}):边界在**原错**上判过一次(连接类整句、errno 臂、1005 内层号都只在原错上读得到),词随形带走 —— 读它就是读那一判,不是第二种读法。 */
|
|
10
11
|
export declare function storeFaultClassOf(err: unknown): StoreFaultClass;
|
|
11
12
|
/**
|
|
12
13
|
* 判官每个词的**对外句**(闭集 `Record`:判官加一个词而不在这里写出它对外怎么说 = 编译错)。这是本判官唯一的一张「对外怎么说」的表 ——
|
|
13
|
-
*
|
|
14
|
-
* (`terminal.ts`
|
|
14
|
+
* 失败要出店 / 出 wire 时,调用方只拿**类别**说话,不把驱动的原句(带库用户名 / 主机 / 表名 / 约束名)交出去;驱动原句只进运维日志
|
|
15
|
+
* (店边界 `terminal.ts` 的 `storeBoundaryFault` 那一行 `at=store`),出口脱敏器是模式脱敏、认不出「这是库账号 / 表名」。每句只说两件事:**坏在哪一类** + **重试有没有用**,不带任何实例化的名字。
|
|
15
16
|
*
|
|
16
17
|
* 🔴 **句子只断言码本身证明得了的事**:判官读到的只有一个码,而同一个码形可以出自库驱动,也可以出自别的系统调用(`ECONNREFUSED` 出自任何一个套接字、`ENOENT` 出自文件系统),
|
|
17
18
|
* 所以 `connection` 说「一条连接」而不说「数据库的连接」;`unclassified` 只说「带了一个本服务不公布的码」。只有 `deployment` 的两类码(缺表、权限拒:`42P01` / `42501` /
|
|
@@ -22,9 +23,27 @@ export declare function storeFaultClassOf(err: unknown): StoreFaultClass;
|
|
|
22
23
|
*/
|
|
23
24
|
export declare const STORE_FAULT_OUTWARD_SENTENCE: Readonly<Record<StoreFaultClass, string>>;
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* 对外句的**唯一拼法**(纯函数):判官的词 → 本表那一句 + 原码尾注 `[original code: <码>]`(码缺席 ⇒ 只有类别句)。两种输入、一只拼法:
|
|
27
|
+
* · 店边界({@link StoreBoundaryFault}):词是边界在**原错**上判的那一个(带 `cause` 的包装、只带 errno 的错、无码整句 —— 只看码判不出的那几形都在原错上判得出);
|
|
28
|
+
* · 只剩码的站点(终局因由 / 投影 / 抛出臂:引擎已把错压成 `code` + `message` 两格,类型与 `cause` 链已不在,`terminal.ts` 的 `outwardStoreMessage`):词 = 判官读 `{ code }`。
|
|
29
|
+
* 两者对同一次店失败说同一句(边界句原样过出口,出口的幂等判 `isOutwardStoreSentence` 由本表派生)。句子里没有「持久层失败」之类的前缀:码 `internal.store_error` 已经在同一条因由上说了辖域,
|
|
30
|
+
* 而抛出臂(没有因由、没有码)上同一句不该替抛出物断言它的出身。
|
|
28
31
|
*/
|
|
29
|
-
export declare function
|
|
32
|
+
export declare function outwardStoreSentence(cls: StoreFaultClass, code: string | undefined): string;
|
|
33
|
+
/** 判官的词(闭集,与 {@link STORE_FAULT_OUTWARD_SENTENCE} 的键同一份):出口幂等判逐词比对用。 */
|
|
34
|
+
export declare const STORE_FAULT_CLASSES: readonly StoreFaultClass[];
|
|
35
|
+
/**
|
|
36
|
+
* **店边界形** —— 一只 SQL 店的任何出口(抛出值 / 包装错的 `cause` / 失败文本 / 交出的读器与事务对象)上驱动错的**唯一**形:原码 + 稳定句,别无他物。
|
|
37
|
+
* 自有成员恰为 `name` · `message` · `stack`(新铸,第一行就是稳定句)· `faultClass` · `code`(有码时)· `errno`(原错链上带数字 errno 时)——
|
|
38
|
+
* **不带** `cause`、`sqlMessage`、`sql`(带插值后的语句全文)、`sqlState`、`fatal`、node-pg `DatabaseError` 的 `detail` / `hint` / `where` / `table` / `column` / `constraint` …、
|
|
39
|
+
* 套接字错的 `syscall` / `address` / `port`、原 stack:引擎在拒绝路径上对抛出值做全量自有键快照,同主体档不跑主机 / 路径脱敏,所以只能是新对象,不能「删几键」。
|
|
40
|
+
* 唯一铸点 = 边界函数 `terminal.ts` 的 `storeBoundaryFault`(它在铸之前把原句经出口座记一行运维日志);本类住在判官旁边,因为判官的首臂读它带的词(`terminal.ts` → 本文件已是一条边,反向成环)。
|
|
41
|
+
*/
|
|
42
|
+
export declare class StoreBoundaryFault extends Error {
|
|
43
|
+
/** 判官在**原错**上读出的词(只算一次、随形带走)。 */
|
|
44
|
+
readonly faultClass: StoreFaultClass;
|
|
45
|
+
readonly code?: string;
|
|
46
|
+
readonly errno?: number;
|
|
47
|
+
constructor(faultClass: StoreFaultClass, code: string | undefined, errno: number | undefined);
|
|
48
|
+
}
|
|
30
49
|
//# sourceMappingURL=store-fault.d.ts.map
|
|
@@ -7,6 +7,8 @@ export function isCodeDefect(err) {
|
|
|
7
7
|
return RUNTIME_DEFECT_CLASSES.some((cls) => err instanceof cls) && !Object.hasOwn(err, "cause");
|
|
8
8
|
}
|
|
9
9
|
export function storeFaultClassOf(err) {
|
|
10
|
+
if (err instanceof StoreBoundaryFault)
|
|
11
|
+
return err.faultClass;
|
|
10
12
|
if (err instanceof StoreCorruptError)
|
|
11
13
|
return "corrupt";
|
|
12
14
|
if (isConnectionFaultError(err))
|
|
@@ -22,7 +24,21 @@ export const STORE_FAULT_OUTWARD_SENTENCE = {
|
|
|
22
24
|
defect: "the service failed on an internal error; retrying fails the same way until the service is fixed",
|
|
23
25
|
unclassified: "the failure carried a code this service does not publish; the operator log carries the original sentence",
|
|
24
26
|
};
|
|
25
|
-
export function
|
|
26
|
-
|
|
27
|
+
export function outwardStoreSentence(cls, code) {
|
|
28
|
+
const sentence = STORE_FAULT_OUTWARD_SENTENCE[cls];
|
|
29
|
+
return code === undefined ? sentence : `${sentence} [original code: ${code}]`;
|
|
30
|
+
}
|
|
31
|
+
export const STORE_FAULT_CLASSES = Object.keys(STORE_FAULT_OUTWARD_SENTENCE);
|
|
32
|
+
export class StoreBoundaryFault extends Error {
|
|
33
|
+
faultClass;
|
|
34
|
+
constructor(faultClass, code, errno) {
|
|
35
|
+
super(outwardStoreSentence(faultClass, code));
|
|
36
|
+
this.name = "StoreBoundaryFault";
|
|
37
|
+
this.faultClass = faultClass;
|
|
38
|
+
if (code !== undefined)
|
|
39
|
+
this.code = code;
|
|
40
|
+
if (errno !== undefined)
|
|
41
|
+
this.errno = errno;
|
|
42
|
+
}
|
|
27
43
|
}
|
|
28
44
|
//# sourceMappingURL=store-fault.js.map
|
|
@@ -83,7 +83,8 @@ export interface TaskAttachmentStore {
|
|
|
83
83
|
deleteBySession(sessionId: string): Promise<number>;
|
|
84
84
|
/** TTL 收割:未绑定且 created_at_ms < olderThanMs 的行。返回删除数。 */
|
|
85
85
|
reapUnbound(olderThanMs: number): Promise<number>;
|
|
86
|
-
/** D-1 孤儿**对象**彻底 GC(clay 拍 2026-07-28):列举对象存储 × meta 行对账,零行且过 grace
|
|
86
|
+
/** D-1 孤儿**对象**彻底 GC(clay 拍 2026-07-28):列举对象存储 × meta 行对账,零行且过 grace 的对象删。只看本域写得出的名(内容地址);
|
|
87
|
+
* 「零行」只对本库成立 ⇒ 命名空间必须只属本库(字节口的删除等命名空间归属证明,`session-blob-namespace.ts`)。
|
|
87
88
|
* 可选——local 店(meta+bytes 同盘同步删)无此孤儿类。 */
|
|
88
89
|
sweepOrphanObjects?(graceMs: number, nowMs?: number): Promise<number>;
|
|
89
90
|
}
|
|
@@ -5,7 +5,8 @@ import { attachmentKindOf, PROJECT_BUNDLE_MIME } from "../project-bundle.js";
|
|
|
5
5
|
import { mysqlDriver, pgDriver } from "./sql-driver.js";
|
|
6
6
|
import { isDupKeyError, retryOnDeadlock } from "./sql-errors.js";
|
|
7
7
|
import { countClientWriteOn } from "./session-withdraw-sql.js";
|
|
8
|
-
import { readAtAddress } from "./blob-backend.js";
|
|
8
|
+
import { isContentAddress, readAtAddress } from "./blob-backend.js";
|
|
9
|
+
import { sealStoreClass } from "./store-boundary.js";
|
|
9
10
|
export const TaskAttachmentRecordSchema = z.object({
|
|
10
11
|
id: z.string(),
|
|
11
12
|
owner: z.string(),
|
|
@@ -385,6 +386,8 @@ export class TiDBTaskAttachmentStore {
|
|
|
385
386
|
batch = [];
|
|
386
387
|
};
|
|
387
388
|
for await (const o of lister.listObjects()) {
|
|
389
|
+
if (!isContentAddress(o.hash))
|
|
390
|
+
continue;
|
|
388
391
|
if (nowMs - o.lastModifiedMs < graceMs)
|
|
389
392
|
continue;
|
|
390
393
|
batch.push(o.hash);
|
|
@@ -420,6 +423,10 @@ export class TiDBTaskAttachmentStore {
|
|
|
420
423
|
return out;
|
|
421
424
|
}
|
|
422
425
|
}
|
|
426
|
+
sealStoreClass(TiDBTaskAttachmentStore, "tidb-task-attachment-store", {
|
|
427
|
+
put: "exit", get: "exit", getContent: "exit", releaseBytes: "exit", bind: "exit", listBySession: "exit", delete: "exit", deleteBySession: "exit",
|
|
428
|
+
reapUnbound: "exit", sweepOrphanObjects: "exit",
|
|
429
|
+
});
|
|
423
430
|
export class PgTaskAttachmentStore {
|
|
424
431
|
bytes;
|
|
425
432
|
db;
|
|
@@ -501,6 +508,8 @@ export class PgTaskAttachmentStore {
|
|
|
501
508
|
batch = [];
|
|
502
509
|
};
|
|
503
510
|
for await (const o of lister.listObjects()) {
|
|
511
|
+
if (!isContentAddress(o.hash))
|
|
512
|
+
continue;
|
|
504
513
|
if (nowMs - o.lastModifiedMs < graceMs)
|
|
505
514
|
continue;
|
|
506
515
|
batch.push(o.hash);
|
|
@@ -536,4 +545,8 @@ export class PgTaskAttachmentStore {
|
|
|
536
545
|
return out;
|
|
537
546
|
}
|
|
538
547
|
}
|
|
548
|
+
sealStoreClass(PgTaskAttachmentStore, "pg-task-attachment-store", {
|
|
549
|
+
put: "exit", get: "exit", getContent: "exit", releaseBytes: "exit", bind: "exit", listBySession: "exit", delete: "exit", deleteBySession: "exit",
|
|
550
|
+
reapUnbound: "exit", sweepOrphanObjects: "exit",
|
|
551
|
+
});
|
|
539
552
|
//# sourceMappingURL=task-attachment-store.js.map
|
|
@@ -50,9 +50,9 @@ export declare function ensurePgTaskListSchema(q: (text: string, params?: unknow
|
|
|
50
50
|
* 事务内先对 meta 行 `FOR UPDATE`(与 `mutate` 同一把分区锁)⇒ 与并发的清单写串行,不会删到
|
|
51
51
|
* 一半被插回新行。meta 行不在(从未写过任何任务)= 无锁可拿,DELETE 命中 0 行,幂等。
|
|
52
52
|
*/
|
|
53
|
-
export declare
|
|
53
|
+
export declare const deleteTiDBTaskList: (pool: MySqlPool, listKey: string) => Promise<void>;
|
|
54
54
|
/** {@link deleteTiDBTaskList} 的 PG 孪生(同语义、同事务姿势)。 */
|
|
55
|
-
export declare
|
|
55
|
+
export declare const deletePgTaskList: (pool: PgPool, listKey: string) => Promise<void>;
|
|
56
56
|
export declare function createTiDBTaskListStore(pool: MySqlPool, listKey: string): TaskListStore;
|
|
57
57
|
export declare function createPgTaskListStore(pool: PgPool, listKey: string): TaskListStore;
|
|
58
58
|
//# sourceMappingURL=task-list-store-sql.d.ts.map
|
|
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { assertJsonMetadata } from "@sema-agent/core";
|
|
3
3
|
import { pgHasUnstorable, pgSafeJsonStringify, PgUnstorableError } from "./pg-safe-json.js";
|
|
4
4
|
import { decodeJsonColumn, foldJsonColumn, jsonColumnText } from "./sql-json-column.js";
|
|
5
|
+
import { sealStoreFunction, sealStoreObject } from "./store-boundary.js";
|
|
5
6
|
export const TASK_LIST_META_TABLE = "task_list_meta";
|
|
6
7
|
export const TASK_LIST_ITEM_TABLE = "task_list_item";
|
|
7
8
|
export function taskListKeyFor(sessionId) {
|
|
@@ -98,7 +99,7 @@ async function setOn(exec, dialect, listKey, id, itemJson) {
|
|
|
98
99
|
? `UPDATE ${TASK_LIST_META_TABLE} SET next_sort = ? WHERE list_key = ?`
|
|
99
100
|
: `UPDATE ${TASK_LIST_META_TABLE} SET next_sort = $1 WHERE list_key = $2`, [sort + 1, listKey]);
|
|
100
101
|
}
|
|
101
|
-
export async function deleteTiDBTaskList(pool, listKey) {
|
|
102
|
+
export const deleteTiDBTaskList = sealStoreFunction(async function deleteTiDBTaskList(pool, listKey) {
|
|
102
103
|
assertListKeyBytes(listKey);
|
|
103
104
|
const c = await pool.getConnection();
|
|
104
105
|
try {
|
|
@@ -115,8 +116,8 @@ export async function deleteTiDBTaskList(pool, listKey) {
|
|
|
115
116
|
finally {
|
|
116
117
|
c.release();
|
|
117
118
|
}
|
|
118
|
-
}
|
|
119
|
-
export async function deletePgTaskList(pool, listKey) {
|
|
119
|
+
}, "sql-task-list-tidb.delete");
|
|
120
|
+
export const deletePgTaskList = sealStoreFunction(async function deletePgTaskList(pool, listKey) {
|
|
120
121
|
if (pgHasUnstorable(listKey))
|
|
121
122
|
throw new PgUnstorableError("task-list listKey");
|
|
122
123
|
assertListKeyBytes(listKey);
|
|
@@ -135,7 +136,8 @@ export async function deletePgTaskList(pool, listKey) {
|
|
|
135
136
|
finally {
|
|
136
137
|
c.release();
|
|
137
138
|
}
|
|
138
|
-
}
|
|
139
|
+
}, "sql-task-list-pg.delete");
|
|
140
|
+
const TASK_LIST_EXIT_PLAN = { get: "exit", set: "exit", delete: "exit", list: "exit", allocateId: "exit", mutate: "exit" };
|
|
139
141
|
export function createTiDBTaskListStore(pool, listKey) {
|
|
140
142
|
assertListKeyBytes(listKey);
|
|
141
143
|
const tx = async (fn) => {
|
|
@@ -158,7 +160,7 @@ export function createTiDBTaskListStore(pool, listKey) {
|
|
|
158
160
|
const [rows] = (await q.query(sql, params));
|
|
159
161
|
return rows;
|
|
160
162
|
};
|
|
161
|
-
const build = (q, inTx) => ({
|
|
163
|
+
const build = (q, inTx) => sealStoreObject({
|
|
162
164
|
get: async (id) => {
|
|
163
165
|
const [rows] = (await q.query(`SELECT ${jsonColumnText("mysql", "item_json")} FROM ${TASK_LIST_ITEM_TABLE} WHERE list_key = ? AND id = ?${inTx ? " FOR UPDATE" : ""}`, [listKey, id]));
|
|
164
166
|
return rows.length > 0 ? parseItem(rows[0].item_json, `for list ${listKey} item ${JSON.stringify(id)}`) : undefined;
|
|
@@ -187,7 +189,7 @@ export function createTiDBTaskListStore(pool, listKey) {
|
|
|
187
189
|
return fn(build(c, true));
|
|
188
190
|
}),
|
|
189
191
|
}),
|
|
190
|
-
});
|
|
192
|
+
}, inTx ? "sql-task-list-tidb-tx" : "sql-task-list-tidb", TASK_LIST_EXIT_PLAN);
|
|
191
193
|
return build(pool, false);
|
|
192
194
|
}
|
|
193
195
|
export function createPgTaskListStore(pool, listKey) {
|
|
@@ -214,7 +216,7 @@ export function createPgTaskListStore(pool, listKey) {
|
|
|
214
216
|
const res = await q.query(sql, params);
|
|
215
217
|
return res.rows;
|
|
216
218
|
};
|
|
217
|
-
const build = (q, inTx) => ({
|
|
219
|
+
const build = (q, inTx) => sealStoreObject({
|
|
218
220
|
get: async (id) => {
|
|
219
221
|
const { rows } = await q.query(`SELECT ${jsonColumnText("pg", "item_json")} FROM ${TASK_LIST_ITEM_TABLE} WHERE list_key = $1 AND id = $2${inTx ? " FOR UPDATE" : ""}`, [listKey, id]);
|
|
220
222
|
return rows.length > 0 ? parseItem(rows[0].item_json, `for list ${listKey} item ${JSON.stringify(id)}`) : undefined;
|
|
@@ -250,7 +252,7 @@ export function createPgTaskListStore(pool, listKey) {
|
|
|
250
252
|
return fn(build(c, true));
|
|
251
253
|
}),
|
|
252
254
|
}),
|
|
253
|
-
});
|
|
255
|
+
}, inTx ? "sql-task-list-pg-tx" : "sql-task-list-pg", TASK_LIST_EXIT_PLAN);
|
|
254
256
|
return build(pool, false);
|
|
255
257
|
}
|
|
256
258
|
//# sourceMappingURL=task-list-store-sql.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { decideQuota } from "../observability/cost-quota.js";
|
|
2
2
|
import { WriteBehindCounter } from "./write-behind-counter.js";
|
|
3
|
+
import { sealStoreClass } from "./store-boundary.js";
|
|
3
4
|
export class TiDBCostQuota {
|
|
4
5
|
counter;
|
|
5
6
|
limitMicroUsd;
|
|
@@ -50,4 +51,7 @@ export class TiDBCostQuota {
|
|
|
50
51
|
this.counter.stop();
|
|
51
52
|
}
|
|
52
53
|
}
|
|
54
|
+
sealStoreClass(TiDBCostQuota, "tidb-cost-quota", {
|
|
55
|
+
setLimits: "exit", check: "exit", add: "exit", flush: "exit", refresh: "exit", reap: "exit", startRefresh: "exit", stop: "exit",
|
|
56
|
+
});
|
|
53
57
|
//# sourceMappingURL=tidb-cost-quota.js.map
|
|
@@ -8,7 +8,7 @@ import { TIDB_PERMISSION_RULE_STATEMENTS } from "./permission-rule-store-sql.js"
|
|
|
8
8
|
import { TIDB_RETENTION_TOMBSTONE_STATEMENTS } from "../stores-sql/retention-store-sql.js";
|
|
9
9
|
import { TIDB_RETENTION_LANE_STATEMENTS } from "./retention-lane-store-sql.js";
|
|
10
10
|
import { SESSION_META_INCARNATION_COLUMN, SESSION_META_LINEAGE_COLUMNS } from "../session-incarnation.js";
|
|
11
|
-
import { ensureSessionExtTableMysql } from "./session-ext-table.js";
|
|
11
|
+
import { SESSION_EXT_INDEXES, ensureSessionExtTableMysql } from "./session-ext-table.js";
|
|
12
12
|
import { CHECKPOINT_HOST_SESSION_COLUMN } from "./checkpoint-index-columns.js";
|
|
13
13
|
import { RUN_IDENTITY_COLUMNS } from "../identity-source.js";
|
|
14
14
|
import { SESSION_RULES_COLUMN } from "./session-rules-column.js";
|
|
@@ -33,6 +33,7 @@ import { acquireAdvisoryLock, releaseAdvisoryLock } from "./ensure-schema-lock-p
|
|
|
33
33
|
import { SKILL_EXEMPTION_CUTOFF_ID, markIfAbsentSql, migrationMarkerDdl } from "./one-time-migration-marker.js";
|
|
34
34
|
import { replicaRegistrationDdl } from "./replica-registration.js";
|
|
35
35
|
import { servingRequirementDdl } from "./serving-requirement.js";
|
|
36
|
+
import { sessionBlobNamespaceClaimDdl } from "./session-blob-claim-token.js";
|
|
36
37
|
import { createCloseAwarePool } from "./sql-driver.js";
|
|
37
38
|
export function tidbPoolOptions(tidb) {
|
|
38
39
|
const { host, port, user, password, database, connectionLimit } = tidb;
|
|
@@ -268,12 +269,11 @@ export const SCHEMA_STATEMENTS = [
|
|
|
268
269
|
session_id VARCHAR(190) NOT NULL,
|
|
269
270
|
version INT NOT NULL DEFAULT 1,
|
|
270
271
|
status VARCHAR(16) NOT NULL DEFAULT 'pending',
|
|
271
|
-
tool_name VARCHAR(190) NULL,
|
|
272
272
|
tool_call_id VARCHAR(190) NULL,
|
|
273
|
-
--
|
|
274
|
-
--
|
|
275
|
-
--
|
|
276
|
-
|
|
273
|
+
-- (no display-copy columns: the approval queue row's action facts — tool name, input, risk descriptor, rule offers,
|
|
274
|
+
-- bidi bit — are projected at read time from ONE whole-row decode of checkpoint, the copy a resume executes;
|
|
275
|
+
-- the stored copies tool_name / tool_input / risk_descriptor / rule_suggestions / has_bidi_controls were retired by
|
|
276
|
+
-- one-time migration M54. tool_call_id / bound_input_hash / approval_card / gate_kind stay: readers find rows by them.)
|
|
277
277
|
checkpoint JSON NOT NULL,
|
|
278
278
|
outcome JSON NULL,
|
|
279
279
|
deadline BIGINT NULL,
|
|
@@ -331,25 +331,6 @@ export const SCHEMA_STATEMENTS = [
|
|
|
331
331
|
-- 那条:文本相等性有太多与业务无关的自由度,整数没有。)
|
|
332
332
|
-- **绝不**用它做 resolve 的 OCC:bump 它不影响 core 的 rev 语义。
|
|
333
333
|
pending_steer_rev BIGINT NOT NULL DEFAULT 0,
|
|
334
|
-
-- risk_descriptor (design/80 riskDescriptor inbox): core's INERT CheckpointGate.riskDescriptor ({severity
|
|
335
|
-
-- 1-5, axes, toolName, redacted summary, touchedPaths}), stamped at put() so listPending can surface it +
|
|
336
|
-
-- triage-sort the supervisor inbox by severity DESC — WITHOUT parsing the checkpoint blob per row.
|
|
337
|
-
-- NULL on gates with no descriptor.
|
|
338
|
-
risk_descriptor TEXT NULL,
|
|
339
|
-
-- rule_suggestions ([3683]-2/[3684]② mint 面归因):core 挂在 pendingAction.ruleOffers 上的规则
|
|
340
|
-
-- 候选(design/179 §4;与同步腿 AskRequest.ruleOffers 同一条契约;design/375 换形后载荷=判别联合,列名保留),在 put() 落列 —— 于是
|
|
341
|
-
-- listPending 不必为一格展示材料去拖整只 checkpoint blob(那是整份 suspend 快照)。落列前过
|
|
342
|
-
-- boundedRuleOffers:窄读(坏条丢弃)+ redactSecrets(候选文本由命令原文铸出,而运维队列跨租户
|
|
343
|
-
-- 可见)+ 基数截断。NULL = 无供给(规则车道没武装 / 命令说不出规则 / 这只 ask 规则清不掉),读口
|
|
344
|
-
-- 据此省键而不是铸空数组。
|
|
345
|
-
rule_suggestions TEXT NULL,
|
|
346
|
-
-- has_bidi_controls(S-30① / #356②;core 5.60.0 #438):bidi **在场位** —— core 在 park mint 写在
|
|
347
|
-
-- pendingAction(tool_approval 臂)上的那一位,put() 反范式成列,listPending 据它给 /v1/approvals 与
|
|
348
|
-
-- /v1/approvals/stream 的行铸 hasBidiControls:true(此前耐久运维队列一个位都没有:同一张卡
|
|
349
|
-
-- 「活着看得到告警、park 之后看不到」)。取值 **1 或 NULL、恒不写 0**:core 的契约是 true 或缺席
|
|
350
|
-
-- (缺席 = 没检出 ≠ 干净),一个 0 会把「没检出」谎成「已确认干净」。老行(本列诞生前 park 的)
|
|
351
|
-
-- NULL ⇒ 读口省键。clay 批 2026-07-26 TINYINT(1) 归一先例:布尔列 TiDB 侧 TINYINT(1)。
|
|
352
|
-
has_bidi_controls TINYINT(1) NULL,
|
|
353
334
|
-- execution_outcome / execution_at_ms(S-160;core 7.7.0 #602 的耐久半场):**决定被怎么处置了**的
|
|
354
335
|
-- 结算记录 —— resume 腿上那次调用的 tool_end 帧携带的 GateOutcome,与 outcome 列(决定本身,不可变)
|
|
355
336
|
-- 是两个轴:一个人批了(outcome 里 disposition=allowed),部署自己的复核在 post-CAS 否了他改过的参数
|
|
@@ -365,6 +346,10 @@ export const SCHEMA_STATEMENTS = [
|
|
|
365
346
|
-- plugins/checkpoint-index-columns.ts 的 hostSessionOf 求值一次;存量行由一次性迁移 M49 自 session_id 回填。按会话找卡的读口(决断 / 取消 / 收割 /
|
|
366
347
|
-- 续跑输入回收 / 运维队列行)只读它;session_id 只答「这是哪段对话」。列定义的唯一属主 = 同模块的 CHECKPOINT_HOST_SESSION_COLUMN。
|
|
367
348
|
${CHECKPOINT_HOST_SESSION_COLUMN.mysql},
|
|
349
|
+
-- card_scope_root:这张卡上「不再询问」规则的 project root **铸卡快照**(停驻那一刻由跑这条 run 的副本写一次,读法与问行 rule_scope_root 同义;
|
|
350
|
+
-- 不在兑付时重推)。NULL = 授权发生地在 server 坐标系里不可知(远程沙箱 / 未登记的 host / 多租 host 车道),或行由加这一列之前的构建落下 ⇒
|
|
351
|
+
-- 规则兑付不铸 scope(core 答 scope-unresolved,只会拒不会放宽)。写口 put,读口 cardScopeRootOf;上界同 rule_scope_root(ABSOLUTE_HOST_PATH_MAX)。
|
|
352
|
+
card_scope_root VARCHAR(4096) NULL,
|
|
368
353
|
PRIMARY KEY (token),
|
|
369
354
|
KEY idx_checkpoint_status_deadline (status, deadline),
|
|
370
355
|
KEY idx_checkpoint_session_status (session_id, status),
|
|
@@ -564,6 +549,15 @@ export const SCHEMA_STATEMENTS = [
|
|
|
564
549
|
created_at DATETIME(3) NOT NULL,
|
|
565
550
|
PRIMARY KEY (blob_hash),
|
|
566
551
|
KEY idx_file_history_blob_created (created_at)
|
|
552
|
+
) COLLATE utf8mb4_bin`,
|
|
553
|
+
`CREATE TABLE IF NOT EXISTS file_history_blob_grant (
|
|
554
|
+
scope VARCHAR(64) NOT NULL,
|
|
555
|
+
landing_owner VARBINARY(${PRINCIPAL_MAX_BYTES}) NOT NULL,
|
|
556
|
+
blob_hash CHAR(64) NOT NULL,
|
|
557
|
+
granted_at DATETIME(3) NOT NULL,
|
|
558
|
+
PRIMARY KEY (scope, landing_owner, blob_hash),
|
|
559
|
+
KEY idx_file_history_blob_grant_granted (granted_at),
|
|
560
|
+
KEY idx_file_history_blob_grant_blob (blob_hash)
|
|
567
561
|
) COLLATE utf8mb4_bin`,
|
|
568
562
|
`CREATE TABLE IF NOT EXISTS workflow_journal (
|
|
569
563
|
run_id VARCHAR(191) NOT NULL,
|
|
@@ -784,6 +778,7 @@ export const SCHEMA_STATEMENTS = [
|
|
|
784
778
|
migrationMarkerDdl("mysql"),
|
|
785
779
|
replicaRegistrationDdl("mysql"),
|
|
786
780
|
servingRequirementDdl("mysql"),
|
|
781
|
+
sessionBlobNamespaceClaimDdl("mysql"),
|
|
787
782
|
...TIDB_APPROVAL_ASK_STATEMENTS,
|
|
788
783
|
...TIDB_MEMORY_OPTOUT_GRANT_STATEMENTS,
|
|
789
784
|
...TIDB_SESSION_CAPTURE_OPTOUT_STATEMENTS,
|
|
@@ -843,6 +838,7 @@ export async function releaseEnsureSchemaLock(conn, tag = "ensureSchema") {
|
|
|
843
838
|
export const SCHEMA_INDEXES = [
|
|
844
839
|
...CENTRAL_SCHEMA_INDEXES,
|
|
845
840
|
...SESSION_INDEXES,
|
|
841
|
+
...SESSION_EXT_INDEXES,
|
|
846
842
|
...TOOL_RESULT_INDEXES,
|
|
847
843
|
...COST_QUOTA_INDEXES,
|
|
848
844
|
...RATE_LIMIT_INDEXES,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WriteBehindCounter } from "./write-behind-counter.js";
|
|
2
|
+
import { sealStoreClass } from "./store-boundary.js";
|
|
2
3
|
export class TiDBRateLimiter {
|
|
3
4
|
counter;
|
|
4
5
|
limit;
|
|
@@ -48,4 +49,7 @@ export class TiDBRateLimiter {
|
|
|
48
49
|
this.counter.stop();
|
|
49
50
|
}
|
|
50
51
|
}
|
|
52
|
+
sealStoreClass(TiDBRateLimiter, "tidb-rate-limiter", {
|
|
53
|
+
setLimits: "exit", check: "exit", sweep: "exit", flush: "exit", refresh: "exit", startRefresh: "exit", stop: "exit",
|
|
54
|
+
});
|
|
51
55
|
//# sourceMappingURL=tidb-rate-limiter.js.map
|
|
@@ -2,6 +2,7 @@ import { recordFailOpen } from "../observability/fail-open.js";
|
|
|
2
2
|
import { isDupKeyError } from "./sql-errors.js";
|
|
3
3
|
import { mysqlDriver, pgDriver } from "./sql-driver.js";
|
|
4
4
|
import { assertPageLimit, CRASHED_CAUSE, SETTLE_HOW_WORDS, USER_INPUT_KIND_WORDS, USER_INPUT_OPEN_SCAN_MAX, USER_INPUT_SESSION_READ_MAX, } from "../user-input-ledger.js";
|
|
5
|
+
import { sealStoreClass } from "./store-boundary.js";
|
|
5
6
|
export const USER_INPUT_ACCEPTANCE_TABLE = "user_input_acceptance";
|
|
6
7
|
const COLUMNS = "accept_id, input_kind, message_id, session_id, task_id, writer, accepted_at_ms, state, state_at_ms, settle_how, announced_at_ms, announced_task_id";
|
|
7
8
|
function rowState(r) {
|
|
@@ -116,6 +117,9 @@ export class SqlUserInputLedgerStore {
|
|
|
116
117
|
return res.affected;
|
|
117
118
|
}
|
|
118
119
|
}
|
|
120
|
+
sealStoreClass(SqlUserInputLedgerStore, "sql-user-input-ledger-store", {
|
|
121
|
+
accept: "exit", settle: "exit", converge: "exit", announce: "exit", listOpen: "exit", listCrashed: "exit", listUnannounced: "exit", deleteBySession: "exit",
|
|
122
|
+
});
|
|
119
123
|
export class TiDBUserInputLedgerStore extends SqlUserInputLedgerStore {
|
|
120
124
|
constructor(pool) {
|
|
121
125
|
super(mysqlDriver(pool));
|