@mastra/memory 1.26.1-alpha.6 → 1.26.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.
- package/CHANGELOG.md +86 -0
- package/dist/docs/SKILL.md +15 -9
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-networks.md +2 -2
- package/dist/docs/references/docs-capabilities-subagents.md +2 -2
- package/dist/docs/references/docs-memory-memory-processors.md +5 -5
- package/dist/docs/references/docs-memory-message-history.md +1 -1
- package/dist/docs/references/docs-memory-observational-memory.md +1 -1
- package/dist/docs/references/docs-storage-overview.md +14 -13
- package/dist/docs/references/integrations-channels-github.md +103 -0
- package/dist/docs/references/{reference-storage-dsql.md → integrations-databases-aurora-dsql.md} +1 -1
- package/dist/docs/references/{reference-storage-dynamodb.md → integrations-databases-dynamodb.md} +1 -1
- package/dist/docs/references/{reference-storage-libsql.md → integrations-databases-libsql.md} +2 -2
- package/dist/docs/references/{reference-storage-mongodb.md → integrations-databases-mongodb.md} +1 -1
- package/dist/docs/references/{reference-storage-oracledb.md → integrations-databases-oracledb.md} +1 -1
- package/dist/docs/references/{reference-storage-postgresql.md → integrations-databases-postgresql.md} +1 -1
- package/dist/docs/references/{reference-storage-redis.md → integrations-databases-redis.md} +1 -1
- package/dist/docs/references/{reference-storage-upstash.md → integrations-databases-upstash.md} +1 -1
- package/dist/docs/references/reference-migrations-agentnetwork.md +100 -0
- package/dist/docs/references/reference-migrations-upgrade-to-v1-memory.md +288 -0
- package/dist/docs/references/reference-vectors-oracledb.md +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/processors/index.cjs +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts.map +1 -1
- package/dist/{src-B2WSEEmS.cjs → src-CTwoCwmY.cjs} +10 -10
- package/dist/{src-B2WSEEmS.cjs.map → src-CTwoCwmY.cjs.map} +1 -1
- package/dist/{src-B_n15_Xg.js → src-DGdlH4fo.js} +10 -10
- package/dist/{src-B_n15_Xg.js.map → src-DGdlH4fo.js.map} +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Memory
|
|
4
|
+
|
|
5
|
+
Memory configuration now requires explicit parameters, and default settings have been updated for better performance and predictability.
|
|
6
|
+
|
|
7
|
+
## Changed
|
|
8
|
+
|
|
9
|
+
### Default settings for semantic recall and last messages
|
|
10
|
+
|
|
11
|
+
Default settings have changed to more reasonable values based on usage patterns. The `lastMessages` default decreased from 40 to 10, `semanticRecall` is now disabled by default, and thread title generation is disabled by default. These changes improve performance and reduce unexpected LLM API calls.
|
|
12
|
+
|
|
13
|
+
To migrate, if you were relying on the old defaults, explicitly configure these settings.
|
|
14
|
+
|
|
15
|
+
```diff
|
|
16
|
+
const memory = new Memory({
|
|
17
|
+
storage,
|
|
18
|
+
vector,
|
|
19
|
+
embedder,
|
|
20
|
+
+ options: {
|
|
21
|
+
+ lastMessages: 40, // Was default before
|
|
22
|
+
+ semanticRecall: {
|
|
23
|
+
+ topK: 2,
|
|
24
|
+
+ messageRange: 2,
|
|
25
|
+
+ scope: 'thread',
|
|
26
|
+
+ }, // Was enabled by default before
|
|
27
|
+
+ generateTitle: true, // Was enabled by default before
|
|
28
|
+
+ },
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Default memory scope from `thread` to `resource`
|
|
33
|
+
|
|
34
|
+
The default scope for both working memory and semantic recall has changed from `'thread'` to `'resource'`. This change aligns with common use cases where applications want to remember user information across conversations. When semantic recall is enabled, it now defaults to searching across all user conversations rather than the current thread.
|
|
35
|
+
|
|
36
|
+
To migrate, if you want to maintain the old behavior where memory is isolated per conversation thread, explicitly set `scope: 'thread'`.
|
|
37
|
+
|
|
38
|
+
```diff
|
|
39
|
+
const memory = new Memory({
|
|
40
|
+
storage,
|
|
41
|
+
vector,
|
|
42
|
+
embedder,
|
|
43
|
+
options: {
|
|
44
|
+
workingMemory: {
|
|
45
|
+
enabled: true,
|
|
46
|
+
+ scope: 'thread', // Explicitly set to thread-scoped
|
|
47
|
+
template: `# User Profile...`,
|
|
48
|
+
},
|
|
49
|
+
semanticRecall: {
|
|
50
|
+
topK: 3,
|
|
51
|
+
+ scope: 'thread', // Explicitly set to thread-scoped
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Thread title generation location
|
|
58
|
+
|
|
59
|
+
The `generateTitle` option has been moved from `threads.generateTitle` to the top-level of memory options. This change simplifies the API by moving the option to where it logically belongs.
|
|
60
|
+
|
|
61
|
+
To migrate, move `generateTitle` from the `threads` config to the top level of options.
|
|
62
|
+
|
|
63
|
+
```diff
|
|
64
|
+
const memory = new Memory({
|
|
65
|
+
storage,
|
|
66
|
+
vector,
|
|
67
|
+
embedder,
|
|
68
|
+
options: {
|
|
69
|
+
- threads: {
|
|
70
|
+
- generateTitle: true,
|
|
71
|
+
- },
|
|
72
|
+
+ generateTitle: true,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Semantic recall default settings optimization
|
|
78
|
+
|
|
79
|
+
The default settings for semantic recall have been optimized based on RAG research. The `topK` increased from 2 to 4, and `messageRange` changed from `{ before: 2, after: 2 }` to `{ before: 1, after: 1 }`. These changes provide better accuracy while only slightly increasing message count.
|
|
80
|
+
|
|
81
|
+
To migrate, if you were relying on the previous defaults, explicitly set these values.
|
|
82
|
+
|
|
83
|
+
```diff
|
|
84
|
+
const memory = new Memory({
|
|
85
|
+
storage,
|
|
86
|
+
vector,
|
|
87
|
+
embedder,
|
|
88
|
+
options: {
|
|
89
|
+
semanticRecall: {
|
|
90
|
+
+ topK: 2, // Was default before
|
|
91
|
+
+ messageRange: { before: 2, after: 2 }, // Was default before
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### `memory.readOnly` moved to `memory.options.readOnly`
|
|
98
|
+
|
|
99
|
+
The `readOnly` property has been moved from the top-level of the memory option to inside `options`. This change aligns `readOnly` with other memory configuration options like `lastMessages` and `semanticRecall`.
|
|
100
|
+
|
|
101
|
+
To migrate, move `readOnly` from the top level to inside `options`.
|
|
102
|
+
|
|
103
|
+
```diff
|
|
104
|
+
agent.stream('Hello', {
|
|
105
|
+
memory: {
|
|
106
|
+
thread: threadId,
|
|
107
|
+
resource: resourceId,
|
|
108
|
+
- readOnly: true,
|
|
109
|
+
+ options: {
|
|
110
|
+
+ readOnly: true,
|
|
111
|
+
+ },
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
> **Codemod:** You can use Mastra's codemod CLI to update your code automatically:
|
|
117
|
+
>
|
|
118
|
+
> ```bash
|
|
119
|
+
> npx @mastra/codemod@latest v1/memory-readonly-to-options .
|
|
120
|
+
> ```
|
|
121
|
+
|
|
122
|
+
### `Memory.query()` renamed to `Memory.recall()`
|
|
123
|
+
|
|
124
|
+
The `Memory.query()` method has been renamed to `Memory.recall()`. The new method returns a simpler format with `{ messages: MastraDBMessage[] }` instead of multiple format variations. This change better describes the action of retrieving messages from memory and simplifies the API.
|
|
125
|
+
|
|
126
|
+
To migrate, rename `query()` to `recall()` and update code that expects the old return format.
|
|
127
|
+
|
|
128
|
+
```diff
|
|
129
|
+
- const result = await memory.query({ threadId: 'thread-123' });
|
|
130
|
+
+ const result = await memory.recall({ threadId: 'thread-123' });
|
|
131
|
+
- // result: { messages: CoreMessage[], uiMessages: UIMessageWithMetadata[], messagesV2: MastraMessageV2[] }
|
|
132
|
+
+ // result: { messages: MastraDBMessage[] }
|
|
133
|
+
+ const messages = result.messages;
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
> **Codemod:** You can use Mastra's codemod CLI to update your code automatically:
|
|
137
|
+
>
|
|
138
|
+
> ```bash
|
|
139
|
+
> npx @mastra/codemod@latest v1/memory-query-to-recall .
|
|
140
|
+
> ```
|
|
141
|
+
|
|
142
|
+
### `Memory.recall()` parameter changes
|
|
143
|
+
|
|
144
|
+
The `Memory.recall()` method now uses `StorageListMessagesInput` format with pagination, and the `vectorMessageSearch` parameter has been renamed to `vectorSearchString`. These changes align the memory API with the storage pagination API and provide more consistent naming.
|
|
145
|
+
|
|
146
|
+
To migrate, update method name, query parameters, and the vector search parameter.
|
|
147
|
+
|
|
148
|
+
```diff
|
|
149
|
+
- memory.query({
|
|
150
|
+
+ memory.recall({
|
|
151
|
+
threadId: 'thread-123',
|
|
152
|
+
- vectorMessageSearch: 'What did we discuss?',
|
|
153
|
+
- selectBy: { ... },
|
|
154
|
+
+ vectorSearchString: 'What did we discuss?',
|
|
155
|
+
+ page: 0,
|
|
156
|
+
+ perPage: 20,
|
|
157
|
+
+ orderBy: 'createdAt',
|
|
158
|
+
+ filter: { ... },
|
|
159
|
+
+ threadConfig: { semanticRecall: true },
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
> **Codemod:** You can use Mastra's codemod CLI to update your code automatically:
|
|
164
|
+
>
|
|
165
|
+
> ```bash
|
|
166
|
+
> npx @mastra/codemod@latest v1/memory-vector-search-param .
|
|
167
|
+
> ```
|
|
168
|
+
|
|
169
|
+
### `MastraMessageV2` type renamed to `MastraDBMessage`
|
|
170
|
+
|
|
171
|
+
The `MastraMessageV2` type has been renamed to `MastraDBMessage` for clarity. This change better describes the purpose of this type as the database message format.
|
|
172
|
+
|
|
173
|
+
To migrate, replace all instances of `MastraMessageV2` with `MastraDBMessage`.
|
|
174
|
+
|
|
175
|
+
```diff
|
|
176
|
+
- import { MastraMessageV2 } from '@mastra/core';
|
|
177
|
+
- function yourCustomFunction(input: MastraMessageV2) {}
|
|
178
|
+
+ import { MastraDBMessage } from '@mastra/core';
|
|
179
|
+
+ function yourCustomFunction(input: MastraDBMessage) {}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
> **Codemod:** You can use Mastra's codemod CLI to update your code automatically:
|
|
183
|
+
>
|
|
184
|
+
> ```bash
|
|
185
|
+
> npx @mastra/codemod@latest v1/memory-message-v2-type .
|
|
186
|
+
> ```
|
|
187
|
+
|
|
188
|
+
## Removed
|
|
189
|
+
|
|
190
|
+
### Working memory `text-stream` mode
|
|
191
|
+
|
|
192
|
+
Working memory `use: "text-stream"` option has been removed. Only `tool-call` mode is supported. This change simplifies the working memory API by removing the less reliable streaming mode.
|
|
193
|
+
|
|
194
|
+
To migrate, remove the `use: "text-stream"` option. Working memory will default to tool-call mode.
|
|
195
|
+
|
|
196
|
+
```diff
|
|
197
|
+
const memory = new Memory({
|
|
198
|
+
storage,
|
|
199
|
+
vector,
|
|
200
|
+
embedder,
|
|
201
|
+
options: {
|
|
202
|
+
workingMemory: {
|
|
203
|
+
enabled: true,
|
|
204
|
+
- use: 'text-stream',
|
|
205
|
+
template: '...',
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### `Memory.rememberMessages()` method
|
|
212
|
+
|
|
213
|
+
The `Memory.rememberMessages()` method has been removed. This method performed the same function as `query()` (now `recall()`), and consolidating to one method simplifies the API.
|
|
214
|
+
|
|
215
|
+
To migrate, replace `rememberMessages()` calls with `recall()`.
|
|
216
|
+
|
|
217
|
+
```diff
|
|
218
|
+
- const { messages } = await memory.rememberMessages({
|
|
219
|
+
+ const { messages } = await memory.recall({
|
|
220
|
+
threadId,
|
|
221
|
+
resourceId,
|
|
222
|
+
});
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### `format` parameter from memory methods
|
|
226
|
+
|
|
227
|
+
The `format` parameter has been removed from all memory get methods. `MastraDBMessage` is now the default return format everywhere. AI SDK format conversion has moved to dedicated utility functions in `@mastra/ai-sdk/ui`. This change improves tree-shaking by moving UI-specific conversion code to a separate package.
|
|
228
|
+
|
|
229
|
+
To migrate, remove the `format` parameter and use conversion functions for AI SDK formats.
|
|
230
|
+
|
|
231
|
+
```diff
|
|
232
|
+
- const messages = await memory.getMessages({ threadId, format: 'v2' });
|
|
233
|
+
- const uiMessages = await memory.getMessages({ threadId, format: 'ui' });
|
|
234
|
+
|
|
235
|
+
+ const result = await memory.recall({ threadId });
|
|
236
|
+
+ const messages = result.messages; // Always MastraDBMessage[]
|
|
237
|
+
+
|
|
238
|
+
+ // Use conversion functions for AI SDK formats
|
|
239
|
+
+ import { toAISdkV5Messages } from '@mastra/ai-sdk/ui';
|
|
240
|
+
+ const uiMessages = toAISdkV5Messages(messages);
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### `MastraMessageV3` type
|
|
244
|
+
|
|
245
|
+
The `MastraMessageV3` type and related conversion methods have been removed. Messages now convert directly between `MastraMessageV2` (now `MastraDBMessage`) and AI SDK v5 formats. This change simplifies the architecture by removing an intermediary format.
|
|
246
|
+
|
|
247
|
+
To migrate, use `MastraDBMessage` for storage or AI SDK v5 message formats directly.
|
|
248
|
+
|
|
249
|
+
```diff
|
|
250
|
+
- import type { MastraMessageV3 } from '@mastra/core/agent';
|
|
251
|
+
- const v3Messages = messageList.get.all.v3();
|
|
252
|
+
|
|
253
|
+
+ // For storage
|
|
254
|
+
+ const v2Messages = messageList.get.all.v2();
|
|
255
|
+
+
|
|
256
|
+
+ // For AI SDK v5
|
|
257
|
+
+ const uiMessages = messageList.get.all.aiV5.ui();
|
|
258
|
+
+ const modelMessages = messageList.get.all.aiV5.model();
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### `processors` config from Memory constructor
|
|
262
|
+
|
|
263
|
+
The `processors` config option in the Memory constructor is no longer supported and throws an error. Configure processors at the Agent level, where processor behavior is scoped to agent execution.
|
|
264
|
+
|
|
265
|
+
To migrate, move processor configuration from Memory to Agent using `inputProcessors` and/or `outputProcessors`.
|
|
266
|
+
|
|
267
|
+
```diff
|
|
268
|
+
+ import { TokenLimiter } from '@mastra/core/processors';
|
|
269
|
+
+
|
|
270
|
+
const memory = new Memory({
|
|
271
|
+
storage,
|
|
272
|
+
vector,
|
|
273
|
+
embedder,
|
|
274
|
+
- processors: [/* ... */],
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
const agent = new Agent({
|
|
278
|
+
id: 'agent',
|
|
279
|
+
memory,
|
|
280
|
+
+ inputProcessors: [
|
|
281
|
+
+ new TokenLimiter({ limit: 4000 }), // Limits historical messages to fit context window
|
|
282
|
+
+ ],
|
|
283
|
+
});
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Additionally, the `@mastra/memory/processors` import path has been removed. Import processors from `@mastra/core/processors` instead. See the [processors migration guide](https://mastra.ai/reference/migrations/upgrade-to-v1/processors) for details.
|
|
287
|
+
|
|
288
|
+
For more information on using processors with agents, see the [Processors docs](https://mastra.ai/docs/agents/processors). For a complete example with memory, see the [TokenLimiter reference](https://mastra.ai/reference/processors/token-limiter-processor).
|
|
@@ -342,6 +342,6 @@ export const oracleAgent = new Agent({
|
|
|
342
342
|
|
|
343
343
|
## Related
|
|
344
344
|
|
|
345
|
-
- [OracleDB storage](https://mastra.ai/
|
|
345
|
+
- [OracleDB storage](https://mastra.ai/integrations/databases/oracledb)
|
|
346
346
|
- [Metadata Filters](https://mastra.ai/reference/rag/metadata-filters)
|
|
347
|
-
- [Vector databases](https://mastra.ai/
|
|
347
|
+
- [Vector databases](https://mastra.ai/reference/rag/vector-databases)
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_src = require("./src-
|
|
2
|
+
const require_src = require("./src-CTwoCwmY.cjs");
|
|
3
3
|
let _mastra_core_processors = require("@mastra/core/processors");
|
|
4
4
|
exports.Extractor = require_src.Extractor;
|
|
5
5
|
exports.Memory = require_src.Memory;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as WorkingMemoryExtractor, R as Extractor, S as deepMergeWorkingMemory, T as summarizeConversation, a as extractWorkingMemoryContent, c as WORKING_MEMORY_STATE_ID, d as getObservationsAsOf, i as WorkingMemory, l as WORKING_MEMORY_STATE_PROCESSOR_ID, n as MessageHistory, o as extractWorkingMemoryTags, r as SemanticRecall, s as removeWorkingMemoryTags, t as Memory, u as WorkingMemoryStateProcessor, w as SUMMARIZE_THREAD_DEFAULTS, x as ModelByInputTokens } from "./src-
|
|
1
|
+
import { C as WorkingMemoryExtractor, R as Extractor, S as deepMergeWorkingMemory, T as summarizeConversation, a as extractWorkingMemoryContent, c as WORKING_MEMORY_STATE_ID, d as getObservationsAsOf, i as WorkingMemory, l as WORKING_MEMORY_STATE_PROCESSOR_ID, n as MessageHistory, o as extractWorkingMemoryTags, r as SemanticRecall, s as removeWorkingMemoryTags, t as Memory, u as WorkingMemoryStateProcessor, w as SUMMARIZE_THREAD_DEFAULTS, x as ModelByInputTokens } from "./src-DGdlH4fo.js";
|
|
2
2
|
export { Extractor, Memory, MessageHistory, ModelByInputTokens, SUMMARIZE_THREAD_DEFAULTS, SemanticRecall, WORKING_MEMORY_STATE_ID, WORKING_MEMORY_STATE_PROCESSOR_ID, WorkingMemory, WorkingMemoryExtractor, WorkingMemoryStateProcessor, deepMergeWorkingMemory, extractWorkingMemoryContent, extractWorkingMemoryTags, getObservationsAsOf, removeWorkingMemoryTags, summarizeConversation };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_src = require("../src-
|
|
2
|
+
const require_src = require("../src-CTwoCwmY.cjs");
|
|
3
3
|
exports.Extractor = require_src.Extractor;
|
|
4
4
|
exports.ModelByInputTokens = require_src.ModelByInputTokens;
|
|
5
5
|
exports.OBSERVATIONAL_MEMORY_DEFAULTS = require_src.OBSERVATIONAL_MEMORY_DEFAULTS;
|
package/dist/processors/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as extractCurrentTask, B as OBSERVATION_CONTEXT_INSTRUCTIONS, C as WorkingMemoryExtractor, D as OBSERVER_SYSTEM_PROMPT, E as TokenCounter, F as injectAnchorIds, H as OBSERVATION_CONTINUATION_HINT, I as parseAnchorId, L as stripEphemeralAnchorIds, M as hasCurrentTaskSection, N as optimizeObservationsForContext, O as buildObserverPrompt, P as parseObserverOutput, R as Extractor, T as summarizeConversation, V as OBSERVATION_CONTEXT_PROMPT, _ as reconcileObservationGroupsFromReflection, b as wrapInObservationGroup, d as getObservationsAsOf, f as ObservationalMemoryProcessor, g as parseObservationGroups, h as deriveObservationGroupProvenance, j as formatMessagesForObserver, k as buildObserverSystemPrompt, m as combineObservationGroupRanges, p as ObservationalMemory, v as renderObservationGroupsForReflection, x as ModelByInputTokens, y as stripObservationGroups, z as OBSERVATIONAL_MEMORY_DEFAULTS } from "../src-
|
|
1
|
+
import { A as extractCurrentTask, B as OBSERVATION_CONTEXT_INSTRUCTIONS, C as WorkingMemoryExtractor, D as OBSERVER_SYSTEM_PROMPT, E as TokenCounter, F as injectAnchorIds, H as OBSERVATION_CONTINUATION_HINT, I as parseAnchorId, L as stripEphemeralAnchorIds, M as hasCurrentTaskSection, N as optimizeObservationsForContext, O as buildObserverPrompt, P as parseObserverOutput, R as Extractor, T as summarizeConversation, V as OBSERVATION_CONTEXT_PROMPT, _ as reconcileObservationGroupsFromReflection, b as wrapInObservationGroup, d as getObservationsAsOf, f as ObservationalMemoryProcessor, g as parseObservationGroups, h as deriveObservationGroupProvenance, j as formatMessagesForObserver, k as buildObserverSystemPrompt, m as combineObservationGroupRanges, p as ObservationalMemory, v as renderObservationGroupsForReflection, x as ModelByInputTokens, y as stripObservationGroups, z as OBSERVATIONAL_MEMORY_DEFAULTS } from "../src-DGdlH4fo.js";
|
|
2
2
|
export { Extractor, ModelByInputTokens, OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, TokenCounter, WorkingMemoryExtractor, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, stripEphemeralAnchorIds, stripObservationGroups, summarizeConversation, wrapInObservationGroup };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-buffer.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/observation-strategies/async-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAc1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAExF,qBAAa,8BAA+B,SAAQ,mBAAmB;IACrE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,oBAAoB,CAAC,CAA0B;gBAE3C,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,kBAAkB;IAMxD,IAAI,SAAS,YAEZ;IACD,IAAI,eAAe,YAElB;IACD,IAAI,gBAAgB,YAEnB;cAEkB,eAAe,IAAI,MAAM;IAItC,OAAO;;;;IAQP,gBAAgB,CAAC,QAAQ,EAAE,MAAM;IAIjC,OAAO,CAAC,oBAAoB,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"async-buffer.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/observation-strategies/async-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAc1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAExF,qBAAa,8BAA+B,SAAQ,mBAAmB;IACrE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,oBAAoB,CAAC,CAA0B;gBAE3C,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,kBAAkB;IAMxD,IAAI,SAAS,YAEZ;IACD,IAAI,eAAe,YAElB;IACD,IAAI,gBAAgB,YAEnB;cAEkB,eAAe,IAAI,MAAM;IAItC,OAAO;;;;IAQP,gBAAgB,CAAC,QAAQ,EAAE,MAAM;IAIjC,OAAO,CAAC,oBAAoB,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE;;;;;;;;;uBAqJpD,CAAC;wBAAsB,CAAC;uBAAqB,CAAC;;;;IApH3D,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA6C7F,OAAO,CAAC,SAAS,EAAE,oBAAoB;IAkEvC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,oBAAoB;IA6BhE,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAkBzD"}
|
|
@@ -21433,7 +21433,7 @@ var SyncObservationStrategy = class extends ObservationStrategy {
|
|
|
21433
21433
|
},
|
|
21434
21434
|
lastObservedMessageCursor: getLastObservedMessageCursor(messages)
|
|
21435
21435
|
});
|
|
21436
|
-
await this.storage.
|
|
21436
|
+
await this.storage.patchThread({
|
|
21437
21437
|
id: threadId,
|
|
21438
21438
|
...shouldUpdateThreadTitle ? { title: newTitle } : {},
|
|
21439
21439
|
metadata: newMetadata
|
|
@@ -21625,7 +21625,7 @@ var AsyncBufferObservationStrategy = class extends ObservationStrategy {
|
|
|
21625
21625
|
...metadataUpdate.extracted ?? {}
|
|
21626
21626
|
}
|
|
21627
21627
|
});
|
|
21628
|
-
await this.storage.
|
|
21628
|
+
await this.storage.patchThread({
|
|
21629
21629
|
id: threadId,
|
|
21630
21630
|
...shouldUpdateThreadTitle ? { title: newTitle } : {},
|
|
21631
21631
|
metadata: newMetadata
|
|
@@ -21970,7 +21970,7 @@ var ResourceScopedObservationStrategy = class extends ObservationStrategy {
|
|
|
21970
21970
|
},
|
|
21971
21971
|
lastObservedMessageCursor: update.lastObservedMessageCursor
|
|
21972
21972
|
});
|
|
21973
|
-
await this.storage.
|
|
21973
|
+
await this.storage.patchThread({
|
|
21974
21974
|
id: update.threadId,
|
|
21975
21975
|
...shouldUpdateThreadTitle ? { title: newTitle } : {},
|
|
21976
21976
|
metadata: newMetadata
|
|
@@ -22913,7 +22913,7 @@ async function persistThreadExtractedValues(storage, extractors, threadId, value
|
|
|
22913
22913
|
...metadataUpdate.extracted ?? {}
|
|
22914
22914
|
}
|
|
22915
22915
|
});
|
|
22916
|
-
await storage.
|
|
22916
|
+
await storage.patchThread({
|
|
22917
22917
|
id: threadId,
|
|
22918
22918
|
metadata: newMetadata
|
|
22919
22919
|
});
|
|
@@ -25884,7 +25884,7 @@ ${formattedMessages}
|
|
|
25884
25884
|
const oldTitle = thread.title?.trim();
|
|
25885
25885
|
const newTitle = chunkThreadTitle?.trim();
|
|
25886
25886
|
const shouldUpdateThreadTitle = !!newTitle && newTitle.length >= 3 && newTitle !== oldTitle;
|
|
25887
|
-
await this.storage.
|
|
25887
|
+
await this.storage.patchThread({
|
|
25888
25888
|
id: threadId,
|
|
25889
25889
|
...shouldUpdateThreadTitle ? { title: newTitle } : {},
|
|
25890
25890
|
metadata: newMetadata
|
|
@@ -26102,7 +26102,7 @@ ${formattedMessages}
|
|
|
26102
26102
|
...metadataUpdate.extracted ?? {}
|
|
26103
26103
|
}
|
|
26104
26104
|
});
|
|
26105
|
-
await this.storage.
|
|
26105
|
+
await this.storage.patchThread({
|
|
26106
26106
|
id: threadId,
|
|
26107
26107
|
metadata: newMetadata
|
|
26108
26108
|
});
|
|
@@ -27156,7 +27156,7 @@ var Memory = class extends _mastra_core_memory.MastraMemory {
|
|
|
27156
27156
|
return savedThread;
|
|
27157
27157
|
}
|
|
27158
27158
|
async updateThread({ id, title, metadata, memoryConfig }) {
|
|
27159
|
-
const updatedThread = await (await this.getMemoryStore()).
|
|
27159
|
+
const updatedThread = await (await this.getMemoryStore()).patchThread({
|
|
27160
27160
|
id,
|
|
27161
27161
|
title,
|
|
27162
27162
|
metadata
|
|
@@ -27247,7 +27247,7 @@ var Memory = class extends _mastra_core_memory.MastraMemory {
|
|
|
27247
27247
|
else {
|
|
27248
27248
|
const thread = await this.getThreadById({ threadId });
|
|
27249
27249
|
if (!thread) throw new Error(`Thread ${threadId} not found`);
|
|
27250
|
-
await memoryStore.
|
|
27250
|
+
await memoryStore.patchThread({
|
|
27251
27251
|
id: threadId,
|
|
27252
27252
|
metadata: {
|
|
27253
27253
|
...thread.metadata,
|
|
@@ -27335,7 +27335,7 @@ ${workingMemory}`;
|
|
|
27335
27335
|
} else {
|
|
27336
27336
|
const thread = await this.getThreadById({ threadId });
|
|
27337
27337
|
if (!thread) throw new Error(`Thread ${threadId} not found`);
|
|
27338
|
-
await memoryStore.
|
|
27338
|
+
await memoryStore.patchThread({
|
|
27339
27339
|
id: threadId,
|
|
27340
27340
|
metadata: {
|
|
27341
27341
|
...thread.metadata,
|
|
@@ -28906,4 +28906,4 @@ Object.defineProperty(exports, "wrapInObservationGroup", {
|
|
|
28906
28906
|
}
|
|
28907
28907
|
});
|
|
28908
28908
|
|
|
28909
|
-
//# sourceMappingURL=src-
|
|
28909
|
+
//# sourceMappingURL=src-CTwoCwmY.cjs.map
|