@mastra/memory 1.28.2 → 1.28.3-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/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-storage.md +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/processors/index.cjs +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts.map +1 -1
- package/dist/processors/observational-memory/processor.d.ts +6 -1
- package/dist/processors/observational-memory/processor.d.ts.map +1 -1
- package/dist/processors/observational-memory/tracing.d.ts.map +1 -1
- package/dist/{src-Bewti2w5.cjs → src-CIhnLM0F.cjs} +43 -15
- package/dist/src-CIhnLM0F.cjs.map +1 -0
- package/dist/{src-BYrxAUzs.js → src-QH80Zc0y.js} +43 -15
- package/dist/{src-BYrxAUzs.js.map → src-QH80Zc0y.js.map} +1 -1
- package/package.json +4 -4
- package/dist/src-Bewti2w5.cjs.map +0 -1
|
@@ -19737,32 +19737,37 @@ function createTemporaryOmMemoryContext(prefix) {
|
|
|
19737
19737
|
//#region src/processors/observational-memory/tracing.ts
|
|
19738
19738
|
const PHASE_CONFIG = {
|
|
19739
19739
|
observer: {
|
|
19740
|
-
name: "
|
|
19741
|
-
entityName: "Observer"
|
|
19740
|
+
name: "memory: observe",
|
|
19741
|
+
entityName: "Observer",
|
|
19742
|
+
operationType: "observe"
|
|
19742
19743
|
},
|
|
19743
19744
|
"observer-multi-thread": {
|
|
19744
|
-
name: "
|
|
19745
|
-
entityName: "MultiThreadObserver"
|
|
19745
|
+
name: "memory: observe.multi-thread",
|
|
19746
|
+
entityName: "MultiThreadObserver",
|
|
19747
|
+
operationType: "observe",
|
|
19748
|
+
multiThread: true
|
|
19746
19749
|
},
|
|
19747
19750
|
reflector: {
|
|
19748
|
-
name: "
|
|
19749
|
-
entityName: "Reflector"
|
|
19751
|
+
name: "memory: reflect",
|
|
19752
|
+
entityName: "Reflector",
|
|
19753
|
+
operationType: "reflect"
|
|
19750
19754
|
}
|
|
19751
19755
|
};
|
|
19752
19756
|
async function withOmTracingSpan({ phase, model, inputTokens, requestContext, observabilityContext, metadata, callback }) {
|
|
19753
19757
|
const config = PHASE_CONFIG[phase];
|
|
19754
19758
|
const span = getOrCreateSpan({
|
|
19755
|
-
type: SpanType.
|
|
19759
|
+
type: SpanType.MEMORY_OPERATION,
|
|
19756
19760
|
name: config.name,
|
|
19757
|
-
entityType: EntityType.
|
|
19761
|
+
entityType: EntityType.MEMORY,
|
|
19758
19762
|
entityName: config.entityName,
|
|
19759
19763
|
tracingContext: observabilityContext?.tracingContext ?? observabilityContext?.tracing,
|
|
19760
|
-
|
|
19761
|
-
|
|
19762
|
-
|
|
19763
|
-
|
|
19764
|
-
...
|
|
19764
|
+
attributes: {
|
|
19765
|
+
operationType: config.operationType,
|
|
19766
|
+
inputTokens,
|
|
19767
|
+
selectedModel: typeof model === "string" ? model : "(dynamic-model)",
|
|
19768
|
+
...config.multiThread ? { multiThread: true } : {}
|
|
19765
19769
|
},
|
|
19770
|
+
metadata,
|
|
19766
19771
|
requestContext
|
|
19767
19772
|
});
|
|
19768
19773
|
const childObservabilityContext = createObservabilityContext({ currentSpan: span });
|
|
@@ -24581,7 +24586,7 @@ var AsyncBufferObservationStrategy = class extends ObservationStrategy {
|
|
|
24581
24586
|
if (!processed.observations) return;
|
|
24582
24587
|
const { record, threadId, resourceId, messages } = this.opts;
|
|
24583
24588
|
const messageTokens = await this.tokenCounter.countMessagesAsync(messages);
|
|
24584
|
-
await this.storage.updateBufferedObservations({
|
|
24589
|
+
await withRetry(() => this.storage.updateBufferedObservations({
|
|
24585
24590
|
id: record.id,
|
|
24586
24591
|
chunk: {
|
|
24587
24592
|
cycleId: this.cycleId,
|
|
@@ -24597,6 +24602,9 @@ var AsyncBufferObservationStrategy = class extends ObservationStrategy {
|
|
|
24597
24602
|
extractionFailures: processed.extractionFailures
|
|
24598
24603
|
},
|
|
24599
24604
|
lastBufferedAtTime: processed.lastObservedAt
|
|
24605
|
+
}), {
|
|
24606
|
+
label: "persist-buffered-observations",
|
|
24607
|
+
abortSignal: this.opts.abortSignal
|
|
24600
24608
|
});
|
|
24601
24609
|
await this.indexObservationGroups(processed.observations, threadId, resourceId, processed.lastObservedAt);
|
|
24602
24610
|
const newTitle = processed.threadTitle?.trim();
|
|
@@ -29646,9 +29654,29 @@ function injectObservationContextMessages({ messageList, systemMessages, continu
|
|
|
29646
29654
|
};
|
|
29647
29655
|
messageList.add(contMsg, "memory");
|
|
29648
29656
|
}
|
|
29657
|
+
/**
|
|
29658
|
+
* Observational memory runs on the processor pipeline, but a user configures
|
|
29659
|
+
* `memory`, not a processor — so its spans are labelled as memory operations
|
|
29660
|
+
* rather than as anonymous pipeline entries.
|
|
29661
|
+
*
|
|
29662
|
+
* The two phases do different things and are named separately: the input step
|
|
29663
|
+
* builds observation context into the system messages (a recall), and the
|
|
29664
|
+
* output result persists what the turn produced (a save).
|
|
29665
|
+
*/
|
|
29666
|
+
const OM_PHASE_OPERATION = {
|
|
29667
|
+
inputStep: "recall",
|
|
29668
|
+
output: "save",
|
|
29669
|
+
outputStep: "save"
|
|
29670
|
+
};
|
|
29649
29671
|
var ObservationalMemoryProcessor = class {
|
|
29650
29672
|
id = "observational-memory";
|
|
29651
29673
|
name = "Observational Memory";
|
|
29674
|
+
spanType = SpanType.MEMORY_OPERATION;
|
|
29675
|
+
spanName = (phase) => `memory: ${OM_PHASE_OPERATION[phase] ?? "observational"}`;
|
|
29676
|
+
spanAttributes = (phase) => {
|
|
29677
|
+
const operationType = OM_PHASE_OPERATION[phase];
|
|
29678
|
+
return operationType ? { operationType } : {};
|
|
29679
|
+
};
|
|
29652
29680
|
/** The underlying ObservationalMemory engine. */
|
|
29653
29681
|
engine;
|
|
29654
29682
|
/** Memory instance for loading context. */
|
|
@@ -31927,4 +31955,4 @@ Notes:
|
|
|
31927
31955
|
//#endregion
|
|
31928
31956
|
export { formatMessagesForObserver as A, OBSERVATION_CONTINUATION_HINT as B, SUMMARIZE_THREAD_DEFAULTS as C, buildObserverPrompt as D, OBSERVER_SYSTEM_PROMPT as E, parseAnchorId as F, ModelByInputTokens as G, KnowledgeSemanticIndexCoordinator as H, stripEphemeralAnchorIds as I, publishSubconsciousActivity as J, SUBCONSCIOUS_ACTIVITY_STATE_ID as K, OBSERVATIONAL_MEMORY_DEFAULTS as L, optimizeObservationsForContext as M, parseObserverOutput as N, buildObserverSystemPrompt as O, injectAnchorIds as P, OBSERVATION_CONTEXT_INSTRUCTIONS as R, WorkingMemoryExtractor as S, TokenCounter as T, StaleKnowledgeSemanticIndexError as U, Subconscious as V, SubconsciousRemindExtractor as W, Extractor as X, renderSubconsciousActivity as Y, wrapInObservationGroup as _, extractWorkingMemoryContent as a, WorkingMemoryStateProcessor as b, getObservationsAsOf as c, combineObservationGroupRanges as d, deriveObservationGroupProvenance as f, stripObservationGroups as g, renderObservationGroupsForReflection as h, WorkingMemory as i, hasCurrentTaskSection as j, extractCurrentTask as k, ObservationalMemoryProcessor as l, reconcileObservationGroupsFromReflection as m, MessageHistory$1 as n, extractWorkingMemoryTags as o, parseObservationGroups as p, buildSubconsciousActivitySnapshot as q, SemanticRecall as r, removeWorkingMemoryTags as s, Memory as t, ObservationalMemory as u, WORKING_MEMORY_STATE_ID as v, summarizeConversation as w, deepMergeWorkingMemory as x, WORKING_MEMORY_STATE_PROCESSOR_ID as y, OBSERVATION_CONTEXT_PROMPT as z };
|
|
31929
31957
|
|
|
31930
|
-
//# sourceMappingURL=src-
|
|
31958
|
+
//# sourceMappingURL=src-QH80Zc0y.js.map
|