@mastra/memory 1.41.3-alpha.1 → 1.41.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.
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +71 -71
- package/dist/docs/references/docs-memory-observational-memory.md +3 -3
- package/dist/docs/references/docs-memory-working-memory.md +33 -0
- package/dist/hooks.cjs +0 -2
- package/dist/hooks.js +0 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +26 -3
- package/dist/index.js +1 -1
- package/dist/processors/index.cjs +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/working-memory-instruction-compat.d.ts +54 -0
- package/dist/{src-CKA5LbDL.cjs → src-BC-wnTHt.cjs} +233 -41
- package/dist/{src-BvZXenIm.js → src-CRmfe-8x.js} +233 -41
- package/package.json +6 -5
- package/dist/hooks.cjs.map +0 -1
- package/dist/hooks.d.ts.map +0 -1
- package/dist/hooks.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/persistence-projection.test-utils.d.ts.map +0 -1
- package/dist/processors/index.d.ts.map +0 -1
- package/dist/processors/observational-memory/activation-ttl.d.ts.map +0 -1
- package/dist/processors/observational-memory/anchor-ids.d.ts.map +0 -1
- package/dist/processors/observational-memory/auto-model.d.ts.map +0 -1
- package/dist/processors/observational-memory/buffering-coordinator.d.ts.map +0 -1
- package/dist/processors/observational-memory/built-in-extractors.d.ts.map +0 -1
- package/dist/processors/observational-memory/commit-queue.d.ts.map +0 -1
- package/dist/processors/observational-memory/constants.d.ts.map +0 -1
- package/dist/processors/observational-memory/date-utils.d.ts.map +0 -1
- package/dist/processors/observational-memory/debug.d.ts.map +0 -1
- package/dist/processors/observational-memory/error.d.ts.map +0 -1
- package/dist/processors/observational-memory/extracted-values.d.ts.map +0 -1
- package/dist/processors/observational-memory/extraction-runner.d.ts.map +0 -1
- package/dist/processors/observational-memory/extractor.d.ts.map +0 -1
- package/dist/processors/observational-memory/hooks.d.ts.map +0 -1
- package/dist/processors/observational-memory/index.d.ts.map +0 -1
- package/dist/processors/observational-memory/internal-request-context.d.ts.map +0 -1
- package/dist/processors/observational-memory/markers.d.ts.map +0 -1
- package/dist/processors/observational-memory/measure-image-buffer.d.ts.map +0 -1
- package/dist/processors/observational-memory/message-utils.d.ts.map +0 -1
- package/dist/processors/observational-memory/model-by-input-tokens.d.ts.map +0 -1
- package/dist/processors/observational-memory/model-context.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-groups.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-strategies/base.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-strategies/index.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-strategies/resource-scoped.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-strategies/sync.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-strategies/thread-title.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-strategies/types.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-turn/index.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-turn/load-memory-context.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-turn/safe-buffer-prefix.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-turn/step.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-turn/turn.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-turn/types.d.ts.map +0 -1
- package/dist/processors/observational-memory/observation-utils.d.ts.map +0 -1
- package/dist/processors/observational-memory/observational-memory.d.ts.map +0 -1
- package/dist/processors/observational-memory/observer-agent.d.ts.map +0 -1
- package/dist/processors/observational-memory/observer-runner.d.ts.map +0 -1
- package/dist/processors/observational-memory/operation-registry.d.ts.map +0 -1
- package/dist/processors/observational-memory/processor.d.ts.map +0 -1
- package/dist/processors/observational-memory/record-lineage.d.ts.map +0 -1
- package/dist/processors/observational-memory/reflector-agent.d.ts.map +0 -1
- package/dist/processors/observational-memory/reflector-runner.d.ts.map +0 -1
- package/dist/processors/observational-memory/repro-capture.d.ts.map +0 -1
- package/dist/processors/observational-memory/retry.d.ts.map +0 -1
- package/dist/processors/observational-memory/string-utils.d.ts.map +0 -1
- package/dist/processors/observational-memory/summarize.d.ts.map +0 -1
- package/dist/processors/observational-memory/temporal-markers.d.ts.map +0 -1
- package/dist/processors/observational-memory/temporary-memory.d.ts.map +0 -1
- package/dist/processors/observational-memory/thresholds.d.ts.map +0 -1
- package/dist/processors/observational-memory/token-counter.d.ts.map +0 -1
- package/dist/processors/observational-memory/tool-argument-helpers.d.ts.map +0 -1
- package/dist/processors/observational-memory/tool-result-helpers.d.ts.map +0 -1
- package/dist/processors/observational-memory/tracing.d.ts.map +0 -1
- package/dist/processors/observational-memory/transform-hooks.d.ts.map +0 -1
- package/dist/processors/observational-memory/types.d.ts.map +0 -1
- package/dist/processors/observational-memory/wait-with-abort.d.ts.map +0 -1
- package/dist/processors/observational-memory/working-memory-extractor.d.ts.map +0 -1
- package/dist/processors/working-memory-state/index.d.ts.map +0 -1
- package/dist/processors/working-memory-state/processor.d.ts.map +0 -1
- package/dist/removed-subconscious.d.ts.map +0 -1
- package/dist/src-BvZXenIm.js.map +0 -1
- package/dist/src-CKA5LbDL.cjs.map +0 -1
- package/dist/system-reminders.d.ts.map +0 -1
- package/dist/tools/om-observations.d.ts.map +0 -1
- package/dist/tools/om-search-context.d.ts.map +0 -1
- package/dist/tools/om-tools.d.ts.map +0 -1
- package/dist/tools/working-memory.d.ts.map +0 -1
package/dist/docs/SKILL.md
CHANGED
|
@@ -1,243 +1,243 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.41.3-alpha.
|
|
2
|
+
"version": "1.41.3-alpha.2",
|
|
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-
|
|
8
|
-
"line":
|
|
7
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
8
|
+
"line": 32808
|
|
9
9
|
},
|
|
10
10
|
"Extractor": {
|
|
11
11
|
"types": "dist/processors/observational-memory/extractor.d.ts",
|
|
12
|
-
"implementation": "dist/src-
|
|
12
|
+
"implementation": "dist/src-CRmfe-8x.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-
|
|
18
|
-
"line":
|
|
17
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
18
|
+
"line": 32591
|
|
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-CRmfe-8x.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-CRmfe-8x.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-CRmfe-8x.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-CRmfe-8x.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-CRmfe-8x.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-CRmfe-8x.js",
|
|
48
48
|
"line": 26793
|
|
49
49
|
},
|
|
50
50
|
"ObservationalMemory": {
|
|
51
51
|
"types": "dist/processors/observational-memory/observational-memory.d.ts",
|
|
52
|
-
"implementation": "dist/src-
|
|
53
|
-
"line":
|
|
52
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
53
|
+
"line": 37616
|
|
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-CRmfe-8x.js",
|
|
58
|
+
"line": 40364
|
|
59
59
|
},
|
|
60
60
|
"TokenCounter": {
|
|
61
61
|
"types": "dist/processors/observational-memory/token-counter.d.ts",
|
|
62
|
-
"implementation": "dist/src-
|
|
62
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
63
63
|
"line": 29310
|
|
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-CRmfe-8x.js",
|
|
68
68
|
"line": 30329
|
|
69
69
|
},
|
|
70
70
|
"buildObserverPrompt": {
|
|
71
71
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
72
|
-
"implementation": "dist/src-
|
|
72
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
73
73
|
"line": 27477
|
|
74
74
|
},
|
|
75
75
|
"buildObserverSystemPrompt": {
|
|
76
76
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
77
|
-
"implementation": "dist/src-
|
|
77
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
78
78
|
"line": 26687
|
|
79
79
|
},
|
|
80
80
|
"combineObservationGroupRanges": {
|
|
81
81
|
"types": "dist/processors/observational-memory/observation-groups.d.ts",
|
|
82
|
-
"implementation": "dist/src-
|
|
83
|
-
"line":
|
|
82
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
83
|
+
"line": 30911
|
|
84
84
|
},
|
|
85
85
|
"deriveObservationGroupProvenance": {
|
|
86
86
|
"types": "dist/processors/observational-memory/observation-groups.d.ts",
|
|
87
|
-
"implementation": "dist/src-
|
|
88
|
-
"line":
|
|
87
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
88
|
+
"line": 30955
|
|
89
89
|
},
|
|
90
90
|
"extractCurrentTask": {
|
|
91
91
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
92
|
-
"implementation": "dist/src-
|
|
92
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
93
93
|
"line": 27790
|
|
94
94
|
},
|
|
95
95
|
"formatMessagesForObserver": {
|
|
96
96
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
97
|
-
"implementation": "dist/src-
|
|
97
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
98
98
|
"line": 27228
|
|
99
99
|
},
|
|
100
100
|
"getObservationContextPrompt": {
|
|
101
101
|
"types": "dist/processors/observational-memory/constants.d.ts",
|
|
102
|
-
"implementation": "dist/src-
|
|
102
|
+
"implementation": "dist/src-CRmfe-8x.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-CRmfe-8x.js",
|
|
108
|
+
"line": 40704
|
|
109
109
|
},
|
|
110
110
|
"hasCurrentTaskSection": {
|
|
111
111
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
112
|
-
"implementation": "dist/src-
|
|
112
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
113
113
|
"line": 27778
|
|
114
114
|
},
|
|
115
115
|
"injectAnchorIds": {
|
|
116
116
|
"types": "dist/processors/observational-memory/anchor-ids.d.ts",
|
|
117
|
-
"implementation": "dist/src-
|
|
117
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
118
118
|
"line": 25409
|
|
119
119
|
},
|
|
120
120
|
"optimizeObservationsForContext": {
|
|
121
121
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
122
|
-
"implementation": "dist/src-
|
|
122
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
123
123
|
"line": 27811
|
|
124
124
|
},
|
|
125
125
|
"parseAnchorId": {
|
|
126
126
|
"types": "dist/processors/observational-memory/anchor-ids.d.ts",
|
|
127
|
-
"implementation": "dist/src-
|
|
127
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
128
128
|
"line": 25393
|
|
129
129
|
},
|
|
130
130
|
"parseObservationGroups": {
|
|
131
131
|
"types": "dist/processors/observational-memory/observation-groups.d.ts",
|
|
132
|
-
"implementation": "dist/src-
|
|
133
|
-
"line":
|
|
132
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
133
|
+
"line": 30866
|
|
134
134
|
},
|
|
135
135
|
"parseObserverOutput": {
|
|
136
136
|
"types": "dist/processors/observational-memory/observer-agent.d.ts",
|
|
137
|
-
"implementation": "dist/src-
|
|
137
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
138
138
|
"line": 27488
|
|
139
139
|
},
|
|
140
140
|
"reconcileObservationGroupsFromReflection": {
|
|
141
141
|
"types": "dist/processors/observational-memory/observation-groups.d.ts",
|
|
142
|
-
"implementation": "dist/src-
|
|
143
|
-
"line":
|
|
142
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
143
|
+
"line": 30974
|
|
144
144
|
},
|
|
145
145
|
"renderObservationGroupsForReflection": {
|
|
146
146
|
"types": "dist/processors/observational-memory/observation-groups.d.ts",
|
|
147
|
-
"implementation": "dist/src-
|
|
148
|
-
"line":
|
|
147
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
148
|
+
"line": 30940
|
|
149
149
|
},
|
|
150
150
|
"resolveAutoModelId": {
|
|
151
151
|
"types": "dist/processors/observational-memory/auto-model.d.ts",
|
|
152
|
-
"implementation": "dist/src-
|
|
153
|
-
"line":
|
|
152
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
153
|
+
"line": 32828
|
|
154
154
|
},
|
|
155
155
|
"stripEphemeralAnchorIds": {
|
|
156
156
|
"types": "dist/processors/observational-memory/anchor-ids.d.ts",
|
|
157
|
-
"implementation": "dist/src-
|
|
157
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
158
158
|
"line": 25432
|
|
159
159
|
},
|
|
160
160
|
"stripObservationGroups": {
|
|
161
161
|
"types": "dist/processors/observational-memory/observation-groups.d.ts",
|
|
162
|
-
"implementation": "dist/src-
|
|
163
|
-
"line":
|
|
162
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
163
|
+
"line": 30883
|
|
164
164
|
},
|
|
165
165
|
"summarizeConversation": {
|
|
166
166
|
"types": "dist/processors/observational-memory/summarize.d.ts",
|
|
167
|
-
"implementation": "dist/src-
|
|
167
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
168
168
|
"line": 29941
|
|
169
169
|
},
|
|
170
170
|
"wrapInObservationGroup": {
|
|
171
171
|
"types": "dist/processors/observational-memory/observation-groups.d.ts",
|
|
172
|
-
"implementation": "dist/src-
|
|
173
|
-
"line":
|
|
172
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
173
|
+
"line": 30837
|
|
174
174
|
},
|
|
175
175
|
"KnowledgeSemanticIndexCoordinator": {
|
|
176
176
|
"types": "dist/removed-subconscious.d.ts",
|
|
177
|
-
"implementation": "dist/src-
|
|
178
|
-
"line":
|
|
177
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
178
|
+
"line": 30435
|
|
179
179
|
},
|
|
180
180
|
"Memory": {
|
|
181
181
|
"types": "dist/index.d.ts",
|
|
182
|
-
"implementation": "dist/src-
|
|
183
|
-
"line":
|
|
182
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
183
|
+
"line": 40935
|
|
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-CRmfe-8x.js",
|
|
188
188
|
"line": 29897
|
|
189
189
|
},
|
|
190
190
|
"StaleKnowledgeSemanticIndexError": {
|
|
191
191
|
"types": "dist/removed-subconscious.d.ts",
|
|
192
|
-
"implementation": "dist/src-
|
|
193
|
-
"line":
|
|
192
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
193
|
+
"line": 30441
|
|
194
194
|
},
|
|
195
195
|
"Subconscious": {
|
|
196
196
|
"types": "dist/removed-subconscious.d.ts",
|
|
197
|
-
"implementation": "dist/src-
|
|
198
|
-
"line":
|
|
197
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
198
|
+
"line": 30429
|
|
199
199
|
},
|
|
200
200
|
"WORKING_MEMORY_STATE_ID": {
|
|
201
201
|
"types": "dist/processors/working-memory-state/processor.d.ts",
|
|
202
|
-
"implementation": "dist/src-
|
|
203
|
-
"line":
|
|
202
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
203
|
+
"line": 32637
|
|
204
204
|
},
|
|
205
205
|
"WORKING_MEMORY_STATE_PROCESSOR_ID": {
|
|
206
206
|
"types": "dist/processors/working-memory-state/processor.d.ts",
|
|
207
|
-
"implementation": "dist/src-
|
|
208
|
-
"line":
|
|
207
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
208
|
+
"line": 32638
|
|
209
209
|
},
|
|
210
210
|
"WorkingMemoryStateProcessor": {
|
|
211
211
|
"types": "dist/processors/working-memory-state/processor.d.ts",
|
|
212
|
-
"implementation": "dist/src-
|
|
213
|
-
"line":
|
|
212
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
213
|
+
"line": 32639
|
|
214
214
|
},
|
|
215
215
|
"deepMergeWorkingMemory": {
|
|
216
216
|
"types": "dist/tools/working-memory.d.ts",
|
|
217
|
-
"implementation": "dist/src-
|
|
217
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
218
218
|
"line": 30020
|
|
219
219
|
},
|
|
220
220
|
"extractWorkingMemoryContent": {
|
|
221
221
|
"types": "dist/index.d.ts",
|
|
222
|
-
"implementation": "dist/src-
|
|
223
|
-
"line":
|
|
222
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
223
|
+
"line": 40769
|
|
224
224
|
},
|
|
225
225
|
"extractWorkingMemoryTags": {
|
|
226
226
|
"types": "dist/index.d.ts",
|
|
227
|
-
"implementation": "dist/src-
|
|
228
|
-
"line":
|
|
227
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
228
|
+
"line": 40737
|
|
229
229
|
},
|
|
230
230
|
"removeWorkingMemoryTags": {
|
|
231
231
|
"types": "dist/index.d.ts",
|
|
232
|
-
"implementation": "dist/src-
|
|
233
|
-
"line":
|
|
232
|
+
"implementation": "dist/src-CRmfe-8x.js",
|
|
233
|
+
"line": 40750
|
|
234
234
|
}
|
|
235
235
|
},
|
|
236
236
|
"modules": {
|
|
237
237
|
"processors": {
|
|
238
238
|
"index": "dist/processors/index.js",
|
|
239
239
|
"chunks": [
|
|
240
|
-
"src-
|
|
240
|
+
"src-CRmfe-8x.js"
|
|
241
241
|
]
|
|
242
242
|
}
|
|
243
243
|
}
|
|
@@ -148,11 +148,11 @@ A provider can reject a request for exceeding its context window before OM's est
|
|
|
148
148
|
|
|
149
149
|
### Gateway models
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
[Mastra Gateway](https://mastra.ai/docs/mastra-platform/gateway/overview) handles model access only. With a Gateway key (`msk-gateway-...` or `mskv2_...`), it doesn't store threads or observations, so OM runs locally against the storage adapter of the `Memory` you configured, the same as with any other model.
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
Keys that start with `msk_` belong to the previous Memory Gateway, which shuts down on December 31, 2026. With an `msk_` key, Mastra skips local OM for `mastra/` models. Memory Gateway runs OM server-side only when it serves the request with its own provider keys and memory is enabled for the project. Your storage adapter still gets the thread record, but not its messages or observations, so `memory.recall()` doesn't return those messages. See [Migrate from Mastra Memory Gateway](https://mastra.ai/docs/mastra-platform/gateway/migrate).
|
|
154
154
|
|
|
155
|
-
> **Warning:**
|
|
155
|
+
> **Warning:** If an `msk_` request uses your own provider key, or memory is disabled for the project, Memory Gateway proxies it without storing observations, while Mastra still skips local OM. Neither the gateway nor your storage adapter keeps the conversation. Move to a Gateway key or a directly configured provider model when the thread has to be stored.
|
|
156
156
|
|
|
157
157
|
## Choosing models
|
|
158
158
|
|
|
@@ -416,6 +416,39 @@ const response = await agent.generate('What do you know about me?', {
|
|
|
416
416
|
})
|
|
417
417
|
```
|
|
418
418
|
|
|
419
|
+
## Customize the working memory instruction
|
|
420
|
+
|
|
421
|
+
Agents receive working memory as a system instruction that tells the model when and how to call `updateWorkingMemory`. To change that text, extend `Memory` and override the method for the mode you use. The method receives the resolved template and the stored data, so the instruction can still include them:
|
|
422
|
+
|
|
423
|
+
```typescript
|
|
424
|
+
import { Memory } from '@mastra/memory'
|
|
425
|
+
import type { WorkingMemoryTemplate } from '@mastra/core/memory'
|
|
426
|
+
|
|
427
|
+
export class DurableFactsMemory extends Memory {
|
|
428
|
+
protected override getWorkingMemoryToolInstruction({
|
|
429
|
+
template,
|
|
430
|
+
data,
|
|
431
|
+
}: {
|
|
432
|
+
template: WorkingMemoryTemplate
|
|
433
|
+
data: string | null
|
|
434
|
+
}): string {
|
|
435
|
+
return `Call updateWorkingMemory only for lasting facts about the user, never for one-off task details.
|
|
436
|
+
|
|
437
|
+
<working_memory_template>
|
|
438
|
+
${typeof template.content === 'string' ? template.content : JSON.stringify(template.content)}
|
|
439
|
+
</working_memory_template>
|
|
440
|
+
|
|
441
|
+
<working_memory_data>
|
|
442
|
+
${data ?? 'No working memory data available.'}
|
|
443
|
+
</working_memory_data>`
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
Pass an instance of the subclass as the agent's `memory`. The other overridable methods are `getReadOnlyWorkingMemoryInstruction()` for `readOnly: true` or `agentManaged: false`, and `__experimental_getWorkingMemoryToolInstructionVNext()` for `version: 'vnext'` templates. A custom `MastraMemory` implementation can override `getWorkingMemoryInstruction()` instead, and return `undefined` to keep the built-in text. If you add a `WorkingMemory` processor to the agent yourself, pass `instructionProvider: memory` to it, or the overrides don't apply.
|
|
449
|
+
|
|
450
|
+
These overrides change the system instruction only. With `useStateSignals: true`, which Observational Memory's `manageWorkingMemory` turns on by default, working memory reaches the model as a state signal and the instruction methods aren't called.
|
|
451
|
+
|
|
419
452
|
## Opt in to state signals (experimental)
|
|
420
453
|
|
|
421
454
|
By default, working memory reaches the model as part of the system message. You can opt into delivering it as a [state signal](https://mastra.ai/docs/signals/state-signals) instead by setting `useStateSignals: true`:
|
package/dist/hooks.cjs
CHANGED
package/dist/hooks.js
CHANGED
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-BC-wnTHt.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.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type { ToolAction } from '@mastra/core/tools';
|
|
|
11
11
|
import type { ObservationalMemory, ObservationalMemoryConfig } from './processors/observational-memory/index.js';
|
|
12
12
|
import type { SummarizeConversationOptions, SummarizeConversationResult } from './processors/observational-memory/summarize.js';
|
|
13
13
|
import { TokenCounter } from './processors/observational-memory/token-counter.js';
|
|
14
|
+
import type { WorkingMemoryInstructionArgs } from './processors/working-memory-instruction-compat.js';
|
|
14
15
|
import { deepMergeWorkingMemory } from './tools/working-memory.js';
|
|
15
16
|
export { asUserTurn, escapeTurnMarkup, sealTurnMarkup } from '@mastra/core/memory';
|
|
16
17
|
export type { TurnSpeaker } from '@mastra/core/memory';
|
|
@@ -334,11 +335,16 @@ export declare class Memory extends MastraMemory {
|
|
|
334
335
|
*/
|
|
335
336
|
private _initOMEngine;
|
|
336
337
|
defaultWorkingMemoryTemplate: string;
|
|
337
|
-
|
|
338
|
+
private builtInWorkingMemoryToolInstruction;
|
|
339
|
+
private builtInWorkingMemoryToolInstructionVNext;
|
|
340
|
+
private builtInReadOnlyWorkingMemoryInstruction;
|
|
341
|
+
/** Instruction for agents that update working memory with the updateWorkingMemory tool. Override to customize it. */
|
|
342
|
+
protected getWorkingMemoryToolInstruction(args: {
|
|
338
343
|
template: WorkingMemoryTemplate;
|
|
339
344
|
data: string | null;
|
|
340
345
|
}): string;
|
|
341
|
-
|
|
346
|
+
/** Instruction for `version: 'vnext'` template working memory. Override to customize it. */
|
|
347
|
+
protected __experimental_getWorkingMemoryToolInstructionVNext(args: {
|
|
342
348
|
template: WorkingMemoryTemplate;
|
|
343
349
|
data: string | null;
|
|
344
350
|
}): string;
|
|
@@ -346,12 +352,24 @@ export declare class Memory extends MastraMemory {
|
|
|
346
352
|
* Generate read-only working memory instructions.
|
|
347
353
|
* This provides the working memory context without any tool update instructions.
|
|
348
354
|
* Used when memory is in readOnly mode, or with `autoUpdated` when the app updates it (agentManaged: false).
|
|
355
|
+
* Override to customize it.
|
|
349
356
|
*/
|
|
350
|
-
protected getReadOnlyWorkingMemoryInstruction(
|
|
357
|
+
protected getReadOnlyWorkingMemoryInstruction(args: {
|
|
351
358
|
template: WorkingMemoryTemplate;
|
|
352
359
|
data: string | null;
|
|
353
360
|
autoUpdated?: boolean;
|
|
354
361
|
}): string;
|
|
362
|
+
/**
|
|
363
|
+
* Renders the working memory instruction an agent receives, using the instruction methods above,
|
|
364
|
+
* so a subclass that overrides them changes what the model sees. Return `undefined` to use the
|
|
365
|
+
* built-in instruction, or an empty string to send none.
|
|
366
|
+
*/
|
|
367
|
+
getWorkingMemoryInstruction(args: WorkingMemoryInstructionArgs): string | undefined;
|
|
368
|
+
/**
|
|
369
|
+
* The built-in text, ignoring subclass overrides of the instruction methods. Used when
|
|
370
|
+
* getWorkingMemoryInstruction returns `undefined`, matching the agent processor's own fallback.
|
|
371
|
+
*/
|
|
372
|
+
private renderBuiltInWorkingMemoryInstruction;
|
|
355
373
|
private isVNextWorkingMemoryConfig;
|
|
356
374
|
private assertWorkingMemoryStateSignalsCompatibility;
|
|
357
375
|
private getObservationEmbeddingIndexName;
|
|
@@ -704,6 +722,11 @@ export declare class Memory extends MastraMemory {
|
|
|
704
722
|
* in the user's configured processors.
|
|
705
723
|
*/
|
|
706
724
|
private createOMProcessor;
|
|
725
|
+
/**
|
|
726
|
+
* Builds the WorkingMemory input processor for cores without an instruction provider, from the same
|
|
727
|
+
* config core's `MastraMemory.getInputProcessors()` uses for the processor it replaces.
|
|
728
|
+
*/
|
|
729
|
+
private createWorkingMemoryInstructionCompatProcessor;
|
|
707
730
|
/**
|
|
708
731
|
* Creates a WorkingMemoryStateProcessor when working memory is enabled and the
|
|
709
732
|
* `useStateSignals` opt-in is set. Returns null otherwise or if the processor
|
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-CRmfe-8x.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-BC-wnTHt.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-CRmfe-8x.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { MemoryConfigInternal, WorkingMemoryTemplate } from '@mastra/core/memory';
|
|
2
|
+
import type { ProcessInputArgs, ProcessInputResult, Processor } from '@mastra/core/processors';
|
|
3
|
+
import type { MemoryStorage } from '@mastra/core/storage';
|
|
4
|
+
/**
|
|
5
|
+
* Local copy of `WorkingMemoryInstructionArgs` from `@mastra/core/processors`. Importing it would put the name in
|
|
6
|
+
* the published declarations, and the peer range includes cores that don't export it, so consumers type-checking
|
|
7
|
+
* with `skipLibCheck: false` would get TS2305. Keep in sync with
|
|
8
|
+
* packages/core/src/processors/memory/working-memory.ts; type-tests/working-memory-instruction-args.test-d.ts
|
|
9
|
+
* fails if the two drift.
|
|
10
|
+
*/
|
|
11
|
+
export type WorkingMemoryInstructionArgs = {
|
|
12
|
+
kind: 'tool' | 'vnext';
|
|
13
|
+
template: WorkingMemoryTemplate;
|
|
14
|
+
data: string | null;
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'read-only';
|
|
17
|
+
template: WorkingMemoryTemplate;
|
|
18
|
+
data: string | null;
|
|
19
|
+
/** True when the app updates working memory (`agentManaged: false`), false for `readOnly`. */
|
|
20
|
+
autoUpdated: boolean;
|
|
21
|
+
};
|
|
22
|
+
export interface WorkingMemoryInstructionCompatOptions {
|
|
23
|
+
storage: MemoryStorage;
|
|
24
|
+
template?: WorkingMemoryTemplate;
|
|
25
|
+
scope?: 'thread' | 'resource';
|
|
26
|
+
useVNext: boolean;
|
|
27
|
+
readOnly?: boolean;
|
|
28
|
+
agentManaged?: boolean;
|
|
29
|
+
/** Used when neither `getWorkingMemoryTemplate` nor `template` gives a template. */
|
|
30
|
+
defaultTemplate: string;
|
|
31
|
+
getWorkingMemoryTemplate(args: {
|
|
32
|
+
memoryConfig?: MemoryConfigInternal;
|
|
33
|
+
}): Promise<WorkingMemoryTemplate | null>;
|
|
34
|
+
/** Renders the instruction using normalized `data: string | null`. An empty string adds no system message. */
|
|
35
|
+
renderInstruction(args: WorkingMemoryInstructionArgs): string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Stand-in for core's `WorkingMemory` input processor on `@mastra/core` versions whose processor renders its own
|
|
39
|
+
* built-in instruction text and has no instruction provider (every core before `getWorkingMemoryInstruction`
|
|
40
|
+
* was added to `MastraMemory`, including 1.86.0-alpha.1 through 1.86.0-alpha.5). `Memory.getInputProcessors()`
|
|
41
|
+
* swaps it in for the auto-created processor on those cores, so `Memory` subclass instruction overrides reach
|
|
42
|
+
* the model there too (#29752).
|
|
43
|
+
*
|
|
44
|
+
* Loading and caching match core's `WorkingMemory.processInput` exactly; only the instruction comes from the
|
|
45
|
+
* memory instance. Keep it in sync with packages/core/src/processors/memory/working-memory.ts.
|
|
46
|
+
*/
|
|
47
|
+
export declare class WorkingMemoryInstructionCompat implements Processor<'working-memory'> {
|
|
48
|
+
private readonly options;
|
|
49
|
+
readonly id = "working-memory";
|
|
50
|
+
readonly name = "WorkingMemory";
|
|
51
|
+
constructor(options: WorkingMemoryInstructionCompatOptions);
|
|
52
|
+
processInput(args: ProcessInputArgs): Promise<ProcessInputResult>;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=working-memory-instruction-compat.d.ts.map
|