@mastra/server 0.10.7-alpha.0 → 0.10.7-alpha.2

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.
Files changed (31) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +147 -19
  2. package/dist/_tsup-dts-rollup.d.ts +147 -19
  3. package/dist/{chunk-WE32JG64.cjs → chunk-4DTDPTQC.cjs} +7 -7
  4. package/dist/{chunk-GPRXMWEQ.js → chunk-5UV7XQ4G.js} +1 -1
  5. package/dist/{chunk-NGURCFEJ.cjs → chunk-CPPYMJX5.cjs} +5 -5
  6. package/dist/{chunk-FYCCJXBC.cjs → chunk-E5IRS3XH.cjs} +5 -5
  7. package/dist/{chunk-JKTNRUKY.js → chunk-GKLL733B.js} +6 -42
  8. package/dist/{chunk-ASKESBJW.cjs → chunk-MN6F4D5A.cjs} +35 -35
  9. package/dist/{chunk-CLYX4KLH.js → chunk-N2YBMSO2.js} +1 -1
  10. package/dist/{chunk-TGJMNUYJ.js → chunk-OSZM4EAY.js} +35 -35
  11. package/dist/{chunk-6TJSHFCJ.cjs → chunk-RQ2Z56EC.cjs} +50 -20
  12. package/dist/{chunk-2HXKRRNS.js → chunk-XR7VJOOP.js} +1 -1
  13. package/dist/{chunk-I7KJZNX5.js → chunk-XUIJ7WRT.js} +50 -20
  14. package/dist/{chunk-FRXZL32L.cjs → chunk-ZYCTFFDB.cjs} +18 -54
  15. package/dist/server/handlers/agents.cjs +7 -7
  16. package/dist/server/handlers/agents.js +1 -1
  17. package/dist/server/handlers/legacyWorkflows.cjs +11 -11
  18. package/dist/server/handlers/legacyWorkflows.js +1 -1
  19. package/dist/server/handlers/memory.cjs +9 -9
  20. package/dist/server/handlers/memory.js +1 -1
  21. package/dist/server/handlers/tools.cjs +5 -5
  22. package/dist/server/handlers/tools.js +1 -1
  23. package/dist/server/handlers/vNextNetwork.cjs +175 -0
  24. package/dist/server/handlers/vNextNetwork.d.cts +5 -0
  25. package/dist/server/handlers/vNextNetwork.d.ts +5 -0
  26. package/dist/server/handlers/vNextNetwork.js +169 -0
  27. package/dist/server/handlers/workflows.cjs +13 -13
  28. package/dist/server/handlers/workflows.js +1 -1
  29. package/dist/server/handlers.cjs +10 -10
  30. package/dist/server/handlers.js +5 -5
  31. package/package.json +4 -4
@@ -5,6 +5,7 @@ import type { Artifact } from '@mastra/core/a2a';
5
5
  import type { BaseLogMessage } from '@mastra/core/logger';
6
6
  import { CoreMessage } from 'ai';
7
7
  import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
8
+ import { DefaultEngineType } from '@mastra/core/workflows';
8
9
  import { EvalRow } from '@mastra/core/storage';
9
10
  import { GenerateObjectResult } from 'ai';
10
11
  import { GenerateTextResult } from 'ai';
@@ -22,12 +23,14 @@ import { MastraMessageV1 } from '@mastra/core/memory';
22
23
  import type { Message } from '@mastra/core/a2a';
23
24
  import type { QueryResult } from '@mastra/core/vector';
24
25
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
26
+ import { ReadableStream as ReadableStream_3 } from 'stream/web';
25
27
  import { RuntimeContext } from '@mastra/core/runtime-context';
26
28
  import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
27
29
  import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
28
30
  import { Step } from '@mastra/core/workflows';
29
31
  import { StepExecutionContext } from '@mastra/core/workflows/legacy';
30
32
  import { StepGraph } from '@mastra/core/workflows/legacy';
33
+ import { StepResult } from '@mastra/core/workflows';
31
34
  import { StorageThreadType } from '@mastra/core/memory';
32
35
  import { StreamEvent } from '@mastra/core/workflows';
33
36
  import { Task } from '@mastra/core/a2a';
@@ -45,7 +48,14 @@ import type { Workflow } from '@mastra/core/workflows';
45
48
  import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
46
49
  import { WorkflowResult } from '@mastra/core/workflows';
47
50
  import type { WorkflowRuns } from '@mastra/core/storage';
51
+ import { ZodBoolean } from 'zod';
52
+ import { ZodEnum } from 'zod';
53
+ import { ZodNumber } from 'zod';
54
+ import { ZodObject } from 'zod';
55
+ import { ZodOptional } from 'zod';
56
+ import { ZodString } from 'zod';
48
57
  import { ZodType } from 'zod';
58
+ import { ZodTypeAny } from 'zod';
49
59
  import { ZodTypeDef } from 'zod';
50
60
 
51
61
  export declare namespace a2a {
@@ -112,7 +122,7 @@ export declare function createTaskContext({ task, userMessage, history, activeCa
112
122
  activeCancellations: Set<string>;
113
123
  }): TaskContext;
114
124
 
115
- export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
125
+ export declare function createThreadHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
116
126
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
117
127
  resourceId?: string;
118
128
  };
@@ -128,7 +138,7 @@ export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<Vec
128
138
  success: boolean;
129
139
  }>;
130
140
 
131
- export declare function deleteThreadHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
141
+ export declare function deleteThreadHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<{
132
142
  result: string;
133
143
  }>;
134
144
 
@@ -179,6 +189,20 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
179
189
  };
180
190
  }): Promise<NodeJS.ReadableStream>;
181
191
 
192
+ export declare function generateVNextNetworkHandler({ mastra, runtimeContext, networkId, body, }: NetworkContext_2 & {
193
+ runtimeContext: RuntimeContext;
194
+ body: {
195
+ message: string;
196
+ threadId?: string;
197
+ resourceId?: string;
198
+ };
199
+ }): Promise<{
200
+ task: string;
201
+ result: string;
202
+ resourceId: string;
203
+ resourceType: "none" | "tool" | "workflow" | "agent";
204
+ }>;
205
+
182
206
  export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, isPlayground, }: Context & {
183
207
  isPlayground?: boolean;
184
208
  runtimeContext: RuntimeContext;
@@ -294,11 +318,11 @@ export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>
294
318
  transports: string[];
295
319
  }>;
296
320
 
297
- export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryContext, 'mastra' | 'agentId'>): Promise<{
321
+ export declare function getMemoryStatusHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
298
322
  result: boolean;
299
323
  }>;
300
324
 
301
- export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
325
+ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
302
326
  limit?: number;
303
327
  }): Promise<{
304
328
  messages: CoreMessage[];
@@ -344,14 +368,56 @@ export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): P
344
368
 
345
369
  export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<any[]>;
346
370
 
347
- export declare function getThreadByIdHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<StorageThreadType>;
371
+ export declare function getThreadByIdHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType>;
348
372
 
349
- export declare function getThreadsHandler({ mastra, agentId, resourceId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId'>): Promise<StorageThreadType[]>;
373
+ export declare function getThreadsHandler({ mastra, agentId, resourceId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType[]>;
350
374
 
351
375
  export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext, 'tools' | 'toolId'>): Promise<any>;
352
376
 
353
377
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
354
378
 
379
+ export declare function getVNextNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
380
+ id: string;
381
+ name: string;
382
+ instructions: string;
383
+ agents: {
384
+ name: string;
385
+ provider: string;
386
+ modelId: string;
387
+ }[];
388
+ workflows: {
389
+ name: string | undefined;
390
+ description: string | undefined;
391
+ inputSchema: string | undefined;
392
+ outputSchema: string | undefined;
393
+ }[];
394
+ routingModel: {
395
+ provider: string;
396
+ modelId: string;
397
+ };
398
+ }>;
399
+
400
+ export declare function getVNextNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'runtimeContext'>): Promise<{
401
+ id: string;
402
+ name: string;
403
+ instructions: string;
404
+ agents: {
405
+ name: string;
406
+ provider: string;
407
+ modelId: string;
408
+ }[];
409
+ workflows: {
410
+ name: string | undefined;
411
+ description: string | undefined;
412
+ inputSchema: string | undefined;
413
+ outputSchema: string | undefined;
414
+ }[];
415
+ routingModel: {
416
+ provider: string;
417
+ modelId: string;
418
+ };
419
+ }[]>;
420
+
355
421
  export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
356
422
  steps: SerializedStep[];
357
423
  name: string | undefined;
@@ -544,6 +610,22 @@ declare type LogsContext = {
544
610
  };
545
611
  };
546
612
 
613
+ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
614
+ runtimeContext: RuntimeContext;
615
+ body: {
616
+ message: string;
617
+ };
618
+ }): Promise<{
619
+ status: "success";
620
+ result: {
621
+ text: string;
622
+ iteration: number;
623
+ };
624
+ steps: {
625
+ [x: string]: StepResult<any, any, any, any> | StepResult<unknown, unknown, unknown, unknown>;
626
+ };
627
+ }>;
628
+
547
629
  export declare namespace memory {
548
630
  export {
549
631
  getMemoryStatusHandler,
@@ -561,6 +643,8 @@ declare interface MemoryContext extends Context {
561
643
  agentId?: string;
562
644
  resourceId?: string;
563
645
  threadId?: string;
646
+ networkId?: string;
647
+ runtimeContext?: RuntimeContext_2;
564
648
  }
565
649
 
566
650
  export declare namespace network {
@@ -577,6 +661,11 @@ declare interface NetworkContext extends Context {
577
661
  runtimeContext: RuntimeContext;
578
662
  }
579
663
 
664
+ declare interface NetworkContext_2 extends Context {
665
+ networkId?: string;
666
+ runtimeContext: RuntimeContext;
667
+ }
668
+
580
669
  export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
581
670
 
582
671
  declare interface QueryRequest {
@@ -601,12 +690,12 @@ export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, r
601
690
  runtimeContext: RuntimeContext;
602
691
  }): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
603
692
 
604
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext: payloadRuntimeContext, }: WorkflowContext_3 & {
693
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
605
694
  body: {
606
695
  step: string | string[];
607
696
  resumeData?: unknown;
608
697
  };
609
- runtimeContext?: Record<string, any>;
698
+ runtimeContext?: RuntimeContext_2;
610
699
  }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
611
700
 
612
701
  export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
@@ -619,17 +708,17 @@ export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId,
619
708
  message: string;
620
709
  }>;
621
710
 
622
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext: payloadRuntimeContext, }: WorkflowContext_3 & {
711
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
623
712
  body: {
624
713
  step: string | string[];
625
714
  resumeData?: unknown;
626
715
  };
627
- runtimeContext?: Record<string, any>;
716
+ runtimeContext?: RuntimeContext_2;
628
717
  }): Promise<{
629
718
  message: string;
630
719
  }>;
631
720
 
632
- export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
721
+ export declare function saveMessagesHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
633
722
  body: {
634
723
  messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
635
724
  };
@@ -651,9 +740,9 @@ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext
651
740
  runtimeContext: RuntimeContext;
652
741
  }): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
653
742
 
654
- export declare function startAsyncWorkflowHandler({ mastra, runtimeContext: payloadRuntimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
743
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
655
744
  inputData?: unknown;
656
- runtimeContext?: Record<string, any>;
745
+ runtimeContext?: RuntimeContext_2;
657
746
  }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
658
747
 
659
748
  export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
@@ -663,9 +752,9 @@ export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext,
663
752
  message: string;
664
753
  }>;
665
754
 
666
- export declare function startWorkflowRunHandler({ mastra, runtimeContext: payloadRuntimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
755
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
667
756
  inputData?: unknown;
668
- runtimeContext?: Record<string, any>;
757
+ runtimeContext?: RuntimeContext_2;
669
758
  }): Promise<{
670
759
  message: string;
671
760
  }>;
@@ -709,11 +798,50 @@ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
709
798
  } & Parameters<AgentNetwork['stream']>[1];
710
799
  }): Promise<Response>;
711
800
 
712
- export declare function streamWorkflowHandler({ mastra, runtimeContext: payloadRuntimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
801
+ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
802
+ runtimeContext: RuntimeContext;
803
+ body: {
804
+ message: string;
805
+ threadId?: string;
806
+ resourceId?: string;
807
+ };
808
+ }): Promise<{
809
+ stream: ReadableStream_3<StreamEvent>;
810
+ getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
811
+ task: ZodString;
812
+ resourceId: ZodString;
813
+ resourceType: ZodEnum<["agent", "workflow", "none", "tool", "none"]>;
814
+ prompt: ZodString;
815
+ result: ZodString;
816
+ isComplete: ZodOptional<ZodBoolean>;
817
+ completionReason: ZodOptional<ZodString>;
818
+ iteration: ZodNumber;
819
+ }, "strip", ZodTypeAny, {
820
+ prompt: string;
821
+ resourceId: string;
822
+ result: string;
823
+ task: string;
824
+ resourceType: "none" | "tool" | "workflow" | "agent";
825
+ iteration: number;
826
+ isComplete?: boolean | undefined;
827
+ completionReason?: string | undefined;
828
+ }, {
829
+ prompt: string;
830
+ resourceId: string;
831
+ result: string;
832
+ task: string;
833
+ resourceType: "none" | "tool" | "workflow" | "agent";
834
+ iteration: number;
835
+ isComplete?: boolean | undefined;
836
+ completionReason?: string | undefined;
837
+ }>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
838
+ }>;
839
+
840
+ export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
713
841
  inputData?: unknown;
714
- runtimeContext?: Record<string, any>;
842
+ runtimeContext?: RuntimeContext_2;
715
843
  }): Promise<{
716
- stream: globalThis.ReadableStream<StreamEvent>;
844
+ stream: ReadableStream_2<StreamEvent>;
717
845
  getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
718
846
  }>;
719
847
 
@@ -783,7 +911,7 @@ export declare type UnOfficalStatusCode = UnofficialStatusCode;
783
911
  */
784
912
  export declare type UnofficialStatusCode = -1;
785
913
 
786
- export declare function updateThreadHandler({ mastra, agentId, threadId, body, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
914
+ export declare function updateThreadHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
787
915
  body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
788
916
  }): Promise<StorageThreadType>;
789
917
 
@@ -5,6 +5,7 @@ import type { Artifact } from '@mastra/core/a2a';
5
5
  import type { BaseLogMessage } from '@mastra/core/logger';
6
6
  import { CoreMessage } from 'ai';
7
7
  import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
8
+ import { DefaultEngineType } from '@mastra/core/workflows';
8
9
  import { EvalRow } from '@mastra/core/storage';
9
10
  import { GenerateObjectResult } from 'ai';
10
11
  import { GenerateTextResult } from 'ai';
@@ -22,12 +23,14 @@ import { MastraMessageV1 } from '@mastra/core/memory';
22
23
  import type { Message } from '@mastra/core/a2a';
23
24
  import type { QueryResult } from '@mastra/core/vector';
24
25
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
26
+ import { ReadableStream as ReadableStream_3 } from 'stream/web';
25
27
  import { RuntimeContext } from '@mastra/core/runtime-context';
26
28
  import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
27
29
  import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
28
30
  import { Step } from '@mastra/core/workflows';
29
31
  import { StepExecutionContext } from '@mastra/core/workflows/legacy';
30
32
  import { StepGraph } from '@mastra/core/workflows/legacy';
33
+ import { StepResult } from '@mastra/core/workflows';
31
34
  import { StorageThreadType } from '@mastra/core/memory';
32
35
  import { StreamEvent } from '@mastra/core/workflows';
33
36
  import { Task } from '@mastra/core/a2a';
@@ -45,7 +48,14 @@ import type { Workflow } from '@mastra/core/workflows';
45
48
  import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
46
49
  import { WorkflowResult } from '@mastra/core/workflows';
47
50
  import type { WorkflowRuns } from '@mastra/core/storage';
51
+ import { ZodBoolean } from 'zod';
52
+ import { ZodEnum } from 'zod';
53
+ import { ZodNumber } from 'zod';
54
+ import { ZodObject } from 'zod';
55
+ import { ZodOptional } from 'zod';
56
+ import { ZodString } from 'zod';
48
57
  import { ZodType } from 'zod';
58
+ import { ZodTypeAny } from 'zod';
49
59
  import { ZodTypeDef } from 'zod';
50
60
 
51
61
  export declare namespace a2a {
@@ -112,7 +122,7 @@ export declare function createTaskContext({ task, userMessage, history, activeCa
112
122
  activeCancellations: Set<string>;
113
123
  }): TaskContext;
114
124
 
115
- export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
125
+ export declare function createThreadHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
116
126
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
117
127
  resourceId?: string;
118
128
  };
@@ -128,7 +138,7 @@ export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<Vec
128
138
  success: boolean;
129
139
  }>;
130
140
 
131
- export declare function deleteThreadHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
141
+ export declare function deleteThreadHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<{
132
142
  result: string;
133
143
  }>;
134
144
 
@@ -179,6 +189,20 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
179
189
  };
180
190
  }): Promise<NodeJS.ReadableStream>;
181
191
 
192
+ export declare function generateVNextNetworkHandler({ mastra, runtimeContext, networkId, body, }: NetworkContext_2 & {
193
+ runtimeContext: RuntimeContext;
194
+ body: {
195
+ message: string;
196
+ threadId?: string;
197
+ resourceId?: string;
198
+ };
199
+ }): Promise<{
200
+ task: string;
201
+ result: string;
202
+ resourceId: string;
203
+ resourceType: "none" | "tool" | "workflow" | "agent";
204
+ }>;
205
+
182
206
  export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, isPlayground, }: Context & {
183
207
  isPlayground?: boolean;
184
208
  runtimeContext: RuntimeContext;
@@ -294,11 +318,11 @@ export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>
294
318
  transports: string[];
295
319
  }>;
296
320
 
297
- export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryContext, 'mastra' | 'agentId'>): Promise<{
321
+ export declare function getMemoryStatusHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
298
322
  result: boolean;
299
323
  }>;
300
324
 
301
- export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
325
+ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
302
326
  limit?: number;
303
327
  }): Promise<{
304
328
  messages: CoreMessage[];
@@ -344,14 +368,56 @@ export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): P
344
368
 
345
369
  export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<any[]>;
346
370
 
347
- export declare function getThreadByIdHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<StorageThreadType>;
371
+ export declare function getThreadByIdHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType>;
348
372
 
349
- export declare function getThreadsHandler({ mastra, agentId, resourceId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId'>): Promise<StorageThreadType[]>;
373
+ export declare function getThreadsHandler({ mastra, agentId, resourceId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType[]>;
350
374
 
351
375
  export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext, 'tools' | 'toolId'>): Promise<any>;
352
376
 
353
377
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
354
378
 
379
+ export declare function getVNextNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
380
+ id: string;
381
+ name: string;
382
+ instructions: string;
383
+ agents: {
384
+ name: string;
385
+ provider: string;
386
+ modelId: string;
387
+ }[];
388
+ workflows: {
389
+ name: string | undefined;
390
+ description: string | undefined;
391
+ inputSchema: string | undefined;
392
+ outputSchema: string | undefined;
393
+ }[];
394
+ routingModel: {
395
+ provider: string;
396
+ modelId: string;
397
+ };
398
+ }>;
399
+
400
+ export declare function getVNextNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'runtimeContext'>): Promise<{
401
+ id: string;
402
+ name: string;
403
+ instructions: string;
404
+ agents: {
405
+ name: string;
406
+ provider: string;
407
+ modelId: string;
408
+ }[];
409
+ workflows: {
410
+ name: string | undefined;
411
+ description: string | undefined;
412
+ inputSchema: string | undefined;
413
+ outputSchema: string | undefined;
414
+ }[];
415
+ routingModel: {
416
+ provider: string;
417
+ modelId: string;
418
+ };
419
+ }[]>;
420
+
355
421
  export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
356
422
  steps: SerializedStep[];
357
423
  name: string | undefined;
@@ -544,6 +610,22 @@ declare type LogsContext = {
544
610
  };
545
611
  };
546
612
 
613
+ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
614
+ runtimeContext: RuntimeContext;
615
+ body: {
616
+ message: string;
617
+ };
618
+ }): Promise<{
619
+ status: "success";
620
+ result: {
621
+ text: string;
622
+ iteration: number;
623
+ };
624
+ steps: {
625
+ [x: string]: StepResult<any, any, any, any> | StepResult<unknown, unknown, unknown, unknown>;
626
+ };
627
+ }>;
628
+
547
629
  export declare namespace memory {
548
630
  export {
549
631
  getMemoryStatusHandler,
@@ -561,6 +643,8 @@ declare interface MemoryContext extends Context {
561
643
  agentId?: string;
562
644
  resourceId?: string;
563
645
  threadId?: string;
646
+ networkId?: string;
647
+ runtimeContext?: RuntimeContext_2;
564
648
  }
565
649
 
566
650
  export declare namespace network {
@@ -577,6 +661,11 @@ declare interface NetworkContext extends Context {
577
661
  runtimeContext: RuntimeContext;
578
662
  }
579
663
 
664
+ declare interface NetworkContext_2 extends Context {
665
+ networkId?: string;
666
+ runtimeContext: RuntimeContext;
667
+ }
668
+
580
669
  export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
581
670
 
582
671
  declare interface QueryRequest {
@@ -601,12 +690,12 @@ export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, r
601
690
  runtimeContext: RuntimeContext;
602
691
  }): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
603
692
 
604
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext: payloadRuntimeContext, }: WorkflowContext_3 & {
693
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
605
694
  body: {
606
695
  step: string | string[];
607
696
  resumeData?: unknown;
608
697
  };
609
- runtimeContext?: Record<string, any>;
698
+ runtimeContext?: RuntimeContext_2;
610
699
  }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
611
700
 
612
701
  export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
@@ -619,17 +708,17 @@ export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId,
619
708
  message: string;
620
709
  }>;
621
710
 
622
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext: payloadRuntimeContext, }: WorkflowContext_3 & {
711
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
623
712
  body: {
624
713
  step: string | string[];
625
714
  resumeData?: unknown;
626
715
  };
627
- runtimeContext?: Record<string, any>;
716
+ runtimeContext?: RuntimeContext_2;
628
717
  }): Promise<{
629
718
  message: string;
630
719
  }>;
631
720
 
632
- export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
721
+ export declare function saveMessagesHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
633
722
  body: {
634
723
  messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
635
724
  };
@@ -651,9 +740,9 @@ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext
651
740
  runtimeContext: RuntimeContext;
652
741
  }): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
653
742
 
654
- export declare function startAsyncWorkflowHandler({ mastra, runtimeContext: payloadRuntimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
743
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
655
744
  inputData?: unknown;
656
- runtimeContext?: Record<string, any>;
745
+ runtimeContext?: RuntimeContext_2;
657
746
  }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
658
747
 
659
748
  export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
@@ -663,9 +752,9 @@ export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext,
663
752
  message: string;
664
753
  }>;
665
754
 
666
- export declare function startWorkflowRunHandler({ mastra, runtimeContext: payloadRuntimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
755
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
667
756
  inputData?: unknown;
668
- runtimeContext?: Record<string, any>;
757
+ runtimeContext?: RuntimeContext_2;
669
758
  }): Promise<{
670
759
  message: string;
671
760
  }>;
@@ -709,11 +798,50 @@ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
709
798
  } & Parameters<AgentNetwork['stream']>[1];
710
799
  }): Promise<Response>;
711
800
 
712
- export declare function streamWorkflowHandler({ mastra, runtimeContext: payloadRuntimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
801
+ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
802
+ runtimeContext: RuntimeContext;
803
+ body: {
804
+ message: string;
805
+ threadId?: string;
806
+ resourceId?: string;
807
+ };
808
+ }): Promise<{
809
+ stream: ReadableStream_3<StreamEvent>;
810
+ getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
811
+ task: ZodString;
812
+ resourceId: ZodString;
813
+ resourceType: ZodEnum<["agent", "workflow", "none", "tool", "none"]>;
814
+ prompt: ZodString;
815
+ result: ZodString;
816
+ isComplete: ZodOptional<ZodBoolean>;
817
+ completionReason: ZodOptional<ZodString>;
818
+ iteration: ZodNumber;
819
+ }, "strip", ZodTypeAny, {
820
+ prompt: string;
821
+ resourceId: string;
822
+ result: string;
823
+ task: string;
824
+ resourceType: "none" | "tool" | "workflow" | "agent";
825
+ iteration: number;
826
+ isComplete?: boolean | undefined;
827
+ completionReason?: string | undefined;
828
+ }, {
829
+ prompt: string;
830
+ resourceId: string;
831
+ result: string;
832
+ task: string;
833
+ resourceType: "none" | "tool" | "workflow" | "agent";
834
+ iteration: number;
835
+ isComplete?: boolean | undefined;
836
+ completionReason?: string | undefined;
837
+ }>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
838
+ }>;
839
+
840
+ export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
713
841
  inputData?: unknown;
714
- runtimeContext?: Record<string, any>;
842
+ runtimeContext?: RuntimeContext_2;
715
843
  }): Promise<{
716
- stream: globalThis.ReadableStream<StreamEvent>;
844
+ stream: ReadableStream_2<StreamEvent>;
717
845
  getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
718
846
  }>;
719
847
 
@@ -783,7 +911,7 @@ export declare type UnOfficalStatusCode = UnofficialStatusCode;
783
911
  */
784
912
  export declare type UnofficialStatusCode = -1;
785
913
 
786
- export declare function updateThreadHandler({ mastra, agentId, threadId, body, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
914
+ export declare function updateThreadHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
787
915
  body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
788
916
  }): Promise<StorageThreadType>;
789
917