tui: WALLETS and SETTINGS menu (F9 / /settings) over the landed wallet + node features
Some checks failed
android-ci / android (pull_request) Has been cancelled
ci / sdk (pull_request) Has been cancelled
ci / fuzz (pull_request) Has been cancelled
ci / test (pull_request) Has been cancelled

The Monero wallet and the cuprate node shipped behind function keys only, so a
user who did not already know F6 opened the wallet could not find wallet setup,
the child wallet, the chain source or the settings.

F9 (also /settings) now opens one discoverable screen with the two groups the
card fixes: WALLET (endpoint, child, sync, receive, balance, payments, create,
import) then SETTINGS (nickname, profile, identity, colour, backup, restore,
wipe, wipe-all). Every actionable row prints the key or command that fires it,
including the F6 wallet screen's own keys, and those keys stay live on the
screen so no row can name a dead key.

- Screen, not popup: 19 rows at 80x24 against 21 inner rows; 120x40 and 200x60
  hold. The footer is the shared status_footer, so TOR / identity / ? help stay
  put.
- No credentials: WalletMenuState carries booleans, labels and display-ready
  error strings only. rpc_login, secret(), seeds and passphrases have no field
  to travel in.
- Untrusted values are display data: sanitize + newline/tab strip, then
  truncated in cells.
- Cells, not chars: cell_width() measures through ratatui's own Span::width, so
  no unicode-width dependency was added and chars().count() is never a width.
- Copy without a clipboard crate: c writes the receive address as an OSC 52
  sequence; the terminal owns the clipboard and it survives SSH.
- Colour is never the only signal: every state also spells itself out.
- F7 stays free for the endpoint config screen that names it (db208be,
  docs/WALLET.md).

F2/F3/F4/F5/F6/F8 keep working: the function keys are now handled once, for Main
and this screen, instead of inside the Main arm.
This commit is contained in:
agent 2026-09-18 22:26:57 -04:00
commit 0131803f9c
No known key found for this signature in database
4 changed files with 1058 additions and 16 deletions

View file

@ -621,3 +621,86 @@ lands on the row that actually owns the outbox entry.
and footer row is `<=` the terminal width, that the markers render, and that
an over-long message wraps instead of being clipped.
- Dump frames: `cargo test --locked --test tui_spec -- --nocapture dump_spec_frames`.
## WALLETS & SETTINGS menu (F9 / `/settings`) — implemented
The Monero wallet and the cuprate node shipped behind function keys only: a user
who did not already know F6 opened the wallet could not find wallet setup, the
child wallet, the chain source or the settings. F9 (`/settings`) is the
discoverable surface. It is a **screen, not a popup**, and it is a discovery
layer, not a replacement: F2, F3, F4, F5, F6 and F8 all keep working, and they
stay live *on this screen* so no row can print a key that does nothing there.
```
cargo test --locked --test tui_spec -- --nocapture wallets_settings_menu_frame_dumps
```
dumps the menu at 80x24, 120x40 and 200x60 in both the configured and the
unconfigured state.
### Rows
Layout is ` label value … keys`: a 9-cell label column, the value truncated
in **cells** with the chrome's ellipsis, and a 12-cell key column right-aligned
so the eye can run down it. Every actionable row names the key or command that
fires it, including the F6 wallet screen's own keys (`F6 c`, `F6 i`, `F6 r`,
`F6 s/x`, `F6 p`), so the menu teaches the shortcuts it sits beside.
| Group | Row | Value | Key |
|---|---|---|---|
| WALLET | endpoint | `configured · connected` / `configured · not connected` / `not configured · receive-only` | — |
| WALLET | child | `{chain source} · running` / `not started` | `F6 s/x` |
| WALLET | sync | chain readiness word (`chain at tip · wallet answering`, `wallet answering · chain not at tip`, `wallet RPC not answering yet`, `child exited`, `not probing · no chain source`) | `F6 p` |
| WALLET | receive | the receive address (truncated) or `no address yet · wallet unreachable` | `c copy` / `F6 r` |
| WALLET | balance | `{xmr}` / `off` / `err` | `F6` |
| WALLET | payments | `{n} recent` / `no transfers yet` | `F6` |
| WALLET | create | `/wallet create · seed shown once` | `F6 c` |
| WALLET | import | `/wallet import · 25-word seed` | `F6 i` |
| SETTINGS | nickname | the self-profile name, or `(none)` | `/profile` |
| SETTINGS | profile | `bio set · xmr set` | `/profile` |
| SETTINGS | identity | `{fp}… · identity = pubkey` | `F2` |
| SETTINGS | colour | `auto · follows NO_COLOR / TERM` | — |
| SETTINGS | backup | `encrypted identity export` | `/backup` |
| SETTINGS | restore | `overwrite self keys from a backup` | `/restore` |
| SETTINGS | wipe | `messages · identity and friends stay` | `/wipe` |
| SETTINGS | wipe-all | `deletes your identity key · new person` | `/wipe-all` |
19 rows at 80x24 against 21 available inner rows: nothing clips or scrolls.
### Guarantees
- **No credentials.** `WalletMenuState` carries booleans, labels and
display-ready error strings from `Node`'s getters. It is never given
`WalletConfig::rpc_login`, `secret()`, a seed or a passphrase, so the screen
cannot render one.
- **Untrusted text is display data.** Every value goes through
`sanitize::display_text` plus a newline/tab strip before it is placed on a
row, so a multi-line or bidi-laden error cannot split a row or reorder it.
- **Cells, not chars.** `cell_width()` measures with ratatui's own
`Span::width` — the same code path the renderer truncates with.
`unicode-width` is not a direct dependency of this crate, so no crate was
added; `chars().count()` is never used for a width.
- **Colour is never the only signal.** Each state word is present as a word
(`not connected`, `child exited`, `not probing`, `no transfers yet`); the
tone only answers "what is this?".
- **Copy without a clipboard crate.** `c` writes the receive address through
OSC 52 (`ESC ] 52 ; c ; <base64> BEL`): the terminal owns the clipboard, the
address never touches a file, and it still works over SSH. A terminal that
does not implement OSC 52 ignores the sequence; `F6 r` still shows the QR.
- **ASCII fallback.** The section rule is `─`, or `-` under `ONIONWIRE_ASCII` /
`NO_COLOR`, alongside the existing ellipsis swap. No emoji.
### Reachable-from-the-TUI gaps this card does not close
Named in the PR body's feature-analysis table. All of them need backend or
sibling-card work, not presentation:
- `Node::wallet_config()` / `Node::wallet_save_config(cfg)` /
`Node::wallet_test_connection(..)` — the endpoint config screen is F7 on
`feat/wallet-create-import`; the menu shows the endpoint's *state* and leaves
the key free.
- Peer payment history — `store.list_payments(..)` has no `Node` accessor, so
the menu can only offer the wallet's own transfer list (F6).
- `Node::set_wallet_child_config(cfg)` — the child can be started/stopped and
probed, not edited.
- `Node::set_petname(..)` — no petname editor exists.