@mastra/server 1.21.0-alpha.0 → 1.21.0-alpha.2
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 +16 -0
- package/dist/_types/@internal_core/dist/index.d.ts +24 -14
- package/dist/{chunk-DAEHQAZC.cjs → chunk-DNYJSPA5.cjs} +27 -6
- package/dist/chunk-DNYJSPA5.cjs.map +1 -0
- package/dist/{chunk-EDP2Y6XD.cjs → chunk-DWXE75AZ.cjs} +19 -19
- package/dist/{chunk-EDP2Y6XD.cjs.map → chunk-DWXE75AZ.cjs.map} +1 -1
- package/dist/{chunk-5CDCKTHB.js → chunk-FCLPA23B.js} +27 -6
- package/dist/chunk-FCLPA23B.js.map +1 -0
- package/dist/{chunk-3VVDBDS5.cjs → chunk-IRRJW5EA.cjs} +4 -3
- package/dist/chunk-IRRJW5EA.cjs.map +1 -0
- package/dist/{chunk-XINNAPVH.cjs → chunk-JMOCVI6W.cjs} +29 -29
- package/dist/{chunk-XINNAPVH.cjs.map → chunk-JMOCVI6W.cjs.map} +1 -1
- package/dist/{chunk-YFQ5JIUD.js → chunk-M7MFCJT4.js} +14 -9
- package/dist/chunk-M7MFCJT4.js.map +1 -0
- package/dist/{chunk-VGHQI3X3.js → chunk-NCW7IFFR.js} +4 -3
- package/dist/chunk-NCW7IFFR.js.map +1 -0
- package/dist/{chunk-MYFV2L3T.js → chunk-PKONZNTB.js} +3 -3
- package/dist/{chunk-MYFV2L3T.js.map → chunk-PKONZNTB.js.map} +1 -1
- package/dist/{chunk-O7CC4J2Y.js → chunk-SW6IJZFQ.js} +5 -5
- package/dist/{chunk-O7CC4J2Y.js.map → chunk-SW6IJZFQ.js.map} +1 -1
- package/dist/{chunk-OSMI5XLT.cjs → chunk-VUW7PJZC.cjs} +14 -9
- package/dist/chunk-VUW7PJZC.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{observational-memory-B25SASRW-T76NSRNU.cjs → observational-memory-WOEVNCG4-5THJIIQE.cjs} +26 -26
- package/dist/{observational-memory-B25SASRW-T76NSRNU.cjs.map → observational-memory-WOEVNCG4-5THJIIQE.cjs.map} +1 -1
- package/dist/{observational-memory-B25SASRW-L4GYD2ZN.js → observational-memory-WOEVNCG4-DT36JHO2.js} +3 -3
- package/dist/{observational-memory-B25SASRW-L4GYD2ZN.js.map → observational-memory-WOEVNCG4-DT36JHO2.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/observability-new-endpoints.cjs +27 -27
- package/dist/server/handlers/observability-new-endpoints.d.ts +24 -16
- package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
- package/dist/server/handlers/observability-new-endpoints.js +1 -1
- package/dist/server/handlers/observability.cjs +32 -32
- package/dist/server/handlers/observability.js +2 -2
- package/dist/server/handlers/responses.cjs +4 -4
- package/dist/server/handlers/responses.d.ts.map +1 -1
- package/dist/server/handlers/responses.js +1 -1
- package/dist/server/handlers.cjs +6 -6
- package/dist/server/handlers.js +3 -3
- package/dist/server/server-adapter/index.cjs +49 -49
- package/dist/server/server-adapter/index.js +4 -4
- package/dist/server/server-adapter/routes/observability.d.ts +12 -8
- package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-3VVDBDS5.cjs.map +0 -1
- package/dist/chunk-5CDCKTHB.js.map +0 -1
- package/dist/chunk-DAEHQAZC.cjs.map +0 -1
- package/dist/chunk-OSMI5XLT.cjs.map +0 -1
- package/dist/chunk-VGHQI3X3.js.map +0 -1
- package/dist/chunk-YFQ5JIUD.js.map +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunk5N66PU3H_cjs = require('./chunk-5N66PU3H.cjs');
|
|
4
4
|
var chunkFPURK3UW_cjs = require('./chunk-FPURK3UW.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkDNYJSPA5_cjs = require('./chunk-DNYJSPA5.cjs');
|
|
6
6
|
var chunkR2ODPDKE_cjs = require('./chunk-R2ODPDKE.cjs');
|
|
7
7
|
var chunk5IKQNFW5_cjs = require('./chunk-5IKQNFW5.cjs');
|
|
8
8
|
var chunkDOHUOYZS_cjs = require('./chunk-DOHUOYZS.cjs');
|
|
@@ -16392,8 +16392,8 @@ function formatTimestamp(date) {
|
|
|
16392
16392
|
return date.toISOString().replace("T", " ").replace(/\.\d{3}Z$/, "Z");
|
|
16393
16393
|
}
|
|
16394
16394
|
function truncateByTokens(text42, maxTokens, hint) {
|
|
16395
|
-
if (
|
|
16396
|
-
const truncated =
|
|
16395
|
+
if (chunkDNYJSPA5_cjs.estimateTokenCount(text42) <= maxTokens) return { text: text42, wasTruncated: false };
|
|
16396
|
+
const truncated = chunkDNYJSPA5_cjs.truncateStringByTokens(text42, maxTokens);
|
|
16397
16397
|
const suffix = hint ? ` [${hint} for more]` : "";
|
|
16398
16398
|
return { text: truncated + suffix, wasTruncated: true };
|
|
16399
16399
|
}
|
|
@@ -16426,11 +16426,11 @@ function formatMessageParts(msg, detail) {
|
|
|
16426
16426
|
} else if (partType === "tool-invocation") {
|
|
16427
16427
|
const inv = part.toolInvocation;
|
|
16428
16428
|
if (inv.state === "result") {
|
|
16429
|
-
const { value: resultValue } =
|
|
16429
|
+
const { value: resultValue } = chunkDNYJSPA5_cjs.resolveToolResultValue(
|
|
16430
16430
|
part,
|
|
16431
16431
|
inv.result
|
|
16432
16432
|
);
|
|
16433
|
-
const resultStr =
|
|
16433
|
+
const resultStr = chunkDNYJSPA5_cjs.formatToolResultForObserver(resultValue, { maxTokens: HIGH_DETAIL_TOOL_RESULT_TOKENS });
|
|
16434
16434
|
const fullText = `[Tool Result: ${inv.toolName}]
|
|
16435
16435
|
${resultStr}`;
|
|
16436
16436
|
parts.push(makePart(msg, i, "tool-result", fullText, detail));
|
|
@@ -16513,9 +16513,9 @@ function expandPriority(part) {
|
|
|
16513
16513
|
}
|
|
16514
16514
|
function renderFormattedParts(parts, timestamps, options) {
|
|
16515
16515
|
const text42 = buildRenderedText(parts, timestamps);
|
|
16516
|
-
let totalTokens =
|
|
16516
|
+
let totalTokens = chunkDNYJSPA5_cjs.estimateTokenCount(text42);
|
|
16517
16517
|
if (totalTokens > options.maxTokens) {
|
|
16518
|
-
const truncated =
|
|
16518
|
+
const truncated = chunkDNYJSPA5_cjs.truncateStringByTokens(text42, options.maxTokens);
|
|
16519
16519
|
return { text: truncated, truncated: true, tokenOffset: totalTokens - options.maxTokens };
|
|
16520
16520
|
}
|
|
16521
16521
|
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));
|
|
@@ -16526,8 +16526,8 @@ function renderFormattedParts(parts, timestamps, options) {
|
|
|
16526
16526
|
for (const { part, index } of truncatedIndices) {
|
|
16527
16527
|
if (remaining <= 0) break;
|
|
16528
16528
|
const maxTokens = expandLimit(part);
|
|
16529
|
-
const fullTokens =
|
|
16530
|
-
const currentTokens =
|
|
16529
|
+
const fullTokens = chunkDNYJSPA5_cjs.estimateTokenCount(part.fullText);
|
|
16530
|
+
const currentTokens = chunkDNYJSPA5_cjs.estimateTokenCount(part.text);
|
|
16531
16531
|
const targetTokens = Math.min(fullTokens, maxTokens);
|
|
16532
16532
|
const delta = targetTokens - currentTokens;
|
|
16533
16533
|
if (delta <= 0) continue;
|
|
@@ -16538,17 +16538,17 @@ function renderFormattedParts(parts, timestamps, options) {
|
|
|
16538
16538
|
const expandedLimit = Math.min(currentTokens + remaining, maxTokens);
|
|
16539
16539
|
const hint = `recall cursor="${part.messageId}" partIndex=${part.partIndex} detail="high"`;
|
|
16540
16540
|
const { text: expanded2 } = truncateByTokens(part.fullText, expandedLimit, hint);
|
|
16541
|
-
const expandedDelta =
|
|
16541
|
+
const expandedDelta = chunkDNYJSPA5_cjs.estimateTokenCount(expanded2) - currentTokens;
|
|
16542
16542
|
parts[index] = { ...part, text: expanded2 };
|
|
16543
16543
|
remaining -= expandedDelta;
|
|
16544
16544
|
}
|
|
16545
16545
|
}
|
|
16546
16546
|
const expanded = buildRenderedText(parts, timestamps);
|
|
16547
|
-
const expandedTokens =
|
|
16547
|
+
const expandedTokens = chunkDNYJSPA5_cjs.estimateTokenCount(expanded);
|
|
16548
16548
|
if (expandedTokens <= options.maxTokens) {
|
|
16549
16549
|
return { text: expanded, truncated: false, tokenOffset: 0 };
|
|
16550
16550
|
}
|
|
16551
|
-
const hardTruncated =
|
|
16551
|
+
const hardTruncated = chunkDNYJSPA5_cjs.truncateStringByTokens(expanded, options.maxTokens);
|
|
16552
16552
|
return { text: hardTruncated, truncated: true, tokenOffset: expandedTokens - options.maxTokens };
|
|
16553
16553
|
}
|
|
16554
16554
|
async function recallPart({
|
|
@@ -16599,7 +16599,7 @@ async function recallPart({
|
|
|
16599
16599
|
|
|
16600
16600
|
`;
|
|
16601
16601
|
const fallbackText = `${fallbackNote}${firstNextPart.text}`;
|
|
16602
|
-
const truncatedText2 =
|
|
16602
|
+
const truncatedText2 = chunkDNYJSPA5_cjs.truncateStringByTokens(fallbackText, maxTokens);
|
|
16603
16603
|
const wasTruncated2 = truncatedText2 !== fallbackText;
|
|
16604
16604
|
return {
|
|
16605
16605
|
text: truncatedText2,
|
|
@@ -16614,7 +16614,7 @@ async function recallPart({
|
|
|
16614
16614
|
}
|
|
16615
16615
|
throw new Error(`Part index ${partIndex} not found in message ${cursor}. Available indices: ${availableIndices}`);
|
|
16616
16616
|
}
|
|
16617
|
-
const truncatedText =
|
|
16617
|
+
const truncatedText = chunkDNYJSPA5_cjs.truncateStringByTokens(target.text, maxTokens);
|
|
16618
16618
|
const wasTruncated = truncatedText !== target.text;
|
|
16619
16619
|
return {
|
|
16620
16620
|
text: truncatedText,
|
|
@@ -17674,7 +17674,7 @@ ${workingMemory}`;
|
|
|
17674
17674
|
}
|
|
17675
17675
|
return chunks;
|
|
17676
17676
|
}
|
|
17677
|
-
hasher =
|
|
17677
|
+
hasher = chunkDNYJSPA5_cjs.e();
|
|
17678
17678
|
// embedding is computationally expensive so cache content -> embeddings/chunks
|
|
17679
17679
|
embeddingCache = /* @__PURE__ */ new Map();
|
|
17680
17680
|
firstEmbed;
|
|
@@ -18058,7 +18058,7 @@ ${workingMemory}`;
|
|
|
18058
18058
|
"Observational memory requires @mastra/core support for request-response-id-rotation. Please bump @mastra/core to a newer version."
|
|
18059
18059
|
);
|
|
18060
18060
|
}
|
|
18061
|
-
const { ObservationalMemory: OMClass } = await import('./observational-memory-
|
|
18061
|
+
const { ObservationalMemory: OMClass } = await import('./observational-memory-WOEVNCG4-5THJIIQE.cjs');
|
|
18062
18062
|
const onIndexObservations = this.hasRetrievalSearch(omConfig.retrieval) ? async (observation) => {
|
|
18063
18063
|
await this.indexObservation(observation);
|
|
18064
18064
|
} : void 0;
|
|
@@ -18946,7 +18946,7 @@ Notes:
|
|
|
18946
18946
|
if (!effectiveConfig) return null;
|
|
18947
18947
|
const engine = await this.omEngine;
|
|
18948
18948
|
if (!engine) return null;
|
|
18949
|
-
const { ObservationalMemoryProcessor } = await import('./observational-memory-
|
|
18949
|
+
const { ObservationalMemoryProcessor } = await import('./observational-memory-WOEVNCG4-5THJIIQE.cjs');
|
|
18950
18950
|
return new ObservationalMemoryProcessor(engine, this);
|
|
18951
18951
|
}
|
|
18952
18952
|
};
|
|
@@ -30166,5 +30166,5 @@ exports.START_ASYNC_AGENT_BUILDER_ACTION_ROUTE = START_ASYNC_AGENT_BUILDER_ACTIO
|
|
|
30166
30166
|
exports.STREAM_AGENT_BUILDER_ACTION_ROUTE = STREAM_AGENT_BUILDER_ACTION_ROUTE;
|
|
30167
30167
|
exports.STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE;
|
|
30168
30168
|
exports.agent_builder_exports = agent_builder_exports;
|
|
30169
|
-
//# sourceMappingURL=chunk-
|
|
30170
|
-
//# sourceMappingURL=chunk-
|
|
30169
|
+
//# sourceMappingURL=chunk-DWXE75AZ.cjs.map
|
|
30170
|
+
//# sourceMappingURL=chunk-DWXE75AZ.cjs.map
|