mirror of
https://github.com/nexu-io/openmotion.git
synced 2026-12-07 01:17:35 +08:00
* feat(game-static-play): add 274-template R2 zip packaging, cookieless static play deploy, and verification pipeline * feat(game-skill): port 21-section OpenGame skill with dual-mode workflow and fast-play path * feat(onboarding): upgrade Cloud MCP install guide and add shared OpenGame prompt builders * feat(game-catalog): sync 274 official templates, 4 kits, downloads manifest, and game contract * feat(cloud-mcp): add read-only game catalog, free asset search, guest catalog API, redirects, and Docker packaging * feat(opengame): enable Stage 1 Game Studio routing, feature flags, and analytics * feat(opengame): add Stage 1 market, multi-client modal, Cursor HTTP fix, SuperAgent prompt, and i18n * fix(opengame): align nullable GameCardWithMeta fields and add opengame-catalog MCP capability * test(mcp-onboarding): update registered public tool count from 22 to 24 for Stage 1 game tools * chore(game-catalog): register 26 verified live R2 in-repo template bundles in game-downloads.json * fix(opengame): address Stage 1 review feedback and failing CI lanes - Send no play URL when GAME_PLAY_PUBLIC_ORIGIN is unset instead of a main-site path that no route serves; Studio falls back to bundled in-repo templates - Keep legacy-host 301 redirects on the configured origin for network-path inputs - Correct the BlenderKit page host in the asset search allowlist - Reuse the shared withdrawn list, TOP earning tag, curated order and comparator in Studio - Remove the unused shared prompt module; the shipped builders stay covered by Studio tests - Drop the blurred launch backdrop and the in-dialog copy notices in favour of Toasts - Describe the shipped read-only Game Studio boundary and 24-tool MCP contract in the architecture - Schedule the game skill and static play suites in CI and budget the three OpenGame events * fix(game-static-play): retry stalled template bundle downloads before failing the run * fix(game-asset-search): size the pagination cursor limit for every supported query A 200-unit query with non-ASCII, control or lone-surrogate characters produced a cursor longer than the 512-character limit, so nextCursor was rejected by both the decoder and the public schema. Share one limit derived from the worst-case JSON/base64url expansion and add a round-trip test for maximum-length queries. * fix(game-asset-search): accept BlenderKit pages on www.blendkit.com and guide licence checks www.blenderkit.com now redirects to www.blendkit.com and the upstream catalog returns that host, so requiring www.blenderkit.com dropped every BlenderKit result. Restore the live host, pin a real upstream row in tests, and tell Agents to confirm the licence on the source page when a source omits it. * fix(deploy): forward game play origin and legacy redirect hosts to the API deploy/.env.example and deploy/k8s/configmap.yaml declared GAME_PLAY_PUBLIC_ORIGIN and APP_REDIRECT_FROM_HOSTS, but neither the compose api service nor the reference api Deployment passed them to the process. Wire both and assert that every reference ConfigMap key is read by a workload. * Address review: keep legacy-host writes, enforce play-origin isolation, share catalog constants - Legacy-host redirects answer GET/HEAD with 301 and every other method with 308, so MCP and API writes keep their method and body. - parseConfig rejects a GAME_PLAY_PUBLIC_ORIGIN that is not https (loopback http excepted), carries a path, or shares or sits under the APP_PUBLIC_ORIGIN host. - The template id pattern, bundle key prefix, withdrawn set and TOP tag predicate live in shared/game-contract.ts; static play, deploy/verify scripts and the catalog service reuse them and the shared bundle URL builder. - Remove unused game-contract and model-catalog exports. - Update the MCP contract, AGENTS.md, README and docs to the 24-name phase-one surface and document the read-only OpenGame tools and guest catalog routes. * fix(game-static-play): make the full play-site upload resumable Upload through the S3 SDK instead of one aws CLI process per file, skip objects whose ETag already matches the local MD5, retry each request with backoff, and write assets before entry pages and the manifest. Give large bundle downloads time for a slow link. Record the provisioned bucket, domain and remaining header rule in the runbook. * feat(game-static-play): harden live play verification and add manual R2 publish workflow * fix(opengame): raise prompt/remix maxLength for >4k OG-13 test and reset notes on target change * fix(mcp): register resources/templates/list handler for Codex MCP compliance * chore(game-catalog): register uploaded tidebreaker bundle for 274/274 R2 CDN parity --------- Co-authored-by: heggria <bshengtao@gmail.com>
77 lines
12 KiB
Markdown
77 lines
12 KiB
Markdown
# 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-language `Prompt` textarea, 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's `ScenarioSkillRef` chips (`role`, `id`, version count, status) with direct click-through (`Open {step} in step-by-step mode`).
|
|
- **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 history** `v1…vn`), and the collapsible **Assets** sidebar.
|
|
- **Assets collection & pinning:** docked on the right at desktop widths (`>= 1100px`) in Step-by-step mode (`240–520px` resizable drawer, opaque medium-width drawer `768–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`, Design `projectId/revision`, Motion `projectId/sessionId`) without duplicating media bytes; **Remove from workflow** unbinds only the workflow reference without deleting workspace assets.
|
|
- **Automatic cross-tab sync:** window focus, tab `visibilitychange` back to `visible`, 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 from `GET /motion-api/scenarios/bundles/:id/file`. A full bundle contains `manifest.json`, `README.md`, `brief/`, unpacked `web/<step-id>/` pages (with embedded local `assets/*` paths that open from disk), optional standalone HTML, pinned `media/` outputs, `social/` posts, `motion/` project links, and optional Motion source archives; passing `poolItemIds` packages only the chosen items alongside `manifest.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-four 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_use` with `action="scenario"` exposes `catalog`, `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`, and `export`. Mutations carry explicit `runId`, `expectedRevision`, and a stable `requestId`; `add_pool` accepts optional `recordIteration=true` and `note` to 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]` via `scenarioConcisePrompt` in `shared/scenarios.ts`. Instead of repeating prose instructions per step, it lists each step's Skills cleanly as `library:<skillId>` (loaded by the Agent via `openmotion_get_skill(skillId)`) or `resource:<resourceUri>` (loaded via MCP `resources/read`, e.g., `openmotion://workflow/*`). `scenarioSkills(scenario)` exposes the deduplicated Skill list per workflow.
|
|
- **Step-scoped MCP write-back:** `scenarioAgentPrompt` and `scenarioRunAgentPrompt` in `shared/scenarios.ts` continue 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 carries `runId`, `expectedRevision`, `stepId` (when step-scoped), attached **Assets**, and exact MCP write-back commands (`generate` + `sync`, `add_pool` with `recordIteration=true`, `add_iteration`, `link_design`, `link_motion`, `update_brief`).
|
|
- **Binary image embedding into HTML projects:** `openmotion_design_edit` with `action="import_asset"` (and `POST /motion-api/design/projects/:id/import-asset`) copies a pinned workspace asset version into a Design Studio project via `DesignProjects.importBinaryFile()`, creating a new revision-checked `vN` snapshot 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](mcp-phase1-tools.md) and [Product architecture](product/architecture.md#scenario-workflows) 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:
|
|
|
|
1. **Register the definition** in `shared/scenarios.ts` (`scenarioDefinitions`), specifying `id`, `category` (`topic | campaign | role`), `title`, `subtitle`, `description`, `icon`, `links`, `briefFields`, and ordered `steps` (referencing valid `studioScenes` IDs, `RemixIcon` names from `packages/design-system/icons.svg`, and `skills: ScenarioSkillRef[]` entries pointing to curated `library` Skills or `workflow` resource URIs).
|
|
2. **Add a local cover mapping** in `studio/src/scenario/scenarioCovers.ts`.
|
|
3. **Add translations across all 10 non-English locales** in `studio/src/i18n/scenario-ui.json` — covering title, subtitle, description, fields, steps, and every `skill.label` / `skill.role` (preserving `{placeholders}`, `openmotion_*` tool names, and using `项目` rather than `工程` in `zh-CN`).
|
|
4. **Optionally add a starter page recipe** in `shared/scenario-content.ts` if the scenario introduces a new `PageRecipeId`.
|
|
|
|
Validate changes with:
|
|
|
|
```bash
|
|
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
|
|
```
|