GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(app): let GUI plugins render tool results by Hona · Pull Request #61536 · anomalyco/opencode

Conversation

@Hona

@Hona Hona commented Nov 4, 2026 •
edited by opencodejr Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

GUI plugins can now restyle the session timeline rows of their own tools and MCP tools. Tools without a renderer now expand to a readable body, with returned images and diagnostics.

  • Plugin API: ctx.add(ToolRenderer, { tool, trigger?, render? }) in @opencode/plugin/gui. It matches a tool by exact name or by prefix_* (MCP tools are named <server>_<tool>). trigger restyles the collapsed row and render replaces the expanded body. Set either one or both.
  • Precedence: tools with a built-in renderer (shell, edit, read, subagent, …) never match, so a plugin can't replace or break them. When several renderers match, an exact name beats a pattern, a longer pattern beats a shorter one, and then the first contributed wins.
  • Isolation: a trigger or render that throws records a plugin failure, and that row falls back to the default row. The plugin's other rows keep rendering.
  • Seam: this uses the same pattern as code blocks. ToolViewsProvider (session-ui/context/tools) is an inherited provider field. PluginLinks fills it and wraps each contribution in Contribution. The host never knows plugin ids.
  • Default row: plugin and MCP rows now expand to show:
    • every input argument in full
    • the output
    • returned images, which open in the image preview on click
    • metadata.diagnostics
  • Image bytes: the app's store drops tool-result image bytes (omitToolFileData). An expanded row reads its own back through a new DataProvider.readToolFiles, which makes one session.message.get call per row.
  • Diagnostics on grouped edits: grouped write/edit/patch rows now keep the metadata.diagnostics that CurrentFileToolGroup used to drop.
import { ToolRenderer } from "@opencode/plugin/gui"

ctx.add(ToolRenderer, {
  tool: "jira_*",
  trigger: (props) => ({ title: ctx.t("jira"), subtitle: String(props.tool.input.jql ?? "") }),
  render: (props) => <IssueTable output={props.tool.output} status={props.tool.status} />,
})
flowchart LR
  row[Tool row] --> builtin{Built-in renderer?}
  builtin -- yes --> b[Built-in row]
  builtin -- no --> match{"ToolRenderer match?<br/>exact > longest prefix_* > first"}
  match -- no --> d["Default row<br/>input, output, images, diagnostics"]
  match -- yes --> p["Plugin trigger + body<br/>(default body when no render)"]
  p -- throws --> d
Loading

Before / after

Before (dev) After: default row After: demo plugin for jira_*

Performance

These numbers come from a story that mounts 600 collapsed MCP tool rows, measured from the click through a forced layout. The runs alternated between the two variants, and the tables show medians.

Registry lookup, same build (n=20 pairs) Mount Script DOM nodes
No tool renderers provided 224.2 ms 197.9 ms 16,821
Host index provided, no row matches 224.0 ms 196.5 ms 16,821
Rows vs dev (n=24 pairs) Mount Script DOM nodes
dev (rows can't expand) 251.1 ms 224.3 ms 12,638
This PR 318.4 ms 277.0 ms 16,821
  • Lookup cost: a row without a built-in renderer reads one memoized index of the contributions, a Map.get plus a scan of the * patterns. It costs nothing measurable. Built-in rows skip the lookup.
  • Expandable rows: the added +0.11 ms and 7 DOM nodes per row are the expand arrow and the collapsible. These are the same parts every expandable built-in row has. With expanding turned off, this PR matches dev within noise (217.0 vs 221.3 ms, equal node count).
  • Bodies: the default body and plugin render mount only after the row expands. File views, diagnostics and image loads start there too. The virtualizer's row observer picks up height changes.
  • No production benchmark: I could not run the production tab-switch benchmark (bun run bench:tabs). Its stable-timeline wait times out on this Windows machine even on dev.

Closes #55961
Closes #57180
Part of #21227: images now show for plugin and MCP tools. The built-in webfetch row still hides attachments.

Visual

<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72" fill="none">
  <defs>
    <clipPath id="body">
      <rect x="0" y="22" width="240" height="50">
        <animate attributeName="height" values="0;0;50;50;0" keyTimes="0;0.15;0.35;0.85;1" dur="4s" repeatCount="indefinite" />
      </rect>
    </clipPath>
  </defs>
  <g fill="currentColor">
    <path d="M14 7l5 4-5 4z" opacity="0.5" transform="rotate(90 16 11)">
      <animateTransform attributeName="transform" type="rotate" values="0 16 11;0 16 11;90 16 11;90 16 11;0 16 11" keyTimes="0;0.15;0.35;0.85;1" dur="4s" repeatCount="indefinite" />
    </path>
    <rect x="26" y="7" width="72" height="8" rx="2" opacity="0.8" />
    <rect x="104" y="7" width="56" height="8" rx="2" opacity="0.35" />
    <rect x="166" y="7" width="22" height="8" rx="2" opacity="0.2" />
  </g>
  <g clip-path="url(#body)" fill="currentColor">
    <rect x="16" y="24" width="1" height="44" opacity="0.25" />
    <rect x="26" y="26" width="30" height="5" rx="1.5" opacity="0.35" />
    <rect x="60" y="26" width="84" height="5" rx="1.5" opacity="0.6" />
    <rect x="26" y="36" width="120" height="16" rx="3" opacity="0.08" stroke="currentColor" stroke-opacity="0.3" />
    <rect x="31" y="41" width="70" height="2" opacity="0.5" />
    <rect x="31" y="46" width="48" height="2" opacity="0.5" />
    <rect x="156" y="26" width="40" height="30" rx="3" opacity="0.12" stroke="currentColor" stroke-opacity="0.35" />
    <path d="M160 52l9-11 7 7 5-5 11 9z" opacity="0.45" />
    <circle cx="186" cy="33" r="3" opacity="0.45" />
    <rect x="26" y="58" width="164" height="8" rx="2" fill="currentColor" opacity="0.1" />
    <rect x="30" y="60.5" width="40" height="3" rx="1" opacity="0.55" />
  </g>
</svg>

Added by the opencode bot (AI-generated).

Related: #21227, #54703, #57818

Public API: adds the ToolRenderer registry and ToolCall/ToolCallFile/ToolCallStatus/ToolRenderProps/ToolTrigger types to @opencode/plugin/gui (backwards compatible)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Hona
feat(app): let GUI plugins render tool results
c28ba31
@Hona
Hona requested a review from Brendonovich as a code owner November 4, 2026 00:51
Copilot AI balanced review requested due to automatic review settings November 4, 2026 00:51
Copilot AI reviewed Nov 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
opencodejr[bot]
opencodejr Bot reviewed Nov 4, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I could not verify this by running it. The change is only visible in the web/desktop app, and this environment has no browser for the app or the Playwright component tests. Type checks pass for session-ui, app and plugin, and the session-ui unit tests pass. The rest of the review is from reading the code: matching, precedence, per-row isolation and the on-demand image reload all look right.

Public API: this adds to the GUI plugin API in @opencode/plugin/gui. It adds the ToolRenderer registry ({ tool, trigger?, render? }) and the types ToolCall, ToolCallFile, ToolCallStatus, ToolRenderProps and ToolTrigger. Inside the monorepo, session-ui gets an optional readToolFiles prop on DataProvider and a new context/tools module. Nothing is removed or changed, so it is backwards compatible.

One concern: when a plugin's renderer matches a tool that failed, the error card is no longer shown (inline comment).

Related: #21227, #54703, #57818

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/session-ui/src/tools/tool-renderer.tsx
<Show when={!hideQuestion()}>
<div data-component="tool-part-wrapper" data-timeline-part-id={props.id}>
<Switch>
<Match when={view()} keyed>

@opencodejr opencodejr Bot Nov 4, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This Match comes before error(), so a tool row that a plugin matches never gets the error card that every other row gets. BasicTool has no visual error state, so a failed call looks like a success in its collapsed row. The message only appears in the default body after you expand the row. If the plugin provides render, the message is never shown unless the plugin renders props.tool.error itself. Could the row keep the error card on failure (for example, try the plugin view only when !error(), or at least on the trigger), so a plugin can't hide tool failures by accident?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@opencodejr opencodejr Bot mentioned this pull request Nov 17, 2026
Desktop: finished ctx_* tool call body can't be expanded (works on mobile) #64376
Closed
@opencodejr opencodejr Bot mentioned this pull request Nov 24, 2026
desktop: images from tool results never render in chat #66062
Closed

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@opencodejr opencodejr[bot] opencodejr[bot] left review comments
@Brendonovich Brendonovich Awaiting requested review from Brendonovich

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

web: tool-result metadata.diagnostics renders in TUI but is dropped in the web timeline [BUG]: V2 web app: plugin and MCP tool calls can't be expanded, so their input and output are not shown

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Hona
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.