The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.
TypeScript agent-skillsagentic-aiai-agentsai-videobyokclaude-codecodexdeepseek-harnessdsh-plugingenerative-ailocal-firstmcpmotionmotion-graphicsmultimodalopenmotionreverse-engineeringvideo-editingvideo-generationworkbuddy
fix(preview): complete visible editor delivery after video creation
罗高61f82096947a
diff --git a/docs/mcp-phase1-tools.md b/docs/mcp-phase1-tools.mdindex ae47f037..c1f2420f 100644--- a/docs/mcp-phase1-tools.md+++ b/docs/mcp-phase1-tools.md@@ -52,9 +52,9 @@ Default action=open accepts an explicit projectId or bound sessionId, optional ePreview and export preflight use the same pinned native `host:"studio"` lint policy as the editor. Structural errors return `PROJECT_VALIDATION_FAILED` before preview opening, or a failed export before rendering, with native code/file/location/fix hints. Warnings do not fail the check. See the [shared lint command](hyperframes.md).-The handoff preserves the current chat by default (presentation=foreground): reuse its native Tab and queue while inactive. On return, resolve the latest project version without replaying the queued version. Codex actions include a calling-chat-only visibilitySync and bounded observation instructions; queued alone is not confirmation. Only an explicit presentation=now request allows switching back for this turn; background skips presentation. See the shared [continuing-edit workflow](../skills/motion-production/references/native.md#continuing-edits).+The handoff preserves the current chat by default (presentation=foreground): reuse its native Tab and queue while inactive. On return, resolve the latest project version without replaying the queued version. Codex actions include a calling-chat-only visibilitySync and bounded observation instructions; queued alone is neither confirmation nor proof that the calling chat is inactive. First delivery follows the same checks as continued edits. A separate hidden automation tab, markDeliverable or completed MP4 export does not satisfy editor delivery. Retry a missing native tab presentation once, then report the display gap. Only an explicit presentation=now request allows switching back for this turn; background skips presentation. See the shared [continuing-edit workflow](../skills/motion-production/references/native.md#continuing-edits).-action=record_display requires projectId, requestId and display={revision,versionId,previewUrl,visibility,contentVerified,evidence}; optional hostStatus and hostTabId retain the acknowledgment and actual native providerTabId independently. Only visible plus inspected latest content returns confirmed. Hidden/queued/unavailable or unverified content remains pending. Reject foreign project/session/origin URLs and stale revision/version identities, including same-hash restores and retries. Records are host_reported; motion_get_project.previewDisplay exposes isCurrentVersion and liveVisibilityVerified=false, never a live visibility claim.+action=record_display requires projectId, requestId and display={revision,versionId,previewUrl,visibility,contentVerified,evidence}; optional hostStatus and hostTabId retain the acknowledgment and actual native providerTabId independently. Only visible plus inspected latest content returns confirmed. Hidden/queued/unavailable or unverified content remains pending. visibility=queued explicitly reports host-confirmed inactive-chat deferral and returns wait_for_calling_chat; hostStatus=queued with visibility=hidden/unavailable retains present_preview recovery rather than assuming inactivity. Reject foreign project/session/origin URLs and stale revision/version identities, including same-hash restores and retries. Records are host_reported; motion_get_project.previewDisplay exposes isCurrentVersion and liveVisibilityVerified=false, never a live visibility claim.motion_edit_project and motion_restore_version accept the same optional presentation and return a fresh version-bound previewHandoff after each save or replay. The host owns persistent background preferences; show-now permission does not persist. Stored native Tab IDs are reuse hints that must be validated against the current host inventory. A host queue can open on return without another model turn; absent a new observation the service receipt stays pending.diff --git a/docs/product/architecture.md b/docs/product/architecture.mdindex c4bbff59..4d4717e7 100644--- a/docs/product/architecture.md+++ b/docs/product/architecture.md@@ -129,7 +129,7 @@ README 参考 OpenDesign 的产品导览和 HTML Anything 的贡献、来源表1. The user creates a blank project or opens an existing one from the sidebar, asks an external Agent to create a project, or chooses a template in the editor. Bundled templates create independent project copies; external references require Agent reconstruction.2. The Agent uses the existing MCP integration and verifies the selected project, revision and workflow. Integration setup remains available outside the MVP editor. Successful Agent-led installation returns the canonical reply rules from `docs/install.md` plus bounded real catalog summaries in the setup result, without waiting for the first MCP use. The Agent defaults to one eligible template; explicit comparison requests can receive three confirmed candidates. Acceptance preserves that exact choice and creates one independent editable project; refusal stops. Registration does not prove active-chat loading or that an invitation was actually displayed. No invitation telemetry/state service is introduced. Follow the [first-run defaults](../../skills/motion-production/references/templates.md#first-run-experience-defaults) for creation and delivery.-3. `motion_open_preview({projectId})` opens the project directly. Project switching waits for pending saves and reloads the document to release the previous edit session. Opening a bookmark warms only its scoped native context without switching other editor tabs. Rendering and write conflicts continue to block unsafe switches. Original creation, reference recreation and template production automatically open the saved project before delivery; the open editor is the deliverable, and video files are handed over only when requested (video-to-template still delivers its template ZIP). Continued edits and restores return a project/revision/version-bound previewHandoff. Reuse the native project tab: present it when the calling chat is active, otherwise queue it without switching chats and resolve the latest version when the user returns. Only this turn's explicit `presentation=now` request permits switching back; explicit background requests suppress presentation. Codex IAB synchronizes visibility within the calling chat. A queued acknowledgment is separate from observed visibility and live-content freshness; `record_display` rejects stale content identities, and stored previewDisplay remains historical host-reported evidence. The shared [editable preview handoff](../../skills/motion-production/references/native.md#editable-preview-handoff) defines readiness, host checks and capability limitations.+3. `motion_open_preview({projectId})` opens the project directly. Project switching waits for pending saves and reloads the document to release the previous edit session. Opening a bookmark warms only its scoped native context without switching other editor tabs. Rendering and write conflicts continue to block unsafe switches. Original creation, reference recreation and template production automatically open the saved project before delivery; the open editor is the deliverable, and video files are handed over only when requested (video-to-template still delivers its template ZIP). Continued edits and restores return a project/revision/version-bound previewHandoff. Reuse the native project tab: present it when the calling chat is active, otherwise queue it without switching chats and resolve the latest version when the user returns. Only this turn's explicit `presentation=now` request permits switching back; explicit background requests suppress presentation. Codex IAB synchronizes visibility within the calling chat. A queued acknowledgment does not establish chat inactivity: hidden/unavailable panels retain presentation recovery, and only host-confirmed inactive-chat deferral waits for return. First delivery uses the same visibility checks; hidden automation playback, markDeliverable and export success do not complete editor delivery. A queued acknowledgment is separate from observed visibility and live-content freshness; `record_display` rejects stale content identities, and stored previewDisplay remains historical host-reported evidence. The shared [editable preview handoff](../../skills/motion-production/references/native.md#editable-preview-handoff) defines readiness, host checks and capability limitations.4. Agent 根据本轮目标直接选择 Skill:motion-director 负责原创、局部/整体叙事动作声音重新设计和创作审片;motion-template-to-video 负责已有模板出片;motion-recreate 负责参考作品重建(已接入实际流程、独立参考与测量脚本);motion-video-to-template 负责可复用模板生产;motion-production 承接既定决定下的工程操作、预览、技术检查、排错和导出。共享规则同源引用,已有 production/start 保留导航,无需前置总路由。项目来源与画面锁定不固定入口;保持项和已完成操作继续有效。5. The Agent imports or generates media through the existing backend. In the editor, the user imports assets, edits text/solid color/opacity, previews, and edits clips on the timeline. Element, clip, time-range and official animation-library Ask Agent entry points are hidden in the MVP; users can continue requesting edits through their external Agent. Text controls include headings with explicit line breaks and preserve those breaks when edited. The MVP omits the layer-count heading and Add text field controls. Unselected off-canvas elements have no dashed markers in the MVP preview; selecting an element, including from Layers, retains its selection boundary. Text selections omit the separate Style group and background-fill control; element opacity remains in Text. For opacity-animated elements, the MVP opacity control saves an independent CSS filter multiplier, retaining the authored fade and existing static filters rather than writing over the animated opacity channel. The multiplier is part of project source, so preview and export use the same value. Other element types retain their Style controls. Generation, image replacement, advanced style/animation controls, code and inspector Layout settings are hidden without rewriting existing source content or removing Agent capabilities.6. 完成画面、文案、声音检查后,按用户要求导出固定 revision 的快照,等待真实产物并验证。diff --git a/docs/product/changes.md b/docs/product/changes.mdindex 1d4e0f17..c0096db4 100644--- a/docs/product/changes.md+++ b/docs/product/changes.md@@ -1,5 +1,12 @@# 公开变更记录+## 2026-11-12: Complete visible editor delivery after video creation++- **Problem:** A queued host acknowledgment with a hidden panel could send an Agent into waiting for the user to return without evidence that the calling chat was inactive. A separate hidden inspection tab or successful MP4 export could then end the turn without visible editor delivery.+- **Implementation:** Hidden/unavailable display receipts retain native-panel presentation recovery and its tab reuse hint. Only explicit host-confirmed inactive-chat deferral returns the wait action. First delivery follows the same visibility and latest-content checks as continued edits, and unresolved display failures remain visible in the final handoff.+- **Validation:** 47 targeted contract, workflow, adapter and packaging tests passed, alongside static checks, Studio type checking and the Studio build. Regression coverage separates queued acknowledgments from observed visibility, preserves inactive-chat deferral and verifies that the updated Skill and Tool sources ship together.+- **Limits:** Original-machine host reproduction and a new model-driven video creation/handoff acceptance run remain unverified. The service records host-reported evidence; it does not independently measure the outer host panel. This change does not publish a package.+## 2026-11-11: Check historical media before offering MCP restoration- **Problem and audience:** Agents and creators could be told that a historical version was restorable after its media blobs had disappeared; restoration then exposed a low-level file-copy error.diff --git a/phase1.ts b/phase1.tsindex 0c9987dc..e61bab36 100644--- a/phase1.ts+++ b/phase1.ts@@ -30,10 +30,10 @@ function previewHandoff(origin: string, target: { projectId: string; sessionId:const background = presentation === 'background';const now = presentation === 'now';const onReturn = { tool: 'motion_open_preview', arguments: { projectId: target.projectId } };- const deferred = !now && display?.visibility !== 'visible' && (display?.hostStatus === 'queued' || display?.visibility === 'queued');+ const deferred = !now && display?.visibility === 'queued';const recovery = now ? { when: 'hidden_after_queued_ack', tool: 'navigate_to_codex_page', scope: 'calling_chat_only',threadIdFrom: 'open_in_codex.response.threadId', then: 'present_same_tab_and_recheck_visibility' } :- { when: 'calling_chat_not_visible', operation: 'wait_for_calling_chat', onReturn };+ { when: 'calling_chat_confirmed_inactive', operation: 'wait_for_calling_chat', onReturn };return { ...target, previewUrl, placement: 'right', reuseExistingTab: true, presentation,focusPolicy: background ? 'background' : now ? 'switch_to_calling_chat' : 'preserve_current_chat',state: background ? 'background' : confirmed ? 'confirmed' : 'pending', openedByHost: confirmed,@@ -41,7 +41,7 @@ function previewHandoff(origin: string, target: { projectId: string; sessionId:nextAction: background || confirmed ? null : deferred ? { kind: 'host', operation: 'wait_for_calling_chat', onReturn } : prepared ? { kind: 'host', operation: 'present_preview',previewUrl, placement: 'right', reuseExistingTab: true, codex: { tool: 'open_in_codex', arguments: {placement: 'right', target: { type: 'browser', url: previewUrl, ...(hostTabId ? { tabId: hostTabId } : {}) } },- tabIdentity: 'Validate any stored Tab ID against the current host inventory; reuse the actual native host Tab ID (providerTabId), never a CUA wrapper id. After presenting, rebind the matching native panel tab before observing visibility; a hidden browser-use tab is separate.',+ tabIdentity: 'Validate any stored Tab ID against the current host inventory; reuse the actual native host Tab ID (providerTabId), never a CUA wrapper id. After presenting, rebind the matching native panel tab before observing visibility. A separate visible:false or browser-use: automation tab and markDeliverable do not satisfy presentation; if the native project tab is missing, retry the same host presentation once, then report the gap.',visibilitySync: { capability: 'visibility', method: 'set', value: true,when: 'after_binding_native_tab', scope: 'calling_chat_only', navigation: false },observation: { visibility: 'get', settleTimeoutMs: 6000, content: 'latest_live_preview', recheckVisibilityAfterContent: true },@@ -49,8 +49,8 @@ function previewHandoff(origin: string, target: { projectId: string; sessionId:projectId: target.projectId, expectedRevision: target.revision, expectedVersionId: target.versionId, presentation } },instructions: background ? 'Keep this edit in the background as explicitly requested by the user.' :(now ? 'The user explicitly requested immediate display for this turn; current-chat recovery may navigate to the calling chat. ' :- 'Preserve the current chat. Queue the preview for its calling chat without navigating; if queued or hidden, wait for the user to return. On return, prepare the latest project version rather than replaying an old version-bound action. ') +- 'Bind the native project tab and request Codex IAB visibility for the calling chat without navigation; inactive chats queue this request. Observe settled visibility and changed live content/time, recheck visibility, then record_display for the currently observed revision/version. A queued acknowledgment alone is not display confirmation. Follow motion://workflow/production/native#continuing-edits.' };+ 'Preserve the current chat. Wait for return only when the host confirms the calling chat is inactive; queued acknowledgment or hidden panel alone does not establish inactivity. On return, prepare the latest project version rather than replaying an old version-bound action. ') ++ 'For first delivery and continued edits, bind the native project tab and request Codex IAB visibility for the calling chat without navigation. Observe settled visibility and changed live content/time, recheck visibility, then record_display for the currently observed revision/version. Use visibility=queued only for confirmed inactive-chat deferral; otherwise record hidden or unavailable and report the display failure. Hidden-tab playback, markDeliverable and completed MP4 export do not complete editor delivery. Follow motion://workflow/production/native#continuing-edits.' };}function cursor(value: any) { return Buffer.from(JSON.stringify(value)).toString('base64url'); }function parseCursor(value: string | undefined, kind: string, scope: string) {@@ -225,7 +225,7 @@ export class Phase1Service {const current = await this.detail(detail.projectId);if (current.revision !== detail.revision || current.currentVersionId !== detail.currentVersionId) throw new Error('VERSION_CONFLICT: content changed during display confirmation');return { projectId: detail.projectId, changed: false, previewHandoff: previewHandoff(this.context.origin(), {- projectId: detail.projectId, sessionId: detail.sessionId, revision: detail.revision, versionId: detail.currentVersionId }, args.presentation, record, true, display.previewUrl), display: record };+ projectId: detail.projectId, sessionId: detail.sessionId, revision: detail.revision, versionId: detail.currentVersionId }, args.presentation, record, true, display.previewUrl, record.hostTabId), display: record };}async review(args: any, objectId?: string) {if (!args.review) throw new Error('INVALID_ARGUMENT: review is required');diff --git a/shared/integration.ts b/shared/integration.tsindex 4301b42a..581b1362 100644--- a/shared/integration.ts+++ b/shared/integration.ts@@ -137,7 +137,7 @@ ${workflowEntryGuide}素材通过 motion_import_assets 批量持久导入实际本机附件,检查逐项结果;再用 motion_edit_project 保存原生 HTML/CSS/JS 和可选需求,传 expectedRevision、expectedVersionId 及稳定 requestId。冲突时重新读,不盲目覆盖 GUI 修改。媒体生成使用宿主或 Studio 已有能力,本期 MCP 不公开生成/供应商配置入口。-After each content edit or restore, follow previewHandoff and production/native#continuing-edits. Request the same project on the calling chat's right panel, preserving embed/query/hash and reusing the actual native Tab ID. Default foreground preserves the current chat: queue while inactive, resolve the latest version on return, and verify actual visibility and changed live content before action=record_display. Codex IAB visibility synchronization is scoped to the calling chat and does not navigate. queued is only an acknowledgment. Only this turn's explicit show-now request permits presentation=now and switching back; background skips presentation. Never guess a project from another chat or workspace.+After each content edit or restore, follow previewHandoff and production/native#continuing-edits. Request the same project on the calling chat's right panel, preserving embed/query/hash and reusing the actual native Tab ID. Default foreground preserves the current chat: queue while inactive, resolve the latest version on return, and verify actual visibility and changed live content before action=record_display. Codex IAB visibility synchronization is scoped to the calling chat and does not navigate. queued is only an acknowledgment, not proof that the calling chat is inactive. Apply the same visibility checks to first delivery; hidden automation tabs, markDeliverable and completed MP4 export do not replace the editor handoff. Use visibility=queued only for confirmed inactive-chat deferral; otherwise report the display failure. Only this turn's explicit show-now request permits presentation=now and switching back; background skips presentation. Never guess a project from another chat or workspace.## 版本与导出diff --git a/shared/mcp-profiles.json b/shared/mcp-profiles.jsonindex f73123ba..1b1c0803 100644--- a/shared/mcp-profiles.json+++ b/shared/mcp-profiles.json@@ -17,6 +17,6 @@"motion_restore_version","motion_export_cancel"],- "instructions": "Use only the tools returned by tools/list. Follow the installed phase-one production skills. Read the selected project and current content version before editing. Save native source through motion_edit_project; preview and export perform their required checks internally. Use motion_list_versions to find project snapshots and motion_restore_version to restore one as a new version while retaining later history. A transport cancellation does not prove a background export stopped. Report actual export state and accessible results; technical validation does not replace visual, audio and player review. Never guess a project from another conversation. Read skills locally or with resources/list and resources/read (motion://workflow/production/start, or the selected specialist); engine authoring guidance is motion://engine/SKILL.md and relative Markdown references under motion://engine/. For new work create explicitly; motion_open_preview never silently creates a project. Persisted create/import/edit/restore/export/cancel and review requests require a stable requestId; preview action=open does not. Edits require projectId, expectedRevision and expectedVersionId. Query export progress through motion_get_project with projectId and exportJobId. Project list and version list are five per page; follow nextCursor. For template discovery, call motion_list_templates to obtain a local JSONL index path, then search that file with local tools. It does not return search results. Read the selected ID with motion_get_template; create its independent editable copy with motion_create_project projectType=template. Use the connected Motion MCP tools for project operations and exports; a shell HTTP call is not an MCP tool invocation. Before opening a project, verify the connection dataDirectory and project/version with motion_get_project. Browser URLs and project IDs do not select another workspace. Compatible phase-one plugin/backend updates continue automatically on the existing connection through API protocol and Tool negotiation; keep the workspace, project binding and running exports. If the API is incompatible, update the incompatible components together when idle. Only an already-closed host transport or an internal legacy runtime replacement requires reconnection. Do not silently bypass MCP or change workspaces. After each content edit or restore, follow previewHandoff and production/native#continuing-edits to request the latest preview in the calling chat. Default foreground preserves the current chat: queue while inactive, then resolve the latest project version on return. Bind the actual native providerTabId, synchronize Codex IAB visibility without navigation, and independently verify settled visibility and changed live content. Record action=record_display only for the observed revision/version; queued alone is not confirmation. Use presentation=now only for this turn's explicit show-now request; background skips presentation."+ "instructions": "Use only the tools returned by tools/list. Follow the installed phase-one production skills. Read the selected project and current content version before editing. Save native source through motion_edit_project; preview and export perform their required checks internally. Use motion_list_versions to find project snapshots and motion_restore_version to restore one as a new version while retaining later history. A transport cancellation does not prove a background export stopped. Report actual export state and accessible results; technical validation does not replace visual, audio and player review. Never guess a project from another conversation. Read skills locally or with resources/list and resources/read (motion://workflow/production/start, or the selected specialist); engine authoring guidance is motion://engine/SKILL.md and relative Markdown references under motion://engine/. For new work create explicitly; motion_open_preview never silently creates a project. Persisted create/import/edit/restore/export/cancel and review requests require a stable requestId; preview action=open does not. Edits require projectId, expectedRevision and expectedVersionId. Query export progress through motion_get_project with projectId and exportJobId. Project list and version list are five per page; follow nextCursor. For template discovery, call motion_list_templates to obtain a local JSONL index path, then search that file with local tools. It does not return search results. Read the selected ID with motion_get_template; create its independent editable copy with motion_create_project projectType=template. Use the connected Motion MCP tools for project operations and exports; a shell HTTP call is not an MCP tool invocation. Before opening a project, verify the connection dataDirectory and project/version with motion_get_project. Browser URLs and project IDs do not select another workspace. Compatible phase-one plugin/backend updates continue automatically on the existing connection through API protocol and Tool negotiation; keep the workspace, project binding and running exports. If the API is incompatible, update the incompatible components together when idle. Only an already-closed host transport or an internal legacy runtime replacement requires reconnection. Do not silently bypass MCP or change workspaces. After each content edit or restore, follow previewHandoff and production/native#continuing-edits to request the latest preview in the calling chat. Default foreground preserves the current chat: queue while inactive, then resolve the latest project version on return. Bind the actual native providerTabId, synchronize Codex IAB visibility without navigation, and independently verify settled visibility and changed live content. Record action=record_display only for the observed revision/version; queued alone is not confirmation or proof that the calling chat is inactive. Complete the same visibility checks for first delivery. Hidden automation tabs, markDeliverable and MP4 export do not satisfy editor delivery. Use visibility=queued only for confirmed inactive-chat deferral; otherwise report the hidden/unavailable panel as a display failure. Use presentation=now only for this turn's explicit show-now request; background skips presentation."}}diff --git a/shared/phase1-tools.ts b/shared/phase1-tools.tsindex 5da56d6f..fa9162c9 100644--- a/shared/phase1-tools.ts+++ b/shared/phase1-tools.ts@@ -2,12 +2,12 @@ const id = { type: 'string', minLength: 1, maxLength: 100 };const projectId = { type: 'string', pattern: '^(project|[a-f0-9]{8}(-[a-f0-9]{4}){3}-[a-f0-9]{12})$' };const revision = { type: 'string', pattern: '^[a-f0-9]{64}$' };const text = { type: 'string', minLength: 1, maxLength: 8000 };-const presentation = { enum: ['foreground', 'background', 'now'], description: 'Default foreground queues for the calling chat without switching chats. Use now only for an explicit request to display immediately in this turn; background skips presentation.' };+const presentation = { enum: ['foreground', 'background', 'now'], description: 'Default foreground shows the calling chat panel when active and queues only while inactive, without switching chats. Use now only for an explicit request to display immediately in this turn; background skips presentation.' };const object = (properties: Record<string, unknown>, required: string[] = []) => ({ type: 'object', properties, required, additionalProperties: false });const review = object({ objectId: id, versionId: id, range: object({ start: { type: 'number', minimum: 0 }, end: { type: 'number', minimum: 0 } }, ['start', 'end']),conclusion: { enum: ['passed', 'failed', 'pending', 'unable_to_view'] }, evidence: text, source: { enum: ['agent', 'user'] } }, ['objectId', 'versionId', 'conclusion', 'evidence', 'source']);const display = object({ revision, versionId: id, previewUrl: { type: 'string', minLength: 1, maxLength: 4000 },- visibility: { enum: ['visible', 'queued', 'hidden', 'unavailable'] }, hostStatus: { type: 'string', minLength: 1, maxLength: 80, description: 'Host action acknowledgment, such as queued; independent of observed panel visibility.' }, hostTabId: { ...id, description: 'Actual native host Tab ID, such as providerTabId; never the CUA wrapper id. A reuse hint, not proof of current visibility.' }, contentVerified: { type: 'boolean' }, evidence: text },+ visibility: { enum: ['visible', 'queued', 'hidden', 'unavailable'], description: 'Observed native panel visibility. Use queued only when the host confirms the calling chat is inactive; a queued acknowledgment alone is insufficient. Otherwise use hidden or unavailable and report the display failure.' }, hostStatus: { type: 'string', minLength: 1, maxLength: 80, description: 'Host action acknowledgment, such as queued; independent of observed panel visibility.' }, hostTabId: { ...id, description: 'Actual native host Tab ID, such as providerTabId; never the CUA wrapper id. A reuse hint, not proof of current visibility.' }, contentVerified: { type: 'boolean' }, evidence: text },['revision', 'versionId', 'previewUrl', 'visibility', 'contentVerified', 'evidence']);const read = { readOnlyHint: true, openWorldHint: false };const write = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false };@@ -17,7 +17,7 @@ export const phase1Tools = [{ name: 'motion_create_project', description: 'Create an independent editable native Motion project from a prompt, an editable template ID or reference-video ID. The host Agent authors the film; creation does not generate a finished video. Persist requirements and source, return project/session IDs and the initial content version. A requestId is required for safe retries.',inputSchema: object({ requestId: id, projectType: { enum: ['natural_language', 'template', 'reference_video'] }, title: { type: 'string', minLength: 1, maxLength: 100 }, requirements: text,sessionId: projectId, templateId: id, referenceVideoId: id, referenceUrl: { type: 'string', maxLength: 2000 } }, ['requestId', 'projectType', 'title', 'requirements']), annotations: write },- { name: 'motion_open_preview', description: 'Open the named project in the shared editable Studio. Without projectId use only an explicitly bound OpenMotion session, never the global most-recent project. Returns a version-bound previewHandoff; default foreground queues for the calling chat without switching chats. Only an explicit show-now request uses presentation=now to permit switching for this turn. Inspect the latest content after the user returns. action=record_display records the host observation against the current revision/version; queued or unverified content stays pending. action=record_review records evidence about a previously viewed frozen version without changing source.',+ { name: 'motion_open_preview', description: 'Prepare the named project in the shared editable Studio; this Tool does not open the host browser. Without projectId use only an explicitly bound OpenMotion session, never the global most-recent project. Follow previewHandoff to present the native panel and verify visibility plus latest content for first delivery and continued edits. Default foreground shows the active calling chat panel without switching chats; wait for return only when the host confirms that chat is inactive. A queued acknowledgment, hidden automation tab or markDeliverable does not complete delivery. Only an explicit show-now request uses presentation=now to permit switching for this turn. action=record_display records the current revision/version observation; queued or unverified content stays pending. Report a still-hidden panel as a display failure. action=record_review records evidence about a previously viewed frozen version without changing source.',inputSchema: object({ action: { enum: ['open', 'record_review', 'record_display'] }, projectId, sessionId: projectId, embedded: { type: 'boolean' }, presentation, expectedRevision: revision, expectedVersionId: id, requestId: id, review, display }, []), annotations: write },{ name: 'motion_import_assets', description: 'Persist a batch of real local attachments into this project, at most 500 MB (500000000 bytes) per file. Probe actual media and return per-item asset IDs, types, sizes, paths and errors. Successful items survive other failures. Existing history is not overwritten. Import does not place media on the timeline. Reuse the same requestId/itemId to retry without duplicate assets.',inputSchema: object({ projectId, requestId: id, items: { type: 'array', minItems: 1, maxItems: 100, items: object({ itemId: id, sourcePath: { type: 'string', minLength: 1, maxLength: 4096 }, name: { type: 'string', maxLength: 200 } }, ['itemId', 'sourcePath']) } }, ['projectId', 'requestId', 'items']), annotations: write },@@ -26,7 +26,7 @@ export const phase1Tools = [{ name: 'motion_edit_project', description: 'Save the host Agent\'s native text-file batch and associated requirements into the explicitly named project. Check both expectedRevision and expectedVersionId, commit all files or none, protect GUI writes, record one complete content version and let Studio refresh. Every save returns a version-bound previewHandoff: preserve the current chat by default, queue when inactive and confirm the latest content on return. An accepted queued preview may be reported as saved and waiting for return. Only an explicit show-now request permits presentation=now for this turn; background skips presentation. The service does not generate code. Read project/version again after conflicts.',inputSchema: object({ projectId, requestId: id, expectedRevision: revision, expectedVersionId: id, presentation, requirements: text, summary: { type: 'string', maxLength: 300 },files: { type: 'array', maxItems: 100, items: object({ path: { type: 'string', minLength: 1, maxLength: 240 }, content: { type: 'string' } }, ['path', 'content']) } }, ['projectId', 'requestId', 'expectedRevision', 'expectedVersionId', 'files']), annotations: write },- { name: 'motion_export_request', description: 'Queue a background MP4 of the explicit project version and immutable source/media snapshot. Automatically lint and fully technically verify the result. Return jobId; read progress/results with motion_get_project exportJobId. Repeated requestId returns the original task. action=record_review only records actual playback/visual/audio evidence for an existing job; it never starts another render.',+ { name: 'motion_export_request', description: 'Queue a background MP4 of the explicit project version and immutable source/media snapshot. Automatically lint and fully technically verify the result. Return jobId; read progress/results with motion_get_project exportJobId. Export does not open the editor or complete an outstanding editable-preview handoff; follow motion_open_preview separately for creation/edit delivery. Repeated requestId returns the original task. action=record_review only records actual playback/visual/audio evidence for an existing job; it never starts another render.',inputSchema: object({ action: { enum: ['request', 'record_review'] }, projectId, requestId: id, expectedRevision: revision, versionId: id, jobId: id,audio: { enum: ['required', 'silent', 'optional'] }, review }, ['projectId', 'requestId']), annotations: write },{ name: 'motion_list_versions', description: 'List consistent project content snapshots, not individual file save counts. Return current-version identity and five snapshots per page with a cursor for older pages, including stable IDs, vN labels, source, summary and restorability. Five is a page size, not a retention limit.',diff --git a/skills/motion-production/references/native.md b/skills/motion-production/references/native.mdindex bf921f71..5722713b 100644--- a/skills/motion-production/references/native.md+++ b/skills/motion-production/references/native.md@@ -16,6 +16,8 @@ Read the pinned engine guide returned as `authoringGuide` by project details, orThe first output of original creation, reference-video recreation and editable-template production automatically includes an editable preview. Once the requested HTML and its supporting files/assets have been saved, call `motion_open_preview({projectId})` for that same project, then visibly open its exact returned `previewUrl` in the host's built-in browser. No additional user request or confirmation is needed. This includes drafts and unchanged template HTML; it does not wait for MP4 export. An empty carrier's `index.html` is not the requested output. Explicit user instructions to stay in the background take precedence.+First delivery must complete steps 1–5 under [Continuing edits](#continuing-edits) too: preparing the preview is only the first step. Hidden-tab playback, screenshots, `markDeliverable()` and a completed MP4 export do not prove editor delivery. Before finishing, either confirm the native panel is visible with the latest content, or state the specific display failure/deferred status and give the project URL. Do not silently replace the editor with files.+The Tool runs lint and selects an existing project in Studio; it does not create a project or open the host browser. Preserve the URL's embed/query/hash, verify that the intended project and current content loaded, and reuse its browser tab on continued work. If lint fails, fix the reported source problem before retrying. If preview or browser capability is unavailable, provide the project URL when available and state the concrete gap; report the page as opened only after observing it. Do not substitute the system `open` command, AppleScript or a separately launched visible browser for the host's browser. For an independent folder/ZIP, use a supported managed-project handoff if available; the public MCP has no general folder/ZIP adoption Tool. Preserve the actual source and report that limitation rather than opening an unrelated carrier.Preview preflight, export preflight and the OpenMotion command `node <runtimeRoot>/scripts/lint-project.mjs <runtimeRoot> <projectDirectory>` use the native linter with `host: "studio"`. Structural errors therefore fail before the editor is opened or rendering begins; ordinary warnings remain non-blocking. A direct upstream `hyperframes lint` still uses its own CLI warning policy and is not proof that Studio will accept a project.@@ -24,13 +26,13 @@ Preview preflight, export preflight and the OpenMotion command `node <runtimeRooEvery content-editing turn saves the result and requests its preview in the same host chat. Reuse the project and native tab. Default `presentation:"foreground"` preserves the user's current chat: show the right panel when this chat is active; otherwise queue it until the user returns. Before writing, confirm project ownership and the current source/version; show the target when this chat is active. Apply this shared rule across production, director, template and recreation edits.-After the final source batch, complete the applicable delivery branch:+For first delivery and continued edits, after the final requested source batch complete these steps:1. Take `projectId`, `revision` and `versionId` from the save's `previewHandoff`. Call its `nextAction` (`motion_open_preview` with both expected identities) when the HTML is ready. A conflict means reread the current project and source, preserve intervening GUI changes, and prepare the preview with the newly read identities. Studio can add source handles on first open; do not overwrite that normalization with the old batch. Verify and acknowledge the current version returned by the successful open.-2. Request the same project's native preview on the right. In Codex, call `open_in_codex` with `placement:"right"` in the calling chat; omit `threadId` unless the user asked for another chat. The host queues the action when its target chat is inactive. Reuse the actual native Tab ID when available; CUA wrapper `id` is not the host's `providerTabId`. A hidden `browser-use:` tab may be separate from the native right-panel tab. Without an established native Tab ID use the exact returned `previewUrl`, preserving embed/query/hash. Reuse an already queued same-project live preview while subsequent edits update that project; avoid duplicate tabs or a queue of frozen versions.-3. Read the host acknowledgment **and separately observe visibility**. `queued` is neither success nor failure evidence. Rebind the actual native panel tab; a previous hidden automation tab can report false while a native tab is visible. In Codex IAB, after binding that tab, call the browser's supported `visibility.set(true)` capability once: it requests the calling chat's panel, queues while that chat is inactive, and does not navigate to it. Do not substitute another host's unverified focus-changing API. Observe `visibility.get()` as the host settles (bounded by the handoff's `settleTimeoutMs`); an immediate false can precede queued panel activation. If inactive, leave it queued and finish with “saved; latest preview will appear when you return.” Navigation remains forbidden by default. A still-hidden active-chat panel is a display failure to report. A closed/collapsed panel is not a request to skip preview entirely.+2. Request the same project's native preview on the right. In Codex, call `open_in_codex` with `placement:"right"` in the calling chat; omit `threadId` unless the user asked for another chat. The host queues the action when its target chat is inactive. Reuse the actual native Tab ID when available; CUA wrapper `id` is not the host's `providerTabId`. Without an established native Tab ID use the exact returned `previewUrl`, preserving embed/query/hash. Rebind it from the current host inventory after presentation. If the matching native tab is absent, retry the same host presentation once, then report the gap; do not create a separate `visible:false` / `browser-use:` automation tab as a substitute. Hidden tabs remain valid for inspection only. Reuse an already queued same-project live preview while subsequent edits update that project; avoid duplicate tabs or a queue of frozen versions.+3. Read the host acknowledgment **and separately observe visibility**. `queued` is neither success nor failure evidence and does not establish that the calling chat is inactive. Rebind the actual native panel tab; a previous hidden automation tab can report false while a native tab is visible. In Codex IAB, after binding that tab, call the browser's supported `visibility.set(true)` capability once: it requests the calling chat's panel, queues while that chat is inactive, and does not navigate to it. Do not substitute another host's unverified focus-changing API. Observe `visibility.get()` as the host settles (bounded by the handoff's `settleTimeoutMs`); an immediate false can precede queued panel activation. Only if the host confirms the calling chat is inactive, leave it queued and finish with “saved; preview queued for when you return.” Otherwise a still-hidden or unobservable panel is a display failure to report, even when the host acknowledged `queued`. Navigation remains forbidden by default. A closed/collapsed panel is not a request to skip preview entirely.4. When the user returns, the host consumes its queued action. If executing a follow-up observation, use the handoff's `onReturn` action to resolve the **latest** project version, rather than replaying an old version-bound open or acknowledging the queued version. Locate the newest changed content at the affected time in the live preview, then recheck host visibility after inspecting it. A hidden WebContents screenshot, DOM `visibilityState`, metadata, a source read, file-watcher notification and a successful open alone do not prove visible freshness. Reload that native tab once if stale; preserve saved content and report any remaining failure. The host queue, not a continuing model turn, owns opening when the user returns; without a new observation leave the receipt pending. In disposable tests, consume queued actions before closing their tabs/server so an old queued tab cannot reappear later.-5. Record `motion_open_preview({action:"record_display",projectId,requestId,presentation,display:{revision,versionId,previewUrl,visibility,hostStatus,hostTabId,contentVerified,evidence}})` with the observed current version and a stable requestId per observation. Optional `hostStatus` preserves the acknowledgment (`queued` can coexist with actual `visibility:"visible"`); optional `hostTabId` preserves the established native ID as a reuse hint, validated against the current inventory. A closed tab's stale ID is omitted in favor of the fresh URL. A queued/hidden observation stays pending; only a visible preview with the latest content actually inspected can be `confirmed`. Deferred delivery is reported as queued, without claiming the user has seen it or polling indefinitely.+5. Record `motion_open_preview({action:"record_display",projectId,requestId,presentation,display:{revision,versionId,previewUrl,visibility,hostStatus,hostTabId,contentVerified,evidence}})` with the observed current version and a stable requestId per observation. Optional `hostStatus` preserves the acknowledgment (`queued` can coexist with actual `visibility:"visible"`); optional `hostTabId` preserves the established native ID as a reuse hint, validated against the current inventory. A closed tab's stale ID is omitted in favor of the fresh URL. Use `visibility:"queued"` only for confirmed inactive-chat deferral, with that host evidence; use `hidden` or `unavailable` for failed/unknown presentation. Every unconfirmed observation stays pending; only a visible preview with the latest content actually inspected can be `confirmed`. Report deferred delivery or the concrete display failure, without claiming the user has seen it or polling indefinitely. If export or packaging follows, retain this unresolved status in the final reply.Only an explicit request such as “show it now / 现在展示” permits `presentation:"now"` for this turn, carried through save/open/display calls. Its recovery may take the verified calling-chat `threadId` from `open_in_codex`, call `navigate_to_codex_page({threadId})` once, and present/recheck the native tab. Use the host chat identity, not the OpenMotion sessionId. This permission does not persist into later ordinary edits. An ordinary “finish editing” or hidden/queued state is not immediate-display authorization.diff --git a/skills/motion-production/references/verification.md b/skills/motion-production/references/verification.mdindex 370b61ea..67d5f92b 100644--- a/skills/motion-production/references/verification.md+++ b/skills/motion-production/references/verification.md@@ -106,4 +106,6 @@ Overall: passed only when all required checks passed and no blocking defect remaDistinguish “preview prepared,” “export pending,” “MP4 exported” and “verified final.” Link only to files that exist. Do not claim guaranteed playback on every device; report which player and checks were actually exercised.+Creation/edit delivery also completes the [editable preview handoff](native.md#editable-preview-handoff). Recheck any outstanding display failure before the final reply and report it separately from export success; hidden-tab playback and `markDeliverable()` do not establish visible editor delivery. Export-only requests do not require opening the editor.+Workflow sources: [rari](https://x.com/0xwhrrari/status/2105643919119696297), [Movez](https://x.com/0xMovez/status/2104216919033192746), [jmori](https://x.com/0xjmori/status/2111793914206171234). Their production principles are adapted to this repository's capabilities; their example tools, code and performance claims are not assumed to be installed or verified here.diff --git a/skills/motion-recreate/SKILL.md b/skills/motion-recreate/SKILL.mdindex c6ccb9ec..abb39354 100644--- a/skills/motion-recreate/SKILL.md+++ b/skills/motion-recreate/SKILL.md@@ -78,7 +78,7 @@ Opening the editor is a preview handoff, not completion of these checks. Keep woThe project open in the editor is the deliverable. Do not copy, link or attach the exported MP4 or other files unless the user asks for them.-Reply briefly in the user's language. Give the `previewUrl` returned by `motion_open_preview` and say the project is open there for review and further edits. Say in one or two sentences what changed, which assumptions you made from the workspace material, and any limitation the user would notice. When the reference, analysis or tools fall short, name the specific gap and its effect; never claim a faithful result that was not achieved.+Reply briefly in the user's language. Give the `previewUrl` returned by `motion_open_preview` and say the editor is open only after confirming visible latest content through the shared handoff; otherwise state the display failure or confirmed inactive-chat deferral, even if the MP4 exported successfully. Say in one or two sentences what changed, which assumptions you made from the workspace material, and any limitation the user would notice. When the reference, analysis or tools fall short, name the specific gap and its effect; never claim a faithful result that was not achieved.## 8. Follow-up requestsdiff --git a/tests/npm-package.test.ts b/tests/npm-package.test.tsindex 7c30a9f1..46b3bf51 100644--- a/tests/npm-package.test.ts+++ b/tests/npm-package.test.ts@@ -109,7 +109,7 @@ test('test npm artifacts contain their application, locked manifest and no bundlfor (const host of ['codex', 'claude', 'deepseek', 'workbuddy']) assert(help.includes(host), host);await readFile(path.join(installer, 'package/LICENSE'));assert.deepEqual((await readdir(path.join(application, 'skills'))).sort(), [...phase1Skills].sort());- for (const document of ['skills/motion-director/SKILL.md', 'skills/motion-production/references/context.md']) {+ for (const document of ['skills/motion-director/SKILL.md', 'skills/motion-production/references/context.md', 'skills/motion-production/references/native.md', 'skills/motion-production/references/verification.md', 'skills/motion-recreate/SKILL.md', 'phase1.ts', 'shared/phase1-tools.ts', 'shared/mcp-profiles.json']) {assert.equal(await readFile(path.join(application, document), 'utf8'), await readFile(document, 'utf8'));}assert.equal(await sha256(path.join(application, 'package-lock.json')), release.locks.npm);diff --git a/tests/preview-handoff.test.ts b/tests/preview-handoff.test.tsindex 46aef5ab..90fd7bd2 100644--- a/tests/preview-handoff.test.ts+++ b/tests/preview-handoff.test.ts@@ -23,13 +23,13 @@ function display(saved: any, visibility = 'visible', contentVerified = true) {visibility, contentVerified, evidence: 'Host panel visibility read back; inspected the edited text in the live preview at 1s.' } };}-test('default deferred preview preserves the current chat and resolves the latest version on return', () => fixture(async store => {+test('confirmed inactive-chat deferral preserves the current chat and resolves the latest version on return', () => fixture(async store => {const service = api(store, async () => {}), p = await create(service), first = await edit(service, p, 'first');const opened = await service.call('motion_open_preview', first.previewHandoff.nextAction.arguments);assert.equal(opened.previewHandoff.focusPolicy, 'preserve_current_chat');assert.equal(opened.previewHandoff.nextAction.codex.recovery.tool, undefined);- const queued = display(first, 'hidden', false);- queued.display = { ...queued.display, hostStatus: 'queued' } as any;+ const queued = display(first, 'queued', false);+ queued.display = { ...queued.display, hostStatus: 'queued', evidence: 'Host confirms the calling chat is inactive; preview is queued for its return.' } as any;const pending = await service.call('motion_open_preview', queued);assert.equal(pending.previewHandoff.state, 'pending');assert.equal(pending.previewHandoff.nextAction.operation, 'wait_for_calling_chat');@@ -42,6 +42,23 @@ test('default deferred preview preserves the current chat and resolves the latesassert.equal((await service.call('motion_open_preview', display({ ...second, previewHandoff: latest.previewHandoff }))).previewHandoff.state, 'confirmed');}, false));+test('a queued acknowledgment with a hidden or unavailable panel retains presentation recovery', () => fixture(async store => {+ const service = api(store, async () => {}), p = await create(service), saved = await edit(service, p, 'complete film');+ const nativeTabId = crypto.randomUUID();+ for (const visibility of ['hidden', 'unavailable']) {+ const receipt = display(saved, visibility, true);+ receipt.display = { ...receipt.display, hostStatus: 'queued', hostTabId: nativeTabId } as any;+ const result = await service.call('motion_open_preview', receipt);+ assert.equal(result.previewHandoff.state, 'pending');+ assert.equal(result.previewHandoff.openedByHost, false);+ assert.equal(result.previewHandoff.nextAction.operation, 'present_preview');+ assert.equal(result.previewHandoff.nextAction.codex.arguments.target.url, saved.previewHandoff.previewUrl);+ assert.equal(result.previewHandoff.nextAction.codex.arguments.target.tabId, nativeTabId);+ assert.equal(result.previewHandoff.nextAction.codex.recovery.when, 'calling_chat_confirmed_inactive');+ assert.equal(result.previewHandoff.nextAction.codex.recovery.tool, undefined, 'ordinary display recovery must not navigate chats');+ }+}, false));+test('every edit returns a version-bound foreground handoff without claiming the host opened', () => fixture(async store => {const service = api(store), p = await create(service);const first = await edit(service, p, 'first');