Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

Merge pull request #2401 from atomantic/claim/issue-2389

[._.]/ Adam Eivybcb1d1571862
diff --cc .changelog/NEXT.md
index 894d877075,d5e0639b74..c3b02f3f44
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@@ -95,6 -81,6 +95,8 @@@
- **Rounds and Music Video can now turn a reference audio file into MIDI locally via MuScriptor.** MuScriptor (github.com/muscriptor/muscriptor) is a multi-instrument audio → MIDI transcription model that runs in an opt-in venv (`INSTALL_MUSCRIPTOR=1 bash scripts/setup-image-video.sh`, weights auto-download from HuggingFace on first use; small/medium/large tiers). A new shared service (`server/services/audioMidiTranscription.js` + the `scripts/transcribe_muscriptor.py` sidecar, same STAGE:/RESULT: wire protocol as the music-gen sidecars) exposes the kickoff/SSE/cancel job shape in both features: a Rounds reference with attached audio gains a **Transcribe MIDI** control (the resulting `.mid` lands as `references[].midiFilename` on Save, cleared with the audio like segments), and a Music Video project gains a **MIDI** toolbar button + download link (`project.midiTranscription` is persisted server-side on completion and invalidated when the audio source changes, exactly like `audioAnalysis`). When the venv isn't provisioned the kickoff 503s with the install hint instead of a bare spawn error.
- **[issue-2386] ffmpeg render errors are now separated into pre-spawn and post-spawn, so a failed kill can no longer let a replacement render overlap the live process.** The music-video and timeline renderers both routed every `'error'` event through the same immediate finalizer — which released the per-project render mutex and dropped process ownership. But `'error'` fires for two very different cases: a genuine pre-spawn failure (ENOENT — the child never started, no `'close'` follows) and a *later* child-process error such as a failed kill while ffmpeg is still running. Releasing the mutex on the latter let a re-render spawn and overlap the still-live ffmpeg. Both services now track spawn state (a `'spawn'` listener sets a flag) and finalize immediately only for pre-spawn errors; a post-spawn error is recorded but retains process + project-mutex ownership until the pending `'close'` runs the sole terminal finalization. A shared `terminal` guard makes terminal handling exactly-once across the error and close paths, and both handlers wrap their body per the child-process-callback convention. Covered by new error-to-close sequence tests before and after spawn in both services.
+- **[issue-2385] Digital Twin evaluation suites now distinguish a load failure from a genuinely empty suite.** Values-Alignment (and its sibling Adversarial-Boundary / Multi-Turn panels, which share the same hook) caught a failed suite load with `.catch(() => [])`, so a server/network error rendered the same "No suite found" empty state as an install that legitimately has no `VALUES_ALIGNMENT_SUITE.md`. The shared `useTwinEvaluationSuite` hook now uses a `null` sentinel for a failed tests-load (distinct from `[]` = successfully-loaded-but-empty) and exposes a `loadError`; `TwinEvaluationSuitePanel` renders an explicit inline load-error state with a **Retry** button that re-runs the load — while the true empty state stays distinct. Feedback stays non-duplicative (inline only, load calls remain `silent`, no toast). History remains secondary: a failed history load degrades to no history without blocking the panel. Covered by new hook tests (failure vs empty vs history-only failure vs reload recovery) and a component test asserting both the load-error/Retry render and the empty-response render.
+- **[issue-2398] Extracted the shared ffmpeg spawn-state/terminal-guard block behind one helper.** After #2386, the ~25-line spawn-state tracking + exactly-once `terminal` guard + pre-vs-post-spawn error dispatch was byte-for-byte parallel in the music-video (`server/services/musicVideo/render.js`) and timeline (`server/services/videoTimeline/local.js`) renderers. Both now call a single `attachFfmpegRenderGuard(proc, { label, onSpawnError, onProcessError, onClose })` helper (`server/lib/ffmpegRenderGuard.js`, barreled + documented) that owns the `'spawn'`/`'error'`/`'close'` wiring — only the pre-spawn `'error'` or `'close'` finalizes; a post-spawn `'error'` records the reason and retains process + mutex ownership — and takes the service-specific finalize bodies as callbacks (music-video mutates the project's render status; timeline does not). Behavior is unchanged — all 42 existing terminal-guard sequence tests still pass — with a new unit test covering the exactly-once dispatch and crash-guard directly. No behavior change.
- **[issue-2375] Split the ~1,380-line `server/routes/apps.js` into domain-focused sub-routers.** The single apps router (24+ endpoints spanning CRUD/status enrichment, PM2 lifecycle, config repair, Xcode provisioning, icon serving, task-type overrides, document git-commits, editor/folder launch, and agent history) is now assembled from nine mountable sub-routers under `server/routes/apps/` (`crud`, `lifecycle`, `viteTls`, `xcode`, `icons`, `taskTypes`, `launch`, `documents`, `agents`), mirroring the pipeline sub-router pattern. Shared plumbing (`loadApp` middleware, `pathExists`, and the port/overall-status derivation helpers previously duplicated between the list and detail endpoints) lives in one `apps/shared.js`, and the ~130-line ecosystem-config port-rewrite orchestration moved out of the PUT handler into a `server/services/appPortConfig.js` service. The `/api/apps` route contract is byte-for-byte identical (all 35 path+method pairs verified) and the oversized route test file is split along the same domain boundaries. No behavior change.
+
+ - **[issue-2389] The Sharing page's per-bucket detail tab (Inbox / Activity / Settings) is now URL-derived and history-safe.** The sub-tab was held in component-local `useState('inbox')`, so it wasn't deep-linkable and browser back/forward could disagree with the visible tab. It now derives from a validated `?tab=` search param via `useDrawerTab('tab', 'inbox', BUCKET_TAB_IDS)` — a direct link opens the named tab, a stale/hand-edited value degrades to Inbox, and switching buckets (a fresh route without the query) resets to Inbox. New render tests cover the direct-link, invalid-fallback, and back/forward cases.