From 6134452891645a8da9ab4a9a74303d089a562e5a Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Fri, 11 Jul 2025 19:45:20 +1000 Subject: [PATCH] Return SubgraphNode widget values during execution (#1114) --- src/subgraph/ExecutableNodeDTO.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/subgraph/ExecutableNodeDTO.ts b/src/subgraph/ExecutableNodeDTO.ts index 373c7c9c93..0482260b63 100644 --- a/src/subgraph/ExecutableNodeDTO.ts +++ b/src/subgraph/ExecutableNodeDTO.ts @@ -19,9 +19,14 @@ export type ExecutionId = string export type ExecutableLGraphNode = Omit type ResolvedInput = { + /** DTO for the node that the link originates from. */ node: ExecutableLGraphNode - origin_id: NodeId + /** Full unique execution ID of the node that the link originates from. */ + origin_id: ExecutionId + /** The slot index of the output on the node that the link originates from. */ origin_slot: number + /** Actual value (e.g. for widgets). */ + value?: unknown } /** @@ -139,7 +144,18 @@ export class ExecutableNodeDTO implements ExecutableLGraphNode { // Nothing connected const linkId = subgraphNodeInput.link - if (linkId == null) return + if (linkId == null) { + const widget = subgraphNode.getWidgetFromSlot(subgraphNodeInput) + if (!widget) return + + // Special case: SubgraphNode widget. + return { + node: this, + origin_id: this.id, + origin_slot: slot, + value: widget.value, + } + } const outerLink = subgraphNode.graph.getLink(linkId) if (!outerLink) throw new InvalidLinkError(`No outer link found for slot [${link.origin_slot}] ${input.name}`)