Conflicts were all at registration points; both sides are kept. Main now routes every write through one connection (#642): ClientDb only reads and writes go through `with_tx` on a WriteDb. Versioning follows: snapshot, restore, prune and the cascade delete move to WriteDb, while the lookups and the "has it changed" check stay on ClientDb. Callers take a write transaction the way their neighbours do: - The HTTP send snapshots in its own transaction from `resolve_send_inputs`, and a failure there (including not getting the writer) is still logged and swallowed, so the response just has no version. - gRPC and WebSocket connect snapshot inside the transaction that upserts the connection. - The snapshot and restore RPCs, on the desktop and in the browser host, each run in a transaction. - The request and workspace cascades live on main's WriteDb deletes. The Request Changed dropdown moves into the response pane's `statusLineRight` slot, since main moved the status line into the shared pane view. The plugin runtime's copy of the model bindings picks up `versionId`, and `gen_rpc.ts` is regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yaak-rpc-schema
The wire schema for the app's RPC surface: every command name, its request payload, and its response type, declared once.
Every host that serves the Yaak UI — the desktop app today, the browser bridge
and anything after it — imports these types and implements the commands against
them. That is what keeps a request's shape from drifting between hosts, and it
is why the TypeScript bindings (bindings/gen_rpc.ts, exposed to the frontend
as @yaakapp-internal/rpc-schema) are generated from one place.
Nothing here depends on Tauri or on any host. Request structs are plain data, and so are the few response types declared here rather than in an engine crate. Command bodies live with the host that runs them.
Adding a command
- Add its request struct and an entry in
with_commands!insrc/lib.rs. - Write the adapter in each host — the desktop's live in
crates-tauri/yaak-app-client/src/rpc_ext.rs. A host that does not support the command still has to say so; a missing adapter fails to compile. - Regenerate the bindings:
cargo test -p yaak-rpc-schemawritesbindings/gen_rpc.ts, which is committed.
How hosts consume the list
with_commands! takes the name of a macro_rules! macro and calls it with the
full name(Req) -> Res list. Each host writes a small macro that receives that
list and builds its router:
macro_rules! register_commands {
( $( $name:ident ( $req:ty ) -> $res:ty ),* $(,)? ) => {
pub fn build_router() -> RpcRouter<MyCtx> {
let mut router = RpcRouter::new();
$( router.register(stringify!($name), rpc_handler_async!($name)); )*
router
}
};
}
yaak_rpc_schema::with_commands!(register_commands);
The schema decides what commands exist; the host decides how each one runs.