anomalyco / anomalyco/opencode
[FEATURE] Plugin hook for streaming text transformation (e.g. `text.delta`)
@rekram1-node is already working on this.
Since Jul 29, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
- I have verified this feature I'm about to request hasn't been suggested before.
Currently, plugins can hook into the AI's response via the experimental.text.complete event, which fires after the full message has been generated.
For plugins that format or transform text (such as the opencode-rtl plugin which adds Unicode BiDi isolates to make right-to-left text readable), this means the text streams in "broken" (scrambled) and only fixes itself once the entire response is finished.
Proposed Solution
Add a streaming hook, such as experimental.text.delta or experimental.text.partial, that allows plugins to intercept and transform text chunks as they arrive from the LLM, before they are rendered to the UI (CLI or Desktop).
Example hook signature:
interface TextDeltaEvent {
delta: string; // The new chunk of text
fullText: string; // The accumulated text so far
transform: (newDelta: string) => void;
}
Or simpler, just allow a synchronous map function over the stream:
plugin.on('text.stream', (chunk: string) => {
return applyBidiIsolates(chunk);
});
Context
This is critical for any plugin attempting to do real-time formatting, translating, or text manipulation where the user experience suffers if they have to watch raw, unformatted text stream in for 30 seconds before it snaps into the correct format.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.