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
feat: legacy series canon helpers redirect to universe (Phase B.3a)
[._.]/ Adam Eivy05223a7b17f6
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 1ef8646410..05e62325da 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -206,6 +206,19 @@it) — the post-merge length comparison was always equal. Now clones theuniverse-side array before passing.+- **Legacy series-side canon helpers redirect to universe (Phase B.3a).**+ `extractAndMergeIntoSeries` and `refineCharacterDescription` now early-+ return into their universe-side equivalents when `series.universeId` is+ set. Every legacy caller (the season:episodes:generate auto-extract,+ textStages auto-extract, the `/series/:id/extract-bible` route, the+ `/series/:id/characters/:entryId/refine` route) automatically writes to+ the universe without a fork. The redirect uses dynamic `import('../universeCanon.js')`+ to avoid a module-init cycle.++ Net effect: linked series's auto-flows now populate universe canon+ exactly like the manual paths on the Nouns + Universe Canon pages.+ Orphan series (no universeId) still take the legacy series-side merge.+- **Per-issue Nouns page reads + writes universe canon (Phase B.2).** Whenthe series is linked to a universe, the Nouns page now points all canonreads (preview thumbnails, "in this issue" filtering) and all mutationsdiff --git a/server/services/pipeline/nounRefine.js b/server/services/pipeline/nounRefine.jsindex d480b0735e..0c8a6faa78 100644--- a/server/services/pipeline/nounRefine.js+++ b/server/services/pipeline/nounRefine.js@@ -22,6 +22,20 @@ const targetForPrompt = (entry) => ({export async function refineCharacterDescription(seriesId, entryId, options = {}) {const series = await getSeries(seriesId);++ // Phase B.3 routing: if the series links to a universe, refine on the+ // universe (where canon actually lives post-Phase-B). Return a series-+ // shaped result so legacy callers — the per-series Nouns page when it+ // takes the orphan branch — don't fork.+ if (series.universeId) {+ // Dynamic import to avoid the universeCanon → series.js cycle on+ // module-init (universeCanon imports updateUniverse, which lives in+ // universeBuilder.js, but the indirect graph still trips).+ const { refineUniverseCharacter } = await import('../universeCanon.js');+ const result = await refineUniverseCharacter(series.universeId, entryId, options);+ return { series, entry: result.entry, rationale: result.rationale, changes: result.changes, runId: result.runId, providerId: result.providerId, model: result.model };+ }+const list = Array.isArray(series.characters) ? series.characters : [];const idx = list.findIndex((e) => e.id === entryId);if (idx < 0) {diff --git a/server/services/pipeline/series.js b/server/services/pipeline/series.jsindex b0a411986e..a05506f76b 100644--- a/server/services/pipeline/series.js+++ b/server/services/pipeline/series.js@@ -226,6 +226,20 @@ export async function purgeImageRefFromAllSeries(filename) {*/export async function extractAndMergeIntoSeries(seriesId, opts = {}) {const series = await getSeries(seriesId);++ // Phase B.3 routing: if the series links to a universe, extract into the+ // universe (single source of truth) and return a compatible shape so+ // every legacy caller (auto-extract in textStages, season:episodes+ // autorun, the /extract-bible route) keeps working without a fork.+ if (series.universeId) {+ // Dynamic import to avoid a circular dep — universeCanon → series.js+ // (for updateSeries, indirectly) and back here would deadlock on+ // module-init otherwise.+ const { extractCanonFromProse } = await import('../universeCanon.js');+ const { universe, results } = await extractCanonFromProse(series.universeId, opts);+ return { series, universe, results };+ }+// Dedup `kinds` — duplicates would run extra LLM calls AND last-write-wins// the merge for the same field, so the only observable effect of a repeat// is a wasted provider round-trip. Preserve first-seen order so callers