@mastra/memory 1.17.3 → 1.17.4

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 1.17.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed idle timeout and provider-change observation activations blocking on in-progress reflection buffering. These triggers now return immediately, letting the background reflection complete asynchronously. ([#15937](https://github.com/mastra-ai/mastra/pull/15937))
8
+
9
+ - Updated dependencies [[`920c757`](https://github.com/mastra-ai/mastra/commit/920c75799c6bd71787d86deaf654a35af4c839ca), [`d587199`](https://github.com/mastra-ai/mastra/commit/d5871993c0371bde2b0717d6b47194755baa1443), [`1fe2533`](https://github.com/mastra-ai/mastra/commit/1fe2533c4382ca6858aac7c4b63e888c2eac6541), [`f8694b6`](https://github.com/mastra-ai/mastra/commit/f8694b6fa0b7a5cde71d794c3bbef4957c55bcb8)]:
10
+ - @mastra/core@1.30.0
11
+
12
+ ## 1.17.4-alpha.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Fixed idle timeout and provider-change observation activations blocking on in-progress reflection buffering. These triggers now return immediately, letting the background reflection complete asynchronously. ([#15937](https://github.com/mastra-ai/mastra/pull/15937))
17
+
18
+ - Updated dependencies [[`d587199`](https://github.com/mastra-ai/mastra/commit/d5871993c0371bde2b0717d6b47194755baa1443)]:
19
+ - @mastra/core@1.29.2-alpha.0
20
+
3
21
  ## 1.17.3
4
22
 
5
23
  ### Patch Changes
@@ -4617,13 +4617,19 @@ var ReflectorRunner = class {
4617
4617
  const bufferKey = this.buffering.getReflectionBufferKey(lockKey);
4618
4618
  const asyncOp = BufferingCoordinator.asyncBufferingOps.get(bufferKey);
4619
4619
  if (asyncOp) {
4620
- omDebug(`[OM:reflect] tryActivateBufferedReflection: waiting for in-progress op...`);
4621
- try {
4622
- await Promise.race([
4623
- asyncOp,
4624
- new Promise((_, reject) => setTimeout(() => reject(new Error("Timeout")), 6e4))
4625
- ]);
4626
- } catch {
4620
+ if (activationMetadata?.triggeredBy === "ttl" || activationMetadata?.triggeredBy === "provider_change") {
4621
+ omDebug(
4622
+ `[OM:reflect] tryActivateBufferedReflection: async op in progress, not blocking for ${activationMetadata.triggeredBy} trigger`
4623
+ );
4624
+ } else {
4625
+ omDebug(`[OM:reflect] tryActivateBufferedReflection: waiting for in-progress op...`);
4626
+ try {
4627
+ await Promise.race([
4628
+ asyncOp,
4629
+ new Promise((_, reject) => setTimeout(() => reject(new Error("Timeout")), 5e3))
4630
+ ]);
4631
+ } catch {
4632
+ }
4627
4633
  }
4628
4634
  }
4629
4635
  const freshRecord = await this.storage.getObservationalMemory(record.threadId, record.resourceId);
@@ -9164,6 +9170,15 @@ var ObservationalMemoryProcessor = class {
9164
9170
  if (readOnly) {
9165
9171
  return messageList;
9166
9172
  }
9173
+ const activeTurn = state.__omTurn ?? this.turn;
9174
+ if (activeTurn && activeTurn.messageList !== messageList) {
9175
+ await activeTurn.end().catch(() => {
9176
+ });
9177
+ if (this.turn === activeTurn) {
9178
+ this.turn = void 0;
9179
+ }
9180
+ state.__omTurn = void 0;
9181
+ }
9167
9182
  if (!this.turn || !state.__omTurn) {
9168
9183
  if (this.turn && !state.__omTurn) {
9169
9184
  await this.turn.end().catch(() => {
@@ -9328,5 +9343,5 @@ function getObservationsAsOf(activeObservations, asOf) {
9328
9343
  }
9329
9344
 
9330
9345
  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 };
9331
- //# sourceMappingURL=chunk-7742VTN5.js.map
9332
- //# sourceMappingURL=chunk-7742VTN5.js.map
9346
+ //# sourceMappingURL=chunk-4C4ERX6N.js.map
9347
+ //# sourceMappingURL=chunk-4C4ERX6N.js.map