@mastra/core 0.15.3 → 0.16.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/agent/index.cjs +8 -8
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/agent/input-processor/index.cjs +6 -6
- package/dist/agent/input-processor/index.js +1 -1
- package/dist/{chunk-K6UMYGK5.cjs → chunk-3CJXUAA2.cjs} +2 -2
- package/dist/{chunk-K6UMYGK5.cjs.map → chunk-3CJXUAA2.cjs.map} +1 -1
- package/dist/{chunk-AWES6LTC.cjs → chunk-7NKIBBCV.cjs} +4 -4
- package/dist/{chunk-AWES6LTC.cjs.map → chunk-7NKIBBCV.cjs.map} +1 -1
- package/dist/chunk-ABJOUEVA.cjs +10 -0
- package/dist/chunk-ABJOUEVA.cjs.map +1 -0
- package/dist/{chunk-VZYIKGJ6.cjs → chunk-AHJY7RHO.cjs} +4 -4
- package/dist/{chunk-VZYIKGJ6.cjs.map → chunk-AHJY7RHO.cjs.map} +1 -1
- package/dist/{chunk-AEE54ND4.js → chunk-AJXRKF6P.js} +13 -7
- package/dist/chunk-AJXRKF6P.js.map +1 -0
- package/dist/{chunk-Z637KSJF.cjs → chunk-BHB4PDNV.cjs} +4 -4
- package/dist/{chunk-Z637KSJF.cjs.map → chunk-BHB4PDNV.cjs.map} +1 -1
- package/dist/{chunk-PDODMDSQ.js → chunk-FAGDTY7M.js} +3 -3
- package/dist/{chunk-PDODMDSQ.js.map → chunk-FAGDTY7M.js.map} +1 -1
- package/dist/{chunk-QQO4SF3C.js → chunk-FCNVKNBE.js} +16 -6
- package/dist/chunk-FCNVKNBE.js.map +1 -0
- package/dist/{chunk-FTAXL6TR.cjs → chunk-FTDWZOPH.cjs} +25 -15
- package/dist/chunk-FTDWZOPH.cjs.map +1 -0
- package/dist/chunk-IHVB4C5U.cjs +4 -0
- package/dist/{chunk-X4RMXTXF.cjs.map → chunk-IHVB4C5U.cjs.map} +1 -1
- package/dist/{chunk-ZHFYYSVY.cjs → chunk-JBCB54LR.cjs} +17 -11
- package/dist/chunk-JBCB54LR.cjs.map +1 -0
- package/dist/{chunk-YGW2WEJ5.js → chunk-JTU7FZ5O.js} +2 -2
- package/dist/{chunk-YGW2WEJ5.js.map → chunk-JTU7FZ5O.js.map} +1 -1
- package/dist/{chunk-EZCMCWSC.cjs → chunk-KPEYRIL4.cjs} +130 -60
- package/dist/chunk-KPEYRIL4.cjs.map +1 -0
- package/dist/chunk-NLNKQD2T.js +7 -0
- package/dist/chunk-NLNKQD2T.js.map +1 -0
- package/dist/{chunk-65ZPZGFH.cjs → chunk-OX7VSHIN.cjs} +4 -4
- package/dist/{chunk-65ZPZGFH.cjs.map → chunk-OX7VSHIN.cjs.map} +1 -1
- package/dist/{chunk-4VU6A5XE.js → chunk-QQIBOVFQ.js} +3 -3
- package/dist/{chunk-4VU6A5XE.js.map → chunk-QQIBOVFQ.js.map} +1 -1
- package/dist/{chunk-AVPW677Z.js → chunk-RRBS3FVU.js} +116 -46
- package/dist/chunk-RRBS3FVU.js.map +1 -0
- package/dist/chunk-S43VACTO.js +3 -0
- package/dist/{chunk-GXSERFAG.js.map → chunk-S43VACTO.js.map} +1 -1
- package/dist/{chunk-R7K2QO7M.js → chunk-TLJPVRO5.js} +4 -4
- package/dist/{chunk-R7K2QO7M.js.map → chunk-TLJPVRO5.js.map} +1 -1
- package/dist/chunk-UM2UEDFU.js +665 -0
- package/dist/chunk-UM2UEDFU.js.map +1 -0
- package/dist/chunk-XDSZO4OG.cjs +673 -0
- package/dist/chunk-XDSZO4OG.cjs.map +1 -0
- package/dist/{chunk-VZS4UVKF.js → chunk-YFAHGS45.js} +3 -3
- package/dist/{chunk-VZS4UVKF.js.map → chunk-YFAHGS45.js.map} +1 -1
- package/dist/index.cjs +31 -31
- package/dist/index.js +8 -8
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +1 -1
- package/dist/loop/workflow/llm-execution.d.ts +4 -4
- package/dist/loop/workflow/outer-llm-step.d.ts +2 -2
- package/dist/loop/workflow/schema.d.ts +2 -2
- package/dist/mastra/hooks.d.ts +3 -1
- package/dist/mastra/hooks.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/network/index.cjs +2 -2
- package/dist/network/index.js +1 -1
- package/dist/network/vNext/index.cjs +15 -15
- package/dist/network/vNext/index.js +2 -2
- package/dist/processors/index.cjs +8 -8
- package/dist/processors/index.js +2 -2
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.js +1 -1
- package/dist/scores/hooks.d.ts +3 -1
- package/dist/scores/hooks.d.ts.map +1 -1
- package/dist/scores/index.cjs +29 -638
- package/dist/scores/index.cjs.map +1 -1
- package/dist/scores/index.js +1 -636
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/types.d.ts +80 -0
- package/dist/scores/types.d.ts.map +1 -1
- package/dist/server/index.cjs +2 -2
- package/dist/server/index.js +1 -1
- package/dist/storage/base.d.ts +2 -2
- package/dist/storage/base.d.ts.map +1 -1
- package/dist/storage/domains/memory/inmemory.d.ts.map +1 -1
- package/dist/storage/index.cjs +8 -6
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.js +4 -2
- package/dist/storage/index.js.map +1 -1
- package/dist/stream/base/output.d.ts.map +1 -1
- package/dist/stream/index.cjs +3 -3
- package/dist/stream/index.js +1 -1
- package/dist/telemetry/index.cjs +7 -7
- package/dist/telemetry/index.js +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/ui-types.d.ts +39 -0
- package/dist/tools/ui-types.d.ts.map +1 -0
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.js +1 -1
- package/dist/voice/index.cjs +4 -4
- package/dist/voice/index.js +1 -1
- package/dist/workflows/constants.cjs +6 -2
- package/dist/workflows/constants.d.ts +1 -0
- package/dist/workflows/constants.d.ts.map +1 -1
- package/dist/workflows/constants.js +1 -1
- package/dist/workflows/default.d.ts +6 -3
- package/dist/workflows/default.d.ts.map +1 -1
- package/dist/workflows/evented/execution-engine.d.ts +1 -0
- package/dist/workflows/evented/execution-engine.d.ts.map +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/evented/step-executor.d.ts.map +1 -1
- package/dist/workflows/execution-engine.d.ts +1 -0
- package/dist/workflows/execution-engine.d.ts.map +1 -1
- package/dist/workflows/index.cjs +10 -10
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/legacy/index.cjs +22 -22
- package/dist/workflows/legacy/index.js +1 -1
- package/dist/workflows/step.d.ts +2 -1
- package/dist/workflows/step.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +13 -1
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/workflow.d.ts +9 -1
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-AEE54ND4.js.map +0 -1
- package/dist/chunk-AVPW677Z.js.map +0 -1
- package/dist/chunk-EZCMCWSC.cjs.map +0 -1
- package/dist/chunk-FTAXL6TR.cjs.map +0 -1
- package/dist/chunk-GK5V7YTQ.js +0 -6
- package/dist/chunk-GK5V7YTQ.js.map +0 -1
- package/dist/chunk-GXSERFAG.js +0 -3
- package/dist/chunk-NFXTYMWZ.cjs +0 -8
- package/dist/chunk-NFXTYMWZ.cjs.map +0 -1
- package/dist/chunk-QQO4SF3C.js.map +0 -1
- package/dist/chunk-X4RMXTXF.cjs +0 -4
- package/dist/chunk-ZHFYYSVY.cjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkAHJY7RHO_cjs = require('./chunk-AHJY7RHO.cjs');
|
|
4
|
+
var chunkABJOUEVA_cjs = require('./chunk-ABJOUEVA.cjs');
|
|
5
|
+
var chunkBHB4PDNV_cjs = require('./chunk-BHB4PDNV.cjs');
|
|
6
6
|
var chunkMNDKBEEQ_cjs = require('./chunk-MNDKBEEQ.cjs');
|
|
7
7
|
var chunkSIKEQ32R_cjs = require('./chunk-SIKEQ32R.cjs');
|
|
8
8
|
var chunkTSNDVBUU_cjs = require('./chunk-TSNDVBUU.cjs');
|
|
@@ -2226,7 +2226,7 @@ var MastraModelOutput = class extends chunkKXCUCBEI_cjs.MastraBase {
|
|
|
2226
2226
|
chunk.payload.output.usage = self.#usageCount;
|
|
2227
2227
|
try {
|
|
2228
2228
|
if (self.processorRunner) {
|
|
2229
|
-
await self.processorRunner.runOutputProcessors(self.messageList);
|
|
2229
|
+
self.messageList = await self.processorRunner.runOutputProcessors(self.messageList);
|
|
2230
2230
|
const outputText = self.messageList.get.response.aiV4.core().map(m => chunkSIKEQ32R_cjs.MessageList.coreContentToString(m.content)).join("\n");
|
|
2231
2231
|
const messages = self.messageList.get.response.v2();
|
|
2232
2232
|
const messagesWithStructuredData = messages.filter(msg => msg.content.metadata && msg.content.metadata.structuredOutput);
|
|
@@ -2238,6 +2238,17 @@ var MastraModelOutput = class extends chunkKXCUCBEI_cjs.MastraBase {
|
|
|
2238
2238
|
}
|
|
2239
2239
|
self.#delayedPromises.text.resolve(outputText);
|
|
2240
2240
|
self.#delayedPromises.finishReason.resolve(self.#finishReason);
|
|
2241
|
+
if (chunk.payload.metadata) {
|
|
2242
|
+
const {
|
|
2243
|
+
providerMetadata,
|
|
2244
|
+
request,
|
|
2245
|
+
...otherMetadata
|
|
2246
|
+
} = chunk.payload.metadata;
|
|
2247
|
+
response = {
|
|
2248
|
+
...otherMetadata,
|
|
2249
|
+
messages: messageList.get.response.aiV5.model()
|
|
2250
|
+
};
|
|
2251
|
+
}
|
|
2241
2252
|
} else {
|
|
2242
2253
|
self.#delayedPromises.text.resolve(self.#bufferedText.join(""));
|
|
2243
2254
|
self.#delayedPromises.finishReason.resolve(self.#finishReason);
|
|
@@ -4449,7 +4460,8 @@ function runScorer({
|
|
|
4449
4460
|
source,
|
|
4450
4461
|
entityType,
|
|
4451
4462
|
threadId,
|
|
4452
|
-
resourceId
|
|
4463
|
+
resourceId,
|
|
4464
|
+
tracingContext
|
|
4453
4465
|
}) {
|
|
4454
4466
|
let shouldExecute = false;
|
|
4455
4467
|
if (!scorerObject?.sampling || scorerObject?.sampling?.type === "none") {
|
|
@@ -4482,7 +4494,8 @@ function runScorer({
|
|
|
4482
4494
|
structuredOutput,
|
|
4483
4495
|
entityType,
|
|
4484
4496
|
threadId,
|
|
4485
|
-
resourceId
|
|
4497
|
+
resourceId,
|
|
4498
|
+
tracingContext
|
|
4486
4499
|
};
|
|
4487
4500
|
chunkTSNDVBUU_cjs.executeHook("onScorerRun" /* ON_SCORER_RUN */, payload);
|
|
4488
4501
|
}
|
|
@@ -8900,7 +8913,7 @@ function resolveThreadIdFromArgs(args) {
|
|
|
8900
8913
|
return void 0;
|
|
8901
8914
|
}
|
|
8902
8915
|
var _Agent_decorators, _init, _a;
|
|
8903
|
-
_Agent_decorators = [
|
|
8916
|
+
_Agent_decorators = [chunkBHB4PDNV_cjs.InstrumentClass({
|
|
8904
8917
|
prefix: "agent",
|
|
8905
8918
|
excludeMethods: ["hasOwnMemory", "getMemory", "__primitive", "__registerMastra", "__registerPrimitives", "__runInputProcessors", "__runOutputProcessors", "_wrapToolsWithAITracing", "getProcessorRunner", "__setTools", "__setLogger", "__setTelemetry", "log", "getModel", "getInstructions", "getTools", "getLLM", "getWorkflows", "getDefaultGenerateOptions", "getDefaultStreamOptions", "getDescription", "getScorers", "getVoice"]
|
|
8906
8919
|
})];
|
|
@@ -8978,7 +8991,7 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
|
|
|
8978
8991
|
this.#voice?.addInstructions(config.instructions);
|
|
8979
8992
|
}
|
|
8980
8993
|
} else {
|
|
8981
|
-
this.#voice = new
|
|
8994
|
+
this.#voice = new chunkAHJY7RHO_cjs.DefaultVoice();
|
|
8982
8995
|
}
|
|
8983
8996
|
if (config.inputProcessors) {
|
|
8984
8997
|
this.#inputProcessors = config.inputProcessors;
|
|
@@ -9128,7 +9141,7 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
|
|
|
9128
9141
|
}));
|
|
9129
9142
|
return voice;
|
|
9130
9143
|
} else {
|
|
9131
|
-
return new
|
|
9144
|
+
return new chunkAHJY7RHO_cjs.DefaultVoice();
|
|
9132
9145
|
}
|
|
9133
9146
|
}
|
|
9134
9147
|
get instructions() {
|
|
@@ -9924,7 +9937,8 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
|
|
|
9924
9937
|
resourceId,
|
|
9925
9938
|
runtimeContext,
|
|
9926
9939
|
methodType,
|
|
9927
|
-
tracingContext
|
|
9940
|
+
tracingContext,
|
|
9941
|
+
format
|
|
9928
9942
|
}) {
|
|
9929
9943
|
const convertedWorkflowTools = {};
|
|
9930
9944
|
const workflows = await this.getWorkflows({
|
|
@@ -9988,8 +10002,8 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
|
|
|
9988
10002
|
} else if (methodType === "streamVNext") {
|
|
9989
10003
|
const streamResult = run.streamVNext({
|
|
9990
10004
|
inputData: context,
|
|
9991
|
-
runtimeContext
|
|
9992
|
-
|
|
10005
|
+
runtimeContext,
|
|
10006
|
+
format
|
|
9993
10007
|
});
|
|
9994
10008
|
if (writer) {
|
|
9995
10009
|
await streamResult.pipeTo(writer);
|
|
@@ -9999,7 +10013,10 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
|
|
|
9999
10013
|
toolAISpan?.end({
|
|
10000
10014
|
output: result
|
|
10001
10015
|
});
|
|
10002
|
-
return
|
|
10016
|
+
return {
|
|
10017
|
+
result,
|
|
10018
|
+
runId: run.runId
|
|
10019
|
+
};
|
|
10003
10020
|
} catch (err) {
|
|
10004
10021
|
const mastraError = new chunkC73WLCY3_cjs.MastraError({
|
|
10005
10022
|
id: "AGENT_WORKFLOW_TOOL_EXECUTION_FAILED",
|
|
@@ -10591,7 +10608,10 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
|
|
|
10591
10608
|
structuredOutput,
|
|
10592
10609
|
overrideScorers,
|
|
10593
10610
|
threadId,
|
|
10594
|
-
resourceId
|
|
10611
|
+
resourceId,
|
|
10612
|
+
tracingContext: {
|
|
10613
|
+
currentSpan: agentAISpan
|
|
10614
|
+
}
|
|
10595
10615
|
});
|
|
10596
10616
|
const scoringData = {
|
|
10597
10617
|
input: {
|
|
@@ -10628,7 +10648,8 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
|
|
|
10628
10648
|
structuredOutput,
|
|
10629
10649
|
overrideScorers,
|
|
10630
10650
|
threadId,
|
|
10631
|
-
resourceId
|
|
10651
|
+
resourceId,
|
|
10652
|
+
tracingContext
|
|
10632
10653
|
}) {
|
|
10633
10654
|
const agentName = this.name;
|
|
10634
10655
|
const userInputMessages = messageList.get.all.ui().filter(m => m.role === "user");
|
|
@@ -10679,7 +10700,8 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
|
|
|
10679
10700
|
entityType: "AGENT",
|
|
10680
10701
|
structuredOutput: !!structuredOutput,
|
|
10681
10702
|
threadId,
|
|
10682
|
-
resourceId
|
|
10703
|
+
resourceId,
|
|
10704
|
+
tracingContext
|
|
10683
10705
|
});
|
|
10684
10706
|
}
|
|
10685
10707
|
}
|
|
@@ -10752,7 +10774,7 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
|
|
|
10752
10774
|
const llm = await this.getLLM({
|
|
10753
10775
|
runtimeContext
|
|
10754
10776
|
});
|
|
10755
|
-
const activeSpan =
|
|
10777
|
+
const activeSpan = chunkBHB4PDNV_cjs.Telemetry.getActiveSpan();
|
|
10756
10778
|
const baggageEntries = {};
|
|
10757
10779
|
if (threadFromArgs?.id) {
|
|
10758
10780
|
if (activeSpan) {
|
|
@@ -10771,7 +10793,7 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
|
|
|
10771
10793
|
};
|
|
10772
10794
|
}
|
|
10773
10795
|
if (Object.keys(baggageEntries).length > 0) {
|
|
10774
|
-
|
|
10796
|
+
chunkBHB4PDNV_cjs.Telemetry.setBaggage(baggageEntries);
|
|
10775
10797
|
}
|
|
10776
10798
|
const memory = await this.getMemory({
|
|
10777
10799
|
runtimeContext
|
|
@@ -10937,7 +10959,7 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
|
|
|
10937
10959
|
tracingContext: options.tracingContext,
|
|
10938
10960
|
runtimeContext
|
|
10939
10961
|
});
|
|
10940
|
-
const activeSpan =
|
|
10962
|
+
const activeSpan = chunkBHB4PDNV_cjs.Telemetry.getActiveSpan();
|
|
10941
10963
|
const baggageEntries = {};
|
|
10942
10964
|
if (threadFromArgs?.id) {
|
|
10943
10965
|
if (activeSpan) {
|
|
@@ -10956,7 +10978,7 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
|
|
|
10956
10978
|
};
|
|
10957
10979
|
}
|
|
10958
10980
|
if (Object.keys(baggageEntries).length > 0) {
|
|
10959
|
-
|
|
10981
|
+
chunkBHB4PDNV_cjs.Telemetry.setBaggage(baggageEntries);
|
|
10960
10982
|
}
|
|
10961
10983
|
const memory = await this.getMemory({
|
|
10962
10984
|
runtimeContext
|
|
@@ -11564,7 +11586,8 @@ the following messages are from ${ymd}
|
|
|
11564
11586
|
instructions,
|
|
11565
11587
|
runtimeContext,
|
|
11566
11588
|
structuredOutput,
|
|
11567
|
-
overrideScorers
|
|
11589
|
+
overrideScorers,
|
|
11590
|
+
tracingContext
|
|
11568
11591
|
});
|
|
11569
11592
|
}
|
|
11570
11593
|
async generateVNext(messages, options) {
|
|
@@ -12529,7 +12552,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
12529
12552
|
attempts,
|
|
12530
12553
|
delay: delay2
|
|
12531
12554
|
},
|
|
12532
|
-
executionSpan
|
|
12555
|
+
executionSpan,
|
|
12556
|
+
format: params.format
|
|
12533
12557
|
},
|
|
12534
12558
|
tracingContext: {
|
|
12535
12559
|
currentSpan: workflowAISpan
|
|
@@ -12665,6 +12689,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
12665
12689
|
emitter,
|
|
12666
12690
|
abortController,
|
|
12667
12691
|
runtimeContext,
|
|
12692
|
+
executionContext,
|
|
12668
12693
|
writableStream,
|
|
12669
12694
|
tracingContext
|
|
12670
12695
|
}) {
|
|
@@ -12709,7 +12734,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
12709
12734
|
abort: () => {
|
|
12710
12735
|
abortController?.abort();
|
|
12711
12736
|
},
|
|
12712
|
-
[
|
|
12737
|
+
[chunkABJOUEVA_cjs.EMITTER_SYMBOL]: emitter,
|
|
12738
|
+
[chunkABJOUEVA_cjs.STREAM_FORMAT_SYMBOL]: executionContext.format,
|
|
12713
12739
|
engine: {},
|
|
12714
12740
|
abortSignal: abortController?.signal,
|
|
12715
12741
|
writer: new chunkS6MAHT7F_cjs.ToolStream({
|
|
@@ -12743,6 +12769,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
12743
12769
|
emitter,
|
|
12744
12770
|
abortController,
|
|
12745
12771
|
runtimeContext,
|
|
12772
|
+
executionContext,
|
|
12746
12773
|
writableStream,
|
|
12747
12774
|
tracingContext
|
|
12748
12775
|
}) {
|
|
@@ -12788,7 +12815,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
12788
12815
|
abort: () => {
|
|
12789
12816
|
abortController?.abort();
|
|
12790
12817
|
},
|
|
12791
|
-
[
|
|
12818
|
+
[chunkABJOUEVA_cjs.EMITTER_SYMBOL]: emitter,
|
|
12819
|
+
[chunkABJOUEVA_cjs.STREAM_FORMAT_SYMBOL]: executionContext.format,
|
|
12792
12820
|
engine: {},
|
|
12793
12821
|
abortSignal: abortController?.signal,
|
|
12794
12822
|
writer: new chunkS6MAHT7F_cjs.ToolStream({
|
|
@@ -13019,7 +13047,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
13019
13047
|
// @ts-ignore
|
|
13020
13048
|
runId: stepResults[step.id]?.suspendPayload?.__workflow_meta?.runId
|
|
13021
13049
|
} : void 0,
|
|
13022
|
-
[
|
|
13050
|
+
[chunkABJOUEVA_cjs.EMITTER_SYMBOL]: emitter,
|
|
13051
|
+
[chunkABJOUEVA_cjs.STREAM_FORMAT_SYMBOL]: executionContext.format,
|
|
13023
13052
|
engine: {},
|
|
13024
13053
|
abortSignal: abortController?.signal,
|
|
13025
13054
|
writer: new chunkS6MAHT7F_cjs.ToolStream({
|
|
@@ -13040,7 +13069,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
13040
13069
|
workflowId,
|
|
13041
13070
|
stepId: step.id,
|
|
13042
13071
|
runtimeContext,
|
|
13043
|
-
disableScorers
|
|
13072
|
+
disableScorers,
|
|
13073
|
+
tracingContext
|
|
13044
13074
|
});
|
|
13045
13075
|
}
|
|
13046
13076
|
if (suspended) {
|
|
@@ -13160,7 +13190,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
13160
13190
|
workflowId,
|
|
13161
13191
|
stepId,
|
|
13162
13192
|
runtimeContext,
|
|
13163
|
-
disableScorers
|
|
13193
|
+
disableScorers,
|
|
13194
|
+
tracingContext
|
|
13164
13195
|
}) {
|
|
13165
13196
|
let scorersToUse = scorers;
|
|
13166
13197
|
if (typeof scorersToUse === "function") {
|
|
@@ -13196,7 +13227,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
13196
13227
|
},
|
|
13197
13228
|
structuredOutput: true,
|
|
13198
13229
|
source: "LIVE",
|
|
13199
|
-
entityType: "WORKFLOW"
|
|
13230
|
+
entityType: "WORKFLOW",
|
|
13231
|
+
tracingContext
|
|
13200
13232
|
});
|
|
13201
13233
|
}
|
|
13202
13234
|
}
|
|
@@ -13353,7 +13385,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
13353
13385
|
abort: () => {
|
|
13354
13386
|
abortController?.abort();
|
|
13355
13387
|
},
|
|
13356
|
-
[
|
|
13388
|
+
[chunkABJOUEVA_cjs.EMITTER_SYMBOL]: emitter,
|
|
13389
|
+
[chunkABJOUEVA_cjs.STREAM_FORMAT_SYMBOL]: executionContext.format,
|
|
13357
13390
|
engine: {},
|
|
13358
13391
|
abortSignal: abortController?.signal,
|
|
13359
13392
|
writer: new chunkS6MAHT7F_cjs.ToolStream({
|
|
@@ -13587,7 +13620,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
13587
13620
|
abort: () => {
|
|
13588
13621
|
abortController?.abort();
|
|
13589
13622
|
},
|
|
13590
|
-
[
|
|
13623
|
+
[chunkABJOUEVA_cjs.EMITTER_SYMBOL]: emitter,
|
|
13624
|
+
[chunkABJOUEVA_cjs.STREAM_FORMAT_SYMBOL]: executionContext.format,
|
|
13591
13625
|
engine: {},
|
|
13592
13626
|
abortSignal: abortController?.signal,
|
|
13593
13627
|
writer: new chunkS6MAHT7F_cjs.ToolStream({
|
|
@@ -14454,7 +14488,8 @@ function createStep(params) {
|
|
|
14454
14488
|
}),
|
|
14455
14489
|
execute: async ({
|
|
14456
14490
|
inputData,
|
|
14457
|
-
[
|
|
14491
|
+
[chunkABJOUEVA_cjs.EMITTER_SYMBOL]: emitter,
|
|
14492
|
+
[chunkABJOUEVA_cjs.STREAM_FORMAT_SYMBOL]: streamFormat,
|
|
14458
14493
|
runtimeContext,
|
|
14459
14494
|
abortSignal,
|
|
14460
14495
|
abort
|
|
@@ -14470,27 +14505,42 @@ function createStep(params) {
|
|
|
14470
14505
|
};
|
|
14471
14506
|
await emitter.emit("watch-v2", {
|
|
14472
14507
|
type: "workflow-agent-call-start",
|
|
14508
|
+
from: "WORKFLOW",
|
|
14473
14509
|
payload: toolData
|
|
14474
14510
|
});
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14511
|
+
let stream;
|
|
14512
|
+
if (streamFormat === "aisdk") {
|
|
14513
|
+
const {
|
|
14514
|
+
fullStream
|
|
14515
|
+
} = await params.stream(inputData.prompt, {
|
|
14516
|
+
// resourceId: inputData.resourceId,
|
|
14517
|
+
// threadId: inputData.threadId,
|
|
14518
|
+
runtimeContext,
|
|
14519
|
+
onFinish: result => {
|
|
14520
|
+
streamPromise.resolve(result.text);
|
|
14521
|
+
},
|
|
14522
|
+
abortSignal
|
|
14523
|
+
});
|
|
14524
|
+
stream = fullStream;
|
|
14525
|
+
} else {
|
|
14526
|
+
const modelOutput = await params.streamVNext(inputData.prompt, {
|
|
14527
|
+
runtimeContext,
|
|
14528
|
+
onFinish: result => {
|
|
14529
|
+
streamPromise.resolve(result.text);
|
|
14530
|
+
}
|
|
14531
|
+
// abortSignal,
|
|
14532
|
+
});
|
|
14533
|
+
stream = modelOutput.fullStream;
|
|
14534
|
+
}
|
|
14486
14535
|
if (abortSignal.aborted) {
|
|
14487
14536
|
return abort();
|
|
14488
14537
|
}
|
|
14489
|
-
for await (const chunk of
|
|
14538
|
+
for await (const chunk of stream) {
|
|
14490
14539
|
await emitter.emit("watch-v2", chunk);
|
|
14491
14540
|
}
|
|
14492
14541
|
await emitter.emit("watch-v2", {
|
|
14493
14542
|
type: "workflow-agent-call-finish",
|
|
14543
|
+
from: "WORKFLOW",
|
|
14494
14544
|
payload: toolData
|
|
14495
14545
|
});
|
|
14496
14546
|
return {
|
|
@@ -15120,7 +15170,7 @@ var Workflow = class extends chunkKXCUCBEI_cjs.MastraBase {
|
|
|
15120
15170
|
resumeData,
|
|
15121
15171
|
suspend,
|
|
15122
15172
|
resume,
|
|
15123
|
-
[
|
|
15173
|
+
[chunkABJOUEVA_cjs.EMITTER_SYMBOL]: emitter,
|
|
15124
15174
|
mastra,
|
|
15125
15175
|
runtimeContext,
|
|
15126
15176
|
abort,
|
|
@@ -15385,16 +15435,12 @@ var Run = class {
|
|
|
15385
15435
|
async sendEvent(event, data) {
|
|
15386
15436
|
this.emitter.emit(`user-event-${event}`, data);
|
|
15387
15437
|
}
|
|
15388
|
-
|
|
15389
|
-
* Starts the workflow execution with the provided input
|
|
15390
|
-
* @param input The input data for the workflow
|
|
15391
|
-
* @returns A promise that resolves to the workflow output
|
|
15392
|
-
*/
|
|
15393
|
-
async start({
|
|
15438
|
+
async _start({
|
|
15394
15439
|
inputData,
|
|
15395
15440
|
runtimeContext,
|
|
15396
15441
|
writableStream,
|
|
15397
|
-
tracingContext
|
|
15442
|
+
tracingContext,
|
|
15443
|
+
format
|
|
15398
15444
|
}) {
|
|
15399
15445
|
const result = await this.executionEngine.execute({
|
|
15400
15446
|
workflowId: this.workflowId,
|
|
@@ -15421,13 +15467,33 @@ var Run = class {
|
|
|
15421
15467
|
runtimeContext: runtimeContext ?? new chunkGPWMM745_cjs.RuntimeContext(),
|
|
15422
15468
|
abortController: this.abortController,
|
|
15423
15469
|
writableStream,
|
|
15424
|
-
tracingContext
|
|
15470
|
+
tracingContext,
|
|
15471
|
+
format
|
|
15425
15472
|
});
|
|
15426
15473
|
if (result.status !== "suspended") {
|
|
15427
15474
|
this.cleanup?.();
|
|
15428
15475
|
}
|
|
15429
15476
|
return result;
|
|
15430
15477
|
}
|
|
15478
|
+
/**
|
|
15479
|
+
* Starts the workflow execution with the provided input
|
|
15480
|
+
* @param input The input data for the workflow
|
|
15481
|
+
* @returns A promise that resolves to the workflow output
|
|
15482
|
+
*/
|
|
15483
|
+
async start({
|
|
15484
|
+
inputData,
|
|
15485
|
+
runtimeContext,
|
|
15486
|
+
writableStream,
|
|
15487
|
+
tracingContext
|
|
15488
|
+
}) {
|
|
15489
|
+
return this._start({
|
|
15490
|
+
inputData,
|
|
15491
|
+
runtimeContext,
|
|
15492
|
+
writableStream,
|
|
15493
|
+
tracingContext,
|
|
15494
|
+
format: "aisdk"
|
|
15495
|
+
});
|
|
15496
|
+
}
|
|
15431
15497
|
/**
|
|
15432
15498
|
* Starts the workflow execution with the provided input as a stream
|
|
15433
15499
|
* @param input The input data for the workflow
|
|
@@ -15497,9 +15563,10 @@ var Run = class {
|
|
|
15497
15563
|
runId: this.runId
|
|
15498
15564
|
}
|
|
15499
15565
|
});
|
|
15500
|
-
this.executionResults = this.
|
|
15566
|
+
this.executionResults = this._start({
|
|
15501
15567
|
inputData,
|
|
15502
|
-
runtimeContext
|
|
15568
|
+
runtimeContext,
|
|
15569
|
+
format: "aisdk"
|
|
15503
15570
|
}).then(result => {
|
|
15504
15571
|
if (result.status !== "suspended") {
|
|
15505
15572
|
this.closeStreamAction?.().catch(() => {});
|
|
@@ -15527,7 +15594,8 @@ var Run = class {
|
|
|
15527
15594
|
*/
|
|
15528
15595
|
streamVNext({
|
|
15529
15596
|
inputData,
|
|
15530
|
-
runtimeContext
|
|
15597
|
+
runtimeContext,
|
|
15598
|
+
format
|
|
15531
15599
|
} = {}) {
|
|
15532
15600
|
this.closeStreamAction = async () => {};
|
|
15533
15601
|
return new MastraWorkflowStream({
|
|
@@ -15563,12 +15631,13 @@ var Run = class {
|
|
|
15563
15631
|
};
|
|
15564
15632
|
const unwatch = this.watch(async ({
|
|
15565
15633
|
type,
|
|
15634
|
+
from = "WORKFLOW" /* WORKFLOW */,
|
|
15566
15635
|
payload
|
|
15567
15636
|
}) => {
|
|
15568
15637
|
buffer.push({
|
|
15569
15638
|
type,
|
|
15570
15639
|
runId: this.runId,
|
|
15571
|
-
from
|
|
15640
|
+
from,
|
|
15572
15641
|
payload: {
|
|
15573
15642
|
stepName: payload.id,
|
|
15574
15643
|
...payload
|
|
@@ -15584,10 +15653,11 @@ var Run = class {
|
|
|
15584
15653
|
console.error("Error closing stream:", err);
|
|
15585
15654
|
}
|
|
15586
15655
|
};
|
|
15587
|
-
const executionResults = this.
|
|
15656
|
+
const executionResults = this._start({
|
|
15588
15657
|
inputData,
|
|
15589
15658
|
runtimeContext,
|
|
15590
|
-
writableStream: writable
|
|
15659
|
+
writableStream: writable,
|
|
15660
|
+
format
|
|
15591
15661
|
}).then(result => {
|
|
15592
15662
|
if (result.status !== "suspended") {
|
|
15593
15663
|
this.closeStreamAction?.().catch(() => {});
|
|
@@ -15869,5 +15939,5 @@ exports.recursivelyCheckForFinalState = recursivelyCheckForFinalState;
|
|
|
15869
15939
|
exports.resolveVariables = resolveVariables;
|
|
15870
15940
|
exports.updateStepInHierarchy = updateStepInHierarchy;
|
|
15871
15941
|
exports.workflowToStep = workflowToStep;
|
|
15872
|
-
//# sourceMappingURL=chunk-
|
|
15873
|
-
//# sourceMappingURL=chunk-
|
|
15942
|
+
//# sourceMappingURL=chunk-KPEYRIL4.cjs.map
|
|
15943
|
+
//# sourceMappingURL=chunk-KPEYRIL4.cjs.map
|