@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
@@ -1,5 +1,5 @@
1
1
  import { a as jaccardSimilarity, i as generateId, n as STREAM, r as fingerprintId, t as KV } from "./cli.mjs";
2
- import { _ as loadSnapshotConfig, a as detectLlmProviderKind, d as isContextInjectionEnabled, f as isGraphExtractionEnabled, g as loadFallbackConfig, h as loadEmbeddingConfig, i as detectEmbeddingProvider, l as isAutoCompressEnabled, m as loadConfig, n as getVisibleTools, o as getConsolidationDecayDays, p as loadClaudeBridgeConfig, r as VERSION, s as getEnvVar, t as getAllTools, u as isConsolidationEnabled, v as loadTeamConfig } from "./tools-registry-BWM0vWeA.mjs";
2
+ import { _ as loadSnapshotConfig, a as detectLlmProviderKind, d as isContextInjectionEnabled, f as isGraphExtractionEnabled, g as loadFallbackConfig, h as loadEmbeddingConfig, i as detectEmbeddingProvider, l as isAutoCompressEnabled, m as loadConfig, n as getVisibleTools, o as getConsolidationDecayDays, p as loadClaudeBridgeConfig, r as VERSION, s as getEnvVar, t as getAllTools, u as isConsolidationEnabled, v as loadTeamConfig } from "./tools-registry-UpRrZBDD.mjs";
3
3
  import { execFile } from "node:child_process";
4
4
  import { constants, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
5
5
  import { basename, dirname, extname, join, resolve, sep } from "node:path";
@@ -1036,6 +1036,23 @@ var VectorIndex = class VectorIndex {
1036
1036
  }
1037
1037
  };
1038
1038
 
1039
+ //#endregion
1040
+ //#region src/state/memory-utils.ts
1041
+ function memoryToObservation(memory) {
1042
+ return {
1043
+ id: memory.id,
1044
+ sessionId: memory.sessionIds[0] ?? "memory",
1045
+ timestamp: memory.createdAt,
1046
+ type: "decision",
1047
+ title: memory.title,
1048
+ facts: [memory.content],
1049
+ narrative: memory.content,
1050
+ concepts: memory.concepts,
1051
+ files: memory.files,
1052
+ importance: memory.strength
1053
+ };
1054
+ }
1055
+
1039
1056
  //#endregion
1040
1057
  //#region src/functions/graph-retrieval.ts
1041
1058
  function buildGraphContext(path) {
@@ -1600,7 +1617,12 @@ var HybridSearch = class {
1600
1617
  }
1601
1618
  async enrichResults(results, limit) {
1602
1619
  const sliced = results.slice(0, limit);
1603
- const observations = await Promise.all(sliced.map((r) => this.kv.get(KV.observations(r.sessionId), r.obsId).catch(() => null)));
1620
+ const observations = await Promise.all(sliced.map(async (r) => {
1621
+ const obs = await this.kv.get(KV.observations(r.sessionId), r.obsId).catch(() => null);
1622
+ if (obs) return obs;
1623
+ const mem = await this.kv.get(KV.memories, r.obsId).catch(() => null);
1624
+ return mem ? memoryToObservation(mem) : null;
1625
+ }));
1604
1626
  const enriched = [];
1605
1627
  for (let i = 0; i < sliced.length; i++) {
1606
1628
  const obs = observations[i];
@@ -2317,20 +2339,6 @@ async function deleteAccessLog(kv, memoryId) {
2317
2339
 
2318
2340
  //#endregion
2319
2341
  //#region src/functions/search.ts
2320
- function memoryAsIndexable$1(memory) {
2321
- return {
2322
- id: memory.id,
2323
- sessionId: memory.sessionIds[0] ?? "memory",
2324
- timestamp: memory.createdAt,
2325
- type: "decision",
2326
- title: memory.title,
2327
- facts: [memory.content],
2328
- narrative: memory.content,
2329
- concepts: memory.concepts,
2330
- files: memory.files,
2331
- importance: memory.strength
2332
- };
2333
- }
2334
2342
  let index = null;
2335
2343
  function getSearchIndex() {
2336
2344
  if (!index) index = new SearchIndex();
@@ -2345,7 +2353,7 @@ async function rebuildIndex(kv) {
2345
2353
  for (const memory of memories) {
2346
2354
  if (memory.isLatest === false) continue;
2347
2355
  if (!memory.title || !memory.content) continue;
2348
- idx.add(memoryAsIndexable$1(memory));
2356
+ idx.add(memoryToObservation(memory));
2349
2357
  count++;
2350
2358
  }
2351
2359
  } catch (err) {
@@ -2423,7 +2431,12 @@ function registerSearchFunction(sdk, kv) {
2423
2431
  }
2424
2432
  candidates.push(r);
2425
2433
  }
2426
- const obsResults = await Promise.all(candidates.map((r) => kv.get(KV.observations(r.sessionId), r.obsId)));
2434
+ const obsResults = await Promise.all(candidates.map(async (r) => {
2435
+ const obs = await kv.get(KV.observations(r.sessionId), r.obsId).catch(() => null);
2436
+ if (obs) return obs;
2437
+ const mem = await kv.get(KV.memories, r.obsId).catch(() => null);
2438
+ return mem ? memoryToObservation(mem) : null;
2439
+ }));
2427
2440
  const enriched = [];
2428
2441
  for (let i = 0; i < candidates.length; i++) {
2429
2442
  const obs = obsResults[i];
@@ -2587,10 +2600,10 @@ function registerObserveFunction(sdk, kv, dedupMap, maxObservationsPerSession) {
2587
2600
  };
2588
2601
  }
2589
2602
  if (pendingImageData && (pendingImageData.startsWith("data:image/") || pendingImageData.startsWith("iVBORw0KGgo") || pendingImageData.startsWith("/9j/"))) {
2590
- const { saveImageToDisk } = await import("./image-store-DnuCI2RB.mjs");
2603
+ const { saveImageToDisk } = await import("./image-store-Bx3J2RQ8.mjs");
2591
2604
  const { filePath, bytesWritten } = await saveImageToDisk(pendingImageData);
2592
2605
  raw.imageData = filePath;
2593
- const { incrementImageRef } = await import("./image-refs-DRse_ePx.mjs");
2606
+ const { incrementImageRef } = await import("./image-refs-B2vyIEyZ.mjs");
2594
2607
  await incrementImageRef(kv, filePath);
2595
2608
  sdk.triggerVoid("mem::disk-size-delta", { deltaBytes: bytesWritten });
2596
2609
  if (process.env["AGENTMEMORY_IMAGE_EMBEDDINGS"] === "true") sdk.triggerVoid("mem::vision-embed", {
@@ -2603,7 +2616,7 @@ function registerObserveFunction(sdk, kv, dedupMap, maxObservationsPerSession) {
2603
2616
  await kv.set(KV.observations(payload.sessionId), obsId, raw);
2604
2617
  } catch (error) {
2605
2618
  if (raw.imageData) {
2606
- const { deleteImage } = await import("./image-store-DnuCI2RB.mjs");
2619
+ const { deleteImage } = await import("./image-store-Bx3J2RQ8.mjs");
2607
2620
  const { deletedBytes } = await deleteImage(raw.imageData);
2608
2621
  if (deletedBytes > 0) sdk.triggerVoid("mem::disk-size-delta", { deltaBytes: -deletedBytes });
2609
2622
  }
@@ -4551,20 +4564,6 @@ function registerPatternsFunction(sdk, kv) {
4551
4564
 
4552
4565
  //#endregion
4553
4566
  //#region src/functions/remember.ts
4554
- function memoryAsIndexable(memory) {
4555
- return {
4556
- id: memory.id,
4557
- sessionId: memory.sessionIds[0] ?? "memory",
4558
- timestamp: memory.createdAt,
4559
- type: "decision",
4560
- title: memory.title,
4561
- facts: [memory.content],
4562
- narrative: memory.content,
4563
- concepts: memory.concepts,
4564
- files: memory.files,
4565
- importance: memory.strength
4566
- };
4567
- }
4568
4567
  function registerRememberFunction(sdk, kv) {
4569
4568
  sdk.registerFunction("mem::remember", async (data) => {
4570
4569
  if (!data.content || typeof data.content !== "string" || !data.content.trim()) return {
@@ -4631,7 +4630,7 @@ function registerRememberFunction(sdk, kv) {
4631
4630
  }
4632
4631
  await kv.set(KV.memories, memory.id, memory);
4633
4632
  try {
4634
- getSearchIndex().add(memoryAsIndexable(memory));
4633
+ getSearchIndex().add(memoryToObservation(memory));
4635
4634
  } catch (err) {
4636
4635
  logger.warn("Failed to index saved memory into BM25", {
4637
4636
  memId: memory.id,
@@ -4658,7 +4657,7 @@ function registerRememberFunction(sdk, kv) {
4658
4657
  const deletedMemoryIds = [];
4659
4658
  const deletedObservationIds = [];
4660
4659
  let deletedSession = false;
4661
- const { decrementImageRef } = await import("./image-refs-DRse_ePx.mjs");
4660
+ const { decrementImageRef } = await import("./image-refs-B2vyIEyZ.mjs");
4662
4661
  if (data.memoryId) {
4663
4662
  const mem = await kv.get(KV.memories, data.memoryId);
4664
4663
  await kv.delete(KV.memories, data.memoryId);
@@ -4717,7 +4716,7 @@ const DEFAULTS$1 = {
4717
4716
  function registerEvictFunction(sdk, kv) {
4718
4717
  sdk.registerFunction("mem::evict", async (data) => {
4719
4718
  const dryRun = data?.dryRun ?? false;
4720
- const { decrementImageRef } = await import("./image-refs-DRse_ePx.mjs");
4719
+ const { decrementImageRef } = await import("./image-refs-B2vyIEyZ.mjs");
4721
4720
  const configOverride = await kv.get(KV.config, "eviction").catch(() => null);
4722
4721
  const cfg = {
4723
4722
  ...DEFAULTS$1,
@@ -5320,7 +5319,7 @@ function registerAutoForgetFunction(sdk, kv) {
5320
5319
  sdk.registerFunction("mem::auto-forget", async (data) => {
5321
5320
  const dryRun = data?.dryRun ?? false;
5322
5321
  const now = Date.now();
5323
- const { decrementImageRef } = await import("./image-refs-DRse_ePx.mjs");
5322
+ const { decrementImageRef } = await import("./image-refs-B2vyIEyZ.mjs");
5324
5323
  const result = {
5325
5324
  ttlExpired: [],
5326
5325
  contradictions: [],
@@ -5554,7 +5553,9 @@ function registerExportImportFunction(sdk, kv) {
5554
5553
  "0.9.2",
5555
5554
  "0.9.3",
5556
5555
  "0.9.4",
5557
- "0.9.5"
5556
+ "0.9.5",
5557
+ "0.9.6",
5558
+ "0.9.7"
5558
5559
  ]).has(importData.version)) return {
5559
5560
  success: false,
5560
5561
  error: `Unsupported export version: ${importData.version}`
@@ -11911,7 +11912,7 @@ function registerRetentionFunctions(sdk, kv) {
11911
11912
  const threshold = typeof data?.threshold === "number" && Number.isFinite(data.threshold) ? data.threshold : DEFAULT_DECAY.tierThresholds.cold;
11912
11913
  const maxEvictRaw = typeof data?.maxEvict === "number" && Number.isInteger(data.maxEvict) ? data.maxEvict : 50;
11913
11914
  const maxEvict = Math.min(1e3, Math.max(0, maxEvictRaw));
11914
- const { decrementImageRef } = await import("./image-refs-DRse_ePx.mjs");
11915
+ const { decrementImageRef } = await import("./image-refs-B2vyIEyZ.mjs");
11915
11916
  const candidates = (await kv.list(KV.retentionScores)).filter((s) => s.score < threshold).sort((a, b) => a.score - b.score).slice(0, maxEvict);
11916
11917
  if (data?.dryRun) return {
11917
11918
  success: true,
@@ -18265,4 +18266,4 @@ main().catch((err) => {
18265
18266
 
18266
18267
  //#endregion
18267
18268
  export { deleteImage as a, saveImageToDisk as c, IMAGES_DIR as i, touchImage as l, getImageRefCount as n, getMaxBytes as o, incrementImageRef as r, isManagedImagePath as s, decrementImageRef as t };
18268
- //# sourceMappingURL=src-xYHSzz5S.mjs.map
18269
+ //# sourceMappingURL=src-DbgW4F8O.mjs.map