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

docs: changelog for child-process helper convergence (#2392)

Adam Eivybf43656101ec
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 85fadf1c79..1d42bcfe5d 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -2,6 +2,8 @@
## Changes
+- **Duplicated child-process stream/discovery helpers converged into shared lib modules (#2392).** Three hand-copied "split a stdout/stderr chunk stream into lines with a carry buffer" implementations (`ytdlpAudioImport.js`, `videoDownload.js`, `hfDownload.js`) had already drifted — only hfDownload's copy flushed the final unterminated line. They now share `server/lib/streamLines.js#createLineReader(onLine, {splitRe?, maxCarry?})`, which carries the partial trailing line across chunks, exposes a `flush()` for the last newline-less line (so the two yt-dlp paths stop dropping it), clamps the carry buffer against a newline-less runaway stream, and takes a `splitRe: /[\r\n]+/` option for bare-`\r` torch/tqdm progress redraws. Separately, the inline `which`/`where` PATH probes in `ytdlp.js`, `ffmpeg.js` (×2), `pythonSetup.js`, and voice `bootstrap.js` are replaced by a single `whichFirst(name)` in `server/lib/processEnv.js` (Malloc-stripped env, 5s timeout, first-line result). The vendored `aiToolkit/providers.js` copy is intentionally left alone (self-contained by design). Behavior-preserving; both new helpers are unit-tested.
+
- **Runtime/venv install SSE flows now log to the server console too, matching the HF model-download logging (#2432).** The image/video/MuScriptor runtime installers (spawning `setup-image-video.sh`), the FLUX.2 venv bootstrap, and the local image-gen pip installer streamed multi-GB pip/git progress only to the browser via SSE — a headless / PM2 log had no record the install ever ran (the same gap `startHfDownloadStream` had already closed for HF model downloads). A new shared `createInstallLogger` chokepoint (`server/lib/installLogger.js`) now emits a single-line START, throttled heartbeats + `stage` milestones, and the OUTCOME (success/fail/cancel) with installer name, target, and elapsed time — without echoing every raw pip/bash line. Wired into all five install spawn sites in `music.js`, `videoGen.js`, `imageGen.js` (FLUX.2 venv + local pip install), and `midiRuntime.js`.
- **The four SSE job-slot hooks now share one implementation.** `useReferenceAudioImport`, `useYoutubeTrackImport`, `useVideoDownload`, and `useMidiTranscription` each hand-rolled the same "kick off a job → stream SSE progress → settle on the terminal frame, with double-click and lost-connection recovery" machinery. That logic now lives in exactly one place — a new generic `useSseJobSlot` hook — and the four feature hooks are thin wrappers that pass their own kickoff/SSE/cancel calls plus per-feature toast copy (and, for MuScriptor, its runtime-install and gated-repo modals). Behavior-preserving refactor deferred from the MuScriptor /simplify pass (#2368); ~150 fewer lines.