@bian-womp/spark-workbench 0.3.8 → 0.3.9

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
@@ -2192,7 +2192,34 @@ const HANDLE_SIZE_PX = 12;
2192
2192
  function computeEffectiveHandles(node, registry) {
2193
2193
  const desc = registry.nodes.get(node.typeId);
2194
2194
  const resolved = node.resolvedHandles || {};
2195
- const inputs = { ...desc?.inputs, ...resolved.inputs };
2195
+ // Merge inputs properly, handling metadata
2196
+ const inputs = {};
2197
+ // First, add all static handles
2198
+ if (desc?.inputs) {
2199
+ for (const [handle, staticDesc] of Object.entries(desc.inputs)) {
2200
+ inputs[handle] = staticDesc;
2201
+ }
2202
+ }
2203
+ // Then, merge dynamic handles (dynamic can override/extend static)
2204
+ if (resolved.inputs) {
2205
+ for (const [handle, dynamicDesc] of Object.entries(resolved.inputs)) {
2206
+ const staticDesc = desc?.inputs?.[handle];
2207
+ const merged = sparkGraph.mergeInputHandleDescriptors(staticDesc, dynamicDesc);
2208
+ if (merged) {
2209
+ inputs[handle] = merged;
2210
+ }
2211
+ }
2212
+ }
2213
+ // Finally, apply overrides from node definition
2214
+ if (node.resolvedHandles?.inputs) {
2215
+ for (const [handle, overrideDesc] of Object.entries(node.resolvedHandles.inputs)) {
2216
+ const existingDesc = inputs[handle];
2217
+ const merged = sparkGraph.mergeInputHandleDescriptors(existingDesc, overrideDesc);
2218
+ if (merged) {
2219
+ inputs[handle] = merged;
2220
+ }
2221
+ }
2222
+ }
2196
2223
  const outputs = { ...desc?.outputs, ...resolved.outputs };
2197
2224
  const inputDefaults = { ...desc?.inputDefaults, ...resolved.inputDefaults };
2198
2225
  return { inputs, outputs, inputDefaults };