@mastra/server 0.0.0-fix-memory-xxhash-20250409202110 → 0.0.0-fix-generate-title-20250616171351
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{LICENSE → LICENSE.md} +3 -1
- package/README.md +48 -135
- package/dist/_tsup-dts-rollup.d.cts +357 -57
- package/dist/_tsup-dts-rollup.d.ts +357 -57
- package/dist/{chunk-YNSGUC2O.js → chunk-2HXKRRNS.js} +14 -8
- package/dist/chunk-4O23XCE5.js +262 -0
- package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
- package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
- package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
- package/dist/{chunk-2FJURXCL.cjs → chunk-6TJSHFCJ.cjs} +44 -36
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/chunk-ASKESBJW.cjs +2004 -0
- package/dist/{chunk-CWSDZEZG.cjs → chunk-B4MQFJ7G.cjs} +18 -12
- package/dist/{chunk-DVPP5S6I.js → chunk-BFOA2QQY.js} +14 -8
- package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
- package/dist/{chunk-2YONKUWB.js → chunk-C7564HUT.js} +58 -33
- package/dist/chunk-C75ZRJKD.cjs +270 -0
- package/dist/{chunk-ILW7XYNJ.js → chunk-CLYX4KLH.js} +85 -61
- package/dist/chunk-CMMOIUFC.cjs +114 -0
- package/dist/{chunk-3RVHWGWO.js → chunk-CP55EVBK.js} +26 -13
- package/dist/chunk-FRXZL32L.cjs +471 -0
- package/dist/chunk-GHC4YV6R.js +504 -0
- package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
- package/dist/{chunk-RBQASTUP.js → chunk-I7KJZNX5.js} +14 -6
- package/dist/chunk-IMBY5XUG.cjs +86 -0
- package/dist/chunk-JKTNRUKY.js +457 -0
- package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/{chunk-4C3EPMMF.cjs → chunk-NGURCFEJ.cjs} +31 -25
- package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
- package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
- package/dist/chunk-QLG2PFHE.js +81 -0
- package/dist/chunk-SDPGVWQJ.cjs +512 -0
- package/dist/chunk-TGJMNUYJ.js +2001 -0
- package/dist/chunk-VPNDC2DI.cjs +148 -0
- package/dist/chunk-WE32JG64.cjs +332 -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 +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 +8 -4
- package/dist/server/handlers/voice.d.cts +1 -0
- package/dist/server/handlers/voice.d.ts +1 -0
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +21 -13
- package/dist/server/handlers/workflows.d.cts +4 -2
- package/dist/server/handlers/workflows.d.ts +4 -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 +14 -13
- package/dist/chunk-2JQC6JWP.js +0 -46
- package/dist/chunk-5JOF627H.cjs +0 -123
- package/dist/chunk-A7DF4ETD.cjs +0 -100
- package/dist/chunk-BMA2ORRT.js +0 -152
- package/dist/chunk-GV52BII2.cjs +0 -160
- package/dist/chunk-QH6XWSXP.cjs +0 -5579
- package/dist/chunk-VB7KH62D.cjs +0 -51
- package/dist/chunk-VK6FX47H.js +0 -5576
- package/dist/chunk-X37I6GZT.cjs +0 -308
|
@@ -1,27 +1,63 @@
|
|
|
1
1
|
import type { Agent } from '@mastra/core/agent';
|
|
2
|
+
import type { AgentCard } from '@mastra/core/a2a';
|
|
2
3
|
import type { AgentNetwork } from '@mastra/core/network';
|
|
3
|
-
import {
|
|
4
|
+
import type { Artifact } from '@mastra/core/a2a';
|
|
5
|
+
import type { BaseLogMessage } from '@mastra/core/logger';
|
|
4
6
|
import { CoreMessage } from 'ai';
|
|
5
|
-
import {
|
|
7
|
+
import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
|
|
8
|
+
import { EvalRow } from '@mastra/core/storage';
|
|
6
9
|
import { GenerateObjectResult } from 'ai';
|
|
7
10
|
import { GenerateTextResult } from 'ai';
|
|
11
|
+
import type { IMastraLogger } from '@mastra/core/logger';
|
|
12
|
+
import type { JSONRPCError } from '@mastra/core/a2a';
|
|
13
|
+
import { JSONRPCResponse } from '@mastra/core/a2a';
|
|
14
|
+
import { LegacyStep } from '@mastra/core/workflows/legacy';
|
|
15
|
+
import type { LegacyWorkflow } from '@mastra/core/workflows/legacy';
|
|
16
|
+
import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
|
|
17
|
+
import type { LegacyWorkflowRuns } from '@mastra/core/storage';
|
|
18
|
+
import type { LogLevel } from '@mastra/core/logger';
|
|
8
19
|
import type { Mastra } from '@mastra/core/mastra';
|
|
9
|
-
import type { Mastra as Mastra_2 } from '@mastra/core';
|
|
10
20
|
import type { MastraMemory } from '@mastra/core/memory';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
21
|
+
import { MastraMessageV1 } from '@mastra/core/memory';
|
|
22
|
+
import type { Message } from '@mastra/core/a2a';
|
|
13
23
|
import type { QueryResult } from '@mastra/core/vector';
|
|
14
24
|
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
25
|
+
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
26
|
+
import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
|
|
27
|
+
import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
|
|
28
|
+
import { Step } from '@mastra/core/workflows';
|
|
29
|
+
import { StepExecutionContext } from '@mastra/core/workflows/legacy';
|
|
30
|
+
import { StepGraph } from '@mastra/core/workflows/legacy';
|
|
31
|
+
import { StorageThreadType } from '@mastra/core/memory';
|
|
32
|
+
import { StreamEvent } from '@mastra/core/workflows';
|
|
33
|
+
import { Task } from '@mastra/core/a2a';
|
|
34
|
+
import { TaskAndHistory } from '@mastra/core/a2a';
|
|
35
|
+
import type { TaskContext } from '@mastra/core/a2a';
|
|
36
|
+
import type { TaskIdParams } from '@mastra/core/a2a';
|
|
37
|
+
import type { TaskQueryParams } from '@mastra/core/a2a';
|
|
38
|
+
import type { TaskSendParams } from '@mastra/core/a2a';
|
|
39
|
+
import type { TaskStatus } from '@mastra/core/a2a';
|
|
19
40
|
import type { ToolAction } from '@mastra/core/tools';
|
|
41
|
+
import { UIMessage } from 'ai';
|
|
20
42
|
import type { VercelTool } from '@mastra/core/tools';
|
|
43
|
+
import type { WatchEvent } from '@mastra/core/workflows';
|
|
21
44
|
import type { Workflow } from '@mastra/core/workflows';
|
|
22
|
-
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core';
|
|
23
|
-
import {
|
|
24
|
-
import { WorkflowRuns } from '@mastra/core';
|
|
45
|
+
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
|
|
46
|
+
import { WorkflowResult } from '@mastra/core/workflows';
|
|
47
|
+
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
48
|
+
import { ZodType } from 'zod';
|
|
49
|
+
import { ZodTypeDef } from 'zod';
|
|
50
|
+
|
|
51
|
+
export declare namespace a2a {
|
|
52
|
+
export {
|
|
53
|
+
getAgentCardByIdHandler,
|
|
54
|
+
handleTaskSend,
|
|
55
|
+
handleTaskGet,
|
|
56
|
+
handleTaskSendSubscribe,
|
|
57
|
+
handleTaskCancel,
|
|
58
|
+
getAgentExecutionHandler
|
|
59
|
+
}
|
|
60
|
+
}
|
|
25
61
|
|
|
26
62
|
export declare namespace agents {
|
|
27
63
|
export {
|
|
@@ -39,12 +75,18 @@ export declare interface ApiError extends Error {
|
|
|
39
75
|
status?: number;
|
|
40
76
|
}
|
|
41
77
|
|
|
78
|
+
export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
|
|
79
|
+
|
|
42
80
|
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
81
|
|
|
44
82
|
export declare interface Context {
|
|
45
83
|
mastra: Mastra;
|
|
46
84
|
}
|
|
47
85
|
|
|
86
|
+
export declare function convertToCoreMessage(message: Message): CoreMessage_2;
|
|
87
|
+
|
|
88
|
+
export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
|
|
89
|
+
|
|
48
90
|
export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
|
|
49
91
|
index: CreateIndexRequest;
|
|
50
92
|
}): Promise<{
|
|
@@ -57,16 +99,29 @@ declare interface CreateIndexRequest {
|
|
|
57
99
|
metric?: 'cosine' | 'euclidean' | 'dotproduct';
|
|
58
100
|
}
|
|
59
101
|
|
|
60
|
-
export declare function
|
|
102
|
+
export declare function createLegacyWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
61
103
|
runId: string;
|
|
62
104
|
}>;
|
|
63
105
|
|
|
106
|
+
export declare function createSuccessResponse<T>(id: number | string | null, result: T): JSONRPCResponse<T>;
|
|
107
|
+
|
|
108
|
+
export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
|
|
109
|
+
task: Task;
|
|
110
|
+
userMessage: Message;
|
|
111
|
+
history: Message[];
|
|
112
|
+
activeCancellations: Set<string>;
|
|
113
|
+
}): TaskContext;
|
|
114
|
+
|
|
64
115
|
export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
|
|
65
116
|
body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
|
|
66
117
|
resourceId?: string;
|
|
67
118
|
};
|
|
68
119
|
}): Promise<StorageThreadType>;
|
|
69
120
|
|
|
121
|
+
export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
122
|
+
runId: string;
|
|
123
|
+
}>;
|
|
124
|
+
|
|
70
125
|
export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
|
|
71
126
|
indexName?: string;
|
|
72
127
|
}): Promise<{
|
|
@@ -87,23 +142,28 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
|
|
|
87
142
|
metric: string | undefined;
|
|
88
143
|
}>;
|
|
89
144
|
|
|
90
|
-
export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
|
|
145
|
+
export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
|
|
91
146
|
agentId?: string;
|
|
92
147
|
data: any;
|
|
148
|
+
runtimeContext: RuntimeContext_2;
|
|
93
149
|
}): Promise<any>;
|
|
94
150
|
|
|
95
|
-
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
|
|
151
|
+
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
|
|
96
152
|
data?: unknown;
|
|
153
|
+
runtimeContext: RuntimeContext_2;
|
|
97
154
|
}) => Promise<any>;
|
|
98
155
|
|
|
99
|
-
export declare function generateHandler({ mastra, agentId, body, }: Context & {
|
|
156
|
+
export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
157
|
+
runtimeContext: RuntimeContext;
|
|
100
158
|
agentId: string;
|
|
101
159
|
body: GetBody<'generate'> & {
|
|
102
160
|
resourceid?: string;
|
|
161
|
+
runtimeContext?: Record<string, unknown>;
|
|
103
162
|
};
|
|
104
|
-
}): Promise<GenerateTextResult<any,
|
|
163
|
+
}): Promise<GenerateTextResult<any, unknown>>;
|
|
105
164
|
|
|
106
|
-
export declare function generateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
|
|
165
|
+
export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
|
|
166
|
+
runtimeContext: RuntimeContext;
|
|
107
167
|
body: {
|
|
108
168
|
messages?: Parameters<AgentNetwork['generate']>[0];
|
|
109
169
|
} & Parameters<AgentNetwork['generate']>[1];
|
|
@@ -117,21 +177,47 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
|
|
|
117
177
|
text?: string;
|
|
118
178
|
speakerId?: string;
|
|
119
179
|
};
|
|
120
|
-
}): Promise<
|
|
121
|
-
audioData: Buffer<ArrayBuffer>;
|
|
122
|
-
}>;
|
|
180
|
+
}): Promise<NodeJS.ReadableStream>;
|
|
123
181
|
|
|
124
|
-
export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
|
|
182
|
+
export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, isPlayground, }: Context & {
|
|
183
|
+
isPlayground?: boolean;
|
|
184
|
+
runtimeContext: RuntimeContext;
|
|
125
185
|
agentId: string;
|
|
126
186
|
}): Promise<{
|
|
127
187
|
name: any;
|
|
128
188
|
instructions: string;
|
|
129
189
|
tools: any;
|
|
190
|
+
workflows: {};
|
|
130
191
|
provider: string;
|
|
131
192
|
modelId: string;
|
|
193
|
+
defaultGenerateOptions: any;
|
|
194
|
+
defaultStreamOptions: any;
|
|
132
195
|
}>;
|
|
133
196
|
|
|
134
|
-
export declare function
|
|
197
|
+
export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
|
|
198
|
+
runtimeContext: RuntimeContext;
|
|
199
|
+
agentId: keyof ReturnType<typeof mastra.getAgents>;
|
|
200
|
+
executionUrl?: string;
|
|
201
|
+
version?: string;
|
|
202
|
+
provider?: {
|
|
203
|
+
organization: string;
|
|
204
|
+
url: string;
|
|
205
|
+
};
|
|
206
|
+
}): Promise<AgentCard>;
|
|
207
|
+
|
|
208
|
+
export declare function getAgentExecutionHandler({ requestId, mastra, agentId, runtimeContext, method, params, taskStore, logger, }: Context & {
|
|
209
|
+
requestId: string;
|
|
210
|
+
runtimeContext: RuntimeContext;
|
|
211
|
+
agentId: string;
|
|
212
|
+
method: 'tasks/send' | 'tasks/sendSubscribe' | 'tasks/get' | 'tasks/cancel';
|
|
213
|
+
params: TaskSendParams | TaskQueryParams | TaskIdParams;
|
|
214
|
+
taskStore?: InMemoryTaskStore;
|
|
215
|
+
logger?: IMastraLogger;
|
|
216
|
+
}): Promise<any>;
|
|
217
|
+
|
|
218
|
+
export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
|
|
219
|
+
runtimeContext: RuntimeContext;
|
|
220
|
+
}): Promise<any>;
|
|
135
221
|
|
|
136
222
|
declare type GetBody<T extends keyof Agent & {
|
|
137
223
|
[K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
|
|
@@ -139,7 +225,8 @@ declare type GetBody<T extends keyof Agent & {
|
|
|
139
225
|
messages: Parameters<Agent[T]>[0];
|
|
140
226
|
} & Parameters<Agent[T]>[1];
|
|
141
227
|
|
|
142
|
-
export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
|
|
228
|
+
export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
229
|
+
runtimeContext: RuntimeContext;
|
|
143
230
|
agentId: string;
|
|
144
231
|
}): Promise<{
|
|
145
232
|
id: string;
|
|
@@ -148,7 +235,37 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
|
|
|
148
235
|
evals: EvalRow[];
|
|
149
236
|
}>;
|
|
150
237
|
|
|
151
|
-
export declare function
|
|
238
|
+
export declare function getLegacyWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
|
|
239
|
+
stepGraph: StepGraph;
|
|
240
|
+
stepSubscriberGraph: Record<string, StepGraph>;
|
|
241
|
+
serializedStepGraph: StepGraph;
|
|
242
|
+
serializedStepSubscriberGraph: Record<string, StepGraph>;
|
|
243
|
+
name: string;
|
|
244
|
+
triggerSchema: string | undefined;
|
|
245
|
+
steps: any;
|
|
246
|
+
}>;
|
|
247
|
+
|
|
248
|
+
export declare function getLegacyWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<LegacyWorkflow['getRun']>>;
|
|
249
|
+
|
|
250
|
+
export declare function getLegacyWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
|
|
251
|
+
fromDate?: Date;
|
|
252
|
+
toDate?: Date;
|
|
253
|
+
limit?: number;
|
|
254
|
+
offset?: number;
|
|
255
|
+
resourceId?: string;
|
|
256
|
+
}): Promise<LegacyWorkflowRuns>;
|
|
257
|
+
|
|
258
|
+
export declare function getLegacyWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Get available listeners for an agent
|
|
262
|
+
*/
|
|
263
|
+
export declare function getListenerHandler({ mastra, agentId }: VoiceContext): Promise<{
|
|
264
|
+
enabled: boolean;
|
|
265
|
+
}>;
|
|
266
|
+
|
|
267
|
+
export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
268
|
+
runtimeContext: RuntimeContext;
|
|
152
269
|
agentId: string;
|
|
153
270
|
}): Promise<{
|
|
154
271
|
id: string;
|
|
@@ -157,9 +274,21 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Contex
|
|
|
157
274
|
evals: EvalRow[];
|
|
158
275
|
}>;
|
|
159
276
|
|
|
160
|
-
export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<
|
|
277
|
+
export declare function getLogsByRunIdHandler({ mastra, runId, transportId, params, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId' | 'params'>): Promise<{
|
|
278
|
+
logs: BaseLogMessage[];
|
|
279
|
+
total: number;
|
|
280
|
+
page: number;
|
|
281
|
+
perPage: number;
|
|
282
|
+
hasMore: boolean;
|
|
283
|
+
}>;
|
|
161
284
|
|
|
162
|
-
export declare function getLogsHandler({ mastra, transportId }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<
|
|
285
|
+
export declare function getLogsHandler({ mastra, transportId, params, }: Pick<LogsContext, 'mastra' | 'transportId' | 'params'>): Promise<{
|
|
286
|
+
logs: BaseLogMessage[];
|
|
287
|
+
total: number;
|
|
288
|
+
page: number;
|
|
289
|
+
perPage: number;
|
|
290
|
+
hasMore: boolean;
|
|
291
|
+
}>;
|
|
163
292
|
|
|
164
293
|
export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
|
|
165
294
|
transports: string[];
|
|
@@ -169,12 +298,14 @@ export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryC
|
|
|
169
298
|
result: boolean;
|
|
170
299
|
}>;
|
|
171
300
|
|
|
172
|
-
export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>
|
|
301
|
+
export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
|
|
302
|
+
limit?: number;
|
|
303
|
+
}): Promise<{
|
|
173
304
|
messages: CoreMessage[];
|
|
174
|
-
uiMessages:
|
|
305
|
+
uiMessages: UIMessage[];
|
|
175
306
|
}>;
|
|
176
307
|
|
|
177
|
-
export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
|
|
308
|
+
export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
178
309
|
id: string;
|
|
179
310
|
name: string;
|
|
180
311
|
instructions: string;
|
|
@@ -189,7 +320,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
|
|
|
189
320
|
};
|
|
190
321
|
}>;
|
|
191
322
|
|
|
192
|
-
export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
|
|
323
|
+
export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
|
|
193
324
|
id: string;
|
|
194
325
|
name: string;
|
|
195
326
|
instructions: string;
|
|
@@ -221,24 +352,75 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
|
|
|
221
352
|
|
|
222
353
|
export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
|
|
223
354
|
|
|
224
|
-
export declare function getWorkflowByIdHandler({ mastra, workflowId }:
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
steps: any;
|
|
355
|
+
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
|
|
356
|
+
steps: SerializedStep[];
|
|
357
|
+
name: string | undefined;
|
|
358
|
+
description: string | undefined;
|
|
359
|
+
stepGraph: SerializedStepFlowEntry[];
|
|
360
|
+
inputSchema: string | undefined;
|
|
361
|
+
outputSchema: string | undefined;
|
|
232
362
|
}>;
|
|
233
363
|
|
|
234
|
-
export declare function
|
|
364
|
+
export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
|
|
365
|
+
|
|
366
|
+
export declare function getWorkflowRunExecutionResultHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<WatchEvent['payload']['workflowState']>;
|
|
235
367
|
|
|
236
|
-
export declare function getWorkflowRunsHandler({ mastra, workflowId }:
|
|
368
|
+
export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
|
|
369
|
+
fromDate?: Date;
|
|
370
|
+
toDate?: Date;
|
|
371
|
+
limit?: number;
|
|
372
|
+
offset?: number;
|
|
373
|
+
resourceId?: string;
|
|
374
|
+
}): Promise<WorkflowRuns>;
|
|
237
375
|
|
|
238
|
-
export declare function getWorkflowsHandler({ mastra }:
|
|
376
|
+
export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
|
|
239
377
|
|
|
240
378
|
export declare function handleError(error: unknown, defaultMessage: string): never;
|
|
241
379
|
|
|
380
|
+
export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
|
|
381
|
+
requestId: string;
|
|
382
|
+
taskStore: InMemoryTaskStore;
|
|
383
|
+
agentId: string;
|
|
384
|
+
taskId: string;
|
|
385
|
+
logger?: IMastraLogger;
|
|
386
|
+
}): Promise<JSONRPCResponse<Task, unknown>>;
|
|
387
|
+
|
|
388
|
+
export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
|
|
389
|
+
requestId: string;
|
|
390
|
+
taskStore: InMemoryTaskStore;
|
|
391
|
+
agentId: string;
|
|
392
|
+
taskId: string;
|
|
393
|
+
}): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
|
|
394
|
+
|
|
395
|
+
export declare function handleTaskSend({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
|
|
396
|
+
requestId: string;
|
|
397
|
+
params: TaskSendParams;
|
|
398
|
+
taskStore: InMemoryTaskStore;
|
|
399
|
+
agent: Agent;
|
|
400
|
+
agentId: string;
|
|
401
|
+
logger?: IMastraLogger;
|
|
402
|
+
runtimeContext: RuntimeContext;
|
|
403
|
+
}): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
|
|
404
|
+
|
|
405
|
+
export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
|
|
406
|
+
requestId: string;
|
|
407
|
+
params: TaskSendParams;
|
|
408
|
+
taskStore: InMemoryTaskStore;
|
|
409
|
+
agent: Agent;
|
|
410
|
+
agentId: string;
|
|
411
|
+
logger?: IMastraLogger;
|
|
412
|
+
runtimeContext: RuntimeContext;
|
|
413
|
+
}): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
|
|
414
|
+
state: string;
|
|
415
|
+
message: {
|
|
416
|
+
role: string;
|
|
417
|
+
parts: {
|
|
418
|
+
type: string;
|
|
419
|
+
text: string;
|
|
420
|
+
}[];
|
|
421
|
+
};
|
|
422
|
+
}, unknown>, void, unknown>;
|
|
423
|
+
|
|
242
424
|
/**
|
|
243
425
|
* `HTTPException` must be used when a fatal error such as authentication failure occurs.
|
|
244
426
|
*
|
|
@@ -300,8 +482,46 @@ declare type HTTPExceptionOptions = {
|
|
|
300
482
|
*/
|
|
301
483
|
declare type InfoStatusCode = 100 | 101 | 102 | 103;
|
|
302
484
|
|
|
485
|
+
export declare class InMemoryTaskStore {
|
|
486
|
+
private store;
|
|
487
|
+
activeCancellations: Set<string>;
|
|
488
|
+
load({ agentId, taskId }: {
|
|
489
|
+
agentId: string;
|
|
490
|
+
taskId: string;
|
|
491
|
+
}): Promise<TaskAndHistory | null>;
|
|
492
|
+
save({ agentId, data }: {
|
|
493
|
+
agentId: string;
|
|
494
|
+
data: TaskAndHistory;
|
|
495
|
+
}): Promise<void>;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
export declare namespace legacyWorkflows {
|
|
499
|
+
export {
|
|
500
|
+
getLegacyWorkflowsHandler,
|
|
501
|
+
getLegacyWorkflowByIdHandler,
|
|
502
|
+
startAsyncLegacyWorkflowHandler,
|
|
503
|
+
getLegacyWorkflowRunHandler,
|
|
504
|
+
createLegacyWorkflowRunHandler,
|
|
505
|
+
startLegacyWorkflowRunHandler,
|
|
506
|
+
watchLegacyWorkflowHandler,
|
|
507
|
+
resumeAsyncLegacyWorkflowHandler,
|
|
508
|
+
resumeLegacyWorkflowHandler,
|
|
509
|
+
getLegacyWorkflowRunsHandler
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
303
513
|
export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
|
|
304
514
|
|
|
515
|
+
export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
|
|
516
|
+
agentId: string;
|
|
517
|
+
taskId: string;
|
|
518
|
+
taskStore: InMemoryTaskStore;
|
|
519
|
+
message: Message;
|
|
520
|
+
sessionId?: string | null;
|
|
521
|
+
metadata?: Record<string, unknown> | null;
|
|
522
|
+
logger?: IMastraLogger;
|
|
523
|
+
}): Promise<TaskAndHistory>;
|
|
524
|
+
|
|
305
525
|
export declare namespace logs {
|
|
306
526
|
export {
|
|
307
527
|
getLogsHandler,
|
|
@@ -314,6 +534,14 @@ declare type LogsContext = {
|
|
|
314
534
|
mastra: Mastra;
|
|
315
535
|
transportId?: string;
|
|
316
536
|
runId?: string;
|
|
537
|
+
params?: {
|
|
538
|
+
fromDate?: Date;
|
|
539
|
+
toDate?: Date;
|
|
540
|
+
logLevel?: LogLevel;
|
|
541
|
+
filters?: string | string[];
|
|
542
|
+
page?: number;
|
|
543
|
+
perPage?: number;
|
|
544
|
+
};
|
|
317
545
|
};
|
|
318
546
|
|
|
319
547
|
export declare namespace memory {
|
|
@@ -346,8 +574,11 @@ export declare namespace network {
|
|
|
346
574
|
|
|
347
575
|
declare interface NetworkContext extends Context {
|
|
348
576
|
networkId?: string;
|
|
577
|
+
runtimeContext: RuntimeContext;
|
|
349
578
|
}
|
|
350
579
|
|
|
580
|
+
export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
|
|
581
|
+
|
|
351
582
|
declare interface QueryRequest {
|
|
352
583
|
indexName: string;
|
|
353
584
|
queryVector: number[];
|
|
@@ -362,18 +593,38 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
|
|
|
362
593
|
|
|
363
594
|
declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
|
|
364
595
|
|
|
365
|
-
export declare function
|
|
596
|
+
export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
366
597
|
body: {
|
|
367
598
|
stepId: string;
|
|
368
599
|
context: any;
|
|
369
600
|
};
|
|
370
|
-
|
|
601
|
+
runtimeContext: RuntimeContext;
|
|
602
|
+
}): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
|
|
603
|
+
|
|
604
|
+
export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext: payloadRuntimeContext, }: WorkflowContext_3 & {
|
|
605
|
+
body: {
|
|
606
|
+
step: string | string[];
|
|
607
|
+
resumeData?: unknown;
|
|
608
|
+
};
|
|
609
|
+
runtimeContext?: Record<string, any>;
|
|
610
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
|
|
371
611
|
|
|
372
|
-
export declare function
|
|
612
|
+
export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
373
613
|
body: {
|
|
374
614
|
stepId: string;
|
|
375
615
|
context: any;
|
|
376
616
|
};
|
|
617
|
+
runtimeContext: RuntimeContext;
|
|
618
|
+
}): Promise<{
|
|
619
|
+
message: string;
|
|
620
|
+
}>;
|
|
621
|
+
|
|
622
|
+
export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext: payloadRuntimeContext, }: WorkflowContext_3 & {
|
|
623
|
+
body: {
|
|
624
|
+
step: string | string[];
|
|
625
|
+
resumeData?: unknown;
|
|
626
|
+
};
|
|
627
|
+
runtimeContext?: Record<string, any>;
|
|
377
628
|
}): Promise<{
|
|
378
629
|
message: string;
|
|
379
630
|
}>;
|
|
@@ -382,16 +633,39 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
|
|
|
382
633
|
body: {
|
|
383
634
|
messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
|
|
384
635
|
};
|
|
385
|
-
}): Promise<
|
|
636
|
+
}): Promise<MastraMessageV1[]>;
|
|
637
|
+
|
|
638
|
+
declare type SerializedStep = {
|
|
639
|
+
id: string;
|
|
640
|
+
description: string;
|
|
641
|
+
inputSchema: string | undefined;
|
|
642
|
+
outputSchema: string | undefined;
|
|
643
|
+
resumeSchema: string | undefined;
|
|
644
|
+
suspendSchema: string | undefined;
|
|
645
|
+
};
|
|
386
646
|
|
|
387
647
|
declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
388
648
|
|
|
389
|
-
export declare function
|
|
649
|
+
export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
390
650
|
triggerData?: unknown;
|
|
391
|
-
|
|
651
|
+
runtimeContext: RuntimeContext;
|
|
652
|
+
}): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
|
|
653
|
+
|
|
654
|
+
export declare function startAsyncWorkflowHandler({ mastra, runtimeContext: payloadRuntimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
655
|
+
inputData?: unknown;
|
|
656
|
+
runtimeContext?: Record<string, any>;
|
|
657
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
|
|
392
658
|
|
|
393
|
-
export declare function
|
|
659
|
+
export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
394
660
|
triggerData?: unknown;
|
|
661
|
+
runtimeContext: RuntimeContext;
|
|
662
|
+
}): Promise<{
|
|
663
|
+
message: string;
|
|
664
|
+
}>;
|
|
665
|
+
|
|
666
|
+
export declare function startWorkflowRunHandler({ mastra, runtimeContext: payloadRuntimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
667
|
+
inputData?: unknown;
|
|
668
|
+
runtimeContext?: Record<string, any>;
|
|
395
669
|
}): Promise<{
|
|
396
670
|
message: string;
|
|
397
671
|
}>;
|
|
@@ -409,25 +683,40 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
|
|
|
409
683
|
status: string;
|
|
410
684
|
message: string;
|
|
411
685
|
error: any;
|
|
686
|
+
} | {
|
|
687
|
+
status: string;
|
|
688
|
+
message: string;
|
|
689
|
+
traceCount?: undefined;
|
|
412
690
|
} | {
|
|
413
691
|
status: string;
|
|
414
692
|
message: string;
|
|
415
693
|
traceCount: number;
|
|
416
694
|
}>;
|
|
417
695
|
|
|
418
|
-
export declare function streamGenerateHandler({ mastra, agentId, body, }: Context & {
|
|
696
|
+
export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
697
|
+
runtimeContext: RuntimeContext;
|
|
419
698
|
agentId: string;
|
|
420
699
|
body: GetBody<'stream'> & {
|
|
421
700
|
resourceid?: string;
|
|
701
|
+
runtimeContext?: string;
|
|
422
702
|
};
|
|
423
703
|
}): Promise<Response | undefined>;
|
|
424
704
|
|
|
425
|
-
export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
|
|
705
|
+
export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
|
|
706
|
+
runtimeContext: RuntimeContext;
|
|
426
707
|
body: {
|
|
427
708
|
messages?: Parameters<AgentNetwork['stream']>[0];
|
|
428
709
|
} & Parameters<AgentNetwork['stream']>[1];
|
|
429
710
|
}): Promise<Response>;
|
|
430
711
|
|
|
712
|
+
export declare function streamWorkflowHandler({ mastra, runtimeContext: payloadRuntimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
713
|
+
inputData?: unknown;
|
|
714
|
+
runtimeContext?: Record<string, any>;
|
|
715
|
+
}): Promise<{
|
|
716
|
+
stream: globalThis.ReadableStream<StreamEvent>;
|
|
717
|
+
getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
|
|
718
|
+
}>;
|
|
719
|
+
|
|
431
720
|
declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
|
|
432
721
|
|
|
433
722
|
export declare namespace telemetry {
|
|
@@ -444,6 +733,8 @@ declare interface TelemetryContext extends Context {
|
|
|
444
733
|
page?: number;
|
|
445
734
|
perPage?: number;
|
|
446
735
|
attribute?: string | string[];
|
|
736
|
+
fromDate?: Date;
|
|
737
|
+
toDate?: Date;
|
|
447
738
|
};
|
|
448
739
|
}
|
|
449
740
|
|
|
@@ -530,7 +821,8 @@ export declare namespace voice {
|
|
|
530
821
|
export {
|
|
531
822
|
getSpeakersHandler,
|
|
532
823
|
generateSpeechHandler,
|
|
533
|
-
transcribeSpeechHandler
|
|
824
|
+
transcribeSpeechHandler,
|
|
825
|
+
getListenerHandler
|
|
534
826
|
}
|
|
535
827
|
}
|
|
536
828
|
|
|
@@ -538,10 +830,16 @@ declare interface VoiceContext extends Context {
|
|
|
538
830
|
agentId?: string;
|
|
539
831
|
}
|
|
540
832
|
|
|
541
|
-
export declare function
|
|
833
|
+
export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
834
|
+
|
|
835
|
+
export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
836
|
+
|
|
837
|
+
declare interface WorkflowContext extends Context {
|
|
838
|
+
workflowId?: string;
|
|
839
|
+
runId?: string;
|
|
840
|
+
}
|
|
542
841
|
|
|
543
|
-
declare interface
|
|
544
|
-
mastra: Mastra_2;
|
|
842
|
+
declare interface WorkflowContext_3 extends Context {
|
|
545
843
|
workflowId?: string;
|
|
546
844
|
runId?: string;
|
|
547
845
|
}
|
|
@@ -550,11 +848,13 @@ export declare namespace workflows {
|
|
|
550
848
|
export {
|
|
551
849
|
getWorkflowsHandler,
|
|
552
850
|
getWorkflowByIdHandler,
|
|
851
|
+
getWorkflowRunByIdHandler,
|
|
852
|
+
getWorkflowRunExecutionResultHandler,
|
|
853
|
+
createWorkflowRunHandler,
|
|
553
854
|
startAsyncWorkflowHandler,
|
|
554
|
-
getWorkflowRunHandler,
|
|
555
|
-
createRunHandler,
|
|
556
855
|
startWorkflowRunHandler,
|
|
557
856
|
watchWorkflowHandler,
|
|
857
|
+
streamWorkflowHandler,
|
|
558
858
|
resumeAsyncWorkflowHandler,
|
|
559
859
|
resumeWorkflowHandler,
|
|
560
860
|
getWorkflowRunsHandler
|