@voltagent/libsql 1.0.14 → 2.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/edge.d.mts +111 -0
- package/dist/edge.d.ts +111 -0
- package/dist/edge.js +2195 -0
- package/dist/edge.js.map +1 -0
- package/dist/edge.mjs +2167 -0
- package/dist/edge.mjs.map +1 -0
- package/dist/index.d.mts +24 -391
- package/dist/index.d.ts +24 -391
- package/dist/index.js +223 -342
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +222 -345
- package/dist/index.mjs.map +1 -1
- package/dist/vector-core-CKn8FNVK.d.mts +274 -0
- package/dist/vector-core-CKn8FNVK.d.ts +274 -0
- package/package.json +23 -8
package/dist/index.js
CHANGED
|
@@ -41,12 +41,15 @@ module.exports = __toCommonJS(index_exports);
|
|
|
41
41
|
var import_node_fs = __toESM(require("fs"));
|
|
42
42
|
var import_node_path = __toESM(require("path"));
|
|
43
43
|
var import_client = require("@libsql/client");
|
|
44
|
+
var import_core2 = require("@voltagent/core");
|
|
45
|
+
var import_logger = require("@voltagent/logger");
|
|
46
|
+
|
|
47
|
+
// src/memory-core.ts
|
|
44
48
|
var import_core = require("@voltagent/core");
|
|
45
49
|
var import_internal = require("@voltagent/internal");
|
|
46
|
-
var
|
|
47
|
-
var LibSQLMemoryAdapter = class {
|
|
50
|
+
var LibSQLMemoryCore = class {
|
|
48
51
|
static {
|
|
49
|
-
__name(this, "
|
|
52
|
+
__name(this, "LibSQLMemoryCore");
|
|
50
53
|
}
|
|
51
54
|
client;
|
|
52
55
|
tablePrefix;
|
|
@@ -55,25 +58,14 @@ var LibSQLMemoryAdapter = class {
|
|
|
55
58
|
maxRetries;
|
|
56
59
|
retryDelayMs;
|
|
57
60
|
url;
|
|
58
|
-
constructor(options
|
|
61
|
+
constructor(client, url, options, logger) {
|
|
62
|
+
this.client = client;
|
|
63
|
+
this.url = url;
|
|
59
64
|
this.tablePrefix = options.tablePrefix ?? "voltagent_memory";
|
|
60
65
|
this.maxRetries = options.maxRetries ?? 3;
|
|
61
66
|
this.retryDelayMs = options.retryDelayMs ?? 100;
|
|
62
|
-
this.logger =
|
|
63
|
-
this.
|
|
64
|
-
if (this.url.startsWith("file:")) {
|
|
65
|
-
const dbPath = this.url.replace("file:", "");
|
|
66
|
-
const dbDir = import_node_path.default.dirname(dbPath);
|
|
67
|
-
if (dbDir && dbDir !== "." && !import_node_fs.default.existsSync(dbDir)) {
|
|
68
|
-
import_node_fs.default.mkdirSync(dbDir, { recursive: true });
|
|
69
|
-
this.logger.debug(`Created database directory: ${dbDir}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
this.client = (0, import_client.createClient)({
|
|
73
|
-
url: this.url,
|
|
74
|
-
authToken: options.authToken
|
|
75
|
-
});
|
|
76
|
-
this.logger.debug("LibSQL Memory adapter initialized", { url: this.url });
|
|
67
|
+
this.logger = logger;
|
|
68
|
+
this.logger.debug("LibSQL Memory adapter core initialized", { url: this.url });
|
|
77
69
|
}
|
|
78
70
|
/**
|
|
79
71
|
* Execute a database operation with retry logic
|
|
@@ -136,14 +128,12 @@ var LibSQLMemoryAdapter = class {
|
|
|
136
128
|
this.logger.debug("Applied PRAGMA settings for better concurrency");
|
|
137
129
|
await this.executeWithRetry(async () => {
|
|
138
130
|
await this.client.batch([
|
|
139
|
-
// Create users table (for user-level working memory)
|
|
140
131
|
`CREATE TABLE IF NOT EXISTS ${usersTable} (
|
|
141
132
|
id TEXT PRIMARY KEY,
|
|
142
133
|
metadata TEXT,
|
|
143
134
|
created_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
|
144
135
|
updated_at TEXT DEFAULT CURRENT_TIMESTAMP
|
|
145
136
|
)`,
|
|
146
|
-
// Create conversations table (matching existing structure)
|
|
147
137
|
`CREATE TABLE IF NOT EXISTS ${conversationsTable} (
|
|
148
138
|
id TEXT PRIMARY KEY,
|
|
149
139
|
resource_id TEXT NOT NULL,
|
|
@@ -153,7 +143,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
153
143
|
created_at TEXT NOT NULL,
|
|
154
144
|
updated_at TEXT NOT NULL
|
|
155
145
|
)`,
|
|
156
|
-
// Create messages table (matching existing structure)
|
|
157
146
|
`CREATE TABLE IF NOT EXISTS ${messagesTable} (
|
|
158
147
|
conversation_id TEXT NOT NULL,
|
|
159
148
|
message_id TEXT NOT NULL,
|
|
@@ -165,7 +154,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
165
154
|
created_at TEXT NOT NULL,
|
|
166
155
|
PRIMARY KEY (conversation_id, message_id)
|
|
167
156
|
)`,
|
|
168
|
-
// Create workflow states table
|
|
169
157
|
`CREATE TABLE IF NOT EXISTS ${workflowStatesTable} (
|
|
170
158
|
id TEXT PRIMARY KEY,
|
|
171
159
|
workflow_id TEXT NOT NULL,
|
|
@@ -181,7 +169,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
181
169
|
created_at TEXT NOT NULL,
|
|
182
170
|
updated_at TEXT NOT NULL
|
|
183
171
|
)`,
|
|
184
|
-
// Create conversation steps table
|
|
185
172
|
`CREATE TABLE IF NOT EXISTS ${stepsTable} (
|
|
186
173
|
id TEXT PRIMARY KEY,
|
|
187
174
|
conversation_id TEXT NOT NULL,
|
|
@@ -201,7 +188,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
201
188
|
created_at TEXT NOT NULL,
|
|
202
189
|
FOREIGN KEY (conversation_id) REFERENCES ${conversationsTable}(id) ON DELETE CASCADE
|
|
203
190
|
)`,
|
|
204
|
-
// Create indexes for better performance
|
|
205
191
|
`CREATE INDEX IF NOT EXISTS idx_${conversationsTable}_user_id ON ${conversationsTable}(user_id)`,
|
|
206
192
|
`CREATE INDEX IF NOT EXISTS idx_${conversationsTable}_resource_id ON ${conversationsTable}(resource_id)`,
|
|
207
193
|
`CREATE INDEX IF NOT EXISTS idx_${messagesTable}_conversation_id ON ${messagesTable}(conversation_id)`,
|
|
@@ -218,10 +204,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
218
204
|
this.initialized = true;
|
|
219
205
|
this.logger.debug("Database schema initialized");
|
|
220
206
|
}
|
|
221
|
-
/**
|
|
222
|
-
* Add new columns to messages table for V2 format if they don't exist
|
|
223
|
-
* This allows existing tables to support both old and new message formats
|
|
224
|
-
*/
|
|
225
207
|
async addV2ColumnsToMessagesTable() {
|
|
226
208
|
const messagesTableName = `${this.tablePrefix}_messages`;
|
|
227
209
|
try {
|
|
@@ -294,10 +276,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
294
276
|
} catch (_) {
|
|
295
277
|
}
|
|
296
278
|
}
|
|
297
|
-
/**
|
|
298
|
-
* Migrate default user_id values in messages table
|
|
299
|
-
* Updates messages with user_id='default' to use the actual user_id from their conversation
|
|
300
|
-
*/
|
|
301
279
|
async migrateDefaultUserIds() {
|
|
302
280
|
const messagesTableName = `${this.tablePrefix}_messages`;
|
|
303
281
|
const conversationsTableName = `${this.tablePrefix}_conversations`;
|
|
@@ -315,14 +293,14 @@ var LibSQLMemoryAdapter = class {
|
|
|
315
293
|
const result = await this.client.execute({
|
|
316
294
|
sql: `UPDATE ${messagesTableName}
|
|
317
295
|
SET user_id = (
|
|
318
|
-
SELECT c.user_id
|
|
319
|
-
FROM ${conversationsTableName} c
|
|
296
|
+
SELECT c.user_id
|
|
297
|
+
FROM ${conversationsTableName} c
|
|
320
298
|
WHERE c.id = ${messagesTableName}.conversation_id
|
|
321
299
|
)
|
|
322
300
|
WHERE user_id = 'default'
|
|
323
301
|
AND EXISTS (
|
|
324
|
-
SELECT 1
|
|
325
|
-
FROM ${conversationsTableName} c
|
|
302
|
+
SELECT 1
|
|
303
|
+
FROM ${conversationsTableName} c
|
|
326
304
|
WHERE c.id = ${messagesTableName}.conversation_id
|
|
327
305
|
)`,
|
|
328
306
|
args: []
|
|
@@ -346,10 +324,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
346
324
|
this.logger.error("Failed to migrate default user_ids", error);
|
|
347
325
|
}
|
|
348
326
|
}
|
|
349
|
-
/**
|
|
350
|
-
* Add new columns to workflow_states table for event persistence
|
|
351
|
-
* This migration adds support for events, output, and cancellation tracking
|
|
352
|
-
*/
|
|
353
327
|
async addWorkflowStateColumns() {
|
|
354
328
|
const workflowStatesTable = `${this.tablePrefix}_workflow_states`;
|
|
355
329
|
try {
|
|
@@ -385,9 +359,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
385
359
|
// ============================================================================
|
|
386
360
|
// Message Operations
|
|
387
361
|
// ============================================================================
|
|
388
|
-
/**
|
|
389
|
-
* Add a single message
|
|
390
|
-
*/
|
|
391
362
|
async addMessage(message, userId, conversationId) {
|
|
392
363
|
await this.initialize();
|
|
393
364
|
const messagesTable = `${this.tablePrefix}_messages`;
|
|
@@ -397,8 +368,14 @@ var LibSQLMemoryAdapter = class {
|
|
|
397
368
|
}
|
|
398
369
|
await this.executeWithRetry(async () => {
|
|
399
370
|
await this.client.execute({
|
|
400
|
-
sql: `INSERT INTO ${messagesTable} (conversation_id, message_id, user_id, role, parts, metadata, format_version, created_at)
|
|
401
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
371
|
+
sql: `INSERT INTO ${messagesTable} (conversation_id, message_id, user_id, role, parts, metadata, format_version, created_at)
|
|
372
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
373
|
+
ON CONFLICT(conversation_id, message_id) DO UPDATE SET
|
|
374
|
+
user_id = excluded.user_id,
|
|
375
|
+
role = excluded.role,
|
|
376
|
+
parts = excluded.parts,
|
|
377
|
+
metadata = excluded.metadata,
|
|
378
|
+
format_version = excluded.format_version`,
|
|
402
379
|
args: [
|
|
403
380
|
conversationId,
|
|
404
381
|
message.id,
|
|
@@ -407,15 +384,11 @@ var LibSQLMemoryAdapter = class {
|
|
|
407
384
|
(0, import_internal.safeStringify)(message.parts),
|
|
408
385
|
message.metadata ? (0, import_internal.safeStringify)(message.metadata) : null,
|
|
409
386
|
2,
|
|
410
|
-
// format_version
|
|
411
387
|
(/* @__PURE__ */ new Date()).toISOString()
|
|
412
388
|
]
|
|
413
389
|
});
|
|
414
390
|
}, "add message");
|
|
415
391
|
}
|
|
416
|
-
/**
|
|
417
|
-
* Add multiple messages
|
|
418
|
-
*/
|
|
419
392
|
async addMessages(messages, userId, conversationId) {
|
|
420
393
|
await this.initialize();
|
|
421
394
|
const messagesTable = `${this.tablePrefix}_messages`;
|
|
@@ -427,8 +400,14 @@ var LibSQLMemoryAdapter = class {
|
|
|
427
400
|
await this.executeWithRetry(async () => {
|
|
428
401
|
await this.client.batch(
|
|
429
402
|
messages.map((message) => ({
|
|
430
|
-
sql: `INSERT INTO ${messagesTable} (conversation_id, message_id, user_id, role, parts, metadata, format_version, created_at)
|
|
431
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
403
|
+
sql: `INSERT INTO ${messagesTable} (conversation_id, message_id, user_id, role, parts, metadata, format_version, created_at)
|
|
404
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
405
|
+
ON CONFLICT(conversation_id, message_id) DO UPDATE SET
|
|
406
|
+
user_id = excluded.user_id,
|
|
407
|
+
role = excluded.role,
|
|
408
|
+
parts = excluded.parts,
|
|
409
|
+
metadata = excluded.metadata,
|
|
410
|
+
format_version = excluded.format_version`,
|
|
432
411
|
args: [
|
|
433
412
|
conversationId,
|
|
434
413
|
message.id,
|
|
@@ -437,7 +416,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
437
416
|
(0, import_internal.safeStringify)(message.parts),
|
|
438
417
|
message.metadata ? (0, import_internal.safeStringify)(message.metadata) : null,
|
|
439
418
|
2,
|
|
440
|
-
// format_version
|
|
441
419
|
now
|
|
442
420
|
]
|
|
443
421
|
}))
|
|
@@ -510,9 +488,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
510
488
|
);
|
|
511
489
|
}, "save conversation steps");
|
|
512
490
|
}
|
|
513
|
-
/**
|
|
514
|
-
* Get messages with optional filtering
|
|
515
|
-
*/
|
|
516
491
|
async getMessages(userId, conversationId, options) {
|
|
517
492
|
await this.initialize();
|
|
518
493
|
const messagesTable = `${this.tablePrefix}_messages`;
|
|
@@ -620,9 +595,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
620
595
|
createdAt: row.created_at ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
621
596
|
}));
|
|
622
597
|
}
|
|
623
|
-
/**
|
|
624
|
-
* Clear messages for a user
|
|
625
|
-
*/
|
|
626
598
|
async clearMessages(userId, conversationId) {
|
|
627
599
|
await this.initialize();
|
|
628
600
|
const messagesTable = `${this.tablePrefix}_messages`;
|
|
@@ -657,9 +629,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
657
629
|
// ============================================================================
|
|
658
630
|
// Conversation Operations
|
|
659
631
|
// ============================================================================
|
|
660
|
-
/**
|
|
661
|
-
* Create a new conversation
|
|
662
|
-
*/
|
|
663
632
|
async createConversation(input) {
|
|
664
633
|
await this.initialize();
|
|
665
634
|
const conversationsTable = `${this.tablePrefix}_conversations`;
|
|
@@ -670,7 +639,7 @@ var LibSQLMemoryAdapter = class {
|
|
|
670
639
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
671
640
|
await this.executeWithRetry(async () => {
|
|
672
641
|
await this.client.execute({
|
|
673
|
-
sql: `INSERT INTO ${conversationsTable} (id, resource_id, user_id, title, metadata, created_at, updated_at)
|
|
642
|
+
sql: `INSERT INTO ${conversationsTable} (id, resource_id, user_id, title, metadata, created_at, updated_at)
|
|
674
643
|
VALUES (?, ?, ?, ?, ?, ?, ?)`,
|
|
675
644
|
args: [
|
|
676
645
|
input.id,
|
|
@@ -693,9 +662,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
693
662
|
updatedAt: now
|
|
694
663
|
};
|
|
695
664
|
}
|
|
696
|
-
/**
|
|
697
|
-
* Get a conversation by ID
|
|
698
|
-
*/
|
|
699
665
|
async getConversation(id) {
|
|
700
666
|
await this.initialize();
|
|
701
667
|
const conversationsTable = `${this.tablePrefix}_conversations`;
|
|
@@ -717,9 +683,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
717
683
|
updatedAt: row.updated_at
|
|
718
684
|
};
|
|
719
685
|
}
|
|
720
|
-
/**
|
|
721
|
-
* Get conversations by resource ID
|
|
722
|
-
*/
|
|
723
686
|
async getConversations(resourceId) {
|
|
724
687
|
await this.initialize();
|
|
725
688
|
const conversationsTable = `${this.tablePrefix}_conversations`;
|
|
@@ -737,15 +700,9 @@ var LibSQLMemoryAdapter = class {
|
|
|
737
700
|
updatedAt: row.updated_at
|
|
738
701
|
}));
|
|
739
702
|
}
|
|
740
|
-
/**
|
|
741
|
-
* Get conversations by user ID
|
|
742
|
-
*/
|
|
743
703
|
async getConversationsByUserId(userId, options) {
|
|
744
704
|
return this.queryConversations({ ...options, userId });
|
|
745
705
|
}
|
|
746
|
-
/**
|
|
747
|
-
* Query conversations with filters
|
|
748
|
-
*/
|
|
749
706
|
async queryConversations(options) {
|
|
750
707
|
await this.initialize();
|
|
751
708
|
const conversationsTable = `${this.tablePrefix}_conversations`;
|
|
@@ -781,9 +738,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
781
738
|
updatedAt: row.updated_at
|
|
782
739
|
}));
|
|
783
740
|
}
|
|
784
|
-
/**
|
|
785
|
-
* Update a conversation
|
|
786
|
-
*/
|
|
787
741
|
async updateConversation(id, updates) {
|
|
788
742
|
await this.initialize();
|
|
789
743
|
const conversationsTable = `${this.tablePrefix}_conversations`;
|
|
@@ -817,9 +771,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
817
771
|
}
|
|
818
772
|
return updated;
|
|
819
773
|
}
|
|
820
|
-
/**
|
|
821
|
-
* Delete a conversation
|
|
822
|
-
*/
|
|
823
774
|
async deleteConversation(id) {
|
|
824
775
|
await this.initialize();
|
|
825
776
|
const conversationsTable = `${this.tablePrefix}_conversations`;
|
|
@@ -831,9 +782,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
831
782
|
// ============================================================================
|
|
832
783
|
// Working Memory Operations
|
|
833
784
|
// ============================================================================
|
|
834
|
-
/**
|
|
835
|
-
* Get working memory
|
|
836
|
-
*/
|
|
837
785
|
async getWorkingMemory(params) {
|
|
838
786
|
await this.initialize();
|
|
839
787
|
if (params.scope === "conversation" && params.conversationId) {
|
|
@@ -853,9 +801,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
853
801
|
}
|
|
854
802
|
return null;
|
|
855
803
|
}
|
|
856
|
-
/**
|
|
857
|
-
* Set working memory
|
|
858
|
-
*/
|
|
859
804
|
async setWorkingMemory(params) {
|
|
860
805
|
await this.initialize();
|
|
861
806
|
if (params.scope === "conversation" && params.conversationId) {
|
|
@@ -889,9 +834,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
889
834
|
}
|
|
890
835
|
}
|
|
891
836
|
}
|
|
892
|
-
/**
|
|
893
|
-
* Delete working memory
|
|
894
|
-
*/
|
|
895
837
|
async deleteWorkingMemory(params) {
|
|
896
838
|
await this.initialize();
|
|
897
839
|
if (params.scope === "conversation" && params.conversationId) {
|
|
@@ -923,9 +865,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
923
865
|
// ============================================================================
|
|
924
866
|
// Workflow State Operations
|
|
925
867
|
// ============================================================================
|
|
926
|
-
/**
|
|
927
|
-
* Get workflow state by execution ID
|
|
928
|
-
*/
|
|
929
868
|
async getWorkflowState(executionId) {
|
|
930
869
|
await this.initialize();
|
|
931
870
|
const workflowStatesTable = `${this.tablePrefix}_workflow_states`;
|
|
@@ -953,9 +892,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
953
892
|
updatedAt: new Date(row.updated_at)
|
|
954
893
|
};
|
|
955
894
|
}
|
|
956
|
-
/**
|
|
957
|
-
* Query workflow states with optional filters
|
|
958
|
-
*/
|
|
959
895
|
async queryWorkflowRuns(query) {
|
|
960
896
|
await this.initialize();
|
|
961
897
|
const workflowStatesTable = `${this.tablePrefix}_workflow_states`;
|
|
@@ -1010,9 +946,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
1010
946
|
updatedAt: new Date(row.updated_at)
|
|
1011
947
|
}));
|
|
1012
948
|
}
|
|
1013
|
-
/**
|
|
1014
|
-
* Set workflow state
|
|
1015
|
-
*/
|
|
1016
949
|
async setWorkflowState(executionId, state) {
|
|
1017
950
|
await this.initialize();
|
|
1018
951
|
const workflowStatesTable = `${this.tablePrefix}_workflow_states`;
|
|
@@ -1037,9 +970,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
1037
970
|
]
|
|
1038
971
|
});
|
|
1039
972
|
}
|
|
1040
|
-
/**
|
|
1041
|
-
* Update workflow state
|
|
1042
|
-
*/
|
|
1043
973
|
async updateWorkflowState(executionId, updates) {
|
|
1044
974
|
await this.initialize();
|
|
1045
975
|
const existing = await this.getWorkflowState(executionId);
|
|
@@ -1053,9 +983,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
1053
983
|
};
|
|
1054
984
|
await this.setWorkflowState(executionId, updated);
|
|
1055
985
|
}
|
|
1056
|
-
/**
|
|
1057
|
-
* Get suspended workflow states for a workflow
|
|
1058
|
-
*/
|
|
1059
986
|
async getSuspendedWorkflowStates(workflowId) {
|
|
1060
987
|
await this.initialize();
|
|
1061
988
|
const workflowStatesTable = `${this.tablePrefix}_workflow_states`;
|
|
@@ -1079,23 +1006,46 @@ var LibSQLMemoryAdapter = class {
|
|
|
1079
1006
|
updatedAt: new Date(row.updated_at)
|
|
1080
1007
|
}));
|
|
1081
1008
|
}
|
|
1082
|
-
/**
|
|
1083
|
-
* Close database connection
|
|
1084
|
-
*/
|
|
1085
1009
|
async close() {
|
|
1086
1010
|
this.logger.debug("Closing LibSQL Memory adapter");
|
|
1087
1011
|
}
|
|
1088
1012
|
};
|
|
1089
1013
|
|
|
1014
|
+
// src/memory-v2-adapter.ts
|
|
1015
|
+
var LibSQLMemoryAdapter = class extends LibSQLMemoryCore {
|
|
1016
|
+
static {
|
|
1017
|
+
__name(this, "LibSQLMemoryAdapter");
|
|
1018
|
+
}
|
|
1019
|
+
constructor(options = {}) {
|
|
1020
|
+
const url = options.url ?? "file:./.voltagent/memory.db";
|
|
1021
|
+
const logger = options.logger || import_core2.AgentRegistry.getInstance().getGlobalLogger() || (0, import_logger.createPinoLogger)({ name: "libsql-memory" });
|
|
1022
|
+
if (url.startsWith("file:")) {
|
|
1023
|
+
const dbPath = url.replace("file:", "");
|
|
1024
|
+
const dbDir = import_node_path.default.dirname(dbPath);
|
|
1025
|
+
if (dbDir && dbDir !== "." && !import_node_fs.default.existsSync(dbDir)) {
|
|
1026
|
+
import_node_fs.default.mkdirSync(dbDir, { recursive: true });
|
|
1027
|
+
logger.debug(`Created database directory: ${dbDir}`);
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
const client = (0, import_client.createClient)({
|
|
1031
|
+
url,
|
|
1032
|
+
authToken: options.authToken
|
|
1033
|
+
});
|
|
1034
|
+
super(client, url, options, logger);
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
|
|
1090
1038
|
// src/observability-adapter.ts
|
|
1091
1039
|
var import_node_fs2 = require("fs");
|
|
1092
1040
|
var import_node_path2 = require("path");
|
|
1093
1041
|
var import_client2 = require("@libsql/client");
|
|
1094
|
-
var import_utils = require("@voltagent/internal/utils");
|
|
1095
1042
|
var import_logger2 = require("@voltagent/logger");
|
|
1096
|
-
|
|
1043
|
+
|
|
1044
|
+
// src/observability-core.ts
|
|
1045
|
+
var import_utils = require("@voltagent/internal/utils");
|
|
1046
|
+
var LibSQLObservabilityCore = class {
|
|
1097
1047
|
static {
|
|
1098
|
-
__name(this, "
|
|
1048
|
+
__name(this, "LibSQLObservabilityCore");
|
|
1099
1049
|
}
|
|
1100
1050
|
client;
|
|
1101
1051
|
tablePrefix;
|
|
@@ -1103,47 +1053,24 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1103
1053
|
logger;
|
|
1104
1054
|
initialized;
|
|
1105
1055
|
maxSpansPerQuery;
|
|
1106
|
-
constructor(options
|
|
1107
|
-
this.
|
|
1056
|
+
constructor(client, options, logger) {
|
|
1057
|
+
this.client = client;
|
|
1058
|
+
this.logger = logger;
|
|
1108
1059
|
this.tablePrefix = options.tablePrefix || "observability";
|
|
1109
1060
|
this.debug = options.debug || false;
|
|
1110
1061
|
this.maxSpansPerQuery = options.maxSpansPerQuery || 1e3;
|
|
1111
|
-
|
|
1112
|
-
if (url.startsWith("file:") && !url.includes(":memory:")) {
|
|
1113
|
-
const filePath = url.substring(5);
|
|
1114
|
-
const dir = (0, import_node_path2.dirname)(filePath);
|
|
1115
|
-
if (dir && dir !== "." && !(0, import_node_fs2.existsSync)(dir)) {
|
|
1116
|
-
try {
|
|
1117
|
-
(0, import_node_fs2.mkdirSync)(dir, { recursive: true });
|
|
1118
|
-
this.debugLog("Created directory for database", { dir });
|
|
1119
|
-
} catch (error) {
|
|
1120
|
-
this.logger.warn("Failed to create directory for database", { dir, error });
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
this.client = (0, import_client2.createClient)({
|
|
1125
|
-
url,
|
|
1126
|
-
authToken: options.authToken
|
|
1127
|
-
});
|
|
1128
|
-
this.debugLog("LibSQL observability adapter initialized with options", {
|
|
1129
|
-
url,
|
|
1062
|
+
this.debugLog("LibSQL observability adapter core initialized", {
|
|
1130
1063
|
tablePrefix: this.tablePrefix,
|
|
1131
1064
|
debug: this.debug,
|
|
1132
1065
|
maxSpansPerQuery: this.maxSpansPerQuery
|
|
1133
1066
|
});
|
|
1134
1067
|
this.initialized = this.initializeDatabase();
|
|
1135
1068
|
}
|
|
1136
|
-
/**
|
|
1137
|
-
* Log a debug message if debug is enabled
|
|
1138
|
-
*/
|
|
1139
1069
|
debugLog(message, data) {
|
|
1140
1070
|
if (this.debug) {
|
|
1141
1071
|
this.logger.debug(`${message}`, data || "");
|
|
1142
1072
|
}
|
|
1143
1073
|
}
|
|
1144
|
-
/**
|
|
1145
|
-
* Initialize database tables for observability
|
|
1146
|
-
*/
|
|
1147
1074
|
async initializeDatabase() {
|
|
1148
1075
|
try {
|
|
1149
1076
|
await this.client.execute(`
|
|
@@ -1170,27 +1097,27 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1170
1097
|
)
|
|
1171
1098
|
`);
|
|
1172
1099
|
await this.client.execute(`
|
|
1173
|
-
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_spans_trace_id
|
|
1100
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_spans_trace_id
|
|
1174
1101
|
ON ${this.tablePrefix}_spans(trace_id)
|
|
1175
1102
|
`);
|
|
1176
1103
|
await this.client.execute(`
|
|
1177
|
-
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_spans_parent_span_id
|
|
1104
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_spans_parent_span_id
|
|
1178
1105
|
ON ${this.tablePrefix}_spans(parent_span_id)
|
|
1179
1106
|
`);
|
|
1180
1107
|
await this.client.execute(`
|
|
1181
|
-
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_spans_start_time
|
|
1108
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_spans_start_time
|
|
1182
1109
|
ON ${this.tablePrefix}_spans(start_time)
|
|
1183
1110
|
`);
|
|
1184
1111
|
await this.client.execute(`
|
|
1185
|
-
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_spans_name
|
|
1112
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_spans_name
|
|
1186
1113
|
ON ${this.tablePrefix}_spans(name)
|
|
1187
1114
|
`);
|
|
1188
1115
|
await this.client.execute(`
|
|
1189
|
-
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_spans_entity_id
|
|
1116
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_spans_entity_id
|
|
1190
1117
|
ON ${this.tablePrefix}_spans(entity_id)
|
|
1191
1118
|
`);
|
|
1192
1119
|
await this.client.execute(`
|
|
1193
|
-
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_spans_entity_type
|
|
1120
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_spans_entity_type
|
|
1194
1121
|
ON ${this.tablePrefix}_spans(entity_type)
|
|
1195
1122
|
`);
|
|
1196
1123
|
await this.client.execute(`
|
|
@@ -1207,15 +1134,15 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1207
1134
|
)
|
|
1208
1135
|
`);
|
|
1209
1136
|
await this.client.execute(`
|
|
1210
|
-
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_traces_start_time
|
|
1137
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_traces_start_time
|
|
1211
1138
|
ON ${this.tablePrefix}_traces(start_time DESC)
|
|
1212
1139
|
`);
|
|
1213
1140
|
await this.client.execute(`
|
|
1214
|
-
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_traces_entity_id
|
|
1141
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_traces_entity_id
|
|
1215
1142
|
ON ${this.tablePrefix}_traces(entity_id)
|
|
1216
1143
|
`);
|
|
1217
1144
|
await this.client.execute(`
|
|
1218
|
-
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_traces_entity_type
|
|
1145
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_traces_entity_type
|
|
1219
1146
|
ON ${this.tablePrefix}_traces(entity_type)
|
|
1220
1147
|
`);
|
|
1221
1148
|
await this.client.execute(`
|
|
@@ -1235,19 +1162,19 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1235
1162
|
)
|
|
1236
1163
|
`);
|
|
1237
1164
|
await this.client.execute(`
|
|
1238
|
-
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_logs_trace_id
|
|
1165
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_logs_trace_id
|
|
1239
1166
|
ON ${this.tablePrefix}_logs(trace_id)
|
|
1240
1167
|
`);
|
|
1241
1168
|
await this.client.execute(`
|
|
1242
|
-
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_logs_span_id
|
|
1169
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_logs_span_id
|
|
1243
1170
|
ON ${this.tablePrefix}_logs(span_id)
|
|
1244
1171
|
`);
|
|
1245
1172
|
await this.client.execute(`
|
|
1246
|
-
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_logs_timestamp
|
|
1173
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_logs_timestamp
|
|
1247
1174
|
ON ${this.tablePrefix}_logs(timestamp DESC)
|
|
1248
1175
|
`);
|
|
1249
1176
|
await this.client.execute(`
|
|
1250
|
-
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_logs_severity
|
|
1177
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tablePrefix}_logs_severity
|
|
1251
1178
|
ON ${this.tablePrefix}_logs(severity_number)
|
|
1252
1179
|
`);
|
|
1253
1180
|
this.debugLog("Database tables initialized successfully");
|
|
@@ -1256,22 +1183,15 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1256
1183
|
throw error;
|
|
1257
1184
|
}
|
|
1258
1185
|
}
|
|
1259
|
-
/**
|
|
1260
|
-
* Ensure database is initialized before operations
|
|
1261
|
-
*/
|
|
1262
1186
|
async ensureInitialized() {
|
|
1263
1187
|
await this.initialized;
|
|
1264
1188
|
}
|
|
1265
|
-
/**
|
|
1266
|
-
* Add a span to the database
|
|
1267
|
-
*/
|
|
1268
1189
|
async addSpan(span) {
|
|
1269
1190
|
await this.ensureInitialized();
|
|
1270
1191
|
try {
|
|
1271
1192
|
const entityId = span.attributes?.["entity.id"] || null;
|
|
1272
1193
|
const entityType = span.attributes?.["entity.type"] || null;
|
|
1273
1194
|
await this.client.batch([
|
|
1274
|
-
// Insert the span with entity columns
|
|
1275
1195
|
{
|
|
1276
1196
|
sql: `
|
|
1277
1197
|
INSERT INTO ${this.tablePrefix}_spans (
|
|
@@ -1302,7 +1222,6 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1302
1222
|
span.instrumentationScope ? (0, import_utils.safeStringify)(span.instrumentationScope) : null
|
|
1303
1223
|
]
|
|
1304
1224
|
},
|
|
1305
|
-
// Update or insert trace metadata with entity columns
|
|
1306
1225
|
{
|
|
1307
1226
|
sql: `
|
|
1308
1227
|
INSERT INTO ${this.tablePrefix}_traces (
|
|
@@ -1319,7 +1238,6 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1319
1238
|
args: [
|
|
1320
1239
|
span.traceId,
|
|
1321
1240
|
span.parentSpanId ? null : span.spanId,
|
|
1322
|
-
// Root span if no parent
|
|
1323
1241
|
entityId,
|
|
1324
1242
|
entityType,
|
|
1325
1243
|
span.startTime,
|
|
@@ -1336,9 +1254,6 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1336
1254
|
throw error;
|
|
1337
1255
|
}
|
|
1338
1256
|
}
|
|
1339
|
-
/**
|
|
1340
|
-
* Update an existing span
|
|
1341
|
-
*/
|
|
1342
1257
|
async updateSpan(spanId, updates) {
|
|
1343
1258
|
await this.ensureInitialized();
|
|
1344
1259
|
try {
|
|
@@ -1375,7 +1290,7 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1375
1290
|
args.push(spanId);
|
|
1376
1291
|
await this.client.execute({
|
|
1377
1292
|
sql: `
|
|
1378
|
-
UPDATE ${this.tablePrefix}_spans
|
|
1293
|
+
UPDATE ${this.tablePrefix}_spans
|
|
1379
1294
|
SET ${setClauses.join(", ")}
|
|
1380
1295
|
WHERE span_id = ?
|
|
1381
1296
|
`,
|
|
@@ -1401,32 +1316,22 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1401
1316
|
throw error;
|
|
1402
1317
|
}
|
|
1403
1318
|
}
|
|
1404
|
-
/**
|
|
1405
|
-
* Get a span by ID
|
|
1406
|
-
*/
|
|
1407
1319
|
async getSpan(spanId) {
|
|
1408
1320
|
await this.ensureInitialized();
|
|
1409
1321
|
try {
|
|
1410
1322
|
const result = await this.client.execute({
|
|
1411
|
-
sql: `
|
|
1412
|
-
SELECT * FROM ${this.tablePrefix}_spans
|
|
1413
|
-
WHERE span_id = ?
|
|
1414
|
-
`,
|
|
1323
|
+
sql: `SELECT * FROM ${this.tablePrefix}_spans WHERE span_id = ?`,
|
|
1415
1324
|
args: [spanId]
|
|
1416
1325
|
});
|
|
1417
1326
|
if (result.rows.length === 0) {
|
|
1418
1327
|
return null;
|
|
1419
1328
|
}
|
|
1420
|
-
|
|
1421
|
-
return this.rowToSpan(row);
|
|
1329
|
+
return this.rowToSpan(result.rows[0]);
|
|
1422
1330
|
} catch (error) {
|
|
1423
1331
|
this.logger.error("Failed to get span", { error, spanId });
|
|
1424
1332
|
throw error;
|
|
1425
1333
|
}
|
|
1426
1334
|
}
|
|
1427
|
-
/**
|
|
1428
|
-
* Get all spans in a trace
|
|
1429
|
-
*/
|
|
1430
1335
|
async getTrace(traceId) {
|
|
1431
1336
|
await this.ensureInitialized();
|
|
1432
1337
|
try {
|
|
@@ -1445,9 +1350,6 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1445
1350
|
throw error;
|
|
1446
1351
|
}
|
|
1447
1352
|
}
|
|
1448
|
-
/**
|
|
1449
|
-
* List all traces with optional entity filter
|
|
1450
|
-
*/
|
|
1451
1353
|
async listTraces(limit = 100, offset = 0, filter) {
|
|
1452
1354
|
await this.ensureInitialized();
|
|
1453
1355
|
try {
|
|
@@ -1485,52 +1387,36 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1485
1387
|
throw error;
|
|
1486
1388
|
}
|
|
1487
1389
|
}
|
|
1488
|
-
/**
|
|
1489
|
-
* Delete old spans
|
|
1490
|
-
*/
|
|
1491
1390
|
async deleteOldSpans(beforeTimestamp) {
|
|
1492
1391
|
await this.ensureInitialized();
|
|
1493
1392
|
try {
|
|
1494
1393
|
const beforeDate = new Date(beforeTimestamp).toISOString();
|
|
1495
1394
|
const tracesResult = await this.client.execute({
|
|
1496
|
-
sql: `
|
|
1497
|
-
SELECT DISTINCT trace_id FROM ${this.tablePrefix}_spans
|
|
1498
|
-
WHERE start_time < ?
|
|
1499
|
-
`,
|
|
1395
|
+
sql: `SELECT DISTINCT trace_id FROM ${this.tablePrefix}_spans WHERE start_time < ?`,
|
|
1500
1396
|
args: [beforeDate]
|
|
1501
1397
|
});
|
|
1502
1398
|
const affectedTraceIds = tracesResult.rows.map((row) => row.trace_id);
|
|
1503
1399
|
const deleteResult = await this.client.execute({
|
|
1504
|
-
sql: `
|
|
1505
|
-
DELETE FROM ${this.tablePrefix}_spans
|
|
1506
|
-
WHERE start_time < ?
|
|
1507
|
-
`,
|
|
1400
|
+
sql: `DELETE FROM ${this.tablePrefix}_spans WHERE start_time < ?`,
|
|
1508
1401
|
args: [beforeDate]
|
|
1509
1402
|
});
|
|
1510
1403
|
if (affectedTraceIds.length > 0) {
|
|
1511
1404
|
for (const traceId of affectedTraceIds) {
|
|
1512
1405
|
const countResult = await this.client.execute({
|
|
1513
|
-
sql: `
|
|
1514
|
-
SELECT COUNT(*) as count FROM ${this.tablePrefix}_spans
|
|
1515
|
-
WHERE trace_id = ?
|
|
1516
|
-
`,
|
|
1406
|
+
sql: `SELECT COUNT(*) as count FROM ${this.tablePrefix}_spans WHERE trace_id = ?`,
|
|
1517
1407
|
args: [traceId]
|
|
1518
1408
|
});
|
|
1519
1409
|
const count = countResult.rows[0].count;
|
|
1520
1410
|
if (count === 0) {
|
|
1521
1411
|
await this.client.execute({
|
|
1522
|
-
sql: `
|
|
1523
|
-
DELETE FROM ${this.tablePrefix}_traces
|
|
1524
|
-
WHERE trace_id = ?
|
|
1525
|
-
`,
|
|
1412
|
+
sql: `DELETE FROM ${this.tablePrefix}_traces WHERE trace_id = ?`,
|
|
1526
1413
|
args: [traceId]
|
|
1527
1414
|
});
|
|
1528
1415
|
} else {
|
|
1529
1416
|
await this.client.execute({
|
|
1530
1417
|
sql: `
|
|
1531
1418
|
UPDATE ${this.tablePrefix}_traces
|
|
1532
|
-
SET span_count = ?,
|
|
1533
|
-
updated_at = CURRENT_TIMESTAMP
|
|
1419
|
+
SET span_count = ?, updated_at = CURRENT_TIMESTAMP
|
|
1534
1420
|
WHERE trace_id = ?
|
|
1535
1421
|
`,
|
|
1536
1422
|
args: [count, traceId]
|
|
@@ -1546,9 +1432,6 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1546
1432
|
throw error;
|
|
1547
1433
|
}
|
|
1548
1434
|
}
|
|
1549
|
-
/**
|
|
1550
|
-
* Clear all spans, traces, and logs
|
|
1551
|
-
*/
|
|
1552
1435
|
async clear() {
|
|
1553
1436
|
await this.ensureInitialized();
|
|
1554
1437
|
try {
|
|
@@ -1563,9 +1446,6 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1563
1446
|
throw error;
|
|
1564
1447
|
}
|
|
1565
1448
|
}
|
|
1566
|
-
/**
|
|
1567
|
-
* Convert a database row to an ObservabilitySpan
|
|
1568
|
-
*/
|
|
1569
1449
|
rowToSpan(row) {
|
|
1570
1450
|
const span = {
|
|
1571
1451
|
traceId: row.trace_id,
|
|
@@ -1611,9 +1491,6 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1611
1491
|
}
|
|
1612
1492
|
return span;
|
|
1613
1493
|
}
|
|
1614
|
-
/**
|
|
1615
|
-
* Get statistics about stored spans
|
|
1616
|
-
*/
|
|
1617
1494
|
async getStats() {
|
|
1618
1495
|
await this.ensureInitialized();
|
|
1619
1496
|
try {
|
|
@@ -1621,9 +1498,7 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1621
1498
|
this.client.execute(`SELECT COUNT(*) as count FROM ${this.tablePrefix}_spans`),
|
|
1622
1499
|
this.client.execute(`SELECT COUNT(*) as count FROM ${this.tablePrefix}_traces`),
|
|
1623
1500
|
this.client.execute(`
|
|
1624
|
-
SELECT
|
|
1625
|
-
MIN(start_time) as oldest,
|
|
1626
|
-
MAX(start_time) as newest
|
|
1501
|
+
SELECT MIN(start_time) as oldest, MAX(start_time) as newest
|
|
1627
1502
|
FROM ${this.tablePrefix}_spans
|
|
1628
1503
|
`)
|
|
1629
1504
|
]);
|
|
@@ -1643,9 +1518,6 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1643
1518
|
throw error;
|
|
1644
1519
|
}
|
|
1645
1520
|
}
|
|
1646
|
-
/**
|
|
1647
|
-
* Save a log record to the database
|
|
1648
|
-
*/
|
|
1649
1521
|
async saveLogRecord(logRecord) {
|
|
1650
1522
|
await this.ensureInitialized();
|
|
1651
1523
|
try {
|
|
@@ -1700,9 +1572,6 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1700
1572
|
throw error;
|
|
1701
1573
|
}
|
|
1702
1574
|
}
|
|
1703
|
-
/**
|
|
1704
|
-
* Get logs by trace ID
|
|
1705
|
-
*/
|
|
1706
1575
|
async getLogsByTraceId(traceId) {
|
|
1707
1576
|
await this.ensureInitialized();
|
|
1708
1577
|
try {
|
|
@@ -1721,9 +1590,6 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1721
1590
|
throw error;
|
|
1722
1591
|
}
|
|
1723
1592
|
}
|
|
1724
|
-
/**
|
|
1725
|
-
* Get logs by span ID
|
|
1726
|
-
*/
|
|
1727
1593
|
async getLogsBySpanId(spanId) {
|
|
1728
1594
|
await this.ensureInitialized();
|
|
1729
1595
|
try {
|
|
@@ -1742,9 +1608,6 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1742
1608
|
throw error;
|
|
1743
1609
|
}
|
|
1744
1610
|
}
|
|
1745
|
-
/**
|
|
1746
|
-
* Query logs with flexible filtering
|
|
1747
|
-
*/
|
|
1748
1611
|
async queryLogs(filter) {
|
|
1749
1612
|
await this.ensureInitialized();
|
|
1750
1613
|
try {
|
|
@@ -1813,18 +1676,12 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1813
1676
|
throw error;
|
|
1814
1677
|
}
|
|
1815
1678
|
}
|
|
1816
|
-
/**
|
|
1817
|
-
* Delete old logs
|
|
1818
|
-
*/
|
|
1819
1679
|
async deleteOldLogs(beforeTimestamp) {
|
|
1820
1680
|
await this.ensureInitialized();
|
|
1821
1681
|
try {
|
|
1822
1682
|
const beforeDate = new Date(beforeTimestamp).toISOString();
|
|
1823
1683
|
const result = await this.client.execute({
|
|
1824
|
-
sql: `
|
|
1825
|
-
DELETE FROM ${this.tablePrefix}_logs
|
|
1826
|
-
WHERE timestamp < ?
|
|
1827
|
-
`,
|
|
1684
|
+
sql: `DELETE FROM ${this.tablePrefix}_logs WHERE timestamp < ?`,
|
|
1828
1685
|
args: [beforeDate]
|
|
1829
1686
|
});
|
|
1830
1687
|
const deletedCount = result.rowsAffected || 0;
|
|
@@ -1835,9 +1692,6 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1835
1692
|
throw error;
|
|
1836
1693
|
}
|
|
1837
1694
|
}
|
|
1838
|
-
/**
|
|
1839
|
-
* Convert a database row to an ObservabilityLogRecord
|
|
1840
|
-
*/
|
|
1841
1695
|
rowToLogRecord(row) {
|
|
1842
1696
|
const log = {
|
|
1843
1697
|
timestamp: row.timestamp,
|
|
@@ -1904,24 +1758,53 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1904
1758
|
description: "Persists spans and logs to a LibSQL/Turso database for long-term retention."
|
|
1905
1759
|
};
|
|
1906
1760
|
}
|
|
1907
|
-
/**
|
|
1908
|
-
* Close the database connection
|
|
1909
|
-
*/
|
|
1910
1761
|
async close() {
|
|
1911
1762
|
this.debugLog("LibSQL observability adapter closed");
|
|
1912
1763
|
}
|
|
1913
1764
|
};
|
|
1914
1765
|
|
|
1766
|
+
// src/observability-adapter.ts
|
|
1767
|
+
var LibSQLObservabilityAdapter = class extends LibSQLObservabilityCore {
|
|
1768
|
+
static {
|
|
1769
|
+
__name(this, "LibSQLObservabilityAdapter");
|
|
1770
|
+
}
|
|
1771
|
+
constructor(options = {}) {
|
|
1772
|
+
const url = options.url || "file:./.voltagent/observability.db";
|
|
1773
|
+
const logger = options.logger || (0, import_logger2.createPinoLogger)({ name: "libsql-observability" });
|
|
1774
|
+
if (url.startsWith("file:") && !url.includes(":memory:")) {
|
|
1775
|
+
const filePath = url.substring(5);
|
|
1776
|
+
const dir = (0, import_node_path2.dirname)(filePath);
|
|
1777
|
+
if (dir && dir !== "." && !(0, import_node_fs2.existsSync)(dir)) {
|
|
1778
|
+
try {
|
|
1779
|
+
(0, import_node_fs2.mkdirSync)(dir, { recursive: true });
|
|
1780
|
+
if (options.debug) {
|
|
1781
|
+
logger.debug("Created directory for database", { dir });
|
|
1782
|
+
}
|
|
1783
|
+
} catch (error) {
|
|
1784
|
+
logger.warn("Failed to create directory for database", { dir, error });
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
const client = (0, import_client2.createClient)({
|
|
1789
|
+
url,
|
|
1790
|
+
authToken: options.authToken
|
|
1791
|
+
});
|
|
1792
|
+
super(client, options, logger);
|
|
1793
|
+
}
|
|
1794
|
+
};
|
|
1795
|
+
|
|
1915
1796
|
// src/vector-adapter.ts
|
|
1916
1797
|
var import_node_fs3 = __toESM(require("fs"));
|
|
1917
1798
|
var import_node_path3 = __toESM(require("path"));
|
|
1918
1799
|
var import_client3 = require("@libsql/client");
|
|
1919
|
-
var import_core2 = require("@voltagent/core");
|
|
1920
|
-
var import_internal2 = require("@voltagent/internal");
|
|
1921
1800
|
var import_logger3 = require("@voltagent/logger");
|
|
1922
|
-
|
|
1801
|
+
|
|
1802
|
+
// src/vector-core.ts
|
|
1803
|
+
var import_core3 = require("@voltagent/core");
|
|
1804
|
+
var import_internal2 = require("@voltagent/internal");
|
|
1805
|
+
var LibSQLVectorCore = class {
|
|
1923
1806
|
static {
|
|
1924
|
-
__name(this, "
|
|
1807
|
+
__name(this, "LibSQLVectorCore");
|
|
1925
1808
|
}
|
|
1926
1809
|
client;
|
|
1927
1810
|
tablePrefix;
|
|
@@ -1932,11 +1815,11 @@ var LibSQLVectorAdapter = class {
|
|
|
1932
1815
|
logger;
|
|
1933
1816
|
maxRetries;
|
|
1934
1817
|
retryDelayMs;
|
|
1935
|
-
url;
|
|
1936
1818
|
initialized = false;
|
|
1937
1819
|
vectorCache;
|
|
1938
1820
|
dimensions = null;
|
|
1939
|
-
constructor(options
|
|
1821
|
+
constructor(client, options, logger) {
|
|
1822
|
+
this.client = client;
|
|
1940
1823
|
this.tablePrefix = options.tablePrefix ?? "voltagent";
|
|
1941
1824
|
this.maxVectorDimensions = options.maxVectorDimensions ?? 1536;
|
|
1942
1825
|
this.cacheSize = options.cacheSize ?? 100;
|
|
@@ -1944,28 +1827,32 @@ var LibSQLVectorAdapter = class {
|
|
|
1944
1827
|
this.maxRetries = options.maxRetries ?? 3;
|
|
1945
1828
|
this.retryDelayMs = options.retryDelayMs ?? 100;
|
|
1946
1829
|
this.debug = options.debug ?? false;
|
|
1947
|
-
this.logger =
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1830
|
+
this.logger = logger;
|
|
1831
|
+
this.vectorCache = /* @__PURE__ */ new Map();
|
|
1832
|
+
}
|
|
1833
|
+
/**
|
|
1834
|
+
* Serialize a vector to binary format
|
|
1835
|
+
* Uses ArrayBuffer/DataView for cross-platform compatibility
|
|
1836
|
+
*/
|
|
1837
|
+
serializeVector(vector) {
|
|
1838
|
+
const buffer = new ArrayBuffer(vector.length * 4);
|
|
1839
|
+
const view = new DataView(buffer);
|
|
1840
|
+
for (let i = 0; i < vector.length; i++) {
|
|
1841
|
+
view.setFloat32(i * 4, vector[i], true);
|
|
1956
1842
|
}
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1843
|
+
return new Uint8Array(buffer);
|
|
1844
|
+
}
|
|
1845
|
+
/**
|
|
1846
|
+
* Deserialize a vector from binary format
|
|
1847
|
+
*/
|
|
1848
|
+
deserializeVector(data) {
|
|
1849
|
+
const bytes = data instanceof ArrayBuffer ? new Uint8Array(data) : data;
|
|
1850
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
1851
|
+
const vector = [];
|
|
1852
|
+
for (let i = 0; i < bytes.length; i += 4) {
|
|
1853
|
+
vector.push(view.getFloat32(i, true));
|
|
1963
1854
|
}
|
|
1964
|
-
|
|
1965
|
-
url: this.url,
|
|
1966
|
-
authToken: options.authToken
|
|
1967
|
-
});
|
|
1968
|
-
this.vectorCache = /* @__PURE__ */ new Map();
|
|
1855
|
+
return vector;
|
|
1969
1856
|
}
|
|
1970
1857
|
/**
|
|
1971
1858
|
* Initialize the database schema
|
|
@@ -1974,8 +1861,7 @@ var LibSQLVectorAdapter = class {
|
|
|
1974
1861
|
if (this.initialized) return;
|
|
1975
1862
|
const tableName = `${this.tablePrefix}_vectors`;
|
|
1976
1863
|
try {
|
|
1977
|
-
await this.client.
|
|
1978
|
-
BEGIN;
|
|
1864
|
+
await this.client.execute(`
|
|
1979
1865
|
CREATE TABLE IF NOT EXISTS ${tableName} (
|
|
1980
1866
|
id TEXT PRIMARY KEY,
|
|
1981
1867
|
vector BLOB NOT NULL,
|
|
@@ -1984,11 +1870,14 @@ var LibSQLVectorAdapter = class {
|
|
|
1984
1870
|
content TEXT,
|
|
1985
1871
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
1986
1872
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
1987
|
-
)
|
|
1988
|
-
CREATE INDEX IF NOT EXISTS idx_${tableName}_created ON ${tableName}(created_at);
|
|
1989
|
-
CREATE INDEX IF NOT EXISTS idx_${tableName}_dimensions ON ${tableName}(dimensions);
|
|
1990
|
-
COMMIT;
|
|
1873
|
+
)
|
|
1991
1874
|
`);
|
|
1875
|
+
await this.client.execute(
|
|
1876
|
+
`CREATE INDEX IF NOT EXISTS idx_${tableName}_created ON ${tableName}(created_at)`
|
|
1877
|
+
);
|
|
1878
|
+
await this.client.execute(
|
|
1879
|
+
`CREATE INDEX IF NOT EXISTS idx_${tableName}_dimensions ON ${tableName}(dimensions)`
|
|
1880
|
+
);
|
|
1992
1881
|
this.initialized = true;
|
|
1993
1882
|
this.logger.debug("Vector adapter initialized");
|
|
1994
1883
|
} catch (error) {
|
|
@@ -1996,34 +1885,6 @@ var LibSQLVectorAdapter = class {
|
|
|
1996
1885
|
throw error;
|
|
1997
1886
|
}
|
|
1998
1887
|
}
|
|
1999
|
-
/**
|
|
2000
|
-
* Serialize a vector to binary format
|
|
2001
|
-
*/
|
|
2002
|
-
serializeVector(vector) {
|
|
2003
|
-
const buffer = Buffer.allocUnsafe(vector.length * 4);
|
|
2004
|
-
for (let i = 0; i < vector.length; i++) {
|
|
2005
|
-
buffer.writeFloatLE(vector[i], i * 4);
|
|
2006
|
-
}
|
|
2007
|
-
return buffer;
|
|
2008
|
-
}
|
|
2009
|
-
/**
|
|
2010
|
-
* Deserialize a vector from binary format
|
|
2011
|
-
*/
|
|
2012
|
-
deserializeVector(buffer) {
|
|
2013
|
-
let bytes;
|
|
2014
|
-
if (buffer instanceof Buffer) {
|
|
2015
|
-
bytes = buffer;
|
|
2016
|
-
} else if (buffer instanceof ArrayBuffer) {
|
|
2017
|
-
bytes = Buffer.from(buffer);
|
|
2018
|
-
} else {
|
|
2019
|
-
bytes = Buffer.from(buffer);
|
|
2020
|
-
}
|
|
2021
|
-
const vector = [];
|
|
2022
|
-
for (let i = 0; i < bytes.length; i += 4) {
|
|
2023
|
-
vector.push(bytes.readFloatLE(i));
|
|
2024
|
-
}
|
|
2025
|
-
return vector;
|
|
2026
|
-
}
|
|
2027
1888
|
/**
|
|
2028
1889
|
* Execute a database operation with retries
|
|
2029
1890
|
*/
|
|
@@ -2045,9 +1906,6 @@ var LibSQLVectorAdapter = class {
|
|
|
2045
1906
|
this.logger.error(`Operation failed after ${this.maxRetries} attempts: ${context}`, lastError);
|
|
2046
1907
|
throw lastError;
|
|
2047
1908
|
}
|
|
2048
|
-
/**
|
|
2049
|
-
* Store a vector with associated metadata
|
|
2050
|
-
*/
|
|
2051
1909
|
async store(id, vector, metadata) {
|
|
2052
1910
|
await this.initialize();
|
|
2053
1911
|
if (!Array.isArray(vector) || vector.length === 0) {
|
|
@@ -2071,7 +1929,7 @@ var LibSQLVectorAdapter = class {
|
|
|
2071
1929
|
await this.executeWithRetry(async () => {
|
|
2072
1930
|
await this.client.execute({
|
|
2073
1931
|
sql: `
|
|
2074
|
-
INSERT OR REPLACE INTO ${tableName}
|
|
1932
|
+
INSERT OR REPLACE INTO ${tableName}
|
|
2075
1933
|
(id, vector, dimensions, metadata, updated_at)
|
|
2076
1934
|
VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP)
|
|
2077
1935
|
`,
|
|
@@ -2085,9 +1943,6 @@ var LibSQLVectorAdapter = class {
|
|
|
2085
1943
|
this.vectorCache.set(id, { id, vector, metadata });
|
|
2086
1944
|
this.logger.debug(`Vector stored: ${id} (${vector.length} dimensions)`);
|
|
2087
1945
|
}
|
|
2088
|
-
/**
|
|
2089
|
-
* Store multiple vectors in batch
|
|
2090
|
-
*/
|
|
2091
1946
|
async storeBatch(items) {
|
|
2092
1947
|
await this.initialize();
|
|
2093
1948
|
if (items.length === 0) return;
|
|
@@ -2120,9 +1975,6 @@ var LibSQLVectorAdapter = class {
|
|
|
2120
1975
|
this.logger.debug(`Batch of ${batch.length} vectors stored`);
|
|
2121
1976
|
}
|
|
2122
1977
|
}
|
|
2123
|
-
/**
|
|
2124
|
-
* Search for similar vectors using cosine similarity
|
|
2125
|
-
*/
|
|
2126
1978
|
async search(queryVector, options) {
|
|
2127
1979
|
await this.initialize();
|
|
2128
1980
|
const { limit = 10, threshold = 0, filter } = options || {};
|
|
@@ -2153,7 +2005,7 @@ var LibSQLVectorAdapter = class {
|
|
|
2153
2005
|
continue;
|
|
2154
2006
|
}
|
|
2155
2007
|
const vector = this.deserializeVector(vectorBlob);
|
|
2156
|
-
const similarity = (0,
|
|
2008
|
+
const similarity = (0, import_core3.cosineSimilarity)(queryVector, vector);
|
|
2157
2009
|
const score = (similarity + 1) / 2;
|
|
2158
2010
|
if (score >= threshold) {
|
|
2159
2011
|
searchResults.push({
|
|
@@ -2163,16 +2015,12 @@ var LibSQLVectorAdapter = class {
|
|
|
2163
2015
|
content,
|
|
2164
2016
|
score,
|
|
2165
2017
|
distance: 1 - similarity
|
|
2166
|
-
// Convert to distance metric
|
|
2167
2018
|
});
|
|
2168
2019
|
}
|
|
2169
2020
|
}
|
|
2170
2021
|
searchResults.sort((a, b) => b.score - a.score);
|
|
2171
2022
|
return searchResults.slice(0, limit);
|
|
2172
2023
|
}
|
|
2173
|
-
/**
|
|
2174
|
-
* Check if metadata matches the filter criteria
|
|
2175
|
-
*/
|
|
2176
2024
|
matchesFilter(metadata, filter) {
|
|
2177
2025
|
if (!metadata) {
|
|
2178
2026
|
return false;
|
|
@@ -2184,9 +2032,6 @@ var LibSQLVectorAdapter = class {
|
|
|
2184
2032
|
}
|
|
2185
2033
|
return true;
|
|
2186
2034
|
}
|
|
2187
|
-
/**
|
|
2188
|
-
* Delete a vector by ID
|
|
2189
|
-
*/
|
|
2190
2035
|
async delete(id) {
|
|
2191
2036
|
await this.initialize();
|
|
2192
2037
|
const tableName = `${this.tablePrefix}_vectors`;
|
|
@@ -2199,9 +2044,6 @@ var LibSQLVectorAdapter = class {
|
|
|
2199
2044
|
this.vectorCache.delete(id);
|
|
2200
2045
|
this.logger.debug(`Vector deleted: ${id}`);
|
|
2201
2046
|
}
|
|
2202
|
-
/**
|
|
2203
|
-
* Delete multiple vectors by IDs
|
|
2204
|
-
*/
|
|
2205
2047
|
async deleteBatch(ids) {
|
|
2206
2048
|
await this.initialize();
|
|
2207
2049
|
if (ids.length === 0) return;
|
|
@@ -2221,9 +2063,6 @@ var LibSQLVectorAdapter = class {
|
|
|
2221
2063
|
this.logger.debug(`Batch of ${batch.length} vectors deleted`);
|
|
2222
2064
|
}
|
|
2223
2065
|
}
|
|
2224
|
-
/**
|
|
2225
|
-
* Clear all vectors
|
|
2226
|
-
*/
|
|
2227
2066
|
async clear() {
|
|
2228
2067
|
await this.initialize();
|
|
2229
2068
|
const tableName = `${this.tablePrefix}_vectors`;
|
|
@@ -2234,9 +2073,6 @@ var LibSQLVectorAdapter = class {
|
|
|
2234
2073
|
this.dimensions = null;
|
|
2235
2074
|
this.logger.debug("All vectors cleared");
|
|
2236
2075
|
}
|
|
2237
|
-
/**
|
|
2238
|
-
* Get total count of stored vectors
|
|
2239
|
-
*/
|
|
2240
2076
|
async count() {
|
|
2241
2077
|
await this.initialize();
|
|
2242
2078
|
const tableName = `${this.tablePrefix}_vectors`;
|
|
@@ -2249,9 +2085,6 @@ var LibSQLVectorAdapter = class {
|
|
|
2249
2085
|
if (typeof raw === "string") return Number.parseInt(raw, 10) || 0;
|
|
2250
2086
|
return raw ?? 0;
|
|
2251
2087
|
}
|
|
2252
|
-
/**
|
|
2253
|
-
* Get a specific vector by ID
|
|
2254
|
-
*/
|
|
2255
2088
|
async get(id) {
|
|
2256
2089
|
await this.initialize();
|
|
2257
2090
|
if (this.vectorCache.has(id)) {
|
|
@@ -2260,7 +2093,6 @@ var LibSQLVectorAdapter = class {
|
|
|
2260
2093
|
return {
|
|
2261
2094
|
...cached,
|
|
2262
2095
|
vector: [...cached.vector],
|
|
2263
|
-
// Return a copy
|
|
2264
2096
|
metadata: cached.metadata ? { ...cached.metadata } : void 0
|
|
2265
2097
|
};
|
|
2266
2098
|
}
|
|
@@ -2295,20 +2127,10 @@ var LibSQLVectorAdapter = class {
|
|
|
2295
2127
|
this.vectorCache.set(id, item);
|
|
2296
2128
|
return item;
|
|
2297
2129
|
}
|
|
2298
|
-
/**
|
|
2299
|
-
* Close the database connection
|
|
2300
|
-
*/
|
|
2301
2130
|
async close() {
|
|
2302
2131
|
this.vectorCache.clear();
|
|
2303
2132
|
this.logger.debug("Vector adapter closed");
|
|
2304
|
-
try {
|
|
2305
|
-
this.client?.close?.();
|
|
2306
|
-
} catch {
|
|
2307
|
-
}
|
|
2308
2133
|
}
|
|
2309
|
-
/**
|
|
2310
|
-
* Get statistics about the vector table and cache
|
|
2311
|
-
*/
|
|
2312
2134
|
async getStats() {
|
|
2313
2135
|
await this.initialize();
|
|
2314
2136
|
const tableName = `${this.tablePrefix}_vectors`;
|
|
@@ -2319,12 +2141,11 @@ var LibSQLVectorAdapter = class {
|
|
|
2319
2141
|
),
|
|
2320
2142
|
"getStats count"
|
|
2321
2143
|
),
|
|
2322
|
-
// Approximate table size by summing blob/text lengths
|
|
2323
2144
|
this.executeWithRetry(
|
|
2324
2145
|
async () => await this.client.execute({
|
|
2325
|
-
sql: `SELECT
|
|
2326
|
-
COALESCE(SUM(LENGTH(id)),0) +
|
|
2327
|
-
COALESCE(SUM(LENGTH(vector)),0) +
|
|
2146
|
+
sql: `SELECT
|
|
2147
|
+
COALESCE(SUM(LENGTH(id)),0) +
|
|
2148
|
+
COALESCE(SUM(LENGTH(vector)),0) +
|
|
2328
2149
|
COALESCE(SUM(LENGTH(metadata)),0) +
|
|
2329
2150
|
COALESCE(SUM(LENGTH(content)),0) AS size
|
|
2330
2151
|
FROM ${tableName}`
|
|
@@ -2346,6 +2167,66 @@ var LibSQLVectorAdapter = class {
|
|
|
2346
2167
|
};
|
|
2347
2168
|
}
|
|
2348
2169
|
};
|
|
2170
|
+
|
|
2171
|
+
// src/vector-adapter.ts
|
|
2172
|
+
var LibSQLVectorAdapter = class extends LibSQLVectorCore {
|
|
2173
|
+
static {
|
|
2174
|
+
__name(this, "LibSQLVectorAdapter");
|
|
2175
|
+
}
|
|
2176
|
+
constructor(options = {}) {
|
|
2177
|
+
const logger = options.logger ?? (0, import_logger3.createPinoLogger)({
|
|
2178
|
+
name: "libsql-vector-adapter",
|
|
2179
|
+
level: options.debug ? "debug" : "info"
|
|
2180
|
+
});
|
|
2181
|
+
const requestedUrl = options.url ?? "file:./.voltagent/memory.db";
|
|
2182
|
+
let url;
|
|
2183
|
+
if (requestedUrl === ":memory:" || requestedUrl === "file::memory:" || requestedUrl.startsWith("file::memory:")) {
|
|
2184
|
+
url = ":memory:";
|
|
2185
|
+
} else {
|
|
2186
|
+
url = requestedUrl;
|
|
2187
|
+
}
|
|
2188
|
+
if (url.startsWith("file:") && !url.startsWith("file::memory:")) {
|
|
2189
|
+
const dbPath = url.replace("file:", "");
|
|
2190
|
+
const dbDir = import_node_path3.default.dirname(dbPath);
|
|
2191
|
+
if (!import_node_fs3.default.existsSync(dbDir)) {
|
|
2192
|
+
import_node_fs3.default.mkdirSync(dbDir, { recursive: true });
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
const client = (0, import_client3.createClient)({
|
|
2196
|
+
url,
|
|
2197
|
+
authToken: options.authToken
|
|
2198
|
+
});
|
|
2199
|
+
super(client, options, logger);
|
|
2200
|
+
}
|
|
2201
|
+
/**
|
|
2202
|
+
* Override to use Buffer for more efficient serialization in Node.js
|
|
2203
|
+
*/
|
|
2204
|
+
serializeVector(vector) {
|
|
2205
|
+
const buffer = Buffer.allocUnsafe(vector.length * 4);
|
|
2206
|
+
for (let i = 0; i < vector.length; i++) {
|
|
2207
|
+
buffer.writeFloatLE(vector[i], i * 4);
|
|
2208
|
+
}
|
|
2209
|
+
return buffer;
|
|
2210
|
+
}
|
|
2211
|
+
/**
|
|
2212
|
+
* Override to use Buffer for more efficient deserialization in Node.js
|
|
2213
|
+
*/
|
|
2214
|
+
deserializeVector(data) {
|
|
2215
|
+
let buffer;
|
|
2216
|
+
if (data instanceof Buffer) {
|
|
2217
|
+
buffer = data;
|
|
2218
|
+
} else if (data instanceof ArrayBuffer) {
|
|
2219
|
+
buffer = Buffer.from(data);
|
|
2220
|
+
} else {
|
|
2221
|
+
buffer = Buffer.from(data);
|
|
2222
|
+
}
|
|
2223
|
+
const vector = [];
|
|
2224
|
+
for (let i = 0; i < buffer.length; i += 4) {
|
|
2225
|
+
vector.push(buffer.readFloatLE(i));
|
|
2226
|
+
}
|
|
2227
|
+
return vector;
|
|
2228
|
+
}
|
|
2229
|
+
};
|
|
2349
2230
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2350
2231
|
0 && (module.exports = {
|
|
2351
2232
|
LibSQLMemoryAdapter,
|