@mastra/memory 1.8.3-alpha.0 → 1.8.3-alpha.2

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 (52) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/{chunk-SUU4IAZJ.js → chunk-4KPXPQX3.js} +212 -75
  3. package/dist/chunk-4KPXPQX3.js.map +1 -0
  4. package/dist/{chunk-YPFNHFT6.cjs → chunk-LGCREJMO.cjs} +212 -74
  5. package/dist/chunk-LGCREJMO.cjs.map +1 -0
  6. package/dist/docs/SKILL.md +1 -1
  7. package/dist/docs/assets/SOURCE_MAP.json +30 -25
  8. package/dist/docs/references/docs-agents-agent-approval.md +4 -4
  9. package/dist/docs/references/docs-agents-network-approval.md +1 -1
  10. package/dist/docs/references/docs-agents-networks.md +1 -1
  11. package/dist/docs/references/docs-agents-supervisor-agents.md +3 -3
  12. package/dist/docs/references/docs-memory-memory-processors.md +6 -6
  13. package/dist/docs/references/docs-memory-semantic-recall.md +1 -1
  14. package/dist/docs/references/docs-memory-storage.md +1 -1
  15. package/dist/docs/references/docs-memory-working-memory.md +2 -2
  16. package/dist/docs/references/reference-memory-memory-class.md +3 -3
  17. package/dist/docs/references/reference-memory-observational-memory.md +5 -5
  18. package/dist/docs/references/reference-processors-token-limiter-processor.md +3 -3
  19. package/dist/docs/references/reference-storage-mongodb.md +1 -1
  20. package/dist/docs/references/reference-storage-postgresql.md +1 -1
  21. package/dist/docs/references/reference-storage-upstash.md +1 -1
  22. package/dist/docs/references/reference-vectors-libsql.md +1 -1
  23. package/dist/docs/references/reference-vectors-mongodb.md +1 -1
  24. package/dist/docs/references/reference-vectors-pg.md +1 -1
  25. package/dist/docs/references/reference-vectors-upstash.md +1 -1
  26. package/dist/index.cjs +16 -10
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +12 -10
  31. package/dist/index.js.map +1 -1
  32. package/dist/{observational-memory-3HFM7PY2.cjs → observational-memory-4TV5KKFV.cjs} +21 -17
  33. package/dist/{observational-memory-3HFM7PY2.cjs.map → observational-memory-4TV5KKFV.cjs.map} +1 -1
  34. package/dist/observational-memory-UEDVTWS2.js +3 -0
  35. package/dist/{observational-memory-XXD6E2SO.js.map → observational-memory-UEDVTWS2.js.map} +1 -1
  36. package/dist/processors/index.cjs +19 -15
  37. package/dist/processors/index.js +1 -1
  38. package/dist/processors/observational-memory/index.d.ts +1 -0
  39. package/dist/processors/observational-memory/index.d.ts.map +1 -1
  40. package/dist/processors/observational-memory/observation-utils.d.ts +16 -0
  41. package/dist/processors/observational-memory/observation-utils.d.ts.map +1 -0
  42. package/dist/processors/observational-memory/observational-memory.d.ts +13 -4
  43. package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
  44. package/dist/processors/observational-memory/observer-agent.d.ts +9 -7
  45. package/dist/processors/observational-memory/observer-agent.d.ts.map +1 -1
  46. package/dist/processors/observational-memory/token-counter.d.ts.map +1 -1
  47. package/dist/processors/observational-memory/tool-result-helpers.d.ts +12 -0
  48. package/dist/processors/observational-memory/tool-result-helpers.d.ts.map +1 -0
  49. package/package.json +6 -6
  50. package/dist/chunk-SUU4IAZJ.js.map +0 -1
  51. package/dist/chunk-YPFNHFT6.cjs.map +0 -1
  52. package/dist/observational-memory-XXD6E2SO.js +0 -3
@@ -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.8.3-alpha.0"
6
+ version: "1.8.3-alpha.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,71 +1,76 @@
1
1
  {
2
- "version": "1.8.3-alpha.0",
2
+ "version": "1.8.3-alpha.2",
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-SUU4IAZJ.js"
7
+ "implementation": "dist/chunk-4KPXPQX3.js"
8
8
  },
9
9
  "OBSERVATION_CONTEXT_INSTRUCTIONS": {
10
10
  "types": "dist/processors/index.d.ts",
11
- "implementation": "dist/chunk-SUU4IAZJ.js"
11
+ "implementation": "dist/chunk-4KPXPQX3.js"
12
12
  },
13
13
  "OBSERVATION_CONTEXT_PROMPT": {
14
14
  "types": "dist/processors/index.d.ts",
15
- "implementation": "dist/chunk-SUU4IAZJ.js"
15
+ "implementation": "dist/chunk-4KPXPQX3.js"
16
16
  },
17
17
  "OBSERVATION_CONTINUATION_HINT": {
18
18
  "types": "dist/processors/index.d.ts",
19
- "implementation": "dist/chunk-SUU4IAZJ.js"
19
+ "implementation": "dist/chunk-4KPXPQX3.js"
20
20
  },
21
21
  "OBSERVER_SYSTEM_PROMPT": {
22
22
  "types": "dist/processors/index.d.ts",
23
- "implementation": "dist/chunk-SUU4IAZJ.js"
23
+ "implementation": "dist/chunk-4KPXPQX3.js"
24
24
  },
25
25
  "ObservationalMemory": {
26
26
  "types": "dist/processors/index.d.ts",
27
- "implementation": "dist/chunk-SUU4IAZJ.js",
28
- "line": 2966
27
+ "implementation": "dist/chunk-4KPXPQX3.js",
28
+ "line": 3054
29
29
  },
30
30
  "TokenCounter": {
31
31
  "types": "dist/processors/index.d.ts",
32
- "implementation": "dist/chunk-SUU4IAZJ.js",
33
- "line": 2447
32
+ "implementation": "dist/chunk-4KPXPQX3.js",
33
+ "line": 2543
34
34
  },
35
35
  "buildObserverPrompt": {
36
36
  "types": "dist/processors/index.d.ts",
37
- "implementation": "dist/chunk-SUU4IAZJ.js",
38
- "line": 1068
37
+ "implementation": "dist/chunk-4KPXPQX3.js",
38
+ "line": 1164
39
39
  },
40
40
  "buildObserverSystemPrompt": {
41
41
  "types": "dist/processors/index.d.ts",
42
- "implementation": "dist/chunk-SUU4IAZJ.js",
43
- "line": 572
42
+ "implementation": "dist/chunk-4KPXPQX3.js",
43
+ "line": 663
44
44
  },
45
45
  "extractCurrentTask": {
46
46
  "types": "dist/processors/index.d.ts",
47
- "implementation": "dist/chunk-SUU4IAZJ.js",
48
- "line": 1176
47
+ "implementation": "dist/chunk-4KPXPQX3.js",
48
+ "line": 1272
49
49
  },
50
50
  "formatMessagesForObserver": {
51
51
  "types": "dist/processors/index.d.ts",
52
- "implementation": "dist/chunk-SUU4IAZJ.js",
53
- "line": 827
52
+ "implementation": "dist/chunk-4KPXPQX3.js",
53
+ "line": 923
54
+ },
55
+ "getObservationsAsOf": {
56
+ "types": "dist/processors/index.d.ts",
57
+ "implementation": "dist/chunk-4KPXPQX3.js",
58
+ "line": 7086
54
59
  },
55
60
  "hasCurrentTaskSection": {
56
61
  "types": "dist/processors/index.d.ts",
57
- "implementation": "dist/chunk-SUU4IAZJ.js",
58
- "line": 1164
62
+ "implementation": "dist/chunk-4KPXPQX3.js",
63
+ "line": 1260
59
64
  },
60
65
  "optimizeObservationsForContext": {
61
66
  "types": "dist/processors/index.d.ts",
62
- "implementation": "dist/chunk-SUU4IAZJ.js",
63
- "line": 1187
67
+ "implementation": "dist/chunk-4KPXPQX3.js",
68
+ "line": 1283
64
69
  },
65
70
  "parseObserverOutput": {
66
71
  "types": "dist/processors/index.d.ts",
67
- "implementation": "dist/chunk-SUU4IAZJ.js",
68
- "line": 1078
72
+ "implementation": "dist/chunk-4KPXPQX3.js",
73
+ "line": 1174
69
74
  },
70
75
  "extractWorkingMemoryContent": {
71
76
  "types": "dist/index.d.ts",
@@ -96,7 +101,7 @@
96
101
  "processors": {
97
102
  "index": "dist/processors/index.js",
98
103
  "chunks": [
99
- "chunk-SUU4IAZJ.js"
104
+ "chunk-4KPXPQX3.js"
100
105
  ]
101
106
  }
102
107
  }
@@ -278,7 +278,7 @@ const agent = new Agent({
278
278
  id: 'my-agent',
279
279
  name: 'My Agent',
280
280
  instructions: 'You are a helpful assistant',
281
- model: 'openai/gpt-4o-mini',
281
+ model: 'openai/gpt-5-mini',
282
282
  tools: { weatherTool },
283
283
  memory: new Memory(),
284
284
  defaultOptions: {
@@ -343,7 +343,7 @@ const agent = new Agent({
343
343
  id: 'my-agent',
344
344
  name: 'My Agent',
345
345
  instructions: 'You are a helpful assistant',
346
- model: 'openai/gpt-4o-mini',
346
+ model: 'openai/gpt-5-mini',
347
347
  tools: { weatherTool },
348
348
  memory: new Memory(),
349
349
  defaultOptions: {
@@ -445,7 +445,7 @@ const dataAgent = new Agent({
445
445
  id: 'data-agent',
446
446
  name: 'Data Agent',
447
447
  description: 'Handles database queries and user data retrieval',
448
- model: 'openai/gpt-4o-mini',
448
+ model: 'openai/gpt-5-mini',
449
449
  tools: { findUserTool },
450
450
  })
451
451
 
@@ -454,7 +454,7 @@ const supervisorAgent = new Agent({
454
454
  name: 'Supervisor Agent',
455
455
  instructions: `You coordinate data retrieval tasks.
456
456
  Delegate to data-agent for user lookups.`,
457
- model: 'openai/gpt-5.1',
457
+ model: 'openai/gpt-5.4',
458
458
  agents: { dataAgent },
459
459
  memory: new Memory(),
460
460
  })
@@ -176,7 +176,7 @@ const routingAgent = new Agent({
176
176
  id: 'routing-agent',
177
177
  name: 'Routing Agent',
178
178
  instructions: 'You coordinate tasks across multiple agents',
179
- model: 'openai/gpt-4o-mini',
179
+ model: 'openai/gpt-5-mini',
180
180
  tools: { confirmationTool },
181
181
  memory: new Memory(),
182
182
  defaultNetworkOptions: {
@@ -48,7 +48,7 @@ export const routingAgent = new Agent({
48
48
  Always respond with a complete report—no bullet points.
49
49
  Write in full paragraphs, like a blog post.
50
50
  Do not answer with incomplete or uncertain information.`,
51
- model: 'openai/gpt-5.1',
51
+ model: 'openai/gpt-5.4',
52
52
  agents: {
53
53
  researchAgent,
54
54
  writingAgent,
@@ -24,20 +24,20 @@ import { LibSQLStore } from '@mastra/libsql'
24
24
  const researchAgent = new Agent({
25
25
  id: 'research-agent',
26
26
  description: 'Gathers factual information and returns bullet-point summaries.',
27
- model: 'openai/gpt-4o-mini',
27
+ model: 'openai/gpt-5-mini',
28
28
  })
29
29
 
30
30
  const writingAgent = new Agent({
31
31
  id: 'writing-agent',
32
32
  description: 'Transforms research into well-structured articles.',
33
- model: 'openai/gpt-4o-mini',
33
+ model: 'openai/gpt-5-mini',
34
34
  })
35
35
 
36
36
  const supervisor = new Agent({
37
37
  id: 'supervisor',
38
38
  instructions: `You coordinate research and writing using specialized agents.
39
39
  Delegate to research-agent for facts, then writing-agent for content.`,
40
- model: 'openai/gpt-5.1',
40
+ model: 'openai/gpt-5.4',
41
41
  agents: { researchAgent, writingAgent },
42
42
  memory: new Memory({
43
43
  storage: new LibSQLStore({ id: 'storage', url: 'file:mastra.db' }),
@@ -45,7 +45,7 @@ const agent = new Agent({
45
45
  id: 'test-agent',
46
46
  name: 'Test Agent',
47
47
  instructions: 'You are a helpful assistant',
48
- model: 'openai/gpt-4o',
48
+ model: 'openai/gpt-5.4',
49
49
  memory: new Memory({
50
50
  storage: new LibSQLStore({
51
51
  id: 'memory-store',
@@ -95,7 +95,7 @@ import { openai } from '@ai-sdk/openai'
95
95
  const agent = new Agent({
96
96
  name: 'semantic-agent',
97
97
  instructions: 'You are a helpful assistant with semantic memory',
98
- model: 'openai/gpt-4o',
98
+ model: 'openai/gpt-5.4',
99
99
  memory: new Memory({
100
100
  storage: new LibSQLStore({
101
101
  id: 'memory-store',
@@ -148,7 +148,7 @@ import { openai } from '@ai-sdk/openai'
148
148
  const agent = new Agent({
149
149
  name: 'working-memory-agent',
150
150
  instructions: 'You are an assistant with working memory',
151
- model: 'openai/gpt-4o',
151
+ model: 'openai/gpt-5.4',
152
152
  memory: new Memory({
153
153
  storage: new LibSQLStore({
154
154
  id: 'memory-store',
@@ -180,7 +180,7 @@ const customMessageHistory = new MessageHistory({
180
180
  const agent = new Agent({
181
181
  name: 'custom-memory-agent',
182
182
  instructions: 'You are a helpful assistant',
183
- model: 'openai/gpt-4o',
183
+ model: 'openai/gpt-5.4',
184
184
  memory: new Memory({
185
185
  storage: new LibSQLStore({ id: 'memory-store', url: 'file:memory.db' }),
186
186
  lastMessages: 10, // This would normally add MessageHistory(10)
@@ -250,7 +250,7 @@ const contentBlocker = {
250
250
  const agent = new Agent({
251
251
  name: 'safe-agent',
252
252
  instructions: 'You are a helpful assistant',
253
- model: 'openai/gpt-4o',
253
+ model: 'openai/gpt-5.4',
254
254
  memory: new Memory({ lastMessages: 10 }),
255
255
  // Your guardrail runs BEFORE memory saves
256
256
  outputProcessors: [contentBlocker],
@@ -289,7 +289,7 @@ const inputValidator = {
289
289
  const agent = new Agent({
290
290
  name: 'validated-agent',
291
291
  instructions: 'You are a helpful assistant',
292
- model: 'openai/gpt-4o',
292
+ model: 'openai/gpt-5.4',
293
293
  memory: new Memory({ lastMessages: 10 }),
294
294
  // Your guardrail runs AFTER memory loads history
295
295
  inputProcessors: [inputValidator],
@@ -28,7 +28,7 @@ const agent = new Agent({
28
28
  id: 'support-agent',
29
29
  name: 'SupportAgent',
30
30
  instructions: 'You are a helpful support agent.',
31
- model: 'openai/gpt-5.1',
31
+ model: 'openai/gpt-5.4',
32
32
  memory: new Memory(),
33
33
  })
34
34
  ```
@@ -180,7 +180,7 @@ export const agent = new Agent({
180
180
  memory: new Memory({
181
181
  options: {
182
182
  generateTitle: {
183
- model: 'openai/gpt-4o-mini',
183
+ model: 'openai/gpt-5-mini',
184
184
  instructions: 'Generate a 1 word title',
185
185
  },
186
186
  },
@@ -26,7 +26,7 @@ const agent = new Agent({
26
26
  id: 'personal-assistant',
27
27
  name: 'PersonalAssistant',
28
28
  instructions: 'You are a helpful personal assistant.',
29
- model: 'openai/gpt-5.1',
29
+ model: 'openai/gpt-5.4',
30
30
  memory: new Memory({
31
31
  options: {
32
32
  workingMemory: {
@@ -268,7 +268,7 @@ Schema-based working memory uses **merge semantics**, meaning the agent only nee
268
268
  ## Choosing between template and schema
269
269
 
270
270
  - Use a **template** (Markdown) if you want the agent to maintain memory as a free-form text block, such as a user profile or scratchpad. Templates use **replace semantics** — the agent must provide the complete memory content on each update.
271
- - Use a **schema** if you need structured, type-safe data that can be validated and programmatically accessed as JSON. Schemas use **merge semantics** — the agent only provides fields to update, and existing fields are preserved.
271
+ - Use a **schema** if you need structured, type-safe data that can be validated and programmatically accessed as JSON. The `workingMemory.schema` field accepts any `PublicSchema`-compatible schema (including Zod v3, Zod v4, JSON Schema, or already-standard schemas). Schemas use **merge semantics** — the agent only provides fields to update, and existing fields are preserved.
272
272
  - Only one mode can be active at a time: setting both `template` and `schema` isn't supported.
273
273
 
274
274
  ## Example: Multi-step retention
@@ -11,7 +11,7 @@ import { Agent } from '@mastra/core/agent'
11
11
  export const agent = new Agent({
12
12
  name: 'test-agent',
13
13
  instructions: 'You are an agent with memory.',
14
- model: 'openai/gpt-5.1',
14
+ model: 'openai/gpt-5.4',
15
15
  memory: new Memory({
16
16
  options: {
17
17
  workingMemory: {
@@ -60,7 +60,7 @@ import { LibSQLStore, LibSQLVector } from '@mastra/libsql'
60
60
  export const agent = new Agent({
61
61
  name: 'test-agent',
62
62
  instructions: 'You are an agent with memory.',
63
- model: 'openai/gpt-5.1',
63
+ model: 'openai/gpt-5.4',
64
64
  memory: new Memory({
65
65
  storage: new LibSQLStore({
66
66
  id: 'test-agent-storage',
@@ -97,7 +97,7 @@ import { PgStore, PgVector } from '@mastra/pg'
97
97
  export const agent = new Agent({
98
98
  name: 'pg-agent',
99
99
  instructions: 'You are an agent with optimized PostgreSQL memory.',
100
- model: 'openai/gpt-5.1',
100
+ model: 'openai/gpt-5.4',
101
101
  memory: new Memory({
102
102
  storage: new PgStore({
103
103
  id: 'pg-agent-storage',
@@ -159,11 +159,11 @@ import { Agent } from '@mastra/core/agent'
159
159
  export const agent = new Agent({
160
160
  name: 'my-agent',
161
161
  instructions: 'You are a helpful assistant.',
162
- model: 'openai/gpt-5-mini',
162
+ model: 'openai/gpt-5.4',
163
163
  memory: new Memory({
164
164
  options: {
165
165
  observationalMemory: {
166
- model: 'openai/gpt-4o-mini',
166
+ model: 'openai/gpt-5-mini',
167
167
  },
168
168
  },
169
169
  }),
@@ -179,7 +179,7 @@ import { Agent } from '@mastra/core/agent'
179
179
  export const agent = new Agent({
180
180
  name: 'my-agent',
181
181
  instructions: 'You are a helpful assistant.',
182
- model: 'openai/gpt-5-mini',
182
+ model: 'openai/gpt-5.4',
183
183
  memory: new Memory({
184
184
  options: {
185
185
  observationalMemory: {
@@ -187,7 +187,7 @@ export const agent = new Agent({
187
187
  model: 'google/gemini-2.5-flash',
188
188
  },
189
189
  reflection: {
190
- model: 'openai/gpt-4o-mini',
190
+ model: 'openai/gpt-5-mini',
191
191
  },
192
192
  },
193
193
  },
@@ -206,7 +206,7 @@ import { Agent } from '@mastra/core/agent'
206
206
  export const agent = new Agent({
207
207
  name: 'health-assistant',
208
208
  instructions: 'You are a health and wellness assistant.',
209
- model: 'openai/gpt-5-mini',
209
+ model: 'openai/gpt-5.4',
210
210
  memory: new Memory({
211
211
  options: {
212
212
  observationalMemory: {
@@ -79,7 +79,7 @@ import { TokenLimiterProcessor } from '@mastra/core/processors'
79
79
  export const agent = new Agent({
80
80
  name: 'context-limited-agent',
81
81
  instructions: 'You are a helpful assistant',
82
- model: 'openai/gpt-4o',
82
+ model: 'openai/gpt-5.4',
83
83
  memory: new Memory({
84
84
  /* ... */
85
85
  }),
@@ -100,7 +100,7 @@ import { TokenLimiterProcessor } from '@mastra/core/processors'
100
100
  export const agent = new Agent({
101
101
  name: 'multi-step-agent',
102
102
  instructions: 'You are a helpful research assistant with access to tools',
103
- model: 'openai/gpt-4o',
103
+ model: 'openai/gpt-5.4',
104
104
  inputProcessors: [
105
105
  new TokenLimiterProcessor({ limit: 8000 }), // Applied at every step
106
106
  ],
@@ -123,7 +123,7 @@ import { TokenLimiterProcessor } from '@mastra/core/processors'
123
123
  export const agent = new Agent({
124
124
  name: 'response-limited-agent',
125
125
  instructions: 'You are a helpful assistant',
126
- model: 'openai/gpt-4o',
126
+ model: 'openai/gpt-5.4',
127
127
  outputProcessors: [
128
128
  new TokenLimiterProcessor({
129
129
  limit: 1000,
@@ -206,7 +206,7 @@ export const mongodbAgent = new Agent({
206
206
  name: 'mongodb-agent',
207
207
  instructions:
208
208
  'You are an AI agent with the ability to automatically recall memories from previous interactions.',
209
- model: 'openai/gpt-5.1',
209
+ model: 'openai/gpt-5.4',
210
210
  memory: new Memory({
211
211
  storage: new MongoDBStore({
212
212
  uri: process.env.MONGODB_URI!,
@@ -332,7 +332,7 @@ export const pgAgent = new Agent({
332
332
  name: 'PG Agent',
333
333
  instructions:
334
334
  'You are an AI agent with the ability to automatically recall memories from previous interactions.',
335
- model: 'openai/gpt-5.1',
335
+ model: 'openai/gpt-5.4',
336
336
  memory: new Memory({
337
337
  storage: new PostgresStore({
338
338
  id: 'pg-agent-storage',
@@ -103,7 +103,7 @@ export const upstashAgent = new Agent({
103
103
  name: 'Upstash Agent',
104
104
  instructions:
105
105
  'You are an AI agent with the ability to automatically recall memories from previous interactions.',
106
- model: 'openai/gpt-5.1',
106
+ model: 'openai/gpt-5.4',
107
107
  memory: new Memory({
108
108
  storage: new UpstashStore({
109
109
  id: 'upstash-agent-storage',
@@ -277,7 +277,7 @@ export const libsqlAgent = new Agent({
277
277
  name: 'libSQL Agent',
278
278
  instructions:
279
279
  'You are an AI agent with the ability to automatically recall memories from previous interactions.',
280
- model: 'openai/gpt-5.1',
280
+ model: 'openai/gpt-5.4',
281
281
  memory: new Memory({
282
282
  storage: new LibSQLStore({
283
283
  id: 'libsql-agent-storage',
@@ -265,7 +265,7 @@ export const mongodbAgent = new Agent({
265
265
  name: 'mongodb-agent',
266
266
  instructions:
267
267
  'You are an AI agent with the ability to automatically recall memories from previous interactions.',
268
- model: 'openai/gpt-5.1',
268
+ model: 'openai/gpt-5.4',
269
269
  memory: new Memory({
270
270
  storage: new MongoDBStore({
271
271
  id: 'mongodb-storage',
@@ -399,7 +399,7 @@ export const pgAgent = new Agent({
399
399
  name: 'PG Agent',
400
400
  instructions:
401
401
  'You are an AI agent with the ability to automatically recall memories from previous interactions.',
402
- model: 'openai/gpt-5.1',
402
+ model: 'openai/gpt-5.4',
403
403
  memory: new Memory({
404
404
  storage: new PostgresStore({
405
405
  id: 'pg-agent-storage',
@@ -265,7 +265,7 @@ export const upstashAgent = new Agent({
265
265
  name: 'Upstash Agent',
266
266
  instructions:
267
267
  'You are an AI agent with the ability to automatically recall memories from previous interactions.',
268
- model: 'openai/gpt-5.1',
268
+ model: 'openai/gpt-5.4',
269
269
  memory: new Memory({
270
270
  storage: new UpstashStore({
271
271
  id: 'upstash-agent-storage',
package/dist/index.cjs CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  var chunkCK4U3AYR_cjs = require('./chunk-CK4U3AYR.cjs');
4
4
  var chunkIDRQZVB4_cjs = require('./chunk-IDRQZVB4.cjs');
5
+ var chunkLGCREJMO_cjs = require('./chunk-LGCREJMO.cjs');
5
6
  var v3 = require('zod/v3');
6
7
  var zod = require('zod');
7
8
  var z4 = require('zod/v4');
@@ -39,7 +40,7 @@ function _interopNamespace(e) {
39
40
  var z4__namespace = /*#__PURE__*/_interopNamespace(z4);
40
41
  var xxhash__default = /*#__PURE__*/_interopDefault(xxhash);
41
42
 
42
- // ../_vendored/ai_v4/dist/chunk-GBOGIFXJ.js
43
+ // ../_vendored/ai_v4/dist/chunk-OPIPXJLE.js
43
44
  var __create = Object.create;
44
45
  var __defProp = Object.defineProperty;
45
46
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -15491,7 +15492,7 @@ var updateWorkingMemoryTool = (memoryConfig) => {
15491
15492
  });
15492
15493
  }
15493
15494
  const usesMergeSemantics = Boolean(schema$2);
15494
- const description = schema$2 ? `Update the working memory with new information. Data is merged with existing memory - you only need to include fields you want to add or update. Set a field to null to remove it. Arrays are replaced entirely when provided.` : `Update the working memory with new information. Any data not included will be overwritten. Always pass data as string to the memory field. Never pass an object.`;
15495
+ const description = schema$2 ? `Update the working memory with new information. Data is merged with existing memory - only include fields you want to add or update. To preserve existing data, omit the field entirely. Arrays are replaced entirely when provided, so pass the complete array or omit it to keep the existing values.` : `Update the working memory with new information. Any data not included will be overwritten. Always pass data as string to the memory field. Never pass an object.`;
15495
15496
  return tools.createTool({
15496
15497
  id: "update-working-memory",
15497
15498
  description,
@@ -15972,14 +15973,15 @@ var Memory = class extends memory.MastraMemory {
15972
15973
  const existingWorkingMemory = await this.getWorkingMemory({ threadId, resourceId, memoryConfig }) || "";
15973
15974
  const template = await this.getWorkingMemoryTemplate({ memoryConfig });
15974
15975
  let reason = "";
15976
+ const templateContent = typeof template?.content === "string" ? template.content : null;
15975
15977
  const normalizeForComparison = (str) => str.replace(/\s+/g, " ").trim();
15976
15978
  const normalizedNewMemory = normalizeForComparison(workingMemory);
15977
- const normalizedTemplate = template?.content ? normalizeForComparison(template.content) : "";
15979
+ const normalizedTemplate = templateContent ? normalizeForComparison(templateContent) : "";
15978
15980
  if (existingWorkingMemory) {
15979
15981
  if (searchString && existingWorkingMemory?.includes(searchString)) {
15980
15982
  workingMemory = existingWorkingMemory.replace(searchString, workingMemory);
15981
15983
  reason = `found and replaced searchString with newMemory`;
15982
- } else if (existingWorkingMemory.includes(workingMemory) || template?.content?.trim() === workingMemory.trim() || // Also check normalized versions to catch template variations with different whitespace
15984
+ } else if (existingWorkingMemory.includes(workingMemory) || templateContent?.trim() === workingMemory.trim() || // Also check normalized versions to catch template variations with different whitespace
15983
15985
  normalizedNewMemory === normalizedTemplate) {
15984
15986
  return {
15985
15987
  success: false,
@@ -16000,7 +16002,7 @@ var Memory = class extends memory.MastraMemory {
16000
16002
  workingMemory = existingWorkingMemory + `
16001
16003
  ${workingMemory}`;
16002
16004
  }
16003
- } else if (workingMemory === template?.content || normalizedNewMemory === normalizedTemplate) {
16005
+ } else if (workingMemory === templateContent || normalizedNewMemory === normalizedTemplate) {
16004
16006
  return {
16005
16007
  success: false,
16006
16008
  reason: `try again when you have data to add. newMemory was equal to the working memory template`
@@ -16008,10 +16010,10 @@ ${workingMemory}`;
16008
16010
  } else {
16009
16011
  reason = `started new working memory`;
16010
16012
  }
16011
- if (template?.content) {
16012
- workingMemory = workingMemory.replaceAll(template.content, "");
16013
- const templateWithUnixLineEndings = template.content.replace(/\r\n/g, "\n");
16014
- const templateWithWindowsLineEndings = template.content.replace(/\n/g, "\r\n");
16013
+ if (templateContent) {
16014
+ workingMemory = workingMemory.replaceAll(templateContent, "");
16015
+ const templateWithUnixLineEndings = templateContent.replace(/\r\n/g, "\n");
16016
+ const templateWithWindowsLineEndings = templateContent.replace(/\n/g, "\r\n");
16015
16017
  workingMemory = workingMemory.replaceAll(templateWithUnixLineEndings, "");
16016
16018
  workingMemory = workingMemory.replaceAll(templateWithWindowsLineEndings, "");
16017
16019
  }
@@ -17013,7 +17015,7 @@ Notes:
17013
17015
  "Observational memory requires @mastra/core support for request-response-id-rotation. Please bump @mastra/core to a newer version."
17014
17016
  );
17015
17017
  }
17016
- const { ObservationalMemory } = await import('./observational-memory-3HFM7PY2.cjs');
17018
+ const { ObservationalMemory } = await import('./observational-memory-4TV5KKFV.cjs');
17017
17019
  return new ObservationalMemory({
17018
17020
  storage: memoryStore,
17019
17021
  scope: omConfig.scope,
@@ -17044,6 +17046,10 @@ Notes:
17044
17046
  }
17045
17047
  };
17046
17048
 
17049
+ Object.defineProperty(exports, "getObservationsAsOf", {
17050
+ enumerable: true,
17051
+ get: function () { return chunkLGCREJMO_cjs.getObservationsAsOf; }
17052
+ });
17047
17053
  Object.defineProperty(exports, "extractWorkingMemoryContent", {
17048
17054
  enumerable: true,
17049
17055
  get: function () { return memory.extractWorkingMemoryContent; }