@mastra/memory 1.41.1-alpha.5 → 1.41.2-alpha.0

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.
@@ -26782,6 +26782,7 @@ function buildObserverHistoryMessage(messages, options) {
26782
26782
  }
26783
26783
  /** Truncate a string to maxLen characters, appending a note if truncated. */
26784
26784
  function maybeTruncate(str, maxLen) {
26785
+ if (typeof str !== "string") return "";
26785
26786
  if (!maxLen || str.length <= maxLen) return str;
26786
26787
  const truncated = safeSlice(str, maxLen);
26787
26788
  return `${truncated}\n... [truncated ${str.length - truncated.length} characters]`;
@@ -29724,7 +29725,10 @@ const __experimental_updateWorkingMemoryToolVNext = (config) => {
29724
29725
  }
29725
29726
  const workingMemory = workingMemoryInput.newMemory || "";
29726
29727
  if (!workingMemoryInput.updateReason) workingMemoryInput.updateReason = `append-new-memory`;
29727
- if (workingMemoryInput.searchString && config.workingMemory?.scope === `resource` && workingMemoryInput.updateReason === `replace-irrelevant-memory`) workingMemoryInput.searchString = void 0;
29728
+ if (workingMemoryInput.searchString && scope === "resource" && workingMemoryInput.updateReason === `replace-irrelevant-memory`) return {
29729
+ success: false,
29730
+ reason: `working memory is shared across all conversations for this resource, so it can't be replaced just because it isn't relevant to this conversation. Use clarify-existing-memory to correct it, or append-new-memory to add to it.`
29731
+ };
29728
29732
  if (workingMemoryInput.updateReason === `append-new-memory` && workingMemoryInput.searchString) workingMemoryInput.searchString = void 0;
29729
29733
  if (workingMemoryInput.updateReason !== `append-new-memory` && !workingMemoryInput.searchString) return {
29730
29734
  success: false,
@@ -42498,4 +42502,4 @@ Notes:
42498
42502
  };
42499
42503
  export { summarizeConversation as A, injectAnchorIds as B, wrapInObservationGroup as C, WorkingMemoryExtractor as D, Subconscious as E, extractCurrentTask as F, OBSERVATION_CONTEXT_INSTRUCTIONS as G, stripEphemeralAnchorIds as H, formatMessagesForObserver as I, OBSERVATION_CONTINUATION_HINT as J, OBSERVATION_CONTEXT_PROMPT as K, hasCurrentTaskSection as L, OBSERVER_SYSTEM_PROMPT as M, buildObserverPrompt as N, deepMergeWorkingMemory as O, buildObserverSystemPrompt as P, optimizeObservationsForContext as R, stripObservationGroups as S, StaleKnowledgeSemanticIndexError as T, Extractor as U, parseAnchorId as V, OBSERVATIONAL_MEMORY_DEFAULTS as W, getObservationContextPrompt as Y, combineObservationGroupRanges as _, extractWorkingMemoryContent as a, reconcileObservationGroupsFromReflection as b, getObservationsAsOf as c, AUTO_MODEL_BY_PROVIDER as d, resolveAutoModelId as f, ModelByInputTokens as g, WorkingMemoryStateProcessor as h, WorkingMemory as i, TokenCounter as j, SUMMARIZE_THREAD_DEFAULTS 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, OBSERVATION_CONTEXT_PROMPT_THREAD as q, SemanticRecall as r, removeWorkingMemoryTags as s, Memory as t, ObservationalMemory as u, deriveObservationGroupProvenance as v, KnowledgeSemanticIndexCoordinator as w, renderObservationGroupsForReflection as x, parseObservationGroups as y, parseObserverOutput as z };
42500
42504
 
42501
- //# sourceMappingURL=src-MUc-jGgr.js.map
42505
+ //# sourceMappingURL=src-CshY_uyn.js.map