@mastra/core 0.15.3 → 0.16.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -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-2BFCQRWV.cjs +673 -0
- package/dist/chunk-2BFCQRWV.cjs.map +1 -0
- 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-EZCMCWSC.cjs → chunk-7GYN2OE3.cjs} +131 -61
- package/dist/chunk-7GYN2OE3.cjs.map +1 -0
- 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-PDODMDSQ.js → chunk-A5VGUE2H.js} +3 -3
- package/dist/{chunk-PDODMDSQ.js.map → chunk-A5VGUE2H.js.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-Z637KSJF.cjs → chunk-BHB4PDNV.cjs} +4 -4
- package/dist/{chunk-Z637KSJF.cjs.map → chunk-BHB4PDNV.cjs.map} +1 -1
- package/dist/{chunk-AEE54ND4.js → chunk-D2Y5SXZN.js} +13 -7
- package/dist/chunk-D2Y5SXZN.js.map +1 -0
- package/dist/{chunk-65ZPZGFH.cjs → chunk-DRMT4EQA.cjs} +4 -4
- package/dist/{chunk-65ZPZGFH.cjs.map → chunk-DRMT4EQA.cjs.map} +1 -1
- package/dist/chunk-IHVB4C5U.cjs +4 -0
- package/dist/{chunk-X4RMXTXF.cjs.map → chunk-IHVB4C5U.cjs.map} +1 -1
- package/dist/{chunk-QQO4SF3C.js → chunk-JT2QXHUD.js} +16 -6
- package/dist/chunk-JT2QXHUD.js.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-MMYGYTJK.js +665 -0
- package/dist/chunk-MMYGYTJK.js.map +1 -0
- package/dist/chunk-NLNKQD2T.js +7 -0
- package/dist/chunk-NLNKQD2T.js.map +1 -0
- 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-S43VACTO.js +3 -0
- package/dist/{chunk-GXSERFAG.js.map → chunk-S43VACTO.js.map} +1 -1
- package/dist/{chunk-FTAXL6TR.cjs → chunk-SLDGELU7.cjs} +25 -15
- package/dist/chunk-SLDGELU7.cjs.map +1 -0
- 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-ZHFYYSVY.cjs → chunk-YEZD4ZLX.cjs} +17 -11
- package/dist/chunk-YEZD4ZLX.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/{chunk-AVPW677Z.js → chunk-YILDTNQM.js} +117 -47
- package/dist/chunk-YILDTNQM.js.map +1 -0
- 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,6 +1,6 @@
|
|
|
1
|
-
import { DefaultVoice } from './chunk-
|
|
2
|
-
import { EMITTER_SYMBOL } from './chunk-
|
|
3
|
-
import { InstrumentClass, Telemetry } from './chunk-
|
|
1
|
+
import { DefaultVoice } from './chunk-QQIBOVFQ.js';
|
|
2
|
+
import { STREAM_FORMAT_SYMBOL, EMITTER_SYMBOL } from './chunk-NLNKQD2T.js';
|
|
3
|
+
import { InstrumentClass, Telemetry } from './chunk-TLJPVRO5.js';
|
|
4
4
|
import { MastraLLMV1 } from './chunk-HGYL2SSF.js';
|
|
5
5
|
import { MessageList, DefaultGeneratedFile, DefaultGeneratedFileWithType } from './chunk-HF7HXOCC.js';
|
|
6
6
|
import { executeHook } from './chunk-TTELJD4F.js';
|
|
@@ -2200,7 +2200,7 @@ var MastraModelOutput = class extends MastraBase {
|
|
|
2200
2200
|
chunk.payload.output.usage = self.#usageCount;
|
|
2201
2201
|
try {
|
|
2202
2202
|
if (self.processorRunner) {
|
|
2203
|
-
await self.processorRunner.runOutputProcessors(self.messageList);
|
|
2203
|
+
self.messageList = await self.processorRunner.runOutputProcessors(self.messageList);
|
|
2204
2204
|
const outputText = self.messageList.get.response.aiV4.core().map(m => MessageList.coreContentToString(m.content)).join("\n");
|
|
2205
2205
|
const messages = self.messageList.get.response.v2();
|
|
2206
2206
|
const messagesWithStructuredData = messages.filter(msg => msg.content.metadata && msg.content.metadata.structuredOutput);
|
|
@@ -2212,6 +2212,17 @@ var MastraModelOutput = class extends MastraBase {
|
|
|
2212
2212
|
}
|
|
2213
2213
|
self.#delayedPromises.text.resolve(outputText);
|
|
2214
2214
|
self.#delayedPromises.finishReason.resolve(self.#finishReason);
|
|
2215
|
+
if (chunk.payload.metadata) {
|
|
2216
|
+
const {
|
|
2217
|
+
providerMetadata,
|
|
2218
|
+
request,
|
|
2219
|
+
...otherMetadata
|
|
2220
|
+
} = chunk.payload.metadata;
|
|
2221
|
+
response = {
|
|
2222
|
+
...otherMetadata,
|
|
2223
|
+
messages: messageList.get.response.aiV5.model()
|
|
2224
|
+
};
|
|
2225
|
+
}
|
|
2215
2226
|
} else {
|
|
2216
2227
|
self.#delayedPromises.text.resolve(self.#bufferedText.join(""));
|
|
2217
2228
|
self.#delayedPromises.finishReason.resolve(self.#finishReason);
|
|
@@ -4423,7 +4434,8 @@ function runScorer({
|
|
|
4423
4434
|
source,
|
|
4424
4435
|
entityType,
|
|
4425
4436
|
threadId,
|
|
4426
|
-
resourceId
|
|
4437
|
+
resourceId,
|
|
4438
|
+
tracingContext
|
|
4427
4439
|
}) {
|
|
4428
4440
|
let shouldExecute = false;
|
|
4429
4441
|
if (!scorerObject?.sampling || scorerObject?.sampling?.type === "none") {
|
|
@@ -4456,7 +4468,8 @@ function runScorer({
|
|
|
4456
4468
|
structuredOutput,
|
|
4457
4469
|
entityType,
|
|
4458
4470
|
threadId,
|
|
4459
|
-
resourceId
|
|
4471
|
+
resourceId,
|
|
4472
|
+
tracingContext
|
|
4460
4473
|
};
|
|
4461
4474
|
executeHook("onScorerRun" /* ON_SCORER_RUN */, payload);
|
|
4462
4475
|
}
|
|
@@ -9898,7 +9911,8 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
9898
9911
|
resourceId,
|
|
9899
9912
|
runtimeContext,
|
|
9900
9913
|
methodType,
|
|
9901
|
-
tracingContext
|
|
9914
|
+
tracingContext,
|
|
9915
|
+
format
|
|
9902
9916
|
}) {
|
|
9903
9917
|
const convertedWorkflowTools = {};
|
|
9904
9918
|
const workflows = await this.getWorkflows({
|
|
@@ -9962,8 +9976,8 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
9962
9976
|
} else if (methodType === "streamVNext") {
|
|
9963
9977
|
const streamResult = run.streamVNext({
|
|
9964
9978
|
inputData: context,
|
|
9965
|
-
runtimeContext
|
|
9966
|
-
|
|
9979
|
+
runtimeContext,
|
|
9980
|
+
format
|
|
9967
9981
|
});
|
|
9968
9982
|
if (writer) {
|
|
9969
9983
|
await streamResult.pipeTo(writer);
|
|
@@ -9973,7 +9987,10 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
9973
9987
|
toolAISpan?.end({
|
|
9974
9988
|
output: result
|
|
9975
9989
|
});
|
|
9976
|
-
return
|
|
9990
|
+
return {
|
|
9991
|
+
result,
|
|
9992
|
+
runId: run.runId
|
|
9993
|
+
};
|
|
9977
9994
|
} catch (err) {
|
|
9978
9995
|
const mastraError = new MastraError({
|
|
9979
9996
|
id: "AGENT_WORKFLOW_TOOL_EXECUTION_FAILED",
|
|
@@ -10565,7 +10582,10 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
|
|
|
10565
10582
|
structuredOutput,
|
|
10566
10583
|
overrideScorers,
|
|
10567
10584
|
threadId,
|
|
10568
|
-
resourceId
|
|
10585
|
+
resourceId,
|
|
10586
|
+
tracingContext: {
|
|
10587
|
+
currentSpan: agentAISpan
|
|
10588
|
+
}
|
|
10569
10589
|
});
|
|
10570
10590
|
const scoringData = {
|
|
10571
10591
|
input: {
|
|
@@ -10602,7 +10622,8 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
|
|
|
10602
10622
|
structuredOutput,
|
|
10603
10623
|
overrideScorers,
|
|
10604
10624
|
threadId,
|
|
10605
|
-
resourceId
|
|
10625
|
+
resourceId,
|
|
10626
|
+
tracingContext
|
|
10606
10627
|
}) {
|
|
10607
10628
|
const agentName = this.name;
|
|
10608
10629
|
const userInputMessages = messageList.get.all.ui().filter(m => m.role === "user");
|
|
@@ -10653,7 +10674,8 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
|
|
|
10653
10674
|
entityType: "AGENT",
|
|
10654
10675
|
structuredOutput: !!structuredOutput,
|
|
10655
10676
|
threadId,
|
|
10656
|
-
resourceId
|
|
10677
|
+
resourceId,
|
|
10678
|
+
tracingContext
|
|
10657
10679
|
});
|
|
10658
10680
|
}
|
|
10659
10681
|
}
|
|
@@ -11538,7 +11560,8 @@ the following messages are from ${ymd}
|
|
|
11538
11560
|
instructions,
|
|
11539
11561
|
runtimeContext,
|
|
11540
11562
|
structuredOutput,
|
|
11541
|
-
overrideScorers
|
|
11563
|
+
overrideScorers,
|
|
11564
|
+
tracingContext
|
|
11542
11565
|
});
|
|
11543
11566
|
}
|
|
11544
11567
|
async generateVNext(messages, options) {
|
|
@@ -12503,7 +12526,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
12503
12526
|
attempts,
|
|
12504
12527
|
delay: delay2
|
|
12505
12528
|
},
|
|
12506
|
-
executionSpan
|
|
12529
|
+
executionSpan,
|
|
12530
|
+
format: params.format
|
|
12507
12531
|
},
|
|
12508
12532
|
tracingContext: {
|
|
12509
12533
|
currentSpan: workflowAISpan
|
|
@@ -12639,6 +12663,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
12639
12663
|
emitter,
|
|
12640
12664
|
abortController,
|
|
12641
12665
|
runtimeContext,
|
|
12666
|
+
executionContext,
|
|
12642
12667
|
writableStream,
|
|
12643
12668
|
tracingContext
|
|
12644
12669
|
}) {
|
|
@@ -12684,6 +12709,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
12684
12709
|
abortController?.abort();
|
|
12685
12710
|
},
|
|
12686
12711
|
[EMITTER_SYMBOL]: emitter,
|
|
12712
|
+
[STREAM_FORMAT_SYMBOL]: executionContext.format,
|
|
12687
12713
|
engine: {},
|
|
12688
12714
|
abortSignal: abortController?.signal,
|
|
12689
12715
|
writer: new ToolStream({
|
|
@@ -12717,6 +12743,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
12717
12743
|
emitter,
|
|
12718
12744
|
abortController,
|
|
12719
12745
|
runtimeContext,
|
|
12746
|
+
executionContext,
|
|
12720
12747
|
writableStream,
|
|
12721
12748
|
tracingContext
|
|
12722
12749
|
}) {
|
|
@@ -12763,6 +12790,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
12763
12790
|
abortController?.abort();
|
|
12764
12791
|
},
|
|
12765
12792
|
[EMITTER_SYMBOL]: emitter,
|
|
12793
|
+
[STREAM_FORMAT_SYMBOL]: executionContext.format,
|
|
12766
12794
|
engine: {},
|
|
12767
12795
|
abortSignal: abortController?.signal,
|
|
12768
12796
|
writer: new ToolStream({
|
|
@@ -12994,6 +13022,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
12994
13022
|
runId: stepResults[step.id]?.suspendPayload?.__workflow_meta?.runId
|
|
12995
13023
|
} : void 0,
|
|
12996
13024
|
[EMITTER_SYMBOL]: emitter,
|
|
13025
|
+
[STREAM_FORMAT_SYMBOL]: executionContext.format,
|
|
12997
13026
|
engine: {},
|
|
12998
13027
|
abortSignal: abortController?.signal,
|
|
12999
13028
|
writer: new ToolStream({
|
|
@@ -13014,7 +13043,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
13014
13043
|
workflowId,
|
|
13015
13044
|
stepId: step.id,
|
|
13016
13045
|
runtimeContext,
|
|
13017
|
-
disableScorers
|
|
13046
|
+
disableScorers,
|
|
13047
|
+
tracingContext
|
|
13018
13048
|
});
|
|
13019
13049
|
}
|
|
13020
13050
|
if (suspended) {
|
|
@@ -13134,7 +13164,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
13134
13164
|
workflowId,
|
|
13135
13165
|
stepId,
|
|
13136
13166
|
runtimeContext,
|
|
13137
|
-
disableScorers
|
|
13167
|
+
disableScorers,
|
|
13168
|
+
tracingContext
|
|
13138
13169
|
}) {
|
|
13139
13170
|
let scorersToUse = scorers;
|
|
13140
13171
|
if (typeof scorersToUse === "function") {
|
|
@@ -13170,7 +13201,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
13170
13201
|
},
|
|
13171
13202
|
structuredOutput: true,
|
|
13172
13203
|
source: "LIVE",
|
|
13173
|
-
entityType: "WORKFLOW"
|
|
13204
|
+
entityType: "WORKFLOW",
|
|
13205
|
+
tracingContext
|
|
13174
13206
|
});
|
|
13175
13207
|
}
|
|
13176
13208
|
}
|
|
@@ -13328,6 +13360,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
13328
13360
|
abortController?.abort();
|
|
13329
13361
|
},
|
|
13330
13362
|
[EMITTER_SYMBOL]: emitter,
|
|
13363
|
+
[STREAM_FORMAT_SYMBOL]: executionContext.format,
|
|
13331
13364
|
engine: {},
|
|
13332
13365
|
abortSignal: abortController?.signal,
|
|
13333
13366
|
writer: new ToolStream({
|
|
@@ -13562,6 +13595,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
13562
13595
|
abortController?.abort();
|
|
13563
13596
|
},
|
|
13564
13597
|
[EMITTER_SYMBOL]: emitter,
|
|
13598
|
+
[STREAM_FORMAT_SYMBOL]: executionContext.format,
|
|
13565
13599
|
engine: {},
|
|
13566
13600
|
abortSignal: abortController?.signal,
|
|
13567
13601
|
writer: new ToolStream({
|
|
@@ -14429,6 +14463,7 @@ function createStep(params) {
|
|
|
14429
14463
|
execute: async ({
|
|
14430
14464
|
inputData,
|
|
14431
14465
|
[EMITTER_SYMBOL]: emitter,
|
|
14466
|
+
[STREAM_FORMAT_SYMBOL]: streamFormat,
|
|
14432
14467
|
runtimeContext,
|
|
14433
14468
|
abortSignal,
|
|
14434
14469
|
abort
|
|
@@ -14444,27 +14479,42 @@ function createStep(params) {
|
|
|
14444
14479
|
};
|
|
14445
14480
|
await emitter.emit("watch-v2", {
|
|
14446
14481
|
type: "workflow-agent-call-start",
|
|
14482
|
+
from: "WORKFLOW",
|
|
14447
14483
|
payload: toolData
|
|
14448
14484
|
});
|
|
14449
|
-
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14485
|
+
let stream;
|
|
14486
|
+
if (streamFormat === "aisdk") {
|
|
14487
|
+
const {
|
|
14488
|
+
fullStream
|
|
14489
|
+
} = await params.stream(inputData.prompt, {
|
|
14490
|
+
// resourceId: inputData.resourceId,
|
|
14491
|
+
// threadId: inputData.threadId,
|
|
14492
|
+
runtimeContext,
|
|
14493
|
+
onFinish: result => {
|
|
14494
|
+
streamPromise.resolve(result.text);
|
|
14495
|
+
},
|
|
14496
|
+
abortSignal
|
|
14497
|
+
});
|
|
14498
|
+
stream = fullStream;
|
|
14499
|
+
} else {
|
|
14500
|
+
const modelOutput = await params.streamVNext(inputData.prompt, {
|
|
14501
|
+
runtimeContext,
|
|
14502
|
+
onFinish: result => {
|
|
14503
|
+
streamPromise.resolve(result.text);
|
|
14504
|
+
}
|
|
14505
|
+
// abortSignal,
|
|
14506
|
+
});
|
|
14507
|
+
stream = modelOutput.fullStream;
|
|
14508
|
+
}
|
|
14460
14509
|
if (abortSignal.aborted) {
|
|
14461
14510
|
return abort();
|
|
14462
14511
|
}
|
|
14463
|
-
for await (const chunk of
|
|
14512
|
+
for await (const chunk of stream) {
|
|
14464
14513
|
await emitter.emit("watch-v2", chunk);
|
|
14465
14514
|
}
|
|
14466
14515
|
await emitter.emit("watch-v2", {
|
|
14467
14516
|
type: "workflow-agent-call-finish",
|
|
14517
|
+
from: "WORKFLOW",
|
|
14468
14518
|
payload: toolData
|
|
14469
14519
|
});
|
|
14470
14520
|
return {
|
|
@@ -14507,7 +14557,7 @@ function createStep(params) {
|
|
|
14507
14557
|
suspendSchema: params.suspendSchema,
|
|
14508
14558
|
scorers: params.scorers,
|
|
14509
14559
|
retries: params.retries,
|
|
14510
|
-
execute: params.execute
|
|
14560
|
+
execute: params.execute.bind(params)
|
|
14511
14561
|
};
|
|
14512
14562
|
}
|
|
14513
14563
|
function cloneStep(step, opts) {
|
|
@@ -15359,16 +15409,12 @@ var Run = class {
|
|
|
15359
15409
|
async sendEvent(event, data) {
|
|
15360
15410
|
this.emitter.emit(`user-event-${event}`, data);
|
|
15361
15411
|
}
|
|
15362
|
-
|
|
15363
|
-
* Starts the workflow execution with the provided input
|
|
15364
|
-
* @param input The input data for the workflow
|
|
15365
|
-
* @returns A promise that resolves to the workflow output
|
|
15366
|
-
*/
|
|
15367
|
-
async start({
|
|
15412
|
+
async _start({
|
|
15368
15413
|
inputData,
|
|
15369
15414
|
runtimeContext,
|
|
15370
15415
|
writableStream,
|
|
15371
|
-
tracingContext
|
|
15416
|
+
tracingContext,
|
|
15417
|
+
format
|
|
15372
15418
|
}) {
|
|
15373
15419
|
const result = await this.executionEngine.execute({
|
|
15374
15420
|
workflowId: this.workflowId,
|
|
@@ -15395,13 +15441,33 @@ var Run = class {
|
|
|
15395
15441
|
runtimeContext: runtimeContext ?? new RuntimeContext(),
|
|
15396
15442
|
abortController: this.abortController,
|
|
15397
15443
|
writableStream,
|
|
15398
|
-
tracingContext
|
|
15444
|
+
tracingContext,
|
|
15445
|
+
format
|
|
15399
15446
|
});
|
|
15400
15447
|
if (result.status !== "suspended") {
|
|
15401
15448
|
this.cleanup?.();
|
|
15402
15449
|
}
|
|
15403
15450
|
return result;
|
|
15404
15451
|
}
|
|
15452
|
+
/**
|
|
15453
|
+
* Starts the workflow execution with the provided input
|
|
15454
|
+
* @param input The input data for the workflow
|
|
15455
|
+
* @returns A promise that resolves to the workflow output
|
|
15456
|
+
*/
|
|
15457
|
+
async start({
|
|
15458
|
+
inputData,
|
|
15459
|
+
runtimeContext,
|
|
15460
|
+
writableStream,
|
|
15461
|
+
tracingContext
|
|
15462
|
+
}) {
|
|
15463
|
+
return this._start({
|
|
15464
|
+
inputData,
|
|
15465
|
+
runtimeContext,
|
|
15466
|
+
writableStream,
|
|
15467
|
+
tracingContext,
|
|
15468
|
+
format: "aisdk"
|
|
15469
|
+
});
|
|
15470
|
+
}
|
|
15405
15471
|
/**
|
|
15406
15472
|
* Starts the workflow execution with the provided input as a stream
|
|
15407
15473
|
* @param input The input data for the workflow
|
|
@@ -15471,9 +15537,10 @@ var Run = class {
|
|
|
15471
15537
|
runId: this.runId
|
|
15472
15538
|
}
|
|
15473
15539
|
});
|
|
15474
|
-
this.executionResults = this.
|
|
15540
|
+
this.executionResults = this._start({
|
|
15475
15541
|
inputData,
|
|
15476
|
-
runtimeContext
|
|
15542
|
+
runtimeContext,
|
|
15543
|
+
format: "aisdk"
|
|
15477
15544
|
}).then(result => {
|
|
15478
15545
|
if (result.status !== "suspended") {
|
|
15479
15546
|
this.closeStreamAction?.().catch(() => {});
|
|
@@ -15501,7 +15568,8 @@ var Run = class {
|
|
|
15501
15568
|
*/
|
|
15502
15569
|
streamVNext({
|
|
15503
15570
|
inputData,
|
|
15504
|
-
runtimeContext
|
|
15571
|
+
runtimeContext,
|
|
15572
|
+
format
|
|
15505
15573
|
} = {}) {
|
|
15506
15574
|
this.closeStreamAction = async () => {};
|
|
15507
15575
|
return new MastraWorkflowStream({
|
|
@@ -15537,12 +15605,13 @@ var Run = class {
|
|
|
15537
15605
|
};
|
|
15538
15606
|
const unwatch = this.watch(async ({
|
|
15539
15607
|
type,
|
|
15608
|
+
from = "WORKFLOW" /* WORKFLOW */,
|
|
15540
15609
|
payload
|
|
15541
15610
|
}) => {
|
|
15542
15611
|
buffer.push({
|
|
15543
15612
|
type,
|
|
15544
15613
|
runId: this.runId,
|
|
15545
|
-
from
|
|
15614
|
+
from,
|
|
15546
15615
|
payload: {
|
|
15547
15616
|
stepName: payload.id,
|
|
15548
15617
|
...payload
|
|
@@ -15558,10 +15627,11 @@ var Run = class {
|
|
|
15558
15627
|
console.error("Error closing stream:", err);
|
|
15559
15628
|
}
|
|
15560
15629
|
};
|
|
15561
|
-
const executionResults = this.
|
|
15630
|
+
const executionResults = this._start({
|
|
15562
15631
|
inputData,
|
|
15563
15632
|
runtimeContext,
|
|
15564
|
-
writableStream: writable
|
|
15633
|
+
writableStream: writable,
|
|
15634
|
+
format
|
|
15565
15635
|
}).then(result => {
|
|
15566
15636
|
if (result.status !== "suspended") {
|
|
15567
15637
|
this.closeStreamAction?.().catch(() => {});
|
|
@@ -15799,5 +15869,5 @@ function deepMergeWorkflowState(a, b) {
|
|
|
15799
15869
|
}
|
|
15800
15870
|
|
|
15801
15871
|
export { AISDKV5OutputStream, Agent, DefaultExecutionEngine, ExecutionEngine, LanguageDetector, LanguageDetectorInputProcessor, LegacyStep, LegacyWorkflow, MastraModelOutput, ModerationInputProcessor, ModerationProcessor, PIIDetector, PIIDetectorInputProcessor, PromptInjectionDetector, PromptInjectionDetectorInputProcessor, Run, StructuredOutputProcessor, TripWire, UnicodeNormalizer, UnicodeNormalizerInputProcessor, WhenConditionReturnValue, Workflow, agentToStep, cloneStep, cloneWorkflow, createStep, createWorkflow, getActivePathsAndStatus, getResultActivePaths, getStepResult, getSuspendedPaths, isAgent, isConditionalKey, isErrorEvent, isFinalState, isLimboState, isTransitionEvent, isVariableReference, isWorkflow, loop, mapVariable, mergeChildValue, recursivelyCheckForFinalState, resolveVariables, updateStepInHierarchy, workflowToStep };
|
|
15802
|
-
//# sourceMappingURL=chunk-
|
|
15803
|
-
//# sourceMappingURL=chunk-
|
|
15872
|
+
//# sourceMappingURL=chunk-YILDTNQM.js.map
|
|
15873
|
+
//# sourceMappingURL=chunk-YILDTNQM.js.map
|