@mastra/memory 1.37.1-alpha.1 → 1.37.1-alpha.3
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/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/observation-strategies/sync.d.ts.map +1 -1
- package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
- package/dist/processors/observational-memory/observer-runner.d.ts.map +1 -1
- package/dist/processors/observational-memory/processor.d.ts.map +1 -1
- package/dist/processors/observational-memory/reflector-runner.d.ts.map +1 -1
- package/dist/{src-BcRCGtUY.cjs → src-BU8L6v1o.cjs} +12 -9
- package/dist/{src-BcRCGtUY.cjs.map → src-BU8L6v1o.cjs.map} +1 -1
- package/dist/{src-DjDnBIS0.js → src-DWoBX5f9.js} +12 -9
- package/dist/{src-DjDnBIS0.js.map → src-DWoBX5f9.js.map} +1 -1
- package/package.json +5 -5
|
@@ -24395,10 +24395,10 @@ function filterObservedMessages(opts) {
|
|
|
24395
24395
|
const msg = allMessages[i];
|
|
24396
24396
|
if (msg?.id && msg.id !== "om-continuation" && !preserveMessageIds.has(msg.id) && !hasPendingToolResultPair(msg, pendingToolResultIds)) messagesToRemove.push(msg.id);
|
|
24397
24397
|
}
|
|
24398
|
-
if (messagesToRemove.length > 0) messageList.removeByIds(messagesToRemove);
|
|
24398
|
+
if (messagesToRemove.length > 0) messageList.removeByIds(messagesToRemove, { pruned: true });
|
|
24399
24399
|
const unobserved = getUnobservedPartsPreservingToolCallPairs(markerMessage);
|
|
24400
24400
|
if (unobserved.length === 0) {
|
|
24401
|
-
if (markerMessage.id) messageList.removeByIds([markerMessage.id]);
|
|
24401
|
+
if (markerMessage.id) messageList.removeByIds([markerMessage.id], { pruned: true });
|
|
24402
24402
|
} else if (unobserved.length < (markerMessage.content?.parts?.length ?? 0)) markerMessage.content.parts = unobserved;
|
|
24403
24403
|
} else if (record) {
|
|
24404
24404
|
const pendingToolResultIds = collectPendingToolResultIds(allMessages, observedIds);
|
|
@@ -24425,7 +24425,7 @@ function filterObservedMessages(opts) {
|
|
|
24425
24425
|
}
|
|
24426
24426
|
}
|
|
24427
24427
|
}
|
|
24428
|
-
if (messagesToRemove.length > 0) messageList.removeByIds(messagesToRemove);
|
|
24428
|
+
if (messagesToRemove.length > 0) messageList.removeByIds(messagesToRemove, { pruned: true });
|
|
24429
24429
|
}
|
|
24430
24430
|
}
|
|
24431
24431
|
function getBufferedChunks(record) {
|
|
@@ -28849,7 +28849,7 @@ var ObservationStep = class {
|
|
|
28849
28849
|
this.turn.setRecord(activation.record);
|
|
28850
28850
|
if (activation.activated) {
|
|
28851
28851
|
activated = true;
|
|
28852
|
-
if (activation.activatedMessageIds?.length) messageList.removeByIds(activation.activatedMessageIds);
|
|
28852
|
+
if (activation.activatedMessageIds?.length) messageList.removeByIds(activation.activatedMessageIds, { pruned: true });
|
|
28853
28853
|
await om.resetBufferingState({
|
|
28854
28854
|
threadId,
|
|
28855
28855
|
resourceId,
|
|
@@ -31031,6 +31031,9 @@ function getLastActivityFromMessages(messages) {
|
|
|
31031
31031
|
return message.createdAt ? new Date(message.createdAt).getTime() : void 0;
|
|
31032
31032
|
}
|
|
31033
31033
|
}
|
|
31034
|
+
function firstFallbackModel(fallbacks) {
|
|
31035
|
+
return fallbacks[0]?.model ?? "unknown";
|
|
31036
|
+
}
|
|
31034
31037
|
function formatModelContext(provider, modelId) {
|
|
31035
31038
|
if (provider && modelId) return `${provider}/${modelId}`;
|
|
31036
31039
|
return modelId;
|
|
@@ -31432,10 +31435,10 @@ var ObservationalMemory = class ObservationalMemory {
|
|
|
31432
31435
|
}
|
|
31433
31436
|
getModelToResolve(model, inputTokens) {
|
|
31434
31437
|
const concreteModel = this.getConcreteModel(model, inputTokens);
|
|
31435
|
-
if (Array.isArray(concreteModel)) return concreteModel
|
|
31438
|
+
if (Array.isArray(concreteModel)) return firstFallbackModel(concreteModel);
|
|
31436
31439
|
if (typeof concreteModel === "function") return async (ctx) => {
|
|
31437
31440
|
const result = await concreteModel(ctx);
|
|
31438
|
-
if (Array.isArray(result)) return result
|
|
31441
|
+
if (Array.isArray(result)) return firstFallbackModel(result);
|
|
31439
31442
|
return result;
|
|
31440
31443
|
};
|
|
31441
31444
|
return concreteModel;
|
|
@@ -32444,7 +32447,7 @@ ${formattedMessages}
|
|
|
32444
32447
|
preserveMessageIds
|
|
32445
32448
|
});
|
|
32446
32449
|
if (messageList) {
|
|
32447
|
-
if (idsToRemoveList.length > 0) messageList.removeByIds(idsToRemoveList);
|
|
32450
|
+
if (idsToRemoveList.length > 0) messageList.removeByIds(idsToRemoveList, { pruned: true });
|
|
32448
32451
|
return messageList.get.all.db();
|
|
32449
32452
|
}
|
|
32450
32453
|
this.removeIdsFromArray(allMsgs, idsToRemoveList);
|
|
@@ -32469,7 +32472,7 @@ ${formattedMessages}
|
|
|
32469
32472
|
} else if (unobservedParts.length < (markerMsg.content?.parts?.length ?? 0)) markerMsg.content.parts = unobservedParts;
|
|
32470
32473
|
}
|
|
32471
32474
|
if (messageList) {
|
|
32472
|
-
if (idsToRemove.length > 0) messageList.removeByIds(idsToRemove);
|
|
32475
|
+
if (idsToRemove.length > 0) messageList.removeByIds(idsToRemove, { pruned: true });
|
|
32473
32476
|
if (messagesToSave.length > 0) await this.persistMessages(messagesToSave, threadId, resourceId);
|
|
32474
32477
|
omDebug(`[OM:cleanupMarker] removed ${idsToRemove.length} messages, saved ${messagesToSave.length}`);
|
|
32475
32478
|
return messageList.get.all.db();
|
|
@@ -36574,4 +36577,4 @@ Notes:
|
|
|
36574
36577
|
//#endregion
|
|
36575
36578
|
export { renderSubconsciousActivity as $, buildObserverSystemPrompt as A, OBSERVATION_CONTEXT_INSTRUCTIONS as B, WorkingMemoryExtractor as C, TokenCounter as D, summarizeConversation as E, parseObserverOutput as F, Subconscious as G, OBSERVATION_CONTEXT_PROMPT_THREAD as H, injectAnchorIds as I, SubconsciousRemindExtractor as J, KnowledgeSemanticIndexCoordinator as K, parseAnchorId as L, formatMessagesForObserver as M, hasCurrentTaskSection as N, OBSERVER_SYSTEM_PROMPT as O, optimizeObservationsForContext as P, publishSubconsciousActivity as Q, stripEphemeralAnchorIds as R, wrapInObservationGroup as S, SUMMARIZE_THREAD_DEFAULTS as T, OBSERVATION_CONTINUATION_HINT as U, OBSERVATION_CONTEXT_PROMPT as V, getObservationContextPrompt as W, SUBCONSCIOUS_ACTIVITY_STATE_ID as X, ModelByInputTokens as Y, buildSubconsciousActivitySnapshot as Z, deriveObservationGroupProvenance as _, extractWorkingMemoryContent as a, renderObservationGroupsForReflection as b, getObservationsAsOf as c, AUTO_MODEL_BY_PROVIDER as d, Extractor as et, resolveAutoModelId as f, combineObservationGroupRanges as g, WorkingMemoryStateProcessor as h, WorkingMemory as i, extractCurrentTask as j, buildObserverPrompt as k, ObservationalMemoryProcessor as l, WORKING_MEMORY_STATE_PROCESSOR_ID as m, MessageHistory$1 as n, extractWorkingMemoryTags as o, WORKING_MEMORY_STATE_ID as p, StaleKnowledgeSemanticIndexError as q, SemanticRecall as r, removeWorkingMemoryTags as s, Memory as t, ObservationalMemory as u, parseObservationGroups as v, deepMergeWorkingMemory as w, stripObservationGroups as x, reconcileObservationGroupsFromReflection as y, OBSERVATIONAL_MEMORY_DEFAULTS as z };
|
|
36576
36579
|
|
|
36577
|
-
//# sourceMappingURL=src-
|
|
36580
|
+
//# sourceMappingURL=src-DWoBX5f9.js.map
|