@mastra/core 1.0.0-beta.15 → 1.0.0-beta.16
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 +165 -0
- 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-IRTICXRZ.cjs → chunk-33VDGXRH.cjs} +22 -44
- package/dist/chunk-33VDGXRH.cjs.map +1 -0
- package/dist/{chunk-DRJTNGI4.cjs → chunk-3ZRMVPQA.cjs} +7 -7
- package/dist/{chunk-DRJTNGI4.cjs.map → chunk-3ZRMVPQA.cjs.map} +1 -1
- package/dist/{chunk-GXMJ5URG.cjs → chunk-4KVIXN7K.cjs} +14 -14
- package/dist/{chunk-GXMJ5URG.cjs.map → chunk-4KVIXN7K.cjs.map} +1 -1
- package/dist/{chunk-BAZHNX5P.js → chunk-4N6WB4EZ.js} +6 -6
- package/dist/{chunk-BAZHNX5P.js.map → chunk-4N6WB4EZ.js.map} +1 -1
- package/dist/{chunk-CBY37FTP.cjs → chunk-4UH5LAF5.cjs} +15 -15
- package/dist/{chunk-CBY37FTP.cjs.map → chunk-4UH5LAF5.cjs.map} +1 -1
- package/dist/{chunk-DDK3URK2.cjs → chunk-5DL6Y7PJ.cjs} +104 -83
- package/dist/chunk-5DL6Y7PJ.cjs.map +1 -0
- package/dist/{chunk-6HJFCSJ4.cjs → chunk-6YUHA5UH.cjs} +2 -2
- package/dist/chunk-6YUHA5UH.cjs.map +1 -0
- package/dist/{chunk-T2LVULCK.cjs → chunk-7KL2YFFK.cjs} +9 -9
- package/dist/{chunk-T2LVULCK.cjs.map → chunk-7KL2YFFK.cjs.map} +1 -1
- package/dist/{chunk-RA2CHJCY.cjs → chunk-A6JNGJIU.cjs} +36 -36
- package/dist/chunk-A6JNGJIU.cjs.map +1 -0
- package/dist/{chunk-BC2VKOH4.cjs → chunk-AQ22JIR7.cjs} +18 -18
- package/dist/{chunk-BC2VKOH4.cjs.map → chunk-AQ22JIR7.cjs.map} +1 -1
- package/dist/{chunk-YV43YEZ6.js → chunk-CSCTVLD5.js} +3 -3
- package/dist/chunk-CSCTVLD5.js.map +1 -0
- package/dist/chunk-DMX7MC4N.js +3 -0
- package/dist/{chunk-GXSERFAG.js.map → chunk-DMX7MC4N.js.map} +1 -1
- package/dist/{chunk-IHISDRFV.js → chunk-DT5RMENY.js} +187 -95
- package/dist/chunk-DT5RMENY.js.map +1 -0
- package/dist/{chunk-NGWTSHNA.js → chunk-F7PAZAGE.js} +69 -48
- package/dist/chunk-F7PAZAGE.js.map +1 -0
- package/dist/{chunk-XJB7J4UT.js → chunk-FB5QMTJJ.js} +4 -4
- package/dist/{chunk-XJB7J4UT.js.map → chunk-FB5QMTJJ.js.map} +1 -1
- package/dist/{chunk-3HDRO3GG.js → chunk-GNUITL2N.js} +26 -49
- package/dist/chunk-GNUITL2N.js.map +1 -0
- package/dist/{chunk-HAYBGFPA.js → chunk-J4SXS7KN.js} +4 -4
- package/dist/{chunk-HAYBGFPA.js.map → chunk-J4SXS7KN.js.map} +1 -1
- package/dist/{chunk-ZGIVAQRI.js → chunk-JQM64OZF.js} +2 -2
- package/dist/chunk-JQM64OZF.js.map +1 -0
- package/dist/{chunk-CBQ6WDUJ.js → chunk-K4XAKG7L.js} +4 -4
- package/dist/{chunk-CBQ6WDUJ.js.map → chunk-K4XAKG7L.js.map} +1 -1
- package/dist/{chunk-4J4M2Q5R.js → chunk-KKYAYRIO.js} +4 -4
- package/dist/{chunk-4J4M2Q5R.js.map → chunk-KKYAYRIO.js.map} +1 -1
- package/dist/{chunk-S23TNDXG.cjs → chunk-NCAMNQC3.cjs} +188 -96
- package/dist/chunk-NCAMNQC3.cjs.map +1 -0
- package/dist/{chunk-CBVHOGXX.cjs → chunk-NK4UN2LF.cjs} +6 -6
- package/dist/chunk-NK4UN2LF.cjs.map +1 -0
- package/dist/{chunk-BCUKD2XG.js → chunk-NNFF3URD.js} +12 -34
- package/dist/chunk-NNFF3URD.js.map +1 -0
- package/dist/{chunk-LOV5NNGK.cjs → chunk-OXV6QFSV.cjs} +31 -54
- package/dist/chunk-OXV6QFSV.cjs.map +1 -0
- package/dist/{chunk-4HP7CS6L.js → chunk-QD776HMB.js} +2 -2
- package/dist/chunk-QD776HMB.js.map +1 -0
- package/dist/chunk-ROOVGRNA.cjs +4 -0
- package/dist/{chunk-X4RMXTXF.cjs.map → chunk-ROOVGRNA.cjs.map} +1 -1
- package/dist/{chunk-2OOMJRXZ.cjs → chunk-UT6MASE5.cjs} +3 -3
- package/dist/{chunk-2OOMJRXZ.cjs.map → chunk-UT6MASE5.cjs.map} +1 -1
- package/dist/{chunk-D2IFWD7A.js → chunk-UTMBASR5.js} +10 -10
- package/dist/chunk-UTMBASR5.js.map +1 -0
- package/dist/{chunk-AR5CF3IN.js → chunk-WDXYPI3P.js} +3 -3
- package/dist/{chunk-AR5CF3IN.js.map → chunk-WDXYPI3P.js.map} +1 -1
- package/dist/{chunk-O2CAMK4A.cjs → chunk-ZSZOYPSJ.cjs} +2 -2
- package/dist/chunk-ZSZOYPSJ.cjs.map +1 -0
- package/dist/evals/index.cjs +19 -19
- package/dist/evals/index.js +2 -2
- package/dist/evals/scoreTraces/index.cjs +5 -5
- package/dist/evals/scoreTraces/index.cjs.map +1 -1
- package/dist/evals/scoreTraces/index.js +2 -2
- package/dist/evals/scoreTraces/index.js.map +1 -1
- package/dist/evals/types.d.ts +0 -2
- package/dist/evals/types.d.ts.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 +11 -11
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/provider-types.generated.d.ts +88 -42
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +1 -1
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +1 -1
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
- package/dist/mastra/hooks.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/mcp/index.cjs +3 -0
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +3 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/types.d.ts +2 -0
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/memory/index.cjs +11 -11
- package/dist/memory/index.js +1 -1
- package/dist/netlify-3MHHJG2E.js +3 -0
- package/dist/{netlify-J4QPOROO.js.map → netlify-3MHHJG2E.js.map} +1 -1
- package/dist/netlify-5Y33S7WL.cjs +12 -0
- package/dist/{netlify-CUYK2MZ2.cjs.map → netlify-5Y33S7WL.cjs.map} +1 -1
- package/dist/observability/index.cjs +11 -11
- package/dist/observability/index.js +1 -1
- package/dist/observability/types/tracing.d.ts +2 -1
- package/dist/observability/types/tracing.d.ts.map +1 -1
- package/dist/processors/index.cjs +37 -37
- package/dist/processors/index.js +1 -1
- package/dist/processors/processors/structured-output.d.ts +1 -0
- package/dist/processors/processors/structured-output.d.ts.map +1 -1
- package/dist/provider-registry-LXSWMVEC.js +3 -0
- package/dist/{provider-registry-6CIGRQVZ.js.map → provider-registry-LXSWMVEC.js.map} +1 -1
- package/dist/provider-registry-YJ2P5YY5.cjs +40 -0
- package/dist/{provider-registry-7O7FJ4BS.cjs.map → provider-registry-YJ2P5YY5.cjs.map} +1 -1
- package/dist/provider-registry.json +184 -92
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/server/types.d.ts +28 -0
- package/dist/server/types.d.ts.map +1 -1
- package/dist/storage/base.d.ts +76 -29
- package/dist/storage/base.d.ts.map +1 -1
- package/dist/storage/constants.cjs +14 -14
- package/dist/storage/constants.js +1 -1
- package/dist/storage/index.cjs +92 -92
- package/dist/storage/index.js +2 -2
- package/dist/storage/mock.d.ts +0 -2
- package/dist/storage/mock.d.ts.map +1 -1
- package/dist/storage/types.d.ts +0 -24
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/compat/consume-stream.d.ts +4 -1
- package/dist/stream/aisdk/v5/compat/consume-stream.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
- package/dist/stream/base/output.d.ts.map +1 -1
- package/dist/stream/index.cjs +9 -9
- 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 +4 -4
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- 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.d.ts +4 -4
- package/dist/tools/tool.d.ts.map +1 -1
- package/dist/tools/types.d.ts +3 -1
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils.cjs +22 -22
- package/dist/utils.js +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +23 -23
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/llm/model/provider-types.generated.d.ts +88 -42
- package/dist/chunk-3HDRO3GG.js.map +0 -1
- package/dist/chunk-4HP7CS6L.js.map +0 -1
- package/dist/chunk-6HJFCSJ4.cjs.map +0 -1
- package/dist/chunk-BCUKD2XG.js.map +0 -1
- package/dist/chunk-CBVHOGXX.cjs.map +0 -1
- package/dist/chunk-D2IFWD7A.js.map +0 -1
- package/dist/chunk-DDK3URK2.cjs.map +0 -1
- package/dist/chunk-GXSERFAG.js +0 -3
- package/dist/chunk-IHISDRFV.js.map +0 -1
- package/dist/chunk-IRTICXRZ.cjs.map +0 -1
- package/dist/chunk-LOV5NNGK.cjs.map +0 -1
- package/dist/chunk-NGWTSHNA.js.map +0 -1
- package/dist/chunk-O2CAMK4A.cjs.map +0 -1
- package/dist/chunk-RA2CHJCY.cjs.map +0 -1
- package/dist/chunk-S23TNDXG.cjs.map +0 -1
- package/dist/chunk-X4RMXTXF.cjs +0 -4
- package/dist/chunk-YV43YEZ6.js.map +0 -1
- package/dist/chunk-ZGIVAQRI.js.map +0 -1
- package/dist/netlify-CUYK2MZ2.cjs +0 -12
- package/dist/netlify-J4QPOROO.js +0 -3
- package/dist/provider-registry-6CIGRQVZ.js +0 -3
- package/dist/provider-registry-7O7FJ4BS.cjs +0 -40
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkSSB4AVHU_cjs = require('./chunk-SSB4AVHU.cjs');
|
|
4
4
|
var chunkL3NKIMF5_cjs = require('./chunk-L3NKIMF5.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkOXV6QFSV_cjs = require('./chunk-OXV6QFSV.cjs');
|
|
6
6
|
var chunkEMLEZXTQ_cjs = require('./chunk-EMLEZXTQ.cjs');
|
|
7
7
|
var chunkNESKUIRE_cjs = require('./chunk-NESKUIRE.cjs');
|
|
8
8
|
var chunkFVQTJUBD_cjs = require('./chunk-FVQTJUBD.cjs');
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var chunk4KVIXN7K_cjs = require('./chunk-4KVIXN7K.cjs');
|
|
10
|
+
var chunk7KL2YFFK_cjs = require('./chunk-7KL2YFFK.cjs');
|
|
11
11
|
var chunk4D4KB75Y_cjs = require('./chunk-4D4KB75Y.cjs');
|
|
12
12
|
var chunkMR7ZWBL6_cjs = require('./chunk-MR7ZWBL6.cjs');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
13
|
+
var chunkAQ22JIR7_cjs = require('./chunk-AQ22JIR7.cjs');
|
|
14
|
+
var chunkZSZOYPSJ_cjs = require('./chunk-ZSZOYPSJ.cjs');
|
|
15
15
|
var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
|
|
16
16
|
var chunkKJBMTK5B_cjs = require('./chunk-KJBMTK5B.cjs');
|
|
17
|
-
var
|
|
17
|
+
var chunk6YUHA5UH_cjs = require('./chunk-6YUHA5UH.cjs');
|
|
18
18
|
var chunkUVHSM2GU_cjs = require('./chunk-UVHSM2GU.cjs');
|
|
19
19
|
var chunk4WQYXT2I_cjs = require('./chunk-4WQYXT2I.cjs');
|
|
20
20
|
var chunkDGV2FWB4_cjs = require('./chunk-DGV2FWB4.cjs');
|
|
@@ -529,7 +529,8 @@ function prepareToolsAndToolChoice({
|
|
|
529
529
|
// src/stream/aisdk/v5/compat/consume-stream.ts
|
|
530
530
|
async function consumeStream({
|
|
531
531
|
stream,
|
|
532
|
-
onError
|
|
532
|
+
onError,
|
|
533
|
+
logger
|
|
533
534
|
}) {
|
|
534
535
|
const reader = stream.getReader();
|
|
535
536
|
try {
|
|
@@ -538,7 +539,7 @@ async function consumeStream({
|
|
|
538
539
|
if (done) break;
|
|
539
540
|
}
|
|
540
541
|
} catch (error) {
|
|
541
|
-
|
|
542
|
+
logger?.error("consumeStream error", error);
|
|
542
543
|
onError?.(error);
|
|
543
544
|
} finally {
|
|
544
545
|
reader.releaseLock();
|
|
@@ -557,6 +558,7 @@ var StructuredOutputProcessor = class {
|
|
|
557
558
|
isStructuringAgentStreamStarted = false;
|
|
558
559
|
jsonPromptInjection;
|
|
559
560
|
providerOptions;
|
|
561
|
+
logger;
|
|
560
562
|
constructor(options) {
|
|
561
563
|
if (!options.schema) {
|
|
562
564
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -579,6 +581,7 @@ var StructuredOutputProcessor = class {
|
|
|
579
581
|
this.fallbackValue = options.fallbackValue;
|
|
580
582
|
this.jsonPromptInjection = options.jsonPromptInjection;
|
|
581
583
|
this.providerOptions = options.providerOptions;
|
|
584
|
+
this.logger = options.logger;
|
|
582
585
|
this.structuringAgent = new Agent({
|
|
583
586
|
id: "structured-output-structurer",
|
|
584
587
|
name: "structured-output-structurer",
|
|
@@ -744,14 +747,14 @@ The input text may be in any format (sentences, bullet points, paragraphs, etc.)
|
|
|
744
747
|
const message = `[StructuredOutputProcessor] ${context}: ${error}`;
|
|
745
748
|
switch (this.errorStrategy) {
|
|
746
749
|
case "strict":
|
|
747
|
-
|
|
750
|
+
this.logger?.error(message);
|
|
748
751
|
abort(message);
|
|
749
752
|
break;
|
|
750
753
|
case "warn":
|
|
751
|
-
|
|
754
|
+
this.logger?.warn(message);
|
|
752
755
|
break;
|
|
753
756
|
case "fallback":
|
|
754
|
-
|
|
757
|
+
this.logger?.info(`${message} (using fallback)`);
|
|
755
758
|
break;
|
|
756
759
|
}
|
|
757
760
|
}
|
|
@@ -1749,7 +1752,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1749
1752
|
}
|
|
1750
1753
|
const { model: _model, ...rest } = result;
|
|
1751
1754
|
if (result.model) {
|
|
1752
|
-
const resolvedModel = await
|
|
1755
|
+
const resolvedModel = await chunk4KVIXN7K_cjs.resolveModelConfig(result.model);
|
|
1753
1756
|
const isSupported = isSupportedLanguageModel(resolvedModel);
|
|
1754
1757
|
if (!isSupported) {
|
|
1755
1758
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -2484,7 +2487,6 @@ var AISDKV5OutputStream = class {
|
|
|
2484
2487
|
async getFullOutput() {
|
|
2485
2488
|
await this.consumeStream({
|
|
2486
2489
|
onError: (error) => {
|
|
2487
|
-
console.error(error);
|
|
2488
2490
|
throw error;
|
|
2489
2491
|
}
|
|
2490
2492
|
});
|
|
@@ -3901,7 +3903,8 @@ var MastraModelOutput = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
3901
3903
|
try {
|
|
3902
3904
|
await consumeStream({
|
|
3903
3905
|
stream: this.#baseStream,
|
|
3904
|
-
onError: options?.onError
|
|
3906
|
+
onError: options?.onError,
|
|
3907
|
+
logger: this.logger
|
|
3905
3908
|
});
|
|
3906
3909
|
} catch (error) {
|
|
3907
3910
|
options?.onError?.(error);
|
|
@@ -3913,7 +3916,7 @@ var MastraModelOutput = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
3913
3916
|
async getFullOutput() {
|
|
3914
3917
|
await this.consumeStream({
|
|
3915
3918
|
onError: (error) => {
|
|
3916
|
-
|
|
3919
|
+
this.logger.error("Error consuming stream", error);
|
|
3917
3920
|
throw error;
|
|
3918
3921
|
}
|
|
3919
3922
|
});
|
|
@@ -5342,7 +5345,7 @@ var createTimeTravelExecutionParams = (params) => {
|
|
|
5342
5345
|
result = void 0;
|
|
5343
5346
|
}
|
|
5344
5347
|
if (result) {
|
|
5345
|
-
const formattedResult =
|
|
5348
|
+
const formattedResult = chunkAQ22JIR7_cjs.removeUndefinedValues(result);
|
|
5346
5349
|
stepResults[stepId] = formattedResult;
|
|
5347
5350
|
}
|
|
5348
5351
|
});
|
|
@@ -5816,7 +5819,7 @@ async function executeLoop(engine, params) {
|
|
|
5816
5819
|
const evalSpan = loopSpan?.createChildSpan({
|
|
5817
5820
|
type: "workflow_conditional_eval" /* WORKFLOW_CONDITIONAL_EVAL */,
|
|
5818
5821
|
name: `condition: '${entry.loopType}'`,
|
|
5819
|
-
input:
|
|
5822
|
+
input: chunkAQ22JIR7_cjs.selectFields(result.output, ["stepResult", "output.text", "output.object", "messages"]),
|
|
5820
5823
|
attributes: {
|
|
5821
5824
|
conditionIndex: iteration
|
|
5822
5825
|
},
|
|
@@ -6897,7 +6900,7 @@ async function executeStep(engine, params) {
|
|
|
6897
6900
|
runId,
|
|
6898
6901
|
resourceId,
|
|
6899
6902
|
workflowId,
|
|
6900
|
-
mastra: engine.mastra ?
|
|
6903
|
+
mastra: engine.mastra ? chunkZSZOYPSJ_cjs.wrapMastra(engine.mastra, { currentSpan: stepSpan }) : void 0,
|
|
6901
6904
|
requestContext,
|
|
6902
6905
|
inputData,
|
|
6903
6906
|
state: executionContext.state,
|
|
@@ -7809,7 +7812,7 @@ function createStep(params, agentOptions) {
|
|
|
7809
7812
|
component: params.component
|
|
7810
7813
|
};
|
|
7811
7814
|
}
|
|
7812
|
-
if (params instanceof
|
|
7815
|
+
if (params instanceof chunk6YUHA5UH_cjs.Tool) {
|
|
7813
7816
|
if (!params.inputSchema || !params.outputSchema) {
|
|
7814
7817
|
throw new Error("Tool must have input and output schemas defined");
|
|
7815
7818
|
}
|
|
@@ -8217,7 +8220,7 @@ function cloneStep(step, opts) {
|
|
|
8217
8220
|
};
|
|
8218
8221
|
}
|
|
8219
8222
|
function isProcessor(obj) {
|
|
8220
|
-
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof Agent) && !(obj instanceof
|
|
8223
|
+
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof Agent) && !(obj instanceof chunk6YUHA5UH_cjs.Tool) && (typeof obj.processInput === "function" || typeof obj.processInputStep === "function" || typeof obj.processOutputStream === "function" || typeof obj.processOutputResult === "function" || typeof obj.processOutputStep === "function");
|
|
8221
8224
|
}
|
|
8222
8225
|
function createWorkflow(params) {
|
|
8223
8226
|
return new Workflow(params);
|
|
@@ -9220,7 +9223,7 @@ var Run = class {
|
|
|
9220
9223
|
outputOptions,
|
|
9221
9224
|
perStep
|
|
9222
9225
|
}) {
|
|
9223
|
-
const workflowSpan =
|
|
9226
|
+
const workflowSpan = chunkZSZOYPSJ_cjs.getOrCreateSpan({
|
|
9224
9227
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
9225
9228
|
name: `workflow run: '${this.workflowId}'`,
|
|
9226
9229
|
entityType: "workflow_run" /* WORKFLOW_RUN */,
|
|
@@ -9281,7 +9284,7 @@ var Run = class {
|
|
|
9281
9284
|
*/
|
|
9282
9285
|
async startAsync(args) {
|
|
9283
9286
|
this._start(args).catch((err) => {
|
|
9284
|
-
|
|
9287
|
+
this.mastra?.getLogger()?.error(`[Workflow ${this.workflowId}] Background execution failed:`, err);
|
|
9285
9288
|
});
|
|
9286
9289
|
return { runId: this.runId };
|
|
9287
9290
|
}
|
|
@@ -9330,7 +9333,7 @@ var Run = class {
|
|
|
9330
9333
|
try {
|
|
9331
9334
|
await writer.close();
|
|
9332
9335
|
} catch (err) {
|
|
9333
|
-
|
|
9336
|
+
this.mastra?.getLogger()?.error("Error closing stream:", err);
|
|
9334
9337
|
} finally {
|
|
9335
9338
|
writer.releaseLock();
|
|
9336
9339
|
}
|
|
@@ -9388,7 +9391,7 @@ var Run = class {
|
|
|
9388
9391
|
try {
|
|
9389
9392
|
await writer.close();
|
|
9390
9393
|
} catch (err) {
|
|
9391
|
-
|
|
9394
|
+
this.mastra?.getLogger()?.error("Error closing stream:", err);
|
|
9392
9395
|
} finally {
|
|
9393
9396
|
writer.releaseLock();
|
|
9394
9397
|
}
|
|
@@ -9480,7 +9483,7 @@ var Run = class {
|
|
|
9480
9483
|
controller.close();
|
|
9481
9484
|
}
|
|
9482
9485
|
} catch (err) {
|
|
9483
|
-
|
|
9486
|
+
self.mastra?.getLogger()?.error("Error closing stream:", err);
|
|
9484
9487
|
}
|
|
9485
9488
|
};
|
|
9486
9489
|
const executionResultsPromise = self._start({
|
|
@@ -9601,7 +9604,7 @@ var Run = class {
|
|
|
9601
9604
|
controller.close();
|
|
9602
9605
|
}
|
|
9603
9606
|
} catch (err) {
|
|
9604
|
-
|
|
9607
|
+
self.mastra?.getLogger()?.error("Error closing stream:", err);
|
|
9605
9608
|
}
|
|
9606
9609
|
};
|
|
9607
9610
|
const executionResultsPromise = self._resume({
|
|
@@ -9653,14 +9656,22 @@ var Run = class {
|
|
|
9653
9656
|
const nestedWatchCb = (event) => {
|
|
9654
9657
|
if (event.runId === this.runId) {
|
|
9655
9658
|
const { event: nestedEvent, workflowId } = event.data;
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9659
|
+
if (nestedEvent.type.startsWith("data-") && nestedEvent.data !== void 0) {
|
|
9660
|
+
void this.pubsub.publish(`workflow.events.v2.${this.runId}`, {
|
|
9661
|
+
type: "watch",
|
|
9662
|
+
runId: this.runId,
|
|
9663
|
+
data: nestedEvent
|
|
9664
|
+
});
|
|
9665
|
+
} else {
|
|
9666
|
+
void this.pubsub.publish(`workflow.events.v2.${this.runId}`, {
|
|
9667
|
+
type: "watch",
|
|
9668
|
+
runId: this.runId,
|
|
9669
|
+
data: {
|
|
9670
|
+
...nestedEvent,
|
|
9671
|
+
...nestedEvent.payload?.id ? { payload: { ...nestedEvent.payload, id: `${workflowId}.${nestedEvent.payload.id}` } } : {}
|
|
9672
|
+
}
|
|
9673
|
+
});
|
|
9674
|
+
}
|
|
9664
9675
|
}
|
|
9665
9676
|
};
|
|
9666
9677
|
void this.pubsub.subscribe(`workflow.events.v2.${this.runId}`, wrappedCb);
|
|
@@ -9760,7 +9771,7 @@ var Run = class {
|
|
|
9760
9771
|
requestContextToUse.set(key, value);
|
|
9761
9772
|
}
|
|
9762
9773
|
});
|
|
9763
|
-
const workflowSpan =
|
|
9774
|
+
const workflowSpan = chunkZSZOYPSJ_cjs.getOrCreateSpan({
|
|
9764
9775
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
9765
9776
|
name: `workflow run: '${this.workflowId}'`,
|
|
9766
9777
|
entityType: "workflow_run" /* WORKFLOW_RUN */,
|
|
@@ -9872,7 +9883,7 @@ var Run = class {
|
|
|
9872
9883
|
requestContextToUse.set(key, value);
|
|
9873
9884
|
}
|
|
9874
9885
|
}
|
|
9875
|
-
const workflowSpan =
|
|
9886
|
+
const workflowSpan = chunkZSZOYPSJ_cjs.getOrCreateSpan({
|
|
9876
9887
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
9877
9888
|
name: `workflow run: '${this.workflowId}'`,
|
|
9878
9889
|
entityType: "workflow_run" /* WORKFLOW_RUN */,
|
|
@@ -9966,7 +9977,7 @@ var Run = class {
|
|
|
9966
9977
|
requestContextToUse.set(key, value);
|
|
9967
9978
|
}
|
|
9968
9979
|
}
|
|
9969
|
-
const workflowSpan =
|
|
9980
|
+
const workflowSpan = chunkZSZOYPSJ_cjs.getOrCreateSpan({
|
|
9970
9981
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
9971
9982
|
name: `workflow run: '${this.workflowId}'`,
|
|
9972
9983
|
input: inputData,
|
|
@@ -10045,7 +10056,7 @@ var Run = class {
|
|
|
10045
10056
|
controller.close();
|
|
10046
10057
|
}
|
|
10047
10058
|
} catch (err) {
|
|
10048
|
-
|
|
10059
|
+
self.mastra?.getLogger()?.error("Error closing stream:", err);
|
|
10049
10060
|
}
|
|
10050
10061
|
};
|
|
10051
10062
|
const executionResultsPromise = self._timeTravel({
|
|
@@ -10490,7 +10501,8 @@ async function processOutputStream({
|
|
|
10490
10501
|
options,
|
|
10491
10502
|
controller,
|
|
10492
10503
|
responseFromModel,
|
|
10493
|
-
includeRawChunks
|
|
10504
|
+
includeRawChunks,
|
|
10505
|
+
logger
|
|
10494
10506
|
}) {
|
|
10495
10507
|
for await (const chunk of outputStream._getBaseStream()) {
|
|
10496
10508
|
if (!chunk) {
|
|
@@ -10573,7 +10585,7 @@ async function processOutputStream({
|
|
|
10573
10585
|
abortSignal: options?.abortSignal
|
|
10574
10586
|
});
|
|
10575
10587
|
} catch (error2) {
|
|
10576
|
-
|
|
10588
|
+
logger?.error("Error calling onInputStart", error2);
|
|
10577
10589
|
}
|
|
10578
10590
|
}
|
|
10579
10591
|
if (isControllerOpen(controller)) {
|
|
@@ -10592,7 +10604,7 @@ async function processOutputStream({
|
|
|
10592
10604
|
abortSignal: options?.abortSignal
|
|
10593
10605
|
});
|
|
10594
10606
|
} catch (error2) {
|
|
10595
|
-
|
|
10607
|
+
logger?.error("Error calling onInputDelta", error2);
|
|
10596
10608
|
}
|
|
10597
10609
|
}
|
|
10598
10610
|
if (isControllerOpen(controller)) {
|
|
@@ -10782,7 +10794,7 @@ async function processOutputStream({
|
|
|
10782
10794
|
}
|
|
10783
10795
|
}
|
|
10784
10796
|
}
|
|
10785
|
-
function executeStreamWithFallbackModels(models) {
|
|
10797
|
+
function executeStreamWithFallbackModels(models, logger) {
|
|
10786
10798
|
return async (callback) => {
|
|
10787
10799
|
let index = 0;
|
|
10788
10800
|
let finalResult;
|
|
@@ -10806,7 +10818,7 @@ function executeStreamWithFallbackModels(models) {
|
|
|
10806
10818
|
throw err;
|
|
10807
10819
|
}
|
|
10808
10820
|
attempt++;
|
|
10809
|
-
|
|
10821
|
+
logger?.error(`Error executing model ${modelConfig.model.modelId}, attempt ${attempt}====`, err);
|
|
10810
10822
|
if (attempt > maxRetries) {
|
|
10811
10823
|
break;
|
|
10812
10824
|
}
|
|
@@ -10816,7 +10828,7 @@ function executeStreamWithFallbackModels(models) {
|
|
|
10816
10828
|
}
|
|
10817
10829
|
}
|
|
10818
10830
|
if (typeof finalResult === "undefined") {
|
|
10819
|
-
|
|
10831
|
+
logger?.error("Exhausted all fallback models and reached the maximum number of retries.");
|
|
10820
10832
|
throw new Error("Exhausted all fallback models and reached the maximum number of retries.");
|
|
10821
10833
|
}
|
|
10822
10834
|
return finalResult;
|
|
@@ -10857,11 +10869,15 @@ function createLLMExecutionStep({
|
|
|
10857
10869
|
inputSchema: llmIterationOutputSchema,
|
|
10858
10870
|
outputSchema: llmIterationOutputSchema,
|
|
10859
10871
|
execute: async ({ inputData, bail, tracingContext }) => {
|
|
10872
|
+
modelSpanTracker?.startStep();
|
|
10860
10873
|
let modelResult;
|
|
10861
10874
|
let warnings;
|
|
10862
10875
|
let request;
|
|
10863
10876
|
let rawResponse;
|
|
10864
|
-
const { outputStream, callBail, runState, stepTools } = await executeStreamWithFallbackModels(
|
|
10877
|
+
const { outputStream, callBail, runState, stepTools } = await executeStreamWithFallbackModels(
|
|
10878
|
+
models,
|
|
10879
|
+
logger
|
|
10880
|
+
)(async (modelConfig, isLastModel) => {
|
|
10865
10881
|
const model = modelConfig.model;
|
|
10866
10882
|
const modelHeaders = modelConfig.headers;
|
|
10867
10883
|
if (initialSystemMessages) {
|
|
@@ -10947,7 +10963,7 @@ function createLLMExecutionStep({
|
|
|
10947
10963
|
stepTools: tools
|
|
10948
10964
|
};
|
|
10949
10965
|
}
|
|
10950
|
-
|
|
10966
|
+
logger?.error("Error in processInputStep processors:", error);
|
|
10951
10967
|
throw error;
|
|
10952
10968
|
}
|
|
10953
10969
|
}
|
|
@@ -10989,7 +11005,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
10989
11005
|
}
|
|
10990
11006
|
}
|
|
10991
11007
|
if (isSupportedLanguageModel(currentStep.model)) {
|
|
10992
|
-
modelResult =
|
|
11008
|
+
modelResult = chunkZSZOYPSJ_cjs.executeWithContextSync({
|
|
10993
11009
|
span: modelSpanTracker?.getTracingContext()?.currentSpan,
|
|
10994
11010
|
fn: () => execute({
|
|
10995
11011
|
runId,
|
|
@@ -11073,10 +11089,11 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
11073
11089
|
warnings,
|
|
11074
11090
|
request,
|
|
11075
11091
|
rawResponse
|
|
11076
|
-
}
|
|
11092
|
+
},
|
|
11093
|
+
logger
|
|
11077
11094
|
});
|
|
11078
11095
|
} catch (error) {
|
|
11079
|
-
|
|
11096
|
+
logger?.error("Error in LLM Execution Step", error);
|
|
11080
11097
|
if (providerUtilsV5.isAbortError(error) && options?.abortSignal?.aborted) {
|
|
11081
11098
|
await options?.onAbort?.({
|
|
11082
11099
|
steps: inputData?.output?.steps ?? []
|
|
@@ -11210,7 +11227,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
11210
11227
|
if (error instanceof TripWire) {
|
|
11211
11228
|
processOutputStepTripwire = error;
|
|
11212
11229
|
} else {
|
|
11213
|
-
|
|
11230
|
+
logger?.error("Error in processOutputStep processors:", error);
|
|
11214
11231
|
throw error;
|
|
11215
11232
|
}
|
|
11216
11233
|
}
|
|
@@ -11476,7 +11493,8 @@ function createToolCallStep({
|
|
|
11476
11493
|
runId,
|
|
11477
11494
|
streamState,
|
|
11478
11495
|
modelSpanTracker,
|
|
11479
|
-
_internal
|
|
11496
|
+
_internal,
|
|
11497
|
+
logger
|
|
11480
11498
|
}) {
|
|
11481
11499
|
return createStep({
|
|
11482
11500
|
id: "toolCallStep",
|
|
@@ -11543,7 +11561,7 @@ function createToolCallStep({
|
|
|
11543
11561
|
try {
|
|
11544
11562
|
await saveQueueManager.flushMessages(messageList, threadId, memoryConfig);
|
|
11545
11563
|
} catch (error) {
|
|
11546
|
-
|
|
11564
|
+
logger?.error("Error removing tool suspension metadata:", error);
|
|
11547
11565
|
}
|
|
11548
11566
|
}
|
|
11549
11567
|
}
|
|
@@ -11567,7 +11585,7 @@ function createToolCallStep({
|
|
|
11567
11585
|
}
|
|
11568
11586
|
await saveQueueManager.flushMessages(messageList, threadId, memoryConfig);
|
|
11569
11587
|
} catch (error) {
|
|
11570
|
-
|
|
11588
|
+
logger?.error("Error flushing messages before suspension:", error);
|
|
11571
11589
|
}
|
|
11572
11590
|
};
|
|
11573
11591
|
if (inputData.providerExecuted) {
|
|
@@ -11588,7 +11606,7 @@ function createToolCallStep({
|
|
|
11588
11606
|
abortSignal: options?.abortSignal
|
|
11589
11607
|
});
|
|
11590
11608
|
} catch (error) {
|
|
11591
|
-
|
|
11609
|
+
logger?.error("Error calling onInputAvailable", error);
|
|
11592
11610
|
}
|
|
11593
11611
|
}
|
|
11594
11612
|
if (!tool2.execute) {
|
|
@@ -11611,7 +11629,7 @@ function createToolCallStep({
|
|
|
11611
11629
|
const needsApprovalResult = await tool2.needsApprovalFn(args);
|
|
11612
11630
|
toolRequiresApproval = needsApprovalResult;
|
|
11613
11631
|
} catch (error) {
|
|
11614
|
-
|
|
11632
|
+
logger?.error(`Error evaluating needsApprovalFn for tool ${inputData.toolName}:`, error);
|
|
11615
11633
|
toolRequiresApproval = true;
|
|
11616
11634
|
}
|
|
11617
11635
|
}
|
|
@@ -11716,7 +11734,7 @@ function createToolCallStep({
|
|
|
11716
11734
|
abortSignal: options?.abortSignal
|
|
11717
11735
|
});
|
|
11718
11736
|
} catch (error) {
|
|
11719
|
-
|
|
11737
|
+
logger?.error("Error calling onOutput", error);
|
|
11720
11738
|
}
|
|
11721
11739
|
}
|
|
11722
11740
|
return { result, ...inputData };
|
|
@@ -12408,7 +12426,7 @@ var MastraLLMVNext = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
12408
12426
|
const remainingTokens = parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"] ?? "", 10);
|
|
12409
12427
|
if (!isNaN(remainingTokens) && remainingTokens > 0 && remainingTokens < 2e3) {
|
|
12410
12428
|
this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
|
|
12411
|
-
await
|
|
12429
|
+
await chunkAQ22JIR7_cjs.delay(10 * 1e3);
|
|
12412
12430
|
}
|
|
12413
12431
|
},
|
|
12414
12432
|
onFinish: async (props) => {
|
|
@@ -13618,7 +13636,7 @@ var AgentLegacyHandler = class {
|
|
|
13618
13636
|
if (process.env.NODE_ENV !== "test") {
|
|
13619
13637
|
this.capabilities.logger.debug(`[Agents:${this.capabilities.name}] - Starting generation`, { runId });
|
|
13620
13638
|
}
|
|
13621
|
-
const agentSpan =
|
|
13639
|
+
const agentSpan = chunkZSZOYPSJ_cjs.getOrCreateSpan({
|
|
13622
13640
|
type: "agent_run" /* AGENT_RUN */,
|
|
13623
13641
|
name: `agent run: '${this.capabilities.id}'`,
|
|
13624
13642
|
entityType: "agent" /* AGENT */,
|
|
@@ -14690,7 +14708,10 @@ function createMapResultsStep({
|
|
|
14690
14708
|
requestContext: result.requestContext
|
|
14691
14709
|
}) : capabilities.outputProcessors : []);
|
|
14692
14710
|
if (options.structuredOutput?.model) {
|
|
14693
|
-
const structuredProcessor = new StructuredOutputProcessor(
|
|
14711
|
+
const structuredProcessor = new StructuredOutputProcessor({
|
|
14712
|
+
...options.structuredOutput,
|
|
14713
|
+
logger: capabilities.logger
|
|
14714
|
+
});
|
|
14694
14715
|
effectiveOutputProcessors = effectiveOutputProcessors ? [...effectiveOutputProcessors, structuredProcessor] : [structuredProcessor];
|
|
14695
14716
|
}
|
|
14696
14717
|
const effectiveInputProcessors = options.inputProcessors || (capabilities.inputProcessors ? typeof capabilities.inputProcessors === "function" ? await capabilities.inputProcessors({
|
|
@@ -15796,7 +15817,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
15796
15817
|
*/
|
|
15797
15818
|
listTools({ requestContext = new chunkUVHSM2GU_cjs.RequestContext() } = {}) {
|
|
15798
15819
|
if (typeof this.#tools !== "function") {
|
|
15799
|
-
return
|
|
15820
|
+
return chunkAQ22JIR7_cjs.ensureToolProperties(this.#tools);
|
|
15800
15821
|
}
|
|
15801
15822
|
const result = this.#tools({ requestContext, mastra: this.#mastra });
|
|
15802
15823
|
return resolveMaybePromise(result, (tools) => {
|
|
@@ -15814,7 +15835,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
15814
15835
|
this.logger.error(mastraError.toString());
|
|
15815
15836
|
throw mastraError;
|
|
15816
15837
|
}
|
|
15817
|
-
return
|
|
15838
|
+
return chunkAQ22JIR7_cjs.ensureToolProperties(tools);
|
|
15818
15839
|
});
|
|
15819
15840
|
}
|
|
15820
15841
|
/**
|
|
@@ -15846,7 +15867,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
15846
15867
|
});
|
|
15847
15868
|
});
|
|
15848
15869
|
} else {
|
|
15849
|
-
llm = new
|
|
15870
|
+
llm = new chunk7KL2YFFK_cjs.MastraLLMV1({
|
|
15850
15871
|
model: resolvedModel,
|
|
15851
15872
|
mastra: this.#mastra,
|
|
15852
15873
|
options: { tracingPolicy: this.#options?.tracingPolicy }
|
|
@@ -15871,7 +15892,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
15871
15892
|
*/
|
|
15872
15893
|
async resolveModelConfig(modelConfig, requestContext) {
|
|
15873
15894
|
try {
|
|
15874
|
-
return await
|
|
15895
|
+
return await chunk4KVIXN7K_cjs.resolveModelConfig(modelConfig, requestContext, this.#mastra);
|
|
15875
15896
|
} catch (error) {
|
|
15876
15897
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
15877
15898
|
id: "AGENT_GET_MODEL_MISSING_MODEL_INSTANCE",
|
|
@@ -16218,7 +16239,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
16218
16239
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
16219
16240
|
requireApproval: toolObj.requireApproval
|
|
16220
16241
|
};
|
|
16221
|
-
const convertedToCoreTool =
|
|
16242
|
+
const convertedToCoreTool = chunkAQ22JIR7_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
16222
16243
|
convertedMemoryTools[toolName] = convertedToCoreTool;
|
|
16223
16244
|
}
|
|
16224
16245
|
}
|
|
@@ -16373,7 +16394,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
16373
16394
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
16374
16395
|
requireApproval: tool2.requireApproval
|
|
16375
16396
|
};
|
|
16376
|
-
return [k,
|
|
16397
|
+
return [k, chunkAQ22JIR7_cjs.makeCoreTool(tool2, options, void 0, autoResumeSuspendedTools)];
|
|
16377
16398
|
})
|
|
16378
16399
|
);
|
|
16379
16400
|
const assignedToolEntriesConverted = Object.fromEntries(
|
|
@@ -16423,7 +16444,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
16423
16444
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
16424
16445
|
requireApproval: toolObj.requireApproval
|
|
16425
16446
|
};
|
|
16426
|
-
const convertedToCoreTool =
|
|
16447
|
+
const convertedToCoreTool = chunkAQ22JIR7_cjs.makeCoreTool(toolObj, options, "toolset", autoResumeSuspendedTools);
|
|
16427
16448
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
16428
16449
|
}
|
|
16429
16450
|
}
|
|
@@ -16468,7 +16489,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
16468
16489
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
16469
16490
|
requireApproval: tool2.requireApproval
|
|
16470
16491
|
};
|
|
16471
|
-
const convertedToCoreTool =
|
|
16492
|
+
const convertedToCoreTool = chunkAQ22JIR7_cjs.makeCoreTool(rest, options, "client-tool", autoResumeSuspendedTools);
|
|
16472
16493
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
16473
16494
|
}
|
|
16474
16495
|
}
|
|
@@ -16506,7 +16527,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
16506
16527
|
subAgentResourceId: z8.z.string().describe("The resource ID of the agent").optional()
|
|
16507
16528
|
});
|
|
16508
16529
|
const modelVersion = (await agent.getModel({ requestContext })).specificationVersion;
|
|
16509
|
-
const toolObj =
|
|
16530
|
+
const toolObj = chunk6YUHA5UH_cjs.createTool({
|
|
16510
16531
|
id: `agent-${agentName}`,
|
|
16511
16532
|
description: agent.getDescription() || `Agent: ${agentName}`,
|
|
16512
16533
|
inputSchema: agentInputSchema,
|
|
@@ -16638,7 +16659,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
16638
16659
|
tracingContext,
|
|
16639
16660
|
tracingPolicy: this.#options?.tracingPolicy
|
|
16640
16661
|
};
|
|
16641
|
-
convertedAgentTools[`agent-${agentName}`] =
|
|
16662
|
+
convertedAgentTools[`agent-${agentName}`] = chunkAQ22JIR7_cjs.makeCoreTool(
|
|
16642
16663
|
toolObj,
|
|
16643
16664
|
options,
|
|
16644
16665
|
void 0,
|
|
@@ -16669,7 +16690,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
16669
16690
|
inputData: workflow.inputSchema,
|
|
16670
16691
|
...workflow.stateSchema ? { initialState: workflow.stateSchema } : {}
|
|
16671
16692
|
});
|
|
16672
|
-
const toolObj =
|
|
16693
|
+
const toolObj = chunk6YUHA5UH_cjs.createTool({
|
|
16673
16694
|
id: `workflow-${workflowName}`,
|
|
16674
16695
|
description: workflow.description || `Workflow: ${workflowName}`,
|
|
16675
16696
|
inputSchema: extendedInputSchema,
|
|
@@ -16817,7 +16838,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
16817
16838
|
tracingContext,
|
|
16818
16839
|
tracingPolicy: this.#options?.tracingPolicy
|
|
16819
16840
|
};
|
|
16820
|
-
convertedWorkflowTools[`workflow-${workflowName}`] =
|
|
16841
|
+
convertedWorkflowTools[`workflow-${workflowName}`] = chunkAQ22JIR7_cjs.makeCoreTool(
|
|
16821
16842
|
toolObj,
|
|
16822
16843
|
options,
|
|
16823
16844
|
void 0,
|
|
@@ -16847,7 +16868,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
16847
16868
|
let mastraProxy = void 0;
|
|
16848
16869
|
const logger = this.logger;
|
|
16849
16870
|
if (this.#mastra) {
|
|
16850
|
-
mastraProxy =
|
|
16871
|
+
mastraProxy = chunkAQ22JIR7_cjs.createMastraProxy({ mastra: this.#mastra, logger });
|
|
16851
16872
|
}
|
|
16852
16873
|
const assignedTools = await this.listAssignedTools({
|
|
16853
16874
|
runId,
|
|
@@ -17087,7 +17108,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
17087
17108
|
throw mastraError;
|
|
17088
17109
|
}
|
|
17089
17110
|
let headers;
|
|
17090
|
-
if (resolvedModel instanceof
|
|
17111
|
+
if (resolvedModel instanceof chunk4KVIXN7K_cjs.ModelRouterLanguageModel) {
|
|
17091
17112
|
headers = resolvedModel.config?.headers;
|
|
17092
17113
|
}
|
|
17093
17114
|
return [
|
|
@@ -17133,7 +17154,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
17133
17154
|
throw mastraError;
|
|
17134
17155
|
}
|
|
17135
17156
|
let headers;
|
|
17136
|
-
if (model2 instanceof
|
|
17157
|
+
if (model2 instanceof chunk4KVIXN7K_cjs.ModelRouterLanguageModel) {
|
|
17137
17158
|
headers = model2.config?.headers;
|
|
17138
17159
|
}
|
|
17139
17160
|
return {
|
|
@@ -17193,7 +17214,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
17193
17214
|
const targetProvider = structuredOutputModel.provider;
|
|
17194
17215
|
const targetModelId = structuredOutputModel.modelId;
|
|
17195
17216
|
if (targetProvider.includes("openai") || targetModelId.includes("openai")) {
|
|
17196
|
-
if (
|
|
17217
|
+
if (chunkAQ22JIR7_cjs.isZodType(options.structuredOutput.schema) && targetModelId) {
|
|
17197
17218
|
const modelInfo = {
|
|
17198
17219
|
provider: targetProvider,
|
|
17199
17220
|
modelId: targetModelId,
|
|
@@ -17212,7 +17233,7 @@ var Agent = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
17212
17233
|
}
|
|
17213
17234
|
const runId = options.runId || this.#mastra?.generateId() || crypto2.randomUUID();
|
|
17214
17235
|
const instructions = options.instructions || await this.getInstructions({ requestContext });
|
|
17215
|
-
const agentSpan =
|
|
17236
|
+
const agentSpan = chunkZSZOYPSJ_cjs.getOrCreateSpan({
|
|
17216
17237
|
type: "agent_run" /* AGENT_RUN */,
|
|
17217
17238
|
name: `agent run: '${this.id}'`,
|
|
17218
17239
|
entityType: "agent" /* AGENT */,
|
|
@@ -20520,7 +20541,7 @@ https://mastra.ai/en/docs/memory/semantic-recall`
|
|
|
20520
20541
|
);
|
|
20521
20542
|
}
|
|
20522
20543
|
if (typeof config.embedder === "string") {
|
|
20523
|
-
this.embedder = new
|
|
20544
|
+
this.embedder = new chunk4KVIXN7K_cjs.ModelRouterEmbeddingModel(config.embedder);
|
|
20524
20545
|
} else {
|
|
20525
20546
|
this.embedder = config.embedder;
|
|
20526
20547
|
}
|
|
@@ -20556,7 +20577,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
20556
20577
|
}
|
|
20557
20578
|
setEmbedder(embedder) {
|
|
20558
20579
|
if (typeof embedder === "string") {
|
|
20559
|
-
this.embedder = new
|
|
20580
|
+
this.embedder = new chunk4KVIXN7K_cjs.ModelRouterEmbeddingModel(embedder);
|
|
20560
20581
|
} else {
|
|
20561
20582
|
this.embedder = embedder;
|
|
20562
20583
|
}
|
|
@@ -20620,7 +20641,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
20620
20641
|
"The threads.generateTitle option has been moved. Use the top-level generateTitle option instead."
|
|
20621
20642
|
);
|
|
20622
20643
|
}
|
|
20623
|
-
const mergedConfig =
|
|
20644
|
+
const mergedConfig = chunkAQ22JIR7_cjs.deepMerge(this.threadConfig, config || {});
|
|
20624
20645
|
if (typeof config?.workingMemory === "object" && config.workingMemory?.schema && typeof mergedConfig.workingMemory === "object") {
|
|
20625
20646
|
mergedConfig.workingMemory.schema = config.workingMemory.schema;
|
|
20626
20647
|
}
|
|
@@ -20858,7 +20879,7 @@ var MockMemory = class extends MastraMemory {
|
|
|
20858
20879
|
} = {}) {
|
|
20859
20880
|
super({
|
|
20860
20881
|
name: "mock",
|
|
20861
|
-
storage: storage || new
|
|
20882
|
+
storage: storage || new chunkOXV6QFSV_cjs.InMemoryStore(),
|
|
20862
20883
|
options: {
|
|
20863
20884
|
workingMemory: enableWorkingMemory ? { enabled: true, template: workingMemoryTemplate } : void 0,
|
|
20864
20885
|
lastMessages: enableMessageHistory ? 10 : void 0
|
|
@@ -20943,7 +20964,7 @@ var MockMemory = class extends MastraMemory {
|
|
|
20943
20964
|
return {};
|
|
20944
20965
|
}
|
|
20945
20966
|
return {
|
|
20946
|
-
updateWorkingMemory:
|
|
20967
|
+
updateWorkingMemory: chunk6YUHA5UH_cjs.createTool({
|
|
20947
20968
|
id: "update-working-memory",
|
|
20948
20969
|
description: `Update the working memory with new information. Any data not included will be overwritten.`,
|
|
20949
20970
|
inputSchema: z8__default.default.object({ memory: z8__default.default.string() }),
|
|
@@ -21141,5 +21162,5 @@ exports.validateStepInput = validateStepInput;
|
|
|
21141
21162
|
exports.validateStepResumeData = validateStepResumeData;
|
|
21142
21163
|
exports.validateStepStateData = validateStepStateData;
|
|
21143
21164
|
exports.validateStepSuspendData = validateStepSuspendData;
|
|
21144
|
-
//# sourceMappingURL=chunk-
|
|
21145
|
-
//# sourceMappingURL=chunk-
|
|
21165
|
+
//# sourceMappingURL=chunk-5DL6Y7PJ.cjs.map
|
|
21166
|
+
//# sourceMappingURL=chunk-5DL6Y7PJ.cjs.map
|