@synergenius/flow-weaver 0.20.6 → 0.20.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/flow-weaver.mjs +21 -8
- package/dist/cli/templates/shared/llm-types.d.ts +1 -1
- package/dist/cli/templates/shared/llm-types.js +1 -1
- package/dist/cli/templates/workflows/foreach.js +1 -2
- package/dist/generated-version.d.ts +1 -1
- package/dist/generated-version.js +1 -1
- package/dist/generator/unified.js +25 -3
- package/package.json +1 -1
package/dist/cli/flow-weaver.mjs
CHANGED
|
@@ -9671,7 +9671,7 @@ var VERSION;
|
|
|
9671
9671
|
var init_generated_version = __esm({
|
|
9672
9672
|
"src/generated-version.ts"() {
|
|
9673
9673
|
"use strict";
|
|
9674
|
-
VERSION = "0.20.
|
|
9674
|
+
VERSION = "0.20.7";
|
|
9675
9675
|
}
|
|
9676
9676
|
});
|
|
9677
9677
|
|
|
@@ -10970,7 +10970,21 @@ function generateControlFlowWithExecutionContext(workflow, nodeTypes, isAsync2,
|
|
|
10970
10970
|
region.failureNodes.delete(instanceId);
|
|
10971
10971
|
});
|
|
10972
10972
|
});
|
|
10973
|
-
const
|
|
10973
|
+
const nodesInBothBranches = /* @__PURE__ */ new Set();
|
|
10974
|
+
branchRegions.forEach((region) => {
|
|
10975
|
+
region.successNodes.forEach((nodeId) => {
|
|
10976
|
+
if (region.failureNodes.has(nodeId)) {
|
|
10977
|
+
nodesInBothBranches.add(nodeId);
|
|
10978
|
+
}
|
|
10979
|
+
});
|
|
10980
|
+
});
|
|
10981
|
+
branchRegions.forEach((region) => {
|
|
10982
|
+
nodesInBothBranches.forEach((nodeId) => {
|
|
10983
|
+
region.successNodes.delete(nodeId);
|
|
10984
|
+
region.failureNodes.delete(nodeId);
|
|
10985
|
+
});
|
|
10986
|
+
});
|
|
10987
|
+
const nodesPromotedFromBranches = new Set(nodesInBothBranches);
|
|
10974
10988
|
branchRegions.forEach((region, branchNodeId) => {
|
|
10975
10989
|
const allBranchNodes = /* @__PURE__ */ new Set([...region.successNodes, ...region.failureNodes]);
|
|
10976
10990
|
allBranchNodes.forEach((nodeId) => {
|
|
@@ -11134,7 +11148,7 @@ function generateControlFlowWithExecutionContext(workflow, nodeTypes, isAsync2,
|
|
|
11134
11148
|
}
|
|
11135
11149
|
});
|
|
11136
11150
|
if (stepSourceConditions.length > 0) {
|
|
11137
|
-
const condition = stepSourceConditions.join("
|
|
11151
|
+
const condition = stepSourceConditions.length === 1 ? stepSourceConditions[0] : stepSourceConditions.join(" || ");
|
|
11138
11152
|
lines.push(` if (${condition}) {`);
|
|
11139
11153
|
chainIndent = " ";
|
|
11140
11154
|
chainNeedsClose = true;
|
|
@@ -11174,7 +11188,7 @@ function generateControlFlowWithExecutionContext(workflow, nodeTypes, isAsync2,
|
|
|
11174
11188
|
}
|
|
11175
11189
|
});
|
|
11176
11190
|
if (stepSourceConditions.length > 0) {
|
|
11177
|
-
const condition = stepSourceConditions.join("
|
|
11191
|
+
const condition = stepSourceConditions.length === 1 ? stepSourceConditions[0] : stepSourceConditions.join(" || ");
|
|
11178
11192
|
lines.push(` if (${condition}) {`);
|
|
11179
11193
|
branchIndent = " ";
|
|
11180
11194
|
branchNeedsClose = true;
|
|
@@ -46770,7 +46784,7 @@ function aggregateResults(
|
|
|
46770
46784
|
|
|
46771
46785
|
/**
|
|
46772
46786
|
* @flowWeaver workflow
|
|
46773
|
-
* @node iterator forEachItem [position: -90 0] [color: "purple"] [icon: "repeat"]
|
|
46787
|
+
* @node iterator forEachItem [position: -90 0] [color: "purple"] [icon: "repeat"] [suppress: "DESIGN_SCOPE_NO_FAILURE_EXIT"]
|
|
46774
46788
|
* @node processor processItem iterator.processItem [color: "blue"] [icon: "settings"]
|
|
46775
46789
|
* @node aggregator aggregateResults [position: 270 0] [color: "teal"] [icon: "inventory"]
|
|
46776
46790
|
* @position Start -450 0
|
|
@@ -46785,7 +46799,6 @@ function aggregateResults(
|
|
|
46785
46799
|
* @connect iterator.results -> Exit.results
|
|
46786
46800
|
* @connect iterator.results -> aggregator.results
|
|
46787
46801
|
* @connect iterator.onSuccess -> aggregator.execute
|
|
46788
|
-
* @connect iterator.onFailure -> aggregator.execute
|
|
46789
46802
|
* @connect aggregator.successCount -> Exit.successCount
|
|
46790
46803
|
* @connect aggregator.failedCount -> Exit.failedCount
|
|
46791
46804
|
* @connect aggregator.onSuccess -> Exit.onSuccess
|
|
@@ -47252,7 +47265,7 @@ interface LLMProvider {
|
|
|
47252
47265
|
async chat(messages) {
|
|
47253
47266
|
const lastMessage = messages[messages.length - 1];
|
|
47254
47267
|
return {
|
|
47255
|
-
content: \`[Mock response to: \${lastMessage
|
|
47268
|
+
content: \`[Mock response to: \${(lastMessage?.content ?? '').slice(0, 50)}...]\`,
|
|
47256
47269
|
toolCalls: [],
|
|
47257
47270
|
finishReason: 'stop',
|
|
47258
47271
|
usage: { promptTokens: 10, completionTokens: 20 },
|
|
@@ -107083,7 +107096,7 @@ function displayInstalledPackage(pkg) {
|
|
|
107083
107096
|
// src/cli/index.ts
|
|
107084
107097
|
init_logger();
|
|
107085
107098
|
init_error_utils();
|
|
107086
|
-
var version2 = true ? "0.20.
|
|
107099
|
+
var version2 = true ? "0.20.7" : "0.0.0-dev";
|
|
107087
107100
|
var program2 = new Command();
|
|
107088
107101
|
program2.name("flow-weaver").description("Flow Weaver Annotations - Compile and validate workflow files").option("-v, --version", "Output the current version").option("--no-color", "Disable colors").option("--color", "Force colors").on("option:version", () => {
|
|
107089
107102
|
logger.banner(version2);
|
|
@@ -9,7 +9,7 @@ export declare const LLM_CORE_TYPES = "interface LLMMessage {\n role: 'system'
|
|
|
9
9
|
/** Simplified LLM types — for templates that don't need tool calling */
|
|
10
10
|
export declare const LLM_SIMPLE_TYPES = "interface LLMMessage {\n role: 'system' | 'user' | 'assistant' | 'tool';\n content: string;\n toolCallId?: string;\n}\n\ninterface LLMToolCall {\n id: string;\n name: string;\n arguments: Record<string, unknown>;\n}\n\ninterface LLMResponse {\n content: string | null;\n toolCalls: LLMToolCall[];\n finishReason: 'stop' | 'tool_calls' | 'length' | 'error';\n usage?: { promptTokens: number; completionTokens: number };\n}\n\ninterface LLMProvider {\n chat(messages: LLMMessage[], options?: { systemPrompt?: string; model?: string; temperature?: number; maxTokens?: number }): Promise<LLMResponse>;\n}";
|
|
11
11
|
/** Mock provider factory code */
|
|
12
|
-
export declare const LLM_MOCK_PROVIDER = "const createMockProvider = (): LLMProvider => ({\n async chat(messages) {\n const lastMessage = messages[messages.length - 1];\n return {\n content: `[Mock response to: ${lastMessage
|
|
12
|
+
export declare const LLM_MOCK_PROVIDER = "const createMockProvider = (): LLMProvider => ({\n async chat(messages) {\n const lastMessage = messages[messages.length - 1];\n return {\n content: `[Mock response to: ${(lastMessage?.content ?? '').slice(0, 50)}...]`,\n toolCalls: [],\n finishReason: 'stop',\n usage: { promptTokens: 10, completionTokens: 20 },\n };\n },\n});\n\nconst llmProvider: LLMProvider = (globalThis as unknown as { __fw_llm_provider__?: LLMProvider }).__fw_llm_provider__ ?? createMockProvider();";
|
|
13
13
|
/** Mock provider with tool calling support (for ai-agent) */
|
|
14
14
|
export declare const LLM_MOCK_PROVIDER_WITH_TOOLS = "const createMockProvider = (): LLMProvider => ({\n async chat(messages, options) {\n const last = messages[messages.length - 1];\n if (options?.tools && last.content.toLowerCase().includes('search')) {\n return {\n content: null,\n toolCalls: [\n {\n id: 'call_' + Date.now(),\n name: 'search',\n arguments: { query: last.content },\n },\n ],\n finishReason: 'tool_calls',\n usage: { promptTokens: 15, completionTokens: 30 },\n };\n }\n\n return {\n content: '[Mock answer] ' + last.content,\n toolCalls: [],\n finishReason: 'stop',\n usage: { promptTokens: 10, completionTokens: 20 },\n };\n },\n});\n\nconst llmProvider: LLMProvider = (globalThis as unknown as { __fw_llm_provider__?: LLMProvider }).__fw_llm_provider__ ?? createMockProvider();";
|
|
15
15
|
//# sourceMappingURL=llm-types.d.ts.map
|
|
@@ -68,7 +68,7 @@ export const LLM_MOCK_PROVIDER = `const createMockProvider = (): LLMProvider =>
|
|
|
68
68
|
async chat(messages) {
|
|
69
69
|
const lastMessage = messages[messages.length - 1];
|
|
70
70
|
return {
|
|
71
|
-
content: \`[Mock response to: \${lastMessage
|
|
71
|
+
content: \`[Mock response to: \${(lastMessage?.content ?? '').slice(0, 50)}...]\`,
|
|
72
72
|
toolCalls: [],
|
|
73
73
|
finishReason: 'stop',
|
|
74
74
|
usage: { promptTokens: 10, completionTokens: 20 },
|
|
@@ -101,7 +101,7 @@ function aggregateResults(
|
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
103
|
* @flowWeaver workflow
|
|
104
|
-
* @node iterator forEachItem [position: -90 0] [color: "purple"] [icon: "repeat"]
|
|
104
|
+
* @node iterator forEachItem [position: -90 0] [color: "purple"] [icon: "repeat"] [suppress: "DESIGN_SCOPE_NO_FAILURE_EXIT"]
|
|
105
105
|
* @node processor processItem iterator.processItem [color: "blue"] [icon: "settings"]
|
|
106
106
|
* @node aggregator aggregateResults [position: 270 0] [color: "teal"] [icon: "inventory"]
|
|
107
107
|
* @position Start -450 0
|
|
@@ -116,7 +116,6 @@ function aggregateResults(
|
|
|
116
116
|
* @connect iterator.results -> Exit.results
|
|
117
117
|
* @connect iterator.results -> aggregator.results
|
|
118
118
|
* @connect iterator.onSuccess -> aggregator.execute
|
|
119
|
-
* @connect iterator.onFailure -> aggregator.execute
|
|
120
119
|
* @connect aggregator.successCount -> Exit.successCount
|
|
121
120
|
* @connect aggregator.failedCount -> Exit.failedCount
|
|
122
121
|
* @connect aggregator.onSuccess -> Exit.onSuccess
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.20.
|
|
1
|
+
export declare const VERSION = "0.20.7";
|
|
2
2
|
//# sourceMappingURL=generated-version.d.ts.map
|
|
@@ -207,9 +207,27 @@ export function generateControlFlowWithExecutionContext(workflow, nodeTypes, isA
|
|
|
207
207
|
region.failureNodes.delete(instanceId);
|
|
208
208
|
});
|
|
209
209
|
});
|
|
210
|
+
// Promote nodes that appear in BOTH success and failure regions of the same
|
|
211
|
+
// branching node. These nodes execute regardless of which branch is taken,
|
|
212
|
+
// so they must not be nested inside either branch (which would cause duplicate
|
|
213
|
+
// variable declarations and cancelled events for nodes that actually run).
|
|
214
|
+
const nodesInBothBranches = new Set();
|
|
215
|
+
branchRegions.forEach((region) => {
|
|
216
|
+
region.successNodes.forEach((nodeId) => {
|
|
217
|
+
if (region.failureNodes.has(nodeId)) {
|
|
218
|
+
nodesInBothBranches.add(nodeId);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
branchRegions.forEach((region) => {
|
|
223
|
+
nodesInBothBranches.forEach((nodeId) => {
|
|
224
|
+
region.successNodes.delete(nodeId);
|
|
225
|
+
region.failureNodes.delete(nodeId);
|
|
226
|
+
});
|
|
227
|
+
});
|
|
210
228
|
// Promote nodes that have DATA dependencies on nodes outside their branch.
|
|
211
229
|
// Without this, STEP-nesting places the node before its data providers are generated.
|
|
212
|
-
const nodesPromotedFromBranches = new Set();
|
|
230
|
+
const nodesPromotedFromBranches = new Set(nodesInBothBranches);
|
|
213
231
|
branchRegions.forEach((region, branchNodeId) => {
|
|
214
232
|
const allBranchNodes = new Set([...region.successNodes, ...region.failureNodes]);
|
|
215
233
|
allBranchNodes.forEach((nodeId) => {
|
|
@@ -383,7 +401,9 @@ export function generateControlFlowWithExecutionContext(workflow, nodeTypes, isA
|
|
|
383
401
|
}
|
|
384
402
|
});
|
|
385
403
|
if (stepSourceConditions.length > 0) {
|
|
386
|
-
const condition = stepSourceConditions.
|
|
404
|
+
const condition = stepSourceConditions.length === 1
|
|
405
|
+
? stepSourceConditions[0]
|
|
406
|
+
: stepSourceConditions.join(' || ');
|
|
387
407
|
lines.push(` if (${condition}) {`);
|
|
388
408
|
chainIndent = ' ';
|
|
389
409
|
chainNeedsClose = true;
|
|
@@ -410,7 +430,9 @@ export function generateControlFlowWithExecutionContext(workflow, nodeTypes, isA
|
|
|
410
430
|
}
|
|
411
431
|
});
|
|
412
432
|
if (stepSourceConditions.length > 0) {
|
|
413
|
-
const condition = stepSourceConditions.
|
|
433
|
+
const condition = stepSourceConditions.length === 1
|
|
434
|
+
? stepSourceConditions[0]
|
|
435
|
+
: stepSourceConditions.join(' || ');
|
|
414
436
|
lines.push(` if (${condition}) {`);
|
|
415
437
|
branchIndent = ' ';
|
|
416
438
|
branchNeedsClose = true;
|
package/package.json
CHANGED