docs(spec): WB-link-1 to 6, WB-assist-6, WB-app-6 for the app's side of the relay (P15 B3)
The claims for the identity, the line, TLS at the app, certificates, the states in words and the per-company switch, the Connect page's web half and the first run; parity.md, the architecture table and the plan's follow-ups (what B3 left out and why: certificate-log watching, steps for products nobody tried, the key for key-only products, a real relay and authority). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
db953c7b5b
commit
14c1a26bfc
6 files changed
+292
-4
No files matched your search
@@ -36,7 +36,9 @@ the specification in `bookspec/` (which never depends on the engine).
|
||||
| `ledger-import` | formats: QuickBooks CSV in; IIF, XLSX, Typst PDFs (statements, the invoice, labels, the audit workpaper) out | `ledger-core`, `ledger-reader` |
|
||||
| `ledger-package` | the shared read-only view over `Store` or `Snapshot` (`PackageBooks`): the CPA package, the 1099 worksheet, the invoice document, Needs attention | `ledger-core`, `ledger-store`, `ledger-config`, `ledger-import`, `ledger-vault` |
|
||||
| `ledger-mcp` | the books server: the MCP tools (122), resources, the handbook, scopes, the door and the access log, backups' scheduling | all of the above |
|
||||
| `ledger-host` | the app's books server as the window's child (`app_server`, P15), the headless host and its leases (`serve` alone starts one), the agent bridge (`wanderbooks mcp`, a line to whatever runs), tokens in 0600 files under the data root (D-63), the owner's commands, uploads and downloads, `update` and `rollback` (P11a), books homes and how to start an agent in one (P11b) | `ledger-store`, `ledger-mcp`, `ledger-config` |
|
||||
| `relay` | the relay for `wanderbooks.link` (P15 B2): routes a web caller's TLS by name down the app's line, and is the domain's DNS; its `proto`, `names`, `mux` and `client` modules are the app's side of the wire too | none of ours |
|
||||
| `ledger-link` | the app's side of the relay (P15 B3): the durable address (key, four-word name, secret label), the one outbound line with backoff and pings, TLS ended in the app, the app's own certificate by ACME DNS-01 (the authority is the relay's list, behind an `Issuer` trait) and its renewals; runs in the window's process | `relay` (and `ledger-store`, Windows only, for the owner-only file helper) |
|
||||
| `ledger-host` | the app's books server as the window's child (`app_server`, P15), the headless host and its leases (`serve` alone starts one), the agent bridge (`wanderbooks mcp`, a line to whatever runs), tokens in 0600 files under the data root (D-63), the owner's commands, uploads and downloads, `update` and `rollback` (P11a), books homes and how to start an agent in one (P11b) | `ledger-store`, `ledger-mcp`, `ledger-config`, `ledger-link` |
|
||||
| `ledger-gui` | the viewer: read-only, live, egui, one window with a tab per open company (P15); the Books menu hands work to the server; the agent dock and the first-run page (P11b) | `ledger-core`, `ledger-store`, `ledger-config`, `ledger-import`, `ledger-package`, `ledger-vault`, `ledger-host` |
|
||||
| `ledger-cli` | `wanderbooks`, the one executable: every mode (`serve`, `server`, `host`, `mcp`, `gui`, `setup`, `books`, `token`, `connect`, `doctor`, `licenses`, …) and the over-the-wire test suites | everything |
|
||||
| `bookspec/checker`, `bookspec/runner` | the example schema and parser, the rule catalogue, the `Engine` trait; the per-rule runner | nothing of ours (the adapter in `ledger-core`'s tests depends on them) |
|
||||
|
||||
+2
-1
@@ -270,7 +270,8 @@ product's own sign-in has been tried against it yet.
|
||||
|
||||
| Area | Counterpart (a cross-check, not the spec) | Status | Notes |
|
||||
|---|---|---|---|
|
||||
| Web assistants reach a company over HTTPS and sign in with OAuth 2.1, approved by the person in the app's window; read and draft by default, posting per connection | QBO's and Xero's "connected apps" consent screens are a cross-check only | partial | WB-remote-1 to WB-remote-10, WB-assist-5; `ledger-mcp` unit tests in `src/local/remote/` (`tests.rs`, `proxy.rs`, `cimd.rs`, `pages.rs`), `ledger-gui` `tests/assistants.rs`; open: reached through the relay (B3), tried with Claude and ChatGPT on the web, uploads and downloads over this door |
|
||||
| Web assistants reach a company over HTTPS and sign in with OAuth 2.1, approved by the person in the app's window; read and draft by default, posting per connection | QBO's and Xero's "connected apps" consent screens are a cross-check only | partial | WB-remote-1 to WB-remote-10, WB-assist-5; `ledger-mcp` unit tests in `src/local/remote/` (`tests.rs`, `proxy.rs`, `cimd.rs`, `pages.rs`), `ledger-gui` `tests/assistants.rs`; open: tried with Claude and ChatGPT on the web, uploads and downloads over this door |
|
||||
| Web assistants are turned on per company in the app (off by default), reached through the relay at one durable private address with the app's own certificate, and the page says in plain words how far it has got and what is wrong | Tailscale Funnel and Home Assistant Cloud do the same (a cross-check only) | partial | WB-link-1 to WB-link-6, WB-assist-6, WB-app-6; `ledger-link` `tests/link.rs` and `tests/acme.rs`, `ledger-cli` `tests/web_link.rs`, `ledger-gui` `tests/web_connect.rs`; open: the relay and a certificate authority are only tried in-process (never a real relay or authority), steps for ChatGPT and others (none written: untested), a key for products that take only a key, watching the certificate logs for a certificate the app did not ask for |
|
||||
|
||||
## P15 T1: every write is one transaction, exactly once (2026-11-21, D-88, D-89)
|
||||
|
||||
|
||||
@@ -235,3 +235,17 @@ and its test that a list with nothing running says which books wait for an upgra
|
||||
`a_command_racing_the_apps_start_joins_the_app`,
|
||||
`two_commands_at_once_with_nothing_running_both_do_their_work`,
|
||||
`a_bridge_that_held_a_host_follows_the_app_that_takes_its_place`).
|
||||
|
||||
**WB-app-6 A first run opens the Connect page once.** After a person makes or
|
||||
opens their first company, and the window's server says no assistant was ever
|
||||
connected (no key, no session, no web approval, none waiting, for any
|
||||
company), the window opens the Connect page by itself, once, with the tools on
|
||||
this computer first and the web below. It is remembered for the installation
|
||||
and never happens again, whatever is connected or revoked later; an
|
||||
installation that has an assistant never sees it. It is asked only after the
|
||||
server has answered, never from a guess, and not in a window that has no
|
||||
server.
|
||||
*Enforced:* `ledger_gui::app::App::first_connect`.
|
||||
*Checked:* `ledger-gui` `tests/web_connect.rs`
|
||||
(`the_connect_page_opens_by_itself_once_for_a_first_run`,
|
||||
`the_connect_page_does_not_open_when_it_was_shown_or_an_assistant_exists`).
|
||||
@@ -88,7 +88,7 @@ when it connected and last acted, and "Revoke", asked once, which calls what
|
||||
`wanderbooks token revoke` calls (the server ends the key and the sessions on
|
||||
it; its copy in the token file is removed). The window writes no books. The
|
||||
web half of the page (the switch, the address, the steps for Claude and
|
||||
ChatGPT) is plan unit B3's, and the "Claude desktop app" row (a one-click
|
||||
ChatGPT) is WB-assist-6's (plan unit B3), and the "Claude desktop app" row (a one-click
|
||||
extension) is unit C1's. What unit B1 puts in `connect::State::web_section` is
|
||||
the question to the person when a web assistant asks to connect (WB-remote-5):
|
||||
a card that says who is asking, where it is sent back to, the address it asked
|
||||
@@ -126,3 +126,32 @@ SCENARIOS:
|
||||
|
||||
*Enforced:* `first_tools_lead`, `connect_text`, `list_tools` (the server's `BooksServer`).
|
||||
*Checked:* `ledger-mcp` unit test `the_company_and_the_entry_point_are_in_the_first_tools_too`.
|
||||
|
||||
**WB-assist-6 The Connect page's web half turns web assistants on and says, in
|
||||
plain words, how far it has got and what to do.** Under "On the web" the page
|
||||
has a switch "Allow web assistants" for the company, off by default; off, it
|
||||
says nothing on this computer can be reached from the internet, and that
|
||||
turning it on again gives the same address if one was kept. On, it tells the
|
||||
progress in three lines (getting an address, getting a certificate, connected)
|
||||
with a spinner on the one under way, then the address an assistant is given
|
||||
for this company with a Copy button, and the steps. The steps for Claude on the
|
||||
web are three, the ones the plan stands behind (Settings, then Connectors; Add
|
||||
custom connector, paste the address; sign in, and match the code in this
|
||||
window before choosing Allow). For ChatGPT, and for any other assistant, the
|
||||
page says "we haven't tested this yet" and gives no steps: the plan records
|
||||
that OpenAI's two pages disagree, and a step nobody tried is not written. A
|
||||
problem is in words: one that mends itself (no internet, the relay down or
|
||||
busy, a certificate not yet got) says the window and the assistants on this
|
||||
computer are not affected and that it keeps trying; one that needs the person
|
||||
(a wrong clock, a lost address) says what to do. "Get a new address" asks
|
||||
first: the old address stops working at once and every assistant connected
|
||||
through it has to be connected again. The switch is the owner's: the page
|
||||
only asks it. The word "MCP" is nowhere on the page.
|
||||
*Enforced:* `ledger_gui::connect::State::web_section`, `claude_steps`,
|
||||
`web_progress`, `web_state`.
|
||||
*Checked:* `ledger-gui` `tests/web_connect.rs`
|
||||
(`the_switch_is_off_by_default_and_an_owner_without_web_assistants_has_none`,
|
||||
`turning_it_on_shows_progress_then_the_address_the_steps_and_what_was_not_tried`,
|
||||
`the_progress_steps_are_in_order`,
|
||||
`what_goes_wrong_is_in_words_and_says_what_is_not_affected`,
|
||||
`off_and_a_new_address_go_through_the_owner_and_a_new_one_is_asked_twice`).
|
||||
@@ -0,0 +1,215 @@
|
||||
# Claims: the link
|
||||
|
||||
The product rules of the app's side of the relay (plan P15, unit B3;
|
||||
decisions D-80, D-82, D-85, D-87 in `plan/p15-app-and-relay.md`). No authority
|
||||
states them: they are wanderbooks' own (`WB-link-<n>`). The code is the crate
|
||||
`crates/ledger-link` (the app's identity, line and TLS and certificates) and,
|
||||
joining it to the books server's remote door, `crates/ledger-host/src/web.rs`.
|
||||
The relay itself is `crates/relay` (`relay.md`); the remote door and its
|
||||
sign-in are `remote.md`.
|
||||
|
||||
Rules: none from bookspec.
|
||||
|
||||
---
|
||||
|
||||
## Product rules
|
||||
|
||||
**WB-link-1** An installation has one durable address, `https://<secret>.<four-words>.wanderbooks.link`, and its key never leaves the machine.
|
||||
|
||||
```text
|
||||
GOAL: a person has one address that is the same every time web assistants
|
||||
are turned on, that nobody can list or guess, and a key the relay is
|
||||
only ever sent the public half of; and can have a new address, after
|
||||
which the old one stops working.
|
||||
SOURCE: D-82, D-85, D-87 in plan/p15-app-and-relay.md; section 5 ("Names":
|
||||
one name per installation, each company a path under it; the secret
|
||||
label stops listing and guessing); the relay's own rule (WB-relay-3:
|
||||
a label is 25 to 63 characters of a-z and 0-9).
|
||||
INVARIANTS:
|
||||
1. The name is four words from the relay's list, picked by the app and
|
||||
kept; the relay claims it for the app's key at the first line.
|
||||
2. The secret label is 32 random characters of a-z and 0-9, about 165
|
||||
bits (128 are needed), made by rejection sampling.
|
||||
3. The key (Ed25519), the label and the certificate's key are in the
|
||||
data root's private link folder: owner-only files (0600 on Unix, the
|
||||
owner-only access list the token files use on Windows), written whole
|
||||
or not at all.
|
||||
4. A new address replaces the label at once and the old host name is no
|
||||
longer given a certificate; if the relay has lost the name, a whole new
|
||||
identity is made.
|
||||
5. No key, label or token is in a log, an error, a status's debug text or
|
||||
a test's output.
|
||||
SCENARIOS:
|
||||
1. The first turn-on makes an address; off and on again, and a restart of
|
||||
the app, give the same one, and the name is claimed once.
|
||||
2. A new address differs in its label only; the old one gets no TLS.
|
||||
3. A damaged identity file is an error in words and is never overwritten.
|
||||
```
|
||||
|
||||
*Enforced:* `Identity::load_or_create`, `Identity::new_label`, `Identity::reset`, `new_label`, `write` (module `private`, crate `ledger-link`).
|
||||
*Checked:* `ledger-link` `tests/link.rs` (`the_key_the_certificate_and_the_label_are_private`, `a_new_address_stops_the_old_one`, `off_closes_the_line_and_the_address_is_the_same_on_again_and_after_a_restart`, `a_relay_that_lost_the_name_says_so_and_a_new_address_carries_on`) and unit tests in `src/identity.rs` and `src/private.rs`.
|
||||
|
||||
**WB-link-2** The app holds one outbound line to the relay and keeps it, by itself, through anything.
|
||||
|
||||
```text
|
||||
GOAL: the line comes back after the network drops, the relay restarts, the
|
||||
relay is down for a while or the computer sleeps and wakes on another
|
||||
network, never spins hot against a relay that is down, and ends when
|
||||
it is told to or when the app does.
|
||||
SOURCE: plan/p15-app-and-relay.md section 6a ("Unit B3's duties: ping at
|
||||
least every 60 s (a line silent for 180 s is dropped); ... a yamux
|
||||
stream limit at least the relay's"); D-80; WB-relay-2 (the proof
|
||||
that is signed for each session).
|
||||
INVARIANTS:
|
||||
1. The line is yamux over TLS 1.3 to the relay, proved with the app's key
|
||||
over that session (the relay crate's own client); the line runs in the
|
||||
app's own process and ends with it, so it can never keep a door open for
|
||||
books that closed.
|
||||
2. A failed dial waits a growing, jittered time (at most five minutes);
|
||||
a nudge or a held line starts it again.
|
||||
3. The line is pinged every 30 seconds and a ping not answered in 15
|
||||
ends it and a new one is made.
|
||||
4. A wall-clock step much longer than the time that passed (a sleep) ends
|
||||
the line and dials again at once.
|
||||
5. The line offers the relay more streams than the relay's limits need.
|
||||
SCENARIOS:
|
||||
1. The relay drops the line; the app dials again and the same name is
|
||||
served, with no new claim.
|
||||
2. An idle line, pinged, outlives several of the relay's silence limits;
|
||||
without pings the relay drops it and the app dials again.
|
||||
3. A relay that is not there is dialled with a backoff, not in a loop.
|
||||
```
|
||||
|
||||
*Enforced:* `Backoff`, `WakeDetector`, `Timing` (module `line`) and `Inner::hold` and `Inner::line_loop` (module `link`), crate `ledger-link`.
|
||||
*Checked:* `ledger-link` `tests/link.rs` (`the_line_comes_back_after_the_relay_drops_it`, `pings_keep_an_idle_line_and_silence_loses_it`, `an_unreachable_relay_says_so_in_words_and_recovers_by_itself`) and unit tests in `src/line.rs` (`the_backoff_grows_stays_under_its_ceiling_and_resets`, `a_wall_clock_jump_with_no_monotonic_jump_is_a_sleep`).
|
||||
|
||||
**WB-link-3** The app ends the web caller's TLS itself, with its own certificate, and hands the plain stream to the remote door after the secret and the relay's header.
|
||||
|
||||
```text
|
||||
GOAL: what the relay forwards is TLS it cannot read; the app decrypts it
|
||||
with a key that never left the machine, for the app's own host name
|
||||
only; and the remote door can tell the connection came from the app's
|
||||
line and whose address the caller has.
|
||||
SOURCE: D-80 (encrypted end to end), plan/p15-app-and-relay.md section 4
|
||||
rule 8 (the per-start secret, then the PROXY header); WB-remote-1;
|
||||
WB-relay-6.
|
||||
INVARIANTS:
|
||||
1. TLS (1.3 and 1.2, with HTTP/2 or HTTP/1.1 by ALPN) is ended with the
|
||||
certificate the app holds, and only for the exact host name of its
|
||||
address: any other name, the apex and a stranger's guess get no
|
||||
certificate.
|
||||
2. The first 64 bytes of every connection to the door are the door's
|
||||
per-start secret as given, then the relay's PROXY version 2 header,
|
||||
then the caller's plain bytes; the door is on 127.0.0.1 only.
|
||||
3. At most 16 callers are served at once, and a caller whose handshake
|
||||
does not finish in time is dropped; with no door, a caller is turned
|
||||
away at once.
|
||||
4. Nothing the relay could use to read traffic leaves the machine.
|
||||
SCENARIOS:
|
||||
1. A caller's TLS through the relay reaches a stand-in door, which is
|
||||
given the secret first, then the caller's address as the relay saw
|
||||
it, then plain HTTP; what crossed the relay holds neither the
|
||||
request, the reply, the secret nor any key.
|
||||
2. With no door the caller's connection ends; with it back, it works.
|
||||
```
|
||||
|
||||
*Enforced:* `Resolver`, `server_config` (module `certs`) and `Inner::serve_caller` (module `link`), crate `ledger-link`.
|
||||
*Checked:* `ledger-link` `tests/link.rs` (`a_caller_through_the_relay_reaches_the_door_and_the_relay_sees_only_ciphertext`, `a_stalled_handshake_is_dropped_and_no_door_means_no_service`) and `ledger-cli` `tests/web_link.rs` (`a_web_assistant_signs_in_through_the_relay_and_reads_the_books`).
|
||||
|
||||
**WB-link-4** The app's certificate is its own, from the authority the relay lists, kept across restarts and renewed ahead of expiry.
|
||||
|
||||
```text
|
||||
GOAL: a certificate for the app's own name, ordered with a key made here,
|
||||
kept so a restart orders nothing, renewed when the authority says (or
|
||||
two thirds through its life), from whichever authority the relay lists
|
||||
so a swap needs no release.
|
||||
SOURCE: D-87, plan/p15-app-and-relay.md section 5 ("Authorities are data,
|
||||
not code"; the proof record is published by the relay for the app's
|
||||
own name); RFC 8555 (ACME, DNS-01, external account binding);
|
||||
RFC 9773 (renewal information).
|
||||
INVARIANTS:
|
||||
1. The order is for the wildcard under the app's name; the proof goes to
|
||||
the relay over the app's own line and is cleared afterwards; the app
|
||||
gives an authority no contact.
|
||||
2. The authorities are the relay's list, in its order; one marked not
|
||||
usable is skipped; a failure falls to the next; all failing is a
|
||||
state in words, retried with a growing, jittered wait while the line
|
||||
stays up.
|
||||
3. The certificate and its key are kept in one private file and read at
|
||||
start; a certificate for another name, or one that does not parse, is
|
||||
ordered again.
|
||||
4. Renewal is at the time the authority's renewal information suggests
|
||||
(asked again from time to time), else two thirds through the life,
|
||||
naming the certificate it replaces; the certificate in use serves
|
||||
until it ends if a renewal fails.
|
||||
5. An account binding is sent only when the relay gave one for this app.
|
||||
SCENARIOS:
|
||||
1. Order, store, reuse across a restart: one order in all.
|
||||
2. The renewal window opens: a second order names the first.
|
||||
3. The first authority fails and the second issues; one needing a binding
|
||||
the relay has none for is never asked.
|
||||
4. Every authority failing says so in words and mends when one works.
|
||||
```
|
||||
|
||||
*Enforced:* `StoredCert`, `CertStore`, `default_renewal` (module `certs`), `AcmeIssuer` (module `acme`), `Inner::cert_loop` and `Inner::order` (module `link`), crate `ledger-link`.
|
||||
*Checked:* `ledger-link` `tests/link.rs` (`the_first_authority_fails_and_the_second_issues`, `an_authority_that_is_not_usable_is_skipped`, `every_authority_failing_is_said_and_retried_until_one_works`, `the_certificate_is_renewed_at_the_authoritys_suggested_time`, `without_renewal_information_it_renews_two_thirds_through`) and `tests/acme.rs` (`an_order_goes_through_account_proof_finalize_and_download`, `a_renewal_reuses_the_account_names_what_it_replaces_and_reads_the_window`, `a_binding_is_sent_when_there_is_one_and_never_invented`, `a_refusal_comes_back_in_the_authoritys_words`).
|
||||
|
||||
**WB-link-5** Every state of the link ends in plain words and mends by itself.
|
||||
|
||||
```text
|
||||
GOAL: no network, a relay that is down or busy, an authority that is
|
||||
rate-limited, a clock that is wrong, a laptop that slept: each is said
|
||||
in words a person can use, says what is not affected, and recovers
|
||||
without the person unless it needs them.
|
||||
SOURCE: plan/p15-app-and-relay.md 3.3 ("progress in plain words ... the
|
||||
state when the relay cannot be reached, in words, with nothing lost
|
||||
locally").
|
||||
INVARIANTS:
|
||||
1. One place makes the words (`Trouble::words`, `LinkStatus::words`); a
|
||||
trouble that mends itself says it keeps trying and that the local
|
||||
assistants still work; one that needs the person says what to do.
|
||||
2. A relay certificate that has ended or not begun is a wrong clock, not
|
||||
a relay that is down.
|
||||
3. A name that does not resolve is no internet; an unanswered relay is
|
||||
the relay down; a relay that does not know the name is the name lost,
|
||||
and a new address makes a new identity.
|
||||
4. The link's state is read from memory and never waits; the window and
|
||||
the local assistants never depend on the network.
|
||||
SCENARIOS:
|
||||
1. Each trouble has words; the mending ones say so.
|
||||
2. A relay that is not there is "can't reach its relay ... keeps
|
||||
trying", and the link connects when it is.
|
||||
3. A name that cannot be resolved is no internet; an expired relay
|
||||
certificate is a wrong clock.
|
||||
```
|
||||
|
||||
*Enforced:* `Trouble`, `LinkStatus`, `Step` (module `status`), `trouble_of_io`, `trouble_of_refusal` (module `line`), crate `ledger-link`.
|
||||
*Checked:* `ledger-link` `tests/link.rs` (`an_unreachable_relay_says_so_in_words_and_recovers_by_itself`, `no_internet_is_said_as_that`, `a_wrong_clock_is_said_as_that`) and unit tests in `src/status.rs` and `src/line.rs` (`errors_read_as_the_right_trouble`).
|
||||
|
||||
**WB-link-6** Web assistants are on per company, off by default, and the line and the door are open only while some company is on.
|
||||
|
||||
```text
|
||||
GOAL: nothing is dialled, listened on or offered until a person turns a
|
||||
company on; turning it off closes the line and the door and keeps the
|
||||
address; what was on when the app closed is on again at the next
|
||||
start.
|
||||
SOURCE: plan/p15-app-and-relay.md 3.3 ("Allow web assistants" per company,
|
||||
off by default; "Turning it off closes the line and the door; the
|
||||
name is kept"), section 5 (one name per installation); D-84.
|
||||
INVARIANTS:
|
||||
1. Turning on starts the door (127.0.0.1) as the app's one address and
|
||||
offers the company; turning off withdraws the company and, with none
|
||||
left, closes the line and then the door.
|
||||
2. A new address restarts the door at the new address: every token and
|
||||
sign-in made at the old one is refused.
|
||||
3. The switches are kept in a private file and put back for the
|
||||
companies that are open; a failure at any step leaves nothing
|
||||
half-on.
|
||||
SCENARIOS:
|
||||
1. On, a web assistant signs in through the relay and reads the books;
|
||||
off, the line and the door are gone and the address is kept; on again,
|
||||
the same address; a new address, and the old one is refused.
|
||||
```
|
||||
|
||||
*Enforced:* `WebAssistants` (`turn_on`, `turn_off`, `new_address`, `restore`) in `crates/ledger-host/src/web.rs`.
|
||||
*Checked:* `ledger-cli` `tests/web_link.rs` (`a_web_assistant_signs_in_through_the_relay_and_reads_the_books`, `off_closes_the_line_and_the_door_and_on_again_is_the_same_address`, `a_new_address_refuses_what_the_old_one_signed_in`, `the_switches_are_put_back_at_the_next_start`).
|
||||
Reference in new issue
Block a user