Script ↔ Storyboard Link — Tasks
Companion: prd.md, design.md. Each phase ships alone. After any code change:
npm run typecheck && npm run lint && npm run test && npm run test:packages(scope package runs withnodetool affected).
Phase 1 — Link schema + extract script from storyboard
- Protocol: link fields. Add
script_idtoScreenplayandscript_line_ids,script_text_snapshot,duration_sourcetoShotinpackages/protocol/src/creative.ts; mirror in the zod shapes and key aliases inpackages/protocol/src/api-schemas/storyboards.ts. Tests: normalization round-trips camelCase aliases; old documents parse unchanged. - Protocol:
script-link.ts.extractScriptFromScreenplay+validateScriptLinkper design §2.1/§1.3, with unit tests covering speaker matching viaentitiesForShot,voice_idseeding, the shot→lines map, duplicate/dangling line references. - Script back-pointer. Nullable
storyboard_idon thescriptstable (packages/models/src/schema/scripts.ts+ migration),scriptResponse/patchScriptInputinpackages/protocol/src/api-schemas/scripts.ts, CAS patch in thescriptstRPC router. - Headless tool:
extract_script_from_storyboard. Inpackages/agents/src/capabilities/storyboards.ts(creates script row, stamps link, sets back-pointer,relinkre-projects). Tool-loop eval case inpackages/agents/src/evals/surfaces/storyboard.ts. - Web: extract + navigation.
ui_storyboard_extract_scriptinweb/src/lib/tools/builtin/storyboard.ts; Extract script / Open script in the storyboard header; Open storyboard in the script header. Deletion downgrade both directions (design §4). - Link validation on save. Wire
validateScriptLinkinto the storyboard normalize/save path; surface issues in both editors.
Phase 2 — Derive board from script + audio-led timing
- Protocol:
deriveShotScaffold. Inscript-link.tsper design §2.2, unit-tested (order, one-line-per-shot default, narration vs. dialogue projection). - Director variant. Scaffold-constrained director pass; normalizer
rejects responses that drop or reassign
script_line_ids(retry, then fall back to scaffold-only shots). Lives with the existing director prompt path used by the storyboard agent. - Headless tool:
derive_storyboard_from_script. Inpackages/agents/src/capabilities/scripts.ts; no-provider mode emits the deterministic scaffold. Eval case inpackages/agents/src/evals/surfaces/script.ts. - Timing.
linkedShotDurationMsinpackages/timeline/src/script-link.ts(design §2.3); storyboard editor and render tools read it whenduration_source !== "manual";ui_storyboard_set_duration_sourcetoggle + inspector control. - Web: derive.
ui_script_derive_storyboardinweb/src/lib/tools/builtin/script.ts; Create storyboard button in the script editor.
Phase 3 — Joint assemble
buildLinkedTimeline.packages/timeline/src/linked.tsper design §2.4. Unit tests: shot-aligned take starts, in-shot offsets with pauses, both linkage key families on voiceover clips, narration draft clip suppressed,skippedLineIds/skippedShotIds; regression fixtures proving unlinkedbuildStoryboardTimeline/buildScriptTimelineoutput is unchanged. Feed the built document to the timeline validator in tests.- Assemble switch.
assemble_storyboard_timeline(headless) andui_storyboard_assemble_timeline/ui_script_send_to_timeline(web) callbuildLinkedTimelinewhen linked; script-side button relabels to Assemble video. Re-assemble in place preserves foreign tracks (reuse the script re-assemble pattern). - Back-sync verification. Jest tests that a re-voiced line and a
revised shot both patch the same jointly-assembled sequence through
the existing
timelineSyncmodules, unmodified. - Creative-pipeline eval. Case: script → derive → render (stubbed
assets) → joint assemble →
validate_timelinegreen, inpackages/agents/src/evals/surfaces/creative-pipeline.ts.
Phase 4 — Drift, Studio, polish
- Drift helpers.
shotDialogueDrifted,orphanedLineIds(design §2.5) with tests; Re-project action updating snapshot + projected text in one CAS save. - Badges. Drift badge + Re-project in the shot inspector; orphan badge in the script gutter; linked-line panel (speaker chip, voice status, play, voice-from-board) in the shot inspector; keyframe thumbnail chips in the script gutter.
- Studio. Prompt-first flow derives script + board linked in one
pass; home groups linked documents into one project card
(
web/src/studio/). - Tool/summary surface.
get_storyboard/get_scriptreport link state, drift, and orphans (design §3.2). - Harness registry. Extend the storyboard/script surface entries in
packages/cli/src/harness/registry.tswith the new deterministic selfchecks;nodetool harness auditstays clean. - Docs. Update
docs/script-editor-concept.md(phase table) anddocs/agentic-video-product.md(reuse table, home cards) to reflect the link; move this feature’s status lines from Proposed to shipped per phase.