@mastra/memory 1.18.2 → 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 +8 -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 +5 -5
- package/dist/chunk-4AQHFADP.cjs.map +0 -1
- package/dist/chunk-LCALB7W6.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @mastra/memory
|
|
2
2
|
|
|
3
|
+
## 1.18.3-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat(memory): start background buffering of unobserved messages when agent goes idle ([#16694](https://github.com/mastra-ai/mastra/pull/16694))
|
|
8
|
+
|
|
9
|
+
In OM buffering mode, when the agent goes idle (turn.end()), any unobserved messages are now buffered in the background via a fire-and-forget buffer() call. This ensures observations are computed proactively rather than waiting for the next turn's step.prepare().
|
|
10
|
+
|
|
3
11
|
## 1.18.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -2447,7 +2447,12 @@ var ObservationTurn = class {
|
|
|
2447
2447
|
return this._currentStep;
|
|
2448
2448
|
}
|
|
2449
2449
|
/**
|
|
2450
|
-
* Finalize the turn: save any remaining messages and return the
|
|
2450
|
+
* Finalize the turn: save any remaining messages and return the current cached record.
|
|
2451
|
+
*
|
|
2452
|
+
* When async observation buffering is enabled and there are unobserved messages,
|
|
2453
|
+
* a background buffer operation is kicked off so that observations are computed
|
|
2454
|
+
* proactively while the agent is idle, rather than waiting for the next turn.
|
|
2455
|
+
* The returned record does not wait for that background buffering pass to finish.
|
|
2451
2456
|
*/
|
|
2452
2457
|
async end() {
|
|
2453
2458
|
if (this._ended) throw new Error("Turn already ended");
|
|
@@ -2458,6 +2463,24 @@ var ObservationTurn = class {
|
|
|
2458
2463
|
if (unsavedMessages.length > 0) {
|
|
2459
2464
|
await this.om.persistMessages(unsavedMessages, this.threadId, this.resourceId);
|
|
2460
2465
|
}
|
|
2466
|
+
if (this.om.buffering.isAsyncObservationEnabled()) {
|
|
2467
|
+
const allMessages = this.messageList.get.all.db();
|
|
2468
|
+
const record = this._record;
|
|
2469
|
+
const unobservedMessages = this.om.getUnobservedMessages(allMessages, record);
|
|
2470
|
+
if (unobservedMessages.length > 0) {
|
|
2471
|
+
void this.om.buffer({
|
|
2472
|
+
threadId: this.threadId,
|
|
2473
|
+
resourceId: this.resourceId,
|
|
2474
|
+
messages: unobservedMessages,
|
|
2475
|
+
record,
|
|
2476
|
+
writer: this.writer,
|
|
2477
|
+
requestContext: this.requestContext,
|
|
2478
|
+
observabilityContext: this.observabilityContext
|
|
2479
|
+
}).catch((err) => {
|
|
2480
|
+
omDebug(`[OM:turn.end] idle buffer failed: ${err?.message}`);
|
|
2481
|
+
});
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2461
2484
|
return { record: this._record };
|
|
2462
2485
|
}
|
|
2463
2486
|
/**
|
|
@@ -9737,5 +9760,5 @@ exports.stripEphemeralAnchorIds = stripEphemeralAnchorIds;
|
|
|
9737
9760
|
exports.stripObservationGroups = stripObservationGroups;
|
|
9738
9761
|
exports.truncateStringByTokens = truncateStringByTokens;
|
|
9739
9762
|
exports.wrapInObservationGroup = wrapInObservationGroup;
|
|
9740
|
-
//# sourceMappingURL=chunk-
|
|
9741
|
-
//# sourceMappingURL=chunk-
|
|
9763
|
+
//# sourceMappingURL=chunk-BK3AYI7X.cjs.map
|
|
9764
|
+
//# sourceMappingURL=chunk-BK3AYI7X.cjs.map
|