onionwire/docs/TUI.md
agent 04d9f436e5
All checks were successful
ci / test (pull_request) Successful in 4m24s
ci / sdk (pull_request) Successful in 1m19s
tui: F7 wallet config screen + wallet/chain setup redesign + doc sync
Implement the F7 wallet-endpoint config screen (Screen::WalletConfig):
- Fields: rpc_url, rpc_login masked with reveal toggle, no_spend checkbox
- Test connection (t → PingResult::line), Save (s → wallet_save_config)
- Status line: 'saved · not connected', 'connected — ...', 'error: ...'
- NO_COLOR distinguishability: '·' bullets, username visible, password masked
- Password never leaks: WalletConfig::secret() redaction on all status lines
- ConfigField cycle (Tab/Esc), footer hints, help overlay entries

Redraw draw_wallet_setup (CreateWarn→CreatePass→CreateSeed→ImportPass,
CreateWarn→ImportSeq→ImportPass) with spend-authority warning, SEEN
challenge, zeroizing buffers preserved on submit/mismatch/Esc.

Update help_overlay_text() with F6 h, F7, copy key; main_footer_hints()
for F7. Extend tui_chrome.rs needle list (F6 h, F7 added).

Reconcile docs: README key table gains F6 s/n/h and F7; WALLET.md
wallet-screen paragraph updated; TUI.md Deliverable 5 marked implemented
with after frames for each config state at 80x24 and 120x40.

Tests: 30 tui_spec (incl. 7 new wallet-config tests), tui_chrome green.
cargo test --locked: 0 failures. cargo clippy --all-targets: clean.
2026-09-15 23:01:56 -04:00

1142 lines
77 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# OnionWire TUI — visual audit and design spec
This card does not change `src/`. Frames come from:
```
cargo test --locked --test tui_frames -- --nocapture dump_audit_frames
```
`tests/tui_chrome.rs` still locks helper **names** and **return strings**. Implementation
must keep `wordmark_banner`, `compact_banner`, `banner_for_width`, `onion_glyph`,
`status_footer`, `main_footer_hints`, `help_overlay_text`, `draw_share`, and `Pane`
working. Add helpers; do not rename those.
## Gaps (could not render the live `App` frame)
`App`, `App::draw`, `App::draw_main`, and every overlay except `draw_share` are
private and need `Arc<Node>` (Arti + store). This presentation-only test cannot
construct that.
| Screen / state | What you get | Why |
|---|---|---|
| Main chat (empty, messages, long line, stale roster, alert) | **RECONSTRUCTED** — same `Layout` constraints as `src/tui.rs` `draw_main` (banner height, 36% roster, composer 3, footer 1) plus the real `banner_for_width` / `status_footer` | `App` private |
| Help / `/who` overlay | **RECONSTRUCTED** — Rect math copied from private `draw_text_overlay` | private |
| Share / invite | **REAL** `draw_share` | public |
| Profile, paste, approve, rotate, wipe, quit, backup, restore, passphrase | **RECONSTRUCTED** — public `*_screen_text` / `ProfileEditor` copy inside `Block::bordered`, titles taken from `src/tui.rs` | private `draw_*` |
| Pay / invoice / file transfer | **No screen exists.** Footer `status_note` only (`invoice sent`, `sending`, `sent file {name}`, `send failed: {e}`) | not a gap in the test — a product finding |
| Tor bootstrap / disconnected HS | Not a TUI screen. `hs status: Bootstrapping` is stderr before `ratatui::init` | out of TUI draw |
| Color / `NO_COLOR` | Glyph dumps only. Color findings are from reading `src/tui.rs` | TestBackend prints symbols |
Color, focus-by-border, and RGB-only styling are invisible in these dumps. Treat
the reconstruction as the glyph skeleton, not a screenshot of Color.
## Deliverable 1 — before frames
Trailing spaces in the live buffer are omitted here. Re-run the command for
byte-identical dumps, including 120x40 and 200x60.
### 80x24 — chrome (`banner_for_width` + `status_footer`, real helpers)
```
.-~~-. .-~~-. .-~~-. ONIONWIRE
( o )( o )( o ) identity = pubkey onion = locator
`-..-' `-..-' `-..-' tor messenger no server
TOR me:abcdef01… onion:abcdefgh… Tab F2 F3 F4 F5 Ctrl-Q ? help
```
Same footer with `status_note = "send failed: connection timed out"` — the note
**does not appear**. Ident + hints win. Fail-closed copy is gone at 80 and at
120 (full onion eats the row). It only survives at 200.
### 80x24 — RECONSTRUCTED main, empty
```
.-~~-. .-~~-. .-~~-. ONIONWIRE
( o )( o )( o ) identity = pubkey onion = locator
`-..-' `-..-' `-..-' tor messenger no server
┌roster 0───────────────────┐┌chat─────────────────────────────────────────────┐
│ ││no friends yet │
│ ││F3 paste an invite to add one │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
└───────────────────────────┘└─────────────────────────────────────────────────┘
┌composer──────────────────────────────────────────────────────────────────────┐
│/wipe /wipe-all /profile /who /pay /tip /file │
└──────────────────────────────────────────────────────────────────────────────┘
TOR me:abcdef01… onion:abcdefgh… Tab F2 F3 F4 F5 Ctrl-Q ? help
```
### 80x24 — RECONSTRUCTED main, messages + stale + alert
```
.-~~-. .-~~-. .-~~-. ONIONWIRE
( o )( o )( o ) identity = pubkey onion = locator
`-..-' `-..-' `-..-' tor messenger no server
passphrases do not match
┌roster 2 1 stale──────────┐┌chat alice──────────────────────────────────────┐
│> alice aaaaaaaa… ││you: ping │
│ bob-the-stale-peer bbbbb││them: pong │
│ ││them: this is a very long chat line that should │
│ ││wrap inside the chat pane instead of running off │
│ ││the right edge of an 80-column terminal and │
│ ││colliding with the roster border │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
└───────────────────────────┘└─────────────────────────────────────────────────┘
┌composer──────────────────────────────────────────────────────────────────────┐
│hello from composer │
└──────────────────────────────────────────────────────────────────────────────┘
sent TOR me:abcdef01… onion:abcdefgh… Tab F2 F3 F4 F5 Ctrl-Q ? help
```
Roster clips `bob-the-stale-peer bbbbb` mid-glyph. Chat wraps (good). Focus on
chat/composer is **not** visible in the glyph dump (color-only in `pane_block`).
### 80x24 — RECONSTRUCTED main, fail-closed send (note dropped)
```
.-~~-. .-~~-. .-~~-. ONIONWIRE
( o )( o )( o ) identity = pubkey onion = locator
`-..-' `-..-' `-..-' tor messenger no server
┌roster 2 1 stale──────────┐┌chat bob-the-stale-peer─────────────────────────┐
│ alice aaaaaaaa… ││no messages │
│> bob-the-stale-peer bbbbb││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
└───────────────────────────┘└─────────────────────────────────────────────────┘
┌composer──────────────────────────────────────────────────────────────────────┐
│/wipe /wipe-all /profile /who /pay /tip /file │
└──────────────────────────────────────────────────────────────────────────────┘
TOR me:abcdef01… onion:abcdefgh… Tab F2 F3 F4 F5 Ctrl-Q ? help
```
`status_note` was `send failed: peer onion down`. The before frame above drops it.
`tests/tui_frames.rs` `status_footer_drops_send_failed_when_crowded` now asserts
the note **is** present at 80, 120, and 200, along with `TOR` / `me:` / `? help`.
### 80x24 — `draw_share` (real)
Invite is 346 chars. Inner width 78. Wraps mid-hex. Full v3 onion fits on its
own line. No QR blocks (locked).
```
┌(o) invite────────────────────────────────────────────────────────────────────┐
│give this string to a friend; they F3 paste it │
│ │
│fp ea4a6c63… │
│onion abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion │
│ │
│onionwire:v1:k=ea4a6c63e29c520abef5507b132ec5f9954776aebebe7b92421eea691446d22│
│c:o=abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion:spk=0101010│
│101010101010101010101010101010101010101010101010101010101:sig=46caf16b6da95e86│
│… │
└──────────────────────────────────────────────────────────────────────────────┘
```
### 80x24 — RECONSTRUCTED help overlay (private `draw_text_overlay` math)
Help is 22 content lines + border. Popup height is `min(lines, height-2)` = 22,
so it covers the banner, punches through roster/composer borders, and **clips**
`Esc closes this overlay`.
```
.-~~-. .-~~-. .-~~-. ONIONWIRE
( o ┌? help─────────────────────────────────────────────────────────┐
`-..-' │OnionWire keys │
┌roster│ │───────┐
│ │Tab / Shift-Tab cycle roster, chat, composer │ │
│ │… │ │
│ │/backup /path encrypted identity export │ │
└──────│/restore /path overwrite self keys │───────┘
┌compos│? this help │───────┐
│/wipe │Ctrl-Q quit; type CLEAR or QUIT │ │
└──────└───────────────────────────────────────────────────────────────┘───────┘
TOR me:abcdef01… onion:abcdefgh… Tab F2 F3 F4 F5 Ctrl-Q ? help
```
### 80x24 — other overlays (copy is real)
- Profile: `> name:` marker (good). Empty xmr is a blank value, not `(none)`.
- Paste: same wrap-mid-hex as share. Error state replaces the hint with the
error string (no "what next").
- Approve / rotate / wipe / quit / backup / passphrase: full-screen bordered
column of copy + typed buffer. Readable. Fine as modal confirmations.
- `/who`: overlay Clear is only the popup rect; chat remnants (`d`, `ff`) show
in the side gutters. Full onion is shown (good).
### 120x40 / 200x60
At 120, `status_footer` shows the **full** 62-char onion and still drops
`send failed: …`. At 200 the note survives in front of `TOR`. Banner stays the
3-line wordmark (width ≥ 63). Chat pane is large; hierarchy problem is worse
(more empty bordered void), not better. Dump: same cargo command.
## Deliverable 2 — findings
Walked in `tui-aesthetics` ladder order.
### 1. Clipping / overlap
| Sev | Where | Wrong | User impact |
|---|---|---|---|
| **blocker** | `src/tui.rs:1505` `status_footer` candidate list | Fail-closed `status_note` (`send failed: …`) is skipped when ident+hints fill the row. Proven at 80 and 120. | Peer down looks like success. The product rule is "send visibly fails". |
| **major** | `src/tui.rs:1702` `draw_text_overlay` | No `Wrap`. Height clipped to `area.height-2`. At 80x24 help overlaps banner/roster/composer and drops the last line. | `?` is unreadable on the floor size. |
| **major** | `src/tui.rs:1355` roster `format!("{name} {fp}")` | No truncate. `bob-the-stale-peer bbbbb` clips inside the 36% pane. | Cannot tell who is selected/stale. |
| **major** | `src/tui.rs:1570` `draw_share` (and paste body) | 346-char invite wraps mid-token at inner width 78. | Mouse-select copy is split; easy to miss a continuation line. |
| **minor** | `src/tui.rs:1334` alert | Alert is one raw line, no wrap/truncate. | Long error will collide with roster on the next row. |
| **nit** | `tests/tui_chrome.rs:15` (and `src/tui.rs:1512`, `1707`) | Width via `chars().count()`. See deliverable 4. | CJK/emoji can wrap in a real terminal while tests stay green. |
### 2. Hierarchy
| Sev | Where | Wrong | User impact |
|---|---|---|---|
| **major** | `src/tui.rs:1314` `draw_main` | Three-line wordmark + two equal bordered panes + bordered composer + footer. Chat is not the primary element. At 80x24, 3 rows of art + 3 composer + 1 footer + 2×2 borders leave the transcript starved. | First glance is ASCII onions, not the conversation. |
| **major** | `src/tui.rs:1340` | Roster is 36% of width on every size. | Chat (the primary pane) is the leftover. |
| **minor** | every `themed_block` / `pane_block` | Border on every pane, including composer and full-screen modals. | Eye cannot find content; "box drawing UI". |
### 3. Spacing
| Sev | Where | Wrong | User impact |
|---|---|---|---|
| **minor** | `src/tui.rs:1328` banner vs `1367` lists | Banner has no inner pad; list/paragraph sit against borders; footer has no pad. Mixed 0 and 1. | Ragged left edge: chat `no friends yet` vs roster empty. |
| **nit** | `src/tui.rs:93` `/file /path` extra space vs other slash rows | Help columns almost align, one extra space. | Looks unfinished. Do **not** change `help_overlay_text` unless `tui_chrome` is updated — the string is locked. Leave the space. |
### 4. States
| Sev | Where | Wrong | User impact |
|---|---|---|---|
| **major** | `src/tui.rs:1349` empty roster | `List` with zero items → blank pane titled `roster 0`. Empty copy lives only in chat. | Looks broken, not empty. |
| **major** | pay / tip / file | No pane. Outcome is a footer note that 80/120 may drop. | `/pay` and `/file` feel like they did nothing. |
| **minor** | `src/tui.rs:1414` empty composer | Placeholder is the slash cheatsheet, dim color only. | Reads as commands already typed. |
| **minor** | `src/tui.rs:1456` `no messages` | One word. No "type below, Enter sends". | Dead pane. |
| **nit** | loading | `sending` in footer, 100 ms poll, no spinner. | Correct. Keep. |
There is no dedicated disconnected screen. Stale friends get a `stale` suffix
(`src/tui.rs:1357`) — keep the word, not color-only.
### 5. Color
| Sev | Where | Wrong | User impact |
|---|---|---|---|
| **major** | `src/tui.rs:15-21` | Seven RGB colors. No 16-color map. No `NO_COLOR`. | 16-color and `NO_COLOR` terminals get garbage or still emit ANSI. |
| **minor** | `src/tui.rs:1359-1372` | Stale is `C_STALE` plus the word `stale` (ok). Selection is bg+fg+bold+`> ` (ok for roster). | Chat/composer focus is color-only (see focus). |
Accent RGB `(232,165,75)` is fine as **the** accent. Do not add more hues.
### 6. Focus
| Sev | Where | Wrong | User impact |
|---|---|---|---|
| **major** | `src/tui.rs:1468` `pane_block` | Focused chat/composer: accent border + bold title. No marker. Roster has `> `. | Monochrome / `NO_COLOR`: cannot see focus unless roster. Typing `j`/`k` feels dead. |
### 7. Motion
| Sev | Where | Wrong | User impact |
|---|---|---|---|
| **nit** | `src/tui.rs:24` `TUI_POLL` 100 ms | Full `terminal.draw` every poll even with no keys, so background send can refresh status. | Acceptable. No decorative spinner. Do not redraw faster. |
### 8. Copy
| Sev | Where | Wrong | User impact |
|---|---|---|---|
| **minor** | `src/tui.rs:1583` paste error | Error replaces the paste hint. No "what next". | User sees `bad invite` and an empty buffer. |
| **minor** | `src/tui.rs:1415` | Composer placeholder is a command dump, not a verb. | Conflicts with `?` help. |
| **nit** | `src/tui.rs:36` | `fingerprint mismatch` is a good short fail-closed string when it actually reaches the footer. | Often dropped (finding 1). |
### Untrusted text
`src/tui.rs:1461` `String::from_utf8_lossy(&m.plaintext)` goes into `Paragraph`
with wrap, **no** control/bidi strip, **no** ellipsis cap. Profile `bio` /
`display_name` and paste buffer are the same class. A separate in-flight PR
owns sanitization — do not duplicate it here. Implementation must call that
helper (or the agreed strip) on every peer-supplied string before draw.
## Deliverable 3 — spec (implement this)
### Pane structure
One primary element per screen.
| Screen | Primary | Secondary | Chrome |
|---|---|---|---|
| Main | Chat transcript | Roster (left, **22 cells** at 80, **28** at 120+, not 36%) | 1-line header, 3-row composer, 1-row status |
| Share / paste / approve | The invite string / typed buffer | fp + onion above it | title `(o) invite` etc. Keep `draw_share` public |
| Profile | The three fields with `>` on the active one | — | title `(o) profile` |
| Rotate / wipe / quit / backup / restore / passphrase | The confirm copy + typed token | — | existing titles |
| Help | The help text, **full screen** when `height < 28`, else a centered overlay that **fits** (wrap, scroll if needed, never clip the last line) | — | title `? help` |
| `/who` | Profile fields | — | same overlay rules as help |
| Pay / file | **None.** Stay on main. Status line carries the result. | — | — |
`draw_main` at `height <= 24` **must not** spend 3 rows on `wordmark_banner()`.
Use a one-line header. Do **not** change `banner_for_width(80)` — chrome tests
lock it to the wordmark. Add `main_header_line(width, fp, onion)` or call
`compact_banner()` plus ident. At `height >= 40`, the 3-line wordmark **may**
sit above the one-line ident; it is optional, not required.
### Spacing unit
**1 cell.** Apply as:
- Header: no box. One space between fields.
- Roster / chat: `Block` with `Borders::ALL` **only on those two** (the primary
split). Inner text starts one cell after the border (ratatui default).
- Composer: **no** outer box. Prefix `> ` when focused, ` ` when not. One
blank row is not required; the 3-row slot stays for wrapped input.
- Footer: no box. One space between clusters, two spaces between clusters if
width ≥ 120.
- Overlays: one box around the popup. No nested padding.
### Palette
One accent. Semantic color only for state. Pair every color with a glyph or
label.
| Role | RGB (keep) | 16-color | `NO_COLOR` |
|---|---|---|---|
| accent | `Rgb(232,165,75)` | `Yellow` | default + bold / reverse |
| text | `Rgb(196,214,176)` | `White` | default |
| dim | `Rgb(98,110,92)` | `DarkGray` | default |
| alert | `Rgb(220,80,70)` | `Red` | default + `! ` prefix |
| stale | `Rgb(210,180,80)` | `Yellow` | default + ` stale` (already) |
| highlight bg | `Rgb(48,42,28)` | `Reverse` | reverse |
| border | `Rgb(72,84,64)` | `DarkGray` | default |
`NO_COLOR` set (empty or any value): no `Style` fg/bg at all. Glyphs and
weight only.
Detection: `std::env::var_os("NO_COLOR")` is Some → no color. Else if the
backend is not a TTY or `TERM=dumb` → 16-color or no color, never RGB.
Else RGB as today.
### Glyphs
| Use | Unicode | ASCII fallback |
|---|---|---|
| onion / share title | `(o)` (already) | `(o)` |
| focus | `> ` | `> ` |
| truncate | `…` (`src/tui.rs:1730`) | `...` (budget 3 cells) |
| box | ratatui `Borders::ALL` (light) | `+` `-` `\|` via `border::Set` |
| alert prefix | `! ` | `! ` |
| stale | word `stale` | `stale` |
| delivery: delivered | `✓` | `ok` |
| delivery: queued | `◷` | (word) `queued` |
| delivery: sending | `»` | (word) `sending` |
| delivery: failed | `✗` | (word) `failed` |
`queued` / `sending` / `failed` always carry their state word, so the ASCII
fallback drops the glyph instead of inventing one. Only `✓` is wordless, so it
falls back to `ok`. `delivery_glyph()` /
`tests/tui_spec.rs::delivery_markers_have_exercised_ascii_fallbacks` exercise the
fallback path.
No emoji. `onion_glyph()` stays for callers that already use it; do not put it
on the main header.
ASCII chrome when `ONIONWIRE_ASCII` is set **or** when `NO_COLOR` is set (same
switch is enough; do not add a crate).
### Focus
Never color alone.
- Roster: keep `highlight_symbol("> ")` + bold. Unselected rows start with two
spaces so columns align.
- Chat: title becomes `> chat {name}` when focused, ` chat {name}` when not,
plus bold on the `> ` title.
- Composer: `> ` prefix on the input row when focused (see spacing).
- `Tab` cycle unchanged (`Pane` tests lock it).
### `status_footer` priority (must change)
Replace the current "first candidate that fits, dropping the note" list.
Build left-to-right, **never drop** a non-empty `status_note`:
1. `status_note` (truncate with `…`/`...` to a minimum of 12 cells if needed).
2. `TOR me:{8}…` (keep `me:` — chrome tests require it).
3. `onion:` + full onion if it fits, else 8-char truncate (keep today's
`width >= 110` full-onion rule if it still fits **after** the note).
4. Hints from `main_footer_hints()`, dropping from the left of that list.
5. Always end with `? help`.
`? help` and `TOR` and `me:` must still be present at 80 and 120 so
`tests/tui_chrome.rs` stays green.
Fail-closed copy is `send failed: {e}` or `fingerprint mismatch`. Prefix `! `
when color is off.
### Copy — non-happy states
Do not soften fail-closed into a loader.
| State | Copy |
|---|---|
| no friends, roster | list item `no friends` (so the pane is not blank) |
| no friends, chat | `no friends yet` / `F3 paste an invite to add one` (keep) |
| friend, no messages | `no messages` / `type below, Enter sends` |
| nothing selected send | `no friend selected` (keep) |
| sending | `sending` (keep, no spinner) |
| sent | `sent` |
| peer down / send err | `send failed: {e}` (visible) |
| queued (outbox) | `{n} queued` — replaces the flat `sent`/`send failed` while rows are outstanding |
| queued + terminal failure | `{n} queued, send failed: {short}` |
| terminal failure | `send failed: {short}` (`{f} failed` when more than one) |
| already sending | `already sending` (keep) |
| stale friend | `stale` suffix (keep) |
| empty composer | `message` as dim placeholder (not the slash list). Slash list stays in `?` |
| paste error | `{err}` then `Enter resubmits Esc back` |
| unknown slash | `unknown command {cmd}` (keep) |
| passphrase mismatch | `passphrases do not match` (keep, alert line) |
### Before → after mockup (80x24 main)
**After** (target). Header 1 line. Roster 22-ish. Chat primary. Composer no
box. Fail-closed note kept. Focus marker on composer.
```
onionwire tor me:abcdef01 onion:abcdefgh
┌friends 2 1 stale┐┌chat alice───────────────────────────────────────────────┐
│ alice aaaaaaaa…││you: ping │
│> bob bbbbbbbb… s││them: pong │
│ ││them: this is a very long chat line that should wrap │
│ ││inside the chat pane instead of running off the edge │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
└──────────────────┘└──────────────────────────────────────────────────────────┘
> hello from composer
! send failed: peer onion down TOR me:abcdef01 ? help
```
Roster names truncate with ellipsis, not mid-letter. `stale` may abbreviate to
`s` only if the word does not fit; prefer keeping `stale`.
### Before → after mockup (80x24 help)
**After:** full-screen, no punch-through. Last line visible. `help_overlay_text()`
body unchanged (chrome tests).
```
┌? help────────────────────────────────────────────────────────────────────────┐
│OnionWire keys │
│ │
│ Tab / Shift-Tab cycle roster, chat, composer │
│ 1 / 2 / 3 focus roster / chat / composer │
│ j k or Up Down move or scroll focused pane │
│ g / G jump to top / bottom │
│ Enter send chat to selected friend, or a /command │
│ Esc close overlay, go back, clear composer │
│ F2 share invite │
│ F3 paste invite │
│ F4 rotate onion locator │
│ F5 selected friend's profile (/who) │
│ /profile edit name, bio, Monero address │
│ /pay <xmr> [memo] invoice to receive │
│ /tip <xmr> [memo] pay selected friend │
│ /file /path send file to selected friend (1 MiB) │
│ /backup /path encrypted identity export │
│ /restore /path overwrite self keys │
│ ? this help │
│ Ctrl-Q quit; type CLEAR or QUIT │
│ │
│Esc closes this overlay │
└──────────────────────────────────────────────────────────────────────────────┘
```
If the body still overflows 24 rows with the border, **scroll** the paragraph;
do not clip. Do not edit the locked help string to shrink it.
### Left alone (on purpose)
- Wire protocol, session, store, send path.
- Peer-text sanitization (other PR). Render must call it once it exists.
- Fail-closed semantics. Only the **visibility** of the error changes.
- Locked helper names and `help_overlay_text` / wordmark strings.
- No QR. Invite stays a string.
- No dedicated pay/invoice/file screens in v1.
- No spinner. `TUI_POLL` 100 ms stays.
- `docs/PROTOCOL.md` unchanged.
- No new crates on the implementation card unless `unicode-width` is approved
(deliverable 4).
## Deliverable 4 — `chars().count()` is not terminal cells
`tests/tui_chrome.rs` asserts `line.chars().count() <= width`. Same metric in
`status_footer` (`src/tui.rs:1512`) and `draw_text_overlay` (`src/tui.rs:1707`).
| Input | `chars().count()` | Terminal cells (East Asian Width; emoji Wide) |
|---|---|---|
| `你好` | 2 | **4** (both Wide) |
| `e\u{0301}` (e + combining acute) | 2 | **1** |
| `🧅` (U+1F9C5) | 1 | **2** |
A line of twenty `你` is 20 chars and 40 cells: the test passes at width 80,
the terminal wraps. A combining-mark string can look "too long" to the test and
still fit.
**Fix (implementation card, approved-then):** measure in cells. `unicode-width`
is already in the lockfile via ratatui but **not** a direct dependency. Do not
add it on this card. Preferred: depend on `unicode-width` explicitly and assert
`UnicodeWidthStr::width(line) <= width as usize`. Until then, keep the existing
`chars().count()` tests green; do not rewrite them to fit a redesign.
`tests/tui_frames.rs` `chars_count_is_not_terminal_cells` documents the three
examples without adding a crate.
## After frames (spacing / ASCII / wrap / copy)
Base: `origin/main` after PR #24 (`33beede`). Hierarchy, fail-closed footer,
1-line header, roster width, help overlay, and `NO_COLOR` palette are unchanged
here. Optional 3-line wordmark at height ≥ 40 was skipped (it fights the 1-line
header without buying hierarchy).
### 80x24 — `draw_share` after (field-boundary wrap)
Invite lines break on `:`. `sig=` hex that does not fit continues as an
all-hex line. Joining those lines (no extra spaces) is the original payload.
```
┌(o) invite────────────────────────────────────────────────────────────────────┐
│give this string to a friend; they F3 paste it │
│ │
│fp ea4a6c63… │
│onion abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion │
│ │
│onionwire:v1: │
│k=ea4a6c63e29c520abef5507b132ec5f9954776aebebe7b92421eea691446d22c: │
│o=abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion: │
│spk=0101010101010101010101010101010101010101010101010101010101010101: │
│sig=46caf16b6da95e86bf93a6ee80605ec74d9e24a419c4ef802632af74f46406fae9953690e0│
│5401b0af934cefea617f71466f406af4bef956847200a8e915190b │
└──────────────────────────────────────────────────────────────────────────────┘
```
### 80x24 — ASCII switch (`ONIONWIRE_ASCII=1`)
No non-ASCII byte. Truncation marker is `...`. Borders are `+` `-` `|`.
```
+(o) invite--------------------------------------------------------------------+
|give this string to a friend; they F3 paste it |
| |
|fp ea4a6c63... |
|onion abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion |
| |
|onionwire:v1: |
|k=ea4a6c63e29c520abef5507b132ec5f9954776aebebe7b92421eea691446d22c: |
|o=abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion: |
|spk=0101010101010101010101010101010101010101010101010101010101010101: |
|sig=46caf16b6da95e86bf93a6ee80605ec74d9e24a419c4ef802632af74f46406fae9953690e0|
|5401b0af934cefea617f71466f406af4bef956847200a8e915190b |
+------------------------------------------------------------------------------+
```
### 80x24 / 120x40 — main chrome after
Same 1-line header, unboxed composer, fail-closed footer as PR #24. Dump:
```
cargo test --locked --test tui_spec -- --nocapture dump_spec_frames
```
Copy wired in `src/tui.rs` (not in the reconstructed standin): empty thread is
`no messages` / `type below, Enter sends`; paste error is `{err}` then
`Enter resubmits Esc back`; alerts truncate to the frame width.
## Delivery state (outbox) — implemented
Per-message state, read from the local outbox. The states are the store's own
(`Queued` / `Sending` / `Sent` / `Failed`) — no parallel model, no new wire
prefix, no server.
| Row | Marker |
|---|---|
| delivered | `you: ping ✓` |
| queued (2nd attempt, 45s out) | `you: pong ◷ queued (try 2/8, retry 45s)` |
| sending | `you: pong » sending` |
| failed | `you: pong ✗ failed: connection timed out` |
| inbound | `them: pong` (no marker) |
- `try {n}/{8}` is the outbox attempt count; `retry {s}s` / `retry {m}m` /
`retry now` comes from the stored absolute `next_attempt_at`.
- Failed reasons are sanitized, cut to the tail of the `a: b: c` chain and
capped at 24 cells (`short_send_reason`).
- Footer while rows are outstanding: `{n} queued`; any terminal failure keeps a
fail-closed `send failed: {short}` statement (with `! ` when colour is off).
- The tag trails the body and wraps with it, so it is never clipped away.
Correlation: a delivered row is deleted from the outbox, so an outbound message
with no row is `Sent`; pending rows are joined to messages on the row id —
`store::Message::id` equals `OutboxEntry::message_id` (`chat_with_delivery`).
Two identical bodies are distinct rows with distinct ids, so the marker always
lands on the row that actually owns the outbox entry.
### Size floor / target
- **Floor: 80x24.** Everything above must render there.
- **Target: 120x40.**
- `tests/tui_spec.rs::chat_and_footer_rows_fit_80x24_and_wrap_instead_of_clipping`
draws the real `draw_chat` + `status_footer` at 80x24 and asserts every chat
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`.
---
## Deliverable 5 — wallet surfaces (copy + pane structure)
Presentation-only. The base branch already owns the API on the table in plan §1.3. This deliverable names the pane on each wallet-family screen, the primary element, and the exact copy for every non-happy state. The copy table is binding: a later card must render these strings (or their ASCII/word variants), not invent new refusal text.
### Wallet screen (`Screen::Wallet`, `draw_wallet` — `src/tui.rs:3072`)
Layout: vertical 2-line title, a bordered body that fills the middle, 1-line action footer.
```
┌wallet────────────────────────┐
└──────────────────────────────┘
┌──────────────────────────────┐
│address 4AdY… │
│balance not synced — unavailable│
│ │
│chain │
│chain: local monerod … │
│daemon: stopped … │
│sync: unknown — … │
│storage: 412 GB free … │
│not ready: wallet RPC … │
│pruned nodes … │
│ │
│recent transfers │
│ (none shown) │
│ │
│ │
│ │
│ │
└──────────────────────────────┘
s chain n start/stop c create i import r qr
```
Primary: address + balance + chain block. Largest element on screen.
**Copy table** — every state the wallet screen can show (sources verified at base commit `b20313e`):
| State | On-screen copy | Source |
|---|---|---|
| Receive-only / no wallet | address: `no address yet — /profile xmr, or create a wallet`; balance: `not synced — unavailable` | `draw_wallet` empty branch; `wallet_view` not-ready branch |
| Receive-only configured (no daemon) | chain: `chain: receive-only — no daemon, no chain traffic`; daemon: `daemon: not configured — press s to choose a chain source`; readiness: `not ready: no wallet — receive-only until c create / i import` | `chain_view` `ChainSource::None` + `WalletChildState::Off` |
| Local monerod chosen, stopped | `chain: local monerod ({bin}) — chain in {dir}`; `daemon: stopped — press n to start it` | `ChainSource::Local` + `WalletChildState::Stopped` |
| Local monerod running | `daemon: running (child owned by this app)` | `WalletChildState::Running` |
| Remote daemon | `chain: remote daemon {host}:{port}` | `ChainSource::Remote` |
| Daemon unreachable | `sync: unknown — {note}` | `DaemonSync.reachable == false` |
| Daemon reachable, syncing | `sync: syncing — {h}/{target}` | `DaemonSync` height/target |
| Daemon synced | `sync: synced — height {h}` | `DaemonSync.synced()` |
| Sync unknown (never probed) | balance: `not synced — unavailable` (never the real balance) | `wallet_view` `!chain.ready` |
| Balance ready | the real balance line (e.g. `12.5 XMR`) | `wallet_view` `chain.ready` |
| No transfers | ` (none shown)` | `draw_wallet` empty transfers branch |
| View-only | spend badge: `view-only — /tip off` (word + glyph, never color-only) | `WalletConfig.no_spend` / `VIEW_ONLY_MSG` |
| Not configured (wallet screen) | readiness: `not ready: no wallet — receive-only until c create / i import` | `WalletReadiness::NotConfigured.line()` |
| Configured, RPC down | readiness: `not ready: wallet RPC not answering — balance is not authoritative` | `WalletReadiness::NotConnected.line()` |
| Ready | readiness: `ready: wallet synced — spend and receipt verification available` | `WalletReadiness::Ready.line()` |
| `/tip` on view-only | status_note exactly: `wallet is in view-only/no-spend mode — /tip is disabled; /pay and receipt verification still work` | `wallet::VIEW_ONLY_MSG` |
| `/tip` or `/pay`, not configured | status_note exactly: `wallet not configured — open F7 to set it up, or set ONIONWIRE_WALLET_RPC` | `wallet::NOT_CONFIGURED_MSG` |
| `/tip` or `/pay`, not connected | status_note exactly: `wallet not connected — check endpoint, login, daemon` | `wallet::NOT_CONNECTED_MSG` |
| Friend has no address (`/tip`) | status_note exactly: `friend has no Monero address — they must /profile` | existing `tip` refusal (src/tui.rs:1738) |
| Address empty (both profile + RPC empty) | status_note: `no receive address — set profile xmr or ONIONWIRE_WALLET RPC` | existing `wallet_receive_address` guard |
Action row (`src/tui.rs:3164`): `s chain n start/stop c create i import r qr`
### Chain setup screen (`Screen::ChainSetup`, `draw_chain_setup` — `src/tui.rs:3170`)
Overlay via `draw_text_overlay`. Three modes:
| Mode | Title | Body | Hint |
|---|---|---|---|
| `Choose` | `chain source` | `where should the chain come from?` + 3 choices (Receive-only / Local monerod / Remote daemon) with detail lines + `receive-only needs no wallet file…` + `Up/Down choose Enter select Esc back` | `ChainChoice::ALL` order; never preselects Remote |
| `RemoteAddr` | `enter daemon address` | `daemon address, as host:port` + `e.g. 127.0.0.1:18081 or yournode.onion:18089` + `> {buf}` + error line or `Enter continues Esc goes back` | parses via `parse_daemon_addr` |
| `RemoteWarn` | `trust shift` | `use {host}:{port} for chain traffic?` + `the daemon operator sees your addresses during sync,` + `and every spend. a remote daemon is untrusted:` + `this app never passes --trusted-daemon.` + `.onion` branch: `this is a .onion host, so Tor would hide the transport.` + `it still does not hide your addresses from the operator.` + `ONION_NO_SOCKS_MSG` | `Enter saves it Esc cancels` |
### Wallet setup screen (`draw_wallet_setup` — `src/tui.rs:3235`)
Five overlays, all via `draw_text_overlay`. The spend-authority warning is `wallet::SPEND_AUTHORITY_WARNING` (exact, `src/wallet.rs:308`).
| Screen | Title | Body | Exit |
|---|---|---|---|
| `CreateWarn` | `create spend wallet` | `SPEND_AUTHORITY_WARNING` + blank + `Type SPEND to confirm Esc to cancel` + `{typed}` | type SPEND / Esc |
| `CreatePass` (1st) | `wallet passphrase` | `set a passphrase for the wallet file` + `Enter continues Esc cancels` | Enter / Esc |
| `CreatePass` (2nd) | `wallet passphrase` | `re-type passphrase` + `Enter submits Esc cancels` | Enter / Esc |
| `CreatePass` mismatch | — | alert: `passphrases do not match` | alert_line |
| `CreateSeed` | `write down this seed` | `{seed}` + blank + `this is shown once. anyone with it can spend.` + `Type SEEN when you have written it down` + `{typed}` | type SEEN / Esc (zeroizes seed on Esc) |
| `ImportSeed` | `import wallet` | `paste the 25-word seed. this is the only path that takes an existing key.` + blank + `{buf}` + blank + `Enter continues Esc cancels` | Enter / Esc |
| `ImportSeed` empty | — | alert: `seed required to import a wallet` | error |
| `ImportPass` (1st) | `wallet passphrase` | `passphrase for the imported wallet file` + `Enter continues Esc cancels` | Enter / Esc |
| `ImportPass` (2nd) | `wallet passphrase` | `re-type passphrase` + `Enter submits Esc cancels` | Enter / Esc |
| `ImportPass` mismatch | — | alert: `passphrases do not match` | alert_line |
| RPC failure | — | alert: the RPC error exactly as returned | error |
### New send/tip flow (`Screen::Send` — **new screen, spec only**)
No screen exists yet in `src/tui.rs`. Primary: recipient + amount field + memo field + resolved atomic value + confirm action. Opens from the wallet screen and from main with a friend selected.
| State | Copy | Source |
|---|---|---|
| No friend selected / empty recipient | action row disabled: `recipient required` | spec |
| Amount unparsed (junk / negative / >8 dp) | field error: `amount: {parse_atomic error}` | `pay::parse_atomic` |
| Amount 0 | field error: `amount must be > 0`; confirm disabled | `pay::parse_atomic` rejection |
| View-only / no-spend refusal | confirm disabled; line exactly: `wallet is in view-only/no-spend mode — /tip is disabled; /pay and receipt verification still work` | `VIEW_ONLY_MSG` |
| Not configured refusal | confirm disabled; line exactly: `wallet not configured — open F7 to set it up, or set ONIONWIRE_WALLET_RPC` | `NOT_CONFIGURED_MSG` |
| Friend has no address | line exactly: `friend has no Monero address — they must /profile` | existing `tip` guard |
| Amount too large for RPC | line: the overflow error from `pay::xmr_to_atomic` | `pay::xmr_to_atomic` |
| Address fails checksum | the address-check error verbatim | `pay::check_address` |
| Sending | status_note: `sending` | existing flow |
| Sent | status_note: `tip sent` (tip) / `invoice sent` (pay) | existing |
| Send failed | status_note: `send failed: {short}` (`! ` when colour off) | `short_send_reason` |
| Esc | no side effect; return to wallet screen | spec |
Spend badge visible on this screen (a view-only wallet cannot reach confirm). Same badge as the wallet screen: `view-only — /tip off`.
### New payment history (`Screen::History` — **new screen; API gap**)
`Node::list_payments(friend_pk)` exists at `src/node.rs:520` and returns `Vec<Payment>`. The `Payment` struct (`src/store.rs:94`):
```
pub struct Payment {
pub id: i64, // store row id
pub dir: String, // "in" | "out"
pub kind: String, // "tip" | "invoice" | "payment"
pub amount_atomic: String,
pub address: String,
pub memo: String,
pub txid: Option<String>,
pub verified: bool,
pub created_at: i64, // unix secs
}
```
Row copy (derived from `Payment`):
| State | Copy | Source |
|---|---|---|
| Empty history | `no payments with this friend yet` | spec (designed, never blank) |
| Outbound, verified | `> {amount} XMR ✓ verified {age}` | `pay::atomic_to_xmr_str` + `Payment.verified` |
| Outbound, unverified | `> {amount} XMR unverified {age}` | word + glyph, never color-only |
| Inbound | `< {amount} XMR {verified/unverified} {age}` | `dir == "in"` |
| No txid | line: `awaiting receipt` | `Payment.txid == None` |
| Long memo | wrap or truncate with `…`/`...` after `sanitize::display_text` | sanitize first |
| Hostile memo (control chars + bidi) | sanitized before draw | `sanitize::display_text` |
| Detail view — txid absent | `txid: awaiting receipt` | `Payment.txid == None` |
Amount is displayed via `pay::atomic_to_xmr_str(&t.amount_atomic)` (`src/pay.rs:144`) — never raw piconero.
### F7 wallet-config screen (`Screen::WalletConfig` — **implemented**)
`draw_wallet_config` renders a full-screen overlay with title `wallet config`.
| State | Copy | Source |
|---|---|---|
| Not configured | `wallet not configured — set rpc_url` | spec |
| rpc_url empty, Test pressed | `rpc_url required` | `WalletConfig::from_config` error |
| rpc_login masked (default) | `rpc_login: •••••••` | `WalletConfig::secret()` redaction |
| rpc_login revealed | `rpc_login: {user}:{mask}` | reveal toggle; real password never printed |
| Test connecting | `testing connection …` (no spinner) | `PingResult` in flight |
| Test OK | `connected — {PingResult::line()}` | `PingResult::line()` |
| Test failed | `error: {short}` (sanitized, never the login) | `Wallet::sanitize` / `redact` |
| Save success, not connected | `saved · not connected` | spec |
| Save success, connected | `connected · {PingResult::line()}` | spec |
| Save failure | `error: {short}` | sanitized |
| no_spend off | `spend on — /tip enabled` | word + glyph |
| no_spend on | `view-only — /tip off` | word + glyph |
Masking rule: `WalletConfig::secret()` (`src/wallet.rs:79`) exists for redaction. The fixture password must not appear in any rendered frame, status note, alert, or help string. The toggle is distinguishable in `NO_COLOR` by the word `•••••••` vs the user, not by color alone.
### Copy rules for every wallet surface
1. Refusal text is the existing string from `wallet.rs` / `Node` — never invent a softer version.
2. Spend badge is always word + glyph (`view-only — /tip off`; `spend on`). Never color-only.
3. Addresses from a friend's profile are peer-supplied — pass through `sanitize::display_text` before draw.
4. Memos are peer-supplied — sanitize first, then wrap/truncate with ellipsis.
5. Empty states are designed copy, not blank panes.
6. Fail-closed status notes (`send failed`, `fingerprint mismatch`, view-only refusal) keep the `! ` prefix when colour is off (`src/tui.rs:64`).
---
## F7 wallet-config — after frames
Real `draw_wallet_config` via `TestBackend`. `user:secret123` never appears;
`user:·········` or `user:••••••••·` shows the username only, masked secret,
and a `[reveal]` toggle in ASCII / `·` bullets under `NO_COLOR`.
### 80x24 — idle, masked, focus on rpc_url
```
┌wallet config───────────────────────────────────────────────────────────────┐
│> rpc_url │
│ http://127.0.0.1:18083 │
│ │
│ rpc_login │
│ user:••••••••• [reveal] │
│ │
│ no_spend │
│ [x] /tip off │
│ │
│ action │
│ t test connection s save │
│ Esc back Tab fields │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└──────────────────────────────────────────────────────────────────────────────┘
```
### 80x24 — tested-fail (NO_COLOR), focus on rpc_login
```
+wallet config-----------------------------------------------------------------+
| rpc_url |
| http://127.0.0.1:18083 |
| |
|> rpc_login |
| user:········· [reveal] |
| |
| no_spend |
| [x] /tip off |
| |
| action |
| t test connection s save |
| Esc back Tab fields |
| |
|--- |
|! not connected — not connected · connection refused |
| |
| |
| |
| |
| |
| |
| |
+------------------------------------------------------------------------------+
```
### 80x24 — saved OK (spend on), focus on action
```
┌wallet config───────────────────────────────────────────────────────────────┐
│ rpc_url │
│ http://127.0.0.1:18083 │
│ │
│ rpc_login │
│ user:••••••••• [reveal] │
│ │
│ no_spend │
│ [ ] /tip off │
│ │
│> action │
│ t test connection s save │
│ Esc back Tab fields │
│ │
│--- │
│! saved · not connected │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└──────────────────────────────────────────────────────────────────────────────┘
```
### 120x40 — idle, no_spend on, focus on rpc_url
```
┌wallet config─────────────────────────┐
│> rpc_url │
│ http://127.0.0.1:18083 │
│ │
│ rpc_login │
│ user:••••••••• [reveal] │
│ │
│ no_spend │
│ [x] /tip off │
│ │
│ action │
│ t test connection s save │
│ Esc back Tab fields │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└───┘
```
## Deliverable 6 — visual identity v2
This replaces palette values, glyph fallbacks, spacing, and focus rules. It does **not** add hues. The locked helper names and strings in `tests/tui_chrome.rs` survive.
### Color palette
The palette lives as RGB constants in `src/tui.rs:21-27`, each with an ANSI16 fallback via `style_fg()` / `style_accent()` / `style_highlight()`. `NO_COLOR` (`ColorMode::None`) drops fg entirely and uses bold/reverse for accent/highlight.
| Role | RGB (current) | ANSI16 fallback | `NO_COLOR` treatment | Where |
|---|---|---|---|---|
| accent | `Rgb(232, 165, 75)` | `Yellow` | bold | titles, focus marks, QR border |
| text | `Rgb(196, 214, 176)` | `White` | plain | body copy, chat, address/balance |
| dim | `Rgb(98, 110, 92)` | `DarkGray` | plain | action row, hints, help |
| alert | `Rgb(220, 80, 70)` | `Red` | `! ` prefix | fail-closed, view-only refusal |
| stale | `Rgb(210, 180, 80)` | `Yellow` | plain + `stale` text | stale roster suffix |
| highlight bg | `Rgb(48, 42, 28)` | `Reverse` | reverse | focused roster row |
| border | `Rgb(72, 84, 64)` | `DarkGray` | plain | pane borders |
`style_highlight()` (`src/tui.rs:379`) uses bold + reverse for NO_COLOR. `style_accent()` (`src/tui.rs:351`) uses bold for NO_COLOR. `style_fg()` (`src/tui.rs:343`) drops fg entirely for NO_COLOR.
**No change to these six values on this card.** Deliverable 6 is the *specification* of how they apply to the wallet surfaces — not a recolor.
### Glyph set (use → unicode → ASCII fallback)
| Glyph | Unicode | ASCII | Cell width (unicode) | Where |
|---|---|---|---|---|
| onion / share | `(o)` | `(o)` | 3 | title (locked) |
| focus | `> ` | `> ` | 2 | focused pane title / roster |
| truncate | `…` | `...` | 1 | `truncate_chars` tail |
| box (border) | `─ │ ┌ ┐ └ ┘` | `+ - |` | 1 each | ratatui `Block::borders` |
| alert prefix | `! ` | `! ` | 2 | fail-closed (`src/tui.rs:64`) |
| stale | word `stale` | `stale` | 5 | roster suffix |
| delivered | `✓` | `ok` | 1 | delivery marker |
| queued | `◷` | `queued` (word) | 1 | delivery marker |
| sending | `»` | `sending` (word) | 1 | delivery marker |
| failed | `✗` | `failed` (word) | 1 | delivery marker |
| bullet (masked) | `•` | `·` | 1 | password mask |
Glyphs are never color-only. ASCII mode (triggered by `ONIONWIRE_ASCII=1` or `NO_COLOR=1`) swaps all unicode glyphs per the table. `delivery_glyph()` (`src/tui.rs:138`) and `tests/tui_spec.rs::delivery_markers_have_exercised_ascii_fallbacks` exercise the fallback.
### Spacing unit
**1 cell.** All internal padding is a single space after the label: `address {value}`, `balance {value}`, `chain: {detail}`. A single blank `String::new()` row separates blocks. Pane borders add no inner pad on the title line.
### Focus rules per pane
- Main: roster > chat > composer. Focused title gets `> ` prefix + bold; unfocused gets ` `.
- Wallet: body block (address/balance/chain/transfers) is primary; action row is dim, never bold. No in-body focus — keys drive navigation.
- Overlays (chain setup, wallet setup, send, history, F7): full-screen, Escape returns. The active field gets `> ` prefix.
- Focus is never color-only. `NO_COLOR` keeps bold/reverse and the `> `/` ` prefix.
### Pane structure per wallet-family screen
| Screen | Panes (top → bottom) |
|---|---|
| Wallet (`draw_wallet`) | title `wallet` (2 rows) / body border (fill) / action row (1 row) |
| `draw_wallet` body | address line / balance line / blank / `chain` header / 5 chain lines / PRUNED_NOTE wrapping / blank / `recent transfers` / transfer rows or `(none shown)` / remaining blank |
| Chain setup (`draw_chain_setup`) | single overlay, full-screen |
| Wallet setup (`draw_wallet_setup`) | single overlay, full-screen |
| Send flow | **to spec** — single overlay, full-screen |
| Payment history | **to spec** — single overlay, full-screen |
| F7 config | **implemented** — single overlay, full-screen |
`WALLET_LINE_MAX` = 76 (`src/tui.rs:1169`). Every chain line is `truncate_chars(&line, WALLET_LINE_MAX)` (`src/tui.rs:1373`).
---
## Before frames (identity v1)
Real `draw_wallet` frames from the base branch at `b20313e`, rendered via `TestBackend` at 80x24. The dump test (`tests/tui_wallet_dump.rs`) was a throwaway — removed after capture, touches no `src/`. Trailing spaces omitted.
### Wallet screen — not-ready / daemon stopped (80x24)
```
┌wallet────────────────────────────────────────────────────────────────────────┐
└──────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────┐
│address 4AdYaG7wVQ3nHvWoXbN9dQkXj1uYcR2mS8pT5LzE6fK7gD │
│balance not synced — unavailable │
│ │
│chain │
│chain: local monerod (monerod) — chain in /home/user/.onionwire/chain │
│daemon: stopped — press n to start it │
│sync: unknown — 127.0.0.1:18081: Connection refused (os error 111) │
│storage: 412 GB free here — pruned mainnet wants ~50-60 GB, a full node ~20… │
│not ready: wallet RPC not answering — balance is not authoritative │
│pruned nodes are not archives: a deep seed restore can degrade. once this │
│wallet has scanned, its own cache is the history │
│ │
│recent transfers │
│ (none shown) │
│ │
│ │
│ │
│ │
│ │
└──────────────────────────────────────────────────────────────────────────────┘
s chain n start/stop c create i import r qr
```
### Wallet screen — receive-only (80x24)
```
┌wallet────────────────────────────────────────────────────────────────────────┐
└──────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────┐
│address no address yet — /profile xmr, or create a wallet │
│balance not synced — unavailable │
│ │
│chain │
│chain: receive-only — no daemon, no chain traffic │
│daemon: not configured — press s to choose a chain source │
│sync: unknown — receive-only: no daemon │
│storage: nothing stored on this device │
│not ready: no wallet — receive-only until c create / i import │
│pruned nodes are not archives: a deep seed restore can degrade. once this │
│wallet has scanned, its own cache is the history │
│ │
│recent transfers │
│ (none shown) │
│ │
│ │
│ │
│ │
│ │
└──────────────────────────────────────────────────────────────────────────────┘
s chain n start/stop c create i import r qr
```
### Wallet screen — ready / synced (80x24)
```
┌wallet────────────────────────────────────────────────────────────────────────┐
└──────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────┐
│address 4AdYaG7wVQ3nHvWoXbN9dQkXj1uYcR2mS8pT5LzE6fK7gD │
│balance 12.5 XMR │
│ │
│chain │
│chain: local monerod (monerod) — chain in /home/user/.onionwire/chain │
│daemon: running (child owned by this app) │
│sync: synced — height 3210000 │
│storage: 412 GB free here — pruned mainnet wants ~50-60 GB, a full node ~20… │
│ready: wallet synced — spend and receipt verification available │
│pruned nodes are not archives: a deep seed restore can degrade. once this │
│wallet has scanned, its own cache is the history │
│ │
│recent transfers │
│ (none shown) │
│ │
│ │
│ │
│ │
│ │
└──────────────────────────────────────────────────────────────────────────────┘
s chain n start/stop c create i import r qr
```
### Wallet screen — ready / synced (120x40)
Wider: the truncated storage line reads in full — `…a full node ~200 GB` — and the body block has 27 rows of empty space.
```
┌wallet────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│address 4AdYaG7wVQ3nHvWoXbN9dQkXj1uYcR2mS8pT5LzE6fK7gD │
│balance 12.5 XMR │
│ │
│chain │
│chain: local monerod (monerod) — chain in /home/user/.onionwire/chain │
│daemon: running (child owned by this app) │
│sync: synced — height 3210000 │
│storage: 412 GB free here — pruned mainnet wants ~50-60 GB, a full node ~200 GB │
│ready: wallet synced — spend and receipt verification available │
│pruned nodes are not archives: a deep seed restore can degrade. once this wallet has scanned, its own cache is the │
│history │
│ │
│recent transfers │
│ (none shown) │
│ │
│ │
│ │
│ │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
s chain n start/stop c create i import r qr
```
---
## Evidence
- `TMPDIR=/var/tmp/onionwire-tui-tmp` set for all compile steps (§1.5 disk-quota trap on `/tmp`).
- `cargo test --locked --test tui_frames -- --nocapture dump_audit_frames` — ok.
- `cargo test --locked --test tui_spec -- --nocapture dump_spec_frames` — ok.
- Wallet screen assertion tests: `wallet_screen_says_not_ready_and_never_a_balance_before_sync`, `wallet_screen_says_receive_only_when_nothing_is_configured`, `wallet_screen_keeps_the_balance_when_the_wallet_is_ready`, `a_view_only_wallet_says_so_instead_of_offering_a_spend` — all green.
- `ChainChoice::ALL.len() == 3` (three choices, never a public node) — asserted.
- `status_footer` keeps `send failed`, `TOR`, `me:`, `? help` at 80 and 120 — asserted by `status_footer_drops_send_failed_when_crowded`.
- `chars().count() <= width` on all locked public copy — asserted by `public_copy_fits_80_by_chars_count`.