@mastra/libsql 1.24.1-alpha.1 → 1.25.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/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +23 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +1 -0
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -7826,6 +7826,7 @@ function addSqliteMetadataValuePredicate(conditions, params, path, value) {
|
|
|
7826
7826
|
var MemoryLibSQL = class MemoryLibSQL extends MemoryStorage {
|
|
7827
7827
|
supportsPartialThreadUpdate = true;
|
|
7828
7828
|
supportsObservationalMemory = true;
|
|
7829
|
+
supportsObservationalMemoryHistorySearch = true;
|
|
7829
7830
|
/**
|
|
7830
7831
|
* Retention-eligible tables. `threads`, `messages`, and `resources` all anchor
|
|
7831
7832
|
* on `createdAt` and are indexed for fast batched deletes. Cascade order is
|
|
@@ -8997,6 +8998,10 @@ var MemoryLibSQL = class MemoryLibSQL extends MemoryStorage {
|
|
|
8997
8998
|
const lookupKey = this.getOMKey(threadId, resourceId);
|
|
8998
8999
|
const conditions = [`"lookupKey" = ?`];
|
|
8999
9000
|
const args = [lookupKey];
|
|
9001
|
+
if (options?.recordId !== void 0) {
|
|
9002
|
+
conditions.push(`id = ?`);
|
|
9003
|
+
args.push(options.recordId);
|
|
9004
|
+
}
|
|
9000
9005
|
if (options?.from) {
|
|
9001
9006
|
conditions.push(`"createdAt" >= ?`);
|
|
9002
9007
|
args.push(options.from.toISOString());
|
|
@@ -9005,8 +9010,25 @@ var MemoryLibSQL = class MemoryLibSQL extends MemoryStorage {
|
|
|
9005
9010
|
conditions.push(`"createdAt" <= ?`);
|
|
9006
9011
|
args.push(options.to.toISOString());
|
|
9007
9012
|
}
|
|
9013
|
+
if (options?.groupId !== void 0) {
|
|
9014
|
+
conditions.push(`(instr("activeObservations", ?) > 0 OR EXISTS (
|
|
9015
|
+
SELECT 1 FROM json_each("bufferedObservationChunks") AS chunk
|
|
9016
|
+
WHERE instr(json_extract(chunk.value, '$.observations'), ?) > 0
|
|
9017
|
+
))`);
|
|
9018
|
+
const prefix = `<observation-group id="${options.groupId}"`;
|
|
9019
|
+
args.push(prefix, prefix);
|
|
9020
|
+
}
|
|
9021
|
+
if (options?.beforeGeneration !== void 0) {
|
|
9022
|
+
conditions.push(`"generationCount" < ?`);
|
|
9023
|
+
args.push(options.beforeGeneration);
|
|
9024
|
+
}
|
|
9025
|
+
if (options?.afterGeneration !== void 0) {
|
|
9026
|
+
conditions.push(`"generationCount" > ?`);
|
|
9027
|
+
args.push(options.afterGeneration);
|
|
9028
|
+
}
|
|
9029
|
+
const direction = options?.sortDirection === "ASC" ? "ASC" : "DESC";
|
|
9008
9030
|
args.push(limit);
|
|
9009
|
-
let sql = `SELECT * FROM "${OM_TABLE}" WHERE ${conditions.join(" AND ")} ORDER BY "generationCount"
|
|
9031
|
+
let sql = `SELECT * FROM "${OM_TABLE}" WHERE ${conditions.join(" AND ")} ORDER BY "generationCount" ${direction}, "createdAt" ASC, id ASC LIMIT ?`;
|
|
9010
9032
|
if (options?.offset != null) {
|
|
9011
9033
|
args.push(options.offset);
|
|
9012
9034
|
sql += ` OFFSET ?`;
|