@mastra/memory 1.1.0 → 1.2.0-alpha.1

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 (95) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/dist/_types/@internal_ai-sdk-v4/dist/index.d.ts +30 -17
  3. package/dist/{chunk-6TXUWFIU.js → chunk-5YW6JV6Y.js} +1958 -321
  4. package/dist/chunk-5YW6JV6Y.js.map +1 -0
  5. package/dist/{chunk-FQJWVCDF.cjs → chunk-7SCXX4S7.cjs} +1957 -320
  6. package/dist/chunk-7SCXX4S7.cjs.map +1 -0
  7. package/dist/chunk-EQ4M72KU.js +439 -0
  8. package/dist/chunk-EQ4M72KU.js.map +1 -0
  9. package/dist/{chunk-O3CS4UGX.cjs → chunk-IDRQZVB4.cjs} +4 -4
  10. package/dist/{chunk-O3CS4UGX.cjs.map → chunk-IDRQZVB4.cjs.map} +1 -1
  11. package/dist/{chunk-YF4R74L2.js → chunk-RC6RZVYE.js} +4 -4
  12. package/dist/{chunk-YF4R74L2.js.map → chunk-RC6RZVYE.js.map} +1 -1
  13. package/dist/chunk-ZD3BKU5O.cjs +441 -0
  14. package/dist/chunk-ZD3BKU5O.cjs.map +1 -0
  15. package/dist/docs/SKILL.md +51 -50
  16. package/dist/docs/{SOURCE_MAP.json → assets/SOURCE_MAP.json} +22 -22
  17. package/dist/docs/{agents/03-agent-approval.md → references/docs-agents-agent-approval.md} +19 -19
  18. package/dist/docs/references/docs-agents-agent-memory.md +212 -0
  19. package/dist/docs/{agents/04-network-approval.md → references/docs-agents-network-approval.md} +13 -12
  20. package/dist/docs/{agents/02-networks.md → references/docs-agents-networks.md} +10 -12
  21. package/dist/docs/{memory/06-memory-processors.md → references/docs-memory-memory-processors.md} +6 -8
  22. package/dist/docs/{memory/03-message-history.md → references/docs-memory-message-history.md} +31 -20
  23. package/dist/docs/references/docs-memory-observational-memory.md +169 -0
  24. package/dist/docs/{memory/01-overview.md → references/docs-memory-overview.md} +8 -8
  25. package/dist/docs/{memory/05-semantic-recall.md → references/docs-memory-semantic-recall.md} +33 -17
  26. package/dist/docs/{memory/02-storage.md → references/docs-memory-storage.md} +29 -39
  27. package/dist/docs/{memory/04-working-memory.md → references/docs-memory-working-memory.md} +16 -27
  28. package/dist/docs/references/reference-core-getMemory.md +50 -0
  29. package/dist/docs/references/reference-core-listMemory.md +56 -0
  30. package/dist/docs/references/reference-memory-clone-utilities.md +199 -0
  31. package/dist/docs/references/reference-memory-cloneThread.md +130 -0
  32. package/dist/docs/references/reference-memory-createThread.md +68 -0
  33. package/dist/docs/references/reference-memory-getThreadById.md +24 -0
  34. package/dist/docs/references/reference-memory-listThreads.md +145 -0
  35. package/dist/docs/references/reference-memory-memory-class.md +147 -0
  36. package/dist/docs/references/reference-memory-observational-memory.md +219 -0
  37. package/dist/docs/{processors/01-reference.md → references/reference-processors-token-limiter-processor.md} +25 -12
  38. package/dist/docs/references/reference-storage-dynamodb.md +282 -0
  39. package/dist/docs/references/reference-storage-libsql.md +135 -0
  40. package/dist/docs/references/reference-storage-mongodb.md +262 -0
  41. package/dist/docs/references/reference-storage-postgresql.md +529 -0
  42. package/dist/docs/references/reference-storage-upstash.md +160 -0
  43. package/dist/docs/references/reference-vectors-libsql.md +305 -0
  44. package/dist/docs/references/reference-vectors-mongodb.md +295 -0
  45. package/dist/docs/references/reference-vectors-pg.md +408 -0
  46. package/dist/docs/references/reference-vectors-upstash.md +294 -0
  47. package/dist/index.cjs +919 -507
  48. package/dist/index.cjs.map +1 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +914 -502
  51. package/dist/index.js.map +1 -1
  52. package/dist/{observational-memory-3Q42SITP.cjs → observational-memory-G3HACXHE.cjs} +14 -14
  53. package/dist/{observational-memory-3Q42SITP.cjs.map → observational-memory-G3HACXHE.cjs.map} +1 -1
  54. package/dist/{observational-memory-VXLHOSDZ.js → observational-memory-LI6QFTRE.js} +3 -3
  55. package/dist/{observational-memory-VXLHOSDZ.js.map → observational-memory-LI6QFTRE.js.map} +1 -1
  56. package/dist/processors/index.cjs +12 -12
  57. package/dist/processors/index.js +1 -1
  58. package/dist/processors/observational-memory/index.d.ts +1 -1
  59. package/dist/processors/observational-memory/index.d.ts.map +1 -1
  60. package/dist/processors/observational-memory/observational-memory.d.ts +283 -1
  61. package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
  62. package/dist/processors/observational-memory/observer-agent.d.ts +3 -1
  63. package/dist/processors/observational-memory/observer-agent.d.ts.map +1 -1
  64. package/dist/processors/observational-memory/reflector-agent.d.ts +10 -3
  65. package/dist/processors/observational-memory/reflector-agent.d.ts.map +1 -1
  66. package/dist/processors/observational-memory/types.d.ts +243 -19
  67. package/dist/processors/observational-memory/types.d.ts.map +1 -1
  68. package/dist/{token-6GSAFR2W-WGTMOPEU.js → token-APYSY3BW-2DN6RAUY.js} +11 -11
  69. package/dist/token-APYSY3BW-2DN6RAUY.js.map +1 -0
  70. package/dist/{token-6GSAFR2W-2B4WM6AQ.cjs → token-APYSY3BW-ZQ7TMBY7.cjs} +14 -14
  71. package/dist/token-APYSY3BW-ZQ7TMBY7.cjs.map +1 -0
  72. package/dist/token-util-RMHT2CPJ-6TGPE335.cjs +10 -0
  73. package/dist/token-util-RMHT2CPJ-6TGPE335.cjs.map +1 -0
  74. package/dist/token-util-RMHT2CPJ-RJEA3FAN.js +8 -0
  75. package/dist/token-util-RMHT2CPJ-RJEA3FAN.js.map +1 -0
  76. package/dist/tools/working-memory.d.ts.map +1 -1
  77. package/package.json +5 -6
  78. package/dist/chunk-6TXUWFIU.js.map +0 -1
  79. package/dist/chunk-FQJWVCDF.cjs.map +0 -1
  80. package/dist/chunk-WM6IIUQW.js +0 -250
  81. package/dist/chunk-WM6IIUQW.js.map +0 -1
  82. package/dist/chunk-ZSBBXHNM.cjs +0 -252
  83. package/dist/chunk-ZSBBXHNM.cjs.map +0 -1
  84. package/dist/docs/README.md +0 -36
  85. package/dist/docs/agents/01-agent-memory.md +0 -166
  86. package/dist/docs/core/01-reference.md +0 -114
  87. package/dist/docs/memory/07-reference.md +0 -687
  88. package/dist/docs/storage/01-reference.md +0 -1218
  89. package/dist/docs/vectors/01-reference.md +0 -942
  90. package/dist/token-6GSAFR2W-2B4WM6AQ.cjs.map +0 -1
  91. package/dist/token-6GSAFR2W-WGTMOPEU.js.map +0 -1
  92. package/dist/token-util-NEHG7TUY-TV2H7N56.js +0 -8
  93. package/dist/token-util-NEHG7TUY-TV2H7N56.js.map +0 -1
  94. package/dist/token-util-NEHG7TUY-WJZIPNNX.cjs +0 -10
  95. package/dist/token-util-NEHG7TUY-WJZIPNNX.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,75 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 1.2.0-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed observational memory progress bars resetting to zero after agent responses finish. The messages and observations sidebar bars now retain their values on stream completion, cancellation, and page reload. Also added a buffer-status endpoint so buffering badges resolve with accurate token counts instead of spinning forever when buffering outlives the stream. ([#12934](https://github.com/mastra-ai/mastra/pull/12934))
8
+
9
+ - Updated dependencies [[`b31c922`](https://github.com/mastra-ai/mastra/commit/b31c922215b513791d98feaea1b98784aa00803a)]:
10
+ - @mastra/core@1.3.0-alpha.2
11
+
12
+ ## 1.2.0-alpha.0
13
+
14
+ ### Minor Changes
15
+
16
+ - **Async buffering for observational memory is now enabled by default.** Observations are pre-computed in the background as conversations grow — when the context window fills up, buffered observations activate instantly with no blocking LLM call. This keeps agents responsive during long conversations. ([#12891](https://github.com/mastra-ai/mastra/pull/12891))
17
+
18
+ **Default settings:**
19
+ - `observation.bufferTokens: 0.2` — buffer every 20% of `messageTokens` (~6k tokens with the default 30k threshold)
20
+ - `observation.bufferActivation: 0.8` — on activation, retain 20% of the message window
21
+ - `reflection.bufferActivation: 0.5` — start background reflection at 50% of the observation threshold
22
+
23
+ **Disabling async buffering:**
24
+
25
+ Set `observation.bufferTokens: false` to disable async buffering for both observations and reflections:
26
+
27
+ ```ts
28
+ const memory = new Memory({
29
+ options: {
30
+ observationalMemory: {
31
+ model: 'google/gemini-2.5-flash',
32
+ observation: {
33
+ bufferTokens: false,
34
+ },
35
+ },
36
+ },
37
+ });
38
+ ```
39
+
40
+ **Model is now required** when passing an observational memory config object. Use `observationalMemory: true` for the default (google/gemini-2.5-flash), or set a model explicitly:
41
+
42
+ ```ts
43
+ // Uses default model (google/gemini-2.5-flash)
44
+ observationalMemory: true
45
+
46
+ // Explicit model
47
+ observationalMemory: {
48
+ model: "google/gemini-2.5-flash",
49
+ }
50
+ ```
51
+
52
+ **`shareTokenBudget` requires `bufferTokens: false`** (temporary limitation). If you use `shareTokenBudget: true`, you must explicitly disable async buffering:
53
+
54
+ ```ts
55
+ observationalMemory: {
56
+ model: "google/gemini-2.5-flash",
57
+ shareTokenBudget: true,
58
+ observation: { bufferTokens: false },
59
+ }
60
+ ```
61
+
62
+ **New streaming event:** `data-om-status` replaces `data-om-progress` with a structured status object containing active window usage, buffered observation/reflection state, and projected activation impact.
63
+
64
+ **Buffering markers:** New `data-om-buffering-start`, `data-om-buffering-end`, and `data-om-buffering-failed` streaming events for UI feedback during background operations.
65
+
66
+ ### Patch Changes
67
+
68
+ - Fixed working memory tools being injected when no thread or resource context is provided. Made working memory tool execute scope-aware: thread-scoped requires threadId, resource-scoped requires resourceId (previously both were always required regardless of scope). ([#12831](https://github.com/mastra-ai/mastra/pull/12831))
69
+
70
+ - Updated dependencies [[`717ffab`](https://github.com/mastra-ai/mastra/commit/717ffab42cfd58ff723b5c19ada4939997773004), [`e4b6dab`](https://github.com/mastra-ai/mastra/commit/e4b6dab171c5960e340b3ea3ea6da8d64d2b8672), [`5719fa8`](https://github.com/mastra-ai/mastra/commit/5719fa8880e86e8affe698ec4b3807c7e0e0a06f), [`83cda45`](https://github.com/mastra-ai/mastra/commit/83cda4523e588558466892bff8f80f631a36945a), [`11804ad`](https://github.com/mastra-ai/mastra/commit/11804adf1d6be46ebe216be40a43b39bb8b397d7), [`aa95f95`](https://github.com/mastra-ai/mastra/commit/aa95f958b186ae5c9f4219c88e268f5565c277a2), [`f5501ae`](https://github.com/mastra-ai/mastra/commit/f5501aedb0a11106c7db7e480d6eaf3971b7bda8), [`44573af`](https://github.com/mastra-ai/mastra/commit/44573afad0a4bc86f627d6cbc0207961cdcb3bc3), [`00e3861`](https://github.com/mastra-ai/mastra/commit/00e3861863fbfee78faeb1ebbdc7c0223aae13ff), [`7bfbc52`](https://github.com/mastra-ai/mastra/commit/7bfbc52a8604feb0fff2c0a082c13c0c2a3df1a2), [`1445994`](https://github.com/mastra-ai/mastra/commit/1445994aee19c9334a6a101cf7bd80ca7ed4d186), [`61f44a2`](https://github.com/mastra-ai/mastra/commit/61f44a26861c89e364f367ff40825bdb7f19df55), [`37145d2`](https://github.com/mastra-ai/mastra/commit/37145d25f99dc31f1a9105576e5452609843ce32), [`fdad759`](https://github.com/mastra-ai/mastra/commit/fdad75939ff008b27625f5ec0ce9c6915d99d9ec), [`e4569c5`](https://github.com/mastra-ai/mastra/commit/e4569c589e00c4061a686c9eb85afe1b7050b0a8), [`7309a85`](https://github.com/mastra-ai/mastra/commit/7309a85427281a8be23f4fb80ca52e18eaffd596), [`99424f6`](https://github.com/mastra-ai/mastra/commit/99424f6862ffb679c4ec6765501486034754a4c2), [`44eb452`](https://github.com/mastra-ai/mastra/commit/44eb4529b10603c279688318bebf3048543a1d61), [`6c40593`](https://github.com/mastra-ai/mastra/commit/6c40593d6d2b1b68b0c45d1a3a4c6ac5ecac3937), [`8c1135d`](https://github.com/mastra-ai/mastra/commit/8c1135dfb91b057283eae7ee11f9ec28753cc64f), [`dd39e54`](https://github.com/mastra-ai/mastra/commit/dd39e54ea34532c995b33bee6e0e808bf41a7341), [`b6fad9a`](https://github.com/mastra-ai/mastra/commit/b6fad9a602182b1cc0df47cd8c55004fa829ad61), [`4129c07`](https://github.com/mastra-ai/mastra/commit/4129c073349b5a66643fd8136ebfe9d7097cf793), [`5b930ab`](https://github.com/mastra-ai/mastra/commit/5b930aba1834d9898e8460a49d15106f31ac7c8d), [`4be93d0`](https://github.com/mastra-ai/mastra/commit/4be93d09d68e20aaf0ea3f210749422719618b5f), [`047635c`](https://github.com/mastra-ai/mastra/commit/047635ccd7861d726c62d135560c0022a5490aec), [`8c90ff4`](https://github.com/mastra-ai/mastra/commit/8c90ff4d3414e7f2a2d216ea91274644f7b29133), [`ed232d1`](https://github.com/mastra-ai/mastra/commit/ed232d1583f403925dc5ae45f7bee948cf2a182b), [`3891795`](https://github.com/mastra-ai/mastra/commit/38917953518eb4154a984ee36e6ededdcfe80f72), [`4f955b2`](https://github.com/mastra-ai/mastra/commit/4f955b20c7f66ed282ee1fd8709696fa64c4f19d), [`55a4c90`](https://github.com/mastra-ai/mastra/commit/55a4c9044ac7454349b9f6aeba0bbab5ee65d10f)]:
71
+ - @mastra/core@1.3.0-alpha.1
72
+
3
73
  ## 1.1.0
4
74
 
5
75
  ### Minor Changes
@@ -3480,7 +3480,16 @@ export declare type JSONValue = null | string | number | boolean | {
3480
3480
  [value: string]: JSONValue;
3481
3481
  } | Array<JSONValue>;
3482
3482
 
3483
- declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
3483
+ declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
3484
+
3485
+ export declare namespace LangChainAdapter {
3486
+ export {
3487
+ mergeIntoDataStream$1 as mergeIntoDataStream,
3488
+ toDataStream$1 as toDataStream,
3489
+ toDataStreamResponse$1 as toDataStreamResponse,
3490
+ };
3491
+ }
3492
+
3484
3493
  /**
3485
3494
  Language model that is used by the AI SDK Core functions.
3486
3495
  */
@@ -4419,8 +4428,16 @@ declare interface Link {
4419
4428
  attributes?: SpanAttributes;
4420
4429
  /** Count of attributes of the link that were dropped due to collection limits */
4421
4430
  droppedAttributesCount?: number;
4422
- }
4423
-
4431
+ }
4432
+
4433
+ export declare namespace LlamaIndexAdapter {
4434
+ export {
4435
+ llamaindexAdapter_mergeIntoDataStream as mergeIntoDataStream,
4436
+ llamaindexAdapter_toDataStream as toDataStream,
4437
+ llamaindexAdapter_toDataStreamResponse as toDataStreamResponse,
4438
+ };
4439
+ }
4440
+
4424
4441
  export declare class LoadAPIKeyError extends AISDKError {
4425
4442
  private readonly [symbol$6_2];
4426
4443
  constructor({ message }: {
@@ -4762,8 +4779,16 @@ export declare type ObjectStreamPart<PARTIAL> = {
4762
4779
  usage: LanguageModelUsage;
4763
4780
  response: LanguageModelResponseMetadata;
4764
4781
  providerMetadata?: ProviderMetadata;
4765
- };
4766
-
4782
+ };
4783
+
4784
+ export declare namespace Output {
4785
+ export {
4786
+ output_Output as Output,
4787
+ output_object as object,
4788
+ output_text as text,
4789
+ };
4790
+ }
4791
+
4767
4792
  declare interface Output_2<OUTPUT, PARTIAL> {
4768
4793
  readonly type: 'object' | 'text';
4769
4794
  injectIntoSystemPrompt(options: {
@@ -7535,15 +7560,3 @@ export declare function zodSchema<OBJECT>(zodSchema: z.Schema<OBJECT, z.ZodTypeD
7535
7560
 
7536
7561
  export { }
7537
7562
  export { LanguageModelV1Message as LanguageModelV1Message, LanguageModelV1CallSettings as LanguageModelV1CallSettings, LanguageModelV1FunctionTool as LanguageModelV1FunctionTool, LanguageModelV1ProviderDefinedTool as LanguageModelV1ProviderDefinedTool, LanguageModelV1ToolChoice as LanguageModelV1ToolChoice, LanguageModelV1ObjectGenerationMode as LanguageModelV1ObjectGenerationMode, LanguageModelV1FunctionToolCall as LanguageModelV1FunctionToolCall, LanguageModelV1Source as LanguageModelV1Source, LanguageModelV1LogProbs as LanguageModelV1LogProbs, FetchFunction as FetchFunction, TextUIPart as TextUIPart, ReasoningUIPart as ReasoningUIPart, ToolInvocationUIPart as ToolInvocationUIPart, SourceUIPart as SourceUIPart, FileUIPart as FileUIPart, StepStartUIPart as StepStartUIPart, AssistantStreamPartType as AssistantStreamPartType, AssistantStreamPartValueType as AssistantStreamPartValueType, AssistantStreamString as AssistantStreamString, DataStreamPartType as DataStreamPartType, DataStreamPartValueType as DataStreamPartValueType, DeepPartialInternal as DeepPartialInternal, Validator as Validator, JSONSchema7 as JSONSchema7, LanguageModelV1FinishReason as LanguageModelV1FinishReason, LanguageModelV1CallWarning as LanguageModelV1CallWarning, JSONValue_2 as JSONValue_2, Source as Source, DataStreamString as DataStreamString, AttributeValue as AttributeValue, Tracer as Tracer, EmbeddingModelV1 as EmbeddingModelV1, EmbeddingModelV1Embedding as EmbeddingModelV1Embedding, ImageModelV1CallWarning as ImageModelV1CallWarning, TranscriptionModelV1CallWarning as TranscriptionModelV1CallWarning, SpeechModelV1CallWarning as SpeechModelV1CallWarning, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, RedactedReasoningPart as RedactedReasoningPart, ToolResultContent as ToolResultContent, inferParameters as inferParameters, ToolParameters as ToolParameters, JSONRPCRequestSchema as JSONRPCRequestSchema, JSONRPCResponseSchema as JSONRPCResponseSchema, JSONRPCErrorSchema as JSONRPCErrorSchema, JSONRPCNotificationSchema as JSONRPCNotificationSchema, JSONRPCMessageSchema as JSONRPCMessageSchema, MCPClientConfig as MCPClientConfig, MCPClient as MCPClient, ValueOf as ValueOf, ToToolResultObject as ToToolResultObject, ToToolsWithDefinedExecute as ToToolsWithDefinedExecute, ToToolsWithExecute as ToToolsWithExecute, ReasoningDetail as ReasoningDetail, ToolCallArray as ToolCallArray, ToolResultArray as ToolResultArray, ResponseMessage as ResponseMessage, Output_2 as Output_2, ConsumeStreamOptions as ConsumeStreamOptions, ImageModelV1 as ImageModelV1, CallSettings as CallSettings, Prompt as Prompt, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, AsyncIterableStream as AsyncIterableStream, SpeechModelV1 as SpeechModelV1, TranscriptionModelV1 as TranscriptionModelV1, LanguageModelV1ProviderMetadata as LanguageModelV1ProviderMetadata, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV1 as ProviderV1, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason as RetryErrorReason, AssistantResponseSettings as AssistantResponseSettings, AssistantResponseCallback as AssistantResponseCallback };
7538
-
7539
- export namespace LangChainAdapter {
7540
- export { mergeIntoDataStream$1 as mergeIntoDataStream, toDataStream$1 as toDataStream, toDataStreamResponse$1 as toDataStreamResponse };
7541
- }
7542
-
7543
- export namespace LlamaIndexAdapter {
7544
- export { llamaindexAdapter_mergeIntoDataStream as mergeIntoDataStream, llamaindexAdapter_toDataStream as toDataStream, llamaindexAdapter_toDataStreamResponse as toDataStreamResponse };
7545
- }
7546
-
7547
- export namespace Output {
7548
- export { output_Output as Output, output_object as object, output_text as text };
7549
- }