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
Merge remote-tracking branch 'origin/main' into pr-560
[._.]/ Adam Eivy5585c6d52945
diff --cc .changelog/NEXT.mdindex d8347974fa,7e6946b191..a509482366--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@@ -15,8 -16,7 +16,8 @@@- **[catalog-federation-orchestrator] The creative catalog now auto-replicates between peers.** The catalog sync routes existed but nothing pulled from peers — orphan ingredients (ideas / scenes / concepts not attached to a universe) and the universe→ingredient ref links stayed local. The sync orchestrator now runs `catalog` as a delta-based PostgreSQL category alongside Memory: on every peer-online event and on the background interval it pulls `GET /api/catalog/sync` (the seven independent per-kind BIGSERIAL cursors: scraps / ingredients / sources / refs / relations / tags / media) and applies each batch locally with the same last-writer-wins + per-row isolation + schema-version gate as direct sync. A peer ahead on the `catalog` schema records a gap on the Instances page (the existing SchemaGapBadge) and pauses draining instead of looping. Toggle it per peer under Instances → Sync Categories → "Catalog"; Postgres-only (a non-Postgres peer simply never enables it).- **[catalog-bundled-universe-push] Universe peer-pushes now carry their catalog enrichments.** When peer A pushes a universe to peer B, the push bundles the `catalog_ingredients` rows referenced by that universe's canon plus the universe→ingredient ref links. Previously only the embedded canon replicated, so the receiver re-derived a strictly-lossy view on first backfill — the `tags`, vector `embedding`, and `payload.summary`-style enrichments that live only in the catalog row were dropped. The bundle ships the full enriched rows (including tombstoned ref rows so unlinks propagate), applied through the same catalog-sync path; it rides only universe pushes (never series / mediaCollection), skips tombstone pushes, and is gated by `PORTOS_SCHEMA_VERSIONS.catalog` so a receiver on an older catalog schema rejects a forward-shaped bundle with a clean 409 rather than corrupting local rows. Postgres-only and best-effort — a bundle failure never fails the universe push.+- **[catalog-character-sheet-enrichment] The Catalog character detail page is now a full editable character sheet, and backfilled rows get friendly universe tags.** Opening a `character` ingredient (e.g. `/catalog/character/cat-chr-…`) now shows grouped DnD-style sheet sections — Identity, Appearance, Personality & Voice, Goals & Drives, Background & Relationships, Notes — exposing every enriched canon scalar field the Universe Builder already tracks (role/archetype, pronouns, age, core theme, physical description, visual/silhouette/posture notes, special traits, personality, mannerisms, speech accent/pattern, motivations, likes, dislikes/fears, background, relationships, skills). Because the editor keys mirror `sanitizeCharacter` exactly, an edit on the Catalog surface lands in the same payload field the Universe Builder canon surface reads — the two are the same durable row (linked by the embedded `ingredientId` + `catalog_ingredient_refs`). The catalog's enriched array fields (color palette swatches, stats, aliases) render read-only here (their structured per-item editors live in Universe Builder), and a new "Reference sheet" panel shows the rendered turnaround when one exists (`/data/image-refs/…`) or, when the character belongs to a universe, links straight to Universe Builder to render one from that universe's style data. Places and objects get the same grouped-section treatment. Migration: a one-time boot-time data repair rewrites the legacy machine tags backfilled rows carried (`from-universe`, `universe:<uuid>`) into the friendly universe NAME tag while preserving every user tag and the structured universe ref — marker-gated in `data/catalog-universe-tags.applied.json` and registered in the migration ledger as `053-catalog-friendly-universe-tags`; new bible→catalog promotions stamp the friendly name from the start. (The deeper unification — collapsing the embedded canon entry to a pure `ingredientId` projection so the catalog row is the single store of record — is scoped to follow.)-+ - **[catalog-source-kinds-url-file-voice] Catalog Ingest accepts URLs, text files, and voice memos — not just pasted text.** The `/catalog/ingest` paste box now sits behind a source picker: **URL** fetches the page through the browser service and extracts its main article text server-side (`source_kind: url`, metadata records the URL + fetched title); **File** reads a `.txt`/`.md` you pick and ingests it (`source_kind: file`, metadata records filename + mime); **Voice Memo** records from your mic, transcribes it with Whisper, persists the audio under `data/audio` to mint a `media_key`, and ingests the transcript (`source_kind: voice-memo`, metadata records the audio key so a later commit can attach it via the media-refs table). Every source funnels into the same extract → review → commit flow and streams the same `catalog:extract:progress` stage checklist as a paste. No DB migration or sync-version bump — `catalog_scraps.source_kind` was already a free `VARCHAR(32)` and the sync envelope already accepts any value, so the new kinds federate to peers as-is. PDF text extraction is intentionally deferred (no in-tree PDF-text dependency); picking a `.pdf` surfaces a clear "paste the text instead" message.- **[catalog-ingredient-media-refs] Catalog ingredients can now carry typed media attachments — a portrait, mood/reference images, and more.** A new "Media" panel on each ingredient detail page lets you set one portrait (rendered large at the head) and attach additional reference images, scoped to your existing media gallery via a "Pick from gallery" picker or by dragging a gallery image onto the panel. Each attachment stores a `media_key` *reference* into your media library (the bytes are never duplicated into the catalog), so a federated peer that receives an ingredient gets its media-key list and matches it against its own library — keys whose asset hasn't arrived yet show a "missing" badge (via the same syncing-asset surface used elsewhere) instead of a broken image. Backed by a new `catalog_ingredient_media` Postgres table (kinds: portrait / reference / audio / video / document) with soft-delete tombstones from day one, so detaches propagate to peers; the rows ride the catalog sync envelope as a new `media` block (`PORTOS_SCHEMA_VERSIONS.catalog` bumped to 6 — a peer on an older catalog schema gets a clean 412 rather than silently dropping every attachment). `POST/DELETE /api/catalog/ingredients/:id/media`, `POST …/media/portrait`, and `GET …/media` + `…/media/missing` are Zod-validated; attaching rejects a key that doesn't resolve against the local library with a 422. Voice-memo capture is intentionally left as a clean seam for the separate source-kinds work.- **[catalog-ingredient-revisions] Catalog ingredients now keep an edit history with inline diff + restore.** Every time a catalog ingredient's name, payload, or tags change — a manual detail-page save, an ingest commit, or a future AI refinement pass — a revision row is recorded, and a new "Revision history" panel on the ingredient detail page lists them newest-first with a source badge (user / extract / refine / sync) and a relative timestamp. Expand any revision to see a field-by-field diff against the current saved state, and click "Restore" on an older revision to roll back (the restore is itself recorded as a new revision, so it's auditable and reversible). Backed by a new append-only `catalog_ingredient_revisions` Postgres table (foreign-keyed to `catalog_ingredients` with ON DELETE CASCADE); retention is capped at the most recent 50 revisions per ingredient (configurable via the `CATALOG_REVISION_RETENTION` env var) so history can't grow unbounded from rapid edits. The history is local audit data — it is intentionally NOT federated (the synced ingredient row already last-write-wins-merges the latest state across peers), so the catalog sync wire version is unchanged.