@mastra/server 1.66.1-alpha.0 → 1.67.0-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.
@@ -4694,7 +4694,7 @@ function splitLines(text) {
4694
4694
  return result;
4695
4695
  }
4696
4696
  //#endregion
4697
- //#region ../memory/dist/src-C4x5Wx9t.js
4697
+ //#region ../memory/dist/src-BNyqEQlx.js
4698
4698
  var __defProp$3 = Object.defineProperty;
4699
4699
  var __exportAll = (all, no_symbols) => {
4700
4700
  let target = {};
@@ -34695,7 +34695,24 @@ function isSystemReminderMessage(message) {
34695
34695
  const firstTextPart = message.content.parts.find((part) => part.type === "text");
34696
34696
  return typeof firstTextPart?.text === "string" && firstTextPart.text.startsWith("<system-reminder");
34697
34697
  }
34698
- function filterSystemReminderMessages(messages, includeSystemReminders) {
34698
+ function isRecallSignalType(type) {
34699
+ return type === "user" || type === "state" || type === "reactive" || type === "notification" || type === "user-message" || type === "system-reminder";
34700
+ }
34701
+ function getRecallSignalType(message) {
34702
+ if (!isRecord(message.content)) return void 0;
34703
+ for (const part of message.content.parts) if ((part.type === "data-signal" || part.type === "data-user-message") && isRecord(part.data) && isRecallSignalType(part.data.type)) return part.data.type;
34704
+ const metadata = message.content.metadata;
34705
+ if (message.role === "signal" && isRecord(metadata) && isRecord(metadata.signal)) {
34706
+ if (isRecallSignalType(metadata.signal.type)) return metadata.signal.type;
34707
+ }
34708
+ return isSystemReminderMessage(message) ? "system-reminder" : void 0;
34709
+ }
34710
+ function filterSystemReminderMessages(messages, includeSystemReminders, hideSignals) {
34711
+ if (hideSignals === false) return messages;
34712
+ if (hideSignals !== void 0) return messages.filter((message) => {
34713
+ const type = getRecallSignalType(message);
34714
+ return type === void 0 || hideSignals !== true && !hideSignals.includes(type);
34715
+ });
34699
34716
  if (includeSystemReminders) return messages;
34700
34717
  return messages.filter((message) => !isSystemReminderMessage(message));
34701
34718
  }
@@ -34913,7 +34930,7 @@ var Memory = class Memory extends _mastra_core_memory.MastraMemory {
34913
34930
  });
34914
34931
  }
34915
34932
  async recall(args) {
34916
- const { threadId, resourceId, perPage: perPageArg, page, orderBy, threadConfig, vectorSearchString, includeSystemReminders, filter, includeTotal } = args;
34933
+ const { threadId, resourceId, perPage: perPageArg, page, orderBy, threadConfig, vectorSearchString, includeSystemReminders, hideSignals, filter, includeTotal } = args;
34917
34934
  const config = this.getMergedThreadConfig(threadConfig || {});
34918
34935
  const semanticRecallEnabled = Boolean(config.semanticRecall);
34919
34936
  const span = this.createMemorySpan("recall", args.observabilityContext, {
@@ -35012,7 +35029,7 @@ var Memory = class Memory extends _mastra_core_memory.MastraMemory {
35012
35029
  const messages = filterSystemReminderMessages(new _mastra_core_agent.MessageList({
35013
35030
  threadId,
35014
35031
  resourceId
35015
- }).add(rawMessages, "memory").get.all.db(), includeSystemReminders);
35032
+ }).add(rawMessages, "memory").get.all.db(), includeSystemReminders, hideSignals);
35016
35033
  const { total, page: resultPage, perPage: resultPerPage, hasMore } = paginatedResult;
35017
35034
  const recallResult = {
35018
35035
  messages,
@@ -36323,8 +36340,16 @@ Notes:
36323
36340
  */
36324
36341
  async cloneThread(args, memoryConfig) {
36325
36342
  const memoryStore = await this.getMemoryStore();
36326
- const result = await memoryStore.cloneThread(args);
36327
36343
  const config = this.getMergedThreadConfig(memoryConfig);
36344
+ const requestedHydrate = args.options?.hydrateMessages ?? true;
36345
+ const effectiveHydrate = requestedHydrate || Boolean(this.vector && this.embedder && config.semanticRecall);
36346
+ const result = await memoryStore.cloneThread(effectiveHydrate === requestedHydrate ? args : {
36347
+ ...args,
36348
+ options: {
36349
+ ...args.options,
36350
+ hydrateMessages: effectiveHydrate
36351
+ }
36352
+ });
36328
36353
  const sourceResourceId = (await this.getThreadById({ threadId: args.sourceThreadId }))?.resourceId;
36329
36354
  if (config.workingMemory?.enabled) {
36330
36355
  const scope = config.workingMemory.scope || "resource";
@@ -47041,4 +47066,4 @@ const agentBuilderWorkflows = {
47041
47066
  //#endregion
47042
47067
  exports.agentBuilderWorkflows = agentBuilderWorkflows;
47043
47068
 
47044
- //# sourceMappingURL=dist-B0Yl4ENo.cjs.map
47069
+ //# sourceMappingURL=dist-CaVro31X.cjs.map