feat(gui): the notice for a host that holds the books has a button that closes it

Plan P15 unit A5, fix round. When an older build's detached host (or `wanderbooks
serve`) holds the books, the app's start is refused, and the notice said to run
`wanderbooks close`. A packaged Mac or Windows install may have no command line
on the path. The notice now says what will happen, and carries a "Close it"
button that asks the host to close the books and waits until it has
(`commands::close_the_host`, what `wanderbooks close` does, over the unchanged
lease protocol, which an older host speaks), then starts the app's own server
and takes the notice away. The line to type stays in the words as the fallback.
A close that fails says why and offers the button again; a start refused for any
other reason offers none. The `Owner` trait gets two methods with default bodies
(`serve_host_holds`, `serve_close_host`), so existing implementations, test mocks
included, are untouched.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-21 12:19:46 -07:00
1 parent 6164d0fa68
commit c47144a401
6 files changed
+388 -1

No files matched your search

+13
View File
@@ -229,6 +229,19 @@ pub trait Owner: Send + Sync {
fn serve_start(&self, _open: &[String]) -> Result<(), String> {
Ok(())
}
/// Whether another program's host holds the books now (an earlier
/// build's, or `wanderbooks serve`'s): asked when the start was
/// refused, to offer the person a button that closes it
/// (`serve_close_host`) beside the line that says what to type.
fn serve_host_holds(&self) -> bool {
false
}
/// Ask that host to close the books and wait until it has (what
/// `wanderbooks close` does, for a person with no command line on
/// their path): `Ok` says what came of it, `Err` why not. Blocks.
fn serve_close_host(&self) -> Result<String, String> {
Err("not here".into())
}
/// Open the company `book` in the server (a tab opened): `Ok(None)`
/// when it is open now. Blocks.
fn serve_open(&self, _book: &str) -> Result<Option<String>, String> {