@mastra/server 0.0.1-alpha.6 → 0.10.1-alpha.0
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/README.md +48 -135
- package/dist/_tsup-dts-rollup.d.cts +316 -52
- package/dist/_tsup-dts-rollup.d.ts +316 -52
- package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
- package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
- package/dist/chunk-5SN4U5AC.cjs +508 -0
- package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/{chunk-VB7KH62D.cjs → chunk-7DLZLWJV.cjs} +16 -12
- package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
- package/dist/{chunk-2YONKUWB.js → chunk-C7564HUT.js} +58 -33
- package/dist/chunk-D4IRYCUI.cjs +235 -0
- package/dist/{chunk-RBQASTUP.js → chunk-DJJIUEL2.js} +13 -5
- package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
- package/dist/{chunk-3RVHWGWO.js → chunk-HFWCEP5S.js} +6 -12
- package/dist/chunk-KUNQFY2W.js +365 -0
- package/dist/chunk-LIVAK2DM.js +2001 -0
- package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
- package/dist/{chunk-CWSDZEZG.cjs → chunk-MHKNLNAN.cjs} +15 -12
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/chunk-MMO2HDM6.cjs +378 -0
- package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
- package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
- package/dist/{chunk-DVPP5S6I.js → chunk-OR3CIE2H.js} +9 -6
- package/dist/chunk-P6SCPDYW.js +500 -0
- package/dist/{chunk-YNSGUC2O.js → chunk-TJKLBTFB.js} +23 -7
- package/dist/chunk-VPNDC2DI.cjs +148 -0
- package/dist/{chunk-ILW7XYNJ.js → chunk-W7VCKPAD.js} +84 -60
- package/dist/{chunk-2JQC6JWP.js → chunk-WFBJJNCK.js} +10 -6
- package/dist/chunk-WUC6LSTW.js +227 -0
- package/dist/{chunk-2FJURXCL.cjs → chunk-Y7UWRW5X.cjs} +43 -35
- package/dist/{chunk-A7DF4ETD.cjs → chunk-YBVOQN4M.cjs} +22 -28
- package/dist/chunk-YIOVBYZH.cjs +332 -0
- package/dist/chunk-YWLUOY3D.cjs +2004 -0
- package/dist/{chunk-4C3EPMMF.cjs → chunk-ZE5AAC4I.cjs} +40 -24
- package/dist/server/handlers/a2a.cjs +30 -0
- package/dist/server/handlers/a2a.d.cts +6 -0
- package/dist/server/handlers/a2a.d.ts +6 -0
- package/dist/server/handlers/a2a.js +1 -0
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/error.cjs +2 -2
- package/dist/server/handlers/error.js +1 -1
- package/dist/server/handlers/legacyWorkflows.cjs +46 -0
- package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
- package/dist/server/handlers/legacyWorkflows.js +1 -0
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +9 -9
- package/dist/server/handlers/memory.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/utils.cjs +2 -2
- package/dist/server/handlers/utils.js +1 -1
- package/dist/server/handlers/vector.cjs +7 -7
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +4 -4
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +17 -13
- package/dist/server/handlers/workflows.d.cts +3 -2
- package/dist/server/handlers/workflows.d.ts +3 -2
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +33 -23
- package/dist/server/handlers.d.cts +2 -0
- package/dist/server/handlers.d.ts +2 -0
- package/dist/server/handlers.js +11 -9
- package/package.json +9 -7
- package/dist/chunk-5JOF627H.cjs +0 -123
- package/dist/chunk-BMA2ORRT.js +0 -152
- package/dist/chunk-GV52BII2.cjs +0 -160
- package/dist/chunk-QH6XWSXP.cjs +0 -5579
- package/dist/chunk-VK6FX47H.js +0 -5576
- package/dist/chunk-X37I6GZT.cjs +0 -308
|
@@ -1,27 +1,61 @@
|
|
|
1
1
|
import type { Agent } from '@mastra/core/agent';
|
|
2
|
+
import type { AgentCard } from '@mastra/core/a2a';
|
|
2
3
|
import type { AgentNetwork } from '@mastra/core/network';
|
|
3
|
-
import {
|
|
4
|
+
import type { Artifact } from '@mastra/core/a2a';
|
|
5
|
+
import type { BaseLogMessage } from '@mastra/core/logger';
|
|
4
6
|
import { CoreMessage } from 'ai';
|
|
5
|
-
import {
|
|
7
|
+
import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
|
|
8
|
+
import { EvalRow } from '@mastra/core/storage';
|
|
6
9
|
import { GenerateObjectResult } from 'ai';
|
|
7
10
|
import { GenerateTextResult } from 'ai';
|
|
11
|
+
import type { IMastraLogger } from '@mastra/core/logger';
|
|
12
|
+
import type { JSONRPCError } from '@mastra/core/a2a';
|
|
13
|
+
import { JSONRPCResponse } from '@mastra/core/a2a';
|
|
14
|
+
import { LegacyStep } from '@mastra/core/workflows/legacy';
|
|
15
|
+
import type { LegacyWorkflow } from '@mastra/core/workflows/legacy';
|
|
16
|
+
import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
|
|
17
|
+
import type { LegacyWorkflowRuns } from '@mastra/core/storage';
|
|
8
18
|
import type { Mastra } from '@mastra/core/mastra';
|
|
9
|
-
import type { Mastra as Mastra_2 } from '@mastra/core';
|
|
10
19
|
import type { MastraMemory } from '@mastra/core/memory';
|
|
11
20
|
import { Message } from 'ai';
|
|
12
|
-
import {
|
|
21
|
+
import type { Message as Message_2 } from '@mastra/core/a2a';
|
|
22
|
+
import { MessageType } from '@mastra/core/memory';
|
|
13
23
|
import type { QueryResult } from '@mastra/core/vector';
|
|
14
24
|
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
25
|
+
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
26
|
+
import { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
|
|
27
|
+
import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
|
|
28
|
+
import { Step } from '@mastra/core/workflows';
|
|
29
|
+
import { StepExecutionContext } from '@mastra/core/workflows/legacy';
|
|
30
|
+
import { StepGraph } from '@mastra/core/workflows/legacy';
|
|
31
|
+
import { StorageThreadType } from '@mastra/core/memory';
|
|
32
|
+
import { Task } from '@mastra/core/a2a';
|
|
33
|
+
import { TaskAndHistory } from '@mastra/core/a2a';
|
|
34
|
+
import type { TaskContext } from '@mastra/core/a2a';
|
|
35
|
+
import type { TaskIdParams } from '@mastra/core/a2a';
|
|
36
|
+
import type { TaskQueryParams } from '@mastra/core/a2a';
|
|
37
|
+
import type { TaskSendParams } from '@mastra/core/a2a';
|
|
38
|
+
import type { TaskStatus } from '@mastra/core/a2a';
|
|
19
39
|
import type { ToolAction } from '@mastra/core/tools';
|
|
20
40
|
import type { VercelTool } from '@mastra/core/tools';
|
|
41
|
+
import { WatchEvent } from '@mastra/core/workflows';
|
|
21
42
|
import type { Workflow } from '@mastra/core/workflows';
|
|
22
|
-
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core';
|
|
23
|
-
import {
|
|
24
|
-
import { WorkflowRuns } from '@mastra/core';
|
|
43
|
+
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
|
|
44
|
+
import { WorkflowResult } from '@mastra/core/workflows';
|
|
45
|
+
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
46
|
+
import { ZodType } from 'zod';
|
|
47
|
+
import { ZodTypeDef } from 'zod';
|
|
48
|
+
|
|
49
|
+
export declare namespace a2a {
|
|
50
|
+
export {
|
|
51
|
+
getAgentCardByIdHandler,
|
|
52
|
+
handleTaskSend,
|
|
53
|
+
handleTaskGet,
|
|
54
|
+
handleTaskSendSubscribe,
|
|
55
|
+
handleTaskCancel,
|
|
56
|
+
getAgentExecutionHandler
|
|
57
|
+
}
|
|
58
|
+
}
|
|
25
59
|
|
|
26
60
|
export declare namespace agents {
|
|
27
61
|
export {
|
|
@@ -39,12 +73,18 @@ export declare interface ApiError extends Error {
|
|
|
39
73
|
status?: number;
|
|
40
74
|
}
|
|
41
75
|
|
|
76
|
+
export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
|
|
77
|
+
|
|
42
78
|
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;
|
|
43
79
|
|
|
44
80
|
export declare interface Context {
|
|
45
81
|
mastra: Mastra;
|
|
46
82
|
}
|
|
47
83
|
|
|
84
|
+
export declare function convertToCoreMessage(message: Message_2): CoreMessage_2;
|
|
85
|
+
|
|
86
|
+
export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
|
|
87
|
+
|
|
48
88
|
export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
|
|
49
89
|
index: CreateIndexRequest;
|
|
50
90
|
}): Promise<{
|
|
@@ -57,16 +97,29 @@ declare interface CreateIndexRequest {
|
|
|
57
97
|
metric?: 'cosine' | 'euclidean' | 'dotproduct';
|
|
58
98
|
}
|
|
59
99
|
|
|
60
|
-
export declare function
|
|
100
|
+
export declare function createLegacyWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
61
101
|
runId: string;
|
|
62
102
|
}>;
|
|
63
103
|
|
|
104
|
+
export declare function createSuccessResponse<T>(id: number | string | null, result: T): JSONRPCResponse<T>;
|
|
105
|
+
|
|
106
|
+
export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
|
|
107
|
+
task: Task;
|
|
108
|
+
userMessage: Message_2;
|
|
109
|
+
history: Message_2[];
|
|
110
|
+
activeCancellations: Set<string>;
|
|
111
|
+
}): TaskContext;
|
|
112
|
+
|
|
64
113
|
export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
|
|
65
114
|
body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
|
|
66
115
|
resourceId?: string;
|
|
67
116
|
};
|
|
68
117
|
}): Promise<StorageThreadType>;
|
|
69
118
|
|
|
119
|
+
export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
120
|
+
runId: string;
|
|
121
|
+
}>;
|
|
122
|
+
|
|
70
123
|
export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
|
|
71
124
|
indexName?: string;
|
|
72
125
|
}): Promise<{
|
|
@@ -87,23 +140,30 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
|
|
|
87
140
|
metric: string | undefined;
|
|
88
141
|
}>;
|
|
89
142
|
|
|
90
|
-
export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
|
|
143
|
+
export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
|
|
91
144
|
agentId?: string;
|
|
92
145
|
data: any;
|
|
146
|
+
runtimeContext: RuntimeContext_2;
|
|
147
|
+
runtimeContextFromRequest: Record<string, unknown>;
|
|
93
148
|
}): Promise<any>;
|
|
94
149
|
|
|
95
|
-
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
|
|
150
|
+
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
|
|
96
151
|
data?: unknown;
|
|
152
|
+
runtimeContext: RuntimeContext_2;
|
|
153
|
+
runtimeContextFromRequest: Record<string, unknown>;
|
|
97
154
|
}) => Promise<any>;
|
|
98
155
|
|
|
99
|
-
export declare function generateHandler({ mastra, agentId, body, }: Context & {
|
|
156
|
+
export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
157
|
+
runtimeContext: RuntimeContext;
|
|
100
158
|
agentId: string;
|
|
101
159
|
body: GetBody<'generate'> & {
|
|
102
160
|
resourceid?: string;
|
|
161
|
+
runtimeContext?: Record<string, unknown>;
|
|
103
162
|
};
|
|
104
163
|
}): Promise<GenerateTextResult<any, any>>;
|
|
105
164
|
|
|
106
|
-
export declare function generateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
|
|
165
|
+
export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
|
|
166
|
+
runtimeContext: RuntimeContext;
|
|
107
167
|
body: {
|
|
108
168
|
messages?: Parameters<AgentNetwork['generate']>[0];
|
|
109
169
|
} & Parameters<AgentNetwork['generate']>[1];
|
|
@@ -117,21 +177,44 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
|
|
|
117
177
|
text?: string;
|
|
118
178
|
speakerId?: string;
|
|
119
179
|
};
|
|
120
|
-
}): Promise<
|
|
121
|
-
audioData: Buffer<ArrayBuffer>;
|
|
122
|
-
}>;
|
|
180
|
+
}): Promise<NodeJS.ReadableStream>;
|
|
123
181
|
|
|
124
|
-
export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
|
|
182
|
+
export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
183
|
+
runtimeContext: RuntimeContext;
|
|
125
184
|
agentId: string;
|
|
126
185
|
}): Promise<{
|
|
127
186
|
name: any;
|
|
128
187
|
instructions: string;
|
|
129
188
|
tools: any;
|
|
189
|
+
workflows: {};
|
|
130
190
|
provider: string;
|
|
131
191
|
modelId: string;
|
|
132
192
|
}>;
|
|
133
193
|
|
|
134
|
-
export declare function
|
|
194
|
+
export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
|
|
195
|
+
runtimeContext: RuntimeContext;
|
|
196
|
+
agentId: keyof ReturnType<typeof mastra.getAgents>;
|
|
197
|
+
executionUrl?: string;
|
|
198
|
+
version?: string;
|
|
199
|
+
provider?: {
|
|
200
|
+
organization: string;
|
|
201
|
+
url: string;
|
|
202
|
+
};
|
|
203
|
+
}): Promise<AgentCard>;
|
|
204
|
+
|
|
205
|
+
export declare function getAgentExecutionHandler({ requestId, mastra, agentId, runtimeContext, method, params, taskStore, logger, }: Context & {
|
|
206
|
+
requestId: string;
|
|
207
|
+
runtimeContext: RuntimeContext;
|
|
208
|
+
agentId: string;
|
|
209
|
+
method: 'tasks/send' | 'tasks/sendSubscribe' | 'tasks/get' | 'tasks/cancel';
|
|
210
|
+
params: TaskSendParams | TaskQueryParams | TaskIdParams;
|
|
211
|
+
taskStore?: InMemoryTaskStore;
|
|
212
|
+
logger?: IMastraLogger;
|
|
213
|
+
}): Promise<any>;
|
|
214
|
+
|
|
215
|
+
export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
|
|
216
|
+
runtimeContext: RuntimeContext;
|
|
217
|
+
}): Promise<any>;
|
|
135
218
|
|
|
136
219
|
declare type GetBody<T extends keyof Agent & {
|
|
137
220
|
[K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
|
|
@@ -139,7 +222,8 @@ declare type GetBody<T extends keyof Agent & {
|
|
|
139
222
|
messages: Parameters<Agent[T]>[0];
|
|
140
223
|
} & Parameters<Agent[T]>[1];
|
|
141
224
|
|
|
142
|
-
export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
|
|
225
|
+
export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
226
|
+
runtimeContext: RuntimeContext;
|
|
143
227
|
agentId: string;
|
|
144
228
|
}): Promise<{
|
|
145
229
|
id: string;
|
|
@@ -148,7 +232,30 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
|
|
|
148
232
|
evals: EvalRow[];
|
|
149
233
|
}>;
|
|
150
234
|
|
|
151
|
-
export declare function
|
|
235
|
+
export declare function getLegacyWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
|
|
236
|
+
stepGraph: StepGraph;
|
|
237
|
+
stepSubscriberGraph: Record<string, StepGraph>;
|
|
238
|
+
serializedStepGraph: StepGraph;
|
|
239
|
+
serializedStepSubscriberGraph: Record<string, StepGraph>;
|
|
240
|
+
name: string;
|
|
241
|
+
triggerSchema: string | undefined;
|
|
242
|
+
steps: any;
|
|
243
|
+
}>;
|
|
244
|
+
|
|
245
|
+
export declare function getLegacyWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<LegacyWorkflow['getRun']>>;
|
|
246
|
+
|
|
247
|
+
export declare function getLegacyWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
|
|
248
|
+
fromDate?: Date;
|
|
249
|
+
toDate?: Date;
|
|
250
|
+
limit?: number;
|
|
251
|
+
offset?: number;
|
|
252
|
+
resourceId?: string;
|
|
253
|
+
}): Promise<LegacyWorkflowRuns>;
|
|
254
|
+
|
|
255
|
+
export declare function getLegacyWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
|
|
256
|
+
|
|
257
|
+
export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
258
|
+
runtimeContext: RuntimeContext;
|
|
152
259
|
agentId: string;
|
|
153
260
|
}): Promise<{
|
|
154
261
|
id: string;
|
|
@@ -157,9 +264,9 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Contex
|
|
|
157
264
|
evals: EvalRow[];
|
|
158
265
|
}>;
|
|
159
266
|
|
|
160
|
-
export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<
|
|
267
|
+
export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<any[]>;
|
|
161
268
|
|
|
162
|
-
export declare function getLogsHandler({ mastra, transportId }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
|
|
269
|
+
export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
|
|
163
270
|
|
|
164
271
|
export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
|
|
165
272
|
transports: string[];
|
|
@@ -169,12 +276,14 @@ export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryC
|
|
|
169
276
|
result: boolean;
|
|
170
277
|
}>;
|
|
171
278
|
|
|
172
|
-
export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>
|
|
279
|
+
export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
|
|
280
|
+
limit?: number;
|
|
281
|
+
}): Promise<{
|
|
173
282
|
messages: CoreMessage[];
|
|
174
283
|
uiMessages: Message[];
|
|
175
284
|
}>;
|
|
176
285
|
|
|
177
|
-
export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
|
|
286
|
+
export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
178
287
|
id: string;
|
|
179
288
|
name: string;
|
|
180
289
|
instructions: string;
|
|
@@ -189,7 +298,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
|
|
|
189
298
|
};
|
|
190
299
|
}>;
|
|
191
300
|
|
|
192
|
-
export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
|
|
301
|
+
export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
|
|
193
302
|
id: string;
|
|
194
303
|
name: string;
|
|
195
304
|
instructions: string;
|
|
@@ -221,24 +330,71 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
|
|
|
221
330
|
|
|
222
331
|
export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
|
|
223
332
|
|
|
224
|
-
export declare function getWorkflowByIdHandler({ mastra, workflowId }:
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
steps: any;
|
|
333
|
+
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
|
|
334
|
+
steps: SerializedStep[];
|
|
335
|
+
name: string | undefined;
|
|
336
|
+
description: string | undefined;
|
|
337
|
+
stepGraph: SerializedStepFlowEntry[];
|
|
338
|
+
inputSchema: string | undefined;
|
|
339
|
+
outputSchema: string | undefined;
|
|
232
340
|
}>;
|
|
233
341
|
|
|
234
|
-
export declare function
|
|
342
|
+
export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
|
|
235
343
|
|
|
236
|
-
export declare function getWorkflowRunsHandler({ mastra, workflowId }:
|
|
344
|
+
export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
|
|
345
|
+
fromDate?: Date;
|
|
346
|
+
toDate?: Date;
|
|
347
|
+
limit?: number;
|
|
348
|
+
offset?: number;
|
|
349
|
+
resourceId?: string;
|
|
350
|
+
}): Promise<WorkflowRuns>;
|
|
237
351
|
|
|
238
|
-
export declare function getWorkflowsHandler({ mastra }:
|
|
352
|
+
export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
|
|
239
353
|
|
|
240
354
|
export declare function handleError(error: unknown, defaultMessage: string): never;
|
|
241
355
|
|
|
356
|
+
export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
|
|
357
|
+
requestId: string;
|
|
358
|
+
taskStore: InMemoryTaskStore;
|
|
359
|
+
agentId: string;
|
|
360
|
+
taskId: string;
|
|
361
|
+
logger?: IMastraLogger;
|
|
362
|
+
}): Promise<JSONRPCResponse<Task, unknown>>;
|
|
363
|
+
|
|
364
|
+
export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
|
|
365
|
+
requestId: string;
|
|
366
|
+
taskStore: InMemoryTaskStore;
|
|
367
|
+
agentId: string;
|
|
368
|
+
taskId: string;
|
|
369
|
+
}): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
|
|
370
|
+
|
|
371
|
+
export declare function handleTaskSend({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
|
|
372
|
+
requestId: string;
|
|
373
|
+
params: TaskSendParams;
|
|
374
|
+
taskStore: InMemoryTaskStore;
|
|
375
|
+
agent: Agent;
|
|
376
|
+
logger?: IMastraLogger;
|
|
377
|
+
runtimeContext: RuntimeContext;
|
|
378
|
+
}): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
|
|
379
|
+
|
|
380
|
+
export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
|
|
381
|
+
requestId: string;
|
|
382
|
+
params: TaskSendParams;
|
|
383
|
+
taskStore: InMemoryTaskStore;
|
|
384
|
+
agent: Agent;
|
|
385
|
+
logger?: IMastraLogger;
|
|
386
|
+
runtimeContext: RuntimeContext;
|
|
387
|
+
}): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
|
|
388
|
+
state: string;
|
|
389
|
+
message: {
|
|
390
|
+
role: string;
|
|
391
|
+
parts: {
|
|
392
|
+
type: string;
|
|
393
|
+
text: string;
|
|
394
|
+
}[];
|
|
395
|
+
};
|
|
396
|
+
}, unknown>, void, unknown>;
|
|
397
|
+
|
|
242
398
|
/**
|
|
243
399
|
* `HTTPException` must be used when a fatal error such as authentication failure occurs.
|
|
244
400
|
*
|
|
@@ -300,8 +456,46 @@ declare type HTTPExceptionOptions = {
|
|
|
300
456
|
*/
|
|
301
457
|
declare type InfoStatusCode = 100 | 101 | 102 | 103;
|
|
302
458
|
|
|
459
|
+
export declare class InMemoryTaskStore {
|
|
460
|
+
private store;
|
|
461
|
+
activeCancellations: Set<string>;
|
|
462
|
+
load({ agentId, taskId }: {
|
|
463
|
+
agentId: string;
|
|
464
|
+
taskId: string;
|
|
465
|
+
}): Promise<TaskAndHistory | null>;
|
|
466
|
+
save({ agentId, data }: {
|
|
467
|
+
agentId: string;
|
|
468
|
+
data: TaskAndHistory;
|
|
469
|
+
}): Promise<void>;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export declare namespace legacyWorkflows {
|
|
473
|
+
export {
|
|
474
|
+
getLegacyWorkflowsHandler,
|
|
475
|
+
getLegacyWorkflowByIdHandler,
|
|
476
|
+
startAsyncLegacyWorkflowHandler,
|
|
477
|
+
getLegacyWorkflowRunHandler,
|
|
478
|
+
createLegacyWorkflowRunHandler,
|
|
479
|
+
startLegacyWorkflowRunHandler,
|
|
480
|
+
watchLegacyWorkflowHandler,
|
|
481
|
+
resumeAsyncLegacyWorkflowHandler,
|
|
482
|
+
resumeLegacyWorkflowHandler,
|
|
483
|
+
getLegacyWorkflowRunsHandler
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
303
487
|
export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
|
|
304
488
|
|
|
489
|
+
export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
|
|
490
|
+
agentId: string;
|
|
491
|
+
taskId: string;
|
|
492
|
+
taskStore: InMemoryTaskStore;
|
|
493
|
+
message: Message_2;
|
|
494
|
+
sessionId?: string | null;
|
|
495
|
+
metadata?: Record<string, unknown> | null;
|
|
496
|
+
logger?: IMastraLogger;
|
|
497
|
+
}): Promise<TaskAndHistory>;
|
|
498
|
+
|
|
305
499
|
export declare namespace logs {
|
|
306
500
|
export {
|
|
307
501
|
getLogsHandler,
|
|
@@ -346,8 +540,11 @@ export declare namespace network {
|
|
|
346
540
|
|
|
347
541
|
declare interface NetworkContext extends Context {
|
|
348
542
|
networkId?: string;
|
|
543
|
+
runtimeContext: RuntimeContext;
|
|
349
544
|
}
|
|
350
545
|
|
|
546
|
+
export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
|
|
547
|
+
|
|
351
548
|
declare interface QueryRequest {
|
|
352
549
|
indexName: string;
|
|
353
550
|
queryVector: number[];
|
|
@@ -362,18 +559,39 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
|
|
|
362
559
|
|
|
363
560
|
declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
|
|
364
561
|
|
|
365
|
-
export declare function
|
|
562
|
+
export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
366
563
|
body: {
|
|
367
564
|
stepId: string;
|
|
368
565
|
context: any;
|
|
369
566
|
};
|
|
370
|
-
|
|
567
|
+
runtimeContext: RuntimeContext;
|
|
568
|
+
}): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
|
|
371
569
|
|
|
372
|
-
export declare function
|
|
570
|
+
export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, runtimeContextFromRequest, }: WorkflowContext_3 & {
|
|
571
|
+
body: {
|
|
572
|
+
step: string | string[];
|
|
573
|
+
resumeData?: unknown;
|
|
574
|
+
};
|
|
575
|
+
runtimeContext?: RuntimeContext_2;
|
|
576
|
+
runtimeContextFromRequest?: Record<string, unknown>;
|
|
577
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
|
|
578
|
+
|
|
579
|
+
export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
373
580
|
body: {
|
|
374
581
|
stepId: string;
|
|
375
582
|
context: any;
|
|
376
583
|
};
|
|
584
|
+
runtimeContext: RuntimeContext;
|
|
585
|
+
}): Promise<{
|
|
586
|
+
message: string;
|
|
587
|
+
}>;
|
|
588
|
+
|
|
589
|
+
export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
|
|
590
|
+
body: {
|
|
591
|
+
step: string | string[];
|
|
592
|
+
resumeData?: unknown;
|
|
593
|
+
};
|
|
594
|
+
runtimeContext?: RuntimeContext_2;
|
|
377
595
|
}): Promise<{
|
|
378
596
|
message: string;
|
|
379
597
|
}>;
|
|
@@ -384,14 +602,39 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
|
|
|
384
602
|
};
|
|
385
603
|
}): Promise<MessageType[]>;
|
|
386
604
|
|
|
605
|
+
declare type SerializedStep = {
|
|
606
|
+
id: string;
|
|
607
|
+
description: string;
|
|
608
|
+
inputSchema: string | undefined;
|
|
609
|
+
outputSchema: string | undefined;
|
|
610
|
+
resumeSchema: string | undefined;
|
|
611
|
+
suspendSchema: string | undefined;
|
|
612
|
+
};
|
|
613
|
+
|
|
387
614
|
declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
388
615
|
|
|
389
|
-
export declare function
|
|
616
|
+
export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
390
617
|
triggerData?: unknown;
|
|
391
|
-
|
|
618
|
+
runtimeContext: RuntimeContext;
|
|
619
|
+
}): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
|
|
392
620
|
|
|
393
|
-
export declare function
|
|
621
|
+
export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
622
|
+
inputData?: unknown;
|
|
623
|
+
runtimeContext?: RuntimeContext_2;
|
|
624
|
+
runtimeContextFromRequest?: Record<string, unknown>;
|
|
625
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
|
|
626
|
+
|
|
627
|
+
export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
394
628
|
triggerData?: unknown;
|
|
629
|
+
runtimeContext: RuntimeContext;
|
|
630
|
+
}): Promise<{
|
|
631
|
+
message: string;
|
|
632
|
+
}>;
|
|
633
|
+
|
|
634
|
+
export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
635
|
+
inputData?: unknown;
|
|
636
|
+
runtimeContext?: RuntimeContext_2;
|
|
637
|
+
runtimeContextFromRequest?: Record<string, unknown>;
|
|
395
638
|
}): Promise<{
|
|
396
639
|
message: string;
|
|
397
640
|
}>;
|
|
@@ -415,19 +658,31 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
|
|
|
415
658
|
traceCount: number;
|
|
416
659
|
}>;
|
|
417
660
|
|
|
418
|
-
export declare function streamGenerateHandler({ mastra, agentId, body, }: Context & {
|
|
661
|
+
export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
662
|
+
runtimeContext: RuntimeContext;
|
|
419
663
|
agentId: string;
|
|
420
664
|
body: GetBody<'stream'> & {
|
|
421
665
|
resourceid?: string;
|
|
666
|
+
runtimeContext?: string;
|
|
422
667
|
};
|
|
423
668
|
}): Promise<Response | undefined>;
|
|
424
669
|
|
|
425
|
-
export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
|
|
670
|
+
export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
|
|
671
|
+
runtimeContext: RuntimeContext;
|
|
426
672
|
body: {
|
|
427
673
|
messages?: Parameters<AgentNetwork['stream']>[0];
|
|
428
674
|
} & Parameters<AgentNetwork['stream']>[1];
|
|
429
675
|
}): Promise<Response>;
|
|
430
676
|
|
|
677
|
+
export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
678
|
+
inputData?: unknown;
|
|
679
|
+
runtimeContext?: RuntimeContext_2;
|
|
680
|
+
runtimeContextFromRequest?: Record<string, unknown>;
|
|
681
|
+
}): {
|
|
682
|
+
stream: globalThis.ReadableStream<WatchEvent>;
|
|
683
|
+
getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
|
|
684
|
+
};
|
|
685
|
+
|
|
431
686
|
declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
|
|
432
687
|
|
|
433
688
|
export declare namespace telemetry {
|
|
@@ -444,6 +699,8 @@ declare interface TelemetryContext extends Context {
|
|
|
444
699
|
page?: number;
|
|
445
700
|
perPage?: number;
|
|
446
701
|
attribute?: string | string[];
|
|
702
|
+
fromDate?: Date;
|
|
703
|
+
toDate?: Date;
|
|
447
704
|
};
|
|
448
705
|
}
|
|
449
706
|
|
|
@@ -538,10 +795,16 @@ declare interface VoiceContext extends Context {
|
|
|
538
795
|
agentId?: string;
|
|
539
796
|
}
|
|
540
797
|
|
|
541
|
-
export declare function
|
|
798
|
+
export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
799
|
+
|
|
800
|
+
export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
801
|
+
|
|
802
|
+
declare interface WorkflowContext extends Context {
|
|
803
|
+
workflowId?: string;
|
|
804
|
+
runId?: string;
|
|
805
|
+
}
|
|
542
806
|
|
|
543
|
-
declare interface
|
|
544
|
-
mastra: Mastra_2;
|
|
807
|
+
declare interface WorkflowContext_3 extends Context {
|
|
545
808
|
workflowId?: string;
|
|
546
809
|
runId?: string;
|
|
547
810
|
}
|
|
@@ -550,11 +813,12 @@ export declare namespace workflows {
|
|
|
550
813
|
export {
|
|
551
814
|
getWorkflowsHandler,
|
|
552
815
|
getWorkflowByIdHandler,
|
|
816
|
+
getWorkflowRunByIdHandler,
|
|
817
|
+
createWorkflowRunHandler,
|
|
553
818
|
startAsyncWorkflowHandler,
|
|
554
|
-
getWorkflowRunHandler,
|
|
555
|
-
createRunHandler,
|
|
556
819
|
startWorkflowRunHandler,
|
|
557
820
|
watchWorkflowHandler,
|
|
821
|
+
streamWorkflowHandler,
|
|
558
822
|
resumeAsyncWorkflowHandler,
|
|
559
823
|
resumeWorkflowHandler,
|
|
560
824
|
getWorkflowRunsHandler
|