@mastra/memory 1.42.0-alpha.4 → 1.42.0-alpha.6
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/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +54 -54
- package/dist/docs/references/docs-harness-background-tasks.md +8 -5
- 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/{src-CVekC2V9.js → src-BJGnRDOG.js} +4 -3
- package/dist/{src-DaOrkH_R.cjs → src-C7wq-aPe.cjs} +4 -3
- package/package.json +4 -4
package/dist/docs/SKILL.md
CHANGED
|
@@ -1,243 +1,243 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.42.0-alpha.
|
|
2
|
+
"version": "1.42.0-alpha.6",
|
|
3
3
|
"package": "@mastra/memory",
|
|
4
4
|
"exports": {
|
|
5
5
|
"AUTO_MODEL_BY_PROVIDER": {
|
|
6
6
|
"types": "dist/processors/observational-memory/auto-model.d.ts",
|
|
7
|
-
"implementation": "dist/src-
|
|
7
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
8
8
|
"line": 32963
|
|
9
9
|
},
|
|
10
10
|
"Extractor": {
|
|
11
11
|
"types": "dist/processors/observational-memory/extractor.d.ts",
|
|
12
|
-
"implementation": "dist/src-
|
|
12
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
13
13
|
"line": 24432
|
|
14
14
|
},
|
|
15
15
|
"ModelByInputTokens": {
|
|
16
16
|
"types": "dist/processors/observational-memory/model-by-input-tokens.d.ts",
|
|
17
|
-
"implementation": "dist/src-
|
|
17
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
18
18
|
"line": 32746
|
|
19
19
|
},
|
|
20
20
|
"OBSERVATIONAL_MEMORY_DEFAULTS": {
|
|
21
21
|
"types": "dist/processors/observational-memory/constants.d.ts",
|
|
22
|
-
"implementation": "dist/src-
|
|
22
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
23
23
|
"line": 24168
|
|
24
24
|
},
|
|
25
25
|
"OBSERVATION_CONTEXT_INSTRUCTIONS": {
|
|
26
26
|
"types": "dist/processors/observational-memory/constants.d.ts",
|
|
27
|
-
"implementation": "dist/src-
|
|
27
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
28
28
|
"line": 24229
|
|
29
29
|
},
|
|
30
30
|
"OBSERVATION_CONTEXT_PROMPT": {
|
|
31
31
|
"types": "dist/processors/observational-memory/constants.d.ts",
|
|
32
|
-
"implementation": "dist/src-
|
|
32
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
33
33
|
"line": 24211
|
|
34
34
|
},
|
|
35
35
|
"OBSERVATION_CONTEXT_PROMPT_THREAD": {
|
|
36
36
|
"types": "dist/processors/observational-memory/constants.d.ts",
|
|
37
|
-
"implementation": "dist/src-
|
|
37
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
38
38
|
"line": 24216
|
|
39
39
|
},
|
|
40
40
|
"OBSERVATION_CONTINUATION_HINT": {
|
|
41
41
|
"types": "dist/processors/observational-memory/constants.d.ts",
|
|
42
|
-
"implementation": "dist/src-
|
|
42
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
43
43
|
"line": 24198
|
|
44
44
|
},
|
|
45
45
|
"OBSERVER_SYSTEM_PROMPT": {
|
|
46
46
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
47
|
-
"implementation": "dist/src-
|
|
47
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
48
48
|
"line": 26898
|
|
49
49
|
},
|
|
50
50
|
"ObservationalMemory": {
|
|
51
51
|
"types": "dist/processors/observational-memory/observational-memory.d.ts",
|
|
52
|
-
"implementation": "dist/src-
|
|
52
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
53
53
|
"line": 38086
|
|
54
54
|
},
|
|
55
55
|
"ObservationalMemoryProcessor": {
|
|
56
56
|
"types": "dist/processors/observational-memory/processor.d.ts",
|
|
57
|
-
"implementation": "dist/src-
|
|
58
|
-
"line":
|
|
57
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
58
|
+
"line": 40967
|
|
59
59
|
},
|
|
60
60
|
"TokenCounter": {
|
|
61
61
|
"types": "dist/processors/observational-memory/token-counter.d.ts",
|
|
62
|
-
"implementation": "dist/src-
|
|
62
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
63
63
|
"line": 29428
|
|
64
64
|
},
|
|
65
65
|
"WorkingMemoryExtractor": {
|
|
66
66
|
"types": "dist/processors/observational-memory/working-memory-extractor.d.ts",
|
|
67
|
-
"implementation": "dist/src-
|
|
67
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
68
68
|
"line": 30484
|
|
69
69
|
},
|
|
70
70
|
"buildObserverPrompt": {
|
|
71
71
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
72
|
-
"implementation": "dist/src-
|
|
72
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
73
73
|
"line": 27580
|
|
74
74
|
},
|
|
75
75
|
"buildObserverSystemPrompt": {
|
|
76
76
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
77
|
-
"implementation": "dist/src-
|
|
77
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
78
78
|
"line": 26792
|
|
79
79
|
},
|
|
80
80
|
"combineObservationGroupRanges": {
|
|
81
81
|
"types": "dist/processors/observational-memory/observation-groups.d.ts",
|
|
82
|
-
"implementation": "dist/src-
|
|
82
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
83
83
|
"line": 31066
|
|
84
84
|
},
|
|
85
85
|
"deriveObservationGroupProvenance": {
|
|
86
86
|
"types": "dist/processors/observational-memory/observation-groups.d.ts",
|
|
87
|
-
"implementation": "dist/src-
|
|
87
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
88
88
|
"line": 31110
|
|
89
89
|
},
|
|
90
90
|
"extractCurrentTask": {
|
|
91
91
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
92
|
-
"implementation": "dist/src-
|
|
92
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
93
93
|
"line": 27893
|
|
94
94
|
},
|
|
95
95
|
"formatMessagesForObserver": {
|
|
96
96
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
97
|
-
"implementation": "dist/src-
|
|
97
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
98
98
|
"line": 27331
|
|
99
99
|
},
|
|
100
100
|
"getObservationContextPrompt": {
|
|
101
101
|
"types": "dist/processors/observational-memory/constants.d.ts",
|
|
102
|
-
"implementation": "dist/src-
|
|
102
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
103
103
|
"line": 24222
|
|
104
104
|
},
|
|
105
105
|
"getObservationsAsOf": {
|
|
106
106
|
"types": "dist/processors/observational-memory/observation-utils.d.ts",
|
|
107
|
-
"implementation": "dist/src-
|
|
108
|
-
"line":
|
|
107
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
108
|
+
"line": 41320
|
|
109
109
|
},
|
|
110
110
|
"hasCurrentTaskSection": {
|
|
111
111
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
112
|
-
"implementation": "dist/src-
|
|
112
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
113
113
|
"line": 27881
|
|
114
114
|
},
|
|
115
115
|
"injectAnchorIds": {
|
|
116
116
|
"types": "dist/processors/observational-memory/anchor-ids.d.ts",
|
|
117
|
-
"implementation": "dist/src-
|
|
117
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
118
118
|
"line": 25432
|
|
119
119
|
},
|
|
120
120
|
"optimizeObservationsForContext": {
|
|
121
121
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
122
|
-
"implementation": "dist/src-
|
|
122
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
123
123
|
"line": 27914
|
|
124
124
|
},
|
|
125
125
|
"parseAnchorId": {
|
|
126
126
|
"types": "dist/processors/observational-memory/anchor-ids.d.ts",
|
|
127
|
-
"implementation": "dist/src-
|
|
127
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
128
128
|
"line": 25416
|
|
129
129
|
},
|
|
130
130
|
"parseObservationGroups": {
|
|
131
131
|
"types": "dist/processors/observational-memory/observation-groups.d.ts",
|
|
132
|
-
"implementation": "dist/src-
|
|
132
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
133
133
|
"line": 31021
|
|
134
134
|
},
|
|
135
135
|
"parseObserverOutput": {
|
|
136
136
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
137
|
-
"implementation": "dist/src-
|
|
137
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
138
138
|
"line": 27591
|
|
139
139
|
},
|
|
140
140
|
"reconcileObservationGroupsFromReflection": {
|
|
141
141
|
"types": "dist/processors/observational-memory/observation-groups.d.ts",
|
|
142
|
-
"implementation": "dist/src-
|
|
142
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
143
143
|
"line": 31129
|
|
144
144
|
},
|
|
145
145
|
"renderObservationGroupsForReflection": {
|
|
146
146
|
"types": "dist/processors/observational-memory/observation-groups.d.ts",
|
|
147
|
-
"implementation": "dist/src-
|
|
147
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
148
148
|
"line": 31095
|
|
149
149
|
},
|
|
150
150
|
"resolveAutoModelId": {
|
|
151
151
|
"types": "dist/processors/observational-memory/auto-model.d.ts",
|
|
152
|
-
"implementation": "dist/src-
|
|
152
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
153
153
|
"line": 32983
|
|
154
154
|
},
|
|
155
155
|
"stripEphemeralAnchorIds": {
|
|
156
156
|
"types": "dist/processors/observational-memory/anchor-ids.d.ts",
|
|
157
|
-
"implementation": "dist/src-
|
|
157
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
158
158
|
"line": 25455
|
|
159
159
|
},
|
|
160
160
|
"stripObservationGroups": {
|
|
161
161
|
"types": "dist/processors/observational-memory/observation-groups.d.ts",
|
|
162
|
-
"implementation": "dist/src-
|
|
162
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
163
163
|
"line": 31038
|
|
164
164
|
},
|
|
165
165
|
"summarizeConversation": {
|
|
166
166
|
"types": "dist/processors/observational-memory/summarize.d.ts",
|
|
167
|
-
"implementation": "dist/src-
|
|
167
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
168
168
|
"line": 30096
|
|
169
169
|
},
|
|
170
170
|
"wrapInObservationGroup": {
|
|
171
171
|
"types": "dist/processors/observational-memory/observation-groups.d.ts",
|
|
172
|
-
"implementation": "dist/src-
|
|
172
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
173
173
|
"line": 30992
|
|
174
174
|
},
|
|
175
175
|
"KnowledgeSemanticIndexCoordinator": {
|
|
176
176
|
"types": "dist/removed-subconscious.d.ts",
|
|
177
|
-
"implementation": "dist/src-
|
|
177
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
178
178
|
"line": 30590
|
|
179
179
|
},
|
|
180
180
|
"Memory": {
|
|
181
181
|
"types": "dist/index.d.ts",
|
|
182
|
-
"implementation": "dist/src-
|
|
183
|
-
"line":
|
|
182
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
183
|
+
"line": 41572
|
|
184
184
|
},
|
|
185
185
|
"SUMMARIZE_THREAD_DEFAULTS": {
|
|
186
186
|
"types": "dist/processors/observational-memory/summarize.d.ts",
|
|
187
|
-
"implementation": "dist/src-
|
|
187
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
188
188
|
"line": 30052
|
|
189
189
|
},
|
|
190
190
|
"StaleKnowledgeSemanticIndexError": {
|
|
191
191
|
"types": "dist/removed-subconscious.d.ts",
|
|
192
|
-
"implementation": "dist/src-
|
|
192
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
193
193
|
"line": 30596
|
|
194
194
|
},
|
|
195
195
|
"Subconscious": {
|
|
196
196
|
"types": "dist/removed-subconscious.d.ts",
|
|
197
|
-
"implementation": "dist/src-
|
|
197
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
198
198
|
"line": 30584
|
|
199
199
|
},
|
|
200
200
|
"WORKING_MEMORY_STATE_ID": {
|
|
201
201
|
"types": "dist/processors/working-memory-state/processor.d.ts",
|
|
202
|
-
"implementation": "dist/src-
|
|
202
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
203
203
|
"line": 32792
|
|
204
204
|
},
|
|
205
205
|
"WORKING_MEMORY_STATE_PROCESSOR_ID": {
|
|
206
206
|
"types": "dist/processors/working-memory-state/processor.d.ts",
|
|
207
|
-
"implementation": "dist/src-
|
|
207
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
208
208
|
"line": 32793
|
|
209
209
|
},
|
|
210
210
|
"WorkingMemoryStateProcessor": {
|
|
211
211
|
"types": "dist/processors/working-memory-state/processor.d.ts",
|
|
212
|
-
"implementation": "dist/src-
|
|
212
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
213
213
|
"line": 32794
|
|
214
214
|
},
|
|
215
215
|
"deepMergeWorkingMemory": {
|
|
216
216
|
"types": "dist/tools/working-memory.d.ts",
|
|
217
|
-
"implementation": "dist/src-
|
|
217
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
218
218
|
"line": 30175
|
|
219
219
|
},
|
|
220
220
|
"extractWorkingMemoryContent": {
|
|
221
221
|
"types": "dist/index.d.ts",
|
|
222
|
-
"implementation": "dist/src-
|
|
223
|
-
"line":
|
|
222
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
223
|
+
"line": 41385
|
|
224
224
|
},
|
|
225
225
|
"extractWorkingMemoryTags": {
|
|
226
226
|
"types": "dist/index.d.ts",
|
|
227
|
-
"implementation": "dist/src-
|
|
228
|
-
"line":
|
|
227
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
228
|
+
"line": 41353
|
|
229
229
|
},
|
|
230
230
|
"removeWorkingMemoryTags": {
|
|
231
231
|
"types": "dist/index.d.ts",
|
|
232
|
-
"implementation": "dist/src-
|
|
233
|
-
"line":
|
|
232
|
+
"implementation": "dist/src-BJGnRDOG.js",
|
|
233
|
+
"line": 41366
|
|
234
234
|
}
|
|
235
235
|
},
|
|
236
236
|
"modules": {
|
|
237
237
|
"processors": {
|
|
238
238
|
"index": "dist/processors/index.js",
|
|
239
239
|
"chunks": [
|
|
240
|
-
"src-
|
|
240
|
+
"src-BJGnRDOG.js"
|
|
241
241
|
]
|
|
242
242
|
}
|
|
243
243
|
}
|
|
@@ -335,12 +335,14 @@ Which layer to use depends on where consistency matters: subagent-level configur
|
|
|
335
335
|
|
|
336
336
|
A background task can pause itself mid-execution and wait for an external signal before continuing. This is useful for human approvals, webhooks, or any flow where the next step depends on data that arrives later.
|
|
337
337
|
|
|
338
|
-
A tool calls `suspend(data)` from inside its `execute
|
|
338
|
+
A tool calls `suspend(data)` from inside its `execute`. Once `execute` returns, Mastra:
|
|
339
339
|
|
|
340
|
-
- Persists `status: 'suspended'` and the `data` payload on the task record.
|
|
341
340
|
- Saves the workflow snapshot so the run survives process restarts.
|
|
342
|
-
-
|
|
341
|
+
- Persists `status: 'suspended'` and the `data` payload on the task record.
|
|
343
342
|
- Releases the concurrency slot so other tasks can run.
|
|
343
|
+
- Emits a `background-task-suspended` chunk on the manager stream.
|
|
344
|
+
|
|
345
|
+
The task is stored as `suspended` only after its snapshot is saved, so a task stored as `suspended` can always be resumed, even after a crash. Until then the task reads as `running`.
|
|
344
346
|
|
|
345
347
|
Resume the task with `mastra.backgroundTaskManager.resume(taskId, resumeData)`. The `resumeData` arrives in the tool's `execute` options on the resumed run, and the task transitions back to `running`.
|
|
346
348
|
|
|
@@ -557,7 +559,7 @@ Before a manager runs a task, it claims the task with a conditional write. The w
|
|
|
557
559
|
|
|
558
560
|
While the task runs, the owner renews the lease every `leaseDurationMs / 3`, with a minimum of one second. Each renewal is conditional on the task still being `running` under the same owner. The task's final writes, such as `completed`, `failed`, `timed_out`, or `suspended`, carry the same condition, so a manager that lost the task can't overwrite the result of the manager that replaced it.
|
|
559
561
|
|
|
560
|
-
The owner stops renewing when the task completes, fails, or suspends. On shutdown, the manager releases the leases it still holds, so other managers can recover those tasks without waiting for the lease to expire. A running task with `maxRetries: 0` can't run again, so shutdown fails it with `Worker process terminated before task completed`, the same ending as a crash, rather than cancelling it. A lease that isn't released, for example because the process crashed, expires on its own.
|
|
562
|
+
The owner stops renewing when the task completes, fails, or suspends. On shutdown, the manager releases the leases it still holds, so other managers can recover those tasks without waiting for the lease to expire. A running task with `maxRetries: 0` can't run again, so shutdown fails it with `Worker process terminated before task completed`, the same ending as a crash, rather than cancelling it. A task whose tool already called `suspend()` is kept instead, so its snapshot can still be saved. Once the tool returns or stops on the abort signal, Mastra saves the snapshot and stores the task as `suspended`, so it can be answered after the restart. If the tool is still running when shutdown ends, nothing is saved and the task is recovered as if its worker crashed. Stale-task recovery uses a retry if one is left and fails the task otherwise, while a redelivered dispatch can run it again even with `maxRetries: 0`. See [Recover a task from a dead owner](#recover-a-task-from-a-dead-owner). A lease that isn't released, for example because the process crashed, expires on its own.
|
|
561
563
|
|
|
562
564
|
### Recover a task from a dead owner
|
|
563
565
|
|
|
@@ -565,6 +567,7 @@ A manager treats a `running` task as abandoned only after its lease expires.
|
|
|
565
567
|
|
|
566
568
|
When `recoverStaleTasksOnStart` is `true`, the default, each manager that runs tasks scans for abandoned tasks on startup. If the scan finds a lease that hasn't expired yet, the manager scans again shortly after that lease expires, and repeats until no live lease is left. After startup, the manager also checks for running tasks with an expired lease every `leaseDurationMs`, so a task whose worker dies later is recovered without a restart. Each check reads up to `globalConcurrency` running tasks (at least 100, at most 1,000), which normally covers all of them, so the task is recovered within about one `leaseDurationMs` after its lease expires. When more tasks are running than that, for example because other servers use a higher `globalConcurrency`, each further page of running tasks adds one `leaseDurationMs`. For each task the scan recovers:
|
|
567
569
|
|
|
570
|
+
- If the task's snapshot already holds a suspension from its current attempt, the task is stored as `suspended` without using a retry, and you can answer it with `resume()`.
|
|
568
571
|
- If the task's worker shut down gracefully, it returns to `pending` and is dispatched again without using a retry.
|
|
569
572
|
- If the worker died and the task's `retryCount` is below `maxRetries`, it uses a retry, returns to `pending`, and is dispatched again.
|
|
570
573
|
- Otherwise, it fails with `Worker process terminated before task completed`. The failure fires `task.failed` and `onTaskFailed` like any other failure.
|
|
@@ -573,7 +576,7 @@ Only a crash counts against `maxRetries`, so a task that keeps taking its worker
|
|
|
573
576
|
|
|
574
577
|
The recovery write is conditional on the owner and lease that the scan read, so only one manager recovers each task.
|
|
575
578
|
|
|
576
|
-
If the pubsub redelivers the unacknowledged dispatch of an abandoned task, the redelivery claims the task once its lease expires and runs it again, even when `maxRetries` is `0`.
|
|
579
|
+
If the pubsub redelivers the unacknowledged dispatch of an abandoned task, the redelivery claims the task once its lease expires and runs it again, even when `maxRetries` is `0`. If the task's snapshot already holds a suspension from its current attempt, the redelivery stores the task as `suspended` instead of running it again.
|
|
577
580
|
|
|
578
581
|
The manager that runs the recovered task needs an executor for it. See the known limitations under [non-agent owners](#non-agent-owners).
|
|
579
582
|
|
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-C7wq-aPe.cjs");
|
|
3
3
|
let _mastra_core_processors = require("@mastra/core/processors");
|
|
4
4
|
let _mastra_core_memory = require("@mastra/core/memory");
|
|
5
5
|
exports.AUTO_MODEL_BY_PROVIDER = require_src.AUTO_MODEL_BY_PROVIDER;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { m as AUTO_MODEL_BY_PROVIDER, K as Extractor, D as KnowledgeSemanticIndexCoordinator, t as Memory, n as MessageHistory, y as ModelByInputTokens, M as SUMMARIZE_THREAD_DEFAULTS, r as SemanticRecall, O as StaleKnowledgeSemanticIndexError, k as Subconscious, g as WORKING_MEMORY_STATE_ID, _ as WORKING_MEMORY_STATE_PROCESSOR_ID, i as WorkingMemory, A as WorkingMemoryExtractor, v as WorkingMemoryStateProcessor, a as asUserTurn, j as deepMergeWorkingMemory, o as escapeTurnMarkup, s as extractWorkingMemoryContent, c as extractWorkingMemoryTags, d as getObservationsAsOf, l as removeWorkingMemoryTags, h as resolveAutoModelId, u as sealTurnMarkup, N as summarizeConversation } from "./src-
|
|
1
|
+
export { m as AUTO_MODEL_BY_PROVIDER, K as Extractor, D as KnowledgeSemanticIndexCoordinator, t as Memory, n as MessageHistory, y as ModelByInputTokens, M as SUMMARIZE_THREAD_DEFAULTS, r as SemanticRecall, O as StaleKnowledgeSemanticIndexError, k as Subconscious, g as WORKING_MEMORY_STATE_ID, _ as WORKING_MEMORY_STATE_PROCESSOR_ID, i as WorkingMemory, A as WorkingMemoryExtractor, v as WorkingMemoryStateProcessor, a as asUserTurn, j as deepMergeWorkingMemory, o as escapeTurnMarkup, s as extractWorkingMemoryContent, c as extractWorkingMemoryTags, d as getObservationsAsOf, l as removeWorkingMemoryTags, h as resolveAutoModelId, u as sealTurnMarkup, N as summarizeConversation } from "./src-BJGnRDOG.js";
|
|
@@ -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-C7wq-aPe.cjs");
|
|
3
3
|
exports.AUTO_MODEL_BY_PROVIDER = require_src.AUTO_MODEL_BY_PROVIDER;
|
|
4
4
|
exports.Extractor = require_src.Extractor;
|
|
5
5
|
exports.ModelByInputTokens = require_src.ModelByInputTokens;
|
package/dist/processors/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { m as AUTO_MODEL_BY_PROVIDER, K as Extractor, y as ModelByInputTokens, q as OBSERVATIONAL_MEMORY_DEFAULTS, J as OBSERVATION_CONTEXT_INSTRUCTIONS, Y as OBSERVATION_CONTEXT_PROMPT, X as OBSERVATION_CONTEXT_PROMPT_THREAD, Z as OBSERVATION_CONTINUATION_HINT, F as OBSERVER_SYSTEM_PROMPT, p as ObservationalMemory, f as ObservationalMemoryProcessor, P as TokenCounter, A as WorkingMemoryExtractor, I as buildObserverPrompt, L as buildObserverSystemPrompt, b as combineObservationGroupRanges, x as deriveObservationGroupProvenance, R as extractCurrentTask, z as formatMessagesForObserver, Q as getObservationContextPrompt, d as getObservationsAsOf, B as hasCurrentTaskSection, U as injectAnchorIds, V as optimizeObservationsForContext, W as parseAnchorId, S as parseObservationGroups, H as parseObserverOutput, C as reconcileObservationGroupsFromReflection, w as renderObservationGroupsForReflection, h as resolveAutoModelId, G as stripEphemeralAnchorIds, T as stripObservationGroups, N as summarizeConversation, E as wrapInObservationGroup } from "../src-
|
|
1
|
+
export { m as AUTO_MODEL_BY_PROVIDER, K as Extractor, y as ModelByInputTokens, q as OBSERVATIONAL_MEMORY_DEFAULTS, J as OBSERVATION_CONTEXT_INSTRUCTIONS, Y as OBSERVATION_CONTEXT_PROMPT, X as OBSERVATION_CONTEXT_PROMPT_THREAD, Z as OBSERVATION_CONTINUATION_HINT, F as OBSERVER_SYSTEM_PROMPT, p as ObservationalMemory, f as ObservationalMemoryProcessor, P as TokenCounter, A as WorkingMemoryExtractor, I as buildObserverPrompt, L as buildObserverSystemPrompt, b as combineObservationGroupRanges, x as deriveObservationGroupProvenance, R as extractCurrentTask, z as formatMessagesForObserver, Q as getObservationContextPrompt, d as getObservationsAsOf, B as hasCurrentTaskSection, U as injectAnchorIds, V as optimizeObservationsForContext, W as parseAnchorId, S as parseObservationGroups, H as parseObserverOutput, C as reconcileObservationGroupsFromReflection, w as renderObservationGroupsForReflection, h as resolveAutoModelId, G as stripEphemeralAnchorIds, T as stripObservationGroups, N as summarizeConversation, E as wrapInObservationGroup } from "../src-BJGnRDOG.js";
|
|
@@ -40040,15 +40040,16 @@ ${formattedMessages}
|
|
|
40040
40040
|
transient: true
|
|
40041
40041
|
}).catch(() => {});
|
|
40042
40042
|
let chunkRecorded = false;
|
|
40043
|
+
const bufferedBoundary = Math.max(currentTokens, newTokens);
|
|
40043
40044
|
const recordBufferedChunk = async () => {
|
|
40044
40045
|
if (chunkRecorded) return;
|
|
40045
40046
|
chunkRecorded = true;
|
|
40046
40047
|
const ownsBoundary = BufferingCoordinator.ownsObservationBoundary(bufferKey, boundaryOwner);
|
|
40047
|
-
if (ownsBoundary) BufferingCoordinator.setObservationBoundary(bufferKey,
|
|
40048
|
-
await runOMCommit(lockKey, () => this.storage.setBufferingObservationFlag(record.id, false, ownsBoundary ?
|
|
40048
|
+
if (ownsBoundary) BufferingCoordinator.setObservationBoundary(bufferKey, bufferedBoundary, boundaryOwner);
|
|
40049
|
+
await runOMCommit(lockKey, () => this.storage.setBufferingObservationFlag(record.id, false, ownsBoundary ? bufferedBoundary : void 0)).catch(() => {});
|
|
40049
40050
|
flagCleared = true;
|
|
40050
40051
|
const stillOwnsBoundary = ownsBoundary && BufferingCoordinator.ownsObservationBoundary(bufferKey, boundaryOwner);
|
|
40051
|
-
setBufferingState(false, stillOwnsBoundary ?
|
|
40052
|
+
setBufferingState(false, stillOwnsBoundary ? bufferedBoundary : void 0);
|
|
40052
40053
|
const maxTimestamp = this.getMaxMessageTimestamp(candidateMessages);
|
|
40053
40054
|
BufferingCoordinator.lastBufferedAtTime.set(bufferKey, new Date(maxTimestamp.getTime() + 1));
|
|
40054
40055
|
releaseChunkWrite();
|
|
@@ -40062,15 +40062,16 @@ ${formattedMessages}
|
|
|
40062
40062
|
transient: true
|
|
40063
40063
|
}).catch(() => {});
|
|
40064
40064
|
let chunkRecorded = false;
|
|
40065
|
+
const bufferedBoundary = Math.max(currentTokens, newTokens);
|
|
40065
40066
|
const recordBufferedChunk = async () => {
|
|
40066
40067
|
if (chunkRecorded) return;
|
|
40067
40068
|
chunkRecorded = true;
|
|
40068
40069
|
const ownsBoundary = BufferingCoordinator.ownsObservationBoundary(bufferKey, boundaryOwner);
|
|
40069
|
-
if (ownsBoundary) BufferingCoordinator.setObservationBoundary(bufferKey,
|
|
40070
|
-
await runOMCommit(lockKey, () => this.storage.setBufferingObservationFlag(record.id, false, ownsBoundary ?
|
|
40070
|
+
if (ownsBoundary) BufferingCoordinator.setObservationBoundary(bufferKey, bufferedBoundary, boundaryOwner);
|
|
40071
|
+
await runOMCommit(lockKey, () => this.storage.setBufferingObservationFlag(record.id, false, ownsBoundary ? bufferedBoundary : void 0)).catch(() => {});
|
|
40071
40072
|
flagCleared = true;
|
|
40072
40073
|
const stillOwnsBoundary = ownsBoundary && BufferingCoordinator.ownsObservationBoundary(bufferKey, boundaryOwner);
|
|
40073
|
-
setBufferingState(false, stillOwnsBoundary ?
|
|
40074
|
+
setBufferingState(false, stillOwnsBoundary ? bufferedBoundary : void 0);
|
|
40074
40075
|
const maxTimestamp = this.getMaxMessageTimestamp(candidateMessages);
|
|
40075
40076
|
BufferingCoordinator.lastBufferedAtTime.set(bufferKey, new Date(maxTimestamp.getTime() + 1));
|
|
40076
40077
|
releaseChunkWrite();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/memory",
|
|
3
|
-
"version": "1.42.0-alpha.
|
|
3
|
+
"version": "1.42.0-alpha.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"probe-image-size": "^7.4.0",
|
|
54
54
|
"xxhash-wasm": "^1.1.0",
|
|
55
55
|
"zod": "^4.6.7",
|
|
56
|
-
"@mastra/schema-compat": "1.4.
|
|
56
|
+
"@mastra/schema-compat": "1.4.2-alpha.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@ai-sdk/openai-v5": "npm:@ai-sdk/openai@2.0.139",
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"typescript": "^6.0.3",
|
|
69
69
|
"vitest": "5.1.0",
|
|
70
70
|
"@internal/ai-sdk-v4": "0.0.99",
|
|
71
|
-
"@internal/ai-sdk-v5": "0.0.99",
|
|
72
71
|
"@internal/ai-v6": "0.0.99",
|
|
73
72
|
"@internal/ai-v7": "0.0.99",
|
|
74
73
|
"@internal/lint": "0.0.152",
|
|
75
74
|
"@internal/types-builder": "0.0.127",
|
|
76
|
-
"@mastra/core": "1.87.0-alpha.
|
|
75
|
+
"@mastra/core": "1.87.0-alpha.19",
|
|
76
|
+
"@internal/ai-sdk-v5": "0.0.99"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"@mastra/core": ">=1.85.1-0 <2.0.0-0"
|