@bian-womp/spark-graph 0.3.41 → 0.3.43

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/lib/cjs/index.cjs CHANGED
@@ -926,8 +926,10 @@ class Graph {
926
926
  if (inbound.length === 0)
927
927
  return true;
928
928
  for (const e of inbound) {
929
- if (!(e.target.handle in node.inputs))
929
+ if (node.resolvedHandles?.inputs?.[e.target.handle] &&
930
+ !node.inputs[e.target.handle]) {
930
931
  return false;
932
+ }
931
933
  }
932
934
  return true;
933
935
  }
@@ -3409,6 +3411,11 @@ class GraphRuntime {
3409
3411
  return;
3410
3412
  this.hydrate({ outputs: { [toNodeId]: { ...fromNode.outputs } } }, { invalidate: !options?.dry });
3411
3413
  this.handleResolver.scheduleRecomputeHandles(toNodeId);
3414
+ const node = this.graph.getNode(toNodeId);
3415
+ const shouldAutoRun = this.runMode === "auto" || node?.policy?.autoRun === true;
3416
+ if (shouldAutoRun && this.graph.allInboundHaveValue(toNodeId)) {
3417
+ this.execute(toNodeId);
3418
+ }
3412
3419
  }
3413
3420
  hydrate(payload, opts) {
3414
3421
  const releasePause = this.requestPause();
@@ -3652,8 +3659,9 @@ class GraphRuntime {
3652
3659
  this.edgePropagator.clearArrayBuckets(nodeId);
3653
3660
  // Trigger handle resolution when inputs are removed
3654
3661
  this.handleResolver.scheduleRecomputeHandles(nodeId);
3655
- if (this.runMode === "auto" &&
3656
- this.graph.allInboundHaveValue(nodeId)) {
3662
+ const node = this.graph.getNode(nodeId);
3663
+ const shouldAutoRun = this.runMode === "auto" || node?.policy?.autoRun === true;
3664
+ if (shouldAutoRun && this.graph.allInboundHaveValue(nodeId)) {
3657
3665
  this.execute(nodeId);
3658
3666
  }
3659
3667
  }