@mastra/server 1.16.1-alpha.0 → 1.17.0-alpha.2

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/chunk-3D55EABW.cjs +111 -0
  3. package/dist/chunk-3D55EABW.cjs.map +1 -0
  4. package/dist/chunk-JMEMSVJ5.js +105 -0
  5. package/dist/chunk-JMEMSVJ5.js.map +1 -0
  6. package/dist/{chunk-7CABBOGK.js → chunk-PZE5ZBAX.js} +202 -73
  7. package/dist/chunk-PZE5ZBAX.js.map +1 -0
  8. package/dist/{chunk-ZQAASZVD.cjs → chunk-R5EM57UR.cjs} +6800 -6618
  9. package/dist/chunk-R5EM57UR.cjs.map +1 -0
  10. package/dist/{chunk-GFTW6WEN.cjs → chunk-SZBVW2WD.cjs} +215 -86
  11. package/dist/chunk-SZBVW2WD.cjs.map +1 -0
  12. package/dist/{chunk-VUR5VN5R.js → chunk-WICIG6YL.js} +6792 -6607
  13. package/dist/chunk-WICIG6YL.js.map +1 -0
  14. package/dist/constants-BDOITAO3-PCCYSQXK.js +3 -0
  15. package/dist/constants-BDOITAO3-PCCYSQXK.js.map +1 -0
  16. package/dist/constants-BDOITAO3-YWTMWUNT.cjs +28 -0
  17. package/dist/constants-BDOITAO3-YWTMWUNT.cjs.map +1 -0
  18. package/dist/docs/SKILL.md +1 -1
  19. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  20. package/dist/observational-memory-WMCWT577-EDKAVK3W.js +4 -0
  21. package/dist/{observational-memory-NMQ7URIP-FOPRYAC2.js.map → observational-memory-WMCWT577-EDKAVK3W.js.map} +1 -1
  22. package/dist/{observational-memory-NMQ7URIP-2GEIXUBD.cjs → observational-memory-WMCWT577-MXWR6ZYS.cjs} +46 -41
  23. package/dist/{observational-memory-NMQ7URIP-2GEIXUBD.cjs.map → observational-memory-WMCWT577-MXWR6ZYS.cjs.map} +1 -1
  24. package/dist/server/handlers/agent-builder.cjs +16 -16
  25. package/dist/server/handlers/agent-builder.js +1 -1
  26. package/dist/server/handlers.cjs +2 -2
  27. package/dist/server/handlers.js +1 -1
  28. package/dist/server/server-adapter/index.cjs +16 -16
  29. package/dist/server/server-adapter/index.js +1 -1
  30. package/package.json +6 -6
  31. package/dist/chunk-7CABBOGK.js.map +0 -1
  32. package/dist/chunk-GFTW6WEN.cjs.map +0 -1
  33. package/dist/chunk-VUR5VN5R.js.map +0 -1
  34. package/dist/chunk-ZQAASZVD.cjs.map +0 -1
  35. package/dist/observational-memory-NMQ7URIP-FOPRYAC2.js +0 -3
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ var chunkR2ODPDKE_cjs = require('./chunk-R2ODPDKE.cjs');
3
4
  var chunk5N66PU3H_cjs = require('./chunk-5N66PU3H.cjs');
4
5
  var chunkEXKS4QPI_cjs = require('./chunk-EXKS4QPI.cjs');
5
6
  var chunkFPURK3UW_cjs = require('./chunk-FPURK3UW.cjs');
6
- var chunkZQAASZVD_cjs = require('./chunk-ZQAASZVD.cjs');
7
- var chunkR2ODPDKE_cjs = require('./chunk-R2ODPDKE.cjs');
7
+ var chunkR5EM57UR_cjs = require('./chunk-R5EM57UR.cjs');
8
8
  var chunk3W54ZNYP_cjs = require('./chunk-3W54ZNYP.cjs');
9
9
  var chunkDOHUOYZS_cjs = require('./chunk-DOHUOYZS.cjs');
10
10
  var chunkHITLRKIU_cjs = require('./chunk-HITLRKIU.cjs');
@@ -16193,8 +16193,8 @@ function formatTimestamp(date) {
16193
16193
  return date.toISOString().replace("T", " ").replace(/\.\d{3}Z$/, "Z");
16194
16194
  }
16195
16195
  function truncateByTokens(text42, maxTokens, hint) {
16196
- if (chunkZQAASZVD_cjs.estimateTokenCount(text42) <= maxTokens) return { text: text42, wasTruncated: false };
16197
- const truncated = chunkZQAASZVD_cjs.truncateStringByTokens(text42, maxTokens);
16196
+ if (chunkR5EM57UR_cjs.estimateTokenCount(text42) <= maxTokens) return { text: text42, wasTruncated: false };
16197
+ const truncated = chunkR5EM57UR_cjs.truncateStringByTokens(text42, maxTokens);
16198
16198
  const suffix = hint ? ` [${hint} for more]` : "";
16199
16199
  return { text: truncated + suffix, wasTruncated: true };
16200
16200
  }
@@ -16227,11 +16227,11 @@ function formatMessageParts(msg, detail) {
16227
16227
  } else if (partType === "tool-invocation") {
16228
16228
  const inv = part.toolInvocation;
16229
16229
  if (inv.state === "result") {
16230
- const { value: resultValue } = chunkZQAASZVD_cjs.resolveToolResultValue(
16230
+ const { value: resultValue } = chunkR5EM57UR_cjs.resolveToolResultValue(
16231
16231
  part,
16232
16232
  inv.result
16233
16233
  );
16234
- const resultStr = chunkZQAASZVD_cjs.formatToolResultForObserver(resultValue, { maxTokens: HIGH_DETAIL_TOOL_RESULT_TOKENS });
16234
+ const resultStr = chunkR5EM57UR_cjs.formatToolResultForObserver(resultValue, { maxTokens: HIGH_DETAIL_TOOL_RESULT_TOKENS });
16235
16235
  const fullText = `[Tool Result: ${inv.toolName}]
16236
16236
  ${resultStr}`;
16237
16237
  parts.push(makePart(msg, i, "tool-result", fullText, detail));
@@ -16293,9 +16293,9 @@ function expandPriority(part) {
16293
16293
  }
16294
16294
  function renderFormattedParts(parts, timestamps, options) {
16295
16295
  const text42 = buildRenderedText(parts, timestamps);
16296
- let totalTokens = chunkZQAASZVD_cjs.estimateTokenCount(text42);
16296
+ let totalTokens = chunkR5EM57UR_cjs.estimateTokenCount(text42);
16297
16297
  if (totalTokens > options.maxTokens) {
16298
- const truncated = chunkZQAASZVD_cjs.truncateStringByTokens(text42, options.maxTokens);
16298
+ const truncated = chunkR5EM57UR_cjs.truncateStringByTokens(text42, options.maxTokens);
16299
16299
  return { text: truncated, truncated: true, tokenOffset: totalTokens - options.maxTokens };
16300
16300
  }
16301
16301
  const truncatedIndices = parts.map((p, i) => ({ part: p, index: i })).filter(({ part }) => part.text !== part.fullText).sort((a, b) => expandPriority(a.part) - expandPriority(b.part));
@@ -16306,8 +16306,8 @@ function renderFormattedParts(parts, timestamps, options) {
16306
16306
  for (const { part, index } of truncatedIndices) {
16307
16307
  if (remaining <= 0) break;
16308
16308
  const maxTokens = expandLimit(part);
16309
- const fullTokens = chunkZQAASZVD_cjs.estimateTokenCount(part.fullText);
16310
- const currentTokens = chunkZQAASZVD_cjs.estimateTokenCount(part.text);
16309
+ const fullTokens = chunkR5EM57UR_cjs.estimateTokenCount(part.fullText);
16310
+ const currentTokens = chunkR5EM57UR_cjs.estimateTokenCount(part.text);
16311
16311
  const targetTokens = Math.min(fullTokens, maxTokens);
16312
16312
  const delta = targetTokens - currentTokens;
16313
16313
  if (delta <= 0) continue;
@@ -16318,17 +16318,17 @@ function renderFormattedParts(parts, timestamps, options) {
16318
16318
  const expandedLimit = Math.min(currentTokens + remaining, maxTokens);
16319
16319
  const hint = `recall cursor="${part.messageId}" partIndex=${part.partIndex} detail="high"`;
16320
16320
  const { text: expanded2 } = truncateByTokens(part.fullText, expandedLimit, hint);
16321
- const expandedDelta = chunkZQAASZVD_cjs.estimateTokenCount(expanded2) - currentTokens;
16321
+ const expandedDelta = chunkR5EM57UR_cjs.estimateTokenCount(expanded2) - currentTokens;
16322
16322
  parts[index] = { ...part, text: expanded2 };
16323
16323
  remaining -= expandedDelta;
16324
16324
  }
16325
16325
  }
16326
16326
  const expanded = buildRenderedText(parts, timestamps);
16327
- const expandedTokens = chunkZQAASZVD_cjs.estimateTokenCount(expanded);
16327
+ const expandedTokens = chunkR5EM57UR_cjs.estimateTokenCount(expanded);
16328
16328
  if (expandedTokens <= options.maxTokens) {
16329
16329
  return { text: expanded, truncated: false, tokenOffset: 0 };
16330
16330
  }
16331
- const hardTruncated = chunkZQAASZVD_cjs.truncateStringByTokens(expanded, options.maxTokens);
16331
+ const hardTruncated = chunkR5EM57UR_cjs.truncateStringByTokens(expanded, options.maxTokens);
16332
16332
  return { text: hardTruncated, truncated: true, tokenOffset: expandedTokens - options.maxTokens };
16333
16333
  }
16334
16334
  async function recallPart({
@@ -16363,7 +16363,7 @@ async function recallPart({
16363
16363
  `Part index ${partIndex} not found in message ${cursor}. Available indices: ${allParts.map((p) => p.partIndex).join(", ")}`
16364
16364
  );
16365
16365
  }
16366
- const truncatedText = chunkZQAASZVD_cjs.truncateStringByTokens(target.text, maxTokens);
16366
+ const truncatedText = chunkR5EM57UR_cjs.truncateStringByTokens(target.text, maxTokens);
16367
16367
  const wasTruncated = truncatedText !== target.text;
16368
16368
  return {
16369
16369
  text: truncatedText,
@@ -16784,6 +16784,14 @@ var DEFAULT_MESSAGE_RANGE = { before: 1, after: 1 };
16784
16784
  var DEFAULT_TOP_K = 4;
16785
16785
  var VECTOR_DELETE_BATCH_SIZE = 100;
16786
16786
  var Memory = class extends memory.MastraMemory {
16787
+ _omEngine;
16788
+ /** The shared ObservationalMemory engine. Lazily created on first access. */
16789
+ get omEngine() {
16790
+ if (!this._omEngine) {
16791
+ this._omEngine = this._initOMEngine();
16792
+ }
16793
+ return this._omEngine;
16794
+ }
16787
16795
  constructor(config = {}) {
16788
16796
  super({ name: "Memory", ...config });
16789
16797
  const mergedConfig = this.getMergedThreadConfig({
@@ -17185,7 +17193,7 @@ ${workingMemory}`;
17185
17193
  }
17186
17194
  return chunks;
17187
17195
  }
17188
- hasher = chunkZQAASZVD_cjs.e();
17196
+ hasher = chunkR5EM57UR_cjs.e();
17189
17197
  // embedding is computationally expensive so cache content -> embeddings/chunks
17190
17198
  embeddingCache = /* @__PURE__ */ new Map();
17191
17199
  firstEmbed;
@@ -17424,6 +17432,179 @@ ${workingMemory}`;
17424
17432
  data: workingMemoryData
17425
17433
  });
17426
17434
  }
17435
+ /**
17436
+ * Get everything needed for an LLM call in one shot.
17437
+ *
17438
+ * Assembles the system message (observations + working memory), loads
17439
+ * unobserved messages from storage, and returns them ready to use.
17440
+ *
17441
+ * @example
17442
+ * ```ts
17443
+ * const ctx = await memory.getContext({ threadId });
17444
+ * const result = await generateText({
17445
+ * model: openai('gpt-4o'),
17446
+ * system: ctx.systemMessage,
17447
+ * messages: ctx.messages.map(toAiSdkMessage),
17448
+ * });
17449
+ * ```
17450
+ */
17451
+ async getContext(opts) {
17452
+ const { threadId, resourceId, memoryConfig } = opts;
17453
+ const config = this.getMergedThreadConfig(memoryConfig);
17454
+ const memoryStore = await this.getMemoryStore();
17455
+ const systemParts = [];
17456
+ let hasObservations = false;
17457
+ let omRecord = null;
17458
+ let continuationMessage;
17459
+ let otherThreadsContext;
17460
+ const omEngine = await this.omEngine;
17461
+ if (omEngine) {
17462
+ omRecord = await omEngine.getRecord(threadId, resourceId);
17463
+ if (omRecord?.activeObservations) {
17464
+ hasObservations = true;
17465
+ if (omEngine.scope === "resource" && resourceId) {
17466
+ otherThreadsContext = await omEngine.getOtherThreadsContext(resourceId, threadId);
17467
+ }
17468
+ const obsSystemMessage = await omEngine.buildContextSystemMessage({
17469
+ threadId,
17470
+ resourceId,
17471
+ record: omRecord,
17472
+ unobservedContextBlocks: otherThreadsContext
17473
+ });
17474
+ if (obsSystemMessage) {
17475
+ systemParts.push(obsSystemMessage);
17476
+ }
17477
+ const { OBSERVATION_CONTINUATION_HINT } = await import('./constants-BDOITAO3-YWTMWUNT.cjs');
17478
+ continuationMessage = {
17479
+ id: "om-continuation",
17480
+ role: "user",
17481
+ createdAt: /* @__PURE__ */ new Date(0),
17482
+ content: {
17483
+ format: 2,
17484
+ parts: [
17485
+ {
17486
+ type: "text",
17487
+ text: `<system-reminder>${OBSERVATION_CONTINUATION_HINT}</system-reminder>`
17488
+ }
17489
+ ]
17490
+ },
17491
+ threadId,
17492
+ resourceId
17493
+ };
17494
+ }
17495
+ }
17496
+ const workingMemoryMessage = await this.getSystemMessage({ threadId, resourceId, memoryConfig: config });
17497
+ if (workingMemoryMessage) {
17498
+ systemParts.push(workingMemoryMessage);
17499
+ }
17500
+ let messages;
17501
+ if (omEngine && omRecord) {
17502
+ const dateFilter = omRecord.lastObservedAt ? { dateRange: { start: new Date(new Date(omRecord.lastObservedAt).getTime() + 1) } } : void 0;
17503
+ if (omEngine.scope === "resource" && resourceId) {
17504
+ const result = await memoryStore.listMessagesByResourceId({
17505
+ resourceId,
17506
+ orderBy: { field: "createdAt", direction: "ASC" },
17507
+ perPage: false,
17508
+ filter: dateFilter
17509
+ });
17510
+ messages = result.messages;
17511
+ } else {
17512
+ const result = await memoryStore.listMessages({
17513
+ threadId,
17514
+ orderBy: { field: "createdAt", direction: "ASC" },
17515
+ perPage: false,
17516
+ filter: dateFilter
17517
+ });
17518
+ messages = result.messages;
17519
+ }
17520
+ } else {
17521
+ const lastMessages = config.lastMessages;
17522
+ if (lastMessages === false) {
17523
+ messages = [];
17524
+ } else {
17525
+ const result = await memoryStore.listMessages({
17526
+ threadId,
17527
+ resourceId,
17528
+ orderBy: { field: "createdAt", direction: "DESC" },
17529
+ perPage: typeof lastMessages === "number" ? lastMessages : void 0
17530
+ });
17531
+ messages = result.messages.reverse();
17532
+ }
17533
+ }
17534
+ return {
17535
+ systemMessage: systemParts.length > 0 ? systemParts.join("\n\n") : void 0,
17536
+ messages,
17537
+ hasObservations,
17538
+ omRecord,
17539
+ continuationMessage,
17540
+ otherThreadsContext
17541
+ };
17542
+ }
17543
+ /**
17544
+ * Raw message upsert — persist messages to storage without embedding or working memory processing.
17545
+ * Used by the processor to save sealed messages before firing a background buffer operation.
17546
+ */
17547
+ async persistMessages(messages) {
17548
+ if (messages.length === 0) return;
17549
+ const memoryStore = await this.getMemoryStore();
17550
+ await memoryStore.saveMessages({ messages });
17551
+ }
17552
+ /**
17553
+ * One-time initialization of the shared ObservationalMemory engine.
17554
+ * Called lazily by the `omEngine` getter on first access.
17555
+ */
17556
+ async _initOMEngine() {
17557
+ const omConfig = normalizeObservationalMemoryConfig(this.threadConfig.observationalMemory);
17558
+ if (!omConfig) return null;
17559
+ const memoryStore = await this.storage.getStore("memory");
17560
+ if (!memoryStore || !memoryStore.supportsObservationalMemory) return null;
17561
+ const coreSupportsOM = features.coreFeatures.has("observationalMemory");
17562
+ if (!coreSupportsOM) {
17563
+ throw new Error(
17564
+ "Observational memory is enabled but the installed version of @mastra/core does not support it. Please upgrade @mastra/core to a version that includes observational memory support."
17565
+ );
17566
+ }
17567
+ if (omConfig.observation?.bufferTokens !== false && !features.coreFeatures.has("asyncBuffering")) {
17568
+ throw new Error(
17569
+ "Observational memory async buffering is enabled by default but the installed version of @mastra/core does not support it. Either upgrade @mastra/core, @mastra/memory, and your storage adapter (@mastra/libsql, @mastra/pg, or @mastra/mongodb) to the latest version, or explicitly disable async buffering by setting `observation: { bufferTokens: false }` in your observationalMemory config."
17570
+ );
17571
+ }
17572
+ if (!features.coreFeatures.has("request-response-id-rotation")) {
17573
+ throw new Error(
17574
+ "Observational memory requires @mastra/core support for request-response-id-rotation. Please bump @mastra/core to a newer version."
17575
+ );
17576
+ }
17577
+ const { ObservationalMemory: OMClass } = await import('./observational-memory-WMCWT577-MXWR6ZYS.cjs');
17578
+ return new OMClass({
17579
+ storage: memoryStore,
17580
+ scope: omConfig.scope,
17581
+ retrieval: omConfig.retrieval,
17582
+ shareTokenBudget: omConfig.shareTokenBudget,
17583
+ model: omConfig.model,
17584
+ observation: omConfig.observation ? {
17585
+ model: omConfig.observation.model,
17586
+ messageTokens: omConfig.observation.messageTokens,
17587
+ modelSettings: omConfig.observation.modelSettings,
17588
+ maxTokensPerBatch: omConfig.observation.maxTokensPerBatch,
17589
+ providerOptions: omConfig.observation.providerOptions,
17590
+ bufferTokens: omConfig.observation.bufferTokens,
17591
+ bufferActivation: omConfig.observation.bufferActivation,
17592
+ blockAfter: omConfig.observation.blockAfter,
17593
+ previousObserverTokens: omConfig.observation.previousObserverTokens,
17594
+ instruction: omConfig.observation.instruction,
17595
+ threadTitle: omConfig.observation.threadTitle
17596
+ } : void 0,
17597
+ reflection: omConfig.reflection ? {
17598
+ model: omConfig.reflection.model,
17599
+ observationTokens: omConfig.reflection.observationTokens,
17600
+ modelSettings: omConfig.reflection.modelSettings,
17601
+ providerOptions: omConfig.reflection.providerOptions,
17602
+ bufferActivation: omConfig.reflection.bufferActivation,
17603
+ blockAfter: omConfig.reflection.blockAfter,
17604
+ instruction: omConfig.reflection.instruction
17605
+ } : void 0
17606
+ });
17607
+ }
17427
17608
  defaultWorkingMemoryTemplate = `
17428
17609
  # User Information
17429
17610
  - **First Name**:
@@ -18085,81 +18266,29 @@ Notes:
18085
18266
  return processors;
18086
18267
  }
18087
18268
  /**
18088
- * Creates an ObservationalMemory processor instance if configured and not already present.
18089
- * A new instance is created per call processorStates (e.g., sealedIds) are shared
18090
- * via the ProcessorRunner's state map keyed by processor ID, not by instance identity.
18269
+ * Creates an ObservationalMemory processor wrapping the shared engine.
18270
+ * Returns null if OM is not configured, not supported, or already present
18271
+ * in the user's configured processors.
18091
18272
  */
18092
18273
  async createOMProcessor(configuredProcessors = [], context2) {
18093
18274
  const hasObservationalMemory = configuredProcessors.some(
18094
18275
  (p) => !("workflow" in p) && p.id === "observational-memory"
18095
18276
  );
18096
- const memoryContext = context2?.get("MastraMemory");
18097
- const runtimeMemoryConfig = memoryContext?.memoryConfig;
18098
- const effectiveConfig = runtimeMemoryConfig ? this.getMergedThreadConfig({
18099
- ...runtimeMemoryConfig,
18100
- observationalMemory: runtimeMemoryConfig.observationalMemory
18277
+ if (hasObservationalMemory) return null;
18278
+ const runtimeMemory = context2?.get("MastraMemory");
18279
+ const runtimeObservationalMemory = normalizeObservationalMemoryConfig(
18280
+ runtimeMemory?.memoryConfig?.observationalMemory
18281
+ );
18282
+ const threadConfig = runtimeObservationalMemory ? this.getMergedThreadConfig({
18283
+ ...runtimeMemory?.memoryConfig,
18284
+ observationalMemory: runtimeObservationalMemory
18101
18285
  }) : this.threadConfig;
18102
- const omConfig = normalizeObservationalMemoryConfig(effectiveConfig.observationalMemory);
18103
- if (!omConfig || hasObservationalMemory) {
18104
- return null;
18105
- }
18106
- const coreSupportsOM = features.coreFeatures.has("observationalMemory");
18107
- if (!coreSupportsOM) {
18108
- throw new Error(
18109
- "Observational memory is enabled but the installed version of @mastra/core does not support it. Please upgrade @mastra/core to a version that includes observational memory support."
18110
- );
18111
- }
18112
- const memoryStore = await this.storage.getStore("memory");
18113
- if (!memoryStore) {
18114
- throw new Error(
18115
- "Using Mastra Memory observational memory requires a storage adapter but no attached adapter was detected."
18116
- );
18117
- }
18118
- if (!memoryStore.supportsObservationalMemory) {
18119
- throw new Error(
18120
- `Observational memory is enabled but the storage adapter (${memoryStore.constructor.name}) does not support it. If you're using @mastra/libsql, @mastra/pg, or @mastra/mongodb, upgrade to the latest version. Otherwise, use one of those adapters or disable observational memory.`
18121
- );
18122
- }
18123
- if (omConfig.observation?.bufferTokens !== false && !features.coreFeatures.has("asyncBuffering")) {
18124
- throw new Error(
18125
- "Observational memory async buffering is enabled by default but the installed version of @mastra/core does not support it. Either upgrade @mastra/core, @mastra/memory, and your storage adapter (@mastra/libsql, @mastra/pg, or @mastra/mongodb) to the latest version, or explicitly disable async buffering by setting `observation: { bufferTokens: false }` in your observationalMemory config."
18126
- );
18127
- }
18128
- if (!features.coreFeatures.has("request-response-id-rotation")) {
18129
- throw new Error(
18130
- "Observational memory requires @mastra/core support for request-response-id-rotation. Please bump @mastra/core to a newer version."
18131
- );
18132
- }
18133
- const { ObservationalMemory } = await import('./observational-memory-NMQ7URIP-2GEIXUBD.cjs');
18134
- return new ObservationalMemory({
18135
- storage: memoryStore,
18136
- scope: omConfig.scope,
18137
- retrieval: omConfig.retrieval,
18138
- shareTokenBudget: omConfig.shareTokenBudget,
18139
- model: omConfig.model,
18140
- observation: omConfig.observation ? {
18141
- model: omConfig.observation.model,
18142
- messageTokens: omConfig.observation.messageTokens,
18143
- modelSettings: omConfig.observation.modelSettings,
18144
- maxTokensPerBatch: omConfig.observation.maxTokensPerBatch,
18145
- providerOptions: omConfig.observation.providerOptions,
18146
- bufferTokens: omConfig.observation.bufferTokens,
18147
- bufferActivation: omConfig.observation.bufferActivation,
18148
- blockAfter: omConfig.observation.blockAfter,
18149
- previousObserverTokens: omConfig.observation.previousObserverTokens,
18150
- instruction: omConfig.observation.instruction,
18151
- threadTitle: omConfig.observation.threadTitle
18152
- } : void 0,
18153
- reflection: omConfig.reflection ? {
18154
- model: omConfig.reflection.model,
18155
- observationTokens: omConfig.reflection.observationTokens,
18156
- modelSettings: omConfig.reflection.modelSettings,
18157
- providerOptions: omConfig.reflection.providerOptions,
18158
- bufferActivation: omConfig.reflection.bufferActivation,
18159
- blockAfter: omConfig.reflection.blockAfter,
18160
- instruction: omConfig.reflection.instruction
18161
- } : void 0
18162
- });
18286
+ const effectiveConfig = normalizeObservationalMemoryConfig(threadConfig.observationalMemory);
18287
+ if (!effectiveConfig) return null;
18288
+ const engine = await this.omEngine;
18289
+ if (!engine) return null;
18290
+ const { ObservationalMemoryProcessor } = await import('./observational-memory-WMCWT577-MXWR6ZYS.cjs');
18291
+ return new ObservationalMemoryProcessor(engine, this);
18163
18292
  }
18164
18293
  };
18165
18294
 
@@ -29374,5 +29503,5 @@ exports.START_ASYNC_AGENT_BUILDER_ACTION_ROUTE = START_ASYNC_AGENT_BUILDER_ACTIO
29374
29503
  exports.STREAM_AGENT_BUILDER_ACTION_ROUTE = STREAM_AGENT_BUILDER_ACTION_ROUTE;
29375
29504
  exports.STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE;
29376
29505
  exports.agent_builder_exports = agent_builder_exports;
29377
- //# sourceMappingURL=chunk-GFTW6WEN.cjs.map
29378
- //# sourceMappingURL=chunk-GFTW6WEN.cjs.map
29506
+ //# sourceMappingURL=chunk-SZBVW2WD.cjs.map
29507
+ //# sourceMappingURL=chunk-SZBVW2WD.cjs.map