@mastra/server 0.10.13 → 0.10.15-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/dist/_tsup-dts-rollup.d.cts +1107 -0
- package/dist/_tsup-dts-rollup.d.ts +1107 -0
- package/dist/chunk-2KZFMI6P.cjs +37 -0
- package/dist/chunk-2SLFAFTR.cjs +148 -0
- package/dist/chunk-3CNDE7QY.cjs +308 -0
- package/dist/chunk-4D66QEKC.js +81 -0
- package/dist/chunk-5PQQ42EZ.js +320 -0
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/chunk-7TP2LX5L.cjs +129 -0
- package/dist/chunk-B2PAS2IB.cjs +514 -0
- package/dist/chunk-BK4XT6EG.js +270 -0
- package/dist/chunk-CCGRCYWJ.cjs +18 -0
- package/dist/chunk-CRCR3ZUK.js +142 -0
- package/dist/chunk-FRVBFMO2.cjs +128 -0
- package/dist/chunk-G7KH752Y.cjs +145 -0
- package/dist/chunk-GHC4YV6R.js +504 -0
- package/dist/chunk-H7DMHBKY.js +498 -0
- package/dist/chunk-JMLYCXMK.cjs +332 -0
- package/dist/chunk-KHZKYUNR.js +112 -0
- package/dist/chunk-KOHWJYJT.js +296 -0
- package/dist/chunk-LCM566I4.js +35 -0
- package/dist/chunk-LF7P5PLR.js +14 -0
- package/dist/chunk-LI436ITD.cjs +2042 -0
- package/dist/chunk-LRCAAFUA.js +122 -0
- package/dist/chunk-LZ3VJXSO.cjs +278 -0
- package/dist/chunk-MEGCYGBU.js +2039 -0
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/chunk-PZQDCRPV.cjs +16 -0
- package/dist/chunk-QGX47B5D.cjs +86 -0
- package/dist/chunk-RG473F6Y.js +141 -0
- package/dist/chunk-RHSWAXKB.cjs +118 -0
- package/dist/chunk-RSEO4XPX.js +16 -0
- package/dist/chunk-SDPGVWQJ.cjs +512 -0
- package/dist/chunk-WNVFNNWN.js +121 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- 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 +30 -0
- package/dist/server/handlers/agents.d.cts +6 -0
- package/dist/server/handlers/agents.d.ts +6 -0
- package/dist/server/handlers/agents.js +1 -0
- package/dist/server/handlers/error.cjs +10 -0
- package/dist/server/handlers/error.d.cts +1 -0
- package/dist/server/handlers/error.d.ts +1 -0
- package/dist/server/handlers/error.js +1 -0
- 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 +18 -0
- package/dist/server/handlers/logs.d.cts +3 -0
- package/dist/server/handlers/logs.d.ts +3 -0
- package/dist/server/handlers/logs.js +1 -0
- package/dist/server/handlers/memory.cjs +46 -0
- package/dist/server/handlers/memory.d.cts +10 -0
- package/dist/server/handlers/memory.d.ts +10 -0
- package/dist/server/handlers/memory.js +1 -0
- package/dist/server/handlers/network.cjs +22 -0
- package/dist/server/handlers/network.d.cts +4 -0
- package/dist/server/handlers/network.d.ts +4 -0
- package/dist/server/handlers/network.js +1 -0
- package/dist/server/handlers/telemetry.cjs +14 -0
- package/dist/server/handlers/telemetry.d.cts +2 -0
- package/dist/server/handlers/telemetry.d.ts +2 -0
- package/dist/server/handlers/telemetry.js +1 -0
- package/dist/server/handlers/tools.cjs +22 -0
- package/dist/server/handlers/tools.d.cts +4 -0
- package/dist/server/handlers/tools.d.ts +4 -0
- package/dist/server/handlers/tools.js +1 -0
- package/dist/server/handlers/utils.cjs +10 -0
- package/dist/server/handlers/utils.d.cts +1 -0
- package/dist/server/handlers/utils.d.ts +1 -0
- package/dist/server/handlers/utils.js +1 -0
- package/dist/server/handlers/vNextNetwork.cjs +218 -0
- package/dist/server/handlers/vNextNetwork.d.cts +6 -0
- package/dist/server/handlers/vNextNetwork.d.ts +6 -0
- package/dist/server/handlers/vNextNetwork.js +211 -0
- package/dist/server/handlers/vector.cjs +30 -0
- package/dist/server/handlers/vector.d.cts +6 -0
- package/dist/server/handlers/vector.d.ts +6 -0
- package/dist/server/handlers/vector.js +1 -0
- package/dist/server/handlers/voice.cjs +22 -0
- package/dist/server/handlers/voice.d.cts +4 -0
- package/dist/server/handlers/voice.d.ts +4 -0
- package/dist/server/handlers/voice.js +1 -0
- package/dist/server/handlers/workflows.cjs +62 -0
- package/dist/server/handlers/workflows.d.cts +14 -0
- package/dist/server/handlers/workflows.d.ts +14 -0
- package/dist/server/handlers/workflows.js +1 -0
- package/dist/server/handlers.cjs +60 -0
- package/dist/server/handlers.d.cts +11 -0
- package/dist/server/handlers.d.ts +11 -0
- package/dist/server/handlers.js +11 -0
- package/package.json +3 -3
|
@@ -0,0 +1,1107 @@
|
|
|
1
|
+
import type { Agent } from '@mastra/core/agent';
|
|
2
|
+
import type { AgentCard } from '@mastra/core/a2a';
|
|
3
|
+
import type { AgentNetwork } from '@mastra/core/network';
|
|
4
|
+
import type { Artifact } from '@mastra/core/a2a';
|
|
5
|
+
import type { BaseLogMessage } from '@mastra/core/logger';
|
|
6
|
+
import { CoreMessage } from 'ai';
|
|
7
|
+
import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
|
|
8
|
+
import { DefaultEngineType } from '@mastra/core';
|
|
9
|
+
import { EvalRow } from '@mastra/core';
|
|
10
|
+
import { GenerateObjectResult } from 'ai';
|
|
11
|
+
import { GenerateTextResult } from 'ai';
|
|
12
|
+
import type { IMastraLogger } from '@mastra/core/logger';
|
|
13
|
+
import type { JSONRPCError } from '@mastra/core/a2a';
|
|
14
|
+
import { JSONRPCResponse } from '@mastra/core/a2a';
|
|
15
|
+
import { LegacyStep } from '@mastra/core/workflows/legacy';
|
|
16
|
+
import type { LegacyWorkflow } from '@mastra/core/workflows/legacy';
|
|
17
|
+
import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
|
|
18
|
+
import type { LegacyWorkflowRuns } from '@mastra/core/storage';
|
|
19
|
+
import type { LogLevel } from '@mastra/core/logger';
|
|
20
|
+
import type { Mastra } from '@mastra/core/mastra';
|
|
21
|
+
import type { MastraError } from '@mastra/core/error';
|
|
22
|
+
import type { MastraMemory } from '@mastra/core/memory';
|
|
23
|
+
import { MastraMessageV1 } from '@mastra/core';
|
|
24
|
+
import type { Message } from '@mastra/core/a2a';
|
|
25
|
+
import type { QueryResult } from '@mastra/core/vector';
|
|
26
|
+
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
27
|
+
import { ReadableStream as ReadableStream_3 } from 'stream/web';
|
|
28
|
+
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
29
|
+
import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
|
|
30
|
+
import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
|
|
31
|
+
import { Step } from '@mastra/core';
|
|
32
|
+
import { StepExecutionContext } from '@mastra/core/workflows/legacy';
|
|
33
|
+
import { StepGraph } from '@mastra/core/workflows/legacy';
|
|
34
|
+
import { StepResult } from '@mastra/core';
|
|
35
|
+
import { StorageThreadType } from '@mastra/core';
|
|
36
|
+
import { StreamEvent } from '@mastra/core';
|
|
37
|
+
import { Task } from '@mastra/core/a2a';
|
|
38
|
+
import { TaskAndHistory } from '@mastra/core/a2a';
|
|
39
|
+
import type { TaskContext } from '@mastra/core/a2a';
|
|
40
|
+
import type { TaskIdParams } from '@mastra/core/a2a';
|
|
41
|
+
import type { TaskQueryParams } from '@mastra/core/a2a';
|
|
42
|
+
import type { TaskSendParams } from '@mastra/core/a2a';
|
|
43
|
+
import type { TaskStatus } from '@mastra/core/a2a';
|
|
44
|
+
import type { ToolAction } from '@mastra/core/tools';
|
|
45
|
+
import { UIMessage } from 'ai';
|
|
46
|
+
import type { VercelTool } from '@mastra/core/tools';
|
|
47
|
+
import type { WatchEvent } from '@mastra/core/workflows';
|
|
48
|
+
import type { Workflow } from '@mastra/core/workflows';
|
|
49
|
+
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
|
|
50
|
+
import { WorkflowResult } from '@mastra/core';
|
|
51
|
+
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
52
|
+
import { WorkingMemoryTemplate } from '@mastra/core';
|
|
53
|
+
import { ZodBoolean } from 'zod';
|
|
54
|
+
import { ZodEnum } from 'zod';
|
|
55
|
+
import { ZodNumber } from 'zod';
|
|
56
|
+
import { ZodObject } from 'zod';
|
|
57
|
+
import { ZodOptional } from 'zod';
|
|
58
|
+
import { ZodString } from 'zod';
|
|
59
|
+
import { ZodType } from 'zod';
|
|
60
|
+
import { ZodTypeAny } from 'zod';
|
|
61
|
+
import { ZodTypeDef } from 'zod';
|
|
62
|
+
|
|
63
|
+
export declare namespace a2a {
|
|
64
|
+
export {
|
|
65
|
+
getAgentCardByIdHandler,
|
|
66
|
+
handleTaskSend,
|
|
67
|
+
handleTaskGet,
|
|
68
|
+
handleTaskSendSubscribe,
|
|
69
|
+
handleTaskCancel,
|
|
70
|
+
getAgentExecutionHandler
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export declare namespace agents {
|
|
75
|
+
export {
|
|
76
|
+
getAgentsHandler,
|
|
77
|
+
getAgentByIdHandler,
|
|
78
|
+
getEvalsByAgentIdHandler,
|
|
79
|
+
getLiveEvalsByAgentIdHandler,
|
|
80
|
+
generateHandler,
|
|
81
|
+
streamGenerateHandler
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export declare interface ApiError extends MastraError {
|
|
86
|
+
message: string;
|
|
87
|
+
status?: number;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
|
|
91
|
+
|
|
92
|
+
export declare function cancelWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
93
|
+
message: string;
|
|
94
|
+
}>;
|
|
95
|
+
|
|
96
|
+
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;
|
|
97
|
+
|
|
98
|
+
export declare interface Context {
|
|
99
|
+
mastra: Mastra;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export declare function convertToCoreMessage(message: Message): CoreMessage_2;
|
|
103
|
+
|
|
104
|
+
export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
|
|
105
|
+
|
|
106
|
+
export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
|
|
107
|
+
index: CreateIndexRequest;
|
|
108
|
+
}): Promise<{
|
|
109
|
+
success: boolean;
|
|
110
|
+
}>;
|
|
111
|
+
|
|
112
|
+
declare interface CreateIndexRequest {
|
|
113
|
+
indexName: string;
|
|
114
|
+
dimension: number;
|
|
115
|
+
metric?: 'cosine' | 'euclidean' | 'dotproduct';
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export declare function createLegacyWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
119
|
+
runId: string;
|
|
120
|
+
}>;
|
|
121
|
+
|
|
122
|
+
export declare function createSuccessResponse<T>(id: number | string | null, result: T): JSONRPCResponse<T>;
|
|
123
|
+
|
|
124
|
+
export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
|
|
125
|
+
task: Task;
|
|
126
|
+
userMessage: Message;
|
|
127
|
+
history: Message[];
|
|
128
|
+
activeCancellations: Set<string>;
|
|
129
|
+
}): TaskContext;
|
|
130
|
+
|
|
131
|
+
export declare function createThreadHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
|
|
132
|
+
body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
|
|
133
|
+
resourceId?: string;
|
|
134
|
+
};
|
|
135
|
+
}): Promise<StorageThreadType>;
|
|
136
|
+
|
|
137
|
+
export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
138
|
+
runId: string;
|
|
139
|
+
}>;
|
|
140
|
+
|
|
141
|
+
export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
|
|
142
|
+
indexName?: string;
|
|
143
|
+
}): Promise<{
|
|
144
|
+
success: boolean;
|
|
145
|
+
}>;
|
|
146
|
+
|
|
147
|
+
export declare function deleteThreadHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
148
|
+
result: string;
|
|
149
|
+
}>;
|
|
150
|
+
|
|
151
|
+
declare type DeprecatedStatusCode = 305 | 306;
|
|
152
|
+
|
|
153
|
+
export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
|
|
154
|
+
indexName?: string;
|
|
155
|
+
}): Promise<{
|
|
156
|
+
dimension: number;
|
|
157
|
+
count: number;
|
|
158
|
+
metric: string | undefined;
|
|
159
|
+
}>;
|
|
160
|
+
|
|
161
|
+
export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
|
|
162
|
+
agentId?: string;
|
|
163
|
+
data: any;
|
|
164
|
+
runtimeContext: RuntimeContext_2;
|
|
165
|
+
}): Promise<any>;
|
|
166
|
+
|
|
167
|
+
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
|
|
168
|
+
data?: unknown;
|
|
169
|
+
runtimeContext: RuntimeContext_2;
|
|
170
|
+
}) => Promise<any>;
|
|
171
|
+
|
|
172
|
+
export declare function generateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
|
|
173
|
+
runtimeContext: RuntimeContext;
|
|
174
|
+
agentId: string;
|
|
175
|
+
body: GetBody<'generate'> & {
|
|
176
|
+
resourceid?: string;
|
|
177
|
+
runtimeContext?: Record<string, unknown>;
|
|
178
|
+
};
|
|
179
|
+
abortSignal?: AbortSignal;
|
|
180
|
+
}): Promise<GenerateTextResult<any, unknown>>;
|
|
181
|
+
|
|
182
|
+
export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
|
|
183
|
+
runtimeContext: RuntimeContext;
|
|
184
|
+
body: {
|
|
185
|
+
messages?: Parameters<AgentNetwork['generate']>[0];
|
|
186
|
+
} & Parameters<AgentNetwork['generate']>[1];
|
|
187
|
+
}): Promise<GenerateObjectResult<any>>;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Generate speech from text
|
|
191
|
+
*/
|
|
192
|
+
export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceContext & {
|
|
193
|
+
body?: {
|
|
194
|
+
text?: string;
|
|
195
|
+
speakerId?: string;
|
|
196
|
+
};
|
|
197
|
+
}): Promise<NodeJS.ReadableStream>;
|
|
198
|
+
|
|
199
|
+
export declare function generateVNextNetworkHandler({ mastra, runtimeContext, networkId, body, }: NetworkContext_2 & {
|
|
200
|
+
runtimeContext: RuntimeContext;
|
|
201
|
+
body: {
|
|
202
|
+
message: string;
|
|
203
|
+
threadId?: string;
|
|
204
|
+
resourceId?: string;
|
|
205
|
+
};
|
|
206
|
+
}): Promise<{
|
|
207
|
+
task: string;
|
|
208
|
+
result: string;
|
|
209
|
+
resourceId: string;
|
|
210
|
+
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
211
|
+
}>;
|
|
212
|
+
|
|
213
|
+
export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, isPlayground, }: Context & {
|
|
214
|
+
isPlayground?: boolean;
|
|
215
|
+
runtimeContext: RuntimeContext;
|
|
216
|
+
agentId: string;
|
|
217
|
+
}): Promise<{
|
|
218
|
+
name: any;
|
|
219
|
+
instructions: string;
|
|
220
|
+
tools: any;
|
|
221
|
+
workflows: {};
|
|
222
|
+
provider: string;
|
|
223
|
+
modelId: string;
|
|
224
|
+
defaultGenerateOptions: any;
|
|
225
|
+
defaultStreamOptions: any;
|
|
226
|
+
}>;
|
|
227
|
+
|
|
228
|
+
export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
|
|
229
|
+
runtimeContext: RuntimeContext;
|
|
230
|
+
agentId: keyof ReturnType<typeof mastra.getAgents>;
|
|
231
|
+
executionUrl?: string;
|
|
232
|
+
version?: string;
|
|
233
|
+
provider?: {
|
|
234
|
+
organization: string;
|
|
235
|
+
url: string;
|
|
236
|
+
};
|
|
237
|
+
}): Promise<AgentCard>;
|
|
238
|
+
|
|
239
|
+
export declare function getAgentExecutionHandler({ requestId, mastra, agentId, runtimeContext, method, params, taskStore, logger, }: Context & {
|
|
240
|
+
requestId: string;
|
|
241
|
+
runtimeContext: RuntimeContext;
|
|
242
|
+
agentId: string;
|
|
243
|
+
method: 'tasks/send' | 'tasks/sendSubscribe' | 'tasks/get' | 'tasks/cancel';
|
|
244
|
+
params: TaskSendParams | TaskQueryParams | TaskIdParams;
|
|
245
|
+
taskStore?: InMemoryTaskStore;
|
|
246
|
+
logger?: IMastraLogger;
|
|
247
|
+
}): Promise<any>;
|
|
248
|
+
|
|
249
|
+
export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
|
|
250
|
+
runtimeContext: RuntimeContext;
|
|
251
|
+
}): Promise<Record<string, Omit<{
|
|
252
|
+
id: string;
|
|
253
|
+
name: any;
|
|
254
|
+
instructions: string;
|
|
255
|
+
tools: any;
|
|
256
|
+
workflows: {};
|
|
257
|
+
provider: string;
|
|
258
|
+
modelId: string;
|
|
259
|
+
defaultGenerateOptions: any;
|
|
260
|
+
defaultStreamOptions: any;
|
|
261
|
+
}, "id">>>;
|
|
262
|
+
|
|
263
|
+
declare type GetBody<T extends keyof Agent & {
|
|
264
|
+
[K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
|
|
265
|
+
}[keyof Agent]> = {
|
|
266
|
+
messages: Parameters<Agent[T]>[0];
|
|
267
|
+
} & Parameters<Agent[T]>[1];
|
|
268
|
+
|
|
269
|
+
export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
270
|
+
runtimeContext: RuntimeContext;
|
|
271
|
+
agentId: string;
|
|
272
|
+
}): Promise<{
|
|
273
|
+
id: string;
|
|
274
|
+
name: any;
|
|
275
|
+
instructions: string;
|
|
276
|
+
evals: EvalRow[];
|
|
277
|
+
}>;
|
|
278
|
+
|
|
279
|
+
export declare function getLegacyWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
|
|
280
|
+
stepGraph: StepGraph;
|
|
281
|
+
stepSubscriberGraph: Record<string, StepGraph>;
|
|
282
|
+
serializedStepGraph: StepGraph;
|
|
283
|
+
serializedStepSubscriberGraph: Record<string, StepGraph>;
|
|
284
|
+
name: string;
|
|
285
|
+
triggerSchema: string | undefined;
|
|
286
|
+
steps: any;
|
|
287
|
+
}>;
|
|
288
|
+
|
|
289
|
+
export declare function getLegacyWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<LegacyWorkflow['getRun']>>;
|
|
290
|
+
|
|
291
|
+
export declare function getLegacyWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
|
|
292
|
+
fromDate?: Date;
|
|
293
|
+
toDate?: Date;
|
|
294
|
+
limit?: number;
|
|
295
|
+
offset?: number;
|
|
296
|
+
resourceId?: string;
|
|
297
|
+
}): Promise<LegacyWorkflowRuns>;
|
|
298
|
+
|
|
299
|
+
export declare function getLegacyWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Get available listeners for an agent
|
|
303
|
+
*/
|
|
304
|
+
export declare function getListenerHandler({ mastra, agentId }: VoiceContext): Promise<{
|
|
305
|
+
enabled: boolean;
|
|
306
|
+
}>;
|
|
307
|
+
|
|
308
|
+
export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
309
|
+
runtimeContext: RuntimeContext;
|
|
310
|
+
agentId: string;
|
|
311
|
+
}): Promise<{
|
|
312
|
+
id: string;
|
|
313
|
+
name: any;
|
|
314
|
+
instructions: string;
|
|
315
|
+
evals: EvalRow[];
|
|
316
|
+
}>;
|
|
317
|
+
|
|
318
|
+
export declare function getLogsByRunIdHandler({ mastra, runId, transportId, params, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId' | 'params'>): Promise<{
|
|
319
|
+
logs: BaseLogMessage[];
|
|
320
|
+
total: number;
|
|
321
|
+
page: number;
|
|
322
|
+
perPage: number;
|
|
323
|
+
hasMore: boolean;
|
|
324
|
+
}>;
|
|
325
|
+
|
|
326
|
+
export declare function getLogsHandler({ mastra, transportId, params, }: Pick<LogsContext, 'mastra' | 'transportId' | 'params'>): Promise<{
|
|
327
|
+
logs: BaseLogMessage[];
|
|
328
|
+
total: number;
|
|
329
|
+
page: number;
|
|
330
|
+
perPage: number;
|
|
331
|
+
hasMore: boolean;
|
|
332
|
+
}>;
|
|
333
|
+
|
|
334
|
+
export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
|
|
335
|
+
transports: string[];
|
|
336
|
+
}>;
|
|
337
|
+
|
|
338
|
+
export declare function getMemoryStatusHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
339
|
+
result: boolean;
|
|
340
|
+
}>;
|
|
341
|
+
|
|
342
|
+
export declare function getMessagesHandler({ mastra, agentId, threadId, limit, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
|
|
343
|
+
limit?: number;
|
|
344
|
+
}): Promise<{
|
|
345
|
+
messages: CoreMessage[];
|
|
346
|
+
uiMessages: UIMessage[];
|
|
347
|
+
}>;
|
|
348
|
+
|
|
349
|
+
export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
350
|
+
id: string;
|
|
351
|
+
name: string;
|
|
352
|
+
instructions: string;
|
|
353
|
+
agents: {
|
|
354
|
+
name: string;
|
|
355
|
+
provider: string;
|
|
356
|
+
modelId: string;
|
|
357
|
+
}[];
|
|
358
|
+
routingModel: {
|
|
359
|
+
provider: string;
|
|
360
|
+
modelId: string;
|
|
361
|
+
};
|
|
362
|
+
}>;
|
|
363
|
+
|
|
364
|
+
export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
|
|
365
|
+
id: string;
|
|
366
|
+
name: string;
|
|
367
|
+
instructions: string;
|
|
368
|
+
agents: {
|
|
369
|
+
name: string;
|
|
370
|
+
provider: string;
|
|
371
|
+
modelId: string;
|
|
372
|
+
}[];
|
|
373
|
+
routingModel: {
|
|
374
|
+
provider: string;
|
|
375
|
+
modelId: string;
|
|
376
|
+
};
|
|
377
|
+
}[]>;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Get available speakers for an agent
|
|
381
|
+
*/
|
|
382
|
+
export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): Promise<{
|
|
383
|
+
voiceId: string;
|
|
384
|
+
}[]>;
|
|
385
|
+
|
|
386
|
+
export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<any[]>;
|
|
387
|
+
|
|
388
|
+
export declare function getThreadByIdHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType>;
|
|
389
|
+
|
|
390
|
+
export declare function getThreadsHandler({ mastra, agentId, resourceId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType[]>;
|
|
391
|
+
|
|
392
|
+
export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext, 'tools' | 'toolId'>): Promise<any>;
|
|
393
|
+
|
|
394
|
+
export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
|
|
395
|
+
|
|
396
|
+
export declare function getVNextNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
397
|
+
id: string;
|
|
398
|
+
name: string;
|
|
399
|
+
instructions: string;
|
|
400
|
+
agents: {
|
|
401
|
+
name: string;
|
|
402
|
+
provider: string;
|
|
403
|
+
modelId: string;
|
|
404
|
+
}[];
|
|
405
|
+
workflows: {
|
|
406
|
+
name: string | undefined;
|
|
407
|
+
description: string | undefined;
|
|
408
|
+
inputSchema: string | undefined;
|
|
409
|
+
outputSchema: string | undefined;
|
|
410
|
+
}[];
|
|
411
|
+
tools: {
|
|
412
|
+
id: string;
|
|
413
|
+
description: string;
|
|
414
|
+
}[];
|
|
415
|
+
routingModel: {
|
|
416
|
+
provider: string;
|
|
417
|
+
modelId: string;
|
|
418
|
+
};
|
|
419
|
+
}>;
|
|
420
|
+
|
|
421
|
+
export declare function getVNextNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'runtimeContext'>): Promise<{
|
|
422
|
+
id: string;
|
|
423
|
+
name: string;
|
|
424
|
+
instructions: string;
|
|
425
|
+
tools: {
|
|
426
|
+
id: string;
|
|
427
|
+
description: string;
|
|
428
|
+
}[];
|
|
429
|
+
agents: {
|
|
430
|
+
name: string;
|
|
431
|
+
provider: string;
|
|
432
|
+
modelId: string;
|
|
433
|
+
}[];
|
|
434
|
+
workflows: {
|
|
435
|
+
name: string | undefined;
|
|
436
|
+
description: string | undefined;
|
|
437
|
+
inputSchema: string | undefined;
|
|
438
|
+
outputSchema: string | undefined;
|
|
439
|
+
}[];
|
|
440
|
+
routingModel: {
|
|
441
|
+
provider: string;
|
|
442
|
+
modelId: string;
|
|
443
|
+
};
|
|
444
|
+
}[]>;
|
|
445
|
+
|
|
446
|
+
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
|
|
447
|
+
steps: Record<string, SerializedStep>;
|
|
448
|
+
allSteps: Record<string, SerializedStep>;
|
|
449
|
+
name: string | undefined;
|
|
450
|
+
description: string | undefined;
|
|
451
|
+
stepGraph: SerializedStepFlowEntry[];
|
|
452
|
+
inputSchema: string | undefined;
|
|
453
|
+
outputSchema: string | undefined;
|
|
454
|
+
}>;
|
|
455
|
+
|
|
456
|
+
export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
|
|
457
|
+
|
|
458
|
+
export declare function getWorkflowRunExecutionResultHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<WatchEvent['payload']['workflowState']>;
|
|
459
|
+
|
|
460
|
+
export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
|
|
461
|
+
fromDate?: Date;
|
|
462
|
+
toDate?: Date;
|
|
463
|
+
limit?: number;
|
|
464
|
+
offset?: number;
|
|
465
|
+
resourceId?: string;
|
|
466
|
+
}): Promise<WorkflowRuns>;
|
|
467
|
+
|
|
468
|
+
export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Handler to get the working memory for a thread (optionally resource-scoped).
|
|
472
|
+
* @returns workingMemory - the working memory for the thread
|
|
473
|
+
* @returns source - thread or resource
|
|
474
|
+
*/
|
|
475
|
+
export declare function getWorkingMemoryHandler({ mastra, agentId, threadId, resourceId, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
|
|
476
|
+
resourceId?: Parameters<MastraMemory['getWorkingMemory']>[0]['resourceId'];
|
|
477
|
+
memoryConfig?: Parameters<MastraMemory['getWorkingMemory']>[0]['memoryConfig'];
|
|
478
|
+
}): Promise<{
|
|
479
|
+
workingMemory: string | null;
|
|
480
|
+
source: string;
|
|
481
|
+
workingMemoryTemplate: WorkingMemoryTemplate | null;
|
|
482
|
+
threadExists: boolean;
|
|
483
|
+
}>;
|
|
484
|
+
|
|
485
|
+
export declare function handleError(error: unknown, defaultMessage: string): never;
|
|
486
|
+
|
|
487
|
+
export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
|
|
488
|
+
requestId: string;
|
|
489
|
+
taskStore: InMemoryTaskStore;
|
|
490
|
+
agentId: string;
|
|
491
|
+
taskId: string;
|
|
492
|
+
logger?: IMastraLogger;
|
|
493
|
+
}): Promise<JSONRPCResponse<Task, unknown>>;
|
|
494
|
+
|
|
495
|
+
export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
|
|
496
|
+
requestId: string;
|
|
497
|
+
taskStore: InMemoryTaskStore;
|
|
498
|
+
agentId: string;
|
|
499
|
+
taskId: string;
|
|
500
|
+
}): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
|
|
501
|
+
|
|
502
|
+
export declare function handleTaskSend({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
|
|
503
|
+
requestId: string;
|
|
504
|
+
params: TaskSendParams;
|
|
505
|
+
taskStore: InMemoryTaskStore;
|
|
506
|
+
agent: Agent;
|
|
507
|
+
agentId: string;
|
|
508
|
+
logger?: IMastraLogger;
|
|
509
|
+
runtimeContext: RuntimeContext;
|
|
510
|
+
}): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
|
|
511
|
+
|
|
512
|
+
export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
|
|
513
|
+
requestId: string;
|
|
514
|
+
params: TaskSendParams;
|
|
515
|
+
taskStore: InMemoryTaskStore;
|
|
516
|
+
agent: Agent;
|
|
517
|
+
agentId: string;
|
|
518
|
+
logger?: IMastraLogger;
|
|
519
|
+
runtimeContext: RuntimeContext;
|
|
520
|
+
}): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
|
|
521
|
+
state: string;
|
|
522
|
+
message: {
|
|
523
|
+
role: string;
|
|
524
|
+
parts: {
|
|
525
|
+
type: string;
|
|
526
|
+
text: string;
|
|
527
|
+
}[];
|
|
528
|
+
};
|
|
529
|
+
}, unknown>, void, unknown>;
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* `HTTPException` must be used when a fatal error such as authentication failure occurs.
|
|
533
|
+
*
|
|
534
|
+
* @see {@link https://hono.dev/docs/api/exception}
|
|
535
|
+
*
|
|
536
|
+
* @param {StatusCode} status - status code of HTTPException
|
|
537
|
+
* @param {HTTPExceptionOptions} options - options of HTTPException
|
|
538
|
+
* @param {HTTPExceptionOptions["res"]} options.res - response of options of HTTPException
|
|
539
|
+
* @param {HTTPExceptionOptions["message"]} options.message - message of options of HTTPException
|
|
540
|
+
* @param {HTTPExceptionOptions["cause"]} options.cause - cause of options of HTTPException
|
|
541
|
+
*
|
|
542
|
+
* @example
|
|
543
|
+
* ```ts
|
|
544
|
+
* import { HTTPException } from 'hono/http-exception'
|
|
545
|
+
*
|
|
546
|
+
* // ...
|
|
547
|
+
*
|
|
548
|
+
* app.post('/auth', async (c, next) => {
|
|
549
|
+
* // authentication
|
|
550
|
+
* if (authorized === false) {
|
|
551
|
+
* throw new HTTPException(401, { message: 'Custom error message' })
|
|
552
|
+
* }
|
|
553
|
+
* await next()
|
|
554
|
+
* })
|
|
555
|
+
* ```
|
|
556
|
+
*/
|
|
557
|
+
export declare class HTTPException extends Error {
|
|
558
|
+
readonly res?: Response;
|
|
559
|
+
readonly status: StatusCode;
|
|
560
|
+
/**
|
|
561
|
+
* Creates an instance of `HTTPException`.
|
|
562
|
+
* @param status - HTTP status code for the exception. Defaults to 500.
|
|
563
|
+
* @param options - Additional options for the exception.
|
|
564
|
+
*/
|
|
565
|
+
constructor(status?: StatusCode, options?: HTTPExceptionOptions);
|
|
566
|
+
/**
|
|
567
|
+
* Returns the response object associated with the exception.
|
|
568
|
+
* If a response object is not provided, a new response is created with the error message and status code.
|
|
569
|
+
* @returns The response object.
|
|
570
|
+
*/
|
|
571
|
+
getResponse(): Response;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Options for creating an `HTTPException`.
|
|
576
|
+
* @property res - Optional response object to use.
|
|
577
|
+
* @property message - Optional custom error message.
|
|
578
|
+
* @property cause - Optional cause of the error.
|
|
579
|
+
* @property stack - Optional stack trace for the error.
|
|
580
|
+
*/
|
|
581
|
+
declare type HTTPExceptionOptions = {
|
|
582
|
+
res?: Response;
|
|
583
|
+
message?: string;
|
|
584
|
+
cause?: unknown;
|
|
585
|
+
stack?: string;
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* @module
|
|
590
|
+
* This module provides the `HTTPException` class.
|
|
591
|
+
*/
|
|
592
|
+
declare type InfoStatusCode = 100 | 101 | 102 | 103;
|
|
593
|
+
|
|
594
|
+
export declare class InMemoryTaskStore {
|
|
595
|
+
private store;
|
|
596
|
+
activeCancellations: Set<string>;
|
|
597
|
+
load({ agentId, taskId }: {
|
|
598
|
+
agentId: string;
|
|
599
|
+
taskId: string;
|
|
600
|
+
}): Promise<TaskAndHistory | null>;
|
|
601
|
+
save({ agentId, data }: {
|
|
602
|
+
agentId: string;
|
|
603
|
+
data: TaskAndHistory;
|
|
604
|
+
}): Promise<void>;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
export declare namespace legacyWorkflows {
|
|
608
|
+
export {
|
|
609
|
+
getLegacyWorkflowsHandler,
|
|
610
|
+
getLegacyWorkflowByIdHandler,
|
|
611
|
+
startAsyncLegacyWorkflowHandler,
|
|
612
|
+
getLegacyWorkflowRunHandler,
|
|
613
|
+
createLegacyWorkflowRunHandler,
|
|
614
|
+
startLegacyWorkflowRunHandler,
|
|
615
|
+
watchLegacyWorkflowHandler,
|
|
616
|
+
resumeAsyncLegacyWorkflowHandler,
|
|
617
|
+
resumeLegacyWorkflowHandler,
|
|
618
|
+
getLegacyWorkflowRunsHandler
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
|
|
623
|
+
|
|
624
|
+
export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
|
|
625
|
+
agentId: string;
|
|
626
|
+
taskId: string;
|
|
627
|
+
taskStore: InMemoryTaskStore;
|
|
628
|
+
message: Message;
|
|
629
|
+
sessionId?: string | null;
|
|
630
|
+
metadata?: Record<string, unknown> | null;
|
|
631
|
+
logger?: IMastraLogger;
|
|
632
|
+
}): Promise<TaskAndHistory>;
|
|
633
|
+
|
|
634
|
+
export declare namespace logs {
|
|
635
|
+
export {
|
|
636
|
+
getLogsHandler,
|
|
637
|
+
getLogsByRunIdHandler,
|
|
638
|
+
getLogTransports
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
declare type LogsContext = {
|
|
643
|
+
mastra: Mastra;
|
|
644
|
+
transportId?: string;
|
|
645
|
+
runId?: string;
|
|
646
|
+
params?: {
|
|
647
|
+
fromDate?: Date;
|
|
648
|
+
toDate?: Date;
|
|
649
|
+
logLevel?: LogLevel;
|
|
650
|
+
filters?: string | string[];
|
|
651
|
+
page?: number;
|
|
652
|
+
perPage?: number;
|
|
653
|
+
};
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
export declare function loopStreamVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
|
|
657
|
+
runtimeContext: RuntimeContext;
|
|
658
|
+
body: {
|
|
659
|
+
message: string;
|
|
660
|
+
threadId?: string;
|
|
661
|
+
resourceId?: string;
|
|
662
|
+
maxIterations?: number;
|
|
663
|
+
};
|
|
664
|
+
}): Promise<{
|
|
665
|
+
stream: ReadableStream_3<StreamEvent>;
|
|
666
|
+
getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
|
|
667
|
+
task: ZodString;
|
|
668
|
+
resourceId: ZodString;
|
|
669
|
+
resourceType: ZodEnum<["agent", "workflow", "none", "tool", "none"]>;
|
|
670
|
+
prompt: ZodString;
|
|
671
|
+
result: ZodString;
|
|
672
|
+
isComplete: ZodOptional<ZodBoolean>;
|
|
673
|
+
completionReason: ZodOptional<ZodString>;
|
|
674
|
+
iteration: ZodNumber;
|
|
675
|
+
}, "strip", ZodTypeAny, {
|
|
676
|
+
prompt: string;
|
|
677
|
+
resourceId: string;
|
|
678
|
+
result: string;
|
|
679
|
+
task: string;
|
|
680
|
+
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
681
|
+
iteration: number;
|
|
682
|
+
isComplete?: boolean | undefined;
|
|
683
|
+
completionReason?: string | undefined;
|
|
684
|
+
}, {
|
|
685
|
+
prompt: string;
|
|
686
|
+
resourceId: string;
|
|
687
|
+
result: string;
|
|
688
|
+
task: string;
|
|
689
|
+
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
690
|
+
iteration: number;
|
|
691
|
+
isComplete?: boolean | undefined;
|
|
692
|
+
completionReason?: string | undefined;
|
|
693
|
+
}>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
|
|
694
|
+
}>;
|
|
695
|
+
|
|
696
|
+
export declare function loopVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
|
|
697
|
+
runtimeContext: RuntimeContext;
|
|
698
|
+
body: {
|
|
699
|
+
message: string;
|
|
700
|
+
};
|
|
701
|
+
}): Promise<{
|
|
702
|
+
status: "success";
|
|
703
|
+
result: {
|
|
704
|
+
text: string;
|
|
705
|
+
iteration: number;
|
|
706
|
+
};
|
|
707
|
+
steps: {
|
|
708
|
+
[x: string]: StepResult<any, any, any, any> | StepResult<unknown, unknown, unknown, unknown>;
|
|
709
|
+
};
|
|
710
|
+
}>;
|
|
711
|
+
|
|
712
|
+
export declare namespace memory {
|
|
713
|
+
export {
|
|
714
|
+
getMemoryStatusHandler,
|
|
715
|
+
getThreadsHandler,
|
|
716
|
+
getThreadByIdHandler,
|
|
717
|
+
saveMessagesHandler,
|
|
718
|
+
createThreadHandler,
|
|
719
|
+
updateThreadHandler,
|
|
720
|
+
deleteThreadHandler,
|
|
721
|
+
getMessagesHandler,
|
|
722
|
+
getWorkingMemoryHandler,
|
|
723
|
+
updateWorkingMemoryHandler
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
declare interface MemoryContext extends Context {
|
|
728
|
+
agentId?: string;
|
|
729
|
+
resourceId?: string;
|
|
730
|
+
threadId?: string;
|
|
731
|
+
networkId?: string;
|
|
732
|
+
runtimeContext?: RuntimeContext_2;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
export declare namespace network {
|
|
736
|
+
export {
|
|
737
|
+
getNetworksHandler,
|
|
738
|
+
getNetworkByIdHandler,
|
|
739
|
+
generateHandler_alias_1 as generateHandler,
|
|
740
|
+
streamGenerateHandler_alias_1 as streamGenerateHandler
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
declare interface NetworkContext extends Context {
|
|
745
|
+
networkId?: string;
|
|
746
|
+
runtimeContext: RuntimeContext;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
declare interface NetworkContext_2 extends Context {
|
|
750
|
+
networkId?: string;
|
|
751
|
+
runtimeContext: RuntimeContext;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
|
|
755
|
+
|
|
756
|
+
declare interface QueryRequest {
|
|
757
|
+
indexName: string;
|
|
758
|
+
queryVector: number[];
|
|
759
|
+
topK?: number;
|
|
760
|
+
filter?: Record<string, any>;
|
|
761
|
+
includeVector?: boolean;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
export declare function queryVectors({ mastra, vectorName, query, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
|
|
765
|
+
query: QueryRequest;
|
|
766
|
+
}): Promise<QueryResult[]>;
|
|
767
|
+
|
|
768
|
+
declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
|
|
769
|
+
|
|
770
|
+
export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
771
|
+
body: {
|
|
772
|
+
stepId: string;
|
|
773
|
+
context: any;
|
|
774
|
+
};
|
|
775
|
+
runtimeContext: RuntimeContext;
|
|
776
|
+
}): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
|
|
777
|
+
|
|
778
|
+
export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
|
|
779
|
+
body: {
|
|
780
|
+
step: string | string[];
|
|
781
|
+
resumeData?: unknown;
|
|
782
|
+
};
|
|
783
|
+
runtimeContext?: RuntimeContext_2;
|
|
784
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
|
|
785
|
+
|
|
786
|
+
export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
787
|
+
body: {
|
|
788
|
+
stepId: string;
|
|
789
|
+
context: any;
|
|
790
|
+
};
|
|
791
|
+
runtimeContext: RuntimeContext;
|
|
792
|
+
}): Promise<{
|
|
793
|
+
message: string;
|
|
794
|
+
}>;
|
|
795
|
+
|
|
796
|
+
export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
|
|
797
|
+
body: {
|
|
798
|
+
step: string | string[];
|
|
799
|
+
resumeData?: unknown;
|
|
800
|
+
};
|
|
801
|
+
runtimeContext?: RuntimeContext_2;
|
|
802
|
+
}): Promise<{
|
|
803
|
+
message: string;
|
|
804
|
+
}>;
|
|
805
|
+
|
|
806
|
+
export declare function saveMessagesHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
|
|
807
|
+
body: {
|
|
808
|
+
messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
|
|
809
|
+
};
|
|
810
|
+
}): Promise<MastraMessageV1[]>;
|
|
811
|
+
|
|
812
|
+
export declare function sendWorkflowRunEventHandler({ mastra, workflowId, runId, event, data, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
813
|
+
event: string;
|
|
814
|
+
data: unknown;
|
|
815
|
+
}): Promise<{
|
|
816
|
+
message: string;
|
|
817
|
+
}>;
|
|
818
|
+
|
|
819
|
+
declare type SerializedStep = {
|
|
820
|
+
id: string;
|
|
821
|
+
description: string;
|
|
822
|
+
inputSchema: string | undefined;
|
|
823
|
+
outputSchema: string | undefined;
|
|
824
|
+
resumeSchema: string | undefined;
|
|
825
|
+
suspendSchema: string | undefined;
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
829
|
+
|
|
830
|
+
export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
831
|
+
triggerData?: unknown;
|
|
832
|
+
runtimeContext: RuntimeContext;
|
|
833
|
+
}): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
|
|
834
|
+
|
|
835
|
+
export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
836
|
+
inputData?: unknown;
|
|
837
|
+
runtimeContext?: RuntimeContext_2;
|
|
838
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
|
|
839
|
+
|
|
840
|
+
export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
841
|
+
triggerData?: unknown;
|
|
842
|
+
runtimeContext: RuntimeContext;
|
|
843
|
+
}): Promise<{
|
|
844
|
+
message: string;
|
|
845
|
+
}>;
|
|
846
|
+
|
|
847
|
+
export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
848
|
+
inputData?: unknown;
|
|
849
|
+
runtimeContext?: RuntimeContext_2;
|
|
850
|
+
}): Promise<{
|
|
851
|
+
message: string;
|
|
852
|
+
}>;
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* If you want to use an unofficial status, use `UnofficialStatusCode`.
|
|
856
|
+
*/
|
|
857
|
+
export declare type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | UnofficialStatusCode;
|
|
858
|
+
|
|
859
|
+
export declare function storeTelemetryHandler({ mastra, body }: Context & {
|
|
860
|
+
body: {
|
|
861
|
+
resourceSpans: any[];
|
|
862
|
+
};
|
|
863
|
+
}): Promise<{
|
|
864
|
+
status: string;
|
|
865
|
+
message: string;
|
|
866
|
+
error: any;
|
|
867
|
+
} | {
|
|
868
|
+
status: string;
|
|
869
|
+
message: string;
|
|
870
|
+
traceCount?: undefined;
|
|
871
|
+
} | {
|
|
872
|
+
status: string;
|
|
873
|
+
message: string;
|
|
874
|
+
traceCount: number;
|
|
875
|
+
}>;
|
|
876
|
+
|
|
877
|
+
export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
|
|
878
|
+
runtimeContext: RuntimeContext;
|
|
879
|
+
agentId: string;
|
|
880
|
+
body: GetBody<'stream'> & {
|
|
881
|
+
resourceid?: string;
|
|
882
|
+
runtimeContext?: string;
|
|
883
|
+
};
|
|
884
|
+
abortSignal?: AbortSignal;
|
|
885
|
+
}): Promise<Response | undefined>;
|
|
886
|
+
|
|
887
|
+
export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
|
|
888
|
+
runtimeContext: RuntimeContext;
|
|
889
|
+
body: {
|
|
890
|
+
messages?: Parameters<AgentNetwork['stream']>[0];
|
|
891
|
+
} & Parameters<AgentNetwork['stream']>[1];
|
|
892
|
+
}): Promise<Response>;
|
|
893
|
+
|
|
894
|
+
export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
|
|
895
|
+
runtimeContext: RuntimeContext;
|
|
896
|
+
body: {
|
|
897
|
+
message: string;
|
|
898
|
+
threadId?: string;
|
|
899
|
+
resourceId?: string;
|
|
900
|
+
};
|
|
901
|
+
}): Promise<{
|
|
902
|
+
stream: ReadableStream_3<StreamEvent>;
|
|
903
|
+
getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
|
|
904
|
+
task: ZodString;
|
|
905
|
+
resourceId: ZodString;
|
|
906
|
+
resourceType: ZodEnum<["agent", "workflow", "none", "tool", "none"]>;
|
|
907
|
+
prompt: ZodString;
|
|
908
|
+
result: ZodString;
|
|
909
|
+
isComplete: ZodOptional<ZodBoolean>;
|
|
910
|
+
completionReason: ZodOptional<ZodString>;
|
|
911
|
+
iteration: ZodNumber;
|
|
912
|
+
threadId: ZodOptional<ZodString>;
|
|
913
|
+
threadResourceId: ZodOptional<ZodString>;
|
|
914
|
+
isOneOff: ZodBoolean;
|
|
915
|
+
}, "strip", ZodTypeAny, {
|
|
916
|
+
prompt: string;
|
|
917
|
+
resourceId: string;
|
|
918
|
+
result: string;
|
|
919
|
+
task: string;
|
|
920
|
+
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
921
|
+
iteration: number;
|
|
922
|
+
isOneOff: boolean;
|
|
923
|
+
threadId?: string | undefined;
|
|
924
|
+
threadResourceId?: string | undefined;
|
|
925
|
+
isComplete?: boolean | undefined;
|
|
926
|
+
completionReason?: string | undefined;
|
|
927
|
+
}, {
|
|
928
|
+
prompt: string;
|
|
929
|
+
resourceId: string;
|
|
930
|
+
result: string;
|
|
931
|
+
task: string;
|
|
932
|
+
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
933
|
+
iteration: number;
|
|
934
|
+
isOneOff: boolean;
|
|
935
|
+
threadId?: string | undefined;
|
|
936
|
+
threadResourceId?: string | undefined;
|
|
937
|
+
isComplete?: boolean | undefined;
|
|
938
|
+
completionReason?: string | undefined;
|
|
939
|
+
}>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
|
|
940
|
+
}>;
|
|
941
|
+
|
|
942
|
+
export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
943
|
+
inputData?: unknown;
|
|
944
|
+
runtimeContext?: RuntimeContext_2;
|
|
945
|
+
}): Promise<{
|
|
946
|
+
stream: ReadableStream_2<StreamEvent>;
|
|
947
|
+
getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
|
|
948
|
+
}>;
|
|
949
|
+
|
|
950
|
+
declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
|
|
951
|
+
|
|
952
|
+
export declare namespace telemetry {
|
|
953
|
+
export {
|
|
954
|
+
getTelemetryHandler,
|
|
955
|
+
storeTelemetryHandler
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
declare interface TelemetryContext extends Context {
|
|
960
|
+
body?: {
|
|
961
|
+
name?: string;
|
|
962
|
+
scope?: string;
|
|
963
|
+
page?: number;
|
|
964
|
+
perPage?: number;
|
|
965
|
+
attribute?: string | string[];
|
|
966
|
+
fromDate?: Date;
|
|
967
|
+
toDate?: Date;
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
export declare namespace tools {
|
|
972
|
+
export {
|
|
973
|
+
getToolsHandler,
|
|
974
|
+
getToolByIdHandler,
|
|
975
|
+
executeToolHandler,
|
|
976
|
+
executeAgentToolHandler
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
declare interface ToolsContext extends Context {
|
|
981
|
+
tools?: Record<string, ToolAction | VercelTool>;
|
|
982
|
+
toolId?: string;
|
|
983
|
+
runId?: string;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Transcribe speech to text
|
|
988
|
+
*/
|
|
989
|
+
export declare function transcribeSpeechHandler({ mastra, agentId, body, }: VoiceContext & {
|
|
990
|
+
body?: {
|
|
991
|
+
audioData?: Buffer;
|
|
992
|
+
options?: Parameters<NonNullable<Agent['voice']>['listen']>[1];
|
|
993
|
+
};
|
|
994
|
+
}): Promise<{
|
|
995
|
+
text: string | void | NodeJS.ReadableStream;
|
|
996
|
+
}>;
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* @deprecated
|
|
1000
|
+
* Use `UnofficialStatusCode` instead.
|
|
1001
|
+
*/
|
|
1002
|
+
export declare type UnOfficalStatusCode = UnofficialStatusCode;
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* `UnofficialStatusCode` can be used to specify an unofficial status code.
|
|
1006
|
+
* @example
|
|
1007
|
+
*
|
|
1008
|
+
* ```ts
|
|
1009
|
+
* app.get('/unknown', (c) => {
|
|
1010
|
+
* return c.text("Unknown Error", 520 as UnofficialStatusCode)
|
|
1011
|
+
* })
|
|
1012
|
+
* ```
|
|
1013
|
+
*/
|
|
1014
|
+
export declare type UnofficialStatusCode = -1;
|
|
1015
|
+
|
|
1016
|
+
export declare function updateThreadHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
|
|
1017
|
+
body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
|
|
1018
|
+
}): Promise<StorageThreadType>;
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Handler to update the working memory for a thread (optionally resource-scoped).
|
|
1022
|
+
* @param threadId - the thread id
|
|
1023
|
+
* @param body - the body containing the working memory to update and the resource id (optional)
|
|
1024
|
+
*/
|
|
1025
|
+
export declare function updateWorkingMemoryHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
|
|
1026
|
+
body: Omit<Parameters<MastraMemory['updateWorkingMemory']>[0], 'threadId'>;
|
|
1027
|
+
}): Promise<{
|
|
1028
|
+
success: boolean;
|
|
1029
|
+
}>;
|
|
1030
|
+
|
|
1031
|
+
declare interface UpsertRequest {
|
|
1032
|
+
indexName: string;
|
|
1033
|
+
vectors: number[][];
|
|
1034
|
+
metadata?: Record<string, any>[];
|
|
1035
|
+
ids?: string[];
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
export declare function upsertVectors({ mastra, vectorName, index }: VectorContext & {
|
|
1039
|
+
index: UpsertRequest;
|
|
1040
|
+
}): Promise<{
|
|
1041
|
+
ids: string[];
|
|
1042
|
+
}>;
|
|
1043
|
+
|
|
1044
|
+
export declare function validateBody(body: Record<string, unknown>): void;
|
|
1045
|
+
|
|
1046
|
+
export declare namespace vector {
|
|
1047
|
+
export {
|
|
1048
|
+
upsertVectors,
|
|
1049
|
+
createIndex,
|
|
1050
|
+
queryVectors,
|
|
1051
|
+
listIndexes,
|
|
1052
|
+
describeIndex,
|
|
1053
|
+
deleteIndex
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
declare interface VectorContext extends Context {
|
|
1058
|
+
vectorName?: string;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
export declare namespace voice {
|
|
1062
|
+
export {
|
|
1063
|
+
getSpeakersHandler,
|
|
1064
|
+
generateSpeechHandler,
|
|
1065
|
+
transcribeSpeechHandler,
|
|
1066
|
+
getListenerHandler
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
declare interface VoiceContext extends Context {
|
|
1071
|
+
agentId?: string;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
1075
|
+
|
|
1076
|
+
export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
1077
|
+
|
|
1078
|
+
declare interface WorkflowContext extends Context {
|
|
1079
|
+
workflowId?: string;
|
|
1080
|
+
runId?: string;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
declare interface WorkflowContext_3 extends Context {
|
|
1084
|
+
workflowId?: string;
|
|
1085
|
+
runId?: string;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
export declare namespace workflows {
|
|
1089
|
+
export {
|
|
1090
|
+
getWorkflowsHandler,
|
|
1091
|
+
getWorkflowByIdHandler,
|
|
1092
|
+
getWorkflowRunByIdHandler,
|
|
1093
|
+
getWorkflowRunExecutionResultHandler,
|
|
1094
|
+
createWorkflowRunHandler,
|
|
1095
|
+
startAsyncWorkflowHandler,
|
|
1096
|
+
startWorkflowRunHandler,
|
|
1097
|
+
watchWorkflowHandler,
|
|
1098
|
+
streamWorkflowHandler,
|
|
1099
|
+
resumeAsyncWorkflowHandler,
|
|
1100
|
+
resumeWorkflowHandler,
|
|
1101
|
+
getWorkflowRunsHandler,
|
|
1102
|
+
cancelWorkflowRunHandler,
|
|
1103
|
+
sendWorkflowRunEventHandler
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
export { }
|