@sema-agent/server 7.145.0 → 7.147.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 +876 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/USAGE.md +374 -99
- package/deploy/facts/CHANGES.json +25 -0
- package/deploy/facts/README.md +57 -0
- package/deploy/facts/lanes.json +61 -0
- package/deploy/facts/lanes.schema.json +57 -0
- package/deploy/facts/sandbox-rbac.json +113 -0
- package/deploy/facts/sandbox-rbac.schema.json +74 -0
- package/deploy/facts/sealed-key.json +9 -0
- package/deploy/facts/sealed-key.schema.json +52 -0
- package/deploy/sema-up/README.md +2 -2
- package/deploy/sema-up/chart/templates/_helpers.tpl +41 -0
- package/deploy/sema-up/chart/templates/sandbox-rbac.yaml +47 -7
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +9 -4
- package/deploy/sema-up/chart/templates/server.yaml +9 -4
- package/deploy/sema-up/chart/values.yaml +8 -1
- package/deploy/sema-up/cluster-up.sh +2 -1
- package/deploy/sema-up/lib/flagshape.sh +4 -0
- package/deploy/sema-up/lib/lanes.json +2 -5
- package/deploy/sema-up/sema-up.sh +12 -9
- package/deploy/sema-up/stack/compose.yaml +5 -4
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +34 -17
- package/dist/adoption/import-limits.d.ts +6 -0
- package/dist/adoption/import-limits.js +7 -0
- package/dist/adoption/import.d.ts +62 -0
- package/dist/adoption/import.js +107 -0
- package/dist/adoption/wire.d.ts +52 -0
- package/dist/adoption/wire.js +9 -0
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +7 -16
- package/dist/approval-card.js +0 -4
- package/dist/approval-gate-currency.d.ts +1 -1
- package/dist/approval-gate-currency.js +1 -1
- package/dist/approval-reconciler.d.ts +1 -1
- package/dist/approval.d.ts +3 -3
- package/dist/audit.js +2 -2
- package/dist/bench/s1/live-deps.js +3 -1
- package/dist/boot/crash-last.js +2 -1
- package/dist/boot/deployment-mods.d.ts +11 -1
- package/dist/boot/deployment-mods.js +15 -2
- package/dist/boot/device-lane.js +7 -5
- package/dist/boot/engine-lease.d.ts +195 -22
- package/dist/boot/engine-lease.js +146 -20
- package/dist/boot/execution-env.d.ts +5 -0
- package/dist/boot/execution-env.js +57 -33
- package/dist/boot/execution-lane.d.ts +37 -9
- package/dist/boot/execution-lane.js +74 -20
- package/dist/boot/exit-boundary.d.ts +50 -0
- package/dist/boot/exit-boundary.js +32 -0
- package/dist/boot/exit-last.d.ts +20 -4
- package/dist/boot/exit-last.js +23 -5
- package/dist/boot/governance-seams.d.ts +2 -2
- package/dist/boot/governance-seams.js +1 -0
- package/dist/boot/leader.js +1 -1
- package/dist/boot/memory-boundary.d.ts +11 -11
- package/dist/boot/memory-boundary.js +3 -3
- package/dist/boot/memory-consolidation.d.ts +42 -41
- package/dist/boot/memory-consolidation.js +26 -28
- package/dist/boot/org-memory.js +3 -2
- package/dist/boot/parked-revive-gate.d.ts +1 -1
- package/dist/boot/parked-revive-gate.js +1 -1
- package/dist/boot/reapers.d.ts +12 -4
- package/dist/boot/reapers.js +40 -16
- package/dist/boot/resolve-spec.d.ts +2 -0
- package/dist/boot/resolve-spec.js +126 -123
- package/dist/boot/retention-lane.d.ts +4 -42
- package/dist/boot/runner-deps.js +1 -1
- package/dist/boot/session-faces.d.ts +1 -0
- package/dist/boot/session-faces.js +11 -3
- package/dist/boot/shutdown.js +27 -9
- package/dist/boot/stage-01-config.d.ts +1 -1
- package/dist/boot/stage-01-config.js +7 -3
- package/dist/boot/stage-02-web-admin-pull.d.ts +1 -1
- package/dist/boot/stage-02-web-admin-pull.js +10 -8
- package/dist/boot/stage-03-store-backend.d.ts +2 -1
- package/dist/boot/stage-03-store-backend.js +2 -2
- package/dist/boot/stage-04-stores.d.ts +2 -1
- package/dist/boot/stage-05-execution-env.d.ts +4 -1
- package/dist/boot/stage-05-execution-env.js +6 -6
- package/dist/boot/stage-06-runners.d.ts +5 -2
- package/dist/boot/stage-06-runners.js +12 -13
- package/dist/boot/stage-07-capability-layer.d.ts +5 -2
- package/dist/boot/stage-07-capability-layer.js +7 -7
- package/dist/boot/stage-08-reapers.d.ts +5 -2
- package/dist/boot/stage-08-reapers.js +3 -3
- package/dist/boot/stage-09-leader.d.ts +6 -2
- package/dist/boot/stage-10-http-server.d.ts +6 -2
- package/dist/boot/stage-10-http-server.js +5 -3
- package/dist/boot/stores.d.ts +10 -0
- package/dist/boot/stores.js +53 -26
- package/dist/boot/web-admin.js +3 -3
- package/dist/boot/workflow-orchestration.d.ts +1 -1
- package/dist/boot/workflow-orchestration.js +2 -1
- package/dist/capabilities/center-plugins.d.ts +2 -0
- package/dist/capabilities/center-plugins.js +6 -2
- package/dist/capabilities/composite-members.d.ts +4 -1
- package/dist/capabilities/composite-members.js +4 -1
- package/dist/capabilities/execution-lane.d.ts +7 -7
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +1 -1
- package/dist/capabilities/scenarios.d.ts +34 -20
- package/dist/capabilities/scenarios.js +13 -9
- package/dist/capabilities/settings-contract.d.ts +29 -0
- package/dist/capabilities/settings-contract.js +14 -0
- package/dist/capabilities/skills.d.ts +5 -5
- package/dist/capability-facts.d.ts +56 -1
- package/dist/capability-facts.js +59 -8
- package/dist/center-credential-renewer.js +3 -2
- package/dist/checkpoint-ctx-seal-m28.d.ts +1 -1
- package/dist/config-catalog.js +19 -9
- package/dist/config-invariants.d.ts +18 -3
- package/dist/config-invariants.js +36 -19
- package/dist/config-lkg.d.ts +1 -1
- package/dist/config-lkg.js +5 -6
- package/dist/config-provider.d.ts +2 -2
- package/dist/config-provider.js +2 -0
- package/dist/config-types.d.ts +228 -185
- package/dist/config.d.ts +74 -6
- package/dist/config.js +146 -64
- package/dist/degenerate-instrument.js +1 -1
- package/dist/deleted-session-ids.d.ts +19 -0
- package/dist/deleted-session-ids.js +26 -0
- package/dist/deploy-facts.d.ts +155 -0
- package/dist/deploy-facts.js +95 -0
- package/dist/deployment-shape.d.ts +21 -12
- package/dist/deployment-shape.js +24 -6
- package/dist/device-ws-hub.d.ts +48 -3
- package/dist/device-ws-hub.js +48 -2
- package/dist/env-facts.d.ts +7 -5
- package/dist/env-facts.js +10 -6
- package/dist/error-code-family.d.ts +35 -0
- package/dist/error-code-family.js +26 -0
- package/dist/execution-config-root.d.ts +5 -5
- package/dist/execution-config-root.js +5 -5
- package/dist/execution-env-purpose.d.ts +14 -0
- package/dist/execution-env-purpose.js +29 -0
- package/dist/execution-lane-caps.d.ts +49 -86
- package/dist/execution-lane-caps.js +52 -62
- package/dist/execution-placement.d.ts +18 -2
- package/dist/execution-placement.js +19 -0
- package/dist/file-history-disclosure.d.ts +2 -2
- package/dist/fleet/drain-entry.d.ts +46 -3
- package/dist/fleet/drain-entry.js +6 -0
- package/dist/fleet/fleet-bus.d.ts +2 -1
- package/dist/fleet/serving-lease.js +3 -4
- package/dist/history-anchor.d.ts +22 -0
- package/dist/history-anchor.js +14 -0
- package/dist/hooks/branch-transcript.d.ts +1 -1
- package/dist/hooks/branch-transcript.js +1 -0
- package/dist/hooks/classic-stations.d.ts +25 -8
- package/dist/hooks/classic-stations.js +29 -3
- package/dist/hooks/command-spawn.d.ts +1 -4
- package/dist/hooks/command-spawn.js +0 -11
- package/dist/hooks/hook-runner.d.ts +85 -24
- package/dist/hooks/hook-runner.js +326 -109
- package/dist/hooks/hook-source.d.ts +14 -2
- package/dist/hooks/hook-source.js +8 -0
- package/dist/http/active-run-conflict.d.ts +1 -1
- package/dist/http/active-run-conflict.js +1 -1
- package/dist/http/admission.js +11 -1
- package/dist/http/approval-sweeps.d.ts +2 -5
- package/dist/http/approval-sweeps.js +3 -2
- package/dist/http/checkpoint-ctx.d.ts +76 -71
- package/dist/http/checkpoint-ctx.js +40 -40
- package/dist/http/claim-latency.d.ts +10 -0
- package/dist/http/claim-latency.js +12 -0
- package/dist/http/dispatch.js +19 -3
- package/dist/http/durable-run-leg.d.ts +5 -0
- package/dist/http/durable-run-leg.js +3 -1
- package/dist/http/execution-context.d.ts +7 -1
- package/dist/http/execution-context.js +13 -0
- package/dist/http/health-self-report.d.ts +6 -2
- package/dist/http/health-self-report.js +3 -2
- package/dist/http/memory-compliance-failure-reply.d.ts +2 -2
- package/dist/http/memory-compliance-failure-reply.js +5 -15
- package/dist/http/memory-control-plane-corrupt-reply.d.ts +25 -0
- package/dist/http/memory-control-plane-corrupt-reply.js +19 -0
- package/dist/http/memory-store-refusal-reply.d.ts +3 -3
- package/dist/http/memory-store-refusal-reply.js +3 -0
- package/dist/http/owner-access.d.ts +11 -0
- package/dist/http/owner-access.js +7 -4
- package/dist/http/principal-gate.d.ts +28 -16
- package/dist/http/principal-gate.js +10 -19
- package/dist/http/request-guards.d.ts +2 -2
- package/dist/http/request-guards.js +5 -5
- package/dist/http/resume-legs.d.ts +29 -10
- package/dist/http/resume-legs.js +94 -56
- package/dist/http/rewind-files-reply.d.ts +34 -0
- package/dist/http/rewind-files-reply.js +36 -0
- package/dist/http/route-ctx.d.ts +43 -26
- package/dist/http/route-table.js +4 -0
- package/dist/http/routes/adoption.d.ts +11 -0
- package/dist/http/routes/adoption.js +80 -6
- package/dist/http/routes/agents-roster.js +1 -0
- package/dist/http/routes/approvals-assistant.js +7 -26
- package/dist/http/routes/background.js +1 -0
- package/dist/http/routes/capabilities.js +12 -3
- package/dist/http/routes/devices.js +1 -1
- package/dist/http/routes/diagnostics.d.ts +9 -14
- package/dist/http/routes/diagnostics.js +10 -20
- package/dist/http/routes/engine.d.ts +31 -0
- package/dist/http/routes/engine.js +81 -0
- package/dist/http/routes/memory-bundle.js +3 -0
- package/dist/http/routes/memory-consolidation.js +3 -5
- package/dist/http/routes/memory-origin.d.ts +2 -2
- package/dist/http/routes/memory-origin.js +2 -4
- package/dist/http/routes/memory-policy.js +5 -1
- package/dist/http/routes/notify-wake.js +2 -1
- package/dist/http/routes/observability.js +3 -6
- package/dist/http/routes/projects.d.ts +70 -0
- package/dist/http/routes/projects.js +86 -0
- package/dist/http/routes/rules.js +30 -2
- package/dist/http/routes/runs.js +15 -11
- package/dist/http/routes/session-sync.js +39 -35
- package/dist/http/routes/sessions-list.d.ts +1 -1
- package/dist/http/routes/sessions.d.ts +7 -1
- package/dist/http/routes/sessions.js +108 -2
- package/dist/http/routes/tasks.js +32 -8
- package/dist/http/routes/trace-usage.js +1 -1
- package/dist/http/run-concurrency-cap.d.ts +86 -0
- package/dist/http/run-concurrency-cap.js +54 -0
- package/dist/http/server.d.ts +31 -14
- package/dist/http/server.js +29 -3
- package/dist/http/stored-body-replay.d.ts +12 -7
- package/dist/http/stored-body-replay.js +28 -5
- package/dist/http/wire-types.d.ts +27 -13
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/instruction-source-notice.d.ts +1 -1
- package/dist/json-body-limit.d.ts +8 -0
- package/dist/json-body-limit.js +2 -0
- package/dist/leader/diffout.d.ts +1 -1
- package/dist/local-data-root.d.ts +2 -2
- package/dist/memory-embedder-reembed.d.ts +38 -0
- package/dist/memory-embedder-reembed.js +20 -0
- package/dist/memory-incident-sink.d.ts +0 -28
- package/dist/memory-incident-sink.js +5 -0
- package/dist/memory-operator-faces.d.ts +9 -4
- package/dist/memory-scope-stores.d.ts +9 -7
- package/dist/memory-scope-stores.js +3 -14
- package/dist/memory-scope.d.ts +38 -2
- package/dist/memory-scope.js +33 -2
- package/dist/memory-store-refusal.d.ts +17 -4
- package/dist/memory-store-refusal.js +1 -1
- package/dist/memory-sync-client.d.ts +2 -0
- package/dist/memory-sync-client.js +13 -11
- package/dist/memory-sync.js +1 -1
- package/dist/model-compat.d.ts +35 -21
- package/dist/model-compat.js +49 -21
- package/dist/model-entry-refusal.d.ts +11 -1
- package/dist/model-entry-refusal.js +7 -0
- package/dist/namespaced-rule-name.d.ts +18 -1
- package/dist/namespaced-rule-name.js +12 -0
- package/dist/net-address.d.ts +53 -0
- package/dist/net-address.js +111 -0
- package/dist/observability/fail-open.d.ts +29 -17
- package/dist/observability/fail-open.js +29 -17
- package/dist/observability/metrics.d.ts +2 -0
- package/dist/observability/metrics.js +2 -0
- package/dist/observability/secret-env-scrub.d.ts +30 -4
- package/dist/observability/secret-env-scrub.js +15 -3
- package/dist/orchestration/workflow-agent-session-index.d.ts +7 -12
- package/dist/orchestration/workflow-agent-session-index.js +1 -6
- package/dist/orchestration/workflow-completion-inbox.d.ts +26 -6
- package/dist/orchestration/workflow-completion-inbox.js +63 -45
- package/dist/orchestration/workflow-notify-journal.js +2 -3
- package/dist/org-delivery-gate.js +1 -1
- package/dist/org-memory-admission.d.ts +5 -2
- package/dist/org-memory-admission.js +25 -10
- package/dist/parked-decide.d.ts +33 -26
- package/dist/parked-decide.js +36 -44
- package/dist/peer-directory.d.ts +6 -12
- package/dist/peer-directory.js +5 -1
- package/dist/plugins/approval-ask-store-file.d.ts +10 -2
- package/dist/plugins/approval-ask-store-file.js +37 -4
- package/dist/plugins/approval-ask-store-memory.d.ts +5 -3
- package/dist/plugins/approval-ask-store-memory.js +11 -2
- package/dist/plugins/approval-ask-store-sql.d.ts +3 -0
- package/dist/plugins/approval-ask-store-sql.js +3 -1
- package/dist/plugins/blob-backend.d.ts +38 -195
- package/dist/plugins/blob-backend.js +33 -229
- package/dist/plugins/caching-session-store.d.ts +12 -5
- package/dist/plugins/caching-session-store.js +3 -0
- package/dist/plugins/checkpoint-index-columns.d.ts +1 -1
- package/dist/plugins/checkpoint-index-columns.js +3 -2
- package/dist/plugins/checkpoint-store-face.d.ts +426 -0
- package/dist/plugins/checkpoint-store-face.js +152 -0
- package/dist/plugins/device-store-sql.d.ts +2 -2
- package/dist/plugins/device-store-sql.js +5 -10
- package/dist/plugins/execution-lane-rename-m40.d.ts +20 -0
- package/dist/plugins/execution-lane-rename-m40.js +10 -0
- package/dist/plugins/execution-placement-sql.d.ts +63 -88
- package/dist/plugins/execution-placement-sql.js +94 -54
- package/dist/plugins/file-run-store.d.ts +26 -18
- package/dist/plugins/file-run-store.js +64 -75
- package/dist/plugins/fork-routing-session-store.d.ts +6 -2
- package/dist/plugins/fork-routing-session-store.js +2 -2
- package/dist/plugins/imported-layer-root-retirement.d.ts +22 -11
- package/dist/plugins/imported-layer-root-retirement.js +4 -8
- package/dist/plugins/inbox-payload-column.d.ts +14 -0
- package/dist/plugins/inbox-payload-column.js +13 -0
- package/dist/plugins/local-checkpoint-store.d.ts +7 -2
- package/dist/plugins/local-checkpoint-store.js +13 -8
- package/dist/plugins/local-data-dir-modes-m39.d.ts +48 -0
- package/dist/plugins/local-data-dir-modes-m39.js +182 -0
- package/dist/plugins/local-engine-high-water.d.ts +11 -0
- package/dist/plugins/local-engine-high-water.js +59 -0
- package/dist/plugins/local-session-store.d.ts +119 -30
- package/dist/plugins/local-session-store.js +156 -53
- package/dist/plugins/local-task-attachment-store.d.ts +2 -0
- package/dist/plugins/local-task-attachment-store.js +10 -11
- package/dist/plugins/memory-embedder-fingerprint.d.ts +33 -10
- package/dist/plugins/memory-embedder-fingerprint.js +52 -12
- package/dist/plugins/memory-embedder.d.ts +1 -1
- package/dist/plugins/memory-embedder.js +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +30 -6
- package/dist/plugins/memory-engine-pg.js +96 -214
- package/dist/plugins/memory-engine-sql-apply.d.ts +130 -0
- package/dist/plugins/memory-engine-sql-apply.js +358 -0
- package/dist/plugins/memory-engine-tidb.d.ts +38 -9
- package/dist/plugins/memory-engine-tidb.js +99 -230
- package/dist/plugins/memory-key-guards.d.ts +1 -1
- package/dist/plugins/memory-origin-law.d.ts +3 -3
- package/dist/plugins/one-time-migrations.d.ts +169 -83
- package/dist/plugins/one-time-migrations.js +295 -235
- package/dist/plugins/owner-only-file-mode.d.ts +29 -0
- package/dist/plugins/owner-only-file-mode.js +141 -0
- package/dist/plugins/permission-rule-store-file.d.ts +17 -3
- package/dist/plugins/permission-rule-store-file.js +20 -1
- package/dist/plugins/pg-pool.d.ts +2 -1
- package/dist/plugins/pg-pool.js +12 -5
- package/dist/plugins/release-version.d.ts +20 -0
- package/dist/plugins/release-version.js +28 -0
- package/dist/plugins/remote-env-adb.d.ts +20 -4
- package/dist/plugins/remote-env-adb.js +39 -11
- package/dist/plugins/remote-env-e2b.d.ts +12 -3
- package/dist/plugins/remote-env-e2b.js +6 -4
- package/dist/plugins/remote-env-host.d.ts +9 -1
- package/dist/plugins/remote-env-host.js +6 -5
- package/dist/plugins/remote-env-k8s.d.ts +5 -2
- package/dist/plugins/remote-env-k8s.js +15 -4
- package/dist/plugins/remote-env-local-docker.d.ts +4 -1
- package/dist/plugins/remote-env-local-docker.js +3 -3
- package/dist/plugins/remote-env-ssh.d.ts +8 -2
- package/dist/plugins/remote-env-ssh.js +26 -24
- package/dist/plugins/remote-shell.d.ts +59 -30
- package/dist/plugins/remote-shell.js +175 -62
- package/dist/plugins/retention-declaration.d.ts +37 -0
- package/dist/plugins/retention-declaration.js +9 -0
- package/dist/plugins/retention-deployment.d.ts +126 -0
- package/dist/plugins/retention-deployment.js +88 -0
- package/dist/plugins/retention-lane-store-sql.d.ts +74 -4
- package/dist/plugins/retention-lane-store-sql.js +103 -1
- package/dist/plugins/retention-sql.d.ts +29 -0
- package/dist/plugins/retention-sql.js +8 -0
- package/dist/plugins/run-store-sql.js +2 -2
- package/dist/plugins/schema-consistency.d.ts +0 -6
- package/dist/plugins/schema-consistency.js +1 -2
- package/dist/plugins/schema-ensure-legs.d.ts +1 -1
- package/dist/plugins/schema-ensure-legs.js +13 -3
- package/dist/plugins/session-ext-table.d.ts +74 -0
- package/dist/plugins/session-ext-table.js +121 -0
- package/dist/plugins/session-fork.d.ts +31 -9
- package/dist/plugins/session-fork.js +3 -2
- package/dist/plugins/session-placement.d.ts +4 -2
- package/dist/plugins/session-row-sql.d.ts +8 -7
- package/dist/plugins/session-row-sql.js +15 -7
- package/dist/plugins/session-store-sql.d.ts +131 -0
- package/dist/plugins/session-store-sql.js +298 -0
- package/dist/plugins/session-workspace-cell.d.ts +2 -2
- package/dist/plugins/session-workspace-cell.js +2 -2
- package/dist/plugins/shared-memory-store-sql.d.ts +10 -0
- package/dist/plugins/shared-memory-store-sql.js +13 -13
- package/dist/plugins/snapshot-bucket-presence.js +1 -1
- package/dist/plugins/sql-driver.d.ts +23 -7
- package/dist/plugins/sql-driver.js +41 -8
- package/dist/plugins/sql-errors.d.ts +5 -2
- package/dist/plugins/sql-errors.js +4 -0
- package/dist/plugins/sql-json-column.d.ts +5 -1
- package/dist/plugins/store-backend.d.ts +46 -16
- package/dist/plugins/store-backend.js +192 -69
- package/dist/plugins/store-contracts.d.ts +10 -13
- package/dist/plugins/store-contracts.js +1 -9
- package/dist/plugins/store-sweep.d.ts +63 -0
- package/dist/plugins/store-sweep.js +48 -0
- package/dist/plugins/task-attachment-store.d.ts +6 -8
- package/dist/plugins/task-attachment-store.js +15 -10
- package/dist/plugins/task-list-store-sql.d.ts +1 -1
- package/dist/plugins/text-column-capacity.d.ts +21 -0
- package/dist/plugins/text-column-capacity.js +5 -0
- package/dist/plugins/tidb-pool.d.ts +3 -2
- package/dist/plugins/tidb-pool.js +20 -32
- package/dist/plugins/user-input-ledger-sql.d.ts +1 -1
- package/dist/prompt-screen.d.ts +6 -9
- package/dist/prompt-screen.js +2 -5
- package/dist/read-face-posture.d.ts +6 -6
- package/dist/read-face-posture.js +2 -2
- package/dist/request-value-closure.d.ts +5 -5
- package/dist/request-value-closure.js +1 -1
- package/dist/rules-consent.d.ts +48 -27
- package/dist/rules-consent.js +147 -23
- package/dist/run-cancel-context.d.ts +4 -1
- package/dist/run-cancel-context.js +2 -1
- package/dist/run-local.js +17 -13
- package/dist/runs.d.ts +48 -30
- package/dist/runs.js +27 -17
- package/dist/runtime-caps-resolver.d.ts +15 -8
- package/dist/runtime-caps-resolver.js +14 -10
- package/dist/sandbox-egress-policy.js +6 -11
- package/dist/sandbox-rbac-rules.d.ts +88 -0
- package/dist/sandbox-rbac-rules.js +80 -0
- package/dist/sealed-key-layout.d.ts +16 -0
- package/dist/sealed-key-layout.js +3 -0
- package/dist/sealed-key.js +8 -6
- package/dist/security.d.ts +43 -9
- package/dist/security.js +9 -2
- package/dist/sema-config-dir.js +2 -2
- package/dist/server-secret-env.d.ts +2 -0
- package/dist/service-version.d.ts +2 -1
- package/dist/service-version.js +2 -2
- package/dist/session-error-wire.d.ts +1 -1
- package/dist/session-incarnation.d.ts +8 -5
- package/dist/session-notify-door.d.ts +5 -3
- package/dist/session-resident-background.d.ts +110 -0
- package/dist/session-resident-background.js +88 -0
- package/dist/session-row.d.ts +1 -1
- package/dist/session-sync-kernel.d.ts +53 -14
- package/dist/session-sync-kernel.js +70 -1
- package/dist/session-sync.d.ts +5 -3
- package/dist/session-workspace.d.ts +12 -2
- package/dist/session-workspace.js +6 -0
- package/dist/sighup-idle.d.ts +9 -7
- package/dist/sighup-idle.js +4 -5
- package/dist/spec-fields.d.ts +16 -0
- package/dist/spec-fields.js +7 -0
- package/dist/store-posture.d.ts +2 -1
- package/dist/stored-request-env-credentials-m38.d.ts +3 -0
- package/dist/stored-request-env-credentials-m38.js +8 -0
- package/dist/stored-request-hooks-m20.d.ts +3 -2
- package/dist/stored-request-hooks-m20.js +19 -14
- package/dist/stored-request-prompt-profile-m30.d.ts +1 -1
- package/dist/stores-sql/blob-index-sql.d.ts +148 -0
- package/dist/stores-sql/blob-index-sql.js +154 -0
- package/dist/{plugins → stores-sql}/checkpoint-store-sql.d.ts +14 -428
- package/dist/{plugins → stores-sql}/checkpoint-store-sql.js +43 -220
- package/dist/{plugins → stores-sql}/file-history-store-sql.d.ts +23 -11
- package/dist/{plugins → stores-sql}/file-history-store-sql.js +23 -18
- package/dist/{plugins → stores-sql}/mailbox-store-sql.d.ts +2 -2
- package/dist/{plugins → stores-sql}/mailbox-store-sql.js +4 -4
- package/dist/{plugins → stores-sql}/pg-session-storage.d.ts +27 -67
- package/dist/{plugins → stores-sql}/pg-session-storage.js +82 -207
- package/dist/{plugins → stores-sql}/retention-store-sql.d.ts +123 -217
- package/dist/{plugins → stores-sql}/retention-store-sql.js +66 -190
- package/dist/{plugins → stores-sql}/roster-store-sql.d.ts +2 -2
- package/dist/{plugins → stores-sql}/roster-store-sql.js +1 -1
- package/dist/{plugins → stores-sql}/session-event-payload.d.ts +1 -1
- package/dist/{plugins → stores-sql}/session-event-payload.js +1 -1
- package/dist/stores-sql/session-policy-store-sql.d.ts +1 -1
- package/dist/stores-sql/session-write-hooks.d.ts +59 -0
- package/dist/stores-sql/session-write-hooks.js +2 -0
- package/dist/{plugins → stores-sql}/tidb-session-storage.d.ts +10 -11
- package/dist/{plugins → stores-sql}/tidb-session-storage.js +10 -21
- package/dist/{plugins → stores-sql}/tidb-session-store.d.ts +35 -112
- package/dist/{plugins → stores-sql}/tidb-session-store.js +73 -169
- package/dist/{plugins → stores-sql}/tool-result-store-sql.d.ts +3 -3
- package/dist/{plugins → stores-sql}/tool-result-store-sql.js +6 -6
- package/dist/stores-sql/windowed-session-storage.d.ts +56 -0
- package/dist/stores-sql/windowed-session-storage.js +61 -0
- package/dist/{plugins → stores-sql}/workflow-journal-store-sql.d.ts +7 -12
- package/dist/{plugins → stores-sql}/workflow-journal-store-sql.js +3 -8
- package/dist/task-a2a.d.ts +7 -1
- package/dist/task-a2a.js +15 -14
- package/dist/task-cwd.d.ts +11 -3
- package/dist/task-cwd.js +17 -1
- package/dist/task-mcp.d.ts +10 -2
- package/dist/task-mcp.js +13 -16
- package/dist/task-settings.d.ts +68 -8
- package/dist/task-settings.js +63 -6
- package/dist/tool-approval.d.ts +23 -10
- package/dist/tool-approval.js +10 -6
- package/dist/trace/core-keyset-guard.d.ts +17 -10
- package/dist/trace/engine-notice-wire.d.ts +1 -1
- package/dist/trace/engine-notice-wire.js +4 -0
- package/dist/trace/exit-seat.d.ts +29 -1
- package/dist/trace/exit-seat.js +4 -0
- package/dist/trace/project.d.ts +33 -16
- package/dist/trace/project.js +21 -9
- package/dist/trace/redact.d.ts +13 -2
- package/dist/trace/redact.js +347 -78
- package/dist/trace/self-minted-wire.d.ts +587 -16
- package/dist/trace/self-minted-wire.js +215 -9
- package/dist/trace/sema-provenance.d.ts +45 -41
- package/dist/trace/sema-provenance.js +81 -10
- package/dist/trace/task-notification-facets.d.ts +70 -2
- package/dist/trace/task-notification-facets.js +71 -1
- package/dist/trace/wire-projection-faces.d.ts +39 -3
- package/dist/trace/wire-projection-faces.js +27 -2
- package/dist/unread-request-members.d.ts +66 -0
- package/dist/unread-request-members.js +41 -0
- package/dist/usage-analytics.d.ts +4 -0
- package/dist/user-input-ledger.d.ts +2 -2
- package/dist/web-admin-client/apply-effective.js +22 -26
- package/dist/web-admin-client/candidate-gate.d.ts +35 -3
- package/dist/web-admin-client/candidate-gate.js +53 -5
- package/dist/web-admin-client/center-request.d.ts +4 -1
- package/dist/web-admin-client/center-request.js +2 -1
- package/dist/web-admin-client/effective-keys.js +0 -1
- package/dist/web-admin-client/facade.d.ts +1 -1
- package/dist/web-admin-client/http-client.d.ts +1 -0
- package/dist/web-admin-client/http-client.js +17 -9
- package/dist/web-admin-client/restart-signal.js +5 -2
- package/dist/web-admin-client/skills-mcp.d.ts +20 -6
- package/dist/web-admin-client/skills-mcp.js +26 -21
- package/dist/web-admin-client/types.d.ts +34 -49
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +2 -2
- package/package.json +22 -13
- package/scripts/drain-check-local.mjs +8 -55
- package/scripts/drain-check.mysql.sql +3 -40
- package/scripts/drain-check.pg.sql +3 -40
- package/skills/update-config.md +1 -1
- package/wire-changes/server@7.146.0.json +3221 -0
- package/wire-changes/server@7.147.0.json +813 -0
- package/dist/approval-batch-census.d.ts +0 -27
- package/dist/approval-batch-census.js +0 -27
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
import { parkedApprovalCard } from "../approval-content-kind.js";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
|
-
import { CHECKPOINT_FACET_SQL, CHECKPOINT_SWEEP_ORDER_SQL, CheckpointIndexRefusedError, judgeCheckpointIndexCells } from "
|
|
4
|
-
import { CheckpointError,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { assertJsonColumnWritable, createObjectColumnReader, decodeJsonColumn, decodeNullableJsonColumn, foldJsonColumn, isJsonColumnBodyProblem, jsonColumnText, jsonColumnTextExpr, jsonColumnTextSha256, readJsonArrayColumn, readJsonColumnTextSha256, readJsonObjectColumn, readNonNullJsonValueColumn, } from "./sql-json-column.js";
|
|
3
|
+
import { CHECKPOINT_FACET_SQL, CHECKPOINT_SWEEP_ORDER_SQL, CheckpointIndexRefusedError, judgeCheckpointIndexCells } from "../plugins/checkpoint-index-columns.js";
|
|
4
|
+
import { CheckpointError, validatePendingSteer, appendPendingSteer, winnerFromOutcome, summarizeCheckpoint, checkpointRevOf, judgeCheckpointRow, CONTRACT_KIT_ENGINE_VERSION, ExecutionOutcomeConflictError, executionRecordDisposition, executionVerdict, } from "@sema-agent/core";
|
|
5
|
+
import { parkRowFacts, skillCardFacts } from "../approval-card.js";
|
|
6
|
+
import { assertJsonColumnWritable, createObjectColumnReader, decodeJsonColumn, decodeNullableJsonColumn, foldJsonColumn, isJsonColumnBodyProblem, jsonColumnText, jsonColumnTextSha256, readJsonArrayColumn, readJsonColumnTextSha256, readNonNullJsonValueColumn, StoreCorruptError, } from "../plugins/sql-json-column.js";
|
|
8
7
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
9
8
|
import { durableRowIdentity, withoutCheckpointToken } from "../checkpoint-identity.js";
|
|
10
|
-
import { mysqlDriver, pgDriver, dialectProtocolJsonEncoder } from "
|
|
11
|
-
import { isDupKeyError, isMissingColumnError, rowTooLargeOrSelf, StoreRowTooLargeError } from "
|
|
12
|
-
import { describeProbedTableDrift } from "
|
|
13
|
-
import { MANAGED_RETENTION, UNMANAGED_RETENTION } from "
|
|
14
|
-
import { approvalPayloadFingerprint } from "
|
|
9
|
+
import { mysqlDriver, pgDriver, dialectProtocolJsonEncoder } from "../plugins/sql-driver.js";
|
|
10
|
+
import { isDupKeyError, isMissingColumnError, rowTooLargeOrSelf, StoreRowTooLargeError } from "../plugins/sql-errors.js";
|
|
11
|
+
import { describeProbedTableDrift } from "../plugins/schema-drift-sentence.js";
|
|
12
|
+
import { MANAGED_RETENTION, UNMANAGED_RETENTION } from "../plugins/retention-declaration.js";
|
|
13
|
+
import { approvalPayloadFingerprint } from "../plugins/approval-payload-fingerprint.js";
|
|
14
|
+
import { approvalDecisionOfWinner, boundedRuleOffers, boundedToolInput, candidateIdentityOf, DECIDED_REPLAY_SCAN_CAP, queueRowGateKind, TERMINAL_BACKSTOP_MS, TERMINAL_GRACE_MS, UnreadableCheckpointRowError, } from "../plugins/checkpoint-store-face.js";
|
|
15
15
|
const CTX_REWRITE_PAGE = 500;
|
|
16
|
-
const KINDLESS_SCAN_PAGE = 200;
|
|
17
|
-
export { approvalPayloadFingerprint } from "./approval-payload-fingerprint.js";
|
|
18
|
-
const MAX_TOOL_INPUT_CHARS = 8192;
|
|
19
|
-
export const TERMINAL_BACKSTOP_MS = Math.max(60_000, (Number.isFinite(Number(process.env.APPROVAL_TERMINAL_BACKSTOP_MS)) ? Number(process.env.APPROVAL_TERMINAL_BACKSTOP_MS) : 0) || 30 * 86_400_000);
|
|
20
|
-
export const TERMINAL_GRACE_MS = 3_600_000;
|
|
21
16
|
export function tokenFingerprint(token) {
|
|
22
17
|
return "sha256:" + createHash("sha256").update(token).digest("hex").slice(0, 12);
|
|
23
18
|
}
|
|
@@ -50,21 +45,6 @@ class StoredRowProjectionMemo {
|
|
|
50
45
|
}
|
|
51
46
|
const STORED_ROW_READ_BATCH = 100;
|
|
52
47
|
const CHECKPOINT_SHA256_AS = "checkpoint_sha256";
|
|
53
|
-
const GATE_KIND_IS_LIVE_RUN_PARK = {
|
|
54
|
-
human: true,
|
|
55
|
-
irreversible_ask: true,
|
|
56
|
-
resource_limit: true,
|
|
57
|
-
needs_review: true,
|
|
58
|
-
plan_review: true,
|
|
59
|
-
task_done: false,
|
|
60
|
-
};
|
|
61
|
-
export const LIVE_RUN_GATE_KINDS = Object.keys(GATE_KIND_IS_LIVE_RUN_PARK).filter((k) => GATE_KIND_IS_LIVE_RUN_PARK[k]);
|
|
62
|
-
export const TERMINAL_PARK_GATE_KINDS = Object.keys(GATE_KIND_IS_LIVE_RUN_PARK).filter((k) => !GATE_KIND_IS_LIVE_RUN_PARK[k]);
|
|
63
|
-
export function pendingRowPrecedes(a, b, pick) {
|
|
64
|
-
if (pick === "oldest")
|
|
65
|
-
return a.createdAt < b.createdAt || (a.createdAt === b.createdAt && a.token < b.token);
|
|
66
|
-
return a.createdAt > b.createdAt || (a.createdAt === b.createdAt && a.token > b.token);
|
|
67
|
-
}
|
|
68
48
|
export const CHECKPOINT_ADDED_COLUMNS = [
|
|
69
49
|
{
|
|
70
50
|
column: "has_bidi_controls",
|
|
@@ -99,53 +79,6 @@ export async function assertCheckpointColumnSchema(query, dialect) {
|
|
|
99
79
|
}
|
|
100
80
|
}
|
|
101
81
|
}
|
|
102
|
-
const MAX_RULE_OFFER_SCAN = 32;
|
|
103
|
-
function preboundBatchMembers(item) {
|
|
104
|
-
if (typeof item !== "object" || item === null)
|
|
105
|
-
return item;
|
|
106
|
-
const candidate = item;
|
|
107
|
-
if (candidate.kind !== "batch" || !Array.isArray(candidate.rules) || candidate.rules.length <= MAX_RULE_OFFER_BATCH_MEMBERS)
|
|
108
|
-
return item;
|
|
109
|
-
return { ...candidate, rules: candidate.rules.slice(0, MAX_RULE_OFFER_BATCH_MEMBERS) };
|
|
110
|
-
}
|
|
111
|
-
export function boundedReaderInput(raw) {
|
|
112
|
-
return Array.isArray(raw) ? raw.slice(0, MAX_RULE_OFFER_SCAN).map(preboundBatchMembers) : raw;
|
|
113
|
-
}
|
|
114
|
-
export function boundedRuleOffers(raw, opts = {}) {
|
|
115
|
-
const observe = opts.countRedactions ?? true;
|
|
116
|
-
const scrub = (text) => redactSecrets(text, { observe }).slice(0, MAX_RULE_TEXT_CHARS);
|
|
117
|
-
const read = readRuleOfferList(boundedReaderInput(raw));
|
|
118
|
-
const out = [];
|
|
119
|
-
for (const { offer } of read) {
|
|
120
|
-
if (out.length >= MAX_RULE_OFFERS)
|
|
121
|
-
break;
|
|
122
|
-
switch (offer.kind) {
|
|
123
|
-
case "single":
|
|
124
|
-
out.push({ kind: "single", rule: scrub(offer.rule), match: offer.match, command: scrub(offer.command) });
|
|
125
|
-
break;
|
|
126
|
-
case "batch":
|
|
127
|
-
out.push({
|
|
128
|
-
kind: "batch",
|
|
129
|
-
rules: offer.rules.slice(0, MAX_RULE_OFFER_BATCH_MEMBERS).map((r) => {
|
|
130
|
-
switch (r.kind) {
|
|
131
|
-
case "command":
|
|
132
|
-
return { kind: "command", rule: scrub(r.rule), match: r.match, command: scrub(r.command), segment: scrub(r.segment) };
|
|
133
|
-
case "directoryRead":
|
|
134
|
-
return { kind: "directoryRead", rule: scrub(r.rule), directory: scrub(r.directory), segment: scrub(r.segment) };
|
|
135
|
-
default:
|
|
136
|
-
throw new Error(`unknown rule-offer batch member kind: ${JSON.stringify(r)}`);
|
|
137
|
-
}
|
|
138
|
-
}),
|
|
139
|
-
uncoveredSegments: offer.uncoveredSegments,
|
|
140
|
-
...(offer.uncoveredDetail !== undefined ? { uncoveredDetail: offer.uncoveredDetail.map((d) => ({ segment: scrub(d.segment), reason: d.reason })) } : {}),
|
|
141
|
-
});
|
|
142
|
-
break;
|
|
143
|
-
default:
|
|
144
|
-
throw new Error(`unknown rule-offer kind: ${JSON.stringify(offer)}`);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return out.length > 0 ? out : undefined;
|
|
148
|
-
}
|
|
149
82
|
const readCheckpointBlobBody = createObjectColumnReader();
|
|
150
83
|
const readResumeOutcomeBody = createObjectColumnReader();
|
|
151
84
|
const readGateOutcomeBody = createObjectColumnReader();
|
|
@@ -156,6 +89,19 @@ function decodeCheckpointColumn(cell, where) {
|
|
|
156
89
|
function verdictOfUnreadableBody(cell) {
|
|
157
90
|
return judgeCheckpointRow(cell);
|
|
158
91
|
}
|
|
92
|
+
const UNREADABLE_SUMMARY_MEMBERS = new Set(["token", "rowVerdict", "sessionId", "scope", "gateKind", "createdAt", "deadline"]);
|
|
93
|
+
function isUnreadableSummaryForm(summary) {
|
|
94
|
+
const names = UNREADABLE_SUMMARY_MEMBERS;
|
|
95
|
+
return summary.rowVerdict.kind !== "ok" && Object.keys(summary).every((member) => names.has(member));
|
|
96
|
+
}
|
|
97
|
+
function readCheckpointBodyOrRefuse(cell, where) {
|
|
98
|
+
try {
|
|
99
|
+
return refusing("a checkpoint nobody can resume", () => decodeCheckpointColumn(cell, where));
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
throw e instanceof StoreCorruptError ? new UnreadableCheckpointRowError(e, verdictOfUnreadableBody(cell)) : e;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
159
105
|
function decodeOutcomeColumn(cell, where) {
|
|
160
106
|
return decodeNullableJsonColumn(cell, readResumeOutcomeBody, `checkpoint.outcome ${where}`);
|
|
161
107
|
}
|
|
@@ -228,80 +174,7 @@ function readCheckpointIdCell(cell) {
|
|
|
228
174
|
return null;
|
|
229
175
|
}
|
|
230
176
|
}
|
|
231
|
-
export function queueRowGateKind(kind) {
|
|
232
|
-
if (isGateKind(kind))
|
|
233
|
-
return kind;
|
|
234
|
-
recordFailOpen("server.approvals.queue-row-gate-kind-missing", `gate_kind=${kind === null || kind === undefined ? "NULL" : redactSecrets(String(kind)).slice(0, 40)}`);
|
|
235
|
-
return undefined;
|
|
236
|
-
}
|
|
237
177
|
const readPendingActionMemberBody = createObjectColumnReader();
|
|
238
|
-
export function boundedToolInput(args) {
|
|
239
|
-
if (args === undefined)
|
|
240
|
-
return null;
|
|
241
|
-
const redacted = redactDeep(args);
|
|
242
|
-
const json = JSON.stringify(redacted);
|
|
243
|
-
if (json === undefined)
|
|
244
|
-
return null;
|
|
245
|
-
if (json.length > MAX_TOOL_INPUT_CHARS)
|
|
246
|
-
return { truncated: true, bytes: json.length };
|
|
247
|
-
return redacted;
|
|
248
|
-
}
|
|
249
|
-
export const DECIDED_REPLAY_SCAN_CAP = 8;
|
|
250
|
-
export function approvalDecisionOfWinner(winner, boundCallId) {
|
|
251
|
-
if (winner === undefined)
|
|
252
|
-
return null;
|
|
253
|
-
if (winner.boundCallId !== boundCallId)
|
|
254
|
-
return null;
|
|
255
|
-
switch (winner.decision) {
|
|
256
|
-
case "allow":
|
|
257
|
-
return "approve";
|
|
258
|
-
case "deny":
|
|
259
|
-
return "deny";
|
|
260
|
-
case "approve":
|
|
261
|
-
case "reject":
|
|
262
|
-
case "edit":
|
|
263
|
-
return null;
|
|
264
|
-
default: {
|
|
265
|
-
const unhandled = winner.decision;
|
|
266
|
-
void unhandled;
|
|
267
|
-
return null;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
function pendingActionToolCallId(body) {
|
|
272
|
-
if (typeof body !== "object" || body === null)
|
|
273
|
-
return { readable: false };
|
|
274
|
-
if ("sourceTaskId" in body)
|
|
275
|
-
return { readable: false };
|
|
276
|
-
const rawSource = "sourceSessionId" in body ? body.sourceSessionId : null;
|
|
277
|
-
if (rawSource !== null && rawSource !== undefined && typeof rawSource !== "string")
|
|
278
|
-
return { readable: false };
|
|
279
|
-
const sourceSessionId = typeof rawSource === "string" ? rawSource : null;
|
|
280
|
-
if (!("pendingAction" in body))
|
|
281
|
-
return { readable: true, toolCallId: null, boundInputHash: null, kind: null, sourceSessionId };
|
|
282
|
-
const pa = body.pendingAction;
|
|
283
|
-
if (typeof pa !== "object" || pa === null)
|
|
284
|
-
return { readable: false };
|
|
285
|
-
const kind = "kind" in pa ? pa.kind : null;
|
|
286
|
-
if (kind !== null && typeof kind !== "string")
|
|
287
|
-
return { readable: false };
|
|
288
|
-
if (!("toolCallId" in pa))
|
|
289
|
-
return { readable: true, toolCallId: null, boundInputHash: null, kind, sourceSessionId };
|
|
290
|
-
const id = pa.toolCallId;
|
|
291
|
-
if (typeof id !== "string")
|
|
292
|
-
return { readable: false };
|
|
293
|
-
if (kind !== "tool_approval")
|
|
294
|
-
return { readable: false };
|
|
295
|
-
const bih = "boundInputHash" in pa ? pa.boundInputHash : null;
|
|
296
|
-
if (bih !== null && typeof bih !== "string")
|
|
297
|
-
return { readable: false };
|
|
298
|
-
return { readable: true, toolCallId: id, boundInputHash: bih, kind, sourceSessionId };
|
|
299
|
-
}
|
|
300
|
-
export function candidateIdentityOf(cp) {
|
|
301
|
-
if (judgeCheckpointRow(cp).kind === "lacking")
|
|
302
|
-
return { readable: false };
|
|
303
|
-
return pendingActionToolCallId(cp);
|
|
304
|
-
}
|
|
305
178
|
function candidateIdentityOfColumn(cell, where) {
|
|
306
179
|
let cp;
|
|
307
180
|
try {
|
|
@@ -314,39 +187,23 @@ function candidateIdentityOfColumn(cell, where) {
|
|
|
314
187
|
}
|
|
315
188
|
return candidateIdentityOf(cp);
|
|
316
189
|
}
|
|
317
|
-
function readActorAssertion(v) {
|
|
318
|
-
if (typeof v !== "object" || v === null)
|
|
319
|
-
return undefined;
|
|
320
|
-
const id = "id" in v ? v.id : undefined;
|
|
321
|
-
const hostAsserted = "hostAsserted" in v ? v.hostAsserted : undefined;
|
|
322
|
-
if (typeof id !== "string" || typeof hostAsserted !== "boolean")
|
|
323
|
-
return undefined;
|
|
324
|
-
const issuer = "issuer" in v ? v.issuer : undefined;
|
|
325
|
-
return { id, hostAsserted, ...(typeof issuer === "string" ? { issuer } : {}) };
|
|
326
|
-
}
|
|
327
190
|
function readQueueEntry(v) {
|
|
328
191
|
if (typeof v !== "object" || v === null)
|
|
329
192
|
return undefined;
|
|
330
|
-
const text = "text" in v ? v.text : undefined;
|
|
331
|
-
const trusted = "trusted" in v ? v.trusted : undefined;
|
|
332
193
|
const seq = "seq" in v ? v.seq : undefined;
|
|
333
|
-
const inputId = "inputId" in v ? v.inputId : undefined;
|
|
334
|
-
if (typeof text !== "string" || typeof trusted !== "boolean")
|
|
335
|
-
return undefined;
|
|
336
194
|
if (typeof seq !== "number" || !Number.isFinite(seq))
|
|
337
195
|
return undefined;
|
|
338
|
-
if (
|
|
196
|
+
if (!("inputId" in v) || v.inputId === undefined)
|
|
339
197
|
return undefined;
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
};
|
|
198
|
+
const carried = Object.fromEntries(Object.entries(v).filter(([key]) => key !== "seq"));
|
|
199
|
+
try {
|
|
200
|
+
return { ...validatePendingSteer(carried), seq };
|
|
201
|
+
}
|
|
202
|
+
catch (e) {
|
|
203
|
+
if (e instanceof CheckpointError && e.code === "steering.invalid_content")
|
|
204
|
+
return undefined;
|
|
205
|
+
throw e;
|
|
206
|
+
}
|
|
350
207
|
}
|
|
351
208
|
export function readPendingSteerQueueColumn(queueRaw) {
|
|
352
209
|
let lossy = false;
|
|
@@ -374,7 +231,6 @@ export function readPendingSteerQueueColumn(queueRaw) {
|
|
|
374
231
|
}
|
|
375
232
|
const STEER_CAS_ATTEMPTS = 8;
|
|
376
233
|
const EXECUTION_RECORD_CAS_ATTEMPTS = 8;
|
|
377
|
-
export const CTX_CLAIM_REWRITES = ["written", "claim_released", "context_absent"];
|
|
378
234
|
export class SqlCheckpointStore {
|
|
379
235
|
db;
|
|
380
236
|
logger;
|
|
@@ -477,7 +333,7 @@ export class SqlCheckpointStore {
|
|
|
477
333
|
const r = rows[0];
|
|
478
334
|
if (!r)
|
|
479
335
|
return null;
|
|
480
|
-
const cp =
|
|
336
|
+
const cp = readCheckpointBodyOrRefuse(r.checkpoint, `for token ${tokenFingerprint(token)}`);
|
|
481
337
|
cp.status = r.status;
|
|
482
338
|
const outcomeRaw = refusing("a decision record nobody can read", () => decodeOutcomeColumn(r.outcome, `for token ${tokenFingerprint(token)}`));
|
|
483
339
|
if (outcomeRaw)
|
|
@@ -679,13 +535,21 @@ export class SqlCheckpointStore {
|
|
|
679
535
|
return { rowVerdict: verdictOfUnreadableBody(r.checkpoint) };
|
|
680
536
|
}
|
|
681
537
|
let summary;
|
|
538
|
+
const disclosed = [];
|
|
682
539
|
try {
|
|
683
|
-
summary = summarizeCheckpoint(cp,
|
|
540
|
+
summary = summarizeCheckpoint(cp, (sentence) => disclosed.push(sentence), memo?.rowVerdict);
|
|
684
541
|
}
|
|
685
542
|
catch {
|
|
686
543
|
recordFailOpen("server.approvals.park-row-blob-unreadable");
|
|
687
544
|
return { rowVerdict: judgeCheckpointRow(cp) };
|
|
688
545
|
}
|
|
546
|
+
if (isUnreadableSummaryForm(summary)) {
|
|
547
|
+
recordFailOpen("server.approvals.park-row-blob-unreadable");
|
|
548
|
+
return { rowVerdict: summary.rowVerdict };
|
|
549
|
+
}
|
|
550
|
+
const seat = discloseFor?.(cp);
|
|
551
|
+
for (const sentence of disclosed)
|
|
552
|
+
seat?.(sentence);
|
|
689
553
|
if (memo === undefined)
|
|
690
554
|
this.storedRowMemo.set(sha256, { rowVerdict: summary.rowVerdict, skillCardFacts: skillCardFacts(summary) });
|
|
691
555
|
return { rowVerdict: summary.rowVerdict, summary };
|
|
@@ -894,47 +758,6 @@ export class SqlCheckpointStore {
|
|
|
894
758
|
}
|
|
895
759
|
return out;
|
|
896
760
|
}
|
|
897
|
-
async scanKindlessBatchRows() {
|
|
898
|
-
const out = [];
|
|
899
|
-
let unreadableCells = 0;
|
|
900
|
-
const tolerant = (read) => {
|
|
901
|
-
try {
|
|
902
|
-
return read();
|
|
903
|
-
}
|
|
904
|
-
catch (e) {
|
|
905
|
-
if (!isJsonColumnBodyProblem(e))
|
|
906
|
-
throw e;
|
|
907
|
-
unreadableCells += 1;
|
|
908
|
-
return undefined;
|
|
909
|
-
}
|
|
910
|
-
};
|
|
911
|
-
const prefilter = (d) => `(rule_suggestions IS NOT NULL OR ${jsonColumnTextExpr(d, "checkpoint", PARK_ROW_PENDING_ACTION.key)} LIKE '%"batch"%')`;
|
|
912
|
-
let after = "";
|
|
913
|
-
for (;;) {
|
|
914
|
-
const { rows } = await this.db.query(this.q(`SELECT token, ${jsonColumnText("mysql", "rule_suggestions")}, ${jsonColumnText("mysql", "checkpoint", PARK_ROW_PENDING_ACTION)} FROM checkpoint WHERE token > ? AND ${prefilter("mysql")} ORDER BY token LIMIT ${KINDLESS_SCAN_PAGE}`, `SELECT token, ${jsonColumnText("pg", "rule_suggestions")}, ${jsonColumnText("pg", "checkpoint", PARK_ROW_PENDING_ACTION)} FROM checkpoint WHERE token > $1 AND ${prefilter("pg")} ORDER BY token LIMIT ${KINDLESS_SCAN_PAGE}`), [after]);
|
|
915
|
-
for (const row of rows) {
|
|
916
|
-
const token = String(row.token);
|
|
917
|
-
after = token;
|
|
918
|
-
const carriers = [];
|
|
919
|
-
const column = tolerant(() => decodeNullableJsonColumn(row.rule_suggestions, readJsonArrayColumn, "checkpoint.rule_suggestions (kind-less batch census)"));
|
|
920
|
-
if (countKindlessBatchOffers(boundedReaderInput(column)) > 0)
|
|
921
|
-
carriers.push("rule_suggestions");
|
|
922
|
-
const pendingAction = tolerant(() => decodeNullableJsonColumn(row[PARK_ROW_PENDING_ACTION.as], readJsonObjectColumn, "checkpoint.checkpoint pendingAction member (kind-less batch census)"));
|
|
923
|
-
if (typeof pendingAction === "object" && pendingAction !== null) {
|
|
924
|
-
const blobOffers = Reflect.get(pendingAction, "ruleOffers");
|
|
925
|
-
if (blobOffers !== undefined && !Array.isArray(blobOffers))
|
|
926
|
-
unreadableCells += 1;
|
|
927
|
-
else if (countKindlessBatchOffers(blobOffers) > 0)
|
|
928
|
-
carriers.push("pendingAction.ruleOffers");
|
|
929
|
-
}
|
|
930
|
-
if (carriers.length > 0)
|
|
931
|
-
out.push({ ref: tokenFingerprint(token), carriers });
|
|
932
|
-
}
|
|
933
|
-
if (rows.length < KINDLESS_SCAN_PAGE)
|
|
934
|
-
break;
|
|
935
|
-
}
|
|
936
|
-
return { rows: out, unreadableCells };
|
|
937
|
-
}
|
|
938
761
|
async reapCtx(cutoff) {
|
|
939
762
|
const res = await this.db.query(this.q("DELETE FROM checkpoint_ctx WHERE updated_at_ms < ? " +
|
|
940
763
|
"AND session_id NOT IN (SELECT session_id FROM checkpoint WHERE status='pending') " +
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Pool as MySqlPool } from "mysql2/promise";
|
|
2
2
|
import type { Pool as PgPool } from "pg";
|
|
3
3
|
import { type FileHistoryRetentionPolicy, type ExecutionEnv, type FileHistoryStore, type FileHistoryResult, type FileHistoryTrackResult, type FileHistoryRestoreResult, type FileHistoryExport, type FileHistoryExportResult } from "@sema-agent/core";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
4
|
+
import type { BlobBackend } from "../plugins/blob-backend.js";
|
|
5
|
+
import { SqlBlobIndex } from "./blob-index-sql.js";
|
|
6
|
+
import type { ServiceBlobExchange } from "../plugins/store-backend.js";
|
|
7
|
+
import { type SqlDriver, type SqlDialect } from "../plugins/sql-driver.js";
|
|
8
|
+
/** The file-history blob domain's SQL table (this store's blob index + the A7 assert). */
|
|
8
9
|
export declare const FILE_HISTORY_BLOB_TABLE = "file_history_blob";
|
|
9
10
|
/** MinIO object-key prefix for this domain (snapshot epoch used "blobs/"; a separate prefix keeps the
|
|
10
11
|
* two domains' objects disjoint so neither sweep can see the other's keys). */
|
|
@@ -17,18 +18,29 @@ export declare const FILE_HISTORY_BLOB_KEY_PREFIX = "file-history/";
|
|
|
17
18
|
*/
|
|
18
19
|
export interface SqlFileHistoryStoreOptions {
|
|
19
20
|
retention?: FileHistoryRetentionPolicy;
|
|
21
|
+
/** Where the blob bytes go — the shape of the engine package's `fileHistory.blobs`: absent ⇒ in this store's own
|
|
22
|
+
* `file_history_blob` rows (SQL, capped per blob); a byte port ⇒ the port holds them and the rows keep bytes NULL. */
|
|
23
|
+
blobs?: BlobBackend;
|
|
24
|
+
/** The operator's explicit per-blob cap for SQL-kept bytes (`SNAPSHOT_BLOB_SQL_MAX_BYTES`); absent ⇒ derived from the walls of
|
|
25
|
+
* the connection that writes. Not read with a byte port. */
|
|
26
|
+
blobSqlMaxBytes?: number;
|
|
27
|
+
/** Where a stale connection's replacement on an SQL-kept blob write is logged. */
|
|
28
|
+
log?: {
|
|
29
|
+
warn(msg: string, meta?: Record<string, unknown>): void;
|
|
30
|
+
};
|
|
20
31
|
}
|
|
21
32
|
/** Dual-dialect durable FileHistoryStore. See the file header for posture + dialect-delta ledger. */
|
|
22
33
|
export declare class SqlFileHistoryStore implements FileHistoryStore {
|
|
23
34
|
protected readonly db: SqlDriver;
|
|
24
|
-
/** RAW native pool — handed to blob-
|
|
35
|
+
/** RAW native pool — handed to the blob index (`blob-index-sql.ts`, outside the SqlDriver seam, dialect-switches on
|
|
25
36
|
* its own string). Not used for this class's own statements (those go through `db`). */
|
|
26
37
|
protected readonly pool: MySqlPool | PgPool;
|
|
27
38
|
/** The blob exchange (core's `FileHistoryStore.blobExchange` group, see {@link ServiceBlobExchange}): how another machine's bytes
|
|
28
39
|
* come in ahead of an `importHistory`, go out to a puller, and are asked about. Its presence IS the capability — read through
|
|
29
40
|
* `blobExchangeOf` (`session-sync.ts`), which defers to core's judge; there is no second word for it on this class. */
|
|
30
41
|
readonly blobExchange: ServiceBlobExchange;
|
|
31
|
-
|
|
42
|
+
/** This store's blob index (the `file_history_blob` rows; the byte port, when given, behind it). */
|
|
43
|
+
protected readonly blobs: SqlBlobIndex;
|
|
32
44
|
/** §10 S-6 in-process lease state (design v1 D2: NOT persisted). Keys = `${scope}\x00${entryId}`. */
|
|
33
45
|
private readonly spentAttempts;
|
|
34
46
|
private readonly activeAttempts;
|
|
@@ -36,9 +48,9 @@ export declare class SqlFileHistoryStore implements FileHistoryStore {
|
|
|
36
48
|
* 由 core 的 `resolveFileHistoryRetention` 在构造期裁定 —— 与两只内置后端同一道门、同一句拒绝。 */
|
|
37
49
|
private readonly boundaryKeep;
|
|
38
50
|
constructor(db: SqlDriver,
|
|
39
|
-
/** RAW native pool — handed to blob-
|
|
51
|
+
/** RAW native pool — handed to the blob index (`blob-index-sql.ts`, outside the SqlDriver seam, dialect-switches on
|
|
40
52
|
* its own string). Not used for this class's own statements (those go through `db`). */
|
|
41
|
-
pool: MySqlPool | PgPool,
|
|
53
|
+
pool: MySqlPool | PgPool, opts?: SqlFileHistoryStoreOptions);
|
|
42
54
|
/** Pick the dialect's SQL text. Both statements stay written out at the call site ON PURPOSE. */
|
|
43
55
|
private q;
|
|
44
56
|
private bool;
|
|
@@ -174,18 +186,18 @@ export declare class SqlFileHistoryStore implements FileHistoryStore {
|
|
|
174
186
|
/**
|
|
175
187
|
* Fetch + content-address verify EVERY blob the envelope references from the source, one at a time (memory bounded by one blob) —— 首推与同图重推共用的**唯一**取值校验;
|
|
176
188
|
* 任何一枚取不出 / 核不过 ⇒ 整信封典型拒,什么都不发布。`onVerified` = 校验过的这一枚拿来做什么:首推传「续租式 upsert」(delete-in-use 租约 —— 发布前的孤儿清扫不许收走
|
|
177
|
-
* 这次导入正要引用的字节);同图重推不传 —— 已发布的图的版本行本身就是引用,租约无事可护,而回写会把每只对象重传一遍(
|
|
189
|
+
* 这次导入正要引用的字节);同图重推不传 —— 已发布的图的版本行本身就是引用,租约无事可护,而回写会把每只对象重传一遍(对象存储字节口的 `put` 是整体 PUT)。
|
|
178
190
|
*/
|
|
179
191
|
private verifySourceBlobs;
|
|
180
192
|
importHistory(scope: string, data: FileHistoryExport, srcGetBlob: (hash: string) => Promise<Uint8Array | undefined>): Promise<FileHistoryResult>;
|
|
181
193
|
}
|
|
182
194
|
/** MySQL-protocol (TiDB) binding. */
|
|
183
195
|
export declare class TiDBFileHistoryStore extends SqlFileHistoryStore {
|
|
184
|
-
constructor(pool: MySqlPool,
|
|
196
|
+
constructor(pool: MySqlPool, opts?: SqlFileHistoryStoreOptions);
|
|
185
197
|
}
|
|
186
198
|
/** PostgreSQL binding. */
|
|
187
199
|
export declare class PgFileHistoryStore extends SqlFileHistoryStore {
|
|
188
|
-
constructor(pool: PgPool,
|
|
200
|
+
constructor(pool: PgPool, opts?: SqlFileHistoryStoreOptions);
|
|
189
201
|
}
|
|
190
202
|
/**
|
|
191
203
|
* [ref] D1② — A7-recipe upgrade precondition assert (**refuse to start**, never a warn; the form and
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { captureFileBackupViaEnv, applyFileRestoreViaEnv, fileHistoryModeProvenDifferent, worldStillMatchesMint, annulProofFailure, boundaryPublishVerdict, fileHistoryDescribeTrackKey, fileHistoryTrackKeyOf, fileHistoryResolveTrackKey, fileHistoryExportDigest, validateFileHistoryExport, resolveFileHistoryRetention, fileHistoryBoundariesToKeep, } from "@sema-agent/core";
|
|
3
|
-
import { BlobTooLargeError,
|
|
4
|
-
import { mysqlDriver, pgDriver } from "
|
|
5
|
-
import { isMissingColumnError, retryOnDeadlock } from "
|
|
6
|
-
import { describeProbedTableDrift } from "
|
|
3
|
+
import { BlobTooLargeError, SqlBlobIndex } from "./blob-index-sql.js";
|
|
4
|
+
import { mysqlDriver, pgDriver } from "../plugins/sql-driver.js";
|
|
5
|
+
import { isMissingColumnError, retryOnDeadlock } from "../plugins/sql-errors.js";
|
|
6
|
+
import { describeProbedTableDrift } from "../plugins/schema-drift-sentence.js";
|
|
7
7
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
8
8
|
import { foldCaughtFailure } from "../file-history-disclosure.js";
|
|
9
9
|
export const FILE_HISTORY_BLOB_TABLE = "file_history_blob";
|
|
@@ -28,17 +28,22 @@ export class SqlFileHistoryStore {
|
|
|
28
28
|
pool;
|
|
29
29
|
blobExchange = {
|
|
30
30
|
put: (hash, bytes) => this.putExchangedBlob(hash, bytes),
|
|
31
|
-
get: (hash) => this.blobs.
|
|
32
|
-
has: (hashes) => this.blobs.
|
|
31
|
+
get: (hash) => this.blobs.get(hash),
|
|
32
|
+
has: (hashes) => this.blobs.has([...hashes]),
|
|
33
33
|
};
|
|
34
34
|
blobs;
|
|
35
35
|
spentAttempts = new Set();
|
|
36
36
|
activeAttempts = new Set();
|
|
37
37
|
boundaryKeep;
|
|
38
|
-
constructor(db, pool,
|
|
38
|
+
constructor(db, pool, opts) {
|
|
39
39
|
this.db = db;
|
|
40
40
|
this.pool = pool;
|
|
41
|
-
this.blobs =
|
|
41
|
+
this.blobs = new SqlBlobIndex(this.db.dialect, this.pool, {
|
|
42
|
+
table: FILE_HISTORY_BLOB_TABLE,
|
|
43
|
+
...(opts?.blobs !== undefined ? { bytes: opts.blobs } : {}),
|
|
44
|
+
...(opts?.blobSqlMaxBytes !== undefined ? { maxBytes: opts.blobSqlMaxBytes } : {}),
|
|
45
|
+
...(opts?.log !== undefined ? { log: opts.log } : {}),
|
|
46
|
+
});
|
|
42
47
|
this.boundaryKeep = resolveFileHistoryRetention(this.db.dialect === "mysql" ? "TiDBFileHistoryStore" : "PgFileHistoryStore", opts?.retention);
|
|
43
48
|
}
|
|
44
49
|
q(mysql, pg) {
|
|
@@ -95,7 +100,7 @@ export class SqlFileHistoryStore {
|
|
|
95
100
|
const baseAvailable = cap.state !== "unreadable";
|
|
96
101
|
let v1;
|
|
97
102
|
if (cap.state === "file") {
|
|
98
|
-
await this.blobs.
|
|
103
|
+
await this.blobs.put(cap.hash, cap.bytes);
|
|
99
104
|
v1 = { blobHash: cap.hash, ...(cap.mode !== undefined ? { mode: cap.mode } : {}), ...(cap.parentIdent !== undefined ? { parentIdent: cap.parentIdent } : {}) };
|
|
100
105
|
}
|
|
101
106
|
else if (cap.state === "absent") {
|
|
@@ -344,7 +349,7 @@ export class SqlFileHistoryStore {
|
|
|
344
349
|
staged.set(t.keyHash, { kind: "unchanged", version: last.version });
|
|
345
350
|
continue;
|
|
346
351
|
}
|
|
347
|
-
await this.blobs.
|
|
352
|
+
await this.blobs.put(cap.hash, cap.bytes);
|
|
348
353
|
staged.set(t.keyHash, { kind: "changed", blobHash: cap.hash, ...(cap.mode !== undefined ? { mode: cap.mode } : {}), ...(cap.parentIdent !== undefined ? { parentIdent: cap.parentIdent } : {}) });
|
|
349
354
|
}
|
|
350
355
|
const verdict = boundaryPublishVerdict({ aborted: signal?.aborted === true });
|
|
@@ -471,7 +476,7 @@ export class SqlFileHistoryStore {
|
|
|
471
476
|
if (rec.blobHash === null)
|
|
472
477
|
target = { absent: true };
|
|
473
478
|
else {
|
|
474
|
-
const bytes = await this.blobs.
|
|
479
|
+
const bytes = await this.blobs.get(rec.blobHash);
|
|
475
480
|
if (bytes === undefined) {
|
|
476
481
|
ledger.failed.push({ path: t.trackKey, reason: `blob ${rec.blobHash} missing (store integrity)` });
|
|
477
482
|
continue;
|
|
@@ -594,14 +599,14 @@ export class SqlFileHistoryStore {
|
|
|
594
599
|
const orphans = rows.map((r) => String(r.blob_hash));
|
|
595
600
|
if (orphans.length === 0)
|
|
596
601
|
return 0;
|
|
597
|
-
return this.blobs.
|
|
602
|
+
return this.blobs.sweep(orphans);
|
|
598
603
|
}
|
|
599
604
|
async putExchangedBlob(hash, bytes) {
|
|
600
605
|
if (sha256hex(bytes) !== hash) {
|
|
601
606
|
return { ok: false, error: { code: "adopt_failed", message: `blob ${hash}: the bytes do not hash to this address — nothing stored`, permanence: "terminal" } };
|
|
602
607
|
}
|
|
603
608
|
try {
|
|
604
|
-
await this.blobs.
|
|
609
|
+
await this.blobs.put(hash, bytes);
|
|
605
610
|
return { ok: true };
|
|
606
611
|
}
|
|
607
612
|
catch (err) {
|
|
@@ -760,7 +765,7 @@ export class SqlFileHistoryStore {
|
|
|
760
765
|
if (existing !== null && !sameGraph) {
|
|
761
766
|
return { ok: false, error: { code: "conflict", message: `importHistory target "${scope}" already holds a DIFFERENT history — a first import requires an empty target and a retry is legal only for the identical envelope (atomic visibility prevents half-graphs; this law prevents publishing the wrong complete graph over locally-grown history)` } };
|
|
762
767
|
}
|
|
763
|
-
const verified = await this.verifySourceBlobs(data, srcGetBlob, sameGraph ? undefined : (hash, bytes) => this.blobs.
|
|
768
|
+
const verified = await this.verifySourceBlobs(data, srcGetBlob, sameGraph ? undefined : (hash, bytes) => this.blobs.put(hash, bytes));
|
|
764
769
|
if (!verified.ok)
|
|
765
770
|
return verified;
|
|
766
771
|
if (sameGraph)
|
|
@@ -813,13 +818,13 @@ export class SqlFileHistoryStore {
|
|
|
813
818
|
}
|
|
814
819
|
}
|
|
815
820
|
export class TiDBFileHistoryStore extends SqlFileHistoryStore {
|
|
816
|
-
constructor(pool,
|
|
817
|
-
super(mysqlDriver(pool), pool,
|
|
821
|
+
constructor(pool, opts) {
|
|
822
|
+
super(mysqlDriver(pool), pool, opts);
|
|
818
823
|
}
|
|
819
824
|
}
|
|
820
825
|
export class PgFileHistoryStore extends SqlFileHistoryStore {
|
|
821
|
-
constructor(pool,
|
|
822
|
-
super(pgDriver(pool), pool,
|
|
826
|
+
constructor(pool, opts) {
|
|
827
|
+
super(pgDriver(pool), pool, opts);
|
|
823
828
|
}
|
|
824
829
|
}
|
|
825
830
|
export async function assertFileHistorySchema(query, dialect) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Pool as MySqlPool } from "mysql2/promise";
|
|
2
2
|
import type { Pool as PgPool } from "pg";
|
|
3
3
|
import type { MailboxAckResult, MailboxAppendMessage, MailboxDecision, MailboxDecisionOutcome, MailboxLease, MailboxRecipientTombstone, MailboxStore } from "@sema-agent/core";
|
|
4
|
-
import { type IndexSpec } from "
|
|
5
|
-
import type { SqlDialect } from "
|
|
4
|
+
import { type IndexSpec } from "../plugins/ensure-index.js";
|
|
5
|
+
import type { SqlDialect } from "../plugins/sql-driver.js";
|
|
6
6
|
export declare const MAILBOX_TABLE = "mailbox";
|
|
7
7
|
export declare const MAILBOX_MSG_TABLE = "mailbox_message";
|
|
8
8
|
/** [ref] 收件人墓碑表(预删除态的**唯一**真源;形与理由见 `mailbox-recipient-lifecycle.ts` 模块头)。
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { isUtf8 } from "node:buffer";
|
|
2
2
|
import { MAILBOX_CONSUMED_ID_WINDOW, MAILBOX_INVALID_PEER_META_CODE, MAILBOX_RECORD_ID_MAX_CHARS, MAILBOX_REPLAY_FACETS, MAILBOX_TOMBSTONED_RECIPIENT_CODE, MailboxStoreError, assertMailboxDecisionMove, judgeMailboxAppendById, mailboxReplayDigests, readMailboxAppend, readMailboxPeerMeta, readStoredMailboxDecision } from "@sema-agent/core";
|
|
3
|
-
import { pgHasUnstorable, pgSanitizeText, PgUnstorableError } from "
|
|
3
|
+
import { pgHasUnstorable, pgSanitizeText, PgUnstorableError } from "../plugins/pg-safe-json.js";
|
|
4
4
|
import { isWellFormedUnicode } from "../principal-jwt.js";
|
|
5
|
-
import { ensureIndexes } from "
|
|
6
|
-
import { escapeLike } from "
|
|
7
|
-
import { SqlJsonColumnError, decodeJsonColumn, decodeNullableJsonColumn, foldJsonColumn, isJsonColumnBodyProblem, jsonColumnText, readStringArrayColumn } from "
|
|
5
|
+
import { ensureIndexes } from "../plugins/ensure-index.js";
|
|
6
|
+
import { escapeLike } from "../plugins/sql-escape.js";
|
|
7
|
+
import { SqlJsonColumnError, decodeJsonColumn, decodeNullableJsonColumn, foldJsonColumn, isJsonColumnBodyProblem, jsonColumnText, readStringArrayColumn } from "../plugins/sql-json-column.js";
|
|
8
8
|
export const MAILBOX_TABLE = "mailbox";
|
|
9
9
|
export const MAILBOX_MSG_TABLE = "mailbox_message";
|
|
10
10
|
export const MAILBOX_TOMBSTONE_TABLE = "mailbox_tombstone";
|