Skip to content

feat(ui): create agent node and prompt template edge components#1110

Open
geoffjay wants to merge 2 commits intoissue-1097from
issue-1098
Open

feat(ui): create agent node and prompt template edge components#1110
geoffjay wants to merge 2 commits intoissue-1097from
issue-1098

Conversation

@geoffjay
Copy link
Copy Markdown
Owner

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

@geoffjay geoffjay added the review-agent Used to invoke a review by an agent tracking this label label Apr 14, 2026
Copy link
Copy Markdown
Owner Author

@geoffjay geoffjay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. 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.
  2. 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.
  3. 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.

@geoffjay geoffjay added merge-queue Approved by reviewer, queued for merge by conductor and removed review-agent Used to invoke a review by an agent tracking this label labels Apr 17, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-queue Approved by reviewer, queued for merge by conductor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant