diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-01 19:19:49 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-01 19:19:49 +0100 |
| commit | 24e3bb54db579fb9aad8df2a591527dc77fe4cb4 (patch) | |
| tree | af9a0c290f2675068e8396823f641f24bbe4d308 /docs | |
| parent | v4.0.6: move the prompt editor and key mapping out of the core (diff) | |
| download | zagan-bet-24e3bb54db579fb9aad8df2a591527dc77fe4cb4.tar.gz zagan-bet-24e3bb54db579fb9aad8df2a591527dc77fe4cb4.zip | |
v4.0.7: finish the Phase 1 boundary with a command shell
The terminal command line moves to client::shell: a typed line becomes a core Command or an adapter action (connect, login, register, set-credential, host maintenance). ClientCore loses submit_line and the last TUI-shaped effects (Interactive, SetPrompt, ListHosts, ForgetHost, AnimateRoulette); the adapter animates roulette from the Result view.
Adds forget-login, which drops the stored credential for the pinned key and keeps trust, distinct from logout (session only) and forget-host (trust too).
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/GUI-PLAN.md | 38 | ||||
| -rw-r--r-- | docs/adr/0001-testable-client-server-cores.md | 10 |
2 files changed, 29 insertions, 19 deletions
diff --git a/docs/GUI-PLAN.md b/docs/GUI-PLAN.md index cb0db91..2789b81 100644 --- a/docs/GUI-PLAN.md +++ b/docs/GUI-PLAN.md | |||
| @@ -24,18 +24,25 @@ Breaking wire change, released for client and server together. | |||
| 24 | **Gate:** mismatch refused in both directions, `HELLO` required before auth, | 24 | **Gate:** mismatch refused in both directions, `HELLO` required before auth, |
| 25 | existing game flows unchanged, new tests for version parsing and gating. | 25 | existing game flows unchanged, new tests for version parsing and gating. |
| 26 | 26 | ||
| 27 | ## Phase 1 — core boundary and roulette | 27 | ## Phase 1 — core boundary and roulette (done) |
| 28 | 28 | ||
| 29 | **In progress.** `Command`/`View` exist and all four games are ported: the | 29 | Complete in v4.0.7. Every game plus `Lobby` and `History` are structured views; |
| 30 | core builds a typed view, frontends send `Command`, and the TUI renders it. | 30 | the core builds the view and frontends send `Command`. The client transport |
| 31 | Done so far: every game plus `Lobby` and `History` are structured views; the | 31 | (TCP, rustls, TOFU, `HELLO`, auto-login) lives in `client::transport` behind a |
| 32 | client transport (TCP, rustls, TOFU, `HELLO`, auto-login) lives in | 32 | trust callback. The command line moved out of the core in two pieces: |
| 33 | `client::transport` behind a trust callback; login and registration are | 33 | `client::input` owns the editor, history and key mapping, and `client::shell` |
| 34 | `Command`s, so a GUI form never needs a terminal prompt. The command-line | 34 | parses a finished line into a core `Command` or an adapter action (connect, |
| 35 | editor and key mapping moved to `client::input`; `ClientCore` no longer knows | 35 | login, register, set-credential, host maintenance). `ClientCore` no longer |
| 36 | keys, the prompt or its history. Remaining: the `Connect` and `Trust` adapter | 36 | holds a `Key`, a prompt buffer, or any of the old TUI-shaped effects |
| 37 | screens, and replacing the last TUI-shaped effects (`Interactive`, host | 37 | (`Interactive`, `SetPrompt`, `ListHosts`, `ForgetHost`, `AnimateRoulette`); the |
| 38 | listing, roulette animation) with commands. | 38 | roulette wheel animation is derived from the `Result` view by the adapter. |
| 39 | "Log out" (`logout`) and "forget saved login" (`forget-login`) are distinct: the | ||
| 40 | latter drops the credential for the pinned key and keeps trust. | ||
| 41 | |||
| 42 | The `Connect` and `Trust` screens are adapter-owned for now: the terminal asks | ||
| 43 | in the transcript, and the GUI will draw them as its own screens over the same | ||
| 44 | `client::transport` callback. They are not core state because the core never | ||
| 45 | sees a certificate. | ||
| 39 | 46 | ||
| 40 | - Introduce `Command` and `View`; move terminal-only concerns (prompt editing, | 47 | - Introduce `Command` and `View`; move terminal-only concerns (prompt editing, |
| 41 | wheel animation, interactive prompts) into the TUI adapter. | 48 | wheel animation, interactive prompts) into the TUI adapter. |
| @@ -43,13 +50,14 @@ listing, roulette animation) with commands. | |||
| 43 | `History`, `Game`. | 50 | `History`, `Game`. |
| 44 | - Port roulette first: `PlaceBet(BetTarget)`, `SetChip`, `ClearBets`, `Spin`, | 51 | - Port roulette first: `PlaceBet(BetTarget)`, `SetChip`, `ClearBets`, `Spin`, |
| 45 | and a `FeltView` carrying chips, cursor, and the last result. | 52 | and a `FeltView` carrying chips, cursor, and the last result. |
| 46 | - Add `ForgetLogin` so "log out" and "forget saved login" are distinct in both | 53 | - Add `forget-login` so "log out" and "forget saved login" are distinct in both |
| 47 | frontends. | 54 | frontends. |
| 48 | - Auto-login stays: a stored credential for the pinned fingerprint logs in | 55 | - Auto-login stays: a stored credential for the pinned fingerprint logs in |
| 49 | automatically after the trust check. | 56 | automatically after the trust check. |
| 50 | 57 | ||
| 51 | **Gate:** the TUI behaves exactly as today, its tests now assert on `View` | 58 | **Gate:** met. The TUI behaves as before (same boards, keys and prompts), its |
| 52 | instead of text where practical, and `ClientCore` contains no terminal types. | 59 | tests drive the real adapter path (`shell::parse`, `Editor`, `game_input`), and |
| 60 | `ClientCore` contains no terminal types. | ||
| 53 | 61 | ||
| 54 | ## Phase 2 — the other three games | 62 | ## Phase 2 — the other three games |
| 55 | 63 | ||
diff --git a/docs/adr/0001-testable-client-server-cores.md b/docs/adr/0001-testable-client-server-cores.md index 2e3cd1e..c19c01a 100644 --- a/docs/adr/0001-testable-client-server-cores.md +++ b/docs/adr/0001-testable-client-server-cores.md | |||
| @@ -16,10 +16,12 @@ exercised from `tests/`. | |||
| 16 | - The library (`src/lib.rs`) owns shared logic. `src/bin/client` and | 16 | - The library (`src/lib.rs`) owns shared logic. `src/bin/client` and |
| 17 | `src/bin/server` are thin adapters for crossterm, TLS, environment variables, | 17 | `src/bin/server` are thin adapters for crossterm, TLS, environment variables, |
| 18 | and interactive prompts. | 18 | and interactive prompts. |
| 19 | - `client::core::ClientCore` owns input, history, commands, game state, and | 19 | - `client::core::ClientCore` owns commands, game state, the current screen, and |
| 20 | pending replies. It returns `Effect`s (`Print`, `ReplaceRegion`, `ClearRegion`, | 20 | pending replies. It returns `Effect`s (`Print`, `Render(View)`, `ClearRegion`, |
| 21 | `SetPrompt`, `SendLine`, `Interactive`, ...). The binary applies them; the | 21 | `SendLine`, `Disconnect`, `Quit`). The binary applies them; the tests apply |
| 22 | tests apply them to a headless screen. | 22 | them to a headless screen. The prompt buffer, history and key mapping live in |
| 23 | `client::input`, and `client::shell` parses a finished line, so the core never | ||
| 24 | sees a `Key` or a raw command line. | ||
| 23 | - `server::core::ServerCore` owns message handling and receives an injected | 25 | - `server::core::ServerCore` owns message handling and receives an injected |
| 24 | `Connection`, `GameRegistry`, and bcrypt cost. The binary only owns the TLS | 26 | `Connection`, `GameRegistry`, and bcrypt cost. The binary only owns the TLS |
| 25 | listener and per-connection thread. | 27 | listener and per-connection thread. |
