@mastra/memory 1.15.0-alpha.1 → 1.15.0-alpha.2
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 +6 -0
- package/dist/{chunk-ZEKCVX4E.js → chunk-ERPFT635.js} +13 -3
- package/dist/chunk-ERPFT635.js.map +1 -0
- package/dist/{chunk-ANKEPFC6.cjs → chunk-LAYKIEDY.cjs} +12 -2
- package/dist/chunk-LAYKIEDY.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +27 -27
- package/dist/index.cjs +13 -13
- package/dist/index.js +4 -4
- package/dist/{observational-memory-S6YN56D3.js → observational-memory-SIX6STZE.js} +3 -3
- package/dist/{observational-memory-S6YN56D3.js.map → observational-memory-SIX6STZE.js.map} +1 -1
- package/dist/{observational-memory-NKF66CFX.cjs → observational-memory-YLDJZ45Q.cjs} +26 -26
- package/dist/{observational-memory-NKF66CFX.cjs.map → observational-memory-YLDJZ45Q.cjs.map} +1 -1
- package/dist/processors/index.cjs +24 -24
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/processor.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-ANKEPFC6.cjs.map +0 -1
- package/dist/chunk-ZEKCVX4E.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @mastra/memory
|
|
2
2
|
|
|
3
|
+
## 1.15.0-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed message history doubling when using Observational Memory with the Mastra gateway. The local ObservationalMemoryProcessor now detects when the agent's model is routed through the Mastra gateway and skips its input/output processing, since the gateway handles OM server-side. ([#15161](https://github.com/mastra-ai/mastra/pull/15161))
|
|
8
|
+
|
|
3
9
|
## 1.15.0-alpha.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_RETRIEVAL_INSTRUCTIONS, OBSERVATION_CONTINUATION_HINT } from './chunk-LSJJAJAF.js';
|
|
2
2
|
import { coreFeatures } from '@mastra/core/features';
|
|
3
|
-
import { resolveModelConfig } from '@mastra/core/llm';
|
|
3
|
+
import { resolveModelConfig, ModelRouterLanguageModel } from '@mastra/core/llm';
|
|
4
4
|
import { getThreadOMMetadata, setThreadOMMetadata, parseMemoryRequestContext } from '@mastra/core/memory';
|
|
5
5
|
import { MessageHistory } from '@mastra/core/processors';
|
|
6
6
|
import xxhash from 'xxhash-wasm';
|
|
@@ -8606,6 +8606,10 @@ function getOmObservabilityContext(args) {
|
|
|
8606
8606
|
metrics: args.metrics
|
|
8607
8607
|
};
|
|
8608
8608
|
}
|
|
8609
|
+
var GATEWAY_STATE_KEY = "__isGatewayModel";
|
|
8610
|
+
function isMastraGatewayModel(model) {
|
|
8611
|
+
return model instanceof ModelRouterLanguageModel && model.gatewayId === "mastra";
|
|
8612
|
+
}
|
|
8609
8613
|
var ObservationalMemoryProcessor = class {
|
|
8610
8614
|
id = "observational-memory";
|
|
8611
8615
|
name = "Observational Memory";
|
|
@@ -8641,6 +8645,11 @@ var ObservationalMemoryProcessor = class {
|
|
|
8641
8645
|
omDebug(`[OM:processInputStep:NO-CONTEXT] getThreadContext returned null \u2014 returning early`);
|
|
8642
8646
|
return messageList;
|
|
8643
8647
|
}
|
|
8648
|
+
if (isMastraGatewayModel(model)) {
|
|
8649
|
+
state[GATEWAY_STATE_KEY] = true;
|
|
8650
|
+
omDebug(`[OM:processInputStep:GATEWAY] gateway handles OM \u2014 skipping local processing`);
|
|
8651
|
+
return messageList;
|
|
8652
|
+
}
|
|
8644
8653
|
const { threadId, resourceId } = context;
|
|
8645
8654
|
const memoryContext = parseMemoryRequestContext(requestContext);
|
|
8646
8655
|
const readOnly = memoryContext?.memoryConfig?.readOnly;
|
|
@@ -8757,6 +8766,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
8757
8766
|
const state = _state ?? {};
|
|
8758
8767
|
const context = this.engine.getThreadContext(requestContext, messageList);
|
|
8759
8768
|
if (!context) return messageList;
|
|
8769
|
+
if (state[GATEWAY_STATE_KEY]) return messageList;
|
|
8760
8770
|
const observabilityContext = getOmObservabilityContext(args);
|
|
8761
8771
|
state.__omObservabilityContext = observabilityContext;
|
|
8762
8772
|
return this.engine.getTokenCounter().runWithModelContext(state.__omActorModelContext, async () => {
|
|
@@ -8808,5 +8818,5 @@ function getObservationsAsOf(activeObservations, asOf) {
|
|
|
8808
8818
|
}
|
|
8809
8819
|
|
|
8810
8820
|
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 };
|
|
8811
|
-
//# sourceMappingURL=chunk-
|
|
8812
|
-
//# sourceMappingURL=chunk-
|
|
8821
|
+
//# sourceMappingURL=chunk-ERPFT635.js.map
|
|
8822
|
+
//# sourceMappingURL=chunk-ERPFT635.js.map
|