feat(ui): create agent node and prompt template edge components#1110
Open
geoffjay wants to merge 2 commits intoissue-1097from
Open
feat(ui): create agent node and prompt template edge components#1110geoffjay wants to merge 2 commits intoissue-1097from
geoffjay wants to merge 2 commits intoissue-1097from
Conversation
Owner
Author
|
This change is part of the following stack:
Change managed by git-spice. |
This was referenced Apr 14, 2026
geoffjay
commented
Apr 17, 2026
Owner
Author
geoffjay
left a comment
There was a problem hiding this comment.
Review: feat(ui): create agent node and prompt template edge components
Stack position: issue-1098 (#1110) stacked on issue-1097 (#1109). Parent #1109 is being reviewed simultaneously and has no blocking issues.
Overview
Adds AgentNode (status-aware borders, tool policy summary, model display, left input handle) and PromptEdge (Bezier curve, truncated template preview, poll interval badge, click callback). Registers both in workflowNodeTypes/workflowEdgeTypes. 29 tests.
What looks good
- toolPolicySummary switch: Covers all 5 ToolPolicy modes with a default: return "Custom policy" fallback. Singular/plural handled correctly for allow_list/deny_list (1 tool allowed vs 3 tools allowed). All 6 cases tested.
- Status border colours: STATUS_BORDER is typed as Record<AgentStatus, string> — TypeScript enforces completeness. The ?? STATUS_BORDER.stopped fallback correctly handles unknown status values at runtime.
- Selected-state priority: When selected, the node uses border-blue-500 ring-2 which overrides the status border class. The logic is clear and intentional.
- PromptEdge truncation: truncateTemplate takes the first line, trims it, and truncates at 40 chars with an ellipsis. The button also sets title={promptTemplate} for full-text hover. Good UX.
- Interval badge pointer-events: none: Prevents the badge div from intercepting clicks intended for the canvas or the label button. Correct.
- EdgeLabelRenderer mock: The test correctly stubs the portal-based renderer to render inline, with a clear comment explaining why. Consistent with how later PRs in the stack handle this.
Non-blocking notes
- onIntervalChange is declared in PromptEdgeData but never invoked — the interval badge has pointerEvents: "none" and no click handler. The callback is advertised in the interface but has no trigger path in the component. Either wire it up or remove it until needed, to avoid callers assuming it works.
- label.querySelector("button")! in the click test (line 161) uses a non-null assertion. If the label's DOM structure changes and the button is removed, the test throws TypeError rather than a clear assertion failure. screen.getByRole("button") would give a clearer error message.
- isCustomised comment says "not purely the default placeholder" but the implementation just checks template.trim().length > 0. There is no placeholder logic — the comment is slightly misleading.
Verdict
Clean, well-tested components. The onIntervalChange gap is worth resolving before callers start passing it expecting it to work, but nothing is blocking merge. LGTM.
AgentNode: - Displays agent name, status badge (dot variant), model, tool policy summary - Input handle on left for incoming trigger connections - Status-aware border: green=running, red=failed, amber=pending, grey=stopped - Selected state with ring highlight - 19 tests covering rendering, tool policies, model, status colours, selection PromptEdge: - Styled Bezier curve using React Flow getBezierPath - Edge label shows truncated prompt template preview (first 40 chars) - Click callback to open prompt template editor - Poll interval badge on the path - Visually distinct for empty vs customised prompts nodeTypes.ts updated with agent node and prompt edge type registrations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add AgentNode (status-aware borders, tool policy summary, input handle) and PromptEdge (Bezier curve, truncated template preview, poll interval badge, click callback). Register both in workflowNodeTypes/workflowEdgeTypes. 29 tests.
Closes #1098