@mastra/server 1.18.0 → 1.18.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 +7 -0
- package/dist/{chunk-R45HPGYC.js → chunk-FTGC7KXM.js} +5 -5
- package/dist/{chunk-R45HPGYC.js.map → chunk-FTGC7KXM.js.map} +1 -1
- package/dist/{chunk-6XE2BQLU.cjs → chunk-MS7GNCN3.cjs} +18 -18
- package/dist/{chunk-6XE2BQLU.cjs.map → chunk-MS7GNCN3.cjs.map} +1 -1
- package/dist/{chunk-HUAXEKGI.cjs → chunk-POOOTRUM.cjs} +29 -22
- package/dist/chunk-POOOTRUM.cjs.map +1 -0
- package/dist/{chunk-YUTITKH2.js → chunk-U5XW3WOS.js} +29 -22
- package/dist/chunk-U5XW3WOS.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{observational-memory-SN7GKMHZ-WOK4TGDH.cjs → observational-memory-SASGM6OW-2G3RBRTW.cjs} +26 -26
- package/dist/{observational-memory-SN7GKMHZ-WOK4TGDH.cjs.map → observational-memory-SASGM6OW-2G3RBRTW.cjs.map} +1 -1
- package/dist/{observational-memory-SN7GKMHZ-IWVBFBS6.js → observational-memory-SASGM6OW-3S6D4TAF.js} +3 -3
- package/dist/{observational-memory-SN7GKMHZ-IWVBFBS6.js.map → observational-memory-SASGM6OW-3S6D4TAF.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 +6 -6
- package/dist/chunk-HUAXEKGI.cjs.map +0 -1
- package/dist/chunk-YUTITKH2.js.map +0 -1
|
@@ -4,7 +4,7 @@ var chunkR2ODPDKE_cjs = require('./chunk-R2ODPDKE.cjs');
|
|
|
4
4
|
var chunk5N66PU3H_cjs = require('./chunk-5N66PU3H.cjs');
|
|
5
5
|
var chunkEXKS4QPI_cjs = require('./chunk-EXKS4QPI.cjs');
|
|
6
6
|
var chunkFPURK3UW_cjs = require('./chunk-FPURK3UW.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkPOOOTRUM_cjs = require('./chunk-POOOTRUM.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');
|
|
@@ -16356,8 +16356,8 @@ function formatTimestamp(date) {
|
|
|
16356
16356
|
return date.toISOString().replace("T", " ").replace(/\.\d{3}Z$/, "Z");
|
|
16357
16357
|
}
|
|
16358
16358
|
function truncateByTokens(text42, maxTokens, hint) {
|
|
16359
|
-
if (
|
|
16360
|
-
const truncated =
|
|
16359
|
+
if (chunkPOOOTRUM_cjs.estimateTokenCount(text42) <= maxTokens) return { text: text42, wasTruncated: false };
|
|
16360
|
+
const truncated = chunkPOOOTRUM_cjs.truncateStringByTokens(text42, maxTokens);
|
|
16361
16361
|
const suffix = hint ? ` [${hint} for more]` : "";
|
|
16362
16362
|
return { text: truncated + suffix, wasTruncated: true };
|
|
16363
16363
|
}
|
|
@@ -16390,11 +16390,11 @@ function formatMessageParts(msg, detail) {
|
|
|
16390
16390
|
} else if (partType === "tool-invocation") {
|
|
16391
16391
|
const inv = part.toolInvocation;
|
|
16392
16392
|
if (inv.state === "result") {
|
|
16393
|
-
const { value: resultValue } =
|
|
16393
|
+
const { value: resultValue } = chunkPOOOTRUM_cjs.resolveToolResultValue(
|
|
16394
16394
|
part,
|
|
16395
16395
|
inv.result
|
|
16396
16396
|
);
|
|
16397
|
-
const resultStr =
|
|
16397
|
+
const resultStr = chunkPOOOTRUM_cjs.formatToolResultForObserver(resultValue, { maxTokens: HIGH_DETAIL_TOOL_RESULT_TOKENS });
|
|
16398
16398
|
const fullText = `[Tool Result: ${inv.toolName}]
|
|
16399
16399
|
${resultStr}`;
|
|
16400
16400
|
parts.push(makePart(msg, i, "tool-result", fullText, detail));
|
|
@@ -16456,9 +16456,9 @@ function expandPriority(part) {
|
|
|
16456
16456
|
}
|
|
16457
16457
|
function renderFormattedParts(parts, timestamps, options) {
|
|
16458
16458
|
const text42 = buildRenderedText(parts, timestamps);
|
|
16459
|
-
let totalTokens =
|
|
16459
|
+
let totalTokens = chunkPOOOTRUM_cjs.estimateTokenCount(text42);
|
|
16460
16460
|
if (totalTokens > options.maxTokens) {
|
|
16461
|
-
const truncated =
|
|
16461
|
+
const truncated = chunkPOOOTRUM_cjs.truncateStringByTokens(text42, options.maxTokens);
|
|
16462
16462
|
return { text: truncated, truncated: true, tokenOffset: totalTokens - options.maxTokens };
|
|
16463
16463
|
}
|
|
16464
16464
|
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));
|
|
@@ -16469,8 +16469,8 @@ function renderFormattedParts(parts, timestamps, options) {
|
|
|
16469
16469
|
for (const { part, index } of truncatedIndices) {
|
|
16470
16470
|
if (remaining <= 0) break;
|
|
16471
16471
|
const maxTokens = expandLimit(part);
|
|
16472
|
-
const fullTokens =
|
|
16473
|
-
const currentTokens =
|
|
16472
|
+
const fullTokens = chunkPOOOTRUM_cjs.estimateTokenCount(part.fullText);
|
|
16473
|
+
const currentTokens = chunkPOOOTRUM_cjs.estimateTokenCount(part.text);
|
|
16474
16474
|
const targetTokens = Math.min(fullTokens, maxTokens);
|
|
16475
16475
|
const delta = targetTokens - currentTokens;
|
|
16476
16476
|
if (delta <= 0) continue;
|
|
@@ -16481,17 +16481,17 @@ function renderFormattedParts(parts, timestamps, options) {
|
|
|
16481
16481
|
const expandedLimit = Math.min(currentTokens + remaining, maxTokens);
|
|
16482
16482
|
const hint = `recall cursor="${part.messageId}" partIndex=${part.partIndex} detail="high"`;
|
|
16483
16483
|
const { text: expanded2 } = truncateByTokens(part.fullText, expandedLimit, hint);
|
|
16484
|
-
const expandedDelta =
|
|
16484
|
+
const expandedDelta = chunkPOOOTRUM_cjs.estimateTokenCount(expanded2) - currentTokens;
|
|
16485
16485
|
parts[index] = { ...part, text: expanded2 };
|
|
16486
16486
|
remaining -= expandedDelta;
|
|
16487
16487
|
}
|
|
16488
16488
|
}
|
|
16489
16489
|
const expanded = buildRenderedText(parts, timestamps);
|
|
16490
|
-
const expandedTokens =
|
|
16490
|
+
const expandedTokens = chunkPOOOTRUM_cjs.estimateTokenCount(expanded);
|
|
16491
16491
|
if (expandedTokens <= options.maxTokens) {
|
|
16492
16492
|
return { text: expanded, truncated: false, tokenOffset: 0 };
|
|
16493
16493
|
}
|
|
16494
|
-
const hardTruncated =
|
|
16494
|
+
const hardTruncated = chunkPOOOTRUM_cjs.truncateStringByTokens(expanded, options.maxTokens);
|
|
16495
16495
|
return { text: hardTruncated, truncated: true, tokenOffset: expandedTokens - options.maxTokens };
|
|
16496
16496
|
}
|
|
16497
16497
|
async function recallPart({
|
|
@@ -16525,7 +16525,7 @@ async function recallPart({
|
|
|
16525
16525
|
`Part index ${partIndex} not found in message ${cursor}. Available indices: ${allParts.map((p) => p.partIndex).join(", ")}`
|
|
16526
16526
|
);
|
|
16527
16527
|
}
|
|
16528
|
-
const truncatedText =
|
|
16528
|
+
const truncatedText = chunkPOOOTRUM_cjs.truncateStringByTokens(target.text, maxTokens);
|
|
16529
16529
|
const wasTruncated = truncatedText !== target.text;
|
|
16530
16530
|
return {
|
|
16531
16531
|
text: truncatedText,
|
|
@@ -17559,7 +17559,7 @@ ${workingMemory}`;
|
|
|
17559
17559
|
}
|
|
17560
17560
|
return chunks;
|
|
17561
17561
|
}
|
|
17562
|
-
hasher =
|
|
17562
|
+
hasher = chunkPOOOTRUM_cjs.e();
|
|
17563
17563
|
// embedding is computationally expensive so cache content -> embeddings/chunks
|
|
17564
17564
|
embeddingCache = /* @__PURE__ */ new Map();
|
|
17565
17565
|
firstEmbed;
|
|
@@ -17940,7 +17940,7 @@ ${workingMemory}`;
|
|
|
17940
17940
|
"Observational memory requires @mastra/core support for request-response-id-rotation. Please bump @mastra/core to a newer version."
|
|
17941
17941
|
);
|
|
17942
17942
|
}
|
|
17943
|
-
const { ObservationalMemory: OMClass } = await import('./observational-memory-
|
|
17943
|
+
const { ObservationalMemory: OMClass } = await import('./observational-memory-SASGM6OW-2G3RBRTW.cjs');
|
|
17944
17944
|
const onIndexObservations = this.hasRetrievalSearch(omConfig.retrieval) ? async (observation) => {
|
|
17945
17945
|
await this.indexObservation(observation);
|
|
17946
17946
|
} : void 0;
|
|
@@ -18828,7 +18828,7 @@ Notes:
|
|
|
18828
18828
|
if (!effectiveConfig) return null;
|
|
18829
18829
|
const engine = await this.omEngine;
|
|
18830
18830
|
if (!engine) return null;
|
|
18831
|
-
const { ObservationalMemoryProcessor } = await import('./observational-memory-
|
|
18831
|
+
const { ObservationalMemoryProcessor } = await import('./observational-memory-SASGM6OW-2G3RBRTW.cjs');
|
|
18832
18832
|
return new ObservationalMemoryProcessor(engine, this);
|
|
18833
18833
|
}
|
|
18834
18834
|
};
|
|
@@ -30044,5 +30044,5 @@ exports.START_ASYNC_AGENT_BUILDER_ACTION_ROUTE = START_ASYNC_AGENT_BUILDER_ACTIO
|
|
|
30044
30044
|
exports.STREAM_AGENT_BUILDER_ACTION_ROUTE = STREAM_AGENT_BUILDER_ACTION_ROUTE;
|
|
30045
30045
|
exports.STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE;
|
|
30046
30046
|
exports.agent_builder_exports = agent_builder_exports;
|
|
30047
|
-
//# sourceMappingURL=chunk-
|
|
30048
|
-
//# sourceMappingURL=chunk-
|
|
30047
|
+
//# sourceMappingURL=chunk-MS7GNCN3.cjs.map
|
|
30048
|
+
//# sourceMappingURL=chunk-MS7GNCN3.cjs.map
|