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's fal.ai browser handoff keeps the linked universe style

Claude293aa0c475f9
diff --git a/client/src/pages/FableLoomStory.jsx b/client/src/pages/FableLoomStory.jsx
index 299f4d73ac..076e82ffd0 100644
--- a/client/src/pages/FableLoomStory.jsx
+++ b/client/src/pages/FableLoomStory.jsx
@@ -49,6 +49,8 @@ import {
} from '../components/fableloom/sceneMediaRequests';
import { fableLoomMediaReadiness } from '../lib/fableLoomReadiness';
import { buildFalH3MaxPrompt } from '../lib/falVideoHandoff';
+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 {
@@ -172,6 +174,12 @@ export default function FableLoomStory({ view = 'graph' }) {
const episode = seriesPlanOpen ? null : loom?.episodes.find((e) => e.id === episodeId) || null;
const node = episode?.nodes.find((n) => n.id === nodeId) || null;
+ // The fal.ai browser handoff types its prompt straight into fal's form, with no
+ // server compile, so it adds the linked universe and series style itself.
+ const falStylePreset = useMemo(
+ () => universeStylePreset(linkedUniverse, linkedSeries),
+ [linkedSeries, linkedUniverse],
+ );
const mediaReadiness = useMemo(
() => fableLoomMediaReadiness(loom, episode),
[loom, episode],
@@ -365,7 +373,8 @@ export default function FableLoomStory({ view = 'graph' }) {
const request = buildFableLoomVideoRequest({
loom, episodeId, node: targetNode,
});
- const fullPrompt = buildFalH3MaxPrompt(request.prompt, request.negativePrompt);
+ const styled = composeStyledPrompt(request.prompt, request.negativePrompt, falStylePreset);
+ const fullPrompt = buildFalH3MaxPrompt(styled.prompt, styled.negativePrompt);
const render = asFableLoomRenderSettings(loom?.renderSettings);
setSceneMediaJob(targetNode.id, 'video', {
jobId: null,
@@ -393,7 +402,7 @@ export default function FableLoomStory({ view = 'graph' }) {
setSceneMediaJob(targetNode.id, 'video', { ...queued, jobId: queued.id });
toast.success(queued.status === 'queued' ? 'fal.ai scene video queued' : 'fal.ai scene video already running');
return queued;
- }, [episodeId, generationDisabledReason, loom, mediaReadiness.reason, mediaWorkflowBlocked, setSceneMediaJob, styleContextLoading, styleContextUnavailable]);
+ }, [episodeId, falStylePreset, generationDisabledReason, loom, mediaReadiness.reason, mediaWorkflowBlocked, setSceneMediaJob, styleContextLoading, styleContextUnavailable]);
const basePath = `/fableloom/${loomId}`;
const episodePath = useCallback(
diff --git a/client/src/pages/FableLoomStory.test.jsx b/client/src/pages/FableLoomStory.test.jsx
index a73f47534c..f4b392fd8a 100644
--- a/client/src/pages/FableLoomStory.test.jsx
+++ b/client/src/pages/FableLoomStory.test.jsx
@@ -573,4 +573,30 @@ describe('FableLoomStory scene media lifecycle', () => {
expect(screen.getByTestId('canvas-video-status')).toHaveTextContent('idle');
expect(toastMocks.success).toHaveBeenCalledWith('Scene video ready from fal.ai');
});
+
+ // Uniquely catches the fal.ai browser handoff, which has no server compile, losing a
+ // linked loom's universe style and avoid list (#11317).
+ it('hands fal.ai a linked loom\'s universe style and avoid list', async () => {
+ const user = userEvent.setup();
+ api.getLoom.mockResolvedValue(loom({
+ universeId: 'universe-1',
+ episodes: [episode({
+ nodes: [{
+ id: 'node-1', title: 'Threshold', prose: 'You stand before the first door.',
+ videoPrompt: 'The door opens.', image: 'threshold.png', transitions: [],
+ }],
+ })],
+ }));
+ api.getUniverse.mockResolvedValue({ id: 'universe-1', influences: { embrace: ['painted ink'], avoid: ['photorealism'] } });
+ api.startLoomFalVideo.mockResolvedValue({ id: 'fal-job-1', source: 'fal-browser', loomId: 'loom-1', episodeId: 'ep-1', nodeId: 'node-1', status: 'queued' });
+ renderEditor('/fableloom/loom-1/ep-1');
+
+ await user.click(await findEnabledByRole('button', { name: 'Canvas automate fal.ai' }));
+
+ await waitFor(() => expect(api.startLoomFalVideo).toHaveBeenCalledWith(
+ 'loom-1', 'ep-1', 'node-1',
+ { prompt: 'painted ink. The door opens.\n\nAvoid: photorealism', aspectRatio: '16:9' },
+ { silent: true },
+ ));
+ });
});