@mastra/memory 1.4.0 → 1.5.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 (30) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/{chunk-D4AWAGLM.js → chunk-DF7NDDSM.js} +282 -190
  3. package/dist/chunk-DF7NDDSM.js.map +1 -0
  4. package/dist/{chunk-QRKB5I2S.cjs → chunk-LLTHE64H.cjs} +281 -189
  5. package/dist/chunk-LLTHE64H.cjs.map +1 -0
  6. package/dist/docs/SKILL.md +1 -1
  7. package/dist/docs/assets/SOURCE_MAP.json +25 -25
  8. package/dist/docs/references/docs-memory-observational-memory.md +2 -0
  9. package/dist/docs/references/reference-memory-memory-class.md +1 -1
  10. package/dist/docs/references/reference-memory-observational-memory.md +1 -0
  11. package/dist/index.cjs +3 -3
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.js +3 -3
  14. package/dist/index.js.map +1 -1
  15. package/dist/{observational-memory-UCOMAMSF.cjs → observational-memory-4PCXEZIS.cjs} +17 -17
  16. package/dist/{observational-memory-UCOMAMSF.cjs.map → observational-memory-4PCXEZIS.cjs.map} +1 -1
  17. package/dist/{observational-memory-53AFLLSH.js → observational-memory-ZNTAIUGT.js} +3 -3
  18. package/dist/{observational-memory-53AFLLSH.js.map → observational-memory-ZNTAIUGT.js.map} +1 -1
  19. package/dist/processors/index.cjs +15 -15
  20. package/dist/processors/index.js +1 -1
  21. package/dist/processors/observational-memory/observational-memory.d.ts +17 -1
  22. package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
  23. package/dist/processors/observational-memory/observer-agent.d.ts +26 -5
  24. package/dist/processors/observational-memory/observer-agent.d.ts.map +1 -1
  25. package/dist/processors/observational-memory/reflector-agent.d.ts.map +1 -1
  26. package/dist/processors/observational-memory/types.d.ts +14 -3
  27. package/dist/processors/observational-memory/types.d.ts.map +1 -1
  28. package/package.json +11 -11
  29. package/dist/chunk-D4AWAGLM.js.map +0 -1
  30. package/dist/chunk-QRKB5I2S.cjs.map +0 -1
@@ -3,7 +3,7 @@ name: mastra-memory
3
3
  description: Documentation for @mastra/memory. Use when working with @mastra/memory APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/memory"
6
- version: "1.4.0"
6
+ version: "1.5.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,71 +1,71 @@
1
1
  {
2
- "version": "1.4.0",
2
+ "version": "1.5.0",
3
3
  "package": "@mastra/memory",
4
4
  "exports": {
5
5
  "OBSERVATIONAL_MEMORY_DEFAULTS": {
6
6
  "types": "dist/processors/index.d.ts",
7
- "implementation": "dist/chunk-D4AWAGLM.js"
7
+ "implementation": "dist/chunk-DF7NDDSM.js"
8
8
  },
9
9
  "OBSERVATION_CONTEXT_INSTRUCTIONS": {
10
10
  "types": "dist/processors/index.d.ts",
11
- "implementation": "dist/chunk-D4AWAGLM.js"
11
+ "implementation": "dist/chunk-DF7NDDSM.js"
12
12
  },
13
13
  "OBSERVATION_CONTEXT_PROMPT": {
14
14
  "types": "dist/processors/index.d.ts",
15
- "implementation": "dist/chunk-D4AWAGLM.js"
15
+ "implementation": "dist/chunk-DF7NDDSM.js"
16
16
  },
17
17
  "OBSERVATION_CONTINUATION_HINT": {
18
18
  "types": "dist/processors/index.d.ts",
19
- "implementation": "dist/chunk-D4AWAGLM.js"
19
+ "implementation": "dist/chunk-DF7NDDSM.js"
20
20
  },
21
21
  "OBSERVER_SYSTEM_PROMPT": {
22
22
  "types": "dist/processors/index.d.ts",
23
- "implementation": "dist/chunk-D4AWAGLM.js"
23
+ "implementation": "dist/chunk-DF7NDDSM.js"
24
24
  },
25
25
  "ObservationalMemory": {
26
26
  "types": "dist/processors/index.d.ts",
27
- "implementation": "dist/chunk-D4AWAGLM.js",
28
- "line": 1273
27
+ "implementation": "dist/chunk-DF7NDDSM.js",
28
+ "line": 1251
29
29
  },
30
30
  "TokenCounter": {
31
31
  "types": "dist/processors/index.d.ts",
32
- "implementation": "dist/chunk-D4AWAGLM.js",
33
- "line": 936
32
+ "implementation": "dist/chunk-DF7NDDSM.js",
33
+ "line": 912
34
34
  },
35
35
  "buildObserverPrompt": {
36
36
  "types": "dist/processors/index.d.ts",
37
- "implementation": "dist/chunk-D4AWAGLM.js",
38
- "line": 606
37
+ "implementation": "dist/chunk-DF7NDDSM.js",
38
+ "line": 533
39
39
  },
40
40
  "buildObserverSystemPrompt": {
41
41
  "types": "dist/processors/index.d.ts",
42
- "implementation": "dist/chunk-D4AWAGLM.js",
43
- "line": 357
42
+ "implementation": "dist/chunk-DF7NDDSM.js",
43
+ "line": 281
44
44
  },
45
45
  "extractCurrentTask": {
46
46
  "types": "dist/processors/index.d.ts",
47
- "implementation": "dist/chunk-D4AWAGLM.js",
48
- "line": 692
47
+ "implementation": "dist/chunk-DF7NDDSM.js",
48
+ "line": 662
49
49
  },
50
50
  "formatMessagesForObserver": {
51
51
  "types": "dist/processors/index.d.ts",
52
- "implementation": "dist/chunk-D4AWAGLM.js",
53
- "line": 452
52
+ "implementation": "dist/chunk-DF7NDDSM.js",
53
+ "line": 376
54
54
  },
55
55
  "hasCurrentTaskSection": {
56
56
  "types": "dist/processors/index.d.ts",
57
- "implementation": "dist/chunk-D4AWAGLM.js",
58
- "line": 680
57
+ "implementation": "dist/chunk-DF7NDDSM.js",
58
+ "line": 650
59
59
  },
60
60
  "optimizeObservationsForContext": {
61
61
  "types": "dist/processors/index.d.ts",
62
- "implementation": "dist/chunk-D4AWAGLM.js",
63
- "line": 703
62
+ "implementation": "dist/chunk-DF7NDDSM.js",
63
+ "line": 673
64
64
  },
65
65
  "parseObserverOutput": {
66
66
  "types": "dist/processors/index.d.ts",
67
- "implementation": "dist/chunk-D4AWAGLM.js",
68
- "line": 637
67
+ "implementation": "dist/chunk-DF7NDDSM.js",
68
+ "line": 564
69
69
  },
70
70
  "extractWorkingMemoryContent": {
71
71
  "types": "dist/index.d.ts",
@@ -96,7 +96,7 @@
96
96
  "processors": {
97
97
  "index": "dist/processors/index.js",
98
98
  "chunks": [
99
- "chunk-D4AWAGLM.js"
99
+ "chunk-DF7NDDSM.js"
100
100
  ]
101
101
  }
102
102
  }
@@ -180,6 +180,8 @@ As the agent converses, message tokens accumulate. At regular intervals (`buffer
180
180
 
181
181
  When message tokens reach the `messageTokens` threshold, buffered chunks activate: their observations move into the active observation log, and the corresponding raw messages are removed from the context window. The agent never pauses.
182
182
 
183
+ Buffered observations also include continuation hints — a suggested next response and the current task — so the main agent maintains conversational continuity after activation shrinks the context window.
184
+
183
185
  If the agent produces messages faster than the Observer can process them, a `blockAfter` safety threshold forces a synchronous observation as a last resort.
184
186
 
185
187
  Reflection works similarly — the Reflector runs in the background when observations reach a fraction of the reflection threshold.
@@ -36,7 +36,7 @@ export const agent = new Agent({
36
36
 
37
37
  ### Options parameters
38
38
 
39
- **lastMessages?:** (`number | false`): Number of most recent messages to retrieve. Set to false to disable. (Default: `10`)
39
+ **lastMessages?:** (`number | false`): Number of most recent messages to include in context. Set to \`false\` to disable loading conversation history into context. Use \`Number.MAX\_SAFE\_INTEGER\` to retrieve all messages with no limit. To prevent saving new messages, use the \`readOnly\` option instead. (Default: `10`)
40
40
 
41
41
  **readOnly?:** (`boolean`): When true, prevents memory from saving new messages and provides working memory as read-only context (without the updateWorkingMemory tool). Useful for read-only operations like previews, internal routing agents, or sub agents that should reference but not modify memory. (Default: `false`)
42
42
 
@@ -221,6 +221,7 @@ Default settings:
221
221
 
222
222
  - `observation.bufferTokens: 0.2` — buffer every 20% of `messageTokens` (e.g. every \~6k tokens with a 30k threshold)
223
223
  - `observation.bufferActivation: 0.8` — on activation, remove enough messages to keep only 20% of the threshold remaining
224
+ - Buffered observations include continuation hints (`suggestedResponse`, `currentTask`) that survive activation to maintain conversational continuity
224
225
  - `reflection.bufferActivation: 0.5` — start background reflection at 50% of observation threshold
225
226
 
226
227
  To customize:
package/dist/index.cjs CHANGED
@@ -12534,7 +12534,7 @@ async function getVercelRequestId2() {
12534
12534
  var _a932;
12535
12535
  return (_a932 = (0, import_oidc3.getContext)().headers) == null ? void 0 : _a932["x-vercel-id"];
12536
12536
  }
12537
- var VERSION5 = "3.0.50";
12537
+ var VERSION5 = "3.0.52";
12538
12538
  var AI_GATEWAY_PROTOCOL_VERSION2 = "0.0.1";
12539
12539
  function createGatewayProvider2(options = {}) {
12540
12540
  var _a932, _b92;
@@ -13602,7 +13602,7 @@ function getTotalTimeoutMs(timeout) {
13602
13602
  }
13603
13603
  return timeout.totalMs;
13604
13604
  }
13605
- var VERSION33 = "6.0.91";
13605
+ var VERSION33 = "6.0.94";
13606
13606
  var dataContentSchema3 = z4.z.union([
13607
13607
  z4.z.string(),
13608
13608
  z4.z.instanceof(Uint8Array),
@@ -16377,7 +16377,7 @@ Notes:
16377
16377
  "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."
16378
16378
  );
16379
16379
  }
16380
- const { ObservationalMemory } = await import('./observational-memory-UCOMAMSF.cjs');
16380
+ const { ObservationalMemory } = await import('./observational-memory-4PCXEZIS.cjs');
16381
16381
  return new ObservationalMemory({
16382
16382
  storage: memoryStore,
16383
16383
  scope: omConfig.scope,