@mastra/memory 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/dist/{chunk-D4AWAGLM.js → chunk-DF7NDDSM.js} +282 -190
- package/dist/chunk-DF7NDDSM.js.map +1 -0
- package/dist/{chunk-QRKB5I2S.cjs → chunk-LLTHE64H.cjs} +281 -189
- package/dist/chunk-LLTHE64H.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +25 -25
- package/dist/docs/references/docs-memory-observational-memory.md +2 -0
- package/dist/docs/references/reference-memory-memory-class.md +1 -1
- package/dist/docs/references/reference-memory-observational-memory.md +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/{observational-memory-UCOMAMSF.cjs → observational-memory-4PCXEZIS.cjs} +17 -17
- package/dist/{observational-memory-UCOMAMSF.cjs.map → observational-memory-4PCXEZIS.cjs.map} +1 -1
- package/dist/{observational-memory-53AFLLSH.js → observational-memory-ZNTAIUGT.js} +3 -3
- package/dist/{observational-memory-53AFLLSH.js.map → observational-memory-ZNTAIUGT.js.map} +1 -1
- package/dist/processors/index.cjs +15 -15
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/observational-memory.d.ts +17 -1
- package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
- package/dist/processors/observational-memory/observer-agent.d.ts +26 -5
- package/dist/processors/observational-memory/observer-agent.d.ts.map +1 -1
- package/dist/processors/observational-memory/reflector-agent.d.ts.map +1 -1
- package/dist/processors/observational-memory/types.d.ts +14 -3
- package/dist/processors/observational-memory/types.d.ts.map +1 -1
- package/package.json +11 -11
- package/dist/chunk-D4AWAGLM.js.map +0 -1
- package/dist/chunk-QRKB5I2S.cjs.map +0 -1
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkLLTHE64H_cjs = require('./chunk-LLTHE64H.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "OBSERVATIONAL_MEMORY_DEFAULTS", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkLLTHE64H_cjs.OBSERVATIONAL_MEMORY_DEFAULTS; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "OBSERVATION_CONTEXT_INSTRUCTIONS", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkLLTHE64H_cjs.OBSERVATION_CONTEXT_INSTRUCTIONS; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "OBSERVATION_CONTEXT_PROMPT", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkLLTHE64H_cjs.OBSERVATION_CONTEXT_PROMPT; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "OBSERVATION_CONTINUATION_HINT", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkLLTHE64H_cjs.OBSERVATION_CONTINUATION_HINT; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "OBSERVER_SYSTEM_PROMPT", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkLLTHE64H_cjs.OBSERVER_SYSTEM_PROMPT; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "ObservationalMemory", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkLLTHE64H_cjs.ObservationalMemory; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "TokenCounter", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkLLTHE64H_cjs.TokenCounter; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "buildObserverPrompt", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkLLTHE64H_cjs.buildObserverPrompt; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "buildObserverSystemPrompt", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkLLTHE64H_cjs.buildObserverSystemPrompt; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "extractCurrentTask", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkLLTHE64H_cjs.extractCurrentTask; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "formatMessagesForObserver", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkLLTHE64H_cjs.formatMessagesForObserver; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "hasCurrentTaskSection", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkLLTHE64H_cjs.hasCurrentTaskSection; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "optimizeObservationsForContext", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkLLTHE64H_cjs.optimizeObservationsForContext; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "parseObserverOutput", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunkLLTHE64H_cjs.parseObserverOutput; }
|
|
62
62
|
});
|
|
63
|
-
//# sourceMappingURL=observational-memory-
|
|
64
|
-
//# sourceMappingURL=observational-memory-
|
|
63
|
+
//# sourceMappingURL=observational-memory-4PCXEZIS.cjs.map
|
|
64
|
+
//# sourceMappingURL=observational-memory-4PCXEZIS.cjs.map
|
package/dist/{observational-memory-UCOMAMSF.cjs.map → observational-memory-4PCXEZIS.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"observational-memory-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"observational-memory-4PCXEZIS.cjs"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, extractCurrentTask, formatMessagesForObserver, hasCurrentTaskSection, optimizeObservationsForContext, parseObserverOutput } from './chunk-
|
|
2
|
-
//# sourceMappingURL=observational-memory-
|
|
3
|
-
//# sourceMappingURL=observational-memory-
|
|
1
|
+
export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, extractCurrentTask, formatMessagesForObserver, hasCurrentTaskSection, optimizeObservationsForContext, parseObserverOutput } from './chunk-DF7NDDSM.js';
|
|
2
|
+
//# sourceMappingURL=observational-memory-ZNTAIUGT.js.map
|
|
3
|
+
//# sourceMappingURL=observational-memory-ZNTAIUGT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"observational-memory-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"observational-memory-ZNTAIUGT.js"}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkLLTHE64H_cjs = require('../chunk-LLTHE64H.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "OBSERVATIONAL_MEMORY_DEFAULTS", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkLLTHE64H_cjs.OBSERVATIONAL_MEMORY_DEFAULTS; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "OBSERVATION_CONTEXT_INSTRUCTIONS", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkLLTHE64H_cjs.OBSERVATION_CONTEXT_INSTRUCTIONS; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "OBSERVATION_CONTEXT_PROMPT", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkLLTHE64H_cjs.OBSERVATION_CONTEXT_PROMPT; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "OBSERVATION_CONTINUATION_HINT", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkLLTHE64H_cjs.OBSERVATION_CONTINUATION_HINT; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "OBSERVER_SYSTEM_PROMPT", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkLLTHE64H_cjs.OBSERVER_SYSTEM_PROMPT; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "ObservationalMemory", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkLLTHE64H_cjs.ObservationalMemory; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "TokenCounter", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkLLTHE64H_cjs.TokenCounter; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "buildObserverPrompt", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkLLTHE64H_cjs.buildObserverPrompt; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "buildObserverSystemPrompt", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkLLTHE64H_cjs.buildObserverSystemPrompt; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "extractCurrentTask", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkLLTHE64H_cjs.extractCurrentTask; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "formatMessagesForObserver", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkLLTHE64H_cjs.formatMessagesForObserver; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "hasCurrentTaskSection", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkLLTHE64H_cjs.hasCurrentTaskSection; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "optimizeObservationsForContext", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkLLTHE64H_cjs.optimizeObservationsForContext; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "parseObserverOutput", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunkLLTHE64H_cjs.parseObserverOutput; }
|
|
62
62
|
});
|
|
63
63
|
//# sourceMappingURL=index.cjs.map
|
|
64
64
|
//# sourceMappingURL=index.cjs.map
|
package/dist/processors/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, extractCurrentTask, formatMessagesForObserver, hasCurrentTaskSection, optimizeObservationsForContext, parseObserverOutput } from '../chunk-
|
|
1
|
+
export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, extractCurrentTask, formatMessagesForObserver, hasCurrentTaskSection, optimizeObservationsForContext, parseObserverOutput } from '../chunk-DF7NDDSM.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -193,7 +193,7 @@ export declare const OBSERVATION_CONTEXT_PROMPT = "The following observations bl
|
|
|
193
193
|
* Instructions that tell the model how to interpret and use observations.
|
|
194
194
|
* Place AFTER the `<observations>` block so the model sees the data before the rules.
|
|
195
195
|
*/
|
|
196
|
-
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.";
|
|
196
|
+
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.";
|
|
197
197
|
/**
|
|
198
198
|
* ObservationalMemory - A three-agent memory system for long conversations.
|
|
199
199
|
*
|
|
@@ -345,6 +345,18 @@ export declare class ObservationalMemory implements Processor<'observational-mem
|
|
|
345
345
|
* Handles cases where it might be a JSON string or undefined.
|
|
346
346
|
*/
|
|
347
347
|
private getBufferedChunks;
|
|
348
|
+
/**
|
|
349
|
+
* Resolve bufferActivation config into an absolute retention floor (tokens to keep).
|
|
350
|
+
* - Value in (0, 1]: ratio → retentionFloor = threshold * (1 - value)
|
|
351
|
+
* - Value >= 1000: absolute token count → retentionFloor = value
|
|
352
|
+
*/
|
|
353
|
+
private resolveRetentionFloor;
|
|
354
|
+
/**
|
|
355
|
+
* Convert bufferActivation to the equivalent ratio (0-1) for the storage layer.
|
|
356
|
+
* When bufferActivation >= 1000, it's an absolute retention target, so we compute
|
|
357
|
+
* the equivalent ratio: 1 - (bufferActivation / threshold).
|
|
358
|
+
*/
|
|
359
|
+
private resolveActivationRatio;
|
|
348
360
|
/**
|
|
349
361
|
* Calculate the projected message tokens that would be removed if activation happened now.
|
|
350
362
|
* This replicates the chunk boundary logic in swapBufferedToActive without actually activating.
|
|
@@ -353,6 +365,10 @@ export declare class ObservationalMemory implements Processor<'observational-mem
|
|
|
353
365
|
/**
|
|
354
366
|
* Check if we've crossed a new bufferTokens interval boundary.
|
|
355
367
|
* Returns true if async buffering should be triggered.
|
|
368
|
+
*
|
|
369
|
+
* When pending tokens are within ~1 bufferTokens of the observation threshold,
|
|
370
|
+
* the buffer interval is halved to produce finer-grained chunks right before
|
|
371
|
+
* activation. This improves chunk boundary selection, reducing overshoot.
|
|
356
372
|
*/
|
|
357
373
|
private shouldTriggerAsyncObservation;
|
|
358
374
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observational-memory.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/observational-memory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGpF,OAAO,KAAK,EACV,SAAS,EAET,oBAAoB,EACpB,uBAAuB,EAExB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAA4B,MAAM,sBAAsB,CAAC;AAkF/G,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,eAAe,EAWhB,MAAM,SAAS,CAAC;AAiOjB;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EACA,uBAAuB,GACvB,sBAAsB,GACtB,sBAAsB,GACtB,qBAAqB,GACrB,oBAAoB,GACpB,eA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,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;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,mpCAIsC,CAAC;AAEjF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,gGAAgG,CAAC;AAExI;;;GAGG;AACH,eAAO,MAAM,gCAAgC
|
|
1
|
+
{"version":3,"file":"observational-memory.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/observational-memory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGpF,OAAO,KAAK,EACV,SAAS,EAET,oBAAoB,EACpB,uBAAuB,EAExB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAA4B,MAAM,sBAAsB,CAAC;AAkF/G,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,eAAe,EAWhB,MAAM,SAAS,CAAC;AAiOjB;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EACA,uBAAuB,GACvB,sBAAsB,GACtB,sBAAsB,GACtB,qBAAqB,GACrB,oBAAoB,GACpB,eAAe,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,C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AAE,MAAM,EACnB,MAAM,CAAC,EAAE,MAAM,EACf,cAAc,CAAC,EAAE,cAAc,GAC9B,OAAO,CAAC,IAAI,CAAC;IAsChB;;OAEG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAMzF;;OAEG;IACG,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAKjG;;OAEG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,EAAE,CAAC;IAK7G;;OAEG;IACG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOjE;;OAEG;IACH,UAAU,IAAI,aAAa;IAI3B;;OAEG;IACH,eAAe,IAAI,YAAY;IAI/B;;OAEG;IACH,oBAAoB,IAAI,yBAAyB;IAIjD;;OAEG;IACH,mBAAmB,IAAI,wBAAwB;CAGhD"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import type { MastraDBMessage } from '@mastra/core/agent';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* The core extraction instructions for the Observer.
|
|
4
|
+
* This is exported so the Reflector can understand how observations were created.
|
|
5
|
+
*/
|
|
6
|
+
export declare const OBSERVER_EXTRACTION_INSTRUCTIONS = "CRITICAL: DISTINGUISH USER ASSERTIONS FROM QUESTIONS\n\nWhen the user TELLS you something about themselves, mark it as an assertion:\n- \"I have two kids\" \u2192 \uD83D\uDD34 (14:30) User stated has two kids\n- \"I work at Acme Corp\" \u2192 \uD83D\uDD34 (14:31) User stated works at Acme Corp\n- \"I graduated in 2019\" \u2192 \uD83D\uDD34 (14:32) User stated graduated in 2019\n\nWhen the user ASKS about something, mark it as a question/request:\n- \"Can you help me with X?\" \u2192 \uD83D\uDD34 (15:00) User asked help with X\n- \"What's the best way to do Y?\" \u2192 \uD83D\uDD34 (15:01) User asked best way to do Y\n\nDistinguish between QUESTIONS and STATEMENTS OF INTENT:\n- \"Can you recommend...\" \u2192 Question (extract as \"User asked...\")\n- \"I'm looking forward to [doing X]\" \u2192 Statement of intent (extract as \"User stated they will [do X] (include estimated/actual date if mentioned)\")\n- \"I need to [do X]\" \u2192 Statement of intent (extract as \"User stated they need to [do X] (again, add date if mentioned)\")\n\nSTATE CHANGES AND UPDATES:\nWhen a user indicates they are changing something, frame it as a state change that supersedes previous information:\n- \"I'm going to start doing X instead of Y\" \u2192 \"User will start doing X (changing from Y)\"\n- \"I'm switching from A to B\" \u2192 \"User is switching from A to B\"\n- \"I moved my stuff to the new place\" \u2192 \"User moved their stuff to the new place (no longer at previous location)\"\n\nIf the new state contradicts or updates previous information, make that explicit:\n- BAD: \"User plans to use the new method\"\n- GOOD: \"User will use the new method (replacing the old approach)\"\n\nThis helps distinguish current state from outdated information.\n\nUSER ASSERTIONS ARE AUTHORITATIVE. The user is the source of truth about their own life.\nIf a user previously stated something and later asks a question about the same topic,\nthe assertion is the answer - the question doesn't invalidate what they already told you.\n\nTEMPORAL ANCHORING:\nEach observation has TWO potential timestamps:\n\n1. BEGINNING: The time the statement was made (from the message timestamp) - ALWAYS include this\n2. END: The time being REFERENCED, if different from when it was said - ONLY when there's a relative time reference\n\nONLY add \"(meaning DATE)\" or \"(estimated DATE)\" at the END when you can provide an ACTUAL DATE:\n- Past: \"last week\", \"yesterday\", \"a few days ago\", \"last month\", \"in March\"\n- Future: \"this weekend\", \"tomorrow\", \"next week\"\n\nDO NOT add end dates for:\n- Present-moment statements with no time reference\n- Vague references like \"recently\", \"a while ago\", \"lately\", \"soon\" - these cannot be converted to actual dates\n\nFORMAT:\n- With time reference: (TIME) [observation]. (meaning/estimated DATE)\n- Without time reference: (TIME) [observation].\n\nGOOD: (09:15) User's friend had a birthday party in March. (meaning March 20XX)\n ^ References a past event - add the referenced date at the end\n\nGOOD: (09:15) User will visit their parents this weekend. (meaning June 17-18, 20XX)\n ^ References a future event - add the referenced date at the end\n\nGOOD: (09:15) User prefers hiking in the mountains.\n ^ Present-moment preference, no time reference - NO end date needed\n\nGOOD: (09:15) User is considering adopting a dog.\n ^ Present-moment thought, no time reference - NO end date needed\n\nBAD: (09:15) User prefers hiking in the mountains. (meaning June 15, 20XX - today)\n ^ No time reference in the statement - don't repeat the message timestamp at the end\n\nIMPORTANT: If an observation contains MULTIPLE events, split them into SEPARATE observation lines.\nEACH split observation MUST have its own date at the end - even if they share the same time context.\n\nExamples (assume message is from June 15, 20XX):\n\nBAD: User will visit their parents this weekend (meaning June 17-18, 20XX) and go to the dentist tomorrow.\nGOOD (split into two observations, each with its date):\n User will visit their parents this weekend. (meaning June 17-18, 20XX)\n User will go to the dentist tomorrow. (meaning June 16, 20XX)\n\nBAD: User needs to clean the garage this weekend and is looking forward to setting up a new workbench.\nGOOD (split, BOTH get the same date since they're related):\n User needs to clean the garage this weekend. (meaning June 17-18, 20XX)\n User will set up a new workbench this weekend. (meaning June 17-18, 20XX)\n\nBAD: User was given a gift by their friend (estimated late May 20XX) last month.\nGOOD: (09:15) User was given a gift by their friend last month. (estimated late May 20XX)\n ^ Message time at START, relative date reference at END - never in the middle\n\nBAD: User started a new job recently and will move to a new apartment next week.\nGOOD (split):\n User started a new job recently.\n User will move to a new apartment next week. (meaning June 21-27, 20XX)\n ^ \"recently\" is too vague for a date - omit the end date. \"next week\" can be calculated.\n\nALWAYS put the date at the END in parentheses - this is critical for temporal reasoning.\nWhen splitting related events that share the same time context, EACH observation must have the date.\n\nPRESERVE UNUSUAL PHRASING:\nWhen the user uses unexpected or non-standard terminology, quote their exact words.\n\nBAD: User exercised.\nGOOD: User stated they did a \"movement session\" (their term for exercise).\n\nUSE PRECISE ACTION VERBS:\nReplace vague verbs like \"getting\", \"got\", \"have\" with specific action verbs that clarify the nature of the action.\nIf the assistant confirms or clarifies the user's action, use the assistant's more precise language.\n\nBAD: User is getting X.\nGOOD: User subscribed to X. (if context confirms recurring delivery)\nGOOD: User purchased X. (if context confirms one-time acquisition)\n\nBAD: User got something.\nGOOD: User purchased / received / was given something. (be specific)\n\nCommon clarifications:\n- \"getting\" something regularly \u2192 \"subscribed to\" or \"enrolled in\"\n- \"getting\" something once \u2192 \"purchased\" or \"acquired\"\n- \"got\" \u2192 \"purchased\", \"received as gift\", \"was given\", \"picked up\"\n- \"signed up\" \u2192 \"enrolled in\", \"registered for\", \"subscribed to\"\n- \"stopped getting\" \u2192 \"canceled\", \"unsubscribed from\", \"discontinued\"\n\nWhen the assistant interprets or confirms the user's vague language, prefer the assistant's precise terminology.\n\nPRESERVING DETAILS IN ASSISTANT-GENERATED CONTENT:\n\nWhen the assistant provides lists, recommendations, or creative content that the user explicitly requested,\npreserve the DISTINGUISHING DETAILS that make each item unique and queryable later.\n\n1. RECOMMENDATION LISTS - Preserve the key attribute that distinguishes each item:\n BAD: Assistant recommended 5 hotels in the city.\n GOOD: Assistant recommended hotels: Hotel A (near the train station), Hotel B (budget-friendly), \n Hotel C (has rooftop pool), Hotel D (pet-friendly), Hotel E (historic building).\n \n BAD: Assistant listed 3 online stores for craft supplies.\n GOOD: Assistant listed craft stores: Store A (based in Germany, ships worldwide), \n Store B (specializes in vintage fabrics), Store C (offers bulk discounts).\n\n2. NAMES, HANDLES, AND IDENTIFIERS - Always preserve specific identifiers:\n BAD: Assistant provided social media accounts for several photographers.\n GOOD: Assistant provided photographer accounts: @photographer_one (portraits), \n @photographer_two (landscapes), @photographer_three (nature).\n \n BAD: Assistant listed some authors to check out.\n GOOD: Assistant recommended authors: Jane Smith (mystery novels), \n Bob Johnson (science fiction), Maria Garcia (historical romance).\n\n3. CREATIVE CONTENT - Preserve structure and key sequences:\n BAD: Assistant wrote a poem with multiple verses.\n GOOD: Assistant wrote a 3-verse poem. Verse 1 theme: loss. Verse 2 theme: hope. \n Verse 3 theme: renewal. Refrain: \"The light returns.\"\n \n BAD: User shared their lucky numbers from a fortune cookie.\n GOOD: User's fortune cookie lucky numbers: 7, 14, 23, 38, 42, 49.\n\n4. TECHNICAL/NUMERICAL RESULTS - Preserve specific values:\n BAD: Assistant explained the performance improvements from the optimization.\n GOOD: Assistant explained the optimization achieved 43.7% faster load times \n and reduced memory usage from 2.8GB to 940MB.\n \n BAD: Assistant provided statistics about the dataset.\n GOOD: Assistant provided dataset stats: 7,342 samples, 89.6% accuracy, \n 23ms average inference time.\n\n5. QUANTITIES AND COUNTS - Always preserve how many of each item:\n BAD: Assistant listed items with details but no quantities.\n GOOD: Assistant listed items: Item A (4 units, size large), Item B (2 units, size small).\n \n When listing items with attributes, always include the COUNT first before other details.\n\n6. ROLE/PARTICIPATION STATEMENTS - When user mentions their role at an event:\n BAD: User attended the company event.\n GOOD: User was a presenter at the company event.\n \n BAD: User went to the fundraiser.\n GOOD: User volunteered at the fundraiser (helped with registration).\n \n Always capture specific roles: presenter, organizer, volunteer, team lead, \n coordinator, participant, contributor, helper, etc.\n\nCONVERSATION CONTEXT:\n- What the user is working on or asking about\n- Previous topics and their outcomes\n- What user understands or needs clarification on\n- Specific requirements or constraints mentioned\n- Contents of assistant learnings and summaries\n- Answers to users questions including full context to remember detailed summaries and explanations\n- Assistant explanations, especially complex ones. observe the fine details so that the assistant does not forget what they explained\n- Relevant code snippets\n- User preferences (like favourites, dislikes, preferences, etc)\n- Any specifically formatted text or ascii that would need to be reproduced or referenced in later interactions (preserve these verbatim in memory)\n- Sequences, units, measurements, and any kind of specific relevant data\n- Any blocks of any text which the user and assistant are iteratively collaborating back and forth on should be preserved verbatim\n- When who/what/where/when is mentioned, note that in the observation. Example: if the user received went on a trip with someone, observe who that someone was, where the trip was, when it happened, and what happened, not just that the user went on the trip.\n- For any described entity (like a person, place, thing, etc), preserve the attributes that would help identify or describe the specific entity later: location (\"near X\"), specialty (\"focuses on Y\"), unique feature (\"has Z\"), relationship (\"owned by W\"), or other details. The entity's name is important, but so are any additional details that distinguish it. If there are a list of entities, preserve these details for each of them.\n\nUSER MESSAGE CAPTURE:\n- Short and medium-length user messages should be captured nearly verbatim in your own words.\n- For very long user messages, summarize but quote key phrases that carry specific intent or meaning.\n- This is critical for continuity: when the conversation window shrinks, the observations are the only record of what the user said.\n\nAVOIDING REPETITIVE OBSERVATIONS:\n- Do NOT repeat the same observation across multiple turns if there is no new information.\n- When the agent performs repeated similar actions (e.g., browsing files, running the same tool type multiple times), group them into a single parent observation with sub-bullets for each new result.\n\nExample \u2014 BAD (repetitive):\n* \uD83D\uDFE1 (14:30) Agent used view tool on src/auth.ts\n* \uD83D\uDFE1 (14:31) Agent used view tool on src/users.ts\n* \uD83D\uDFE1 (14:32) Agent used view tool on src/routes.ts\n\nExample \u2014 GOOD (grouped):\n* \uD83D\uDFE1 (14:30) Agent browsed source files for auth flow\n * -> viewed src/auth.ts \u2014 found token validation logic\n * -> viewed src/users.ts \u2014 found user lookup by email\n * -> viewed src/routes.ts \u2014 found middleware chain\n\nOnly add a new observation for a repeated action if the NEW result changes the picture.\n\nACTIONABLE INSIGHTS:\n- What worked well in explanations\n- What needs follow-up or clarification\n- User's stated goals or next steps (note if the user tells you not to do a next step, or asks for something specific, other next steps besides the users request should be marked as \"waiting for user\", unless the user explicitly says to continue all next steps)";
|
|
7
|
+
/**
|
|
8
|
+
* The output format instructions for the Observer.
|
|
9
|
+
* This is exported so the Reflector can use the same format.
|
|
5
10
|
*/
|
|
6
|
-
export declare const OBSERVER_EXTRACTION_INSTRUCTIONS: string;
|
|
7
11
|
/**
|
|
8
12
|
* Base output format for Observer (without patterns section)
|
|
9
13
|
*/
|
|
10
|
-
export declare const OBSERVER_OUTPUT_FORMAT_BASE = "Use priority levels:\n- \uD83D\uDD34 High: explicit user facts, preferences, goals achieved, critical context\n- \uD83D\uDFE1 Medium: project details, learned information, tool results\n- \uD83D\uDFE2 Low: minor details, uncertain observations\n\nGroup related observations (like tool sequences) by indenting:\n* \uD83D\
|
|
14
|
+
export declare const OBSERVER_OUTPUT_FORMAT_BASE = "Use priority levels:\n- \uD83D\uDD34 High: explicit user facts, preferences, goals achieved, critical context\n- \uD83D\uDFE1 Medium: project details, learned information, tool results\n- \uD83D\uDFE2 Low: minor details, uncertain observations\n\nGroup related observations (like tool sequences) by indenting:\n* \uD83D\uDD34 (14:33) Agent debugging auth issue\n * -> ran git status, found 3 modified files\n * -> viewed auth.ts:45-60, found missing null check\n * -> applied fix, tests now pass\n\nGroup observations by date, then list each with 24-hour time.\n\n<observations>\nDate: Dec 4, 2025\n* \uD83D\uDD34 (14:30) User prefers direct answers\n* \uD83D\uDD34 (14:31) Working on feature X\n* \uD83D\uDFE1 (14:32) User might prefer dark mode\n\nDate: Dec 5, 2025\n* \uD83D\uDD34 (09:15) Continued work on feature X\n</observations>\n\n<current-task>\nState the current task(s) explicitly. Can be single or multiple:\n- Primary: What the agent is currently working on\n- Secondary: Other pending tasks (mark as \"waiting for user\" if appropriate)\n\nIf the agent started doing something without user approval, note that it's off-task.\n</current-task>\n\n<suggested-response>\nHint for the agent's immediate next message. Examples:\n- \"I've updated the navigation model. Let me walk you through the changes...\"\n- \"The assistant should wait for the user to respond before continuing.\"\n- Call the view tool on src/example.ts to continue debugging.\n</suggested-response>";
|
|
11
15
|
/**
|
|
12
16
|
* The guidelines for the Observer.
|
|
13
17
|
* This is exported so the Reflector can reference them.
|
|
14
18
|
*/
|
|
15
|
-
export declare const OBSERVER_GUIDELINES:
|
|
19
|
+
export declare const OBSERVER_GUIDELINES = "- Be specific enough for the assistant to act on\n- Good: \"User prefers short, direct answers without lengthy explanations\"\n- Bad: \"User stated a preference\" (too vague)\n- Add 1 to 5 observations per exchange\n- Use terse language to save tokens. Sentences should be dense without unnecessary words\n- Do not add repetitive observations that have already been observed. Group repeated similar actions (tool calls, file browsing) under a single parent with sub-bullets for new results\n- If the agent calls tools, observe what was called, why, and what was learned\n- When observing files with line numbers, include the line number if useful\n- If the agent provides a detailed response, observe the contents so it could be repeated\n- Make sure you start each observation with a priority emoji (\uD83D\uDD34, \uD83D\uDFE1, \uD83D\uDFE2)\n- User messages are always \uD83D\uDD34 priority, so are the completions of tasks. Capture the user's words closely \u2014 short/medium messages near-verbatim, long messages summarized with key quotes\n- Observe WHAT the agent did and WHAT it means\n- If the user provides detailed messages or code snippets, observe all important details";
|
|
16
20
|
/**
|
|
17
21
|
* Build the complete observer system prompt.
|
|
18
22
|
* @param multiThread - Whether this is for multi-thread batched observation (default: false)
|
|
@@ -39,6 +43,8 @@ export interface ObserverResult {
|
|
|
39
43
|
suggestedContinuation?: string;
|
|
40
44
|
/** Raw output from the model (for debugging) */
|
|
41
45
|
rawOutput?: string;
|
|
46
|
+
/** True if the output was detected as degenerate (repetition loop) and should be discarded/retried */
|
|
47
|
+
degenerate?: boolean;
|
|
42
48
|
}
|
|
43
49
|
/**
|
|
44
50
|
* Format messages for the Observer's input.
|
|
@@ -64,6 +70,8 @@ export interface MultiThreadObserverResult {
|
|
|
64
70
|
threads: Map<string, ObserverResult>;
|
|
65
71
|
/** Raw output from the model (for debugging) */
|
|
66
72
|
rawOutput: string;
|
|
73
|
+
/** True if the output was detected as degenerate (repetition loop) and should be discarded/retried */
|
|
74
|
+
degenerate?: boolean;
|
|
67
75
|
}
|
|
68
76
|
/**
|
|
69
77
|
* Parse multi-thread Observer output to extract per-thread results.
|
|
@@ -94,6 +102,19 @@ interface ParsedMemorySection {
|
|
|
94
102
|
* Extracts content from <observations>, <current-task>, and <suggested-response> tags.
|
|
95
103
|
*/
|
|
96
104
|
export declare function parseMemorySectionXml(content: string): ParsedMemorySection;
|
|
105
|
+
/**
|
|
106
|
+
* Truncate individual observation lines that exceed the maximum length.
|
|
107
|
+
*/
|
|
108
|
+
export declare function sanitizeObservationLines(observations: string): string;
|
|
109
|
+
/**
|
|
110
|
+
* Detect degenerate repetition in observer/reflector output.
|
|
111
|
+
* Returns true if the text contains suspicious levels of repeated content,
|
|
112
|
+
* which indicates an LLM repeat-penalty bug (e.g., Gemini Flash looping).
|
|
113
|
+
*
|
|
114
|
+
* Strategy: sample sequential chunks of the text and check if a high
|
|
115
|
+
* proportion are near-identical to previous chunks.
|
|
116
|
+
*/
|
|
117
|
+
export declare function detectDegenerateRepetition(text: string): boolean;
|
|
97
118
|
/**
|
|
98
119
|
* Check if observations contain a Current Task section.
|
|
99
120
|
* Supports both XML format and legacy markdown format.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observer-agent.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/observer-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"observer-agent.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/observer-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,gCAAgC,0gZAwNyN,CAAC;AAEvQ;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,2BAA2B,+8CAoClB,CAAC;AAEvB;;;GAGG;AACH,eAAO,MAAM,mBAAmB,mqCAYyD,CAAC;AAE1F;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,GAAE,OAAe,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAyFpG;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,QAA8B,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;IAErB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,mDAAmD;IACnD,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,sGAAsG;I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;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAsC1E;AA4BD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAWrE;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAgChE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAenE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUtE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAoB3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflector-agent.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/reflector-agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reflector-agent.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/reflector-agent.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEtE;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CA8FvE;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAA+B,CAAC;AAEpE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,CA8C9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,QAA0B,CAAC;AAEhE;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,MAAM,EACrB,gBAAgB,CAAC,EAAE,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAC1C,qBAAqB,CAAC,EAAE,OAAO,GAC9B,MAAM,CAgCR;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAoBpE;AAsED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAG7F"}
|
|
@@ -100,12 +100,21 @@ export interface ObservationConfig {
|
|
|
100
100
|
*/
|
|
101
101
|
bufferTokens?: number | false;
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
103
|
+
* Controls how many raw message tokens to retain after activation.
|
|
104
|
+
*
|
|
105
|
+
* - **Ratio (0 < value <= 1):** fraction of `messageTokens` to activate.
|
|
106
|
+
* The retention floor is `messageTokens * (1 - ratio)`.
|
|
107
|
+
* e.g. `0.8` with `messageTokens: 30000` → retain ~6000 tokens.
|
|
108
|
+
*
|
|
109
|
+
* - **Absolute (value >= 1000):** exact number of message tokens to retain.
|
|
110
|
+
* e.g. `3000` → always aim to keep ~3000 tokens of raw message history.
|
|
111
|
+
* Must be less than `messageTokens`.
|
|
112
|
+
*
|
|
113
|
+
* Values between 1 and 1000 are invalid.
|
|
105
114
|
*
|
|
106
115
|
* Requires `bufferTokens` to also be set.
|
|
107
116
|
*
|
|
108
|
-
* @default 0.8 (
|
|
117
|
+
* @default 0.8 (retain ~20% of messageTokens as raw messages)
|
|
109
118
|
*/
|
|
110
119
|
bufferActivation?: number;
|
|
111
120
|
/**
|
|
@@ -207,6 +216,8 @@ export interface ReflectorResult {
|
|
|
207
216
|
observations: string;
|
|
208
217
|
/** Suggested continuation for the Actor */
|
|
209
218
|
suggestedContinuation?: string;
|
|
219
|
+
/** True if the output was detected as degenerate (repetition loop) and should be discarded/retried */
|
|
220
|
+
degenerate?: boolean;
|
|
210
221
|
}
|
|
211
222
|
/**
|
|
212
223
|
* Config snapshot included in observation markers for debugging.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AAE5E;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,gCAAgC,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,cAAc,CAAC,EAAE;QACf,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,CAAC;IACF,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAE7B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;;OAGG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;;;;;;;;;;;OAcG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAE9B
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AAE5E;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,gCAAgC,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,cAAc,CAAC,EAAE;QACf,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,CAAC;IACF,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAE7B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;;OAGG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,CA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MAAM,CAAC;QAEjB,uBAAuB;QACvB,QAAQ,EAAE,MAAM,CAAC;QAEjB,0CAA0C;QAC1C,eAAe,EAAE,MAAM,CAAC;QAExB,4CAA4C;QAC5C,MAAM,EAAE,uBAAuB,CAAC;QAEhC,qEAAqE;QACrE,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC7B,0BAA0B,GAC1B,wBAAwB,GACxB,2BAA2B,GAC3B,gBAAgB,CAAC;AAErB;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,qBAAqB,GAAG,mBAAmB,GAAG,oBAAoB,CAAC;AAE5F;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,kBAAkB,CAAC;IACzB,IAAI,EAAE;QACJ,qCAAqC;QACrC,UAAU,EAAE,MAAM,CAAC;QAEnB,6DAA6D;QAC7D,cAAc,EAAE,MAAM,CAAC;QAEvB,qDAAqD;QACrD,iBAAiB,EAAE,MAAM,CAAC;QAE1B,mDAAmD;QACnD,QAAQ,EAAE,MAAM,CAAC;QAEjB,uBAAuB;QACvB,QAAQ,EAAE,MAAM,CAAC;QAEjB,4EAA4E;QAC5E,SAAS,EAAE,MAAM,EAAE,CAAC;QAEpB,6DAA6D;QAC7D,MAAM,CAAC,EAAE,uBAAuB,CAAC;KAClC,CAAC;CACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/memory",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"json-schema": "^0.4.0",
|
|
42
42
|
"lru-cache": "^11.2.6",
|
|
43
43
|
"xxhash-wasm": "^1.1.0",
|
|
44
|
-
"@mastra/schema-compat": "1.1.
|
|
44
|
+
"@mastra/schema-compat": "1.1.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@ai-sdk/openai": "^1.3.24",
|
|
@@ -49,19 +49,19 @@
|
|
|
49
49
|
"@types/json-schema": "^7.0.15",
|
|
50
50
|
"@types/lru-cache": "^7.10.10",
|
|
51
51
|
"@types/node": "22.19.7",
|
|
52
|
-
"@vitest/coverage-v8": "4.0.
|
|
53
|
-
"@vitest/ui": "4.0.
|
|
52
|
+
"@vitest/coverage-v8": "4.0.18",
|
|
53
|
+
"@vitest/ui": "4.0.18",
|
|
54
54
|
"eslint": "^9.37.0",
|
|
55
55
|
"tsup": "^8.5.1",
|
|
56
56
|
"typescript": "^5.9.3",
|
|
57
57
|
"typescript-eslint": "^8.51.0",
|
|
58
|
-
"vitest": "4.0.
|
|
59
|
-
"@internal/ai-sdk-v4": "0.0.
|
|
60
|
-
"@internal/ai-sdk-v5": "0.0.
|
|
61
|
-
"@internal/
|
|
62
|
-
"@internal/
|
|
63
|
-
"@internal/
|
|
64
|
-
"@mastra/core": "1.
|
|
58
|
+
"vitest": "4.0.18",
|
|
59
|
+
"@internal/ai-sdk-v4": "0.0.8",
|
|
60
|
+
"@internal/ai-sdk-v5": "0.0.8",
|
|
61
|
+
"@internal/ai-v6": "0.0.8",
|
|
62
|
+
"@internal/types-builder": "0.0.36",
|
|
63
|
+
"@internal/lint": "0.0.61",
|
|
64
|
+
"@mastra/core": "1.6.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"@mastra/core": ">=1.4.1-0 <2.0.0-0",
|