@claudexor/daemon 3.25.1 → 4.0.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/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 +91 -0
- package/dist/store/retention.d.ts.map +1 -0
- package/dist/store/retention.js +169 -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,30 @@
|
|
|
1
|
+
import { ControlUploadStatus } from "@claudexor/schema";
|
|
2
|
+
import { type UploadRow } from "./resource-rows.js";
|
|
3
|
+
import type { EngineStore } from "./store.js";
|
|
4
|
+
import { UploadBindings } from "./upload-binding-retention.js";
|
|
5
|
+
/** The shared main-thread decision used by cancel, post-publication cleanup and the sweep. */
|
|
6
|
+
export declare function cleanupUploadPart(store: EngineStore, uploadId: string, path: string): Promise<"removed" | "owned">;
|
|
7
|
+
export declare class SqlUploads {
|
|
8
|
+
private readonly store;
|
|
9
|
+
private readonly defer;
|
|
10
|
+
readonly bindings: UploadBindings;
|
|
11
|
+
private readonly writing;
|
|
12
|
+
constructor(store: EngineStore, defer: (work: Promise<unknown>) => void);
|
|
13
|
+
create(raw: unknown, key: string): ControlUploadStatus;
|
|
14
|
+
status(id: string): ControlUploadStatus;
|
|
15
|
+
get(id: string): UploadRow;
|
|
16
|
+
partPath(id: string): string;
|
|
17
|
+
write(id: string, chunks: AsyncIterable<Uint8Array>): Promise<ControlUploadStatus>;
|
|
18
|
+
/** The daemon-produced result is synchronous through its publication commit. */
|
|
19
|
+
writeAll(id: string, bytes: Uint8Array): void;
|
|
20
|
+
cancel(id: string): ControlUploadStatus;
|
|
21
|
+
discard(id: string): void;
|
|
22
|
+
cleanPart(id: string): void;
|
|
23
|
+
private beginWrite;
|
|
24
|
+
private writeChunk;
|
|
25
|
+
private finishWrite;
|
|
26
|
+
private assertNotCancelled;
|
|
27
|
+
private markCancelled;
|
|
28
|
+
private save;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=uploads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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AAM,GAAG,mBAAmB,CAQtC;IAED,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAUxB;IACD,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAE1B;IAED,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,IAAI;CAOb"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { closeSync, constants, ftruncateSync, openSync, writeSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { ControlUploadCreateRequest, ControlUploadStatus } from "@claudexor/schema";
|
|
4
|
+
import { hashJson, newId, sensitiveResourcePolicy } from "@claudexor/util";
|
|
5
|
+
import { ensureDirectory, externalWriteFlags, unlinkExternalFile } from "./external-files.js";
|
|
6
|
+
import { mapStoreError } from "./errors.js";
|
|
7
|
+
import { deleteUnownedInlineInTx } from "./blob-files.js";
|
|
8
|
+
import { bindIdempotencyInTx } from "./idempotency.js";
|
|
9
|
+
import { runMutation } from "./mutation.js";
|
|
10
|
+
import { putUploadInTx, readUploadRow, resourceError, sensitiveResourceError, } from "./resource-rows.js";
|
|
11
|
+
import { UploadBindings, uploadKeyDigest } from "./upload-binding-retention.js";
|
|
12
|
+
/** The shared main-thread decision used by cancel, post-publication cleanup and the sweep. */
|
|
13
|
+
export async function cleanupUploadPart(store, uploadId, path) {
|
|
14
|
+
const observe = () => {
|
|
15
|
+
if (store
|
|
16
|
+
.prepare("SELECT 1 FROM effect_obligation WHERE kind='publish_blob' AND key=?")
|
|
17
|
+
.get(uploadId))
|
|
18
|
+
return "owned";
|
|
19
|
+
const row = store.prepare("SELECT state FROM upload WHERE id=?").get(uploadId);
|
|
20
|
+
if (row?.state === "published")
|
|
21
|
+
return "published";
|
|
22
|
+
return !row || row.state === "discarded" ? "unowned" : "owned";
|
|
23
|
+
};
|
|
24
|
+
const state = observe();
|
|
25
|
+
if (state === "owned")
|
|
26
|
+
return "owned";
|
|
27
|
+
if (state === "published") {
|
|
28
|
+
// The removed obligation already certified publication. A crash between
|
|
29
|
+
// its clear and this callback may have left the upload's digest reference.
|
|
30
|
+
runMutation(store, (tx) => {
|
|
31
|
+
const row = tx.prepare("SELECT finalize_sha FROM upload WHERE id=?").get(uploadId);
|
|
32
|
+
if (row.finalize_sha !== null) {
|
|
33
|
+
tx.prepare("UPDATE upload SET finalize_sha=NULL WHERE id=?").run(uploadId);
|
|
34
|
+
deleteUnownedInlineInTx(tx, row.finalize_sha);
|
|
35
|
+
tx.changes.blobChanged(row.finalize_sha);
|
|
36
|
+
tx.changes.uploadChanged(uploadId);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
unlinkExternalFile(store, path);
|
|
40
|
+
return "removed";
|
|
41
|
+
}
|
|
42
|
+
// Discarded metadata keeps its public cancelled receipt but owns no .part.
|
|
43
|
+
return store.owners.unlinkWhenUnowned(`upload:${uploadId}`, {
|
|
44
|
+
path,
|
|
45
|
+
owners: () => observe() !== "unowned",
|
|
46
|
+
afterUnlink: () => {
|
|
47
|
+
store.registerExternal(store.paths.uploads);
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export class SqlUploads {
|
|
52
|
+
store;
|
|
53
|
+
defer;
|
|
54
|
+
bindings;
|
|
55
|
+
writing = new Set();
|
|
56
|
+
constructor(store, defer) {
|
|
57
|
+
this.store = store;
|
|
58
|
+
this.defer = defer;
|
|
59
|
+
this.bindings = new UploadBindings(store);
|
|
60
|
+
// As in the legacy restart path, an interrupted stream is retryable from byte zero.
|
|
61
|
+
const rows = store.prepare("SELECT id FROM upload WHERE state='open'").all();
|
|
62
|
+
for (const { id } of rows) {
|
|
63
|
+
const row = readUploadRow(store, id);
|
|
64
|
+
if (row.status.state !== "uploading")
|
|
65
|
+
continue;
|
|
66
|
+
row.status = { ...row.status, state: "open", receivedBytes: 0 };
|
|
67
|
+
this.save(row);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
create(raw, key) {
|
|
71
|
+
const request = ControlUploadCreateRequest.parse(raw);
|
|
72
|
+
if (sensitiveResourcePolicy.classifyPath(request.name).sensitive)
|
|
73
|
+
throw sensitiveResourceError();
|
|
74
|
+
const requestDigest = hashJson(request);
|
|
75
|
+
const prior = this.bindings.lookup("create", key, requestDigest);
|
|
76
|
+
if (prior)
|
|
77
|
+
return ControlUploadStatus.parse(prior.result);
|
|
78
|
+
const uploadId = newId("upl");
|
|
79
|
+
ensureDirectory(this.store, this.store.paths.uploads);
|
|
80
|
+
try {
|
|
81
|
+
const fd = openSync(this.partPath(uploadId), constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL, 0o600);
|
|
82
|
+
closeSync(fd);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
throw mapStoreError(error, "creating upload part");
|
|
86
|
+
}
|
|
87
|
+
this.store.registerExternal(this.store.paths.uploads);
|
|
88
|
+
const status = ControlUploadStatus.parse({
|
|
89
|
+
uploadId,
|
|
90
|
+
state: "open",
|
|
91
|
+
receivedBytes: 0,
|
|
92
|
+
expectedBytes: request.sizeBytes,
|
|
93
|
+
});
|
|
94
|
+
runMutation(this.store, (tx) => {
|
|
95
|
+
putUploadInTx(tx, { request, status, state: "open", finalizeSha: null });
|
|
96
|
+
bindIdempotencyInTx(tx, {
|
|
97
|
+
owner: "upload",
|
|
98
|
+
pid: 0,
|
|
99
|
+
keyDigest: uploadKeyDigest("create", key),
|
|
100
|
+
operation: "create",
|
|
101
|
+
requestDigest,
|
|
102
|
+
targetId: uploadId,
|
|
103
|
+
result: status,
|
|
104
|
+
createdAt: tx.now().toISOString(),
|
|
105
|
+
});
|
|
106
|
+
tx.changes.uploadChanged(uploadId);
|
|
107
|
+
});
|
|
108
|
+
return status;
|
|
109
|
+
}
|
|
110
|
+
status(id) {
|
|
111
|
+
return ControlUploadStatus.parse(this.get(id).status);
|
|
112
|
+
}
|
|
113
|
+
get(id) {
|
|
114
|
+
const row = readUploadRow(this.store, id);
|
|
115
|
+
if (!row || row.state === "published")
|
|
116
|
+
throw resourceError(`no such upload: ${id}`, 404, "upload_not_found");
|
|
117
|
+
return row;
|
|
118
|
+
}
|
|
119
|
+
partPath(id) {
|
|
120
|
+
return join(this.store.paths.uploads, `${id}.part`);
|
|
121
|
+
}
|
|
122
|
+
async write(id, chunks) {
|
|
123
|
+
const row = this.get(id);
|
|
124
|
+
if (row.status.state !== "open")
|
|
125
|
+
throw resourceError(`upload ${id} is ${row.status.state}`, 409, "upload_not_open");
|
|
126
|
+
const fd = this.beginWrite(row);
|
|
127
|
+
this.writing.add(id);
|
|
128
|
+
try {
|
|
129
|
+
for await (const chunk of chunks)
|
|
130
|
+
this.writeChunk(row, fd, chunk);
|
|
131
|
+
return this.finishWrite(row);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
this.markCancelled(row);
|
|
135
|
+
throw mapStoreError(error, "writing upload part");
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
closeSync(fd);
|
|
139
|
+
this.writing.delete(id);
|
|
140
|
+
if (readUploadRow(this.store, id)?.state === "discarded")
|
|
141
|
+
this.cleanPart(id);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/** The daemon-produced result is synchronous through its publication commit. */
|
|
145
|
+
writeAll(id, bytes) {
|
|
146
|
+
const row = this.get(id);
|
|
147
|
+
const fd = this.beginWrite(row);
|
|
148
|
+
try {
|
|
149
|
+
this.writeChunk(row, fd, bytes);
|
|
150
|
+
this.finishWrite(row);
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
this.markCancelled(row);
|
|
154
|
+
throw mapStoreError(error, "writing model result part");
|
|
155
|
+
}
|
|
156
|
+
finally {
|
|
157
|
+
closeSync(fd);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
cancel(id) {
|
|
161
|
+
const row = this.get(id);
|
|
162
|
+
if (row.finalization)
|
|
163
|
+
throw resourceError("upload finalization has already started", 409, "upload_finalizing");
|
|
164
|
+
this.markCancelled(row);
|
|
165
|
+
// A streaming descriptor is closed by its writer before unlink (also required on Windows).
|
|
166
|
+
if (!this.writing.has(id))
|
|
167
|
+
this.cleanPart(id);
|
|
168
|
+
return ControlUploadStatus.parse(row.status);
|
|
169
|
+
}
|
|
170
|
+
discard(id) {
|
|
171
|
+
const row = readUploadRow(this.store, id);
|
|
172
|
+
if (!row)
|
|
173
|
+
return;
|
|
174
|
+
runMutation(this.store, (tx) => {
|
|
175
|
+
tx.prepare("DELETE FROM upload WHERE id=?").run(id);
|
|
176
|
+
if (row.finalizeSha)
|
|
177
|
+
deleteUnownedInlineInTx(tx, row.finalizeSha);
|
|
178
|
+
tx.changes.uploadChanged(id);
|
|
179
|
+
tx.changes.blobChanged(row.finalizeSha);
|
|
180
|
+
});
|
|
181
|
+
this.cleanPart(id);
|
|
182
|
+
}
|
|
183
|
+
cleanPart(id) {
|
|
184
|
+
this.defer(cleanupUploadPart(this.store, id, this.partPath(id)));
|
|
185
|
+
}
|
|
186
|
+
beginWrite(row) {
|
|
187
|
+
let fd;
|
|
188
|
+
try {
|
|
189
|
+
fd = openSync(this.partPath(row.status.uploadId), externalWriteFlags(constants.O_RDWR));
|
|
190
|
+
ftruncateSync(fd, 0);
|
|
191
|
+
row.status = { ...row.status, state: "uploading", receivedBytes: 0 };
|
|
192
|
+
this.save(row);
|
|
193
|
+
return fd;
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
if (fd !== undefined)
|
|
197
|
+
closeSync(fd);
|
|
198
|
+
throw mapStoreError(error, "opening upload part for writing");
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
writeChunk(row, fd, bytes) {
|
|
202
|
+
this.assertNotCancelled(row.status.uploadId);
|
|
203
|
+
const next = row.status.receivedBytes + bytes.byteLength;
|
|
204
|
+
if (next > row.status.expectedBytes)
|
|
205
|
+
throw resourceError("upload exceeds declared size", 413, "upload_size_exceeded");
|
|
206
|
+
let offset = 0;
|
|
207
|
+
while (offset < bytes.byteLength)
|
|
208
|
+
offset += writeSync(fd, bytes, offset, bytes.byteLength - offset);
|
|
209
|
+
row.status = { ...row.status, receivedBytes: next };
|
|
210
|
+
this.save(row);
|
|
211
|
+
}
|
|
212
|
+
finishWrite(row) {
|
|
213
|
+
this.assertNotCancelled(row.status.uploadId);
|
|
214
|
+
if (row.status.receivedBytes !== row.status.expectedBytes)
|
|
215
|
+
throw resourceError(`upload size mismatch: expected ${row.status.expectedBytes}, received ${row.status.receivedBytes}`, 400, "upload_size_mismatch");
|
|
216
|
+
row.status = { ...row.status, state: "uploaded" };
|
|
217
|
+
row.state = "uploaded";
|
|
218
|
+
this.save(row);
|
|
219
|
+
return ControlUploadStatus.parse(row.status);
|
|
220
|
+
}
|
|
221
|
+
assertNotCancelled(id) {
|
|
222
|
+
if (readUploadRow(this.store, id)?.state === "discarded")
|
|
223
|
+
throw resourceError(`upload ${id} was cancelled`, 409, "upload_cancelled");
|
|
224
|
+
}
|
|
225
|
+
markCancelled(row) {
|
|
226
|
+
row.status = { ...row.status, state: "cancelled" };
|
|
227
|
+
row.state = "discarded";
|
|
228
|
+
this.save(row);
|
|
229
|
+
}
|
|
230
|
+
save(row) {
|
|
231
|
+
runMutation(this.store, (tx) => {
|
|
232
|
+
putUploadInTx(tx, row);
|
|
233
|
+
tx.changes.uploadChanged(row.status.uploadId);
|
|
234
|
+
tx.changes.blobChanged(row.finalizeSha);
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=uploads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["../../src/store/uploads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CA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C,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;QAClD,GAAG,CAAC,KAAK,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACf,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;IACO,kBAAkB,CAAC,EAAU;QACnC,IAAI,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,KAAK,WAAW;YACtD,MAAM,aAAa,CAAC,UAAU,EAAE,gBAAgB,EAAE,GAAG,EAAE,kBAAkB,CAAC,CAAC;IAC/E,CAAC;IACO,aAAa,CAAC,GAAc;QAClC,GAAG,CAAC,MAAM,GAAG,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;QACnD,GAAG,CAAC,KAAK,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC;IACO,IAAI,CAAC,GAAc;QACzB,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE;YAC7B,aAAa,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;YACvB,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC9C,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/** Operational storage boundaries, independent of their implementation. */
|
|
2
|
+
import type { Attachment, CommandListQuery, ControlJournalEvent, ControlJournalExportReceipt, ControlJournalInspection, ControlJournalQuarantineReceipt, ControlJournalValidation, ControlPendingInteraction, ControlProjectListingProblem, ControlResource, ControlUploadStatus, ModelPayloadRef, Project, ProjectNesting, ResourceAttachmentRef, RunEvent, Session, Thread, ThreadTurn } from "@claudexor/schema";
|
|
3
|
+
import type { AcceptCommand, FindCommand } from "./command-store.js";
|
|
4
|
+
import type { JobRecord } from "./job-record.js";
|
|
5
|
+
import type { ProjectRegistration, RegisterProject } from "./projects.js";
|
|
6
|
+
import type { InteractionContext, InteractionTerminal } from "./interactions.js";
|
|
7
|
+
import type { OperatorDecisionRecord, RecordedOperatorDecision } from "./operator-decisions.js";
|
|
8
|
+
import type { CreateThreadInput, CreateTurnInput, UpdateThreadInput } from "./threads.js";
|
|
9
|
+
import type { JournalQuarantineRequest } from "./journal-recovery-operation.js";
|
|
10
|
+
export interface ProfileContinuityResult {
|
|
11
|
+
sessions: number;
|
|
12
|
+
checkpoints: number;
|
|
13
|
+
skippedPartitions: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface CommandStorePort {
|
|
16
|
+
accept(input: AcceptCommand): {
|
|
17
|
+
record: JobRecord;
|
|
18
|
+
reused: boolean;
|
|
19
|
+
};
|
|
20
|
+
find(input: FindCommand): JobRecord | null;
|
|
21
|
+
get(id: string): JobRecord | undefined;
|
|
22
|
+
update(id: string, patch: Partial<JobRecord>): JobRecord;
|
|
23
|
+
prune(ids: readonly string[]): void;
|
|
24
|
+
prunedScopeRoots(): string[];
|
|
25
|
+
recoverDurableTerminal(id: string): JobRecord | null;
|
|
26
|
+
flushed(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export interface ProjectStorePort {
|
|
29
|
+
list(): Project[];
|
|
30
|
+
listWithNesting(): Array<Project & {
|
|
31
|
+
nesting: ProjectNesting[];
|
|
32
|
+
}>;
|
|
33
|
+
get(id: string): Project | undefined;
|
|
34
|
+
findByRoot(root: string): Project | undefined;
|
|
35
|
+
nestingFor(id: string): ProjectNesting[];
|
|
36
|
+
register(input: RegisterProject): ProjectRegistration;
|
|
37
|
+
relink(id: string, rootInput: string): Project;
|
|
38
|
+
unregister(id: string): Project | undefined;
|
|
39
|
+
}
|
|
40
|
+
export interface ResourceStorePort {
|
|
41
|
+
create(raw: unknown, idempotencyKey: string): ControlUploadStatus;
|
|
42
|
+
status(uploadId: string): ControlUploadStatus;
|
|
43
|
+
write(uploadId: string, chunks: AsyncIterable<Uint8Array>): Promise<ControlUploadStatus>;
|
|
44
|
+
cancel(uploadId: string): ControlUploadStatus;
|
|
45
|
+
finalize(uploadId: string, expectedSha256: string | undefined, idempotencyKey: string): ControlResource;
|
|
46
|
+
resolve(refs: ResourceAttachmentRef[] | undefined): Attachment[];
|
|
47
|
+
readModel(raw: ModelPayloadRef): Buffer;
|
|
48
|
+
publishModel(bytes: Uint8Array): ModelPayloadRef;
|
|
49
|
+
releaseModel(raw: ModelPayloadRef): void;
|
|
50
|
+
expireModel(raw: ModelPayloadRef, expiredAt: string): void;
|
|
51
|
+
listModelResources(): Array<ModelPayloadRef & {
|
|
52
|
+
createdAt: string;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
export interface InteractionStorePort {
|
|
56
|
+
request(ctx: InteractionContext): ControlPendingInteraction;
|
|
57
|
+
resolve(runId: string, interactionId: string, terminal: InteractionTerminal): "resolved" | "not_found" | "already_resolved";
|
|
58
|
+
resolveRun(runId: string, terminal: Extract<InteractionTerminal, "run_terminal" | "interrupted">): string[];
|
|
59
|
+
status(runId: string, interactionId: string): "pending" | "resolved" | "missing";
|
|
60
|
+
pendingForRun(runId: string): ControlPendingInteraction[];
|
|
61
|
+
}
|
|
62
|
+
export interface ProjectThreadPort {
|
|
63
|
+
registerProject(input: RegisterProject): ProjectRegistration;
|
|
64
|
+
relinkProject(id: string, root: string): Project;
|
|
65
|
+
removeProject(id: string, activeRunRoots: ReadonlySet<string>): import("@claudexor/schema").ControlProjectRemoveReceipt;
|
|
66
|
+
createThread(input: CreateThreadInput & {
|
|
67
|
+
ephemeral?: boolean;
|
|
68
|
+
}): Thread;
|
|
69
|
+
findThreadCreation(input: CreateThreadInput & {
|
|
70
|
+
ephemeral?: boolean;
|
|
71
|
+
}): Thread | null;
|
|
72
|
+
listThreads(): Thread[];
|
|
73
|
+
listThreadsResilient(): {
|
|
74
|
+
threads: Thread[];
|
|
75
|
+
problems: ControlProjectListingProblem[];
|
|
76
|
+
};
|
|
77
|
+
listPurgedThreads(): Thread[];
|
|
78
|
+
getThread(id: string): Thread | undefined;
|
|
79
|
+
getTurn(id: string): ThreadTurn | undefined;
|
|
80
|
+
turnsFor(id: string): ThreadTurn[];
|
|
81
|
+
sessionsForThread(id: string): Session[];
|
|
82
|
+
createTurn(id: string, prompt: string, input?: CreateTurnInput): ThreadTurn;
|
|
83
|
+
findTurnByIdempotency(id: string, input: NonNullable<CreateTurnInput["idempotency"]>): ThreadTurn | undefined;
|
|
84
|
+
updateThread(id: string, patch: UpdateThreadInput): Thread;
|
|
85
|
+
trashThread(id: string): Thread;
|
|
86
|
+
restoreThread(id: string): Thread;
|
|
87
|
+
purgeThread(id: string): Thread;
|
|
88
|
+
setThreadWorktree(id: string, path: string, baseSha: string, deliveredThroughRunId?: string): void;
|
|
89
|
+
assertKnownIds(threadId: unknown, turnId: unknown): {
|
|
90
|
+
threadId?: string;
|
|
91
|
+
turnId?: string;
|
|
92
|
+
};
|
|
93
|
+
bindTurnRun(id: string, runId: string): void;
|
|
94
|
+
setTurnEnqueueError(id: string, problem: import("@claudexor/schema").TurnEnqueueProblem): void;
|
|
95
|
+
resumeMap(id: string, profileId?: string | null): Record<string, {
|
|
96
|
+
sessionId: string;
|
|
97
|
+
profileId: string | null;
|
|
98
|
+
}>;
|
|
99
|
+
resumeMapAuto(id: string): Record<string, {
|
|
100
|
+
sessionId: string;
|
|
101
|
+
profileId: string | null;
|
|
102
|
+
}>;
|
|
103
|
+
accountBindings(id: string): Record<string, string>;
|
|
104
|
+
recordSession(id: string, harnessId: string, nativeSessionId: string, observedModel?: string | null, profileId?: string | null): void;
|
|
105
|
+
recordLaneCheckpoint(id: string, harnessId: string, profileId: string | null, turnId: string): void;
|
|
106
|
+
laneCheckpoint(id: string, harnessId: string, profileId: string | null): string | null;
|
|
107
|
+
laneCheckpointsForThread(id: string): import("@claudexor/schema").LaneCheckpoint[];
|
|
108
|
+
setTurnContinuity(turnId: string, disclosure: import("@claudexor/schema").ContinuityDisclosure): void;
|
|
109
|
+
pingThreadHead(id: string): void;
|
|
110
|
+
healthyProjectRoots(): string[];
|
|
111
|
+
migrateNullProfileContinuity(harnessId: string, rowId: string): ProfileContinuityResult;
|
|
112
|
+
rollbackProfileContinuity(harnessId: string, rowId: string): ProfileContinuityResult;
|
|
113
|
+
invalidateCredentialProfile(harnessId: string, profileId: string): {
|
|
114
|
+
clearedThreads: number;
|
|
115
|
+
invalidatedSessions: number;
|
|
116
|
+
};
|
|
117
|
+
assertCredentialProfileInvalidationReady(): void;
|
|
118
|
+
operatorDecision(params: unknown, runId: string): OperatorDecisionRecord | null;
|
|
119
|
+
findOperatorDecisionByIdempotency(params: unknown, runId: string, idempotency: {
|
|
120
|
+
key: string;
|
|
121
|
+
client: string;
|
|
122
|
+
request: unknown;
|
|
123
|
+
}): OperatorDecisionRecord | null;
|
|
124
|
+
recordOperatorDecision(params: unknown, decision: OperatorDecisionRecord, idempotency?: {
|
|
125
|
+
key: string;
|
|
126
|
+
client: string;
|
|
127
|
+
request: unknown;
|
|
128
|
+
}): RecordedOperatorDecision;
|
|
129
|
+
recordRunEvent(params: unknown, event: RunEvent): RunEvent;
|
|
130
|
+
beginDelivery(params: unknown, input: {
|
|
131
|
+
key: string;
|
|
132
|
+
client: string;
|
|
133
|
+
operation: string;
|
|
134
|
+
request: unknown;
|
|
135
|
+
}): JobRecord & {
|
|
136
|
+
reused: boolean;
|
|
137
|
+
};
|
|
138
|
+
completeDelivery(id: string, result: unknown): void;
|
|
139
|
+
failDelivery(id: string, error: unknown): void;
|
|
140
|
+
}
|
|
141
|
+
export interface CommandQueries {
|
|
142
|
+
getByRunId(runId: string): JobRecord | undefined;
|
|
143
|
+
select(query: CommandListQuery): JobRecord[];
|
|
144
|
+
publicList(query: CommandListQuery): JobRecord[];
|
|
145
|
+
active(): JobRecord[];
|
|
146
|
+
count(): number;
|
|
147
|
+
}
|
|
148
|
+
/** Product recovery operations, without journal preparation or file ownership. */
|
|
149
|
+
export interface PartitionControlPort {
|
|
150
|
+
events(afterCursor?: string): ControlJournalEvent[];
|
|
151
|
+
inspect(): ControlJournalInspection;
|
|
152
|
+
preflightQuarantine(input: JournalQuarantineRequest): {
|
|
153
|
+
disposition: string;
|
|
154
|
+
receipt: ControlJournalQuarantineReceipt | null;
|
|
155
|
+
};
|
|
156
|
+
validate(): ControlJournalValidation | Promise<ControlJournalValidation>;
|
|
157
|
+
exportRecovery(): ControlJournalExportReceipt | Promise<ControlJournalExportReceipt>;
|
|
158
|
+
quarantineAndStartFresh(input: JournalQuarantineRequest): ControlJournalQuarantineReceipt | Promise<ControlJournalQuarantineReceipt>;
|
|
159
|
+
}
|
|
160
|
+
export type ProjectControlPort = ProjectThreadPort & {
|
|
161
|
+
journal(partition: string): PartitionControlPort;
|
|
162
|
+
};
|
|
163
|
+
export interface StoreEvent<T = unknown> {
|
|
164
|
+
partition: string;
|
|
165
|
+
epoch: string;
|
|
166
|
+
seq: number;
|
|
167
|
+
time: string;
|
|
168
|
+
type: string;
|
|
169
|
+
payload: T;
|
|
170
|
+
}
|
|
171
|
+
/** The quota reducer needs logical events, never checksums, files or compaction. */
|
|
172
|
+
export interface EventLedger {
|
|
173
|
+
append<T>(type: string, payload: T): StoreEvent<T>;
|
|
174
|
+
appendBatch(entries: readonly {
|
|
175
|
+
type: string;
|
|
176
|
+
payload: unknown;
|
|
177
|
+
}[]): StoreEvent[];
|
|
178
|
+
records<T = unknown>(afterSeq: number, types: readonly string[]): StoreEvent<T>[];
|
|
179
|
+
cursorFor(record: Pick<StoreEvent, "partition" | "epoch" | "seq">): string;
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=store-contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-contracts.d.ts","sourceRoot":"","sources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,+BAA+B,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;CAC/E;AAED,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG;IACnD,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,CAAC;CAClD,CAAC;AAEF,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,OAAO;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,CAAC;CACZ;AACD,oFAAoF;AACpF,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IACnD,WAAW,CAAC,OAAO,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,GAAG,UAAU,EAAE,CAAC;IAClF,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IAClF,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC;CAC5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-contracts.js","sourceRoot":"","sources":["../src/store-contracts.ts"],"names":[],"mappings":""}
|
|
@@ -38,4 +38,13 @@ export declare function terminalCommandResult(record: JobRecord, facts: RunFacts
|
|
|
38
38
|
};
|
|
39
39
|
/** ENOENT-tolerant lstat: retention may have legitimately reclaimed the path. */
|
|
40
40
|
export declare function lstatOrNull(path: string): ReturnType<typeof lstatSync> | null;
|
|
41
|
+
/** The same canonical tail validation for legacy recovery and SQL file obligations. */
|
|
42
|
+
export declare function normalizedTerminalEvents(eventsBytes: Buffer, terminal: RunEvent, terminalSeq: number): string;
|
|
43
|
+
export declare function terminalResultMatches(result: unknown, expected: {
|
|
44
|
+
lifecycle: RunFacts["outcome"]["lifecycle"];
|
|
45
|
+
facts: RunFacts["outcome"];
|
|
46
|
+
runId: string;
|
|
47
|
+
taskId: string;
|
|
48
|
+
runDir: string;
|
|
49
|
+
}): boolean;
|
|
41
50
|
//# sourceMappingURL=terminal-authority.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-authority.d.ts","sourceRoot":"","sources":["../src/terminal-authority.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"terminal-authority.d.ts","sourceRoot":"","sources":["../src/terminal-authority.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,QAAQ,EACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,QAAQ,GACjB;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CA+B1C;AAED,2EAA2E;AAC3E,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ;IAEpE,SAAS;IACT,KAAK;;;;;;;;;;;;;;;;;;IACL,KAAK;IACL,MAAM;IACN,MAAM;EAET;AAED,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,GAAG,IAAI,CAO7E;AAED,uFAAuF;AACvF,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,GAClB,MAAM,CA6DR;AA+BD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE;IACR,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC;IAC5C,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,GACA,OAAO,CAUT"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { lstatSync } from "node:fs";
|
|
2
|
-
import {
|
|
2
|
+
import { TextDecoder } from "node:util";
|
|
3
|
+
import { POST_TERMINAL_AUDIT_EVENT_TYPES } from "./journaled-run-events.js";
|
|
4
|
+
import { needsOperatorAttention, RunEvent as RunEventSchema, validateRunFactsInvariants, } from "@claudexor/schema";
|
|
3
5
|
import { hashJson } from "@claudexor/util";
|
|
4
6
|
/**
|
|
5
7
|
* Pure (no filesystem) validation binding a durable terminal event's RunFacts
|
|
@@ -55,4 +57,104 @@ export function lstatOrNull(path) {
|
|
|
55
57
|
throw error;
|
|
56
58
|
}
|
|
57
59
|
}
|
|
60
|
+
/** The same canonical tail validation for legacy recovery and SQL file obligations. */
|
|
61
|
+
export function normalizedTerminalEvents(eventsBytes, terminal, terminalSeq) {
|
|
62
|
+
const normalizedLines = [];
|
|
63
|
+
let terminalOccurrences = 0;
|
|
64
|
+
let previousSeq = 0;
|
|
65
|
+
const rawLines = splitLines(eventsBytes);
|
|
66
|
+
const finalNonEmptyIndex = rawLines.findLastIndex((line) => !isAsciiWhitespace(line));
|
|
67
|
+
const canonicalTerminalLine = JSON.stringify(terminal);
|
|
68
|
+
const canonicalTerminalBytes = Buffer.from(canonicalTerminalLine, "utf8");
|
|
69
|
+
const endsWithNewline = eventsBytes.at(-1) === 0x0a;
|
|
70
|
+
const utf8 = new TextDecoder("utf-8", { fatal: true });
|
|
71
|
+
for (const [index, lineBytes] of rawLines.entries()) {
|
|
72
|
+
if (isAsciiWhitespace(lineBytes))
|
|
73
|
+
continue;
|
|
74
|
+
let event;
|
|
75
|
+
try {
|
|
76
|
+
const line = utf8.decode(lineBytes);
|
|
77
|
+
event = RunEventSchema.parse(JSON.parse(line));
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
const tornFinalLine = index === finalNonEmptyIndex &&
|
|
81
|
+
!endsWithNewline &&
|
|
82
|
+
terminalOccurrences === 0 &&
|
|
83
|
+
isBufferPrefix(canonicalTerminalBytes, lineBytes);
|
|
84
|
+
if (tornFinalLine)
|
|
85
|
+
break;
|
|
86
|
+
throw new Error("per-run event log contains malformed committed evidence");
|
|
87
|
+
}
|
|
88
|
+
if (event.run_id !== terminal.run_id || event.task_id !== terminal.task_id) {
|
|
89
|
+
throw new Error("per-run event identity conflicts with durable terminal authority");
|
|
90
|
+
}
|
|
91
|
+
if (typeof event.seq !== "number" || !Number.isSafeInteger(event.seq) || event.seq <= 0) {
|
|
92
|
+
throw new Error("per-run event has no valid sequence");
|
|
93
|
+
}
|
|
94
|
+
const eventSeq = event.seq;
|
|
95
|
+
if (eventSeq <= previousSeq) {
|
|
96
|
+
throw new Error("per-run event sequence is duplicate or non-monotonic");
|
|
97
|
+
}
|
|
98
|
+
const sameEvent = hashJson(event) === hashJson(terminal);
|
|
99
|
+
if (terminalOccurrences === 0 && !sameEvent && eventSeq >= terminalSeq) {
|
|
100
|
+
throw new Error("per-run event sequence conflicts with durable terminal authority");
|
|
101
|
+
}
|
|
102
|
+
if (terminalOccurrences > 0 && !sameEvent && !isPostTerminalControlAudit(event.type)) {
|
|
103
|
+
throw new Error("per-run event appears after terminal authority");
|
|
104
|
+
}
|
|
105
|
+
const eventIsTerminal = event.type === "run.completed" || event.type === "run.failed" || event.type === "run.blocked";
|
|
106
|
+
if (eventIsTerminal) {
|
|
107
|
+
if (!sameEvent) {
|
|
108
|
+
throw new Error("per-run terminal event conflicts with durable journal authority");
|
|
109
|
+
}
|
|
110
|
+
terminalOccurrences += 1;
|
|
111
|
+
if (terminalOccurrences > 1) {
|
|
112
|
+
throw new Error("per-run event log contains multiple terminal events");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
previousSeq = eventSeq;
|
|
116
|
+
normalizedLines.push(JSON.stringify(event));
|
|
117
|
+
}
|
|
118
|
+
if (terminalOccurrences === 0) {
|
|
119
|
+
normalizedLines.push(JSON.stringify(terminal));
|
|
120
|
+
}
|
|
121
|
+
const normalizedEvents = normalizedLines.length > 0 ? `${normalizedLines.join("\n")}\n` : "";
|
|
122
|
+
return normalizedEvents;
|
|
123
|
+
}
|
|
124
|
+
function splitLines(bytes) {
|
|
125
|
+
const lines = [];
|
|
126
|
+
let start = 0;
|
|
127
|
+
for (let index = 0; index < bytes.length; index += 1) {
|
|
128
|
+
if (bytes[index] !== 0x0a)
|
|
129
|
+
continue;
|
|
130
|
+
lines.push(bytes.subarray(start, index));
|
|
131
|
+
start = index + 1;
|
|
132
|
+
}
|
|
133
|
+
lines.push(bytes.subarray(start));
|
|
134
|
+
return lines;
|
|
135
|
+
}
|
|
136
|
+
function isAsciiWhitespace(bytes) {
|
|
137
|
+
for (const byte of bytes) {
|
|
138
|
+
if (byte !== 0x09 && byte !== 0x0b && byte !== 0x0c && byte !== 0x0d && byte !== 0x20) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
function isBufferPrefix(whole, prefix) {
|
|
145
|
+
return prefix.length <= whole.length && whole.subarray(0, prefix.length).equals(prefix);
|
|
146
|
+
}
|
|
147
|
+
function isPostTerminalControlAudit(type) {
|
|
148
|
+
return POST_TERMINAL_AUDIT_EVENT_TYPES.has(type);
|
|
149
|
+
}
|
|
150
|
+
export function terminalResultMatches(result, expected) {
|
|
151
|
+
if (!result || typeof result !== "object" || Array.isArray(result))
|
|
152
|
+
return false;
|
|
153
|
+
const value = result;
|
|
154
|
+
return (value["lifecycle"] === expected.lifecycle &&
|
|
155
|
+
value["runId"] === expected.runId &&
|
|
156
|
+
value["taskId"] === expected.taskId &&
|
|
157
|
+
value["runDir"] === expected.runDir &&
|
|
158
|
+
hashJson(value["facts"]) === hashJson(expected.facts));
|
|
159
|
+
}
|
|
58
160
|
//# sourceMappingURL=terminal-authority.js.map
|