Skip to content

Support rich custom tool rendering via metadata kind (diff.v1) instead of tool-id only #15451

@onslauth

Description

@onslauth

Motivation

The reason I am opening this issue is because I wanted to see the nice ApplyPatch output, but for proposed changes that haven't yet been committed. I investigated using a custom-tool for this purpose, only to discover that the output cannot be rendered in the same format as ApplyPatch.

Problem

OpenCode currently hardcodes rich TUI rendering by tool id (for example, apply_patch), so custom tools cannot render rich components even if they return structured data.
Custom tools fall back to generic text output, and HTML/JSX from tools is not a safe or supported path.

Goal

Enable custom tools to return typed render metadata (starting with diff.v1) so the TUI can render rich diffs without requiring built-in tool ids.

Progress

I have already gone ahead and created the necessary changes and tested it with a working custom tool. All tests are passing. Also added new tests for the implemented and changed functionality.

Question

I wanted to find out if this is something that the team would like to investigate, and if so, I would be glad to start on the process of submitting. Otherwise if this is not something the team is interested in, please go ahead and close this ticket.

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions