@paraharness/sqlite 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +64 -2
- package/dist/builders/compaction-config-builder.d.ts +66 -0
- package/dist/builders/compaction-config-builder.d.ts.map +1 -0
- package/dist/builders/compaction-config-builder.js +2 -0
- package/dist/builders/compaction-config-builder.js.map +1 -0
- package/dist/builders/create-compaction-config-builder.d.ts +14 -0
- package/dist/builders/create-compaction-config-builder.d.ts.map +1 -0
- package/dist/builders/create-compaction-config-builder.js +66 -0
- package/dist/builders/create-compaction-config-builder.js.map +1 -0
- package/dist/builders/create-sqlite-global-rules-builder.d.ts +15 -0
- package/dist/builders/create-sqlite-global-rules-builder.d.ts.map +1 -0
- package/dist/builders/create-sqlite-global-rules-builder.js +30 -0
- package/dist/builders/create-sqlite-global-rules-builder.js.map +1 -0
- package/dist/builders/create-sqlite-ledger-builder.d.ts +15 -0
- package/dist/builders/create-sqlite-ledger-builder.d.ts.map +1 -0
- package/dist/builders/create-sqlite-ledger-builder.js +31 -0
- package/dist/builders/create-sqlite-ledger-builder.js.map +1 -0
- package/dist/builders/create-sqlite-lessons-builder.d.ts +12 -0
- package/dist/builders/create-sqlite-lessons-builder.d.ts.map +1 -0
- package/dist/builders/create-sqlite-lessons-builder.js +23 -0
- package/dist/builders/create-sqlite-lessons-builder.js.map +1 -0
- package/dist/builders/create-sqlite-topology-builder.d.ts +12 -0
- package/dist/builders/create-sqlite-topology-builder.d.ts.map +1 -0
- package/dist/builders/create-sqlite-topology-builder.js +23 -0
- package/dist/builders/create-sqlite-topology-builder.js.map +1 -0
- package/dist/builders/internal/compaction-config-builder-state.d.ts +16 -0
- package/dist/builders/internal/compaction-config-builder-state.d.ts.map +1 -0
- package/dist/builders/internal/compaction-config-builder-state.js +2 -0
- package/dist/builders/internal/compaction-config-builder-state.js.map +1 -0
- package/dist/builders/sqlite-global-rules-builder.d.ts +17 -0
- package/dist/builders/sqlite-global-rules-builder.d.ts.map +1 -0
- package/dist/builders/sqlite-global-rules-builder.js +2 -0
- package/dist/builders/sqlite-global-rules-builder.js.map +1 -0
- package/dist/builders/sqlite-ledger-builder.d.ts +21 -0
- package/dist/builders/sqlite-ledger-builder.d.ts.map +1 -0
- package/dist/builders/sqlite-ledger-builder.js +2 -0
- package/dist/builders/sqlite-ledger-builder.js.map +1 -0
- package/dist/builders/sqlite-lessons-builder.d.ts +18 -0
- package/dist/builders/sqlite-lessons-builder.d.ts.map +1 -0
- package/dist/builders/sqlite-lessons-builder.js +2 -0
- package/dist/builders/sqlite-lessons-builder.js.map +1 -0
- package/dist/builders/sqlite-namespace-contract.d.ts +64 -0
- package/dist/builders/sqlite-namespace-contract.d.ts.map +1 -0
- package/dist/builders/sqlite-namespace-contract.js +2 -0
- package/dist/builders/sqlite-namespace-contract.js.map +1 -0
- package/dist/builders/sqlite-namespace.d.ts +9 -0
- package/dist/builders/sqlite-namespace.d.ts.map +1 -0
- package/dist/builders/sqlite-namespace.js +17 -0
- package/dist/builders/sqlite-namespace.js.map +1 -0
- package/dist/builders/sqlite-topology-builder.d.ts +18 -0
- package/dist/builders/sqlite-topology-builder.d.ts.map +1 -0
- package/dist/builders/sqlite-topology-builder.js +2 -0
- package/dist/builders/sqlite-topology-builder.js.map +1 -0
- package/dist/ddl/internal/open-sqlite-connection.d.ts +24 -0
- package/dist/ddl/internal/open-sqlite-connection.d.ts.map +1 -0
- package/dist/ddl/internal/open-sqlite-connection.js +65 -0
- package/dist/ddl/internal/open-sqlite-connection.js.map +1 -0
- package/dist/ddl/sqlite-schema.constants.d.ts +21 -0
- package/dist/ddl/sqlite-schema.constants.d.ts.map +1 -0
- package/dist/ddl/sqlite-schema.constants.js +134 -0
- package/dist/ddl/sqlite-schema.constants.js.map +1 -0
- package/dist/executors/create-sqlite-executors.d.ts +11 -0
- package/dist/executors/create-sqlite-executors.d.ts.map +1 -0
- package/dist/executors/create-sqlite-executors.js +38 -0
- package/dist/executors/create-sqlite-executors.js.map +1 -0
- package/dist/executors/sqlite-executors.constants.d.ts +9 -0
- package/dist/executors/sqlite-executors.constants.d.ts.map +1 -0
- package/dist/executors/sqlite-executors.constants.js +9 -0
- package/dist/executors/sqlite-executors.constants.js.map +1 -0
- package/dist/executors/sqlite-rules-source-executor.d.ts +15 -0
- package/dist/executors/sqlite-rules-source-executor.d.ts.map +1 -0
- package/dist/executors/sqlite-rules-source-executor.js +47 -0
- package/dist/executors/sqlite-rules-source-executor.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/stores/internal/admit-lesson-params.d.ts +16 -0
- package/dist/stores/internal/admit-lesson-params.d.ts.map +1 -0
- package/dist/stores/internal/admit-lesson-params.js +2 -0
- package/dist/stores/internal/admit-lesson-params.js.map +1 -0
- package/dist/stores/internal/compute-normalized-relevance.d.ts +47 -0
- package/dist/stores/internal/compute-normalized-relevance.d.ts.map +1 -0
- package/dist/stores/internal/compute-normalized-relevance.js +63 -0
- package/dist/stores/internal/compute-normalized-relevance.js.map +1 -0
- package/dist/stores/internal/mark-frame-tombstone-params.d.ts +16 -0
- package/dist/stores/internal/mark-frame-tombstone-params.d.ts.map +1 -0
- package/dist/stores/internal/mark-frame-tombstone-params.js +2 -0
- package/dist/stores/internal/mark-frame-tombstone-params.js.map +1 -0
- package/dist/stores/internal/record-terminal-receipt-params.d.ts +16 -0
- package/dist/stores/internal/record-terminal-receipt-params.d.ts.map +1 -0
- package/dist/stores/internal/record-terminal-receipt-params.js +2 -0
- package/dist/stores/internal/record-terminal-receipt-params.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-compaction-ops.d.ts +14 -0
- package/dist/stores/internal/sqlite-ledger-compaction-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-compaction-ops.js +29 -0
- package/dist/stores/internal/sqlite-ledger-compaction-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-fork-operations.d.ts +33 -0
- package/dist/stores/internal/sqlite-ledger-fork-operations.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-fork-operations.js +44 -0
- package/dist/stores/internal/sqlite-ledger-fork-operations.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-frame-operations.d.ts +24 -0
- package/dist/stores/internal/sqlite-ledger-frame-operations.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-frame-operations.js +40 -0
- package/dist/stores/internal/sqlite-ledger-frame-operations.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-frame-ops.d.ts +50 -0
- package/dist/stores/internal/sqlite-ledger-frame-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-frame-ops.js +90 -0
- package/dist/stores/internal/sqlite-ledger-frame-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-plan-and-fork-ops.d.ts +59 -0
- package/dist/stores/internal/sqlite-ledger-plan-and-fork-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-plan-and-fork-ops.js +90 -0
- package/dist/stores/internal/sqlite-ledger-plan-and-fork-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-plan-operations.d.ts +40 -0
- package/dist/stores/internal/sqlite-ledger-plan-operations.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-plan-operations.js +39 -0
- package/dist/stores/internal/sqlite-ledger-plan-operations.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-run-operations.d.ts +41 -0
- package/dist/stores/internal/sqlite-ledger-run-operations.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-run-operations.js +89 -0
- package/dist/stores/internal/sqlite-ledger-run-operations.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-run-ops.d.ts +58 -0
- package/dist/stores/internal/sqlite-ledger-run-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-run-ops.js +80 -0
- package/dist/stores/internal/sqlite-ledger-run-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-step-operations.d.ts +28 -0
- package/dist/stores/internal/sqlite-ledger-step-operations.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-step-operations.js +53 -0
- package/dist/stores/internal/sqlite-ledger-step-operations.js.map +1 -0
- package/dist/stores/internal/sqlite-ledger-step-ops.d.ts +47 -0
- package/dist/stores/internal/sqlite-ledger-step-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-ledger-step-ops.js +89 -0
- package/dist/stores/internal/sqlite-ledger-step-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-lesson-ops.d.ts +100 -0
- package/dist/stores/internal/sqlite-lesson-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-lesson-ops.js +178 -0
- package/dist/stores/internal/sqlite-lesson-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-lesson-row.d.ts +28 -0
- package/dist/stores/internal/sqlite-lesson-row.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-lesson-row.js +2 -0
- package/dist/stores/internal/sqlite-lesson-row.js.map +1 -0
- package/dist/stores/internal/sqlite-overlay-step-mutation-entry.d.ts +21 -0
- package/dist/stores/internal/sqlite-overlay-step-mutation-entry.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-overlay-step-mutation-entry.js +2 -0
- package/dist/stores/internal/sqlite-overlay-step-mutation-entry.js.map +1 -0
- package/dist/stores/internal/sqlite-run-row.d.ts +36 -0
- package/dist/stores/internal/sqlite-run-row.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-run-row.js +2 -0
- package/dist/stores/internal/sqlite-run-row.js.map +1 -0
- package/dist/stores/internal/sqlite-step-row.d.ts +32 -0
- package/dist/stores/internal/sqlite-step-row.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-step-row.js +2 -0
- package/dist/stores/internal/sqlite-step-row.js.map +1 -0
- package/dist/stores/internal/sqlite-suspended-fork-row.d.ts +22 -0
- package/dist/stores/internal/sqlite-suspended-fork-row.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-suspended-fork-row.js +2 -0
- package/dist/stores/internal/sqlite-suspended-fork-row.js.map +1 -0
- package/dist/stores/internal/sqlite-topology-base-row.d.ts +18 -0
- package/dist/stores/internal/sqlite-topology-base-row.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-topology-base-row.js +2 -0
- package/dist/stores/internal/sqlite-topology-base-row.js.map +1 -0
- package/dist/stores/internal/sqlite-topology-commit-ops.d.ts +37 -0
- package/dist/stores/internal/sqlite-topology-commit-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-topology-commit-ops.js +58 -0
- package/dist/stores/internal/sqlite-topology-commit-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-commit.d.ts +25 -0
- package/dist/stores/internal/sqlite-topology-overlay-commit.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-commit.js +51 -0
- package/dist/stores/internal/sqlite-topology-overlay-commit.js.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-ops.d.ts +61 -0
- package/dist/stores/internal/sqlite-topology-overlay-ops.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-ops.js +156 -0
- package/dist/stores/internal/sqlite-topology-overlay-ops.js.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-row.d.ts +40 -0
- package/dist/stores/internal/sqlite-topology-overlay-row.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-row.js +2 -0
- package/dist/stores/internal/sqlite-topology-overlay-row.js.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-sync.d.ts +72 -0
- package/dist/stores/internal/sqlite-topology-overlay-sync.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-topology-overlay-sync.js +116 -0
- package/dist/stores/internal/sqlite-topology-overlay-sync.js.map +1 -0
- package/dist/stores/internal/sqlite-wire-frame-row.d.ts +26 -0
- package/dist/stores/internal/sqlite-wire-frame-row.d.ts.map +1 -0
- package/dist/stores/internal/sqlite-wire-frame-row.js +2 -0
- package/dist/stores/internal/sqlite-wire-frame-row.js.map +1 -0
- package/dist/stores/internal/three-way-merge-contract.d.ts +25 -0
- package/dist/stores/internal/three-way-merge-contract.d.ts.map +1 -0
- package/dist/stores/internal/three-way-merge-contract.js +76 -0
- package/dist/stores/internal/three-way-merge-contract.js.map +1 -0
- package/dist/stores/internal/update-continuation-stack-params.d.ts +17 -0
- package/dist/stores/internal/update-continuation-stack-params.d.ts.map +1 -0
- package/dist/stores/internal/update-continuation-stack-params.js +2 -0
- package/dist/stores/internal/update-continuation-stack-params.js.map +1 -0
- package/dist/stores/internal/update-contract-in-overlay-params.d.ts +16 -0
- package/dist/stores/internal/update-contract-in-overlay-params.d.ts.map +1 -0
- package/dist/stores/internal/update-contract-in-overlay-params.js +2 -0
- package/dist/stores/internal/update-contract-in-overlay-params.js.map +1 -0
- package/dist/stores/internal/validate-lane-dag.d.ts +59 -0
- package/dist/stores/internal/validate-lane-dag.d.ts.map +1 -0
- package/dist/stores/internal/validate-lane-dag.js +117 -0
- package/dist/stores/internal/validate-lane-dag.js.map +1 -0
- package/dist/stores/sqlite-ledger-store.d.ts +222 -0
- package/dist/stores/sqlite-ledger-store.d.ts.map +1 -0
- package/dist/stores/sqlite-ledger-store.js +295 -0
- package/dist/stores/sqlite-ledger-store.js.map +1 -0
- package/dist/stores/sqlite-lesson-store.d.ts +96 -0
- package/dist/stores/sqlite-lesson-store.d.ts.map +1 -0
- package/dist/stores/sqlite-lesson-store.js +121 -0
- package/dist/stores/sqlite-lesson-store.js.map +1 -0
- package/dist/stores/sqlite-topology-store.d.ts +112 -0
- package/dist/stores/sqlite-topology-store.d.ts.map +1 -0
- package/dist/stores/sqlite-topology-store.js +137 -0
- package/dist/stores/sqlite-topology-store.js.map +1 -0
- package/package.json +70 -3
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import type { ContinuationFrame, CreateOrResumeRunInput, CreateOrResumeRunResult, InterruptedStepBootRecord, LedgerStore, MutateLanePlanRequest, RecordStepStartInput, RecordStepTransitionInput, RunTerminalReceiptRecord, SuspendedForkRecord, WireFrameRecord } from '@paraharness/core';
|
|
2
|
+
import type Database from 'better-sqlite3';
|
|
3
|
+
import { type GetSuspendedForksOptions } from './internal/sqlite-ledger-plan-and-fork-ops.js';
|
|
4
|
+
import { type UpdateRunInputParams } from './internal/sqlite-ledger-run-ops.js';
|
|
5
|
+
/**
|
|
6
|
+
* Optional parameters for updating a step's continuation stack in `updateContinuationStack`.
|
|
7
|
+
*/
|
|
8
|
+
export interface UpdateContinuationStackOptions {
|
|
9
|
+
/** Optional updated base scope checkpoint after prerequisite `syncRoot` wakeup. */
|
|
10
|
+
readonly baseScopeCheckpoint?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* WAL-mode SQLite implementation of the `@paraharness/core` `LedgerStore` runtime port.
|
|
14
|
+
*
|
|
15
|
+
* Persists flow runs, step continuation stacks, wire-frame chains, dynamic lane DAG mutations,
|
|
16
|
+
* and suspended fork records inside transactional SQLite tables serialized via `p-queue`.
|
|
17
|
+
*/
|
|
18
|
+
export declare class SqliteLedgerStore implements LedgerStore {
|
|
19
|
+
/** Underlying `better-sqlite3` database connection. */
|
|
20
|
+
private readonly db;
|
|
21
|
+
/** Single-concurrency FIFO queue serializing asynchronous store operations. */
|
|
22
|
+
private readonly queue;
|
|
23
|
+
/**
|
|
24
|
+
* Initializes a `SqliteLedgerStore` against a SQLite file path, `:memory:`, or existing `Database` instance.
|
|
25
|
+
*
|
|
26
|
+
* Applies WAL-mode PRAGMAs and idempotent ledger DDL statements on initialization.
|
|
27
|
+
*
|
|
28
|
+
* @param {string | Database.Database} uriOrDb - SQLite database URI or open `better-sqlite3` handle.
|
|
29
|
+
*/
|
|
30
|
+
constructor(uriOrDb: string | Database.Database);
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new flow run row (`status: 'RUNNING'`) or resumes an existing run.
|
|
33
|
+
*
|
|
34
|
+
* Pins `compiledPrefixesJson` on initial creation and returns completed step outputs for `.inputFrom()`.
|
|
35
|
+
*
|
|
36
|
+
* @param {CreateOrResumeRunInput} run - Run initialization or resume request payload.
|
|
37
|
+
*
|
|
38
|
+
* @returns {Promise<CreateOrResumeRunResult>} Current persisted state and completed step outputs.
|
|
39
|
+
*/
|
|
40
|
+
createOrResumeRun(run: CreateOrResumeRunInput): Promise<CreateOrResumeRunResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Records the start of a flow step execution and initializes its `ContinuationFrame[]` stack.
|
|
43
|
+
*
|
|
44
|
+
* Persists `baseScopeCheckpoint` and `executableId` for reboot recovery.
|
|
45
|
+
*
|
|
46
|
+
* @param {RecordStepStartInput} step - Step start metadata and initial continuation stack.
|
|
47
|
+
*
|
|
48
|
+
* @returns {Promise<void>} Resolves once the step start is committed.
|
|
49
|
+
*/
|
|
50
|
+
recordStepStart(step: RecordStepStartInput): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Atomically updates the serialized `ContinuationFrame[]` stack for `stepExecId`.
|
|
53
|
+
*
|
|
54
|
+
* Optionally updates `baseScopeCheckpoint` after prerequisite `syncRoot` wakeup.
|
|
55
|
+
*
|
|
56
|
+
* @param {string} runId - Enclosing flow run identifier.
|
|
57
|
+
* @param {string} stepExecId - Target step execution identifier.
|
|
58
|
+
* @param {readonly ContinuationFrame[]} continuationStack - Updated outer-to-inner continuation stack.
|
|
59
|
+
* @param {UpdateContinuationStackOptions} [opts] - Optional updated base scope checkpoint.
|
|
60
|
+
*
|
|
61
|
+
* @returns {Promise<void>} Resolves once the continuation stack is persisted.
|
|
62
|
+
*/
|
|
63
|
+
updateContinuationStack(runId: string, stepExecId: string, continuationStack: readonly ContinuationFrame[], opts?: UpdateContinuationStackOptions): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Updates a run's serialized flow input payload and optional pending rewind target step ID.
|
|
66
|
+
*
|
|
67
|
+
* Used during `.replaceWith()` step promotion and `.onSignal().rewindTo()` transitions.
|
|
68
|
+
*
|
|
69
|
+
* @param {string} runId - Target flow run identifier.
|
|
70
|
+
* @param {UpdateRunInputParams} update - Updated input JSON and rewind target.
|
|
71
|
+
*
|
|
72
|
+
* @returns {Promise<void>} Resolves once the run input update is committed.
|
|
73
|
+
*/
|
|
74
|
+
updateRunInput(runId: string, update: UpdateRunInputParams): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Atomically chains spawned prerequisite items and validates DAG acyclicity and `maxPrerequisiteDepth`.
|
|
77
|
+
*
|
|
78
|
+
* Rejects cycles and depth limit breaches before committing any edge to SQLite.
|
|
79
|
+
*
|
|
80
|
+
* @param {MutateLanePlanRequest} req - Lane plan mutation request.
|
|
81
|
+
*
|
|
82
|
+
* @returns {Promise<void>} Resolves once the lane DAG mutation is committed.
|
|
83
|
+
*/
|
|
84
|
+
mutateLanePlan(req: MutateLanePlanRequest): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Appends a new `WireFrameRecord` to the conversation transcript for `runId`.
|
|
87
|
+
*
|
|
88
|
+
* Persists both raw vendor wire bytes and canonical message projections.
|
|
89
|
+
*
|
|
90
|
+
* @param {string} runId - Enclosing flow run identifier.
|
|
91
|
+
* @param {WireFrameRecord} frame - Immutable wire frame record to append.
|
|
92
|
+
*
|
|
93
|
+
* @returns {Promise<void>} Resolves once the frame is persisted.
|
|
94
|
+
*/
|
|
95
|
+
appendMessageFrame(runId: string, frame: WireFrameRecord): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Replaces an existing `WireFrameRecord` in-place (such as after `appendToolResultNotes`).
|
|
98
|
+
*
|
|
99
|
+
* Updates `rawWireFrame` and `canonical` while preserving `messageId` and `parentMessageId`.
|
|
100
|
+
*
|
|
101
|
+
* @param {string} runId - Enclosing flow run identifier.
|
|
102
|
+
* @param {WireFrameRecord} frame - Updated wire frame record.
|
|
103
|
+
*
|
|
104
|
+
* @returns {Promise<void>} Resolves once the frame replacement is committed.
|
|
105
|
+
*/
|
|
106
|
+
replaceMessageFrame(runId: string, frame: WireFrameRecord): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Records a per-`callId` compacted skill tombstone on an earlier `activateSkill` message frame.
|
|
109
|
+
*
|
|
110
|
+
* Updates `compactedTombstones[callId]` without mutating `rawWireFrame`.
|
|
111
|
+
*
|
|
112
|
+
* @param {string} runId - Enclosing flow run identifier.
|
|
113
|
+
* @param {string} messageId - Target `WireFrameRecord.messageId`.
|
|
114
|
+
* @param {string} callId - Tool call ID of the `activateSkill` invocation.
|
|
115
|
+
* @param {string} compactedTombstone - Tombstone replacement string for cross-model escalations.
|
|
116
|
+
*
|
|
117
|
+
* @returns {Promise<void>} Resolves once the tombstone entry is recorded.
|
|
118
|
+
*/
|
|
119
|
+
markFrameTombstone(runId: string, messageId: string, callId: string, compactedTombstone: string): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Reconstructs the ordered `WireFrameRecord[]` ancestor chain from Turn 0 through `leafMessageId`.
|
|
122
|
+
*
|
|
123
|
+
* Traverses `parentMessageId` links and returns frames in chronological root-to-leaf order.
|
|
124
|
+
*
|
|
125
|
+
* @param {string} leafMessageId - Identifier of the trailing message frame in the chain.
|
|
126
|
+
*
|
|
127
|
+
* @returns {Promise<readonly WireFrameRecord[]>} Ordered root-to-leaf wire frame sequence.
|
|
128
|
+
*/
|
|
129
|
+
getMessageChain(leafMessageId: string): Promise<readonly WireFrameRecord[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Persists a `SuspendedForkRecord` when a child fork suspends on an upward or sibling interrupt.
|
|
132
|
+
*
|
|
133
|
+
* Stores the monotonic `suspendedForkId` (`${forkId}#${suspensionEpoch}`) and continuation stack.
|
|
134
|
+
*
|
|
135
|
+
* @param {SuspendedForkRecord} record - Suspended fork snapshot and continuation stack.
|
|
136
|
+
*
|
|
137
|
+
* @returns {Promise<void>} Resolves once the suspension record is persisted.
|
|
138
|
+
*/
|
|
139
|
+
recordForkSuspension(record: SuspendedForkRecord): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Queries unresolved suspended fork records for `runId`, optionally filtered by `forkIds` or `parentStepExecId`.
|
|
142
|
+
*
|
|
143
|
+
* Excludes epochs already marked `'RESUMED'` or `'ABORTED'`.
|
|
144
|
+
*
|
|
145
|
+
* @param {string} runId - Enclosing flow run identifier.
|
|
146
|
+
* @param {GetSuspendedForksOptions} [opts] - Optional filter criteria.
|
|
147
|
+
*
|
|
148
|
+
* @returns {Promise<readonly SuspendedForkRecord[]>} Matching open suspended fork records.
|
|
149
|
+
*/
|
|
150
|
+
getSuspendedForks(runId: string, opts?: GetSuspendedForksOptions): Promise<readonly SuspendedForkRecord[]>;
|
|
151
|
+
/**
|
|
152
|
+
* Marks `suspendedForkId` and any earlier unresolved epochs `${forkId}#1 .. ${forkId}#${epoch}` as resolved.
|
|
153
|
+
*
|
|
154
|
+
* Prevents resolved suspension epochs from remaining open in subsequent queries.
|
|
155
|
+
*
|
|
156
|
+
* @param {string} suspendedForkId - Monotonic `${forkId}#${suspensionEpoch}` identifier.
|
|
157
|
+
* @param {'RESUMED' | 'ABORTED'} status - Resolution status.
|
|
158
|
+
*
|
|
159
|
+
* @returns {Promise<void>} Resolves once the status transition is committed.
|
|
160
|
+
*/
|
|
161
|
+
resolveSuspendedFork(suspendedForkId: string, status: 'RESUMED' | 'ABORTED'): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Records a step lifecycle transition (`'RUNNING' | 'COMPLETED' | 'INTERRUPTED' | 'FAILED' | 'SUSPENDED'`).
|
|
164
|
+
*
|
|
165
|
+
* Commits serialized output, scope checkpoints, and universal step telemetry.
|
|
166
|
+
*
|
|
167
|
+
* @param {RecordStepTransitionInput} transition - Step transition payload and telemetry snapshot.
|
|
168
|
+
*
|
|
169
|
+
* @returns {Promise<void>} Resolves once the step transition is persisted.
|
|
170
|
+
*/
|
|
171
|
+
recordStepTransition(transition: RecordStepTransitionInput): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Persists the terminal exit state and final scope receipt for `runId` and `itemKey`.
|
|
174
|
+
*
|
|
175
|
+
* Updates both `harness_terminal_receipts` and `harness_runs`.
|
|
176
|
+
*
|
|
177
|
+
* @param {string} runId - Completed flow run identifier.
|
|
178
|
+
* @param {string} itemKey - Work item deduplication key.
|
|
179
|
+
* @param {string} terminalState - Terminal exit state string.
|
|
180
|
+
* @param {string} [scopeReceiptJson] - Optional JSON-serialized final scope receipt.
|
|
181
|
+
*
|
|
182
|
+
* @returns {Promise<void>} Resolves once the terminal receipt is committed.
|
|
183
|
+
*/
|
|
184
|
+
recordRunTerminalReceipt(runId: string, itemKey: string, terminalState: string, scopeReceiptJson?: string): Promise<void>;
|
|
185
|
+
/**
|
|
186
|
+
* Retrieves the latest terminal run receipts keyed by `itemKey`.
|
|
187
|
+
*
|
|
188
|
+
* Used during prerequisite `syncRoot` wakeup and signal-correlated overlay commits.
|
|
189
|
+
*
|
|
190
|
+
* @param {readonly string[]} itemKeys - Work item keys to look up.
|
|
191
|
+
*
|
|
192
|
+
* @returns {Promise<ReadonlyMap<string, RunTerminalReceiptRecord>>} Map of `itemKey` to terminal receipt record.
|
|
193
|
+
*/
|
|
194
|
+
getRunTerminalReceipts(itemKeys: readonly string[]): Promise<ReadonlyMap<string, RunTerminalReceiptRecord>>;
|
|
195
|
+
/**
|
|
196
|
+
* Queries all non-terminal runs (`'QUEUED' | 'RUNNING' | 'WAITING' | 'SUSPENDED'`) on runtime startup.
|
|
197
|
+
*
|
|
198
|
+
* Returns active step checkpoints and continuation stacks for reboot crash recovery.
|
|
199
|
+
*
|
|
200
|
+
* @returns {Promise<readonly InterruptedStepBootRecord[]>} Non-terminal runs requiring recovery.
|
|
201
|
+
*/
|
|
202
|
+
getInterruptedStepsOnBoot(): Promise<readonly InterruptedStepBootRecord[]>;
|
|
203
|
+
/**
|
|
204
|
+
* Prunes raw `WireFrameRecord` payloads for a terminal `runId` while retaining canonical audit headers.
|
|
205
|
+
*
|
|
206
|
+
* Scoped strictly to `runId` so active runs sharing the same `itemKey` are never pruned.
|
|
207
|
+
*
|
|
208
|
+
* @param {string} runId - Terminal flow run identifier to compact.
|
|
209
|
+
*
|
|
210
|
+
* @returns {Promise<void>} Resolves once wire frames for `runId` are compacted.
|
|
211
|
+
*/
|
|
212
|
+
compactRunFrames(runId: string): Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* Closes the underlying `better-sqlite3` database connection.
|
|
215
|
+
*
|
|
216
|
+
* Releases file descriptors and WAL shared-memory locks held by this store instance.
|
|
217
|
+
*
|
|
218
|
+
* @returns {void} Returns nothing once the connection is closed.
|
|
219
|
+
*/
|
|
220
|
+
close(): void;
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=sqlite-ledger-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-ledger-store.d.ts","sourceRoot":"","sources":["../../src/stores/sqlite-ledger-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,WAAW,EACX,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAU3C,OAAO,EACL,KAAK,wBAAwB,EAK9B,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,KAAK,oBAAoB,EAK1B,MAAM,qCAAqC,CAAC;AAQ7C;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,mFAAmF;IACnF,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC;AAED;;;;;GAKG;AACH,qBAAa,iBAAkB,YAAW,WAAW;IACnD,uDAAuD;IACvD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoB;IACvC,+EAA+E;IAC/E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkC;IAExD;;;;;;OAMG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,iBAAiB,CACf,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,wBAAwB,GAC9B,OAAO,CAAC,SAAS,mBAAmB,EAAE,CAAC;IAI1C;;;;;;;;;OASG;IACH,oBAAoB,CAAC,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAM3F;;;;;;;;OAQG;IACH,oBAAoB,CAAC,UAAU,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAM1E;;;;;;;;;;;OAWG;IACH,wBAAwB,CACtB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC;IAahB;;;;;;;;OAQG;IACH,sBAAsB,CACpB,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;IAIzD;;;;;;OAMG;IACH,yBAAyB,IAAI,OAAO,CAAC,SAAS,yBAAyB,EAAE,CAAC;IAI1E;;;;;;;;OAQG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM9C;;;;;;OAMG;IACH,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import PQueue from 'p-queue';
|
|
2
|
+
import { openSqliteConnection } from '../ddl/internal/open-sqlite-connection.js';
|
|
3
|
+
import { compactRunFramesInSqlite } from './internal/sqlite-ledger-compaction-ops.js';
|
|
4
|
+
import { appendMessageFrameInSqlite, getMessageChainFromSqlite, markFrameTombstoneInSqlite, replaceMessageFrameInSqlite, } from './internal/sqlite-ledger-frame-ops.js';
|
|
5
|
+
import { getSuspendedForksFromSqlite, mutateLanePlanInSqlite, recordForkSuspensionInSqlite, resolveSuspendedForkInSqlite, } from './internal/sqlite-ledger-plan-and-fork-ops.js';
|
|
6
|
+
import { createOrResumeRunInSqlite, getRunTerminalReceiptsFromSqlite, recordRunTerminalReceiptInSqlite, updateRunInputInSqlite, } from './internal/sqlite-ledger-run-ops.js';
|
|
7
|
+
import { getInterruptedStepsOnBootFromSqlite, recordStepStartInSqlite, recordStepTransitionInSqlite, updateContinuationStackInSqlite, } from './internal/sqlite-ledger-step-ops.js';
|
|
8
|
+
/**
|
|
9
|
+
* WAL-mode SQLite implementation of the `@paraharness/core` `LedgerStore` runtime port.
|
|
10
|
+
*
|
|
11
|
+
* Persists flow runs, step continuation stacks, wire-frame chains, dynamic lane DAG mutations,
|
|
12
|
+
* and suspended fork records inside transactional SQLite tables serialized via `p-queue`.
|
|
13
|
+
*/
|
|
14
|
+
export class SqliteLedgerStore {
|
|
15
|
+
/** Underlying `better-sqlite3` database connection. */
|
|
16
|
+
db;
|
|
17
|
+
/** Single-concurrency FIFO queue serializing asynchronous store operations. */
|
|
18
|
+
queue = new PQueue({ concurrency: 1 });
|
|
19
|
+
/**
|
|
20
|
+
* Initializes a `SqliteLedgerStore` against a SQLite file path, `:memory:`, or existing `Database` instance.
|
|
21
|
+
*
|
|
22
|
+
* Applies WAL-mode PRAGMAs and idempotent ledger DDL statements on initialization.
|
|
23
|
+
*
|
|
24
|
+
* @param {string | Database.Database} uriOrDb - SQLite database URI or open `better-sqlite3` handle.
|
|
25
|
+
*/
|
|
26
|
+
constructor(uriOrDb) {
|
|
27
|
+
this.db = openSqliteConnection(uriOrDb);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new flow run row (`status: 'RUNNING'`) or resumes an existing run.
|
|
31
|
+
*
|
|
32
|
+
* Pins `compiledPrefixesJson` on initial creation and returns completed step outputs for `.inputFrom()`.
|
|
33
|
+
*
|
|
34
|
+
* @param {CreateOrResumeRunInput} run - Run initialization or resume request payload.
|
|
35
|
+
*
|
|
36
|
+
* @returns {Promise<CreateOrResumeRunResult>} Current persisted state and completed step outputs.
|
|
37
|
+
*/
|
|
38
|
+
createOrResumeRun(run) {
|
|
39
|
+
return this.queue.add(() => this.db.transaction(() => createOrResumeRunInSqlite(this.db, run))());
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Records the start of a flow step execution and initializes its `ContinuationFrame[]` stack.
|
|
43
|
+
*
|
|
44
|
+
* Persists `baseScopeCheckpoint` and `executableId` for reboot recovery.
|
|
45
|
+
*
|
|
46
|
+
* @param {RecordStepStartInput} step - Step start metadata and initial continuation stack.
|
|
47
|
+
*
|
|
48
|
+
* @returns {Promise<void>} Resolves once the step start is committed.
|
|
49
|
+
*/
|
|
50
|
+
recordStepStart(step) {
|
|
51
|
+
return this.queue.add(() => {
|
|
52
|
+
this.db.transaction(() => recordStepStartInSqlite(this.db, step))();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Atomically updates the serialized `ContinuationFrame[]` stack for `stepExecId`.
|
|
57
|
+
*
|
|
58
|
+
* Optionally updates `baseScopeCheckpoint` after prerequisite `syncRoot` wakeup.
|
|
59
|
+
*
|
|
60
|
+
* @param {string} runId - Enclosing flow run identifier.
|
|
61
|
+
* @param {string} stepExecId - Target step execution identifier.
|
|
62
|
+
* @param {readonly ContinuationFrame[]} continuationStack - Updated outer-to-inner continuation stack.
|
|
63
|
+
* @param {UpdateContinuationStackOptions} [opts] - Optional updated base scope checkpoint.
|
|
64
|
+
*
|
|
65
|
+
* @returns {Promise<void>} Resolves once the continuation stack is persisted.
|
|
66
|
+
*/
|
|
67
|
+
updateContinuationStack(runId, stepExecId, continuationStack, opts) {
|
|
68
|
+
return this.queue.add(() => {
|
|
69
|
+
updateContinuationStackInSqlite(this.db, {
|
|
70
|
+
runId,
|
|
71
|
+
stepExecId,
|
|
72
|
+
continuationStack,
|
|
73
|
+
baseScopeCheckpoint: opts?.baseScopeCheckpoint,
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Updates a run's serialized flow input payload and optional pending rewind target step ID.
|
|
79
|
+
*
|
|
80
|
+
* Used during `.replaceWith()` step promotion and `.onSignal().rewindTo()` transitions.
|
|
81
|
+
*
|
|
82
|
+
* @param {string} runId - Target flow run identifier.
|
|
83
|
+
* @param {UpdateRunInputParams} update - Updated input JSON and rewind target.
|
|
84
|
+
*
|
|
85
|
+
* @returns {Promise<void>} Resolves once the run input update is committed.
|
|
86
|
+
*/
|
|
87
|
+
updateRunInput(runId, update) {
|
|
88
|
+
return this.queue.add(() => {
|
|
89
|
+
updateRunInputInSqlite(this.db, runId, update);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Atomically chains spawned prerequisite items and validates DAG acyclicity and `maxPrerequisiteDepth`.
|
|
94
|
+
*
|
|
95
|
+
* Rejects cycles and depth limit breaches before committing any edge to SQLite.
|
|
96
|
+
*
|
|
97
|
+
* @param {MutateLanePlanRequest} req - Lane plan mutation request.
|
|
98
|
+
*
|
|
99
|
+
* @returns {Promise<void>} Resolves once the lane DAG mutation is committed.
|
|
100
|
+
*/
|
|
101
|
+
mutateLanePlan(req) {
|
|
102
|
+
return this.queue.add(() => {
|
|
103
|
+
this.db.transaction(() => mutateLanePlanInSqlite(this.db, req))();
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Appends a new `WireFrameRecord` to the conversation transcript for `runId`.
|
|
108
|
+
*
|
|
109
|
+
* Persists both raw vendor wire bytes and canonical message projections.
|
|
110
|
+
*
|
|
111
|
+
* @param {string} runId - Enclosing flow run identifier.
|
|
112
|
+
* @param {WireFrameRecord} frame - Immutable wire frame record to append.
|
|
113
|
+
*
|
|
114
|
+
* @returns {Promise<void>} Resolves once the frame is persisted.
|
|
115
|
+
*/
|
|
116
|
+
appendMessageFrame(runId, frame) {
|
|
117
|
+
return this.queue.add(() => {
|
|
118
|
+
appendMessageFrameInSqlite(this.db, runId, frame);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Replaces an existing `WireFrameRecord` in-place (such as after `appendToolResultNotes`).
|
|
123
|
+
*
|
|
124
|
+
* Updates `rawWireFrame` and `canonical` while preserving `messageId` and `parentMessageId`.
|
|
125
|
+
*
|
|
126
|
+
* @param {string} runId - Enclosing flow run identifier.
|
|
127
|
+
* @param {WireFrameRecord} frame - Updated wire frame record.
|
|
128
|
+
*
|
|
129
|
+
* @returns {Promise<void>} Resolves once the frame replacement is committed.
|
|
130
|
+
*/
|
|
131
|
+
replaceMessageFrame(runId, frame) {
|
|
132
|
+
return this.queue.add(() => {
|
|
133
|
+
replaceMessageFrameInSqlite(this.db, runId, frame);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Records a per-`callId` compacted skill tombstone on an earlier `activateSkill` message frame.
|
|
138
|
+
*
|
|
139
|
+
* Updates `compactedTombstones[callId]` without mutating `rawWireFrame`.
|
|
140
|
+
*
|
|
141
|
+
* @param {string} runId - Enclosing flow run identifier.
|
|
142
|
+
* @param {string} messageId - Target `WireFrameRecord.messageId`.
|
|
143
|
+
* @param {string} callId - Tool call ID of the `activateSkill` invocation.
|
|
144
|
+
* @param {string} compactedTombstone - Tombstone replacement string for cross-model escalations.
|
|
145
|
+
*
|
|
146
|
+
* @returns {Promise<void>} Resolves once the tombstone entry is recorded.
|
|
147
|
+
*/
|
|
148
|
+
markFrameTombstone(runId, messageId, callId, compactedTombstone) {
|
|
149
|
+
return this.queue.add(() => {
|
|
150
|
+
this.db.transaction(() => markFrameTombstoneInSqlite(this.db, {
|
|
151
|
+
runId,
|
|
152
|
+
messageId,
|
|
153
|
+
callId,
|
|
154
|
+
compactedTombstone,
|
|
155
|
+
}))();
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Reconstructs the ordered `WireFrameRecord[]` ancestor chain from Turn 0 through `leafMessageId`.
|
|
160
|
+
*
|
|
161
|
+
* Traverses `parentMessageId` links and returns frames in chronological root-to-leaf order.
|
|
162
|
+
*
|
|
163
|
+
* @param {string} leafMessageId - Identifier of the trailing message frame in the chain.
|
|
164
|
+
*
|
|
165
|
+
* @returns {Promise<readonly WireFrameRecord[]>} Ordered root-to-leaf wire frame sequence.
|
|
166
|
+
*/
|
|
167
|
+
getMessageChain(leafMessageId) {
|
|
168
|
+
return this.queue.add(() => getMessageChainFromSqlite(this.db, leafMessageId));
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Persists a `SuspendedForkRecord` when a child fork suspends on an upward or sibling interrupt.
|
|
172
|
+
*
|
|
173
|
+
* Stores the monotonic `suspendedForkId` (`${forkId}#${suspensionEpoch}`) and continuation stack.
|
|
174
|
+
*
|
|
175
|
+
* @param {SuspendedForkRecord} record - Suspended fork snapshot and continuation stack.
|
|
176
|
+
*
|
|
177
|
+
* @returns {Promise<void>} Resolves once the suspension record is persisted.
|
|
178
|
+
*/
|
|
179
|
+
recordForkSuspension(record) {
|
|
180
|
+
return this.queue.add(() => {
|
|
181
|
+
recordForkSuspensionInSqlite(this.db, record);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Queries unresolved suspended fork records for `runId`, optionally filtered by `forkIds` or `parentStepExecId`.
|
|
186
|
+
*
|
|
187
|
+
* Excludes epochs already marked `'RESUMED'` or `'ABORTED'`.
|
|
188
|
+
*
|
|
189
|
+
* @param {string} runId - Enclosing flow run identifier.
|
|
190
|
+
* @param {GetSuspendedForksOptions} [opts] - Optional filter criteria.
|
|
191
|
+
*
|
|
192
|
+
* @returns {Promise<readonly SuspendedForkRecord[]>} Matching open suspended fork records.
|
|
193
|
+
*/
|
|
194
|
+
getSuspendedForks(runId, opts) {
|
|
195
|
+
return this.queue.add(() => getSuspendedForksFromSqlite(this.db, runId, opts));
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Marks `suspendedForkId` and any earlier unresolved epochs `${forkId}#1 .. ${forkId}#${epoch}` as resolved.
|
|
199
|
+
*
|
|
200
|
+
* Prevents resolved suspension epochs from remaining open in subsequent queries.
|
|
201
|
+
*
|
|
202
|
+
* @param {string} suspendedForkId - Monotonic `${forkId}#${suspensionEpoch}` identifier.
|
|
203
|
+
* @param {'RESUMED' | 'ABORTED'} status - Resolution status.
|
|
204
|
+
*
|
|
205
|
+
* @returns {Promise<void>} Resolves once the status transition is committed.
|
|
206
|
+
*/
|
|
207
|
+
resolveSuspendedFork(suspendedForkId, status) {
|
|
208
|
+
return this.queue.add(() => {
|
|
209
|
+
this.db.transaction(() => resolveSuspendedForkInSqlite(this.db, suspendedForkId, status))();
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Records a step lifecycle transition (`'RUNNING' | 'COMPLETED' | 'INTERRUPTED' | 'FAILED' | 'SUSPENDED'`).
|
|
214
|
+
*
|
|
215
|
+
* Commits serialized output, scope checkpoints, and universal step telemetry.
|
|
216
|
+
*
|
|
217
|
+
* @param {RecordStepTransitionInput} transition - Step transition payload and telemetry snapshot.
|
|
218
|
+
*
|
|
219
|
+
* @returns {Promise<void>} Resolves once the step transition is persisted.
|
|
220
|
+
*/
|
|
221
|
+
recordStepTransition(transition) {
|
|
222
|
+
return this.queue.add(() => {
|
|
223
|
+
this.db.transaction(() => recordStepTransitionInSqlite(this.db, transition))();
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Persists the terminal exit state and final scope receipt for `runId` and `itemKey`.
|
|
228
|
+
*
|
|
229
|
+
* Updates both `harness_terminal_receipts` and `harness_runs`.
|
|
230
|
+
*
|
|
231
|
+
* @param {string} runId - Completed flow run identifier.
|
|
232
|
+
* @param {string} itemKey - Work item deduplication key.
|
|
233
|
+
* @param {string} terminalState - Terminal exit state string.
|
|
234
|
+
* @param {string} [scopeReceiptJson] - Optional JSON-serialized final scope receipt.
|
|
235
|
+
*
|
|
236
|
+
* @returns {Promise<void>} Resolves once the terminal receipt is committed.
|
|
237
|
+
*/
|
|
238
|
+
recordRunTerminalReceipt(runId, itemKey, terminalState, scopeReceiptJson) {
|
|
239
|
+
return this.queue.add(() => {
|
|
240
|
+
this.db.transaction(() => recordRunTerminalReceiptInSqlite(this.db, {
|
|
241
|
+
runId,
|
|
242
|
+
itemKey,
|
|
243
|
+
terminalState,
|
|
244
|
+
scopeReceiptJson,
|
|
245
|
+
}))();
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Retrieves the latest terminal run receipts keyed by `itemKey`.
|
|
250
|
+
*
|
|
251
|
+
* Used during prerequisite `syncRoot` wakeup and signal-correlated overlay commits.
|
|
252
|
+
*
|
|
253
|
+
* @param {readonly string[]} itemKeys - Work item keys to look up.
|
|
254
|
+
*
|
|
255
|
+
* @returns {Promise<ReadonlyMap<string, RunTerminalReceiptRecord>>} Map of `itemKey` to terminal receipt record.
|
|
256
|
+
*/
|
|
257
|
+
getRunTerminalReceipts(itemKeys) {
|
|
258
|
+
return this.queue.add(() => getRunTerminalReceiptsFromSqlite(this.db, itemKeys));
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Queries all non-terminal runs (`'QUEUED' | 'RUNNING' | 'WAITING' | 'SUSPENDED'`) on runtime startup.
|
|
262
|
+
*
|
|
263
|
+
* Returns active step checkpoints and continuation stacks for reboot crash recovery.
|
|
264
|
+
*
|
|
265
|
+
* @returns {Promise<readonly InterruptedStepBootRecord[]>} Non-terminal runs requiring recovery.
|
|
266
|
+
*/
|
|
267
|
+
getInterruptedStepsOnBoot() {
|
|
268
|
+
return this.queue.add(() => getInterruptedStepsOnBootFromSqlite(this.db));
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Prunes raw `WireFrameRecord` payloads for a terminal `runId` while retaining canonical audit headers.
|
|
272
|
+
*
|
|
273
|
+
* Scoped strictly to `runId` so active runs sharing the same `itemKey` are never pruned.
|
|
274
|
+
*
|
|
275
|
+
* @param {string} runId - Terminal flow run identifier to compact.
|
|
276
|
+
*
|
|
277
|
+
* @returns {Promise<void>} Resolves once wire frames for `runId` are compacted.
|
|
278
|
+
*/
|
|
279
|
+
compactRunFrames(runId) {
|
|
280
|
+
return this.queue.add(() => {
|
|
281
|
+
this.db.transaction(() => compactRunFramesInSqlite(this.db, runId))();
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Closes the underlying `better-sqlite3` database connection.
|
|
286
|
+
*
|
|
287
|
+
* Releases file descriptors and WAL shared-memory locks held by this store instance.
|
|
288
|
+
*
|
|
289
|
+
* @returns {void} Returns nothing once the connection is closed.
|
|
290
|
+
*/
|
|
291
|
+
close() {
|
|
292
|
+
this.db.close();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
//# sourceMappingURL=sqlite-ledger-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-ledger-store.js","sourceRoot":"","sources":["../../src/stores/sqlite-ledger-store.ts"],"names":[],"mappings":"AAcA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AACtF,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEL,2BAA2B,EAC3B,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAEL,yBAAyB,EACzB,gCAAgC,EAChC,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,mCAAmC,EACnC,uBAAuB,EACvB,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,sCAAsC,CAAC;AAU9C;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;I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AAG,EAAE;YACzB,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,CACvB,gCAAgC,CAAC,IAAI,CAAC,EAAE,EAAE;gBACxC,KAAK;gBACL,OAAO;gBACP,aAAa;gBACb,gBAAgB;aACjB,CAAC,CACH,EAAE,CAAC;QACN,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,sBAAsB,CACpB,QAA2B;QAE3B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,gCAAgC,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;OAMG;IACH,yBAAyB;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,mCAAmC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;;;;OAQG;IACH,gBAAgB,CAAC,KAAa;QAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;YACzB,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;QACxE,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK;QACH,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { LessonRecord, LessonStore } from '@paraharness/core';
|
|
2
|
+
import type Database from 'better-sqlite3';
|
|
3
|
+
import type { AdmitLessonParams } from './internal/admit-lesson-params.js';
|
|
4
|
+
import { type LessonOutcomeEntryParams, type QueryLessonCandidatesParams } from './internal/sqlite-lesson-ops.js';
|
|
5
|
+
/**
|
|
6
|
+
* WAL-mode SQLite implementation of the `@paraharness/core` `LessonStore` runtime port.
|
|
7
|
+
*
|
|
8
|
+
* Persists distilled empirical lessons, computes normalized candidate relevance $R(L, Q) \in [0, 1]$,
|
|
9
|
+
* tracks 4-state execution outcomes, synchronizes creation epochs, and enforces signal cooldowns.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SqliteLessonStore implements LessonStore {
|
|
12
|
+
/** Underlying `better-sqlite3` database connection. */
|
|
13
|
+
private readonly db;
|
|
14
|
+
/** Single-concurrency FIFO queue serializing asynchronous store operations. */
|
|
15
|
+
private readonly queue;
|
|
16
|
+
/**
|
|
17
|
+
* Initializes a `SqliteLessonStore` against a SQLite file path, `:memory:`, or existing `Database` handle.
|
|
18
|
+
*
|
|
19
|
+
* Applies WAL-mode PRAGMAs and idempotent lesson store DDL statements on initialization.
|
|
20
|
+
*
|
|
21
|
+
* @param {string | Database.Database} uriOrDb - SQLite database URI or open `better-sqlite3` handle.
|
|
22
|
+
*/
|
|
23
|
+
constructor(uriOrDb: string | Database.Database);
|
|
24
|
+
/**
|
|
25
|
+
* Queries non-retired candidate lessons relevant to `req.queryText` and `req.partitions`.
|
|
26
|
+
*
|
|
27
|
+
* Populates `relevanceScore` in `[0, 1]` on each returned `LessonRecord`.
|
|
28
|
+
*
|
|
29
|
+
* @param {QueryLessonCandidatesParams} req - Search query and active partitions.
|
|
30
|
+
*
|
|
31
|
+
* @returns {Promise<readonly LessonRecord[]>} Candidate lesson records with `relevanceScore` populated.
|
|
32
|
+
*/
|
|
33
|
+
queryCandidates(req: QueryLessonCandidatesParams): Promise<readonly LessonRecord[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Persists a newly distilled lesson into the store and returns its assigned `lessonId`.
|
|
36
|
+
*
|
|
37
|
+
* Deduplicates identical `(partition, directive)` entries and records `epochAtCreation` and `createdByRunId`.
|
|
38
|
+
*
|
|
39
|
+
* @param {AdmitLessonParams} lesson - Lesson definition to admit.
|
|
40
|
+
*
|
|
41
|
+
* @returns {Promise<string>} Newly assigned or content-addressed `lessonId`.
|
|
42
|
+
*/
|
|
43
|
+
admit(lesson: AdmitLessonParams): Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Appends deduplicated step execution outcomes to the specified lessons and returns their updated records.
|
|
46
|
+
*
|
|
47
|
+
* Increments `totalCleanPasses` or `totalViolated` and updates each lesson's `recentOutcomes` window.
|
|
48
|
+
*
|
|
49
|
+
* @param {readonly LessonOutcomeEntryParams[]} outcomes - Batch of `(lessonId, outcome)` pairs.
|
|
50
|
+
*
|
|
51
|
+
* @returns {Promise<readonly LessonRecord[]>} Updated lesson records reflecting the recorded outcomes.
|
|
52
|
+
*/
|
|
53
|
+
recordOutcomes(outcomes: readonly LessonOutcomeEntryParams[]): Promise<readonly LessonRecord[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Aligns `epochAtCreation` for lessons created by `runIds` when their topology overlays commit to the base store.
|
|
56
|
+
*
|
|
57
|
+
* Prevents lessons authored in a run that also updated a partition's contract from being falsely penalized for epoch drift.
|
|
58
|
+
*
|
|
59
|
+
* @param {readonly string[]} runIds - Run IDs whose topology overlays were committed.
|
|
60
|
+
* @param {ReadonlyMap<string, number>} updatedEpochs - Map of `partitionId` to newly committed base epoch.
|
|
61
|
+
*
|
|
62
|
+
* @returns {Promise<void>} Resolves when creation epochs are synchronized.
|
|
63
|
+
*/
|
|
64
|
+
syncCreationEpochsForRuns(runIds: readonly string[], updatedEpochs: ReadonlyMap<string, number>): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Records the ISO-8601 timestamp when a promotion signal was emitted for `lessonId`.
|
|
67
|
+
*
|
|
68
|
+
* Persists the timestamp in `signalLastEmittedAt[signalId]` to enforce `cooldownHours` across restarts.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} lessonId - Identifier of the lesson that triggered the signal.
|
|
71
|
+
* @param {string} signalId - Identifier of the emitted signal.
|
|
72
|
+
* @param {string} emittedAt - ISO-8601 timestamp string of the emission.
|
|
73
|
+
*
|
|
74
|
+
* @returns {Promise<void>} Resolves when the cooldown timestamp is persisted.
|
|
75
|
+
*/
|
|
76
|
+
markSignalEmitted(lessonId: string, signalId: string, emittedAt: string): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Permanently retires lessons that breached violation or low clean-pass-rate thresholds.
|
|
79
|
+
*
|
|
80
|
+
* Excludes retired lessons from all subsequent `queryCandidates()` recalls.
|
|
81
|
+
*
|
|
82
|
+
* @param {readonly string[]} lessonIds - Identifiers of lessons to retire.
|
|
83
|
+
*
|
|
84
|
+
* @returns {Promise<void>} Resolves when all specified lessons are retired.
|
|
85
|
+
*/
|
|
86
|
+
retire(lessonIds: readonly string[]): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Closes the underlying `better-sqlite3` database connection.
|
|
89
|
+
*
|
|
90
|
+
* Releases file descriptors and WAL shared-memory locks held by this store instance.
|
|
91
|
+
*
|
|
92
|
+
* @returns {void} Returns nothing once the connection is closed.
|
|
93
|
+
*/
|
|
94
|
+
close(): void;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=sqlite-lesson-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-lesson-store.d.ts","sourceRoot":"","sources":["../../src/stores/sqlite-lesson-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAG3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAOjC,MAAM,iCAAiC,CAAC;AAEzC;;;;;GAKG;AACH,qBAAa,iBAAkB,YAAW,WAAW;IACnD,uDAAuD;IACvD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoB;IACvC,+EAA+E;IAC/E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkC;IAExD;;;;;;OAMG;gBACS,O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