@mastra/server 1.17.0 → 1.18.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 +22 -0
- package/dist/{chunk-MROITNSM.js → chunk-4Q2QV27C.js} +13 -3
- package/dist/chunk-4Q2QV27C.js.map +1 -0
- package/dist/{chunk-4OM2A5ZZ.cjs → chunk-6H7FQ4CY.cjs} +14 -2
- package/dist/chunk-6H7FQ4CY.cjs.map +1 -0
- package/dist/{chunk-OXE6JN54.js → chunk-6MYRF6QR.js} +68 -4
- package/dist/chunk-6MYRF6QR.js.map +1 -0
- package/dist/{chunk-R5EM57UR.cjs → chunk-DJQT32SV.cjs} +214 -81
- package/dist/chunk-DJQT32SV.cjs.map +1 -0
- package/dist/{chunk-PZE5ZBAX.js → chunk-OSQ4FZT2.js} +5 -5
- package/dist/{chunk-PZE5ZBAX.js.map → chunk-OSQ4FZT2.js.map} +1 -1
- package/dist/{chunk-WICIG6YL.js → chunk-PVUR75AM.js} +214 -81
- package/dist/chunk-PVUR75AM.js.map +1 -0
- package/dist/{chunk-XBMICDYC.cjs → chunk-Z36FXNDQ.cjs} +126 -60
- package/dist/chunk-Z36FXNDQ.cjs.map +1 -0
- package/dist/{chunk-SZBVW2WD.cjs → chunk-ZBOL3JND.cjs} +18 -18
- package/dist/{chunk-SZBVW2WD.cjs.map → chunk-ZBOL3JND.cjs.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{observational-memory-WMCWT577-MXWR6ZYS.cjs → observational-memory-UGDENJPE-DM3C7ZXI.cjs} +26 -26
- package/dist/{observational-memory-WMCWT577-MXWR6ZYS.cjs.map → observational-memory-UGDENJPE-DM3C7ZXI.cjs.map} +1 -1
- package/dist/{observational-memory-WMCWT577-EDKAVK3W.js → observational-memory-UGDENJPE-NVMIXNI4.js} +3 -3
- package/dist/{observational-memory-WMCWT577-EDKAVK3W.js.map → observational-memory-UGDENJPE-NVMIXNI4.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/datasets.cjs +32 -24
- package/dist/server/handlers/datasets.d.ts +88 -0
- package/dist/server/handlers/datasets.d.ts.map +1 -1
- package/dist/server/handlers/datasets.js +1 -1
- package/dist/server/handlers.cjs +2 -2
- package/dist/server/handlers.js +1 -1
- package/dist/server/schemas/datasets.d.ts +16 -0
- package/dist/server/schemas/datasets.d.ts.map +1 -1
- package/dist/server/schemas/index.cjs +48 -40
- package/dist/server/schemas/index.js +1 -1
- package/dist/server/server-adapter/index.cjs +45 -41
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.js +7 -3
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/routes/datasets.d.ts +87 -1
- package/dist/server/server-adapter/routes/datasets.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-4OM2A5ZZ.cjs.map +0 -1
- package/dist/chunk-MROITNSM.js.map +0 -1
- package/dist/chunk-OXE6JN54.js.map +0 -1
- package/dist/chunk-R5EM57UR.cjs.map +0 -1
- package/dist/chunk-WICIG6YL.js.map +0 -1
- package/dist/chunk-XBMICDYC.cjs.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 chunkDJQT32SV_cjs = require('./chunk-DJQT32SV.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');
|
|
@@ -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 (chunkDJQT32SV_cjs.estimateTokenCount(text42) <= maxTokens) return { text: text42, wasTruncated: false };
|
|
16197
|
+
const truncated = chunkDJQT32SV_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 } = chunkDJQT32SV_cjs.resolveToolResultValue(
|
|
16231
16231
|
part,
|
|
16232
16232
|
inv.result
|
|
16233
16233
|
);
|
|
16234
|
-
const resultStr =
|
|
16234
|
+
const resultStr = chunkDJQT32SV_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 = chunkDJQT32SV_cjs.estimateTokenCount(text42);
|
|
16297
16297
|
if (totalTokens > options.maxTokens) {
|
|
16298
|
-
const truncated =
|
|
16298
|
+
const truncated = chunkDJQT32SV_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 = chunkDJQT32SV_cjs.estimateTokenCount(part.fullText);
|
|
16310
|
+
const currentTokens = chunkDJQT32SV_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 = chunkDJQT32SV_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 = chunkDJQT32SV_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 = chunkDJQT32SV_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 = chunkDJQT32SV_cjs.truncateStringByTokens(target.text, maxTokens);
|
|
16367
16367
|
const wasTruncated = truncatedText !== target.text;
|
|
16368
16368
|
return {
|
|
16369
16369
|
text: truncatedText,
|
|
@@ -17193,7 +17193,7 @@ ${workingMemory}`;
|
|
|
17193
17193
|
}
|
|
17194
17194
|
return chunks;
|
|
17195
17195
|
}
|
|
17196
|
-
hasher =
|
|
17196
|
+
hasher = chunkDJQT32SV_cjs.e();
|
|
17197
17197
|
// embedding is computationally expensive so cache content -> embeddings/chunks
|
|
17198
17198
|
embeddingCache = /* @__PURE__ */ new Map();
|
|
17199
17199
|
firstEmbed;
|
|
@@ -17574,7 +17574,7 @@ ${workingMemory}`;
|
|
|
17574
17574
|
"Observational memory requires @mastra/core support for request-response-id-rotation. Please bump @mastra/core to a newer version."
|
|
17575
17575
|
);
|
|
17576
17576
|
}
|
|
17577
|
-
const { ObservationalMemory: OMClass } = await import('./observational-memory-
|
|
17577
|
+
const { ObservationalMemory: OMClass } = await import('./observational-memory-UGDENJPE-DM3C7ZXI.cjs');
|
|
17578
17578
|
return new OMClass({
|
|
17579
17579
|
storage: memoryStore,
|
|
17580
17580
|
scope: omConfig.scope,
|
|
@@ -18287,7 +18287,7 @@ Notes:
|
|
|
18287
18287
|
if (!effectiveConfig) return null;
|
|
18288
18288
|
const engine = await this.omEngine;
|
|
18289
18289
|
if (!engine) return null;
|
|
18290
|
-
const { ObservationalMemoryProcessor } = await import('./observational-memory-
|
|
18290
|
+
const { ObservationalMemoryProcessor } = await import('./observational-memory-UGDENJPE-DM3C7ZXI.cjs');
|
|
18291
18291
|
return new ObservationalMemoryProcessor(engine, this);
|
|
18292
18292
|
}
|
|
18293
18293
|
};
|
|
@@ -29503,5 +29503,5 @@ exports.START_ASYNC_AGENT_BUILDER_ACTION_ROUTE = START_ASYNC_AGENT_BUILDER_ACTIO
|
|
|
29503
29503
|
exports.STREAM_AGENT_BUILDER_ACTION_ROUTE = STREAM_AGENT_BUILDER_ACTION_ROUTE;
|
|
29504
29504
|
exports.STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE;
|
|
29505
29505
|
exports.agent_builder_exports = agent_builder_exports;
|
|
29506
|
-
//# sourceMappingURL=chunk-
|
|
29507
|
-
//# sourceMappingURL=chunk-
|
|
29506
|
+
//# sourceMappingURL=chunk-ZBOL3JND.cjs.map
|
|
29507
|
+
//# sourceMappingURL=chunk-ZBOL3JND.cjs.map
|