mirror of
https://github.com/nexu-io/openmotion.git
synced 2026-12-02 13:59:29 +08:00
* Edit images and generate music with OpenDesign account models - Map audio_music catalogue rows to text-to-audio account models and run `audio music`, with an optional whole-second duration. - Mark account image models whose catalogue publishes `edits` with supportsImageReference and run `image edit --image` with the job's snapshotted reference. - Accept one image reference for any model that reports supportsImageReference in the gateway, the Studio asset composer and the MCP tool descriptions. - Reject a caller mode that differs from an account model's catalogue mode, so speech and music cannot be swapped on one model. - Update provider docs, media skills and READMEs. * fix(render): retry socket-buffer failures with fewer workers (#443) Co-authored-by: 罗高 <luogao@users.noreply.github.com> * [OPEND-5344] feat(skills): streamline unchanged template file delivery (#440) * feat(skills): streamline unchanged template file delivery * test(ci): run unchanged template delivery regressions * fix(skills): exclude render outputs and caches from template packages HTML packaging for unchanged template delivery only filtered tool caches, so a project that had produced a Studio render shipped renders/*.mp4 (and dist/, output/ or arbitrary .hyperframes cache files) inside HTML/ and HTML.zip while the receipt still pinned the revision and claimed sourceUnchanged. Mirror the WorkspaceStore non-source directories and restrict .hyperframes to the pinned native entries plus history-id, so the package holds exactly the pinned source. Extend the delivery test fixture with render outputs and cache files and assert the receipt, the written tree and the ZIP contain only pinned source. Generated-By: looper 0.16.2 (runner=fixer, agent=pi) * fix(skills): reject unpinned drift and quoted CSS imports in template packaging HTML packaging accepted any file the workspace added after the pinned project read, so a native manifest or ordinary source written mid-delivery was shipped under the old revision with sourceUnchanged: true, and the second scan could not notice because both scans contained it. Packaging now requires the scanned source set to equal the pinned inventory plus editor-only metadata (.hyperframes/history-id), and dotted entries mirror WorkspaceStore caches. Quoted CSS @import targets were also missed by the dependency scan, so a missing or remote stylesheet still produced dependencies: "local". Quoted imports are now resolved relative to their containing file, including inside HTML <style>. Generated-By: looper 0.16.2 (runner=fixer, agent=pi) * fix(skills): scope quoted import validation to active CSS * fix(skills): ship vendored dist dependencies in template packages Excluding `dist` at any depth mirrored the WorkspaceStore revision and dropped files the page actually loads, so packaging `vendor/gsap-3.14.2/dist/gsap.min.js` was skipped and the dependency check then rejected decision-tree, nyt-graph and product-promo with MISSING_DEPENDENCY. Keep render outputs, node_modules and caches out of the package but treat store-ignored dist trees as packageable non-revision content: scan them, ship them, and allow them outside the pinned inventory while unpinned source additions still fail. Restore a `vendor/.../dist/...` dependency case in the delivery tests and describe the packaging rule accurately. Generated-By: looper 0.16.2 (runner=fixer, agent=pi) --------- Co-authored-by: bone3deep1962-collab <bone3deep1962@gmail.com> Co-authored-by: 罗高 <luogao@users.noreply.github.com> * Expect the enlarged account catalogue in the settings browser check The shared account fixture now publishes five media models (image, video, speech, a non-editing image model and music) and maps the music row into the account catalogue, so the account provider renders seven model rows instead of five. The browser check waited for exactly five rows and would have timed out; it now expects the seven rows the fixture produces, alongside the two language models. Generated-By: looper 0.16.2 (runner=fixer, agent=pi) * fix(installer): recover Windows host setup and legacy workspaces (#434) * fix(installer): recover Windows host setup and legacy workspaces * fix(installer): preserve registered Harness bundles across failures * fix(runtime): preserve kill signal for native spawn cancellation --------- Co-authored-by: stevenguotj <stevenguotj@stevenguotjdeMacBook-Pro.local> * Restore optional npm installation and the existing release workflow (#444) * Restore optional npm installation and manual release workflows * Localize the optional npm README sections and align the install.md note Translate the new optional npm installation section in README.zh-CN.md, docs/README.zh-CN.md and docs/README.ja.md so the shipped localized READMEs keep localized headings, instructions and link labels next to the existing source-install prompt. Reword docs/release-guide.md to describe docs/install.md the same way as docs/release-workflows.md: it is not a generator input, but the source repository entry that routes explicitly selected npm installations to the published stable or test guide while install.md remains the default route. Generated-By: looper 0.16.2 (runner=fixer, agent=pi) --------- Co-authored-by: bone3deep1962-collab <bone3deep1962@gmail.com> Co-authored-by: 罗高 <luogao@users.noreply.github.com> * List Claude Motion before CapCut across the localized READMEs (#453) Co-authored-by: joeylee12629-star <236967869+joeylee12629-star@users.noreply.github.com> * [OPEND-5342] Select media by content need and prefer matching OpenMotion capabilities (#439) * [OPEND-5342] Keep media sourcing within OpenMotion workflows * [OPEND-5342] Route media tools by content need and capability --------- Co-authored-by: bone3deep1962-collab <bone3deep1962@gmail.com> * Add unified asset use, media reads and per-action MCP telemetry (#455) * Add unified asset use tool with bounded media reads * Track asset tool actions across MCP transports --------- Co-authored-by: 罗高 <luogao@users.noreply.github.com> --------- Co-authored-by: heggria <bshengtao@gmail.com> Co-authored-by: open-design-crew[bot] <299007234+open-design-crew[bot]@users.noreply.github.com> Co-authored-by: 罗高 <luogao@users.noreply.github.com> Co-authored-by: MasonJJ <jinmeihong@refly.ai> Co-authored-by: bone3deep1962-collab <bone3deep1962@gmail.com> Co-authored-by: stevenguotj <stevenguotj@stevenguotjdeMacBook-Pro.local> Co-authored-by: Joey-nexu <joeylee12629@gmail.com> Co-authored-by: joeylee12629-star <236967869+joeylee12629-star@users.noreply.github.com>
78 lines
6.7 KiB
TypeScript
78 lines
6.7 KiB
TypeScript
import type { Model } from './gateway.ts';
|
|
|
|
export type GenerationOption = {
|
|
key: string; label: string; kind: 'choice' | 'number' | 'boolean' | 'text';
|
|
choices?: { value: string | number; label: string; requires?: Record<string, string | number> }[];
|
|
default?: string | number | boolean; min?: number; max?: number; step?: number;
|
|
presentation?: 'ratio' | 'count'; required?: boolean;
|
|
};
|
|
export type GenerationOptions = { delivery: 'provider' | 'prompt'; fields: GenerationOption[] };
|
|
const choice = (key: string, label: string, values: (string | number)[], value?: string | number, presentation?: GenerationOption['presentation']): GenerationOption => ({ key, label, kind: 'choice', choices: values.map(value => ({ value, label: String(value) })), default: value, presentation });
|
|
const number = (key: string, label: string, value?: number, min?: number, max?: number, step = 1): GenerationOption => ({ key, label, kind: 'number', default: value, min, max, step });
|
|
const toggle = (key: string, label: string, value = false): GenerationOption => ({ key, label, kind: 'boolean', default: value });
|
|
const text = (key: string, label: string, required = false): GenerationOption => ({ key, label, kind: 'text', required });
|
|
|
|
/** Exact endpoint profiles, checked 2026-11-15. Sources: docs/generation-options.md.
|
|
* An unknown catalogue model deliberately gets no guessed schema. */
|
|
export function generationOptions(model: Model): GenerationOptions | undefined {
|
|
const endpoint = `${model.provider}:${model.modelId}`;
|
|
if (endpoint === 'codex:image-generation' && model.modality === 'image') return { delivery: 'prompt', fields: [
|
|
choice('aspect_ratio', 'Aspect ratio', ['1:1', '4:3', '3:4', '16:9', '9:16'], undefined, 'ratio'),
|
|
choice('background', 'Background', ['opaque', 'transparent']),
|
|
] };
|
|
let fields: GenerationOption[] | undefined;
|
|
if (endpoint === 'atlascloud:google/nano-banana-2/text-to-image' && model.modality === 'image') fields = [
|
|
choice('aspect_ratio', 'Aspect ratio', ['1:1', '3:2', '2:3', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9'], undefined, 'ratio'),
|
|
choice('resolution', 'Resolution', ['1k', '2k', '4k']), choice('output_format', 'Output format', ['default', 'png', 'jpeg']),
|
|
choice('thinking_level', 'Thinking level', ['default', 'minimal', 'high']), toggle('enable_web_search', 'Web search'), number('seed', 'Seed', -1),
|
|
];
|
|
if (endpoint === 'atlascloud:bytedance/seedance-2.0/text-to-video' && model.modality === 'video') fields = [
|
|
choice('ratio', 'Aspect ratio', ['adaptive', '16:9', '4:3', '1:1', '3:4', '9:16', '21:9'], undefined, 'ratio'),
|
|
{ ...choice('resolution', 'Resolution', []), choices: ['480p', '720p', '720p-SR', '1080p', '1080p-SR', '1440p-SR', '4k'].map(value => ({ value, label: value, ...(value === '4k' ? { requires: { ratio: '16:9' } } : {}) })) },
|
|
choice('duration', 'Duration (seconds)', [-1, ...Array.from({ length: 12 }, (_, i) => i + 4)], 5),
|
|
toggle('generate_audio', 'Generate audio', true), choice('bitrate_mode', 'Bitrate', ['standard', 'high']), number('seed', 'Seed'),
|
|
];
|
|
if (endpoint === 'atlascloud:suno/chirp-v4' && model.modality === 'audio') fields = [toggle('instrumental', 'Instrumental only'), choice('vocal_gender', 'Vocal gender', ['Male', 'Female'])];
|
|
if (endpoint === 'fal:fal-ai/flux/schnell' && model.modality === 'image') fields = [
|
|
{ ...choice('image_size', 'Image size', [], 'landscape_4_3', 'ratio'), choices: [
|
|
['square_hd', '1:1 HD'], ['square', '1:1'], ['portrait_4_3', '3:4'], ['portrait_16_9', '9:16'], ['landscape_4_3', '4:3'], ['landscape_16_9', '16:9'],
|
|
].map(([value, label]) => ({ value, label })) },
|
|
{ ...number('num_images', 'Output count', 1, 1), presentation: 'count' }, choice('output_format', 'Output format', ['jpeg', 'png'], 'jpeg'), number('seed', 'Seed'),
|
|
];
|
|
if (endpoint === 'fal:fal-ai/wan/v2.2-a14b/text-to-video' && model.modality === 'video') fields = [
|
|
choice('aspect_ratio', 'Aspect ratio', ['16:9', '9:16', '1:1'], '16:9', 'ratio'), choice('resolution', 'Resolution', ['480p', '580p', '720p'], '720p'),
|
|
number('num_frames', 'Frames', 81, 17, 161), number('frames_per_second', 'Frames per second', 16, 4, 60),
|
|
toggle('enable_prompt_expansion', 'Expand prompt'), text('negative_prompt', 'Negative prompt'), number('seed', 'Seed'),
|
|
];
|
|
if (endpoint === 'fal:fal-ai/kokoro/american-english' && model.modality === 'audio') fields = [
|
|
choice('voice', 'Speech voice', ['af_heart', 'af_alloy', 'af_aoede', 'af_bella', 'af_jessica', 'af_kore', 'af_nicole', 'af_nova', 'af_river', 'af_sarah', 'af_sky', 'am_adam', 'am_echo', 'am_eric', 'am_fenrir', 'am_liam', 'am_michael', 'am_onyx', 'am_puck', 'am_santa'], 'af_heart'),
|
|
number('speed', 'Speech speed', 1, undefined, undefined, 0.1),
|
|
];
|
|
if (['opendesign', 'account'].includes(model.provider) && model.mode === 'text-to-speech') fields = [text('voice', 'Voice ID', true)];
|
|
// The connector's `audio music --duration` takes whole seconds; music models publish no duration range.
|
|
if (model.provider === 'account' && model.modality === 'audio' && model.mode === 'text-to-audio') fields = [number('duration', 'Duration (seconds)', undefined, 1)];
|
|
return fields ? { delivery: 'provider', fields } : undefined;
|
|
}
|
|
|
|
/** Validate maintained fields; preserve the advanced provider-native escape hatch. */
|
|
export function validateGenerationOptions(model: Model, parameters: Record<string, unknown>) {
|
|
for (const field of generationOptions(model)?.fields ?? []) {
|
|
const value = parameters[field.key];
|
|
if (value === undefined) { if (field.required) throw new Error(`${field.label} is required`); continue; }
|
|
// fal also accepts custom dimensions; the quick picker is only a subset.
|
|
if (field.key === 'image_size' && value && typeof value === 'object' && !Array.isArray(value)) {
|
|
const { width, height } = value as Record<string, unknown>;
|
|
if ([width, height].every(n => typeof n === 'number' && Number.isInteger(n) && n > 0)) continue;
|
|
}
|
|
const valid = field.kind === 'choice' ? field.choices?.some(c => c.value === value)
|
|
: field.kind === 'boolean' ? typeof value === 'boolean'
|
|
: field.kind === 'text' ? typeof value === 'string' && (!field.required || !!value.trim())
|
|
: typeof value === 'number' && Number.isFinite(value) && (field.step !== 1 || Number.isInteger(value)) && (field.min === undefined || value >= field.min) && (field.max === undefined || value <= field.max);
|
|
if (!valid) throw new Error(`Invalid ${field.label}: ${field.key}`);
|
|
const requires = field.choices?.find(c => c.value === value)?.requires;
|
|
if (requires) for (const [key, required] of Object.entries(requires)) {
|
|
if (parameters[key] !== required) throw new Error(`${field.label} ${value} requires ${key} ${required}`);
|
|
}
|
|
}
|
|
}
|