Files
openmotion/web/inline-video.js
Haoran Zhou 36f1c3ab5c fix(video): load complete final media through the native App connection (#522)
Load completed final-video bytes over the MCP App server-tool connection so Codex transcript truncation cannot corrupt first playback. Preserve pinned identity, bounded retries, duplicate-delivery handling and one final video per delivery.

Validated with 10 passing PR checks, full packaged public-tool and two-round rendering regressions, and user-confirmed native Codex first-load acceptance.
2026-11-17 15:56:40 +08:00

14 lines
716 B
JavaScript

import { App } from '@modelcontextprotocol/ext-apps';
import { mountFinalVideo } from './final-video-component.js';
const app = new App({ name: 'OpenMotion final video', version: '1.0.0' }, {});
document.documentElement.dataset.motionUi = '';
const root = document.createElement('main'); document.body.append(root);
const ui = mountFinalVideo(root, app);
app.ontoolinput = ui.setInput;
app.ontoolresult = ui.update;
app.onteardown = async () => { ui.destroy(); return {}; };
app.onhostcontextchanged = context => { if (context.theme) document.documentElement.dataset.theme = context.theme; };
await app.connect();
const theme = app.getHostContext()?.theme;
if (theme) document.documentElement.dataset.theme = theme;