@mastra/memory 1.20.0-alpha.2 → 1.20.1-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 +30 -0
- package/dist/{chunk-BCWFD5J7.js → chunk-LXU26UVM.js} +18 -5
- package/dist/chunk-LXU26UVM.js.map +1 -0
- package/dist/{chunk-SMKIROLC.cjs → chunk-R2H7SJS2.cjs} +18 -5
- package/dist/chunk-R2H7SJS2.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +39 -39
- package/dist/docs/references/docs-memory-observational-memory.md +19 -0
- package/dist/docs/references/reference-memory-observational-memory.md +2 -0
- package/dist/index.cjs +14 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/{observational-memory-E6F7NKJP.js → observational-memory-GE5MP6W7.js} +3 -3
- package/dist/{observational-memory-E6F7NKJP.js.map → observational-memory-GE5MP6W7.js.map} +1 -1
- package/dist/{observational-memory-LGCWMUEM.cjs → observational-memory-L32TPJ5J.cjs} +26 -26
- package/dist/{observational-memory-LGCWMUEM.cjs.map → observational-memory-L32TPJ5J.cjs.map} +1 -1
- package/dist/processors/index.cjs +24 -24
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/observation-strategies/types.d.ts +4 -2
- package/dist/processors/observational-memory/observation-strategies/types.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-turn/turn.d.ts +5 -1
- package/dist/processors/observational-memory/observation-turn/turn.d.ts.map +1 -1
- package/dist/processors/observational-memory/observational-memory.d.ts +5 -1
- package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
- package/dist/processors/observational-memory/processor.d.ts.map +1 -1
- package/dist/processors/observational-memory/types.d.ts +11 -0
- package/dist/processors/observational-memory/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/chunk-BCWFD5J7.js.map +0 -1
- package/dist/chunk-SMKIROLC.cjs.map +0 -1
|
@@ -2411,6 +2411,8 @@ var ObservationTurn = class {
|
|
|
2411
2411
|
requestContext;
|
|
2412
2412
|
/** Optional observability context for nested OM spans. */
|
|
2413
2413
|
observabilityContext;
|
|
2414
|
+
/** Optional signal sender for processor-originated notifications. */
|
|
2415
|
+
sendSignal;
|
|
2414
2416
|
/** Current actor model for this step. Updated by the processor before prepare(). */
|
|
2415
2417
|
actorModelContext;
|
|
2416
2418
|
/** Processor-provided hooks for turn/step lifecycle integration. */
|
|
@@ -2420,6 +2422,8 @@ var ObservationTurn = class {
|
|
|
2420
2422
|
this.threadId = opts.threadId;
|
|
2421
2423
|
this.resourceId = opts.resourceId;
|
|
2422
2424
|
this.messageList = opts.messageList;
|
|
2425
|
+
this.sendSignal = opts.sendSignal;
|
|
2426
|
+
this.requestContext = opts.requestContext;
|
|
2423
2427
|
this.observabilityContext = opts.observabilityContext;
|
|
2424
2428
|
this.hooks = opts.hooks ?? {};
|
|
2425
2429
|
}
|
|
@@ -2509,7 +2513,9 @@ var ObservationTurn = class {
|
|
|
2509
2513
|
if (unsavedMessages.length > 0) {
|
|
2510
2514
|
await this.om.persistMessages(unsavedMessages, this.threadId, this.resourceId);
|
|
2511
2515
|
}
|
|
2512
|
-
|
|
2516
|
+
const asyncObservationEnabled = this.om.buffering.isAsyncObservationEnabled();
|
|
2517
|
+
const bufferOnIdle = this.om.getObservationConfig().bufferOnIdle;
|
|
2518
|
+
if (asyncObservationEnabled && bufferOnIdle) {
|
|
2513
2519
|
const allMessages = this.messageList.get.all.db();
|
|
2514
2520
|
const record = this._record;
|
|
2515
2521
|
const unobservedMessages = this.om.getUnobservedMessages(allMessages, record);
|
|
@@ -2520,8 +2526,11 @@ var ObservationTurn = class {
|
|
|
2520
2526
|
messages: unobservedMessages,
|
|
2521
2527
|
record,
|
|
2522
2528
|
writer: this.writer,
|
|
2529
|
+
sendSignal: this.sendSignal,
|
|
2523
2530
|
requestContext: this.requestContext,
|
|
2524
|
-
|
|
2531
|
+
currentModel: this.actorModelContext,
|
|
2532
|
+
observabilityContext: this.observabilityContext,
|
|
2533
|
+
skipMinimumTokenCheck: true
|
|
2525
2534
|
}).catch((err) => {
|
|
2526
2535
|
omDebug(`[OM:turn.end] idle buffer failed: ${err?.message}`);
|
|
2527
2536
|
});
|
|
@@ -7193,6 +7202,7 @@ Async buffering is enabled by default \u2014 this opt-out is only needed when us
|
|
|
7193
7202
|
config.observation?.bufferTokens ?? chunk3Q3LOVQP_cjs.OBSERVATIONAL_MEMORY_DEFAULTS.observation.bufferTokens,
|
|
7194
7203
|
config.observation?.messageTokens ?? chunk3Q3LOVQP_cjs.OBSERVATIONAL_MEMORY_DEFAULTS.observation.messageTokens
|
|
7195
7204
|
),
|
|
7205
|
+
bufferOnIdle: config.observation?.bufferOnIdle ?? false,
|
|
7196
7206
|
bufferActivation: asyncBufferingDisabled ? void 0 : config.observation?.bufferActivation ?? chunk3Q3LOVQP_cjs.OBSERVATIONAL_MEMORY_DEFAULTS.observation.bufferActivation,
|
|
7197
7207
|
activateAfterIdle: parseActivationTTL(observationActivateAfterIdle, observationActivateAfterIdlePath),
|
|
7198
7208
|
activateOnProviderChange: config.observation?.activateOnProviderChange ?? config.activateOnProviderChange ?? false,
|
|
@@ -9004,7 +9014,7 @@ ${grouped}` : grouped;
|
|
|
9004
9014
|
const bufferTokens = this.observationConfig.bufferTokens ?? 5e3;
|
|
9005
9015
|
const minNewTokens = bufferTokens / 2;
|
|
9006
9016
|
const newTokens = await this.tokenCounter.countMessagesAsync(candidateMessages);
|
|
9007
|
-
if (
|
|
9017
|
+
if (candidateMessages.length === 0 || !opts.skipMinimumTokenCheck && newTokens < minNewTokens) {
|
|
9008
9018
|
return { buffered: false, record };
|
|
9009
9019
|
}
|
|
9010
9020
|
if (opts.beforeBuffer) {
|
|
@@ -9037,7 +9047,9 @@ ${grouped}` : grouped;
|
|
|
9037
9047
|
cycleId,
|
|
9038
9048
|
startedAt,
|
|
9039
9049
|
writer,
|
|
9050
|
+
sendSignal: opts.sendSignal,
|
|
9040
9051
|
requestContext,
|
|
9052
|
+
currentModel: opts.currentModel,
|
|
9041
9053
|
observabilityContext
|
|
9042
9054
|
}).run();
|
|
9043
9055
|
if (isOmReproCaptureEnabled()) {
|
|
@@ -9723,6 +9735,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
9723
9735
|
}
|
|
9724
9736
|
});
|
|
9725
9737
|
this.turn.writer = writer;
|
|
9738
|
+
this.turn.sendSignal = args.sendSignal;
|
|
9726
9739
|
this.turn.requestContext = requestContext;
|
|
9727
9740
|
await this.turn.start(this.memory);
|
|
9728
9741
|
if (stepNumber === 0 && this.temporalMarkers) {
|
|
@@ -9883,5 +9896,5 @@ exports.stripEphemeralAnchorIds = stripEphemeralAnchorIds;
|
|
|
9883
9896
|
exports.stripObservationGroups = stripObservationGroups;
|
|
9884
9897
|
exports.truncateStringByTokens = truncateStringByTokens;
|
|
9885
9898
|
exports.wrapInObservationGroup = wrapInObservationGroup;
|
|
9886
|
-
//# sourceMappingURL=chunk-
|
|
9887
|
-
//# sourceMappingURL=chunk-
|
|
9899
|
+
//# sourceMappingURL=chunk-R2H7SJS2.cjs.map
|
|
9900
|
+
//# sourceMappingURL=chunk-R2H7SJS2.cjs.map
|