@mastra/core 0.10.4 → 0.10.5
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 +4 -4
- package/dist/agent/index.d.cts +1 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +2 -2
- package/dist/{base-icHjkcs-.d.ts → base-CmIdgTSq.d.ts} +37 -31
- package/dist/{base-Bdc5hWla.d.cts → base-_mZ6e_qo.d.cts} +37 -31
- package/dist/chunk-2RZXEVWT.js +68 -0
- package/dist/{chunk-UFQERGWG.js → chunk-32XBQVNY.js} +117 -28
- package/dist/{chunk-TRJIWZKM.js → chunk-3SY7GRSA.js} +1 -1
- package/dist/{chunk-PUG7THT5.cjs → chunk-6EMFDXAQ.cjs} +4 -4
- package/dist/{chunk-36UICULV.js → chunk-6PQRSQZF.js} +35 -5
- package/dist/{chunk-VB4S54R3.cjs → chunk-7L56W43N.cjs} +118 -29
- package/dist/{chunk-62ZSDIUK.js → chunk-BMED2N3R.js} +1 -1
- package/dist/{chunk-I2KL5KMY.js → chunk-CMEK3A3W.js} +2 -2
- package/dist/{chunk-HGPLTKJA.cjs → chunk-D2ULEJL3.cjs} +2 -2
- package/dist/{chunk-AX6IHSGY.js → chunk-DPKEVI6Q.js} +1 -1
- package/dist/{chunk-ZKUUYDOQ.cjs → chunk-EFJIVMMM.cjs} +21 -21
- package/dist/{chunk-SI2ENZ3O.js → chunk-F2DBWJK3.js} +1 -1
- package/dist/{chunk-Z37B4W7B.js → chunk-HIQ3FPBN.js} +1 -1
- package/dist/{chunk-RO5VPM3P.cjs → chunk-HVI3SKIH.cjs} +278 -55
- package/dist/{chunk-GV6P24NY.cjs → chunk-ISRXIKDS.cjs} +4 -4
- package/dist/{chunk-QVROTSA5.cjs → chunk-J7MLMW6O.cjs} +2 -2
- package/dist/{chunk-PVGSY24V.js → chunk-LDNCERLU.js} +7 -0
- package/dist/{chunk-S6WRT7GI.cjs → chunk-LRMKKZ6M.cjs} +2 -2
- package/dist/{chunk-BBAQW23O.cjs → chunk-OLSQRA2V.cjs} +7 -0
- package/dist/chunk-Q65UGFQK.cjs +70 -0
- package/dist/{chunk-ZAXPU6F2.cjs → chunk-QQ3KHYKE.cjs} +35 -5
- package/dist/{chunk-ZWYZGIV3.cjs → chunk-QQT4XTOG.cjs} +279 -73
- package/dist/{chunk-XUODQRSL.cjs → chunk-TGK6JO2D.cjs} +3 -3
- package/dist/{chunk-JYLH5IY3.cjs → chunk-VRDDTY4O.cjs} +87 -16
- package/dist/{chunk-SWJKOFCU.js → chunk-VZDPK54I.js} +262 -56
- package/dist/{chunk-HFEELWJO.js → chunk-YDGX5LRI.js} +274 -51
- package/dist/{chunk-7UNDRBOU.js → chunk-YLCFUSJ4.js} +86 -15
- package/dist/{chunk-IZGRJXUQ.js → chunk-Z7SBZ7XB.js} +1 -1
- package/dist/error/index.cjs +5 -5
- package/dist/error/index.d.cts +7 -0
- package/dist/error/index.d.ts +7 -0
- package/dist/error/index.js +1 -1
- package/dist/eval/index.d.cts +1 -1
- package/dist/eval/index.d.ts +1 -1
- package/dist/index.cjs +48 -48
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -12
- 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.cjs +2 -2
- package/dist/mastra/index.d.cts +1 -1
- package/dist/mastra/index.d.ts +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/mcp/index.d.cts +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.d.cts +1 -1
- package/dist/memory/index.d.ts +1 -1
- package/dist/memory/index.js +1 -1
- package/dist/network/index.cjs +11 -5
- package/dist/network/index.d.cts +1 -1
- package/dist/network/index.d.ts +1 -1
- package/dist/network/index.js +10 -4
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.d.cts +1 -1
- package/dist/relevance/index.d.ts +1 -1
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.cjs +9 -3
- package/dist/server/index.d.cts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +8 -2
- package/dist/storage/index.cjs +12 -12
- package/dist/storage/index.d.cts +2 -2
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.js +4 -4
- package/dist/telemetry/index.cjs +7 -7
- package/dist/telemetry/index.d.cts +1 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/tools/index.d.cts +2 -2
- package/dist/tools/index.d.ts +2 -2
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.js +1 -1
- package/dist/utils.cjs +14 -14
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.js +1 -1
- package/dist/voice/index.cjs +4 -4
- package/dist/voice/index.d.cts +1 -1
- package/dist/voice/index.d.ts +1 -1
- package/dist/voice/index.js +1 -1
- package/dist/workflows/index.cjs +9 -9
- package/dist/workflows/index.d.cts +14 -7
- package/dist/workflows/index.d.ts +14 -7
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/legacy/index.cjs +22 -22
- package/dist/workflows/legacy/index.d.cts +2 -2
- package/dist/workflows/legacy/index.d.ts +2 -2
- package/dist/workflows/legacy/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-IM7CLVLZ.js +0 -43
- package/dist/chunk-LEK3J7YN.cjs +0 -45
package/dist/agent/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkQQT4XTOG_cjs = require('../chunk-QQT4XTOG.cjs');
|
|
4
|
+
var chunkTGK6JO2D_cjs = require('../chunk-TGK6JO2D.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "Agent", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkQQT4XTOG_cjs.Agent; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "MessageList", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkTGK6JO2D_cjs.MessageList; }
|
|
15
15
|
});
|
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 { A as Agent,
|
|
4
|
+
export { A as Agent, at as AgentConfig, bV as AgentGenerateOptions, bW as AgentStreamOptions, bU as DynamicArgument, bs as MastraLanguageModel, bX as MastraMessageContentV2, s as MastraMessageV2, bS as MessageList, T as ToolsInput, bT as ToolsetsInput } from '../base-_mZ6e_qo.cjs';
|
|
5
5
|
import '../base-DVVTzIQy.cjs';
|
|
6
6
|
import '../types-Bo1uigWx.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 { A as Agent,
|
|
4
|
+
export { A as Agent, at as AgentConfig, bV as AgentGenerateOptions, bW as AgentStreamOptions, bU as DynamicArgument, bs as MastraLanguageModel, bX as MastraMessageContentV2, s as MastraMessageV2, bS as MessageList, T as ToolsInput, bT as ToolsetsInput } from '../base-CmIdgTSq.js';
|
|
5
5
|
import '../base-BbdvunNJ.js';
|
|
6
6
|
import '../types-Bo1uigWx.js';
|
|
7
7
|
import '../runtime-context/index.js';
|
package/dist/agent/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Agent } from '../chunk-
|
|
2
|
-
export { MessageList } from '../chunk-
|
|
1
|
+
export { Agent } from '../chunk-VZDPK54I.js';
|
|
2
|
+
export { MessageList } from '../chunk-DPKEVI6Q.js';
|
|
@@ -1040,7 +1040,7 @@ declare class LegacyWorkflow<TSteps extends LegacyStep<string, any, any>[] = Leg
|
|
|
1040
1040
|
toStep(): LegacyStep<TStepId, TTriggerSchema, z.ZodType<LegacyWorkflowRunResult<TTriggerSchema, TSteps, TResultSchema>>, any>;
|
|
1041
1041
|
}
|
|
1042
1042
|
|
|
1043
|
-
type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema> = (params: {
|
|
1043
|
+
type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, EngineType> = (params: {
|
|
1044
1044
|
runId: string;
|
|
1045
1045
|
mastra: Mastra;
|
|
1046
1046
|
runtimeContext: RuntimeContext;
|
|
@@ -1057,15 +1057,16 @@ type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema> = (
|
|
|
1057
1057
|
[EMITTER_SYMBOL]: {
|
|
1058
1058
|
emit: (event: string, data: any) => Promise<void>;
|
|
1059
1059
|
};
|
|
1060
|
+
engine: EngineType;
|
|
1060
1061
|
}) => Promise<TStepOutput>;
|
|
1061
|
-
interface Step<TStepId extends string = string, TSchemaIn extends z.ZodType<any> = z.ZodType<any>, TSchemaOut extends z.ZodType<any> = z.ZodType<any>, TResumeSchema extends z.ZodType<any> = z.ZodType<any>, TSuspendSchema extends z.ZodType<any> = z.ZodType<any
|
|
1062
|
+
interface Step<TStepId extends string = string, TSchemaIn extends z.ZodType<any> = z.ZodType<any>, TSchemaOut extends z.ZodType<any> = z.ZodType<any>, TResumeSchema extends z.ZodType<any> = z.ZodType<any>, TSuspendSchema extends z.ZodType<any> = z.ZodType<any>, TEngineType = any> {
|
|
1062
1063
|
id: TStepId;
|
|
1063
1064
|
description?: string;
|
|
1064
1065
|
inputSchema: TSchemaIn;
|
|
1065
1066
|
outputSchema: TSchemaOut;
|
|
1066
1067
|
resumeSchema?: TResumeSchema;
|
|
1067
1068
|
suspendSchema?: TSuspendSchema;
|
|
1068
|
-
execute: ExecuteFunction<z.infer<TSchemaIn>, z.infer<TSchemaOut>, z.infer<TResumeSchema>, z.infer<TSuspendSchema
|
|
1069
|
+
execute: ExecuteFunction<z.infer<TSchemaIn>, z.infer<TSchemaOut>, z.infer<TResumeSchema>, z.infer<TSuspendSchema>, TEngineType>;
|
|
1069
1070
|
retries?: number;
|
|
1070
1071
|
}
|
|
1071
1072
|
|
|
@@ -1114,7 +1115,7 @@ type StepsRecord<T extends readonly Step<any, any, any>[]> = {
|
|
|
1114
1115
|
}>;
|
|
1115
1116
|
};
|
|
1116
1117
|
type DynamicMapping<TPrevSchema extends z.ZodTypeAny, TSchemaOut extends z.ZodTypeAny> = {
|
|
1117
|
-
fn: ExecuteFunction<z.infer<TPrevSchema>, z.infer<TSchemaOut>, any, any>;
|
|
1118
|
+
fn: ExecuteFunction<z.infer<TPrevSchema>, z.infer<TSchemaOut>, any, any, any>;
|
|
1118
1119
|
schema: TSchemaOut;
|
|
1119
1120
|
};
|
|
1120
1121
|
type PathsToStringProps<T> = T extends object ? {
|
|
@@ -1158,7 +1159,7 @@ type WatchEvent = {
|
|
|
1158
1159
|
suspendedAt?: number;
|
|
1159
1160
|
resumedAt?: number;
|
|
1160
1161
|
}>;
|
|
1161
|
-
|
|
1162
|
+
result?: Record<string, any>;
|
|
1162
1163
|
payload?: Record<string, any>;
|
|
1163
1164
|
error?: string | Error;
|
|
1164
1165
|
};
|
|
@@ -1168,6 +1169,9 @@ type WatchEvent = {
|
|
|
1168
1169
|
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;
|
|
1169
1170
|
interface WorkflowRunState {
|
|
1170
1171
|
runId: string;
|
|
1172
|
+
status: 'success' | 'failed' | 'suspended' | 'running';
|
|
1173
|
+
result?: Record<string, any>;
|
|
1174
|
+
error?: string | Error;
|
|
1171
1175
|
value: Record<string, string>;
|
|
1172
1176
|
context: {
|
|
1173
1177
|
input?: Record<string, any>;
|
|
@@ -1224,7 +1228,8 @@ declare abstract class ExecutionEngine extends MastraBase {
|
|
|
1224
1228
|
}): Promise<TOutput>;
|
|
1225
1229
|
}
|
|
1226
1230
|
|
|
1227
|
-
type
|
|
1231
|
+
type DefaultEngineType = {};
|
|
1232
|
+
type StepFlowEntry<TEngineType = DefaultEngineType> = {
|
|
1228
1233
|
type: 'step';
|
|
1229
1234
|
step: Step;
|
|
1230
1235
|
} | {
|
|
@@ -1233,7 +1238,7 @@ type StepFlowEntry = {
|
|
|
1233
1238
|
} | {
|
|
1234
1239
|
type: 'conditional';
|
|
1235
1240
|
steps: StepFlowEntry[];
|
|
1236
|
-
conditions: ExecuteFunction<any, any, any, any>[];
|
|
1241
|
+
conditions: ExecuteFunction<any, any, any, any, TEngineType>[];
|
|
1237
1242
|
serializedConditions: {
|
|
1238
1243
|
id: string;
|
|
1239
1244
|
fn: string;
|
|
@@ -1241,7 +1246,7 @@ type StepFlowEntry = {
|
|
|
1241
1246
|
} | {
|
|
1242
1247
|
type: 'loop';
|
|
1243
1248
|
step: Step;
|
|
1244
|
-
condition: ExecuteFunction<any, any, any, any>;
|
|
1249
|
+
condition: ExecuteFunction<any, any, any, any, any>;
|
|
1245
1250
|
serializedCondition: {
|
|
1246
1251
|
id: string;
|
|
1247
1252
|
fn: string;
|
|
@@ -1254,7 +1259,7 @@ type StepFlowEntry = {
|
|
|
1254
1259
|
concurrency: number;
|
|
1255
1260
|
};
|
|
1256
1261
|
};
|
|
1257
|
-
type SerializedStep = Pick<Step, 'id' | 'description'> & {
|
|
1262
|
+
type SerializedStep<TEngineType = DefaultEngineType> = Pick<Step<any, any, any, any, any, TEngineType>, 'id' | 'description'> & {
|
|
1258
1263
|
component?: string;
|
|
1259
1264
|
serializedStepFlow?: SerializedStepFlowEntry[];
|
|
1260
1265
|
mapConfig?: string;
|
|
@@ -1297,32 +1302,32 @@ type SerializedStepFlowEntry = {
|
|
|
1297
1302
|
* @param params.execute Function that performs the step's operations
|
|
1298
1303
|
* @returns A Step object that can be added to the workflow
|
|
1299
1304
|
*/
|
|
1300
|
-
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
|
|
1305
|
+
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>, TEngineType = DefaultEngineType>(params: {
|
|
1301
1306
|
id: TStepId;
|
|
1302
1307
|
description?: string;
|
|
1303
1308
|
inputSchema: TStepInput;
|
|
1304
1309
|
outputSchema: TStepOutput;
|
|
1305
1310
|
resumeSchema?: TResumeSchema;
|
|
1306
1311
|
suspendSchema?: TSuspendSchema;
|
|
1307
|
-
execute: ExecuteFunction<z.infer<TStepInput>, z.infer<TStepOutput>, z.infer<TResumeSchema>, z.infer<TSuspendSchema
|
|
1308
|
-
}): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema>;
|
|
1312
|
+
execute: ExecuteFunction<z.infer<TStepInput>, z.infer<TStepOutput>, z.infer<TResumeSchema>, z.infer<TSuspendSchema>, TEngineType>;
|
|
1313
|
+
}): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, TEngineType>;
|
|
1309
1314
|
declare function createStep<TStepId extends string, TStepInput extends z.ZodObject<{
|
|
1310
1315
|
prompt: z.ZodString;
|
|
1311
1316
|
}>, TStepOutput extends z.ZodObject<{
|
|
1312
1317
|
text: z.ZodString;
|
|
1313
|
-
}>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(agent: Agent<TStepId, any, any>): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema>;
|
|
1318
|
+
}>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(agent: Agent<TStepId, any, any>): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, DefaultEngineType>;
|
|
1314
1319
|
declare function createStep<TSchemaIn extends z.ZodType<any>, TSchemaOut extends z.ZodType<any>, TContext extends ToolExecutionContext<TSchemaIn>>(tool: Tool<TSchemaIn, TSchemaOut, TContext> & {
|
|
1315
1320
|
inputSchema: TSchemaIn;
|
|
1316
1321
|
outputSchema: TSchemaOut;
|
|
1317
1322
|
execute: (context: TContext) => Promise<any>;
|
|
1318
|
-
}): Step<string, TSchemaIn, TSchemaOut, z.ZodType<any>, z.ZodType<any
|
|
1323
|
+
}): Step<string, TSchemaIn, TSchemaOut, z.ZodType<any>, z.ZodType<any>, DefaultEngineType>;
|
|
1319
1324
|
declare function cloneStep<TStepId extends string>(step: Step<string, any, any>, opts: {
|
|
1320
1325
|
id: TStepId;
|
|
1321
1326
|
}): Step<TStepId, any, any>;
|
|
1322
|
-
declare function createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TInput>;
|
|
1323
|
-
declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[]>(workflow: Workflow<TSteps, string, TInput, TOutput>, opts: {
|
|
1327
|
+
declare function createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TEngineType = DefaultEngineType, TSteps extends Step<string, any, any, any, any, TEngineType>[] = Step<string, any, any, any, any, TEngineType>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): Workflow<TSteps, TWorkflowId, TInput, TOutput, DefaultEngineType, TInput>;
|
|
1328
|
+
declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends Step<string, any, any, any, any, DefaultEngineType>[] = Step<string, any, any, any, any, DefaultEngineType>[]>(workflow: Workflow<TSteps, string, TInput, TOutput, DefaultEngineType>, opts: {
|
|
1324
1329
|
id: TWorkflowId;
|
|
1325
|
-
}): Workflow<TSteps, TWorkflowId, TInput, TOutput>;
|
|
1330
|
+
}): Workflow<TSteps, TWorkflowId, TInput, TOutput, DefaultEngineType>;
|
|
1326
1331
|
type WorkflowResult<TOutput extends z.ZodType<any>, TSteps extends Step<string, any, any>[]> = {
|
|
1327
1332
|
status: 'success';
|
|
1328
1333
|
result: z.infer<TOutput>;
|
|
@@ -1355,7 +1360,7 @@ type WorkflowConfig<TWorkflowId extends string = string, TInput extends z.ZodTyp
|
|
|
1355
1360
|
delay?: number;
|
|
1356
1361
|
};
|
|
1357
1362
|
};
|
|
1358
|
-
declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[], TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TPrevSchema extends z.ZodType<any> = TInput> extends MastraBase implements Step<TWorkflowId, TInput, TOutput> {
|
|
1363
|
+
declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[], TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TEngineType = DefaultEngineType, TPrevSchema extends z.ZodType<any> = TInput> extends MastraBase implements Step<TWorkflowId, TInput, TOutput, any, any, TEngineType> {
|
|
1359
1364
|
#private;
|
|
1360
1365
|
id: TWorkflowId;
|
|
1361
1366
|
description?: string | undefined;
|
|
@@ -1373,7 +1378,7 @@ declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<
|
|
|
1373
1378
|
};
|
|
1374
1379
|
constructor({ mastra, id, inputSchema, outputSchema, description, executionEngine, retryConfig, steps, }: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>);
|
|
1375
1380
|
get runs(): Map<string, Run<TSteps, TInput, TOutput>>;
|
|
1376
|
-
get mastra(): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, LegacyWorkflow<LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, Workflow<Step<string, any, any, any, any>[], string, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>>, Record<string, MastraVector>, Record<string, MastraTTS>, IMastraLogger, Record<string, AgentNetwork>, Record<string, MCPServerBase>> | undefined;
|
|
1381
|
+
get mastra(): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, LegacyWorkflow<LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, Workflow<Step<string, any, any, any, any, any>[], string, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, DefaultEngineType, z.ZodType<any, z.ZodTypeDef, any>>>, Record<string, MastraVector>, Record<string, MastraTTS>, IMastraLogger, Record<string, AgentNetwork>, Record<string, MCPServerBase>> | undefined;
|
|
1377
1382
|
__registerMastra(mastra: Mastra): void;
|
|
1378
1383
|
__registerPrimitives(p: MastraPrimitives): void;
|
|
1379
1384
|
setStepFlow(stepFlow: StepFlowEntry[]): void;
|
|
@@ -1382,7 +1387,7 @@ declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<
|
|
|
1382
1387
|
* @param step The step to add to the workflow
|
|
1383
1388
|
* @returns The workflow instance for chaining
|
|
1384
1389
|
*/
|
|
1385
|
-
then<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
1390
|
+
then<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any, TEngineType>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TEngineType, TSchemaOut>;
|
|
1386
1391
|
map<TSteps extends Step<string, any, any>[], TMapping extends {
|
|
1387
1392
|
[K in keyof TMapping]: {
|
|
1388
1393
|
step: TSteps[number] | TSteps[number][];
|
|
@@ -1397,17 +1402,17 @@ declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<
|
|
|
1397
1402
|
runtimeContextPath: string;
|
|
1398
1403
|
schema: z.ZodTypeAny;
|
|
1399
1404
|
} | DynamicMapping<TPrevSchema, z.ZodTypeAny>;
|
|
1400
|
-
}>(mappingConfig: TMapping | ExecuteFunction<z.infer<TPrevSchema>, any, any, any>): Workflow<TSteps, TWorkflowId, TInput, TOutput,
|
|
1401
|
-
parallel<TParallelSteps extends Step<string, TPrevSchema, any, any, any>[]>(steps: TParallelSteps): Workflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodObject<{ [K in keyof StepsRecord<TParallelSteps>]: StepsRecord<TParallelSteps>[K]["outputSchema"]["path"]; }, any, z.ZodTypeAny>>;
|
|
1405
|
+
}>(mappingConfig: TMapping | ExecuteFunction<z.infer<TPrevSchema>, any, any, any, TEngineType>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TEngineType, TInput>;
|
|
1406
|
+
parallel<TParallelSteps extends Step<string, TPrevSchema, any, any, any, TEngineType>[]>(steps: TParallelSteps): Workflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodObject<{ [K in keyof StepsRecord<TParallelSteps>]: StepsRecord<TParallelSteps>[K]["outputSchema"]["path"]; }, any, z.ZodTypeAny>>;
|
|
1402
1407
|
branch<TBranchSteps extends Array<[
|
|
1403
|
-
ExecuteFunction<z.infer<TPrevSchema>, any, any, any>,
|
|
1404
|
-
Step<string, TPrevSchema, any, any, any>
|
|
1405
|
-
]>>(steps: TBranchSteps): Workflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodObject<{ [K in keyof StepsRecord<{ [K_1 in keyof TBranchSteps]: TBranchSteps[K_1][1]; }[number][]>]: StepsRecord<{ [K_1 in keyof TBranchSteps]: TBranchSteps[K_1][1]; }[number][]>[K]["outputSchema"]; }, any, z.ZodTypeAny>>;
|
|
1406
|
-
dowhile<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any>, condition: ExecuteFunction<z.infer<TSchemaOut>, any, any, any>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
1407
|
-
dountil<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any>, condition: ExecuteFunction<z.infer<TSchemaOut>, any, any, any>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
1408
|
-
foreach<TPrevIsArray extends TPrevSchema extends z.ZodArray<any> ? true : false, TStepInputSchema extends TPrevSchema extends z.ZodArray<infer TElement> ? TElement : never, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: TPrevIsArray extends true ? Step<TStepId, TStepInputSchema, TSchemaOut, any, any> : 'Previous step must return an array type', opts?: {
|
|
1408
|
+
ExecuteFunction<z.infer<TPrevSchema>, any, any, any, any>,
|
|
1409
|
+
Step<string, TPrevSchema, any, any, any, TEngineType>
|
|
1410
|
+
]>>(steps: TBranchSteps): Workflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodObject<{ [K in keyof StepsRecord<{ [K_1 in keyof TBranchSteps]: TBranchSteps[K_1][1]; }[number][]>]: StepsRecord<{ [K_1 in keyof TBranchSteps]: TBranchSteps[K_1][1]; }[number][]>[K]["outputSchema"]; }, any, z.ZodTypeAny, TEngineType>>;
|
|
1411
|
+
dowhile<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any, TEngineType>, condition: ExecuteFunction<z.infer<TSchemaOut>, any, any, any, TEngineType>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
1412
|
+
dountil<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any, TEngineType>, condition: ExecuteFunction<z.infer<TSchemaOut>, any, any, any, TEngineType>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
1413
|
+
foreach<TPrevIsArray extends TPrevSchema extends z.ZodArray<any> ? true : false, TStepInputSchema extends TPrevSchema extends z.ZodArray<infer TElement> ? TElement : never, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: TPrevIsArray extends true ? Step<TStepId, TStepInputSchema, TSchemaOut, any, any, TEngineType> : 'Previous step must return an array type', opts?: {
|
|
1409
1414
|
concurrency: number;
|
|
1410
|
-
}): Workflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodArray<TSchemaOut>>;
|
|
1415
|
+
}): Workflow<TSteps, TWorkflowId, TInput, TOutput, TEngineType, z.ZodArray<TSchemaOut>>;
|
|
1411
1416
|
/**
|
|
1412
1417
|
* Builds the execution graph for this workflow
|
|
1413
1418
|
* @returns The execution graph that can be used to execute the workflow
|
|
@@ -1419,7 +1424,7 @@ declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<
|
|
|
1419
1424
|
* @returns A built workflow instance ready for execution
|
|
1420
1425
|
*/
|
|
1421
1426
|
commit(): Workflow<TSteps, TWorkflowId, TInput, TOutput, TOutput>;
|
|
1422
|
-
get stepGraph(): StepFlowEntry[];
|
|
1427
|
+
get stepGraph(): StepFlowEntry<DefaultEngineType>[];
|
|
1423
1428
|
get serializedStepGraph(): SerializedStepFlowEntry[];
|
|
1424
1429
|
/**
|
|
1425
1430
|
* Creates a new workflow run instance
|
|
@@ -1444,6 +1449,7 @@ declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<
|
|
|
1444
1449
|
};
|
|
1445
1450
|
mastra: Mastra;
|
|
1446
1451
|
runtimeContext?: RuntimeContext;
|
|
1452
|
+
engine: TEngineType;
|
|
1447
1453
|
}): Promise<z.infer<TOutput>>;
|
|
1448
1454
|
getWorkflowRuns(args?: {
|
|
1449
1455
|
fromDate?: Date;
|
|
@@ -3521,4 +3527,4 @@ declare abstract class MastraStorage extends MastraBase {
|
|
|
3521
3527
|
}>;
|
|
3522
3528
|
}
|
|
3523
3529
|
|
|
3524
|
-
export { type
|
|
3530
|
+
export { type BaseCondition as $, Agent as A, type StorageGetTracesArg as B, type CoreTool as C, type DefaultEngineType as D, type EvalRow as E, TABLE_WORKFLOW_SNAPSHOT as F, TABLE_EVALS as G, TABLE_MESSAGES as H, TABLE_THREADS as I, TABLE_TRACES as J, TABLE_SCHEMAS as K, LegacyWorkflow as L, Mastra as M, type VariableReference$1 as N, type StepResult$1 as O, type PaginationInfo as P, type StepAction as Q, type LegacyWorkflowRunResult as R, type StepExecutionContext as S, type ToolsInput as T, type WorkflowOptions as U, type VercelTool as V, type WorkflowContext as W, type StepVariableType as X, type StepNode as Y, type StepGraph as Z, type RetryConfig as _, type MastraPrimitives as a, MemoryProcessor as a$, type ActionContext as a0, WhenConditionReturnValue as a1, type StepDef as a2, type StepCondition as a3, type StepConfig as a4, type StepsRecord$1 as a5, type WorkflowLogMessage as a6, type WorkflowEvent as a7, type ResolverFunctionInput as a8, type ResolverFunctionOutput as a9, type CoreToolMessage as aA, type EmbedResult as aB, type EmbedManyResult as aC, type BaseStructuredOutputType as aD, type StructuredOutputType as aE, type StructuredOutputArrayItem as aF, type StructuredOutput as aG, type GenerateReturn as aH, type StreamReturn as aI, type OutputType as aJ, type DefaultLLMTextOptions as aK, type DefaultLLMTextObjectOptions as aL, type DefaultLLMStreamOptions as aM, type DefaultLLMStreamObjectOptions as aN, type LLMTextOptions as aO, type LLMTextObjectOptions as aP, type LLMStreamOptions as aQ, type LLMInnerStreamOptions as aR, type LLMStreamObjectOptions as aS, createMockModel as aT, type Config as aU, type MessageType as aV, type MessageResponse as aW, type MemoryConfig as aX, type SharedMemoryConfig as aY, type TraceType as aZ, type MemoryProcessorOpts as a_, type SubscriberFunctionOutput as aa, type DependencyCheckOutput as ab, type StepResolverOutput as ac, type WorkflowActors as ad, type WorkflowActionParams as ae, type WorkflowActions as af, type LegacyWorkflowState as ag, type StepId as ah, type ExtractSchemaFromStep$1 as ai, type ExtractStepResult as aj, type StepInputType as ak, type ExtractSchemaType$1 as al, type PathsToStringProps$1 as am, type LegacyWorkflowRunState as an, type WorkflowResumeResult as ao, Tool as ap, createTool as aq, type InternalCoreTool as ar, type ToolExecutionContext as as, type AgentConfig as at, type WorkflowConfig as au, type LanguageModel as av, type CoreMessage as aw, type CoreSystemMessage as ax, type CoreAssistantMessage as ay, type CoreUserMessage as az, MastraMemory as b, memoryDefaultOptions as b0, type StepFlowEntry as b1, type SerializedStep as b2, type SerializedStepFlowEntry as b3, createStep as b4, cloneStep as b5, createWorkflow as b6, cloneWorkflow as b7, type WorkflowResult as b8, Run as b9, type ConvertedTool as bA, type MCPServerSSEOptions as bB, type MCPServerHonoSSEOptions as bC, type MCPServerHTTPOptions as bD, type Repository as bE, type VersionDetail as bF, type ArgumentInfo as bG, type PositionalArgumentInfo as bH, type NamedArgumentInfo as bI, type SubcommandInfo as bJ, type CommandInfo as bK, type EnvironmentVariableInfo as bL, type PackageInfo as bM, type RemoteInfo as bN, type MCPServerConfig as bO, type ServerInfo as bP, type ServerDetailInfo as bQ, type MCPToolType as bR, MessageList as bS, type ToolsetsInput as bT, type DynamicArgument as bU, type AgentGenerateOptions as bV, type AgentStreamOptions as bW, type MastraMessageContentV2 as bX, type ExecutionGraph as ba, ExecutionEngine as bb, type ExecuteFunction as bc, type StepSuccess as bd, type StepFailure as be, type StepSuspended as bf, type StepRunning as bg, type StepResult as bh, type StepsRecord as bi, type DynamicMapping as bj, type PathsToStringProps as bk, type ExtractSchemaType as bl, type ExtractSchemaFromStep as bm, type VariableReference as bn, type StreamEvent as bo, type WatchEvent as bp, type ZodPathType as bq, type WorkflowRunState as br, type MastraLanguageModel as bs, type VoiceEventType as bt, type VoiceEventMap as bu, type VoiceConfig as bv, MastraVoice as bw, CompositeVoice as bx, DefaultVoice as by, type AgentNetworkConfig as bz, type ToolAction as c, LegacyStep as d, Workflow as e, type Step as f, AgentNetwork as g, MCPServerBase as h, type Methods as i, type ApiRoute as j, type MastraAuthConfig as k, type ContextWithMastra as l, MastraAuthProvider as m, type MastraAuthProviderOptions as n, MastraStorage as o, type TABLE_NAMES as p, type StorageColumn as q, type StorageThreadType as r, type MastraMessageV2 as s, type StorageGetMessagesArg as t, type MastraMessageV1 as u, type WorkflowRuns as v, type WorkflowRun as w, type LegacyWorkflowRuns as x, type LegacyWorkflowRun as y, type PaginationArgs as z };
|
|
@@ -1040,7 +1040,7 @@ declare class LegacyWorkflow<TSteps extends LegacyStep<string, any, any>[] = Leg
|
|
|
1040
1040
|
toStep(): LegacyStep<TStepId, TTriggerSchema, z.ZodType<LegacyWorkflowRunResult<TTriggerSchema, TSteps, TResultSchema>>, any>;
|
|
1041
1041
|
}
|
|
1042
1042
|
|
|
1043
|
-
type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema> = (params: {
|
|
1043
|
+
type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, EngineType> = (params: {
|
|
1044
1044
|
runId: string;
|
|
1045
1045
|
mastra: Mastra;
|
|
1046
1046
|
runtimeContext: RuntimeContext;
|
|
@@ -1057,15 +1057,16 @@ type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema> = (
|
|
|
1057
1057
|
[EMITTER_SYMBOL]: {
|
|
1058
1058
|
emit: (event: string, data: any) => Promise<void>;
|
|
1059
1059
|
};
|
|
1060
|
+
engine: EngineType;
|
|
1060
1061
|
}) => Promise<TStepOutput>;
|
|
1061
|
-
interface Step<TStepId extends string = string, TSchemaIn extends z.ZodType<any> = z.ZodType<any>, TSchemaOut extends z.ZodType<any> = z.ZodType<any>, TResumeSchema extends z.ZodType<any> = z.ZodType<any>, TSuspendSchema extends z.ZodType<any> = z.ZodType<any
|
|
1062
|
+
interface Step<TStepId extends string = string, TSchemaIn extends z.ZodType<any> = z.ZodType<any>, TSchemaOut extends z.ZodType<any> = z.ZodType<any>, TResumeSchema extends z.ZodType<any> = z.ZodType<any>, TSuspendSchema extends z.ZodType<any> = z.ZodType<any>, TEngineType = any> {
|
|
1062
1063
|
id: TStepId;
|
|
1063
1064
|
description?: string;
|
|
1064
1065
|
inputSchema: TSchemaIn;
|
|
1065
1066
|
outputSchema: TSchemaOut;
|
|
1066
1067
|
resumeSchema?: TResumeSchema;
|
|
1067
1068
|
suspendSchema?: TSuspendSchema;
|
|
1068
|
-
execute: ExecuteFunction<z.infer<TSchemaIn>, z.infer<TSchemaOut>, z.infer<TResumeSchema>, z.infer<TSuspendSchema
|
|
1069
|
+
execute: ExecuteFunction<z.infer<TSchemaIn>, z.infer<TSchemaOut>, z.infer<TResumeSchema>, z.infer<TSuspendSchema>, TEngineType>;
|
|
1069
1070
|
retries?: number;
|
|
1070
1071
|
}
|
|
1071
1072
|
|
|
@@ -1114,7 +1115,7 @@ type StepsRecord<T extends readonly Step<any, any, any>[]> = {
|
|
|
1114
1115
|
}>;
|
|
1115
1116
|
};
|
|
1116
1117
|
type DynamicMapping<TPrevSchema extends z.ZodTypeAny, TSchemaOut extends z.ZodTypeAny> = {
|
|
1117
|
-
fn: ExecuteFunction<z.infer<TPrevSchema>, z.infer<TSchemaOut>, any, any>;
|
|
1118
|
+
fn: ExecuteFunction<z.infer<TPrevSchema>, z.infer<TSchemaOut>, any, any, any>;
|
|
1118
1119
|
schema: TSchemaOut;
|
|
1119
1120
|
};
|
|
1120
1121
|
type PathsToStringProps<T> = T extends object ? {
|
|
@@ -1158,7 +1159,7 @@ type WatchEvent = {
|
|
|
1158
1159
|
suspendedAt?: number;
|
|
1159
1160
|
resumedAt?: number;
|
|
1160
1161
|
}>;
|
|
1161
|
-
|
|
1162
|
+
result?: Record<string, any>;
|
|
1162
1163
|
payload?: Record<string, any>;
|
|
1163
1164
|
error?: string | Error;
|
|
1164
1165
|
};
|
|
@@ -1168,6 +1169,9 @@ type WatchEvent = {
|
|
|
1168
1169
|
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;
|
|
1169
1170
|
interface WorkflowRunState {
|
|
1170
1171
|
runId: string;
|
|
1172
|
+
status: 'success' | 'failed' | 'suspended' | 'running';
|
|
1173
|
+
result?: Record<string, any>;
|
|
1174
|
+
error?: string | Error;
|
|
1171
1175
|
value: Record<string, string>;
|
|
1172
1176
|
context: {
|
|
1173
1177
|
input?: Record<string, any>;
|
|
@@ -1224,7 +1228,8 @@ declare abstract class ExecutionEngine extends MastraBase {
|
|
|
1224
1228
|
}): Promise<TOutput>;
|
|
1225
1229
|
}
|
|
1226
1230
|
|
|
1227
|
-
type
|
|
1231
|
+
type DefaultEngineType = {};
|
|
1232
|
+
type StepFlowEntry<TEngineType = DefaultEngineType> = {
|
|
1228
1233
|
type: 'step';
|
|
1229
1234
|
step: Step;
|
|
1230
1235
|
} | {
|
|
@@ -1233,7 +1238,7 @@ type StepFlowEntry = {
|
|
|
1233
1238
|
} | {
|
|
1234
1239
|
type: 'conditional';
|
|
1235
1240
|
steps: StepFlowEntry[];
|
|
1236
|
-
conditions: ExecuteFunction<any, any, any, any>[];
|
|
1241
|
+
conditions: ExecuteFunction<any, any, any, any, TEngineType>[];
|
|
1237
1242
|
serializedConditions: {
|
|
1238
1243
|
id: string;
|
|
1239
1244
|
fn: string;
|
|
@@ -1241,7 +1246,7 @@ type StepFlowEntry = {
|
|
|
1241
1246
|
} | {
|
|
1242
1247
|
type: 'loop';
|
|
1243
1248
|
step: Step;
|
|
1244
|
-
condition: ExecuteFunction<any, any, any, any>;
|
|
1249
|
+
condition: ExecuteFunction<any, any, any, any, any>;
|
|
1245
1250
|
serializedCondition: {
|
|
1246
1251
|
id: string;
|
|
1247
1252
|
fn: string;
|
|
@@ -1254,7 +1259,7 @@ type StepFlowEntry = {
|
|
|
1254
1259
|
concurrency: number;
|
|
1255
1260
|
};
|
|
1256
1261
|
};
|
|
1257
|
-
type SerializedStep = Pick<Step, 'id' | 'description'> & {
|
|
1262
|
+
type SerializedStep<TEngineType = DefaultEngineType> = Pick<Step<any, any, any, any, any, TEngineType>, 'id' | 'description'> & {
|
|
1258
1263
|
component?: string;
|
|
1259
1264
|
serializedStepFlow?: SerializedStepFlowEntry[];
|
|
1260
1265
|
mapConfig?: string;
|
|
@@ -1297,32 +1302,32 @@ type SerializedStepFlowEntry = {
|
|
|
1297
1302
|
* @param params.execute Function that performs the step's operations
|
|
1298
1303
|
* @returns A Step object that can be added to the workflow
|
|
1299
1304
|
*/
|
|
1300
|
-
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
|
|
1305
|
+
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>, TEngineType = DefaultEngineType>(params: {
|
|
1301
1306
|
id: TStepId;
|
|
1302
1307
|
description?: string;
|
|
1303
1308
|
inputSchema: TStepInput;
|
|
1304
1309
|
outputSchema: TStepOutput;
|
|
1305
1310
|
resumeSchema?: TResumeSchema;
|
|
1306
1311
|
suspendSchema?: TSuspendSchema;
|
|
1307
|
-
execute: ExecuteFunction<z.infer<TStepInput>, z.infer<TStepOutput>, z.infer<TResumeSchema>, z.infer<TSuspendSchema
|
|
1308
|
-
}): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema>;
|
|
1312
|
+
execute: ExecuteFunction<z.infer<TStepInput>, z.infer<TStepOutput>, z.infer<TResumeSchema>, z.infer<TSuspendSchema>, TEngineType>;
|
|
1313
|
+
}): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, TEngineType>;
|
|
1309
1314
|
declare function createStep<TStepId extends string, TStepInput extends z.ZodObject<{
|
|
1310
1315
|
prompt: z.ZodString;
|
|
1311
1316
|
}>, TStepOutput extends z.ZodObject<{
|
|
1312
1317
|
text: z.ZodString;
|
|
1313
|
-
}>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(agent: Agent<TStepId, any, any>): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema>;
|
|
1318
|
+
}>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(agent: Agent<TStepId, any, any>): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, DefaultEngineType>;
|
|
1314
1319
|
declare function createStep<TSchemaIn extends z.ZodType<any>, TSchemaOut extends z.ZodType<any>, TContext extends ToolExecutionContext<TSchemaIn>>(tool: Tool<TSchemaIn, TSchemaOut, TContext> & {
|
|
1315
1320
|
inputSchema: TSchemaIn;
|
|
1316
1321
|
outputSchema: TSchemaOut;
|
|
1317
1322
|
execute: (context: TContext) => Promise<any>;
|
|
1318
|
-
}): Step<string, TSchemaIn, TSchemaOut, z.ZodType<any>, z.ZodType<any
|
|
1323
|
+
}): Step<string, TSchemaIn, TSchemaOut, z.ZodType<any>, z.ZodType<any>, DefaultEngineType>;
|
|
1319
1324
|
declare function cloneStep<TStepId extends string>(step: Step<string, any, any>, opts: {
|
|
1320
1325
|
id: TStepId;
|
|
1321
1326
|
}): Step<TStepId, any, any>;
|
|
1322
|
-
declare function createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TInput>;
|
|
1323
|
-
declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[]>(workflow: Workflow<TSteps, string, TInput, TOutput>, opts: {
|
|
1327
|
+
declare function createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TEngineType = DefaultEngineType, TSteps extends Step<string, any, any, any, any, TEngineType>[] = Step<string, any, any, any, any, TEngineType>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): Workflow<TSteps, TWorkflowId, TInput, TOutput, DefaultEngineType, TInput>;
|
|
1328
|
+
declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends Step<string, any, any, any, any, DefaultEngineType>[] = Step<string, any, any, any, any, DefaultEngineType>[]>(workflow: Workflow<TSteps, string, TInput, TOutput, DefaultEngineType>, opts: {
|
|
1324
1329
|
id: TWorkflowId;
|
|
1325
|
-
}): Workflow<TSteps, TWorkflowId, TInput, TOutput>;
|
|
1330
|
+
}): Workflow<TSteps, TWorkflowId, TInput, TOutput, DefaultEngineType>;
|
|
1326
1331
|
type WorkflowResult<TOutput extends z.ZodType<any>, TSteps extends Step<string, any, any>[]> = {
|
|
1327
1332
|
status: 'success';
|
|
1328
1333
|
result: z.infer<TOutput>;
|
|
@@ -1355,7 +1360,7 @@ type WorkflowConfig<TWorkflowId extends string = string, TInput extends z.ZodTyp
|
|
|
1355
1360
|
delay?: number;
|
|
1356
1361
|
};
|
|
1357
1362
|
};
|
|
1358
|
-
declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[], TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TPrevSchema extends z.ZodType<any> = TInput> extends MastraBase implements Step<TWorkflowId, TInput, TOutput> {
|
|
1363
|
+
declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[], TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TEngineType = DefaultEngineType, TPrevSchema extends z.ZodType<any> = TInput> extends MastraBase implements Step<TWorkflowId, TInput, TOutput, any, any, TEngineType> {
|
|
1359
1364
|
#private;
|
|
1360
1365
|
id: TWorkflowId;
|
|
1361
1366
|
description?: string | undefined;
|
|
@@ -1373,7 +1378,7 @@ declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<
|
|
|
1373
1378
|
};
|
|
1374
1379
|
constructor({ mastra, id, inputSchema, outputSchema, description, executionEngine, retryConfig, steps, }: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>);
|
|
1375
1380
|
get runs(): Map<string, Run<TSteps, TInput, TOutput>>;
|
|
1376
|
-
get mastra(): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, LegacyWorkflow<LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, Workflow<Step<string, any, any, any, any>[], string, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>>, Record<string, MastraVector>, Record<string, MastraTTS>, IMastraLogger, Record<string, AgentNetwork>, Record<string, MCPServerBase>> | undefined;
|
|
1381
|
+
get mastra(): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, LegacyWorkflow<LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, Workflow<Step<string, any, any, any, any, any>[], string, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, DefaultEngineType, z.ZodType<any, z.ZodTypeDef, any>>>, Record<string, MastraVector>, Record<string, MastraTTS>, IMastraLogger, Record<string, AgentNetwork>, Record<string, MCPServerBase>> | undefined;
|
|
1377
1382
|
__registerMastra(mastra: Mastra): void;
|
|
1378
1383
|
__registerPrimitives(p: MastraPrimitives): void;
|
|
1379
1384
|
setStepFlow(stepFlow: StepFlowEntry[]): void;
|
|
@@ -1382,7 +1387,7 @@ declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<
|
|
|
1382
1387
|
* @param step The step to add to the workflow
|
|
1383
1388
|
* @returns The workflow instance for chaining
|
|
1384
1389
|
*/
|
|
1385
|
-
then<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
1390
|
+
then<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any, TEngineType>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TEngineType, TSchemaOut>;
|
|
1386
1391
|
map<TSteps extends Step<string, any, any>[], TMapping extends {
|
|
1387
1392
|
[K in keyof TMapping]: {
|
|
1388
1393
|
step: TSteps[number] | TSteps[number][];
|
|
@@ -1397,17 +1402,17 @@ declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<
|
|
|
1397
1402
|
runtimeContextPath: string;
|
|
1398
1403
|
schema: z.ZodTypeAny;
|
|
1399
1404
|
} | DynamicMapping<TPrevSchema, z.ZodTypeAny>;
|
|
1400
|
-
}>(mappingConfig: TMapping | ExecuteFunction<z.infer<TPrevSchema>, any, any, any>): Workflow<TSteps, TWorkflowId, TInput, TOutput,
|
|
1401
|
-
parallel<TParallelSteps extends Step<string, TPrevSchema, any, any, any>[]>(steps: TParallelSteps): Workflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodObject<{ [K in keyof StepsRecord<TParallelSteps>]: StepsRecord<TParallelSteps>[K]["outputSchema"]["path"]; }, any, z.ZodTypeAny>>;
|
|
1405
|
+
}>(mappingConfig: TMapping | ExecuteFunction<z.infer<TPrevSchema>, any, any, any, TEngineType>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TEngineType, TInput>;
|
|
1406
|
+
parallel<TParallelSteps extends Step<string, TPrevSchema, any, any, any, TEngineType>[]>(steps: TParallelSteps): Workflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodObject<{ [K in keyof StepsRecord<TParallelSteps>]: StepsRecord<TParallelSteps>[K]["outputSchema"]["path"]; }, any, z.ZodTypeAny>>;
|
|
1402
1407
|
branch<TBranchSteps extends Array<[
|
|
1403
|
-
ExecuteFunction<z.infer<TPrevSchema>, any, any, any>,
|
|
1404
|
-
Step<string, TPrevSchema, any, any, any>
|
|
1405
|
-
]>>(steps: TBranchSteps): Workflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodObject<{ [K in keyof StepsRecord<{ [K_1 in keyof TBranchSteps]: TBranchSteps[K_1][1]; }[number][]>]: StepsRecord<{ [K_1 in keyof TBranchSteps]: TBranchSteps[K_1][1]; }[number][]>[K]["outputSchema"]; }, any, z.ZodTypeAny>>;
|
|
1406
|
-
dowhile<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any>, condition: ExecuteFunction<z.infer<TSchemaOut>, any, any, any>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
1407
|
-
dountil<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any>, condition: ExecuteFunction<z.infer<TSchemaOut>, any, any, any>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
1408
|
-
foreach<TPrevIsArray extends TPrevSchema extends z.ZodArray<any> ? true : false, TStepInputSchema extends TPrevSchema extends z.ZodArray<infer TElement> ? TElement : never, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: TPrevIsArray extends true ? Step<TStepId, TStepInputSchema, TSchemaOut, any, any> : 'Previous step must return an array type', opts?: {
|
|
1408
|
+
ExecuteFunction<z.infer<TPrevSchema>, any, any, any, any>,
|
|
1409
|
+
Step<string, TPrevSchema, any, any, any, TEngineType>
|
|
1410
|
+
]>>(steps: TBranchSteps): Workflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodObject<{ [K in keyof StepsRecord<{ [K_1 in keyof TBranchSteps]: TBranchSteps[K_1][1]; }[number][]>]: StepsRecord<{ [K_1 in keyof TBranchSteps]: TBranchSteps[K_1][1]; }[number][]>[K]["outputSchema"]; }, any, z.ZodTypeAny, TEngineType>>;
|
|
1411
|
+
dowhile<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any, TEngineType>, condition: ExecuteFunction<z.infer<TSchemaOut>, any, any, any, TEngineType>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
1412
|
+
dountil<TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, TStepInputSchema, TSchemaOut, any, any, TEngineType>, condition: ExecuteFunction<z.infer<TSchemaOut>, any, any, any, TEngineType>): Workflow<TSteps, TWorkflowId, TInput, TOutput, TSchemaOut>;
|
|
1413
|
+
foreach<TPrevIsArray extends TPrevSchema extends z.ZodArray<any> ? true : false, TStepInputSchema extends TPrevSchema extends z.ZodArray<infer TElement> ? TElement : never, TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: TPrevIsArray extends true ? Step<TStepId, TStepInputSchema, TSchemaOut, any, any, TEngineType> : 'Previous step must return an array type', opts?: {
|
|
1409
1414
|
concurrency: number;
|
|
1410
|
-
}): Workflow<TSteps, TWorkflowId, TInput, TOutput, z.ZodArray<TSchemaOut>>;
|
|
1415
|
+
}): Workflow<TSteps, TWorkflowId, TInput, TOutput, TEngineType, z.ZodArray<TSchemaOut>>;
|
|
1411
1416
|
/**
|
|
1412
1417
|
* Builds the execution graph for this workflow
|
|
1413
1418
|
* @returns The execution graph that can be used to execute the workflow
|
|
@@ -1419,7 +1424,7 @@ declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<
|
|
|
1419
1424
|
* @returns A built workflow instance ready for execution
|
|
1420
1425
|
*/
|
|
1421
1426
|
commit(): Workflow<TSteps, TWorkflowId, TInput, TOutput, TOutput>;
|
|
1422
|
-
get stepGraph(): StepFlowEntry[];
|
|
1427
|
+
get stepGraph(): StepFlowEntry<DefaultEngineType>[];
|
|
1423
1428
|
get serializedStepGraph(): SerializedStepFlowEntry[];
|
|
1424
1429
|
/**
|
|
1425
1430
|
* Creates a new workflow run instance
|
|
@@ -1444,6 +1449,7 @@ declare class Workflow<TSteps extends Step<string, any, any, any, any>[] = Step<
|
|
|
1444
1449
|
};
|
|
1445
1450
|
mastra: Mastra;
|
|
1446
1451
|
runtimeContext?: RuntimeContext;
|
|
1452
|
+
engine: TEngineType;
|
|
1447
1453
|
}): Promise<z.infer<TOutput>>;
|
|
1448
1454
|
getWorkflowRuns(args?: {
|
|
1449
1455
|
fromDate?: Date;
|
|
@@ -3521,4 +3527,4 @@ declare abstract class MastraStorage extends MastraBase {
|
|
|
3521
3527
|
}>;
|
|
3522
3528
|
}
|
|
3523
3529
|
|
|
3524
|
-
export { type
|
|
3530
|
+
export { type BaseCondition as $, Agent as A, type StorageGetTracesArg as B, type CoreTool as C, type DefaultEngineType as D, type EvalRow as E, TABLE_WORKFLOW_SNAPSHOT as F, TABLE_EVALS as G, TABLE_MESSAGES as H, TABLE_THREADS as I, TABLE_TRACES as J, TABLE_SCHEMAS as K, LegacyWorkflow as L, Mastra as M, type VariableReference$1 as N, type StepResult$1 as O, type PaginationInfo as P, type StepAction as Q, type LegacyWorkflowRunResult as R, type StepExecutionContext as S, type ToolsInput as T, type WorkflowOptions as U, type VercelTool as V, type WorkflowContext as W, type StepVariableType as X, type StepNode as Y, type StepGraph as Z, type RetryConfig as _, type MastraPrimitives as a, MemoryProcessor as a$, type ActionContext as a0, WhenConditionReturnValue as a1, type StepDef as a2, type StepCondition as a3, type StepConfig as a4, type StepsRecord$1 as a5, type WorkflowLogMessage as a6, type WorkflowEvent as a7, type ResolverFunctionInput as a8, type ResolverFunctionOutput as a9, type CoreToolMessage as aA, type EmbedResult as aB, type EmbedManyResult as aC, type BaseStructuredOutputType as aD, type StructuredOutputType as aE, type StructuredOutputArrayItem as aF, type StructuredOutput as aG, type GenerateReturn as aH, type StreamReturn as aI, type OutputType as aJ, type DefaultLLMTextOptions as aK, type DefaultLLMTextObjectOptions as aL, type DefaultLLMStreamOptions as aM, type DefaultLLMStreamObjectOptions as aN, type LLMTextOptions as aO, type LLMTextObjectOptions as aP, type LLMStreamOptions as aQ, type LLMInnerStreamOptions as aR, type LLMStreamObjectOptions as aS, createMockModel as aT, type Config as aU, type MessageType as aV, type MessageResponse as aW, type MemoryConfig as aX, type SharedMemoryConfig as aY, type TraceType as aZ, type MemoryProcessorOpts as a_, type SubscriberFunctionOutput as aa, type DependencyCheckOutput as ab, type StepResolverOutput as ac, type WorkflowActors as ad, type WorkflowActionParams as ae, type WorkflowActions as af, type LegacyWorkflowState as ag, type StepId as ah, type ExtractSchemaFromStep$1 as ai, type ExtractStepResult as aj, type StepInputType as ak, type ExtractSchemaType$1 as al, type PathsToStringProps$1 as am, type LegacyWorkflowRunState as an, type WorkflowResumeResult as ao, Tool as ap, createTool as aq, type InternalCoreTool as ar, type ToolExecutionContext as as, type AgentConfig as at, type WorkflowConfig as au, type LanguageModel as av, type CoreMessage as aw, type CoreSystemMessage as ax, type CoreAssistantMessage as ay, type CoreUserMessage as az, MastraMemory as b, memoryDefaultOptions as b0, type StepFlowEntry as b1, type SerializedStep as b2, type SerializedStepFlowEntry as b3, createStep as b4, cloneStep as b5, createWorkflow as b6, cloneWorkflow as b7, type WorkflowResult as b8, Run as b9, type ConvertedTool as bA, type MCPServerSSEOptions as bB, type MCPServerHonoSSEOptions as bC, type MCPServerHTTPOptions as bD, type Repository as bE, type VersionDetail as bF, type ArgumentInfo as bG, type PositionalArgumentInfo as bH, type NamedArgumentInfo as bI, type SubcommandInfo as bJ, type CommandInfo as bK, type EnvironmentVariableInfo as bL, type PackageInfo as bM, type RemoteInfo as bN, type MCPServerConfig as bO, type ServerInfo as bP, type ServerDetailInfo as bQ, type MCPToolType as bR, MessageList as bS, type ToolsetsInput as bT, type DynamicArgument as bU, type AgentGenerateOptions as bV, type AgentStreamOptions as bW, type MastraMessageContentV2 as bX, type ExecutionGraph as ba, ExecutionEngine as bb, type ExecuteFunction as bc, type StepSuccess as bd, type StepFailure as be, type StepSuspended as bf, type StepRunning as bg, type StepResult as bh, type StepsRecord as bi, type DynamicMapping as bj, type PathsToStringProps as bk, type ExtractSchemaType as bl, type ExtractSchemaFromStep as bm, type VariableReference as bn, type StreamEvent as bo, type WatchEvent as bp, type ZodPathType as bq, type WorkflowRunState as br, type MastraLanguageModel as bs, type VoiceEventType as bt, type VoiceEventMap as bu, type VoiceConfig as bv, MastraVoice as bw, CompositeVoice as bx, DefaultVoice as by, type AgentNetworkConfig as bz, type ToolAction as c, LegacyStep as d, Workflow as e, type Step as f, AgentNetwork as g, MCPServerBase as h, type Methods as i, type ApiRoute as j, type MastraAuthConfig as k, type ContextWithMastra as l, MastraAuthProvider as m, type MastraAuthProviderOptions as n, MastraStorage as o, type TABLE_NAMES as p, type StorageColumn as q, type StorageThreadType as r, type MastraMessageV2 as s, type StorageGetMessagesArg as t, type MastraMessageV1 as u, type WorkflowRuns as v, type WorkflowRun as w, type LegacyWorkflowRuns as x, type LegacyWorkflowRun as y, type PaginationArgs as z };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { MastraError } from './chunk-LDNCERLU.js';
|
|
2
|
+
import { MastraBase } from './chunk-5IEKR756.js';
|
|
3
|
+
|
|
4
|
+
// src/vector/vector.ts
|
|
5
|
+
var MastraVector = class extends MastraBase {
|
|
6
|
+
constructor() {
|
|
7
|
+
super({ name: "MastraVector", component: "VECTOR" });
|
|
8
|
+
}
|
|
9
|
+
get indexSeparator() {
|
|
10
|
+
return "_";
|
|
11
|
+
}
|
|
12
|
+
async validateExistingIndex(indexName, dimension, metric) {
|
|
13
|
+
let info;
|
|
14
|
+
try {
|
|
15
|
+
info = await this.describeIndex({ indexName });
|
|
16
|
+
} catch (infoError) {
|
|
17
|
+
const mastraError = new MastraError(
|
|
18
|
+
{
|
|
19
|
+
id: "VECTOR_VALIDATE_INDEX_FETCH_FAILED",
|
|
20
|
+
text: `Index "${indexName}" already exists, but failed to fetch index info for dimension check.`,
|
|
21
|
+
domain: "MASTRA_VECTOR" /* MASTRA_VECTOR */,
|
|
22
|
+
category: "SYSTEM" /* SYSTEM */,
|
|
23
|
+
details: { indexName }
|
|
24
|
+
},
|
|
25
|
+
infoError
|
|
26
|
+
);
|
|
27
|
+
this.logger?.trackException(mastraError);
|
|
28
|
+
this.logger?.error(mastraError.toString());
|
|
29
|
+
throw mastraError;
|
|
30
|
+
}
|
|
31
|
+
const existingDim = info?.dimension;
|
|
32
|
+
const existingMetric = info?.metric;
|
|
33
|
+
if (existingDim === dimension) {
|
|
34
|
+
this.logger?.info(
|
|
35
|
+
`Index "${indexName}" already exists with ${existingDim} dimensions and metric ${existingMetric}, skipping creation.`
|
|
36
|
+
);
|
|
37
|
+
if (existingMetric !== metric) {
|
|
38
|
+
this.logger?.warn(
|
|
39
|
+
`Attempted to create index with metric "${metric}", but index already exists with metric "${existingMetric}". To use a different metric, delete and recreate the index.`
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
} else if (info) {
|
|
43
|
+
const mastraError = new MastraError({
|
|
44
|
+
id: "VECTOR_VALIDATE_INDEX_DIMENSION_MISMATCH",
|
|
45
|
+
text: `Index "${indexName}" already exists with ${existingDim} dimensions, but ${dimension} dimensions were requested`,
|
|
46
|
+
domain: "MASTRA_VECTOR" /* MASTRA_VECTOR */,
|
|
47
|
+
category: "USER" /* USER */,
|
|
48
|
+
details: { indexName, existingDim, requestedDim: dimension }
|
|
49
|
+
});
|
|
50
|
+
this.logger?.trackException(mastraError);
|
|
51
|
+
this.logger?.error(mastraError.toString());
|
|
52
|
+
throw mastraError;
|
|
53
|
+
} else {
|
|
54
|
+
const mastraError = new MastraError({
|
|
55
|
+
id: "VECTOR_VALIDATE_INDEX_NO_DIMENSION",
|
|
56
|
+
text: `Index "${indexName}" already exists, but could not retrieve its dimensions for validation.`,
|
|
57
|
+
domain: "MASTRA_VECTOR" /* MASTRA_VECTOR */,
|
|
58
|
+
category: "SYSTEM" /* SYSTEM */,
|
|
59
|
+
details: { indexName }
|
|
60
|
+
});
|
|
61
|
+
this.logger?.trackException(mastraError);
|
|
62
|
+
this.logger?.error(mastraError.toString());
|
|
63
|
+
throw mastraError;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export { MastraVector };
|