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

feat: make FableLoom nodes camera cuts

Adam Eivye0ea6410f49c
diff --git a/client/src/components/fableloom/LoomNodeEditor.jsx b/client/src/components/fableloom/LoomNodeEditor.jsx
index a482c0e9b1..6954e4d7d5 100644
--- a/client/src/components/fableloom/LoomNodeEditor.jsx
+++ b/client/src/components/fableloom/LoomNodeEditor.jsx
@@ -1,8 +1,8 @@
/**
* FableLoom scene editor — the side panel for the selected node: title/prose,
* ending flag + label, the intent-transition list, scene image prompt and
- * image/video previews via the shared local media lanes, and the AI branch
- * action. The authored scene text is the video prompt.
+ * image/video previews via the shared local media lanes, a known camera-move
+ * selector, a dedicated single-clip video prompt, and the AI branch action.
*
* Fields save on blur (silent PATCH, skipped when unchanged; the server
* returns the full loom, which the parent folds into state). Paths save one
@@ -26,6 +26,7 @@ import {
} from '../../services/api';
import { fieldClass, labelClass, sceneFieldClass } from './fieldStyles';
import { isTeleplayFormat } from './loomFormats';
+import { FABLELOOM_CAMERA_MOVEMENTS } from '../../../../server/lib/fableLoomCameraMovements.js';
const toRow = (t) => ({ ...t, triggersText: (t.triggers || []).join('; ') });
const rowToPatch = ({ targetNodeId, intent, triggersText, description }) => ({
@@ -56,6 +57,8 @@ export default function LoomNodeEditor({ loom, episode, node, onLoomUpdate, onCl
title: node.title || '',
prose: node.prose || '',
imagePrompt: node.imagePrompt || '',
+ videoPrompt: node.videoPrompt || '',
+ cameraMovement: node.cameraMovement || '',
isEnding: !!node.isEnding,
endingLabel: node.endingLabel || '',
transitions: (node.transitions || []).map(toRow),
@@ -170,14 +173,17 @@ export default function LoomNodeEditor({ loom, episode, node, onLoomUpdate, onCl
}, { errorMessage: 'Could not queue the render' });
const [runGenerateVideo, videoRendering] = useAsyncAction(async () => {
- const prompt = form.prose.trim();
- if (!prompt) {
+ const authoredPrompt = form.videoPrompt.trim() || form.prose.trim();
+ if (!authoredPrompt) {
toast.error('Write the scene first');
return;
}
- // The authored scene is already the complete generation prompt, especially
- // for teleplays where sluglines, action, and dialogue carry the full beat.
+ // Prefer the explicit single-cut direction; legacy nodes fall back to the
+ // authored scene until they are updated.
// An existing rendered still seeds image-to-video when one is available.
+ await saveField('videoPrompt', form.videoPrompt);
+ const movement = FABLELOOM_CAMERA_MOVEMENTS.find((move) => move.value === form.cameraMovement);
+ const prompt = movement ? `${authoredPrompt}\n\nCamera direction: ${movement.prompt}` : authoredPrompt;
await generateVideo({
prompt: loom.styleNotes ? `${prompt}\n\nStyle: ${loom.styleNotes}` : prompt,
backend: 'local',
@@ -318,7 +324,36 @@ export default function LoomNodeEditor({ loom, episode, node, onLoomUpdate, onCl
Generate video
</button>
</div>
- <p className="text-xs text-port-text-muted">Uses the scene above as the video prompt.</p>
+ <div className="space-y-2">
+ <label htmlFor="loom-node-camera-movement" className={labelClass}>Camera movement</label>
+ <select
+ id="loom-node-camera-movement"
+ className={fieldClass}
+ value={form.cameraMovement}
+ onChange={(e) => {
+ setForm((p) => ({ ...p, cameraMovement: e.target.value }));
+ patchNode({ cameraMovement: e.target.value });
+ }}
+ >
+ <option value="">Choose a movement</option>
+ {form.cameraMovement && !FABLELOOM_CAMERA_MOVEMENTS.some((move) => move.value === form.cameraMovement) && (
+ <option value={form.cameraMovement}>{form.cameraMovement} (custom)</option>
+ )}
+ {FABLELOOM_CAMERA_MOVEMENTS.map((move) => (
+ <option key={move.value} value={move.value}>{move.label}</option>
+ ))}
+ </select>
+ <textarea
+ rows={3}
+ className={fieldClass}
+ placeholder="One continuous clip: action, camera move, pace, atmosphere, final beat"
+ aria-label="Video prompt"
+ value={form.videoPrompt}
+ onChange={(e) => setForm((p) => ({ ...p, videoPrompt: e.target.value }))}
+ onBlur={() => saveField('videoPrompt', form.videoPrompt)}
+ />
+ <p className="text-xs text-port-text-muted">Falls back to the scene text when no dedicated video prompt is set.</p>
+ </div>
{node.videoHistoryId && (
<video
controls
diff --git a/client/src/components/fableloom/LoomNodeEditor.test.jsx b/client/src/components/fableloom/LoomNodeEditor.test.jsx
index f0fcecbde4..39048b2b5b 100644
--- a/client/src/components/fableloom/LoomNodeEditor.test.jsx
+++ b/client/src/components/fableloom/LoomNodeEditor.test.jsx
@@ -26,7 +26,8 @@ const scene = 'EXT. ANCIENT GATE - NIGHT\n\nThe gate groans open.';
const makeNodes = (transitions) => ([
{
id: 'n1', title: 'The Gate', prose: scene, image: 'scene.png',
- imagePrompt: 'an ancient gate', videoPrompt: 'legacy motion prompt', transitions,
+ imagePrompt: 'an ancient gate', videoPrompt: 'The gate opens in one continuous shot.',
+ cameraMovement: 'slow-dolly-in', transitions,
},
{ id: 'n2', title: 'Inside', prose: 'Torchlight.', transitions: [] },
]);
@@ -117,13 +118,13 @@ describe('LoomNodeEditor scene media', () => {
generateVideo.mockResolvedValue({ jobId: 'video-1', status: 'queued' });
renderEditor();
- expect(screen.queryByLabelText('Video prompt')).not.toBeInTheDocument();
- expect(screen.getByText('Uses the scene above as the video prompt.')).toBeInTheDocument();
+ expect(screen.getByLabelText('Video prompt')).toHaveValue('The gate opens in one continuous shot.');
+ expect(screen.getByLabelText('Camera movement')).toHaveValue('slow-dolly-in');
await user.click(screen.getByRole('button', { name: 'Generate video' }));
await waitFor(() => expect(generateVideo).toHaveBeenCalledTimes(1));
expect(generateVideo).toHaveBeenCalledWith({
- prompt: scene,
+ prompt: 'The gate opens in one continuous shot.\n\nCamera direction: Camera slowly moves forward toward the subject.',
backend: 'local',
mode: 'image',
sourceImageFile: 'scene.png',
@@ -136,7 +137,7 @@ describe('LoomNodeEditor scene media', () => {
const user = userEvent.setup();
generateVideo.mockResolvedValue({ jobId: 'video-2', status: 'queued' });
const nodes = makeNodes([]).map((node) => node.id === 'n1'
- ? { ...node, image: null }
+ ? { ...node, image: null, videoPrompt: '', cameraMovement: '' }
: node);
render(
<LoomNodeEditor
@@ -156,4 +157,16 @@ describe('LoomNodeEditor scene media', () => {
}));
expect(generateVideo.mock.calls[0][0]).not.toHaveProperty('sourceImageFile');
});
+
+ it('persists a selected camera movement from the shared vocabulary', async () => {
+ const user = userEvent.setup();
+ updateLoomNode.mockResolvedValue({ id: 'loom-1' });
+ renderEditor();
+
+ await user.selectOptions(screen.getByLabelText('Camera movement'), 'orbit-180');
+
+ await waitFor(() => expect(updateLoomNode).toHaveBeenCalledWith(
+ 'loom-1', 'ep-1', 'n1', { cameraMovement: 'orbit-180' }, { silent: true },
+ ));
+ });
});
diff --git a/client/src/pages/FableLoomStory.jsx b/client/src/pages/FableLoomStory.jsx
index de493e4162..e774e26a6f 100644
--- a/client/src/pages/FableLoomStory.jsx
+++ b/client/src/pages/FableLoomStory.jsx
@@ -394,7 +394,7 @@ export default function FableLoomStory({ view = 'graph' }) {
* controls, and episode deletion.
*/
function EpisodeSetupDrawer({ open, onClose, loom, episode, onLoomUpdate, onFeedbackStarted, onDeleted }) {
- const [form, setForm] = useState({ title: '', synopsis: '', guidance: '', nodeTarget: 12, endingTarget: 3 });
+ const [form, setForm] = useState({ title: '', synopsis: '', guidance: '' });
// The weave reads server-side state (title/synopsis), so it gates on
// in-flight meta saves per the client save-gating convention.
const [metaSaving, setMetaSaving] = useState(0);
@@ -421,8 +421,6 @@ function EpisodeSetupDrawer({ open, onClose, loom, episode, onLoomUpdate, onFeed
const [runWeave, weaving] = useAsyncAction(async () => {
const result = await weaveLoomEpisode(loom.id, episode.id, {
guidance: form.guidance,
- nodeTarget: Number(form.nodeTarget) || 12,
- endingTarget: Number(form.endingTarget) || 3,
replace: hasScenes,
}, { silent: true });
onLoomUpdate(result.loom);
@@ -473,24 +471,9 @@ function EpisodeSetupDrawer({ open, onClose, loom, episode, onLoomUpdate, onFeed
onChange={(e) => setForm((p) => ({ ...p, guidance: e.target.value }))}
/>
</FormField>
- <div className="grid grid-cols-2 gap-3">
- <FormField label="Scenes (approx.)" labelClassName={labelClass}>
- <input
- type="number" min={3} max={60}
- className={fieldClass}
- value={form.nodeTarget}
- onChange={(e) => setForm((p) => ({ ...p, nodeTarget: e.target.value }))}
- />
- </FormField>
- <FormField label="Endings" labelClassName={labelClass}>
- <input
- type="number" min={1} max={12}
- className={fieldClass}
- value={form.endingTarget}
- onChange={(e) => setForm((p) => ({ ...p, endingTarget: e.target.value }))}
- />
- </FormField>
- </div>
+ <p className="text-xs text-port-text-muted">
+ The story writer and creative director choose the number of camera-cut scenes and endings from the episode.
+ </p>
{hasScenes && (
<p className="text-xs text-port-warning">
Weaving replaces this episode's {episode.nodes.length} existing scene{episode.nodes.length === 1 ? '' : 's'}.
diff --git a/data.reference/prompts/stage-config.json b/data.reference/prompts/stage-config.json
index 666aefdb91..dd84a12a44 100644
--- a/data.reference/prompts/stage-config.json
+++ b/data.reference/prompts/stage-config.json
@@ -991,14 +991,14 @@
},
"fableloom-weave-episode": {
"name": "FableLoom — Weave Episode Graph",
- "description": "Generates a complete branching-narrative episode as a directed graph of scenes: an opening, 2–4 intent-labeled paths per scene (with example reader phrasings), and multiple distinct endings. Grounded in the loom's premise plus the linked universe's canon. Returns { startKey, nodes[] } with author-stable keys the service maps onto server-minted node ids.",
+ "description": "Generates a complete branching-narrative episode as a directed graph of single-camera-cut nodes, choosing its own node and ending counts from the story. Consecutive coverage uses Continue paths; genuine decisions use distinct intent paths. Each node includes image, video, and camera-movement direction.",
"model": "heavy",
"returnsJson": true,
"variables": []
},
"fableloom-branch-node": {
"name": "FableLoom — Branch a Scene",
- "description": "Grows new paths out of ONE scene of a branching-narrative episode: each branch is a new scene plus the reader intent (label + example phrasings + spoiler-safe description) that leads to it, kept distinct from the scene's existing paths. Returns { branches[] }.",
+ "description": "Grows new paths out of ONE camera-cut node: each branch is a new single-shot node plus the reader intent that leads to it, including image, video, and camera-movement direction. Returns { branches[] }.",
"model": "default",
"returnsJson": true,
"variables": []
diff --git a/data.reference/prompts/stages/fableloom-branch-node.md b/data.reference/prompts/stages/fableloom-branch-node.md
index f962312fbf..ced7747c80 100644
--- a/data.reference/prompts/stages/fableloom-branch-node.md
+++ b/data.reference/prompts/stages/fableloom-branch-node.md
@@ -29,8 +29,12 @@ You are a branching-narrative designer growing new paths out of ONE scene of an
- Create exactly {{branchCount}} new branches out of this scene. Each branch is a NEW scene plus the intent that leads to it.
- Each branch's `intent` is a short imperative label (≤10 words) a reader could plausibly express; include 2–4 `triggers` (example free-text phrasings) and a one-sentence spoiler-safe `description`.
- The new intents must be clearly distinguishable from each other AND from the scene's existing paths shown in the graph digest.
-- A new scene may be an ending (`isEnding: true` + `endingLabel`) when the branch naturally concludes the story; otherwise write it as a scene that ends at a decision point (its own paths will be authored later).
+- A new scene may be an ending (`isEnding: true` + `endingLabel`) when the branch naturally concludes the story; otherwise write it as one continuous camera cut that ends at a decision point (its own paths will be authored later).
- Each new scene's `imagePrompt` is one sentence of concrete visual description.
+- Each new scene's `videoPrompt` directs one renderable clip: visible action, one primary camera movement, pace, atmosphere, and final beat. Never put a cut or angle change inside it.
+- Choose `cameraMovement` from this vocabulary (the stable id before the parentheses):
+
+{{cameraMovementCatalog}}
- Stay consistent with the tone, continuity, and canon of the existing graph.
## Scene format
@@ -52,6 +56,8 @@ Return ONLY valid JSON matching this shape — no prose, no markdown fence, no c
"title": "string",
"prose": "string",
"imagePrompt": "string",
+ "videoPrompt": "string",
+ "cameraMovement": "slow-dolly-in",
"isEnding": false,
"endingLabel": ""
}
diff --git a/data.reference/prompts/stages/fableloom-feedback-episode.md b/data.reference/prompts/stages/fableloom-feedback-episode.md
index d81045a647..0bbb2ada08 100644
--- a/data.reference/prompts/stages/fableloom-feedback-episode.md
+++ b/data.reference/prompts/stages/fableloom-feedback-episode.md
@@ -25,10 +25,13 @@ The bracketed values are stable scene and path ids. They are the only records yo
- Interpret the feedback as an actionable revision, not as a request for critique or an explanation.
- Return only the fields that need to change. An omitted field is preserved. A present empty string intentionally clears that field.
- You may revise the episode `title` and `synopsis`.
-- You may revise existing scenes' `title`, complete `prose`, `imagePrompt`, `isEnding`, and `endingLabel`.
+- You may revise existing scenes' `title`, complete `prose`, `imagePrompt`, `videoPrompt`, `cameraMovement`, `isEnding`, and `endingLabel`.
- You may revise the `intent`, `triggers`, `description`, or `targetNodeId` of an existing path, using its existing path id.
- Do not add or remove scenes or paths. Keep every id exactly as shown. Keep any changed `targetNodeId` pointed at an existing scene id.
- A prose edit must be a complete replacement for that scene, not a summary, placeholder, or editorial note. Preserve the episode's scene format and continuity.
+- Each scene is one continuous camera cut and one separately rendered video clip. A revised `videoPrompt` must contain visible action, one primary move, pace, atmosphere, and final beat—never an edit or second setup. Choose `cameraMovement` from this vocabulary:
+
+{{cameraMovementCatalog}}
- If the feedback asks for a new or deleted scene/path, make the closest useful edit to the existing records and leave graph membership unchanged.
- If the feedback is ambiguous, make a reasonable, minimal story edit without asking a question.
@@ -46,6 +49,8 @@ Return ONLY valid JSON matching this shape — no prose, no markdown fence, no c
"title": "new title, only when changed",
"prose": "complete replacement prose, only when changed",
"imagePrompt": "new image prompt, only when changed",
+ "videoPrompt": "new single-clip video prompt, only when changed",
+ "cameraMovement": "slow-dolly-in, only when changed",
"isEnding": false,
"endingLabel": "new ending label, only when changed",
"transitions": [
diff --git a/data.reference/prompts/stages/fableloom-weave-episode.md b/data.reference/prompts/stages/fableloom-weave-episode.md
index 081618da24..36e7576fce 100644
--- a/data.reference/prompts/stages/fableloom-weave-episode.md
+++ b/data.reference/prompts/stages/fableloom-weave-episode.md
@@ -1,6 +1,6 @@
# FableLoom — Weave Episode Graph
-You are a branching-narrative designer. Build ONE complete episode of an interactive story as a directed graph of scenes. Readers move through the graph by expressing intents in free text ("sneak past the guard", "ask her about the letter"), so every scene's outgoing paths must be labeled with a clear, distinct intent a reader could plausibly express on their own.
+You are a story writer and creative director. Build ONE complete episode of an interactive story as a directed graph of camera-cut nodes. Every node becomes one separately rendered video clip: treat it like one comic panel or one continuous camera setup, never a container for multiple cuts.
## Story
@@ -14,15 +14,27 @@ You are a branching-narrative designer. Build ONE complete episode of an interac
{{guidance}}
+## Existing episode graph
+
+{{existingGraph}}
+
+When an existing graph is present, this is a reweave: preserve its story events, dialogue, branch meanings, and ending outcomes while expanding or recomposing nodes as needed to satisfy the one-camera-cut-per-node contract.
+
## Design contract
-- Aim for roughly {{nodeTarget}} scenes and {{endingTarget}} distinct endings. Endings must differ meaningfully in outcome and tone — not the same conclusion reworded.
+- Choose the node count and ending count yourself from the story's pacing, dramatic coverage, and branching needs. Never compress multiple camera cuts into one node to hit an arbitrary count.
+- Each node is exactly ONE continuous shot with one primary framing and one camera movement. Split every change of angle, framing, location, time, or camera movement into another node.
+- Use a single `Continue` transition for consecutive coverage inside the same narrative path. Reserve 2–4 distinct intent paths for genuine reader decisions. Endings must differ meaningfully in outcome and tone.
- Exactly one scene is the opening (`startKey`). Every scene must be reachable from it.
-- Every non-ending scene needs 2–4 outgoing paths. Each path gets: an `intent` (a short imperative label, ≤10 words), 2–4 `triggers` (example free-text phrasings a reader might type), and a one-sentence `description` of where it leads (spoiler-safe).
+- Every non-ending node needs either one `Continue` path for consecutive coverage or 2–4 outgoing paths at a genuine decision. Each path gets: an `intent` (a short imperative label, ≤10 words), 2–4 `triggers` (example free-text phrasings a reader might type), and a one-sentence `description` of where it leads (spoiler-safe).
- Intents on the same scene must be clearly distinguishable from each other — no two paths a reader could mean with the same sentence.
- Ending scenes have `isEnding: true`, an `endingLabel` (a short evocative name for that outcome), and NO outgoing paths.
- Loops back to earlier scenes are allowed when they make narrative sense, but at least one ending must remain reachable from every scene.
- Each scene's `imagePrompt` is one sentence of concrete visual description for an image generator — subject, setting, mood, no character names unless they're in the canon above.
+- Each scene's `videoPrompt` is a self-contained single-clip direction: visible subject action, the selected camera move, pace, atmosphere, and final beat. Do not describe edits, montages, angle changes, or a second shot.
+- Choose `cameraMovement` from this production vocabulary (the stable id before the parentheses):
+
+{{cameraMovementCatalog}}
## Scene format
@@ -41,6 +53,8 @@ Return ONLY valid JSON matching this shape — no prose, no markdown fence, no c
"title": "string",
"prose": "string",
"imagePrompt": "string",
+ "videoPrompt": "string",
+ "cameraMovement": "slow-dolly-in",
"isEnding": false,
"transitions": [
{ "targetKey": "s2", "intent": "string", "triggers": ["string"], "description": "string" }
@@ -51,6 +65,8 @@ Return ONLY valid JSON matching this shape — no prose, no markdown fence, no c
"title": "string",
"prose": "string",
"imagePrompt": "string",
+ "videoPrompt": "string",
+ "cameraMovement": "locked-off",
"isEnding": true,
"endingLabel": "string",
"transitions": []
diff --git a/scripts/migrations/288-fableloom-scene-format.js b/scripts/migrations/288-fableloom-scene-format.js
index 5894bca281..4fc053befe 100644
--- a/scripts/migrations/288-fableloom-scene-format.js
+++ b/scripts/migrations/288-fableloom-scene-format.js
@@ -25,8 +25,8 @@ export const ACCEPTED_OLD_MD5 = {
// Post-change shipped hashes (format contract rendered from the loom record).
export const NEW_SHIPPED_MD5 = {
- 'fableloom-weave-episode.md': '1b27f5b0073a304c21079aa6e2c71447',
- 'fableloom-branch-node.md': '6279b1c9912c300363a727245d22fe84',
+ 'fableloom-weave-episode.md': '990cdecf9e46fa049ae4aae27e3b172d',
+ 'fableloom-branch-node.md': 'e5005826c4577623ba362a0292741c7c',
'fableloom-play-turn.md': 'e35ad91aae263e3adf28d1e047a46661',
};
diff --git a/scripts/migrations/310-fableloom-camera-cuts.js b/scripts/migrations/310-fableloom-camera-cuts.js
new file mode 100644
index 0000000000..0e79e4c883
--- /dev/null
+++ b/scripts/migrations/310-fableloom-camera-cuts.js
@@ -0,0 +1,30 @@
+/**
+ * Upgrade FableLoom generation/editing prompts to one renderable camera cut
+ * per node and add the shared camera-movement vocabulary.
+ */
+
+import { makePromptReplaceMigration } from './_lib.js';
+
+export const ACCEPTED_OLD_MD5 = {
+ 'fableloom-weave-episode.md': ['1b27f5b0073a304c21079aa6e2c71447'],
+ 'fableloom-branch-node.md': ['6279b1c9912c300363a727245d22fe84'],
+ 'fableloom-feedback-episode.md': ['43d1525fcedce99b933ae5b003516a36'],
+};
+
+export const NEW_SHIPPED_MD5 = {
+ 'fableloom-weave-episode.md': '990cdecf9e46fa049ae4aae27e3b172d',
+ 'fableloom-branch-node.md': 'e5005826c4577623ba362a0292741c7c',
+ 'fableloom-feedback-episode.md': '9ff21b47c4251585da9500c306d91a28',
+};
+
+const { applyMigration, up } = makePromptReplaceMigration({
+ accepted: ACCEPTED_OLD_MD5,
+ current: NEW_SHIPPED_MD5,
+ label: 'FableLoom camera cuts',
+ customizedHint: (filename) =>
+ ` Merge the one-camera-cut contract and {{cameraMovementCatalog}} from\n`
+ + ` data.reference/prompts/stages/${filename} into the installed template.`,
+});
+
+export { applyMigration };
+export default { up };
diff --git a/scripts/migrations/310-fableloom-camera-cuts.test.js b/scripts/migrations/310-fableloom-camera-cuts.test.js
new file mode 100644
index 0000000000..0ca0a23282
--- /dev/null
+++ b/scripts/migrations/310-fableloom-camera-cuts.test.js
@@ -0,0 +1,14 @@
+import { describe } from 'vitest';
+
+import migration, { applyMigration, ACCEPTED_OLD_MD5, NEW_SHIPPED_MD5 } from './310-fableloom-camera-cuts.js';
+import { runPromptMigrationTests } from './_testHelpers.js';
+
+describe('migration 310 — FableLoom camera-cut prompts', () => {
+ runPromptMigrationTests({
+ migration,
+ applyMigration,
+ ACCEPTED_OLD_MD5,
+ NEW_SHIPPED_MD5,
+ prefix: 'migration-310-',
+ });
+});
diff --git a/server/lib/README.md b/server/lib/README.md
index 6321ca5d01..6a32e4d9a5 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -32,6 +32,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `sharedSchemas.js` | Cross-domain Zod fragments that `validation.js` and the per-domain `*Validation.js` files both need, kept in a leaf module so the domain files never import back through `validation.js` (its hoisted `export * from` lines would TDZ). `grokVideoDurationSchema` (grok clip-length union), `cloudModelIdString(message)` (cloud-CLI model-id charset/bounds), `recordRenderPinFields` (the `imageMode`/`imageModelId` per-record render pin pair), and `isSafeSubdirFilter(v)` (relative path with no wildcard, `..` segment, or leading `/`), and `csvIdsParam({ max, maxIdLength, truncate })` (the `?ids=a,b,c` batch-by-id query param: trims, drops empties, reads all-blank as absent, and either 400s or silently slices an over-cap batch). |
| `generationModes.js` | Shared immutable image/video render-backend alphabets (`IMAGE_GEN_MODE[S]`, `QUEUEABLE_IMAGE_MODES`, `VIDEO_GEN_MODE[S]`, and cloud subsets), kept below both validation and generation services so schemas never import orchestration modules. |
| `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. |
+| `fableLoomCameraMovements.js` | Shared FableLoom camera-movement registry for generated cut direction and the manual scene editor selector. |
| `fableLoomFormats.js` | FableLoom scene formats (`LOOM_FORMATS`, `asLoomFormat`, `sceneFormatContract`, …) — how a loom writes scene text, read by validation, the sanitizer, and every generative stage. |
| `postDrillTypes.js` | MeatSpace POST drill vocabularies (`CACHEABLE_TYPES`, `COGNITIVE_DRILL_TYPES`), kept below validation so a route schema never pulls in the POST services (and, through them, the LLM drill generator). |
| `spriteVocabulary.js` | Sprite id pattern, record kinds, the canonical 8-direction order + derived anchor set, `TURNAROUND_ID`, and the animation provider ids — the alphabets the sprite route schemas enumerate, kept below the sprite services. |
diff --git a/server/lib/fableLoomCameraMovements.js b/server/lib/fableLoomCameraMovements.js
new file mode 100644
index 0000000000..e790534916
--- /dev/null
+++ b/server/lib/fableLoomCameraMovements.js
@@ -0,0 +1,63 @@
+/**
+ * Camera-direction vocabulary shared by FableLoom's AI prompts and editor.
+ * Values are stable persisted ids; labels and prompt text may improve without
+ * migrating existing scene nodes.
+ */
+
+export const FABLELOOM_CAMERA_MOVEMENTS = Object.freeze([
+ { value: 'locked-off', label: 'Locked-off / static', prompt: 'Locked-off tripod shot; the camera remains completely still.' },
+ { value: 'slow-dolly-in', label: 'Slow dolly in', prompt: 'Camera slowly moves forward toward the subject.' },
+ { value: 'slow-dolly-out', label: 'Slow dolly out', prompt: 'Camera slowly moves backward away from the subject.' },
+ { value: 'fast-dolly-in', label: 'Fast dolly in', prompt: 'Camera rapidly pushes toward the subject with urgent motion.' },
+ { value: 'dolly-zoom', label: 'Dolly zoom / vertigo', prompt: 'Camera dollies while zooming in the opposite direction, warping background scale.' },
+ { value: 'zoom-in', label: 'Optical zoom in', prompt: 'Stationary camera smoothly magnifies the subject with the lens.' },
+ { value: 'zoom-out', label: 'Optical zoom out', prompt: 'Stationary camera smoothly widens the field of view with the lens.' },
+ { value: 'crash-zoom', label: 'Crash zoom', prompt: 'A sudden snap zoom punches into the key detail.' },
+ { value: 'macro-zoom', label: 'Extreme macro zoom', prompt: 'The view transitions from the subject into an extreme macro detail.' },
+ { value: 'pan-left', label: 'Pan left', prompt: 'Camera pivots horizontally to the left from a fixed position.' },
+ { value: 'pan-right', label: 'Pan right', prompt: 'Camera pivots horizontally to the right from a fixed position.' },
+ { value: 'whip-pan', label: 'Whip pan', prompt: 'Camera whips sideways with strong directional motion blur.' },
+ { value: 'tilt-up', label: 'Tilt up', prompt: 'Camera pivots vertically upward from a fixed position.' },
+ { value: 'tilt-down', label: 'Tilt down', prompt: 'Camera pivots vertically downward from a fixed position.' },
+ { value: 'truck-left', label: 'Truck left', prompt: 'Camera travels laterally to the left on a parallel track.' },
+ { value: 'truck-right', label: 'Truck right', prompt: 'Camera travels laterally to the right on a parallel track.' },
+ { value: 'pedestal-up', label: 'Pedestal up', prompt: 'Camera rises vertically while keeping its angle and distance.' },
+ { value: 'pedestal-down', label: 'Pedestal down', prompt: 'Camera lowers vertically while keeping its angle and distance.' },
+ { value: 'crane-up', label: 'Crane up / high reveal', prompt: 'Camera cranes upward into a high-angle reveal.' },
+ { value: 'crane-down', label: 'Crane down / landing', prompt: 'Camera cranes down and settles near the subject.' },
+ { value: 'orbit-180', label: 'Orbit 180°', prompt: 'Camera makes a half-circle around the subject.' },
+ { value: 'orbit-360', label: 'Orbit 360°', prompt: 'Camera makes one complete circle around the subject.' },
+ { value: 'cinematic-arc', label: 'Slow cinematic arc', prompt: 'Camera follows a slow, wide curved path around the subject.' },
+ { value: 'reveal-from-behind', label: 'Reveal from behind', prompt: 'Camera slides from behind a foreground object to reveal the scene.' },
+ { value: 'fly-through', label: 'Fly-through', prompt: 'Camera passes through an opening and continues into the scene.' },
+ { value: 'following-shot', label: 'Following tracking shot', prompt: 'Camera follows behind the moving subject at matching speed.' },
+ { value: 'leading-shot', label: 'Leading tracking shot', prompt: 'Camera moves backward ahead of the subject at matching speed.' },
+ { value: 'side-tracking', label: 'Side tracking shot', prompt: 'Camera travels parallel beside the moving subject.' },
+ { value: 'steadicam-follow', label: 'Steadicam follow', prompt: 'Stabilized camera glides with the subject through the environment.' },
+ { value: 'handheld', label: 'Handheld documentary', prompt: 'Natural handheld drift and restrained shake create documentary immediacy.' },
+ { value: 'pov-walk', label: 'POV walk', prompt: 'First-person camera advances with subtle human head-bob.' },
+ { value: 'worm-eye-track', label: "Worm's-eye tracking", prompt: 'Ground-level camera tracks forward while looking up.' },
+ { value: 'drone-flyover', label: 'Drone flyover', prompt: 'High aerial camera flies forward over the environment.' },
+ { value: 'drone-reveal', label: 'Drone rise and reveal', prompt: 'Aerial camera rises and tilts down to unveil the larger scene.' },
+ { value: 'drone-orbit', label: 'Large-scale drone orbit', prompt: 'Aerial camera sweeps in a broad circle around the landscape.' },
+ { value: 'drone-dive', label: 'FPV drone dive', prompt: 'Fast first-person aerial camera dives down a vertical structure.' },
+ { value: 'top-down-twist', label: "Top-down / God's-eye twist", prompt: 'Camera looks straight down while slowly rotating.' },
+ { value: 'dutch-roll', label: 'Dutch roll', prompt: 'Camera rolls on its lens axis into a disorienting Dutch angle.' },
+ { value: 'barrel-roll', label: 'Barrel roll', prompt: 'Camera rotates a full turn on its lens axis while moving forward.' },
+ { value: 'rack-focus', label: 'Rack focus', prompt: 'Focus shifts decisively between foreground and background subjects; camera position stays fixed.' },
+ { value: 'focus-reveal', label: 'Reveal from blur', prompt: 'The shot begins fully defocused and gradually resolves to sharp focus.' },
+ { value: 'ots-drift', label: 'Over-the-shoulder drift', prompt: 'Camera holds an over-the-shoulder composition with a subtle lateral drift.' },
+ { value: 'push-past', label: 'Push past foreground', prompt: 'Camera pushes past a close foreground element to uncover the subject.' },
+ { value: 'slider-parallax', label: 'Slider parallax', prompt: 'A short lateral slider move creates controlled foreground-background parallax.' },
+ { value: 'body-mount', label: 'Body-mounted / SnorriCam', prompt: 'Camera stays rigidly mounted to the moving subject while the world swings behind them.' },
+ { value: 'bullet-time', label: 'Bullet-time orbit', prompt: 'Action nearly freezes while the camera moves around the moment.' },
+ { value: 'hyperlapse', label: 'Moving hyperlapse', prompt: 'Camera advances through accelerated time with compressed environmental motion.' },
+]);
+
+export const FABLELOOM_CAMERA_MOVEMENT_VALUES = Object.freeze(
+ FABLELOOM_CAMERA_MOVEMENTS.map(({ value }) => value),
+);
+
+export const fableLoomCameraMovementCatalogForPrompt = () => FABLELOOM_CAMERA_MOVEMENTS
+ .map(({ value, label, prompt }) => `- ${value} (${label}): ${prompt}`)
+ .join('\n');
diff --git a/server/lib/fableLoomCameraMovements.test.js b/server/lib/fableLoomCameraMovements.test.js
new file mode 100644
index 0000000000..a73d40371f
--- /dev/null
+++ b/server/lib/fableLoomCameraMovements.test.js
@@ -0,0 +1,16 @@
+import { describe, expect, it } from 'vitest';
+
+import {
+ FABLELOOM_CAMERA_MOVEMENTS,
+ FABLELOOM_CAMERA_MOVEMENT_VALUES,
+ fableLoomCameraMovementCatalogForPrompt,
+} from './fableLoomCameraMovements.js';
+
+describe('FableLoom camera movements', () => {
+ it('provides unique stable ids and usable prompt direction', () => {
+ expect(FABLELOOM_CAMERA_MOVEMENTS.length).toBeGreaterThanOrEqual(40);
+ expect(new Set(FABLELOOM_CAMERA_MOVEMENT_VALUES).size).toBe(FABLELOOM_CAMERA_MOVEMENTS.length);
+ expect(FABLELOOM_CAMERA_MOVEMENTS.every(({ value, label, prompt }) => value && label && prompt)).toBe(true);
+ expect(fableLoomCameraMovementCatalogForPrompt()).toContain('slider-parallax (Slider parallax)');
+ });
+});
diff --git a/server/lib/fableLoomLimits.js b/server/lib/fableLoomLimits.js
index 620cec6426..ca7e4dd4b9 100644
--- a/server/lib/fableLoomLimits.js
+++ b/server/lib/fableLoomLimits.js
@@ -24,6 +24,7 @@ export const LOOM_LIMITS = Object.freeze({
PROSE_MAX: 20000,
IMAGE_PROMPT_MAX: 2000,
VIDEO_PROMPT_MAX: 4000,
+ CAMERA_MOVEMENT_MAX: 80,
ENDING_LABEL_MAX: 200,
TRANSITIONS_MAX: 12,
INTENT_MAX: 120,
diff --git a/server/lib/fableLoomValidation.js b/server/lib/fableLoomValidation.js
index a890989c8c..fb04f261cb 100644
--- a/server/lib/fableLoomValidation.js
+++ b/server/lib/fableLoomValidation.js
@@ -123,6 +123,7 @@ const nodeFields = {
prose: z.string().max(LOOM_LIMITS.PROSE_MAX).optional(),
imagePrompt: z.string().max(LOOM_LIMITS.IMAGE_PROMPT_MAX).optional(),
videoPrompt: z.string().max(LOOM_LIMITS.VIDEO_PROMPT_MAX).optional(),
+ cameraMovement: z.string().max(LOOM_LIMITS.CAMERA_MOVEMENT_MAX).optional(),
isEnding: z.boolean().optional(),
endingLabel: z.string().max(LOOM_LIMITS.ENDING_LABEL_MAX).optional(),
pos: z.object({ x: z.number(), y: z.number() }).nullable().optional(),
diff --git a/server/lib/index.js b/server/lib/index.js
index c33434fc9b..63726e887f 100644
--- a/server/lib/index.js
+++ b/server/lib/index.js
@@ -81,6 +81,7 @@ export * from './creativeLatitude.js';
// discovery surface reaches EDITORIAL_CHECKS + the lookup helpers.
export * as editorial from './editorial/index.js';
export * from './fableLoomGraph.js';
+export * from './fableLoomCameraMovements.js';
export * from './fableLoomLimits.js';
export * from './fableLoomFormats.js';
export * from './scenePrompt.js';
diff --git a/server/services/fableLoom/records.js b/server/services/fableLoom/records.js
index 7307ed40e3..ca8de1da81 100644
--- a/server/services/fableLoom/records.js
+++ b/server/services/fableLoom/records.js
@@ -3,10 +3,10 @@
* transitions.
*
* A loom is a branching-narrative story: episodes hold a directed graph of
- * scene nodes; each node carries prose, an image prompt, rendered media, and a
- * list of intent-triggered transitions the play LLM matches against free-text
- * reader input. Legacy video prompts remain sanitized for compatibility, while
- * current clients use the scene text itself. All ids are server-minted. Every
+ * scene nodes; each node carries prose, image and single-clip video prompts,
+ * camera direction, rendered media, and a list of intent-triggered transitions
+ * the play LLM matches against free-text reader input. Legacy nodes without a
+ * video prompt still render from scene text. All ids are server-minted. Every
* write funnels through `mutateLoom` (per-record write queue + full re-sanitize),
* so a malformed mutation can never persist.
*/
@@ -69,6 +69,7 @@ function sanitizeNode(raw) {
image: isSafeImageFilename(raw.image) ? raw.image : null,
imageJobId: isStr(raw.imageJobId) && raw.imageJobId ? raw.imageJobId.slice(0, 200) : null,
videoPrompt: trimTo(raw.videoPrompt, LOOM_LIMITS.VIDEO_PROMPT_MAX),
+ cameraMovement: trimTo(raw.cameraMovement, LOOM_LIMITS.CAMERA_MOVEMENT_MAX),
videoHistoryId: isSafeVideoHistoryId(raw.videoHistoryId) ? raw.videoHistoryId : null,
isEnding: raw.isEnding === true,
// The format this scene's text is actually WRITTEN in — server-set, not
@@ -370,7 +371,7 @@ export function deleteEpisode(loomId, episodeId) {
// --- Nodes & transitions ----------------------------------------------------
-const NODE_PATCH_FIELDS = ['title', 'prose', 'imagePrompt', 'videoPrompt', 'isEnding', 'endingLabel', 'pos', 'transitions'];
+const NODE_PATCH_FIELDS = ['title', 'prose', 'imagePrompt', 'videoPrompt', 'cameraMovement', 'isEnding', 'endingLabel', 'pos', 'transitions'];
export function addNode(loomId, episodeId, fields = {}) {
return mutateLoom(loomId, (loom) => {
diff --git a/server/services/fableLoom/records.test.js b/server/services/fableLoom/records.test.js
index a74da45a9c..addd06c7db 100644
--- a/server/services/fableLoom/records.test.js
+++ b/server/services/fableLoom/records.test.js
@@ -82,6 +82,19 @@ describe('sanitizeLoom', () => {
expect(loom.episodes[0].startNodeId).toBe('n1');
});
+ it('preserves single-cut video direction and camera movement metadata', () => {
+ const loom = sanitizeLoom({
+ id: 'loom-1',
+ name: 'X',
+ episodes: [{ id: 'ep-1', nodes: [{
+ id: 'n1', videoPrompt: 'A figure turns as the camera arcs.', cameraMovement: 'cinematic-arc',
+ }] }],
+ });
+ expect(loom.episodes[0].nodes[0]).toMatchObject({
+ videoPrompt: 'A figure turns as the camera arcs.', cameraMovement: 'cinematic-arc',
+ });
+ });
+
it('defaults the scene format and keeps only a known one', () => {
expect(sanitizeLoom({ id: 'loom-1', name: 'X' }).format).toBe('prose');
expect(sanitizeLoom({ id: 'loom-1', name: 'X', format: 'teleplay' }).format).toBe('teleplay');
diff --git a/server/services/fableLoom/weave.js b/server/services/fableLoom/weave.js
index 2e564ba64f..d5f3e5b70a 100644
--- a/server/services/fableLoom/weave.js
+++ b/server/services/fableLoom/weave.js
@@ -19,6 +19,7 @@ import { isStr, trimTo } from '../../lib/storyBible.js';
import { resolveLlmRoutePin } from '../../lib/llmRoutePin.js';
import { renderCanonForPrompt } from '../../lib/universePromptRenderers.js';
import { analyzeEpisodeGraph, describeGraphForPrompt } from '../../lib/fableLoomGraph.js';
+import { fableLoomCameraMovementCatalogForPrompt } from '../../lib/fableLoomCameraMovements.js';
import { getUniverse } from '../universeBuilder.js';
import { LOOM_LIMITS, findEpisode, findNode, getLoom, mutateLoom } from './records.js';
import { asLoomFormat, loomFormatLabel, narrationFormatContract, sceneFormatContract } from './formats.js';
@@ -139,6 +140,8 @@ const generatedNodeFields = (raw) => ({
title: raw.title,
prose: raw.prose,
imagePrompt: raw.imagePrompt,
+ videoPrompt: raw.videoPrompt,
+ cameraMovement: raw.cameraMovement,
isEnding: raw.isEnding === true,
endingLabel: raw.endingLabel,
});
@@ -177,7 +180,7 @@ export function mapGeneratedGraph(parsed) {
}
export async function weaveEpisode(loomId, episodeId, {
- guidance = '', nodeTarget, endingTarget, replace = false, providerId, model, effort,
+ guidance = '', replace = false, providerId, model, effort,
} = {}) {
const loom = await requireLoom(loomId);
const episode = findEpisode(loom, episodeId);
@@ -189,8 +192,10 @@ export async function weaveEpisode(loomId, episodeId, {
storyContext: storyContext(loom, episode),
canonDigest: canonDigest || '(none — invent what the story needs)',
guidance: guidance || '(none)',
- nodeTarget: String(clamp(nodeTarget, 3, 60, 12)),
- endingTarget: String(clamp(endingTarget, 1, 12, 3)),
+ existingGraph: episode.nodes.length
+ ? describeGraphForPrompt(episode, { proseLimit: 4000 })
+ : '(none — create the episode from the story context)',
+ cameraMovementCatalog: fableLoomCameraMovementCatalogForPrompt(),
sceneFormatContract: sceneFormatContract(loom.format),
}, llmOptions({ providerId, model, effort }, 'fableloom-weave'));
@@ -225,6 +230,7 @@ export async function branchNode(loomId, episodeId, nodeId, {
sceneTitle: node.title || 'Untitled scene',
sceneProse: node.prose || '(no prose yet)',
branchCount: String(count),
+ cameraMovementCatalog: fableLoomCameraMovementCatalogForPrompt(),
guidance: guidance || '(none)',
sceneFormatContract: sceneFormatContract(loom.format),
}, llmOptions({ providerId, model, effort }, 'fableloom-branch'));
@@ -288,9 +294,9 @@ export async function reviewEpisode(loomId, episodeId, { providerId, model, effo
// --- Feedback: apply a conversational episode edit --------------------------
-const FEEDBACK_NODE_FIELDS = ['title', 'prose', 'imagePrompt', 'isEnding', 'endingLabel'];
+const FEEDBACK_NODE_FIELDS = ['title', 'prose', 'imagePrompt', 'videoPrompt', 'cameraMovement', 'isEnding', 'endingLabel'];
const FEEDBACK_TRANSITION_FIELDS = ['targetNodeId', 'intent', 'triggers', 'description'];
-const FEEDBACK_STRING_NODE_FIELDS = new Set(['title', 'prose', 'imagePrompt', 'endingLabel']);
+const FEEDBACK_STRING_NODE_FIELDS = new Set(['title', 'prose', 'imagePrompt', 'videoPrompt', 'cameraMovement', 'endingLabel']);
const hasOwn = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
@@ -372,6 +378,7 @@ export async function feedbackEpisode(loomId, episodeId, {
storyContext: storyContext(loom, episode),
canonDigest: canonDigest || '(none)',
graphDigest: describeGraphForPrompt(episode, { proseLimit: 1200 }),
+ cameraMovementCatalog: fableLoomCameraMovementCatalogForPrompt(),
feedback: instruction,
}, llmOptions({ providerId, model, effort }, 'fableloom-feedback'));
diff --git a/server/services/fableLoom/weave.test.js b/server/services/fableLoom/weave.test.js
index 1f2cffd23f..cabbb1f668 100644
--- a/server/services/fableLoom/weave.test.js
+++ b/server/services/fableLoom/weave.test.js
@@ -104,6 +104,10 @@ describe('weaveEpisode', () => {
expect(stage).toBe('fableloom-weave-episode');
expect(variables.storyContext).toContain('The Hollow Crown');
expect(variables.guidance).toBe('darker');
+ expect(variables.existingGraph).toContain('(none');
+ expect(variables.cameraMovementCatalog).toContain('slow-dolly-in');
+ expect(variables).not.toHaveProperty('nodeTarget');
+ expect(variables).not.toHaveProperty('endingTarget');
});
it('refuses to clobber a non-empty episode without replace', async () => {