@agentmemory/agentmemory 0.9.2 → 0.9.3

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.
@@ -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 loadTeamConfig, a as getConsolidationDecayDays, c as isAutoCompressEnabled, d as isGraphExtractionEnabled, f as loadClaudeBridgeConfig, g as loadSnapshotConfig, h as loadFallbackConfig, i as detectEmbeddingProvider, l as isConsolidationEnabled, m as loadEmbeddingConfig, n as getVisibleTools, o as getEnvVar, p as loadConfig, r as VERSION, t as getAllTools, u as isContextInjectionEnabled } from "./tools-registry-CHH84gIQ.mjs";
2
+ import { _ as loadTeamConfig, a as getConsolidationDecayDays, c as isAutoCompressEnabled, d as isGraphExtractionEnabled, f as loadClaudeBridgeConfig, g as loadSnapshotConfig, h as loadFallbackConfig, i as detectEmbeddingProvider, l as isConsolidationEnabled, m as loadEmbeddingConfig, n as getVisibleTools, o as getEnvVar, p as loadConfig, r as VERSION, t as getAllTools, u as isContextInjectionEnabled } from "./tools-registry-m8Ofn9vV.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";
@@ -2507,10 +2507,10 @@ function registerObserveFunction(sdk, kv, dedupMap, maxObservationsPerSession) {
2507
2507
  };
2508
2508
  }
2509
2509
  if (pendingImageData && (pendingImageData.startsWith("data:image/") || pendingImageData.startsWith("iVBORw0KGgo") || pendingImageData.startsWith("/9j/"))) {
2510
- const { saveImageToDisk } = await import("./image-store-BLOkD0xV.mjs");
2510
+ const { saveImageToDisk } = await import("./image-store-DGvZMMrI.mjs");
2511
2511
  const { filePath, bytesWritten } = await saveImageToDisk(pendingImageData);
2512
2512
  raw.imageData = filePath;
2513
- const { incrementImageRef } = await import("./image-refs-Dq5wcV-a.mjs");
2513
+ const { incrementImageRef } = await import("./image-refs-CESf9ndJ.mjs");
2514
2514
  await incrementImageRef(kv, filePath);
2515
2515
  sdk.triggerVoid("mem::disk-size-delta", { deltaBytes: bytesWritten });
2516
2516
  if (process.env["AGENTMEMORY_IMAGE_EMBEDDINGS"] === "true") sdk.triggerVoid("mem::vision-embed", {
@@ -2523,7 +2523,7 @@ function registerObserveFunction(sdk, kv, dedupMap, maxObservationsPerSession) {
2523
2523
  await kv.set(KV.observations(payload.sessionId), obsId, raw);
2524
2524
  } catch (error) {
2525
2525
  if (raw.imageData) {
2526
- const { deleteImage } = await import("./image-store-BLOkD0xV.mjs");
2526
+ const { deleteImage } = await import("./image-store-DGvZMMrI.mjs");
2527
2527
  const { deletedBytes } = await deleteImage(raw.imageData);
2528
2528
  if (deletedBytes > 0) sdk.triggerVoid("mem::disk-size-delta", { deltaBytes: -deletedBytes });
2529
2529
  }
@@ -4556,7 +4556,7 @@ function registerRememberFunction(sdk, kv) {
4556
4556
  const deletedMemoryIds = [];
4557
4557
  const deletedObservationIds = [];
4558
4558
  let deletedSession = false;
4559
- const { decrementImageRef } = await import("./image-refs-Dq5wcV-a.mjs");
4559
+ const { decrementImageRef } = await import("./image-refs-CESf9ndJ.mjs");
4560
4560
  if (data.memoryId) {
4561
4561
  const mem = await kv.get(KV.memories, data.memoryId);
4562
4562
  await kv.delete(KV.memories, data.memoryId);
@@ -4615,7 +4615,7 @@ const DEFAULTS$1 = {
4615
4615
  function registerEvictFunction(sdk, kv) {
4616
4616
  sdk.registerFunction("mem::evict", async (data) => {
4617
4617
  const dryRun = data?.dryRun ?? false;
4618
- const { decrementImageRef } = await import("./image-refs-Dq5wcV-a.mjs");
4618
+ const { decrementImageRef } = await import("./image-refs-CESf9ndJ.mjs");
4619
4619
  const configOverride = await kv.get(KV.config, "eviction").catch(() => null);
4620
4620
  const cfg = {
4621
4621
  ...DEFAULTS$1,
@@ -5218,7 +5218,7 @@ function registerAutoForgetFunction(sdk, kv) {
5218
5218
  sdk.registerFunction("mem::auto-forget", async (data) => {
5219
5219
  const dryRun = data?.dryRun ?? false;
5220
5220
  const now = Date.now();
5221
- const { decrementImageRef } = await import("./image-refs-Dq5wcV-a.mjs");
5221
+ const { decrementImageRef } = await import("./image-refs-CESf9ndJ.mjs");
5222
5222
  const result = {
5223
5223
  ttlExpired: [],
5224
5224
  contradictions: [],
@@ -5449,7 +5449,8 @@ function registerExportImportFunction(sdk, kv) {
5449
5449
  "0.8.13",
5450
5450
  "0.9.0",
5451
5451
  "0.9.1",
5452
- "0.9.2"
5452
+ "0.9.2",
5453
+ "0.9.3"
5453
5454
  ]).has(importData.version)) return {
5454
5455
  success: false,
5455
5456
  error: `Unsupported export version: ${importData.version}`
@@ -11806,7 +11807,7 @@ function registerRetentionFunctions(sdk, kv) {
11806
11807
  const threshold = typeof data?.threshold === "number" && Number.isFinite(data.threshold) ? data.threshold : DEFAULT_DECAY.tierThresholds.cold;
11807
11808
  const maxEvictRaw = typeof data?.maxEvict === "number" && Number.isInteger(data.maxEvict) ? data.maxEvict : 50;
11808
11809
  const maxEvict = Math.min(1e3, Math.max(0, maxEvictRaw));
11809
- const { decrementImageRef } = await import("./image-refs-Dq5wcV-a.mjs");
11810
+ const { decrementImageRef } = await import("./image-refs-CESf9ndJ.mjs");
11810
11811
  const candidates = (await kv.list(KV.retentionScores)).filter((s) => s.score < threshold).sort((a, b) => a.score - b.score).slice(0, maxEvict);
11811
11812
  if (data?.dryRun) return {
11812
11813
  success: true,
@@ -12747,6 +12748,28 @@ function requireConfiguredSecret(secret, feature) {
12747
12748
  body: { error: `${feature} requires AGENTMEMORY_SECRET` }
12748
12749
  };
12749
12750
  }
12751
+ function flagDisabledResponse(opts) {
12752
+ return {
12753
+ status_code: 503,
12754
+ body: opts
12755
+ };
12756
+ }
12757
+ function graphDisabledResponse() {
12758
+ return flagDisabledResponse({
12759
+ error: "Knowledge graph not enabled",
12760
+ flag: "GRAPH_EXTRACTION_ENABLED",
12761
+ enableHow: "Set GRAPH_EXTRACTION_ENABLED=true and restart. Requires an LLM provider key.",
12762
+ docsHref: "https://github.com/rohitg00/agentmemory#knowledge-graph"
12763
+ });
12764
+ }
12765
+ function consolidationDisabledResponse() {
12766
+ return flagDisabledResponse({
12767
+ error: "Consolidation pipeline not enabled",
12768
+ flag: "CONSOLIDATION_ENABLED",
12769
+ enableHow: "Set CONSOLIDATION_ENABLED=true and restart. Requires an LLM provider key.",
12770
+ docsHref: "https://github.com/rohitg00/agentmemory#consolidation"
12771
+ });
12772
+ }
12750
12773
  function asNonEmptyString$1(value) {
12751
12774
  if (typeof value !== "string") return null;
12752
12775
  const trimmed = value.trim();
@@ -12798,6 +12821,78 @@ function registerApiTriggers(sdk, kv, secret, metricsStore, provider) {
12798
12821
  http_method: "GET"
12799
12822
  }
12800
12823
  });
12824
+ sdk.registerFunction("api::config-flags", async (req) => {
12825
+ const authErr = checkAuth(req, secret);
12826
+ if (authErr) return authErr;
12827
+ const env = process.env;
12828
+ return {
12829
+ status_code: 200,
12830
+ body: {
12831
+ version: VERSION,
12832
+ provider: env["ANTHROPIC_API_KEY"] || env["GEMINI_API_KEY"] || env["OPENROUTER_API_KEY"] || env["MINIMAX_API_KEY"] ? "llm" : "noop",
12833
+ embeddingProvider: detectEmbeddingProvider() ? "embeddings" : "none",
12834
+ flags: [
12835
+ {
12836
+ key: "GRAPH_EXTRACTION_ENABLED",
12837
+ label: "Knowledge graph extraction",
12838
+ enabled: isGraphExtractionEnabled(),
12839
+ default: false,
12840
+ affects: ["Graph", "Dashboard"],
12841
+ needsLlm: true,
12842
+ description: "Extracts entities and relations from observations into a knowledge graph.",
12843
+ enableHow: "Set GRAPH_EXTRACTION_ENABLED=true and provide an LLM key, then restart.",
12844
+ docsHref: "https://github.com/rohitg00/agentmemory#knowledge-graph"
12845
+ },
12846
+ {
12847
+ key: "CONSOLIDATION_ENABLED",
12848
+ label: "Memory consolidation",
12849
+ enabled: isConsolidationEnabled(),
12850
+ default: false,
12851
+ affects: [
12852
+ "Dashboard",
12853
+ "Memories",
12854
+ "Crystals"
12855
+ ],
12856
+ needsLlm: true,
12857
+ description: "Periodically summarizes sessions into semantic facts + procedures.",
12858
+ enableHow: "Set CONSOLIDATION_ENABLED=true and provide an LLM key, then restart.",
12859
+ docsHref: "https://github.com/rohitg00/agentmemory#consolidation"
12860
+ },
12861
+ {
12862
+ key: "AGENTMEMORY_AUTO_COMPRESS",
12863
+ label: "LLM-powered observation compression",
12864
+ enabled: isAutoCompressEnabled(),
12865
+ default: false,
12866
+ affects: ["Memories", "Timeline"],
12867
+ needsLlm: true,
12868
+ description: "Every observation is compressed by the LLM for richer summaries (costs tokens). OFF uses zero-LLM synthetic compression.",
12869
+ enableHow: "Set AGENTMEMORY_AUTO_COMPRESS=true and provide an LLM key.",
12870
+ docsHref: "https://github.com/rohitg00/agentmemory/issues/138"
12871
+ },
12872
+ {
12873
+ key: "AGENTMEMORY_INJECT_CONTEXT",
12874
+ label: "In-conversation context injection",
12875
+ enabled: isContextInjectionEnabled(),
12876
+ default: false,
12877
+ affects: ["Hooks"],
12878
+ needsLlm: false,
12879
+ description: "Hooks write recalled context into Claude Code's conversation. OFF captures in the background without injecting.",
12880
+ enableHow: "Set AGENTMEMORY_INJECT_CONTEXT=true and restart.",
12881
+ docsHref: "https://github.com/rohitg00/agentmemory/issues/143"
12882
+ }
12883
+ ]
12884
+ }
12885
+ };
12886
+ });
12887
+ sdk.registerTrigger({
12888
+ type: "http",
12889
+ function_id: "api::config-flags",
12890
+ config: {
12891
+ api_path: "/agentmemory/config/flags",
12892
+ http_method: "GET",
12893
+ middleware_function_ids: ["middleware::api-auth"]
12894
+ }
12895
+ });
12801
12896
  sdk.registerFunction("api::health", async (req) => {
12802
12897
  const health = await getLatestHealth(kv);
12803
12898
  const functionMetrics = metricsStore ? await metricsStore.getAll() : [];
@@ -13618,10 +13713,7 @@ function registerApiTriggers(sdk, kv, secret, metricsStore, provider) {
13618
13713
  })
13619
13714
  };
13620
13715
  } catch {
13621
- return {
13622
- status_code: 404,
13623
- body: { error: "Knowledge graph not enabled" }
13624
- };
13716
+ return graphDisabledResponse();
13625
13717
  }
13626
13718
  });
13627
13719
  sdk.registerTrigger({
@@ -13644,10 +13736,7 @@ function registerApiTriggers(sdk, kv, secret, metricsStore, provider) {
13644
13736
  })
13645
13737
  };
13646
13738
  } catch {
13647
- return {
13648
- status_code: 404,
13649
- body: { error: "Knowledge graph not enabled" }
13650
- };
13739
+ return graphDisabledResponse();
13651
13740
  }
13652
13741
  });
13653
13742
  sdk.registerTrigger({
@@ -13674,10 +13763,7 @@ function registerApiTriggers(sdk, kv, secret, metricsStore, provider) {
13674
13763
  })
13675
13764
  };
13676
13765
  } catch {
13677
- return {
13678
- status_code: 404,
13679
- body: { error: "Knowledge graph not enabled" }
13680
- };
13766
+ return graphDisabledResponse();
13681
13767
  }
13682
13768
  });
13683
13769
  sdk.registerTrigger({
@@ -13700,10 +13786,7 @@ function registerApiTriggers(sdk, kv, secret, metricsStore, provider) {
13700
13786
  })
13701
13787
  };
13702
13788
  } catch {
13703
- return {
13704
- status_code: 404,
13705
- body: { error: "Consolidation pipeline not enabled" }
13706
- };
13789
+ return consolidationDisabledResponse();
13707
13790
  }
13708
13791
  });
13709
13792
  sdk.registerTrigger({
@@ -17959,4 +18042,4 @@ main().catch((err) => {
17959
18042
 
17960
18043
  //#endregion
17961
18044
  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 };
17962
- //# sourceMappingURL=src-tmuZyobT.mjs.map
18045
+ //# sourceMappingURL=src-3Snd7D3T.mjs.map