@agentmemory/agentmemory 0.9.5 → 0.9.7

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.
Files changed (32) hide show
  1. package/dist/cli.mjs +12 -5
  2. package/dist/cli.mjs.map +1 -1
  3. package/dist/docker-compose.yml +5 -0
  4. package/dist/hooks/session-start.mjs +23 -10
  5. package/dist/hooks/session-start.mjs.map +1 -1
  6. package/dist/hooks/subagent-start.mjs +17 -18
  7. package/dist/hooks/subagent-start.mjs.map +1 -1
  8. package/dist/iii-config.docker.yaml +2 -2
  9. package/dist/image-refs-B2vyIEyZ.mjs +3 -0
  10. package/dist/{image-store-DnuCI2RB.mjs → image-store-Bx3J2RQ8.mjs} +1 -1
  11. package/dist/index.mjs +35 -34
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/{src-xYHSzz5S.mjs → src-DbgW4F8O.mjs} +43 -42
  14. package/dist/src-DbgW4F8O.mjs.map +1 -0
  15. package/dist/{standalone-BvKacAId.mjs → standalone-CFJp7B7c.mjs} +71 -10
  16. package/dist/standalone-CFJp7B7c.mjs.map +1 -0
  17. package/dist/standalone.d.mts.map +1 -1
  18. package/dist/standalone.mjs +70 -9
  19. package/dist/standalone.mjs.map +1 -1
  20. package/dist/{tools-registry-BWM0vWeA.mjs → tools-registry-UpRrZBDD.mjs} +2 -2
  21. package/dist/{tools-registry-BWM0vWeA.mjs.map → tools-registry-UpRrZBDD.mjs.map} +1 -1
  22. package/docker-compose.yml +5 -0
  23. package/iii-config.docker.yaml +2 -2
  24. package/package.json +1 -1
  25. package/plugin/.claude-plugin/plugin.json +1 -1
  26. package/plugin/scripts/session-start.mjs +23 -10
  27. package/plugin/scripts/session-start.mjs.map +1 -1
  28. package/plugin/scripts/subagent-start.mjs +17 -18
  29. package/plugin/scripts/subagent-start.mjs.map +1 -1
  30. package/dist/image-refs-DRse_ePx.mjs +0 -3
  31. package/dist/src-xYHSzz5S.mjs.map +0 -1
  32. package/dist/standalone-BvKacAId.mjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -1213,6 +1213,23 @@ var VectorIndex = class VectorIndex {
1213
1213
  }
1214
1214
  };
1215
1215
 
1216
+ //#endregion
1217
+ //#region src/state/memory-utils.ts
1218
+ function memoryToObservation(memory) {
1219
+ return {
1220
+ id: memory.id,
1221
+ sessionId: memory.sessionIds[0] ?? "memory",
1222
+ timestamp: memory.createdAt,
1223
+ type: "decision",
1224
+ title: memory.title,
1225
+ facts: [memory.content],
1226
+ narrative: memory.content,
1227
+ concepts: memory.concepts,
1228
+ files: memory.files,
1229
+ importance: memory.strength
1230
+ };
1231
+ }
1232
+
1216
1233
  //#endregion
1217
1234
  //#region src/functions/graph-retrieval.ts
1218
1235
  function buildGraphContext(path) {
@@ -1777,7 +1794,12 @@ var HybridSearch = class {
1777
1794
  }
1778
1795
  async enrichResults(results, limit) {
1779
1796
  const sliced = results.slice(0, limit);
1780
- const observations = await Promise.all(sliced.map((r) => this.kv.get(KV.observations(r.sessionId), r.obsId).catch(() => null)));
1797
+ const observations = await Promise.all(sliced.map(async (r) => {
1798
+ const obs = await this.kv.get(KV.observations(r.sessionId), r.obsId).catch(() => null);
1799
+ if (obs) return obs;
1800
+ const mem = await this.kv.get(KV.memories, r.obsId).catch(() => null);
1801
+ return mem ? memoryToObservation(mem) : null;
1802
+ }));
1781
1803
  const enriched = [];
1782
1804
  for (let i = 0; i < sliced.length; i++) {
1783
1805
  const obs = observations[i];
@@ -2507,20 +2529,6 @@ async function deleteAccessLog(kv, memoryId) {
2507
2529
 
2508
2530
  //#endregion
2509
2531
  //#region src/functions/search.ts
2510
- function memoryAsIndexable$1(memory) {
2511
- return {
2512
- id: memory.id,
2513
- sessionId: memory.sessionIds[0] ?? "memory",
2514
- timestamp: memory.createdAt,
2515
- type: "decision",
2516
- title: memory.title,
2517
- facts: [memory.content],
2518
- narrative: memory.content,
2519
- concepts: memory.concepts,
2520
- files: memory.files,
2521
- importance: memory.strength
2522
- };
2523
- }
2524
2532
  let index = null;
2525
2533
  function getSearchIndex() {
2526
2534
  if (!index) index = new SearchIndex();
@@ -2535,7 +2543,7 @@ async function rebuildIndex(kv) {
2535
2543
  for (const memory of memories) {
2536
2544
  if (memory.isLatest === false) continue;
2537
2545
  if (!memory.title || !memory.content) continue;
2538
- idx.add(memoryAsIndexable$1(memory));
2546
+ idx.add(memoryToObservation(memory));
2539
2547
  count++;
2540
2548
  }
2541
2549
  } catch (err) {
@@ -2613,7 +2621,12 @@ function registerSearchFunction(sdk, kv) {
2613
2621
  }
2614
2622
  candidates.push(r);
2615
2623
  }
2616
- const obsResults = await Promise.all(candidates.map((r) => kv.get(KV.observations(r.sessionId), r.obsId)));
2624
+ const obsResults = await Promise.all(candidates.map(async (r) => {
2625
+ const obs = await kv.get(KV.observations(r.sessionId), r.obsId).catch(() => null);
2626
+ if (obs) return obs;
2627
+ const mem = await kv.get(KV.memories, r.obsId).catch(() => null);
2628
+ return mem ? memoryToObservation(mem) : null;
2629
+ }));
2617
2630
  const enriched = [];
2618
2631
  for (let i = 0; i < candidates.length; i++) {
2619
2632
  const obs = obsResults[i];
@@ -4848,20 +4861,6 @@ function registerPatternsFunction(sdk, kv) {
4848
4861
 
4849
4862
  //#endregion
4850
4863
  //#region src/functions/remember.ts
4851
- function memoryAsIndexable(memory) {
4852
- return {
4853
- id: memory.id,
4854
- sessionId: memory.sessionIds[0] ?? "memory",
4855
- timestamp: memory.createdAt,
4856
- type: "decision",
4857
- title: memory.title,
4858
- facts: [memory.content],
4859
- narrative: memory.content,
4860
- concepts: memory.concepts,
4861
- files: memory.files,
4862
- importance: memory.strength
4863
- };
4864
- }
4865
4864
  function registerRememberFunction(sdk, kv) {
4866
4865
  sdk.registerFunction("mem::remember", async (data) => {
4867
4866
  if (!data.content || typeof data.content !== "string" || !data.content.trim()) return {
@@ -4928,7 +4927,7 @@ function registerRememberFunction(sdk, kv) {
4928
4927
  }
4929
4928
  await kv.set(KV.memories, memory.id, memory);
4930
4929
  try {
4931
- getSearchIndex().add(memoryAsIndexable(memory));
4930
+ getSearchIndex().add(memoryToObservation(memory));
4932
4931
  } catch (err) {
4933
4932
  logger.warn("Failed to index saved memory into BM25", {
4934
4933
  memId: memory.id,
@@ -5732,7 +5731,7 @@ function registerAutoForgetFunction(sdk, kv) {
5732
5731
 
5733
5732
  //#endregion
5734
5733
  //#region src/version.ts
5735
- const VERSION = "0.9.5";
5734
+ const VERSION = "0.9.7";
5736
5735
 
5737
5736
  //#endregion
5738
5737
  //#region src/functions/export-import.ts
@@ -5855,7 +5854,9 @@ function registerExportImportFunction(sdk, kv) {
5855
5854
  "0.9.2",
5856
5855
  "0.9.3",
5857
5856
  "0.9.4",
5858
- "0.9.5"
5857
+ "0.9.5",
5858
+ "0.9.6",
5859
+ "0.9.7"
5859
5860
  ]).has(importData.version)) return {
5860
5861
  success: false,
5861
5862
  error: `Unsupported export version: ${importData.version}`