@mastra/core 0.9.1-alpha.1 → 0.9.1-alpha.3
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.d.cts +1 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/{base-DDoWFpFc.d.ts → base-CuXWXbrh.d.ts} +33 -9
- package/dist/{base-CZmT-p10.d.cts → base-mr-hn8v_.d.cts} +33 -9
- package/dist/eval/index.d.cts +1 -1
- package/dist/eval/index.d.ts +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/integration/index.d.cts +1 -1
- package/dist/integration/index.d.ts +1 -1
- package/dist/llm/index.d.cts +1 -1
- package/dist/llm/index.d.ts +1 -1
- package/dist/mastra/index.d.cts +1 -1
- package/dist/mastra/index.d.ts +1 -1
- package/dist/memory/index.d.cts +1 -1
- package/dist/memory/index.d.ts +1 -1
- package/dist/network/index.d.cts +1 -1
- package/dist/network/index.d.ts +1 -1
- package/dist/relevance/index.d.cts +1 -1
- package/dist/relevance/index.d.ts +1 -1
- package/dist/server/index.d.cts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/storage/index.d.cts +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/libsql/index.d.cts +1 -1
- package/dist/storage/libsql/index.d.ts +1 -1
- package/dist/telemetry/index.d.cts +1 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/tools/index.d.cts +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/voice/index.d.cts +2 -2
- package/dist/voice/index.d.ts +2 -2
- package/dist/workflows/index.d.cts +2 -2
- package/dist/workflows/index.d.ts +2 -2
- package/dist/workflows/vNext/index.cjs +38 -21
- package/dist/workflows/vNext/index.d.cts +2 -2
- package/dist/workflows/vNext/index.d.ts +2 -2
- package/dist/workflows/vNext/index.js +38 -22
- package/package.json +1 -1
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 { G as Agent, H as AgentConfig, b9 as AgentGenerateOptions, ba as AgentStreamOptions, b3 as MastraLanguageModel, b4 as ToolsInput, b8 as ToolsetsInput } from '../base-mr-hn8v_.cjs';
|
|
5
5
|
import '../base-BihKcqDY.cjs';
|
|
6
6
|
import '../types-BtMyV38I.cjs';
|
|
7
7
|
import '../runtime-context/index.cjs';
|
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 { G as Agent, H as AgentConfig, b9 as AgentGenerateOptions, ba as AgentStreamOptions, b3 as MastraLanguageModel, b4 as ToolsInput, b8 as ToolsetsInput } from '../base-CuXWXbrh.js';
|
|
5
5
|
import '../base-DT2poiVK.js';
|
|
6
6
|
import '../types-BtMyV38I.js';
|
|
7
7
|
import '../runtime-context/index.js';
|
|
@@ -1177,7 +1177,7 @@ type VariableReference<TStep extends NewStep<string, any, any> = NewStep<string,
|
|
|
1177
1177
|
type WatchEvent = {
|
|
1178
1178
|
type: 'watch';
|
|
1179
1179
|
payload: {
|
|
1180
|
-
currentStep
|
|
1180
|
+
currentStep?: {
|
|
1181
1181
|
id: string;
|
|
1182
1182
|
status: 'running' | 'success' | 'failed' | 'suspended';
|
|
1183
1183
|
output?: Record<string, any>;
|
|
@@ -1300,10 +1300,13 @@ declare function createStep<TSchemaIn extends z.ZodType<any>, TSchemaOut extends
|
|
|
1300
1300
|
outputSchema: TSchemaOut;
|
|
1301
1301
|
execute: (context: TContext) => Promise<any>;
|
|
1302
1302
|
}): NewStep<string, TSchemaIn, TSchemaOut, z.ZodType<any>, z.ZodType<any>>;
|
|
1303
|
-
declare function cloneStep<TStepId extends string>(step: NewStep<
|
|
1303
|
+
declare function cloneStep<TStepId extends string>(step: NewStep<string, any, any>, opts: {
|
|
1304
1304
|
id: TStepId;
|
|
1305
|
-
}): NewStep<
|
|
1306
|
-
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>;
|
|
1305
|
+
}): NewStep<TStepId, any, any>;
|
|
1306
|
+
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, any, any>[] = NewStep<string, any, any, any, any>[]>(params: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): NewWorkflow<TSteps, TWorkflowId, TInput, TOutput, TInput>;
|
|
1307
|
+
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 NewStep<string, any, any, any, any>[] = NewStep<string, any, any, any, any>[]>(workflow: NewWorkflow<TSteps, string, TInput, TOutput>, opts: {
|
|
1308
|
+
id: TWorkflowId;
|
|
1309
|
+
}): NewWorkflow<TSteps, TWorkflowId, TInput, TOutput>;
|
|
1307
1310
|
type WorkflowResult<TOutput extends z.ZodType<any>, TSteps extends NewStep<string, any, any>[]> = {
|
|
1308
1311
|
status: 'success';
|
|
1309
1312
|
result: z.infer<TOutput>;
|
|
@@ -1323,7 +1326,7 @@ type WorkflowResult<TOutput extends z.ZodType<any>, TSteps extends NewStep<strin
|
|
|
1323
1326
|
};
|
|
1324
1327
|
suspended: [string[], ...string[][]];
|
|
1325
1328
|
};
|
|
1326
|
-
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>[]> = {
|
|
1329
|
+
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, any, any>[] = NewStep<string, any, any, any, any>[]> = {
|
|
1327
1330
|
mastra?: Mastra;
|
|
1328
1331
|
id: TWorkflowId;
|
|
1329
1332
|
description?: string | undefined;
|
|
@@ -1336,13 +1339,14 @@ type NewWorkflowConfig<TWorkflowId extends string = string, TInput extends z.Zod
|
|
|
1336
1339
|
delay?: number;
|
|
1337
1340
|
};
|
|
1338
1341
|
};
|
|
1339
|
-
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> {
|
|
1342
|
+
declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] = NewStep<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 NewStep<TWorkflowId, TInput, TOutput> {
|
|
1340
1343
|
#private;
|
|
1341
1344
|
id: TWorkflowId;
|
|
1342
1345
|
description?: string | undefined;
|
|
1343
1346
|
inputSchema: TInput;
|
|
1344
1347
|
outputSchema: TOutput;
|
|
1345
|
-
steps: Record<string, NewStep<string, any, any>>;
|
|
1348
|
+
steps: Record<string, NewStep<string, any, any, any, any>>;
|
|
1349
|
+
stepDefs?: TSteps;
|
|
1346
1350
|
protected stepFlow: StepFlowEntry[];
|
|
1347
1351
|
protected executionEngine: ExecutionEngine;
|
|
1348
1352
|
protected executionGraph: ExecutionGraph;
|
|
@@ -1350,9 +1354,11 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any>[] = NewStep<s
|
|
|
1350
1354
|
attempts?: number;
|
|
1351
1355
|
delay?: number;
|
|
1352
1356
|
};
|
|
1353
|
-
constructor({ mastra, id, inputSchema, outputSchema, description, executionEngine, retryConfig, }: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>);
|
|
1357
|
+
constructor({ mastra, id, inputSchema, outputSchema, description, executionEngine, retryConfig, steps, }: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>);
|
|
1358
|
+
get mastra(): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, Workflow<Step<string, any, any, StepExecutionContext<any, WorkflowContext<any, Step<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, NewWorkflow<NewStep<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>, Logger, Record<string, AgentNetwork>> | undefined;
|
|
1354
1359
|
__registerMastra(mastra: Mastra): void;
|
|
1355
1360
|
__registerPrimitives(p: MastraPrimitives): void;
|
|
1361
|
+
setStepFlow(stepFlow: StepFlowEntry[]): void;
|
|
1356
1362
|
/**
|
|
1357
1363
|
* Adds a step to the workflow
|
|
1358
1364
|
* @param step The step to add to the workflow
|
|
@@ -2131,9 +2137,27 @@ type Middleware = MiddlewareHandler | {
|
|
|
2131
2137
|
handler: MiddlewareHandler;
|
|
2132
2138
|
};
|
|
2133
2139
|
type ServerConfig = {
|
|
2140
|
+
/**
|
|
2141
|
+
* Port for the server
|
|
2142
|
+
* @default 4111
|
|
2143
|
+
*/
|
|
2134
2144
|
port?: number;
|
|
2145
|
+
/**
|
|
2146
|
+
* Host for the server
|
|
2147
|
+
* @default 'localhost'
|
|
2148
|
+
*/
|
|
2149
|
+
host?: string;
|
|
2150
|
+
/**
|
|
2151
|
+
* Timeout for the server
|
|
2152
|
+
*/
|
|
2135
2153
|
timeout?: number;
|
|
2154
|
+
/**
|
|
2155
|
+
* Custom API routes for the server
|
|
2156
|
+
*/
|
|
2136
2157
|
apiRoutes?: ApiRoute[];
|
|
2158
|
+
/**
|
|
2159
|
+
* Middleware for the server
|
|
2160
|
+
*/
|
|
2137
2161
|
middleware?: Middleware | Middleware[];
|
|
2138
2162
|
/**
|
|
2139
2163
|
* CORS configuration for the server
|
|
@@ -2627,4 +2651,4 @@ declare abstract class MastraStorage extends MastraBase {
|
|
|
2627
2651
|
}): Promise<WorkflowRuns>;
|
|
2628
2652
|
}
|
|
2629
2653
|
|
|
2630
|
-
export { type
|
|
2654
|
+
export { type CoreSystemMessage as $, type ApiRoute as A, type VariableReference as B, CompositeVoice as C, type WatchEvent as D, type EvalRow as E, type ToolAction as F, Agent as G, type AgentConfig as H, MastraMemory as I, type ToolExecutionContext as J, Tool as K, Step as L, type Methods as M, type NewStep as N, Workflow as O, type PathsToStringProps as P, type WorkflowOptions as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type WorkflowRow as U, type VoiceEventType as V, type WorkflowRunState as W, type WorkflowRuns as X, type LanguageModel as Y, type ZodPathType as Z, type CoreMessage as _, Mastra as a, type StepInputType as a$, type CoreAssistantMessage as a0, type CoreUserMessage as a1, type CoreToolMessage as a2, type EmbedResult as a3, type EmbedManyResult as a4, type BaseStructuredOutputType as a5, type StructuredOutputType as a6, type StructuredOutputArrayItem as a7, type StructuredOutput as a8, type GenerateReturn as a9, type StepGraph as aA, type RetryConfig as aB, type VariableReference$1 as aC, type BaseCondition as aD, type ActionContext as aE, WhenConditionReturnValue as aF, type StepDef as aG, type StepCondition as aH, type StepConfig as aI, type StepResult$1 as aJ, type StepsRecord$1 as aK, type WorkflowRunResult as aL, type WorkflowContext as aM, type WorkflowLogMessage as aN, type WorkflowEvent as aO, type ResolverFunctionInput as aP, type ResolverFunctionOutput as aQ, type SubscriberFunctionOutput as aR, type DependencyCheckOutput as aS, type StepResolverOutput as aT, type WorkflowActors as aU, type WorkflowActionParams as aV, type WorkflowActions as aW, type WorkflowState as aX, type StepId as aY, type ExtractSchemaFromStep$1 as aZ, type ExtractStepResult as a_, type StreamReturn as aa, type OutputType as ab, type DefaultLLMTextOptions as ac, type DefaultLLMTextObjectOptions as ad, type DefaultLLMStreamOptions as ae, type DefaultLLMStreamObjectOptions as af, type LLMTextOptions as ag, type LLMTextObjectOptions as ah, type LLMStreamOptions as ai, type LLMInnerStreamOptions as aj, type LLMStreamObjectOptions as ak, createMockModel as al, type Config as am, type MessageResponse as an, type MemoryConfig as ao, type SharedMemoryConfig as ap, type MemoryProcessorOpts as aq, MemoryProcessor as ar, memoryDefaultOptions as as, createTool as at, type VercelTool as au, type CoreTool as av, type StepExecutionContext as aw, type StepAction as ax, type StepVariableType as ay, type StepNode as az, MastraVoice as b, type ExtractSchemaType$1 as b0, type PathsToStringProps$1 as b1, type WorkflowResumeResult as b2, type MastraLanguageModel as b3, type ToolsInput as b4, type MastraPrimitives as b5, AgentNetwork as b6, type AgentNetworkConfig as b7, type ToolsetsInput as b8, type AgentGenerateOptions as b9, type AgentStreamOptions as ba, TABLE_WORKFLOW_SNAPSHOT as bb, TABLE_EVALS as bc, TABLE_MESSAGES as bd, TABLE_THREADS as be, TABLE_TRACES as bf, TABLE_SCHEMAS as bg, 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 as k, type StepFlowEntry as l, type ExecuteFunction as m, createStep as n, cloneStep as o, createWorkflow as p, cloneWorkflow as q, type WorkflowResult as r, type NewWorkflowConfig as s, NewWorkflow as t, type StepSuccess as u, type StepFailure as v, type StepSuspended as w, type StepsRecord as x, type ExtractSchemaType as y, type ExtractSchemaFromStep as z };
|
|
@@ -1177,7 +1177,7 @@ type VariableReference<TStep extends NewStep<string, any, any> = NewStep<string,
|
|
|
1177
1177
|
type WatchEvent = {
|
|
1178
1178
|
type: 'watch';
|
|
1179
1179
|
payload: {
|
|
1180
|
-
currentStep
|
|
1180
|
+
currentStep?: {
|
|
1181
1181
|
id: string;
|
|
1182
1182
|
status: 'running' | 'success' | 'failed' | 'suspended';
|
|
1183
1183
|
output?: Record<string, any>;
|
|
@@ -1300,10 +1300,13 @@ declare function createStep<TSchemaIn extends z.ZodType<any>, TSchemaOut extends
|
|
|
1300
1300
|
outputSchema: TSchemaOut;
|
|
1301
1301
|
execute: (context: TContext) => Promise<any>;
|
|
1302
1302
|
}): NewStep<string, TSchemaIn, TSchemaOut, z.ZodType<any>, z.ZodType<any>>;
|
|
1303
|
-
declare function cloneStep<TStepId extends string>(step: NewStep<
|
|
1303
|
+
declare function cloneStep<TStepId extends string>(step: NewStep<string, any, any>, opts: {
|
|
1304
1304
|
id: TStepId;
|
|
1305
|
-
}): NewStep<
|
|
1306
|
-
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>;
|
|
1305
|
+
}): NewStep<TStepId, any, any>;
|
|
1306
|
+
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, any, any>[] = NewStep<string, any, any, any, any>[]>(params: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): NewWorkflow<TSteps, TWorkflowId, TInput, TOutput, TInput>;
|
|
1307
|
+
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 NewStep<string, any, any, any, any>[] = NewStep<string, any, any, any, any>[]>(workflow: NewWorkflow<TSteps, string, TInput, TOutput>, opts: {
|
|
1308
|
+
id: TWorkflowId;
|
|
1309
|
+
}): NewWorkflow<TSteps, TWorkflowId, TInput, TOutput>;
|
|
1307
1310
|
type WorkflowResult<TOutput extends z.ZodType<any>, TSteps extends NewStep<string, any, any>[]> = {
|
|
1308
1311
|
status: 'success';
|
|
1309
1312
|
result: z.infer<TOutput>;
|
|
@@ -1323,7 +1326,7 @@ type WorkflowResult<TOutput extends z.ZodType<any>, TSteps extends NewStep<strin
|
|
|
1323
1326
|
};
|
|
1324
1327
|
suspended: [string[], ...string[][]];
|
|
1325
1328
|
};
|
|
1326
|
-
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>[]> = {
|
|
1329
|
+
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, any, any>[] = NewStep<string, any, any, any, any>[]> = {
|
|
1327
1330
|
mastra?: Mastra;
|
|
1328
1331
|
id: TWorkflowId;
|
|
1329
1332
|
description?: string | undefined;
|
|
@@ -1336,13 +1339,14 @@ type NewWorkflowConfig<TWorkflowId extends string = string, TInput extends z.Zod
|
|
|
1336
1339
|
delay?: number;
|
|
1337
1340
|
};
|
|
1338
1341
|
};
|
|
1339
|
-
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> {
|
|
1342
|
+
declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] = NewStep<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 NewStep<TWorkflowId, TInput, TOutput> {
|
|
1340
1343
|
#private;
|
|
1341
1344
|
id: TWorkflowId;
|
|
1342
1345
|
description?: string | undefined;
|
|
1343
1346
|
inputSchema: TInput;
|
|
1344
1347
|
outputSchema: TOutput;
|
|
1345
|
-
steps: Record<string, NewStep<string, any, any>>;
|
|
1348
|
+
steps: Record<string, NewStep<string, any, any, any, any>>;
|
|
1349
|
+
stepDefs?: TSteps;
|
|
1346
1350
|
protected stepFlow: StepFlowEntry[];
|
|
1347
1351
|
protected executionEngine: ExecutionEngine;
|
|
1348
1352
|
protected executionGraph: ExecutionGraph;
|
|
@@ -1350,9 +1354,11 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any>[] = NewStep<s
|
|
|
1350
1354
|
attempts?: number;
|
|
1351
1355
|
delay?: number;
|
|
1352
1356
|
};
|
|
1353
|
-
constructor({ mastra, id, inputSchema, outputSchema, description, executionEngine, retryConfig, }: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>);
|
|
1357
|
+
constructor({ mastra, id, inputSchema, outputSchema, description, executionEngine, retryConfig, steps, }: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>);
|
|
1358
|
+
get mastra(): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, Workflow<Step<string, any, any, StepExecutionContext<any, WorkflowContext<any, Step<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, NewWorkflow<NewStep<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>, Logger, Record<string, AgentNetwork>> | undefined;
|
|
1354
1359
|
__registerMastra(mastra: Mastra): void;
|
|
1355
1360
|
__registerPrimitives(p: MastraPrimitives): void;
|
|
1361
|
+
setStepFlow(stepFlow: StepFlowEntry[]): void;
|
|
1356
1362
|
/**
|
|
1357
1363
|
* Adds a step to the workflow
|
|
1358
1364
|
* @param step The step to add to the workflow
|
|
@@ -2131,9 +2137,27 @@ type Middleware = MiddlewareHandler | {
|
|
|
2131
2137
|
handler: MiddlewareHandler;
|
|
2132
2138
|
};
|
|
2133
2139
|
type ServerConfig = {
|
|
2140
|
+
/**
|
|
2141
|
+
* Port for the server
|
|
2142
|
+
* @default 4111
|
|
2143
|
+
*/
|
|
2134
2144
|
port?: number;
|
|
2145
|
+
/**
|
|
2146
|
+
* Host for the server
|
|
2147
|
+
* @default 'localhost'
|
|
2148
|
+
*/
|
|
2149
|
+
host?: string;
|
|
2150
|
+
/**
|
|
2151
|
+
* Timeout for the server
|
|
2152
|
+
*/
|
|
2135
2153
|
timeout?: number;
|
|
2154
|
+
/**
|
|
2155
|
+
* Custom API routes for the server
|
|
2156
|
+
*/
|
|
2136
2157
|
apiRoutes?: ApiRoute[];
|
|
2158
|
+
/**
|
|
2159
|
+
* Middleware for the server
|
|
2160
|
+
*/
|
|
2137
2161
|
middleware?: Middleware | Middleware[];
|
|
2138
2162
|
/**
|
|
2139
2163
|
* CORS configuration for the server
|
|
@@ -2627,4 +2651,4 @@ declare abstract class MastraStorage extends MastraBase {
|
|
|
2627
2651
|
}): Promise<WorkflowRuns>;
|
|
2628
2652
|
}
|
|
2629
2653
|
|
|
2630
|
-
export { type
|
|
2654
|
+
export { type CoreSystemMessage as $, type ApiRoute as A, type VariableReference as B, CompositeVoice as C, type WatchEvent as D, type EvalRow as E, type ToolAction as F, Agent as G, type AgentConfig as H, MastraMemory as I, type ToolExecutionContext as J, Tool as K, Step as L, type Methods as M, type NewStep as N, Workflow as O, type PathsToStringProps as P, type WorkflowOptions as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type WorkflowRow as U, type VoiceEventType as V, type WorkflowRunState as W, type WorkflowRuns as X, type LanguageModel as Y, type ZodPathType as Z, type CoreMessage as _, Mastra as a, type StepInputType as a$, type CoreAssistantMessage as a0, type CoreUserMessage as a1, type CoreToolMessage as a2, type EmbedResult as a3, type EmbedManyResult as a4, type BaseStructuredOutputType as a5, type StructuredOutputType as a6, type StructuredOutputArrayItem as a7, type StructuredOutput as a8, type GenerateReturn as a9, type StepGraph as aA, type RetryConfig as aB, type VariableReference$1 as aC, type BaseCondition as aD, type ActionContext as aE, WhenConditionReturnValue as aF, type StepDef as aG, type StepCondition as aH, type StepConfig as aI, type StepResult$1 as aJ, type StepsRecord$1 as aK, type WorkflowRunResult as aL, type WorkflowContext as aM, type WorkflowLogMessage as aN, type WorkflowEvent as aO, type ResolverFunctionInput as aP, type ResolverFunctionOutput as aQ, type SubscriberFunctionOutput as aR, type DependencyCheckOutput as aS, type StepResolverOutput as aT, type WorkflowActors as aU, type WorkflowActionParams as aV, type WorkflowActions as aW, type WorkflowState as aX, type StepId as aY, type ExtractSchemaFromStep$1 as aZ, type ExtractStepResult as a_, type StreamReturn as aa, type OutputType as ab, type DefaultLLMTextOptions as ac, type DefaultLLMTextObjectOptions as ad, type DefaultLLMStreamOptions as ae, type DefaultLLMStreamObjectOptions as af, type LLMTextOptions as ag, type LLMTextObjectOptions as ah, type LLMStreamOptions as ai, type LLMInnerStreamOptions as aj, type LLMStreamObjectOptions as ak, createMockModel as al, type Config as am, type MessageResponse as an, type MemoryConfig as ao, type SharedMemoryConfig as ap, type MemoryProcessorOpts as aq, MemoryProcessor as ar, memoryDefaultOptions as as, createTool as at, type VercelTool as au, type CoreTool as av, type StepExecutionContext as aw, type StepAction as ax, type StepVariableType as ay, type StepNode as az, MastraVoice as b, type ExtractSchemaType$1 as b0, type PathsToStringProps$1 as b1, type WorkflowResumeResult as b2, type MastraLanguageModel as b3, type ToolsInput as b4, type MastraPrimitives as b5, AgentNetwork as b6, type AgentNetworkConfig as b7, type ToolsetsInput as b8, type AgentGenerateOptions as b9, type AgentStreamOptions as ba, TABLE_WORKFLOW_SNAPSHOT as bb, TABLE_EVALS as bc, TABLE_MESSAGES as bd, TABLE_THREADS as be, TABLE_TRACES as bf, TABLE_SCHEMAS as bg, 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 as k, type StepFlowEntry as l, type ExecuteFunction as m, createStep as n, cloneStep as o, createWorkflow as p, cloneWorkflow as q, type WorkflowResult as r, type NewWorkflowConfig as s, NewWorkflow as t, type StepSuccess as u, type StepFailure as v, type StepSuspended as w, type StepsRecord as x, type ExtractSchemaType as y, type ExtractSchemaFromStep as z };
|
package/dist/eval/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as Metric, T as TestInfo, E as EvaluationResult } from '../types-BtMyV38I.cjs';
|
|
2
2
|
export { M as MetricResult } from '../types-BtMyV38I.cjs';
|
|
3
|
-
import {
|
|
3
|
+
import { G as Agent } from '../base-mr-hn8v_.cjs';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../base-BihKcqDY.cjs';
|
|
6
6
|
import '@opentelemetry/api';
|
package/dist/eval/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as Metric, T as TestInfo, E as EvaluationResult } from '../types-BtMyV38I.js';
|
|
2
2
|
export { M as MetricResult } from '../types-BtMyV38I.js';
|
|
3
|
-
import {
|
|
3
|
+
import { G as Agent } from '../base-CuXWXbrh.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../base-DT2poiVK.js';
|
|
6
6
|
import '@opentelemetry/api';
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Metric } from './types-BtMyV38I.cjs';
|
|
2
2
|
export { E as EvaluationResult, M as MetricResult, T as TestInfo } from './types-BtMyV38I.cjs';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
import { F as ToolAction, G as Agent$1, H as AgentConfig, e as MastraStorage$1, I as MastraMemory$1, J as ToolExecutionContext, K as Tool$1, L as Step, O as Workflow$1, Q as WorkflowOptions } from './base-mr-hn8v_.cjs';
|
|
4
|
+
export { aE as ActionContext, aD as BaseCondition, a5 as BaseStructuredOutputType, am as Config, a0 as CoreAssistantMessage, _ as CoreMessage, $ as CoreSystemMessage, av as CoreTool, a2 as CoreToolMessage, a1 as CoreUserMessage, af as DefaultLLMStreamObjectOptions, ae as DefaultLLMStreamOptions, ad as DefaultLLMTextObjectOptions, ac as DefaultLLMTextOptions, aS as DependencyCheckOutput, a4 as EmbedManyResult, a3 as EmbedResult, E as EvalRow, aZ as ExtractSchemaFromStep, b0 as ExtractSchemaType, a_ as ExtractStepResult, a9 as GenerateReturn, aj as LLMInnerStreamOptions, ak as LLMStreamObjectOptions, ai as LLMStreamOptions, ah as LLMTextObjectOptions, ag as LLMTextOptions, Y as LanguageModel, a as Mastra, ao as MemoryConfig, ar as MemoryProcessor, aq as MemoryProcessorOpts, an as MessageResponse, g as MessageType, ab as OutputType, b1 as PathsToStringProps, aP as ResolverFunctionInput, aQ as ResolverFunctionOutput, aB as RetryConfig, ap as SharedMemoryConfig, ax as StepAction, aH as StepCondition, aI as StepConfig, aG as StepDef, aw as StepExecutionContext, aA as StepGraph, aY as StepId, a$ as StepInputType, az as StepNode, aT as StepResolverOutput, aJ as StepResult, ay as StepVariableType, aK as StepsRecord, S as StorageColumn, h as StorageGetMessagesArg, f as StorageThreadType, aa as StreamReturn, a8 as StructuredOutput, a7 as StructuredOutputArrayItem, a6 as StructuredOutputType, aR as SubscriberFunctionOutput, aC as VariableReference, au as VercelTool, aF as WhenConditionReturnValue, aV as WorkflowActionParams, aW as WorkflowActions, aU as WorkflowActors, aM as WorkflowContext, aO as WorkflowEvent, aN as WorkflowLogMessage, b2 as WorkflowResumeResult, U as WorkflowRow, aL as WorkflowRunResult, W as WorkflowRunState, X as WorkflowRuns, aX as WorkflowState, al as createMockModel, at as createTool, as as memoryDefaultOptions } from './base-mr-hn8v_.cjs';
|
|
5
5
|
import { M as MastraBase$1 } from './base-BihKcqDY.cjs';
|
|
6
6
|
export { O as OtelConfig, S as SamplingStrategy, T as Telemetry } from './base-BihKcqDY.cjs';
|
|
7
7
|
import { R as RegisteredLogger, a as LogLevel, T as TransportMap, L as Logger } from './index-CquI0inB.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Metric } from './types-BtMyV38I.js';
|
|
2
2
|
export { E as EvaluationResult, M as MetricResult, T as TestInfo } from './types-BtMyV38I.js';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
import { F as ToolAction, G as Agent$1, H as AgentConfig, e as MastraStorage$1, I as MastraMemory$1, J as ToolExecutionContext, K as Tool$1, L as Step, O as Workflow$1, Q as WorkflowOptions } from './base-CuXWXbrh.js';
|
|
4
|
+
export { aE as ActionContext, aD as BaseCondition, a5 as BaseStructuredOutputType, am as Config, a0 as CoreAssistantMessage, _ as CoreMessage, $ as CoreSystemMessage, av as CoreTool, a2 as CoreToolMessage, a1 as CoreUserMessage, af as DefaultLLMStreamObjectOptions, ae as DefaultLLMStreamOptions, ad as DefaultLLMTextObjectOptions, ac as DefaultLLMTextOptions, aS as DependencyCheckOutput, a4 as EmbedManyResult, a3 as EmbedResult, E as EvalRow, aZ as ExtractSchemaFromStep, b0 as ExtractSchemaType, a_ as ExtractStepResult, a9 as GenerateReturn, aj as LLMInnerStreamOptions, ak as LLMStreamObjectOptions, ai as LLMStreamOptions, ah as LLMTextObjectOptions, ag as LLMTextOptions, Y as LanguageModel, a as Mastra, ao as MemoryConfig, ar as MemoryProcessor, aq as MemoryProcessorOpts, an as MessageResponse, g as MessageType, ab as OutputType, b1 as PathsToStringProps, aP as ResolverFunctionInput, aQ as ResolverFunctionOutput, aB as RetryConfig, ap as SharedMemoryConfig, ax as StepAction, aH as StepCondition, aI as StepConfig, aG as StepDef, aw as StepExecutionContext, aA as StepGraph, aY as StepId, a$ as StepInputType, az as StepNode, aT as StepResolverOutput, aJ as StepResult, ay as StepVariableType, aK as StepsRecord, S as StorageColumn, h as StorageGetMessagesArg, f as StorageThreadType, aa as StreamReturn, a8 as StructuredOutput, a7 as StructuredOutputArrayItem, a6 as StructuredOutputType, aR as SubscriberFunctionOutput, aC as VariableReference, au as VercelTool, aF as WhenConditionReturnValue, aV as WorkflowActionParams, aW as WorkflowActions, aU as WorkflowActors, aM as WorkflowContext, aO as WorkflowEvent, aN as WorkflowLogMessage, b2 as WorkflowResumeResult, U as WorkflowRow, aL as WorkflowRunResult, W as WorkflowRunState, X as WorkflowRuns, aX as WorkflowState, al as createMockModel, at as createTool, as as memoryDefaultOptions } from './base-CuXWXbrh.js';
|
|
5
5
|
import { M as MastraBase$1 } from './base-DT2poiVK.js';
|
|
6
6
|
export { O as OtelConfig, S as SamplingStrategy, T as Telemetry } from './base-DT2poiVK.js';
|
|
7
7
|
import { R as RegisteredLogger, a as LogLevel, T as TransportMap, L as Logger } from './index-CquI0inB.js';
|
package/dist/llm/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'ai';
|
|
2
2
|
import 'json-schema';
|
|
3
3
|
import 'zod';
|
|
4
|
-
export {
|
|
4
|
+
export { a5 as BaseStructuredOutputType, a0 as CoreAssistantMessage, _ as CoreMessage, $ as CoreSystemMessage, a2 as CoreToolMessage, a1 as CoreUserMessage, af as DefaultLLMStreamObjectOptions, ae as DefaultLLMStreamOptions, ad as DefaultLLMTextObjectOptions, ac as DefaultLLMTextOptions, a4 as EmbedManyResult, a3 as EmbedResult, a9 as GenerateReturn, aj as LLMInnerStreamOptions, ak as LLMStreamObjectOptions, ai as LLMStreamOptions, ah as LLMTextObjectOptions, ag as LLMTextOptions, Y as LanguageModel, ab as OutputType, aa as StreamReturn, a8 as StructuredOutput, a7 as StructuredOutputArrayItem, a6 as StructuredOutputType, al as createMockModel } from '../base-mr-hn8v_.cjs';
|
|
5
5
|
import '../index-CquI0inB.cjs';
|
|
6
6
|
import '../runtime-context/index.cjs';
|
|
7
7
|
import '../base-BihKcqDY.cjs';
|
package/dist/llm/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'ai';
|
|
2
2
|
import 'json-schema';
|
|
3
3
|
import 'zod';
|
|
4
|
-
export {
|
|
4
|
+
export { a5 as BaseStructuredOutputType, a0 as CoreAssistantMessage, _ as CoreMessage, $ as CoreSystemMessage, a2 as CoreToolMessage, a1 as CoreUserMessage, af as DefaultLLMStreamObjectOptions, ae as DefaultLLMStreamOptions, ad as DefaultLLMTextObjectOptions, ac as DefaultLLMTextOptions, a4 as EmbedManyResult, a3 as EmbedResult, a9 as GenerateReturn, aj as LLMInnerStreamOptions, ak as LLMStreamObjectOptions, ai as LLMStreamOptions, ah as LLMTextObjectOptions, ag as LLMTextOptions, Y as LanguageModel, ab as OutputType, aa as StreamReturn, a8 as StructuredOutput, a7 as StructuredOutputArrayItem, a6 as StructuredOutputType, al as createMockModel } from '../base-CuXWXbrh.js';
|
|
5
5
|
import '../index-CquI0inB.js';
|
|
6
6
|
import '../runtime-context/index.js';
|
|
7
7
|
import '../base-DT2poiVK.js';
|
package/dist/mastra/index.d.cts
CHANGED
package/dist/mastra/index.d.ts
CHANGED
package/dist/memory/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { I as MastraMemory, ao as MemoryConfig, ar as MemoryProcessor, aq as MemoryProcessorOpts, an as MessageResponse, g as MessageType, ap as SharedMemoryConfig, f as StorageThreadType, as as memoryDefaultOptions } from '../base-mr-hn8v_.cjs';
|
|
2
2
|
export { Message as AiMessageType } from 'ai';
|
|
3
3
|
import '../base-BihKcqDY.cjs';
|
|
4
4
|
import '@opentelemetry/api';
|
package/dist/memory/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { I as MastraMemory, ao as MemoryConfig, ar as MemoryProcessor, aq as MemoryProcessorOpts, an as MessageResponse, g as MessageType, ap as SharedMemoryConfig, f as StorageThreadType, as as memoryDefaultOptions } from '../base-CuXWXbrh.js';
|
|
2
2
|
export { Message as AiMessageType } from 'ai';
|
|
3
3
|
import '../base-DT2poiVK.js';
|
|
4
4
|
import '@opentelemetry/api';
|
package/dist/network/index.d.cts
CHANGED
package/dist/network/index.d.ts
CHANGED
package/dist/server/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Handler, MiddlewareHandler } from 'hono';
|
|
2
2
|
import { DescribeRouteOptions } from 'hono-openapi';
|
|
3
|
-
import { M as Methods, a as Mastra, A as ApiRoute } from '../base-
|
|
3
|
+
import { M as Methods, a as Mastra, A as ApiRoute } from '../base-mr-hn8v_.cjs';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../base-BihKcqDY.cjs';
|
|
6
6
|
import '@opentelemetry/api';
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Handler, MiddlewareHandler } from 'hono';
|
|
2
2
|
import { DescribeRouteOptions } from 'hono-openapi';
|
|
3
|
-
import { M as Methods, a as Mastra, A as ApiRoute } from '../base-
|
|
3
|
+
import { M as Methods, a as Mastra, A as ApiRoute } from '../base-CuXWXbrh.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../base-DT2poiVK.js';
|
|
6
6
|
import '@opentelemetry/api';
|
package/dist/storage/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { E as EvalRow, e as MastraStorage, S as StorageColumn, h as StorageGetMessagesArg,
|
|
1
|
+
export { E as EvalRow, e as MastraStorage, S as StorageColumn, h as StorageGetMessagesArg, bc as TABLE_EVALS, bd as TABLE_MESSAGES, T as TABLE_NAMES, bg as TABLE_SCHEMAS, be as TABLE_THREADS, bf as TABLE_TRACES, bb as TABLE_WORKFLOW_SNAPSHOT, U as WorkflowRow, X as WorkflowRuns } from '../base-mr-hn8v_.cjs';
|
|
2
2
|
import 'ai';
|
|
3
3
|
import '../base-BihKcqDY.cjs';
|
|
4
4
|
import '@opentelemetry/api';
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { E as EvalRow, e as MastraStorage, S as StorageColumn, h as StorageGetMessagesArg,
|
|
1
|
+
export { E as EvalRow, e as MastraStorage, S as StorageColumn, h as StorageGetMessagesArg, bc as TABLE_EVALS, bd as TABLE_MESSAGES, T as TABLE_NAMES, bg as TABLE_SCHEMAS, be as TABLE_THREADS, bf as TABLE_TRACES, bb as TABLE_WORKFLOW_SNAPSHOT, U as WorkflowRow, X as WorkflowRuns } from '../base-CuXWXbrh.js';
|
|
2
2
|
import 'ai';
|
|
3
3
|
import '../base-DT2poiVK.js';
|
|
4
4
|
import '@opentelemetry/api';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Config } from '@libsql/client';
|
|
2
|
-
import { e as MastraStorage, T as TABLE_NAMES, S as StorageColumn, f as StorageThreadType, g as MessageType, h as StorageGetMessagesArg, E as EvalRow, W as WorkflowRunState } from '../../base-
|
|
2
|
+
import { e as MastraStorage, T as TABLE_NAMES, S as StorageColumn, f as StorageThreadType, g as MessageType, h as StorageGetMessagesArg, E as EvalRow, W as WorkflowRunState } from '../../base-mr-hn8v_.cjs';
|
|
3
3
|
import '../../base-BihKcqDY.cjs';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../../types-BtMyV38I.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Config } from '@libsql/client';
|
|
2
|
-
import { e as MastraStorage, T as TABLE_NAMES, S as StorageColumn, f as StorageThreadType, g as MessageType, h as StorageGetMessagesArg, E as EvalRow, W as WorkflowRunState } from '../../base-
|
|
2
|
+
import { e as MastraStorage, T as TABLE_NAMES, S as StorageColumn, f as StorageThreadType, g as MessageType, h as StorageGetMessagesArg, E as EvalRow, W as WorkflowRunState } from '../../base-CuXWXbrh.js';
|
|
3
3
|
import '../../base-DT2poiVK.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../../types-BtMyV38I.js';
|
|
@@ -3,7 +3,7 @@ import { SpanKind } from '@opentelemetry/api';
|
|
|
3
3
|
import { ExportResult } from '@opentelemetry/core';
|
|
4
4
|
import { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
5
5
|
import { L as Logger } from '../index-CquI0inB.cjs';
|
|
6
|
-
import { e as MastraStorage } from '../base-
|
|
6
|
+
import { e as MastraStorage } from '../base-mr-hn8v_.cjs';
|
|
7
7
|
import 'stream';
|
|
8
8
|
import 'pino';
|
|
9
9
|
import 'ai';
|
|
@@ -3,7 +3,7 @@ import { SpanKind } from '@opentelemetry/api';
|
|
|
3
3
|
import { ExportResult } from '@opentelemetry/core';
|
|
4
4
|
import { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
5
5
|
import { L as Logger } from '../index-CquI0inB.js';
|
|
6
|
-
import { e as MastraStorage } from '../base-
|
|
6
|
+
import { e as MastraStorage } from '../base-CuXWXbrh.js';
|
|
7
7
|
import 'stream';
|
|
8
8
|
import 'pino';
|
|
9
9
|
import 'ai';
|
package/dist/tools/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { av as CoreTool, K as Tool, F as ToolAction, J as ToolExecutionContext, au as VercelTool, at as createTool } from '../base-mr-hn8v_.cjs';
|
|
2
2
|
export { isVercelTool } from '../utils.cjs';
|
|
3
3
|
import 'ai';
|
|
4
4
|
import '../base-BihKcqDY.cjs';
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { av as CoreTool, K as Tool, F as ToolAction, J as ToolExecutionContext, au as VercelTool, at as createTool } from '../base-CuXWXbrh.js';
|
|
2
2
|
export { isVercelTool } from '../utils.js';
|
|
3
3
|
import 'ai';
|
|
4
4
|
import '../base-DT2poiVK.js';
|
package/dist/utils.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { au as VercelTool, F as ToolAction, b4 as ToolsInput, a as Mastra, b5 as MastraPrimitives, I as MastraMemory, av as CoreTool, G as Agent, O as Workflow, L as Step, aw as StepExecutionContext, aM as WorkflowContext, t as NewWorkflow, N as NewStep, b6 as AgentNetwork } from './base-mr-hn8v_.cjs';
|
|
2
2
|
import { CoreMessage, Message } from 'ai';
|
|
3
3
|
import { MastraTTS } from './tts/index.cjs';
|
|
4
4
|
import { MastraVector } from './vector/index.cjs';
|
|
@@ -102,7 +102,7 @@ declare function makeCoreTool(tool: ToolToConvert, options: ToolOptions, logType
|
|
|
102
102
|
declare function createMastraProxy({ mastra, logger }: {
|
|
103
103
|
mastra: Mastra;
|
|
104
104
|
logger: Logger;
|
|
105
|
-
}): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, Workflow<Step<string, any, any, StepExecutionContext<any, WorkflowContext<any, Step<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, NewWorkflow<NewStep<string, any, any,
|
|
105
|
+
}): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, Workflow<Step<string, any, any, StepExecutionContext<any, WorkflowContext<any, Step<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, NewWorkflow<NewStep<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>, Logger, Record<string, AgentNetwork>>;
|
|
106
106
|
declare function checkEvalStorageFields(traceObject: any, logger?: Logger): boolean;
|
|
107
107
|
declare function ensureAllMessagesAreCoreMessages(messages: (CoreMessage | Message)[]): CoreMessage[];
|
|
108
108
|
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { au as VercelTool, F as ToolAction, b4 as ToolsInput, a as Mastra, b5 as MastraPrimitives, I as MastraMemory, av as CoreTool, G as Agent, O as Workflow, L as Step, aw as StepExecutionContext, aM as WorkflowContext, t as NewWorkflow, N as NewStep, b6 as AgentNetwork } from './base-CuXWXbrh.js';
|
|
2
2
|
import { CoreMessage, Message } from 'ai';
|
|
3
3
|
import { MastraTTS } from './tts/index.js';
|
|
4
4
|
import { MastraVector } from './vector/index.js';
|
|
@@ -102,7 +102,7 @@ declare function makeCoreTool(tool: ToolToConvert, options: ToolOptions, logType
|
|
|
102
102
|
declare function createMastraProxy({ mastra, logger }: {
|
|
103
103
|
mastra: Mastra;
|
|
104
104
|
logger: Logger;
|
|
105
|
-
}): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, Workflow<Step<string, any, any, StepExecutionContext<any, WorkflowContext<any, Step<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, NewWorkflow<NewStep<string, any, any,
|
|
105
|
+
}): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, Workflow<Step<string, any, any, StepExecutionContext<any, WorkflowContext<any, Step<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, NewWorkflow<NewStep<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>, Logger, Record<string, AgentNetwork>>;
|
|
106
106
|
declare function checkEvalStorageFields(traceObject: any, logger?: Logger): boolean;
|
|
107
107
|
declare function ensureAllMessagesAreCoreMessages(messages: (CoreMessage | Message)[]): CoreMessage[];
|
|
108
108
|
|
package/dist/voice/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as MastraVoice } from '../base-
|
|
2
|
-
export { C as CompositeVoice, d as VoiceConfig, c as VoiceEventMap, V as VoiceEventType } from '../base-
|
|
1
|
+
import { b as MastraVoice } from '../base-mr-hn8v_.cjs';
|
|
2
|
+
export { C as CompositeVoice, d as VoiceConfig, c as VoiceEventMap, V as VoiceEventType } from '../base-mr-hn8v_.cjs';
|
|
3
3
|
import '../base-BihKcqDY.cjs';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../types-BtMyV38I.cjs';
|
package/dist/voice/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as MastraVoice } from '../base-
|
|
2
|
-
export { C as CompositeVoice, d as VoiceConfig, c as VoiceEventMap, V as VoiceEventType } from '../base-
|
|
1
|
+
import { b as MastraVoice } from '../base-CuXWXbrh.js';
|
|
2
|
+
export { C as CompositeVoice, d as VoiceConfig, c as VoiceEventMap, V as VoiceEventType } from '../base-CuXWXbrh.js';
|
|
3
3
|
import '../base-DT2poiVK.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../types-BtMyV38I.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { aC as VariableReference, aJ as StepResult, L as Step, O as Workflow, G as Agent, aM as WorkflowContext, b4 as ToolsInput, a as Mastra, ax as StepAction, aL as WorkflowRunResult } from '../base-mr-hn8v_.cjs';
|
|
2
|
+
export { aE as ActionContext, aD as BaseCondition, aS as DependencyCheckOutput, aZ as ExtractSchemaFromStep, b0 as ExtractSchemaType, a_ as ExtractStepResult, b1 as PathsToStringProps, aP as ResolverFunctionInput, aQ as ResolverFunctionOutput, aB as RetryConfig, aH as StepCondition, aI as StepConfig, aG as StepDef, aw as StepExecutionContext, aA as StepGraph, aY as StepId, a$ as StepInputType, az as StepNode, aT as StepResolverOutput, ay as StepVariableType, aK as StepsRecord, aR as SubscriberFunctionOutput, aF as WhenConditionReturnValue, aV as WorkflowActionParams, aW as WorkflowActions, aU as WorkflowActors, aO as WorkflowEvent, aN as WorkflowLogMessage, Q as WorkflowOptions, b2 as WorkflowResumeResult, W as WorkflowRunState, aX as WorkflowState } from '../base-mr-hn8v_.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { a as Metric } from '../types-BtMyV38I.cjs';
|
|
5
5
|
import { L as Logger } from '../index-CquI0inB.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { aC as VariableReference, aJ as StepResult, L as Step, O as Workflow, G as Agent, aM as WorkflowContext, b4 as ToolsInput, a as Mastra, ax as StepAction, aL as WorkflowRunResult } from '../base-CuXWXbrh.js';
|
|
2
|
+
export { aE as ActionContext, aD as BaseCondition, aS as DependencyCheckOutput, aZ as ExtractSchemaFromStep, b0 as ExtractSchemaType, a_ as ExtractStepResult, b1 as PathsToStringProps, aP as ResolverFunctionInput, aQ as ResolverFunctionOutput, aB as RetryConfig, aH as StepCondition, aI as StepConfig, aG as StepDef, aw as StepExecutionContext, aA as StepGraph, aY as StepId, a$ as StepInputType, az as StepNode, aT as StepResolverOutput, ay as StepVariableType, aK as StepsRecord, aR as SubscriberFunctionOutput, aF as WhenConditionReturnValue, aV as WorkflowActionParams, aW as WorkflowActions, aU as WorkflowActors, aO as WorkflowEvent, aN as WorkflowLogMessage, Q as WorkflowOptions, b2 as WorkflowResumeResult, W as WorkflowRunState, aX as WorkflowState } from '../base-CuXWXbrh.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { a as Metric } from '../types-BtMyV38I.js';
|
|
5
5
|
import { L as Logger } from '../index-CquI0inB.js';
|
|
@@ -92,10 +92,6 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
92
92
|
params.emitter.emit("watch", {
|
|
93
93
|
type: "watch",
|
|
94
94
|
payload: {
|
|
95
|
-
currentStep: {
|
|
96
|
-
id: entry.step.id,
|
|
97
|
-
...lastOutput
|
|
98
|
-
},
|
|
99
95
|
workflowState: {
|
|
100
96
|
status: lastOutput.status,
|
|
101
97
|
steps: stepResults,
|
|
@@ -114,15 +110,11 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
114
110
|
params.emitter.emit("watch", {
|
|
115
111
|
type: "watch",
|
|
116
112
|
payload: {
|
|
117
|
-
currentStep: {
|
|
118
|
-
id: entry.step.id,
|
|
119
|
-
...lastOutput
|
|
120
|
-
},
|
|
121
113
|
workflowState: {
|
|
122
|
-
status: "
|
|
114
|
+
status: "failed",
|
|
123
115
|
steps: stepResults,
|
|
124
116
|
result: null,
|
|
125
|
-
error:
|
|
117
|
+
error: e
|
|
126
118
|
}
|
|
127
119
|
},
|
|
128
120
|
eventTimestamp: Date.now()
|
|
@@ -134,7 +126,6 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
134
126
|
params.emitter.emit("watch", {
|
|
135
127
|
type: "watch",
|
|
136
128
|
payload: {
|
|
137
|
-
currentStep: null,
|
|
138
129
|
workflowState: {
|
|
139
130
|
status: lastOutput.status,
|
|
140
131
|
steps: stepResults,
|
|
@@ -659,12 +650,25 @@ function cloneStep(step, opts) {
|
|
|
659
650
|
function createWorkflow(params) {
|
|
660
651
|
return new NewWorkflow(params);
|
|
661
652
|
}
|
|
653
|
+
function cloneWorkflow(workflow, opts) {
|
|
654
|
+
const wf = new NewWorkflow({
|
|
655
|
+
id: opts.id,
|
|
656
|
+
inputSchema: workflow.inputSchema,
|
|
657
|
+
outputSchema: workflow.outputSchema,
|
|
658
|
+
steps: workflow.stepDefs,
|
|
659
|
+
mastra: workflow.mastra
|
|
660
|
+
});
|
|
661
|
+
wf.setStepFlow(workflow.stepGraph);
|
|
662
|
+
wf.commit();
|
|
663
|
+
return wf;
|
|
664
|
+
}
|
|
662
665
|
var NewWorkflow = class extends chunkD63P5O4Q_cjs.MastraBase {
|
|
663
666
|
id;
|
|
664
667
|
description;
|
|
665
668
|
inputSchema;
|
|
666
669
|
outputSchema;
|
|
667
670
|
steps;
|
|
671
|
+
stepDefs;
|
|
668
672
|
stepFlow;
|
|
669
673
|
executionEngine;
|
|
670
674
|
executionGraph;
|
|
@@ -678,7 +682,8 @@ var NewWorkflow = class extends chunkD63P5O4Q_cjs.MastraBase {
|
|
|
678
682
|
outputSchema,
|
|
679
683
|
description,
|
|
680
684
|
executionEngine,
|
|
681
|
-
retryConfig
|
|
685
|
+
retryConfig,
|
|
686
|
+
steps
|
|
682
687
|
}) {
|
|
683
688
|
super({ name: id, component: chunkO7IW545H_cjs.RegisteredLogger.WORKFLOW });
|
|
684
689
|
this.id = id;
|
|
@@ -690,6 +695,7 @@ var NewWorkflow = class extends chunkD63P5O4Q_cjs.MastraBase {
|
|
|
690
695
|
this.stepFlow = [];
|
|
691
696
|
this.#mastra = mastra;
|
|
692
697
|
this.steps = {};
|
|
698
|
+
this.stepDefs = steps;
|
|
693
699
|
if (!executionEngine) {
|
|
694
700
|
this.executionEngine = new DefaultExecutionEngine({ mastra: this.#mastra });
|
|
695
701
|
} else {
|
|
@@ -697,6 +703,9 @@ var NewWorkflow = class extends chunkD63P5O4Q_cjs.MastraBase {
|
|
|
697
703
|
}
|
|
698
704
|
this.#runs = /* @__PURE__ */ new Map();
|
|
699
705
|
}
|
|
706
|
+
get mastra() {
|
|
707
|
+
return this.#mastra;
|
|
708
|
+
}
|
|
700
709
|
__registerMastra(mastra) {
|
|
701
710
|
this.#mastra = mastra;
|
|
702
711
|
this.executionEngine.__registerMastra(mastra);
|
|
@@ -709,6 +718,9 @@ var NewWorkflow = class extends chunkD63P5O4Q_cjs.MastraBase {
|
|
|
709
718
|
this.__setLogger(p.logger);
|
|
710
719
|
}
|
|
711
720
|
}
|
|
721
|
+
setStepFlow(stepFlow) {
|
|
722
|
+
this.stepFlow = stepFlow;
|
|
723
|
+
}
|
|
712
724
|
/**
|
|
713
725
|
* Adds a step to the workflow
|
|
714
726
|
* @param step The step to add to the workflow
|
|
@@ -953,16 +965,17 @@ var Run = class {
|
|
|
953
965
|
return result;
|
|
954
966
|
}
|
|
955
967
|
watch(cb) {
|
|
956
|
-
|
|
957
|
-
this.updateState(payload);
|
|
958
|
-
cb({ type, payload: this.getState(), eventTimestamp });
|
|
959
|
-
}
|
|
960
|
-
this.emitter.on("
|
|
968
|
+
const watchCb = (event) => {
|
|
969
|
+
this.updateState(event.payload);
|
|
970
|
+
cb({ type: event.type, payload: this.getState(), eventTimestamp: event.eventTimestamp });
|
|
971
|
+
};
|
|
972
|
+
this.emitter.on("watch", watchCb);
|
|
973
|
+
const nestedWatchCb = ({ event, workflowId }) => {
|
|
961
974
|
try {
|
|
962
975
|
const { type, payload, eventTimestamp } = event;
|
|
963
976
|
const prefixedSteps = Object.fromEntries(
|
|
964
977
|
Object.entries(payload?.workflowState?.steps ?? {}).map(([stepId, step]) => [
|
|
965
|
-
`${workflowId}.${stepId}`,
|
|
978
|
+
`${this.workflowId}.${stepId}`,
|
|
966
979
|
step
|
|
967
980
|
])
|
|
968
981
|
);
|
|
@@ -972,7 +985,6 @@ var Run = class {
|
|
|
972
985
|
id: `${workflowId}.${payload?.currentStep?.id}`
|
|
973
986
|
},
|
|
974
987
|
workflowState: {
|
|
975
|
-
...payload?.workflowState,
|
|
976
988
|
steps: prefixedSteps
|
|
977
989
|
}
|
|
978
990
|
};
|
|
@@ -981,9 +993,11 @@ var Run = class {
|
|
|
981
993
|
} catch (e) {
|
|
982
994
|
console.error(e);
|
|
983
995
|
}
|
|
984
|
-
}
|
|
996
|
+
};
|
|
997
|
+
this.emitter.on("nested-watch", nestedWatchCb);
|
|
985
998
|
return () => {
|
|
986
|
-
this.emitter.off("watch",
|
|
999
|
+
this.emitter.off("watch", watchCb);
|
|
1000
|
+
this.emitter.off("nested-watch", nestedWatchCb);
|
|
987
1001
|
};
|
|
988
1002
|
}
|
|
989
1003
|
async resume(params) {
|
|
@@ -1020,6 +1034,8 @@ var Run = class {
|
|
|
1020
1034
|
updateState(state) {
|
|
1021
1035
|
if (state.currentStep) {
|
|
1022
1036
|
this.state.currentStep = state.currentStep;
|
|
1037
|
+
} else if (state.workflowState?.status !== "running") {
|
|
1038
|
+
delete this.state.currentStep;
|
|
1023
1039
|
}
|
|
1024
1040
|
if (state.workflowState) {
|
|
1025
1041
|
this.state.workflowState = deepMerge(this.state.workflowState ?? {}, state.workflowState ?? {});
|
|
@@ -1054,5 +1070,6 @@ exports.ExecutionEngine = ExecutionEngine;
|
|
|
1054
1070
|
exports.NewWorkflow = NewWorkflow;
|
|
1055
1071
|
exports.Run = Run;
|
|
1056
1072
|
exports.cloneStep = cloneStep;
|
|
1073
|
+
exports.cloneWorkflow = cloneWorkflow;
|
|
1057
1074
|
exports.createStep = createStep;
|
|
1058
1075
|
exports.createWorkflow = createWorkflow;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as ExecutionEngine, j as ExecutionGraph, k as StepResult, l as StepFlowEntry, N as NewStep, m as ExecuteFunction } from '../../base-
|
|
2
|
-
export {
|
|
1
|
+
import { i as ExecutionEngine, j as ExecutionGraph, k as StepResult, l as StepFlowEntry, N as NewStep, m as ExecuteFunction } from '../../base-mr-hn8v_.cjs';
|
|
2
|
+
export { z as ExtractSchemaFromStep, y as ExtractSchemaType, t as NewWorkflow, s as NewWorkflowConfig, P as PathsToStringProps, R as Run, v as StepFailure, u as StepSuccess, w as StepSuspended, x as StepsRecord, B as VariableReference, D as WatchEvent, r as WorkflowResult, Z as ZodPathType, o as cloneStep, q as cloneWorkflow, n as createStep, p as createWorkflow } from '../../base-mr-hn8v_.cjs';
|
|
3
3
|
import EventEmitter from 'events';
|
|
4
4
|
import { RuntimeContext } from '../../runtime-context/index.cjs';
|
|
5
5
|
import 'ai';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as ExecutionEngine, j as ExecutionGraph, k as StepResult, l as StepFlowEntry, N as NewStep, m as ExecuteFunction } from '../../base-
|
|
2
|
-
export {
|
|
1
|
+
import { i as ExecutionEngine, j as ExecutionGraph, k as StepResult, l as StepFlowEntry, N as NewStep, m as ExecuteFunction } from '../../base-CuXWXbrh.js';
|
|
2
|
+
export { z as ExtractSchemaFromStep, y as ExtractSchemaType, t as NewWorkflow, s as NewWorkflowConfig, P as PathsToStringProps, R as Run, v as StepFailure, u as StepSuccess, w as StepSuspended, x as StepsRecord, B as VariableReference, D as WatchEvent, r as WorkflowResult, Z as ZodPathType, o as cloneStep, q as cloneWorkflow, n as createStep, p as createWorkflow } from '../../base-CuXWXbrh.js';
|
|
3
3
|
import EventEmitter from 'events';
|
|
4
4
|
import { RuntimeContext } from '../../runtime-context/index.js';
|
|
5
5
|
import 'ai';
|
|
@@ -86,10 +86,6 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
86
86
|
params.emitter.emit("watch", {
|
|
87
87
|
type: "watch",
|
|
88
88
|
payload: {
|
|
89
|
-
currentStep: {
|
|
90
|
-
id: entry.step.id,
|
|
91
|
-
...lastOutput
|
|
92
|
-
},
|
|
93
89
|
workflowState: {
|
|
94
90
|
status: lastOutput.status,
|
|
95
91
|
steps: stepResults,
|
|
@@ -108,15 +104,11 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
108
104
|
params.emitter.emit("watch", {
|
|
109
105
|
type: "watch",
|
|
110
106
|
payload: {
|
|
111
|
-
currentStep: {
|
|
112
|
-
id: entry.step.id,
|
|
113
|
-
...lastOutput
|
|
114
|
-
},
|
|
115
107
|
workflowState: {
|
|
116
|
-
status: "
|
|
108
|
+
status: "failed",
|
|
117
109
|
steps: stepResults,
|
|
118
110
|
result: null,
|
|
119
|
-
error:
|
|
111
|
+
error: e
|
|
120
112
|
}
|
|
121
113
|
},
|
|
122
114
|
eventTimestamp: Date.now()
|
|
@@ -128,7 +120,6 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
128
120
|
params.emitter.emit("watch", {
|
|
129
121
|
type: "watch",
|
|
130
122
|
payload: {
|
|
131
|
-
currentStep: null,
|
|
132
123
|
workflowState: {
|
|
133
124
|
status: lastOutput.status,
|
|
134
125
|
steps: stepResults,
|
|
@@ -653,12 +644,25 @@ function cloneStep(step, opts) {
|
|
|
653
644
|
function createWorkflow(params) {
|
|
654
645
|
return new NewWorkflow(params);
|
|
655
646
|
}
|
|
647
|
+
function cloneWorkflow(workflow, opts) {
|
|
648
|
+
const wf = new NewWorkflow({
|
|
649
|
+
id: opts.id,
|
|
650
|
+
inputSchema: workflow.inputSchema,
|
|
651
|
+
outputSchema: workflow.outputSchema,
|
|
652
|
+
steps: workflow.stepDefs,
|
|
653
|
+
mastra: workflow.mastra
|
|
654
|
+
});
|
|
655
|
+
wf.setStepFlow(workflow.stepGraph);
|
|
656
|
+
wf.commit();
|
|
657
|
+
return wf;
|
|
658
|
+
}
|
|
656
659
|
var NewWorkflow = class extends MastraBase {
|
|
657
660
|
id;
|
|
658
661
|
description;
|
|
659
662
|
inputSchema;
|
|
660
663
|
outputSchema;
|
|
661
664
|
steps;
|
|
665
|
+
stepDefs;
|
|
662
666
|
stepFlow;
|
|
663
667
|
executionEngine;
|
|
664
668
|
executionGraph;
|
|
@@ -672,7 +676,8 @@ var NewWorkflow = class extends MastraBase {
|
|
|
672
676
|
outputSchema,
|
|
673
677
|
description,
|
|
674
678
|
executionEngine,
|
|
675
|
-
retryConfig
|
|
679
|
+
retryConfig,
|
|
680
|
+
steps
|
|
676
681
|
}) {
|
|
677
682
|
super({ name: id, component: RegisteredLogger.WORKFLOW });
|
|
678
683
|
this.id = id;
|
|
@@ -684,6 +689,7 @@ var NewWorkflow = class extends MastraBase {
|
|
|
684
689
|
this.stepFlow = [];
|
|
685
690
|
this.#mastra = mastra;
|
|
686
691
|
this.steps = {};
|
|
692
|
+
this.stepDefs = steps;
|
|
687
693
|
if (!executionEngine) {
|
|
688
694
|
this.executionEngine = new DefaultExecutionEngine({ mastra: this.#mastra });
|
|
689
695
|
} else {
|
|
@@ -691,6 +697,9 @@ var NewWorkflow = class extends MastraBase {
|
|
|
691
697
|
}
|
|
692
698
|
this.#runs = /* @__PURE__ */ new Map();
|
|
693
699
|
}
|
|
700
|
+
get mastra() {
|
|
701
|
+
return this.#mastra;
|
|
702
|
+
}
|
|
694
703
|
__registerMastra(mastra) {
|
|
695
704
|
this.#mastra = mastra;
|
|
696
705
|
this.executionEngine.__registerMastra(mastra);
|
|
@@ -703,6 +712,9 @@ var NewWorkflow = class extends MastraBase {
|
|
|
703
712
|
this.__setLogger(p.logger);
|
|
704
713
|
}
|
|
705
714
|
}
|
|
715
|
+
setStepFlow(stepFlow) {
|
|
716
|
+
this.stepFlow = stepFlow;
|
|
717
|
+
}
|
|
706
718
|
/**
|
|
707
719
|
* Adds a step to the workflow
|
|
708
720
|
* @param step The step to add to the workflow
|
|
@@ -947,16 +959,17 @@ var Run = class {
|
|
|
947
959
|
return result;
|
|
948
960
|
}
|
|
949
961
|
watch(cb) {
|
|
950
|
-
|
|
951
|
-
this.updateState(payload);
|
|
952
|
-
cb({ type, payload: this.getState(), eventTimestamp });
|
|
953
|
-
}
|
|
954
|
-
this.emitter.on("
|
|
962
|
+
const watchCb = (event) => {
|
|
963
|
+
this.updateState(event.payload);
|
|
964
|
+
cb({ type: event.type, payload: this.getState(), eventTimestamp: event.eventTimestamp });
|
|
965
|
+
};
|
|
966
|
+
this.emitter.on("watch", watchCb);
|
|
967
|
+
const nestedWatchCb = ({ event, workflowId }) => {
|
|
955
968
|
try {
|
|
956
969
|
const { type, payload, eventTimestamp } = event;
|
|
957
970
|
const prefixedSteps = Object.fromEntries(
|
|
958
971
|
Object.entries(payload?.workflowState?.steps ?? {}).map(([stepId, step]) => [
|
|
959
|
-
`${workflowId}.${stepId}`,
|
|
972
|
+
`${this.workflowId}.${stepId}`,
|
|
960
973
|
step
|
|
961
974
|
])
|
|
962
975
|
);
|
|
@@ -966,7 +979,6 @@ var Run = class {
|
|
|
966
979
|
id: `${workflowId}.${payload?.currentStep?.id}`
|
|
967
980
|
},
|
|
968
981
|
workflowState: {
|
|
969
|
-
...payload?.workflowState,
|
|
970
982
|
steps: prefixedSteps
|
|
971
983
|
}
|
|
972
984
|
};
|
|
@@ -975,9 +987,11 @@ var Run = class {
|
|
|
975
987
|
} catch (e) {
|
|
976
988
|
console.error(e);
|
|
977
989
|
}
|
|
978
|
-
}
|
|
990
|
+
};
|
|
991
|
+
this.emitter.on("nested-watch", nestedWatchCb);
|
|
979
992
|
return () => {
|
|
980
|
-
this.emitter.off("watch",
|
|
993
|
+
this.emitter.off("watch", watchCb);
|
|
994
|
+
this.emitter.off("nested-watch", nestedWatchCb);
|
|
981
995
|
};
|
|
982
996
|
}
|
|
983
997
|
async resume(params) {
|
|
@@ -1014,6 +1028,8 @@ var Run = class {
|
|
|
1014
1028
|
updateState(state) {
|
|
1015
1029
|
if (state.currentStep) {
|
|
1016
1030
|
this.state.currentStep = state.currentStep;
|
|
1031
|
+
} else if (state.workflowState?.status !== "running") {
|
|
1032
|
+
delete this.state.currentStep;
|
|
1017
1033
|
}
|
|
1018
1034
|
if (state.workflowState) {
|
|
1019
1035
|
this.state.workflowState = deepMerge(this.state.workflowState ?? {}, state.workflowState ?? {});
|
|
@@ -1043,4 +1059,4 @@ function deepMerge(a, b) {
|
|
|
1043
1059
|
return result;
|
|
1044
1060
|
}
|
|
1045
1061
|
|
|
1046
|
-
export { DefaultExecutionEngine, ExecutionEngine, NewWorkflow, Run, cloneStep, createStep, createWorkflow };
|
|
1062
|
+
export { DefaultExecutionEngine, ExecutionEngine, NewWorkflow, Run, cloneStep, cloneWorkflow, createStep, createWorkflow };
|