@mastra/server 0.0.0-vnextAgentNetwork-20250527111332 → 0.0.0-vnextAgentNetwork-20250602134426
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/dist/_tsup-dts-rollup.d.cts +148 -12
- package/dist/_tsup-dts-rollup.d.ts +148 -12
- package/dist/{chunk-D4IRYCUI.cjs → chunk-A3KDUGS7.cjs} +6 -2
- package/dist/{chunk-MHKNLNAN.cjs → chunk-B4MQFJ7G.cjs} +5 -2
- package/dist/{chunk-OR3CIE2H.js → chunk-BFOA2QQY.js} +5 -2
- package/dist/{chunk-YBVOQN4M.cjs → chunk-CMMOIUFC.cjs} +20 -0
- package/dist/{chunk-HFWCEP5S.js → chunk-CP55EVBK.js} +20 -1
- package/dist/{chunk-WFBJJNCK.js → chunk-DQLE3DVM.js} +0 -1
- package/dist/{chunk-P6SCPDYW.js → chunk-GHC4YV6R.js} +5 -1
- package/dist/{chunk-WUC6LSTW.js → chunk-J3PKLB3A.js} +6 -2
- package/dist/{chunk-7DLZLWJV.cjs → chunk-NEOOQUKW.cjs} +0 -1
- package/dist/{chunk-5SN4U5AC.cjs → chunk-SDPGVWQJ.cjs} +5 -1
- package/dist/server/handlers/a2a.cjs +7 -7
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/telemetry.cjs +3 -3
- package/dist/server/handlers/telemetry.js +1 -1
- package/dist/server/handlers/vNextNetwork.cjs +173 -0
- package/dist/server/handlers/vNextNetwork.d.cts +5 -0
- package/dist/server/handlers/vNextNetwork.d.ts +5 -0
- package/dist/server/handlers/vNextNetwork.js +167 -0
- package/dist/server/handlers/voice.cjs +8 -4
- package/dist/server/handlers/voice.d.cts +1 -0
- package/dist/server/handlers/voice.d.ts +1 -0
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers.cjs +10 -10
- package/dist/server/handlers.js +5 -5
- package/package.json +4 -4
|
@@ -17,9 +17,8 @@ import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
|
|
|
17
17
|
import type { LegacyWorkflowRuns } from '@mastra/core/storage';
|
|
18
18
|
import type { Mastra } from '@mastra/core/mastra';
|
|
19
19
|
import type { MastraMemory } from '@mastra/core/memory';
|
|
20
|
-
import {
|
|
21
|
-
import type { Message
|
|
22
|
-
import { MessageType } from '@mastra/core/memory';
|
|
20
|
+
import { MastraMessageV1 } from '@mastra/core/memory';
|
|
21
|
+
import type { Message } from '@mastra/core/a2a';
|
|
23
22
|
import type { QueryResult } from '@mastra/core/vector';
|
|
24
23
|
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
25
24
|
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
@@ -28,6 +27,7 @@ import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
|
|
|
28
27
|
import { Step } from '@mastra/core/workflows';
|
|
29
28
|
import { StepExecutionContext } from '@mastra/core/workflows/legacy';
|
|
30
29
|
import { StepGraph } from '@mastra/core/workflows/legacy';
|
|
30
|
+
import { StepResult } from '@mastra/core/workflows';
|
|
31
31
|
import { StorageThreadType } from '@mastra/core/memory';
|
|
32
32
|
import { Task } from '@mastra/core/a2a';
|
|
33
33
|
import { TaskAndHistory } from '@mastra/core/a2a';
|
|
@@ -37,13 +37,21 @@ import type { TaskQueryParams } from '@mastra/core/a2a';
|
|
|
37
37
|
import type { TaskSendParams } from '@mastra/core/a2a';
|
|
38
38
|
import type { TaskStatus } from '@mastra/core/a2a';
|
|
39
39
|
import type { ToolAction } from '@mastra/core/tools';
|
|
40
|
+
import { UIMessage } from 'ai';
|
|
40
41
|
import type { VercelTool } from '@mastra/core/tools';
|
|
41
42
|
import { WatchEvent } from '@mastra/core/workflows';
|
|
42
43
|
import type { Workflow } from '@mastra/core/workflows';
|
|
43
44
|
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
|
|
44
45
|
import { WorkflowResult } from '@mastra/core/workflows';
|
|
45
46
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
47
|
+
import { ZodBoolean } from 'zod';
|
|
48
|
+
import { ZodEnum } from 'zod';
|
|
49
|
+
import { ZodNumber } from 'zod';
|
|
50
|
+
import { ZodObject } from 'zod';
|
|
51
|
+
import { ZodOptional } from 'zod';
|
|
52
|
+
import { ZodString } from 'zod';
|
|
46
53
|
import { ZodType } from 'zod';
|
|
54
|
+
import { ZodTypeAny } from 'zod';
|
|
47
55
|
import { ZodTypeDef } from 'zod';
|
|
48
56
|
|
|
49
57
|
export declare namespace a2a {
|
|
@@ -81,7 +89,7 @@ export declare interface Context {
|
|
|
81
89
|
mastra: Mastra;
|
|
82
90
|
}
|
|
83
91
|
|
|
84
|
-
export declare function convertToCoreMessage(message:
|
|
92
|
+
export declare function convertToCoreMessage(message: Message): CoreMessage_2;
|
|
85
93
|
|
|
86
94
|
export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
|
|
87
95
|
|
|
@@ -105,8 +113,8 @@ export declare function createSuccessResponse<T>(id: number | string | null, res
|
|
|
105
113
|
|
|
106
114
|
export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
|
|
107
115
|
task: Task;
|
|
108
|
-
userMessage:
|
|
109
|
-
history:
|
|
116
|
+
userMessage: Message;
|
|
117
|
+
history: Message[];
|
|
110
118
|
activeCancellations: Set<string>;
|
|
111
119
|
}): TaskContext;
|
|
112
120
|
|
|
@@ -179,6 +187,18 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
|
|
|
179
187
|
};
|
|
180
188
|
}): Promise<NodeJS.ReadableStream>;
|
|
181
189
|
|
|
190
|
+
export declare function generateVNextNetworkHandler({ mastra, runtimeContext, networkId, body, }: NetworkContext_2 & {
|
|
191
|
+
runtimeContext: RuntimeContext;
|
|
192
|
+
body: {
|
|
193
|
+
message: string;
|
|
194
|
+
};
|
|
195
|
+
}): Promise<{
|
|
196
|
+
task: string;
|
|
197
|
+
result: string;
|
|
198
|
+
resourceId: string;
|
|
199
|
+
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
200
|
+
}>;
|
|
201
|
+
|
|
182
202
|
export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
183
203
|
runtimeContext: RuntimeContext;
|
|
184
204
|
agentId: string;
|
|
@@ -189,6 +209,8 @@ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }
|
|
|
189
209
|
workflows: {};
|
|
190
210
|
provider: string;
|
|
191
211
|
modelId: string;
|
|
212
|
+
defaultGenerateOptions: any;
|
|
213
|
+
defaultStreamOptions: any;
|
|
192
214
|
}>;
|
|
193
215
|
|
|
194
216
|
export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
|
|
@@ -254,6 +276,13 @@ export declare function getLegacyWorkflowRunsHandler({ mastra, workflowId, fromD
|
|
|
254
276
|
|
|
255
277
|
export declare function getLegacyWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
|
|
256
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Get available listeners for an agent
|
|
281
|
+
*/
|
|
282
|
+
export declare function getListenerHandler({ mastra, agentId }: VoiceContext): Promise<{
|
|
283
|
+
enabled: boolean;
|
|
284
|
+
}>;
|
|
285
|
+
|
|
257
286
|
export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
258
287
|
runtimeContext: RuntimeContext;
|
|
259
288
|
agentId: string;
|
|
@@ -280,7 +309,7 @@ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }
|
|
|
280
309
|
limit?: number;
|
|
281
310
|
}): Promise<{
|
|
282
311
|
messages: CoreMessage[];
|
|
283
|
-
uiMessages:
|
|
312
|
+
uiMessages: UIMessage[];
|
|
284
313
|
}>;
|
|
285
314
|
|
|
286
315
|
export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
@@ -330,6 +359,48 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
|
|
|
330
359
|
|
|
331
360
|
export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
|
|
332
361
|
|
|
362
|
+
export declare function getVNextNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
363
|
+
id: string;
|
|
364
|
+
name: string;
|
|
365
|
+
instructions: string;
|
|
366
|
+
agents: {
|
|
367
|
+
name: string;
|
|
368
|
+
provider: string;
|
|
369
|
+
modelId: string;
|
|
370
|
+
}[];
|
|
371
|
+
workflows: {
|
|
372
|
+
name: string | undefined;
|
|
373
|
+
description: string | undefined;
|
|
374
|
+
inputSchema: string | undefined;
|
|
375
|
+
outputSchema: string | undefined;
|
|
376
|
+
}[];
|
|
377
|
+
routingModel: {
|
|
378
|
+
provider: string;
|
|
379
|
+
modelId: string;
|
|
380
|
+
};
|
|
381
|
+
}>;
|
|
382
|
+
|
|
383
|
+
export declare function getVNextNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'runtimeContext'>): Promise<{
|
|
384
|
+
id: string;
|
|
385
|
+
name: string;
|
|
386
|
+
instructions: string;
|
|
387
|
+
agents: {
|
|
388
|
+
name: string;
|
|
389
|
+
provider: string;
|
|
390
|
+
modelId: string;
|
|
391
|
+
}[];
|
|
392
|
+
workflows: {
|
|
393
|
+
name: string | undefined;
|
|
394
|
+
description: string | undefined;
|
|
395
|
+
inputSchema: string | undefined;
|
|
396
|
+
outputSchema: string | undefined;
|
|
397
|
+
}[];
|
|
398
|
+
routingModel: {
|
|
399
|
+
provider: string;
|
|
400
|
+
modelId: string;
|
|
401
|
+
};
|
|
402
|
+
}[]>;
|
|
403
|
+
|
|
333
404
|
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
|
|
334
405
|
steps: SerializedStep[];
|
|
335
406
|
name: string | undefined;
|
|
@@ -368,20 +439,22 @@ export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }
|
|
|
368
439
|
taskId: string;
|
|
369
440
|
}): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
|
|
370
441
|
|
|
371
|
-
export declare function handleTaskSend({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
|
|
442
|
+
export declare function handleTaskSend({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
|
|
372
443
|
requestId: string;
|
|
373
444
|
params: TaskSendParams;
|
|
374
445
|
taskStore: InMemoryTaskStore;
|
|
375
446
|
agent: Agent;
|
|
447
|
+
agentId: string;
|
|
376
448
|
logger?: IMastraLogger;
|
|
377
449
|
runtimeContext: RuntimeContext;
|
|
378
450
|
}): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
|
|
379
451
|
|
|
380
|
-
export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
|
|
452
|
+
export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
|
|
381
453
|
requestId: string;
|
|
382
454
|
params: TaskSendParams;
|
|
383
455
|
taskStore: InMemoryTaskStore;
|
|
384
456
|
agent: Agent;
|
|
457
|
+
agentId: string;
|
|
385
458
|
logger?: IMastraLogger;
|
|
386
459
|
runtimeContext: RuntimeContext;
|
|
387
460
|
}): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
|
|
@@ -490,7 +563,7 @@ export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore,
|
|
|
490
563
|
agentId: string;
|
|
491
564
|
taskId: string;
|
|
492
565
|
taskStore: InMemoryTaskStore;
|
|
493
|
-
message:
|
|
566
|
+
message: Message;
|
|
494
567
|
sessionId?: string | null;
|
|
495
568
|
metadata?: Record<string, unknown> | null;
|
|
496
569
|
logger?: IMastraLogger;
|
|
@@ -510,6 +583,22 @@ declare type LogsContext = {
|
|
|
510
583
|
runId?: string;
|
|
511
584
|
};
|
|
512
585
|
|
|
586
|
+
export declare function loopVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
|
|
587
|
+
runtimeContext: RuntimeContext;
|
|
588
|
+
body: {
|
|
589
|
+
message: string;
|
|
590
|
+
};
|
|
591
|
+
}): Promise<{
|
|
592
|
+
status: "success";
|
|
593
|
+
result: {
|
|
594
|
+
text: string;
|
|
595
|
+
iteration: number;
|
|
596
|
+
};
|
|
597
|
+
steps: {
|
|
598
|
+
[x: string]: StepResult<any, any, any, any> | StepResult<unknown, unknown, unknown, unknown>;
|
|
599
|
+
};
|
|
600
|
+
}>;
|
|
601
|
+
|
|
513
602
|
export declare namespace memory {
|
|
514
603
|
export {
|
|
515
604
|
getMemoryStatusHandler,
|
|
@@ -543,6 +632,11 @@ declare interface NetworkContext extends Context {
|
|
|
543
632
|
runtimeContext: RuntimeContext;
|
|
544
633
|
}
|
|
545
634
|
|
|
635
|
+
declare interface NetworkContext_2 extends Context {
|
|
636
|
+
networkId?: string;
|
|
637
|
+
runtimeContext: RuntimeContext;
|
|
638
|
+
}
|
|
639
|
+
|
|
546
640
|
export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
|
|
547
641
|
|
|
548
642
|
declare interface QueryRequest {
|
|
@@ -600,7 +694,7 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
|
|
|
600
694
|
body: {
|
|
601
695
|
messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
|
|
602
696
|
};
|
|
603
|
-
}): Promise<
|
|
697
|
+
}): Promise<MastraMessageV1[]>;
|
|
604
698
|
|
|
605
699
|
declare type SerializedStep = {
|
|
606
700
|
id: string;
|
|
@@ -652,6 +746,10 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
|
|
|
652
746
|
status: string;
|
|
653
747
|
message: string;
|
|
654
748
|
error: any;
|
|
749
|
+
} | {
|
|
750
|
+
status: string;
|
|
751
|
+
message: string;
|
|
752
|
+
traceCount?: undefined;
|
|
655
753
|
} | {
|
|
656
754
|
status: string;
|
|
657
755
|
message: string;
|
|
@@ -674,6 +772,43 @@ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
|
|
|
674
772
|
} & Parameters<AgentNetwork['stream']>[1];
|
|
675
773
|
}): Promise<Response>;
|
|
676
774
|
|
|
775
|
+
export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
|
|
776
|
+
runtimeContext: RuntimeContext;
|
|
777
|
+
body: {
|
|
778
|
+
message: string;
|
|
779
|
+
};
|
|
780
|
+
}): Promise<{
|
|
781
|
+
stream: ReadableStream<WatchEvent>;
|
|
782
|
+
getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
|
|
783
|
+
task: ZodString;
|
|
784
|
+
resourceId: ZodString;
|
|
785
|
+
resourceType: ZodEnum<["agent", "workflow", "none", "tool", "none"]>;
|
|
786
|
+
prompt: ZodString;
|
|
787
|
+
result: ZodString;
|
|
788
|
+
isComplete: ZodOptional<ZodBoolean>;
|
|
789
|
+
completionReason: ZodOptional<ZodString>;
|
|
790
|
+
iteration: ZodNumber;
|
|
791
|
+
}, "strip", ZodTypeAny, {
|
|
792
|
+
prompt: string;
|
|
793
|
+
result: string;
|
|
794
|
+
resourceId: string;
|
|
795
|
+
task: string;
|
|
796
|
+
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
797
|
+
iteration: number;
|
|
798
|
+
isComplete?: boolean | undefined;
|
|
799
|
+
completionReason?: string | undefined;
|
|
800
|
+
}, {
|
|
801
|
+
prompt: string;
|
|
802
|
+
result: string;
|
|
803
|
+
resourceId: string;
|
|
804
|
+
task: string;
|
|
805
|
+
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
806
|
+
iteration: number;
|
|
807
|
+
isComplete?: boolean | undefined;
|
|
808
|
+
completionReason?: string | undefined;
|
|
809
|
+
}>, Step<string, any, any, ZodType<any, ZodTypeDef, any>, ZodType<any, ZodTypeDef, any>>[]>>;
|
|
810
|
+
}>;
|
|
811
|
+
|
|
677
812
|
export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
678
813
|
inputData?: unknown;
|
|
679
814
|
runtimeContext?: RuntimeContext_2;
|
|
@@ -787,7 +922,8 @@ export declare namespace voice {
|
|
|
787
922
|
export {
|
|
788
923
|
getSpeakersHandler,
|
|
789
924
|
generateSpeechHandler,
|
|
790
|
-
transcribeSpeechHandler
|
|
925
|
+
transcribeSpeechHandler,
|
|
926
|
+
getListenerHandler
|
|
791
927
|
}
|
|
792
928
|
}
|
|
793
929
|
|
|
@@ -17,9 +17,8 @@ import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
|
|
|
17
17
|
import type { LegacyWorkflowRuns } from '@mastra/core/storage';
|
|
18
18
|
import type { Mastra } from '@mastra/core/mastra';
|
|
19
19
|
import type { MastraMemory } from '@mastra/core/memory';
|
|
20
|
-
import {
|
|
21
|
-
import type { Message
|
|
22
|
-
import { MessageType } from '@mastra/core/memory';
|
|
20
|
+
import { MastraMessageV1 } from '@mastra/core/memory';
|
|
21
|
+
import type { Message } from '@mastra/core/a2a';
|
|
23
22
|
import type { QueryResult } from '@mastra/core/vector';
|
|
24
23
|
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
25
24
|
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
@@ -28,6 +27,7 @@ import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
|
|
|
28
27
|
import { Step } from '@mastra/core/workflows';
|
|
29
28
|
import { StepExecutionContext } from '@mastra/core/workflows/legacy';
|
|
30
29
|
import { StepGraph } from '@mastra/core/workflows/legacy';
|
|
30
|
+
import { StepResult } from '@mastra/core/workflows';
|
|
31
31
|
import { StorageThreadType } from '@mastra/core/memory';
|
|
32
32
|
import { Task } from '@mastra/core/a2a';
|
|
33
33
|
import { TaskAndHistory } from '@mastra/core/a2a';
|
|
@@ -37,13 +37,21 @@ import type { TaskQueryParams } from '@mastra/core/a2a';
|
|
|
37
37
|
import type { TaskSendParams } from '@mastra/core/a2a';
|
|
38
38
|
import type { TaskStatus } from '@mastra/core/a2a';
|
|
39
39
|
import type { ToolAction } from '@mastra/core/tools';
|
|
40
|
+
import { UIMessage } from 'ai';
|
|
40
41
|
import type { VercelTool } from '@mastra/core/tools';
|
|
41
42
|
import { WatchEvent } from '@mastra/core/workflows';
|
|
42
43
|
import type { Workflow } from '@mastra/core/workflows';
|
|
43
44
|
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
|
|
44
45
|
import { WorkflowResult } from '@mastra/core/workflows';
|
|
45
46
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
47
|
+
import { ZodBoolean } from 'zod';
|
|
48
|
+
import { ZodEnum } from 'zod';
|
|
49
|
+
import { ZodNumber } from 'zod';
|
|
50
|
+
import { ZodObject } from 'zod';
|
|
51
|
+
import { ZodOptional } from 'zod';
|
|
52
|
+
import { ZodString } from 'zod';
|
|
46
53
|
import { ZodType } from 'zod';
|
|
54
|
+
import { ZodTypeAny } from 'zod';
|
|
47
55
|
import { ZodTypeDef } from 'zod';
|
|
48
56
|
|
|
49
57
|
export declare namespace a2a {
|
|
@@ -81,7 +89,7 @@ export declare interface Context {
|
|
|
81
89
|
mastra: Mastra;
|
|
82
90
|
}
|
|
83
91
|
|
|
84
|
-
export declare function convertToCoreMessage(message:
|
|
92
|
+
export declare function convertToCoreMessage(message: Message): CoreMessage_2;
|
|
85
93
|
|
|
86
94
|
export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
|
|
87
95
|
|
|
@@ -105,8 +113,8 @@ export declare function createSuccessResponse<T>(id: number | string | null, res
|
|
|
105
113
|
|
|
106
114
|
export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
|
|
107
115
|
task: Task;
|
|
108
|
-
userMessage:
|
|
109
|
-
history:
|
|
116
|
+
userMessage: Message;
|
|
117
|
+
history: Message[];
|
|
110
118
|
activeCancellations: Set<string>;
|
|
111
119
|
}): TaskContext;
|
|
112
120
|
|
|
@@ -179,6 +187,18 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
|
|
|
179
187
|
};
|
|
180
188
|
}): Promise<NodeJS.ReadableStream>;
|
|
181
189
|
|
|
190
|
+
export declare function generateVNextNetworkHandler({ mastra, runtimeContext, networkId, body, }: NetworkContext_2 & {
|
|
191
|
+
runtimeContext: RuntimeContext;
|
|
192
|
+
body: {
|
|
193
|
+
message: string;
|
|
194
|
+
};
|
|
195
|
+
}): Promise<{
|
|
196
|
+
task: string;
|
|
197
|
+
result: string;
|
|
198
|
+
resourceId: string;
|
|
199
|
+
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
200
|
+
}>;
|
|
201
|
+
|
|
182
202
|
export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
183
203
|
runtimeContext: RuntimeContext;
|
|
184
204
|
agentId: string;
|
|
@@ -189,6 +209,8 @@ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }
|
|
|
189
209
|
workflows: {};
|
|
190
210
|
provider: string;
|
|
191
211
|
modelId: string;
|
|
212
|
+
defaultGenerateOptions: any;
|
|
213
|
+
defaultStreamOptions: any;
|
|
192
214
|
}>;
|
|
193
215
|
|
|
194
216
|
export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
|
|
@@ -254,6 +276,13 @@ export declare function getLegacyWorkflowRunsHandler({ mastra, workflowId, fromD
|
|
|
254
276
|
|
|
255
277
|
export declare function getLegacyWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
|
|
256
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Get available listeners for an agent
|
|
281
|
+
*/
|
|
282
|
+
export declare function getListenerHandler({ mastra, agentId }: VoiceContext): Promise<{
|
|
283
|
+
enabled: boolean;
|
|
284
|
+
}>;
|
|
285
|
+
|
|
257
286
|
export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
258
287
|
runtimeContext: RuntimeContext;
|
|
259
288
|
agentId: string;
|
|
@@ -280,7 +309,7 @@ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }
|
|
|
280
309
|
limit?: number;
|
|
281
310
|
}): Promise<{
|
|
282
311
|
messages: CoreMessage[];
|
|
283
|
-
uiMessages:
|
|
312
|
+
uiMessages: UIMessage[];
|
|
284
313
|
}>;
|
|
285
314
|
|
|
286
315
|
export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
@@ -330,6 +359,48 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
|
|
|
330
359
|
|
|
331
360
|
export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
|
|
332
361
|
|
|
362
|
+
export declare function getVNextNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
363
|
+
id: string;
|
|
364
|
+
name: string;
|
|
365
|
+
instructions: string;
|
|
366
|
+
agents: {
|
|
367
|
+
name: string;
|
|
368
|
+
provider: string;
|
|
369
|
+
modelId: string;
|
|
370
|
+
}[];
|
|
371
|
+
workflows: {
|
|
372
|
+
name: string | undefined;
|
|
373
|
+
description: string | undefined;
|
|
374
|
+
inputSchema: string | undefined;
|
|
375
|
+
outputSchema: string | undefined;
|
|
376
|
+
}[];
|
|
377
|
+
routingModel: {
|
|
378
|
+
provider: string;
|
|
379
|
+
modelId: string;
|
|
380
|
+
};
|
|
381
|
+
}>;
|
|
382
|
+
|
|
383
|
+
export declare function getVNextNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'runtimeContext'>): Promise<{
|
|
384
|
+
id: string;
|
|
385
|
+
name: string;
|
|
386
|
+
instructions: string;
|
|
387
|
+
agents: {
|
|
388
|
+
name: string;
|
|
389
|
+
provider: string;
|
|
390
|
+
modelId: string;
|
|
391
|
+
}[];
|
|
392
|
+
workflows: {
|
|
393
|
+
name: string | undefined;
|
|
394
|
+
description: string | undefined;
|
|
395
|
+
inputSchema: string | undefined;
|
|
396
|
+
outputSchema: string | undefined;
|
|
397
|
+
}[];
|
|
398
|
+
routingModel: {
|
|
399
|
+
provider: string;
|
|
400
|
+
modelId: string;
|
|
401
|
+
};
|
|
402
|
+
}[]>;
|
|
403
|
+
|
|
333
404
|
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
|
|
334
405
|
steps: SerializedStep[];
|
|
335
406
|
name: string | undefined;
|
|
@@ -368,20 +439,22 @@ export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }
|
|
|
368
439
|
taskId: string;
|
|
369
440
|
}): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
|
|
370
441
|
|
|
371
|
-
export declare function handleTaskSend({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
|
|
442
|
+
export declare function handleTaskSend({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
|
|
372
443
|
requestId: string;
|
|
373
444
|
params: TaskSendParams;
|
|
374
445
|
taskStore: InMemoryTaskStore;
|
|
375
446
|
agent: Agent;
|
|
447
|
+
agentId: string;
|
|
376
448
|
logger?: IMastraLogger;
|
|
377
449
|
runtimeContext: RuntimeContext;
|
|
378
450
|
}): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
|
|
379
451
|
|
|
380
|
-
export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
|
|
452
|
+
export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
|
|
381
453
|
requestId: string;
|
|
382
454
|
params: TaskSendParams;
|
|
383
455
|
taskStore: InMemoryTaskStore;
|
|
384
456
|
agent: Agent;
|
|
457
|
+
agentId: string;
|
|
385
458
|
logger?: IMastraLogger;
|
|
386
459
|
runtimeContext: RuntimeContext;
|
|
387
460
|
}): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
|
|
@@ -490,7 +563,7 @@ export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore,
|
|
|
490
563
|
agentId: string;
|
|
491
564
|
taskId: string;
|
|
492
565
|
taskStore: InMemoryTaskStore;
|
|
493
|
-
message:
|
|
566
|
+
message: Message;
|
|
494
567
|
sessionId?: string | null;
|
|
495
568
|
metadata?: Record<string, unknown> | null;
|
|
496
569
|
logger?: IMastraLogger;
|
|
@@ -510,6 +583,22 @@ declare type LogsContext = {
|
|
|
510
583
|
runId?: string;
|
|
511
584
|
};
|
|
512
585
|
|
|
586
|
+
export declare function loopVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
|
|
587
|
+
runtimeContext: RuntimeContext;
|
|
588
|
+
body: {
|
|
589
|
+
message: string;
|
|
590
|
+
};
|
|
591
|
+
}): Promise<{
|
|
592
|
+
status: "success";
|
|
593
|
+
result: {
|
|
594
|
+
text: string;
|
|
595
|
+
iteration: number;
|
|
596
|
+
};
|
|
597
|
+
steps: {
|
|
598
|
+
[x: string]: StepResult<any, any, any, any> | StepResult<unknown, unknown, unknown, unknown>;
|
|
599
|
+
};
|
|
600
|
+
}>;
|
|
601
|
+
|
|
513
602
|
export declare namespace memory {
|
|
514
603
|
export {
|
|
515
604
|
getMemoryStatusHandler,
|
|
@@ -543,6 +632,11 @@ declare interface NetworkContext extends Context {
|
|
|
543
632
|
runtimeContext: RuntimeContext;
|
|
544
633
|
}
|
|
545
634
|
|
|
635
|
+
declare interface NetworkContext_2 extends Context {
|
|
636
|
+
networkId?: string;
|
|
637
|
+
runtimeContext: RuntimeContext;
|
|
638
|
+
}
|
|
639
|
+
|
|
546
640
|
export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
|
|
547
641
|
|
|
548
642
|
declare interface QueryRequest {
|
|
@@ -600,7 +694,7 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
|
|
|
600
694
|
body: {
|
|
601
695
|
messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
|
|
602
696
|
};
|
|
603
|
-
}): Promise<
|
|
697
|
+
}): Promise<MastraMessageV1[]>;
|
|
604
698
|
|
|
605
699
|
declare type SerializedStep = {
|
|
606
700
|
id: string;
|
|
@@ -652,6 +746,10 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
|
|
|
652
746
|
status: string;
|
|
653
747
|
message: string;
|
|
654
748
|
error: any;
|
|
749
|
+
} | {
|
|
750
|
+
status: string;
|
|
751
|
+
message: string;
|
|
752
|
+
traceCount?: undefined;
|
|
655
753
|
} | {
|
|
656
754
|
status: string;
|
|
657
755
|
message: string;
|
|
@@ -674,6 +772,43 @@ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
|
|
|
674
772
|
} & Parameters<AgentNetwork['stream']>[1];
|
|
675
773
|
}): Promise<Response>;
|
|
676
774
|
|
|
775
|
+
export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
|
|
776
|
+
runtimeContext: RuntimeContext;
|
|
777
|
+
body: {
|
|
778
|
+
message: string;
|
|
779
|
+
};
|
|
780
|
+
}): Promise<{
|
|
781
|
+
stream: ReadableStream<WatchEvent>;
|
|
782
|
+
getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
|
|
783
|
+
task: ZodString;
|
|
784
|
+
resourceId: ZodString;
|
|
785
|
+
resourceType: ZodEnum<["agent", "workflow", "none", "tool", "none"]>;
|
|
786
|
+
prompt: ZodString;
|
|
787
|
+
result: ZodString;
|
|
788
|
+
isComplete: ZodOptional<ZodBoolean>;
|
|
789
|
+
completionReason: ZodOptional<ZodString>;
|
|
790
|
+
iteration: ZodNumber;
|
|
791
|
+
}, "strip", ZodTypeAny, {
|
|
792
|
+
prompt: string;
|
|
793
|
+
result: string;
|
|
794
|
+
resourceId: string;
|
|
795
|
+
task: string;
|
|
796
|
+
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
797
|
+
iteration: number;
|
|
798
|
+
isComplete?: boolean | undefined;
|
|
799
|
+
completionReason?: string | undefined;
|
|
800
|
+
}, {
|
|
801
|
+
prompt: string;
|
|
802
|
+
result: string;
|
|
803
|
+
resourceId: string;
|
|
804
|
+
task: string;
|
|
805
|
+
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
806
|
+
iteration: number;
|
|
807
|
+
isComplete?: boolean | undefined;
|
|
808
|
+
completionReason?: string | undefined;
|
|
809
|
+
}>, Step<string, any, any, ZodType<any, ZodTypeDef, any>, ZodType<any, ZodTypeDef, any>>[]>>;
|
|
810
|
+
}>;
|
|
811
|
+
|
|
677
812
|
export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
678
813
|
inputData?: unknown;
|
|
679
814
|
runtimeContext?: RuntimeContext_2;
|
|
@@ -787,7 +922,8 @@ export declare namespace voice {
|
|
|
787
922
|
export {
|
|
788
923
|
getSpeakersHandler,
|
|
789
924
|
generateSpeechHandler,
|
|
790
|
-
transcribeSpeechHandler
|
|
925
|
+
transcribeSpeechHandler,
|
|
926
|
+
getListenerHandler
|
|
791
927
|
}
|
|
792
928
|
}
|
|
793
929
|
|
|
@@ -58,7 +58,9 @@ async function getAgentsHandler({ mastra, runtimeContext }) {
|
|
|
58
58
|
tools: serializedAgentTools,
|
|
59
59
|
workflows: serializedAgentWorkflows,
|
|
60
60
|
provider: llm?.getProvider(),
|
|
61
|
-
modelId: llm?.getModelId()
|
|
61
|
+
modelId: llm?.getModelId(),
|
|
62
|
+
defaultGenerateOptions: agent.getDefaultGenerateOptions(),
|
|
63
|
+
defaultStreamOptions: agent.getDefaultStreamOptions()
|
|
62
64
|
};
|
|
63
65
|
})
|
|
64
66
|
);
|
|
@@ -116,7 +118,9 @@ async function getAgentByIdHandler({
|
|
|
116
118
|
tools: serializedAgentTools,
|
|
117
119
|
workflows: serializedAgentWorkflows,
|
|
118
120
|
provider: llm?.getProvider(),
|
|
119
|
-
modelId: llm?.getModelId()
|
|
121
|
+
modelId: llm?.getModelId(),
|
|
122
|
+
defaultGenerateOptions: agent.getDefaultGenerateOptions(),
|
|
123
|
+
defaultStreamOptions: agent.getDefaultStreamOptions()
|
|
120
124
|
};
|
|
121
125
|
} catch (error) {
|
|
122
126
|
return chunk64U3UDTH_cjs.handleError(error, "Error getting agent");
|
|
@@ -18,7 +18,7 @@ async function getTelemetryHandler({ mastra, body }) {
|
|
|
18
18
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Telemetry is not initialized" });
|
|
19
19
|
}
|
|
20
20
|
if (!storage) {
|
|
21
|
-
|
|
21
|
+
return [];
|
|
22
22
|
}
|
|
23
23
|
if (!body) {
|
|
24
24
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Body is required" });
|
|
@@ -49,7 +49,10 @@ async function storeTelemetryHandler({ mastra, body }) {
|
|
|
49
49
|
const storage = mastra.getStorage();
|
|
50
50
|
const logger = mastra.getLogger();
|
|
51
51
|
if (!storage) {
|
|
52
|
-
|
|
52
|
+
return {
|
|
53
|
+
status: "error",
|
|
54
|
+
message: "Storage is not initialized"
|
|
55
|
+
};
|
|
53
56
|
}
|
|
54
57
|
const now = /* @__PURE__ */ new Date();
|
|
55
58
|
const items = body?.resourceSpans?.[0]?.scopeSpans;
|
|
@@ -16,7 +16,7 @@ async function getTelemetryHandler({ mastra, body }) {
|
|
|
16
16
|
throw new HTTPException(400, { message: "Telemetry is not initialized" });
|
|
17
17
|
}
|
|
18
18
|
if (!storage) {
|
|
19
|
-
|
|
19
|
+
return [];
|
|
20
20
|
}
|
|
21
21
|
if (!body) {
|
|
22
22
|
throw new HTTPException(400, { message: "Body is required" });
|
|
@@ -47,7 +47,10 @@ async function storeTelemetryHandler({ mastra, body }) {
|
|
|
47
47
|
const storage = mastra.getStorage();
|
|
48
48
|
const logger = mastra.getLogger();
|
|
49
49
|
if (!storage) {
|
|
50
|
-
|
|
50
|
+
return {
|
|
51
|
+
status: "error",
|
|
52
|
+
message: "Storage is not initialized"
|
|
53
|
+
};
|
|
51
54
|
}
|
|
52
55
|
const now = /* @__PURE__ */ new Date();
|
|
53
56
|
const items = body?.resourceSpans?.[0]?.scopeSpans;
|