@mastra/memory 1.30.0-alpha.2 → 1.30.0-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.
@@ -19797,19 +19797,28 @@ const PHASE_CONFIG = {
19797
19797
  };
19798
19798
  async function withOmTracingSpan({ phase, model, inputTokens, requestContext, observabilityContext, metadata, callback }) {
19799
19799
  const config = PHASE_CONFIG[phase];
19800
+ const tracingContext = observabilityContext?.tracingContext ?? observabilityContext?.tracing;
19801
+ const callerMetadata = tracingContext?.currentSpan?.metadata;
19802
+ const inheritedCallerThreadId = callerMetadata?.__mastraObservationalMemoryCallerThreadId;
19803
+ const callerThreadId = callerMetadata?.threadId;
19804
+ const requestThreadId = requestContext?.get(MASTRA_THREAD_ID_KEY);
19805
+ const omCallerThreadId = typeof inheritedCallerThreadId === "string" && inheritedCallerThreadId ? inheritedCallerThreadId : typeof callerThreadId === "string" && callerThreadId ? callerThreadId : typeof requestThreadId === "string" && requestThreadId ? requestThreadId : void 0;
19800
19806
  const span = getOrCreateSpan({
19801
19807
  type: SpanType.MEMORY_OPERATION,
19802
19808
  name: config.name,
19803
19809
  entityType: EntityType.MEMORY,
19804
19810
  entityName: config.entityName,
19805
- tracingContext: observabilityContext?.tracingContext ?? observabilityContext?.tracing,
19811
+ tracingContext,
19806
19812
  attributes: {
19807
19813
  operationType: config.operationType,
19808
19814
  inputTokens,
19809
19815
  selectedModel: typeof model === "string" ? model : "(dynamic-model)",
19810
19816
  ...config.multiThread ? { multiThread: true } : {}
19811
19817
  },
19812
- metadata,
19818
+ metadata: omCallerThreadId !== void 0 ? {
19819
+ ...metadata,
19820
+ __mastraObservationalMemoryCallerThreadId: omCallerThreadId
19821
+ } : metadata,
19813
19822
  requestContext
19814
19823
  });
19815
19824
  const childObservabilityContext = createObservabilityContext({ currentSpan: span });
@@ -28491,7 +28500,7 @@ ${formattedMessages}
28491
28500
  if (!this.buffering.isAsyncObservationEnabled()) return false;
28492
28501
  const lockKey = this.buffering.getLockKey(opts.threadId, opts.resourceId);
28493
28502
  const shouldTrigger = this.buffering.shouldTriggerAsyncObservation(opts.pendingTokens, lockKey, opts.record, this.storage, opts.threshold);
28494
- if (shouldTrigger) this.trackBackgroundWork(this.startAsyncBufferedObservation(opts.record, opts.threadId, opts.unobservedMessages, lockKey, opts.writer, opts.unbufferedPendingTokens, opts.requestContext));
28503
+ if (shouldTrigger) this.trackBackgroundWork(this.startAsyncBufferedObservation(opts.record, opts.threadId, opts.unobservedMessages, lockKey, opts.writer, opts.unbufferedPendingTokens, opts.requestContext, opts.observabilityContext));
28495
28504
  return shouldTrigger;
28496
28505
  }
28497
28506
  isMessageList(value) {
@@ -32350,4 +32359,4 @@ Notes:
32350
32359
  //#endregion
32351
32360
  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 };
32352
32361
 
32353
- //# sourceMappingURL=src-TN3MwGgP.js.map
32362
+ //# sourceMappingURL=src-t3Mhge0m.js.map