Local Weights · docs/MANAGER_ARCHITECTURE.md
Four layers, two hard boundaries. Below the UI boundary no Tauri type exists and progress flows as serializable data on per-operation channels. At the trust gate, profile operations receive an Arc<TrustedRegistry> as an argument — a type whose sole constructor is signature verification. The manager holds no registry state, no job registry, and no event bus: callers own tracking, the manager owns the work.
Layer 1 · consumers & adapters — presentation, consent, wording. No business logic.
Catalog, library, peers, consent dialogs, notifications.
Renders plans, progress, APPROVED/MANUAL, SIGNED badge. Owns all human-facing wording.
Owns LoadedRegistry + registry sync, the OperationId → CancellationToken map, and task handles. Forwards each operation's events → app.emit. Manual peer/ticket cmds stay unchanged.
Second consumer — keeps the boundary honest.
Plus weights join (invites) and weights scan-dir add/remove/list (custom scan folders). Loads the signed cache, constructs the same manager, owns one foreground OperationContext; Ctrl-C cancels it. May need the desktop app stopped to open the iroh store.
Layer 2 · orchestration — the one implementation of "install a profile".
Owns policy and sequencing, nothing else. Fields: data_dir · db · p2p — constructor-injected; no registry state, no job registry, no event bus, never reads UI state.
ProfileManager { data_dir, db, p2p } · plan(), acquire(), and the service lifecycle (install · start · stop · restart · status · uninstall) · DTOs (ProfilePlan, AcquisitionSource, AcquiredProfile, InstalledProfile) all Serialize.
Hardware facts → tier → source choice; local reuse short-circuit; LAN transfer with HF fallback; conservative disk math; verify (BLAKE3 + SHA-256) before exposure; .acquire.lock cross-process guard; record into db; cancellation checked between stages.
id + CancellationToken + mpsc::UnboundedSender. Caller creates and tracks it; manager honors it. Cooperative cancel leaves resumable .part/iroh state and returns Cancelled.
ManagerEvent: Clone + Serialize, operation id + profile on every event. Sent through the caller's channel — no bus, no replay, no subscribers.
mod.rs + launchd.rs + systemd.rs — both service backends shipped for the macOS and Strix Halo targets. Verified artifacts (archive + binary hashes, symlink-safe extraction), clone/hardlink materialization, exact argv + constructed env, install/uninstall, health as identity (/props must report the managed model), repair data.
Serializable thiserror enum, tag = "code": ProfileNotFound · UnsupportedHardware{detected_gib, minimum_gib} · InsufficientDisk{req, avail} · MissingCredentials · AlreadyAcquiring · ProfileNotInstalled · Service · RuntimeArtifact{Missing, HashMismatch} · RuntimeUnhealthy · Cancelled · Internal · … — data, not UX copy.
Layer 3 · primitives — mechanism, no policy. Neither crate knows the manager exists.
Identity, verification, storage, file mechanics.
Verified transfer. BLAKE3 is the only identity on the wire.
Layer 4 · the world — everything the system talks to but does not contain.
release.json + registry.json. Any https host or local path; trust is the Ed25519 key, never the host. Rollback-protected by version.
Fallback weight source at pinned revisions (Range resume, HF_TOKEN); runtime artifacts pinned by build ID, source revision, archive SHA-256, and binary SHA-256.
Other machines running Weights. Preferred byte source. Approval is receiver-side against each machine's own trusted registry.
~/.weights (state.db, trust.json, acquired/, blobs/, runtimes/, logs/) · app caches (HF, LM Studio, Ollama, llama.cpp) · launchd / systemd user services running llama-server.