@mastra/server 0.0.0-message-ordering-20250415215612 → 0.0.0-pass-headers-for-create-mastra-client-20250529190531
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 +316 -59
- package/dist/_tsup-dts-rollup.d.ts +316 -59
- 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-A3KDUGS7.cjs +239 -0
- package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
- package/dist/{chunk-YANVFOYA.js → chunk-C7564HUT.js} +56 -34
- package/dist/{chunk-RBQASTUP.js → chunk-DJJIUEL2.js} +13 -5
- package/dist/{chunk-3EJZQ6TQ.js → chunk-DQLE3DVM.js} +5 -5
- package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
- package/dist/{chunk-3RVHWGWO.js → chunk-HFWCEP5S.js} +6 -12
- package/dist/chunk-J3PKLB3A.js +231 -0
- 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-SKBVVI24.cjs → chunk-NEOOQUKW.cjs} +11 -11
- 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-UV4WTEH4.js → chunk-TJKLBTFB.js} +20 -8
- package/dist/chunk-VPNDC2DI.cjs +148 -0
- package/dist/{chunk-OPP7H5TW.js → chunk-W7VCKPAD.js} +77 -62
- 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-PDC4ZBQW.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/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 +8 -6
- package/dist/chunk-67WTHYAV.js +0 -156
- package/dist/chunk-B64YROKU.cjs +0 -317
- package/dist/chunk-JLDXUWK7.cjs +0 -126
- package/dist/chunk-QH6XWSXP.cjs +0 -5579
- package/dist/chunk-VK6FX47H.js +0 -5576
- package/dist/chunk-Z46X3YCB.cjs +0 -164
|
@@ -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';
|
|
4
|
+
import type { Artifact } from '@mastra/core/a2a';
|
|
3
5
|
import type { BaseLogMessage } from '@mastra/core/logger';
|
|
4
|
-
import type {
|
|
5
|
-
import { CoreMessage } from 'ai';
|
|
6
|
+
import type { CoreMessage } from '@mastra/core/llm';
|
|
6
7
|
import { EvalRow } from '@mastra/core/storage';
|
|
7
8
|
import { GenerateObjectResult } from 'ai';
|
|
8
9
|
import { GenerateTextResult } from 'ai';
|
|
10
|
+
import type { IMastraLogger } from '@mastra/core/logger';
|
|
11
|
+
import type { JSONRPCError } from '@mastra/core/a2a';
|
|
12
|
+
import { JSONRPCResponse } from '@mastra/core/a2a';
|
|
13
|
+
import { LegacyStep } from '@mastra/core/workflows/legacy';
|
|
14
|
+
import type { LegacyWorkflow } from '@mastra/core/workflows/legacy';
|
|
15
|
+
import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
|
|
16
|
+
import type { LegacyWorkflowRuns } from '@mastra/core/storage';
|
|
9
17
|
import type { Mastra } from '@mastra/core/mastra';
|
|
10
18
|
import type { MastraMemory } from '@mastra/core/memory';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
19
|
+
import { MastraMessageV1 } from '@mastra/core/memory';
|
|
20
|
+
import { MastraMessageV2 } from '@mastra/core/agent';
|
|
21
|
+
import type { Message } from '@mastra/core/a2a';
|
|
13
22
|
import type { QueryResult } from '@mastra/core/vector';
|
|
14
23
|
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
24
|
+
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
25
|
+
import { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
|
|
26
|
+
import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
|
|
15
27
|
import { Step } from '@mastra/core/workflows';
|
|
16
|
-
import { StepExecutionContext } from '@mastra/core/workflows';
|
|
17
|
-
import { StepGraph } from '@mastra/core/workflows';
|
|
28
|
+
import { StepExecutionContext } from '@mastra/core/workflows/legacy';
|
|
29
|
+
import { StepGraph } from '@mastra/core/workflows/legacy';
|
|
18
30
|
import { StorageThreadType } from '@mastra/core/memory';
|
|
31
|
+
import { Task } from '@mastra/core/a2a';
|
|
32
|
+
import { TaskAndHistory } from '@mastra/core/a2a';
|
|
33
|
+
import type { TaskContext } from '@mastra/core/a2a';
|
|
34
|
+
import type { TaskIdParams } from '@mastra/core/a2a';
|
|
35
|
+
import type { TaskQueryParams } from '@mastra/core/a2a';
|
|
36
|
+
import type { TaskSendParams } from '@mastra/core/a2a';
|
|
37
|
+
import type { TaskStatus } from '@mastra/core/a2a';
|
|
19
38
|
import type { ToolAction } from '@mastra/core/tools';
|
|
39
|
+
import { UIMessage } from 'ai';
|
|
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/workflows';
|
|
23
|
-
import {
|
|
43
|
+
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
|
|
44
|
+
import { WorkflowResult } from '@mastra/core/workflows';
|
|
24
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): CoreMessage;
|
|
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;
|
|
109
|
+
history: Message[];
|
|
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,27 +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,
|
|
143
|
+
export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
|
|
91
144
|
agentId?: string;
|
|
92
145
|
data: any;
|
|
93
|
-
|
|
146
|
+
runtimeContext: RuntimeContext_2;
|
|
147
|
+
runtimeContextFromRequest: Record<string, unknown>;
|
|
94
148
|
}): Promise<any>;
|
|
95
149
|
|
|
96
|
-
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data,
|
|
150
|
+
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
|
|
97
151
|
data?: unknown;
|
|
98
|
-
|
|
152
|
+
runtimeContext: RuntimeContext_2;
|
|
153
|
+
runtimeContextFromRequest: Record<string, unknown>;
|
|
99
154
|
}) => Promise<any>;
|
|
100
155
|
|
|
101
|
-
export declare function generateHandler({ mastra,
|
|
102
|
-
|
|
156
|
+
export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
157
|
+
runtimeContext: RuntimeContext;
|
|
103
158
|
agentId: string;
|
|
104
159
|
body: GetBody<'generate'> & {
|
|
105
160
|
resourceid?: string;
|
|
161
|
+
runtimeContext?: Record<string, unknown>;
|
|
106
162
|
};
|
|
107
163
|
}): Promise<GenerateTextResult<any, any>>;
|
|
108
164
|
|
|
109
|
-
export declare function generateHandler_alias_1({ mastra,
|
|
110
|
-
|
|
165
|
+
export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
|
|
166
|
+
runtimeContext: RuntimeContext;
|
|
111
167
|
body: {
|
|
112
168
|
messages?: Parameters<AgentNetwork['generate']>[0];
|
|
113
169
|
} & Parameters<AgentNetwork['generate']>[1];
|
|
@@ -121,21 +177,46 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
|
|
|
121
177
|
text?: string;
|
|
122
178
|
speakerId?: string;
|
|
123
179
|
};
|
|
124
|
-
}): Promise<
|
|
125
|
-
audioData: Buffer<ArrayBuffer>;
|
|
126
|
-
}>;
|
|
180
|
+
}): Promise<NodeJS.ReadableStream>;
|
|
127
181
|
|
|
128
|
-
export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
|
|
182
|
+
export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
183
|
+
runtimeContext: RuntimeContext;
|
|
129
184
|
agentId: string;
|
|
130
185
|
}): Promise<{
|
|
131
186
|
name: any;
|
|
132
187
|
instructions: string;
|
|
133
188
|
tools: any;
|
|
189
|
+
workflows: {};
|
|
134
190
|
provider: string;
|
|
135
191
|
modelId: string;
|
|
192
|
+
defaultGenerateOptions: any;
|
|
193
|
+
defaultStreamOptions: any;
|
|
136
194
|
}>;
|
|
137
195
|
|
|
138
|
-
export declare function
|
|
196
|
+
export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
|
|
197
|
+
runtimeContext: RuntimeContext;
|
|
198
|
+
agentId: keyof ReturnType<typeof mastra.getAgents>;
|
|
199
|
+
executionUrl?: string;
|
|
200
|
+
version?: string;
|
|
201
|
+
provider?: {
|
|
202
|
+
organization: string;
|
|
203
|
+
url: string;
|
|
204
|
+
};
|
|
205
|
+
}): Promise<AgentCard>;
|
|
206
|
+
|
|
207
|
+
export declare function getAgentExecutionHandler({ requestId, mastra, agentId, runtimeContext, method, params, taskStore, logger, }: Context & {
|
|
208
|
+
requestId: string;
|
|
209
|
+
runtimeContext: RuntimeContext;
|
|
210
|
+
agentId: string;
|
|
211
|
+
method: 'tasks/send' | 'tasks/sendSubscribe' | 'tasks/get' | 'tasks/cancel';
|
|
212
|
+
params: TaskSendParams | TaskQueryParams | TaskIdParams;
|
|
213
|
+
taskStore?: InMemoryTaskStore;
|
|
214
|
+
logger?: IMastraLogger;
|
|
215
|
+
}): Promise<any>;
|
|
216
|
+
|
|
217
|
+
export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
|
|
218
|
+
runtimeContext: RuntimeContext;
|
|
219
|
+
}): Promise<any>;
|
|
139
220
|
|
|
140
221
|
declare type GetBody<T extends keyof Agent & {
|
|
141
222
|
[K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
|
|
@@ -143,7 +224,8 @@ declare type GetBody<T extends keyof Agent & {
|
|
|
143
224
|
messages: Parameters<Agent[T]>[0];
|
|
144
225
|
} & Parameters<Agent[T]>[1];
|
|
145
226
|
|
|
146
|
-
export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
|
|
227
|
+
export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
228
|
+
runtimeContext: RuntimeContext;
|
|
147
229
|
agentId: string;
|
|
148
230
|
}): Promise<{
|
|
149
231
|
id: string;
|
|
@@ -152,7 +234,30 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
|
|
|
152
234
|
evals: EvalRow[];
|
|
153
235
|
}>;
|
|
154
236
|
|
|
155
|
-
export declare function
|
|
237
|
+
export declare function getLegacyWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
|
|
238
|
+
stepGraph: StepGraph;
|
|
239
|
+
stepSubscriberGraph: Record<string, StepGraph>;
|
|
240
|
+
serializedStepGraph: StepGraph;
|
|
241
|
+
serializedStepSubscriberGraph: Record<string, StepGraph>;
|
|
242
|
+
name: string;
|
|
243
|
+
triggerSchema: string | undefined;
|
|
244
|
+
steps: any;
|
|
245
|
+
}>;
|
|
246
|
+
|
|
247
|
+
export declare function getLegacyWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<LegacyWorkflow['getRun']>>;
|
|
248
|
+
|
|
249
|
+
export declare function getLegacyWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
|
|
250
|
+
fromDate?: Date;
|
|
251
|
+
toDate?: Date;
|
|
252
|
+
limit?: number;
|
|
253
|
+
offset?: number;
|
|
254
|
+
resourceId?: string;
|
|
255
|
+
}): Promise<LegacyWorkflowRuns>;
|
|
256
|
+
|
|
257
|
+
export declare function getLegacyWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
|
|
258
|
+
|
|
259
|
+
export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
260
|
+
runtimeContext: RuntimeContext;
|
|
156
261
|
agentId: string;
|
|
157
262
|
}): Promise<{
|
|
158
263
|
id: string;
|
|
@@ -161,7 +266,7 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Contex
|
|
|
161
266
|
evals: EvalRow[];
|
|
162
267
|
}>;
|
|
163
268
|
|
|
164
|
-
export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<
|
|
269
|
+
export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<any[]>;
|
|
165
270
|
|
|
166
271
|
export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
|
|
167
272
|
|
|
@@ -173,12 +278,14 @@ export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryC
|
|
|
173
278
|
result: boolean;
|
|
174
279
|
}>;
|
|
175
280
|
|
|
176
|
-
export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>
|
|
177
|
-
|
|
178
|
-
|
|
281
|
+
export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
|
|
282
|
+
limit?: number;
|
|
283
|
+
}): Promise<{
|
|
284
|
+
messages: MastraMessageV1[];
|
|
285
|
+
uiMessages: UIMessage[];
|
|
179
286
|
}>;
|
|
180
287
|
|
|
181
|
-
export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
|
|
288
|
+
export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
182
289
|
id: string;
|
|
183
290
|
name: string;
|
|
184
291
|
instructions: string;
|
|
@@ -193,7 +300,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
|
|
|
193
300
|
};
|
|
194
301
|
}>;
|
|
195
302
|
|
|
196
|
-
export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
|
|
303
|
+
export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
|
|
197
304
|
id: string;
|
|
198
305
|
name: string;
|
|
199
306
|
instructions: string;
|
|
@@ -225,24 +332,71 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
|
|
|
225
332
|
|
|
226
333
|
export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
|
|
227
334
|
|
|
228
|
-
export declare function getWorkflowByIdHandler({ mastra, workflowId }:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
steps: any;
|
|
335
|
+
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
|
|
336
|
+
steps: SerializedStep[];
|
|
337
|
+
name: string | undefined;
|
|
338
|
+
description: string | undefined;
|
|
339
|
+
stepGraph: SerializedStepFlowEntry[];
|
|
340
|
+
inputSchema: string | undefined;
|
|
341
|
+
outputSchema: string | undefined;
|
|
236
342
|
}>;
|
|
237
343
|
|
|
238
|
-
export declare function
|
|
344
|
+
export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
|
|
239
345
|
|
|
240
|
-
export declare function getWorkflowRunsHandler({ mastra, workflowId }:
|
|
346
|
+
export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
|
|
347
|
+
fromDate?: Date;
|
|
348
|
+
toDate?: Date;
|
|
349
|
+
limit?: number;
|
|
350
|
+
offset?: number;
|
|
351
|
+
resourceId?: string;
|
|
352
|
+
}): Promise<WorkflowRuns>;
|
|
241
353
|
|
|
242
|
-
export declare function getWorkflowsHandler({ mastra }:
|
|
354
|
+
export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
|
|
243
355
|
|
|
244
356
|
export declare function handleError(error: unknown, defaultMessage: string): never;
|
|
245
357
|
|
|
358
|
+
export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
|
|
359
|
+
requestId: string;
|
|
360
|
+
taskStore: InMemoryTaskStore;
|
|
361
|
+
agentId: string;
|
|
362
|
+
taskId: string;
|
|
363
|
+
logger?: IMastraLogger;
|
|
364
|
+
}): Promise<JSONRPCResponse<Task, unknown>>;
|
|
365
|
+
|
|
366
|
+
export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
|
|
367
|
+
requestId: string;
|
|
368
|
+
taskStore: InMemoryTaskStore;
|
|
369
|
+
agentId: string;
|
|
370
|
+
taskId: string;
|
|
371
|
+
}): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
|
|
372
|
+
|
|
373
|
+
export declare function handleTaskSend({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
|
|
374
|
+
requestId: string;
|
|
375
|
+
params: TaskSendParams;
|
|
376
|
+
taskStore: InMemoryTaskStore;
|
|
377
|
+
agent: Agent;
|
|
378
|
+
logger?: IMastraLogger;
|
|
379
|
+
runtimeContext: RuntimeContext;
|
|
380
|
+
}): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
|
|
381
|
+
|
|
382
|
+
export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
|
|
383
|
+
requestId: string;
|
|
384
|
+
params: TaskSendParams;
|
|
385
|
+
taskStore: InMemoryTaskStore;
|
|
386
|
+
agent: Agent;
|
|
387
|
+
logger?: IMastraLogger;
|
|
388
|
+
runtimeContext: RuntimeContext;
|
|
389
|
+
}): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
|
|
390
|
+
state: string;
|
|
391
|
+
message: {
|
|
392
|
+
role: string;
|
|
393
|
+
parts: {
|
|
394
|
+
type: string;
|
|
395
|
+
text: string;
|
|
396
|
+
}[];
|
|
397
|
+
};
|
|
398
|
+
}, unknown>, void, unknown>;
|
|
399
|
+
|
|
246
400
|
/**
|
|
247
401
|
* `HTTPException` must be used when a fatal error such as authentication failure occurs.
|
|
248
402
|
*
|
|
@@ -304,8 +458,46 @@ declare type HTTPExceptionOptions = {
|
|
|
304
458
|
*/
|
|
305
459
|
declare type InfoStatusCode = 100 | 101 | 102 | 103;
|
|
306
460
|
|
|
461
|
+
export declare class InMemoryTaskStore {
|
|
462
|
+
private store;
|
|
463
|
+
activeCancellations: Set<string>;
|
|
464
|
+
load({ agentId, taskId }: {
|
|
465
|
+
agentId: string;
|
|
466
|
+
taskId: string;
|
|
467
|
+
}): Promise<TaskAndHistory | null>;
|
|
468
|
+
save({ agentId, data }: {
|
|
469
|
+
agentId: string;
|
|
470
|
+
data: TaskAndHistory;
|
|
471
|
+
}): Promise<void>;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
export declare namespace legacyWorkflows {
|
|
475
|
+
export {
|
|
476
|
+
getLegacyWorkflowsHandler,
|
|
477
|
+
getLegacyWorkflowByIdHandler,
|
|
478
|
+
startAsyncLegacyWorkflowHandler,
|
|
479
|
+
getLegacyWorkflowRunHandler,
|
|
480
|
+
createLegacyWorkflowRunHandler,
|
|
481
|
+
startLegacyWorkflowRunHandler,
|
|
482
|
+
watchLegacyWorkflowHandler,
|
|
483
|
+
resumeAsyncLegacyWorkflowHandler,
|
|
484
|
+
resumeLegacyWorkflowHandler,
|
|
485
|
+
getLegacyWorkflowRunsHandler
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
307
489
|
export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
|
|
308
490
|
|
|
491
|
+
export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
|
|
492
|
+
agentId: string;
|
|
493
|
+
taskId: string;
|
|
494
|
+
taskStore: InMemoryTaskStore;
|
|
495
|
+
message: Message;
|
|
496
|
+
sessionId?: string | null;
|
|
497
|
+
metadata?: Record<string, unknown> | null;
|
|
498
|
+
logger?: IMastraLogger;
|
|
499
|
+
}): Promise<TaskAndHistory>;
|
|
500
|
+
|
|
309
501
|
export declare namespace logs {
|
|
310
502
|
export {
|
|
311
503
|
getLogsHandler,
|
|
@@ -350,8 +542,11 @@ export declare namespace network {
|
|
|
350
542
|
|
|
351
543
|
declare interface NetworkContext extends Context {
|
|
352
544
|
networkId?: string;
|
|
545
|
+
runtimeContext: RuntimeContext;
|
|
353
546
|
}
|
|
354
547
|
|
|
548
|
+
export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
|
|
549
|
+
|
|
355
550
|
declare interface QueryRequest {
|
|
356
551
|
indexName: string;
|
|
357
552
|
queryVector: number[];
|
|
@@ -366,20 +561,39 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
|
|
|
366
561
|
|
|
367
562
|
declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
|
|
368
563
|
|
|
369
|
-
export declare function
|
|
564
|
+
export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
370
565
|
body: {
|
|
371
566
|
stepId: string;
|
|
372
567
|
context: any;
|
|
373
568
|
};
|
|
374
|
-
|
|
375
|
-
}): Promise<Omit<
|
|
569
|
+
runtimeContext: RuntimeContext;
|
|
570
|
+
}): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
|
|
376
571
|
|
|
377
|
-
export declare function
|
|
572
|
+
export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, runtimeContextFromRequest, }: WorkflowContext_3 & {
|
|
573
|
+
body: {
|
|
574
|
+
step: string | string[];
|
|
575
|
+
resumeData?: unknown;
|
|
576
|
+
};
|
|
577
|
+
runtimeContext?: RuntimeContext_2;
|
|
578
|
+
runtimeContextFromRequest?: Record<string, unknown>;
|
|
579
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
|
|
580
|
+
|
|
581
|
+
export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
378
582
|
body: {
|
|
379
583
|
stepId: string;
|
|
380
584
|
context: any;
|
|
381
585
|
};
|
|
382
|
-
|
|
586
|
+
runtimeContext: RuntimeContext;
|
|
587
|
+
}): Promise<{
|
|
588
|
+
message: string;
|
|
589
|
+
}>;
|
|
590
|
+
|
|
591
|
+
export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
|
|
592
|
+
body: {
|
|
593
|
+
step: string | string[];
|
|
594
|
+
resumeData?: unknown;
|
|
595
|
+
};
|
|
596
|
+
runtimeContext?: RuntimeContext_2;
|
|
383
597
|
}): Promise<{
|
|
384
598
|
message: string;
|
|
385
599
|
}>;
|
|
@@ -388,18 +602,41 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
|
|
|
388
602
|
body: {
|
|
389
603
|
messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
|
|
390
604
|
};
|
|
391
|
-
}): Promise<
|
|
605
|
+
}): Promise<MastraMessageV2[]>;
|
|
606
|
+
|
|
607
|
+
declare type SerializedStep = {
|
|
608
|
+
id: string;
|
|
609
|
+
description: string;
|
|
610
|
+
inputSchema: string | undefined;
|
|
611
|
+
outputSchema: string | undefined;
|
|
612
|
+
resumeSchema: string | undefined;
|
|
613
|
+
suspendSchema: string | undefined;
|
|
614
|
+
};
|
|
392
615
|
|
|
393
616
|
declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
394
617
|
|
|
395
|
-
export declare function
|
|
618
|
+
export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
396
619
|
triggerData?: unknown;
|
|
397
|
-
|
|
398
|
-
}): Promise<
|
|
620
|
+
runtimeContext: RuntimeContext;
|
|
621
|
+
}): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
|
|
399
622
|
|
|
400
|
-
export declare function
|
|
623
|
+
export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
624
|
+
inputData?: unknown;
|
|
625
|
+
runtimeContext?: RuntimeContext_2;
|
|
626
|
+
runtimeContextFromRequest?: Record<string, unknown>;
|
|
627
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
|
|
628
|
+
|
|
629
|
+
export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
401
630
|
triggerData?: unknown;
|
|
402
|
-
|
|
631
|
+
runtimeContext: RuntimeContext;
|
|
632
|
+
}): Promise<{
|
|
633
|
+
message: string;
|
|
634
|
+
}>;
|
|
635
|
+
|
|
636
|
+
export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
637
|
+
inputData?: unknown;
|
|
638
|
+
runtimeContext?: RuntimeContext_2;
|
|
639
|
+
runtimeContextFromRequest?: Record<string, unknown>;
|
|
403
640
|
}): Promise<{
|
|
404
641
|
message: string;
|
|
405
642
|
}>;
|
|
@@ -423,21 +660,31 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
|
|
|
423
660
|
traceCount: number;
|
|
424
661
|
}>;
|
|
425
662
|
|
|
426
|
-
export declare function streamGenerateHandler({ mastra,
|
|
427
|
-
|
|
663
|
+
export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
664
|
+
runtimeContext: RuntimeContext;
|
|
428
665
|
agentId: string;
|
|
429
666
|
body: GetBody<'stream'> & {
|
|
430
667
|
resourceid?: string;
|
|
668
|
+
runtimeContext?: string;
|
|
431
669
|
};
|
|
432
670
|
}): Promise<Response | undefined>;
|
|
433
671
|
|
|
434
|
-
export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
|
|
435
|
-
|
|
672
|
+
export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
|
|
673
|
+
runtimeContext: RuntimeContext;
|
|
436
674
|
body: {
|
|
437
675
|
messages?: Parameters<AgentNetwork['stream']>[0];
|
|
438
676
|
} & Parameters<AgentNetwork['stream']>[1];
|
|
439
677
|
}): Promise<Response>;
|
|
440
678
|
|
|
679
|
+
export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
680
|
+
inputData?: unknown;
|
|
681
|
+
runtimeContext?: RuntimeContext_2;
|
|
682
|
+
runtimeContextFromRequest?: Record<string, unknown>;
|
|
683
|
+
}): {
|
|
684
|
+
stream: globalThis.ReadableStream<WatchEvent>;
|
|
685
|
+
getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
|
|
686
|
+
};
|
|
687
|
+
|
|
441
688
|
declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
|
|
442
689
|
|
|
443
690
|
export declare namespace telemetry {
|
|
@@ -454,6 +701,8 @@ declare interface TelemetryContext extends Context {
|
|
|
454
701
|
page?: number;
|
|
455
702
|
perPage?: number;
|
|
456
703
|
attribute?: string | string[];
|
|
704
|
+
fromDate?: Date;
|
|
705
|
+
toDate?: Date;
|
|
457
706
|
};
|
|
458
707
|
}
|
|
459
708
|
|
|
@@ -548,22 +797,30 @@ declare interface VoiceContext extends Context {
|
|
|
548
797
|
agentId?: string;
|
|
549
798
|
}
|
|
550
799
|
|
|
551
|
-
export declare function
|
|
800
|
+
export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
801
|
+
|
|
802
|
+
export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
552
803
|
|
|
553
804
|
declare interface WorkflowContext extends Context {
|
|
554
805
|
workflowId?: string;
|
|
555
806
|
runId?: string;
|
|
556
807
|
}
|
|
557
808
|
|
|
809
|
+
declare interface WorkflowContext_3 extends Context {
|
|
810
|
+
workflowId?: string;
|
|
811
|
+
runId?: string;
|
|
812
|
+
}
|
|
813
|
+
|
|
558
814
|
export declare namespace workflows {
|
|
559
815
|
export {
|
|
560
816
|
getWorkflowsHandler,
|
|
561
817
|
getWorkflowByIdHandler,
|
|
818
|
+
getWorkflowRunByIdHandler,
|
|
819
|
+
createWorkflowRunHandler,
|
|
562
820
|
startAsyncWorkflowHandler,
|
|
563
|
-
getWorkflowRunHandler,
|
|
564
|
-
createRunHandler,
|
|
565
821
|
startWorkflowRunHandler,
|
|
566
822
|
watchWorkflowHandler,
|
|
823
|
+
streamWorkflowHandler,
|
|
567
824
|
resumeAsyncWorkflowHandler,
|
|
568
825
|
resumeWorkflowHandler,
|
|
569
826
|
getWorkflowRunsHandler
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { handleError } from './chunk-
|
|
2
|
-
import {
|
|
1
|
+
import { handleError } from './chunk-M5ABIP7D.js';
|
|
2
|
+
import { HTTPException } from './chunk-NYN7KFXL.js';
|
|
3
|
+
import { __export } from './chunk-MLKGABMK.js';
|
|
3
4
|
|
|
4
5
|
// src/server/handlers/vector.ts
|
|
5
6
|
var vector_exports = {};
|
|
@@ -90,7 +91,7 @@ async function describeIndex({
|
|
|
90
91
|
throw new HTTPException(400, { message: "Index name is required" });
|
|
91
92
|
}
|
|
92
93
|
const vector = getVector(mastra, vectorName);
|
|
93
|
-
const stats = await vector.describeIndex(indexName);
|
|
94
|
+
const stats = await vector.describeIndex({ indexName });
|
|
94
95
|
return {
|
|
95
96
|
dimension: stats.dimension,
|
|
96
97
|
count: stats.count,
|
|
@@ -110,7 +111,7 @@ async function deleteIndex({
|
|
|
110
111
|
throw new HTTPException(400, { message: "Index name is required" });
|
|
111
112
|
}
|
|
112
113
|
const vector = getVector(mastra, vectorName);
|
|
113
|
-
await vector.deleteIndex(indexName);
|
|
114
|
+
await vector.deleteIndex({ indexName });
|
|
114
115
|
return { success: true };
|
|
115
116
|
} catch (error) {
|
|
116
117
|
return handleError(error, "Error deleting index");
|
|
@@ -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
|
|