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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
docs: changelog entry for meatspace + videoGen decomposition (#1833)
[._.]/ Adam Eivy729458613529
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex db13efc0ec..63e637a63f 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -25,6 +25,7 @@## Internal+- **Decomposed two remaining large files: `server/routes/meatspace.js` + `server/services/videoGen/local.js`** — the 1,069-line `meatspace.js` router (14 health sub-domains, each backed by its own service import) is split one concern per file (`meatspaceCoreRoutes.js` overview/config/birth-date/death-clock/LEV, `meatspaceAlcoholRoutes.js`, `meatspaceNicotineRoutes.js`, `meatspaceHealthRoutes.js` blood/body/BP/workouts/epigenetic/eyes, `meatspacePostRoutes.js` POST drills + training + memory builder, `meatspaceCalendarRoutes.js` life calendar/activities/events, `meatspaceExportRoutes.js` MortalLoom export), assembled by a thin `meatspace.js` barrel that mounts each under `/api/meatspace` — the same pattern `routes/cos.js`/`routes/brain.js` use; the split is wiring-only (the 70-route surface is byte-identical, verified). The 1,805-line `videoGen/local.js` had its BYOV runtime management (venv/helper-script path constants, `BYOV_RUNTIME_INFO`, install/ready/fingerprint probes) extracted to `videoGen/runtimes.js` and its render-history I/O (`loadHistory`/`saveHistory`) to `videoGen/history.js`; `local.js` keeps generation + post-processing and re-exports the extracted surface so every existing deep import (`from '../videoGen/local.js'`) keeps resolving unchanged (all 30 prior exports preserved, verified). (#1833)- **Decomposed `server/routes/brain.js` (1,149-line router covering 13 sub-domains)** — the monolithic Brain router that mixed capture/inbox, four entity CRUD collections + memories, digest/review, settings/summary, links + buckets, graph, federation sync, and the daily log is now split one concern per file (`brainCapture.js`, `brainCrud.js`, `brainDigest.js`, `brainSettings.js`, `brainLinks.js`, `brainGraph.js`, `brainSync.js`, `brainDailyLog.js`), assembled by a thin `brain.js` barrel that mounts each sub-router under `/api/brain` — the same pattern `routes/cos.js` already uses. The split is wiring-only: route paths, ordering (literal-before-`:id` routes stay within their owning sub-router), validation, and the barrel's default export are unchanged, so `server/index.js` and the existing `brain.test.js` (105 tests) pass without edits. (#1832)- **Split `server/lib/validation.js` (1,897-line multi-domain Zod barrel)** — the catch-all schema file that mixed 15+ unrelated domains is decomposed (continuing the #1151 `peerSyncValidation.js`/`creativeDirectorValidation.js` precedent) into four per-domain files: `agentValidation.js` (social-bot agent personality, Moltbook/Moltworld accounts, automation schedules, agent tools + Moltworld payloads, CoS Feature Agents), `cosValidation.js` (CoS tasks/jobs/loops/learning, the Review-Loop reviewer vocabulary + `normalizeReviewers`/`buildReviewWithArgs`, the Code-Review settings slice, and the task-metadata sanitizer), `mediaValidation.js` (LoRA training, local-LLM/Ollama/LM Studio management, CyberCity snapshots, media-collection bulk ops), and `pipelineValidation.js` (Writers Room, story-bible character/place/object, editorial checks, storyboard shots/scenes, prompt-stage config, issue-list query). `validation.js` (~550 lines) keeps the app/process/provider, social-account, GitHub, backup/sharing, and document/legacy-export core plus the `validateRequest`/`validate`/`parsePagination` helpers, and re-exports the four new files (flat) so every existing deep `import { x } from '../lib/validation.js'` callsite keeps working unchanged; the barrel surfaces each as a namespace export. The new domain files import only `zodCompat.js` + leaf constant modules (never back through `validation.js`), keeping the transitional re-export cycle-safe under ESM. (#1831)- **Decomposed `server/services/sharing/peerSync.js` (4,004-line god file mixing 3 sync protocols)** — the single module that inlined per-record subscription CRUD + the outbound push path (951-line region) + the receiver path (909-line region) + standalone media-library sync + CoS-history/tasks sync is now split into one concern per file: `peerSyncShared.js` (state machine, constants, peer-capability helpers, the cross-cutting event bus), `peerSyncAssets.js` (asset manifest build/diff/hash + the receiver-side asset-pull worker, reused by every receive path), `peerSyncPush.js` (the `pushRecordToPeer` pipeline + payload builder + schema-gate bookkeeping), `peerSyncReceive.js` (`applyIncomingPush` + reverse-subscribe + merge dispatch), `peerMediaLibrarySync.js` (#1566 media-library sweep), and `peerCosSync.js` (#1650 CoS history + tasks). `peerSync.js` (~985 lines) stays the orchestrator — subscription CRUD, the debounced push scheduler, the `recordEvents`/`peer:online` listeners, and the boot-time `registerSubscriptionAdapter` wiring — and re-exports the extracted modules' public surface so every existing importer (routes, `sharing/index.js`, `dataSync`, the test suite) keeps working unchanged. The leaf-`peerSyncShared` design keeps the only module cycle (`peerSync` ↔ `peerSyncReceive`, both call-time-only) safe under ESM. Verified behavior-preserving: the full server suite produces byte-identical pass/fail results before and after (zero regressions, 15,092 tests), the DB suite is 156/156 green, and the server smoke-boots cleanly. (#1830)