@mastra/inngest 1.0.0-beta.12 → 1.0.0-beta.13
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/CHANGELOG.md +94 -0
- package/dist/execution-engine.d.ts +87 -2
- package/dist/execution-engine.d.ts.map +1 -1
- package/dist/index.cjs +853 -203
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +63 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +854 -204
- package/dist/index.js.map +1 -1
- package/dist/run.d.ts +48 -37
- package/dist/run.d.ts.map +1 -1
- package/dist/types.d.ts +4 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/workflow.d.ts +1 -2
- package/dist/workflow.d.ts.map +1 -1
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Agent } from '@mastra/core/agent';
|
|
2
2
|
import type { MastraScorers } from '@mastra/core/evals';
|
|
3
|
+
import type { Processor } from '@mastra/core/processors';
|
|
4
|
+
import { ProcessorStepOutputSchema, ProcessorStepSchema } from '@mastra/core/processors';
|
|
5
|
+
import type { OutputSchema } from '@mastra/core/stream';
|
|
3
6
|
import type { ToolExecutionContext } from '@mastra/core/tools';
|
|
7
|
+
import { Tool } from '@mastra/core/tools';
|
|
4
8
|
import type { DynamicArgument } from '@mastra/core/types';
|
|
5
|
-
import type { Step, AgentStepOptions, StepParams
|
|
9
|
+
import type { Step, AgentStepOptions, StepParams } from '@mastra/core/workflows';
|
|
6
10
|
import { Workflow } from '@mastra/core/workflows';
|
|
7
11
|
import type { Inngest } from 'inngest';
|
|
8
12
|
import { z } from 'zod';
|
|
@@ -14,44 +18,75 @@ export * from './pubsub.js';
|
|
|
14
18
|
export * from './run.js';
|
|
15
19
|
export * from './serve.js';
|
|
16
20
|
export * from './types.js';
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Creates a step from explicit params (IMPORTANT: FIRST overload for best error messages when using .then in workflows)
|
|
23
|
+
* @param params Configuration parameters for the step
|
|
24
|
+
* @param params.id Unique identifier for the step
|
|
25
|
+
* @param params.description Optional description of what the step does
|
|
26
|
+
* @param params.inputSchema Zod schema defining the input structure
|
|
27
|
+
* @param params.outputSchema Zod schema defining the output structure
|
|
28
|
+
* @param params.execute Function that performs the step's operations
|
|
29
|
+
* @returns A Step object that can be added to the workflow
|
|
30
|
+
*/
|
|
31
|
+
export declare function createStep<TStepId extends string, TStateSchema extends z.ZodTypeAny | undefined, TInputSchema extends z.ZodTypeAny, TOutputSchema extends z.ZodTypeAny, TResumeSchema extends z.ZodTypeAny | undefined = undefined, TSuspendSchema extends z.ZodTypeAny | undefined = undefined>(params: StepParams<TStepId, TStateSchema, TInputSchema, TOutputSchema, TResumeSchema, TSuspendSchema>): Step<TStepId, TStateSchema extends z.ZodTypeAny ? z.infer<TStateSchema> : unknown, z.infer<TInputSchema>, z.infer<TOutputSchema>, TResumeSchema extends z.ZodTypeAny ? z.infer<TResumeSchema> : unknown, TSuspendSchema extends z.ZodTypeAny ? z.infer<TSuspendSchema> : unknown, InngestEngineType>;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a step from an agent with structured output
|
|
34
|
+
*/
|
|
35
|
+
export declare function createStep<TStepId extends string, TStepOutput>(agent: Agent<TStepId, any>, agentOptions: AgentStepOptions<TStepOutput> & {
|
|
19
36
|
structuredOutput: {
|
|
20
|
-
schema: TStepOutput
|
|
37
|
+
schema: OutputSchema<TStepOutput>;
|
|
21
38
|
};
|
|
22
39
|
retries?: number;
|
|
23
40
|
scorers?: DynamicArgument<MastraScorers>;
|
|
24
|
-
}): Step<TStepId,
|
|
25
|
-
prompt:
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
41
|
+
}): Step<TStepId, unknown, {
|
|
42
|
+
prompt: string;
|
|
43
|
+
}, TStepOutput, unknown, unknown, InngestEngineType>;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a step from an agent (defaults to { text: string } output)
|
|
46
|
+
*/
|
|
47
|
+
export declare function createStep<TStepId extends string, TStepInput extends {
|
|
48
|
+
prompt: string;
|
|
49
|
+
}, TStepOutput extends {
|
|
50
|
+
text: string;
|
|
51
|
+
}, TResume, TSuspend>(agent: Agent<TStepId, any>): Step<TStepId, unknown, TStepInput, TStepOutput, TResume, TSuspend, InngestEngineType>;
|
|
52
|
+
/**
|
|
53
|
+
* Creates a step from a tool
|
|
54
|
+
*/
|
|
55
|
+
export declare function createStep<TSchemaIn, TSuspend, TResume, TSchemaOut, TContext extends ToolExecutionContext<TSuspend, TResume>, TId extends string>(tool: Tool<TSchemaIn, TSchemaOut, TSuspend, TResume, TContext, TId>, toolOptions?: {
|
|
32
56
|
retries?: number;
|
|
33
57
|
scorers?: DynamicArgument<MastraScorers>;
|
|
34
|
-
}): Step<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
58
|
+
}): Step<TId, unknown, TSchemaIn, TSchemaOut, TSuspend, TResume, InngestEngineType>;
|
|
59
|
+
/**
|
|
60
|
+
* Creates a step from a Processor - wraps a Processor as a workflow step
|
|
61
|
+
* Note: We require at least one processor method to distinguish from StepParams
|
|
62
|
+
*/
|
|
63
|
+
export declare function createStep<TProcessorId extends string>(processor: (Processor<TProcessorId> & {
|
|
64
|
+
processInput: Function;
|
|
65
|
+
}) | (Processor<TProcessorId> & {
|
|
66
|
+
processInputStream: Function;
|
|
67
|
+
}) | (Processor<TProcessorId> & {
|
|
68
|
+
processInputStep: Function;
|
|
69
|
+
}) | (Processor<TProcessorId> & {
|
|
70
|
+
processOutputStream: Function;
|
|
71
|
+
}) | (Processor<TProcessorId> & {
|
|
72
|
+
processOutputResult: Function;
|
|
73
|
+
}) | (Processor<TProcessorId> & {
|
|
74
|
+
processOutputStep: Function;
|
|
75
|
+
})): Step<`processor:${TProcessorId}`, unknown, typeof ProcessorStepSchema, typeof ProcessorStepOutputSchema, unknown, unknown, InngestEngineType>;
|
|
76
|
+
/**
|
|
77
|
+
* IMPORTANT: Fallback overload - provides better error messages when StepParams doesn't match
|
|
78
|
+
* This should be LAST and will show clearer errors about what's wrong
|
|
79
|
+
* This is a copy of first one, KEEP THIS IN SYNC!
|
|
80
|
+
*/
|
|
81
|
+
export declare function createStep<TStepId extends string, TStateSchema extends z.ZodTypeAny | undefined, TInputSchema extends z.ZodTypeAny, TOutputSchema extends z.ZodTypeAny, TResumeSchema extends z.ZodTypeAny | undefined = undefined, TSuspendSchema extends z.ZodTypeAny | undefined = undefined>(params: StepParams<TStepId, TStateSchema, TInputSchema, TOutputSchema, TResumeSchema, TSuspendSchema>): Step<TStepId, TStateSchema extends z.ZodTypeAny ? z.infer<TStateSchema> : unknown, z.infer<TInputSchema>, z.infer<TOutputSchema>, TResumeSchema extends z.ZodTypeAny ? z.infer<TResumeSchema> : unknown, TSuspendSchema extends z.ZodTypeAny ? z.infer<TSuspendSchema> : unknown, InngestEngineType>;
|
|
39
82
|
export declare function init(inngest: Inngest): {
|
|
40
|
-
createWorkflow<TWorkflowId extends string = string, TState extends
|
|
41
|
-
[x: string]: any;
|
|
42
|
-
}, {
|
|
43
|
-
[x: string]: any;
|
|
44
|
-
}>, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends Step<string, any, any, any, any, any, InngestEngineType>[] = Step<string, any, any, any, any, any, InngestEngineType>[]>(params: InngestWorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps>): InngestWorkflow<InngestEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TInput>;
|
|
83
|
+
createWorkflow<TWorkflowId extends string = string, TState = any, TInput = any, TOutput = any, TSteps extends Step<string, any, any, any, any, any, InngestEngineType>[] = Step<string, any, any, any, any, any, InngestEngineType>[]>(params: InngestWorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps>): InngestWorkflow<InngestEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TInput>;
|
|
45
84
|
createStep: typeof createStep;
|
|
46
85
|
cloneStep<TStepId extends string>(step: Step<TStepId, any, any, any, any, any, InngestEngineType>, opts: {
|
|
47
86
|
id: TStepId;
|
|
48
87
|
}): Step<TStepId, any, any, any, any, any, InngestEngineType>;
|
|
49
|
-
cloneWorkflow<TWorkflowId extends string = string, TState extends
|
|
50
|
-
[x: string]: any;
|
|
51
|
-
}, {
|
|
52
|
-
[x: string]: any;
|
|
53
|
-
}>, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends Step<string, any, any, any, any, any, InngestEngineType>[] = Step<string, any, any, any, any, any, InngestEngineType>[], TPrevSchema extends z.ZodType<any> = TInput>(workflow: Workflow<InngestEngineType, TSteps, string, TState, TInput, TOutput, TPrevSchema>, opts: {
|
|
88
|
+
cloneWorkflow<TWorkflowId extends string = string, TState = unknown, TInput = unknown, TOutput = unknown, TSteps extends Step<string, any, any, any, any, any, InngestEngineType>[] = Step<string, any, any, any, any, any, InngestEngineType>[], TPrev = TInput>(workflow: Workflow<InngestEngineType, TSteps, string, TState, TInput, TOutput, TPrev>, opts: {
|
|
54
89
|
id: TWorkflowId;
|
|
55
|
-
}): Workflow<InngestEngineType, TSteps, TWorkflowId, TState, TInput, TOutput,
|
|
90
|
+
}): Workflow<InngestEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TPrev>;
|
|
56
91
|
};
|
|
57
92
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,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