mirror of
https://github.com/nexu-io/openmotion.git
synced 2026-12-02 08:59:26 +08:00
* Add Skills page for open-source motion techniques Add a Skills entry to the application rail next to the template library. The page lists 18 curated open-source motion projects with an illustrated cover, category, upstream repository and license. Selecting a skill opens a brief form (subject, duration, aspect ratio, style) that produces an Agent instruction to copy into Codex, Claude Code or another MCP client; the instruction drives the existing OpenMotion MCP tools to build an editable Hyperframes project. Clipboard failures select the instruction for manual copy. The page is routed as ?page=skills&skill=<id>, keeps the editor mounted like the Assets page, and ships Chinese translations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Use the public phase-one MCP tools in Skills instructions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Add video-shotcraft to the Skills catalog Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Group Skills by scenario and add Higgsfield and Black Friday skills Reorganize categories around the video the user wants to make: Campaigns, Product promos, Explainers, Brand & covers, People & AI media, and Motion techniques for the open-source libraries. Add seven Higgsfield workflow skills (product photoshoot, marketplace cards, faceless video, brand kit, YouTube thumbnail, media generation, consistent character) and an OpenMotion Black Friday sale skill. Skills that need generated media route through openmotion_media_use instead of third-party CLIs. OpenMotion-authored skills have no upstream repository and keep translated names; upstream names stay verbatim. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Reset the Skills brief when the selected skill changes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Remove the Black Friday skill for now Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Restyle Skills like the template library Reuse the template library header, category pills, masonry grid, intro block and gallery cards. Cards can show an upstream demo poster and play its video while hovered or focused, falling back to the illustration. Column count follows the list width so the detail panel never crowds the cards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Remove the Skills footer note Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Start Skills instructions with the template install guidance Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Use upstream demo videos and GIFs as Skills covers Hotlink official demos from each project's README or docs: Motion and Manim videos, and video-shotcraft, Ola, Anime.js and Lottie Web GIFs. Videos and GIFs play only while the card is hovered or focused; other skills keep the illustration until verified media is found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Show the concrete deliverable of each skill Each skill states what the Agent will make (for example a narrated explainer with no presenter). Cards and the detail panel show it, and the instruction sends it as the deliverable. Remove source avatars from cards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Use short task titles and official demo covers for Skills Card titles name the task in plain words (for example Product promo, Faceless explainer) with the upstream project as a subtitle. Add verified official demo videos and stills for 14 more skills, including six Higgsfield skills from Higgsfield's own marketing pages. Drop the bracketed suffix from the Motion techniques category label. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Update the Skills search test for task titles Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Add Connect Agent and pin Skills actions to the panel bottom Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Remove the hint under the Skills actions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Add motionmaxxing first and a copyable Agent command Add the motionmaxxing anti-slop skill as the first card, with its official before/after comparison video as the cover. Connect Agent now opens a popover with a short command that any AI Agent can run, including the OpenMotion install guide, instead of linking to settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Show only the task title on Skills cards Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Update the Skills copy test for task titles Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Remove the media generation and consistent character skills Both only wrap Higgsfield platform access (model calls and paid face training) rather than a way to make a film, so they read as unclear in OpenMotion. Drop the People & AI media category with them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Label the before/after cover and drop the misleading Ola cover Show the motionmaxxing comparison video whole with Before/After labels. The Ola dots GIF did not read as animated numbers, so the card falls back to its illustration until a counter sample is produced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Make Skills cards say when to use each skill Cards keep the cover clean and list the task name, when to use it and what it makes underneath, like a skills gallery. Add a when-to-use line for every skill. Show four columns on wide lists. Move search into the category row and drop the page title and count. Render the motionmaxxing before/after demo as a split cover with captions on the footage, and rename it to Remove the AI look from motion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Show one when-to-use line under each Skills card Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Label the before/after divider with the skill action Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Add sample and recorded demo covers for the remaining skills Eleven skills without usable upstream video now have real covers: recorded official live demos for Three.js, LUME and Proton, and OpenMotion-made samples for the rest (animated numbers, loading easing, shapes to logo, step tour, looping GIF sticker, whiteboard demo, character animation, diagram explainer). Each file is under 1 MiB. The editor server now serves bundled mp4 assets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Autoplay visible Skills covers and lead with the anti-slop skill Covers play while at least half the card is on screen (hover-to-play under reduced motion). Move the intro above the grid so the first card sits top-left, retitle it, and move the looping GIF sticker to second. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Replace the 3D turntable cover with a product turntable sample The Babylon.js physics sandbox clip did not show a product turntable. Use a Babylon.js rendered turntable of the Khronos MaterialsVariantsShoe sample (model © 2021 Shopify, CC BY 4.0) until a final cover is chosen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Play Skills covers in place and buffer them a screen ahead The video element now owns its poster, so playback starts without an image-to-video swap, and covers begin buffering before they scroll into view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Use an orbiting Three.js recording and a richer character animation cover Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep both halves of the before/after cover in the detail panel The large-media display rule overrode the split grid, collapsing both halves to zero width so the detail cover rendered black. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Use the antique camera turntable as the 3D product cover Model AntiqueCamera by UX3D, CC0, from KhronosGroup/glTF-Sample-Assets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Use the detailed antique camera close-up as the 3D product cover Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Localize the Skills page and Agent instructions in all supported languages Translate the Skills UI strings and the Agent instruction and command templates into the nine other Studio languages, matching the template library. Prompts move to a locale-keyed JSON with English fallback. A test checks every locale has every string with matching placeholders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refresh failed-copy text on brief changes and reset detail media per skill Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Ignore late copy failures for a brief that has since changed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fall back to the illustration when a still cover fails to load Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Show Skills cover provenance and credit bundled cover clips Render cover.source in the skill detail next to the upstream link, credit the Littlest Tokyo model (CC BY 4.0) in the three-js cover, and list every bundled cover with its source and license in docs/readme/ASSETS.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: zhanghuihua <zhanghuihua@huihuideMacBook-Pro.local> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
70 lines
4.1 KiB
TypeScript
70 lines
4.1 KiB
TypeScript
import { renderFilenameStem } from './shared/render-name.ts';
|
|
import { request } from 'node:http';
|
|
import { readFile } from 'node:fs/promises';
|
|
import path from 'node:path';
|
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
import { pluginRoot } from './hyperframes.ts';
|
|
import { resolveDesignSystemFile } from './packages/design-system/index.js';
|
|
|
|
const mime: Record<string, string> = { '.mp4': 'video/mp4', '.jpg': 'image/jpeg', '.png': 'image/png', '.webp': 'image/webp', '.html': 'text/html; charset=utf-8', '.js': 'text/javascript; charset=utf-8', '.css': 'text/css; charset=utf-8', '.svg': 'image/svg+xml', '.json': 'application/json', '.map': 'application/json', '.ttf': 'font/ttf', '.woff2': 'font/woff2', '.txt': 'text/plain', '.md': 'text/plain; charset=utf-8' };
|
|
|
|
/** Only application bundle and design-system files are exposed, never Studio source or project files. */
|
|
export async function serveEditorFile(url: URL, res: ServerResponse): Promise<boolean> {
|
|
let relative: string;
|
|
const designFile = resolveDesignSystemFile(url.pathname);
|
|
if (url.pathname === '/') relative = 'studio/build/index.html';
|
|
else if (designFile) relative = 'packages/design-system/' + designFile;
|
|
else if (url.pathname === '/favicon.svg') relative = 'packages/design-system/brand/favicon.svg';
|
|
else if (/^\/editor-assets\/[a-zA-Z0-9_.-]+$/.test(url.pathname)) relative = 'studio/build' + url.pathname;
|
|
else if (/^\/web\/catalog\/(?:hyperframes|template-frames|provenance|covers)\.json$/.test(url.pathname) || /^\/web\/catalog\/(?:template-frames|covers)\/[a-f0-9]{24}\.(?:jpg|webp)$/.test(url.pathname)) relative = url.pathname.slice(1);
|
|
else return false;
|
|
const type = mime[path.extname(relative)];
|
|
if (!type) return false;
|
|
try {
|
|
const data = await readFile(path.join(pluginRoot, relative));
|
|
res.writeHead(200, { 'Content-Type': type, 'Content-Length': data.length }); res.end(data);
|
|
} catch (error) {
|
|
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error;
|
|
res.writeHead(503, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
res.end(relative.endsWith('index.html') ? '编辑器尚未构建。请运行 npm run build:studio。' : '编辑器资源不存在,请刷新页面。');
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/** Suggest a portable name without changing the immutable render's storage path. */
|
|
export function renderDownloadDisposition(title: string | undefined, extension: string): string {
|
|
const stem = renderFilenameStem(title);
|
|
const encoded = encodeURIComponent(stem + extension).replace(/['()*]/g, char =>
|
|
'%' + char.charCodeAt(0).toString(16).toUpperCase());
|
|
return `attachment; filename="OpenMotion${extension}"; filename*=UTF-8''${encoded}`;
|
|
}
|
|
|
|
/** Preserve native HTTP semantics (SSE, byte ranges, multipart uploads and optimistic file writes). */
|
|
export function proxyStudio(req: IncomingMessage, res: ServerResponse, url: URL, studioUrl: string, downloadDisposition?: string): Promise<void> {
|
|
const target = new URL(studioUrl);
|
|
target.pathname = url.pathname; target.search = url.search; target.hash = '';
|
|
const headers = { ...req.headers, host: target.host };
|
|
if (headers.origin) headers.origin = target.origin;
|
|
if (headers.referer) headers.referer = target.origin + '/';
|
|
delete headers.connection;
|
|
return new Promise(resolve => {
|
|
const upstream = request(target, { method: req.method, headers }, response => {
|
|
const outgoing = { ...response.headers };
|
|
delete outgoing.connection;
|
|
if (downloadDisposition && response.statusCode === 200) outgoing['content-disposition'] = downloadDisposition;
|
|
res.writeHead(response.statusCode || 502, outgoing);
|
|
response.on('error', () => { res.destroy(); resolve(); });
|
|
response.pipe(res);
|
|
});
|
|
upstream.on('error', () => {
|
|
if (!res.headersSent) { res.writeHead(502, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ error: '原生编辑服务连接中断,请刷新重试' })); }
|
|
else res.destroy();
|
|
resolve();
|
|
});
|
|
res.on('close', () => { upstream.destroy(); resolve(); });
|
|
res.on('finish', resolve);
|
|
req.on('error', () => upstream.destroy());
|
|
req.pipe(upstream);
|
|
});
|
|
}
|