@mastra/memory 1.13.1 → 1.13.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/{chunk-HNVSYZRA.cjs → chunk-4FMHSWZD.cjs} +23 -19
- package/dist/chunk-4FMHSWZD.cjs.map +1 -0
- package/dist/{chunk-SWCWXIDJ.js → chunk-C7PARRAD.js} +23 -19
- package/dist/chunk-C7PARRAD.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +39 -39
- package/dist/index.cjs +12 -12
- package/dist/index.js +4 -4
- package/dist/{observational-memory-4VT6QEB7.cjs → observational-memory-5YDQLKHE.cjs} +26 -26
- package/dist/{observational-memory-4VT6QEB7.cjs.map → observational-memory-5YDQLKHE.cjs.map} +1 -1
- package/dist/{observational-memory-74TRS2R6.js → observational-memory-B7AUSTEY.js} +3 -3
- package/dist/{observational-memory-74TRS2R6.js.map → observational-memory-B7AUSTEY.js.map} +1 -1
- package/dist/processors/index.cjs +24 -24
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/observation-turn/step.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-HNVSYZRA.cjs.map +0 -1
- package/dist/chunk-SWCWXIDJ.js.map +0 -1
|
@@ -2023,6 +2023,26 @@ var ObservationStep = class {
|
|
|
2023
2023
|
if (statusSnapshot.shouldBuffer && !hasIncompleteToolCalls) {
|
|
2024
2024
|
const allMessages = messageList.get.all.db();
|
|
2025
2025
|
const unobservedMessages = om.getUnobservedMessages(allMessages, statusSnapshot.record);
|
|
2026
|
+
const candidates = om.getUnobservedMessages(unobservedMessages, statusSnapshot.record, {
|
|
2027
|
+
excludeBuffered: true
|
|
2028
|
+
});
|
|
2029
|
+
if (candidates.length > 0) {
|
|
2030
|
+
om.sealMessagesForBuffering(candidates);
|
|
2031
|
+
try {
|
|
2032
|
+
await this.turn.hooks?.onBufferChunkSealed?.();
|
|
2033
|
+
} catch (error) {
|
|
2034
|
+
omDebug(
|
|
2035
|
+
`[OM:buffer] onBufferChunkSealed hook failed: ${error instanceof Error ? error.message : String(error)}`
|
|
2036
|
+
);
|
|
2037
|
+
}
|
|
2038
|
+
if (this.turn.memory) {
|
|
2039
|
+
await this.turn.memory.persistMessages(candidates);
|
|
2040
|
+
}
|
|
2041
|
+
messageList.removeByIds(candidates.map((msg) => msg.id));
|
|
2042
|
+
for (const msg of candidates) {
|
|
2043
|
+
messageList.add(msg, "memory");
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2026
2046
|
void om.buffer({
|
|
2027
2047
|
threadId,
|
|
2028
2048
|
resourceId,
|
|
@@ -2031,23 +2051,7 @@ var ObservationStep = class {
|
|
|
2031
2051
|
record: statusSnapshot.record,
|
|
2032
2052
|
writer: this.turn.writer,
|
|
2033
2053
|
requestContext: this.turn.requestContext,
|
|
2034
|
-
observabilityContext: this.turn.observabilityContext
|
|
2035
|
-
beforeBuffer: async (candidates) => {
|
|
2036
|
-
if (candidates.length === 0) {
|
|
2037
|
-
return;
|
|
2038
|
-
}
|
|
2039
|
-
om.sealMessagesForBuffering(candidates);
|
|
2040
|
-
try {
|
|
2041
|
-
await this.turn.hooks?.onBufferChunkSealed?.();
|
|
2042
|
-
} catch (error) {
|
|
2043
|
-
omDebug(
|
|
2044
|
-
`[OM:buffer] onBufferChunkSealed hook failed: ${error instanceof Error ? error.message : String(error)}`
|
|
2045
|
-
);
|
|
2046
|
-
}
|
|
2047
|
-
if (this.turn.memory) {
|
|
2048
|
-
await this.turn.memory.persistMessages(candidates);
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2054
|
+
observabilityContext: this.turn.observabilityContext
|
|
2051
2055
|
}).catch((err) => {
|
|
2052
2056
|
omDebug(`[OM:buffer] fire-and-forget buffer failed: ${err?.message}`);
|
|
2053
2057
|
});
|
|
@@ -8559,5 +8563,5 @@ function getObservationsAsOf(activeObservations, asOf) {
|
|
|
8559
8563
|
}
|
|
8560
8564
|
|
|
8561
8565
|
export { ModelByInputTokens, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, formatToolResultForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, resolveToolResultValue, stripEphemeralAnchorIds, stripObservationGroups, truncateStringByTokens, wrapInObservationGroup };
|
|
8562
|
-
//# sourceMappingURL=chunk-
|
|
8563
|
-
//# sourceMappingURL=chunk-
|
|
8566
|
+
//# sourceMappingURL=chunk-C7PARRAD.js.map
|
|
8567
|
+
//# sourceMappingURL=chunk-C7PARRAD.js.map
|