Rust core vs TypeScript frontend split #3
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
needs-info
needs-triage
question
ready-for-agent
ready-for-human
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crowmaki/ai-studio#3
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #1
Question
Which responsibilities live in the Tauri Rust side (SQLite, render worker, ComfyUI client, file I/O, atlas composition, export) and which in SvelteKit/TS? What does the command/event boundary between them look like?
Resolution
Crates. A Cargo workspace:
studio-corehas no Tauri or specta dependency. It holds the domain model, SQLite, OSF import, Lock snapshot rules, staleness, Atlas composition, the prompt composer, the slot budget, the render queue and worker, the ComfyUI client, ffmpeg calls, and export (FCPXML, CSV, folder layout).src-tauriis a thin adapter.Database. Only Rust opens the
.studiofile. The frontend changes state only through named domain commands.Frontend. Svelte 5 holds view state, interaction, and the Board paint canvas, including its local stroke undo until a save.
Boundary.
taurpcprocedures for commands. DTOs are defined insrc-tauriand mapped fromstudio-coreview-shaped read models, so the core stays free of specta.changed { kind, ids }invalidation events, after which the UI refetches what it is showing.tauri::ipc::Channelfor per-job progress. Events stay app-wide broadcasts only.Undo. App-level undo is a Rust command log, per Project, kept in memory, and cleared when the Project closes. It covers authored edits only: merges, retags, Setup and Shot edits, Line ranges, circling, Board saves, and Location folders. Locking, queuing or rendering, generating, and importing media are append-only provenance and never undoable. Cancelling a queued or in-flight job is a separate, explicit queue command.
Media. One custom
studio:scheme, registered with the async variant:studio://blob/<id>serves blobs from SQLite.studio://rendition/<id>serves Renditions with Range/206 support, chunked.URLs carry ids, not paths, and the webview gets no file scope. Content-hash cache headers suit Atlases.
ffmpeg. An unmodified LGPL build ships as a Tauri sidecar and is called only by Rust. It handles posters and thumbnails, audio extraction and decoding, and remuxing. It never encodes Renditions; ComfyUI does that.
Pixels. Rust produces every stored or derived image, deterministic and byte-stable:
imagecrate.Sessions. One Project per process, with possibly several windows that all receive the same events. The core holds a single
ProjectSession(connection, undo stack, worker). The worker belongs to the session.Handed on:
Recorded as ADR-0003 (
docs/adr/0003-rust-core-owns-the-domain.md).Facts (Tauri 2.12):