@mastra/server 0.0.0-fix-memory-xxhash-20250409202110 → 0.0.0-fix-message-embedding-20250506021742
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{LICENSE → LICENSE.md} +3 -1
- package/dist/_tsup-dts-rollup.d.cts +138 -34
- package/dist/_tsup-dts-rollup.d.ts +138 -34
- package/dist/{chunk-2JQC6JWP.js → chunk-3EJZQ6TQ.js} +4 -1
- package/dist/{chunk-ILW7XYNJ.js → chunk-3XTEV33Q.js} +33 -12
- package/dist/{chunk-GV52BII2.cjs → chunk-4BIX6GMY.cjs} +63 -34
- package/dist/{chunk-A7DF4ETD.cjs → chunk-55HTWX4C.cjs} +2 -9
- package/dist/{chunk-YNSGUC2O.js → chunk-5JNVY6DU.js} +8 -4
- package/dist/{chunk-QH6XWSXP.cjs → chunk-5SWCVTNL.cjs} +38 -38
- package/dist/{chunk-5JOF627H.cjs → chunk-5YGDYMRB.cjs} +54 -30
- package/dist/{chunk-CWSDZEZG.cjs → chunk-AMVOS7YB.cjs} +6 -4
- package/dist/{chunk-DVPP5S6I.js → chunk-BPL2CBLV.js} +6 -4
- package/dist/{chunk-X37I6GZT.cjs → chunk-CHFORQ7J.cjs} +39 -18
- package/dist/{chunk-4C3EPMMF.cjs → chunk-D3G23FP3.cjs} +12 -8
- package/dist/chunk-FOXHTOQZ.cjs +324 -0
- package/dist/chunk-IQTNZSFP.js +312 -0
- package/dist/{chunk-VK6FX47H.js → chunk-OMN3UI6X.js} +38 -38
- package/dist/{chunk-3RVHWGWO.js → chunk-Q6SHQECN.js} +2 -9
- package/dist/{chunk-2YONKUWB.js → chunk-QJ3AHN64.js} +54 -30
- package/dist/{chunk-VB7KH62D.cjs → chunk-SKBVVI24.cjs} +4 -1
- package/dist/{chunk-BMA2ORRT.js → chunk-Y3SV5XK4.js} +61 -32
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/network.cjs +5 -5
- package/dist/server/handlers/network.js +1 -1
- package/dist/server/handlers/telemetry.cjs +3 -3
- package/dist/server/handlers/telemetry.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/vNextWorkflows.cjs +46 -0
- package/dist/server/handlers/vNextWorkflows.d.cts +10 -0
- package/dist/server/handlers/vNextWorkflows.d.ts +10 -0
- package/dist/server/handlers/vNextWorkflows.js +1 -0
- package/dist/server/handlers/voice.cjs +4 -4
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +11 -11
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +19 -14
- package/dist/server/handlers.d.cts +1 -0
- package/dist/server/handlers.d.ts +1 -0
- package/dist/server/handlers.js +8 -7
- package/package.json +6 -6
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
import type { Agent } from '@mastra/core/agent';
|
|
2
2
|
import type { AgentNetwork } from '@mastra/core/network';
|
|
3
|
-
import { BaseLogMessage } from '@mastra/core';
|
|
3
|
+
import type { BaseLogMessage } from '@mastra/core/logger';
|
|
4
4
|
import { CoreMessage } from 'ai';
|
|
5
|
-
import { EvalRow } from '@mastra/core';
|
|
5
|
+
import { EvalRow } from '@mastra/core/storage';
|
|
6
6
|
import { GenerateObjectResult } from 'ai';
|
|
7
7
|
import { GenerateTextResult } from 'ai';
|
|
8
8
|
import type { Mastra } from '@mastra/core/mastra';
|
|
9
|
-
import type { Mastra as Mastra_2 } from '@mastra/core';
|
|
10
9
|
import type { MastraMemory } from '@mastra/core/memory';
|
|
11
10
|
import { Message } from 'ai';
|
|
12
|
-
import { MessageType } from '@mastra/core';
|
|
11
|
+
import { MessageType } from '@mastra/core/memory';
|
|
12
|
+
import { NewStep } from '@mastra/core/workflows/vNext';
|
|
13
|
+
import type { NewWorkflow } from '@mastra/core/workflows/vNext';
|
|
13
14
|
import type { QueryResult } from '@mastra/core/vector';
|
|
14
15
|
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
16
|
+
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
|
17
|
+
import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
|
|
18
|
+
import { SerializedStepFlowEntry } from '@mastra/core/workflows/vNext';
|
|
19
|
+
import { Step } from '@mastra/core/workflows';
|
|
20
|
+
import { StepExecutionContext } from '@mastra/core/workflows';
|
|
21
|
+
import { StepGraph } from '@mastra/core/workflows';
|
|
22
|
+
import { StorageThreadType } from '@mastra/core/memory';
|
|
19
23
|
import type { ToolAction } from '@mastra/core/tools';
|
|
20
24
|
import type { VercelTool } from '@mastra/core/tools';
|
|
21
25
|
import type { Workflow } from '@mastra/core/workflows';
|
|
22
|
-
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core';
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
26
|
+
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
|
|
27
|
+
import { WorkflowResult } from '@mastra/core/workflows/vNext';
|
|
28
|
+
import { WorkflowRunResult } from '@mastra/core/workflows';
|
|
29
|
+
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
30
|
+
import { ZodType } from 'zod';
|
|
31
|
+
import { ZodTypeDef } from 'zod';
|
|
25
32
|
|
|
26
33
|
export declare namespace agents {
|
|
27
34
|
export {
|
|
@@ -67,6 +74,10 @@ export declare function createThreadHandler({ mastra, agentId, body, }: Pick<Mem
|
|
|
67
74
|
};
|
|
68
75
|
}): Promise<StorageThreadType>;
|
|
69
76
|
|
|
77
|
+
export declare function createVNextWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
78
|
+
runId: string;
|
|
79
|
+
}>;
|
|
80
|
+
|
|
70
81
|
export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
|
|
71
82
|
indexName?: string;
|
|
72
83
|
}): Promise<{
|
|
@@ -87,23 +98,27 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
|
|
|
87
98
|
metric: string | undefined;
|
|
88
99
|
}>;
|
|
89
100
|
|
|
90
|
-
export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
|
|
101
|
+
export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
|
|
91
102
|
agentId?: string;
|
|
92
103
|
data: any;
|
|
104
|
+
runtimeContext: RuntimeContext;
|
|
93
105
|
}): Promise<any>;
|
|
94
106
|
|
|
95
|
-
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
|
|
107
|
+
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
|
|
96
108
|
data?: unknown;
|
|
109
|
+
runtimeContext: RuntimeContext;
|
|
97
110
|
}) => Promise<any>;
|
|
98
111
|
|
|
99
|
-
export declare function generateHandler({ mastra, agentId, body, }: Context & {
|
|
112
|
+
export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
113
|
+
runtimeContext: RuntimeContext;
|
|
100
114
|
agentId: string;
|
|
101
115
|
body: GetBody<'generate'> & {
|
|
102
116
|
resourceid?: string;
|
|
103
117
|
};
|
|
104
118
|
}): Promise<GenerateTextResult<any, any>>;
|
|
105
119
|
|
|
106
|
-
export declare function generateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
|
|
120
|
+
export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
|
|
121
|
+
runtimeContext: RuntimeContext;
|
|
107
122
|
body: {
|
|
108
123
|
messages?: Parameters<AgentNetwork['generate']>[0];
|
|
109
124
|
} & Parameters<AgentNetwork['generate']>[1];
|
|
@@ -117,11 +132,10 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
|
|
|
117
132
|
text?: string;
|
|
118
133
|
speakerId?: string;
|
|
119
134
|
};
|
|
120
|
-
}): Promise<
|
|
121
|
-
audioData: Buffer<ArrayBuffer>;
|
|
122
|
-
}>;
|
|
135
|
+
}): Promise<NodeJS.ReadableStream>;
|
|
123
136
|
|
|
124
|
-
export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
|
|
137
|
+
export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
138
|
+
runtimeContext: RuntimeContext;
|
|
125
139
|
agentId: string;
|
|
126
140
|
}): Promise<{
|
|
127
141
|
name: any;
|
|
@@ -131,7 +145,9 @@ export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
|
|
|
131
145
|
modelId: string;
|
|
132
146
|
}>;
|
|
133
147
|
|
|
134
|
-
export declare function getAgentsHandler({ mastra }: Context
|
|
148
|
+
export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
|
|
149
|
+
runtimeContext: RuntimeContext;
|
|
150
|
+
}): Promise<any>;
|
|
135
151
|
|
|
136
152
|
declare type GetBody<T extends keyof Agent & {
|
|
137
153
|
[K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
|
|
@@ -139,7 +155,8 @@ declare type GetBody<T extends keyof Agent & {
|
|
|
139
155
|
messages: Parameters<Agent[T]>[0];
|
|
140
156
|
} & Parameters<Agent[T]>[1];
|
|
141
157
|
|
|
142
|
-
export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
|
|
158
|
+
export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
159
|
+
runtimeContext: RuntimeContext;
|
|
143
160
|
agentId: string;
|
|
144
161
|
}): Promise<{
|
|
145
162
|
id: string;
|
|
@@ -148,7 +165,8 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
|
|
|
148
165
|
evals: EvalRow[];
|
|
149
166
|
}>;
|
|
150
167
|
|
|
151
|
-
export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
|
|
168
|
+
export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
169
|
+
runtimeContext: RuntimeContext;
|
|
152
170
|
agentId: string;
|
|
153
171
|
}): Promise<{
|
|
154
172
|
id: string;
|
|
@@ -159,7 +177,7 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Contex
|
|
|
159
177
|
|
|
160
178
|
export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
|
|
161
179
|
|
|
162
|
-
export declare function getLogsHandler({ mastra, transportId }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
|
|
180
|
+
export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
|
|
163
181
|
|
|
164
182
|
export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
|
|
165
183
|
transports: string[];
|
|
@@ -174,7 +192,7 @@ export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<
|
|
|
174
192
|
uiMessages: Message[];
|
|
175
193
|
}>;
|
|
176
194
|
|
|
177
|
-
export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
|
|
195
|
+
export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
178
196
|
id: string;
|
|
179
197
|
name: string;
|
|
180
198
|
instructions: string;
|
|
@@ -189,7 +207,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
|
|
|
189
207
|
};
|
|
190
208
|
}>;
|
|
191
209
|
|
|
192
|
-
export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
|
|
210
|
+
export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
|
|
193
211
|
id: string;
|
|
194
212
|
name: string;
|
|
195
213
|
instructions: string;
|
|
@@ -221,6 +239,26 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
|
|
|
221
239
|
|
|
222
240
|
export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
|
|
223
241
|
|
|
242
|
+
export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
|
|
243
|
+
steps: any;
|
|
244
|
+
name: string | undefined;
|
|
245
|
+
stepGraph: SerializedStepFlowEntry[];
|
|
246
|
+
inputSchema: string | undefined;
|
|
247
|
+
outputSchema: string | undefined;
|
|
248
|
+
}>;
|
|
249
|
+
|
|
250
|
+
export declare function getVNextWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRun']>>;
|
|
251
|
+
|
|
252
|
+
export declare function getVNextWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: VNextWorkflowContext & {
|
|
253
|
+
fromDate?: Date;
|
|
254
|
+
toDate?: Date;
|
|
255
|
+
limit?: number;
|
|
256
|
+
offset?: number;
|
|
257
|
+
resourceId?: string;
|
|
258
|
+
}): Promise<WorkflowRuns>;
|
|
259
|
+
|
|
260
|
+
export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): Promise<any>;
|
|
261
|
+
|
|
224
262
|
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
|
|
225
263
|
stepGraph: StepGraph;
|
|
226
264
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
@@ -233,7 +271,13 @@ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowC
|
|
|
233
271
|
|
|
234
272
|
export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
|
|
235
273
|
|
|
236
|
-
export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext
|
|
274
|
+
export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
|
|
275
|
+
fromDate?: Date;
|
|
276
|
+
toDate?: Date;
|
|
277
|
+
limit?: number;
|
|
278
|
+
offset?: number;
|
|
279
|
+
resourceId?: string;
|
|
280
|
+
}): Promise<WorkflowRuns>;
|
|
237
281
|
|
|
238
282
|
export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
|
|
239
283
|
|
|
@@ -346,6 +390,7 @@ export declare namespace network {
|
|
|
346
390
|
|
|
347
391
|
declare interface NetworkContext extends Context {
|
|
348
392
|
networkId?: string;
|
|
393
|
+
runtimeContext: RuntimeContext;
|
|
349
394
|
}
|
|
350
395
|
|
|
351
396
|
declare interface QueryRequest {
|
|
@@ -362,18 +407,38 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
|
|
|
362
407
|
|
|
363
408
|
declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
|
|
364
409
|
|
|
365
|
-
export declare function
|
|
410
|
+
export declare function resumeAsyncVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
|
|
411
|
+
body: {
|
|
412
|
+
step: string | string[];
|
|
413
|
+
resumeData?: unknown;
|
|
414
|
+
};
|
|
415
|
+
runtimeContext?: RuntimeContext_2;
|
|
416
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
|
|
417
|
+
|
|
418
|
+
export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
366
419
|
body: {
|
|
367
420
|
stepId: string;
|
|
368
421
|
context: any;
|
|
369
422
|
};
|
|
423
|
+
runtimeContext: RuntimeContext;
|
|
370
424
|
}): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
|
|
371
425
|
|
|
372
|
-
export declare function
|
|
426
|
+
export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
|
|
427
|
+
body: {
|
|
428
|
+
step: string | string[];
|
|
429
|
+
resumeData?: unknown;
|
|
430
|
+
};
|
|
431
|
+
runtimeContext?: RuntimeContext_2;
|
|
432
|
+
}): Promise<{
|
|
433
|
+
message: string;
|
|
434
|
+
}>;
|
|
435
|
+
|
|
436
|
+
export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
373
437
|
body: {
|
|
374
438
|
stepId: string;
|
|
375
439
|
context: any;
|
|
376
440
|
};
|
|
441
|
+
runtimeContext: RuntimeContext;
|
|
377
442
|
}): Promise<{
|
|
378
443
|
message: string;
|
|
379
444
|
}>;
|
|
@@ -386,12 +451,26 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
|
|
|
386
451
|
|
|
387
452
|
declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
388
453
|
|
|
389
|
-
export declare function
|
|
454
|
+
export declare function startAsyncVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
455
|
+
inputData?: unknown;
|
|
456
|
+
runtimeContext?: RuntimeContext_2;
|
|
457
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
|
|
458
|
+
|
|
459
|
+
export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
390
460
|
triggerData?: unknown;
|
|
461
|
+
runtimeContext: RuntimeContext;
|
|
391
462
|
}): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
|
|
392
463
|
|
|
393
|
-
export declare function
|
|
464
|
+
export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
465
|
+
inputData?: unknown;
|
|
466
|
+
runtimeContext?: RuntimeContext_2;
|
|
467
|
+
}): Promise<{
|
|
468
|
+
message: string;
|
|
469
|
+
}>;
|
|
470
|
+
|
|
471
|
+
export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
394
472
|
triggerData?: unknown;
|
|
473
|
+
runtimeContext: RuntimeContext;
|
|
395
474
|
}): Promise<{
|
|
396
475
|
message: string;
|
|
397
476
|
}>;
|
|
@@ -415,14 +494,16 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
|
|
|
415
494
|
traceCount: number;
|
|
416
495
|
}>;
|
|
417
496
|
|
|
418
|
-
export declare function streamGenerateHandler({ mastra, agentId, body, }: Context & {
|
|
497
|
+
export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
498
|
+
runtimeContext: RuntimeContext;
|
|
419
499
|
agentId: string;
|
|
420
500
|
body: GetBody<'stream'> & {
|
|
421
501
|
resourceid?: string;
|
|
422
502
|
};
|
|
423
503
|
}): Promise<Response | undefined>;
|
|
424
504
|
|
|
425
|
-
export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
|
|
505
|
+
export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
|
|
506
|
+
runtimeContext: RuntimeContext;
|
|
426
507
|
body: {
|
|
427
508
|
messages?: Parameters<AgentNetwork['stream']>[0];
|
|
428
509
|
} & Parameters<AgentNetwork['stream']>[1];
|
|
@@ -444,6 +525,8 @@ declare interface TelemetryContext extends Context {
|
|
|
444
525
|
page?: number;
|
|
445
526
|
perPage?: number;
|
|
446
527
|
attribute?: string | string[];
|
|
528
|
+
fromDate?: Date;
|
|
529
|
+
toDate?: Date;
|
|
447
530
|
};
|
|
448
531
|
}
|
|
449
532
|
|
|
@@ -526,6 +609,26 @@ declare interface VectorContext extends Context {
|
|
|
526
609
|
vectorName?: string;
|
|
527
610
|
}
|
|
528
611
|
|
|
612
|
+
declare interface VNextWorkflowContext extends Context {
|
|
613
|
+
workflowId?: string;
|
|
614
|
+
runId?: string;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
export declare namespace vNextWorkflows {
|
|
618
|
+
export {
|
|
619
|
+
getVNextWorkflowsHandler,
|
|
620
|
+
getVNextWorkflowByIdHandler,
|
|
621
|
+
getVNextWorkflowRunHandler,
|
|
622
|
+
createVNextWorkflowRunHandler,
|
|
623
|
+
startAsyncVNextWorkflowHandler,
|
|
624
|
+
startVNextWorkflowRunHandler,
|
|
625
|
+
watchVNextWorkflowHandler,
|
|
626
|
+
resumeAsyncVNextWorkflowHandler,
|
|
627
|
+
resumeVNextWorkflowHandler,
|
|
628
|
+
getVNextWorkflowRunsHandler
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
529
632
|
export declare namespace voice {
|
|
530
633
|
export {
|
|
531
634
|
getSpeakersHandler,
|
|
@@ -538,10 +641,11 @@ declare interface VoiceContext extends Context {
|
|
|
538
641
|
agentId?: string;
|
|
539
642
|
}
|
|
540
643
|
|
|
644
|
+
export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
645
|
+
|
|
541
646
|
export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
542
647
|
|
|
543
|
-
declare interface WorkflowContext {
|
|
544
|
-
mastra: Mastra_2;
|
|
648
|
+
declare interface WorkflowContext extends Context {
|
|
545
649
|
workflowId?: string;
|
|
546
650
|
runId?: string;
|
|
547
651
|
}
|
|
@@ -9,7 +9,10 @@ __export(logs_exports, {
|
|
|
9
9
|
getLogsByRunIdHandler: () => getLogsByRunIdHandler,
|
|
10
10
|
getLogsHandler: () => getLogsHandler
|
|
11
11
|
});
|
|
12
|
-
async function getLogsHandler({
|
|
12
|
+
async function getLogsHandler({
|
|
13
|
+
mastra,
|
|
14
|
+
transportId
|
|
15
|
+
}) {
|
|
13
16
|
try {
|
|
14
17
|
validateBody({ transportId });
|
|
15
18
|
const logs = await mastra.getLogs(transportId);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { stringify, esm_default } from './chunk-
|
|
1
|
+
import { stringify, esm_default } from './chunk-OMN3UI6X.js';
|
|
2
2
|
import { handleError } from './chunk-3AHQ5RGN.js';
|
|
3
3
|
import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
|
|
4
4
|
import { ReadableStream } from 'node:stream/web';
|
|
@@ -32,7 +32,9 @@ async function getWorkflowsHandler({ mastra }) {
|
|
|
32
32
|
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
33
33
|
const _step = step;
|
|
34
34
|
acc2[key2] = {
|
|
35
|
-
|
|
35
|
+
id: _step.id,
|
|
36
|
+
description: _step.description,
|
|
37
|
+
workflowId: _step.workflowId,
|
|
36
38
|
inputSchema: _step.inputSchema ? stringify(esm_default(_step.inputSchema)) : void 0,
|
|
37
39
|
outputSchema: _step.outputSchema ? stringify(esm_default(_step.outputSchema)) : void 0
|
|
38
40
|
};
|
|
@@ -65,7 +67,9 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
65
67
|
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
66
68
|
const _step = step;
|
|
67
69
|
acc[key] = {
|
|
68
|
-
|
|
70
|
+
id: _step.id,
|
|
71
|
+
description: _step.description,
|
|
72
|
+
workflowId: _step.workflowId,
|
|
69
73
|
inputSchema: _step.inputSchema ? stringify(esm_default(_step.inputSchema)) : void 0,
|
|
70
74
|
outputSchema: _step.outputSchema ? stringify(esm_default(_step.outputSchema)) : void 0
|
|
71
75
|
};
|
|
@@ -78,6 +82,7 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
78
82
|
}
|
|
79
83
|
async function startAsyncWorkflowHandler({
|
|
80
84
|
mastra,
|
|
85
|
+
runtimeContext,
|
|
81
86
|
workflowId,
|
|
82
87
|
runId,
|
|
83
88
|
triggerData
|
|
@@ -93,7 +98,8 @@ async function startAsyncWorkflowHandler({
|
|
|
93
98
|
if (!runId) {
|
|
94
99
|
const { start } = workflow.createRun();
|
|
95
100
|
const result2 = await start({
|
|
96
|
-
triggerData
|
|
101
|
+
triggerData,
|
|
102
|
+
runtimeContext
|
|
97
103
|
});
|
|
98
104
|
return result2;
|
|
99
105
|
}
|
|
@@ -102,7 +108,8 @@ async function startAsyncWorkflowHandler({
|
|
|
102
108
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
103
109
|
}
|
|
104
110
|
const result = await run.start({
|
|
105
|
-
triggerData
|
|
111
|
+
triggerData,
|
|
112
|
+
runtimeContext
|
|
106
113
|
});
|
|
107
114
|
return result;
|
|
108
115
|
} catch (error) {
|
|
@@ -155,6 +162,7 @@ async function createRunHandler({
|
|
|
155
162
|
}
|
|
156
163
|
async function startWorkflowRunHandler({
|
|
157
164
|
mastra,
|
|
165
|
+
runtimeContext,
|
|
158
166
|
workflowId,
|
|
159
167
|
runId,
|
|
160
168
|
triggerData
|
|
@@ -172,7 +180,8 @@ async function startWorkflowRunHandler({
|
|
|
172
180
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
173
181
|
}
|
|
174
182
|
await run.start({
|
|
175
|
-
triggerData
|
|
183
|
+
triggerData,
|
|
184
|
+
runtimeContext
|
|
176
185
|
});
|
|
177
186
|
return { message: "Workflow run started" };
|
|
178
187
|
} catch (e) {
|
|
@@ -227,7 +236,8 @@ async function resumeAsyncWorkflowHandler({
|
|
|
227
236
|
mastra,
|
|
228
237
|
workflowId,
|
|
229
238
|
runId,
|
|
230
|
-
body
|
|
239
|
+
body,
|
|
240
|
+
runtimeContext
|
|
231
241
|
}) {
|
|
232
242
|
try {
|
|
233
243
|
if (!workflowId) {
|
|
@@ -243,7 +253,8 @@ async function resumeAsyncWorkflowHandler({
|
|
|
243
253
|
}
|
|
244
254
|
const result = await run.resume({
|
|
245
255
|
stepId: body.stepId,
|
|
246
|
-
context: body.context
|
|
256
|
+
context: body.context,
|
|
257
|
+
runtimeContext
|
|
247
258
|
});
|
|
248
259
|
return result;
|
|
249
260
|
} catch (error) {
|
|
@@ -254,7 +265,8 @@ async function resumeWorkflowHandler({
|
|
|
254
265
|
mastra,
|
|
255
266
|
workflowId,
|
|
256
267
|
runId,
|
|
257
|
-
body
|
|
268
|
+
body,
|
|
269
|
+
runtimeContext
|
|
258
270
|
}) {
|
|
259
271
|
try {
|
|
260
272
|
if (!workflowId) {
|
|
@@ -270,20 +282,29 @@ async function resumeWorkflowHandler({
|
|
|
270
282
|
}
|
|
271
283
|
await run.resume({
|
|
272
284
|
stepId: body.stepId,
|
|
273
|
-
context: body.context
|
|
285
|
+
context: body.context,
|
|
286
|
+
runtimeContext
|
|
274
287
|
});
|
|
275
288
|
return { message: "Workflow run resumed" };
|
|
276
289
|
} catch (error) {
|
|
277
290
|
return handleError(error, "Error resuming workflow");
|
|
278
291
|
}
|
|
279
292
|
}
|
|
280
|
-
async function getWorkflowRunsHandler({
|
|
293
|
+
async function getWorkflowRunsHandler({
|
|
294
|
+
mastra,
|
|
295
|
+
workflowId,
|
|
296
|
+
fromDate,
|
|
297
|
+
toDate,
|
|
298
|
+
limit,
|
|
299
|
+
offset,
|
|
300
|
+
resourceId
|
|
301
|
+
}) {
|
|
281
302
|
try {
|
|
282
303
|
if (!workflowId) {
|
|
283
304
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
284
305
|
}
|
|
285
306
|
const workflow = mastra.getWorkflow(workflowId);
|
|
286
|
-
const workflowRuns = await workflow.getWorkflowRuns() || {
|
|
307
|
+
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
287
308
|
runs: [],
|
|
288
309
|
total: 0
|
|
289
310
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5SWCVTNL_cjs = require('./chunk-5SWCVTNL.cjs');
|
|
4
4
|
var chunkQN4KF3BH_cjs = require('./chunk-QN4KF3BH.cjs');
|
|
5
5
|
var chunkZLBRQFDD_cjs = require('./chunk-ZLBRQFDD.cjs');
|
|
6
6
|
var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
|
|
@@ -15,27 +15,35 @@ chunkFV45V6WC_cjs.__export(agents_exports, {
|
|
|
15
15
|
getLiveEvalsByAgentIdHandler: () => getLiveEvalsByAgentIdHandler,
|
|
16
16
|
streamGenerateHandler: () => streamGenerateHandler
|
|
17
17
|
});
|
|
18
|
-
async function getAgentsHandler({ mastra }) {
|
|
18
|
+
async function getAgentsHandler({ mastra, runtimeContext }) {
|
|
19
19
|
try {
|
|
20
20
|
const agents = mastra.getAgents();
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
const serializedAgentsMap = await Promise.all(
|
|
22
|
+
Object.entries(agents).map(async ([id, agent]) => {
|
|
23
|
+
const instructions = await agent.getInstructions({ runtimeContext });
|
|
24
|
+
const tools = await agent.getTools({ runtimeContext });
|
|
25
|
+
const llm = await agent.getLLM({ runtimeContext });
|
|
26
|
+
const serializedAgentTools = Object.entries(tools || {}).reduce((acc, [key, tool]) => {
|
|
27
|
+
const _tool = tool;
|
|
28
|
+
acc[key] = {
|
|
29
|
+
..._tool,
|
|
30
|
+
inputSchema: _tool.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_tool.inputSchema)) : void 0,
|
|
31
|
+
outputSchema: _tool.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_tool.outputSchema)) : void 0
|
|
32
|
+
};
|
|
33
|
+
return acc;
|
|
34
|
+
}, {});
|
|
35
|
+
return {
|
|
36
|
+
id,
|
|
37
|
+
name: agent.name,
|
|
38
|
+
instructions,
|
|
39
|
+
tools: serializedAgentTools,
|
|
40
|
+
provider: llm?.getProvider(),
|
|
41
|
+
modelId: llm?.getModelId()
|
|
29
42
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
instructions: agent.instructions,
|
|
35
|
-
tools: serializedAgentTools,
|
|
36
|
-
provider: agent.llm?.getProvider(),
|
|
37
|
-
modelId: agent.llm?.getModelId()
|
|
38
|
-
};
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
const serializedAgents = serializedAgentsMap.reduce((acc, { id, ...rest }) => {
|
|
46
|
+
acc[id] = rest;
|
|
39
47
|
return acc;
|
|
40
48
|
}, {});
|
|
41
49
|
return serializedAgents;
|
|
@@ -43,54 +51,71 @@ async function getAgentsHandler({ mastra }) {
|
|
|
43
51
|
return chunkZLBRQFDD_cjs.handleError(error, "Error getting agents");
|
|
44
52
|
}
|
|
45
53
|
}
|
|
46
|
-
async function getAgentByIdHandler({
|
|
54
|
+
async function getAgentByIdHandler({
|
|
55
|
+
mastra,
|
|
56
|
+
runtimeContext,
|
|
57
|
+
agentId
|
|
58
|
+
}) {
|
|
47
59
|
try {
|
|
48
60
|
const agent = mastra.getAgent(agentId);
|
|
49
61
|
if (!agent) {
|
|
50
62
|
throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Agent not found" });
|
|
51
63
|
}
|
|
52
|
-
const
|
|
64
|
+
const tools = await agent.getTools({ runtimeContext });
|
|
65
|
+
const serializedAgentTools = Object.entries(tools || {}).reduce((acc, [key, tool]) => {
|
|
53
66
|
const _tool = tool;
|
|
54
67
|
acc[key] = {
|
|
55
68
|
..._tool,
|
|
56
|
-
inputSchema: _tool.inputSchema ?
|
|
57
|
-
outputSchema: _tool.outputSchema ?
|
|
69
|
+
inputSchema: _tool.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_tool.inputSchema)) : void 0,
|
|
70
|
+
outputSchema: _tool.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_tool.outputSchema)) : void 0
|
|
58
71
|
};
|
|
59
72
|
return acc;
|
|
60
73
|
}, {});
|
|
74
|
+
const instructions = await agent.getInstructions({ runtimeContext });
|
|
75
|
+
const llm = await agent.getLLM({ runtimeContext });
|
|
61
76
|
return {
|
|
62
77
|
name: agent.name,
|
|
63
|
-
instructions
|
|
78
|
+
instructions,
|
|
64
79
|
tools: serializedAgentTools,
|
|
65
|
-
provider:
|
|
66
|
-
modelId:
|
|
80
|
+
provider: llm?.getProvider(),
|
|
81
|
+
modelId: llm?.getModelId()
|
|
67
82
|
};
|
|
68
83
|
} catch (error) {
|
|
69
84
|
return chunkZLBRQFDD_cjs.handleError(error, "Error getting agent");
|
|
70
85
|
}
|
|
71
86
|
}
|
|
72
|
-
async function getEvalsByAgentIdHandler({
|
|
87
|
+
async function getEvalsByAgentIdHandler({
|
|
88
|
+
mastra,
|
|
89
|
+
runtimeContext,
|
|
90
|
+
agentId
|
|
91
|
+
}) {
|
|
73
92
|
try {
|
|
74
93
|
const agent = mastra.getAgent(agentId);
|
|
75
|
-
const evals = await mastra.getStorage()?.
|
|
94
|
+
const evals = await mastra.getStorage()?.getEvalsByAgentName?.(agent.name, "test") || [];
|
|
95
|
+
const instructions = await agent.getInstructions({ runtimeContext });
|
|
76
96
|
return {
|
|
77
97
|
id: agentId,
|
|
78
98
|
name: agent.name,
|
|
79
|
-
instructions
|
|
99
|
+
instructions,
|
|
80
100
|
evals
|
|
81
101
|
};
|
|
82
102
|
} catch (error) {
|
|
83
103
|
return chunkZLBRQFDD_cjs.handleError(error, "Error getting test evals");
|
|
84
104
|
}
|
|
85
105
|
}
|
|
86
|
-
async function getLiveEvalsByAgentIdHandler({
|
|
106
|
+
async function getLiveEvalsByAgentIdHandler({
|
|
107
|
+
mastra,
|
|
108
|
+
runtimeContext,
|
|
109
|
+
agentId
|
|
110
|
+
}) {
|
|
87
111
|
try {
|
|
88
112
|
const agent = mastra.getAgent(agentId);
|
|
89
|
-
const evals = await mastra.getStorage()?.
|
|
113
|
+
const evals = await mastra.getStorage()?.getEvalsByAgentName?.(agent.name, "live") || [];
|
|
114
|
+
const instructions = await agent.getInstructions({ runtimeContext });
|
|
90
115
|
return {
|
|
91
116
|
id: agentId,
|
|
92
117
|
name: agent.name,
|
|
93
|
-
instructions
|
|
118
|
+
instructions,
|
|
94
119
|
evals
|
|
95
120
|
};
|
|
96
121
|
} catch (error) {
|
|
@@ -99,6 +124,7 @@ async function getLiveEvalsByAgentIdHandler({ mastra, agentId }) {
|
|
|
99
124
|
}
|
|
100
125
|
async function generateHandler({
|
|
101
126
|
mastra,
|
|
127
|
+
runtimeContext,
|
|
102
128
|
agentId,
|
|
103
129
|
body
|
|
104
130
|
}) {
|
|
@@ -113,7 +139,8 @@ async function generateHandler({
|
|
|
113
139
|
const result = await agent.generate(messages, {
|
|
114
140
|
...rest,
|
|
115
141
|
// @ts-expect-error TODO fix types
|
|
116
|
-
resourceId: finalResourceId
|
|
142
|
+
resourceId: finalResourceId,
|
|
143
|
+
runtimeContext
|
|
117
144
|
});
|
|
118
145
|
return result;
|
|
119
146
|
} catch (error) {
|
|
@@ -122,6 +149,7 @@ async function generateHandler({
|
|
|
122
149
|
}
|
|
123
150
|
async function streamGenerateHandler({
|
|
124
151
|
mastra,
|
|
152
|
+
runtimeContext,
|
|
125
153
|
agentId,
|
|
126
154
|
body
|
|
127
155
|
}) {
|
|
@@ -136,7 +164,8 @@ async function streamGenerateHandler({
|
|
|
136
164
|
const streamResult = await agent.stream(messages, {
|
|
137
165
|
...rest,
|
|
138
166
|
// @ts-expect-error TODO fix types
|
|
139
|
-
resourceId: finalResourceId
|
|
167
|
+
resourceId: finalResourceId,
|
|
168
|
+
runtimeContext
|
|
140
169
|
});
|
|
141
170
|
const streamResponse = rest.output ? streamResult.toTextStreamResponse() : streamResult.toDataStreamResponse({
|
|
142
171
|
sendUsage: true,
|