@voltagent/libsql 1.0.7 → 1.0.9
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 +0 -10
- package/dist/index.d.ts +0 -10
- package/dist/index.js +1 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -10
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
|
*/
|
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
|
*/
|
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];
|