Skip to content

Add TUI display-only chat text transform hook (string→string) #11864

Description

@AnganSamadder

Problem

The TUI chat markdown output can sometimes be difficult to read depending on the content (e.g., long tables, deeply nested lists, or excessive whitespace). Currently, there is no mechanism for plugins to intercept and transform this text specifically for display purposes without affecting persistence or the Web UI.

Proposal

Add a new stable plugin hook (e.g., chat.display.transform) with a string -> string signature. This hook will allow plugins to perform display-only transformations on chat text before it is rendered in the TUI.

Scope & Constraints

  • TUI only: Initial implementation targets the TUI TextPart component.
  • Display-only: Transformations are transient and not persisted to the session history.
  • String -> String: Simple synchronous transformation.
  • No Web UI / File Viewer changes: This hook specifically targets chat message rendering.

Timing Modes

To balance performance and UX, the hook should support three timing modes (configurable via opencode.json with CLI overrides):

  1. final: Apply only once the message is complete.
  2. throttle: Apply on streaming updates but throttled (default 100ms).
  3. chunk: Apply on every streaming update (raw).

Safety & Reliability

  • Sync-only: Prevents async plugins from blocking the render loop.
  • Error Fallback: If a plugin throws or returns a non-string, the system logs the error and falls back to the original (or last successful) text, continuing the chain.
  • Deterministic Ordering: Hooks run in the sequence plugins are defined in the config.

Acceptance Criteria

  • New hook type added to plugin definitions.
  • TUI rendering wired at the TextPart chokepoint.
  • Configuration keys and CLI flags added for mode and throttle control.
  • Unit tests for multi-plugin ordering and error fallback.

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Feb 3, 2026
  2. github-actions commented on Feb 3, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case or if you're proposing something distinct from TUI rendering customization.

  3. github-actions commented on Apr 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

opentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions