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

FableLoom: Board view shows one episode path as storyboard panels (#13290)

[._.]/9a045559f870
diff --git a/client/src/App.jsx b/client/src/App.jsx
index 61ca1ae078..78378b948c 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -660,6 +660,7 @@ export default function App() {
<Route path="fableloom" element={<FableLoom />} />
<Route path="fableloom/:loomId" element={<FableLoomStory />} />
<Route path="fableloom/:loomId/:episodeId/outline" element={<FableLoomStory view="outline" />} />
+ <Route path="fableloom/:loomId/:episodeId/board" element={<FableLoomStory view="board" />} />
<Route path="fableloom/:loomId/:episodeId" element={<FableLoomStory />} />
<Route path="fableloom/:loomId/:episodeId/:nodeId" element={<FableLoomStory />} />
<Route path="start-story" element={<StartStory />} />
diff --git a/client/src/components/fableloom/LoomBoard.jsx b/client/src/components/fableloom/LoomBoard.jsx
new file mode 100644
index 0000000000..2a0b520d45
--- /dev/null
+++ b/client/src/components/fableloom/LoomBoard.jsx
@@ -0,0 +1,82 @@
+import { useMemo } from 'react';
+import { Check, CornerUpLeft, GitBranch, ImageIcon } from 'lucide-react';
+import MediaImage from '../MediaImage';
+import { aspectClass } from '../storyboards/storyboardArt';
+import { formatCount, formatTimecode } from '../../utils/formatters';
+import { fableLoomBoardPath } from '../../../../server/lib/fableLoomBoard.js';
+
+const END_LABELS = {
+ ending: 'The path reaches an ending.',
+ loop: 'The path loops back to an earlier scene.',
+ open: 'The path stops at a scene with no way on.',
+};
+const thumb = (image) => `/data/images/${encodeURIComponent(image)}`;
+
+/**
+ * One path through an episode as storyboard panels, grouped by dramatic scene.
+ * A fork's other choices sit under its panel; picking one moves the path
+ * (`via`, in the URL). Tapping a panel opens the scene in the graph.
+ */
+export default function LoomBoard({ episode, aspectRatio, via, onPick, onOpenNode }) {
+ const path = useMemo(() => fableLoomBoardPath(episode, via), [episode, via]);
+ const scenes = path.beats.reduce((sum, beat) => sum + beat.panels.length, 0);
+ const titleOf = (id) => episode.nodes.find((node) => node.id === id)?.title || 'an earlier scene';
+
+ if (path.end === 'empty') return <p className="p-6 text-sm text-port-text-muted">This episode has no start scene yet.</p>;
+ return (
+ <div className="min-h-0 flex-1 overflow-y-auto p-2 sm:p-4 space-y-4" aria-label="Episode board">
+ <p className="text-xs text-port-text-muted">
+ {formatCount(scenes)} scene{scenes === 1 ? '' : 's'} on this path
+ {path.totalSeconds > 0 && <>, <span className="tabular-nums">{formatTimecode(path.totalSeconds)}</span></>}. {END_LABELS[path.end]}
+ </p>
+ {path.beats.map((beat) => (
+ <section key={`${beat.id}-${beat.panels[0].number}`} aria-label={beat.title || `Scene ${beat.panels[0].number}`} className="space-y-1.5">
+ {beat.title && <h3 className="text-sm font-medium text-port-text">{beat.title}</h3>}
+ <ol className="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-2">
+ {beat.panels.map(({ node, number, seconds, choices, loopsTo }) => (
+ <li key={node.id} className="space-y-1">
+ <button type="button" onClick={() => onOpenNode(node.id)} aria-label={`Open scene ${number}: ${node.title || 'Untitled'}`}
+ className="block w-full overflow-hidden rounded-lg border border-port-border bg-port-card text-left hover:border-port-accent/50">
+ <div className={`${aspectClass(aspectRatio)} relative flex w-full items-center justify-center overflow-hidden bg-port-bg`}>
+ {node.image ? (
+ <MediaImage src={thumb(node.image)} alt="" className="h-full w-full object-cover" />
+ ) : node.prose ? (
+ <p className="line-clamp-4 p-2 text-xs text-port-text-muted">{node.prose}</p>
+ ) : (
+ <ImageIcon className="h-6 w-6 text-port-text-muted" aria-hidden="true" />
+ )}
+ {node.isEnding && <span className="port-media-overlay-strong absolute left-1 top-1 rounded px-1 text-[10px]">{node.endingLabel || 'Ending'}</span>}
+ </div>
+ <div className="flex min-w-0 items-center gap-1.5 px-2 py-1 text-[11px] text-port-text-muted">
+ <span className="font-semibold tabular-nums text-port-text">{number}</span>
+ <span className="truncate">{node.title || 'Untitled'}</span>
+ {seconds ? <span className="ml-auto shrink-0 tabular-nums">{seconds}s</span> : null}
+ </div>
+ </button>
+ {choices.length > 1 && (
+ <ul aria-label={`Choices after scene ${number}`} className="space-y-1">
+ {choices.map((choice) => (
+ <li key={choice.transitionId}>
+ <button type="button" onClick={() => onPick(choice.transitionId)} disabled={choice.picked} aria-pressed={choice.picked}
+ className={`flex min-h-[44px] w-full items-center gap-1.5 rounded border px-1.5 text-left text-[11px] ${choice.picked ? 'border-port-accent/60 text-port-text' : 'border-port-border text-port-text-muted hover:border-port-accent/50'}`}>
+ {choice.picked ? <Check size={12} className="shrink-0 text-port-accent" aria-hidden="true" /> : <GitBranch size={12} className="shrink-0" aria-hidden="true" />}
+ {choice.image && <img src={thumb(choice.image)} alt="" loading="lazy" className="h-6 w-8 shrink-0 rounded object-cover" />}
+ <span className="min-w-0 flex-1 truncate">{choice.intent || choice.title || 'Untitled'}</span>
+ </button>
+ </li>
+ ))}
+ </ul>
+ )}
+ {loopsTo && (
+ <p className="flex items-center gap-1 text-[11px] text-port-text-muted">
+ <CornerUpLeft size={12} aria-hidden="true" /> Back to {titleOf(loopsTo)}
+ </p>
+ )}
+ </li>
+ ))}
+ </ol>
+ </section>
+ ))}
+ </div>
+ );
+}
diff --git a/client/src/pages/FableLoomStory.jsx b/client/src/pages/FableLoomStory.jsx
index 8f18c76ceb..3ce68c6462 100644
--- a/client/src/pages/FableLoomStory.jsx
+++ b/client/src/pages/FableLoomStory.jsx
@@ -3,7 +3,8 @@
*
* URL is the source of truth: /fableloom/:loomId/plan is the series workspace;
* /fableloom/:loomId/:episodeId selects an episode, /outline switches that
- * episode to its text outline, and /:nodeId selects a scene in the graph. The
+ * episode to its text outline, /board shows one path as storyboard panels
+ * (its fork picks in ?via=), and /:nodeId selects a scene in the graph. The
* full-screen player rides ?play=1.
* Left: the scene-graph canvas (stacks top-to-bottom under the `lg` rail
* breakpoint). Right rail: the selected scene's editor, or the
@@ -18,7 +19,7 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { Link, Navigate, useNavigate, useParams, useSearchParams } from 'react-router';
-import { ArrowLeft, BookOpenText, ListTree, PencilLine, Plus, Settings, Sparkles, Trash2, Waypoints, Workflow as WorkflowIcon, X } from 'lucide-react';
+import { ArrowLeft, BookOpenText, LayoutGrid, ListTree, PencilLine, Plus, Settings, Sparkles, Trash2, Waypoints, Workflow as WorkflowIcon, X } from 'lucide-react';
import toast from '../components/ui/Toast';
import Drawer from '../components/Drawer';
import ConfirmButtonPair from '../components/ui/ConfirmButtonPair';
@@ -32,6 +33,7 @@ import { useConfirmDelete } from '../hooks/useConfirmDelete';
import useFableLoomAiRun from '../hooks/useFableLoomAiRun';
import useContainerWidth from '../hooks/useContainerWidth';
import { useScrollLock } from '../hooks/useScrollLock';
+import LoomBoard from '../components/fableloom/LoomBoard';
import LoomCanvas from '../components/fableloom/LoomCanvas';
import LoomEpisodeOutline from '../components/fableloom/LoomEpisodeOutline';
import LoomEpisodeOutlinePlanner from '../components/fableloom/LoomEpisodeOutlinePlanner';
@@ -53,6 +55,7 @@ import { composeStyledPrompt } from '../lib/composeStyledPrompt';
import { universeStylePreset } from '../lib/universeStylePreset';
import { LOOM_ORIENTATION, LOOM_STACK_WIDTH } from '../lib/loomLayout';
import { asFableLoomRenderSettings } from '../../../server/lib/fableLoomProduction.js';
+import { fableLoomBoardPick } from '../../../server/lib/fableLoomBoard.js';
import {
addLoomEpisode, addLoomNode, deleteLoomEpisode, generateImage, generateVideo,
getLoom, getPipelineSeries, getUniverse, updateLoomEpisode, updateLoomNode,
@@ -90,6 +93,8 @@ export default function FableLoomStory({ view = 'graph' }) {
useScrollLock(playOpen);
const seriesPlanOpen = episodeId === 'plan';
const outlineOpen = view === 'outline';
+ const boardOpen = view === 'board';
+ const via = useMemo(() => (searchParams.get('via') || '').split(',').filter(Boolean), [searchParams]);
// Orientation keys off the PAGE, not the canvas. The canvas is the leftover
// after the 380–420px rail on `lg+`, so measuring it would stack a laptop graph
// while the rail is still beside it.
@@ -597,9 +602,10 @@ export default function FableLoomStory({ view = 'graph' }) {
tabs={[
{ id: 'graph', label: 'Graph', icon: Waypoints },
{ id: 'outline', label: 'Outline', icon: ListTree },
+ { id: 'board', label: 'Board', icon: LayoutGrid },
]}
- activeTab={outlineOpen ? 'outline' : 'graph'}
- onChange={(id) => navigate(id === 'outline' ? `${episodePath(episode.id)}/outline` : episodePath(episode.id))}
+ activeTab={outlineOpen ? 'outline' : boardOpen ? 'board' : 'graph'}
+ onChange={(id) => navigate(id === 'graph' ? episodePath(episode.id) : `${episodePath(episode.id)}/${id}`)}
/>
)}
</div>
@@ -623,6 +629,18 @@ export default function FableLoomStory({ view = 'graph' }) {
</button>
</div>
</div>
+ ) : boardOpen ? (
+ <LoomBoard
+ episode={episode}
+ aspectRatio={asFableLoomRenderSettings(loom.renderSettings).aspectRatio}
+ via={via}
+ onPick={(transitionId) => setSearchParams((prev) => {
+ const next = new URLSearchParams(prev);
+ next.set('via', fableLoomBoardPick(episode, via, transitionId).join(','));
+ return next;
+ }, { replace: true })}
+ onOpenNode={(id) => navigate(episodePath(episode.id, id))}
+ />
) : outlineOpen ? (
<LoomEpisodeOutline
loom={loom}
diff --git a/client/src/pages/FableLoomStory.test.jsx b/client/src/pages/FableLoomStory.test.jsx
index f4b392fd8a..c68bfe5ec6 100644
--- a/client/src/pages/FableLoomStory.test.jsx
+++ b/client/src/pages/FableLoomStory.test.jsx
@@ -251,6 +251,37 @@ describe('FableLoomStory episode outline route', () => {
});
});
+describe('FableLoomStory episode board route', () => {
+ it('lays one path out as panels, moves it by a fork pick in the URL, and opens a scene in the graph', async () => {
+ const user = userEvent.setup();
+ api.getLoom.mockResolvedValue(loom({ episodes: [episode({ nodes: [
+ { id: 'node-1', title: 'Threshold', prose: 'You stand before the first door.', transitions: [
+ { id: 'tr-left', targetNodeId: 'node-2', intent: 'Go left' },
+ { id: 'tr-right', targetNodeId: 'node-3', intent: 'Go right' },
+ ] },
+ { id: 'node-2', title: 'Left Hall', prose: 'Dust.', isEnding: true, transitions: [] },
+ { id: 'node-3', title: 'Right Hall', prose: 'Light.', isEnding: true, transitions: [] },
+ ] })] }));
+ render(
+ <MemoryRouter initialEntries={['/fableloom/loom-1/ep-1/board']}>
+ <Routes>
+ <Route path="/fableloom/:loomId/:episodeId/board" element={<FableLoomStory view="board" />} />
+ <Route path="/fableloom/:loomId/:episodeId/:nodeId" element={<FableLoomStory />} />
+ </Routes>
+ </MemoryRouter>,
+ );
+
+ expect(await screen.findByRole('button', { name: 'Open scene 2: Left Hall' })).toBeInTheDocument();
+ expect(screen.getByRole('tab', { name: 'Board' })).toHaveAttribute('aria-selected', 'true');
+ await user.click(screen.getByRole('button', { name: 'Go right' }));
+ expect(await screen.findByRole('button', { name: 'Open scene 2: Right Hall' })).toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'Open scene 2: Left Hall' })).not.toBeInTheDocument();
+
+ await user.click(screen.getByRole('button', { name: 'Open scene 2: Right Hall' }));
+ expect(await screen.findByText('Editing scene: Right Hall')).toBeInTheDocument();
+ });
+});
+
describe('FableLoomStory episode expansion safety', () => {
it('exposes an explicit episode editor for changing the title and synopsis', async () => {
const user = userEvent.setup();
diff --git a/docs/PAGE_LAYOUT_AUDIT.md b/docs/PAGE_LAYOUT_AUDIT.md
index 3be0895752..5e10618302 100644
--- a/docs/PAGE_LAYOUT_AUDIT.md
+++ b/docs/PAGE_LAYOUT_AUDIT.md
@@ -71,7 +71,7 @@ Grouped by rendered component, including param/deep-link routes. “Retained”
| `/eidoverse/guest` | Intentional layout | Guest admission/world surface, outside the operator shell. |
| `/fableloom` | Retained, flush | Existing full-width title/navigation shell and internal content scrolling; no outer-gutter mismatch found. |
| `/fableloom/join` | Intentional layout | Hosted join flow, outside the operator shell. |
-| `/fableloom/:loomId`, `/fableloom/:loomId/:episodeId/outline`, `/fableloom/:loomId/:episodeId`, `/fableloom/:loomId/:episodeId/:nodeId` | Intentional layout | Story/episode editor; data-driven episode picker intentionally retained. |
+| `/fableloom/:loomId`, `/fableloom/:loomId/:episodeId/outline`, `/fableloom/:loomId/:episodeId/board`, `/fableloom/:loomId/:episodeId`, `/fableloom/:loomId/:episodeId/:nodeId` | Intentional layout | Story/episode editor; data-driven episode picker intentionally retained. |
| `/feature-agents/create`, `/feature-agents/:id/:tab` | Fixed | Moved record tabs out of the padded header into TabPills; kept record identity/back navigation. |
| `/feature-agents` | Retained, flush | Existing full-width title/navigation shell and internal content scrolling; no outer-gutter mismatch found. |
| `/devtools/flows` | Retained, flush | Existing full-width title/navigation shell and internal content scrolling; no outer-gutter mismatch found. |
diff --git a/docs/features/fableloom.md b/docs/features/fableloom.md
index 1c6690dfca..cc50073f29 100644
--- a/docs/features/fableloom.md
+++ b/docs/features/fableloom.md
@@ -111,6 +111,12 @@ scene-local clothes cannot silently reappear between episodes.
story order with their authored prose, endings, and reader paths. Unreachable
scenes remain visible in a separate section, and path destinations return to
the matching scene in the visual editor.
+- **`/fableloom/:loomId/:episodeId/board`** — one path through the episode as
+ storyboard panels (scene image or text, shot length, ending), grouped by
+ dramatic scene. The path follows the first choice at each fork; a fork's
+ choices sit under its panel, and picking one moves the path (`?via=` holds
+ the picked transition ids). The path stops at an ending, a loop back or a
+ scene with no way on; tapping a panel opens that scene in the graph.
- **Episode setup → Story beats → teleplay** — the production gate: draft one
concise log-line per eventual camera cut, edit paths and audience-channel
states, run the deterministic validator, and optionally ask the AI story
diff --git a/server/lib/README.md b/server/lib/README.md
index 91cb33128d..e929689c48 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -59,6 +59,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `falImageModels.js` | Curated fal.ai image model catalog, a dependency-free leaf the client imports: `FAL_IMAGE_FAMILIES` (text + `/edit` endpoint per family, per-model reference cap, sizing alphabet, pricing), `FAL_IMAGE_DEFAULT_MODEL`, `FAL_IMAGE_MODEL_IDS` (the only ids a fal `cloudModel` may name), `falImageFamily`/`isFalImageModel`, `falImagePriceLabel`, `buildFalImageRequest` (routes to `/edit` when input images are present; maps width/height to aspect-ratio + resolution tier or pixel `image_size`) and `estimateFalImageCostUsd` (with `FAL_MEGAPIXEL`, fal.ai's binary megapixel). |
| `imageRuntimeRemedies.js` | Local image-runtime vocabulary, a dependency-free leaf beside `imageGenCapabilities.js`: `IMAGE_RUNTIME_READINESS` (ready/unavailable/unknown), `IMAGE_RUNTIME` + `IMAGE_RUNTIME_LABELS` (the shared torch venv vs. the configurable mflux interpreter), `IMAGE_RUNTIME_REMEDY` (the one action that fixes each unavailable state), and `IMAGE_RUNTIME_UNAVAILABLE_CODE`. `services/imageGen/localRuntime.js` builds the diagnosis from these, `services/imageGen/local.js` tags its pre-flight render refusal with the same remedy, and `client/src/lib/imageGenModes.js` re-exports them so no component hand-copies a remedy kind. |
| `renderModeLadder.js` | `resolveRenderPins` and `resolveRenderTargetPins` share backend-scoped model candidate inheritance across browser and server. Image-gen mode resolution ladder (#6815), a dependency-free leaf beside `generationModes.js`/`renderTargets.js` so the client imports it directly instead of hand-copying it: `isModeUsable(settings, mode)` (queueable + enabled gate, no per-provider spec lookup), `pickUsableMode(settings, candidates)` (first usable candidate, falling through disabled pins to the cloud-then-local tail), `renderTargetDefaults(settings, target)` (the normalized `settings.renderDefaults[target]` pin), and `imageModeCandidates(settings, target, record)` (the shared `[recordPin, targetPin, installDefault]` candidate order, declared once so a UI's own "what will Auto resolve to" display can't drift from the resolver). `services/imageGen/cloudProviderConfig.js` re-exports the first three for its existing callers. |
+| `fableLoomBoard.js` | FableLoom Board view: `fableLoomBoardPath` walks one path from an episode's start scene (first choice at each fork unless a picked transition in `via`) into storyboard beats of panels with each fork's choices, stopping at an ending, a loop or a dead end; `fableLoomBoardPick` swaps a fork's pick. Browser-safe. |
| `fableLoomLimits.js` | FableLoom record caps (`LOOM_LIMITS`) — the single source of truth shared by the route schemas and the record sanitizer. A leaf module, below both. |
| `cameraMovements.js` | Shared camera-movement vocabulary (#10589): `CAMERA_MOVEMENTS` (stable ids with `family`, `energy`, `snap`/`still` flags, start/end framing and the four-part movement/speed/framing/end prose), `normalizeCameraMovement`/`cameraMovementId`/`cameraMovementFromText`, `shotCameraPrompt(camera)` (the four-part i2v camera block for a structured shot camera) and `cameraMovementCatalogForPrompt`. Used by FableLoom, Music Video planning/review and the layered template's `cameraRig.js`. |
| `fableLoomCameraMovements.js` | FableLoom names for the shared `cameraMovements.js` catalog (generated cut direction and the manual scene editor selector); persisted ids are unchanged. |
diff --git a/server/lib/fableLoomBoard.js b/server/lib/fableLoomBoard.js
new file mode 100644
index 0000000000..ade81f3215
--- /dev/null
+++ b/server/lib/fableLoomBoard.js
@@ -0,0 +1,66 @@
+/**
+ * FableLoom Board view — one path through an episode's scene graph laid out as
+ * storyboard panels. The path starts at the episode's start scene and follows
+ * the first choice at each fork unless the reader picked another (`via`, the
+ * chosen transition ids, kept in the URL). A fork's other choices travel with
+ * its panel as alternates. Consecutive scenes of the same dramatic scene form
+ * one beat, as panels do on a storyboard. Read-only; browser-safe.
+ */
+
+const sceneSeconds = (node) => (Number.isFinite(node?.shot?.durationSeconds) ? node.shot.durationSeconds : null);
+
+/**
+ * `{ beats, totalSeconds, end }`: beats of panels in path order. A panel is
+ * `{ node, number, seconds, choices, loopsTo }`, where `choices` lists every
+ * transition to a scene that exists (`picked` marks the one the path takes)
+ * and `loopsTo` names a scene the path already showed, where it stops. `end`
+ * is `ending`, `loop`, `open` (a scene with nowhere to go) or `empty`.
+ */
+export function fableLoomBoardPath(episode, via = []) {
+ const nodes = Array.isArray(episode?.nodes) ? episode.nodes : [];
+ const byId = new Map(nodes.map((node) => [node.id, node]));
+ const chosen = new Set(via);
+ const beats = [];
+ const seen = new Set();
+ let node = byId.get(episode?.startNodeId) || null;
+ let end = node ? 'open' : 'empty';
+ let number = 0;
+ let totalSeconds = 0;
+ while (node) {
+ seen.add(node.id);
+ number += 1;
+ const choices = (node.transitions || []).filter((t) => byId.has(t.targetNodeId));
+ const next = choices.find((t) => chosen.has(t.id)) || choices[0] || null;
+ const loopsTo = next && seen.has(next.targetNodeId) ? next.targetNodeId : null;
+ const seconds = sceneSeconds(node);
+ totalSeconds += seconds || 0;
+ const beatId = node.shot?.dramaticSceneId || node.id;
+ if (beats.at(-1)?.id !== beatId) beats.push({ id: beatId, title: node.shot?.dramaticSceneTitle || node.title || '', panels: [] });
+ beats.at(-1).panels.push({
+ node,
+ number,
+ seconds,
+ loopsTo,
+ choices: choices.map((t) => ({
+ transitionId: t.id, targetNodeId: t.targetNodeId, intent: t.intent || '', picked: t === next,
+ title: byId.get(t.targetNodeId).title || '', image: byId.get(t.targetNodeId).image || null,
+ })),
+ });
+ if (node.isEnding) { end = 'ending'; break; }
+ if (!next) break;
+ if (loopsTo) { end = 'loop'; break; }
+ node = byId.get(next.targetNodeId);
+ }
+ return { beats, totalSeconds, end };
+}
+
+/**
+ * The `via` list after picking `transitionId` at its scene: that scene's other
+ * choices are dropped, so one pick per fork. Picks after the fork stay; they
+ * still apply wherever the new path reaches their scenes.
+ */
+export function fableLoomBoardPick(episode, via, transitionId) {
+ const owner = (episode?.nodes || []).find((node) => (node.transitions || []).some((t) => t.id === transitionId));
+ const siblings = new Set((owner?.transitions || []).map((t) => t.id));
+ return [...via.filter((id) => !siblings.has(id)), transitionId];
+}
diff --git a/server/lib/fableLoomBoard.test.js b/server/lib/fableLoomBoard.test.js
new file mode 100644
index 0000000000..bdc124737c
--- /dev/null
+++ b/server/lib/fableLoomBoard.test.js
@@ -0,0 +1,40 @@
+import { describe, expect, it } from 'vitest';
+import { fableLoomBoardPath, fableLoomBoardPick } from './fableLoomBoard.js';
+
+const scene = (id, transitions = [], extra = {}) => ({
+ id, title: id.toUpperCase(), transitions: transitions.map(([tid, target, intent = '']) => ({ id: tid, targetNodeId: target, intent })), ...extra,
+});
+// a → b (fork: c or d); c → a loops; d is an ending. a and b share a dramatic scene.
+const episode = {
+ startNodeId: 'a',
+ nodes: [
+ scene('a', [['t-ab', 'b']], { shot: { dramaticSceneId: 'ds-1', dramaticSceneTitle: 'Arrival', durationSeconds: 6 } }),
+ scene('b', [['t-bc', 'c', 'Run'], ['t-bd', 'd', 'Stay'], ['t-bx', 'missing']], { shot: { dramaticSceneId: 'ds-1', durationSeconds: 8 } }),
+ scene('c', [['t-ca', 'a']]),
+ scene('d', [], { isEnding: true }),
+ ],
+};
+const ids = (path) => path.beats.flatMap((beat) => beat.panels.map((panel) => panel.node.id));
+
+describe('fableLoomBoardPath', () => {
+ it('follows the first choice, groups a dramatic scene into one beat, and stops where it would loop', () => {
+ const path = fableLoomBoardPath(episode);
+ expect(ids(path)).toEqual(['a', 'b', 'c']);
+ expect(path.beats.map((beat) => [beat.title, beat.panels.length])).toEqual([['Arrival', 2], ['C', 1]]);
+ expect(path.beats[0].panels[1].choices.map((c) => [c.intent, c.picked])).toEqual([['Run', true], ['Stay', false]]);
+ expect(path.beats[1].panels[0].loopsTo).toBe('a');
+ expect([path.end, path.totalSeconds]).toEqual(['loop', 14]);
+ });
+
+ it('takes a picked choice to an ending, and one pick per fork', () => {
+ const via = fableLoomBoardPick(episode, ['t-bc'], 't-bd');
+ expect(via).toEqual(['t-bd']);
+ const path = fableLoomBoardPath(episode, via);
+ expect(ids(path)).toEqual(['a', 'b', 'd']);
+ expect(path.end).toBe('ending');
+ });
+
+ it('reports an episode with no start scene as empty', () => {
+ expect(fableLoomBoardPath({ nodes: [] })).toMatchObject({ beats: [], end: 'empty' });
+ });
+});
diff --git a/server/lib/index.js b/server/lib/index.js
index 7f4fe724f9..aaa283891f 100644
--- a/server/lib/index.js
+++ b/server/lib/index.js
@@ -130,6 +130,7 @@ export * from './creativeLatitude.js';
// discovery surface reaches EDITORIAL_CHECKS + the lookup helpers.
export * as editorial from './editorial/index.js';
export * from './familySettingsMap.js';
+export * from './fableLoomBoard.js';
export * from './fableLoomGraph.js';
export * from './cameraMovements.js';
export * from './fableLoomCameraMovements.js';