@mastra/core 0.9.4 → 0.10.0-alpha.1
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/README.md +3 -2
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.d.cts +13 -14
- package/dist/agent/index.d.ts +13 -14
- package/dist/agent/index.js +1 -1
- package/dist/{base-BCfssGt6.d.ts → base-DttB7sJD.d.ts} +1187 -886
- package/dist/{base-CAEcd6q2.d.cts → base-aJ3etsh5.d.cts} +1187 -886
- package/dist/{base-H7siSAfu.d.cts → base-aPYtPBT2.d.cts} +3 -3
- package/dist/{base-4Z34GQL8.d.ts → base-tc5kgDTD.d.ts} +3 -3
- package/dist/base.cjs +2 -2
- package/dist/base.d.cts +2 -3
- package/dist/base.d.ts +2 -3
- package/dist/base.js +1 -1
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.d.cts +2 -3
- package/dist/bundler/index.d.ts +2 -3
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-W4BSLENO.js → chunk-2NTUAUGH.js} +1 -1
- package/dist/{chunk-S34QVMKE.js → chunk-2PW6UJMW.js} +77 -10
- package/dist/{chunk-WE36CRQV.cjs → chunk-2U7ZZUFO.cjs} +2 -2
- package/dist/{workflows/vNext/index.js → chunk-3SQ3G2EJ.js} +19 -16
- package/dist/chunk-5HULBQ2W.cjs +38 -0
- package/dist/{chunk-XRGDVLM4.cjs → chunk-5JRD3NDP.cjs} +15 -15
- package/dist/{chunk-GXKODTLA.cjs → chunk-5W2G7S44.cjs} +83 -68
- package/dist/chunk-75Z4BZEE.js +36 -0
- package/dist/{chunk-66GQROSI.cjs → chunk-AOGUTJUO.cjs} +58 -51
- package/dist/{chunk-WIKOYZ63.js → chunk-BPTSLJHA.js} +9 -9
- package/dist/{chunk-JBJ7KXN5.js → chunk-C3ICEF6E.js} +1 -1
- package/dist/{chunk-E4FAXBUV.cjs → chunk-CWSFP2HS.cjs} +2 -2
- package/dist/{chunk-FW5RS6WV.js → chunk-E7CLY6SK.js} +42 -35
- package/dist/{chunk-235X76GC.js → chunk-FI7R232B.js} +2 -2
- package/dist/chunk-GQ2XQ4UN.js +321 -0
- package/dist/{chunk-H4CEZSRM.js → chunk-J7GDGV6F.js} +1 -1
- package/dist/{chunk-NLBJOFNG.js → chunk-JW5TMK2L.js} +1 -1
- package/dist/{chunk-NOPY74PV.js → chunk-KJQFFEEQ.js} +1 -1
- package/dist/{chunk-V2Q2FEVO.cjs → chunk-KSPHQSZX.cjs} +2 -2
- package/dist/{chunk-NZV4OA6P.js → chunk-LHRZV5VG.js} +2 -23
- package/dist/chunk-NMDM4IZN.cjs +78 -0
- package/dist/chunk-OBEALYTK.js +74 -0
- package/dist/{chunk-PEK4TY3P.js → chunk-OCT2762Q.js} +1 -1
- package/dist/{chunk-5DUFC7TV.cjs → chunk-P7BGXOQV.cjs} +2 -2
- package/dist/{chunk-WQKOM7XM.cjs → chunk-PIZM25KI.cjs} +3 -24
- package/dist/{chunk-S7J63JOG.cjs → chunk-RVS6OUJN.cjs} +2 -2
- package/dist/{chunk-5JUWUTPJ.cjs → chunk-SKG2NIZW.cjs} +2 -2
- package/dist/chunk-SWW4EBUZ.cjs +96 -0
- package/dist/{chunk-RGE4UF6A.cjs → chunk-TMPFLJLG.cjs} +2 -2
- package/dist/{workflows/vNext/index.cjs → chunk-TTKQ37ZZ.cjs} +24 -21
- package/dist/{chunk-EJITEVAB.cjs → chunk-U3L3NEOM.cjs} +81 -10
- package/dist/chunk-VHLL4AZK.js +90 -0
- package/dist/{chunk-EG74VBSP.cjs → chunk-YEULQPUY.cjs} +6 -6
- package/dist/{chunk-SOLXHDNQ.js → chunk-ZB3LEHL2.js} +81 -66
- package/dist/{chunk-TAFOICHR.js → chunk-ZKN6HYYQ.js} +1 -1
- package/dist/chunk-ZZDAC5KD.cjs +325 -0
- package/dist/deployer/index.cjs +2 -2
- package/dist/deployer/index.d.cts +2 -3
- package/dist/deployer/index.d.ts +2 -3
- package/dist/deployer/index.js +1 -1
- package/dist/eval/index.d.cts +13 -14
- package/dist/eval/index.d.ts +13 -14
- package/dist/hooks/index.d.cts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/index.cjs +88 -159
- package/dist/index.d.cts +17 -25
- package/dist/index.d.ts +17 -25
- package/dist/index.js +18 -25
- package/dist/integration/index.cjs +3 -3
- package/dist/integration/index.d.cts +12 -13
- package/dist/integration/index.d.ts +12 -13
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.d.cts +13 -14
- package/dist/llm/index.d.ts +13 -14
- package/dist/logger/index.cjs +18 -17
- package/dist/logger/index.d.cts +42 -2
- package/dist/logger/index.d.ts +42 -2
- package/dist/logger/index.js +2 -1
- package/dist/{index-QV27jkxQ.d.ts → logger-EhZkzZOr.d.cts} +38 -52
- package/dist/{index-QV27jkxQ.d.cts → logger-EhZkzZOr.d.ts} +38 -52
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.cts +11 -12
- package/dist/mastra/index.d.ts +11 -12
- package/dist/mastra/index.js +1 -1
- package/dist/mcp/index.cjs +75 -17
- package/dist/mcp/index.d.cts +14 -15
- package/dist/mcp/index.d.ts +14 -15
- package/dist/mcp/index.js +69 -15
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.d.cts +12 -13
- package/dist/memory/index.d.ts +12 -13
- package/dist/memory/index.js +1 -1
- package/dist/network/index.cjs +8 -8
- package/dist/network/index.d.cts +12 -13
- package/dist/network/index.d.ts +12 -13
- package/dist/network/index.js +5 -5
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.d.cts +15 -16
- package/dist/relevance/index.d.ts +15 -16
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.cjs +4 -0
- package/dist/server/index.d.cts +13 -12
- package/dist/server/index.d.ts +13 -12
- package/dist/server/index.js +4 -1
- package/dist/storage/index.cjs +184 -3
- package/dist/storage/index.d.cts +83 -13
- package/dist/storage/index.d.ts +83 -13
- package/dist/storage/index.js +186 -1
- package/dist/telemetry/index.d.cts +14 -15
- package/dist/telemetry/index.d.ts +14 -15
- package/dist/telemetry/otel-vendor.cjs +2 -2
- package/dist/telemetry/otel-vendor.d.cts +1 -1
- package/dist/telemetry/otel-vendor.d.ts +1 -1
- package/dist/telemetry/otel-vendor.js +1 -1
- package/dist/tools/index.cjs +4 -4
- package/dist/tools/index.d.cts +12 -13
- package/dist/tools/index.d.ts +12 -13
- package/dist/tools/index.js +1 -1
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.d.cts +2 -3
- package/dist/tts/index.d.ts +2 -3
- package/dist/tts/index.js +1 -1
- package/dist/{types-BtMyV38I.d.ts → types-Bo1uigWx.d.cts} +1 -1
- package/dist/{types-BtMyV38I.d.cts → types-Bo1uigWx.d.ts} +1 -1
- package/dist/utils.cjs +28 -12
- package/dist/utils.d.cts +59 -16
- package/dist/utils.d.ts +59 -16
- package/dist/utils.js +1 -1
- package/dist/vector/filter/index.cjs +189 -7
- package/dist/vector/filter/index.js +190 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.d.cts +28 -20
- package/dist/vector/index.d.ts +28 -20
- package/dist/vector/index.js +1 -1
- package/dist/voice/index.cjs +4 -4
- package/dist/voice/index.d.cts +12 -13
- package/dist/voice/index.d.ts +12 -13
- package/dist/voice/index.js +1 -1
- package/dist/workflows/index.cjs +17 -69
- package/dist/workflows/index.d.cts +197 -77
- package/dist/workflows/index.d.ts +197 -77
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/legacy/index.cjs +90 -0
- package/dist/workflows/legacy/index.d.cts +87 -0
- package/dist/workflows/legacy/index.d.ts +87 -0
- package/dist/workflows/legacy/index.js +1 -0
- package/package.json +19 -40
- package/workflows/legacy.d.ts +1 -0
- package/dist/chunk-4WABQORE.js +0 -781
- package/dist/chunk-CIEPFV6B.js +0 -658
- package/dist/chunk-CMPPXW4U.js +0 -154
- package/dist/chunk-CTKNWYK2.js +0 -131
- package/dist/chunk-LGERQTJM.js +0 -190
- package/dist/chunk-O44MSFMZ.cjs +0 -168
- package/dist/chunk-QDAMIZY3.cjs +0 -783
- package/dist/chunk-QHDPLMHB.cjs +0 -667
- package/dist/chunk-RAQBTCIR.cjs +0 -134
- package/dist/chunk-YK3XJ52U.cjs +0 -192
- package/dist/storage/libsql/index.cjs +0 -581
- package/dist/storage/libsql/index.d.cts +0 -104
- package/dist/storage/libsql/index.d.ts +0 -104
- package/dist/storage/libsql/index.js +0 -578
- package/dist/vector/libsql/index.cjs +0 -14
- package/dist/vector/libsql/index.d.cts +0 -82
- package/dist/vector/libsql/index.d.ts +0 -82
- package/dist/vector/libsql/index.js +0 -1
- package/dist/workflows/vNext/index.d.cts +0 -209
- package/dist/workflows/vNext/index.d.ts +0 -209
- package/storage/libsql.d.ts +0 -1
- package/vector/libsql.d.ts +0 -1
- package/workflows/vNext.d.ts +0 -1
|
@@ -1,88 +1,208 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { L as Logger } from '../index-QV27jkxQ.cjs';
|
|
6
|
-
import '../base-H7siSAfu.cjs';
|
|
1
|
+
import { a$ as ExecutionEngine, b4 as StepResult, a_ as ExecutionGraph, aR as StepFlowEntry, ae as Step, b0 as ExecuteFunction } from '../base-aJ3etsh5.cjs';
|
|
2
|
+
export { b6 as DynamicMapping, b9 as ExtractSchemaFromStep, b8 as ExtractSchemaType, b7 as PathsToStringProps, aZ as Run, aS as SerializedStep, aT as SerializedStepFlowEntry, b2 as StepFailure, b1 as StepSuccess, b3 as StepSuspended, b5 as StepsRecord, ba as VariableReference, bb as WatchEvent, af as Workflow, ag as WorkflowConfig, aY as WorkflowResult, bd as WorkflowRunState, bc as ZodPathType, aV as cloneStep, aX as cloneWorkflow, aU as createStep, aW as createWorkflow } from '../base-aJ3etsh5.cjs';
|
|
3
|
+
import { Span } from '@opentelemetry/api';
|
|
4
|
+
import { RuntimeContext } from '../runtime-context/index.cjs';
|
|
7
5
|
import 'ai';
|
|
8
|
-
import '
|
|
9
|
-
import '
|
|
10
|
-
import '../runtime-context/index.cjs';
|
|
11
|
-
import '@opentelemetry/api';
|
|
12
|
-
import 'xstate';
|
|
13
|
-
import 'node:events';
|
|
14
|
-
import '../vector/index.cjs';
|
|
15
|
-
import '../vector/filter/index.cjs';
|
|
6
|
+
import '../base-aPYtPBT2.cjs';
|
|
7
|
+
import '../logger-EhZkzZOr.cjs';
|
|
16
8
|
import 'stream';
|
|
17
|
-
import 'pino';
|
|
18
9
|
import '@opentelemetry/sdk-trace-base';
|
|
19
|
-
import '../
|
|
20
|
-
import '
|
|
21
|
-
import '
|
|
22
|
-
import '
|
|
10
|
+
import '../types-Bo1uigWx.cjs';
|
|
11
|
+
import 'sift';
|
|
12
|
+
import 'zod';
|
|
13
|
+
import 'json-schema';
|
|
23
14
|
import '../deployer/index.cjs';
|
|
24
15
|
import '../bundler/index.cjs';
|
|
16
|
+
import 'node:http';
|
|
17
|
+
import 'hono';
|
|
18
|
+
import '../vector/index.cjs';
|
|
19
|
+
import '../vector/filter/index.cjs';
|
|
25
20
|
import 'hono/cors';
|
|
26
21
|
import 'hono-openapi';
|
|
22
|
+
import '../tts/index.cjs';
|
|
23
|
+
import 'xstate';
|
|
24
|
+
import 'node:events';
|
|
25
|
+
import 'events';
|
|
27
26
|
import 'ai/test';
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
error: Error;
|
|
32
|
-
};
|
|
33
|
-
declare function isTransitionEvent(stateEvent: any): stateEvent is {
|
|
34
|
-
type: `xstate.done.actor.${string}`;
|
|
35
|
-
output?: unknown;
|
|
36
|
-
};
|
|
37
|
-
declare function isVariableReference(value: any): value is VariableReference<any, any>;
|
|
38
|
-
declare function getStepResult(result?: StepResult<any>): any;
|
|
39
|
-
declare function getSuspendedPaths({ value, path, suspendedPaths, }: {
|
|
40
|
-
value: string | Record<string, string>;
|
|
41
|
-
path: string;
|
|
42
|
-
suspendedPaths: Set<string>;
|
|
43
|
-
}): void;
|
|
44
|
-
declare function isFinalState(status: string): boolean;
|
|
45
|
-
declare function isLimboState(status: string): boolean;
|
|
46
|
-
declare function recursivelyCheckForFinalState({ value, suspendedPaths, path, }: {
|
|
47
|
-
value: string | Record<string, string>;
|
|
48
|
-
suspendedPaths: Set<string>;
|
|
49
|
-
path: string;
|
|
50
|
-
}): boolean;
|
|
51
|
-
declare function getActivePathsAndStatus(value: Record<string, any>): Array<{
|
|
52
|
-
stepPath: string[];
|
|
53
|
-
stepId: string;
|
|
54
|
-
status: string;
|
|
55
|
-
}>;
|
|
56
|
-
declare function mergeChildValue(startStepId: string, parent: Record<string, any>, child: Record<string, any>): Record<string, any>;
|
|
57
|
-
declare const updateStepInHierarchy: (value: Record<string, any>, targetStepId: string) => Record<string, any>;
|
|
58
|
-
declare function getResultActivePaths(state: {
|
|
59
|
-
value: Record<string, string>;
|
|
60
|
-
context: {
|
|
61
|
-
steps: Record<string, any>;
|
|
62
|
-
};
|
|
63
|
-
}): Map<string, {
|
|
64
|
-
status: string;
|
|
65
|
-
suspendPayload?: any;
|
|
66
|
-
stepPath: string[];
|
|
67
|
-
}>;
|
|
68
|
-
declare function isWorkflow(step: Step<any, any, any, any> | Workflow<any, any, any, any> | Agent<any, any, any>): step is Workflow<any, any, any, any>;
|
|
69
|
-
declare function isAgent(step: Step<any, any, any, any> | Agent<any, any, any> | Workflow<any, any, any, any>): step is Agent<any, any, any>;
|
|
70
|
-
declare function resolveVariables({ runId, logger, variables, context, }: {
|
|
28
|
+
type ExecutionContext = {
|
|
29
|
+
workflowId: string;
|
|
71
30
|
runId: string;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
declare
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
31
|
+
executionPath: number[];
|
|
32
|
+
suspendedPaths: Record<string, number[]>;
|
|
33
|
+
retryConfig: {
|
|
34
|
+
attempts: number;
|
|
35
|
+
delay: number;
|
|
36
|
+
};
|
|
37
|
+
executionSpan: Span;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Default implementation of the ExecutionEngine using XState
|
|
41
|
+
*/
|
|
42
|
+
declare class DefaultExecutionEngine extends ExecutionEngine {
|
|
43
|
+
protected fmtReturnValue<TOutput>(executionSpan: Span | undefined, emitter: {
|
|
44
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
45
|
+
}, stepResults: Record<string, StepResult<any>>, lastOutput: StepResult<any>, error?: Error | string): Promise<TOutput>;
|
|
46
|
+
/**
|
|
47
|
+
* Executes a workflow run with the provided execution graph and input
|
|
48
|
+
* @param graph The execution graph to execute
|
|
49
|
+
* @param input The input data for the workflow
|
|
50
|
+
* @returns A promise that resolves to the workflow output
|
|
51
|
+
*/
|
|
52
|
+
execute<TInput, TOutput>(params: {
|
|
53
|
+
workflowId: string;
|
|
54
|
+
runId: string;
|
|
55
|
+
graph: ExecutionGraph;
|
|
56
|
+
input?: TInput;
|
|
57
|
+
resume?: {
|
|
58
|
+
steps: string[];
|
|
59
|
+
stepResults: Record<string, StepResult<any>>;
|
|
60
|
+
resumePayload: any;
|
|
61
|
+
resumePath: number[];
|
|
62
|
+
};
|
|
63
|
+
emitter: {
|
|
64
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
65
|
+
};
|
|
66
|
+
retryConfig?: {
|
|
67
|
+
attempts?: number;
|
|
68
|
+
delay?: number;
|
|
69
|
+
};
|
|
70
|
+
runtimeContext: RuntimeContext;
|
|
71
|
+
}): Promise<TOutput>;
|
|
72
|
+
getStepOutput(stepResults: Record<string, any>, step?: StepFlowEntry): any;
|
|
73
|
+
executeStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
|
|
74
|
+
workflowId: string;
|
|
75
|
+
runId: string;
|
|
76
|
+
step: Step<string, any, any>;
|
|
77
|
+
stepResults: Record<string, StepResult<any>>;
|
|
78
|
+
executionContext: ExecutionContext;
|
|
79
|
+
resume?: {
|
|
80
|
+
steps: string[];
|
|
81
|
+
resumePayload: any;
|
|
82
|
+
};
|
|
83
|
+
prevOutput: any;
|
|
84
|
+
emitter: {
|
|
85
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
86
|
+
};
|
|
87
|
+
runtimeContext: RuntimeContext;
|
|
88
|
+
}): Promise<StepResult<any>>;
|
|
89
|
+
executeParallel({ workflowId, runId, entry, prevStep, stepResults, resume, executionContext, emitter, runtimeContext, }: {
|
|
90
|
+
workflowId: string;
|
|
91
|
+
runId: string;
|
|
92
|
+
entry: {
|
|
93
|
+
type: 'parallel';
|
|
94
|
+
steps: StepFlowEntry[];
|
|
95
|
+
};
|
|
96
|
+
prevStep: StepFlowEntry;
|
|
97
|
+
stepResults: Record<string, StepResult<any>>;
|
|
98
|
+
resume?: {
|
|
99
|
+
steps: string[];
|
|
100
|
+
stepResults: Record<string, StepResult<any>>;
|
|
101
|
+
resumePayload: any;
|
|
102
|
+
resumePath: number[];
|
|
103
|
+
};
|
|
104
|
+
executionContext: ExecutionContext;
|
|
105
|
+
emitter: {
|
|
106
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
107
|
+
};
|
|
108
|
+
runtimeContext: RuntimeContext;
|
|
109
|
+
}): Promise<StepResult<any>>;
|
|
110
|
+
executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, resume, executionContext, emitter, runtimeContext, }: {
|
|
111
|
+
workflowId: string;
|
|
112
|
+
runId: string;
|
|
113
|
+
entry: {
|
|
114
|
+
type: 'conditional';
|
|
115
|
+
steps: StepFlowEntry[];
|
|
116
|
+
conditions: ExecuteFunction<any, any, any, any>[];
|
|
117
|
+
};
|
|
118
|
+
prevStep: StepFlowEntry;
|
|
119
|
+
prevOutput: any;
|
|
120
|
+
stepResults: Record<string, StepResult<any>>;
|
|
121
|
+
resume?: {
|
|
122
|
+
steps: string[];
|
|
123
|
+
stepResults: Record<string, StepResult<any>>;
|
|
124
|
+
resumePayload: any;
|
|
125
|
+
resumePath: number[];
|
|
126
|
+
};
|
|
127
|
+
executionContext: ExecutionContext;
|
|
128
|
+
emitter: {
|
|
129
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
130
|
+
};
|
|
131
|
+
runtimeContext: RuntimeContext;
|
|
132
|
+
}): Promise<StepResult<any>>;
|
|
133
|
+
executeLoop({ workflowId, runId, entry, prevOutput, stepResults, resume, executionContext, emitter, runtimeContext, }: {
|
|
134
|
+
workflowId: string;
|
|
135
|
+
runId: string;
|
|
136
|
+
entry: {
|
|
137
|
+
type: 'loop';
|
|
138
|
+
step: Step;
|
|
139
|
+
condition: ExecuteFunction<any, any, any, any>;
|
|
140
|
+
loopType: 'dowhile' | 'dountil';
|
|
141
|
+
};
|
|
142
|
+
prevStep: StepFlowEntry;
|
|
143
|
+
prevOutput: any;
|
|
144
|
+
stepResults: Record<string, StepResult<any>>;
|
|
145
|
+
resume?: {
|
|
146
|
+
steps: string[];
|
|
147
|
+
stepResults: Record<string, StepResult<any>>;
|
|
148
|
+
resumePayload: any;
|
|
149
|
+
resumePath: number[];
|
|
150
|
+
};
|
|
151
|
+
executionContext: ExecutionContext;
|
|
152
|
+
emitter: {
|
|
153
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
154
|
+
};
|
|
155
|
+
runtimeContext: RuntimeContext;
|
|
156
|
+
}): Promise<StepResult<any>>;
|
|
157
|
+
executeForeach({ workflowId, runId, entry, prevOutput, stepResults, resume, executionContext, emitter, runtimeContext, }: {
|
|
158
|
+
workflowId: string;
|
|
159
|
+
runId: string;
|
|
160
|
+
entry: {
|
|
161
|
+
type: 'foreach';
|
|
162
|
+
step: Step;
|
|
163
|
+
opts: {
|
|
164
|
+
concurrency: number;
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
prevStep: StepFlowEntry;
|
|
168
|
+
prevOutput: any;
|
|
169
|
+
stepResults: Record<string, StepResult<any>>;
|
|
170
|
+
resume?: {
|
|
171
|
+
steps: string[];
|
|
172
|
+
stepResults: Record<string, StepResult<any>>;
|
|
173
|
+
resumePayload: any;
|
|
174
|
+
resumePath: number[];
|
|
175
|
+
};
|
|
176
|
+
executionContext: ExecutionContext;
|
|
177
|
+
emitter: {
|
|
178
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
179
|
+
};
|
|
180
|
+
runtimeContext: RuntimeContext;
|
|
181
|
+
}): Promise<StepResult<any>>;
|
|
182
|
+
protected persistStepUpdate({ workflowId, runId, stepResults, executionContext, }: {
|
|
183
|
+
workflowId: string;
|
|
184
|
+
runId: string;
|
|
185
|
+
stepResults: Record<string, StepResult<any>>;
|
|
186
|
+
executionContext: ExecutionContext;
|
|
187
|
+
}): Promise<void>;
|
|
188
|
+
executeEntry({ workflowId, runId, entry, prevStep, stepResults, resume, executionContext, emitter, runtimeContext, }: {
|
|
189
|
+
workflowId: string;
|
|
190
|
+
runId: string;
|
|
191
|
+
entry: StepFlowEntry;
|
|
192
|
+
prevStep: StepFlowEntry;
|
|
193
|
+
stepResults: Record<string, StepResult<any>>;
|
|
194
|
+
resume?: {
|
|
195
|
+
steps: string[];
|
|
196
|
+
stepResults: Record<string, StepResult<any>>;
|
|
197
|
+
resumePayload: any;
|
|
198
|
+
resumePath: number[];
|
|
199
|
+
};
|
|
200
|
+
executionContext: ExecutionContext;
|
|
201
|
+
emitter: {
|
|
202
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
203
|
+
};
|
|
204
|
+
runtimeContext: RuntimeContext;
|
|
205
|
+
}): Promise<StepResult<any>>;
|
|
206
|
+
}
|
|
87
207
|
|
|
88
|
-
export {
|
|
208
|
+
export { DefaultExecutionEngine, ExecuteFunction, type ExecutionContext, ExecutionEngine, ExecutionGraph, Step, StepFlowEntry, StepResult };
|
|
@@ -1,88 +1,208 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { L as Logger } from '../index-QV27jkxQ.js';
|
|
6
|
-
import '../base-4Z34GQL8.js';
|
|
1
|
+
import { a$ as ExecutionEngine, b4 as StepResult, a_ as ExecutionGraph, aR as StepFlowEntry, ae as Step, b0 as ExecuteFunction } from '../base-DttB7sJD.js';
|
|
2
|
+
export { b6 as DynamicMapping, b9 as ExtractSchemaFromStep, b8 as ExtractSchemaType, b7 as PathsToStringProps, aZ as Run, aS as SerializedStep, aT as SerializedStepFlowEntry, b2 as StepFailure, b1 as StepSuccess, b3 as StepSuspended, b5 as StepsRecord, ba as VariableReference, bb as WatchEvent, af as Workflow, ag as WorkflowConfig, aY as WorkflowResult, bd as WorkflowRunState, bc as ZodPathType, aV as cloneStep, aX as cloneWorkflow, aU as createStep, aW as createWorkflow } from '../base-DttB7sJD.js';
|
|
3
|
+
import { Span } from '@opentelemetry/api';
|
|
4
|
+
import { RuntimeContext } from '../runtime-context/index.js';
|
|
7
5
|
import 'ai';
|
|
8
|
-
import '
|
|
9
|
-
import '
|
|
10
|
-
import '../runtime-context/index.js';
|
|
11
|
-
import '@opentelemetry/api';
|
|
12
|
-
import 'xstate';
|
|
13
|
-
import 'node:events';
|
|
14
|
-
import '../vector/index.js';
|
|
15
|
-
import '../vector/filter/index.js';
|
|
6
|
+
import '../base-tc5kgDTD.js';
|
|
7
|
+
import '../logger-EhZkzZOr.js';
|
|
16
8
|
import 'stream';
|
|
17
|
-
import 'pino';
|
|
18
9
|
import '@opentelemetry/sdk-trace-base';
|
|
19
|
-
import '../
|
|
20
|
-
import '
|
|
21
|
-
import '
|
|
22
|
-
import '
|
|
10
|
+
import '../types-Bo1uigWx.js';
|
|
11
|
+
import 'sift';
|
|
12
|
+
import 'zod';
|
|
13
|
+
import 'json-schema';
|
|
23
14
|
import '../deployer/index.js';
|
|
24
15
|
import '../bundler/index.js';
|
|
16
|
+
import 'node:http';
|
|
17
|
+
import 'hono';
|
|
18
|
+
import '../vector/index.js';
|
|
19
|
+
import '../vector/filter/index.js';
|
|
25
20
|
import 'hono/cors';
|
|
26
21
|
import 'hono-openapi';
|
|
22
|
+
import '../tts/index.js';
|
|
23
|
+
import 'xstate';
|
|
24
|
+
import 'node:events';
|
|
25
|
+
import 'events';
|
|
27
26
|
import 'ai/test';
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
error: Error;
|
|
32
|
-
};
|
|
33
|
-
declare function isTransitionEvent(stateEvent: any): stateEvent is {
|
|
34
|
-
type: `xstate.done.actor.${string}`;
|
|
35
|
-
output?: unknown;
|
|
36
|
-
};
|
|
37
|
-
declare function isVariableReference(value: any): value is VariableReference<any, any>;
|
|
38
|
-
declare function getStepResult(result?: StepResult<any>): any;
|
|
39
|
-
declare function getSuspendedPaths({ value, path, suspendedPaths, }: {
|
|
40
|
-
value: string | Record<string, string>;
|
|
41
|
-
path: string;
|
|
42
|
-
suspendedPaths: Set<string>;
|
|
43
|
-
}): void;
|
|
44
|
-
declare function isFinalState(status: string): boolean;
|
|
45
|
-
declare function isLimboState(status: string): boolean;
|
|
46
|
-
declare function recursivelyCheckForFinalState({ value, suspendedPaths, path, }: {
|
|
47
|
-
value: string | Record<string, string>;
|
|
48
|
-
suspendedPaths: Set<string>;
|
|
49
|
-
path: string;
|
|
50
|
-
}): boolean;
|
|
51
|
-
declare function getActivePathsAndStatus(value: Record<string, any>): Array<{
|
|
52
|
-
stepPath: string[];
|
|
53
|
-
stepId: string;
|
|
54
|
-
status: string;
|
|
55
|
-
}>;
|
|
56
|
-
declare function mergeChildValue(startStepId: string, parent: Record<string, any>, child: Record<string, any>): Record<string, any>;
|
|
57
|
-
declare const updateStepInHierarchy: (value: Record<string, any>, targetStepId: string) => Record<string, any>;
|
|
58
|
-
declare function getResultActivePaths(state: {
|
|
59
|
-
value: Record<string, string>;
|
|
60
|
-
context: {
|
|
61
|
-
steps: Record<string, any>;
|
|
62
|
-
};
|
|
63
|
-
}): Map<string, {
|
|
64
|
-
status: string;
|
|
65
|
-
suspendPayload?: any;
|
|
66
|
-
stepPath: string[];
|
|
67
|
-
}>;
|
|
68
|
-
declare function isWorkflow(step: Step<any, any, any, any> | Workflow<any, any, any, any> | Agent<any, any, any>): step is Workflow<any, any, any, any>;
|
|
69
|
-
declare function isAgent(step: Step<any, any, any, any> | Agent<any, any, any> | Workflow<any, any, any, any>): step is Agent<any, any, any>;
|
|
70
|
-
declare function resolveVariables({ runId, logger, variables, context, }: {
|
|
28
|
+
type ExecutionContext = {
|
|
29
|
+
workflowId: string;
|
|
71
30
|
runId: string;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
declare
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
31
|
+
executionPath: number[];
|
|
32
|
+
suspendedPaths: Record<string, number[]>;
|
|
33
|
+
retryConfig: {
|
|
34
|
+
attempts: number;
|
|
35
|
+
delay: number;
|
|
36
|
+
};
|
|
37
|
+
executionSpan: Span;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Default implementation of the ExecutionEngine using XState
|
|
41
|
+
*/
|
|
42
|
+
declare class DefaultExecutionEngine extends ExecutionEngine {
|
|
43
|
+
protected fmtReturnValue<TOutput>(executionSpan: Span | undefined, emitter: {
|
|
44
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
45
|
+
}, stepResults: Record<string, StepResult<any>>, lastOutput: StepResult<any>, error?: Error | string): Promise<TOutput>;
|
|
46
|
+
/**
|
|
47
|
+
* Executes a workflow run with the provided execution graph and input
|
|
48
|
+
* @param graph The execution graph to execute
|
|
49
|
+
* @param input The input data for the workflow
|
|
50
|
+
* @returns A promise that resolves to the workflow output
|
|
51
|
+
*/
|
|
52
|
+
execute<TInput, TOutput>(params: {
|
|
53
|
+
workflowId: string;
|
|
54
|
+
runId: string;
|
|
55
|
+
graph: ExecutionGraph;
|
|
56
|
+
input?: TInput;
|
|
57
|
+
resume?: {
|
|
58
|
+
steps: string[];
|
|
59
|
+
stepResults: Record<string, StepResult<any>>;
|
|
60
|
+
resumePayload: any;
|
|
61
|
+
resumePath: number[];
|
|
62
|
+
};
|
|
63
|
+
emitter: {
|
|
64
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
65
|
+
};
|
|
66
|
+
retryConfig?: {
|
|
67
|
+
attempts?: number;
|
|
68
|
+
delay?: number;
|
|
69
|
+
};
|
|
70
|
+
runtimeContext: RuntimeContext;
|
|
71
|
+
}): Promise<TOutput>;
|
|
72
|
+
getStepOutput(stepResults: Record<string, any>, step?: StepFlowEntry): any;
|
|
73
|
+
executeStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
|
|
74
|
+
workflowId: string;
|
|
75
|
+
runId: string;
|
|
76
|
+
step: Step<string, any, any>;
|
|
77
|
+
stepResults: Record<string, StepResult<any>>;
|
|
78
|
+
executionContext: ExecutionContext;
|
|
79
|
+
resume?: {
|
|
80
|
+
steps: string[];
|
|
81
|
+
resumePayload: any;
|
|
82
|
+
};
|
|
83
|
+
prevOutput: any;
|
|
84
|
+
emitter: {
|
|
85
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
86
|
+
};
|
|
87
|
+
runtimeContext: RuntimeContext;
|
|
88
|
+
}): Promise<StepResult<any>>;
|
|
89
|
+
executeParallel({ workflowId, runId, entry, prevStep, stepResults, resume, executionContext, emitter, runtimeContext, }: {
|
|
90
|
+
workflowId: string;
|
|
91
|
+
runId: string;
|
|
92
|
+
entry: {
|
|
93
|
+
type: 'parallel';
|
|
94
|
+
steps: StepFlowEntry[];
|
|
95
|
+
};
|
|
96
|
+
prevStep: StepFlowEntry;
|
|
97
|
+
stepResults: Record<string, StepResult<any>>;
|
|
98
|
+
resume?: {
|
|
99
|
+
steps: string[];
|
|
100
|
+
stepResults: Record<string, StepResult<any>>;
|
|
101
|
+
resumePayload: any;
|
|
102
|
+
resumePath: number[];
|
|
103
|
+
};
|
|
104
|
+
executionContext: ExecutionContext;
|
|
105
|
+
emitter: {
|
|
106
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
107
|
+
};
|
|
108
|
+
runtimeContext: RuntimeContext;
|
|
109
|
+
}): Promise<StepResult<any>>;
|
|
110
|
+
executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, resume, executionContext, emitter, runtimeContext, }: {
|
|
111
|
+
workflowId: string;
|
|
112
|
+
runId: string;
|
|
113
|
+
entry: {
|
|
114
|
+
type: 'conditional';
|
|
115
|
+
steps: StepFlowEntry[];
|
|
116
|
+
conditions: ExecuteFunction<any, any, any, any>[];
|
|
117
|
+
};
|
|
118
|
+
prevStep: StepFlowEntry;
|
|
119
|
+
prevOutput: any;
|
|
120
|
+
stepResults: Record<string, StepResult<any>>;
|
|
121
|
+
resume?: {
|
|
122
|
+
steps: string[];
|
|
123
|
+
stepResults: Record<string, StepResult<any>>;
|
|
124
|
+
resumePayload: any;
|
|
125
|
+
resumePath: number[];
|
|
126
|
+
};
|
|
127
|
+
executionContext: ExecutionContext;
|
|
128
|
+
emitter: {
|
|
129
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
130
|
+
};
|
|
131
|
+
runtimeContext: RuntimeContext;
|
|
132
|
+
}): Promise<StepResult<any>>;
|
|
133
|
+
executeLoop({ workflowId, runId, entry, prevOutput, stepResults, resume, executionContext, emitter, runtimeContext, }: {
|
|
134
|
+
workflowId: string;
|
|
135
|
+
runId: string;
|
|
136
|
+
entry: {
|
|
137
|
+
type: 'loop';
|
|
138
|
+
step: Step;
|
|
139
|
+
condition: ExecuteFunction<any, any, any, any>;
|
|
140
|
+
loopType: 'dowhile' | 'dountil';
|
|
141
|
+
};
|
|
142
|
+
prevStep: StepFlowEntry;
|
|
143
|
+
prevOutput: any;
|
|
144
|
+
stepResults: Record<string, StepResult<any>>;
|
|
145
|
+
resume?: {
|
|
146
|
+
steps: string[];
|
|
147
|
+
stepResults: Record<string, StepResult<any>>;
|
|
148
|
+
resumePayload: any;
|
|
149
|
+
resumePath: number[];
|
|
150
|
+
};
|
|
151
|
+
executionContext: ExecutionContext;
|
|
152
|
+
emitter: {
|
|
153
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
154
|
+
};
|
|
155
|
+
runtimeContext: RuntimeContext;
|
|
156
|
+
}): Promise<StepResult<any>>;
|
|
157
|
+
executeForeach({ workflowId, runId, entry, prevOutput, stepResults, resume, executionContext, emitter, runtimeContext, }: {
|
|
158
|
+
workflowId: string;
|
|
159
|
+
runId: string;
|
|
160
|
+
entry: {
|
|
161
|
+
type: 'foreach';
|
|
162
|
+
step: Step;
|
|
163
|
+
opts: {
|
|
164
|
+
concurrency: number;
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
prevStep: StepFlowEntry;
|
|
168
|
+
prevOutput: any;
|
|
169
|
+
stepResults: Record<string, StepResult<any>>;
|
|
170
|
+
resume?: {
|
|
171
|
+
steps: string[];
|
|
172
|
+
stepResults: Record<string, StepResult<any>>;
|
|
173
|
+
resumePayload: any;
|
|
174
|
+
resumePath: number[];
|
|
175
|
+
};
|
|
176
|
+
executionContext: ExecutionContext;
|
|
177
|
+
emitter: {
|
|
178
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
179
|
+
};
|
|
180
|
+
runtimeContext: RuntimeContext;
|
|
181
|
+
}): Promise<StepResult<any>>;
|
|
182
|
+
protected persistStepUpdate({ workflowId, runId, stepResults, executionContext, }: {
|
|
183
|
+
workflowId: string;
|
|
184
|
+
runId: string;
|
|
185
|
+
stepResults: Record<string, StepResult<any>>;
|
|
186
|
+
executionContext: ExecutionContext;
|
|
187
|
+
}): Promise<void>;
|
|
188
|
+
executeEntry({ workflowId, runId, entry, prevStep, stepResults, resume, executionContext, emitter, runtimeContext, }: {
|
|
189
|
+
workflowId: string;
|
|
190
|
+
runId: string;
|
|
191
|
+
entry: StepFlowEntry;
|
|
192
|
+
prevStep: StepFlowEntry;
|
|
193
|
+
stepResults: Record<string, StepResult<any>>;
|
|
194
|
+
resume?: {
|
|
195
|
+
steps: string[];
|
|
196
|
+
stepResults: Record<string, StepResult<any>>;
|
|
197
|
+
resumePayload: any;
|
|
198
|
+
resumePath: number[];
|
|
199
|
+
};
|
|
200
|
+
executionContext: ExecutionContext;
|
|
201
|
+
emitter: {
|
|
202
|
+
emit: (event: string, data: any) => Promise<void>;
|
|
203
|
+
};
|
|
204
|
+
runtimeContext: RuntimeContext;
|
|
205
|
+
}): Promise<StepResult<any>>;
|
|
206
|
+
}
|
|
87
207
|
|
|
88
|
-
export {
|
|
208
|
+
export { DefaultExecutionEngine, ExecuteFunction, type ExecutionContext, ExecutionEngine, ExecutionGraph, Step, StepFlowEntry, StepResult };
|
package/dist/workflows/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { DefaultExecutionEngine, ExecutionEngine, Run, Workflow, cloneStep, cloneWorkflow, createStep, createWorkflow } from '../chunk-3SQ3G2EJ.js';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkAOGUTJUO_cjs = require('../../chunk-AOGUTJUO.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "LegacyStep", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkAOGUTJUO_cjs.LegacyStep; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "LegacyWorkflow", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkAOGUTJUO_cjs.LegacyWorkflow; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "WhenConditionReturnValue", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkAOGUTJUO_cjs.WhenConditionReturnValue; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "agentToStep", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkAOGUTJUO_cjs.agentToStep; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "getActivePathsAndStatus", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkAOGUTJUO_cjs.getActivePathsAndStatus; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "getResultActivePaths", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkAOGUTJUO_cjs.getResultActivePaths; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "getStepResult", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkAOGUTJUO_cjs.getStepResult; }
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "getSuspendedPaths", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return chunkAOGUTJUO_cjs.getSuspendedPaths; }
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "isAgent", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () { return chunkAOGUTJUO_cjs.isAgent; }
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "isConditionalKey", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () { return chunkAOGUTJUO_cjs.isConditionalKey; }
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, "isErrorEvent", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () { return chunkAOGUTJUO_cjs.isErrorEvent; }
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, "isFinalState", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () { return chunkAOGUTJUO_cjs.isFinalState; }
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "isLimboState", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () { return chunkAOGUTJUO_cjs.isLimboState; }
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, "isTransitionEvent", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function () { return chunkAOGUTJUO_cjs.isTransitionEvent; }
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "isVariableReference", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function () { return chunkAOGUTJUO_cjs.isVariableReference; }
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, "isWorkflow", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () { return chunkAOGUTJUO_cjs.isWorkflow; }
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(exports, "mergeChildValue", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
get: function () { return chunkAOGUTJUO_cjs.mergeChildValue; }
|
|
74
|
+
});
|
|
75
|
+
Object.defineProperty(exports, "recursivelyCheckForFinalState", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function () { return chunkAOGUTJUO_cjs.recursivelyCheckForFinalState; }
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, "resolveVariables", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () { return chunkAOGUTJUO_cjs.resolveVariables; }
|
|
82
|
+
});
|
|
83
|
+
Object.defineProperty(exports, "updateStepInHierarchy", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: function () { return chunkAOGUTJUO_cjs.updateStepInHierarchy; }
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(exports, "workflowToStep", {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () { return chunkAOGUTJUO_cjs.workflowToStep; }
|
|
90
|
+
});
|