@mastra/core 0.0.0-commonjs-20250227130920
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +180 -0
- package/dist/agent/index.cjs +1865 -0
- package/dist/agent/index.d.cts +15 -0
- package/dist/agent/index.d.ts +15 -0
- package/dist/agent/index.js +1 -0
- package/dist/base-D90KQ4XI.d.ts +139 -0
- package/dist/base-hs9NDAZ2.d.cts +139 -0
- package/dist/base-nKCMCNrM.d.ts +920 -0
- package/dist/base-nhesrHv3.d.cts +920 -0
- package/dist/base.cjs +138 -0
- package/dist/base.d.cts +6 -0
- package/dist/base.d.ts +6 -0
- package/dist/base.js +1 -0
- package/dist/bundler/index.cjs +158 -0
- package/dist/bundler/index.d.cts +28 -0
- package/dist/bundler/index.d.ts +28 -0
- package/dist/bundler/index.js +1 -0
- package/dist/chunk-33GSTUNK.js +620 -0
- package/dist/chunk-4YRYBCOZ.js +10 -0
- package/dist/chunk-55NFNRKO.js +10 -0
- package/dist/chunk-5XPCMNGW.js +215 -0
- package/dist/chunk-B3M27AMP.js +1479 -0
- package/dist/chunk-BB4KXGBU.js +83 -0
- package/dist/chunk-C6A6W6XS.js +77 -0
- package/dist/chunk-HQ55LN2U.js +318 -0
- package/dist/chunk-KNVTCZW7.js +416 -0
- package/dist/chunk-LH47WVJL.js +61 -0
- package/dist/chunk-NGD2HQYW.js +346 -0
- package/dist/chunk-NUDAZEOG.js +35 -0
- package/dist/chunk-OZ4XVJ6F.js +49 -0
- package/dist/chunk-PHMSPCTC.js +145 -0
- package/dist/chunk-PNZK456O.js +88 -0
- package/dist/chunk-QAAJAHDB.js +37 -0
- package/dist/chunk-RG66XEJT.js +8 -0
- package/dist/chunk-SIFBBGY6.js +190 -0
- package/dist/chunk-SVEAENO7.js +22 -0
- package/dist/chunk-SY5244IR.js +1499 -0
- package/dist/chunk-W5HVJX45.js +402 -0
- package/dist/chunk-WIBGG4X6.js +173 -0
- package/dist/chunk-ZDWFBE5L.js +1 -0
- package/dist/chunk-ZINPRHAN.js +22 -0
- package/dist/deployer/index.cjs +165 -0
- package/dist/deployer/index.d.cts +19 -0
- package/dist/deployer/index.d.ts +19 -0
- package/dist/deployer/index.js +1 -0
- package/dist/eval/index.cjs +110 -0
- package/dist/eval/index.d.cts +28 -0
- package/dist/eval/index.d.ts +28 -0
- package/dist/eval/index.js +1 -0
- package/dist/filter/index.cjs +192 -0
- package/dist/filter/index.d.cts +90 -0
- package/dist/filter/index.d.ts +90 -0
- package/dist/filter/index.js +1 -0
- package/dist/hooks/index.cjs +87 -0
- package/dist/hooks/index.d.cts +33 -0
- package/dist/hooks/index.d.ts +33 -0
- package/dist/hooks/index.js +1 -0
- package/dist/index-mKY1XrpK.d.cts +90 -0
- package/dist/index-mKY1XrpK.d.ts +90 -0
- package/dist/index.cjs +6844 -0
- package/dist/index.d.cts +97 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.js +119 -0
- package/dist/integration/index.cjs +113 -0
- package/dist/integration/index.d.cts +52 -0
- package/dist/integration/index.d.ts +52 -0
- package/dist/integration/index.js +1 -0
- package/dist/llm/index.cjs +2 -0
- package/dist/llm/index.d.cts +15 -0
- package/dist/llm/index.d.ts +15 -0
- package/dist/llm/index.js +1 -0
- package/dist/logger/index.cjs +159 -0
- package/dist/logger/index.d.cts +3 -0
- package/dist/logger/index.d.ts +3 -0
- package/dist/logger/index.js +1 -0
- package/dist/mastra/index.cjs +1741 -0
- package/dist/mastra/index.d.cts +67 -0
- package/dist/mastra/index.d.ts +67 -0
- package/dist/mastra/index.js +1 -0
- package/dist/memory/index.cjs +1907 -0
- package/dist/memory/index.d.cts +15 -0
- package/dist/memory/index.d.ts +15 -0
- package/dist/memory/index.js +1 -0
- package/dist/relevance/index.cjs +1927 -0
- package/dist/relevance/index.d.cts +21 -0
- package/dist/relevance/index.d.ts +21 -0
- package/dist/relevance/index.js +1 -0
- package/dist/storage/index.cjs +361 -0
- package/dist/storage/index.d.cts +15 -0
- package/dist/storage/index.d.ts +15 -0
- package/dist/storage/index.js +2 -0
- package/dist/storage/libsql/index.cjs +770 -0
- package/dist/storage/libsql/index.d.cts +81 -0
- package/dist/storage/libsql/index.d.ts +81 -0
- package/dist/storage/libsql/index.js +1 -0
- package/dist/telemetry/index.cjs +413 -0
- package/dist/telemetry/index.d.cts +51 -0
- package/dist/telemetry/index.d.ts +51 -0
- package/dist/telemetry/index.js +1 -0
- package/dist/telemetry/otel-vendor.cjs +52 -0
- package/dist/telemetry/otel-vendor.d.cts +7 -0
- package/dist/telemetry/otel-vendor.d.ts +7 -0
- package/dist/telemetry/otel-vendor.js +7 -0
- package/dist/tools/index.cjs +25 -0
- package/dist/tools/index.d.cts +29 -0
- package/dist/tools/index.d.ts +29 -0
- package/dist/tools/index.js +1 -0
- package/dist/tts/index.cjs +328 -0
- package/dist/tts/index.d.cts +28 -0
- package/dist/tts/index.d.ts +28 -0
- package/dist/tts/index.js +1 -0
- package/dist/types-m9RryK9a.d.cts +14 -0
- package/dist/types-m9RryK9a.d.ts +14 -0
- package/dist/utils.cjs +179 -0
- package/dist/utils.d.cts +26 -0
- package/dist/utils.d.ts +26 -0
- package/dist/utils.js +1 -0
- package/dist/vector/index.cjs +145 -0
- package/dist/vector/index.d.cts +30 -0
- package/dist/vector/index.d.ts +30 -0
- package/dist/vector/index.js +1 -0
- package/dist/vector/libsql/index.cjs +951 -0
- package/dist/vector/libsql/index.d.cts +29 -0
- package/dist/vector/libsql/index.d.ts +29 -0
- package/dist/vector/libsql/index.js +1 -0
- package/dist/voice/index.cjs +369 -0
- package/dist/voice/index.d.cts +67 -0
- package/dist/voice/index.d.ts +67 -0
- package/dist/voice/index.js +76 -0
- package/dist/workflow-DqQ4pON_.d.cts +84 -0
- package/dist/workflow-Ng_F_Zaf.d.ts +84 -0
- package/dist/workflows/index.cjs +1628 -0
- package/dist/workflows/index.d.cts +48 -0
- package/dist/workflows/index.d.ts +48 -0
- package/dist/workflows/index.js +1 -0
- package/package.json +162 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { e as StepExecutionContext, f as StepAction, R as RetryConfig, g as MastraPrimitives, h as StepResult, W as WorkflowOptions, I as IAction, i as StepVariableType, j as StepConfig, k as WorkflowRunState, l as StepGraph } from './base-nhesrHv3.cjs';
|
|
2
|
+
import { Span } from '@opentelemetry/api';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { M as MastraBase } from './base-hs9NDAZ2.cjs';
|
|
5
|
+
|
|
6
|
+
declare class Step<TStepId extends string = any, TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends StepExecutionContext<TSchemaIn> = StepExecutionContext<TSchemaIn>> implements StepAction<TStepId, TSchemaIn, TSchemaOut, TContext> {
|
|
7
|
+
id: TStepId;
|
|
8
|
+
description?: string;
|
|
9
|
+
inputSchema?: TSchemaIn;
|
|
10
|
+
outputSchema?: TSchemaOut;
|
|
11
|
+
payload?: TSchemaIn extends z.ZodSchema ? Partial<z.infer<TSchemaIn>> : unknown;
|
|
12
|
+
execute?: (context: TContext) => Promise<TSchemaOut extends z.ZodSchema ? z.infer<TSchemaOut> : unknown>;
|
|
13
|
+
retryConfig?: RetryConfig;
|
|
14
|
+
mastra?: MastraPrimitives;
|
|
15
|
+
constructor({ id, description, execute, payload, outputSchema, inputSchema, retryConfig, }: StepAction<TStepId, TSchemaIn, TSchemaOut, TContext>);
|
|
16
|
+
}
|
|
17
|
+
declare function createStep<TId extends string, TSchemaIn extends z.ZodSchema | undefined, TSchemaOut extends z.ZodSchema | undefined, TContext extends StepExecutionContext<TSchemaIn>>(opts: StepAction<TId, TSchemaIn, TSchemaOut, TContext>): Step<TId, TSchemaIn, TSchemaOut, TContext>;
|
|
18
|
+
|
|
19
|
+
interface WorkflowResultReturn<T extends z.ZodType<any>> {
|
|
20
|
+
runId: string;
|
|
21
|
+
start: (props?: {
|
|
22
|
+
triggerData?: z.infer<T>;
|
|
23
|
+
} | undefined) => Promise<{
|
|
24
|
+
triggerData?: z.infer<T>;
|
|
25
|
+
results: Record<string, StepResult<any>>;
|
|
26
|
+
runId: string;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare class Workflow<TSteps extends Step<any, any, any>[] = any, TTriggerSchema extends z.ZodType<any> = any> extends MastraBase {
|
|
31
|
+
#private;
|
|
32
|
+
name: string;
|
|
33
|
+
triggerSchema?: TTriggerSchema;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new Workflow instance
|
|
36
|
+
* @param name - Identifier for the workflow (not necessarily unique)
|
|
37
|
+
* @param logger - Optional logger instance
|
|
38
|
+
*/
|
|
39
|
+
constructor({ name, triggerSchema, retryConfig, mastra }: WorkflowOptions<TTriggerSchema>);
|
|
40
|
+
step<TStep extends IAction<any, any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>>(step: TStep, config?: StepConfig<TStep, CondStep, VarStep, TTriggerSchema>): this;
|
|
41
|
+
then<TStep extends IAction<any, any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>>(step: TStep, config?: StepConfig<TStep, CondStep, VarStep, TTriggerSchema>): this;
|
|
42
|
+
after<TStep extends IAction<any, any, any, any>>(step: TStep): Omit<typeof this, "then" | "after">;
|
|
43
|
+
/**
|
|
44
|
+
* Executes the workflow with the given trigger data
|
|
45
|
+
* @param triggerData - Initial data to start the workflow with
|
|
46
|
+
* @returns Promise resolving to workflow results or rejecting with error
|
|
47
|
+
* @throws Error if trigger schema validation fails
|
|
48
|
+
*/
|
|
49
|
+
createRun(): WorkflowResultReturn<TTriggerSchema>;
|
|
50
|
+
/**
|
|
51
|
+
* Rebuilds the machine with the current steps configuration and validates the workflow
|
|
52
|
+
*
|
|
53
|
+
* This is the last step of a workflow builder method chain
|
|
54
|
+
* @throws Error if validation fails
|
|
55
|
+
*
|
|
56
|
+
* @returns this instance for method chaining
|
|
57
|
+
*/
|
|
58
|
+
commit(): this;
|
|
59
|
+
getExecutionSpan(runId: string): Span | undefined;
|
|
60
|
+
getState(runId: string): Promise<WorkflowRunState | null>;
|
|
61
|
+
watch(onTransition: (state: WorkflowRunState) => void): () => void;
|
|
62
|
+
resume({ runId, stepId, context: resumeContext, }: {
|
|
63
|
+
runId: string;
|
|
64
|
+
stepId: string;
|
|
65
|
+
context?: Record<string, any>;
|
|
66
|
+
}): Promise<{
|
|
67
|
+
triggerData?: z.TypeOf<TTriggerSchema> | undefined;
|
|
68
|
+
results: Record<string, StepResult<any>>;
|
|
69
|
+
} | undefined>;
|
|
70
|
+
_resume({ runId, stepId, context: resumeContext, }: {
|
|
71
|
+
runId: string;
|
|
72
|
+
stepId: string;
|
|
73
|
+
context?: Record<string, any>;
|
|
74
|
+
}): Promise<{
|
|
75
|
+
triggerData?: z.TypeOf<TTriggerSchema> | undefined;
|
|
76
|
+
results: Record<string, StepResult<any>>;
|
|
77
|
+
} | undefined>;
|
|
78
|
+
__registerPrimitives(p: MastraPrimitives): void;
|
|
79
|
+
get stepGraph(): StepGraph;
|
|
80
|
+
get stepSubscriberGraph(): Record<string, StepGraph>;
|
|
81
|
+
get steps(): Record<string, IAction<any, any, any, any>>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export { Step as S, Workflow as W, createStep as c };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { e as StepExecutionContext, f as StepAction, R as RetryConfig, g as MastraPrimitives, h as StepResult, W as WorkflowOptions, I as IAction, i as StepVariableType, j as StepConfig, k as WorkflowRunState, l as StepGraph } from './base-nKCMCNrM.js';
|
|
2
|
+
import { Span } from '@opentelemetry/api';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { M as MastraBase } from './base-D90KQ4XI.js';
|
|
5
|
+
|
|
6
|
+
declare class Step<TStepId extends string = any, TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends StepExecutionContext<TSchemaIn> = StepExecutionContext<TSchemaIn>> implements StepAction<TStepId, TSchemaIn, TSchemaOut, TContext> {
|
|
7
|
+
id: TStepId;
|
|
8
|
+
description?: string;
|
|
9
|
+
inputSchema?: TSchemaIn;
|
|
10
|
+
outputSchema?: TSchemaOut;
|
|
11
|
+
payload?: TSchemaIn extends z.ZodSchema ? Partial<z.infer<TSchemaIn>> : unknown;
|
|
12
|
+
execute?: (context: TContext) => Promise<TSchemaOut extends z.ZodSchema ? z.infer<TSchemaOut> : unknown>;
|
|
13
|
+
retryConfig?: RetryConfig;
|
|
14
|
+
mastra?: MastraPrimitives;
|
|
15
|
+
constructor({ id, description, execute, payload, outputSchema, inputSchema, retryConfig, }: StepAction<TStepId, TSchemaIn, TSchemaOut, TContext>);
|
|
16
|
+
}
|
|
17
|
+
declare function createStep<TId extends string, TSchemaIn extends z.ZodSchema | undefined, TSchemaOut extends z.ZodSchema | undefined, TContext extends StepExecutionContext<TSchemaIn>>(opts: StepAction<TId, TSchemaIn, TSchemaOut, TContext>): Step<TId, TSchemaIn, TSchemaOut, TContext>;
|
|
18
|
+
|
|
19
|
+
interface WorkflowResultReturn<T extends z.ZodType<any>> {
|
|
20
|
+
runId: string;
|
|
21
|
+
start: (props?: {
|
|
22
|
+
triggerData?: z.infer<T>;
|
|
23
|
+
} | undefined) => Promise<{
|
|
24
|
+
triggerData?: z.infer<T>;
|
|
25
|
+
results: Record<string, StepResult<any>>;
|
|
26
|
+
runId: string;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare class Workflow<TSteps extends Step<any, any, any>[] = any, TTriggerSchema extends z.ZodType<any> = any> extends MastraBase {
|
|
31
|
+
#private;
|
|
32
|
+
name: string;
|
|
33
|
+
triggerSchema?: TTriggerSchema;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new Workflow instance
|
|
36
|
+
* @param name - Identifier for the workflow (not necessarily unique)
|
|
37
|
+
* @param logger - Optional logger instance
|
|
38
|
+
*/
|
|
39
|
+
constructor({ name, triggerSchema, retryConfig, mastra }: WorkflowOptions<TTriggerSchema>);
|
|
40
|
+
step<TStep extends IAction<any, any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>>(step: TStep, config?: StepConfig<TStep, CondStep, VarStep, TTriggerSchema>): this;
|
|
41
|
+
then<TStep extends IAction<any, any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>>(step: TStep, config?: StepConfig<TStep, CondStep, VarStep, TTriggerSchema>): this;
|
|
42
|
+
after<TStep extends IAction<any, any, any, any>>(step: TStep): Omit<typeof this, "then" | "after">;
|
|
43
|
+
/**
|
|
44
|
+
* Executes the workflow with the given trigger data
|
|
45
|
+
* @param triggerData - Initial data to start the workflow with
|
|
46
|
+
* @returns Promise resolving to workflow results or rejecting with error
|
|
47
|
+
* @throws Error if trigger schema validation fails
|
|
48
|
+
*/
|
|
49
|
+
createRun(): WorkflowResultReturn<TTriggerSchema>;
|
|
50
|
+
/**
|
|
51
|
+
* Rebuilds the machine with the current steps configuration and validates the workflow
|
|
52
|
+
*
|
|
53
|
+
* This is the last step of a workflow builder method chain
|
|
54
|
+
* @throws Error if validation fails
|
|
55
|
+
*
|
|
56
|
+
* @returns this instance for method chaining
|
|
57
|
+
*/
|
|
58
|
+
commit(): this;
|
|
59
|
+
getExecutionSpan(runId: string): Span | undefined;
|
|
60
|
+
getState(runId: string): Promise<WorkflowRunState | null>;
|
|
61
|
+
watch(onTransition: (state: WorkflowRunState) => void): () => void;
|
|
62
|
+
resume({ runId, stepId, context: resumeContext, }: {
|
|
63
|
+
runId: string;
|
|
64
|
+
stepId: string;
|
|
65
|
+
context?: Record<string, any>;
|
|
66
|
+
}): Promise<{
|
|
67
|
+
triggerData?: z.TypeOf<TTriggerSchema> | undefined;
|
|
68
|
+
results: Record<string, StepResult<any>>;
|
|
69
|
+
} | undefined>;
|
|
70
|
+
_resume({ runId, stepId, context: resumeContext, }: {
|
|
71
|
+
runId: string;
|
|
72
|
+
stepId: string;
|
|
73
|
+
context?: Record<string, any>;
|
|
74
|
+
}): Promise<{
|
|
75
|
+
triggerData?: z.TypeOf<TTriggerSchema> | undefined;
|
|
76
|
+
results: Record<string, StepResult<any>>;
|
|
77
|
+
} | undefined>;
|
|
78
|
+
__registerPrimitives(p: MastraPrimitives): void;
|
|
79
|
+
get stepGraph(): StepGraph;
|
|
80
|
+
get stepSubscriberGraph(): Record<string, StepGraph>;
|
|
81
|
+
get steps(): Record<string, IAction<any, any, any, any>>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export { Step as S, Workflow as W, createStep as c };
|