@mastra/server 0.0.0-bundle-dynamic-imports-20250424001248 → 0.0.0-cloud-transporter-20250513033346
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/README.md +48 -135
- package/dist/_tsup-dts-rollup.d.cts +257 -13
- package/dist/_tsup-dts-rollup.d.ts +257 -13
- package/dist/{chunk-M56ECCHK.cjs → chunk-4YZ3U35L.cjs} +18 -17
- 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-RE6YL32K.js → chunk-C7564HUT.js} +52 -30
- package/dist/chunk-D4IRYCUI.cjs +235 -0
- package/dist/{chunk-RBQASTUP.js → chunk-DJJIUEL2.js} +13 -5
- package/dist/{chunk-LFOBHRFO.js → chunk-EJO45KYT.js} +35 -20
- package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
- package/dist/{chunk-Q6SHQECN.js → chunk-HFWCEP5S.js} +4 -3
- package/dist/{chunk-3EJZQ6TQ.js → chunk-HWZVAG3H.js} +3 -3
- package/dist/{chunk-TZK63M5N.cjs → chunk-I2B73Y4I.cjs} +76 -61
- package/dist/{chunk-4JINXASC.js → chunk-IU5VO2I2.js} +3 -2
- package/dist/chunk-LIVAK2DM.js +2001 -0
- package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
- package/dist/{chunk-7IWQE76Z.cjs → chunk-MHKNLNAN.cjs} +13 -10
- package/dist/chunk-MIQYDLLM.js +329 -0
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
- package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
- package/dist/{chunk-SKBVVI24.cjs → chunk-OGCNNUHF.cjs} +9 -9
- package/dist/{chunk-WTHDCRMY.js → chunk-OR3CIE2H.js} +7 -4
- package/dist/chunk-P6SCPDYW.js +500 -0
- package/dist/{chunk-5JNVY6DU.js → chunk-TJKLBTFB.js} +20 -8
- package/dist/chunk-UCTEMO2Q.cjs +341 -0
- package/dist/{chunk-FPIWDH5Y.cjs → chunk-VPNDC2DI.cjs} +62 -40
- package/dist/chunk-WUC6LSTW.js +227 -0
- package/dist/{chunk-2FJURXCL.cjs → chunk-Y7UWRW5X.cjs} +43 -35
- package/dist/{chunk-55HTWX4C.cjs → chunk-YBVOQN4M.cjs} +20 -19
- package/dist/chunk-YWLUOY3D.cjs +2004 -0
- package/dist/{chunk-D3G23FP3.cjs → chunk-ZE5AAC4I.cjs} +37 -25
- 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/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/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/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 +11 -11
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +31 -21
- 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 +8 -6
- package/dist/chunk-5SWCVTNL.cjs +0 -5579
- package/dist/chunk-HCOPJZ4A.cjs +0 -164
- package/dist/chunk-OMN3UI6X.js +0 -5576
- package/dist/chunk-R4J7XQYU.js +0 -156
|
@@ -1,27 +1,59 @@
|
|
|
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';
|
|
4
|
+
import type { Artifact } from '@mastra/core/a2a';
|
|
3
5
|
import type { BaseLogMessage } from '@mastra/core/logger';
|
|
4
6
|
import { CoreMessage } from 'ai';
|
|
7
|
+
import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
|
|
5
8
|
import { EvalRow } from '@mastra/core/storage';
|
|
6
9
|
import { GenerateObjectResult } from 'ai';
|
|
7
10
|
import { GenerateTextResult } from 'ai';
|
|
11
|
+
import type { JSONRPCError } from '@mastra/core/a2a';
|
|
12
|
+
import { JSONRPCResponse } from '@mastra/core/a2a';
|
|
13
|
+
import type { Logger } from '@mastra/core/logger';
|
|
8
14
|
import type { Mastra } from '@mastra/core/mastra';
|
|
9
15
|
import type { MastraMemory } from '@mastra/core/memory';
|
|
10
16
|
import { Message } from 'ai';
|
|
17
|
+
import type { Message as Message_2 } from '@mastra/core/a2a';
|
|
11
18
|
import { MessageType } from '@mastra/core/memory';
|
|
19
|
+
import { NewStep } from '@mastra/core/workflows/vNext';
|
|
20
|
+
import type { NewWorkflow } from '@mastra/core/workflows/vNext';
|
|
12
21
|
import type { QueryResult } from '@mastra/core/vector';
|
|
13
22
|
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
14
|
-
import
|
|
23
|
+
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
24
|
+
import { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
|
|
25
|
+
import type { SerializedStepFlowEntry } from '@mastra/core/workflows/vNext';
|
|
15
26
|
import { Step } from '@mastra/core/workflows';
|
|
16
27
|
import { StepExecutionContext } from '@mastra/core/workflows';
|
|
17
28
|
import { StepGraph } from '@mastra/core/workflows';
|
|
18
29
|
import { StorageThreadType } from '@mastra/core/memory';
|
|
30
|
+
import { Task } from '@mastra/core/a2a';
|
|
31
|
+
import { TaskAndHistory } from '@mastra/core/a2a';
|
|
32
|
+
import type { TaskContext } from '@mastra/core/a2a';
|
|
33
|
+
import type { TaskIdParams } from '@mastra/core/a2a';
|
|
34
|
+
import type { TaskQueryParams } from '@mastra/core/a2a';
|
|
35
|
+
import type { TaskSendParams } from '@mastra/core/a2a';
|
|
36
|
+
import type { TaskStatus } from '@mastra/core/a2a';
|
|
19
37
|
import type { ToolAction } from '@mastra/core/tools';
|
|
20
38
|
import type { VercelTool } from '@mastra/core/tools';
|
|
21
39
|
import type { Workflow } from '@mastra/core/workflows';
|
|
22
40
|
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
|
|
41
|
+
import { WorkflowResult } from '@mastra/core/workflows/vNext';
|
|
23
42
|
import { WorkflowRunResult } from '@mastra/core/workflows';
|
|
24
43
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
44
|
+
import { ZodType } from 'zod';
|
|
45
|
+
import { ZodTypeDef } from 'zod';
|
|
46
|
+
|
|
47
|
+
export declare namespace a2a {
|
|
48
|
+
export {
|
|
49
|
+
getAgentCardByIdHandler,
|
|
50
|
+
handleTaskSend,
|
|
51
|
+
handleTaskGet,
|
|
52
|
+
handleTaskSendSubscribe,
|
|
53
|
+
handleTaskCancel,
|
|
54
|
+
getAgentExecutionHandler
|
|
55
|
+
}
|
|
56
|
+
}
|
|
25
57
|
|
|
26
58
|
export declare namespace agents {
|
|
27
59
|
export {
|
|
@@ -39,12 +71,18 @@ export declare interface ApiError extends Error {
|
|
|
39
71
|
status?: number;
|
|
40
72
|
}
|
|
41
73
|
|
|
74
|
+
export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
|
|
75
|
+
|
|
42
76
|
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
77
|
|
|
44
78
|
export declare interface Context {
|
|
45
79
|
mastra: Mastra;
|
|
46
80
|
}
|
|
47
81
|
|
|
82
|
+
export declare function convertToCoreMessage(message: Message_2): CoreMessage_2;
|
|
83
|
+
|
|
84
|
+
export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
|
|
85
|
+
|
|
48
86
|
export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
|
|
49
87
|
index: CreateIndexRequest;
|
|
50
88
|
}): Promise<{
|
|
@@ -61,12 +99,25 @@ export declare function createRunHandler({ mastra, workflowId, runId: prevRunId,
|
|
|
61
99
|
runId: string;
|
|
62
100
|
}>;
|
|
63
101
|
|
|
102
|
+
export declare function createSuccessResponse<T>(id: number | string | null, result: T): JSONRPCResponse<T>;
|
|
103
|
+
|
|
104
|
+
export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
|
|
105
|
+
task: Task;
|
|
106
|
+
userMessage: Message_2;
|
|
107
|
+
history: Message_2[];
|
|
108
|
+
activeCancellations: Set<string>;
|
|
109
|
+
}): TaskContext;
|
|
110
|
+
|
|
64
111
|
export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
|
|
65
112
|
body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
|
|
66
113
|
resourceId?: string;
|
|
67
114
|
};
|
|
68
115
|
}): Promise<StorageThreadType>;
|
|
69
116
|
|
|
117
|
+
export declare function createVNextWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
118
|
+
runId: string;
|
|
119
|
+
}>;
|
|
120
|
+
|
|
70
121
|
export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
|
|
71
122
|
indexName?: string;
|
|
72
123
|
}): Promise<{
|
|
@@ -87,15 +138,17 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
|
|
|
87
138
|
metric: string | undefined;
|
|
88
139
|
}>;
|
|
89
140
|
|
|
90
|
-
export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
|
|
141
|
+
export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
|
|
91
142
|
agentId?: string;
|
|
92
143
|
data: any;
|
|
93
|
-
runtimeContext:
|
|
144
|
+
runtimeContext: RuntimeContext_2;
|
|
145
|
+
runtimeContextFromRequest: Record<string, unknown>;
|
|
94
146
|
}): Promise<any>;
|
|
95
147
|
|
|
96
|
-
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
|
|
148
|
+
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
|
|
97
149
|
data?: unknown;
|
|
98
|
-
runtimeContext:
|
|
150
|
+
runtimeContext: RuntimeContext_2;
|
|
151
|
+
runtimeContextFromRequest: Record<string, unknown>;
|
|
99
152
|
}) => Promise<any>;
|
|
100
153
|
|
|
101
154
|
export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
@@ -103,6 +156,7 @@ export declare function generateHandler({ mastra, runtimeContext, agentId, body,
|
|
|
103
156
|
agentId: string;
|
|
104
157
|
body: GetBody<'generate'> & {
|
|
105
158
|
resourceid?: string;
|
|
159
|
+
runtimeContext?: Record<string, unknown>;
|
|
106
160
|
};
|
|
107
161
|
}): Promise<GenerateTextResult<any, any>>;
|
|
108
162
|
|
|
@@ -123,17 +177,42 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
|
|
|
123
177
|
};
|
|
124
178
|
}): Promise<NodeJS.ReadableStream>;
|
|
125
179
|
|
|
126
|
-
export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
|
|
180
|
+
export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
181
|
+
runtimeContext: RuntimeContext;
|
|
127
182
|
agentId: string;
|
|
128
183
|
}): Promise<{
|
|
129
184
|
name: any;
|
|
130
185
|
instructions: string;
|
|
131
186
|
tools: any;
|
|
187
|
+
workflows: {};
|
|
132
188
|
provider: string;
|
|
133
189
|
modelId: string;
|
|
134
190
|
}>;
|
|
135
191
|
|
|
136
|
-
export declare function
|
|
192
|
+
export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
|
|
193
|
+
runtimeContext: RuntimeContext;
|
|
194
|
+
agentId: keyof ReturnType<typeof mastra.getAgents>;
|
|
195
|
+
executionUrl?: string;
|
|
196
|
+
version?: string;
|
|
197
|
+
provider?: {
|
|
198
|
+
organization: string;
|
|
199
|
+
url: string;
|
|
200
|
+
};
|
|
201
|
+
}): Promise<AgentCard>;
|
|
202
|
+
|
|
203
|
+
export declare function getAgentExecutionHandler({ requestId, mastra, agentId, runtimeContext, method, params, taskStore, logger, }: Context & {
|
|
204
|
+
requestId: string;
|
|
205
|
+
runtimeContext: RuntimeContext;
|
|
206
|
+
agentId: string;
|
|
207
|
+
method: 'tasks/send' | 'tasks/sendSubscribe' | 'tasks/get' | 'tasks/cancel';
|
|
208
|
+
params: TaskSendParams | TaskQueryParams | TaskIdParams;
|
|
209
|
+
taskStore?: InMemoryTaskStore;
|
|
210
|
+
logger?: Logger;
|
|
211
|
+
}): Promise<any>;
|
|
212
|
+
|
|
213
|
+
export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
|
|
214
|
+
runtimeContext: RuntimeContext;
|
|
215
|
+
}): Promise<any>;
|
|
137
216
|
|
|
138
217
|
declare type GetBody<T extends keyof Agent & {
|
|
139
218
|
[K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
|
|
@@ -141,7 +220,8 @@ declare type GetBody<T extends keyof Agent & {
|
|
|
141
220
|
messages: Parameters<Agent[T]>[0];
|
|
142
221
|
} & Parameters<Agent[T]>[1];
|
|
143
222
|
|
|
144
|
-
export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
|
|
223
|
+
export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
224
|
+
runtimeContext: RuntimeContext;
|
|
145
225
|
agentId: string;
|
|
146
226
|
}): Promise<{
|
|
147
227
|
id: string;
|
|
@@ -150,7 +230,8 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
|
|
|
150
230
|
evals: EvalRow[];
|
|
151
231
|
}>;
|
|
152
232
|
|
|
153
|
-
export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
|
|
233
|
+
export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
234
|
+
runtimeContext: RuntimeContext;
|
|
154
235
|
agentId: string;
|
|
155
236
|
}): Promise<{
|
|
156
237
|
id: string;
|
|
@@ -171,12 +252,14 @@ export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryC
|
|
|
171
252
|
result: boolean;
|
|
172
253
|
}>;
|
|
173
254
|
|
|
174
|
-
export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>
|
|
255
|
+
export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
|
|
256
|
+
limit?: number;
|
|
257
|
+
}): Promise<{
|
|
175
258
|
messages: CoreMessage[];
|
|
176
259
|
uiMessages: Message[];
|
|
177
260
|
}>;
|
|
178
261
|
|
|
179
|
-
export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
|
|
262
|
+
export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
180
263
|
id: string;
|
|
181
264
|
name: string;
|
|
182
265
|
instructions: string;
|
|
@@ -191,7 +274,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
|
|
|
191
274
|
};
|
|
192
275
|
}>;
|
|
193
276
|
|
|
194
|
-
export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
|
|
277
|
+
export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
|
|
195
278
|
id: string;
|
|
196
279
|
name: string;
|
|
197
280
|
instructions: string;
|
|
@@ -223,6 +306,26 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
|
|
|
223
306
|
|
|
224
307
|
export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
|
|
225
308
|
|
|
309
|
+
export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
|
|
310
|
+
steps: SerializedStep[];
|
|
311
|
+
name: string | undefined;
|
|
312
|
+
stepGraph: SerializedStepFlowEntry[];
|
|
313
|
+
inputSchema: string | undefined;
|
|
314
|
+
outputSchema: string | undefined;
|
|
315
|
+
}>;
|
|
316
|
+
|
|
317
|
+
export declare function getVNextWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRunById']>>;
|
|
318
|
+
|
|
319
|
+
export declare function getVNextWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: VNextWorkflowContext & {
|
|
320
|
+
fromDate?: Date;
|
|
321
|
+
toDate?: Date;
|
|
322
|
+
limit?: number;
|
|
323
|
+
offset?: number;
|
|
324
|
+
resourceId?: string;
|
|
325
|
+
}): Promise<WorkflowRuns>;
|
|
326
|
+
|
|
327
|
+
export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): Promise<any>;
|
|
328
|
+
|
|
226
329
|
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
|
|
227
330
|
stepGraph: StepGraph;
|
|
228
331
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
@@ -235,12 +338,60 @@ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowC
|
|
|
235
338
|
|
|
236
339
|
export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
|
|
237
340
|
|
|
238
|
-
export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext
|
|
341
|
+
export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
|
|
342
|
+
fromDate?: Date;
|
|
343
|
+
toDate?: Date;
|
|
344
|
+
limit?: number;
|
|
345
|
+
offset?: number;
|
|
346
|
+
resourceId?: string;
|
|
347
|
+
}): Promise<WorkflowRuns>;
|
|
239
348
|
|
|
240
349
|
export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
|
|
241
350
|
|
|
242
351
|
export declare function handleError(error: unknown, defaultMessage: string): never;
|
|
243
352
|
|
|
353
|
+
export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
|
|
354
|
+
requestId: string;
|
|
355
|
+
taskStore: InMemoryTaskStore;
|
|
356
|
+
agentId: string;
|
|
357
|
+
taskId: string;
|
|
358
|
+
logger?: Logger;
|
|
359
|
+
}): Promise<JSONRPCResponse<Task, unknown>>;
|
|
360
|
+
|
|
361
|
+
export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
|
|
362
|
+
requestId: string;
|
|
363
|
+
taskStore: InMemoryTaskStore;
|
|
364
|
+
agentId: string;
|
|
365
|
+
taskId: string;
|
|
366
|
+
}): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
|
|
367
|
+
|
|
368
|
+
export declare function handleTaskSend({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
|
|
369
|
+
requestId: string;
|
|
370
|
+
params: TaskSendParams;
|
|
371
|
+
taskStore: InMemoryTaskStore;
|
|
372
|
+
agent: Agent;
|
|
373
|
+
logger?: Logger;
|
|
374
|
+
runtimeContext: RuntimeContext;
|
|
375
|
+
}): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
|
|
376
|
+
|
|
377
|
+
export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
|
|
378
|
+
requestId: string;
|
|
379
|
+
params: TaskSendParams;
|
|
380
|
+
taskStore: InMemoryTaskStore;
|
|
381
|
+
agent: Agent;
|
|
382
|
+
logger?: Logger;
|
|
383
|
+
runtimeContext: RuntimeContext;
|
|
384
|
+
}): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
|
|
385
|
+
state: string;
|
|
386
|
+
message: {
|
|
387
|
+
role: string;
|
|
388
|
+
parts: {
|
|
389
|
+
type: string;
|
|
390
|
+
text: string;
|
|
391
|
+
}[];
|
|
392
|
+
};
|
|
393
|
+
}, unknown>, void, unknown>;
|
|
394
|
+
|
|
244
395
|
/**
|
|
245
396
|
* `HTTPException` must be used when a fatal error such as authentication failure occurs.
|
|
246
397
|
*
|
|
@@ -302,8 +453,31 @@ declare type HTTPExceptionOptions = {
|
|
|
302
453
|
*/
|
|
303
454
|
declare type InfoStatusCode = 100 | 101 | 102 | 103;
|
|
304
455
|
|
|
456
|
+
export declare class InMemoryTaskStore {
|
|
457
|
+
private store;
|
|
458
|
+
activeCancellations: Set<string>;
|
|
459
|
+
load({ agentId, taskId }: {
|
|
460
|
+
agentId: string;
|
|
461
|
+
taskId: string;
|
|
462
|
+
}): Promise<TaskAndHistory | null>;
|
|
463
|
+
save({ agentId, data }: {
|
|
464
|
+
agentId: string;
|
|
465
|
+
data: TaskAndHistory;
|
|
466
|
+
}): Promise<void>;
|
|
467
|
+
}
|
|
468
|
+
|
|
305
469
|
export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
|
|
306
470
|
|
|
471
|
+
export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
|
|
472
|
+
agentId: string;
|
|
473
|
+
taskId: string;
|
|
474
|
+
taskStore: InMemoryTaskStore;
|
|
475
|
+
message: Message_2;
|
|
476
|
+
sessionId?: string | null;
|
|
477
|
+
metadata?: Record<string, unknown> | null;
|
|
478
|
+
logger?: Logger;
|
|
479
|
+
}): Promise<TaskAndHistory>;
|
|
480
|
+
|
|
307
481
|
export declare namespace logs {
|
|
308
482
|
export {
|
|
309
483
|
getLogsHandler,
|
|
@@ -348,8 +522,11 @@ export declare namespace network {
|
|
|
348
522
|
|
|
349
523
|
declare interface NetworkContext extends Context {
|
|
350
524
|
networkId?: string;
|
|
525
|
+
runtimeContext: RuntimeContext;
|
|
351
526
|
}
|
|
352
527
|
|
|
528
|
+
export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: Logger): JSONRPCResponse<null, unknown>;
|
|
529
|
+
|
|
353
530
|
declare interface QueryRequest {
|
|
354
531
|
indexName: string;
|
|
355
532
|
queryVector: number[];
|
|
@@ -364,6 +541,15 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
|
|
|
364
541
|
|
|
365
542
|
declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
|
|
366
543
|
|
|
544
|
+
export declare function resumeAsyncVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, runtimeContextFromRequest, }: VNextWorkflowContext & {
|
|
545
|
+
body: {
|
|
546
|
+
step: string | string[];
|
|
547
|
+
resumeData?: unknown;
|
|
548
|
+
};
|
|
549
|
+
runtimeContext?: RuntimeContext_2;
|
|
550
|
+
runtimeContextFromRequest?: Record<string, unknown>;
|
|
551
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
|
|
552
|
+
|
|
367
553
|
export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
368
554
|
body: {
|
|
369
555
|
stepId: string;
|
|
@@ -372,6 +558,16 @@ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId,
|
|
|
372
558
|
runtimeContext: RuntimeContext;
|
|
373
559
|
}): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
|
|
374
560
|
|
|
561
|
+
export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
|
|
562
|
+
body: {
|
|
563
|
+
step: string | string[];
|
|
564
|
+
resumeData?: unknown;
|
|
565
|
+
};
|
|
566
|
+
runtimeContext?: RuntimeContext_2;
|
|
567
|
+
}): Promise<{
|
|
568
|
+
message: string;
|
|
569
|
+
}>;
|
|
570
|
+
|
|
375
571
|
export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
376
572
|
body: {
|
|
377
573
|
stepId: string;
|
|
@@ -388,13 +584,36 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
|
|
|
388
584
|
};
|
|
389
585
|
}): Promise<MessageType[]>;
|
|
390
586
|
|
|
587
|
+
declare type SerializedStep = {
|
|
588
|
+
id: string;
|
|
589
|
+
description: string;
|
|
590
|
+
inputSchema: string | undefined;
|
|
591
|
+
outputSchema: string | undefined;
|
|
592
|
+
resumeSchema: string | undefined;
|
|
593
|
+
suspendSchema: string | undefined;
|
|
594
|
+
};
|
|
595
|
+
|
|
391
596
|
declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
392
597
|
|
|
598
|
+
export declare function startAsyncVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
599
|
+
inputData?: unknown;
|
|
600
|
+
runtimeContext?: RuntimeContext_2;
|
|
601
|
+
runtimeContextFromRequest?: Record<string, unknown>;
|
|
602
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
|
|
603
|
+
|
|
393
604
|
export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
394
605
|
triggerData?: unknown;
|
|
395
606
|
runtimeContext: RuntimeContext;
|
|
396
607
|
}): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
|
|
397
608
|
|
|
609
|
+
export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
610
|
+
inputData?: unknown;
|
|
611
|
+
runtimeContext?: RuntimeContext_2;
|
|
612
|
+
runtimeContextFromRequest?: Record<string, unknown>;
|
|
613
|
+
}): Promise<{
|
|
614
|
+
message: string;
|
|
615
|
+
}>;
|
|
616
|
+
|
|
398
617
|
export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
399
618
|
triggerData?: unknown;
|
|
400
619
|
runtimeContext: RuntimeContext;
|
|
@@ -426,6 +645,7 @@ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId,
|
|
|
426
645
|
agentId: string;
|
|
427
646
|
body: GetBody<'stream'> & {
|
|
428
647
|
resourceid?: string;
|
|
648
|
+
runtimeContext?: string;
|
|
429
649
|
};
|
|
430
650
|
}): Promise<Response | undefined>;
|
|
431
651
|
|
|
@@ -452,6 +672,8 @@ declare interface TelemetryContext extends Context {
|
|
|
452
672
|
page?: number;
|
|
453
673
|
perPage?: number;
|
|
454
674
|
attribute?: string | string[];
|
|
675
|
+
fromDate?: Date;
|
|
676
|
+
toDate?: Date;
|
|
455
677
|
};
|
|
456
678
|
}
|
|
457
679
|
|
|
@@ -534,6 +756,26 @@ declare interface VectorContext extends Context {
|
|
|
534
756
|
vectorName?: string;
|
|
535
757
|
}
|
|
536
758
|
|
|
759
|
+
declare interface VNextWorkflowContext extends Context {
|
|
760
|
+
workflowId?: string;
|
|
761
|
+
runId?: string;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
export declare namespace vNextWorkflows {
|
|
765
|
+
export {
|
|
766
|
+
getVNextWorkflowsHandler,
|
|
767
|
+
getVNextWorkflowByIdHandler,
|
|
768
|
+
getVNextWorkflowRunByIdHandler,
|
|
769
|
+
createVNextWorkflowRunHandler,
|
|
770
|
+
startAsyncVNextWorkflowHandler,
|
|
771
|
+
startVNextWorkflowRunHandler,
|
|
772
|
+
watchVNextWorkflowHandler,
|
|
773
|
+
resumeAsyncVNextWorkflowHandler,
|
|
774
|
+
resumeVNextWorkflowHandler,
|
|
775
|
+
getVNextWorkflowRunsHandler
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
537
779
|
export declare namespace voice {
|
|
538
780
|
export {
|
|
539
781
|
getSpeakersHandler,
|
|
@@ -546,6 +788,8 @@ declare interface VoiceContext extends Context {
|
|
|
546
788
|
agentId?: string;
|
|
547
789
|
}
|
|
548
790
|
|
|
791
|
+
export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
792
|
+
|
|
549
793
|
export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
550
794
|
|
|
551
795
|
declare interface WorkflowContext extends Context {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
4
|
+
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
5
|
+
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
5
6
|
|
|
6
7
|
// src/server/handlers/vector.ts
|
|
7
8
|
var vector_exports = {};
|
|
8
|
-
|
|
9
|
+
chunk75ZPJI57_cjs.__export(vector_exports, {
|
|
9
10
|
createIndex: () => createIndex,
|
|
10
11
|
deleteIndex: () => deleteIndex,
|
|
11
12
|
describeIndex: () => describeIndex,
|
|
@@ -15,24 +16,24 @@ chunkFV45V6WC_cjs.__export(vector_exports, {
|
|
|
15
16
|
});
|
|
16
17
|
function getVector(mastra, vectorName) {
|
|
17
18
|
if (!vectorName) {
|
|
18
|
-
throw new
|
|
19
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Vector name is required" });
|
|
19
20
|
}
|
|
20
21
|
const vector = mastra.getVector(vectorName);
|
|
21
22
|
if (!vector) {
|
|
22
|
-
throw new
|
|
23
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: `Vector store ${vectorName} not found` });
|
|
23
24
|
}
|
|
24
25
|
return vector;
|
|
25
26
|
}
|
|
26
27
|
async function upsertVectors({ mastra, vectorName, index }) {
|
|
27
28
|
try {
|
|
28
29
|
if (!index?.indexName || !index?.vectors || !Array.isArray(index.vectors)) {
|
|
29
|
-
throw new
|
|
30
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Invalid request index. indexName and vectors array are required." });
|
|
30
31
|
}
|
|
31
32
|
const vector = getVector(mastra, vectorName);
|
|
32
33
|
const result = await vector.upsert(index);
|
|
33
34
|
return { ids: result };
|
|
34
35
|
} catch (error) {
|
|
35
|
-
return
|
|
36
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error upserting vectors");
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
async function createIndex({
|
|
@@ -43,18 +44,18 @@ async function createIndex({
|
|
|
43
44
|
try {
|
|
44
45
|
const { indexName, dimension, metric } = index;
|
|
45
46
|
if (!indexName || typeof dimension !== "number" || dimension <= 0) {
|
|
46
|
-
throw new
|
|
47
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, {
|
|
47
48
|
message: "Invalid request index, indexName and positive dimension number are required."
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
if (metric && !["cosine", "euclidean", "dotproduct"].includes(metric)) {
|
|
51
|
-
throw new
|
|
52
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Invalid metric. Must be one of: cosine, euclidean, dotproduct" });
|
|
52
53
|
}
|
|
53
54
|
const vector = getVector(mastra, vectorName);
|
|
54
55
|
await vector.createIndex({ indexName, dimension, metric });
|
|
55
56
|
return { success: true };
|
|
56
57
|
} catch (error) {
|
|
57
|
-
return
|
|
58
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error creating index");
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
async function queryVectors({
|
|
@@ -64,13 +65,13 @@ async function queryVectors({
|
|
|
64
65
|
}) {
|
|
65
66
|
try {
|
|
66
67
|
if (!query?.indexName || !query?.queryVector || !Array.isArray(query.queryVector)) {
|
|
67
|
-
throw new
|
|
68
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Invalid request query. indexName and queryVector array are required." });
|
|
68
69
|
}
|
|
69
70
|
const vector = getVector(mastra, vectorName);
|
|
70
71
|
const results = await vector.query(query);
|
|
71
72
|
return results;
|
|
72
73
|
} catch (error) {
|
|
73
|
-
return
|
|
74
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error querying vectors");
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
async function listIndexes({ mastra, vectorName }) {
|
|
@@ -79,7 +80,7 @@ async function listIndexes({ mastra, vectorName }) {
|
|
|
79
80
|
const indexes = await vector.listIndexes();
|
|
80
81
|
return indexes.filter(Boolean);
|
|
81
82
|
} catch (error) {
|
|
82
|
-
return
|
|
83
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error listing indexes");
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
async function describeIndex({
|
|
@@ -89,7 +90,7 @@ async function describeIndex({
|
|
|
89
90
|
}) {
|
|
90
91
|
try {
|
|
91
92
|
if (!indexName) {
|
|
92
|
-
throw new
|
|
93
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Index name is required" });
|
|
93
94
|
}
|
|
94
95
|
const vector = getVector(mastra, vectorName);
|
|
95
96
|
const stats = await vector.describeIndex(indexName);
|
|
@@ -99,7 +100,7 @@ async function describeIndex({
|
|
|
99
100
|
metric: stats.metric?.toLowerCase()
|
|
100
101
|
};
|
|
101
102
|
} catch (error) {
|
|
102
|
-
return
|
|
103
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error describing index");
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
async function deleteIndex({
|
|
@@ -109,13 +110,13 @@ async function deleteIndex({
|
|
|
109
110
|
}) {
|
|
110
111
|
try {
|
|
111
112
|
if (!indexName) {
|
|
112
|
-
throw new
|
|
113
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Index name is required" });
|
|
113
114
|
}
|
|
114
115
|
const vector = getVector(mastra, vectorName);
|
|
115
116
|
await vector.deleteIndex(indexName);
|
|
116
117
|
return { success: true };
|
|
117
118
|
} catch (error) {
|
|
118
|
-
return
|
|
119
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error deleting index");
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
4
4
|
|
|
5
5
|
// src/server/handlers/utils.ts
|
|
6
6
|
function validateBody(body) {
|
|
@@ -11,7 +11,7 @@ function validateBody(body) {
|
|
|
11
11
|
return acc;
|
|
12
12
|
}, {});
|
|
13
13
|
if (Object.keys(errorResponse).length > 0) {
|
|
14
|
-
throw new
|
|
14
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: Object.values(errorResponse)[0] });
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|