flowcraft 2.0.0 → 2.1.0
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 +1 -1
- package/dist/analysis.d.ts +1 -1
- package/dist/analysis.js +1 -1
- package/dist/{chunk-VFC342WL.js → chunk-4PELJWF7.js} +6 -6
- package/dist/chunk-4PELJWF7.js.map +1 -0
- package/dist/chunk-5EHIPX23.js +202 -0
- package/dist/chunk-5EHIPX23.js.map +1 -0
- package/dist/{chunk-DSZSR7UE.js → chunk-5QMPFUKA.js} +2 -2
- package/dist/chunk-5QMPFUKA.js.map +1 -0
- package/dist/{chunk-6DNEDIIT.js → chunk-5ZWYSKMH.js} +47 -23
- package/dist/chunk-5ZWYSKMH.js.map +1 -0
- package/dist/{chunk-WXT3YEWU.js → chunk-5ZXV3R5D.js} +2 -2
- package/dist/chunk-5ZXV3R5D.js.map +1 -0
- package/dist/{chunk-RYTIQZIB.js → chunk-CO5BTPKI.js} +160 -53
- package/dist/chunk-CO5BTPKI.js.map +1 -0
- package/dist/{chunk-UYPIWXZG.js → chunk-CSZ6EOWG.js} +9 -10
- package/dist/chunk-CSZ6EOWG.js.map +1 -0
- package/dist/chunk-CYHZ2YVH.js +24 -0
- package/dist/chunk-CYHZ2YVH.js.map +1 -0
- package/dist/{chunk-J3RNCPED.js → chunk-DSYAC4WB.js} +2 -2
- package/dist/chunk-DSYAC4WB.js.map +1 -0
- package/dist/{chunk-M23P46ZL.js → chunk-HN72TZY5.js} +10 -5
- package/dist/chunk-HN72TZY5.js.map +1 -0
- package/dist/{chunk-MICPMOTW.js → chunk-KWQHFT7E.js} +2 -2
- package/dist/chunk-KWQHFT7E.js.map +1 -0
- package/dist/chunk-PH2IYZHV.js +48 -0
- package/dist/chunk-PH2IYZHV.js.map +1 -0
- package/dist/{chunk-734J4PTM.js → chunk-QRMUKDSP.js} +56 -15
- package/dist/chunk-QRMUKDSP.js.map +1 -0
- package/dist/{chunk-RAZXOMZC.js → chunk-UETC63DP.js} +7 -6
- package/dist/chunk-UETC63DP.js.map +1 -0
- package/dist/{chunk-RW4FH7IL.js → chunk-UMXW3TCY.js} +60 -30
- package/dist/chunk-UMXW3TCY.js.map +1 -0
- package/dist/context.d.ts +5 -5
- package/dist/context.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/evaluator.d.ts +21 -13
- package/dist/evaluator.js +1 -1
- package/dist/flow.d.ts +4 -3
- package/dist/flow.js +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +15 -15
- package/dist/linter.d.ts +1 -1
- package/dist/linter.js +2 -2
- package/dist/logger.d.ts +5 -5
- package/dist/logger.js +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +1 -1
- package/dist/runtime/adapter.d.ts +20 -4
- package/dist/runtime/adapter.js +13 -13
- package/dist/runtime/executors.d.ts +7 -7
- package/dist/runtime/executors.js +2 -2
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +13 -13
- package/dist/runtime/runtime.d.ts +7 -6
- package/dist/runtime/runtime.js +12 -12
- package/dist/runtime/state.d.ts +2 -2
- package/dist/runtime/state.js +2 -2
- package/dist/runtime/traverser.d.ts +4 -3
- package/dist/runtime/traverser.js +3 -3
- package/dist/runtime/types.d.ts +1 -1
- package/dist/sanitizer.d.ts +1 -1
- package/dist/sanitizer.js +1 -1
- package/dist/serializer.d.ts +2 -1
- package/dist/serializer.js +1 -1
- package/dist/{types-CZN_FcB6.d.ts → types-lG3xCzp_.d.ts} +27 -22
- package/dist/types.d.ts +1 -1
- package/package.json +2 -2
- package/dist/chunk-6DNEDIIT.js.map +0 -1
- package/dist/chunk-734J4PTM.js.map +0 -1
- package/dist/chunk-DSZSR7UE.js.map +0 -1
- package/dist/chunk-GTZC6PQI.js +0 -22
- package/dist/chunk-GTZC6PQI.js.map +0 -1
- package/dist/chunk-J3RNCPED.js.map +0 -1
- package/dist/chunk-M23P46ZL.js.map +0 -1
- package/dist/chunk-MICPMOTW.js.map +0 -1
- package/dist/chunk-NPAJNLXQ.js +0 -106
- package/dist/chunk-NPAJNLXQ.js.map +0 -1
- package/dist/chunk-RAZXOMZC.js.map +0 -1
- package/dist/chunk-REH55ZXV.js +0 -13
- package/dist/chunk-REH55ZXV.js.map +0 -1
- package/dist/chunk-RW4FH7IL.js.map +0 -1
- package/dist/chunk-RYTIQZIB.js.map +0 -1
- package/dist/chunk-UYPIWXZG.js.map +0 -1
- package/dist/chunk-VFC342WL.js.map +0 -1
- package/dist/chunk-WXT3YEWU.js.map +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/evaluator.ts
|
|
2
|
+
var PropertyEvaluator = class {
|
|
3
|
+
evaluate(expression, context) {
|
|
4
|
+
try {
|
|
5
|
+
if (!/^[a-zA-Z0-9_$.]+$/.test(expression)) {
|
|
6
|
+
console.error(`Error evaluating expression: "${expression}" contains invalid characters.`);
|
|
7
|
+
return void 0;
|
|
8
|
+
}
|
|
9
|
+
const parts = expression.split(".");
|
|
10
|
+
const startKey = parts[0];
|
|
11
|
+
if (!Object.hasOwn(context, startKey)) {
|
|
12
|
+
return void 0;
|
|
13
|
+
}
|
|
14
|
+
let current = context[startKey];
|
|
15
|
+
for (let i = 1; i < parts.length; i++) {
|
|
16
|
+
if (current === null || current === void 0) {
|
|
17
|
+
return void 0;
|
|
18
|
+
}
|
|
19
|
+
current = current[parts[i]];
|
|
20
|
+
}
|
|
21
|
+
return current;
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error(`Error evaluating property expression "${expression}":`, error);
|
|
24
|
+
return void 0;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var UnsafeEvaluator = class {
|
|
29
|
+
evaluate(expression, context) {
|
|
30
|
+
try {
|
|
31
|
+
const validIdentifierRegex = /^[a-z_$][\w$]*$/i;
|
|
32
|
+
const validKeys = Object.keys(context).filter((key) => validIdentifierRegex.test(key));
|
|
33
|
+
const validContext = {};
|
|
34
|
+
for (const key of validKeys) {
|
|
35
|
+
validContext[key] = context[key];
|
|
36
|
+
}
|
|
37
|
+
const sandbox = new Function(...validKeys, `return ${expression}`);
|
|
38
|
+
return sandbox(...validKeys.map((k) => validContext[k]));
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error(`Error evaluating expression "${expression}":`, error);
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { PropertyEvaluator, UnsafeEvaluator };
|
|
47
|
+
//# sourceMappingURL=chunk-PH2IYZHV.js.map
|
|
48
|
+
//# sourceMappingURL=chunk-PH2IYZHV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/evaluator.ts"],"names":[],"mappings":";AAWO,IAAM,oBAAN,MAA8C;AAAA,EACpD,QAAA,CAAS,YAAoB,OAAA,EAAmC;AAC/D,IAAA,IAAI;AAEH,MAAA,IAAI,CAAC,mBAAA,CAAoB,IAAA,CAAK,UAAU,CAAA,EAAG;AAC1C,QAAA,OAAA,CAAQ,KAAA,CAAM,CAAA,8BAAA,EAAiC,UAAU,CAAA,8BAAA,CAAgC,CAAA;AACzF,QAAA,OAAO,KAAA,CAAA;AAAA,MACR;AAEA,MAAA,MAAM,KAAA,GAAQ,UAAA,CAAW,KAAA,CAAM,GAAG,CAAA;AAClC,MAAA,MAAM,QAAA,GAAW,MAAM,CAAC,CAAA;AAExB,MAAA,IAAI,CAAC,MAAA,CAAO,MAAA,CAAO,OAAA,EAAS,QAAQ,CAAA,EAAG;AACtC,QAAA,OAAO,KAAA,CAAA;AAAA,MACR;AAEA,MAAA,IAAI,OAAA,GAAU,QAAQ,QAAQ,CAAA;AAC9B,MAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,KAAA,CAAM,QAAQ,CAAA,EAAA,EAAK;AACtC,QAAA,IAAI,OAAA,KAAY,IAAA,IAAQ,OAAA,KAAY,KAAA,CAAA,EAAW;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access.\n * It cannot execute arbitrary code and is secure for untrusted inputs.\n *\n * Example expressions:\n * - \"result.output.status\"\n * - \"context.user.isAdmin\"\n * - \"input.value\"\n */\nexport class PropertyEvaluator implements IEvaluator {\n\tevaluate(expression: string, context: Record<string, any>): any {\n\t\ttry {\n\t\t\t// Basic validation to ensure it's a simple path\n\t\t\tif (!/^[a-zA-Z0-9_$.]+$/.test(expression)) {\n\t\t\t\tconsole.error(`Error evaluating expression: \"${expression}\" contains invalid characters.`)\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\tconst parts = expression.split('.')\n\t\t\tconst startKey = parts[0]\n\n\t\t\tif (!Object.hasOwn(context, startKey)) {\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\tlet current = context[startKey]\n\t\t\tfor (let i = 1; i < parts.length; i++) {\n\t\t\t\tif (current === null || current === undefined) {\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\t\t\t\tcurrent = current[parts[i]]\n\t\t\t}\n\t\t\treturn current\n\t\t} catch (error) {\n\t\t\tconsole.error(`Error evaluating property expression \"${expression}\":`, error)\n\t\t\treturn undefined\n\t\t}\n\t}\n}\n\n/**\n * @warning This evaluator uses `new Function()` and can execute arbitrary\n * JavaScript code. It poses a significant security risk if the expressions\n * are not from a trusted source (e.g., user input).\n *\n * It should only be used in controlled environments where all workflow\n * definitions are static and authored by trusted developers.\n *\n * For safer evaluation, use the default `PropertyEvaluator` or install a\n * sandboxed library like `jsep` to create a custom, secure evaluator.\n */\nexport class UnsafeEvaluator implements IEvaluator {\n\tevaluate(expression: string, context: Record<string, any>): any {\n\t\ttry {\n\t\t\t// filter out keys that aren't valid JavaScript identifiers\n\t\t\tconst validIdentifierRegex = /^[a-z_$][\\w$]*$/i\n\t\t\tconst validKeys = Object.keys(context).filter((key) => validIdentifierRegex.test(key))\n\t\t\tconst validContext: Record<string, any> = {}\n\t\t\tfor (const key of validKeys) {\n\t\t\t\tvalidContext[key] = context[key]\n\t\t\t}\n\n\t\t\t// sandboxed function prevents access to global scope (e.g., `window`, `process`).\n\t\t\tconst sandbox = new Function(...validKeys, `return ${expression}`)\n\t\t\treturn sandbox(...validKeys.map((k) => validContext[k]))\n\t\t} catch (error) {\n\t\t\tconsole.error(`Error evaluating expression \"${expression}\":`, error)\n\t\t\t// default to a \"falsy\" value.\n\t\t\treturn undefined\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CancelledWorkflowError, FatalNodeExecutionError } from './chunk-
|
|
1
|
+
import { CancelledWorkflowError, FatalNodeExecutionError } from './chunk-5ZXV3R5D.js';
|
|
2
2
|
|
|
3
3
|
// src/runtime/executors.ts
|
|
4
4
|
var FunctionNodeExecutor = class {
|
|
@@ -14,7 +14,11 @@ var FunctionNodeExecutor = class {
|
|
|
14
14
|
signal?.throwIfAborted();
|
|
15
15
|
const result = await this.implementation(context);
|
|
16
16
|
if (attempt > 1) {
|
|
17
|
-
context.dependencies.logger.info(`Node execution succeeded after retry`, {
|
|
17
|
+
context.dependencies.logger.info(`Node execution succeeded after retry`, {
|
|
18
|
+
nodeId: nodeDef.id,
|
|
19
|
+
attempt,
|
|
20
|
+
executionId
|
|
21
|
+
});
|
|
18
22
|
}
|
|
19
23
|
return result;
|
|
20
24
|
} catch (error) {
|
|
@@ -22,13 +26,28 @@ var FunctionNodeExecutor = class {
|
|
|
22
26
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
23
27
|
throw new CancelledWorkflowError("Workflow cancelled");
|
|
24
28
|
}
|
|
25
|
-
if (error instanceof FatalNodeExecutionError)
|
|
26
|
-
break;
|
|
29
|
+
if (error instanceof FatalNodeExecutionError) break;
|
|
27
30
|
if (attempt < this.maxRetries) {
|
|
28
|
-
context.dependencies.logger.warn(`Node execution failed, retrying`, {
|
|
29
|
-
|
|
31
|
+
context.dependencies.logger.warn(`Node execution failed, retrying`, {
|
|
32
|
+
nodeId: nodeDef.id,
|
|
33
|
+
attempt,
|
|
34
|
+
maxRetries: this.maxRetries,
|
|
35
|
+
error: error instanceof Error ? error.message : String(error),
|
|
36
|
+
executionId
|
|
37
|
+
});
|
|
38
|
+
await this.eventBus.emit("node:retry", {
|
|
39
|
+
blueprintId: context.dependencies.blueprint?.id || "",
|
|
40
|
+
nodeId: nodeDef.id,
|
|
41
|
+
attempt,
|
|
42
|
+
executionId
|
|
43
|
+
});
|
|
30
44
|
} else {
|
|
31
|
-
context.dependencies.logger.error(`Node execution failed after all retries`, {
|
|
45
|
+
context.dependencies.logger.error(`Node execution failed after all retries`, {
|
|
46
|
+
nodeId: nodeDef.id,
|
|
47
|
+
attempts: this.maxRetries,
|
|
48
|
+
error: error instanceof Error ? error.message : String(error),
|
|
49
|
+
executionId
|
|
50
|
+
});
|
|
32
51
|
}
|
|
33
52
|
}
|
|
34
53
|
}
|
|
@@ -54,7 +73,11 @@ var ClassNodeExecutor = class {
|
|
|
54
73
|
execResult = await instance.exec(prepResult, context);
|
|
55
74
|
lastError = void 0;
|
|
56
75
|
if (attempt > 1) {
|
|
57
|
-
context.dependencies.logger.info(`Node execution succeeded after retry`, {
|
|
76
|
+
context.dependencies.logger.info(`Node execution succeeded after retry`, {
|
|
77
|
+
nodeId: nodeDef.id,
|
|
78
|
+
attempt,
|
|
79
|
+
executionId
|
|
80
|
+
});
|
|
58
81
|
}
|
|
59
82
|
break;
|
|
60
83
|
} catch (error) {
|
|
@@ -62,13 +85,28 @@ var ClassNodeExecutor = class {
|
|
|
62
85
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
63
86
|
throw new CancelledWorkflowError("Workflow cancelled");
|
|
64
87
|
}
|
|
65
|
-
if (error instanceof FatalNodeExecutionError)
|
|
66
|
-
break;
|
|
88
|
+
if (error instanceof FatalNodeExecutionError) break;
|
|
67
89
|
if (attempt < this.maxRetries) {
|
|
68
|
-
context.dependencies.logger.warn(`Node execution failed, retrying`, {
|
|
69
|
-
|
|
90
|
+
context.dependencies.logger.warn(`Node execution failed, retrying`, {
|
|
91
|
+
nodeId: nodeDef.id,
|
|
92
|
+
attempt,
|
|
93
|
+
maxRetries: this.maxRetries,
|
|
94
|
+
error: error instanceof Error ? error.message : String(error),
|
|
95
|
+
executionId
|
|
96
|
+
});
|
|
97
|
+
await this.eventBus.emit("node:retry", {
|
|
98
|
+
blueprintId: context.dependencies.blueprint?.id || "",
|
|
99
|
+
nodeId: nodeDef.id,
|
|
100
|
+
attempt,
|
|
101
|
+
executionId
|
|
102
|
+
});
|
|
70
103
|
} else {
|
|
71
|
-
context.dependencies.logger.error(`Node execution failed after all retries`, {
|
|
104
|
+
context.dependencies.logger.error(`Node execution failed after all retries`, {
|
|
105
|
+
nodeId: nodeDef.id,
|
|
106
|
+
attempts: this.maxRetries,
|
|
107
|
+
error: error instanceof Error ? error.message : String(error),
|
|
108
|
+
executionId
|
|
109
|
+
});
|
|
72
110
|
}
|
|
73
111
|
}
|
|
74
112
|
}
|
|
@@ -77,6 +115,9 @@ var ClassNodeExecutor = class {
|
|
|
77
115
|
execResult = await instance.fallback(lastError, context);
|
|
78
116
|
}
|
|
79
117
|
signal?.throwIfAborted();
|
|
118
|
+
if (!execResult) {
|
|
119
|
+
throw new Error("Execution failed after all retries");
|
|
120
|
+
}
|
|
80
121
|
return await instance.post(execResult, context);
|
|
81
122
|
} catch (error) {
|
|
82
123
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
@@ -96,5 +137,5 @@ var BuiltInNodeExecutor = class {
|
|
|
96
137
|
};
|
|
97
138
|
|
|
98
139
|
export { BuiltInNodeExecutor, ClassNodeExecutor, FunctionNodeExecutor };
|
|
99
|
-
//# sourceMappingURL=chunk-
|
|
100
|
-
//# sourceMappingURL=chunk-
|
|
140
|
+
//# sourceMappingURL=chunk-QRMUKDSP.js.map
|
|
141
|
+
//# sourceMappingURL=chunk-QRMUKDSP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/executors.ts"],"names":[],"mappings":";;;AAoBO,IAAM,uBAAN,MAA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OAAqC,CAAA;AAAA,EAClF;AACD","file":"chunk-QRMUKDSP.js","sourcesContent":["import { CancelledWorkflowError, FatalNodeExecutionError } from '../errors'\nimport type {\n\tContextImplementation,\n\tIEventBus,\n\tNodeClass,\n\tNodeContext,\n\tNodeDefinition,\n\tNodeFunction,\n\tNodeResult,\n} from '../types'\n\nexport interface ExecutionStrategy {\n\texecute: (\n\t\tnodeDef: NodeDefinition,\n\t\tcontext: NodeContext<any, any, any>,\n\t\texecutionId?: string,\n\t\tsignal?: AbortSignal,\n\t) => Promise<NodeResult<any, any>>\n}\n\nexport class FunctionNodeExecutor implements ExecutionStrategy {\n\tconstructor(\n\t\tprivate implementation: NodeFunction,\n\t\tprivate maxRetries: number,\n\t\tprivate eventBus: IEventBus,\n\t) {}\n\n\tasync execute(\n\t\tnodeDef: NodeDefinition,\n\t\tcontext: NodeContext<any, any, any>,\n\t\texecutionId?: string,\n\t\tsignal?: AbortSignal,\n\t): Promise<NodeResult<any, any>> {\n\t\tlet lastError: any\n\t\tfor (let attempt = 1; attempt <= this.maxRetries; attempt++) {\n\t\t\ttry {\n\t\t\t\tsignal?.throwIfAborted()\n\t\t\t\tconst result = await this.implementation(context)\n\t\t\t\tif (attempt > 1) {\n\t\t\t\t\tcontext.dependencies.logger.info(`Node execution succeeded after retry`, {\n\t\t\t\t\t\tnodeId: nodeDef.id,\n\t\t\t\t\t\tattempt,\n\t\t\t\t\t\texecutionId,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\treturn result\n\t\t\t} catch (error) {\n\t\t\t\tlastError = error\n\t\t\t\tif (error instanceof DOMException && error.name === 'AbortError') {\n\t\t\t\t\tthrow new CancelledWorkflowError('Workflow cancelled')\n\t\t\t\t}\n\t\t\t\tif (error instanceof FatalNodeExecutionError) break\n\t\t\t\tif (attempt < this.maxRetries) {\n\t\t\t\t\tcontext.dependencies.logger.warn(`Node execution failed, retrying`, {\n\t\t\t\t\t\tnodeId: nodeDef.id,\n\t\t\t\t\t\tattempt,\n\t\t\t\t\t\tmaxRetries: this.maxRetries,\n\t\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\texecutionId,\n\t\t\t\t\t})\n\t\t\t\t\tawait this.eventBus.emit('node:retry', {\n\t\t\t\t\t\tblueprintId: context.dependencies.blueprint?.id || '',\n\t\t\t\t\t\tnodeId: nodeDef.id,\n\t\t\t\t\t\tattempt,\n\t\t\t\t\t\texecutionId,\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tcontext.dependencies.logger.error(`Node execution failed after all retries`, {\n\t\t\t\t\t\tnodeId: nodeDef.id,\n\t\t\t\t\t\tattempts: this.maxRetries,\n\t\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\texecutionId,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthrow lastError\n\t}\n}\n\nexport class ClassNodeExecutor implements ExecutionStrategy {\n\tconstructor(\n\t\tprivate implementation: NodeClass,\n\t\tprivate maxRetries: number,\n\t\tprivate eventBus: IEventBus,\n\t) {}\n\n\tasync execute(\n\t\tnodeDef: NodeDefinition,\n\t\tcontext: NodeContext<any, any, any>,\n\t\texecutionId?: string,\n\t\tsignal?: AbortSignal,\n\t): Promise<NodeResult<any, any>> {\n\t\tconst instance = new this.implementation(nodeDef.params || {})\n\t\ttry {\n\t\t\tsignal?.throwIfAborted()\n\t\t\tconst prepResult = await instance.prep(context)\n\t\t\tlet execResult: Omit<NodeResult, 'error'> | undefined\n\t\t\tlet lastError: any\n\t\t\tfor (let attempt = 1; attempt <= this.maxRetries; attempt++) {\n\t\t\t\ttry {\n\t\t\t\t\tsignal?.throwIfAborted()\n\t\t\t\t\texecResult = await instance.exec(prepResult, context)\n\t\t\t\t\tlastError = undefined\n\t\t\t\t\tif (attempt > 1) {\n\t\t\t\t\t\tcontext.dependencies.logger.info(`Node execution succeeded after retry`, {\n\t\t\t\t\t\t\tnodeId: nodeDef.id,\n\t\t\t\t\t\t\tattempt,\n\t\t\t\t\t\t\texecutionId,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlastError = error\n\t\t\t\t\tif (error instanceof DOMException && error.name === 'AbortError') {\n\t\t\t\t\t\tthrow new CancelledWorkflowError('Workflow cancelled')\n\t\t\t\t\t}\n\t\t\t\t\tif (error instanceof FatalNodeExecutionError) break\n\t\t\t\t\tif (attempt < this.maxRetries) {\n\t\t\t\t\t\tcontext.dependencies.logger.warn(`Node execution failed, retrying`, {\n\t\t\t\t\t\t\tnodeId: nodeDef.id,\n\t\t\t\t\t\t\tattempt,\n\t\t\t\t\t\t\tmaxRetries: this.maxRetries,\n\t\t\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\texecutionId,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tawait this.eventBus.emit('node:retry', {\n\t\t\t\t\t\t\tblueprintId: context.dependencies.blueprint?.id || '',\n\t\t\t\t\t\t\tnodeId: nodeDef.id,\n\t\t\t\t\t\t\tattempt,\n\t\t\t\t\t\t\texecutionId,\n\t\t\t\t\t\t})\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontext.dependencies.logger.error(`Node execution failed after all retries`, {\n\t\t\t\t\t\t\tnodeId: nodeDef.id,\n\t\t\t\t\t\t\tattempts: this.maxRetries,\n\t\t\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\texecutionId,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (lastError) {\n\t\t\t\tsignal?.throwIfAborted()\n\t\t\t\texecResult = await instance.fallback(lastError, context)\n\t\t\t}\n\t\t\tsignal?.throwIfAborted()\n\t\t\tif (!execResult) {\n\t\t\t\tthrow new Error('Execution failed after all retries')\n\t\t\t}\n\t\t\treturn await instance.post(execResult, context)\n\t\t} catch (error) {\n\t\t\tif (error instanceof DOMException && error.name === 'AbortError') {\n\t\t\t\tthrow new CancelledWorkflowError('Workflow cancelled')\n\t\t\t}\n\t\t\tthrow error\n\t\t}\n\t}\n}\n\nexport class BuiltInNodeExecutor implements ExecutionStrategy {\n\tconstructor(\n\t\tprivate executeBuiltIn: (\n\t\t\tnodeDef: NodeDefinition,\n\t\t\tcontext: ContextImplementation<any>,\n\t\t) => Promise<NodeResult<any, any>>,\n\t) {}\n\n\tasync execute(\n\t\tnodeDef: NodeDefinition,\n\t\tcontext: NodeContext<Record<string, unknown>, Record<string, unknown>, any>,\n\t): Promise<NodeResult<any, any>> {\n\t\treturn this.executeBuiltIn(nodeDef, context.context as ContextImplementation<any>)\n\t}\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { analyzeBlueprint } from './chunk-
|
|
1
|
+
import { analyzeBlueprint } from './chunk-HN72TZY5.js';
|
|
2
2
|
|
|
3
3
|
// src/linter.ts
|
|
4
4
|
function lintBlueprint(blueprint, registry) {
|
|
@@ -37,11 +37,12 @@ function lintBlueprint(blueprint, registry) {
|
|
|
37
37
|
const visited = /* @__PURE__ */ new Set();
|
|
38
38
|
while (nodesToVisit.length > 0) {
|
|
39
39
|
const currentId = nodesToVisit.pop();
|
|
40
|
-
if (visited.has(currentId))
|
|
41
|
-
continue;
|
|
40
|
+
if (!currentId || visited.has(currentId)) continue;
|
|
42
41
|
visited.add(currentId);
|
|
43
42
|
connectedNodes.add(currentId);
|
|
44
|
-
blueprint.edges.filter((
|
|
43
|
+
for (const e of blueprint.edges.filter((e2) => e2.source === currentId)) {
|
|
44
|
+
nodesToVisit.push(e.target);
|
|
45
|
+
}
|
|
45
46
|
}
|
|
46
47
|
for (const nodeId of nodeIds) {
|
|
47
48
|
if (!connectedNodes.has(nodeId)) {
|
|
@@ -60,5 +61,5 @@ function lintBlueprint(blueprint, registry) {
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
export { lintBlueprint };
|
|
63
|
-
//# sourceMappingURL=chunk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AS;AAC7B,MAAA,IAAI,CAAC,cAAA,CAAe,GAAA,CAAI,MAAM,CAAA,EAAG;AAChC,QAAA,MAAA,CAAO,IAAA,CAAK;AAAA,UACX,IAAA,EAAM,aAAA;AAAA,UACN,OAAA,EAAS,SAAS,MAAM,CAAA,uCAAA,CAAA;AAAA,UACxB;AAAA,SACA,CAAA;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAEA,EAAA,OAAO;AAAA,IACN,OAAA,EAAS,OAAO,MAAA,KAAW,CAAA;AAAA,IAC3B;AAAA,GACD;AACD","file":"chunk-UETC63DP.js","sourcesContent":["import { analyzeBlueprint } from './analysis'\nimport type { NodeClass, NodeFunction, WorkflowBlueprint } from './types'\n\nexport type LinterIssueCode =\n\t| 'INVALID_EDGE_SOURCE'\n\t| 'INVALID_EDGE_TARGET'\n\t| 'MISSING_NODE_IMPLEMENTATION'\n\t| 'ORPHAN_NODE'\n\nexport interface LinterIssue {\n\tcode: LinterIssueCode\n\tmessage: string\n\tnodeId?: string\n\trelatedId?: string\n}\n\nexport interface LinterResult {\n\tisValid: boolean\n\tissues: LinterIssue[]\n}\n\n/**\n * Statically analyzes a workflow blueprint against a registry of implementations\n * to find common errors before runtime.\n *\n * @param blueprint The WorkflowBlueprint to analyze.\n * @param registry A map of node implementations (functions or classes) to check against.\n * @returns A LinterResult object containing any issues found.\n */\nexport function lintBlueprint(\n\tblueprint: WorkflowBlueprint,\n\tregistry: Map<string, NodeFunction | NodeClass> | Record<string, NodeFunction | NodeClass>,\n): LinterResult {\n\tconst issues: LinterIssue[] = []\n\tconst nodeIds = new Set(blueprint.nodes.map((n) => n.id))\n\tconst registryKeys = registry instanceof Map ? new Set(registry.keys()) : new Set(Object.keys(registry))\n\n\t// check for missing node implementations\n\tfor (const node of blueprint.nodes) {\n\t\tif (!node.uses.startsWith('batch-') && !node.uses.startsWith('loop-') && !registryKeys.has(node.uses)) {\n\t\t\tissues.push({\n\t\t\t\tcode: 'MISSING_NODE_IMPLEMENTATION',\n\t\t\t\tmessage: `Node implementation key '${node.uses}' is not found in the provided registry.`,\n\t\t\t\tnodeId: node.id,\n\t\t\t})\n\t\t}\n\t}\n\n\t// check for graph integrity (edges must point to valid nodes)\n\tfor (const edge of blueprint.edges || []) {\n\t\tif (!nodeIds.has(edge.source)) {\n\t\t\tissues.push({\n\t\t\t\tcode: 'INVALID_EDGE_SOURCE',\n\t\t\t\tmessage: `Edge source '${edge.source}' does not correspond to a valid node ID.`,\n\t\t\t\trelatedId: edge.target,\n\t\t\t})\n\t\t}\n\t\tif (!nodeIds.has(edge.target)) {\n\t\t\tissues.push({\n\t\t\t\tcode: 'INVALID_EDGE_TARGET',\n\t\t\t\tmessage: `Edge target '${edge.target}' does not correspond to a valid node ID.`,\n\t\t\t\trelatedId: edge.source,\n\t\t\t})\n\t\t}\n\t}\n\n\t// check for orphan nodes (not connected to the main graph)\n\tif (blueprint.nodes.length > 1) {\n\t\tconst analysis = analyzeBlueprint(blueprint)\n\t\tconst connectedNodes = new Set<string>()\n\t\tconst nodesToVisit = [...analysis.startNodeIds]\n\t\tconst visited = new Set<string>()\n\n\t\twhile (nodesToVisit.length > 0) {\n\t\t\tconst currentId = nodesToVisit.pop()\n\t\t\tif (!currentId || visited.has(currentId)) continue\n\n\t\t\tvisited.add(currentId)\n\t\t\tconnectedNodes.add(currentId)\n\n\t\t\tfor (const e of blueprint.edges.filter((e) => e.source === currentId)) {\n\t\t\t\tnodesToVisit.push(e.target)\n\t\t\t}\n\t\t}\n\n\t\tfor (const nodeId of nodeIds) {\n\t\t\tif (!connectedNodes.has(nodeId)) {\n\t\t\t\tissues.push({\n\t\t\t\t\tcode: 'ORPHAN_NODE',\n\t\t\t\t\tmessage: `Node '${nodeId}' is not reachable from any start node.`,\n\t\t\t\t\tnodeId,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tisValid: issues.length === 0,\n\t\tissues,\n\t}\n}\n"]}
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { CancelledWorkflowError } from './chunk-
|
|
2
|
-
import { analyzeBlueprint } from './chunk-
|
|
1
|
+
import { CancelledWorkflowError } from './chunk-5ZXV3R5D.js';
|
|
2
|
+
import { analyzeBlueprint } from './chunk-HN72TZY5.js';
|
|
3
3
|
|
|
4
4
|
// src/runtime/traverser.ts
|
|
5
5
|
var GraphTraverser = class {
|
|
6
|
-
constructor(blueprint, runtime, state, functionRegistry, executionId, signal) {
|
|
7
|
-
this.blueprint = blueprint;
|
|
6
|
+
constructor(blueprint, runtime, state, functionRegistry, executionId, signal, concurrency) {
|
|
8
7
|
this.runtime = runtime;
|
|
9
8
|
this.state = state;
|
|
10
9
|
this.functionRegistry = functionRegistry;
|
|
11
10
|
this.executionId = executionId;
|
|
12
11
|
this.signal = signal;
|
|
13
|
-
this.
|
|
12
|
+
this.concurrency = concurrency;
|
|
13
|
+
this.dynamicBlueprint = structuredClone(blueprint);
|
|
14
14
|
this.allPredecessors = /* @__PURE__ */ new Map();
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
for (const node of this.dynamicBlueprint.nodes) {
|
|
16
|
+
this.allPredecessors.set(node.id, /* @__PURE__ */ new Set());
|
|
17
|
+
}
|
|
18
|
+
for (const edge of this.dynamicBlueprint.edges) {
|
|
19
|
+
this.allPredecessors.get(edge.target)?.add(edge.source);
|
|
20
|
+
}
|
|
17
21
|
const analysis = analyzeBlueprint(blueprint);
|
|
18
22
|
this.frontier = new Set(analysis.startNodeIds.filter((id) => !this.isFallbackNode(id)));
|
|
19
23
|
if (this.frontier.size === 0 && analysis.cycles.length > 0 && this.runtime.options.strict !== true) {
|
|
20
24
|
const uniqueStartNodes = /* @__PURE__ */ new Set();
|
|
21
25
|
for (const cycle of analysis.cycles) {
|
|
22
|
-
if (cycle.length > 0)
|
|
23
|
-
uniqueStartNodes.add(cycle[0]);
|
|
26
|
+
if (cycle.length > 0) uniqueStartNodes.add(cycle[0]);
|
|
24
27
|
}
|
|
25
28
|
this.frontier = new Set(uniqueStartNodes);
|
|
26
29
|
}
|
|
@@ -42,52 +45,49 @@ var GraphTraverser = class {
|
|
|
42
45
|
let iterations = 0;
|
|
43
46
|
const maxIterations = 1e4;
|
|
44
47
|
while (this.frontier.size > 0) {
|
|
45
|
-
if (++iterations > maxIterations)
|
|
46
|
-
throw new Error("Traversal exceeded maximum iterations, possible infinite loop");
|
|
48
|
+
if (++iterations > maxIterations) throw new Error("Traversal exceeded maximum iterations, possible infinite loop");
|
|
47
49
|
try {
|
|
48
50
|
this.signal?.throwIfAborted();
|
|
49
51
|
const currentJobs = Array.from(this.frontier);
|
|
50
52
|
this.frontier.clear();
|
|
51
|
-
const
|
|
52
|
-
(nodeId) => this.runtime.executeNode(this.dynamicBlueprint, nodeId, this.state, this.allPredecessors, this.functionRegistry, this.executionId, this.signal).then((result) => ({ status: "fulfilled", value: { nodeId, result } })).catch((error) => ({ status: "rejected", reason: { nodeId, error } }))
|
|
53
|
-
);
|
|
54
|
-
const settledResults = await Promise.all(promises);
|
|
53
|
+
const settledResults = await this.executeWithConcurrency(currentJobs);
|
|
55
54
|
const completedThisTurn = /* @__PURE__ */ new Set();
|
|
56
55
|
for (const promiseResult of settledResults) {
|
|
57
56
|
if (promiseResult.status === "rejected") {
|
|
58
57
|
const { nodeId: nodeId2, error } = promiseResult.reason;
|
|
59
|
-
if (error instanceof CancelledWorkflowError)
|
|
60
|
-
throw error;
|
|
58
|
+
if (error instanceof CancelledWorkflowError) throw error;
|
|
61
59
|
this.state.addError(nodeId2, error);
|
|
62
60
|
continue;
|
|
63
61
|
}
|
|
64
62
|
const { nodeId, result } = promiseResult.value;
|
|
65
63
|
this.state.addCompletedNode(nodeId, result.output);
|
|
66
64
|
completedThisTurn.add(nodeId);
|
|
67
|
-
if (result._fallbackExecuted)
|
|
68
|
-
this.state.markFallbackExecuted();
|
|
65
|
+
if (result._fallbackExecuted) this.state.markFallbackExecuted();
|
|
69
66
|
await this.handleDynamicNodes(nodeId, result);
|
|
70
67
|
if (!result._fallbackExecuted) {
|
|
71
|
-
const matched = await this.runtime.determineNextNodes(
|
|
68
|
+
const matched = await this.runtime.determineNextNodes(
|
|
69
|
+
this.dynamicBlueprint,
|
|
70
|
+
nodeId,
|
|
71
|
+
result,
|
|
72
|
+
this.state.getContext()
|
|
73
|
+
);
|
|
72
74
|
const loopControllerMatch = matched.find((m) => m.node.uses === "loop-controller");
|
|
73
75
|
const finalMatched = loopControllerMatch ? [loopControllerMatch] : matched;
|
|
74
76
|
for (const { node, edge } of finalMatched) {
|
|
75
77
|
const joinStrategy = node.config?.joinStrategy || "all";
|
|
76
|
-
if (joinStrategy !== "any" && this.state.getCompletedNodes().has(node.id))
|
|
77
|
-
continue;
|
|
78
|
+
if (joinStrategy !== "any" && this.state.getCompletedNodes().has(node.id)) continue;
|
|
78
79
|
await this.runtime.applyEdgeTransform(edge, result, node, this.state.getContext(), this.allPredecessors);
|
|
79
80
|
const requiredPredecessors = this.allPredecessors.get(node.id);
|
|
81
|
+
if (!requiredPredecessors) continue;
|
|
80
82
|
const isReady = joinStrategy === "any" ? [...requiredPredecessors].some((p) => completedThisTurn.has(p)) : [...requiredPredecessors].every((p) => this.state.getCompletedNodes().has(p));
|
|
81
|
-
if (isReady)
|
|
82
|
-
this.frontier.add(node.id);
|
|
83
|
+
if (isReady) this.frontier.add(node.id);
|
|
83
84
|
}
|
|
84
85
|
if (matched.length === 0) {
|
|
85
86
|
for (const [potentialNextId, predecessors] of this.allPredecessors) {
|
|
86
87
|
if (predecessors.has(nodeId) && !this.state.getCompletedNodes().has(potentialNextId)) {
|
|
87
88
|
const joinStrategy = this.dynamicBlueprint.nodes.find((n) => n.id === potentialNextId)?.config?.joinStrategy || "all";
|
|
88
89
|
const isReady = joinStrategy === "any" ? [...predecessors].some((p) => completedThisTurn.has(p)) : [...predecessors].every((p) => this.state.getCompletedNodes().has(p));
|
|
89
|
-
if (isReady)
|
|
90
|
-
this.frontier.add(potentialNextId);
|
|
90
|
+
if (isReady) this.frontier.add(potentialNextId);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -101,6 +101,37 @@ var GraphTraverser = class {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
+
async executeWithConcurrency(nodeIds) {
|
|
105
|
+
const maxConcurrency = this.concurrency || nodeIds.length;
|
|
106
|
+
const results = [];
|
|
107
|
+
for (let i = 0; i < nodeIds.length; i += maxConcurrency) {
|
|
108
|
+
const batch = nodeIds.slice(i, i + maxConcurrency);
|
|
109
|
+
const batchPromises = batch.map(async (nodeId) => {
|
|
110
|
+
try {
|
|
111
|
+
const result = await this.runtime.executeNode(
|
|
112
|
+
this.dynamicBlueprint,
|
|
113
|
+
nodeId,
|
|
114
|
+
this.state,
|
|
115
|
+
this.allPredecessors,
|
|
116
|
+
this.functionRegistry,
|
|
117
|
+
this.executionId,
|
|
118
|
+
this.signal
|
|
119
|
+
);
|
|
120
|
+
results.push({
|
|
121
|
+
status: "fulfilled",
|
|
122
|
+
value: { nodeId, result }
|
|
123
|
+
});
|
|
124
|
+
} catch (error) {
|
|
125
|
+
results.push({
|
|
126
|
+
status: "rejected",
|
|
127
|
+
reason: { nodeId, error }
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
await Promise.all(batchPromises);
|
|
132
|
+
}
|
|
133
|
+
return results;
|
|
134
|
+
}
|
|
104
135
|
async handleDynamicNodes(nodeId, result) {
|
|
105
136
|
if (result.dynamicNodes && result.dynamicNodes.length > 0) {
|
|
106
137
|
const gatherNodeId = result.output?.gatherNodeId;
|
|
@@ -120,8 +151,7 @@ var GraphTraverser = class {
|
|
|
120
151
|
getFallbackNodeIds() {
|
|
121
152
|
const fallbackNodeIds = /* @__PURE__ */ new Set();
|
|
122
153
|
for (const node of this.dynamicBlueprint.nodes) {
|
|
123
|
-
if (node.config?.fallback)
|
|
124
|
-
fallbackNodeIds.add(node.config.fallback);
|
|
154
|
+
if (node.config?.fallback) fallbackNodeIds.add(node.config.fallback);
|
|
125
155
|
}
|
|
126
156
|
return fallbackNodeIds;
|
|
127
157
|
}
|
|
@@ -131,5 +161,5 @@ var GraphTraverser = class {
|
|
|
131
161
|
};
|
|
132
162
|
|
|
133
163
|
export { GraphTraverser };
|
|
134
|
-
//# sourceMappingURL=chunk-
|
|
135
|
-
//# sourceMappingURL=chunk-
|
|
164
|
+
//# sourceMappingURL=chunk-UMXW3TCY.js.map
|
|
165
|
+
//# sourceMappingURL=chunk-UMXW3TCY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/traverser.ts"],"names":["nodeId"],"mappings":";;;;AAMO,IAAM,iBAAN,MAAsG;AAAA,EAK5G,YACC,SAAA,EACQ,OAAA,EACA,OACA,gBAAA,EACA,WAAA,EACA,QACA,WAAA,EACP;AANO,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AACA,IAAA,IAAA,CAAA,KAAA,GAAA,KAAA;AACA,IAAA,IAAA,CAAA,gBAAA,GAAA,gBAAA;AACA,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AACA,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AACA,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AAER,IAAA,IAAA,CAAK,gBAAA,GAAmB,gBAAgB,SAAS,CAAA;AACjD,IAAA,IAAA,CAAK,eAAA,uBAAsB,GAAA,EAAyB;AACpD,IAAA,KAAA,MAAW,IAAA,IAAQ,IAAA,CAAK,gBAAA,CAAiB,KAAA,EAAO;AAC/C,MAAA,IAAA,CAAK,gBAAgB,GAAA,CAAI,IAAA,CAAK,EAAA,kBAAI,IAAI,KAAK,CAAA;AAAA,IAC5C;AACA,IAAA,KAAA,MAAW,IAAA,IAAQ,IAAA,CAAK,gBAAA,CAAiB,KAAA,EAAO;AAC/C,MAAA,IAAA,CAAK,gBAAgB,GAAA,CAAI,IAAA,CAAK,MAAM,CAAA,EAAG,GAAA,CAAI,KAAK,MAAM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AAa,SAAS,CAAA,EAAG;AAC1D,MAAA,MAAM,YAAA,GAAe,OAAO,MAAA,EAAQ,YAAA;AACpC,MAAA,KAAA,MAAW,WAAA,IAAe,OAAO,YAAA,EAAc;AAC9C,QAAA,IAAA,CAAK,gBAAA,CAAiB,KAAA,CAAM,IAAA,CAAK,WAAW,CAAA;AAC5C,QAAA,IAAA,CAAK,eAAA,CAAgB,IAAI,WAAA,CAAY,EAAA,sBAAQ,GAAA,CAAI,CAAC,MAAM,CAAC,CAAC,CAAA;AAC1D,QAAA,IAAI,YAAA,EAAc;AACjB,UAAA,IAAA,CAAK,gBAAgB,GAAA,CAAI,YAAY,CAAA,EAAG,GAAA,CAAI,YAAY,EAAE,CAAA;AAAA,QAC3D;AACA,QAAA,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,WAAA,CAAY,EAAE,CAAA;AAAA,MACjC;AAAA,IACD;AAAA,EACD;AAAA,EAEA,aAAA,GAA6B;AAC5B,IAAA,OAAO,IAAI,GAAA,CAAI,IAAA,CAAK,gBAAA,CAAiB,KAAA,CAAM,IAAI,CAAC,CAAA,KAAM,CAAA,CAAE,EAAE,CAAC,CAAA;AAAA,EAC5D;AAAA,EAEA,kBAAA,GAAkC;AACjC,IAAA,MAAM,eAAA,uBAAsB,GAAA,EAAY;AACxC,IAAA,KAAA,MAAW,IAAA,IAAQ,IAAA,CAAK,gBAAA,CAAiB,KAAA,EAAO;AAC/C,MAAA,IAAI,KAAK,MAAA,EAAQ,QAAA,kBAA0B,GAAA,CAAI,IAAA,CAAK,OAAO,QAAQ,CAAA;AAAA,IACpE;AACA,IAAA,OAAO,eAAA;AAAA,EACR;AAAA,EAEA,mBAAA,GAAyC;AACxC,IAAA,OAAO,IAAA,CAAK,gBAAA;AAAA,EACb;AACD","file":"chunk-UMXW3TCY.js","sourcesContent":["import { analyzeBlueprint } from '../analysis'\nimport { CancelledWorkflowError } from '../errors'\nimport type { NodeResult, WorkflowBlueprint } from '../types'\nimport type { WorkflowState } from './state'\nimport type { IRuntime } from './types'\n\nexport class GraphTraverser<TContext extends Record<string, any>, TDependencies extends Record<string, any>> {\n\tprivate frontier = new Set<string>()\n\tprivate allPredecessors: Map<string, Set<string>>\n\tprivate dynamicBlueprint: WorkflowBlueprint\n\n\tconstructor(\n\t\tblueprint: WorkflowBlueprint,\n\t\tprivate runtime: IRuntime<TContext, TDependencies>,\n\t\tprivate state: WorkflowState<TContext>,\n\t\tprivate functionRegistry: Map<string, any> | undefined,\n\t\tprivate executionId: string,\n\t\tprivate signal?: AbortSignal,\n\t\tprivate concurrency?: number,\n\t) {\n\t\tthis.dynamicBlueprint = structuredClone(blueprint) as WorkflowBlueprint\n\t\tthis.allPredecessors = new Map<string, Set<string>>()\n\t\tfor (const node of this.dynamicBlueprint.nodes) {\n\t\t\tthis.allPredecessors.set(node.id, new Set())\n\t\t}\n\t\tfor (const edge of this.dynamicBlueprint.edges) {\n\t\t\tthis.allPredecessors.get(edge.target)?.add(edge.source)\n\t\t}\n\t\tconst analysis = analyzeBlueprint(blueprint)\n\t\tthis.frontier = new Set(analysis.startNodeIds.filter((id) => !this.isFallbackNode(id)))\n\t\tif (this.frontier.size === 0 && analysis.cycles.length > 0 && this.runtime.options.strict !== true) {\n\t\t\tconst uniqueStartNodes = new Set<string>()\n\t\t\tfor (const cycle of analysis.cycles) {\n\t\t\t\tif (cycle.length > 0) uniqueStartNodes.add(cycle[0])\n\t\t\t}\n\t\t\tthis.frontier = new Set(uniqueStartNodes)\n\t\t}\n\t}\n\n\tprivate isFallbackNode(nodeId: string): boolean {\n\t\treturn this.dynamicBlueprint.nodes.some((n) => n.config?.fallback === nodeId)\n\t}\n\n\tasync traverse(): Promise<void> {\n\t\ttry {\n\t\t\tthis.signal?.throwIfAborted()\n\t\t} catch (error) {\n\t\t\tif (error instanceof DOMException && error.name === 'AbortError')\n\t\t\t\tthrow new CancelledWorkflowError('Workflow cancelled')\n\t\t\tthrow error\n\t\t}\n\t\tlet iterations = 0\n\t\tconst maxIterations = 10000\n\t\twhile (this.frontier.size > 0) {\n\t\t\tif (++iterations > maxIterations) throw new Error('Traversal exceeded maximum iterations, possible infinite loop')\n\n\t\t\ttry {\n\t\t\t\tthis.signal?.throwIfAborted()\n\t\t\t\tconst currentJobs = Array.from(this.frontier)\n\t\t\t\tthis.frontier.clear()\n\t\t\t\tconst settledResults = await this.executeWithConcurrency(currentJobs)\n\t\t\t\tconst completedThisTurn = new Set<string>()\n\t\t\t\tfor (const promiseResult of settledResults) {\n\t\t\t\t\tif (promiseResult.status === 'rejected') {\n\t\t\t\t\t\tconst { nodeId, error } = promiseResult.reason\n\t\t\t\t\t\tif (error instanceof CancelledWorkflowError) throw error\n\t\t\t\t\t\tthis.state.addError(nodeId, error as Error)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst { nodeId, result } = promiseResult.value\n\t\t\t\t\tthis.state.addCompletedNode(nodeId, result.output)\n\t\t\t\t\tcompletedThisTurn.add(nodeId)\n\t\t\t\t\tif (result._fallbackExecuted) this.state.markFallbackExecuted()\n\t\t\t\t\tawait this.handleDynamicNodes(nodeId, result)\n\t\t\t\t\tif (!result._fallbackExecuted) {\n\t\t\t\t\t\tconst matched = await this.runtime.determineNextNodes(\n\t\t\t\t\t\t\tthis.dynamicBlueprint,\n\t\t\t\t\t\t\tnodeId,\n\t\t\t\t\t\t\tresult,\n\t\t\t\t\t\t\tthis.state.getContext(),\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\t// If one of the next nodes is a loop controller, prioritize it to avoid ambiguity from manual cycle edges.\n\t\t\t\t\t\tconst loopControllerMatch = matched.find((m) => m.node.uses === 'loop-controller')\n\t\t\t\t\t\tconst finalMatched = loopControllerMatch ? [loopControllerMatch] : matched\n\n\t\t\t\t\t\tfor (const { node, edge } of finalMatched) {\n\t\t\t\t\t\t\tconst joinStrategy = node.config?.joinStrategy || 'all'\n\t\t\t\t\t\t\tif (joinStrategy !== 'any' && this.state.getCompletedNodes().has(node.id)) continue\n\t\t\t\t\t\t\tawait this.runtime.applyEdgeTransform(edge, result, node, this.state.getContext(), this.allPredecessors)\n\t\t\t\t\t\t\tconst requiredPredecessors = this.allPredecessors.get(node.id)\n\t\t\t\t\t\t\tif (!requiredPredecessors) continue\n\t\t\t\t\t\t\tconst isReady =\n\t\t\t\t\t\t\t\tjoinStrategy === 'any'\n\t\t\t\t\t\t\t\t\t? [...requiredPredecessors].some((p) => completedThisTurn.has(p))\n\t\t\t\t\t\t\t\t\t: [...requiredPredecessors].every((p) => this.state.getCompletedNodes().has(p))\n\t\t\t\t\t\t\tif (isReady) this.frontier.add(node.id)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (matched.length === 0) {\n\t\t\t\t\t\t\tfor (const [potentialNextId, predecessors] of this.allPredecessors) {\n\t\t\t\t\t\t\t\tif (predecessors.has(nodeId) && !this.state.getCompletedNodes().has(potentialNextId)) {\n\t\t\t\t\t\t\t\t\tconst joinStrategy =\n\t\t\t\t\t\t\t\t\t\tthis.dynamicBlueprint.nodes.find((n) => n.id === potentialNextId)?.config?.joinStrategy || 'all'\n\t\t\t\t\t\t\t\t\tconst isReady =\n\t\t\t\t\t\t\t\t\t\tjoinStrategy === 'any'\n\t\t\t\t\t\t\t\t\t\t\t? [...predecessors].some((p) => completedThisTurn.has(p))\n\t\t\t\t\t\t\t\t\t\t\t: [...predecessors].every((p) => this.state.getCompletedNodes().has(p))\n\t\t\t\t\t\t\t\t\tif (isReady) this.frontier.add(potentialNextId)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof DOMException && error.name === 'AbortError') {\n\t\t\t\t\tthrow new CancelledWorkflowError('Workflow cancelled')\n\t\t\t\t}\n\t\t\t\tthrow error\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async executeWithConcurrency(\n\t\tnodeIds: string[],\n\t): Promise<\n\t\tArray<\n\t\t\t| { status: 'fulfilled'; value: { nodeId: string; result: NodeResult<any, any> } }\n\t\t\t| { status: 'rejected'; reason: { nodeId: string; error: unknown } }\n\t\t>\n\t> {\n\t\tconst maxConcurrency = this.concurrency || nodeIds.length\n\t\tconst results: Array<\n\t\t\t| { status: 'fulfilled'; value: { nodeId: string; result: NodeResult<any, any> } }\n\t\t\t| { status: 'rejected'; reason: { nodeId: string; error: unknown } }\n\t\t> = []\n\n\t\tfor (let i = 0; i < nodeIds.length; i += maxConcurrency) {\n\t\t\tconst batch = nodeIds.slice(i, i + maxConcurrency)\n\t\t\tconst batchPromises = batch.map(async (nodeId) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await this.runtime.executeNode(\n\t\t\t\t\t\tthis.dynamicBlueprint,\n\t\t\t\t\t\tnodeId,\n\t\t\t\t\t\tthis.state,\n\t\t\t\t\t\tthis.allPredecessors,\n\t\t\t\t\t\tthis.functionRegistry,\n\t\t\t\t\t\tthis.executionId,\n\t\t\t\t\t\tthis.signal,\n\t\t\t\t\t)\n\t\t\t\t\tresults.push({\n\t\t\t\t\t\tstatus: 'fulfilled' as const,\n\t\t\t\t\t\tvalue: { nodeId, result },\n\t\t\t\t\t})\n\t\t\t\t} catch (error) {\n\t\t\t\t\tresults.push({\n\t\t\t\t\t\tstatus: 'rejected' as const,\n\t\t\t\t\t\treason: { nodeId, error },\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tawait Promise.all(batchPromises)\n\t\t}\n\n\t\treturn results\n\t}\n\n\tprivate async handleDynamicNodes(nodeId: string, result: NodeResult<any, any>) {\n\t\tif (result.dynamicNodes && result.dynamicNodes.length > 0) {\n\t\t\tconst gatherNodeId = result.output?.gatherNodeId\n\t\t\tfor (const dynamicNode of result.dynamicNodes) {\n\t\t\t\tthis.dynamicBlueprint.nodes.push(dynamicNode)\n\t\t\t\tthis.allPredecessors.set(dynamicNode.id, new Set([nodeId]))\n\t\t\t\tif (gatherNodeId) {\n\t\t\t\t\tthis.allPredecessors.get(gatherNodeId)?.add(dynamicNode.id)\n\t\t\t\t}\n\t\t\t\tthis.frontier.add(dynamicNode.id)\n\t\t\t}\n\t\t}\n\t}\n\n\tgetAllNodeIds(): Set<string> {\n\t\treturn new Set(this.dynamicBlueprint.nodes.map((n) => n.id))\n\t}\n\n\tgetFallbackNodeIds(): Set<string> {\n\t\tconst fallbackNodeIds = new Set<string>()\n\t\tfor (const node of this.dynamicBlueprint.nodes) {\n\t\t\tif (node.config?.fallback) fallbackNodeIds.add(node.config.fallback)\n\t\t}\n\t\treturn fallbackNodeIds\n\t}\n\n\tgetDynamicBlueprint(): WorkflowBlueprint {\n\t\treturn this.dynamicBlueprint\n\t}\n}\n"]}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as ISyncContext, h as IAsyncContext } from './types-
|
|
1
|
+
import { I as ISyncContext, h as IAsyncContext } from './types-lG3xCzp_.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A default, high-performance, in-memory implementation of ISyncContext using a Map.
|
|
@@ -9,8 +9,8 @@ declare class Context<TContext extends Record<string, any>> implements ISyncCont
|
|
|
9
9
|
constructor(initialData?: Partial<TContext>);
|
|
10
10
|
get<K extends keyof TContext>(key: K): TContext[K] | undefined;
|
|
11
11
|
set<K extends keyof TContext>(key: K, value: TContext[K]): void;
|
|
12
|
-
has(key:
|
|
13
|
-
delete(key:
|
|
12
|
+
has<K extends keyof TContext>(key: K): boolean;
|
|
13
|
+
delete<K extends keyof TContext>(key: K): boolean;
|
|
14
14
|
toJSON(): Record<string, any>;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
@@ -23,8 +23,8 @@ declare class AsyncContextView<TContext extends Record<string, any>> implements
|
|
|
23
23
|
constructor(syncContext: ISyncContext<TContext>);
|
|
24
24
|
get<K extends keyof TContext>(key: K): Promise<TContext[K] | undefined>;
|
|
25
25
|
set<K extends keyof TContext>(key: K, value: TContext[K]): Promise<void>;
|
|
26
|
-
has(key:
|
|
27
|
-
delete(key:
|
|
26
|
+
has<K extends keyof TContext>(key: K): Promise<boolean>;
|
|
27
|
+
delete<K extends keyof TContext>(key: K): Promise<boolean>;
|
|
28
28
|
toJSON(): Promise<Record<string, any>>;
|
|
29
29
|
}
|
|
30
30
|
|
package/dist/context.js
CHANGED
package/dist/errors.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CancelledWorkflowError, FatalNodeExecutionError, NodeExecutionError } from './chunk-
|
|
1
|
+
export { CancelledWorkflowError, FatalNodeExecutionError, NodeExecutionError } from './chunk-5ZXV3R5D.js';
|
|
2
2
|
//# sourceMappingURL=errors.js.map
|
|
3
3
|
//# sourceMappingURL=errors.js.map
|
package/dist/evaluator.d.ts
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
import { k as IEvaluator } from './types-
|
|
1
|
+
import { k as IEvaluator } from './types-lG3xCzp_.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* A
|
|
5
|
-
* It
|
|
4
|
+
* A safe evaluator that only allows simple property access.
|
|
5
|
+
* It cannot execute arbitrary code and is secure for untrusted inputs.
|
|
6
6
|
*
|
|
7
|
-
* @warning This implementation uses `new Function()` which, while sandboxed from the global
|
|
8
|
-
* scope, can be a security risk if expressions are provided by end-users. It is NOT
|
|
9
|
-
* recommended for production systems. Please replace this with a more robust and secure
|
|
10
|
-
* library like `jsep` by providing your own implementation in the runtime options.
|
|
11
|
-
*
|
|
12
|
-
* This implementation can only access properties on a single context object.
|
|
13
7
|
* Example expressions:
|
|
14
|
-
* - "result.output.status
|
|
8
|
+
* - "result.output.status"
|
|
15
9
|
* - "context.user.isAdmin"
|
|
16
|
-
* - "input.value
|
|
10
|
+
* - "input.value"
|
|
11
|
+
*/
|
|
12
|
+
declare class PropertyEvaluator implements IEvaluator {
|
|
13
|
+
evaluate(expression: string, context: Record<string, any>): any;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @warning This evaluator uses `new Function()` and can execute arbitrary
|
|
17
|
+
* JavaScript code. It poses a significant security risk if the expressions
|
|
18
|
+
* are not from a trusted source (e.g., user input).
|
|
19
|
+
*
|
|
20
|
+
* It should only be used in controlled environments where all workflow
|
|
21
|
+
* definitions are static and authored by trusted developers.
|
|
22
|
+
*
|
|
23
|
+
* For safer evaluation, use the default `PropertyEvaluator` or install a
|
|
24
|
+
* sandboxed library like `jsep` to create a custom, secure evaluator.
|
|
17
25
|
*/
|
|
18
|
-
declare class
|
|
26
|
+
declare class UnsafeEvaluator implements IEvaluator {
|
|
19
27
|
evaluate(expression: string, context: Record<string, any>): any;
|
|
20
28
|
}
|
|
21
29
|
|
|
22
|
-
export {
|
|
30
|
+
export { PropertyEvaluator, UnsafeEvaluator };
|
package/dist/evaluator.js
CHANGED
package/dist/flow.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as NodeFunction, e as NodeClass, N as NodeDefinition, E as EdgeDefinition, W as WorkflowBlueprint } from './types-
|
|
1
|
+
import { d as NodeFunction, e as NodeClass, N as NodeDefinition, E as EdgeDefinition, W as WorkflowBlueprint } from './types-lG3xCzp_.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A fluent API for programmatically constructing a WorkflowBlueprint.
|
|
@@ -7,8 +7,9 @@ declare class Flow<TContext extends Record<string, any> = Record<string, any>, T
|
|
|
7
7
|
private blueprint;
|
|
8
8
|
private functionRegistry;
|
|
9
9
|
private loopControllerIds;
|
|
10
|
+
private loopDefinitions;
|
|
10
11
|
constructor(id: string);
|
|
11
|
-
node(id: string, implementation: NodeFunction<TContext, TDependencies> | NodeClass, options?: Omit<NodeDefinition, 'id' | 'uses'>): this;
|
|
12
|
+
node<TInput = any, TOutput = any, TAction extends string = string>(id: string, implementation: NodeFunction<TContext, TDependencies, TInput, TOutput, TAction> | NodeClass<TContext, TDependencies, TInput, TOutput, TAction>, options?: Omit<NodeDefinition, 'id' | 'uses'>): this;
|
|
12
13
|
edge(source: string, target: string, options?: Omit<EdgeDefinition, 'source' | 'target'>): this;
|
|
13
14
|
/**
|
|
14
15
|
* Creates a batch processing pattern.
|
|
@@ -20,7 +21,7 @@ declare class Flow<TContext extends Record<string, any> = Record<string, any>, T
|
|
|
20
21
|
* @param options.outputKey The key in the context where the array of results will be stored.
|
|
21
22
|
* @returns The Flow instance for chaining.
|
|
22
23
|
*/
|
|
23
|
-
batch(id: string, worker: NodeFunction<TContext, TDependencies> | NodeClass, options: {
|
|
24
|
+
batch<TInput = any, TOutput = any, TAction extends string = string>(id: string, worker: NodeFunction<TContext, TDependencies, TInput, TOutput, TAction> | NodeClass<TContext, TDependencies, TInput, TOutput, TAction>, options: {
|
|
24
25
|
/** The key in the context that holds the input array for the batch. */
|
|
25
26
|
inputKey: string;
|
|
26
27
|
/** The key in the context where the array of results will be stored. */
|
package/dist/flow.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { BlueprintAnalysis, Cycles, analyzeBlueprint, checkForCycles, generateMermaid } from './analysis.js';
|
|
2
2
|
export { AsyncContextView, Context } from './context.js';
|
|
3
3
|
export { CancelledWorkflowError, FatalNodeExecutionError, NodeExecutionError } from './errors.js';
|
|
4
|
+
export { PropertyEvaluator, UnsafeEvaluator } from './evaluator.js';
|
|
4
5
|
export { Flow, createFlow } from './flow.js';
|
|
5
6
|
export { LinterIssue, LinterIssueCode, LinterResult, lintBlueprint } from './linter.js';
|
|
6
7
|
export { ConsoleLogger, NullLogger } from './logger.js';
|
|
7
|
-
export { B as BaseNode, C as ContextImplementation, E as EdgeDefinition, h as IAsyncContext, k as IEvaluator, m as IEventBus, l as ILogger, n as ISerializer, I as ISyncContext, M as Middleware, e as NodeClass, a as NodeConfig, c as NodeContext, N as NodeDefinition, d as NodeFunction, f as NodeImplementation, g as NodeRegistry, b as NodeResult, R as RuntimeDependencies, j as RuntimeOptions, W as WorkflowBlueprint, o as WorkflowError, p as WorkflowResult, i as isNodeClass } from './types-
|
|
8
|
+
export { B as BaseNode, C as ContextImplementation, E as EdgeDefinition, h as IAsyncContext, k as IEvaluator, m as IEventBus, l as ILogger, n as ISerializer, I as ISyncContext, M as Middleware, e as NodeClass, a as NodeConfig, c as NodeContext, N as NodeDefinition, d as NodeFunction, f as NodeImplementation, g as NodeRegistry, b as NodeResult, R as RuntimeDependencies, j as RuntimeOptions, W as WorkflowBlueprint, o as WorkflowError, p as WorkflowResult, i as isNodeClass } from './types-lG3xCzp_.js';
|
|
8
9
|
export { AdapterOptions, BaseDistributedAdapter, ICoordinationStore, JobPayload } from './runtime/adapter.js';
|
|
9
10
|
export { BuiltInNodeExecutor, ClassNodeExecutor, ExecutionStrategy, FunctionNodeExecutor } from './runtime/executors.js';
|
|
10
11
|
export { FlowRuntime } from './runtime/runtime.js';
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import './chunk-55J6XMHW.js';
|
|
2
2
|
import './chunk-HMR2GEGE.js';
|
|
3
|
-
export { BaseDistributedAdapter } from './chunk-
|
|
4
|
-
export { FlowRuntime } from './chunk-
|
|
5
|
-
export { WorkflowState } from './chunk-
|
|
6
|
-
export { GraphTraverser } from './chunk-
|
|
7
|
-
export { sanitizeBlueprint } from './chunk-
|
|
8
|
-
import './chunk-
|
|
9
|
-
export { BuiltInNodeExecutor, ClassNodeExecutor, FunctionNodeExecutor } from './chunk-
|
|
10
|
-
export { AsyncContextView, Context } from './chunk-
|
|
11
|
-
export { CancelledWorkflowError, FatalNodeExecutionError, NodeExecutionError } from './chunk-
|
|
12
|
-
|
|
13
|
-
export { Flow, createFlow } from './chunk-
|
|
14
|
-
export { BaseNode, isNodeClass } from './chunk-
|
|
15
|
-
export { lintBlueprint } from './chunk-
|
|
16
|
-
export { analyzeBlueprint, checkForCycles, generateMermaid } from './chunk-
|
|
17
|
-
export { ConsoleLogger, NullLogger } from './chunk-
|
|
3
|
+
export { BaseDistributedAdapter } from './chunk-5EHIPX23.js';
|
|
4
|
+
export { FlowRuntime } from './chunk-CO5BTPKI.js';
|
|
5
|
+
export { WorkflowState } from './chunk-CSZ6EOWG.js';
|
|
6
|
+
export { GraphTraverser } from './chunk-UMXW3TCY.js';
|
|
7
|
+
export { sanitizeBlueprint } from './chunk-DSYAC4WB.js';
|
|
8
|
+
import './chunk-CYHZ2YVH.js';
|
|
9
|
+
export { BuiltInNodeExecutor, ClassNodeExecutor, FunctionNodeExecutor } from './chunk-QRMUKDSP.js';
|
|
10
|
+
export { AsyncContextView, Context } from './chunk-KWQHFT7E.js';
|
|
11
|
+
export { CancelledWorkflowError, FatalNodeExecutionError, NodeExecutionError } from './chunk-5ZXV3R5D.js';
|
|
12
|
+
export { PropertyEvaluator, UnsafeEvaluator } from './chunk-PH2IYZHV.js';
|
|
13
|
+
export { Flow, createFlow } from './chunk-5ZWYSKMH.js';
|
|
14
|
+
export { BaseNode, isNodeClass } from './chunk-5QMPFUKA.js';
|
|
15
|
+
export { lintBlueprint } from './chunk-UETC63DP.js';
|
|
16
|
+
export { analyzeBlueprint, checkForCycles, generateMermaid } from './chunk-HN72TZY5.js';
|
|
17
|
+
export { ConsoleLogger, NullLogger } from './chunk-4PELJWF7.js';
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
|
19
19
|
//# sourceMappingURL=index.js.map
|
package/dist/linter.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as WorkflowBlueprint, d as NodeFunction, e as NodeClass } from './types-
|
|
1
|
+
import { W as WorkflowBlueprint, d as NodeFunction, e as NodeClass } from './types-lG3xCzp_.js';
|
|
2
2
|
|
|
3
3
|
type LinterIssueCode = 'INVALID_EDGE_SOURCE' | 'INVALID_EDGE_TARGET' | 'MISSING_NODE_IMPLEMENTATION' | 'ORPHAN_NODE';
|
|
4
4
|
interface LinterIssue {
|