@defai.digital/sqlite-adapter 13.0.3

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 ADDED
@@ -0,0 +1,214 @@
1
+ AutomatosX Open Source Edition - Apache License 2.0
2
+
3
+ This license applies ONLY to the AutomatosX Open Source Edition code
4
+ published on GitHub at https://github.com/defai-digital/automatosx
5
+
6
+ This license does NOT apply to:
7
+ - AutomatosX Pro Edition (proprietary software - separate EULA)
8
+ - AutomatosX Enterprise Edition (proprietary software - separate agreement)
9
+
10
+ For commercial editions, see COMMERCIAL-LICENSE.md
11
+
12
+ ===============================================================================
13
+
14
+ Apache License
15
+ Version 2.0, January 2004
16
+ http://www.apache.org/licenses/
17
+
18
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
19
+
20
+ 1. Definitions.
21
+
22
+ "License" shall mean the terms and conditions for use, reproduction,
23
+ and distribution as defined by Sections 1 through 9 of this document.
24
+
25
+ "Licensor" shall mean the copyright owner or entity authorized by
26
+ the copyright owner that is granting the License.
27
+
28
+ "Legal Entity" shall mean the union of the acting entity and all
29
+ other entities that control, are controlled by, or are under common
30
+ control with that entity. For the purposes of this definition,
31
+ "control" means (i) the power, direct or indirect, to cause the
32
+ direction or management of such entity, whether by contract or
33
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
34
+ outstanding shares, or (iii) beneficial ownership of such entity.
35
+
36
+ "You" (or "Your") shall mean an individual or Legal Entity
37
+ exercising permissions granted by this License.
38
+
39
+ "Source" form shall mean the preferred form for making modifications,
40
+ including but not limited to software source code, documentation
41
+ source, and configuration files.
42
+
43
+ "Object" form shall mean any form resulting from mechanical
44
+ transformation or translation of a Source form, including but
45
+ not limited to compiled object code, generated documentation,
46
+ and conversions to other media types.
47
+
48
+ "Work" shall mean the work of authorship, whether in Source or
49
+ Object form, made available under the License, as indicated by a
50
+ copyright notice that is included in or attached to the work
51
+ (an example is provided in the Appendix below).
52
+
53
+ "Derivative Works" shall mean any work, whether in Source or Object
54
+ form, that is based on (or derived from) the Work and for which the
55
+ editorial revisions, annotations, elaborations, or other modifications
56
+ represent, as a whole, an original work of authorship. For the purposes
57
+ of this License, Derivative Works shall not include works that remain
58
+ separable from, or merely link (or bind by name) to the interfaces of,
59
+ the Work and Derivative Works thereof.
60
+
61
+ "Contribution" shall mean any work of authorship, including
62
+ the original version of the Work and any modifications or additions
63
+ to that Work or Derivative Works thereof, that is intentionally
64
+ submitted to Licensor for inclusion in the Work by the copyright owner
65
+ or by an individual or Legal Entity authorized to submit on behalf of
66
+ the copyright owner. For the purposes of this definition, "submitted"
67
+ means any form of electronic, verbal, or written communication sent
68
+ to the Licensor or its representatives, including but not limited to
69
+ communication on electronic mailing lists, source code control systems,
70
+ and issue tracking systems that are managed by, or on behalf of, the
71
+ Licensor for the purpose of discussing and improving the Work, but
72
+ excluding communication that is conspicuously marked or otherwise
73
+ designated in writing by the copyright owner as "Not a Contribution."
74
+
75
+ "Contributor" shall mean Licensor and any individual or Legal Entity
76
+ on behalf of whom a Contribution has been received by Licensor and
77
+ subsequently incorporated within the Work.
78
+
79
+ 2. Grant of Copyright License. Subject to the terms and conditions of
80
+ this License, each Contributor hereby grants to You a perpetual,
81
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
82
+ copyright license to reproduce, prepare Derivative Works of,
83
+ publicly display, publicly perform, sublicense, and distribute the
84
+ Work and such Derivative Works in Source or Object form.
85
+
86
+ 3. Grant of Patent License. Subject to the terms and conditions of
87
+ this License, each Contributor hereby grants to You a perpetual,
88
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
89
+ (except as stated in this section) patent license to make, have made,
90
+ use, offer to sell, sell, import, and otherwise transfer the Work,
91
+ where such license applies only to those patent claims licensable
92
+ by such Contributor that are necessarily infringed by their
93
+ Contribution(s) alone or by combination of their Contribution(s)
94
+ with the Work to which such Contribution(s) was submitted. If You
95
+ institute patent litigation against any entity (including a
96
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
97
+ or a Contribution incorporated within the Work constitutes direct
98
+ or contributory patent infringement, then any patent licenses
99
+ granted to You under this License for that Work shall terminate
100
+ as of the date such litigation is filed.
101
+
102
+ 4. Redistribution. You may reproduce and distribute copies of the
103
+ Work or Derivative Works thereof in any medium, with or without
104
+ modifications, and in Source or Object form, provided that You
105
+ meet the following conditions:
106
+
107
+ (a) You must give any other recipients of the Work or
108
+ Derivative Works a copy of this License; and
109
+
110
+ (b) You must cause any modified files to carry prominent notices
111
+ stating that You changed the files; and
112
+
113
+ (c) You must retain, in the Source form of any Derivative Works
114
+ that You distribute, all copyright, patent, trademark, and
115
+ attribution notices from the Source form of the Work,
116
+ excluding those notices that do not pertain to any part of
117
+ the Derivative Works; and
118
+
119
+ (d) If the Work includes a "NOTICE" text file as part of its
120
+ distribution, then any Derivative Works that You distribute must
121
+ include a readable copy of the attribution notices contained
122
+ within such NOTICE file, excluding those notices that do not
123
+ pertain to any part of the Derivative Works, in at least one
124
+ of the following places: within a NOTICE text file distributed
125
+ as part of the Derivative Works; within the Source form or
126
+ documentation, if provided along with the Derivative Works; or,
127
+ within a display generated by the Derivative Works, if and
128
+ wherever such third-party notices normally appear. The contents
129
+ of the NOTICE file are for informational purposes only and
130
+ do not modify the License. You may add Your own attribution
131
+ notices within Derivative Works that You distribute, alongside
132
+ or as an addendum to the NOTICE text from the Work, provided
133
+ that such additional attribution notices cannot be construed
134
+ as modifying the License.
135
+
136
+ You may add Your own copyright statement to Your modifications and
137
+ may provide additional or different license terms and conditions
138
+ for use, reproduction, or distribution of Your modifications, or
139
+ for any such Derivative Works as a whole, provided Your use,
140
+ reproduction, and distribution of the Work otherwise complies with
141
+ the conditions stated in this License.
142
+
143
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
144
+ any Contribution intentionally submitted for inclusion in the Work
145
+ by You to the Licensor shall be under the terms and conditions of
146
+ this License, without any additional terms or conditions.
147
+ Notwithstanding the above, nothing herein shall supersede or modify
148
+ the terms of any separate license agreement you may have executed
149
+ with Licensor regarding such Contributions.
150
+
151
+ 6. Trademarks. This License does not grant permission to use the trade
152
+ names, trademarks, service marks, or product names of the Licensor,
153
+ except as required for reasonable and customary use in describing the
154
+ origin of the Work and reproducing the content of the NOTICE file.
155
+
156
+ 7. Disclaimer of Warranty. Unless required by applicable law or
157
+ agreed to in writing, Licensor provides the Work (and each
158
+ Contributor provides its Contributions) on an "AS IS" BASIS,
159
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
160
+ implied, including, without limitation, any warranties or conditions
161
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
162
+ PARTICULAR PURPOSE. You are solely responsible for determining the
163
+ appropriateness of using or redistributing the Work and assume any
164
+ risks associated with Your exercise of permissions under this License.
165
+
166
+ 8. Limitation of Liability. In no event and under no legal theory,
167
+ whether in tort (including negligence), contract, or otherwise,
168
+ unless required by applicable law (such as deliberate and grossly
169
+ negligent acts) or agreed to in writing, shall any Contributor be
170
+ liable to You for damages, including any direct, indirect, special,
171
+ incidental, or consequential damages of any character arising as a
172
+ result of this License or out of the use or inability to use the
173
+ Work (including but not limited to damages for loss of goodwill,
174
+ work stoppage, computer failure or malfunction, or any and all
175
+ other commercial damages or losses), even if such Contributor
176
+ has been advised of the possibility of such damages.
177
+
178
+ 9. Accepting Warranty or Additional Liability. While redistributing
179
+ the Work or Derivative Works thereof, You may choose to offer,
180
+ and charge a fee for, acceptance of support, warranty, indemnity,
181
+ or other liability obligations and/or rights consistent with this
182
+ License. However, in accepting such obligations, You may act only
183
+ on Your own behalf and on Your sole responsibility, not on behalf
184
+ of any other Contributor, and only if You agree to indemnify,
185
+ defend, and hold each Contributor harmless for any liability
186
+ incurred by, or claims asserted against, such Contributor by reason
187
+ of your accepting any such warranty or additional liability.
188
+
189
+ END OF TERMS AND CONDITIONS
190
+
191
+ APPENDIX: How to apply the Apache License to your work.
192
+
193
+ To apply the Apache License to your work, attach the following
194
+ boilerplate notice, with the fields enclosed by brackets "[]"
195
+ replaced with your own identifying information. (Don't include
196
+ the brackets!) The text should be enclosed in the appropriate
197
+ comment syntax for the file format. We also recommend that a
198
+ file or class name and description of purpose be included on the
199
+ same "printed page" as the copyright notice for easier
200
+ identification within third-party archives.
201
+
202
+ Copyright 2024-2025 DEFAI Private Limited
203
+
204
+ Licensed under the Apache License, Version 2.0 (the "License");
205
+ you may not use this file except in compliance with the License.
206
+ You may obtain a copy of the License at
207
+
208
+ http://www.apache.org/licenses/LICENSE-2.0
209
+
210
+ Unless required by applicable law or agreed to in writing, software
211
+ distributed under the License is distributed on an "AS IS" BASIS,
212
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
213
+ See the License for the specific language governing permissions and
214
+ limitations under the License.
@@ -0,0 +1,80 @@
1
+ /**
2
+ * SQLite Checkpoint Storage Implementation
3
+ *
4
+ * Persistent storage for agent execution checkpoints.
5
+ *
6
+ * Invariants:
7
+ * - INV-CP-001: Checkpoint contains all data needed to resume
8
+ * - INV-CP-002: Resumed execution starts from step after checkpoint
9
+ */
10
+ import type { Checkpoint } from '@defai.digital/contracts';
11
+ import type { CheckpointStorage } from '@defai.digital/agent-execution';
12
+ import type Database from 'better-sqlite3';
13
+ /**
14
+ * Error thrown by SQLite checkpoint store operations
15
+ */
16
+ export declare class SqliteCheckpointStoreError extends Error {
17
+ readonly code: string;
18
+ readonly details?: Record<string, unknown> | undefined;
19
+ constructor(code: string, message: string, details?: Record<string, unknown> | undefined);
20
+ }
21
+ /**
22
+ * Error codes for SQLite checkpoint store
23
+ */
24
+ export declare const SqliteCheckpointStoreErrorCodes: {
25
+ readonly DATABASE_ERROR: "SQLITE_CHECKPOINT_DATABASE_ERROR";
26
+ readonly INVALID_CHECKPOINT: "SQLITE_CHECKPOINT_INVALID";
27
+ readonly SERIALIZATION_ERROR: "SQLITE_CHECKPOINT_SERIALIZATION_ERROR";
28
+ readonly INVALID_TABLE_NAME: "SQLITE_CHECKPOINT_INVALID_TABLE_NAME";
29
+ };
30
+ /**
31
+ * SQLite implementation of CheckpointStorage
32
+ *
33
+ * Invariants:
34
+ * - INV-CP-001: All checkpoint data is serialized and stored
35
+ * - INV-CP-002: Checkpoints are retrieved in creation order for latest lookup
36
+ */
37
+ export declare class SqliteCheckpointStorage implements CheckpointStorage {
38
+ private readonly db;
39
+ private readonly tableName;
40
+ constructor(db: Database.Database, tableName?: string);
41
+ /**
42
+ * Initializes the database schema
43
+ */
44
+ private initialize;
45
+ /**
46
+ * Save a checkpoint
47
+ * INV-CP-001: All data needed to resume is stored
48
+ */
49
+ save(checkpoint: Checkpoint): Promise<void>;
50
+ /**
51
+ * Load a checkpoint by ID
52
+ */
53
+ load(checkpointId: string): Promise<Checkpoint | null>;
54
+ /**
55
+ * Load latest checkpoint for an agent
56
+ * INV-CP-002: Returns most recent checkpoint for proper resume
57
+ */
58
+ loadLatest(agentId: string, sessionId?: string): Promise<Checkpoint | null>;
59
+ /**
60
+ * List checkpoints for an agent
61
+ */
62
+ list(agentId: string, sessionId?: string): Promise<Checkpoint[]>;
63
+ /**
64
+ * Delete a checkpoint
65
+ */
66
+ delete(checkpointId: string): Promise<boolean>;
67
+ /**
68
+ * Delete expired checkpoints
69
+ */
70
+ deleteExpired(): Promise<number>;
71
+ /**
72
+ * Clears all checkpoints (for testing only)
73
+ */
74
+ clear(): void;
75
+ }
76
+ /**
77
+ * Creates a SQLite checkpoint storage
78
+ */
79
+ export declare function createSqliteCheckpointStorage(db: Database.Database, tableName?: string): SqliteCheckpointStorage;
80
+ //# sourceMappingURL=checkpoint-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-store.d.ts","sourceRoot":"","sources":["../src/checkpoint-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KA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E,QAAQ,CAAC,QAAQ,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,uBAAuB,CAEzB"}
@@ -0,0 +1,264 @@
1
+ /**
2
+ * SQLite Checkpoint Storage Implementation
3
+ *
4
+ * Persistent storage for agent execution checkpoints.
5
+ *
6
+ * Invariants:
7
+ * - INV-CP-001: Checkpoint contains all data needed to resume
8
+ * - INV-CP-002: Resumed execution starts from step after checkpoint
9
+ */
10
+ /**
11
+ * Error thrown by SQLite checkpoint store operations
12
+ */
13
+ export class SqliteCheckpointStoreError extends Error {
14
+ code;
15
+ details;
16
+ constructor(code, message, details) {
17
+ super(message);
18
+ this.code = code;
19
+ this.details = details;
20
+ this.name = 'SqliteCheckpointStoreError';
21
+ }
22
+ }
23
+ /**
24
+ * Error codes for SQLite checkpoint store
25
+ */
26
+ export const SqliteCheckpointStoreErrorCodes = {
27
+ DATABASE_ERROR: 'SQLITE_CHECKPOINT_DATABASE_ERROR',
28
+ INVALID_CHECKPOINT: 'SQLITE_CHECKPOINT_INVALID',
29
+ SERIALIZATION_ERROR: 'SQLITE_CHECKPOINT_SERIALIZATION_ERROR',
30
+ INVALID_TABLE_NAME: 'SQLITE_CHECKPOINT_INVALID_TABLE_NAME',
31
+ };
32
+ /**
33
+ * Validates a SQL table name to prevent SQL injection
34
+ * Only allows alphanumeric characters and underscores, must start with letter or underscore
35
+ */
36
+ function isValidTableName(name) {
37
+ return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(name) && name.length <= 64;
38
+ }
39
+ /**
40
+ * SQLite implementation of CheckpointStorage
41
+ *
42
+ * Invariants:
43
+ * - INV-CP-001: All checkpoint data is serialized and stored
44
+ * - INV-CP-002: Checkpoints are retrieved in creation order for latest lookup
45
+ */
46
+ export class SqliteCheckpointStorage {
47
+ db;
48
+ tableName;
49
+ constructor(db, tableName = 'checkpoints') {
50
+ // Validate table name to prevent SQL injection
51
+ if (!isValidTableName(tableName)) {
52
+ throw new SqliteCheckpointStoreError(SqliteCheckpointStoreErrorCodes.INVALID_TABLE_NAME, `Invalid table name: ${tableName}. Must start with letter or underscore, contain only alphanumeric and underscores, max 64 chars.`);
53
+ }
54
+ this.db = db;
55
+ this.tableName = tableName;
56
+ this.initialize();
57
+ }
58
+ /**
59
+ * Initializes the database schema
60
+ */
61
+ initialize() {
62
+ this.db.exec(`
63
+ CREATE TABLE IF NOT EXISTS ${this.tableName} (
64
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
65
+ checkpoint_id TEXT NOT NULL UNIQUE,
66
+ agent_id TEXT NOT NULL,
67
+ session_id TEXT,
68
+ workflow_id TEXT,
69
+ step_index INTEGER NOT NULL,
70
+ completed_step_id TEXT NOT NULL,
71
+ step_outputs TEXT NOT NULL,
72
+ context TEXT NOT NULL,
73
+ memory_snapshot TEXT,
74
+ created_at TEXT NOT NULL,
75
+ expires_at TEXT
76
+ );
77
+
78
+ CREATE INDEX IF NOT EXISTS idx_${this.tableName}_agent_id
79
+ ON ${this.tableName}(agent_id);
80
+
81
+ CREATE INDEX IF NOT EXISTS idx_${this.tableName}_agent_session
82
+ ON ${this.tableName}(agent_id, session_id);
83
+
84
+ CREATE INDEX IF NOT EXISTS idx_${this.tableName}_created_at
85
+ ON ${this.tableName}(created_at DESC);
86
+
87
+ CREATE INDEX IF NOT EXISTS idx_${this.tableName}_expires_at
88
+ ON ${this.tableName}(expires_at);
89
+ `);
90
+ }
91
+ /**
92
+ * Save a checkpoint
93
+ * INV-CP-001: All data needed to resume is stored
94
+ */
95
+ async save(checkpoint) {
96
+ try {
97
+ const stmt = this.db.prepare(`
98
+ INSERT OR REPLACE INTO ${this.tableName} (
99
+ checkpoint_id, agent_id, session_id, workflow_id,
100
+ step_index, completed_step_id, step_outputs, context,
101
+ memory_snapshot, created_at, expires_at
102
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
103
+ `);
104
+ stmt.run(checkpoint.checkpointId, checkpoint.agentId, checkpoint.sessionId ?? null, checkpoint.workflowId ?? null, checkpoint.stepIndex, checkpoint.completedStepId, JSON.stringify(checkpoint.stepOutputs), JSON.stringify(checkpoint.context), checkpoint.memorySnapshot !== undefined
105
+ ? JSON.stringify(checkpoint.memorySnapshot)
106
+ : null, checkpoint.createdAt, checkpoint.expiresAt ?? null);
107
+ }
108
+ catch (error) {
109
+ throw new SqliteCheckpointStoreError(SqliteCheckpointStoreErrorCodes.DATABASE_ERROR, `Failed to save checkpoint: ${error instanceof Error ? error.message : 'Unknown error'}`, { checkpointId: checkpoint.checkpointId });
110
+ }
111
+ }
112
+ /**
113
+ * Load a checkpoint by ID
114
+ */
115
+ async load(checkpointId) {
116
+ try {
117
+ const stmt = this.db.prepare(`
118
+ SELECT checkpoint_id, agent_id, session_id, workflow_id,
119
+ step_index, completed_step_id, step_outputs, context,
120
+ memory_snapshot, created_at, expires_at
121
+ FROM ${this.tableName}
122
+ WHERE checkpoint_id = ?
123
+ `);
124
+ const row = stmt.get(checkpointId);
125
+ return row !== undefined ? rowToCheckpoint(row) : null;
126
+ }
127
+ catch (error) {
128
+ throw new SqliteCheckpointStoreError(SqliteCheckpointStoreErrorCodes.DATABASE_ERROR, `Failed to load checkpoint: ${error instanceof Error ? error.message : 'Unknown error'}`, { checkpointId });
129
+ }
130
+ }
131
+ /**
132
+ * Load latest checkpoint for an agent
133
+ * INV-CP-002: Returns most recent checkpoint for proper resume
134
+ */
135
+ async loadLatest(agentId, sessionId) {
136
+ try {
137
+ let sql = `
138
+ SELECT checkpoint_id, agent_id, session_id, workflow_id,
139
+ step_index, completed_step_id, step_outputs, context,
140
+ memory_snapshot, created_at, expires_at
141
+ FROM ${this.tableName}
142
+ WHERE agent_id = ?
143
+ `;
144
+ const params = [agentId];
145
+ if (sessionId !== undefined) {
146
+ sql += ' AND session_id = ?';
147
+ params.push(sessionId);
148
+ }
149
+ sql += ' ORDER BY created_at DESC LIMIT 1';
150
+ const stmt = this.db.prepare(sql);
151
+ const row = stmt.get(...params);
152
+ return row !== undefined ? rowToCheckpoint(row) : null;
153
+ }
154
+ catch (error) {
155
+ throw new SqliteCheckpointStoreError(SqliteCheckpointStoreErrorCodes.DATABASE_ERROR, `Failed to load latest checkpoint: ${error instanceof Error ? error.message : 'Unknown error'}`, { agentId, sessionId });
156
+ }
157
+ }
158
+ /**
159
+ * List checkpoints for an agent
160
+ */
161
+ async list(agentId, sessionId) {
162
+ try {
163
+ let sql = `
164
+ SELECT checkpoint_id, agent_id, session_id, workflow_id,
165
+ step_index, completed_step_id, step_outputs, context,
166
+ memory_snapshot, created_at, expires_at
167
+ FROM ${this.tableName}
168
+ WHERE agent_id = ?
169
+ `;
170
+ const params = [agentId];
171
+ if (sessionId !== undefined) {
172
+ sql += ' AND session_id = ?';
173
+ params.push(sessionId);
174
+ }
175
+ sql += ' ORDER BY created_at DESC';
176
+ const stmt = this.db.prepare(sql);
177
+ const rows = stmt.all(...params);
178
+ return rows.map(rowToCheckpoint);
179
+ }
180
+ catch (error) {
181
+ throw new SqliteCheckpointStoreError(SqliteCheckpointStoreErrorCodes.DATABASE_ERROR, `Failed to list checkpoints: ${error instanceof Error ? error.message : 'Unknown error'}`, { agentId, sessionId });
182
+ }
183
+ }
184
+ /**
185
+ * Delete a checkpoint
186
+ */
187
+ async delete(checkpointId) {
188
+ try {
189
+ const stmt = this.db.prepare(`
190
+ DELETE FROM ${this.tableName} WHERE checkpoint_id = ?
191
+ `);
192
+ const result = stmt.run(checkpointId);
193
+ return result.changes > 0;
194
+ }
195
+ catch (error) {
196
+ throw new SqliteCheckpointStoreError(SqliteCheckpointStoreErrorCodes.DATABASE_ERROR, `Failed to delete checkpoint: ${error instanceof Error ? error.message : 'Unknown error'}`, { checkpointId });
197
+ }
198
+ }
199
+ /**
200
+ * Delete expired checkpoints
201
+ */
202
+ async deleteExpired() {
203
+ try {
204
+ const now = new Date().toISOString();
205
+ const stmt = this.db.prepare(`
206
+ DELETE FROM ${this.tableName}
207
+ WHERE expires_at IS NOT NULL AND expires_at < ?
208
+ `);
209
+ const result = stmt.run(now);
210
+ return result.changes;
211
+ }
212
+ catch (error) {
213
+ throw new SqliteCheckpointStoreError(SqliteCheckpointStoreErrorCodes.DATABASE_ERROR, `Failed to delete expired checkpoints: ${error instanceof Error ? error.message : 'Unknown error'}`);
214
+ }
215
+ }
216
+ /**
217
+ * Clears all checkpoints (for testing only)
218
+ */
219
+ clear() {
220
+ this.db.exec(`DELETE FROM ${this.tableName}`);
221
+ }
222
+ }
223
+ /**
224
+ * Safely parses JSON with error handling
225
+ */
226
+ function safeJsonParse(json, fieldName, checkpointId) {
227
+ try {
228
+ return JSON.parse(json);
229
+ }
230
+ catch (error) {
231
+ throw new SqliteCheckpointStoreError(SqliteCheckpointStoreErrorCodes.SERIALIZATION_ERROR, `Failed to parse ${fieldName} for checkpoint ${checkpointId}: ${error instanceof Error ? error.message : 'Invalid JSON'}`, { checkpointId, fieldName });
232
+ }
233
+ }
234
+ function rowToCheckpoint(row) {
235
+ const checkpoint = {
236
+ checkpointId: row.checkpoint_id,
237
+ agentId: row.agent_id,
238
+ stepIndex: row.step_index,
239
+ completedStepId: row.completed_step_id,
240
+ stepOutputs: safeJsonParse(row.step_outputs, 'stepOutputs', row.checkpoint_id),
241
+ context: safeJsonParse(row.context, 'context', row.checkpoint_id),
242
+ createdAt: row.created_at,
243
+ };
244
+ if (row.session_id !== null) {
245
+ checkpoint.sessionId = row.session_id;
246
+ }
247
+ if (row.workflow_id !== null) {
248
+ checkpoint.workflowId = row.workflow_id;
249
+ }
250
+ if (row.memory_snapshot !== null) {
251
+ checkpoint.memorySnapshot = safeJsonParse(row.memory_snapshot, 'memorySnapshot', row.checkpoint_id);
252
+ }
253
+ if (row.expires_at !== null) {
254
+ checkpoint.expiresAt = row.expires_at;
255
+ }
256
+ return checkpoint;
257
+ }
258
+ /**
259
+ * Creates a SQLite checkpoint storage
260
+ */
261
+ export function createSqliteCheckpointStorage(db, tableName) {
262
+ return new SqliteCheckpointStorage(db, tableName);
263
+ }
264
+ //# sourceMappingURL=checkpoint-store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C;IACxC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,EAAqB,EACrB,SAAkB;IAElB,OAAO,IAAI,uBAAuB,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * SQLite Dead Letter Storage Implementation
3
+ *
4
+ * Persistent storage for dead letter queue entries.
5
+ *
6
+ * Invariants:
7
+ * - INV-DLQ-001: Failed events captured with full context
8
+ * - INV-DLQ-002: Retries respect maxRetries limit
9
+ * - INV-DLQ-003: Exhausted entries marked appropriately
10
+ */
11
+ import type { DeadLetterEntry, DeadLetterStatus } from '@defai.digital/contracts';
12
+ import type { DeadLetterStorage } from '@defai.digital/cross-cutting';
13
+ import type Database from 'better-sqlite3';
14
+ /**
15
+ * Error thrown by SQLite dead letter store operations
16
+ */
17
+ export declare class SqliteDeadLetterStoreError extends Error {
18
+ readonly code: string;
19
+ readonly details?: Record<string, unknown> | undefined;
20
+ constructor(code: string, message: string, details?: Record<string, unknown> | undefined);
21
+ }
22
+ /**
23
+ * Error codes for SQLite dead letter store
24
+ */
25
+ export declare const SqliteDeadLetterStoreErrorCodes: {
26
+ readonly DATABASE_ERROR: "SQLITE_DLQ_DATABASE_ERROR";
27
+ readonly INVALID_ENTRY: "SQLITE_DLQ_INVALID_ENTRY";
28
+ readonly SERIALIZATION_ERROR: "SQLITE_DLQ_SERIALIZATION_ERROR";
29
+ readonly INVALID_TABLE_NAME: "SQLITE_DLQ_INVALID_TABLE_NAME";
30
+ };
31
+ /**
32
+ * SQLite implementation of DeadLetterStorage
33
+ *
34
+ * Invariants:
35
+ * - INV-DLQ-001: All entry data is serialized and stored
36
+ * - INV-DLQ-002: Status transitions tracked via updates
37
+ * - INV-DLQ-003: countByStatus provides accurate status breakdown
38
+ */
39
+ export declare class SqliteDeadLetterStorage implements DeadLetterStorage {
40
+ private readonly db;
41
+ private readonly tableName;
42
+ constructor(db: Database.Database, tableName?: string);
43
+ /**
44
+ * Initializes the database schema
45
+ */
46
+ private initialize;
47
+ /**
48
+ * Add entry to DLQ
49
+ * INV-DLQ-001: All context captured
50
+ */
51
+ add(entry: DeadLetterEntry): Promise<void>;
52
+ /**
53
+ * Get entry by ID
54
+ */
55
+ get(entryId: string): Promise<DeadLetterEntry | null>;
56
+ /**
57
+ * List entries with optional status filter
58
+ */
59
+ list(status?: DeadLetterStatus): Promise<DeadLetterEntry[]>;
60
+ /**
61
+ * Update entry
62
+ * INV-DLQ-002, INV-DLQ-003: Status transitions handled
63
+ */
64
+ update(entry: DeadLetterEntry): Promise<void>;
65
+ /**
66
+ * Delete entry
67
+ */
68
+ delete(entryId: string): Promise<boolean>;
69
+ /**
70
+ * Count entries by status
71
+ */
72
+ countByStatus(): Promise<Record<DeadLetterStatus, number>>;
73
+ /**
74
+ * Clears all entries (for testing only)
75
+ */
76
+ clear(): void;
77
+ }
78
+ /**
79
+ * Creates a SQLite dead letter storage
80
+ */
81
+ export declare function createSqliteDeadLetterStorage(db: Database.Database, tableName?: string): SqliteDeadLetterStorage;
82
+ //# sourceMappingURL=dead-letter-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dead-letter-store.d.ts","sourceRoot":"","sources":["../src/dead-letter-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;aAEjC,IAAI,EAAE,MAAM;aAEZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAFjC,IAAI,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM,EACC,OAAO,CAAC,EA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