@claudexor/daemon 3.25.1 → 4.0.1
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/dist/account-resets.d.ts +2 -2
- package/dist/account-resets.d.ts.map +1 -1
- package/dist/account-resets.js +15 -0
- package/dist/account-resets.js.map +1 -1
- package/dist/client.d.ts +25 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +55 -51
- package/dist/client.js.map +1 -1
- package/dist/command-authority.d.ts +11 -8
- package/dist/command-authority.d.ts.map +1 -1
- package/dist/command-authority.js +5 -6
- package/dist/command-authority.js.map +1 -1
- package/dist/command-list-projection.d.ts +0 -1
- package/dist/command-list-projection.d.ts.map +1 -1
- package/dist/command-list-projection.js +0 -6
- package/dist/command-list-projection.js.map +1 -1
- package/dist/command-list-select.d.ts +0 -4
- package/dist/command-list-select.d.ts.map +1 -1
- package/dist/command-list-select.js +1 -115
- package/dist/command-list-select.js.map +1 -1
- package/dist/command-retention.d.ts +7 -19
- package/dist/command-retention.d.ts.map +1 -1
- package/dist/command-retention.js +1 -120
- package/dist/command-retention.js.map +1 -1
- package/dist/command-rpc.d.ts +4 -1
- package/dist/command-rpc.d.ts.map +1 -1
- package/dist/command-rpc.js +12 -1
- package/dist/command-rpc.js.map +1 -1
- package/dist/command-store.d.ts +15 -52
- package/dist/command-store.d.ts.map +1 -1
- package/dist/command-store.js +5 -493
- package/dist/command-store.js.map +1 -1
- package/dist/daemon-health.d.ts +56 -8
- package/dist/daemon-health.d.ts.map +1 -1
- package/dist/daemon-health.js +44 -9
- package/dist/daemon-health.js.map +1 -1
- package/dist/daemon-local-client.d.ts +28 -0
- package/dist/daemon-local-client.d.ts.map +1 -0
- package/dist/daemon-local-client.js +55 -0
- package/dist/daemon-local-client.js.map +1 -0
- package/dist/delivery-command.d.ts +4 -4
- package/dist/delivery-command.d.ts.map +1 -1
- package/dist/delivery-command.js.map +1 -1
- package/dist/index.d.ts +23 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -8
- package/dist/index.js.map +1 -1
- package/dist/interactions.d.ts +12 -28
- package/dist/interactions.d.ts.map +1 -1
- package/dist/interactions.js +22 -123
- package/dist/interactions.js.map +1 -1
- package/dist/job-admission.d.ts +26 -0
- package/dist/job-admission.d.ts.map +1 -0
- package/dist/job-admission.js +67 -0
- package/dist/job-admission.js.map +1 -0
- package/dist/journal-fold-policy.d.ts +1 -1
- package/dist/journal-fold-policy.d.ts.map +1 -1
- package/dist/journal-recovery-files.d.ts +1 -41
- package/dist/journal-recovery-files.d.ts.map +1 -1
- package/dist/journal-recovery-files.js +2 -340
- package/dist/journal-recovery-files.js.map +1 -1
- package/dist/loop-facts.d.ts +28 -0
- package/dist/loop-facts.d.ts.map +1 -0
- package/dist/loop-facts.js +97 -0
- package/dist/loop-facts.js.map +1 -0
- package/dist/memory-facts.d.ts +2 -0
- package/dist/memory-facts.d.ts.map +1 -1
- package/dist/memory-facts.js +5 -0
- package/dist/memory-facts.js.map +1 -1
- package/dist/model-operations.d.ts +11 -4
- package/dist/model-operations.d.ts.map +1 -1
- package/dist/model-operations.js +68 -38
- package/dist/model-operations.js.map +1 -1
- package/dist/operator-decisions.d.ts +15 -25
- package/dist/operator-decisions.d.ts.map +1 -1
- package/dist/operator-decisions.js +5 -84
- package/dist/operator-decisions.js.map +1 -1
- package/dist/projects.d.ts +42 -41
- package/dist/projects.d.ts.map +1 -1
- package/dist/projects.js +46 -184
- package/dist/projects.js.map +1 -1
- package/dist/quota-registry-replay.d.ts +2 -2
- package/dist/quota-registry-replay.d.ts.map +1 -1
- package/dist/quota-registry-replay.js.map +1 -1
- package/dist/quota-registry-support.d.ts +4 -1
- package/dist/quota-registry-support.d.ts.map +1 -1
- package/dist/quota-registry-support.js +15 -2
- package/dist/quota-registry-support.js.map +1 -1
- package/dist/quota-registry.d.ts +64 -2
- package/dist/quota-registry.d.ts.map +1 -1
- package/dist/quota-registry.js +10 -3
- package/dist/quota-registry.js.map +1 -1
- package/dist/quota-resources.d.ts +6 -3
- package/dist/quota-resources.d.ts.map +1 -1
- package/dist/quota-resources.js +25 -8
- package/dist/quota-resources.js.map +1 -1
- package/dist/runless-turn-recovery.d.ts +2 -9
- package/dist/runless-turn-recovery.d.ts.map +1 -1
- package/dist/runless-turn-recovery.js +0 -14
- package/dist/runless-turn-recovery.js.map +1 -1
- package/dist/server.d.ts +23 -22
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +74 -84
- package/dist/server.js.map +1 -1
- package/dist/store/blob-files.d.ts +71 -0
- package/dist/store/blob-files.d.ts.map +1 -0
- package/dist/store/blob-files.js +160 -0
- package/dist/store/blob-files.js.map +1 -0
- package/dist/store/command-prune.d.ts +37 -0
- package/dist/store/command-prune.d.ts.map +1 -0
- package/dist/store/command-prune.js +123 -0
- package/dist/store/command-prune.js.map +1 -0
- package/dist/store/command-queries.d.ts +41 -0
- package/dist/store/command-queries.d.ts.map +1 -0
- package/dist/store/command-queries.js +186 -0
- package/dist/store/command-queries.js.map +1 -0
- package/dist/store/command-rows.d.ts +66 -0
- package/dist/store/command-rows.d.ts.map +1 -0
- package/dist/store/command-rows.js +141 -0
- package/dist/store/command-rows.js.map +1 -0
- package/dist/store/commands.d.ts +49 -0
- package/dist/store/commands.d.ts.map +1 -0
- package/dist/store/commands.js +247 -0
- package/dist/store/commands.js.map +1 -0
- package/dist/store/cursors.d.ts +33 -0
- package/dist/store/cursors.d.ts.map +1 -0
- package/dist/store/cursors.js +82 -0
- package/dist/store/cursors.js.map +1 -0
- package/dist/store/engine-recovery-files.d.ts +14 -0
- package/dist/store/engine-recovery-files.d.ts.map +1 -0
- package/dist/store/engine-recovery-files.js +53 -0
- package/dist/store/engine-recovery-files.js.map +1 -0
- package/dist/store/engine-state-recovery.d.ts +71 -0
- package/dist/store/engine-state-recovery.d.ts.map +1 -0
- package/dist/store/engine-state-recovery.js +318 -0
- package/dist/store/engine-state-recovery.js.map +1 -0
- package/dist/store/errors.d.ts +80 -0
- package/dist/store/errors.d.ts.map +1 -0
- package/dist/store/errors.js +130 -0
- package/dist/store/errors.js.map +1 -0
- package/dist/store/event-store.d.ts +52 -0
- package/dist/store/event-store.d.ts.map +1 -0
- package/dist/store/event-store.js +117 -0
- package/dist/store/event-store.js.map +1 -0
- package/dist/store/external-files.d.ts +40 -0
- package/dist/store/external-files.d.ts.map +1 -0
- package/dist/store/external-files.js +90 -0
- package/dist/store/external-files.js.map +1 -0
- package/dist/store/flusher-protocol.d.ts +82 -0
- package/dist/store/flusher-protocol.d.ts.map +1 -0
- package/dist/store/flusher-protocol.js +23 -0
- package/dist/store/flusher-protocol.js.map +1 -0
- package/dist/store/flusher-worker.d.ts +24 -0
- package/dist/store/flusher-worker.d.ts.map +1 -0
- package/dist/store/flusher-worker.js +185 -0
- package/dist/store/flusher-worker.js.map +1 -0
- package/dist/store/flusher.d.ts +87 -0
- package/dist/store/flusher.d.ts.map +1 -0
- package/dist/store/flusher.js +264 -0
- package/dist/store/flusher.js.map +1 -0
- package/dist/store/generations.d.ts +43 -0
- package/dist/store/generations.d.ts.map +1 -0
- package/dist/store/generations.js +143 -0
- package/dist/store/generations.js.map +1 -0
- package/dist/store/idempotency.d.ts +25 -0
- package/dist/store/idempotency.d.ts.map +1 -0
- package/dist/store/idempotency.js +53 -0
- package/dist/store/idempotency.js.map +1 -0
- package/dist/store/import-context.d.ts +22 -0
- package/dist/store/import-context.d.ts.map +1 -0
- package/dist/store/import-context.js +87 -0
- package/dist/store/import-context.js.map +1 -0
- package/dist/store/import-discovery.d.ts +6 -0
- package/dist/store/import-discovery.d.ts.map +1 -0
- package/dist/store/import-discovery.js +66 -0
- package/dist/store/import-discovery.js.map +1 -0
- package/dist/store/import-records.d.ts +6 -0
- package/dist/store/import-records.d.ts.map +1 -0
- package/dist/store/import-records.js +191 -0
- package/dist/store/import-records.js.map +1 -0
- package/dist/store/import-resources.d.ts +14 -0
- package/dist/store/import-resources.d.ts.map +1 -0
- package/dist/store/import-resources.js +197 -0
- package/dist/store/import-resources.js.map +1 -0
- package/dist/store/import-source.d.ts +24 -0
- package/dist/store/import-source.d.ts.map +1 -0
- package/dist/store/import-source.js +65 -0
- package/dist/store/import-source.js.map +1 -0
- package/dist/store/import-verify.d.ts +6 -0
- package/dist/store/import-verify.d.ts.map +1 -0
- package/dist/store/import-verify.js +97 -0
- package/dist/store/import-verify.js.map +1 -0
- package/dist/store/import-worker.d.ts +18 -0
- package/dist/store/import-worker.d.ts.map +1 -0
- package/dist/store/import-worker.js +69 -0
- package/dist/store/import-worker.js.map +1 -0
- package/dist/store/importer.d.ts +42 -0
- package/dist/store/importer.d.ts.map +1 -0
- package/dist/store/importer.js +239 -0
- package/dist/store/importer.js.map +1 -0
- package/dist/store/interactions.d.ts +22 -0
- package/dist/store/interactions.d.ts.map +1 -0
- package/dist/store/interactions.js +82 -0
- package/dist/store/interactions.js.map +1 -0
- package/dist/store/legacy-journal/frame-codec.d.ts +94 -0
- package/dist/store/legacy-journal/frame-codec.d.ts.map +1 -0
- package/dist/store/legacy-journal/frame-codec.js +352 -0
- package/dist/store/legacy-journal/frame-codec.js.map +1 -0
- package/dist/store/legacy-journal/frame-reader.d.ts +30 -0
- package/dist/store/legacy-journal/frame-reader.d.ts.map +1 -0
- package/dist/store/legacy-journal/frame-reader.js +97 -0
- package/dist/store/legacy-journal/frame-reader.js.map +1 -0
- package/dist/store/legacy-journal/journal-fold.d.ts +47 -0
- package/dist/store/legacy-journal/journal-fold.d.ts.map +1 -0
- package/dist/store/legacy-journal/journal-fold.js +81 -0
- package/dist/store/legacy-journal/journal-fold.js.map +1 -0
- package/dist/store/legacy-journal/journal-partition.d.ts +2 -0
- package/dist/store/legacy-journal/journal-partition.d.ts.map +1 -0
- package/dist/store/legacy-journal/journal-partition.js +10 -0
- package/dist/store/legacy-journal/journal-partition.js.map +1 -0
- package/dist/store/legacy-journal/read-only-preparation.d.ts +48 -0
- package/dist/store/legacy-journal/read-only-preparation.d.ts.map +1 -0
- package/dist/store/legacy-journal/read-only-preparation.js +430 -0
- package/dist/store/legacy-journal/read-only-preparation.js.map +1 -0
- package/dist/store/maintenance-worker.d.ts +5 -0
- package/dist/store/maintenance-worker.d.ts.map +1 -0
- package/dist/store/maintenance-worker.js +175 -0
- package/dist/store/maintenance-worker.js.map +1 -0
- package/dist/store/maintenance.d.ts +124 -0
- package/dist/store/maintenance.d.ts.map +1 -0
- package/dist/store/maintenance.js +197 -0
- package/dist/store/maintenance.js.map +1 -0
- package/dist/store/mutation.d.ts +34 -0
- package/dist/store/mutation.d.ts.map +1 -0
- package/dist/store/mutation.js +85 -0
- package/dist/store/mutation.js.map +1 -0
- package/dist/store/obligations.d.ts +101 -0
- package/dist/store/obligations.d.ts.map +1 -0
- package/dist/store/obligations.js +226 -0
- package/dist/store/obligations.js.map +1 -0
- package/dist/store/operator-decisions.d.ts +23 -0
- package/dist/store/operator-decisions.d.ts.map +1 -0
- package/dist/store/operator-decisions.js +68 -0
- package/dist/store/operator-decisions.js.map +1 -0
- package/dist/store/owner-generations.d.ts +33 -0
- package/dist/store/owner-generations.d.ts.map +1 -0
- package/dist/store/owner-generations.js +63 -0
- package/dist/store/owner-generations.js.map +1 -0
- package/dist/store/partitions.d.ts +37 -0
- package/dist/store/partitions.d.ts.map +1 -0
- package/dist/store/partitions.js +68 -0
- package/dist/store/partitions.js.map +1 -0
- package/dist/store/pragmas.d.ts +32 -0
- package/dist/store/pragmas.d.ts.map +1 -0
- package/dist/store/pragmas.js +65 -0
- package/dist/store/pragmas.js.map +1 -0
- package/dist/store/project-router.d.ts +325 -0
- package/dist/store/project-router.d.ts.map +1 -0
- package/dist/store/project-router.js +298 -0
- package/dist/store/project-router.js.map +1 -0
- package/dist/store/projects.d.ts +36 -0
- package/dist/store/projects.d.ts.map +1 -0
- package/dist/store/projects.js +238 -0
- package/dist/store/projects.js.map +1 -0
- package/dist/store/publish-blob.d.ts +20 -0
- package/dist/store/publish-blob.d.ts.map +1 -0
- package/dist/store/publish-blob.js +158 -0
- package/dist/store/publish-blob.js.map +1 -0
- package/dist/store/purge-files.d.ts +30 -0
- package/dist/store/purge-files.d.ts.map +1 -0
- package/dist/store/purge-files.js +79 -0
- package/dist/store/purge-files.js.map +1 -0
- package/dist/store/resource-rows.d.ts +40 -0
- package/dist/store/resource-rows.d.ts.map +1 -0
- package/dist/store/resource-rows.js +103 -0
- package/dist/store/resource-rows.js.map +1 -0
- package/dist/store/resources.d.ts +67 -0
- package/dist/store/resources.d.ts.map +1 -0
- package/dist/store/resources.js +147 -0
- package/dist/store/resources.js.map +1 -0
- package/dist/store/retention.d.ts +95 -0
- package/dist/store/retention.d.ts.map +1 -0
- package/dist/store/retention.js +173 -0
- package/dist/store/retention.js.map +1 -0
- package/dist/store/run-events.d.ts +14 -0
- package/dist/store/run-events.d.ts.map +1 -0
- package/dist/store/run-events.js +35 -0
- package/dist/store/run-events.js.map +1 -0
- package/dist/store/runtime.d.ts +24 -0
- package/dist/store/runtime.d.ts.map +1 -0
- package/dist/store/runtime.js +67 -0
- package/dist/store/runtime.js.map +1 -0
- package/dist/store/schema.d.ts +33 -0
- package/dist/store/schema.d.ts.map +1 -0
- package/dist/store/schema.js +187 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/setup-bindings.d.ts +20 -0
- package/dist/store/setup-bindings.d.ts.map +1 -0
- package/dist/store/setup-bindings.js +52 -0
- package/dist/store/setup-bindings.js.map +1 -0
- package/dist/store/sql-command-router.d.ts +79 -0
- package/dist/store/sql-command-router.d.ts.map +1 -0
- package/dist/store/sql-command-router.js +92 -0
- package/dist/store/sql-command-router.js.map +1 -0
- package/dist/store/sql-daemon-services.d.ts +61 -0
- package/dist/store/sql-daemon-services.d.ts.map +1 -0
- package/dist/store/sql-daemon-services.js +124 -0
- package/dist/store/sql-daemon-services.js.map +1 -0
- package/dist/store/sql-recovery-export.d.ts +8 -0
- package/dist/store/sql-recovery-export.d.ts.map +1 -0
- package/dist/store/sql-recovery-export.js +110 -0
- package/dist/store/sql-recovery-export.js.map +1 -0
- package/dist/store/sql-recovery-inspection.d.ts +22 -0
- package/dist/store/sql-recovery-inspection.d.ts.map +1 -0
- package/dist/store/sql-recovery-inspection.js +88 -0
- package/dist/store/sql-recovery-inspection.js.map +1 -0
- package/dist/store/sql-recovery.d.ts +69 -0
- package/dist/store/sql-recovery.d.ts.map +1 -0
- package/dist/store/sql-recovery.js +169 -0
- package/dist/store/sql-recovery.js.map +1 -0
- package/dist/store/sql-validation.d.ts +9 -0
- package/dist/store/sql-validation.d.ts.map +1 -0
- package/dist/store/sql-validation.js +103 -0
- package/dist/store/sql-validation.js.map +1 -0
- package/dist/store/statement-observer.d.ts +7 -0
- package/dist/store/statement-observer.d.ts.map +1 -0
- package/dist/store/statement-observer.js +44 -0
- package/dist/store/statement-observer.js.map +1 -0
- package/dist/store/store.d.ts +110 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +296 -0
- package/dist/store/store.js.map +1 -0
- package/dist/store/terminal-files.d.ts +21 -0
- package/dist/store/terminal-files.d.ts.map +1 -0
- package/dist/store/terminal-files.js +115 -0
- package/dist/store/terminal-files.js.map +1 -0
- package/dist/store/thread-replay.d.ts +12 -0
- package/dist/store/thread-replay.d.ts.map +1 -0
- package/dist/store/thread-replay.js +49 -0
- package/dist/store/thread-replay.js.map +1 -0
- package/dist/store/thread-rows.d.ts +25 -0
- package/dist/store/thread-rows.d.ts.map +1 -0
- package/dist/store/thread-rows.js +141 -0
- package/dist/store/thread-rows.js.map +1 -0
- package/dist/store/threads.d.ts +105 -0
- package/dist/store/threads.d.ts.map +1 -0
- package/dist/store/threads.js +423 -0
- package/dist/store/threads.js.map +1 -0
- package/dist/store/upload-binding-retention.d.ts +26 -0
- package/dist/store/upload-binding-retention.d.ts.map +1 -0
- package/dist/store/upload-binding-retention.js +142 -0
- package/dist/store/upload-binding-retention.js.map +1 -0
- package/dist/store/uploads.d.ts +30 -0
- package/dist/store/uploads.d.ts.map +1 -0
- package/dist/store/uploads.js +238 -0
- package/dist/store/uploads.js.map +1 -0
- package/dist/store-contracts.d.ts +181 -0
- package/dist/store-contracts.d.ts.map +1 -0
- package/dist/store-contracts.js +2 -0
- package/dist/store-contracts.js.map +1 -0
- package/dist/terminal-authority.d.ts +9 -0
- package/dist/terminal-authority.d.ts.map +1 -1
- package/dist/terminal-authority.js +103 -1
- package/dist/terminal-authority.js.map +1 -1
- package/dist/thread-lane-checkpoints.d.ts +0 -2
- package/dist/thread-lane-checkpoints.d.ts.map +1 -1
- package/dist/thread-lane-checkpoints.js +0 -4
- package/dist/thread-lane-checkpoints.js.map +1 -1
- package/dist/thread-store-support.d.ts +1 -27
- package/dist/thread-store-support.d.ts.map +1 -1
- package/dist/thread-store-support.js +0 -63
- package/dist/thread-store-support.js.map +1 -1
- package/dist/threads.d.ts +1 -113
- package/dist/threads.d.ts.map +1 -1
- package/dist/threads.js +1 -379
- package/dist/threads.js.map +1 -1
- package/package.json +9 -7
- package/dist/command-activity.d.ts +0 -14
- package/dist/command-activity.d.ts.map +0 -1
- package/dist/command-activity.js +0 -16
- package/dist/command-activity.js.map +0 -1
- package/dist/journal-events.d.ts +0 -4
- package/dist/journal-events.d.ts.map +0 -1
- package/dist/journal-events.js +0 -23
- package/dist/journal-events.js.map +0 -1
- package/dist/journal-maintenance.d.ts +0 -50
- package/dist/journal-maintenance.d.ts.map +0 -1
- package/dist/journal-maintenance.js +0 -162
- package/dist/journal-maintenance.js.map +0 -1
- package/dist/journal-manager-journal.d.ts +0 -18
- package/dist/journal-manager-journal.d.ts.map +0 -1
- package/dist/journal-manager-journal.js +0 -25
- package/dist/journal-manager-journal.js.map +0 -1
- package/dist/journal-manager-lifecycle.d.ts +0 -11
- package/dist/journal-manager-lifecycle.d.ts.map +0 -1
- package/dist/journal-manager-lifecycle.js +0 -2
- package/dist/journal-manager-lifecycle.js.map +0 -1
- package/dist/journal-manager.d.ts +0 -99
- package/dist/journal-manager.d.ts.map +0 -1
- package/dist/journal-manager.js +0 -559
- package/dist/journal-manager.js.map +0 -1
- package/dist/journal-prepared-operation.d.ts +0 -53
- package/dist/journal-prepared-operation.d.ts.map +0 -1
- package/dist/journal-prepared-operation.js +0 -158
- package/dist/journal-prepared-operation.js.map +0 -1
- package/dist/journal-projection-slot.d.ts +0 -28
- package/dist/journal-projection-slot.d.ts.map +0 -1
- package/dist/journal-projection-slot.js +0 -71
- package/dist/journal-projection-slot.js.map +0 -1
- package/dist/journal-projection.d.ts +0 -13
- package/dist/journal-projection.d.ts.map +0 -1
- package/dist/journal-projection.js +0 -2
- package/dist/journal-projection.js.map +0 -1
- package/dist/partition-accounts.d.ts +0 -27
- package/dist/partition-accounts.d.ts.map +0 -1
- package/dist/partition-accounts.js +0 -21
- package/dist/partition-accounts.js.map +0 -1
- package/dist/project-partition-preparation.d.ts +0 -87
- package/dist/project-partition-preparation.d.ts.map +0 -1
- package/dist/project-partition-preparation.js +0 -273
- package/dist/project-partition-preparation.js.map +0 -1
- package/dist/project-partitions.d.ts +0 -214
- package/dist/project-partitions.d.ts.map +0 -1
- package/dist/project-partitions.js +0 -486
- package/dist/project-partitions.js.map +0 -1
- package/dist/project-remove.d.ts +0 -11
- package/dist/project-remove.d.ts.map +0 -1
- package/dist/project-remove.js +0 -65
- package/dist/project-remove.js.map +0 -1
- package/dist/project-thread-listing.d.ts +0 -14
- package/dist/project-thread-listing.d.ts.map +0 -1
- package/dist/project-thread-listing.js +0 -37
- package/dist/project-thread-listing.js.map +0 -1
- package/dist/quota-projection.d.ts +0 -11
- package/dist/quota-projection.d.ts.map +0 -1
- package/dist/quota-projection.js +0 -10
- package/dist/quota-projection.js.map +0 -1
- package/dist/resource-store.d.ts +0 -39
- package/dist/resource-store.d.ts.map +0 -1
- package/dist/resource-store.js +0 -464
- package/dist/resource-store.js.map +0 -1
- package/dist/run-event-terminal-index.d.ts +0 -13
- package/dist/run-event-terminal-index.d.ts.map +0 -1
- package/dist/run-event-terminal-index.js +0 -38
- package/dist/run-event-terminal-index.js.map +0 -1
- package/dist/run-events.d.ts +0 -17
- package/dist/run-events.d.ts.map +0 -1
- package/dist/run-events.js +0 -31
- package/dist/run-events.js.map +0 -1
- package/dist/thread-head-ping.d.ts +0 -35
- package/dist/thread-head-ping.d.ts.map +0 -1
- package/dist/thread-head-ping.js +0 -67
- package/dist/thread-head-ping.js.map +0 -1
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { InteractionRegistry } from "../interactions.js";
|
|
2
|
+
import { LiveInputRegistry } from "../live-input.js";
|
|
3
|
+
import { QuotaRegistry } from "../quota-registry.js";
|
|
4
|
+
import { BlobFiles } from "./blob-files.js";
|
|
5
|
+
import { SqlCommandPruner } from "./command-prune.js";
|
|
6
|
+
import { readJournalEvents } from "./cursors.js";
|
|
7
|
+
import { isServedPid } from "./generations.js";
|
|
8
|
+
import { SqlInteractionStore } from "./interactions.js";
|
|
9
|
+
import { MaintenanceController } from "./maintenance.js";
|
|
10
|
+
import { Obligations } from "./obligations.js";
|
|
11
|
+
import { partitionById } from "./partitions.js";
|
|
12
|
+
import { SqlProjectStore } from "./projects.js";
|
|
13
|
+
import { SqlPurgeFiles, partitionFilesHandler } from "./purge-files.js";
|
|
14
|
+
import { SqlResourceStore } from "./resources.js";
|
|
15
|
+
import { SqlCommandRouter } from "./sql-command-router.js";
|
|
16
|
+
import { SqlTerminalFiles } from "./terminal-files.js";
|
|
17
|
+
/** Builds one storage graph over an opened store. Global projections validate
|
|
18
|
+
* lazily, so a recovery-required registry cannot hide the recovery owners.
|
|
19
|
+
* Startup owns admission; this factory discovers no roots or second backend. */
|
|
20
|
+
export function createSqlDaemonServices(store, options) {
|
|
21
|
+
const blobs = new BlobFiles(store);
|
|
22
|
+
let resources;
|
|
23
|
+
const obligations = new Obligations(store, {
|
|
24
|
+
log: options.log,
|
|
25
|
+
onCleared: (rows) => resources.onObligationsCleared(rows),
|
|
26
|
+
});
|
|
27
|
+
const terminalFiles = new SqlTerminalFiles(store, obligations);
|
|
28
|
+
const pruner = new SqlCommandPruner(store, blobs, { log: options.log });
|
|
29
|
+
const projects = new SqlProjectStore(store, blobs, obligations);
|
|
30
|
+
const threads = new SqlCommandRouter(projects, { obligations, terminalFiles, pruner });
|
|
31
|
+
let globalEvents = null;
|
|
32
|
+
resources = new SqlResourceStore(store, blobs, obligations, options.log);
|
|
33
|
+
const purgeFiles = new SqlPurgeFiles(store, obligations);
|
|
34
|
+
obligations.registerHandler("purge_fs", purgeFiles.handler(options.purgeFiles));
|
|
35
|
+
obligations.registerHandler("archive_fs", partitionFilesHandler(store));
|
|
36
|
+
obligations.registerHandler("quarantine_fs", partitionFilesHandler(store));
|
|
37
|
+
const maintenance = new MaintenanceController(store, {
|
|
38
|
+
...options.maintenance,
|
|
39
|
+
log: options.log,
|
|
40
|
+
blobs,
|
|
41
|
+
});
|
|
42
|
+
const quotaFor = (events) => new QuotaRegistry(events, options.refreshers, store.now, options.subjects, options.pacerStore);
|
|
43
|
+
let quota = null;
|
|
44
|
+
const rebindGlobal = () => {
|
|
45
|
+
const generation = projects.global();
|
|
46
|
+
if (generation.pid === globalEvents?.generation.pid && quota)
|
|
47
|
+
return;
|
|
48
|
+
const nextEvents = threads.ledger(generation);
|
|
49
|
+
const nextQuota = quotaFor(nextEvents);
|
|
50
|
+
globalEvents = nextEvents;
|
|
51
|
+
quota = nextQuota;
|
|
52
|
+
};
|
|
53
|
+
const interactions = new InteractionRegistry({
|
|
54
|
+
forRequest: (params) => threads.interactionsForRequest(params),
|
|
55
|
+
forRun: (runId) => threads.interactionsForRun(runId),
|
|
56
|
+
});
|
|
57
|
+
const liveInputs = new LiveInputRegistry({
|
|
58
|
+
pendingForRun: (runId) => interactions.pendingForRun(runId),
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
store,
|
|
62
|
+
blobs,
|
|
63
|
+
obligations,
|
|
64
|
+
terminalFiles,
|
|
65
|
+
pruner,
|
|
66
|
+
projects,
|
|
67
|
+
threads,
|
|
68
|
+
commands: threads,
|
|
69
|
+
get globalEvents() {
|
|
70
|
+
rebindGlobal();
|
|
71
|
+
return globalEvents;
|
|
72
|
+
},
|
|
73
|
+
resources,
|
|
74
|
+
purgeFiles,
|
|
75
|
+
maintenance,
|
|
76
|
+
get quota() {
|
|
77
|
+
rebindGlobal();
|
|
78
|
+
return quota;
|
|
79
|
+
},
|
|
80
|
+
interactions,
|
|
81
|
+
liveInputs,
|
|
82
|
+
/** Called by the existing global recovery replacement owner after it
|
|
83
|
+
* drains setup and changes the registry generation. Publish both owners
|
|
84
|
+
* together only after the new quota projection validates. */
|
|
85
|
+
rebindGlobal,
|
|
86
|
+
journalEvents: (partition, afterCursor) => readJournalEvents(store, partition, afterCursor, blobs),
|
|
87
|
+
async recoverAfterStartup() {
|
|
88
|
+
const effects = await obligations.completeOpen();
|
|
89
|
+
// Only generations with unfinished work need recovery. No reconstruction
|
|
90
|
+
// of every project's historical command store on restart.
|
|
91
|
+
const rows = store
|
|
92
|
+
.prepare(`SELECT DISTINCT pid FROM command WHERE live=1 AND state IN ('queued','running')
|
|
93
|
+
UNION SELECT DISTINCT pid FROM interaction WHERE state='pending'`)
|
|
94
|
+
.all();
|
|
95
|
+
for (const { pid } of rows) {
|
|
96
|
+
if (!isServedPid(store, pid))
|
|
97
|
+
continue;
|
|
98
|
+
const generation = partitionById(store, pid);
|
|
99
|
+
threads.commandStore(generation).recoverAfterStartup();
|
|
100
|
+
new SqlInteractionStore(store, threads.ledger(generation)).recoverAfterStartup();
|
|
101
|
+
}
|
|
102
|
+
threads.recoverRunlessTurns();
|
|
103
|
+
rebindGlobal();
|
|
104
|
+
quota.recoverAfterStartup();
|
|
105
|
+
return effects;
|
|
106
|
+
},
|
|
107
|
+
/** Caller closes transports/runners first, then this graph, then its store. */
|
|
108
|
+
async close() {
|
|
109
|
+
await maintenance.stop();
|
|
110
|
+
try {
|
|
111
|
+
await store.flushed();
|
|
112
|
+
}
|
|
113
|
+
finally {
|
|
114
|
+
try {
|
|
115
|
+
await resources.drainCleanup();
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
obligations.close();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=sql-daemon-services.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-daemon-services.js","sourceRoot":"","sources":["../../src/store/sql-daemon-services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAqC,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAyB,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAWvD;;gFAEgF;AAChF,MAAM,UAAU,uBAAuB,CAAC,KAAkB,EAAE,OAAiC;IAC3F,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC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BACT,WAAW,CAAC,KAAK,EAAE,CAAC;gBACtB,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ControlJournalExportReceipt } from "@claudexor/schema";
|
|
2
|
+
import { type BlobFiles } from "./blob-files.js";
|
|
3
|
+
import type { MaintenanceController } from "./maintenance.js";
|
|
4
|
+
import type { EngineStore } from "./store.js";
|
|
5
|
+
/** One snapshot bundle, not a second backup authority. Missing required bodies
|
|
6
|
+
* fail the export; concurrent GC never turns a partial copy into a receipt. */
|
|
7
|
+
export declare function exportSqlRecovery(store: EngineStore, blobs: BlobFiles, maintenance: Pick<MaintenanceController, "exportTo">, partition: string): Promise<ControlJournalExportReceipt>;
|
|
8
|
+
//# sourceMappingURL=sql-recovery-export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-recovery-export.d.ts","sourceRoot":"","sources":["../../src/store/sql-recovery-export.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA4B9C;+EAC+E;AAC/E,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,EACpD,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,2BAA2B,CAAC,CA8EtC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { createReadStream } from "node:fs";
|
|
3
|
+
import { chmod, copyFile, mkdir, open, rm, stat } from "node:fs/promises";
|
|
4
|
+
import { constants } from "node:fs";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { ControlJournalExportReceipt as Receipt } from "@claudexor/schema";
|
|
7
|
+
import { BLOB_OWNER_PREDICATE } from "./blob-files.js";
|
|
8
|
+
import { StoreError } from "./errors.js";
|
|
9
|
+
import { partitionEvidence, partitionRecovery, recoveryGeneration, } from "./sql-recovery-inspection.js";
|
|
10
|
+
async function digestFile(path) {
|
|
11
|
+
const hash = createHash("sha256");
|
|
12
|
+
for await (const bytes of createReadStream(path))
|
|
13
|
+
hash.update(bytes);
|
|
14
|
+
return hash.digest("hex");
|
|
15
|
+
}
|
|
16
|
+
async function syncFile(path, directory = false) {
|
|
17
|
+
try {
|
|
18
|
+
const fd = await open(path, directory ? "r" : "r+");
|
|
19
|
+
try {
|
|
20
|
+
await fd.sync();
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
await fd.close();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
// Directory durability has the existing platform limit; database/body
|
|
28
|
+
// file synchronization never takes this exception.
|
|
29
|
+
if (!directory || process.platform !== "win32")
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** One snapshot bundle, not a second backup authority. Missing required bodies
|
|
34
|
+
* fail the export; concurrent GC never turns a partial copy into a receipt. */
|
|
35
|
+
export async function exportSqlRecovery(store, blobs, maintenance, partition) {
|
|
36
|
+
const exportId = `journal-export-${store.now().getTime().toString(36)}-${randomUUID()}`;
|
|
37
|
+
const exportsRoot = join(dirname(store.paths.database), "recovery-exports");
|
|
38
|
+
await mkdir(exportsRoot, { recursive: true, mode: 0o700 });
|
|
39
|
+
const bundlePath = join(exportsRoot, exportId);
|
|
40
|
+
await mkdir(bundlePath, { mode: 0o700 });
|
|
41
|
+
const databasePath = join(bundlePath, "engine.sqlite");
|
|
42
|
+
try {
|
|
43
|
+
await maintenance.exportTo(databasePath);
|
|
44
|
+
// All evidence, including required body refs, belongs to this exact copy.
|
|
45
|
+
const db = new store.runtime.sqlite.DatabaseSync(databasePath, { readOnly: true });
|
|
46
|
+
let evidence;
|
|
47
|
+
let recovery;
|
|
48
|
+
let required;
|
|
49
|
+
try {
|
|
50
|
+
evidence = partitionEvidence(db, recoveryGeneration(db, partition));
|
|
51
|
+
recovery = partitionRecovery(db, evidence.generation);
|
|
52
|
+
required = db
|
|
53
|
+
.prepare(`SELECT sha256,size FROM blob WHERE inline IS NULL AND (${BLOB_OWNER_PREDICATE.replaceAll("?1", "blob.sha256")}) ORDER BY sha256`)
|
|
54
|
+
.all();
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
db.close();
|
|
58
|
+
}
|
|
59
|
+
const entries = [];
|
|
60
|
+
if (required.length)
|
|
61
|
+
await mkdir(join(bundlePath, "blobs"), { mode: 0o700 });
|
|
62
|
+
for (const body of required) {
|
|
63
|
+
const target = join(bundlePath, "blobs", body.sha256);
|
|
64
|
+
await copyFile(blobs.filePath(body.sha256), target, constants.COPYFILE_EXCL);
|
|
65
|
+
const bytes = (await stat(target)).size;
|
|
66
|
+
const sha256 = await digestFile(target);
|
|
67
|
+
if (bytes !== Number(body.size) || sha256 !== body.sha256)
|
|
68
|
+
throw new Error(`SQL body ${body.sha256} does not match its snapshot digest/size`);
|
|
69
|
+
await syncFile(target);
|
|
70
|
+
await chmod(target, 0o400);
|
|
71
|
+
entries.push({ path: `blobs/${body.sha256}`, sha256, bytes });
|
|
72
|
+
}
|
|
73
|
+
await syncFile(databasePath);
|
|
74
|
+
await chmod(databasePath, 0o400);
|
|
75
|
+
entries.unshift({
|
|
76
|
+
path: "engine.sqlite",
|
|
77
|
+
sha256: await digestFile(databasePath),
|
|
78
|
+
bytes: (await stat(databasePath)).size,
|
|
79
|
+
});
|
|
80
|
+
const createdAt = store.now().toISOString();
|
|
81
|
+
const manifest = Buffer.from(`${JSON.stringify({ schemaVersion: 1, exportId, partition, fingerprint: evidence.fingerprint, recovery, createdAt, scope: "whole_engine_store", storeId: evidence.storeId, generation: evidence.generation, counts: evidence.counts, entries, externalEvidence: "Upload .part files, legacy upload idempotency-key files not yet adopted into SQL, per-run event logs, run artifacts and setup operational artifacts remain in their existing locations and are not included." }, null, 2)}\n`);
|
|
82
|
+
const manifestPath = join(bundlePath, "manifest.json");
|
|
83
|
+
const fd = await open(manifestPath, "wx", 0o400);
|
|
84
|
+
try {
|
|
85
|
+
await fd.writeFile(manifest);
|
|
86
|
+
await fd.sync();
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
await fd.close();
|
|
90
|
+
}
|
|
91
|
+
if (required.length)
|
|
92
|
+
await syncFile(join(bundlePath, "blobs"), true);
|
|
93
|
+
await syncFile(bundlePath, true);
|
|
94
|
+
await syncFile(exportsRoot, true);
|
|
95
|
+
return Receipt.parse({
|
|
96
|
+
schemaVersion: 1,
|
|
97
|
+
exportId,
|
|
98
|
+
partition,
|
|
99
|
+
fingerprint: evidence.fingerprint,
|
|
100
|
+
bundlePath,
|
|
101
|
+
manifestSha256: createHash("sha256").update(manifest).digest("hex"),
|
|
102
|
+
createdAt,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
await rm(bundlePath, { recursive: true, force: true });
|
|
107
|
+
throw new StoreError("recovery_export_incomplete", 503, true, `SQL recovery export did not complete: ${error instanceof Error ? error.message : String(error)}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=sql-recovery-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-recovery-export.js","sourceRoot":"","sources":["../../src/store/sql-recovery-export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE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ClC,OAAO,OAAO,CAAC,KAAK,CAAC;YACnB,aAAa,EAAE,CAAC;YAChB,QAAQ;YACR,SAAS;YACT,WAAW,EAAE,QAAQ,CAAC,WAAW;YACjC,UAAU;YACV,cAAc,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YACnE,SAAS;SACV,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,EAAE,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,MAAM,IAAI,UAAU,CAClB,4BAA4B,EAC5B,GAAG,EACH,IAAI,EACJ,yCAAyC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAClG,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type JournalRecoveryState } from "./errors.js";
|
|
2
|
+
import { ControlJournalInspection } from "@claudexor/schema";
|
|
3
|
+
import { type PartitionGeneration } from "./partitions.js";
|
|
4
|
+
import type { SqlWriteContext } from "./mutation.js";
|
|
5
|
+
export type RecoveryReader = Pick<SqlWriteContext, "prepare">;
|
|
6
|
+
/** Current registry authority, including a partition that cannot serve product work. */
|
|
7
|
+
export declare function recoveryGeneration(sql: RecoveryReader, name: string): PartitionGeneration;
|
|
8
|
+
export interface SqlPartitionEvidence {
|
|
9
|
+
storeId: string;
|
|
10
|
+
generation: PartitionGeneration;
|
|
11
|
+
counts: Array<{
|
|
12
|
+
type: string;
|
|
13
|
+
count: number;
|
|
14
|
+
}>;
|
|
15
|
+
fingerprint: string;
|
|
16
|
+
}
|
|
17
|
+
/** Inspection fingerprints metadata only; command/turn/event bodies stay unopened. */
|
|
18
|
+
export declare function partitionEvidence(sql: RecoveryReader, generation: PartitionGeneration): SqlPartitionEvidence;
|
|
19
|
+
export declare function partitionRecovery(sql: RecoveryReader, generation: PartitionGeneration): JournalRecoveryState;
|
|
20
|
+
export declare function inspection(sql: RecoveryReader, evidence: SqlPartitionEvidence, observedAt: string): ControlJournalInspection;
|
|
21
|
+
export declare function assertPartitionReadable(sql: RecoveryReader, generation: PartitionGeneration): void;
|
|
22
|
+
//# sourceMappingURL=sql-recovery-inspection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-recovery-inspection.d.ts","sourceRoot":"","sources":["../../src/store/sql-recovery-inspection.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAA+B,MAAM,mBAAmB,CAAC;AAE1F,OAAO,EAAiB,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;AAE9D,wFAAwF;AACxF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAiBzF;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,mBAAmB,CAAC;IAChC,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,sFAAsF;AACtF,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,cAAc,EACnB,UAAU,EAAE,mBAAmB,GAC9B,oBAAoB,CAqBtB;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,cAAc,EACnB,UAAU,EAAE,mBAAmB,GAC9B,oBAAoB,CAsBtB;AAED,wBAAgB,UAAU,CACxB,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,oBAAoB,EAC9B,UAAU,EAAE,MAAM,GACjB,wBAAwB,CAY1B;AAED,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,cAAc,EACnB,UAAU,EAAE,mBAAmB,GAC9B,IAAI,CAGN"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { JournalRecoveryRequiredError } from "./errors.js";
|
|
3
|
+
import { ControlJournalInspection, ControlJournalRecoveryState } from "@claudexor/schema";
|
|
4
|
+
import { globalGeneration } from "./generations.js";
|
|
5
|
+
import { partitionById } from "./partitions.js";
|
|
6
|
+
/** Current registry authority, including a partition that cannot serve product work. */
|
|
7
|
+
export function recoveryGeneration(sql, name) {
|
|
8
|
+
const global = globalGeneration(sql);
|
|
9
|
+
if (name === "global" && global)
|
|
10
|
+
return global;
|
|
11
|
+
if (global && global.status === "ready") {
|
|
12
|
+
const project = sql
|
|
13
|
+
.prepare(`SELECT q.id FROM project p JOIN partition q ON q.id=p.current_pid
|
|
14
|
+
WHERE p.pid=? AND p.status='active' AND q.name=?`)
|
|
15
|
+
.get(global.pid, name);
|
|
16
|
+
const generation = project ? partitionById(sql, project.id) : null;
|
|
17
|
+
if (generation)
|
|
18
|
+
return generation;
|
|
19
|
+
}
|
|
20
|
+
throw Object.assign(new Error(`journal partition is not registered: ${name}`), {
|
|
21
|
+
code: "journal_partition_not_found",
|
|
22
|
+
status: 404,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** Inspection fingerprints metadata only; command/turn/event bodies stay unopened. */
|
|
26
|
+
export function partitionEvidence(sql, generation) {
|
|
27
|
+
const identity = sql.prepare("SELECT value FROM meta WHERE key='store_id'").get();
|
|
28
|
+
if (!identity)
|
|
29
|
+
throw new Error("engine store identity is missing");
|
|
30
|
+
const counts = sql
|
|
31
|
+
.prepare("SELECT type,count(*) AS count FROM event WHERE pid=? GROUP BY type ORDER BY type")
|
|
32
|
+
.all(generation.pid).map((row) => ({ type: row.type, count: Number(row.count) }));
|
|
33
|
+
const fingerprint = createHash("sha256")
|
|
34
|
+
.update(JSON.stringify({
|
|
35
|
+
store_id: identity.value,
|
|
36
|
+
name: generation.name,
|
|
37
|
+
epoch: generation.epoch,
|
|
38
|
+
next_seq: generation.nextSeq,
|
|
39
|
+
counts,
|
|
40
|
+
}))
|
|
41
|
+
.digest("hex");
|
|
42
|
+
return { storeId: identity.value, generation, counts, fingerprint };
|
|
43
|
+
}
|
|
44
|
+
export function partitionRecovery(sql, generation) {
|
|
45
|
+
if (generation.status === "ready")
|
|
46
|
+
return { status: "ready", discardedTailBytes: 0 };
|
|
47
|
+
const imported = sql
|
|
48
|
+
.prepare("SELECT problem FROM import_partition WHERE pid=? AND problem IS NOT NULL")
|
|
49
|
+
.get(generation.pid);
|
|
50
|
+
if (imported) {
|
|
51
|
+
try {
|
|
52
|
+
const parsed = ControlJournalRecoveryState.parse(JSON.parse(imported.problem));
|
|
53
|
+
if (parsed.status === "recovery_required")
|
|
54
|
+
return parsed;
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
/* Preserve a usable recovery doorway when the original detail is unavailable. */
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const issue = sql
|
|
61
|
+
.prepare("SELECT seq,reason FROM unclassified WHERE pid=? ORDER BY seq LIMIT 1")
|
|
62
|
+
.get(generation.pid);
|
|
63
|
+
return {
|
|
64
|
+
status: "recovery_required",
|
|
65
|
+
location: { kind: "cursor", epoch: generation.epoch, seq: issue ? Number(issue.seq) : 0 },
|
|
66
|
+
reason: issue?.reason ?? `partition generation is ${generation.status}`,
|
|
67
|
+
discardedTailBytes: 0,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export function inspection(sql, evidence, observedAt) {
|
|
71
|
+
const recovery = partitionRecovery(sql, evidence.generation);
|
|
72
|
+
return ControlJournalInspection.parse({
|
|
73
|
+
schemaVersion: 1,
|
|
74
|
+
partition: evidence.generation.name,
|
|
75
|
+
generation: evidence.generation.pid,
|
|
76
|
+
status: recovery.status,
|
|
77
|
+
recovery,
|
|
78
|
+
fingerprint: evidence.fingerprint,
|
|
79
|
+
observedAt,
|
|
80
|
+
evidenceRefs: [`recovery:${evidence.generation.name}:${evidence.fingerprint}`],
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
export function assertPartitionReadable(sql, generation) {
|
|
84
|
+
const state = partitionRecovery(sql, generation);
|
|
85
|
+
if (state.status === "recovery_required")
|
|
86
|
+
throw new JournalRecoveryRequiredError(state);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=sql-recovery-inspection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-recovery-inspection.js","sourceRoot":"","sources":["../../src/store/sql-recovery-inspection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,4BAA4B,EAA6B,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAA4B,MAAM,iBAAiB,CAAC;AAK1E,wFAAwF;AACxF,MAAM,UAAU,kBAAkB,CAAC,GAAmB,EAAE,IAAY;IAClE,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,IAAI,KAAK,QAAQ,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC/C,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;QACxC,MAAM,OAAO,GAAG,GAAG;aAChB,OAAO,CACN;uDAC+C,CAChD;aACA,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAA+B,CA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,OAAO,wBAAwB,CAAC,KAAK,CAAC;QACpC,aAAa,EAAE,CAAC;QAChB,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,IAAI;QACnC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG;QACnC,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,QAAQ;QACR,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,UAAU;QACV,YAAY,EAAE,CAAC,YAAY,QAAQ,CAAC,UAAU,CAAC,IAAI,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;KAC/E,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,GAAmB,EACnB,UAA+B;IAE/B,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IACjD,IAAI,KAAK,CAAC,MAAM,KAAK,mBAAmB;QAAE,MAAM,IAAI,4BAA4B,CAAC,KAAK,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ControlJournalQuarantineReceipt, ControlJournalValidation, type ControlJournalInspection } from "@claudexor/schema";
|
|
2
|
+
import { type JournalQuarantineRequest } from "../journal-recovery-operation.js";
|
|
3
|
+
import type { PartitionControlPort } from "../store-contracts.js";
|
|
4
|
+
import type { BlobFiles } from "./blob-files.js";
|
|
5
|
+
import { StoreError } from "./errors.js";
|
|
6
|
+
import type { MaintenanceController } from "./maintenance.js";
|
|
7
|
+
import { type PartitionGeneration } from "./partitions.js";
|
|
8
|
+
import type { EngineStore } from "./store.js";
|
|
9
|
+
/** The composition root supplies its existing pure/stateful projection validators.
|
|
10
|
+
* Validation must be synchronous and side-effect free; no substitute reducers. */
|
|
11
|
+
export interface SqlRecoveryProjection {
|
|
12
|
+
name: string;
|
|
13
|
+
validate(generation: PartitionGeneration): void;
|
|
14
|
+
}
|
|
15
|
+
export interface SqlRecoveryOptions {
|
|
16
|
+
projections(generation: PartitionGeneration): readonly SqlRecoveryProjection[];
|
|
17
|
+
onQuarantined?(receipt: ControlJournalQuarantineReceipt, previous: PartitionGeneration, current: PartitionGeneration): void;
|
|
18
|
+
onPhysicalCorruption?(problem: StoreError): void;
|
|
19
|
+
}
|
|
20
|
+
/** Logical partition recovery over one supplied store. Physical SQLite repair
|
|
21
|
+
* remains the owning application's whole-store engine-state lifecycle. */
|
|
22
|
+
export declare class SqlPartitionRecovery implements PartitionControlPort {
|
|
23
|
+
private readonly store;
|
|
24
|
+
private readonly blobs;
|
|
25
|
+
private readonly maintenance;
|
|
26
|
+
readonly partition: string;
|
|
27
|
+
private readonly options;
|
|
28
|
+
constructor(store: EngineStore, blobs: BlobFiles, maintenance: Pick<MaintenanceController, "integrityCheck" | "exportTo">, partition: string, options: SqlRecoveryOptions);
|
|
29
|
+
inspect(): ControlJournalInspection;
|
|
30
|
+
validate(): Promise<ControlJournalValidation>;
|
|
31
|
+
events(afterCursor?: string): {
|
|
32
|
+
schemaVersion: 1;
|
|
33
|
+
cursor: string;
|
|
34
|
+
partition: string;
|
|
35
|
+
type: string;
|
|
36
|
+
observedAt: string;
|
|
37
|
+
payload?: unknown;
|
|
38
|
+
}[];
|
|
39
|
+
exportRecovery(): Promise<{
|
|
40
|
+
schemaVersion: 1;
|
|
41
|
+
exportId: string;
|
|
42
|
+
partition: string;
|
|
43
|
+
fingerprint: string;
|
|
44
|
+
bundlePath: string;
|
|
45
|
+
manifestSha256: string;
|
|
46
|
+
createdAt: string;
|
|
47
|
+
}>;
|
|
48
|
+
preflightQuarantine(input: JournalQuarantineRequest): {
|
|
49
|
+
disposition: string;
|
|
50
|
+
receipt: {
|
|
51
|
+
schemaVersion: 1;
|
|
52
|
+
operationId: string;
|
|
53
|
+
partition: string;
|
|
54
|
+
previousFingerprint: string;
|
|
55
|
+
quarantineArtifactId: string;
|
|
56
|
+
quarantinePath: string;
|
|
57
|
+
newEpoch: string;
|
|
58
|
+
completedAt: string;
|
|
59
|
+
};
|
|
60
|
+
} | {
|
|
61
|
+
disposition: string;
|
|
62
|
+
receipt: null;
|
|
63
|
+
};
|
|
64
|
+
quarantineAndStartFresh(input: JournalQuarantineRequest): ControlJournalQuarantineReceipt;
|
|
65
|
+
private replay;
|
|
66
|
+
private assertPhysicalHealthy;
|
|
67
|
+
private physicalCorruption;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=sql-recovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-recovery.d.ts","sourceRoot":"","sources":["../../src/store/sql-recovery.ts"],"names":[],"mappings":"AACA,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACxB,KAAK,wBAAwB,EAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAKL,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAiB,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAS9C;kFACkF;AAClF,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACjD;AACD,MAAM,WAAW,kBAAkB;IACjC,WAAW,CAAC,UAAU,EAAE,mBAAmB,GAAG,SAAS,qBAAqB,EAAE,CAAC;IAC/E,aAAa,CAAC,CACZ,OAAO,EAAE,+BAA+B,EACxC,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,EAAE,mBAAmB,GAC3B,IAAI,CAAC;IACR,oBAAoB,CAAC,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;CAClD;AAED;0EAC0E;AAC1E,qBAAa,oBAAqB,YAAW,oBAAoB;IAE7D,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAL1B,YACmB,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,GAAG,UAAU,CAAC,EAC/E,SAAS,EAAE,MAAM,EACT,OAAO,EAAE,kBAAkB,EAC1C;IAEJ,OAAO,IAAI,wBAAwB,CAQlC;IAEK,QAAQ,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAmDlD;IAED,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM;;;;;;;QAI1B;IAED,cAAc;;;;;;;;OAIb;IAED,mBAAmB,CAAC,KAAK,EAAE,wBAAwB;;;;;;;;;;;;;;;MAelD;IAED,uBAAuB,CAAC,KAAK,EAAE,wBAAwB,GAAG,+BAA+B,CA2BxF;IAED,OAAO,CAAC,MAAM;IAwDd,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,kBAAkB;CAU3B"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { ControlJournalQuarantineReceipt, ControlJournalValidation, } from "@claudexor/schema";
|
|
3
|
+
import { conflict, quarantineRequestDigest, typedError, validateRequest, } from "../journal-recovery-operation.js";
|
|
4
|
+
import { sha256 } from "../journal-recovery-files.js";
|
|
5
|
+
import { readJournalEvents } from "./cursors.js";
|
|
6
|
+
import { StoreError } from "./errors.js";
|
|
7
|
+
import { quarantineGeneration, setGenerationStatusInTx } from "./generations.js";
|
|
8
|
+
import { runMutation } from "./mutation.js";
|
|
9
|
+
import { partitionById } from "./partitions.js";
|
|
10
|
+
import { exportSqlRecovery } from "./sql-recovery-export.js";
|
|
11
|
+
import { assertPartitionReadable, inspection, partitionEvidence, recoveryGeneration, } from "./sql-recovery-inspection.js";
|
|
12
|
+
/** Logical partition recovery over one supplied store. Physical SQLite repair
|
|
13
|
+
* remains the owning application's whole-store engine-state lifecycle. */
|
|
14
|
+
export class SqlPartitionRecovery {
|
|
15
|
+
store;
|
|
16
|
+
blobs;
|
|
17
|
+
maintenance;
|
|
18
|
+
partition;
|
|
19
|
+
options;
|
|
20
|
+
constructor(store, blobs, maintenance, partition, options) {
|
|
21
|
+
this.store = store;
|
|
22
|
+
this.blobs = blobs;
|
|
23
|
+
this.maintenance = maintenance;
|
|
24
|
+
this.partition = partition;
|
|
25
|
+
this.options = options;
|
|
26
|
+
}
|
|
27
|
+
inspect() {
|
|
28
|
+
this.assertPhysicalHealthy();
|
|
29
|
+
const generation = recoveryGeneration(this.store, this.partition);
|
|
30
|
+
return inspection(this.store, partitionEvidence(this.store, generation), this.store.now().toISOString());
|
|
31
|
+
}
|
|
32
|
+
async validate() {
|
|
33
|
+
const integrity = await this.maintenance.integrityCheck();
|
|
34
|
+
if (!integrity.ok)
|
|
35
|
+
this.physicalCorruption(integrity.problems.join("; "));
|
|
36
|
+
const generation = recoveryGeneration(this.store, this.partition);
|
|
37
|
+
const before = partitionEvidence(this.store, generation);
|
|
38
|
+
const statuses = [
|
|
39
|
+
{
|
|
40
|
+
name: "sqlite.integrity",
|
|
41
|
+
status: "valid",
|
|
42
|
+
detail: "Whole engine database integrity_check passed.",
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
const projections = this.options.projections(generation);
|
|
46
|
+
if (projections.length === 0)
|
|
47
|
+
throw new StoreError("recovery_validation_unavailable", 503, false, "no projection validators are registered for this partition");
|
|
48
|
+
let failed = false;
|
|
49
|
+
for (const projection of projections) {
|
|
50
|
+
try {
|
|
51
|
+
const result = projection.validate(generation);
|
|
52
|
+
if (result && typeof result.then === "function")
|
|
53
|
+
throw new Error("SQL recovery projection validation must be synchronous");
|
|
54
|
+
statuses.push({ name: projection.name, status: "valid", detail: null });
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
if (error.code === "store_corrupt")
|
|
58
|
+
this.physicalCorruption(error instanceof Error ? error.message : String(error));
|
|
59
|
+
failed = true;
|
|
60
|
+
statuses.push({
|
|
61
|
+
name: projection.name,
|
|
62
|
+
status: "invalid",
|
|
63
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const after = partitionEvidence(this.store, recoveryGeneration(this.store, this.partition));
|
|
68
|
+
if (before.fingerprint !== after.fingerprint)
|
|
69
|
+
throw new StoreError("recovery_validation_changed", 409, true, "partition changed during projection validation");
|
|
70
|
+
if (failed)
|
|
71
|
+
runMutation(this.store, (tx) => setGenerationStatusInTx(tx, generation.pid, "recovery_required"));
|
|
72
|
+
return ControlJournalValidation.parse({ ...this.inspect(), projectionStatus: statuses });
|
|
73
|
+
}
|
|
74
|
+
events(afterCursor) {
|
|
75
|
+
this.assertPhysicalHealthy();
|
|
76
|
+
assertPartitionReadable(this.store, recoveryGeneration(this.store, this.partition));
|
|
77
|
+
return readJournalEvents(this.store, this.partition, afterCursor, this.blobs);
|
|
78
|
+
}
|
|
79
|
+
exportRecovery() {
|
|
80
|
+
this.assertPhysicalHealthy();
|
|
81
|
+
recoveryGeneration(this.store, this.partition);
|
|
82
|
+
return exportSqlRecovery(this.store, this.blobs, this.maintenance, this.partition);
|
|
83
|
+
}
|
|
84
|
+
preflightQuarantine(input) {
|
|
85
|
+
validateRequest(input);
|
|
86
|
+
this.assertPhysicalHealthy();
|
|
87
|
+
const prior = this.replay(input);
|
|
88
|
+
if (prior)
|
|
89
|
+
return { disposition: "completed", receipt: prior };
|
|
90
|
+
const current = this.inspect();
|
|
91
|
+
if (recoveryGeneration(this.store, this.partition).status !== "recovery_required")
|
|
92
|
+
throw typedError("journal_partition_ready", 409, "only a corrupt partition can be quarantined");
|
|
93
|
+
if (current.fingerprint !== input.expectedFingerprint)
|
|
94
|
+
throw conflict("recovery_fingerprint_mismatch");
|
|
95
|
+
return { disposition: "new", receipt: null };
|
|
96
|
+
}
|
|
97
|
+
quarantineAndStartFresh(input) {
|
|
98
|
+
const preflight = this.preflightQuarantine(input);
|
|
99
|
+
if (preflight.disposition === "completed")
|
|
100
|
+
return preflight.receipt;
|
|
101
|
+
const previous = recoveryGeneration(this.store, this.partition);
|
|
102
|
+
const operationId = randomUUID();
|
|
103
|
+
const epoch = randomUUID().replaceAll("-", "");
|
|
104
|
+
const receipt = ControlJournalQuarantineReceipt.parse({
|
|
105
|
+
schemaVersion: 1,
|
|
106
|
+
operationId,
|
|
107
|
+
partition: this.partition,
|
|
108
|
+
previousFingerprint: input.expectedFingerprint,
|
|
109
|
+
quarantineArtifactId: `partition-${previous.pid}-${operationId}`,
|
|
110
|
+
quarantinePath: `partition:${this.partition}@${previous.epoch}`,
|
|
111
|
+
newEpoch: epoch,
|
|
112
|
+
completedAt: this.store.now().toISOString(),
|
|
113
|
+
});
|
|
114
|
+
const outcome = quarantineGeneration(this.store, this.blobs, {
|
|
115
|
+
oldPid: previous.pid,
|
|
116
|
+
keyDigest: sha256(Buffer.from(input.idempotencyKey)),
|
|
117
|
+
requestDigest: quarantineRequestDigest(this.partition, input),
|
|
118
|
+
operationId,
|
|
119
|
+
payload: receipt,
|
|
120
|
+
epoch,
|
|
121
|
+
});
|
|
122
|
+
if (outcome.replay)
|
|
123
|
+
return this.replay(input);
|
|
124
|
+
this.options.onQuarantined?.(receipt, previous, outcome.generation);
|
|
125
|
+
return receipt;
|
|
126
|
+
}
|
|
127
|
+
replay(input) {
|
|
128
|
+
// The old generation is the key's scope. Search its addressed binding before
|
|
129
|
+
// current-registry preconditions; global recovery may have hidden the project.
|
|
130
|
+
const rows = this.store
|
|
131
|
+
.prepare(`SELECT i.pid,i.request_digest,i.target_id FROM partition p JOIN idempotency i
|
|
132
|
+
ON i.pid=p.id AND i.owner='quarantine' AND i.key_digest=? WHERE p.name=? LIMIT 2`)
|
|
133
|
+
.all(sha256(Buffer.from(input.idempotencyKey)), this.partition);
|
|
134
|
+
if (rows.length === 0)
|
|
135
|
+
return null;
|
|
136
|
+
if (rows.length !== 1)
|
|
137
|
+
throw typedError("recovery_operation_ambiguous", 503, "multiple quarantine bindings match this key");
|
|
138
|
+
const binding = rows[0];
|
|
139
|
+
if (binding.request_digest !== quarantineRequestDigest(this.partition, input))
|
|
140
|
+
throw conflict("idempotency_conflict");
|
|
141
|
+
const old = partitionById(this.store, binding.pid);
|
|
142
|
+
// Receipts are small, retained event rows. Never use today's current epoch
|
|
143
|
+
// to manufacture a receipt for an earlier successfully committed operation.
|
|
144
|
+
const records = this.store
|
|
145
|
+
.prepare(`SELECT e.payload FROM partition p JOIN event e ON e.pid=p.id
|
|
146
|
+
WHERE p.name=? AND e.type='journal.partition_quarantined'
|
|
147
|
+
AND json_extract(CAST(e.payload AS TEXT),'$.operationId')=?`)
|
|
148
|
+
.all(this.partition, binding.target_id);
|
|
149
|
+
if (records.length !== 1)
|
|
150
|
+
throw typedError("recovery_operation_missing", 503, "original quarantine receipt is unavailable");
|
|
151
|
+
const receipt = ControlJournalQuarantineReceipt.parse(JSON.parse(Buffer.from(records[0].payload).toString("utf8")));
|
|
152
|
+
if (receipt.partition !== this.partition ||
|
|
153
|
+
receipt.operationId !== binding.target_id ||
|
|
154
|
+
receipt.previousFingerprint !== input.expectedFingerprint ||
|
|
155
|
+
receipt.quarantinePath !== `partition:${this.partition}@${old.epoch}`)
|
|
156
|
+
throw typedError("recovery_receipt_mismatch", 503, "quarantine receipt does not match intent");
|
|
157
|
+
return receipt;
|
|
158
|
+
}
|
|
159
|
+
assertPhysicalHealthy() {
|
|
160
|
+
if (this.store.facts().integrity === "failed")
|
|
161
|
+
this.physicalCorruption("engine store integrity check failed");
|
|
162
|
+
}
|
|
163
|
+
physicalCorruption(detail) {
|
|
164
|
+
const problem = new StoreError("store_corrupt", 503, false, `physical SQLite recovery requires the whole engine-state owner: ${detail}`);
|
|
165
|
+
this.options.onPhysicalCorruption?.(problem);
|
|
166
|
+
throw problem;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=sql-recovery.js.map
|