P1f: self-contained Tauri host; complete P1

This commit is contained in:
Emil
2026-11-01 01:57:30 +03:00
parent 9d84c2f162
commit 9add2610d7
13 changed files with 1610 additions and 603 deletions
+32
View File
@@ -200,3 +200,35 @@ The snapshot carries the cores' cuts, not the audio; the audio is still content-
- Imports are not undoable; the history is snapshots, not the complete journal.
- The cap is 64 edits; older history is dropped.
- Corrupt history JSON is ignored with a warning and an empty stack.
---
# P1f · the host inside Tauri
The native window is now self-contained.
## Shape
- `crates/zhila-daemon` became a library (`zhila_daemon::run(HostConfig)`) plus the thin daemon binary. `HostConfig` is port, token, no_audio and project.
- `app/src-tauri` depends on the daemon library. On start it spawns one thread with a current-thread Tokio runtime and calls `run`; the Tauri window runs on the main thread. The engine, session, SQLite store, assets and WebSocket server live in the app process.
- The embedded Svelte surface talks to `ws://127.0.0.1:4317` exactly as the browser does; the token is `dev`, the project is the default one.
- The standalone daemon still exists for browser-first development; the two cannot share port 4317.
## Verification
- `cd app && ./node_modules/.bin/tauri build --no-bundle` builds `zhila-app` with the host; the release build passes.
- The standalone daemon was stopped; `ss -ltnp` shows `zhila-app` owning `127.0.0.1:4317`.
- The app log shows `project loaded ... descent-04`, the audio device, and `wire opened ... client=zhila-ui`; the window shows `engine live`, the project name, the 2 cores and the pattern.
- Screenshot: `preview-p1-tauri-host.png`.
- Final P1 checks: `./scripts/check.sh`, `node scripts/persistence-smoke.mjs` (manual cut + undo + redo across a daemon restart), the browser smokes.
## Limits
- The app uses the development token and the default project; no first-run project picker.
- The app and the browser daemon contend for 4317.
- WebKitGTK microphone permission for recording is not verified on this machine.
- Installers (deb/AppImage) are still not built; the binary is the deliverable.
## P1 acceptance
The "first playing loop" is reachable end-to-end: import or record → sixteen faces, cut and trimmed by hand → assign to a vein → pattern plays → save/load, undo/redo across restarts → the same material and history in the self-contained native app.