@mastra/core 1.18.1-alpha.0 → 1.19.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 +32 -0
- package/dist/agent/agent-legacy.d.ts +3 -1
- package/dist/agent/agent-legacy.d.ts.map +1 -1
- package/dist/agent/agent.d.ts +3 -1
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/index.cjs +8 -8
- package/dist/agent/index.js +1 -1
- package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
- package/dist/{chunk-AV4YSAZL.cjs → chunk-2OYWVA6F.cjs} +17 -2
- package/dist/chunk-2OYWVA6F.cjs.map +1 -0
- package/dist/{chunk-45LU555A.cjs → chunk-2RTFET56.cjs} +7 -7
- package/dist/{chunk-45LU555A.cjs.map → chunk-2RTFET56.cjs.map} +1 -1
- package/dist/{chunk-LKZQG2ZZ.cjs → chunk-4TUILCMR.cjs} +7 -6
- package/dist/chunk-4TUILCMR.cjs.map +1 -0
- package/dist/{chunk-NMDKJUHA.cjs → chunk-5OBBDZBA.cjs} +185 -185
- package/dist/{chunk-NMDKJUHA.cjs.map → chunk-5OBBDZBA.cjs.map} +1 -1
- package/dist/{chunk-OF7ELKXY.js → chunk-6TEEIOHA.js} +4 -4
- package/dist/{chunk-OF7ELKXY.js.map → chunk-6TEEIOHA.js.map} +1 -1
- package/dist/{chunk-KG5NOH3Z.js → chunk-6XYHMM2X.js} +8 -8
- package/dist/{chunk-KG5NOH3Z.js.map → chunk-6XYHMM2X.js.map} +1 -1
- package/dist/{chunk-IVXAQT6H.js → chunk-BS5UESNT.js} +93 -42
- package/dist/chunk-BS5UESNT.js.map +1 -0
- package/dist/{chunk-NRIT3KHS.js → chunk-CSIKD56W.js} +3 -3
- package/dist/{chunk-NRIT3KHS.js.map → chunk-CSIKD56W.js.map} +1 -1
- package/dist/{chunk-KEYCLRBI.js → chunk-D5EXC3XM.js} +4 -4
- package/dist/{chunk-KEYCLRBI.js.map → chunk-D5EXC3XM.js.map} +1 -1
- package/dist/{chunk-XQRTJIC7.cjs → chunk-E2SMTTP6.cjs} +45 -16
- package/dist/chunk-E2SMTTP6.cjs.map +1 -0
- package/dist/{chunk-RVBOSWN5.cjs → chunk-E3JUOJME.cjs} +5 -5
- package/dist/{chunk-RVBOSWN5.cjs.map → chunk-E3JUOJME.cjs.map} +1 -1
- package/dist/{chunk-FA4PTEBK.js → chunk-EWPUWV33.js} +18 -3
- package/dist/chunk-EWPUWV33.js.map +1 -0
- package/dist/{chunk-BWRB3RPC.js → chunk-F4PVOQKD.js} +3 -3
- package/dist/{chunk-BWRB3RPC.js.map → chunk-F4PVOQKD.js.map} +1 -1
- package/dist/{chunk-TJNYXDI7.cjs → chunk-GFQPMPSV.cjs} +7 -113
- package/dist/chunk-GFQPMPSV.cjs.map +1 -0
- package/dist/{chunk-V2NQOABM.cjs → chunk-GNA52EF4.cjs} +9 -9
- package/dist/{chunk-V2NQOABM.cjs.map → chunk-GNA52EF4.cjs.map} +1 -1
- package/dist/{chunk-GALW5K2E.js → chunk-IOHKSHT4.js} +3 -3
- package/dist/{chunk-GALW5K2E.js.map → chunk-IOHKSHT4.js.map} +1 -1
- package/dist/{chunk-Z7DO2WCR.cjs → chunk-IQV2SVCE.cjs} +52 -52
- package/dist/{chunk-Z7DO2WCR.cjs.map → chunk-IQV2SVCE.cjs.map} +1 -1
- package/dist/{chunk-GXXNF6NF.cjs → chunk-L2FL7HMV.cjs} +35 -30
- package/dist/chunk-L2FL7HMV.cjs.map +1 -0
- package/dist/{chunk-HZI7AYCD.js → chunk-M62LMDHE.js} +8 -7
- package/dist/chunk-M62LMDHE.js.map +1 -0
- package/dist/{chunk-TPE5VTVF.cjs → chunk-MN7WNZE6.cjs} +6 -6
- package/dist/{chunk-TPE5VTVF.cjs.map → chunk-MN7WNZE6.cjs.map} +1 -1
- package/dist/{chunk-7W6PDCOH.cjs → chunk-NWOPWLJ3.cjs} +83 -82
- package/dist/chunk-NWOPWLJ3.cjs.map +1 -0
- package/dist/{chunk-CJ4RMDJJ.cjs → chunk-O542TXPV.cjs} +145 -94
- package/dist/chunk-O542TXPV.cjs.map +1 -0
- package/dist/{chunk-4FMKWOPC.js → chunk-OZHBY6NY.js} +32 -5
- package/dist/chunk-OZHBY6NY.js.map +1 -0
- package/dist/{chunk-MJF7NZEF.js → chunk-PPCEPCG7.js} +3 -3
- package/dist/{chunk-MJF7NZEF.js.map → chunk-PPCEPCG7.js.map} +1 -1
- package/dist/{chunk-CU764D5P.cjs → chunk-QB4YHCVA.cjs} +15 -15
- package/dist/{chunk-CU764D5P.cjs.map → chunk-QB4YHCVA.cjs.map} +1 -1
- package/dist/{chunk-K7AE4BHR.js → chunk-QIOD3LOP.js} +4 -3
- package/dist/chunk-QIOD3LOP.js.map +1 -0
- package/dist/{chunk-DTT543MP.cjs → chunk-RD76XK7E.cjs} +3 -3
- package/dist/{chunk-DTT543MP.cjs.map → chunk-RD76XK7E.cjs.map} +1 -1
- package/dist/{chunk-HRT662B6.js → chunk-SVIEJH5H.js} +13 -8
- package/dist/chunk-SVIEJH5H.js.map +1 -0
- package/dist/{chunk-KFL6ZGWG.js → chunk-VYZRHQUD.js} +5 -5
- package/dist/{chunk-KFL6ZGWG.js.map → chunk-VYZRHQUD.js.map} +1 -1
- package/dist/{chunk-H5ZOJOQ2.cjs → chunk-WKAEIA42.cjs} +9 -9
- package/dist/{chunk-H5ZOJOQ2.cjs.map → chunk-WKAEIA42.cjs.map} +1 -1
- package/dist/{chunk-L3V6LSQF.js → chunk-X5BBF6AG.js} +3 -3
- package/dist/{chunk-L3V6LSQF.js.map → chunk-X5BBF6AG.js.map} +1 -1
- package/dist/{chunk-WGJL6F3F.js → chunk-Z6I5PBGG.js} +6 -112
- package/dist/chunk-Z6I5PBGG.js.map +1 -0
- package/dist/datasets/index.cjs +17 -17
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +8 -18
- package/dist/docs/assets/SOURCE_MAP.json +266 -266
- package/dist/docs/references/docs-agents-overview.md +4 -4
- package/dist/docs/references/docs-agents-processors.md +1 -1
- package/dist/docs/references/{docs-observability-datasets-overview.md → docs-evals-datasets-overview.md} +12 -12
- package/dist/docs/references/{docs-observability-datasets-running-experiments.md → docs-evals-datasets-running-experiments.md} +9 -9
- package/dist/docs/references/docs-evals-overview.md +8 -9
- package/dist/docs/references/docs-memory-observational-memory.md +20 -11
- package/dist/docs/references/docs-memory-overview.md +4 -4
- package/dist/docs/references/docs-memory-semantic-recall.md +28 -19
- package/dist/docs/references/docs-memory-storage.md +4 -4
- package/dist/docs/references/docs-rag-chunking-and-embedding.md +2 -2
- package/dist/docs/references/docs-server-auth-composite-auth.md +1 -7
- package/dist/docs/references/docs-server-auth-custom-auth-provider.md +2 -4
- package/dist/docs/references/docs-server-auth-jwt.md +1 -1
- package/dist/docs/references/docs-server-auth-simple-auth.md +1 -7
- package/dist/docs/references/docs-server-custom-adapters.md +3 -1
- package/dist/docs/references/docs-server-custom-api-routes.md +1 -1
- package/dist/docs/references/docs-server-mastra-client.md +1 -3
- package/dist/docs/references/docs-server-mastra-server.md +8 -0
- package/dist/docs/references/docs-server-request-context.md +17 -17
- package/dist/docs/references/docs-streaming-events.md +1 -90
- package/dist/docs/references/docs-studio-auth.md +142 -0
- package/dist/docs/references/docs-studio-deployment.md +260 -0
- package/dist/docs/references/docs-studio-observability.md +98 -0
- package/dist/docs/references/docs-studio-overview.md +127 -0
- package/dist/docs/references/docs-workflows-agents-and-tools.md +7 -10
- package/dist/docs/references/docs-workflows-control-flow.md +1 -1
- package/dist/docs/references/docs-workflows-overview.md +12 -7
- package/dist/docs/references/docs-workflows-suspend-and-resume.md +1 -1
- package/dist/docs/references/guides-concepts-multi-agent-systems.md +4 -4
- package/dist/docs/references/reference-agents-agent.md +1 -1
- package/dist/docs/references/reference-configuration.md +4 -4
- package/dist/docs/references/reference-memory-observational-memory.md +1 -1
- package/dist/docs/references/reference-storage-cloudflare-d1.md +1 -1
- package/dist/docs/references/reference-storage-lance.md +1 -1
- package/dist/docs/references/reference-storage-upstash.md +1 -1
- package/dist/docs/references/reference.md +16 -14
- package/dist/evals/index.cjs +5 -5
- package/dist/evals/index.js +2 -2
- package/dist/evals/scoreTraces/index.cjs +3 -3
- package/dist/evals/scoreTraces/index.js +1 -1
- package/dist/harness/harness.d.ts.map +1 -1
- package/dist/harness/index.cjs +19 -18
- package/dist/harness/index.cjs.map +1 -1
- package/dist/harness/index.js +9 -8
- package/dist/harness/index.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/integration/index.cjs +2 -2
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.cjs +16 -16
- package/dist/llm/index.js +5 -5
- package/dist/llm/model/aisdk/v5/model.d.ts +5 -0
- package/dist/llm/model/aisdk/v5/model.d.ts.map +1 -1
- package/dist/llm/model/aisdk/v6/model.d.ts +5 -0
- package/dist/llm/model/aisdk/v6/model.d.ts.map +1 -1
- package/dist/llm/model/provider-types.generated.d.ts +1 -50
- package/dist/loop/index.cjs +14 -14
- package/dist/loop/index.js +1 -1
- package/dist/loop/network/validation.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +14 -14
- package/dist/memory/index.js +1 -1
- package/dist/models-dev-VAVD7BDV.cjs +12 -0
- package/dist/{models-dev-674ULLFE.cjs.map → models-dev-VAVD7BDV.cjs.map} +1 -1
- package/dist/models-dev-VFIUOVG4.js +3 -0
- package/dist/{models-dev-AVV7SNWL.js.map → models-dev-VFIUOVG4.js.map} +1 -1
- package/dist/netlify-KL3UR26O.cjs +12 -0
- package/dist/{netlify-QP3MZ4FK.cjs.map → netlify-KL3UR26O.cjs.map} +1 -1
- package/dist/netlify-Q3SJTV4U.js +3 -0
- package/dist/{netlify-KWEJPG27.js.map → netlify-Q3SJTV4U.js.map} +1 -1
- package/dist/processor-provider/index.cjs +10 -10
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +44 -44
- package/dist/processors/index.js +1 -1
- package/dist/provider-registry-COX4XKGI.js +3 -0
- package/dist/{provider-registry-L3LFTZUA.js.map → provider-registry-COX4XKGI.js.map} +1 -1
- package/dist/provider-registry-IAU4XHVY.cjs +40 -0
- package/dist/{provider-registry-KZN4FOFE.cjs.map → provider-registry-IAU4XHVY.cjs.map} +1 -1
- package/dist/provider-registry.json +2 -108
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/storage/index.cjs +74 -74
- package/dist/storage/index.js +1 -1
- package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts.map +1 -1
- package/dist/stream/index.cjs +8 -8
- package/dist/stream/index.js +1 -1
- package/dist/test-utils/llm-mock.cjs +4 -4
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/tools/index.cjs +8 -8
- package/dist/tools/index.js +1 -1
- package/dist/tools/is-vercel-tool.cjs +2 -2
- package/dist/tools/is-vercel-tool.js +1 -1
- package/dist/tools/tool-builder/builder.d.ts.map +1 -1
- package/dist/tools/validation.d.ts.map +1 -1
- package/dist/utils.cjs +31 -23
- package/dist/utils.d.ts +10 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +7 -7
- package/dist/vector/index.js +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +24 -24
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/dist/workspace/index.cjs +68 -68
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/workspace.d.ts +1 -0
- package/dist/workspace/workspace.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/llm/model/provider-types.generated.d.ts +1 -50
- package/dist/chunk-4FMKWOPC.js.map +0 -1
- package/dist/chunk-7W6PDCOH.cjs.map +0 -1
- package/dist/chunk-AV4YSAZL.cjs.map +0 -1
- package/dist/chunk-CJ4RMDJJ.cjs.map +0 -1
- package/dist/chunk-FA4PTEBK.js.map +0 -1
- package/dist/chunk-GXXNF6NF.cjs.map +0 -1
- package/dist/chunk-HRT662B6.js.map +0 -1
- package/dist/chunk-HZI7AYCD.js.map +0 -1
- package/dist/chunk-IVXAQT6H.js.map +0 -1
- package/dist/chunk-K7AE4BHR.js.map +0 -1
- package/dist/chunk-LKZQG2ZZ.cjs.map +0 -1
- package/dist/chunk-TJNYXDI7.cjs.map +0 -1
- package/dist/chunk-WGJL6F3F.js.map +0 -1
- package/dist/chunk-XQRTJIC7.cjs.map +0 -1
- package/dist/docs/references/docs-observability-logging.md +0 -99
- package/dist/docs/references/docs-observability-overview.md +0 -70
- package/dist/docs/references/docs-observability-tracing-bridges-otel.md +0 -209
- package/dist/docs/references/docs-observability-tracing-exporters-arize.md +0 -272
- package/dist/docs/references/docs-observability-tracing-exporters-braintrust.md +0 -126
- package/dist/docs/references/docs-observability-tracing-exporters-cloud.md +0 -127
- package/dist/docs/references/docs-observability-tracing-exporters-datadog.md +0 -317
- package/dist/docs/references/docs-observability-tracing-exporters-default.md +0 -209
- package/dist/docs/references/docs-observability-tracing-exporters-laminar.md +0 -100
- package/dist/docs/references/docs-observability-tracing-exporters-langfuse.md +0 -213
- package/dist/docs/references/docs-observability-tracing-exporters-langsmith.md +0 -198
- package/dist/docs/references/docs-observability-tracing-exporters-otel.md +0 -476
- package/dist/docs/references/docs-observability-tracing-exporters-posthog.md +0 -148
- package/dist/docs/references/docs-observability-tracing-overview.md +0 -1112
- package/dist/models-dev-674ULLFE.cjs +0 -12
- package/dist/models-dev-AVV7SNWL.js +0 -3
- package/dist/netlify-KWEJPG27.js +0 -3
- package/dist/netlify-QP3MZ4FK.cjs +0 -12
- package/dist/provider-registry-KZN4FOFE.cjs +0 -40
- package/dist/provider-registry-L3LFTZUA.js +0 -3
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { DefaultVoice } from './chunk-YDLGEJ7W.js';
|
|
2
2
|
import { PUBSUB_SYMBOL, STREAM_FORMAT_SYMBOL } from './chunk-2QXNHEDL.js';
|
|
3
|
-
import { createWorkspaceTools, createSkillTools, getTiktoken, BM25Index } from './chunk-
|
|
4
|
-
import { InMemoryStore } from './chunk-
|
|
3
|
+
import { createWorkspaceTools, createSkillTools, getTiktoken, BM25Index } from './chunk-SVIEJH5H.js';
|
|
4
|
+
import { InMemoryStore } from './chunk-PPCEPCG7.js';
|
|
5
5
|
import { MessageList, coreContentToString, DefaultGeneratedFile, DefaultGeneratedFileWithType, sanitizeToolName } from './chunk-SLZ3WO42.js';
|
|
6
6
|
import { parsePartialJson, isDeepEqualData, stepCountIs } from './chunk-2PHG443D.js';
|
|
7
7
|
import { generateId, APICallError, tool, asSchema } from './chunk-6PALJNKG.js';
|
|
8
8
|
import { executeHook } from './chunk-L54GIUCB.js';
|
|
9
|
-
import { resolveModelConfig, ModelRouterEmbeddingModel, ModelRouterLanguageModel } from './chunk-
|
|
10
|
-
import { MastraLLMV1 } from './chunk-
|
|
9
|
+
import { resolveModelConfig, ModelRouterEmbeddingModel, ModelRouterLanguageModel } from './chunk-M62LMDHE.js';
|
|
10
|
+
import { MastraLLMV1 } from './chunk-QIOD3LOP.js';
|
|
11
11
|
import { noopLogger } from './chunk-PSCMWPLC.js';
|
|
12
12
|
import { EventEmitterPubSub } from './chunk-X2HAI3OX.js';
|
|
13
|
-
import { removeUndefinedValues, ensureToolProperties, makeCoreTool, createMastraProxy, deepMerge, generateEmptyFromSchema, selectFields, delay } from './chunk-
|
|
13
|
+
import { removeUndefinedValues, safeStringify, ensureToolProperties, makeCoreTool, createMastraProxy, deepMerge, generateEmptyFromSchema, selectFields, ensureSerializable, delay } from './chunk-OZHBY6NY.js';
|
|
14
14
|
import { resolveObservabilityContext, EntityType, createObservabilityContext, getRootExportSpan, getOrCreateSpan, wrapMastra, executeWithContext, executeWithContextSync } from './chunk-KRFGPA2H.js';
|
|
15
15
|
import { ToolStream } from './chunk-DD2VNRQM.js';
|
|
16
|
-
import { Tool, createTool, isMastraTool, isProviderTool, getProviderToolName, isProviderDefinedTool } from './chunk-
|
|
16
|
+
import { Tool, createTool, isMastraTool, isProviderTool, getProviderToolName, isProviderDefinedTool } from './chunk-EWPUWV33.js';
|
|
17
17
|
import { toStandardSchema, standardSchemaToJSONSchema, isStandardSchemaWithJSON } from './chunk-6SRTDZ7S.js';
|
|
18
18
|
import { RequestContext, MASTRA_RESOURCE_ID_KEY, MASTRA_THREAD_ID_KEY } from './chunk-JGOH7RWL.js';
|
|
19
19
|
import { MastraError, getErrorFromUnknown } from './chunk-FJEVLHJT.js';
|
|
@@ -618,10 +618,16 @@ function prepareToolsAndToolChoice({
|
|
|
618
618
|
activeTools,
|
|
619
619
|
targetVersion = "v2"
|
|
620
620
|
}) {
|
|
621
|
+
if (toolChoice === "none") {
|
|
622
|
+
return {
|
|
623
|
+
tools: void 0,
|
|
624
|
+
toolChoice: { type: "none" }
|
|
625
|
+
};
|
|
626
|
+
}
|
|
621
627
|
if (Object.keys(tools || {}).length === 0) {
|
|
622
628
|
return {
|
|
623
629
|
tools: void 0,
|
|
624
|
-
toolChoice:
|
|
630
|
+
toolChoice: void 0
|
|
625
631
|
};
|
|
626
632
|
}
|
|
627
633
|
const filteredTools = activeTools != null ? Object.entries(tools || {}).filter(([name]) => activeTools.includes(name)) : Object.entries(tools || {});
|
|
@@ -8307,6 +8313,16 @@ function isToolStep(input) {
|
|
|
8307
8313
|
function isStepParams(input) {
|
|
8308
8314
|
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof Agent) && !(input instanceof Tool);
|
|
8309
8315
|
}
|
|
8316
|
+
function findStepInGraph(graph, stepId) {
|
|
8317
|
+
for (const entry of graph) {
|
|
8318
|
+
if ("step" in entry && entry.step?.id === stepId) return entry;
|
|
8319
|
+
if ((entry.type === "conditional" || entry.type === "parallel") && "steps" in entry) {
|
|
8320
|
+
const found = findStepInGraph(entry.steps, stepId);
|
|
8321
|
+
if (found) return found;
|
|
8322
|
+
}
|
|
8323
|
+
}
|
|
8324
|
+
return void 0;
|
|
8325
|
+
}
|
|
8310
8326
|
function createStep(params, agentOrToolOptions) {
|
|
8311
8327
|
if (isAgent(params)) {
|
|
8312
8328
|
return createStepFromAgent(params, agentOrToolOptions);
|
|
@@ -9787,7 +9803,7 @@ var Workflow = class extends MastraBase {
|
|
|
9787
9803
|
const { input, ...steps } = context;
|
|
9788
9804
|
let finalSteps = {};
|
|
9789
9805
|
for (const step of Object.keys(steps)) {
|
|
9790
|
-
const stepGraph = serializedStepGraph
|
|
9806
|
+
const stepGraph = findStepInGraph(serializedStepGraph, step);
|
|
9791
9807
|
finalSteps[step] = steps[step];
|
|
9792
9808
|
if (stepGraph && stepGraph?.step?.component === "WORKFLOW") {
|
|
9793
9809
|
const stepResult = steps[step];
|
|
@@ -11564,7 +11580,7 @@ async function runDefaultCompletionCheck(agent, context, streamContext, abortSig
|
|
|
11564
11580
|
Primitives already executed: ${completedPrimitives.join(", ")}` : "";
|
|
11565
11581
|
const completionPrompt = `
|
|
11566
11582
|
The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} has contributed to the task.
|
|
11567
|
-
This is the result: ${
|
|
11583
|
+
This is the result: ${safeStringify(context.primitiveResult)}
|
|
11568
11584
|
|
|
11569
11585
|
${completedSection}
|
|
11570
11586
|
|
|
@@ -11660,7 +11676,7 @@ async function generateFinalResult(agent, context, streamContext, abortSignal, o
|
|
|
11660
11676
|
Original task: ${context.originalTask}
|
|
11661
11677
|
|
|
11662
11678
|
The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} produced this result:
|
|
11663
|
-
${
|
|
11679
|
+
${safeStringify(context.primitiveResult)}
|
|
11664
11680
|
|
|
11665
11681
|
IMPORTANT: If the above result is from an AGENT PRIMITIVE and it is a suitable final result itself considering the original task, then finalResult should be an empty string or undefined.
|
|
11666
11682
|
You should evaluate if the above result is comprehensive enough to accomplish the user's original task.
|
|
@@ -11718,7 +11734,7 @@ async function generateStructuredFinalResult(agent, context, structuredOutputOpt
|
|
|
11718
11734
|
Original task: ${context.originalTask}
|
|
11719
11735
|
|
|
11720
11736
|
The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} produced this result:
|
|
11721
|
-
${
|
|
11737
|
+
${safeStringify(context.primitiveResult)}
|
|
11722
11738
|
|
|
11723
11739
|
Based on the task and result above, generate a structured response according to the provided schema.
|
|
11724
11740
|
Use the conversation history and primitive results to craft the response.
|
|
@@ -13912,7 +13928,8 @@ function createToolCallStep({
|
|
|
13912
13928
|
args.resourceId = _internal?.resourceId;
|
|
13913
13929
|
}
|
|
13914
13930
|
}
|
|
13915
|
-
const
|
|
13931
|
+
const rawResult = await tool2.execute(args, toolOptions);
|
|
13932
|
+
const result = ensureSerializable(rawResult);
|
|
13916
13933
|
if (tool2 && "onOutput" in tool2 && typeof tool2.onOutput === "function") {
|
|
13917
13934
|
try {
|
|
13918
13935
|
await tool2.onOutput({
|
|
@@ -17409,27 +17426,33 @@ var AgentLegacyHandler = class {
|
|
|
17409
17426
|
}
|
|
17410
17427
|
const promises = [];
|
|
17411
17428
|
const config = memory.getMergedThreadConfig(memoryConfig2);
|
|
17412
|
-
const userMessage = this.capabilities.getMostRecentUserMessage(messageList.get.all.ui());
|
|
17413
17429
|
const {
|
|
17414
17430
|
shouldGenerate,
|
|
17415
17431
|
model: titleModel,
|
|
17416
|
-
instructions: titleInstructions
|
|
17432
|
+
instructions: titleInstructions,
|
|
17433
|
+
minMessages
|
|
17417
17434
|
} = this.capabilities.resolveTitleGenerationConfig(config?.generateTitle);
|
|
17418
|
-
|
|
17419
|
-
|
|
17420
|
-
|
|
17421
|
-
|
|
17422
|
-
|
|
17423
|
-
|
|
17424
|
-
|
|
17425
|
-
|
|
17426
|
-
|
|
17427
|
-
|
|
17428
|
-
|
|
17429
|
-
|
|
17430
|
-
|
|
17431
|
-
|
|
17432
|
-
|
|
17435
|
+
const uiMessages = messageList.get.all.ui();
|
|
17436
|
+
const messages2 = messageList.get.all.core();
|
|
17437
|
+
const requiredMessages = minMessages ?? 1;
|
|
17438
|
+
if (shouldGenerate && !thread2.title && messages2.length >= requiredMessages) {
|
|
17439
|
+
const userMessage = this.capabilities.getMostRecentUserMessage(uiMessages);
|
|
17440
|
+
if (userMessage) {
|
|
17441
|
+
const observabilityContext2 = createObservabilityContext({ currentSpan: agentSpan });
|
|
17442
|
+
promises.push(
|
|
17443
|
+
this.capabilities.genTitle(userMessage, requestContext, observabilityContext2, titleModel, titleInstructions).then((title) => {
|
|
17444
|
+
if (title) {
|
|
17445
|
+
return memory.createThread({
|
|
17446
|
+
threadId: thread2.id,
|
|
17447
|
+
resourceId,
|
|
17448
|
+
memoryConfig: memoryConfig2,
|
|
17449
|
+
title,
|
|
17450
|
+
metadata: thread2.metadata
|
|
17451
|
+
});
|
|
17452
|
+
}
|
|
17453
|
+
})
|
|
17454
|
+
);
|
|
17455
|
+
}
|
|
17433
17456
|
}
|
|
17434
17457
|
if (promises.length > 0) {
|
|
17435
17458
|
await Promise.all(promises);
|
|
@@ -18437,7 +18460,16 @@ function createMapResultsStep({
|
|
|
18437
18460
|
...modelId && { modelId }
|
|
18438
18461
|
});
|
|
18439
18462
|
}
|
|
18440
|
-
|
|
18463
|
+
const error = payload.error instanceof Error ? payload.error : new MastraError(
|
|
18464
|
+
{
|
|
18465
|
+
id: "AGENT_STREAM_ERROR",
|
|
18466
|
+
domain: "AGENT" /* AGENT */,
|
|
18467
|
+
category: "SYSTEM" /* SYSTEM */,
|
|
18468
|
+
details: { runId }
|
|
18469
|
+
},
|
|
18470
|
+
payload.error
|
|
18471
|
+
);
|
|
18472
|
+
agentSpan?.error({ error, endSpan: true });
|
|
18441
18473
|
return;
|
|
18442
18474
|
}
|
|
18443
18475
|
const aborted = options.abortSignal?.aborted;
|
|
@@ -18465,7 +18497,19 @@ function createMapResultsStep({
|
|
|
18465
18497
|
error: e,
|
|
18466
18498
|
runId
|
|
18467
18499
|
});
|
|
18500
|
+
const spanError = e instanceof Error ? e : new MastraError(
|
|
18501
|
+
{
|
|
18502
|
+
id: "AGENT_ON_FINISH_ERROR",
|
|
18503
|
+
domain: "AGENT" /* AGENT */,
|
|
18504
|
+
category: "SYSTEM" /* SYSTEM */,
|
|
18505
|
+
details: { runId }
|
|
18506
|
+
},
|
|
18507
|
+
e
|
|
18508
|
+
);
|
|
18509
|
+
agentSpan?.error({ error: spanError, endSpan: true });
|
|
18468
18510
|
}
|
|
18511
|
+
} else {
|
|
18512
|
+
agentSpan?.end();
|
|
18469
18513
|
}
|
|
18470
18514
|
await options?.onFinish?.({
|
|
18471
18515
|
...payload,
|
|
@@ -21114,10 +21158,7 @@ ${effectiveInstructions}`;
|
|
|
21114
21158
|
this.logger.error(`[Agent:${this.name}] - messageFilter error: ${filterError}`);
|
|
21115
21159
|
}
|
|
21116
21160
|
}
|
|
21117
|
-
const messagesForSubAgent = [
|
|
21118
|
-
...filteredContextMessages,
|
|
21119
|
-
{ role: "user", content: effectivePrompt }
|
|
21120
|
-
];
|
|
21161
|
+
const messagesForSubAgent = [{ role: "user", content: effectivePrompt }];
|
|
21121
21162
|
const subAgentPromptCreatedAt = /* @__PURE__ */ new Date();
|
|
21122
21163
|
if ((methodType === "generate" || methodType === "generateLegacy") && supportedLanguageModelSpecifications.includes(modelVersion)) {
|
|
21123
21164
|
const generateResult = resumeData ? await agent.resumeGenerate(resumeData, {
|
|
@@ -21126,6 +21167,7 @@ ${effectiveInstructions}`;
|
|
|
21126
21167
|
...resolveObservabilityContext(context ?? {}),
|
|
21127
21168
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21128
21169
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21170
|
+
context: filteredContextMessages,
|
|
21129
21171
|
...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
|
|
21130
21172
|
memory: {
|
|
21131
21173
|
resource: subAgentResourceId,
|
|
@@ -21138,6 +21180,7 @@ ${effectiveInstructions}`;
|
|
|
21138
21180
|
...resolveObservabilityContext(context ?? {}),
|
|
21139
21181
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21140
21182
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21183
|
+
context: filteredContextMessages,
|
|
21141
21184
|
...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
|
|
21142
21185
|
memory: {
|
|
21143
21186
|
resource: subAgentResourceId,
|
|
@@ -21199,7 +21242,8 @@ ${effectiveInstructions}`;
|
|
|
21199
21242
|
} else if (methodType === "generate" && modelVersion === "v1") {
|
|
21200
21243
|
const generateResult = await agent.generateLegacy(messagesForSubAgent, {
|
|
21201
21244
|
requestContext,
|
|
21202
|
-
...resolveObservabilityContext(context ?? {})
|
|
21245
|
+
...resolveObservabilityContext(context ?? {}),
|
|
21246
|
+
context: filteredContextMessages
|
|
21203
21247
|
});
|
|
21204
21248
|
result = { text: generateResult.text };
|
|
21205
21249
|
} else if ((methodType === "stream" || methodType === "streamLegacy") && supportedLanguageModelSpecifications.includes(modelVersion)) {
|
|
@@ -21209,6 +21253,7 @@ ${effectiveInstructions}`;
|
|
|
21209
21253
|
...resolveObservabilityContext(context ?? {}),
|
|
21210
21254
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21211
21255
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21256
|
+
context: filteredContextMessages,
|
|
21212
21257
|
...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
|
|
21213
21258
|
memory: {
|
|
21214
21259
|
resource: subAgentResourceId,
|
|
@@ -21223,6 +21268,7 @@ ${effectiveInstructions}`;
|
|
|
21223
21268
|
...resolveObservabilityContext(context ?? {}),
|
|
21224
21269
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21225
21270
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21271
|
+
context: filteredContextMessages,
|
|
21226
21272
|
...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
|
|
21227
21273
|
memory: {
|
|
21228
21274
|
resource: subAgentResourceId,
|
|
@@ -22272,12 +22318,16 @@ ${effectiveInstructions}`;
|
|
|
22272
22318
|
const {
|
|
22273
22319
|
shouldGenerate,
|
|
22274
22320
|
model: titleModel,
|
|
22275
|
-
instructions: titleInstructions
|
|
22321
|
+
instructions: titleInstructions,
|
|
22322
|
+
minMessages
|
|
22276
22323
|
} = this.resolveTitleGenerationConfig(
|
|
22277
|
-
config
|
|
22324
|
+
config?.generateTitle
|
|
22278
22325
|
);
|
|
22279
|
-
|
|
22280
|
-
|
|
22326
|
+
const uiMessages = messageList.get.all.ui();
|
|
22327
|
+
const messages = messageList.get.all.core();
|
|
22328
|
+
const requiredMessages = minMessages ?? 1;
|
|
22329
|
+
if (shouldGenerate && !thread.title && messages.length >= requiredMessages) {
|
|
22330
|
+
const userMessage = this.getMostRecentUserMessage(uiMessages);
|
|
22281
22331
|
if (userMessage) {
|
|
22282
22332
|
void this.genTitle(userMessage, requestContext, observabilityContext, titleModel, titleInstructions).then(
|
|
22283
22333
|
async (title) => {
|
|
@@ -22854,7 +22904,8 @@ ${effectiveInstructions}`;
|
|
|
22854
22904
|
return {
|
|
22855
22905
|
shouldGenerate: true,
|
|
22856
22906
|
model: generateTitleConfig.model,
|
|
22857
|
-
instructions: generateTitleConfig.instructions
|
|
22907
|
+
instructions: generateTitleConfig.instructions,
|
|
22908
|
+
minMessages: generateTitleConfig.minMessages
|
|
22858
22909
|
};
|
|
22859
22910
|
}
|
|
22860
22911
|
return { shouldGenerate: false };
|
|
@@ -27293,5 +27344,5 @@ var MockMemory = class extends MastraMemory {
|
|
|
27293
27344
|
};
|
|
27294
27345
|
|
|
27295
27346
|
export { Agent, AgentsMDInjector, BaseProcessor, BatchPartsProcessor, ChunkFrom, DefaultExecutionEngine, ExecutionEngine, FilePartSchema, ImagePartSchema, LanguageDetector, MastraAgentNetworkStream, MastraMemory, MastraModelOutput, MastraScorer, MemoryProcessor, MessageContentSchema, MessageHistory, MessagePartSchema, MockMemory, ModerationProcessor, PIIDetector, ProcessorInputPhaseSchema, ProcessorInputStepPhaseSchema, ProcessorMessageContentSchema, ProcessorMessageSchema, ProcessorOutputResultPhaseSchema, ProcessorOutputStepPhaseSchema, ProcessorOutputStreamPhaseSchema, ProcessorRunner, ProcessorState, ProcessorStepInputSchema, ProcessorStepOutputSchema, ProcessorStepSchema, PromptInjectionDetector, ReasoningPartSchema, Run, SemanticRecall, SkillSearchProcessor, SkillsProcessor, SourcePartSchema, StepStartPartSchema, StructuredOutputProcessor, SystemPromptScrubber, TextPartSchema, TokenLimiterProcessor, ToolCallFilter, ToolInvocationPartSchema, ToolSearchProcessor, TripWire, UnicodeNormalizer, WORKING_MEMORY_END_TAG, WORKING_MEMORY_START_TAG, Workflow, WorkflowRunOutput, WorkingMemory, WorkspaceInstructionsProcessor, augmentWithInit, cleanStepResult, cloneStep, cloneWorkflow, convertFullStreamChunkToMastra, convertFullStreamChunkToUIMessageStream, convertMastraChunkToAISDKv5, createDeprecationProxy, createScorer, createStep, createTimeTravelExecutionParams, createWorkflow, extractWorkingMemoryContent, extractWorkingMemoryTags, formatCheckFeedback, formatCompletionFeedback, formatStreamCompletionFeedback, formatValidationFeedback, forwardAgentStreamChunk, generateFinalResult, generateStructuredFinalResult, getResumeLabelsByStepId, getStepIds, getStepResult, getThreadOMMetadata, globalEmbeddingCache, hydrateSerializedStepErrors, isObservationalMemoryEnabled, isProcessor, isProcessorWorkflow, isSupportedLanguageModel, loop, mapVariable, memoryDefaultOptions, parseMemoryRequestContext, removeWorkingMemoryTags, resolveThreadIdFromArgs, runChecks, runCompletionScorers, runCountDeprecationMessage, runDefaultCompletionCheck, runStreamCompletionScorers, runValidation, setThreadOMMetadata, supportedLanguageModelSpecifications, tryGenerateWithJsonFallback, tryStreamWithJsonFallback, validateStepInput, validateStepRequestContext, validateStepResumeData, validateStepStateData, validateStepSuspendData };
|
|
27296
|
-
//# sourceMappingURL=chunk-
|
|
27297
|
-
//# sourceMappingURL=chunk-
|
|
27347
|
+
//# sourceMappingURL=chunk-BS5UESNT.js.map
|
|
27348
|
+
//# sourceMappingURL=chunk-BS5UESNT.js.map
|