Skip to content

Commit d028a94

Browse files
committed
updates
1 parent df97886 commit d028a94

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

packages/evaluator/src/evaluate.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,21 @@ export async function evaluate(graph: Graph, options: EvaluateOptions): Promise<
8585
return result;
8686
}
8787

88+
if (node.type === 'graphOutput') {
89+
// graphOutput is a pass-through: evaluate its upstream 'value' input
90+
const portEdges = edgesByDst.get(nodeName);
91+
const edges = portEdges?.get('value') ?? [];
92+
let value: any = undefined;
93+
if (edges.length > 0) {
94+
const edge = edges[0];
95+
const upstreamOutputs = await evaluateNode(edge.src.node);
96+
value = upstreamOutputs[edge.src.port];
97+
}
98+
const result = { value };
99+
cache.set(nodeName, result);
100+
return result;
101+
}
102+
88103
// Handle subnet nodes (kind: 'subnet')
89104
if (node.kind === 'subnet' && node.nodes && node.edges) {
90105
// Collect inputs for the subnet by evaluating upstream nodes

packages/graph-editor/src/context/GraphContext.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,32 @@ import {
1616
} from '../utils/graphTransform';
1717
import { BOUNDARY_NODE_TYPES, isBoundaryNodeType } from '../types';
1818

19+
// Built-in definitions for boundary node types
20+
// These ensure graphInput/graphOutput/graphProp nodes render their ports
21+
const BOUNDARY_NODE_DEFINITIONS: NodeDefinition[] = [
22+
{
23+
context: 'core',
24+
category: 'graph',
25+
type: BOUNDARY_NODE_TYPES.input, // 'graphInput'
26+
inputs: [],
27+
outputs: [{ name: 'value', type: 'any' }],
28+
},
29+
{
30+
context: 'core',
31+
category: 'graph',
32+
type: BOUNDARY_NODE_TYPES.output, // 'graphOutput'
33+
inputs: [{ name: 'value', type: 'any' }],
34+
outputs: [{ name: 'value', type: 'any' }],
35+
},
36+
{
37+
context: 'core',
38+
category: 'graph',
39+
type: BOUNDARY_NODE_TYPES.prop, // 'graphProp'
40+
inputs: [],
41+
outputs: [{ name: 'value', type: 'any' }],
42+
},
43+
];
44+
1945
// Re-export getEdgeId for backward compatibility
2046
export { getEdgeId } from '../utils/graphTransform';
2147

@@ -234,6 +260,7 @@ function graphReducer(state: GraphEditorState, action: GraphAction): GraphEditor
234260
...state,
235261
graph: migratedGraph,
236262
definitions: new Map([
263+
...BOUNDARY_NODE_DEFINITIONS.map(d => [d.type, d] as [string, NodeDefinition]),
237264
...state.definitions,
238265
...(migratedGraph.definitions || []).map(d => [d.type, d] as [string, NodeDefinition])
239266
])
@@ -950,6 +977,7 @@ export function GraphProvider({ children, initialGraph, externalDefinitions, onS
950977
...initialState,
951978
graph: migratedInitialGraph,
952979
definitions: new Map([
980+
...BOUNDARY_NODE_DEFINITIONS.map(d => [d.type, d] as [string, NodeDefinition]),
953981
...(migratedInitialGraph.definitions || []).map(d => [d.type, d] as [string, NodeDefinition]),
954982
...(externalDefinitions || []).map(d => [d.type, d] as [string, NodeDefinition])
955983
])

0 commit comments

Comments
 (0)