2.3 KiB
2.3 KiB
TUI Visual & Flow Overhaul Plan
Goal
Drastically improve the "Design Flow" and "Text Flow" of the TUI as requested.
- Eliminate Visual Glitches: Fix text "eating" and "off" wrapping.
- Separate Thinking: Move AI reasoning into a dedicated, collapsible UI block.
- Fix Command Logic: Remove duplicate
/writehandler that prevents the Diff View from working.
User Review Required
Important
Experience Change: "Thinking" text (e.g., "Let me analyze...") will no longer appear in the main chat stream. It will appear in a separate "Ghost Box" above the chat. This makes the final output cleaner.
Proposed Changes
1. Fix Logic Conflict
- File:
bin/opencode-ink.mjs - Action: Delete the old
case '/write':block (lines ~1372-1387) to allow the new "Holographic Diff" handler (lines ~1592) to take effect.
2. New Component: ThinkingBlock.mjs
- Location:
bin/ui/components/ThinkingBlock.mjs - Features:
- Displays "🧠 Thinking..." header.
- Shows last 3 lines of thinking process (or full log if expanded).
- Dimmed color (gray) to reduce visual noise.
- Pulsing animation? (Maybe just simple text for stability).
3. Stream Processor (The "Flow" Engine)
- File:
bin/opencode-ink.mjs - Logic:
- Introduce
thinkingContentstate. - Update
sendMessagecallback:- Heuristic: If line starts with "Let me", "I will", "Thinking:", enter Thinking Mode.
- Heuristic: If line starts with "Here is", "Below", or markdown
#, enter Response Mode. - Split the stream: Thinking ->
thinkingContent, Response ->messages.
- Introduce
4. Layout Tuning
- Action: Increase safety margin for
mainWidthcalculation (-6 chars) to prevent edge glitches. - Action: Ensure
Markdownrenderer gets explicitwidthprop.
Verification Plan
- Diff Test:
- Run
/writeagain. Confirm Holographic Diff appears (proving old handler is gone).
- Run
- Thinking Flow Test:
- Ask "Calculate the Fibonacci sequence in Python and explain".
- Expected:
- "Thinking" box appears, updating with reasoning.
- Main chat remains empty or shows "Processing...".
- Once actual answer starts, Main chat fills with Markdown.
- Result is clean, formatted code.
- Layout Test:
- Resize window during output. Verify no text is "eaten".