@synergenius/flow-weaver 0.22.5 → 0.22.6

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.
@@ -9886,7 +9886,7 @@ var VERSION;
9886
9886
  var init_generated_version = __esm({
9887
9887
  "src/generated-version.ts"() {
9888
9888
  "use strict";
9889
- VERSION = "0.22.5";
9889
+ VERSION = "0.22.6";
9890
9890
  }
9891
9891
  });
9892
9892
 
@@ -10791,16 +10791,35 @@ function buildNodeArgumentsWithContext(opts) {
10791
10791
  } else if (skipPorts?.has("execute")) {
10792
10792
  args.push(`${safeId}_execute`);
10793
10793
  } else if (executeConnections.length > 0) {
10794
- const conn = executeConnections[0];
10795
- const sourceNode = conn.from.node;
10796
- const sourcePort = conn.from.port;
10797
10794
  const varName = `${safeId}_execute`;
10798
- const sourceIdx = isStartNode(sourceNode) ? "startIdx" : `${toValidIdentifier(sourceNode)}Idx`;
10799
- const isConstSource = isStartNode(sourceNode) || sourceNode === instanceParent;
10800
- const nonNullAssert = isConstSource ? "" : "!";
10801
- lines.push(
10802
- `${indent}const ${varName} = ${getCall}({ id: '${sourceNode}', portName: '${sourcePort}', executionIndex: ${sourceIdx}${nonNullAssert} }) as boolean;`
10803
- );
10795
+ if (executeConnections.length === 1) {
10796
+ const conn = executeConnections[0];
10797
+ const sourceNode = conn.from.node;
10798
+ const sourcePort = conn.from.port;
10799
+ const sourceIdx = isStartNode(sourceNode) ? "startIdx" : `${toValidIdentifier(sourceNode)}Idx`;
10800
+ const isConstSource = isStartNode(sourceNode) || sourceNode === instanceParent;
10801
+ if (isConstSource) {
10802
+ lines.push(
10803
+ `${indent}const ${varName} = ${getCall}({ id: '${sourceNode}', portName: '${sourcePort}', executionIndex: ${sourceIdx} }) as boolean;`
10804
+ );
10805
+ } else {
10806
+ lines.push(
10807
+ `${indent}const ${varName} = ${sourceIdx} !== undefined ? ${getCall}({ id: '${sourceNode}', portName: '${sourcePort}', executionIndex: ${sourceIdx} }) as boolean : false;`
10808
+ );
10809
+ }
10810
+ } else {
10811
+ const parts = executeConnections.map((conn) => {
10812
+ const sourceNode = conn.from.node;
10813
+ const sourcePort = conn.from.port;
10814
+ const sourceIdx = isStartNode(sourceNode) ? "startIdx" : `${toValidIdentifier(sourceNode)}Idx`;
10815
+ const isConstSource = isStartNode(sourceNode) || sourceNode === instanceParent;
10816
+ if (isConstSource) {
10817
+ return `(${getCall}({ id: '${sourceNode}', portName: '${sourcePort}', executionIndex: ${sourceIdx} }) as boolean)`;
10818
+ }
10819
+ return `(${sourceIdx} !== undefined ? ${getCall}({ id: '${sourceNode}', portName: '${sourcePort}', executionIndex: ${sourceIdx} }) as boolean : false)`;
10820
+ });
10821
+ lines.push(`${indent}const ${varName} = ${parts.join(" || ")};`);
10822
+ }
10804
10823
  if (emitInputEvents) {
10805
10824
  lines.push(
10806
10825
  `${indent}${setCall}({ id: '${id}', portName: 'execute', executionIndex: ${safeId}Idx, nodeTypeName: '${effectiveNodeTypeName}' }, ${varName});`
@@ -94920,7 +94939,7 @@ var {
94920
94939
  // src/cli/index.ts
94921
94940
  init_logger();
94922
94941
  init_error_utils();
94923
- var version2 = true ? "0.22.5" : "0.0.0-dev";
94942
+ var version2 = true ? "0.22.6" : "0.0.0-dev";
94924
94943
  var program2 = new Command();
94925
94944
  program2.name("fw").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", () => {
94926
94945
  logger.banner(version2);
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.22.5";
1
+ export declare const VERSION = "0.22.6";
2
2
  //# sourceMappingURL=generated-version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by scripts/generate-version.ts — do not edit manually
2
- export const VERSION = '0.22.5';
2
+ export const VERSION = '0.22.6';
3
3
  //# sourceMappingURL=generated-version.js.map
@@ -172,16 +172,36 @@ export function buildNodeArgumentsWithContext(opts) {
172
172
  args.push(`${safeId}_execute`);
173
173
  }
174
174
  else if (executeConnections.length > 0) {
175
- // Execute port has a connection - use it
176
- const conn = executeConnections[0];
177
- const sourceNode = conn.from.node;
178
- const sourcePort = conn.from.port;
175
+ // Execute port has connections - use them
179
176
  const varName = `${safeId}_execute`;
180
- // startIdx is const so no ! needed; parent scope node is also const; other node indices are let so need !
181
- const sourceIdx = isStartNode(sourceNode) ? 'startIdx' : `${toValidIdentifier(sourceNode)}Idx`;
182
- const isConstSource = isStartNode(sourceNode) || sourceNode === instanceParent;
183
- const nonNullAssert = isConstSource ? '' : '!';
184
- lines.push(`${indent}const ${varName} = ${getCall}({ id: '${sourceNode}', portName: '${sourcePort}', executionIndex: ${sourceIdx}${nonNullAssert} }) as boolean;`);
177
+ if (executeConnections.length === 1) {
178
+ const conn = executeConnections[0];
179
+ const sourceNode = conn.from.node;
180
+ const sourcePort = conn.from.port;
181
+ const sourceIdx = isStartNode(sourceNode) ? 'startIdx' : `${toValidIdentifier(sourceNode)}Idx`;
182
+ const isConstSource = isStartNode(sourceNode) || sourceNode === instanceParent;
183
+ if (isConstSource) {
184
+ lines.push(`${indent}const ${varName} = ${getCall}({ id: '${sourceNode}', portName: '${sourcePort}', executionIndex: ${sourceIdx} }) as boolean;`);
185
+ }
186
+ else {
187
+ // Non-const source may be undefined (CANCELLED branch) — guard with false default
188
+ lines.push(`${indent}const ${varName} = ${sourceIdx} !== undefined ? ${getCall}({ id: '${sourceNode}', portName: '${sourcePort}', executionIndex: ${sourceIdx} }) as boolean : false;`);
189
+ }
190
+ }
191
+ else {
192
+ // Multiple execute connections — coalesce with ||, each guarded
193
+ const parts = executeConnections.map((conn) => {
194
+ const sourceNode = conn.from.node;
195
+ const sourcePort = conn.from.port;
196
+ const sourceIdx = isStartNode(sourceNode) ? 'startIdx' : `${toValidIdentifier(sourceNode)}Idx`;
197
+ const isConstSource = isStartNode(sourceNode) || sourceNode === instanceParent;
198
+ if (isConstSource) {
199
+ return `(${getCall}({ id: '${sourceNode}', portName: '${sourcePort}', executionIndex: ${sourceIdx} }) as boolean)`;
200
+ }
201
+ return `(${sourceIdx} !== undefined ? ${getCall}({ id: '${sourceNode}', portName: '${sourcePort}', executionIndex: ${sourceIdx} }) as boolean : false)`;
202
+ });
203
+ lines.push(`${indent}const ${varName} = ${parts.join(' || ')};`);
204
+ }
185
205
  // Emit VARIABLE_SET for execute input port
186
206
  if (emitInputEvents) {
187
207
  lines.push(`${indent}${setCall}({ id: '${id}', portName: 'execute', executionIndex: ${safeId}Idx, nodeTypeName: '${effectiveNodeTypeName}' }, ${varName});`);
@@ -814,7 +814,9 @@ isAsync = false) {
814
814
  if (!instance)
815
815
  return;
816
816
  const safeId = toValidIdentifier(instanceId);
817
- // Add execution index for this skipped node so the event has a valid reference
817
+ // Use const (block-scoped) intentionally the outer `let ${safeId}Idx`
818
+ // stays undefined, which signals to downstream guards that this node was
819
+ // CANCELLED and its data ports should not be read.
818
820
  lines.push(`${indent}const ${safeId}Idx = ${ctxVar}.addExecution('${instanceId}');`);
819
821
  // Set STEP port variables so downstream nodes reading onSuccess/onFailure
820
822
  // from this cancelled node don't crash with "Variable not found".
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synergenius/flow-weaver",
3
- "version": "0.22.5",
3
+ "version": "0.22.6",
4
4
  "description": "Deterministic workflow compiler for AI agents. Compiles to standalone TypeScript, no runtime dependencies.",
5
5
  "private": false,
6
6
  "type": "module",