@mastra/memory 1.20.1 → 1.20.2-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.
Files changed (56) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/chunk-43FJOLKM.cjs +108 -0
  3. package/dist/chunk-43FJOLKM.cjs.map +1 -0
  4. package/dist/{chunk-3Q3LOVQP.cjs → chunk-D4J4XPGM.cjs} +2 -9
  5. package/dist/chunk-D4J4XPGM.cjs.map +1 -0
  6. package/dist/{chunk-VKRZ3O5X.js → chunk-LSJJAJAF.js} +3 -9
  7. package/dist/chunk-LSJJAJAF.js.map +1 -0
  8. package/dist/{chunk-P4BYW7GY.cjs → chunk-PTCSCRB6.cjs} +27 -27
  9. package/dist/{chunk-P4BYW7GY.cjs.map → chunk-PTCSCRB6.cjs.map} +1 -1
  10. package/dist/chunk-PZ5AY32C.js +9 -0
  11. package/dist/chunk-PZ5AY32C.js.map +1 -0
  12. package/dist/chunk-Q7SFCCGT.cjs +11 -0
  13. package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
  14. package/dist/{chunk-KMJQDCCZ.js → chunk-SXFOZU7K.js} +3 -3
  15. package/dist/{chunk-KMJQDCCZ.js.map → chunk-SXFOZU7K.js.map} +1 -1
  16. package/dist/chunk-WCGXQIEN.js +103 -0
  17. package/dist/chunk-WCGXQIEN.js.map +1 -0
  18. package/dist/constants-DVRTNEGY.js +3 -0
  19. package/dist/{constants-SPS7MR4D.js.map → constants-DVRTNEGY.js.map} +1 -1
  20. package/dist/{constants-D6W7OWCP.cjs → constants-JS5SS7GS.cjs} +8 -8
  21. package/dist/{constants-D6W7OWCP.cjs.map → constants-JS5SS7GS.cjs.map} +1 -1
  22. package/dist/docs/SKILL.md +1 -1
  23. package/dist/docs/assets/SOURCE_MAP.json +43 -30
  24. package/dist/docs/references/docs-memory-multi-user-threads.md +1 -1
  25. package/dist/docs/references/docs-memory-working-memory.md +27 -0
  26. package/dist/docs/references/reference-storage-libsql.md +6 -0
  27. package/dist/docs/references/reference-storage-mongodb.md +3 -0
  28. package/dist/docs/references/reference-storage-postgresql.md +3 -0
  29. package/dist/index.cjs +222 -98
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.ts +8 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +184 -72
  34. package/dist/index.js.map +1 -1
  35. package/dist/{observational-memory-TJFOX3YN.js → observational-memory-G52HNRHE.js} +4 -4
  36. package/dist/{observational-memory-TJFOX3YN.js.map → observational-memory-G52HNRHE.js.map} +1 -1
  37. package/dist/{observational-memory-CDLGZL67.cjs → observational-memory-SZF7GKTS.cjs} +31 -31
  38. package/dist/{observational-memory-CDLGZL67.cjs.map → observational-memory-SZF7GKTS.cjs.map} +1 -1
  39. package/dist/processors/index.cjs +29 -29
  40. package/dist/processors/index.js +2 -2
  41. package/dist/processors/observational-memory/index.d.ts +1 -1
  42. package/dist/processors/observational-memory/index.d.ts.map +1 -1
  43. package/dist/processors/working-memory-state/index.d.ts +2 -0
  44. package/dist/processors/working-memory-state/index.d.ts.map +1 -0
  45. package/dist/processors/working-memory-state/processor.d.ts +53 -0
  46. package/dist/processors/working-memory-state/processor.d.ts.map +1 -0
  47. package/dist/tools/working-memory.d.ts +22 -0
  48. package/dist/tools/working-memory.d.ts.map +1 -1
  49. package/dist/working-memory-state-J7ASTNXX.js +3 -0
  50. package/dist/working-memory-state-J7ASTNXX.js.map +1 -0
  51. package/dist/working-memory-state-Y2SCKCNU.cjs +24 -0
  52. package/dist/working-memory-state-Y2SCKCNU.cjs.map +1 -0
  53. package/package.json +3 -2
  54. package/dist/chunk-3Q3LOVQP.cjs.map +0 -1
  55. package/dist/chunk-VKRZ3O5X.js.map +0 -1
  56. package/dist/constants-SPS7MR4D.js +0 -3
@@ -1,4 +1,4 @@
1
- export { ModelByInputTokens, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, stripEphemeralAnchorIds, stripObservationGroups, wrapInObservationGroup } from './chunk-KMJQDCCZ.js';
2
- export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT } from './chunk-VKRZ3O5X.js';
3
- //# sourceMappingURL=observational-memory-TJFOX3YN.js.map
4
- //# sourceMappingURL=observational-memory-TJFOX3YN.js.map
1
+ export { ModelByInputTokens, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, stripEphemeralAnchorIds, stripObservationGroups, wrapInObservationGroup } from './chunk-SXFOZU7K.js';
2
+ export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT } from './chunk-LSJJAJAF.js';
3
+ //# sourceMappingURL=observational-memory-G52HNRHE.js.map
4
+ //# sourceMappingURL=observational-memory-G52HNRHE.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"observational-memory-TJFOX3YN.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"observational-memory-G52HNRHE.js"}
@@ -1,117 +1,117 @@
1
1
  'use strict';
2
2
 
3
- var chunkP4BYW7GY_cjs = require('./chunk-P4BYW7GY.cjs');
4
- var chunk3Q3LOVQP_cjs = require('./chunk-3Q3LOVQP.cjs');
3
+ var chunkPTCSCRB6_cjs = require('./chunk-PTCSCRB6.cjs');
4
+ var chunkD4J4XPGM_cjs = require('./chunk-D4J4XPGM.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "ModelByInputTokens", {
9
9
  enumerable: true,
10
- get: function () { return chunkP4BYW7GY_cjs.ModelByInputTokens; }
10
+ get: function () { return chunkPTCSCRB6_cjs.ModelByInputTokens; }
11
11
  });
12
12
  Object.defineProperty(exports, "OBSERVER_SYSTEM_PROMPT", {
13
13
  enumerable: true,
14
- get: function () { return chunkP4BYW7GY_cjs.OBSERVER_SYSTEM_PROMPT; }
14
+ get: function () { return chunkPTCSCRB6_cjs.OBSERVER_SYSTEM_PROMPT; }
15
15
  });
16
16
  Object.defineProperty(exports, "ObservationalMemory", {
17
17
  enumerable: true,
18
- get: function () { return chunkP4BYW7GY_cjs.ObservationalMemory; }
18
+ get: function () { return chunkPTCSCRB6_cjs.ObservationalMemory; }
19
19
  });
20
20
  Object.defineProperty(exports, "ObservationalMemoryProcessor", {
21
21
  enumerable: true,
22
- get: function () { return chunkP4BYW7GY_cjs.ObservationalMemoryProcessor; }
22
+ get: function () { return chunkPTCSCRB6_cjs.ObservationalMemoryProcessor; }
23
23
  });
24
24
  Object.defineProperty(exports, "TokenCounter", {
25
25
  enumerable: true,
26
- get: function () { return chunkP4BYW7GY_cjs.TokenCounter; }
26
+ get: function () { return chunkPTCSCRB6_cjs.TokenCounter; }
27
27
  });
28
28
  Object.defineProperty(exports, "buildObserverPrompt", {
29
29
  enumerable: true,
30
- get: function () { return chunkP4BYW7GY_cjs.buildObserverPrompt; }
30
+ get: function () { return chunkPTCSCRB6_cjs.buildObserverPrompt; }
31
31
  });
32
32
  Object.defineProperty(exports, "buildObserverSystemPrompt", {
33
33
  enumerable: true,
34
- get: function () { return chunkP4BYW7GY_cjs.buildObserverSystemPrompt; }
34
+ get: function () { return chunkPTCSCRB6_cjs.buildObserverSystemPrompt; }
35
35
  });
36
36
  Object.defineProperty(exports, "combineObservationGroupRanges", {
37
37
  enumerable: true,
38
- get: function () { return chunkP4BYW7GY_cjs.combineObservationGroupRanges; }
38
+ get: function () { return chunkPTCSCRB6_cjs.combineObservationGroupRanges; }
39
39
  });
40
40
  Object.defineProperty(exports, "deriveObservationGroupProvenance", {
41
41
  enumerable: true,
42
- get: function () { return chunkP4BYW7GY_cjs.deriveObservationGroupProvenance; }
42
+ get: function () { return chunkPTCSCRB6_cjs.deriveObservationGroupProvenance; }
43
43
  });
44
44
  Object.defineProperty(exports, "extractCurrentTask", {
45
45
  enumerable: true,
46
- get: function () { return chunkP4BYW7GY_cjs.extractCurrentTask; }
46
+ get: function () { return chunkPTCSCRB6_cjs.extractCurrentTask; }
47
47
  });
48
48
  Object.defineProperty(exports, "formatMessagesForObserver", {
49
49
  enumerable: true,
50
- get: function () { return chunkP4BYW7GY_cjs.formatMessagesForObserver; }
50
+ get: function () { return chunkPTCSCRB6_cjs.formatMessagesForObserver; }
51
51
  });
52
52
  Object.defineProperty(exports, "getObservationsAsOf", {
53
53
  enumerable: true,
54
- get: function () { return chunkP4BYW7GY_cjs.getObservationsAsOf; }
54
+ get: function () { return chunkPTCSCRB6_cjs.getObservationsAsOf; }
55
55
  });
56
56
  Object.defineProperty(exports, "hasCurrentTaskSection", {
57
57
  enumerable: true,
58
- get: function () { return chunkP4BYW7GY_cjs.hasCurrentTaskSection; }
58
+ get: function () { return chunkPTCSCRB6_cjs.hasCurrentTaskSection; }
59
59
  });
60
60
  Object.defineProperty(exports, "injectAnchorIds", {
61
61
  enumerable: true,
62
- get: function () { return chunkP4BYW7GY_cjs.injectAnchorIds; }
62
+ get: function () { return chunkPTCSCRB6_cjs.injectAnchorIds; }
63
63
  });
64
64
  Object.defineProperty(exports, "optimizeObservationsForContext", {
65
65
  enumerable: true,
66
- get: function () { return chunkP4BYW7GY_cjs.optimizeObservationsForContext; }
66
+ get: function () { return chunkPTCSCRB6_cjs.optimizeObservationsForContext; }
67
67
  });
68
68
  Object.defineProperty(exports, "parseAnchorId", {
69
69
  enumerable: true,
70
- get: function () { return chunkP4BYW7GY_cjs.parseAnchorId; }
70
+ get: function () { return chunkPTCSCRB6_cjs.parseAnchorId; }
71
71
  });
72
72
  Object.defineProperty(exports, "parseObservationGroups", {
73
73
  enumerable: true,
74
- get: function () { return chunkP4BYW7GY_cjs.parseObservationGroups; }
74
+ get: function () { return chunkPTCSCRB6_cjs.parseObservationGroups; }
75
75
  });
76
76
  Object.defineProperty(exports, "parseObserverOutput", {
77
77
  enumerable: true,
78
- get: function () { return chunkP4BYW7GY_cjs.parseObserverOutput; }
78
+ get: function () { return chunkPTCSCRB6_cjs.parseObserverOutput; }
79
79
  });
80
80
  Object.defineProperty(exports, "reconcileObservationGroupsFromReflection", {
81
81
  enumerable: true,
82
- get: function () { return chunkP4BYW7GY_cjs.reconcileObservationGroupsFromReflection; }
82
+ get: function () { return chunkPTCSCRB6_cjs.reconcileObservationGroupsFromReflection; }
83
83
  });
84
84
  Object.defineProperty(exports, "renderObservationGroupsForReflection", {
85
85
  enumerable: true,
86
- get: function () { return chunkP4BYW7GY_cjs.renderObservationGroupsForReflection; }
86
+ get: function () { return chunkPTCSCRB6_cjs.renderObservationGroupsForReflection; }
87
87
  });
88
88
  Object.defineProperty(exports, "stripEphemeralAnchorIds", {
89
89
  enumerable: true,
90
- get: function () { return chunkP4BYW7GY_cjs.stripEphemeralAnchorIds; }
90
+ get: function () { return chunkPTCSCRB6_cjs.stripEphemeralAnchorIds; }
91
91
  });
92
92
  Object.defineProperty(exports, "stripObservationGroups", {
93
93
  enumerable: true,
94
- get: function () { return chunkP4BYW7GY_cjs.stripObservationGroups; }
94
+ get: function () { return chunkPTCSCRB6_cjs.stripObservationGroups; }
95
95
  });
96
96
  Object.defineProperty(exports, "wrapInObservationGroup", {
97
97
  enumerable: true,
98
- get: function () { return chunkP4BYW7GY_cjs.wrapInObservationGroup; }
98
+ get: function () { return chunkPTCSCRB6_cjs.wrapInObservationGroup; }
99
99
  });
100
100
  Object.defineProperty(exports, "OBSERVATIONAL_MEMORY_DEFAULTS", {
101
101
  enumerable: true,
102
- get: function () { return chunk3Q3LOVQP_cjs.OBSERVATIONAL_MEMORY_DEFAULTS; }
102
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATIONAL_MEMORY_DEFAULTS; }
103
103
  });
104
104
  Object.defineProperty(exports, "OBSERVATION_CONTEXT_INSTRUCTIONS", {
105
105
  enumerable: true,
106
- get: function () { return chunk3Q3LOVQP_cjs.OBSERVATION_CONTEXT_INSTRUCTIONS; }
106
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATION_CONTEXT_INSTRUCTIONS; }
107
107
  });
108
108
  Object.defineProperty(exports, "OBSERVATION_CONTEXT_PROMPT", {
109
109
  enumerable: true,
110
- get: function () { return chunk3Q3LOVQP_cjs.OBSERVATION_CONTEXT_PROMPT; }
110
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATION_CONTEXT_PROMPT; }
111
111
  });
112
112
  Object.defineProperty(exports, "OBSERVATION_CONTINUATION_HINT", {
113
113
  enumerable: true,
114
- get: function () { return chunk3Q3LOVQP_cjs.OBSERVATION_CONTINUATION_HINT; }
114
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATION_CONTINUATION_HINT; }
115
115
  });
116
- //# sourceMappingURL=observational-memory-CDLGZL67.cjs.map
117
- //# sourceMappingURL=observational-memory-CDLGZL67.cjs.map
116
+ //# sourceMappingURL=observational-memory-SZF7GKTS.cjs.map
117
+ //# sourceMappingURL=observational-memory-SZF7GKTS.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"observational-memory-CDLGZL67.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"observational-memory-SZF7GKTS.cjs"}
@@ -1,117 +1,117 @@
1
1
  'use strict';
2
2
 
3
- var chunkP4BYW7GY_cjs = require('../chunk-P4BYW7GY.cjs');
4
- var chunk3Q3LOVQP_cjs = require('../chunk-3Q3LOVQP.cjs');
3
+ var chunkPTCSCRB6_cjs = require('../chunk-PTCSCRB6.cjs');
4
+ var chunkD4J4XPGM_cjs = require('../chunk-D4J4XPGM.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "ModelByInputTokens", {
9
9
  enumerable: true,
10
- get: function () { return chunkP4BYW7GY_cjs.ModelByInputTokens; }
10
+ get: function () { return chunkPTCSCRB6_cjs.ModelByInputTokens; }
11
11
  });
12
12
  Object.defineProperty(exports, "OBSERVER_SYSTEM_PROMPT", {
13
13
  enumerable: true,
14
- get: function () { return chunkP4BYW7GY_cjs.OBSERVER_SYSTEM_PROMPT; }
14
+ get: function () { return chunkPTCSCRB6_cjs.OBSERVER_SYSTEM_PROMPT; }
15
15
  });
16
16
  Object.defineProperty(exports, "ObservationalMemory", {
17
17
  enumerable: true,
18
- get: function () { return chunkP4BYW7GY_cjs.ObservationalMemory; }
18
+ get: function () { return chunkPTCSCRB6_cjs.ObservationalMemory; }
19
19
  });
20
20
  Object.defineProperty(exports, "ObservationalMemoryProcessor", {
21
21
  enumerable: true,
22
- get: function () { return chunkP4BYW7GY_cjs.ObservationalMemoryProcessor; }
22
+ get: function () { return chunkPTCSCRB6_cjs.ObservationalMemoryProcessor; }
23
23
  });
24
24
  Object.defineProperty(exports, "TokenCounter", {
25
25
  enumerable: true,
26
- get: function () { return chunkP4BYW7GY_cjs.TokenCounter; }
26
+ get: function () { return chunkPTCSCRB6_cjs.TokenCounter; }
27
27
  });
28
28
  Object.defineProperty(exports, "buildObserverPrompt", {
29
29
  enumerable: true,
30
- get: function () { return chunkP4BYW7GY_cjs.buildObserverPrompt; }
30
+ get: function () { return chunkPTCSCRB6_cjs.buildObserverPrompt; }
31
31
  });
32
32
  Object.defineProperty(exports, "buildObserverSystemPrompt", {
33
33
  enumerable: true,
34
- get: function () { return chunkP4BYW7GY_cjs.buildObserverSystemPrompt; }
34
+ get: function () { return chunkPTCSCRB6_cjs.buildObserverSystemPrompt; }
35
35
  });
36
36
  Object.defineProperty(exports, "combineObservationGroupRanges", {
37
37
  enumerable: true,
38
- get: function () { return chunkP4BYW7GY_cjs.combineObservationGroupRanges; }
38
+ get: function () { return chunkPTCSCRB6_cjs.combineObservationGroupRanges; }
39
39
  });
40
40
  Object.defineProperty(exports, "deriveObservationGroupProvenance", {
41
41
  enumerable: true,
42
- get: function () { return chunkP4BYW7GY_cjs.deriveObservationGroupProvenance; }
42
+ get: function () { return chunkPTCSCRB6_cjs.deriveObservationGroupProvenance; }
43
43
  });
44
44
  Object.defineProperty(exports, "extractCurrentTask", {
45
45
  enumerable: true,
46
- get: function () { return chunkP4BYW7GY_cjs.extractCurrentTask; }
46
+ get: function () { return chunkPTCSCRB6_cjs.extractCurrentTask; }
47
47
  });
48
48
  Object.defineProperty(exports, "formatMessagesForObserver", {
49
49
  enumerable: true,
50
- get: function () { return chunkP4BYW7GY_cjs.formatMessagesForObserver; }
50
+ get: function () { return chunkPTCSCRB6_cjs.formatMessagesForObserver; }
51
51
  });
52
52
  Object.defineProperty(exports, "getObservationsAsOf", {
53
53
  enumerable: true,
54
- get: function () { return chunkP4BYW7GY_cjs.getObservationsAsOf; }
54
+ get: function () { return chunkPTCSCRB6_cjs.getObservationsAsOf; }
55
55
  });
56
56
  Object.defineProperty(exports, "hasCurrentTaskSection", {
57
57
  enumerable: true,
58
- get: function () { return chunkP4BYW7GY_cjs.hasCurrentTaskSection; }
58
+ get: function () { return chunkPTCSCRB6_cjs.hasCurrentTaskSection; }
59
59
  });
60
60
  Object.defineProperty(exports, "injectAnchorIds", {
61
61
  enumerable: true,
62
- get: function () { return chunkP4BYW7GY_cjs.injectAnchorIds; }
62
+ get: function () { return chunkPTCSCRB6_cjs.injectAnchorIds; }
63
63
  });
64
64
  Object.defineProperty(exports, "optimizeObservationsForContext", {
65
65
  enumerable: true,
66
- get: function () { return chunkP4BYW7GY_cjs.optimizeObservationsForContext; }
66
+ get: function () { return chunkPTCSCRB6_cjs.optimizeObservationsForContext; }
67
67
  });
68
68
  Object.defineProperty(exports, "parseAnchorId", {
69
69
  enumerable: true,
70
- get: function () { return chunkP4BYW7GY_cjs.parseAnchorId; }
70
+ get: function () { return chunkPTCSCRB6_cjs.parseAnchorId; }
71
71
  });
72
72
  Object.defineProperty(exports, "parseObservationGroups", {
73
73
  enumerable: true,
74
- get: function () { return chunkP4BYW7GY_cjs.parseObservationGroups; }
74
+ get: function () { return chunkPTCSCRB6_cjs.parseObservationGroups; }
75
75
  });
76
76
  Object.defineProperty(exports, "parseObserverOutput", {
77
77
  enumerable: true,
78
- get: function () { return chunkP4BYW7GY_cjs.parseObserverOutput; }
78
+ get: function () { return chunkPTCSCRB6_cjs.parseObserverOutput; }
79
79
  });
80
80
  Object.defineProperty(exports, "reconcileObservationGroupsFromReflection", {
81
81
  enumerable: true,
82
- get: function () { return chunkP4BYW7GY_cjs.reconcileObservationGroupsFromReflection; }
82
+ get: function () { return chunkPTCSCRB6_cjs.reconcileObservationGroupsFromReflection; }
83
83
  });
84
84
  Object.defineProperty(exports, "renderObservationGroupsForReflection", {
85
85
  enumerable: true,
86
- get: function () { return chunkP4BYW7GY_cjs.renderObservationGroupsForReflection; }
86
+ get: function () { return chunkPTCSCRB6_cjs.renderObservationGroupsForReflection; }
87
87
  });
88
88
  Object.defineProperty(exports, "stripEphemeralAnchorIds", {
89
89
  enumerable: true,
90
- get: function () { return chunkP4BYW7GY_cjs.stripEphemeralAnchorIds; }
90
+ get: function () { return chunkPTCSCRB6_cjs.stripEphemeralAnchorIds; }
91
91
  });
92
92
  Object.defineProperty(exports, "stripObservationGroups", {
93
93
  enumerable: true,
94
- get: function () { return chunkP4BYW7GY_cjs.stripObservationGroups; }
94
+ get: function () { return chunkPTCSCRB6_cjs.stripObservationGroups; }
95
95
  });
96
96
  Object.defineProperty(exports, "wrapInObservationGroup", {
97
97
  enumerable: true,
98
- get: function () { return chunkP4BYW7GY_cjs.wrapInObservationGroup; }
98
+ get: function () { return chunkPTCSCRB6_cjs.wrapInObservationGroup; }
99
99
  });
100
100
  Object.defineProperty(exports, "OBSERVATIONAL_MEMORY_DEFAULTS", {
101
101
  enumerable: true,
102
- get: function () { return chunk3Q3LOVQP_cjs.OBSERVATIONAL_MEMORY_DEFAULTS; }
102
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATIONAL_MEMORY_DEFAULTS; }
103
103
  });
104
104
  Object.defineProperty(exports, "OBSERVATION_CONTEXT_INSTRUCTIONS", {
105
105
  enumerable: true,
106
- get: function () { return chunk3Q3LOVQP_cjs.OBSERVATION_CONTEXT_INSTRUCTIONS; }
106
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATION_CONTEXT_INSTRUCTIONS; }
107
107
  });
108
108
  Object.defineProperty(exports, "OBSERVATION_CONTEXT_PROMPT", {
109
109
  enumerable: true,
110
- get: function () { return chunk3Q3LOVQP_cjs.OBSERVATION_CONTEXT_PROMPT; }
110
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATION_CONTEXT_PROMPT; }
111
111
  });
112
112
  Object.defineProperty(exports, "OBSERVATION_CONTINUATION_HINT", {
113
113
  enumerable: true,
114
- get: function () { return chunk3Q3LOVQP_cjs.OBSERVATION_CONTINUATION_HINT; }
114
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATION_CONTINUATION_HINT; }
115
115
  });
116
116
  //# sourceMappingURL=index.cjs.map
117
117
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- export { ModelByInputTokens, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, stripEphemeralAnchorIds, stripObservationGroups, wrapInObservationGroup } from '../chunk-KMJQDCCZ.js';
2
- export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT } from '../chunk-VKRZ3O5X.js';
1
+ export { ModelByInputTokens, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, stripEphemeralAnchorIds, stripObservationGroups, wrapInObservationGroup } from '../chunk-SXFOZU7K.js';
2
+ export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT } from '../chunk-LSJJAJAF.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -16,7 +16,7 @@ export { ObservationalMemoryProcessor } from './processor.js';
16
16
  export type { MemoryContextProvider } from './processor.js';
17
17
  export { getObservationsAsOf } from './observation-utils.js';
18
18
  export { ModelByInputTokens, type ModelByInputTokensConfig } from './model-by-input-tokens.js';
19
- export type { ObservationalMemoryConfig, ObservationDebugEvent, ObserveHooks, ObserveHookUsage, ObservationConfig, ReflectionConfig, ObserverResult, ReflectorResult, DataOmBufferingStartPart, DataOmBufferingEndPart, DataOmBufferingFailedPart, DataOmBufferingPart, DataOmActivationPart, DataOmPart, } from './types.js';
19
+ export type { ObservationalMemoryConfig, ObservationDebugEvent, ObserveHooks, ObserveHookUsage, ObservationConfig, ReflectionConfig, ObserverResult, ReflectorResult, ObservationMarkerConfig, DataOmObservationStartPart, DataOmObservationEndPart, DataOmObservationFailedPart, DataOmStatusPart, DataOmThreadUpdatePart, DataOmObservationPart, DataOmBufferingStartPart, DataOmBufferingEndPart, DataOmBufferingFailedPart, DataOmBufferingPart, DataOmActivationPart, DataOmPart, } from './types.js';
20
20
  export { OBSERVER_SYSTEM_PROMPT, buildObserverSystemPrompt, buildObserverPrompt, parseObserverOutput, optimizeObservationsForContext, formatMessagesForObserver, hasCurrentTaskSection, extractCurrentTask, type ObserverResult as ObserverAgentResult, } from './observer-agent.js';
21
21
  export type { ObservationalMemoryRecord, ObservationalMemoryScope, ObservationalMemoryOriginType, CreateObservationalMemoryInput, UpdateActiveObservationsInput, UpdateBufferedObservationsInput, CreateReflectionGenerationInput, } from '@mastra/core/storage';
22
22
  export { TokenCounter } from './token-counter.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC3D,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,kBAAkB,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAE5F,YAAY,EACV,yBAAyB,EACzB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EAEf,wBAAwB,EACxB,sBAAsB,EACtB,yBAAyB,EACzB,mBAAmB,EAEnB,oBAAoB,EACpB,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,8BAA8B,EAC9B,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,cAAc,IAAI,mBAAmB,GAC3C,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,6BAA6B,EAC7B,8BAA8B,EAC9B,6BAA6B,EAC7B,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,oCAAoC,EACpC,wCAAwC,EACxC,gCAAgC,EAChC,6BAA6B,EAC7B,KAAK,gBAAgB,GACtB,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC3D,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,kBAAkB,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAE5F,YAAY,EACV,yBAAyB,EACzB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EAEf,uBAAuB,EAEvB,0BAA0B,EAC1B,wBAAwB,EACxB,2BAA2B,EAC3B,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EAErB,wBAAwB,EACxB,sBAAsB,EACtB,yBAAyB,EACzB,mBAAmB,EAEnB,oBAAoB,EACpB,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,8BAA8B,EAC9B,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,cAAc,IAAI,mBAAmB,GAC3C,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,6BAA6B,EAC7B,8BAA8B,EAC9B,6BAA6B,EAC7B,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,oCAAoC,EACpC,wCAAwC,EACxC,gCAAgC,EAChC,6BAA6B,EAC7B,KAAK,gBAAgB,GACtB,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { WorkingMemoryStateProcessor, WORKING_MEMORY_STATE_ID, WORKING_MEMORY_STATE_PROCESSOR_ID, stableWorkingMemoryCacheKey, } from './processor.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/processors/working-memory-state/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACvB,iCAAiC,EACjC,2BAA2B,GAC5B,MAAM,aAAa,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * WorkingMemoryStateProcessor
3
+ *
4
+ * Experimental: delivers working memory to the model as a state signal instead
5
+ * of folding it into the system message. Storage and the `setWorkingMemory`
6
+ * tool are unchanged — this processor only changes the delivery path.
7
+ *
8
+ * Pattern matches `BrowserContextProcessor` in `@mastra/core/browser`:
9
+ * - `stateId` namespaces the state lane on the thread.
10
+ * - `cacheKey` is derived from the rendered payload so dedup is automatic.
11
+ * - `contextWindow.hasSnapshot` re-injection ensures the model still sees the
12
+ * current snapshot after older messages drop out of the window.
13
+ *
14
+ * Delta emission (markdown mode only): when a prior snapshot exists in the
15
+ * context window, the processor emits a unified-diff delta against that
16
+ * snapshot's contents. Schema mode and the snapshot fallback always emit a
17
+ * full snapshot.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * new Memory({
22
+ * options: {
23
+ * workingMemory: {
24
+ * enabled: true,
25
+ * template: '...',
26
+ * useStateSignals: true, // auto-attaches this processor
27
+ * },
28
+ * },
29
+ * });
30
+ * ```
31
+ */
32
+ import type { MastraMemory, MemoryConfigInternal, WorkingMemoryTemplate } from '@mastra/core/memory';
33
+ import type { ComputeStateSignalArgs, ComputeStateSignalResult, Processor } from '@mastra/core/processors';
34
+ export declare const WORKING_MEMORY_STATE_ID = "working-memory";
35
+ export declare const WORKING_MEMORY_STATE_PROCESSOR_ID = "working-memory-state";
36
+ export declare class WorkingMemoryStateProcessor implements Processor<typeof WORKING_MEMORY_STATE_PROCESSOR_ID> {
37
+ private readonly memory;
38
+ private readonly memoryConfig?;
39
+ readonly id = "working-memory-state";
40
+ readonly stateId = "working-memory";
41
+ constructor(memory: MastraMemory, memoryConfig?: MemoryConfigInternal | undefined);
42
+ computeStateSignal(args: ComputeStateSignalArgs): Promise<ComputeStateSignalResult>;
43
+ }
44
+ /**
45
+ * Stable cache key for the rendered working memory payload. Returns a SHA-256
46
+ * digest so dedup metadata stays compact regardless of payload size (working
47
+ * memory blobs can grow arbitrarily long).
48
+ */
49
+ export declare function stableWorkingMemoryCacheKey(input: {
50
+ format: WorkingMemoryTemplate['format'];
51
+ data: string | null;
52
+ }): string;
53
+ //# sourceMappingURL=processor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processor.d.ts","sourceRoot":"","sources":["../../../src/processors/working-memory-state/processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EACxB,SAAS,EAEV,MAAM,yBAAyB,CAAC;AAGjC,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AACxD,eAAO,MAAM,iCAAiC,yBAAyB,CAAC;AAExE,qBAAa,2BAA4B,YAAW,SAAS,CAAC,OAAO,iCAAiC,CAAC;IAKnG,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;IALhC,QAAQ,CAAC,EAAE,0BAAqC;IAChD,QAAQ,CAAC,OAAO,oBAA2B;gBAGxB,MAAM,EAAE,YAAY,EACpB,YAAY,CAAC,EAAE,oBAAoB,YAAA;IAGhD,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAkE1F;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,MAAM,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACxC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,GAAG,MAAM,CAMT"}
@@ -1,4 +1,5 @@
1
1
  import type { MemoryConfigInternal } from '@mastra/core/memory';
2
+ import type { ToolAction } from '@mastra/core/tools';
2
3
  /**
3
4
  * Deep merges two objects, with special handling for null values (delete) and arrays (replace).
4
5
  * - Object properties are recursively merged
@@ -9,4 +10,25 @@ import type { MemoryConfigInternal } from '@mastra/core/memory';
9
10
  export declare function deepMergeWorkingMemory(existing: Record<string, unknown> | null | undefined, update: Record<string, unknown> | null | undefined): Record<string, unknown>;
10
11
  export declare const updateWorkingMemoryTool: (memoryConfig?: MemoryConfigInternal) => import("@mastra/core/tools").Tool<unknown, unknown, unknown, unknown, import("@mastra/core/tools").ToolExecutionContext<unknown, unknown, unknown>, "update-working-memory", unknown>;
11
12
  export declare const __experimental_updateWorkingMemoryToolVNext: (config: MemoryConfigInternal) => import("@mastra/core/tools").Tool<unknown, unknown, unknown, unknown, import("@mastra/core/tools").ToolExecutionContext<unknown, unknown, unknown>, "update-working-memory", unknown>;
13
+ /**
14
+ * Returns the working-memory tool plus the wire name it should be registered under.
15
+ *
16
+ * - Default delivery (`useStateSignals: false`): wire name `updateWorkingMemory`,
17
+ * identical shape to today.
18
+ * - State-signals delivery (`useStateSignals: true`): wire name `setWorkingMemory`.
19
+ * The rename keeps legacy strip filters (which match the literal `updateWorkingMemory`)
20
+ * from removing tool-call parts so they persist as a normal audit trail. Any
21
+ * future state-signal-specific tweaks to the tool (e.g. delta-aware results,
22
+ * scoped descriptions) belong here.
23
+ *
24
+ * The VNext vs default tool body decision is left to the caller because Memory
25
+ * owns the `isVNextWorkingMemoryConfig` check; pass `vNext: true` to use the
26
+ * search-and-replace shape.
27
+ */
28
+ export declare function createWorkingMemoryTool(config: MemoryConfigInternal, options?: {
29
+ vNext?: boolean;
30
+ }): {
31
+ name: string;
32
+ tool: ToolAction<any, any, any>;
33
+ };
12
34
  //# sourceMappingURL=working-memory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"working-memory.d.ts","sourceRoot":"","sources":["../../src/tools/working-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAOhE;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,EACpD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GACjD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA4CzB;AA2BD,eAAO,MAAM,uBAAuB,GAAI,eAAe,oBAAoB,0LA+M1E,CAAC;AAEF,eAAO,MAAM,2CAA2C,GAAI,QAAQ,oBAAoB,0LA6GvF,CAAC"}
1
+ {"version":3,"file":"working-memory.d.ts","sourceRoot":"","sources":["../../src/tools/working-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAUrD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,EACpD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GACjD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA4CzB;AA2BD,eAAO,MAAM,uBAAuB,GAAI,eAAe,oBAAoB,0LAuN1E,CAAC;AAEF,eAAO,MAAM,2CAA2C,GAAI,QAAQ,oBAAoB,0LA6GvF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAChC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;CAAE,CAKnD"}
@@ -0,0 +1,3 @@
1
+ export { WORKING_MEMORY_STATE_ID, WORKING_MEMORY_STATE_PROCESSOR_ID, WorkingMemoryStateProcessor, stableWorkingMemoryCacheKey } from './chunk-WCGXQIEN.js';
2
+ //# sourceMappingURL=working-memory-state-J7ASTNXX.js.map
3
+ //# sourceMappingURL=working-memory-state-J7ASTNXX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"working-memory-state-J7ASTNXX.js"}
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ var chunk43FJOLKM_cjs = require('./chunk-43FJOLKM.cjs');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "WORKING_MEMORY_STATE_ID", {
8
+ enumerable: true,
9
+ get: function () { return chunk43FJOLKM_cjs.WORKING_MEMORY_STATE_ID; }
10
+ });
11
+ Object.defineProperty(exports, "WORKING_MEMORY_STATE_PROCESSOR_ID", {
12
+ enumerable: true,
13
+ get: function () { return chunk43FJOLKM_cjs.WORKING_MEMORY_STATE_PROCESSOR_ID; }
14
+ });
15
+ Object.defineProperty(exports, "WorkingMemoryStateProcessor", {
16
+ enumerable: true,
17
+ get: function () { return chunk43FJOLKM_cjs.WorkingMemoryStateProcessor; }
18
+ });
19
+ Object.defineProperty(exports, "stableWorkingMemoryCacheKey", {
20
+ enumerable: true,
21
+ get: function () { return chunk43FJOLKM_cjs.stableWorkingMemoryCacheKey; }
22
+ });
23
+ //# sourceMappingURL=working-memory-state-Y2SCKCNU.cjs.map
24
+ //# sourceMappingURL=working-memory-state-Y2SCKCNU.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"working-memory-state-Y2SCKCNU.cjs"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/memory",
3
- "version": "1.20.1",
3
+ "version": "1.20.2-alpha.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -37,6 +37,7 @@
37
37
  "license": "Apache-2.0",
38
38
  "dependencies": {
39
39
  "async-mutex": "^0.5.0",
40
+ "diff": "^8.0.3",
40
41
  "image-size": "^2.0.2",
41
42
  "json-schema": "^0.4.0",
42
43
  "lru-cache": "^11.2.7",
@@ -64,7 +65,7 @@
64
65
  "@internal/ai-v6": "0.0.47",
65
66
  "@internal/lint": "0.0.100",
66
67
  "@internal/types-builder": "0.0.75",
67
- "@mastra/core": "1.38.0"
68
+ "@mastra/core": "1.39.0-alpha.0"
68
69
  },
69
70
  "peerDependencies": {
70
71
  "@mastra/core": ">=1.4.1-0 <2.0.0-0"
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/processors/observational-memory/constants.ts"],"names":[],"mappings":";;;;;;;;;AAGO,IAAM,6BAAA,GAAgC;AAAA,EAC3C,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,yBAAA;AAAA,IACP,aAAA,EAAe,GAAA;AAAA,IACf,aAAA,EAAe;AAAA,MACb,WAAA,EAAa,GAAA;AAAA,MACb,eAAA,EAAiB;AAAA,KACnB;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,MAAA,EAAQ;AAAA,QACN,cAAA,EAAgB;AAAA,UACd,cAAA,EAAgB;AAAA;AAClB;AACF,KACF;AAAA,IACA,iBAAA,EAAmB,GAAA;AAAA;AAAA,IAEnB,YAAA,EAAc,GAAA;AAAA;AAAA,IACd,gBAAA,EAAkB;AAAA;AAAA,GACpB;AAAA,EACA,UAAA,EAAY;AAAA,IACV,KAAA,EAAO,yBAAA;AAAA,IACP,iBAAA,EAAmB,GAAA;AAAA,IACnB,aAAA,EAAe;AAAA,MACb,WAAA,EAAa,CAAA;AAAA;AAAA,MACb,eAAA,EAAiB;AAAA,KACnB;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,MAAA,EAAQ;AAAA,QACN,cAAA,EAAgB;AAAA,UACd,cAAA,EAAgB;AAAA;AAClB;AACF,KACF;AAAA;AAAA,IAEA,gBAAA,EAAkB;AAAA;AAAA;AAEtB;AAOO,IAAM,6BAAA,GAAgC,CAAA;;AAAA;;AAAA;;AAAA,wEAAA;AAatC,IAAM,0BAAA,GAA6B,CAAA,2FAAA;AAMnC,IAAM,gCAAA,GAAmC,CAAA;;AAAA;;AAAA;;AAAA;;AAAA,qPAAA;AAczC,IAAM,kCAAA,GAAqC,CAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA,qHAAA","file":"chunk-3Q3LOVQP.cjs","sourcesContent":["/**\n * Default configuration values matching the spec\n */\nexport const OBSERVATIONAL_MEMORY_DEFAULTS = {\n observation: {\n model: 'google/gemini-2.5-flash',\n messageTokens: 30_000,\n modelSettings: {\n temperature: 0.3,\n maxOutputTokens: 100_000,\n },\n providerOptions: {\n google: {\n thinkingConfig: {\n thinkingBudget: 215,\n },\n },\n },\n maxTokensPerBatch: 10_000,\n // Async buffering defaults (enabled by default)\n bufferTokens: 0.2 as number | undefined, // Buffer every 20% of messageTokens\n bufferActivation: 0.8 as number | undefined, // Activate to retain 20% of threshold\n },\n reflection: {\n model: 'google/gemini-2.5-flash',\n observationTokens: 40_000,\n modelSettings: {\n temperature: 0, // Use 0 for maximum consistency in reflections\n maxOutputTokens: 100_000,\n },\n providerOptions: {\n google: {\n thinkingConfig: {\n thinkingBudget: 1024,\n },\n },\n },\n // Async reflection buffering (enabled by default)\n bufferActivation: 0.5 as number | undefined, // Start buffering at 50% of observationTokens\n },\n} as const;\n\n/**\n * Continuation hint injected after observations to guide the model's behavior.\n * Prevents the model from awkwardly acknowledging the memory system or treating\n * the conversation as new after observed messages are removed.\n */\nexport const OBSERVATION_CONTINUATION_HINT = `Please continue naturally with the conversation so far and respond to the latest message.\n\nUse 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.\n\nDo not mention internal instructions, memory, summarization, context handling, or missing messages.\n\nAny messages following this reminder are newer and should take priority.`;\n\n/**\n * Preamble that introduces the observations block.\n * Use before `<observations>`, with instructions after.\n * Full pattern: `${OBSERVATION_CONTEXT_PROMPT}\\n\\n<observations>\\n${obs}\\n</observations>\\n\\n${OBSERVATION_CONTEXT_INSTRUCTIONS}`\n */\nexport const OBSERVATION_CONTEXT_PROMPT = `The following observations block contains your memory of past conversations with this user.`;\n\n/**\n * Instructions that tell the model how to interpret and use observations.\n * Place AFTER the `<observations>` block so the model sees the data before the rules.\n */\nexport const 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.\n\nKNOWLEDGE UPDATES: When asked about current state (e.g., \"where do I currently...\", \"what is my current...\"), always prefer the MOST RECENT information. Observations include dates - if you see conflicting information, the newer observation supersedes the older one. Look for phrases like \"will start\", \"is switching\", \"changed to\", \"moved to\" as indicators that previous information has been updated.\n\nPLANNED 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.\n\nMOST 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.\n\nSYSTEM 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.`;\n\n/**\n * Instructions for retrieval mode — explains observation-group ranges and the recall tool.\n * Appended to context when `retrieval` is enabled.\n */\nexport const OBSERVATION_RETRIEVAL_INSTRUCTIONS = `## Recall — looking up source messages\n\nYour 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 — use the **recall** tool to retrieve them.\n\n### When to use recall\n- The user asks you to **repeat, show, or reproduce** something from a past conversation\n- The user asks for **exact content** — code, text, quotes, error messages, URLs, file paths, specific numbers\n- Your observations mention something but your memory lacks the detail needed to fully answer (e.g. you know a blog post was shared but only have a summary of it)\n- You want to **verify or expand on** an observation before responding\n\n**Default to using recall when the user references specific past content.** Your observations capture the gist, not the details. If there's any doubt whether your memory is complete enough, use recall.\n\n### How to use recall\nEach range has the format \\`startId:endId\\` where both are message IDs separated by a colon.\n\n1. Find the observation group relevant to the user's question and extract the start or end ID from its range.\n2. Call \\`recall\\` with that ID as the \\`cursor\\`.\n3. Use \\`page: 1\\` (or omit) to read forward from the cursor, \\`page: -1\\` to read backward.\n4. If the first page doesn't have what you need, increment the page number to keep paginating.\n5. Check \\`hasNextPage\\`/\\`hasPrevPage\\` in the result to know if more pages exist in each direction.\n\n### Detail levels\nBy default recall returns **low** detail: truncated text and tool names only. Each message shows its ID and each part has a positional index like \\`[p0]\\`, \\`[p1]\\`, etc.\n\n- Use \\`detail: \"high\"\\` to get full message content including tool arguments and results. This will only return the high detail version of a single message part at a time.\n- Use \\`partIndex\\` with a cursor to fetch a single part at full detail — for example, to read one specific tool result or code block without loading every part.\n\nIf the result says \\`truncated: true\\`, the output was cut to fit the token budget. You can paginate or use \\`partIndex\\` to target specific content.\n\n### Following up on truncated parts\nLow-detail results may include truncation hints like:\n\\`[truncated — call recall cursor=\"...\" partIndex=N detail=\"high\" for full content]\\`\n\n**When you see these hints and need the full content, make the exact call described in the hint.** This is the normal workflow: first recall at low detail to scan, then drill into specific parts at high detail. Do not stop at the low-detail result if the user asked for exact content.\n\n### When recall is NOT needed\n- The user is asking for a high-level summary and your observations already cover it\n- The question is about general preferences or facts that don't require source text\n- There is no relevant range in your observations for the topic\n\nObservation groups with range IDs and your recall tool allows you to think back and remember details you're fuzzy on.`;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/processors/observational-memory/constants.ts"],"names":[],"mappings":";;;;;;;AAGO,IAAM,6BAAA,GAAgC;AAAA,EAC3C,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,yBAAA;AAAA,IACP,aAAA,EAAe,GAAA;AAAA,IACf,aAAA,EAAe;AAAA,MACb,WAAA,EAAa,GAAA;AAAA,MACb,eAAA,EAAiB;AAAA,KACnB;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,MAAA,EAAQ;AAAA,QACN,cAAA,EAAgB;AAAA,UACd,cAAA,EAAgB;AAAA;AAClB;AACF,KACF;AAAA,IACA,iBAAA,EAAmB,GAAA;AAAA;AAAA,IAEnB,YAAA,EAAc,GAAA;AAAA;AAAA,IACd,gBAAA,EAAkB;AAAA;AAAA,GACpB;AAAA,EACA,UAAA,EAAY;AAAA,IACV,KAAA,EAAO,yBAAA;AAAA,IACP,iBAAA,EAAmB,GAAA;AAAA,IACnB,aAAA,EAAe;AAAA,MACb,WAAA,EAAa,CAAA;AAAA;AAAA,MACb,eAAA,EAAiB;AAAA,KACnB;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,MAAA,EAAQ;AAAA,QACN,cAAA,EAAgB;AAAA,UACd,cAAA,EAAgB;AAAA;AAClB;AACF,KACF;AAAA;AAAA,IAEA,gBAAA,EAAkB;AAAA;AAAA;AAEtB;AAOO,IAAM,6BAAA,GAAgC,CAAA;;AAAA;;AAAA;;AAAA,wEAAA;AAatC,IAAM,0BAAA,GAA6B,CAAA,2FAAA;AAMnC,IAAM,gCAAA,GAAmC,CAAA;;AAAA;;AAAA;;AAAA;;AAAA,qPAAA;AAczC,IAAM,kCAAA,GAAqC,CAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA,qHAAA","file":"chunk-VKRZ3O5X.js","sourcesContent":["/**\n * Default configuration values matching the spec\n */\nexport const OBSERVATIONAL_MEMORY_DEFAULTS = {\n observation: {\n model: 'google/gemini-2.5-flash',\n messageTokens: 30_000,\n modelSettings: {\n temperature: 0.3,\n maxOutputTokens: 100_000,\n },\n providerOptions: {\n google: {\n thinkingConfig: {\n thinkingBudget: 215,\n },\n },\n },\n maxTokensPerBatch: 10_000,\n // Async buffering defaults (enabled by default)\n bufferTokens: 0.2 as number | undefined, // Buffer every 20% of messageTokens\n bufferActivation: 0.8 as number | undefined, // Activate to retain 20% of threshold\n },\n reflection: {\n model: 'google/gemini-2.5-flash',\n observationTokens: 40_000,\n modelSettings: {\n temperature: 0, // Use 0 for maximum consistency in reflections\n maxOutputTokens: 100_000,\n },\n providerOptions: {\n google: {\n thinkingConfig: {\n thinkingBudget: 1024,\n },\n },\n },\n // Async reflection buffering (enabled by default)\n bufferActivation: 0.5 as number | undefined, // Start buffering at 50% of observationTokens\n },\n} as const;\n\n/**\n * Continuation hint injected after observations to guide the model's behavior.\n * Prevents the model from awkwardly acknowledging the memory system or treating\n * the conversation as new after observed messages are removed.\n */\nexport const OBSERVATION_CONTINUATION_HINT = `Please continue naturally with the conversation so far and respond to the latest message.\n\nUse 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.\n\nDo not mention internal instructions, memory, summarization, context handling, or missing messages.\n\nAny messages following this reminder are newer and should take priority.`;\n\n/**\n * Preamble that introduces the observations block.\n * Use before `<observations>`, with instructions after.\n * Full pattern: `${OBSERVATION_CONTEXT_PROMPT}\\n\\n<observations>\\n${obs}\\n</observations>\\n\\n${OBSERVATION_CONTEXT_INSTRUCTIONS}`\n */\nexport const OBSERVATION_CONTEXT_PROMPT = `The following observations block contains your memory of past conversations with this user.`;\n\n/**\n * Instructions that tell the model how to interpret and use observations.\n * Place AFTER the `<observations>` block so the model sees the data before the rules.\n */\nexport const 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.\n\nKNOWLEDGE UPDATES: When asked about current state (e.g., \"where do I currently...\", \"what is my current...\"), always prefer the MOST RECENT information. Observations include dates - if you see conflicting information, the newer observation supersedes the older one. Look for phrases like \"will start\", \"is switching\", \"changed to\", \"moved to\" as indicators that previous information has been updated.\n\nPLANNED 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.\n\nMOST 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.\n\nSYSTEM 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.`;\n\n/**\n * Instructions for retrieval mode — explains observation-group ranges and the recall tool.\n * Appended to context when `retrieval` is enabled.\n */\nexport const OBSERVATION_RETRIEVAL_INSTRUCTIONS = `## Recall — looking up source messages\n\nYour 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 — use the **recall** tool to retrieve them.\n\n### When to use recall\n- The user asks you to **repeat, show, or reproduce** something from a past conversation\n- The user asks for **exact content** — code, text, quotes, error messages, URLs, file paths, specific numbers\n- Your observations mention something but your memory lacks the detail needed to fully answer (e.g. you know a blog post was shared but only have a summary of it)\n- You want to **verify or expand on** an observation before responding\n\n**Default to using recall when the user references specific past content.** Your observations capture the gist, not the details. If there's any doubt whether your memory is complete enough, use recall.\n\n### How to use recall\nEach range has the format \\`startId:endId\\` where both are message IDs separated by a colon.\n\n1. Find the observation group relevant to the user's question and extract the start or end ID from its range.\n2. Call \\`recall\\` with that ID as the \\`cursor\\`.\n3. Use \\`page: 1\\` (or omit) to read forward from the cursor, \\`page: -1\\` to read backward.\n4. If the first page doesn't have what you need, increment the page number to keep paginating.\n5. Check \\`hasNextPage\\`/\\`hasPrevPage\\` in the result to know if more pages exist in each direction.\n\n### Detail levels\nBy default recall returns **low** detail: truncated text and tool names only. Each message shows its ID and each part has a positional index like \\`[p0]\\`, \\`[p1]\\`, etc.\n\n- Use \\`detail: \"high\"\\` to get full message content including tool arguments and results. This will only return the high detail version of a single message part at a time.\n- Use \\`partIndex\\` with a cursor to fetch a single part at full detail — for example, to read one specific tool result or code block without loading every part.\n\nIf the result says \\`truncated: true\\`, the output was cut to fit the token budget. You can paginate or use \\`partIndex\\` to target specific content.\n\n### Following up on truncated parts\nLow-detail results may include truncation hints like:\n\\`[truncated — call recall cursor=\"...\" partIndex=N detail=\"high\" for full content]\\`\n\n**When you see these hints and need the full content, make the exact call described in the hint.** This is the normal workflow: first recall at low detail to scan, then drill into specific parts at high detail. Do not stop at the low-detail result if the user asked for exact content.\n\n### When recall is NOT needed\n- The user is asking for a high-level summary and your observations already cover it\n- The question is about general preferences or facts that don't require source text\n- There is no relevant range in your observations for the topic\n\nObservation groups with range IDs and your recall tool allows you to think back and remember details you're fuzzy on.`;\n"]}
@@ -1,3 +0,0 @@
1
- export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT, OBSERVATION_RETRIEVAL_INSTRUCTIONS } from './chunk-VKRZ3O5X.js';
2
- //# sourceMappingURL=constants-SPS7MR4D.js.map
3
- //# sourceMappingURL=constants-SPS7MR4D.js.map