@joshuaswarren/openclaw-engram 9.0.88 → 9.0.89

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.
@@ -4,7 +4,7 @@ import {
4
4
  parseContinuityImprovementLoops,
5
5
  parseContinuityIncident,
6
6
  sanitizeMemoryContent
7
- } from "./chunk-C26MLXQM.js";
7
+ } from "./chunk-O4KLNIZ3.js";
8
8
  import {
9
9
  log
10
10
  } from "./chunk-SSIIJJKA.js";
@@ -1805,4 +1805,4 @@ export {
1805
1805
  defaultTierMigrationCycleBudget,
1806
1806
  CompoundingEngine
1807
1807
  };
1808
- //# sourceMappingURL=chunk-ECZTNFXJ.js.map
1808
+ //# sourceMappingURL=chunk-BNMGDMNG.js.map
@@ -109,6 +109,7 @@ var SPECULATIVE_TTL_DAYS = 30;
109
109
 
110
110
  // src/memory-projection-store.ts
111
111
  import path2 from "path";
112
+ import { readFileSync } from "fs";
112
113
  import Database from "better-sqlite3";
113
114
  var MEMORY_PROJECTION_SCHEMA_VERSION = 2;
114
115
  function getMemoryProjectionPath(memoryDir) {
@@ -453,9 +454,6 @@ function readProjectedMemoryTimeline(memoryDir, memoryId, limit) {
453
454
  function readProjectedMemoryBrowse(memoryDir, options) {
454
455
  return withProjectionReadonly(memoryDir, (db) => {
455
456
  const normalizedQuery = options.query?.trim().toLowerCase() ?? "";
456
- if (normalizedQuery) {
457
- return null;
458
- }
459
457
  const currentSelect = memoryCurrentSelectExpressions(db);
460
458
  const whereClauses = [];
461
459
  const params = [];
@@ -482,6 +480,57 @@ function readProjectedMemoryBrowse(memoryDir, options) {
482
480
  }
483
481
  })();
484
482
  const whereSql = whereClauses.length > 0 ? `WHERE ${whereClauses.join(" AND ")}` : "";
483
+ if (normalizedQuery) {
484
+ const allRows = db.prepare(`
485
+ SELECT
486
+ memory_id,
487
+ path_rel,
488
+ category,
489
+ status,
490
+ created_at,
491
+ updated_at,
492
+ entity_ref,
493
+ ${currentSelect.tagsJson},
494
+ ${currentSelect.previewText}
495
+ FROM memory_current
496
+ ${whereSql}
497
+ ORDER BY ${orderBySql}
498
+ `).all(...params);
499
+ const filtered = allRows.filter((row) => {
500
+ if (typeof row.memory_id !== "string" || typeof row.path_rel !== "string") return false;
501
+ const preview = typeof row.preview_text === "string" ? row.preview_text.toLowerCase() : "";
502
+ const category = typeof row.category === "string" ? row.category.toLowerCase() : "";
503
+ const entityRef = typeof row.entity_ref === "string" ? row.entity_ref.toLowerCase() : "";
504
+ const tags = typeof row.tags_json === "string" ? row.tags_json.toLowerCase() : "";
505
+ if (preview.includes(normalizedQuery) || category.includes(normalizedQuery) || entityRef.includes(normalizedQuery) || tags.includes(normalizedQuery)) {
506
+ return true;
507
+ }
508
+ try {
509
+ const filePath = path2.join(memoryDir, row.path_rel);
510
+ const content = readFileSync(filePath, "utf-8").toLowerCase();
511
+ return content.includes(normalizedQuery);
512
+ } catch {
513
+ return false;
514
+ }
515
+ });
516
+ const pageRows = filtered.slice(options.offset, options.offset + options.limit);
517
+ return {
518
+ total: filtered.length,
519
+ memories: pageRows.filter(
520
+ (row) => typeof row.memory_id === "string" && typeof row.path_rel === "string" && typeof row.category === "string" && typeof row.status === "string"
521
+ ).map((row) => ({
522
+ id: row.memory_id,
523
+ path: path2.join(memoryDir, row.path_rel),
524
+ category: row.category,
525
+ status: row.status,
526
+ created: typeof row.created_at === "string" ? row.created_at : void 0,
527
+ updated: typeof row.updated_at === "string" ? row.updated_at : void 0,
528
+ tags: parseStringArray(row.tags_json),
529
+ entityRef: typeof row.entity_ref === "string" ? row.entity_ref : void 0,
530
+ preview: typeof row.preview_text === "string" ? row.preview_text : ""
531
+ }))
532
+ };
533
+ }
485
534
  const totalRow = db.prepare(`SELECT COUNT(*) AS total FROM memory_current ${whereSql}`).get(...params);
486
535
  const rows = db.prepare(`
487
536
  SELECT
@@ -3810,4 +3859,4 @@ export {
3810
3859
  serializeEntityFile,
3811
3860
  StorageManager
3812
3861
  };
3813
- //# sourceMappingURL=chunk-C26MLXQM.js.map
3862
+ //# sourceMappingURL=chunk-O4KLNIZ3.js.map