-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Open
Labels
opentuiThis relates to changes in v1.0, now that opencode uses opentuiThis relates to changes in v1.0, now that opencode uses opentui
Description
Description
The experimental.text.complete hook is being triggered correctly and modifying text, but the modified text is not reflected in the TUI display.
Environment
- OpenCode version: 1.1.6
- Plugin: oh-my-opencode (table-formatter hook feat(hooks): add table-formatter hook for proper column alignment code-yeongyu/oh-my-opencode#576)
- OS: macOS
Steps to Reproduce
- Create a plugin with
experimental.text.completehook that modifies text - Generate LLM response containing markdown tables
- Hook runs and modifies text (confirmed by logs)
- TUI displays original unmodified text
Evidence
Plugin logs show the hook IS being called and IS modifying text:
[table-formatter] Formatted table {"tableCount":1,"beforeLength":1625,"afterLength":1828}
[table-formatter] Formatted table {"tableCount":1,"beforeLength":780,"afterLength":775}
Expected Behavior
TUI should display the text modified by experimental.text.complete hook.
Actual Behavior
TUI displays the original streamed text, not the hook-modified text.
Analysis
Looking at packages/opencode/src/session/processor.ts:
case "text-end":
if (currentText) {
currentText.text = currentText.text.trimEnd()
const textOutput = await Plugin.trigger(
"experimental.text.complete",
{...},
{ text: currentText.text },
)
currentText.text = textOutput.text // ✅ Result assigned
await Session.updatePart(currentText) // ✅ Saved
}The hook result is saved to the session, but the TUI may be:
- Caching the streamed
text-deltaupdates - Not re-rendering when the final text is saved after hook completion
Possible Root Cause
During streaming, text-delta events update the TUI in real-time. When text-end triggers the hook and saves the modified text, the TUI might not refresh to show the updated content.
arsham
Metadata
Metadata
Assignees
Labels
opentuiThis relates to changes in v1.0, now that opencode uses opentuiThis relates to changes in v1.0, now that opencode uses opentui