@mastra/server 1.71.0 → 1.72.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/dist/{agents-CqEbqSrC.cjs → agents-DwJE1tsB.cjs} +5 -4
- package/dist/{agents-CqEbqSrC.cjs.map → agents-DwJE1tsB.cjs.map} +1 -1
- package/dist/{agents-Dstk6Isf.js → agents-kOz1lr_e.js} +5 -4
- package/dist/{agents-Dstk6Isf.js.map → agents-kOz1lr_e.js.map} +1 -1
- package/dist/{api-schema-manifest-wibRCXX8.js → api-schema-manifest-DJiUahwo.js} +2 -2
- package/dist/{api-schema-manifest-wibRCXX8.js.map → api-schema-manifest-DJiUahwo.js.map} +1 -1
- package/dist/{api-schema-manifest-CHTg1Kb-.cjs → api-schema-manifest-Maxewnw7.cjs} +2 -2
- package/dist/{api-schema-manifest-CHTg1Kb-.cjs.map → api-schema-manifest-Maxewnw7.cjs.map} +1 -1
- package/dist/{dist-D19QgTH4.js → dist-ABdCIqbD.js} +47 -10
- package/dist/dist-ABdCIqbD.js.map +1 -0
- package/dist/{dist-unhwBKm6.cjs → dist-Cfr6t0cK.cjs} +47 -10
- package/dist/dist-Cfr6t0cK.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{editor-builder-DRn7G0Mr.js → editor-builder-BLi1jvZd.js} +2 -2
- package/dist/{editor-builder-DRn7G0Mr.js.map → editor-builder-BLi1jvZd.js.map} +1 -1
- package/dist/{editor-builder-BaIipd1y.js → editor-builder-BrkDnCEd.js} +2 -2
- package/dist/{editor-builder-BaIipd1y.js.map → editor-builder-BrkDnCEd.js.map} +1 -1
- package/dist/{editor-builder-BbdoWaL_.cjs → editor-builder-DIpISGSI.cjs} +2 -2
- package/dist/{editor-builder-BbdoWaL_.cjs.map → editor-builder-DIpISGSI.cjs.map} +1 -1
- package/dist/{editor-builder-ByrOB5f8.cjs → editor-builder-Dm6jviKJ.cjs} +2 -2
- package/dist/{editor-builder-ByrOB5f8.cjs.map → editor-builder-Dm6jviKJ.cjs.map} +1 -1
- package/dist/route-builder-2yrD15TL.cjs.map +1 -1
- package/dist/route-builder-lBil8Cvo.js.map +1 -1
- package/dist/{routes-CLtivVqs.cjs → routes-C9CmwhbC.cjs} +3 -3
- package/dist/{routes-CLtivVqs.cjs.map → routes-C9CmwhbC.cjs.map} +1 -1
- package/dist/{routes-BRIkKqTl.js → routes-D6sAEgtj.js} +3 -3
- package/dist/{routes-BRIkKqTl.js.map → routes-D6sAEgtj.js.map} +1 -1
- package/dist/schema-e0VHpMt0-BS9KHnuT.cjs.map +1 -1
- package/dist/schema-e0VHpMt0-CvPvLS06.js.map +1 -1
- package/dist/server/handlers/agent-builder.cjs +2 -2
- package/dist/server/handlers/agent-builder.js +2 -2
- package/dist/server/handlers/agent-controller.cjs +12 -1
- package/dist/server/handlers/agent-controller.cjs.map +1 -1
- package/dist/server/handlers/agent-controller.d.ts.map +1 -1
- package/dist/server/handlers/agent-controller.js +12 -1
- package/dist/server/handlers/agent-controller.js.map +1 -1
- package/dist/server/handlers/agents.cjs +17 -4
- package/dist/server/handlers/agents.cjs.map +1 -1
- package/dist/server/handlers/agents.d.ts +6 -0
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +17 -4
- package/dist/server/handlers/agents.js.map +1 -1
- package/dist/server/handlers/editor-builder.cjs +1 -1
- package/dist/server/handlers/editor-builder.js +1 -1
- package/dist/server/handlers/favorites-enrichment.cjs +1 -1
- package/dist/server/handlers/favorites-enrichment.js +1 -1
- package/dist/server/handlers/plans.cjs +1 -1
- package/dist/server/handlers/plans.js +1 -1
- package/dist/server/handlers/stored-agent-favorites.cjs +1 -1
- package/dist/server/handlers/stored-agent-favorites.js +1 -1
- package/dist/server/handlers/stored-agents.cjs +1 -1
- package/dist/server/handlers/stored-agents.js +1 -1
- package/dist/server/handlers/stored-skill-favorites.cjs +1 -1
- package/dist/server/handlers/stored-skill-favorites.js +1 -1
- package/dist/server/handlers/stored-skills.cjs +1 -1
- package/dist/server/handlers/stored-skills.js +1 -1
- package/dist/server/handlers/system.cjs +1 -1
- package/dist/server/handlers/system.js +1 -1
- package/dist/server/handlers/tools.cjs +1 -1
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/workflow-builder.cjs +1 -1
- package/dist/server/handlers/workflow-builder.js +1 -1
- package/dist/server/handlers/workflows.cjs +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/schemas/agents.d.ts +3 -0
- package/dist/server/schemas/agents.d.ts.map +1 -1
- package/dist/server/schemas/index.cjs +2 -2
- package/dist/server/schemas/index.js +2 -2
- package/dist/server/server-adapter/index.cjs +1 -1
- package/dist/server/server-adapter/index.js +1 -1
- package/dist/{workflow-builder-Cp9M5q2y.cjs → workflow-builder-DTcM8ER3.cjs} +3 -3
- package/dist/{workflow-builder-Cp9M5q2y.cjs.map → workflow-builder-DTcM8ER3.cjs.map} +1 -1
- package/dist/{workflow-builder-JDAg-Yz7.js → workflow-builder-KRSpDol2.js} +3 -3
- package/dist/{workflow-builder-JDAg-Yz7.js.map → workflow-builder-KRSpDol2.js.map} +1 -1
- package/package.json +5 -5
- package/dist/dist-D19QgTH4.js.map +0 -1
- package/dist/dist-unhwBKm6.cjs.map +0 -1
|
@@ -4638,7 +4638,7 @@ function splitLines(text) {
|
|
|
4638
4638
|
return result;
|
|
4639
4639
|
}
|
|
4640
4640
|
//#endregion
|
|
4641
|
-
//#region ../memory/dist/src-
|
|
4641
|
+
//#region ../memory/dist/src-B-_pkR2t.js
|
|
4642
4642
|
var __defProp$3 = Object.defineProperty;
|
|
4643
4643
|
var __exportAll = (all, no_symbols) => {
|
|
4644
4644
|
let target = {};
|
|
@@ -27649,7 +27649,7 @@ async function summarizeConversation(opts) {
|
|
|
27649
27649
|
usage: result.usage
|
|
27650
27650
|
};
|
|
27651
27651
|
}
|
|
27652
|
-
const UPDATE_WORKING_MEMORY_TOOL_NAME = "updateWorkingMemory";
|
|
27652
|
+
const UPDATE_WORKING_MEMORY_TOOL_NAME$1 = "updateWorkingMemory";
|
|
27653
27653
|
const SET_WORKING_MEMORY_TOOL_NAME = "setWorkingMemory";
|
|
27654
27654
|
/**
|
|
27655
27655
|
* Deep merges two objects, with special handling for null values (delete) and arrays (replace).
|
|
@@ -27907,7 +27907,7 @@ function createWorkingMemoryTool(config, options = {}) {
|
|
|
27907
27907
|
const useStateSignals = config.workingMemory?.useStateSignals === true;
|
|
27908
27908
|
const tool = options.vNext ? __experimental_updateWorkingMemoryToolVNext(config) : updateWorkingMemoryTool(config);
|
|
27909
27909
|
return {
|
|
27910
|
-
name: useStateSignals ? SET_WORKING_MEMORY_TOOL_NAME : UPDATE_WORKING_MEMORY_TOOL_NAME,
|
|
27910
|
+
name: useStateSignals ? SET_WORKING_MEMORY_TOOL_NAME : UPDATE_WORKING_MEMORY_TOOL_NAME$1,
|
|
27911
27911
|
tool
|
|
27912
27912
|
};
|
|
27913
27913
|
}
|
|
@@ -33372,6 +33372,7 @@ function parseActivationTTL(value, fieldPath) {
|
|
|
33372
33372
|
if (!Number.isFinite(amount) || amount < 0) throw new Error(`${fieldPath} must be a non-negative number of milliseconds or a duration string like "5m".`);
|
|
33373
33373
|
return amount * (unit === "ms" || unit === "msec" || unit === "msecs" || unit === "millisecond" || unit === "milliseconds" ? 1 : unit === "s" || unit === "sec" || unit === "secs" || unit === "second" || unit === "seconds" ? 1e3 : unit === "m" || unit === "min" || unit === "mins" || unit === "minute" || unit === "minutes" ? 6e4 : 36e5);
|
|
33374
33374
|
}
|
|
33375
|
+
let hasWarnedResourceScopeDeprecation = false;
|
|
33375
33376
|
/**
|
|
33376
33377
|
* ObservationalMemory - A three-agent memory system for long conversations.
|
|
33377
33378
|
*
|
|
@@ -33650,6 +33651,10 @@ var ObservationalMemory = class ObservationalMemory {
|
|
|
33650
33651
|
hooks: this.hooks
|
|
33651
33652
|
});
|
|
33652
33653
|
this.validateBufferConfig();
|
|
33654
|
+
if (this.scope === "resource" && !hasWarnedResourceScopeDeprecation) {
|
|
33655
|
+
hasWarnedResourceScopeDeprecation = true;
|
|
33656
|
+
console.warn("[Mastra] Observational memory `scope: 'resource'` is deprecated and will be removed in a future release because it works much worse than thread scope for prompt caching and agent understanding. Remove `scope` to use the default thread scope, and enable `retrieval` for cross-thread recall. See https://mastra.ai/docs/memory/observational-memory#resource-scope-deprecated");
|
|
33657
|
+
}
|
|
33653
33658
|
omDebug(`[OM:init] new ObservationalMemory instance created — scope=${this.scope}, messageTokens=${JSON.stringify(this.observationConfig.messageTokens)}, obsAsyncEnabled=${this.buffering.isAsyncObservationEnabled()}, bufferTokens=${this.observationConfig.bufferTokens}, bufferActivation=${this.observationConfig.bufferActivation}, blockAfter=${this.observationConfig.blockAfter}, reflectionTokens=${this.reflectionConfig.observationTokens}, refAsyncEnabled=${this.buffering.isAsyncReflectionEnabled()}, refAsyncActivation=${this.reflectionConfig.bufferActivation}, refBlockAfter=${this.reflectionConfig.blockAfter}`);
|
|
33654
33659
|
}
|
|
33655
33660
|
__registerMastra(mastra) {
|
|
@@ -36217,6 +36222,40 @@ function extractWorkingMemoryContent(text) {
|
|
|
36217
36222
|
if (end === -1) return null;
|
|
36218
36223
|
return text.substring(contentStart, end);
|
|
36219
36224
|
}
|
|
36225
|
+
const UPDATE_WORKING_MEMORY_TOOL_NAME = "updateWorkingMemory";
|
|
36226
|
+
/**
|
|
36227
|
+
* Removes `updateWorkingMemory` tool invocations from stored message parts, one step
|
|
36228
|
+
* at a time. A step starts at a `step-start` part, or where a tool part is followed by
|
|
36229
|
+
* a non-tool part (the same boundary prompt conversion uses when markers are missing).
|
|
36230
|
+
* A step whose tool calls were all working-memory calls loses its tool-call/tool-result
|
|
36231
|
+
* boundary once they are removed. If only reasoning is left, the whole step is dropped:
|
|
36232
|
+
* replaying that signed reasoning merges it into the next step's assistant message,
|
|
36233
|
+
* which providers such as Anthropic reject (see #22798).
|
|
36234
|
+
*/
|
|
36235
|
+
function removeWorkingMemoryToolInvocationParts(parts) {
|
|
36236
|
+
const isWorkingMemoryCall = (part) => part?.type === "tool-invocation" && part.toolInvocation?.toolName === UPDATE_WORKING_MEMORY_TOOL_NAME;
|
|
36237
|
+
if (!parts.some(isWorkingMemoryCall)) return parts;
|
|
36238
|
+
const steps = [];
|
|
36239
|
+
parts.forEach((part, i) => {
|
|
36240
|
+
const previous = parts[i - 1];
|
|
36241
|
+
if (part?.type === "step-start" || previous?.type === "tool-invocation" && part?.type !== "tool-invocation" || steps.length === 0) steps.push([]);
|
|
36242
|
+
steps[steps.length - 1].push(part);
|
|
36243
|
+
});
|
|
36244
|
+
return steps.flatMap((step) => {
|
|
36245
|
+
if (!step.some(isWorkingMemoryCall)) return step;
|
|
36246
|
+
const remaining = step.filter((part) => !isWorkingMemoryCall(part));
|
|
36247
|
+
return remaining.every((part) => part?.type === "step-start" || part?.type === "reasoning" || part?.type === "text" && !removeWorkingMemoryTags(part.text ?? "").trim()) ? [] : remaining;
|
|
36248
|
+
});
|
|
36249
|
+
}
|
|
36250
|
+
/**
|
|
36251
|
+
* Removes `updateWorkingMemory` entries from the legacy `toolInvocations` array so
|
|
36252
|
+
* prompt conversion cannot re-add a stripped working-memory call.
|
|
36253
|
+
*/
|
|
36254
|
+
function removeWorkingMemoryToolInvocations(toolInvocations) {
|
|
36255
|
+
if (!toolInvocations?.some((invocation) => invocation.toolName === UPDATE_WORKING_MEMORY_TOOL_NAME)) return toolInvocations;
|
|
36256
|
+
const remaining = toolInvocations.filter((invocation) => invocation.toolName !== UPDATE_WORKING_MEMORY_TOOL_NAME);
|
|
36257
|
+
return remaining.length > 0 ? remaining : void 0;
|
|
36258
|
+
}
|
|
36220
36259
|
function isRecallSignalType(type) {
|
|
36221
36260
|
return type === "user" || type === "state" || type === "reactive" || type === "notification" || type === "user-message" || type === "system-reminder";
|
|
36222
36261
|
}
|
|
@@ -37076,10 +37115,8 @@ ${workingMemory}`;
|
|
|
37076
37115
|
if (message.content && typeof message.content === "object" && !Array.isArray(message.content)) newMessage.content = { ...message.content };
|
|
37077
37116
|
if (typeof newMessage.content?.content === "string" && newMessage.content.content.length > 0) newMessage.content.content = removeWorkingMemoryTags(newMessage.content.content).trim();
|
|
37078
37117
|
if (Array.isArray(newMessage.content?.parts)) {
|
|
37079
|
-
newMessage.content.
|
|
37080
|
-
|
|
37081
|
-
return true;
|
|
37082
|
-
}).map((part) => {
|
|
37118
|
+
if (Array.isArray(newMessage.content.toolInvocations)) newMessage.content.toolInvocations = removeWorkingMemoryToolInvocations(newMessage.content.toolInvocations);
|
|
37119
|
+
newMessage.content.parts = removeWorkingMemoryToolInvocationParts(newMessage.content.parts).map((part) => {
|
|
37083
37120
|
if (part?.type === "text") {
|
|
37084
37121
|
const text = typeof part.text === "string" ? part.text : "";
|
|
37085
37122
|
return {
|
|
@@ -37432,7 +37469,7 @@ ${hasEmptyWorkingMemoryTemplateObject ? "When working with json data, the object
|
|
|
37432
37469
|
${hasEmptyWorkingMemoryTemplateObject ? JSON.stringify(emptyWorkingMemoryTemplateObject) : ""}
|
|
37433
37470
|
|
|
37434
37471
|
<working_memory_data>
|
|
37435
|
-
${data}
|
|
37472
|
+
${data || "No working memory data available."}
|
|
37436
37473
|
</working_memory_data>
|
|
37437
37474
|
|
|
37438
37475
|
Notes:
|
|
@@ -37461,7 +37498,7 @@ ${template.content}
|
|
|
37461
37498
|
</working_memory_template>
|
|
37462
37499
|
|
|
37463
37500
|
<working_memory_data>
|
|
37464
|
-
${data}
|
|
37501
|
+
${data || "No working memory data available."}
|
|
37465
37502
|
</working_memory_data>
|
|
37466
37503
|
|
|
37467
37504
|
Notes:
|
|
@@ -49237,4 +49274,4 @@ const agentBuilderWorkflows = {
|
|
|
49237
49274
|
//#endregion
|
|
49238
49275
|
exports.agentBuilderWorkflows = agentBuilderWorkflows;
|
|
49239
49276
|
|
|
49240
|
-
//# sourceMappingURL=dist-
|
|
49277
|
+
//# sourceMappingURL=dist-Cfr6t0cK.cjs.map
|