@mastra/server 0.0.0-taofeeqInngest-20250603090617 → 0.0.0-transpile-packages-20250724123433

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 (80) hide show
  1. package/LICENSE.md +11 -42
  2. package/dist/_tsup-dts-rollup.d.cts +390 -45
  3. package/dist/_tsup-dts-rollup.d.ts +390 -45
  4. package/dist/{chunk-OCWPVYNI.cjs → chunk-2KZFMI6P.cjs} +1 -0
  5. package/dist/{chunk-VPNDC2DI.cjs → chunk-2SLFAFTR.cjs} +12 -12
  6. package/dist/chunk-4D66QEKC.js +81 -0
  7. package/dist/{chunk-W7VCKPAD.js → chunk-5PQQ42EZ.js} +9 -9
  8. package/dist/{chunk-BNEY4P4P.cjs → chunk-7TP2LX5L.cjs} +16 -16
  9. package/dist/chunk-B2PAS2IB.cjs +514 -0
  10. package/dist/{chunk-J3PKLB3A.js → chunk-BK4XT6EG.js} +56 -17
  11. package/dist/chunk-CBFTEHOO.cjs +157 -0
  12. package/dist/{chunk-57CJTIPW.cjs → chunk-CCGRCYWJ.cjs} +2 -2
  13. package/dist/{chunk-C7564HUT.js → chunk-CRCR3ZUK.js} +3 -3
  14. package/dist/{chunk-ZE5AAC4I.cjs → chunk-FRVBFMO2.cjs} +26 -36
  15. package/dist/{chunk-DJJIUEL2.js → chunk-G4L7OMCA.js} +135 -26
  16. package/dist/{chunk-B4MQFJ7G.cjs → chunk-G7KH752Y.cjs} +5 -5
  17. package/dist/{chunk-KUNQFY2W.js → chunk-H7DMHBKY.js} +190 -57
  18. package/dist/{chunk-YIOVBYZH.cjs → chunk-JMLYCXMK.cjs} +43 -43
  19. package/dist/{chunk-CP55EVBK.js → chunk-KHZKYUNR.js} +15 -11
  20. package/dist/{chunk-NYN7KFXL.js → chunk-LCM566I4.js} +1 -0
  21. package/dist/chunk-LF7P5PLR.js +14 -0
  22. package/dist/{chunk-YWLUOY3D.cjs → chunk-LI436ITD.cjs} +107 -69
  23. package/dist/{chunk-TJKLBTFB.js → chunk-LRCAAFUA.js} +10 -20
  24. package/dist/{chunk-A3KDUGS7.cjs → chunk-LZ3VJXSO.cjs} +70 -31
  25. package/dist/{chunk-LIVAK2DM.js → chunk-MEGCYGBU.js} +108 -70
  26. package/dist/chunk-PZQDCRPV.cjs +16 -0
  27. package/dist/chunk-QGX47B5D.cjs +86 -0
  28. package/dist/{chunk-BFOA2QQY.js → chunk-RG473F6Y.js} +2 -2
  29. package/dist/{chunk-CMMOIUFC.cjs → chunk-RHSWAXKB.cjs} +34 -30
  30. package/dist/{chunk-H5PTF3Y4.js → chunk-RSEO4XPX.js} +1 -1
  31. package/dist/chunk-VULESSU5.js +149 -0
  32. package/dist/{chunk-55DOQLP6.js → chunk-WNVFNNWN.js} +2 -2
  33. package/dist/chunk-Z75RYULP.cjs +333 -0
  34. package/dist/server/handlers/agents.cjs +7 -7
  35. package/dist/server/handlers/agents.js +1 -1
  36. package/dist/server/handlers/error.cjs +2 -2
  37. package/dist/server/handlers/error.js +1 -1
  38. package/dist/server/handlers/legacyWorkflows.cjs +11 -11
  39. package/dist/server/handlers/legacyWorkflows.js +1 -1
  40. package/dist/server/handlers/logs.cjs +4 -4
  41. package/dist/server/handlers/logs.js +1 -1
  42. package/dist/server/handlers/memory.cjs +21 -9
  43. package/dist/server/handlers/memory.d.cts +3 -0
  44. package/dist/server/handlers/memory.d.ts +3 -0
  45. package/dist/server/handlers/memory.js +1 -1
  46. package/dist/server/handlers/network.cjs +5 -5
  47. package/dist/server/handlers/network.js +1 -1
  48. package/dist/server/handlers/scores.cjs +30 -0
  49. package/dist/server/handlers/scores.d.cts +6 -0
  50. package/dist/server/handlers/scores.d.ts +6 -0
  51. package/dist/server/handlers/scores.js +1 -0
  52. package/dist/server/handlers/telemetry.cjs +3 -3
  53. package/dist/server/handlers/telemetry.js +1 -1
  54. package/dist/server/handlers/tools.cjs +5 -5
  55. package/dist/server/handlers/tools.js +1 -1
  56. package/dist/server/handlers/utils.cjs +2 -2
  57. package/dist/server/handlers/utils.js +1 -1
  58. package/dist/server/handlers/vNextNetwork.cjs +218 -0
  59. package/dist/server/handlers/vNextNetwork.d.cts +6 -0
  60. package/dist/server/handlers/vNextNetwork.d.ts +6 -0
  61. package/dist/server/handlers/vNextNetwork.js +211 -0
  62. package/dist/server/handlers/vector.cjs +7 -7
  63. package/dist/server/handlers/vector.js +1 -1
  64. package/dist/server/handlers/voice.cjs +5 -5
  65. package/dist/server/handlers/voice.js +1 -1
  66. package/dist/server/handlers/workflows.cjs +24 -12
  67. package/dist/server/handlers/workflows.d.cts +3 -0
  68. package/dist/server/handlers/workflows.d.ts +3 -0
  69. package/dist/server/handlers/workflows.js +1 -1
  70. package/dist/server/handlers.cjs +28 -23
  71. package/dist/server/handlers.d.cts +3 -2
  72. package/dist/server/handlers.d.ts +3 -2
  73. package/dist/server/handlers.js +11 -10
  74. package/package.json +15 -15
  75. package/dist/chunk-64U3UDTH.cjs +0 -13
  76. package/dist/chunk-DQLE3DVM.js +0 -49
  77. package/dist/chunk-M5ABIP7D.js +0 -11
  78. package/dist/chunk-MMO2HDM6.cjs +0 -378
  79. package/dist/chunk-NEOOQUKW.cjs +0 -54
  80. package/dist/chunk-Y7UWRW5X.cjs +0 -221
@@ -5,7 +5,8 @@ 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 { EvalRow } from '@mastra/core/storage';
8
+ import { DefaultEngineType } from '@mastra/core';
9
+ import { EvalRow } from '@mastra/core';
9
10
  import { GenerateObjectResult } from 'ai';
10
11
  import { GenerateTextResult } from 'ai';
11
12
  import type { IMastraLogger } from '@mastra/core/logger';
@@ -15,19 +16,30 @@ import { LegacyStep } from '@mastra/core/workflows/legacy';
15
16
  import type { LegacyWorkflow } from '@mastra/core/workflows/legacy';
16
17
  import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
17
18
  import type { LegacyWorkflowRuns } from '@mastra/core/storage';
19
+ import type { LogLevel } from '@mastra/core/logger';
18
20
  import type { Mastra } from '@mastra/core/mastra';
21
+ import type { MastraError } from '@mastra/core/error';
19
22
  import type { MastraMemory } from '@mastra/core/memory';
20
- import { MastraMessageV1 } from '@mastra/core/memory';
23
+ import { MastraMessageV1 } from '@mastra/core';
24
+ import { MastraMessageV2 } from '@mastra/core';
25
+ import type { MastraScorerEntry } from '@mastra/core/scores';
21
26
  import type { Message } from '@mastra/core/a2a';
27
+ import { PaginationInfo } from '@mastra/core';
22
28
  import type { QueryResult } from '@mastra/core/vector';
23
29
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
30
+ import { ReadableStream as ReadableStream_3 } from 'stream/web';
24
31
  import { RuntimeContext } from '@mastra/core/runtime-context';
25
- import { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
32
+ import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
33
+ import type { ScoreRowData } from '@mastra/core/scores';
26
34
  import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
27
- import { Step } from '@mastra/core/workflows';
35
+ import { Step } from '@mastra/core';
28
36
  import { StepExecutionContext } from '@mastra/core/workflows/legacy';
29
37
  import { StepGraph } from '@mastra/core/workflows/legacy';
30
- import { StorageThreadType } from '@mastra/core/memory';
38
+ import { StepResult } from '@mastra/core';
39
+ import type { StorageGetMessagesArg } from '@mastra/core';
40
+ import type { StoragePagination } from '@mastra/core/storage';
41
+ import { StorageThreadType } from '@mastra/core';
42
+ import { StreamEvent } from '@mastra/core';
31
43
  import { Task } from '@mastra/core/a2a';
32
44
  import { TaskAndHistory } from '@mastra/core/a2a';
33
45
  import type { TaskContext } from '@mastra/core/a2a';
@@ -36,14 +48,23 @@ import type { TaskQueryParams } from '@mastra/core/a2a';
36
48
  import type { TaskSendParams } from '@mastra/core/a2a';
37
49
  import type { TaskStatus } from '@mastra/core/a2a';
38
50
  import type { ToolAction } from '@mastra/core/tools';
51
+ import { Trace } from '@mastra/core';
39
52
  import { UIMessage } from 'ai';
40
53
  import type { VercelTool } from '@mastra/core/tools';
41
- import { WatchEvent } from '@mastra/core/workflows';
54
+ import type { WatchEvent } from '@mastra/core/workflows';
42
55
  import type { Workflow } from '@mastra/core/workflows';
43
56
  import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
44
- import { WorkflowResult } from '@mastra/core/workflows';
57
+ import { WorkflowResult } from '@mastra/core';
45
58
  import type { WorkflowRuns } from '@mastra/core/storage';
59
+ import { WorkingMemoryTemplate } from '@mastra/core';
60
+ import { ZodBoolean } from 'zod';
61
+ import { ZodEnum } from 'zod';
62
+ import { ZodNumber } from 'zod';
63
+ import { ZodObject } from 'zod';
64
+ import { ZodOptional } from 'zod';
65
+ import { ZodString } from 'zod';
46
66
  import { ZodType } from 'zod';
67
+ import { ZodTypeAny } from 'zod';
47
68
  import { ZodTypeDef } from 'zod';
48
69
 
49
70
  export declare namespace a2a {
@@ -68,13 +89,17 @@ export declare namespace agents {
68
89
  }
69
90
  }
70
91
 
71
- export declare interface ApiError extends Error {
92
+ export declare interface ApiError extends MastraError {
72
93
  message: string;
73
94
  status?: number;
74
95
  }
75
96
 
76
97
  export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
77
98
 
99
+ export declare function cancelWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
100
+ message: string;
101
+ }>;
102
+
78
103
  declare type ClientErrorStatusCode = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451;
79
104
 
80
105
  export declare interface Context {
@@ -110,7 +135,7 @@ export declare function createTaskContext({ task, userMessage, history, activeCa
110
135
  activeCancellations: Set<string>;
111
136
  }): TaskContext;
112
137
 
113
- export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
138
+ export declare function createThreadHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
114
139
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
115
140
  resourceId?: string;
116
141
  };
@@ -126,7 +151,7 @@ export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<Vec
126
151
  success: boolean;
127
152
  }>;
128
153
 
129
- export declare function deleteThreadHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
154
+ export declare function deleteThreadHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<{
130
155
  result: string;
131
156
  }>;
132
157
 
@@ -140,27 +165,26 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
140
165
  metric: string | undefined;
141
166
  }>;
142
167
 
143
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
168
+ export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
144
169
  agentId?: string;
145
170
  data: any;
146
171
  runtimeContext: RuntimeContext_2;
147
- runtimeContextFromRequest: Record<string, unknown>;
148
172
  }): Promise<any>;
149
173
 
150
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
174
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
151
175
  data?: unknown;
152
176
  runtimeContext: RuntimeContext_2;
153
- runtimeContextFromRequest: Record<string, unknown>;
154
177
  }) => Promise<any>;
155
178
 
156
- export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
179
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
157
180
  runtimeContext: RuntimeContext;
158
181
  agentId: string;
159
182
  body: GetBody<'generate'> & {
160
183
  resourceid?: string;
161
184
  runtimeContext?: Record<string, unknown>;
162
185
  };
163
- }): Promise<GenerateTextResult<any, any>>;
186
+ abortSignal?: AbortSignal;
187
+ }): Promise<GenerateTextResult<any, unknown>>;
164
188
 
165
189
  export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
166
190
  runtimeContext: RuntimeContext;
@@ -179,7 +203,22 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
179
203
  };
180
204
  }): Promise<NodeJS.ReadableStream>;
181
205
 
182
- export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
206
+ export declare function generateVNextNetworkHandler({ mastra, runtimeContext, networkId, body, }: NetworkContext_2 & {
207
+ runtimeContext: RuntimeContext;
208
+ body: {
209
+ message: string;
210
+ threadId?: string;
211
+ resourceId?: string;
212
+ };
213
+ }): Promise<{
214
+ task: string;
215
+ result: string;
216
+ resourceId: string;
217
+ resourceType: "none" | "tool" | "workflow" | "agent";
218
+ }>;
219
+
220
+ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, isPlayground, }: Context & {
221
+ isPlayground?: boolean;
183
222
  runtimeContext: RuntimeContext;
184
223
  agentId: string;
185
224
  }): Promise<{
@@ -216,7 +255,17 @@ export declare function getAgentExecutionHandler({ requestId, mastra, agentId, r
216
255
 
217
256
  export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
218
257
  runtimeContext: RuntimeContext;
219
- }): Promise<any>;
258
+ }): Promise<Record<string, Omit<{
259
+ id: string;
260
+ name: any;
261
+ instructions: string;
262
+ tools: any;
263
+ workflows: {};
264
+ provider: string;
265
+ modelId: string;
266
+ defaultGenerateOptions: any;
267
+ defaultStreamOptions: any;
268
+ }, "id">>>;
220
269
 
221
270
  declare type GetBody<T extends keyof Agent & {
222
271
  [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
@@ -273,25 +322,41 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, a
273
322
  evals: EvalRow[];
274
323
  }>;
275
324
 
276
- export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<any[]>;
325
+ export declare function getLogsByRunIdHandler({ mastra, runId, transportId, params, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId' | 'params'>): Promise<{
326
+ logs: BaseLogMessage[];
327
+ total: number;
328
+ page: number;
329
+ perPage: number;
330
+ hasMore: boolean;
331
+ }>;
277
332
 
278
- export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
333
+ export declare function getLogsHandler({ mastra, transportId, params, }: Pick<LogsContext, 'mastra' | 'transportId' | 'params'>): Promise<{
334
+ logs: BaseLogMessage[];
335
+ total: number;
336
+ page: number;
337
+ perPage: number;
338
+ hasMore: boolean;
339
+ }>;
279
340
 
280
341
  export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
281
342
  transports: string[];
282
343
  }>;
283
344
 
284
- export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryContext, 'mastra' | 'agentId'>): Promise<{
345
+ export declare function getMemoryStatusHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
285
346
  result: boolean;
286
347
  }>;
287
348
 
288
- export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
349
+ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
289
350
  limit?: number;
290
351
  }): Promise<{
291
352
  messages: CoreMessage[];
292
353
  uiMessages: UIMessage[];
293
354
  }>;
294
355
 
356
+ export declare function getMessagesPaginatedHandler({ mastra, threadId, resourceId, selectBy, format, }: StorageGetMessagesArg & Pick<MemoryContext, 'mastra'>): Promise<PaginationInfo & {
357
+ messages: MastraMessageV1[] | MastraMessageV2[];
358
+ }>;
359
+
295
360
  export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
296
361
  id: string;
297
362
  name: string;
@@ -322,6 +387,50 @@ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<Net
322
387
  };
323
388
  }[]>;
324
389
 
390
+ export declare function getScorerHandler({ mastra, scorerId, runtimeContext, }: Context & {
391
+ scorerId: string;
392
+ runtimeContext: RuntimeContext;
393
+ }): Promise<(MastraScorerEntry & {
394
+ agentIds: string[];
395
+ workflowIds: string[];
396
+ }) | null>;
397
+
398
+ export declare function getScorersHandler({ mastra, runtimeContext }: Context & {
399
+ runtimeContext: RuntimeContext;
400
+ }): Promise<{
401
+ [k: string]: MastraScorerEntry & {
402
+ agentIds: string[];
403
+ workflowIds: string[];
404
+ };
405
+ }>;
406
+
407
+ export declare function getScoresByEntityIdHandler({ mastra, entityId, entityType, pagination, }: Context & {
408
+ entityId: string;
409
+ entityType: string;
410
+ pagination: StoragePagination;
411
+ }): Promise<never[] | {
412
+ pagination: PaginationInfo;
413
+ scores: ScoreRowData[];
414
+ }>;
415
+
416
+ export declare function getScoresByRunIdHandler({ mastra, runId, pagination, }: Context & {
417
+ runId: string;
418
+ pagination: StoragePagination;
419
+ }): Promise<never[] | {
420
+ pagination: PaginationInfo;
421
+ scores: ScoreRowData[];
422
+ }>;
423
+
424
+ export declare function getScoresByScorerIdHandler({ mastra, scorerId, pagination, entityId, entityType, }: Context & {
425
+ scorerId: string;
426
+ pagination: StoragePagination;
427
+ entityId?: string;
428
+ entityType?: string;
429
+ }): Promise<never[] | {
430
+ pagination: PaginationInfo;
431
+ scores: ScoreRowData[];
432
+ }>;
433
+
325
434
  /**
326
435
  * Get available speakers for an agent
327
436
  */
@@ -329,18 +438,69 @@ export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): P
329
438
  voiceId: string;
330
439
  }[]>;
331
440
 
332
- export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<any[]>;
441
+ export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<Trace[]>;
333
442
 
334
- export declare function getThreadByIdHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<StorageThreadType>;
443
+ export declare function getThreadByIdHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType>;
335
444
 
336
- export declare function getThreadsHandler({ mastra, agentId, resourceId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId'>): Promise<StorageThreadType[]>;
445
+ export declare function getThreadsHandler({ mastra, agentId, resourceId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType[]>;
337
446
 
338
447
  export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext, 'tools' | 'toolId'>): Promise<any>;
339
448
 
340
449
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
341
450
 
451
+ export declare function getVNextNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
452
+ id: string;
453
+ name: string;
454
+ instructions: string;
455
+ agents: {
456
+ name: string;
457
+ provider: string;
458
+ modelId: string;
459
+ }[];
460
+ workflows: {
461
+ name: string | undefined;
462
+ description: string | undefined;
463
+ inputSchema: string | undefined;
464
+ outputSchema: string | undefined;
465
+ }[];
466
+ tools: {
467
+ id: string;
468
+ description: string;
469
+ }[];
470
+ routingModel: {
471
+ provider: string;
472
+ modelId: string;
473
+ };
474
+ }>;
475
+
476
+ export declare function getVNextNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'runtimeContext'>): Promise<{
477
+ id: string;
478
+ name: string;
479
+ instructions: string;
480
+ tools: {
481
+ id: string;
482
+ description: string;
483
+ }[];
484
+ agents: {
485
+ name: string;
486
+ provider: string;
487
+ modelId: string;
488
+ }[];
489
+ workflows: {
490
+ name: string | undefined;
491
+ description: string | undefined;
492
+ inputSchema: string | undefined;
493
+ outputSchema: string | undefined;
494
+ }[];
495
+ routingModel: {
496
+ provider: string;
497
+ modelId: string;
498
+ };
499
+ }[]>;
500
+
342
501
  export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
343
- steps: SerializedStep[];
502
+ steps: Record<string, SerializedStep>;
503
+ allSteps: Record<string, SerializedStep>;
344
504
  name: string | undefined;
345
505
  description: string | undefined;
346
506
  stepGraph: SerializedStepFlowEntry[];
@@ -350,6 +510,8 @@ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowC
350
510
 
351
511
  export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
352
512
 
513
+ export declare function getWorkflowRunExecutionResultHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<WatchEvent['payload']['workflowState']>;
514
+
353
515
  export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
354
516
  fromDate?: Date;
355
517
  toDate?: Date;
@@ -360,6 +522,21 @@ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, t
360
522
 
361
523
  export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
362
524
 
525
+ /**
526
+ * Handler to get the working memory for a thread (optionally resource-scoped).
527
+ * @returns workingMemory - the working memory for the thread
528
+ * @returns source - thread or resource
529
+ */
530
+ export declare function getWorkingMemoryHandler({ mastra, agentId, threadId, resourceId, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
531
+ resourceId?: Parameters<MastraMemory['getWorkingMemory']>[0]['resourceId'];
532
+ memoryConfig?: Parameters<MastraMemory['getWorkingMemory']>[0]['memoryConfig'];
533
+ }): Promise<{
534
+ workingMemory: string | null;
535
+ source: string;
536
+ workingMemoryTemplate: WorkingMemoryTemplate | null;
537
+ threadExists: boolean;
538
+ }>;
539
+
363
540
  export declare function handleError(error: unknown, defaultMessage: string): never;
364
541
 
365
542
  export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
@@ -454,11 +631,13 @@ export declare class HTTPException extends Error {
454
631
  * @property res - Optional response object to use.
455
632
  * @property message - Optional custom error message.
456
633
  * @property cause - Optional cause of the error.
634
+ * @property stack - Optional stack trace for the error.
457
635
  */
458
636
  declare type HTTPExceptionOptions = {
459
637
  res?: Response;
460
638
  message?: string;
461
639
  cause?: unknown;
640
+ stack?: string;
462
641
  };
463
642
 
464
643
  /**
@@ -519,8 +698,81 @@ declare type LogsContext = {
519
698
  mastra: Mastra;
520
699
  transportId?: string;
521
700
  runId?: string;
701
+ params?: {
702
+ fromDate?: Date;
703
+ toDate?: Date;
704
+ logLevel?: LogLevel;
705
+ filters?: string | string[];
706
+ page?: number;
707
+ perPage?: number;
708
+ };
522
709
  };
523
710
 
711
+ export declare function loopStreamVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
712
+ runtimeContext: RuntimeContext;
713
+ body: {
714
+ message: string;
715
+ threadId?: string;
716
+ resourceId?: string;
717
+ maxIterations?: number;
718
+ };
719
+ }): Promise<{
720
+ stream: ReadableStream_3<StreamEvent>;
721
+ getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
722
+ task: ZodString;
723
+ resourceId: ZodString;
724
+ resourceType: ZodEnum<["agent", "workflow", "none", "tool", "none"]>;
725
+ prompt: ZodString;
726
+ result: ZodString;
727
+ isComplete: ZodOptional<ZodBoolean>;
728
+ completionReason: ZodOptional<ZodString>;
729
+ iteration: ZodNumber;
730
+ }, "strip", ZodTypeAny, {
731
+ prompt: string;
732
+ resourceId: string;
733
+ result: string;
734
+ task: string;
735
+ resourceType: "none" | "tool" | "workflow" | "agent";
736
+ iteration: number;
737
+ isComplete?: boolean | undefined;
738
+ completionReason?: string | undefined;
739
+ }, {
740
+ prompt: string;
741
+ resourceId: string;
742
+ result: string;
743
+ task: string;
744
+ resourceType: "none" | "tool" | "workflow" | "agent";
745
+ iteration: number;
746
+ isComplete?: boolean | undefined;
747
+ completionReason?: string | undefined;
748
+ }>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
749
+ }>;
750
+
751
+ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
752
+ runtimeContext: RuntimeContext;
753
+ body: {
754
+ message: string;
755
+ };
756
+ }): Promise<{
757
+ status: "success";
758
+ result: {
759
+ prompt: string;
760
+ resourceId: string;
761
+ result: string;
762
+ task: string;
763
+ resourceType: "none" | "tool" | "workflow" | "agent";
764
+ iteration: number;
765
+ isOneOff: boolean;
766
+ threadId?: string | undefined;
767
+ threadResourceId?: string | undefined;
768
+ isComplete?: boolean | undefined;
769
+ completionReason?: string | undefined;
770
+ };
771
+ steps: {
772
+ [x: string]: StepResult<any, any, any, any> | StepResult<unknown, unknown, unknown, unknown>;
773
+ };
774
+ }>;
775
+
524
776
  export declare namespace memory {
525
777
  export {
526
778
  getMemoryStatusHandler,
@@ -530,7 +782,10 @@ export declare namespace memory {
530
782
  createThreadHandler,
531
783
  updateThreadHandler,
532
784
  deleteThreadHandler,
533
- getMessagesHandler
785
+ getMessagesPaginatedHandler,
786
+ getMessagesHandler,
787
+ getWorkingMemoryHandler,
788
+ updateWorkingMemoryHandler
534
789
  }
535
790
  }
536
791
 
@@ -538,6 +793,8 @@ declare interface MemoryContext extends Context {
538
793
  agentId?: string;
539
794
  resourceId?: string;
540
795
  threadId?: string;
796
+ networkId?: string;
797
+ runtimeContext?: RuntimeContext_2;
541
798
  }
542
799
 
543
800
  export declare namespace network {
@@ -554,6 +811,11 @@ declare interface NetworkContext extends Context {
554
811
  runtimeContext: RuntimeContext;
555
812
  }
556
813
 
814
+ declare interface NetworkContext_2 extends Context {
815
+ networkId?: string;
816
+ runtimeContext: RuntimeContext;
817
+ }
818
+
557
819
  export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
558
820
 
559
821
  declare interface QueryRequest {
@@ -578,14 +840,13 @@ export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, r
578
840
  runtimeContext: RuntimeContext;
579
841
  }): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
580
842
 
581
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, runtimeContextFromRequest, }: WorkflowContext_3 & {
843
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
582
844
  body: {
583
845
  step: string | string[];
584
846
  resumeData?: unknown;
585
847
  };
586
848
  runtimeContext?: RuntimeContext_2;
587
- runtimeContextFromRequest?: Record<string, unknown>;
588
- }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
849
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
589
850
 
590
851
  export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
591
852
  body: {
@@ -607,12 +868,36 @@ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body,
607
868
  message: string;
608
869
  }>;
609
870
 
610
- export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
871
+ export declare function saveMessagesHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
611
872
  body: {
612
873
  messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
613
874
  };
614
875
  }): Promise<MastraMessageV1[]>;
615
876
 
877
+ export declare function saveScoreHandler({ mastra, score }: Context & {
878
+ score: ScoreRowData;
879
+ }): Promise<never[] | {
880
+ score: ScoreRowData;
881
+ }>;
882
+
883
+ export declare namespace scores {
884
+ export {
885
+ getScorersHandler,
886
+ getScorerHandler,
887
+ getScoresByRunIdHandler,
888
+ getScoresByScorerIdHandler,
889
+ getScoresByEntityIdHandler,
890
+ saveScoreHandler
891
+ }
892
+ }
893
+
894
+ export declare function sendWorkflowRunEventHandler({ mastra, workflowId, runId, event, data, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
895
+ event: string;
896
+ data: unknown;
897
+ }): Promise<{
898
+ message: string;
899
+ }>;
900
+
616
901
  declare type SerializedStep = {
617
902
  id: string;
618
903
  description: string;
@@ -629,11 +914,10 @@ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext
629
914
  runtimeContext: RuntimeContext;
630
915
  }): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
631
916
 
632
- export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
917
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
633
918
  inputData?: unknown;
634
919
  runtimeContext?: RuntimeContext_2;
635
- runtimeContextFromRequest?: Record<string, unknown>;
636
- }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
920
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
637
921
 
638
922
  export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
639
923
  triggerData?: unknown;
@@ -642,10 +926,9 @@ export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext,
642
926
  message: string;
643
927
  }>;
644
928
 
645
- export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
929
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
646
930
  inputData?: unknown;
647
931
  runtimeContext?: RuntimeContext_2;
648
- runtimeContextFromRequest?: Record<string, unknown>;
649
932
  }): Promise<{
650
933
  message: string;
651
934
  }>;
@@ -673,13 +956,14 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
673
956
  traceCount: number;
674
957
  }>;
675
958
 
676
- export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
959
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
677
960
  runtimeContext: RuntimeContext;
678
961
  agentId: string;
679
962
  body: GetBody<'stream'> & {
680
963
  resourceid?: string;
681
964
  runtimeContext?: string;
682
965
  };
966
+ abortSignal?: AbortSignal;
683
967
  }): Promise<Response | undefined>;
684
968
 
685
969
  export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
@@ -689,14 +973,61 @@ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
689
973
  } & Parameters<AgentNetwork['stream']>[1];
690
974
  }): Promise<Response>;
691
975
 
692
- export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
976
+ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
977
+ runtimeContext: RuntimeContext;
978
+ body: {
979
+ message: string;
980
+ threadId?: string;
981
+ resourceId?: string;
982
+ };
983
+ }): Promise<{
984
+ stream: ReadableStream_3<StreamEvent>;
985
+ getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
986
+ task: ZodString;
987
+ resourceId: ZodString;
988
+ resourceType: ZodEnum<["agent", "workflow", "none", "tool", "none"]>;
989
+ prompt: ZodString;
990
+ result: ZodString;
991
+ isComplete: ZodOptional<ZodBoolean>;
992
+ completionReason: ZodOptional<ZodString>;
993
+ iteration: ZodNumber;
994
+ threadId: ZodOptional<ZodString>;
995
+ threadResourceId: ZodOptional<ZodString>;
996
+ isOneOff: ZodBoolean;
997
+ }, "strip", ZodTypeAny, {
998
+ prompt: string;
999
+ resourceId: string;
1000
+ result: string;
1001
+ task: string;
1002
+ resourceType: "none" | "tool" | "workflow" | "agent";
1003
+ iteration: number;
1004
+ isOneOff: boolean;
1005
+ threadId?: string | undefined;
1006
+ threadResourceId?: string | undefined;
1007
+ isComplete?: boolean | undefined;
1008
+ completionReason?: string | undefined;
1009
+ }, {
1010
+ prompt: string;
1011
+ resourceId: string;
1012
+ result: string;
1013
+ task: string;
1014
+ resourceType: "none" | "tool" | "workflow" | "agent";
1015
+ iteration: number;
1016
+ isOneOff: boolean;
1017
+ threadId?: string | undefined;
1018
+ threadResourceId?: string | undefined;
1019
+ isComplete?: boolean | undefined;
1020
+ completionReason?: string | undefined;
1021
+ }>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
1022
+ }>;
1023
+
1024
+ export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
693
1025
  inputData?: unknown;
694
1026
  runtimeContext?: RuntimeContext_2;
695
- runtimeContextFromRequest?: Record<string, unknown>;
696
- }): {
697
- stream: globalThis.ReadableStream<WatchEvent>;
698
- getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
699
- };
1027
+ }): Promise<{
1028
+ stream: ReadableStream_2<StreamEvent>;
1029
+ getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
1030
+ }>;
700
1031
 
701
1032
  declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
702
1033
 
@@ -764,10 +1095,21 @@ export declare type UnOfficalStatusCode = UnofficialStatusCode;
764
1095
  */
765
1096
  export declare type UnofficialStatusCode = -1;
766
1097
 
767
- export declare function updateThreadHandler({ mastra, agentId, threadId, body, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
1098
+ export declare function updateThreadHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
768
1099
  body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
769
1100
  }): Promise<StorageThreadType>;
770
1101
 
1102
+ /**
1103
+ * Handler to update the working memory for a thread (optionally resource-scoped).
1104
+ * @param threadId - the thread id
1105
+ * @param body - the body containing the working memory to update and the resource id (optional)
1106
+ */
1107
+ export declare function updateWorkingMemoryHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
1108
+ body: Omit<Parameters<MastraMemory['updateWorkingMemory']>[0], 'threadId'>;
1109
+ }): Promise<{
1110
+ success: boolean;
1111
+ }>;
1112
+
771
1113
  declare interface UpsertRequest {
772
1114
  indexName: string;
773
1115
  vectors: number[][];
@@ -830,6 +1172,7 @@ export declare namespace workflows {
830
1172
  getWorkflowsHandler,
831
1173
  getWorkflowByIdHandler,
832
1174
  getWorkflowRunByIdHandler,
1175
+ getWorkflowRunExecutionResultHandler,
833
1176
  createWorkflowRunHandler,
834
1177
  startAsyncWorkflowHandler,
835
1178
  startWorkflowRunHandler,
@@ -837,7 +1180,9 @@ export declare namespace workflows {
837
1180
  streamWorkflowHandler,
838
1181
  resumeAsyncWorkflowHandler,
839
1182
  resumeWorkflowHandler,
840
- getWorkflowRunsHandler
1183
+ getWorkflowRunsHandler,
1184
+ cancelWorkflowRunHandler,
1185
+ sendWorkflowRunEventHandler
841
1186
  }
842
1187
  }
843
1188