[PR #7109] feat(tui): enable plugin tools to use Task component rendering #12250

Open
opened 2026-02-16 18:17:10 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7109

State: open
Merged: No


Summary

This PR enables external plugin tools to use the built-in Task component's TUI rendering, providing a consistent visual experience for custom task implementations.

Changes

  • TUI Routing: Route plugin tools with sessionId metadata to Task/BlockTool component
  • Task Component: Support flexible input shapes from external tools (agentName fallback chain, conditional toolcalls display)
  • Registry: Preserve plugin tool metadata by wrapping context and capturing metadata() calls

How it works

Plugin tools can now call ctx.metadata({ metadata: { sessionId: "..." } }) to opt into BlockTool rendering. The TUI checks for metadata.sessionId presence and routes accordingly.

Technical Details

  • Removed as any type assertion in registry, replaced with explicit types
  • Added wrappedCtx to intercept and capture metadata from plugin tool execution
  • Task component now derives agentName from multiple sources: subagent_type → agent → category → tool
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7109 **State:** open **Merged:** No --- ## Summary This PR enables external plugin tools to use the built-in Task component's TUI rendering, providing a consistent visual experience for custom task implementations. ### Changes - **TUI Routing**: Route plugin tools with `sessionId` metadata to Task/BlockTool component - **Task Component**: Support flexible input shapes from external tools (agentName fallback chain, conditional toolcalls display) - **Registry**: Preserve plugin tool metadata by wrapping context and capturing `metadata()` calls ### How it works Plugin tools can now call `ctx.metadata({ metadata: { sessionId: "..." } })` to opt into BlockTool rendering. The TUI checks for `metadata.sessionId` presence and routes accordingly. ### Technical Details - Removed `as any` type assertion in registry, replaced with explicit types - Added `wrappedCtx` to intercept and capture metadata from plugin tool execution - Task component now derives `agentName` from multiple sources: `subagent_type → agent → category → tool`
yindo added the pull-request label 2026-02-16 18:17:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12250