* Fix workflow draft handling, media previews, and exports * Align Explore spotlight regression tests with the launch order * Use a finite MCP response in the SPA routing regression * Seed soundtrack duration from the workflow brief --------- Co-authored-by: stevenguotj <stevenguotj@users.noreply.github.com>
12 KiB
Scenario Workflows
Workflows (backed by OpenMotion's scenario workflow contract) guide end-to-end production from a single creative idea through web pages, visual assets, video and motion films, audio, multi-platform social copy, and one downloadable ZIP package. Each workflow supports two modes in one workspace — Step by step (manual) for hands-on iterative creation and Agent mode (agent, ?mode=agent) for concise prompt + Skills delegation to an external MCP Agent — backed by shared versioned runs and a unified Assets collection.
Workflow taxonomy
Workflows are organized into three categories under Workflows in the top navigation (?page=scenarios), its hover mega popover, the Explore hero carousel, and the Workflows highlights rail:
| Category | Workflow / Scenario ID | Title | Ordered steps |
|---|---|---|---|
Topics (topic) |
motion-full-chain |
Idea to Motion Film | Brief → Storyboard → Motion film → Soundtrack → Social posts |
Topics (topic) |
gemini-4-neon |
Interactive Code Animation | Brief → Code animation → Key stills → Film & motion → Social posts |
Topics (topic) |
design-full-chain |
Landing Page & Launch Kit | Brief → Landing page → Page images → Embed images → Promo video → Social posts |
Campaigns (campaign) |
black-friday |
Black Friday Promo Kit | Brief → Product images → Detail page → 30s sales film → Social posts |
Roles (role) |
ai-influencer |
Virtual Creator Episode | Brief & script → Persona visuals → Link-in-bio page → Voiceover & audio → Talking video → Social posts |
Every step carries curated ScenarioSkillRef bindings (step.skills[]) identifying either a curated Studio library Skill (source: 'library', loaded via openmotion_get_skill(skillId)) or a workflow resource guide (source: 'workflow', loaded via MCP resources/read on resourceUri such as openmotion://workflow/*). Existing Studio destinations (Motion Studio, Design Studio, Cinema Studio, Model Hub, Black Friday collection, Template library, Skills) remain directly reachable from navigation and context links inside each workflow.
Dual workspace modes and Assets
Opening any workflow navigates to ?page=scenario&scenario=<id>[&run=<uuid>][&mode=agent][&step=<stepId>] (defaults to Step by step unless mode=agent is requested).
- Run header: displays the workflow cover, All workflows breadcrumb, workflow title and category badge, Workflow mode segmented switch (Step by step vs Agent mode), run switcher (create, rename or archive drafts), contextual Copy for Agent (header action in Step-by-step mode), desktop toggle to collapse/reopen Assets, and Export all (builds and downloads a full ZIP bundle directly).
- Agent mode (
?mode=agent,ScenarioAgentModeView.tsx): renders a clean two-column workspace:- Left column — Assets + Prompt & parameters: inline shared Assets panel at the top (so users can upload, import, select, pin, and inspect attached reference assets cleanly), paired below with a Prompt & parameters composer featuring one-click
Try:brief presets, Clear, a large natural-languagePrompttextarea, primary scenario fields, and progressive-disclosure secondary parameters (More parameters / Hide parameters) synchronized directly to the persisted run brief, plus a direct Switch to step by step link. - Right column — Copy for Agent + Skills workflow: centers the primary Copy for Agent CTA (auto-creating a persisted run when invoked on an unsaved draft and copying compact output from
scenarioConcisePrompt), quick Sync and MCP guide actions, a Preview prompt / Hide prompt toggle inspecting the generated concise instructions, and a grouped Skills workflow timeline displaying every step'sScenarioSkillRefchips (role,id, version count, status) with direct click-through (Open {step} in step-by-step mode).
- Left column — Assets + Prompt & parameters: inline shared Assets panel at the top (so users can upload, import, select, pin, and inspect attached reference assets cleanly), paired below with a Prompt & parameters composer featuring one-click
- Step by step mode (
manual): combines the non-linear step navigation rail (Workflow steps, allowing direct jumps to any step with sensible upstream default bindings and without locking downstream steps), a single guided brief/creation workbench (Generate media for direct image/video/audio generation into Assets via configured providers, Copy MCP prompt, MCP guide, Sync, progressive disclosures for reuse/templates, live preview, per-step export actions, and Version historyv1…vn), and the collapsible Assets sidebar. - Assets collection & pinning: docked on the right at desktop widths (
>= 1100px) in Step-by-step mode (240–520pxresizable drawer, opaque medium-width drawer768–1099px, mobile bottom sheet< 768px) or placed inline at the top left in Agent mode. Empty zero-count filter chips stay hidden until populated. Supports single, multi-select (Select), and bulk Import / Export (Export all,Export selected,Export filtered). Every uploaded, imported, or generated asset is stored as a pinned reference (assetId/versionId, DesignprojectId/revision, MotionprojectId/sessionId) without duplicating media bytes; Remove from workflow unbinds only the workflow reference without deleting workspace assets. - Automatic cross-tab sync: window focus, tab
visibilitychangeback tovisible, and manual Sync actions refresh the active run and highlight newly added items in Assets.
Export and packaging
- Per-step export: every step header offers a lightweight menu for immediate deliverables (HTML/ZIP for Design pages, direct downloads for active media files, Markdown/JSON copy or download for social packs and briefs, editor links, and step-scoped ZIP packages).
- Single, multi-select, filtered, and full bundle export: Assets and top-bar Export all build validated ZIP archives via
openmotion_assets_use(action="scenario", scenario={ command: "export", poolItemIds?: [...], ... })and stream them fromGET /motion-api/scenarios/bundles/:id/file. A full bundle containsmanifest.json,README.md,brief/, unpackedweb/<step-id>/pages (with embedded localassets/*paths that open from disk), optional standalone HTML, pinnedmedia/outputs,social/posts,motion/project links, and optional Motion source archives; passingpoolItemIdspackages only the chosen items alongsidemanifest.json. Studio's Export all includes media from previous iterations by default. The ZIP uses the localized draft title, and media files use their displayed titles with their original version numbers and file extensions. Enable Active outputs only in the Assets export options to restrict which iteration outputs are included. When present, the saved script and social copy match the versions shown in Studio. A newer brief or asset-only version still leaves those files and the copy's attached media available for export.
MCP and Agent integration
Workflows preserve the twenty-two registered phase-one MCP tool names and share one backend domain service (gateway/scenario-runs.ts) across Studio and external Agents:
- Workflow / scenario orchestration:
openmotion_assets_usewithaction="scenario"exposescatalog,list,get,create,update_run,update_brief,update_step,add_pool,update_pool,remove_pool,add_iteration,generate,sync,cancel,promote,create_page,embed_image,link_design,create_motion,link_motion, andexport. Mutations carry explicitrunId,expectedRevision, and a stablerequestId;add_poolaccepts optionalrecordIteration=trueandnoteto write Agent-processed workspace assets back into both Assets and the target step's version history atomically. - Concise Skills handoff (
scenarioConcisePrompt&ScenarioSkillRef): in Agent mode (?mode=agent), clicking Copy for Agent (or inspecting Preview prompt) formats compact[Metadata],[Task & Parameters],[Skills Pipeline], and[Instructions]viascenarioConcisePromptinshared/scenarios.ts. Instead of repeating prose instructions per step, it lists each step's Skills cleanly aslibrary:<skillId>(loaded by the Agent viaopenmotion_get_skill(skillId)) orresource:<resourceUri>(loaded via MCPresources/read, e.g.,openmotion://workflow/*).scenarioSkills(scenario)exposes the deduplicated Skill list per workflow. - Step-scoped MCP write-back:
scenarioAgentPromptandscenarioRunAgentPromptinshared/scenarios.tscontinue to power per-step Copy MCP prompt, Step-by-step Copy for Agent, and the MCP · Connect Agent handbook (Run a workflow and save back to Assets). Copying from a fresh draft creates and persists the run first so every copied instruction carriesrunId,expectedRevision,stepId(when step-scoped), attached Assets, and exact MCP write-back commands (generate+sync,add_poolwithrecordIteration=true,add_iteration,link_design,link_motion,update_brief). - Binary image embedding into HTML projects:
openmotion_design_editwithaction="import_asset"(andPOST /motion-api/design/projects/:id/import-asset) copies a pinned workspace asset version into a Design Studio project viaDesignProjects.importBinaryFile(), creating a new revision-checkedvNsnapshot and returning its project-relative path.
Workflow audio and video generation saves assets as Draft title · Step name vN. The optional generate.locale localizes the step name and the default draft name. Studio passes the current interface locale, and external callers can omit it to use the saved draft locale. Custom draft names are used as entered.
See MCP Phase 1 tools and Product architecture for contract details.
Capability boundaries
- No built-in text or design LLM: offline starter HTML pages, script outlines, and multi-platform social drafts are deterministic templates seeded from your brief. AI-authored HTML pages and copy come from your connected external Agent via the shared Skills handoff prompt.
- Provider-backed media generation: image, video, speech, and music generation use your configured providers in Model providers (OpenDesign account or BYOK). When no compatible model is configured, steps show a setup panel alongside offline upload, workspace-asset import, and Agent handoff alternatives without fabricating results.
- Export-only social packs: social posts are drafted, edited, copied, and exported as Markdown/JSON/text files; OpenMotion does not publish directly to social platforms.
- Distinct verification evidence: automated unit/DOM checks, browser visual checks across light/dark themes and viewports, paid model generation, and human visual acceptance remain separate evidence.
Adding a new Topic, Campaign or Role workflow
Navigation, Explore, the Workflows hub, the MCP catalog, and run persistence all read from the shared registry. Adding a new workflow requires four changes:
- Register the definition in
shared/scenarios.ts(scenarioDefinitions), specifyingid,category(topic | campaign | role),title,subtitle,description,icon,links,briefFields, and orderedsteps(referencing validstudioScenesIDs,RemixIconnames frompackages/design-system/icons.svg, andskills: ScenarioSkillRef[]entries pointing to curatedlibrarySkills orworkflowresource URIs). - Add a local cover mapping in
studio/src/scenario/scenarioCovers.ts. - Add translations across all 10 non-English locales in
studio/src/i18n/scenario-ui.json— covering title, subtitle, description, fields, steps, and everyskill.label/skill.role(preserving{placeholders},openmotion_*tool names, and using项目rather than工程inzh-CN). - Optionally add a starter page recipe in
shared/scenario-content.tsif the scenario introduces a newPageRecipeId.
Validate changes with:
npm run check
npm run design:check
npm run typecheck:backend
npm run typecheck:studio
npm run test:studio -- src/i18n src/motion/ScenarioNavigation.test.tsx src/motion/WorkspacePageNavigation.test.tsx src/motion/workspacePageRouting.test.ts
node --experimental-strip-types --test tests/mcp-onboarding.test.ts tests/scenario-runs.test.ts tests/scenario-content.test.ts tests/scenario-bundle.test.ts