@mastra/server 1.28.0-alpha.0 → 1.28.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/CHANGELOG.md +7 -0
- package/dist/{chunk-4AQ5TM7H.js → chunk-2CI3G2FS.js} +5 -5
- package/dist/{chunk-4AQ5TM7H.js.map → chunk-2CI3G2FS.js.map} +1 -1
- package/dist/{chunk-HIK5MY74.cjs → chunk-53QVLUCB.cjs} +101 -45
- package/dist/chunk-53QVLUCB.cjs.map +1 -0
- package/dist/{chunk-BXJTD5TI.js → chunk-HU57X24H.js} +101 -45
- package/dist/chunk-HU57X24H.js.map +1 -0
- package/dist/{chunk-J4CWO6LX.cjs → chunk-VD2MZSOE.cjs} +20 -20
- package/dist/{chunk-J4CWO6LX.cjs.map → chunk-VD2MZSOE.cjs.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{observational-memory-7TQV7JJV-PBFFIN3K.cjs → observational-memory-YYO73QMY-CHIPDTZY.cjs} +26 -26
- package/dist/{observational-memory-7TQV7JJV-PBFFIN3K.cjs.map → observational-memory-YYO73QMY-CHIPDTZY.cjs.map} +1 -1
- package/dist/{observational-memory-7TQV7JJV-XHC4I75W.js → observational-memory-YYO73QMY-JNLMPY5B.js} +3 -3
- package/dist/{observational-memory-7TQV7JJV-XHC4I75W.js.map → observational-memory-YYO73QMY-JNLMPY5B.js.map} +1 -1
- package/dist/server/handlers/agent-builder.cjs +16 -16
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers.cjs +2 -2
- package/dist/server/handlers.js +1 -1
- package/dist/server/server-adapter/index.cjs +16 -16
- package/dist/server/server-adapter/index.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-BXJTD5TI.js.map +0 -1
- package/dist/chunk-HIK5MY74.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk53QVLUCB_cjs = require('./chunk-53QVLUCB.cjs');
|
|
4
4
|
var chunkR2ODPDKE_cjs = require('./chunk-R2ODPDKE.cjs');
|
|
5
5
|
var chunk4Z5OSMQB_cjs = require('./chunk-4Z5OSMQB.cjs');
|
|
6
6
|
var chunkRPOKTN4O_cjs = require('./chunk-RPOKTN4O.cjs');
|
|
@@ -16799,8 +16799,8 @@ function formatTimestamp(date) {
|
|
|
16799
16799
|
return date.toISOString().replace("T", " ").replace(/\.\d{3}Z$/, "Z");
|
|
16800
16800
|
}
|
|
16801
16801
|
function truncateByTokens(text42, maxTokens, hint) {
|
|
16802
|
-
if (
|
|
16803
|
-
const truncated =
|
|
16802
|
+
if (chunk53QVLUCB_cjs.estimateTokenCount(text42) <= maxTokens) return { text: text42, wasTruncated: false };
|
|
16803
|
+
const truncated = chunk53QVLUCB_cjs.truncateStringByTokens(text42, maxTokens);
|
|
16804
16804
|
const suffix = hint ? ` [${hint} for more]` : "";
|
|
16805
16805
|
return { text: truncated + suffix, wasTruncated: true };
|
|
16806
16806
|
}
|
|
@@ -16852,11 +16852,11 @@ ${JSON.stringify(inv.args, null, 2)}`;
|
|
|
16852
16852
|
});
|
|
16853
16853
|
}
|
|
16854
16854
|
if (inv.state === "result") {
|
|
16855
|
-
const { value: resultValue } =
|
|
16855
|
+
const { value: resultValue } = chunk53QVLUCB_cjs.resolveToolResultValue(
|
|
16856
16856
|
part,
|
|
16857
16857
|
inv.result
|
|
16858
16858
|
);
|
|
16859
|
-
const resultStr =
|
|
16859
|
+
const resultStr = chunk53QVLUCB_cjs.formatToolResultForObserver(resultValue, { maxTokens: HIGH_DETAIL_TOOL_RESULT_TOKENS });
|
|
16860
16860
|
const fullText = `[Tool Result: ${inv.toolName}]
|
|
16861
16861
|
${resultStr}`;
|
|
16862
16862
|
parts.push(makePart(msg, i, "tool-result", fullText, detail, inv.toolName));
|
|
@@ -16883,7 +16883,7 @@ ${typeof rawArgs === "string" ? rawArgs : JSON.stringify(rawArgs, null, 2)}`;
|
|
|
16883
16883
|
const toolName = part.toolName;
|
|
16884
16884
|
if (toolName) {
|
|
16885
16885
|
const rawResult = part.output ?? part.result;
|
|
16886
|
-
const resultStr =
|
|
16886
|
+
const resultStr = chunk53QVLUCB_cjs.formatToolResultForObserver(rawResult, { maxTokens: HIGH_DETAIL_TOOL_RESULT_TOKENS });
|
|
16887
16887
|
const fullText = `[Tool Result: ${toolName}]
|
|
16888
16888
|
${resultStr}`;
|
|
16889
16889
|
parts.push(makePart(msg, i, "tool-result", fullText, detail, toolName));
|
|
@@ -16961,9 +16961,9 @@ function expandPriority(part) {
|
|
|
16961
16961
|
}
|
|
16962
16962
|
function renderFormattedParts(parts, timestamps, options) {
|
|
16963
16963
|
const text42 = buildRenderedText(parts, timestamps);
|
|
16964
|
-
let totalTokens =
|
|
16964
|
+
let totalTokens = chunk53QVLUCB_cjs.estimateTokenCount(text42);
|
|
16965
16965
|
if (totalTokens > options.maxTokens) {
|
|
16966
|
-
const truncated =
|
|
16966
|
+
const truncated = chunk53QVLUCB_cjs.truncateStringByTokens(text42, options.maxTokens);
|
|
16967
16967
|
return { text: truncated, truncated: true, tokenOffset: totalTokens - options.maxTokens };
|
|
16968
16968
|
}
|
|
16969
16969
|
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));
|
|
@@ -16974,8 +16974,8 @@ function renderFormattedParts(parts, timestamps, options) {
|
|
|
16974
16974
|
for (const { part, index } of truncatedIndices) {
|
|
16975
16975
|
if (remaining <= 0) break;
|
|
16976
16976
|
const maxTokens = expandLimit(part);
|
|
16977
|
-
const fullTokens =
|
|
16978
|
-
const currentTokens =
|
|
16977
|
+
const fullTokens = chunk53QVLUCB_cjs.estimateTokenCount(part.fullText);
|
|
16978
|
+
const currentTokens = chunk53QVLUCB_cjs.estimateTokenCount(part.text);
|
|
16979
16979
|
const targetTokens = Math.min(fullTokens, maxTokens);
|
|
16980
16980
|
const delta = targetTokens - currentTokens;
|
|
16981
16981
|
if (delta <= 0) continue;
|
|
@@ -16986,17 +16986,17 @@ function renderFormattedParts(parts, timestamps, options) {
|
|
|
16986
16986
|
const expandedLimit = Math.min(currentTokens + remaining, maxTokens);
|
|
16987
16987
|
const hint = `recall cursor="${part.messageId}" partIndex=${part.partIndex} detail="high"`;
|
|
16988
16988
|
const { text: expanded2 } = truncateByTokens(part.fullText, expandedLimit, hint);
|
|
16989
|
-
const expandedDelta =
|
|
16989
|
+
const expandedDelta = chunk53QVLUCB_cjs.estimateTokenCount(expanded2) - currentTokens;
|
|
16990
16990
|
parts[index] = { ...part, text: expanded2 };
|
|
16991
16991
|
remaining -= expandedDelta;
|
|
16992
16992
|
}
|
|
16993
16993
|
}
|
|
16994
16994
|
const expanded = buildRenderedText(parts, timestamps);
|
|
16995
|
-
const expandedTokens =
|
|
16995
|
+
const expandedTokens = chunk53QVLUCB_cjs.estimateTokenCount(expanded);
|
|
16996
16996
|
if (expandedTokens <= options.maxTokens) {
|
|
16997
16997
|
return { text: expanded, truncated: false, tokenOffset: 0 };
|
|
16998
16998
|
}
|
|
16999
|
-
const hardTruncated =
|
|
16999
|
+
const hardTruncated = chunk53QVLUCB_cjs.truncateStringByTokens(expanded, options.maxTokens);
|
|
17000
17000
|
return { text: hardTruncated, truncated: true, tokenOffset: expandedTokens - options.maxTokens };
|
|
17001
17001
|
}
|
|
17002
17002
|
async function recallPart({
|
|
@@ -17047,7 +17047,7 @@ async function recallPart({
|
|
|
17047
17047
|
|
|
17048
17048
|
`;
|
|
17049
17049
|
const fallbackText = `${fallbackNote}${firstNextPart.text}`;
|
|
17050
|
-
const truncatedText2 =
|
|
17050
|
+
const truncatedText2 = chunk53QVLUCB_cjs.truncateStringByTokens(fallbackText, maxTokens);
|
|
17051
17051
|
const wasTruncated2 = truncatedText2 !== fallbackText;
|
|
17052
17052
|
return {
|
|
17053
17053
|
text: truncatedText2,
|
|
@@ -17062,7 +17062,7 @@ async function recallPart({
|
|
|
17062
17062
|
}
|
|
17063
17063
|
throw new Error(`Part index ${partIndex} not found in message ${cursor}. Available indices: ${availableIndices}`);
|
|
17064
17064
|
}
|
|
17065
|
-
const truncatedText =
|
|
17065
|
+
const truncatedText = chunk53QVLUCB_cjs.truncateStringByTokens(target.text, maxTokens);
|
|
17066
17066
|
const wasTruncated = truncatedText !== target.text;
|
|
17067
17067
|
return {
|
|
17068
17068
|
text: truncatedText,
|
|
@@ -18291,7 +18291,7 @@ ${workingMemory}`;
|
|
|
18291
18291
|
}
|
|
18292
18292
|
return chunks;
|
|
18293
18293
|
}
|
|
18294
|
-
hasher =
|
|
18294
|
+
hasher = chunk53QVLUCB_cjs.e();
|
|
18295
18295
|
// embedding is computationally expensive so cache content -> embeddings/chunks
|
|
18296
18296
|
embeddingCache = /* @__PURE__ */ new Map();
|
|
18297
18297
|
firstEmbed;
|
|
@@ -18693,7 +18693,7 @@ ${workingMemory}`;
|
|
|
18693
18693
|
"Observational memory requires @mastra/core support for request-response-id-rotation. Please bump @mastra/core to a newer version."
|
|
18694
18694
|
);
|
|
18695
18695
|
}
|
|
18696
|
-
const { ObservationalMemory: OMClass } = await import('./observational-memory-
|
|
18696
|
+
const { ObservationalMemory: OMClass } = await import('./observational-memory-YYO73QMY-CHIPDTZY.cjs');
|
|
18697
18697
|
const onIndexObservations = this.hasRetrievalSearch(omConfig.retrieval) ? async (observation) => {
|
|
18698
18698
|
await this.indexObservation(observation);
|
|
18699
18699
|
} : void 0;
|
|
@@ -19618,7 +19618,7 @@ Notes:
|
|
|
19618
19618
|
if (!effectiveConfig) return null;
|
|
19619
19619
|
const engine = await this.omEngine;
|
|
19620
19620
|
if (!engine) return null;
|
|
19621
|
-
const { ObservationalMemoryProcessor } = await import('./observational-memory-
|
|
19621
|
+
const { ObservationalMemoryProcessor } = await import('./observational-memory-YYO73QMY-CHIPDTZY.cjs');
|
|
19622
19622
|
return new ObservationalMemoryProcessor(engine, this, {
|
|
19623
19623
|
temporalMarkers: effectiveConfig.temporalMarkers
|
|
19624
19624
|
});
|
|
@@ -30993,5 +30993,5 @@ exports.START_ASYNC_AGENT_BUILDER_ACTION_ROUTE = START_ASYNC_AGENT_BUILDER_ACTIO
|
|
|
30993
30993
|
exports.STREAM_AGENT_BUILDER_ACTION_ROUTE = STREAM_AGENT_BUILDER_ACTION_ROUTE;
|
|
30994
30994
|
exports.STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE;
|
|
30995
30995
|
exports.agent_builder_exports = agent_builder_exports;
|
|
30996
|
-
//# sourceMappingURL=chunk-
|
|
30997
|
-
//# sourceMappingURL=chunk-
|
|
30996
|
+
//# sourceMappingURL=chunk-VD2MZSOE.cjs.map
|
|
30997
|
+
//# sourceMappingURL=chunk-VD2MZSOE.cjs.map
|