@mastra/memory 1.10.0 → 1.10.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/dist/{chunk-7A3UGAXY.js → chunk-2QSOQQPM.js} +6817 -6611
  3. package/dist/chunk-2QSOQQPM.js.map +1 -0
  4. package/dist/chunk-D4J4XPGM.cjs +111 -0
  5. package/dist/chunk-D4J4XPGM.cjs.map +1 -0
  6. package/dist/chunk-LSJJAJAF.js +105 -0
  7. package/dist/chunk-LSJJAJAF.js.map +1 -0
  8. package/dist/{chunk-EVBFYGDL.cjs → chunk-NS47X3OB.cjs} +6808 -6605
  9. package/dist/chunk-NS47X3OB.cjs.map +1 -0
  10. package/dist/constants-BDOITAO3.js +3 -0
  11. package/dist/constants-BDOITAO3.js.map +1 -0
  12. package/dist/constants-HXOCZPB7.cjs +28 -0
  13. package/dist/constants-HXOCZPB7.cjs.map +1 -0
  14. package/dist/docs/SKILL.md +1 -1
  15. package/dist/docs/assets/SOURCE_MAP.json +67 -61
  16. package/dist/docs/references/docs-memory-observational-memory.md +7 -5
  17. package/dist/docs/references/reference-memory-observational-memory.md +2 -2
  18. package/dist/index.cjs +207 -78
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.ts +52 -5
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +200 -71
  23. package/dist/index.js.map +1 -1
  24. package/dist/{observational-memory-COYJCVX3.cjs → observational-memory-I5UTOG63.cjs} +46 -41
  25. package/dist/{observational-memory-COYJCVX3.cjs.map → observational-memory-I5UTOG63.cjs.map} +1 -1
  26. package/dist/observational-memory-WMCWT577.js +4 -0
  27. package/dist/{observational-memory-K2U3QQIO.js.map → observational-memory-WMCWT577.js.map} +1 -1
  28. package/dist/processors/index.cjs +44 -39
  29. package/dist/processors/index.js +2 -1
  30. package/dist/processors/observational-memory/buffering-coordinator.d.ts +61 -0
  31. package/dist/processors/observational-memory/buffering-coordinator.d.ts.map +1 -0
  32. package/dist/processors/observational-memory/constants.d.ts +62 -0
  33. package/dist/processors/observational-memory/constants.d.ts.map +1 -0
  34. package/dist/processors/observational-memory/debug.d.ts +3 -0
  35. package/dist/processors/observational-memory/debug.d.ts.map +1 -0
  36. package/dist/processors/observational-memory/index.d.ts +5 -2
  37. package/dist/processors/observational-memory/index.d.ts.map +1 -1
  38. package/dist/processors/observational-memory/message-utils.d.ts +69 -0
  39. package/dist/processors/observational-memory/message-utils.d.ts.map +1 -0
  40. package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts +33 -0
  41. package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts.map +1 -0
  42. package/dist/processors/observational-memory/observation-strategies/base.d.ts +102 -0
  43. package/dist/processors/observational-memory/observation-strategies/base.d.ts.map +1 -0
  44. package/dist/processors/observational-memory/observation-strategies/index.d.ts +7 -0
  45. package/dist/processors/observational-memory/observation-strategies/index.d.ts.map +1 -0
  46. package/dist/processors/observational-memory/observation-strategies/resource-scoped.d.ts +39 -0
  47. package/dist/processors/observational-memory/observation-strategies/resource-scoped.d.ts.map +1 -0
  48. package/dist/processors/observational-memory/observation-strategies/sync.d.ts +35 -0
  49. package/dist/processors/observational-memory/observation-strategies/sync.d.ts.map +1 -0
  50. package/dist/processors/observational-memory/observation-strategies/types.d.ts +55 -0
  51. package/dist/processors/observational-memory/observation-strategies/types.d.ts.map +1 -0
  52. package/dist/processors/observational-memory/observation-turn/index.d.ts +4 -0
  53. package/dist/processors/observational-memory/observation-turn/index.d.ts.map +1 -0
  54. package/dist/processors/observational-memory/observation-turn/step.d.ts +34 -0
  55. package/dist/processors/observational-memory/observation-turn/step.d.ts.map +1 -0
  56. package/dist/processors/observational-memory/observation-turn/turn.d.ts +84 -0
  57. package/dist/processors/observational-memory/observation-turn/turn.d.ts.map +1 -0
  58. package/dist/processors/observational-memory/observation-turn/types.d.ts +38 -0
  59. package/dist/processors/observational-memory/observation-turn/types.d.ts.map +1 -0
  60. package/dist/processors/observational-memory/observational-memory.d.ts +388 -553
  61. package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
  62. package/dist/processors/observational-memory/observer-runner.d.ts +65 -0
  63. package/dist/processors/observational-memory/observer-runner.d.ts.map +1 -0
  64. package/dist/processors/observational-memory/processor.d.ts +70 -0
  65. package/dist/processors/observational-memory/processor.d.ts.map +1 -0
  66. package/dist/processors/observational-memory/reflector-runner.d.ts +95 -0
  67. package/dist/processors/observational-memory/reflector-runner.d.ts.map +1 -0
  68. package/dist/processors/observational-memory/types.d.ts +157 -0
  69. package/dist/processors/observational-memory/types.d.ts.map +1 -1
  70. package/package.json +2 -2
  71. package/dist/chunk-7A3UGAXY.js.map +0 -1
  72. package/dist/chunk-EVBFYGDL.cjs.map +0 -1
  73. package/dist/observational-memory-K2U3QQIO.js +0 -3
@@ -1,112 +1,117 @@
1
1
  'use strict';
2
2
 
3
- var chunkEVBFYGDL_cjs = require('./chunk-EVBFYGDL.cjs');
3
+ var chunkNS47X3OB_cjs = require('./chunk-NS47X3OB.cjs');
4
+ var chunkD4J4XPGM_cjs = require('./chunk-D4J4XPGM.cjs');
4
5
 
5
6
 
6
7
 
7
8
  Object.defineProperty(exports, "ModelByInputTokens", {
8
9
  enumerable: true,
9
- get: function () { return chunkEVBFYGDL_cjs.ModelByInputTokens; }
10
- });
11
- Object.defineProperty(exports, "OBSERVATIONAL_MEMORY_DEFAULTS", {
12
- enumerable: true,
13
- get: function () { return chunkEVBFYGDL_cjs.OBSERVATIONAL_MEMORY_DEFAULTS; }
14
- });
15
- Object.defineProperty(exports, "OBSERVATION_CONTEXT_INSTRUCTIONS", {
16
- enumerable: true,
17
- get: function () { return chunkEVBFYGDL_cjs.OBSERVATION_CONTEXT_INSTRUCTIONS; }
18
- });
19
- Object.defineProperty(exports, "OBSERVATION_CONTEXT_PROMPT", {
20
- enumerable: true,
21
- get: function () { return chunkEVBFYGDL_cjs.OBSERVATION_CONTEXT_PROMPT; }
22
- });
23
- Object.defineProperty(exports, "OBSERVATION_CONTINUATION_HINT", {
24
- enumerable: true,
25
- get: function () { return chunkEVBFYGDL_cjs.OBSERVATION_CONTINUATION_HINT; }
10
+ get: function () { return chunkNS47X3OB_cjs.ModelByInputTokens; }
26
11
  });
27
12
  Object.defineProperty(exports, "OBSERVER_SYSTEM_PROMPT", {
28
13
  enumerable: true,
29
- get: function () { return chunkEVBFYGDL_cjs.OBSERVER_SYSTEM_PROMPT; }
14
+ get: function () { return chunkNS47X3OB_cjs.OBSERVER_SYSTEM_PROMPT; }
30
15
  });
31
16
  Object.defineProperty(exports, "ObservationalMemory", {
32
17
  enumerable: true,
33
- get: function () { return chunkEVBFYGDL_cjs.ObservationalMemory; }
18
+ get: function () { return chunkNS47X3OB_cjs.ObservationalMemory; }
19
+ });
20
+ Object.defineProperty(exports, "ObservationalMemoryProcessor", {
21
+ enumerable: true,
22
+ get: function () { return chunkNS47X3OB_cjs.ObservationalMemoryProcessor; }
34
23
  });
35
24
  Object.defineProperty(exports, "TokenCounter", {
36
25
  enumerable: true,
37
- get: function () { return chunkEVBFYGDL_cjs.TokenCounter; }
26
+ get: function () { return chunkNS47X3OB_cjs.TokenCounter; }
38
27
  });
39
28
  Object.defineProperty(exports, "buildObserverPrompt", {
40
29
  enumerable: true,
41
- get: function () { return chunkEVBFYGDL_cjs.buildObserverPrompt; }
30
+ get: function () { return chunkNS47X3OB_cjs.buildObserverPrompt; }
42
31
  });
43
32
  Object.defineProperty(exports, "buildObserverSystemPrompt", {
44
33
  enumerable: true,
45
- get: function () { return chunkEVBFYGDL_cjs.buildObserverSystemPrompt; }
34
+ get: function () { return chunkNS47X3OB_cjs.buildObserverSystemPrompt; }
46
35
  });
47
36
  Object.defineProperty(exports, "combineObservationGroupRanges", {
48
37
  enumerable: true,
49
- get: function () { return chunkEVBFYGDL_cjs.combineObservationGroupRanges; }
38
+ get: function () { return chunkNS47X3OB_cjs.combineObservationGroupRanges; }
50
39
  });
51
40
  Object.defineProperty(exports, "deriveObservationGroupProvenance", {
52
41
  enumerable: true,
53
- get: function () { return chunkEVBFYGDL_cjs.deriveObservationGroupProvenance; }
42
+ get: function () { return chunkNS47X3OB_cjs.deriveObservationGroupProvenance; }
54
43
  });
55
44
  Object.defineProperty(exports, "extractCurrentTask", {
56
45
  enumerable: true,
57
- get: function () { return chunkEVBFYGDL_cjs.extractCurrentTask; }
46
+ get: function () { return chunkNS47X3OB_cjs.extractCurrentTask; }
58
47
  });
59
48
  Object.defineProperty(exports, "formatMessagesForObserver", {
60
49
  enumerable: true,
61
- get: function () { return chunkEVBFYGDL_cjs.formatMessagesForObserver; }
50
+ get: function () { return chunkNS47X3OB_cjs.formatMessagesForObserver; }
62
51
  });
63
52
  Object.defineProperty(exports, "getObservationsAsOf", {
64
53
  enumerable: true,
65
- get: function () { return chunkEVBFYGDL_cjs.getObservationsAsOf; }
54
+ get: function () { return chunkNS47X3OB_cjs.getObservationsAsOf; }
66
55
  });
67
56
  Object.defineProperty(exports, "hasCurrentTaskSection", {
68
57
  enumerable: true,
69
- get: function () { return chunkEVBFYGDL_cjs.hasCurrentTaskSection; }
58
+ get: function () { return chunkNS47X3OB_cjs.hasCurrentTaskSection; }
70
59
  });
71
60
  Object.defineProperty(exports, "injectAnchorIds", {
72
61
  enumerable: true,
73
- get: function () { return chunkEVBFYGDL_cjs.injectAnchorIds; }
62
+ get: function () { return chunkNS47X3OB_cjs.injectAnchorIds; }
74
63
  });
75
64
  Object.defineProperty(exports, "optimizeObservationsForContext", {
76
65
  enumerable: true,
77
- get: function () { return chunkEVBFYGDL_cjs.optimizeObservationsForContext; }
66
+ get: function () { return chunkNS47X3OB_cjs.optimizeObservationsForContext; }
78
67
  });
79
68
  Object.defineProperty(exports, "parseAnchorId", {
80
69
  enumerable: true,
81
- get: function () { return chunkEVBFYGDL_cjs.parseAnchorId; }
70
+ get: function () { return chunkNS47X3OB_cjs.parseAnchorId; }
82
71
  });
83
72
  Object.defineProperty(exports, "parseObservationGroups", {
84
73
  enumerable: true,
85
- get: function () { return chunkEVBFYGDL_cjs.parseObservationGroups; }
74
+ get: function () { return chunkNS47X3OB_cjs.parseObservationGroups; }
86
75
  });
87
76
  Object.defineProperty(exports, "parseObserverOutput", {
88
77
  enumerable: true,
89
- get: function () { return chunkEVBFYGDL_cjs.parseObserverOutput; }
78
+ get: function () { return chunkNS47X3OB_cjs.parseObserverOutput; }
90
79
  });
91
80
  Object.defineProperty(exports, "reconcileObservationGroupsFromReflection", {
92
81
  enumerable: true,
93
- get: function () { return chunkEVBFYGDL_cjs.reconcileObservationGroupsFromReflection; }
82
+ get: function () { return chunkNS47X3OB_cjs.reconcileObservationGroupsFromReflection; }
94
83
  });
95
84
  Object.defineProperty(exports, "renderObservationGroupsForReflection", {
96
85
  enumerable: true,
97
- get: function () { return chunkEVBFYGDL_cjs.renderObservationGroupsForReflection; }
86
+ get: function () { return chunkNS47X3OB_cjs.renderObservationGroupsForReflection; }
98
87
  });
99
88
  Object.defineProperty(exports, "stripEphemeralAnchorIds", {
100
89
  enumerable: true,
101
- get: function () { return chunkEVBFYGDL_cjs.stripEphemeralAnchorIds; }
90
+ get: function () { return chunkNS47X3OB_cjs.stripEphemeralAnchorIds; }
102
91
  });
103
92
  Object.defineProperty(exports, "stripObservationGroups", {
104
93
  enumerable: true,
105
- get: function () { return chunkEVBFYGDL_cjs.stripObservationGroups; }
94
+ get: function () { return chunkNS47X3OB_cjs.stripObservationGroups; }
106
95
  });
107
96
  Object.defineProperty(exports, "wrapInObservationGroup", {
108
97
  enumerable: true,
109
- get: function () { return chunkEVBFYGDL_cjs.wrapInObservationGroup; }
98
+ get: function () { return chunkNS47X3OB_cjs.wrapInObservationGroup; }
99
+ });
100
+ Object.defineProperty(exports, "OBSERVATIONAL_MEMORY_DEFAULTS", {
101
+ enumerable: true,
102
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATIONAL_MEMORY_DEFAULTS; }
103
+ });
104
+ Object.defineProperty(exports, "OBSERVATION_CONTEXT_INSTRUCTIONS", {
105
+ enumerable: true,
106
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATION_CONTEXT_INSTRUCTIONS; }
107
+ });
108
+ Object.defineProperty(exports, "OBSERVATION_CONTEXT_PROMPT", {
109
+ enumerable: true,
110
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATION_CONTEXT_PROMPT; }
111
+ });
112
+ Object.defineProperty(exports, "OBSERVATION_CONTINUATION_HINT", {
113
+ enumerable: true,
114
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATION_CONTINUATION_HINT; }
110
115
  });
111
- //# sourceMappingURL=observational-memory-COYJCVX3.cjs.map
112
- //# sourceMappingURL=observational-memory-COYJCVX3.cjs.map
116
+ //# sourceMappingURL=observational-memory-I5UTOG63.cjs.map
117
+ //# sourceMappingURL=observational-memory-I5UTOG63.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"observational-memory-COYJCVX3.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"observational-memory-I5UTOG63.cjs"}
@@ -0,0 +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-2QSOQQPM.js';
2
+ export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT } from './chunk-LSJJAJAF.js';
3
+ //# sourceMappingURL=observational-memory-WMCWT577.js.map
4
+ //# sourceMappingURL=observational-memory-WMCWT577.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"observational-memory-K2U3QQIO.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"observational-memory-WMCWT577.js"}
@@ -1,112 +1,117 @@
1
1
  'use strict';
2
2
 
3
- var chunkEVBFYGDL_cjs = require('../chunk-EVBFYGDL.cjs');
3
+ var chunkNS47X3OB_cjs = require('../chunk-NS47X3OB.cjs');
4
+ var chunkD4J4XPGM_cjs = require('../chunk-D4J4XPGM.cjs');
4
5
 
5
6
 
6
7
 
7
8
  Object.defineProperty(exports, "ModelByInputTokens", {
8
9
  enumerable: true,
9
- get: function () { return chunkEVBFYGDL_cjs.ModelByInputTokens; }
10
- });
11
- Object.defineProperty(exports, "OBSERVATIONAL_MEMORY_DEFAULTS", {
12
- enumerable: true,
13
- get: function () { return chunkEVBFYGDL_cjs.OBSERVATIONAL_MEMORY_DEFAULTS; }
14
- });
15
- Object.defineProperty(exports, "OBSERVATION_CONTEXT_INSTRUCTIONS", {
16
- enumerable: true,
17
- get: function () { return chunkEVBFYGDL_cjs.OBSERVATION_CONTEXT_INSTRUCTIONS; }
18
- });
19
- Object.defineProperty(exports, "OBSERVATION_CONTEXT_PROMPT", {
20
- enumerable: true,
21
- get: function () { return chunkEVBFYGDL_cjs.OBSERVATION_CONTEXT_PROMPT; }
22
- });
23
- Object.defineProperty(exports, "OBSERVATION_CONTINUATION_HINT", {
24
- enumerable: true,
25
- get: function () { return chunkEVBFYGDL_cjs.OBSERVATION_CONTINUATION_HINT; }
10
+ get: function () { return chunkNS47X3OB_cjs.ModelByInputTokens; }
26
11
  });
27
12
  Object.defineProperty(exports, "OBSERVER_SYSTEM_PROMPT", {
28
13
  enumerable: true,
29
- get: function () { return chunkEVBFYGDL_cjs.OBSERVER_SYSTEM_PROMPT; }
14
+ get: function () { return chunkNS47X3OB_cjs.OBSERVER_SYSTEM_PROMPT; }
30
15
  });
31
16
  Object.defineProperty(exports, "ObservationalMemory", {
32
17
  enumerable: true,
33
- get: function () { return chunkEVBFYGDL_cjs.ObservationalMemory; }
18
+ get: function () { return chunkNS47X3OB_cjs.ObservationalMemory; }
19
+ });
20
+ Object.defineProperty(exports, "ObservationalMemoryProcessor", {
21
+ enumerable: true,
22
+ get: function () { return chunkNS47X3OB_cjs.ObservationalMemoryProcessor; }
34
23
  });
35
24
  Object.defineProperty(exports, "TokenCounter", {
36
25
  enumerable: true,
37
- get: function () { return chunkEVBFYGDL_cjs.TokenCounter; }
26
+ get: function () { return chunkNS47X3OB_cjs.TokenCounter; }
38
27
  });
39
28
  Object.defineProperty(exports, "buildObserverPrompt", {
40
29
  enumerable: true,
41
- get: function () { return chunkEVBFYGDL_cjs.buildObserverPrompt; }
30
+ get: function () { return chunkNS47X3OB_cjs.buildObserverPrompt; }
42
31
  });
43
32
  Object.defineProperty(exports, "buildObserverSystemPrompt", {
44
33
  enumerable: true,
45
- get: function () { return chunkEVBFYGDL_cjs.buildObserverSystemPrompt; }
34
+ get: function () { return chunkNS47X3OB_cjs.buildObserverSystemPrompt; }
46
35
  });
47
36
  Object.defineProperty(exports, "combineObservationGroupRanges", {
48
37
  enumerable: true,
49
- get: function () { return chunkEVBFYGDL_cjs.combineObservationGroupRanges; }
38
+ get: function () { return chunkNS47X3OB_cjs.combineObservationGroupRanges; }
50
39
  });
51
40
  Object.defineProperty(exports, "deriveObservationGroupProvenance", {
52
41
  enumerable: true,
53
- get: function () { return chunkEVBFYGDL_cjs.deriveObservationGroupProvenance; }
42
+ get: function () { return chunkNS47X3OB_cjs.deriveObservationGroupProvenance; }
54
43
  });
55
44
  Object.defineProperty(exports, "extractCurrentTask", {
56
45
  enumerable: true,
57
- get: function () { return chunkEVBFYGDL_cjs.extractCurrentTask; }
46
+ get: function () { return chunkNS47X3OB_cjs.extractCurrentTask; }
58
47
  });
59
48
  Object.defineProperty(exports, "formatMessagesForObserver", {
60
49
  enumerable: true,
61
- get: function () { return chunkEVBFYGDL_cjs.formatMessagesForObserver; }
50
+ get: function () { return chunkNS47X3OB_cjs.formatMessagesForObserver; }
62
51
  });
63
52
  Object.defineProperty(exports, "getObservationsAsOf", {
64
53
  enumerable: true,
65
- get: function () { return chunkEVBFYGDL_cjs.getObservationsAsOf; }
54
+ get: function () { return chunkNS47X3OB_cjs.getObservationsAsOf; }
66
55
  });
67
56
  Object.defineProperty(exports, "hasCurrentTaskSection", {
68
57
  enumerable: true,
69
- get: function () { return chunkEVBFYGDL_cjs.hasCurrentTaskSection; }
58
+ get: function () { return chunkNS47X3OB_cjs.hasCurrentTaskSection; }
70
59
  });
71
60
  Object.defineProperty(exports, "injectAnchorIds", {
72
61
  enumerable: true,
73
- get: function () { return chunkEVBFYGDL_cjs.injectAnchorIds; }
62
+ get: function () { return chunkNS47X3OB_cjs.injectAnchorIds; }
74
63
  });
75
64
  Object.defineProperty(exports, "optimizeObservationsForContext", {
76
65
  enumerable: true,
77
- get: function () { return chunkEVBFYGDL_cjs.optimizeObservationsForContext; }
66
+ get: function () { return chunkNS47X3OB_cjs.optimizeObservationsForContext; }
78
67
  });
79
68
  Object.defineProperty(exports, "parseAnchorId", {
80
69
  enumerable: true,
81
- get: function () { return chunkEVBFYGDL_cjs.parseAnchorId; }
70
+ get: function () { return chunkNS47X3OB_cjs.parseAnchorId; }
82
71
  });
83
72
  Object.defineProperty(exports, "parseObservationGroups", {
84
73
  enumerable: true,
85
- get: function () { return chunkEVBFYGDL_cjs.parseObservationGroups; }
74
+ get: function () { return chunkNS47X3OB_cjs.parseObservationGroups; }
86
75
  });
87
76
  Object.defineProperty(exports, "parseObserverOutput", {
88
77
  enumerable: true,
89
- get: function () { return chunkEVBFYGDL_cjs.parseObserverOutput; }
78
+ get: function () { return chunkNS47X3OB_cjs.parseObserverOutput; }
90
79
  });
91
80
  Object.defineProperty(exports, "reconcileObservationGroupsFromReflection", {
92
81
  enumerable: true,
93
- get: function () { return chunkEVBFYGDL_cjs.reconcileObservationGroupsFromReflection; }
82
+ get: function () { return chunkNS47X3OB_cjs.reconcileObservationGroupsFromReflection; }
94
83
  });
95
84
  Object.defineProperty(exports, "renderObservationGroupsForReflection", {
96
85
  enumerable: true,
97
- get: function () { return chunkEVBFYGDL_cjs.renderObservationGroupsForReflection; }
86
+ get: function () { return chunkNS47X3OB_cjs.renderObservationGroupsForReflection; }
98
87
  });
99
88
  Object.defineProperty(exports, "stripEphemeralAnchorIds", {
100
89
  enumerable: true,
101
- get: function () { return chunkEVBFYGDL_cjs.stripEphemeralAnchorIds; }
90
+ get: function () { return chunkNS47X3OB_cjs.stripEphemeralAnchorIds; }
102
91
  });
103
92
  Object.defineProperty(exports, "stripObservationGroups", {
104
93
  enumerable: true,
105
- get: function () { return chunkEVBFYGDL_cjs.stripObservationGroups; }
94
+ get: function () { return chunkNS47X3OB_cjs.stripObservationGroups; }
106
95
  });
107
96
  Object.defineProperty(exports, "wrapInObservationGroup", {
108
97
  enumerable: true,
109
- get: function () { return chunkEVBFYGDL_cjs.wrapInObservationGroup; }
98
+ get: function () { return chunkNS47X3OB_cjs.wrapInObservationGroup; }
99
+ });
100
+ Object.defineProperty(exports, "OBSERVATIONAL_MEMORY_DEFAULTS", {
101
+ enumerable: true,
102
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATIONAL_MEMORY_DEFAULTS; }
103
+ });
104
+ Object.defineProperty(exports, "OBSERVATION_CONTEXT_INSTRUCTIONS", {
105
+ enumerable: true,
106
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATION_CONTEXT_INSTRUCTIONS; }
107
+ });
108
+ Object.defineProperty(exports, "OBSERVATION_CONTEXT_PROMPT", {
109
+ enumerable: true,
110
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATION_CONTEXT_PROMPT; }
111
+ });
112
+ Object.defineProperty(exports, "OBSERVATION_CONTINUATION_HINT", {
113
+ enumerable: true,
114
+ get: function () { return chunkD4J4XPGM_cjs.OBSERVATION_CONTINUATION_HINT; }
110
115
  });
111
116
  //# sourceMappingURL=index.cjs.map
112
117
  //# sourceMappingURL=index.cjs.map
@@ -1,3 +1,4 @@
1
- export { ModelByInputTokens, OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, stripEphemeralAnchorIds, stripObservationGroups, wrapInObservationGroup } from '../chunk-7A3UGAXY.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-2QSOQQPM.js';
2
+ export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT } from '../chunk-LSJJAJAF.js';
2
3
  //# sourceMappingURL=index.js.map
3
4
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,61 @@
1
+ import type { ObservationalMemoryRecord } from '@mastra/core/storage';
2
+ import type { ResolvedObservationConfig, ResolvedReflectionConfig } from './types.js';
3
+ /**
4
+ * Manages the static buffering state machine for async observation and reflection.
5
+ *
6
+ * Static maps are shared across all ObservationalMemory instances in a process.
7
+ * This is critical because multiple OM instances are created per agent loop step,
8
+ * and they need to share knowledge of in-flight operations.
9
+ */
10
+ export declare class BufferingCoordinator {
11
+ private readonly observationConfig;
12
+ private readonly reflectionConfig;
13
+ private readonly scope;
14
+ /**
15
+ * Track in-flight async buffering operations per resource/thread.
16
+ * Key format: "obs:{lockKey}" or "refl:{lockKey}"
17
+ * Value: Promise that resolves when buffering completes
18
+ */
19
+ static asyncBufferingOps: Map<string, Promise<void>>;
20
+ /**
21
+ * Track the last token boundary at which we started buffering.
22
+ * Key format: "obs:{lockKey}" or "refl:{lockKey}"
23
+ */
24
+ static lastBufferedBoundary: Map<string, number>;
25
+ /**
26
+ * Track the timestamp cursor for buffered messages.
27
+ * Key format: "obs:{lockKey}"
28
+ */
29
+ static lastBufferedAtTime: Map<string, Date>;
30
+ /**
31
+ * Tracks cycleId for in-flight buffered reflections.
32
+ * Key format: "refl:{lockKey}"
33
+ */
34
+ static reflectionBufferCycleIds: Map<string, string>;
35
+ constructor(opts: {
36
+ observationConfig: ResolvedObservationConfig;
37
+ reflectionConfig: ResolvedReflectionConfig;
38
+ scope: 'thread' | 'resource';
39
+ });
40
+ getLockKey(threadId: string | null | undefined, resourceId: string | null | undefined): string;
41
+ isAsyncObservationEnabled(): boolean;
42
+ isAsyncReflectionEnabled(): boolean;
43
+ getObservationBufferKey(lockKey: string): string;
44
+ getReflectionBufferKey(lockKey: string): string;
45
+ isAsyncBufferingInProgress(bufferKey: string): boolean;
46
+ /**
47
+ * Clean up static maps for a thread/resource to prevent memory leaks.
48
+ */
49
+ cleanupStaticMaps(threadId: string, resourceId?: string | null, activatedMessageIds?: string[]): void;
50
+ /**
51
+ * Check if we've crossed a new bufferTokens interval boundary for async observation.
52
+ */
53
+ shouldTriggerAsyncObservation(currentTokens: number, lockKey: string, record: ObservationalMemoryRecord, storage?: {
54
+ setBufferingObservationFlag(id: string, flag: boolean): Promise<void>;
55
+ }, messageTokensThreshold?: number): boolean;
56
+ /**
57
+ * Await any in-flight async buffering operations for a given thread/resource.
58
+ */
59
+ static awaitBuffering(threadId: string | null | undefined, resourceId: string | null | undefined, scope: 'thread' | 'resource', timeoutMs?: number): Promise<void>;
60
+ }
61
+ //# sourceMappingURL=buffering-coordinator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buffering-coordinator.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/buffering-coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAItE,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnF;;;;;;GAMG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA4B;IAC9D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA2B;IAC5D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwB;IAE9C;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,6BAAoC;IAE5D;;;OAGG;IACH,MAAM,CAAC,oBAAoB,sBAA6B;IAExD;;;OAGG;IACH,MAAM,CAAC,kBAAkB,oBAA2B;IAEpD;;;OAGG;IACH,MAAM,CAAC,wBAAwB,sBAA6B;gBAEhD,IAAI,EAAE;QAChB,iBAAiB,EAAE,yBAAyB,CAAC;QAC7C,gBAAgB,EAAE,wBAAwB,CAAC;QAC3C,KAAK,EAAE,QAAQ,GAAG,UAAU,CAAC;KAC9B;IAMD,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM;IAO9F,yBAAyB,IAAI,OAAO;IAIpC,wBAAwB,IAAI,OAAO;IAInC,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIhD,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAI/C,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAItD;;OAEG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,mBAAmB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI;IAqBrG;;OAEG;IACH,6BAA6B,CAC3B,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,yBAAyB,EACjC,OAAO,CAAC,EAAE;QAAE,2BAA2B,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,EACnF,sBAAsB,CAAC,EAAE,MAAM,GAC9B,OAAO;IAgCV;;OAEG;WACU,cAAc,CACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACrC,KAAK,EAAE,QAAQ,GAAG,UAAU,EAC5B,SAAS,SAAQ,GAChB,OAAO,CAAC,IAAI,CAAC;CA6BjB"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Default configuration values matching the spec
3
+ */
4
+ export declare const OBSERVATIONAL_MEMORY_DEFAULTS: {
5
+ readonly observation: {
6
+ readonly model: "google/gemini-2.5-flash";
7
+ readonly messageTokens: 30000;
8
+ readonly modelSettings: {
9
+ readonly temperature: 0.3;
10
+ readonly maxOutputTokens: 100000;
11
+ };
12
+ readonly providerOptions: {
13
+ readonly google: {
14
+ readonly thinkingConfig: {
15
+ readonly thinkingBudget: 215;
16
+ };
17
+ };
18
+ };
19
+ readonly maxTokensPerBatch: 10000;
20
+ readonly bufferTokens: number | undefined;
21
+ readonly bufferActivation: number | undefined;
22
+ };
23
+ readonly reflection: {
24
+ readonly model: "google/gemini-2.5-flash";
25
+ readonly observationTokens: 40000;
26
+ readonly modelSettings: {
27
+ readonly temperature: 0;
28
+ readonly maxOutputTokens: 100000;
29
+ };
30
+ readonly providerOptions: {
31
+ readonly google: {
32
+ readonly thinkingConfig: {
33
+ readonly thinkingBudget: 1024;
34
+ };
35
+ };
36
+ };
37
+ readonly bufferActivation: number | undefined;
38
+ };
39
+ };
40
+ /**
41
+ * Continuation hint injected after observations to guide the model's behavior.
42
+ * Prevents the model from awkwardly acknowledging the memory system or treating
43
+ * the conversation as new after observed messages are removed.
44
+ */
45
+ export declare 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.";
46
+ /**
47
+ * Preamble that introduces the observations block.
48
+ * Use before `<observations>`, with instructions after.
49
+ * Full pattern: `${OBSERVATION_CONTEXT_PROMPT}\n\n<observations>\n${obs}\n</observations>\n\n${OBSERVATION_CONTEXT_INSTRUCTIONS}`
50
+ */
51
+ export declare const OBSERVATION_CONTEXT_PROMPT = "The following observations block contains your memory of past conversations with this user.";
52
+ /**
53
+ * Instructions that tell the model how to interpret and use observations.
54
+ * Place AFTER the `<observations>` block so the model sees the data before the rules.
55
+ */
56
+ export declare 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.";
57
+ /**
58
+ * Instructions for retrieval mode — explains observation-group ranges and the recall tool.
59
+ * Appended to context when `retrieval` is enabled.
60
+ */
61
+ export declare const OBSERVATION_RETRIEVAL_INSTRUCTIONS = "## Recall \u2014 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 \u2014 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** \u2014 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 \u2014 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 \u2014 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.";
62
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;+BAiBjB,MAAM,GAAG,SAAS;mCACd,MAAM,GAAG,SAAS;;;;;;;;;;;;;;;;mCAiBlB,MAAM,GAAG,SAAS;;CAErC,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,kdAM+B,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,gGAAgG,CAAC;AAExI;;;GAGG;AACH,eAAO,MAAM,gCAAgC,+oDAQyM,CAAC;AAEvP;;;GAGG;AACH,eAAO,MAAM,kCAAkC,gnGAwCuE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function omDebug(msg: string): void;
2
+ export declare function omError(msg: string, err?: unknown): void;
3
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/debug.ts"],"names":[],"mappings":"AAKA,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,QAOlC;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,QAIjD"}
@@ -10,10 +10,13 @@
10
10
  * - Observer: Extracts observations when history exceeds threshold
11
11
  * - Reflector: Condenses observations when they exceed threshold
12
12
  */
13
- export { ObservationalMemory, OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTINUATION_HINT, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTEXT_INSTRUCTIONS, type ObservationalMemoryConfig, type ObservationDebugEvent, type ObserveHooks, } from './observational-memory.js';
13
+ export { ObservationalMemory } from './observational-memory.js';
14
+ export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTINUATION_HINT, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTEXT_INSTRUCTIONS, } from './constants.js';
15
+ export { ObservationalMemoryProcessor } from './processor.js';
16
+ export type { MemoryContextProvider } from './processor.js';
14
17
  export { getObservationsAsOf } from './observation-utils.js';
15
18
  export { ModelByInputTokens, type ModelByInputTokensConfig } from './model-by-input-tokens.js';
16
- export type { ObservationConfig, ReflectionConfig, ObserverResult, ReflectorResult, DataOmBufferingStartPart, DataOmBufferingEndPart, DataOmBufferingFailedPart, DataOmBufferingPart, DataOmActivationPart, DataOmPart, } from './types.js';
19
+ export type { ObservationalMemoryConfig, ObservationDebugEvent, ObserveHooks, ObservationConfig, ReflectionConfig, ObserverResult, ReflectorResult, DataOmBufferingStartPart, DataOmBufferingEndPart, DataOmBufferingFailedPart, DataOmBufferingPart, DataOmActivationPart, DataOmPart, } from './types.js';
17
20
  export { OBSERVER_SYSTEM_PROMPT, buildObserverSystemPrompt, buildObserverPrompt, parseObserverOutput, optimizeObservationsForContext, formatMessagesForObserver, hasCurrentTaskSection, extractCurrentTask, type ObserverResult as ObserverAgentResult, } from './observer-agent.js';
18
21
  export type { ObservationalMemoryRecord, ObservationalMemoryScope, ObservationalMemoryOriginType, CreateObservationalMemoryInput, UpdateActiveObservationsInput, UpdateBufferedObservationsInput, CreateReflectionGenerationInput, } from '@mastra/core/storage';
19
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,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,gCAAgC,EAChC,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,YAAY,GAClB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,kBAAkB,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAE5F,YAAY,EACV,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,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"}
@@ -0,0 +1,69 @@
1
+ import type { MastraDBMessage, MessageList } from '@mastra/core/agent';
2
+ import type { BufferedObservationChunk, ObservationalMemoryRecord } from '@mastra/core/storage';
3
+ /**
4
+ * Find the index of the last completed observation boundary (end marker) in a message's parts.
5
+ * Returns -1 if no completed observation is found.
6
+ */
7
+ export declare function findLastCompletedObservationBoundary(message: MastraDBMessage): number;
8
+ /**
9
+ * Get unobserved parts from a message.
10
+ * If the message has a completed observation (start + end), only return parts after the end.
11
+ * If observation is in progress (start without end), include parts before the start.
12
+ * Otherwise, return all parts.
13
+ */
14
+ export declare function getUnobservedParts(message: MastraDBMessage): MastraDBMessage['content']['parts'];
15
+ /**
16
+ * Check if a message has any unobserved parts.
17
+ */
18
+ export declare function hasUnobservedParts(message: MastraDBMessage): boolean;
19
+ /**
20
+ * Compute a cursor pointing at the latest message by createdAt.
21
+ * Used to derive a stable observation boundary for replay pruning.
22
+ */
23
+ export declare function getLastObservedMessageCursor(messages: MastraDBMessage[]): {
24
+ createdAt: string;
25
+ id: string;
26
+ } | undefined;
27
+ /**
28
+ * Check if a message is at or before a cursor (by createdAt then id).
29
+ */
30
+ export declare function isMessageAtOrBeforeCursor(msg: MastraDBMessage, cursor: {
31
+ createdAt: string;
32
+ id: string;
33
+ }): boolean;
34
+ /**
35
+ * Safely extract buffered observation chunks from a record.
36
+ * Handles both array and JSON-string formats, returning empty array if malformed.
37
+ */
38
+ /**
39
+ * Filter out already-observed messages from the in-memory context.
40
+ * Uses marker-boundary pruning (preferred) or record-based fallback.
41
+ *
42
+ * The `fallbackCursor` is optional — callers that need it should resolve it
43
+ * from thread metadata before calling this function.
44
+ */
45
+ export declare function filterObservedMessages(opts: {
46
+ messageList: MessageList;
47
+ record?: ObservationalMemoryRecord;
48
+ useMarkerBoundaryPruning?: boolean;
49
+ fallbackCursor?: {
50
+ createdAt: string;
51
+ id: string;
52
+ };
53
+ }): void;
54
+ export declare function getBufferedChunks(record: ObservationalMemoryRecord | null | undefined): BufferedObservationChunk[];
55
+ /**
56
+ * Sort threads by their oldest unobserved message.
57
+ * Returns thread IDs in order from oldest to most recent.
58
+ */
59
+ /**
60
+ * Combine active and buffered observations for the buffering observer context.
61
+ */
62
+ export declare function combineObservationsForBuffering(activeObservations: string | undefined, bufferedObservations: string | undefined): string | undefined;
63
+ export declare function sortThreadsByOldestMessage(messagesByThread: Map<string, MastraDBMessage[]>): string[];
64
+ /**
65
+ * Strip any thread tags that the Observer might have added.
66
+ * Thread attribution is handled externally by the system, not by the Observer.
67
+ */
68
+ export declare function stripThreadTags(observations: string): string;
69
+ //# sourceMappingURL=message-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-utils.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/message-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEhG;;;GAGG;AACH,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAYrF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAoBhG;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAEpE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,eAAe,EAAE,GAC1B;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAS/C;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAMlH;AAED;;;GAGG;AACH;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CACpD,GAAG,IAAI,CAuEP;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,yBAAyB,GAAG,IAAI,GAAG,SAAS,GAAG,wBAAwB,EAAE,CAYlH;AAED;;;GAGG;AACH;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,kBAAkB,EAAE,MAAM,GAAG,SAAS,EACtC,oBAAoB,EAAE,MAAM,GAAG,SAAS,GACvC,MAAM,GAAG,SAAS,CAKpB;AAED,wBAAgB,0BAA0B,CAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,GAAG,MAAM,EAAE,CAQrG;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE5D"}
@@ -0,0 +1,33 @@
1
+ import type { MastraDBMessage } from '@mastra/core/agent';
2
+ import { ObservationStrategy } from './base.js';
3
+ import type { StrategyDeps } from './base.js';
4
+ import type { ObservationRunOpts, ObserverOutput, ProcessedObservation } from './types.js';
5
+ export declare class AsyncBufferObservationStrategy extends ObservationStrategy {
6
+ private readonly startedAt;
7
+ private readonly cycleId;
8
+ constructor(deps: StrategyDeps, opts: ObservationRunOpts);
9
+ get needsLock(): boolean;
10
+ get needsReflection(): boolean;
11
+ protected generateCycleId(): string;
12
+ prepare(): Promise<{
13
+ messages: MastraDBMessage[];
14
+ existingObservations: string;
15
+ }>;
16
+ emitStartMarkers(_cycleId: string): Promise<void>;
17
+ observe(existingObservations: string, messages: MastraDBMessage[]): Promise<{
18
+ observations: string;
19
+ currentTask?: string;
20
+ suggestedContinuation?: string;
21
+ threadTitle?: string;
22
+ usage?: {
23
+ inputTokens?: number;
24
+ outputTokens?: number;
25
+ totalTokens?: number;
26
+ };
27
+ }>;
28
+ process(output: ObserverOutput, _existingObservations: string): Promise<ProcessedObservation>;
29
+ persist(processed: ProcessedObservation): Promise<void>;
30
+ emitEndMarkers(_cycleId: string, processed: ProcessedObservation): Promise<void>;
31
+ emitFailedMarkers(_cycleId: string, error: unknown): Promise<void>;
32
+ }
33
+ //# sourceMappingURL=async-buffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-buffer.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/observation-strategies/async-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAQ1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAExF,qBAAa,8BAA+B,SAAQ,mBAAmB;IACrE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,kBAAkB;IAMxD,IAAI,SAAS,YAEZ;IACD,IAAI,eAAe,YAElB;cAEkB,eAAe,IAAI,MAAM;IAItC,OAAO;;;;IAQP,gBAAgB,CAAC,QAAQ,EAAE,MAAM;IAIjC,OAAO,CAAC,oBAAoB,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE;;;;;;uBAiCrE,CAAH;wBAAsB,CAAC;uBAAqB,CAAC;;;IA1BtC,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA0C7F,OAAO,CAAC,SAAS,EAAE,oBAAoB;IAsBvC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,oBAAoB;IAwBhE,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAiBzD"}