@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.
@@ -3,7 +3,7 @@ name: mastra-libsql
3
3
  description: Documentation for @mastra/libsql. Use when working with @mastra/libsql APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/libsql"
6
- version: "1.24.1-alpha.1"
6
+ version: "1.25.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.24.1-alpha.1",
2
+ "version": "1.25.0",
3
3
  "package": "@mastra/libsql",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -7827,6 +7827,7 @@ function addSqliteMetadataValuePredicate(conditions, params, path, value) {
7827
7827
  var MemoryLibSQL = class MemoryLibSQL extends _mastra_core_storage.MemoryStorage {
7828
7828
  supportsPartialThreadUpdate = true;
7829
7829
  supportsObservationalMemory = true;
7830
+ supportsObservationalMemoryHistorySearch = true;
7830
7831
  /**
7831
7832
  * Retention-eligible tables. `threads`, `messages`, and `resources` all anchor
7832
7833
  * on `createdAt` and are indexed for fast batched deletes. Cascade order is
@@ -8998,6 +8999,10 @@ var MemoryLibSQL = class MemoryLibSQL extends _mastra_core_storage.MemoryStorage
8998
8999
  const lookupKey = this.getOMKey(threadId, resourceId);
8999
9000
  const conditions = [`"lookupKey" = ?`];
9000
9001
  const args = [lookupKey];
9002
+ if (options?.recordId !== void 0) {
9003
+ conditions.push(`id = ?`);
9004
+ args.push(options.recordId);
9005
+ }
9001
9006
  if (options?.from) {
9002
9007
  conditions.push(`"createdAt" >= ?`);
9003
9008
  args.push(options.from.toISOString());
@@ -9006,8 +9011,25 @@ var MemoryLibSQL = class MemoryLibSQL extends _mastra_core_storage.MemoryStorage
9006
9011
  conditions.push(`"createdAt" <= ?`);
9007
9012
  args.push(options.to.toISOString());
9008
9013
  }
9014
+ if (options?.groupId !== void 0) {
9015
+ conditions.push(`(instr("activeObservations", ?) > 0 OR EXISTS (
9016
+ SELECT 1 FROM json_each("bufferedObservationChunks") AS chunk
9017
+ WHERE instr(json_extract(chunk.value, '$.observations'), ?) > 0
9018
+ ))`);
9019
+ const prefix = `<observation-group id="${options.groupId}"`;
9020
+ args.push(prefix, prefix);
9021
+ }
9022
+ if (options?.beforeGeneration !== void 0) {
9023
+ conditions.push(`"generationCount" < ?`);
9024
+ args.push(options.beforeGeneration);
9025
+ }
9026
+ if (options?.afterGeneration !== void 0) {
9027
+ conditions.push(`"generationCount" > ?`);
9028
+ args.push(options.afterGeneration);
9029
+ }
9030
+ const direction = options?.sortDirection === "ASC" ? "ASC" : "DESC";
9009
9031
  args.push(limit);
9010
- let sql = `SELECT * FROM "${OM_TABLE}" WHERE ${conditions.join(" AND ")} ORDER BY "generationCount" DESC LIMIT ?`;
9032
+ let sql = `SELECT * FROM "${OM_TABLE}" WHERE ${conditions.join(" AND ")} ORDER BY "generationCount" ${direction}, "createdAt" ASC, id ASC LIMIT ?`;
9011
9033
  if (options?.offset != null) {
9012
9034
  args.push(options.offset);
9013
9035
  sql += ` OFFSET ?`;