xonecas.io
60255
Zn

Zoea-Nova / commit 9818f3c

fix(tui): config flow error handling and emoji removal

Fix multiple TUI issues identified in code review:

1. Config flow error handling: Invalid provider input now properly resets
   input mode and returns early, preventing broken state where user is left
   with error and no way to retry.

2. Two-step config flow: Split provider configuration into provider selection
   followed by model selection. Stores provider in pendingProvider field
   during the flow.

3. Escape key handling: Clear error state when cancelling config flow to
   provide clean visual feedback.

4. Emoji removal: Replace emojis with Unicode characters per project style:
   - Broadcast: ◈ (diamond)
   - Message: ◆ (filled diamond)
   - New mysis: ⬡ (hexagon)
   - Config: ⚙ (gear)

Addresses KNOWN_ISSUES.md requirement to remove all emoji usage.

xonecas2026-02-04 9818f3cd8452110f4e4c506e865449cc7ed408a9 parent 304339f

2 files changed

internal/tui/app.go+18−1
@@ -41,6 +41,8 @@ type Model struct {
4141 logs []LogEntry
4242 focusID string
4343
44+ pendingProvider string
45+
4446 // Swarm broadcast history
4547 swarmMessages []SwarmMessage
4648
@@ -435,6 +437,8 @@ func (m Model) handleInputKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
435437 switch {
436438 case key.Matches(msg, keys.Escape):
437439 m.input.Reset()
440+ m.pendingProvider = ""
441+ m.err = nil
438442 return m, nil
439443
440444 case key.Matches(msg, keys.Enter):
@@ -483,7 +487,20 @@ func (m Model) handleInputKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
483487 m.refreshMysisList()
484488
485489 case InputModeConfigProvider:
486- m.err = m.commander.ConfigureMysis(m.input.TargetID(), value)
490+ switch value {
491+ case "ollama", "opencode_zen":
492+ m.pendingProvider = value
493+ m.input.SetMode(InputModeConfigModel, m.input.TargetID())
494+ return m, m.input.Focus()
495+ default:
496+ m.err = fmt.Errorf("unknown provider: %s", value)
497+ m.input.Reset()
498+ return m, nil
499+ }
500+
501+ case InputModeConfigModel:
502+ m.err = m.commander.ConfigureMysis(m.input.TargetID(), m.pendingProvider, value)
503+ m.pendingProvider = ""
487504 }
488505
489506 m.input.Reset()
internal/tui/input.go+8−4
@@ -15,6 +15,7 @@ const (
1515 InputModeMessage
1616 InputModeNewMysis
1717 InputModeConfigProvider
18+ InputModeConfigModel
1819 )
1920
2021 const maxHistorySize = 100
@@ -53,16 +54,19 @@ func (m *InputModel) SetMode(mode InputMode, targetID string) {
5354 switch mode {
5455 case InputModeBroadcast:
5556 m.textInput.Placeholder = "Broadcast message to all myses..."
56- m.textInput.Prompt = inputPromptStyle.Render("📢 ") + " "
57+ m.textInput.Prompt = inputPromptStyle.Render("◈ ") + " "
5758 case InputModeMessage:
5859 m.textInput.Placeholder = "Message to mysis..."
59- m.textInput.Prompt = inputPromptStyle.Render("💬 ") + " "
60+ m.textInput.Prompt = inputPromptStyle.Render("◆ ") + " "
6061 case InputModeNewMysis:
6162 m.textInput.Placeholder = "Enter mysis name..."
62- m.textInput.Prompt = inputPromptStyle.Render("🤖 ") + " "
63+ m.textInput.Prompt = inputPromptStyle.Render("⬡ ") + " "
6364 case InputModeConfigProvider:
6465 m.textInput.Placeholder = "Enter provider (ollama/opencode_zen)..."
65- m.textInput.Prompt = inputPromptStyle.Render("⚙️ ") + " "
66+ m.textInput.Prompt = inputPromptStyle.Render("⚙ ") + " "
67+ case InputModeConfigModel:
68+ m.textInput.Placeholder = "Enter model name..."
69+ m.textInput.Prompt = inputPromptStyle.Render("cfg ") + " "
6670 default:
6771 m.textInput.Placeholder = ""
6872 m.textInput.Prompt = ""