@mastra/memory 1.2.0 → 1.3.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/dist/{chunk-5YW6JV6Y.js → chunk-F5P5HTMC.js} +135 -67
  3. package/dist/chunk-F5P5HTMC.js.map +1 -0
  4. package/dist/{chunk-7SCXX4S7.cjs → chunk-LXATBJ2L.cjs} +137 -66
  5. package/dist/chunk-LXATBJ2L.cjs.map +1 -0
  6. package/dist/docs/SKILL.md +1 -1
  7. package/dist/docs/assets/SOURCE_MAP.json +26 -14
  8. package/dist/docs/references/docs-memory-observational-memory.md +86 -11
  9. package/dist/docs/references/reference-memory-observational-memory.md +318 -9
  10. package/dist/index.cjs +22 -1
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +22 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/observational-memory-3DA7KJIH.js +3 -0
  16. package/dist/{observational-memory-LI6QFTRE.js.map → observational-memory-3DA7KJIH.js.map} +1 -1
  17. package/dist/observational-memory-SA5RITIG.cjs +64 -0
  18. package/dist/{observational-memory-G3HACXHE.cjs.map → observational-memory-SA5RITIG.cjs.map} +1 -1
  19. package/dist/processors/index.cjs +24 -12
  20. package/dist/processors/index.js +1 -1
  21. package/dist/processors/observational-memory/index.d.ts +1 -1
  22. package/dist/processors/observational-memory/index.d.ts.map +1 -1
  23. package/dist/processors/observational-memory/observational-memory.d.ts +41 -4
  24. package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
  25. package/package.json +7 -7
  26. package/dist/chunk-5YW6JV6Y.js.map +0 -1
  27. package/dist/chunk-7SCXX4S7.cjs.map +0 -1
  28. package/dist/observational-memory-G3HACXHE.cjs +0 -52
  29. package/dist/observational-memory-LI6QFTRE.js +0 -3
package/dist/index.cjs CHANGED
@@ -15891,6 +15891,27 @@ Notes:
15891
15891
  if (this.vector && config.semanticRecall && result.clonedMessages.length > 0) {
15892
15892
  await this.embedClonedMessages(result.clonedMessages, config);
15893
15893
  }
15894
+ if (config.workingMemory?.enabled) {
15895
+ const scope = config.workingMemory.scope || "resource";
15896
+ const sourceThread = await this.getThreadById({ threadId: args.sourceThreadId });
15897
+ const sourceResourceId = sourceThread?.resourceId;
15898
+ const shouldCopy = scope === "thread" || scope === "resource" && args.resourceId && args.resourceId !== sourceResourceId;
15899
+ if (shouldCopy) {
15900
+ const sourceWm = await this.getWorkingMemory({
15901
+ threadId: args.sourceThreadId,
15902
+ resourceId: sourceResourceId,
15903
+ memoryConfig
15904
+ });
15905
+ if (sourceWm) {
15906
+ await this.updateWorkingMemory({
15907
+ threadId: result.thread.id,
15908
+ resourceId: result.thread.resourceId,
15909
+ workingMemory: sourceWm,
15910
+ memoryConfig
15911
+ });
15912
+ }
15913
+ }
15914
+ }
15894
15915
  return result;
15895
15916
  }
15896
15917
  /**
@@ -16125,7 +16146,7 @@ Notes:
16125
16146
  "Observational memory async buffering is enabled by default but the installed version of @mastra/core does not support it. Either upgrade @mastra/core, @mastra/memory, and your storage adapter (@mastra/libsql, @mastra/pg, or @mastra/mongodb) to the latest version, or explicitly disable async buffering by setting `observation: { bufferTokens: false }` in your observationalMemory config."
16126
16147
  );
16127
16148
  }
16128
- const { ObservationalMemory } = await import('./observational-memory-G3HACXHE.cjs');
16149
+ const { ObservationalMemory } = await import('./observational-memory-SA5RITIG.cjs');
16129
16150
  return new ObservationalMemory({
16130
16151
  storage: memoryStore,
16131
16152
  scope: omConfig.scope,