@mastra/core 0.9.0 → 0.9.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.d.cts +2 -1
- package/dist/agent/index.d.ts +2 -1
- package/dist/agent/index.js +1 -1
- package/dist/{base-Bk5V1doj.d.ts → base-5aS_vKtG.d.ts} +436 -10
- package/dist/{base-oP3DoUrm.d.cts → base-CDhO2lMb.d.cts} +436 -10
- package/dist/{chunk-ATXF6TIO.cjs → chunk-5RNAWF6S.cjs} +2 -4
- package/dist/{chunk-RASVJ3TR.js → chunk-6UQK6P76.js} +31 -0
- package/dist/{chunk-W5IA5OGL.cjs → chunk-HZZCDTUN.cjs} +31 -0
- package/dist/{chunk-DIZZQ3E5.cjs → chunk-MYAFJQRT.cjs} +2 -2
- package/dist/{chunk-HARYMLZH.js → chunk-XQMX3MB3.js} +3 -4
- package/dist/{chunk-GJWCFDFN.js → chunk-Y6LKS4NI.js} +1 -1
- package/dist/eval/index.d.cts +2 -1
- package/dist/eval/index.d.ts +2 -1
- package/dist/index.cjs +29 -33
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -4
- package/dist/integration/index.d.cts +2 -1
- package/dist/integration/index.d.ts +2 -1
- package/dist/llm/index.d.cts +2 -1
- package/dist/llm/index.d.ts +2 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.cts +2 -1
- package/dist/mastra/index.d.ts +2 -1
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.d.cts +2 -1
- package/dist/memory/index.d.ts +2 -1
- package/dist/network/index.cjs +2 -2
- package/dist/network/index.d.cts +2 -1
- package/dist/network/index.d.ts +2 -1
- package/dist/network/index.js +1 -1
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.d.cts +2 -1
- package/dist/relevance/index.d.ts +2 -1
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.d.cts +2 -1
- package/dist/server/index.d.ts +2 -1
- package/dist/storage/index.d.cts +2 -1
- package/dist/storage/index.d.ts +2 -1
- package/dist/storage/libsql/index.d.cts +2 -1
- package/dist/storage/libsql/index.d.ts +2 -1
- package/dist/telemetry/index.d.cts +2 -1
- package/dist/telemetry/index.d.ts +2 -1
- package/dist/tools/index.d.cts +2 -1
- package/dist/tools/index.d.ts +2 -1
- package/dist/utils.d.cts +4 -3
- package/dist/utils.d.ts +4 -3
- package/dist/voice/index.d.cts +3 -2
- package/dist/voice/index.d.ts +3 -2
- package/dist/workflows/index.cjs +22 -26
- package/dist/workflows/index.d.cts +3 -2
- package/dist/workflows/index.d.ts +3 -2
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/vNext/index.cjs +975 -0
- package/dist/workflows/vNext/index.d.cts +179 -0
- package/dist/workflows/vNext/index.d.ts +179 -0
- package/dist/workflows/vNext/index.js +963 -0
- package/package.json +11 -1
- package/workflows/vNext.d.ts +1 -0
package/dist/agent/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5RNAWF6S_cjs = require('../chunk-5RNAWF6S.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "Agent", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk5RNAWF6S_cjs.Agent; }
|
|
10
10
|
});
|
package/dist/agent/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Message as AiMessageType } from 'ai';
|
|
2
2
|
import 'json-schema';
|
|
3
3
|
import 'zod';
|
|
4
|
-
export {
|
|
4
|
+
export { F as Agent, G as AgentConfig, b6 as AgentGenerateOptions, b7 as AgentStreamOptions, b0 as MastraLanguageModel, b1 as ToolsInput, b5 as ToolsetsInput } from '../base-CDhO2lMb.cjs';
|
|
5
5
|
import '../base-BihKcqDY.cjs';
|
|
6
6
|
import '../di/index.cjs';
|
|
7
7
|
import '../types-BtMyV38I.cjs';
|
|
@@ -16,6 +16,7 @@ import '../vector/index.cjs';
|
|
|
16
16
|
import '../vector/filter/index.cjs';
|
|
17
17
|
import '@opentelemetry/sdk-trace-base';
|
|
18
18
|
import '../tts/index.cjs';
|
|
19
|
+
import 'events';
|
|
19
20
|
import '../deployer/index.cjs';
|
|
20
21
|
import '../bundler/index.cjs';
|
|
21
22
|
import 'hono';
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Message as AiMessageType } from 'ai';
|
|
2
2
|
import 'json-schema';
|
|
3
3
|
import 'zod';
|
|
4
|
-
export {
|
|
4
|
+
export { F as Agent, G as AgentConfig, b6 as AgentGenerateOptions, b7 as AgentStreamOptions, b0 as MastraLanguageModel, b1 as ToolsInput, b5 as ToolsetsInput } from '../base-5aS_vKtG.js';
|
|
5
5
|
import '../base-DT2poiVK.js';
|
|
6
6
|
import '../di/index.js';
|
|
7
7
|
import '../types-BtMyV38I.js';
|
|
@@ -16,6 +16,7 @@ import '../vector/index.js';
|
|
|
16
16
|
import '../vector/filter/index.js';
|
|
17
17
|
import '@opentelemetry/sdk-trace-base';
|
|
18
18
|
import '../tts/index.js';
|
|
19
|
+
import 'events';
|
|
19
20
|
import '../deployer/index.js';
|
|
20
21
|
import '../bundler/index.js';
|
|
21
22
|
import 'hono';
|
package/dist/agent/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Agent } from '../chunk-
|
|
1
|
+
export { Agent } from '../chunk-XQMX3MB3.js';
|
|
@@ -6,13 +6,14 @@ import { Query } from 'sift';
|
|
|
6
6
|
import { z, ZodSchema } from 'zod';
|
|
7
7
|
import { JSONSchema7 } from 'json-schema';
|
|
8
8
|
import { RuntimeContext } from './di/index.js';
|
|
9
|
-
import { B as BaseLogMessage, R as RegisteredLogger, L as Logger, d as Run } from './index-CquI0inB.js';
|
|
9
|
+
import { B as BaseLogMessage, R as RegisteredLogger, L as Logger, d as Run$1 } from './index-CquI0inB.js';
|
|
10
10
|
import { Span } from '@opentelemetry/api';
|
|
11
11
|
import * as xstate from 'xstate';
|
|
12
12
|
import { Snapshot } from 'xstate';
|
|
13
|
-
import EventEmitter from 'node:events';
|
|
13
|
+
import EventEmitter$1 from 'node:events';
|
|
14
14
|
import { MastraVector } from './vector/index.js';
|
|
15
15
|
import { MastraTTS } from './tts/index.js';
|
|
16
|
+
import EventEmitter from 'events';
|
|
16
17
|
import { MastraDeployer } from './deployer/index.js';
|
|
17
18
|
import { Handler, MiddlewareHandler } from 'hono';
|
|
18
19
|
import { cors } from 'hono/cors';
|
|
@@ -51,7 +52,13 @@ declare class Tool<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchem
|
|
|
51
52
|
mastra?: Mastra;
|
|
52
53
|
constructor(opts: ToolAction<TSchemaIn, TSchemaOut, TContext>);
|
|
53
54
|
}
|
|
54
|
-
declare function createTool<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends ToolExecutionContext<TSchemaIn> = ToolExecutionContext<TSchemaIn
|
|
55
|
+
declare function createTool<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends ToolExecutionContext<TSchemaIn> = ToolExecutionContext<TSchemaIn>, TExecute extends ToolAction<TSchemaIn, TSchemaOut, TContext>['execute'] = ToolAction<TSchemaIn, TSchemaOut, TContext>['execute']>(opts: ToolAction<TSchemaIn, TSchemaOut, TContext> & {
|
|
56
|
+
execute?: TExecute;
|
|
57
|
+
}): [TSchemaIn, TSchemaOut, TExecute] extends [z.ZodSchema, z.ZodSchema, Function] ? Tool<TSchemaIn, TSchemaOut, TContext> & {
|
|
58
|
+
inputSchema: TSchemaIn;
|
|
59
|
+
outputSchema: TSchemaOut;
|
|
60
|
+
execute: (context: TContext) => Promise<any>;
|
|
61
|
+
} : Tool<TSchemaIn, TSchemaOut, TContext>;
|
|
55
62
|
|
|
56
63
|
type AgentNetworkConfig = {
|
|
57
64
|
name: string;
|
|
@@ -169,6 +176,420 @@ declare class AgentNetwork extends MastraBase {
|
|
|
169
176
|
__registerMastra(p: Mastra): void;
|
|
170
177
|
}
|
|
171
178
|
|
|
179
|
+
type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema> = (params: {
|
|
180
|
+
mastra: Mastra;
|
|
181
|
+
container: RuntimeContext;
|
|
182
|
+
inputData: TStepInput;
|
|
183
|
+
resumeData?: TResumeSchema;
|
|
184
|
+
getInitData<T extends NewWorkflow<any, any, any, any, any>>(): T extends undefined ? unknown : z.infer<NonNullable<T['inputSchema']>>;
|
|
185
|
+
getStepResult<T extends NewStep<any, any, any>>(stepId: T): T['outputSchema'] extends undefined ? unknown : z.infer<NonNullable<T['outputSchema']>>;
|
|
186
|
+
suspend(suspendPayload: TSuspendSchema): Promise<void>;
|
|
187
|
+
resume?: {
|
|
188
|
+
steps: string[];
|
|
189
|
+
resumePayload: any;
|
|
190
|
+
};
|
|
191
|
+
emitter: EventEmitter;
|
|
192
|
+
}) => Promise<TStepOutput>;
|
|
193
|
+
interface NewStep<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>> {
|
|
194
|
+
id: TStepId;
|
|
195
|
+
description?: string;
|
|
196
|
+
inputSchema: TSchemaIn;
|
|
197
|
+
outputSchema: TSchemaOut;
|
|
198
|
+
resumeSchema?: TResumeSchema;
|
|
199
|
+
suspendSchema?: TSuspendSchema;
|
|
200
|
+
execute: ExecuteFunction<z.infer<TSchemaIn>, z.infer<TSchemaOut>, z.infer<TResumeSchema>, z.infer<TSuspendSchema>>;
|
|
201
|
+
retries?: number;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
type StepSuccess$1<T> = {
|
|
205
|
+
status: 'success';
|
|
206
|
+
output: T;
|
|
207
|
+
};
|
|
208
|
+
type StepFailure$1 = {
|
|
209
|
+
status: 'failed';
|
|
210
|
+
error: string;
|
|
211
|
+
};
|
|
212
|
+
type StepSuspended$1<T> = {
|
|
213
|
+
status: 'suspended';
|
|
214
|
+
payload: T;
|
|
215
|
+
};
|
|
216
|
+
type StepResult$1<T> = StepSuccess$1<T> | StepFailure$1 | StepSuspended$1<T>;
|
|
217
|
+
type StepsRecord$1<T extends readonly NewStep<any, any, any>[]> = {
|
|
218
|
+
[K in T[number]['id']]: Extract<T[number], {
|
|
219
|
+
id: K;
|
|
220
|
+
}>;
|
|
221
|
+
};
|
|
222
|
+
type PathsToStringProps$1<T> = T extends object ? {
|
|
223
|
+
[K in keyof T]: T[K] extends object ? K extends string ? K | `${K}.${PathsToStringProps$1<T[K]>}` : never : K extends string ? K : never;
|
|
224
|
+
}[keyof T] : never;
|
|
225
|
+
type ExtractSchemaType$1<T extends z.ZodType<any>> = T extends z.ZodObject<infer V> ? V : never;
|
|
226
|
+
type ExtractSchemaFromStep$1<TStep extends NewStep<any, any, any>, TKey extends 'inputSchema' | 'outputSchema'> = TStep[TKey];
|
|
227
|
+
type VariableReference$1<TStep extends NewStep<string, any, any> = NewStep<string, any, any>, TVarPath extends PathsToStringProps$1<ExtractSchemaType$1<ExtractSchemaFromStep$1<TStep, 'outputSchema'>>> | '' | '.' = PathsToStringProps$1<ExtractSchemaType$1<ExtractSchemaFromStep$1<TStep, 'outputSchema'>>> | '' | '.'> = {
|
|
228
|
+
step: TStep;
|
|
229
|
+
path: TVarPath;
|
|
230
|
+
} | {
|
|
231
|
+
value: any;
|
|
232
|
+
schema: z.ZodTypeAny;
|
|
233
|
+
};
|
|
234
|
+
type WatchEvent = {
|
|
235
|
+
type: 'watch';
|
|
236
|
+
payload: {
|
|
237
|
+
currentStep: {
|
|
238
|
+
id: string;
|
|
239
|
+
status: 'running' | 'completed' | 'failed' | 'suspended';
|
|
240
|
+
output?: Record<string, any>;
|
|
241
|
+
payload?: Record<string, any>;
|
|
242
|
+
};
|
|
243
|
+
workflowState: {
|
|
244
|
+
status: 'running' | 'completed' | 'failed' | 'suspended';
|
|
245
|
+
steps: Record<string, {
|
|
246
|
+
status: 'running' | 'completed' | 'failed' | 'suspended';
|
|
247
|
+
output?: Record<string, any>;
|
|
248
|
+
payload?: Record<string, any>;
|
|
249
|
+
}>;
|
|
250
|
+
output?: Record<string, any>;
|
|
251
|
+
payload?: Record<string, any>;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
eventTimestamp: Date;
|
|
255
|
+
};
|
|
256
|
+
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;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Represents an execution graph for a workflow
|
|
260
|
+
*/
|
|
261
|
+
interface ExecutionGraph {
|
|
262
|
+
id: string;
|
|
263
|
+
steps: StepFlowEntry[];
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Execution engine abstract class for building and executing workflow graphs
|
|
267
|
+
* Providers will implement this class to provide their own execution logic
|
|
268
|
+
*/
|
|
269
|
+
declare abstract class ExecutionEngine extends MastraBase {
|
|
270
|
+
protected mastra?: Mastra;
|
|
271
|
+
constructor({ mastra }: {
|
|
272
|
+
mastra?: Mastra;
|
|
273
|
+
});
|
|
274
|
+
__registerMastra(mastra: Mastra): void;
|
|
275
|
+
/**
|
|
276
|
+
* Executes a workflow run with the provided execution graph and input
|
|
277
|
+
* @param graph The execution graph to execute
|
|
278
|
+
* @param input The input data for the workflow
|
|
279
|
+
* @returns A promise that resolves to the workflow output
|
|
280
|
+
*/
|
|
281
|
+
abstract execute<TInput, TOutput>(params: {
|
|
282
|
+
workflowId: string;
|
|
283
|
+
runId: string;
|
|
284
|
+
graph: ExecutionGraph;
|
|
285
|
+
input?: TInput;
|
|
286
|
+
resume?: {
|
|
287
|
+
steps: string[];
|
|
288
|
+
stepResults: Record<string, StepResult$1<any>>;
|
|
289
|
+
resumePayload: any;
|
|
290
|
+
resumePath: number[];
|
|
291
|
+
};
|
|
292
|
+
emitter: EventEmitter;
|
|
293
|
+
container: RuntimeContext;
|
|
294
|
+
retryConfig?: {
|
|
295
|
+
attempts?: number;
|
|
296
|
+
delay?: number;
|
|
297
|
+
};
|
|
298
|
+
}): Promise<TOutput>;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
type StepFlowEntry = {
|
|
302
|
+
type: 'step';
|
|
303
|
+
step: NewStep;
|
|
304
|
+
} | {
|
|
305
|
+
type: 'parallel';
|
|
306
|
+
steps: StepFlowEntry[];
|
|
307
|
+
} | {
|
|
308
|
+
type: 'conditional';
|
|
309
|
+
steps: StepFlowEntry[];
|
|
310
|
+
conditions: ExecuteFunction<any, any, any, any>[];
|
|
311
|
+
} | {
|
|
312
|
+
type: 'loop';
|
|
313
|
+
step: NewStep;
|
|
314
|
+
condition: ExecuteFunction<any, any, any, any>;
|
|
315
|
+
loopType: 'dowhile' | 'dountil';
|
|
316
|
+
} | {
|
|
317
|
+
type: 'foreach';
|
|
318
|
+
step: NewStep;
|
|
319
|
+
opts: {
|
|
320
|
+
concurrency: number;
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* Creates a new workflow step
|
|
325
|
+
* @param params Configuration parameters for the step
|
|
326
|
+
* @param params.id Unique identifier for the step
|
|
327
|
+
* @param params.description Optional description of what the step does
|
|
328
|
+
* @param params.inputSchema Zod schema defining the input structure
|
|
329
|
+
* @param params.outputSchema Zod schema defining the output structure
|
|
330
|
+
* @param params.execute Function that performs the step's operations
|
|
331
|
+
* @returns A Step object that can be added to the workflow
|
|
332
|
+
*/
|
|
333
|
+
declare function createStep<TStepId extends string, TStepInput extends z.ZodType<any>, TStepOutput extends z.ZodType<any>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(params: {
|
|
334
|
+
id: TStepId;
|
|
335
|
+
description?: string;
|
|
336
|
+
inputSchema: TStepInput;
|
|
337
|
+
outputSchema: TStepOutput;
|
|
338
|
+
resumeSchema?: TResumeSchema;
|
|
339
|
+
suspendSchema?: TSuspendSchema;
|
|
340
|
+
execute: ExecuteFunction<z.infer<TStepInput>, z.infer<TStepOutput>, z.infer<TResumeSchema>, z.infer<TSuspendSchema>>;
|
|
341
|
+
}): NewStep<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema>;
|
|
342
|
+
declare function createStep<TStepId extends string, TStepInput extends z.ZodObject<{
|
|
343
|
+
prompt: z.ZodString;
|
|
344
|
+
}>, TStepOutput extends z.ZodObject<{
|
|
345
|
+
text: z.ZodString;
|
|
346
|
+
}>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(agent: Agent<TStepId, any, any>): NewStep<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema>;
|
|
347
|
+
declare function createStep<TSchemaIn extends z.ZodType<any>, TSchemaOut extends z.ZodType<any>, TContext extends ToolExecutionContext<TSchemaIn>>(tool: Tool<TSchemaIn, TSchemaOut, TContext> & {
|
|
348
|
+
inputSchema: TSchemaIn;
|
|
349
|
+
outputSchema: TSchemaOut;
|
|
350
|
+
execute: (context: TContext) => Promise<any>;
|
|
351
|
+
}): NewStep<string, TSchemaIn, TSchemaOut, z.ZodType<any>, z.ZodType<any>>;
|
|
352
|
+
declare function cloneStep<TStepId extends string>(step: NewStep<TStepId, any, any>, opts: {
|
|
353
|
+
id: TStepId;
|
|
354
|
+
}): NewStep<string, any, any>;
|
|
355
|
+
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 NewStep<string, any, any>[] = NewStep<string, any, any>[]>(params: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): NewWorkflow<TSteps, TWorkflowId, TInput, TOutput, TInput>;
|
|
356
|
+
type WorkflowStatus<TOutput extends z.ZodType<any>, TSteps extends NewStep<string, any, any>[]> = {
|
|
357
|
+
status: 'success';
|
|
358
|
+
result: z.infer<TOutput>;
|
|
359
|
+
steps: {
|
|
360
|
+
[K in keyof StepsRecord$1<TSteps>]: StepsRecord$1<TSteps>[K]['outputSchema'] extends undefined ? StepResult$1<unknown> : StepResult$1<z.infer<NonNullable<StepsRecord$1<TSteps>[K]['outputSchema']>>>;
|
|
361
|
+
};
|
|
362
|
+
} | {
|
|
363
|
+
status: 'failed';
|
|
364
|
+
steps: {
|
|
365
|
+
[K in keyof StepsRecord$1<TSteps>]: StepsRecord$1<TSteps>[K]['outputSchema'] extends undefined ? StepResult$1<unknown> : StepResult$1<z.infer<NonNullable<StepsRecord$1<TSteps>[K]['outputSchema']>>>;
|
|
366
|
+
};
|
|
367
|
+
error: string;
|
|
368
|
+
} | {
|
|
369
|
+
status: 'suspended';
|
|
370
|
+
steps: {
|
|
371
|
+
[K in keyof StepsRecord$1<TSteps>]: StepsRecord$1<TSteps>[K]['outputSchema'] extends undefined ? StepResult$1<unknown> : StepResult$1<z.infer<NonNullable<StepsRecord$1<TSteps>[K]['outputSchema']>>>;
|
|
372
|
+
};
|
|
373
|
+
suspended: [string[], ...string[][]];
|
|
374
|
+
};
|
|
375
|
+
type NewWorkflowConfig<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends NewStep<string, any, any>[] = NewStep<string, any, any>[]> = {
|
|
376
|
+
mastra?: Mastra;
|
|
377
|
+
id: TWorkflowId;
|
|
378
|
+
description?: string | undefined;
|
|
379
|
+
inputSchema: TInput;
|
|
380
|
+
outputSchema: TOutput;
|
|
381
|
+
executionEngine?: ExecutionEngine;
|
|
382
|
+
steps?: TSteps;
|
|
383
|
+
retryConfig?: {
|
|
384
|
+
attempts?: number;
|
|
385
|
+
delay?: number;
|
|
386
|
+
};
|
|
387
|
+
};
|
|
388
|
+
declare class NewWorkflow<TSteps extends NewStep<string, any, any>[] = NewStep<string, 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 NewStep<TWorkflowId, TInput, TOutput> {
|
|
389
|
+
#private;
|
|
390
|
+
id: TWorkflowId;
|
|
391
|
+
description?: string | undefined;
|
|
392
|
+
inputSchema: TInput;
|
|
393
|
+
outputSchema: TOutput;
|
|
394
|
+
protected stepFlow: StepFlowEntry[];
|
|
395
|
+
protected executionEngine: ExecutionEngine;
|
|
396
|
+
protected executionGraph: ExecutionGraph;
|
|
397
|
+
protected retryConfig: {
|
|
398
|
+
attempts?: number;
|
|
399
|
+
delay?: number;
|
|
400
|
+
};
|
|
401
|
+
constructor({ mastra, id, inputSchema, outputSchema, description, executionEngine, retryConfig, }: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>);
|
|
402
|
+
__registerMastra(mastra: Mastra): void;
|
|
403
|
+
__registerPrimitives(p: MastraPrimitives): void;
|
|
404
|
+
/**
|
|
405
|
+
* Adds a step to the workflow
|
|
406
|
+
* @param step The step to add to the workflow
|
|
407
|
+
* @returns The workflow instance for chaining
|
|
408
|
+
*/
|
|
409
|
+
then<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: NewStep<TStepId, TStepInputSchema, TSchemaOut, any, any>): NewWorkflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
410
|
+
map<TSteps extends NewStep<string, any, any>[], TMapping extends {
|
|
411
|
+
[K in keyof TMapping]: {
|
|
412
|
+
step: TSteps[number];
|
|
413
|
+
path: PathsToStringProps$1<ExtractSchemaType$1<ExtractSchemaFromStep$1<TSteps[number], 'outputSchema'>>> | '.';
|
|
414
|
+
} | {
|
|
415
|
+
value: any;
|
|
416
|
+
schema: z.ZodTypeAny;
|
|
417
|
+
} | {
|
|
418
|
+
initData: TSteps[number];
|
|
419
|
+
path: PathsToStringProps$1<ExtractSchemaType$1<ExtractSchemaFromStep$1<TSteps[number], 'inputSchema'>>> | '.';
|
|
420
|
+
} | {
|
|
421
|
+
containerPath: string;
|
|
422
|
+
schema: z.ZodTypeAny;
|
|
423
|
+
};
|
|
424
|
+
}>(mappingConfig: TMapping): NewWorkflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodObject<{ [K in keyof TMapping]: TMapping[K] extends {
|
|
425
|
+
step: TSteps[number];
|
|
426
|
+
path: PathsToStringProps$1<ExtractSchemaType$1<ExtractSchemaFromStep$1<TSteps[number], "outputSchema">>>;
|
|
427
|
+
} ? TMapping[K]["path"] extends "." ? TMapping[K]["step"]["outputSchema"] : ZodPathType<TMapping[K]["step"]["outputSchema"], TMapping[K]["path"]> : TMapping[K] extends {
|
|
428
|
+
initData: TSteps[number];
|
|
429
|
+
path: PathsToStringProps$1<ExtractSchemaType$1<ExtractSchemaFromStep$1<TSteps[number], "inputSchema">>>;
|
|
430
|
+
} ? TMapping[K]["path"] extends "." ? TMapping[K]["initData"]["inputSchema"] : ZodPathType<TMapping[K]["initData"]["inputSchema"], TMapping[K]["path"]> : TMapping[K] extends {
|
|
431
|
+
value: any;
|
|
432
|
+
schema: z.ZodTypeAny;
|
|
433
|
+
} ? TMapping[K]["schema"] : TMapping[K] extends {
|
|
434
|
+
containerPath: string;
|
|
435
|
+
schema: z.ZodTypeAny;
|
|
436
|
+
} ? TMapping[K]["schema"] : never; }, any, z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{ [K in keyof TMapping]: TMapping[K] extends {
|
|
437
|
+
step: TSteps[number];
|
|
438
|
+
path: PathsToStringProps$1<ExtractSchemaType$1<ExtractSchemaFromStep$1<TSteps[number], "outputSchema">>>;
|
|
439
|
+
} ? TMapping[K]["path"] extends "." ? TMapping[K]["step"]["outputSchema"] : ZodPathType<TMapping[K]["step"]["outputSchema"], TMapping[K]["path"]> : TMapping[K] extends {
|
|
440
|
+
initData: TSteps[number];
|
|
441
|
+
path: PathsToStringProps$1<ExtractSchemaType$1<ExtractSchemaFromStep$1<TSteps[number], "inputSchema">>>;
|
|
442
|
+
} ? TMapping[K]["path"] extends "." ? TMapping[K]["initData"]["inputSchema"] : ZodPathType<TMapping[K]["initData"]["inputSchema"], TMapping[K]["path"]> : TMapping[K] extends {
|
|
443
|
+
value: any;
|
|
444
|
+
schema: z.ZodTypeAny;
|
|
445
|
+
} ? TMapping[K]["schema"] : TMapping[K] extends {
|
|
446
|
+
containerPath: string;
|
|
447
|
+
schema: z.ZodTypeAny;
|
|
448
|
+
} ? TMapping[K]["schema"] : never; }>, any> extends infer T ? { [k in keyof T]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{ [K in keyof TMapping]: TMapping[K] extends {
|
|
449
|
+
step: TSteps[number];
|
|
450
|
+
path: PathsToStringProps$1<ExtractSchemaType$1<ExtractSchemaFromStep$1<TSteps[number], "outputSchema">>>;
|
|
451
|
+
} ? TMapping[K]["path"] extends "." ? TMapping[K]["step"]["outputSchema"] : ZodPathType<TMapping[K]["step"]["outputSchema"], TMapping[K]["path"]> : TMapping[K] extends {
|
|
452
|
+
initData: TSteps[number];
|
|
453
|
+
path: PathsToStringProps$1<ExtractSchemaType$1<ExtractSchemaFromStep$1<TSteps[number], "inputSchema">>>;
|
|
454
|
+
} ? TMapping[K]["path"] extends "." ? TMapping[K]["initData"]["inputSchema"] : ZodPathType<TMapping[K]["initData"]["inputSchema"], TMapping[K]["path"]> : TMapping[K] extends {
|
|
455
|
+
value: any;
|
|
456
|
+
schema: z.ZodTypeAny;
|
|
457
|
+
} ? TMapping[K]["schema"] : TMapping[K] extends {
|
|
458
|
+
containerPath: string;
|
|
459
|
+
schema: z.ZodTypeAny;
|
|
460
|
+
} ? TMapping[K]["schema"] : never; }>, any>[k]; } : never, z.baseObjectInputType<{ [K in keyof TMapping]: TMapping[K] extends {
|
|
461
|
+
step: TSteps[number];
|
|
462
|
+
path: PathsToStringProps$1<ExtractSchemaType$1<ExtractSchemaFromStep$1<TSteps[number], "outputSchema">>>;
|
|
463
|
+
} ? TMapping[K]["path"] extends "." ? TMapping[K]["step"]["outputSchema"] : ZodPathType<TMapping[K]["step"]["outputSchema"], TMapping[K]["path"]> : TMapping[K] extends {
|
|
464
|
+
initData: TSteps[number];
|
|
465
|
+
path: PathsToStringProps$1<ExtractSchemaType$1<ExtractSchemaFromStep$1<TSteps[number], "inputSchema">>>;
|
|
466
|
+
} ? TMapping[K]["path"] extends "." ? TMapping[K]["initData"]["inputSchema"] : ZodPathType<TMapping[K]["initData"]["inputSchema"], TMapping[K]["path"]> : TMapping[K] extends {
|
|
467
|
+
value: any;
|
|
468
|
+
schema: z.ZodTypeAny;
|
|
469
|
+
} ? TMapping[K]["schema"] : TMapping[K] extends {
|
|
470
|
+
containerPath: string;
|
|
471
|
+
schema: z.ZodTypeAny;
|
|
472
|
+
} ? TMapping[K]["schema"] : never; }> extends infer T_1 ? { [k_1 in keyof T_1]: z.baseObjectInputType<{ [K in keyof TMapping]: TMapping[K] extends {
|
|
473
|
+
step: TSteps[number];
|
|
474
|
+
path: PathsToStringProps$1<ExtractSchemaType$1<ExtractSchemaFromStep$1<TSteps[number], "outputSchema">>>;
|
|
475
|
+
} ? TMapping[K]["path"] extends "." ? TMapping[K]["step"]["outputSchema"] : ZodPathType<TMapping[K]["step"]["outputSchema"], TMapping[K]["path"]> : TMapping[K] extends {
|
|
476
|
+
initData: TSteps[number];
|
|
477
|
+
path: PathsToStringProps$1<ExtractSchemaType$1<ExtractSchemaFromStep$1<TSteps[number], "inputSchema">>>;
|
|
478
|
+
} ? TMapping[K]["path"] extends "." ? TMapping[K]["initData"]["inputSchema"] : ZodPathType<TMapping[K]["initData"]["inputSchema"], TMapping[K]["path"]> : TMapping[K] extends {
|
|
479
|
+
value: any;
|
|
480
|
+
schema: z.ZodTypeAny;
|
|
481
|
+
} ? TMapping[K]["schema"] : TMapping[K] extends {
|
|
482
|
+
containerPath: string;
|
|
483
|
+
schema: z.ZodTypeAny;
|
|
484
|
+
} ? TMapping[K]["schema"] : never; }>[k_1]; } : never>>;
|
|
485
|
+
parallel<TParallelSteps extends NewStep<string, TPrevSchema, any, any, any>[]>(steps: TParallelSteps): NewWorkflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodObject<{ [K in keyof StepsRecord$1<TParallelSteps>]: StepsRecord$1<TParallelSteps>[K]["outputSchema"]["path"]; }, any, z.ZodTypeAny>>;
|
|
486
|
+
branch<TBranchSteps extends Array<[
|
|
487
|
+
ExecuteFunction<z.infer<TPrevSchema>, any, any, any>,
|
|
488
|
+
NewStep<string, TPrevSchema, any, any, any>
|
|
489
|
+
]>>(steps: TBranchSteps): NewWorkflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodObject<{ [K in keyof StepsRecord$1<{ [K_1 in keyof TBranchSteps]: TBranchSteps[K_1][1]; }[number][]>]: StepsRecord$1<{ [K_1 in keyof TBranchSteps]: TBranchSteps[K_1][1]; }[number][]>[K]["outputSchema"]; }, any, z.ZodTypeAny>>;
|
|
490
|
+
dowhile<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: NewStep<TStepId, TStepInputSchema, TSchemaOut, any, any>, condition: ExecuteFunction<z.infer<TSchemaOut>, any, any, any>): NewWorkflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
491
|
+
dountil<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: NewStep<TStepId, TStepInputSchema, TSchemaOut, any, any>, condition: ExecuteFunction<z.infer<TSchemaOut>, any, any, any>): NewWorkflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
492
|
+
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 ? NewStep<TStepId, TStepInputSchema, TSchemaOut, any, any> : 'Previous step must return an array type', opts?: {
|
|
493
|
+
concurrency: number;
|
|
494
|
+
}): NewWorkflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodArray<TSchemaOut>>;
|
|
495
|
+
/**
|
|
496
|
+
* Builds the execution graph for this workflow
|
|
497
|
+
* @returns The execution graph that can be used to execute the workflow
|
|
498
|
+
*/
|
|
499
|
+
buildExecutionGraph(): ExecutionGraph;
|
|
500
|
+
/**
|
|
501
|
+
* Finalizes the workflow definition and prepares it for execution
|
|
502
|
+
* This method should be called after all steps have been added to the workflow
|
|
503
|
+
* @returns A built workflow instance ready for execution
|
|
504
|
+
*/
|
|
505
|
+
commit(): NewWorkflow<TSteps, TWorkflowId, TInput, TOutput, TOutput>;
|
|
506
|
+
/**
|
|
507
|
+
* Creates a new workflow run instance
|
|
508
|
+
* @param options Optional configuration for the run
|
|
509
|
+
* @returns A Run instance that can be used to execute the workflow
|
|
510
|
+
*/
|
|
511
|
+
createRun(options?: {
|
|
512
|
+
runId?: string;
|
|
513
|
+
}): Run<TSteps, TInput, TOutput>;
|
|
514
|
+
execute({ inputData, resumeData, suspend, resume, emitter, mastra, }: {
|
|
515
|
+
inputData: z.infer<TInput>;
|
|
516
|
+
resumeData?: any;
|
|
517
|
+
getStepResult<T extends NewStep<any, any, any>>(stepId: T): T['outputSchema'] extends undefined ? unknown : z.infer<NonNullable<T['outputSchema']>>;
|
|
518
|
+
suspend: (suspendPayload: any) => Promise<void>;
|
|
519
|
+
resume?: {
|
|
520
|
+
steps: string[];
|
|
521
|
+
resumePayload: any;
|
|
522
|
+
runId?: string;
|
|
523
|
+
};
|
|
524
|
+
emitter: EventEmitter;
|
|
525
|
+
mastra: Mastra;
|
|
526
|
+
}): Promise<z.infer<TOutput>>;
|
|
527
|
+
getWorkflowRuns(): Promise<WorkflowRuns>;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Represents a workflow run that can be executed
|
|
531
|
+
*/
|
|
532
|
+
declare class Run<TSteps extends NewStep<string, any, any>[] = NewStep<string, any, any>[], TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>> {
|
|
533
|
+
#private;
|
|
534
|
+
protected emitter: EventEmitter;
|
|
535
|
+
/**
|
|
536
|
+
* Unique identifier for this workflow
|
|
537
|
+
*/
|
|
538
|
+
readonly workflowId: string;
|
|
539
|
+
/**
|
|
540
|
+
* Unique identifier for this run
|
|
541
|
+
*/
|
|
542
|
+
readonly runId: string;
|
|
543
|
+
/**
|
|
544
|
+
* Internal state of the workflow run
|
|
545
|
+
*/
|
|
546
|
+
protected state: Record<string, any>;
|
|
547
|
+
/**
|
|
548
|
+
* The execution engine for this run
|
|
549
|
+
*/
|
|
550
|
+
executionEngine: ExecutionEngine;
|
|
551
|
+
/**
|
|
552
|
+
* The execution graph for this run
|
|
553
|
+
*/
|
|
554
|
+
executionGraph: ExecutionGraph;
|
|
555
|
+
protected retryConfig?: {
|
|
556
|
+
attempts?: number;
|
|
557
|
+
delay?: number;
|
|
558
|
+
};
|
|
559
|
+
constructor(params: {
|
|
560
|
+
workflowId: string;
|
|
561
|
+
runId: string;
|
|
562
|
+
executionEngine: ExecutionEngine;
|
|
563
|
+
executionGraph: ExecutionGraph;
|
|
564
|
+
mastra?: Mastra;
|
|
565
|
+
retryConfig?: {
|
|
566
|
+
attempts?: number;
|
|
567
|
+
delay?: number;
|
|
568
|
+
};
|
|
569
|
+
});
|
|
570
|
+
/**
|
|
571
|
+
* Starts the workflow execution with the provided input
|
|
572
|
+
* @param input The input data for the workflow
|
|
573
|
+
* @returns A promise that resolves to the workflow output
|
|
574
|
+
*/
|
|
575
|
+
start({ inputData, container, }: {
|
|
576
|
+
inputData?: z.infer<TInput>;
|
|
577
|
+
container?: RuntimeContext;
|
|
578
|
+
}): Promise<WorkflowStatus<TOutput, TSteps>>;
|
|
579
|
+
watch(cb: (event: WatchEvent) => void): () => void;
|
|
580
|
+
resume<TResumeSchema extends z.ZodType<any>>(params: {
|
|
581
|
+
resumeData?: z.infer<TResumeSchema>;
|
|
582
|
+
step: NewStep<string, any, any, TResumeSchema, any> | [...NewStep<string, any, any, any, any>[], NewStep<string, any, any, TResumeSchema, any>] | string | string[];
|
|
583
|
+
container?: RuntimeContext;
|
|
584
|
+
}): Promise<WorkflowStatus<TOutput, TSteps>>;
|
|
585
|
+
/**
|
|
586
|
+
* Returns the current state of the workflow run
|
|
587
|
+
* @returns The current state of the workflow run
|
|
588
|
+
*/
|
|
589
|
+
getState(): Record<string, any>;
|
|
590
|
+
updateState(state: Record<string, any>): void;
|
|
591
|
+
}
|
|
592
|
+
|
|
172
593
|
interface WorkflowOptions<TWorkflowName extends string = string, TSteps extends Step<string, any, any, any>[] = Step<string, any, any, any>[], TTriggerSchema extends z.ZodObject<any> = any, TResultSchema extends z.ZodObject<any> = any> {
|
|
173
594
|
steps?: TSteps;
|
|
174
595
|
name: TWorkflowName;
|
|
@@ -541,6 +962,7 @@ interface WorkflowRunState {
|
|
|
541
962
|
stepId: string;
|
|
542
963
|
status: string;
|
|
543
964
|
}>;
|
|
965
|
+
suspendedPaths: Record<string, number[]>;
|
|
544
966
|
runId: string;
|
|
545
967
|
timestamp: number;
|
|
546
968
|
childStates?: Record<string, WorkflowRunState>;
|
|
@@ -562,9 +984,8 @@ declare class Step<TStepId extends string = any, TSchemaIn extends z.ZodSchema |
|
|
|
562
984
|
mastra?: Mastra;
|
|
563
985
|
constructor({ id, description, execute, payload, outputSchema, inputSchema, retryConfig, }: StepAction<TStepId, TSchemaIn, TSchemaOut, TContext>);
|
|
564
986
|
}
|
|
565
|
-
declare function createStep<TId extends string, TSchemaIn extends z.ZodSchema | undefined, TSchemaOut extends z.ZodSchema | undefined, TContext extends StepExecutionContext<TSchemaIn>>(opts: StepAction<TId, TSchemaIn, TSchemaOut, TContext>): Step<TId, TSchemaIn, TSchemaOut, TContext>;
|
|
566
987
|
|
|
567
|
-
declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any, any, any>[], TTriggerSchema extends z.ZodObject<any> = any, TResultSchema extends z.ZodObject<any> = any> extends EventEmitter {
|
|
988
|
+
declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any, any, any>[], TTriggerSchema extends z.ZodObject<any> = any, TResultSchema extends z.ZodObject<any> = any> extends EventEmitter$1 {
|
|
568
989
|
#private;
|
|
569
990
|
logger: Logger;
|
|
570
991
|
name: string;
|
|
@@ -1321,7 +1742,7 @@ type MastraCustomLLMOptions<Z extends ZodSchema | JSONSchema7 | undefined = unde
|
|
|
1321
1742
|
threadId?: string;
|
|
1322
1743
|
resourceId?: string;
|
|
1323
1744
|
runtimeContext: RuntimeContext;
|
|
1324
|
-
} & Run;
|
|
1745
|
+
} & Run$1;
|
|
1325
1746
|
type LLMTextOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
|
|
1326
1747
|
messages: CoreMessage[];
|
|
1327
1748
|
} & MastraCustomLLMOptions<Z> & DefaultLLMTextOptions;
|
|
@@ -1679,13 +2100,14 @@ type ServerConfig = {
|
|
|
1679
2100
|
};
|
|
1680
2101
|
};
|
|
1681
2102
|
|
|
1682
|
-
interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, 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 Logger = Logger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>> {
|
|
2103
|
+
interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TNewWorkflows extends Record<string, NewWorkflow> = Record<string, NewWorkflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends Logger = Logger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>> {
|
|
1683
2104
|
agents?: TAgents;
|
|
1684
2105
|
networks?: TNetworks;
|
|
1685
2106
|
storage?: MastraStorage;
|
|
1686
2107
|
vectors?: TVectors;
|
|
1687
2108
|
logger?: TLogger | false;
|
|
1688
2109
|
workflows?: TWorkflows;
|
|
2110
|
+
vnext_workflows?: TNewWorkflows;
|
|
1689
2111
|
tts?: TTTS;
|
|
1690
2112
|
telemetry?: OtelConfig;
|
|
1691
2113
|
deployer?: MastraDeployer;
|
|
@@ -1701,7 +2123,7 @@ interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Age
|
|
|
1701
2123
|
}>;
|
|
1702
2124
|
memory?: MastraMemory;
|
|
1703
2125
|
}
|
|
1704
|
-
declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, 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 Logger = Logger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>> {
|
|
2126
|
+
declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TNewWorkflows extends Record<string, NewWorkflow> = Record<string, NewWorkflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends Logger = Logger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>> {
|
|
1705
2127
|
#private;
|
|
1706
2128
|
/**
|
|
1707
2129
|
* @deprecated use getTelemetry() instead
|
|
@@ -1715,7 +2137,7 @@ declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string,
|
|
|
1715
2137
|
* @deprecated use getMemory() instead
|
|
1716
2138
|
*/
|
|
1717
2139
|
get memory(): MastraMemory | undefined;
|
|
1718
|
-
constructor(config?: Config<TAgents, TWorkflows, TVectors, TTTS, TLogger>);
|
|
2140
|
+
constructor(config?: Config<TAgents, TWorkflows, TNewWorkflows, TVectors, TTTS, TLogger>);
|
|
1719
2141
|
getAgent<TAgentName extends keyof TAgents>(name: TAgentName): TAgents[TAgentName];
|
|
1720
2142
|
getAgents(): TAgents;
|
|
1721
2143
|
getVector<TVectorName extends keyof TVectors>(name: TVectorName): TVectors[TVectorName];
|
|
@@ -1724,6 +2146,9 @@ declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string,
|
|
|
1724
2146
|
getWorkflow<TWorkflowId extends keyof TWorkflows>(id: TWorkflowId, { serialized }?: {
|
|
1725
2147
|
serialized?: boolean;
|
|
1726
2148
|
}): TWorkflows[TWorkflowId];
|
|
2149
|
+
vnext_getWorkflow<TWorkflowId extends keyof TNewWorkflows>(id: TWorkflowId, { serialized }?: {
|
|
2150
|
+
serialized?: boolean;
|
|
2151
|
+
}): TNewWorkflows[TWorkflowId];
|
|
1727
2152
|
getWorkflows(props?: {
|
|
1728
2153
|
serialized?: boolean;
|
|
1729
2154
|
}): Record<string, Workflow>;
|
|
@@ -1804,6 +2229,7 @@ declare class MastraLLMBase extends MastraBase {
|
|
|
1804
2229
|
|
|
1805
2230
|
declare class Agent<TAgentId extends string = string, TTools extends ToolsInput = ToolsInput, TMetrics extends Record<string, Metric> = Record<string, Metric>> extends MastraBase {
|
|
1806
2231
|
#private;
|
|
2232
|
+
id: TAgentId;
|
|
1807
2233
|
name: TAgentId;
|
|
1808
2234
|
readonly llm: MastraLLMBase;
|
|
1809
2235
|
instructions: string;
|
|
@@ -2156,4 +2582,4 @@ declare abstract class MastraStorage extends MastraBase {
|
|
|
2156
2582
|
}): Promise<WorkflowRuns>;
|
|
2157
2583
|
}
|
|
2158
2584
|
|
|
2159
|
-
export { type
|
|
2585
|
+
export { type CoreAssistantMessage as $, type ApiRoute as A, type WatchEvent as B, CompositeVoice as C, type ToolAction as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps$1 as P, type WorkflowRow as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type WorkflowRuns as U, type VoiceEventType as V, type WorkflowRunState as W, type LanguageModel as X, type CoreMessage as Y, type ZodPathType as Z, type CoreSystemMessage as _, Mastra as a, type WorkflowResumeResult as a$, type CoreUserMessage as a0, type CoreToolMessage as a1, type EmbedResult as a2, type EmbedManyResult as a3, type BaseStructuredOutputType as a4, type StructuredOutputType as a5, type StructuredOutputArrayItem as a6, type StructuredOutput as a7, type GenerateReturn as a8, type StreamReturn as a9, type BaseCondition as aA, type ActionContext as aB, WhenConditionReturnValue as aC, type StepDef as aD, type StepCondition as aE, type StepConfig as aF, type StepResult as aG, type StepsRecord as aH, type WorkflowRunResult as aI, type WorkflowContext as aJ, type WorkflowLogMessage as aK, type WorkflowEvent as aL, type ResolverFunctionInput as aM, type ResolverFunctionOutput as aN, type SubscriberFunctionOutput as aO, type DependencyCheckOutput as aP, type StepResolverOutput as aQ, type WorkflowActors as aR, type WorkflowActionParams as aS, type WorkflowActions as aT, type WorkflowState as aU, type StepId as aV, type ExtractSchemaFromStep as aW, type ExtractStepResult as aX, type StepInputType as aY, type ExtractSchemaType as aZ, type PathsToStringProps as a_, type OutputType as aa, type DefaultLLMTextOptions as ab, type DefaultLLMTextObjectOptions as ac, type DefaultLLMStreamOptions as ad, type DefaultLLMStreamObjectOptions as ae, type LLMTextOptions as af, type LLMTextObjectOptions as ag, type LLMStreamOptions as ah, type LLMInnerStreamOptions as ai, type LLMStreamObjectOptions as aj, type Config as ak, type MessageResponse as al, type MemoryConfig as am, type SharedMemoryConfig as an, type MemoryProcessorOpts as ao, MemoryProcessor as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type StepExecutionContext as at, type StepAction as au, type StepVariableType as av, type StepNode as aw, type StepGraph as ax, type RetryConfig as ay, type VariableReference as az, MastraVoice as b, type MastraLanguageModel as b0, type ToolsInput as b1, type MastraPrimitives as b2, AgentNetwork as b3, type AgentNetworkConfig as b4, type ToolsetsInput as b5, type AgentGenerateOptions as b6, type AgentStreamOptions as b7, TABLE_WORKFLOW_SNAPSHOT as b8, TABLE_EVALS as b9, TABLE_MESSAGES as ba, TABLE_THREADS as bb, TABLE_TRACES as bc, TABLE_SCHEMAS as bd, type VoiceEventMap as c, type VoiceConfig as d, MastraStorage as e, type StorageThreadType as f, type MessageType as g, type StorageGetMessagesArg as h, ExecutionEngine as i, type ExecutionGraph as j, type StepResult$1 as k, type StepFlowEntry as l, type ExecuteFunction as m, createStep as n, cloneStep as o, createWorkflow as p, type WorkflowStatus as q, type NewWorkflowConfig as r, NewWorkflow as s, type StepSuccess$1 as t, type StepFailure$1 as u, type StepSuspended$1 as v, type StepsRecord$1 as w, type ExtractSchemaType$1 as x, type ExtractSchemaFromStep$1 as y, type VariableReference$1 as z };
|