@mastra/memory 1.18.2-alpha.1 → 1.18.3-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 +47 -0
- package/dist/{chunk-4AQHFADP.cjs → chunk-BK3AYI7X.cjs} +26 -3
- package/dist/chunk-BK3AYI7X.cjs.map +1 -0
- package/dist/{chunk-LCALB7W6.js → chunk-KLETR4RS.js} +26 -3
- package/dist/chunk-KLETR4RS.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +39 -39
- package/dist/index.cjs +13 -13
- package/dist/index.js +4 -4
- package/dist/{observational-memory-SYNXJVL4.js → observational-memory-K5ES5KKQ.js} +3 -3
- package/dist/{observational-memory-SYNXJVL4.js.map → observational-memory-K5ES5KKQ.js.map} +1 -1
- package/dist/{observational-memory-7M2T5EOV.cjs → observational-memory-SRGNHILF.cjs} +26 -26
- package/dist/{observational-memory-7M2T5EOV.cjs.map → observational-memory-SRGNHILF.cjs.map} +1 -1
- package/dist/processors/index.cjs +24 -24
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/observation-turn/turn.d.ts +6 -1
- package/dist/processors/observational-memory/observation-turn/turn.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/chunk-4AQHFADP.cjs.map +0 -1
- package/dist/chunk-LCALB7W6.js.map +0 -1
|
@@ -2440,7 +2440,12 @@ var ObservationTurn = class {
|
|
|
2440
2440
|
return this._currentStep;
|
|
2441
2441
|
}
|
|
2442
2442
|
/**
|
|
2443
|
-
* Finalize the turn: save any remaining messages and return the
|
|
2443
|
+
* Finalize the turn: save any remaining messages and return the current cached record.
|
|
2444
|
+
*
|
|
2445
|
+
* When async observation buffering is enabled and there are unobserved messages,
|
|
2446
|
+
* a background buffer operation is kicked off so that observations are computed
|
|
2447
|
+
* proactively while the agent is idle, rather than waiting for the next turn.
|
|
2448
|
+
* The returned record does not wait for that background buffering pass to finish.
|
|
2444
2449
|
*/
|
|
2445
2450
|
async end() {
|
|
2446
2451
|
if (this._ended) throw new Error("Turn already ended");
|
|
@@ -2451,6 +2456,24 @@ var ObservationTurn = class {
|
|
|
2451
2456
|
if (unsavedMessages.length > 0) {
|
|
2452
2457
|
await this.om.persistMessages(unsavedMessages, this.threadId, this.resourceId);
|
|
2453
2458
|
}
|
|
2459
|
+
if (this.om.buffering.isAsyncObservationEnabled()) {
|
|
2460
|
+
const allMessages = this.messageList.get.all.db();
|
|
2461
|
+
const record = this._record;
|
|
2462
|
+
const unobservedMessages = this.om.getUnobservedMessages(allMessages, record);
|
|
2463
|
+
if (unobservedMessages.length > 0) {
|
|
2464
|
+
void this.om.buffer({
|
|
2465
|
+
threadId: this.threadId,
|
|
2466
|
+
resourceId: this.resourceId,
|
|
2467
|
+
messages: unobservedMessages,
|
|
2468
|
+
record,
|
|
2469
|
+
writer: this.writer,
|
|
2470
|
+
requestContext: this.requestContext,
|
|
2471
|
+
observabilityContext: this.observabilityContext
|
|
2472
|
+
}).catch((err) => {
|
|
2473
|
+
omDebug(`[OM:turn.end] idle buffer failed: ${err?.message}`);
|
|
2474
|
+
});
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2454
2477
|
return { record: this._record };
|
|
2455
2478
|
}
|
|
2456
2479
|
/**
|
|
@@ -9705,5 +9728,5 @@ function getObservationsAsOf(activeObservations, asOf) {
|
|
|
9705
9728
|
}
|
|
9706
9729
|
|
|
9707
9730
|
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 };
|
|
9708
|
-
//# sourceMappingURL=chunk-
|
|
9709
|
-
//# sourceMappingURL=chunk-
|
|
9731
|
+
//# sourceMappingURL=chunk-KLETR4RS.js.map
|
|
9732
|
+
//# sourceMappingURL=chunk-KLETR4RS.js.map
|