Skip to content

The agent that grows with you

Merge origin/main into fix/pkg13-ink-leftovers

Teknium85188e61c35b
diff --cc apps/desktop/src/app/session/hooks/use-prompt-actions/index.ts
index 1834b2705c4,85775aef257..e11a31df21c
--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/index.ts
+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/index.ts
@@@ -888,31 -890,10 +890,18 @@@ export function usePromptActions(
{ session_id: id, text }
)
+ // TUI-26: a bare stop phrase typed mid-turn into a LOCAL voice chat ended that chat on
+ // the owner and reached no turn. Settled (nothing to re-queue), and no bubble stays.
+ if (result?.voice_stopped === true) {
+ discardOptimisticMessage()
+
+ return true
+ }
+
if (result?.status === 'redirected') {
if (mode === 'interrupt') {
- updateSessionState(id, state => {
- const message = state.messages.find(candidate => candidate.id === messageId)
-
- // A newer reply may precede this ACK; it already owns its boundary.
- const hasNewReply = state.messages
- .slice(state.messages.findIndex(candidate => candidate.id === messageId) + 1)
- .some(candidate => candidate.role === 'assistant')
-
- return message && state.streamId && !hasNewReply
- ? appendMidTurnUserMessage(
- { ...state, messages: state.messages.filter(candidate => candidate.id !== messageId) },
- message
- )
- : state
- })
+ flushStreamDeltas(id)
+ updateSessionState(id, state => sealAcceptedCorrection(state, messageId))
}
triggerHaptic('submit')
diff --cc hermes_cli/cli_tui_mixin.py
index 61c1dd7387c,5b2addaf4bd..00cedb86f5e
--- a/hermes_cli/cli_tui_mixin.py
+++ b/hermes_cli/cli_tui_mixin.py
@@@ -39,7 -39,7 +39,8 @@@ from prompt_toolkit.widgets import Text
from typing import Optional
from hermes_cli.cli_footer_split import FooterSplit
+ from hermes_cli.cli_panel import _Panel
+from hermes_cli.cli_tui_wrap import _prefix_wrapped_rows, _wrap_rows
# Rows below an overlay panel taken by spinner/tool-progress, status bar, input, separators and
# prompt symbol (measured ~6 during live PTY approval prompts) — shared by every panel budget.
@@@ -85,30 -85,23 +86,6 @@@ def _term_rows() -> int
return shutil.get_terminal_size((100, 24)).lines
- class _Panel:
- """Fragment accumulator for one bordered overlay panel (``(style, text)`` tuples)."""
-
- def __init__(self, border: str, box_width: int, title: str = "", title_style: str = ""):
- from cli import _append_blank_panel_line, _append_panel_line
- self.lines, self.border, self.width = [], border, box_width
- self._row, self._blank = _append_panel_line, _append_blank_panel_line
- if title:
- # Title inlined into the top rule: ``╭─ Title ───╮``.
- self.lines.append((border, "╭─ "))
- self.lines.append((title_style, title))
- self.lines.append((border, " " + ("─" * max(0, box_width - len(title) - 3)) + "╮\n"))
- else:
- self.lines.append((border, "╭" + ("─" * box_width) + "╮\n"))
-def _wrap_rows(wrap, items, width, indent) -> list[tuple[int, str]]:
- """``(index, wrapped_line)`` pairs so selected styling can be re-applied per row."""
- return [(i, w) for i, label in enumerate(items) for w in wrap(label, width, subsequent_indent=indent)]
--
- def row(self, style: str, text: str) -> None:
- self._row(self.lines, self.border, style, text, self.width)
--
- def blank(self) -> None:
- self._blank(self.lines, self.border, self.width)
-def _prefix_wrapped_rows(wrap, label, width, first_prefix, indent) -> list[str]:
- """Wrap ``label``, then prefix the rows with ``first_prefix`` / ``indent``.
--
- def close(self) -> list:
- self.lines.append((self.border, "╰" + ("─" * self.width) + "╯\n"))
- return self.lines
- The prefix is applied *after* wrapping on purpose. Folding it into the
- string handed to the wrapper charges those columns against the label's own
- width budget — so a selected row wraps one line early and strands the ``❯``
- cursor on a row of its own — and whitespace-trimming wrappers drop the
- leading indent entirely, leaving long unselected labels flush against the
- panel border, out of alignment with every other row.
- """
- rows = wrap(label, width)
- return [(first_prefix if i == 0 else indent) + row for i, row in enumerate(rows)]
class CLITuiMixin: