anomalyco / anomalyco/opencode

[FEATURE]: TUI plugins have no way to read or drive the prompt

Open
#38,962 3 comments 0 reactions 1 assignee View on GitHub

@simonklee is already working on this.

Since Jul 26, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Feature hasn't been suggested before.
  • I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request

TUI plugins can render into slots, but they cannot read what the user is typing, edit it, move the cursor, or annotate a span of it. Anything that wants to complete, rewrite, validate, or highlight prompt text has no supported surface — the TextareaRenderable is internal to the prompt component.

Suggested behaviour

A plugin-facing prompt facade: read prompt state, replace a text range, drive the cursor, draw extmarks (underlined spans), and subscribe to prompt/cursor changes.

The awkward part is lifetime, and it is worth designing for rather than discovering later. The prompt remounts on session switches and route changes, so a plugin that captured a ref at load time is holding a destroyed controller. A facade that hands out the component ref directly will produce crashes in plugin code that looks correct.

Related edges that need an explicit answer rather than incidental behaviour:

  • what a range replacement does when start > end
  • whether offsets are byte, codepoint, or display-width, and how they snap to grapheme boundaries
  • whether an existing extmark survives an edit that overlaps it
  • what a screen-coordinate lookup returns when the prompt is unmounted or not yet laid out
Version

v1.18.5

Additional context

PR #38955 implements this (draft — the API shape is worth maintainer input before it becomes public surface).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.