@mastra/memory 1.29.0 → 1.30.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.
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-memory-message-history.md +1 -1
- package/dist/docs/references/docs-subagents.md +25 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/processors/index.cjs +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/error.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-strategies/sync.d.ts.map +1 -1
- package/dist/processors/observational-memory/observer-runner.d.ts.map +1 -1
- package/dist/{src-BNB8ko_o.js → src-BNyqEQlx.js} +155 -72
- package/dist/{src-BNB8ko_o.js.map → src-BNyqEQlx.js.map} +1 -1
- package/dist/{src-DjCR8GJe.cjs → src-Bze5SVTm.cjs} +155 -72
- package/dist/{src-DjCR8GJe.cjs.map → src-Bze5SVTm.cjs.map} +1 -1
- package/package.json +4 -4
|
@@ -17914,6 +17914,46 @@ async function applyExtractorHooks(opts) {
|
|
|
17914
17914
|
};
|
|
17915
17915
|
}
|
|
17916
17916
|
//#endregion
|
|
17917
|
+
//#region src/processors/observational-memory/error.ts
|
|
17918
|
+
function isRecord$4(value) {
|
|
17919
|
+
return typeof value === "object" && value !== null;
|
|
17920
|
+
}
|
|
17921
|
+
/** Keep provider diagnostics in streamed/persisted markers, not whole API request/response objects. */
|
|
17922
|
+
function formatOmError(error) {
|
|
17923
|
+
const details = /* @__PURE__ */ new Set();
|
|
17924
|
+
const visited = /* @__PURE__ */ new Set();
|
|
17925
|
+
const add = (value) => {
|
|
17926
|
+
if (typeof value === "string" && value.trim()) details.add(value.trim().slice(0, 2e3));
|
|
17927
|
+
};
|
|
17928
|
+
function collectErrorDetails(value, depth) {
|
|
17929
|
+
if (depth > 5) return;
|
|
17930
|
+
if (!isRecord$4(value)) {
|
|
17931
|
+
if (value !== void 0) add(String(value));
|
|
17932
|
+
return;
|
|
17933
|
+
}
|
|
17934
|
+
if (visited.has(value)) return;
|
|
17935
|
+
visited.add(value);
|
|
17936
|
+
add(value.message);
|
|
17937
|
+
if (typeof value.statusCode === "number") add(`HTTP ${value.statusCode}`);
|
|
17938
|
+
if (typeof value.responseBody === "string") try {
|
|
17939
|
+
const body = JSON.parse(value.responseBody);
|
|
17940
|
+
if (isRecord$4(body)) {
|
|
17941
|
+
add(body.message);
|
|
17942
|
+
add(body.detail);
|
|
17943
|
+
if (isRecord$4(body.error)) add(body.error.message);
|
|
17944
|
+
else add(body.error);
|
|
17945
|
+
}
|
|
17946
|
+
} catch {}
|
|
17947
|
+
if (value.cause !== void 0) collectErrorDetails(value.cause, depth + 1);
|
|
17948
|
+
if (value.error !== void 0) collectErrorDetails(value.error, depth + 1);
|
|
17949
|
+
}
|
|
17950
|
+
try {
|
|
17951
|
+
collectErrorDetails(error, 0);
|
|
17952
|
+
} catch {}
|
|
17953
|
+
const message = [...details].join(": ") || "Unknown error";
|
|
17954
|
+
return message.length > 2e3 ? `${message.slice(0, 1997)}...` : message;
|
|
17955
|
+
}
|
|
17956
|
+
//#endregion
|
|
17917
17957
|
//#region src/processors/observational-memory/extraction-runner.ts
|
|
17918
17958
|
function isAbortError$1(error, abortSignal) {
|
|
17919
17959
|
return abortSignal?.aborted === true || error instanceof DOMException && error.name === "AbortError" || error instanceof Error && error.name === "AbortError";
|
|
@@ -18914,11 +18954,11 @@ function formatObserverAttachmentPlaceholder(part, counter) {
|
|
|
18914
18954
|
const label = resolveObserverAttachmentLabel(part);
|
|
18915
18955
|
return label ? `[${attachmentType} #${attachmentId}: ${label}]` : `[${attachmentType} #${attachmentId}]`;
|
|
18916
18956
|
}
|
|
18917
|
-
function isRecord$
|
|
18957
|
+
function isRecord$3(value) {
|
|
18918
18958
|
return !!value && typeof value === "object";
|
|
18919
18959
|
}
|
|
18920
18960
|
function mapToolResultBlockToAttachment(block) {
|
|
18921
|
-
if (!isRecord$
|
|
18961
|
+
if (!isRecord$3(block) || typeof block.type !== "string") return;
|
|
18922
18962
|
const mediaType = typeof block.mediaType === "string" ? block.mediaType : void 0;
|
|
18923
18963
|
const filename = typeof block.filename === "string" ? block.filename : void 0;
|
|
18924
18964
|
switch (block.type) {
|
|
@@ -18979,7 +19019,7 @@ function mapToolResultBlockToAttachment(block) {
|
|
|
18979
19019
|
}
|
|
18980
19020
|
}
|
|
18981
19021
|
function extractToolResultAttachments(result, counter, attachmentFilter) {
|
|
18982
|
-
if (!isRecord$
|
|
19022
|
+
if (!isRecord$3(result) || result.type !== "content" || !Array.isArray(result.value)) return {
|
|
18983
19023
|
resultWithoutAttachments: result,
|
|
18984
19024
|
attachments: []
|
|
18985
19025
|
};
|
|
@@ -18993,7 +19033,7 @@ function extractToolResultAttachments(result, counter, attachmentFilter) {
|
|
|
18993
19033
|
if (shouldIncludeObserverAttachment(attachment, attachmentFilter)) attachments.push(toObserverInputAttachmentPart(attachment));
|
|
18994
19034
|
const placeholder = formatObserverAttachmentPlaceholder(attachment, counter);
|
|
18995
19035
|
return {
|
|
18996
|
-
type: isRecord$
|
|
19036
|
+
type: isRecord$3(block) ? block.type : void 0,
|
|
18997
19037
|
placeholder
|
|
18998
19038
|
};
|
|
18999
19039
|
});
|
|
@@ -19614,17 +19654,17 @@ const TRANSIENT_MESSAGE_SUBSTRINGS = [
|
|
|
19614
19654
|
"connection reset",
|
|
19615
19655
|
"connection closed"
|
|
19616
19656
|
];
|
|
19617
|
-
function isRecord$
|
|
19657
|
+
function isRecord$2(value) {
|
|
19618
19658
|
return typeof value === "object" && value !== null;
|
|
19619
19659
|
}
|
|
19620
19660
|
function isAbortError(error) {
|
|
19621
|
-
if (!isRecord$
|
|
19661
|
+
if (!isRecord$2(error)) return false;
|
|
19622
19662
|
if (error.name === "AbortError") return true;
|
|
19623
19663
|
if (typeof error.code === "string" && error.code === "ABORT_ERR") return true;
|
|
19624
19664
|
return false;
|
|
19625
19665
|
}
|
|
19626
19666
|
function hasTransientMessage(value) {
|
|
19627
|
-
if (!isRecord$
|
|
19667
|
+
if (!isRecord$2(value)) return false;
|
|
19628
19668
|
const message = typeof value.message === "string" ? value.message.toLowerCase() : "";
|
|
19629
19669
|
if (message && TRANSIENT_MESSAGE_SUBSTRINGS.some((sub) => message.includes(sub))) return true;
|
|
19630
19670
|
if (typeof value.code === "string" && value.code.toUpperCase().startsWith("UND_ERR_")) return true;
|
|
@@ -19635,13 +19675,13 @@ function isRetryableHttpStatus(status) {
|
|
|
19635
19675
|
return status >= 500 && status <= 599;
|
|
19636
19676
|
}
|
|
19637
19677
|
function hasRetryableHttpStatus(value) {
|
|
19638
|
-
if (!isRecord$
|
|
19678
|
+
if (!isRecord$2(value)) return false;
|
|
19639
19679
|
if (typeof value.statusCode === "number" && isRetryableHttpStatus(value.statusCode)) return true;
|
|
19640
19680
|
if (typeof value.code === "number" && isRetryableHttpStatus(value.code)) return true;
|
|
19641
19681
|
return false;
|
|
19642
19682
|
}
|
|
19643
19683
|
function hasIsRetryableFlag(value) {
|
|
19644
|
-
if (!isRecord$
|
|
19684
|
+
if (!isRecord$2(value)) return false;
|
|
19645
19685
|
return value.isRetryable === true;
|
|
19646
19686
|
}
|
|
19647
19687
|
/**
|
|
@@ -19659,14 +19699,14 @@ function isTransientLLMError(error) {
|
|
|
19659
19699
|
if (isAbortError(error)) return false;
|
|
19660
19700
|
const visited = /* @__PURE__ */ new WeakSet();
|
|
19661
19701
|
function visit(candidate) {
|
|
19662
|
-
if (isRecord$
|
|
19702
|
+
if (isRecord$2(candidate)) {
|
|
19663
19703
|
if (visited.has(candidate)) return false;
|
|
19664
19704
|
visited.add(candidate);
|
|
19665
19705
|
}
|
|
19666
19706
|
if (hasTransientMessage(candidate)) return true;
|
|
19667
19707
|
if (hasRetryableHttpStatus(candidate)) return true;
|
|
19668
19708
|
if (hasIsRetryableFlag(candidate)) return true;
|
|
19669
|
-
if (isRecord$
|
|
19709
|
+
if (isRecord$2(candidate)) {
|
|
19670
19710
|
if (visit(candidate.cause)) return true;
|
|
19671
19711
|
if (visit(candidate.error)) return true;
|
|
19672
19712
|
}
|
|
@@ -19939,7 +19979,19 @@ var ObserverRunner = class {
|
|
|
19939
19979
|
}
|
|
19940
19980
|
async callObserver(existingObservations, messagesToObserve, abortSignal, options) {
|
|
19941
19981
|
const inputTokens = this.tokenCounter.countMessages(messagesToObserve);
|
|
19942
|
-
const resolvedModel =
|
|
19982
|
+
const resolvedModel = (() => {
|
|
19983
|
+
try {
|
|
19984
|
+
return options?.model ? { model: options.model } : this.resolveModel(inputTokens);
|
|
19985
|
+
} catch (error) {
|
|
19986
|
+
this.mastra?.getLogger?.().error("OM observer model resolution failed", {
|
|
19987
|
+
diagnostic: formatOmError(error),
|
|
19988
|
+
inputTokens,
|
|
19989
|
+
threadId: messagesToObserve[0]?.threadId,
|
|
19990
|
+
hasRequestContext: Boolean(options?.requestContext)
|
|
19991
|
+
});
|
|
19992
|
+
throw error;
|
|
19993
|
+
}
|
|
19994
|
+
})();
|
|
19943
19995
|
const activeExtractors = await resolveExtractors(filterObserverExtractors(this.observationConfig.extractors, options?.skipContinuationHints), {
|
|
19944
19996
|
source: "observer",
|
|
19945
19997
|
threadId: messagesToObserve[0]?.threadId,
|
|
@@ -19977,14 +20029,28 @@ var ObserverRunner = class {
|
|
|
19977
20029
|
...resolvedModel.routingThresholds ? { omRoutingThresholds: resolvedModel.routingThresholds } : {}
|
|
19978
20030
|
},
|
|
19979
20031
|
callback: (childObservabilityContext) => this.withAbortCheck(async () => {
|
|
19980
|
-
|
|
19981
|
-
|
|
19982
|
-
|
|
19983
|
-
|
|
19984
|
-
|
|
19985
|
-
|
|
19986
|
-
|
|
19987
|
-
|
|
20032
|
+
try {
|
|
20033
|
+
return await (await agent.stream(observerMessages, {
|
|
20034
|
+
modelSettings: { ...this.observationConfig.modelSettings },
|
|
20035
|
+
providerOptions: this.observationConfig.providerOptions,
|
|
20036
|
+
...temporaryMemory ? { memory: temporaryMemory.options } : {},
|
|
20037
|
+
...abortSignal ? { abortSignal } : {},
|
|
20038
|
+
...internalRequestContext ? { requestContext: internalRequestContext } : {},
|
|
20039
|
+
...childObservabilityContext
|
|
20040
|
+
})).getFullOutput();
|
|
20041
|
+
} catch (error) {
|
|
20042
|
+
this.mastra?.getLogger?.().error("OM observer provider call failed", {
|
|
20043
|
+
diagnostic: formatOmError(error),
|
|
20044
|
+
model: typeof resolvedModel.model === "function" ? "(dynamic-model)" : this.extractModelRouterId(resolvedModel.model, internalRequestContext),
|
|
20045
|
+
inputTokens,
|
|
20046
|
+
threadId: messagesToObserve[0]?.threadId,
|
|
20047
|
+
observedMessageCount: messagesToObserve.length,
|
|
20048
|
+
providerOptionProviders: Object.keys(this.observationConfig.providerOptions ?? {}),
|
|
20049
|
+
hasRequestContext: Boolean(internalRequestContext),
|
|
20050
|
+
aborted: abortSignal?.aborted ?? false
|
|
20051
|
+
});
|
|
20052
|
+
throw error;
|
|
20053
|
+
}
|
|
19988
20054
|
}, abortSignal)
|
|
19989
20055
|
}), {
|
|
19990
20056
|
label: "observer",
|
|
@@ -20081,7 +20147,22 @@ var ObserverRunner = class {
|
|
|
20081
20147
|
async callMultiThreadObserver(existingObservations, messagesByThread, threadOrder, abortSignal, requestContext, priorMetadataByThread, observabilityContext, model) {
|
|
20082
20148
|
if (threadOrder.length === 0) return { results: /* @__PURE__ */ new Map() };
|
|
20083
20149
|
const inputTokens = Array.from(messagesByThread.values()).reduce((total, messages) => total + this.tokenCounter.countMessages(messages), 0);
|
|
20084
|
-
const resolvedModel =
|
|
20150
|
+
const resolvedModel = (() => {
|
|
20151
|
+
try {
|
|
20152
|
+
return model ? { model } : this.resolveModel(inputTokens);
|
|
20153
|
+
} catch (error) {
|
|
20154
|
+
this.mastra?.getLogger?.().error("OM multi-thread observer model resolution failed", {
|
|
20155
|
+
diagnostic: formatOmError(error),
|
|
20156
|
+
inputTokens,
|
|
20157
|
+
threadIds: {
|
|
20158
|
+
sample: threadOrder.slice(0, 10).map((threadId) => threadId.slice(0, 128)),
|
|
20159
|
+
total: threadOrder.length
|
|
20160
|
+
},
|
|
20161
|
+
hasRequestContext: Boolean(requestContext)
|
|
20162
|
+
});
|
|
20163
|
+
throw error;
|
|
20164
|
+
}
|
|
20165
|
+
})();
|
|
20085
20166
|
const firstThreadMessages = messagesByThread.get(threadOrder[0] ?? "") ?? [];
|
|
20086
20167
|
const activeExtractors = await resolveExtractors(this.observationConfig.extractors ?? [], {
|
|
20087
20168
|
source: "observer",
|
|
@@ -20151,13 +20232,29 @@ var ObserverRunner = class {
|
|
|
20151
20232
|
...resolvedModel.routingThresholds ? { omRoutingThresholds: resolvedModel.routingThresholds } : {}
|
|
20152
20233
|
},
|
|
20153
20234
|
callback: (childObservabilityContext) => this.withAbortCheck(async () => {
|
|
20154
|
-
|
|
20155
|
-
|
|
20156
|
-
|
|
20157
|
-
|
|
20158
|
-
|
|
20159
|
-
|
|
20160
|
-
|
|
20235
|
+
try {
|
|
20236
|
+
return await (await agent.stream(observerMessages, {
|
|
20237
|
+
modelSettings: { ...this.observationConfig.modelSettings },
|
|
20238
|
+
providerOptions: this.observationConfig.providerOptions,
|
|
20239
|
+
...abortSignal ? { abortSignal } : {},
|
|
20240
|
+
...internalRequestContext ? { requestContext: internalRequestContext } : {},
|
|
20241
|
+
...childObservabilityContext
|
|
20242
|
+
})).getFullOutput();
|
|
20243
|
+
} catch (error) {
|
|
20244
|
+
this.mastra?.getLogger?.().error("OM multi-thread observer provider call failed", {
|
|
20245
|
+
diagnostic: formatOmError(error),
|
|
20246
|
+
model: typeof resolvedModel.model === "function" ? "(dynamic-model)" : this.extractModelRouterId(resolvedModel.model, internalRequestContext),
|
|
20247
|
+
inputTokens,
|
|
20248
|
+
threadIds: {
|
|
20249
|
+
sample: threadOrder.slice(0, 10).map((threadId) => threadId.slice(0, 128)),
|
|
20250
|
+
total: threadOrder.length
|
|
20251
|
+
},
|
|
20252
|
+
providerOptionProviders: Object.keys(this.observationConfig.providerOptions ?? {}),
|
|
20253
|
+
hasRequestContext: Boolean(internalRequestContext),
|
|
20254
|
+
aborted: abortSignal?.aborted ?? false
|
|
20255
|
+
});
|
|
20256
|
+
throw error;
|
|
20257
|
+
}
|
|
20161
20258
|
}, abortSignal)
|
|
20162
20259
|
}), {
|
|
20163
20260
|
label: "observer-multi-thread",
|
|
@@ -23431,45 +23528,6 @@ function didProviderChange(actorModel, lastModel) {
|
|
|
23431
23528
|
return false;
|
|
23432
23529
|
}
|
|
23433
23530
|
//#endregion
|
|
23434
|
-
//#region src/processors/observational-memory/error.ts
|
|
23435
|
-
function isRecord$2(value) {
|
|
23436
|
-
return typeof value === "object" && value !== null;
|
|
23437
|
-
}
|
|
23438
|
-
/** Keep provider diagnostics in streamed/persisted markers, not whole API request/response objects. */
|
|
23439
|
-
function formatOmError(error) {
|
|
23440
|
-
const details = /* @__PURE__ */ new Set();
|
|
23441
|
-
const visited = /* @__PURE__ */ new Set();
|
|
23442
|
-
const add = (value) => {
|
|
23443
|
-
if (typeof value === "string" && value.trim()) details.add(value.trim().slice(0, 2e3));
|
|
23444
|
-
};
|
|
23445
|
-
function collectErrorDetails(value, depth) {
|
|
23446
|
-
if (depth > 5) return;
|
|
23447
|
-
if (!isRecord$2(value)) {
|
|
23448
|
-
if (value !== void 0) add(String(value));
|
|
23449
|
-
return;
|
|
23450
|
-
}
|
|
23451
|
-
if (visited.has(value)) return;
|
|
23452
|
-
visited.add(value);
|
|
23453
|
-
add(value.message);
|
|
23454
|
-
if (typeof value.statusCode === "number") add(`HTTP ${value.statusCode}`);
|
|
23455
|
-
if (typeof value.responseBody === "string") try {
|
|
23456
|
-
const body = JSON.parse(value.responseBody);
|
|
23457
|
-
if (isRecord$2(body)) {
|
|
23458
|
-
add(body.message);
|
|
23459
|
-
if (isRecord$2(body.error)) add(body.error.message);
|
|
23460
|
-
else add(body.error);
|
|
23461
|
-
}
|
|
23462
|
-
} catch {}
|
|
23463
|
-
if (value.cause !== void 0) collectErrorDetails(value.cause, depth + 1);
|
|
23464
|
-
if (value.error !== void 0) collectErrorDetails(value.error, depth + 1);
|
|
23465
|
-
}
|
|
23466
|
-
try {
|
|
23467
|
-
collectErrorDetails(error, 0);
|
|
23468
|
-
} catch {}
|
|
23469
|
-
const message = [...details].join(": ") || "Unknown error";
|
|
23470
|
-
return message.length > 2e3 ? `${message.slice(0, 1997)}...` : message;
|
|
23471
|
-
}
|
|
23472
|
-
//#endregion
|
|
23473
23531
|
//#region src/processors/observational-memory/markers.ts
|
|
23474
23532
|
/**
|
|
23475
23533
|
* Create a start marker for when observation begins.
|
|
@@ -30180,7 +30238,24 @@ function isSystemReminderMessage(message) {
|
|
|
30180
30238
|
const firstTextPart = message.content.parts.find((part) => part.type === "text");
|
|
30181
30239
|
return typeof firstTextPart?.text === "string" && firstTextPart.text.startsWith("<system-reminder");
|
|
30182
30240
|
}
|
|
30183
|
-
function
|
|
30241
|
+
function isRecallSignalType(type) {
|
|
30242
|
+
return type === "user" || type === "state" || type === "reactive" || type === "notification" || type === "user-message" || type === "system-reminder";
|
|
30243
|
+
}
|
|
30244
|
+
function getRecallSignalType(message) {
|
|
30245
|
+
if (!isRecord(message.content)) return void 0;
|
|
30246
|
+
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;
|
|
30247
|
+
const metadata = message.content.metadata;
|
|
30248
|
+
if (message.role === "signal" && isRecord(metadata) && isRecord(metadata.signal)) {
|
|
30249
|
+
if (isRecallSignalType(metadata.signal.type)) return metadata.signal.type;
|
|
30250
|
+
}
|
|
30251
|
+
return isSystemReminderMessage(message) ? "system-reminder" : void 0;
|
|
30252
|
+
}
|
|
30253
|
+
function filterSystemReminderMessages(messages, includeSystemReminders, hideSignals) {
|
|
30254
|
+
if (hideSignals === false) return messages;
|
|
30255
|
+
if (hideSignals !== void 0) return messages.filter((message) => {
|
|
30256
|
+
const type = getRecallSignalType(message);
|
|
30257
|
+
return type === void 0 || hideSignals !== true && !hideSignals.includes(type);
|
|
30258
|
+
});
|
|
30184
30259
|
if (includeSystemReminders) return messages;
|
|
30185
30260
|
return messages.filter((message) => !isSystemReminderMessage(message));
|
|
30186
30261
|
}
|
|
@@ -30398,7 +30473,7 @@ var Memory = class Memory extends _mastra_core_memory.MastraMemory {
|
|
|
30398
30473
|
});
|
|
30399
30474
|
}
|
|
30400
30475
|
async recall(args) {
|
|
30401
|
-
const { threadId, resourceId, perPage: perPageArg, page, orderBy, threadConfig, vectorSearchString, includeSystemReminders, filter, includeTotal } = args;
|
|
30476
|
+
const { threadId, resourceId, perPage: perPageArg, page, orderBy, threadConfig, vectorSearchString, includeSystemReminders, hideSignals, filter, includeTotal } = args;
|
|
30402
30477
|
const config = this.getMergedThreadConfig(threadConfig || {});
|
|
30403
30478
|
const semanticRecallEnabled = Boolean(config.semanticRecall);
|
|
30404
30479
|
const span = this.createMemorySpan("recall", args.observabilityContext, {
|
|
@@ -30497,7 +30572,7 @@ var Memory = class Memory extends _mastra_core_memory.MastraMemory {
|
|
|
30497
30572
|
const messages = filterSystemReminderMessages(new _mastra_core_agent.MessageList({
|
|
30498
30573
|
threadId,
|
|
30499
30574
|
resourceId
|
|
30500
|
-
}).add(rawMessages, "memory").get.all.db(), includeSystemReminders);
|
|
30575
|
+
}).add(rawMessages, "memory").get.all.db(), includeSystemReminders, hideSignals);
|
|
30501
30576
|
const { total, page: resultPage, perPage: resultPerPage, hasMore } = paginatedResult;
|
|
30502
30577
|
const recallResult = {
|
|
30503
30578
|
messages,
|
|
@@ -31808,8 +31883,16 @@ Notes:
|
|
|
31808
31883
|
*/
|
|
31809
31884
|
async cloneThread(args, memoryConfig) {
|
|
31810
31885
|
const memoryStore = await this.getMemoryStore();
|
|
31811
|
-
const result = await memoryStore.cloneThread(args);
|
|
31812
31886
|
const config = this.getMergedThreadConfig(memoryConfig);
|
|
31887
|
+
const requestedHydrate = args.options?.hydrateMessages ?? true;
|
|
31888
|
+
const effectiveHydrate = requestedHydrate || Boolean(this.vector && this.embedder && config.semanticRecall);
|
|
31889
|
+
const result = await memoryStore.cloneThread(effectiveHydrate === requestedHydrate ? args : {
|
|
31890
|
+
...args,
|
|
31891
|
+
options: {
|
|
31892
|
+
...args.options,
|
|
31893
|
+
hydrateMessages: effectiveHydrate
|
|
31894
|
+
}
|
|
31895
|
+
});
|
|
31813
31896
|
const sourceResourceId = (await this.getThreadById({ threadId: args.sourceThreadId }))?.resourceId;
|
|
31814
31897
|
if (config.workingMemory?.enabled) {
|
|
31815
31898
|
const scope = config.workingMemory.scope || "resource";
|
|
@@ -32424,4 +32507,4 @@ Object.defineProperty(exports, "wrapInObservationGroup", {
|
|
|
32424
32507
|
}
|
|
32425
32508
|
});
|
|
32426
32509
|
|
|
32427
|
-
//# sourceMappingURL=src-
|
|
32510
|
+
//# sourceMappingURL=src-Bze5SVTm.cjs.map
|