@mastra/server 0.0.0-cli-debug-2-20250611100354 → 0.0.0-cloudflare-deployer-dont-install-deps-20250714111754

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 (70) hide show
  1. package/LICENSE.md +11 -42
  2. package/dist/_tsup-dts-rollup.d.cts +275 -28
  3. package/dist/_tsup-dts-rollup.d.ts +275 -28
  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-3CNDE7QY.cjs +308 -0
  7. package/dist/{chunk-QLG2PFHE.js → chunk-4D66QEKC.js} +2 -2
  8. package/dist/{chunk-TEZOEGR4.js → chunk-5PQQ42EZ.js} +8 -8
  9. package/dist/{chunk-BNEY4P4P.cjs → chunk-7TP2LX5L.cjs} +16 -16
  10. package/dist/chunk-B2PAS2IB.cjs +514 -0
  11. package/dist/{chunk-6F2H7Y45.js → chunk-BK4XT6EG.js} +29 -14
  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-TJO277H7.cjs → chunk-FRVBFMO2.cjs} +20 -20
  15. package/dist/{chunk-B4MQFJ7G.cjs → chunk-G7KH752Y.cjs} +5 -5
  16. package/dist/{chunk-7IBZ4L35.js → chunk-H7DMHBKY.js} +181 -27
  17. package/dist/{chunk-UZ7FJ66C.cjs → chunk-JMLYCXMK.cjs} +43 -43
  18. package/dist/{chunk-CP55EVBK.js → chunk-KHZKYUNR.js} +15 -11
  19. package/dist/{chunk-I7KJZNX5.js → chunk-KOHWJYJT.js} +110 -25
  20. package/dist/{chunk-NYN7KFXL.js → chunk-LCM566I4.js} +1 -0
  21. package/dist/chunk-LF7P5PLR.js +14 -0
  22. package/dist/{chunk-XUGQSVZ4.cjs → chunk-LI436ITD.cjs} +107 -69
  23. package/dist/{chunk-HYP7B2TL.js → chunk-LRCAAFUA.js} +4 -4
  24. package/dist/{chunk-JEWNMAYQ.cjs → chunk-LZ3VJXSO.cjs} +43 -28
  25. package/dist/{chunk-WKWHYFX4.js → chunk-MEGCYGBU.js} +108 -70
  26. package/dist/chunk-PZQDCRPV.cjs +16 -0
  27. package/dist/{chunk-IMBY5XUG.cjs → chunk-QGX47B5D.cjs} +7 -7
  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-55DOQLP6.js → chunk-WNVFNNWN.js} +2 -2
  32. package/dist/server/handlers/agents.cjs +7 -7
  33. package/dist/server/handlers/agents.js +1 -1
  34. package/dist/server/handlers/error.cjs +2 -2
  35. package/dist/server/handlers/error.js +1 -1
  36. package/dist/server/handlers/legacyWorkflows.cjs +11 -11
  37. package/dist/server/handlers/legacyWorkflows.js +1 -1
  38. package/dist/server/handlers/logs.cjs +4 -4
  39. package/dist/server/handlers/logs.js +1 -1
  40. package/dist/server/handlers/memory.cjs +17 -9
  41. package/dist/server/handlers/memory.d.cts +2 -0
  42. package/dist/server/handlers/memory.d.ts +2 -0
  43. package/dist/server/handlers/memory.js +1 -1
  44. package/dist/server/handlers/network.cjs +5 -5
  45. package/dist/server/handlers/network.js +1 -1
  46. package/dist/server/handlers/telemetry.cjs +3 -3
  47. package/dist/server/handlers/telemetry.js +1 -1
  48. package/dist/server/handlers/tools.cjs +5 -5
  49. package/dist/server/handlers/tools.js +1 -1
  50. package/dist/server/handlers/utils.cjs +2 -2
  51. package/dist/server/handlers/utils.js +1 -1
  52. package/dist/server/handlers/vNextNetwork.cjs +218 -0
  53. package/dist/server/handlers/vNextNetwork.d.cts +6 -0
  54. package/dist/server/handlers/vNextNetwork.d.ts +6 -0
  55. package/dist/server/handlers/vNextNetwork.js +211 -0
  56. package/dist/server/handlers/vector.cjs +7 -7
  57. package/dist/server/handlers/vector.js +1 -1
  58. package/dist/server/handlers/voice.cjs +5 -5
  59. package/dist/server/handlers/voice.js +1 -1
  60. package/dist/server/handlers/workflows.cjs +24 -12
  61. package/dist/server/handlers/workflows.d.cts +3 -0
  62. package/dist/server/handlers/workflows.d.ts +3 -0
  63. package/dist/server/handlers/workflows.js +1 -1
  64. package/dist/server/handlers.cjs +20 -20
  65. package/dist/server/handlers.js +10 -10
  66. package/package.json +11 -12
  67. package/dist/chunk-64U3UDTH.cjs +0 -13
  68. package/dist/chunk-6TJSHFCJ.cjs +0 -221
  69. package/dist/chunk-JKF6PRPU.cjs +0 -357
  70. package/dist/chunk-M5ABIP7D.js +0 -11
package/LICENSE.md CHANGED
@@ -1,46 +1,15 @@
1
- # Elastic License 2.0 (ELv2)
1
+ # Apache License 2.0
2
2
 
3
- Copyright (c) 2025 Mastra AI, Inc.
3
+ Copyright (c) 2025 Kepler Software, Inc.
4
4
 
5
- **Acceptance**
6
- By using the software, you agree to all of the terms and conditions below.
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
7
8
 
8
- **Copyright License**
9
- The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
10
 
11
- **Limitations**
12
- You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
13
-
14
- You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
15
-
16
- You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
17
-
18
- **Patents**
19
- The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
20
-
21
- **Notices**
22
- You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
23
-
24
- If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
25
-
26
- **No Other Rights**
27
- These terms do not imply any licenses other than those expressly granted in these terms.
28
-
29
- **Termination**
30
- If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
31
-
32
- **No Liability**
33
- As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
34
-
35
- **Definitions**
36
- The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.
37
-
38
- _you_ refers to the individual or entity agreeing to these terms.
39
-
40
- _your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
41
-
42
- _your licenses_ are all the licenses granted to you for the software under these terms.
43
-
44
- _use_ means anything you do with the software requiring one of your licenses.
45
-
46
- _trademark_ means trademarks, service marks, and similar rights.
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
@@ -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';
@@ -17,19 +18,22 @@ import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
17
18
  import type { LegacyWorkflowRuns } from '@mastra/core/storage';
18
19
  import type { LogLevel } from '@mastra/core/logger';
19
20
  import type { Mastra } from '@mastra/core/mastra';
21
+ import type { MastraError } from '@mastra/core/error';
20
22
  import type { MastraMemory } from '@mastra/core/memory';
21
- import { MastraMessageV1 } from '@mastra/core/memory';
23
+ import { MastraMessageV1 } from '@mastra/core';
22
24
  import type { Message } from '@mastra/core/a2a';
23
25
  import type { QueryResult } from '@mastra/core/vector';
24
26
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
27
+ import { ReadableStream as ReadableStream_3 } from 'stream/web';
25
28
  import { RuntimeContext } from '@mastra/core/runtime-context';
26
29
  import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
27
30
  import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
28
- import { Step } from '@mastra/core/workflows';
31
+ import { Step } from '@mastra/core';
29
32
  import { StepExecutionContext } from '@mastra/core/workflows/legacy';
30
33
  import { StepGraph } from '@mastra/core/workflows/legacy';
31
- import { StorageThreadType } from '@mastra/core/memory';
32
- import { StreamEvent } from '@mastra/core/workflows';
34
+ import { StepResult } from '@mastra/core';
35
+ import { StorageThreadType } from '@mastra/core';
36
+ import { StreamEvent } from '@mastra/core';
33
37
  import { Task } from '@mastra/core/a2a';
34
38
  import { TaskAndHistory } from '@mastra/core/a2a';
35
39
  import type { TaskContext } from '@mastra/core/a2a';
@@ -40,11 +44,20 @@ import type { TaskStatus } from '@mastra/core/a2a';
40
44
  import type { ToolAction } from '@mastra/core/tools';
41
45
  import { UIMessage } from 'ai';
42
46
  import type { VercelTool } from '@mastra/core/tools';
47
+ import type { WatchEvent } from '@mastra/core/workflows';
43
48
  import type { Workflow } from '@mastra/core/workflows';
44
49
  import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
45
- import { WorkflowResult } from '@mastra/core/workflows';
50
+ import { WorkflowResult } from '@mastra/core';
46
51
  import type { WorkflowRuns } from '@mastra/core/storage';
52
+ import { WorkingMemoryTemplate } from '@mastra/core';
53
+ import { ZodBoolean } from 'zod';
54
+ import { ZodEnum } from 'zod';
55
+ import { ZodNumber } from 'zod';
56
+ import { ZodObject } from 'zod';
57
+ import { ZodOptional } from 'zod';
58
+ import { ZodString } from 'zod';
47
59
  import { ZodType } from 'zod';
60
+ import { ZodTypeAny } from 'zod';
48
61
  import { ZodTypeDef } from 'zod';
49
62
 
50
63
  export declare namespace a2a {
@@ -69,13 +82,17 @@ export declare namespace agents {
69
82
  }
70
83
  }
71
84
 
72
- export declare interface ApiError extends Error {
85
+ export declare interface ApiError extends MastraError {
73
86
  message: string;
74
87
  status?: number;
75
88
  }
76
89
 
77
90
  export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
78
91
 
92
+ export declare function cancelWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
93
+ message: string;
94
+ }>;
95
+
79
96
  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;
80
97
 
81
98
  export declare interface Context {
@@ -111,7 +128,7 @@ export declare function createTaskContext({ task, userMessage, history, activeCa
111
128
  activeCancellations: Set<string>;
112
129
  }): TaskContext;
113
130
 
114
- export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
131
+ export declare function createThreadHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
115
132
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
116
133
  resourceId?: string;
117
134
  };
@@ -127,7 +144,7 @@ export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<Vec
127
144
  success: boolean;
128
145
  }>;
129
146
 
130
- export declare function deleteThreadHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
147
+ export declare function deleteThreadHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<{
131
148
  result: string;
132
149
  }>;
133
150
 
@@ -152,14 +169,15 @@ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mas
152
169
  runtimeContext: RuntimeContext_2;
153
170
  }) => Promise<any>;
154
171
 
155
- export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
172
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
156
173
  runtimeContext: RuntimeContext;
157
174
  agentId: string;
158
175
  body: GetBody<'generate'> & {
159
176
  resourceid?: string;
160
177
  runtimeContext?: Record<string, unknown>;
161
178
  };
162
- }): Promise<GenerateTextResult<any, any>>;
179
+ abortSignal?: AbortSignal;
180
+ }): Promise<GenerateTextResult<any, unknown>>;
163
181
 
164
182
  export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
165
183
  runtimeContext: RuntimeContext;
@@ -178,6 +196,20 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
178
196
  };
179
197
  }): Promise<NodeJS.ReadableStream>;
180
198
 
199
+ export declare function generateVNextNetworkHandler({ mastra, runtimeContext, networkId, body, }: NetworkContext_2 & {
200
+ runtimeContext: RuntimeContext;
201
+ body: {
202
+ message: string;
203
+ threadId?: string;
204
+ resourceId?: string;
205
+ };
206
+ }): Promise<{
207
+ task: string;
208
+ result: string;
209
+ resourceId: string;
210
+ resourceType: "none" | "tool" | "workflow" | "agent";
211
+ }>;
212
+
181
213
  export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, isPlayground, }: Context & {
182
214
  isPlayground?: boolean;
183
215
  runtimeContext: RuntimeContext;
@@ -216,7 +248,17 @@ export declare function getAgentExecutionHandler({ requestId, mastra, agentId, r
216
248
 
217
249
  export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
218
250
  runtimeContext: RuntimeContext;
219
- }): Promise<any>;
251
+ }): Promise<Record<string, Omit<{
252
+ id: string;
253
+ name: any;
254
+ instructions: string;
255
+ tools: any;
256
+ workflows: {};
257
+ provider: string;
258
+ modelId: string;
259
+ defaultGenerateOptions: any;
260
+ defaultStreamOptions: any;
261
+ }, "id">>>;
220
262
 
221
263
  declare type GetBody<T extends keyof Agent & {
222
264
  [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
@@ -293,11 +335,11 @@ export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>
293
335
  transports: string[];
294
336
  }>;
295
337
 
296
- export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryContext, 'mastra' | 'agentId'>): Promise<{
338
+ export declare function getMemoryStatusHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
297
339
  result: boolean;
298
340
  }>;
299
341
 
300
- export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
342
+ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
301
343
  limit?: number;
302
344
  }): Promise<{
303
345
  messages: CoreMessage[];
@@ -343,16 +385,67 @@ export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): P
343
385
 
344
386
  export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<any[]>;
345
387
 
346
- export declare function getThreadByIdHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<StorageThreadType>;
388
+ export declare function getThreadByIdHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType>;
347
389
 
348
- export declare function getThreadsHandler({ mastra, agentId, resourceId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId'>): Promise<StorageThreadType[]>;
390
+ export declare function getThreadsHandler({ mastra, agentId, resourceId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType[]>;
349
391
 
350
392
  export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext, 'tools' | 'toolId'>): Promise<any>;
351
393
 
352
394
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
353
395
 
396
+ export declare function getVNextNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
397
+ id: string;
398
+ name: string;
399
+ instructions: string;
400
+ agents: {
401
+ name: string;
402
+ provider: string;
403
+ modelId: string;
404
+ }[];
405
+ workflows: {
406
+ name: string | undefined;
407
+ description: string | undefined;
408
+ inputSchema: string | undefined;
409
+ outputSchema: string | undefined;
410
+ }[];
411
+ tools: {
412
+ id: string;
413
+ description: string;
414
+ }[];
415
+ routingModel: {
416
+ provider: string;
417
+ modelId: string;
418
+ };
419
+ }>;
420
+
421
+ export declare function getVNextNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'runtimeContext'>): Promise<{
422
+ id: string;
423
+ name: string;
424
+ instructions: string;
425
+ tools: {
426
+ id: string;
427
+ description: string;
428
+ }[];
429
+ agents: {
430
+ name: string;
431
+ provider: string;
432
+ modelId: string;
433
+ }[];
434
+ workflows: {
435
+ name: string | undefined;
436
+ description: string | undefined;
437
+ inputSchema: string | undefined;
438
+ outputSchema: string | undefined;
439
+ }[];
440
+ routingModel: {
441
+ provider: string;
442
+ modelId: string;
443
+ };
444
+ }[]>;
445
+
354
446
  export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
355
- steps: SerializedStep[];
447
+ steps: Record<string, SerializedStep>;
448
+ allSteps: Record<string, SerializedStep>;
356
449
  name: string | undefined;
357
450
  description: string | undefined;
358
451
  stepGraph: SerializedStepFlowEntry[];
@@ -362,6 +455,8 @@ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowC
362
455
 
363
456
  export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
364
457
 
458
+ export declare function getWorkflowRunExecutionResultHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<WatchEvent['payload']['workflowState']>;
459
+
365
460
  export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
366
461
  fromDate?: Date;
367
462
  toDate?: Date;
@@ -372,6 +467,21 @@ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, t
372
467
 
373
468
  export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
374
469
 
470
+ /**
471
+ * Handler to get the working memory for a thread (optionally resource-scoped).
472
+ * @returns workingMemory - the working memory for the thread
473
+ * @returns source - thread or resource
474
+ */
475
+ export declare function getWorkingMemoryHandler({ mastra, agentId, threadId, resourceId, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
476
+ resourceId?: Parameters<MastraMemory['getWorkingMemory']>[0]['resourceId'];
477
+ memoryConfig?: Parameters<MastraMemory['getWorkingMemory']>[0]['memoryConfig'];
478
+ }): Promise<{
479
+ workingMemory: string | null;
480
+ source: string;
481
+ workingMemoryTemplate: WorkingMemoryTemplate | null;
482
+ threadExists: boolean;
483
+ }>;
484
+
375
485
  export declare function handleError(error: unknown, defaultMessage: string): never;
376
486
 
377
487
  export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
@@ -466,11 +576,13 @@ export declare class HTTPException extends Error {
466
576
  * @property res - Optional response object to use.
467
577
  * @property message - Optional custom error message.
468
578
  * @property cause - Optional cause of the error.
579
+ * @property stack - Optional stack trace for the error.
469
580
  */
470
581
  declare type HTTPExceptionOptions = {
471
582
  res?: Response;
472
583
  message?: string;
473
584
  cause?: unknown;
585
+ stack?: string;
474
586
  };
475
587
 
476
588
  /**
@@ -541,6 +653,62 @@ declare type LogsContext = {
541
653
  };
542
654
  };
543
655
 
656
+ export declare function loopStreamVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
657
+ runtimeContext: RuntimeContext;
658
+ body: {
659
+ message: string;
660
+ threadId?: string;
661
+ resourceId?: string;
662
+ maxIterations?: number;
663
+ };
664
+ }): Promise<{
665
+ stream: ReadableStream_3<StreamEvent>;
666
+ getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
667
+ task: ZodString;
668
+ resourceId: ZodString;
669
+ resourceType: ZodEnum<["agent", "workflow", "none", "tool", "none"]>;
670
+ prompt: ZodString;
671
+ result: ZodString;
672
+ isComplete: ZodOptional<ZodBoolean>;
673
+ completionReason: ZodOptional<ZodString>;
674
+ iteration: ZodNumber;
675
+ }, "strip", ZodTypeAny, {
676
+ prompt: string;
677
+ resourceId: string;
678
+ result: string;
679
+ task: string;
680
+ resourceType: "none" | "tool" | "workflow" | "agent";
681
+ iteration: number;
682
+ isComplete?: boolean | undefined;
683
+ completionReason?: string | undefined;
684
+ }, {
685
+ prompt: string;
686
+ resourceId: string;
687
+ result: string;
688
+ task: string;
689
+ resourceType: "none" | "tool" | "workflow" | "agent";
690
+ iteration: number;
691
+ isComplete?: boolean | undefined;
692
+ completionReason?: string | undefined;
693
+ }>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
694
+ }>;
695
+
696
+ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
697
+ runtimeContext: RuntimeContext;
698
+ body: {
699
+ message: string;
700
+ };
701
+ }): Promise<{
702
+ status: "success";
703
+ result: {
704
+ text: string;
705
+ iteration: number;
706
+ };
707
+ steps: {
708
+ [x: string]: StepResult<any, any, any, any> | StepResult<unknown, unknown, unknown, unknown>;
709
+ };
710
+ }>;
711
+
544
712
  export declare namespace memory {
545
713
  export {
546
714
  getMemoryStatusHandler,
@@ -550,7 +718,9 @@ export declare namespace memory {
550
718
  createThreadHandler,
551
719
  updateThreadHandler,
552
720
  deleteThreadHandler,
553
- getMessagesHandler
721
+ getMessagesHandler,
722
+ getWorkingMemoryHandler,
723
+ updateWorkingMemoryHandler
554
724
  }
555
725
  }
556
726
 
@@ -558,6 +728,8 @@ declare interface MemoryContext extends Context {
558
728
  agentId?: string;
559
729
  resourceId?: string;
560
730
  threadId?: string;
731
+ networkId?: string;
732
+ runtimeContext?: RuntimeContext_2;
561
733
  }
562
734
 
563
735
  export declare namespace network {
@@ -574,6 +746,11 @@ declare interface NetworkContext extends Context {
574
746
  runtimeContext: RuntimeContext;
575
747
  }
576
748
 
749
+ declare interface NetworkContext_2 extends Context {
750
+ networkId?: string;
751
+ runtimeContext: RuntimeContext;
752
+ }
753
+
577
754
  export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
578
755
 
579
756
  declare interface QueryRequest {
@@ -604,7 +781,7 @@ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId,
604
781
  resumeData?: unknown;
605
782
  };
606
783
  runtimeContext?: RuntimeContext_2;
607
- }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
784
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
608
785
 
609
786
  export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
610
787
  body: {
@@ -626,12 +803,19 @@ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body,
626
803
  message: string;
627
804
  }>;
628
805
 
629
- export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
806
+ export declare function saveMessagesHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
630
807
  body: {
631
808
  messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
632
809
  };
633
810
  }): Promise<MastraMessageV1[]>;
634
811
 
812
+ export declare function sendWorkflowRunEventHandler({ mastra, workflowId, runId, event, data, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
813
+ event: string;
814
+ data: unknown;
815
+ }): Promise<{
816
+ message: string;
817
+ }>;
818
+
635
819
  declare type SerializedStep = {
636
820
  id: string;
637
821
  description: string;
@@ -651,7 +835,7 @@ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext
651
835
  export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
652
836
  inputData?: unknown;
653
837
  runtimeContext?: RuntimeContext_2;
654
- }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
838
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
655
839
 
656
840
  export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
657
841
  triggerData?: unknown;
@@ -690,13 +874,14 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
690
874
  traceCount: number;
691
875
  }>;
692
876
 
693
- export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
877
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
694
878
  runtimeContext: RuntimeContext;
695
879
  agentId: string;
696
880
  body: GetBody<'stream'> & {
697
881
  resourceid?: string;
698
882
  runtimeContext?: string;
699
883
  };
884
+ abortSignal?: AbortSignal;
700
885
  }): Promise<Response | undefined>;
701
886
 
702
887
  export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
@@ -706,13 +891,61 @@ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
706
891
  } & Parameters<AgentNetwork['stream']>[1];
707
892
  }): Promise<Response>;
708
893
 
894
+ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
895
+ runtimeContext: RuntimeContext;
896
+ body: {
897
+ message: string;
898
+ threadId?: string;
899
+ resourceId?: string;
900
+ };
901
+ }): Promise<{
902
+ stream: ReadableStream_3<StreamEvent>;
903
+ getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
904
+ task: ZodString;
905
+ resourceId: ZodString;
906
+ resourceType: ZodEnum<["agent", "workflow", "none", "tool", "none"]>;
907
+ prompt: ZodString;
908
+ result: ZodString;
909
+ isComplete: ZodOptional<ZodBoolean>;
910
+ completionReason: ZodOptional<ZodString>;
911
+ iteration: ZodNumber;
912
+ threadId: ZodOptional<ZodString>;
913
+ threadResourceId: ZodOptional<ZodString>;
914
+ isOneOff: ZodBoolean;
915
+ }, "strip", ZodTypeAny, {
916
+ prompt: string;
917
+ resourceId: string;
918
+ result: string;
919
+ task: string;
920
+ resourceType: "none" | "tool" | "workflow" | "agent";
921
+ iteration: number;
922
+ isOneOff: boolean;
923
+ threadId?: string | undefined;
924
+ threadResourceId?: string | undefined;
925
+ isComplete?: boolean | undefined;
926
+ completionReason?: string | undefined;
927
+ }, {
928
+ prompt: string;
929
+ resourceId: string;
930
+ result: string;
931
+ task: string;
932
+ resourceType: "none" | "tool" | "workflow" | "agent";
933
+ iteration: number;
934
+ isOneOff: boolean;
935
+ threadId?: string | undefined;
936
+ threadResourceId?: string | undefined;
937
+ isComplete?: boolean | undefined;
938
+ completionReason?: string | undefined;
939
+ }>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
940
+ }>;
941
+
709
942
  export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
710
943
  inputData?: unknown;
711
944
  runtimeContext?: RuntimeContext_2;
712
- }): {
713
- stream: globalThis.ReadableStream<StreamEvent>;
714
- getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
715
- };
945
+ }): Promise<{
946
+ stream: ReadableStream_2<StreamEvent>;
947
+ getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
948
+ }>;
716
949
 
717
950
  declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
718
951
 
@@ -780,10 +1013,21 @@ export declare type UnOfficalStatusCode = UnofficialStatusCode;
780
1013
  */
781
1014
  export declare type UnofficialStatusCode = -1;
782
1015
 
783
- export declare function updateThreadHandler({ mastra, agentId, threadId, body, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
1016
+ export declare function updateThreadHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
784
1017
  body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
785
1018
  }): Promise<StorageThreadType>;
786
1019
 
1020
+ /**
1021
+ * Handler to update the working memory for a thread (optionally resource-scoped).
1022
+ * @param threadId - the thread id
1023
+ * @param body - the body containing the working memory to update and the resource id (optional)
1024
+ */
1025
+ export declare function updateWorkingMemoryHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
1026
+ body: Omit<Parameters<MastraMemory['updateWorkingMemory']>[0], 'threadId'>;
1027
+ }): Promise<{
1028
+ success: boolean;
1029
+ }>;
1030
+
787
1031
  declare interface UpsertRequest {
788
1032
  indexName: string;
789
1033
  vectors: number[][];
@@ -846,6 +1090,7 @@ export declare namespace workflows {
846
1090
  getWorkflowsHandler,
847
1091
  getWorkflowByIdHandler,
848
1092
  getWorkflowRunByIdHandler,
1093
+ getWorkflowRunExecutionResultHandler,
849
1094
  createWorkflowRunHandler,
850
1095
  startAsyncWorkflowHandler,
851
1096
  startWorkflowRunHandler,
@@ -853,7 +1098,9 @@ export declare namespace workflows {
853
1098
  streamWorkflowHandler,
854
1099
  resumeAsyncWorkflowHandler,
855
1100
  resumeWorkflowHandler,
856
- getWorkflowRunsHandler
1101
+ getWorkflowRunsHandler,
1102
+ cancelWorkflowRunHandler,
1103
+ sendWorkflowRunEventHandler
857
1104
  }
858
1105
  }
859
1106