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