@mastra/server 0.0.0-tool-call-parts-20250630193309 → 0.0.0-transpile-packages-20250730132657

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 (78) hide show
  1. package/LICENSE.md +11 -42
  2. package/dist/_tsup-dts-rollup.d.cts +212 -23
  3. package/dist/_tsup-dts-rollup.d.ts +212 -23
  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-MEGCYGBU.js → chunk-36BLNJHS.js} +37 -37
  7. package/dist/chunk-424T5F2J.cjs +157 -0
  8. package/dist/{chunk-QLG2PFHE.js → chunk-4D66QEKC.js} +2 -2
  9. package/dist/{chunk-L3VURYKY.cjs → chunk-6KP2OBYA.cjs} +177 -68
  10. package/dist/chunk-6T5JUKOQ.js +149 -0
  11. package/dist/{chunk-BNEY4P4P.cjs → chunk-7TP2LX5L.cjs} +16 -16
  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-B4MQFJ7G.cjs → chunk-G7KH752Y.cjs} +5 -5
  15. package/dist/{chunk-LI436ITD.cjs → chunk-HISYIDYH.cjs} +37 -37
  16. package/dist/{chunk-Z3PTO2AK.cjs → chunk-HRSAZUIK.cjs} +20 -20
  17. package/dist/{chunk-EP3XVEVC.cjs → chunk-I5JKUCGE.cjs} +50 -20
  18. package/dist/{chunk-R5VGYBV6.js → chunk-KHZKYUNR.js} +3 -3
  19. package/dist/{chunk-NYN7KFXL.js → chunk-LCM566I4.js} +1 -0
  20. package/dist/chunk-LF7P5PLR.js +14 -0
  21. package/dist/chunk-PZQDCRPV.cjs +16 -0
  22. package/dist/{chunk-IMBY5XUG.cjs → chunk-QGX47B5D.cjs} +7 -7
  23. package/dist/chunk-R3I7AJVL.js +507 -0
  24. package/dist/{chunk-BFOA2QQY.js → chunk-RG473F6Y.js} +2 -2
  25. package/dist/{chunk-WJY57THV.cjs → chunk-RHSWAXKB.cjs} +22 -22
  26. package/dist/{chunk-H5PTF3Y4.js → chunk-RSEO4XPX.js} +1 -1
  27. package/dist/{chunk-72LOJGUV.js → chunk-T7HAZC2E.js} +118 -12
  28. package/dist/chunk-TTPJHP42.cjs +522 -0
  29. package/dist/{chunk-NGHSYB5B.cjs → chunk-UCV4247U.cjs} +43 -43
  30. package/dist/{chunk-2BCWG3EZ.js → chunk-VTTN2FW3.js} +36 -7
  31. package/dist/{chunk-EWLR2PNT.js → chunk-WBRFIHSF.js} +4 -4
  32. package/dist/{chunk-55DOQLP6.js → chunk-WNVFNNWN.js} +2 -2
  33. package/dist/{chunk-E2LP4J6K.js → chunk-ZYAFP2AV.js} +8 -8
  34. package/dist/server/handlers/agents.cjs +11 -7
  35. package/dist/server/handlers/agents.d.cts +1 -0
  36. package/dist/server/handlers/agents.d.ts +1 -0
  37. package/dist/server/handlers/agents.js +1 -1
  38. package/dist/server/handlers/error.cjs +2 -2
  39. package/dist/server/handlers/error.js +1 -1
  40. package/dist/server/handlers/legacyWorkflows.cjs +11 -11
  41. package/dist/server/handlers/legacyWorkflows.js +1 -1
  42. package/dist/server/handlers/logs.cjs +4 -4
  43. package/dist/server/handlers/logs.js +1 -1
  44. package/dist/server/handlers/memory.cjs +29 -9
  45. package/dist/server/handlers/memory.d.cts +5 -0
  46. package/dist/server/handlers/memory.d.ts +5 -0
  47. package/dist/server/handlers/memory.js +1 -1
  48. package/dist/server/handlers/network.cjs +5 -5
  49. package/dist/server/handlers/network.js +1 -1
  50. package/dist/server/handlers/scores.cjs +30 -0
  51. package/dist/server/handlers/scores.d.cts +6 -0
  52. package/dist/server/handlers/scores.d.ts +6 -0
  53. package/dist/server/handlers/scores.js +1 -0
  54. package/dist/server/handlers/telemetry.cjs +3 -3
  55. package/dist/server/handlers/telemetry.js +1 -1
  56. package/dist/server/handlers/tools.cjs +5 -5
  57. package/dist/server/handlers/tools.js +1 -1
  58. package/dist/server/handlers/utils.cjs +2 -2
  59. package/dist/server/handlers/utils.js +1 -1
  60. package/dist/server/handlers/vNextNetwork.cjs +23 -23
  61. package/dist/server/handlers/vNextNetwork.js +4 -4
  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 +25 -13
  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 +8 -7
  75. package/dist/chunk-64U3UDTH.cjs +0 -13
  76. package/dist/chunk-M5ABIP7D.js +0 -11
  77. package/dist/chunk-RQ2Z56EC.cjs +0 -251
  78. package/dist/chunk-XUIJ7WRT.js +0 -241
@@ -5,10 +5,10 @@ import type { Artifact } from '@mastra/core/a2a';
5
5
  import type { BaseLogMessage } from '@mastra/core/logger';
6
6
  import { CoreMessage } from 'ai';
7
7
  import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
8
- import { DefaultEngineType } from '@mastra/core/workflows';
9
- import { EvalRow } from '@mastra/core/storage';
10
- import { GenerateObjectResult } from 'ai';
11
- import { GenerateTextResult } from 'ai';
8
+ import { DefaultEngineType } from '@mastra/core';
9
+ import { EvalRow } from '@mastra/core';
10
+ import type { GenerateReturn } from '@mastra/core/llm';
11
+ import { GenerateTextResult } from '@mastra/core';
12
12
  import type { IMastraLogger } from '@mastra/core/logger';
13
13
  import type { JSONRPCError } from '@mastra/core/a2a';
14
14
  import { JSONRPCResponse } from '@mastra/core/a2a';
@@ -18,21 +18,30 @@ import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
18
18
  import type { LegacyWorkflowRuns } from '@mastra/core/storage';
19
19
  import type { LogLevel } from '@mastra/core/logger';
20
20
  import type { Mastra } from '@mastra/core/mastra';
21
+ import type { MastraError } from '@mastra/core/error';
21
22
  import type { MastraMemory } from '@mastra/core/memory';
22
- 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';
26
+ import { MastraWorkflowStream } from '@mastra/core';
27
+ import { MemoryConfig } from '@mastra/core';
23
28
  import type { Message } from '@mastra/core/a2a';
29
+ import { PaginationInfo } from '@mastra/core';
24
30
  import type { QueryResult } from '@mastra/core/vector';
25
31
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
26
32
  import { ReadableStream as ReadableStream_3 } from 'stream/web';
27
33
  import { RuntimeContext } from '@mastra/core/runtime-context';
28
34
  import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
35
+ import type { ScoreRowData } from '@mastra/core/scores';
29
36
  import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
30
- import { Step } from '@mastra/core/workflows';
37
+ import { Step } from '@mastra/core';
31
38
  import { StepExecutionContext } from '@mastra/core/workflows/legacy';
32
39
  import { StepGraph } from '@mastra/core/workflows/legacy';
33
- import { StepResult } from '@mastra/core/workflows';
34
- import { StorageThreadType } from '@mastra/core/memory';
35
- import { StreamEvent } from '@mastra/core/workflows';
40
+ import { StepResult } from '@mastra/core';
41
+ import type { StorageGetMessagesArg } from '@mastra/core';
42
+ import type { StoragePagination } from '@mastra/core/storage';
43
+ import { StorageThreadType } from '@mastra/core';
44
+ import { StreamEvent } from '@mastra/core';
36
45
  import { Task } from '@mastra/core/a2a';
37
46
  import { TaskAndHistory } from '@mastra/core/a2a';
38
47
  import type { TaskContext } from '@mastra/core/a2a';
@@ -41,13 +50,15 @@ import type { TaskQueryParams } from '@mastra/core/a2a';
41
50
  import type { TaskSendParams } from '@mastra/core/a2a';
42
51
  import type { TaskStatus } from '@mastra/core/a2a';
43
52
  import type { ToolAction } from '@mastra/core/tools';
53
+ import { Trace } from '@mastra/core';
44
54
  import { UIMessage } from 'ai';
45
55
  import type { VercelTool } from '@mastra/core/tools';
46
56
  import type { WatchEvent } from '@mastra/core/workflows';
47
57
  import type { Workflow } from '@mastra/core/workflows';
48
58
  import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
49
- import { WorkflowResult } from '@mastra/core/workflows';
59
+ import { WorkflowResult } from '@mastra/core';
50
60
  import type { WorkflowRuns } from '@mastra/core/storage';
61
+ import { WorkingMemoryTemplate } from '@mastra/core';
51
62
  import { ZodBoolean } from 'zod';
52
63
  import { ZodEnum } from 'zod';
53
64
  import { ZodNumber } from 'zod';
@@ -76,17 +87,22 @@ export declare namespace agents {
76
87
  getEvalsByAgentIdHandler,
77
88
  getLiveEvalsByAgentIdHandler,
78
89
  generateHandler,
79
- streamGenerateHandler
90
+ streamGenerateHandler,
91
+ streamVNextGenerateHandler
80
92
  }
81
93
  }
82
94
 
83
- export declare interface ApiError extends Error {
95
+ export declare interface ApiError extends MastraError {
84
96
  message: string;
85
97
  status?: number;
86
98
  }
87
99
 
88
100
  export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
89
101
 
102
+ export declare function cancelWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
103
+ message: string;
104
+ }>;
105
+
90
106
  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;
91
107
 
92
108
  export declare interface Context {
@@ -171,14 +187,14 @@ export declare function generateHandler({ mastra, runtimeContext, agentId, body,
171
187
  runtimeContext?: Record<string, unknown>;
172
188
  };
173
189
  abortSignal?: AbortSignal;
174
- }): Promise<GenerateTextResult<any, unknown>>;
190
+ }): Promise<GenerateTextResult<any, undefined>>;
175
191
 
176
192
  export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
177
193
  runtimeContext: RuntimeContext;
178
194
  body: {
179
195
  messages?: Parameters<AgentNetwork['generate']>[0];
180
196
  } & Parameters<AgentNetwork['generate']>[1];
181
- }): Promise<GenerateObjectResult<any>>;
197
+ }): Promise<GenerateReturn<any, any, any>>;
182
198
 
183
199
  /**
184
200
  * Generate speech from text
@@ -329,6 +345,10 @@ export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>
329
345
  transports: string[];
330
346
  }>;
331
347
 
348
+ export declare function getMemoryConfigHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
349
+ config: MemoryConfig;
350
+ }>;
351
+
332
352
  export declare function getMemoryStatusHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
333
353
  result: boolean;
334
354
  }>;
@@ -340,6 +360,10 @@ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, n
340
360
  uiMessages: UIMessage[];
341
361
  }>;
342
362
 
363
+ export declare function getMessagesPaginatedHandler({ mastra, threadId, resourceId, selectBy, format, }: StorageGetMessagesArg & Pick<MemoryContext, 'mastra'>): Promise<PaginationInfo & {
364
+ messages: MastraMessageV1[] | MastraMessageV2[];
365
+ }>;
366
+
343
367
  export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
344
368
  id: string;
345
369
  name: string;
@@ -370,6 +394,50 @@ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<Net
370
394
  };
371
395
  }[]>;
372
396
 
397
+ export declare function getScorerHandler({ mastra, scorerId, runtimeContext, }: Context & {
398
+ scorerId: string;
399
+ runtimeContext: RuntimeContext;
400
+ }): Promise<(MastraScorerEntry & {
401
+ agentIds: string[];
402
+ workflowIds: string[];
403
+ }) | null>;
404
+
405
+ export declare function getScorersHandler({ mastra, runtimeContext }: Context & {
406
+ runtimeContext: RuntimeContext;
407
+ }): Promise<{
408
+ [k: string]: MastraScorerEntry & {
409
+ agentIds: string[];
410
+ workflowIds: string[];
411
+ };
412
+ }>;
413
+
414
+ export declare function getScoresByEntityIdHandler({ mastra, entityId, entityType, pagination, }: Context & {
415
+ entityId: string;
416
+ entityType: string;
417
+ pagination: StoragePagination;
418
+ }): Promise<never[] | {
419
+ pagination: PaginationInfo;
420
+ scores: ScoreRowData[];
421
+ }>;
422
+
423
+ export declare function getScoresByRunIdHandler({ mastra, runId, pagination, }: Context & {
424
+ runId: string;
425
+ pagination: StoragePagination;
426
+ }): Promise<never[] | {
427
+ pagination: PaginationInfo;
428
+ scores: ScoreRowData[];
429
+ }>;
430
+
431
+ export declare function getScoresByScorerIdHandler({ mastra, scorerId, pagination, entityId, entityType, }: Context & {
432
+ scorerId: string;
433
+ pagination: StoragePagination;
434
+ entityId?: string;
435
+ entityType?: string;
436
+ }): Promise<never[] | {
437
+ pagination: PaginationInfo;
438
+ scores: ScoreRowData[];
439
+ }>;
440
+
373
441
  /**
374
442
  * Get available speakers for an agent
375
443
  */
@@ -377,7 +445,7 @@ export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): P
377
445
  voiceId: string;
378
446
  }[]>;
379
447
 
380
- export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<any[]>;
448
+ export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<Trace[]>;
381
449
 
382
450
  export declare function getThreadByIdHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType>;
383
451
 
@@ -438,7 +506,8 @@ export declare function getVNextNetworksHandler({ mastra, runtimeContext, }: Pic
438
506
  }[]>;
439
507
 
440
508
  export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
441
- steps: SerializedStep[];
509
+ steps: Record<string, SerializedStep>;
510
+ allSteps: Record<string, SerializedStep>;
442
511
  name: string | undefined;
443
512
  description: string | undefined;
444
513
  stepGraph: SerializedStepFlowEntry[];
@@ -460,6 +529,21 @@ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, t
460
529
 
461
530
  export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
462
531
 
532
+ /**
533
+ * Handler to get the working memory for a thread (optionally resource-scoped).
534
+ * @returns workingMemory - the working memory for the thread
535
+ * @returns source - thread or resource
536
+ */
537
+ export declare function getWorkingMemoryHandler({ mastra, agentId, threadId, resourceId, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
538
+ resourceId?: Parameters<MastraMemory['getWorkingMemory']>[0]['resourceId'];
539
+ memoryConfig?: Parameters<MastraMemory['getWorkingMemory']>[0]['memoryConfig'];
540
+ }): Promise<{
541
+ workingMemory: string | null;
542
+ source: string;
543
+ workingMemoryTemplate: WorkingMemoryTemplate | null;
544
+ threadExists: boolean;
545
+ }>;
546
+
463
547
  export declare function handleError(error: unknown, defaultMessage: string): never;
464
548
 
465
549
  export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
@@ -554,11 +638,13 @@ export declare class HTTPException extends Error {
554
638
  * @property res - Optional response object to use.
555
639
  * @property message - Optional custom error message.
556
640
  * @property cause - Optional cause of the error.
641
+ * @property stack - Optional stack trace for the error.
557
642
  */
558
643
  declare type HTTPExceptionOptions = {
559
644
  res?: Response;
560
645
  message?: string;
561
646
  cause?: unknown;
647
+ stack?: string;
562
648
  };
563
649
 
564
650
  /**
@@ -649,18 +735,18 @@ export declare function loopStreamVNextNetworkHandler({ mastra, networkId, body,
649
735
  completionReason: ZodOptional<ZodString>;
650
736
  iteration: ZodNumber;
651
737
  }, "strip", ZodTypeAny, {
738
+ result: string;
652
739
  prompt: string;
653
740
  resourceId: string;
654
- result: string;
655
741
  task: string;
656
742
  resourceType: "none" | "tool" | "workflow" | "agent";
657
743
  iteration: number;
658
744
  isComplete?: boolean | undefined;
659
745
  completionReason?: string | undefined;
660
746
  }, {
747
+ result: string;
661
748
  prompt: string;
662
749
  resourceId: string;
663
- result: string;
664
750
  task: string;
665
751
  resourceType: "none" | "tool" | "workflow" | "agent";
666
752
  iteration: number;
@@ -677,8 +763,17 @@ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runti
677
763
  }): Promise<{
678
764
  status: "success";
679
765
  result: {
680
- text: string;
766
+ result: string;
767
+ prompt: string;
768
+ resourceId: string;
769
+ task: string;
770
+ resourceType: "none" | "tool" | "workflow" | "agent";
681
771
  iteration: number;
772
+ isOneOff: boolean;
773
+ threadId?: string | undefined;
774
+ threadResourceId?: string | undefined;
775
+ isComplete?: boolean | undefined;
776
+ completionReason?: string | undefined;
682
777
  };
683
778
  steps: {
684
779
  [x: string]: StepResult<any, any, any, any> | StepResult<unknown, unknown, unknown, unknown>;
@@ -688,13 +783,18 @@ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runti
688
783
  export declare namespace memory {
689
784
  export {
690
785
  getMemoryStatusHandler,
786
+ getMemoryConfigHandler,
691
787
  getThreadsHandler,
692
788
  getThreadByIdHandler,
693
789
  saveMessagesHandler,
694
790
  createThreadHandler,
695
791
  updateThreadHandler,
696
792
  deleteThreadHandler,
697
- getMessagesHandler
793
+ getMessagesPaginatedHandler,
794
+ getMessagesHandler,
795
+ getWorkingMemoryHandler,
796
+ updateWorkingMemoryHandler,
797
+ searchMemoryHandler
698
798
  }
699
799
  }
700
800
 
@@ -783,6 +883,67 @@ export declare function saveMessagesHandler({ mastra, agentId, body, networkId,
783
883
  };
784
884
  }): Promise<MastraMessageV1[]>;
785
885
 
886
+ export declare function saveScoreHandler({ mastra, score }: Context & {
887
+ score: ScoreRowData;
888
+ }): Promise<never[] | {
889
+ score: ScoreRowData;
890
+ }>;
891
+
892
+ export declare namespace scores {
893
+ export {
894
+ getScorersHandler,
895
+ getScorerHandler,
896
+ getScoresByRunIdHandler,
897
+ getScoresByScorerIdHandler,
898
+ getScoresByEntityIdHandler,
899
+ saveScoreHandler
900
+ }
901
+ }
902
+
903
+ /**
904
+ * Handler to search messages in a thread.
905
+ * @param searchQuery - the text to search for
906
+ * @param resourceId - the resource id (user/org) to validate thread ownership
907
+ * @param threadId - the thread id to search within
908
+ * @param limit - maximum number of results to return (default: 20)
909
+ */
910
+ export declare function searchMemoryHandler({ mastra, agentId, searchQuery, resourceId, threadId, limit, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
911
+ searchQuery: string;
912
+ resourceId: string;
913
+ threadId?: string;
914
+ limit?: number;
915
+ memoryConfig?: any;
916
+ }): Promise<SearchResponse | ReturnType<typeof handleError>>;
917
+
918
+ declare interface SearchResponse {
919
+ results: SearchResult[];
920
+ count: number;
921
+ query: string;
922
+ searchScope?: string;
923
+ searchType?: string;
924
+ }
925
+
926
+ declare interface SearchResult {
927
+ id: string;
928
+ role: string;
929
+ content: any;
930
+ createdAt: Date;
931
+ threadId?: string;
932
+ threadTitle?: string;
933
+ score?: number;
934
+ context?: {
935
+ before?: SearchResult[];
936
+ after?: SearchResult[];
937
+ };
938
+ }
939
+
940
+ export declare function sendWorkflowRunEventHandler({ mastra, workflowId, runId, event, data, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
941
+ event: string;
942
+ data: unknown;
943
+ }): Promise<{
944
+ message: string;
945
+ }>;
946
+
786
947
  declare type SerializedStep = {
787
948
  id: string;
788
949
  description: string;
@@ -880,9 +1041,9 @@ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, b
880
1041
  threadResourceId: ZodOptional<ZodString>;
881
1042
  isOneOff: ZodBoolean;
882
1043
  }, "strip", ZodTypeAny, {
1044
+ result: string;
883
1045
  prompt: string;
884
1046
  resourceId: string;
885
- result: string;
886
1047
  task: string;
887
1048
  resourceType: "none" | "tool" | "workflow" | "agent";
888
1049
  iteration: number;
@@ -892,9 +1053,9 @@ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, b
892
1053
  isComplete?: boolean | undefined;
893
1054
  completionReason?: string | undefined;
894
1055
  }, {
1056
+ result: string;
895
1057
  prompt: string;
896
1058
  resourceId: string;
897
- result: string;
898
1059
  task: string;
899
1060
  resourceType: "none" | "tool" | "workflow" | "agent";
900
1061
  iteration: number;
@@ -906,6 +1067,20 @@ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, b
906
1067
  }>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
907
1068
  }>;
908
1069
 
1070
+ export declare function streamVNextGenerateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
1071
+ runtimeContext: RuntimeContext;
1072
+ agentId: string;
1073
+ body: GetBody<'streamVNext'> & {
1074
+ runtimeContext?: string;
1075
+ };
1076
+ abortSignal?: AbortSignal;
1077
+ }): ReturnType<Agent['streamVNext']>;
1078
+
1079
+ export declare function streamVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
1080
+ inputData?: unknown;
1081
+ runtimeContext?: RuntimeContext_2;
1082
+ }): Promise<MastraWorkflowStream>;
1083
+
909
1084
  export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
910
1085
  inputData?: unknown;
911
1086
  runtimeContext?: RuntimeContext_2;
@@ -984,6 +1159,17 @@ export declare function updateThreadHandler({ mastra, agentId, threadId, body, n
984
1159
  body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
985
1160
  }): Promise<StorageThreadType>;
986
1161
 
1162
+ /**
1163
+ * Handler to update the working memory for a thread (optionally resource-scoped).
1164
+ * @param threadId - the thread id
1165
+ * @param body - the body containing the working memory to update and the resource id (optional)
1166
+ */
1167
+ export declare function updateWorkingMemoryHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
1168
+ body: Omit<Parameters<MastraMemory['updateWorkingMemory']>[0], 'threadId'>;
1169
+ }): Promise<{
1170
+ success: boolean;
1171
+ }>;
1172
+
987
1173
  declare interface UpsertRequest {
988
1174
  indexName: string;
989
1175
  vectors: number[][];
@@ -1052,9 +1238,12 @@ export declare namespace workflows {
1052
1238
  startWorkflowRunHandler,
1053
1239
  watchWorkflowHandler,
1054
1240
  streamWorkflowHandler,
1241
+ streamVNextWorkflowHandler,
1055
1242
  resumeAsyncWorkflowHandler,
1056
1243
  resumeWorkflowHandler,
1057
- getWorkflowRunsHandler
1244
+ getWorkflowRunsHandler,
1245
+ cancelWorkflowRunHandler,
1246
+ sendWorkflowRunEventHandler
1058
1247
  }
1059
1248
  }
1060
1249
 
@@ -13,6 +13,7 @@ var HTTPException = class extends Error {
13
13
  super(options?.message, { cause: options?.cause });
14
14
  this.res = options?.res;
15
15
  this.status = status;
16
+ this.stack = options?.stack || this.stack;
16
17
  }
17
18
  /**
18
19
  * Returns the response object associated with the exception.
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk57CJTIPW_cjs = require('./chunk-57CJTIPW.cjs');
4
- var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
5
- var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
3
+ var chunkCCGRCYWJ_cjs = require('./chunk-CCGRCYWJ.cjs');
4
+ var chunkPZQDCRPV_cjs = require('./chunk-PZQDCRPV.cjs');
5
+ var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
6
6
  var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
7
7
 
8
8
  // src/server/handlers/network.ts
@@ -47,7 +47,7 @@ async function getNetworksHandler({
47
47
  );
48
48
  return serializedNetworks;
49
49
  } catch (error) {
50
- return chunk64U3UDTH_cjs.handleError(error, "Error getting networks");
50
+ return chunkPZQDCRPV_cjs.handleError(error, "Error getting networks");
51
51
  }
52
52
  }
53
53
  async function getNetworkByIdHandler({
@@ -62,7 +62,7 @@ async function getNetworkByIdHandler({
62
62
  return network2.formatAgentId(routingAgent2.name) === networkId;
63
63
  });
64
64
  if (!network) {
65
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Network not found" });
65
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Network not found" });
66
66
  }
67
67
  const routingAgent = network.getRoutingAgent();
68
68
  const routingLLM = await routingAgent.getLLM({ runtimeContext });
@@ -88,7 +88,7 @@ async function getNetworkByIdHandler({
88
88
  };
89
89
  return serializedNetwork;
90
90
  } catch (error) {
91
- return chunk64U3UDTH_cjs.handleError(error, "Error getting network by ID");
91
+ return chunkPZQDCRPV_cjs.handleError(error, "Error getting network by ID");
92
92
  }
93
93
  }
94
94
  async function generateHandler({
@@ -100,14 +100,14 @@ async function generateHandler({
100
100
  try {
101
101
  const network = mastra.getNetwork(networkId);
102
102
  if (!network) {
103
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Network not found" });
103
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Network not found" });
104
104
  }
105
- chunk57CJTIPW_cjs.validateBody({ messages: body.messages });
105
+ chunkCCGRCYWJ_cjs.validateBody({ messages: body.messages });
106
106
  const { messages, ...rest } = body;
107
107
  const result = await network.generate(messages, { ...rest, runtimeContext });
108
108
  return result;
109
109
  } catch (error) {
110
- return chunk64U3UDTH_cjs.handleError(error, "Error generating from network");
110
+ return chunkPZQDCRPV_cjs.handleError(error, "Error generating from network");
111
111
  }
112
112
  }
113
113
  async function streamGenerateHandler({
@@ -119,9 +119,9 @@ async function streamGenerateHandler({
119
119
  try {
120
120
  const network = mastra.getNetwork(networkId);
121
121
  if (!network) {
122
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Network not found" });
122
+ throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Network not found" });
123
123
  }
124
- chunk57CJTIPW_cjs.validateBody({ messages: body.messages });
124
+ chunkCCGRCYWJ_cjs.validateBody({ messages: body.messages });
125
125
  const { messages, output, ...rest } = body;
126
126
  const streamResult = await network.stream(messages, {
127
127
  output,
@@ -137,7 +137,7 @@ async function streamGenerateHandler({
137
137
  });
138
138
  return streamResponse;
139
139
  } catch (error) {
140
- return chunk64U3UDTH_cjs.handleError(error, "Error streaming from network");
140
+ return chunkPZQDCRPV_cjs.handleError(error, "Error streaming from network");
141
141
  }
142
142
  }
143
143