@mastra/memory 1.14.0-alpha.2 → 1.14.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.
- package/CHANGELOG.md +66 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
# @mastra/memory
|
|
2
2
|
|
|
3
|
+
## 1.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added usage data to ObserveHooks callbacks and standalone reflect() return. ([#15047](https://github.com/mastra-ai/mastra/pull/15047))
|
|
8
|
+
|
|
9
|
+
**ObserveHooks:** `onObservationEnd` and `onReflectionEnd` now receive a result object containing token usage from the underlying LLM call. This enables reliable usage tracking across all observation and reflection paths (sync, async buffered, and resource-scoped).
|
|
10
|
+
|
|
11
|
+
**Standalone reflect():** `reflect()` now returns `{ reflected, record, usage? }` so callers can capture token usage without hooks.
|
|
12
|
+
|
|
13
|
+
**Examples**
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
// Via hooks
|
|
17
|
+
await memory.observe({
|
|
18
|
+
threadId,
|
|
19
|
+
messages,
|
|
20
|
+
hooks: {
|
|
21
|
+
onObservationEnd: ({ usage }) => {
|
|
22
|
+
// usage: { inputTokens, outputTokens, totalTokens }
|
|
23
|
+
},
|
|
24
|
+
onReflectionEnd: ({ usage }) => {
|
|
25
|
+
// usage: { inputTokens, outputTokens, totalTokens }
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Via standalone reflect()
|
|
31
|
+
const { reflected, usage } = await memory.reflect(threadId, resourceId);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Existing callbacks that accept no arguments continue to work without changes.
|
|
35
|
+
|
|
36
|
+
- Added tracing support to Memory operations (recall, save, delete, update working memory). When an `observabilityContext` is provided, Memory creates `MEMORY_OPERATION` spans that capture operation type, message counts, embedding token usage, and vector result counts. Tracing is fully opt-in — existing usage without `observabilityContext` is unaffected. ([#14305](https://github.com/mastra-ai/mastra/pull/14305))
|
|
37
|
+
|
|
38
|
+
**Example usage:**
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { Memory } from '@mastra/memory';
|
|
42
|
+
import { InMemoryStore } from '@mastra/core/storage';
|
|
43
|
+
|
|
44
|
+
const memory = new Memory({ storage: new InMemoryStore() });
|
|
45
|
+
|
|
46
|
+
// Pass observabilityContext to create observable spans
|
|
47
|
+
await memory.recall({
|
|
48
|
+
threadId: 'thread-1',
|
|
49
|
+
observabilityContext: { tracingContext: { currentSpan: parentSpan } },
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
await memory.saveMessages({
|
|
53
|
+
messages: [userMessage, assistantMessage],
|
|
54
|
+
observabilityContext: { tracingContext: { currentSpan: parentSpan } },
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- Added per-record config overrides for observation and reflection thresholds in Observational Memory. Each thread can now have its own `messageTokens` and `observationTokens` thresholds that override the instance-level defaults, without requiring a process restart or cache invalidation. If no per-record override is set, the instance-level config is used as before. ([#15102](https://github.com/mastra-ai/mastra/pull/15102))
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- Fixed observational memory buffering so sealed assistant chunks stay split instead of being merged back into one persisted message during long tool runs. ([#14995](https://github.com/mastra-ai/mastra/pull/14995))
|
|
63
|
+
|
|
64
|
+
- Fixed recall() to hide dynamic system reminder messages by default, with includeSystemReminders available when callers need raw reminder history. ([#15100](https://github.com/mastra-ai/mastra/pull/15100))
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [[`f32b9e1`](https://github.com/mastra-ai/mastra/commit/f32b9e115a3c754d1c8cfa3f4256fba87b09cfb7), [`7d6f521`](https://github.com/mastra-ai/mastra/commit/7d6f52164d0cca099f0b07cb2bba334360f1c8ab), [`a50d220`](https://github.com/mastra-ai/mastra/commit/a50d220b01ecbc5644d489a3d446c3bd4ab30245), [`665477b`](https://github.com/mastra-ai/mastra/commit/665477bc104fd52cfef8e7610d7664781a70c220), [`4cc2755`](https://github.com/mastra-ai/mastra/commit/4cc2755a7194cb08720ff2ab4dffb4b4a5103dfd), [`ac7baf6`](https://github.com/mastra-ai/mastra/commit/ac7baf66ef1db15e03975ef4ebb02724f015a391), [`ed425d7`](https://github.com/mastra-ai/mastra/commit/ed425d78e7c66cbda8209fee910856f98c6c6b82), [`1371703`](https://github.com/mastra-ai/mastra/commit/1371703835080450ef3f9aea58059a95d0da2e5a), [`0df8321`](https://github.com/mastra-ai/mastra/commit/0df832196eeb2450ab77ce887e8553abdd44c5a6), [`98f8a8b`](https://github.com/mastra-ai/mastra/commit/98f8a8bdf5761b9982f3ad3acbe7f1cc3efa71f3), [`ba6f7e9`](https://github.com/mastra-ai/mastra/commit/ba6f7e9086d8281393f2acae60fda61de3bff1f9), [`7eb2596`](https://github.com/mastra-ai/mastra/commit/7eb25960d607e07468c9a10c5437abd2deaf1e9a), [`1805ddc`](https://github.com/mastra-ai/mastra/commit/1805ddc9c9b3b14b63749735a13c05a45af43a80), [`fff91cf`](https://github.com/mastra-ai/mastra/commit/fff91cf914de0e731578aacebffdeebef82f0440), [`61109b3`](https://github.com/mastra-ai/mastra/commit/61109b34feb0e38d54bee4b8ca83eb7345b1d557), [`33f1ead`](https://github.com/mastra-ai/mastra/commit/33f1eadfa19c86953f593478e5fa371093b33779)]:
|
|
67
|
+
- @mastra/core@1.23.0
|
|
68
|
+
|
|
3
69
|
## 1.14.0-alpha.2
|
|
4
70
|
|
|
5
71
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/memory",
|
|
3
|
-
"version": "1.14.0
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -59,12 +59,12 @@
|
|
|
59
59
|
"typescript-eslint": "^8.57.0",
|
|
60
60
|
"vitest": "4.0.18",
|
|
61
61
|
"zod": "^4.3.6",
|
|
62
|
-
"@internal/ai-sdk-v4": "0.0.
|
|
63
|
-
"@internal/ai-
|
|
64
|
-
"@internal/
|
|
65
|
-
"@internal/
|
|
66
|
-
"@internal/types-builder": "0.0.
|
|
67
|
-
"@mastra/core": "1.23.0
|
|
62
|
+
"@internal/ai-sdk-v4": "0.0.27",
|
|
63
|
+
"@internal/ai-sdk-v5": "0.0.27",
|
|
64
|
+
"@internal/lint": "0.0.80",
|
|
65
|
+
"@internal/ai-v6": "0.0.27",
|
|
66
|
+
"@internal/types-builder": "0.0.55",
|
|
67
|
+
"@mastra/core": "1.23.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@mastra/core": ">=1.4.1-0 <2.0.0-0",
|