@mastra/server 1.16.0-alpha.5 → 1.16.1-alpha.0
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 +119 -0
- package/dist/{chunk-57IWHVDZ.js → chunk-7CABBOGK.js} +5 -5
- package/dist/{chunk-57IWHVDZ.js.map → chunk-7CABBOGK.js.map} +1 -1
- package/dist/{chunk-B4RWYKPG.cjs → chunk-GFTW6WEN.cjs} +18 -18
- package/dist/{chunk-B4RWYKPG.cjs.map → chunk-GFTW6WEN.cjs.map} +1 -1
- package/dist/{chunk-W2QMKHBI.js → chunk-VUR5VN5R.js} +12 -8
- package/dist/chunk-VUR5VN5R.js.map +1 -0
- package/dist/{chunk-UTQV3JAT.cjs → chunk-ZQAASZVD.cjs} +12 -8
- package/dist/chunk-ZQAASZVD.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{observational-memory-K2U3QQIO-MBBXGVVG.cjs → observational-memory-NMQ7URIP-2GEIXUBD.cjs} +29 -29
- package/dist/{observational-memory-K2U3QQIO-MBBXGVVG.cjs.map → observational-memory-NMQ7URIP-2GEIXUBD.cjs.map} +1 -1
- package/dist/{observational-memory-K2U3QQIO-MOPJN5M7.js → observational-memory-NMQ7URIP-FOPRYAC2.js} +3 -3
- package/dist/{observational-memory-K2U3QQIO-MOPJN5M7.js.map → observational-memory-NMQ7URIP-FOPRYAC2.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 +8 -8
- package/dist/chunk-UTQV3JAT.cjs.map +0 -1
- package/dist/chunk-W2QMKHBI.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk5N66PU3H_cjs = require('./chunk-5N66PU3H.cjs');
|
|
4
|
-
var chunkDOHUOYZS_cjs = require('./chunk-DOHUOYZS.cjs');
|
|
5
4
|
var chunkEXKS4QPI_cjs = require('./chunk-EXKS4QPI.cjs');
|
|
6
5
|
var chunkFPURK3UW_cjs = require('./chunk-FPURK3UW.cjs');
|
|
7
|
-
var
|
|
6
|
+
var chunkZQAASZVD_cjs = require('./chunk-ZQAASZVD.cjs');
|
|
8
7
|
var chunkR2ODPDKE_cjs = require('./chunk-R2ODPDKE.cjs');
|
|
9
8
|
var chunk3W54ZNYP_cjs = require('./chunk-3W54ZNYP.cjs');
|
|
9
|
+
var chunkDOHUOYZS_cjs = require('./chunk-DOHUOYZS.cjs');
|
|
10
10
|
var chunkHITLRKIU_cjs = require('./chunk-HITLRKIU.cjs');
|
|
11
11
|
var chunkVTPTMQFA_cjs = require('./chunk-VTPTMQFA.cjs');
|
|
12
12
|
var chunkWC4OPIB4_cjs = require('./chunk-WC4OPIB4.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 (
|
|
16197
|
-
const truncated =
|
|
16196
|
+
if (chunkZQAASZVD_cjs.estimateTokenCount(text42) <= maxTokens) return { text: text42, wasTruncated: false };
|
|
16197
|
+
const truncated = chunkZQAASZVD_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 } =
|
|
16230
|
+
const { value: resultValue } = chunkZQAASZVD_cjs.resolveToolResultValue(
|
|
16231
16231
|
part,
|
|
16232
16232
|
inv.result
|
|
16233
16233
|
);
|
|
16234
|
-
const resultStr =
|
|
16234
|
+
const resultStr = chunkZQAASZVD_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 =
|
|
16296
|
+
let totalTokens = chunkZQAASZVD_cjs.estimateTokenCount(text42);
|
|
16297
16297
|
if (totalTokens > options.maxTokens) {
|
|
16298
|
-
const truncated =
|
|
16298
|
+
const truncated = chunkZQAASZVD_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 =
|
|
16310
|
-
const currentTokens =
|
|
16309
|
+
const fullTokens = chunkZQAASZVD_cjs.estimateTokenCount(part.fullText);
|
|
16310
|
+
const currentTokens = chunkZQAASZVD_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 =
|
|
16321
|
+
const expandedDelta = chunkZQAASZVD_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 =
|
|
16327
|
+
const expandedTokens = chunkZQAASZVD_cjs.estimateTokenCount(expanded);
|
|
16328
16328
|
if (expandedTokens <= options.maxTokens) {
|
|
16329
16329
|
return { text: expanded, truncated: false, tokenOffset: 0 };
|
|
16330
16330
|
}
|
|
16331
|
-
const hardTruncated =
|
|
16331
|
+
const hardTruncated = chunkZQAASZVD_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 =
|
|
16366
|
+
const truncatedText = chunkZQAASZVD_cjs.truncateStringByTokens(target.text, maxTokens);
|
|
16367
16367
|
const wasTruncated = truncatedText !== target.text;
|
|
16368
16368
|
return {
|
|
16369
16369
|
text: truncatedText,
|
|
@@ -17185,7 +17185,7 @@ ${workingMemory}`;
|
|
|
17185
17185
|
}
|
|
17186
17186
|
return chunks;
|
|
17187
17187
|
}
|
|
17188
|
-
hasher =
|
|
17188
|
+
hasher = chunkZQAASZVD_cjs.e();
|
|
17189
17189
|
// embedding is computationally expensive so cache content -> embeddings/chunks
|
|
17190
17190
|
embeddingCache = /* @__PURE__ */ new Map();
|
|
17191
17191
|
firstEmbed;
|
|
@@ -18130,7 +18130,7 @@ Notes:
|
|
|
18130
18130
|
"Observational memory requires @mastra/core support for request-response-id-rotation. Please bump @mastra/core to a newer version."
|
|
18131
18131
|
);
|
|
18132
18132
|
}
|
|
18133
|
-
const { ObservationalMemory } = await import('./observational-memory-
|
|
18133
|
+
const { ObservationalMemory } = await import('./observational-memory-NMQ7URIP-2GEIXUBD.cjs');
|
|
18134
18134
|
return new ObservationalMemory({
|
|
18135
18135
|
storage: memoryStore,
|
|
18136
18136
|
scope: omConfig.scope,
|
|
@@ -29374,5 +29374,5 @@ exports.START_ASYNC_AGENT_BUILDER_ACTION_ROUTE = START_ASYNC_AGENT_BUILDER_ACTIO
|
|
|
29374
29374
|
exports.STREAM_AGENT_BUILDER_ACTION_ROUTE = STREAM_AGENT_BUILDER_ACTION_ROUTE;
|
|
29375
29375
|
exports.STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE;
|
|
29376
29376
|
exports.agent_builder_exports = agent_builder_exports;
|
|
29377
|
-
//# sourceMappingURL=chunk-
|
|
29378
|
-
//# sourceMappingURL=chunk-
|
|
29377
|
+
//# sourceMappingURL=chunk-GFTW6WEN.cjs.map
|
|
29378
|
+
//# sourceMappingURL=chunk-GFTW6WEN.cjs.map
|