@voltagent/libsql 1.0.6 → 1.0.8
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/index.d.mts +6 -10
- package/dist/index.d.ts +6 -10
- package/dist/index.js +9 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -21,11 +21,6 @@ interface LibSQLMemoryOptions {
|
|
|
21
21
|
* Auth token for remote connections (optional)
|
|
22
22
|
*/
|
|
23
23
|
authToken?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Maximum number of messages to store per conversation
|
|
26
|
-
* @default 100
|
|
27
|
-
*/
|
|
28
|
-
storageLimit?: number;
|
|
29
24
|
/**
|
|
30
25
|
* Prefix for table names
|
|
31
26
|
* @default "voltagent_memory"
|
|
@@ -58,7 +53,6 @@ interface LibSQLMemoryOptions {
|
|
|
58
53
|
*/
|
|
59
54
|
declare class LibSQLMemoryAdapter implements StorageAdapter {
|
|
60
55
|
private client;
|
|
61
|
-
private storageLimit;
|
|
62
56
|
private tablePrefix;
|
|
63
57
|
private initialized;
|
|
64
58
|
private logger;
|
|
@@ -92,10 +86,6 @@ declare class LibSQLMemoryAdapter implements StorageAdapter {
|
|
|
92
86
|
* Add multiple messages
|
|
93
87
|
*/
|
|
94
88
|
addMessages(messages: UIMessage[], userId: string, conversationId: string): Promise<void>;
|
|
95
|
-
/**
|
|
96
|
-
* Apply storage limit to a conversation
|
|
97
|
-
*/
|
|
98
|
-
private applyStorageLimit;
|
|
99
89
|
/**
|
|
100
90
|
* Get messages with optional filtering
|
|
101
91
|
*/
|
|
@@ -316,6 +306,12 @@ declare class LibSQLObservabilityAdapter implements ObservabilityStorageAdapter
|
|
|
316
306
|
* Convert a database row to an ObservabilityLogRecord
|
|
317
307
|
*/
|
|
318
308
|
private rowToLogRecord;
|
|
309
|
+
getInfo(): {
|
|
310
|
+
adapter: string;
|
|
311
|
+
displayName: string;
|
|
312
|
+
persistent: boolean;
|
|
313
|
+
description: string;
|
|
314
|
+
};
|
|
319
315
|
/**
|
|
320
316
|
* Close the database connection
|
|
321
317
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -21,11 +21,6 @@ interface LibSQLMemoryOptions {
|
|
|
21
21
|
* Auth token for remote connections (optional)
|
|
22
22
|
*/
|
|
23
23
|
authToken?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Maximum number of messages to store per conversation
|
|
26
|
-
* @default 100
|
|
27
|
-
*/
|
|
28
|
-
storageLimit?: number;
|
|
29
24
|
/**
|
|
30
25
|
* Prefix for table names
|
|
31
26
|
* @default "voltagent_memory"
|
|
@@ -58,7 +53,6 @@ interface LibSQLMemoryOptions {
|
|
|
58
53
|
*/
|
|
59
54
|
declare class LibSQLMemoryAdapter implements StorageAdapter {
|
|
60
55
|
private client;
|
|
61
|
-
private storageLimit;
|
|
62
56
|
private tablePrefix;
|
|
63
57
|
private initialized;
|
|
64
58
|
private logger;
|
|
@@ -92,10 +86,6 @@ declare class LibSQLMemoryAdapter implements StorageAdapter {
|
|
|
92
86
|
* Add multiple messages
|
|
93
87
|
*/
|
|
94
88
|
addMessages(messages: UIMessage[], userId: string, conversationId: string): Promise<void>;
|
|
95
|
-
/**
|
|
96
|
-
* Apply storage limit to a conversation
|
|
97
|
-
*/
|
|
98
|
-
private applyStorageLimit;
|
|
99
89
|
/**
|
|
100
90
|
* Get messages with optional filtering
|
|
101
91
|
*/
|
|
@@ -316,6 +306,12 @@ declare class LibSQLObservabilityAdapter implements ObservabilityStorageAdapter
|
|
|
316
306
|
* Convert a database row to an ObservabilityLogRecord
|
|
317
307
|
*/
|
|
318
308
|
private rowToLogRecord;
|
|
309
|
+
getInfo(): {
|
|
310
|
+
adapter: string;
|
|
311
|
+
displayName: string;
|
|
312
|
+
persistent: boolean;
|
|
313
|
+
description: string;
|
|
314
|
+
};
|
|
319
315
|
/**
|
|
320
316
|
* Close the database connection
|
|
321
317
|
*/
|
package/dist/index.js
CHANGED
|
@@ -49,7 +49,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
49
49
|
__name(this, "LibSQLMemoryAdapter");
|
|
50
50
|
}
|
|
51
51
|
client;
|
|
52
|
-
storageLimit;
|
|
53
52
|
tablePrefix;
|
|
54
53
|
initialized = false;
|
|
55
54
|
logger;
|
|
@@ -57,7 +56,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
57
56
|
retryDelayMs;
|
|
58
57
|
url;
|
|
59
58
|
constructor(options = {}) {
|
|
60
|
-
this.storageLimit = options.storageLimit ?? 100;
|
|
61
59
|
this.tablePrefix = options.tablePrefix ?? "voltagent_memory";
|
|
62
60
|
this.maxRetries = options.maxRetries ?? 3;
|
|
63
61
|
this.retryDelayMs = options.retryDelayMs ?? 100;
|
|
@@ -351,7 +349,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
351
349
|
]
|
|
352
350
|
});
|
|
353
351
|
}, "add message");
|
|
354
|
-
await this.applyStorageLimit(conversationId);
|
|
355
352
|
}
|
|
356
353
|
/**
|
|
357
354
|
* Add multiple messages
|
|
@@ -383,26 +380,6 @@ var LibSQLMemoryAdapter = class {
|
|
|
383
380
|
}))
|
|
384
381
|
);
|
|
385
382
|
}, "add batch messages");
|
|
386
|
-
await this.applyStorageLimit(conversationId);
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Apply storage limit to a conversation
|
|
390
|
-
*/
|
|
391
|
-
async applyStorageLimit(conversationId) {
|
|
392
|
-
const messagesTable = `${this.tablePrefix}_messages`;
|
|
393
|
-
await this.executeWithRetry(async () => {
|
|
394
|
-
await this.client.execute({
|
|
395
|
-
sql: `DELETE FROM ${messagesTable}
|
|
396
|
-
WHERE conversation_id = ?
|
|
397
|
-
AND message_id NOT IN (
|
|
398
|
-
SELECT message_id FROM ${messagesTable}
|
|
399
|
-
WHERE conversation_id = ?
|
|
400
|
-
ORDER BY created_at DESC
|
|
401
|
-
LIMIT ?
|
|
402
|
-
)`,
|
|
403
|
-
args: [conversationId, conversationId, this.storageLimit]
|
|
404
|
-
});
|
|
405
|
-
}, "apply storage limit");
|
|
406
383
|
}
|
|
407
384
|
/**
|
|
408
385
|
* Get messages with optional filtering
|
|
@@ -410,7 +387,7 @@ var LibSQLMemoryAdapter = class {
|
|
|
410
387
|
async getMessages(userId, conversationId, options) {
|
|
411
388
|
await this.initialize();
|
|
412
389
|
const messagesTable = `${this.tablePrefix}_messages`;
|
|
413
|
-
const { limit
|
|
390
|
+
const { limit, before, after, roles } = options || {};
|
|
414
391
|
let sql = `SELECT * FROM ${messagesTable}
|
|
415
392
|
WHERE conversation_id = ? AND user_id = ?`;
|
|
416
393
|
const args = [conversationId, userId];
|
|
@@ -1663,6 +1640,14 @@ var LibSQLObservabilityAdapter = class {
|
|
|
1663
1640
|
}
|
|
1664
1641
|
return log;
|
|
1665
1642
|
}
|
|
1643
|
+
getInfo() {
|
|
1644
|
+
return {
|
|
1645
|
+
adapter: this.constructor.name,
|
|
1646
|
+
displayName: "LibSQL Observability Storage",
|
|
1647
|
+
persistent: true,
|
|
1648
|
+
description: "Persists spans and logs to a LibSQL/Turso database for long-term retention."
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1666
1651
|
/**
|
|
1667
1652
|
* Close the database connection
|
|
1668
1653
|
*/
|