Chat picker: companions only, and Del deletes a thread's history

The Direct section now lists only companion nodes (a contact whose
type was never advertised gets the benefit of the doubt) — repeaters,
rooms, and sensors are not DM targets. Pressing Del on a contacted
thread offers the reserved-red Cancel/Delete confirm; on commit the
peer's stored messages are removed (new Repository.delete_chat_history
— channel history and other peers untouched), the unread count clears,
and the re-entered picker shows the row hollow-dotted in the
uncontacted tail. The Del atom rides the existing deletable-row
machinery, with delete_hint now threaded through Ui/TuiUi/session
select so the footer advertises it only on rows it can act on.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jean-Pierre MartineauandClaude Fable 5 committed 2026-07-19 01:21:43 -04:00
1 parent 3fe4e5b4e1
commit 7b689dfd04
5 files changed
+301 -57

No files matched your search

+7 -2
View File
@@ -115,12 +115,14 @@ class Ui:
default: Any = None,
wrap: bool = True,
filterable: bool = True,
delete_hint: str = "",
) -> Any:
"""Prompt the user to choose one item; return its value or ``None`` if cancelled.
``prompt`` draws an instruction inside the popup, above the list. Pass
``filterable=False`` for a short, fixed list so a stray key can't narrow (and
resize) it.
resize) it. ``delete_hint`` (with rows marked deletable) enables the Delete
key's remove flow — see :meth:`~meshterm.ui.tui.session.TuiSession.select`.
"""
raise NotImplementedError
@@ -394,6 +396,7 @@ class PlainUi(Ui):
default: Any = None,
wrap: bool = True,
filterable: bool = True,
delete_hint: str = "",
) -> Any:
"""Unsupported in scripted CLI mode."""
raise self._no_prompt()
@@ -639,10 +642,12 @@ class TuiUi(Ui):
default: Any = None,
wrap: bool = True,
filterable: bool = True,
delete_hint: str = "",
) -> Any:
"""Delegate to the session's select screen."""
return await self.session.select(
title, items, prompt=prompt, default=default, wrap=wrap, filterable=filterable
title, items, prompt=prompt, default=default, wrap=wrap,
filterable=filterable, delete_hint=delete_hint,
)
async def select_startup(
+7 -2
View File
@@ -362,15 +362,20 @@ class TuiSession:
wrap: bool = True,
filterable: bool = True,
footer_hint: Optional[str] = None,
delete_hint: str = "",
) -> Any:
"""Show a select screen; return the chosen value or ``None`` if cancelled.
``prompt`` draws an instruction inside the box above the list; ``filterable`` and
``footer_hint`` are forwarded for short, fixed lists (a yes-or-no style choice) that
want no type-to-filter and a tailored hint.
want no type-to-filter and a tailored hint. ``delete_hint`` (with rows marked
:attr:`~meshterm.ui.tui.select.Choice.deletable`) surfaces the Delete key's atom
while the highlight sits on such a row; Delete then resolves a
:class:`~meshterm.ui.tui.select.DeleteRequest` the caller unwraps.
"""
kwargs: dict[str, Any] = dict(
prompt=prompt, default=default, wrap=wrap, filterable=filterable
prompt=prompt, default=default, wrap=wrap, filterable=filterable,
delete_hint=delete_hint,
)
if footer_hint is not None:
kwargs["footer_hint"] = footer_hint