@mastra/memory 1.41.2-alpha.0 → 1.41.2-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.
@@ -28079,6 +28079,19 @@ function buildEstimateKey(kind, text) {
28079
28079
  function resolveEstimatorId() {
28080
28080
  return "tokenx";
28081
28081
  }
28082
+ const ATTACHMENT_CONTENT_PART_TYPES = /* @__PURE__ */ new Set([
28083
+ "image",
28084
+ "image-data",
28085
+ "media",
28086
+ "audio",
28087
+ "file-data"
28088
+ ]);
28089
+ /** Mirrors the parts countMultimodalToolResultContent counts as attachments. */
28090
+ function isAttachmentContentPart(item) {
28091
+ if (!item || typeof item !== "object") return false;
28092
+ const contentPart = item;
28093
+ return ATTACHMENT_CONTENT_PART_TYPES.has(contentPart.type) && typeof contentPart.data === "string";
28094
+ }
28082
28095
  function isTokenEstimateEntry(value) {
28083
28096
  if (!value || typeof value !== "object") return false;
28084
28097
  const entry = value;
@@ -28871,12 +28884,12 @@ var TokenCounter = class TokenCounter {
28871
28884
  }
28872
28885
  countMultimodalToolResultContent(part, toolResult) {
28873
28886
  if (!toolResult || typeof toolResult !== "object") return;
28887
+ const output = toolResult;
28888
+ const content = output.type === "content" && Array.isArray(output.value) ? output.value : output.content;
28889
+ if (!Array.isArray(content) || !content.some(isAttachmentContentPart)) return;
28874
28890
  const resultKey = buildEstimateKey("tool-result-multimodal-content-source", JSON.stringify(toolResult));
28875
28891
  const cached = this.multimodalToolResultCounts.get(part);
28876
28892
  if (cached?.resultKey === resultKey) return cached.tokens;
28877
- const output = toolResult;
28878
- const content = output.type === "content" && Array.isArray(output.value) ? output.value : output.content;
28879
- if (!Array.isArray(content)) return;
28880
28893
  let hasAttachment = false;
28881
28894
  let tokens = 0;
28882
28895
  const cacheParts = [];
@@ -42502,4 +42515,4 @@ Notes:
42502
42515
  };
42503
42516
  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 };
42504
42517
 
42505
- //# sourceMappingURL=src-CshY_uyn.js.map
42518
+ //# sourceMappingURL=src-DGBUSKXy.js.map