@mastra/ai-sdk 0.0.0-moving-fetching-hooks-to-playground-ui-and-expose-them-20251023071821 → 0.0.0-netlify-no-bundle-20251127120354
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 +356 -1
- package/dist/__tests__/__fixtures__/network.stream.d.ts +2329 -0
- package/dist/__tests__/__fixtures__/network.stream.d.ts.map +1 -0
- package/dist/chat-route.d.ts +52 -2
- package/dist/chat-route.d.ts.map +1 -1
- package/dist/convert-messages.d.ts +10 -0
- package/dist/convert-messages.d.ts.map +1 -0
- package/dist/convert-streams.d.ts +82 -0
- package/dist/convert-streams.d.ts.map +1 -0
- package/dist/helpers.d.ts +2 -3
- package/dist/helpers.d.ts.map +1 -1
- package/dist/index.cjs +452 -113
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +452 -114
- package/dist/index.js.map +1 -1
- package/dist/to-ai-sdk-format.d.ts +15 -16
- package/dist/to-ai-sdk-format.d.ts.map +1 -1
- package/dist/transformers.d.ts +174 -10
- package/dist/transformers.d.ts.map +1 -1
- package/dist/ui.cjs +16 -0
- package/dist/ui.cjs.map +1 -0
- package/dist/ui.d.ts +2 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +13 -0
- package/dist/ui.js.map +1 -0
- package/dist/utils.d.ts +9 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/workflow-route.d.ts +3 -1
- package/dist/workflow-route.d.ts.map +1 -1
- package/package.json +21 -6
package/dist/index.js
CHANGED
|
@@ -8,6 +8,51 @@ import { DefaultGeneratedFile, DefaultGeneratedFileWithType } from '@mastra/core
|
|
|
8
8
|
var isDataChunkType = (chunk) => {
|
|
9
9
|
return chunk && typeof chunk === "object" && "type" in chunk && chunk.type?.startsWith("data-");
|
|
10
10
|
};
|
|
11
|
+
var isMastraTextStreamChunk = (chunk) => {
|
|
12
|
+
return chunk && typeof chunk === "object" && "type" in chunk && typeof chunk.type === "string" && [
|
|
13
|
+
"text-start",
|
|
14
|
+
"text-delta",
|
|
15
|
+
"text-end",
|
|
16
|
+
"reasoning-start",
|
|
17
|
+
"reasoning-delta",
|
|
18
|
+
"reasoning-end",
|
|
19
|
+
"file",
|
|
20
|
+
"source",
|
|
21
|
+
"tool-input-start",
|
|
22
|
+
"tool-input-delta",
|
|
23
|
+
"tool-call",
|
|
24
|
+
"tool-result",
|
|
25
|
+
"tool-error",
|
|
26
|
+
"error",
|
|
27
|
+
"start-step",
|
|
28
|
+
"finish-step",
|
|
29
|
+
"start",
|
|
30
|
+
"finish",
|
|
31
|
+
"abort",
|
|
32
|
+
"tool-input-end",
|
|
33
|
+
"raw"
|
|
34
|
+
].includes(chunk.type);
|
|
35
|
+
};
|
|
36
|
+
function safeParseErrorObject(obj) {
|
|
37
|
+
if (typeof obj !== "object" || obj === null) {
|
|
38
|
+
return String(obj);
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const stringified = JSON.stringify(obj);
|
|
42
|
+
if (stringified === "{}") {
|
|
43
|
+
return String(obj);
|
|
44
|
+
}
|
|
45
|
+
return stringified;
|
|
46
|
+
} catch {
|
|
47
|
+
return String(obj);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
var isAgentExecutionDataChunkType = (chunk) => {
|
|
51
|
+
return chunk && typeof chunk === "object" && "type" in chunk && chunk.type?.startsWith("agent-execution-event-") && "payload" in chunk && typeof chunk.payload === "object" && "type" in chunk.payload && chunk.payload.type?.startsWith("data-");
|
|
52
|
+
};
|
|
53
|
+
var isWorkflowExecutionDataChunkType = (chunk) => {
|
|
54
|
+
return chunk && typeof chunk === "object" && "type" in chunk && chunk.type?.startsWith("workflow-execution-event-") && "payload" in chunk && typeof chunk.payload === "object" && "type" in chunk.payload && chunk.payload.type?.startsWith("data-");
|
|
55
|
+
};
|
|
11
56
|
|
|
12
57
|
// src/helpers.ts
|
|
13
58
|
function convertMastraChunkToAISDKv5({
|
|
@@ -118,6 +163,28 @@ function convertMastraChunkToAISDKv5({
|
|
|
118
163
|
toolName: chunk.payload.toolName,
|
|
119
164
|
input: chunk.payload.args
|
|
120
165
|
};
|
|
166
|
+
case "tool-call-approval":
|
|
167
|
+
return {
|
|
168
|
+
type: "data-tool-call-approval",
|
|
169
|
+
id: chunk.payload.toolCallId,
|
|
170
|
+
data: {
|
|
171
|
+
runId: chunk.runId,
|
|
172
|
+
toolCallId: chunk.payload.toolCallId,
|
|
173
|
+
toolName: chunk.payload.toolName,
|
|
174
|
+
args: chunk.payload.args
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
case "tool-call-suspended":
|
|
178
|
+
return {
|
|
179
|
+
type: "data-tool-call-suspended",
|
|
180
|
+
id: chunk.payload.toolCallId,
|
|
181
|
+
data: {
|
|
182
|
+
runId: chunk.runId,
|
|
183
|
+
toolCallId: chunk.payload.toolCallId,
|
|
184
|
+
toolName: chunk.payload.toolName,
|
|
185
|
+
suspendPayload: chunk.payload.suspendPayload
|
|
186
|
+
}
|
|
187
|
+
};
|
|
121
188
|
case "tool-call-input-streaming-start":
|
|
122
189
|
return {
|
|
123
190
|
type: "tool-input-start",
|
|
@@ -208,6 +275,13 @@ function convertMastraChunkToAISDKv5({
|
|
|
208
275
|
type: "object",
|
|
209
276
|
object: chunk.object
|
|
210
277
|
};
|
|
278
|
+
case "tripwire":
|
|
279
|
+
return {
|
|
280
|
+
type: "data-tripwire",
|
|
281
|
+
data: {
|
|
282
|
+
tripwireReason: chunk.payload.tripwireReason
|
|
283
|
+
}
|
|
284
|
+
};
|
|
211
285
|
default:
|
|
212
286
|
if (chunk.type && "payload" in chunk && chunk.payload) {
|
|
213
287
|
return {
|
|
@@ -263,6 +337,14 @@ function convertFullStreamChunkToUIMessageStream({
|
|
|
263
337
|
};
|
|
264
338
|
}
|
|
265
339
|
case "reasoning-delta": {
|
|
340
|
+
if (sendReasoning) {
|
|
341
|
+
return {
|
|
342
|
+
type: "reasoning-delta",
|
|
343
|
+
id: part.id,
|
|
344
|
+
delta: part.text,
|
|
345
|
+
...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
|
|
346
|
+
};
|
|
347
|
+
}
|
|
266
348
|
return;
|
|
267
349
|
}
|
|
268
350
|
case "reasoning-end": {
|
|
@@ -280,6 +362,25 @@ function convertFullStreamChunkToUIMessageStream({
|
|
|
280
362
|
};
|
|
281
363
|
}
|
|
282
364
|
case "source": {
|
|
365
|
+
if (sendSources && part.sourceType === "url") {
|
|
366
|
+
return {
|
|
367
|
+
type: "source-url",
|
|
368
|
+
sourceId: part.id,
|
|
369
|
+
url: part.url,
|
|
370
|
+
title: part.title,
|
|
371
|
+
...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
if (sendSources && part.sourceType === "document") {
|
|
375
|
+
return {
|
|
376
|
+
type: "source-document",
|
|
377
|
+
sourceId: part.id,
|
|
378
|
+
mediaType: part.mediaType,
|
|
379
|
+
title: part.title,
|
|
380
|
+
filename: part.filename,
|
|
381
|
+
...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
|
|
382
|
+
};
|
|
383
|
+
}
|
|
283
384
|
return;
|
|
284
385
|
}
|
|
285
386
|
case "tool-input-start": {
|
|
@@ -337,6 +438,14 @@ function convertFullStreamChunkToUIMessageStream({
|
|
|
337
438
|
toolCallId: part.toolCallId,
|
|
338
439
|
payload: part.output
|
|
339
440
|
};
|
|
441
|
+
} else if (isDataChunkType(part.output)) {
|
|
442
|
+
if (!("data" in part.output)) {
|
|
443
|
+
throw new Error(
|
|
444
|
+
`UI Messages require a data property when using data- prefixed chunks
|
|
445
|
+
${JSON.stringify(part)}`
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
return part.output;
|
|
340
449
|
}
|
|
341
450
|
return;
|
|
342
451
|
}
|
|
@@ -362,21 +471,23 @@ function convertFullStreamChunkToUIMessageStream({
|
|
|
362
471
|
return { type: "finish-step" };
|
|
363
472
|
}
|
|
364
473
|
case "start": {
|
|
365
|
-
{
|
|
474
|
+
if (sendStart) {
|
|
366
475
|
return {
|
|
367
476
|
type: "start",
|
|
368
477
|
...messageMetadataValue != null ? { messageMetadata: messageMetadataValue } : {},
|
|
369
478
|
...responseMessageId != null ? { messageId: responseMessageId } : {}
|
|
370
479
|
};
|
|
371
480
|
}
|
|
481
|
+
return;
|
|
372
482
|
}
|
|
373
483
|
case "finish": {
|
|
374
|
-
{
|
|
484
|
+
if (sendFinish) {
|
|
375
485
|
return {
|
|
376
486
|
type: "finish",
|
|
377
487
|
...messageMetadataValue != null ? { messageMetadata: messageMetadataValue } : {}
|
|
378
488
|
};
|
|
379
489
|
}
|
|
490
|
+
return;
|
|
380
491
|
}
|
|
381
492
|
case "abort": {
|
|
382
493
|
return part;
|
|
@@ -403,7 +514,10 @@ function convertFullStreamChunkToUIMessageStream({
|
|
|
403
514
|
}
|
|
404
515
|
|
|
405
516
|
// src/transformers.ts
|
|
406
|
-
|
|
517
|
+
var PRIMITIVE_CACHE_SYMBOL = Symbol("primitive-cache");
|
|
518
|
+
function WorkflowStreamToAISDKTransformer({
|
|
519
|
+
includeTextStreamParts
|
|
520
|
+
} = {}) {
|
|
407
521
|
const bufferedWorkflows = /* @__PURE__ */ new Map();
|
|
408
522
|
return new TransformStream({
|
|
409
523
|
start(controller) {
|
|
@@ -417,7 +531,7 @@ function WorkflowStreamToAISDKTransformer() {
|
|
|
417
531
|
});
|
|
418
532
|
},
|
|
419
533
|
transform(chunk, controller) {
|
|
420
|
-
const transformed = transformWorkflow(chunk, bufferedWorkflows);
|
|
534
|
+
const transformed = transformWorkflow(chunk, bufferedWorkflows, false, includeTextStreamParts);
|
|
421
535
|
if (transformed) controller.enqueue(transformed);
|
|
422
536
|
}
|
|
423
537
|
});
|
|
@@ -441,20 +555,37 @@ function AgentNetworkToAISDKTransformer() {
|
|
|
441
555
|
}
|
|
442
556
|
});
|
|
443
557
|
}
|
|
444
|
-
function AgentStreamToAISDKTransformer(
|
|
558
|
+
function AgentStreamToAISDKTransformer({
|
|
559
|
+
lastMessageId,
|
|
560
|
+
sendStart,
|
|
561
|
+
sendFinish,
|
|
562
|
+
sendReasoning,
|
|
563
|
+
sendSources,
|
|
564
|
+
messageMetadata,
|
|
565
|
+
onError
|
|
566
|
+
}) {
|
|
445
567
|
let bufferedSteps = /* @__PURE__ */ new Map();
|
|
568
|
+
let tripwireOccurred = false;
|
|
569
|
+
let finishEventSent = false;
|
|
446
570
|
return new TransformStream({
|
|
447
571
|
transform(chunk, controller) {
|
|
572
|
+
if (chunk.type === "tripwire") {
|
|
573
|
+
tripwireOccurred = true;
|
|
574
|
+
}
|
|
575
|
+
if (chunk.type === "finish") {
|
|
576
|
+
finishEventSent = true;
|
|
577
|
+
}
|
|
448
578
|
const part = convertMastraChunkToAISDKv5({ chunk, mode: "stream" });
|
|
449
579
|
const transformedChunk = convertFullStreamChunkToUIMessageStream({
|
|
450
580
|
part,
|
|
451
|
-
sendReasoning
|
|
452
|
-
sendSources
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
581
|
+
sendReasoning,
|
|
582
|
+
sendSources,
|
|
583
|
+
messageMetadataValue: messageMetadata?.({ part }),
|
|
584
|
+
sendStart,
|
|
585
|
+
sendFinish,
|
|
586
|
+
responseMessageId: lastMessageId,
|
|
587
|
+
onError(error) {
|
|
588
|
+
return onError ? onError(error) : safeParseErrorObject(error);
|
|
458
589
|
}
|
|
459
590
|
});
|
|
460
591
|
if (transformedChunk) {
|
|
@@ -474,6 +605,14 @@ function AgentStreamToAISDKTransformer() {
|
|
|
474
605
|
controller.enqueue(transformedChunk);
|
|
475
606
|
}
|
|
476
607
|
}
|
|
608
|
+
},
|
|
609
|
+
flush(controller) {
|
|
610
|
+
if (tripwireOccurred && !finishEventSent && sendFinish) {
|
|
611
|
+
controller.enqueue({
|
|
612
|
+
type: "finish",
|
|
613
|
+
finishReason: "other"
|
|
614
|
+
});
|
|
615
|
+
}
|
|
477
616
|
}
|
|
478
617
|
});
|
|
479
618
|
}
|
|
@@ -613,7 +752,7 @@ function transformAgent(payload, bufferedSteps) {
|
|
|
613
752
|
}
|
|
614
753
|
return null;
|
|
615
754
|
}
|
|
616
|
-
function transformWorkflow(payload, bufferedWorkflows, isNested) {
|
|
755
|
+
function transformWorkflow(payload, bufferedWorkflows, isNested, includeTextStreamParts) {
|
|
617
756
|
switch (payload.type) {
|
|
618
757
|
case "workflow-start":
|
|
619
758
|
bufferedWorkflows.set(payload.runId, {
|
|
@@ -636,7 +775,9 @@ function transformWorkflow(payload, bufferedWorkflows, isNested) {
|
|
|
636
775
|
name: payload.payload.id,
|
|
637
776
|
status: payload.payload.status,
|
|
638
777
|
input: payload.payload.payload ?? null,
|
|
639
|
-
output: null
|
|
778
|
+
output: null,
|
|
779
|
+
suspendPayload: null,
|
|
780
|
+
resumePayload: null
|
|
640
781
|
};
|
|
641
782
|
bufferedWorkflows.set(payload.runId, current);
|
|
642
783
|
return {
|
|
@@ -669,6 +810,27 @@ function transformWorkflow(payload, bufferedWorkflows, isNested) {
|
|
|
669
810
|
}
|
|
670
811
|
};
|
|
671
812
|
}
|
|
813
|
+
case "workflow-step-suspended": {
|
|
814
|
+
const current = bufferedWorkflows.get(payload.runId);
|
|
815
|
+
if (!current) return null;
|
|
816
|
+
current.steps[payload.payload.id] = {
|
|
817
|
+
...current.steps[payload.payload.id],
|
|
818
|
+
status: payload.payload.status,
|
|
819
|
+
suspendPayload: payload.payload.suspendPayload ?? null,
|
|
820
|
+
resumePayload: payload.payload.resumePayload ?? null,
|
|
821
|
+
output: null
|
|
822
|
+
};
|
|
823
|
+
return {
|
|
824
|
+
type: isNested ? "data-tool-workflow" : "data-workflow",
|
|
825
|
+
id: payload.runId,
|
|
826
|
+
data: {
|
|
827
|
+
name: current.name,
|
|
828
|
+
status: "suspended",
|
|
829
|
+
steps: current.steps,
|
|
830
|
+
output: null
|
|
831
|
+
}
|
|
832
|
+
};
|
|
833
|
+
}
|
|
672
834
|
case "workflow-finish": {
|
|
673
835
|
const current = bufferedWorkflows.get(payload.runId);
|
|
674
836
|
if (!current) return null;
|
|
@@ -683,6 +845,29 @@ function transformWorkflow(payload, bufferedWorkflows, isNested) {
|
|
|
683
845
|
}
|
|
684
846
|
};
|
|
685
847
|
}
|
|
848
|
+
case "workflow-step-output": {
|
|
849
|
+
const output = payload.payload.output;
|
|
850
|
+
if (includeTextStreamParts && output && isMastraTextStreamChunk(output)) {
|
|
851
|
+
const part = convertMastraChunkToAISDKv5({ chunk: output, mode: "stream" });
|
|
852
|
+
const transformedChunk = convertFullStreamChunkToUIMessageStream({
|
|
853
|
+
part,
|
|
854
|
+
onError(error) {
|
|
855
|
+
return safeParseErrorObject(error);
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
return transformedChunk;
|
|
859
|
+
}
|
|
860
|
+
if (output && isDataChunkType(output)) {
|
|
861
|
+
if (!("data" in output)) {
|
|
862
|
+
throw new Error(
|
|
863
|
+
`UI Messages require a data property when using data- prefixed chunks
|
|
864
|
+
${JSON.stringify(output)}`
|
|
865
|
+
);
|
|
866
|
+
}
|
|
867
|
+
return output;
|
|
868
|
+
}
|
|
869
|
+
return null;
|
|
870
|
+
}
|
|
686
871
|
default: {
|
|
687
872
|
if (isDataChunkType(payload)) {
|
|
688
873
|
if (!("data" in payload)) {
|
|
@@ -700,19 +885,39 @@ function transformWorkflow(payload, bufferedWorkflows, isNested) {
|
|
|
700
885
|
function transformNetwork(payload, bufferedNetworks, isNested) {
|
|
701
886
|
switch (payload.type) {
|
|
702
887
|
case "routing-agent-start": {
|
|
703
|
-
if (!bufferedNetworks.has(payload.
|
|
704
|
-
bufferedNetworks.set(payload.
|
|
705
|
-
name: payload.payload.
|
|
706
|
-
steps: []
|
|
888
|
+
if (!bufferedNetworks.has(payload.runId)) {
|
|
889
|
+
bufferedNetworks.set(payload.runId, {
|
|
890
|
+
name: payload.payload.networkId,
|
|
891
|
+
steps: [],
|
|
892
|
+
usage: null,
|
|
893
|
+
output: null
|
|
707
894
|
});
|
|
708
895
|
}
|
|
896
|
+
const current = bufferedNetworks.get(payload.runId);
|
|
897
|
+
current.steps.push({
|
|
898
|
+
id: payload.payload.runId,
|
|
899
|
+
name: payload.payload.agentId,
|
|
900
|
+
status: "running",
|
|
901
|
+
iteration: payload.payload.inputData.iteration,
|
|
902
|
+
input: {
|
|
903
|
+
task: payload.payload.inputData.task,
|
|
904
|
+
threadId: payload.payload.inputData.threadId,
|
|
905
|
+
threadResourceId: payload.payload.inputData.threadResourceId
|
|
906
|
+
},
|
|
907
|
+
output: "",
|
|
908
|
+
task: null,
|
|
909
|
+
suspendPayload: null,
|
|
910
|
+
resumePayload: null,
|
|
911
|
+
[PRIMITIVE_CACHE_SYMBOL]: /* @__PURE__ */ new Map()
|
|
912
|
+
});
|
|
709
913
|
return {
|
|
710
914
|
type: isNested ? "data-tool-network" : "data-network",
|
|
711
|
-
id: payload.
|
|
915
|
+
id: payload.runId,
|
|
712
916
|
data: {
|
|
713
|
-
name: bufferedNetworks.get(payload.
|
|
917
|
+
name: bufferedNetworks.get(payload.runId).name,
|
|
714
918
|
status: "running",
|
|
715
|
-
|
|
919
|
+
usage: null,
|
|
920
|
+
steps: bufferedNetworks.get(payload.runId).steps,
|
|
716
921
|
output: null
|
|
717
922
|
}
|
|
718
923
|
};
|
|
@@ -735,150 +940,180 @@ function transformNetwork(payload, bufferedNetworks, isNested) {
|
|
|
735
940
|
};
|
|
736
941
|
}
|
|
737
942
|
case "agent-execution-start": {
|
|
738
|
-
const current = bufferedNetworks.get(payload.
|
|
943
|
+
const current = bufferedNetworks.get(payload.runId);
|
|
944
|
+
if (!current) return null;
|
|
739
945
|
current.steps.push({
|
|
946
|
+
id: payload.payload.runId,
|
|
740
947
|
name: payload.payload.agentId,
|
|
741
948
|
status: "running",
|
|
742
|
-
|
|
743
|
-
|
|
949
|
+
iteration: payload.payload.args?.iteration ?? 0,
|
|
950
|
+
input: { prompt: payload.payload.args?.prompt ?? "" },
|
|
951
|
+
output: null,
|
|
952
|
+
task: null,
|
|
953
|
+
suspendPayload: null,
|
|
954
|
+
resumePayload: null,
|
|
955
|
+
[PRIMITIVE_CACHE_SYMBOL]: /* @__PURE__ */ new Map()
|
|
744
956
|
});
|
|
745
|
-
bufferedNetworks.set(payload.
|
|
957
|
+
bufferedNetworks.set(payload.runId, current);
|
|
746
958
|
return {
|
|
747
959
|
type: isNested ? "data-tool-network" : "data-network",
|
|
748
|
-
id: payload.
|
|
960
|
+
id: payload.runId,
|
|
749
961
|
data: {
|
|
750
|
-
|
|
751
|
-
status: "running"
|
|
752
|
-
steps: current.steps,
|
|
753
|
-
output: null
|
|
962
|
+
...current,
|
|
963
|
+
status: "running"
|
|
754
964
|
}
|
|
755
965
|
};
|
|
756
966
|
}
|
|
757
967
|
case "workflow-execution-start": {
|
|
758
|
-
const current = bufferedNetworks.get(payload.
|
|
968
|
+
const current = bufferedNetworks.get(payload.runId);
|
|
969
|
+
if (!current) return null;
|
|
759
970
|
current.steps.push({
|
|
760
|
-
|
|
971
|
+
id: payload.payload.runId,
|
|
972
|
+
name: payload.payload.workflowId,
|
|
761
973
|
status: "running",
|
|
762
|
-
|
|
763
|
-
|
|
974
|
+
iteration: payload.payload.args?.iteration ?? 0,
|
|
975
|
+
input: { prompt: payload.payload.args?.prompt ?? "" },
|
|
976
|
+
output: null,
|
|
977
|
+
task: null,
|
|
978
|
+
suspendPayload: null,
|
|
979
|
+
resumePayload: null,
|
|
980
|
+
[PRIMITIVE_CACHE_SYMBOL]: /* @__PURE__ */ new Map()
|
|
764
981
|
});
|
|
765
|
-
bufferedNetworks.set(payload.
|
|
982
|
+
bufferedNetworks.set(payload.runId, current);
|
|
766
983
|
return {
|
|
767
984
|
type: isNested ? "data-tool-network" : "data-network",
|
|
768
|
-
id: payload.
|
|
985
|
+
id: payload.runId,
|
|
769
986
|
data: {
|
|
770
|
-
|
|
771
|
-
status: "running"
|
|
772
|
-
steps: current.steps,
|
|
773
|
-
output: null
|
|
987
|
+
...current,
|
|
988
|
+
status: "running"
|
|
774
989
|
}
|
|
775
990
|
};
|
|
776
991
|
}
|
|
777
992
|
case "tool-execution-start": {
|
|
778
|
-
const current = bufferedNetworks.get(payload.
|
|
993
|
+
const current = bufferedNetworks.get(payload.runId);
|
|
994
|
+
if (!current) return null;
|
|
779
995
|
current.steps.push({
|
|
996
|
+
id: payload.payload.args.toolCallId,
|
|
780
997
|
name: payload.payload.args?.toolName,
|
|
781
998
|
status: "running",
|
|
999
|
+
iteration: payload.payload.args?.iteration ? Number(payload.payload.args.iteration) : 0,
|
|
1000
|
+
task: {
|
|
1001
|
+
id: payload.payload.args?.toolName
|
|
1002
|
+
},
|
|
782
1003
|
input: payload.payload.args?.args || null,
|
|
783
|
-
output: null
|
|
1004
|
+
output: null,
|
|
1005
|
+
suspendPayload: null,
|
|
1006
|
+
resumePayload: null,
|
|
1007
|
+
[PRIMITIVE_CACHE_SYMBOL]: /* @__PURE__ */ new Map()
|
|
784
1008
|
});
|
|
785
|
-
bufferedNetworks.set(payload.
|
|
1009
|
+
bufferedNetworks.set(payload.runId, current);
|
|
786
1010
|
return {
|
|
787
1011
|
type: isNested ? "data-tool-network" : "data-network",
|
|
788
|
-
id: payload.
|
|
1012
|
+
id: payload.runId,
|
|
789
1013
|
data: {
|
|
790
|
-
|
|
791
|
-
status: "running"
|
|
792
|
-
steps: current.steps,
|
|
793
|
-
output: null
|
|
1014
|
+
...current,
|
|
1015
|
+
status: "running"
|
|
794
1016
|
}
|
|
795
1017
|
};
|
|
796
1018
|
}
|
|
797
1019
|
case "agent-execution-end": {
|
|
798
1020
|
const current = bufferedNetworks.get(payload.runId);
|
|
799
1021
|
if (!current) return null;
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
1022
|
+
const stepId = payload.payload.runId;
|
|
1023
|
+
const step = current.steps.find((step2) => step2.id === stepId);
|
|
1024
|
+
if (!step) {
|
|
1025
|
+
return null;
|
|
1026
|
+
}
|
|
1027
|
+
step.status = "success";
|
|
1028
|
+
step.output = payload.payload.result;
|
|
806
1029
|
return {
|
|
807
1030
|
type: isNested ? "data-tool-network" : "data-network",
|
|
808
1031
|
id: payload.runId,
|
|
809
1032
|
data: {
|
|
810
|
-
|
|
1033
|
+
...current,
|
|
1034
|
+
usage: payload.payload?.usage ?? current.usage,
|
|
811
1035
|
status: "running",
|
|
812
|
-
|
|
813
|
-
output: payload.payload.result ?? null
|
|
1036
|
+
output: payload.payload.result ?? current.output
|
|
814
1037
|
}
|
|
815
1038
|
};
|
|
816
1039
|
}
|
|
817
1040
|
case "tool-execution-end": {
|
|
818
1041
|
const current = bufferedNetworks.get(payload.runId);
|
|
819
1042
|
if (!current) return null;
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
1043
|
+
const stepId = payload.payload.toolCallId;
|
|
1044
|
+
const step = current.steps.find((step2) => step2.id === stepId);
|
|
1045
|
+
if (!step) {
|
|
1046
|
+
return null;
|
|
1047
|
+
}
|
|
1048
|
+
step.status = "success";
|
|
1049
|
+
step.output = payload.payload.result;
|
|
826
1050
|
return {
|
|
827
1051
|
type: isNested ? "data-tool-network" : "data-network",
|
|
828
1052
|
id: payload.runId,
|
|
829
1053
|
data: {
|
|
830
|
-
|
|
1054
|
+
...current,
|
|
831
1055
|
status: "running",
|
|
832
|
-
|
|
833
|
-
output: payload.payload.result ?? null
|
|
1056
|
+
output: payload.payload.result ?? current.output
|
|
834
1057
|
}
|
|
835
1058
|
};
|
|
836
1059
|
}
|
|
837
1060
|
case "workflow-execution-end": {
|
|
838
1061
|
const current = bufferedNetworks.get(payload.runId);
|
|
839
1062
|
if (!current) return null;
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
1063
|
+
const stepId = payload.payload.runId;
|
|
1064
|
+
const step = current.steps.find((step2) => step2.id === stepId);
|
|
1065
|
+
if (!step) {
|
|
1066
|
+
return null;
|
|
1067
|
+
}
|
|
1068
|
+
step.status = "success";
|
|
1069
|
+
step.output = payload.payload.result;
|
|
846
1070
|
return {
|
|
847
1071
|
type: isNested ? "data-tool-network" : "data-network",
|
|
848
1072
|
id: payload.runId,
|
|
849
1073
|
data: {
|
|
850
|
-
|
|
1074
|
+
...current,
|
|
1075
|
+
usage: payload.payload?.usage ?? current.usage,
|
|
851
1076
|
status: "running",
|
|
852
|
-
|
|
853
|
-
output: payload.payload.result ?? null
|
|
1077
|
+
output: payload.payload.result ?? current.output
|
|
854
1078
|
}
|
|
855
1079
|
};
|
|
856
1080
|
}
|
|
857
1081
|
case "routing-agent-end": {
|
|
858
|
-
const current = bufferedNetworks.get(payload.
|
|
1082
|
+
const current = bufferedNetworks.get(payload.runId);
|
|
859
1083
|
if (!current) return null;
|
|
1084
|
+
const stepId = payload.payload.runId;
|
|
1085
|
+
const step = current.steps.find((step2) => step2.id === stepId);
|
|
1086
|
+
if (!step) {
|
|
1087
|
+
return null;
|
|
1088
|
+
}
|
|
1089
|
+
step.status = "success";
|
|
1090
|
+
step.task = {
|
|
1091
|
+
id: payload.payload.primitiveId,
|
|
1092
|
+
type: payload.payload.primitiveType,
|
|
1093
|
+
name: payload.payload.task,
|
|
1094
|
+
reason: payload.payload.selectionReason
|
|
1095
|
+
};
|
|
1096
|
+
step.output = payload.payload.result;
|
|
860
1097
|
return {
|
|
861
1098
|
type: isNested ? "data-tool-network" : "data-network",
|
|
862
|
-
id: payload.
|
|
1099
|
+
id: payload.runId,
|
|
863
1100
|
data: {
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
output: payload.payload?.result ?? null
|
|
1101
|
+
...current,
|
|
1102
|
+
usage: payload.payload?.usage ?? current.usage,
|
|
1103
|
+
output: payload.payload?.result ?? current.output
|
|
868
1104
|
}
|
|
869
1105
|
};
|
|
870
1106
|
}
|
|
871
1107
|
case "network-execution-event-step-finish": {
|
|
872
|
-
const current = bufferedNetworks.get(payload.
|
|
1108
|
+
const current = bufferedNetworks.get(payload.runId);
|
|
873
1109
|
if (!current) return null;
|
|
874
1110
|
return {
|
|
875
1111
|
type: isNested ? "data-tool-network" : "data-network",
|
|
876
|
-
id: payload.
|
|
1112
|
+
id: payload.runId,
|
|
877
1113
|
data: {
|
|
878
|
-
|
|
1114
|
+
...current,
|
|
879
1115
|
status: "finished",
|
|
880
|
-
|
|
881
|
-
output: payload.payload?.result ?? null
|
|
1116
|
+
output: payload.payload?.result ?? current.output
|
|
882
1117
|
}
|
|
883
1118
|
};
|
|
884
1119
|
}
|
|
@@ -889,14 +1124,47 @@ function transformNetwork(payload, bufferedNetworks, isNested) {
|
|
|
889
1124
|
type: isNested ? "data-tool-network" : "data-network",
|
|
890
1125
|
id: payload.runId,
|
|
891
1126
|
data: {
|
|
892
|
-
|
|
1127
|
+
...current,
|
|
1128
|
+
usage: payload.payload?.usage ?? current.usage,
|
|
893
1129
|
status: "finished",
|
|
894
|
-
|
|
895
|
-
output: payload.payload?.result ?? null
|
|
1130
|
+
output: payload.payload?.result ?? current.output
|
|
896
1131
|
}
|
|
897
1132
|
};
|
|
898
1133
|
}
|
|
899
1134
|
default: {
|
|
1135
|
+
if (payload.type.startsWith("agent-execution-event-")) {
|
|
1136
|
+
const stepId = payload.payload.runId;
|
|
1137
|
+
const current = bufferedNetworks.get(payload.runId);
|
|
1138
|
+
if (!current) return null;
|
|
1139
|
+
const step = current.steps.find((step2) => step2.id === stepId);
|
|
1140
|
+
if (!step) {
|
|
1141
|
+
return null;
|
|
1142
|
+
}
|
|
1143
|
+
step[PRIMITIVE_CACHE_SYMBOL] = step[PRIMITIVE_CACHE_SYMBOL] || /* @__PURE__ */ new Map();
|
|
1144
|
+
const result = transformAgent(payload.payload, step[PRIMITIVE_CACHE_SYMBOL]);
|
|
1145
|
+
if (result) {
|
|
1146
|
+
const { request, response, ...data } = result.data;
|
|
1147
|
+
step.task = data;
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
if (payload.type.startsWith("workflow-execution-event-")) {
|
|
1151
|
+
const stepId = payload.payload.runId;
|
|
1152
|
+
const current = bufferedNetworks.get(payload.runId);
|
|
1153
|
+
if (!current) return null;
|
|
1154
|
+
const step = current.steps.find((step2) => step2.id === stepId);
|
|
1155
|
+
if (!step) {
|
|
1156
|
+
return null;
|
|
1157
|
+
}
|
|
1158
|
+
step[PRIMITIVE_CACHE_SYMBOL] = step[PRIMITIVE_CACHE_SYMBOL] || /* @__PURE__ */ new Map();
|
|
1159
|
+
const result = transformWorkflow(payload.payload, step[PRIMITIVE_CACHE_SYMBOL]);
|
|
1160
|
+
if (result && "data" in result) {
|
|
1161
|
+
const data = result.data;
|
|
1162
|
+
step.task = data;
|
|
1163
|
+
if (data.name && step.task) {
|
|
1164
|
+
step.task.id = data.name;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
900
1168
|
if (isDataChunkType(payload)) {
|
|
901
1169
|
if (!("data" in payload)) {
|
|
902
1170
|
throw new Error(
|
|
@@ -904,31 +1172,73 @@ function transformNetwork(payload, bufferedNetworks, isNested) {
|
|
|
904
1172
|
${JSON.stringify(payload)}`
|
|
905
1173
|
);
|
|
906
1174
|
}
|
|
907
|
-
|
|
1175
|
+
const { type, data } = payload;
|
|
1176
|
+
return { type, data };
|
|
1177
|
+
}
|
|
1178
|
+
if (isAgentExecutionDataChunkType(payload)) {
|
|
1179
|
+
if (!("data" in payload.payload)) {
|
|
1180
|
+
throw new Error(
|
|
1181
|
+
`UI Messages require a data property when using data- prefixed chunks
|
|
1182
|
+
${JSON.stringify(payload)}`
|
|
1183
|
+
);
|
|
1184
|
+
}
|
|
1185
|
+
const { type, data } = payload.payload;
|
|
1186
|
+
return { type, data };
|
|
1187
|
+
}
|
|
1188
|
+
if (isWorkflowExecutionDataChunkType(payload)) {
|
|
1189
|
+
if (!("data" in payload.payload)) {
|
|
1190
|
+
throw new Error(
|
|
1191
|
+
`UI Messages require a data property when using data- prefixed chunks
|
|
1192
|
+
${JSON.stringify(payload)}`
|
|
1193
|
+
);
|
|
1194
|
+
}
|
|
1195
|
+
const { type, data } = payload.payload;
|
|
1196
|
+
return { type, data };
|
|
908
1197
|
}
|
|
909
1198
|
return null;
|
|
910
1199
|
}
|
|
911
1200
|
}
|
|
912
1201
|
}
|
|
913
1202
|
|
|
914
|
-
// src/
|
|
915
|
-
function
|
|
1203
|
+
// src/convert-streams.ts
|
|
1204
|
+
function toAISdkV5Stream(stream, options = {
|
|
1205
|
+
from: "agent",
|
|
1206
|
+
sendStart: true,
|
|
1207
|
+
sendFinish: true
|
|
1208
|
+
}) {
|
|
916
1209
|
const from = options?.from;
|
|
917
1210
|
if (from === "workflow") {
|
|
918
|
-
|
|
1211
|
+
const includeTextStreamParts = options?.includeTextStreamParts ?? true;
|
|
1212
|
+
return stream.pipeThrough(
|
|
1213
|
+
WorkflowStreamToAISDKTransformer({ includeTextStreamParts })
|
|
1214
|
+
);
|
|
919
1215
|
}
|
|
920
1216
|
if (from === "network") {
|
|
921
1217
|
return stream.pipeThrough(AgentNetworkToAISDKTransformer());
|
|
922
1218
|
}
|
|
923
1219
|
const agentReadable = "fullStream" in stream ? stream.fullStream : stream;
|
|
924
|
-
return agentReadable.pipeThrough(
|
|
1220
|
+
return agentReadable.pipeThrough(
|
|
1221
|
+
AgentStreamToAISDKTransformer({
|
|
1222
|
+
lastMessageId: options?.lastMessageId,
|
|
1223
|
+
sendStart: options?.sendStart,
|
|
1224
|
+
sendFinish: options?.sendFinish,
|
|
1225
|
+
sendReasoning: options?.sendReasoning,
|
|
1226
|
+
sendSources: options?.sendSources,
|
|
1227
|
+
messageMetadata: options?.messageMetadata,
|
|
1228
|
+
onError: options?.onError
|
|
1229
|
+
})
|
|
1230
|
+
);
|
|
925
1231
|
}
|
|
926
1232
|
|
|
927
1233
|
// src/chat-route.ts
|
|
928
1234
|
function chatRoute({
|
|
929
1235
|
path = "/chat/:agentId",
|
|
930
1236
|
agent,
|
|
931
|
-
defaultOptions
|
|
1237
|
+
defaultOptions,
|
|
1238
|
+
sendStart = true,
|
|
1239
|
+
sendFinish = true,
|
|
1240
|
+
sendReasoning = false,
|
|
1241
|
+
sendSources = false
|
|
932
1242
|
}) {
|
|
933
1243
|
if (!agent && !path.includes("/:agentId")) {
|
|
934
1244
|
throw new Error("Path must include :agentId to route to the correct agent or pass the agent explicitly");
|
|
@@ -1029,7 +1339,7 @@ function chatRoute({
|
|
|
1029
1339
|
handler: async (c) => {
|
|
1030
1340
|
const { messages, ...rest } = await c.req.json();
|
|
1031
1341
|
const mastra = c.get("mastra");
|
|
1032
|
-
const
|
|
1342
|
+
const requestContext = c.get("requestContext");
|
|
1033
1343
|
let agentToUse = agent;
|
|
1034
1344
|
if (!agent) {
|
|
1035
1345
|
const agentId = c.req.param("agentId");
|
|
@@ -1040,25 +1350,36 @@ function chatRoute({
|
|
|
1040
1350
|
`Fixed agent ID was set together with an agentId path parameter. This can lead to unexpected behavior.`
|
|
1041
1351
|
);
|
|
1042
1352
|
}
|
|
1043
|
-
if (
|
|
1044
|
-
mastra.getLogger()?.warn(`"
|
|
1353
|
+
if (requestContext && defaultOptions?.requestContext) {
|
|
1354
|
+
mastra.getLogger()?.warn(`"requestContext" set in the route options will be overridden by the request's "requestContext".`);
|
|
1045
1355
|
}
|
|
1046
1356
|
if (!agentToUse) {
|
|
1047
1357
|
throw new Error("Agent ID is required");
|
|
1048
1358
|
}
|
|
1049
|
-
const agentObj = mastra.
|
|
1359
|
+
const agentObj = mastra.getAgentById(agentToUse);
|
|
1050
1360
|
if (!agentObj) {
|
|
1051
1361
|
throw new Error(`Agent ${agentToUse} not found`);
|
|
1052
1362
|
}
|
|
1053
1363
|
const result = await agentObj.stream(messages, {
|
|
1054
1364
|
...defaultOptions,
|
|
1055
1365
|
...rest,
|
|
1056
|
-
|
|
1366
|
+
requestContext: requestContext || defaultOptions?.requestContext
|
|
1057
1367
|
});
|
|
1368
|
+
let lastMessageId;
|
|
1369
|
+
if (messages.length > 0 && messages[messages.length - 1].role === "assistant") {
|
|
1370
|
+
lastMessageId = messages[messages.length - 1].id;
|
|
1371
|
+
}
|
|
1058
1372
|
const uiMessageStream = createUIMessageStream({
|
|
1059
1373
|
originalMessages: messages,
|
|
1060
1374
|
execute: async ({ writer }) => {
|
|
1061
|
-
for await (const part of
|
|
1375
|
+
for await (const part of toAISdkV5Stream(result, {
|
|
1376
|
+
from: "agent",
|
|
1377
|
+
lastMessageId,
|
|
1378
|
+
sendStart,
|
|
1379
|
+
sendFinish,
|
|
1380
|
+
sendReasoning,
|
|
1381
|
+
sendSources
|
|
1382
|
+
})) {
|
|
1062
1383
|
writer.write(part);
|
|
1063
1384
|
}
|
|
1064
1385
|
}
|
|
@@ -1071,7 +1392,8 @@ function chatRoute({
|
|
|
1071
1392
|
}
|
|
1072
1393
|
function workflowRoute({
|
|
1073
1394
|
path = "/api/workflows/:workflowId/stream",
|
|
1074
|
-
workflow
|
|
1395
|
+
workflow,
|
|
1396
|
+
includeTextStreamParts = true
|
|
1075
1397
|
}) {
|
|
1076
1398
|
if (!workflow && !path.includes("/:workflowId")) {
|
|
1077
1399
|
throw new Error("Path must include :workflowId to route to the correct workflow or pass the workflow explicitly");
|
|
@@ -1098,9 +1420,13 @@ function workflowRoute({
|
|
|
1098
1420
|
schema: {
|
|
1099
1421
|
type: "object",
|
|
1100
1422
|
properties: {
|
|
1423
|
+
runId: { type: "string" },
|
|
1424
|
+
resourceId: { type: "string" },
|
|
1101
1425
|
inputData: { type: "object", additionalProperties: true },
|
|
1102
|
-
|
|
1103
|
-
|
|
1426
|
+
resumeData: { type: "object", additionalProperties: true },
|
|
1427
|
+
requestContext: { type: "object", additionalProperties: true },
|
|
1428
|
+
tracingOptions: { type: "object", additionalProperties: true },
|
|
1429
|
+
step: { type: "string" }
|
|
1104
1430
|
}
|
|
1105
1431
|
}
|
|
1106
1432
|
}
|
|
@@ -1118,8 +1444,9 @@ function workflowRoute({
|
|
|
1118
1444
|
}
|
|
1119
1445
|
},
|
|
1120
1446
|
handler: async (c) => {
|
|
1121
|
-
const { inputData, ...rest } = await c.req.json();
|
|
1447
|
+
const { runId, resourceId, inputData, resumeData, ...rest } = await c.req.json();
|
|
1122
1448
|
const mastra = c.get("mastra");
|
|
1449
|
+
const requestContext = c.get("requestContext");
|
|
1123
1450
|
let workflowToUse = workflow;
|
|
1124
1451
|
if (!workflow) {
|
|
1125
1452
|
const workflowId = c.req.param("workflowId");
|
|
@@ -1133,15 +1460,20 @@ function workflowRoute({
|
|
|
1133
1460
|
if (!workflowToUse) {
|
|
1134
1461
|
throw new Error("Workflow ID is required");
|
|
1135
1462
|
}
|
|
1136
|
-
const workflowObj = mastra.
|
|
1463
|
+
const workflowObj = mastra.getWorkflowById(workflowToUse);
|
|
1137
1464
|
if (!workflowObj) {
|
|
1138
1465
|
throw new Error(`Workflow ${workflowToUse} not found`);
|
|
1139
1466
|
}
|
|
1140
|
-
|
|
1141
|
-
|
|
1467
|
+
if (requestContext && rest.requestContext) {
|
|
1468
|
+
mastra.getLogger()?.warn(
|
|
1469
|
+
`"requestContext" from the request body will be ignored because "requestContext" is already set in the route options.`
|
|
1470
|
+
);
|
|
1471
|
+
}
|
|
1472
|
+
const run = await workflowObj.createRun({ runId, resourceId, ...rest });
|
|
1473
|
+
const stream = resumeData ? run.resumeStream({ resumeData, ...rest, requestContext: requestContext || rest.requestContext }) : run.stream({ inputData, ...rest, requestContext: requestContext || rest.requestContext });
|
|
1142
1474
|
const uiMessageStream = createUIMessageStream({
|
|
1143
1475
|
execute: async ({ writer }) => {
|
|
1144
|
-
for await (const part of
|
|
1476
|
+
for await (const part of toAISdkV5Stream(stream, { from: "workflow", includeTextStreamParts })) {
|
|
1145
1477
|
writer.write(part);
|
|
1146
1478
|
}
|
|
1147
1479
|
}
|
|
@@ -1181,13 +1513,12 @@ function networkRoute({
|
|
|
1181
1513
|
type: "object",
|
|
1182
1514
|
properties: {
|
|
1183
1515
|
messages: { type: "array", items: { type: "object" } },
|
|
1184
|
-
|
|
1516
|
+
requestContext: { type: "object", additionalProperties: true },
|
|
1185
1517
|
runId: { type: "string" },
|
|
1186
1518
|
maxSteps: { type: "number" },
|
|
1187
1519
|
threadId: { type: "string" },
|
|
1188
1520
|
resourceId: { type: "string" },
|
|
1189
1521
|
modelSettings: { type: "object", additionalProperties: true },
|
|
1190
|
-
telemetry: { type: "object", additionalProperties: true },
|
|
1191
1522
|
tools: { type: "array", items: { type: "object" } }
|
|
1192
1523
|
},
|
|
1193
1524
|
required: ["messages"]
|
|
@@ -1226,7 +1557,7 @@ function networkRoute({
|
|
|
1226
1557
|
if (!agentToUse) {
|
|
1227
1558
|
throw new Error("Agent ID is required");
|
|
1228
1559
|
}
|
|
1229
|
-
const agentObj = mastra.
|
|
1560
|
+
const agentObj = mastra.getAgentById(agentToUse);
|
|
1230
1561
|
if (!agentObj) {
|
|
1231
1562
|
throw new Error(`Agent ${agentToUse} not found`);
|
|
1232
1563
|
}
|
|
@@ -1236,7 +1567,7 @@ function networkRoute({
|
|
|
1236
1567
|
});
|
|
1237
1568
|
const uiMessageStream = createUIMessageStream({
|
|
1238
1569
|
execute: async ({ writer }) => {
|
|
1239
|
-
for await (const part of
|
|
1570
|
+
for await (const part of toAISdkV5Stream(result, { from: "network" })) {
|
|
1240
1571
|
writer.write(part);
|
|
1241
1572
|
}
|
|
1242
1573
|
}
|
|
@@ -1246,6 +1577,13 @@ function networkRoute({
|
|
|
1246
1577
|
});
|
|
1247
1578
|
}
|
|
1248
1579
|
|
|
1249
|
-
|
|
1580
|
+
// src/to-ai-sdk-format.ts
|
|
1581
|
+
function toAISdkFormat() {
|
|
1582
|
+
throw new Error(
|
|
1583
|
+
'toAISdkFormat() has been deprecated. Please use toAISdkStream() instead.\n\nMigration:\n import { toAISdkFormat } from "@mastra/ai-sdk";\n // Change to:\n import { toAISdkStream } from "@mastra/ai-sdk";\n\nThe function signature remains the same.'
|
|
1584
|
+
);
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
export { chatRoute, networkRoute, toAISdkFormat, toAISdkV5Stream as toAISdkStream, workflowRoute };
|
|
1250
1588
|
//# sourceMappingURL=index.js.map
|
|
1251
1589
|
//# sourceMappingURL=index.js.map
|