@mastra/server 0.0.0-ai-v5-20250626003446 → 0.0.0-ai-v5-20250718021026
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.md +11 -42
- package/dist/_tsup-dts-rollup.d.cts +265 -22
- package/dist/_tsup-dts-rollup.d.ts +265 -22
- package/dist/{chunk-OCWPVYNI.cjs → chunk-2KZFMI6P.cjs} +1 -0
- package/dist/{chunk-5BKZNI2F.cjs → chunk-34GEZJPU.cjs} +29 -23
- package/dist/{chunk-TGJMNUYJ.js → chunk-36BLNJHS.js} +108 -70
- package/dist/{chunk-XUTX4CAB.cjs → chunk-3TMDONWY.cjs} +154 -75
- package/dist/{chunk-QLG2PFHE.js → chunk-4D66QEKC.js} +2 -2
- package/dist/{chunk-BNEY4P4P.cjs → chunk-7TP2LX5L.cjs} +16 -16
- package/dist/{chunk-P54JFWUD.js → chunk-BYCOGHDE.js} +3 -3
- package/dist/{chunk-57CJTIPW.cjs → chunk-CCGRCYWJ.cjs} +2 -2
- package/dist/{chunk-B4MQFJ7G.cjs → chunk-G7KH752Y.cjs} +5 -5
- package/dist/{chunk-I3FR2N5I.cjs → chunk-HAGPF7OS.cjs} +12 -12
- package/dist/{chunk-ASKESBJW.cjs → chunk-HISYIDYH.cjs} +107 -69
- package/dist/{chunk-NGURCFEJ.cjs → chunk-HRSAZUIK.cjs} +20 -20
- package/dist/{chunk-R5VGYBV6.js → chunk-KHZKYUNR.js} +3 -3
- package/dist/{chunk-NYN7KFXL.js → chunk-LCM566I4.js} +1 -0
- package/dist/chunk-LF7P5PLR.js +14 -0
- package/dist/{chunk-BSUAZLUK.js → chunk-N6KVUULV.js} +110 -25
- package/dist/{chunk-2XXCPCYB.js → chunk-OKL5JVWU.js} +15 -9
- package/dist/{chunk-3CSC35VL.js → chunk-ORHUZSM2.js} +96 -19
- package/dist/chunk-PZQDCRPV.cjs +16 -0
- package/dist/{chunk-IMBY5XUG.cjs → chunk-QGX47B5D.cjs} +7 -7
- package/dist/{chunk-BFOA2QQY.js → chunk-RG473F6Y.js} +2 -2
- package/dist/{chunk-WJY57THV.cjs → chunk-RHSWAXKB.cjs} +22 -22
- package/dist/{chunk-H5PTF3Y4.js → chunk-RSEO4XPX.js} +1 -1
- package/dist/{chunk-WE32JG64.cjs → chunk-UCV4247U.cjs} +43 -43
- package/dist/chunk-VDTQM2M5.cjs +321 -0
- package/dist/{chunk-2HXKRRNS.js → chunk-WBRFIHSF.js} +4 -4
- package/dist/{chunk-55DOQLP6.js → chunk-WNVFNNWN.js} +2 -2
- package/dist/{chunk-CLYX4KLH.js → chunk-ZYAFP2AV.js} +8 -8
- 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 +11 -11
- package/dist/server/handlers/legacyWorkflows.js +1 -1
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +17 -9
- package/dist/server/handlers/memory.d.cts +2 -0
- package/dist/server/handlers/memory.d.ts +2 -0
- 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/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 +7 -7
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +5 -5
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +21 -13
- package/dist/server/handlers/workflows.d.cts +2 -0
- package/dist/server/handlers/workflows.d.ts +2 -0
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +20 -20
- package/dist/server/handlers.js +10 -10
- package/package.json +9 -9
- package/dist/chunk-64U3UDTH.cjs +0 -13
- package/dist/chunk-M5ABIP7D.js +0 -11
- package/dist/chunk-PADRC33G.cjs +0 -234
package/LICENSE.md
CHANGED
|
@@ -1,46 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Apache License 2.0
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025
|
|
3
|
+
Copyright (c) 2025 Kepler Software, Inc.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
|
|
17
|
-
|
|
18
|
-
**Patents**
|
|
19
|
-
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
20
|
-
|
|
21
|
-
**Notices**
|
|
22
|
-
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
|
|
23
|
-
|
|
24
|
-
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
|
|
25
|
-
|
|
26
|
-
**No Other Rights**
|
|
27
|
-
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
28
|
-
|
|
29
|
-
**Termination**
|
|
30
|
-
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
|
|
31
|
-
|
|
32
|
-
**No Liability**
|
|
33
|
-
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
|
|
34
|
-
|
|
35
|
-
**Definitions**
|
|
36
|
-
The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.
|
|
37
|
-
|
|
38
|
-
_you_ refers to the individual or entity agreeing to these terms.
|
|
39
|
-
|
|
40
|
-
_your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
41
|
-
|
|
42
|
-
_your licenses_ are all the licenses granted to you for the software under these terms.
|
|
43
|
-
|
|
44
|
-
_use_ means anything you do with the software requiring one of your licenses.
|
|
45
|
-
|
|
46
|
-
_trademark_ means trademarks, service marks, and similar rights.
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
@@ -4,7 +4,8 @@ import type { AgentNetwork } from '@mastra/core/network';
|
|
|
4
4
|
import type { Artifact } from '@mastra/core/a2a';
|
|
5
5
|
import type { BaseLogMessage } from '@mastra/core/logger';
|
|
6
6
|
import type { CoreMessage } from '@mastra/core/llm';
|
|
7
|
-
import {
|
|
7
|
+
import { DefaultEngineType } from '@mastra/core';
|
|
8
|
+
import { EvalRow } from '@mastra/core';
|
|
8
9
|
import { GenerateObjectResult } from 'ai';
|
|
9
10
|
import { GenerateTextResult } from 'ai';
|
|
10
11
|
import type { IMastraLogger } from '@mastra/core/logger';
|
|
@@ -16,20 +17,23 @@ import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
|
|
|
16
17
|
import type { LegacyWorkflowRuns } from '@mastra/core/storage';
|
|
17
18
|
import type { LogLevel } from '@mastra/core/logger';
|
|
18
19
|
import type { Mastra } from '@mastra/core/mastra';
|
|
20
|
+
import type { MastraError } from '@mastra/core/error';
|
|
19
21
|
import type { MastraMemory } from '@mastra/core/memory';
|
|
20
|
-
import { MastraMessageV1 } from '@mastra/core
|
|
22
|
+
import { MastraMessageV1 } from '@mastra/core';
|
|
21
23
|
import type { Message } from '@mastra/core/a2a';
|
|
22
24
|
import { ModelMessage } from 'ai';
|
|
23
25
|
import type { QueryResult } from '@mastra/core/vector';
|
|
24
26
|
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
27
|
+
import { ReadableStream as ReadableStream_3 } from 'stream/web';
|
|
25
28
|
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
26
29
|
import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
|
|
27
30
|
import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
|
|
28
|
-
import { Step } from '@mastra/core
|
|
31
|
+
import { Step } from '@mastra/core';
|
|
29
32
|
import { StepExecutionContext } from '@mastra/core/workflows/legacy';
|
|
30
33
|
import { StepGraph } from '@mastra/core/workflows/legacy';
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
34
|
+
import { StepResult } from '@mastra/core';
|
|
35
|
+
import { StorageThreadType } from '@mastra/core';
|
|
36
|
+
import { StreamEvent } from '@mastra/core';
|
|
33
37
|
import { Task } from '@mastra/core/a2a';
|
|
34
38
|
import { TaskAndHistory } from '@mastra/core/a2a';
|
|
35
39
|
import type { TaskContext } from '@mastra/core/a2a';
|
|
@@ -42,9 +46,17 @@ import type { VercelTool } from '@mastra/core/tools';
|
|
|
42
46
|
import type { WatchEvent } from '@mastra/core/workflows';
|
|
43
47
|
import type { Workflow } from '@mastra/core/workflows';
|
|
44
48
|
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
|
|
45
|
-
import { WorkflowResult } from '@mastra/core
|
|
49
|
+
import { WorkflowResult } from '@mastra/core';
|
|
46
50
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
51
|
+
import { WorkingMemoryTemplate } from '@mastra/core';
|
|
52
|
+
import { ZodBoolean } from 'zod';
|
|
53
|
+
import { ZodEnum } from 'zod';
|
|
54
|
+
import { ZodNumber } from 'zod';
|
|
55
|
+
import { ZodObject } from 'zod';
|
|
56
|
+
import { ZodOptional } from 'zod';
|
|
57
|
+
import { ZodString } from 'zod';
|
|
47
58
|
import { ZodType } from 'zod';
|
|
59
|
+
import { ZodTypeAny } from 'zod';
|
|
48
60
|
import { ZodTypeDef } from 'zod';
|
|
49
61
|
|
|
50
62
|
export declare namespace a2a {
|
|
@@ -69,13 +81,17 @@ export declare namespace agents {
|
|
|
69
81
|
}
|
|
70
82
|
}
|
|
71
83
|
|
|
72
|
-
export declare interface ApiError extends
|
|
84
|
+
export declare interface ApiError extends MastraError {
|
|
73
85
|
message: string;
|
|
74
86
|
status?: number;
|
|
75
87
|
}
|
|
76
88
|
|
|
77
89
|
export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
|
|
78
90
|
|
|
91
|
+
export declare function cancelWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
92
|
+
message: string;
|
|
93
|
+
}>;
|
|
94
|
+
|
|
79
95
|
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;
|
|
80
96
|
|
|
81
97
|
export declare interface Context {
|
|
@@ -111,7 +127,7 @@ export declare function createTaskContext({ task, userMessage, history, activeCa
|
|
|
111
127
|
activeCancellations: Set<string>;
|
|
112
128
|
}): TaskContext;
|
|
113
129
|
|
|
114
|
-
export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
|
|
130
|
+
export declare function createThreadHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
|
|
115
131
|
body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
|
|
116
132
|
resourceId?: string;
|
|
117
133
|
};
|
|
@@ -127,7 +143,7 @@ export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<Vec
|
|
|
127
143
|
success: boolean;
|
|
128
144
|
}>;
|
|
129
145
|
|
|
130
|
-
export declare function deleteThreadHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
|
|
146
|
+
export declare function deleteThreadHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
131
147
|
result: string;
|
|
132
148
|
}>;
|
|
133
149
|
|
|
@@ -152,13 +168,14 @@ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mas
|
|
|
152
168
|
runtimeContext: RuntimeContext_2;
|
|
153
169
|
}) => Promise<any>;
|
|
154
170
|
|
|
155
|
-
export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
171
|
+
export declare function generateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
|
|
156
172
|
runtimeContext: RuntimeContext;
|
|
157
173
|
agentId: string;
|
|
158
174
|
body: GetBody<'generate'> & {
|
|
159
175
|
resourceid?: string;
|
|
160
176
|
runtimeContext?: Record<string, unknown>;
|
|
161
177
|
};
|
|
178
|
+
abortSignal?: AbortSignal;
|
|
162
179
|
}): Promise<GenerateTextResult<any, unknown>>;
|
|
163
180
|
|
|
164
181
|
export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
|
|
@@ -178,6 +195,20 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
|
|
|
178
195
|
};
|
|
179
196
|
}): Promise<NodeJS.ReadableStream>;
|
|
180
197
|
|
|
198
|
+
export declare function generateVNextNetworkHandler({ mastra, runtimeContext, networkId, body, }: NetworkContext_2 & {
|
|
199
|
+
runtimeContext: RuntimeContext;
|
|
200
|
+
body: {
|
|
201
|
+
message: string;
|
|
202
|
+
threadId?: string;
|
|
203
|
+
resourceId?: string;
|
|
204
|
+
};
|
|
205
|
+
}): Promise<{
|
|
206
|
+
task: string;
|
|
207
|
+
result: string;
|
|
208
|
+
resourceId: string;
|
|
209
|
+
resourceType: "tool" | "none" | "workflow" | "agent";
|
|
210
|
+
}>;
|
|
211
|
+
|
|
181
212
|
export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, isPlayground, }: Context & {
|
|
182
213
|
isPlayground?: boolean;
|
|
183
214
|
runtimeContext: RuntimeContext;
|
|
@@ -216,7 +247,17 @@ export declare function getAgentExecutionHandler({ requestId, mastra, agentId, r
|
|
|
216
247
|
|
|
217
248
|
export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
|
|
218
249
|
runtimeContext: RuntimeContext;
|
|
219
|
-
}): Promise<
|
|
250
|
+
}): Promise<Record<string, Omit<{
|
|
251
|
+
id: string;
|
|
252
|
+
name: any;
|
|
253
|
+
instructions: string;
|
|
254
|
+
tools: any;
|
|
255
|
+
workflows: {};
|
|
256
|
+
provider: string;
|
|
257
|
+
modelId: string;
|
|
258
|
+
defaultGenerateOptions: any;
|
|
259
|
+
defaultStreamOptions: any;
|
|
260
|
+
}, "id">>>;
|
|
220
261
|
|
|
221
262
|
declare type GetBody<T extends keyof Agent & {
|
|
222
263
|
[K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
|
|
@@ -293,11 +334,11 @@ export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>
|
|
|
293
334
|
transports: string[];
|
|
294
335
|
}>;
|
|
295
336
|
|
|
296
|
-
export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryContext, 'mastra' | 'agentId'>): Promise<{
|
|
337
|
+
export declare function getMemoryStatusHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
297
338
|
result: boolean;
|
|
298
339
|
}>;
|
|
299
340
|
|
|
300
|
-
export declare function getMessagesHandler({ mastra, agentId, threadId, limit, format, clientSdkCompat, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
|
|
341
|
+
export declare function getMessagesHandler({ mastra, agentId, threadId, limit, format, clientSdkCompat, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
|
|
301
342
|
limit?: number;
|
|
302
343
|
format?: 'aiv4' | 'aiv5';
|
|
303
344
|
clientSdkCompat?: string;
|
|
@@ -345,16 +386,67 @@ export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): P
|
|
|
345
386
|
|
|
346
387
|
export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<any[]>;
|
|
347
388
|
|
|
348
|
-
export declare function getThreadByIdHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<StorageThreadType>;
|
|
389
|
+
export declare function getThreadByIdHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType>;
|
|
349
390
|
|
|
350
|
-
export declare function getThreadsHandler({ mastra, agentId, resourceId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId'>): Promise<StorageThreadType[]>;
|
|
391
|
+
export declare function getThreadsHandler({ mastra, agentId, resourceId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType[]>;
|
|
351
392
|
|
|
352
393
|
export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext, 'tools' | 'toolId'>): Promise<any>;
|
|
353
394
|
|
|
354
395
|
export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
|
|
355
396
|
|
|
397
|
+
export declare function getVNextNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
398
|
+
id: string;
|
|
399
|
+
name: string;
|
|
400
|
+
instructions: string;
|
|
401
|
+
agents: {
|
|
402
|
+
name: string;
|
|
403
|
+
provider: string;
|
|
404
|
+
modelId: string;
|
|
405
|
+
}[];
|
|
406
|
+
workflows: {
|
|
407
|
+
name: string | undefined;
|
|
408
|
+
description: string | undefined;
|
|
409
|
+
inputSchema: string | undefined;
|
|
410
|
+
outputSchema: string | undefined;
|
|
411
|
+
}[];
|
|
412
|
+
tools: {
|
|
413
|
+
id: string;
|
|
414
|
+
description: string;
|
|
415
|
+
}[];
|
|
416
|
+
routingModel: {
|
|
417
|
+
provider: string;
|
|
418
|
+
modelId: string;
|
|
419
|
+
};
|
|
420
|
+
}>;
|
|
421
|
+
|
|
422
|
+
export declare function getVNextNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'runtimeContext'>): Promise<{
|
|
423
|
+
id: string;
|
|
424
|
+
name: string;
|
|
425
|
+
instructions: string;
|
|
426
|
+
tools: {
|
|
427
|
+
id: string;
|
|
428
|
+
description: string;
|
|
429
|
+
}[];
|
|
430
|
+
agents: {
|
|
431
|
+
name: string;
|
|
432
|
+
provider: string;
|
|
433
|
+
modelId: string;
|
|
434
|
+
}[];
|
|
435
|
+
workflows: {
|
|
436
|
+
name: string | undefined;
|
|
437
|
+
description: string | undefined;
|
|
438
|
+
inputSchema: string | undefined;
|
|
439
|
+
outputSchema: string | undefined;
|
|
440
|
+
}[];
|
|
441
|
+
routingModel: {
|
|
442
|
+
provider: string;
|
|
443
|
+
modelId: string;
|
|
444
|
+
};
|
|
445
|
+
}[]>;
|
|
446
|
+
|
|
356
447
|
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
|
|
357
|
-
steps: SerializedStep
|
|
448
|
+
steps: Record<string, SerializedStep>;
|
|
449
|
+
allSteps: Record<string, SerializedStep>;
|
|
358
450
|
name: string | undefined;
|
|
359
451
|
description: string | undefined;
|
|
360
452
|
stepGraph: SerializedStepFlowEntry[];
|
|
@@ -376,6 +468,21 @@ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, t
|
|
|
376
468
|
|
|
377
469
|
export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
|
|
378
470
|
|
|
471
|
+
/**
|
|
472
|
+
* Handler to get the working memory for a thread (optionally resource-scoped).
|
|
473
|
+
* @returns workingMemory - the working memory for the thread
|
|
474
|
+
* @returns source - thread or resource
|
|
475
|
+
*/
|
|
476
|
+
export declare function getWorkingMemoryHandler({ mastra, agentId, threadId, resourceId, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
|
|
477
|
+
resourceId?: Parameters<MastraMemory['getWorkingMemory']>[0]['resourceId'];
|
|
478
|
+
memoryConfig?: Parameters<MastraMemory['getWorkingMemory']>[0]['memoryConfig'];
|
|
479
|
+
}): Promise<{
|
|
480
|
+
workingMemory: string | null;
|
|
481
|
+
source: string;
|
|
482
|
+
workingMemoryTemplate: WorkingMemoryTemplate | null;
|
|
483
|
+
threadExists: boolean;
|
|
484
|
+
}>;
|
|
485
|
+
|
|
379
486
|
export declare function handleError(error: unknown, defaultMessage: string): never;
|
|
380
487
|
|
|
381
488
|
export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
|
|
@@ -470,11 +577,13 @@ export declare class HTTPException extends Error {
|
|
|
470
577
|
* @property res - Optional response object to use.
|
|
471
578
|
* @property message - Optional custom error message.
|
|
472
579
|
* @property cause - Optional cause of the error.
|
|
580
|
+
* @property stack - Optional stack trace for the error.
|
|
473
581
|
*/
|
|
474
582
|
declare type HTTPExceptionOptions = {
|
|
475
583
|
res?: Response;
|
|
476
584
|
message?: string;
|
|
477
585
|
cause?: unknown;
|
|
586
|
+
stack?: string;
|
|
478
587
|
};
|
|
479
588
|
|
|
480
589
|
/**
|
|
@@ -545,6 +654,62 @@ declare type LogsContext = {
|
|
|
545
654
|
};
|
|
546
655
|
};
|
|
547
656
|
|
|
657
|
+
export declare function loopStreamVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
|
|
658
|
+
runtimeContext: RuntimeContext;
|
|
659
|
+
body: {
|
|
660
|
+
message: string;
|
|
661
|
+
threadId?: string;
|
|
662
|
+
resourceId?: string;
|
|
663
|
+
maxIterations?: number;
|
|
664
|
+
};
|
|
665
|
+
}): Promise<{
|
|
666
|
+
stream: ReadableStream_3<StreamEvent>;
|
|
667
|
+
getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
|
|
668
|
+
task: ZodString;
|
|
669
|
+
resourceId: ZodString;
|
|
670
|
+
resourceType: ZodEnum<["agent", "workflow", "none", "tool"]>;
|
|
671
|
+
prompt: ZodString;
|
|
672
|
+
result: ZodString;
|
|
673
|
+
isComplete: ZodOptional<ZodBoolean>;
|
|
674
|
+
completionReason: ZodOptional<ZodString>;
|
|
675
|
+
iteration: ZodNumber;
|
|
676
|
+
}, "strip", ZodTypeAny, {
|
|
677
|
+
result: string;
|
|
678
|
+
prompt: string;
|
|
679
|
+
resourceId: string;
|
|
680
|
+
task: string;
|
|
681
|
+
resourceType: "tool" | "none" | "workflow" | "agent";
|
|
682
|
+
iteration: number;
|
|
683
|
+
isComplete?: boolean | undefined;
|
|
684
|
+
completionReason?: string | undefined;
|
|
685
|
+
}, {
|
|
686
|
+
result: string;
|
|
687
|
+
prompt: string;
|
|
688
|
+
resourceId: string;
|
|
689
|
+
task: string;
|
|
690
|
+
resourceType: "tool" | "none" | "workflow" | "agent";
|
|
691
|
+
iteration: number;
|
|
692
|
+
isComplete?: boolean | undefined;
|
|
693
|
+
completionReason?: string | undefined;
|
|
694
|
+
}>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
|
|
695
|
+
}>;
|
|
696
|
+
|
|
697
|
+
export declare function loopVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
|
|
698
|
+
runtimeContext: RuntimeContext;
|
|
699
|
+
body: {
|
|
700
|
+
message: string;
|
|
701
|
+
};
|
|
702
|
+
}): Promise<{
|
|
703
|
+
status: "success";
|
|
704
|
+
result: {
|
|
705
|
+
text: string;
|
|
706
|
+
iteration: number;
|
|
707
|
+
};
|
|
708
|
+
steps: {
|
|
709
|
+
[x: string]: StepResult<any, any, any, any> | StepResult<unknown, unknown, unknown, unknown>;
|
|
710
|
+
};
|
|
711
|
+
}>;
|
|
712
|
+
|
|
548
713
|
export declare namespace memory {
|
|
549
714
|
export {
|
|
550
715
|
getMemoryStatusHandler,
|
|
@@ -554,7 +719,9 @@ export declare namespace memory {
|
|
|
554
719
|
createThreadHandler,
|
|
555
720
|
updateThreadHandler,
|
|
556
721
|
deleteThreadHandler,
|
|
557
|
-
getMessagesHandler
|
|
722
|
+
getMessagesHandler,
|
|
723
|
+
getWorkingMemoryHandler,
|
|
724
|
+
updateWorkingMemoryHandler
|
|
558
725
|
}
|
|
559
726
|
}
|
|
560
727
|
|
|
@@ -562,6 +729,8 @@ declare interface MemoryContext extends Context {
|
|
|
562
729
|
agentId?: string;
|
|
563
730
|
resourceId?: string;
|
|
564
731
|
threadId?: string;
|
|
732
|
+
networkId?: string;
|
|
733
|
+
runtimeContext?: RuntimeContext_2;
|
|
565
734
|
}
|
|
566
735
|
|
|
567
736
|
export declare namespace network {
|
|
@@ -578,6 +747,11 @@ declare interface NetworkContext extends Context {
|
|
|
578
747
|
runtimeContext: RuntimeContext;
|
|
579
748
|
}
|
|
580
749
|
|
|
750
|
+
declare interface NetworkContext_2 extends Context {
|
|
751
|
+
networkId?: string;
|
|
752
|
+
runtimeContext: RuntimeContext;
|
|
753
|
+
}
|
|
754
|
+
|
|
581
755
|
export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
|
|
582
756
|
|
|
583
757
|
declare interface QueryRequest {
|
|
@@ -630,12 +804,19 @@ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body,
|
|
|
630
804
|
message: string;
|
|
631
805
|
}>;
|
|
632
806
|
|
|
633
|
-
export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
|
|
807
|
+
export declare function saveMessagesHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
|
|
634
808
|
body: {
|
|
635
809
|
messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
|
|
636
810
|
};
|
|
637
811
|
}): Promise<MastraMessageV1[]>;
|
|
638
812
|
|
|
813
|
+
export declare function sendWorkflowRunEventHandler({ mastra, workflowId, runId, event, data, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
814
|
+
event: string;
|
|
815
|
+
data: unknown;
|
|
816
|
+
}): Promise<{
|
|
817
|
+
message: string;
|
|
818
|
+
}>;
|
|
819
|
+
|
|
639
820
|
declare type SerializedStep = {
|
|
640
821
|
id: string;
|
|
641
822
|
description: string;
|
|
@@ -694,13 +875,14 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
|
|
|
694
875
|
traceCount: number;
|
|
695
876
|
}>;
|
|
696
877
|
|
|
697
|
-
export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, clientSdkCompat, }: Context & {
|
|
878
|
+
export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, clientSdkCompat, abortSignal, }: Context & {
|
|
698
879
|
runtimeContext: RuntimeContext;
|
|
699
880
|
agentId: string;
|
|
700
881
|
body: GetBody<'stream'> & {
|
|
701
882
|
runtimeContext?: string;
|
|
702
883
|
};
|
|
703
884
|
clientSdkCompat?: string;
|
|
885
|
+
abortSignal?: AbortSignal;
|
|
704
886
|
}): Promise<Response | undefined>;
|
|
705
887
|
|
|
706
888
|
export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, clientSdkCompat, }: NetworkContext & {
|
|
@@ -711,11 +893,59 @@ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
|
|
|
711
893
|
clientSdkCompat?: string;
|
|
712
894
|
}): Promise<Response>;
|
|
713
895
|
|
|
896
|
+
export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
|
|
897
|
+
runtimeContext: RuntimeContext;
|
|
898
|
+
body: {
|
|
899
|
+
message: string;
|
|
900
|
+
threadId?: string;
|
|
901
|
+
resourceId?: string;
|
|
902
|
+
};
|
|
903
|
+
}): Promise<{
|
|
904
|
+
stream: ReadableStream_3<StreamEvent>;
|
|
905
|
+
getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
|
|
906
|
+
task: ZodString;
|
|
907
|
+
resourceId: ZodString;
|
|
908
|
+
resourceType: ZodEnum<["agent", "workflow", "none", "tool"]>;
|
|
909
|
+
prompt: ZodString;
|
|
910
|
+
result: ZodString;
|
|
911
|
+
isComplete: ZodOptional<ZodBoolean>;
|
|
912
|
+
completionReason: ZodOptional<ZodString>;
|
|
913
|
+
iteration: ZodNumber;
|
|
914
|
+
threadId: ZodOptional<ZodString>;
|
|
915
|
+
threadResourceId: ZodOptional<ZodString>;
|
|
916
|
+
isOneOff: ZodBoolean;
|
|
917
|
+
}, "strip", ZodTypeAny, {
|
|
918
|
+
result: string;
|
|
919
|
+
prompt: string;
|
|
920
|
+
resourceId: string;
|
|
921
|
+
task: string;
|
|
922
|
+
resourceType: "tool" | "none" | "workflow" | "agent";
|
|
923
|
+
iteration: number;
|
|
924
|
+
isOneOff: boolean;
|
|
925
|
+
threadId?: string | undefined;
|
|
926
|
+
threadResourceId?: string | undefined;
|
|
927
|
+
isComplete?: boolean | undefined;
|
|
928
|
+
completionReason?: string | undefined;
|
|
929
|
+
}, {
|
|
930
|
+
result: string;
|
|
931
|
+
prompt: string;
|
|
932
|
+
resourceId: string;
|
|
933
|
+
task: string;
|
|
934
|
+
resourceType: "tool" | "none" | "workflow" | "agent";
|
|
935
|
+
iteration: number;
|
|
936
|
+
isOneOff: boolean;
|
|
937
|
+
threadId?: string | undefined;
|
|
938
|
+
threadResourceId?: string | undefined;
|
|
939
|
+
isComplete?: boolean | undefined;
|
|
940
|
+
completionReason?: string | undefined;
|
|
941
|
+
}>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
|
|
942
|
+
}>;
|
|
943
|
+
|
|
714
944
|
export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
715
945
|
inputData?: unknown;
|
|
716
946
|
runtimeContext?: RuntimeContext_2;
|
|
717
947
|
}): Promise<{
|
|
718
|
-
stream:
|
|
948
|
+
stream: ReadableStream_2<StreamEvent>;
|
|
719
949
|
getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
|
|
720
950
|
}>;
|
|
721
951
|
|
|
@@ -785,10 +1015,21 @@ export declare type UnOfficalStatusCode = UnofficialStatusCode;
|
|
|
785
1015
|
*/
|
|
786
1016
|
export declare type UnofficialStatusCode = -1;
|
|
787
1017
|
|
|
788
|
-
export declare function updateThreadHandler({ mastra, agentId, threadId, body, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
|
|
1018
|
+
export declare function updateThreadHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
|
|
789
1019
|
body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
|
|
790
1020
|
}): Promise<StorageThreadType>;
|
|
791
1021
|
|
|
1022
|
+
/**
|
|
1023
|
+
* Handler to update the working memory for a thread (optionally resource-scoped).
|
|
1024
|
+
* @param threadId - the thread id
|
|
1025
|
+
* @param body - the body containing the working memory to update and the resource id (optional)
|
|
1026
|
+
*/
|
|
1027
|
+
export declare function updateWorkingMemoryHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
|
|
1028
|
+
body: Omit<Parameters<MastraMemory['updateWorkingMemory']>[0], 'threadId'>;
|
|
1029
|
+
}): Promise<{
|
|
1030
|
+
success: boolean;
|
|
1031
|
+
}>;
|
|
1032
|
+
|
|
792
1033
|
declare interface UpsertRequest {
|
|
793
1034
|
indexName: string;
|
|
794
1035
|
vectors: number[][];
|
|
@@ -859,7 +1100,9 @@ export declare namespace workflows {
|
|
|
859
1100
|
streamWorkflowHandler,
|
|
860
1101
|
resumeAsyncWorkflowHandler,
|
|
861
1102
|
resumeWorkflowHandler,
|
|
862
|
-
getWorkflowRunsHandler
|
|
1103
|
+
getWorkflowRunsHandler,
|
|
1104
|
+
cancelWorkflowRunHandler,
|
|
1105
|
+
sendWorkflowRunEventHandler
|
|
863
1106
|
}
|
|
864
1107
|
}
|
|
865
1108
|
|