Add a Host trait and move DB/model commands off Tauri

Command handlers took Tauri types, so running them anywhere else meant
rewriting them. `yaak_commands::Host` is what a handler actually needs
from its surroundings: who the client is, what it's looking at, and the
shared managers. Handlers are generic over it and keep the router's
shape, so another host registers one with rpc_handler_async! and no
adapter at all.

28 commands move: models, deletes, response reads, encryption, plugin
info, export. ClientCtx implements Host, so the desktop adapters are one
line and behavior is unchanged.

PluginHost is separate because PluginManager is "spawn a Node sidecar
and talk to it" — a browser host runs plugins in a worker and can't hand
one back. Only 4 of the 28 need it; the rest work without a plugin
runtime, and the compiler says which is which.

Also drops yaak_core::AppContext, an earlier sketch of this that was
never implemented.
This commit is contained in:
Gregory Schier
2026-08-16 07:07:55 -07:00
parent 32e92d484b
commit 57d55e1eed
24 changed files with 848 additions and 518 deletions
+2
View File
@@ -2,6 +2,7 @@
resolver = "2"
members = [
"crates/yaak",
"crates/yaak-commands",
# Common/foundation crates
"crates/common/yaak-database",
"crates/common/yaak-rpc",
@@ -69,6 +70,7 @@ yaak-rpc-schema = { path = "crates/common/yaak-rpc-schema" }
# Internal crates - shared
yaak-core = { path = "crates/yaak-core" }
yaak = { path = "crates/yaak" }
yaak-commands = { path = "crates/yaak-commands" }
yaak-common = { path = "crates/yaak-common" }
yaak-crypto = { path = "crates/yaak-crypto" }
yaak-git = { path = "crates/yaak-git" }