Skip to content

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.

fix(studio): remove timeline Agent handoff from MVP editor

罗高46aa6d01470b
diff --git a/docs/product/architecture.md b/docs/product/architecture.md
index 4fc3eddc..db973f3f 100644
--- a/docs/product/architecture.md
+++ b/docs/product/architecture.md
@@ -27,6 +27,7 @@ Model Gateway remains a shared media-generation backend for MCP, using local Cod
- Timeline clips omit a title that duplicates the track header, giving its space to the preview. Distinct clip names, accessible labels, status badges and track visibility controls remain available.
- The MVP omits the standalone timeline title strip to give its space to tracks, retaining the tool row and ruler.
- The MVP shows Select and Split as adjacent timeline tools. Split at playhead remains available by keyboard shortcut, without a duplicate toolbar button. Tooltips add a short explanation for less familiar controls while simple actions retain a name-only hint.
+- The MVP does not open an Agent prompt or media-action popover from clip selection, time-range selection or ruler clicks. Element-level Agent requests remain available in the Design panel.
- 模板先展示真实成片效果;作者、出处、内容种类和有来源的热度帮助选择。
- Template copy uses the public environment-specific installation guide, the exact template title/ID, the requested HTML/MP4 deliverables and an empty requirements section. Local connection guides remain available for workspace setup.
- 导出成功需要真实产物与验证证据;技术检查与画面、声音、播放器检查分别记录。
@@ -124,7 +125,7 @@ README 参考 OpenDesign 的产品导览和 HTML Anything 的贡献、来源表
2. The Agent uses the existing MCP integration and verifies the selected project, revision and workflow. Integration setup remains available outside the MVP editor. After installation, introduce the capabilities and wait for a choice; accepting the first-run experience selects the independent 20-second `product-promo` project and its editable host panel. Do not ask for another material/template confirmation or export an MP4 unless requested. Check that the project loads and plays; a host without a panel uses an explicit link fallback. Follow the [first-run defaults](../../skills/motion-production/references/templates.md#first-run-experience-defaults) for the completion sentence and contextual invitation.
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.
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/geometry, previews, and edits clips on the timeline. Element, clip and time-range prompts still provide Ask Agent. Generation, image replacement, advanced style/animation controls, code and version-history panels are hidden without rewriting existing source content or removing Agent capabilities.
+5. The Agent imports or generates media through the existing backend. In the editor, the user imports assets, edits text/solid color/opacity/geometry, previews, and edits clips on the timeline. Element prompts provide Ask Agent in the Design panel; clip selection, time-range selection and ruler clicks do not open an Agent prompt in the MVP. Generation, image replacement, advanced style/animation controls, code and version-history panels are hidden without rewriting existing source content or removing Agent capabilities.
6. 完成画面、文案、声音检查后,按用户要求导出固定 revision 的快照,等待真实产物并验证。
后续需求应注明改变了哪一步、影响哪些角色,以及用户能观察到的完成条件。
diff --git a/studio/src/motion/TimelineMediaBar.test.tsx b/studio/src/motion/TimelineMediaBar.test.tsx
index 0872baeb..2078a9e7 100644
--- a/studio/src/motion/TimelineMediaBar.test.tsx
+++ b/studio/src/motion/TimelineMediaBar.test.tsx
@@ -4,6 +4,7 @@ import React, { act } from 'react';
import { createRoot, type Root } from 'react-dom/client';
import { afterEach, beforeEach, expect, it, vi } from 'vitest';
import { TimelineMediaBar } from './TimelineMediaBar';
+import { TimelineEditPopoverOverlay } from '../player/components/TimelineOverlays';
import { TimelineReadOnlyContext } from '../player/components/timelineReadOnly';
import type { TimelineState } from '../player/components/TimelineProvider';
import type { TimelineElement } from '../player/store/playerStore';
@@ -12,15 +13,15 @@ import { I18nProvider } from '../i18n/I18n';
import { projectMediaPath, selectedMedia } from './timelineMediaSelection';
import { ArtifactViewActive } from './ArtifactViewState';
-const hooks = vi.hoisted(() => ({ state: {} as TimelineState, open: vi.fn() }));
+const hooks = vi.hoisted(() => ({ state: {} as TimelineState, open: vi.fn(), connected: true }));
vi.mock('../player/components/EditModal', () => ({ EditPopover: ({ initialPrompt, rangeStart, rangeEnd, selectedElementKey }: { initialPrompt: string; rangeStart: number; rangeEnd: number; selectedElementKey?: string }) => <div data-testid="agent-edit" data-selected-key={selectedElementKey}>{initialPrompt} {rangeStart}–{rangeEnd}</div> }));
vi.mock('../player/components/TimelineProvider', () => ({ useTimelineContext: () => ({ state: hooks.state }) }));
-vi.mock('./MediaGatewayContext', () => ({ useMediaGateway: () => ({ openGenerator: hooks.open, generationOpen: false }) }));
+vi.mock('./MediaGatewayContext', () => ({ useMediaGateway: () => hooks.connected ? ({ openGenerator: hooks.open, generationOpen: false }) : null }));
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
let root: Root; let viewport: HTMLDivElement;
const clip = { id: 'image', key: 'main:image', tag: 'img', src: 'assets/original.png', label: 'Forest', start: 2, duration: 6, track: 1 } as TimelineElement;
beforeEach(() => {
- hooks.open.mockReset(); usePlayerStore.getState().reset();
+ hooks.open.mockReset(); hooks.connected = true; usePlayerStore.getState().reset();
const host = document.createElement('div'); host.dataset.motionStudio = ''; document.body.append(host); root = createRoot(host);
const timeline = document.createElement('div'); timeline.dataset.studioTimeline = ''; document.body.append(timeline);
viewport = document.createElement('div'); timeline.append(viewport); viewport.scrollLeft = 40;
@@ -98,28 +99,26 @@ it('removes the portalled media actions while the owning Viewer is hidden and re
expect(document.querySelector('.motion-timeline-media-bar')).not.toBeNull();
});
-it('MVP keeps clip and range prompts for Agent without opening media generation', async () => {
- const mountMvp = () => act(async () => root.render(<StudioHostContext.Provider value={{ mvpEditor: true }}><TimelineMediaBar /></StudioHostContext.Provider>));
+it('MVP omits timeline Agent actions for clip, range and ruler selections', async () => {
+ const mountMvp = () => act(async () => root.render(<StudioHostContext.Provider value={{ mvpEditor: true }}><TimelineMediaBar /><TimelineEditPopoverOverlay /></StudioHostContext.Provider>));
+ const expectHidden = () => {
+ expect(document.querySelector('aside')).toBeNull();
+ expect(document.querySelector('[data-testid="agent-edit"]')).toBeNull();
+ expect(hooks.open).not.toHaveBeenCalled();
+ };
await mountMvp();
- expect(button('Generate media')).toBeUndefined();
- expect(button('Edit image')).toBeUndefined();
- expect(button('Ask Agent')).toBeDefined();
- const prompt = document.querySelector('input')!;
- await act(async () => {
- Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')!.set!.call(prompt, 'Make this title larger');
- prompt.dispatchEvent(new Event('input', { bubbles: true }));
- });
- await act(async () => prompt.closest('form')!.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true })));
- expect(document.querySelector('[data-testid="agent-edit"]')?.textContent).toBe('Make this title larger 2–8');
- expect(document.querySelector('[data-testid="agent-edit"]')?.getAttribute('data-selected-key')).toBe('main:image');
- expect(hooks.open).not.toHaveBeenCalled();
- await act(async () => root.render(null));
+ expectHidden();
hooks.state.overlays = { ...hooks.state.overlays, showPopover: true, rangeSelection: { start: 8, end: 5, anchorX: 0, anchorY: 0 } };
await mountMvp();
- await act(async () => button('Ask Agent').click());
- expect(document.querySelector('[data-testid="agent-edit"]')?.textContent).toBe(' 5–8');
- expect(document.querySelector('[data-testid="agent-edit"]')?.hasAttribute('data-selected-key')).toBe(false);
- expect(hooks.open).not.toHaveBeenCalled();
+ expectHidden();
+ hooks.connected = false;
+ await mountMvp();
+ expectHidden();
+ hooks.state.overlays.showPopover = false;
+ hooks.state.selectedElementId = null;
+ await mountMvp();
+ await act(async () => viewport.dispatchEvent(new PointerEvent('pointerup', { button: 0, clientX: 440, clientY: 505 })));
+ expectHidden();
});
it('dismisses after leaving the opener and popover, but protects a focused draft', async () => {
diff --git a/studio/src/motion/TimelineMediaBar.tsx b/studio/src/motion/TimelineMediaBar.tsx
index 649a0668..7cae3e9f 100644
--- a/studio/src/motion/TimelineMediaBar.tsx
+++ b/studio/src/motion/TimelineMediaBar.tsx
@@ -17,12 +17,12 @@ import type { MediaPopoverAnchor } from './mediaPopoverPosition';
export function TimelineMediaBar() {
const gateway = useMediaGateway();
const active = useArtifactViewActive();
- return gateway && active ? <ConnectedTimelineMediaBar /> : null;
+ const mvp = useMvpEditor();
+ return gateway && active && !mvp ? <ConnectedTimelineMediaBar /> : null;
}
function ConnectedTimelineMediaBar() {
const gateway = useMediaGateway()!; const { t } = useI18n();
- const mvp = useMvpEditor();
const { state } = useTimelineContext(); const shell = useStudioShellContextOptional();
const readOnly = useTimelineReadOnlyPress();
const playing = usePlayerStore(s => s.isPlaying);
@@ -123,10 +123,10 @@ function ConnectedTimelineMediaBar() {
return createPortal(ask ? <EditPopover initialPrompt={prompt} selectedElementKey={clipKey} rangeStart={start} rangeEnd={start + duration} anchorX={(anchorRect.left + anchorRect.right) / 2} anchorY={anchorRect.top - 8} onClose={close} /> :
<aside ref={popover.ref} className="motion-timeline-media-bar motion-media-surface" style={popover.style} aria-label={t('Timeline media actions')} onPointerDown={e => e.stopPropagation()} onKeyDown={e => { e.stopPropagation(); if (e.key === 'Escape') close(); }}>
<div className="motion-media-context"><span>{start.toFixed(1)}–{(start + duration).toFixed(1)}s</span><span title={media?.label}>{media?.label ?? t(range ? 'Selected time range' : clip ? 'Selected clip' : 'At playhead')}</span><button className="motion-media-close" aria-label={t('Close timeline media actions')} onClick={close}>×</button></div>
- <form onSubmit={e => { e.preventDefault(); if (mvp) setAsk(true); else open(); }}>
- <input aria-label={t('Timeline media prompt')} value={prompt} onChange={e => setPrompt(e.target.value)} placeholder={t(!mvp && media?.modality === 'image' ? 'Describe a new image or how to change this one…' : 'Describe what goes here…')} />
- {!mvp && <button type="submit">{t('Generate media')}</button>}
- {!mvp && media?.modality === 'image' && <button type="button" className="motion-media-primary" onClick={() => open(true)}>{t('Edit image')}</button>}
+ <form onSubmit={e => { e.preventDefault(); open(); }}>
+ <input aria-label={t('Timeline media prompt')} value={prompt} onChange={e => setPrompt(e.target.value)} placeholder={t(media?.modality === 'image' ? 'Describe a new image or how to change this one…' : 'Describe what goes here…')} />
+ <button type="submit">{t('Generate media')}</button>
+ {media?.modality === 'image' && <button type="button" className="motion-media-primary" onClick={() => open(true)}>{t('Edit image')}</button>}
<button type="button" onClick={() => setAsk(true)}>{t('Ask Agent')}</button>
</form>
</aside>, host);
diff --git a/studio/src/player/components/TimelineOverlays.tsx b/studio/src/player/components/TimelineOverlays.tsx
index f8abe096..69b8590f 100644
--- a/studio/src/player/components/TimelineOverlays.tsx
+++ b/studio/src/player/components/TimelineOverlays.tsx
@@ -11,6 +11,7 @@ import { copyTextToClipboard } from "../../utils/clipboard";
import { trackStudioSegmentEaseEdit } from "../../telemetry/events";
import { useTimelineContext } from "./TimelineProvider";
import { useMediaGateway } from '../../motion/MediaGatewayContext';
+import { useMvpEditor } from '../../motion/StudioHost';
interface TimelineContextTargetInput {
capturedElement: TimelineElement;
@@ -43,8 +44,9 @@ export function TimelineShortcutHintOverlay() {
export function TimelineEditPopoverOverlay() {
const { state } = useTimelineContext();
const gateway = useMediaGateway();
+ const mvp = useMvpEditor();
const { showPopover, rangeSelection, setShowPopover, setRangeSelection } = state.overlays;
- if (gateway || !showPopover || !rangeSelection) return null;
+ if (mvp || gateway || !showPopover || !rangeSelection) return null;
return (
<EditPopover
rangeStart={rangeSelection.start}