@mastra/core 0.9.5-alpha.0 → 0.10.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/README.md +3 -2
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.d.cts +12 -13
- package/dist/agent/index.d.ts +12 -13
- package/dist/agent/index.js +1 -1
- package/dist/{base-CI7Uz2GO.d.ts → base-DttB7sJD.d.ts} +1172 -1130
- package/dist/{base-BV8SNIdm.d.cts → base-aJ3etsh5.d.cts} +1172 -1130
- package/dist/{base-H7siSAfu.d.cts → base-aPYtPBT2.d.cts} +3 -3
- package/dist/{base-4Z34GQL8.d.ts → base-tc5kgDTD.d.ts} +3 -3
- package/dist/base.cjs +2 -2
- package/dist/base.d.cts +2 -3
- package/dist/base.d.ts +2 -3
- package/dist/base.js +1 -1
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.d.cts +2 -3
- package/dist/bundler/index.d.ts +2 -3
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-W4BSLENO.js → chunk-2NTUAUGH.js} +1 -1
- package/dist/{chunk-MF5BUJO6.js → chunk-2PW6UJMW.js} +57 -9
- package/dist/{chunk-HKCSQI7G.cjs → chunk-2U7ZZUFO.cjs} +2 -2
- package/dist/{workflows/vNext/index.js → chunk-3SQ3G2EJ.js} +16 -15
- package/dist/chunk-5HULBQ2W.cjs +38 -0
- package/dist/{chunk-BATBI3D4.cjs → chunk-5JRD3NDP.cjs} +15 -15
- package/dist/{chunk-EYQLTWRJ.cjs → chunk-5W2G7S44.cjs} +33 -58
- package/dist/chunk-75Z4BZEE.js +36 -0
- package/dist/{chunk-S3Y7QBO7.cjs → chunk-AOGUTJUO.cjs} +57 -50
- package/dist/{chunk-BZUIFK6C.js → chunk-BPTSLJHA.js} +9 -9
- package/dist/{chunk-JBJ7KXN5.js → chunk-C3ICEF6E.js} +1 -1
- package/dist/{chunk-E4FAXBUV.cjs → chunk-CWSFP2HS.cjs} +2 -2
- package/dist/{chunk-RWWUZTAK.js → chunk-E7CLY6SK.js} +41 -34
- package/dist/{chunk-235X76GC.js → chunk-FI7R232B.js} +2 -2
- package/dist/chunk-GQ2XQ4UN.js +321 -0
- package/dist/{chunk-6EPEYXAE.js → chunk-J7GDGV6F.js} +1 -1
- package/dist/{chunk-NLBJOFNG.js → chunk-JW5TMK2L.js} +1 -1
- package/dist/{chunk-NOPY74PV.js → chunk-KJQFFEEQ.js} +1 -1
- package/dist/{chunk-V2Q2FEVO.cjs → chunk-KSPHQSZX.cjs} +2 -2
- package/dist/{chunk-SU4O2A72.js → chunk-LHRZV5VG.js} +1 -22
- package/dist/chunk-NMDM4IZN.cjs +78 -0
- package/dist/chunk-OBEALYTK.js +74 -0
- package/dist/{chunk-PU2TNRKO.js → chunk-OCT2762Q.js} +1 -1
- package/dist/{chunk-5DUFC7TV.cjs → chunk-P7BGXOQV.cjs} +2 -2
- package/dist/{chunk-NQE264UM.cjs → chunk-PIZM25KI.cjs} +2 -23
- package/dist/{chunk-S7J63JOG.cjs → chunk-RVS6OUJN.cjs} +2 -2
- package/dist/{chunk-LF5CE7LU.cjs → chunk-SKG2NIZW.cjs} +2 -2
- package/dist/chunk-SWW4EBUZ.cjs +96 -0
- package/dist/{chunk-RGE4UF6A.cjs → chunk-TMPFLJLG.cjs} +2 -2
- package/dist/{workflows/vNext/index.cjs → chunk-TTKQ37ZZ.cjs} +21 -20
- package/dist/{chunk-F7HNPG53.cjs → chunk-U3L3NEOM.cjs} +58 -10
- package/dist/chunk-VHLL4AZK.js +90 -0
- package/dist/{chunk-EG74VBSP.cjs → chunk-YEULQPUY.cjs} +6 -6
- package/dist/{chunk-RVKA5VUT.js → chunk-ZB3LEHL2.js} +31 -56
- package/dist/{chunk-TAFOICHR.js → chunk-ZKN6HYYQ.js} +1 -1
- package/dist/chunk-ZZDAC5KD.cjs +325 -0
- package/dist/deployer/index.cjs +2 -2
- package/dist/deployer/index.d.cts +2 -3
- package/dist/deployer/index.d.ts +2 -3
- package/dist/deployer/index.js +1 -1
- package/dist/eval/index.d.cts +12 -13
- package/dist/eval/index.d.ts +12 -13
- package/dist/hooks/index.d.cts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/index.cjs +71 -158
- package/dist/index.d.cts +16 -24
- package/dist/index.d.ts +16 -24
- package/dist/index.js +16 -23
- package/dist/integration/index.cjs +3 -3
- package/dist/integration/index.d.cts +11 -12
- package/dist/integration/index.d.ts +11 -12
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.d.cts +11 -12
- package/dist/llm/index.d.ts +11 -12
- package/dist/logger/index.cjs +18 -17
- package/dist/logger/index.d.cts +42 -2
- package/dist/logger/index.d.ts +42 -2
- package/dist/logger/index.js +2 -1
- package/dist/{index-QV27jkxQ.d.ts → logger-EhZkzZOr.d.cts} +38 -52
- package/dist/{index-QV27jkxQ.d.cts → logger-EhZkzZOr.d.ts} +38 -52
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.cts +10 -11
- package/dist/mastra/index.d.ts +10 -11
- package/dist/mastra/index.js +1 -1
- package/dist/mcp/index.cjs +4 -4
- package/dist/mcp/index.d.cts +13 -14
- package/dist/mcp/index.d.ts +13 -14
- package/dist/mcp/index.js +2 -2
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.d.cts +11 -12
- package/dist/memory/index.d.ts +11 -12
- package/dist/memory/index.js +1 -1
- package/dist/network/index.cjs +8 -8
- package/dist/network/index.d.cts +11 -12
- package/dist/network/index.d.ts +11 -12
- package/dist/network/index.js +4 -4
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.d.cts +14 -15
- package/dist/relevance/index.d.ts +14 -15
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.cjs +4 -0
- package/dist/server/index.d.cts +14 -13
- package/dist/server/index.d.ts +14 -13
- package/dist/server/index.js +4 -1
- package/dist/storage/index.cjs +184 -3
- package/dist/storage/index.d.cts +82 -12
- package/dist/storage/index.d.ts +82 -12
- package/dist/storage/index.js +186 -1
- package/dist/telemetry/index.d.cts +13 -14
- package/dist/telemetry/index.d.ts +13 -14
- package/dist/telemetry/otel-vendor.cjs +2 -2
- package/dist/telemetry/otel-vendor.d.cts +1 -1
- package/dist/telemetry/otel-vendor.d.ts +1 -1
- package/dist/telemetry/otel-vendor.js +1 -1
- package/dist/tools/index.cjs +4 -4
- package/dist/tools/index.d.cts +11 -12
- package/dist/tools/index.d.ts +11 -12
- package/dist/tools/index.js +1 -1
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.d.cts +2 -3
- package/dist/tts/index.d.ts +2 -3
- package/dist/tts/index.js +1 -1
- package/dist/{types-BtMyV38I.d.ts → types-Bo1uigWx.d.cts} +1 -1
- package/dist/{types-BtMyV38I.d.cts → types-Bo1uigWx.d.ts} +1 -1
- package/dist/utils.cjs +16 -16
- package/dist/utils.d.cts +14 -15
- package/dist/utils.d.ts +14 -15
- package/dist/utils.js +1 -1
- package/dist/vector/filter/index.cjs +189 -7
- package/dist/vector/filter/index.js +190 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.d.cts +10 -24
- package/dist/vector/index.d.ts +10 -24
- package/dist/vector/index.js +1 -1
- package/dist/voice/index.cjs +4 -4
- package/dist/voice/index.d.cts +11 -12
- package/dist/voice/index.d.ts +11 -12
- package/dist/voice/index.js +1 -1
- package/dist/workflows/index.cjs +17 -69
- package/dist/workflows/index.d.cts +195 -75
- package/dist/workflows/index.d.ts +195 -75
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/legacy/index.cjs +90 -0
- package/dist/workflows/legacy/index.d.cts +87 -0
- package/dist/workflows/legacy/index.d.ts +87 -0
- package/dist/workflows/legacy/index.js +1 -0
- package/package.json +19 -41
- package/workflows/legacy.d.ts +1 -0
- package/dist/chunk-CMPPXW4U.js +0 -154
- package/dist/chunk-GH6EMQSO.js +0 -131
- package/dist/chunk-JMJXBE7L.js +0 -843
- package/dist/chunk-LGERQTJM.js +0 -190
- package/dist/chunk-O44MSFMZ.cjs +0 -168
- package/dist/chunk-T6DN4C76.cjs +0 -134
- package/dist/chunk-UCZWRJRW.cjs +0 -667
- package/dist/chunk-YK3XJ52U.cjs +0 -192
- package/dist/chunk-YNOTY72R.cjs +0 -845
- package/dist/chunk-ZY2DW2VQ.js +0 -658
- package/dist/storage/libsql/index.cjs +0 -588
- package/dist/storage/libsql/index.d.cts +0 -104
- package/dist/storage/libsql/index.d.ts +0 -104
- package/dist/storage/libsql/index.js +0 -585
- package/dist/vector/libsql/index.cjs +0 -14
- package/dist/vector/libsql/index.d.cts +0 -86
- package/dist/vector/libsql/index.d.ts +0 -86
- package/dist/vector/libsql/index.js +0 -1
- package/dist/workflows/vNext/index.d.cts +0 -209
- package/dist/workflows/vNext/index.d.ts +0 -209
- package/storage/libsql.d.ts +0 -1
- package/vector/libsql.d.ts +0 -1
- package/workflows/vNext.d.ts +0 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import * as ai from 'ai';
|
|
2
|
-
import { Tool as Tool$1, Schema, ToolExecutionOptions,
|
|
3
|
-
import { M as MastraBase, T as Telemetry, O as OtelConfig } from './base-
|
|
4
|
-
import {
|
|
2
|
+
import { Tool as Tool$1, Schema, ToolExecutionOptions, EmbeddingModel, CoreMessage as CoreMessage$1, Message, UserContent, AssistantContent, LanguageModel as LanguageModel$1, GenerateTextResult, GenerateObjectResult, StreamTextResult, StreamObjectResult, DeepPartial, generateText, generateObject, streamText, streamObject, TelemetrySettings, CoreSystemMessage as CoreSystemMessage$1, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, LanguageModelV1, GenerateTextOnStepFinishCallback, StreamTextOnFinishCallback, StreamObjectOnFinishCallback, StreamTextOnStepFinishCallback, ToolContent } from 'ai';
|
|
3
|
+
import { M as MastraBase, T as Telemetry, O as OtelConfig } from './base-tc5kgDTD.js';
|
|
4
|
+
import { M as Metric, a as MetricResult, T as TestInfo } from './types-Bo1uigWx.js';
|
|
5
5
|
import { Query } from 'sift';
|
|
6
6
|
import { z, ZodSchema } from 'zod';
|
|
7
7
|
import { JSONSchema7Type, JSONSchema7 } from 'json-schema';
|
|
8
|
-
import {
|
|
8
|
+
import { MastraDeployer } from './deployer/index.js';
|
|
9
|
+
import { B as BaseLogMessage, R as RegisteredLogger, I as IMastraLogger } from './logger-EhZkzZOr.js';
|
|
10
|
+
import * as http from 'node:http';
|
|
11
|
+
import { Context, Handler, MiddlewareHandler, HonoRequest } from 'hono';
|
|
9
12
|
import { RuntimeContext } from './runtime-context/index.js';
|
|
13
|
+
import { MastraVector } from './vector/index.js';
|
|
14
|
+
import { cors } from 'hono/cors';
|
|
15
|
+
import { DescribeRouteOptions } from 'hono-openapi';
|
|
16
|
+
import { MastraTTS } from './tts/index.js';
|
|
10
17
|
import { Span } from '@opentelemetry/api';
|
|
11
18
|
import * as xstate from 'xstate';
|
|
12
19
|
import { Snapshot } from 'xstate';
|
|
13
20
|
import EventEmitter from 'node:events';
|
|
14
|
-
import * as http from 'node:http';
|
|
15
|
-
import { Context, Handler, MiddlewareHandler } from 'hono';
|
|
16
|
-
import { MastraTTS } from './tts/index.js';
|
|
17
|
-
import { MastraVector } from './vector/index.js';
|
|
18
21
|
import EventEmitter$1 from 'events';
|
|
19
|
-
import { MastraDeployer } from './deployer/index.js';
|
|
20
|
-
import { cors } from 'hono/cors';
|
|
21
|
-
import { DescribeRouteOptions } from 'hono-openapi';
|
|
22
22
|
import { MockLanguageModelV1 } from 'ai/test';
|
|
23
23
|
|
|
24
24
|
type VercelTool = Tool$1;
|
|
@@ -75,494 +75,484 @@ declare function createTool<TSchemaIn extends z.ZodSchema | undefined = undefine
|
|
|
75
75
|
execute: (context: TContext) => Promise<any>;
|
|
76
76
|
} : Tool<TSchemaIn, TSchemaOut, TContext>;
|
|
77
77
|
|
|
78
|
-
type
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
execute: InternalCoreTool['execute'];
|
|
78
|
+
type RunStatus = 'created' | 'running' | 'completed' | 'failed';
|
|
79
|
+
type Run$1 = {
|
|
80
|
+
runId?: string;
|
|
81
|
+
runStatus?: RunStatus;
|
|
83
82
|
};
|
|
84
|
-
|
|
83
|
+
|
|
84
|
+
type MemoryProcessorOpts = {
|
|
85
|
+
systemMessage?: string;
|
|
86
|
+
memorySystemMessage?: string;
|
|
87
|
+
newMessages?: CoreMessage$1[];
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Interface for message processors that can filter or transform messages
|
|
91
|
+
* before they're sent to the LLM.
|
|
92
|
+
*/
|
|
93
|
+
declare abstract class MemoryProcessor extends MastraBase {
|
|
85
94
|
/**
|
|
86
|
-
*
|
|
95
|
+
* Process a list of messages and return a filtered or transformed list.
|
|
96
|
+
* @param messages The messages to process
|
|
97
|
+
* @returns The processed messages
|
|
87
98
|
*/
|
|
88
|
-
|
|
99
|
+
process(messages: CoreMessage$1[], _opts: MemoryProcessorOpts): CoreMessage$1[];
|
|
100
|
+
}
|
|
101
|
+
declare const memoryDefaultOptions: {
|
|
102
|
+
lastMessages: number;
|
|
103
|
+
semanticRecall: false;
|
|
104
|
+
threads: {
|
|
105
|
+
generateTitle: false;
|
|
106
|
+
};
|
|
107
|
+
workingMemory: {
|
|
108
|
+
enabled: false;
|
|
109
|
+
template: string;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Abstract Memory class that defines the interface for storing and retrieving
|
|
114
|
+
* conversation threads and messages.
|
|
115
|
+
*/
|
|
116
|
+
declare abstract class MastraMemory extends MastraBase {
|
|
117
|
+
MAX_CONTEXT_TOKENS?: number;
|
|
118
|
+
_storage?: MastraStorage;
|
|
119
|
+
vector?: MastraVector;
|
|
120
|
+
embedder?: EmbeddingModel<string>;
|
|
121
|
+
private processors;
|
|
122
|
+
protected threadConfig: MemoryConfig;
|
|
123
|
+
constructor(config: {
|
|
124
|
+
name: string;
|
|
125
|
+
} & SharedMemoryConfig);
|
|
126
|
+
protected _hasOwnStorage: boolean;
|
|
127
|
+
get hasOwnStorage(): boolean;
|
|
128
|
+
get storage(): MastraStorage;
|
|
129
|
+
setStorage(storage: MastraStorage): void;
|
|
130
|
+
setVector(vector: MastraVector): void;
|
|
131
|
+
setEmbedder(embedder: EmbeddingModel<string>): void;
|
|
89
132
|
/**
|
|
90
|
-
*
|
|
133
|
+
* Get a system message to inject into the conversation.
|
|
134
|
+
* This will be called before each conversation turn.
|
|
135
|
+
* Implementations can override this to inject custom system messages.
|
|
91
136
|
*/
|
|
92
|
-
|
|
137
|
+
getSystemMessage(_input: {
|
|
138
|
+
threadId: string;
|
|
139
|
+
memoryConfig?: MemoryConfig;
|
|
140
|
+
}): Promise<string | null>;
|
|
93
141
|
/**
|
|
94
|
-
*
|
|
142
|
+
* Get tools that should be available to the agent.
|
|
143
|
+
* This will be called when converting tools for the agent.
|
|
144
|
+
* Implementations can override this to provide additional tools.
|
|
95
145
|
*/
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
interface MCPServerSSEOptions extends MCPServerSSEOptionsBase {
|
|
146
|
+
getTools(_config?: MemoryConfig): Record<string, CoreTool>;
|
|
147
|
+
protected createEmbeddingIndex(dimensions?: number): Promise<{
|
|
148
|
+
indexName: string;
|
|
149
|
+
}>;
|
|
150
|
+
getMergedThreadConfig(config?: MemoryConfig): MemoryConfig;
|
|
102
151
|
/**
|
|
103
|
-
*
|
|
152
|
+
* Apply all configured message processors to a list of messages.
|
|
153
|
+
* @param messages The messages to process
|
|
154
|
+
* @returns The processed messages
|
|
104
155
|
*/
|
|
105
|
-
|
|
156
|
+
private applyProcessors;
|
|
157
|
+
processMessages({ messages, processors, ...opts }: {
|
|
158
|
+
messages: CoreMessage$1[];
|
|
159
|
+
processors?: MemoryProcessor[];
|
|
160
|
+
} & MemoryProcessorOpts): CoreMessage$1[];
|
|
161
|
+
abstract rememberMessages({ threadId, resourceId, vectorMessageSearch, systemMessage, config, }: {
|
|
162
|
+
threadId: string;
|
|
163
|
+
resourceId?: string;
|
|
164
|
+
vectorMessageSearch?: string;
|
|
165
|
+
systemMessage?: CoreMessage$1;
|
|
166
|
+
config?: MemoryConfig;
|
|
167
|
+
}): Promise<{
|
|
168
|
+
threadId: string;
|
|
169
|
+
messages: CoreMessage$1[];
|
|
170
|
+
uiMessages: Message[];
|
|
171
|
+
}>;
|
|
172
|
+
estimateTokens(text: string): number;
|
|
173
|
+
protected parseMessages(messages: MessageType[]): CoreMessage$1[];
|
|
174
|
+
protected convertToUIMessages(messages: MessageType[]): Message[];
|
|
106
175
|
/**
|
|
107
|
-
*
|
|
176
|
+
* Retrieves a specific thread by its ID
|
|
177
|
+
* @param threadId - The unique identifier of the thread
|
|
178
|
+
* @returns Promise resolving to the thread or null if not found
|
|
108
179
|
*/
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
180
|
+
abstract getThreadById({ threadId }: {
|
|
181
|
+
threadId: string;
|
|
182
|
+
}): Promise<StorageThreadType | null>;
|
|
183
|
+
abstract getThreadsByResourceId({ resourceId }: {
|
|
184
|
+
resourceId: string;
|
|
185
|
+
}): Promise<StorageThreadType[]>;
|
|
115
186
|
/**
|
|
116
|
-
*
|
|
187
|
+
* Saves or updates a thread
|
|
188
|
+
* @param thread - The thread data to save
|
|
189
|
+
* @returns Promise resolving to the saved thread
|
|
117
190
|
*/
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
191
|
+
abstract saveThread({ thread, memoryConfig, }: {
|
|
192
|
+
thread: StorageThreadType;
|
|
193
|
+
memoryConfig?: MemoryConfig;
|
|
194
|
+
}): Promise<StorageThreadType>;
|
|
121
195
|
/**
|
|
122
|
-
*
|
|
196
|
+
* Saves messages to a thread
|
|
197
|
+
* @param messages - Array of messages to save
|
|
198
|
+
* @returns Promise resolving to the saved messages
|
|
123
199
|
*/
|
|
124
|
-
|
|
200
|
+
abstract saveMessages({ messages, memoryConfig, }: {
|
|
201
|
+
messages: MessageType[];
|
|
202
|
+
memoryConfig: MemoryConfig | undefined;
|
|
203
|
+
}): Promise<MessageType[]>;
|
|
125
204
|
/**
|
|
126
|
-
*
|
|
205
|
+
* Retrieves all messages for a specific thread
|
|
206
|
+
* @param threadId - The unique identifier of the thread
|
|
207
|
+
* @returns Promise resolving to array of messages and uiMessages
|
|
127
208
|
*/
|
|
128
|
-
|
|
209
|
+
abstract query({ threadId, resourceId, selectBy, }: StorageGetMessagesArg): Promise<{
|
|
210
|
+
messages: CoreMessage$1[];
|
|
211
|
+
uiMessages: Message[];
|
|
212
|
+
}>;
|
|
129
213
|
/**
|
|
130
|
-
*
|
|
214
|
+
* Helper method to create a new thread
|
|
215
|
+
* @param title - Optional title for the thread
|
|
216
|
+
* @param metadata - Optional metadata for the thread
|
|
217
|
+
* @returns Promise resolving to the created thread
|
|
131
218
|
*/
|
|
132
|
-
|
|
219
|
+
createThread({ threadId, resourceId, title, metadata, memoryConfig, }: {
|
|
220
|
+
resourceId: string;
|
|
221
|
+
threadId?: string;
|
|
222
|
+
title?: string;
|
|
223
|
+
metadata?: Record<string, unknown>;
|
|
224
|
+
memoryConfig?: MemoryConfig;
|
|
225
|
+
}): Promise<StorageThreadType>;
|
|
133
226
|
/**
|
|
134
|
-
*
|
|
227
|
+
* Helper method to delete a thread
|
|
228
|
+
* @param threadId - the id of the thread to delete
|
|
135
229
|
*/
|
|
136
|
-
|
|
230
|
+
abstract deleteThread(threadId: string): Promise<void>;
|
|
137
231
|
/**
|
|
138
|
-
*
|
|
232
|
+
* Helper method to add a single message to a thread
|
|
233
|
+
* @param threadId - The thread to add the message to
|
|
234
|
+
* @param content - The message content
|
|
235
|
+
* @param role - The role of the message sender
|
|
236
|
+
* @param type - The type of the message
|
|
237
|
+
* @param toolNames - Optional array of tool names that were called
|
|
238
|
+
* @param toolCallArgs - Optional array of tool call arguments
|
|
239
|
+
* @param toolCallIds - Optional array of tool call ids
|
|
240
|
+
* @returns Promise resolving to the saved message
|
|
139
241
|
*/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
release_date: string;
|
|
157
|
-
/** Indicates if this version is the latest available. */
|
|
158
|
-
is_latest: boolean;
|
|
242
|
+
addMessage({ threadId, resourceId, config, content, role, type, toolNames, toolCallArgs, toolCallIds, }: {
|
|
243
|
+
threadId: string;
|
|
244
|
+
resourceId: string;
|
|
245
|
+
config?: MemoryConfig;
|
|
246
|
+
content: UserContent | AssistantContent;
|
|
247
|
+
role: 'user' | 'assistant';
|
|
248
|
+
type: 'text' | 'tool-call' | 'tool-result';
|
|
249
|
+
toolNames?: string[];
|
|
250
|
+
toolCallArgs?: Record<string, unknown>[];
|
|
251
|
+
toolCallIds?: string[];
|
|
252
|
+
}): Promise<MessageType>;
|
|
253
|
+
/**
|
|
254
|
+
* Generates a unique identifier
|
|
255
|
+
* @returns A unique string ID
|
|
256
|
+
*/
|
|
257
|
+
generateId(): string;
|
|
159
258
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
name:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
259
|
+
|
|
260
|
+
declare class MastraLLMBase extends MastraBase {
|
|
261
|
+
#private;
|
|
262
|
+
constructor({ name, model }: {
|
|
263
|
+
name: string;
|
|
264
|
+
model: LanguageModel$1;
|
|
265
|
+
});
|
|
266
|
+
getProvider(): string;
|
|
267
|
+
getModelId(): string;
|
|
268
|
+
getModel(): ai.LanguageModelV1;
|
|
269
|
+
convertToMessages(messages: string | string[] | CoreMessage$1[]): CoreMessage$1[];
|
|
270
|
+
__registerPrimitives(p: MastraPrimitives): void;
|
|
271
|
+
__registerMastra(p: Mastra): void;
|
|
272
|
+
__text<Z extends ZodSchema | JSONSchema7 | undefined>(input: LLMTextOptions<Z>): Promise<GenerateTextResult<any, any>>;
|
|
273
|
+
__textObject<T extends ZodSchema | JSONSchema7 | undefined>(input: LLMTextObjectOptions<T>): Promise<GenerateObjectResult<T>>;
|
|
274
|
+
generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], options: LLMStreamOptions<Z>): Promise<GenerateReturn<Z>>;
|
|
275
|
+
__stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(input: LLMInnerStreamOptions<Z>): Promise<StreamTextResult<any, any>>;
|
|
276
|
+
__streamObject<T extends ZodSchema | JSONSchema7 | undefined>(input: LLMStreamObjectOptions<T>): Promise<StreamObjectResult<DeepPartial<T>, T, never>>;
|
|
277
|
+
stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], options: LLMStreamOptions<Z>): Promise<StreamReturn<Z>>;
|
|
176
278
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
* Optional release date of this server version (ISO 8601 string).
|
|
268
|
-
* Defaults to the time of instantiation if not provided.
|
|
269
|
-
*/
|
|
270
|
-
releaseDate?: string;
|
|
271
|
-
/**
|
|
272
|
-
* Optional flag indicating if this is the latest version.
|
|
273
|
-
* Defaults to true if not provided.
|
|
274
|
-
*/
|
|
275
|
-
isLatest?: boolean;
|
|
276
|
-
/**
|
|
277
|
-
* Optional canonical packaging format if the server is distributed as a package
|
|
278
|
-
* (e.g., "npm", "docker").
|
|
279
|
-
*/
|
|
280
|
-
packageCanonical?: 'npm' | 'docker' | 'pypi' | 'crates' | string;
|
|
281
|
-
/** Optional list of installable packages for this server. */
|
|
282
|
-
packages?: PackageInfo[];
|
|
283
|
-
/** Optional list of remote access points for this server. */
|
|
284
|
-
remotes?: RemoteInfo[];
|
|
279
|
+
|
|
280
|
+
declare function createMockModel({ objectGenerationMode, mockText, spyGenerate, spyStream, }: {
|
|
281
|
+
objectGenerationMode?: 'json';
|
|
282
|
+
mockText: string | Record<string, any>;
|
|
283
|
+
spyGenerate?: (props: any) => void;
|
|
284
|
+
spyStream?: (props: any) => void;
|
|
285
|
+
}): MockLanguageModelV1;
|
|
286
|
+
|
|
287
|
+
type LanguageModel = MastraLanguageModel;
|
|
288
|
+
type CoreMessage = CoreMessage$1;
|
|
289
|
+
type CoreSystemMessage = CoreSystemMessage$1;
|
|
290
|
+
type CoreAssistantMessage = CoreAssistantMessage$1;
|
|
291
|
+
type CoreUserMessage = CoreUserMessage$1;
|
|
292
|
+
type CoreToolMessage = CoreToolMessage$1;
|
|
293
|
+
type EmbedResult<T> = EmbedResult$1<T>;
|
|
294
|
+
type EmbedManyResult<T> = EmbedManyResult$1<T>;
|
|
295
|
+
type BaseStructuredOutputType = 'string' | 'number' | 'boolean' | 'date';
|
|
296
|
+
type StructuredOutputType = 'array' | 'string' | 'number' | 'object' | 'boolean' | 'date';
|
|
297
|
+
type StructuredOutputArrayItem = {
|
|
298
|
+
type: BaseStructuredOutputType;
|
|
299
|
+
} | {
|
|
300
|
+
type: 'object';
|
|
301
|
+
items: StructuredOutput;
|
|
302
|
+
};
|
|
303
|
+
type StructuredOutput = {
|
|
304
|
+
[key: string]: {
|
|
305
|
+
type: BaseStructuredOutputType;
|
|
306
|
+
} | {
|
|
307
|
+
type: 'object';
|
|
308
|
+
items: StructuredOutput;
|
|
309
|
+
} | {
|
|
310
|
+
type: 'array';
|
|
311
|
+
items: StructuredOutputArrayItem;
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
type GenerateReturn<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = Z extends undefined ? GenerateTextResult<any, Z extends ZodSchema ? z.infer<Z> : unknown> : GenerateObjectResult<Z extends ZodSchema ? z.infer<Z> : unknown>;
|
|
315
|
+
type StreamReturn<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = Z extends undefined ? StreamTextResult<any, Z extends ZodSchema ? z.infer<Z> : unknown> : StreamObjectResult<any, Z extends ZodSchema ? z.infer<Z> : unknown, any>;
|
|
316
|
+
type OutputType = StructuredOutput | ZodSchema | JSONSchema7 | undefined;
|
|
317
|
+
type GenerateTextOptions = Parameters<typeof generateText>[0];
|
|
318
|
+
type StreamTextOptions = Parameters<typeof streamText>[0];
|
|
319
|
+
type GenerateObjectOptions = Parameters<typeof generateObject>[0];
|
|
320
|
+
type StreamObjectOptions = Parameters<typeof streamObject>[0];
|
|
321
|
+
type MastraCustomLLMOptionsKeys = 'messages' | 'tools' | 'model' | 'onStepFinish' | 'experimental_output' | 'experimental_telemetry' | 'messages' | 'onFinish' | 'output';
|
|
322
|
+
type DefaultLLMTextOptions = Omit<GenerateTextOptions, MastraCustomLLMOptionsKeys>;
|
|
323
|
+
type DefaultLLMTextObjectOptions = Omit<GenerateObjectOptions, MastraCustomLLMOptionsKeys>;
|
|
324
|
+
type DefaultLLMStreamOptions = Omit<StreamTextOptions, MastraCustomLLMOptionsKeys>;
|
|
325
|
+
type DefaultLLMStreamObjectOptions = Omit<StreamObjectOptions, MastraCustomLLMOptionsKeys>;
|
|
326
|
+
type MastraCustomLLMOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
327
|
+
tools?: Record<string, CoreTool>;
|
|
328
|
+
onStepFinish?: (step: unknown) => Promise<void> | void;
|
|
329
|
+
experimental_output?: Z;
|
|
330
|
+
telemetry?: TelemetrySettings;
|
|
331
|
+
threadId?: string;
|
|
332
|
+
resourceId?: string;
|
|
333
|
+
runtimeContext: RuntimeContext;
|
|
334
|
+
} & Run$1;
|
|
335
|
+
type LLMTextOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
336
|
+
messages: CoreMessage[];
|
|
337
|
+
} & MastraCustomLLMOptions<Z> & DefaultLLMTextOptions;
|
|
338
|
+
type LLMTextObjectOptions<T extends ZodSchema | JSONSchema7 | undefined = undefined> = LLMTextOptions<T> & DefaultLLMTextObjectOptions & {
|
|
339
|
+
structuredOutput: JSONSchema7 | z.ZodType<T> | StructuredOutput;
|
|
340
|
+
};
|
|
341
|
+
type LLMStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
342
|
+
output?: OutputType | Z;
|
|
343
|
+
onFinish?: (result: string) => Promise<void> | void;
|
|
344
|
+
} & MastraCustomLLMOptions<Z> & DefaultLLMStreamOptions;
|
|
345
|
+
type LLMInnerStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
346
|
+
messages: CoreMessage[];
|
|
347
|
+
onFinish?: (result: string) => Promise<void> | void;
|
|
348
|
+
} & MastraCustomLLMOptions<Z> & DefaultLLMStreamOptions;
|
|
349
|
+
type LLMStreamObjectOptions<T extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
350
|
+
structuredOutput: JSONSchema7 | z.ZodType<T> | StructuredOutput;
|
|
351
|
+
} & LLMInnerStreamOptions<T> & DefaultLLMStreamObjectOptions;
|
|
352
|
+
|
|
353
|
+
type VoiceEventType = 'speaking' | 'writing' | 'error' | string;
|
|
354
|
+
interface VoiceEventMap {
|
|
355
|
+
speaker: NodeJS.ReadableStream;
|
|
356
|
+
speaking: {
|
|
357
|
+
audio?: string;
|
|
358
|
+
};
|
|
359
|
+
writing: {
|
|
360
|
+
text: string;
|
|
361
|
+
role: 'assistant' | 'user';
|
|
362
|
+
};
|
|
363
|
+
error: {
|
|
364
|
+
message: string;
|
|
365
|
+
code?: string;
|
|
366
|
+
details?: unknown;
|
|
367
|
+
};
|
|
368
|
+
[key: string]: unknown;
|
|
285
369
|
}
|
|
286
|
-
|
|
287
|
-
interface ServerInfo {
|
|
288
|
-
/** The unique ID of the server. */
|
|
289
|
-
id: string;
|
|
290
|
-
/** The name of the server. */
|
|
370
|
+
interface BuiltInModelConfig {
|
|
291
371
|
name: string;
|
|
292
|
-
|
|
293
|
-
description?: string;
|
|
294
|
-
/** Repository information for the server. */
|
|
295
|
-
repository?: Repository;
|
|
296
|
-
/** Detailed version information. */
|
|
297
|
-
version_detail: VersionDetail;
|
|
372
|
+
apiKey?: string;
|
|
298
373
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
374
|
+
interface VoiceConfig<T = unknown> {
|
|
375
|
+
listeningModel?: BuiltInModelConfig;
|
|
376
|
+
speechModel?: BuiltInModelConfig;
|
|
377
|
+
speaker?: string;
|
|
378
|
+
name?: string;
|
|
379
|
+
realtimeConfig?: {
|
|
380
|
+
model?: string;
|
|
381
|
+
apiKey?: string;
|
|
382
|
+
options?: T;
|
|
383
|
+
};
|
|
307
384
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
/** The semantic version of the MCP server. */
|
|
320
|
-
readonly version: string;
|
|
321
|
-
/** Internal storage for the server's unique ID. */
|
|
322
|
-
private _id;
|
|
323
|
-
/** A description of what the MCP server does. */
|
|
324
|
-
readonly description?: string;
|
|
325
|
-
/** Repository information for the server's source code. */
|
|
326
|
-
readonly repository?: Repository;
|
|
327
|
-
/** The release date of this server version (ISO 8601 string). */
|
|
328
|
-
readonly releaseDate: string;
|
|
329
|
-
/** Indicates if this version is the latest available. */
|
|
330
|
-
readonly isLatest: boolean;
|
|
331
|
-
/** The canonical packaging format (e.g., "npm", "docker"), if applicable. */
|
|
332
|
-
readonly packageCanonical?: MCPServerConfig['packageCanonical'];
|
|
333
|
-
/** Information about installable packages for this server. */
|
|
334
|
-
readonly packages?: PackageInfo[];
|
|
335
|
-
/** Information about remote access points for this server. */
|
|
336
|
-
readonly remotes?: RemoteInfo[];
|
|
337
|
-
/** The tools registered with and converted by this MCP server. */
|
|
338
|
-
readonly convertedTools: Record<string, ConvertedTool>;
|
|
339
|
-
/** Reference to the Mastra instance if this server is registered with one. */
|
|
340
|
-
mastra: Mastra | undefined;
|
|
341
|
-
/**
|
|
342
|
-
* Public getter for the server's unique ID.
|
|
343
|
-
* The ID is set at construction or by Mastra and is read-only afterwards.
|
|
344
|
-
*/
|
|
345
|
-
get id(): string;
|
|
346
|
-
/**
|
|
347
|
-
* Gets a read-only view of the registered tools.
|
|
348
|
-
* @returns A readonly record of converted tools.
|
|
349
|
-
*/
|
|
350
|
-
tools(): Readonly<Record<string, ConvertedTool>>;
|
|
351
|
-
/**
|
|
352
|
-
* Sets the server's unique ID. This method is typically called by Mastra when
|
|
353
|
-
* registering the server, using the key provided in the Mastra configuration.
|
|
354
|
-
* It ensures the ID is set only once.
|
|
355
|
-
* If an ID was already provided in the MCPServerConfig, this method will be a no-op.
|
|
356
|
-
* @param id The unique ID to assign to the server.
|
|
357
|
-
*/
|
|
358
|
-
setId(id: string): void;
|
|
385
|
+
declare abstract class MastraVoice<TOptions = unknown, TSpeakOptions = unknown, TListenOptions = unknown, TTools extends ToolsInput = ToolsInput, TEventArgs extends VoiceEventMap = VoiceEventMap, TSpeakerMetadata = unknown> extends MastraBase {
|
|
386
|
+
protected listeningModel?: BuiltInModelConfig;
|
|
387
|
+
protected speechModel?: BuiltInModelConfig;
|
|
388
|
+
protected speaker?: string;
|
|
389
|
+
protected realtimeConfig?: {
|
|
390
|
+
model?: string;
|
|
391
|
+
apiKey?: string;
|
|
392
|
+
options?: TOptions;
|
|
393
|
+
};
|
|
394
|
+
constructor({ listeningModel, speechModel, speaker, realtimeConfig, name }?: VoiceConfig<TOptions>);
|
|
395
|
+
traced<T extends Function>(method: T, methodName: string): T;
|
|
359
396
|
/**
|
|
360
|
-
*
|
|
361
|
-
* @param
|
|
362
|
-
* @
|
|
397
|
+
* Convert text to speech
|
|
398
|
+
* @param input Text or text stream to convert to speech
|
|
399
|
+
* @param options Speech options including speaker and provider-specific options
|
|
400
|
+
* @returns Audio stream
|
|
363
401
|
*/
|
|
364
|
-
abstract convertTools(tools: ToolsInput): Record<string, ConvertedTool>;
|
|
365
402
|
/**
|
|
366
|
-
*
|
|
367
|
-
* @param
|
|
368
|
-
* @
|
|
403
|
+
* Convert text to speech
|
|
404
|
+
* @param input Text or text stream to convert to speech
|
|
405
|
+
* @param options Speech options including speaker and provider-specific options
|
|
406
|
+
* @returns Audio stream or void if in chat mode
|
|
369
407
|
*/
|
|
370
|
-
|
|
408
|
+
abstract speak(input: string | NodeJS.ReadableStream, options?: {
|
|
409
|
+
speaker?: string;
|
|
410
|
+
} & TSpeakOptions): Promise<NodeJS.ReadableStream | void>;
|
|
371
411
|
/**
|
|
372
|
-
*
|
|
373
|
-
* @param
|
|
412
|
+
* Convert speech to text
|
|
413
|
+
* @param audioStream Audio stream to transcribe
|
|
414
|
+
* @param options Provider-specific transcription options
|
|
415
|
+
* @returns Text or text stream
|
|
374
416
|
*/
|
|
375
|
-
constructor(config: MCPServerConfig);
|
|
376
417
|
/**
|
|
377
|
-
*
|
|
378
|
-
*
|
|
418
|
+
* Convert speech to text
|
|
419
|
+
* @param audioStream Audio stream to transcribe
|
|
420
|
+
* @param options Provider-specific transcription options
|
|
421
|
+
* @returns Text, text stream, or void if in chat mode
|
|
379
422
|
*/
|
|
380
|
-
abstract
|
|
423
|
+
abstract listen(audioStream: NodeJS.ReadableStream | unknown, // Allow other audio input types for OpenAI realtime API
|
|
424
|
+
options?: TListenOptions): Promise<string | NodeJS.ReadableStream | void>;
|
|
425
|
+
updateConfig(_options: Record<string, unknown>): void;
|
|
381
426
|
/**
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
* @param options Options for the SSE transport
|
|
427
|
+
* Initializes a WebSocket or WebRTC connection for real-time communication
|
|
428
|
+
* @returns Promise that resolves when the connection is established
|
|
385
429
|
*/
|
|
386
|
-
|
|
430
|
+
connect(_options?: Record<string, unknown>): Promise<void>;
|
|
387
431
|
/**
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
* @param options Options for the SSE transport
|
|
432
|
+
* Relay audio data to the voice provider for real-time processing
|
|
433
|
+
* @param audioData Audio data to relay
|
|
391
434
|
*/
|
|
392
|
-
|
|
435
|
+
send(_audioData: NodeJS.ReadableStream | Int16Array): Promise<void>;
|
|
393
436
|
/**
|
|
394
|
-
*
|
|
395
|
-
* @param options Options for the HTTP transport
|
|
437
|
+
* Trigger voice providers to respond
|
|
396
438
|
*/
|
|
397
|
-
|
|
439
|
+
answer(_options?: Record<string, unknown>): Promise<void>;
|
|
398
440
|
/**
|
|
399
|
-
*
|
|
441
|
+
* Equip the voice provider with instructions
|
|
442
|
+
* @param instructions Instructions to add
|
|
400
443
|
*/
|
|
401
|
-
|
|
444
|
+
addInstructions(_instructions?: string): void;
|
|
402
445
|
/**
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
* @returns ServerInfo object containing basic server metadata.
|
|
446
|
+
* Equip the voice provider with tools
|
|
447
|
+
* @param tools Array of tools to add
|
|
406
448
|
*/
|
|
407
|
-
|
|
449
|
+
addTools(_tools: TTools): void;
|
|
408
450
|
/**
|
|
409
|
-
*
|
|
410
|
-
* This includes all information from `getServerInfo` plus package and remote details.
|
|
411
|
-
* @returns ServerDetailInfo object containing comprehensive server metadata.
|
|
451
|
+
* Disconnect from the WebSocket or WebRTC connection
|
|
412
452
|
*/
|
|
413
|
-
|
|
453
|
+
close(): void;
|
|
414
454
|
/**
|
|
415
|
-
*
|
|
416
|
-
* @
|
|
455
|
+
* Register an event listener
|
|
456
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
457
|
+
* @param callback Callback function that receives event data
|
|
417
458
|
*/
|
|
418
|
-
|
|
419
|
-
tools: Array<{
|
|
420
|
-
name: string;
|
|
421
|
-
description?: string;
|
|
422
|
-
inputSchema: string;
|
|
423
|
-
}>;
|
|
424
|
-
};
|
|
459
|
+
on<E extends VoiceEventType>(_event: E, _callback: (data: E extends keyof TEventArgs ? TEventArgs[E] : unknown) => void): void;
|
|
425
460
|
/**
|
|
426
|
-
*
|
|
427
|
-
* @param
|
|
428
|
-
* @
|
|
461
|
+
* Remove an event listener
|
|
462
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
463
|
+
* @param callback Callback function to remove
|
|
429
464
|
*/
|
|
430
|
-
|
|
431
|
-
name: string;
|
|
432
|
-
description?: string;
|
|
433
|
-
inputSchema: string;
|
|
434
|
-
} | undefined;
|
|
465
|
+
off<E extends VoiceEventType>(_event: E, _callback: (data: E extends keyof TEventArgs ? TEventArgs[E] : unknown) => void): void;
|
|
435
466
|
/**
|
|
436
|
-
*
|
|
437
|
-
* @
|
|
438
|
-
* @param args The arguments to pass to the tool's execute function.
|
|
439
|
-
* @param executionContext Optional context for the tool execution (e.g., messages, toolCallId).
|
|
440
|
-
* @returns A promise that resolves to the result of the tool execution.
|
|
441
|
-
* @throws Error if the tool is not found, or if execution fails.
|
|
467
|
+
* Get available speakers/voices
|
|
468
|
+
* @returns Array of available voice IDs and their metadata
|
|
442
469
|
*/
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
}): Promise<any>;
|
|
470
|
+
getSpeakers(): Promise<Array<{
|
|
471
|
+
voiceId: string;
|
|
472
|
+
} & TSpeakerMetadata>>;
|
|
447
473
|
}
|
|
448
474
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
agent: string;
|
|
479
|
-
includeHistory?: boolean | undefined;
|
|
480
|
-
}[];
|
|
481
|
-
}, {
|
|
482
|
-
actions: {
|
|
483
|
-
input: string;
|
|
484
|
-
agent: string;
|
|
485
|
-
includeHistory?: boolean | undefined;
|
|
486
|
-
}[];
|
|
487
|
-
}>, undefined, ToolExecutionContext<z.ZodObject<{
|
|
488
|
-
actions: z.ZodArray<z.ZodObject<{
|
|
489
|
-
agent: z.ZodString;
|
|
490
|
-
input: z.ZodString;
|
|
491
|
-
includeHistory: z.ZodOptional<z.ZodBoolean>;
|
|
492
|
-
}, "strip", z.ZodTypeAny, {
|
|
493
|
-
input: string;
|
|
494
|
-
agent: string;
|
|
495
|
-
includeHistory?: boolean | undefined;
|
|
496
|
-
}, {
|
|
497
|
-
input: string;
|
|
498
|
-
agent: string;
|
|
499
|
-
includeHistory?: boolean | undefined;
|
|
500
|
-
}>, "many">;
|
|
501
|
-
}, "strip", z.ZodTypeAny, {
|
|
502
|
-
actions: {
|
|
503
|
-
input: string;
|
|
504
|
-
agent: string;
|
|
505
|
-
includeHistory?: boolean | undefined;
|
|
506
|
-
}[];
|
|
507
|
-
}, {
|
|
508
|
-
actions: {
|
|
509
|
-
input: string;
|
|
510
|
-
agent: string;
|
|
511
|
-
includeHistory?: boolean | undefined;
|
|
512
|
-
}[];
|
|
513
|
-
}>>>;
|
|
514
|
-
};
|
|
515
|
-
getAgentHistory(agentId: string): {
|
|
516
|
-
input: string;
|
|
517
|
-
output: string;
|
|
518
|
-
timestamp: string;
|
|
519
|
-
}[];
|
|
475
|
+
declare class CompositeVoice extends MastraVoice<unknown, unknown, unknown, ToolsInput, VoiceEventMap> {
|
|
476
|
+
protected speakProvider?: MastraVoice;
|
|
477
|
+
protected listenProvider?: MastraVoice;
|
|
478
|
+
protected realtimeProvider?: MastraVoice;
|
|
479
|
+
constructor({ input, output, realtime, speakProvider, listenProvider, realtimeProvider, }: {
|
|
480
|
+
/** @deprecated use output instead */
|
|
481
|
+
speakProvider?: MastraVoice;
|
|
482
|
+
/** @deprecated use input instead */
|
|
483
|
+
listenProvider?: MastraVoice;
|
|
484
|
+
/** @deprecated use realtime instead */
|
|
485
|
+
realtimeProvider?: MastraVoice;
|
|
486
|
+
input?: MastraVoice;
|
|
487
|
+
output?: MastraVoice;
|
|
488
|
+
realtime?: MastraVoice;
|
|
489
|
+
});
|
|
490
|
+
/**
|
|
491
|
+
* Convert text to speech using the configured provider
|
|
492
|
+
* @param input Text or text stream to convert to speech
|
|
493
|
+
* @param options Speech options including speaker and provider-specific options
|
|
494
|
+
* @returns Audio stream or void if in realtime mode
|
|
495
|
+
*/
|
|
496
|
+
speak(input: string | NodeJS.ReadableStream, options?: {
|
|
497
|
+
speaker?: string;
|
|
498
|
+
} & any): Promise<NodeJS.ReadableStream | void>;
|
|
499
|
+
listen(audioStream: NodeJS.ReadableStream, options?: any): Promise<string | void | NodeJS.ReadableStream>;
|
|
500
|
+
getSpeakers(): Promise<{
|
|
501
|
+
voiceId: string;
|
|
502
|
+
}[]>;
|
|
503
|
+
updateConfig(options: Record<string, unknown>): void;
|
|
520
504
|
/**
|
|
521
|
-
*
|
|
522
|
-
* @returns
|
|
505
|
+
* Initializes a WebSocket or WebRTC connection for real-time communication
|
|
506
|
+
* @returns Promise that resolves when the connection is established
|
|
523
507
|
*/
|
|
524
|
-
|
|
525
|
-
[x: string]: {
|
|
526
|
-
input: string;
|
|
527
|
-
output: string;
|
|
528
|
-
timestamp: string;
|
|
529
|
-
}[];
|
|
530
|
-
};
|
|
508
|
+
connect(options?: Record<string, unknown>): Promise<void>;
|
|
531
509
|
/**
|
|
532
|
-
*
|
|
533
|
-
* @
|
|
510
|
+
* Relay audio data to the voice provider for real-time processing
|
|
511
|
+
* @param audioData Audio data to send
|
|
534
512
|
*/
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
513
|
+
send(audioData: NodeJS.ReadableStream | Int16Array): Promise<void>;
|
|
514
|
+
/**
|
|
515
|
+
* Trigger voice providers to respond
|
|
516
|
+
*/
|
|
517
|
+
answer(options?: Record<string, unknown>): Promise<void>;
|
|
518
|
+
/**
|
|
519
|
+
* Equip the voice provider with instructions
|
|
520
|
+
* @param instructions Instructions to add
|
|
521
|
+
*/
|
|
522
|
+
addInstructions(instructions: string): void;
|
|
523
|
+
/**
|
|
524
|
+
* Equip the voice provider with tools
|
|
525
|
+
* @param tools Array of tools to add
|
|
526
|
+
*/
|
|
527
|
+
addTools(tools: ToolsInput): void;
|
|
528
|
+
/**
|
|
529
|
+
* Disconnect from the WebSocket or WebRTC connection
|
|
530
|
+
*/
|
|
531
|
+
close(): void;
|
|
532
|
+
/**
|
|
533
|
+
* Register an event listener
|
|
534
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
535
|
+
* @param callback Callback function that receives event data
|
|
536
|
+
*/
|
|
537
|
+
on<E extends VoiceEventType>(event: E, callback: (data: E extends keyof VoiceEventMap ? VoiceEventMap[E] : unknown) => void): void;
|
|
538
|
+
/**
|
|
539
|
+
* Remove an event listener
|
|
540
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
541
|
+
* @param callback Callback function to remove
|
|
542
|
+
*/
|
|
543
|
+
off<E extends VoiceEventType>(event: E, callback: (data: E extends keyof VoiceEventMap ? VoiceEventMap[E] : unknown) => void): void;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
declare class DefaultVoice extends MastraVoice {
|
|
547
|
+
constructor();
|
|
548
|
+
speak(_input: string | NodeJS.ReadableStream): Promise<NodeJS.ReadableStream>;
|
|
549
|
+
listen(_input: string | NodeJS.ReadableStream): Promise<string>;
|
|
550
|
+
getSpeakers(): Promise<{
|
|
551
|
+
voiceId: string;
|
|
552
|
+
}[]>;
|
|
563
553
|
}
|
|
564
554
|
|
|
565
|
-
interface WorkflowOptions<TWorkflowName extends string = string, TSteps extends
|
|
555
|
+
interface WorkflowOptions<TWorkflowName extends string = string, TSteps extends LegacyStep<string, any, any, any>[] = LegacyStep<string, any, any, any>[], TTriggerSchema extends z.ZodObject<any> = any, TResultSchema extends z.ZodObject<any> = any> {
|
|
566
556
|
steps?: TSteps;
|
|
567
557
|
name: TWorkflowName;
|
|
568
558
|
triggerSchema?: TTriggerSchema;
|
|
@@ -593,7 +583,7 @@ interface StepAction<TId extends string, TSchemaIn extends z.ZodSchema | undefin
|
|
|
593
583
|
payload?: TSchemaIn extends z.ZodSchema ? Partial<z.infer<TSchemaIn>> : unknown;
|
|
594
584
|
execute: (context: TContext) => Promise<TSchemaOut extends z.ZodSchema ? z.infer<TSchemaOut> : unknown>;
|
|
595
585
|
retryConfig?: RetryConfig;
|
|
596
|
-
workflow?:
|
|
586
|
+
workflow?: LegacyWorkflow;
|
|
597
587
|
workflowId?: string;
|
|
598
588
|
}
|
|
599
589
|
interface SimpleConditionalType {
|
|
@@ -675,7 +665,7 @@ type Condition<TStep extends StepVariableType<any, any, any, any>, TTriggerSchem
|
|
|
675
665
|
} | {
|
|
676
666
|
not: Condition<TStep, TTriggerSchema>;
|
|
677
667
|
};
|
|
678
|
-
interface StepConfig<TStep extends StepAction<any, any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>, TTriggerSchema extends z.ZodObject<any>, TSteps extends
|
|
668
|
+
interface StepConfig<TStep extends StepAction<any, any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>, TTriggerSchema extends z.ZodObject<any>, TSteps extends LegacyStep<string, any, any, any>[] = LegacyStep<string, any, any, any>[]> {
|
|
679
669
|
when?: Condition<CondStep, TTriggerSchema> | ((args: {
|
|
680
670
|
context: WorkflowContext<TTriggerSchema, TSteps>;
|
|
681
671
|
mastra?: Mastra;
|
|
@@ -713,12 +703,12 @@ type StepSkipped = {
|
|
|
713
703
|
status: 'skipped';
|
|
714
704
|
};
|
|
715
705
|
type StepResult$1<T> = StepSuccess$1<T> | StepFailure$1 | StepSuspended$1<T> | StepWaiting | StepSkipped;
|
|
716
|
-
type StepsRecord$1<T extends readonly
|
|
706
|
+
type StepsRecord$1<T extends readonly LegacyStep<any, any, z.ZodType<any> | undefined>[]> = {
|
|
717
707
|
[K in T[number]['id']]: Extract<T[number], {
|
|
718
708
|
id: K;
|
|
719
709
|
}>;
|
|
720
710
|
};
|
|
721
|
-
interface
|
|
711
|
+
interface LegacyWorkflowRunResult<T extends z.ZodObject<any>, TSteps extends LegacyStep<string, any, z.ZodType<any> | undefined>[], TResult extends z.ZodObject<any>> {
|
|
722
712
|
triggerData?: z.infer<T>;
|
|
723
713
|
result?: z.infer<TResult>;
|
|
724
714
|
results: {
|
|
@@ -732,7 +722,7 @@ interface WorkflowRunResult<T extends z.ZodObject<any>, TSteps extends Step<stri
|
|
|
732
722
|
stepPath: string[];
|
|
733
723
|
}>;
|
|
734
724
|
}
|
|
735
|
-
interface WorkflowContext<TTrigger extends z.ZodObject<any> = any, TSteps extends
|
|
725
|
+
interface WorkflowContext<TTrigger extends z.ZodObject<any> = any, TSteps extends LegacyStep<string, any, any, any>[] = LegacyStep<string, any, any, any>[], TInputData extends Record<string, any> = Record<string, any>> {
|
|
736
726
|
isResume?: {
|
|
737
727
|
runId: string;
|
|
738
728
|
stepId: string;
|
|
@@ -746,7 +736,7 @@ interface WorkflowContext<TTrigger extends z.ZodObject<any> = any, TSteps extend
|
|
|
746
736
|
attempts: Record<string, number>;
|
|
747
737
|
getStepResult(stepId: 'trigger'): z.infer<TTrigger>;
|
|
748
738
|
getStepResult<T extends keyof StepsRecord$1<TSteps> | unknown>(stepId: T extends keyof StepsRecord$1<TSteps> ? T : string): T extends keyof StepsRecord$1<TSteps> ? StepsRecord$1<TSteps>[T]['outputSchema'] extends undefined ? unknown : z.infer<NonNullable<StepsRecord$1<TSteps>[T]['outputSchema']>> : T;
|
|
749
|
-
getStepResult<T extends
|
|
739
|
+
getStepResult<T extends LegacyStep<any, any, any, any>>(stepId: T): T['outputSchema'] extends undefined ? unknown : z.infer<NonNullable<T['outputSchema']>>;
|
|
750
740
|
}
|
|
751
741
|
interface WorkflowLogMessage extends BaseLogMessage {
|
|
752
742
|
type: typeof RegisteredLogger.WORKFLOW;
|
|
@@ -844,7 +834,7 @@ type WorkflowActions = {
|
|
|
844
834
|
type: 'updateStepResult' | 'setStepError' | 'notifyStepCompletion' | 'decrementAttemptCount';
|
|
845
835
|
params: WorkflowActionParams;
|
|
846
836
|
};
|
|
847
|
-
type
|
|
837
|
+
type LegacyWorkflowState = {
|
|
848
838
|
[key: string]: {
|
|
849
839
|
initial: 'pending';
|
|
850
840
|
states: {
|
|
@@ -918,7 +908,7 @@ type ExtractSchemaType$1<T extends z.ZodSchema> = T extends z.ZodSchema<infer V>
|
|
|
918
908
|
type PathsToStringProps$1<T> = T extends object ? {
|
|
919
909
|
[K in keyof T]: T[K] extends object ? K extends string ? K | `${K}.${PathsToStringProps$1<T[K]>}` : never : K extends string ? K : never;
|
|
920
910
|
}[keyof T] : never;
|
|
921
|
-
interface
|
|
911
|
+
interface LegacyWorkflowRunState {
|
|
922
912
|
value: Record<string, string>;
|
|
923
913
|
context: {
|
|
924
914
|
steps: Record<string, {
|
|
@@ -937,7 +927,7 @@ interface WorkflowRunState {
|
|
|
937
927
|
suspendedPaths: Record<string, number[]>;
|
|
938
928
|
runId: string;
|
|
939
929
|
timestamp: number;
|
|
940
|
-
childStates?: Record<string,
|
|
930
|
+
childStates?: Record<string, LegacyWorkflowRunState>;
|
|
941
931
|
suspendedSteps?: Record<string, string>;
|
|
942
932
|
}
|
|
943
933
|
type WorkflowResumeResult<TTriggerSchema extends z.ZodObject<any>> = {
|
|
@@ -945,7 +935,7 @@ type WorkflowResumeResult<TTriggerSchema extends z.ZodObject<any>> = {
|
|
|
945
935
|
results: Record<string, StepResult$1<any>>;
|
|
946
936
|
};
|
|
947
937
|
|
|
948
|
-
declare class
|
|
938
|
+
declare class LegacyStep<TStepId extends string = any, TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends StepExecutionContext<TSchemaIn> = StepExecutionContext<TSchemaIn>> implements StepAction<TStepId, TSchemaIn, TSchemaOut, TContext> {
|
|
949
939
|
id: TStepId;
|
|
950
940
|
description?: string;
|
|
951
941
|
inputSchema?: TSchemaIn;
|
|
@@ -957,12 +947,12 @@ declare class Step<TStepId extends string = any, TSchemaIn extends z.ZodSchema |
|
|
|
957
947
|
constructor({ id, description, execute, payload, outputSchema, inputSchema, retryConfig, }: StepAction<TStepId, TSchemaIn, TSchemaOut, TContext>);
|
|
958
948
|
}
|
|
959
949
|
|
|
960
|
-
declare class Machine<TSteps extends
|
|
950
|
+
declare class Machine<TSteps extends LegacyStep<any, any, any, any>[] = LegacyStep<any, any, any, any>[], TTriggerSchema extends z.ZodObject<any> = any, TResultSchema extends z.ZodObject<any> = any> extends EventEmitter {
|
|
961
951
|
#private;
|
|
962
|
-
logger:
|
|
952
|
+
logger: IMastraLogger;
|
|
963
953
|
name: string;
|
|
964
954
|
constructor({ logger, mastra, runtimeContext, workflowInstance, executionSpan, name, runId, steps, stepGraph, retryConfig, startStepId, }: {
|
|
965
|
-
logger:
|
|
955
|
+
logger: IMastraLogger;
|
|
966
956
|
mastra?: Mastra;
|
|
967
957
|
runtimeContext: RuntimeContext;
|
|
968
958
|
workflowInstance: WorkflowInstance;
|
|
@@ -980,9 +970,9 @@ declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any,
|
|
|
980
970
|
input?: any;
|
|
981
971
|
snapshot?: Snapshot<any>;
|
|
982
972
|
resumeData?: any;
|
|
983
|
-
}): Promise<Pick<
|
|
973
|
+
}): Promise<Pick<LegacyWorkflowRunResult<TTriggerSchema, TSteps, TResultSchema>, 'results' | 'activePaths' | 'runId' | 'timestamp'>>;
|
|
984
974
|
private initializeMachine;
|
|
985
|
-
getSnapshot(): xstate.MachineSnapshot<Omit<WorkflowContext<any,
|
|
975
|
+
getSnapshot(): xstate.MachineSnapshot<Omit<WorkflowContext<any, LegacyStep<string, any, any, any>[], Record<string, any>>, "getStepResult">, {
|
|
986
976
|
type: "RESET_TO_PENDING";
|
|
987
977
|
stepId: string;
|
|
988
978
|
} | {
|
|
@@ -1244,8 +1234,8 @@ declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any,
|
|
|
1244
1234
|
syncSnapshot?: boolean;
|
|
1245
1235
|
} & { [K in xstate.RequiredLogicInput<TLogic>]: unknown; }) | undefined], xstate.IsNotNever<xstate.RequiredLogicInput<TLogic>>>): xstate.ActorRefFromLogic<TLogic>;
|
|
1246
1236
|
};
|
|
1247
|
-
input: Omit<WorkflowContext<any,
|
|
1248
|
-
self: xstate.ActorRef<xstate.MachineSnapshot<Omit<WorkflowContext<any,
|
|
1237
|
+
input: Omit<WorkflowContext<any, LegacyStep<string, any, any, any>[], Record<string, any>>, "getStepResult">;
|
|
1238
|
+
self: xstate.ActorRef<xstate.MachineSnapshot<Omit<WorkflowContext<any, LegacyStep<string, any, any, any>[], Record<string, any>>, "getStepResult">, {
|
|
1249
1239
|
type: "RESET_TO_PENDING";
|
|
1250
1240
|
stepId: string;
|
|
1251
1241
|
} | {
|
|
@@ -1332,30 +1322,30 @@ declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any,
|
|
|
1332
1322
|
}> | undefined;
|
|
1333
1323
|
}
|
|
1334
1324
|
|
|
1335
|
-
interface WorkflowResultReturn<TResult extends z.ZodObject<any>, T extends z.ZodObject<any>, TSteps extends
|
|
1325
|
+
interface WorkflowResultReturn<TResult extends z.ZodObject<any>, T extends z.ZodObject<any>, TSteps extends LegacyStep<any, any, any>[]> {
|
|
1336
1326
|
runId: string;
|
|
1337
1327
|
start: (props?: {
|
|
1338
1328
|
triggerData?: z.infer<T>;
|
|
1339
1329
|
runtimeContext?: RuntimeContext;
|
|
1340
|
-
} | undefined) => Promise<
|
|
1341
|
-
watch: (onTransition: (state: Pick<
|
|
1330
|
+
} | undefined) => Promise<LegacyWorkflowRunResult<T, TSteps, TResult>>;
|
|
1331
|
+
watch: (onTransition: (state: Pick<LegacyWorkflowRunResult<T, TSteps, TResult>, 'results' | 'activePaths' | 'runId' | 'timestamp'>) => void) => () => void;
|
|
1342
1332
|
resume: (props: {
|
|
1343
1333
|
stepId: string;
|
|
1344
1334
|
context?: Record<string, any>;
|
|
1345
1335
|
runtimeContext?: RuntimeContext;
|
|
1346
|
-
}) => Promise<Omit<
|
|
1347
|
-
resumeWithEvent: (eventName: string, data: any, runtimeContext?: RuntimeContext) => Promise<Omit<
|
|
1336
|
+
}) => Promise<Omit<LegacyWorkflowRunResult<T, TSteps, TResult>, 'runId'> | undefined>;
|
|
1337
|
+
resumeWithEvent: (eventName: string, data: any, runtimeContext?: RuntimeContext) => Promise<Omit<LegacyWorkflowRunResult<T, TSteps, TResult>, 'runId'> | undefined>;
|
|
1348
1338
|
}
|
|
1349
|
-
declare class WorkflowInstance<TSteps extends
|
|
1339
|
+
declare class WorkflowInstance<TSteps extends LegacyStep<any, any, any, any>[] = LegacyStep<any, any, any, any>[], TTriggerSchema extends z.ZodObject<any> = any, TResult extends z.ZodObject<any> = any> implements WorkflowResultReturn<TResult, TTriggerSchema, TSteps> {
|
|
1350
1340
|
#private;
|
|
1351
1341
|
name: string;
|
|
1352
|
-
logger:
|
|
1342
|
+
logger: IMastraLogger;
|
|
1353
1343
|
events?: Record<string, {
|
|
1354
1344
|
schema: z.ZodObject<any>;
|
|
1355
1345
|
}>;
|
|
1356
1346
|
constructor({ name, logger, steps, runId, retryConfig, mastra, stepGraph, stepSubscriberGraph, onFinish, onStepTransition, resultMapping, events, }: {
|
|
1357
1347
|
name: string;
|
|
1358
|
-
logger:
|
|
1348
|
+
logger: IMastraLogger;
|
|
1359
1349
|
steps: Record<string, StepNode>;
|
|
1360
1350
|
mastra?: Mastra;
|
|
1361
1351
|
retryConfig?: RetryConfig;
|
|
@@ -1363,7 +1353,7 @@ declare class WorkflowInstance<TSteps extends Step<any, any, any, any>[] = Step<
|
|
|
1363
1353
|
stepGraph: StepGraph;
|
|
1364
1354
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
1365
1355
|
onFinish?: () => void;
|
|
1366
|
-
onStepTransition?: Set<(state: Pick<
|
|
1356
|
+
onStepTransition?: Set<(state: Pick<LegacyWorkflowRunResult<TTriggerSchema, TSteps, TResult>, 'results' | 'activePaths' | 'runId' | 'timestamp'>) => void | Promise<void>>;
|
|
1367
1357
|
resultMapping?: Record<string, {
|
|
1368
1358
|
step: StepAction<any, any, any, any>;
|
|
1369
1359
|
path: string;
|
|
@@ -1375,16 +1365,16 @@ declare class WorkflowInstance<TSteps extends Step<any, any, any, any>[] = Step<
|
|
|
1375
1365
|
setState(state: any): void;
|
|
1376
1366
|
get runId(): string;
|
|
1377
1367
|
get executionSpan(): Span | undefined;
|
|
1378
|
-
watch(onTransition: (state: Pick<
|
|
1368
|
+
watch(onTransition: (state: Pick<LegacyWorkflowRunResult<TTriggerSchema, TSteps, TResult>, 'results' | 'activePaths' | 'runId' | 'timestamp'>) => void): () => void;
|
|
1379
1369
|
start({ triggerData, runtimeContext, }?: {
|
|
1380
1370
|
triggerData?: z.infer<TTriggerSchema>;
|
|
1381
1371
|
runtimeContext?: RuntimeContext;
|
|
1382
1372
|
}): Promise<{
|
|
1383
1373
|
runId: string;
|
|
1384
1374
|
result?: z.TypeOf<TResult> | undefined;
|
|
1385
|
-
timestamp: number;
|
|
1386
1375
|
triggerData?: z.TypeOf<TTriggerSchema> | undefined;
|
|
1387
1376
|
results: { [K in keyof StepsRecord$1<TSteps>]: StepsRecord$1<TSteps>[K]["outputSchema"] extends undefined ? StepResult$1<unknown> : StepResult$1<z.TypeOf<NonNullable<StepsRecord$1<TSteps>[K]["outputSchema"]>>>; };
|
|
1377
|
+
timestamp: number;
|
|
1388
1378
|
activePaths: Map<TSteps[number]["id"], {
|
|
1389
1379
|
status: string;
|
|
1390
1380
|
suspendPayload?: any;
|
|
@@ -1398,30 +1388,30 @@ declare class WorkflowInstance<TSteps extends Step<any, any, any, any>[] = Step<
|
|
|
1398
1388
|
snapshot?: Snapshot<any>;
|
|
1399
1389
|
resumeData?: any;
|
|
1400
1390
|
runtimeContext: RuntimeContext;
|
|
1401
|
-
}): Promise<Omit<
|
|
1391
|
+
}): Promise<Omit<LegacyWorkflowRunResult<TTriggerSchema, TSteps, TResult>, 'runId'>>;
|
|
1402
1392
|
hasSubscribers(stepId: string): boolean;
|
|
1403
|
-
runMachine(parentStepId: string, input: any, runtimeContext?: RuntimeContext): Promise<(Pick<
|
|
1393
|
+
runMachine(parentStepId: string, input: any, runtimeContext?: RuntimeContext): Promise<(Pick<LegacyWorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId" | "results" | "timestamp" | "activePaths"> | undefined)[]>;
|
|
1404
1394
|
suspend(stepId: string, machine: Machine<TSteps, TTriggerSchema>): Promise<void>;
|
|
1405
1395
|
/**
|
|
1406
1396
|
* Persists the workflow state to the database
|
|
1407
1397
|
*/
|
|
1408
1398
|
persistWorkflowSnapshot(): Promise<void>;
|
|
1409
|
-
getState(): Promise<
|
|
1410
|
-
resumeWithEvent(eventName: string, data: any, runtimeContext?: RuntimeContext): Promise<Omit<
|
|
1399
|
+
getState(): Promise<LegacyWorkflowRunState | null>;
|
|
1400
|
+
resumeWithEvent(eventName: string, data: any, runtimeContext?: RuntimeContext): Promise<Omit<LegacyWorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId"> | undefined>;
|
|
1411
1401
|
resume({ stepId, context: resumeContext, runtimeContext, }: {
|
|
1412
1402
|
stepId: string;
|
|
1413
1403
|
context?: Record<string, any>;
|
|
1414
1404
|
runtimeContext?: RuntimeContext;
|
|
1415
|
-
}): Promise<Omit<
|
|
1405
|
+
}): Promise<Omit<LegacyWorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId"> | undefined>;
|
|
1416
1406
|
_resume({ stepId, context: resumeContext, runtimeContext, }: {
|
|
1417
1407
|
stepId: string;
|
|
1418
1408
|
context?: Record<string, any>;
|
|
1419
1409
|
runtimeContext: RuntimeContext;
|
|
1420
|
-
}): Promise<Omit<
|
|
1410
|
+
}): Promise<Omit<LegacyWorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId"> | undefined>;
|
|
1421
1411
|
}
|
|
1422
1412
|
|
|
1423
|
-
type WorkflowBuilder<T extends
|
|
1424
|
-
declare class
|
|
1413
|
+
type WorkflowBuilder<T extends LegacyWorkflow<any, any>> = Pick<T, 'step' | 'then' | 'after' | 'while' | 'until' | 'if' | 'else' | 'afterEvent' | 'commit'>;
|
|
1414
|
+
declare class LegacyWorkflow<TSteps extends LegacyStep<string, any, any>[] = LegacyStep<string, any, any>[], TStepId extends string = string, TTriggerSchema extends z.ZodObject<any> = any, TResultSchema extends z.ZodObject<any> = any> extends MastraBase {
|
|
1425
1415
|
#private;
|
|
1426
1416
|
name: TStepId;
|
|
1427
1417
|
triggerSchema?: TTriggerSchema;
|
|
@@ -1435,24 +1425,24 @@ declare class Workflow<TSteps extends Step<string, any, any>[] = Step<string, an
|
|
|
1435
1425
|
}>;
|
|
1436
1426
|
isNested: boolean;
|
|
1437
1427
|
/**
|
|
1438
|
-
* Creates a new
|
|
1428
|
+
* Creates a new LegacyWorkflow instance
|
|
1439
1429
|
* @param name - Identifier for the workflow (not necessarily unique)
|
|
1440
1430
|
* @param logger - Optional logger instance
|
|
1441
1431
|
*/
|
|
1442
1432
|
constructor({ name, triggerSchema, result, retryConfig, mastra, events, }: WorkflowOptions<TStepId, TSteps, TTriggerSchema, TResultSchema>);
|
|
1443
|
-
step<TWorkflow extends
|
|
1433
|
+
step<TWorkflow extends LegacyWorkflow<any, any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>, Steps extends StepAction<any, any, any, any>[] = TSteps>(next: TWorkflow, config?: StepConfig<ReturnType<TWorkflow['toStep']>, CondStep, VarStep, TTriggerSchema, Steps>): WorkflowBuilder<this>;
|
|
1444
1434
|
step<TAgent extends Agent<any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>, Steps extends StepAction<any, any, any, any>[] = TSteps>(next: TAgent, config?: StepConfig<ReturnType<TAgent['toStep']>, CondStep, VarStep, TTriggerSchema, Steps>): WorkflowBuilder<this>;
|
|
1445
1435
|
step<TStep extends StepAction<any, any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>, Steps extends StepAction<any, any, any, any>[] = TSteps>(step: TStep, config?: StepConfig<TStep, CondStep, VarStep, TTriggerSchema, Steps>): WorkflowBuilder<this>;
|
|
1446
1436
|
then<TStep extends StepAction<string, any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>>(next: TStep | TStep[], config?: StepConfig<TStep, CondStep, VarStep, TTriggerSchema>): this;
|
|
1447
|
-
then<TWorkflow extends
|
|
1437
|
+
then<TWorkflow extends LegacyWorkflow<any, any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>>(next: TWorkflow | TWorkflow[], config?: StepConfig<StepAction<string, any, any, any>, CondStep, VarStep, TTriggerSchema>): this;
|
|
1448
1438
|
then<TAgent extends Agent<any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>>(next: TAgent | TAgent[], config?: StepConfig<StepAction<string, any, any, any>, CondStep, VarStep, TTriggerSchema>): this;
|
|
1449
1439
|
private loop;
|
|
1450
1440
|
while<FallbackStep extends StepAction<string, any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>>(condition: StepConfig<FallbackStep, CondStep, VarStep, TTriggerSchema, TSteps>['when'], fallbackStep: FallbackStep, variables?: StepConfig<FallbackStep, CondStep, VarStep, TTriggerSchema, TSteps>['variables']): Pick<WorkflowBuilder<this>, "then" | "commit">;
|
|
1451
1441
|
until<FallbackStep extends StepAction<string, any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>>(condition: StepConfig<FallbackStep, CondStep, VarStep, TTriggerSchema, TSteps>['when'], fallbackStep: FallbackStep, variables?: StepConfig<FallbackStep, CondStep, VarStep, TTriggerSchema, TSteps>['variables']): Pick<WorkflowBuilder<this>, "then" | "commit">;
|
|
1452
|
-
if<TStep extends StepAction<string, any, any, any>>(condition: StepConfig<TStep, any, any, TTriggerSchema>['when'], ifStep?: TStep |
|
|
1442
|
+
if<TStep extends StepAction<string, any, any, any>>(condition: StepConfig<TStep, any, any, TTriggerSchema>['when'], ifStep?: TStep | LegacyWorkflow, elseStep?: TStep | LegacyWorkflow): this | WorkflowBuilder<this>;
|
|
1453
1443
|
else(): WorkflowBuilder<this>;
|
|
1454
1444
|
after<TStep extends StepAction<string, any, any, any>>(steps: string | TStep | TStep[] | (TStep | string)[]): Omit<WorkflowBuilder<this>, 'then' | 'after'>;
|
|
1455
|
-
after<TWorkflow extends
|
|
1445
|
+
after<TWorkflow extends LegacyWorkflow<any, any, any, any>>(steps: TWorkflow | TWorkflow[]): Omit<WorkflowBuilder<this>, 'then' | 'after'>;
|
|
1456
1446
|
after<TAgent extends Agent<any, any, any>>(steps: TAgent | TAgent[]): Omit<WorkflowBuilder<this>, 'then' | 'after'>;
|
|
1457
1447
|
afterEvent(eventName: string): WorkflowBuilder<this>;
|
|
1458
1448
|
/**
|
|
@@ -1494,17 +1484,17 @@ declare class Workflow<TSteps extends Step<string, any, any>[] = Step<string, an
|
|
|
1494
1484
|
limit?: number;
|
|
1495
1485
|
offset?: number;
|
|
1496
1486
|
resourceId?: string;
|
|
1497
|
-
}): Promise<
|
|
1487
|
+
}): Promise<LegacyWorkflowRuns>;
|
|
1498
1488
|
getExecutionSpan(runId: string): Span | undefined;
|
|
1499
|
-
getState(runId: string): Promise<
|
|
1489
|
+
getState(runId: string): Promise<LegacyWorkflowRunState | null>;
|
|
1500
1490
|
resume({ runId, stepId, context: resumeContext, runtimeContext, }: {
|
|
1501
1491
|
runId: string;
|
|
1502
1492
|
stepId: string;
|
|
1503
1493
|
context?: Record<string, any>;
|
|
1504
1494
|
runtimeContext: RuntimeContext;
|
|
1505
|
-
}): Promise<Omit<
|
|
1506
|
-
watch(onTransition: (state: Pick<
|
|
1507
|
-
resumeWithEvent(runId: string, eventName: string, data: any): Promise<Omit<
|
|
1495
|
+
}): Promise<Omit<LegacyWorkflowRunResult<TTriggerSchema, TSteps, any>, "runId"> | undefined>;
|
|
1496
|
+
watch(onTransition: (state: Pick<LegacyWorkflowRunResult<TTriggerSchema, TSteps, TResultSchema>, 'results' | 'activePaths' | 'runId' | 'timestamp'>) => void): () => void;
|
|
1497
|
+
resumeWithEvent(runId: string, eventName: string, data: any): Promise<Omit<LegacyWorkflowRunResult<TTriggerSchema, TSteps, any>, "runId"> | undefined>;
|
|
1508
1498
|
__registerMastra(mastra: Mastra): void;
|
|
1509
1499
|
__registerPrimitives(p: MastraPrimitives): void;
|
|
1510
1500
|
get stepGraph(): StepGraph;
|
|
@@ -1513,7 +1503,7 @@ declare class Workflow<TSteps extends Step<string, any, any>[] = Step<string, an
|
|
|
1513
1503
|
get serializedStepSubscriberGraph(): Record<string, StepGraph>;
|
|
1514
1504
|
get steps(): Record<string, StepAction<string, any, any, any>>;
|
|
1515
1505
|
setNested(isNested: boolean): void;
|
|
1516
|
-
toStep():
|
|
1506
|
+
toStep(): LegacyStep<TStepId, TTriggerSchema, z.ZodType<LegacyWorkflowRunResult<TTriggerSchema, TSteps, TResultSchema>>, any>;
|
|
1517
1507
|
}
|
|
1518
1508
|
|
|
1519
1509
|
type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema> = (params: {
|
|
@@ -1522,8 +1512,8 @@ type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema> = (
|
|
|
1522
1512
|
inputData: TStepInput;
|
|
1523
1513
|
resumeData?: TResumeSchema;
|
|
1524
1514
|
getInitData<T extends z.ZodType<any>>(): z.infer<T>;
|
|
1525
|
-
getInitData<T extends
|
|
1526
|
-
getStepResult<T extends
|
|
1515
|
+
getInitData<T extends Workflow<any, any, any, any, any>>(): T extends undefined ? unknown : z.infer<NonNullable<T['inputSchema']>>;
|
|
1516
|
+
getStepResult<T extends Step<any, any, any>>(stepId: T): T['outputSchema'] extends undefined ? unknown : z.infer<NonNullable<T['outputSchema']>>;
|
|
1527
1517
|
suspend(suspendPayload: TSuspendSchema): Promise<void>;
|
|
1528
1518
|
resume?: {
|
|
1529
1519
|
steps: string[];
|
|
@@ -1533,7 +1523,7 @@ type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema> = (
|
|
|
1533
1523
|
emit: (event: string, data: any) => Promise<void>;
|
|
1534
1524
|
};
|
|
1535
1525
|
}) => Promise<TStepOutput>;
|
|
1536
|
-
interface
|
|
1526
|
+
interface Step<TStepId extends string = string, TSchemaIn extends z.ZodType<any> = z.ZodType<any>, TSchemaOut extends z.ZodType<any> = z.ZodType<any>, TResumeSchema extends z.ZodType<any> = z.ZodType<any>, TSuspendSchema extends z.ZodType<any> = z.ZodType<any>> {
|
|
1537
1527
|
id: TStepId;
|
|
1538
1528
|
description?: string;
|
|
1539
1529
|
inputSchema: TSchemaIn;
|
|
@@ -1557,7 +1547,7 @@ type StepSuspended<T> = {
|
|
|
1557
1547
|
payload: T;
|
|
1558
1548
|
};
|
|
1559
1549
|
type StepResult<T> = StepSuccess<T> | StepFailure | StepSuspended<T>;
|
|
1560
|
-
type StepsRecord<T extends readonly
|
|
1550
|
+
type StepsRecord<T extends readonly Step<any, any, any>[]> = {
|
|
1561
1551
|
[K in T[number]['id']]: Extract<T[number], {
|
|
1562
1552
|
id: K;
|
|
1563
1553
|
}>;
|
|
@@ -1570,8 +1560,8 @@ type PathsToStringProps<T> = T extends object ? {
|
|
|
1570
1560
|
[K in keyof T]: T[K] extends object ? K extends string ? K | `${K}.${PathsToStringProps<T[K]>}` : never : K extends string ? K : never;
|
|
1571
1561
|
}[keyof T] : never;
|
|
1572
1562
|
type ExtractSchemaType<T extends z.ZodType<any>> = T extends z.ZodObject<infer V> ? V : never;
|
|
1573
|
-
type ExtractSchemaFromStep<TStep extends
|
|
1574
|
-
type VariableReference<TStep extends
|
|
1563
|
+
type ExtractSchemaFromStep<TStep extends Step<any, any, any>, TKey extends 'inputSchema' | 'outputSchema'> = TStep[TKey];
|
|
1564
|
+
type VariableReference<TStep extends Step<string, any, any> = Step<string, any, any>, TVarPath extends PathsToStringProps<ExtractSchemaType<ExtractSchemaFromStep<TStep, 'outputSchema'>>> | '' | '.' = PathsToStringProps<ExtractSchemaType<ExtractSchemaFromStep<TStep, 'outputSchema'>>> | '' | '.'> = {
|
|
1575
1565
|
step: TStep;
|
|
1576
1566
|
path: TVarPath;
|
|
1577
1567
|
} | {
|
|
@@ -1601,7 +1591,7 @@ type WatchEvent = {
|
|
|
1601
1591
|
eventTimestamp: Date;
|
|
1602
1592
|
};
|
|
1603
1593
|
type ZodPathType<T extends z.ZodTypeAny, P extends string> = T extends z.ZodObject<infer Shape> ? P extends `${infer Key}.${infer Rest}` ? Key extends keyof Shape ? Shape[Key] extends z.ZodTypeAny ? ZodPathType<Shape[Key], Rest> : never : never : P extends keyof Shape ? Shape[P] : never : never;
|
|
1604
|
-
interface
|
|
1594
|
+
interface WorkflowRunState {
|
|
1605
1595
|
runId: string;
|
|
1606
1596
|
value: Record<string, string>;
|
|
1607
1597
|
context: {
|
|
@@ -1659,7 +1649,7 @@ declare abstract class ExecutionEngine extends MastraBase {
|
|
|
1659
1649
|
|
|
1660
1650
|
type StepFlowEntry = {
|
|
1661
1651
|
type: 'step';
|
|
1662
|
-
step:
|
|
1652
|
+
step: Step;
|
|
1663
1653
|
} | {
|
|
1664
1654
|
type: 'parallel';
|
|
1665
1655
|
steps: StepFlowEntry[];
|
|
@@ -1673,7 +1663,7 @@ type StepFlowEntry = {
|
|
|
1673
1663
|
}[];
|
|
1674
1664
|
} | {
|
|
1675
1665
|
type: 'loop';
|
|
1676
|
-
step:
|
|
1666
|
+
step: Step;
|
|
1677
1667
|
condition: ExecuteFunction<any, any, any, any>;
|
|
1678
1668
|
serializedCondition: {
|
|
1679
1669
|
id: string;
|
|
@@ -1682,12 +1672,12 @@ type StepFlowEntry = {
|
|
|
1682
1672
|
loopType: 'dowhile' | 'dountil';
|
|
1683
1673
|
} | {
|
|
1684
1674
|
type: 'foreach';
|
|
1685
|
-
step:
|
|
1675
|
+
step: Step;
|
|
1686
1676
|
opts: {
|
|
1687
1677
|
concurrency: number;
|
|
1688
1678
|
};
|
|
1689
1679
|
};
|
|
1690
|
-
type SerializedStep = Pick<
|
|
1680
|
+
type SerializedStep = Pick<Step, 'id' | 'description'> & {
|
|
1691
1681
|
component?: string;
|
|
1692
1682
|
serializedStepFlow?: SerializedStepFlowEntry[];
|
|
1693
1683
|
};
|
|
@@ -1737,25 +1727,25 @@ declare function createStep<TStepId extends string, TStepInput extends z.ZodType
|
|
|
1737
1727
|
resumeSchema?: TResumeSchema;
|
|
1738
1728
|
suspendSchema?: TSuspendSchema;
|
|
1739
1729
|
execute: ExecuteFunction<z.infer<TStepInput>, z.infer<TStepOutput>, z.infer<TResumeSchema>, z.infer<TSuspendSchema>>;
|
|
1740
|
-
}):
|
|
1730
|
+
}): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema>;
|
|
1741
1731
|
declare function createStep<TStepId extends string, TStepInput extends z.ZodObject<{
|
|
1742
1732
|
prompt: z.ZodString;
|
|
1743
1733
|
}>, TStepOutput extends z.ZodObject<{
|
|
1744
1734
|
text: z.ZodString;
|
|
1745
|
-
}>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(agent: Agent<TStepId, any, any>):
|
|
1735
|
+
}>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(agent: Agent<TStepId, any, any>): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema>;
|
|
1746
1736
|
declare function createStep<TSchemaIn extends z.ZodType<any>, TSchemaOut extends z.ZodType<any>, TContext extends ToolExecutionContext<TSchemaIn>>(tool: Tool<TSchemaIn, TSchemaOut, TContext> & {
|
|
1747
1737
|
inputSchema: TSchemaIn;
|
|
1748
1738
|
outputSchema: TSchemaOut;
|
|
1749
1739
|
execute: (context: TContext) => Promise<any>;
|
|
1750
|
-
}):
|
|
1751
|
-
declare function cloneStep<TStepId extends string>(step:
|
|
1740
|
+
}): Step<string, TSchemaIn, TSchemaOut, z.ZodType<any>, z.ZodType<any>>;
|
|
1741
|
+
declare function cloneStep<TStepId extends string>(step: Step<string, any, any>, opts: {
|
|
1752
1742
|
id: TStepId;
|
|
1753
|
-
}):
|
|
1754
|
-
declare function createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends
|
|
1755
|
-
declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends
|
|
1743
|
+
}): Step<TStepId, any, any>;
|
|
1744
|
+
declare function createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TInput>;
|
|
1745
|
+
declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[]>(workflow: Workflow<TSteps, string, TInput, TOutput>, opts: {
|
|
1756
1746
|
id: TWorkflowId;
|
|
1757
|
-
}):
|
|
1758
|
-
type WorkflowResult<TOutput extends z.ZodType<any>, TSteps extends
|
|
1747
|
+
}): Workflow<TSteps, TWorkflowId, TInput, TOutput>;
|
|
1748
|
+
type WorkflowResult<TOutput extends z.ZodType<any>, TSteps extends Step<string, any, any>[]> = {
|
|
1759
1749
|
status: 'success';
|
|
1760
1750
|
result: z.infer<TOutput>;
|
|
1761
1751
|
steps: {
|
|
@@ -1774,7 +1764,7 @@ type WorkflowResult<TOutput extends z.ZodType<any>, TSteps extends NewStep<strin
|
|
|
1774
1764
|
};
|
|
1775
1765
|
suspended: [string[], ...string[][]];
|
|
1776
1766
|
};
|
|
1777
|
-
type
|
|
1767
|
+
type WorkflowConfig<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[]> = {
|
|
1778
1768
|
mastra?: Mastra;
|
|
1779
1769
|
id: TWorkflowId;
|
|
1780
1770
|
description?: string | undefined;
|
|
@@ -1787,13 +1777,13 @@ type NewWorkflowConfig<TWorkflowId extends string = string, TInput extends z.Zod
|
|
|
1787
1777
|
delay?: number;
|
|
1788
1778
|
};
|
|
1789
1779
|
};
|
|
1790
|
-
declare class
|
|
1780
|
+
declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[], TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TPrevSchema extends z.ZodType<any> = TInput> extends MastraBase implements Step<TWorkflowId, TInput, TOutput> {
|
|
1791
1781
|
#private;
|
|
1792
1782
|
id: TWorkflowId;
|
|
1793
1783
|
description?: string | undefined;
|
|
1794
1784
|
inputSchema: TInput;
|
|
1795
1785
|
outputSchema: TOutput;
|
|
1796
|
-
steps: Record<string,
|
|
1786
|
+
steps: Record<string, Step<string, any, any, any, any>>;
|
|
1797
1787
|
stepDefs?: TSteps;
|
|
1798
1788
|
protected stepFlow: StepFlowEntry[];
|
|
1799
1789
|
protected serializedStepFlow: SerializedStepFlowEntry[];
|
|
@@ -1803,9 +1793,9 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
|
|
|
1803
1793
|
attempts?: number;
|
|
1804
1794
|
delay?: number;
|
|
1805
1795
|
};
|
|
1806
|
-
constructor({ mastra, id, inputSchema, outputSchema, description, executionEngine, retryConfig, steps, }:
|
|
1796
|
+
constructor({ mastra, id, inputSchema, outputSchema, description, executionEngine, retryConfig, steps, }: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>);
|
|
1807
1797
|
get runs(): Map<string, Run<TSteps, TInput, TOutput>>;
|
|
1808
|
-
get mastra(): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string,
|
|
1798
|
+
get mastra(): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, LegacyWorkflow<LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, Workflow<Step<string, any, any, any, any>[], string, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>>, Record<string, MastraVector>, Record<string, MastraTTS>, IMastraLogger, Record<string, AgentNetwork>, Record<string, MCPServerBase>> | undefined;
|
|
1809
1799
|
__registerMastra(mastra: Mastra): void;
|
|
1810
1800
|
__registerPrimitives(p: MastraPrimitives): void;
|
|
1811
1801
|
setStepFlow(stepFlow: StepFlowEntry[]): void;
|
|
@@ -1814,8 +1804,8 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
|
|
|
1814
1804
|
* @param step The step to add to the workflow
|
|
1815
1805
|
* @returns The workflow instance for chaining
|
|
1816
1806
|
*/
|
|
1817
|
-
then<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step:
|
|
1818
|
-
map<TSteps extends
|
|
1807
|
+
then<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
1808
|
+
map<TSteps extends Step<string, any, any>[], TMapping extends {
|
|
1819
1809
|
[K in keyof TMapping]: {
|
|
1820
1810
|
step: TSteps[number] | TSteps[number][];
|
|
1821
1811
|
path: PathsToStringProps<ExtractSchemaType<ExtractSchemaFromStep<TSteps[number], 'outputSchema'>>> | '.';
|
|
@@ -1829,17 +1819,17 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
|
|
|
1829
1819
|
runtimeContextPath: string;
|
|
1830
1820
|
schema: z.ZodTypeAny;
|
|
1831
1821
|
} | DynamicMapping<TPrevSchema, z.ZodTypeAny>;
|
|
1832
|
-
}>(mappingConfig: TMapping | ExecuteFunction<z.infer<TPrevSchema>, any, any, any>):
|
|
1833
|
-
parallel<TParallelSteps extends
|
|
1822
|
+
}>(mappingConfig: TMapping | ExecuteFunction<z.infer<TPrevSchema>, any, any, any>): Workflow<TSteps, TWorkflowId, TInput, TOutput, any>;
|
|
1823
|
+
parallel<TParallelSteps extends Step<string, TPrevSchema, any, any, any>[]>(steps: TParallelSteps): Workflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodObject<{ [K in keyof StepsRecord<TParallelSteps>]: StepsRecord<TParallelSteps>[K]["outputSchema"]["path"]; }, any, z.ZodTypeAny>>;
|
|
1834
1824
|
branch<TBranchSteps extends Array<[
|
|
1835
1825
|
ExecuteFunction<z.infer<TPrevSchema>, any, any, any>,
|
|
1836
|
-
|
|
1837
|
-
]>>(steps: TBranchSteps):
|
|
1838
|
-
dowhile<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step:
|
|
1839
|
-
dountil<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step:
|
|
1840
|
-
foreach<TPrevIsArray extends TPrevSchema extends z.ZodArray<any> ? true : false, TStepInputSchema extends TPrevSchema extends z.ZodArray<infer TElement> ? TElement : never, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: TPrevIsArray extends true ?
|
|
1826
|
+
Step<string, TPrevSchema, any, any, any>
|
|
1827
|
+
]>>(steps: TBranchSteps): Workflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodObject<{ [K in keyof StepsRecord<{ [K_1 in keyof TBranchSteps]: TBranchSteps[K_1][1]; }[number][]>]: StepsRecord<{ [K_1 in keyof TBranchSteps]: TBranchSteps[K_1][1]; }[number][]>[K]["outputSchema"]; }, any, z.ZodTypeAny>>;
|
|
1828
|
+
dowhile<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any>, condition: ExecuteFunction<z.infer<TSchemaOut>, any, any, any>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
1829
|
+
dountil<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any>, condition: ExecuteFunction<z.infer<TSchemaOut>, any, any, any>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
1830
|
+
foreach<TPrevIsArray extends TPrevSchema extends z.ZodArray<any> ? true : false, TStepInputSchema extends TPrevSchema extends z.ZodArray<infer TElement> ? TElement : never, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: TPrevIsArray extends true ? Step<TStepId, TStepInputSchema, TSchemaOut, any, any> : 'Previous step must return an array type', opts?: {
|
|
1841
1831
|
concurrency: number;
|
|
1842
|
-
}):
|
|
1832
|
+
}): Workflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodArray<TSchemaOut>>;
|
|
1843
1833
|
/**
|
|
1844
1834
|
* Builds the execution graph for this workflow
|
|
1845
1835
|
* @returns The execution graph that can be used to execute the workflow
|
|
@@ -1850,7 +1840,7 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
|
|
|
1850
1840
|
* This method should be called after all steps have been added to the workflow
|
|
1851
1841
|
* @returns A built workflow instance ready for execution
|
|
1852
1842
|
*/
|
|
1853
|
-
commit():
|
|
1843
|
+
commit(): Workflow<TSteps, TWorkflowId, TInput, TOutput, TOutput>;
|
|
1854
1844
|
get stepGraph(): StepFlowEntry[];
|
|
1855
1845
|
get serializedStepGraph(): SerializedStepFlowEntry[];
|
|
1856
1846
|
/**
|
|
@@ -1861,10 +1851,10 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
|
|
|
1861
1851
|
createRun(options?: {
|
|
1862
1852
|
runId?: string;
|
|
1863
1853
|
}): Run<TSteps, TInput, TOutput>;
|
|
1864
|
-
execute({ inputData, resumeData, suspend, resume, emitter, mastra, }: {
|
|
1854
|
+
execute({ inputData, resumeData, suspend, resume, emitter, mastra, runtimeContext, }: {
|
|
1865
1855
|
inputData: z.infer<TInput>;
|
|
1866
1856
|
resumeData?: any;
|
|
1867
|
-
getStepResult<T extends
|
|
1857
|
+
getStepResult<T extends Step<any, any, any>>(stepId: T): T['outputSchema'] extends undefined ? unknown : z.infer<NonNullable<T['outputSchema']>>;
|
|
1868
1858
|
suspend: (suspendPayload: any) => Promise<void>;
|
|
1869
1859
|
resume?: {
|
|
1870
1860
|
steps: string[];
|
|
@@ -1875,6 +1865,7 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
|
|
|
1875
1865
|
emit: (event: string, data: any) => void;
|
|
1876
1866
|
};
|
|
1877
1867
|
mastra: Mastra;
|
|
1868
|
+
runtimeContext?: RuntimeContext;
|
|
1878
1869
|
}): Promise<z.infer<TOutput>>;
|
|
1879
1870
|
getWorkflowRuns(args?: {
|
|
1880
1871
|
fromDate?: Date;
|
|
@@ -1882,657 +1873,667 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
|
|
|
1882
1873
|
limit?: number;
|
|
1883
1874
|
offset?: number;
|
|
1884
1875
|
resourceId?: string;
|
|
1885
|
-
}): Promise<
|
|
1886
|
-
getWorkflowRunById(runId: string): Promise<
|
|
1876
|
+
}): Promise<WorkflowRuns>;
|
|
1877
|
+
getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
|
|
1887
1878
|
}
|
|
1888
1879
|
/**
|
|
1889
1880
|
* Represents a workflow run that can be executed
|
|
1890
1881
|
*/
|
|
1891
|
-
declare class Run<TSteps extends
|
|
1882
|
+
declare class Run<TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>> {
|
|
1883
|
+
#private;
|
|
1884
|
+
protected emitter: EventEmitter$1;
|
|
1885
|
+
/**
|
|
1886
|
+
* Unique identifier for this workflow
|
|
1887
|
+
*/
|
|
1888
|
+
readonly workflowId: string;
|
|
1889
|
+
/**
|
|
1890
|
+
* Unique identifier for this run
|
|
1891
|
+
*/
|
|
1892
|
+
readonly runId: string;
|
|
1893
|
+
/**
|
|
1894
|
+
* Internal state of the workflow run
|
|
1895
|
+
*/
|
|
1896
|
+
protected state: Record<string, any>;
|
|
1897
|
+
/**
|
|
1898
|
+
* The execution engine for this run
|
|
1899
|
+
*/
|
|
1900
|
+
executionEngine: ExecutionEngine;
|
|
1901
|
+
/**
|
|
1902
|
+
* The execution graph for this run
|
|
1903
|
+
*/
|
|
1904
|
+
executionGraph: ExecutionGraph;
|
|
1905
|
+
protected cleanup?: () => void;
|
|
1906
|
+
protected retryConfig?: {
|
|
1907
|
+
attempts?: number;
|
|
1908
|
+
delay?: number;
|
|
1909
|
+
};
|
|
1910
|
+
constructor(params: {
|
|
1911
|
+
workflowId: string;
|
|
1912
|
+
runId: string;
|
|
1913
|
+
executionEngine: ExecutionEngine;
|
|
1914
|
+
executionGraph: ExecutionGraph;
|
|
1915
|
+
mastra?: Mastra;
|
|
1916
|
+
retryConfig?: {
|
|
1917
|
+
attempts?: number;
|
|
1918
|
+
delay?: number;
|
|
1919
|
+
};
|
|
1920
|
+
cleanup?: () => void;
|
|
1921
|
+
});
|
|
1922
|
+
/**
|
|
1923
|
+
* Starts the workflow execution with the provided input
|
|
1924
|
+
* @param input The input data for the workflow
|
|
1925
|
+
* @returns A promise that resolves to the workflow output
|
|
1926
|
+
*/
|
|
1927
|
+
start({ inputData, runtimeContext, }: {
|
|
1928
|
+
inputData?: z.infer<TInput>;
|
|
1929
|
+
runtimeContext?: RuntimeContext;
|
|
1930
|
+
}): Promise<WorkflowResult<TOutput, TSteps>>;
|
|
1931
|
+
watch(cb: (event: WatchEvent) => void): () => void;
|
|
1932
|
+
resume<TResumeSchema extends z.ZodType<any>>(params: {
|
|
1933
|
+
resumeData?: z.infer<TResumeSchema>;
|
|
1934
|
+
step: Step<string, any, any, TResumeSchema, any> | [...Step<string, any, any, any, any>[], Step<string, any, any, TResumeSchema, any>] | string | string[];
|
|
1935
|
+
runtimeContext?: RuntimeContext;
|
|
1936
|
+
}): Promise<WorkflowResult<TOutput, TSteps>>;
|
|
1937
|
+
/**
|
|
1938
|
+
* Returns the current state of the workflow run
|
|
1939
|
+
* @returns The current state of the workflow run
|
|
1940
|
+
*/
|
|
1941
|
+
getState(): Record<string, any>;
|
|
1942
|
+
updateState(state: Record<string, any>): void;
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
type ToolsInput = Record<string, ToolAction<any, any, any> | VercelTool>;
|
|
1946
|
+
type ToolsetsInput = Record<string, ToolsInput>;
|
|
1947
|
+
type MastraLanguageModel = LanguageModelV1;
|
|
1948
|
+
type DynamicArgument<T> = T | (({ runtimeContext }: {
|
|
1949
|
+
runtimeContext: RuntimeContext;
|
|
1950
|
+
}) => Promise<T> | T);
|
|
1951
|
+
interface AgentConfig<TAgentId extends string = string, TTools extends ToolsInput = ToolsInput, TMetrics extends Record<string, Metric> = Record<string, Metric>> {
|
|
1952
|
+
name: TAgentId;
|
|
1953
|
+
instructions: DynamicArgument<string>;
|
|
1954
|
+
model: DynamicArgument<MastraLanguageModel>;
|
|
1955
|
+
tools?: DynamicArgument<TTools>;
|
|
1956
|
+
workflows?: DynamicArgument<Record<string, Workflow>>;
|
|
1957
|
+
defaultGenerateOptions?: AgentGenerateOptions;
|
|
1958
|
+
defaultStreamOptions?: AgentStreamOptions;
|
|
1959
|
+
mastra?: Mastra;
|
|
1960
|
+
evals?: TMetrics;
|
|
1961
|
+
memory?: MastraMemory;
|
|
1962
|
+
voice?: CompositeVoice;
|
|
1963
|
+
/** @deprecated This property is deprecated. Use evals instead to add evaluation metrics. */
|
|
1964
|
+
metrics?: TMetrics;
|
|
1965
|
+
}
|
|
1966
|
+
/**
|
|
1967
|
+
* Options for generating responses with an agent
|
|
1968
|
+
* @template Z - The schema type for structured output (Zod schema or JSON schema)
|
|
1969
|
+
*/
|
|
1970
|
+
type AgentGenerateOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
1971
|
+
/** Optional instructions to override the agent's default instructions */
|
|
1972
|
+
instructions?: string;
|
|
1973
|
+
/** Additional tool sets that can be used for this generation */
|
|
1974
|
+
toolsets?: ToolsetsInput;
|
|
1975
|
+
clientTools?: ToolsInput;
|
|
1976
|
+
/** Additional context messages to include */
|
|
1977
|
+
context?: CoreMessage[];
|
|
1978
|
+
/** Memory configuration options */
|
|
1979
|
+
memoryOptions?: MemoryConfig;
|
|
1980
|
+
/** Unique ID for this generation run */
|
|
1981
|
+
runId?: string;
|
|
1982
|
+
/** Callback fired after each generation step completes */
|
|
1983
|
+
onStepFinish?: Z extends undefined ? GenerateTextOnStepFinishCallback<any> : never;
|
|
1984
|
+
/** Maximum number of steps allowed for generation */
|
|
1985
|
+
maxSteps?: number;
|
|
1986
|
+
/** Schema for structured output, does not work with tools, use experimental_output instead */
|
|
1987
|
+
output?: OutputType | Z;
|
|
1988
|
+
/** Schema for structured output generation alongside tool calls. */
|
|
1989
|
+
experimental_output?: Z;
|
|
1990
|
+
/** Controls how tools are selected during generation */
|
|
1991
|
+
toolChoice?: 'auto' | 'none' | 'required' | {
|
|
1992
|
+
type: 'tool';
|
|
1993
|
+
toolName: string;
|
|
1994
|
+
};
|
|
1995
|
+
/** Telemetry settings */
|
|
1996
|
+
telemetry?: TelemetrySettings;
|
|
1997
|
+
/** RuntimeContext for dependency injection */
|
|
1998
|
+
runtimeContext?: RuntimeContext;
|
|
1999
|
+
} & ({
|
|
2000
|
+
resourceId?: undefined;
|
|
2001
|
+
threadId?: undefined;
|
|
2002
|
+
} | {
|
|
2003
|
+
resourceId: string;
|
|
2004
|
+
threadId: string;
|
|
2005
|
+
}) & (Z extends undefined ? DefaultLLMTextOptions : DefaultLLMTextObjectOptions);
|
|
2006
|
+
/**
|
|
2007
|
+
* Options for streaming responses with an agent
|
|
2008
|
+
* @template Z - The schema type for structured output (Zod schema or JSON schema)
|
|
2009
|
+
*/
|
|
2010
|
+
type AgentStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
2011
|
+
/** Optional instructions to override the agent's default instructions */
|
|
2012
|
+
instructions?: string;
|
|
2013
|
+
/** Additional tool sets that can be used for this generation */
|
|
2014
|
+
toolsets?: ToolsetsInput;
|
|
2015
|
+
clientTools?: ToolsInput;
|
|
2016
|
+
/** Additional context messages to include */
|
|
2017
|
+
context?: CoreMessage[];
|
|
2018
|
+
/** Memory configuration options */
|
|
2019
|
+
memoryOptions?: MemoryConfig;
|
|
2020
|
+
/** Unique ID for this generation run */
|
|
2021
|
+
runId?: string;
|
|
2022
|
+
/** Callback fired when streaming completes */
|
|
2023
|
+
onFinish?: Z extends undefined ? StreamTextOnFinishCallback<any> : Z extends ZodSchema ? StreamObjectOnFinishCallback<z.infer<Z>> : StreamObjectOnFinishCallback<any>;
|
|
2024
|
+
/** Callback fired after each generation step completes */
|
|
2025
|
+
onStepFinish?: Z extends undefined ? StreamTextOnStepFinishCallback<any> : never;
|
|
2026
|
+
/** Maximum number of steps allowed for generation */
|
|
2027
|
+
maxSteps?: number;
|
|
2028
|
+
/** Schema for structured output */
|
|
2029
|
+
output?: OutputType | Z;
|
|
2030
|
+
/** Temperature parameter for controlling randomness */
|
|
2031
|
+
temperature?: number;
|
|
2032
|
+
/** Controls how tools are selected during generation */
|
|
2033
|
+
toolChoice?: 'auto' | 'none' | 'required' | {
|
|
2034
|
+
type: 'tool';
|
|
2035
|
+
toolName: string;
|
|
2036
|
+
};
|
|
2037
|
+
/** Experimental schema for structured output */
|
|
2038
|
+
experimental_output?: Z;
|
|
2039
|
+
/** Telemetry settings */
|
|
2040
|
+
telemetry?: TelemetrySettings;
|
|
2041
|
+
/** RuntimeContext for dependency injection */
|
|
2042
|
+
runtimeContext?: RuntimeContext;
|
|
2043
|
+
} & ({
|
|
2044
|
+
resourceId?: undefined;
|
|
2045
|
+
threadId?: undefined;
|
|
2046
|
+
} | {
|
|
2047
|
+
resourceId: string;
|
|
2048
|
+
threadId: string;
|
|
2049
|
+
}) & (Z extends undefined ? DefaultLLMStreamOptions : DefaultLLMStreamObjectOptions);
|
|
2050
|
+
|
|
2051
|
+
type AgentNetworkConfig = {
|
|
2052
|
+
name: string;
|
|
2053
|
+
agents: Agent[];
|
|
2054
|
+
model: LanguageModelV1;
|
|
2055
|
+
instructions: string;
|
|
2056
|
+
};
|
|
2057
|
+
|
|
2058
|
+
declare class AgentNetwork extends MastraBase {
|
|
1892
2059
|
#private;
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
2060
|
+
constructor(config: AgentNetworkConfig);
|
|
2061
|
+
formatAgentId(name: string): string;
|
|
2062
|
+
getTools(): {
|
|
2063
|
+
readonly transmit: Tool<z.ZodObject<{
|
|
2064
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
2065
|
+
agent: z.ZodString;
|
|
2066
|
+
input: z.ZodString;
|
|
2067
|
+
includeHistory: z.ZodOptional<z.ZodBoolean>;
|
|
2068
|
+
}, "strip", z.ZodTypeAny, {
|
|
2069
|
+
input: string;
|
|
2070
|
+
agent: string;
|
|
2071
|
+
includeHistory?: boolean | undefined;
|
|
2072
|
+
}, {
|
|
2073
|
+
input: string;
|
|
2074
|
+
agent: string;
|
|
2075
|
+
includeHistory?: boolean | undefined;
|
|
2076
|
+
}>, "many">;
|
|
2077
|
+
}, "strip", z.ZodTypeAny, {
|
|
2078
|
+
actions: {
|
|
2079
|
+
input: string;
|
|
2080
|
+
agent: string;
|
|
2081
|
+
includeHistory?: boolean | undefined;
|
|
2082
|
+
}[];
|
|
2083
|
+
}, {
|
|
2084
|
+
actions: {
|
|
2085
|
+
input: string;
|
|
2086
|
+
agent: string;
|
|
2087
|
+
includeHistory?: boolean | undefined;
|
|
2088
|
+
}[];
|
|
2089
|
+
}>, undefined, ToolExecutionContext<z.ZodObject<{
|
|
2090
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
2091
|
+
agent: z.ZodString;
|
|
2092
|
+
input: z.ZodString;
|
|
2093
|
+
includeHistory: z.ZodOptional<z.ZodBoolean>;
|
|
2094
|
+
}, "strip", z.ZodTypeAny, {
|
|
2095
|
+
input: string;
|
|
2096
|
+
agent: string;
|
|
2097
|
+
includeHistory?: boolean | undefined;
|
|
2098
|
+
}, {
|
|
2099
|
+
input: string;
|
|
2100
|
+
agent: string;
|
|
2101
|
+
includeHistory?: boolean | undefined;
|
|
2102
|
+
}>, "many">;
|
|
2103
|
+
}, "strip", z.ZodTypeAny, {
|
|
2104
|
+
actions: {
|
|
2105
|
+
input: string;
|
|
2106
|
+
agent: string;
|
|
2107
|
+
includeHistory?: boolean | undefined;
|
|
2108
|
+
}[];
|
|
2109
|
+
}, {
|
|
2110
|
+
actions: {
|
|
2111
|
+
input: string;
|
|
2112
|
+
agent: string;
|
|
2113
|
+
includeHistory?: boolean | undefined;
|
|
2114
|
+
}[];
|
|
2115
|
+
}>>>;
|
|
1918
2116
|
};
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
mastra?: Mastra;
|
|
1925
|
-
retryConfig?: {
|
|
1926
|
-
attempts?: number;
|
|
1927
|
-
delay?: number;
|
|
1928
|
-
};
|
|
1929
|
-
cleanup?: () => void;
|
|
1930
|
-
});
|
|
2117
|
+
getAgentHistory(agentId: string): {
|
|
2118
|
+
input: string;
|
|
2119
|
+
output: string;
|
|
2120
|
+
timestamp: string;
|
|
2121
|
+
}[];
|
|
1931
2122
|
/**
|
|
1932
|
-
*
|
|
1933
|
-
* @
|
|
1934
|
-
* @returns A promise that resolves to the workflow output
|
|
2123
|
+
* Get the history of all agent interactions that have occurred in this network
|
|
2124
|
+
* @returns A record of agent interactions, keyed by agent ID
|
|
1935
2125
|
*/
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
step: NewStep<string, any, any, TResumeSchema, any> | [...NewStep<string, any, any, any, any>[], NewStep<string, any, any, TResumeSchema, any>] | string | string[];
|
|
1944
|
-
runtimeContext?: RuntimeContext;
|
|
1945
|
-
}): Promise<WorkflowResult<TOutput, TSteps>>;
|
|
2126
|
+
getAgentInteractionHistory(): {
|
|
2127
|
+
[x: string]: {
|
|
2128
|
+
input: string;
|
|
2129
|
+
output: string;
|
|
2130
|
+
timestamp: string;
|
|
2131
|
+
}[];
|
|
2132
|
+
};
|
|
1946
2133
|
/**
|
|
1947
|
-
*
|
|
1948
|
-
* @returns
|
|
2134
|
+
* Get a summary of agent interactions in a more readable format, displayed chronologically
|
|
2135
|
+
* @returns A formatted string with all agent interactions in chronological order
|
|
1949
2136
|
*/
|
|
1950
|
-
|
|
1951
|
-
|
|
2137
|
+
getAgentInteractionSummary(): string;
|
|
2138
|
+
executeAgent(agentId: string, input: CoreMessage$1[], includeHistory?: boolean, runtimeContext?: RuntimeContext): Promise<string>;
|
|
2139
|
+
getInstructions(): string;
|
|
2140
|
+
getRoutingAgent(): Agent<string, ToolsInput, Record<string, Metric>>;
|
|
2141
|
+
getAgents(): Agent<string, ToolsInput, Record<string, Metric>>[];
|
|
2142
|
+
generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], args?: AgentGenerateOptions<Z> & {
|
|
2143
|
+
output?: never;
|
|
2144
|
+
experimental_output?: never;
|
|
2145
|
+
}): Promise<GenerateTextResult<any, Z extends ZodSchema ? z.infer<Z> : unknown>>;
|
|
2146
|
+
generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], args?: AgentGenerateOptions<Z> & ({
|
|
2147
|
+
output: Z;
|
|
2148
|
+
experimental_output?: never;
|
|
2149
|
+
} | {
|
|
2150
|
+
experimental_output: Z;
|
|
2151
|
+
output?: never;
|
|
2152
|
+
})): Promise<GenerateObjectResult<Z extends ZodSchema ? z.infer<Z> : unknown>>;
|
|
2153
|
+
stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], args?: AgentStreamOptions<Z> & {
|
|
2154
|
+
output?: never;
|
|
2155
|
+
experimental_output?: never;
|
|
2156
|
+
}): Promise<StreamTextResult<any, Z extends ZodSchema ? z.infer<Z> : unknown>>;
|
|
2157
|
+
stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], args?: AgentStreamOptions<Z> & ({
|
|
2158
|
+
output: Z;
|
|
2159
|
+
experimental_output?: never;
|
|
2160
|
+
} | {
|
|
2161
|
+
experimental_output: Z;
|
|
2162
|
+
output?: never;
|
|
2163
|
+
})): Promise<StreamObjectResult<any, Z extends ZodSchema ? z.infer<Z> : unknown, any>>;
|
|
2164
|
+
__registerMastra(p: Mastra): void;
|
|
1952
2165
|
}
|
|
1953
2166
|
|
|
1954
|
-
type
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
/**
|
|
1960
|
-
* Interface for message processors that can filter or transform messages
|
|
1961
|
-
* before they're sent to the LLM.
|
|
1962
|
-
*/
|
|
1963
|
-
declare abstract class MemoryProcessor extends MastraBase {
|
|
1964
|
-
/**
|
|
1965
|
-
* Process a list of messages and return a filtered or transformed list.
|
|
1966
|
-
* @param messages The messages to process
|
|
1967
|
-
* @returns The processed messages
|
|
1968
|
-
*/
|
|
1969
|
-
process(messages: CoreMessage$1[], _opts: MemoryProcessorOpts): CoreMessage$1[];
|
|
1970
|
-
}
|
|
1971
|
-
declare const memoryDefaultOptions: {
|
|
1972
|
-
lastMessages: number;
|
|
1973
|
-
semanticRecall: {
|
|
1974
|
-
topK: number;
|
|
1975
|
-
messageRange: {
|
|
1976
|
-
before: number;
|
|
1977
|
-
after: number;
|
|
1978
|
-
};
|
|
1979
|
-
};
|
|
1980
|
-
threads: {
|
|
1981
|
-
generateTitle: true;
|
|
1982
|
-
};
|
|
1983
|
-
workingMemory: {
|
|
1984
|
-
use: "text-stream";
|
|
1985
|
-
enabled: false;
|
|
1986
|
-
template: string;
|
|
1987
|
-
};
|
|
2167
|
+
type ConvertedTool = {
|
|
2168
|
+
name: string;
|
|
2169
|
+
description?: string;
|
|
2170
|
+
parameters: InternalCoreTool['parameters'];
|
|
2171
|
+
execute: InternalCoreTool['execute'];
|
|
1988
2172
|
};
|
|
1989
|
-
|
|
1990
|
-
* Abstract Memory class that defines the interface for storing and retrieving
|
|
1991
|
-
* conversation threads and messages.
|
|
1992
|
-
*/
|
|
1993
|
-
declare abstract class MastraMemory extends MastraBase {
|
|
1994
|
-
MAX_CONTEXT_TOKENS?: number;
|
|
1995
|
-
storage: MastraStorage;
|
|
1996
|
-
vector?: MastraVector;
|
|
1997
|
-
embedder?: EmbeddingModel<string>;
|
|
1998
|
-
private processors;
|
|
1999
|
-
private deprecationWarnings;
|
|
2000
|
-
protected threadConfig: MemoryConfig;
|
|
2001
|
-
constructor(config: {
|
|
2002
|
-
name: string;
|
|
2003
|
-
} & SharedMemoryConfig);
|
|
2004
|
-
private addImplicitDefaultsWarning;
|
|
2005
|
-
setStorage(storage: MastraStorage): void;
|
|
2006
|
-
setVector(vector: MastraVector): void;
|
|
2007
|
-
setEmbedder(embedder: EmbeddingModel<string>): void;
|
|
2008
|
-
/**
|
|
2009
|
-
* Get a system message to inject into the conversation.
|
|
2010
|
-
* This will be called before each conversation turn.
|
|
2011
|
-
* Implementations can override this to inject custom system messages.
|
|
2012
|
-
*/
|
|
2013
|
-
getSystemMessage(_input: {
|
|
2014
|
-
threadId: string;
|
|
2015
|
-
memoryConfig?: MemoryConfig;
|
|
2016
|
-
}): Promise<string | null>;
|
|
2173
|
+
interface MCPServerSSEOptionsBase {
|
|
2017
2174
|
/**
|
|
2018
|
-
*
|
|
2019
|
-
* This will be called when converting tools for the agent.
|
|
2020
|
-
* Implementations can override this to provide additional tools.
|
|
2175
|
+
* Parsed URL of the incoming request
|
|
2021
2176
|
*/
|
|
2022
|
-
|
|
2023
|
-
protected createEmbeddingIndex(dimensions?: number): Promise<{
|
|
2024
|
-
indexName: string;
|
|
2025
|
-
}>;
|
|
2026
|
-
getMergedThreadConfig(config?: MemoryConfig): MemoryConfig;
|
|
2177
|
+
url: URL;
|
|
2027
2178
|
/**
|
|
2028
|
-
*
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
*/
|
|
2032
|
-
private applyProcessors;
|
|
2033
|
-
processMessages({ messages, processors, ...opts }: {
|
|
2034
|
-
messages: CoreMessage$1[];
|
|
2035
|
-
processors?: MemoryProcessor[];
|
|
2036
|
-
} & MemoryProcessorOpts): CoreMessage$1[];
|
|
2037
|
-
abstract rememberMessages({ threadId, resourceId, vectorMessageSearch, systemMessage, config, }: {
|
|
2038
|
-
threadId: string;
|
|
2039
|
-
resourceId?: string;
|
|
2040
|
-
vectorMessageSearch?: string;
|
|
2041
|
-
systemMessage?: CoreMessage$1;
|
|
2042
|
-
config?: MemoryConfig;
|
|
2043
|
-
}): Promise<{
|
|
2044
|
-
threadId: string;
|
|
2045
|
-
messages: CoreMessage$1[];
|
|
2046
|
-
uiMessages: Message[];
|
|
2047
|
-
}>;
|
|
2048
|
-
estimateTokens(text: string): number;
|
|
2049
|
-
protected parseMessages(messages: MessageType[]): CoreMessage$1[];
|
|
2050
|
-
protected convertToUIMessages(messages: MessageType[]): Message[];
|
|
2179
|
+
* Path for establishing the SSE connection (e.g. '/sse')
|
|
2180
|
+
*/
|
|
2181
|
+
ssePath: string;
|
|
2051
2182
|
/**
|
|
2052
|
-
*
|
|
2053
|
-
* @param threadId - The unique identifier of the thread
|
|
2054
|
-
* @returns Promise resolving to the thread or null if not found
|
|
2183
|
+
* Path for POSTing client messages (e.g. '/message')
|
|
2055
2184
|
*/
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2185
|
+
messagePath: string;
|
|
2186
|
+
}
|
|
2187
|
+
/**
|
|
2188
|
+
* Options for starting an MCP server with SSE transport
|
|
2189
|
+
*/
|
|
2190
|
+
interface MCPServerSSEOptions extends MCPServerSSEOptionsBase {
|
|
2062
2191
|
/**
|
|
2063
|
-
*
|
|
2064
|
-
* @param thread - The thread data to save
|
|
2065
|
-
* @returns Promise resolving to the saved thread
|
|
2192
|
+
* Incoming HTTP request
|
|
2066
2193
|
*/
|
|
2067
|
-
|
|
2068
|
-
thread: StorageThreadType;
|
|
2069
|
-
memoryConfig?: MemoryConfig;
|
|
2070
|
-
}): Promise<StorageThreadType>;
|
|
2194
|
+
req: http.IncomingMessage;
|
|
2071
2195
|
/**
|
|
2072
|
-
*
|
|
2073
|
-
* @param messages - Array of messages to save
|
|
2074
|
-
* @returns Promise resolving to the saved messages
|
|
2196
|
+
* HTTP response (must support .write/.end)
|
|
2075
2197
|
*/
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2198
|
+
res: http.ServerResponse<http.IncomingMessage>;
|
|
2199
|
+
}
|
|
2200
|
+
/**
|
|
2201
|
+
* Options for starting an MCP server with Hono SSE transport
|
|
2202
|
+
*/
|
|
2203
|
+
interface MCPServerHonoSSEOptions extends MCPServerSSEOptionsBase {
|
|
2080
2204
|
/**
|
|
2081
|
-
*
|
|
2082
|
-
* @param threadId - The unique identifier of the thread
|
|
2083
|
-
* @returns Promise resolving to array of messages and uiMessages
|
|
2205
|
+
* Incoming Hono context
|
|
2084
2206
|
*/
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
}>;
|
|
2207
|
+
context: Context;
|
|
2208
|
+
}
|
|
2209
|
+
interface MCPServerHTTPOptions {
|
|
2089
2210
|
/**
|
|
2090
|
-
*
|
|
2091
|
-
* @param title - Optional title for the thread
|
|
2092
|
-
* @param metadata - Optional metadata for the thread
|
|
2093
|
-
* @returns Promise resolving to the created thread
|
|
2211
|
+
* Parsed URL of the incoming request
|
|
2094
2212
|
*/
|
|
2095
|
-
|
|
2096
|
-
resourceId: string;
|
|
2097
|
-
threadId?: string;
|
|
2098
|
-
title?: string;
|
|
2099
|
-
metadata?: Record<string, unknown>;
|
|
2100
|
-
memoryConfig?: MemoryConfig;
|
|
2101
|
-
}): Promise<StorageThreadType>;
|
|
2213
|
+
url: URL;
|
|
2102
2214
|
/**
|
|
2103
|
-
*
|
|
2104
|
-
* @param threadId - the id of the thread to delete
|
|
2215
|
+
* Path for establishing the HTTP connection (e.g. '/mcp')
|
|
2105
2216
|
*/
|
|
2106
|
-
|
|
2217
|
+
httpPath: string;
|
|
2107
2218
|
/**
|
|
2108
|
-
*
|
|
2109
|
-
* @param threadId - The thread to add the message to
|
|
2110
|
-
* @param content - The message content
|
|
2111
|
-
* @param role - The role of the message sender
|
|
2112
|
-
* @param type - The type of the message
|
|
2113
|
-
* @param toolNames - Optional array of tool names that were called
|
|
2114
|
-
* @param toolCallArgs - Optional array of tool call arguments
|
|
2115
|
-
* @param toolCallIds - Optional array of tool call ids
|
|
2116
|
-
* @returns Promise resolving to the saved message
|
|
2219
|
+
* Incoming HTTP request
|
|
2117
2220
|
*/
|
|
2118
|
-
|
|
2119
|
-
threadId: string;
|
|
2120
|
-
resourceId: string;
|
|
2121
|
-
config?: MemoryConfig;
|
|
2122
|
-
content: UserContent | AssistantContent;
|
|
2123
|
-
role: 'user' | 'assistant';
|
|
2124
|
-
type: 'text' | 'tool-call' | 'tool-result';
|
|
2125
|
-
toolNames?: string[];
|
|
2126
|
-
toolCallArgs?: Record<string, unknown>[];
|
|
2127
|
-
toolCallIds?: string[];
|
|
2128
|
-
}): Promise<MessageType>;
|
|
2221
|
+
req: http.IncomingMessage;
|
|
2129
2222
|
/**
|
|
2130
|
-
*
|
|
2131
|
-
* @returns A unique string ID
|
|
2223
|
+
* HTTP response (must support .write/.end)
|
|
2132
2224
|
*/
|
|
2133
|
-
|
|
2225
|
+
res: http.ServerResponse<http.IncomingMessage>;
|
|
2226
|
+
/**
|
|
2227
|
+
* Optional options to pass to the transport (e.g. sessionIdGenerator)
|
|
2228
|
+
*/
|
|
2229
|
+
options?: any;
|
|
2134
2230
|
}
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
getModelId(): string;
|
|
2144
|
-
getModel(): ai.LanguageModelV1;
|
|
2145
|
-
convertToMessages(messages: string | string[] | CoreMessage$1[]): CoreMessage$1[];
|
|
2146
|
-
__registerPrimitives(p: MastraPrimitives): void;
|
|
2147
|
-
__registerMastra(p: Mastra): void;
|
|
2148
|
-
__text<Z extends ZodSchema | JSONSchema7 | undefined>(input: LLMTextOptions<Z>): Promise<GenerateTextResult<any, any>>;
|
|
2149
|
-
__textObject<T extends ZodSchema | JSONSchema7 | undefined>(input: LLMTextObjectOptions<T>): Promise<GenerateObjectResult<T>>;
|
|
2150
|
-
generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], options: LLMStreamOptions<Z>): Promise<GenerateReturn<Z>>;
|
|
2151
|
-
__stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(input: LLMInnerStreamOptions<Z>): Promise<StreamTextResult<any, any>>;
|
|
2152
|
-
__streamObject<T extends ZodSchema | JSONSchema7 | undefined>(input: LLMStreamObjectOptions<T>): Promise<StreamObjectResult<DeepPartial<T>, T, never>>;
|
|
2153
|
-
stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], options: LLMStreamOptions<Z>): Promise<StreamReturn<Z>>;
|
|
2231
|
+
/** Describes a source code repository. */
|
|
2232
|
+
interface Repository {
|
|
2233
|
+
/** The URL of the repository (e.g., a GitHub URL). */
|
|
2234
|
+
url: string;
|
|
2235
|
+
/** The source control platform (e.g., 'github', 'gitlab'). */
|
|
2236
|
+
source: 'github' | 'gitlab' | string;
|
|
2237
|
+
/** A unique identifier for the repository at the source. */
|
|
2238
|
+
id: string;
|
|
2154
2239
|
}
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
type StreamTextOptions = Parameters<typeof streamText>[0];
|
|
2195
|
-
type GenerateObjectOptions = Parameters<typeof generateObject>[0];
|
|
2196
|
-
type StreamObjectOptions = Parameters<typeof streamObject>[0];
|
|
2197
|
-
type MastraCustomLLMOptionsKeys = 'messages' | 'tools' | 'model' | 'onStepFinish' | 'experimental_output' | 'experimental_telemetry' | 'messages' | 'onFinish' | 'output';
|
|
2198
|
-
type DefaultLLMTextOptions = Omit<GenerateTextOptions, MastraCustomLLMOptionsKeys>;
|
|
2199
|
-
type DefaultLLMTextObjectOptions = Omit<GenerateObjectOptions, MastraCustomLLMOptionsKeys>;
|
|
2200
|
-
type DefaultLLMStreamOptions = Omit<StreamTextOptions, MastraCustomLLMOptionsKeys>;
|
|
2201
|
-
type DefaultLLMStreamObjectOptions = Omit<StreamObjectOptions, MastraCustomLLMOptionsKeys>;
|
|
2202
|
-
type MastraCustomLLMOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
2203
|
-
tools?: Record<string, CoreTool>;
|
|
2204
|
-
onStepFinish?: (step: unknown) => void;
|
|
2205
|
-
experimental_output?: Z;
|
|
2206
|
-
telemetry?: TelemetrySettings;
|
|
2207
|
-
threadId?: string;
|
|
2208
|
-
resourceId?: string;
|
|
2209
|
-
runtimeContext: RuntimeContext;
|
|
2210
|
-
} & Run$1;
|
|
2211
|
-
type LLMTextOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
2212
|
-
messages: CoreMessage[];
|
|
2213
|
-
} & MastraCustomLLMOptions<Z> & DefaultLLMTextOptions;
|
|
2214
|
-
type LLMTextObjectOptions<T extends ZodSchema | JSONSchema7 | undefined = undefined> = LLMTextOptions<T> & DefaultLLMTextObjectOptions & {
|
|
2215
|
-
structuredOutput: JSONSchema7 | z.ZodType<T> | StructuredOutput;
|
|
2216
|
-
};
|
|
2217
|
-
type LLMStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
2218
|
-
output?: OutputType | Z;
|
|
2219
|
-
onFinish?: (result: string) => Promise<void> | void;
|
|
2220
|
-
} & MastraCustomLLMOptions<Z> & DefaultLLMStreamOptions;
|
|
2221
|
-
type LLMInnerStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
2222
|
-
messages: CoreMessage[];
|
|
2223
|
-
onFinish?: (result: string) => Promise<void> | void;
|
|
2224
|
-
} & MastraCustomLLMOptions<Z> & DefaultLLMStreamOptions;
|
|
2225
|
-
type LLMStreamObjectOptions<T extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
2226
|
-
structuredOutput: JSONSchema7 | z.ZodType<T> | StructuredOutput;
|
|
2227
|
-
} & LLMInnerStreamOptions<T> & DefaultLLMStreamObjectOptions;
|
|
2228
|
-
|
|
2229
|
-
type VoiceEventType = 'speaking' | 'writing' | 'error' | string;
|
|
2230
|
-
interface VoiceEventMap {
|
|
2231
|
-
speaker: NodeJS.ReadableStream;
|
|
2232
|
-
speaking: {
|
|
2233
|
-
audio?: string;
|
|
2234
|
-
};
|
|
2235
|
-
writing: {
|
|
2236
|
-
text: string;
|
|
2237
|
-
role: 'assistant' | 'user';
|
|
2238
|
-
};
|
|
2239
|
-
error: {
|
|
2240
|
-
message: string;
|
|
2241
|
-
code?: string;
|
|
2242
|
-
details?: unknown;
|
|
2243
|
-
};
|
|
2244
|
-
[key: string]: unknown;
|
|
2240
|
+
/** Provides details about a specific version of an MCP server. */
|
|
2241
|
+
interface VersionDetail {
|
|
2242
|
+
/** The semantic version string (e.g., "1.0.2"). */
|
|
2243
|
+
version: string;
|
|
2244
|
+
/** The ISO 8601 date-time string when this version was released or registered. */
|
|
2245
|
+
release_date: string;
|
|
2246
|
+
/** Indicates if this version is the latest available. */
|
|
2247
|
+
is_latest: boolean;
|
|
2248
|
+
}
|
|
2249
|
+
/** Base interface for command-line arguments. */
|
|
2250
|
+
interface ArgumentInfo {
|
|
2251
|
+
/** The name of the argument. */
|
|
2252
|
+
name: string;
|
|
2253
|
+
/** A description of what the argument is for. */
|
|
2254
|
+
description: string;
|
|
2255
|
+
/** Whether the argument is required. */
|
|
2256
|
+
is_required: boolean;
|
|
2257
|
+
/** Whether the argument can be specified multiple times. */
|
|
2258
|
+
is_repeatable?: boolean;
|
|
2259
|
+
/** Whether the argument's value can be edited by the user (e.g., in a UI). */
|
|
2260
|
+
is_editable?: boolean;
|
|
2261
|
+
/** A list of predefined choices for the argument's value. */
|
|
2262
|
+
choices?: string[];
|
|
2263
|
+
/** The default value for the argument if not specified. */
|
|
2264
|
+
default_value?: string | number | boolean;
|
|
2265
|
+
}
|
|
2266
|
+
/** Describes a positional argument for a command. */
|
|
2267
|
+
interface PositionalArgumentInfo extends ArgumentInfo {
|
|
2268
|
+
/** The 0-indexed position of the argument. */
|
|
2269
|
+
position: number;
|
|
2270
|
+
}
|
|
2271
|
+
/** Describes a named argument (flag) for a command. */
|
|
2272
|
+
interface NamedArgumentInfo extends ArgumentInfo {
|
|
2273
|
+
/** The short flag for the argument (e.g., "-y"). */
|
|
2274
|
+
short_flag?: string;
|
|
2275
|
+
/** The long flag for the argument (e.g., "--yes"). */
|
|
2276
|
+
long_flag?: string;
|
|
2277
|
+
/** Whether the flag requires a value (e.g., `--config <value>`) or is a boolean flag. */
|
|
2278
|
+
requires_value?: boolean;
|
|
2245
2279
|
}
|
|
2246
|
-
|
|
2280
|
+
/** Describes a subcommand for a command-line tool. */
|
|
2281
|
+
interface SubcommandInfo {
|
|
2282
|
+
/** The name of the subcommand (e.g., "run", "list"). */
|
|
2247
2283
|
name: string;
|
|
2248
|
-
|
|
2284
|
+
/** A description of what the subcommand does. */
|
|
2285
|
+
description: string;
|
|
2286
|
+
/** Whether this subcommand is required if its parent command is used. */
|
|
2287
|
+
is_required?: boolean;
|
|
2288
|
+
/** Nested subcommands. */
|
|
2289
|
+
subcommands?: SubcommandInfo[];
|
|
2290
|
+
/** Positional arguments for this subcommand. */
|
|
2291
|
+
positional_arguments?: PositionalArgumentInfo[];
|
|
2292
|
+
/** Named arguments (flags) for this subcommand. */
|
|
2293
|
+
named_arguments?: NamedArgumentInfo[];
|
|
2249
2294
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2295
|
+
/** Describes a command to run an MCP server package. */
|
|
2296
|
+
interface CommandInfo {
|
|
2297
|
+
/** The primary command executable (e.g., "npx", "docker"). */
|
|
2298
|
+
name: 'npx' | 'docker' | 'pypi' | 'uvx' | string;
|
|
2299
|
+
/** Subcommands to append to the primary command. */
|
|
2300
|
+
subcommands?: SubcommandInfo[];
|
|
2301
|
+
/** Positional arguments for the command. */
|
|
2302
|
+
positional_arguments?: PositionalArgumentInfo[];
|
|
2303
|
+
/** Named arguments (flags) for the command. */
|
|
2304
|
+
named_arguments?: NamedArgumentInfo[];
|
|
2260
2305
|
}
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
/**
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
/**
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
options?: TListenOptions): Promise<string | NodeJS.ReadableStream | void>;
|
|
2301
|
-
updateConfig(_options: Record<string, unknown>): void;
|
|
2302
|
-
/**
|
|
2303
|
-
* Initializes a WebSocket or WebRTC connection for real-time communication
|
|
2304
|
-
* @returns Promise that resolves when the connection is established
|
|
2305
|
-
*/
|
|
2306
|
-
connect(_options?: Record<string, unknown>): Promise<void>;
|
|
2306
|
+
/** Describes an environment variable required or used by an MCP server package. */
|
|
2307
|
+
interface EnvironmentVariableInfo {
|
|
2308
|
+
/** The name of the environment variable (e.g., "API_KEY"). */
|
|
2309
|
+
name: string;
|
|
2310
|
+
/** A description of what the environment variable is for. */
|
|
2311
|
+
description: string;
|
|
2312
|
+
/** Whether the environment variable is required. */
|
|
2313
|
+
required?: boolean;
|
|
2314
|
+
/** The default value for the environment variable if not set. */
|
|
2315
|
+
default_value?: string;
|
|
2316
|
+
}
|
|
2317
|
+
/** Describes an installable package for an MCP server. */
|
|
2318
|
+
interface PackageInfo {
|
|
2319
|
+
/** The name of the package registry (e.g., "npm", "docker"). */
|
|
2320
|
+
registry_name: 'npm' | 'docker' | 'pypi' | 'homebrew' | string;
|
|
2321
|
+
/** The name of the package. */
|
|
2322
|
+
name: string;
|
|
2323
|
+
/** The version of the package. */
|
|
2324
|
+
version: string;
|
|
2325
|
+
/** The command structure to run this package as an MCP server. */
|
|
2326
|
+
command?: CommandInfo;
|
|
2327
|
+
/** Environment variables relevant to this package. */
|
|
2328
|
+
environment_variables?: EnvironmentVariableInfo[];
|
|
2329
|
+
}
|
|
2330
|
+
/** Describes a remote endpoint for accessing an MCP server. */
|
|
2331
|
+
interface RemoteInfo {
|
|
2332
|
+
/** The transport type for the remote connection (e.g., "sse", "streamable"). */
|
|
2333
|
+
transport_type: 'streamable' | 'sse' | string;
|
|
2334
|
+
/** The URL of the remote endpoint. */
|
|
2335
|
+
url: string;
|
|
2336
|
+
}
|
|
2337
|
+
/** Configuration options for creating an MCPServer instance. */
|
|
2338
|
+
interface MCPServerConfig {
|
|
2339
|
+
/** The display name of the MCP server. */
|
|
2340
|
+
name: string;
|
|
2341
|
+
/** The semantic version of the MCP server. */
|
|
2342
|
+
version: string;
|
|
2343
|
+
/** The tools that this MCP server will expose. */
|
|
2344
|
+
tools: ToolsInput;
|
|
2307
2345
|
/**
|
|
2308
|
-
*
|
|
2309
|
-
*
|
|
2346
|
+
* Optional unique identifier for the server.
|
|
2347
|
+
* If not provided, a UUID will be generated.
|
|
2348
|
+
* If provided, this ID is considered final and cannot be changed by Mastra.
|
|
2310
2349
|
*/
|
|
2311
|
-
|
|
2350
|
+
id?: string;
|
|
2351
|
+
/** Optional description of the MCP server. */
|
|
2352
|
+
description?: string;
|
|
2353
|
+
/** Optional repository information for the server's source code. */
|
|
2354
|
+
repository?: Repository;
|
|
2312
2355
|
/**
|
|
2313
|
-
*
|
|
2356
|
+
* Optional release date of this server version (ISO 8601 string).
|
|
2357
|
+
* Defaults to the time of instantiation if not provided.
|
|
2314
2358
|
*/
|
|
2315
|
-
|
|
2359
|
+
releaseDate?: string;
|
|
2316
2360
|
/**
|
|
2317
|
-
*
|
|
2318
|
-
*
|
|
2361
|
+
* Optional flag indicating if this is the latest version.
|
|
2362
|
+
* Defaults to true if not provided.
|
|
2319
2363
|
*/
|
|
2320
|
-
|
|
2364
|
+
isLatest?: boolean;
|
|
2321
2365
|
/**
|
|
2322
|
-
*
|
|
2323
|
-
*
|
|
2366
|
+
* Optional canonical packaging format if the server is distributed as a package
|
|
2367
|
+
* (e.g., "npm", "docker").
|
|
2324
2368
|
*/
|
|
2325
|
-
|
|
2369
|
+
packageCanonical?: 'npm' | 'docker' | 'pypi' | 'crates' | string;
|
|
2370
|
+
/** Optional list of installable packages for this server. */
|
|
2371
|
+
packages?: PackageInfo[];
|
|
2372
|
+
/** Optional list of remote access points for this server. */
|
|
2373
|
+
remotes?: RemoteInfo[];
|
|
2374
|
+
}
|
|
2375
|
+
/** Basic information about an MCP server, conforming to the MCP Registry 'Server' schema. */
|
|
2376
|
+
interface ServerInfo {
|
|
2377
|
+
/** The unique ID of the server. */
|
|
2378
|
+
id: string;
|
|
2379
|
+
/** The name of the server. */
|
|
2380
|
+
name: string;
|
|
2381
|
+
/** A description of the server. */
|
|
2382
|
+
description?: string;
|
|
2383
|
+
/** Repository information for the server. */
|
|
2384
|
+
repository?: Repository;
|
|
2385
|
+
/** Detailed version information. */
|
|
2386
|
+
version_detail: VersionDetail;
|
|
2387
|
+
}
|
|
2388
|
+
/** Detailed information about an MCP server, conforming to the MCP Registry 'ServerDetail' schema. */
|
|
2389
|
+
interface ServerDetailInfo extends ServerInfo {
|
|
2390
|
+
/** The canonical packaging format, if applicable. */
|
|
2391
|
+
package_canonical?: MCPServerConfig['packageCanonical'];
|
|
2392
|
+
/** Information about installable packages for this server. */
|
|
2393
|
+
packages?: PackageInfo[];
|
|
2394
|
+
/** Information about remote access points for this server. */
|
|
2395
|
+
remotes?: RemoteInfo[];
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2398
|
+
/**
|
|
2399
|
+
* Abstract base class for MCP server implementations.
|
|
2400
|
+
* This provides a common interface and shared functionality for all MCP servers
|
|
2401
|
+
* that can be registered with Mastra, including handling of server metadata.
|
|
2402
|
+
*/
|
|
2403
|
+
declare abstract class MCPServerBase extends MastraBase {
|
|
2404
|
+
/** Tracks if the server ID has been definitively set. */
|
|
2405
|
+
private idWasSet;
|
|
2406
|
+
/** The display name of the MCP server. */
|
|
2407
|
+
readonly name: string;
|
|
2408
|
+
/** The semantic version of the MCP server. */
|
|
2409
|
+
readonly version: string;
|
|
2410
|
+
/** Internal storage for the server's unique ID. */
|
|
2411
|
+
private _id;
|
|
2412
|
+
/** A description of what the MCP server does. */
|
|
2413
|
+
readonly description?: string;
|
|
2414
|
+
/** Repository information for the server's source code. */
|
|
2415
|
+
readonly repository?: Repository;
|
|
2416
|
+
/** The release date of this server version (ISO 8601 string). */
|
|
2417
|
+
readonly releaseDate: string;
|
|
2418
|
+
/** Indicates if this version is the latest available. */
|
|
2419
|
+
readonly isLatest: boolean;
|
|
2420
|
+
/** The canonical packaging format (e.g., "npm", "docker"), if applicable. */
|
|
2421
|
+
readonly packageCanonical?: MCPServerConfig['packageCanonical'];
|
|
2422
|
+
/** Information about installable packages for this server. */
|
|
2423
|
+
readonly packages?: PackageInfo[];
|
|
2424
|
+
/** Information about remote access points for this server. */
|
|
2425
|
+
readonly remotes?: RemoteInfo[];
|
|
2426
|
+
/** The tools registered with and converted by this MCP server. */
|
|
2427
|
+
readonly convertedTools: Record<string, ConvertedTool>;
|
|
2428
|
+
/** Reference to the Mastra instance if this server is registered with one. */
|
|
2429
|
+
mastra: Mastra | undefined;
|
|
2326
2430
|
/**
|
|
2327
|
-
*
|
|
2431
|
+
* Public getter for the server's unique ID.
|
|
2432
|
+
* The ID is set at construction or by Mastra and is read-only afterwards.
|
|
2328
2433
|
*/
|
|
2329
|
-
|
|
2434
|
+
get id(): string;
|
|
2330
2435
|
/**
|
|
2331
|
-
*
|
|
2332
|
-
* @
|
|
2333
|
-
* @param callback Callback function that receives event data
|
|
2436
|
+
* Gets a read-only view of the registered tools.
|
|
2437
|
+
* @returns A readonly record of converted tools.
|
|
2334
2438
|
*/
|
|
2335
|
-
|
|
2439
|
+
tools(): Readonly<Record<string, ConvertedTool>>;
|
|
2336
2440
|
/**
|
|
2337
|
-
*
|
|
2338
|
-
*
|
|
2339
|
-
*
|
|
2441
|
+
* Sets the server's unique ID. This method is typically called by Mastra when
|
|
2442
|
+
* registering the server, using the key provided in the Mastra configuration.
|
|
2443
|
+
* It ensures the ID is set only once.
|
|
2444
|
+
* If an ID was already provided in the MCPServerConfig, this method will be a no-op.
|
|
2445
|
+
* @param id The unique ID to assign to the server.
|
|
2340
2446
|
*/
|
|
2341
|
-
|
|
2447
|
+
setId(id: string): void;
|
|
2342
2448
|
/**
|
|
2343
|
-
*
|
|
2344
|
-
* @
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
} & TSpeakerMetadata>>;
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
|
-
declare class CompositeVoice extends MastraVoice<unknown, unknown, unknown, ToolsInput, VoiceEventMap> {
|
|
2352
|
-
protected speakProvider?: MastraVoice;
|
|
2353
|
-
protected listenProvider?: MastraVoice;
|
|
2354
|
-
protected realtimeProvider?: MastraVoice;
|
|
2355
|
-
constructor({ input, output, realtime, speakProvider, listenProvider, realtimeProvider, }: {
|
|
2356
|
-
/** @deprecated use output instead */
|
|
2357
|
-
speakProvider?: MastraVoice;
|
|
2358
|
-
/** @deprecated use input instead */
|
|
2359
|
-
listenProvider?: MastraVoice;
|
|
2360
|
-
/** @deprecated use realtime instead */
|
|
2361
|
-
realtimeProvider?: MastraVoice;
|
|
2362
|
-
input?: MastraVoice;
|
|
2363
|
-
output?: MastraVoice;
|
|
2364
|
-
realtime?: MastraVoice;
|
|
2365
|
-
});
|
|
2449
|
+
* Abstract method to convert and validate tool definitions provided to the server.
|
|
2450
|
+
* @param tools Tool definitions to convert.
|
|
2451
|
+
* @returns A record of converted and validated tools.
|
|
2452
|
+
*/
|
|
2453
|
+
abstract convertTools(tools: ToolsInput): Record<string, ConvertedTool>;
|
|
2366
2454
|
/**
|
|
2367
|
-
*
|
|
2368
|
-
* @param
|
|
2369
|
-
* @
|
|
2370
|
-
* @returns Audio stream or void if in realtime mode
|
|
2455
|
+
* Internal method used by Mastra to register itself with the server.
|
|
2456
|
+
* @param mastra The Mastra instance.
|
|
2457
|
+
* @internal
|
|
2371
2458
|
*/
|
|
2372
|
-
|
|
2373
|
-
speaker?: string;
|
|
2374
|
-
} & any): Promise<NodeJS.ReadableStream | void>;
|
|
2375
|
-
listen(audioStream: NodeJS.ReadableStream, options?: any): Promise<string | void | NodeJS.ReadableStream>;
|
|
2376
|
-
getSpeakers(): Promise<{
|
|
2377
|
-
voiceId: string;
|
|
2378
|
-
}[]>;
|
|
2379
|
-
updateConfig(options: Record<string, unknown>): void;
|
|
2459
|
+
__registerMastra(mastra: Mastra): void;
|
|
2380
2460
|
/**
|
|
2381
|
-
*
|
|
2382
|
-
* @
|
|
2461
|
+
* Constructor for the MCPServerBase.
|
|
2462
|
+
* @param config Configuration options for the MCP server, including metadata.
|
|
2383
2463
|
*/
|
|
2384
|
-
|
|
2464
|
+
constructor(config: MCPServerConfig);
|
|
2385
2465
|
/**
|
|
2386
|
-
*
|
|
2387
|
-
*
|
|
2466
|
+
* Start the MCP server using stdio transport
|
|
2467
|
+
* This is typically used for Windsurf integration
|
|
2388
2468
|
*/
|
|
2389
|
-
|
|
2469
|
+
abstract startStdio(): Promise<void>;
|
|
2390
2470
|
/**
|
|
2391
|
-
*
|
|
2471
|
+
* Start the MCP server using SSE transport
|
|
2472
|
+
* This is typically used for web integration
|
|
2473
|
+
* @param options Options for the SSE transport
|
|
2392
2474
|
*/
|
|
2393
|
-
|
|
2475
|
+
abstract startSSE(options: MCPServerSSEOptions): Promise<void>;
|
|
2394
2476
|
/**
|
|
2395
|
-
*
|
|
2396
|
-
*
|
|
2477
|
+
* Start the MCP server using Hono SSE transport
|
|
2478
|
+
* Used for Hono servers
|
|
2479
|
+
* @param options Options for the SSE transport
|
|
2397
2480
|
*/
|
|
2398
|
-
|
|
2481
|
+
abstract startHonoSSE(options: MCPServerHonoSSEOptions): Promise<Response | undefined>;
|
|
2399
2482
|
/**
|
|
2400
|
-
*
|
|
2401
|
-
* @param
|
|
2483
|
+
* Start the MCP server using HTTP transport
|
|
2484
|
+
* @param options Options for the HTTP transport
|
|
2402
2485
|
*/
|
|
2403
|
-
|
|
2486
|
+
abstract startHTTP(options: MCPServerHTTPOptions): Promise<void>;
|
|
2404
2487
|
/**
|
|
2405
|
-
*
|
|
2488
|
+
* Close the MCP server and all its connections
|
|
2406
2489
|
*/
|
|
2407
|
-
close(): void
|
|
2490
|
+
abstract close(): Promise<void>;
|
|
2408
2491
|
/**
|
|
2409
|
-
*
|
|
2410
|
-
*
|
|
2411
|
-
* @
|
|
2492
|
+
* Gets the basic information about the server, conforming to the MCP Registry 'Server' schema.
|
|
2493
|
+
* This information is suitable for listing multiple servers.
|
|
2494
|
+
* @returns ServerInfo object containing basic server metadata.
|
|
2412
2495
|
*/
|
|
2413
|
-
|
|
2496
|
+
abstract getServerInfo(): ServerInfo;
|
|
2414
2497
|
/**
|
|
2415
|
-
*
|
|
2416
|
-
*
|
|
2417
|
-
* @
|
|
2498
|
+
* Gets detailed information about the server, conforming to the MCP Registry 'ServerDetail' schema.
|
|
2499
|
+
* This includes all information from `getServerInfo` plus package and remote details.
|
|
2500
|
+
* @returns ServerDetailInfo object containing comprehensive server metadata.
|
|
2418
2501
|
*/
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
}
|
|
2430
|
-
|
|
2431
|
-
type ToolsInput = Record<string, ToolAction<any, any, any> | VercelTool>;
|
|
2432
|
-
type ToolsetsInput = Record<string, ToolsInput>;
|
|
2433
|
-
type MastraLanguageModel = LanguageModelV1;
|
|
2434
|
-
type DynamicArgument<T> = T | (({ runtimeContext }: {
|
|
2435
|
-
runtimeContext: RuntimeContext;
|
|
2436
|
-
}) => Promise<T> | T);
|
|
2437
|
-
interface AgentConfig<TAgentId extends string = string, TTools extends ToolsInput = ToolsInput, TMetrics extends Record<string, Metric> = Record<string, Metric>> {
|
|
2438
|
-
name: TAgentId;
|
|
2439
|
-
instructions: DynamicArgument<string>;
|
|
2440
|
-
model: DynamicArgument<MastraLanguageModel>;
|
|
2441
|
-
tools?: DynamicArgument<TTools>;
|
|
2442
|
-
workflows?: DynamicArgument<Record<string, NewWorkflow>>;
|
|
2443
|
-
defaultGenerateOptions?: AgentGenerateOptions;
|
|
2444
|
-
defaultStreamOptions?: AgentStreamOptions;
|
|
2445
|
-
mastra?: Mastra;
|
|
2446
|
-
evals?: TMetrics;
|
|
2447
|
-
memory?: MastraMemory;
|
|
2448
|
-
voice?: CompositeVoice;
|
|
2449
|
-
/** @deprecated This property is deprecated. Use evals instead to add evaluation metrics. */
|
|
2450
|
-
metrics?: TMetrics;
|
|
2451
|
-
}
|
|
2452
|
-
/**
|
|
2453
|
-
* Options for generating responses with an agent
|
|
2454
|
-
* @template Z - The schema type for structured output (Zod schema or JSON schema)
|
|
2455
|
-
*/
|
|
2456
|
-
type AgentGenerateOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
2457
|
-
/** Optional instructions to override the agent's default instructions */
|
|
2458
|
-
instructions?: string;
|
|
2459
|
-
/** Additional tool sets that can be used for this generation */
|
|
2460
|
-
toolsets?: ToolsetsInput;
|
|
2461
|
-
clientTools?: ToolsInput;
|
|
2462
|
-
/** Additional context messages to include */
|
|
2463
|
-
context?: CoreMessage[];
|
|
2464
|
-
/** Memory configuration options */
|
|
2465
|
-
memoryOptions?: MemoryConfig;
|
|
2466
|
-
/** Unique ID for this generation run */
|
|
2467
|
-
runId?: string;
|
|
2468
|
-
/** Callback fired after each generation step completes */
|
|
2469
|
-
onStepFinish?: Z extends undefined ? GenerateTextOnStepFinishCallback<any> : never;
|
|
2470
|
-
/** Maximum number of steps allowed for generation */
|
|
2471
|
-
maxSteps?: number;
|
|
2472
|
-
/** Schema for structured output, does not work with tools, use experimental_output instead */
|
|
2473
|
-
output?: OutputType | Z;
|
|
2474
|
-
/** Schema for structured output generation alongside tool calls. */
|
|
2475
|
-
experimental_output?: Z;
|
|
2476
|
-
/** Controls how tools are selected during generation */
|
|
2477
|
-
toolChoice?: 'auto' | 'none' | 'required' | {
|
|
2478
|
-
type: 'tool';
|
|
2479
|
-
toolName: string;
|
|
2480
|
-
};
|
|
2481
|
-
/** Telemetry settings */
|
|
2482
|
-
telemetry?: TelemetrySettings;
|
|
2483
|
-
/** RuntimeContext for dependency injection */
|
|
2484
|
-
runtimeContext?: RuntimeContext;
|
|
2485
|
-
} & ({
|
|
2486
|
-
resourceId?: undefined;
|
|
2487
|
-
threadId?: undefined;
|
|
2488
|
-
} | {
|
|
2489
|
-
resourceId: string;
|
|
2490
|
-
threadId: string;
|
|
2491
|
-
}) & (Z extends undefined ? DefaultLLMTextOptions : DefaultLLMTextObjectOptions);
|
|
2492
|
-
/**
|
|
2493
|
-
* Options for streaming responses with an agent
|
|
2494
|
-
* @template Z - The schema type for structured output (Zod schema or JSON schema)
|
|
2495
|
-
*/
|
|
2496
|
-
type AgentStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
2497
|
-
/** Optional instructions to override the agent's default instructions */
|
|
2498
|
-
instructions?: string;
|
|
2499
|
-
/** Additional tool sets that can be used for this generation */
|
|
2500
|
-
toolsets?: ToolsetsInput;
|
|
2501
|
-
clientTools?: ToolsInput;
|
|
2502
|
-
/** Additional context messages to include */
|
|
2503
|
-
context?: CoreMessage[];
|
|
2504
|
-
/** Memory configuration options */
|
|
2505
|
-
memoryOptions?: MemoryConfig;
|
|
2506
|
-
/** Unique ID for this generation run */
|
|
2507
|
-
runId?: string;
|
|
2508
|
-
/** Callback fired when streaming completes */
|
|
2509
|
-
onFinish?: Z extends undefined ? StreamTextOnFinishCallback<any> : Z extends ZodSchema ? StreamObjectOnFinishCallback<z.infer<Z>> : StreamObjectOnFinishCallback<any>;
|
|
2510
|
-
/** Callback fired after each generation step completes */
|
|
2511
|
-
onStepFinish?: Z extends undefined ? StreamTextOnStepFinishCallback<any> : never;
|
|
2512
|
-
/** Maximum number of steps allowed for generation */
|
|
2513
|
-
maxSteps?: number;
|
|
2514
|
-
/** Schema for structured output */
|
|
2515
|
-
output?: OutputType | Z;
|
|
2516
|
-
/** Temperature parameter for controlling randomness */
|
|
2517
|
-
temperature?: number;
|
|
2518
|
-
/** Controls how tools are selected during generation */
|
|
2519
|
-
toolChoice?: 'auto' | 'none' | 'required' | {
|
|
2520
|
-
type: 'tool';
|
|
2521
|
-
toolName: string;
|
|
2502
|
+
abstract getServerDetail(): ServerDetailInfo;
|
|
2503
|
+
/**
|
|
2504
|
+
* Gets a list of tools provided by this MCP server, including their schemas.
|
|
2505
|
+
* @returns An object containing an array of tool information.
|
|
2506
|
+
*/
|
|
2507
|
+
abstract getToolListInfo(): {
|
|
2508
|
+
tools: Array<{
|
|
2509
|
+
name: string;
|
|
2510
|
+
description?: string;
|
|
2511
|
+
inputSchema: string;
|
|
2512
|
+
}>;
|
|
2522
2513
|
};
|
|
2523
|
-
/**
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
} |
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2514
|
+
/**
|
|
2515
|
+
* Gets information for a specific tool provided by this MCP server.
|
|
2516
|
+
* @param toolId The ID/name of the tool to retrieve.
|
|
2517
|
+
* @returns Tool information (name, description, inputSchema) or undefined if not found.
|
|
2518
|
+
*/
|
|
2519
|
+
abstract getToolInfo(toolId: string): {
|
|
2520
|
+
name: string;
|
|
2521
|
+
description?: string;
|
|
2522
|
+
inputSchema: string;
|
|
2523
|
+
} | undefined;
|
|
2524
|
+
/**
|
|
2525
|
+
* Executes a specific tool provided by this MCP server.
|
|
2526
|
+
* @param toolId The ID/name of the tool to execute.
|
|
2527
|
+
* @param args The arguments to pass to the tool's execute function.
|
|
2528
|
+
* @param executionContext Optional context for the tool execution (e.g., messages, toolCallId).
|
|
2529
|
+
* @returns A promise that resolves to the result of the tool execution.
|
|
2530
|
+
* @throws Error if the tool is not found, or if execution fails.
|
|
2531
|
+
*/
|
|
2532
|
+
abstract executeTool(toolId: string, args: any, executionContext?: {
|
|
2533
|
+
messages?: any[];
|
|
2534
|
+
toolCallId?: string;
|
|
2535
|
+
}): Promise<any>;
|
|
2536
|
+
}
|
|
2536
2537
|
|
|
2537
2538
|
type Methods = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'ALL';
|
|
2538
2539
|
type ApiRoute = {
|
|
@@ -2554,6 +2555,47 @@ type Middleware = MiddlewareHandler | {
|
|
|
2554
2555
|
path: string;
|
|
2555
2556
|
handler: MiddlewareHandler;
|
|
2556
2557
|
};
|
|
2558
|
+
type ContextWithMastra = Context<{
|
|
2559
|
+
Variables: {
|
|
2560
|
+
mastra: Mastra;
|
|
2561
|
+
runtimeContext: RuntimeContext;
|
|
2562
|
+
};
|
|
2563
|
+
}>;
|
|
2564
|
+
type MastraAuthConfig<TUser = unknown> = {
|
|
2565
|
+
/**
|
|
2566
|
+
* Public paths for the server
|
|
2567
|
+
*/
|
|
2568
|
+
public?: (RegExp | string | [string, Methods | Methods[]])[];
|
|
2569
|
+
/**
|
|
2570
|
+
* Public paths for the server
|
|
2571
|
+
*/
|
|
2572
|
+
authenticateToken?: (token: string, request: HonoRequest) => Promise<TUser>;
|
|
2573
|
+
/**
|
|
2574
|
+
* Authorization function for the server
|
|
2575
|
+
*/
|
|
2576
|
+
authorize?: (path: string, method: string, user: TUser, context: ContextWithMastra) => Promise<boolean>;
|
|
2577
|
+
/**
|
|
2578
|
+
* Rules for the server
|
|
2579
|
+
*/
|
|
2580
|
+
rules?: {
|
|
2581
|
+
/**
|
|
2582
|
+
* Path for the rule
|
|
2583
|
+
*/
|
|
2584
|
+
path?: RegExp | string | string[];
|
|
2585
|
+
/**
|
|
2586
|
+
* Method for the rule
|
|
2587
|
+
*/
|
|
2588
|
+
methods?: Methods | Methods[];
|
|
2589
|
+
/**
|
|
2590
|
+
* Condition for the rule
|
|
2591
|
+
*/
|
|
2592
|
+
condition?: (user: TUser) => Promise<boolean> | boolean;
|
|
2593
|
+
/**
|
|
2594
|
+
* Allow the rule
|
|
2595
|
+
*/
|
|
2596
|
+
allow?: boolean;
|
|
2597
|
+
}[];
|
|
2598
|
+
};
|
|
2557
2599
|
type ServerConfig = {
|
|
2558
2600
|
/**
|
|
2559
2601
|
* Port for the server
|
|
@@ -2607,16 +2649,20 @@ type ServerConfig = {
|
|
|
2607
2649
|
* @default 4.5mb
|
|
2608
2650
|
*/
|
|
2609
2651
|
bodySizeLimit?: number;
|
|
2652
|
+
/**
|
|
2653
|
+
* Authentication configuration for the server
|
|
2654
|
+
*/
|
|
2655
|
+
experimental_auth?: MastraAuthConfig<any>;
|
|
2610
2656
|
};
|
|
2611
2657
|
|
|
2612
|
-
interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>,
|
|
2658
|
+
interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TLegacyWorkflows extends Record<string, LegacyWorkflow> = Record<string, LegacyWorkflow>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends IMastraLogger = IMastraLogger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>, TMCPServers extends Record<string, MCPServerBase> = Record<string, MCPServerBase>> {
|
|
2613
2659
|
agents?: TAgents;
|
|
2614
2660
|
networks?: TNetworks;
|
|
2615
2661
|
storage?: MastraStorage;
|
|
2616
2662
|
vectors?: TVectors;
|
|
2617
2663
|
logger?: TLogger | false;
|
|
2664
|
+
legacy_workflows?: TLegacyWorkflows;
|
|
2618
2665
|
workflows?: TWorkflows;
|
|
2619
|
-
vnext_workflows?: TNewWorkflows;
|
|
2620
2666
|
tts?: TTTS;
|
|
2621
2667
|
telemetry?: OtelConfig;
|
|
2622
2668
|
deployer?: MastraDeployer;
|
|
@@ -2631,9 +2677,9 @@ interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Age
|
|
|
2631
2677
|
handler: (c: any, next: () => Promise<void>) => Promise<Response | void>;
|
|
2632
2678
|
path?: string;
|
|
2633
2679
|
}>;
|
|
2634
|
-
memory?:
|
|
2680
|
+
memory?: never;
|
|
2635
2681
|
}
|
|
2636
|
-
declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>,
|
|
2682
|
+
declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TLegacyWorkflows extends Record<string, LegacyWorkflow> = Record<string, LegacyWorkflow>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends IMastraLogger = IMastraLogger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>, TMCPServers extends Record<string, MCPServerBase> = Record<string, MCPServerBase>> {
|
|
2637
2683
|
#private;
|
|
2638
2684
|
/**
|
|
2639
2685
|
* @deprecated use getTelemetry() instead
|
|
@@ -2647,24 +2693,24 @@ declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string,
|
|
|
2647
2693
|
* @deprecated use getMemory() instead
|
|
2648
2694
|
*/
|
|
2649
2695
|
get memory(): MastraMemory | undefined;
|
|
2650
|
-
constructor(config?: Config<TAgents,
|
|
2696
|
+
constructor(config?: Config<TAgents, TLegacyWorkflows, TWorkflows, TVectors, TTTS, TLogger, TNetworks, TMCPServers>);
|
|
2651
2697
|
getAgent<TAgentName extends keyof TAgents>(name: TAgentName): TAgents[TAgentName];
|
|
2652
2698
|
getAgents(): TAgents;
|
|
2653
2699
|
getVector<TVectorName extends keyof TVectors>(name: TVectorName): TVectors[TVectorName];
|
|
2654
2700
|
getVectors(): TVectors | undefined;
|
|
2655
2701
|
getDeployer(): MastraDeployer | undefined;
|
|
2702
|
+
legacy_getWorkflow<TWorkflowId extends keyof TLegacyWorkflows>(id: TWorkflowId, { serialized }?: {
|
|
2703
|
+
serialized?: boolean;
|
|
2704
|
+
}): TLegacyWorkflows[TWorkflowId];
|
|
2656
2705
|
getWorkflow<TWorkflowId extends keyof TWorkflows>(id: TWorkflowId, { serialized }?: {
|
|
2657
2706
|
serialized?: boolean;
|
|
2658
2707
|
}): TWorkflows[TWorkflowId];
|
|
2659
|
-
|
|
2708
|
+
legacy_getWorkflows(props?: {
|
|
2660
2709
|
serialized?: boolean;
|
|
2661
|
-
}):
|
|
2710
|
+
}): Record<string, LegacyWorkflow>;
|
|
2662
2711
|
getWorkflows(props?: {
|
|
2663
2712
|
serialized?: boolean;
|
|
2664
2713
|
}): Record<string, Workflow>;
|
|
2665
|
-
vnext_getWorkflows(props?: {
|
|
2666
|
-
serialized?: boolean;
|
|
2667
|
-
}): Record<string, NewWorkflow>;
|
|
2668
2714
|
setStorage(storage: MastraStorage): void;
|
|
2669
2715
|
setLogger({ logger }: {
|
|
2670
2716
|
logger: TLogger;
|
|
@@ -2690,8 +2736,8 @@ declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string,
|
|
|
2690
2736
|
getLogsByRunId({ runId, transportId }: {
|
|
2691
2737
|
runId: string;
|
|
2692
2738
|
transportId: string;
|
|
2693
|
-
}): Promise<
|
|
2694
|
-
getLogs(transportId: string): Promise<
|
|
2739
|
+
}): Promise<any[]>;
|
|
2740
|
+
getLogs(transportId: string): Promise<any[]>;
|
|
2695
2741
|
/**
|
|
2696
2742
|
* Get all registered MCP server instances.
|
|
2697
2743
|
* @returns A record of MCP server ID to MCPServerBase instance, or undefined if none are registered.
|
|
@@ -2710,7 +2756,7 @@ declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string,
|
|
|
2710
2756
|
}
|
|
2711
2757
|
|
|
2712
2758
|
type MastraPrimitives = {
|
|
2713
|
-
logger?:
|
|
2759
|
+
logger?: IMastraLogger;
|
|
2714
2760
|
telemetry?: Telemetry;
|
|
2715
2761
|
storage?: MastraStorage;
|
|
2716
2762
|
agents?: Record<string, Agent>;
|
|
@@ -2749,7 +2795,7 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
|
|
|
2749
2795
|
get voice(): CompositeVoice;
|
|
2750
2796
|
getWorkflows({ runtimeContext, }?: {
|
|
2751
2797
|
runtimeContext?: RuntimeContext;
|
|
2752
|
-
}): Promise<Record<string,
|
|
2798
|
+
}): Promise<Record<string, Workflow>>;
|
|
2753
2799
|
getVoice({ runtimeContext }?: {
|
|
2754
2800
|
runtimeContext?: RuntimeContext;
|
|
2755
2801
|
}): Promise<CompositeVoice | DefaultVoice>;
|
|
@@ -2912,7 +2958,7 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
|
|
|
2912
2958
|
getSpeakers(): Promise<{
|
|
2913
2959
|
voiceId: string;
|
|
2914
2960
|
}[]>;
|
|
2915
|
-
toStep():
|
|
2961
|
+
toStep(): LegacyStep<TAgentId, z.ZodObject<{
|
|
2916
2962
|
prompt: z.ZodString;
|
|
2917
2963
|
}>, z.ZodObject<{
|
|
2918
2964
|
text: z.ZodString;
|
|
@@ -2928,26 +2974,26 @@ interface StorageColumn {
|
|
|
2928
2974
|
column: string;
|
|
2929
2975
|
};
|
|
2930
2976
|
}
|
|
2931
|
-
interface
|
|
2932
|
-
runs:
|
|
2977
|
+
interface LegacyWorkflowRuns {
|
|
2978
|
+
runs: LegacyWorkflowRun[];
|
|
2933
2979
|
total: number;
|
|
2934
2980
|
}
|
|
2935
|
-
interface
|
|
2981
|
+
interface LegacyWorkflowRun {
|
|
2936
2982
|
workflowName: string;
|
|
2937
2983
|
runId: string;
|
|
2938
|
-
snapshot:
|
|
2984
|
+
snapshot: LegacyWorkflowRunState | string;
|
|
2939
2985
|
createdAt: Date;
|
|
2940
2986
|
updatedAt: Date;
|
|
2941
2987
|
resourceId?: string;
|
|
2942
2988
|
}
|
|
2943
|
-
interface
|
|
2944
|
-
runs:
|
|
2989
|
+
interface WorkflowRuns {
|
|
2990
|
+
runs: WorkflowRun[];
|
|
2945
2991
|
total: number;
|
|
2946
2992
|
}
|
|
2947
|
-
interface
|
|
2993
|
+
interface WorkflowRun {
|
|
2948
2994
|
workflowName: string;
|
|
2949
2995
|
runId: string;
|
|
2950
|
-
snapshot:
|
|
2996
|
+
snapshot: WorkflowRunState | string;
|
|
2951
2997
|
createdAt: Date;
|
|
2952
2998
|
updatedAt: Date;
|
|
2953
2999
|
resourceId?: string;
|
|
@@ -3023,12 +3069,8 @@ type MemoryConfig = {
|
|
|
3023
3069
|
workingMemory?: {
|
|
3024
3070
|
enabled: boolean;
|
|
3025
3071
|
template?: string;
|
|
3026
|
-
use
|
|
3027
|
-
|
|
3028
|
-
enabled: boolean;
|
|
3029
|
-
template?: string;
|
|
3030
|
-
/** @deprecated the 'text-stream' working memory option (which is the current default) will be full removed in favor of the 'tool-call' option in a future breaking change. */
|
|
3031
|
-
use?: 'text-stream';
|
|
3072
|
+
/** @deprecated The `use` option has been removed. Working memory always uses tool-call mode. */
|
|
3073
|
+
use?: never;
|
|
3032
3074
|
};
|
|
3033
3075
|
threads?: {
|
|
3034
3076
|
generateTitle?: boolean;
|
|
@@ -3136,4 +3178,4 @@ declare abstract class MastraStorage extends MastraBase {
|
|
|
3136
3178
|
}): Promise<WorkflowRun | null>;
|
|
3137
3179
|
}
|
|
3138
3180
|
|
|
3139
|
-
export { type
|
|
3181
|
+
export { type WorkflowActions as $, type ApiRoute as A, type StepGraph as B, type ContextWithMastra as C, type BaseCondition as D, type EvalRow as E, type ActionContext as F, WhenConditionReturnValue as G, type StepDef as H, type StepCondition as I, type StepConfig as J, type StepsRecord$1 as K, type LegacyWorkflowRuns as L, type Methods as M, type WorkflowLogMessage as N, type WorkflowEvent as O, type ResolverFunctionInput as P, type ResolverFunctionOutput as Q, type RetryConfig as R, type StorageColumn as S, type TABLE_NAMES as T, type SubscriberFunctionOutput as U, type VariableReference$1 as V, type WorkflowRuns as W, type DependencyCheckOutput as X, type StepResolverOutput as Y, type WorkflowActors as Z, type WorkflowActionParams as _, Mastra as a, ExecutionEngine as a$, type LegacyWorkflowState as a0, type StepId as a1, type ExtractSchemaFromStep$1 as a2, type ExtractStepResult as a3, type StepInputType as a4, type ExtractSchemaType$1 as a5, type PathsToStringProps$1 as a6, type LegacyWorkflowRunState as a7, type WorkflowResumeResult as a8, type ToolAction as a9, type LLMTextOptions as aA, type LLMTextObjectOptions as aB, type LLMStreamOptions as aC, type LLMInnerStreamOptions as aD, type LLMStreamObjectOptions as aE, createMockModel as aF, type Config as aG, type MessageResponse as aH, type MemoryConfig as aI, type SharedMemoryConfig as aJ, type MemoryProcessorOpts as aK, MemoryProcessor as aL, memoryDefaultOptions as aM, createTool as aN, type VercelTool as aO, type CoreTool as aP, type InternalCoreTool as aQ, type StepFlowEntry as aR, type SerializedStep as aS, type SerializedStepFlowEntry as aT, createStep as aU, cloneStep as aV, createWorkflow as aW, cloneWorkflow as aX, type WorkflowResult as aY, Run as aZ, type ExecutionGraph as a_, type AgentConfig as aa, MastraMemory as ab, type ToolExecutionContext as ac, Tool as ad, type Step as ae, Workflow as af, type WorkflowConfig as ag, type LanguageModel as ah, type CoreMessage as ai, type CoreSystemMessage as aj, type CoreAssistantMessage as ak, type CoreUserMessage as al, type CoreToolMessage as am, type EmbedResult as an, type EmbedManyResult as ao, type BaseStructuredOutputType as ap, type StructuredOutputType as aq, type StructuredOutputArrayItem as ar, type StructuredOutput as as, type GenerateReturn as at, type StreamReturn as au, type OutputType as av, type DefaultLLMTextOptions as aw, type DefaultLLMTextObjectOptions as ax, type DefaultLLMStreamOptions as ay, type DefaultLLMStreamObjectOptions as az, type MastraAuthConfig as b, type ExecuteFunction as b0, type StepSuccess as b1, type StepFailure as b2, type StepSuspended as b3, type StepResult as b4, type StepsRecord as b5, type DynamicMapping as b6, type PathsToStringProps as b7, type ExtractSchemaType as b8, type ExtractSchemaFromStep as b9, type EnvironmentVariableInfo as bA, type PackageInfo as bB, type RemoteInfo as bC, type MCPServerConfig as bD, type ServerInfo as bE, type ServerDetailInfo as bF, type ToolsetsInput as bG, type DynamicArgument as bH, type AgentGenerateOptions as bI, type AgentStreamOptions as bJ, type VariableReference as ba, type WatchEvent as bb, type ZodPathType as bc, type WorkflowRunState as bd, type MastraLanguageModel as be, type MastraPrimitives as bf, AgentNetwork as bg, MCPServerBase as bh, type VoiceEventType as bi, type VoiceEventMap as bj, type VoiceConfig as bk, MastraVoice as bl, CompositeVoice as bm, DefaultVoice as bn, type AgentNetworkConfig as bo, type ConvertedTool as bp, type MCPServerSSEOptions as bq, type MCPServerHonoSSEOptions as br, type MCPServerHTTPOptions as bs, type Repository as bt, type VersionDetail as bu, type ArgumentInfo as bv, type PositionalArgumentInfo as bw, type NamedArgumentInfo as bx, type SubcommandInfo as by, type CommandInfo as bz, MastraStorage as c, type StorageThreadType as d, type MessageType as e, type StorageGetMessagesArg as f, type WorkflowRun as g, type LegacyWorkflowRun as h, TABLE_WORKFLOW_SNAPSHOT as i, TABLE_EVALS as j, TABLE_MESSAGES as k, TABLE_THREADS as l, TABLE_TRACES as m, TABLE_SCHEMAS as n, type StepResult$1 as o, LegacyStep as p, LegacyWorkflow as q, Agent as r, type WorkflowContext as s, type ToolsInput as t, type StepAction as u, type LegacyWorkflowRunResult as v, type WorkflowOptions as w, type StepExecutionContext as x, type StepVariableType as y, type StepNode as z };
|