@mastra/memory 1.17.6-alpha.0 → 1.17.6-alpha.1

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,14 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 1.17.6-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Added extra defensive checks to prevent edge cases where system messages may have already been stored in message history. ([#15787](https://github.com/mastra-ai/mastra/pull/15787))
8
+
9
+ - Updated dependencies [[`b560d6f`](https://github.com/mastra-ai/mastra/commit/b560d6f88b9b904b15c10f75c949eb145bc27684), [`36b3bbf`](https://github.com/mastra-ai/mastra/commit/36b3bbf5a8d59f7e23d47e29340e76c681b4929c), [`b275631`](https://github.com/mastra-ai/mastra/commit/b275631dc10541a482b2e2d4a3e3cfa843bd5fa1)]:
10
+ - @mastra/core@1.33.0-alpha.6
11
+
3
12
  ## 1.17.6-alpha.0
4
13
 
5
14
  ### Patch Changes
@@ -1689,8 +1689,9 @@ var ResourceScopedObservationStrategy = class extends ObservationStrategy {
1689
1689
  orderBy: { field: "createdAt", direction: "ASC" },
1690
1690
  filter: startDate ? { dateRange: { start: startDate } } : void 0
1691
1691
  });
1692
- if (result.messages.length > 0) {
1693
- this.messagesByThread.set(thread.id, result.messages);
1692
+ const messages = result.messages.filter((msg) => msg.role !== "system");
1693
+ if (messages.length > 0) {
1694
+ this.messagesByThread.set(thread.id, messages);
1694
1695
  }
1695
1696
  }
1696
1697
  if (currentThreadMessages.length > 0) {
@@ -7419,6 +7420,9 @@ Async buffering is enabled by default \u2014 this opt-out is only needed when us
7419
7420
  }
7420
7421
  const result = [];
7421
7422
  for (const msg of allMessages) {
7423
+ if (msg.role === "system") {
7424
+ continue;
7425
+ }
7422
7426
  if (observedMessageIds?.has(msg.id)) {
7423
7427
  continue;
7424
7428
  }
@@ -7729,7 +7733,7 @@ ${suggestedResponse}
7729
7733
  } : void 0
7730
7734
  });
7731
7735
  }
7732
- return result.messages;
7736
+ return result.messages.filter((msg) => msg.role !== "system");
7733
7737
  }
7734
7738
  /**
7735
7739
  * Format unobserved messages from other threads as <unobserved-context> blocks.
@@ -9441,5 +9445,5 @@ function getObservationsAsOf(activeObservations, asOf) {
9441
9445
  }
9442
9446
 
9443
9447
  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 };
9444
- //# sourceMappingURL=chunk-NUYSX3DD.js.map
9445
- //# sourceMappingURL=chunk-NUYSX3DD.js.map
9448
+ //# sourceMappingURL=chunk-QZGJY67D.js.map
9449
+ //# sourceMappingURL=chunk-QZGJY67D.js.map