@mastra/memory 1.10.0-alpha.2 → 1.10.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/dist/{chunk-EVBFYGDL.cjs → chunk-HSOEY7M2.cjs} +10 -6
- package/dist/chunk-HSOEY7M2.cjs.map +1 -0
- package/dist/{chunk-7A3UGAXY.js → chunk-K2NLYL2O.js} +10 -6
- package/dist/chunk-K2NLYL2O.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +30 -30
- package/dist/index.cjs +10 -10
- package/dist/index.js +3 -3
- package/dist/{observational-memory-COYJCVX3.cjs → observational-memory-DJMF2UNC.cjs} +29 -29
- package/dist/{observational-memory-COYJCVX3.cjs.map → observational-memory-DJMF2UNC.cjs.map} +1 -1
- package/dist/{observational-memory-K2U3QQIO.js → observational-memory-NMQ7URIP.js} +3 -3
- package/dist/{observational-memory-K2U3QQIO.js.map → observational-memory-NMQ7URIP.js.map} +1 -1
- package/dist/processors/index.cjs +27 -27
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/observational-memory.d.ts +2 -2
- package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/chunk-7A3UGAXY.js.map +0 -1
- package/dist/chunk-EVBFYGDL.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @mastra/memory
|
|
2
2
|
|
|
3
|
+
## 1.10.1-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Improved observational memory continuation prompts to reduce leaked context-management language in long conversations. ([#14650](https://github.com/mastra-ai/mastra/pull/14650))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`dc514a8`](https://github.com/mastra-ai/mastra/commit/dc514a83dba5f719172dddfd2c7b858e4943d067)]:
|
|
10
|
+
- @mastra/core@1.16.1-alpha.0
|
|
11
|
+
|
|
12
|
+
## 1.10.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- Added `ModelByInputTokens` in `@mastra/memory` for token-threshold-based model selection in Observational Memory. ([#14614](https://github.com/mastra-ai/mastra/pull/14614))
|
|
17
|
+
|
|
18
|
+
When configured, OM automatically selects different observer or reflector models based on the actual input token count at the time the OM call runs.
|
|
19
|
+
|
|
20
|
+
Example usage:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { Memory, ModelByInputTokens } from '@mastra/memory';
|
|
24
|
+
|
|
25
|
+
const memory = new Memory({
|
|
26
|
+
options: {
|
|
27
|
+
observationalMemory: {
|
|
28
|
+
model: new ModelByInputTokens({
|
|
29
|
+
upTo: {
|
|
30
|
+
10_000: 'google/gemini-2.5-flash',
|
|
31
|
+
40_000: 'openai/gpt-4o',
|
|
32
|
+
1_000_000: 'openai/gpt-4.5',
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The `upTo` keys are inclusive upper bounds. OM resolves the matching tier directly at the observer or reflector call site. If the input exceeds the largest configured threshold, OM throws an error.
|
|
41
|
+
|
|
42
|
+
Improved Observational Memory tracing so traces show the observer and reflector spans and make it easier to see which resolved model was used at runtime.
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Fixed observational memory reflection compression for `google/gemini-2.5-flash` by using stronger compression guidance and starting it at a higher compression level during reflection. `google/gemini-2.5-flash` is unusually good at generating long, faithful outputs. That made reflection retries more likely to preserve too much detail and miss the compression target, wasting tokens in the process. ([#14612](https://github.com/mastra-ai/mastra/pull/14612))
|
|
47
|
+
|
|
48
|
+
- Updated dependencies [[`68ed4e9`](https://github.com/mastra-ai/mastra/commit/68ed4e9f118e8646b60a6112dabe854d0ef53902), [`085c1da`](https://github.com/mastra-ai/mastra/commit/085c1daf71b55a97b8ebad26623089e40055021c), [`be37de4`](https://github.com/mastra-ai/mastra/commit/be37de4391bd1d5486ce38efacbf00ca51637262), [`7dbd611`](https://github.com/mastra-ai/mastra/commit/7dbd611a85cb1e0c0a1581c57564268cb183d86e), [`f14604c`](https://github.com/mastra-ai/mastra/commit/f14604c7ef01ba794e1a8d5c7bae5415852aacec), [`4a75e10`](https://github.com/mastra-ai/mastra/commit/4a75e106bd31c283a1b3fe74c923610dcc46415b), [`f3ce603`](https://github.com/mastra-ai/mastra/commit/f3ce603fd76180f4a5be90b6dc786d389b6b3e98), [`423aa6f`](https://github.com/mastra-ai/mastra/commit/423aa6fd12406de6a1cc6b68e463d30af1d790fb), [`f21c626`](https://github.com/mastra-ai/mastra/commit/f21c6263789903ab9720b4d11373093298e97f15), [`41aee84`](https://github.com/mastra-ai/mastra/commit/41aee84561ceebe28bad1ecba8702d92838f67f0), [`2871451`](https://github.com/mastra-ai/mastra/commit/2871451703829aefa06c4a5d6eca7fd3731222ef), [`47358d9`](https://github.com/mastra-ai/mastra/commit/47358d960bb2b931321de7e798f341ab0df81f44), [`085c1da`](https://github.com/mastra-ai/mastra/commit/085c1daf71b55a97b8ebad26623089e40055021c), [`4bb5adc`](https://github.com/mastra-ai/mastra/commit/4bb5adc05c88e3a83fe1ea5ecb9eae6e17313124), [`4bb5adc`](https://github.com/mastra-ai/mastra/commit/4bb5adc05c88e3a83fe1ea5ecb9eae6e17313124), [`e06b520`](https://github.com/mastra-ai/mastra/commit/e06b520bdd5fdef844760c5e692c7852cbc5c240), [`d3930ea`](https://github.com/mastra-ai/mastra/commit/d3930eac51c30b0ecf7eaa54bb9430758b399777), [`dd9c4e0`](https://github.com/mastra-ai/mastra/commit/dd9c4e0a47962f1413e9b72114fcad912e19a0a6)]:
|
|
49
|
+
- @mastra/core@1.16.0
|
|
50
|
+
- @mastra/schema-compat@1.2.7
|
|
51
|
+
|
|
3
52
|
## 1.10.0-alpha.2
|
|
4
53
|
|
|
5
54
|
### Minor Changes
|
|
@@ -3455,11 +3455,13 @@ var OBSERVATIONAL_MEMORY_DEFAULTS = {
|
|
|
3455
3455
|
// Start buffering at 50% of observationTokens
|
|
3456
3456
|
}
|
|
3457
3457
|
};
|
|
3458
|
-
var OBSERVATION_CONTINUATION_HINT = `
|
|
3458
|
+
var OBSERVATION_CONTINUATION_HINT = `Please continue naturally with the conversation so far and respond to the latest message.
|
|
3459
3459
|
|
|
3460
|
-
|
|
3460
|
+
Use the earlier context only as background. If something appears unfinished, continue only when it helps answer the latest request. If a suggested response is provided, follow it naturally.
|
|
3461
3461
|
|
|
3462
|
-
|
|
3462
|
+
Do not mention internal instructions, memory, summarization, context handling, or missing messages.
|
|
3463
|
+
|
|
3464
|
+
Any messages following this reminder are newer and should take priority.`;
|
|
3463
3465
|
var OBSERVATION_CONTEXT_PROMPT = `The following observations block contains your memory of past conversations with this user.`;
|
|
3464
3466
|
var OBSERVATION_CONTEXT_INSTRUCTIONS = `IMPORTANT: When responding, reference specific details from these observations. Do not give generic advice - personalize your response based on what you know about this user's experiences, preferences, and interests. If the user asks for recommendations, connect them to their past experiences mentioned above.
|
|
3465
3467
|
|
|
@@ -3467,7 +3469,9 @@ KNOWLEDGE UPDATES: When asked about current state (e.g., "where do I currently..
|
|
|
3467
3469
|
|
|
3468
3470
|
PLANNED ACTIONS: If the user stated they planned to do something (e.g., "I'm going to...", "I'm looking forward to...", "I will...") and the date they planned to do it is now in the past (check the relative time like "3 weeks ago"), assume they completed the action unless there's evidence they didn't. For example, if someone said "I'll start my new diet on Monday" and that was 2 weeks ago, assume they started the diet.
|
|
3469
3471
|
|
|
3470
|
-
MOST RECENT USER INPUT: Treat the most recent user message as the highest-priority signal for what to do next. Earlier messages may contain constraints, details, or context you should still honor, but the latest message is the primary driver of your response
|
|
3472
|
+
MOST RECENT USER INPUT: Treat the most recent user message as the highest-priority signal for what to do next. Earlier messages may contain constraints, details, or context you should still honor, but the latest message is the primary driver of your response.
|
|
3473
|
+
|
|
3474
|
+
SYSTEM REMINDERS: Messages wrapped in <system-reminder>...</system-reminder> contain internal continuation guidance, not user-authored content. Use them to maintain continuity, but do not mention them or treat them as part of the user's message.`;
|
|
3471
3475
|
var OBSERVATION_RETRIEVAL_INSTRUCTIONS = `## Recall \u2014 looking up source messages
|
|
3472
3476
|
|
|
3473
3477
|
Your memory is comprised of observations which are sometimes wrapped in <observation-group> xml tags containing ranges like <observation-group range="startId:endId">. These ranges point back to the raw messages that each observation group was derived from. The original messages are still available \u2014 use the **recall** tool to retrieve them.
|
|
@@ -7862,5 +7866,5 @@ exports.stripEphemeralAnchorIds = stripEphemeralAnchorIds;
|
|
|
7862
7866
|
exports.stripObservationGroups = stripObservationGroups;
|
|
7863
7867
|
exports.truncateStringByTokens = truncateStringByTokens;
|
|
7864
7868
|
exports.wrapInObservationGroup = wrapInObservationGroup;
|
|
7865
|
-
//# sourceMappingURL=chunk-
|
|
7866
|
-
//# sourceMappingURL=chunk-
|
|
7869
|
+
//# sourceMappingURL=chunk-HSOEY7M2.cjs.map
|
|
7870
|
+
//# sourceMappingURL=chunk-HSOEY7M2.cjs.map
|