@mastra/memory 1.3.0-alpha.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - @mastra/opencode: Add opencode plugin for Observational Memory integration ([#12925](https://github.com/mastra-ai/mastra/pull/12925))
8
+
9
+ Added standalone `observe()` API that accepts external messages directly, so integrations can trigger observation without duplicating messages into Mastra's storage.
10
+
11
+ **New exports:**
12
+ - `ObserveHooks` — lifecycle callbacks (`onObservationStart`, `onObservationEnd`, `onReflectionStart`, `onReflectionEnd`) for hooking into observation/reflection cycles
13
+ - `OBSERVATION_CONTEXT_PROMPT` — preamble that introduces the observations block
14
+ - `OBSERVATION_CONTEXT_INSTRUCTIONS` — rules for interpreting observations (placed after the `<observations>` block)
15
+ - `OBSERVATION_CONTINUATION_HINT` — behavioral guidance that prevents models from awkwardly acknowledging the memory system
16
+ - `getOrCreateRecord()` — now public, allows eager record initialization before the first observation cycle
17
+
18
+ ```ts
19
+ import { ObservationalMemory } from '@mastra/memory/processors';
20
+
21
+ const om = new ObservationalMemory({ storage, model: 'google/gemini-2.5-flash' });
22
+
23
+ // Eagerly initialize a record
24
+ await om.getOrCreateRecord(threadId);
25
+
26
+ // Pass messages directly with lifecycle hooks
27
+ await om.observe({
28
+ threadId,
29
+ messages: myMessages,
30
+ hooks: {
31
+ onObservationStart: () => console.log('Observing...'),
32
+ onObservationEnd: () => console.log('Done!'),
33
+ onReflectionStart: () => console.log('Reflecting...'),
34
+ onReflectionEnd: () => console.log('Reflected!'),
35
+ },
36
+ });
37
+ ```
38
+
39
+ **Breaking:** `observe()` now takes an object param instead of positional args. Update calls from `observe(threadId, resourceId)` to `observe({ threadId, resourceId })`.
40
+
41
+ ### Patch Changes
42
+
43
+ - Fixed observational memory writing non-integer token counts to PostgreSQL, which caused `invalid input syntax for type integer` errors. Token counts are now correctly rounded to integers before all database writes. ([#12976](https://github.com/mastra-ai/mastra/pull/12976))
44
+
45
+ - Fixed cloneThread not copying working memory to the cloned thread. Thread-scoped working memory is now properly carried over when cloning, and resource-scoped working memory is copied when the clone uses a different resourceId. ([#12833](https://github.com/mastra-ai/mastra/pull/12833))
46
+
47
+ - Updated dependencies [[`7ef618f`](https://github.com/mastra-ai/mastra/commit/7ef618f3c49c27e2f6b27d7f564c557c0734325b), [`b373564`](https://github.com/mastra-ai/mastra/commit/b37356491d43b4d53067f10cb669abaf2502f218), [`927c2af`](https://github.com/mastra-ai/mastra/commit/927c2af9792286c122e04409efce0f3c804f777f), [`b896b41`](https://github.com/mastra-ai/mastra/commit/b896b41343de7fcc14442fb40fe82d189e65bbe2), [`6415277`](https://github.com/mastra-ai/mastra/commit/6415277a438faa00db2af850ead5dee25f40c428), [`0831bbb`](https://github.com/mastra-ai/mastra/commit/0831bbb5bc750c18e9b22b45f18687c964b70828), [`63f7eda`](https://github.com/mastra-ai/mastra/commit/63f7eda605eb3e0c8c35ee3912ffe7c999c69f69), [`a5b67a3`](https://github.com/mastra-ai/mastra/commit/a5b67a3589a74415feb663a55d1858324a2afde9), [`877b02c`](https://github.com/mastra-ai/mastra/commit/877b02cdbb15e199184c7f2b8f217be8d3ebada7), [`7567222`](https://github.com/mastra-ai/mastra/commit/7567222b1366f0d39980594792dd9d5060bfe2ab), [`af71458`](https://github.com/mastra-ai/mastra/commit/af71458e3b566f09c11d0e5a0a836dc818e7a24a), [`eb36bd8`](https://github.com/mastra-ai/mastra/commit/eb36bd8c52fcd6ec9674ac3b7a6412405b5983e1), [`3cbf121`](https://github.com/mastra-ai/mastra/commit/3cbf121f55418141924754a83102aade89835947)]:
48
+ - @mastra/core@1.4.0
49
+
3
50
  ## 1.3.0-alpha.0
4
51
 
5
52
  ### Minor Changes
@@ -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.3.0-alpha.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.0-alpha.0",
2
+ "version": "1.3.0",
3
3
  "package": "@mastra/memory",
4
4
  "exports": {
5
5
  "OBSERVATIONAL_MEMORY_DEFAULTS": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/memory",
3
- "version": "1.3.0-alpha.0",
3
+ "version": "1.3.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -56,12 +56,12 @@
56
56
  "typescript": "^5.9.3",
57
57
  "typescript-eslint": "^8.51.0",
58
58
  "vitest": "4.0.16",
59
- "@internal/ai-sdk-v4": "0.0.5",
60
- "@internal/ai-sdk-v5": "0.0.5",
61
- "@internal/ai-v6": "0.0.5",
62
- "@internal/types-builder": "0.0.33",
63
- "@mastra/core": "1.4.0-alpha.0",
64
- "@internal/lint": "0.0.58"
59
+ "@internal/ai-sdk-v4": "0.0.6",
60
+ "@internal/ai-sdk-v5": "0.0.6",
61
+ "@internal/ai-v6": "0.0.6",
62
+ "@internal/types-builder": "0.0.34",
63
+ "@internal/lint": "0.0.59",
64
+ "@mastra/core": "1.4.0"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "@mastra/core": ">=1.0.0-0 <2.0.0-0",