@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
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkZC4FJVJZ_cjs = require('./chunk-ZC4FJVJZ.cjs');
|
|
4
4
|
var chunkZCBG4ZQT_cjs = require('./chunk-ZCBG4ZQT.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var chunkL2FL7HMV_cjs = require('./chunk-L2FL7HMV.cjs');
|
|
6
|
+
var chunkGNA52EF4_cjs = require('./chunk-GNA52EF4.cjs');
|
|
7
7
|
var chunkANLO4VM2_cjs = require('./chunk-ANLO4VM2.cjs');
|
|
8
8
|
var chunkY3APFUXZ_cjs = require('./chunk-Y3APFUXZ.cjs');
|
|
9
9
|
var chunkCFMZZDO2_cjs = require('./chunk-CFMZZDO2.cjs');
|
|
10
10
|
var chunkMR7ZWBL6_cjs = require('./chunk-MR7ZWBL6.cjs');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var chunkNWOPWLJ3_cjs = require('./chunk-NWOPWLJ3.cjs');
|
|
12
|
+
var chunk4TUILCMR_cjs = require('./chunk-4TUILCMR.cjs');
|
|
13
13
|
var chunk6BJ7XHRH_cjs = require('./chunk-6BJ7XHRH.cjs');
|
|
14
14
|
var chunkOQDRPRKM_cjs = require('./chunk-OQDRPRKM.cjs');
|
|
15
|
-
var
|
|
15
|
+
var chunkE2SMTTP6_cjs = require('./chunk-E2SMTTP6.cjs');
|
|
16
16
|
var chunkBF7IH4JU_cjs = require('./chunk-BF7IH4JU.cjs');
|
|
17
17
|
var chunkKJBMTK5B_cjs = require('./chunk-KJBMTK5B.cjs');
|
|
18
|
-
var
|
|
18
|
+
var chunk2OYWVA6F_cjs = require('./chunk-2OYWVA6F.cjs');
|
|
19
19
|
var chunkXB4FLS7A_cjs = require('./chunk-XB4FLS7A.cjs');
|
|
20
20
|
var chunk5WBEMKE2_cjs = require('./chunk-5WBEMKE2.cjs');
|
|
21
21
|
var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
|
|
@@ -643,10 +643,16 @@ function prepareToolsAndToolChoice({
|
|
|
643
643
|
activeTools,
|
|
644
644
|
targetVersion = "v2"
|
|
645
645
|
}) {
|
|
646
|
+
if (toolChoice === "none") {
|
|
647
|
+
return {
|
|
648
|
+
tools: void 0,
|
|
649
|
+
toolChoice: { type: "none" }
|
|
650
|
+
};
|
|
651
|
+
}
|
|
646
652
|
if (Object.keys(tools || {}).length === 0) {
|
|
647
653
|
return {
|
|
648
654
|
tools: void 0,
|
|
649
|
-
toolChoice:
|
|
655
|
+
toolChoice: void 0
|
|
650
656
|
};
|
|
651
657
|
}
|
|
652
658
|
const filteredTools = activeTools != null ? Object.entries(tools || {}).filter(([name]) => activeTools.includes(name)) : Object.entries(tools || {});
|
|
@@ -654,10 +660,10 @@ function prepareToolsAndToolChoice({
|
|
|
654
660
|
return {
|
|
655
661
|
tools: filteredTools.map(([name, tool2]) => {
|
|
656
662
|
try {
|
|
657
|
-
if (
|
|
663
|
+
if (chunk2OYWVA6F_cjs.isProviderDefinedTool(tool2)) {
|
|
658
664
|
return {
|
|
659
665
|
type: providerToolType,
|
|
660
|
-
name:
|
|
666
|
+
name: chunk2OYWVA6F_cjs.getProviderToolName(tool2.id),
|
|
661
667
|
id: tool2.id,
|
|
662
668
|
args: tool2.args ?? {}
|
|
663
669
|
};
|
|
@@ -711,7 +717,7 @@ function prepareToolsAndToolChoice({
|
|
|
711
717
|
const providerId = sdkTool.id;
|
|
712
718
|
return {
|
|
713
719
|
type: providerToolType,
|
|
714
|
-
name: providerId ?
|
|
720
|
+
name: providerId ? chunk2OYWVA6F_cjs.getProviderToolName(providerId) : name,
|
|
715
721
|
id: providerId,
|
|
716
722
|
args: sdkTool.args
|
|
717
723
|
};
|
|
@@ -2073,7 +2079,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
2073
2079
|
}
|
|
2074
2080
|
const { model: _model, ...rest } = result;
|
|
2075
2081
|
if (result.model) {
|
|
2076
|
-
const resolvedModel = await
|
|
2082
|
+
const resolvedModel = await chunkNWOPWLJ3_cjs.resolveModelConfig(result.model);
|
|
2077
2083
|
const isSupported = isSupportedLanguageModel(resolvedModel);
|
|
2078
2084
|
if (!isSupported) {
|
|
2079
2085
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -5499,7 +5505,7 @@ var createTimeTravelExecutionParams = (params) => {
|
|
|
5499
5505
|
result = void 0;
|
|
5500
5506
|
}
|
|
5501
5507
|
if (result) {
|
|
5502
|
-
const formattedResult =
|
|
5508
|
+
const formattedResult = chunkE2SMTTP6_cjs.removeUndefinedValues(result);
|
|
5503
5509
|
stepResults[stepId] = formattedResult;
|
|
5504
5510
|
}
|
|
5505
5511
|
});
|
|
@@ -6057,7 +6063,7 @@ async function executeLoop(engine, params) {
|
|
|
6057
6063
|
options: {
|
|
6058
6064
|
type: "workflow_conditional_eval" /* WORKFLOW_CONDITIONAL_EVAL */,
|
|
6059
6065
|
name: `condition: '${entry.loopType}'`,
|
|
6060
|
-
input:
|
|
6066
|
+
input: chunkE2SMTTP6_cjs.selectFields(result.output, ["stepResult", "output.text", "output.object", "messages"]),
|
|
6061
6067
|
attributes: {
|
|
6062
6068
|
conditionIndex: iteration
|
|
6063
6069
|
},
|
|
@@ -8327,10 +8333,20 @@ function isAgent(input) {
|
|
|
8327
8333
|
return input instanceof Agent;
|
|
8328
8334
|
}
|
|
8329
8335
|
function isToolStep(input) {
|
|
8330
|
-
return input instanceof
|
|
8336
|
+
return input instanceof chunk2OYWVA6F_cjs.Tool;
|
|
8331
8337
|
}
|
|
8332
8338
|
function isStepParams(input) {
|
|
8333
|
-
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof Agent) && !(input instanceof
|
|
8339
|
+
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof Agent) && !(input instanceof chunk2OYWVA6F_cjs.Tool);
|
|
8340
|
+
}
|
|
8341
|
+
function findStepInGraph(graph, stepId) {
|
|
8342
|
+
for (const entry of graph) {
|
|
8343
|
+
if ("step" in entry && entry.step?.id === stepId) return entry;
|
|
8344
|
+
if ((entry.type === "conditional" || entry.type === "parallel") && "steps" in entry) {
|
|
8345
|
+
const found = findStepInGraph(entry.steps, stepId);
|
|
8346
|
+
if (found) return found;
|
|
8347
|
+
}
|
|
8348
|
+
}
|
|
8349
|
+
return void 0;
|
|
8334
8350
|
}
|
|
8335
8351
|
function createStep(params, agentOrToolOptions) {
|
|
8336
8352
|
if (isAgent(params)) {
|
|
@@ -9060,7 +9076,7 @@ function cloneStep(step, opts) {
|
|
|
9060
9076
|
};
|
|
9061
9077
|
}
|
|
9062
9078
|
function isProcessor(obj) {
|
|
9063
|
-
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof Agent) && !(obj instanceof
|
|
9079
|
+
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof Agent) && !(obj instanceof chunk2OYWVA6F_cjs.Tool) && (typeof obj.processInput === "function" || typeof obj.processInputStep === "function" || typeof obj.processOutputStream === "function" || typeof obj.processOutputResult === "function" || typeof obj.processOutputStep === "function");
|
|
9064
9080
|
}
|
|
9065
9081
|
function createWorkflow(params) {
|
|
9066
9082
|
return new Workflow(params);
|
|
@@ -9812,7 +9828,7 @@ var Workflow = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
9812
9828
|
const { input, ...steps } = context;
|
|
9813
9829
|
let finalSteps = {};
|
|
9814
9830
|
for (const step of Object.keys(steps)) {
|
|
9815
|
-
const stepGraph = serializedStepGraph
|
|
9831
|
+
const stepGraph = findStepInGraph(serializedStepGraph, step);
|
|
9816
9832
|
finalSteps[step] = steps[step];
|
|
9817
9833
|
if (stepGraph && stepGraph?.step?.component === "WORKFLOW") {
|
|
9818
9834
|
const stepResult = steps[step];
|
|
@@ -11358,7 +11374,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
11358
11374
|
}
|
|
11359
11375
|
});
|
|
11360
11376
|
}
|
|
11361
|
-
const resolvedModel = await
|
|
11377
|
+
const resolvedModel = await chunkNWOPWLJ3_cjs.resolveModelConfig(modelConfig, void 0, this.#mastra);
|
|
11362
11378
|
const judge = new Agent({
|
|
11363
11379
|
id: "judge",
|
|
11364
11380
|
name: "judge",
|
|
@@ -11589,7 +11605,7 @@ async function runDefaultCompletionCheck(agent, context, streamContext, abortSig
|
|
|
11589
11605
|
Primitives already executed: ${completedPrimitives.join(", ")}` : "";
|
|
11590
11606
|
const completionPrompt = `
|
|
11591
11607
|
The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} has contributed to the task.
|
|
11592
|
-
This is the result: ${
|
|
11608
|
+
This is the result: ${chunkE2SMTTP6_cjs.safeStringify(context.primitiveResult)}
|
|
11593
11609
|
|
|
11594
11610
|
${completedSection}
|
|
11595
11611
|
|
|
@@ -11685,7 +11701,7 @@ async function generateFinalResult(agent, context, streamContext, abortSignal, o
|
|
|
11685
11701
|
Original task: ${context.originalTask}
|
|
11686
11702
|
|
|
11687
11703
|
The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} produced this result:
|
|
11688
|
-
${
|
|
11704
|
+
${chunkE2SMTTP6_cjs.safeStringify(context.primitiveResult)}
|
|
11689
11705
|
|
|
11690
11706
|
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.
|
|
11691
11707
|
You should evaluate if the above result is comprehensive enough to accomplish the user's original task.
|
|
@@ -11743,7 +11759,7 @@ async function generateStructuredFinalResult(agent, context, structuredOutputOpt
|
|
|
11743
11759
|
Original task: ${context.originalTask}
|
|
11744
11760
|
|
|
11745
11761
|
The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} produced this result:
|
|
11746
|
-
${
|
|
11762
|
+
${chunkE2SMTTP6_cjs.safeStringify(context.primitiveResult)}
|
|
11747
11763
|
|
|
11748
11764
|
Based on the task and result above, generate a structured response according to the provided schema.
|
|
11749
11765
|
Use the conversation history and primitive results to craft the response.
|
|
@@ -12213,11 +12229,11 @@ var DefaultStepResult = class {
|
|
|
12213
12229
|
// src/tools/provider-tool-utils.ts
|
|
12214
12230
|
function findProviderToolByName(tools, toolName) {
|
|
12215
12231
|
if (!tools) return void 0;
|
|
12216
|
-
return Object.values(tools).find((t) =>
|
|
12232
|
+
return Object.values(tools).find((t) => chunk2OYWVA6F_cjs.isProviderTool(t) && chunk2OYWVA6F_cjs.getProviderToolName(t.id) === toolName);
|
|
12217
12233
|
}
|
|
12218
12234
|
function inferProviderExecuted(providerExecuted, tool2) {
|
|
12219
12235
|
if (providerExecuted !== void 0) return providerExecuted;
|
|
12220
|
-
return
|
|
12236
|
+
return chunk2OYWVA6F_cjs.isProviderTool(tool2) ? true : void 0;
|
|
12221
12237
|
}
|
|
12222
12238
|
|
|
12223
12239
|
// src/loop/workflows/run-state.ts
|
|
@@ -12839,8 +12855,8 @@ function createLLMExecutionStep({
|
|
|
12839
12855
|
if (processInputStepResult.tools && currentStep.tools) {
|
|
12840
12856
|
const convertedTools = {};
|
|
12841
12857
|
for (const [name, tool2] of Object.entries(currentStep.tools)) {
|
|
12842
|
-
if (
|
|
12843
|
-
convertedTools[name] =
|
|
12858
|
+
if (chunk2OYWVA6F_cjs.isMastraTool(tool2)) {
|
|
12859
|
+
convertedTools[name] = chunkE2SMTTP6_cjs.makeCoreTool(
|
|
12844
12860
|
tool2,
|
|
12845
12861
|
{
|
|
12846
12862
|
name,
|
|
@@ -13047,7 +13063,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
13047
13063
|
}
|
|
13048
13064
|
});
|
|
13049
13065
|
let transportResolver;
|
|
13050
|
-
if (currentStep.model instanceof
|
|
13066
|
+
if (currentStep.model instanceof chunkNWOPWLJ3_cjs.ModelRouterLanguageModel) {
|
|
13051
13067
|
const routerModel = currentStep.model;
|
|
13052
13068
|
transportResolver = () => routerModel._getStreamTransport();
|
|
13053
13069
|
}
|
|
@@ -13937,7 +13953,8 @@ function createToolCallStep({
|
|
|
13937
13953
|
args.resourceId = _internal?.resourceId;
|
|
13938
13954
|
}
|
|
13939
13955
|
}
|
|
13940
|
-
const
|
|
13956
|
+
const rawResult = await tool2.execute(args, toolOptions);
|
|
13957
|
+
const result = chunkE2SMTTP6_cjs.ensureSerializable(rawResult);
|
|
13941
13958
|
if (tool2 && "onOutput" in tool2 && typeof tool2.onOutput === "function") {
|
|
13942
13959
|
try {
|
|
13943
13960
|
await tool2.onOutput({
|
|
@@ -14794,7 +14811,7 @@ var MastraLLMVNext = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
14794
14811
|
const remainingTokens = parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"] ?? "", 10);
|
|
14795
14812
|
if (!isNaN(remainingTokens) && remainingTokens > 0 && remainingTokens < 2e3) {
|
|
14796
14813
|
this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
|
|
14797
|
-
await
|
|
14814
|
+
await chunkE2SMTTP6_cjs.delay(10 * 1e3);
|
|
14798
14815
|
}
|
|
14799
14816
|
},
|
|
14800
14817
|
onFinish: async (props) => {
|
|
@@ -17434,27 +17451,33 @@ var AgentLegacyHandler = class {
|
|
|
17434
17451
|
}
|
|
17435
17452
|
const promises = [];
|
|
17436
17453
|
const config = memory.getMergedThreadConfig(memoryConfig2);
|
|
17437
|
-
const userMessage = this.capabilities.getMostRecentUserMessage(messageList.get.all.ui());
|
|
17438
17454
|
const {
|
|
17439
17455
|
shouldGenerate,
|
|
17440
17456
|
model: titleModel,
|
|
17441
|
-
instructions: titleInstructions
|
|
17457
|
+
instructions: titleInstructions,
|
|
17458
|
+
minMessages
|
|
17442
17459
|
} = this.capabilities.resolveTitleGenerationConfig(config?.generateTitle);
|
|
17443
|
-
|
|
17444
|
-
|
|
17445
|
-
|
|
17446
|
-
|
|
17447
|
-
|
|
17448
|
-
|
|
17449
|
-
|
|
17450
|
-
|
|
17451
|
-
|
|
17452
|
-
|
|
17453
|
-
|
|
17454
|
-
|
|
17455
|
-
|
|
17456
|
-
|
|
17457
|
-
|
|
17460
|
+
const uiMessages = messageList.get.all.ui();
|
|
17461
|
+
const messages2 = messageList.get.all.core();
|
|
17462
|
+
const requiredMessages = minMessages ?? 1;
|
|
17463
|
+
if (shouldGenerate && !thread2.title && messages2.length >= requiredMessages) {
|
|
17464
|
+
const userMessage = this.capabilities.getMostRecentUserMessage(uiMessages);
|
|
17465
|
+
if (userMessage) {
|
|
17466
|
+
const observabilityContext2 = chunkBF7IH4JU_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
17467
|
+
promises.push(
|
|
17468
|
+
this.capabilities.genTitle(userMessage, requestContext, observabilityContext2, titleModel, titleInstructions).then((title) => {
|
|
17469
|
+
if (title) {
|
|
17470
|
+
return memory.createThread({
|
|
17471
|
+
threadId: thread2.id,
|
|
17472
|
+
resourceId,
|
|
17473
|
+
memoryConfig: memoryConfig2,
|
|
17474
|
+
title,
|
|
17475
|
+
metadata: thread2.metadata
|
|
17476
|
+
});
|
|
17477
|
+
}
|
|
17478
|
+
})
|
|
17479
|
+
);
|
|
17480
|
+
}
|
|
17458
17481
|
}
|
|
17459
17482
|
if (promises.length > 0) {
|
|
17460
17483
|
await Promise.all(promises);
|
|
@@ -18462,7 +18485,16 @@ function createMapResultsStep({
|
|
|
18462
18485
|
...modelId && { modelId }
|
|
18463
18486
|
});
|
|
18464
18487
|
}
|
|
18465
|
-
|
|
18488
|
+
const error = payload.error instanceof Error ? payload.error : new chunk4U7ZLI36_cjs.MastraError(
|
|
18489
|
+
{
|
|
18490
|
+
id: "AGENT_STREAM_ERROR",
|
|
18491
|
+
domain: "AGENT" /* AGENT */,
|
|
18492
|
+
category: "SYSTEM" /* SYSTEM */,
|
|
18493
|
+
details: { runId }
|
|
18494
|
+
},
|
|
18495
|
+
payload.error
|
|
18496
|
+
);
|
|
18497
|
+
agentSpan?.error({ error, endSpan: true });
|
|
18466
18498
|
return;
|
|
18467
18499
|
}
|
|
18468
18500
|
const aborted = options.abortSignal?.aborted;
|
|
@@ -18490,7 +18522,19 @@ function createMapResultsStep({
|
|
|
18490
18522
|
error: e,
|
|
18491
18523
|
runId
|
|
18492
18524
|
});
|
|
18525
|
+
const spanError = e instanceof Error ? e : new chunk4U7ZLI36_cjs.MastraError(
|
|
18526
|
+
{
|
|
18527
|
+
id: "AGENT_ON_FINISH_ERROR",
|
|
18528
|
+
domain: "AGENT" /* AGENT */,
|
|
18529
|
+
category: "SYSTEM" /* SYSTEM */,
|
|
18530
|
+
details: { runId }
|
|
18531
|
+
},
|
|
18532
|
+
e
|
|
18533
|
+
);
|
|
18534
|
+
agentSpan?.error({ error: spanError, endSpan: true });
|
|
18493
18535
|
}
|
|
18536
|
+
} else {
|
|
18537
|
+
agentSpan?.end();
|
|
18494
18538
|
}
|
|
18495
18539
|
await options?.onFinish?.({
|
|
18496
18540
|
...payload,
|
|
@@ -19858,7 +19902,7 @@ ${errorMessages}`,
|
|
|
19858
19902
|
*/
|
|
19859
19903
|
listTools({ requestContext = new chunk5WBEMKE2_cjs.RequestContext() } = {}) {
|
|
19860
19904
|
if (typeof this.#tools !== "function") {
|
|
19861
|
-
return
|
|
19905
|
+
return chunkE2SMTTP6_cjs.ensureToolProperties(this.#tools);
|
|
19862
19906
|
}
|
|
19863
19907
|
const result = this.#tools({
|
|
19864
19908
|
requestContext,
|
|
@@ -19879,7 +19923,7 @@ ${errorMessages}`,
|
|
|
19879
19923
|
this.logger.error(mastraError.toString());
|
|
19880
19924
|
throw mastraError;
|
|
19881
19925
|
}
|
|
19882
|
-
return
|
|
19926
|
+
return chunkE2SMTTP6_cjs.ensureToolProperties(tools);
|
|
19883
19927
|
});
|
|
19884
19928
|
}
|
|
19885
19929
|
/**
|
|
@@ -19928,7 +19972,7 @@ ${errorMessages}`,
|
|
|
19928
19972
|
});
|
|
19929
19973
|
});
|
|
19930
19974
|
} else {
|
|
19931
|
-
llm = new
|
|
19975
|
+
llm = new chunk4TUILCMR_cjs.MastraLLMV1({
|
|
19932
19976
|
model: modelInfo,
|
|
19933
19977
|
mastra: this.#mastra,
|
|
19934
19978
|
options: { tracingPolicy: this.#options?.tracingPolicy }
|
|
@@ -19954,7 +19998,7 @@ ${errorMessages}`,
|
|
|
19954
19998
|
*/
|
|
19955
19999
|
async resolveModelConfig(modelConfig, requestContext) {
|
|
19956
20000
|
try {
|
|
19957
|
-
return await
|
|
20001
|
+
return await chunkNWOPWLJ3_cjs.resolveModelConfig(modelConfig, requestContext, this.#mastra);
|
|
19958
20002
|
} catch (error) {
|
|
19959
20003
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
19960
20004
|
id: "AGENT_GET_MODEL_MISSING_MODEL_INSTANCE",
|
|
@@ -20443,7 +20487,7 @@ ${errorMessages}`,
|
|
|
20443
20487
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20444
20488
|
requireApproval: toolObj.requireApproval
|
|
20445
20489
|
};
|
|
20446
|
-
const convertedToCoreTool =
|
|
20490
|
+
const convertedToCoreTool = chunkE2SMTTP6_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
20447
20491
|
convertedMemoryTools[toolName] = convertedToCoreTool;
|
|
20448
20492
|
}
|
|
20449
20493
|
}
|
|
@@ -20472,7 +20516,7 @@ ${errorMessages}`,
|
|
|
20472
20516
|
if (!workspace) {
|
|
20473
20517
|
return convertedWorkspaceTools;
|
|
20474
20518
|
}
|
|
20475
|
-
const workspaceTools =
|
|
20519
|
+
const workspaceTools = chunkL2FL7HMV_cjs.createWorkspaceTools(workspace);
|
|
20476
20520
|
if (Object.keys(workspaceTools).length > 0) {
|
|
20477
20521
|
this.logger.debug(`[Agent:${this.name}] - Adding workspace tools: ${Object.keys(workspaceTools).join(", ")}`, {
|
|
20478
20522
|
runId
|
|
@@ -20495,7 +20539,7 @@ ${errorMessages}`,
|
|
|
20495
20539
|
requireApproval: toolObj.requireApproval,
|
|
20496
20540
|
workspace
|
|
20497
20541
|
};
|
|
20498
|
-
const convertedToCoreTool =
|
|
20542
|
+
const convertedToCoreTool = chunkE2SMTTP6_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
20499
20543
|
convertedWorkspaceTools[toolName] = convertedToCoreTool;
|
|
20500
20544
|
}
|
|
20501
20545
|
}
|
|
@@ -20526,7 +20570,7 @@ ${errorMessages}`,
|
|
|
20526
20570
|
if (!workspace?.skills) {
|
|
20527
20571
|
return convertedSkillTools;
|
|
20528
20572
|
}
|
|
20529
|
-
const skillTools =
|
|
20573
|
+
const skillTools = chunkL2FL7HMV_cjs.createSkillTools(workspace.skills);
|
|
20530
20574
|
if (Object.keys(skillTools).length > 0) {
|
|
20531
20575
|
this.logger.debug(`[Agent:${this.name}] - Adding skill tools: ${Object.keys(skillTools).join(", ")}`, {
|
|
20532
20576
|
runId
|
|
@@ -20550,7 +20594,7 @@ ${errorMessages}`,
|
|
|
20550
20594
|
// Skill tools never require approval
|
|
20551
20595
|
workspace
|
|
20552
20596
|
};
|
|
20553
|
-
const convertedToCoreTool =
|
|
20597
|
+
const convertedToCoreTool = chunkE2SMTTP6_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
20554
20598
|
convertedSkillTools[toolName] = convertedToCoreTool;
|
|
20555
20599
|
}
|
|
20556
20600
|
}
|
|
@@ -20767,7 +20811,7 @@ ${errorMessages}`,
|
|
|
20767
20811
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20768
20812
|
requireApproval: tool2.requireApproval
|
|
20769
20813
|
};
|
|
20770
|
-
return [k,
|
|
20814
|
+
return [k, chunkE2SMTTP6_cjs.makeCoreTool(tool2, options, void 0, autoResumeSuspendedTools)];
|
|
20771
20815
|
})
|
|
20772
20816
|
);
|
|
20773
20817
|
const assignedToolEntriesConverted = Object.fromEntries(
|
|
@@ -20819,7 +20863,7 @@ ${errorMessages}`,
|
|
|
20819
20863
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20820
20864
|
requireApproval: toolObj.requireApproval
|
|
20821
20865
|
};
|
|
20822
|
-
const convertedToCoreTool =
|
|
20866
|
+
const convertedToCoreTool = chunkE2SMTTP6_cjs.makeCoreTool(toolObj, options, "toolset", autoResumeSuspendedTools);
|
|
20823
20867
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
20824
20868
|
}
|
|
20825
20869
|
}
|
|
@@ -20866,7 +20910,7 @@ ${errorMessages}`,
|
|
|
20866
20910
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20867
20911
|
requireApproval: tool2.requireApproval
|
|
20868
20912
|
};
|
|
20869
|
-
const convertedToCoreTool =
|
|
20913
|
+
const convertedToCoreTool = chunkE2SMTTP6_cjs.makeCoreTool(toolRest, options, "client-tool", autoResumeSuspendedTools);
|
|
20870
20914
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
20871
20915
|
}
|
|
20872
20916
|
}
|
|
@@ -20950,7 +20994,7 @@ ${errorMessages}`,
|
|
|
20950
20994
|
).describe("The results from the agent's tool calls").optional()
|
|
20951
20995
|
});
|
|
20952
20996
|
const modelVersion = (await agent.getModel({ requestContext })).specificationVersion;
|
|
20953
|
-
const toolObj =
|
|
20997
|
+
const toolObj = chunk2OYWVA6F_cjs.createTool({
|
|
20954
20998
|
id: `agent-${agentName}`,
|
|
20955
20999
|
description: agent.getDescription() || `Agent: ${agentName}`,
|
|
20956
21000
|
inputSchema: agentInputSchema,
|
|
@@ -21139,10 +21183,7 @@ ${effectiveInstructions}`;
|
|
|
21139
21183
|
this.logger.error(`[Agent:${this.name}] - messageFilter error: ${filterError}`);
|
|
21140
21184
|
}
|
|
21141
21185
|
}
|
|
21142
|
-
const messagesForSubAgent = [
|
|
21143
|
-
...filteredContextMessages,
|
|
21144
|
-
{ role: "user", content: effectivePrompt }
|
|
21145
|
-
];
|
|
21186
|
+
const messagesForSubAgent = [{ role: "user", content: effectivePrompt }];
|
|
21146
21187
|
const subAgentPromptCreatedAt = /* @__PURE__ */ new Date();
|
|
21147
21188
|
if ((methodType === "generate" || methodType === "generateLegacy") && supportedLanguageModelSpecifications.includes(modelVersion)) {
|
|
21148
21189
|
const generateResult = resumeData ? await agent.resumeGenerate(resumeData, {
|
|
@@ -21151,6 +21192,7 @@ ${effectiveInstructions}`;
|
|
|
21151
21192
|
...chunkBF7IH4JU_cjs.resolveObservabilityContext(context ?? {}),
|
|
21152
21193
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21153
21194
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21195
|
+
context: filteredContextMessages,
|
|
21154
21196
|
...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
|
|
21155
21197
|
memory: {
|
|
21156
21198
|
resource: subAgentResourceId,
|
|
@@ -21163,6 +21205,7 @@ ${effectiveInstructions}`;
|
|
|
21163
21205
|
...chunkBF7IH4JU_cjs.resolveObservabilityContext(context ?? {}),
|
|
21164
21206
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21165
21207
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21208
|
+
context: filteredContextMessages,
|
|
21166
21209
|
...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
|
|
21167
21210
|
memory: {
|
|
21168
21211
|
resource: subAgentResourceId,
|
|
@@ -21224,7 +21267,8 @@ ${effectiveInstructions}`;
|
|
|
21224
21267
|
} else if (methodType === "generate" && modelVersion === "v1") {
|
|
21225
21268
|
const generateResult = await agent.generateLegacy(messagesForSubAgent, {
|
|
21226
21269
|
requestContext,
|
|
21227
|
-
...chunkBF7IH4JU_cjs.resolveObservabilityContext(context ?? {})
|
|
21270
|
+
...chunkBF7IH4JU_cjs.resolveObservabilityContext(context ?? {}),
|
|
21271
|
+
context: filteredContextMessages
|
|
21228
21272
|
});
|
|
21229
21273
|
result = { text: generateResult.text };
|
|
21230
21274
|
} else if ((methodType === "stream" || methodType === "streamLegacy") && supportedLanguageModelSpecifications.includes(modelVersion)) {
|
|
@@ -21234,6 +21278,7 @@ ${effectiveInstructions}`;
|
|
|
21234
21278
|
...chunkBF7IH4JU_cjs.resolveObservabilityContext(context ?? {}),
|
|
21235
21279
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21236
21280
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21281
|
+
context: filteredContextMessages,
|
|
21237
21282
|
...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
|
|
21238
21283
|
memory: {
|
|
21239
21284
|
resource: subAgentResourceId,
|
|
@@ -21248,6 +21293,7 @@ ${effectiveInstructions}`;
|
|
|
21248
21293
|
...chunkBF7IH4JU_cjs.resolveObservabilityContext(context ?? {}),
|
|
21249
21294
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21250
21295
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21296
|
+
context: filteredContextMessages,
|
|
21251
21297
|
...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
|
|
21252
21298
|
memory: {
|
|
21253
21299
|
resource: subAgentResourceId,
|
|
@@ -21529,7 +21575,7 @@ ${effectiveInstructions}`;
|
|
|
21529
21575
|
...observabilityContext,
|
|
21530
21576
|
tracingPolicy: this.#options?.tracingPolicy
|
|
21531
21577
|
};
|
|
21532
|
-
convertedAgentTools[`agent-${agentName}`] =
|
|
21578
|
+
convertedAgentTools[`agent-${agentName}`] = chunkE2SMTTP6_cjs.makeCoreTool(
|
|
21533
21579
|
toolObj,
|
|
21534
21580
|
options,
|
|
21535
21581
|
void 0,
|
|
@@ -21594,7 +21640,7 @@ ${effectiveInstructions}`;
|
|
|
21594
21640
|
}
|
|
21595
21641
|
]
|
|
21596
21642
|
};
|
|
21597
|
-
const toolObj =
|
|
21643
|
+
const toolObj = chunk2OYWVA6F_cjs.createTool({
|
|
21598
21644
|
id: `workflow-${workflowName}`,
|
|
21599
21645
|
description: workflow.description || `Workflow: ${workflowName}`,
|
|
21600
21646
|
inputSchema: extendedInputSchema,
|
|
@@ -21746,7 +21792,7 @@ ${effectiveInstructions}`;
|
|
|
21746
21792
|
...observabilityContext,
|
|
21747
21793
|
tracingPolicy: this.#options?.tracingPolicy
|
|
21748
21794
|
};
|
|
21749
|
-
convertedWorkflowTools[`workflow-${workflowName}`] =
|
|
21795
|
+
convertedWorkflowTools[`workflow-${workflowName}`] = chunkE2SMTTP6_cjs.makeCoreTool(
|
|
21750
21796
|
toolObj,
|
|
21751
21797
|
options,
|
|
21752
21798
|
void 0,
|
|
@@ -21778,7 +21824,7 @@ ${effectiveInstructions}`;
|
|
|
21778
21824
|
let mastraProxy = void 0;
|
|
21779
21825
|
const logger = this.logger;
|
|
21780
21826
|
if (this.#mastra) {
|
|
21781
|
-
mastraProxy =
|
|
21827
|
+
mastraProxy = chunkE2SMTTP6_cjs.createMastraProxy({ mastra: this.#mastra, logger });
|
|
21782
21828
|
}
|
|
21783
21829
|
const assignedTools = await this.listAssignedTools({
|
|
21784
21830
|
runId,
|
|
@@ -22030,7 +22076,7 @@ ${effectiveInstructions}`;
|
|
|
22030
22076
|
const resolvedModel = await this.resolveModelConfig(selection, requestContext);
|
|
22031
22077
|
this.assertSupportsPreparedModels(resolvedModel);
|
|
22032
22078
|
let headers;
|
|
22033
|
-
if (resolvedModel instanceof
|
|
22079
|
+
if (resolvedModel instanceof chunkNWOPWLJ3_cjs.ModelRouterLanguageModel) {
|
|
22034
22080
|
headers = resolvedModel.config?.headers;
|
|
22035
22081
|
}
|
|
22036
22082
|
return [
|
|
@@ -22063,7 +22109,7 @@ ${effectiveInstructions}`;
|
|
|
22063
22109
|
throw mastraError;
|
|
22064
22110
|
}
|
|
22065
22111
|
let headers;
|
|
22066
|
-
if (model instanceof
|
|
22112
|
+
if (model instanceof chunkNWOPWLJ3_cjs.ModelRouterLanguageModel) {
|
|
22067
22113
|
headers = model.config?.headers;
|
|
22068
22114
|
}
|
|
22069
22115
|
return {
|
|
@@ -22297,12 +22343,16 @@ ${effectiveInstructions}`;
|
|
|
22297
22343
|
const {
|
|
22298
22344
|
shouldGenerate,
|
|
22299
22345
|
model: titleModel,
|
|
22300
|
-
instructions: titleInstructions
|
|
22346
|
+
instructions: titleInstructions,
|
|
22347
|
+
minMessages
|
|
22301
22348
|
} = this.resolveTitleGenerationConfig(
|
|
22302
|
-
config
|
|
22349
|
+
config?.generateTitle
|
|
22303
22350
|
);
|
|
22304
|
-
|
|
22305
|
-
|
|
22351
|
+
const uiMessages = messageList.get.all.ui();
|
|
22352
|
+
const messages = messageList.get.all.core();
|
|
22353
|
+
const requiredMessages = minMessages ?? 1;
|
|
22354
|
+
if (shouldGenerate && !thread.title && messages.length >= requiredMessages) {
|
|
22355
|
+
const userMessage = this.getMostRecentUserMessage(uiMessages);
|
|
22306
22356
|
if (userMessage) {
|
|
22307
22357
|
void this.genTitle(userMessage, requestContext, observabilityContext, titleModel, titleInstructions).then(
|
|
22308
22358
|
async (title) => {
|
|
@@ -22517,7 +22567,7 @@ ${effectiveInstructions}`;
|
|
|
22517
22567
|
const defaultOptions = await this.getDefaultOptions({
|
|
22518
22568
|
requestContext: options?.requestContext
|
|
22519
22569
|
});
|
|
22520
|
-
const mergedOptions =
|
|
22570
|
+
const mergedOptions = chunkE2SMTTP6_cjs.deepMerge(
|
|
22521
22571
|
defaultOptions,
|
|
22522
22572
|
options ?? {}
|
|
22523
22573
|
);
|
|
@@ -22587,7 +22637,7 @@ ${effectiveInstructions}`;
|
|
|
22587
22637
|
const defaultOptions = await this.getDefaultOptions({
|
|
22588
22638
|
requestContext: streamOptions?.requestContext
|
|
22589
22639
|
});
|
|
22590
|
-
const mergedOptions =
|
|
22640
|
+
const mergedOptions = chunkE2SMTTP6_cjs.deepMerge(
|
|
22591
22641
|
defaultOptions,
|
|
22592
22642
|
streamOptions ?? {}
|
|
22593
22643
|
);
|
|
@@ -22651,7 +22701,7 @@ ${effectiveInstructions}`;
|
|
|
22651
22701
|
const defaultOptions = await this.getDefaultOptions({
|
|
22652
22702
|
requestContext: streamOptions?.requestContext
|
|
22653
22703
|
});
|
|
22654
|
-
let mergedStreamOptions =
|
|
22704
|
+
let mergedStreamOptions = chunkE2SMTTP6_cjs.deepMerge(
|
|
22655
22705
|
defaultOptions,
|
|
22656
22706
|
streamOptions ?? {}
|
|
22657
22707
|
);
|
|
@@ -22716,7 +22766,7 @@ ${effectiveInstructions}`;
|
|
|
22716
22766
|
const defaultOptions = await this.getDefaultOptions({
|
|
22717
22767
|
requestContext: options?.requestContext
|
|
22718
22768
|
});
|
|
22719
|
-
const mergedOptions =
|
|
22769
|
+
const mergedOptions = chunkE2SMTTP6_cjs.deepMerge(
|
|
22720
22770
|
defaultOptions,
|
|
22721
22771
|
options ?? {}
|
|
22722
22772
|
);
|
|
@@ -22879,7 +22929,8 @@ ${effectiveInstructions}`;
|
|
|
22879
22929
|
return {
|
|
22880
22930
|
shouldGenerate: true,
|
|
22881
22931
|
model: generateTitleConfig.model,
|
|
22882
|
-
instructions: generateTitleConfig.instructions
|
|
22932
|
+
instructions: generateTitleConfig.instructions,
|
|
22933
|
+
minMessages: generateTitleConfig.minMessages
|
|
22883
22934
|
};
|
|
22884
22935
|
}
|
|
22885
22936
|
return { shouldGenerate: false };
|
|
@@ -24290,7 +24341,7 @@ var TokenLimiterProcessor = class _TokenLimiterProcessor {
|
|
|
24290
24341
|
return new TiktokenClass(this.customEncoding);
|
|
24291
24342
|
});
|
|
24292
24343
|
} else {
|
|
24293
|
-
this.encoderPromise =
|
|
24344
|
+
this.encoderPromise = chunkL2FL7HMV_cjs.getTiktoken();
|
|
24294
24345
|
}
|
|
24295
24346
|
}
|
|
24296
24347
|
return this.encoderPromise;
|
|
@@ -25185,7 +25236,7 @@ var ToolSearchProcessor = class {
|
|
|
25185
25236
|
minScore: options.search?.minScore ?? 0
|
|
25186
25237
|
};
|
|
25187
25238
|
this.ttl = options.ttl ?? 36e5;
|
|
25188
|
-
this.bm25Index = new
|
|
25239
|
+
this.bm25Index = new chunkL2FL7HMV_cjs.BM25Index({}, TOOL_SEARCH_TOKENIZE_OPTIONS);
|
|
25189
25240
|
this.indexTools();
|
|
25190
25241
|
if (this.ttl > 0) {
|
|
25191
25242
|
this.scheduleCleanup();
|
|
@@ -25350,7 +25401,7 @@ var ToolSearchProcessor = class {
|
|
|
25350
25401
|
messageList.addSystem(
|
|
25351
25402
|
"To discover available tools, call search_tools with a keyword query. To add a tool to the conversation, call load_tool with the tool name. Tools must be loaded before they can be used."
|
|
25352
25403
|
);
|
|
25353
|
-
const searchTool =
|
|
25404
|
+
const searchTool = chunk2OYWVA6F_cjs.createTool({
|
|
25354
25405
|
id: "search_tools",
|
|
25355
25406
|
description: "Search for available tools by keyword. Use this when you need a capability you don't currently have. Returns a list of matching tools with their names and descriptions. After finding a useful tool, use load_tool to make it available.",
|
|
25356
25407
|
inputSchema: v4.z.object({
|
|
@@ -25380,7 +25431,7 @@ var ToolSearchProcessor = class {
|
|
|
25380
25431
|
};
|
|
25381
25432
|
}
|
|
25382
25433
|
});
|
|
25383
|
-
const loadTool =
|
|
25434
|
+
const loadTool = chunk2OYWVA6F_cjs.createTool({
|
|
25384
25435
|
id: "load_tool",
|
|
25385
25436
|
description: "Load a specific tool into your context. Call this after finding a tool with search_tools. Once loaded, the tool will be available for use. Args: toolName - The exact name of the tool to load (from search results).",
|
|
25386
25437
|
inputSchema: v4.z.object({
|
|
@@ -25578,7 +25629,7 @@ var SkillSearchProcessor = class {
|
|
|
25578
25629
|
messageList.addSystem(
|
|
25579
25630
|
"To discover available skills, call search_skills with a keyword query. To load a skill's instructions, call load_skill with the skill name. Loaded skills provide context and instructions for the conversation."
|
|
25580
25631
|
);
|
|
25581
|
-
const searchSkillTool =
|
|
25632
|
+
const searchSkillTool = chunk2OYWVA6F_cjs.createTool({
|
|
25582
25633
|
id: "search_skills",
|
|
25583
25634
|
description: "Search for available skills by keyword. Returns a list of matching skills with their names and descriptions. After finding a useful skill, use load_skill to load its instructions.",
|
|
25584
25635
|
inputSchema: v4.z.object({
|
|
@@ -25628,7 +25679,7 @@ var SkillSearchProcessor = class {
|
|
|
25628
25679
|
};
|
|
25629
25680
|
}
|
|
25630
25681
|
});
|
|
25631
|
-
const loadSkillTool =
|
|
25682
|
+
const loadSkillTool = chunk2OYWVA6F_cjs.createTool({
|
|
25632
25683
|
id: "load_skill",
|
|
25633
25684
|
description: "Load a skill's full instructions into the conversation. Call this after finding a skill with search_skills. The skill's instructions will be available as context.",
|
|
25634
25685
|
inputSchema: v4.z.object({
|
|
@@ -25967,7 +26018,7 @@ var WorkingMemory = class {
|
|
|
25967
26018
|
return messageList;
|
|
25968
26019
|
}
|
|
25969
26020
|
generateEmptyFromSchemaInternal(schema) {
|
|
25970
|
-
const result =
|
|
26021
|
+
const result = chunkE2SMTTP6_cjs.generateEmptyFromSchema(schema);
|
|
25971
26022
|
return Object.keys(result).length > 0 ? result : null;
|
|
25972
26023
|
}
|
|
25973
26024
|
getWorkingMemoryToolInstruction({
|
|
@@ -26612,7 +26663,7 @@ https://mastra.ai/en/docs/memory/semantic-recall`
|
|
|
26612
26663
|
);
|
|
26613
26664
|
}
|
|
26614
26665
|
if (typeof config.embedder === "string") {
|
|
26615
|
-
this.embedder = new
|
|
26666
|
+
this.embedder = new chunkNWOPWLJ3_cjs.ModelRouterEmbeddingModel(config.embedder);
|
|
26616
26667
|
} else {
|
|
26617
26668
|
this.embedder = config.embedder;
|
|
26618
26669
|
}
|
|
@@ -26625,7 +26676,7 @@ https://mastra.ai/en/docs/memory/semantic-recall`
|
|
|
26625
26676
|
}
|
|
26626
26677
|
if (config.embedder) {
|
|
26627
26678
|
if (typeof config.embedder === "string") {
|
|
26628
|
-
this.embedder = new
|
|
26679
|
+
this.embedder = new chunkNWOPWLJ3_cjs.ModelRouterEmbeddingModel(config.embedder);
|
|
26629
26680
|
} else {
|
|
26630
26681
|
this.embedder = config.embedder;
|
|
26631
26682
|
}
|
|
@@ -26665,7 +26716,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
26665
26716
|
}
|
|
26666
26717
|
setEmbedder(embedder, embedderOptions) {
|
|
26667
26718
|
if (typeof embedder === "string") {
|
|
26668
|
-
this.embedder = new
|
|
26719
|
+
this.embedder = new chunkNWOPWLJ3_cjs.ModelRouterEmbeddingModel(embedder);
|
|
26669
26720
|
} else {
|
|
26670
26721
|
this.embedder = embedder;
|
|
26671
26722
|
}
|
|
@@ -26762,7 +26813,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
26762
26813
|
"The threads.generateTitle option has been moved. Use the top-level generateTitle option instead."
|
|
26763
26814
|
);
|
|
26764
26815
|
}
|
|
26765
|
-
const mergedConfig =
|
|
26816
|
+
const mergedConfig = chunkE2SMTTP6_cjs.deepMerge(this.threadConfig, config || {});
|
|
26766
26817
|
if (typeof config?.workingMemory === "object" && config.workingMemory?.schema && typeof mergedConfig.workingMemory === "object") {
|
|
26767
26818
|
mergedConfig.workingMemory.schema = config.workingMemory.schema;
|
|
26768
26819
|
}
|
|
@@ -27114,7 +27165,7 @@ var MockMemory = class extends MastraMemory {
|
|
|
27114
27165
|
} = {}) {
|
|
27115
27166
|
super({
|
|
27116
27167
|
name: "mock",
|
|
27117
|
-
storage: storage || new
|
|
27168
|
+
storage: storage || new chunkGNA52EF4_cjs.InMemoryStore(),
|
|
27118
27169
|
options: {
|
|
27119
27170
|
...options,
|
|
27120
27171
|
workingMemory: enableWorkingMemory ? { enabled: true, template: workingMemoryTemplate } : options?.workingMemory,
|
|
@@ -27195,7 +27246,7 @@ var MockMemory = class extends MastraMemory {
|
|
|
27195
27246
|
return {};
|
|
27196
27247
|
}
|
|
27197
27248
|
return {
|
|
27198
|
-
updateWorkingMemory:
|
|
27249
|
+
updateWorkingMemory: chunk2OYWVA6F_cjs.createTool({
|
|
27199
27250
|
id: "update-working-memory",
|
|
27200
27251
|
description: `Update the working memory with new information. Any data not included will be overwritten.`,
|
|
27201
27252
|
inputSchema: v4.z.object({ memory: v4.z.string() }),
|
|
@@ -27425,5 +27476,5 @@ exports.validateStepRequestContext = validateStepRequestContext;
|
|
|
27425
27476
|
exports.validateStepResumeData = validateStepResumeData;
|
|
27426
27477
|
exports.validateStepStateData = validateStepStateData;
|
|
27427
27478
|
exports.validateStepSuspendData = validateStepSuspendData;
|
|
27428
|
-
//# sourceMappingURL=chunk-
|
|
27429
|
-
//# sourceMappingURL=chunk-
|
|
27479
|
+
//# sourceMappingURL=chunk-O542TXPV.cjs.map
|
|
27480
|
+
//# sourceMappingURL=chunk-O542TXPV.cjs.map
|